krop's commit fixes my problem in a better way, reverting
[kdepim.git] / knotes / knotesapp.h
blob5fe89f65e855422855fe3f83bbda4902c171578b
1 /*******************************************************************
2 KNotes -- Notes for the KDE project
4 Copyright (c) 1997-2006, The KNotes Developers
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 *******************************************************************/
21 #ifndef KNOTESAPP_H
22 #define KNOTESAPP_H
24 #include <QDomDocument>
25 #include <QList>
26 #include <QMap>
27 #include <QString>
28 #include <QWidget>
30 #include <kapplication.h>
31 #include <ksessionmanager.h>
32 #include <kxmlguiclient.h>
34 class QTcpServer;
36 class KAction;
37 class KFind;
38 class KMenu;
39 class KNote;
40 class KNotesAlarm;
41 class KNotesResourceManager;
42 class KXMLGUIBuilder;
43 class KXMLGUIFactory;
44 class KNotificationItem;
46 namespace KCal {
47 class Journal;
49 namespace DNSSD {
50 class PublicService;
53 class KNotesApp
54 : public QWidget, public KSessionManager, virtual public KXMLGUIClient
56 Q_OBJECT
57 public:
58 KNotesApp();
59 ~KNotesApp();
61 void showNote( const QString &id ) const;
62 void hideNote( const QString &id ) const;
64 void killNote( const QString &id );
65 void killNote( const QString &id, bool force );
67 QString name( const QString &id ) const;
68 QString text( const QString &id ) const;
70 void setName( const QString &id, const QString &newName );
71 void setText( const QString &id, const QString &newText );
73 QMap<QString,QString> notes() const;
75 bool commitData( QSessionManager & );
77 public slots:
78 QString newNote( const QString &name = QString(),
79 const QString &text = QString() );
80 QString newNoteFromClipboard( const QString &name = QString() );
82 void hideAllNotes() const;
83 void showAllNotes() const;
85 protected slots:
86 void slotActivateRequested( bool, const QPoint& pos);
87 void slotSecondaryActivateRequested( const QPoint& );
88 void slotShowNote();
89 void slotWalkThroughNotes();
91 void slotOpenFindDialog();
92 void slotFindNext();
94 void slotPreferences();
95 void slotConfigureAccels();
97 void slotNoteKilled( KCal::Journal *journal );
99 void slotQuit();
101 private:
102 void showNote( KNote *note ) const;
103 void saveConfigs();
105 private slots:
106 void acceptConnection();
107 void saveNotes();
108 void saveNotes( const QString & uid );
109 void updateNoteActions();
110 void updateNetworkListener();
111 void updateStyle();
113 void createNote( KCal::Journal *journal );
114 void killNote( KCal::Journal *journal );
116 private:
117 QMap<QString, KNote *> m_notes;
118 QList<QAction *> m_noteActions;
120 KNotesResourceManager *m_manager;
121 KNotesAlarm *m_alarm;
122 QTcpServer *m_listener;
123 DNSSD::PublicService *m_publisher;
125 KFind *m_find;
126 QMap<QString, KNote *>::iterator *m_findPos;
128 KMenu *m_noteMenu;
129 KMenu *m_contextMenu;
131 KXMLGUIFactory *m_guiFactory;
132 KXMLGUIBuilder *m_guiBuilder;
133 KNotificationItem *m_tray;
134 KAction *m_findAction;
136 QDomDocument m_noteGUI;
137 QString m_noteUidModify;
140 #endif