summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-01-05 14:17:14 (UTC)
committer zautrix <zautrix>2005-01-05 14:17:14 (UTC)
commitdf0200487afbfa59b80a79e548d70b5203019003 (patch) (side-by-side diff)
tree2240de4162736461316c8cb3cd00f87a8a9bf2bd /korganizer
parentb8410daa179dbff2ebb833071ba50b9da36e6330 (diff)
downloadkdepimpi-df0200487afbfa59b80a79e548d70b5203019003.zip
kdepimpi-df0200487afbfa59b80a79e548d70b5203019003.tar.gz
kdepimpi-df0200487afbfa59b80a79e548d70b5203019003.tar.bz2
todo enhancements/fixes
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp4
-rw-r--r--korganizer/koagendaitem.cpp2
-rw-r--r--korganizer/kodialogmanager.cpp2
-rw-r--r--korganizer/koprefs.cpp2
-rw-r--r--korganizer/koprefs.h2
-rw-r--r--korganizer/koprefsdialog.cpp13
-rw-r--r--korganizer/kotodoview.cpp78
-rw-r--r--korganizer/kotodoview.h7
-rw-r--r--korganizer/kotodoviewitem.cpp33
-rw-r--r--korganizer/koviewmanager.cpp1
10 files changed, 115 insertions, 29 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index a46cd87..7ddbe23 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -268,2 +268,3 @@ void CalendarView::init()
mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
+ mTodoList->setNavigator( mNavigator );
mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
@@ -313,2 +314,3 @@ void CalendarView::init()
mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall");
+ mTodoList->setNavigator( mNavigator );
@@ -2146,2 +2148,4 @@ void CalendarView::updateView()
updateView( tmpList.first(), tmpList.last() );
+ if ( KOPrefs::instance()->mHideNonStartedTodos )
+ mTodoList->updateView();
}
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 46184ac..6965ba7 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -500,3 +500,3 @@ void KOAgendaItem::computeText()
} else {
- if ( !(mIncidence->doesFloat()))
+ if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp
index db7c3f2..c99c0cb 100644
--- a/korganizer/kodialogmanager.cpp
+++ b/korganizer/kodialogmanager.cpp
@@ -193,3 +193,3 @@ void KODialogManager::showSearchDialog()
#ifndef DESKTOP_VERSION
- mSearchDialog->setMaximumSize( 640, 480 );
+ mSearchDialog->setMaximumSize( QApplication::desktop()->size());
//mSearchDialog->setGeometry( 40,40, 400, 300);
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 1cdb2fb..aae4692 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -112,2 +112,4 @@ KOPrefs::KOPrefs() :
addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
+ addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true);
+ addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false);
addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index f2fe77a..69722a1 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -192,2 +192,4 @@ class KOPrefs : public KPimPrefs
bool mShowTodoInAgenda;
+ bool mShowTimeInAgenda;
+ bool mHideNonStartedTodos;
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index 578c0e9..8aa24ee 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -95,2 +95,5 @@ KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
//setupGroupAutomationTab();
+
+ if ( QApplication::desktop()->height() == 480 )
+ hideButtons();
}
@@ -604,2 +607,7 @@ void KOPrefsDialog::setupViewsTab()
dummy =
+ addWidBool(i18n("Show time in agenda items"),
+ &(KOPrefs::instance()->mShowTimeInAgenda),topFrame);
+ topLayout->addWidget(dummy->checkBox(),ii++,0);
+
+ dummy =
addWidBool(i18n("Highlight current day in agenda"),
@@ -835,2 +843,7 @@ void KOPrefsDialog::setupViewsTab()
ii = 0;
+dummy =
+ addWidBool(i18n("Hide not running Todos in To-do view"),
+ &(KOPrefs::instance()->mHideNonStartedTodos),topFrame);
+ topLayout->addWidget(dummy->checkBox(),ii++,0);
+
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 9cafc60..5d7b066 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -334,2 +334,3 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
{
+ mNavigator = 0;
QBoxLayout *topLayout = new QVBoxLayout(this);
@@ -354,3 +355,4 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
mTodoListView->addColumn(i18n("Complete"));
- mTodoListView->setColumnAlignment(2,AlignHCenter);
+ mTodoListView->setColumnAlignment(2,AlignCenter);
+
mTodoListView->addColumn(i18n("Due Date"));
@@ -359,2 +361,8 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
mTodoListView->setColumnAlignment(4,AlignHCenter);
+
+ mTodoListView->addColumn(i18n("Start Date"));
+ mTodoListView->setColumnAlignment(5,AlignLeft);
+ mTodoListView->addColumn(i18n("Start Time"));
+ mTodoListView->setColumnAlignment(6,AlignHCenter);
+
mTodoListView->addColumn(i18n("Cancelled"));
@@ -377,6 +385,5 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
mTodoListView->setColumnWidthMode(6, QListView::Manual);
- mTodoListView->setColumnAlignment( 2, AlignCenter );
-#if 0
- mTodoListView->setColumnWidthMode(6, QListView::Manual);
-#endif
+ mTodoListView->setColumnWidthMode(7, QListView::Manual);
+ mTodoListView->setColumnWidthMode(8, QListView::Manual);
+
@@ -430,2 +437,4 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
this, SLOT( toggleQuickTodo() ),0, 34 );
+ mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
+ this, SLOT( toggleRunning() ),0, 35 );
@@ -440,2 +449,4 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
this, SLOT( toggleQuickTodo() ),0,4 );
+ mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
+ this, SLOT( toggleRunning() ),0,5 );
mDocPrefs = new DocPrefs( name );
@@ -444,2 +455,14 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
mItemPopupMenu->setCheckable( true );
+
+
+ mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
+ mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
+
+ mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
+ mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
+
+ mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
+ mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
+
+
// Double clicking conflicts with opening/closing the subtree
@@ -478,7 +501,2 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
SLOT( addQuickTodo() ) );
-// if ( QApplication::desktop()->width() < 480 ) {
-// setNarrow();
- // mTodoListView->setColumnWidth( 0, 100 );
-
- // }
@@ -499,12 +517,2 @@ void KOTodoView::jumpToDate ()
-void KOTodoView::setNarrow()
-{
- //mTodoListView->setColumnWidth( 0, 120 );
- mTodoListView->setColumnWidth( 1, 35 );
- mTodoListView->setColumnWidth( 2, 40 );
- mTodoListView->setColumnWidth( 3, 80 );
- mTodoListView->setColumnWidth( 4, 40 );
- mTodoListView->setColumnWidth( 5, 90 );
-
-}
void KOTodoView::updateView()
@@ -589,3 +597,3 @@ void KOTodoView::updateView()
for(todo = todoList.first(); todo; todo = todoList.next()) {
- if (!mTodoMap.contains(todo) && ( KOPrefs::instance()->mShowCompletedTodo || !todo->isCompleted() ) )
+ if (!mTodoMap.contains(todo) && checkTodo( todo ) )
{
@@ -603,2 +611,18 @@ void KOTodoView::updateView()
+bool KOTodoView::checkTodo( Todo * todo )
+{
+
+ if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
+ return false;
+ if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
+ if ( todo->hasStartDate() )
+ if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
+ return false;
+ if ( todo->hasDueDate() )
+ if ( mNavigator->selectedDates().first() > todo->dtDue().date() )
+ return false;
+ }
+ return true;
+}
+
void KOTodoView::restoreItemState( QListViewItem *item )
@@ -618,2 +642,3 @@ QMap<Todo *,KOTodoViewItem *>::ConstIterator
{
+
// kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl;
@@ -720,3 +745,3 @@ void KOTodoView::popupMenu(QListViewItem *item,const QPoint &,int column)
break;
- case 6:
+ case 8:
getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break;
@@ -997,2 +1022,11 @@ void KOTodoView::toggleQuickTodo()
}
+
+void KOTodoView::toggleRunning()
+{
+ KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos;
+ mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
+ mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
+ updateView();
+}
+
void KOTodoView::toggleCompleted()
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 0c08677..5ca0362 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -45,2 +45,3 @@
#include "koglobals.h"
+#include "datenavigator.h"
@@ -120,3 +121,2 @@ class KOTodoView : public KOrg::BaseView
int currentDateCount() { return 0; }
- void setNarrow();
@@ -130,2 +130,3 @@ class KOTodoView : public KOrg::BaseView
QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem);
+ void setNavigator( DateNavigator* nav ) {mNavigator = nav;}
@@ -164,2 +165,3 @@ class KOTodoView : public KOrg::BaseView
void toggleCompleted();
+ void toggleRunning();
void toggleQuickTodo();
@@ -209,2 +211,4 @@ class KOTodoView : public KOrg::BaseView
+ bool checkTodo( Todo * );
+
KOTodoListView *mTodoListView;
@@ -231,2 +235,3 @@ class KOTodoView : public KOrg::BaseView
KOTodoViewItem * pendingSubtodo;
+ DateNavigator* mNavigator;
};
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index ae0b334..347d982 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -81,2 +81,4 @@ void KOTodoViewItem::construct()
QString keyt = "==";
+ QString skeyd = "==";
+ QString skeyt = "==";
@@ -98,3 +100,3 @@ void KOTodoViewItem::construct()
keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
- setSortKey(3,keyd);
+ // setSortKey(3,keyd);
if (mTodo->doesFloat()) {
@@ -106,3 +108,3 @@ void KOTodoViewItem::construct()
keyt.sprintf("%02d%02d",t.hour(),t.minute());
- setSortKey(4,keyt);
+ //setSortKey(4,keyt);
}
@@ -118,4 +120,27 @@ void KOTodoViewItem::construct()
- setText(5,mTodo->cancelled() ? i18n("Yes") : i18n("No"));
- setText(6,mTodo->categoriesStr());
+
+
+ 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();
+ skeyt.sprintf("%02d%02d",t.hour(),t.minute());
+
+ }
+ } else {
+ setText(5,"");
+ setText(6,"");
+ }
+ setSortKey(5,skeyd);
+ setSortKey(6,skeyt);
+
+ setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No"));
+ setText(8,mTodo->categoriesStr());
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 6e151f9..b2dd266 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -511,2 +511,3 @@ void KOViewManager::showTodoView()
mTodoView->restoreLayout(config,"Todo View");
+ mTodoView->setNavigator( mMainView->dateNavigator() );
}