summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-09 20:21:58 (UTC)
committer zautrix <zautrix>2005-04-09 20:21:58 (UTC)
commit9e43ebbe5867b2da957bb17c35bd357715424cba (patch) (unidiff)
treeb506ba029b50fc46a33d35a39e6f1c768c995f22 /korganizer
parent2c39ac46121e8796e780a5321ab777f08792e5ba (diff)
downloadkdepimpi-9e43ebbe5867b2da957bb17c35bd357715424cba.zip
kdepimpi-9e43ebbe5867b2da957bb17c35bd357715424cba.tar.gz
kdepimpi-9e43ebbe5867b2da957bb17c35bd357715424cba.tar.bz2
todo tt
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koprefs.cpp7
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/koprefsdialog.cpp14
-rw-r--r--korganizer/kotodoview.cpp30
-rw-r--r--korganizer/kotodoview.h1
-rw-r--r--korganizer/kotodoviewitem.cpp62
6 files changed, 86 insertions, 29 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 5879a2d..e8c7c76 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -62,13 +62,9 @@ KOPrefs::KOPrefs() :
62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
63 QColor defaultTodoDueTodayColor = QColor(255,220,100); 63 QColor defaultTodoDueTodayColor = QColor(255,220,100);
64 QColor defaultTodoOverdueColor = QColor(255,153,125); 64 QColor defaultTodoOverdueColor = QColor(255,153,125);
65 65 QColor defaultTodoRunColor = QColor(99,194,30);
66
67 KPrefs::setCurrentGroup("General"); 66 KPrefs::setCurrentGroup("General");
68
69
70 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 67 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
71
72 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 68 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
73 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 69 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
74 addItemBool("ShowIconSearch",&mShowIconSearch,true); 70 addItemBool("ShowIconSearch",&mShowIconSearch,true);
@@ -217,6 +213,7 @@ KOPrefs::KOPrefs() :
217 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 213 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
218 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 214 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
219 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 215 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
216 addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor);
220 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 217 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
221 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 218 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
222 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 219 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index cf8dae6..d511faa 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -139,6 +139,7 @@ class KOPrefs : public KPimPrefs
139 QColor mWorkingHoursColor; 139 QColor mWorkingHoursColor;
140 QColor mTodoDueTodayColor; 140 QColor mTodoDueTodayColor;
141 QColor mTodoOverdueColor; 141 QColor mTodoOverdueColor;
142 QColor mTodoRunColor;
142 QColor mMonthViewEvenColor; 143 QColor mMonthViewEvenColor;
143 QColor mMonthViewOddColor; 144 QColor mMonthViewOddColor;
144 QColor mMonthViewHolidayColor; 145 QColor mMonthViewHolidayColor;
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index 0bbb3bf..a8943de 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -895,12 +895,22 @@ dummy =
895 topLayout->addWidget(dummy->checkBox(),ii++,0); 895 topLayout->addWidget(dummy->checkBox(),ii++,0);
896 896
897 897
898 QWidget* wid = new QWidget( topFrame ); 898 QWidget* wid = new QWidget( topFrame );
899 // Todo run today color
900 KPrefsDialogWidColor *todoRunColor =
901 addWidColor(i18n("Color for running todos:"),
902 &(KOPrefs::instance()->mTodoRunColor),wid);
903 QHBoxLayout *widLayout = new QHBoxLayout(wid);
904 widLayout->addWidget( todoRunColor->label() );
905 widLayout->addWidget( todoRunColor->button() );
906 topLayout->addWidget(wid,ii++,0);
907
908 wid = new QWidget( topFrame );
899 // Todo due today color 909 // Todo due today color
900 KPrefsDialogWidColor *todoDueTodayColor = 910 KPrefsDialogWidColor *todoDueTodayColor =
901 addWidColor(i18n("Todo due today color:"), 911 addWidColor(i18n("Todo due today color:"),
902 &(KOPrefs::instance()->mTodoDueTodayColor),wid); 912 &(KOPrefs::instance()->mTodoDueTodayColor),wid);
903 QHBoxLayout *widLayout = new QHBoxLayout(wid); 913 widLayout = new QHBoxLayout(wid);
904 widLayout->addWidget( todoDueTodayColor->label() ); 914 widLayout->addWidget( todoDueTodayColor->label() );
905 widLayout->addWidget( todoDueTodayColor->button() ); 915 widLayout->addWidget( todoDueTodayColor->button() );
906 topLayout->addWidget(wid,ii++,0); 916 topLayout->addWidget(wid,ii++,0);
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 935a5f5..7ee1eef 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -481,6 +481,8 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
481 SLOT (cancelTodo())); 481 SLOT (cancelTodo()));
482 mItemPopupMenu->insertSeparator(); 482 mItemPopupMenu->insertSeparator();
483 483
484 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
485 SLOT (toggleRunningItem()));
484 mItemPopupMenu->insertItem( i18n("New Todo..."), this, 486 mItemPopupMenu->insertItem( i18n("New Todo..."), this,
485 SLOT (newTodo())); 487 SLOT (newTodo()));
486 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, 488 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
@@ -1099,17 +1101,43 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item)
1099 newTodo(); 1101 newTodo();
1100 return; 1102 return;
1101 } else { 1103 } else {
1102 if ( row == 1 || row == 2 ) { 1104 if ( row == 2 ) {
1103 mActiveItem = (KOTodoViewItem *) item; 1105 mActiveItem = (KOTodoViewItem *) item;
1104 newSubTodo(); 1106 newSubTodo();
1105 return; 1107 return;
1106 } 1108 }
1109 if ( row == 1 ) {
1110 mActiveItem = (KOTodoViewItem *) item;
1111 toggleRunningItem();
1112 return;
1113 }
1107 } 1114 }
1108 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1115 if ( KOPrefs::instance()->mEditOnDoubleClick )
1109 editItem( item ); 1116 editItem( item );
1110 else 1117 else
1111 showItem( item , QPoint(), 0 ); 1118 showItem( item , QPoint(), 0 );
1112} 1119}
1120void KOTodoView::toggleRunningItem()
1121{
1122 qDebug("KOTodoView::toggleRunning() ");
1123 if ( ! mActiveItem )
1124 return;
1125 Todo * t = mActiveItem->todo();
1126 if ( t->isRunning() ) {
1127 int result = KMessageBox::warningContinueCancel(this,
1128 i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 20 ) ),i18n("Todo is started"),i18n("Stop todo"),i18n("Cancel"), true);
1129 if (result != KMessageBox::Continue) return;
1130 t->setRunning( false );
1131 mActiveItem->construct();
1132 } else {
1133 int result = KMessageBox::warningContinueCancel(this,
1134 i18n("The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?").arg(mActiveItem->text(0).left( 20 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true);
1135 if (result != KMessageBox::Continue) return;
1136 t->setRunning( true );
1137 mActiveItem->construct();
1138 }
1139}
1140
1113void KOTodoView::itemClicked(QListViewItem *item) 1141void KOTodoView::itemClicked(QListViewItem *item)
1114{ 1142{
1115 //qDebug("KOTodoView::itemClicked %d", item); 1143 //qDebug("KOTodoView::itemClicked %d", item);
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index d0788a9..d368513 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -206,6 +206,7 @@ class KOTodoView : public KOrg::BaseView
206 void purgeCompletedSignal(); 206 void purgeCompletedSignal();
207 207
208 protected slots: 208 protected slots:
209 void toggleRunningItem();
209 void paintNeeded(); 210 void paintNeeded();
210 void processSelectionChange(); 211 void processSelectionChange();
211 void addQuickTodo(); 212 void addQuickTodo();
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 6559119..66f8d06 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -20,6 +20,7 @@
20#include <klocale.h> 20#include <klocale.h>
21#include <kdebug.h> 21#include <kdebug.h>
22#include <qapp.h> 22#include <qapp.h>
23#include <kglobal.h>
23 24
24#include <kiconloader.h> 25#include <kiconloader.h>
25#include "kotodoviewitem.h" 26#include "kotodoviewitem.h"
@@ -120,24 +121,35 @@ void KOTodoViewItem::construct()
120 121
121 122
122 123
123 if (mTodo->hasStartDate()) { 124 keyd = "";
124 setText(5, mTodo->dtStartDateStr()); 125 keyt = "";
125 QDate d = mTodo->dtStart().date(); 126
126 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 127 if (mTodo->isRunning() ) {
127 128 QDate d = mTodo->runStart().date();
128 if (mTodo->doesFloat()) { 129 QTime t = mTodo->runStart().time();
129 setText(6,"");
130 }
131 else {
132 setText(6,mTodo->dtStartTimeStr());
133 QTime t = mTodo->dtStart().time();
134 skeyt.sprintf("%02d%02d",t.hour(),t.minute()); 130 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
135 131 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
136 } 132 keyd = KGlobal::locale()->formatDate( d );
133 keyt = KGlobal::locale()->formatTime( t );
134
137 } else { 135 } else {
138 setText(5,""); 136
139 setText(6,""); 137 if (mTodo->hasStartDate()) {
138 keyd = mTodo->dtStartDateStr();
139 QDate d = mTodo->dtStart().date();
140 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
141
142 if ( !mTodo->doesFloat()) {
143 keyt = mTodo->dtStartTimeStr();
144 QTime t = mTodo->dtStart().time();
145 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
146
147 }
148
149 }
140 } 150 }
151 setText(5,keyd);
152 setText(6,keyt);
141 setSortKey(5,skeyd); 153 setSortKey(5,skeyd);
142 setSortKey(6,skeyt); 154 setSortKey(6,skeyt);
143 155
@@ -368,13 +380,21 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i
368 // maybe we are in flat-display-mode 380 // maybe we are in flat-display-mode
369 if ( !firstChild() ) 381 if ( !firstChild() )
370 openMode = false; 382 openMode = false;
371 int odue = mTodo->hasDueSubTodo( openMode ); 383 bool colorRunning = mTodo->isRunning();
372 if (odue == 2) { 384 if ( ! colorRunning && openMode )
373 colorToSet = KOPrefs::instance()->mTodoOverdueColor; 385 colorRunning = mTodo->hasRunningSub();
374 setColor = true; 386 if ( colorRunning ) {
375 } else if ( odue == 1 ) {
376 colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
377 setColor = true; 387 setColor = true;
388 colorToSet = KOPrefs::instance()->mTodoRunColor;
389 } else {
390 int odue = mTodo->hasDueSubTodo( openMode );
391 if (odue == 2) {
392 colorToSet = KOPrefs::instance()->mTodoOverdueColor;
393 setColor = true;
394 } else if ( odue == 1 ) {
395 colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
396 setColor = true;
397 }
378 } 398 }
379 399
380 400