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 <tqdict.h>
00026 
00027 #include <kiconview.h>
00028 #include <tdeglobal.h>
00029 #include <kiconloader.h>
00030 
00031 #include <libkcal/journal.h>
00032 #include <tdeparts/part.h>
00033 
00034 #include "knotes/KNotesIface.h"
00035 
00036 class TDEIconView;
00037 class TQIconViewItem;
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 
00052   public:
00053     KNotesPart( TQObject *parent = 0, const char *name = 0 );
00054    ~KNotesPart();
00055 
00056     bool openFile();
00057 
00058   public slots:
00059     TQString newNote( const TQString& name = TQString(),
00060                      const TQString& text = TQString() );
00061     TQString newNoteFromClipboard( const TQString& name = TQString() );
00062 
00063   public:
00064     void killNote( const TQString& id );
00065     void killNote( const TQString& id, bool force );
00066 
00067     TQString name( const TQString& id ) const;
00068     TQString text( const TQString& id ) const;
00069 
00070     void setName( const TQString& id, const TQString& newName );
00071     void setText( const TQString& id, const TQString& newText );
00072 
00073     TQMap<TQString, TQString> notes() const;
00074 
00075     TQDateTime getLastModified( const TQString& id ) const;
00076 
00077   private slots:
00078     void createNote( KCal::Journal *journal );
00079     void killNote( KCal::Journal *journal );
00080 
00081     void editNote( TQIconViewItem *item );
00082 
00083     void renameNote();
00084     void renamedNote( TQIconViewItem *item );
00085 
00086     void slotOnItem( TQIconViewItem *item );
00087     void slotOnViewport();
00088     void slotOnCurrentChanged( TQIconViewItem *item );
00089 
00090     void popupRMB( TQIconViewItem *item, const TQPoint& pos );
00091     void killSelectedNotes();
00092 
00093     void printSelectedNotes();
00094 
00095   private:
00096     TDEIconView *mNotesView;
00097     KNoteTip *mNoteTip;
00098     KNoteEditDlg *mNoteEditDlg;
00099 
00100     KNotesResourceManager *mManager;
00101     TQDict<KNotesIconViewItem> mNoteList;
00102   TQString mOldName;
00103 };
00104 
00105 #endif