knotes
knotesapp.h
Go to the documentation of this file.00001 /******************************************************************* 00002 KNotes -- Notes for the KDE project 00003 00004 Copyright (c) 1997-2006, The KNotes Developers 00005 00006 This program is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU General Public License 00008 as published by the Free Software Foundation; either version 2 00009 of the License, or (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 *******************************************************************/ 00020 00021 #ifndef KNOTESAPP_H 00022 #define KNOTESAPP_H 00023 00024 #include <QDomDocument> 00025 #include <QList> 00026 #include <QMap> 00027 #include <QString> 00028 #include <QWidget> 00029 00030 #include <kapplication.h> 00031 #include <ksessionmanager.h> 00032 #include <ksystemtrayicon.h> 00033 #include <kxmlguiclient.h> 00034 00035 class QTcpServer; 00036 00037 class KAction; 00038 class KFind; 00039 class KMenu; 00040 class KNote; 00041 class KNotesAlarm; 00042 class KNotesResourceManager; 00043 class KXMLGUIBuilder; 00044 class KXMLGUIFactory; 00045 00046 namespace KCal { 00047 class Journal; 00048 } 00049 00050 00051 class KNotesApp 00052 : public QWidget, public KSessionManager, virtual public KXMLGUIClient 00053 { 00054 Q_OBJECT 00055 public: 00056 KNotesApp(); 00057 ~KNotesApp(); 00058 00059 void showNote( const QString &id ) const; 00060 void hideNote( const QString &id ) const; 00061 00062 void killNote( const QString &id ); 00063 void killNote( const QString &id, bool force ); 00064 00065 QString name( const QString &id ) const; 00066 QString text( const QString &id ) const; 00067 00068 void setName( const QString &id, const QString &newName ); 00069 void setText( const QString &id, const QString &newText ); 00070 00071 QMap<QString,QString> notes() const; 00072 00073 bool commitData( QSessionManager & ); 00074 00075 public slots: 00076 QString newNote( const QString &name = QString(), 00077 const QString &text = QString() ); 00078 QString newNoteFromClipboard( const QString &name = QString() ); 00079 00080 void hideAllNotes() const; 00081 void showAllNotes() const; 00082 00083 protected slots: 00084 void slotActivated( QSystemTrayIcon::ActivationReason ); 00085 void slotShowNote(); 00086 void slotWalkThroughNotes(); 00087 00088 void slotOpenFindDialog(); 00089 void slotFindNext(); 00090 00091 void slotPreferences(); 00092 void slotConfigureAccels(); 00093 00094 void slotNoteKilled( KCal::Journal *journal ); 00095 00096 void slotQuit(); 00097 00098 private: 00099 void showNote( KNote *note ) const; 00100 void saveConfigs(); 00101 00102 private slots: 00103 void acceptConnection(); 00104 void saveNotes(); 00105 void updateNoteActions(); 00106 void updateNetworkListener(); 00107 void updateStyle(); 00108 00109 void createNote( KCal::Journal *journal ); 00110 void killNote( KCal::Journal *journal ); 00111 00112 private: 00113 QMap<QString, KNote *> m_notes; 00114 QList<QAction *> m_noteActions; 00115 00116 KNotesResourceManager *m_manager; 00117 KNotesAlarm *m_alarm; 00118 QTcpServer *m_listener; 00119 00120 KFind *m_find; 00121 QMap<QString, KNote *>::iterator *m_findPos; 00122 00123 KMenu *m_noteMenu; 00124 KMenu *m_contextMenu; 00125 00126 KXMLGUIFactory *m_guiFactory; 00127 KXMLGUIBuilder *m_guiBuilder; 00128 KSystemTrayIcon *m_tray; 00129 00130 QDomDocument m_noteGUI; 00131 }; 00132 00133 #endif
KDE 4.2 API Reference