-rw-r--r-- | korganizer/kotodoview.cpp | 61 |
1 files changed, 35 insertions, 26 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 1fb480d..8c1953d 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -94,193 +94,195 @@ void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) | |||
94 | #ifndef KORG_NODND | 94 | #ifndef KORG_NODND |
95 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; | 95 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; |
96 | 96 | ||
97 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 97 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
98 | !QTextDrag::canDecode( e ) ) { | 98 | !QTextDrag::canDecode( e ) ) { |
99 | e->ignore(); | 99 | e->ignore(); |
100 | return; | 100 | return; |
101 | } | 101 | } |
102 | 102 | ||
103 | e->accept(); | 103 | e->accept(); |
104 | #endif | 104 | #endif |
105 | } | 105 | } |
106 | 106 | ||
107 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) | 107 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) |
108 | { | 108 | { |
109 | #ifndef KORG_NODND | 109 | #ifndef KORG_NODND |
110 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; | 110 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; |
111 | 111 | ||
112 | setCurrentItem(mOldCurrent); | 112 | setCurrentItem(mOldCurrent); |
113 | setSelected(mOldCurrent,true); | 113 | setSelected(mOldCurrent,true); |
114 | #endif | 114 | #endif |
115 | } | 115 | } |
116 | 116 | ||
117 | void KOTodoListView::contentsDropEvent(QDropEvent *e) | 117 | void KOTodoListView::contentsDropEvent(QDropEvent *e) |
118 | { | 118 | { |
119 | #ifndef KORG_NODND | 119 | #ifndef KORG_NODND |
120 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; | 120 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; |
121 | 121 | ||
122 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 122 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
123 | !QTextDrag::canDecode( e ) ) { | 123 | !QTextDrag::canDecode( e ) ) { |
124 | e->ignore(); | 124 | e->ignore(); |
125 | return; | 125 | return; |
126 | } | 126 | } |
127 | 127 | ||
128 | DndFactory factory( mCalendar ); | 128 | DndFactory factory( mCalendar ); |
129 | Todo *todo = factory.createDropTodo(e); | 129 | Todo *todo = factory.createDropTodo(e); |
130 | 130 | ||
131 | if (todo) { | 131 | if (todo) { |
132 | e->acceptAction(); | 132 | e->acceptAction(); |
133 | 133 | ||
134 | KOTodoViewItem *destination = | 134 | KOTodoViewItem *destination = |
135 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); | 135 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); |
136 | Todo *destinationEvent = 0; | 136 | Todo *destinationEvent = 0; |
137 | if (destination) destinationEvent = destination->todo(); | 137 | if (destination) destinationEvent = destination->todo(); |
138 | 138 | ||
139 | Todo *existingTodo = mCalendar->todo(todo->uid()); | 139 | Todo *existingTodo = mCalendar->todo(todo->uid()); |
140 | 140 | ||
141 | if(existingTodo) { | 141 | if(existingTodo) { |
142 | // kdDebug() << "Drop existing Todo" << endl; | ||
143 | Incidence *to = destinationEvent; | 142 | Incidence *to = destinationEvent; |
144 | while(to) { | 143 | while(to) { |
145 | if (to->uid() == todo->uid()) { | 144 | if (to->uid() == todo->uid()) { |
146 | KMessageBox::sorry(this, | 145 | KMessageBox::sorry(this, |
147 | i18n("Cannot move To-Do to itself or a child of itself"), | 146 | i18n("Cannot move To-Do to itself\nor a child of itself"), |
148 | i18n("Drop To-Do")); | 147 | i18n("Drop To-Do")); |
149 | delete todo; | 148 | delete todo; |
150 | return; | 149 | return; |
151 | } | 150 | } |
152 | to = to->relatedTo(); | 151 | to = to->relatedTo(); |
153 | } | 152 | } |
154 | existingTodo->setRelatedTo(destinationEvent); | 153 | internalDrop = true; |
155 | emit todoDropped(todo); | 154 | if ( destinationEvent ) |
155 | reparentTodoSignal( destinationEvent, existingTodo ); | ||
156 | else | ||
157 | unparentTodoSignal(existingTodo); | ||
156 | delete todo; | 158 | delete todo; |
157 | } else { | 159 | } else { |
158 | // kdDebug() << "Drop new Todo" << endl; | ||
159 | todo->setRelatedTo(destinationEvent); | ||
160 | mCalendar->addTodo(todo); | 160 | mCalendar->addTodo(todo); |
161 | 161 | emit todoDropped(todo, KOGlobals::EVENTADDED); | |
162 | emit todoDropped(todo); | 162 | if ( destinationEvent ) |
163 | reparentTodoSignal( destinationEvent, todo ); | ||
163 | } | 164 | } |
164 | } | 165 | } |
165 | else { | 166 | else { |
166 | QString text; | 167 | QString text; |
167 | if (QTextDrag::decode(e,text)) { | 168 | if (QTextDrag::decode(e,text)) { |
168 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); | 169 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); |
169 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); | 170 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); |
170 | kdDebug() << "Dropped : " << text << endl; | 171 | qDebug("Dropped : " + text); |
171 | QStringList emails = QStringList::split(",",text); | 172 | QStringList emails = QStringList::split(",",text); |
172 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 173 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
173 | kdDebug() << " Email: " << (*it) << endl; | ||
174 | int pos = (*it).find("<"); | 174 | int pos = (*it).find("<"); |
175 | QString name = (*it).left(pos); | 175 | QString name = (*it).left(pos); |
176 | QString email = (*it).mid(pos); | 176 | QString email = (*it).mid(pos); |
177 | if (!email.isEmpty() && todoi) { | 177 | if (!email.isEmpty() && todoi) { |
178 | todoi->todo()->addAttendee(new Attendee(name,email)); | 178 | todoi->todo()->addAttendee(new Attendee(name,email)); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | } | 181 | } |
182 | else { | 182 | else { |
183 | kdDebug() << "KOTodoListView::contentsDropEvent(): Todo from drop not decodable" << endl; | 183 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); |
184 | e->ignore(); | 184 | e->ignore(); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | #endif | 187 | #endif |
188 | } | 188 | } |
189 | 189 | ||
190 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | 190 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) |
191 | { | 191 | { |
192 | QListView::contentsMousePressEvent(e); | ||
193 | #ifndef KORG_NODND | 192 | #ifndef KORG_NODND |
194 | QPoint p(contentsToViewport(e->pos())); | 193 | QPoint p(contentsToViewport(e->pos())); |
195 | QListViewItem *i = itemAt(p); | 194 | QListViewItem *i = itemAt(p); |
195 | mMousePressed = false; | ||
196 | if (i) { | 196 | if (i) { |
197 | // if the user clicked into the root decoration of the item, don't | 197 | // if the user clicked into the root decoration of the item, don't |
198 | // try to start a drag! | 198 | // try to start a drag! |
199 | if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + | 199 | if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + |
200 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | 200 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + |
201 | itemMargin() || | 201 | itemMargin() || |
202 | p.x() < header()->sectionPos(header()->mapToIndex(0))) { | 202 | p.x() < header()->sectionPos(header()->mapToIndex(0))) { |
203 | if (e->button()==Qt::LeftButton) { | 203 | if (e->button()==Qt::LeftButton) { |
204 | mPressPos = e->pos(); | 204 | mPressPos = e->pos(); |
205 | mMousePressed = true; | 205 | mMousePressed = true; |
206 | } | 206 | } |
207 | } | 207 | } |
208 | } | 208 | } |
209 | #endif | 209 | #endif |
210 | QListView::contentsMousePressEvent(e); | ||
210 | } | 211 | } |
211 | 212 | ||
212 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 213 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
213 | { | 214 | { |
214 | 215 | ||
215 | #ifndef KORG_NODND | 216 | #ifndef KORG_NODND |
216 | // kdDebug() << "KOTodoListView::contentsMouseMoveEvent()" << endl; | ||
217 | QListView::contentsMouseMoveEvent(e); | 217 | QListView::contentsMouseMoveEvent(e); |
218 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > | 218 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > |
219 | QApplication::startDragDistance()) { | 219 | QApplication::startDragDistance()) { |
220 | mMousePressed = false; | 220 | mMousePressed = false; |
221 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); | 221 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); |
222 | if (item) { | 222 | if (item) { |
223 | // kdDebug() << "Start Drag for item " << item->text(0) << endl; | ||
224 | DndFactory factory( mCalendar ); | 223 | DndFactory factory( mCalendar ); |
225 | ICalDrag *vd = factory.createDragTodo( | 224 | ICalDrag *vd = factory.createDrag( |
226 | ((KOTodoViewItem *)item)->todo(),viewport()); | 225 | ((KOTodoViewItem *)item)->todo(),viewport()); |
226 | internalDrop = false; | ||
227 | // we cannot do any senseful here, because the DnD is still broken in Qt | ||
227 | if (vd->drag()) { | 228 | if (vd->drag()) { |
228 | kdDebug() << "KOTodoListView::contentsMouseMoveEvent(): Delete drag source" << endl; | 229 | if ( !internalDrop ) { |
230 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); | ||
231 | qDebug("Dnd: External move: Delete drag source "); | ||
232 | } else | ||
233 | qDebug("Dnd: Internal move "); | ||
234 | |||
235 | } else { | ||
236 | if ( !internalDrop ) { | ||
237 | qDebug("Dnd: External Copy"); | ||
238 | } else | ||
239 | qDebug("DnD: Internal copy: Copy pending"); | ||
229 | } | 240 | } |
230 | /* | ||
231 | QString source = fullPath(item); | ||
232 | if ( QFile::exists(source) ) { | ||
233 | QUriDrag* ud = new QUriDrag(viewport()); | ||
234 | ud->setFilenames( source ); | ||
235 | if ( ud->drag() ) | ||
236 | QMessageBox::information( this, "Drag source", | ||
237 | QString("Delete ")+source, "Not implemented" ); | ||
238 | */ | ||
239 | } | 241 | } |
240 | } | 242 | } |
241 | #endif | 243 | #endif |
242 | } | 244 | } |
243 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 245 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
244 | { | 246 | { |
245 | 247 | ||
246 | QListViewItem* cn; | 248 | QListViewItem* cn; |
247 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { | 249 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { |
248 | cn = currentItem(); | 250 | cn = currentItem(); |
249 | if ( cn ) { | 251 | if ( cn ) { |
250 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 252 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
251 | if ( ci ){ | 253 | if ( ci ){ |
252 | if ( e->state() == ShiftButton ) | 254 | if ( e->state() == ShiftButton ) |
253 | ci->setOn( false ); | 255 | ci->setOn( false ); |
254 | else | 256 | else |
255 | ci->setOn( true ); | 257 | ci->setOn( true ); |
256 | cn = cn->nextSibling(); | 258 | cn = cn->nextSibling(); |
257 | if ( cn ) { | 259 | if ( cn ) { |
258 | setCurrentItem ( cn ); | 260 | setCurrentItem ( cn ); |
259 | ensureItemVisible ( cn ); | 261 | ensureItemVisible ( cn ); |
260 | } | 262 | } |
261 | 263 | ||
262 | } | 264 | } |
263 | } | 265 | } |
264 | 266 | ||
265 | return; | 267 | return; |
266 | } | 268 | } |
267 | 269 | ||
268 | // qDebug("KOTodoListView::keyPressEvent "); | 270 | // qDebug("KOTodoListView::keyPressEvent "); |
269 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 271 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
270 | switch ( e->key() ) { | 272 | switch ( e->key() ) { |
271 | case Qt::Key_Down: | 273 | case Qt::Key_Down: |
272 | case Qt::Key_Up: | 274 | case Qt::Key_Up: |
273 | QListView::keyPressEvent ( e ); | 275 | QListView::keyPressEvent ( e ); |
274 | break; | 276 | break; |
275 | case Qt::Key_Left: | 277 | case Qt::Key_Left: |
276 | case Qt::Key_Right: | 278 | case Qt::Key_Right: |
277 | QListView::keyPressEvent ( e ); | 279 | QListView::keyPressEvent ( e ); |
278 | e->accept(); | 280 | e->accept(); |
279 | return; | 281 | return; |
280 | break; | 282 | break; |
281 | default: | 283 | default: |
282 | e->ignore(); | 284 | e->ignore(); |
283 | break; | 285 | break; |
284 | } | 286 | } |
285 | return; | 287 | return; |
286 | } | 288 | } |
@@ -444,111 +446,118 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
444 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 446 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
445 | SLOT (newTodo()),0,1); | 447 | SLOT (newTodo()),0,1); |
446 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 448 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
447 | this, SLOT(purgeCompleted()),0,2); | 449 | this, SLOT(purgeCompleted()),0,2); |
448 | mPopupMenu->insertItem(i18n("Show Completed"), | 450 | mPopupMenu->insertItem(i18n("Show Completed"), |
449 | this, SLOT( toggleCompleted() ),0,3 ); | 451 | this, SLOT( toggleCompleted() ),0,3 ); |
450 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 452 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
451 | this, SLOT( toggleQuickTodo() ),0,4 ); | 453 | this, SLOT( toggleQuickTodo() ),0,4 ); |
452 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 454 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
453 | this, SLOT( toggleRunning() ),0,5 ); | 455 | this, SLOT( toggleRunning() ),0,5 ); |
454 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 456 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
455 | this, SLOT( setAllOpen() ),0,6 ); | 457 | this, SLOT( setAllOpen() ),0,6 ); |
456 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 458 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
457 | this, SLOT( setAllClose() ),0,7 ); | 459 | this, SLOT( setAllClose() ),0,7 ); |
458 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 460 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
459 | this, SLOT( setAllFlat() ),0,8 ); | 461 | this, SLOT( setAllFlat() ),0,8 ); |
460 | mDocPrefs = new DocPrefs( name ); | 462 | mDocPrefs = new DocPrefs( name ); |
461 | 463 | ||
462 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 464 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
463 | mPopupMenu->setCheckable( true ); | 465 | mPopupMenu->setCheckable( true ); |
464 | mItemPopupMenu->setCheckable( true ); | 466 | mItemPopupMenu->setCheckable( true ); |
465 | 467 | ||
466 | 468 | ||
467 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 469 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
468 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 470 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
469 | 471 | ||
470 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 472 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
471 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 473 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
472 | 474 | ||
473 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 475 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
474 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 476 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
475 | 477 | ||
476 | 478 | ||
477 | // Double clicking conflicts with opening/closing the subtree | 479 | // Double clicking conflicts with opening/closing the subtree |
478 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 480 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
479 | SLOT( editItem( QListViewItem *) ) ); | 481 | SLOT( editItem( QListViewItem *) ) ); |
480 | /* | 482 | /* |
481 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 483 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
482 | const QPoint &,int ) ), | 484 | const QPoint &,int ) ), |
483 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 485 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
484 | */ | 486 | */ |
485 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 487 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
486 | const QPoint &,int ) ), | 488 | const QPoint &,int ) ), |
487 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 489 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
488 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 490 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
489 | SLOT( itemClicked( QListViewItem * ) ) ); | 491 | SLOT( itemClicked( QListViewItem * ) ) ); |
490 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 492 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
491 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 493 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
492 | connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ), | 494 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
493 | SLOT( updateView() ) ); | 495 | SLOT( updateView() ) ); |
496 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | ||
497 | SLOT( todoModified(Todo *, int) ) ); | ||
494 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 498 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
495 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 499 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
496 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 500 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
497 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 501 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
498 | 502 | ||
499 | #if 0 | 503 | #if 0 |
500 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 504 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
501 | SLOT(selectionChanged(QListViewItem *))); | 505 | SLOT(selectionChanged(QListViewItem *))); |
502 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 506 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
503 | SLOT(selectionChanged(QListViewItem *))); | 507 | SLOT(selectionChanged(QListViewItem *))); |
504 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 508 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
505 | SLOT(selectionChanged(QListViewItem *))); | 509 | SLOT(selectionChanged(QListViewItem *))); |
506 | #endif | 510 | #endif |
511 | |||
512 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | ||
513 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | ||
514 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | ||
515 | |||
507 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 516 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
508 | SLOT( processSelectionChange() ) ); | 517 | SLOT( processSelectionChange() ) ); |
509 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 518 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
510 | SLOT( addQuickTodo() ) ); | 519 | SLOT( addQuickTodo() ) ); |
511 | 520 | ||
512 | } | 521 | } |
513 | 522 | ||
514 | KOTodoView::~KOTodoView() | 523 | KOTodoView::~KOTodoView() |
515 | { | 524 | { |
516 | delete mDocPrefs; | 525 | delete mDocPrefs; |
517 | } | 526 | } |
518 | 527 | ||
519 | void KOTodoView::jumpToDate () | 528 | void KOTodoView::jumpToDate () |
520 | { | 529 | { |
521 | // if (mActiveItem) { | 530 | // if (mActiveItem) { |
522 | // mActiveItem->todo()); | 531 | // mActiveItem->todo()); |
523 | // if ( mActiveItem->todo()->hasDueDate() ) | 532 | // if ( mActiveItem->todo()->hasDueDate() ) |
524 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 533 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
525 | } | 534 | } |
526 | 535 | ||
527 | void KOTodoView::updateView() | 536 | void KOTodoView::updateView() |
528 | { | 537 | { |
529 | pendingSubtodo = 0; | 538 | pendingSubtodo = 0; |
530 | if ( mBlockUpdate ) { | 539 | if ( mBlockUpdate ) { |
531 | //qDebug("blocked "); | 540 | //qDebug("blocked "); |
532 | return; | 541 | return; |
533 | } | 542 | } |
534 | if ( isFlatDisplay ) { | 543 | if ( isFlatDisplay ) { |
535 | setAllFlat(); | 544 | setAllFlat(); |
536 | return; | 545 | return; |
537 | } | 546 | } |
538 | //qDebug("update "); | 547 | //qDebug("update "); |
539 | // kdDebug() << "KOTodoView::updateView()" << endl; | 548 | // kdDebug() << "KOTodoView::updateView()" << endl; |
540 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 549 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
541 | mTodoListView->clear(); | 550 | mTodoListView->clear(); |
542 | if ( mName == "todolistsmall" ) { | 551 | if ( mName == "todolistsmall" ) { |
543 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 552 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
544 | int ps = fo.pointSize() -2; | 553 | int ps = fo.pointSize() -2; |
545 | if ( ps > 12 ) | 554 | if ( ps > 12 ) |
546 | ps -= 2; | 555 | ps -= 2; |
547 | fo.setPointSize( ps ); | 556 | fo.setPointSize( ps ); |
548 | } | 557 | } |
549 | } | 558 | } |
550 | 559 | ||
551 | mTodoListView->setFont( fo ); | 560 | mTodoListView->setFont( fo ); |
552 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 561 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
553 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 562 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
554 | QPtrList<Todo> todoList = calendar()->todos(); | 563 | QPtrList<Todo> todoList = calendar()->todos(); |