-rw-r--r-- | korganizer/kotodoview.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index f11518d..68e29bb 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -1,244 +1,247 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOTODOVIEW_H | 23 | #ifndef KOTODOVIEW_H |
24 | #define KOTODOVIEW_H | 24 | #define KOTODOVIEW_H |
25 | 25 | ||
26 | #include <qfont.h> | 26 | #include <qfont.h> |
27 | #include <qfontmetrics.h> | 27 | #include <qfontmetrics.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | #include <qptrlist.h> | 29 | #include <qptrlist.h> |
30 | #include <qstrlist.h> | 30 | #include <qstrlist.h> |
31 | #include <qlistbox.h> | 31 | #include <qlistbox.h> |
32 | #include <qpopupmenu.h> | 32 | #include <qpopupmenu.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qmap.h> | 34 | #include <qmap.h> |
35 | #include <qlistview.h> | 35 | #include <qlistview.h> |
36 | #include <klistview.h> | 36 | #include <klistview.h> |
37 | 37 | ||
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | 40 | ||
41 | #include <korganizer/baseview.h> | 41 | #include <korganizer/baseview.h> |
42 | 42 | ||
43 | #include "kotodoviewitem.h" | 43 | #include "kotodoviewitem.h" |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #include "koglobals.h" | 45 | #include "koglobals.h" |
46 | #include "datenavigator.h" | 46 | #include "datenavigator.h" |
47 | 47 | ||
48 | class QDragEnterEvent; | 48 | class QDragEnterEvent; |
49 | class QDragMoveEvent; | 49 | class QDragMoveEvent; |
50 | class QDragLeaveEvent; | 50 | class QDragLeaveEvent; |
51 | class QDropEvent; | 51 | class QDropEvent; |
52 | 52 | ||
53 | class DocPrefs; | 53 | class DocPrefs; |
54 | 54 | ||
55 | class KOTodoListView : public KListView | 55 | class KOTodoListView : public KListView |
56 | { | 56 | { |
57 | Q_OBJECT | 57 | Q_OBJECT |
58 | public: | 58 | public: |
59 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); | 59 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); |
60 | virtual ~KOTodoListView() {} | 60 | virtual ~KOTodoListView() {} |
61 | 61 | ||
62 | signals: | 62 | signals: |
63 | void todoDropped(Todo *); | 63 | void todoDropped(Todo *, int); |
64 | void double_Clicked(QListViewItem *item); | 64 | void double_Clicked(QListViewItem *item); |
65 | 65 | void reparentTodoSignal( Todo *,Todo * ); | |
66 | void unparentTodoSignal(Todo *); | ||
67 | void deleteTodo( Todo * ); | ||
66 | protected: | 68 | protected: |
67 | void contentsDragEnterEvent(QDragEnterEvent *); | 69 | void contentsDragEnterEvent(QDragEnterEvent *); |
68 | void contentsDragMoveEvent(QDragMoveEvent *); | 70 | void contentsDragMoveEvent(QDragMoveEvent *); |
69 | void contentsDragLeaveEvent(QDragLeaveEvent *); | 71 | void contentsDragLeaveEvent(QDragLeaveEvent *); |
70 | void contentsDropEvent(QDropEvent *); | 72 | void contentsDropEvent(QDropEvent *); |
71 | 73 | ||
72 | void contentsMousePressEvent(QMouseEvent *); | 74 | void contentsMousePressEvent(QMouseEvent *); |
73 | void contentsMouseMoveEvent(QMouseEvent *); | 75 | void contentsMouseMoveEvent(QMouseEvent *); |
74 | void contentsMouseReleaseEvent(QMouseEvent *); | 76 | void contentsMouseReleaseEvent(QMouseEvent *); |
75 | void contentsMouseDoubleClickEvent(QMouseEvent *); | 77 | void contentsMouseDoubleClickEvent(QMouseEvent *); |
76 | 78 | ||
77 | private: | 79 | private: |
80 | bool internalDrop; | ||
78 | QString mName; | 81 | QString mName; |
79 | Calendar *mCalendar; | 82 | Calendar *mCalendar; |
80 | QPoint mPressPos; | 83 | QPoint mPressPos; |
81 | bool mMousePressed; | 84 | bool mMousePressed; |
82 | QListViewItem *mOldCurrent; | 85 | QListViewItem *mOldCurrent; |
83 | void keyPressEvent ( QKeyEvent * ) ; | 86 | void keyPressEvent ( QKeyEvent * ) ; |
84 | }; | 87 | }; |
85 | 88 | ||
86 | 89 | ||
87 | /** | 90 | /** |
88 | This is the line-edit on top of the todoview for fast addition of new todos | 91 | This is the line-edit on top of the todoview for fast addition of new todos |
89 | */ | 92 | */ |
90 | class KOQuickTodo : public QLineEdit | 93 | class KOQuickTodo : public QLineEdit |
91 | { | 94 | { |
92 | public: | 95 | public: |
93 | KOQuickTodo(QWidget *parent=0); | 96 | KOQuickTodo(QWidget *parent=0); |
94 | protected: | 97 | protected: |
95 | void focusInEvent(QFocusEvent *ev); | 98 | void focusInEvent(QFocusEvent *ev); |
96 | void focusOutEvent(QFocusEvent *ev); | 99 | void focusOutEvent(QFocusEvent *ev); |
97 | }; | 100 | }; |
98 | 101 | ||
99 | 102 | ||
100 | /** | 103 | /** |
101 | This class provides a multi-column list view of todo events. | 104 | This class provides a multi-column list view of todo events. |
102 | 105 | ||
103 | @short multi-column list view of todo events. | 106 | @short multi-column list view of todo events. |
104 | @author Cornelius Schumacher <schumacher@kde.org> | 107 | @author Cornelius Schumacher <schumacher@kde.org> |
105 | */ | 108 | */ |
106 | class KOTodoView : public KOrg::BaseView | 109 | class KOTodoView : public KOrg::BaseView |
107 | { | 110 | { |
108 | Q_OBJECT | 111 | Q_OBJECT |
109 | public: | 112 | public: |
110 | KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); | 113 | KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); |
111 | ~KOTodoView(); | 114 | ~KOTodoView(); |
112 | 115 | ||
113 | QPtrList<Incidence> selectedIncidences(); | 116 | QPtrList<Incidence> selectedIncidences(); |
114 | QPtrList<Todo> selectedTodos(); | 117 | QPtrList<Todo> selectedTodos(); |
115 | 118 | ||
116 | DateList selectedDates() | 119 | DateList selectedDates() |
117 | {DateList q; | 120 | {DateList q; |
118 | return q;} | 121 | return q;} |
119 | 122 | ||
120 | /** Return number of shown dates. TodoView does not show dates, */ | 123 | /** Return number of shown dates. TodoView does not show dates, */ |
121 | int currentDateCount() { return 0; } | 124 | int currentDateCount() { return 0; } |
122 | 125 | ||
123 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); | 126 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); |
124 | 127 | ||
125 | void setDocumentId( const QString & ); | 128 | void setDocumentId( const QString & ); |
126 | 129 | ||
127 | void saveLayout(KConfig *config, const QString &group) const; | 130 | void saveLayout(KConfig *config, const QString &group) const; |
128 | void restoreLayout(KConfig *config, const QString &group); | 131 | void restoreLayout(KConfig *config, const QString &group); |
129 | /** Create a popup menu to set categories */ | 132 | /** Create a popup menu to set categories */ |
130 | QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); | 133 | QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); |
131 | void setNavigator( DateNavigator* nav ) {mNavigator = nav;} | 134 | void setNavigator( DateNavigator* nav ) {mNavigator = nav;} |
132 | 135 | ||
133 | public slots: | 136 | public slots: |
134 | void updateView(); | 137 | void updateView(); |
135 | void updateConfig(); | 138 | void updateConfig(); |
136 | 139 | ||
137 | void changeEventDisplay(Event *, int); | 140 | void changeEventDisplay(Event *, int); |
138 | 141 | ||
139 | void showDates(const QDate &start, const QDate &end); | 142 | void showDates(const QDate &start, const QDate &end); |
140 | void showEvents(QPtrList<Event> eventList); | 143 | void showEvents(QPtrList<Event> eventList); |
141 | 144 | ||
142 | void clearSelection(); | 145 | void clearSelection(); |
143 | void jumpToDate (); | 146 | void jumpToDate (); |
144 | 147 | ||
145 | void editItem(QListViewItem *item); | 148 | void editItem(QListViewItem *item); |
146 | void showItem(QListViewItem *item,const QPoint &,int); | 149 | void showItem(QListViewItem *item,const QPoint &,int); |
147 | void popupMenu(QListViewItem *item,const QPoint &,int); | 150 | void popupMenu(QListViewItem *item,const QPoint &,int); |
148 | void newTodo(); | 151 | void newTodo(); |
149 | void newSubTodo(); | 152 | void newSubTodo(); |
150 | void unparentTodo(); | 153 | void unparentTodo(); |
151 | void reparentTodo(); | 154 | void reparentTodo(); |
152 | void showTodo(); | 155 | void showTodo(); |
153 | void editTodo(); | 156 | void editTodo(); |
154 | void cloneTodo(); | 157 | void cloneTodo(); |
155 | void cancelTodo(); | 158 | void cancelTodo(); |
156 | void moveTodo(); | 159 | void moveTodo(); |
157 | void beamTodo(); | 160 | void beamTodo(); |
158 | void deleteTodo(); | 161 | void deleteTodo(); |
159 | 162 | ||
160 | void setNewPriority(int); | 163 | void setNewPriority(int); |
161 | void setNewPercentage(int); | 164 | void setNewPercentage(int); |
162 | void changedCategories(int); | 165 | void changedCategories(int); |
163 | 166 | ||
164 | void setAllOpen(); | 167 | void setAllOpen(); |
165 | void setAllClose(); | 168 | void setAllClose(); |
166 | void setAllFlat(); | 169 | void setAllFlat(); |
167 | 170 | ||
168 | void purgeCompleted(); | 171 | void purgeCompleted(); |
169 | void toggleCompleted(); | 172 | void toggleCompleted(); |
170 | void toggleRunning(); | 173 | void toggleRunning(); |
171 | void toggleQuickTodo(); | 174 | void toggleQuickTodo(); |
172 | void updateTodo( Todo *, int ); | 175 | void updateTodo( Todo *, int ); |
173 | 176 | ||
174 | void itemClicked(QListViewItem *); | 177 | void itemClicked(QListViewItem *); |
175 | void itemStateChanged(QListViewItem *); | 178 | void itemStateChanged(QListViewItem *); |
176 | void modified(bool); | 179 | void modified(bool); |
177 | void itemDoubleClicked(QListViewItem *item); | 180 | void itemDoubleClicked(QListViewItem *item); |
178 | 181 | ||
179 | signals: | 182 | signals: |
180 | void newTodoSignal(); | 183 | void newTodoSignal(); |
181 | void newSubTodoSignal(Todo *); | 184 | void newSubTodoSignal(Todo *); |
182 | void unparentTodoSignal(Todo *); | 185 | void unparentTodoSignal(Todo *); |
183 | void reparentTodoSignal( Todo *,Todo * ); | 186 | void reparentTodoSignal( Todo *,Todo * ); |
184 | void showTodoSignal(Todo *); | 187 | void showTodoSignal(Todo *); |
185 | 188 | ||
186 | void editTodoSignal(Todo *); | 189 | void editTodoSignal(Todo *); |
187 | void deleteTodoSignal(Todo *); | 190 | void deleteTodoSignal(Todo *); |
188 | void todoModifiedSignal (Todo *, int); | 191 | void todoModifiedSignal (Todo *, int); |
189 | 192 | ||
190 | void isModified(bool); | 193 | void isModified(bool); |
191 | void cloneTodoSignal( Incidence * ); | 194 | void cloneTodoSignal( Incidence * ); |
192 | void cancelTodoSignal( Incidence * ); | 195 | void cancelTodoSignal( Incidence * ); |
193 | void moveTodoSignal( Incidence * ); | 196 | void moveTodoSignal( Incidence * ); |
194 | void beamTodoSignal( Incidence * ); | 197 | void beamTodoSignal( Incidence * ); |
195 | void purgeCompletedSignal(); | 198 | void purgeCompletedSignal(); |
196 | 199 | ||
197 | protected slots: | 200 | protected slots: |
198 | void processSelectionChange(); | 201 | void processSelectionChange(); |
199 | void addQuickTodo(); | 202 | void addQuickTodo(); |
203 | void setTodoModified( Todo* ); | ||
204 | void todoModified(Todo *, int ); | ||
200 | 205 | ||
201 | private: | 206 | private: |
202 | /* | 207 | /* |
203 | * the TodoEditor approach is rather unscaling in the long | 208 | * the TodoEditor approach is rather unscaling in the long |
204 | * run. | 209 | * run. |
205 | * Korganizer keeps it in memory and we need to update | 210 | * Korganizer keeps it in memory and we need to update |
206 | * 1. make KOTodoViewItem a QObject again? | 211 | * 1. make KOTodoViewItem a QObject again? |
207 | * 2. add a public method for setting one todo modified? | 212 | * 2. add a public method for setting one todo modified? |
208 | * 3. add a private method for setting a todo modified + friend here? | 213 | * 3. add a private method for setting a todo modified + friend here? |
209 | * -- zecke 2002-07-08 | 214 | * -- zecke 2002-07-08 |
210 | */ | 215 | */ |
211 | friend class KOTodoViewItem; | 216 | friend class KOTodoViewItem; |
212 | void setTodoModified( Todo* ); | ||
213 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); | 217 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); |
214 | void restoreItemState( QListViewItem * ); | 218 | void restoreItemState( QListViewItem * ); |
215 | 219 | ||
216 | bool checkTodo( Todo * ); | 220 | bool checkTodo( Todo * ); |
217 | bool isFlatDisplay; | 221 | bool isFlatDisplay; |
218 | void setOpen( QListViewItem*, bool setOpen); | 222 | void setOpen( QListViewItem*, bool setOpen); |
219 | KOTodoListView *mTodoListView; | 223 | KOTodoListView *mTodoListView; |
220 | QPopupMenu *mItemPopupMenu; | 224 | QPopupMenu *mItemPopupMenu; |
221 | QPopupMenu *mPopupMenu; | 225 | QPopupMenu *mPopupMenu; |
222 | QPopupMenu *mPriorityPopupMenu; | 226 | QPopupMenu *mPriorityPopupMenu; |
223 | QPopupMenu *mPercentageCompletedPopupMenu; | 227 | QPopupMenu *mPercentageCompletedPopupMenu; |
224 | QPopupMenu *mCategoryPopupMenu; | 228 | QPopupMenu *mCategoryPopupMenu; |
225 | 229 | ||
226 | QMap<int, int> mPercentage; | 230 | QMap<int, int> mPercentage; |
227 | QMap<int, int> mPriority; | 231 | QMap<int, int> mPriority; |
228 | QMap<int, QString> mCategory; | 232 | QMap<int, QString> mCategory; |
229 | KOTodoViewItem *mActiveItem; | 233 | KOTodoViewItem *mActiveItem; |
230 | 234 | ||
231 | QMap<Todo *,KOTodoViewItem *> mTodoMap; | 235 | QMap<Todo *,KOTodoViewItem *> mTodoMap; |
232 | QString mName; | 236 | QString mName; |
233 | 237 | ||
234 | DocPrefs *mDocPrefs; | 238 | DocPrefs *mDocPrefs; |
235 | QString mCurrentDoc; | 239 | QString mCurrentDoc; |
236 | KOQuickTodo *mQuickAdd; | 240 | KOQuickTodo *mQuickAdd; |
237 | bool mBlockUpdate; | 241 | bool mBlockUpdate; |
238 | void todoModified(Todo *, int ); | ||
239 | void keyPressEvent ( QKeyEvent * ) ; | 242 | void keyPressEvent ( QKeyEvent * ) ; |
240 | KOTodoViewItem * pendingSubtodo; | 243 | KOTodoViewItem * pendingSubtodo; |
241 | DateNavigator* mNavigator; | 244 | DateNavigator* mNavigator; |
242 | }; | 245 | }; |
243 | 246 | ||
244 | #endif | 247 | #endif |