author | zautrix <zautrix> | 2005-06-27 04:48:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-27 04:48:41 (UTC) |
commit | 9b2bf31715226dfa8210f31843616a04f810f012 (patch) (side-by-side diff) | |
tree | b502c4a379b26f74621ba8fabb59fcb53f5a5679 /korganizer/kotodoview.cpp | |
parent | 2e566a307bb50ac595fe729ebed0f5336f2af5a8 (diff) | |
download | kdepimpi-9b2bf31715226dfa8210f31843616a04f810f012.zip kdepimpi-9b2bf31715226dfa8210f31843616a04f810f012.tar.gz kdepimpi-9b2bf31715226dfa8210f31843616a04f810f012.tar.bz2 |
strat stop tod fixes
-rw-r--r-- | korganizer/kotodoview.cpp | 60 |
1 files changed, 51 insertions, 9 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 7349d20..1bfdef9 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -54,24 +54,54 @@ #else #include <qapplication.h> #endif #ifndef KORG_NOPRINTER #include "calprinter.h" #endif #include "docprefs.h" #include "kotodoview.h" 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 ) : QDialog( parent, name, true ) { mTodo = todo; setCaption( i18n("Stop todo") ); QVBoxLayout* lay = new QVBoxLayout( this ); lay->setSpacing( 3 ); lay->setMargin( 3 ); QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this ); lay->addWidget( lab ); lab->setAlignment( AlignHCenter ); lab = new QLabel( i18n("Additional Comment:"), this ); @@ -1190,59 +1220,71 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) Todo * t = mActiveItem->todo(); if ( t->isRunning() ) { if ( t->runTime() < 15) { t->stopRunning(); mActiveItem->construct(); topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); return; } else 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; } } } 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() ) { 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; int yy = (QApplication::desktop()->height()-hei)/2; tp.setGeometry( xx,yy,wid,hei ); } tp.exec(); mActiveItem->construct(); } 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; - 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(); + } } } void KOTodoView::itemClicked(QListViewItem *item) { //qDebug("KOTodoView::itemClicked %d", item); if (!item) { if ( pendingSubtodo != 0 ) { topLevelWidget()->setCaption(i18n("Reparenting aborted!")); } pendingSubtodo = 0; return; |