author | zautrix <zautrix> | 2005-06-07 06:37:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-07 06:37:42 (UTC) |
commit | ff8af7ccdd6346bba1cb871c33931352bbafe40e (patch) (unidiff) | |
tree | 8a905fe8237cd1be7276b3c5f10479a9efdb6ee5 | |
parent | 79f58240bc34d20601abe3325e1dc7e76e1ebe39 (diff) | |
download | kdepimpi-ff8af7ccdd6346bba1cb871c33931352bbafe40e.zip kdepimpi-ff8af7ccdd6346bba1cb871c33931352bbafe40e.tar.gz kdepimpi-ff8af7ccdd6346bba1cb871c33931352bbafe40e.tar.bz2 |
fixx
-rw-r--r-- | kaddressbook/mainembedded.cpp | 1 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index 50db377..93ba53c 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp | |||
@@ -1,119 +1,120 @@ | |||
1 | #ifndef DESKTOP_VERSION | 1 | #ifndef DESKTOP_VERSION |
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qcopchannel_qws.h> | 3 | #include <qcopchannel_qws.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #else | 5 | #else |
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | #include <qwindowsstyle.h> | 7 | #include <qwindowsstyle.h> |
8 | #include <qplatinumstyle.h> | 8 | #include <qplatinumstyle.h> |
9 | #include <qmainwindow.h> | 9 | #include <qmainwindow.h> |
10 | #include <qmessagebox.h> | 10 | #include <qmessagebox.h> |
11 | #include <stdlib.h> | 11 | #include <stdlib.h> |
12 | #endif | 12 | #endif |
13 | 13 | ||
14 | #include <qtextcodec.h> | 14 | #include <qtextcodec.h> |
15 | #include <kstandarddirs.h> | 15 | #include <kstandarddirs.h> |
16 | #include <qregexp.h> | 16 | #include <qregexp.h> |
17 | #include <kglobal.h> | 17 | #include <kglobal.h> |
18 | #include <stdio.h> | 18 | #include <stdio.h> |
19 | #include <qdir.h> | 19 | #include <qdir.h> |
20 | #include "kabprefs.h" | 20 | #include "kabprefs.h" |
21 | #include "kaddressbookmain.h" | 21 | #include "kaddressbookmain.h" |
22 | #include "externalapphandler.h" | 22 | #include "externalapphandler.h" |
23 | #include <libkdepim/kpimglobalprefs.h> | 23 | #include <libkdepim/kpimglobalprefs.h> |
24 | void dumpMissing(); | 24 | void dumpMissing(); |
25 | int main( int argc, char **argv ) | 25 | int main( int argc, char **argv ) |
26 | { | 26 | { |
27 | #ifndef DESKTOP_VERSION | 27 | #ifndef DESKTOP_VERSION |
28 | QPEApplication a( argc, argv ); | 28 | QPEApplication a( argc, argv ); |
29 | a.setKeepRunning (); | 29 | a.setKeepRunning (); |
30 | #else | 30 | #else |
31 | QApplication a( argc, argv ); | 31 | QApplication a( argc, argv ); |
32 | QApplication::setStyle( new QPlatinumStyle ()); | 32 | QApplication::setStyle( new QPlatinumStyle ()); |
33 | #ifdef _WIN32_ | 33 | #ifdef _WIN32_ |
34 | QString hdir ( getenv( "HOME") ); | 34 | QString hdir ( getenv( "HOME") ); |
35 | if ( hdir.isEmpty() ) { | 35 | if ( hdir.isEmpty() ) { |
36 | QString hd ("C:/" ); | 36 | QString hd ("C:/" ); |
37 | //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); | 37 | //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); |
38 | if ( QDir::homeDirPath().lower() == hd.lower() ) { | 38 | if ( QDir::homeDirPath().lower() == hd.lower() ) { |
39 | _putenv( "HOME=C:"); | 39 | _putenv( "HOME=C:"); |
40 | //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); | 40 | //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); |
41 | } | 41 | } |
42 | } else { | 42 | } else { |
43 | QDir app_dir; | 43 | QDir app_dir; |
44 | if ( !app_dir.exists(hdir) ) | 44 | if ( !app_dir.exists(hdir) ) |
45 | app_dir.mkdir (hdir); | 45 | app_dir.mkdir (hdir); |
46 | } | 46 | } |
47 | #endif | 47 | #endif |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | bool exitHelp = false; | 50 | bool exitHelp = false; |
51 | if ( argc > 1 ) { | 51 | if ( argc > 1 ) { |
52 | QString command = argv[1]; | 52 | QString command = argv[1]; |
53 | if ( command == "-help" ){ | 53 | if ( command == "-help" ){ |
54 | printf("KA/E command line commands:\n"); | 54 | printf("KA/E command line commands:\n"); |
55 | printf(" no command: Start KA/E in usual way\n"); | 55 | printf(" no command: Start KA/E in usual way\n"); |
56 | printf(" -help: This output\n"); | 56 | printf(" -help: This output\n"); |
57 | printf(" KA/E is exiting now. Bye!\n"); | 57 | printf(" KA/E is exiting now. Bye!\n"); |
58 | exitHelp = true; | 58 | exitHelp = true; |
59 | } | 59 | } |
60 | } | 60 | } |
61 | if ( ! exitHelp ) { | 61 | if ( ! exitHelp ) { |
62 | 62 | ||
63 | KGlobal::setAppName( "kaddressbook" ); | 63 | KGlobal::setAppName( "kaddressbook" ); |
64 | #ifndef DESKTOP_VERSION | 64 | #ifndef DESKTOP_VERSION |
65 | if ( QApplication::desktop()->width() > 320 ) | 65 | if ( QApplication::desktop()->width() > 320 ) |
66 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); | 66 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); |
67 | else | 67 | else |
68 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); | 68 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); |
69 | #else | 69 | #else |
70 | QString fileName ; | 70 | QString fileName ; |
71 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; | 71 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; |
72 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 72 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
73 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 73 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
74 | 74 | ||
75 | #endif | 75 | #endif |
76 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); | 76 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); |
77 | // init language | 77 | // init language |
78 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 78 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
79 | QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); | 79 | QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); |
80 | KAddressBookMain m ; | 80 | KAddressBookMain m ; |
81 | //US MainWindow m; | 81 | //US MainWindow m; |
82 | #ifndef DESKTOP_VERSION | 82 | #ifndef DESKTOP_VERSION |
83 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 83 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
84 | #endif | 84 | #endif |
85 | 85 | ||
86 | 86 | ||
87 | #ifndef DESKTOP_VERSION | 87 | #ifndef DESKTOP_VERSION |
88 | a.showMainWidget( &m ); | 88 | a.showMainWidget( &m ); |
89 | 89 | ||
90 | #else | 90 | #else |
91 | a.setMainWidget( &m ); | 91 | a.setMainWidget( &m ); |
92 | m.show(); | 92 | m.show(); |
93 | #endif | 93 | #endif |
94 | a.exec(); | 94 | a.exec(); |
95 | #ifdef DESKTOP_VERSION | 95 | #ifdef DESKTOP_VERSION |
96 | KConfig *config = KABPrefs::instance()->getConfig(); | 96 | KConfig *config = KABPrefs::instance()->getConfig(); |
97 | config->setGroup("WidgetLayout"); | 97 | config->setGroup("WidgetLayout"); |
98 | QStringList list ;//= config->readListEntry("MainLayout"); | 98 | QStringList list ;//= config->readListEntry("MainLayout"); |
99 | int x,y,w,h; | 99 | int x,y,w,h; |
100 | QWidget* wid; | 100 | QWidget* wid; |
101 | wid = &m; | 101 | wid = &m; |
102 | x = wid->geometry().x(); | 102 | x = wid->geometry().x(); |
103 | y = wid->geometry().y(); | 103 | y = wid->geometry().y(); |
104 | w = wid->width(); | 104 | w = wid->width(); |
105 | h = wid->height(); | 105 | h = wid->height(); |
106 | list.clear(); | 106 | list.clear(); |
107 | list << QString::number( x ); | 107 | list << QString::number( x ); |
108 | list << QString::number( y ); | 108 | list << QString::number( y ); |
109 | list << QString::number( w ); | 109 | list << QString::number( w ); |
110 | list << QString::number( h ); | 110 | list << QString::number( h ); |
111 | config->writeEntry("MainLayout",list ); | 111 | config->writeEntry("MainLayout",list ); |
112 | config->sync(); | ||
112 | #endif | 113 | #endif |
113 | dumpMissing(); | 114 | dumpMissing(); |
114 | 115 | ||
115 | KPimGlobalPrefs::instance()->writeConfig(); | 116 | KPimGlobalPrefs::instance()->writeConfig(); |
116 | } | 117 | } |
117 | qDebug("KA: Bye! "); | 118 | qDebug("KA: Bye! "); |
118 | } | 119 | } |
119 | 120 | ||
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index e13d0be..720ad78 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -515,257 +515,258 @@ void CalendarView::init() | |||
515 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 515 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
516 | mNavigator, SLOT( selectNextMonth() ) ); | 516 | mNavigator, SLOT( selectNextMonth() ) ); |
517 | 517 | ||
518 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 518 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
519 | mNavigator, SLOT( selectPrevious() ) ); | 519 | mNavigator, SLOT( selectPrevious() ) ); |
520 | connect( mDateNavigator, SIGNAL( goNext() ), | 520 | connect( mDateNavigator, SIGNAL( goNext() ), |
521 | mNavigator, SLOT( selectNext() ) ); | 521 | mNavigator, SLOT( selectNext() ) ); |
522 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 522 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
523 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 523 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
524 | 524 | ||
525 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 525 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
526 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 526 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
527 | #if 0 | 527 | #if 0 |
528 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 528 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
529 | SLOT( incidenceAdded( Incidence *) ) ); | 529 | SLOT( incidenceAdded( Incidence *) ) ); |
530 | #endif | 530 | #endif |
531 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 531 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
532 | 532 | ||
533 | connect( this, SIGNAL( configChanged() ), | 533 | connect( this, SIGNAL( configChanged() ), |
534 | mDateNavigator, SLOT( updateConfig() ) ); | 534 | mDateNavigator, SLOT( updateConfig() ) ); |
535 | 535 | ||
536 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 536 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
537 | SLOT( newTodo() ) ); | 537 | SLOT( newTodo() ) ); |
538 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 538 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
539 | SLOT( newSubTodo( Todo * ) ) ); | 539 | SLOT( newSubTodo( Todo * ) ) ); |
540 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 540 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
541 | SLOT( editTodo( Todo * ) ) ); | 541 | SLOT( editTodo( Todo * ) ) ); |
542 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 542 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
543 | SLOT( showTodo( Todo *) ) ); | 543 | SLOT( showTodo( Todo *) ) ); |
544 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 544 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
545 | SLOT( deleteTodo( Todo *) ) ); | 545 | SLOT( deleteTodo( Todo *) ) ); |
546 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 546 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
547 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 547 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
548 | SLOT( purgeCompleted() ) ); | 548 | SLOT( purgeCompleted() ) ); |
549 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 549 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
550 | SIGNAL( todoModified( Todo *, int ) ) ); | 550 | SIGNAL( todoModified( Todo *, int ) ) ); |
551 | 551 | ||
552 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 552 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
553 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 553 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
554 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 554 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
555 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 555 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
556 | 556 | ||
557 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 557 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
558 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 558 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
559 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 559 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
560 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 560 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
561 | 561 | ||
562 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 562 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
563 | this, SLOT ( todo_unsub( Todo * ) ) ); | 563 | this, SLOT ( todo_unsub( Todo * ) ) ); |
564 | 564 | ||
565 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 565 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
566 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 566 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
567 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 567 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
568 | SLOT( updateTodo( Todo *, int ) ) ); | 568 | SLOT( updateTodo( Todo *, int ) ) ); |
569 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 569 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
570 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 570 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
571 | 571 | ||
572 | 572 | ||
573 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 573 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
574 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 574 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
575 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 575 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
576 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 576 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
577 | 577 | ||
578 | 578 | ||
579 | 579 | ||
580 | 580 | ||
581 | 581 | ||
582 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 582 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
583 | SLOT(checkClipboard())); | 583 | SLOT(checkClipboard())); |
584 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 584 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
585 | SLOT( processTodoListSelection( Incidence * ) ) ); | 585 | SLOT( processTodoListSelection( Incidence * ) ) ); |
586 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 586 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
587 | 587 | ||
588 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 588 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
589 | 589 | ||
590 | mDateFrame = new QVBox(0,0,WType_Popup); | 590 | mDateFrame = new QVBox(0,0,WType_Popup); |
591 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 591 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
592 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 592 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
593 | mDateFrame->setLineWidth(3); | 593 | mDateFrame->setLineWidth(3); |
594 | mDateFrame->hide(); | 594 | mDateFrame->hide(); |
595 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 595 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
596 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 596 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
597 | 597 | ||
598 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 598 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
599 | 599 | ||
600 | mEventEditor = mDialogManager->getEventEditor(); | 600 | mEventEditor = mDialogManager->getEventEditor(); |
601 | mTodoEditor = mDialogManager->getTodoEditor(); | 601 | mTodoEditor = mDialogManager->getTodoEditor(); |
602 | 602 | ||
603 | mFlagEditDescription = false; | 603 | mFlagEditDescription = false; |
604 | 604 | ||
605 | mSuspendTimer = new QTimer( this ); | 605 | mSuspendTimer = new QTimer( this ); |
606 | mAlarmTimer = new QTimer( this ); | 606 | mAlarmTimer = new QTimer( this ); |
607 | mRecheckAlarmTimer = new QTimer( this ); | 607 | mRecheckAlarmTimer = new QTimer( this ); |
608 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 608 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
609 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 609 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
610 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 610 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
611 | mAlarmDialog = new AlarmDialog( this ); | 611 | mAlarmDialog = new AlarmDialog( this ); |
612 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 612 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
613 | mAlarmDialog->setServerNotification( false ); | 613 | mAlarmDialog->setServerNotification( false ); |
614 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 614 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
615 | 615 | ||
616 | 616 | ||
617 | #ifndef DESKTOP_VERSION | 617 | #ifndef DESKTOP_VERSION |
618 | //US listen for arriving address resultsets | 618 | //US listen for arriving address resultsets |
619 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 619 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
620 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 620 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
621 | #endif | 621 | #endif |
622 | mDateNavigator->setCalendar( mCalendar ); | 622 | mDateNavigator->setCalendar( mCalendar ); |
623 | } | 623 | } |
624 | 624 | ||
625 | 625 | ||
626 | CalendarView::~CalendarView() | 626 | CalendarView::~CalendarView() |
627 | { | 627 | { |
628 | // kdDebug() << "~CalendarView()" << endl; | 628 | // kdDebug() << "~CalendarView()" << endl; |
629 | //qDebug("CalendarView::~CalendarView() "); | 629 | //qDebug("CalendarView::~CalendarView() "); |
630 | delete mDialogManager; | 630 | delete mDialogManager; |
631 | delete mViewManager; | 631 | delete mViewManager; |
632 | delete mStorage; | 632 | delete mStorage; |
633 | delete mDateFrame ; | 633 | delete mDateFrame ; |
634 | delete beamDialog; | 634 | delete beamDialog; |
635 | delete mEventViewerDialog; | 635 | delete mEventViewerDialog; |
636 | //kdDebug() << "~CalendarView() done" << endl; | 636 | //kdDebug() << "~CalendarView() done" << endl; |
637 | } | 637 | } |
638 | void CalendarView::checkAlarms() | 638 | void CalendarView::checkAlarms() |
639 | { | 639 | { |
640 | KConfig *config = KOGlobals::config(); | 640 | KConfig *config = KOGlobals::config(); |
641 | config->setGroup( "AppRun" ); | 641 | config->setGroup( "AppRun" ); |
642 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 642 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
643 | int secs = config->readNumEntry( "LatestProgramStop" ) - 30; | 643 | int secto = dt.secsTo( QDateTime::currentDateTime() ); |
644 | int secs = config->readNumEntry( "LatestProgramStop" , secto) - 30; | ||
644 | //secs -= ( 3600 * 24*3 ); // debug only | 645 | //secs -= ( 3600 * 24*3 ); // debug only |
645 | QDateTime latest = dt.addSecs ( secs ); | 646 | QDateTime latest = dt.addSecs ( secs ); |
646 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | 647 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); |
647 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | 648 | QPtrList<Incidence> el = mCalendar->rawIncidences(); |
648 | QPtrList<Incidence> al; | 649 | QPtrList<Incidence> al; |
649 | Incidence* inL = el.first(); | 650 | Incidence* inL = el.first(); |
650 | while ( inL ) { | 651 | while ( inL ) { |
651 | bool ok = false; | 652 | bool ok = false; |
652 | int offset = 0; | 653 | int offset = 0; |
653 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; | 654 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; |
654 | if ( ok ) { | 655 | if ( ok ) { |
655 | //qDebug("OK %s",next.toString().latin1()); | 656 | //qDebug("OK %s",next.toString().latin1()); |
656 | if ( next < QDateTime::currentDateTime() ) { | 657 | if ( next < QDateTime::currentDateTime() ) { |
657 | al.append( inL ); | 658 | al.append( inL ); |
658 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); | 659 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); |
659 | } | 660 | } |
660 | } | 661 | } |
661 | inL = el.next(); | 662 | inL = el.next(); |
662 | } | 663 | } |
663 | if ( al.count() ) { | 664 | if ( al.count() ) { |
664 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); | 665 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); |
665 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); | 666 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); |
666 | QVBoxLayout* lay = new QVBoxLayout( dia ); | 667 | QVBoxLayout* lay = new QVBoxLayout( dia ); |
667 | lay->setSpacing( 0 ); | 668 | lay->setSpacing( 0 ); |
668 | lay->setMargin( 0 ); | 669 | lay->setMargin( 0 ); |
669 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); | 670 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); |
670 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 671 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
671 | lay->addWidget( matb ); | 672 | lay->addWidget( matb ); |
672 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { | 673 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { |
673 | int wid = 210; | 674 | int wid = 210; |
674 | int x = QApplication::desktop()->width() - wid - 7; | 675 | int x = QApplication::desktop()->width() - wid - 7; |
675 | int y = QApplication::desktop()->height() - wid - 70; | 676 | int y = QApplication::desktop()->height() - wid - 70; |
676 | dia->setGeometry ( x,y,wid,wid); | 677 | dia->setGeometry ( x,y,wid,wid); |
677 | } else { | 678 | } else { |
678 | int si = 220; | 679 | int si = 220; |
679 | if ( QApplication::desktop()->width() > 470 ) | 680 | if ( QApplication::desktop()->width() > 470 ) |
680 | si = 400; | 681 | si = 400; |
681 | dia->resize(si,si/2); | 682 | dia->resize(si,si/2); |
682 | } | 683 | } |
683 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); | 684 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); |
684 | dia->show(); | 685 | dia->show(); |
685 | 686 | ||
686 | } | 687 | } |
687 | } | 688 | } |
688 | void CalendarView::showDay( QDate d ) | 689 | void CalendarView::showDay( QDate d ) |
689 | { | 690 | { |
690 | dateNavigator()->blockSignals( true ); | 691 | dateNavigator()->blockSignals( true ); |
691 | dateNavigator()->selectDate( d ); | 692 | dateNavigator()->selectDate( d ); |
692 | dateNavigator()->blockSignals( false ); | 693 | dateNavigator()->blockSignals( false ); |
693 | mViewManager->showDayView(); | 694 | mViewManager->showDayView(); |
694 | //dateNavigator()->selectDate( d ); | 695 | //dateNavigator()->selectDate( d ); |
695 | } | 696 | } |
696 | void CalendarView::timerAlarm() | 697 | void CalendarView::timerAlarm() |
697 | { | 698 | { |
698 | //qDebug("CalendarView::timerAlarm() "); | 699 | //qDebug("CalendarView::timerAlarm() "); |
699 | computeAlarm(mAlarmNotification ); | 700 | computeAlarm(mAlarmNotification ); |
700 | } | 701 | } |
701 | 702 | ||
702 | void CalendarView::suspendAlarm() | 703 | void CalendarView::suspendAlarm() |
703 | { | 704 | { |
704 | //qDebug(" CalendarView::suspendAlarm() "); | 705 | //qDebug(" CalendarView::suspendAlarm() "); |
705 | computeAlarm(mSuspendAlarmNotification ); | 706 | computeAlarm(mSuspendAlarmNotification ); |
706 | 707 | ||
707 | } | 708 | } |
708 | 709 | ||
709 | void CalendarView::startAlarm( QString mess , QString filename) | 710 | void CalendarView::startAlarm( QString mess , QString filename) |
710 | { | 711 | { |
711 | 712 | ||
712 | topLevelWidget()->showNormal(); | 713 | topLevelWidget()->showNormal(); |
713 | topLevelWidget()->setActiveWindow(); | 714 | topLevelWidget()->setActiveWindow(); |
714 | topLevelWidget()->raise(); | 715 | topLevelWidget()->raise(); |
715 | 716 | ||
716 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 717 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
717 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 718 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
718 | 719 | ||
719 | } | 720 | } |
720 | 721 | ||
721 | void CalendarView::checkNextTimerAlarm() | 722 | void CalendarView::checkNextTimerAlarm() |
722 | { | 723 | { |
723 | mCalendar->checkAlarmForIncidence( 0, true ); | 724 | mCalendar->checkAlarmForIncidence( 0, true ); |
724 | } | 725 | } |
725 | 726 | ||
726 | void CalendarView::computeAlarm( QString msg ) | 727 | void CalendarView::computeAlarm( QString msg ) |
727 | { | 728 | { |
728 | 729 | ||
729 | QString mess = msg; | 730 | QString mess = msg; |
730 | QString mAlarmMessage = mess.mid( 9 ); | 731 | QString mAlarmMessage = mess.mid( 9 ); |
731 | QString filename = MainWindow::resourcePath(); | 732 | QString filename = MainWindow::resourcePath(); |
732 | filename += "koalarm.wav"; | 733 | filename += "koalarm.wav"; |
733 | QString tempfilename; | 734 | QString tempfilename; |
734 | if ( mess.left( 13 ) == "suspend_alarm") { | 735 | if ( mess.left( 13 ) == "suspend_alarm") { |
735 | bool error = false; | 736 | bool error = false; |
736 | int len = mess.mid( 13 ).find("+++"); | 737 | int len = mess.mid( 13 ).find("+++"); |
737 | if ( len < 2 ) | 738 | if ( len < 2 ) |
738 | error = true; | 739 | error = true; |
739 | else { | 740 | else { |
740 | tempfilename = mess.mid( 13, len ); | 741 | tempfilename = mess.mid( 13, len ); |
741 | if ( !QFile::exists( tempfilename ) ) | 742 | if ( !QFile::exists( tempfilename ) ) |
742 | error = true; | 743 | error = true; |
743 | } | 744 | } |
744 | if ( ! error ) { | 745 | if ( ! error ) { |
745 | filename = tempfilename; | 746 | filename = tempfilename; |
746 | } | 747 | } |
747 | mAlarmMessage = mess.mid( 13+len+3 ); | 748 | mAlarmMessage = mess.mid( 13+len+3 ); |
748 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 749 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
749 | startAlarm( mAlarmMessage, filename); | 750 | startAlarm( mAlarmMessage, filename); |
750 | return; | 751 | return; |
751 | } | 752 | } |
752 | if ( mess.left( 11 ) == "timer_alarm") { | 753 | if ( mess.left( 11 ) == "timer_alarm") { |
753 | //mTimerTime = 0; | 754 | //mTimerTime = 0; |
754 | startAlarm( mess.mid( 11 ), filename ); | 755 | startAlarm( mess.mid( 11 ), filename ); |
755 | return; | 756 | return; |
756 | } | 757 | } |
757 | if ( mess.left( 10 ) == "proc_alarm") { | 758 | if ( mess.left( 10 ) == "proc_alarm") { |
758 | bool error = false; | 759 | bool error = false; |
759 | int len = mess.mid( 10 ).find("+++"); | 760 | int len = mess.mid( 10 ).find("+++"); |
760 | if ( len < 2 ) | 761 | if ( len < 2 ) |
761 | error = true; | 762 | error = true; |
762 | else { | 763 | else { |
763 | tempfilename = mess.mid( 10, len ); | 764 | tempfilename = mess.mid( 10, len ); |
764 | if ( !QFile::exists( tempfilename ) ) | 765 | if ( !QFile::exists( tempfilename ) ) |
765 | error = true; | 766 | error = true; |
766 | } | 767 | } |
767 | if ( error ) { | 768 | if ( error ) { |
768 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 769 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
769 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 770 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
770 | } else { | 771 | } else { |
771 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 772 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |