-rw-r--r-- | korganizer/calendarview.cpp | 9 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 2 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 68 | ||||
-rw-r--r-- | korganizer/kolistview.h | 5 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 4 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | libkcal/calendar.h | 1 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 10 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 1 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 2 |
10 files changed, 87 insertions, 16 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 377a66f..2012e92 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1834,12 +1834,5 @@ bool CalendarView::importQtopia( const QString &categories, void CalendarView::setSyncEventsReadOnly() { - Event * ev; - QPtrList<Event> eL = mCalendar->rawEvents(); - ev = eL.first(); - while ( ev ) { - if ( ev->uid().left(15) == QString("last-syncEvent-") ) - ev->setReadOnly( true ); - ev = eL.next(); - } + mCalendar->setSyncEventsReadOnly(); } diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index b2b136a..93ff55e 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -663,5 +663,5 @@ void KOAgendaView::createDayLabels() // It would remove some flickering and gain speed (since this is called by // each updateView() call) - + int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2; mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 1f3b4c6..c705c73 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -68,7 +68,4 @@ #include "koeventviewer.h" - - - class KOListViewWhatsThis :public QWhatsThis { @@ -141,4 +138,5 @@ bool ListItemVisitor::visit(Event *e) mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); mItem->setText(10,e->categoriesStr()); + mItem->setText(11, KOPrefs::instance()->calName( e->calID() )); QString key; @@ -190,4 +188,5 @@ bool ListItemVisitor::visit(Todo *t) mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); mItem->setText(10,t->categoriesStr()); + mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); QString key; @@ -225,4 +224,5 @@ bool ListItemVisitor::visit(Journal * j) mItem->setText(9,"---"); mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); + mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); QString key; @@ -252,4 +252,5 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, mListView->addColumn(i18n("Cancelled")); mListView->addColumn(i18n("Categories")); + mListView->addColumn(i18n("Calendar")); mListView->setColumnAlignment(0,AlignLeft); @@ -264,9 +265,9 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, mListView->setColumnAlignment(9,AlignLeft); mListView->setColumnAlignment(10,AlignLeft); - mListView->setColumnWidthMode(10, QListView::Manual); + mListView->setColumnAlignment(11,AlignLeft); mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); int iii = 0; - for ( iii = 0; iii< 10 ; ++iii ) + for ( iii = 0; iii< 12 ; ++iii ) mListView->setColumnWidthMode( iii, QListView::Manual ); @@ -296,4 +297,11 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, mPopupMenu->insertSeparator(); #endif + mCalPopup = new QPopupMenu ( this ); + mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup ); + + 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 ); @@ -317,4 +325,5 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, + #ifndef DESKTOP_VERSION mPopupMenu->insertSeparator(); @@ -372,4 +381,51 @@ QString KOListView::getWhatsThisText(QPoint p) } +void KOListView::setCalendar( int c ) +{ + int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), + i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), + i18n("Continue"), i18n("Cancel"), 0, + 0, 1 ); + if ( result != 0 ) { + return; + } + + QPtrList<Incidence> delSel = getSelectedIncidences() ; + int icount = delSel.count(); + if ( icount ) { + Incidence *incidence = delSel.first(); + while ( incidence ) { + incidence->setCalID( c ); + KOListViewItem * item = getItemForEvent( incidence ); + if ( item ) { + ListItemVisitor v(item, mStartDate ); + incidence->accept(v); + } + incidence = delSel.next(); + } + } + QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; + KopiCalendarFile * cal = calendars.first(); + while ( cal ) { + mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); + mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); + mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); + if ( cal->isStandard ) + mCalendar->setDefaultCalendar( cal->mCalNumber ); + cal = calendars.next(); + } + mCalendar->setSyncEventsReadOnly(); + mCalendar->reInitAlarmSettings(); + +} +void KOListView::populateCalPopup() +{ + mCalPopup->clear(); + KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); + while ( kkf ) { + mCalPopup->insertItem( kkf->mName, kkf->mCalNumber); + kkf = KOPrefs::instance()->mCalendars.next(); + } +} void KOListView::updateList() { @@ -1040,5 +1096,5 @@ void KOListView::changeEventDisplay(Event *event, int action) } -KOListViewItem *KOListView::getItemForEvent(Event *event) +KOListViewItem *KOListView::getItemForEvent(Incidence *event) { KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index 9da5497..d384af0 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h @@ -296,4 +296,6 @@ class KOListView : public KOEventView void defaultItemAction(QListViewItem *item); void popupMenu(QListViewItem *item,const QPoint &,int); + void setCalendar( int c ); + void populateCalPopup(); protected slots: @@ -304,7 +306,8 @@ class KOListView : public KOEventView void addEvents(QPtrList<Event> eventList); void addIncidence(Incidence *); - KOListViewItem *getItemForEvent(Event *event); + KOListViewItem *getItemForEvent(Incidence *event); private: + QPopupMenu* mCalPopup; KOListViewWhatsThis *mKOListViewWhatsThis; KOListViewListView *mListView; diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 65f0342..a4ea3d3 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -496,4 +496,8 @@ void KOPrefs::deleteCalendar( int num ) } } +QString KOPrefs::calName( int calNum) const +{ + return (mDefCalColors[calNum-1])->mName; +} QColor KOPrefs::defaultColor( int calNum ) const { diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 463fc33..5cc9bfa 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h @@ -100,4 +100,5 @@ class KOPrefs : public KPimPrefs void deleteCalendar( int ); QColor defaultColor( int ) const; + QString calName( int ) const; protected: void setTimeZoneIdDefault(); diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 2243e28..3b7b183 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h @@ -77,4 +77,5 @@ public: virtual void addCalendar( Calendar* ) = 0; virtual bool addCalendarFile( QString name, int id ) = 0; + virtual void setSyncEventsReadOnly() = 0; /** diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 336c3e8..8c4dde1 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -79,4 +79,14 @@ bool CalendarLocal::addCalendarFile( QString name, int id ) return false; } +void CalendarLocal::setSyncEventsReadOnly() +{ + Event * ev; + ev = mEventList.first(); + while ( ev ) { + if ( ev->uid().left(15) == QString("last-syncEvent-") ) + ev->setReadOnly( true ); + ev = mEventList.next(); + } +} void CalendarLocal::addCalendar( Calendar* cal ) { diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index 5bbe55f..0286b48 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h @@ -46,4 +46,5 @@ class CalendarLocal : public Calendar void addCalendar( Calendar* ); bool addCalendarFile( QString name, int id ); + void setSyncEventsReadOnly(); /** Loads a calendar on disk in vCalendar or iCalendar format into the current diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 2ddbb01..96039df 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp @@ -142,4 +142,6 @@ QDateTime IncidenceBase::getEvenTime( QDateTime dt ) void IncidenceBase::setCalID( int id ) { + if ( mCalID > 0 ) + updated(); mCalID = id; } |