knotesapp.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KNOTESAPP_H
00022 #define KNOTESAPP_H
00023
00024 #include <qstring.h>
00025 #include <qptrlist.h>
00026 #include <qdict.h>
00027 #include <qlabel.h>
00028
00029 #include <kapplication.h>
00030 #include <kxmlguiclient.h>
00031 #include <kxmlguibuilder.h>
00032
00033 #include "KNotesIface.h"
00034
00035 class KNote;
00036 class KPopupMenu;
00037 class KAction;
00038 class KActionMenu;
00039 class KGlobalAccel;
00040 class KXMLGUIFactory;
00041
00042
00043 class KNotesApp : public QLabel, virtual public KNotesIface, public KSessionManaged,
00044 public KXMLGUIBuilder, virtual public KXMLGUIClient
00045 {
00046 Q_OBJECT
00047 public:
00048 KNotesApp();
00049 ~KNotesApp();
00050
00051 int newNote( QString name = QString::null, const QString& text = QString::null );
00052 int newNoteFromClipboard( QString name = QString::null );
00053 void showNote( const QString& name ) const;
00054 void showNote( int noteId ) const;
00055 void hideNote( const QString& name ) const;
00056 void hideNote( int noteId ) const;
00057 void killNote( const QString& name );
00058 void killNote( int noteId );
00059
00060 QMap<int,QString> notes() const;
00061 QString text( const QString& name ) const;
00062 QString text( int noteId ) const;
00063 void setName( const QString& oldName, const QString& newName );
00064 void setName( int noteId, const QString& newName );
00065 void setText( const QString& name, const QString& newText );
00066 void setText( int noteId, const QString& newText );
00067
00068 void sync( const QString& app );
00069 bool isNew( const QString& app, const QString& name ) const;
00070 bool isNew( const QString& app, int noteId ) const;
00071 bool isModified( const QString& app, const QString& name ) const;
00072 bool isModified( const QString& app, int noteId ) const;
00073
00074 bool commitData( QSessionManager& );
00075 bool saveState( QSessionManager& );
00076
00077 protected:
00078 void mousePressEvent( QMouseEvent* );
00079 bool eventFilter( QObject*, QEvent* );
00080
00081 protected slots:
00082 void slotNewNote();
00083 void slotNewNoteFromClipboard();
00084 void slotShowNote();
00085
00086 void slotPreferences() const;
00087 void slotConfigureAccels();
00088
00089 void slotNoteKilled( const QString& name );
00090 void slotNoteRenamed( const QString& oldname, const QString& newname );
00091
00092 void slotQuit();
00093
00094 private slots:
00095 void updateNoteActions();
00096 void updateGlobalAccels();
00097
00098 private:
00099 KNote* noteById( int id ) const;
00100 void showNote( KNote* note ) const;
00101 void saveNotes( bool display ) const;
00102
00103 QDict<KNote> m_noteList;
00104 QPtrList<KAction> m_noteActions;
00105
00106 KPopupMenu* m_note_menu;
00107 KPopupMenu* m_context_menu;
00108
00109 KXMLGUIFactory* factory;
00110
00111 KGlobalAccel *globalAccel;
00112 };
00113
00114 #endif
This file is part of the documentation for kdelibs Version 3.1.4.