-rw-r--r-- | korganizer/kotodoview.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index da8b4bc..c5b9a21 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -15,53 +15,71 @@ | |||
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 | 28 | ||
28 | #include <qvbox.h> | 29 | #include <qvbox.h> |
29 | #include <kdebug.h> | 30 | #include <kdebug.h> |
30 | #include "koprefs.h" | 31 | #include "koprefs.h" |
31 | #include <klocale.h> | 32 | #include <klocale.h> |
32 | #include <kglobal.h> | 33 | #include <kglobal.h> |
33 | #include <kiconloader.h> | 34 | #include <kiconloader.h> |
34 | #include <kmessagebox.h> | 35 | #include <kmessagebox.h> |
35 | 36 | ||
36 | #include <libkcal/icaldrag.h> | 37 | #include <libkcal/icaldrag.h> |
37 | #include <libkcal/vcaldrag.h> | 38 | #include <libkcal/vcaldrag.h> |
38 | #include <libkcal/calfilter.h> | 39 | #include <libkcal/calfilter.h> |
39 | #include <libkcal/dndfactory.h> | 40 | #include <libkcal/dndfactory.h> |
40 | #include <libkcal/calendarresources.h> | 41 | #include <libkcal/calendarresources.h> |
41 | #include <libkcal/resourcecalendar.h> | 42 | #include <libkcal/resourcecalendar.h> |
42 | #include <kresources/resourceselectdialog.h> | 43 | #include <kresources/resourceselectdialog.h> |
44 | #include <libkcal/kincidenceformatter.h> | ||
43 | #ifndef DESKTOP_VERSION | 45 | #ifndef DESKTOP_VERSION |
44 | #include <qpe/qpeapplication.h> | 46 | #include <qpe/qpeapplication.h> |
45 | #else | 47 | #else |
46 | #include <qapplication.h> | 48 | #include <qapplication.h> |
47 | #endif | 49 | #endif |
48 | #ifndef KORG_NOPRINTER | 50 | #ifndef KORG_NOPRINTER |
49 | #include "calprinter.h" | 51 | #include "calprinter.h" |
50 | #endif | 52 | #endif |
51 | #include "docprefs.h" | 53 | #include "docprefs.h" |
52 | 54 | ||
53 | #include "kotodoview.h" | 55 | #include "kotodoview.h" |
54 | using namespace KOrg; | 56 | using namespace KOrg; |
55 | 57 | ||
58 | |||
59 | class KOTodoViewWhatsThis :public QWhatsThis | ||
60 | { | ||
61 | public: | ||
62 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | ||
63 | |||
64 | protected: | ||
65 | virtual QString text( const QPoint& p) | ||
66 | { | ||
67 | return _view->getWhatsThisText(p) ; | ||
68 | } | ||
69 | private: | ||
70 | QWidget* _wid; | ||
71 | KOTodoView * _view; | ||
72 | }; | ||
73 | |||
56 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, | 74 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, |
57 | const char *name) : | 75 | const char *name) : |
58 | KListView(parent,name) | 76 | KListView(parent,name) |
59 | { | 77 | { |
60 | mName = QString ( name ); | 78 | mName = QString ( name ); |
61 | mCalendar = calendar; | 79 | mCalendar = calendar; |
62 | #ifndef DESKTOP_VERSION | 80 | #ifndef DESKTOP_VERSION |
63 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 81 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
64 | #endif | 82 | #endif |
65 | mOldCurrent = 0; | 83 | mOldCurrent = 0; |
66 | mMousePressed = false; | 84 | mMousePressed = false; |
67 | 85 | ||
@@ -386,24 +404,26 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
386 | mTodoListView->setColumnWidth( 0, 120 ); | 404 | mTodoListView->setColumnWidth( 0, 120 ); |
387 | mTodoListView->setColumnWidthMode(0, QListView::Manual); | 405 | mTodoListView->setColumnWidthMode(0, QListView::Manual); |
388 | mTodoListView->setColumnWidthMode(1, QListView::Manual); | 406 | mTodoListView->setColumnWidthMode(1, QListView::Manual); |
389 | mTodoListView->setColumnWidthMode(2, QListView::Manual); | 407 | mTodoListView->setColumnWidthMode(2, QListView::Manual); |
390 | mTodoListView->setColumnWidthMode(3, QListView::Manual); | 408 | mTodoListView->setColumnWidthMode(3, QListView::Manual); |
391 | mTodoListView->setColumnWidthMode(4, QListView::Manual); | 409 | mTodoListView->setColumnWidthMode(4, QListView::Manual); |
392 | mTodoListView->setColumnWidthMode(5, QListView::Manual); | 410 | mTodoListView->setColumnWidthMode(5, QListView::Manual); |
393 | mTodoListView->setColumnWidthMode(6, QListView::Manual); | 411 | mTodoListView->setColumnWidthMode(6, QListView::Manual); |
394 | mTodoListView->setColumnWidthMode(7, QListView::Manual); | 412 | mTodoListView->setColumnWidthMode(7, QListView::Manual); |
395 | mTodoListView->setColumnWidthMode(8, QListView::Manual); | 413 | mTodoListView->setColumnWidthMode(8, QListView::Manual); |
396 | 414 | ||
397 | 415 | ||
416 | new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | ||
417 | |||
398 | mPriorityPopupMenu = new QPopupMenu(this); | 418 | mPriorityPopupMenu = new QPopupMenu(this); |
399 | for (int i = 1; i <= 5; i++) { | 419 | for (int i = 1; i <= 5; i++) { |
400 | QString label = QString ("%1").arg (i); | 420 | QString label = QString ("%1").arg (i); |
401 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 421 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
402 | } | 422 | } |
403 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 423 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
404 | 424 | ||
405 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 425 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
406 | for (int i = 0; i <= 100; i+=20) { | 426 | for (int i = 0; i <= 100; i+=20) { |
407 | QString label = QString ("%1 %").arg (i); | 427 | QString label = QString ("%1 %").arg (i); |
408 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 428 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
409 | } | 429 | } |
@@ -523,24 +543,32 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
523 | 543 | ||
524 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 544 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
525 | SLOT( processSelectionChange() ) ); | 545 | SLOT( processSelectionChange() ) ); |
526 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 546 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
527 | SLOT( addQuickTodo() ) ); | 547 | SLOT( addQuickTodo() ) ); |
528 | 548 | ||
529 | } | 549 | } |
530 | 550 | ||
531 | KOTodoView::~KOTodoView() | 551 | KOTodoView::~KOTodoView() |
532 | { | 552 | { |
533 | delete mDocPrefs; | 553 | delete mDocPrefs; |
534 | } | 554 | } |
555 | QString KOTodoView::getWhatsThisText(QPoint p) | ||
556 | { | ||
557 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); | ||
558 | if ( item ) | ||
559 | return KIncidenceFormatter::instance()->getFormattedText( item->todo() ); | ||
560 | return i18n("That is the todo view" ); | ||
561 | |||
562 | } | ||
535 | 563 | ||
536 | void KOTodoView::jumpToDate () | 564 | void KOTodoView::jumpToDate () |
537 | { | 565 | { |
538 | // if (mActiveItem) { | 566 | // if (mActiveItem) { |
539 | // mActiveItem->todo()); | 567 | // mActiveItem->todo()); |
540 | // if ( mActiveItem->todo()->hasDueDate() ) | 568 | // if ( mActiveItem->todo()->hasDueDate() ) |
541 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 569 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
542 | } | 570 | } |
543 | void KOTodoView::paintNeeded() | 571 | void KOTodoView::paintNeeded() |
544 | { | 572 | { |
545 | if ( mPendingUpdateBeforeRepaint ) { | 573 | if ( mPendingUpdateBeforeRepaint ) { |
546 | updateView(); | 574 | updateView(); |