knotes

knotesapp.h

00001 /*******************************************************************
00002  KNotes -- Notes for the KDE project
00003 
00004  Copyright (c) 1997-2005, 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 <qstring.h>
00025 #include <qdict.h>
00026 #include <qptrlist.h>
00027 #include <qlabel.h>
00028 #include <qdom.h>
00029 
00030 #include <kapplication.h>
00031 #include <kxmlguiclient.h>
00032 
00033 #include "KNotesAppIface.h"
00034 
00035 class KFind;
00036 class KNote;
00037 class KPopupMenu;
00038 class KAction;
00039 class KActionMenu;
00040 class KGlobalAccel;
00041 class KXMLGUIFactory;
00042 class KXMLGUIBuilder;
00043 class KExtendedSocket;
00044 class KNotesAlarm;
00045 class KNotesResourceManager;
00046 
00047 namespace KCal {
00048     class Journal;
00049 }
00050 
00051 
00052 class KNotesApp : public QLabel, public KSessionManaged, virtual public KXMLGUIClient,
00053     virtual public KNotesAppIface
00054 {
00055     Q_OBJECT
00056 public:
00057     KNotesApp();
00058     ~KNotesApp();
00059 
00060     void showNote( const QString& id ) const;
00061     void hideNote( const QString& id ) const;
00062 
00063     void killNote( const QString& id );
00064     void killNote( const QString& id, bool force );
00065 
00066     QString name( const QString& id ) const;
00067     QString text( const QString& id ) const;
00068 
00069     void setName( const QString& id, const QString& newName );
00070     void setText( const QString& id, const QString& newText );
00071 
00072     QMap<QString,QString> notes() const;
00073 
00074     void sync( const QString& app );
00075     bool isNew( const QString& app, const QString& id ) const;
00076     bool isModified( const QString& app, const QString& id ) const;
00077 
00078     bool commitData( QSessionManager& );
00079 
00080 public slots:
00081     QString newNote( const QString& name = QString::null,
00082                      const QString& text = QString::null );
00083     QString newNoteFromClipboard( const QString& name = QString::null );
00084 
00085     void hideAllNotes() const;
00086     void showAllNotes() const;
00087 
00088 protected:
00089     void mousePressEvent( QMouseEvent* );
00090 
00091 protected slots:
00092     void slotShowNote();
00093     void slotWalkThroughNotes();
00094 
00095     void slotOpenFindDialog();
00096     void slotFindNext();
00097 
00098     void slotPreferences();
00099     void slotConfigureAccels();
00100 
00101     void slotNoteKilled( KCal::Journal *journal );
00102 
00103     void slotQuit();
00104 
00105 private:
00106     void showNote( KNote *note ) const;
00107     void saveConfigs();
00108 
00109 private slots:
00110     void acceptConnection();
00111     void saveNotes();
00112     void updateNoteActions();
00113     void updateGlobalAccels();
00114     void updateNetworkListener();
00115     void updateStyle();
00116 
00117     void createNote( KCal::Journal *journal );
00118     void killNote( KCal::Journal *journal );
00119 
00120 private:
00121     class KNoteActionList : public QPtrList<KAction>
00122     {
00123     public:
00124         virtual int compareItems( QPtrCollection::Item s1, QPtrCollection::Item s2 );
00125     };
00126 
00127     KNotesResourceManager *m_manager;
00128 
00129     KNotesAlarm     *m_alarm;
00130     KExtendedSocket *m_listener;
00131 
00132     QDict<KNote>    m_noteList;
00133     KNoteActionList m_noteActions;
00134 
00135     KFind           *m_find;
00136     QDictIterator<KNote> *m_findPos;
00137 
00138     KPopupMenu      *m_note_menu;
00139     KPopupMenu      *m_context_menu;
00140 
00141     KGlobalAccel    *m_globalAccel;
00142     KXMLGUIFactory  *m_guiFactory;
00143     KXMLGUIBuilder  *m_guiBuilder;
00144 
00145     QDomDocument    m_noteGUI;
00146 };
00147 
00148 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys