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 
00029 #include <kapplication.h>
00030 #include <kxmlguiclient.h>
00031 #include <kxmlguibuilder.h>
00032 
00033 #include "libkcal/calendarlocal.h"
00034 
00035 #include "KNotesIface.h"
00036 
00037 class KNote;
00038 class KNoteConfig;
00039 class KPopupMenu;
00040 class KAction;
00041 class KActionMenu;
00042 class KGlobalAccel;
00043 class KXMLGUIFactory;
00044 
00045 namespace KCal {
00046     class Journal;
00047 }
00048 
00049 
00050 class KNotesApp : public QLabel, virtual public KNotesIface, public KSessionManaged,
00051     public KXMLGUIBuilder, virtual public KXMLGUIClient
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 protected:
00084     void mousePressEvent( QMouseEvent* );
00085     bool eventFilter( QObject*, QEvent* );
00086 
00087 protected slots:
00088     void slotShowNote();
00089 
00090     void slotPreferences();
00091     void slotConfigureAccels();
00092 
00093     void slotNoteKilled( KCal::Journal *journal );
00094 
00095     void slotQuit();
00096 
00097 private:
00098     void showNote( KNote *note ) const;
00099     void saveConfigs();
00100 
00101 private slots:
00102     void saveNotes();
00103     void updateNoteActions();
00104     void updateGlobalAccels();
00105 
00106     void createNote( KCal::Journal *journal );
00107 
00108 private:
00109     class KNoteActionList : public QPtrList<KAction>
00110     {
00111     public:
00112         virtual int compareItems( QPtrCollection::Item s1, QPtrCollection::Item s2 );
00113     };
00114 
00115     KCal::CalendarLocal m_calendar;
00116 
00117     KNoteConfig     *m_defaultConfig;
00118 
00119     QDict<KNote>    m_noteList;
00120     KNoteActionList m_noteActions;
00121 
00122     KPopupMenu      *m_note_menu;
00123     KPopupMenu      *m_context_menu;
00124 
00125     KGlobalAccel    *m_globalAccel;
00126     KXMLGUIFactory  *m_guiFactory;
00127 };
00128 
00129 #endif
KDE Logo
This file is part of the documentation for knotes Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:36:55 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003