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) (side-by-side diff)
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() :
QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
QColor defaultTodoDueTodayColor = QColor(255,220,100);
QColor defaultTodoOverdueColor = QColor(255,153,125);
-
-
+ QColor defaultTodoRunColor = QColor(99,194,30);
KPrefs::setCurrentGroup("General");
-
-
addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
-
addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
addItemBool("ShowIconSearch",&mShowIconSearch,true);
@@ -217,6 +213,7 @@ KOPrefs::KOPrefs() :
addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
+ addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor);
addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
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
QColor mWorkingHoursColor;
QColor mTodoDueTodayColor;
QColor mTodoOverdueColor;
+ QColor mTodoRunColor;
QColor mMonthViewEvenColor;
QColor mMonthViewOddColor;
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 =
topLayout->addWidget(dummy->checkBox(),ii++,0);
- QWidget* wid = new QWidget( topFrame );
+ QWidget* wid = new QWidget( topFrame );
+ // Todo run today color
+ KPrefsDialogWidColor *todoRunColor =
+ addWidColor(i18n("Color for running todos:"),
+ &(KOPrefs::instance()->mTodoRunColor),wid);
+ QHBoxLayout *widLayout = new QHBoxLayout(wid);
+ widLayout->addWidget( todoRunColor->label() );
+ widLayout->addWidget( todoRunColor->button() );
+ topLayout->addWidget(wid,ii++,0);
+
+ wid = new QWidget( topFrame );
// Todo due today color
KPrefsDialogWidColor *todoDueTodayColor =
addWidColor(i18n("Todo due today color:"),
&(KOPrefs::instance()->mTodoDueTodayColor),wid);
- QHBoxLayout *widLayout = new QHBoxLayout(wid);
+ widLayout = new QHBoxLayout(wid);
widLayout->addWidget( todoDueTodayColor->label() );
widLayout->addWidget( todoDueTodayColor->button() );
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) :
SLOT (cancelTodo()));
mItemPopupMenu->insertSeparator();
+ mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
+ SLOT (toggleRunningItem()));
mItemPopupMenu->insertItem( i18n("New Todo..."), this,
SLOT (newTodo()));
mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
@@ -1099,17 +1101,43 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item)
newTodo();
return;
} else {
- if ( row == 1 || row == 2 ) {
+ if ( row == 2 ) {
mActiveItem = (KOTodoViewItem *) item;
newSubTodo();
return;
}
+ if ( row == 1 ) {
+ mActiveItem = (KOTodoViewItem *) item;
+ toggleRunningItem();
+ return;
+ }
}
if ( KOPrefs::instance()->mEditOnDoubleClick )
editItem( item );
else
showItem( item , QPoint(), 0 );
}
+void KOTodoView::toggleRunningItem()
+{
+ qDebug("KOTodoView::toggleRunning() ");
+ if ( ! mActiveItem )
+ return;
+ Todo * t = mActiveItem->todo();
+ if ( t->isRunning() ) {
+ int result = KMessageBox::warningContinueCancel(this,
+ 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);
+ if (result != KMessageBox::Continue) return;
+ t->setRunning( false );
+ mActiveItem->construct();
+ } else {
+ int result = KMessageBox::warningContinueCancel(this,
+ 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);
+ if (result != KMessageBox::Continue) return;
+ t->setRunning( true );
+ mActiveItem->construct();
+ }
+}
+
void KOTodoView::itemClicked(QListViewItem *item)
{
//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
void purgeCompletedSignal();
protected slots:
+ void toggleRunningItem();
void paintNeeded();
void processSelectionChange();
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 @@
#include <klocale.h>
#include <kdebug.h>
#include <qapp.h>
+#include <kglobal.h>
#include <kiconloader.h>
#include "kotodoviewitem.h"
@@ -120,24 +121,35 @@ void KOTodoViewItem::construct()
- if (mTodo->hasStartDate()) {
- setText(5, mTodo->dtStartDateStr());
- QDate d = mTodo->dtStart().date();
- skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
-
- if (mTodo->doesFloat()) {
- setText(6,"");
- }
- else {
- setText(6,mTodo->dtStartTimeStr());
- QTime t = mTodo->dtStart().time();
+ keyd = "";
+ keyt = "";
+
+ if (mTodo->isRunning() ) {
+ QDate d = mTodo->runStart().date();
+ QTime t = mTodo->runStart().time();
skeyt.sprintf("%02d%02d",t.hour(),t.minute());
-
- }
+ skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
+ keyd = KGlobal::locale()->formatDate( d );
+ keyt = KGlobal::locale()->formatTime( t );
+
} else {
- setText(5,"");
- setText(6,"");
+
+ if (mTodo->hasStartDate()) {
+ keyd = mTodo->dtStartDateStr();
+ QDate d = mTodo->dtStart().date();
+ skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
+
+ if ( !mTodo->doesFloat()) {
+ keyt = mTodo->dtStartTimeStr();
+ QTime t = mTodo->dtStart().time();
+ skeyt.sprintf("%02d%02d",t.hour(),t.minute());
+
+ }
+
+ }
}
+ setText(5,keyd);
+ setText(6,keyt);
setSortKey(5,skeyd);
setSortKey(6,skeyt);
@@ -368,13 +380,21 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i
// maybe we are in flat-display-mode
if ( !firstChild() )
openMode = false;
- int odue = mTodo->hasDueSubTodo( openMode );
- if (odue == 2) {
- colorToSet = KOPrefs::instance()->mTodoOverdueColor;
- setColor = true;
- } else if ( odue == 1 ) {
- colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
+ bool colorRunning = mTodo->isRunning();
+ if ( ! colorRunning && openMode )
+ colorRunning = mTodo->hasRunningSub();
+ if ( colorRunning ) {
setColor = true;
+ colorToSet = KOPrefs::instance()->mTodoRunColor;
+ } else {
+ int odue = mTodo->hasDueSubTodo( openMode );
+ if (odue == 2) {
+ colorToSet = KOPrefs::instance()->mTodoOverdueColor;
+ setColor = true;
+ } else if ( odue == 1 ) {
+ colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
+ setColor = true;
+ }
}