knotes_part.h
1 /*
2  This file is part of the KDE project
3  Copyright (C) 2002 Daniel Molkentin <molkentin@kde.org>
4  Copyright (C) 2004-2006 Michael Brade <brade@kde.org>
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; see the file COPYING. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef KNOTES_PART_H
23 #define KNOTES_PART_H
24 
25 #include <tqdict.h>
26 
27 #include <kiconview.h>
28 #include <tdeglobal.h>
29 #include <kiconloader.h>
30 
31 #include <libkcal/journal.h>
32 #include <tdeparts/part.h>
33 
34 #include "knotes/KNotesIface.h"
35 
36 class TDEIconView;
37 class TQIconViewItem;
38 class KNotesIconViewItem;
39 class KNoteTip;
40 class KNoteEditDlg;
41 class KNotesResourceManager;
42 
43 namespace KCal {
44 class Journal;
45 }
46 
47 class KNotesPart : public KParts::ReadOnlyPart, virtual public KNotesIface
48 {
49  TQ_OBJECT
50 
51 
52  public:
53  KNotesPart( TQObject *parent = 0, const char *name = 0 );
54  ~KNotesPart();
55 
56  bool openFile();
57 
58  public slots:
59  TQString newNote( const TQString& name = TQString(),
60  const TQString& text = TQString() );
61  TQString newNoteFromClipboard( const TQString& name = TQString() );
62 
63  public:
64  void killNote( const TQString& id );
65  void killNote( const TQString& id, bool force );
66 
67  TQString name( const TQString& id ) const;
68  TQString text( const TQString& id ) const;
69 
70  void setName( const TQString& id, const TQString& newName );
71  void setText( const TQString& id, const TQString& newText );
72 
73  TQMap<TQString, TQString> notes() const;
74 
75  TQDateTime getLastModified( const TQString& id ) const;
76 
77  private slots:
78  void createNote( KCal::Journal *journal );
79  void killNote( KCal::Journal *journal );
80 
81  void editNote( TQIconViewItem *item );
82 
83  void renameNote();
84  void renamedNote( TQIconViewItem *item );
85 
86  void slotOnItem( TQIconViewItem *item );
87  void slotOnViewport();
88  void slotOnCurrentChanged( TQIconViewItem *item );
89 
90  void popupRMB( TQIconViewItem *item, const TQPoint& pos );
91  void killSelectedNotes();
92 
93  void printSelectedNotes();
94 
95  private:
96  TDEIconView *mNotesView;
97  KNoteTip *mNoteTip;
98  KNoteEditDlg *mNoteEditDlg;
99 
100  KNotesResourceManager *mManager;
101  TQDict<KNotesIconViewItem> mNoteList;
102  TQString mOldName;
103 };
104 
105 #endif