summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp103
-rw-r--r--korganizer/calendarview.h5
2 files changed, 106 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 1de2759..b3b4cdb 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -38,96 +38,97 @@
38#include <qcursor.h> 38#include <qcursor.h>
39#include <qmessagebox.h> 39#include <qmessagebox.h>
40#include <qprogressbar.h> 40#include <qprogressbar.h>
41#include <qmultilineedit.h> 41#include <qmultilineedit.h>
42#include <qtimer.h> 42#include <qtimer.h>
43#include <qwidgetstack.h> 43#include <qwidgetstack.h>
44#include <qptrlist.h> 44#include <qptrlist.h>
45#include <qregexp.h> 45#include <qregexp.h>
46#include <qgroupbox.h> 46#include <qgroupbox.h>
47#include <qfile.h> 47#include <qfile.h>
48#include <qdir.h> 48#include <qdir.h>
49#ifndef KORG_NOSPLITTER 49#ifndef KORG_NOSPLITTER
50#include <qsplitter.h> 50#include <qsplitter.h>
51#endif 51#endif
52 52
53#include <kglobal.h> 53#include <kglobal.h>
54#include <kdebug.h> 54#include <kdebug.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56#include <kfiledialog.h> 56#include <kfiledialog.h>
57#include <kmessagebox.h> 57#include <kmessagebox.h>
58#include <knotifyclient.h> 58#include <knotifyclient.h>
59#include <kconfig.h> 59#include <kconfig.h>
60 60
61#include <libkdepim/ksyncprefsdialog.h> 61#include <libkdepim/ksyncprefsdialog.h>
62#include <krun.h> 62#include <krun.h>
63#include <kdirwatch.h> 63#include <kdirwatch.h>
64#include <libkdepim/kdatepicker.h> 64#include <libkdepim/kdatepicker.h>
65#include <libkdepim/ksyncprofile.h> 65#include <libkdepim/ksyncprofile.h>
66#include <libkdepim/kpimglobalprefs.h> 66#include <libkdepim/kpimglobalprefs.h>
67 67
68#include <libkcal/vcaldrag.h> 68#include <libkcal/vcaldrag.h>
69#include <libkcal/icaldrag.h> 69#include <libkcal/icaldrag.h>
70#include <libkcal/icalformat.h> 70#include <libkcal/icalformat.h>
71#include <libkcal/vcalformat.h> 71#include <libkcal/vcalformat.h>
72#include <libkcal/scheduler.h> 72#include <libkcal/scheduler.h>
73#include <libkcal/calendarlocal.h> 73#include <libkcal/calendarlocal.h>
74#include <libkcal/journal.h> 74#include <libkcal/journal.h>
75#include <libkcal/calfilter.h> 75#include <libkcal/calfilter.h>
76#include <libkcal/attendee.h> 76#include <libkcal/attendee.h>
77#include <libkcal/dndfactory.h> 77#include <libkcal/dndfactory.h>
78#include <libkcal/freebusy.h> 78#include <libkcal/freebusy.h>
79#include <libkcal/filestorage.h> 79#include <libkcal/filestorage.h>
80#include <libkcal/calendarresources.h> 80#include <libkcal/calendarresources.h>
81#include <libkcal/qtopiaformat.h> 81#include <libkcal/qtopiaformat.h>
82#include "../kalarmd/alarmdialog.h" 82#include "../kalarmd/alarmdialog.h"
83 83
84#ifndef DESKTOP_VERSION 84#ifndef DESKTOP_VERSION
85#include <libkcal/sharpformat.h> 85#include <libkcal/sharpformat.h>
86#include <externalapphandler.h>
86#endif 87#endif
87#include <libkcal/phoneformat.h> 88#include <libkcal/phoneformat.h>
88#ifndef KORG_NOMAIL 89#ifndef KORG_NOMAIL
89#include "komailclient.h" 90#include "komailclient.h"
90#endif 91#endif
91#ifndef KORG_NOPRINTER 92#ifndef KORG_NOPRINTER
92#include "calprinter.h" 93#include "calprinter.h"
93#endif 94#endif
94#ifndef KORG_NOPLUGINS 95#ifndef KORG_NOPLUGINS
95#include "kocore.h" 96#include "kocore.h"
96#endif 97#endif
97#include "koeventeditor.h" 98#include "koeventeditor.h"
98#include "kotodoeditor.h" 99#include "kotodoeditor.h"
99#include "koprefs.h" 100#include "koprefs.h"
100#include "koeventviewerdialog.h" 101#include "koeventviewerdialog.h"
101#include "publishdialog.h" 102#include "publishdialog.h"
102#include "kofilterview.h" 103#include "kofilterview.h"
103#include "koglobals.h" 104#include "koglobals.h"
104#include "koviewmanager.h" 105#include "koviewmanager.h"
105#include "koagendaview.h" 106#include "koagendaview.h"
106#include "kodialogmanager.h" 107#include "kodialogmanager.h"
107#include "outgoingdialog.h" 108#include "outgoingdialog.h"
108#include "incomingdialog.h" 109#include "incomingdialog.h"
109#include "statusdialog.h" 110#include "statusdialog.h"
110#include "kdatenavigator.h" 111#include "kdatenavigator.h"
111#include "kotodoview.h" 112#include "kotodoview.h"
112#include "datenavigator.h" 113#include "datenavigator.h"
113#include "resourceview.h" 114#include "resourceview.h"
114#include "navigatorbar.h" 115#include "navigatorbar.h"
115#include "searchdialog.h" 116#include "searchdialog.h"
116#include "mainwindow.h" 117#include "mainwindow.h"
117 118
118#include "calendarview.h" 119#include "calendarview.h"
119#ifndef DESKTOP_VERSION 120#ifndef DESKTOP_VERSION
120#include <qtopia/alarmserver.h> 121#include <qtopia/alarmserver.h>
121#endif 122#endif
122#ifndef _WIN32_ 123#ifndef _WIN32_
123#include <stdlib.h> 124#include <stdlib.h>
124#include <stdio.h> 125#include <stdio.h>
125#include <unistd.h> 126#include <unistd.h>
126#else 127#else
127#include <qprocess.h> 128#include <qprocess.h>
128#endif 129#endif
129using namespace KOrg; 130using namespace KOrg;
130using namespace KCal; 131using namespace KCal;
131extern int globalFlagBlockAgenda; 132extern int globalFlagBlockAgenda;
132extern int globalFlagBlockStartup; 133extern int globalFlagBlockStartup;
133 134
@@ -417,96 +418,104 @@ void CalendarView::init()
417 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 418 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
418 SLOT( updateTodo( Todo *, int ) ) ); 419 SLOT( updateTodo( Todo *, int ) ) );
419 connect( this, SIGNAL( todoModified( Todo *, int )), this, 420 connect( this, SIGNAL( todoModified( Todo *, int )), this,
420 SLOT( changeTodoDisplay( Todo *, int ) ) ); 421 SLOT( changeTodoDisplay( Todo *, int ) ) );
421 422
422 423
423 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 424 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
424 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 425 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
425 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 426 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
426 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 427 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
427 428
428 429
429 430
430 431
431 432
432 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 433 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
433 SLOT(checkClipboard())); 434 SLOT(checkClipboard()));
434 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 435 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
435 SLOT( processTodoListSelection( Incidence * ) ) ); 436 SLOT( processTodoListSelection( Incidence * ) ) );
436 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 437 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
437 438
438 // kdDebug() << "CalendarView::CalendarView() done" << endl; 439 // kdDebug() << "CalendarView::CalendarView() done" << endl;
439 440
440 mDateFrame = new QVBox(0,0,WType_Popup); 441 mDateFrame = new QVBox(0,0,WType_Popup);
441 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 442 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
442 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 443 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
443 mDateFrame->setLineWidth(3); 444 mDateFrame->setLineWidth(3);
444 mDateFrame->hide(); 445 mDateFrame->hide();
445 mDateFrame->setCaption( i18n( "Pick a date to display")); 446 mDateFrame->setCaption( i18n( "Pick a date to display"));
446 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 447 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
447 448
448 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 449 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
449 450
450 mEventEditor = mDialogManager->getEventEditor(); 451 mEventEditor = mDialogManager->getEventEditor();
451 mTodoEditor = mDialogManager->getTodoEditor(); 452 mTodoEditor = mDialogManager->getTodoEditor();
452 453
453 mFlagEditDescription = false; 454 mFlagEditDescription = false;
454 455
455 mSuspendTimer = new QTimer( this ); 456 mSuspendTimer = new QTimer( this );
456 mAlarmTimer = new QTimer( this ); 457 mAlarmTimer = new QTimer( this );
457 mRecheckAlarmTimer = new QTimer( this ); 458 mRecheckAlarmTimer = new QTimer( this );
458 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 459 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
459 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 460 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
460 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 461 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
461 mAlarmDialog = new AlarmDialog( this ); 462 mAlarmDialog = new AlarmDialog( this );
462 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 463 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
463 mAlarmDialog->setServerNotification( false ); 464 mAlarmDialog->setServerNotification( false );
464 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 465 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
466
467
468#ifndef DESKTOP_VERSION
469//US listen for arriving address resultsets
470 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
471 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
472#endif
473
465} 474}
466 475
467 476
468CalendarView::~CalendarView() 477CalendarView::~CalendarView()
469{ 478{
470 // kdDebug() << "~CalendarView()" << endl; 479 // kdDebug() << "~CalendarView()" << endl;
471 //qDebug("CalendarView::~CalendarView() "); 480 //qDebug("CalendarView::~CalendarView() ");
472 delete mDialogManager; 481 delete mDialogManager;
473 delete mViewManager; 482 delete mViewManager;
474 delete mStorage; 483 delete mStorage;
475 delete mDateFrame ; 484 delete mDateFrame ;
476 delete beamDialog; 485 delete beamDialog;
477 //kdDebug() << "~CalendarView() done" << endl; 486 //kdDebug() << "~CalendarView() done" << endl;
478} 487}
479void CalendarView::timerAlarm() 488void CalendarView::timerAlarm()
480{ 489{
481 //qDebug("CalendarView::timerAlarm() "); 490 //qDebug("CalendarView::timerAlarm() ");
482 computeAlarm(mAlarmNotification ); 491 computeAlarm(mAlarmNotification );
483} 492}
484 493
485void CalendarView::suspendAlarm() 494void CalendarView::suspendAlarm()
486{ 495{
487 //qDebug(" CalendarView::suspendAlarm() "); 496 //qDebug(" CalendarView::suspendAlarm() ");
488 computeAlarm(mSuspendAlarmNotification ); 497 computeAlarm(mSuspendAlarmNotification );
489 498
490} 499}
491 500
492void CalendarView::startAlarm( QString mess , QString filename) 501void CalendarView::startAlarm( QString mess , QString filename)
493{ 502{
494 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 503 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
495 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 504 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
496 505
497} 506}
498 507
499void CalendarView::checkNextTimerAlarm() 508void CalendarView::checkNextTimerAlarm()
500{ 509{
501 mCalendar->checkAlarmForIncidence( 0, true ); 510 mCalendar->checkAlarmForIncidence( 0, true );
502} 511}
503 512
504void CalendarView::computeAlarm( QString msg ) 513void CalendarView::computeAlarm( QString msg )
505{ 514{
506 515
507 QString mess = msg; 516 QString mess = msg;
508 QString mAlarmMessage = mess.mid( 9 ); 517 QString mAlarmMessage = mess.mid( 9 );
509 QString filename = MainWindow::resourcePath(); 518 QString filename = MainWindow::resourcePath();
510 filename += "koalarm.wav"; 519 filename += "koalarm.wav";
511 QString tempfilename; 520 QString tempfilename;
512 if ( mess.left( 13 ) == "suspend_alarm") { 521 if ( mess.left( 13 ) == "suspend_alarm") {
@@ -1279,141 +1288,231 @@ void CalendarView::syncExternal( int mode )
1279 if ( sharpFormat ) 1288 if ( sharpFormat )
1280 sharpFormat->save(calendar); 1289 sharpFormat->save(calendar);
1281#endif 1290#endif
1282 if ( phoneFormat ) 1291 if ( phoneFormat )
1283 phoneFormat->save(calendar); 1292 phoneFormat->save(calendar);
1284 iL = calendar->rawIncidences(); 1293 iL = calendar->rawIncidences();
1285 inc = iL.first(); 1294 inc = iL.first();
1286 Incidence* loc; 1295 Incidence* loc;
1287 while ( inc ) { 1296 while ( inc ) {
1288 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1297 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1289 loc = mCalendar->incidence(inc->uid() ); 1298 loc = mCalendar->incidence(inc->uid() );
1290 if ( loc ) { 1299 if ( loc ) {
1291 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1300 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1292 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1301 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1293 } 1302 }
1294 } 1303 }
1295 inc = iL.next(); 1304 inc = iL.next();
1296 } 1305 }
1297 Incidence* lse = getLastSyncEvent(); 1306 Incidence* lse = getLastSyncEvent();
1298 if ( lse ) { 1307 if ( lse ) {
1299 lse->setReadOnly( false ); 1308 lse->setReadOnly( false );
1300 lse->setDescription( "" ); 1309 lse->setDescription( "" );
1301 lse->setReadOnly( true ); 1310 lse->setReadOnly( true );
1302 } 1311 }
1303 } 1312 }
1304 } 1313 }
1305 setModified( true ); 1314 setModified( true );
1306 } else { 1315 } else {
1307 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1316 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1308 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1317 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1309 question, i18n("Ok")) ; 1318 question, i18n("Ok")) ;
1310 1319
1311 } 1320 }
1312 delete calendar; 1321 delete calendar;
1313 updateView(); 1322 updateView();
1314 return ;//syncOK; 1323 return ;//syncOK;
1315 1324
1316} 1325}
1317void CalendarView::syncSharp() 1326void CalendarView::syncSharp()
1318{ 1327{
1319 syncExternal( 0 ); 1328 syncExternal( 0 );
1320 1329
1321} 1330}
1322 1331
1323 1332
1324//#include <kabc/stdaddressbook.h> 1333//#include <kabc/stdaddressbook.h>
1325bool CalendarView::importBday() 1334bool CalendarView::importBday()
1326{ 1335{
1327#if 0 1336#ifndef KORG_NOKABC
1337
1338#ifdef DESKTOP_VERSION
1328 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1339 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1329 KABC::AddressBook::Iterator it; 1340 KABC::AddressBook::Iterator it;
1330 int count = 0; 1341 int count = 0;
1331 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1342 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1332 ++count; 1343 ++count;
1333 } 1344 }
1334 QProgressBar bar(count,0 ); 1345 QProgressBar bar(count,0 );
1335 int w = 300; 1346 int w = 300;
1336 if ( QApplication::desktop()->width() < 320 ) 1347 if ( QApplication::desktop()->width() < 320 )
1337 w = 220; 1348 w = 220;
1338 int h = bar.sizeHint().height() ; 1349 int h = bar.sizeHint().height() ;
1339 int dw = QApplication::desktop()->width(); 1350 int dw = QApplication::desktop()->width();
1340 int dh = QApplication::desktop()->height(); 1351 int dh = QApplication::desktop()->height();
1341 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1352 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1342 bar.show(); 1353 bar.show();
1343 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1354 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1344 qApp->processEvents(); 1355 qApp->processEvents();
1345 count = 0; 1356 count = 0;
1346 int addCount = 0; 1357 int addCount = 0;
1347 KCal::Attendee* a = 0; 1358 KCal::Attendee* a = 0;
1348 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1359 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1349 if ( ! bar.isVisible() ) 1360 if ( ! bar.isVisible() )
1350 return false; 1361 return false;
1351 bar.setProgress( count++ ); 1362 bar.setProgress( count++ );
1352 qApp->processEvents(); 1363 qApp->processEvents();
1353 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1364 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1354 if ( (*it).birthday().date().isValid() ){ 1365 if ( (*it).birthday().date().isValid() ){
1355 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1366 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1356 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1367 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1357 ++addCount; 1368 ++addCount;
1358 } 1369 }
1359 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1370 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1360 if ( anni.isValid() ){ 1371 if ( anni.isValid() ){
1361 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1372 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1362 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1373 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1363 ++addCount; 1374 ++addCount;
1364 } 1375 }
1365 } 1376 }
1366 updateView(); 1377 updateView();
1367 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1378 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1368#endif 1379#else //DESKTOP_VERSION
1380
1381 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
1382 // the result should now arrive through method insertBirthdays
1383
1384#endif //DESKTOP_VERSION
1385
1386#endif //KORG_NOKABC
1387
1388
1369 return true; 1389 return true;
1370} 1390}
1371 1391
1392// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
1393void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
1394 const QStringList& anniversaryList, const QStringList& realNameList,
1395 const QStringList& emailList, const QStringList& assembledNameList,
1396 const QStringList& uidList)
1397{
1398 qDebug("CalendarView::insertBirthdays");
1399 if (uid == this->name())
1400 {
1401 int count = birthdayList.count();
1402 int addCount = 0;
1403 KCal::Attendee* a = 0;
1404
1405 qDebug("CalView 1 %i", count);
1406
1407 QProgressBar bar(count,0 );
1408 int w = 300;
1409 if ( QApplication::desktop()->width() < 320 )
1410 w = 220;
1411 int h = bar.sizeHint().height() ;
1412 int dw = QApplication::desktop()->width();
1413 int dh = QApplication::desktop()->height();
1414 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1415 bar.show();
1416 bar.setCaption (i18n("inserting birthdays - close to abort!") );
1417 qApp->processEvents();
1418
1419 QDate birthday;
1420 QDate anniversary;
1421 QString realName;
1422 QString email;
1423 QString assembledName;
1424 QString uid;
1425 bool ok = true;
1426 for ( int i = 0; i < count; i++)
1427 {
1428 if ( ! bar.isVisible() )
1429 return;
1430 bar.setProgress( i );
1431 qApp->processEvents();
1432
1433 qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() );
1434
1435 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok);
1436 if (!ok)
1437 qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1());
1438
1439 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok);
1440 if (!ok)
1441 qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1());
1442 realName = realNameList[i];
1443 email = emailList[i];
1444 assembledName = assembledNameList[i];
1445 uid = uidList[i];
1446
1447 if ( birthday.isValid() ){
1448 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1449 KCal::Attendee::ReqParticipant,uid) ;
1450 if ( addAnniversary( birthday, assembledName, a, true ) )
1451 ++addCount;
1452 }
1453
1454 if ( anniversary.isValid() ){
1455 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1456 KCal::Attendee::ReqParticipant,uid) ;
1457 if ( addAnniversary( anniversary, assembledName, a, false ) )
1458 ++addCount;
1459 }
1460 }
1461
1462 updateView();
1463 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1464
1465 }
1466
1467}
1468
1469
1470
1372bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1471bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1373{ 1472{
1374 //qDebug("addAnni "); 1473 //qDebug("addAnni ");
1375 Event * ev = new Event(); 1474 Event * ev = new Event();
1376 if ( a ) { 1475 if ( a ) {
1377 ev->addAttendee( a ); 1476 ev->addAttendee( a );
1378 } 1477 }
1379 QString kind; 1478 QString kind;
1380 if ( birthday ) 1479 if ( birthday )
1381 kind = i18n( "Birthday" ); 1480 kind = i18n( "Birthday" );
1382 else 1481 else
1383 kind = i18n( "Anniversary" ); 1482 kind = i18n( "Anniversary" );
1384 ev->setSummary( name + " - " + kind ); 1483 ev->setSummary( name + " - " + kind );
1385 ev->setOrganizer( "nobody@nowhere" ); 1484 ev->setOrganizer( "nobody@nowhere" );
1386 ev->setCategories( kind ); 1485 ev->setCategories( kind );
1387 ev->setDtStart( QDateTime(date) ); 1486 ev->setDtStart( QDateTime(date) );
1388 ev->setDtEnd( QDateTime(date) ); 1487 ev->setDtEnd( QDateTime(date) );
1389 ev->setFloats( true ); 1488 ev->setFloats( true );
1390 Recurrence * rec = ev->recurrence(); 1489 Recurrence * rec = ev->recurrence();
1391 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1490 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1392 rec->addYearlyNum( date.month() ); 1491 rec->addYearlyNum( date.month() );
1393 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1492 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1394 delete ev; 1493 delete ev;
1395 return false; 1494 return false;
1396 } 1495 }
1397 return true; 1496 return true;
1398 1497
1399} 1498}
1400bool CalendarView::importQtopia( const QString &categories, 1499bool CalendarView::importQtopia( const QString &categories,
1401 const QString &datebook, 1500 const QString &datebook,
1402 const QString &todolist ) 1501 const QString &todolist )
1403{ 1502{
1404 1503
1405 QtopiaFormat qtopiaFormat; 1504 QtopiaFormat qtopiaFormat;
1406 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1505 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1407 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1506 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1408 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1507 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1409 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1508 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1410 1509
1411 updateView(); 1510 updateView();
1412 return true; 1511 return true;
1413 1512
1414#if 0 1513#if 0
1415 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1514 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1416 mCurrentSyncDevice = "qtopia-XML"; 1515 mCurrentSyncDevice = "qtopia-XML";
1417 if ( KOPrefs::instance()->mAskForPreferences ) 1516 if ( KOPrefs::instance()->mAskForPreferences )
1418 edit_sync_options(); 1517 edit_sync_options();
1419 qApp->processEvents(); 1518 qApp->processEvents();
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 0f7e696..8d329a9 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -138,96 +138,101 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
138 /** Emitted when the unit of navigation changes */ 138 /** Emitted when the unit of navigation changes */
139 void changeNavStringPrev(const QString &); 139 void changeNavStringPrev(const QString &);
140 void changeNavStringNext(const QString &); 140 void changeNavStringNext(const QString &);
141 141
142 /** Emitted when state of events selection has changed and user is organizer*/ 142 /** Emitted when state of events selection has changed and user is organizer*/
143 void organizerEventsSelected(bool); 143 void organizerEventsSelected(bool);
144 /** Emitted when state of events selection has changed and user is attendee*/ 144 /** Emitted when state of events selection has changed and user is attendee*/
145 void groupEventsSelected(bool); 145 void groupEventsSelected(bool);
146 /** 146 /**
147 Emitted when an incidence gets selected. If the selection is cleared the 147 Emitted when an incidence gets selected. If the selection is cleared the
148 signal is emitted with 0 as argument. 148 signal is emitted with 0 as argument.
149 */ 149 */
150 void incidenceSelected( Incidence * ); 150 void incidenceSelected( Incidence * );
151 /** Emitted, when a todoitem is selected or deselected. */ 151 /** Emitted, when a todoitem is selected or deselected. */
152 void todoSelected( bool ); 152 void todoSelected( bool );
153 153
154 /** 154 /**
155 Emitted, when clipboard content changes. Parameter indicates if paste 155 Emitted, when clipboard content changes. Parameter indicates if paste
156 is possible or not. 156 is possible or not.
157 */ 157 */
158 void pasteEnabled(bool); 158 void pasteEnabled(bool);
159 159
160 /** Emitted, when the number of incoming messages has changed. */ 160 /** Emitted, when the number of incoming messages has changed. */
161 void numIncomingChanged(int); 161 void numIncomingChanged(int);
162 162
163 /** Emitted, when the number of outgoing messages has changed. */ 163 /** Emitted, when the number of outgoing messages has changed. */
164 void numOutgoingChanged(int); 164 void numOutgoingChanged(int);
165 165
166 /** Send status message, which can e.g. be displayed in the status bar. */ 166 /** Send status message, which can e.g. be displayed in the status bar. */
167 void statusMessage(const QString &); 167 void statusMessage(const QString &);
168 168
169 void calendarViewExpanded( bool ); 169 void calendarViewExpanded( bool );
170 void updateSearchDialog(); 170 void updateSearchDialog();
171 171
172 172
173 public slots: 173 public slots:
174 void showOpenError(); 174 void showOpenError();
175 void watchSavedFile(); 175 void watchSavedFile();
176 void recheckTimerAlarm(); 176 void recheckTimerAlarm();
177 void checkNextTimerAlarm(); 177 void checkNextTimerAlarm();
178 void addAlarm(const QDateTime &qdt, const QString &noti ); 178 void addAlarm(const QDateTime &qdt, const QString &noti );
179 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 179 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
180 void removeAlarm(const QDateTime &qdt, const QString &noti ); 180 void removeAlarm(const QDateTime &qdt, const QString &noti );
181 181
182 /** options dialog made a changed to the configuration. we catch this 182 /** options dialog made a changed to the configuration. we catch this
183 * and notify all widgets which need to update their configuration. */ 183 * and notify all widgets which need to update their configuration. */
184 void updateConfig(); 184 void updateConfig();
185 185
186 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
187 const QStringList& anniversaryList, const QStringList& realNameList,
188 const QStringList& emailList, const QStringList& assembledNameList,
189 const QStringList& uidList);
190
186 /** 191 /**
187 Load calendar from file \a filename. If \a merge is true, load 192 Load calendar from file \a filename. If \a merge is true, load
188 calendar into existing one, if it is false, clear calendar, before 193 calendar into existing one, if it is false, clear calendar, before
189 loading. Return true, if calendar could be successfully loaded. 194 loading. Return true, if calendar could be successfully loaded.
190 */ 195 */
191 bool openCalendar(QString filename, bool merge=false); 196 bool openCalendar(QString filename, bool merge=false);
192 bool syncCalendar(QString filename,int mode = 0 ); 197 bool syncCalendar(QString filename,int mode = 0 );
193 198
194 /** 199 /**
195 Save calendar data to file. Return true if calendar could be 200 Save calendar data to file. Return true if calendar could be
196 successfully saved. 201 successfully saved.
197 */ 202 */
198 bool saveCalendar(QString filename); 203 bool saveCalendar(QString filename);
199 204
200 /** 205 /**
201 Close calendar. Clear calendar data and reset views to display an empty 206 Close calendar. Clear calendar data and reset views to display an empty
202 calendar. 207 calendar.
203 */ 208 */
204 void closeCalendar(); 209 void closeCalendar();
205 210
206 /** Archive old events of calendar */ 211 /** Archive old events of calendar */
207 void archiveCalendar(); 212 void archiveCalendar();
208 213
209 void showIncidence(); 214 void showIncidence();
210 void editIncidence(); 215 void editIncidence();
211 void editIncidenceDescription(); 216 void editIncidenceDescription();
212 void deleteIncidence(); 217 void deleteIncidence();
213 void cloneIncidence(); 218 void cloneIncidence();
214 void moveIncidence(); 219 void moveIncidence();
215 void beamIncidence(); 220 void beamIncidence();
216 void toggleCancelIncidence(); 221 void toggleCancelIncidence();
217 222
218 /** create an editeventwin with supplied date/time, and if bool is true, 223 /** create an editeventwin with supplied date/time, and if bool is true,
219 * make the event take all day. */ 224 * make the event take all day. */
220 void newEvent(QDateTime, QDateTime, bool allDay = false); 225 void newEvent(QDateTime, QDateTime, bool allDay = false);
221 void newEvent(QDateTime fh); 226 void newEvent(QDateTime fh);
222 void newEvent(QDate dt); 227 void newEvent(QDate dt);
223 /** create new event without having a date hint. Takes current date as 228 /** create new event without having a date hint. Takes current date as
224 default hint. */ 229 default hint. */
225 void newEvent(); 230 void newEvent();
226 void newFloatingEvent(); 231 void newFloatingEvent();
227 232
228 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 233 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
229 void showIncidence(Incidence *); 234 void showIncidence(Incidence *);
230 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 235 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
231 void editIncidence(Incidence *); 236 void editIncidence(Incidence *);
232 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 237 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
233 void deleteIncidence(Incidence *); 238 void deleteIncidence(Incidence *);