-rw-r--r-- | korganizer/kotodoview.cpp | 49 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 5 |
2 files changed, 42 insertions, 12 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index c5fae17..13e88ef 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -1,290 +1,315 @@ | |||
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 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qheader.h> | 25 | #include <qheader.h> |
26 | #include <qcursor.h> | 26 | #include <qcursor.h> |
27 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
28 | #include <qdialog.h> | 28 | #include <qdialog.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | 31 | ||
32 | #include <qinputdialog.h> | 32 | #include <qinputdialog.h> |
33 | 33 | ||
34 | #include <qvbox.h> | 34 | #include <qvbox.h> |
35 | #include <kdebug.h> | 35 | #include <kdebug.h> |
36 | #include "koprefs.h" | 36 | #include "koprefs.h" |
37 | #include <klocale.h> | 37 | #include <klocale.h> |
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kdateedit.h> | ||
40 | #include "ktimeedit.h" | ||
39 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
40 | #include <kmessagebox.h> | 42 | #include <kmessagebox.h> |
41 | 43 | ||
42 | #include <libkcal/icaldrag.h> | 44 | #include <libkcal/icaldrag.h> |
43 | #include <libkcal/vcaldrag.h> | 45 | #include <libkcal/vcaldrag.h> |
44 | #include <libkcal/calfilter.h> | 46 | #include <libkcal/calfilter.h> |
45 | #include <libkcal/dndfactory.h> | 47 | #include <libkcal/dndfactory.h> |
46 | #include <libkcal/calendarresources.h> | 48 | #include <libkcal/calendarresources.h> |
47 | #include <libkcal/resourcecalendar.h> | 49 | #include <libkcal/resourcecalendar.h> |
48 | #include <kresources/resourceselectdialog.h> | 50 | #include <kresources/resourceselectdialog.h> |
49 | #include <libkcal/kincidenceformatter.h> | 51 | #include <libkcal/kincidenceformatter.h> |
50 | #ifndef DESKTOP_VERSION | 52 | #ifndef DESKTOP_VERSION |
51 | #include <qpe/qpeapplication.h> | 53 | #include <qpe/qpeapplication.h> |
52 | #else | 54 | #else |
53 | #include <qapplication.h> | 55 | #include <qapplication.h> |
54 | #endif | 56 | #endif |
55 | #ifndef KORG_NOPRINTER | 57 | #ifndef KORG_NOPRINTER |
56 | #include "calprinter.h" | 58 | #include "calprinter.h" |
57 | #endif | 59 | #endif |
58 | #include "docprefs.h" | 60 | #include "docprefs.h" |
59 | 61 | ||
60 | #include "kotodoview.h" | 62 | #include "kotodoview.h" |
61 | using namespace KOrg; | 63 | using namespace KOrg; |
62 | 64 | ||
63 | 65 | ||
64 | KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : | 66 | KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : |
65 | QDialog( parent, name, true ) | 67 | QDialog( parent, name, true ) |
66 | { | 68 | { |
67 | mTodo = todo; | 69 | mTodo = todo; |
68 | setCaption( i18n("Stop todo") ); | 70 | setCaption( i18n("Stop todo") ); |
69 | QVBoxLayout* lay = new QVBoxLayout( this ); | 71 | QVBoxLayout* lay = new QVBoxLayout( this ); |
70 | lay->setSpacing( 3 ); | 72 | lay->setSpacing( 3 ); |
71 | lay->setMargin( 3 ); | 73 | lay->setMargin( 3 ); |
72 | QLabel * lab = new QLabel( i18n("%1\nis running!").arg( todo->summary() ), this ); | 74 | QLabel * lab = new QLabel( i18n("%1\nis running!").arg( todo->summary() ), this ); |
73 | lay->addWidget( lab ); | 75 | lay->addWidget( lab ); |
74 | lab->setAlignment( AlignHCenter ); | 76 | lab->setAlignment( AlignHCenter ); |
75 | 77 | lab = new QLabel( i18n("Additional Comment:"), this ); | |
78 | lay->addWidget( lab ); | ||
79 | mComment = new QLineEdit( this ); | ||
80 | lay->addWidget( mComment ); | ||
81 | QHBox * start = new QHBox ( this ); | ||
82 | lay->addWidget( start ); | ||
83 | lab = new QLabel( i18n("Start:"), start ); | ||
84 | QHBox * end = new QHBox ( this ); | ||
85 | lay->addWidget( end ); | ||
86 | lab = new QLabel( i18n("End:"), end ); | ||
87 | sde = new KDateEdit( start ); | ||
88 | ste = new KOTimeEdit( start ); | ||
89 | connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); | ||
90 | ede = new KDateEdit( end ); | ||
91 | ete = new KOTimeEdit(end ); | ||
92 | connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); | ||
93 | sde->setDate( mTodo->runStart().date() ); | ||
94 | ste->setTime( mTodo->runStart().time() ); | ||
95 | ede->setDate( QDate::currentDate()); | ||
96 | ete->setTime( QTime::currentTime() ); | ||
76 | QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); | 97 | QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); |
77 | lay->addWidget( ok ); | 98 | lay->addWidget( ok ); |
78 | QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); | 99 | QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); |
79 | lay->addWidget( cancel ); | 100 | lay->addWidget( cancel ); |
80 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 101 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
81 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 102 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
82 | ok = new QPushButton( i18n("Stop - do not save"), this ); | 103 | ok = new QPushButton( i18n("Stop - do not save"), this ); |
83 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); | 104 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); |
84 | lay->addWidget( ok ); | 105 | lay->addWidget( ok ); |
85 | resize( 200, 200 ); | 106 | if (QApplication::desktop()->width() < 320 ) |
107 | resize( 240, 200 ); | ||
108 | else | ||
109 | resize( 320, 200 ); | ||
110 | |||
86 | } | 111 | } |
87 | 112 | ||
88 | void KOStopTodoPrefs::accept() | 113 | void KOStopTodoPrefs::accept() |
89 | { | 114 | { |
90 | qDebug("KOStopTodoPrefs::accept() "); | 115 | QDateTime start = QDateTime( sde->date(), ste->getTime() ); |
91 | 116 | QDateTime stop = QDateTime( ede->date(), ete->getTime() ); | |
92 | 117 | if ( start > stop ) { | |
93 | #if 0 | 118 | KMessageBox::sorry(this, |
94 | t->setRunningFalse( comment ); | 119 | i18n("The start time is\nafter the end time!"), |
95 | 120 | i18n("Time mismatch!")); | |
96 | t->setRunning( false ); | 121 | return; |
97 | #endif | 122 | } |
98 | 123 | mTodo->saveRunningInfo( mComment->text(), start, stop ); | |
99 | QDialog::accept(); | 124 | QDialog::accept(); |
100 | } | 125 | } |
101 | void KOStopTodoPrefs::doNotSave() | 126 | void KOStopTodoPrefs::doNotSave() |
102 | { | 127 | { |
103 | int result = KMessageBox::warningContinueCancel(this, | 128 | int result = KMessageBox::warningContinueCancel(this, |
104 | i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary() ); | 129 | i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary() ); |
105 | if (result != KMessageBox::Continue) return; | 130 | if (result != KMessageBox::Continue) return; |
106 | mTodo->stopRunning(); | 131 | mTodo->stopRunning(); |
107 | QDialog::accept(); | 132 | QDialog::accept(); |
108 | } | 133 | } |
109 | 134 | ||
110 | 135 | ||
111 | class KOTodoViewWhatsThis :public QWhatsThis | 136 | class KOTodoViewWhatsThis :public QWhatsThis |
112 | { | 137 | { |
113 | public: | 138 | public: |
114 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 139 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; |
115 | 140 | ||
116 | protected: | 141 | protected: |
117 | virtual QString text( const QPoint& p) | 142 | virtual QString text( const QPoint& p) |
118 | { | 143 | { |
119 | return _view->getWhatsThisText(p) ; | 144 | return _view->getWhatsThisText(p) ; |
120 | } | 145 | } |
121 | private: | 146 | private: |
122 | QWidget* _wid; | 147 | QWidget* _wid; |
123 | KOTodoView * _view; | 148 | KOTodoView * _view; |
124 | }; | 149 | }; |
125 | 150 | ||
126 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, | 151 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, |
127 | const char *name) : | 152 | const char *name) : |
128 | KListView(parent,name) | 153 | KListView(parent,name) |
129 | { | 154 | { |
130 | mName = QString ( name ); | 155 | mName = QString ( name ); |
131 | mCalendar = calendar; | 156 | mCalendar = calendar; |
132 | #ifndef DESKTOP_VERSION | 157 | #ifndef DESKTOP_VERSION |
133 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 158 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
134 | #endif | 159 | #endif |
135 | mOldCurrent = 0; | 160 | mOldCurrent = 0; |
136 | mMousePressed = false; | 161 | mMousePressed = false; |
137 | 162 | ||
138 | setAcceptDrops(true); | 163 | setAcceptDrops(true); |
139 | viewport()->setAcceptDrops(true); | 164 | viewport()->setAcceptDrops(true); |
140 | int size = 16; | 165 | int size = 16; |
141 | if (qApp->desktop()->width() < 300 ) | 166 | if (qApp->desktop()->width() < 300 ) |
142 | size = 12; | 167 | size = 12; |
143 | setTreeStepSize( size + 6 ); | 168 | setTreeStepSize( size + 6 ); |
144 | 169 | ||
145 | } | 170 | } |
146 | 171 | ||
147 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) | 172 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) |
148 | { | 173 | { |
149 | #ifndef KORG_NODND | 174 | #ifndef KORG_NODND |
150 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; | 175 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; |
151 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 176 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
152 | !QTextDrag::canDecode( e ) ) { | 177 | !QTextDrag::canDecode( e ) ) { |
153 | e->ignore(); | 178 | e->ignore(); |
154 | return; | 179 | return; |
155 | } | 180 | } |
156 | 181 | ||
157 | mOldCurrent = currentItem(); | 182 | mOldCurrent = currentItem(); |
158 | #endif | 183 | #endif |
159 | } | 184 | } |
160 | 185 | ||
161 | 186 | ||
162 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) | 187 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) |
163 | { | 188 | { |
164 | #ifndef KORG_NODND | 189 | #ifndef KORG_NODND |
165 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; | 190 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; |
166 | 191 | ||
167 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 192 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
168 | !QTextDrag::canDecode( e ) ) { | 193 | !QTextDrag::canDecode( e ) ) { |
169 | e->ignore(); | 194 | e->ignore(); |
170 | return; | 195 | return; |
171 | } | 196 | } |
172 | 197 | ||
173 | e->accept(); | 198 | e->accept(); |
174 | #endif | 199 | #endif |
175 | } | 200 | } |
176 | 201 | ||
177 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) | 202 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) |
178 | { | 203 | { |
179 | #ifndef KORG_NODND | 204 | #ifndef KORG_NODND |
180 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; | 205 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; |
181 | 206 | ||
182 | setCurrentItem(mOldCurrent); | 207 | setCurrentItem(mOldCurrent); |
183 | setSelected(mOldCurrent,true); | 208 | setSelected(mOldCurrent,true); |
184 | #endif | 209 | #endif |
185 | } | 210 | } |
186 | 211 | ||
187 | void KOTodoListView::contentsDropEvent(QDropEvent *e) | 212 | void KOTodoListView::contentsDropEvent(QDropEvent *e) |
188 | { | 213 | { |
189 | #ifndef KORG_NODND | 214 | #ifndef KORG_NODND |
190 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; | 215 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; |
191 | 216 | ||
192 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 217 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
193 | !QTextDrag::canDecode( e ) ) { | 218 | !QTextDrag::canDecode( e ) ) { |
194 | e->ignore(); | 219 | e->ignore(); |
195 | return; | 220 | return; |
196 | } | 221 | } |
197 | 222 | ||
198 | DndFactory factory( mCalendar ); | 223 | DndFactory factory( mCalendar ); |
199 | Todo *todo = factory.createDropTodo(e); | 224 | Todo *todo = factory.createDropTodo(e); |
200 | 225 | ||
201 | if (todo) { | 226 | if (todo) { |
202 | e->acceptAction(); | 227 | e->acceptAction(); |
203 | 228 | ||
204 | KOTodoViewItem *destination = | 229 | KOTodoViewItem *destination = |
205 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); | 230 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); |
206 | Todo *destinationEvent = 0; | 231 | Todo *destinationEvent = 0; |
207 | if (destination) destinationEvent = destination->todo(); | 232 | if (destination) destinationEvent = destination->todo(); |
208 | 233 | ||
209 | Todo *existingTodo = mCalendar->todo(todo->uid()); | 234 | Todo *existingTodo = mCalendar->todo(todo->uid()); |
210 | 235 | ||
211 | if(existingTodo) { | 236 | if(existingTodo) { |
212 | Incidence *to = destinationEvent; | 237 | Incidence *to = destinationEvent; |
213 | while(to) { | 238 | while(to) { |
214 | if (to->uid() == todo->uid()) { | 239 | if (to->uid() == todo->uid()) { |
215 | KMessageBox::sorry(this, | 240 | KMessageBox::sorry(this, |
216 | i18n("Cannot move Todo to itself\nor a child of itself"), | 241 | i18n("Cannot move Todo to itself\nor a child of itself"), |
217 | i18n("Drop Todo")); | 242 | i18n("Drop Todo")); |
218 | delete todo; | 243 | delete todo; |
219 | return; | 244 | return; |
220 | } | 245 | } |
221 | to = to->relatedTo(); | 246 | to = to->relatedTo(); |
222 | } | 247 | } |
223 | internalDrop = true; | 248 | internalDrop = true; |
224 | if ( destinationEvent ) | 249 | if ( destinationEvent ) |
225 | reparentTodoSignal( destinationEvent, existingTodo ); | 250 | reparentTodoSignal( destinationEvent, existingTodo ); |
226 | else | 251 | else |
227 | unparentTodoSignal(existingTodo); | 252 | unparentTodoSignal(existingTodo); |
228 | delete todo; | 253 | delete todo; |
229 | } else { | 254 | } else { |
230 | mCalendar->addTodo(todo); | 255 | mCalendar->addTodo(todo); |
231 | emit todoDropped(todo, KOGlobals::EVENTADDED); | 256 | emit todoDropped(todo, KOGlobals::EVENTADDED); |
232 | if ( destinationEvent ) | 257 | if ( destinationEvent ) |
233 | reparentTodoSignal( destinationEvent, todo ); | 258 | reparentTodoSignal( destinationEvent, todo ); |
234 | } | 259 | } |
235 | } | 260 | } |
236 | else { | 261 | else { |
237 | QString text; | 262 | QString text; |
238 | if (QTextDrag::decode(e,text)) { | 263 | if (QTextDrag::decode(e,text)) { |
239 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); | 264 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); |
240 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); | 265 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); |
241 | qDebug("Dropped : " + text); | 266 | qDebug("Dropped : " + text); |
242 | QStringList emails = QStringList::split(",",text); | 267 | QStringList emails = QStringList::split(",",text); |
243 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 268 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
244 | int pos = (*it).find("<"); | 269 | int pos = (*it).find("<"); |
245 | QString name = (*it).left(pos); | 270 | QString name = (*it).left(pos); |
246 | QString email = (*it).mid(pos); | 271 | QString email = (*it).mid(pos); |
247 | if (!email.isEmpty() && todoi) { | 272 | if (!email.isEmpty() && todoi) { |
248 | todoi->todo()->addAttendee(new Attendee(name,email)); | 273 | todoi->todo()->addAttendee(new Attendee(name,email)); |
249 | } | 274 | } |
250 | } | 275 | } |
251 | } | 276 | } |
252 | else { | 277 | else { |
253 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); | 278 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); |
254 | e->ignore(); | 279 | e->ignore(); |
255 | } | 280 | } |
256 | } | 281 | } |
257 | #endif | 282 | #endif |
258 | } | 283 | } |
259 | void KOTodoListView::wheelEvent (QWheelEvent *e) | 284 | void KOTodoListView::wheelEvent (QWheelEvent *e) |
260 | { | 285 | { |
261 | QListView::wheelEvent (e); | 286 | QListView::wheelEvent (e); |
262 | } | 287 | } |
263 | 288 | ||
264 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | 289 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) |
265 | { | 290 | { |
266 | 291 | ||
267 | QPoint p(contentsToViewport(e->pos())); | 292 | QPoint p(contentsToViewport(e->pos())); |
268 | QListViewItem *i = itemAt(p); | 293 | QListViewItem *i = itemAt(p); |
269 | bool rootClicked = true; | 294 | bool rootClicked = true; |
270 | if (i) { | 295 | if (i) { |
271 | // if the user clicked into the root decoration of the item, don't | 296 | // if the user clicked into the root decoration of the item, don't |
272 | // try to start a drag! | 297 | // try to start a drag! |
273 | int X = p.x(); | 298 | int X = p.x(); |
274 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); | 299 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); |
275 | if (X > header()->sectionPos(0) + | 300 | if (X > header()->sectionPos(0) + |
276 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | 301 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + |
277 | itemMargin() +i->height()|| | 302 | itemMargin() +i->height()|| |
278 | X < header()->sectionPos(0)) { | 303 | X < header()->sectionPos(0)) { |
279 | rootClicked = false; | 304 | rootClicked = false; |
280 | } | 305 | } |
281 | } else { | 306 | } else { |
282 | rootClicked = false; | 307 | rootClicked = false; |
283 | } | 308 | } |
284 | #ifndef KORG_NODND | 309 | #ifndef KORG_NODND |
285 | mMousePressed = false; | 310 | mMousePressed = false; |
286 | if (! rootClicked && !( e->button() == RightButton) ) { | 311 | if (! rootClicked && !( e->button() == RightButton) ) { |
287 | mPressPos = e->pos(); | 312 | mPressPos = e->pos(); |
288 | mMousePressed = true; | 313 | mMousePressed = true; |
289 | } else { | 314 | } else { |
290 | mMousePressed = false; | 315 | mMousePressed = false; |
@@ -1010,385 +1035,385 @@ void KOTodoView::unparentTodo() | |||
1010 | if (mActiveItem) { | 1035 | if (mActiveItem) { |
1011 | emit unparentTodoSignal(mActiveItem->todo()); | 1036 | emit unparentTodoSignal(mActiveItem->todo()); |
1012 | } | 1037 | } |
1013 | } | 1038 | } |
1014 | 1039 | ||
1015 | void KOTodoView::reparentTodo() | 1040 | void KOTodoView::reparentTodo() |
1016 | { | 1041 | { |
1017 | if (mActiveItem) { | 1042 | if (mActiveItem) { |
1018 | topLevelWidget()->setCaption(i18n("Click on new parent item")); | 1043 | topLevelWidget()->setCaption(i18n("Click on new parent item")); |
1019 | pendingSubtodo = mActiveItem; | 1044 | pendingSubtodo = mActiveItem; |
1020 | } | 1045 | } |
1021 | } | 1046 | } |
1022 | void KOTodoView::editTodo() | 1047 | void KOTodoView::editTodo() |
1023 | { | 1048 | { |
1024 | if (mActiveItem) { | 1049 | if (mActiveItem) { |
1025 | emit editTodoSignal(mActiveItem->todo()); | 1050 | emit editTodoSignal(mActiveItem->todo()); |
1026 | } | 1051 | } |
1027 | } | 1052 | } |
1028 | void KOTodoView::cloneTodo() | 1053 | void KOTodoView::cloneTodo() |
1029 | { | 1054 | { |
1030 | if (mActiveItem) { | 1055 | if (mActiveItem) { |
1031 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 1056 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
1032 | } | 1057 | } |
1033 | } | 1058 | } |
1034 | void KOTodoView::cancelTodo() | 1059 | void KOTodoView::cancelTodo() |
1035 | { | 1060 | { |
1036 | if (mActiveItem) { | 1061 | if (mActiveItem) { |
1037 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 1062 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
1038 | } | 1063 | } |
1039 | } | 1064 | } |
1040 | void KOTodoView::moveTodo() | 1065 | void KOTodoView::moveTodo() |
1041 | { | 1066 | { |
1042 | if (mActiveItem) { | 1067 | if (mActiveItem) { |
1043 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); | 1068 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); |
1044 | } | 1069 | } |
1045 | } | 1070 | } |
1046 | void KOTodoView::beamTodo() | 1071 | void KOTodoView::beamTodo() |
1047 | { | 1072 | { |
1048 | if (mActiveItem) { | 1073 | if (mActiveItem) { |
1049 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); | 1074 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); |
1050 | } | 1075 | } |
1051 | } | 1076 | } |
1052 | 1077 | ||
1053 | 1078 | ||
1054 | void KOTodoView::showTodo() | 1079 | void KOTodoView::showTodo() |
1055 | { | 1080 | { |
1056 | if (mActiveItem) { | 1081 | if (mActiveItem) { |
1057 | emit showTodoSignal(mActiveItem->todo()); | 1082 | emit showTodoSignal(mActiveItem->todo()); |
1058 | } | 1083 | } |
1059 | } | 1084 | } |
1060 | 1085 | ||
1061 | void KOTodoView::deleteTodo() | 1086 | void KOTodoView::deleteTodo() |
1062 | { | 1087 | { |
1063 | if (mActiveItem) { | 1088 | if (mActiveItem) { |
1064 | emit deleteTodoSignal(mActiveItem->todo()); | 1089 | emit deleteTodoSignal(mActiveItem->todo()); |
1065 | } | 1090 | } |
1066 | } | 1091 | } |
1067 | 1092 | ||
1068 | void KOTodoView::setNewPriority(int index) | 1093 | void KOTodoView::setNewPriority(int index) |
1069 | { | 1094 | { |
1070 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1095 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1071 | mActiveItem->todo()->setPriority(mPriority[index]); | 1096 | mActiveItem->todo()->setPriority(mPriority[index]); |
1072 | mActiveItem->construct(); | 1097 | mActiveItem->construct(); |
1073 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); | 1098 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); |
1074 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1099 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1075 | } | 1100 | } |
1076 | } | 1101 | } |
1077 | 1102 | ||
1078 | void KOTodoView::setNewPercentage(int index) | 1103 | void KOTodoView::setNewPercentage(int index) |
1079 | { | 1104 | { |
1080 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1105 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1081 | 1106 | ||
1082 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { | 1107 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { |
1083 | mActiveItem->setOn( true ); | 1108 | mActiveItem->setOn( true ); |
1084 | return; | 1109 | return; |
1085 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { | 1110 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { |
1086 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); | 1111 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); |
1087 | if ( par && par->isOn() ) | 1112 | if ( par && par->isOn() ) |
1088 | par->setOn( false ); | 1113 | par->setOn( false ); |
1089 | } | 1114 | } |
1090 | if (mPercentage[index] == 100) { | 1115 | if (mPercentage[index] == 100) { |
1091 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1116 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
1092 | } else { | 1117 | } else { |
1093 | mActiveItem->todo()->setCompleted(false); | 1118 | mActiveItem->todo()->setCompleted(false); |
1094 | } | 1119 | } |
1095 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 1120 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
1096 | mActiveItem->construct(); | 1121 | mActiveItem->construct(); |
1097 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 1122 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
1098 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1123 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1099 | } | 1124 | } |
1100 | } | 1125 | } |
1101 | 1126 | ||
1102 | 1127 | ||
1103 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | 1128 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) |
1104 | { | 1129 | { |
1105 | QPopupMenu* tempMenu = new QPopupMenu (this); | 1130 | QPopupMenu* tempMenu = new QPopupMenu (this); |
1106 | QStringList checkedCategories = todoItem->todo()->categories (); | 1131 | QStringList checkedCategories = todoItem->todo()->categories (); |
1107 | 1132 | ||
1108 | tempMenu->setCheckable (true); | 1133 | tempMenu->setCheckable (true); |
1109 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 1134 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
1110 | it != KOPrefs::instance()->mCustomCategories.end (); | 1135 | it != KOPrefs::instance()->mCustomCategories.end (); |
1111 | ++it) { | 1136 | ++it) { |
1112 | int index = tempMenu->insertItem (*it); | 1137 | int index = tempMenu->insertItem (*it); |
1113 | mCategory[index] = *it; | 1138 | mCategory[index] = *it; |
1114 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); | 1139 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); |
1115 | } | 1140 | } |
1116 | 1141 | ||
1117 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 1142 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
1118 | return tempMenu; | 1143 | return tempMenu; |
1119 | 1144 | ||
1120 | 1145 | ||
1121 | } | 1146 | } |
1122 | void KOTodoView::changedCategories(int index) | 1147 | void KOTodoView::changedCategories(int index) |
1123 | { | 1148 | { |
1124 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1149 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1125 | QStringList categories = mActiveItem->todo()->categories (); | 1150 | QStringList categories = mActiveItem->todo()->categories (); |
1126 | QString colcat = categories.first(); | 1151 | QString colcat = categories.first(); |
1127 | if (categories.find (mCategory[index]) != categories.end ()) | 1152 | if (categories.find (mCategory[index]) != categories.end ()) |
1128 | categories.remove (mCategory[index]); | 1153 | categories.remove (mCategory[index]); |
1129 | else | 1154 | else |
1130 | categories.insert (categories.end(), mCategory[index]); | 1155 | categories.insert (categories.end(), mCategory[index]); |
1131 | categories.sort (); | 1156 | categories.sort (); |
1132 | if ( !colcat.isEmpty() ) { | 1157 | if ( !colcat.isEmpty() ) { |
1133 | if ( categories.find ( colcat ) != categories.end () ) { | 1158 | if ( categories.find ( colcat ) != categories.end () ) { |
1134 | categories.remove( colcat ); | 1159 | categories.remove( colcat ); |
1135 | categories.prepend( colcat ); | 1160 | categories.prepend( colcat ); |
1136 | } | 1161 | } |
1137 | } | 1162 | } |
1138 | mActiveItem->todo()->setCategories (categories); | 1163 | mActiveItem->todo()->setCategories (categories); |
1139 | mActiveItem->construct(); | 1164 | mActiveItem->construct(); |
1140 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1165 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1141 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); | 1166 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); |
1142 | } | 1167 | } |
1143 | } | 1168 | } |
1144 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 1169 | void KOTodoView::itemDoubleClicked(QListViewItem *item) |
1145 | { | 1170 | { |
1146 | if ( pendingSubtodo != 0 ) { | 1171 | if ( pendingSubtodo != 0 ) { |
1147 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1172 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1148 | } | 1173 | } |
1149 | pendingSubtodo = 0; | 1174 | pendingSubtodo = 0; |
1150 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); | 1175 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); |
1151 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); | 1176 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); |
1152 | //qDebug("ROW %d ", row); | 1177 | //qDebug("ROW %d ", row); |
1153 | if (!item) { | 1178 | if (!item) { |
1154 | newTodo(); | 1179 | newTodo(); |
1155 | return; | 1180 | return; |
1156 | } else { | 1181 | } else { |
1157 | if ( row == 2 || row == 1 ) { | 1182 | if ( row == 2 || row == 1 ) { |
1158 | mActiveItem = (KOTodoViewItem *) item; | 1183 | mActiveItem = (KOTodoViewItem *) item; |
1159 | newSubTodo(); | 1184 | newSubTodo(); |
1160 | return; | 1185 | return; |
1161 | } | 1186 | } |
1162 | if ( row == 5 || row == 6 ) { | 1187 | if ( row == 5 || row == 6 ) { |
1163 | mActiveItem = (KOTodoViewItem *) item; | 1188 | mActiveItem = (KOTodoViewItem *) item; |
1164 | toggleRunningItem(); | 1189 | toggleRunningItem(); |
1165 | return; | 1190 | return; |
1166 | } | 1191 | } |
1167 | } | 1192 | } |
1168 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 1193 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
1169 | editItem( item ); | 1194 | editItem( item ); |
1170 | else | 1195 | else |
1171 | showItem( item , QPoint(), 0 ); | 1196 | showItem( item , QPoint(), 0 ); |
1172 | } | 1197 | } |
1173 | void KOTodoView::toggleRunningItem() | 1198 | void KOTodoView::toggleRunningItem() |
1174 | { | 1199 | { |
1175 | // qDebug("KOTodoView::toggleRunning() "); | 1200 | // qDebug("KOTodoView::toggleRunning() "); |
1176 | if ( ! mActiveItem ) | 1201 | if ( ! mActiveItem ) |
1177 | return; | 1202 | return; |
1178 | Todo * t = mActiveItem->todo(); | 1203 | Todo * t = mActiveItem->todo(); |
1179 | if ( t->isRunning() ) { | 1204 | if ( t->isRunning() ) { |
1180 | 1205 | ||
1181 | 1206 | ||
1182 | KOStopTodoPrefs tp ( t, this ); | 1207 | KOStopTodoPrefs tp ( t, this ); |
1183 | tp.exec(); | 1208 | tp.exec(); |
1184 | 1209 | ||
1185 | 1210 | ||
1186 | #if 0 | 1211 | #if 0 |
1187 | int result = KMessageBox::warningYesNoCancel(this, | 1212 | int result = KMessageBox::warningYesNoCancel(this, |
1188 | i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop"),i18n("Stop+note")); | 1213 | i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop"),i18n("Stop+note")); |
1189 | if (result == KMessageBox::Cancel) return; | 1214 | if (result == KMessageBox::Cancel) return; |
1190 | if ( result == KMessageBox::No ) { | 1215 | if ( result == KMessageBox::No ) { |
1191 | QString comment = QInputDialog::getText(mActiveItem->text(0).left( 25 ),i18n("Comment for todo:") ); | 1216 | QString comment = QInputDialog::getText(mActiveItem->text(0).left( 25 ),i18n("Comment for todo:") ); |
1192 | t->setRunningFalse( comment ); | 1217 | t->setRunningFalse( comment ); |
1193 | } else { | 1218 | } else { |
1194 | t->setRunning( false ); | 1219 | t->setRunning( false ); |
1195 | } | 1220 | } |
1196 | mActiveItem->construct(); | 1221 | mActiveItem->construct(); |
1197 | 1222 | ||
1198 | 1223 | ||
1199 | #endif | 1224 | #endif |
1200 | } else { | 1225 | } else { |
1201 | int result = KMessageBox::warningContinueCancel(this, | 1226 | int result = KMessageBox::warningContinueCancel(this, |
1202 | i18n("The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true); | 1227 | i18n("<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>").arg(mActiveItem->text(0).left( 25 ) ),i18n("Start todo"),i18n("Start todo"),i18n("Cancel"), true); |
1203 | if (result != KMessageBox::Continue) return; | 1228 | if (result != KMessageBox::Continue) return; |
1204 | t->setRunning( true ); | 1229 | t->setRunning( true ); |
1205 | mActiveItem->construct(); | 1230 | mActiveItem->construct(); |
1206 | } | 1231 | } |
1207 | } | 1232 | } |
1208 | 1233 | ||
1209 | void KOTodoView::itemClicked(QListViewItem *item) | 1234 | void KOTodoView::itemClicked(QListViewItem *item) |
1210 | { | 1235 | { |
1211 | //qDebug("KOTodoView::itemClicked %d", item); | 1236 | //qDebug("KOTodoView::itemClicked %d", item); |
1212 | if (!item) { | 1237 | if (!item) { |
1213 | if ( pendingSubtodo != 0 ) { | 1238 | if ( pendingSubtodo != 0 ) { |
1214 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1239 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1215 | } | 1240 | } |
1216 | pendingSubtodo = 0; | 1241 | pendingSubtodo = 0; |
1217 | return; | 1242 | return; |
1218 | } | 1243 | } |
1219 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1244 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1220 | if ( pendingSubtodo != 0 ) { | 1245 | if ( pendingSubtodo != 0 ) { |
1221 | bool allowReparent = true; | 1246 | bool allowReparent = true; |
1222 | QListViewItem *par = item; | 1247 | QListViewItem *par = item; |
1223 | while ( par ) { | 1248 | while ( par ) { |
1224 | if ( par == pendingSubtodo ) { | 1249 | if ( par == pendingSubtodo ) { |
1225 | allowReparent = false; | 1250 | allowReparent = false; |
1226 | break; | 1251 | break; |
1227 | } | 1252 | } |
1228 | par = par->parent(); | 1253 | par = par->parent(); |
1229 | } | 1254 | } |
1230 | if ( !allowReparent ) { | 1255 | if ( !allowReparent ) { |
1231 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); | 1256 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); |
1232 | pendingSubtodo = 0; | 1257 | pendingSubtodo = 0; |
1233 | } else { | 1258 | } else { |
1234 | Todo* newParent = todoItem->todo(); | 1259 | Todo* newParent = todoItem->todo(); |
1235 | Todo* newSub = pendingSubtodo->todo(); | 1260 | Todo* newSub = pendingSubtodo->todo(); |
1236 | pendingSubtodo = 0; | 1261 | pendingSubtodo = 0; |
1237 | emit reparentTodoSignal( newParent,newSub ); | 1262 | emit reparentTodoSignal( newParent,newSub ); |
1238 | return; | 1263 | return; |
1239 | } | 1264 | } |
1240 | } | 1265 | } |
1241 | 1266 | ||
1242 | } | 1267 | } |
1243 | 1268 | ||
1244 | void KOTodoView::setDocumentId( const QString &id ) | 1269 | void KOTodoView::setDocumentId( const QString &id ) |
1245 | { | 1270 | { |
1246 | 1271 | ||
1247 | mDocPrefs->setDoc( id ); | 1272 | mDocPrefs->setDoc( id ); |
1248 | } | 1273 | } |
1249 | 1274 | ||
1250 | void KOTodoView::itemStateChanged( QListViewItem *item ) | 1275 | void KOTodoView::itemStateChanged( QListViewItem *item ) |
1251 | { | 1276 | { |
1252 | if (!item) return; | 1277 | if (!item) return; |
1253 | 1278 | ||
1254 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1279 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1255 | 1280 | ||
1256 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; | 1281 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; |
1257 | 1282 | ||
1258 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); | 1283 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); |
1259 | } | 1284 | } |
1260 | 1285 | ||
1261 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const | 1286 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const |
1262 | { | 1287 | { |
1263 | mTodoListView->saveLayout(config,group); | 1288 | mTodoListView->saveLayout(config,group); |
1264 | } | 1289 | } |
1265 | 1290 | ||
1266 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) | 1291 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) |
1267 | { | 1292 | { |
1268 | mTodoListView->restoreLayout(config,group); | 1293 | mTodoListView->restoreLayout(config,group); |
1269 | } | 1294 | } |
1270 | 1295 | ||
1271 | void KOTodoView::processSelectionChange() | 1296 | void KOTodoView::processSelectionChange() |
1272 | { | 1297 | { |
1273 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; | 1298 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; |
1274 | 1299 | ||
1275 | KOTodoViewItem *item = | 1300 | KOTodoViewItem *item = |
1276 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); | 1301 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); |
1277 | 1302 | ||
1278 | if ( !item ) { | 1303 | if ( !item ) { |
1279 | emit incidenceSelected( 0 ); | 1304 | emit incidenceSelected( 0 ); |
1280 | } else { | 1305 | } else { |
1281 | emit incidenceSelected( item->todo() ); | 1306 | emit incidenceSelected( item->todo() ); |
1282 | } | 1307 | } |
1283 | } | 1308 | } |
1284 | 1309 | ||
1285 | void KOTodoView::modified(bool b) | 1310 | void KOTodoView::modified(bool b) |
1286 | { | 1311 | { |
1287 | emit isModified(b); | 1312 | emit isModified(b); |
1288 | } | 1313 | } |
1289 | void KOTodoView::setTodoModified( Todo* todo ) | 1314 | void KOTodoView::setTodoModified( Todo* todo ) |
1290 | { | 1315 | { |
1291 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); | 1316 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); |
1292 | } | 1317 | } |
1293 | void KOTodoView::clearSelection() | 1318 | void KOTodoView::clearSelection() |
1294 | { | 1319 | { |
1295 | mTodoListView->selectAll( false ); | 1320 | mTodoListView->selectAll( false ); |
1296 | } | 1321 | } |
1297 | void KOTodoView::setAllOpen() | 1322 | void KOTodoView::setAllOpen() |
1298 | { | 1323 | { |
1299 | if ( isFlatDisplay ) { | 1324 | if ( isFlatDisplay ) { |
1300 | isFlatDisplay = false; | 1325 | isFlatDisplay = false; |
1301 | mPopupMenu->setItemChecked( 8,false ); | 1326 | mPopupMenu->setItemChecked( 8,false ); |
1302 | updateView(); | 1327 | updateView(); |
1303 | } else { | 1328 | } else { |
1304 | storeCurrentItem(); | 1329 | storeCurrentItem(); |
1305 | } | 1330 | } |
1306 | setOpen(mTodoListView->firstChild(), true); | 1331 | setOpen(mTodoListView->firstChild(), true); |
1307 | resetCurrentItem(); | 1332 | resetCurrentItem(); |
1308 | } | 1333 | } |
1309 | void KOTodoView::setAllClose() | 1334 | void KOTodoView::setAllClose() |
1310 | { | 1335 | { |
1311 | if ( isFlatDisplay ) { | 1336 | if ( isFlatDisplay ) { |
1312 | isFlatDisplay = false; | 1337 | isFlatDisplay = false; |
1313 | mPopupMenu->setItemChecked( 8,false ); | 1338 | mPopupMenu->setItemChecked( 8,false ); |
1314 | updateView(); | 1339 | updateView(); |
1315 | } else { | 1340 | } else { |
1316 | storeCurrentItem(); | 1341 | storeCurrentItem(); |
1317 | } | 1342 | } |
1318 | setOpen(mTodoListView->firstChild(), false); | 1343 | setOpen(mTodoListView->firstChild(), false); |
1319 | resetCurrentItem(); | 1344 | resetCurrentItem(); |
1320 | } | 1345 | } |
1321 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) | 1346 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) |
1322 | { | 1347 | { |
1323 | 1348 | ||
1324 | while ( item ) { | 1349 | while ( item ) { |
1325 | setOpen( item->firstChild(), setOpenI ); | 1350 | setOpen( item->firstChild(), setOpenI ); |
1326 | item->setOpen( setOpenI ); | 1351 | item->setOpen( setOpenI ); |
1327 | item = item->nextSibling(); | 1352 | item = item->nextSibling(); |
1328 | } | 1353 | } |
1329 | } | 1354 | } |
1330 | 1355 | ||
1331 | void KOTodoView::displayAllFlat() | 1356 | void KOTodoView::displayAllFlat() |
1332 | { | 1357 | { |
1333 | pendingSubtodo = 0; | 1358 | pendingSubtodo = 0; |
1334 | if ( mBlockUpdate ) { | 1359 | if ( mBlockUpdate ) { |
1335 | return; | 1360 | return; |
1336 | } | 1361 | } |
1337 | mPopupMenu->setItemChecked( 8,true ); | 1362 | mPopupMenu->setItemChecked( 8,true ); |
1338 | isFlatDisplay = true; | 1363 | isFlatDisplay = true; |
1339 | QPtrList<Todo> todoList = calendar()->todos(); | 1364 | QPtrList<Todo> todoList = calendar()->todos(); |
1340 | mTodoMap.clear(); | 1365 | mTodoMap.clear(); |
1341 | mTodoListView->clear(); | 1366 | mTodoListView->clear(); |
1342 | Todo *todo; | 1367 | Todo *todo; |
1343 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 1368 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
1344 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1369 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1345 | mTodoMap.insert(todo,todoItem); | 1370 | mTodoMap.insert(todo,todoItem); |
1346 | } | 1371 | } |
1347 | mTodoListView->setFocus(); | 1372 | mTodoListView->setFocus(); |
1348 | processSelectionChange(); | 1373 | processSelectionChange(); |
1349 | } | 1374 | } |
1350 | 1375 | ||
1351 | void KOTodoView::setAllFlat() | 1376 | void KOTodoView::setAllFlat() |
1352 | { | 1377 | { |
1353 | if ( isFlatDisplay ) { | 1378 | if ( isFlatDisplay ) { |
1354 | isFlatDisplay = false; | 1379 | isFlatDisplay = false; |
1355 | mPopupMenu->setItemChecked( 8,false ); | 1380 | mPopupMenu->setItemChecked( 8,false ); |
1356 | updateView(); | 1381 | updateView(); |
1357 | return; | 1382 | return; |
1358 | } | 1383 | } |
1359 | storeCurrentItem(); | 1384 | storeCurrentItem(); |
1360 | displayAllFlat(); | 1385 | displayAllFlat(); |
1361 | resetCurrentItem(); | 1386 | resetCurrentItem(); |
1362 | } | 1387 | } |
1363 | 1388 | ||
1364 | void KOTodoView::purgeCompleted() | 1389 | void KOTodoView::purgeCompleted() |
1365 | { | 1390 | { |
1366 | emit purgeCompletedSignal(); | 1391 | emit purgeCompletedSignal(); |
1367 | 1392 | ||
1368 | } | 1393 | } |
1369 | void KOTodoView::toggleQuickTodo() | 1394 | void KOTodoView::toggleQuickTodo() |
1370 | { | 1395 | { |
1371 | if ( mQuickAdd->isVisible() ) { | 1396 | if ( mQuickAdd->isVisible() ) { |
1372 | mQuickAdd->hide(); | 1397 | mQuickAdd->hide(); |
1373 | KOPrefs::instance()->mEnableQuickTodo = false; | 1398 | KOPrefs::instance()->mEnableQuickTodo = false; |
1374 | } | 1399 | } |
1375 | else { | 1400 | else { |
1376 | mQuickAdd->show(); | 1401 | mQuickAdd->show(); |
1377 | KOPrefs::instance()->mEnableQuickTodo = true; | 1402 | KOPrefs::instance()->mEnableQuickTodo = true; |
1378 | } | 1403 | } |
1379 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 1404 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
1380 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 1405 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
1381 | } | 1406 | } |
1382 | 1407 | ||
1383 | void KOTodoView::toggleRunning() | 1408 | void KOTodoView::toggleRunning() |
1384 | { | 1409 | { |
1385 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; | 1410 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; |
1386 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 1411 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
1387 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 1412 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
1388 | updateView(); | 1413 | updateView(); |
1389 | } | 1414 | } |
1390 | 1415 | ||
1391 | void KOTodoView::toggleCompleted() | 1416 | void KOTodoView::toggleCompleted() |
1392 | { | 1417 | { |
1393 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; | 1418 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; |
1394 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 1419 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index ceabdba..8f0c99e 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -1,262 +1,267 @@ | |||
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 <qdialog.h> | 35 | #include <qdialog.h> |
36 | #include <qlabel.h> | 36 | #include <qlabel.h> |
37 | #include <qlistview.h> | 37 | #include <qlistview.h> |
38 | #include <klistview.h> | 38 | #include <klistview.h> |
39 | 39 | ||
40 | #include <libkcal/calendar.h> | 40 | #include <libkcal/calendar.h> |
41 | #include <libkcal/todo.h> | 41 | #include <libkcal/todo.h> |
42 | 42 | ||
43 | #include <korganizer/baseview.h> | 43 | #include <korganizer/baseview.h> |
44 | 44 | ||
45 | #include "kotodoviewitem.h" | 45 | #include "kotodoviewitem.h" |
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "koglobals.h" | 47 | #include "koglobals.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | 49 | ||
50 | class QDragEnterEvent; | 50 | class QDragEnterEvent; |
51 | class QDragMoveEvent; | 51 | class QDragMoveEvent; |
52 | class QDragLeaveEvent; | 52 | class QDragLeaveEvent; |
53 | class QDropEvent; | 53 | class QDropEvent; |
54 | class KOTodoViewWhatsThis; | 54 | class KOTodoViewWhatsThis; |
55 | class KDateEdit; | ||
56 | class KOTimeEdit; | ||
55 | 57 | ||
56 | class DocPrefs; | 58 | class DocPrefs; |
57 | 59 | ||
58 | 60 | ||
59 | class KOStopTodoPrefs : public QDialog | 61 | class KOStopTodoPrefs : public QDialog |
60 | { | 62 | { |
61 | Q_OBJECT | 63 | Q_OBJECT |
62 | public: | 64 | public: |
63 | KOStopTodoPrefs( Todo* todo, QWidget *parent=0, const char *name=0 ) ; | 65 | KOStopTodoPrefs( Todo* todo, QWidget *parent=0, const char *name=0 ) ; |
64 | 66 | ||
65 | 67 | ||
66 | private slots: | 68 | private slots: |
67 | void doNotSave(); | 69 | void doNotSave(); |
68 | void accept(); | 70 | void accept(); |
69 | private: | 71 | private: |
70 | Todo* mTodo; | 72 | Todo* mTodo; |
73 | QLineEdit* mComment; | ||
74 | KDateEdit *sde, *ede; | ||
75 | KOTimeEdit *ste, *ete; | ||
71 | 76 | ||
72 | }; | 77 | }; |
73 | 78 | ||
74 | class KOTodoListView : public KListView | 79 | class KOTodoListView : public KListView |
75 | { | 80 | { |
76 | Q_OBJECT | 81 | Q_OBJECT |
77 | public: | 82 | public: |
78 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); | 83 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); |
79 | virtual ~KOTodoListView() {} | 84 | virtual ~KOTodoListView() {} |
80 | 85 | ||
81 | signals: | 86 | signals: |
82 | void paintNeeded(); | 87 | void paintNeeded(); |
83 | void todoDropped(Todo *, int); | 88 | void todoDropped(Todo *, int); |
84 | void double_Clicked(QListViewItem *item); | 89 | void double_Clicked(QListViewItem *item); |
85 | void reparentTodoSignal( Todo *,Todo * ); | 90 | void reparentTodoSignal( Todo *,Todo * ); |
86 | void unparentTodoSignal(Todo *); | 91 | void unparentTodoSignal(Todo *); |
87 | void deleteTodo( Todo * ); | 92 | void deleteTodo( Todo * ); |
88 | protected: | 93 | protected: |
89 | void wheelEvent (QWheelEvent *e); | 94 | void wheelEvent (QWheelEvent *e); |
90 | void contentsDragEnterEvent(QDragEnterEvent *); | 95 | void contentsDragEnterEvent(QDragEnterEvent *); |
91 | void contentsDragMoveEvent(QDragMoveEvent *); | 96 | void contentsDragMoveEvent(QDragMoveEvent *); |
92 | void contentsDragLeaveEvent(QDragLeaveEvent *); | 97 | void contentsDragLeaveEvent(QDragLeaveEvent *); |
93 | void contentsDropEvent(QDropEvent *); | 98 | void contentsDropEvent(QDropEvent *); |
94 | 99 | ||
95 | void contentsMousePressEvent(QMouseEvent *); | 100 | void contentsMousePressEvent(QMouseEvent *); |
96 | void contentsMouseMoveEvent(QMouseEvent *); | 101 | void contentsMouseMoveEvent(QMouseEvent *); |
97 | void contentsMouseReleaseEvent(QMouseEvent *); | 102 | void contentsMouseReleaseEvent(QMouseEvent *); |
98 | void contentsMouseDoubleClickEvent(QMouseEvent *); | 103 | void contentsMouseDoubleClickEvent(QMouseEvent *); |
99 | 104 | ||
100 | private: | 105 | private: |
101 | void paintEvent(QPaintEvent * pevent); | 106 | void paintEvent(QPaintEvent * pevent); |
102 | bool internalDrop; | 107 | bool internalDrop; |
103 | QString mName; | 108 | QString mName; |
104 | Calendar *mCalendar; | 109 | Calendar *mCalendar; |
105 | QPoint mPressPos; | 110 | QPoint mPressPos; |
106 | bool mMousePressed; | 111 | bool mMousePressed; |
107 | QListViewItem *mOldCurrent; | 112 | QListViewItem *mOldCurrent; |
108 | bool mFlagKeyPressed; | 113 | bool mFlagKeyPressed; |
109 | void keyPressEvent ( QKeyEvent * ) ; | 114 | void keyPressEvent ( QKeyEvent * ) ; |
110 | void keyReleaseEvent ( QKeyEvent * ) ; | 115 | void keyReleaseEvent ( QKeyEvent * ) ; |
111 | }; | 116 | }; |
112 | 117 | ||
113 | 118 | ||
114 | /** | 119 | /** |
115 | This is the line-edit on top of the todoview for fast addition of new todos | 120 | This is the line-edit on top of the todoview for fast addition of new todos |
116 | */ | 121 | */ |
117 | class KOQuickTodo : public QLineEdit | 122 | class KOQuickTodo : public QLineEdit |
118 | { | 123 | { |
119 | public: | 124 | public: |
120 | KOQuickTodo(QWidget *parent=0); | 125 | KOQuickTodo(QWidget *parent=0); |
121 | protected: | 126 | protected: |
122 | void focusInEvent(QFocusEvent *ev); | 127 | void focusInEvent(QFocusEvent *ev); |
123 | void focusOutEvent(QFocusEvent *ev); | 128 | void focusOutEvent(QFocusEvent *ev); |
124 | }; | 129 | }; |
125 | 130 | ||
126 | 131 | ||
127 | /** | 132 | /** |
128 | This class provides a multi-column list view of todo events. | 133 | This class provides a multi-column list view of todo events. |
129 | 134 | ||
130 | @short multi-column list view of todo events. | 135 | @short multi-column list view of todo events. |
131 | @author Cornelius Schumacher <schumacher@kde.org> | 136 | @author Cornelius Schumacher <schumacher@kde.org> |
132 | */ | 137 | */ |
133 | class KOTodoView : public KOrg::BaseView | 138 | class KOTodoView : public KOrg::BaseView |
134 | { | 139 | { |
135 | Q_OBJECT | 140 | Q_OBJECT |
136 | public: | 141 | public: |
137 | KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); | 142 | KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); |
138 | ~KOTodoView(); | 143 | ~KOTodoView(); |
139 | 144 | ||
140 | QPtrList<Incidence> selectedIncidences(); | 145 | QPtrList<Incidence> selectedIncidences(); |
141 | QPtrList<Todo> selectedTodos(); | 146 | QPtrList<Todo> selectedTodos(); |
142 | 147 | ||
143 | DateList selectedDates() | 148 | DateList selectedDates() |
144 | {DateList q; | 149 | {DateList q; |
145 | return q;} | 150 | return q;} |
146 | 151 | ||
147 | /** Return number of shown dates. TodoView does not show dates, */ | 152 | /** Return number of shown dates. TodoView does not show dates, */ |
148 | int currentDateCount() { return 0; } | 153 | int currentDateCount() { return 0; } |
149 | 154 | ||
150 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); | 155 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); |
151 | 156 | ||
152 | void setDocumentId( const QString & ); | 157 | void setDocumentId( const QString & ); |
153 | 158 | ||
154 | void saveLayout(KConfig *config, const QString &group) const; | 159 | void saveLayout(KConfig *config, const QString &group) const; |
155 | void restoreLayout(KConfig *config, const QString &group); | 160 | void restoreLayout(KConfig *config, const QString &group); |
156 | /** Create a popup menu to set categories */ | 161 | /** Create a popup menu to set categories */ |
157 | QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); | 162 | QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); |
158 | void setNavigator( DateNavigator* nav ) {mNavigator = nav;} | 163 | void setNavigator( DateNavigator* nav ) {mNavigator = nav;} |
159 | QString getWhatsThisText(QPoint p); | 164 | QString getWhatsThisText(QPoint p); |
160 | void clearList() {mTodoListView->clear(); } | 165 | void clearList() {mTodoListView->clear(); } |
161 | 166 | ||
162 | public slots: | 167 | public slots: |
163 | void updateView(); | 168 | void updateView(); |
164 | void updateConfig(); | 169 | void updateConfig(); |
165 | 170 | ||
166 | void changeEventDisplay(Event *, int); | 171 | void changeEventDisplay(Event *, int); |
167 | 172 | ||
168 | void showDates(const QDate &start, const QDate &end); | 173 | void showDates(const QDate &start, const QDate &end); |
169 | void showEvents(QPtrList<Event> eventList); | 174 | void showEvents(QPtrList<Event> eventList); |
170 | 175 | ||
171 | void clearSelection(); | 176 | void clearSelection(); |
172 | void jumpToDate (); | 177 | void jumpToDate (); |
173 | 178 | ||
174 | void editItem(QListViewItem *item); | 179 | void editItem(QListViewItem *item); |
175 | void showItem(QListViewItem *item,const QPoint &,int); | 180 | void showItem(QListViewItem *item,const QPoint &,int); |
176 | void popupMenu(QListViewItem *item,const QPoint &,int); | 181 | void popupMenu(QListViewItem *item,const QPoint &,int); |
177 | void newTodo(); | 182 | void newTodo(); |
178 | void newSubTodo(); | 183 | void newSubTodo(); |
179 | void unparentTodo(); | 184 | void unparentTodo(); |
180 | void reparentTodo(); | 185 | void reparentTodo(); |
181 | void showTodo(); | 186 | void showTodo(); |
182 | void editTodo(); | 187 | void editTodo(); |
183 | void cloneTodo(); | 188 | void cloneTodo(); |
184 | void cancelTodo(); | 189 | void cancelTodo(); |
185 | void moveTodo(); | 190 | void moveTodo(); |
186 | void beamTodo(); | 191 | void beamTodo(); |
187 | void deleteTodo(); | 192 | void deleteTodo(); |
188 | 193 | ||
189 | void setNewPriority(int); | 194 | void setNewPriority(int); |
190 | void setNewPercentage(int); | 195 | void setNewPercentage(int); |
191 | void changedCategories(int); | 196 | void changedCategories(int); |
192 | 197 | ||
193 | void setAllOpen(); | 198 | void setAllOpen(); |
194 | void setAllClose(); | 199 | void setAllClose(); |
195 | void setAllFlat(); | 200 | void setAllFlat(); |
196 | void displayAllFlat(); | 201 | void displayAllFlat(); |
197 | 202 | ||
198 | void purgeCompleted(); | 203 | void purgeCompleted(); |
199 | void toggleCompleted(); | 204 | void toggleCompleted(); |
200 | void toggleRunning(); | 205 | void toggleRunning(); |
201 | void toggleQuickTodo(); | 206 | void toggleQuickTodo(); |
202 | void updateTodo( Todo *, int ); | 207 | void updateTodo( Todo *, int ); |
203 | 208 | ||
204 | void itemClicked(QListViewItem *); | 209 | void itemClicked(QListViewItem *); |
205 | void itemStateChanged(QListViewItem *); | 210 | void itemStateChanged(QListViewItem *); |
206 | void modified(bool); | 211 | void modified(bool); |
207 | void itemDoubleClicked(QListViewItem *item); | 212 | void itemDoubleClicked(QListViewItem *item); |
208 | 213 | ||
209 | signals: | 214 | signals: |
210 | void newTodoSignal(); | 215 | void newTodoSignal(); |
211 | void newSubTodoSignal(Todo *); | 216 | void newSubTodoSignal(Todo *); |
212 | void unparentTodoSignal(Todo *); | 217 | void unparentTodoSignal(Todo *); |
213 | void reparentTodoSignal( Todo *,Todo * ); | 218 | void reparentTodoSignal( Todo *,Todo * ); |
214 | void showTodoSignal(Todo *); | 219 | void showTodoSignal(Todo *); |
215 | 220 | ||
216 | void editTodoSignal(Todo *); | 221 | void editTodoSignal(Todo *); |
217 | void deleteTodoSignal(Todo *); | 222 | void deleteTodoSignal(Todo *); |
218 | void todoModifiedSignal (Todo *, int); | 223 | void todoModifiedSignal (Todo *, int); |
219 | 224 | ||
220 | void isModified(bool); | 225 | void isModified(bool); |
221 | void cloneTodoSignal( Incidence * ); | 226 | void cloneTodoSignal( Incidence * ); |
222 | void cancelTodoSignal( Incidence * ); | 227 | void cancelTodoSignal( Incidence * ); |
223 | void moveTodoSignal( Incidence * ); | 228 | void moveTodoSignal( Incidence * ); |
224 | void beamTodoSignal( Incidence * ); | 229 | void beamTodoSignal( Incidence * ); |
225 | void purgeCompletedSignal(); | 230 | void purgeCompletedSignal(); |
226 | 231 | ||
227 | protected slots: | 232 | protected slots: |
228 | void toggleRunningItem(); | 233 | void toggleRunningItem(); |
229 | void paintNeeded(); | 234 | void paintNeeded(); |
230 | void processSelectionChange(); | 235 | void processSelectionChange(); |
231 | void addQuickTodo(); | 236 | void addQuickTodo(); |
232 | void setTodoModified( Todo* ); | 237 | void setTodoModified( Todo* ); |
233 | void todoModified(Todo *, int ); | 238 | void todoModified(Todo *, int ); |
234 | 239 | ||
235 | private: | 240 | private: |
236 | /* | 241 | /* |
237 | * the TodoEditor approach is rather unscaling in the long | 242 | * the TodoEditor approach is rather unscaling in the long |
238 | * run. | 243 | * run. |
239 | * Korganizer keeps it in memory and we need to update | 244 | * Korganizer keeps it in memory and we need to update |
240 | * 1. make KOTodoViewItem a QObject again? | 245 | * 1. make KOTodoViewItem a QObject again? |
241 | * 2. add a public method for setting one todo modified? | 246 | * 2. add a public method for setting one todo modified? |
242 | * 3. add a private method for setting a todo modified + friend here? | 247 | * 3. add a private method for setting a todo modified + friend here? |
243 | * -- zecke 2002-07-08 | 248 | * -- zecke 2002-07-08 |
244 | */ | 249 | */ |
245 | KOTodoViewWhatsThis* mKOTodoViewWhatsThis; | 250 | KOTodoViewWhatsThis* mKOTodoViewWhatsThis; |
246 | friend class KOTodoListView; | 251 | friend class KOTodoListView; |
247 | void paintEvent(QPaintEvent * pevent); | 252 | void paintEvent(QPaintEvent * pevent); |
248 | bool mPendingUpdateBeforeRepaint; | 253 | bool mPendingUpdateBeforeRepaint; |
249 | friend class KOTodoViewItem; | 254 | friend class KOTodoViewItem; |
250 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); | 255 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); |
251 | void restoreItemState( QListViewItem * ); | 256 | void restoreItemState( QListViewItem * ); |
252 | 257 | ||
253 | bool checkTodo( Todo * ); | 258 | bool checkTodo( Todo * ); |
254 | bool isFlatDisplay; | 259 | bool isFlatDisplay; |
255 | void setOpen( QListViewItem*, bool setOpen); | 260 | void setOpen( QListViewItem*, bool setOpen); |
256 | KOTodoListView *mTodoListView; | 261 | KOTodoListView *mTodoListView; |
257 | QPopupMenu *mItemPopupMenu; | 262 | QPopupMenu *mItemPopupMenu; |
258 | QPopupMenu *mPopupMenu; | 263 | QPopupMenu *mPopupMenu; |
259 | QPopupMenu *mPriorityPopupMenu; | 264 | QPopupMenu *mPriorityPopupMenu; |
260 | QPopupMenu *mPercentageCompletedPopupMenu; | 265 | QPopupMenu *mPercentageCompletedPopupMenu; |
261 | QPopupMenu *mCategoryPopupMenu; | 266 | QPopupMenu *mCategoryPopupMenu; |
262 | 267 | ||