knotes Library API Documentation

knotesapp.h

00001 /*******************************************************************
00002  KNotes -- Notes for the KDE project
00003 
00004  Copyright (c) 1997-2003, 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 <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 "libkcal/calendarlocal.h"
00034 
00035 #include "KNotesIface.h"
00036 
00037 class KNote;
00038 class KPopupMenu;
00039 class KAction;
00040 class KActionMenu;
00041 class KGlobalAccel;
00042 class KXMLGUIFactory;
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     QString newNote( const QString& name = QString::null,
00058                             const QString& text = QString::null );
00059     QString newNoteFromClipboard( const QString& name = QString::null );
00060 
00061     void showNote( const QString& id ) const;
00062     void hideNote( const QString& id ) const;
00063     void killNote( const QString& id, bool force );
00064     void killNote( const QString& id );
00065 
00066     QString name( const QString& id ) const;
00067     QString text( const QString& id ) const;
00068 
00069     void setName( const QString& id, const QString& newName );
00070     void setText( const QString& id, const QString& newText );
00071 
00072     QMap<QString,QString> notes() const;
00073 
00074     void sync( const QString& app );
00075     bool isNew( const QString& app, const QString& id ) const;
00076     bool isModified( const QString& app, const QString& id ) const;
00077 
00078     bool commitData( QSessionManager& );
00079 
00080 protected:
00081     void mousePressEvent( QMouseEvent* );
00082     bool eventFilter( QObject*, QEvent* );
00083 
00084 protected slots:
00085     void slotNewNote();
00086     void slotNewNoteFromClipboard();
00087     void slotShowNote();
00088 
00089     void slotPreferences() const;
00090     void slotConfigureAccels();
00091 
00092     void slotNoteKilled( KCal::Journal* );
00093 
00094     void slotQuit();
00095 
00096 private slots:
00097     void updateNoteActions();
00098     void updateGlobalAccels();
00099 
00100     void saveNotes();
00101 
00102 private:
00103     void showNote( KNote *note ) const;
00104     void saveConfig();
00105 
00106 
00107     class KNoteActionList : public QPtrList<KAction>
00108     {
00109     public:
00110         virtual int compareItems( QPtrCollection::Item s1, QPtrCollection::Item s2 );
00111     };
00112 
00113     QDict<KNote>      m_noteList;
00114     KNoteActionList   m_noteActions;
00115 
00116     KCal::CalendarLocal m_calendar;
00117 
00118     KPopupMenu *m_note_menu;
00119     KPopupMenu *m_context_menu;
00120 
00121     KXMLGUIFactory *factory;
00122 
00123     KGlobalAccel *globalAccel;
00124 };
00125 
00126 #endif
KDE Logo
This file is part of the documentation for knotes Library Version 3.2.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Mar 6 17:18:05 2004 by doxygen 1.3.6-20040222 written by Dimitri van Heesch, © 1997-2003