knotes Library API Documentation

knotesapp.h

00001 /*******************************************************************
00002  KNotes -- Notes for the KDE project
00003 
00004  Copyright (c) 1997-2004, 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 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 KNote;
00036 class KPopupMenu;
00037 class KAction;
00038 class KActionMenu;
00039 class KGlobalAccel;
00040 class KXMLGUIFactory;
00041 class KXMLGUIBuilder;
00042 class KExtendedSocket;
00043 class KNotesResourceManager;
00044 
00045 namespace KCal {
00046     class Journal;
00047 }
00048 
00049 
00050 class KNotesApp : public QLabel, public KSessionManaged, virtual public KXMLGUIClient,
00051     virtual public KNotesAppIface
00052 {
00053     Q_OBJECT
00054 public:
00055     KNotesApp();
00056     ~KNotesApp();
00057 
00058     void showNote( const QString& id ) const;
00059     void hideNote( const QString& id ) const;
00060 
00061     void killNote( const QString& id );
00062     void killNote( const QString& id, bool force );
00063 
00064     QString name( const QString& id ) const;
00065     QString text( const QString& id ) const;
00066 
00067     void setName( const QString& id, const QString& newName );
00068     void setText( const QString& id, const QString& newText );
00069 
00070     QMap<QString,QString> notes() const;
00071 
00072     void sync( const QString& app );
00073     bool isNew( const QString& app, const QString& id ) const;
00074     bool isModified( const QString& app, const QString& id ) const;
00075 
00076     bool commitData( QSessionManager& );
00077 
00078 public slots:
00079     QString newNote( const QString& name = QString::null,
00080                      const QString& text = QString::null );
00081     QString newNoteFromClipboard( const QString& name = QString::null );
00082 
00083     void hideAllNotes() const;
00084     void showAllNotes() const;
00085 
00086 protected:
00087     void mousePressEvent( QMouseEvent* );
00088 
00089 protected slots:
00090     void slotShowNote();
00091     void slotWalkThroughNotes();
00092 
00093     void slotPreferences();
00094     void slotConfigureAccels();
00095 
00096     void slotNoteKilled( KCal::Journal *journal );
00097 
00098     void slotQuit();
00099 
00100 private:
00101     void showNote( KNote *note ) const;
00102     void saveConfigs();
00103 
00104 private slots:
00105     void acceptConnection();
00106     void saveNotes();
00107     void updateNoteActions();
00108     void updateGlobalAccels();
00109     void updateNetworkListener();
00110 
00111     void createNote( KCal::Journal *journal );
00112     void killNote( KCal::Journal *journal );
00113 
00114 private:
00115     class KNoteActionList : public QPtrList<KAction>
00116     {
00117     public:
00118         virtual int compareItems( QPtrCollection::Item s1, QPtrCollection::Item s2 );
00119     };
00120 
00121     KNotesResourceManager *m_manager;
00122 
00123     KExtendedSocket *m_listener;
00124 
00125     QDict<KNote>    m_noteList;
00126     KNoteActionList m_noteActions;
00127 
00128     KPopupMenu      *m_note_menu;
00129     KPopupMenu      *m_context_menu;
00130 
00131     KGlobalAccel    *m_globalAccel;
00132     KXMLGUIFactory  *m_guiFactory;
00133     KXMLGUIBuilder  *m_guiBuilder;
00134 
00135     QDomDocument    m_noteGUI;
00136 };
00137 
00138 #endif
KDE Logo
This file is part of the documentation for knotes Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 4 14:40:42 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003