-rw-r--r-- | korganizer/kolistview.cpp | 155 | ||||
-rw-r--r-- | korganizer/kolistview.h | 7 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 2 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 2 |
4 files changed, 50 insertions, 116 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index e5e3704..4c815d8 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -281,78 +281,75 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, mListView->setColumnAlignment(10,AlignLeft); mListView->setColumnAlignment(11,AlignLeft); mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); int iii = 0; for ( iii = 0; iii< 12 ; ++iii ) mListView->setColumnWidthMode( iii, QListView::Manual ); QBoxLayout *layoutTop = new QVBoxLayout(this); layoutTop->addWidget(mListView); mListView->setFont ( KOPrefs::instance()->mListViewFont ); mPopupMenu = eventPopup(); - mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), - i18n("Select all"),this, - SLOT(allSelection()),true); - mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), - i18n("Deselect all"),this, - SLOT(clearSelection()),true); - mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), - i18n("Delete all selected"),this, - SLOT(deleteAll()),true); - + QPopupMenu* selPopup = new QPopupMenu ( this ); + mPopupMenu->insertSeparator(); + + selPopup->insertItem(i18n("All"),this, + SLOT(allSelection())); + selPopup->insertItem(i18n("None"),this, + SLOT(clearSelection())); + selPopup->insertItem(i18n("Delete selected..."),this, + SLOT(deleteAll())); + mPopupMenu->insertItem(i18n("Selection"), selPopup ); mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), i18n("Hide all selected"),this, SLOT(hideAll()),true); mPopupMenu->insertSeparator(); #ifdef DESKTOP_VERSION mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), i18n("Print complete list"),this, SLOT(printList()),true); mPopupMenu->insertSeparator(); #endif mCalPopup = new QPopupMenu ( this ); mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup ); + mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), + i18n("Set categories")+"...",this, + SLOT(setCat()),true); + mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), + i18n("Set alarm..."),this, + SLOT(setAlarm()),true); QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, SLOT( populateCalPopup() )); QObject::connect(mCalPopup,SIGNAL(activated( int )),this, SLOT( setCalendar( int ) )); QPopupMenu * exportPO = new QPopupMenu ( this ); - mPopupMenu->insertItem( i18n("Export selected"), exportPO ); + mPopupMenu->insertItem( i18n("Export"), exportPO ); exportPO->insertItem( i18n("As iCal (ics) file..."),this, SLOT(saveToFile())); exportPO->insertItem( i18n("As vCal (vcs) file..."),this, SLOT(saveToFileVCS())); exportPO->insertItem( i18n("Journal/Details..."),this, SLOT(saveDescriptionToFile())); // mPopupMenu->insertSeparator(); - mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), - i18n("Add Categ. to selected..."),this, - SLOT(addCat()),true); - mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), - i18n("Set Categ. for selected..."),this, - SLOT(setCat()),true); + // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), + // i18n("Add Categ. to selected..."),this, + // SLOT(addCat()),true); //mPopupMenu->insertSeparator(); - mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), - i18n("Set alarm for selected..."),this, - SLOT(setAlarm()),true); - - - #ifndef DESKTOP_VERSION mPopupMenu->insertSeparator(); mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), - i18n("Beam selected via IR"),this, + i18n("Beam via IR"),this, SLOT(beamSelected()),true); #endif /* mPopupMenu = new QPopupMenu; mPopupMenu->insertItem(i18n("Edit Event"), this, SLOT (editEvent())); mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, SLOT (deleteEvent())); mPopupMenu->insertSeparator(); mPopupMenu->insertItem(i18n("Show Dates"), this, SLOT(showDates())); mPopupMenu->insertItem(i18n("Hide Dates"), this, @@ -429,55 +426,60 @@ void KOListView::setCalendar( int c ) mCalendar->setDefaultCalendar( cal->mCalNumber ); cal = calendars.next(); } mCalendar->setSyncEventsReadOnly(); mCalendar->reInitAlarmSettings(); } void KOListView::populateCalPopup() { mCalPopup->clear(); KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); while ( kkf ) { - int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber); + int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber); if ( kkf->mErrorOnLoad || kkf->isReadOnly ) mCalPopup->setItemEnabled( index, false ); kkf = KOPrefs::instance()->mCalendars.next(); } } void KOListView::updateList() { // qDebug(" KOListView::updateList() "); } void KOListView::clearList() { clear (); } -void KOListView::addCat( ) -{ - setCategories( false ); -} + void KOListView::setCat() { - setCategories( true ); + + bool set = true; + int result = KMessageBox::warningYesNoCancel(this, + i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), + i18n("Set categories"), + i18n("Add"), + i18n("Reset")); + if (result == KMessageBox::Cancel) return; + if (result == KMessageBox::Yes) set = false; + setCategories( set ); } void KOListView::setAlarm() { KOAlarmPrefs kap( this); if ( !kap.exec() ) return; - QStringList itemList; QPtrList<KOListViewItem> sel ; QListViewItem *qitem = mListView->firstChild (); while ( qitem ) { if ( qitem->isSelected() ) { Incidence* inc = ((KOListViewItem *) qitem)->data(); if ( inc->typeID() != journalID ) { if ( inc->typeID() == todoID ) { if ( ((Todo*)inc)->hasDueDate() ) sel.append(((KOListViewItem *)qitem)); } else sel.append(((KOListViewItem *)qitem)); } @@ -534,109 +536,47 @@ void KOListView::setAlarm() } void KOListView::setCategories( bool removeOld ) { KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); csd->setColorEnabled(); if (! csd->exec()) { delete csd; return; } QStringList catList = csd->selectedCategories(); delete csd; - // if ( catList.count() == 0 ) - // return; - //catList.sort(); - QString categoriesStr = catList.join(","); - int i; - QStringList itemList; - QPtrList<KOListViewItem> sel ; - QListViewItem *qitem = mListView->firstChild (); - while ( qitem ) { - if ( qitem->isSelected() ) { - sel.append(((KOListViewItem *)qitem)); - } - qitem = qitem->nextSibling(); - } - KOListViewItem * item, *temp; - item = sel.first(); - if( item ) { - Incidence* inc = item->data() ; - bool setSub = false; - if( inc->typeID() == todoID && sel.count() == 1 && inc->relations().count() > 0 ) { - int result = KMessageBox::warningYesNoCancel(this, - i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ), - i18n("Todo has subtodos"), - i18n("Yes"), - i18n("No")); - if (result == KMessageBox::Cancel) item = 0; - if (result == KMessageBox::Yes) setSub = true; - } - while ( item ) { - inc = item->data(); - if ( removeOld ) { - inc->setCategories( catList, setSub ); - } else { - inc->addCategories( catList, setSub ); - } + QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; + Incidence* inc = delSel.first(); + while ( inc ) { + if ( removeOld ) { + inc->setCategories( catList, false ); + } else { + inc->addCategories( catList, false ); + } + KOListViewItem* item = getItemForEvent(inc); + if (item) { ListItemVisitor v(item, mStartDate ); inc->accept(v); - item = sel.next(); } + inc = delSel.next(); } QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); } void KOListView::beamSelected() { QPtrList<Incidence> delSel = getSelectedIncidences() ; - int icount = delSel.count(); - if ( icount ) { + if ( delSel.count() ) emit beamIncidenceList( delSel ); - return; - QString fn ; - fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; - QString mes; - bool createbup = true; - if ( createbup ) { - QString description = "\n"; - CalendarLocal* cal = new CalendarLocal(); - cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); - Incidence *incidence = delSel.first(); - while ( incidence ) { - Incidence *in = incidence->clone(); - description += in->summary() + "\n"; - cal->addIncidence( in ); - incidence = delSel.next(); - } - FileStorage storage( cal, fn, new VCalFormat ); - storage.save(); - delete cal; - mes = i18n("KO/Pi: Ready for beaming"); - topLevelWidget()->setCaption(mes); - -#ifndef DESKTOP_VERSION - Ir *ir = new Ir( this ); - connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); - ir->send( fn, description, "text/x-vCalendar" ); -#endif - } - } -} -void KOListView::beamDone( Ir *ir ) -{ -#ifndef DESKTOP_VERSION - delete ir; -#endif - topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); } void KOListView::saveDescriptionToFile() { int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), i18n("Continue"), i18n("Cancel"), 0, 0, 1 ); if ( result != 0 ) { return; } @@ -1097,27 +1037,26 @@ int KOListView::count() void KOListView::changeEventDisplay(Event *event, int action) { KOListViewItem *item; switch(action) { case KOGlobals::EVENTADDED: addIncidence( event ); break; case KOGlobals::EVENTEDITED: item = getItemForEvent(event); if (item) { - mUidDict.remove( event->uid() ); - delete item; - addIncidence( event ); + ListItemVisitor v(item, mStartDate ); + ((Incidence*)event)->accept(v); } break; case KOGlobals::EVENTDELETED: item = getItemForEvent(event); if (item) { mUidDict.remove( event->uid() ); delete item; } break; default: ; } diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index bcef0f0..a54b550 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h @@ -21,29 +21,24 @@ with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #ifndef _KOLISTVIEW_H #define _KOLISTVIEW_H #include <qlistview.h> #include <qmap.h> #include <qdict.h> #include <klistview.h> -#ifndef DESKTOP_VERSION -#include <qtopia/ir.h> -#else -#define Ir char -#endif #include <libkcal/incidence.h> #include "koeventview.h" #include "customlistviewitem.h" using namespace KCal; class KOListViewWhatsThis; #include <qpushbutton.h> #include <qlayout.h> #include <qdialog.h> @@ -270,34 +265,32 @@ class KOListView : public KOEventView public slots: void hideAll(); void printList(); void resetFocus(); virtual void updateView(); virtual void showDates(const QDate &start, const QDate &end); virtual void showEvents(QPtrList<Event> eventList); void clearSelection(); void allSelection(); void clear(); - void beamDone( Ir *ir ); void showDates(); void hideDates(); void deleteAll(); void saveToFile(); void saveToFileVCS(); void saveDescriptionToFile(); void beamSelected(); void updateConfig(); - void addCat(); void setCat(); void setAlarm(); void setCategories( bool removeOld ); void changeEventDisplay(Event *, int); void defaultItemAction(QListViewItem *item); void popupMenu(QListViewItem *item,const QPoint &,int); void setCalendar( int c ); void populateCalPopup(); protected slots: void processSelectionChange(QListViewItem *); diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 02d7aae..6337ca5 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -220,25 +220,25 @@ KOPrefs::KOPrefs() : addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); addItemBool("MonthViewWeek",&mMonthViewWeek,false); addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); addItemBool("UseAppColors",&mUseAppColors,false); KPrefs::setCurrentGroup("Views"); - addItemBool("Block Popup Menu",&mBlockPopupMenu,true); + addItemBool("Block Popup Menu",&mBlockPopupMenu,false); addItemBool("Show Date Navigator",&mShowDateNavigator,true); addItemInt("Hour Size",&mHourSize,8); addItemBool("Show Daily Recurrences",&mDailyRecur,true); addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); addItemBool("ShowShortMonthName",&mMonthShowShort,false); addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true); #ifdef DESKTOP_VERION addItemBool("Enable ToolTips",&mEnableToolTips,true); #else diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index bd191d8..792a7b8 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -446,24 +446,26 @@ void KOViewManager::showListView() mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); connect( mListView, SIGNAL( signalNewEvent() ), mMainView, SLOT( newEvent() ) ); connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), mMainView, SLOT ( moveIncidence( Incidence * ) ) ); connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), mMainView, SLOT ( beamIncidence( Incidence * ) ) ); + connect( mListView, SIGNAL( beamIncidenceList( QPtrList<Incidence> ) ), + mMainView, SLOT ( beamIncidenceList( QPtrList<Incidence> ) ) ); } // bool temp = mFlagShowNextxDays; //globalFlagBlockPainting = true; globalFlagBlockAgenda = 1; if ( KOPrefs::instance()->mListViewMonthTimespan ) { mMainView->setBlockShowDates( true ); mMainView->dateNavigator()->selectMonth(); mMainView->setBlockShowDates( false ); } KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; showView(mListView, KOPrefs::instance()->mFullViewTodo); //mFlagShowNextxDays = temp; |