-rw-r--r-- | korganizer/kotodoview.cpp | 56 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 18 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 2 |
3 files changed, 71 insertions, 5 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index b2ff33b..99e6a3a 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -27,2 +27,5 @@ #include <qwhatsthis.h> +#include <qdialog.h> +#include <qlabel.h> +#include <qpushbutton.h> @@ -60,2 +63,42 @@ using namespace KOrg; +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("%1\nis running!").arg( todo->summary() ), this ); + lay->addWidget( lab ); + lab->setAlignment( AlignHCenter ); + + QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); + lay->addWidget( ok ); + QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); + lay->addWidget( cancel ); + connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); + connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); + ok = new QPushButton( i18n("Stop - do not save"), this ); + connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); + lay->addWidget( ok ); + resize( 200, 200 ); +} + +void KOStopTodoPrefs::accept() +{ + qDebug("KOStopTodoPrefs::accept() "); + QDialog::accept(); +} +void KOStopTodoPrefs::doNotSave() +{ + + int result = KMessageBox::warningContinueCancel(this, + i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary() ); + if (result != KMessageBox::Continue) return; + mTodo->stopRunning(); + QDialog::accept(); +} + + class KOTodoViewWhatsThis :public QWhatsThis @@ -1129,7 +1172,9 @@ void KOTodoView::toggleRunningItem() if ( t->isRunning() ) { -#if 0 - int result = KMessageBox::warningContinueCancel(this, - i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop todo"),i18n("Cancel"), true); -#endif + + KOStopTodoPrefs tp ( t, this ); + tp.exec(); + + +#if 0 int result = KMessageBox::warningYesNoCancel(this, @@ -1144,2 +1189,5 @@ void KOTodoView::toggleRunningItem() mActiveItem->construct(); + + +#endif } else { diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 1ffc34a..ceabdba 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h @@ -34,2 +34,4 @@ #include <qmap.h> +#include <qdialog.h> +#include <qlabel.h> #include <qlistview.h> @@ -55,2 +57,18 @@ class DocPrefs; + +class KOStopTodoPrefs : public QDialog +{ + Q_OBJECT + public: + KOStopTodoPrefs( Todo* todo, QWidget *parent=0, const char *name=0 ) ; + + +private slots: + void doNotSave(); + void accept(); +private: + Todo* mTodo; + +}; + class KOTodoListView : public KListView diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index f62aab8..0cf6e4c 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp @@ -362,3 +362,3 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i QColorGroup::ColorRole role; - if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) + if ( KOPrefs::instance()->mTodoViewUsesForegroundColor && !mTodo->isRunning()) role = QColorGroup::Text; |