summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp4
-rw-r--r--korganizer/kotodoview.cpp1
-rw-r--r--korganizer/kotodoviewitem.cpp2
3 files changed, 6 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 2321087..3908dbb 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2354,200 +2354,204 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2354 addText = true; 2354 addText = true;
2355 else { 2355 else {
2356 description.sprintf(i18n(" %d items?"),delSel.count() ); 2356 description.sprintf(i18n(" %d items?"),delSel.count() );
2357 } 2357 }
2358 while ( incidence ) { 2358 while ( incidence ) {
2359 Incidence *in = incidence->clone(); 2359 Incidence *in = incidence->clone();
2360 if ( ! in->summary().isEmpty() ) { 2360 if ( ! in->summary().isEmpty() ) {
2361 in->setDescription(""); 2361 in->setDescription("");
2362 } else { 2362 } else {
2363 in->setSummary( in->description().left(20)); 2363 in->setSummary( in->description().left(20));
2364 in->setDescription(""); 2364 in->setDescription("");
2365 } 2365 }
2366 if ( addText ) 2366 if ( addText )
2367 description += in->summary() + "\n"; 2367 description += in->summary() + "\n";
2368 cal->addIncidence( in ); 2368 cal->addIncidence( in );
2369 incidence = delSel.next(); 2369 incidence = delSel.next();
2370 } 2370 }
2371 if ( beamDialog->beamVcal() ) { 2371 if ( beamDialog->beamVcal() ) {
2372 fn += ".vcs"; 2372 fn += ".vcs";
2373 FileStorage storage( cal, fn, new VCalFormat ); 2373 FileStorage storage( cal, fn, new VCalFormat );
2374 storage.save(); 2374 storage.save();
2375 } else { 2375 } else {
2376 fn += ".ics"; 2376 fn += ".ics";
2377 FileStorage storage( cal, fn, new ICalFormat( ) ); 2377 FileStorage storage( cal, fn, new ICalFormat( ) );
2378 storage.save(); 2378 storage.save();
2379 } 2379 }
2380 delete cal; 2380 delete cal;
2381 mes = i18n("KO/Pi: Ready for beaming"); 2381 mes = i18n("KO/Pi: Ready for beaming");
2382 topLevelWidget()->setCaption(mes); 2382 topLevelWidget()->setCaption(mes);
2383 KApplication::convert2latin1( fn ); 2383 KApplication::convert2latin1( fn );
2384#ifndef DESKTOP_VERSION 2384#ifndef DESKTOP_VERSION
2385 Ir *ir = new Ir( this ); 2385 Ir *ir = new Ir( this );
2386 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2386 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2387 ir->send( fn, description, "text/x-vCalendar" ); 2387 ir->send( fn, description, "text/x-vCalendar" );
2388#endif 2388#endif
2389 } 2389 }
2390} 2390}
2391void CalendarView::beamDone( Ir *ir ) 2391void CalendarView::beamDone( Ir *ir )
2392{ 2392{
2393#ifndef DESKTOP_VERSION 2393#ifndef DESKTOP_VERSION
2394 delete ir; 2394 delete ir;
2395#endif 2395#endif
2396 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2396 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2397 topLevelWidget()->raise(); 2397 topLevelWidget()->raise();
2398} 2398}
2399 2399
2400void CalendarView::moveIncidence(Incidence * inc ) 2400void CalendarView::moveIncidence(Incidence * inc )
2401{ 2401{
2402 if ( !inc ) return; 2402 if ( !inc ) return;
2403 // qDebug("showDatePickerForIncidence( ) "); 2403 // qDebug("showDatePickerForIncidence( ) ");
2404 if ( mDateFrame->isVisible() ) 2404 if ( mDateFrame->isVisible() )
2405 mDateFrame->hide(); 2405 mDateFrame->hide();
2406 else { 2406 else {
2407 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2407 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2408 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2408 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2409 int dw = QApplication::desktop()->width(); 2409 int dw = QApplication::desktop()->width();
2410 int dh = QApplication::desktop()->height(); 2410 int dh = QApplication::desktop()->height();
2411 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2411 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2412 mDateFrame->show(); 2412 mDateFrame->show();
2413 } 2413 }
2414 mDatePickerMode = 2; 2414 mDatePickerMode = 2;
2415 mMoveIncidence = inc ; 2415 mMoveIncidence = inc ;
2416 QDate da; 2416 QDate da;
2417 if ( mMoveIncidence->type() == "Todo" ) { 2417 if ( mMoveIncidence->type() == "Todo" ) {
2418 Todo * to = (Todo *) mMoveIncidence; 2418 Todo * to = (Todo *) mMoveIncidence;
2419 if ( to->hasDueDate() ) 2419 if ( to->hasDueDate() )
2420 da = to->dtDue().date(); 2420 da = to->dtDue().date();
2421 else 2421 else
2422 da = QDate::currentDate(); 2422 da = QDate::currentDate();
2423 } else { 2423 } else {
2424 da = mMoveIncidence->dtStart().date(); 2424 da = mMoveIncidence->dtStart().date();
2425 } 2425 }
2426 mDatePicker->setDate( da ); 2426 mDatePicker->setDate( da );
2427} 2427}
2428void CalendarView::showDatePicker( ) 2428void CalendarView::showDatePicker( )
2429{ 2429{
2430 //qDebug("CalendarView::showDatePicker( ) "); 2430 //qDebug("CalendarView::showDatePicker( ) ");
2431 if ( mDateFrame->isVisible() ) 2431 if ( mDateFrame->isVisible() )
2432 mDateFrame->hide(); 2432 mDateFrame->hide();
2433 else { 2433 else {
2434 int w =mDatePicker->sizeHint().width() ; 2434 int w =mDatePicker->sizeHint().width() ;
2435 int h = mDatePicker->sizeHint().height() ; 2435 int h = mDatePicker->sizeHint().height() ;
2436 int dw = QApplication::desktop()->width(); 2436 int dw = QApplication::desktop()->width();
2437 int dh = QApplication::desktop()->height(); 2437 int dh = QApplication::desktop()->height();
2438 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2438 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2439 mDateFrame->show(); 2439 mDateFrame->show();
2440 } 2440 }
2441 mDatePickerMode = 1; 2441 mDatePickerMode = 1;
2442 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2442 mDatePicker->setDate( mNavigator->selectedDates().first() );
2443} 2443}
2444 2444
2445void CalendarView::showEventEditor() 2445void CalendarView::showEventEditor()
2446{ 2446{
2447#ifdef DESKTOP_VERSION 2447#ifdef DESKTOP_VERSION
2448 mEventEditor->show(); 2448 mEventEditor->show();
2449#else 2449#else
2450 if ( mEventEditor->width() != QApplication::desktop()->width() )
2451 mEventEditor->hide();
2450 mEventEditor->showMaximized(); 2452 mEventEditor->showMaximized();
2451#endif 2453#endif
2452} 2454}
2453void CalendarView::showTodoEditor() 2455void CalendarView::showTodoEditor()
2454{ 2456{
2455#ifdef DESKTOP_VERSION 2457#ifdef DESKTOP_VERSION
2456 mTodoEditor->show(); 2458 mTodoEditor->show();
2457#else 2459#else
2460 if ( mTodoEditor->width() != QApplication::desktop()->width() )
2461 mTodoEditor->hide();
2458 mTodoEditor->showMaximized(); 2462 mTodoEditor->showMaximized();
2459#endif 2463#endif
2460} 2464}
2461 2465
2462void CalendarView::cloneIncidence() 2466void CalendarView::cloneIncidence()
2463{ 2467{
2464 Incidence *incidence = currentSelection(); 2468 Incidence *incidence = currentSelection();
2465 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2469 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2466 if ( incidence ) { 2470 if ( incidence ) {
2467 cloneIncidence(incidence); 2471 cloneIncidence(incidence);
2468 } 2472 }
2469} 2473}
2470void CalendarView::moveIncidence() 2474void CalendarView::moveIncidence()
2471{ 2475{
2472 Incidence *incidence = currentSelection(); 2476 Incidence *incidence = currentSelection();
2473 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2477 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2474 if ( incidence ) { 2478 if ( incidence ) {
2475 moveIncidence(incidence); 2479 moveIncidence(incidence);
2476 } 2480 }
2477} 2481}
2478void CalendarView::beamIncidence() 2482void CalendarView::beamIncidence()
2479{ 2483{
2480 Incidence *incidence = currentSelection(); 2484 Incidence *incidence = currentSelection();
2481 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2485 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2482 if ( incidence ) { 2486 if ( incidence ) {
2483 beamIncidence(incidence); 2487 beamIncidence(incidence);
2484 } 2488 }
2485} 2489}
2486void CalendarView::toggleCancelIncidence() 2490void CalendarView::toggleCancelIncidence()
2487{ 2491{
2488 Incidence *incidence = currentSelection(); 2492 Incidence *incidence = currentSelection();
2489 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2493 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2490 if ( incidence ) { 2494 if ( incidence ) {
2491 cancelIncidence(incidence); 2495 cancelIncidence(incidence);
2492 } 2496 }
2493} 2497}
2494 2498
2495 2499
2496void CalendarView::cancelIncidence(Incidence * inc ) 2500void CalendarView::cancelIncidence(Incidence * inc )
2497{ 2501{
2498 inc->setCancelled( ! inc->cancelled() ); 2502 inc->setCancelled( ! inc->cancelled() );
2499 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2503 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2500 updateView(); 2504 updateView();
2501} 2505}
2502void CalendarView::cloneIncidence(Incidence * orgInc ) 2506void CalendarView::cloneIncidence(Incidence * orgInc )
2503{ 2507{
2504 Incidence * newInc = orgInc->clone(); 2508 Incidence * newInc = orgInc->clone();
2505 newInc->recreate(); 2509 newInc->recreate();
2506 2510
2507 if ( newInc->type() == "Todo" ) { 2511 if ( newInc->type() == "Todo" ) {
2508 Todo* t = (Todo*) newInc; 2512 Todo* t = (Todo*) newInc;
2509 mTodoEditor->editTodo( t ); 2513 mTodoEditor->editTodo( t );
2510 showTodoEditor(); 2514 showTodoEditor();
2511 if ( mTodoEditor->exec() ) { 2515 if ( mTodoEditor->exec() ) {
2512 mCalendar->addTodo( t ); 2516 mCalendar->addTodo( t );
2513 updateView(); 2517 updateView();
2514 } else { 2518 } else {
2515 delete t; 2519 delete t;
2516 } 2520 }
2517 } 2521 }
2518 else { 2522 else {
2519 Event* e = (Event*) newInc; 2523 Event* e = (Event*) newInc;
2520 mEventEditor->editEvent( e ); 2524 mEventEditor->editEvent( e );
2521 showEventEditor(); 2525 showEventEditor();
2522 if ( mEventEditor->exec() ) { 2526 if ( mEventEditor->exec() ) {
2523 mCalendar->addEvent( e ); 2527 mCalendar->addEvent( e );
2524 updateView(); 2528 updateView();
2525 } else { 2529 } else {
2526 delete e; 2530 delete e;
2527 } 2531 }
2528 } 2532 }
2529} 2533}
2530 2534
2531void CalendarView::newEvent() 2535void CalendarView::newEvent()
2532{ 2536{
2533 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 2537 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
2534 KOAgendaView *aView = mViewManager->agendaView(); 2538 KOAgendaView *aView = mViewManager->agendaView();
2535 if (aView) { 2539 if (aView) {
2536 if (aView->selectionStart().isValid()) { 2540 if (aView->selectionStart().isValid()) {
2537 if (aView->selectedIsAllDay()) { 2541 if (aView->selectedIsAllDay()) {
2538 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 2542 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
2539 } else { 2543 } else {
2540 newEvent(aView->selectionStart(),aView->selectionEnd()); 2544 newEvent(aView->selectionStart(),aView->selectionEnd());
2541 } 2545 }
2542 return; 2546 return;
2543 } 2547 }
2544 } 2548 }
2545 2549
2546 QDate date = mNavigator->selectedDates().first(); 2550 QDate date = mNavigator->selectedDates().first();
2547 QDateTime current = QDateTime::currentDateTime(); 2551 QDateTime current = QDateTime::currentDateTime();
2548 if ( date <= current.date() ) { 2552 if ( date <= current.date() ) {
2549 int hour = current.time().hour() +1; 2553 int hour = current.time().hour() +1;
2550 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 2554 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
2551 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2555 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2552 } else 2556 } else
2553 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 2557 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index a12acd1..9cafc60 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -281,192 +281,193 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e )
281 default: 281 default:
282 e->ignore(); 282 e->ignore();
283 break; 283 break;
284 } 284 }
285 return; 285 return;
286 } 286 }
287 e->ignore(); 287 e->ignore();
288} 288}
289void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 289void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
290{ 290{
291 QListView::contentsMouseReleaseEvent(e); 291 QListView::contentsMouseReleaseEvent(e);
292 mMousePressed = false; 292 mMousePressed = false;
293} 293}
294 294
295void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 295void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
296{ 296{
297 if (!e) return; 297 if (!e) return;
298 298
299 QPoint vp = contentsToViewport(e->pos()); 299 QPoint vp = contentsToViewport(e->pos());
300 300
301 QListViewItem *item = itemAt(vp); 301 QListViewItem *item = itemAt(vp);
302 302
303 emit double_Clicked(item); 303 emit double_Clicked(item);
304 if (!item) return; 304 if (!item) return;
305 305
306 emit doubleClicked(item,vp,0); 306 emit doubleClicked(item,vp,0);
307} 307}
308 308
309///////////////////////////////////////////////////////////////////////////// 309/////////////////////////////////////////////////////////////////////////////
310 310
311KOQuickTodo::KOQuickTodo(QWidget *parent) : 311KOQuickTodo::KOQuickTodo(QWidget *parent) :
312 QLineEdit(parent) 312 QLineEdit(parent)
313{ 313{
314 setText(i18n("Click to add a new Todo")); 314 setText(i18n("Click to add a new Todo"));
315} 315}
316 316
317void KOQuickTodo::focusInEvent(QFocusEvent *ev) 317void KOQuickTodo::focusInEvent(QFocusEvent *ev)
318{ 318{
319 if ( text()==i18n("Click to add a new Todo") ) 319 if ( text()==i18n("Click to add a new Todo") )
320 setText(""); 320 setText("");
321 QLineEdit::focusInEvent(ev); 321 QLineEdit::focusInEvent(ev);
322} 322}
323 323
324void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 324void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
325{ 325{
326 setText(i18n("Click to add a new Todo")); 326 setText(i18n("Click to add a new Todo"));
327 QLineEdit::focusOutEvent(ev); 327 QLineEdit::focusOutEvent(ev);
328} 328}
329 329
330///////////////////////////////////////////////////////////////////////////// 330/////////////////////////////////////////////////////////////////////////////
331 331
332KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 332KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
333 KOrg::BaseView(calendar,parent,name) 333 KOrg::BaseView(calendar,parent,name)
334{ 334{
335 QBoxLayout *topLayout = new QVBoxLayout(this); 335 QBoxLayout *topLayout = new QVBoxLayout(this);
336 mName = QString ( name ); 336 mName = QString ( name );
337 mBlockUpdate = false; 337 mBlockUpdate = false;
338 mQuickAdd = new KOQuickTodo(this); 338 mQuickAdd = new KOQuickTodo(this);
339 topLayout->addWidget(mQuickAdd); 339 topLayout->addWidget(mQuickAdd);
340 340
341 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 341 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
342 342
343 mTodoListView = new KOTodoListView(calendar,this, name ); 343 mTodoListView = new KOTodoListView(calendar,this, name );
344 topLayout->addWidget(mTodoListView); 344 topLayout->addWidget(mTodoListView);
345 //mTodoListView->header()->setMaximumHeight(30); 345 //mTodoListView->header()->setMaximumHeight(30);
346 mTodoListView->setRootIsDecorated(true); 346 mTodoListView->setRootIsDecorated(true);
347 mTodoListView->setAllColumnsShowFocus(true); 347 mTodoListView->setAllColumnsShowFocus(true);
348 348
349 mTodoListView->setShowSortIndicator(true); 349 mTodoListView->setShowSortIndicator(true);
350 350
351 mTodoListView->addColumn(i18n("Todo")); 351 mTodoListView->addColumn(i18n("Todo"));
352 mTodoListView->addColumn(i18n("Prio")); 352 mTodoListView->addColumn(i18n("Prio"));
353 mTodoListView->setColumnAlignment(1,AlignHCenter); 353 mTodoListView->setColumnAlignment(1,AlignHCenter);
354 mTodoListView->addColumn(i18n("Complete")); 354 mTodoListView->addColumn(i18n("Complete"));
355 mTodoListView->setColumnAlignment(2,AlignHCenter); 355 mTodoListView->setColumnAlignment(2,AlignHCenter);
356 mTodoListView->addColumn(i18n("Due Date")); 356 mTodoListView->addColumn(i18n("Due Date"));
357 mTodoListView->setColumnAlignment(3,AlignLeft); 357 mTodoListView->setColumnAlignment(3,AlignLeft);
358 mTodoListView->addColumn(i18n("Due Time")); 358 mTodoListView->addColumn(i18n("Due Time"));
359 mTodoListView->setColumnAlignment(4,AlignHCenter); 359 mTodoListView->setColumnAlignment(4,AlignHCenter);
360 mTodoListView->addColumn(i18n("Cancelled")); 360 mTodoListView->addColumn(i18n("Cancelled"));
361 mTodoListView->addColumn(i18n("Categories")); 361 mTodoListView->addColumn(i18n("Categories"));
362#if 0 362#if 0
363 mTodoListView->addColumn(i18n("Sort Id")); 363 mTodoListView->addColumn(i18n("Sort Id"));
364 mTodoListView->setColumnAlignment(4,AlignHCenter); 364 mTodoListView->setColumnAlignment(4,AlignHCenter);
365#endif 365#endif
366 366
367 mTodoListView->setMinimumHeight( 60 ); 367 mTodoListView->setMinimumHeight( 60 );
368 mTodoListView->setItemsRenameable( true ); 368 mTodoListView->setItemsRenameable( true );
369 mTodoListView->setRenameable( 0 ); 369 mTodoListView->setRenameable( 0 );
370 mTodoListView->setColumnWidth( 0, 120 ); 370 mTodoListView->setColumnWidth( 0, 120 );
371 mTodoListView->setColumnWidthMode(0, QListView::Manual); 371 mTodoListView->setColumnWidthMode(0, QListView::Manual);
372 mTodoListView->setColumnWidthMode(1, QListView::Manual); 372 mTodoListView->setColumnWidthMode(1, QListView::Manual);
373 mTodoListView->setColumnWidthMode(2, QListView::Manual); 373 mTodoListView->setColumnWidthMode(2, QListView::Manual);
374 mTodoListView->setColumnWidthMode(3, QListView::Manual); 374 mTodoListView->setColumnWidthMode(3, QListView::Manual);
375 mTodoListView->setColumnWidthMode(4, QListView::Manual); 375 mTodoListView->setColumnWidthMode(4, QListView::Manual);
376 mTodoListView->setColumnWidthMode(5, QListView::Manual); 376 mTodoListView->setColumnWidthMode(5, QListView::Manual);
377 mTodoListView->setColumnWidthMode(6, QListView::Manual);
377 mTodoListView->setColumnAlignment( 2, AlignCenter ); 378 mTodoListView->setColumnAlignment( 2, AlignCenter );
378#if 0 379#if 0
379 mTodoListView->setColumnWidthMode(6, QListView::Manual); 380 mTodoListView->setColumnWidthMode(6, QListView::Manual);
380#endif 381#endif
381 382
382 mPriorityPopupMenu = new QPopupMenu(this); 383 mPriorityPopupMenu = new QPopupMenu(this);
383 for (int i = 1; i <= 5; i++) { 384 for (int i = 1; i <= 5; i++) {
384 QString label = QString ("%1").arg (i); 385 QString label = QString ("%1").arg (i);
385 mPriority[mPriorityPopupMenu->insertItem (label)] = i; 386 mPriority[mPriorityPopupMenu->insertItem (label)] = i;
386 } 387 }
387 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); 388 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
388 389
389 mPercentageCompletedPopupMenu = new QPopupMenu(this); 390 mPercentageCompletedPopupMenu = new QPopupMenu(this);
390 for (int i = 0; i <= 100; i+=20) { 391 for (int i = 0; i <= 100; i+=20) {
391 QString label = QString ("%1 %").arg (i); 392 QString label = QString ("%1 %").arg (i);
392 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; 393 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
393 } 394 }
394 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); 395 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
395 396
396 397
397 398
398 mItemPopupMenu = new QPopupMenu(this); 399 mItemPopupMenu = new QPopupMenu(this);
399 mItemPopupMenu->insertItem(i18n("Show..."), this, 400 mItemPopupMenu->insertItem(i18n("Show..."), this,
400 SLOT (showTodo())); 401 SLOT (showTodo()));
401 mItemPopupMenu->insertItem(i18n("Edit..."), this, 402 mItemPopupMenu->insertItem(i18n("Edit..."), this,
402 SLOT (editTodo())); 403 SLOT (editTodo()));
403 mItemPopupMenu->insertItem( i18n("Delete"), this, 404 mItemPopupMenu->insertItem( i18n("Delete"), this,
404 SLOT (deleteTodo())); 405 SLOT (deleteTodo()));
405 mItemPopupMenu->insertItem( i18n("Clone..."), this, 406 mItemPopupMenu->insertItem( i18n("Clone..."), this,
406 SLOT (cloneTodo())); 407 SLOT (cloneTodo()));
407 mItemPopupMenu->insertItem( i18n("Move..."), this, 408 mItemPopupMenu->insertItem( i18n("Move..."), this,
408 SLOT (moveTodo())); 409 SLOT (moveTodo()));
409 mItemPopupMenu->insertItem( i18n("Beam..."), this, 410 mItemPopupMenu->insertItem( i18n("Beam..."), this,
410 SLOT (beamTodo())); 411 SLOT (beamTodo()));
411 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 412 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
412 SLOT (cancelTodo())); 413 SLOT (cancelTodo()));
413 mItemPopupMenu->insertSeparator(); 414 mItemPopupMenu->insertSeparator();
414 415
415 mItemPopupMenu->insertItem( i18n("New Todo..."), this, 416 mItemPopupMenu->insertItem( i18n("New Todo..."), this,
416 SLOT (newTodo())); 417 SLOT (newTodo()));
417 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, 418 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
418 SLOT (newSubTodo())); 419 SLOT (newSubTodo()));
419 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, 420 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
420 SLOT (unparentTodo()),0,21); 421 SLOT (unparentTodo()),0,21);
421 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, 422 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
422 SLOT (reparentTodo()),0,22); 423 SLOT (reparentTodo()),0,22);
423 mItemPopupMenu->insertSeparator(); 424 mItemPopupMenu->insertSeparator();
424 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), 425 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"),
425 this, SLOT( purgeCompleted() ) ); 426 this, SLOT( purgeCompleted() ) );
426 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), 427 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
427 this, SLOT( toggleCompleted() ),0, 33 ); 428 this, SLOT( toggleCompleted() ),0, 33 );
428 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 429 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
429 this, SLOT( toggleQuickTodo() ),0, 34 ); 430 this, SLOT( toggleQuickTodo() ),0, 34 );
430 431
431 mPopupMenu = new QPopupMenu(this); 432 mPopupMenu = new QPopupMenu(this);
432 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, 433 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this,
433 SLOT (newTodo()),0,1); 434 SLOT (newTodo()),0,1);
434 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), 435 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"),
435 this, SLOT(purgeCompleted()),0,2); 436 this, SLOT(purgeCompleted()),0,2);
436 mPopupMenu->insertItem(i18n("Show Completed"), 437 mPopupMenu->insertItem(i18n("Show Completed"),
437 this, SLOT( toggleCompleted() ),0,3 ); 438 this, SLOT( toggleCompleted() ),0,3 );
438 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 439 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
439 this, SLOT( toggleQuickTodo() ),0,4 ); 440 this, SLOT( toggleQuickTodo() ),0,4 );
440 mDocPrefs = new DocPrefs( name ); 441 mDocPrefs = new DocPrefs( name );
441 442
442 mPopupMenu->setCheckable( true ); 443 mPopupMenu->setCheckable( true );
443 mItemPopupMenu->setCheckable( true ); 444 mItemPopupMenu->setCheckable( true );
444 // Double clicking conflicts with opening/closing the subtree 445 // Double clicking conflicts with opening/closing the subtree
445 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 446 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ),
446 SLOT( editItem( QListViewItem *) ) ); 447 SLOT( editItem( QListViewItem *) ) );
447 /* 448 /*
448 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 449 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
449 const QPoint &,int ) ), 450 const QPoint &,int ) ),
450 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 451 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
451 */ 452 */
452 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, 453 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *,
453 const QPoint &,int ) ), 454 const QPoint &,int ) ),
454 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 455 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
455 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 456 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
456 SLOT( itemClicked( QListViewItem * ) ) ); 457 SLOT( itemClicked( QListViewItem * ) ) );
457 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 458 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
458 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 459 SLOT( itemDoubleClicked( QListViewItem * ) ) );
459 connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ), 460 connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ),
460 SLOT( updateView() ) ); 461 SLOT( updateView() ) );
461 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 462 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
462 SLOT( itemStateChanged( QListViewItem * ) ) ); 463 SLOT( itemStateChanged( QListViewItem * ) ) );
463 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 464 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
464 SLOT( itemStateChanged( QListViewItem * ) ) ); 465 SLOT( itemStateChanged( QListViewItem * ) ) );
465 466
466#if 0 467#if 0
467 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 468 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
468 SLOT(selectionChanged(QListViewItem *))); 469 SLOT(selectionChanged(QListViewItem *)));
469 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 470 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
470 SLOT(selectionChanged(QListViewItem *))); 471 SLOT(selectionChanged(QListViewItem *)));
471 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 472 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
472 SLOT(selectionChanged(QListViewItem *))); 473 SLOT(selectionChanged(QListViewItem *)));
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 85647b1..ae0b334 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -1,141 +1,141 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
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 19
20#include <klocale.h> 20#include <klocale.h>
21#include <kdebug.h> 21#include <kdebug.h>
22#include <qapp.h> 22#include <qapp.h>
23 23
24#include <kiconloader.h> 24#include <kiconloader.h>
25#include "kotodoviewitem.h" 25#include "kotodoviewitem.h"
26#include "kotodoview.h" 26#include "kotodoview.h"
27#include "koprefs.h" 27#include "koprefs.h"
28 28
29KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) 29KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo)
30 : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) 30 : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
31{ 31{
32 construct(); 32 construct();
33} 33}
34 34
35KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) 35KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo )
36 : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) 36 : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
37{ 37{
38 construct(); 38 construct();
39} 39}
40 40
41QString KOTodoViewItem::key(int column,bool) const 41QString KOTodoViewItem::key(int column,bool) const
42{ 42{
43 QMap<int,QString>::ConstIterator it = mKeyMap.find(column); 43 QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
44 if (it == mKeyMap.end()) { 44 if (it == mKeyMap.end()) {
45 return text(column); 45 return text(column).lower();
46 } else { 46 } else {
47 return *it; 47 return *it;
48 } 48 }
49} 49}
50 50
51void KOTodoViewItem:: setup() 51void KOTodoViewItem:: setup()
52{ 52{
53 53
54 int h = 20; 54 int h = 20;
55 if ( listView () ) { 55 if ( listView () ) {
56 QFontMetrics fm ( listView ()->font () ); 56 QFontMetrics fm ( listView ()->font () );
57 h = fm.height(); 57 h = fm.height();
58 } 58 }
59 setHeight( h ); 59 setHeight( h );
60 60
61} 61}
62void KOTodoViewItem::setSortKey(int column,const QString &key) 62void KOTodoViewItem::setSortKey(int column,const QString &key)
63{ 63{
64 mKeyMap.insert(column,key); 64 mKeyMap.insert(column,key);
65} 65}
66 66
67#if QT_VERSION >= 300 67#if QT_VERSION >= 300
68void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, 68void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w,
69 int y,int h) 69 int y,int h)
70{ 70{
71 QListViewItem::paintBranches(p,cg,w,y,h); 71 QListViewItem::paintBranches(p,cg,w,y,h);
72} 72}
73#else 73#else
74#endif 74#endif
75 75
76void KOTodoViewItem::construct() 76void KOTodoViewItem::construct()
77{ 77{
78 // qDebug("KOTodoViewItem::construct() "); 78 // qDebug("KOTodoViewItem::construct() ");
79 m_init = true; 79 m_init = true;
80 QString keyd = "=="; 80 QString keyd = "==";
81 QString keyt = "=="; 81 QString keyt = "==";
82 82
83 setOn(mTodo->isCompleted()); 83 setOn(mTodo->isCompleted());
84 setText(0,mTodo->summary()); 84 setText(0,mTodo->summary());
85 setText(1,QString::number(mTodo->priority())); 85 setText(1,QString::number(mTodo->priority()));
86 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); 86 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete())));
87 if (mTodo->percentComplete()<100) { 87 if (mTodo->percentComplete()<100) {
88 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 88 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
89 else setSortKey(2,QString::number(mTodo->percentComplete())); 89 else setSortKey(2,QString::number(mTodo->percentComplete()));
90 } 90 }
91 else { 91 else {
92 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 92 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
93 else setSortKey(2,QString::number(99)); 93 else setSortKey(2,QString::number(99));
94 } 94 }
95 if (mTodo->hasDueDate()) { 95 if (mTodo->hasDueDate()) {
96 setText(3, mTodo->dtDueDateStr()); 96 setText(3, mTodo->dtDueDateStr());
97 QDate d = mTodo->dtDue().date(); 97 QDate d = mTodo->dtDue().date();
98 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 98 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
99 setSortKey(3,keyd); 99 setSortKey(3,keyd);
100 if (mTodo->doesFloat()) { 100 if (mTodo->doesFloat()) {
101 setText(4,""); 101 setText(4,"");
102 } 102 }
103 else { 103 else {
104 setText(4,mTodo->dtDueTimeStr()); 104 setText(4,mTodo->dtDueTimeStr());
105 QTime t = mTodo->dtDue().time(); 105 QTime t = mTodo->dtDue().time();
106 keyt.sprintf("%02d%02d",t.hour(),t.minute()); 106 keyt.sprintf("%02d%02d",t.hour(),t.minute());
107 setSortKey(4,keyt); 107 setSortKey(4,keyt);
108 } 108 }
109 } else { 109 } else {
110 setText(3,""); 110 setText(3,"");
111 setText(4,""); 111 setText(4,"");
112 } 112 }
113 setSortKey(3,keyd); 113 setSortKey(3,keyd);
114 setSortKey(4,keyt); 114 setSortKey(4,keyt);
115 115
116 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); 116 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt);
117 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 117 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
118 118
119 setText(5,mTodo->cancelled() ? i18n("Yes") : i18n("No")); 119 setText(5,mTodo->cancelled() ? i18n("Yes") : i18n("No"));
120 setText(6,mTodo->categoriesStr()); 120 setText(6,mTodo->categoriesStr());
121 121
122#if 0 122#if 0
123 // Find sort id in description. It's the text behind the last '#' character 123 // Find sort id in description. It's the text behind the last '#' character
124 // found in the description. White spaces are removed from beginning and end 124 // found in the description. White spaces are removed from beginning and end
125 // of sort id. 125 // of sort id.
126 int pos = mTodo->description().findRev('#'); 126 int pos = mTodo->description().findRev('#');
127 if (pos < 0) { 127 if (pos < 0) {
128 setText(6,""); 128 setText(6,"");
129 } else { 129 } else {
130 QString str = mTodo->description().mid(pos+1); 130 QString str = mTodo->description().mid(pos+1);
131 str.stripWhiteSpace(); 131 str.stripWhiteSpace();
132 setText(6,str); 132 setText(6,str);
133 } 133 }
134#endif 134#endif
135 135
136 m_known = false; 136 m_known = false;
137 m_init = false; 137 m_init = false;
138 138
139 setMyPixmap(); 139 setMyPixmap();
140 140
141} 141}