summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt12
-rw-r--r--korganizer/koprefs.cpp7
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/koprefsdialog.cpp12
-rw-r--r--korganizer/kotodoview.cpp30
-rw-r--r--korganizer/kotodoview.h1
-rw-r--r--korganizer/kotodoviewitem.cpp38
-rw-r--r--libkcal/todo.cpp44
-rw-r--r--libkcal/todo.h16
9 files changed, 143 insertions, 18 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index b4e26c2..5257bff 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1337,2 +1337,14 @@
1337{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" }, 1337{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" },
1338{ "Start/Stop todo...","Starte/Stoppe Todo..." },
1339{ "Color for running todos:","Farbe für laufende Todos:" },
1340{ "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" },
1341{ "Todo is started","Todo is gestarted" },
1342{ "Stop todo","Stoppe Todo" },
1343{ "Todo is stopped","Todo ist gestoppt" },
1344{ "Start todo","Starte Todo" },
1345{ "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" },
1346{ "","" },
1347{ "","" },
1348{ "","" },
1349{ "","" },
1338{ "","" }, 1350{ "","" },
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 5879a2d..e8c7c76 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -64,9 +64,5 @@ KOPrefs::KOPrefs() :
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);
@@ -219,2 +215,3 @@ KOPrefs::KOPrefs() :
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 ));
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index cf8dae6..d511faa 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -141,2 +141,3 @@ class KOPrefs : public KPimPrefs
141 QColor mTodoOverdueColor; 141 QColor mTodoOverdueColor;
142 QColor mTodoRunColor;
142 QColor mMonthViewEvenColor; 143 QColor mMonthViewEvenColor;
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index 0bbb3bf..a8943de 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -898,2 +898,12 @@ dummy =
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
@@ -902,3 +912,3 @@ dummy =
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() );
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 935a5f5..7ee1eef 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -483,2 +483,4 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
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,
@@ -1101,3 +1103,3 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item)
1101 } else { 1103 } else {
1102 if ( row == 1 || row == 2 ) { 1104 if ( row == 2 ) {
1103 mActiveItem = (KOTodoViewItem *) item; 1105 mActiveItem = (KOTodoViewItem *) item;
@@ -1106,2 +1108,7 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item)
1106 } 1108 }
1109 if ( row == 1 ) {
1110 mActiveItem = (KOTodoViewItem *) item;
1111 toggleRunningItem();
1112 return;
1113 }
1107 } 1114 }
@@ -1112,2 +1119,23 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item)
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)
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index d0788a9..d368513 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -208,2 +208,3 @@ class KOTodoView : public KOrg::BaseView
208 protected slots: 208 protected slots:
209 void toggleRunningItem();
209 void paintNeeded(); 210 void paintNeeded();
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 6559119..66f8d06 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -22,2 +22,3 @@
22#include <qapp.h> 22#include <qapp.h>
23#include <kglobal.h>
23 24
@@ -122,4 +123,17 @@ void KOTodoViewItem::construct()
122 123
124 keyd = "";
125 keyt = "";
126
127 if (mTodo->isRunning() ) {
128 QDate d = mTodo->runStart().date();
129 QTime t = mTodo->runStart().time();
130 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
131 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
132 keyd = KGlobal::locale()->formatDate( d );
133 keyt = KGlobal::locale()->formatTime( t );
134
135 } else {
136
123 if (mTodo->hasStartDate()) { 137 if (mTodo->hasStartDate()) {
124 setText(5, mTodo->dtStartDateStr()); 138 keyd = mTodo->dtStartDateStr();
125 QDate d = mTodo->dtStart().date(); 139 QDate d = mTodo->dtStart().date();
@@ -127,7 +141,4 @@ void KOTodoViewItem::construct()
127 141
128 if (mTodo->doesFloat()) { 142 if ( !mTodo->doesFloat()) {
129 setText(6,""); 143 keyt = mTodo->dtStartTimeStr();
130 }
131 else {
132 setText(6,mTodo->dtStartTimeStr());
133 QTime t = mTodo->dtStart().time(); 144 QTime t = mTodo->dtStart().time();
@@ -136,6 +147,7 @@ void KOTodoViewItem::construct()
136 } 147 }
137 } else { 148
138 setText(5,"");
139 setText(6,"");
140 } 149 }
150 }
151 setText(5,keyd);
152 setText(6,keyt);
141 setSortKey(5,skeyd); 153 setSortKey(5,skeyd);
@@ -370,2 +382,9 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i
370 openMode = false; 382 openMode = false;
383 bool colorRunning = mTodo->isRunning();
384 if ( ! colorRunning && openMode )
385 colorRunning = mTodo->hasRunningSub();
386 if ( colorRunning ) {
387 setColor = true;
388 colorToSet = KOPrefs::instance()->mTodoRunColor;
389 } else {
371 int odue = mTodo->hasDueSubTodo( openMode ); 390 int odue = mTodo->hasDueSubTodo( openMode );
@@ -378,2 +397,3 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i
378 } 397 }
398 }
379 399
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index a496404..7dee4cd 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -37,2 +37,4 @@ Todo::Todo(): Incidence()
37 mPercentComplete = 0; 37 mPercentComplete = 0;
38 mRunning = false;
39 mRunSaveTimer = 0;
38} 40}
@@ -46,2 +48,4 @@ Todo::Todo(const Todo &t) : Incidence(t)
46 mPercentComplete = t.mPercentComplete; 48 mPercentComplete = t.mPercentComplete;
49 mRunning = false;
50 mRunSaveTimer = 0;
47} 51}
@@ -50,5 +54,45 @@ Todo::~Todo()
50{ 54{
55 setRunning( false );
56}
57
58void Todo::setRunning( bool run )
59{
60 if ( run == mRunning )
61 return;
62 if ( !mRunSaveTimer ) {
63 mRunSaveTimer = new QTimer ( this );
64 connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) );
65 }
66 mRunning = run;
67 if ( mRunning ) {
68 mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min
69 mRunStart = QDateTime::currentDateTime();
70 } else {
71 mRunSaveTimer->stop();
72 saveRunningInfoToFile();
73 }
74}
51 75
76void Todo::saveRunningInfoToFile()
77{
78 qDebug("Todo::saveRunningInfoToFile() ");
52} 79}
53 80
81int Todo::runTime()
82{
83 if ( !mRunning )
84 return 0;
85 return mRunStart.secsTo( QDateTime::currentDateTime() );
86}
87bool Todo::hasRunningSub()
88{
89 if ( mRunning )
90 return true;
91 Incidence *aTodo;
92 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) {
93 if ( ((Todo*)aTodo)->hasRunningSub() )
94 return true;
95 }
96 return false;
97}
54Incidence *Todo::clone() 98Incidence *Todo::clone()
diff --git a/libkcal/todo.h b/libkcal/todo.h
index a22d4b7..fe43357 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -27,2 +27,4 @@
27 27
28#include <qtimer.h>
29
28namespace KCal { 30namespace KCal {
@@ -32,4 +34,5 @@ namespace KCal {
32*/ 34*/
33class Todo : public Incidence 35 class Todo : public QObject,public Incidence
34{ 36{
37 Q_OBJECT
35 public: 38 public:
@@ -116,4 +119,13 @@ class Todo : public Incidence
116 bool setRecurDates(); 119 bool setRecurDates();
117 120 bool isRunning() {return mRunning;}
121 bool hasRunningSub();
122 void setRunning( bool );
123 int runTime();
124 QDateTime runStart () const { return mRunStart;}
125 public slots:
126 void saveRunningInfoToFile();
118 private: 127 private:
128 bool mRunning;
129 QTimer * mRunSaveTimer;
130 QDateTime mRunStart;
119 bool accept(Visitor &v) { return v.visit(this); } 131 bool accept(Visitor &v) { return v.visit(this); }