-rw-r--r-- | korganizer/kotodoview.cpp | 50 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 14 |
2 files changed, 60 insertions, 4 deletions
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 |