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 <kglobal.h>
29 #include <kiconloader.h>
30 
31 #include <libkcal/journal.h>
32 #include <kparts/part.h>
33 
34 #include "knotes/KNotesIface.h"
35 
36 class KIconView;
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  Q_OBJECT
50  TQ_OBJECT
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  private slots:
76  void createNote( KCal::Journal *journal );
77  void killNote( KCal::Journal *journal );
78 
79  void editNote( TQIconViewItem *item );
80 
81  void renameNote();
82  void renamedNote( TQIconViewItem *item );
83 
84  void slotOnItem( TQIconViewItem *item );
85  void slotOnViewport();
86  void slotOnCurrentChanged( TQIconViewItem *item );
87 
88  void popupRMB( TQIconViewItem *item, const TQPoint& pos );
89  void killSelectedNotes();
90 
91  void printSelectedNotes();
92 
93  private:
94  KIconView *mNotesView;
95  KNoteTip *mNoteTip;
96  KNoteEditDlg *mNoteEditDlg;
97 
98  KNotesResourceManager *mManager;
99  TQDict<KNotesIconViewItem> mNoteList;
100  TQString mOldName;
101 };
102 
103 #endif