-rw-r--r-- | korganizer/kotodoview.cpp | 198 |
1 files changed, 107 insertions, 91 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index ba94057..2b8fbd3 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -8,43 +8,59 @@ | |||
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <QDesktopWidget> | ||
25 | |||
24 | #include <qlayout.h> | 26 | #include <qlayout.h> |
25 | #include <qheader.h> | 27 | #include <q3header.h> |
26 | #include <qcursor.h> | 28 | #include <qcursor.h> |
27 | #include <qwhatsthis.h> | 29 | #include <q3whatsthis.h> |
28 | #include <qdialog.h> | 30 | #include <qdialog.h> |
29 | #include <qlabel.h> | 31 | #include <qlabel.h> |
30 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
31 | 33 | ||
32 | #include <qinputdialog.h> | 34 | #include <qinputdialog.h> |
33 | 35 | ||
34 | #include <qvbox.h> | 36 | #include <q3vbox.h> |
37 | //Added by qt3to4: | ||
38 | #include <QWheelEvent> | ||
39 | #include <QFocusEvent> | ||
40 | #include <QDragLeaveEvent> | ||
41 | #include <QMouseEvent> | ||
42 | #include <QDragEnterEvent> | ||
43 | #include <QKeyEvent> | ||
44 | #include <Q3HBoxLayout> | ||
45 | #include <Q3VBoxLayout> | ||
46 | #include <QDropEvent> | ||
47 | #include <QDragMoveEvent> | ||
48 | #include <QPaintEvent> | ||
49 | #include <Q3PopupMenu> | ||
50 | #include <Q3PtrList> | ||
35 | #include <kdebug.h> | 51 | #include <kdebug.h> |
36 | #include "koprefs.h" | 52 | #include "koprefs.h" |
37 | #include <klocale.h> | 53 | #include <klocale.h> |
38 | #include <kglobal.h> | 54 | #include <kglobal.h> |
39 | #include <kdateedit.h> | 55 | #include <kdateedit.h> |
40 | #include "ktimeedit.h" | 56 | #include "ktimeedit.h" |
41 | #include <kiconloader.h> | 57 | #include <kiconloader.h> |
42 | #include <kmessagebox.h> | 58 | #include <kmessagebox.h> |
43 | 59 | ||
44 | #include <libkcal/icaldrag.h> | 60 | #include <libkcal/icaldrag.h> |
45 | #include <libkcal/vcaldrag.h> | 61 | #include <libkcal/vcaldrag.h> |
46 | #include <libkcal/calfilter.h> | 62 | #include <libkcal/calfilter.h> |
47 | #include <libkcal/dndfactory.h> | 63 | #include <libkcal/dndfactory.h> |
48 | #include <libkcal/calendarresources.h> | 64 | #include <libkcal/calendarresources.h> |
49 | #include <libkcal/resourcecalendar.h> | 65 | #include <libkcal/resourcecalendar.h> |
50 | #include <kresources/resourceselectdialog.h> | 66 | #include <kresources/resourceselectdialog.h> |
@@ -55,76 +71,76 @@ | |||
55 | #include <qapplication.h> | 71 | #include <qapplication.h> |
56 | #endif | 72 | #endif |
57 | #ifndef KORG_NOPRINTER | 73 | #ifndef KORG_NOPRINTER |
58 | #include "calprinter.h" | 74 | #include "calprinter.h" |
59 | #endif | 75 | #endif |
60 | #include "docprefs.h" | 76 | #include "docprefs.h" |
61 | 77 | ||
62 | #include "kotodoview.h" | 78 | #include "kotodoview.h" |
63 | using namespace KOrg; | 79 | using namespace KOrg; |
64 | 80 | ||
65 | 81 | ||
66 | KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) : | 82 | KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) : |
67 | QDialog( parent, name, true ) | 83 | QDialog( parent, name, true ) |
68 | { | 84 | { |
69 | mStopAll = true; | 85 | mStopAll = true; |
70 | setCaption( i18n("Start todo") ); | 86 | setCaption( i18n("Start todo") ); |
71 | QVBoxLayout* lay = new QVBoxLayout( this ); | 87 | Q3VBoxLayout* lay = new Q3VBoxLayout( this ); |
72 | lay->setSpacing( 3 ); | 88 | lay->setSpacing( 3 ); |
73 | lay->setMargin( 3 ); | 89 | lay->setMargin( 3 ); |
74 | QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this ); | 90 | QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this ); |
75 | lay->addWidget( lab ); | 91 | lay->addWidget( lab ); |
76 | lab->setAlignment( AlignCenter ); | 92 | lab->setAlignment( Qt::AlignCenter ); |
77 | 93 | ||
78 | QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this ); | 94 | QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this ); |
79 | lay->addWidget( ok ); | 95 | lay->addWidget( ok ); |
80 | ok->setDefault( true ); | 96 | ok->setDefault( true ); |
81 | QPushButton * start = new QPushButton( i18n("Start todo"), this ); | 97 | QPushButton * start = new QPushButton( i18n("Start todo"), this ); |
82 | lay->addWidget( start ); | 98 | lay->addWidget( start ); |
83 | QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this ); | 99 | QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this ); |
84 | lay->addWidget( cancel ); | 100 | lay->addWidget( cancel ); |
85 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 101 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
86 | connect ( start,SIGNAL(clicked() ),this , SLOT ( doStop() ) ); | 102 | connect ( start,SIGNAL(clicked() ),this , SLOT ( doStop() ) ); |
87 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 103 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
88 | resize( sizeHint() ); | 104 | resize( sizeHint() ); |
89 | 105 | ||
90 | } | 106 | } |
91 | void KOStartTodoPrefs::doStop() | 107 | void KOStartTodoPrefs::doStop() |
92 | { | 108 | { |
93 | mStopAll = false; | 109 | mStopAll = false; |
94 | accept(); | 110 | accept(); |
95 | } | 111 | } |
96 | KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : | 112 | KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : |
97 | QDialog( parent, name, true ) | 113 | QDialog( parent, name, true ) |
98 | { | 114 | { |
99 | mTodo = todo; | 115 | mTodo = todo; |
100 | setCaption( i18n("Stop todo") ); | 116 | setCaption( i18n("Stop todo") ); |
101 | QVBoxLayout* lay = new QVBoxLayout( this ); | 117 | Q3VBoxLayout* lay = new Q3VBoxLayout( this ); |
102 | lay->setSpacing( 3 ); | 118 | lay->setSpacing( 3 ); |
103 | lay->setMargin( 3 ); | 119 | lay->setMargin( 3 ); |
104 | QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this ); | 120 | QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this ); |
105 | lay->addWidget( lab ); | 121 | lay->addWidget( lab ); |
106 | lab->setAlignment( AlignHCenter ); | 122 | lab->setAlignment( Qt::AlignHCenter ); |
107 | lab = new QLabel( i18n("Additional Comment:"), this ); | 123 | lab = new QLabel( i18n("Additional Comment:"), this ); |
108 | lay->addWidget( lab ); | 124 | lay->addWidget( lab ); |
109 | mComment = new QLineEdit( this ); | 125 | mComment = new QLineEdit( this ); |
110 | lay->addWidget( mComment ); | 126 | lay->addWidget( mComment ); |
111 | QHBox * start = new QHBox ( this ); | 127 | Q3HBox * start = new Q3HBox ( this ); |
112 | lay->addWidget( start ); | 128 | lay->addWidget( start ); |
113 | lab = new QLabel( i18n("Start:"), start ); | 129 | lab = new QLabel( i18n("Start:"), start ); |
114 | QHBox * end = new QHBox ( this ); | 130 | Q3HBox * end = new Q3HBox ( this ); |
115 | lay->addWidget( end ); | 131 | lay->addWidget( end ); |
116 | lab = new QLabel( i18n("End:"), end ); | 132 | lab = new QLabel( i18n("End:"), end ); |
117 | sde = new KDateEdit( start ); | 133 | sde = new KDateEdit( start ); |
118 | ste = new KOTimeEdit( start ); | 134 | ste = new KOTimeEdit( start ); |
119 | connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); | 135 | connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); |
120 | ede = new KDateEdit( end ); | 136 | ede = new KDateEdit( end ); |
121 | ete = new KOTimeEdit(end ); | 137 | ete = new KOTimeEdit(end ); |
122 | connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); | 138 | connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); |
123 | sde->setDate( mTodo->runStart().date() ); | 139 | sde->setDate( mTodo->runStart().date() ); |
124 | ste->setTime( mTodo->runStart().time() ); | 140 | ste->setTime( mTodo->runStart().time() ); |
125 | mStop = QDateTime::currentDateTime(); | 141 | mStop = QDateTime::currentDateTime(); |
126 | ede->setDate( mStop.date()); | 142 | ede->setDate( mStop.date()); |
127 | ete->setTime( mStop.time() ); | 143 | ete->setTime( mStop.time() ); |
128 | QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); | 144 | QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); |
129 | lay->addWidget( ok ); | 145 | lay->addWidget( ok ); |
130 | ok->setDefault( true ); | 146 | ok->setDefault( true ); |
@@ -160,36 +176,36 @@ void KOStopTodoPrefs::accept() | |||
160 | QTime( mStop.time().hour() , mStop.time().minute() ) ) ) | 176 | QTime( mStop.time().hour() , mStop.time().minute() ) ) ) |
161 | stop = mStop; | 177 | stop = mStop; |
162 | 178 | ||
163 | mTodo->saveRunningInfo( mComment->text(), start, stop ); | 179 | mTodo->saveRunningInfo( mComment->text(), start, stop ); |
164 | QDialog::accept(); | 180 | QDialog::accept(); |
165 | } | 181 | } |
166 | void KOStopTodoPrefs::doNotSave() | 182 | void KOStopTodoPrefs::doNotSave() |
167 | { | 183 | { |
168 | int result = KMessageBox::warningContinueCancel(this, | 184 | int result = KMessageBox::warningContinueCancel(this, |
169 | i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") ); | 185 | i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") ); |
170 | if (result != KMessageBox::Continue) return; | 186 | if (result != KMessageBox::Continue) return; |
171 | mTodo->stopRunning(); | 187 | mTodo->stopRunning(); |
172 | QDialog::accept(); | 188 | QDialog::accept(); |
173 | } | 189 | } |
174 | 190 | ||
175 | 191 | ||
176 | class KOTodoViewWhatsThis :public QWhatsThis | 192 | class KOTodoViewWhatsThis :public Q3WhatsThis |
177 | { | 193 | { |
178 | public: | 194 | public: |
179 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 195 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : Q3WhatsThis( wid ), _wid(wid),_view (view) { }; |
180 | 196 | ||
181 | protected: | 197 | protected: |
182 | virtual QString text( const QPoint& p) | 198 | virtual QString text( const QPoint& p) |
183 | { | 199 | { |
184 | return _view->getWhatsThisText(p) ; | 200 | return _view->getWhatsThisText(p) ; |
185 | } | 201 | } |
186 | private: | 202 | private: |
187 | QWidget* _wid; | 203 | QWidget* _wid; |
188 | KOTodoView * _view; | 204 | KOTodoView * _view; |
189 | }; | 205 | }; |
190 | 206 | ||
191 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, | 207 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, |
192 | const char *name) : | 208 | const char *name) : |
193 | KListView(parent,name) | 209 | KListView(parent,name) |
194 | { | 210 | { |
195 | mName = QString ( name ); | 211 | mName = QString ( name ); |
@@ -201,74 +217,74 @@ KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, | |||
201 | mMousePressed = false; | 217 | mMousePressed = false; |
202 | 218 | ||
203 | setAcceptDrops(true); | 219 | setAcceptDrops(true); |
204 | viewport()->setAcceptDrops(true); | 220 | viewport()->setAcceptDrops(true); |
205 | int size = 16; | 221 | int size = 16; |
206 | if (qApp->desktop()->width() < 300 ) | 222 | if (qApp->desktop()->width() < 300 ) |
207 | size = 12; | 223 | size = 12; |
208 | setTreeStepSize( size + 6 ); | 224 | setTreeStepSize( size + 6 ); |
209 | 225 | ||
210 | } | 226 | } |
211 | 227 | ||
212 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) | 228 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) |
213 | { | 229 | { |
214 | #ifndef KORG_NODND | 230 | #ifndef KORG_NODND |
215 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; | 231 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; |
216 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 232 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
217 | !QTextDrag::canDecode( e ) ) { | 233 | !Q3TextDrag::canDecode( e ) ) { |
218 | e->ignore(); | 234 | e->ignore(); |
219 | return; | 235 | return; |
220 | } | 236 | } |
221 | 237 | ||
222 | mOldCurrent = currentItem(); | 238 | mOldCurrent = currentItem(); |
223 | #endif | 239 | #endif |
224 | } | 240 | } |
225 | 241 | ||
226 | 242 | ||
227 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) | 243 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) |
228 | { | 244 | { |
229 | #ifndef KORG_NODND | 245 | #ifndef KORG_NODND |
230 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; | 246 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; |
231 | 247 | ||
232 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 248 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
233 | !QTextDrag::canDecode( e ) ) { | 249 | !Q3TextDrag::canDecode( e ) ) { |
234 | e->ignore(); | 250 | e->ignore(); |
235 | return; | 251 | return; |
236 | } | 252 | } |
237 | 253 | ||
238 | e->accept(); | 254 | e->accept(); |
239 | #endif | 255 | #endif |
240 | } | 256 | } |
241 | 257 | ||
242 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) | 258 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) |
243 | { | 259 | { |
244 | #ifndef KORG_NODND | 260 | #ifndef KORG_NODND |
245 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; | 261 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; |
246 | 262 | ||
247 | setCurrentItem(mOldCurrent); | 263 | setCurrentItem(mOldCurrent); |
248 | setSelected(mOldCurrent,true); | 264 | setSelected(mOldCurrent,true); |
249 | #endif | 265 | #endif |
250 | } | 266 | } |
251 | 267 | ||
252 | void KOTodoListView::contentsDropEvent(QDropEvent *e) | 268 | void KOTodoListView::contentsDropEvent(QDropEvent *e) |
253 | { | 269 | { |
254 | #ifndef KORG_NODND | 270 | #ifndef KORG_NODND |
255 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; | 271 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; |
256 | 272 | ||
257 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 273 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
258 | !QTextDrag::canDecode( e ) ) { | 274 | !Q3TextDrag::canDecode( e ) ) { |
259 | e->ignore(); | 275 | e->ignore(); |
260 | return; | 276 | return; |
261 | } | 277 | } |
262 | 278 | ||
263 | DndFactory factory( mCalendar ); | 279 | DndFactory factory( mCalendar ); |
264 | Todo *todo = factory.createDropTodo(e); | 280 | Todo *todo = factory.createDropTodo(e); |
265 | 281 | ||
266 | if (todo) { | 282 | if (todo) { |
267 | e->acceptAction(); | 283 | e->acceptAction(); |
268 | 284 | ||
269 | KOTodoViewItem *destination = | 285 | KOTodoViewItem *destination = |
270 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); | 286 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); |
271 | Todo *destinationEvent = 0; | 287 | Todo *destinationEvent = 0; |
272 | if (destination) destinationEvent = destination->todo(); | 288 | if (destination) destinationEvent = destination->todo(); |
273 | 289 | ||
274 | Todo *existingTodo = mCalendar->todo(todo->uid()); | 290 | Todo *existingTodo = mCalendar->todo(todo->uid()); |
@@ -287,109 +303,109 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e) | |||
287 | } | 303 | } |
288 | internalDrop = true; | 304 | internalDrop = true; |
289 | if ( destinationEvent ) | 305 | if ( destinationEvent ) |
290 | reparentTodoSignal( destinationEvent, existingTodo ); | 306 | reparentTodoSignal( destinationEvent, existingTodo ); |
291 | else | 307 | else |
292 | unparentTodoSignal(existingTodo); | 308 | unparentTodoSignal(existingTodo); |
293 | delete todo; | 309 | delete todo; |
294 | } else { | 310 | } else { |
295 | mCalendar->addTodo(todo); | 311 | mCalendar->addTodo(todo); |
296 | emit todoDropped(todo, KOGlobals::EVENTADDED); | 312 | emit todoDropped(todo, KOGlobals::EVENTADDED); |
297 | if ( destinationEvent ) | 313 | if ( destinationEvent ) |
298 | reparentTodoSignal( destinationEvent, todo ); | 314 | reparentTodoSignal( destinationEvent, todo ); |
299 | } | 315 | } |
300 | } | 316 | } |
301 | else { | 317 | else { |
302 | QString text; | 318 | QString text; |
303 | if (QTextDrag::decode(e,text)) { | 319 | if (Q3TextDrag::decode(e,text)) { |
304 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); | 320 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); |
305 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); | 321 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); |
306 | qDebug("Dropped : " + text); | 322 | qDebug("Dropped : " + text); |
307 | QStringList emails = QStringList::split(",",text); | 323 | QStringList emails = QStringList::split(",",text); |
308 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 324 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
309 | int pos = (*it).find("<"); | 325 | int pos = (*it).find("<"); |
310 | QString name = (*it).left(pos); | 326 | QString name = (*it).left(pos); |
311 | QString email = (*it).mid(pos); | 327 | QString email = (*it).mid(pos); |
312 | if (!email.isEmpty() && todoi) { | 328 | if (!email.isEmpty() && todoi) { |
313 | todoi->todo()->addAttendee(new Attendee(name,email)); | 329 | todoi->todo()->addAttendee(new Attendee(name,email)); |
314 | } | 330 | } |
315 | } | 331 | } |
316 | } | 332 | } |
317 | else { | 333 | else { |
318 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); | 334 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); |
319 | e->ignore(); | 335 | e->ignore(); |
320 | } | 336 | } |
321 | } | 337 | } |
322 | #endif | 338 | #endif |
323 | } | 339 | } |
324 | void KOTodoListView::wheelEvent (QWheelEvent *e) | 340 | void KOTodoListView::wheelEvent (QWheelEvent *e) |
325 | { | 341 | { |
326 | QListView::wheelEvent (e); | 342 | Q3ListView::wheelEvent (e); |
327 | } | 343 | } |
328 | 344 | ||
329 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | 345 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) |
330 | { | 346 | { |
331 | 347 | ||
332 | QPoint p(contentsToViewport(e->pos())); | 348 | QPoint p(contentsToViewport(e->pos())); |
333 | QListViewItem *i = itemAt(p); | 349 | Q3ListViewItem *i = itemAt(p); |
334 | bool rootClicked = true; | 350 | bool rootClicked = true; |
335 | if (i) { | 351 | if (i) { |
336 | // if the user clicked into the root decoration of the item, don't | 352 | // if the user clicked into the root decoration of the item, don't |
337 | // try to start a drag! | 353 | // try to start a drag! |
338 | int X = p.x(); | 354 | int X = p.x(); |
339 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); | 355 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); |
340 | if (X > header()->sectionPos(0) + | 356 | if (X > header()->sectionPos(0) + |
341 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | 357 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + |
342 | itemMargin() +i->height()|| | 358 | itemMargin() +i->height()|| |
343 | X < header()->sectionPos(0)) { | 359 | X < header()->sectionPos(0)) { |
344 | rootClicked = false; | 360 | rootClicked = false; |
345 | } | 361 | } |
346 | } else { | 362 | } else { |
347 | rootClicked = false; | 363 | rootClicked = false; |
348 | } | 364 | } |
349 | #ifndef KORG_NODND | 365 | #ifndef KORG_NODND |
350 | mMousePressed = false; | 366 | mMousePressed = false; |
351 | if (! rootClicked && !( e->button() == RightButton) ) { | 367 | if (! rootClicked && !( e->button() == Qt::RightButton) ) { |
352 | mPressPos = e->pos(); | 368 | mPressPos = e->pos(); |
353 | mMousePressed = true; | 369 | mMousePressed = true; |
354 | } else { | 370 | } else { |
355 | mMousePressed = false; | 371 | mMousePressed = false; |
356 | } | 372 | } |
357 | #endif | 373 | #endif |
358 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); | 374 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); |
359 | #ifndef DESKTOP_VERSION | 375 | #ifndef DESKTOP_VERSION |
360 | if (!( e->button() == RightButton && rootClicked) ) | 376 | if (!( e->button() == RightButton && rootClicked) ) |
361 | QListView::contentsMousePressEvent(e); | 377 | Q3ListView::contentsMousePressEvent(e); |
362 | #else | 378 | #else |
363 | QListView::contentsMousePressEvent(e); | 379 | Q3ListView::contentsMousePressEvent(e); |
364 | #endif | 380 | #endif |
365 | } | 381 | } |
366 | void KOTodoListView::paintEvent(QPaintEvent* e) | 382 | void KOTodoListView::paintEvent(QPaintEvent* e) |
367 | { | 383 | { |
368 | emit paintNeeded(); | 384 | emit paintNeeded(); |
369 | QListView::paintEvent( e); | 385 | Q3ListView::paintEvent( e); |
370 | } | 386 | } |
371 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 387 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
372 | { | 388 | { |
373 | 389 | ||
374 | #ifndef KORG_NODND | 390 | #ifndef KORG_NODND |
375 | //QListView::contentsMouseMoveEvent(e); | 391 | //QListView::contentsMouseMoveEvent(e); |
376 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > | 392 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > |
377 | QApplication::startDragDistance()*3) { | 393 | QApplication::startDragDistance()*3) { |
378 | mMousePressed = false; | 394 | mMousePressed = false; |
379 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); | 395 | Q3ListViewItem *item = itemAt(contentsToViewport(mPressPos)); |
380 | if (item) { | 396 | if (item) { |
381 | DndFactory factory( mCalendar ); | 397 | DndFactory factory( mCalendar ); |
382 | ICalDrag *vd = factory.createDrag( | 398 | ICalDrag *vd = factory.createDrag( |
383 | ((KOTodoViewItem *)item)->todo(),viewport()); | 399 | ((KOTodoViewItem *)item)->todo(),viewport()); |
384 | internalDrop = false; | 400 | internalDrop = false; |
385 | // we cannot do any senseful here, because the DnD is still broken in Qt | 401 | // we cannot do any senseful here, because the DnD is still broken in Qt |
386 | if (vd->drag()) { | 402 | if (vd->drag()) { |
387 | if ( !internalDrop ) { | 403 | if ( !internalDrop ) { |
388 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); | 404 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); |
389 | qDebug("Dnd: External move: Delete drag source "); | 405 | qDebug("Dnd: External move: Delete drag source "); |
390 | } else | 406 | } else |
391 | qDebug("Dnd: Internal move "); | 407 | qDebug("Dnd: Internal move "); |
392 | 408 | ||
393 | } else { | 409 | } else { |
394 | if ( !internalDrop ) { | 410 | if ( !internalDrop ) { |
395 | qDebug("Dnd: External Copy"); | 411 | qDebug("Dnd: External Copy"); |
@@ -409,141 +425,141 @@ void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) | |||
409 | 425 | ||
410 | 426 | ||
411 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 427 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
412 | { | 428 | { |
413 | qApp->processEvents(); | 429 | qApp->processEvents(); |
414 | if ( !isVisible() ) { | 430 | if ( !isVisible() ) { |
415 | e->ignore(); | 431 | e->ignore(); |
416 | return; | 432 | return; |
417 | } | 433 | } |
418 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 434 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
419 | e->ignore(); | 435 | e->ignore(); |
420 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 436 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
421 | return; | 437 | return; |
422 | } | 438 | } |
423 | if (! e->isAutoRepeat() ) | 439 | if (! e->isAutoRepeat() ) |
424 | mFlagKeyPressed = true; | 440 | mFlagKeyPressed = true; |
425 | QListViewItem* cn; | 441 | Q3ListViewItem* cn; |
426 | if ( (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) && mName != "todolistsmall") { | 442 | if ( (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) && mName != "todolistsmall") { |
427 | cn = currentItem(); | 443 | cn = currentItem(); |
428 | if ( cn ) { | 444 | if ( cn ) { |
429 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 445 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
430 | if ( ci ){ | 446 | if ( ci ){ |
431 | if ( e->state() == ShiftButton ) | 447 | if ( e->state() == Qt::ShiftButton ) |
432 | ci->setOn( false ); | 448 | ci->setOn( false ); |
433 | else | 449 | else |
434 | ci->setOn( true ); | 450 | ci->setOn( true ); |
435 | cn = cn->itemBelow(); | 451 | cn = cn->itemBelow(); |
436 | if ( cn ) { | 452 | if ( cn ) { |
437 | setCurrentItem ( cn ); | 453 | setCurrentItem ( cn ); |
438 | ensureItemVisible ( cn ); | 454 | ensureItemVisible ( cn ); |
439 | } | 455 | } |
440 | 456 | ||
441 | } | 457 | } |
442 | } | 458 | } |
443 | 459 | ||
444 | e->accept(); | 460 | e->accept(); |
445 | return; | 461 | return; |
446 | } | 462 | } |
447 | 463 | ||
448 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 464 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
449 | switch ( e->key() ) { | 465 | switch ( e->key() ) { |
450 | case Qt::Key_Down: | 466 | case Qt::Key_Down: |
451 | case Qt::Key_Up: | 467 | case Qt::Key_Up: |
452 | QListView::keyPressEvent ( e ); | 468 | Q3ListView::keyPressEvent ( e ); |
453 | e->accept(); | 469 | e->accept(); |
454 | break; | 470 | break; |
455 | case Qt::Key_Left: | 471 | case Qt::Key_Left: |
456 | case Qt::Key_Right: | 472 | case Qt::Key_Right: |
457 | QListView::keyPressEvent ( e ); | 473 | Q3ListView::keyPressEvent ( e ); |
458 | e->accept(); | 474 | e->accept(); |
459 | return; | 475 | return; |
460 | break; | 476 | break; |
461 | default: | 477 | default: |
462 | e->ignore(); | 478 | e->ignore(); |
463 | break; | 479 | break; |
464 | } | 480 | } |
465 | return; | 481 | return; |
466 | } | 482 | } |
467 | e->ignore(); | 483 | e->ignore(); |
468 | } | 484 | } |
469 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 485 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
470 | { | 486 | { |
471 | QListView::contentsMouseReleaseEvent(e); | 487 | Q3ListView::contentsMouseReleaseEvent(e); |
472 | mMousePressed = false; | 488 | mMousePressed = false; |
473 | } | 489 | } |
474 | 490 | ||
475 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 491 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
476 | { | 492 | { |
477 | if (!e) return; | 493 | if (!e) return; |
478 | 494 | ||
479 | QPoint vp = contentsToViewport(e->pos()); | 495 | QPoint vp = contentsToViewport(e->pos()); |
480 | 496 | ||
481 | QListViewItem *item = itemAt(vp); | 497 | Q3ListViewItem *item = itemAt(vp); |
482 | 498 | ||
483 | emit double_Clicked(item); | 499 | emit double_Clicked(item); |
484 | if (!item) return; | 500 | if (!item) return; |
485 | 501 | ||
486 | emit doubleClicked(item,vp,0); | 502 | emit doubleClicked(item,vp,0); |
487 | } | 503 | } |
488 | 504 | ||
489 | ///////////////////////////////////////////////////////////////////////////// | 505 | ///////////////////////////////////////////////////////////////////////////// |
490 | 506 | ||
491 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 507 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
492 | QLineEdit(parent) | 508 | QLineEdit(parent) |
493 | { | 509 | { |
494 | setText(i18n("Click to add new Todo")); | 510 | setText(i18n("Click to add new Todo")); |
495 | setFocusPolicy ( QWidget::ClickFocus ); | 511 | setFocusPolicy ( Qt::ClickFocus ); |
496 | } | 512 | } |
497 | 513 | ||
498 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 514 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
499 | { | 515 | { |
500 | if ( text()==i18n("Click to add new Todo") ) | 516 | if ( text()==i18n("Click to add new Todo") ) |
501 | setText(""); | 517 | setText(""); |
502 | QLineEdit::focusInEvent(ev); | 518 | QLineEdit::focusInEvent(ev); |
503 | } | 519 | } |
504 | 520 | ||
505 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 521 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
506 | { | 522 | { |
507 | setText(i18n("Click to add new Todo")); | 523 | setText(i18n("Click to add new Todo")); |
508 | QLineEdit::focusOutEvent(ev); | 524 | QLineEdit::focusOutEvent(ev); |
509 | } | 525 | } |
510 | 526 | ||
511 | ///////////////////////////////////////////////////////////////////////////// | 527 | ///////////////////////////////////////////////////////////////////////////// |
512 | 528 | ||
513 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 529 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
514 | KOrg::BaseView(calendar,parent,name) | 530 | KOrg::BaseView(calendar,parent,name) |
515 | { | 531 | { |
516 | mIsActiveWindow = false; | 532 | mIsActiveWindow = false; |
517 | mCurItem = 0; | 533 | mCurItem = 0; |
518 | mCurItemRootParent = 0; | 534 | mCurItemRootParent = 0; |
519 | mCurItemParent = 0; | 535 | mCurItemParent = 0; |
520 | mCurItemAbove = 0; | 536 | mCurItemAbove = 0; |
521 | mActiveItem = 0; | 537 | mActiveItem = 0; |
522 | mCategoryPopupMenu = 0; | 538 | mCategoryPopupMenu = 0; |
523 | mPendingUpdateBeforeRepaint = false; | 539 | mPendingUpdateBeforeRepaint = false; |
524 | isFlatDisplay = false; | 540 | isFlatDisplay = false; |
525 | mNavigator = 0; | 541 | mNavigator = 0; |
526 | QBoxLayout *topLayout = new QVBoxLayout(this); | 542 | Q3BoxLayout *topLayout = new Q3VBoxLayout(this); |
527 | mName = QString ( name ); | 543 | mName = QString ( name ); |
528 | mBlockUpdate = false; | 544 | mBlockUpdate = false; |
529 | mQuickBar = new QWidget( this ); | 545 | mQuickBar = new QWidget( this ); |
530 | topLayout->addWidget(mQuickBar); | 546 | topLayout->addWidget(mQuickBar); |
531 | 547 | ||
532 | mQuickAdd = new KOQuickTodo(mQuickBar); | 548 | mQuickAdd = new KOQuickTodo(mQuickBar); |
533 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); | 549 | Q3BoxLayout *quickLayout = new Q3HBoxLayout(mQuickBar); |
534 | quickLayout->addWidget( mQuickAdd ); | 550 | quickLayout->addWidget( mQuickAdd ); |
535 | mNewSubBut = new QPushButton( "sub",mQuickBar ); | 551 | mNewSubBut = new QPushButton( "sub",mQuickBar ); |
536 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); | 552 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); |
537 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); | 553 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); |
538 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); | 554 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); |
539 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); | 555 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); |
540 | QPushButton * flat = new QPushButton( "F",mQuickBar ); | 556 | QPushButton * flat = new QPushButton( "F",mQuickBar ); |
541 | 557 | ||
542 | int fixwid = mQuickAdd->sizeHint().height(); | 558 | int fixwid = mQuickAdd->sizeHint().height(); |
543 | int fixhei = fixwid; | 559 | int fixhei = fixwid; |
544 | if ( QApplication::desktop()->width() > 800 ) | 560 | if ( QApplication::desktop()->width() > 800 ) |
545 | fixwid = (fixwid*3)/2; | 561 | fixwid = (fixwid*3)/2; |
546 | connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); | 562 | connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); |
547 | connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); | 563 | connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); |
548 | connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); | 564 | connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); |
549 | s_done->setPixmap( SmallIcon("greenhook16")); | 565 | s_done->setPixmap( SmallIcon("greenhook16")); |
@@ -555,130 +571,130 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
555 | 571 | ||
556 | mNewSubBut->setFixedWidth(mNewSubBut->sizeHint().width() ); | 572 | mNewSubBut->setFixedWidth(mNewSubBut->sizeHint().width() ); |
557 | mNewSubBut->setEnabled( false ); | 573 | mNewSubBut->setEnabled( false ); |
558 | flat->setFixedWidth( fixwid ); | 574 | flat->setFixedWidth( fixwid ); |
559 | s_done->setFixedWidth( fixwid ); | 575 | s_done->setFixedWidth( fixwid ); |
560 | allopen->setFixedWidth( fixwid ); | 576 | allopen->setFixedWidth( fixwid ); |
561 | allclose->setFixedWidth( fixwid ); | 577 | allclose->setFixedWidth( fixwid ); |
562 | s_run->setFixedWidth( fixwid ); | 578 | s_run->setFixedWidth( fixwid ); |
563 | 579 | ||
564 | flat->setFixedHeight(fixhei ); | 580 | flat->setFixedHeight(fixhei ); |
565 | s_done->setFixedHeight(fixhei ); | 581 | s_done->setFixedHeight(fixhei ); |
566 | allopen->setFixedHeight(fixhei ); | 582 | allopen->setFixedHeight(fixhei ); |
567 | allclose->setFixedHeight(fixhei ); | 583 | allclose->setFixedHeight(fixhei ); |
568 | s_run->setFixedHeight(fixhei ); | 584 | s_run->setFixedHeight(fixhei ); |
569 | mNewSubBut->setFixedHeight(fixhei ); | 585 | mNewSubBut->setFixedHeight(fixhei ); |
570 | 586 | ||
571 | flat->setFocusPolicy( NoFocus ); | 587 | flat->setFocusPolicy( Qt::NoFocus ); |
572 | s_done->setFocusPolicy( NoFocus ); | 588 | s_done->setFocusPolicy( Qt::NoFocus ); |
573 | allopen->setFocusPolicy( NoFocus ); | 589 | allopen->setFocusPolicy( Qt::NoFocus ); |
574 | allclose->setFocusPolicy( NoFocus ); | 590 | allclose->setFocusPolicy( Qt::NoFocus ); |
575 | s_run->setFocusPolicy( NoFocus ); | 591 | s_run->setFocusPolicy( Qt::NoFocus ); |
576 | mNewSubBut->setFocusPolicy( NoFocus ); | 592 | mNewSubBut->setFocusPolicy( Qt::NoFocus ); |
577 | 593 | ||
578 | QWhatsThis::add( flat, i18n("Click this button to display all todos in a <b>flat</b> hierarchy" ) ); | 594 | Q3WhatsThis::add( flat, i18n("Click this button to display all todos in a <b>flat</b> hierarchy" ) ); |
579 | QWhatsThis::add( allopen, i18n("Click this button to display all todos <b>openend</b>" ) ); | 595 | Q3WhatsThis::add( allopen, i18n("Click this button to display all todos <b>openend</b>" ) ); |
580 | QWhatsThis::add( allclose, i18n("Click this button to display all todos <b>closed</b>" ) ); | 596 | Q3WhatsThis::add( allclose, i18n("Click this button to display all todos <b>closed</b>" ) ); |
581 | QWhatsThis::add( s_run, i18n("Click this button to toggle show/hide <b>running</b> todos" ) ); | 597 | Q3WhatsThis::add( s_run, i18n("Click this button to toggle show/hide <b>running</b> todos" ) ); |
582 | QWhatsThis::add( mNewSubBut, i18n("Click this button to add a new subtodo to the currently selected todo" ) ); | 598 | Q3WhatsThis::add( mNewSubBut, i18n("Click this button to add a new subtodo to the currently selected todo" ) ); |
583 | QWhatsThis::add( s_done, i18n("Click this button to toggle show/hide <b>completed</b> todos" ) ); | 599 | Q3WhatsThis::add( s_done, i18n("Click this button to toggle show/hide <b>completed</b> todos" ) ); |
584 | 600 | ||
585 | quickLayout->addWidget( mNewSubBut ); | 601 | quickLayout->addWidget( mNewSubBut ); |
586 | quickLayout->addWidget( s_done ); | 602 | quickLayout->addWidget( s_done ); |
587 | quickLayout->addWidget( s_run ); | 603 | quickLayout->addWidget( s_run ); |
588 | quickLayout->addWidget( allopen ); | 604 | quickLayout->addWidget( allopen ); |
589 | quickLayout->addWidget( allclose ); | 605 | quickLayout->addWidget( allclose ); |
590 | quickLayout->addWidget( flat ); | 606 | quickLayout->addWidget( flat ); |
591 | 607 | ||
592 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); | 608 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); |
593 | 609 | ||
594 | mTodoListView = new KOTodoListView(calendar,this, name ); | 610 | mTodoListView = new KOTodoListView(calendar,this, name ); |
595 | topLayout->addWidget(mTodoListView); | 611 | topLayout->addWidget(mTodoListView); |
596 | //mTodoListView->header()->setMaximumHeight(30); | 612 | //mTodoListView->header()->setMaximumHeight(30); |
597 | mTodoListView->setRootIsDecorated(true); | 613 | mTodoListView->setRootIsDecorated(true); |
598 | mTodoListView->setAllColumnsShowFocus(true); | 614 | mTodoListView->setAllColumnsShowFocus(true); |
599 | 615 | ||
600 | mTodoListView->setShowSortIndicator(true); | 616 | mTodoListView->setShowSortIndicator(true); |
601 | 617 | ||
602 | mTodoListView->addColumn(i18n("Todo")); | 618 | mTodoListView->addColumn(i18n("Todo")); |
603 | mTodoListView->addColumn(i18n("Prio")); | 619 | mTodoListView->addColumn(i18n("Prio")); |
604 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 620 | mTodoListView->setColumnAlignment(1,Qt::AlignHCenter); |
605 | mTodoListView->addColumn(i18n("Complete")); | 621 | mTodoListView->addColumn(i18n("Complete")); |
606 | mTodoListView->setColumnAlignment(2,AlignCenter); | 622 | mTodoListView->setColumnAlignment(2,Qt::AlignCenter); |
607 | 623 | ||
608 | mTodoListView->addColumn(i18n("Due Date")); | 624 | mTodoListView->addColumn(i18n("Due Date")); |
609 | mTodoListView->setColumnAlignment(3,AlignLeft); | 625 | mTodoListView->setColumnAlignment(3,Qt::AlignLeft); |
610 | mTodoListView->addColumn(i18n("Due Time")); | 626 | mTodoListView->addColumn(i18n("Due Time")); |
611 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 627 | mTodoListView->setColumnAlignment(4,Qt::AlignHCenter); |
612 | 628 | ||
613 | mTodoListView->addColumn(i18n("Start Date")); | 629 | mTodoListView->addColumn(i18n("Start Date")); |
614 | mTodoListView->setColumnAlignment(5,AlignLeft); | 630 | mTodoListView->setColumnAlignment(5,Qt::AlignLeft); |
615 | mTodoListView->addColumn(i18n("Start Time")); | 631 | mTodoListView->addColumn(i18n("Start Time")); |
616 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 632 | mTodoListView->setColumnAlignment(6,Qt::AlignHCenter); |
617 | 633 | ||
618 | //mTodoListView->addColumn(i18n("Cancelled")); | 634 | //mTodoListView->addColumn(i18n("Cancelled")); |
619 | mTodoListView->addColumn(i18n("Categories")); | 635 | mTodoListView->addColumn(i18n("Categories")); |
620 | mTodoListView->addColumn(i18n("Calendar")); | 636 | mTodoListView->addColumn(i18n("Calendar")); |
621 | mTodoListView->addColumn(i18n("Last Modified")); | 637 | mTodoListView->addColumn(i18n("Last Modified")); |
622 | mTodoListView->addColumn(i18n("Created")); | 638 | mTodoListView->addColumn(i18n("Created")); |
623 | mTodoListView->addColumn(i18n("Last Modified Sub")); | 639 | mTodoListView->addColumn(i18n("Last Modified Sub")); |
624 | #if 0 | 640 | #if 0 |
625 | mTodoListView->addColumn(i18n("Sort Id")); | 641 | mTodoListView->addColumn(i18n("Sort Id")); |
626 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 642 | mTodoListView->setColumnAlignment(4,Qt::AlignHCenter); |
627 | #endif | 643 | #endif |
628 | 644 | ||
629 | mTodoListView->setMinimumHeight( 60 ); | 645 | mTodoListView->setMinimumHeight( 60 ); |
630 | mTodoListView->setItemsRenameable( true ); | 646 | mTodoListView->setItemsRenameable( true ); |
631 | mTodoListView->setRenameable( 0 ); | 647 | mTodoListView->setRenameable( 0 ); |
632 | mTodoListView->setColumnWidth( 0, 120 ); | 648 | mTodoListView->setColumnWidth( 0, 120 ); |
633 | int iii = 0; | 649 | int iii = 0; |
634 | for ( iii = 0; iii< 12 ; ++iii ) | 650 | for ( iii = 0; iii< 12 ; ++iii ) |
635 | mTodoListView->setColumnWidthMode( iii, QListView::Manual ); | 651 | mTodoListView->setColumnWidthMode( iii, Q3ListView::Manual ); |
636 | 652 | ||
637 | 653 | ||
638 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | 654 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); |
639 | 655 | ||
640 | mPriorityPopupMenu = new QPopupMenu(this); | 656 | mPriorityPopupMenu = new Q3PopupMenu(this); |
641 | for (int i = 1; i <= 5; i++) { | 657 | for (int i = 1; i <= 5; i++) { |
642 | QString label = QString ("%1").arg (i); | 658 | QString label = QString ("%1").arg (i); |
643 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 659 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
644 | } | 660 | } |
645 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 661 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
646 | 662 | ||
647 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 663 | mPercentageCompletedPopupMenu = new Q3PopupMenu(this); |
648 | for (int i = 0; i <= 100; i+=20) { | 664 | for (int i = 0; i <= 100; i+=20) { |
649 | QString label = QString ("%1 %").arg (i); | 665 | QString label = QString ("%1 %").arg (i); |
650 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 666 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
651 | } | 667 | } |
652 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 668 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
653 | 669 | ||
654 | 670 | ||
655 | mCategoryPopupMenu = new QPopupMenu (this); | 671 | mCategoryPopupMenu = new Q3PopupMenu (this); |
656 | mCategoryPopupMenu->setCheckable (true); | 672 | mCategoryPopupMenu->setCheckable (true); |
657 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 673 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
658 | connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); | 674 | connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); |
659 | 675 | ||
660 | mCalPopupMenu = new QPopupMenu (this); | 676 | mCalPopupMenu = new Q3PopupMenu (this); |
661 | mCalPopupMenu->setCheckable (true); | 677 | mCalPopupMenu->setCheckable (true); |
662 | connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); | 678 | connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); |
663 | connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); | 679 | connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); |
664 | 680 | ||
665 | 681 | ||
666 | 682 | ||
667 | 683 | ||
668 | mItemPopupMenu = new QPopupMenu(this); | 684 | mItemPopupMenu = new Q3PopupMenu(this); |
669 | mItemPopupMenu->insertItem(i18n("Show"), this, | 685 | mItemPopupMenu->insertItem(i18n("Show"), this, |
670 | SLOT (showTodo())); | 686 | SLOT (showTodo())); |
671 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 687 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
672 | SLOT (editTodo())); | 688 | SLOT (editTodo())); |
673 | mItemPopupMenu->insertItem( i18n("Delete..."), this, | 689 | mItemPopupMenu->insertItem( i18n("Delete..."), this, |
674 | SLOT (deleteTodo())); | 690 | SLOT (deleteTodo())); |
675 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 691 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
676 | SLOT (cloneTodo())); | 692 | SLOT (cloneTodo())); |
677 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 693 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
678 | SLOT (moveTodo())); | 694 | SLOT (moveTodo())); |
679 | #ifndef DESKTOP_VERSION | 695 | #ifndef DESKTOP_VERSION |
680 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 696 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
681 | SLOT (beamTodo())); | 697 | SLOT (beamTodo())); |
682 | #endif | 698 | #endif |
683 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 699 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
684 | SLOT (cancelTodo())); | 700 | SLOT (cancelTodo())); |
@@ -697,33 +713,33 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
697 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 713 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
698 | SLOT (unparentTodo()),0,21); | 714 | SLOT (unparentTodo()),0,21); |
699 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 715 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
700 | SLOT (reparentTodo()),0,22); | 716 | SLOT (reparentTodo()),0,22); |
701 | mItemPopupMenu->insertSeparator(); | 717 | mItemPopupMenu->insertSeparator(); |
702 | #if 0 | 718 | #if 0 |
703 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed..."), | 719 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed..."), |
704 | this, SLOT( purgeCompleted() ) ); | 720 | this, SLOT( purgeCompleted() ) ); |
705 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 721 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
706 | this, SLOT( toggleCompleted() ),0, 33 ); | 722 | this, SLOT( toggleCompleted() ),0, 33 ); |
707 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 723 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
708 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 724 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
709 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 725 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
710 | this, SLOT( toggleRunning() ),0, 35 ); | 726 | this, SLOT( toggleRunning() ),0, 35 ); |
711 | 727 | ||
712 | #endif | 728 | #endif |
713 | mPopupMenu = new QPopupMenu(this); | 729 | mPopupMenu = new Q3PopupMenu(this); |
714 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 730 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
715 | SLOT (newTodo()),0,1); | 731 | SLOT (newTodo()),0,1); |
716 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."), | 732 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."), |
717 | this, SLOT(purgeCompleted()),0,2); | 733 | this, SLOT(purgeCompleted()),0,2); |
718 | mPopupMenu->insertItem(i18n("Show Completed"), | 734 | mPopupMenu->insertItem(i18n("Show Completed"), |
719 | this, SLOT( toggleCompleted() ),0,3 ); | 735 | this, SLOT( toggleCompleted() ),0,3 ); |
720 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 736 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
721 | this, SLOT( toggleRunning() ),0,5 ); | 737 | this, SLOT( toggleRunning() ),0,5 ); |
722 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 738 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
723 | this, SLOT( setAllOpen() ),0,6 ); | 739 | this, SLOT( setAllOpen() ),0,6 ); |
724 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 740 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
725 | this, SLOT( setAllClose() ),0,7 ); | 741 | this, SLOT( setAllClose() ),0,7 ); |
726 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 742 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
727 | this, SLOT( setAllFlat() ),0,8 ); | 743 | this, SLOT( setAllFlat() ),0,8 ); |
728 | mPopupMenu->insertSeparator(); | 744 | mPopupMenu->insertSeparator(); |
729 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 745 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
@@ -733,64 +749,64 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
733 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 749 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
734 | mPopupMenu->setCheckable( true ); | 750 | mPopupMenu->setCheckable( true ); |
735 | mItemPopupMenu->setCheckable( true ); | 751 | mItemPopupMenu->setCheckable( true ); |
736 | 752 | ||
737 | 753 | ||
738 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 754 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
739 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 755 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
740 | 756 | ||
741 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 757 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
742 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 758 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
743 | 759 | ||
744 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 760 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
745 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 761 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
746 | 762 | ||
747 | 763 | ||
748 | // Double clicking conflicts with opening/closing the subtree | 764 | // Double clicking conflicts with opening/closing the subtree |
749 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 765 | connect( mTodoListView, SIGNAL( doubleClicked( Q3ListViewItem *) ), |
750 | SLOT( editItem( QListViewItem *) ) ); | 766 | SLOT( editItem( Q3ListViewItem *) ) ); |
751 | /* | 767 | /* |
752 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 768 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
753 | const QPoint &,int ) ), | 769 | const QPoint &,int ) ), |
754 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 770 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
755 | */ | 771 | */ |
756 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 772 | connect( mTodoListView, SIGNAL( contextRequest ( Q3ListViewItem *, |
757 | const QPoint &,int ) ), | 773 | const QPoint &,int ) ), |
758 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 774 | SLOT( popupMenu( Q3ListViewItem *, const QPoint & ,int) ) ); |
759 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 775 | connect( mTodoListView, SIGNAL( clicked( Q3ListViewItem * ) ), |
760 | SLOT( itemClicked( QListViewItem * ) ) ); | 776 | SLOT( itemClicked( Q3ListViewItem * ) ) ); |
761 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 777 | connect( mTodoListView, SIGNAL( double_Clicked( Q3ListViewItem * ) ), |
762 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 778 | SLOT( itemDoubleClicked( Q3ListViewItem * ) ) ); |
763 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 779 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
764 | SLOT( updateView() ) ); | 780 | SLOT( updateView() ) ); |
765 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 781 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
766 | SLOT( todoModified(Todo *, int) ) ); | 782 | SLOT( todoModified(Todo *, int) ) ); |
767 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 783 | connect( mTodoListView, SIGNAL( expanded( Q3ListViewItem * ) ), |
768 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 784 | SLOT( itemStateChanged( Q3ListViewItem * ) ) ); |
769 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 785 | connect( mTodoListView, SIGNAL( collapsed( Q3ListViewItem * ) ), |
770 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 786 | SLOT( itemStateChanged( Q3ListViewItem * ) ) ); |
771 | connect( mTodoListView, SIGNAL( paintNeeded() ), | 787 | connect( mTodoListView, SIGNAL( paintNeeded() ), |
772 | SLOT( paintNeeded()) ); | 788 | SLOT( paintNeeded()) ); |
773 | 789 | ||
774 | #if 0 | 790 | #if 0 |
775 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 791 | connect(mTodoListView,SIGNAL(selectionChanged(Q3ListViewItem *)), |
776 | SLOT(selectionChanged(QListViewItem *))); | 792 | SLOT(selectionChanged(Q3ListViewItem *))); |
777 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 793 | connect(mTodoListView,SIGNAL(clicked(Q3ListViewItem *)), |
778 | SLOT(selectionChanged(QListViewItem *))); | 794 | SLOT(selectionChanged(Q3ListViewItem *))); |
779 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 795 | connect(mTodoListView,SIGNAL(pressed(Q3ListViewItem *)), |
780 | SLOT(selectionChanged(QListViewItem *))); | 796 | SLOT(selectionChanged(Q3ListViewItem *))); |
781 | #endif | 797 | #endif |
782 | 798 | ||
783 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | 799 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); |
784 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | 800 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); |
785 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | 801 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); |
786 | 802 | ||
787 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 803 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
788 | SLOT( processSelectionChange() ) ); | 804 | SLOT( processSelectionChange() ) ); |
789 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 805 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
790 | SLOT( addQuickTodo() ) ); | 806 | SLOT( addQuickTodo() ) ); |
791 | 807 | ||
792 | } | 808 | } |
793 | 809 | ||
794 | KOTodoView::~KOTodoView() | 810 | KOTodoView::~KOTodoView() |
795 | { | 811 | { |
796 | 812 | ||
@@ -868,33 +884,33 @@ void KOTodoView::updateView() | |||
868 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 884 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
869 | 885 | ||
870 | clearList (); | 886 | clearList (); |
871 | 887 | ||
872 | if ( mName == "todolistsmall" ) { | 888 | if ( mName == "todolistsmall" ) { |
873 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 889 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
874 | int ps = fo.pointSize() -2; | 890 | int ps = fo.pointSize() -2; |
875 | if ( ps > 12 ) | 891 | if ( ps > 12 ) |
876 | ps -= 2; | 892 | ps -= 2; |
877 | fo.setPointSize( ps ); | 893 | fo.setPointSize( ps ); |
878 | } | 894 | } |
879 | } | 895 | } |
880 | 896 | ||
881 | mTodoListView->setFont( fo ); | 897 | mTodoListView->setFont( fo ); |
882 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 898 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
883 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 899 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
884 | QPtrList<Todo> todoList = calendar()->todos(); | 900 | Q3PtrList<Todo> todoList = calendar()->todos(); |
885 | 901 | ||
886 | /* | 902 | /* |
887 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 903 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
888 | Event *t; | 904 | Event *t; |
889 | for(t = todoList.first(); t; t = todoList.next()) { | 905 | for(t = todoList.first(); t; t = todoList.next()) { |
890 | kdDebug() << " " << t->getSummary() << endl; | 906 | kdDebug() << " " << t->getSummary() << endl; |
891 | 907 | ||
892 | if (t->getRelatedTo()) { | 908 | if (t->getRelatedTo()) { |
893 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 909 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
894 | } | 910 | } |
895 | 911 | ||
896 | QPtrList<Event> l = t->getRelations(); | 912 | QPtrList<Event> l = t->getRelations(); |
897 | Event *c; | 913 | Event *c; |
898 | for(c=l.first();c;c=l.next()) { | 914 | for(c=l.first();c;c=l.next()) { |
899 | kdDebug() << " - relation: " << c->getSummary() << endl; | 915 | kdDebug() << " - relation: " << c->getSummary() << endl; |
900 | } | 916 | } |
@@ -1031,33 +1047,33 @@ bool KOTodoView::checkTodo( Todo * todo ) | |||
1031 | return false; | 1047 | return false; |
1032 | if ( !todo->isCompleted() ) { | 1048 | if ( !todo->isCompleted() ) { |
1033 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) | 1049 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) |
1034 | return true; | 1050 | return true; |
1035 | } | 1051 | } |
1036 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { | 1052 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { |
1037 | if ( todo->hasStartDate() ) | 1053 | if ( todo->hasStartDate() ) |
1038 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) | 1054 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) |
1039 | return false; | 1055 | return false; |
1040 | if ( todo->hasDueDate() ) | 1056 | if ( todo->hasDueDate() ) |
1041 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) | 1057 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) |
1042 | return false; | 1058 | return false; |
1043 | } | 1059 | } |
1044 | return true; | 1060 | return true; |
1045 | } | 1061 | } |
1046 | 1062 | ||
1047 | void KOTodoView::restoreItemState( QListViewItem *item ) | 1063 | void KOTodoView::restoreItemState( Q3ListViewItem *item ) |
1048 | { | 1064 | { |
1049 | pendingSubtodo = 0; | 1065 | pendingSubtodo = 0; |
1050 | while( item ) { | 1066 | while( item ) { |
1051 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1067 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1052 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 1068 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
1053 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 1069 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
1054 | item = item->nextSibling(); | 1070 | item = item->nextSibling(); |
1055 | } | 1071 | } |
1056 | } | 1072 | } |
1057 | 1073 | ||
1058 | 1074 | ||
1059 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 1075 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
1060 | KOTodoView::insertTodoItem(Todo *todo) | 1076 | KOTodoView::insertTodoItem(Todo *todo) |
1061 | { | 1077 | { |
1062 | 1078 | ||
1063 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 1079 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
@@ -1083,89 +1099,89 @@ KOTodoView::insertTodoItem(Todo *todo) | |||
1083 | return mTodoMap.insert(todo,todoItem); | 1099 | return mTodoMap.insert(todo,todoItem); |
1084 | } else { | 1100 | } else { |
1085 | // kdDebug() << " no Related" << endl; | 1101 | // kdDebug() << " no Related" << endl; |
1086 | // see above -zecke | 1102 | // see above -zecke |
1087 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1103 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1088 | return mTodoMap.insert(todo,todoItem); | 1104 | return mTodoMap.insert(todo,todoItem); |
1089 | } | 1105 | } |
1090 | } | 1106 | } |
1091 | 1107 | ||
1092 | 1108 | ||
1093 | void KOTodoView::updateConfig() | 1109 | void KOTodoView::updateConfig() |
1094 | { | 1110 | { |
1095 | updateView(); | 1111 | updateView(); |
1096 | mTodoListView->repaintContents(); | 1112 | mTodoListView->repaintContents(); |
1097 | } | 1113 | } |
1098 | 1114 | ||
1099 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 1115 | Q3PtrList<Incidence> KOTodoView::selectedIncidences() |
1100 | { | 1116 | { |
1101 | QPtrList<Incidence> selected; | 1117 | Q3PtrList<Incidence> selected; |
1102 | 1118 | ||
1103 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 1119 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
1104 | // if (!item) item = mActiveItem; | 1120 | // if (!item) item = mActiveItem; |
1105 | if (item) selected.append(item->todo()); | 1121 | if (item) selected.append(item->todo()); |
1106 | 1122 | ||
1107 | return selected; | 1123 | return selected; |
1108 | } | 1124 | } |
1109 | 1125 | ||
1110 | QPtrList<Todo> KOTodoView::selectedTodos() | 1126 | Q3PtrList<Todo> KOTodoView::selectedTodos() |
1111 | { | 1127 | { |
1112 | QPtrList<Todo> selected; | 1128 | Q3PtrList<Todo> selected; |
1113 | 1129 | ||
1114 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 1130 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
1115 | // if (!item) item = mActiveItem; | 1131 | // if (!item) item = mActiveItem; |
1116 | if (item) selected.append(item->todo()); | 1132 | if (item) selected.append(item->todo()); |
1117 | 1133 | ||
1118 | return selected; | 1134 | return selected; |
1119 | } | 1135 | } |
1120 | 1136 | ||
1121 | void KOTodoView::changeEventDisplay(Event *, int) | 1137 | void KOTodoView::changeEventDisplay(Event *, int) |
1122 | { | 1138 | { |
1123 | updateView(); | 1139 | updateView(); |
1124 | } | 1140 | } |
1125 | 1141 | ||
1126 | void KOTodoView::showDates(const QDate &, const QDate &) | 1142 | void KOTodoView::showDates(const QDate &, const QDate &) |
1127 | { | 1143 | { |
1128 | } | 1144 | } |
1129 | 1145 | ||
1130 | void KOTodoView::showEvents(QPtrList<Event>) | 1146 | void KOTodoView::showEvents(Q3PtrList<Event>) |
1131 | { | 1147 | { |
1132 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; | 1148 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; |
1133 | } | 1149 | } |
1134 | 1150 | ||
1135 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1151 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1136 | const QDate &td) | 1152 | const QDate &td) |
1137 | { | 1153 | { |
1138 | #ifndef KORG_NOPRINTER | 1154 | #ifndef KORG_NOPRINTER |
1139 | calPrinter->preview(CalPrinter::Todolist, fd, td); | 1155 | calPrinter->preview(CalPrinter::Todolist, fd, td); |
1140 | #endif | 1156 | #endif |
1141 | } | 1157 | } |
1142 | 1158 | ||
1143 | void KOTodoView::editItem(QListViewItem *item ) | 1159 | void KOTodoView::editItem(Q3ListViewItem *item ) |
1144 | { | 1160 | { |
1145 | if ( item ) | 1161 | if ( item ) |
1146 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); | 1162 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); |
1147 | } | 1163 | } |
1148 | 1164 | ||
1149 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 1165 | void KOTodoView::showItem(Q3ListViewItem *item,const QPoint &,int) |
1150 | { | 1166 | { |
1151 | if ( item ) | 1167 | if ( item ) |
1152 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); | 1168 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); |
1153 | } | 1169 | } |
1154 | 1170 | ||
1155 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) | 1171 | void KOTodoView::popupMenu(Q3ListViewItem *item,const QPoint &p,int column) |
1156 | { | 1172 | { |
1157 | pendingSubtodo = 0; | 1173 | pendingSubtodo = 0; |
1158 | mActiveItem = (KOTodoViewItem *)item; | 1174 | mActiveItem = (KOTodoViewItem *)item; |
1159 | if (item) { | 1175 | if (item) { |
1160 | switch (column){ | 1176 | switch (column){ |
1161 | case 1: | 1177 | case 1: |
1162 | mPriorityPopupMenu->popup(QCursor::pos ()); break; | 1178 | mPriorityPopupMenu->popup(QCursor::pos ()); break; |
1163 | case 2: | 1179 | case 2: |
1164 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; | 1180 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; |
1165 | case 3: | 1181 | case 3: |
1166 | moveTodo(); | 1182 | moveTodo(); |
1167 | break; | 1183 | break; |
1168 | case 7: | 1184 | case 7: |
1169 | mCategoryPopupMenu->popup(QCursor::pos ()); break; | 1185 | mCategoryPopupMenu->popup(QCursor::pos ()); break; |
1170 | case 8: | 1186 | case 8: |
1171 | mCalPopupMenu->popup(QCursor::pos ()); break; | 1187 | mCalPopupMenu->popup(QCursor::pos ()); break; |
@@ -1348,33 +1364,33 @@ void KOTodoView::toggleRunningItemQuick() | |||
1348 | if ( t->isRunning() ) { | 1364 | if ( t->isRunning() ) { |
1349 | if ( t->runTime() < 15) { | 1365 | if ( t->runTime() < 15) { |
1350 | t->stopRunning(); | 1366 | t->stopRunning(); |
1351 | mActiveItem->construct(); | 1367 | mActiveItem->construct(); |
1352 | topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); | 1368 | topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); |
1353 | return; | 1369 | return; |
1354 | } | 1370 | } |
1355 | else | 1371 | else |
1356 | toggleRunningItem(); | 1372 | toggleRunningItem(); |
1357 | return; | 1373 | return; |
1358 | } else { | 1374 | } else { |
1359 | t->setRunning( true ); | 1375 | t->setRunning( true ); |
1360 | mActiveItem->construct(); | 1376 | mActiveItem->construct(); |
1361 | topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); | 1377 | topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); |
1362 | } | 1378 | } |
1363 | } | 1379 | } |
1364 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 1380 | void KOTodoView::itemDoubleClicked(Q3ListViewItem *item) |
1365 | { | 1381 | { |
1366 | if ( pendingSubtodo != 0 ) { | 1382 | if ( pendingSubtodo != 0 ) { |
1367 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1383 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1368 | } | 1384 | } |
1369 | pendingSubtodo = 0; | 1385 | pendingSubtodo = 0; |
1370 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); | 1386 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); |
1371 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); | 1387 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); |
1372 | //qDebug("ROW %d ", row); | 1388 | //qDebug("ROW %d ", row); |
1373 | if (!item) { | 1389 | if (!item) { |
1374 | newTodo(); | 1390 | newTodo(); |
1375 | return; | 1391 | return; |
1376 | } else { | 1392 | } else { |
1377 | if ( row == 1 ) { | 1393 | if ( row == 1 ) { |
1378 | mActiveItem = (KOTodoViewItem *) item; | 1394 | mActiveItem = (KOTodoViewItem *) item; |
1379 | newSubTodo(); | 1395 | newSubTodo(); |
1380 | return; | 1396 | return; |
@@ -1415,74 +1431,74 @@ void KOTodoView::toggleRunningItem() | |||
1415 | int xx = (QApplication::desktop()->width()-wid)/2; | 1431 | int xx = (QApplication::desktop()->width()-wid)/2; |
1416 | int yy = (QApplication::desktop()->height()-hei)/2; | 1432 | int yy = (QApplication::desktop()->height()-hei)/2; |
1417 | tp.setGeometry( xx,yy,wid,hei ); | 1433 | tp.setGeometry( xx,yy,wid,hei ); |
1418 | } | 1434 | } |
1419 | if ( !tp.exec() ) return; | 1435 | if ( !tp.exec() ) return; |
1420 | if ( tp.stopAll() ) { | 1436 | if ( tp.stopAll() ) { |
1421 | mCalendar->stopAllTodos(); | 1437 | mCalendar->stopAllTodos(); |
1422 | t->setRunning( true ); | 1438 | t->setRunning( true ); |
1423 | updateView(); | 1439 | updateView(); |
1424 | } else { | 1440 | } else { |
1425 | t->setRunning( true ); | 1441 | t->setRunning( true ); |
1426 | updateTodo ( t, KOGlobals::EVENTEDITED ); | 1442 | updateTodo ( t, KOGlobals::EVENTEDITED ); |
1427 | } | 1443 | } |
1428 | } | 1444 | } |
1429 | } | 1445 | } |
1430 | 1446 | ||
1431 | void KOTodoView::itemClicked(QListViewItem *item) | 1447 | void KOTodoView::itemClicked(Q3ListViewItem *item) |
1432 | { | 1448 | { |
1433 | //qDebug("KOTodoView::itemClicked %d", item); | 1449 | //qDebug("KOTodoView::itemClicked %d", item); |
1434 | if (!item) { | 1450 | if (!item) { |
1435 | if ( pendingSubtodo != 0 ) { | 1451 | if ( pendingSubtodo != 0 ) { |
1436 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1452 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1437 | } | 1453 | } |
1438 | pendingSubtodo = 0; | 1454 | pendingSubtodo = 0; |
1439 | return; | 1455 | return; |
1440 | } | 1456 | } |
1441 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1457 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1442 | if ( pendingSubtodo != 0 ) { | 1458 | if ( pendingSubtodo != 0 ) { |
1443 | bool allowReparent = true; | 1459 | bool allowReparent = true; |
1444 | QListViewItem *par = item; | 1460 | Q3ListViewItem *par = item; |
1445 | while ( par ) { | 1461 | while ( par ) { |
1446 | if ( par == pendingSubtodo ) { | 1462 | if ( par == pendingSubtodo ) { |
1447 | allowReparent = false; | 1463 | allowReparent = false; |
1448 | break; | 1464 | break; |
1449 | } | 1465 | } |
1450 | par = par->parent(); | 1466 | par = par->parent(); |
1451 | } | 1467 | } |
1452 | if ( !allowReparent ) { | 1468 | if ( !allowReparent ) { |
1453 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); | 1469 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); |
1454 | pendingSubtodo = 0; | 1470 | pendingSubtodo = 0; |
1455 | } else { | 1471 | } else { |
1456 | Todo* newParent = todoItem->todo(); | 1472 | Todo* newParent = todoItem->todo(); |
1457 | Todo* newSub = pendingSubtodo->todo(); | 1473 | Todo* newSub = pendingSubtodo->todo(); |
1458 | pendingSubtodo = 0; | 1474 | pendingSubtodo = 0; |
1459 | emit reparentTodoSignal( newParent,newSub ); | 1475 | emit reparentTodoSignal( newParent,newSub ); |
1460 | return; | 1476 | return; |
1461 | } | 1477 | } |
1462 | } | 1478 | } |
1463 | 1479 | ||
1464 | } | 1480 | } |
1465 | 1481 | ||
1466 | void KOTodoView::setDocumentId( const QString &id ) | 1482 | void KOTodoView::setDocumentId( const QString &id ) |
1467 | { | 1483 | { |
1468 | 1484 | ||
1469 | mDocPrefs->setDoc( id ); | 1485 | mDocPrefs->setDoc( id ); |
1470 | } | 1486 | } |
1471 | 1487 | ||
1472 | void KOTodoView::itemStateChanged( QListViewItem *item ) | 1488 | void KOTodoView::itemStateChanged( Q3ListViewItem *item ) |
1473 | { | 1489 | { |
1474 | if (!item) return; | 1490 | if (!item) return; |
1475 | 1491 | ||
1476 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1492 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1477 | 1493 | ||
1478 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; | 1494 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; |
1479 | 1495 | ||
1480 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); | 1496 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); |
1481 | } | 1497 | } |
1482 | 1498 | ||
1483 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const | 1499 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const |
1484 | { | 1500 | { |
1485 | mTodoListView->saveLayout(config,group); | 1501 | mTodoListView->saveLayout(config,group); |
1486 | } | 1502 | } |
1487 | 1503 | ||
1488 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) | 1504 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) |
@@ -1529,54 +1545,54 @@ void KOTodoView::setAllOpen() | |||
1529 | } | 1545 | } |
1530 | setOpen(mTodoListView->firstChild(), true); | 1546 | setOpen(mTodoListView->firstChild(), true); |
1531 | resetCurrentItem(); | 1547 | resetCurrentItem(); |
1532 | } | 1548 | } |
1533 | void KOTodoView::setAllClose() | 1549 | void KOTodoView::setAllClose() |
1534 | { | 1550 | { |
1535 | if ( isFlatDisplay ) { | 1551 | if ( isFlatDisplay ) { |
1536 | isFlatDisplay = false; | 1552 | isFlatDisplay = false; |
1537 | mPopupMenu->setItemChecked( 8,false ); | 1553 | mPopupMenu->setItemChecked( 8,false ); |
1538 | updateView(); | 1554 | updateView(); |
1539 | } else { | 1555 | } else { |
1540 | storeCurrentItem(); | 1556 | storeCurrentItem(); |
1541 | } | 1557 | } |
1542 | setOpen(mTodoListView->firstChild(), false); | 1558 | setOpen(mTodoListView->firstChild(), false); |
1543 | resetCurrentItem(); | 1559 | resetCurrentItem(); |
1544 | } | 1560 | } |
1545 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) | 1561 | void KOTodoView::setOpen( Q3ListViewItem* item, bool setOpenI) |
1546 | { | 1562 | { |
1547 | 1563 | ||
1548 | while ( item ) { | 1564 | while ( item ) { |
1549 | setOpen( item->firstChild(), setOpenI ); | 1565 | setOpen( item->firstChild(), setOpenI ); |
1550 | item->setOpen( setOpenI ); | 1566 | item->setOpen( setOpenI ); |
1551 | item = item->nextSibling(); | 1567 | item = item->nextSibling(); |
1552 | } | 1568 | } |
1553 | } | 1569 | } |
1554 | 1570 | ||
1555 | void KOTodoView::displayAllFlat() | 1571 | void KOTodoView::displayAllFlat() |
1556 | { | 1572 | { |
1557 | 1573 | ||
1558 | mActiveItem = 0; | 1574 | mActiveItem = 0; |
1559 | pendingSubtodo = 0; | 1575 | pendingSubtodo = 0; |
1560 | if ( mBlockUpdate ) { | 1576 | if ( mBlockUpdate ) { |
1561 | return; | 1577 | return; |
1562 | } | 1578 | } |
1563 | clearList (); | 1579 | clearList (); |
1564 | mPopupMenu->setItemChecked( 8,true ); | 1580 | mPopupMenu->setItemChecked( 8,true ); |
1565 | isFlatDisplay = true; | 1581 | isFlatDisplay = true; |
1566 | QPtrList<Todo> todoList = calendar()->todos(); | 1582 | Q3PtrList<Todo> todoList = calendar()->todos(); |
1567 | Todo *todo; | 1583 | Todo *todo; |
1568 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 1584 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
1569 | if ( checkTodo( todo ) ) { | 1585 | if ( checkTodo( todo ) ) { |
1570 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1586 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1571 | mTodoMap.insert(todo,todoItem); | 1587 | mTodoMap.insert(todo,todoItem); |
1572 | } | 1588 | } |
1573 | } | 1589 | } |
1574 | resetCurrentItem(); | 1590 | resetCurrentItem(); |
1575 | } | 1591 | } |
1576 | 1592 | ||
1577 | void KOTodoView::setAllFlat() | 1593 | void KOTodoView::setAllFlat() |
1578 | { | 1594 | { |
1579 | if ( isFlatDisplay ) { | 1595 | if ( isFlatDisplay ) { |
1580 | isFlatDisplay = false; | 1596 | isFlatDisplay = false; |
1581 | mPopupMenu->setItemChecked( 8,false ); | 1597 | mPopupMenu->setItemChecked( 8,false ); |
1582 | updateView(); | 1598 | updateView(); |