author | zautrix <zautrix> | 2005-03-11 19:26:02 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-11 19:26:02 (UTC) |
commit | 1166a4797a91cedd5002a3513d5028c5e86016f0 (patch) (side-by-side diff) | |
tree | 8e7443bc887a15dcf3852abd36e6e61f2e6bddad /korganizer | |
parent | 71462ba8ef1803787bba6793f1adb85987eb57df (diff) | |
download | kdepimpi-1166a4797a91cedd5002a3513d5028c5e86016f0.zip kdepimpi-1166a4797a91cedd5002a3513d5028c5e86016f0.tar.gz kdepimpi-1166a4797a91cedd5002a3513d5028c5e86016f0.tar.bz2 |
better kopi export
-rw-r--r-- | korganizer/kolistview.cpp | 41 | ||||
-rw-r--r-- | korganizer/kolistview.h | 2 |
2 files changed, 35 insertions, 8 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 710a9f9..f235705 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -266,10 +266,12 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, SLOT(deleteAll()),true); mPopupMenu->insertSeparator(); - mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), - i18n("Save selected to file..."),this, - SLOT(saveToFile()),true); - mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), - i18n("Save Journal/Description..."),this, - SLOT(saveDescriptionToFile()),true); + QPopupMenu * exportPO = new QPopupMenu ( this ); + mPopupMenu->insertItem( i18n("Export selected"), 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()), @@ -607,6 +609,14 @@ void KOListView::saveDescriptionToFile() } } +void KOListView::saveToFileVCS() +{ + writeToFile( false ); +} void KOListView::saveToFile() { + writeToFile( true ); +} +void KOListView::writeToFile( bool iCal ) +{ int icount = 0; @@ -623,4 +633,14 @@ void KOListView::saveToFile() if ( icount ) { QString fn = KOPrefs::instance()->mLastSaveFile; + QString extension; + if ( iCal ) { + if ( fn.right( 4 ).lower() == ".vcs" ) { + fn = fn.left( fn.length() -3) + "ics"; + } + } else { + if ( fn.right( 4 ).lower() == ".ics" ) { + fn = fn.left( fn.length() -3) + "vcs"; + } + } fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); @@ -648,6 +668,11 @@ void KOListView::saveToFile() incidence = delSel.next(); } - ICalFormat format; - format.save( &cal, fn ); + if ( iCal ) { + ICalFormat format; + format.save( &cal, fn ); + } else { + VCalFormat format; + format.save( &cal, fn ); + } mes = i18n("KO/Pi:Saved %1").arg(fn ); KOPrefs::instance()->mLastSaveFile = fn; diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index c86449d..0d9c525 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h @@ -273,4 +273,5 @@ class KOListView : public KOEventView void deleteAll(); void saveToFile(); + void saveToFileVCS(); void saveDescriptionToFile(); void beamSelected(); @@ -289,4 +290,5 @@ class KOListView : public KOEventView protected: + void writeToFile( bool iCal ); void addEvents(QPtrList<Event> eventList); void addIncidence(Incidence *); |