-rw-r--r-- | korganizer/kotodoview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 902f3f4..2f5259f 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -66,385 +66,385 @@ KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, | |||
66 | mMousePressed = false; | 66 | mMousePressed = false; |
67 | 67 | ||
68 | setAcceptDrops(true); | 68 | setAcceptDrops(true); |
69 | viewport()->setAcceptDrops(true); | 69 | viewport()->setAcceptDrops(true); |
70 | int size = 16; | 70 | int size = 16; |
71 | if (qApp->desktop()->width() < 300 ) | 71 | if (qApp->desktop()->width() < 300 ) |
72 | size = 12; | 72 | size = 12; |
73 | setTreeStepSize( size + 6 ); | 73 | setTreeStepSize( size + 6 ); |
74 | 74 | ||
75 | } | 75 | } |
76 | 76 | ||
77 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) | 77 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) |
78 | { | 78 | { |
79 | #ifndef KORG_NODND | 79 | #ifndef KORG_NODND |
80 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; | 80 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; |
81 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 81 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
82 | !QTextDrag::canDecode( e ) ) { | 82 | !QTextDrag::canDecode( e ) ) { |
83 | e->ignore(); | 83 | e->ignore(); |
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | 86 | ||
87 | mOldCurrent = currentItem(); | 87 | mOldCurrent = currentItem(); |
88 | #endif | 88 | #endif |
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
92 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) | 92 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) |
93 | { | 93 | { |
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 | Incidence *to = destinationEvent; | 142 | Incidence *to = destinationEvent; |
143 | while(to) { | 143 | while(to) { |
144 | if (to->uid() == todo->uid()) { | 144 | if (to->uid() == todo->uid()) { |
145 | KMessageBox::sorry(this, | 145 | KMessageBox::sorry(this, |
146 | i18n("Cannot move To-Do to itself\nor a child of itself"), | 146 | i18n("Cannot move To-Do to itself\nor a child of itself"), |
147 | i18n("Drop To-Do")); | 147 | i18n("Drop To-Do")); |
148 | delete todo; | 148 | delete todo; |
149 | return; | 149 | return; |
150 | } | 150 | } |
151 | to = to->relatedTo(); | 151 | to = to->relatedTo(); |
152 | } | 152 | } |
153 | internalDrop = true; | 153 | internalDrop = true; |
154 | if ( destinationEvent ) | 154 | if ( destinationEvent ) |
155 | reparentTodoSignal( destinationEvent, existingTodo ); | 155 | reparentTodoSignal( destinationEvent, existingTodo ); |
156 | else | 156 | else |
157 | unparentTodoSignal(existingTodo); | 157 | unparentTodoSignal(existingTodo); |
158 | delete todo; | 158 | delete todo; |
159 | } else { | 159 | } else { |
160 | mCalendar->addTodo(todo); | 160 | mCalendar->addTodo(todo); |
161 | emit todoDropped(todo, KOGlobals::EVENTADDED); | 161 | emit todoDropped(todo, KOGlobals::EVENTADDED); |
162 | if ( destinationEvent ) | 162 | if ( destinationEvent ) |
163 | reparentTodoSignal( destinationEvent, todo ); | 163 | reparentTodoSignal( destinationEvent, todo ); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | else { | 166 | else { |
167 | QString text; | 167 | QString text; |
168 | if (QTextDrag::decode(e,text)) { | 168 | if (QTextDrag::decode(e,text)) { |
169 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); | 169 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); |
170 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); | 170 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); |
171 | qDebug("Dropped : " + text); | 171 | qDebug("Dropped : " + text); |
172 | QStringList emails = QStringList::split(",",text); | 172 | QStringList emails = QStringList::split(",",text); |
173 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 173 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
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 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); | 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 | #ifndef KORG_NODND | 192 | #ifndef KORG_NODND |
193 | QPoint p(contentsToViewport(e->pos())); | 193 | QPoint p(contentsToViewport(e->pos())); |
194 | QListViewItem *i = itemAt(p); | 194 | QListViewItem *i = itemAt(p); |
195 | mMousePressed = false; | 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 | QListView::contentsMousePressEvent(e); |
211 | } | 211 | } |
212 | 212 | ||
213 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 213 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
214 | { | 214 | { |
215 | 215 | ||
216 | #ifndef KORG_NODND | 216 | #ifndef KORG_NODND |
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 | DndFactory factory( mCalendar ); | 223 | DndFactory factory( mCalendar ); |
224 | ICalDrag *vd = factory.createDrag( | 224 | ICalDrag *vd = factory.createDrag( |
225 | ((KOTodoViewItem *)item)->todo(),viewport()); | 225 | ((KOTodoViewItem *)item)->todo(),viewport()); |
226 | internalDrop = false; | 226 | internalDrop = false; |
227 | // we cannot do any senseful here, because the DnD is still broken in Qt | 227 | // we cannot do any senseful here, because the DnD is still broken in Qt |
228 | if (vd->drag()) { | 228 | if (vd->drag()) { |
229 | if ( !internalDrop ) { | 229 | if ( !internalDrop ) { |
230 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); | 230 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); |
231 | qDebug("Dnd: External move: Delete drag source "); | 231 | qDebug("Dnd: External move: Delete drag source "); |
232 | } else | 232 | } else |
233 | qDebug("Dnd: Internal move "); | 233 | qDebug("Dnd: Internal move "); |
234 | 234 | ||
235 | } else { | 235 | } else { |
236 | if ( !internalDrop ) { | 236 | if ( !internalDrop ) { |
237 | qDebug("Dnd: External Copy"); | 237 | qDebug("Dnd: External Copy"); |
238 | } else | 238 | } else |
239 | qDebug("DnD: Internal copy: Copy pending"); | 239 | qDebug("DnD: Internal copy: Copy pending"); |
240 | } | 240 | } |
241 | } | 241 | } |
242 | } | 242 | } |
243 | #endif | 243 | #endif |
244 | } | 244 | } |
245 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 245 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
246 | { | 246 | { |
247 | 247 | ||
248 | QListViewItem* cn; | 248 | QListViewItem* cn; |
249 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { | 249 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { |
250 | cn = currentItem(); | 250 | cn = currentItem(); |
251 | if ( cn ) { | 251 | if ( cn ) { |
252 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 252 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
253 | if ( ci ){ | 253 | if ( ci ){ |
254 | if ( e->state() == ShiftButton ) | 254 | if ( e->state() == ShiftButton ) |
255 | ci->setOn( false ); | 255 | ci->setOn( false ); |
256 | else | 256 | else |
257 | ci->setOn( true ); | 257 | ci->setOn( true ); |
258 | cn = cn->nextSibling(); | 258 | cn = cn->itemBelow(); |
259 | if ( cn ) { | 259 | if ( cn ) { |
260 | setCurrentItem ( cn ); | 260 | setCurrentItem ( cn ); |
261 | ensureItemVisible ( cn ); | 261 | ensureItemVisible ( cn ); |
262 | } | 262 | } |
263 | 263 | ||
264 | } | 264 | } |
265 | } | 265 | } |
266 | 266 | ||
267 | return; | 267 | return; |
268 | } | 268 | } |
269 | 269 | ||
270 | // qDebug("KOTodoListView::keyPressEvent "); | 270 | // qDebug("KOTodoListView::keyPressEvent "); |
271 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 271 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
272 | switch ( e->key() ) { | 272 | switch ( e->key() ) { |
273 | case Qt::Key_Down: | 273 | case Qt::Key_Down: |
274 | case Qt::Key_Up: | 274 | case Qt::Key_Up: |
275 | QListView::keyPressEvent ( e ); | 275 | QListView::keyPressEvent ( e ); |
276 | break; | 276 | break; |
277 | case Qt::Key_Left: | 277 | case Qt::Key_Left: |
278 | case Qt::Key_Right: | 278 | case Qt::Key_Right: |
279 | QListView::keyPressEvent ( e ); | 279 | QListView::keyPressEvent ( e ); |
280 | e->accept(); | 280 | e->accept(); |
281 | return; | 281 | return; |
282 | break; | 282 | break; |
283 | default: | 283 | default: |
284 | e->ignore(); | 284 | e->ignore(); |
285 | break; | 285 | break; |
286 | } | 286 | } |
287 | return; | 287 | return; |
288 | } | 288 | } |
289 | e->ignore(); | 289 | e->ignore(); |
290 | } | 290 | } |
291 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 291 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
292 | { | 292 | { |
293 | QListView::contentsMouseReleaseEvent(e); | 293 | QListView::contentsMouseReleaseEvent(e); |
294 | mMousePressed = false; | 294 | mMousePressed = false; |
295 | } | 295 | } |
296 | 296 | ||
297 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 297 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
298 | { | 298 | { |
299 | if (!e) return; | 299 | if (!e) return; |
300 | 300 | ||
301 | QPoint vp = contentsToViewport(e->pos()); | 301 | QPoint vp = contentsToViewport(e->pos()); |
302 | 302 | ||
303 | QListViewItem *item = itemAt(vp); | 303 | QListViewItem *item = itemAt(vp); |
304 | 304 | ||
305 | emit double_Clicked(item); | 305 | emit double_Clicked(item); |
306 | if (!item) return; | 306 | if (!item) return; |
307 | 307 | ||
308 | emit doubleClicked(item,vp,0); | 308 | emit doubleClicked(item,vp,0); |
309 | } | 309 | } |
310 | 310 | ||
311 | ///////////////////////////////////////////////////////////////////////////// | 311 | ///////////////////////////////////////////////////////////////////////////// |
312 | 312 | ||
313 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 313 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
314 | QLineEdit(parent) | 314 | QLineEdit(parent) |
315 | { | 315 | { |
316 | setText(i18n("Click to add a new Todo")); | 316 | setText(i18n("Click to add a new Todo")); |
317 | } | 317 | } |
318 | 318 | ||
319 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 319 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
320 | { | 320 | { |
321 | if ( text()==i18n("Click to add a new Todo") ) | 321 | if ( text()==i18n("Click to add a new Todo") ) |
322 | setText(""); | 322 | setText(""); |
323 | QLineEdit::focusInEvent(ev); | 323 | QLineEdit::focusInEvent(ev); |
324 | } | 324 | } |
325 | 325 | ||
326 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 326 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
327 | { | 327 | { |
328 | setText(i18n("Click to add a new Todo")); | 328 | setText(i18n("Click to add a new Todo")); |
329 | QLineEdit::focusOutEvent(ev); | 329 | QLineEdit::focusOutEvent(ev); |
330 | } | 330 | } |
331 | 331 | ||
332 | ///////////////////////////////////////////////////////////////////////////// | 332 | ///////////////////////////////////////////////////////////////////////////// |
333 | 333 | ||
334 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 334 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
335 | KOrg::BaseView(calendar,parent,name) | 335 | KOrg::BaseView(calendar,parent,name) |
336 | { | 336 | { |
337 | isFlatDisplay = false; | 337 | isFlatDisplay = false; |
338 | mNavigator = 0; | 338 | mNavigator = 0; |
339 | QBoxLayout *topLayout = new QVBoxLayout(this); | 339 | QBoxLayout *topLayout = new QVBoxLayout(this); |
340 | mName = QString ( name ); | 340 | mName = QString ( name ); |
341 | mBlockUpdate = false; | 341 | mBlockUpdate = false; |
342 | mQuickAdd = new KOQuickTodo(this); | 342 | mQuickAdd = new KOQuickTodo(this); |
343 | topLayout->addWidget(mQuickAdd); | 343 | topLayout->addWidget(mQuickAdd); |
344 | 344 | ||
345 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 345 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
346 | 346 | ||
347 | mTodoListView = new KOTodoListView(calendar,this, name ); | 347 | mTodoListView = new KOTodoListView(calendar,this, name ); |
348 | topLayout->addWidget(mTodoListView); | 348 | topLayout->addWidget(mTodoListView); |
349 | //mTodoListView->header()->setMaximumHeight(30); | 349 | //mTodoListView->header()->setMaximumHeight(30); |
350 | mTodoListView->setRootIsDecorated(true); | 350 | mTodoListView->setRootIsDecorated(true); |
351 | mTodoListView->setAllColumnsShowFocus(true); | 351 | mTodoListView->setAllColumnsShowFocus(true); |
352 | 352 | ||
353 | mTodoListView->setShowSortIndicator(true); | 353 | mTodoListView->setShowSortIndicator(true); |
354 | 354 | ||
355 | mTodoListView->addColumn(i18n("Todo")); | 355 | mTodoListView->addColumn(i18n("Todo")); |
356 | mTodoListView->addColumn(i18n("Prio")); | 356 | mTodoListView->addColumn(i18n("Prio")); |
357 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 357 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
358 | mTodoListView->addColumn(i18n("Complete")); | 358 | mTodoListView->addColumn(i18n("Complete")); |
359 | mTodoListView->setColumnAlignment(2,AlignCenter); | 359 | mTodoListView->setColumnAlignment(2,AlignCenter); |
360 | 360 | ||
361 | mTodoListView->addColumn(i18n("Due Date")); | 361 | mTodoListView->addColumn(i18n("Due Date")); |
362 | mTodoListView->setColumnAlignment(3,AlignLeft); | 362 | mTodoListView->setColumnAlignment(3,AlignLeft); |
363 | mTodoListView->addColumn(i18n("Due Time")); | 363 | mTodoListView->addColumn(i18n("Due Time")); |
364 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 364 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
365 | 365 | ||
366 | mTodoListView->addColumn(i18n("Start Date")); | 366 | mTodoListView->addColumn(i18n("Start Date")); |
367 | mTodoListView->setColumnAlignment(5,AlignLeft); | 367 | mTodoListView->setColumnAlignment(5,AlignLeft); |
368 | mTodoListView->addColumn(i18n("Start Time")); | 368 | mTodoListView->addColumn(i18n("Start Time")); |
369 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 369 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
370 | 370 | ||
371 | mTodoListView->addColumn(i18n("Cancelled")); | 371 | mTodoListView->addColumn(i18n("Cancelled")); |
372 | mTodoListView->addColumn(i18n("Categories")); | 372 | mTodoListView->addColumn(i18n("Categories")); |
373 | #if 0 | 373 | #if 0 |
374 | mTodoListView->addColumn(i18n("Sort Id")); | 374 | mTodoListView->addColumn(i18n("Sort Id")); |
375 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 375 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
376 | #endif | 376 | #endif |
377 | 377 | ||
378 | mTodoListView->setMinimumHeight( 60 ); | 378 | mTodoListView->setMinimumHeight( 60 ); |
379 | mTodoListView->setItemsRenameable( true ); | 379 | mTodoListView->setItemsRenameable( true ); |
380 | mTodoListView->setRenameable( 0 ); | 380 | mTodoListView->setRenameable( 0 ); |
381 | mTodoListView->setColumnWidth( 0, 120 ); | 381 | mTodoListView->setColumnWidth( 0, 120 ); |
382 | mTodoListView->setColumnWidthMode(0, QListView::Manual); | 382 | mTodoListView->setColumnWidthMode(0, QListView::Manual); |
383 | mTodoListView->setColumnWidthMode(1, QListView::Manual); | 383 | mTodoListView->setColumnWidthMode(1, QListView::Manual); |
384 | mTodoListView->setColumnWidthMode(2, QListView::Manual); | 384 | mTodoListView->setColumnWidthMode(2, QListView::Manual); |
385 | mTodoListView->setColumnWidthMode(3, QListView::Manual); | 385 | mTodoListView->setColumnWidthMode(3, QListView::Manual); |
386 | mTodoListView->setColumnWidthMode(4, QListView::Manual); | 386 | mTodoListView->setColumnWidthMode(4, QListView::Manual); |
387 | mTodoListView->setColumnWidthMode(5, QListView::Manual); | 387 | mTodoListView->setColumnWidthMode(5, QListView::Manual); |
388 | mTodoListView->setColumnWidthMode(6, QListView::Manual); | 388 | mTodoListView->setColumnWidthMode(6, QListView::Manual); |
389 | mTodoListView->setColumnWidthMode(7, QListView::Manual); | 389 | mTodoListView->setColumnWidthMode(7, QListView::Manual); |
390 | mTodoListView->setColumnWidthMode(8, QListView::Manual); | 390 | mTodoListView->setColumnWidthMode(8, QListView::Manual); |
391 | 391 | ||
392 | 392 | ||
393 | mPriorityPopupMenu = new QPopupMenu(this); | 393 | mPriorityPopupMenu = new QPopupMenu(this); |
394 | for (int i = 1; i <= 5; i++) { | 394 | for (int i = 1; i <= 5; i++) { |
395 | QString label = QString ("%1").arg (i); | 395 | QString label = QString ("%1").arg (i); |
396 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 396 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
397 | } | 397 | } |
398 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 398 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
399 | 399 | ||
400 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 400 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
401 | for (int i = 0; i <= 100; i+=20) { | 401 | for (int i = 0; i <= 100; i+=20) { |
402 | QString label = QString ("%1 %").arg (i); | 402 | QString label = QString ("%1 %").arg (i); |
403 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 403 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
404 | } | 404 | } |
405 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 405 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
406 | 406 | ||
407 | 407 | ||
408 | 408 | ||
409 | mItemPopupMenu = new QPopupMenu(this); | 409 | mItemPopupMenu = new QPopupMenu(this); |
410 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 410 | mItemPopupMenu->insertItem(i18n("Show..."), this, |
411 | SLOT (showTodo())); | 411 | SLOT (showTodo())); |
412 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 412 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
413 | SLOT (editTodo())); | 413 | SLOT (editTodo())); |
414 | mItemPopupMenu->insertItem( i18n("Delete"), this, | 414 | mItemPopupMenu->insertItem( i18n("Delete"), this, |
415 | SLOT (deleteTodo())); | 415 | SLOT (deleteTodo())); |
416 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 416 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
417 | SLOT (cloneTodo())); | 417 | SLOT (cloneTodo())); |
418 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 418 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
419 | SLOT (moveTodo())); | 419 | SLOT (moveTodo())); |
420 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 420 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
421 | SLOT (beamTodo())); | 421 | SLOT (beamTodo())); |
422 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 422 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
423 | SLOT (cancelTodo())); | 423 | SLOT (cancelTodo())); |
424 | mItemPopupMenu->insertSeparator(); | 424 | mItemPopupMenu->insertSeparator(); |
425 | 425 | ||
426 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 426 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
427 | SLOT (newTodo())); | 427 | SLOT (newTodo())); |
428 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 428 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
429 | SLOT (newSubTodo())); | 429 | SLOT (newSubTodo())); |
430 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 430 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
431 | SLOT (unparentTodo()),0,21); | 431 | SLOT (unparentTodo()),0,21); |
432 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 432 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
433 | SLOT (reparentTodo()),0,22); | 433 | SLOT (reparentTodo()),0,22); |
434 | mItemPopupMenu->insertSeparator(); | 434 | mItemPopupMenu->insertSeparator(); |
435 | #if 0 | 435 | #if 0 |
436 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), | 436 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), |
437 | this, SLOT( purgeCompleted() ) ); | 437 | this, SLOT( purgeCompleted() ) ); |
438 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 438 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
439 | this, SLOT( toggleCompleted() ),0, 33 ); | 439 | this, SLOT( toggleCompleted() ),0, 33 ); |
440 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 440 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
441 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 441 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
442 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 442 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
443 | this, SLOT( toggleRunning() ),0, 35 ); | 443 | this, SLOT( toggleRunning() ),0, 35 ); |
444 | 444 | ||
445 | #endif | 445 | #endif |
446 | mPopupMenu = new QPopupMenu(this); | 446 | mPopupMenu = new QPopupMenu(this); |
447 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 447 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
448 | SLOT (newTodo()),0,1); | 448 | SLOT (newTodo()),0,1); |
449 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 449 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
450 | this, SLOT(purgeCompleted()),0,2); | 450 | this, SLOT(purgeCompleted()),0,2); |