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 | 37 | ||||
-rw-r--r-- | korganizer/kolistview.h | 2 |
2 files changed, 33 insertions, 6 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 710a9f9..f235705 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -267,8 +267,10 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, 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(); @@ -608,4 +610,12 @@ void KOListView::saveDescriptionToFile() } +void KOListView::saveToFileVCS() +{ + writeToFile( false ); +} void KOListView::saveToFile() { + writeToFile( true ); +} +void KOListView::writeToFile( bool iCal ) +{ @@ -624,2 +634,12 @@ void KOListView::saveToFile() 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 ); @@ -649,4 +669,9 @@ void KOListView::saveToFile() } + if ( iCal ) { ICalFormat format; format.save( &cal, fn ); + } else { + VCalFormat format; + format.save( &cal, fn ); + } mes = i18n("KO/Pi:Saved %1").arg(fn ); diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index c86449d..0d9c525 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h @@ -274,2 +274,3 @@ class KOListView : public KOEventView void saveToFile(); + void saveToFileVCS(); void saveDescriptionToFile(); @@ -290,2 +291,3 @@ class KOListView : public KOEventView protected: + void writeToFile( bool iCal ); void addEvents(QPtrList<Event> eventList); |