knotes

resourcemanager.h
1 /*******************************************************************
2  This file is part of KNotes.
3 
4  Copyright (c) 2004, Bo Thorsen <bo@sonofthor.dk>
5  2004, Michael Brade <brade@kde.org>
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20  MA 02110-1301, USA.
21 
22  In addition, as a special exception, the copyright holders give
23  permission to link the code of this program with any edition of
24  the TQt library by Trolltech AS, Norway (or with modified versions
25  of TQt that use the same license as TQt), and distribute linked
26  combinations including the two. You must obey the GNU General
27  Public License in all respects for all of the code used other than
28  TQt. If you modify this file, you may extend this exception to
29  your version of the file, but you are not obligated to do so. If
30  you do not wish to do so, delete this exception statement from
31  your version.
32 *******************************************************************/
33 
34 #ifndef KNOTES_RESOURCEMANAGER_H
35 #define KNOTES_RESOURCEMANAGER_H
36 
37 #include <knotes/resourcenotes.h>
38 #include <tderesources/manager.h>
39 
40 #include <libkcal/alarm.h>
41 
42 class KNotesApp;
43 class KNote;
44 
45 namespace KCal {
46  class Journal;
47 }
48 
49 
50 class KNotesResourceManager : public TQObject, public KRES::ManagerObserver<ResourceNotes>
51 {
52  TQ_OBJECT
53 
54 public:
55  KNotesResourceManager();
56  virtual ~KNotesResourceManager();
57 
58  void load();
59  void save();
60 
61  bool addNewNote( KCal::Journal *journal );
62  void registerNote( ResourceNotes *resource, KCal::Journal *journal );
63 
64  void deleteNote( KCal::Journal *journal );
65 
66  KCal::Alarm::List alarms( const TQDateTime& from, const TQDateTime& to );
67 
68  // from the ManagerObserver interface
69  virtual void resourceAdded( ResourceNotes *resource );
70  virtual void resourceModified( ResourceNotes *resource );
71  virtual void resourceDeleted( ResourceNotes *resource );
72 
73 signals:
74  void sigRegisteredNote( KCal::Journal *journal );
75  void sigDeregisteredNote( KCal::Journal *journal );
76 
77 private:
78  KRES::Manager<ResourceNotes> *m_manager;
79  TQDict<ResourceNotes> m_resourceMap;
80 };
81 
82 
83 #endif // RESOURCEMANAGER_H
This class provides the interfaces for a KNotes resource.
Definition: resourcenotes.h:56