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 <qdict.h>
00026
#include <qptrlist.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
class KExtendedSocket;
00042
class KNotesResourceManager;
00043
00044
namespace KCal {
00045
class Journal;
00046 }
00047
00048
00049
class KNotesApp :
public QLabel,
virtual public KNotesIface,
public KSessionManaged,
00050
public KXMLGUIBuilder,
virtual public KXMLGUIClient
00051 {
00052 Q_OBJECT
00053
public:
00054 KNotesApp();
00055 ~KNotesApp();
00056
00057
void showNote(
const QString&
id )
const;
00058
void hideNote(
const QString&
id )
const;
00059
00060
void killNote(
const QString&
id );
00061
void killNote(
const QString&
id,
bool force );
00062
00063
QString name(
const QString&
id )
const;
00064
QString text(
const QString&
id )
const;
00065
00066
void setName(
const QString&
id,
const QString& newName );
00067
void setText(
const QString&
id,
const QString& newText );
00068
00069
QMap<QString,QString> notes() const;
00070
00071
void sync( const
QString& app );
00072
bool isNew( const
QString& app, const
QString&
id ) const;
00073
bool isModified( const
QString& app, const
QString&
id ) const;
00074
00075
bool commitData(
QSessionManager& );
00076
00077 public slots:
00078
QString newNote( const
QString& name =
QString::null,
00079 const
QString& text =
QString::null );
00080
QString newNoteFromClipboard( const
QString& name =
QString::null );
00081
00082 protected:
00083
void mousePressEvent(
QMouseEvent* );
00084
bool eventFilter(
QObject*,
QEvent* );
00085
00086 protected slots:
00087
void slotShowNote();
00088
00089
void slotPreferences();
00090
void slotConfigureAccels();
00091
00092
void slotNoteKilled( KCal::Journal *journal );
00093
00094
void slotQuit();
00095
00096 private:
00097
void showNote( KNote *note ) const;
00098
void saveConfigs();
00099
00100 private slots:
00101
void acceptConnection();
00102
void saveNotes();
00103
void updateNoteActions();
00104
void updateGlobalAccels();
00105
void updateNetworkListener();
00106
00107
void createNote( KCal::Journal *journal );
00108
void killNote( KCal::Journal *journal );
00109
00110 private:
00111 class KNoteActionList : public
QPtrList<KAction>
00112 {
00113
public:
00114
virtual int compareItems( QPtrCollection::Item s1, QPtrCollection::Item s2 );
00115 };
00116
00117 KNotesResourceManager *m_manager;
00118
00119 KExtendedSocket *m_listener;
00120
00121
QDict<KNote> m_noteList;
00122 KNoteActionList m_noteActions;
00123
00124 KPopupMenu *m_note_menu;
00125 KPopupMenu *m_context_menu;
00126
00127 KGlobalAccel *m_globalAccel;
00128 KXMLGUIFactory *m_guiFactory;
00129 };
00130
00131
#endif