summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index d0dbb47..acd9265 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -267,513 +267,513 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
267 mPopupMenu->insertSeparator(); 267 mPopupMenu->insertSeparator();
268 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 268 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
269 i18n("Save selected to file..."),this, 269 i18n("Save selected to file..."),this,
270 SLOT(saveToFile()),true); 270 SLOT(saveToFile()),true);
271 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 271 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
272 i18n("Save Journal/Description..."),this, 272 i18n("Save Journal/Description..."),this,
273 SLOT(saveDescriptionToFile()),true); 273 SLOT(saveDescriptionToFile()),true);
274 // mPopupMenu->insertSeparator(); 274 // mPopupMenu->insertSeparator();
275 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 275 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
276 i18n("Add Categ. to selected..."),this, 276 i18n("Add Categ. to selected..."),this,
277 SLOT(addCat()),true); 277 SLOT(addCat()),true);
278 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 278 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
279 i18n("Set Categ. for selected..."),this, 279 i18n("Set Categ. for selected..."),this,
280 SLOT(setCat()),true); 280 SLOT(setCat()),true);
281 //mPopupMenu->insertSeparator(); 281 //mPopupMenu->insertSeparator();
282 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 282 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
283 i18n("Set alarm for selected..."),this, 283 i18n("Set alarm for selected..."),this,
284 SLOT(setAlarm()),true); 284 SLOT(setAlarm()),true);
285 285
286 286
287#ifndef DESKTOP_VERSION 287#ifndef DESKTOP_VERSION
288 mPopupMenu->insertSeparator(); 288 mPopupMenu->insertSeparator();
289 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 289 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
290 i18n("Beam selected via IR"),this, 290 i18n("Beam selected via IR"),this,
291 SLOT(beamSelected()),true); 291 SLOT(beamSelected()),true);
292#endif 292#endif
293 /* 293 /*
294 mPopupMenu = new QPopupMenu; 294 mPopupMenu = new QPopupMenu;
295 mPopupMenu->insertItem(i18n("Edit Event"), this, 295 mPopupMenu->insertItem(i18n("Edit Event"), this,
296 SLOT (editEvent())); 296 SLOT (editEvent()));
297 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 297 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
298 SLOT (deleteEvent())); 298 SLOT (deleteEvent()));
299 mPopupMenu->insertSeparator(); 299 mPopupMenu->insertSeparator();
300 mPopupMenu->insertItem(i18n("Show Dates"), this, 300 mPopupMenu->insertItem(i18n("Show Dates"), this,
301 SLOT(showDates())); 301 SLOT(showDates()));
302 mPopupMenu->insertItem(i18n("Hide Dates"), this, 302 mPopupMenu->insertItem(i18n("Hide Dates"), this,
303 SLOT(hideDates())); 303 SLOT(hideDates()));
304 */ 304 */
305 QObject::connect(mListView,SIGNAL( newEvent()), 305 QObject::connect(mListView,SIGNAL( newEvent()),
306 this,SIGNAL(signalNewEvent())); 306 this,SIGNAL(signalNewEvent()));
307 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 307 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
308 this,SLOT(defaultItemAction(QListViewItem *))); 308 this,SLOT(defaultItemAction(QListViewItem *)));
309 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, 309 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *,
310 const QPoint &, int )), 310 const QPoint &, int )),
311 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 311 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
312 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 312 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
313 SLOT(processSelectionChange(QListViewItem *))); 313 SLOT(processSelectionChange(QListViewItem *)));
314 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 314 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
315 SIGNAL(showIncidenceSignal(Incidence *)) ); 315 SIGNAL(showIncidenceSignal(Incidence *)) );
316 316
317 readSettings(KOGlobals::config(),"KOListView Layout"); 317 readSettings(KOGlobals::config(),"KOListView Layout");
318} 318}
319 319
320KOListView::~KOListView() 320KOListView::~KOListView()
321{ 321{
322 delete mPopupMenu; 322 delete mPopupMenu;
323} 323}
324QString KOListView::getWhatsThisText(QPoint p) 324QString KOListView::getWhatsThisText(QPoint p)
325{ 325{
326 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 326 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
327 if ( item ) 327 if ( item )
328 return KIncidenceFormatter::instance()->getFormattedText( item->data() ); 328 return KIncidenceFormatter::instance()->getFormattedText( item->data() );
329 return i18n("That is the list view" ); 329 return i18n("That is the list view" );
330 330
331} 331}
332 332
333void KOListView::updateList() 333void KOListView::updateList()
334{ 334{
335 // qDebug(" KOListView::updateList() "); 335 // qDebug(" KOListView::updateList() ");
336 336
337} 337}
338 338
339void KOListView::addCat( ) 339void KOListView::addCat( )
340{ 340{
341 setCategories( false ); 341 setCategories( false );
342} 342}
343void KOListView::setCat() 343void KOListView::setCat()
344{ 344{
345 setCategories( true ); 345 setCategories( true );
346} 346}
347void KOListView::setAlarm() 347void KOListView::setAlarm()
348{ 348{
349 KOAlarmPrefs kap( this); 349 KOAlarmPrefs kap( this);
350 if ( !kap.exec() ) 350 if ( !kap.exec() )
351 return; 351 return;
352 352
353 353
354 QStringList itemList; 354 QStringList itemList;
355 QPtrList<KOListViewItem> sel ; 355 QPtrList<KOListViewItem> sel ;
356 QListViewItem *qitem = mListView->firstChild (); 356 QListViewItem *qitem = mListView->firstChild ();
357 while ( qitem ) { 357 while ( qitem ) {
358 if ( qitem->isSelected() ) { 358 if ( qitem->isSelected() ) {
359 Incidence* inc = ((KOListViewItem *) qitem)->data(); 359 Incidence* inc = ((KOListViewItem *) qitem)->data();
360 if ( inc->type() != "Journal" ) { 360 if ( inc->type() != "Journal" ) {
361 if ( inc->type() == "Todo" ) { 361 if ( inc->type() == "Todo" ) {
362 if ( ((Todo*)inc)->hasDueDate() ) 362 if ( ((Todo*)inc)->hasDueDate() )
363 sel.append(((KOListViewItem *)qitem)); 363 sel.append(((KOListViewItem *)qitem));
364 } else 364 } else
365 sel.append(((KOListViewItem *)qitem)); 365 sel.append(((KOListViewItem *)qitem));
366 } 366 }
367 } 367 }
368 qitem = qitem->nextSibling(); 368 qitem = qitem->nextSibling();
369 } 369 }
370 int count = 0; 370 int count = 0;
371 KOListViewItem * item, *temp; 371 KOListViewItem * item, *temp;
372 item = sel.first(); 372 item = sel.first();
373 Incidence* inc; 373 Incidence* inc;
374 while ( item ) { 374 while ( item ) {
375 inc = item->data(); 375 inc = item->data();
376 ++count; 376 ++count;
377 if (kap.mAlarmButton->isChecked()) { 377 if (kap.mAlarmButton->isChecked()) {
378 if (inc->alarms().count() == 0) 378 if (inc->alarms().count() == 0)
379 inc->newAlarm(); 379 inc->newAlarm();
380 QPtrList<Alarm> alarms = inc->alarms(); 380 QPtrList<Alarm> alarms = inc->alarms();
381 Alarm *alarm; 381 Alarm *alarm;
382 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 382 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
383 alarm->setEnabled(true); 383 alarm->setEnabled(true);
384 int j = kap.mAlarmTimeEdit->value()* -60; 384 int j = kap.mAlarmTimeEdit->value()* -60;
385 if (kap.mAlarmIncrCombo->currentItem() == 1) 385 if (kap.mAlarmIncrCombo->currentItem() == 1)
386 j = j * 60; 386 j = j * 60;
387 else if (kap.mAlarmIncrCombo->currentItem() == 2) 387 else if (kap.mAlarmIncrCombo->currentItem() == 2)
388 j = j * (60 * 24); 388 j = j * (60 * 24);
389 alarm->setStartOffset( j ); 389 alarm->setStartOffset( j );
390 390
391 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { 391 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
392 alarm->setProcedureAlarm(kap.mAlarmProgram); 392 alarm->setProcedureAlarm(kap.mAlarmProgram);
393 } 393 }
394 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) 394 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
395 alarm->setAudioAlarm(kap.mAlarmSound); 395 alarm->setAudioAlarm(kap.mAlarmSound);
396 else 396 else
397 alarm->setType(Alarm::Invalid); 397 alarm->setType(Alarm::Invalid);
398 //alarm->setAudioAlarm("default"); 398 //alarm->setAudioAlarm("default");
399 // TODO: Deal with multiple alarms 399 // TODO: Deal with multiple alarms
400 break; // For now, stop after the first alarm 400 break; // For now, stop after the first alarm
401 } 401 }
402 } else { 402 } else {
403 Alarm* alarm = inc->alarms().first(); 403 Alarm* alarm = inc->alarms().first();
404 if ( alarm ) { 404 if ( alarm ) {
405 alarm->setEnabled(false); 405 alarm->setEnabled(false);
406 alarm->setType(Alarm::Invalid); 406 alarm->setType(Alarm::Invalid);
407 } 407 }
408 } 408 }
409 temp = item; 409 temp = item;
410 item = sel.next(); 410 item = sel.next();
411 mUidDict.remove( inc->uid() ); 411 mUidDict.remove( inc->uid() );
412 delete temp;; 412 delete temp;;
413 addIncidence( inc ); 413 addIncidence( inc );
414 } 414 }
415 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); 415 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) );
416 qDebug("KO: Set alarm for %d items", count); 416 qDebug("KO: Set alarm for %d items", count);
417 calendar()->reInitAlarmSettings(); 417 calendar()->reInitAlarmSettings();
418} 418}
419void KOListView::setCategories( bool removeOld ) 419void KOListView::setCategories( bool removeOld )
420{ 420{
421 421
422 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 422 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
423 if (! csd->exec()) { 423 if (! csd->exec()) {
424 delete csd; 424 delete csd;
425 return; 425 return;
426 } 426 }
427 QStringList catList = csd->selectedCategories(); 427 QStringList catList = csd->selectedCategories();
428 delete csd; 428 delete csd;
429 // if ( catList.count() == 0 ) 429 // if ( catList.count() == 0 )
430 // return; 430 // return;
431 catList.sort(); 431 catList.sort();
432 QString categoriesStr = catList.join(","); 432 QString categoriesStr = catList.join(",");
433 int i; 433 int i;
434 QStringList itemList; 434 QStringList itemList;
435 QPtrList<KOListViewItem> sel ; 435 QPtrList<KOListViewItem> sel ;
436 QListViewItem *qitem = mListView->firstChild (); 436 QListViewItem *qitem = mListView->firstChild ();
437 while ( qitem ) { 437 while ( qitem ) {
438 if ( qitem->isSelected() ) { 438 if ( qitem->isSelected() ) {
439 sel.append(((KOListViewItem *)qitem)); 439 sel.append(((KOListViewItem *)qitem));
440 } 440 }
441 qitem = qitem->nextSibling(); 441 qitem = qitem->nextSibling();
442 } 442 }
443 KOListViewItem * item, *temp; 443 KOListViewItem * item, *temp;
444 item = sel.first(); 444 item = sel.first();
445 Incidence* inc; 445 Incidence* inc;
446 while ( item ) { 446 while ( item ) {
447 inc = item->data(); 447 inc = item->data();
448 if ( removeOld ) { 448 if ( removeOld ) {
449 inc->setCategories( categoriesStr ); 449 inc->setCategories( categoriesStr );
450 } else { 450 } else {
451 itemList = QStringList::split (",", inc->categoriesStr() ); 451 itemList = QStringList::split (",", inc->categoriesStr() );
452 for( i = 0; i< catList.count(); ++i ) { 452 for( i = 0; i< catList.count(); ++i ) {
453 if ( !itemList.contains (catList[i])) 453 if ( !itemList.contains (catList[i]))
454 itemList.append( catList[i] ); 454 itemList.append( catList[i] );
455 } 455 }
456 itemList.sort(); 456 itemList.sort();
457 inc->setCategories( itemList.join(",") ); 457 inc->setCategories( itemList.join(",") );
458 } 458 }
459 temp = item; 459 temp = item;
460 item = sel.next(); 460 item = sel.next();
461 mUidDict.remove( inc->uid() ); 461 mUidDict.remove( inc->uid() );
462 delete temp;; 462 delete temp;;
463 addIncidence( inc ); 463 addIncidence( inc );
464 } 464 }
465} 465}
466 466
467void KOListView::beamSelected() 467void KOListView::beamSelected()
468{ 468{
469 int icount = 0; 469 int icount = 0;
470 QPtrList<Incidence> delSel ; 470 QPtrList<Incidence> delSel ;
471 QListViewItem *item = mListView->firstChild (); 471 QListViewItem *item = mListView->firstChild ();
472 while ( item ) { 472 while ( item ) {
473 if ( item->isSelected() ) { 473 if ( item->isSelected() ) {
474 delSel.append(((KOListViewItem *)item)->data()); 474 delSel.append(((KOListViewItem *)item)->data());
475 ++icount; 475 ++icount;
476 } 476 }
477 477
478 item = item->nextSibling(); 478 item = item->nextSibling();
479 } 479 }
480 if ( icount ) { 480 if ( icount ) {
481 emit beamIncidenceList( delSel ); 481 emit beamIncidenceList( delSel );
482 return; 482 return;
483 QString fn ; 483 QString fn ;
484 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; 484 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs";
485 QString mes; 485 QString mes;
486 bool createbup = true; 486 bool createbup = true;
487 if ( createbup ) { 487 if ( createbup ) {
488 QString description = "\n"; 488 QString description = "\n";
489 CalendarLocal* cal = new CalendarLocal(); 489 CalendarLocal* cal = new CalendarLocal();
490 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 490 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
491 Incidence *incidence = delSel.first(); 491 Incidence *incidence = delSel.first();
492 while ( incidence ) { 492 while ( incidence ) {
493 Incidence *in = incidence->clone(); 493 Incidence *in = incidence->clone();
494 description += in->summary() + "\n"; 494 description += in->summary() + "\n";
495 cal->addIncidence( in ); 495 cal->addIncidence( in );
496 incidence = delSel.next(); 496 incidence = delSel.next();
497 } 497 }
498 FileStorage storage( cal, fn, new VCalFormat ); 498 FileStorage storage( cal, fn, new VCalFormat );
499 storage.save(); 499 storage.save();
500 delete cal; 500 delete cal;
501 mes = i18n("KO/Pi: Ready for beaming"); 501 mes = i18n("KO/Pi: Ready for beaming");
502 topLevelWidget()->setCaption(mes); 502 topLevelWidget()->setCaption(mes);
503 503
504#ifndef DESKTOP_VERSION 504#ifndef DESKTOP_VERSION
505 Ir *ir = new Ir( this ); 505 Ir *ir = new Ir( this );
506 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 506 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
507 ir->send( fn, description, "text/x-vCalendar" ); 507 ir->send( fn, description, "text/x-vCalendar" );
508#endif 508#endif
509 } 509 }
510 } 510 }
511} 511}
512void KOListView::beamDone( Ir *ir ) 512void KOListView::beamDone( Ir *ir )
513{ 513{
514#ifndef DESKTOP_VERSION 514#ifndef DESKTOP_VERSION
515 delete ir; 515 delete ir;
516#endif 516#endif
517 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); 517 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done"));
518} 518}
519 519
520void KOListView::saveDescriptionToFile() 520void KOListView::saveDescriptionToFile()
521{ 521{
522 522
523 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 523 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
524 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), 524 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
525 i18n("Continue"), i18n("Cancel"), 0, 525 i18n("Continue"), i18n("Cancel"), 0,
526 0, 1 ); 526 0, 1 );
527 if ( result != 0 ) { 527 if ( result != 0 ) {
528 return; 528 return;
529 } 529 }
530 int icount = 0; 530 int icount = 0;
531 QPtrList<Incidence> delSel ; 531 QPtrList<Incidence> delSel ;
532 QListViewItem *item = mListView->firstChild (); 532 QListViewItem *item = mListView->firstChild ();
533 while ( item ) { 533 while ( item ) {
534 if ( item->isSelected() ) { 534 if ( item->isSelected() ) {
535 delSel.append(((KOListViewItem *)item)->data()); 535 delSel.append(((KOListViewItem *)item)->data());
536 ++icount; 536 ++icount;
537 } 537 }
538 538
539 item = item->nextSibling(); 539 item = item->nextSibling();
540 } 540 }
541 if ( icount ) { 541 if ( icount ) {
542 QString fn = KOPrefs::instance()->mLastSaveFile; 542 QString fn = KOPrefs::instance()->mLastSaveFile;
543 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 543 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
544 544
545 if ( fn == "" ) 545 if ( fn == "" )
546 return; 546 return;
547 QFileInfo info; 547 QFileInfo info;
548 info.setFile( fn ); 548 info.setFile( fn );
549 QString mes; 549 QString mes;
550 bool createbup = true; 550 bool createbup = true;
551 if ( info. exists() ) { 551 if ( info. exists() ) {
552 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 552 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
553 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 553 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
554 i18n("Overwrite!"), i18n("Cancel"), 0, 554 i18n("Overwrite!"), i18n("Cancel"), 0,
555 0, 1 ); 555 0, 1 );
556 if ( result != 0 ) { 556 if ( result != 0 ) {
557 createbup = false; 557 createbup = false;
558 } 558 }
559 } 559 }
560 if ( createbup ) { 560 if ( createbup ) {
561 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + 561 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") +
562 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); 562 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false);
563 Incidence *incidence = delSel.first(); 563 Incidence *incidence = delSel.first();
564 icount = 0; 564 icount = 0;
565 while ( incidence ) { 565 while ( incidence ) {
566 if ( incidence->type() == "Journal" ) { 566 if ( incidence->type() == "Journal" ) {
567 text += "\n************************************\n"; 567 text += "\n************************************\n";
568 text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); 568 text += i18n("Journal from: ") +incidence->dtStartDateStr( false );
569 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 569 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
570 text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); 570 text +="\n" + i18n("Description: ") + "\n"+ incidence->description();
571 ++icount; 571 ++icount;
572 572
573 } else { 573 } else {
574 if ( !incidence->description().isEmpty() ) { 574 if ( !incidence->description().isEmpty() ) {
575 text += "\n************************************\n"; 575 text += "\n************************************\n";
576 if ( incidence->type() == "Todo" ) 576 if ( incidence->type() == "Todo" )
577 text += i18n("To-Do: "); 577 text += i18n("To-Do: ");
578 text += incidence->summary(); 578 text += incidence->summary();
579 if ( incidence->hasStartDate() ) 579 if ( incidence->hasStartDate() )
580 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); 580 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
581 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 581 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
582 if ( !incidence->location().isEmpty() ) 582 if ( !incidence->location().isEmpty() )
583 text += "\n" +i18n("Location: ") + incidence->location(); 583 text += "\n" +i18n("Location: ") + incidence->location();
584 text += "\n" + i18n("Description: ") + "\n" + incidence->description(); 584 text += "\n" + i18n("Description: ") + "\n" + incidence->description();
585 ++icount; 585 ++icount;
586 586
587 } 587 }
588 } 588 }
589 incidence = delSel.next(); 589 incidence = delSel.next();
590 } 590 }
591 QFile file( fn ); 591 QFile file( fn );
592 if (!file.open( IO_WriteOnly ) ) { 592 if (!file.open( IO_WriteOnly ) ) {
593 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); 593 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") );
594 return; 594 return;
595 } 595 }
596 QTextStream ts( &file ); 596 QTextStream ts( &file );
597 ts << text; 597 ts << text;
598 file.close(); 598 file.close();
599 //qDebug("%s ", text.latin1()); 599 //qDebug("%s ", text.latin1());
600 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); 600 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount );
601 KOPrefs::instance()->mLastSaveFile = fn; 601 KOPrefs::instance()->mLastSaveFile = fn;
602 topLevelWidget()->setCaption(mes); 602 topLevelWidget()->setCaption(mes);
603 } 603 }
604 } 604 }
605} 605}
606void KOListView::saveToFile() 606void KOListView::saveToFile()
607{ 607{
608 608
609 int icount = 0; 609 int icount = 0;
610 QPtrList<Incidence> delSel ; 610 QPtrList<Incidence> delSel ;
611 QListViewItem *item = mListView->firstChild (); 611 QListViewItem *item = mListView->firstChild ();
612 while ( item ) { 612 while ( item ) {
613 if ( item->isSelected() ) { 613 if ( item->isSelected() ) {
614 delSel.append(((KOListViewItem *)item)->data()); 614 delSel.append(((KOListViewItem *)item)->data());
615 ++icount; 615 ++icount;
616 } 616 }
617 617
618 item = item->nextSibling(); 618 item = item->nextSibling();
619 } 619 }
620 if ( icount ) { 620 if ( icount ) {
621 QString fn = KOPrefs::instance()->mLastSaveFile; 621 QString fn = KOPrefs::instance()->mLastSaveFile;
622 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 622 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
623 623
624 if ( fn == "" ) 624 if ( fn == "" )
625 return; 625 return;
626 QFileInfo info; 626 QFileInfo info;
627 info.setFile( fn ); 627 info.setFile( fn );
628 QString mes; 628 QString mes;
629 bool createbup = true; 629 bool createbup = true;
630 if ( info. exists() ) { 630 if ( info. exists() ) {
631 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 631 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
632 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 632 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
633 i18n("Overwrite!"), i18n("Cancel"), 0, 633 i18n("Overwrite!"), i18n("Cancel"), 0,
634 0, 1 ); 634 0, 1 );
635 if ( result != 0 ) { 635 if ( result != 0 ) {
636 createbup = false; 636 createbup = false;
637 } 637 }
638 } 638 }
639 if ( createbup ) { 639 if ( createbup ) {
640 CalendarLocal cal; 640 CalendarLocal cal;
641 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 641 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
642 Incidence *incidence = delSel.first(); 642 Incidence *incidence = delSel.first();
643 while ( incidence ) { 643 while ( incidence ) {
644 cal.addIncidence( incidence->clone() ); 644 cal.addIncidence( incidence->clone() );
645 incidence = delSel.next(); 645 incidence = delSel.next();
646 } 646 }
647 ICalFormat format; 647 ICalFormat format;
648 format.save( &cal, fn ); 648 format.save( &cal, fn );
649 mes = i18n("KO/Pi:Saved %1").arg(fn ); 649 mes = i18n("KO/Pi:Saved %1").arg(fn );
650 KOPrefs::instance()->mLastSaveFile = fn; 650 KOPrefs::instance()->mLastSaveFile = fn;
651 topLevelWidget()->setCaption(mes); 651 topLevelWidget()->setCaption(mes);
652 } 652 }
653 } 653 }
654} 654}
655void KOListView::deleteAll() 655void KOListView::deleteAll()
656{ 656{
657 int icount = 0; 657 int icount = 0;
658 QPtrList<Incidence> delSel ; 658 QPtrList<Incidence> delSel ;
659 QListViewItem *item = mListView->firstChild (); 659 QListViewItem *item = mListView->firstChild ();
660 while ( item ) { 660 while ( item ) {
661 if ( item->isSelected() ) { 661 if ( item->isSelected() ) {
662 delSel.append(((KOListViewItem *)item)->data()); 662 delSel.append(((KOListViewItem *)item)->data());
663 ++icount; 663 ++icount;
664 } 664 }
665 665
666 item = item->nextSibling(); 666 item = item->nextSibling();
667 } 667 }
668 if ( icount ) { 668 if ( icount ) {
669 Incidence *incidence = delSel.first(); 669 Incidence *incidence = delSel.first();
670 Incidence *toDelete; 670 Incidence *toDelete;
671 KOPrefs *p = KOPrefs::instance(); 671 KOPrefs *p = KOPrefs::instance();
672 bool confirm = p->mConfirm; 672 bool confirm = p->mConfirm;
673 QString mess; 673 QString mess;
674 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); 674 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount );
675 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { 675 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) {
676 p->mConfirm = false; 676 p->mConfirm = false;
677 int delCounter = 0; 677 int delCounter = 0;
678 QDialog dia ( this, "p-dialog", true ); 678 QDialog dia ( this, "p-dialog", true );
679 QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); 679 QLabel lab (i18n("Close dialog to abort deletion!"), &dia );
680 QVBoxLayout lay( &dia ); 680 QVBoxLayout lay( &dia );
681 lay.setMargin(7); 681 lay.setMargin(7);
682 lay.setSpacing(7); 682 lay.setSpacing(7);
683 lay.addWidget( &lab); 683 lay.addWidget( &lab);
684 QProgressBar bar( icount, &dia ); 684 QProgressBar bar( icount, &dia );
685 lay.addWidget( &bar); 685 lay.addWidget( &bar);
686 int w = 220; 686 int w = 220;
687 int h = 50; 687 int h = 50;
688 int dw = QApplication::desktop()->width(); 688 int dw = QApplication::desktop()->width();
689 int dh = QApplication::desktop()->height(); 689 int dh = QApplication::desktop()->height();
690 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 690 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
691 //dia.resize( 240,50 ); 691 //dia.resize( 240,50 );
692 dia.show(); 692 dia.show();
693 693
694 while ( incidence ) { 694 while ( incidence ) {
695 bar.setProgress( delCounter ); 695 bar.setProgress( delCounter );
696 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); 696 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter );
697 dia.setCaption( mess ); 697 dia.setCaption( mess );
698 qApp->processEvents(); 698 qApp->processEvents();
699 toDelete = (incidence); 699 toDelete = (incidence);
700 incidence = delSel.next(); 700 incidence = delSel.next();
701 emit deleteIncidenceSignal(toDelete ); 701 emit deleteIncidenceSignal(toDelete );
702 if ( dia.result() != 0 ) 702 if ( dia.result() != 0 )
703 break; 703 break;
704 704
705 } 705 }
706 mess = mess.sprintf( i18n("%d items remaining in list."), count() ); 706 mess = mess.sprintf( i18n("%d items remaining in list."), count() );
707 topLevelWidget ()->setCaption( mess ); 707 topLevelWidget ()->setCaption( mess );
708 p->mConfirm = confirm; 708 p->mConfirm = confirm;
709 } 709 }
710 } 710 }
711 711
712 712
713} 713}
714int KOListView::maxDatesHint() 714int KOListView::maxDatesHint()
715{ 715{
716 return 0; 716 return 0;
717} 717}
718 718
719int KOListView::currentDateCount() 719int KOListView::currentDateCount()
720{ 720{
721 return 0; 721 return 0;
722} 722}
723 723
724QPtrList<Incidence> KOListView::selectedIncidences() 724QPtrList<Incidence> KOListView::selectedIncidences()
725{ 725{
726 QPtrList<Incidence> eventList; 726 QPtrList<Incidence> eventList;
727 QListViewItem *item = mListView->firstChild (); 727 QListViewItem *item = mListView->firstChild ();
728 while ( item ) { 728 while ( item ) {
729 if ( item->isSelected() ) { 729 if ( item->isSelected() ) {
730 eventList.append(((KOListViewItem *)item)->data()); 730 eventList.append(((KOListViewItem *)item)->data());
731 } 731 }
732 732
733 item = item->nextSibling(); 733 item = item->nextSibling();
734 } 734 }
735 735
736 // // QListViewItem *item = mListView->selectedItem(); 736 // // QListViewItem *item = mListView->selectedItem();
737 //if (item) eventList.append(((KOListViewItem *)item)->data()); 737 //if (item) eventList.append(((KOListViewItem *)item)->data());
738 738
739 return eventList; 739 return eventList;
740} 740}
741 741
742DateList KOListView::selectedDates() 742DateList KOListView::selectedDates()
743{ 743{
744 DateList eventList; 744 DateList eventList;
745 return eventList; 745 return eventList;
746} 746}
747 747
748void KOListView::showDates(bool show) 748void KOListView::showDates(bool show)
749{ 749{
750 // Shouldn't we set it to a value greater 0? When showDates is called with 750 // Shouldn't we set it to a value greater 0? When showDates is called with
751 // show == true at first, then the columnwidths are set to zero. 751 // show == true at first, then the columnwidths are set to zero.
752 static int oldColWidth1 = 0; 752 static int oldColWidth1 = 0;
753 static int oldColWidth3 = 0; 753 static int oldColWidth3 = 0;
754 754
755 if (!show) { 755 if (!show) {
756 oldColWidth1 = mListView->columnWidth(1); 756 oldColWidth1 = mListView->columnWidth(1);
757 oldColWidth3 = mListView->columnWidth(3); 757 oldColWidth3 = mListView->columnWidth(3);
758 mListView->setColumnWidth(1, 0); 758 mListView->setColumnWidth(1, 0);
759 mListView->setColumnWidth(3, 0); 759 mListView->setColumnWidth(3, 0);
760 } else { 760 } else {
761 mListView->setColumnWidth(1, oldColWidth1); 761 mListView->setColumnWidth(1, oldColWidth1);
762 mListView->setColumnWidth(3, oldColWidth3); 762 mListView->setColumnWidth(3, oldColWidth3);
763 } 763 }
764 mListView->repaint(); 764 mListView->repaint();
765} 765}
766 766
767void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, 767void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd,
768 const QDate &td) 768 const QDate &td)
769{ 769{
770#ifndef KORG_NOPRINTER 770#ifndef KORG_NOPRINTER
771 calPrinter->preview(CalPrinter::Day, fd, td); 771 calPrinter->preview(CalPrinter::Day, fd, td);
772#endif 772#endif
773} 773}
774 774
775void KOListView::showDates() 775void KOListView::showDates()
776{ 776{
777 showDates(true); 777 showDates(true);
778} 778}
779 779