author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/kotodoview.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | korganizer/kotodoview.cpp | 198 |
1 files changed, 107 insertions, 91 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index ba94057..2b8fbd3 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -18,23 +18,39 @@ | |||
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 <QDesktopWidget> | ||
25 | |||
24 | #include <qlayout.h> | 26 | #include <qlayout.h> |
25 | #include <qheader.h> | 27 | #include <q3header.h> |
26 | #include <qcursor.h> | 28 | #include <qcursor.h> |
27 | #include <qwhatsthis.h> | 29 | #include <q3whatsthis.h> |
28 | #include <qdialog.h> | 30 | #include <qdialog.h> |
29 | #include <qlabel.h> | 31 | #include <qlabel.h> |
30 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
31 | 33 | ||
32 | #include <qinputdialog.h> | 34 | #include <qinputdialog.h> |
33 | 35 | ||
34 | #include <qvbox.h> | 36 | #include <q3vbox.h> |
37 | //Added by qt3to4: | ||
38 | #include <QWheelEvent> | ||
39 | #include <QFocusEvent> | ||
40 | #include <QDragLeaveEvent> | ||
41 | #include <QMouseEvent> | ||
42 | #include <QDragEnterEvent> | ||
43 | #include <QKeyEvent> | ||
44 | #include <Q3HBoxLayout> | ||
45 | #include <Q3VBoxLayout> | ||
46 | #include <QDropEvent> | ||
47 | #include <QDragMoveEvent> | ||
48 | #include <QPaintEvent> | ||
49 | #include <Q3PopupMenu> | ||
50 | #include <Q3PtrList> | ||
35 | #include <kdebug.h> | 51 | #include <kdebug.h> |
36 | #include "koprefs.h" | 52 | #include "koprefs.h" |
37 | #include <klocale.h> | 53 | #include <klocale.h> |
38 | #include <kglobal.h> | 54 | #include <kglobal.h> |
39 | #include <kdateedit.h> | 55 | #include <kdateedit.h> |
40 | #include "ktimeedit.h" | 56 | #include "ktimeedit.h" |
@@ -65,18 +81,18 @@ using namespace KOrg; | |||
65 | 81 | ||
66 | KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) : | 82 | KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) : |
67 | QDialog( parent, name, true ) | 83 | QDialog( parent, name, true ) |
68 | { | 84 | { |
69 | mStopAll = true; | 85 | mStopAll = true; |
70 | setCaption( i18n("Start todo") ); | 86 | setCaption( i18n("Start todo") ); |
71 | QVBoxLayout* lay = new QVBoxLayout( this ); | 87 | Q3VBoxLayout* lay = new Q3VBoxLayout( this ); |
72 | lay->setSpacing( 3 ); | 88 | lay->setSpacing( 3 ); |
73 | lay->setMargin( 3 ); | 89 | lay->setMargin( 3 ); |
74 | QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this ); | 90 | QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this ); |
75 | lay->addWidget( lab ); | 91 | lay->addWidget( lab ); |
76 | lab->setAlignment( AlignCenter ); | 92 | lab->setAlignment( Qt::AlignCenter ); |
77 | 93 | ||
78 | QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this ); | 94 | QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this ); |
79 | lay->addWidget( ok ); | 95 | lay->addWidget( ok ); |
80 | ok->setDefault( true ); | 96 | ok->setDefault( true ); |
81 | QPushButton * start = new QPushButton( i18n("Start todo"), this ); | 97 | QPushButton * start = new QPushButton( i18n("Start todo"), this ); |
82 | lay->addWidget( start ); | 98 | lay->addWidget( start ); |
@@ -95,26 +111,26 @@ void KOStartTodoPrefs::doStop() | |||
95 | } | 111 | } |
96 | KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : | 112 | KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : |
97 | QDialog( parent, name, true ) | 113 | QDialog( parent, name, true ) |
98 | { | 114 | { |
99 | mTodo = todo; | 115 | mTodo = todo; |
100 | setCaption( i18n("Stop todo") ); | 116 | setCaption( i18n("Stop todo") ); |
101 | QVBoxLayout* lay = new QVBoxLayout( this ); | 117 | Q3VBoxLayout* lay = new Q3VBoxLayout( this ); |
102 | lay->setSpacing( 3 ); | 118 | lay->setSpacing( 3 ); |
103 | lay->setMargin( 3 ); | 119 | lay->setMargin( 3 ); |
104 | QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this ); | 120 | QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this ); |
105 | lay->addWidget( lab ); | 121 | lay->addWidget( lab ); |
106 | lab->setAlignment( AlignHCenter ); | 122 | lab->setAlignment( Qt::AlignHCenter ); |
107 | lab = new QLabel( i18n("Additional Comment:"), this ); | 123 | lab = new QLabel( i18n("Additional Comment:"), this ); |
108 | lay->addWidget( lab ); | 124 | lay->addWidget( lab ); |
109 | mComment = new QLineEdit( this ); | 125 | mComment = new QLineEdit( this ); |
110 | lay->addWidget( mComment ); | 126 | lay->addWidget( mComment ); |
111 | QHBox * start = new QHBox ( this ); | 127 | Q3HBox * start = new Q3HBox ( this ); |
112 | lay->addWidget( start ); | 128 | lay->addWidget( start ); |
113 | lab = new QLabel( i18n("Start:"), start ); | 129 | lab = new QLabel( i18n("Start:"), start ); |
114 | QHBox * end = new QHBox ( this ); | 130 | Q3HBox * end = new Q3HBox ( this ); |
115 | lay->addWidget( end ); | 131 | lay->addWidget( end ); |
116 | lab = new QLabel( i18n("End:"), end ); | 132 | lab = new QLabel( i18n("End:"), end ); |
117 | sde = new KDateEdit( start ); | 133 | sde = new KDateEdit( start ); |
118 | ste = new KOTimeEdit( start ); | 134 | ste = new KOTimeEdit( start ); |
119 | connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); | 135 | connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); |
120 | ede = new KDateEdit( end ); | 136 | ede = new KDateEdit( end ); |
@@ -170,16 +186,16 @@ void KOStopTodoPrefs::doNotSave() | |||
170 | if (result != KMessageBox::Continue) return; | 186 | if (result != KMessageBox::Continue) return; |
171 | mTodo->stopRunning(); | 187 | mTodo->stopRunning(); |
172 | QDialog::accept(); | 188 | QDialog::accept(); |
173 | } | 189 | } |
174 | 190 | ||
175 | 191 | ||
176 | class KOTodoViewWhatsThis :public QWhatsThis | 192 | class KOTodoViewWhatsThis :public Q3WhatsThis |
177 | { | 193 | { |
178 | public: | 194 | public: |
179 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 195 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : Q3WhatsThis( wid ), _wid(wid),_view (view) { }; |
180 | 196 | ||
181 | protected: | 197 | protected: |
182 | virtual QString text( const QPoint& p) | 198 | virtual QString text( const QPoint& p) |
183 | { | 199 | { |
184 | return _view->getWhatsThisText(p) ; | 200 | return _view->getWhatsThisText(p) ; |
185 | } | 201 | } |
@@ -211,13 +227,13 @@ KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, | |||
211 | 227 | ||
212 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) | 228 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) |
213 | { | 229 | { |
214 | #ifndef KORG_NODND | 230 | #ifndef KORG_NODND |
215 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; | 231 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; |
216 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 232 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
217 | !QTextDrag::canDecode( e ) ) { | 233 | !Q3TextDrag::canDecode( e ) ) { |
218 | e->ignore(); | 234 | e->ignore(); |
219 | return; | 235 | return; |
220 | } | 236 | } |
221 | 237 | ||
222 | mOldCurrent = currentItem(); | 238 | mOldCurrent = currentItem(); |
223 | #endif | 239 | #endif |
@@ -227,13 +243,13 @@ void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) | |||
227 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) | 243 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) |
228 | { | 244 | { |
229 | #ifndef KORG_NODND | 245 | #ifndef KORG_NODND |
230 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; | 246 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; |
231 | 247 | ||
232 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 248 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
233 | !QTextDrag::canDecode( e ) ) { | 249 | !Q3TextDrag::canDecode( e ) ) { |
234 | e->ignore(); | 250 | e->ignore(); |
235 | return; | 251 | return; |
236 | } | 252 | } |
237 | 253 | ||
238 | e->accept(); | 254 | e->accept(); |
239 | #endif | 255 | #endif |
@@ -252,13 +268,13 @@ void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) | |||
252 | void KOTodoListView::contentsDropEvent(QDropEvent *e) | 268 | void KOTodoListView::contentsDropEvent(QDropEvent *e) |
253 | { | 269 | { |
254 | #ifndef KORG_NODND | 270 | #ifndef KORG_NODND |
255 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; | 271 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; |
256 | 272 | ||
257 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 273 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
258 | !QTextDrag::canDecode( e ) ) { | 274 | !Q3TextDrag::canDecode( e ) ) { |
259 | e->ignore(); | 275 | e->ignore(); |
260 | return; | 276 | return; |
261 | } | 277 | } |
262 | 278 | ||
263 | DndFactory factory( mCalendar ); | 279 | DndFactory factory( mCalendar ); |
264 | Todo *todo = factory.createDropTodo(e); | 280 | Todo *todo = factory.createDropTodo(e); |
@@ -297,13 +313,13 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e) | |||
297 | if ( destinationEvent ) | 313 | if ( destinationEvent ) |
298 | reparentTodoSignal( destinationEvent, todo ); | 314 | reparentTodoSignal( destinationEvent, todo ); |
299 | } | 315 | } |
300 | } | 316 | } |
301 | else { | 317 | else { |
302 | QString text; | 318 | QString text; |
303 | if (QTextDrag::decode(e,text)) { | 319 | if (Q3TextDrag::decode(e,text)) { |
304 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); | 320 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); |
305 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); | 321 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); |
306 | qDebug("Dropped : " + text); | 322 | qDebug("Dropped : " + text); |
307 | QStringList emails = QStringList::split(",",text); | 323 | QStringList emails = QStringList::split(",",text); |
308 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 324 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
309 | int pos = (*it).find("<"); | 325 | int pos = (*it).find("<"); |
@@ -320,20 +336,20 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e) | |||
320 | } | 336 | } |
321 | } | 337 | } |
322 | #endif | 338 | #endif |
323 | } | 339 | } |
324 | void KOTodoListView::wheelEvent (QWheelEvent *e) | 340 | void KOTodoListView::wheelEvent (QWheelEvent *e) |
325 | { | 341 | { |
326 | QListView::wheelEvent (e); | 342 | Q3ListView::wheelEvent (e); |
327 | } | 343 | } |
328 | 344 | ||
329 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | 345 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) |
330 | { | 346 | { |
331 | 347 | ||
332 | QPoint p(contentsToViewport(e->pos())); | 348 | QPoint p(contentsToViewport(e->pos())); |
333 | QListViewItem *i = itemAt(p); | 349 | Q3ListViewItem *i = itemAt(p); |
334 | bool rootClicked = true; | 350 | bool rootClicked = true; |
335 | if (i) { | 351 | if (i) { |
336 | // if the user clicked into the root decoration of the item, don't | 352 | // if the user clicked into the root decoration of the item, don't |
337 | // try to start a drag! | 353 | // try to start a drag! |
338 | int X = p.x(); | 354 | int X = p.x(); |
339 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); | 355 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); |
@@ -345,41 +361,41 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | |||
345 | } | 361 | } |
346 | } else { | 362 | } else { |
347 | rootClicked = false; | 363 | rootClicked = false; |
348 | } | 364 | } |
349 | #ifndef KORG_NODND | 365 | #ifndef KORG_NODND |
350 | mMousePressed = false; | 366 | mMousePressed = false; |
351 | if (! rootClicked && !( e->button() == RightButton) ) { | 367 | if (! rootClicked && !( e->button() == Qt::RightButton) ) { |
352 | mPressPos = e->pos(); | 368 | mPressPos = e->pos(); |
353 | mMousePressed = true; | 369 | mMousePressed = true; |
354 | } else { | 370 | } else { |
355 | mMousePressed = false; | 371 | mMousePressed = false; |
356 | } | 372 | } |
357 | #endif | 373 | #endif |
358 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); | 374 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); |
359 | #ifndef DESKTOP_VERSION | 375 | #ifndef DESKTOP_VERSION |
360 | if (!( e->button() == RightButton && rootClicked) ) | 376 | if (!( e->button() == RightButton && rootClicked) ) |
361 | QListView::contentsMousePressEvent(e); | 377 | Q3ListView::contentsMousePressEvent(e); |
362 | #else | 378 | #else |
363 | QListView::contentsMousePressEvent(e); | 379 | Q3ListView::contentsMousePressEvent(e); |
364 | #endif | 380 | #endif |
365 | } | 381 | } |
366 | void KOTodoListView::paintEvent(QPaintEvent* e) | 382 | void KOTodoListView::paintEvent(QPaintEvent* e) |
367 | { | 383 | { |
368 | emit paintNeeded(); | 384 | emit paintNeeded(); |
369 | QListView::paintEvent( e); | 385 | Q3ListView::paintEvent( e); |
370 | } | 386 | } |
371 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 387 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
372 | { | 388 | { |
373 | 389 | ||
374 | #ifndef KORG_NODND | 390 | #ifndef KORG_NODND |
375 | //QListView::contentsMouseMoveEvent(e); | 391 | //QListView::contentsMouseMoveEvent(e); |
376 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > | 392 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > |
377 | QApplication::startDragDistance()*3) { | 393 | QApplication::startDragDistance()*3) { |
378 | mMousePressed = false; | 394 | mMousePressed = false; |
379 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); | 395 | Q3ListViewItem *item = itemAt(contentsToViewport(mPressPos)); |
380 | if (item) { | 396 | if (item) { |
381 | DndFactory factory( mCalendar ); | 397 | DndFactory factory( mCalendar ); |
382 | ICalDrag *vd = factory.createDrag( | 398 | ICalDrag *vd = factory.createDrag( |
383 | ((KOTodoViewItem *)item)->todo(),viewport()); | 399 | ((KOTodoViewItem *)item)->todo(),viewport()); |
384 | internalDrop = false; | 400 | internalDrop = false; |
385 | // we cannot do any senseful here, because the DnD is still broken in Qt | 401 | // we cannot do any senseful here, because the DnD is still broken in Qt |
@@ -419,19 +435,19 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | |||
419 | e->ignore(); | 435 | e->ignore(); |
420 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 436 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
421 | return; | 437 | return; |
422 | } | 438 | } |
423 | if (! e->isAutoRepeat() ) | 439 | if (! e->isAutoRepeat() ) |
424 | mFlagKeyPressed = true; | 440 | mFlagKeyPressed = true; |
425 | QListViewItem* cn; | 441 | Q3ListViewItem* cn; |
426 | if ( (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) && mName != "todolistsmall") { | 442 | if ( (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) && mName != "todolistsmall") { |
427 | cn = currentItem(); | 443 | cn = currentItem(); |
428 | if ( cn ) { | 444 | if ( cn ) { |
429 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 445 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
430 | if ( ci ){ | 446 | if ( ci ){ |
431 | if ( e->state() == ShiftButton ) | 447 | if ( e->state() == Qt::ShiftButton ) |
432 | ci->setOn( false ); | 448 | ci->setOn( false ); |
433 | else | 449 | else |
434 | ci->setOn( true ); | 450 | ci->setOn( true ); |
435 | cn = cn->itemBelow(); | 451 | cn = cn->itemBelow(); |
436 | if ( cn ) { | 452 | if ( cn ) { |
437 | setCurrentItem ( cn ); | 453 | setCurrentItem ( cn ); |
@@ -446,18 +462,18 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | |||
446 | } | 462 | } |
447 | 463 | ||
448 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 464 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
449 | switch ( e->key() ) { | 465 | switch ( e->key() ) { |
450 | case Qt::Key_Down: | 466 | case Qt::Key_Down: |
451 | case Qt::Key_Up: | 467 | case Qt::Key_Up: |
452 | QListView::keyPressEvent ( e ); | 468 | Q3ListView::keyPressEvent ( e ); |
453 | e->accept(); | 469 | e->accept(); |
454 | break; | 470 | break; |
455 | case Qt::Key_Left: | 471 | case Qt::Key_Left: |
456 | case Qt::Key_Right: | 472 | case Qt::Key_Right: |
457 | QListView::keyPressEvent ( e ); | 473 | Q3ListView::keyPressEvent ( e ); |
458 | e->accept(); | 474 | e->accept(); |
459 | return; | 475 | return; |
460 | break; | 476 | break; |
461 | default: | 477 | default: |
462 | e->ignore(); | 478 | e->ignore(); |
463 | break; | 479 | break; |
@@ -465,23 +481,23 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | |||
465 | return; | 481 | return; |
466 | } | 482 | } |
467 | e->ignore(); | 483 | e->ignore(); |
468 | } | 484 | } |
469 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 485 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
470 | { | 486 | { |
471 | QListView::contentsMouseReleaseEvent(e); | 487 | Q3ListView::contentsMouseReleaseEvent(e); |
472 | mMousePressed = false; | 488 | mMousePressed = false; |
473 | } | 489 | } |
474 | 490 | ||
475 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 491 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
476 | { | 492 | { |
477 | if (!e) return; | 493 | if (!e) return; |
478 | 494 | ||
479 | QPoint vp = contentsToViewport(e->pos()); | 495 | QPoint vp = contentsToViewport(e->pos()); |
480 | 496 | ||
481 | QListViewItem *item = itemAt(vp); | 497 | Q3ListViewItem *item = itemAt(vp); |
482 | 498 | ||
483 | emit double_Clicked(item); | 499 | emit double_Clicked(item); |
484 | if (!item) return; | 500 | if (!item) return; |
485 | 501 | ||
486 | emit doubleClicked(item,vp,0); | 502 | emit doubleClicked(item,vp,0); |
487 | } | 503 | } |
@@ -489,13 +505,13 @@ void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | |||
489 | ///////////////////////////////////////////////////////////////////////////// | 505 | ///////////////////////////////////////////////////////////////////////////// |
490 | 506 | ||
491 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 507 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
492 | QLineEdit(parent) | 508 | QLineEdit(parent) |
493 | { | 509 | { |
494 | setText(i18n("Click to add new Todo")); | 510 | setText(i18n("Click to add new Todo")); |
495 | setFocusPolicy ( QWidget::ClickFocus ); | 511 | setFocusPolicy ( Qt::ClickFocus ); |
496 | } | 512 | } |
497 | 513 | ||
498 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 514 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
499 | { | 515 | { |
500 | if ( text()==i18n("Click to add new Todo") ) | 516 | if ( text()==i18n("Click to add new Todo") ) |
501 | setText(""); | 517 | setText(""); |
@@ -520,20 +536,20 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
520 | mCurItemAbove = 0; | 536 | mCurItemAbove = 0; |
521 | mActiveItem = 0; | 537 | mActiveItem = 0; |
522 | mCategoryPopupMenu = 0; | 538 | mCategoryPopupMenu = 0; |
523 | mPendingUpdateBeforeRepaint = false; | 539 | mPendingUpdateBeforeRepaint = false; |
524 | isFlatDisplay = false; | 540 | isFlatDisplay = false; |
525 | mNavigator = 0; | 541 | mNavigator = 0; |
526 | QBoxLayout *topLayout = new QVBoxLayout(this); | 542 | Q3BoxLayout *topLayout = new Q3VBoxLayout(this); |
527 | mName = QString ( name ); | 543 | mName = QString ( name ); |
528 | mBlockUpdate = false; | 544 | mBlockUpdate = false; |
529 | mQuickBar = new QWidget( this ); | 545 | mQuickBar = new QWidget( this ); |
530 | topLayout->addWidget(mQuickBar); | 546 | topLayout->addWidget(mQuickBar); |
531 | 547 | ||
532 | mQuickAdd = new KOQuickTodo(mQuickBar); | 548 | mQuickAdd = new KOQuickTodo(mQuickBar); |
533 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); | 549 | Q3BoxLayout *quickLayout = new Q3HBoxLayout(mQuickBar); |
534 | quickLayout->addWidget( mQuickAdd ); | 550 | quickLayout->addWidget( mQuickAdd ); |
535 | mNewSubBut = new QPushButton( "sub",mQuickBar ); | 551 | mNewSubBut = new QPushButton( "sub",mQuickBar ); |
536 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); | 552 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); |
537 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); | 553 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); |
538 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); | 554 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); |
539 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); | 555 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); |
@@ -565,25 +581,25 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
565 | s_done->setFixedHeight(fixhei ); | 581 | s_done->setFixedHeight(fixhei ); |
566 | allopen->setFixedHeight(fixhei ); | 582 | allopen->setFixedHeight(fixhei ); |
567 | allclose->setFixedHeight(fixhei ); | 583 | allclose->setFixedHeight(fixhei ); |
568 | s_run->setFixedHeight(fixhei ); | 584 | s_run->setFixedHeight(fixhei ); |
569 | mNewSubBut->setFixedHeight(fixhei ); | 585 | mNewSubBut->setFixedHeight(fixhei ); |
570 | 586 | ||
571 | flat->setFocusPolicy( NoFocus ); | 587 | flat->setFocusPolicy( Qt::NoFocus ); |
572 | s_done->setFocusPolicy( NoFocus ); | 588 | s_done->setFocusPolicy( Qt::NoFocus ); |
573 | allopen->setFocusPolicy( NoFocus ); | 589 | allopen->setFocusPolicy( Qt::NoFocus ); |
574 | allclose->setFocusPolicy( NoFocus ); | 590 | allclose->setFocusPolicy( Qt::NoFocus ); |
575 | s_run->setFocusPolicy( NoFocus ); | 591 | s_run->setFocusPolicy( Qt::NoFocus ); |
576 | mNewSubBut->setFocusPolicy( NoFocus ); | 592 | mNewSubBut->setFocusPolicy( Qt::NoFocus ); |
577 | 593 | ||
578 | QWhatsThis::add( flat, i18n("Click this button to display all todos in a <b>flat</b> hierarchy" ) ); | 594 | Q3WhatsThis::add( flat, i18n("Click this button to display all todos in a <b>flat</b> hierarchy" ) ); |
579 | QWhatsThis::add( allopen, i18n("Click this button to display all todos <b>openend</b>" ) ); | 595 | Q3WhatsThis::add( allopen, i18n("Click this button to display all todos <b>openend</b>" ) ); |
580 | QWhatsThis::add( allclose, i18n("Click this button to display all todos <b>closed</b>" ) ); | 596 | Q3WhatsThis::add( allclose, i18n("Click this button to display all todos <b>closed</b>" ) ); |
581 | QWhatsThis::add( s_run, i18n("Click this button to toggle show/hide <b>running</b> todos" ) ); | 597 | Q3WhatsThis::add( s_run, i18n("Click this button to toggle show/hide <b>running</b> todos" ) ); |
582 | QWhatsThis::add( mNewSubBut, i18n("Click this button to add a new subtodo to the currently selected todo" ) ); | 598 | Q3WhatsThis::add( mNewSubBut, i18n("Click this button to add a new subtodo to the currently selected todo" ) ); |
583 | QWhatsThis::add( s_done, i18n("Click this button to toggle show/hide <b>completed</b> todos" ) ); | 599 | Q3WhatsThis::add( s_done, i18n("Click this button to toggle show/hide <b>completed</b> todos" ) ); |
584 | 600 | ||
585 | quickLayout->addWidget( mNewSubBut ); | 601 | quickLayout->addWidget( mNewSubBut ); |
586 | quickLayout->addWidget( s_done ); | 602 | quickLayout->addWidget( s_done ); |
587 | quickLayout->addWidget( s_run ); | 603 | quickLayout->addWidget( s_run ); |
588 | quickLayout->addWidget( allopen ); | 604 | quickLayout->addWidget( allopen ); |
589 | quickLayout->addWidget( allclose ); | 605 | quickLayout->addWidget( allclose ); |
@@ -598,77 +614,77 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
598 | mTodoListView->setAllColumnsShowFocus(true); | 614 | mTodoListView->setAllColumnsShowFocus(true); |
599 | 615 | ||
600 | mTodoListView->setShowSortIndicator(true); | 616 | mTodoListView->setShowSortIndicator(true); |
601 | 617 | ||
602 | mTodoListView->addColumn(i18n("Todo")); | 618 | mTodoListView->addColumn(i18n("Todo")); |
603 | mTodoListView->addColumn(i18n("Prio")); | 619 | mTodoListView->addColumn(i18n("Prio")); |
604 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 620 | mTodoListView->setColumnAlignment(1,Qt::AlignHCenter); |
605 | mTodoListView->addColumn(i18n("Complete")); | 621 | mTodoListView->addColumn(i18n("Complete")); |
606 | mTodoListView->setColumnAlignment(2,AlignCenter); | 622 | mTodoListView->setColumnAlignment(2,Qt::AlignCenter); |
607 | 623 | ||
608 | mTodoListView->addColumn(i18n("Due Date")); | 624 | mTodoListView->addColumn(i18n("Due Date")); |
609 | mTodoListView->setColumnAlignment(3,AlignLeft); | 625 | mTodoListView->setColumnAlignment(3,Qt::AlignLeft); |
610 | mTodoListView->addColumn(i18n("Due Time")); | 626 | mTodoListView->addColumn(i18n("Due Time")); |
611 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 627 | mTodoListView->setColumnAlignment(4,Qt::AlignHCenter); |
612 | 628 | ||
613 | mTodoListView->addColumn(i18n("Start Date")); | 629 | mTodoListView->addColumn(i18n("Start Date")); |
614 | mTodoListView->setColumnAlignment(5,AlignLeft); | 630 | mTodoListView->setColumnAlignment(5,Qt::AlignLeft); |
615 | mTodoListView->addColumn(i18n("Start Time")); | 631 | mTodoListView->addColumn(i18n("Start Time")); |
616 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 632 | mTodoListView->setColumnAlignment(6,Qt::AlignHCenter); |
617 | 633 | ||
618 | //mTodoListView->addColumn(i18n("Cancelled")); | 634 | //mTodoListView->addColumn(i18n("Cancelled")); |
619 | mTodoListView->addColumn(i18n("Categories")); | 635 | mTodoListView->addColumn(i18n("Categories")); |
620 | mTodoListView->addColumn(i18n("Calendar")); | 636 | mTodoListView->addColumn(i18n("Calendar")); |
621 | mTodoListView->addColumn(i18n("Last Modified")); | 637 | mTodoListView->addColumn(i18n("Last Modified")); |
622 | mTodoListView->addColumn(i18n("Created")); | 638 | mTodoListView->addColumn(i18n("Created")); |
623 | mTodoListView->addColumn(i18n("Last Modified Sub")); | 639 | mTodoListView->addColumn(i18n("Last Modified Sub")); |
624 | #if 0 | 640 | #if 0 |
625 | mTodoListView->addColumn(i18n("Sort Id")); | 641 | mTodoListView->addColumn(i18n("Sort Id")); |
626 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 642 | mTodoListView->setColumnAlignment(4,Qt::AlignHCenter); |
627 | #endif | 643 | #endif |
628 | 644 | ||
629 | mTodoListView->setMinimumHeight( 60 ); | 645 | mTodoListView->setMinimumHeight( 60 ); |
630 | mTodoListView->setItemsRenameable( true ); | 646 | mTodoListView->setItemsRenameable( true ); |
631 | mTodoListView->setRenameable( 0 ); | 647 | mTodoListView->setRenameable( 0 ); |
632 | mTodoListView->setColumnWidth( 0, 120 ); | 648 | mTodoListView->setColumnWidth( 0, 120 ); |
633 | int iii = 0; | 649 | int iii = 0; |
634 | for ( iii = 0; iii< 12 ; ++iii ) | 650 | for ( iii = 0; iii< 12 ; ++iii ) |
635 | mTodoListView->setColumnWidthMode( iii, QListView::Manual ); | 651 | mTodoListView->setColumnWidthMode( iii, Q3ListView::Manual ); |
636 | 652 | ||
637 | 653 | ||
638 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | 654 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); |
639 | 655 | ||
640 | mPriorityPopupMenu = new QPopupMenu(this); | 656 | mPriorityPopupMenu = new Q3PopupMenu(this); |
641 | for (int i = 1; i <= 5; i++) { | 657 | for (int i = 1; i <= 5; i++) { |
642 | QString label = QString ("%1").arg (i); | 658 | QString label = QString ("%1").arg (i); |
643 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 659 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
644 | } | 660 | } |
645 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 661 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
646 | 662 | ||
647 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 663 | mPercentageCompletedPopupMenu = new Q3PopupMenu(this); |
648 | for (int i = 0; i <= 100; i+=20) { | 664 | for (int i = 0; i <= 100; i+=20) { |
649 | QString label = QString ("%1 %").arg (i); | 665 | QString label = QString ("%1 %").arg (i); |
650 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 666 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
651 | } | 667 | } |
652 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 668 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
653 | 669 | ||
654 | 670 | ||
655 | mCategoryPopupMenu = new QPopupMenu (this); | 671 | mCategoryPopupMenu = new Q3PopupMenu (this); |
656 | mCategoryPopupMenu->setCheckable (true); | 672 | mCategoryPopupMenu->setCheckable (true); |
657 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 673 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
658 | connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); | 674 | connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); |
659 | 675 | ||
660 | mCalPopupMenu = new QPopupMenu (this); | 676 | mCalPopupMenu = new Q3PopupMenu (this); |
661 | mCalPopupMenu->setCheckable (true); | 677 | mCalPopupMenu->setCheckable (true); |
662 | connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); | 678 | connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); |
663 | connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); | 679 | connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); |
664 | 680 | ||
665 | 681 | ||
666 | 682 | ||
667 | 683 | ||
668 | mItemPopupMenu = new QPopupMenu(this); | 684 | mItemPopupMenu = new Q3PopupMenu(this); |
669 | mItemPopupMenu->insertItem(i18n("Show"), this, | 685 | mItemPopupMenu->insertItem(i18n("Show"), this, |
670 | SLOT (showTodo())); | 686 | SLOT (showTodo())); |
671 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 687 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
672 | SLOT (editTodo())); | 688 | SLOT (editTodo())); |
673 | mItemPopupMenu->insertItem( i18n("Delete..."), this, | 689 | mItemPopupMenu->insertItem( i18n("Delete..."), this, |
674 | SLOT (deleteTodo())); | 690 | SLOT (deleteTodo())); |
@@ -707,13 +723,13 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
707 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 723 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
708 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 724 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
709 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 725 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
710 | this, SLOT( toggleRunning() ),0, 35 ); | 726 | this, SLOT( toggleRunning() ),0, 35 ); |
711 | 727 | ||
712 | #endif | 728 | #endif |
713 | mPopupMenu = new QPopupMenu(this); | 729 | mPopupMenu = new Q3PopupMenu(this); |
714 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 730 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
715 | SLOT (newTodo()),0,1); | 731 | SLOT (newTodo()),0,1); |
716 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."), | 732 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."), |
717 | this, SLOT(purgeCompleted()),0,2); | 733 | this, SLOT(purgeCompleted()),0,2); |
718 | mPopupMenu->insertItem(i18n("Show Completed"), | 734 | mPopupMenu->insertItem(i18n("Show Completed"), |
719 | this, SLOT( toggleCompleted() ),0,3 ); | 735 | this, SLOT( toggleCompleted() ),0,3 ); |
@@ -743,44 +759,44 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
743 | 759 | ||
744 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 760 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
745 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 761 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
746 | 762 | ||
747 | 763 | ||
748 | // Double clicking conflicts with opening/closing the subtree | 764 | // Double clicking conflicts with opening/closing the subtree |
749 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 765 | connect( mTodoListView, SIGNAL( doubleClicked( Q3ListViewItem *) ), |
750 | SLOT( editItem( QListViewItem *) ) ); | 766 | SLOT( editItem( Q3ListViewItem *) ) ); |
751 | /* | 767 | /* |
752 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 768 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
753 | const QPoint &,int ) ), | 769 | const QPoint &,int ) ), |
754 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 770 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
755 | */ | 771 | */ |
756 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 772 | connect( mTodoListView, SIGNAL( contextRequest ( Q3ListViewItem *, |
757 | const QPoint &,int ) ), | 773 | const QPoint &,int ) ), |
758 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 774 | SLOT( popupMenu( Q3ListViewItem *, const QPoint & ,int) ) ); |
759 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 775 | connect( mTodoListView, SIGNAL( clicked( Q3ListViewItem * ) ), |
760 | SLOT( itemClicked( QListViewItem * ) ) ); | 776 | SLOT( itemClicked( Q3ListViewItem * ) ) ); |
761 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 777 | connect( mTodoListView, SIGNAL( double_Clicked( Q3ListViewItem * ) ), |
762 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 778 | SLOT( itemDoubleClicked( Q3ListViewItem * ) ) ); |
763 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 779 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
764 | SLOT( updateView() ) ); | 780 | SLOT( updateView() ) ); |
765 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 781 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
766 | SLOT( todoModified(Todo *, int) ) ); | 782 | SLOT( todoModified(Todo *, int) ) ); |
767 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 783 | connect( mTodoListView, SIGNAL( expanded( Q3ListViewItem * ) ), |
768 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 784 | SLOT( itemStateChanged( Q3ListViewItem * ) ) ); |
769 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 785 | connect( mTodoListView, SIGNAL( collapsed( Q3ListViewItem * ) ), |
770 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 786 | SLOT( itemStateChanged( Q3ListViewItem * ) ) ); |
771 | connect( mTodoListView, SIGNAL( paintNeeded() ), | 787 | connect( mTodoListView, SIGNAL( paintNeeded() ), |
772 | SLOT( paintNeeded()) ); | 788 | SLOT( paintNeeded()) ); |
773 | 789 | ||
774 | #if 0 | 790 | #if 0 |
775 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 791 | connect(mTodoListView,SIGNAL(selectionChanged(Q3ListViewItem *)), |
776 | SLOT(selectionChanged(QListViewItem *))); | 792 | SLOT(selectionChanged(Q3ListViewItem *))); |
777 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 793 | connect(mTodoListView,SIGNAL(clicked(Q3ListViewItem *)), |
778 | SLOT(selectionChanged(QListViewItem *))); | 794 | SLOT(selectionChanged(Q3ListViewItem *))); |
779 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 795 | connect(mTodoListView,SIGNAL(pressed(Q3ListViewItem *)), |
780 | SLOT(selectionChanged(QListViewItem *))); | 796 | SLOT(selectionChanged(Q3ListViewItem *))); |
781 | #endif | 797 | #endif |
782 | 798 | ||
783 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | 799 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); |
784 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | 800 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); |
785 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | 801 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); |
786 | 802 | ||
@@ -878,13 +894,13 @@ void KOTodoView::updateView() | |||
878 | } | 894 | } |
879 | } | 895 | } |
880 | 896 | ||
881 | mTodoListView->setFont( fo ); | 897 | mTodoListView->setFont( fo ); |
882 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 898 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
883 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 899 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
884 | QPtrList<Todo> todoList = calendar()->todos(); | 900 | Q3PtrList<Todo> todoList = calendar()->todos(); |
885 | 901 | ||
886 | /* | 902 | /* |
887 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 903 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
888 | Event *t; | 904 | Event *t; |
889 | for(t = todoList.first(); t; t = todoList.next()) { | 905 | for(t = todoList.first(); t; t = todoList.next()) { |
890 | kdDebug() << " " << t->getSummary() << endl; | 906 | kdDebug() << " " << t->getSummary() << endl; |
@@ -1041,13 +1057,13 @@ bool KOTodoView::checkTodo( Todo * todo ) | |||
1041 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) | 1057 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) |
1042 | return false; | 1058 | return false; |
1043 | } | 1059 | } |
1044 | return true; | 1060 | return true; |
1045 | } | 1061 | } |
1046 | 1062 | ||
1047 | void KOTodoView::restoreItemState( QListViewItem *item ) | 1063 | void KOTodoView::restoreItemState( Q3ListViewItem *item ) |
1048 | { | 1064 | { |
1049 | pendingSubtodo = 0; | 1065 | pendingSubtodo = 0; |
1050 | while( item ) { | 1066 | while( item ) { |
1051 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1067 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1052 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 1068 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
1053 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 1069 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
@@ -1093,26 +1109,26 @@ KOTodoView::insertTodoItem(Todo *todo) | |||
1093 | void KOTodoView::updateConfig() | 1109 | void KOTodoView::updateConfig() |
1094 | { | 1110 | { |
1095 | updateView(); | 1111 | updateView(); |
1096 | mTodoListView->repaintContents(); | 1112 | mTodoListView->repaintContents(); |
1097 | } | 1113 | } |
1098 | 1114 | ||
1099 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 1115 | Q3PtrList<Incidence> KOTodoView::selectedIncidences() |
1100 | { | 1116 | { |
1101 | QPtrList<Incidence> selected; | 1117 | Q3PtrList<Incidence> selected; |
1102 | 1118 | ||
1103 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 1119 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
1104 | // if (!item) item = mActiveItem; | 1120 | // if (!item) item = mActiveItem; |
1105 | if (item) selected.append(item->todo()); | 1121 | if (item) selected.append(item->todo()); |
1106 | 1122 | ||
1107 | return selected; | 1123 | return selected; |
1108 | } | 1124 | } |
1109 | 1125 | ||
1110 | QPtrList<Todo> KOTodoView::selectedTodos() | 1126 | Q3PtrList<Todo> KOTodoView::selectedTodos() |
1111 | { | 1127 | { |
1112 | QPtrList<Todo> selected; | 1128 | Q3PtrList<Todo> selected; |
1113 | 1129 | ||
1114 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 1130 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
1115 | // if (!item) item = mActiveItem; | 1131 | // if (!item) item = mActiveItem; |
1116 | if (item) selected.append(item->todo()); | 1132 | if (item) selected.append(item->todo()); |
1117 | 1133 | ||
1118 | return selected; | 1134 | return selected; |
@@ -1124,38 +1140,38 @@ void KOTodoView::changeEventDisplay(Event *, int) | |||
1124 | } | 1140 | } |
1125 | 1141 | ||
1126 | void KOTodoView::showDates(const QDate &, const QDate &) | 1142 | void KOTodoView::showDates(const QDate &, const QDate &) |
1127 | { | 1143 | { |
1128 | } | 1144 | } |
1129 | 1145 | ||
1130 | void KOTodoView::showEvents(QPtrList<Event>) | 1146 | void KOTodoView::showEvents(Q3PtrList<Event>) |
1131 | { | 1147 | { |
1132 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; | 1148 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; |
1133 | } | 1149 | } |
1134 | 1150 | ||
1135 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1151 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1136 | const QDate &td) | 1152 | const QDate &td) |
1137 | { | 1153 | { |
1138 | #ifndef KORG_NOPRINTER | 1154 | #ifndef KORG_NOPRINTER |
1139 | calPrinter->preview(CalPrinter::Todolist, fd, td); | 1155 | calPrinter->preview(CalPrinter::Todolist, fd, td); |
1140 | #endif | 1156 | #endif |
1141 | } | 1157 | } |
1142 | 1158 | ||
1143 | void KOTodoView::editItem(QListViewItem *item ) | 1159 | void KOTodoView::editItem(Q3ListViewItem *item ) |
1144 | { | 1160 | { |
1145 | if ( item ) | 1161 | if ( item ) |
1146 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); | 1162 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); |
1147 | } | 1163 | } |
1148 | 1164 | ||
1149 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 1165 | void KOTodoView::showItem(Q3ListViewItem *item,const QPoint &,int) |
1150 | { | 1166 | { |
1151 | if ( item ) | 1167 | if ( item ) |
1152 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); | 1168 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); |
1153 | } | 1169 | } |
1154 | 1170 | ||
1155 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) | 1171 | void KOTodoView::popupMenu(Q3ListViewItem *item,const QPoint &p,int column) |
1156 | { | 1172 | { |
1157 | pendingSubtodo = 0; | 1173 | pendingSubtodo = 0; |
1158 | mActiveItem = (KOTodoViewItem *)item; | 1174 | mActiveItem = (KOTodoViewItem *)item; |
1159 | if (item) { | 1175 | if (item) { |
1160 | switch (column){ | 1176 | switch (column){ |
1161 | case 1: | 1177 | case 1: |
@@ -1358,13 +1374,13 @@ void KOTodoView::toggleRunningItemQuick() | |||
1358 | } else { | 1374 | } else { |
1359 | t->setRunning( true ); | 1375 | t->setRunning( true ); |
1360 | mActiveItem->construct(); | 1376 | mActiveItem->construct(); |
1361 | topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); | 1377 | topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); |
1362 | } | 1378 | } |
1363 | } | 1379 | } |
1364 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 1380 | void KOTodoView::itemDoubleClicked(Q3ListViewItem *item) |
1365 | { | 1381 | { |
1366 | if ( pendingSubtodo != 0 ) { | 1382 | if ( pendingSubtodo != 0 ) { |
1367 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1383 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1368 | } | 1384 | } |
1369 | pendingSubtodo = 0; | 1385 | pendingSubtodo = 0; |
1370 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); | 1386 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); |
@@ -1425,26 +1441,26 @@ void KOTodoView::toggleRunningItem() | |||
1425 | t->setRunning( true ); | 1441 | t->setRunning( true ); |
1426 | updateTodo ( t, KOGlobals::EVENTEDITED ); | 1442 | updateTodo ( t, KOGlobals::EVENTEDITED ); |
1427 | } | 1443 | } |
1428 | } | 1444 | } |
1429 | } | 1445 | } |
1430 | 1446 | ||
1431 | void KOTodoView::itemClicked(QListViewItem *item) | 1447 | void KOTodoView::itemClicked(Q3ListViewItem *item) |
1432 | { | 1448 | { |
1433 | //qDebug("KOTodoView::itemClicked %d", item); | 1449 | //qDebug("KOTodoView::itemClicked %d", item); |
1434 | if (!item) { | 1450 | if (!item) { |
1435 | if ( pendingSubtodo != 0 ) { | 1451 | if ( pendingSubtodo != 0 ) { |
1436 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1452 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1437 | } | 1453 | } |
1438 | pendingSubtodo = 0; | 1454 | pendingSubtodo = 0; |
1439 | return; | 1455 | return; |
1440 | } | 1456 | } |
1441 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1457 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1442 | if ( pendingSubtodo != 0 ) { | 1458 | if ( pendingSubtodo != 0 ) { |
1443 | bool allowReparent = true; | 1459 | bool allowReparent = true; |
1444 | QListViewItem *par = item; | 1460 | Q3ListViewItem *par = item; |
1445 | while ( par ) { | 1461 | while ( par ) { |
1446 | if ( par == pendingSubtodo ) { | 1462 | if ( par == pendingSubtodo ) { |
1447 | allowReparent = false; | 1463 | allowReparent = false; |
1448 | break; | 1464 | break; |
1449 | } | 1465 | } |
1450 | par = par->parent(); | 1466 | par = par->parent(); |
@@ -1466,13 +1482,13 @@ void KOTodoView::itemClicked(QListViewItem *item) | |||
1466 | void KOTodoView::setDocumentId( const QString &id ) | 1482 | void KOTodoView::setDocumentId( const QString &id ) |
1467 | { | 1483 | { |
1468 | 1484 | ||
1469 | mDocPrefs->setDoc( id ); | 1485 | mDocPrefs->setDoc( id ); |
1470 | } | 1486 | } |
1471 | 1487 | ||
1472 | void KOTodoView::itemStateChanged( QListViewItem *item ) | 1488 | void KOTodoView::itemStateChanged( Q3ListViewItem *item ) |
1473 | { | 1489 | { |
1474 | if (!item) return; | 1490 | if (!item) return; |
1475 | 1491 | ||
1476 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1492 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1477 | 1493 | ||
1478 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; | 1494 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; |
@@ -1539,13 +1555,13 @@ void KOTodoView::setAllClose() | |||
1539 | } else { | 1555 | } else { |
1540 | storeCurrentItem(); | 1556 | storeCurrentItem(); |
1541 | } | 1557 | } |
1542 | setOpen(mTodoListView->firstChild(), false); | 1558 | setOpen(mTodoListView->firstChild(), false); |
1543 | resetCurrentItem(); | 1559 | resetCurrentItem(); |
1544 | } | 1560 | } |
1545 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) | 1561 | void KOTodoView::setOpen( Q3ListViewItem* item, bool setOpenI) |
1546 | { | 1562 | { |
1547 | 1563 | ||
1548 | while ( item ) { | 1564 | while ( item ) { |
1549 | setOpen( item->firstChild(), setOpenI ); | 1565 | setOpen( item->firstChild(), setOpenI ); |
1550 | item->setOpen( setOpenI ); | 1566 | item->setOpen( setOpenI ); |
1551 | item = item->nextSibling(); | 1567 | item = item->nextSibling(); |
@@ -1560,13 +1576,13 @@ void KOTodoView::displayAllFlat() | |||
1560 | if ( mBlockUpdate ) { | 1576 | if ( mBlockUpdate ) { |
1561 | return; | 1577 | return; |
1562 | } | 1578 | } |
1563 | clearList (); | 1579 | clearList (); |
1564 | mPopupMenu->setItemChecked( 8,true ); | 1580 | mPopupMenu->setItemChecked( 8,true ); |
1565 | isFlatDisplay = true; | 1581 | isFlatDisplay = true; |
1566 | QPtrList<Todo> todoList = calendar()->todos(); | 1582 | Q3PtrList<Todo> todoList = calendar()->todos(); |
1567 | Todo *todo; | 1583 | Todo *todo; |
1568 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 1584 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
1569 | if ( checkTodo( todo ) ) { | 1585 | if ( checkTodo( todo ) ) { |
1570 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1586 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1571 | mTodoMap.insert(todo,todoItem); | 1587 | mTodoMap.insert(todo,todoItem); |
1572 | } | 1588 | } |