summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 623cf9d..214b829 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -68,768 +68,770 @@
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 viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); 145 viewport()->setBackgroundColor( QColor( 255, 255, 255 ) );
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\"><h2>"; 149 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
150#else 150#else
151 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; 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></h2>"; 158 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>";
159#else 159#else
160 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; 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->typeID() == eventID ) { 173 if ( inc->typeID() == eventID ) {
174 tempText += "href=\"event:"; 174 tempText += "href=\"event:";
175 } else if ( inc->typeID() == todoID ) { 175 } else if ( inc->typeID() == todoID ) {
176 tempText += "href=\"todo:"; 176 tempText += "href=\"todo:";
177 } 177 }
178 tempText += inc->uid() + "\">"; 178 tempText += inc->uid() + "\">";
179 if ( inc->typeID() == todoID ) 179 if ( inc->typeID() == todoID )
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 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; 191 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
192 mText += "<table>"; 192 mText += "<table>";
193 time = 1; 193 time = 1;
194 } 194 }
195 if ( dt.date() == QDate::currentDate() && time <= 1 ) { 195 if ( dt.date() == QDate::currentDate() && time <= 1 ) {
196 if ( time > 0 ) 196 if ( time > 0 )
197 mText +="</table>"; 197 mText +="</table>";
198 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; 198 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>";
199 mText += "<table>"; 199 mText += "<table>";
200 time = 2; 200 time = 2;
201 201
202 } 202 }
203 if ( dt.date() > QDate::currentDate() && time <= 2 ) { 203 if ( dt.date() > QDate::currentDate() && time <= 2 ) {
204 if ( time > 0 ) 204 if ( time > 0 )
205 mText +="</table>"; 205 mText +="</table>";
206 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; 206 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>";
207 mText += "<table>"; 207 mText += "<table>";
208 time = 3; 208 time = 3;
209 } 209 }
210 mText +="<tr><td><b>"; 210 mText +="<tr><td><b>";
211 mText += timestr; 211 mText += timestr;
212 mText += "</b></td><td>"; 212 mText += "</b></td><td>";
213 mText += tempText; 213 mText += tempText;
214 mText += "</td></tr>\n"; 214 mText += "</td></tr>\n";
215 inc = getNextInc( start ); 215 inc = getNextInc( start );
216 } 216 }
217 mText +="</table>"; 217 mText +="</table>";
218 setText( mText ); 218 setText( mText );
219} 219}
220 220
221MissedAlarmTextBrowser::~MissedAlarmTextBrowser() 221MissedAlarmTextBrowser::~MissedAlarmTextBrowser()
222{ 222{
223 //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() "); 223 //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() ");
224} 224}
225Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) 225Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start )
226{ 226{
227 QDateTime dt ; 227 QDateTime dt ;
228 Incidence * retInc; 228 Incidence * retInc;
229 Incidence * inc = mAlarms.first(); 229 Incidence * inc = mAlarms.first();
230 if ( inc == 0 ) 230 if ( inc == 0 )
231 return 0; 231 return 0;
232 bool ok; 232 bool ok;
233 dt = inc->getNextOccurence( start, &ok ); 233 dt = inc->getNextOccurence( start, &ok );
234 if ( ! ok ) return 0; 234 if ( ! ok ) return 0;
235 QDateTime dtn ; 235 QDateTime dtn ;
236 retInc = inc; 236 retInc = inc;
237 inc = mAlarms.next(); 237 inc = mAlarms.next();
238 while ( inc ) { 238 while ( inc ) {
239 dtn = inc->getNextOccurence( start, &ok ); 239 dtn = inc->getNextOccurence( start, &ok );
240 if ( ! ok ) return 0; 240 if ( ! ok ) return 0;
241 if ( dtn < dt ) { 241 if ( dtn < dt ) {
242 dt = dtn; 242 dt = dtn;
243 retInc = inc; 243 retInc = inc;
244 } 244 }
245 inc = mAlarms.next(); 245 inc = mAlarms.next();
246 } 246 }
247 mAlarms.remove( retInc ); 247 mAlarms.remove( retInc );
248 return retInc; 248 return retInc;
249 249
250} 250}
251void MissedAlarmTextBrowser::setSource(const QString & n) 251void MissedAlarmTextBrowser::setSource(const QString & n)
252{ 252{
253 if (n.startsWith("event:")) { 253 if (n.startsWith("event:")) {
254#ifdef DESKTOP_VERSION 254#ifdef DESKTOP_VERSION
255 emit showIncidence(n.mid(8)); 255 emit showIncidence(n.mid(8));
256#else 256#else
257 emit showIncidence(n.mid(6)); 257 emit showIncidence(n.mid(6));
258#endif 258#endif
259 return; 259 return;
260 } else if (n.startsWith("todo:")) { 260 } else if (n.startsWith("todo:")) {
261#ifdef DESKTOP_VERSION 261#ifdef DESKTOP_VERSION
262 emit showIncidence(n.mid(7)); 262 emit showIncidence(n.mid(7));
263#else 263#else
264 emit showIncidence(n.mid(5)); 264 emit showIncidence(n.mid(5));
265#endif 265#endif
266 return; 266 return;
267 } 267 }
268} 268}
269 269
270 270
271class KOBeamPrefs : public QDialog 271class KOBeamPrefs : public QDialog
272{ 272{
273 public: 273 public:
274 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 274 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
275 QDialog( parent, name, true ) 275 QDialog( parent, name, true )
276 { 276 {
277 setCaption( i18n("Beam Options") ); 277 setCaption( i18n("Beam Options") );
278 QVBoxLayout* lay = new QVBoxLayout( this ); 278 QVBoxLayout* lay = new QVBoxLayout( this );
279 lay->setSpacing( 3 ); 279 lay->setSpacing( 3 );
280 lay->setMargin( 3 ); 280 lay->setMargin( 3 );
281 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 281 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
282 lay->addWidget( format ); 282 lay->addWidget( format );
283 format->setExclusive ( true ) ; 283 format->setExclusive ( true ) ;
284 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 284 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
285 lay->addWidget( time ); time->setExclusive ( true ) ; 285 lay->addWidget( time ); time->setExclusive ( true ) ;
286 vcal = new QRadioButton(" vCalendar ", format ); 286 vcal = new QRadioButton(" vCalendar ", format );
287 ical = new QRadioButton(" iCalendar ", format ); 287 ical = new QRadioButton(" iCalendar ", format );
288 vcal->setChecked( true ); 288 vcal->setChecked( true );
289 tz = new QRadioButton(i18n(" With timezone "), time ); 289 tz = new QRadioButton(i18n(" With timezone "), time );
290 local = new QRadioButton(i18n(" Local time "), time ); 290 local = new QRadioButton(i18n(" Local time "), time );
291 tz->setChecked( true ); 291 tz->setChecked( true );
292 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 292 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
293 lay->addWidget( ok ); 293 lay->addWidget( ok );
294 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 294 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
295 lay->addWidget( cancel ); 295 lay->addWidget( cancel );
296 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 296 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
297 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 297 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
298 resize( 200, 200 ); 298 resize( 200, 200 );
299 } 299 }
300 300
301 bool beamVcal() { return vcal->isChecked(); } 301 bool beamVcal() { return vcal->isChecked(); }
302 bool beamLocal() { return local->isChecked(); } 302 bool beamLocal() { return local->isChecked(); }
303private: 303private:
304 QRadioButton* vcal, *ical, *local, *tz; 304 QRadioButton* vcal, *ical, *local, *tz;
305}; 305};
306class KOCatPrefs : public QDialog 306class KOCatPrefs : public QDialog
307{ 307{
308 public: 308 public:
309 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 309 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
310 QDialog( parent, name, true ) 310 QDialog( parent, name, true )
311 { 311 {
312 setCaption( i18n("Manage new Categories") ); 312 setCaption( i18n("Manage new Categories") );
313 QVBoxLayout* lay = new QVBoxLayout( this ); 313 QVBoxLayout* lay = new QVBoxLayout( this );
314 lay->setSpacing( 3 ); 314 lay->setSpacing( 3 );
315 lay->setMargin( 3 ); 315 lay->setMargin( 3 );
316 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 316 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
317 lay->addWidget( lab ); 317 lay->addWidget( lab );
318 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 318 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
319 lay->addWidget( format ); 319 lay->addWidget( format );
320 format->setExclusive ( true ) ; 320 format->setExclusive ( true ) ;
321 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 321 addCatBut = new QRadioButton(i18n("Add to category list"), format );
322 new QRadioButton(i18n("Remove from Events/Todos"), format ); 322 new QRadioButton(i18n("Remove from Events/Todos"), format );
323 addCatBut->setChecked( true ); 323 addCatBut->setChecked( true );
324 QPushButton * ok = new QPushButton( i18n("OK"), this ); 324 QPushButton * ok = new QPushButton( i18n("OK"), this );
325 lay->addWidget( ok ); 325 lay->addWidget( ok );
326 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 326 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
327 lay->addWidget( cancel ); 327 lay->addWidget( cancel );
328 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 328 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
329 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 329 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
330 resize( 200, 200 ); 330 resize( 200, 200 );
331 } 331 }
332 332
333 bool addCat() { return addCatBut->isChecked(); } 333 bool addCat() { return addCatBut->isChecked(); }
334private: 334private:
335 QRadioButton* addCatBut; 335 QRadioButton* addCatBut;
336}; 336};
337 337
338 338
339 339
340CalendarView::CalendarView( CalendarResources *calendar, 340CalendarView::CalendarView( CalendarResources *calendar,
341 QWidget *parent, const char *name ) 341 QWidget *parent, const char *name )
342 : CalendarViewBase( parent, name ), 342 : CalendarViewBase( parent, name ),
343 mCalendar( calendar ), 343 mCalendar( calendar ),
344 mResourceManager( calendar->resourceManager() ) 344 mResourceManager( calendar->resourceManager() )
345{ 345{
346 346
347 mEventEditor = 0; 347 mEventEditor = 0;
348 mTodoEditor = 0; 348 mTodoEditor = 0;
349 349
350 init(); 350 init();
351} 351}
352 352
353CalendarView::CalendarView( Calendar *calendar, 353CalendarView::CalendarView( Calendar *calendar,
354 QWidget *parent, const char *name ) 354 QWidget *parent, const char *name )
355 : CalendarViewBase( parent, name ), 355 : CalendarViewBase( parent, name ),
356 mCalendar( calendar ), 356 mCalendar( calendar ),
357 mResourceManager( 0 ) 357 mResourceManager( 0 )
358{ 358{
359 359
360 mEventEditor = 0; 360 mEventEditor = 0;
361 mTodoEditor = 0; 361 mTodoEditor = 0;
362 init(); 362 init();
363} 363}
364 364
365void CalendarView::init() 365void CalendarView::init()
366{ 366{
367 mNextAlarmDateTime = QDateTime::currentDateTime(); 367 mNextAlarmDateTime = QDateTime::currentDateTime();
368 setFocusPolicy ( NoFocus ); 368 setFocusPolicy ( NoFocus );
369 mViewerCallerIsSearchDialog = false; 369 mViewerCallerIsSearchDialog = false;
370 mBlockShowDates = false; 370 mBlockShowDates = false;
371 371
372 mDatePickerMode = 0; 372 mDatePickerMode = 0;
373 mCurrentSyncDevice = ""; 373 mCurrentSyncDevice = "";
374 mViewManager = new KOViewManager( this ); 374 mViewManager = new KOViewManager( this );
375 mDialogManager = new KODialogManager( this ); 375 mDialogManager = new KODialogManager( this );
376 mEventViewerDialog = 0; 376 mEventViewerDialog = 0;
377 mModified = false; 377 mModified = false;
378 mReadOnly = false; 378 mReadOnly = false;
379 mSelectedIncidence = 0; 379 mSelectedIncidence = 0;
380 mCalPrinter = 0; 380 mCalPrinter = 0;
381 mFilters.setAutoDelete(true); 381 mFilters.setAutoDelete(true);
382 382
383 mCalendar->registerObserver( this ); 383 mCalendar->registerObserver( this );
384 // TODO: Make sure that view is updated, when calendar is changed. 384 // TODO: Make sure that view is updated, when calendar is changed.
385 385
386 mStorage = new FileStorage( mCalendar ); 386 mStorage = new FileStorage( mCalendar );
387 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 387 mNavigator = new DateNavigator( this, "datevav", mViewManager );
388 388
389 QBoxLayout *topLayout = (QBoxLayout*)layout(); 389 QBoxLayout *topLayout = (QBoxLayout*)layout();
390#ifndef KORG_NOSPLITTER 390#ifndef KORG_NOSPLITTER
391 // create the main layout frames. 391 // create the main layout frames.
392 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 392 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
393 topLayout->addWidget(mPanner); 393 topLayout->addWidget(mPanner);
394 394
395 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 395 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
396 "CalendarView::LeftFrame"); 396 "CalendarView::LeftFrame");
397 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 397 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
398 398
399 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 399 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
400 "CalendarView::DateNavigator" ); 400 "CalendarView::DateNavigator" );
401 401
402 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 402 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
403 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 403 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
404 mTodoList->setNavigator( mNavigator ); 404 mTodoList->setNavigator( mNavigator );
405 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 405 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
406 406
407#ifdef KORG_NORESOURCEVIEW 407#ifdef KORG_NORESOURCEVIEW
408 mResourceView = 0; 408 mResourceView = 0;
409#else 409#else
410 if ( mResourceManager ) { 410 if ( mResourceManager ) {
411 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 411 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
412 mResourceView->updateView(); 412 mResourceView->updateView();
413 connect( mResourceView, SIGNAL( resourcesChanged() ), 413 connect( mResourceView, SIGNAL( resourcesChanged() ),
414 SLOT( updateView() ) ); 414 SLOT( updateView() ) );
415 } else { 415 } else {
416 mResourceView = 0; 416 mResourceView = 0;
417 } 417 }
418#endif 418#endif
419 QWidget *rightBox = new QWidget( mPanner ); 419 QWidget *rightBox = new QWidget( mPanner );
420 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 420 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
421 421
422 mRightFrame = new QWidgetStack( rightBox ); 422 mRightFrame = new QWidgetStack( rightBox );
423 rightLayout->addWidget( mRightFrame, 1 ); 423 rightLayout->addWidget( mRightFrame, 1 );
424 424
425 mLeftFrame = mLeftSplitter; 425 mLeftFrame = mLeftSplitter;
426#else 426#else
427 //QWidget *mainBox = new QWidget( this ); 427 //QWidget *mainBox = new QWidget( this );
428 //QWidget *leftFrame = new QWidget( mainBox ); 428 //QWidget *leftFrame = new QWidget( mainBox );
429 //QBoxLayout * mainBoxLayout; 429 //QBoxLayout * mainBoxLayout;
430 if ( KOPrefs::instance()->mVerticalScreen ) { 430 if ( KOPrefs::instance()->mVerticalScreen ) {
431 //mainBoxLayout = new QVBoxLayout(mainBox); 431 //mainBoxLayout = new QVBoxLayout(mainBox);
432 //leftFrameLayout = new QHBoxLayout(leftFrame ); 432 //leftFrameLayout = new QHBoxLayout(leftFrame );
433 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 433 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
434 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 434 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
435 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 435 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
436 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 436 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
437 } else { 437 } else {
438 //mainBoxLayout = new QHBoxLayout(mainBox); 438 //mainBoxLayout = new QHBoxLayout(mainBox);
439 //leftFrameLayout = new QVBoxLayout(leftFrame ); 439 //leftFrameLayout = new QVBoxLayout(leftFrame );
440 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 440 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
441 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 441 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
442 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 442 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
443 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 443 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
444 } 444 }
445 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 445 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
446 //QBoxLayout * leftFrameLayout; 446 //QBoxLayout * leftFrameLayout;
447 topLayout->addWidget( mMainFrame ); 447 topLayout->addWidget( mMainFrame );
448#ifdef DESKTOP_VERSION 448#ifdef DESKTOP_VERSION
449 mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this ); 449 mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this );
450 topLayout->addWidget( mDateScrollBar ); 450 topLayout->addWidget( mDateScrollBar );
451 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); 451 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) );
452 if ( QApplication::desktop()->width() < 800 )
453 mDateScrollBar->hide();
452#endif 454#endif
453 //mainBoxLayout->addWidget (mLeftFrame); 455 //mainBoxLayout->addWidget (mLeftFrame);
454 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 456 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
455 "CalendarView::DateNavigator" ); 457 "CalendarView::DateNavigator" );
456#if 0 458#if 0
457 // FIXME 459 // FIXME
458 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 460 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
459 "CalendarView::DateNavigator", QDate::currentDate()); 461 "CalendarView::DateNavigator", QDate::currentDate());
460#endif 462#endif
461 // mDateNavigator->blockSignals( true ); 463 // mDateNavigator->blockSignals( true );
462 //leftFrameLayout->addWidget( mDateNavigator ); 464 //leftFrameLayout->addWidget( mDateNavigator );
463 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 465 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
464 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 466 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
465 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); 467 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
466 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); 468 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
467 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); 469 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
468 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); 470 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) );
469 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); 471 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
470 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); 472 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) );
471 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); 473 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
472 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); 474 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
473 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); 475 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
474 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); 476 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) );
475 477
476 mTodoList->setNavigator( mNavigator ); 478 mTodoList->setNavigator( mNavigator );
477#if 0 479#if 0
478 if ( QApplication::desktop()->width() < 480 ) { 480 if ( QApplication::desktop()->width() < 480 ) {
479 leftFrameLayout->addWidget(mFilterView); 481 leftFrameLayout->addWidget(mFilterView);
480 leftFrameLayout->addWidget(mTodoList, 2 ); 482 leftFrameLayout->addWidget(mTodoList, 2 );
481 483
482 } else { 484 } else {
483 leftFrameLayout->addWidget(mTodoList,2 ); 485 leftFrameLayout->addWidget(mTodoList,2 );
484 leftFrameLayout->addWidget(mFilterView ); 486 leftFrameLayout->addWidget(mFilterView );
485 } 487 }
486#endif 488#endif
487 mFilterView->hide(); 489 mFilterView->hide();
488 mCalEditView->hide(); 490 mCalEditView->hide();
489 QWidget *rightBox = new QWidget( mMainFrame ); 491 QWidget *rightBox = new QWidget( mMainFrame );
490 //mainBoxLayout->addWidget ( rightBox, 10 ); 492 //mainBoxLayout->addWidget ( rightBox, 10 );
491 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 493 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
492 mRightFrame = new QWidgetStack( rightBox ); 494 mRightFrame = new QWidgetStack( rightBox );
493 rightLayout->addWidget( mRightFrame, 10 ); 495 rightLayout->addWidget( mRightFrame, 10 );
494 496
495 //mLeftFrame = (QWidget *)leftFrame; 497 //mLeftFrame = (QWidget *)leftFrame;
496 if ( KOPrefs::instance()->mVerticalScreen ) { 498 if ( KOPrefs::instance()->mVerticalScreen ) {
497 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 499 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
498 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 500 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
499 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 501 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
500 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 502 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
501 } else { 503 } else {
502 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 504 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
503 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 505 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
504 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 506 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
505 } 507 }
506 if ( !KOPrefs::instance()->mShowDateNavigator) 508 if ( !KOPrefs::instance()->mShowDateNavigator)
507 mDateNavigator->hide(); 509 mDateNavigator->hide();
508 //qDebug("Calendarview Size %d %d ", width(), height()); 510 //qDebug("Calendarview Size %d %d ", width(), height());
509#endif 511#endif
510 512
511 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 513 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
512 SLOT( showDates( const KCal::DateList & ) ) ); 514 SLOT( showDates( const KCal::DateList & ) ) );
513 515
514 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 516 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
515 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 517 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
516 518
517 519
518 520
519 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 521 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
520 mViewManager, SLOT( showMonth( const QDate & ) ) ); 522 mViewManager, SLOT( showMonth( const QDate & ) ) );
521 523
522 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 524 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
523 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 525 mNavigator, SLOT( selectWeek( const QDate & ) ) );
524 526
525 connect( mDateNavigator, SIGNAL( goPrevYear() ), 527 connect( mDateNavigator, SIGNAL( goPrevYear() ),
526 mNavigator, SLOT( selectPreviousYear() ) ); 528 mNavigator, SLOT( selectPreviousYear() ) );
527 connect( mDateNavigator, SIGNAL( goNextYear() ), 529 connect( mDateNavigator, SIGNAL( goNextYear() ),
528 mNavigator, SLOT( selectNextYear() ) ); 530 mNavigator, SLOT( selectNextYear() ) );
529 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 531 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
530 mNavigator, SLOT( selectPreviousMonth() ) ); 532 mNavigator, SLOT( selectPreviousMonth() ) );
531 connect( mDateNavigator, SIGNAL( goNextMonth() ), 533 connect( mDateNavigator, SIGNAL( goNextMonth() ),
532 mNavigator, SLOT( selectNextMonth() ) ); 534 mNavigator, SLOT( selectNextMonth() ) );
533 535
534 connect( mDateNavigator, SIGNAL( goPrevious() ), 536 connect( mDateNavigator, SIGNAL( goPrevious() ),
535 mNavigator, SLOT( selectPrevious() ) ); 537 mNavigator, SLOT( selectPrevious() ) );
536 connect( mDateNavigator, SIGNAL( goNext() ), 538 connect( mDateNavigator, SIGNAL( goNext() ),
537 mNavigator, SLOT( selectNext() ) ); 539 mNavigator, SLOT( selectNext() ) );
538 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 540 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
539 mNavigator, SLOT( slotMonthSelect( int ) ) ); 541 mNavigator, SLOT( slotMonthSelect( int ) ) );
540 542
541 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 543 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
542 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 544 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
543#if 0 545#if 0
544 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 546 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
545 SLOT( incidenceAdded( Incidence *) ) ); 547 SLOT( incidenceAdded( Incidence *) ) );
546#endif 548#endif
547 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 549 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
548 550
549 connect( this, SIGNAL( configChanged() ), 551 connect( this, SIGNAL( configChanged() ),
550 mDateNavigator, SLOT( updateConfig() ) ); 552 mDateNavigator, SLOT( updateConfig() ) );
551 553
552 connect( mTodoList, SIGNAL( newTodoSignal() ), 554 connect( mTodoList, SIGNAL( newTodoSignal() ),
553 SLOT( newTodo() ) ); 555 SLOT( newTodo() ) );
554 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 556 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
555 SLOT( newSubTodo( Todo * ) ) ); 557 SLOT( newSubTodo( Todo * ) ) );
556 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 558 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
557 SLOT( editTodo( Todo * ) ) ); 559 SLOT( editTodo( Todo * ) ) );
558 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 560 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
559 SLOT( showTodo( Todo *) ) ); 561 SLOT( showTodo( Todo *) ) );
560 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 562 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
561 SLOT( deleteTodo( Todo *) ) ); 563 SLOT( deleteTodo( Todo *) ) );
562 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 564 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
563 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 565 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
564 SLOT( purgeCompleted() ) ); 566 SLOT( purgeCompleted() ) );
565 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 567 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
566 SIGNAL( todoModified( Todo *, int ) ) ); 568 SIGNAL( todoModified( Todo *, int ) ) );
567 569
568 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 570 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
569 this, SLOT ( cloneIncidence( Incidence * ) ) ); 571 this, SLOT ( cloneIncidence( Incidence * ) ) );
570 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 572 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
571 this, SLOT (cancelIncidence( Incidence * ) ) ); 573 this, SLOT (cancelIncidence( Incidence * ) ) );
572 574
573 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 575 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
574 this, SLOT ( moveIncidence( Incidence * ) ) ); 576 this, SLOT ( moveIncidence( Incidence * ) ) );
575 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 577 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
576 this, SLOT ( beamIncidence( Incidence * ) ) ); 578 this, SLOT ( beamIncidence( Incidence * ) ) );
577 579
578 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 580 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
579 this, SLOT ( todo_unsub( Todo * ) ) ); 581 this, SLOT ( todo_unsub( Todo * ) ) );
580 582
581 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 583 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
582 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 584 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
583 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 585 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
584 SLOT( updateTodo( Todo *, int ) ) ); 586 SLOT( updateTodo( Todo *, int ) ) );
585 connect( this, SIGNAL( todoModified( Todo *, int )), this, 587 connect( this, SIGNAL( todoModified( Todo *, int )), this,
586 SLOT( changeTodoDisplay( Todo *, int ) ) ); 588 SLOT( changeTodoDisplay( Todo *, int ) ) );
587 589
588 590
589 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 591 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
590 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 592 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
591 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 593 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
592 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 594 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
593 595
594 596
595 597
596 598
597 599
598 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 600 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
599 SLOT(checkClipboard())); 601 SLOT(checkClipboard()));
600 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 602 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
601 SLOT( processTodoListSelection( Incidence * ) ) ); 603 SLOT( processTodoListSelection( Incidence * ) ) );
602 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 604 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
603 605
604 // kdDebug() << "CalendarView::CalendarView() done" << endl; 606 // kdDebug() << "CalendarView::CalendarView() done" << endl;
605 607
606 mDateFrame = new QVBox(0,0,WType_Popup); 608 mDateFrame = new QVBox(0,0,WType_Popup);
607 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 609 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
608 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 610 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
609 mDateFrame->setLineWidth(3); 611 mDateFrame->setLineWidth(3);
610 mDateFrame->hide(); 612 mDateFrame->hide();
611 mDateFrame->setCaption( i18n( "Pick a date to display")); 613 mDateFrame->setCaption( i18n( "Pick a date to display"));
612 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 614 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
613 615
614 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 616 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
615 617
616 mEventEditor = mDialogManager->getEventEditor(); 618 mEventEditor = mDialogManager->getEventEditor();
617 mTodoEditor = mDialogManager->getTodoEditor(); 619 mTodoEditor = mDialogManager->getTodoEditor();
618 620
619 mFlagEditDescription = false; 621 mFlagEditDescription = false;
620 622
621 mSuspendTimer = new QTimer( this ); 623 mSuspendTimer = new QTimer( this );
622 mAlarmTimer = new QTimer( this ); 624 mAlarmTimer = new QTimer( this );
623 mRecheckAlarmTimer = new QTimer( this ); 625 mRecheckAlarmTimer = new QTimer( this );
624 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 626 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
625 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 627 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
626 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 628 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
627 mAlarmDialog = new AlarmDialog( this ); 629 mAlarmDialog = new AlarmDialog( this );
628 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 630 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
629 mAlarmDialog->setServerNotification( false ); 631 mAlarmDialog->setServerNotification( false );
630 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 632 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
631 633
632 634
633#ifndef DESKTOP_VERSION 635#ifndef DESKTOP_VERSION
634//US listen for arriving address resultsets 636//US listen for arriving address resultsets
635 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 637 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
636 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 638 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
637#endif 639#endif
638 mDateNavigator->setCalendar( mCalendar ); 640 mDateNavigator->setCalendar( mCalendar );
639} 641}
640 642
641 643
642CalendarView::~CalendarView() 644CalendarView::~CalendarView()
643{ 645{
644 // kdDebug() << "~CalendarView()" << endl; 646 // kdDebug() << "~CalendarView()" << endl;
645 //qDebug("CalendarView::~CalendarView() "); 647 //qDebug("CalendarView::~CalendarView() ");
646 delete mDialogManager; 648 delete mDialogManager;
647 delete mViewManager; 649 delete mViewManager;
648 delete mStorage; 650 delete mStorage;
649 delete mDateFrame ; 651 delete mDateFrame ;
650 delete mEventViewerDialog; 652 delete mEventViewerDialog;
651 //kdDebug() << "~CalendarView() done" << endl; 653 //kdDebug() << "~CalendarView() done" << endl;
652} 654}
653void CalendarView::setScrollBarStep(int val ) 655void CalendarView::setScrollBarStep(int val )
654{ 656{
655#ifdef DESKTOP_VERSION 657#ifdef DESKTOP_VERSION
656 mDateScrollBar->setLineStep ( val ); 658 mDateScrollBar->setLineStep ( val );
657#endif 659#endif
658} 660}
659void CalendarView::scrollBarValue(int val ) 661void CalendarView::scrollBarValue(int val )
660{ 662{
661#ifdef DESKTOP_VERSION 663#ifdef DESKTOP_VERSION
662 if ( QApplication::desktop()->width() < 800 ) return; 664 if ( QApplication::desktop()->width() < 800 ) return;
663 static bool block = false; 665 static bool block = false;
664 if ( block ) return; 666 if ( block ) return;
665 block = true; 667 block = true;
666 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 668 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
667 //qDebug("VAL %d ",val ); 669 //qDebug("VAL %d ",val );
668 int count = mNavigator->selectedDates().count(); 670 int count = mNavigator->selectedDates().count();
669 int year = mNavigator->selectedDates().first().year(); 671 int year = mNavigator->selectedDates().first().year();
670 int day = mNavigator->selectedDates().first().dayOfYear(); 672 int day = mNavigator->selectedDates().first().dayOfYear();
671 if ( val == day -1 ) { 673 if ( val == day -1 ) {
672 block = false; 674 block = false;
673 return; 675 return;
674 } 676 }
675 QDate d ( year,1,1 ); 677 QDate d ( year,1,1 );
676 mNavigator->selectDates( d.addDays( val ), count ); 678 mNavigator->selectDates( d.addDays( val ), count );
677 block = false; 679 block = false;
678#endif 680#endif
679 681
680} 682}
681 683
682void CalendarView::checkAlarms() 684void CalendarView::checkAlarms()
683{ 685{
684 KConfig *config = KOGlobals::config(); 686 KConfig *config = KOGlobals::config();
685 config->setGroup( "AppRun" ); 687 config->setGroup( "AppRun" );
686 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 688 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
687 int daysto = dt.daysTo( QDate::currentDate() ); 689 int daysto = dt.daysTo( QDate::currentDate() );
688 int days = config->readNumEntry( "LatestProgramStopDays" , daysto); 690 int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
689 dt = dt.addDays( days ); 691 dt = dt.addDays( days );
690 int secto = dt.secsTo( QDateTime::currentDateTime() ); 692 int secto = dt.secsTo( QDateTime::currentDateTime() );
691 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; 693 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
692 //qDebug("KO: Reading program stop %d ", secs); 694 //qDebug("KO: Reading program stop %d ", secs);
693 //secs -= ( 3600 * 24*3 ); // debug only 695 //secs -= ( 3600 * 24*3 ); // debug only
694 QDateTime latest = dt.addSecs ( secs ); 696 QDateTime latest = dt.addSecs ( secs );
695 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 697 qDebug("KO: Last termination on %s ", latest.toString().latin1());
696 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 698 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
697 QPtrList<Incidence> el = mCalendar->rawIncidences(); 699 QPtrList<Incidence> el = mCalendar->rawIncidences();
698 QPtrList<Incidence> al; 700 QPtrList<Incidence> al;
699 Incidence* inL = el.first(); 701 Incidence* inL = el.first();
700 QDateTime cur = QDateTime::currentDateTime().addSecs(-59); 702 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
701 qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); 703 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
702 while ( inL ) { 704 while ( inL ) {
703 bool ok = false; 705 bool ok = false;
704 int offset = 0; 706 int offset = 0;
705 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 707 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
706 if ( ok ) { 708 if ( ok ) {
707 //qDebug("OK %s",next.toString().latin1()); 709 //qDebug("OK %s",next.toString().latin1());
708 if ( next < cur ) { 710 if ( next < cur ) {
709 al.append( inL ); 711 al.append( inL );
710 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 712 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
711 } 713 }
712 } 714 }
713 inL = el.next(); 715 inL = el.next();
714 } 716 }
715 if ( al.count() ) { 717 if ( al.count() ) {
716 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 718 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
717 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 719 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
718 QVBoxLayout* lay = new QVBoxLayout( dia ); 720 QVBoxLayout* lay = new QVBoxLayout( dia );
719 lay->setSpacing( 0 ); 721 lay->setSpacing( 0 );
720 lay->setMargin( 0 ); 722 lay->setMargin( 0 );
721 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 723 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
722 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 724 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
723 lay->addWidget( matb ); 725 lay->addWidget( matb );
724 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 726 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
725 int wid = 210; 727 int wid = 210;
726 int x = QApplication::desktop()->width() - wid - 7; 728 int x = QApplication::desktop()->width() - wid - 7;
727 int y = QApplication::desktop()->height() - wid - 70; 729 int y = QApplication::desktop()->height() - wid - 70;
728 dia->setGeometry ( x,y,wid,wid); 730 dia->setGeometry ( x,y,wid,wid);
729 } else { 731 } else {
730 int si = 220; 732 int si = 220;
731 if ( QApplication::desktop()->width() > 470 ) 733 if ( QApplication::desktop()->width() > 470 )
732 si = 400; 734 si = 400;
733 dia->resize(si,si/2); 735 dia->resize(si,si/2);
734 } 736 }
735 dia->setBackgroundColor( QColor( 255, 255, 255 ) ); 737 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
736 dia->show(); 738 dia->show();
737 739
738 } 740 }
739} 741}
740void CalendarView::showDay( QDate d ) 742void CalendarView::showDay( QDate d )
741{ 743{
742 dateNavigator()->blockSignals( true ); 744 dateNavigator()->blockSignals( true );
743 dateNavigator()->selectDate( d ); 745 dateNavigator()->selectDate( d );
744 dateNavigator()->blockSignals( false ); 746 dateNavigator()->blockSignals( false );
745 mViewManager->showDayView(); 747 mViewManager->showDayView();
746 //dateNavigator()->selectDate( d ); 748 //dateNavigator()->selectDate( d );
747} 749}
748void CalendarView::timerAlarm() 750void CalendarView::timerAlarm()
749{ 751{
750 //qDebug("CalendarView::timerAlarm() "); 752 //qDebug("CalendarView::timerAlarm() ");
751 computeAlarm(mAlarmNotification ); 753 computeAlarm(mAlarmNotification );
752} 754}
753 755
754void CalendarView::suspendAlarm() 756void CalendarView::suspendAlarm()
755{ 757{
756 //qDebug(" CalendarView::suspendAlarm() "); 758 //qDebug(" CalendarView::suspendAlarm() ");
757 computeAlarm(mSuspendAlarmNotification ); 759 computeAlarm(mSuspendAlarmNotification );
758 760
759} 761}
760 762
761void CalendarView::startAlarm( QString mess , QString filename) 763void CalendarView::startAlarm( QString mess , QString filename)
762{ 764{
763 765
764 topLevelWidget()->showNormal(); 766 topLevelWidget()->showNormal();
765 topLevelWidget()->setActiveWindow(); 767 topLevelWidget()->setActiveWindow();
766 topLevelWidget()->raise(); 768 topLevelWidget()->raise();
767 769
768 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 770 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
769 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 771 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
770 772
771} 773}
772 774
773void CalendarView::checkNextTimerAlarm() 775void CalendarView::checkNextTimerAlarm()
774{ 776{
775 mCalendar->checkAlarmForIncidence( 0, true ); 777 mCalendar->checkAlarmForIncidence( 0, true );
776} 778}
777 779
778void CalendarView::computeAlarm( QString msg ) 780void CalendarView::computeAlarm( QString msg )
779{ 781{
780 782
781 QString mess = msg; 783 QString mess = msg;
782 QString mAlarmMessage = mess.mid( 9 ); 784 QString mAlarmMessage = mess.mid( 9 );
783 QString filename = MainWindow::resourcePath(); 785 QString filename = MainWindow::resourcePath();
784 filename += "koalarm.wav"; 786 filename += "koalarm.wav";
785 QString tempfilename; 787 QString tempfilename;
786 if ( mess.left( 13 ) == "suspend_alarm") { 788 if ( mess.left( 13 ) == "suspend_alarm") {
787 bool error = false; 789 bool error = false;
788 int len = mess.mid( 13 ).find("+++"); 790 int len = mess.mid( 13 ).find("+++");
789 if ( len < 2 ) 791 if ( len < 2 )
790 error = true; 792 error = true;
791 else { 793 else {
792 tempfilename = mess.mid( 13, len ); 794 tempfilename = mess.mid( 13, len );
793 if ( !QFile::exists( tempfilename ) ) 795 if ( !QFile::exists( tempfilename ) )
794 error = true; 796 error = true;
795 } 797 }
796 if ( ! error ) { 798 if ( ! error ) {
797 filename = tempfilename; 799 filename = tempfilename;
798 } 800 }
799 mAlarmMessage = mess.mid( 13+len+3 ); 801 mAlarmMessage = mess.mid( 13+len+3 );
800 //qDebug("suspend file %s ",tempfilename.latin1() ); 802 //qDebug("suspend file %s ",tempfilename.latin1() );
801 startAlarm( mAlarmMessage, filename); 803 startAlarm( mAlarmMessage, filename);
802 return; 804 return;
803 } 805 }
804 if ( mess.left( 11 ) == "timer_alarm") { 806 if ( mess.left( 11 ) == "timer_alarm") {
805 //mTimerTime = 0; 807 //mTimerTime = 0;
806 startAlarm( mess.mid( 11 ), filename ); 808 startAlarm( mess.mid( 11 ), filename );
807 return; 809 return;
808 } 810 }
809 if ( mess.left( 10 ) == "proc_alarm") { 811 if ( mess.left( 10 ) == "proc_alarm") {
810 bool error = false; 812 bool error = false;
811 int len = mess.mid( 10 ).find("+++"); 813 int len = mess.mid( 10 ).find("+++");
812 if ( len < 2 ) 814 if ( len < 2 )
813 error = true; 815 error = true;
814 else { 816 else {
815 tempfilename = mess.mid( 10, len ); 817 tempfilename = mess.mid( 10, len );
816 if ( !QFile::exists( tempfilename ) ) 818 if ( !QFile::exists( tempfilename ) )
817 error = true; 819 error = true;
818 } 820 }
819 if ( error ) { 821 if ( error ) {
820 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 822 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
821 mAlarmMessage += mess.mid( 10+len+3+9 ); 823 mAlarmMessage += mess.mid( 10+len+3+9 );
822 } else { 824 } else {
823 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 825 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
824 //qDebug("-----system command %s ",tempfilename.latin1() ); 826 //qDebug("-----system command %s ",tempfilename.latin1() );
825#ifndef _WIN32_ 827#ifndef _WIN32_
826 if ( vfork () == 0 ) { 828 if ( vfork () == 0 ) {
827 execl ( tempfilename.latin1(), 0 ); 829 execl ( tempfilename.latin1(), 0 );
828 return; 830 return;
829 } 831 }
830#else 832#else
831 QProcess* p = new QProcess(); 833 QProcess* p = new QProcess();
832 p->addArgument( tempfilename.latin1() ); 834 p->addArgument( tempfilename.latin1() );
833 p->start(); 835 p->start();
834 return; 836 return;
835#endif 837#endif