summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp148
1 files changed, 77 insertions, 71 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 8385bcc..c1a2f76 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -23,40 +23,46 @@
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
24 GNU General Public License for more details. 24 GNU General Public License for more details.
25 25
26 You should have received a copy of the GNU General Public License 26 You should have received a copy of the GNU General Public License
27 along with this program; if not, write to the Free Software 27 along with this program; if not, write to the Free Software
28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#include <stdlib.h> 31#include <stdlib.h>
32 32
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qradiobutton.h> 34#include <qradiobutton.h>
35#include <qbuttongroup.h> 35#include <q3buttongroup.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qclipboard.h> 37#include <qclipboard.h>
38#include <qcursor.h> 38#include <qcursor.h>
39#include <qmessagebox.h> 39#include <qmessagebox.h>
40#include <qprogressbar.h> 40#include <q3progressbar.h>
41#include <qmultilineedit.h> 41#include <q3multilineedit.h>
42#include <qtimer.h> 42#include <qtimer.h>
43#include <qwidgetstack.h> 43#include <q3widgetstack.h>
44#include <qptrlist.h> 44#include <q3ptrlist.h>
45#include <qregexp.h> 45#include <qregexp.h>
46#include <qgroupbox.h> 46#include <q3groupbox.h>
47#include <qfile.h> 47#include <qfile.h>
48#include <qdir.h> 48#include <qdir.h>
49#ifndef KORG_NOSPLITTER 49#ifndef KORG_NOSPLITTER
50#include <qsplitter.h> 50#include <qsplitter.h>
51//Added by qt3to4:
52#include <Q3VBoxLayout>
53#include <QKeyEvent>
54#include <Q3Frame>
55#include <QLabel>
56#include <Q3ValueList>
51#endif 57#endif
52 58
53#include <kglobal.h> 59#include <kglobal.h>
54#include <kdebug.h> 60#include <kdebug.h>
55#include <kstandarddirs.h> 61#include <kstandarddirs.h>
56#include <kfiledialog.h> 62#include <kfiledialog.h>
57#include <kmessagebox.h> 63#include <kmessagebox.h>
58#include <knotifyclient.h> 64#include <knotifyclient.h>
59#include <kconfig.h> 65#include <kconfig.h>
60 66
61#include <libkdepim/ksyncprefsdialog.h> 67#include <libkdepim/ksyncprefsdialog.h>
62#include <krun.h> 68#include <krun.h>
@@ -119,37 +125,37 @@
119#include "mainwindow.h" 125#include "mainwindow.h"
120#include "categoryeditdialog.h" 126#include "categoryeditdialog.h"
121 127
122#include "calendarview.h" 128#include "calendarview.h"
123#ifndef DESKTOP_VERSION 129#ifndef DESKTOP_VERSION
124#include <qtopia/alarmserver.h> 130#include <qtopia/alarmserver.h>
125#endif 131#endif
126#ifndef _WIN32_ 132#ifndef _WIN32_
127#include <stdlib.h> 133#include <stdlib.h>
128#include <stdio.h> 134#include <stdio.h>
129#include <unistd.h> 135#include <unistd.h>
130#else 136#else
131#include <qprocess.h> 137#include <q3process.h>
132#endif 138#endif
133 139
134#ifdef DESKTOP_VERSION 140#ifdef DESKTOP_VERSION
135#include <kabc/stdaddressbook.h> 141#include <kabc/stdaddressbook.h>
136#endif 142#endif
137using namespace KOrg; 143using namespace KOrg;
138using namespace KCal; 144using namespace KCal;
139extern int globalFlagBlockAgenda; 145extern int globalFlagBlockAgenda;
140extern int globalFlagBlockStartup; 146extern int globalFlagBlockStartup;
141 147
142 148
143MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) 149MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, Q3PtrList<Incidence> alarms,QDateTime start ) : Q3TextBrowser(parent)
144 150
145{ 151{
146 mAlarms = alarms; 152 mAlarms = alarms;
147 viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); 153 viewport()->setBackgroundColor( QColor( 255, 255, 255 ) );
148 QString mText = "<table width=\"100%\">\n"; 154 QString mText = "<table width=\"100%\">\n";
149 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 155 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
150#ifdef DESKTOP_VERSION 156#ifdef DESKTOP_VERSION
151 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 157 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
152#else 158#else
153 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; 159 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>";
154#endif 160#endif
155 // mText += "<img src=\""; 161 // mText += "<img src=\"";
@@ -268,31 +274,31 @@ void MissedAlarmTextBrowser::setSource(const QString & n)
268 return; 274 return;
269 } 275 }
270} 276}
271 277
272 278
273class KOBeamPrefs : public QDialog 279class KOBeamPrefs : public QDialog
274{ 280{
275 public: 281 public:
276 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 282 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
277 QDialog( parent, name, true ) 283 QDialog( parent, name, true )
278 { 284 {
279 setCaption( i18n("Beam Options") ); 285 setCaption( i18n("Beam Options") );
280 QVBoxLayout* lay = new QVBoxLayout( this ); 286 Q3VBoxLayout* lay = new Q3VBoxLayout( this );
281 lay->setSpacing( 3 ); 287 lay->setSpacing( 3 );
282 lay->setMargin( 3 ); 288 lay->setMargin( 3 );
283 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 289 Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("File format"), this );
284 lay->addWidget( format ); 290 lay->addWidget( format );
285 format->setExclusive ( true ) ; 291 format->setExclusive ( true ) ;
286 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 292 Q3ButtonGroup* time = new Q3ButtonGroup(1, Qt::Horizontal, i18n("Time format"), this );
287 lay->addWidget( time ); time->setExclusive ( true ) ; 293 lay->addWidget( time ); time->setExclusive ( true ) ;
288 vcal = new QRadioButton(" vCalendar ", format ); 294 vcal = new QRadioButton(" vCalendar ", format );
289 ical = new QRadioButton(" iCalendar ", format ); 295 ical = new QRadioButton(" iCalendar ", format );
290 vcal->setChecked( true ); 296 vcal->setChecked( true );
291 tz = new QRadioButton(i18n(" With timezone "), time ); 297 tz = new QRadioButton(i18n(" With timezone "), time );
292 local = new QRadioButton(i18n(" Local time "), time ); 298 local = new QRadioButton(i18n(" Local time "), time );
293 tz->setChecked( true ); 299 tz->setChecked( true );
294 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 300 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
295 lay->addWidget( ok ); 301 lay->addWidget( ok );
296 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 302 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
297 lay->addWidget( cancel ); 303 lay->addWidget( cancel );
298 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 304 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
@@ -303,30 +309,30 @@ class KOBeamPrefs : public QDialog
303 bool beamVcal() { return vcal->isChecked(); } 309 bool beamVcal() { return vcal->isChecked(); }
304 bool beamLocal() { return local->isChecked(); } 310 bool beamLocal() { return local->isChecked(); }
305private: 311private:
306 QRadioButton* vcal, *ical, *local, *tz; 312 QRadioButton* vcal, *ical, *local, *tz;
307}; 313};
308class KOCatPrefs : public QDialog 314class KOCatPrefs : public QDialog
309{ 315{
310 public: 316 public:
311 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 317 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
312 QDialog( parent, name, true ) 318 QDialog( parent, name, true )
313 { 319 {
314 setCaption( i18n("Manage new Categories") ); 320 setCaption( i18n("Manage new Categories") );
315 QVBoxLayout* lay = new QVBoxLayout( this ); 321 Q3VBoxLayout* lay = new Q3VBoxLayout( this );
316 lay->setSpacing( 3 ); 322 lay->setSpacing( 3 );
317 lay->setMargin( 3 ); 323 lay->setMargin( 3 );
318 QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); 324 QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this );
319 lay->addWidget( lab ); 325 lay->addWidget( lab );
320 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 326 Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("New categories not in list:"), this );
321 lay->addWidget( format ); 327 lay->addWidget( format );
322 format->setExclusive ( true ) ; 328 format->setExclusive ( true ) ;
323 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 329 addCatBut = new QRadioButton(i18n("Add to category list"), format );
324 new QRadioButton(i18n("Remove from Events/Todos"), format ); 330 new QRadioButton(i18n("Remove from Events/Todos"), format );
325 addCatBut->setChecked( true ); 331 addCatBut->setChecked( true );
326 QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); 332 QPushButton * ok = new QPushButton( i18n("Change category list now!"), this );
327 lay->addWidget( ok ); 333 lay->addWidget( ok );
328 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 334 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
329 lay->addWidget( cancel ); 335 lay->addWidget( cancel );
330 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 336 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
331 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 337 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
332 resize( 200, 200 ); 338 resize( 200, 200 );
@@ -364,46 +370,46 @@ CalendarView::CalendarView( Calendar *calendar,
364 init(); 370 init();
365} 371}
366 372
367void CalendarView::init() 373void CalendarView::init()
368{ 374{
369 mMultiResourceSync = false; 375 mMultiResourceSync = false;
370 flag_blockConflict = false; 376 flag_blockConflict = false;
371 flag_blockScrollBar = false; 377 flag_blockScrollBar = false;
372 flag_checkFileFirsttime = true; 378 flag_checkFileFirsttime = true;
373 flag_clearallviewsEventDisplay = false; 379 flag_clearallviewsEventDisplay = false;
374 flag_clearallviewsupdateView = false; 380 flag_clearallviewsupdateView = false;
375 mNextAlarmDateTime = QDateTime::currentDateTime(); 381 mNextAlarmDateTime = QDateTime::currentDateTime();
376 setFocusPolicy (NoFocus ); 382 setFocusPolicy (Qt::NoFocus );
377 mViewerCallerIsSearchDialog = false; 383 mViewerCallerIsSearchDialog = false;
378 mBlockShowDates = false; 384 mBlockShowDates = false;
379 mConflictingEvent = 0; 385 mConflictingEvent = 0;
380 mDatePickerMode = 0; 386 mDatePickerMode = 0;
381 mCurrentSyncDevice = ""; 387 mCurrentSyncDevice = "";
382 mViewManager = new KOViewManager( this ); 388 mViewManager = new KOViewManager( this );
383 mDialogManager = new KODialogManager( this ); 389 mDialogManager = new KODialogManager( this );
384 mEventViewerDialog = 0; 390 mEventViewerDialog = 0;
385 mModified = false; 391 mModified = false;
386 mReadOnly = false; 392 mReadOnly = false;
387 mSelectedIncidence = 0; 393 mSelectedIncidence = 0;
388 mCalPrinter = 0; 394 mCalPrinter = 0;
389 mFilters.setAutoDelete(true); 395 mFilters.setAutoDelete(true);
390 396
391 mCalendar->registerObserver( this ); 397 mCalendar->registerObserver( this );
392 // TODO: Make sure that view is updated, when calendar is changed. 398 // TODO: Make sure that view is updated, when calendar is changed.
393 399
394 mStorage = new FileStorage( mCalendar ); 400 mStorage = new FileStorage( mCalendar );
395 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 401 mNavigator = new DateNavigator( this, "datevav", mViewManager );
396 402
397 QBoxLayout *topLayout = (QBoxLayout*)layout(); 403 Q3BoxLayout *topLayout = (Q3BoxLayout*)layout();
398#ifndef KORG_NOSPLITTER 404#ifndef KORG_NOSPLITTER
399 // create the main layout frames. 405 // create the main layout frames.
400 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 406 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
401 topLayout->addWidget(mPanner); 407 topLayout->addWidget(mPanner);
402 408
403 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 409 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
404 "CalendarView::LeftFrame"); 410 "CalendarView::LeftFrame");
405 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 411 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
406 412
407 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 413 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
408 "CalendarView::DateNavigator" ); 414 "CalendarView::DateNavigator" );
409 415
@@ -416,27 +422,27 @@ void CalendarView::init()
416 mResourceView = 0; 422 mResourceView = 0;
417#else 423#else
418 if ( mResourceManager ) { 424 if ( mResourceManager ) {
419 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 425 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
420 mResourceView->updateView(); 426 mResourceView->updateView();
421 connect( mResourceView, SIGNAL( resourcesChanged() ), 427 connect( mResourceView, SIGNAL( resourcesChanged() ),
422 SLOT( updateView() ) ); 428 SLOT( updateView() ) );
423 } else { 429 } else {
424 mResourceView = 0; 430 mResourceView = 0;
425 } 431 }
426#endif 432#endif
427 QWidget *rightBox = new QWidget( mPanner ); 433 QWidget *rightBox = new QWidget( mPanner );
428 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 434 Q3BoxLayout *rightLayout = new Q3VBoxLayout( rightBox );
429 435
430 mRightFrame = new QWidgetStack( rightBox ); 436 mRightFrame = new Q3WidgetStack( rightBox );
431 rightLayout->addWidget( mRightFrame, 1 ); 437 rightLayout->addWidget( mRightFrame, 1 );
432 438
433 mLeftFrame = mLeftSplitter; 439 mLeftFrame = mLeftSplitter;
434#else 440#else
435 //QWidget *mainBox = new QWidget( this ); 441 //QWidget *mainBox = new QWidget( this );
436 //QWidget *leftFrame = new QWidget( mainBox ); 442 //QWidget *leftFrame = new QWidget( mainBox );
437 //QBoxLayout * mainBoxLayout; 443 //QBoxLayout * mainBoxLayout;
438 if ( KOPrefs::instance()->mVerticalScreen ) { 444 if ( KOPrefs::instance()->mVerticalScreen ) {
439 //mainBoxLayout = new QVBoxLayout(mainBox); 445 //mainBoxLayout = new QVBoxLayout(mainBox);
440 //leftFrameLayout = new QHBoxLayout(leftFrame ); 446 //leftFrameLayout = new QHBoxLayout(leftFrame );
441 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 447 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
442 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 448 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
@@ -445,25 +451,25 @@ void CalendarView::init()
445 } else { 451 } else {
446 //mainBoxLayout = new QHBoxLayout(mainBox); 452 //mainBoxLayout = new QHBoxLayout(mainBox);
447 //leftFrameLayout = new QVBoxLayout(leftFrame ); 453 //leftFrameLayout = new QVBoxLayout(leftFrame );
448 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 454 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
449 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 455 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
450 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 456 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
451 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 457 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
452 } 458 }
453 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 459 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
454 //QBoxLayout * leftFrameLayout; 460 //QBoxLayout * leftFrameLayout;
455 topLayout->addWidget( mMainFrame ); 461 topLayout->addWidget( mMainFrame );
456#ifdef DESKTOP_VERSION 462#ifdef DESKTOP_VERSION
457 mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this ); 463 mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,Qt::Horizontal, this );
458 topLayout->addWidget( mDateScrollBar ); 464 topLayout->addWidget( mDateScrollBar );
459 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); 465 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) );
460 if ( QApplication::desktop()->width() < 800 ) 466 if ( QApplication::desktop()->width() < 800 )
461 mDateScrollBar->hide(); 467 mDateScrollBar->hide();
462#endif 468#endif
463 //mainBoxLayout->addWidget (mLeftFrame); 469 //mainBoxLayout->addWidget (mLeftFrame);
464 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 470 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
465 "CalendarView::DateNavigator" ); 471 "CalendarView::DateNavigator" );
466#if 0 472#if 0
467 // FIXME 473 // FIXME
468 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 474 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
469 "CalendarView::DateNavigator", QDate::currentDate()); 475 "CalendarView::DateNavigator", QDate::currentDate());
@@ -492,26 +498,26 @@ void CalendarView::init()
492 leftFrameLayout->addWidget(mFilterView); 498 leftFrameLayout->addWidget(mFilterView);
493 leftFrameLayout->addWidget(mTodoList, 2 ); 499 leftFrameLayout->addWidget(mTodoList, 2 );
494 500
495 } else { 501 } else {
496 leftFrameLayout->addWidget(mTodoList,2 ); 502 leftFrameLayout->addWidget(mTodoList,2 );
497 leftFrameLayout->addWidget(mFilterView ); 503 leftFrameLayout->addWidget(mFilterView );
498 } 504 }
499#endif 505#endif
500 mFilterView->hide(); 506 mFilterView->hide();
501 mCalEditView->hide(); 507 mCalEditView->hide();
502 QWidget *rightBox = new QWidget( mMainFrame ); 508 QWidget *rightBox = new QWidget( mMainFrame );
503 //mainBoxLayout->addWidget ( rightBox, 10 ); 509 //mainBoxLayout->addWidget ( rightBox, 10 );
504 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 510 Q3BoxLayout *rightLayout = new Q3VBoxLayout( rightBox );
505 mRightFrame = new QWidgetStack( rightBox ); 511 mRightFrame = new Q3WidgetStack( rightBox );
506 rightLayout->addWidget( mRightFrame, 10 ); 512 rightLayout->addWidget( mRightFrame, 10 );
507 513
508 //mLeftFrame = (QWidget *)leftFrame; 514 //mLeftFrame = (QWidget *)leftFrame;
509 if ( KOPrefs::instance()->mVerticalScreen ) { 515 if ( KOPrefs::instance()->mVerticalScreen ) {
510 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 516 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
511 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 517 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
512 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 518 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
513 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 519 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
514 } else { 520 } else {
515 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 521 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
516 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 522 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
517 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 523 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
@@ -607,27 +613,27 @@ void CalendarView::init()
607 613
608 614
609 615
610 616
611 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 617 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
612 SLOT(checkClipboard())); 618 SLOT(checkClipboard()));
613 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 619 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
614 SLOT( processTodoListSelection( Incidence * ) ) ); 620 SLOT( processTodoListSelection( Incidence * ) ) );
615 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 621 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
616 622
617 // kdDebug() << "CalendarView::CalendarView() done" << endl; 623 // kdDebug() << "CalendarView::CalendarView() done" << endl;
618 624
619 mDateFrame = new QVBox(0,0,WType_Popup); 625 mDateFrame = new Q3VBox(0,0,Qt::WType_Popup);
620 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 626 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
621 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 627 mDateFrame->setFrameStyle( Q3Frame::WinPanel |Q3Frame::Raised );
622 mDateFrame->setLineWidth(3); 628 mDateFrame->setLineWidth(3);
623 mDateFrame->hide(); 629 mDateFrame->hide();
624 mDateFrame->setCaption( i18n( "Pick a date to display")); 630 mDateFrame->setCaption( i18n( "Pick a date to display"));
625 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 631 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
626 632
627 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 633 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
628 634
629 mEventEditor = mDialogManager->getEventEditor(); 635 mEventEditor = mDialogManager->getEventEditor();
630 mTodoEditor = mDialogManager->getTodoEditor(); 636 mTodoEditor = mDialogManager->getTodoEditor();
631 637
632 mFlagEditDescription = false; 638 mFlagEditDescription = false;
633 639
@@ -660,41 +666,41 @@ CalendarView::~CalendarView()
660 delete mViewManager; 666 delete mViewManager;
661 delete mStorage; 667 delete mStorage;
662 delete mDateFrame ; 668 delete mDateFrame ;
663 delete mEventViewerDialog; 669 delete mEventViewerDialog;
664 //kdDebug() << "~CalendarView() done" << endl; 670 //kdDebug() << "~CalendarView() done" << endl;
665} 671}
666 672
667 673
668void CalendarView::nextConflict( bool all, bool allday ) 674void CalendarView::nextConflict( bool all, bool allday )
669{ 675{
670 if ( flag_blockConflict ) return; 676 if ( flag_blockConflict ) return;
671 flag_blockConflict = true; 677 flag_blockConflict = true;
672 QPtrList<Event> testlist = mCalendar->events(); 678 Q3PtrList<Event> testlist = mCalendar->events();
673 Event * test = testlist.first(); 679 Event * test = testlist.first();
674 while ( test ) { 680 while ( test ) {
675 test->setTagged( false ); 681 test->setTagged( false );
676 test = testlist.next(); 682 test = testlist.next();
677 } 683 }
678 QTime st ( 0,0,0); 684 QTime st ( 0,0,0);
679 if ( mViewManager->currentView() == mViewManager->agendaView() ) 685 if ( mViewManager->currentView() == mViewManager->agendaView() )
680 st = mViewManager->agendaView()->agenda()->getEndTime(); 686 st = mViewManager->agendaView()->agenda()->getEndTime();
681 //qDebug("time %s ", st.toString().latin1()); 687 //qDebug("time %s ", st.toString().latin1());
682 QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st); 688 QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st);
683 QDateTime conflict; 689 QDateTime conflict;
684 QDateTime retVal; 690 QDateTime retVal;
685 bool found = false; 691 bool found = false;
686 Event * cE = 0; 692 Event * cE = 0;
687 Event * cE2 = 0; 693 Event * cE2 = 0;
688 QPtrList<Event> testlist2 = testlist; 694 Q3PtrList<Event> testlist2 = testlist;
689 test = testlist.first(); 695 test = testlist.first();
690 bool skip = false; 696 bool skip = false;
691 topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); 697 topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") );
692 //QTime tm; 698 //QTime tm;
693 //tm.start(); 699 //tm.start();
694 while ( test ) { 700 while ( test ) {
695 qApp->processEvents(); 701 qApp->processEvents();
696 skip = false; 702 skip = false;
697 if ( !all ) skip = ( allday != test->doesFloat() ); 703 if ( !all ) skip = ( allday != test->doesFloat() );
698 if ( !skip ) { 704 if ( !skip ) {
699 if ( found ) 705 if ( found )
700 skip = !test->matchTime( &startDT, &conflict ); 706 skip = !test->matchTime( &startDT, &conflict );
@@ -826,78 +832,78 @@ void CalendarView::updateView(const QDate &start, const QDate &end)
826 } 832 }
827#endif 833#endif
828 mTodoList->updateView(); 834 mTodoList->updateView();
829 mViewManager->updateView(start, end); 835 mViewManager->updateView(start, end);
830 //mDateNavigator->updateView(); 836 //mDateNavigator->updateView();
831} 837}
832 838
833 839
834 840
835void CalendarView::checkFiles() 841void CalendarView::checkFiles()
836{ 842{
837 QString message; 843 QString message;
838 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 844 Q3PtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
839 KopiCalendarFile * cal = calendars.first(); 845 KopiCalendarFile * cal = calendars.first();
840 while ( cal ) { 846 while ( cal ) {
841 if ( cal->mErrorOnLoad ) { 847 if ( cal->mErrorOnLoad ) {
842 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; 848 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n";
843 } 849 }
844 cal = calendars.next(); 850 cal = calendars.next();
845 } 851 }
846 if ( !message.isEmpty() ) { 852 if ( !message.isEmpty() ) {
847 message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); 853 message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0);
848 KMessageBox::error(this,message, i18n("Loading of calendar(s) failed")); 854 KMessageBox::error(this,message, i18n("Loading of calendar(s) failed"));
849 } 855 }
850 if ( flag_checkFileFirsttime ) { 856 if ( flag_checkFileFirsttime ) {
851 flag_checkFileFirsttime = false; 857 flag_checkFileFirsttime = false;
852 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); 858 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() ));
853 } 859 }
854} 860}
855void CalendarView::checkAlarms() 861void CalendarView::checkAlarms()
856{ 862{
857 KConfig *config = KOGlobals::config(); 863 KConfig *config = KOGlobals::config();
858 config->setGroup( "AppRun" ); 864 config->setGroup( "AppRun" );
859 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 865 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
860 int daysto = dt.daysTo( QDate::currentDate() ); 866 int daysto = dt.daysTo( (QDateTime)QDate::currentDate() );
861 int days = config->readNumEntry( "LatestProgramStopDays" , daysto); 867 int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
862 dt = dt.addDays( days ); 868 dt = dt.addDays( days );
863 int secto = dt.secsTo( QDateTime::currentDateTime() ); 869 int secto = dt.secsTo( QDateTime::currentDateTime() );
864 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; 870 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
865 //qDebug("KO: Reading program stop %d ", secs); 871 //qDebug("KO: Reading program stop %d ", secs);
866 //secs -= ( 3600 * 24*3 ); // debug only 872 //secs -= ( 3600 * 24*3 ); // debug only
867 QDateTime latest = dt.addSecs ( secs ); 873 QDateTime latest = dt.addSecs ( secs );
868 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 874 qDebug("KO: Last termination on %s ", latest.toString().latin1());
869 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 875 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
870 QPtrList<Incidence> el = mCalendar->rawIncidences(); 876 Q3PtrList<Incidence> el = mCalendar->rawIncidences();
871 QPtrList<Incidence> al; 877 Q3PtrList<Incidence> al;
872 Incidence* inL = el.first(); 878 Incidence* inL = el.first();
873 QDateTime cur = QDateTime::currentDateTime().addSecs(-59); 879 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
874 qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); 880 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
875 while ( inL ) { 881 while ( inL ) {
876 bool ok = false; 882 bool ok = false;
877 int offset = 0; 883 int offset = 0;
878 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 884 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
879 if ( ok ) { 885 if ( ok ) {
880 //qDebug("OK %s",next.toString().latin1()); 886 //qDebug("OK %s",next.toString().latin1());
881 if ( next < cur ) { 887 if ( next < cur ) {
882 al.append( inL ); 888 al.append( inL );
883 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 889 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
884 } 890 }
885 } 891 }
886 inL = el.next(); 892 inL = el.next();
887 } 893 }
888 if ( al.count() ) { 894 if ( al.count() ) {
889 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 895 QDialog* dia = new QDialog( this, "huhu", false, Qt::WDestructiveClose | Qt::WStyle_StaysOnTop );
890 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 896 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
891 QVBoxLayout* lay = new QVBoxLayout( dia ); 897 Q3VBoxLayout* lay = new Q3VBoxLayout( dia );
892 lay->setSpacing( 0 ); 898 lay->setSpacing( 0 );
893 lay->setMargin( 0 ); 899 lay->setMargin( 0 );
894 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 900 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
895 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 901 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
896 lay->addWidget( matb ); 902 lay->addWidget( matb );
897 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 903 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
898 int wid = 210; 904 int wid = 210;
899 int x = QApplication::desktop()->width() - wid - 7; 905 int x = QApplication::desktop()->width() - wid - 7;
900 int y = QApplication::desktop()->height() - wid - 70; 906 int y = QApplication::desktop()->height() - wid - 70;
901 dia->setGeometry ( x,y,wid,wid); 907 dia->setGeometry ( x,y,wid,wid);
902 } else { 908 } else {
903 int si = 220; 909 int si = 220;
@@ -1207,25 +1213,25 @@ void CalendarView::computeAlarm( QString msg )
1207 if ( error ) { 1213 if ( error ) {
1208 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 1214 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
1209 mAlarmMessage += mess.mid( 10+len+3+9 ); 1215 mAlarmMessage += mess.mid( 10+len+3+9 );
1210 } else { 1216 } else {
1211 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 1217 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
1212 //qDebug("-----system command %s ",tempfilename.latin1() ); 1218 //qDebug("-----system command %s ",tempfilename.latin1() );
1213#ifndef _WIN32_ 1219#ifndef _WIN32_
1214 if ( vfork () == 0 ) { 1220 if ( vfork () == 0 ) {
1215 execl ( tempfilename.latin1(), 0 ); 1221 execl ( tempfilename.latin1(), 0 );
1216 return; 1222 return;
1217 } 1223 }
1218#else 1224#else
1219 QProcess* p = new QProcess(); 1225 Q3Process* p = new Q3Process();
1220 p->addArgument( tempfilename.latin1() ); 1226 p->addArgument( tempfilename.latin1() );
1221 p->start(); 1227 p->start();
1222 return; 1228 return;
1223#endif 1229#endif
1224 1230
1225 return; 1231 return;
1226 } 1232 }
1227 1233
1228 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 1234 //qDebug("+++++++system command %s ",tempfilename.latin1() );
1229 } 1235 }
1230 if ( mess.left( 11 ) == "audio_alarm") { 1236 if ( mess.left( 11 ) == "audio_alarm") {
1231 bool error = false; 1237 bool error = false;
@@ -1257,56 +1263,56 @@ void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
1257 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 1263 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
1258 1264
1259 mSuspendAlarmNotification = noti; 1265 mSuspendAlarmNotification = noti;
1260 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 1266 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
1261 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 1267 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
1262 mSuspendTimer->start( ms , true ); 1268 mSuspendTimer->start( ms , true );
1263#ifdef DESKTOP_VERSION 1269#ifdef DESKTOP_VERSION
1264 if ( QApplication::desktop()->width() < 1024 ) { 1270 if ( QApplication::desktop()->width() < 1024 ) {
1265 QString mess = qdt.toString( "yyyy-MM-dd hh:mm:ss" ) + "\n" + noti; 1271 QString mess = qdt.toString( "yyyy-MM-dd hh:mm:ss" ) + "\n" + noti;
1266 //qDebug("nextsuspendalarm = \n%s ",mess.latin1() ); 1272 //qDebug("nextsuspendalarm = \n%s ",mess.latin1() );
1267 QString fn = QDir::homeDirPath() + "/.kopi_suspend_alarm"; 1273 QString fn = QDir::homeDirPath() + "/.kopi_suspend_alarm";
1268 QFile file( fn ); 1274 QFile file( fn );
1269 if (!file.open( IO_WriteOnly ) ) { 1275 if (!file.open( QIODevice::WriteOnly ) ) {
1270 qDebug("KO: Error writing next suspend alarm file %s\nContent: \n%s ", fn.latin1(), mess.latin1()); 1276 qDebug("KO: Error writing next suspend alarm file %s\nContent: \n%s ", fn.latin1(), mess.latin1());
1271 } else { 1277 } else {
1272 QTextStream ts( &file ); 1278 Q3TextStream ts( &file );
1273 ts << mess; 1279 ts << mess;
1274 file.close(); 1280 file.close();
1275 } 1281 }
1276 } 1282 }
1277#endif 1283#endif
1278 1284
1279} 1285}
1280 1286
1281void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 1287void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
1282{ 1288{
1283 mNextAlarmDateTime = qdt; 1289 mNextAlarmDateTime = qdt;
1284 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 1290 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
1285 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 1291 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
1286#ifndef DESKTOP_VERSION 1292#ifndef DESKTOP_VERSION
1287 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); 1293 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() );
1288#endif 1294#endif
1289 return; 1295 return;
1290 } 1296 }
1291#ifdef DESKTOP_VERSION 1297#ifdef DESKTOP_VERSION
1292 if ( QApplication::desktop()->width() < 1024 ) { 1298 if ( QApplication::desktop()->width() < 1024 ) {
1293 QString mess = qdt.toString( "yyyy-MM-dd hh:mm:ss" ) + "\n" + noti; 1299 QString mess = qdt.toString( "yyyy-MM-dd hh:mm:ss" ) + "\n" + noti;
1294 //qDebug("nextalarm = \n%s ",mess.latin1() ); 1300 //qDebug("nextalarm = \n%s ",mess.latin1() );
1295 QString fn = QDir::homeDirPath() + "/.kopi_next_alarm"; 1301 QString fn = QDir::homeDirPath() + "/.kopi_next_alarm";
1296 QFile file( fn ); 1302 QFile file( fn );
1297 if (!file.open( IO_WriteOnly ) ) { 1303 if (!file.open( QIODevice::WriteOnly ) ) {
1298 qDebug("KO: Error writing next alarm file %s\nContent: \n%s ", fn.latin1(), mess.latin1()); 1304 qDebug("KO: Error writing next alarm file %s\nContent: \n%s ", fn.latin1(), mess.latin1());
1299 } else { 1305 } else {
1300 QTextStream ts( &file ); 1306 Q3TextStream ts( &file );
1301 ts << mess; 1307 ts << mess;
1302 file.close(); 1308 file.close();
1303 } 1309 }
1304 } 1310 }
1305#endif 1311#endif
1306 int maxSec; 1312 int maxSec;
1307 //maxSec = 5; //testing only 1313 //maxSec = 5; //testing only
1308 maxSec = 86400+3600; // one day+1hour 1314 maxSec = 86400+3600; // one day+1hour
1309 mAlarmNotification = noti; 1315 mAlarmNotification = noti;
1310 int sec = QDateTime::currentDateTime().secsTo( qdt ); 1316 int sec = QDateTime::currentDateTime().secsTo( qdt );
1311 if ( sec > maxSec ) { 1317 if ( sec > maxSec ) {
1312 mRecheckAlarmTimer->start( maxSec * 1000 ); 1318 mRecheckAlarmTimer->start( maxSec * 1000 );
@@ -1561,25 +1567,25 @@ Event* CalendarView::getLastSyncEvent()
1561 lse->setReadOnly( true ); 1567 lse->setReadOnly( true );
1562 lse->setCalID( 1 ); 1568 lse->setCalID( 1 );
1563 mCalendar->addEvent( lse ); 1569 mCalendar->addEvent( lse );
1564 } else 1570 } else
1565 qDebug("KO: Last Syncevent on local found"); 1571 qDebug("KO: Last Syncevent on local found");
1566 1572
1567 return lse; 1573 return lse;
1568 1574
1569} 1575}
1570 1576
1571// we check, if the to delete event has a id for a profile 1577// we check, if the to delete event has a id for a profile
1572// if yes, we set this id in the profile to delete 1578// if yes, we set this id in the profile to delete
1573void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 1579void CalendarView::checkExternSyncEvent( Q3PtrList<Event> lastSync , Incidence* toDelete )
1574{ 1580{
1575 if ( lastSync.count() == 0 ) { 1581 if ( lastSync.count() == 0 ) {
1576 //qDebug(" lastSync.count() == 0"); 1582 //qDebug(" lastSync.count() == 0");
1577 return; 1583 return;
1578 } 1584 }
1579 if ( toDelete->typeID() == journalID ) 1585 if ( toDelete->typeID() == journalID )
1580 return; 1586 return;
1581 1587
1582 Event* eve = lastSync.first(); 1588 Event* eve = lastSync.first();
1583 1589
1584 while ( eve ) { 1590 while ( eve ) {
1585 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 1591 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
@@ -1591,50 +1597,50 @@ void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* t
1591 des += pref+ id + ","; 1597 des += pref+ id + ",";
1592 eve->setReadOnly( false ); 1598 eve->setReadOnly( false );
1593 eve->setDescription( des ); 1599 eve->setDescription( des );
1594 //qDebug("setdes %s ", des.latin1()); 1600 //qDebug("setdes %s ", des.latin1());
1595 eve->setReadOnly( true ); 1601 eve->setReadOnly( true );
1596 } 1602 }
1597 eve = lastSync.next(); 1603 eve = lastSync.next();
1598 } 1604 }
1599 1605
1600} 1606}
1601void CalendarView::checkExternalId( Incidence * inc ) 1607void CalendarView::checkExternalId( Incidence * inc )
1602{ 1608{
1603 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 1609 Q3PtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
1604 checkExternSyncEvent( lastSync, inc ); 1610 checkExternSyncEvent( lastSync, inc );
1605 1611
1606} 1612}
1607// SSSSSSSSSSSSSSSSSSSSSS 1613// SSSSSSSSSSSSSSSSSSSSSS
1608bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 1614bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
1609{ 1615{
1610 1616
1611 bool syncOK = true; 1617 bool syncOK = true;
1612 int addedEvent = 0; 1618 int addedEvent = 0;
1613 int addedEventR = 0; 1619 int addedEventR = 0;
1614 int deletedEventR = 0; 1620 int deletedEventR = 0;
1615 int deletedEventL = 0; 1621 int deletedEventL = 0;
1616 int changedLocal = 0; 1622 int changedLocal = 0;
1617 int changedRemote = 0; 1623 int changedRemote = 0;
1618 int filteredIN = 0; 1624 int filteredIN = 0;
1619 int filteredOUT = 0; 1625 int filteredOUT = 0;
1620 //QPtrList<Event> el = local->rawEvents(); 1626 //QPtrList<Event> el = local->rawEvents();
1621 Event* eventR; 1627 Event* eventR;
1622 QString uid; 1628 QString uid;
1623 int take; 1629 int take;
1624 Event* eventRSync; 1630 Event* eventRSync;
1625 Event* eventLSync; 1631 Event* eventLSync;
1626 clearAllViews(); 1632 clearAllViews();
1627 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 1633 Q3PtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
1628 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 1634 Q3PtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
1629 bool fullDateRange = false; 1635 bool fullDateRange = false;
1630 local->resetTempSyncStat(); 1636 local->resetTempSyncStat();
1631 mLastCalendarSync = QDateTime::currentDateTime(); 1637 mLastCalendarSync = QDateTime::currentDateTime();
1632 if ( mSyncManager->syncWithDesktop() ) { 1638 if ( mSyncManager->syncWithDesktop() ) {
1633 remote->resetPilotStat(1); 1639 remote->resetPilotStat(1);
1634 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 1640 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
1635 mLastCalendarSync = KSyncManager::mRequestedSyncEvent; 1641 mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
1636 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); 1642 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
1637 } else { 1643 } else {
1638 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 1644 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
1639 } 1645 }
1640 } 1646 }
@@ -1675,28 +1681,28 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1675 } 1681 }
1676 if ( fullDateRange ) 1682 if ( fullDateRange )
1677 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 1683 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
1678 else 1684 else
1679 mLastCalendarSync = eventLSync->dtStart(); 1685 mLastCalendarSync = eventLSync->dtStart();
1680 // for resyncing if own file has changed 1686 // for resyncing if own file has changed
1681 if ( mCurrentSyncDevice == "deleteaftersync" ) { 1687 if ( mCurrentSyncDevice == "deleteaftersync" ) {
1682 mLastCalendarSync = loadedFileVersion; 1688 mLastCalendarSync = loadedFileVersion;
1683 //qDebug("setting mLastCalendarSync "); 1689 //qDebug("setting mLastCalendarSync ");
1684 } 1690 }
1685 //qDebug("*************************** "); 1691 //qDebug("*************************** ");
1686 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); 1692 qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
1687 QPtrList<Incidence> er = remote->rawIncidences(); 1693 Q3PtrList<Incidence> er = remote->rawIncidences();
1688 Incidence* inR = er.first(); 1694 Incidence* inR = er.first();
1689 Incidence* inL; 1695 Incidence* inL;
1690 QProgressBar bar( er.count(),0 ); 1696 Q3ProgressBar bar( er.count(),0 );
1691 bar.setCaption (i18n("Syncing - close to abort!") ); 1697 bar.setCaption (i18n("Syncing - close to abort!") );
1692 1698
1693 // ************** setting up filter ************* 1699 // ************** setting up filter *************
1694 CalFilter *filterIN = 0; 1700 CalFilter *filterIN = 0;
1695 CalFilter *filterOUT = 0; 1701 CalFilter *filterOUT = 0;
1696 CalFilter *filter = mFilters.first(); 1702 CalFilter *filter = mFilters.first();
1697 while(filter) { 1703 while(filter) {
1698 if ( filter->name() == mSyncManager->mFilterInCal ) 1704 if ( filter->name() == mSyncManager->mFilterInCal )
1699 filterIN = filter; 1705 filterIN = filter;
1700 if ( filter->name() == mSyncManager->mFilterOutCal ) 1706 if ( filter->name() == mSyncManager->mFilterOutCal )
1701 filterOUT = filter; 1707 filterOUT = filter;
1702 filter = mFilters.next(); 1708 filter = mFilters.next();
@@ -1822,25 +1828,25 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1822 checkExternSyncEvent(eventRSyncSharp, inR); 1828 checkExternSyncEvent(eventRSyncSharp, inR);
1823 remote->deleteIncidence( inR ); 1829 remote->deleteIncidence( inR );
1824 ++deletedEventR; 1830 ++deletedEventR;
1825 } 1831 }
1826 } 1832 }
1827 } else { 1833 } else {
1828 ++filteredIN; 1834 ++filteredIN;
1829 } 1835 }
1830 } 1836 }
1831 } 1837 }
1832 inR = er.next(); 1838 inR = er.next();
1833 } 1839 }
1834 QPtrList<Incidence> el = local->rawIncidences(); 1840 Q3PtrList<Incidence> el = local->rawIncidences();
1835 inL = el.first(); 1841 inL = el.first();
1836 modulo = (el.count()/10)+1; 1842 modulo = (el.count()/10)+1;
1837 bar.setCaption (i18n("Add / remove events") ); 1843 bar.setCaption (i18n("Add / remove events") );
1838 bar.setTotalSteps ( el.count() ) ; 1844 bar.setTotalSteps ( el.count() ) ;
1839 bar.show(); 1845 bar.show();
1840 incCounter = 0; 1846 incCounter = 0;
1841 1847
1842 while ( inL ) { 1848 while ( inL ) {
1843 1849
1844 qApp->processEvents(); 1850 qApp->processEvents();
1845 if ( ! bar.isVisible() ) 1851 if ( ! bar.isVisible() )
1846 return false; 1852 return false;
@@ -2039,25 +2045,25 @@ void CalendarView::syncExternal( int mode )
2039 } else { 2045 } else {
2040 emit tempDisableBR(false); 2046 emit tempDisableBR(false);
2041 return; 2047 return;
2042 } 2048 }
2043 if ( loadSuccess ) { 2049 if ( loadSuccess ) {
2044 getEventViewerDialog()->setSyncMode( true ); 2050 getEventViewerDialog()->setSyncMode( true );
2045 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 2051 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
2046 getEventViewerDialog()->setSyncMode( false ); 2052 getEventViewerDialog()->setSyncMode( false );
2047 qApp->processEvents(); 2053 qApp->processEvents();
2048 if ( syncOK ) { 2054 if ( syncOK ) {
2049 if ( mSyncManager->mWriteBackFile ) 2055 if ( mSyncManager->mWriteBackFile )
2050 { 2056 {
2051 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 2057 Q3PtrList<Incidence> iL = mCalendar->rawIncidences();
2052 Incidence* inc = iL.first(); 2058 Incidence* inc = iL.first();
2053 if ( phoneFormat ) { 2059 if ( phoneFormat ) {
2054 while ( inc ) { 2060 while ( inc ) {
2055 inc->removeID(mCurrentSyncDevice); 2061 inc->removeID(mCurrentSyncDevice);
2056 inc = iL.next(); 2062 inc = iL.next();
2057 } 2063 }
2058 } 2064 }
2059#ifndef DESKTOP_VERSION 2065#ifndef DESKTOP_VERSION
2060 if ( sharpFormat ) 2066 if ( sharpFormat )
2061 sharpFormat->save(calendar); 2067 sharpFormat->save(calendar);
2062#endif 2068#endif
2063 if ( phoneFormat ) 2069 if ( phoneFormat )
@@ -2106,25 +2112,25 @@ bool CalendarView::importBday()
2106#ifdef DESKTOP_VERSION 2112#ifdef DESKTOP_VERSION
2107 int curCal = mCalendar->defaultCalendar(); 2113 int curCal = mCalendar->defaultCalendar();
2108 int bd = mCalEditView->getBirtdayID(); 2114 int bd = mCalEditView->getBirtdayID();
2109 if ( bd == 0 ) 2115 if ( bd == 0 )
2110 return false; 2116 return false;
2111 mCalendar->setDefaultCalendar( bd ); 2117 mCalendar->setDefaultCalendar( bd );
2112 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 2118 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
2113 KABC::AddressBook::Iterator it; 2119 KABC::AddressBook::Iterator it;
2114 int count = 0; 2120 int count = 0;
2115 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 2121 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
2116 ++count; 2122 ++count;
2117 } 2123 }
2118 QProgressBar bar(count,0 ); 2124 Q3ProgressBar bar(count,0 );
2119 int w = 300; 2125 int w = 300;
2120 if ( QApplication::desktop()->width() < 320 ) 2126 if ( QApplication::desktop()->width() < 320 )
2121 w = 220; 2127 w = 220;
2122 int h = bar.sizeHint().height() ; 2128 int h = bar.sizeHint().height() ;
2123 int dw = QApplication::desktop()->width(); 2129 int dw = QApplication::desktop()->width();
2124 int dh = QApplication::desktop()->height(); 2130 int dh = QApplication::desktop()->height();
2125 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2131 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2126 bar.show(); 2132 bar.show();
2127 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 2133 bar.setCaption (i18n("Reading addressbook - close to abort!") );
2128 qApp->processEvents(); 2134 qApp->processEvents();
2129 count = 0; 2135 count = 0;
2130 int addCount = 0; 2136 int addCount = 0;
@@ -2177,25 +2183,25 @@ void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthd
2177 int bd = mCalEditView->getBirtdayID(); 2183 int bd = mCalEditView->getBirtdayID();
2178 if ( bd == 0 ) 2184 if ( bd == 0 )
2179 return; 2185 return;
2180 mCalendar->setDefaultCalendar( bd ); 2186 mCalendar->setDefaultCalendar( bd );
2181 2187
2182 2188
2183 int count = birthdayList.count(); 2189 int count = birthdayList.count();
2184 int addCount = 0; 2190 int addCount = 0;
2185 KCal::Attendee* a = 0; 2191 KCal::Attendee* a = 0;
2186 2192
2187 //qDebug("CalView 1 %i", count); 2193 //qDebug("CalView 1 %i", count);
2188 2194
2189 QProgressBar bar(count,0 ); 2195 Q3ProgressBar bar(count,0 );
2190 int w = 300; 2196 int w = 300;
2191 if ( QApplication::desktop()->width() < 320 ) 2197 if ( QApplication::desktop()->width() < 320 )
2192 w = 220; 2198 w = 220;
2193 int h = bar.sizeHint().height() ; 2199 int h = bar.sizeHint().height() ;
2194 int dw = QApplication::desktop()->width(); 2200 int dw = QApplication::desktop()->width();
2195 int dh = QApplication::desktop()->height(); 2201 int dh = QApplication::desktop()->height();
2196 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2202 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2197 bar.show(); 2203 bar.show();
2198 bar.setCaption (i18n("inserting birthdays - close to abort!") ); 2204 bar.setCaption (i18n("inserting birthdays - close to abort!") );
2199 qApp->processEvents(); 2205 qApp->processEvents();
2200 2206
2201 QDate birthday; 2207 QDate birthday;
@@ -2341,39 +2347,39 @@ bool CalendarView::importQtopia( const QString &categories,
2341 2347
2342#endif 2348#endif
2343 2349
2344} 2350}
2345 2351
2346void CalendarView::setSyncEventsReadOnly() 2352void CalendarView::setSyncEventsReadOnly()
2347{ 2353{
2348 mCalendar->setSyncEventsReadOnly(); 2354 mCalendar->setSyncEventsReadOnly();
2349} 2355}
2350 2356
2351bool CalendarView::loadCalendars() 2357bool CalendarView::loadCalendars()
2352{ 2358{
2353 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 2359 Q3PtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
2354 KopiCalendarFile * cal = calendars.first(); 2360 KopiCalendarFile * cal = calendars.first();
2355 mCalendar->setDefaultCalendar( 1 ); 2361 mCalendar->setDefaultCalendar( 1 );
2356 openCalendar( MainWindow::defaultFileName(), false ); 2362 openCalendar( MainWindow::defaultFileName(), false );
2357 cal = calendars.next(); 2363 cal = calendars.next();
2358 while ( cal ) { 2364 while ( cal ) {
2359 addCalendar( cal ); 2365 addCalendar( cal );
2360 cal = calendars.next(); 2366 cal = calendars.next();
2361 } 2367 }
2362 restoreCalendarSettings(); 2368 restoreCalendarSettings();
2363 return true; 2369 return true;
2364} 2370}
2365bool CalendarView::restoreCalendarSettings() 2371bool CalendarView::restoreCalendarSettings()
2366{ 2372{
2367 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 2373 Q3PtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
2368 KopiCalendarFile * cal = calendars.first(); 2374 KopiCalendarFile * cal = calendars.first();
2369 while ( cal ) { 2375 while ( cal ) {
2370 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); 2376 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled );
2371 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); 2377 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled );
2372 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); 2378 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly );
2373 if ( cal->isStandard ) 2379 if ( cal->isStandard )
2374 mCalendar->setDefaultCalendar( cal->mCalNumber ); 2380 mCalendar->setDefaultCalendar( cal->mCalNumber );
2375 cal = calendars.next(); 2381 cal = calendars.next();
2376 } 2382 }
2377 setSyncEventsReadOnly(); 2383 setSyncEventsReadOnly();
2378 mCalendar->reInitAlarmSettings(); 2384 mCalendar->reInitAlarmSettings();
2379 updateUnmanagedViews(); 2385 updateUnmanagedViews();
@@ -2520,25 +2526,25 @@ void CalendarView::watchSavedFile()
2520 if ( !finf.exists() ) 2526 if ( !finf.exists() )
2521 return; 2527 return;
2522 QDateTime dt = finf.lastModified (); 2528 QDateTime dt = finf.lastModified ();
2523 if ( dt < loadedFileVersion ) { 2529 if ( dt < loadedFileVersion ) {
2524 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); 2530 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1());
2525 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); 2531 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
2526 return; 2532 return;
2527 } 2533 }
2528 loadedFileVersion = dt; 2534 loadedFileVersion = dt;
2529} 2535}
2530bool CalendarView::checkAllFileVersions() 2536bool CalendarView::checkAllFileVersions()
2531{ 2537{
2532 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 2538 Q3PtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
2533 KopiCalendarFile * cal = calendars.first(); 2539 KopiCalendarFile * cal = calendars.first();
2534 mCalendar->setDefaultCalendar( 1 ); 2540 mCalendar->setDefaultCalendar( 1 );
2535 mCalendar->setDefaultCalendarEnabledOnly(); 2541 mCalendar->setDefaultCalendarEnabledOnly();
2536 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { 2542 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
2537 if ( !checkFileVersion(MainWindow::defaultFileName())) { 2543 if ( !checkFileVersion(MainWindow::defaultFileName())) {
2538 restoreCalendarSettings(); 2544 restoreCalendarSettings();
2539 return false; 2545 return false;
2540 } 2546 }
2541 } 2547 }
2542 cal = calendars.next(); 2548 cal = calendars.next();
2543 QDateTime storeTemp = loadedFileVersion; 2549 QDateTime storeTemp = loadedFileVersion;
2544 while ( cal ) { 2550 while ( cal ) {
@@ -2582,25 +2588,25 @@ bool CalendarView::checkFileVersion(QString fn)
2582 mSyncManager->mWriteBackFile = false; 2588 mSyncManager->mWriteBackFile = false;
2583 mSyncManager->mWriteBackExistingOnly = false; 2589 mSyncManager->mWriteBackExistingOnly = false;
2584 mSyncManager->mShowSyncSummary = false; 2590 mSyncManager->mShowSyncSummary = false;
2585 mMultiResourceSync = false; 2591 mMultiResourceSync = false;
2586 syncCalendar( fn, 3 ); 2592 syncCalendar( fn, 3 );
2587 Event * e = getLastSyncEvent(); 2593 Event * e = getLastSyncEvent();
2588 if ( e ) 2594 if ( e )
2589 mCalendar->deleteEvent( e ); 2595 mCalendar->deleteEvent( e );
2590 return true; 2596 return true;
2591} 2597}
2592bool CalendarView::saveCalendars() 2598bool CalendarView::saveCalendars()
2593{ 2599{
2594 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 2600 Q3PtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
2595 KopiCalendarFile * cal = calendars.first(); 2601 KopiCalendarFile * cal = calendars.first();
2596 mCalendar->setDefaultCalendar( 1 ); 2602 mCalendar->setDefaultCalendar( 1 );
2597 mCalendar->setDefaultCalendarEnabledOnly(); 2603 mCalendar->setDefaultCalendarEnabledOnly();
2598 QString saveError; 2604 QString saveError;
2599 if ( !saveCalendar( MainWindow::defaultFileName() ) ) 2605 if ( !saveCalendar( MainWindow::defaultFileName() ) )
2600 saveError = cal->mName +"\n"; 2606 saveError = cal->mName +"\n";
2601 cal = calendars.next(); 2607 cal = calendars.next();
2602 while ( cal ) { 2608 while ( cal ) {
2603 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { 2609 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
2604 mCalendar->setDefaultCalendar( cal->mCalNumber ); 2610 mCalendar->setDefaultCalendar( cal->mCalNumber );
2605 mCalendar->setDefaultCalendarEnabledOnly(); 2611 mCalendar->setDefaultCalendarEnabledOnly();
2606 if ( saveCalendar( cal->mFileName ) ) 2612 if ( saveCalendar( cal->mFileName ) )
@@ -2686,25 +2692,25 @@ void CalendarView::readSettings()
2686{ 2692{
2687 2693
2688 2694
2689 // mViewManager->showAgendaView(); 2695 // mViewManager->showAgendaView();
2690 QString str; 2696 QString str;
2691 //qDebug("CalendarView::readSettings() "); 2697 //qDebug("CalendarView::readSettings() ");
2692 // read settings from the KConfig, supplying reasonable 2698 // read settings from the KConfig, supplying reasonable
2693 // defaults where none are to be found 2699 // defaults where none are to be found
2694 KConfig *config = KOGlobals::config(); 2700 KConfig *config = KOGlobals::config();
2695#ifndef KORG_NOSPLITTER 2701#ifndef KORG_NOSPLITTER
2696 config->setGroup("KOrganizer Geometry"); 2702 config->setGroup("KOrganizer Geometry");
2697 2703
2698 QValueList<int> sizes = config->readIntListEntry("Separator1"); 2704 Q3ValueList<int> sizes = config->readIntListEntry("Separator1");
2699 if (sizes.count() != 2) { 2705 if (sizes.count() != 2) {
2700 sizes << mDateNavigator->minimumSizeHint().width(); 2706 sizes << mDateNavigator->minimumSizeHint().width();
2701 sizes << 300; 2707 sizes << 300;
2702 } 2708 }
2703 mPanner->setSizes(sizes); 2709 mPanner->setSizes(sizes);
2704 2710
2705 sizes = config->readIntListEntry("Separator2"); 2711 sizes = config->readIntListEntry("Separator2");
2706 if ( ( mResourceView && sizes.count() == 4 ) || 2712 if ( ( mResourceView && sizes.count() == 4 ) ||
2707 ( !mResourceView && sizes.count() == 3 ) ) { 2713 ( !mResourceView && sizes.count() == 3 ) ) {
2708 mLeftSplitter->setSizes(sizes); 2714 mLeftSplitter->setSizes(sizes);
2709 } 2715 }
2710#endif 2716#endif
@@ -2754,25 +2760,25 @@ void CalendarView::readSettings()
2754 if ( ! list.isEmpty() ) { 2760 if ( ! list.isEmpty() ) {
2755 x = list[0].toInt(); 2761 x = list[0].toInt();
2756 y = list[1].toInt(); 2762 y = list[1].toInt();
2757 w = list[2].toInt(); 2763 w = list[2].toInt();
2758 h = list[3].toInt(); 2764 h = list[3].toInt();
2759 KApplication::testCoords( &x,&y,&w,&h ); 2765 KApplication::testCoords( &x,&y,&w,&h );
2760 getEventViewerDialog()->setGeometry(x,y,w,h); 2766 getEventViewerDialog()->setGeometry(x,y,w,h);
2761 } 2767 }
2762#endif 2768#endif
2763 config->setGroup( "Views" ); 2769 config->setGroup( "Views" );
2764 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 2770 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
2765 2771
2766 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); 2772 Q3ValueList<int> sizes = config->readIntListEntry("Left Splitter Frame");
2767 2773
2768 int resetval = 0; 2774 int resetval = 0;
2769 int maxVal = 0; 2775 int maxVal = 0;
2770 if (sizes.count() != 3) { 2776 if (sizes.count() != 3) {
2771 if ( KOPrefs::instance()->mVerticalScreen ) { 2777 if ( KOPrefs::instance()->mVerticalScreen ) {
2772 resetval = mDateNavigator->sizeHint().width()+2; 2778 resetval = mDateNavigator->sizeHint().width()+2;
2773 } else { 2779 } else {
2774 resetval = mDateNavigator->sizeHint().height()+2; 2780 resetval = mDateNavigator->sizeHint().height()+2;
2775 } 2781 }
2776 } 2782 }
2777 if ( resetval ) { 2783 if ( resetval ) {
2778 sizes.clear(); 2784 sizes.clear();
@@ -2833,25 +2839,25 @@ void CalendarView::writeSettings()
2833 2839
2834 KConfig *config = KOGlobals::config(); 2840 KConfig *config = KOGlobals::config();
2835 2841
2836 mViewManager->writeSettings( config ); 2842 mViewManager->writeSettings( config );
2837 mTodoList->saveLayout(config,QString("Todo Layout")); 2843 mTodoList->saveLayout(config,QString("Todo Layout"));
2838 mDialogManager->writeSettings( config ); 2844 mDialogManager->writeSettings( config );
2839 //KOPrefs::instance()->usrWriteConfig(); 2845 //KOPrefs::instance()->usrWriteConfig();
2840 KOPrefs::instance()->writeConfig(); 2846 KOPrefs::instance()->writeConfig();
2841 2847
2842 writeFilterSettings(config); 2848 writeFilterSettings(config);
2843 config->setGroup( "AppRun" ); 2849 config->setGroup( "AppRun" );
2844 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 2850 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
2845 int days = dt.daysTo( QDate::currentDate() ); 2851 int days = dt.daysTo( (QDateTime)QDate::currentDate() );
2846 dt = dt.addDays( days ); 2852 dt = dt.addDays( days );
2847 int secs = dt.secsTo( QDateTime::currentDateTime() ); 2853 int secs = dt.secsTo( QDateTime::currentDateTime() );
2848 config->writeEntry( "LatestProgramStopDays", days ); 2854 config->writeEntry( "LatestProgramStopDays", days );
2849 config->writeEntry( "LatestProgramStopSecs", secs ); 2855 config->writeEntry( "LatestProgramStopSecs", secs );
2850 //qDebug("KO: Writing stop time: %d ", secs); 2856 //qDebug("KO: Writing stop time: %d ", secs);
2851 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 2857 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
2852 //QDateTime latest = dt.addSecs ( secs ); 2858 //QDateTime latest = dt.addSecs ( secs );
2853 //qDebug("KO: Termination on %s ", latest.toString().latin1()); 2859 //qDebug("KO: Termination on %s ", latest.toString().latin1());
2854 config->setGroup( "Views" ); 2860 config->setGroup( "Views" );
2855 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 2861 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
2856 2862
2857#if 0 2863#if 0
@@ -2860,27 +2866,27 @@ void CalendarView::writeSettings()
2860 QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); 2866 QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) );
2861 QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); 2867 QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) );
2862 int secsto = dt_nodaylight.secsTo( dt_daylight ); 2868 int secsto = dt_nodaylight.secsTo( dt_daylight );
2863 QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); 2869 QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto );
2864 qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); 2870 qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() );
2865 qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); 2871 qDebug("dt daylight %s ",dt_daylight.toString().latin1() );
2866 qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); 2872 qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() );
2867 qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); 2873 qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600);
2868 qDebug("********************* testcode end"); 2874 qDebug("********************* testcode end");
2869 2875
2870#endif 2876#endif
2871 2877
2872 QValueList<int> listINT = mLeftFrame->sizes(); 2878 Q3ValueList<int> listINT = mLeftFrame->sizes();
2873 config->writeEntry("Left Splitter Frame",listINT); 2879 config->writeEntry("Left Splitter Frame",listINT);
2874 QValueList<int> listINT2 = mMainFrame->sizes(); 2880 Q3ValueList<int> listINT2 = mMainFrame->sizes();
2875 config->writeEntry("Main Splitter Frame",listINT2); 2881 config->writeEntry("Main Splitter Frame",listINT2);
2876#ifdef DESKTOP_VERSION 2882#ifdef DESKTOP_VERSION
2877 config->setGroup("WidgetLayout"); 2883 config->setGroup("WidgetLayout");
2878 QStringList list ;//= config->readListEntry("MainLayout"); 2884 QStringList list ;//= config->readListEntry("MainLayout");
2879 int x,y,w,h; 2885 int x,y,w,h;
2880 QWidget* wid; 2886 QWidget* wid;
2881 wid = topLevelWidget(); 2887 wid = topLevelWidget();
2882 x = wid->geometry().x(); 2888 x = wid->geometry().x();
2883 y = wid->geometry().y(); 2889 y = wid->geometry().y();
2884 w = wid->width(); 2890 w = wid->width();
2885 h = wid->height(); 2891 h = wid->height();
2886 list.clear(); 2892 list.clear();
@@ -3157,25 +3163,25 @@ void CalendarView::checkConflictForEvent()
3157 while(filter) { 3163 while(filter) {
3158 if ( filter->name() == KOPrefs::instance()->mFilterConflictEditItem) 3164 if ( filter->name() == KOPrefs::instance()->mFilterConflictEditItem)
3159 filterIN = filter; 3165 filterIN = filter;
3160 if ( filter->name() == KOPrefs::instance()->mFilterConflictAllItem ) 3166 if ( filter->name() == KOPrefs::instance()->mFilterConflictAllItem )
3161 filterALL = filter; 3167 filterALL = filter;
3162 filter = mFilters.next(); 3168 filter = mFilters.next();
3163 } 3169 }
3164 if ( filterIN ) { 3170 if ( filterIN ) {
3165 if ( !filterIN->filterCalendarItem( conflictingEvent ) ) { 3171 if ( !filterIN->filterCalendarItem( conflictingEvent ) ) {
3166 return; 3172 return;
3167 } 3173 }
3168 } 3174 }
3169 QPtrList<Event> testlist = mCalendar->events(); 3175 Q3PtrList<Event> testlist = mCalendar->events();
3170 Event * test = testlist.first(); 3176 Event * test = testlist.first();
3171 QDateTime conflict; 3177 QDateTime conflict;
3172 QDateTime retVal; 3178 QDateTime retVal;
3173 bool found = false; 3179 bool found = false;
3174 Event * cE = 0; 3180 Event * cE = 0;
3175 bool chAD = KOPrefs::instance()->mCheckConflictsAllDayAllDay; 3181 bool chAD = KOPrefs::instance()->mCheckConflictsAllDayAllDay;
3176 bool chNad = KOPrefs::instance()->mCheckConflictsAllDayNonAD; 3182 bool chNad = KOPrefs::instance()->mCheckConflictsAllDayNonAD;
3177 if ( !conflictingEvent->doesFloat() ) { 3183 if ( !conflictingEvent->doesFloat() ) {
3178 chAD = KOPrefs::instance()->mCheckConflictsNonADAllDay; 3184 chAD = KOPrefs::instance()->mCheckConflictsNonADAllDay;
3179 chNad = KOPrefs::instance()->mCheckConflictsNonADNonAD; 3185 chNad = KOPrefs::instance()->mCheckConflictsNonADNonAD;
3180 } 3186 }
3181 topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); 3187 topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") );
@@ -3419,46 +3425,46 @@ void CalendarView::slotSelectPickerDate( QDate d)
3419 } else if ( mMoveIncidence->typeID() == journalID ) { 3425 } else if ( mMoveIncidence->typeID() == journalID ) {
3420 QTime tim = mMoveIncidence->dtStart().time(); 3426 QTime tim = mMoveIncidence->dtStart().time();
3421 QDateTime dt ( d,tim ); 3427 QDateTime dt ( d,tim );
3422 mMoveIncidence->setDtStart( dt ); 3428 mMoveIncidence->setDtStart( dt );
3423 updateView(); 3429 updateView();
3424 } 3430 }
3425 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 3431 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
3426 } 3432 }
3427} 3433}
3428 3434
3429void CalendarView::removeCategories() 3435void CalendarView::removeCategories()
3430{ 3436{
3431 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 3437 Q3PtrList<Incidence> incList = mCalendar->rawIncidences();
3432 QStringList catList = KOPrefs::instance()->mCustomCategories; 3438 QStringList catList = KOPrefs::instance()->mCustomCategories;
3433 QStringList catIncList; 3439 QStringList catIncList;
3434 QStringList newCatList; 3440 QStringList newCatList;
3435 Incidence* inc = incList.first(); 3441 Incidence* inc = incList.first();
3436 uint i; 3442 uint i;
3437 while ( inc ) { 3443 while ( inc ) {
3438 newCatList.clear(); 3444 newCatList.clear();
3439 catIncList = inc->categories() ; 3445 catIncList = inc->categories() ;
3440 for( i = 0; i< catIncList.count(); ++i ) { 3446 for( i = 0; i< catIncList.count(); ++i ) {
3441 if ( catList.contains (catIncList[i])) 3447 if ( catList.contains (catIncList[i]))
3442 newCatList.append( catIncList[i] ); 3448 newCatList.append( catIncList[i] );
3443 } 3449 }
3444 newCatList.sort(); 3450 newCatList.sort();
3445 inc->setCategories( newCatList.join(",") ); 3451 inc->setCategories( newCatList.join(",") );
3446 inc = incList.next(); 3452 inc = incList.next();
3447 } 3453 }
3448} 3454}
3449 3455
3450int CalendarView::addCategories() 3456int CalendarView::addCategories()
3451{ 3457{
3452 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 3458 Q3PtrList<Incidence> incList = mCalendar->rawIncidences();
3453 QStringList catList = KOPrefs::instance()->mCustomCategories; 3459 QStringList catList = KOPrefs::instance()->mCustomCategories;
3454 QStringList catIncList; 3460 QStringList catIncList;
3455 Incidence* inc = incList.first(); 3461 Incidence* inc = incList.first();
3456 uint i; 3462 uint i;
3457 int count = 0; 3463 int count = 0;
3458 while ( inc ) { 3464 while ( inc ) {
3459 catIncList = inc->categories() ; 3465 catIncList = inc->categories() ;
3460 for( i = 0; i< catIncList.count(); ++i ) { 3466 for( i = 0; i< catIncList.count(); ++i ) {
3461 if ( !catList.contains (catIncList[i])) { 3467 if ( !catList.contains (catIncList[i])) {
3462 catList.append( catIncList[i] ); 3468 catList.append( catIncList[i] );
3463 //qDebug("add cat %s ", catIncList[i].latin1()); 3469 //qDebug("add cat %s ", catIncList[i].latin1());
3464 ++count; 3470 ++count;
@@ -3498,41 +3504,41 @@ void CalendarView::manageCategories()
3498 writeSettings(); 3504 writeSettings();
3499 } else 3505 } else
3500 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 3506 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
3501 } else { 3507 } else {
3502 removeCategories(); 3508 removeCategories();
3503 updateView(); 3509 updateView();
3504 } 3510 }
3505 delete cp; 3511 delete cp;
3506} 3512}
3507 3513
3508void CalendarView::beamIncidence(Incidence * Inc) 3514void CalendarView::beamIncidence(Incidence * Inc)
3509{ 3515{
3510 QPtrList<Incidence> delSel ; 3516 Q3PtrList<Incidence> delSel ;
3511 delSel.append(Inc); 3517 delSel.append(Inc);
3512 beamIncidenceList( delSel ); 3518 beamIncidenceList( delSel );
3513} 3519}
3514void CalendarView::beamCalendar() 3520void CalendarView::beamCalendar()
3515{ 3521{
3516 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 3522 Q3PtrList<Incidence> delSel = mCalendar->rawIncidences();
3517 //qDebug("beamCalendar() "); 3523 //qDebug("beamCalendar() ");
3518 beamIncidenceList( delSel ); 3524 beamIncidenceList( delSel );
3519} 3525}
3520void CalendarView::beamFilteredCalendar() 3526void CalendarView::beamFilteredCalendar()
3521{ 3527{
3522 QPtrList<Incidence> delSel = mCalendar->incidences(); 3528 Q3PtrList<Incidence> delSel = mCalendar->incidences();
3523 //qDebug("beamFilteredCalendar() "); 3529 //qDebug("beamFilteredCalendar() ");
3524 beamIncidenceList( delSel ); 3530 beamIncidenceList( delSel );
3525} 3531}
3526void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 3532void CalendarView::beamIncidenceList(Q3PtrList<Incidence> delSel )
3527{ 3533{
3528 3534
3529 KOBeamPrefs beamDialog; 3535 KOBeamPrefs beamDialog;
3530 if ( beamDialog.exec () == QDialog::Rejected ) 3536 if ( beamDialog.exec () == QDialog::Rejected )
3531 return; 3537 return;
3532#ifdef DESKTOP_VERSION 3538#ifdef DESKTOP_VERSION
3533 QString fn = locateLocal( "tmp", "kopibeamfile" ); 3539 QString fn = locateLocal( "tmp", "kopibeamfile" );
3534#else 3540#else
3535 QString fn = "/tmp/kopibeamfile"; 3541 QString fn = "/tmp/kopibeamfile";
3536#endif 3542#endif
3537 QString mes; 3543 QString mes;
3538 bool createbup = true; 3544 bool createbup = true;
@@ -4306,25 +4312,25 @@ void CalendarView::schedule_publish(Incidence *incidence)
4306 if ( incidence && incidence->typeID() == todoID ) { 4312 if ( incidence && incidence->typeID() == todoID ) {
4307 todo = static_cast<Todo *>(incidence); 4313 todo = static_cast<Todo *>(incidence);
4308 } 4314 }
4309 } 4315 }
4310 4316
4311 if (!event && !todo) { 4317 if (!event && !todo) {
4312 KMessageBox::sorry(this,i18n("No event selected.")); 4318 KMessageBox::sorry(this,i18n("No event selected."));
4313 return; 4319 return;
4314 } 4320 }
4315 4321
4316 PublishDialog *publishdlg = new PublishDialog(); 4322 PublishDialog *publishdlg = new PublishDialog();
4317 if (incidence->attendeeCount()>0) { 4323 if (incidence->attendeeCount()>0) {
4318 QPtrList<Attendee> attendees = incidence->attendees(); 4324 Q3PtrList<Attendee> attendees = incidence->attendees();
4319 attendees.first(); 4325 attendees.first();
4320 while ( attendees.current()!=0 ) { 4326 while ( attendees.current()!=0 ) {
4321 publishdlg->addAttendee(attendees.current()); 4327 publishdlg->addAttendee(attendees.current());
4322 attendees.next(); 4328 attendees.next();
4323 } 4329 }
4324 } 4330 }
4325 bool send = true; 4331 bool send = true;
4326 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { 4332 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) {
4327 if ( publishdlg->exec() != QDialog::Accepted ) 4333 if ( publishdlg->exec() != QDialog::Accepted )
4328 send = false; 4334 send = false;
4329 } 4335 }
4330 if ( send ) { 4336 if ( send ) {
@@ -4715,25 +4721,25 @@ void CalendarView::showDates(const DateList &selectedDates)
4715 addString = i18n("Day before yesterday"); 4721 addString = i18n("Day before yesterday");
4716 else if ( date == QDateTime::currentDateTime().date().addDays(2) ) 4722 else if ( date == QDateTime::currentDateTime().date().addDays(2) )
4717 addString = i18n("Day after tomorrow"); 4723 addString = i18n("Day after tomorrow");
4718 if ( !addString.isEmpty() ) { 4724 if ( !addString.isEmpty() ) {
4719 topLevelWidget()->setCaption( addString+", " + selDates ); 4725 topLevelWidget()->setCaption( addString+", " + selDates );
4720 return; 4726 return;
4721 } 4727 }
4722 } 4728 }
4723 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 4729 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
4724 4730
4725} 4731}
4726 4732
4727QPtrList<CalFilter> CalendarView::filters() 4733Q3PtrList<CalFilter> CalendarView::filters()
4728{ 4734{
4729 return mFilters; 4735 return mFilters;
4730 4736
4731} 4737}
4732void CalendarView::editFilters() 4738void CalendarView::editFilters()
4733{ 4739{
4734 // kdDebug() << "CalendarView::editFilters()" << endl; 4740 // kdDebug() << "CalendarView::editFilters()" << endl;
4735 4741
4736 CalFilter *filter = mFilters.first(); 4742 CalFilter *filter = mFilters.first();
4737 while(filter) { 4743 while(filter) {
4738 filter = mFilters.next(); 4744 filter = mFilters.next();
4739 } 4745 }
@@ -4756,25 +4762,25 @@ KOFilterView *CalendarView::filterView()
4756} 4762}
4757void CalendarView::selectFilter( int fil ) 4763void CalendarView::selectFilter( int fil )
4758{ 4764{
4759 mFilterView->setSelectedFilter( fil ); 4765 mFilterView->setSelectedFilter( fil );
4760 updateUnmanagedViews(); 4766 updateUnmanagedViews();
4761} 4767}
4762void CalendarView::showFilter(bool visible) 4768void CalendarView::showFilter(bool visible)
4763{ 4769{
4764#if 1 4770#if 1
4765 if (visible) { 4771 if (visible) {
4766 mCalEditView->readConfig(); 4772 mCalEditView->readConfig();
4767 mCalEditView->show(); 4773 mCalEditView->show();
4768 QValueList<int> sizes; 4774 Q3ValueList<int> sizes;
4769 sizes = mLeftFrame->sizes(); 4775 sizes = mLeftFrame->sizes();
4770 if ( sizes.count() == 4 && sizes[3] < 20 ) { 4776 if ( sizes.count() == 4 && sizes[3] < 20 ) {
4771 sizes.clear(); 4777 sizes.clear();
4772 sizes << 100; 4778 sizes << 100;
4773 sizes << 0; 4779 sizes << 0;
4774 sizes << 0; 4780 sizes << 0;
4775 sizes << 100; 4781 sizes << 100;
4776 mLeftFrame->setSizes(sizes); 4782 mLeftFrame->setSizes(sizes);
4777 } 4783 }
4778#if 0 4784#if 0
4779 sizes = mLeftFrame->sizes(); 4785 sizes = mLeftFrame->sizes();
4780 int ccc = 0; 4786 int ccc = 0;
@@ -4837,54 +4843,54 @@ void CalendarView::takeOverEvent()
4837 incidence->setOrganizer(KOPrefs::instance()->email()); 4843 incidence->setOrganizer(KOPrefs::instance()->email());
4838 incidence->recreate(); 4844 incidence->recreate();
4839 incidence->setReadOnly(false); 4845 incidence->setReadOnly(false);
4840 4846
4841 updateView(); 4847 updateView();
4842} 4848}
4843 4849
4844void CalendarView::takeOverCalendar() 4850void CalendarView::takeOverCalendar()
4845{ 4851{
4846 // TODO: Create Calendar::allIncidences() function and use it here 4852 // TODO: Create Calendar::allIncidences() function and use it here
4847 4853
4848 clearAllViews(); 4854 clearAllViews();
4849 QPtrList<Event> events = mCalendar->events(); 4855 Q3PtrList<Event> events = mCalendar->events();
4850 for(uint i=0; i<events.count(); ++i) { 4856 for(uint i=0; i<events.count(); ++i) {
4851 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 4857 events.at(i)->setOrganizer(KOPrefs::instance()->email());
4852 events.at(i)->recreate(); 4858 events.at(i)->recreate();
4853 events.at(i)->setReadOnly(false); 4859 events.at(i)->setReadOnly(false);
4854 } 4860 }
4855 4861
4856 QPtrList<Todo> todos = mCalendar->todos(); 4862 Q3PtrList<Todo> todos = mCalendar->todos();
4857 for(uint i=0; i<todos.count(); ++i) { 4863 for(uint i=0; i<todos.count(); ++i) {
4858 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 4864 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
4859 todos.at(i)->recreate(); 4865 todos.at(i)->recreate();
4860 todos.at(i)->setReadOnly(false); 4866 todos.at(i)->setReadOnly(false);
4861 } 4867 }
4862 4868
4863 QPtrList<Journal> journals = mCalendar->journals(); 4869 Q3PtrList<Journal> journals = mCalendar->journals();
4864 for(uint i=0; i<journals.count(); ++i) { 4870 for(uint i=0; i<journals.count(); ++i) {
4865 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 4871 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
4866 journals.at(i)->recreate(); 4872 journals.at(i)->recreate();
4867 journals.at(i)->setReadOnly(false); 4873 journals.at(i)->setReadOnly(false);
4868 } 4874 }
4869 4875
4870 updateView(); 4876 updateView();
4871} 4877}
4872 4878
4873void CalendarView::showIntro() 4879void CalendarView::showIntro()
4874{ 4880{
4875 kdDebug() << "To be implemented." << endl; 4881 kdDebug() << "To be implemented." << endl;
4876} 4882}
4877 4883
4878QWidgetStack *CalendarView::viewStack() 4884Q3WidgetStack *CalendarView::viewStack()
4879{ 4885{
4880 return mRightFrame; 4886 return mRightFrame;
4881} 4887}
4882 4888
4883QWidget *CalendarView::leftFrame() 4889QWidget *CalendarView::leftFrame()
4884{ 4890{
4885 return ( QWidget *)mLeftFrame; 4891 return ( QWidget *)mLeftFrame;
4886} 4892}
4887 4893
4888DateNavigator *CalendarView::dateNavigator() 4894DateNavigator *CalendarView::dateNavigator()
4889{ 4895{
4890 return mNavigator; 4896 return mNavigator;
@@ -5051,25 +5057,25 @@ void CalendarView::lookForOutgoingMessages()
5051 ogd->loadMessages(); 5057 ogd->loadMessages();
5052} 5058}
5053 5059
5054void CalendarView::lookForIncomingMessages() 5060void CalendarView::lookForIncomingMessages()
5055{ 5061{
5056 IncomingDialog *icd = mDialogManager->incomingDialog(); 5062 IncomingDialog *icd = mDialogManager->incomingDialog();
5057 icd->retrieve(); 5063 icd->retrieve();
5058} 5064}
5059 5065
5060bool CalendarView::removeCompletedSubTodos( Todo* t ) 5066bool CalendarView::removeCompletedSubTodos( Todo* t )
5061{ 5067{
5062 bool deleteTodo = true; 5068 bool deleteTodo = true;
5063 QPtrList<Incidence> subTodos; 5069 Q3PtrList<Incidence> subTodos;
5064 Incidence *aTodo; 5070 Incidence *aTodo;
5065 subTodos = t->relations(); 5071 subTodos = t->relations();
5066 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 5072 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
5067 if (! removeCompletedSubTodos( (Todo*) aTodo )) 5073 if (! removeCompletedSubTodos( (Todo*) aTodo ))
5068 deleteTodo = false; 5074 deleteTodo = false;
5069 } 5075 }
5070 if ( deleteTodo ) { 5076 if ( deleteTodo ) {
5071 if ( t->isCompleted() && !t->doesRecur()) { 5077 if ( t->isCompleted() && !t->doesRecur()) {
5072 checkExternalId( t ); 5078 checkExternalId( t );
5073 mCalendar->deleteTodo( t ); 5079 mCalendar->deleteTodo( t );
5074 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 5080 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
5075 } 5081 }
@@ -5077,26 +5083,26 @@ bool CalendarView::removeCompletedSubTodos( Todo* t )
5077 deleteTodo = false; 5083 deleteTodo = false;
5078 } 5084 }
5079 return deleteTodo; 5085 return deleteTodo;
5080 5086
5081} 5087}
5082void CalendarView::purgeCompleted() 5088void CalendarView::purgeCompleted()
5083{ 5089{
5084 int result = KMessageBox::warningContinueCancel(this, 5090 int result = KMessageBox::warningContinueCancel(this,
5085 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); 5091 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge"));
5086 5092
5087 if (result == KMessageBox::Continue) { 5093 if (result == KMessageBox::Continue) {
5088 5094
5089 QPtrList<Todo> todoCal; 5095 Q3PtrList<Todo> todoCal;
5090 QPtrList<Todo> rootTodos; 5096 Q3PtrList<Todo> rootTodos;
5091 //QPtrList<Incidence> rel; 5097 //QPtrList<Incidence> rel;
5092 Todo *aTodo; 5098 Todo *aTodo;
5093 todoCal = calendar()->todos(); 5099 todoCal = calendar()->todos();
5094 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 5100 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
5095 if ( !aTodo->relatedTo() ) 5101 if ( !aTodo->relatedTo() )
5096 rootTodos.append( aTodo ); 5102 rootTodos.append( aTodo );
5097 } 5103 }
5098 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 5104 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
5099 removeCompletedSubTodos( aTodo ); 5105 removeCompletedSubTodos( aTodo );
5100 } 5106 }
5101 5107
5102 updateView(); 5108 updateView();