-rw-r--r-- | korganizer/kolistview.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 7022e02..be51694 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -379,50 +379,50 @@ void KOListView::updateList() | |||
379 | 379 | ||
380 | void KOListView::clearList() | 380 | void KOListView::clearList() |
381 | { | 381 | { |
382 | clear (); | 382 | clear (); |
383 | } | 383 | } |
384 | void KOListView::addCat( ) | 384 | void KOListView::addCat( ) |
385 | { | 385 | { |
386 | setCategories( false ); | 386 | setCategories( false ); |
387 | } | 387 | } |
388 | void KOListView::setCat() | 388 | void KOListView::setCat() |
389 | { | 389 | { |
390 | setCategories( true ); | 390 | setCategories( true ); |
391 | } | 391 | } |
392 | void KOListView::setAlarm() | 392 | void KOListView::setAlarm() |
393 | { | 393 | { |
394 | KOAlarmPrefs kap( this); | 394 | KOAlarmPrefs kap( this); |
395 | if ( !kap.exec() ) | 395 | if ( !kap.exec() ) |
396 | return; | 396 | return; |
397 | QStringList itemList; | 397 | QStringList itemList; |
398 | QPtrList<KOListViewItem> sel ; | 398 | QPtrList<KOListViewItem> sel ; |
399 | QListViewItem *qitem = mListView->firstChild (); | 399 | QListViewItem *qitem = mListView->firstChild (); |
400 | while ( qitem ) { | 400 | while ( qitem ) { |
401 | if ( qitem->isSelected() ) { | 401 | if ( qitem->isSelected() ) { |
402 | Incidence* inc = ((KOListViewItem *) qitem)->data(); | 402 | Incidence* inc = ((KOListViewItem *) qitem)->data(); |
403 | if ( inc->type() != "Journal" ) { | 403 | if ( inc->typeID() != journalID ) { |
404 | if ( inc->type() == "Todo" ) { | 404 | if ( inc->typeID() == todoID ) { |
405 | if ( ((Todo*)inc)->hasDueDate() ) | 405 | if ( ((Todo*)inc)->hasDueDate() ) |
406 | sel.append(((KOListViewItem *)qitem)); | 406 | sel.append(((KOListViewItem *)qitem)); |
407 | } else | 407 | } else |
408 | sel.append(((KOListViewItem *)qitem)); | 408 | sel.append(((KOListViewItem *)qitem)); |
409 | } | 409 | } |
410 | } | 410 | } |
411 | qitem = qitem->nextSibling(); | 411 | qitem = qitem->nextSibling(); |
412 | } | 412 | } |
413 | int count = 0; | 413 | int count = 0; |
414 | KOListViewItem * item, *temp; | 414 | KOListViewItem * item, *temp; |
415 | item = sel.first(); | 415 | item = sel.first(); |
416 | Incidence* inc; | 416 | Incidence* inc; |
417 | while ( item ) { | 417 | while ( item ) { |
418 | inc = item->data(); | 418 | inc = item->data(); |
419 | ++count; | 419 | ++count; |
420 | if (kap.mAlarmButton->isChecked()) { | 420 | if (kap.mAlarmButton->isChecked()) { |
421 | if (inc->alarms().count() == 0) | 421 | if (inc->alarms().count() == 0) |
422 | inc->newAlarm(); | 422 | inc->newAlarm(); |
423 | QPtrList<Alarm> alarms = inc->alarms(); | 423 | QPtrList<Alarm> alarms = inc->alarms(); |
424 | Alarm *alarm; | 424 | Alarm *alarm; |
425 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 425 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
426 | alarm->setEnabled(true); | 426 | alarm->setEnabled(true); |
427 | int j = kap.mAlarmTimeEdit->value()* -60; | 427 | int j = kap.mAlarmTimeEdit->value()* -60; |
428 | if (kap.mAlarmIncrCombo->currentItem() == 1) | 428 | if (kap.mAlarmIncrCombo->currentItem() == 1) |
@@ -467,49 +467,49 @@ void KOListView::setCategories( bool removeOld ) | |||
467 | delete csd; | 467 | delete csd; |
468 | return; | 468 | return; |
469 | } | 469 | } |
470 | QStringList catList = csd->selectedCategories(); | 470 | QStringList catList = csd->selectedCategories(); |
471 | delete csd; | 471 | delete csd; |
472 | // if ( catList.count() == 0 ) | 472 | // if ( catList.count() == 0 ) |
473 | // return; | 473 | // return; |
474 | //catList.sort(); | 474 | //catList.sort(); |
475 | QString categoriesStr = catList.join(","); | 475 | QString categoriesStr = catList.join(","); |
476 | int i; | 476 | int i; |
477 | QStringList itemList; | 477 | QStringList itemList; |
478 | QPtrList<KOListViewItem> sel ; | 478 | QPtrList<KOListViewItem> sel ; |
479 | QListViewItem *qitem = mListView->firstChild (); | 479 | QListViewItem *qitem = mListView->firstChild (); |
480 | while ( qitem ) { | 480 | while ( qitem ) { |
481 | if ( qitem->isSelected() ) { | 481 | if ( qitem->isSelected() ) { |
482 | sel.append(((KOListViewItem *)qitem)); | 482 | sel.append(((KOListViewItem *)qitem)); |
483 | } | 483 | } |
484 | qitem = qitem->nextSibling(); | 484 | qitem = qitem->nextSibling(); |
485 | } | 485 | } |
486 | KOListViewItem * item, *temp; | 486 | KOListViewItem * item, *temp; |
487 | item = sel.first(); | 487 | item = sel.first(); |
488 | if( item ) { | 488 | if( item ) { |
489 | Incidence* inc = item->data() ; | 489 | Incidence* inc = item->data() ; |
490 | bool setSub = false; | 490 | bool setSub = false; |
491 | if( inc->type() == "Todo" && sel.count() == 1 && inc->relations().count() > 0 ) { | 491 | if( inc->typeID() == todoID && sel.count() == 1 && inc->relations().count() > 0 ) { |
492 | int result = KMessageBox::warningYesNoCancel(this, | 492 | int result = KMessageBox::warningYesNoCancel(this, |
493 | i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ), | 493 | i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ), |
494 | i18n("Todo has subtodos"), | 494 | i18n("Todo has subtodos"), |
495 | i18n("Yes"), | 495 | i18n("Yes"), |
496 | i18n("No")); | 496 | i18n("No")); |
497 | if (result == KMessageBox::Cancel) item = 0; | 497 | if (result == KMessageBox::Cancel) item = 0; |
498 | if (result == KMessageBox::Yes) setSub = true; | 498 | if (result == KMessageBox::Yes) setSub = true; |
499 | } | 499 | } |
500 | while ( item ) { | 500 | while ( item ) { |
501 | inc = item->data(); | 501 | inc = item->data(); |
502 | if ( removeOld ) { | 502 | if ( removeOld ) { |
503 | inc->setCategories( catList, setSub ); | 503 | inc->setCategories( catList, setSub ); |
504 | } else { | 504 | } else { |
505 | inc->addCategories( catList, setSub ); | 505 | inc->addCategories( catList, setSub ); |
506 | } | 506 | } |
507 | ListItemVisitor v(item, mStartDate ); | 507 | ListItemVisitor v(item, mStartDate ); |
508 | inc->accept(v); | 508 | inc->accept(v); |
509 | item = sel.next(); | 509 | item = sel.next(); |
510 | } | 510 | } |
511 | } | 511 | } |
512 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 512 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
513 | } | 513 | } |
514 | 514 | ||
515 | void KOListView::beamSelected() | 515 | void KOListView::beamSelected() |
@@ -590,107 +590,107 @@ void KOListView::saveDescriptionToFile() | |||
590 | QString fn = KOPrefs::instance()->mLastSaveFile; | 590 | QString fn = KOPrefs::instance()->mLastSaveFile; |
591 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 591 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
592 | 592 | ||
593 | if ( fn == "" ) | 593 | if ( fn == "" ) |
594 | return; | 594 | return; |
595 | QFileInfo info; | 595 | QFileInfo info; |
596 | info.setFile( fn ); | 596 | info.setFile( fn ); |
597 | QString mes; | 597 | QString mes; |
598 | bool createbup = true; | 598 | bool createbup = true; |
599 | if ( info. exists() ) { | 599 | if ( info. exists() ) { |
600 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 600 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
601 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 601 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
602 | i18n("Overwrite!"), i18n("Cancel"), 0, | 602 | i18n("Overwrite!"), i18n("Cancel"), 0, |
603 | 0, 1 ); | 603 | 0, 1 ); |
604 | if ( result != 0 ) { | 604 | if ( result != 0 ) { |
605 | createbup = false; | 605 | createbup = false; |
606 | } | 606 | } |
607 | } | 607 | } |
608 | if ( createbup ) { | 608 | if ( createbup ) { |
609 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + | 609 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + |
610 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); | 610 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); |
611 | Incidence *incidence = delSel.first(); | 611 | Incidence *incidence = delSel.first(); |
612 | icount = 0; | 612 | icount = 0; |
613 | while ( incidence ) { | 613 | while ( incidence ) { |
614 | if ( incidence->type() == "Journal" ) { | 614 | if ( incidence->typeID() == journalID ) { |
615 | text += "\n************************************\n"; | 615 | text += "\n************************************\n"; |
616 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); | 616 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); |
617 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 617 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
618 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); | 618 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); |
619 | ++icount; | 619 | ++icount; |
620 | 620 | ||
621 | } else { | 621 | } else { |
622 | if ( !incidence->description().isEmpty() ) { | 622 | if ( !incidence->description().isEmpty() ) { |
623 | text += "\n************************************\n"; | 623 | text += "\n************************************\n"; |
624 | if ( incidence->type() == "Todo" ) | 624 | if ( incidence->typeID() == todoID ) |
625 | text += i18n("To-Do: "); | 625 | text += i18n("To-Do: "); |
626 | text += incidence->summary(); | 626 | text += incidence->summary(); |
627 | if ( incidence->hasStartDate() ) | 627 | if ( incidence->hasStartDate() ) |
628 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); | 628 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); |
629 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 629 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
630 | if ( !incidence->location().isEmpty() ) | 630 | if ( !incidence->location().isEmpty() ) |
631 | text += "\n" +i18n("Location: ") + incidence->location(); | 631 | text += "\n" +i18n("Location: ") + incidence->location(); |
632 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); | 632 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); |
633 | ++icount; | 633 | ++icount; |
634 | 634 | ||
635 | } | 635 | } |
636 | } | 636 | } |
637 | incidence = delSel.next(); | 637 | incidence = delSel.next(); |
638 | } | 638 | } |
639 | QFile file( fn ); | 639 | QFile file( fn ); |
640 | if (!file.open( IO_WriteOnly ) ) { | 640 | if (!file.open( IO_WriteOnly ) ) { |
641 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); | 641 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); |
642 | return; | 642 | return; |
643 | } | 643 | } |
644 | QTextStream ts( &file ); | 644 | QTextStream ts( &file ); |
645 | ts << text; | 645 | ts << text; |
646 | file.close(); | 646 | file.close(); |
647 | //qDebug("%s ", text.latin1()); | 647 | //qDebug("%s ", text.latin1()); |
648 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); | 648 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); |
649 | KOPrefs::instance()->mLastSaveFile = fn; | 649 | KOPrefs::instance()->mLastSaveFile = fn; |
650 | topLevelWidget()->setCaption(mes); | 650 | topLevelWidget()->setCaption(mes); |
651 | } | 651 | } |
652 | } | 652 | } |
653 | } | 653 | } |
654 | void KOListView::saveToFileVCS() | 654 | void KOListView::saveToFileVCS() |
655 | { | 655 | { |
656 | writeToFile( false ); | 656 | writeToFile( false ); |
657 | } | 657 | } |
658 | void KOListView::saveToFile() | 658 | void KOListView::saveToFile() |
659 | { | 659 | { |
660 | writeToFile( true ); | 660 | writeToFile( true ); |
661 | } | 661 | } |
662 | void KOListView::writeToFile( bool iCal ) | 662 | void KOListView::writeToFile( bool iCal ) |
663 | { | 663 | { |
664 | 664 | ||
665 | int icount = 0; | 665 | int icount = 0; |
666 | QPtrList<Incidence> delSel ; | 666 | QPtrList<Incidence> delSel ; |
667 | QListViewItem *item = mListView->firstChild (); | 667 | QListViewItem *item = mListView->firstChild (); |
668 | bool journal = iCal; // warn only for vCal | 668 | bool journal = iCal; // warn only for vCal |
669 | while ( item ) { | 669 | while ( item ) { |
670 | if ( item->isSelected() ) { | 670 | if ( item->isSelected() ) { |
671 | if ( !journal ) | 671 | if ( !journal ) |
672 | if ( ((KOListViewItem *)item)->data()->type() == "Journal") | 672 | if ( ((KOListViewItem *)item)->data()->typeID() == journalID ) |
673 | journal = true; | 673 | journal = true; |
674 | delSel.append(((KOListViewItem *)item)->data()); | 674 | delSel.append(((KOListViewItem *)item)->data()); |
675 | ++icount; | 675 | ++icount; |
676 | } | 676 | } |
677 | 677 | ||
678 | item = item->nextSibling(); | 678 | item = item->nextSibling(); |
679 | } | 679 | } |
680 | if ( !iCal && journal ) { | 680 | if ( !iCal && journal ) { |
681 | int result = KMessageBox::warningContinueCancel(this, | 681 | int result = KMessageBox::warningContinueCancel(this, |
682 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 682 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
683 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 683 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
684 | true); | 684 | true); |
685 | if (result != KMessageBox::Continue) return; | 685 | if (result != KMessageBox::Continue) return; |
686 | } | 686 | } |
687 | if ( icount ) { | 687 | if ( icount ) { |
688 | QString fn = KOPrefs::instance()->mLastSaveFile; | 688 | QString fn = KOPrefs::instance()->mLastSaveFile; |
689 | QString extension; | 689 | QString extension; |
690 | if ( iCal ) { | 690 | if ( iCal ) { |
691 | if ( fn.right( 4 ).lower() == ".vcs" ) { | 691 | if ( fn.right( 4 ).lower() == ".vcs" ) { |
692 | fn = fn.left( fn.length() -3) + "ics"; | 692 | fn = fn.left( fn.length() -3) + "ics"; |
693 | } | 693 | } |
694 | } else { | 694 | } else { |
695 | if ( fn.right( 4 ).lower() == ".ics" ) { | 695 | if ( fn.right( 4 ).lower() == ".ics" ) { |
696 | fn = fn.left( fn.length() -3) + "vcs"; | 696 | fn = fn.left( fn.length() -3) + "vcs"; |