summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp9
-rw-r--r--korganizer/koagendaview.cpp2
-rw-r--r--korganizer/kolistview.cpp68
-rw-r--r--korganizer/kolistview.h5
-rw-r--r--korganizer/koprefs.cpp4
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp10
-rw-r--r--libkcal/calendarlocal.h1
-rw-r--r--libkcal/incidencebase.cpp2
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
@@ -1833,14 +1833,7 @@ 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();
}
bool CalendarView::loadCalendars()
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index b2b136a..93ff55e 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -662,7 +662,7 @@ void KOAgendaView::createDayLabels()
// ### Before deleting and recreating we could check if mSelectedDates changed...
// 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 );
if ( maxWid < 20 )
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 1f3b4c6..c705c73 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -67,9 +67,6 @@
#include "kolistview.h"
#include "koeventviewer.h"
-
-
-
class KOListViewWhatsThis :public QWhatsThis
{
public:
@@ -140,6 +137,7 @@ bool ListItemVisitor::visit(Event *e)
mItem->setText(8,"---");
mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
mItem->setText(10,e->categoriesStr());
+ mItem->setText(11, KOPrefs::instance()->calName( e->calID() ));
QString key;
QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
@@ -189,6 +187,7 @@ 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;
QDate d;
@@ -224,6 +223,7 @@ bool ListItemVisitor::visit(Journal * j)
mItem->setText(8,"---");
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;
QDate d = j->dtStart().date();
@@ -251,6 +251,7 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
mListView->addColumn(i18n("Due Time"));
mListView->addColumn(i18n("Cancelled"));
mListView->addColumn(i18n("Categories"));
+ mListView->addColumn(i18n("Calendar"));
mListView->setColumnAlignment(0,AlignLeft);
mListView->setColumnAlignment(1,AlignLeft);
@@ -263,11 +264,11 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
mListView->setColumnAlignment(8,AlignLeft);
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 );
QBoxLayout *layoutTop = new QVBoxLayout(this);
@@ -295,6 +296,13 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
SLOT(printList()),true);
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 );
exportPO->insertItem( i18n("As iCal (ics) file..."),this,
@@ -316,6 +324,7 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
SLOT(setAlarm()),true);
+
#ifndef DESKTOP_VERSION
mPopupMenu->insertSeparator();
mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
@@ -371,6 +380,53 @@ 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()
{
// qDebug(" KOListView::updateList() ");
@@ -1039,7 +1095,7 @@ void KOListView::changeEventDisplay(Event *event, int action)
}
}
-KOListViewItem *KOListView::getItemForEvent(Event *event)
+KOListViewItem *KOListView::getItemForEvent(Incidence *event)
{
KOListViewItem *item = (KOListViewItem *)mListView->firstChild();
while (item) {
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index 9da5497..d384af0 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -295,6 +295,8 @@ class KOListView : public KOEventView
void defaultItemAction(QListViewItem *item);
void popupMenu(QListViewItem *item,const QPoint &,int);
+ void setCalendar( int c );
+ void populateCalPopup();
protected slots:
void processSelectionChange(QListViewItem *);
@@ -303,9 +305,10 @@ class KOListView : public KOEventView
void writeToFile( bool iCal );
void addEvents(QPtrList<Event> eventList);
void addIncidence(Incidence *);
- KOListViewItem *getItemForEvent(Event *event);
+ KOListViewItem *getItemForEvent(Incidence *event);
private:
+ QPopupMenu* mCalPopup;
KOListViewWhatsThis *mKOListViewWhatsThis;
KOListViewListView *mListView;
KOEventPopupMenu *mPopupMenu;
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 65f0342..a4ea3d3 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -495,6 +495,10 @@ void KOPrefs::deleteCalendar( int num )
kkf = mCalendars.next();
}
}
+QString KOPrefs::calName( int calNum) const
+{
+ return (mDefCalColors[calNum-1])->mName;
+}
QColor KOPrefs::defaultColor( int calNum ) const
{
if ( calNum == 1 ) return mEventColor;
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 463fc33..5cc9bfa 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -99,6 +99,7 @@ class KOPrefs : public KPimPrefs
KopiCalendarFile * getCalendar( int );
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
@@ -76,6 +76,7 @@ public:
virtual void close() = 0;
virtual void addCalendar( Calendar* ) = 0;
virtual bool addCalendarFile( QString name, int id ) = 0;
+ virtual void setSyncEventsReadOnly() = 0;
/**
Sync changes in memory to persistant storage.
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 336c3e8..8c4dde1 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -78,6 +78,16 @@ 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 )
{
cal->setDontDeleteIncidencesOnClose();
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 5bbe55f..0286b48 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -45,6 +45,7 @@ class CalendarLocal : public Calendar
~CalendarLocal();
void addCalendar( Calendar* );
bool addCalendarFile( QString name, int id );
+ void setSyncEventsReadOnly();
/**
Loads a calendar on disk in vCalendar or iCalendar format into the current
calendar. Any information already present is lost.
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 2ddbb01..96039df 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -141,6 +141,8 @@ QDateTime IncidenceBase::getEvenTime( QDateTime dt )
void IncidenceBase::setCalID( int id )
{
+ if ( mCalID > 0 )
+ updated();
mCalID = id;
}
int IncidenceBase::calID() const