summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt3
-rw-r--r--korganizer/kotodoview.cpp50
-rw-r--r--korganizer/kotodoview.h14
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp6
-rw-r--r--libkcal/calendarlocal.h1
-rw-r--r--libkcal/todo.cpp4
7 files changed, 73 insertions, 6 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 01c707e..6ac79ad 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1459,2 +1459,5 @@
{ "KO/Pi import information!","KO/Pi Import Information!" },
+{ "Start this todo\nand stop all running","Starte dieses Todo\nund stoppe alle Laufenden" },
+{ "Cancel - do not start"," Abbrechen - Todo nicht starten" },
+{ "","" },
{ "","" },
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 7349d20..1bfdef9 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -65,2 +65,32 @@ using namespace KOrg;
+KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) :
+ QDialog( parent, name, true )
+{
+ mStopAll = true;
+ setCaption( i18n("Start todo") );
+ QVBoxLayout* lay = new QVBoxLayout( this );
+ lay->setSpacing( 3 );
+ lay->setMargin( 3 );
+ QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this );
+ lay->addWidget( lab );
+ lab->setAlignment( AlignCenter );
+
+ QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this );
+ lay->addWidget( ok );
+ ok->setDefault( true );
+ QPushButton * start = new QPushButton( i18n("Start todo"), this );
+ lay->addWidget( start );
+ QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this );
+ lay->addWidget( cancel );
+ connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
+ connect ( start,SIGNAL(clicked() ),this , SLOT ( doStop() ) );
+ connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
+ resize( sizeHint() );
+
+}
+void KOStartTodoPrefs::doStop()
+{
+ mStopAll = false;
+ accept();
+}
KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) :
@@ -1221,3 +1251,3 @@ void KOTodoView::toggleRunningItem()
KOStopTodoPrefs tp ( t, this );
- if (QApplication::desktop()->width() < 800 ){
+ if (QApplication::desktop()->width() <= 800 ){
int wid = tp.width();
@@ -1231,5 +1261,16 @@ void KOTodoView::toggleRunningItem()
} else {
- int result = KMessageBox::warningContinueCancel(this,
- i18n("<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>").arg(mActiveItem->text(0).left( 25 ) ),i18n("Start todo"),i18n("Start todo"),i18n("Cancel"), true);
- if (result != KMessageBox::Continue) return;
+ KOStartTodoPrefs tp ( t->summary(), this );
+ if (QApplication::desktop()->width() <= 800 ){
+ int wid = tp.width();
+ int hei = tp.height();
+ int xx = (QApplication::desktop()->width()-wid)/2;
+ int yy = (QApplication::desktop()->height()-hei)/2;
+ tp.setGeometry( xx,yy,wid,hei );
+ }
+ if ( !tp.exec() ) return;
+ if ( tp.stopAll() ) {
+ mCalendar->stopAllTodos();
+ t->setRunning( true );
+ updateView();
+ } else {
t->setRunning( true );
@@ -1238,2 +1279,3 @@ void KOTodoView::toggleRunningItem()
}
+}
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 8f0c99e..1b31d0d 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -78,2 +78,16 @@ private:
+class KOStartTodoPrefs : public QDialog
+{
+ Q_OBJECT
+ public:
+ KOStartTodoPrefs( QString sum, QWidget *parent=0, const char *name=0 ) ;
+
+ bool stopAll() { return mStopAll; }
+private slots:
+ void doStop();
+private:
+ bool mStopAll;
+
+};
+
class KOTodoListView : public KListView
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 3b7b183..2efa355 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -79,2 +79,3 @@ public:
virtual void setSyncEventsReadOnly() = 0;
+ virtual void stopAllTodos() = 0;
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 8c4dde1..18f1af8 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -149,2 +149,8 @@ bool CalendarLocal::save( const QString &fileName, CalFormat *format )
+void CalendarLocal::stopAllTodos()
+{
+ for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
+ it->setRunning( false );
+
+}
void CalendarLocal::close()
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 0286b48..d32597f 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -48,2 +48,3 @@ class CalendarLocal : public Calendar
void setSyncEventsReadOnly();
+ void stopAllTodos();
/**
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 9a8b6e4..5260051 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -113,4 +113,4 @@ void Todo::saveRunningInfoToFile( QString comment )
//qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1());
- if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 10 ) {
- qDebug("Running time < 30 seconds. Skipped. ");
+ if ( mRunStart.secsTo ( mRunEnd) < 15 ) {
+ qDebug("Running time < 15 seconds. Skipped. ");
return;