summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-15 18:23:08 (UTC)
committer zautrix <zautrix>2005-06-15 18:23:08 (UTC)
commitccfe3f97afd65c75ee6c7c931cb3694919a4e29b (patch) (side-by-side diff)
tree117d3467ef1d9678f31dea1b506390707f88d94a
parentcba0ac17d3d505805be6aa4b4fea6f63473a1e00 (diff)
downloadkdepimpi-ccfe3f97afd65c75ee6c7c931cb3694919a4e29b.zip
kdepimpi-ccfe3f97afd65c75ee6c7c931cb3694919a4e29b.tar.gz
kdepimpi-ccfe3f97afd65c75ee6c7c931cb3694919a4e29b.tar.bz2
fixess
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
@@ -1832,16 +1832,9 @@ 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
@@ -661,9 +661,9 @@ 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 )
maxWid = 20;
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 1f3b4c6..c705c73 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -66,11 +66,8 @@
#include "kolistview.h"
#include "koeventviewer.h"
-
-
-
class KOListViewWhatsThis :public QWhatsThis
{
public:
KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
@@ -139,8 +136,9 @@ bool ListItemVisitor::visit(Event *e)
mItem->setText(7,"---");
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();
key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
@@ -188,8 +186,9 @@ bool ListItemVisitor::visit(Todo *t)
mItem->setText(8,"---");
}
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;
if (t->hasDueDate()) {
@@ -223,8 +222,9 @@ bool ListItemVisitor::visit(Journal * j)
mItem->setText(7,j->dtStartDateStr());
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();
key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
@@ -250,8 +250,9 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
mListView->addColumn(i18n("Due Date"));
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);
mListView->setColumnAlignment(2,AlignHCenter);
@@ -262,13 +263,13 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
mListView->setColumnAlignment(7,AlignLeft);
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);
layoutTop->addWidget(mListView);
@@ -294,8 +295,15 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
i18n("Print complete list"),this,
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,
SLOT(saveToFile()));
@@ -315,8 +323,9 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
i18n("Set alarm for selected..."),this,
SLOT(setAlarm()),true);
+
#ifndef DESKTOP_VERSION
mPopupMenu->insertSeparator();
mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
i18n("Beam selected via IR"),this,
@@ -370,8 +379,55 @@ QString KOListView::getWhatsThisText(QPoint p)
return i18n("That is the list view" );
}
+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() ");
@@ -1038,9 +1094,9 @@ void KOListView::changeEventDisplay(Event *event, int action)
;
}
}
-KOListViewItem *KOListView::getItemForEvent(Event *event)
+KOListViewItem *KOListView::getItemForEvent(Incidence *event)
{
KOListViewItem *item = (KOListViewItem *)mListView->firstChild();
while (item) {
if (item->data() == event) return item;
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index 9da5497..d384af0 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -294,19 +294,22 @@ class KOListView : public KOEventView
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 *);
protected:
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;
KOListViewItem *mActiveItem;
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 65f0342..a4ea3d3 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -494,8 +494,12 @@ 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;
return (mDefCalColors[calNum-1])->mDefaultColor;
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 463fc33..5cc9bfa 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -98,8 +98,9 @@ class KOPrefs : public KPimPrefs
KopiCalendarFile * getNewCalendar();
KopiCalendarFile * getCalendar( int );
void deleteCalendar( int );
QColor defaultColor( int ) const;
+ QString calName( int ) const;
protected:
void setTimeZoneIdDefault();
/** Fill empty mail fields with default values. */
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 2243e28..3b7b183 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -75,8 +75,9 @@ 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
@@ -77,8 +77,18 @@ bool CalendarLocal::addCalendarFile( QString name, int id )
return true;
}
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
@@ -44,8 +44,9 @@ class CalendarLocal : public Calendar
CalendarLocal( const QString &timeZoneId );
~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.
@return true, if successfull, false on error.
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 2ddbb01..96039df 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -140,8 +140,10 @@ QDateTime IncidenceBase::getEvenTime( QDateTime dt )
}
void IncidenceBase::setCalID( int id )
{
+ if ( mCalID > 0 )
+ updated();
mCalID = id;
}
int IncidenceBase::calID() const
{