author | zautrix <zautrix> | 2005-04-09 20:21:58 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-09 20:21:58 (UTC) |
commit | 9e43ebbe5867b2da957bb17c35bd357715424cba (patch) (side-by-side diff) | |
tree | b506ba029b50fc46a33d35a39e6f1c768c995f22 /korganizer | |
parent | 2c39ac46121e8796e780a5321ab777f08792e5ba (diff) | |
download | kdepimpi-9e43ebbe5867b2da957bb17c35bd357715424cba.zip kdepimpi-9e43ebbe5867b2da957bb17c35bd357715424cba.tar.gz kdepimpi-9e43ebbe5867b2da957bb17c35bd357715424cba.tar.bz2 |
todo tt
-rw-r--r-- | korganizer/koprefs.cpp | 7 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 12 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 30 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 1 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 38 |
6 files changed, 73 insertions, 16 deletions
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() : 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); @@ -219,2 +215,3 @@ KOPrefs::KOPrefs() : addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); + addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor); 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 QColor mTodoOverdueColor; + QColor mTodoRunColor; 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 = 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 @@ -902,3 +912,3 @@ dummy = &(KOPrefs::instance()->mTodoDueTodayColor),wid); - QHBoxLayout *widLayout = new QHBoxLayout(wid); + widLayout = new QHBoxLayout(wid); 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) : + mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, + SLOT (toggleRunningItem())); mItemPopupMenu->insertItem( i18n("New Todo..."), this, @@ -1101,3 +1103,3 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) } else { - if ( row == 1 || row == 2 ) { + if ( row == 2 ) { mActiveItem = (KOTodoViewItem *) item; @@ -1106,2 +1108,7 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) } + if ( row == 1 ) { + mActiveItem = (KOTodoViewItem *) item; + toggleRunningItem(); + return; + } } @@ -1112,2 +1119,23 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) } +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) 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 protected slots: + void toggleRunningItem(); 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 @@ #include <qapp.h> +#include <kglobal.h> @@ -122,4 +123,17 @@ void KOTodoViewItem::construct() + 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 { + if (mTodo->hasStartDate()) { - setText(5, mTodo->dtStartDateStr()); + keyd = mTodo->dtStartDateStr(); QDate d = mTodo->dtStart().date(); @@ -127,7 +141,4 @@ void KOTodoViewItem::construct() - if (mTodo->doesFloat()) { - setText(6,""); - } - else { - setText(6,mTodo->dtStartTimeStr()); + if ( !mTodo->doesFloat()) { + keyt = mTodo->dtStartTimeStr(); QTime t = mTodo->dtStart().time(); @@ -136,6 +147,7 @@ void KOTodoViewItem::construct() } - } else { - setText(5,""); - setText(6,""); + } + } + setText(5,keyd); + setText(6,keyt); setSortKey(5,skeyd); @@ -370,2 +382,9 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i openMode = false; + bool colorRunning = mTodo->isRunning(); + if ( ! colorRunning && openMode ) + colorRunning = mTodo->hasRunningSub(); + if ( colorRunning ) { + setColor = true; + colorToSet = KOPrefs::instance()->mTodoRunColor; + } else { int odue = mTodo->hasDueSubTodo( openMode ); @@ -378,2 +397,3 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i } + } |