summaryrefslogtreecommitdiffabout
path: root/korganizer/kolistview.cpp
authorzautrix <zautrix>2005-03-11 19:26:02 (UTC)
committer zautrix <zautrix>2005-03-11 19:26:02 (UTC)
commit1166a4797a91cedd5002a3513d5028c5e86016f0 (patch) (side-by-side diff)
tree8e7443bc887a15dcf3852abd36e6e61f2e6bddad /korganizer/kolistview.cpp
parent71462ba8ef1803787bba6793f1adb85987eb57df (diff)
downloadkdepimpi-1166a4797a91cedd5002a3513d5028c5e86016f0.zip
kdepimpi-1166a4797a91cedd5002a3513d5028c5e86016f0.tar.gz
kdepimpi-1166a4797a91cedd5002a3513d5028c5e86016f0.tar.bz2
better kopi export
Diffstat (limited to 'korganizer/kolistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp41
1 files changed, 33 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
@@ -265,12 +265,14 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
i18n("Delete all selected"),this,
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()),
i18n("Add Categ. to selected..."),this,
@@ -606,8 +608,16 @@ void KOListView::saveDescriptionToFile()
}
}
}
+void KOListView::saveToFileVCS()
+{
+ writeToFile( false );
+}
void KOListView::saveToFile()
{
+ writeToFile( true );
+}
+void KOListView::writeToFile( bool iCal )
+{
int icount = 0;
QPtrList<Incidence> delSel ;
@@ -622,6 +632,16 @@ 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 );
if ( fn == "" )
@@ -647,8 +667,13 @@ void KOListView::saveToFile()
cal.addIncidence( incidence->clone() );
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;
topLevelWidget()->setCaption(mes);