kontact

knotes_part.h

00001 /*
00002    This file is part of the KDE project
00003    Copyright (C) 2002 Daniel Molkentin <molkentin@kde.org>
00004    Copyright (C) 2004-2006 Michael Brade <brade@kde.org>
00005 
00006    This program is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 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 GNU
00014    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; see the file COPYING.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019    Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef KNOTES_PART_H
00023 #define KNOTES_PART_H
00024 
00025 #include <qdict.h>
00026 
00027 #include <kiconview.h>
00028 #include <kglobal.h>
00029 #include <kiconloader.h>
00030 
00031 #include <libkcal/journal.h>
00032 #include <kparts/part.h>
00033 
00034 #include "knotes/KNotesIface.h"
00035 
00036 class KIconView;
00037 class QIconViewItem;
00038 class KNotesIconViewItem;
00039 class KNoteTip;
00040 class KNoteEditDlg;
00041 class KNotesResourceManager;
00042 
00043 namespace KCal {
00044 class Journal;
00045 }
00046 
00047 class KNotesPart : public KParts::ReadOnlyPart, virtual public KNotesIface
00048 {
00049   Q_OBJECT
00050 
00051   public:
00052     KNotesPart( QObject *parent = 0, const char *name = 0 );
00053    ~KNotesPart();
00054 
00055     bool openFile();
00056 
00057   public slots:
00058     QString newNote( const QString& name = QString::null,
00059                      const QString& text = QString::null );
00060     QString newNoteFromClipboard( const QString& name = QString::null );
00061 
00062   public:
00063     void killNote( const QString& id );
00064     void killNote( const QString& id, bool force );
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   private slots:
00075     void createNote( KCal::Journal *journal );
00076     void killNote( KCal::Journal *journal );
00077 
00078     void editNote( QIconViewItem *item );
00079 
00080     void renameNote();
00081     void renamedNote( QIconViewItem *item );
00082 
00083     void slotOnItem( QIconViewItem *item );
00084     void slotOnViewport();
00085     void slotOnCurrentChanged( QIconViewItem *item );
00086 
00087     void popupRMB( QIconViewItem *item, const QPoint& pos );
00088     void killSelectedNotes();
00089 
00090   private:
00091     KIconView *mNotesView;
00092     KNoteTip *mNoteTip;
00093     KNoteEditDlg *mNoteEditDlg;
00094 
00095     KNotesResourceManager *mManager;
00096     QDict<KNotesIconViewItem> mNoteList;
00097 };
00098 
00099 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys