knotes
knotesapp.h00001
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 <tqstring.h>
00025 #include <tqdict.h>
00026 #include <tqptrlist.h>
00027 #include <tqlabel.h>
00028 #include <tqdom.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 KNotesAlarm;
00044 class KNotesResourceManager;
00045
00046 namespace KCal {
00047 class Journal;
00048 }
00049
00050 namespace KNetwork {
00051 class KServerSocket;
00052 }
00053
00054
00055 class KNotesApp : public TQLabel, public KSessionManaged, virtual public KXMLGUIClient,
00056 virtual public KNotesAppIface
00057 {
00058 Q_OBJECT
00059 TQ_OBJECT
00060 public:
00061 KNotesApp();
00062 ~KNotesApp();
00063
00064 void showNote( const TQString& id ) const;
00065 void hideNote( const TQString& id ) const;
00066
00067 void killNote( const TQString& id );
00068 void killNote( const TQString& id, bool force );
00069
00070 TQString name( const TQString& id ) const;
00071 TQString text( const TQString& id ) const;
00072
00073 void setName( const TQString& id, const TQString& newName );
00074 void setText( const TQString& id, const TQString& newText );
00075
00076 TQString fgColor( const TQString& id ) const;
00077 TQString bgColor( const TQString& id ) const;
00078
00079 void setColor( const TQString& id, const TQString& fgColor,
00080 const TQString& bgColor );
00081
00082 TQMap<TQString,TQString> notes() const;
00083
00084 int width( const TQString& noteId ) const;
00085 int height( const TQString& noteId ) const;
00086
00087 void move( const TQString& noteId, int x, int y ) const;
00088 void resize( const TQString& noteId, int width, int height ) const;
00089
00090 void sync( const TQString& app );
00091 bool isNew( const TQString& app, const TQString& id ) const;
00092 bool isModified( const TQString& app, const TQString& id ) const;
00093
00094 bool commitData( TQSessionManager& );
00095
00096 public slots:
00097 TQString newNote( const TQString& name = TQString(),
00098 const TQString& text = TQString() );
00099 TQString newNoteFromClipboard( const TQString& name = TQString() );
00100
00101 void hideAllNotes() const;
00102 void showAllNotes() const;
00103
00104 protected:
00105 void mousePressEvent( TQMouseEvent* );
00106 void resizeEvent ( TQResizeEvent * );
00107
00108 protected slots:
00109 void slotShowNote();
00110 void slotWalkThroughNotes();
00111
00112 void slotOpenFindDialog();
00113 void slotFindNext();
00114
00115 void slotPreferences();
00116 void slotConfigureAccels();
00117
00118 void slotNoteKilled( KCal::Journal *journal );
00119
00120 void slotQuit();
00121
00122 private:
00123 void showNote( KNote *note ) const;
00124 void saveConfigs();
00125
00126 private slots:
00127 void acceptConnection();
00128 void saveNotes();
00129 void saveNotes( const TQString & uid );
00130 void updateNoteActions();
00131 void updateGlobalAccels();
00132 void updateNetworkListener();
00133 void updateStyle();
00134
00135 void createNote( KCal::Journal *journal );
00136 void killNote( KCal::Journal *journal );
00137
00138 private:
00139 class KNoteActionList : public TQPtrList<KAction>
00140 {
00141 public:
00142 virtual int compareItems( TQPtrCollection::Item s1, TQPtrCollection::Item s2 );
00143 };
00144
00145 KNotesResourceManager *m_manager;
00146
00147 KNotesAlarm *m_alarm;
00148 KNetwork::KServerSocket *m_listener;
00149
00150 TQDict<KNote> m_noteList;
00151 KNoteActionList m_noteActions;
00152
00153 KFind *m_find;
00154 TQDictIterator<KNote> *m_findPos;
00155
00156 KPopupMenu *m_note_menu;
00157 KPopupMenu *m_context_menu;
00158
00159 KGlobalAccel *m_globalAccel;
00160 KXMLGUIFactory *m_guiFactory;
00161 KXMLGUIBuilder *m_guiBuilder;
00162
00163 TQDomDocument m_noteGUI;
00164 KAction *m_findAction;
00165 TQString m_noteUidModify;
00166 };
00167
00168 #endif
|