From 9b2bf31715226dfa8210f31843616a04f810f012 Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 27 Jun 2005 04:48:41 +0000 Subject: strat stop tod fixes --- (limited to 'korganizer') diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 7349d20..1bfdef9 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -63,6 +63,36 @@ 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("%1\n").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 ) : QDialog( parent, name, true ) { @@ -1199,9 +1229,9 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) toggleRunningItem(); return; } else { - t->setRunning( true ); - mActiveItem->construct(); - topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); + t->setRunning( true ); + mActiveItem->construct(); + topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); return; } } @@ -1219,7 +1249,7 @@ void KOTodoView::toggleRunningItem() Todo * t = mActiveItem->todo(); if ( t->isRunning() ) { KOStopTodoPrefs tp ( t, this ); - if (QApplication::desktop()->width() < 800 ){ + if (QApplication::desktop()->width() <= 800 ){ int wid = tp.width(); int hei = tp.height(); int xx = (QApplication::desktop()->width()-wid)/2; @@ -1229,11 +1259,23 @@ void KOTodoView::toggleRunningItem() tp.exec(); mActiveItem->construct(); } else { - int result = KMessageBox::warningContinueCancel(this, - i18n("
%1
is not running. Do you want to set\nthe state to running?
").arg(mActiveItem->text(0).left( 25 ) ),i18n("Start todo"),i18n("Start todo"),i18n("Cancel"), true); - if (result != KMessageBox::Continue) return; - t->setRunning( true ); - mActiveItem->construct(); + 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 ); + mActiveItem->construct(); + } } } diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 8f0c99e..1b31d0d 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h @@ -76,6 +76,20 @@ 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 { Q_OBJECT -- cgit v0.9.0.2