summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-03 23:47:47 (UTC)
committer zautrix <zautrix>2005-06-03 23:47:47 (UTC)
commit0e0ac7a92ac2fe052b3e72d49e505a078b05e7f3 (patch) (unidiff)
tree01c96ae843e7a988d6957a5353616b42e0b322da
parentaa0f7df485c3ff0c298d4924ac1e8a5e9e6da627 (diff)
downloadkdepimpi-0e0ac7a92ac2fe052b3e72d49e505a078b05e7f3.zip
kdepimpi-0e0ac7a92ac2fe052b3e72d49e505a078b05e7f3.tar.gz
kdepimpi-0e0ac7a92ac2fe052b3e72d49e505a078b05e7f3.tar.bz2
fixxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index c01be9b..5132f98 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -53,204 +53,204 @@
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#include <externalapphandler.h>
87#endif 87#endif
88#include <libkcal/phoneformat.h> 88#include <libkcal/phoneformat.h>
89#ifndef KORG_NOMAIL 89#ifndef KORG_NOMAIL
90#include "komailclient.h" 90#include "komailclient.h"
91#endif 91#endif
92#ifndef KORG_NOPRINTER 92#ifndef KORG_NOPRINTER
93#include "calprinter.h" 93#include "calprinter.h"
94#endif 94#endif
95#ifndef KORG_NOPLUGINS 95#ifndef KORG_NOPLUGINS
96#include "kocore.h" 96#include "kocore.h"
97#endif 97#endif
98#include "koeventeditor.h" 98#include "koeventeditor.h"
99#include "kotodoeditor.h" 99#include "kotodoeditor.h"
100#include "koprefs.h" 100#include "koprefs.h"
101#include "koeventviewerdialog.h" 101#include "koeventviewerdialog.h"
102#include "publishdialog.h" 102#include "publishdialog.h"
103#include "kofilterview.h" 103#include "kofilterview.h"
104#include "koglobals.h" 104#include "koglobals.h"
105#include "koviewmanager.h" 105#include "koviewmanager.h"
106#include "koagendaview.h" 106#include "koagendaview.h"
107#include "kodialogmanager.h" 107#include "kodialogmanager.h"
108#include "outgoingdialog.h" 108#include "outgoingdialog.h"
109#include "incomingdialog.h" 109#include "incomingdialog.h"
110#include "datenavigatorcontainer.h" 110#include "datenavigatorcontainer.h"
111#include "statusdialog.h" 111#include "statusdialog.h"
112#include "kdatenavigator.h" 112#include "kdatenavigator.h"
113#include "kotodoview.h" 113#include "kotodoview.h"
114#include "datenavigator.h" 114#include "datenavigator.h"
115#include "resourceview.h" 115#include "resourceview.h"
116#include "navigatorbar.h" 116#include "navigatorbar.h"
117#include "searchdialog.h" 117#include "searchdialog.h"
118#include "mainwindow.h" 118#include "mainwindow.h"
119 119
120#include "calendarview.h" 120#include "calendarview.h"
121#ifndef DESKTOP_VERSION 121#ifndef DESKTOP_VERSION
122#include <qtopia/alarmserver.h> 122#include <qtopia/alarmserver.h>
123#endif 123#endif
124#ifndef _WIN32_ 124#ifndef _WIN32_
125#include <stdlib.h> 125#include <stdlib.h>
126#include <stdio.h> 126#include <stdio.h>
127#include <unistd.h> 127#include <unistd.h>
128#else 128#else
129#include <qprocess.h> 129#include <qprocess.h>
130#endif 130#endif
131 131
132#ifdef DESKTOP_VERSION 132#ifdef DESKTOP_VERSION
133#include <kabc/stdaddressbook.h> 133#include <kabc/stdaddressbook.h>
134#endif 134#endif
135using namespace KOrg; 135using namespace KOrg;
136using namespace KCal; 136using namespace KCal;
137extern int globalFlagBlockAgenda; 137extern int globalFlagBlockAgenda;
138extern int globalFlagBlockStartup; 138extern int globalFlagBlockStartup;
139 139
140 140
141MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) 141MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent)
142 142
143{ 143{
144 mAlarms = alarms; 144 mAlarms = alarms;
145 setBackgroundColor( QColor( 86, 153, 205 ) ); 145 setBackgroundColor( QColor( 86, 153, 205 ) );
146 QString mText = "<table width=\"100%\">\n"; 146 QString mText = "<table width=\"100%\">\n";
147 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 147 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
148#ifdef DESKTOP_VERSION 148#ifdef DESKTOP_VERSION
149 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>";
150#else
151 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 149 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
150#else
151 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>";
152#endif 152#endif
153 // mText += "<img src=\""; 153 // mText += "<img src=\"";
154 // mText += ipath; 154 // mText += ipath;
155 // mText += "\">"; 155 // mText += "\">";
156 //mEventDate = QDate::currentDate(); 156 //mEventDate = QDate::currentDate();
157#ifdef DESKTOP_VERSION 157#ifdef DESKTOP_VERSION
158 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h1>";
159#else
160 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; 158 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>";
159#else
160 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>";
161#endif 161#endif
162 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; 162 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
163 163
164 Incidence * inc = getNextInc( start ); 164 Incidence * inc = getNextInc( start );
165 int time = 0; 165 int time = 0;
166 mText += "<table>"; 166 mText += "<table>";
167 while ( inc ) { 167 while ( inc ) {
168 QDateTime dt ; 168 QDateTime dt ;
169 QString tempText = "<a "; 169 QString tempText = "<a ";
170 bool ok; 170 bool ok;
171 dt = inc->getNextOccurence( start, &ok ); 171 dt = inc->getNextOccurence( start, &ok );
172 if ( !ok ) continue; 172 if ( !ok ) continue;
173 if ( inc->type() == "Event" ) { 173 if ( inc->type() == "Event" ) {
174 tempText += "href=\"event:"; 174 tempText += "href=\"event:";
175 } else if ( inc->type() == "Todo" ) { 175 } else if ( inc->type() == "Todo" ) {
176 tempText += "href=\"todo:"; 176 tempText += "href=\"todo:";
177 } 177 }
178 tempText += inc->uid() + "\">"; 178 tempText += inc->uid() + "\">";
179 if ( inc->type() == "Todo" ) 179 if ( inc->type() == "Todo" )
180 tempText += i18n("Todo: "); 180 tempText += i18n("Todo: ");
181 if ( inc->summary().length() > 0 ) 181 if ( inc->summary().length() > 0 )
182 tempText += inc->summary(); 182 tempText += inc->summary();
183 else 183 else
184 tempText += i18n("-no summary-"); 184 tempText += i18n("-no summary-");
185 QString timestr; 185 QString timestr;
186 if (!inc->doesFloat()) 186 if (!inc->doesFloat())
187 timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; 187 timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": ";
188 else 188 else
189 timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 189 timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
190 if ( dt.date() == QDate::currentDate() && time == 0 ) { 190 if ( dt.date() == QDate::currentDate() && time == 0 ) {
191 time = 1; 191 time = 1;
192 mText +="</table>"; 192 mText +="</table>";
193 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; 193 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>";
194 mText += "<table>"; 194 mText += "<table>";
195 195
196 } 196 }
197 if ( dt.date() > QDate::currentDate() && time != 2 ) { 197 if ( dt.date() > QDate::currentDate() && time != 2 ) {
198 time = 2; 198 time = 2;
199 mText +="</table>"; 199 mText +="</table>";
200 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; 200 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>";
201 mText += "<table>"; 201 mText += "<table>";
202 } 202 }
203 mText +="<tr><td><b>"; 203 mText +="<tr><td><b>";
204 mText += timestr; 204 mText += timestr;
205 mText += "</b></td><td>"; 205 mText += "</b></td><td>";
206 mText += tempText; 206 mText += tempText;
207 mText += "</td></tr>\n"; 207 mText += "</td></tr>\n";
208 inc = getNextInc( start ); 208 inc = getNextInc( start );
209 } 209 }
210 mText +="</table>"; 210 mText +="</table>";
211 setText( mText ); 211 setText( mText );
212} 212}
213 213
214Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) 214Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start )
215{ 215{
216 QDateTime dt ; 216 QDateTime dt ;
217 Incidence * retInc; 217 Incidence * retInc;
218 Incidence * inc = mAlarms.first(); 218 Incidence * inc = mAlarms.first();
219 if ( inc == 0 ) 219 if ( inc == 0 )
220 return 0; 220 return 0;
221 bool ok; 221 bool ok;
222 dt = inc->getNextOccurence( start, &ok ); 222 dt = inc->getNextOccurence( start, &ok );
223 if ( ! ok ) return 0; 223 if ( ! ok ) return 0;
224 QDateTime dtn ; 224 QDateTime dtn ;
225 retInc = inc; 225 retInc = inc;
226 inc = mAlarms.next(); 226 inc = mAlarms.next();
227 while ( inc ) { 227 while ( inc ) {
228 dtn = inc->getNextOccurence( start, &ok ); 228 dtn = inc->getNextOccurence( start, &ok );
229 if ( ! ok ) return 0; 229 if ( ! ok ) return 0;
230 if ( dtn < dt ) { 230 if ( dtn < dt ) {
231 dt = dtn; 231 dt = dtn;
232 retInc = inc; 232 retInc = inc;
233 } 233 }
234 inc = mAlarms.next(); 234 inc = mAlarms.next();
235 } 235 }
236 mAlarms.remove( retInc ); 236 mAlarms.remove( retInc );
237 return retInc; 237 return retInc;
238 238
239} 239}
240void MissedAlarmTextBrowser::setSource(const QString & n) 240void MissedAlarmTextBrowser::setSource(const QString & n)
241{ 241{
242 if (n.startsWith("event:")) { 242 if (n.startsWith("event:")) {
243#ifdef DESKTOP_VERSION 243#ifdef DESKTOP_VERSION
244 emit showIncidence(n.mid(8)); 244 emit showIncidence(n.mid(8));
245#else 245#else
246 emit showIncidence(n.mid(6)); 246 emit showIncidence(n.mid(6));
247#endif 247#endif
248 return; 248 return;
249 } else if (n.startsWith("todo:")) { 249 } else if (n.startsWith("todo:")) {
250#ifdef DESKTOP_VERSION 250#ifdef DESKTOP_VERSION
251 emit showIncidence(n.mid(7)); 251 emit showIncidence(n.mid(7));
252#else 252#else
253 emit showIncidence(n.mid(5)); 253 emit showIncidence(n.mid(5));
254#endif 254#endif
255 return; 255 return;
256 } 256 }
@@ -537,222 +537,226 @@ void CalendarView::init()
537 SLOT( purgeCompleted() ) ); 537 SLOT( purgeCompleted() ) );
538 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 538 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
539 SIGNAL( todoModified( Todo *, int ) ) ); 539 SIGNAL( todoModified( Todo *, int ) ) );
540 540
541 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 541 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
542 this, SLOT ( cloneIncidence( Incidence * ) ) ); 542 this, SLOT ( cloneIncidence( Incidence * ) ) );
543 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 543 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
544 this, SLOT (cancelIncidence( Incidence * ) ) ); 544 this, SLOT (cancelIncidence( Incidence * ) ) );
545 545
546 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 546 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
547 this, SLOT ( moveIncidence( Incidence * ) ) ); 547 this, SLOT ( moveIncidence( Incidence * ) ) );
548 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 548 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
549 this, SLOT ( beamIncidence( Incidence * ) ) ); 549 this, SLOT ( beamIncidence( Incidence * ) ) );
550 550
551 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 551 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
552 this, SLOT ( todo_unsub( Todo * ) ) ); 552 this, SLOT ( todo_unsub( Todo * ) ) );
553 553
554 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 554 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
555 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 555 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
556 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 556 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
557 SLOT( updateTodo( Todo *, int ) ) ); 557 SLOT( updateTodo( Todo *, int ) ) );
558 connect( this, SIGNAL( todoModified( Todo *, int )), this, 558 connect( this, SIGNAL( todoModified( Todo *, int )), this,
559 SLOT( changeTodoDisplay( Todo *, int ) ) ); 559 SLOT( changeTodoDisplay( Todo *, int ) ) );
560 560
561 561
562 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 562 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
563 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 563 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
564 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 564 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
565 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 565 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
566 566
567 567
568 568
569 569
570 570
571 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 571 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
572 SLOT(checkClipboard())); 572 SLOT(checkClipboard()));
573 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 573 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
574 SLOT( processTodoListSelection( Incidence * ) ) ); 574 SLOT( processTodoListSelection( Incidence * ) ) );
575 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 575 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
576 576
577 // kdDebug() << "CalendarView::CalendarView() done" << endl; 577 // kdDebug() << "CalendarView::CalendarView() done" << endl;
578 578
579 mDateFrame = new QVBox(0,0,WType_Popup); 579 mDateFrame = new QVBox(0,0,WType_Popup);
580 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 580 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
581 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 581 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
582 mDateFrame->setLineWidth(3); 582 mDateFrame->setLineWidth(3);
583 mDateFrame->hide(); 583 mDateFrame->hide();
584 mDateFrame->setCaption( i18n( "Pick a date to display")); 584 mDateFrame->setCaption( i18n( "Pick a date to display"));
585 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 585 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
586 586
587 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 587 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
588 588
589 mEventEditor = mDialogManager->getEventEditor(); 589 mEventEditor = mDialogManager->getEventEditor();
590 mTodoEditor = mDialogManager->getTodoEditor(); 590 mTodoEditor = mDialogManager->getTodoEditor();
591 591
592 mFlagEditDescription = false; 592 mFlagEditDescription = false;
593 593
594 mSuspendTimer = new QTimer( this ); 594 mSuspendTimer = new QTimer( this );
595 mAlarmTimer = new QTimer( this ); 595 mAlarmTimer = new QTimer( this );
596 mRecheckAlarmTimer = new QTimer( this ); 596 mRecheckAlarmTimer = new QTimer( this );
597 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 597 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
598 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 598 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
599 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 599 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
600 mAlarmDialog = new AlarmDialog( this ); 600 mAlarmDialog = new AlarmDialog( this );
601 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 601 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
602 mAlarmDialog->setServerNotification( false ); 602 mAlarmDialog->setServerNotification( false );
603 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 603 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
604 604
605 605
606#ifndef DESKTOP_VERSION 606#ifndef DESKTOP_VERSION
607//US listen for arriving address resultsets 607//US listen for arriving address resultsets
608 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 608 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
609 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 609 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
610#endif 610#endif
611 mDateNavigator->setCalendar( mCalendar ); 611 mDateNavigator->setCalendar( mCalendar );
612} 612}
613 613
614 614
615CalendarView::~CalendarView() 615CalendarView::~CalendarView()
616{ 616{
617 // kdDebug() << "~CalendarView()" << endl; 617 // kdDebug() << "~CalendarView()" << endl;
618 //qDebug("CalendarView::~CalendarView() "); 618 //qDebug("CalendarView::~CalendarView() ");
619 delete mDialogManager; 619 delete mDialogManager;
620 delete mViewManager; 620 delete mViewManager;
621 delete mStorage; 621 delete mStorage;
622 delete mDateFrame ; 622 delete mDateFrame ;
623 delete beamDialog; 623 delete beamDialog;
624 delete mEventViewerDialog; 624 delete mEventViewerDialog;
625 //kdDebug() << "~CalendarView() done" << endl; 625 //kdDebug() << "~CalendarView() done" << endl;
626} 626}
627void CalendarView::checkAlarms() 627void CalendarView::checkAlarms()
628{ 628{
629 KConfig *config = KOGlobals::config(); 629 KConfig *config = KOGlobals::config();
630 config->setGroup( "AppRun" ); 630 config->setGroup( "AppRun" );
631 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 631 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
632 int secs = config->readNumEntry( "LatestProgramStop" ) - 30; 632 int secs = config->readNumEntry( "LatestProgramStop" ) - 30;
633 secs -= ( 3600 * 24*3 ); // debug only 633 secs -= ( 3600 * 24*3 ); // debug only
634 QDateTime latest = dt.addSecs ( secs ); 634 QDateTime latest = dt.addSecs ( secs );
635 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 635 qDebug("KO: Last termination on %s ", latest.toString().latin1());
636 QPtrList<Incidence> el = mCalendar->rawIncidences(); 636 QPtrList<Incidence> el = mCalendar->rawIncidences();
637 QPtrList<Incidence> al; 637 QPtrList<Incidence> al;
638 Incidence* inL = el.first(); 638 Incidence* inL = el.first();
639 while ( inL ) { 639 while ( inL ) {
640 bool ok = false; 640 bool ok = false;
641 int offset = 0; 641 int offset = 0;
642 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 642 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
643 if ( ok ) { 643 if ( ok ) {
644 //qDebug("OK %s",next.toString().latin1()); 644 //qDebug("OK %s",next.toString().latin1());
645 if ( next < QDateTime::currentDateTime() ) { 645 if ( next < QDateTime::currentDateTime() ) {
646 al.append( inL ); 646 al.append( inL );
647 qDebug("found missed alarm: %s ", inL->summary().latin1() ); 647 qDebug("found missed alarm: %s ", inL->summary().latin1() );
648 } 648 }
649 } 649 }
650 inL = el.next(); 650 inL = el.next();
651 } 651 }
652 if ( al.count() ) { 652 if ( al.count() ) {
653 QDialog dia ( this, "huhu", true ); 653 QDialog* dia = new QDialog( this, "huhu", false );
654 dia.setCaption( i18n("KO/Pi: Missing alarm notification!") ); 654 dia->setCaption( i18n("KO/Pi: Missing alarm notification!") );
655 QVBoxLayout* lay = new QVBoxLayout( &dia ); 655 QVBoxLayout* lay = new QVBoxLayout( dia );
656 lay->setSpacing( 3 ); 656 lay->setSpacing( 0 );
657 lay->setMargin( 3 ); 657 lay->setMargin( 0 );
658 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( &dia, al, latest ); 658 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
659 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 659 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
660 lay->addWidget( matb ); 660 lay->addWidget( matb );
661 dia.resize(240,240); 661 int si = 220;
662 dia.exec(); 662 if ( QApplication::desktop()->width() > 470 )
663 si = 400;
664 dia->resize(si,si/2);
665 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
666 dia->show();
663 667
664 } 668 }
665} 669}
666void CalendarView::showDay( QDate d ) 670void CalendarView::showDay( QDate d )
667{ 671{
668 dateNavigator()->blockSignals( true ); 672 dateNavigator()->blockSignals( true );
669 dateNavigator()->selectDate( d ); 673 dateNavigator()->selectDate( d );
670 dateNavigator()->blockSignals( false ); 674 dateNavigator()->blockSignals( false );
671 mViewManager->showDayView(); 675 mViewManager->showDayView();
672 //dateNavigator()->selectDate( d ); 676 //dateNavigator()->selectDate( d );
673} 677}
674void CalendarView::timerAlarm() 678void CalendarView::timerAlarm()
675{ 679{
676 //qDebug("CalendarView::timerAlarm() "); 680 //qDebug("CalendarView::timerAlarm() ");
677 computeAlarm(mAlarmNotification ); 681 computeAlarm(mAlarmNotification );
678} 682}
679 683
680void CalendarView::suspendAlarm() 684void CalendarView::suspendAlarm()
681{ 685{
682 //qDebug(" CalendarView::suspendAlarm() "); 686 //qDebug(" CalendarView::suspendAlarm() ");
683 computeAlarm(mSuspendAlarmNotification ); 687 computeAlarm(mSuspendAlarmNotification );
684 688
685} 689}
686 690
687void CalendarView::startAlarm( QString mess , QString filename) 691void CalendarView::startAlarm( QString mess , QString filename)
688{ 692{
689 693
690 topLevelWidget()->showNormal(); 694 topLevelWidget()->showNormal();
691 topLevelWidget()->setActiveWindow(); 695 topLevelWidget()->setActiveWindow();
692 topLevelWidget()->raise(); 696 topLevelWidget()->raise();
693 697
694 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 698 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
695 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 699 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
696 700
697} 701}
698 702
699void CalendarView::checkNextTimerAlarm() 703void CalendarView::checkNextTimerAlarm()
700{ 704{
701 mCalendar->checkAlarmForIncidence( 0, true ); 705 mCalendar->checkAlarmForIncidence( 0, true );
702} 706}
703 707
704void CalendarView::computeAlarm( QString msg ) 708void CalendarView::computeAlarm( QString msg )
705{ 709{
706 710
707 QString mess = msg; 711 QString mess = msg;
708 QString mAlarmMessage = mess.mid( 9 ); 712 QString mAlarmMessage = mess.mid( 9 );
709 QString filename = MainWindow::resourcePath(); 713 QString filename = MainWindow::resourcePath();
710 filename += "koalarm.wav"; 714 filename += "koalarm.wav";
711 QString tempfilename; 715 QString tempfilename;
712 if ( mess.left( 13 ) == "suspend_alarm") { 716 if ( mess.left( 13 ) == "suspend_alarm") {
713 bool error = false; 717 bool error = false;
714 int len = mess.mid( 13 ).find("+++"); 718 int len = mess.mid( 13 ).find("+++");
715 if ( len < 2 ) 719 if ( len < 2 )
716 error = true; 720 error = true;
717 else { 721 else {
718 tempfilename = mess.mid( 13, len ); 722 tempfilename = mess.mid( 13, len );
719 if ( !QFile::exists( tempfilename ) ) 723 if ( !QFile::exists( tempfilename ) )
720 error = true; 724 error = true;
721 } 725 }
722 if ( ! error ) { 726 if ( ! error ) {
723 filename = tempfilename; 727 filename = tempfilename;
724 } 728 }
725 mAlarmMessage = mess.mid( 13+len+3 ); 729 mAlarmMessage = mess.mid( 13+len+3 );
726 //qDebug("suspend file %s ",tempfilename.latin1() ); 730 //qDebug("suspend file %s ",tempfilename.latin1() );
727 startAlarm( mAlarmMessage, filename); 731 startAlarm( mAlarmMessage, filename);
728 return; 732 return;
729 } 733 }
730 if ( mess.left( 11 ) == "timer_alarm") { 734 if ( mess.left( 11 ) == "timer_alarm") {
731 //mTimerTime = 0; 735 //mTimerTime = 0;
732 startAlarm( mess.mid( 11 ), filename ); 736 startAlarm( mess.mid( 11 ), filename );
733 return; 737 return;
734 } 738 }
735 if ( mess.left( 10 ) == "proc_alarm") { 739 if ( mess.left( 10 ) == "proc_alarm") {
736 bool error = false; 740 bool error = false;
737 int len = mess.mid( 10 ).find("+++"); 741 int len = mess.mid( 10 ).find("+++");
738 if ( len < 2 ) 742 if ( len < 2 )
739 error = true; 743 error = true;
740 else { 744 else {
741 tempfilename = mess.mid( 10, len ); 745 tempfilename = mess.mid( 10, len );
742 if ( !QFile::exists( tempfilename ) ) 746 if ( !QFile::exists( tempfilename ) )
743 error = true; 747 error = true;
744 } 748 }
745 if ( error ) { 749 if ( error ) {
746 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 750 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
747 mAlarmMessage += mess.mid( 10+len+3+9 ); 751 mAlarmMessage += mess.mid( 10+len+3+9 );
748 } else { 752 } else {
749 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 753 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
750 //qDebug("-----system command %s ",tempfilename.latin1() ); 754 //qDebug("-----system command %s ",tempfilename.latin1() );
751#ifndef _WIN32_ 755#ifndef _WIN32_
752 if ( vfork () == 0 ) { 756 if ( vfork () == 0 ) {
753 execl ( tempfilename.latin1(), 0 ); 757 execl ( tempfilename.latin1(), 0 );
754 return; 758 return;
755 } 759 }
756#else 760#else
757 QProcess* p = new QProcess(); 761 QProcess* p = new QProcess();
758 p->addArgument( tempfilename.latin1() ); 762 p->addArgument( tempfilename.latin1() );