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
@@ -53,31 +53,27 @@ static KStaticDeleter<KOPrefs> insd;
KOPrefs::KOPrefs() :
KPimPrefs("korganizerrc")
{
mCategoryColors.setAutoDelete(true);
fillMailDefaults();
mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
QColor defaultHolidayColor = QColor(255,0,0);
QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
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);
addItemBool("ShowIconList",&mShowIconList,true);
addItemBool("ShowIconDay1",&mShowIconDay1,true);
addItemBool("ShowIconDay5",&mShowIconDay5,true);
addItemBool("ShowIconDay6",&mShowIconDay6,true);
addItemBool("ShowIconDay7",&mShowIconDay7,true);
addItemBool("ShowIconMonth",&mShowIconMonth,true);
addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
addItemBool("ShowIconBack",&mShowIconBack,true);
@@ -208,24 +204,25 @@ KOPrefs::KOPrefs() :
addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
KPrefs::setCurrentGroup("Colors");
addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) );
addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
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 ));
addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
addItemBool("MonthViewWeek",&mMonthViewWeek,false);
addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
addItemBool("UseAppColors",&mUseAppColors,false);
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index cf8dae6..d511faa 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -130,24 +130,25 @@ class KOPrefs : public KPimPrefs
QColor mHolidayColor;
QColor mHighlightColor;
QColor mEventColor;
QColor mTodoDoneColor;
QColor mAgendaBgColor;
QColor mWorkingHoursColor;
QColor mTodoDueTodayColor;
QColor mTodoOverdueColor;
+ QColor mTodoRunColor;
QColor mMonthViewEvenColor;
QColor mMonthViewOddColor;
QColor mMonthViewHolidayColor;
bool mMonthViewUsesDayColors;
bool mMonthViewSatSunTog;
bool mMonthViewWeek;
QColor mAppColor1;
QColor mAppColor2;
bool mUseAppColors;
int mDayBegins;
int mHourSize;
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index 0bbb3bf..a8943de 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -886,30 +886,40 @@ dummy =
addWidBool(i18n("Small To-do view uses smaller font"),
&(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Todo view uses category colors"),
&(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame);
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);
//topLayout->addWidget(todoDueTodayColor->button(),ii++,1);
// Todo overdue color
wid = new QWidget( topFrame );
widLayout = new QHBoxLayout(wid);
KPrefsDialogWidColor *todoOverdueColor =
addWidColor(i18n("Todo overdue color:"),
&(KOPrefs::instance()->mTodoOverdueColor),wid);
widLayout->addWidget(todoOverdueColor->label());
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 935a5f5..7ee1eef 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -472,24 +472,26 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
mItemPopupMenu->insertItem( i18n("Delete"), this,
SLOT (deleteTodo()));
mItemPopupMenu->insertItem( i18n("Clone..."), this,
SLOT (cloneTodo()));
mItemPopupMenu->insertItem( i18n("Move..."), this,
SLOT (moveTodo()));
mItemPopupMenu->insertItem( i18n("Beam..."), this,
SLOT (beamTodo()));
mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
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,
SLOT (newSubTodo()));
mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
SLOT (unparentTodo()),0,21);
mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
SLOT (reparentTodo()),0,22);
mItemPopupMenu->insertSeparator();
#if 0
mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"),
this, SLOT( purgeCompleted() ) );
@@ -1090,35 +1092,61 @@ void KOTodoView::changedCategories(int index)
void KOTodoView::itemDoubleClicked(QListViewItem *item)
{
if ( pendingSubtodo != 0 ) {
topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
}
pendingSubtodo = 0;
int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
//qDebug("ROW %d ", row);
if (!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);
if (!item) {
if ( pendingSubtodo != 0 ) {
topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
}
pendingSubtodo = 0;
return;
}
KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
if ( pendingSubtodo != 0 ) {
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index d0788a9..d368513 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -197,24 +197,25 @@ class KOTodoView : public KOrg::BaseView
void editTodoSignal(Todo *);
void deleteTodoSignal(Todo *);
void todoModifiedSignal (Todo *, int);
void isModified(bool);
void cloneTodoSignal( Incidence * );
void cancelTodoSignal( Incidence * );
void moveTodoSignal( Incidence * );
void beamTodoSignal( Incidence * );
void purgeCompletedSignal();
protected slots:
+ void toggleRunningItem();
void paintNeeded();
void processSelectionChange();
void addQuickTodo();
void setTodoModified( Todo* );
void todoModified(Todo *, int );
private:
/*
* the TodoEditor approach is rather unscaling in the long
* run.
* Korganizer keeps it in memory and we need to update
* 1. make KOTodoViewItem a QObject again?
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 6559119..66f8d06 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -11,24 +11,25 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <klocale.h>
#include <kdebug.h>
#include <qapp.h>
+#include <kglobal.h>
#include <kiconloader.h>
#include "kotodoviewitem.h"
#include "kotodoview.h"
#include "koprefs.h"
KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo)
: QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
{
construct();
}
@@ -111,42 +112,53 @@ void KOTodoViewItem::construct()
} else {
setText(3,"");
setText(4,"");
}
setSortKey(3,keyd);
setSortKey(4,keyt);
if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt);
else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
- 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);
setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No"));
setText(8,mTodo->categoriesStr());
#if 0
// Find sort id in description. It's the text behind the last '#' character
// found in the description. White spaces are removed from beginning and end
// of sort id.
int pos = mTodo->description().findRev('#');
if (pos < 0) {
@@ -359,31 +371,39 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i
if ( setColor ) {
QStringList categories = mTodo->categories();
QString cat = categories.first();
if ( !cat.isEmpty()) {
colorToSet = *(KOPrefs::instance()->categoryColor(cat) );
} else
setColor = false;
}
bool openMode = !isOpen();
// 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;
+ }
}
if ( setColor ) {
_cg.setColor(role,colorToSet );
if ( role == QColorGroup::Base) {
int rgb = colorToSet.red();
rgb += colorToSet.blue()/2;
rgb += colorToSet.green();
if ( rgb < 200 )
_cg.setColor(QColorGroup::Text,Qt::white );
}