summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kolistview.cpp37
-rw-r--r--korganizer/kolistview.h2
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
@@ -260,22 +260,24 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
260 SLOT(allSelection()),true); 260 SLOT(allSelection()),true);
261 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 261 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
262 i18n("Deselect all"),this, 262 i18n("Deselect all"),this,
263 SLOT(clearSelection()),true); 263 SLOT(clearSelection()),true);
264 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 264 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
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,
277 SLOT(addCat()),true); 279 SLOT(addCat()),true);
278 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 280 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
279 i18n("Set Categ. for selected..."),this, 281 i18n("Set Categ. for selected..."),this,
280 SLOT(setCat()),true); 282 SLOT(setCat()),true);
281 //mPopupMenu->insertSeparator(); 283 //mPopupMenu->insertSeparator();
@@ -601,32 +603,50 @@ void KOListView::saveDescriptionToFile()
601 file.close(); 603 file.close();
602 //qDebug("%s ", text.latin1()); 604 //qDebug("%s ", text.latin1());
603 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); 605 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount );
604 KOPrefs::instance()->mLastSaveFile = fn; 606 KOPrefs::instance()->mLastSaveFile = fn;
605 topLevelWidget()->setCaption(mes); 607 topLevelWidget()->setCaption(mes);
606 } 608 }
607 } 609 }
608} 610}
611void KOListView::saveToFileVCS()
612{
613 writeToFile( false );
614}
609void KOListView::saveToFile() 615void KOListView::saveToFile()
610{ 616{
617 writeToFile( true );
618}
619void KOListView::writeToFile( bool iCal )
620{
611 621
612 int icount = 0; 622 int icount = 0;
613 QPtrList<Incidence> delSel ; 623 QPtrList<Incidence> delSel ;
614 QListViewItem *item = mListView->firstChild (); 624 QListViewItem *item = mListView->firstChild ();
615 while ( item ) { 625 while ( item ) {
616 if ( item->isSelected() ) { 626 if ( item->isSelected() ) {
617 delSel.append(((KOListViewItem *)item)->data()); 627 delSel.append(((KOListViewItem *)item)->data());
618 ++icount; 628 ++icount;
619 } 629 }
620 630
621 item = item->nextSibling(); 631 item = item->nextSibling();
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 == "" )
628 return; 648 return;
629 QFileInfo info; 649 QFileInfo info;
630 info.setFile( fn ); 650 info.setFile( fn );
631 QString mes; 651 QString mes;
632 bool createbup = true; 652 bool createbup = true;
@@ -642,18 +662,23 @@ void KOListView::saveToFile()
642 if ( createbup ) { 662 if ( createbup ) {
643 CalendarLocal cal; 663 CalendarLocal cal;
644 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 664 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
645 Incidence *incidence = delSel.first(); 665 Incidence *incidence = delSel.first();
646 while ( incidence ) { 666 while ( incidence ) {
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);
655 } 680 }
656 } 681 }
657} 682}
658void KOListView::deleteAll() 683void KOListView::deleteAll()
659{ 684{
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index c86449d..0d9c525 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -267,32 +267,34 @@ class KOListView : public KOEventView
267 void allSelection(); 267 void allSelection();
268 268
269 void clear(); 269 void clear();
270 void beamDone( Ir *ir ); 270 void beamDone( Ir *ir );
271 void showDates(); 271 void showDates();
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();
278 void addCat(); 279 void addCat();
279 void setCat(); 280 void setCat();
280 void setAlarm(); 281 void setAlarm();
281 void setCategories( bool removeOld ); 282 void setCategories( bool removeOld );
282 void changeEventDisplay(Event *, int); 283 void changeEventDisplay(Event *, int);
283 284
284 void defaultItemAction(QListViewItem *item); 285 void defaultItemAction(QListViewItem *item);
285 void popupMenu(QListViewItem *item,const QPoint &,int); 286 void popupMenu(QListViewItem *item,const QPoint &,int);
286 287
287 protected slots: 288 protected slots:
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);
294 296
295 private: 297 private:
296 KOListViewListView *mListView; 298 KOListViewListView *mListView;
297 KOEventPopupMenu *mPopupMenu; 299 KOEventPopupMenu *mPopupMenu;
298 KOListViewItem *mActiveItem; 300 KOListViewItem *mActiveItem;