summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp13
-rw-r--r--korganizer/kotodoview.h1
2 files changed, 12 insertions, 2 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 07bfdbf..a12c43e 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -93,93 +93,102 @@ void KOStartTodoPrefs::doStop()
93 mStopAll = false; 93 mStopAll = false;
94 accept(); 94 accept();
95} 95}
96KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : 96KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) :
97 QDialog( parent, name, true ) 97 QDialog( parent, name, true )
98{ 98{
99 mTodo = todo; 99 mTodo = todo;
100 setCaption( i18n("Stop todo") ); 100 setCaption( i18n("Stop todo") );
101 QVBoxLayout* lay = new QVBoxLayout( this ); 101 QVBoxLayout* lay = new QVBoxLayout( this );
102 lay->setSpacing( 3 ); 102 lay->setSpacing( 3 );
103 lay->setMargin( 3 ); 103 lay->setMargin( 3 );
104 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this ); 104 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this );
105 lay->addWidget( lab ); 105 lay->addWidget( lab );
106 lab->setAlignment( AlignHCenter ); 106 lab->setAlignment( AlignHCenter );
107 lab = new QLabel( i18n("Additional Comment:"), this ); 107 lab = new QLabel( i18n("Additional Comment:"), this );
108 lay->addWidget( lab ); 108 lay->addWidget( lab );
109 mComment = new QLineEdit( this ); 109 mComment = new QLineEdit( this );
110 lay->addWidget( mComment ); 110 lay->addWidget( mComment );
111 QHBox * start = new QHBox ( this ); 111 QHBox * start = new QHBox ( this );
112 lay->addWidget( start ); 112 lay->addWidget( start );
113 lab = new QLabel( i18n("Start:"), start ); 113 lab = new QLabel( i18n("Start:"), start );
114 QHBox * end = new QHBox ( this ); 114 QHBox * end = new QHBox ( this );
115 lay->addWidget( end ); 115 lay->addWidget( end );
116 lab = new QLabel( i18n("End:"), end ); 116 lab = new QLabel( i18n("End:"), end );
117 sde = new KDateEdit( start ); 117 sde = new KDateEdit( start );
118 ste = new KOTimeEdit( start ); 118 ste = new KOTimeEdit( start );
119 connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); 119 connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) );
120 ede = new KDateEdit( end ); 120 ede = new KDateEdit( end );
121 ete = new KOTimeEdit(end ); 121 ete = new KOTimeEdit(end );
122 connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); 122 connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) );
123 sde->setDate( mTodo->runStart().date() ); 123 sde->setDate( mTodo->runStart().date() );
124 ste->setTime( mTodo->runStart().time() ); 124 ste->setTime( mTodo->runStart().time() );
125 ede->setDate( QDate::currentDate()); 125 mStop = QDateTime::currentDateTime();
126 ete->setTime( QTime::currentTime() ); 126 ede->setDate( mStop.date());
127 ete->setTime( mStop.time() );
127 QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); 128 QPushButton * ok = new QPushButton( i18n("Stop and save"), this );
128 lay->addWidget( ok ); 129 lay->addWidget( ok );
129 ok->setDefault( true ); 130 ok->setDefault( true );
130 QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); 131 QPushButton * cancel = new QPushButton( i18n("Continue running"), this );
131 lay->addWidget( cancel ); 132 lay->addWidget( cancel );
132 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 133 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
133 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 134 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
134 ok = new QPushButton( i18n("Stop - do not save"), this ); 135 ok = new QPushButton( i18n("Stop - do not save"), this );
135 connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); 136 connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) );
136 lay->addWidget( ok ); 137 lay->addWidget( ok );
137 if (QApplication::desktop()->width() < 320 ) 138 if (QApplication::desktop()->width() < 320 )
138 resize( 240, sizeHint().height() ); 139 resize( 240, sizeHint().height() );
139 else 140 else
140 resize( 320, sizeHint().height() ); 141 resize( 320, sizeHint().height() );
141 142
142} 143}
143 144
144void KOStopTodoPrefs::accept() 145void KOStopTodoPrefs::accept()
145{ 146{
146 QDateTime start = QDateTime( sde->date(), ste->getTime() ); 147 QDateTime start = QDateTime( sde->date(), ste->getTime() );
147 QDateTime stop = QDateTime( ede->date(), ete->getTime() ); 148 QDateTime stop = QDateTime( ede->date(), ete->getTime() );
148 if ( start > stop ) { 149 if ( start > stop ) {
149 KMessageBox::sorry(this, 150 KMessageBox::sorry(this,
150 i18n("The start time is\nafter the end time!"), 151 i18n("The start time is\nafter the end time!"),
151 i18n("Time mismatch!")); 152 i18n("Time mismatch!"));
152 return; 153 return;
153 } 154 }
155 // restoring the seconds
156 if ( start == QDateTime( mTodo->runStart().date(),
157 QTime(mTodo->runStart().time().hour() , mTodo->runStart().time().minute() ) ) )
158 start = mTodo->runStart();
159 if ( stop == QDateTime( mStop.date(),
160 QTime( mStop.time().hour() , mStop.time().minute() ) ) )
161 stop = mStop;
162
154 mTodo->saveRunningInfo( mComment->text(), start, stop ); 163 mTodo->saveRunningInfo( mComment->text(), start, stop );
155 QDialog::accept(); 164 QDialog::accept();
156} 165}
157void KOStopTodoPrefs::doNotSave() 166void KOStopTodoPrefs::doNotSave()
158{ 167{
159 int result = KMessageBox::warningContinueCancel(this, 168 int result = KMessageBox::warningContinueCancel(this,
160 i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") ); 169 i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") );
161 if (result != KMessageBox::Continue) return; 170 if (result != KMessageBox::Continue) return;
162 mTodo->stopRunning(); 171 mTodo->stopRunning();
163 QDialog::accept(); 172 QDialog::accept();
164} 173}
165 174
166 175
167class KOTodoViewWhatsThis :public QWhatsThis 176class KOTodoViewWhatsThis :public QWhatsThis
168{ 177{
169public: 178public:
170 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 179 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
171 180
172protected: 181protected:
173 virtual QString text( const QPoint& p) 182 virtual QString text( const QPoint& p)
174 { 183 {
175 return _view->getWhatsThisText(p) ; 184 return _view->getWhatsThisText(p) ;
176 } 185 }
177private: 186private:
178 QWidget* _wid; 187 QWidget* _wid;
179 KOTodoView * _view; 188 KOTodoView * _view;
180}; 189};
181 190
182KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, 191KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
183 const char *name) : 192 const char *name) :
184 KListView(parent,name) 193 KListView(parent,name)
185{ 194{
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 9180015..ecd0ad9 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -42,64 +42,65 @@
42 42
43#include <korganizer/baseview.h> 43#include <korganizer/baseview.h>
44 44
45#include "kotodoviewitem.h" 45#include "kotodoviewitem.h"
46#include "koprefs.h" 46#include "koprefs.h"
47#include "koglobals.h" 47#include "koglobals.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49 49
50class QDragEnterEvent; 50class QDragEnterEvent;
51class QDragMoveEvent; 51class QDragMoveEvent;
52class QDragLeaveEvent; 52class QDragLeaveEvent;
53class QDropEvent; 53class QDropEvent;
54class KOTodoViewWhatsThis; 54class KOTodoViewWhatsThis;
55class KDateEdit; 55class KDateEdit;
56class KOTimeEdit; 56class KOTimeEdit;
57 57
58class DocPrefs; 58class DocPrefs;
59 59
60 60
61class KOStopTodoPrefs : public QDialog 61class KOStopTodoPrefs : public QDialog
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64 public: 64 public:
65 KOStopTodoPrefs( Todo* todo, QWidget *parent=0, const char *name=0 ) ; 65 KOStopTodoPrefs( Todo* todo, QWidget *parent=0, const char *name=0 ) ;
66 66
67 67
68private slots: 68private slots:
69 void doNotSave(); 69 void doNotSave();
70 void accept(); 70 void accept();
71private: 71private:
72 Todo* mTodo; 72 Todo* mTodo;
73 QLineEdit* mComment; 73 QLineEdit* mComment;
74 QDateTime mStop;
74 KDateEdit *sde, *ede; 75 KDateEdit *sde, *ede;
75 KOTimeEdit *ste, *ete; 76 KOTimeEdit *ste, *ete;
76 77
77}; 78};
78 79
79class KOStartTodoPrefs : public QDialog 80class KOStartTodoPrefs : public QDialog
80{ 81{
81 Q_OBJECT 82 Q_OBJECT
82 public: 83 public:
83 KOStartTodoPrefs( QString sum, QWidget *parent=0, const char *name=0 ) ; 84 KOStartTodoPrefs( QString sum, QWidget *parent=0, const char *name=0 ) ;
84 85
85 bool stopAll() { return mStopAll; } 86 bool stopAll() { return mStopAll; }
86private slots: 87private slots:
87 void doStop(); 88 void doStop();
88private: 89private:
89 bool mStopAll; 90 bool mStopAll;
90 91
91}; 92};
92 93
93class KOTodoListView : public KListView 94class KOTodoListView : public KListView
94{ 95{
95 Q_OBJECT 96 Q_OBJECT
96 public: 97 public:
97 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); 98 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0);
98 virtual ~KOTodoListView() {} 99 virtual ~KOTodoListView() {}
99 100
100 signals: 101 signals:
101 void paintNeeded(); 102 void paintNeeded();
102 void todoDropped(Todo *, int); 103 void todoDropped(Todo *, int);
103 void double_Clicked(QListViewItem *item); 104 void double_Clicked(QListViewItem *item);
104 void reparentTodoSignal( Todo *,Todo * ); 105 void reparentTodoSignal( Todo *,Todo * );
105 void unparentTodoSignal(Todo *); 106 void unparentTodoSignal(Todo *);