author | zautrix <zautrix> | 2005-03-11 19:26:02 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-11 19:26:02 (UTC) |
commit | 1166a4797a91cedd5002a3513d5028c5e86016f0 (patch) (unidiff) | |
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 | |||
@@ -265,12 +265,14 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, | |||
265 | i18n("Delete all selected"),this, | 265 | i18n("Delete all selected"),this, |
266 | SLOT(deleteAll()),true); | 266 | SLOT(deleteAll()),true); |
267 | mPopupMenu->insertSeparator(); | 267 | mPopupMenu->insertSeparator(); |
268 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 268 | QPopupMenu * exportPO = new QPopupMenu ( this ); |
269 | i18n("Save selected to file..."),this, | 269 | mPopupMenu->insertItem( i18n("Export selected"), exportPO ); |
270 | SLOT(saveToFile()),true); | 270 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, |
271 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 271 | SLOT(saveToFile())); |
272 | i18n("Save Journal/Description..."),this, | 272 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, |
273 | SLOT(saveDescriptionToFile()),true); | 273 | SLOT(saveToFileVCS())); |
274 | exportPO->insertItem( i18n("Journal/Details..."),this, | ||
275 | SLOT(saveDescriptionToFile())); | ||
274 | // mPopupMenu->insertSeparator(); | 276 | // mPopupMenu->insertSeparator(); |
275 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 277 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
276 | i18n("Add Categ. to selected..."),this, | 278 | i18n("Add Categ. to selected..."),this, |
@@ -606,8 +608,16 @@ void KOListView::saveDescriptionToFile() | |||
606 | } | 608 | } |
607 | } | 609 | } |
608 | } | 610 | } |
611 | void KOListView::saveToFileVCS() | ||
612 | { | ||
613 | writeToFile( false ); | ||
614 | } | ||
609 | void KOListView::saveToFile() | 615 | void KOListView::saveToFile() |
610 | { | 616 | { |
617 | writeToFile( true ); | ||
618 | } | ||
619 | void KOListView::writeToFile( bool iCal ) | ||
620 | { | ||
611 | 621 | ||
612 | int icount = 0; | 622 | int icount = 0; |
613 | QPtrList<Incidence> delSel ; | 623 | QPtrList<Incidence> delSel ; |
@@ -622,6 +632,16 @@ void KOListView::saveToFile() | |||
622 | } | 632 | } |
623 | if ( icount ) { | 633 | if ( icount ) { |
624 | QString fn = KOPrefs::instance()->mLastSaveFile; | 634 | QString fn = KOPrefs::instance()->mLastSaveFile; |
635 | QString extension; | ||
636 | if ( iCal ) { | ||
637 | if ( fn.right( 4 ).lower() == ".vcs" ) { | ||
638 | fn = fn.left( fn.length() -3) + "ics"; | ||
639 | } | ||
640 | } else { | ||
641 | if ( fn.right( 4 ).lower() == ".ics" ) { | ||
642 | fn = fn.left( fn.length() -3) + "vcs"; | ||
643 | } | ||
644 | } | ||
625 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 645 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
626 | 646 | ||
627 | if ( fn == "" ) | 647 | if ( fn == "" ) |
@@ -647,8 +667,13 @@ void KOListView::saveToFile() | |||
647 | cal.addIncidence( incidence->clone() ); | 667 | cal.addIncidence( incidence->clone() ); |
648 | incidence = delSel.next(); | 668 | incidence = delSel.next(); |
649 | } | 669 | } |
670 | if ( iCal ) { | ||
650 | ICalFormat format; | 671 | ICalFormat format; |
651 | format.save( &cal, fn ); | 672 | format.save( &cal, fn ); |
673 | } else { | ||
674 | VCalFormat format; | ||
675 | format.save( &cal, fn ); | ||
676 | } | ||
652 | mes = i18n("KO/Pi:Saved %1").arg(fn ); | 677 | mes = i18n("KO/Pi:Saved %1").arg(fn ); |
653 | KOPrefs::instance()->mLastSaveFile = fn; | 678 | KOPrefs::instance()->mLastSaveFile = fn; |
654 | topLevelWidget()->setCaption(mes); | 679 | topLevelWidget()->setCaption(mes); |
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index c86449d..0d9c525 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h | |||
@@ -272,6 +272,7 @@ class KOListView : public KOEventView | |||
272 | void hideDates(); | 272 | void hideDates(); |
273 | void deleteAll(); | 273 | void deleteAll(); |
274 | void saveToFile(); | 274 | void saveToFile(); |
275 | void saveToFileVCS(); | ||
275 | void saveDescriptionToFile(); | 276 | void saveDescriptionToFile(); |
276 | void beamSelected(); | 277 | void beamSelected(); |
277 | void updateConfig(); | 278 | void updateConfig(); |
@@ -288,6 +289,7 @@ class KOListView : public KOEventView | |||
288 | void processSelectionChange(QListViewItem *); | 289 | void processSelectionChange(QListViewItem *); |
289 | 290 | ||
290 | protected: | 291 | protected: |
292 | void writeToFile( bool iCal ); | ||
291 | void addEvents(QPtrList<Event> eventList); | 293 | void addEvents(QPtrList<Event> eventList); |
292 | void addIncidence(Incidence *); | 294 | void addIncidence(Incidence *); |
293 | KOListViewItem *getItemForEvent(Event *event); | 295 | KOListViewItem *getItemForEvent(Event *event); |