knotes Library API Documentation

knotesapp.h

00001 /*******************************************************************
00002  KNotes -- Notes for the KDE project
00003 
00004  Copyright (c) 1997-2001, 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., 675 Mass Ave, Cambridge, MA 02139, 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 "KNotesIface.h"
00034 
00035 class KNote;
00036 class KPopupMenu;
00037 class KAction;
00038 class KActionMenu;
00039 class KGlobalAccel;
00040 class KXMLGUIFactory;
00041 
00042 
00043 class KNotesApp : public QLabel, virtual public KNotesIface, public KSessionManaged,
00044     public KXMLGUIBuilder, virtual public KXMLGUIClient
00045 {
00046     Q_OBJECT
00047 public:
00048     KNotesApp();
00049     ~KNotesApp();
00050 
00051     int newNote( QString name = QString::null, const QString& text = QString::null );
00052     int newNoteFromClipboard( QString name = QString::null );
00053     void showNote( const QString& name ) const;
00054     void showNote( int noteId ) const;
00055     void hideNote( const QString& name ) const;
00056     void hideNote( int noteId ) const;
00057     void killNote( const QString& name );
00058     void killNote( int noteId );
00059 
00060     QMap<int,QString> notes() const;
00061     QString text( const QString& name ) const;
00062     QString text( int noteId ) const;
00063     void setName( const QString& oldName, const QString& newName );
00064     void setName( int noteId, const QString& newName );
00065     void setText( const QString& name, const QString& newText );
00066     void setText( int noteId, const QString& newText );
00067 
00068     void sync( const QString& app );
00069     bool isNew( const QString& app, const QString& name ) const;
00070     bool isNew( const QString& app, int noteId ) const;
00071     bool isModified( const QString& app, const QString& name ) const;
00072     bool isModified( const QString& app, int noteId ) const;
00073     
00074     bool commitData( QSessionManager& );
00075     bool saveState( QSessionManager& );
00076 
00077 protected:
00078     void mousePressEvent( QMouseEvent* );
00079     bool eventFilter( QObject*, QEvent* );
00080 
00081 protected slots:
00082     void slotNewNote();
00083     void slotNewNoteFromClipboard();
00084     void slotShowNote();
00085 
00086     void slotPreferences() const;
00087     void slotConfigureAccels();
00088 
00089     void slotNoteKilled( const QString& name );
00090     void slotNoteRenamed( const QString& oldname, const QString& newname );
00091 
00092     void slotQuit();
00093     
00094 private slots:
00095     void updateNoteActions();
00096     void updateGlobalAccels();
00097 
00098 private:
00099     KNote* noteById( int id ) const;
00100     void showNote( KNote* note ) const;
00101     void saveNotes( bool display ) const;
00102 
00103     QDict<KNote>      m_noteList;
00104     QPtrList<KAction> m_noteActions;
00105 
00106     KPopupMenu* m_note_menu;
00107     KPopupMenu* m_context_menu;
00108 
00109     KXMLGUIFactory* factory;
00110 
00111     KGlobalAccel *globalAccel;
00112 };
00113 
00114 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:46:58 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001