summaryrefslogtreecommitdiffabout
path: root/korganizer/kolistview.cpp
Unidiff
Diffstat (limited to 'korganizer/kolistview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kolistview.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 341f473..e1b393d 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -318,32 +318,33 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
318 this,SLOT(defaultItemAction(QListViewItem *))); 318 this,SLOT(defaultItemAction(QListViewItem *)));
319 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, 319 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
320 const QPoint &, int )), 320 const QPoint &, int )),
321 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 321 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
322 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 322 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
323 SLOT(processSelectionChange(QListViewItem *))); 323 SLOT(processSelectionChange(QListViewItem *)));
324 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 324 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
325 SIGNAL(showIncidenceSignal(Incidence *)) ); 325 SIGNAL(showIncidenceSignal(Incidence *)) );
326 326
327 readSettings(KOGlobals::config(),"KOListView Layout"); 327 readSettings(KOGlobals::config(),"KOListView Layout");
328} 328}
329 329
330KOListView::~KOListView() 330KOListView::~KOListView()
331{ 331{
332 delete mPopupMenu; 332 delete mPopupMenu;
333} 333}
334
334QString KOListView::getWhatsThisText(QPoint p) 335QString KOListView::getWhatsThisText(QPoint p)
335{ 336{
336 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 337 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
337 if ( item ) 338 if ( item )
338 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 339 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
339 KOPrefs::instance()->mWTshowDetails, 340 KOPrefs::instance()->mWTshowDetails,
340 KOPrefs::instance()->mWTshowCreated, 341 KOPrefs::instance()->mWTshowCreated,
341 KOPrefs::instance()->mWTshowChanged); 342 KOPrefs::instance()->mWTshowChanged);
342 return i18n("That is the list view" ); 343 return i18n("That is the list view" );
343 344
344} 345}
345 346
346void KOListView::updateList() 347void KOListView::updateList()
347{ 348{
348 // qDebug(" KOListView::updateList() "); 349 // qDebug(" KOListView::updateList() ");
349 350
@@ -415,32 +416,33 @@ void KOListView::setAlarm()
415 } else { 416 } else {
416 Alarm* alarm = inc->alarms().first(); 417 Alarm* alarm = inc->alarms().first();
417 if ( alarm ) { 418 if ( alarm ) {
418 alarm->setEnabled(false); 419 alarm->setEnabled(false);
419 alarm->setType(Alarm::Invalid); 420 alarm->setType(Alarm::Invalid);
420 } 421 }
421 } 422 }
422 temp = item; 423 temp = item;
423 item = sel.next(); 424 item = sel.next();
424 mUidDict.remove( inc->uid() ); 425 mUidDict.remove( inc->uid() );
425 delete temp;; 426 delete temp;;
426 addIncidence( inc ); 427 addIncidence( inc );
427 } 428 }
428 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); 429 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) );
429 qDebug("KO: Set alarm for %d items", count); 430 qDebug("KO: Set alarm for %d items", count);
430 calendar()->reInitAlarmSettings(); 431 calendar()->reInitAlarmSettings();
432 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
431} 433}
432void KOListView::setCategories( bool removeOld ) 434void KOListView::setCategories( bool removeOld )
433{ 435{
434 436
435 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 437 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
436 if (! csd->exec()) { 438 if (! csd->exec()) {
437 delete csd; 439 delete csd;
438 return; 440 return;
439 } 441 }
440 QStringList catList = csd->selectedCategories(); 442 QStringList catList = csd->selectedCategories();
441 delete csd; 443 delete csd;
442 // if ( catList.count() == 0 ) 444 // if ( catList.count() == 0 )
443 // return; 445 // return;
444 catList.sort(); 446 catList.sort();
445 QString categoriesStr = catList.join(","); 447 QString categoriesStr = catList.join(",");
446 int i; 448 int i;
@@ -462,32 +464,33 @@ void KOListView::setCategories( bool removeOld )
462 inc->setCategories( categoriesStr ); 464 inc->setCategories( categoriesStr );
463 } else { 465 } else {
464 itemList = QStringList::split (",", inc->categoriesStr() ); 466 itemList = QStringList::split (",", inc->categoriesStr() );
465 for( i = 0; i< catList.count(); ++i ) { 467 for( i = 0; i< catList.count(); ++i ) {
466 if ( !itemList.contains (catList[i])) 468 if ( !itemList.contains (catList[i]))
467 itemList.append( catList[i] ); 469 itemList.append( catList[i] );
468 } 470 }
469 itemList.sort(); 471 itemList.sort();
470 inc->setCategories( itemList.join(",") ); 472 inc->setCategories( itemList.join(",") );
471 } 473 }
472 temp = item; 474 temp = item;
473 item = sel.next(); 475 item = sel.next();
474 mUidDict.remove( inc->uid() ); 476 mUidDict.remove( inc->uid() );
475 delete temp;; 477 delete temp;;
476 addIncidence( inc ); 478 addIncidence( inc );
477 } 479 }
480 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
478} 481}
479 482
480void KOListView::beamSelected() 483void KOListView::beamSelected()
481{ 484{
482 int icount = 0; 485 int icount = 0;
483 QPtrList<Incidence> delSel ; 486 QPtrList<Incidence> delSel ;
484 QListViewItem *item = mListView->firstChild (); 487 QListViewItem *item = mListView->firstChild ();
485 while ( item ) { 488 while ( item ) {
486 if ( item->isSelected() ) { 489 if ( item->isSelected() ) {
487 delSel.append(((KOListViewItem *)item)->data()); 490 delSel.append(((KOListViewItem *)item)->data());
488 ++icount; 491 ++icount;
489 } 492 }
490 493
491 item = item->nextSibling(); 494 item = item->nextSibling();
492 } 495 }
493 if ( icount ) { 496 if ( icount ) {
@@ -686,32 +689,33 @@ void KOListView::writeToFile( bool iCal )
686 cal.addIncidence( incidence->clone() ); 689 cal.addIncidence( incidence->clone() );
687 incidence = delSel.next(); 690 incidence = delSel.next();
688 } 691 }
689 if ( iCal ) { 692 if ( iCal ) {
690 ICalFormat format; 693 ICalFormat format;
691 format.save( &cal, fn ); 694 format.save( &cal, fn );
692 } else { 695 } else {
693 696
694 VCalFormat format; 697 VCalFormat format;
695 format.save( &cal, fn ); 698 format.save( &cal, fn );
696 } 699 }
697 mes = i18n("KO/Pi:Saved %1").arg(fn ); 700 mes = i18n("KO/Pi:Saved %1").arg(fn );
698 KOPrefs::instance()->mLastSaveFile = fn; 701 KOPrefs::instance()->mLastSaveFile = fn;
699 topLevelWidget()->setCaption(mes); 702 topLevelWidget()->setCaption(mes);
700 } 703 }
701 } 704 }
705 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
702} 706}
703void KOListView::deleteAll() 707void KOListView::deleteAll()
704{ 708{
705 int icount = 0; 709 int icount = 0;
706 QPtrList<Incidence> delSel ; 710 QPtrList<Incidence> delSel ;
707 QListViewItem *item = mListView->firstChild (); 711 QListViewItem *item = mListView->firstChild ();
708 while ( item ) { 712 while ( item ) {
709 if ( item->isSelected() ) { 713 if ( item->isSelected() ) {
710 delSel.append(((KOListViewItem *)item)->data()); 714 delSel.append(((KOListViewItem *)item)->data());
711 ++icount; 715 ++icount;
712 } 716 }
713 717
714 item = item->nextSibling(); 718 item = item->nextSibling();
715 } 719 }
716 if ( icount ) { 720 if ( icount ) {
717 Incidence *incidence = delSel.first(); 721 Incidence *incidence = delSel.first();
@@ -816,34 +820,37 @@ void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd,
816 const QDate &td) 820 const QDate &td)
817{ 821{
818#ifndef KORG_NOPRINTER 822#ifndef KORG_NOPRINTER
819 calPrinter->preview(CalPrinter::Day, fd, td); 823 calPrinter->preview(CalPrinter::Day, fd, td);
820#endif 824#endif
821} 825}
822 826
823void KOListView::showDates() 827void KOListView::showDates()
824{ 828{
825 showDates(true); 829 showDates(true);
826} 830}
827 831
828void KOListView::hideDates() 832void KOListView::hideDates()
829{ 833{
830 showDates(false); 834 showDates(false);
831} 835}
836
832void KOListView::resetFocus() 837void KOListView::resetFocus()
833{ 838{
839 topLevelWidget()->setActiveWindow();
840 topLevelWidget()->raise();
834 mListView->setFocus(); 841 mListView->setFocus();
835} 842}
836void KOListView::updateView() 843void KOListView::updateView()
837{ 844{
838 mListView->setFocus(); 845 mListView->setFocus();
839 if ( mListView->firstChild () ) 846 if ( mListView->firstChild () )
840 mListView->setCurrentItem( mListView->firstChild () ); 847 mListView->setCurrentItem( mListView->firstChild () );
841} 848}
842void KOListView::updateConfig() 849void KOListView::updateConfig()
843{ 850{
844 851
845 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 852 mListView->setFont ( KOPrefs::instance()->mListViewFont );
846 updateView(); 853 updateView();
847 854
848} 855}
849void KOListView::setStartDate(const QDate &start) 856void KOListView::setStartDate(const QDate &start)