summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp50
-rw-r--r--korganizer/kotodoview.h14
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
@@ -60,12 +60,42 @@
60#include "docprefs.h" 60#include "docprefs.h"
61 61
62#include "kotodoview.h" 62#include "kotodoview.h"
63using namespace KOrg; 63using namespace KOrg;
64 64
65 65
66KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) :
67 QDialog( parent, name, true )
68{
69 mStopAll = true;
70 setCaption( i18n("Start todo") );
71 QVBoxLayout* lay = new QVBoxLayout( this );
72 lay->setSpacing( 3 );
73 lay->setMargin( 3 );
74 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this );
75 lay->addWidget( lab );
76 lab->setAlignment( AlignCenter );
77
78 QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this );
79 lay->addWidget( ok );
80 ok->setDefault( true );
81 QPushButton * start = new QPushButton( i18n("Start todo"), this );
82 lay->addWidget( start );
83 QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this );
84 lay->addWidget( cancel );
85 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
86 connect ( start,SIGNAL(clicked() ),this , SLOT ( doStop() ) );
87 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
88 resize( sizeHint() );
89
90}
91void KOStartTodoPrefs::doStop()
92{
93 mStopAll = false;
94 accept();
95}
66KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : 96KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) :
67 QDialog( parent, name, true ) 97 QDialog( parent, name, true )
68{ 98{
69 mTodo = todo; 99 mTodo = todo;
70 setCaption( i18n("Stop todo") ); 100 setCaption( i18n("Stop todo") );
71 QVBoxLayout* lay = new QVBoxLayout( this ); 101 QVBoxLayout* lay = new QVBoxLayout( this );
@@ -1216,29 +1246,41 @@ void KOTodoView::toggleRunningItem()
1216 // qDebug("KOTodoView::toggleRunning() "); 1246 // qDebug("KOTodoView::toggleRunning() ");
1217 if ( ! mActiveItem ) 1247 if ( ! mActiveItem )
1218 return; 1248 return;
1219 Todo * t = mActiveItem->todo(); 1249 Todo * t = mActiveItem->todo();
1220 if ( t->isRunning() ) { 1250 if ( t->isRunning() ) {
1221 KOStopTodoPrefs tp ( t, this ); 1251 KOStopTodoPrefs tp ( t, this );
1222 if (QApplication::desktop()->width() < 800 ){ 1252 if (QApplication::desktop()->width() <= 800 ){
1223 int wid = tp.width(); 1253 int wid = tp.width();
1224 int hei = tp.height(); 1254 int hei = tp.height();
1225 int xx = (QApplication::desktop()->width()-wid)/2; 1255 int xx = (QApplication::desktop()->width()-wid)/2;
1226 int yy = (QApplication::desktop()->height()-hei)/2; 1256 int yy = (QApplication::desktop()->height()-hei)/2;
1227 tp.setGeometry( xx,yy,wid,hei ); 1257 tp.setGeometry( xx,yy,wid,hei );
1228 } 1258 }
1229 tp.exec(); 1259 tp.exec();
1230 mActiveItem->construct(); 1260 mActiveItem->construct();
1231 } else { 1261 } else {
1232 int result = KMessageBox::warningContinueCancel(this, 1262 KOStartTodoPrefs tp ( t->summary(), this );
1233 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); 1263 if (QApplication::desktop()->width() <= 800 ){
1234 if (result != KMessageBox::Continue) return; 1264 int wid = tp.width();
1265 int hei = tp.height();
1266 int xx = (QApplication::desktop()->width()-wid)/2;
1267 int yy = (QApplication::desktop()->height()-hei)/2;
1268 tp.setGeometry( xx,yy,wid,hei );
1269 }
1270 if ( !tp.exec() ) return;
1271 if ( tp.stopAll() ) {
1272 mCalendar->stopAllTodos();
1273 t->setRunning( true );
1274 updateView();
1275 } else {
1235 t->setRunning( true ); 1276 t->setRunning( true );
1236 mActiveItem->construct(); 1277 mActiveItem->construct();
1237 } 1278 }
1238} 1279}
1280}
1239 1281
1240void KOTodoView::itemClicked(QListViewItem *item) 1282void KOTodoView::itemClicked(QListViewItem *item)
1241{ 1283{
1242 //qDebug("KOTodoView::itemClicked %d", item); 1284 //qDebug("KOTodoView::itemClicked %d", item);
1243 if (!item) { 1285 if (!item) {
1244 if ( pendingSubtodo != 0 ) { 1286 if ( pendingSubtodo != 0 ) {
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 8f0c99e..1b31d0d 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -73,12 +73,26 @@ private:
73 QLineEdit* mComment; 73 QLineEdit* mComment;
74 KDateEdit *sde, *ede; 74 KDateEdit *sde, *ede;
75 KOTimeEdit *ste, *ete; 75 KOTimeEdit *ste, *ete;
76 76
77}; 77};
78 78
79class KOStartTodoPrefs : public QDialog
80{
81 Q_OBJECT
82 public:
83 KOStartTodoPrefs( QString sum, QWidget *parent=0, const char *name=0 ) ;
84
85 bool stopAll() { return mStopAll; }
86private slots:
87 void doStop();
88private:
89 bool mStopAll;
90
91};
92
79class KOTodoListView : public KListView 93class KOTodoListView : public KListView
80{ 94{
81 Q_OBJECT 95 Q_OBJECT
82 public: 96 public:
83 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); 97 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0);
84 virtual ~KOTodoListView() {} 98 virtual ~KOTodoListView() {}