summaryrefslogtreecommitdiffabout
path: root/korganizer/kolistview.cpp
Unidiff
Diffstat (limited to 'korganizer/kolistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index bafd349..d3aa650 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -18,48 +18,49 @@
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qlistview.h> 25#include <qlistview.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qprogressbar.h> 29#include <qprogressbar.h>
30#include <qfileinfo.h> 30#include <qfileinfo.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qdialog.h> 32#include <qdialog.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qdir.h> 34#include <qdir.h>
35#include <qregexp.h> 35#include <qregexp.h>
36 36
37#include <klocale.h> 37#include <klocale.h>
38#include <kdebug.h> 38#include <kdebug.h>
39#include <kiconloader.h> 39#include <kiconloader.h>
40#include <kglobal.h> 40#include <kglobal.h>
41 41
42#include <libkdepim/kpimglobalprefs.h>
42#include <libkcal/calendar.h> 43#include <libkcal/calendar.h>
43#include <libkcal/calendarlocal.h> 44#include <libkcal/calendarlocal.h>
44#include <libkcal/icalformat.h> 45#include <libkcal/icalformat.h>
45#include <libkcal/vcalformat.h> 46#include <libkcal/vcalformat.h>
46#include <libkcal/recurrence.h> 47#include <libkcal/recurrence.h>
47#include <libkcal/filestorage.h> 48#include <libkcal/filestorage.h>
48#include <libkdepim/categoryselectdialog.h> 49#include <libkdepim/categoryselectdialog.h>
49#ifndef DESKTOP_VERSION 50#ifndef DESKTOP_VERSION
50#include <qpe/qpeapplication.h> 51#include <qpe/qpeapplication.h>
51#else 52#else
52#include <qapplication.h> 53#include <qapplication.h>
53#endif 54#endif
54 55
55#ifndef KORG_NOPRINTER 56#ifndef KORG_NOPRINTER
56#include "calprinter.h" 57#include "calprinter.h"
57#endif 58#endif
58#include "koglobals.h" 59#include "koglobals.h"
59#include "koprefs.h" 60#include "koprefs.h"
60#include "kfiledialog.h" 61#include "kfiledialog.h"
61 62
62#include "kolistview.h" 63#include "kolistview.h"
63 64
64ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 65ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
65{ 66{
@@ -356,49 +357,49 @@ void KOListView::setCategories( bool removeOld )
356 357
357void KOListView::beamSelected() 358void KOListView::beamSelected()
358{ 359{
359 int icount = 0; 360 int icount = 0;
360 QPtrList<Incidence> delSel ; 361 QPtrList<Incidence> delSel ;
361 QListViewItem *item = mListView->firstChild (); 362 QListViewItem *item = mListView->firstChild ();
362 while ( item ) { 363 while ( item ) {
363 if ( item->isSelected() ) { 364 if ( item->isSelected() ) {
364 delSel.append(((KOListViewItem *)item)->data()); 365 delSel.append(((KOListViewItem *)item)->data());
365 ++icount; 366 ++icount;
366 } 367 }
367 368
368 item = item->nextSibling(); 369 item = item->nextSibling();
369 } 370 }
370 if ( icount ) { 371 if ( icount ) {
371 emit beamIncidenceList( delSel ); 372 emit beamIncidenceList( delSel );
372 return; 373 return;
373 QString fn ; 374 QString fn ;
374 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; 375 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs";
375 QString mes; 376 QString mes;
376 bool createbup = true; 377 bool createbup = true;
377 if ( createbup ) { 378 if ( createbup ) {
378 QString description = "\n"; 379 QString description = "\n";
379 CalendarLocal* cal = new CalendarLocal(); 380 CalendarLocal* cal = new CalendarLocal();
380 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 381 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
381 Incidence *incidence = delSel.first(); 382 Incidence *incidence = delSel.first();
382 while ( incidence ) { 383 while ( incidence ) {
383 Incidence *in = incidence->clone(); 384 Incidence *in = incidence->clone();
384 description += in->summary() + "\n"; 385 description += in->summary() + "\n";
385 cal->addIncidence( in ); 386 cal->addIncidence( in );
386 incidence = delSel.next(); 387 incidence = delSel.next();
387 } 388 }
388 FileStorage storage( cal, fn, new VCalFormat ); 389 FileStorage storage( cal, fn, new VCalFormat );
389 storage.save(); 390 storage.save();
390 delete cal; 391 delete cal;
391 mes = i18n("KO/Pi: Ready for beaming"); 392 mes = i18n("KO/Pi: Ready for beaming");
392 topLevelWidget()->setCaption(mes); 393 topLevelWidget()->setCaption(mes);
393 394
394#ifndef DESKTOP_VERSION 395#ifndef DESKTOP_VERSION
395 Ir *ir = new Ir( this ); 396 Ir *ir = new Ir( this );
396 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 397 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
397 ir->send( fn, description, "text/x-vCalendar" ); 398 ir->send( fn, description, "text/x-vCalendar" );
398#endif 399#endif
399 } 400 }
400 } 401 }
401} 402}
402void KOListView::beamDone( Ir *ir ) 403void KOListView::beamDone( Ir *ir )
403{ 404{
404#ifndef DESKTOP_VERSION 405#ifndef DESKTOP_VERSION
@@ -507,49 +508,49 @@ void KOListView::saveToFile()
507 508
508 item = item->nextSibling(); 509 item = item->nextSibling();
509 } 510 }
510 if ( icount ) { 511 if ( icount ) {
511 QString fn = KOPrefs::instance()->mLastSaveFile; 512 QString fn = KOPrefs::instance()->mLastSaveFile;
512 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 513 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
513 514
514 if ( fn == "" ) 515 if ( fn == "" )
515 return; 516 return;
516 QFileInfo info; 517 QFileInfo info;
517 info.setFile( fn ); 518 info.setFile( fn );
518 QString mes; 519 QString mes;
519 bool createbup = true; 520 bool createbup = true;
520 if ( info. exists() ) { 521 if ( info. exists() ) {
521 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 522 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
522 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 523 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
523 i18n("Overwrite!"), i18n("Cancel"), 0, 524 i18n("Overwrite!"), i18n("Cancel"), 0,
524 0, 1 ); 525 0, 1 );
525 if ( result != 0 ) { 526 if ( result != 0 ) {
526 createbup = false; 527 createbup = false;
527 } 528 }
528 } 529 }
529 if ( createbup ) { 530 if ( createbup ) {
530 CalendarLocal cal; 531 CalendarLocal cal;
531 cal.setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 532 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
532 Incidence *incidence = delSel.first(); 533 Incidence *incidence = delSel.first();
533 while ( incidence ) { 534 while ( incidence ) {
534 cal.addIncidence( incidence->clone() ); 535 cal.addIncidence( incidence->clone() );
535 incidence = delSel.next(); 536 incidence = delSel.next();
536 } 537 }
537 ICalFormat format; 538 ICalFormat format;
538 format.save( &cal, fn ); 539 format.save( &cal, fn );
539 mes = i18n("KO/Pi:Saved %1").arg(fn ); 540 mes = i18n("KO/Pi:Saved %1").arg(fn );
540 KOPrefs::instance()->mLastSaveFile = fn; 541 KOPrefs::instance()->mLastSaveFile = fn;
541 topLevelWidget()->setCaption(mes); 542 topLevelWidget()->setCaption(mes);
542 } 543 }
543 } 544 }
544} 545}
545void KOListView::deleteAll() 546void KOListView::deleteAll()
546{ 547{
547 int icount = 0; 548 int icount = 0;
548 QPtrList<Incidence> delSel ; 549 QPtrList<Incidence> delSel ;
549 QListViewItem *item = mListView->firstChild (); 550 QListViewItem *item = mListView->firstChild ();
550 while ( item ) { 551 while ( item ) {
551 if ( item->isSelected() ) { 552 if ( item->isSelected() ) {
552 delSel.append(((KOListViewItem *)item)->data()); 553 delSel.append(((KOListViewItem *)item)->data());
553 ++icount; 554 ++icount;
554 } 555 }
555 556