summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp148
-rw-r--r--korganizer/calendarview.h32
-rw-r--r--korganizer/calprintbase.cpp102
-rw-r--r--korganizer/calprinter.cpp23
-rw-r--r--korganizer/calprinter.h18
-rw-r--r--korganizer/calprintplugins.cpp4
-rw-r--r--korganizer/cellitem.cpp14
-rw-r--r--korganizer/cellitem.h4
-rw-r--r--korganizer/datenavigatorcontainer.cpp2
-rw-r--r--korganizer/datenavigatorcontainer.h5
-rw-r--r--korganizer/filteredit_base.cpp40
-rw-r--r--korganizer/filteredit_base.h42
-rw-r--r--korganizer/filtereditdialog.cpp11
-rw-r--r--korganizer/filtereditdialog.h6
-rw-r--r--korganizer/incomingdialog.cpp30
-rw-r--r--korganizer/incomingdialog.h10
-rw-r--r--korganizer/incomingdialog_base.cpp14
-rw-r--r--korganizer/incomingdialog_base.h22
-rw-r--r--korganizer/interfaces/korganizer/baseview.h8
-rw-r--r--korganizer/interfaces/korganizer/calendarviewbase.h4
-rw-r--r--korganizer/journalentry.cpp39
-rw-r--r--korganizer/journalentry.h9
-rw-r--r--korganizer/kdatenavigator.cpp20
-rw-r--r--korganizer/kdatenavigator.h11
-rw-r--r--korganizer/koagenda.cpp169
-rw-r--r--korganizer/koagenda.h43
-rw-r--r--korganizer/koagendaitem.cpp70
-rw-r--r--korganizer/koagendaitem.h17
-rw-r--r--korganizer/koagendaview.cpp78
-rw-r--r--korganizer/koagendaview.h52
-rw-r--r--korganizer/kocounterdialog.h2
-rw-r--r--korganizer/kodaymatrix.cpp47
-rw-r--r--korganizer/kodaymatrix.h14
-rw-r--r--korganizer/kodialogmanager.cpp8
-rw-r--r--korganizer/kodialogmanager.h4
-rw-r--r--korganizer/koeditordetails.cpp38
-rw-r--r--korganizer/koeditordetails.h12
-rw-r--r--korganizer/koeditorgeneral.cpp39
-rw-r--r--korganizer/koeditorgeneral.h21
-rw-r--r--korganizer/koeditorgeneralevent.cpp32
-rw-r--r--korganizer/koeditorgeneralevent.h12
-rw-r--r--korganizer/koeditorgeneraltodo.cpp39
-rw-r--r--korganizer/koeditorgeneraltodo.h16
-rw-r--r--korganizer/koeditorrecurrence.cpp94
-rw-r--r--korganizer/koeditorrecurrence.h30
-rw-r--r--korganizer/koeventeditor.cpp43
-rw-r--r--korganizer/koeventpopupmenu.cpp17
-rw-r--r--korganizer/koeventpopupmenu.h16
-rw-r--r--korganizer/koeventview.cpp4
-rw-r--r--korganizer/koeventview.h4
-rw-r--r--korganizer/koeventviewer.cpp37
-rw-r--r--korganizer/koeventviewer.h17
-rw-r--r--korganizer/koeventviewerdialog.cpp5
-rw-r--r--korganizer/koeventviewerdialog.h5
-rw-r--r--korganizer/kofilterview.cpp48
-rw-r--r--korganizer/kofilterview.h36
-rw-r--r--korganizer/koimportoldialog.cpp30
-rw-r--r--korganizer/koimportoldialog.h4
-rw-r--r--korganizer/koincidenceeditor.cpp10
-rw-r--r--korganizer/kojournalview.cpp36
-rw-r--r--korganizer/kojournalview.h15
-rw-r--r--korganizer/kolistview.cpp193
-rw-r--r--korganizer/kolistview.h42
-rw-r--r--korganizer/komonthview.cpp218
-rw-r--r--korganizer/komonthview.h57
-rw-r--r--korganizer/koprefs.cpp8
-rw-r--r--korganizer/koprefs.h11
-rw-r--r--korganizer/koprefsdialog.cpp138
-rw-r--r--korganizer/koprefsdialog.h12
-rw-r--r--korganizer/korganizer.pro57
-rw-r--r--korganizer/korganizerE.pro6
-rw-r--r--korganizer/kotimespanview.cpp20
-rw-r--r--korganizer/kotimespanview.h6
-rw-r--r--korganizer/kotodoeditor.cpp43
-rw-r--r--korganizer/kotodoview.cpp198
-rw-r--r--korganizer/kotodoview.h58
-rw-r--r--korganizer/kotodoviewitem.cpp42
-rw-r--r--korganizer/kotodoviewitem.h14
-rw-r--r--korganizer/koviewmanager.cpp8
-rw-r--r--korganizer/kowhatsnextview.cpp38
-rw-r--r--korganizer/kowhatsnextview.h20
-rw-r--r--korganizer/ktimeedit.cpp89
-rw-r--r--korganizer/ktimeedit.h7
-rw-r--r--korganizer/lineview.cpp2
-rw-r--r--korganizer/lineview.h8
-rw-r--r--korganizer/main.cpp10
-rw-r--r--korganizer/mainwindow.cpp316
-rw-r--r--korganizer/mainwindow.h68
-rw-r--r--korganizer/navigatorbar.cpp29
-rw-r--r--korganizer/navigatorbar.h7
-rw-r--r--korganizer/outgoingdialog.cpp28
-rw-r--r--korganizer/outgoingdialog.h10
-rw-r--r--korganizer/outgoingdialog_base.cpp18
-rw-r--r--korganizer/outgoingdialog_base.h22
-rw-r--r--korganizer/publishdialog.cpp18
-rw-r--r--korganizer/publishdialog.h4
-rw-r--r--korganizer/publishdialog_base.cpp27
-rw-r--r--korganizer/publishdialog_base.h28
-rw-r--r--korganizer/savetemplatedialog.cpp7
-rw-r--r--korganizer/searchdialog.cpp43
-rw-r--r--korganizer/searchdialog.h16
-rw-r--r--korganizer/statusdialog.cpp9
-rw-r--r--korganizer/timeline.cpp6
-rw-r--r--korganizer/timeline.h4
-rw-r--r--korganizer/timespanview.cpp22
-rw-r--r--korganizer/timespanview.h10
106 files changed, 2091 insertions, 1688 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 8385bcc..c1a2f76 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -19,48 +19,54 @@
19 (at your option) any later version. 19 (at your option) any later version.
20 20
21 This program is distributed in the hope that it will be useful, 21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of 22 but WITHOUT ANY WARRANTY; without even the implied warranty of
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>
63#include <kdirwatch.h> 69#include <kdirwatch.h>
64#include <libkdepim/kdatepicker.h> 70#include <libkdepim/kdatepicker.h>
65#include <libkdepim/ksyncprofile.h> 71#include <libkdepim/ksyncprofile.h>
66#include <libkdepim/kpimglobalprefs.h> 72#include <libkdepim/kpimglobalprefs.h>
@@ -115,45 +121,45 @@
115#include "datenavigator.h" 121#include "datenavigator.h"
116#include "resourceview.h" 122#include "resourceview.h"
117#include "navigatorbar.h" 123#include "navigatorbar.h"
118#include "searchdialog.h" 124#include "searchdialog.h"
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=\"";
156 // mText += ipath; 162 // mText += ipath;
157 // mText += "\">"; 163 // mText += "\">";
158 //mEventDate = QDate::currentDate(); 164 //mEventDate = QDate::currentDate();
159#ifdef DESKTOP_VERSION 165#ifdef DESKTOP_VERSION
@@ -264,73 +270,73 @@ void MissedAlarmTextBrowser::setSource(const QString & n)
264 emit showIncidence(n.mid(7)); 270 emit showIncidence(n.mid(7));
265#else 271#else
266 emit showIncidence(n.mid(5)); 272 emit showIncidence(n.mid(5));
267#endif 273#endif
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() ) );
299 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 305 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
300 resize( 200, 200 ); 306 resize( 200, 200 );
301 } 307 }
302 308
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 );
333 } 339 }
334 340
335 bool addCat() { return addCatBut->isChecked(); } 341 bool addCat() { return addCatBut->isChecked(); }
336private: 342private:
@@ -360,114 +366,114 @@ CalendarView::CalendarView( Calendar *calendar,
360{ 366{
361 367
362 mEventEditor = 0; 368 mEventEditor = 0;
363 mTodoEditor = 0; 369 mTodoEditor = 0;
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
410 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 416 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
411 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 417 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
412 mTodoList->setNavigator( mNavigator ); 418 mTodoList->setNavigator( mNavigator );
413 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 419 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
414 420
415#ifdef KORG_NORESOURCEVIEW 421#ifdef KORG_NORESOURCEVIEW
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 );
443 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 449 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
444 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 450 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
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());
470#endif 476#endif
471 // mDateNavigator->blockSignals( true ); 477 // mDateNavigator->blockSignals( true );
472 //leftFrameLayout->addWidget( mDateNavigator ); 478 //leftFrameLayout->addWidget( mDateNavigator );
473 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 479 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
@@ -488,34 +494,34 @@ void CalendarView::init()
488 494
489 mTodoList->setNavigator( mNavigator ); 495 mTodoList->setNavigator( mNavigator );
490#if 0 496#if 0
491 if ( QApplication::desktop()->width() < 480 ) { 497 if ( QApplication::desktop()->width() < 480 ) {
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() );
518 } 524 }
519 if ( !KOPrefs::instance()->mShowDateNavigator) 525 if ( !KOPrefs::instance()->mShowDateNavigator)
520 mDateNavigator->hide(); 526 mDateNavigator->hide();
521 //qDebug("Calendarview Size %d %d ", width(), height()); 527 //qDebug("Calendarview Size %d %d ", width(), height());
@@ -603,35 +609,35 @@ void CalendarView::init()
603 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 609 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
604 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 610 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
605 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 611 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
606 612
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
634 mSuspendTimer = new QTimer( this ); 640 mSuspendTimer = new QTimer( this );
635 mAlarmTimer = new QTimer( this ); 641 mAlarmTimer = new QTimer( this );
636 mRecheckAlarmTimer = new QTimer( this ); 642 mRecheckAlarmTimer = new QTimer( this );
637 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 643 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
@@ -656,49 +662,49 @@ CalendarView::~CalendarView()
656{ 662{
657 // kdDebug() << "~CalendarView()" << endl; 663 // kdDebug() << "~CalendarView()" << endl;
658 //qDebug("CalendarView::~CalendarView() "); 664 //qDebug("CalendarView::~CalendarView() ");
659 delete mDialogManager; 665 delete mDialogManager;
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 );
701 else 707 else
702 skip = !test->matchTime( &startDT, 0 ); 708 skip = !test->matchTime( &startDT, 0 );
703 } 709 }
704 if ( !skip ) { 710 if ( !skip ) {
@@ -822,86 +828,86 @@ void CalendarView::updateView(const QDate &start, const QDate &end)
822 mDateScrollBar->blockSignals( true ); 828 mDateScrollBar->blockSignals( true );
823 mDateScrollBar->setValue( start.dayOfYear()); 829 mDateScrollBar->setValue( start.dayOfYear());
824 mDateScrollBar->blockSignals( false ); 830 mDateScrollBar->blockSignals( false );
825 } 831 }
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;
904 if ( QApplication::desktop()->width() > 470 ) 910 if ( QApplication::desktop()->width() > 470 )
905 si = 400; 911 si = 400;
906 dia->resize(si,si/2); 912 dia->resize(si,si/2);
907 } 913 }
@@ -1203,33 +1209,33 @@ void CalendarView::computeAlarm( QString msg )
1203 tempfilename = mess.mid( 10, len ); 1209 tempfilename = mess.mid( 10, len );
1204 if ( !QFile::exists( tempfilename ) ) 1210 if ( !QFile::exists( tempfilename ) )
1205 error = true; 1211 error = true;
1206 } 1212 }
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;
1232 int len = mess.mid( 11 ).find("+++"); 1238 int len = mess.mid( 11 ).find("+++");
1233 if ( len < 2 ) 1239 if ( len < 2 )
1234 error = true; 1240 error = true;
1235 else { 1241 else {
@@ -1253,64 +1259,64 @@ void CalendarView::computeAlarm( QString msg )
1253} 1259}
1254 1260
1255void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 1261void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
1256{ 1262{
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 );
1313 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 1319 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
1314 return; 1320 return;
1315 } else { 1321 } else {
1316 mRecheckAlarmTimer->stop(); 1322 mRecheckAlarmTimer->stop();
@@ -1557,88 +1563,88 @@ Event* CalendarView::getLastSyncEvent()
1557 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 1563 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
1558 lse->setDtStart( mLastCalendarSync ); 1564 lse->setDtStart( mLastCalendarSync );
1559 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 1565 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
1560 lse->setCategories( i18n("SyncEvent") ); 1566 lse->setCategories( i18n("SyncEvent") );
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
1586 if ( !id.isEmpty() ) { 1592 if ( !id.isEmpty() ) {
1587 QString des = eve->description(); 1593 QString des = eve->description();
1588 QString pref = "e"; 1594 QString pref = "e";
1589 if ( toDelete->typeID() == todoID ) 1595 if ( toDelete->typeID() == todoID )
1590 pref = "t"; 1596 pref = "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 }
1641 QDateTime modifiedCalendar = mLastCalendarSync; 1647 QDateTime modifiedCalendar = mLastCalendarSync;
1642 eventLSync = getLastSyncEvent(); 1648 eventLSync = getLastSyncEvent();
1643 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 1649 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
1644 if ( eventR ) { 1650 if ( eventR ) {
@@ -1671,36 +1677,36 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1671 } 1677 }
1672 } 1678 }
1673 if ( mSyncManager->syncWithDesktop() ) { 1679 if ( mSyncManager->syncWithDesktop() ) {
1674 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); 1680 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync );
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();
1703 } 1709 }
1704 int w = 300; 1710 int w = 300;
1705 if ( QApplication::desktop()->width() < 320 ) 1711 if ( QApplication::desktop()->width() < 320 )
1706 w = 220; 1712 w = 220;
@@ -1818,33 +1824,33 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1818 local->addIncidence( inL ); 1824 local->addIncidence( inL );
1819 ++addedEvent; 1825 ++addedEvent;
1820 1826
1821 } else { 1827 } else {
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;
1847 if ( incCounter % modulo == 0 ) 1853 if ( incCounter % modulo == 0 )
1848 bar.setProgress( incCounter ); 1854 bar.setProgress( incCounter );
1849 ++incCounter; 1855 ++incCounter;
1850 uid = inL->uid(); 1856 uid = inL->uid();
@@ -2035,33 +2041,33 @@ void CalendarView::syncExternal( int mode )
2035 mSyncManager->mPhoneConnection, 2041 mSyncManager->mPhoneConnection,
2036 mSyncManager->mPhoneModel); 2042 mSyncManager->mPhoneModel);
2037 loadSuccess = phoneFormat->load( calendar,mCalendar); 2043 loadSuccess = phoneFormat->load( calendar,mCalendar);
2038 2044
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 )
2064 phoneFormat->save(calendar); 2070 phoneFormat->save(calendar);
2065 iL = calendar->rawIncidences(); 2071 iL = calendar->rawIncidences();
2066 inc = iL.first(); 2072 inc = iL.first();
2067 Incidence* loc; 2073 Incidence* loc;
@@ -2102,33 +2108,33 @@ void CalendarView::syncExternal( int mode )
2102bool CalendarView::importBday() 2108bool CalendarView::importBday()
2103{ 2109{
2104#ifndef KORG_NOKABC 2110#ifndef KORG_NOKABC
2105 2111
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;
2131 KCal::Attendee* a = 0; 2137 KCal::Attendee* a = 0;
2132 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 2138 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
2133 if ( ! bar.isVisible() ) 2139 if ( ! bar.isVisible() )
2134 return false; 2140 return false;
@@ -2173,33 +2179,33 @@ void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthd
2173 //qDebug("KO::CalendarView::insertBirthdays"); 2179 //qDebug("KO::CalendarView::insertBirthdays");
2174 if (uid == this->name()) 2180 if (uid == this->name())
2175 { 2181 {
2176 int curCal = mCalendar->defaultCalendar(); 2182 int curCal = mCalendar->defaultCalendar();
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;
2202 QDate anniversary; 2208 QDate anniversary;
2203 QString realName; 2209 QString realName;
2204 QString email; 2210 QString email;
2205 QString assembledName; 2211 QString assembledName;
@@ -2337,47 +2343,47 @@ bool CalendarView::importQtopia( const QString &categories,
2337 delete calendar; 2343 delete calendar;
2338 updateView(); 2344 updateView();
2339 return syncOK; 2345 return syncOK;
2340 2346
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();
2380 updateView(); 2386 updateView();
2381 return true; 2387 return true;
2382} 2388}
2383void CalendarView::addCalendarId( int id ) 2389void CalendarView::addCalendarId( int id )
@@ -2516,33 +2522,33 @@ bool CalendarView::checkFileChanged(QString fn)
2516} 2522}
2517void CalendarView::watchSavedFile() 2523void CalendarView::watchSavedFile()
2518{ 2524{
2519 QFileInfo finf ( MainWindow::defaultFileName()); 2525 QFileInfo finf ( MainWindow::defaultFileName());
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 ) {
2545 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { 2551 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
2546 mCalendar->setDefaultCalendar( cal->mCalNumber ); 2552 mCalendar->setDefaultCalendar( cal->mCalNumber );
2547 mCalendar->setDefaultCalendarEnabledOnly(); 2553 mCalendar->setDefaultCalendarEnabledOnly();
2548 loadedFileVersion = cal->mLoadDt.addSecs( 15 ); 2554 loadedFileVersion = cal->mLoadDt.addSecs( 15 );
@@ -2578,33 +2584,33 @@ bool CalendarView::checkFileVersion(QString fn)
2578 2584
2579 setSyncDevice("deleteaftersync" ); 2585 setSyncDevice("deleteaftersync" );
2580 mSyncManager->mAskForPreferences = true; 2586 mSyncManager->mAskForPreferences = true;
2581 mSyncManager->mSyncAlgoPrefs = 3; 2587 mSyncManager->mSyncAlgoPrefs = 3;
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 ) )
2607 cal->mLoadDt = QDateTime::currentDateTime(); 2613 cal->mLoadDt = QDateTime::currentDateTime();
2608 else 2614 else
2609 saveError += cal->mName + "\n"; 2615 saveError += cal->mName + "\n";
2610 } 2616 }
@@ -2682,33 +2688,33 @@ void CalendarView::archiveCalendar()
2682} 2688}
2683 2689
2684 2690
2685void CalendarView::readSettings() 2691void 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
2711 globalFlagBlockAgenda = 1; 2717 globalFlagBlockAgenda = 1;
2712 mViewManager->showAgendaView(); 2718 mViewManager->showAgendaView();
2713 //mViewManager->readSettings( config ); 2719 //mViewManager->readSettings( config );
2714 mTodoList->restoreLayout(config,QString("Todo Layout")); 2720 mTodoList->restoreLayout(config,QString("Todo Layout"));
@@ -2750,33 +2756,33 @@ void CalendarView::readSettings()
2750 mTodoEditor->setGeometry(x,y,w,h); 2756 mTodoEditor->setGeometry(x,y,w,h);
2751 2757
2752 } 2758 }
2753 list = config->readListEntry("ViewerLayout"); 2759 list = config->readListEntry("ViewerLayout");
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();
2779 if ( KOPrefs::instance()->mVerticalScreen ) { 2785 if ( KOPrefs::instance()->mVerticalScreen ) {
2780 maxVal = QApplication::desktop()->width() -10; 2786 maxVal = QApplication::desktop()->width() -10;
2781 } else { 2787 } else {
2782 maxVal = QApplication::desktop()->height()-10; 2788 maxVal = QApplication::desktop()->height()-10;
@@ -2829,62 +2835,62 @@ void CalendarView::checkSuspendAlarm()
2829} 2835}
2830void CalendarView::writeSettings() 2836void CalendarView::writeSettings()
2831{ 2837{
2832 // kdDebug() << "CalendarView::writeSettings" << endl; 2838 // kdDebug() << "CalendarView::writeSettings" << endl;
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
2858 qDebug("********************* "); 2864 qDebug("********************* ");
2859 qDebug("Testcode secsto "); 2865 qDebug("Testcode secsto ");
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();
2887 list << QString::number( x ); 2893 list << QString::number( x );
2888 list << QString::number( y ); 2894 list << QString::number( y );
2889 list << QString::number( w ); 2895 list << QString::number( w );
2890 list << QString::number( h ); 2896 list << QString::number( h );
@@ -3153,33 +3159,33 @@ void CalendarView::checkConflictForEvent()
3153 } 3159 }
3154 CalFilter *filterIN = 0; 3160 CalFilter *filterIN = 0;
3155 CalFilter *filterALL = 0; 3161 CalFilter *filterALL = 0;
3156 CalFilter *filter = mFilters.first(); 3162 CalFilter *filter = mFilters.first();
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") );
3182 while ( test ) { 3188 while ( test ) {
3183 qApp->processEvents(); 3189 qApp->processEvents();
3184 bool skip = ( test->doesFloat() && !chAD ) || ( !test->doesFloat() && !chNad ); 3190 bool skip = ( test->doesFloat() && !chAD ) || ( !test->doesFloat() && !chNad );
3185 3191
@@ -3415,54 +3421,54 @@ void CalendarView::slotSelectPickerDate( QDate d)
3415 QDateTime dt ( d,tim ); 3421 QDateTime dt ( d,tim );
3416 mMoveIncidence->setDtStart( dt ); 3422 mMoveIncidence->setDtStart( dt );
3417 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 3423 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
3418 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 3424 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
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;
3465 } 3471 }
3466 } 3472 }
3467 inc = incList.next(); 3473 inc = incList.next();
3468 } 3474 }
@@ -3494,49 +3500,49 @@ void CalendarView::manageCategories()
3494 if ( cp->addCat() ) { 3500 if ( cp->addCat() ) {
3495 count = addCategories(); 3501 count = addCategories();
3496 if ( count ) { 3502 if ( count ) {
3497 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 3503 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
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;
3539 if ( createbup ) { 3545 if ( createbup ) {
3540 QString description = "\n"; 3546 QString description = "\n";
3541 CalendarLocal* cal = new CalendarLocal(); 3547 CalendarLocal* cal = new CalendarLocal();
3542 if ( beamDialog.beamLocal() ) 3548 if ( beamDialog.beamLocal() )
@@ -4302,33 +4308,33 @@ void CalendarView::schedule_publish(Incidence *incidence)
4302 } 4308 }
4303 if ( incidence && incidence->typeID() == eventID ) { 4309 if ( incidence && incidence->typeID() == eventID ) {
4304 event = static_cast<Event *>(incidence); 4310 event = static_cast<Event *>(incidence);
4305 } else { 4311 } else {
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 ) {
4331 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 4337 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
4332 if ( event ) { 4338 if ( event ) {
4333 Event *ev = new Event(*event); 4339 Event *ev = new Event(*event);
4334 ev->registerObserver(0); 4340 ev->registerObserver(0);
@@ -4711,33 +4717,33 @@ void CalendarView::showDates(const DateList &selectedDates)
4711 addString = i18n("Tomorrow"); 4717 addString = i18n("Tomorrow");
4712 else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) 4718 else if ( date == QDateTime::currentDateTime().date().addDays(-1) )
4713 addString = i18n("Yesterday"); 4719 addString = i18n("Yesterday");
4714 else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) 4720 else if ( date == QDateTime::currentDateTime().date().addDays(-2) )
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 }
4740 4746
4741 mDialogManager->showFilterEditDialog(&mFilters); 4747 mDialogManager->showFilterEditDialog(&mFilters);
4742 updateFilter(); 4748 updateFilter();
4743} 4749}
@@ -4752,33 +4758,33 @@ void CalendarView::toggleFilter()
4752 4758
4753KOFilterView *CalendarView::filterView() 4759KOFilterView *CalendarView::filterView()
4754{ 4760{
4755 return mFilterView; 4761 return mFilterView;
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;
4781 while ( ccc < sizes.count()) { 4787 while ( ccc < sizes.count()) {
4782 qDebug("size %d %d ", ccc, sizes[ccc]); 4788 qDebug("size %d %d ", ccc, sizes[ccc]);
4783 ++ccc; 4789 ++ccc;
4784 } 4790 }
@@ -4833,62 +4839,62 @@ void CalendarView::takeOverEvent()
4833 Incidence *incidence = currentSelection(); 4839 Incidence *incidence = currentSelection();
4834 4840
4835 if (!incidence) return; 4841 if (!incidence) return;
4836 4842
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;
4891} 4897}
4892 4898
4893KDateNavigator* CalendarView::dateNavigatorWidget() 4899KDateNavigator* CalendarView::dateNavigatorWidget()
4894{ 4900{
@@ -5047,60 +5053,60 @@ void CalendarView::deleteIncidence(Incidence *incidence)
5047 5053
5048void CalendarView::lookForOutgoingMessages() 5054void CalendarView::lookForOutgoingMessages()
5049{ 5055{
5050 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 5056 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
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 }
5076 else 5082 else
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();
5103 } 5109 }
5104} 5110}
5105 5111
5106void CalendarView::slotCalendarChanged() 5112void CalendarView::slotCalendarChanged()
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 60b1276..b4eada7 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -11,56 +11,58 @@
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef CALENDARVIEW_H 24#ifndef CALENDARVIEW_H
25#define CALENDARVIEW_H 25#define CALENDARVIEW_H
26 26
27#include <qframe.h> 27#include <q3frame.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qptrlist.h> 30#include <q3ptrlist.h>
31#include <qvbox.h> 31#include <q3vbox.h>
32#include <qmap.h> 32#include <qmap.h>
33#include <qscrollbar.h> 33#include <qscrollbar.h>
34//Added by qt3to4:
35#include <QKeyEvent>
34#ifndef DESKTOP_VERSION 36#ifndef DESKTOP_VERSION
35#include <qtopia/ir.h> 37#include <qtopia/ir.h>
36#else 38#else
37#define Ir char 39#define Ir char
38#endif 40#endif
39#include <libkcal/calendar.h> 41#include <libkcal/calendar.h>
40#include <libkcal/scheduler.h> 42#include <libkcal/scheduler.h>
41#include <libkcal/calendarresources.h> 43#include <libkcal/calendarresources.h>
42#include <libkcal/resourcecalendar.h> 44#include <libkcal/resourcecalendar.h>
43#include <KDGanttMinimizeSplitter.h> 45#include <KDGanttMinimizeSplitter.h>
44 46
45#include <korganizer/calendarviewbase.h> 47#include <korganizer/calendarviewbase.h>
46 48
47#include <ksyncmanager.h> 49#include <ksyncmanager.h>
48//#include <koprefs.h> 50//#include <koprefs.h>
49 51
50class QWidgetStack; 52class Q3WidgetStack;
51class QSplitter; 53class QSplitter;
52class KopiCalendarFile; 54class KopiCalendarFile;
53class CalPrinter; 55class CalPrinter;
54class KOFilterView; 56class KOFilterView;
55class KOCalEditView; 57class KOCalEditView;
56class KOViewManager; 58class KOViewManager;
57class KODialogManager; 59class KODialogManager;
58class KOTodoView; 60class KOTodoView;
59class KDateNavigator; 61class KDateNavigator;
60class DateNavigatorContainer; 62class DateNavigatorContainer;
61class DateNavigator; 63class DateNavigator;
62class KOIncidenceEditor; 64class KOIncidenceEditor;
63class KDatePicker; 65class KDatePicker;
64class ResourceView; 66class ResourceView;
65class KOEventEditor; 67class KOEventEditor;
66class KOTodoEditor ; 68class KOTodoEditor ;
@@ -71,76 +73,76 @@ class AlarmDialog;
71class KCal::Attendee; 73class KCal::Attendee;
72 74
73namespace KCal { class FileStorage; } 75namespace KCal { class FileStorage; }
74 76
75using namespace KCal; 77using namespace KCal;
76 78
77/** 79/**
78 This is the main calendar widget. It provides the different vies on t he 80 This is the main calendar widget. It provides the different vies on t he
79 calendar data as well as the date navigator. It also handles synchronisation 81 calendar data as well as the date navigator. It also handles synchronisation
80 of the different views and controls the different dialogs like preferences, 82 of the different views and controls the different dialogs like preferences,
81 event editor, search dialog etc. 83 event editor, search dialog etc.
82 84
83 @short main calendar view widget 85 @short main calendar view widget
84 @author Cornelius Schumacher 86 @author Cornelius Schumacher
85*/ 87*/
86 88
87#include <qtextbrowser.h> 89#include <q3textbrowser.h>
88#include <qtextcodec.h> 90#include <qtextcodec.h>
89 91
90class MissedAlarmTextBrowser : public QTextBrowser { 92class MissedAlarmTextBrowser : public Q3TextBrowser {
91 Q_OBJECT 93 Q_OBJECT
92 public: 94 public:
93 MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); 95 MissedAlarmTextBrowser(QWidget *parent, Q3PtrList<Incidence> alarms ,QDateTime start);
94 ~MissedAlarmTextBrowser(); 96 ~MissedAlarmTextBrowser();
95 void setSource(const QString & n); 97 void setSource(const QString & n);
96 98
97 private: 99 private:
98 Incidence * getNextInc(QDateTime start ); 100 Incidence * getNextInc(QDateTime start );
99 QPtrList<Incidence> mAlarms; 101 Q3PtrList<Incidence> mAlarms;
100 signals: 102 signals:
101 void showIncidence( QString uid); 103 void showIncidence( QString uid);
102}; 104};
103 105
104 106
105class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface 107class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
106{ 108{
107 Q_OBJECT 109 Q_OBJECT
108 public: 110 public:
109 /** 111 /**
110 Constructs a new calendar view widget. 112 Constructs a new calendar view widget.
111 113
112 @param calendar calendar document 114 @param calendar calendar document
113 @param parent parent window 115 @param parent parent window
114 @param name Qt internal widget object name 116 @param name Qt internal widget object name
115 */ 117 */
116 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 118 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
117 const char *name = 0 ); 119 const char *name = 0 );
118 CalendarView( Calendar *calendar, QWidget *parent = 0, 120 CalendarView( Calendar *calendar, QWidget *parent = 0,
119 const char *name = 0 ); 121 const char *name = 0 );
120 virtual ~CalendarView(); 122 virtual ~CalendarView();
121 123
122 Calendar *calendar() { return mCalendar; } 124 Calendar *calendar() { return mCalendar; }
123 125
124 KOViewManager *viewManager(); 126 KOViewManager *viewManager();
125 KODialogManager *dialogManager(); 127 KODialogManager *dialogManager();
126 128
127 QDate startDate(); 129 QDate startDate();
128 QDate endDate(); 130 QDate endDate();
129 131
130 QWidgetStack *viewStack(); 132 Q3WidgetStack *viewStack();
131 QWidget *leftFrame(); 133 QWidget *leftFrame();
132 134
133 DateNavigator *dateNavigator(); 135 DateNavigator *dateNavigator();
134 KDateNavigator *dateNavigatorWidget(); 136 KDateNavigator *dateNavigatorWidget();
135 137
136 void addView(KOrg::BaseView *); 138 void addView(KOrg::BaseView *);
137 void showView(KOrg::BaseView *); 139 void showView(KOrg::BaseView *);
138 KOEventViewerDialog* getEventViewerDialog(); 140 KOEventViewerDialog* getEventViewerDialog();
139 Incidence *currentSelection(); 141 Incidence *currentSelection();
140 void checkSuspendAlarm(); 142 void checkSuspendAlarm();
141 void mergeFile( QString fn ); 143 void mergeFile( QString fn );
142 void mergeFileResource( QString fn ,QString res); 144 void mergeFileResource( QString fn ,QString res);
143 145
144 signals: 146 signals:
145 void save (); 147 void save ();
146 void saveStopTimer (); 148 void saveStopTimer ();
@@ -428,33 +430,33 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
428 430
429 /* iTIP scheduling actions */ 431 /* iTIP scheduling actions */
430 void schedule_publish(Incidence *incidence = 0); 432 void schedule_publish(Incidence *incidence = 0);
431 void schedule_request(Incidence *incidence = 0); 433 void schedule_request(Incidence *incidence = 0);
432 void schedule_refresh(Incidence *incidence = 0); 434 void schedule_refresh(Incidence *incidence = 0);
433 void schedule_cancel(Incidence *incidence = 0); 435 void schedule_cancel(Incidence *incidence = 0);
434 void schedule_add(Incidence *incidence = 0); 436 void schedule_add(Incidence *incidence = 0);
435 void schedule_reply(Incidence *incidence = 0); 437 void schedule_reply(Incidence *incidence = 0);
436 void schedule_counter(Incidence *incidence = 0); 438 void schedule_counter(Incidence *incidence = 0);
437 void schedule_declinecounter(Incidence *incidence = 0); 439 void schedule_declinecounter(Incidence *incidence = 0);
438 void schedule_publish_freebusy(int daysToPublish = 30); 440 void schedule_publish_freebusy(int daysToPublish = 30);
439 441
440 void openAddressbook(); 442 void openAddressbook();
441 443
442 void editFilters(); 444 void editFilters();
443 void toggleFilerEnabled(); 445 void toggleFilerEnabled();
444 QPtrList<CalFilter> filters(); 446 Q3PtrList<CalFilter> filters();
445 void toggleFilter(); 447 void toggleFilter();
446 void showFilter(bool visible); 448 void showFilter(bool visible);
447 void updateFilter(); 449 void updateFilter();
448 void filterEdited(); 450 void filterEdited();
449 void selectFilter( int ); 451 void selectFilter( int );
450 KOFilterView *filterView(); 452 KOFilterView *filterView();
451 453
452 void showIntro(); 454 void showIntro();
453 455
454 /** Move the curdatepient view date to today */ 456 /** Move the curdatepient view date to today */
455 void goToday(); 457 void goToday();
456 458
457 /** Move to the next date(s) in the current view */ 459 /** Move to the next date(s) in the current view */
458 void goNext(); 460 void goNext();
459 461
460 /** Move to the previous date(s) in the current view */ 462 /** Move to the previous date(s) in the current view */
@@ -482,33 +484,33 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
482 void purgeCompleted(); 484 void purgeCompleted();
483 bool removeCompletedSubTodos( Todo* ); 485 bool removeCompletedSubTodos( Todo* );
484 void slotCalendarChanged(); 486 void slotCalendarChanged();
485 bool importBday(); 487 bool importBday();
486 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 488 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
487 bool importQtopia( const QString &categoriesFile, 489 bool importQtopia( const QString &categoriesFile,
488 const QString &datebookFile, 490 const QString &datebookFile,
489 const QString &tasklistFile ); 491 const QString &tasklistFile );
490 void syncExternal( int mode ); 492 void syncExternal( int mode );
491 void slotSelectPickerDate( QDate ) ; 493 void slotSelectPickerDate( QDate ) ;
492 void showDatePicker() ; 494 void showDatePicker() ;
493 void showDatePickerPopup() ; 495 void showDatePickerPopup() ;
494 void moveIncidence(Incidence *) ; 496 void moveIncidence(Incidence *) ;
495 void beamIncidence(Incidence *) ; 497 void beamIncidence(Incidence *) ;
496 void beamCalendar() ; 498 void beamCalendar() ;
497 void beamFilteredCalendar() ; 499 void beamFilteredCalendar() ;
498 void beamIncidenceList(QPtrList<Incidence>) ; 500 void beamIncidenceList(Q3PtrList<Incidence>) ;
499 void manageCategories(); 501 void manageCategories();
500 void editCategories(); 502 void editCategories();
501 int addCategories(); 503 int addCategories();
502 void removeCategories(); 504 void removeCategories();
503 void setSyncDevice( QString ); 505 void setSyncDevice( QString );
504 void setSyncName( QString ); 506 void setSyncName( QString );
505 void showDay( QDate ); 507 void showDay( QDate );
506 void undo_delete(); 508 void undo_delete();
507 protected slots: 509 protected slots:
508 void resetFocus(); 510 void resetFocus();
509 void scrollBarValue(int); 511 void scrollBarValue(int);
510 void slotViewerClosed(); 512 void slotViewerClosed();
511 void timerAlarm(); 513 void timerAlarm();
512 void suspendAlarm(); 514 void suspendAlarm();
513 void beamDone( Ir *ir ); 515 void beamDone( Ir *ir );
514 /** Select a view or adapt the current view to display the specified dates. */ 516 /** Select a view or adapt the current view to display the specified dates. */
@@ -562,76 +564,76 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
562 bool flag_clearallviewsupdateView; 564 bool flag_clearallviewsupdateView;
563 QDateTime mNextAlarmDateTime; 565 QDateTime mNextAlarmDateTime;
564 bool mViewerCallerIsSearchDialog; 566 bool mViewerCallerIsSearchDialog;
565 bool mBlockShowDates; 567 bool mBlockShowDates;
566 KSyncManager* mSyncManager; 568 KSyncManager* mSyncManager;
567 AlarmDialog * mAlarmDialog; 569 AlarmDialog * mAlarmDialog;
568 QString mAlarmNotification; 570 QString mAlarmNotification;
569 QString mSuspendAlarmNotification; 571 QString mSuspendAlarmNotification;
570 QTimer* mSuspendTimer; 572 QTimer* mSuspendTimer;
571 QTimer* mAlarmTimer; 573 QTimer* mAlarmTimer;
572 QTimer* mRecheckAlarmTimer; 574 QTimer* mRecheckAlarmTimer;
573 void computeAlarm( QString ); 575 void computeAlarm( QString );
574 void startAlarm( QString, QString ); 576 void startAlarm( QString, QString );
575 void setSyncEventsReadOnly(); 577 void setSyncEventsReadOnly();
576 578
577 QDateTime loadedFileVersion; 579 QDateTime loadedFileVersion;
578 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 580 void checkExternSyncEvent( Q3PtrList<Event> lastSync , Incidence* toDelete );
579 void checkExternalId( Incidence * inc ); 581 void checkExternalId( Incidence * inc );
580 int mGlobalSyncMode; 582 int mGlobalSyncMode;
581 QString mCurrentSyncDevice; 583 QString mCurrentSyncDevice;
582 QString mCurrentSyncName; 584 QString mCurrentSyncName;
583 void init(); 585 void init();
584 int mDatePickerMode; 586 int mDatePickerMode;
585 bool mFlagEditDescription; 587 bool mFlagEditDescription;
586 QDateTime mLastCalendarSync; 588 QDateTime mLastCalendarSync;
587 void createPrinter(); 589 void createPrinter();
588 590
589 void calendarModified( bool, Calendar * ); 591 void calendarModified( bool, Calendar * );
590 592
591 CalPrinter *mCalPrinter; 593 CalPrinter *mCalPrinter;
592 594
593 QSplitter *mPanner; 595 QSplitter *mPanner;
594 QSplitter *mLeftSplitter; 596 QSplitter *mLeftSplitter;
595 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; 597 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame;
596 QWidgetStack *mRightFrame; 598 Q3WidgetStack *mRightFrame;
597 599
598 KDatePicker* mDatePicker; 600 KDatePicker* mDatePicker;
599 QVBox* mDateFrame; 601 Q3VBox* mDateFrame;
600 602
601 DateNavigatorContainer *mDateNavigator; // widget showing small month view. 603 DateNavigatorContainer *mDateNavigator; // widget showing small month view.
602 604
603 KOFilterView *mFilterView; 605 KOFilterView *mFilterView;
604 KOCalEditView *mCalEditView; 606 KOCalEditView *mCalEditView;
605 607
606 ResourceView *mResourceView; 608 ResourceView *mResourceView;
607 609
608 // calendar object for this viewing instance 610 // calendar object for this viewing instance
609 Calendar *mCalendar; 611 Calendar *mCalendar;
610 612
611 CalendarResourceManager *mResourceManager; 613 CalendarResourceManager *mResourceManager;
612 614
613 FileStorage *mStorage; 615 FileStorage *mStorage;
614 616
615 DateNavigator *mNavigator; 617 DateNavigator *mNavigator;
616 618
617 KOViewManager *mViewManager; 619 KOViewManager *mViewManager;
618 KODialogManager *mDialogManager; 620 KODialogManager *mDialogManager;
619 621
620 // Calendar filters 622 // Calendar filters
621 QPtrList<CalFilter> mFilters; 623 Q3PtrList<CalFilter> mFilters;
622 624
623 // various housekeeping variables. 625 // various housekeeping variables.
624 bool mModified; // flag indicating if calendar is modified 626 bool mModified; // flag indicating if calendar is modified
625 bool mReadOnly; // flag indicating if calendar is read-only 627 bool mReadOnly; // flag indicating if calendar is read-only
626 QDate mSaveSingleDate; 628 QDate mSaveSingleDate;
627 629
628 Incidence *mSelectedIncidence; 630 Incidence *mSelectedIncidence;
629 Incidence *mMoveIncidence; 631 Incidence *mMoveIncidence;
630 QDate mMoveIncidenceOldDate; 632 QDate mMoveIncidenceOldDate;
631 KOTodoView *mTodoList; 633 KOTodoView *mTodoList;
632 KOEventEditor * mEventEditor; 634 KOEventEditor * mEventEditor;
633 KOTodoEditor * mTodoEditor; 635 KOTodoEditor * mTodoEditor;
634 KOEventViewerDialog * mEventViewerDialog; 636 KOEventViewerDialog * mEventViewerDialog;
635 void keyPressEvent ( QKeyEvent *e) ; 637 void keyPressEvent ( QKeyEvent *e) ;
636 //QMap<Incidence*,KOIncidenceEditor*> mDialogList; 638 //QMap<Incidence*,KOIncidenceEditor*> mDialogList;
637}; 639};
diff --git a/korganizer/calprintbase.cpp b/korganizer/calprintbase.cpp
index 7b7d54c..ecb9e03 100644
--- a/korganizer/calprintbase.cpp
+++ b/korganizer/calprintbase.cpp
@@ -12,37 +12,39 @@
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qframe.h> 28#include <q3frame.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qptrlist.h> 30#include <q3ptrlist.h>
31#include <qintdict.h> 31#include <q3intdict.h>
32#include <qfontmetrics.h> 32#include <qfontmetrics.h>
33//Added by qt3to4:
34#include <Q3VBoxLayout>
33 35
34#include <kglobal.h> 36#include <kglobal.h>
35#include <klocale.h> 37#include <klocale.h>
36#include <kdebug.h> 38#include <kdebug.h>
37#include <kconfig.h> 39#include <kconfig.h>
38#include <kcalendarsystem.h> 40#include <kcalendarsystem.h>
39#include <kprinter.h> 41#include <kprinter.h>
40 42
41#include <libkcal/todo.h> 43#include <libkcal/todo.h>
42#include <libkcal/event.h> 44#include <libkcal/event.h>
43#include <libkcal/calendar.h> 45#include <libkcal/calendar.h>
44 46
45#include "koprefs.h" 47#include "koprefs.h"
46#include "koglobals.h" 48#include "koglobals.h"
47#ifndef KORG_NOPLUGINS 49#ifndef KORG_NOPLUGINS
48#include "kocore.h" 50#include "kocore.h"
@@ -132,34 +134,34 @@ void setCategoryColors( QPainter &p, Incidence *incidence)
132 134
133 135
134 136
135CalPrintBase::CalPrintBase( KPrinter *printer, Calendar *cal, KConfig *cfg ) 137CalPrintBase::CalPrintBase( KPrinter *printer, Calendar *cal, KConfig *cfg )
136 : QObject(), mPrinter( printer ), mCalendar( cal ), mConfig( cfg ) 138 : QObject(), mPrinter( printer ), mCalendar( cal ), mConfig( cfg )
137{ 139{
138} 140}
139 141
140CalPrintBase::~CalPrintBase() 142CalPrintBase::~CalPrintBase()
141{ 143{
142} 144}
143 145
144 146
145 147
146QWidget *CalPrintBase::configWidget( QWidget *w ) 148QWidget *CalPrintBase::configWidget( QWidget *w )
147{ 149{
148 QFrame *wdg = new QFrame( w ); 150 Q3Frame *wdg = new Q3Frame( w );
149 QVBoxLayout *layout = new QVBoxLayout( wdg ); 151 Q3VBoxLayout *layout = new Q3VBoxLayout( wdg );
150 152
151 QLabel *title = new QLabel( description(), wdg ); 153 QLabel *title = new QLabel( description(), wdg );
152 QFont titleFont( title->font() ); 154 QFont titleFont( title->font() );
153 titleFont.setPointSize( 20 ); 155 titleFont.setPointSize( 20 );
154 titleFont.setBold( true ); 156 titleFont.setBold( true );
155 title->setFont( titleFont ); 157 title->setFont( titleFont );
156 158
157 layout->addWidget( title ); 159 layout->addWidget( title );
158 layout->addWidget( new QLabel( longDescription(), wdg ) ); 160 layout->addWidget( new QLabel( longDescription(), wdg ) );
159 layout->addSpacing( 20 ); 161 layout->addSpacing( 20 );
160 layout->addWidget( new QLabel( i18n("This printing style does not " 162 layout->addWidget( new QLabel( i18n("This printing style does not "
161 "have any configuration options."), 163 "have any configuration options."),
162 wdg ) ); 164 wdg ) );
163 layout->addStretch(); 165 layout->addStretch();
164 return wdg; 166 return wdg;
165} 167}
@@ -272,66 +274,66 @@ void CalPrintBase::drawHeader( QPainter &p, QString title,
272 p.drawText( textRect, Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak, title ); 274 p.drawText( textRect, Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak, title );
273} 275}
274 276
275 277
276void CalPrintBase::drawSmallMonth(QPainter &p, const QDate &qd, 278void CalPrintBase::drawSmallMonth(QPainter &p, const QDate &qd,
277 int x, int y, int width, int height) 279 int x, int y, int width, int height)
278{ 280{
279 bool firstCol = true; 281 bool firstCol = true;
280 QDate monthDate(QDate(qd.year(), qd.month(), 1)); 282 QDate monthDate(QDate(qd.year(), qd.month(), 1));
281 QDate monthDate2; 283 QDate monthDate2;
282 int month = monthDate.month(); 284 int month = monthDate.month();
283 285
284 // draw the title 286 // draw the title
285 p.setFont(QFont("helvetica", 7, QFont::Bold)); 287 p.setFont(QFont("helvetica", 7, QFont::Bold));
286 // int lineSpacing = p.fontMetrics().lineSpacing(); 288 // int lineSpacing = p.fontMetrics().lineSpacing();
287 const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); 289 const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem();
288 p.drawText(x, y, width, height/4, AlignCenter, calSys->monthName( qd ) ); 290 p.drawText(x, y, width, height/4, Qt::AlignCenter, calSys->monthName( qd ) );
289 291
290 int cellWidth = width/7; 292 int cellWidth = width/7;
291 int cellHeight = height/8; 293 int cellHeight = height/8;
292 QString tmpStr; 294 QString tmpStr;
293 295
294 // correct begin of week 296 // correct begin of week
295 int weekdayCol = weekdayColumn( qd.dayOfWeek() ); 297 int weekdayCol = weekdayColumn( qd.dayOfWeek() );
296 monthDate2 = monthDate.addDays(-weekdayCol); 298 monthDate2 = monthDate.addDays(-weekdayCol);
297 299
298 // draw days of week 300 // draw days of week
299 p.setFont(QFont("helvetica", 7, QFont::Bold)); 301 p.setFont(QFont("helvetica", 7, QFont::Bold));
300 for (int col = 0; col < 7; col++) { 302 for (int col = 0; col < 7; col++) {
301 // tmpStr.sprintf("%c",(const char*)monthDate2.dayName(monthDate2.dayOfWeek())); 303 // tmpStr.sprintf("%c",(const char*)monthDate2.dayName(monthDate2.dayOfWeek()));
302 tmpStr=calSys->weekDayName( monthDate2 )[0].upper(); 304 tmpStr=calSys->weekDayName( monthDate2 )[0].upper();
303 p.drawText(x+col*cellWidth, y+height/4, cellWidth, cellHeight, 305 p.drawText(x+col*cellWidth, y+height/4, cellWidth, cellHeight,
304 AlignCenter, tmpStr); 306 Qt::AlignCenter, tmpStr);
305 monthDate2 = monthDate2.addDays(1); 307 monthDate2 = monthDate2.addDays(1);
306 } 308 }
307 309
308 // draw separator line 310 // draw separator line
309 p.drawLine(x, y+height/4+cellHeight, x+width, y+height/4+cellHeight); 311 p.drawLine(x, y+height/4+cellHeight, x+width, y+height/4+cellHeight);
310 312
311 for (int row = 0; row < 5; row++) { 313 for (int row = 0; row < 5; row++) {
312 for (int col = 0; col < 7; col++) { 314 for (int col = 0; col < 7; col++) {
313 if (monthDate.month() != month) 315 if (monthDate.month() != month)
314 break; 316 break;
315 if (firstCol) { 317 if (firstCol) {
316 firstCol = true; 318 firstCol = true;
317 col = weekdayColumn( monthDate.dayOfWeek() ); 319 col = weekdayColumn( monthDate.dayOfWeek() );
318 } 320 }
319 p.drawText( x+col*cellWidth, 321 p.drawText( x+col*cellWidth,
320 y+height/4+cellHeight+(row*cellHeight), 322 y+height/4+cellHeight+(row*cellHeight),
321 cellWidth, cellHeight, AlignCenter, 323 cellWidth, cellHeight, Qt::AlignCenter,
322 tmpStr.setNum(monthDate.day()) ); 324 tmpStr.setNum(monthDate.day()) );
323 monthDate = monthDate.addDays(1); 325 monthDate = monthDate.addDays(1);
324 } 326 }
325 } 327 }
326} 328}
327 329
328 330
329/////////////////////////////////////////////////////////////////////////////// 331///////////////////////////////////////////////////////////////////////////////
330 332
331/* 333/*
332 * This routine draws a header box over the main part of the calendar 334 * This routine draws a header box over the main part of the calendar
333 * containing the days of the week. 335 * containing the days of the week.
334 */ 336 */
335void CalPrintBase::drawDaysOfWeek(QPainter &p, 337void CalPrintBase::drawDaysOfWeek(QPainter &p,
336 const QDate &fromDate, const QDate &toDate, 338 const QDate &fromDate, const QDate &toDate,
337 int x, int y, int width, int height) 339 int x, int y, int width, int height)
@@ -345,33 +347,33 @@ void CalPrintBase::drawDaysOfWeek(QPainter &p,
345 currx+=cellWidth; 347 currx+=cellWidth;
346 cellDate = cellDate.addDays(1); 348 cellDate = cellDate.addDays(1);
347 } 349 }
348} 350}
349 351
350 352
351void CalPrintBase::drawDaysOfWeekBox(QPainter &p, const QDate &qd, 353void CalPrintBase::drawDaysOfWeekBox(QPainter &p, const QDate &qd,
352 int x, int y, int width, int height) 354 int x, int y, int width, int height)
353{ 355{
354 const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); 356 const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem();
355 357
356 p.setFont( QFont( "helvetica", 10, QFont::Bold ) ); 358 p.setFont( QFont( "helvetica", 10, QFont::Bold ) );
357 p.drawRect( x, y, width, height ); 359 p.drawRect( x, y, width, height );
358// p.fillRect( x+1, y+1, 360// p.fillRect( x+1, y+1,
359// width-2, height-2, 361// width-2, height-2,
360// QBrush( Dense7Pattern ) ); 362// QBrush( Dense7Pattern ) );
361 p.drawText( x+5, y, width-10, height, AlignCenter | AlignVCenter, 363 p.drawText( x+5, y, width-10, height, Qt::AlignCenter | Qt::AlignVCenter,
362 calSys->weekDayName( qd ) ); 364 calSys->weekDayName( qd ) );
363} 365}
364 366
365 367
366void CalPrintBase::drawTimeLine(QPainter &p, 368void CalPrintBase::drawTimeLine(QPainter &p,
367 const QTime &fromTime, const QTime &toTime, 369 const QTime &fromTime, const QTime &toTime,
368 int x, int y, int width, int height) 370 int x, int y, int width, int height)
369{ 371{
370 p.drawRect(x, y, width, height); 372 p.drawRect(x, y, width, height);
371 373
372 int totalsecs=fromTime.secsTo(toTime); 374 int totalsecs=fromTime.secsTo(toTime);
373 float minlen=(float)height*60./(float)totalsecs; 375 float minlen=(float)height*60./(float)totalsecs;
374 float cellHeight=(60.*(float)minlen); 376 float cellHeight=(60.*(float)minlen);
375 float currY=y; 377 float currY=y;
376 378
377 QTime curTime( fromTime ); 379 QTime curTime( fromTime );
@@ -388,42 +390,42 @@ void CalPrintBase::drawTimeLine(QPainter &p,
388 390
389 while ( curTime < endTime ) { 391 while ( curTime < endTime ) {
390 p.drawLine( x, (int)currY, x+width, (int)currY ); 392 p.drawLine( x, (int)currY, x+width, (int)currY );
391 int newY=(int)(currY+cellHeight/2.); 393 int newY=(int)(currY+cellHeight/2.);
392 QString numStr; 394 QString numStr;
393 if (newY < y+height) { 395 if (newY < y+height) {
394 p.drawLine(x+width/2, (int)newY, x+width, (int)newY); 396 p.drawLine(x+width/2, (int)newY, x+width, (int)newY);
395 // draw the time: 397 // draw the time:
396 if ( !KGlobal::locale()->use12Clock() ) { 398 if ( !KGlobal::locale()->use12Clock() ) {
397 numStr.setNum(curTime.hour()); 399 numStr.setNum(curTime.hour());
398 if (cellHeight > 30) { 400 if (cellHeight > 30) {
399 p.setFont(QFont("helvetica", 16, QFont::Bold)); 401 p.setFont(QFont("helvetica", 16, QFont::Bold));
400 } else { 402 } else {
401 p.setFont(QFont("helvetica", 12, QFont::Bold)); 403 p.setFont(QFont("helvetica", 12, QFont::Bold));
402 } 404 }
403 p.drawText(x+2, (int)currY+2, width/2-2, (int)cellHeight, 405 p.drawText(x+2, (int)currY+2, width/2-2, (int)cellHeight,
404 AlignTop|AlignRight, numStr); 406 Qt::AlignTop|Qt::AlignRight, numStr);
405 p.setFont(QFont("helvetica", 10, QFont::Normal)); 407 p.setFont(QFont("helvetica", 10, QFont::Normal));
406 p.drawText(x+width/2, (int)currY+2, width/2+2, (int)(cellHeight/2)-3, 408 p.drawText(x+width/2, (int)currY+2, width/2+2, (int)(cellHeight/2)-3,
407 AlignTop | AlignLeft, "00"); 409 Qt::AlignTop | Qt::AlignLeft, "00");
408 } else { 410 } else {
409 QTime time( curTime.hour(), 0 ); 411 QTime time( curTime.hour(), 0 );
410 numStr = KGlobal::locale()->formatTime( time ); 412 numStr = KGlobal::locale()->formatTime( time );
411 p.setFont(QFont("helvetica", 14, QFont::Bold)); 413 p.setFont(QFont("helvetica", 14, QFont::Bold));
412 p.drawText(x+2, (int)currY+2, width-4, (int)cellHeight/2-3, 414 p.drawText(x+2, (int)currY+2, width-4, (int)cellHeight/2-3,
413 AlignTop|AlignLeft, numStr); 415 Qt::AlignTop|Qt::AlignLeft, numStr);
414 } 416 }
415 currY+=cellHeight; 417 currY+=cellHeight;
416 } // enough space for half-hour line and time 418 } // enough space for half-hour line and time
417 if (curTime.secsTo(endTime)>3600) 419 if (curTime.secsTo(endTime)>3600)
418 curTime=curTime.addSecs(3600); 420 curTime=curTime.addSecs(3600);
419 else curTime=endTime; 421 else curTime=endTime;
420 } // currTime<endTime 422 } // currTime<endTime
421} 423}
422 424
423 425
424/////////////////////////////////////////////////////////////////////////////// 426///////////////////////////////////////////////////////////////////////////////
425 427
426/** prints the all-day box for the agenda print view. if expandable is set, 428/** prints the all-day box for the agenda print view. if expandable is set,
427 height is the cell height of a single cell, and the returned height will 429 height is the cell height of a single cell, and the returned height will
428 be the total height used for the all-day events. If !expandable, only one 430 be the total height used for the all-day events. If !expandable, only one
429 cell will be used, and multiple events are concatenated using ", ". 431 cell will be used, and multiple events are concatenated using ", ".
@@ -459,54 +461,54 @@ void CalPrintBase::drawAllDayBox(QPainter &p, Event::List &eventList,
459 while( it!=eventList.end() ) { 461 while( it!=eventList.end() ) {
460 currEvent=*it; 462 currEvent=*it;
461 itold=it; 463 itold=it;
462 ++it; 464 ++it;
463 if ( currEvent->doesFloat() ) { 465 if ( currEvent->doesFloat() ) {
464 // set the colors according to the categories 466 // set the colors according to the categories
465 QString text = currEvent->summary() ; 467 QString text = currEvent->summary() ;
466 if ( ! currEvent->location().isEmpty() ) 468 if ( ! currEvent->location().isEmpty() )
467 text += " ("+currEvent->location()+")"; 469 text += " ("+currEvent->location()+")";
468 if (expandable) { 470 if (expandable) {
469 if (mUseColors) 471 if (mUseColors)
470 setCategoryColors(p, currEvent); 472 setCategoryColors(p, currEvent);
471 473
472 p.drawRect( x, offset, width, height ); 474 p.drawRect( x, offset, width, height );
473 475
474 p.drawText( x+5, offset+5, width-10, height-10, 476 p.drawText( x+5, offset+5, width-10, height-10,
475 AlignCenter | AlignVCenter | AlignJustify | WordBreak, 477 Qt::AlignCenter | Qt::AlignVCenter | Qt::AlignJustify | Qt::WordBreak,
476 text ); 478 text );
477 // reset the colors 479 // reset the colors
478 p.setBrush( oldBrush ); 480 p.setBrush( oldBrush );
479 p.setPen( oldPen ); 481 p.setPen( oldPen );
480 p.setBackgroundColor(oldBgColor); 482 p.setBackgroundColor(oldBgColor);
481 483
482 offset += height; 484 offset += height;
483 } else { 485 } else {
484 //if (!multiDayStr.isEmpty()) multiDayStr+=", "; 486 //if (!multiDayStr.isEmpty()) multiDayStr+=", ";
485 multiDayStr += text+"\n"; 487 multiDayStr += text+"\n";
486 } 488 }
487 eventList.remove( itold ); 489 eventList.remove( itold );
488 } 490 }
489 } 491 }
490 492
491 if (!expandable) { 493 if (!expandable) {
492 p.drawRect(x, offset, width, height); 494 p.drawRect(x, offset, width, height);
493 if (!multiDayStr.isEmpty()) { 495 if (!multiDayStr.isEmpty()) {
494 // p.fillRect(x+1, offset+1, width-2, height-2, QBrush(Dense5Pattern) ); 496 // p.fillRect(x+1, offset+1, width-2, height-2, QBrush(Dense5Pattern) );
495 p.drawText( x+5, offset+5, width-10, height-10, 497 p.drawText( x+5, offset+5, width-10, height-10,
496 AlignLeft | AlignTop | AlignJustify , 498 Qt::AlignLeft | Qt::AlignTop | Qt::AlignJustify ,
497 multiDayStr); 499 multiDayStr);
498 } 500 }
499 } else { 501 } else {
500 height=offset-y; 502 height=offset-y;
501 } 503 }
502} 504}
503 505
504 506
505void CalPrintBase::drawAgendaDayBox( QPainter &p, Event::List &events, 507void CalPrintBase::drawAgendaDayBox( QPainter &p, Event::List &events,
506 const QDate &qd, bool expandable, 508 const QDate &qd, bool expandable,
507 QTime &fromTime, QTime &toTime, 509 QTime &fromTime, QTime &toTime,
508 int x, int y, int width, int height ) 510 int x, int y, int width, int height )
509{ 511{
510 p.drawRect( x, y, width, height ); 512 p.drawRect( x, y, width, height );
511 513
512 Event *event; 514 Event *event;
@@ -547,66 +549,66 @@ void CalPrintBase::drawAgendaDayBox( QPainter &p, Event::List &events,
547 p.setPen( QColor( 192, 192, 192 ) ); 549 p.setPen( QColor( 192, 192, 192 ) );
548 p.drawLine( x, int( currY ), x + width, int( currY ) ); 550 p.drawLine( x, int( currY ), x + width, int( currY ) );
549 p.setPen( oldPen ); 551 p.setPen( oldPen );
550 } // enough space for half-hour line 552 } // enough space for half-hour line
551 if ( curTime.secsTo( toTime ) > 3600 ) 553 if ( curTime.secsTo( toTime ) > 3600 )
552 curTime = curTime.addSecs( 3600 ); 554 curTime = curTime.addSecs( 3600 );
553 else curTime = toTime; 555 else curTime = toTime;
554 currY += cellHeight / 2; 556 currY += cellHeight / 2;
555 } 557 }
556 558
557 QDateTime startPrintDate = QDateTime( qd, fromTime ); 559 QDateTime startPrintDate = QDateTime( qd, fromTime );
558 QDateTime endPrintDate = QDateTime( qd, toTime ); 560 QDateTime endPrintDate = QDateTime( qd, toTime );
559 561
560 // Calculate horizontal positions and widths of events taking into account 562 // Calculate horizontal positions and widths of events taking into account
561 // overlapping events 563 // overlapping events
562 564
563 QPtrList<KOrg::CellItem> cells; 565 Q3PtrList<KOrg::CellItem> cells;
564 cells.setAutoDelete( true ); 566 cells.setAutoDelete( true );
565 567
566 Event::List::ConstIterator itEvents; 568 Event::List::ConstIterator itEvents;
567 for( itEvents = events.begin(); itEvents != events.end(); ++itEvents ) { 569 for( itEvents = events.begin(); itEvents != events.end(); ++itEvents ) {
568 cells.append( new PrintCellItem( *itEvents, qd ) ); 570 cells.append( new PrintCellItem( *itEvents, qd ) );
569 } 571 }
570 572
571 QPtrListIterator<KOrg::CellItem> it1( cells ); 573 Q3PtrListIterator<KOrg::CellItem> it1( cells );
572 for( it1.toFirst(); it1.current(); ++it1 ) { 574 for( it1.toFirst(); it1.current(); ++it1 ) {
573 KOrg::CellItem *placeItem = it1.current(); 575 KOrg::CellItem *placeItem = it1.current();
574 576
575 KOrg::CellItem::placeItem( cells, placeItem ); 577 KOrg::CellItem::placeItem( cells, placeItem );
576 } 578 }
577 579
578 QPen oldPen = p.pen(); 580 QPen oldPen = p.pen();
579 QColor oldBgColor = p.backgroundColor(); 581 QColor oldBgColor = p.backgroundColor();
580 QBrush oldBrush = p.brush(); 582 QBrush oldBrush = p.brush();
581 583
582 p.setFont( QFont( "helvetica", 10 ) ); 584 p.setFont( QFont( "helvetica", 10 ) );
583 //p.setBrush( QBrush( Dense7Pattern ) ); 585 //p.setBrush( QBrush( Dense7Pattern ) );
584 586
585 for( it1.toFirst(); it1.current(); ++it1 ) { 587 for( it1.toFirst(); it1.current(); ++it1 ) {
586 PrintCellItem *placeItem = static_cast<PrintCellItem *>( it1.current() ); 588 PrintCellItem *placeItem = static_cast<PrintCellItem *>( it1.current() );
587 589
588 drawAgendaItem( placeItem, p, qd, startPrintDate, endPrintDate, minlen, x, 590 drawAgendaItem( placeItem, p, qd, startPrintDate, endPrintDate, minlen, x,
589 y, width ); 591 y, width );
590 592
591 p.setBrush( oldBrush ); 593 p.setBrush( oldBrush );
592 p.setPen( oldPen ); 594 p.setPen( oldPen );
593 p.setBackgroundColor( oldBgColor ); 595 p.setBackgroundColor( oldBgColor );
594 } 596 }
595 597
596 p.setBrush( QBrush( NoBrush ) ); 598 p.setBrush( QBrush( Qt::NoBrush ) );
597} 599}
598 600
599 601
600void CalPrintBase::drawAgendaItem( PrintCellItem *item, QPainter &p, 602void CalPrintBase::drawAgendaItem( PrintCellItem *item, QPainter &p,
601 const QDate &qd, 603 const QDate &qd,
602 const QDateTime &startPrintDate, 604 const QDateTime &startPrintDate,
603 const QDateTime &endPrintDate, 605 const QDateTime &endPrintDate,
604 float minlen, int x, int y, int width ) 606 float minlen, int x, int y, int width )
605{ 607{
606 Event *event = item->event(); 608 Event *event = item->event();
607 609
608 // set the colors according to the categories 610 // set the colors according to the categories
609 if ( mUseColors ) setCategoryColors( p, event ); 611 if ( mUseColors ) setCategoryColors( p, event );
610 else p.setBrush( Qt::white ); 612 else p.setBrush( Qt::white );
611 // start/end of print area for event 613 // start/end of print area for event
612 QDateTime startTime = event->dtStart(); 614 QDateTime startTime = event->dtStart();
@@ -622,33 +624,33 @@ void CalPrintBase::drawAgendaItem( PrintCellItem *item, QPainter &p,
622 int eventLength = int( startTime.secsTo( endTime ) / 60. * minlen ); 624 int eventLength = int( startTime.secsTo( endTime ) / 60. * minlen );
623 int currentyPos = int( y + startPrintDate.secsTo( startTime ) * 625 int currentyPos = int( y + startPrintDate.secsTo( startTime ) *
624 minlen / 60. ); 626 minlen / 60. );
625 int currentWidth = width / item->subCells(); 627 int currentWidth = width / item->subCells();
626 int currentX = x + item->subCell() * currentWidth; 628 int currentX = x + item->subCell() * currentWidth;
627 QString text = KGlobal::locale()->formatTime(event->dtStart().time())+ 629 QString text = KGlobal::locale()->formatTime(event->dtStart().time())+
628 "-"+KGlobal::locale()->formatTime(event->dtEnd().time())+ 630 "-"+KGlobal::locale()->formatTime(event->dtEnd().time())+
629 " "+event->summary(); 631 " "+event->summary();
630 if ( !event->location().isEmpty() ) 632 if ( !event->location().isEmpty() )
631 text += " (" +event->location()+")"; 633 text += " (" +event->location()+")";
632 // p.save(); 634 // p.save();
633 QPen pe = p.pen(); 635 QPen pe = p.pen();
634 pe.setWidth( 2 ); 636 pe.setWidth( 2 );
635 p.setPen( pe ); 637 p.setPen( pe );
636 p.drawRect( currentX, currentyPos+1, currentWidth+1, eventLength+1 ); 638 p.drawRect( currentX, currentyPos+1, currentWidth+1, eventLength+1 );
637 p.drawText( currentX+3, currentyPos+2, currentWidth-5, eventLength-3, 639 p.drawText( currentX+3, currentyPos+2, currentWidth-5, eventLength-3,
638 AlignLeft | AlignTop | AlignJustify | WordBreak, 640 Qt::AlignLeft | Qt::AlignTop | Qt::AlignJustify | Qt::TextWordWrap,
639 text); 641 text);
640 // p.restore(); 642 // p.restore();
641 } 643 }
642} 644}
643 645
644void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, 646void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd,
645 int x, int y, int width, int height, 647 int x, int y, int width, int height,
646 bool fullDate) 648 bool fullDate)
647{ 649{
648 QString dayNumStr; 650 QString dayNumStr;
649 QString ampm; 651 QString ampm;
650 const KLocale*local = KGlobal::locale(); 652 const KLocale*local = KGlobal::locale();
651 653
652 654
653 // This has to be localized 655 // This has to be localized
654 if (fullDate) { 656 if (fullDate) {
@@ -657,43 +659,43 @@ void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd,
657 dayNumStr = QString::number( qd.day() ); 659 dayNumStr = QString::number( qd.day() );
658 } 660 }
659 661
660 p.eraseRect( x, y, width, height ); 662 p.eraseRect( x, y, width, height );
661 p.drawRect( x, y, width, height ); 663 p.drawRect( x, y, width, height );
662 // p.fillRect( x+1, y+1, width-2,height, QBrush(Dense7Pattern) ); 664 // p.fillRect( x+1, y+1, width-2,height, QBrush(Dense7Pattern) );
663 p.drawRect( x, y, width, mSubHeaderHeight ); 665 p.drawRect( x, y, width, mSubHeaderHeight );
664 //p.fillRect( x+1, y+1, width-2, mSubHeaderHeight-2, QBrush(Dense7Pattern) ); 666 //p.fillRect( x+1, y+1, width-2, mSubHeaderHeight-2, QBrush(Dense7Pattern) );
665 QString hstring; 667 QString hstring;
666#ifndef KORG_NOPLUGINS 668#ifndef KORG_NOPLUGINS
667 hstring=KOCore::self()->holiday(qd); 669 hstring=KOCore::self()->holiday(qd);
668#endif 670#endif
669 671
670 if (!hstring.isEmpty()) { 672 if (!hstring.isEmpty()) {
671 p.setFont( QFont( "helvetica", 8, QFont::Bold, true ) ); 673 p.setFont( QFont( "helvetica", 8, QFont::Bold, true ) );
672 674
673 p.drawText( x+5, y, width-25, mSubHeaderHeight, AlignLeft | AlignVCenter, 675 p.drawText( x+5, y, width-25, mSubHeaderHeight, Qt::AlignLeft | Qt::AlignVCenter,
674 hstring ); 676 hstring );
675 } 677 }
676 p.setFont(QFont("helvetica", 10, QFont::Bold)); 678 p.setFont(QFont("helvetica", 10, QFont::Bold));
677 if ( fullDate) { 679 if ( fullDate) {
678 // use short date format, if long date is too long 680 // use short date format, if long date is too long
679 QFontMetrics fm ( p.font() ); 681 QFontMetrics fm ( p.font() );
680 if ( fm.width( dayNumStr ) > width -10 ) 682 if ( fm.width( dayNumStr ) > width -10 )
681 dayNumStr = local->formatDate(qd, true); 683 dayNumStr = local->formatDate(qd, true);
682 } 684 }
683 p.drawText(x+5, y, width-10, mSubHeaderHeight, AlignRight | AlignVCenter, 685 p.drawText(x+5, y, width-10, mSubHeaderHeight, Qt::AlignRight | Qt::AlignVCenter,
684 dayNumStr); 686 dayNumStr);
685 Event::List eventList; 687 Event::List eventList;
686 eventList.fill( mCalendar->events( qd, true )); 688 eventList.fill( mCalendar->events( qd, true ));
687 Todo::List todos; 689 Todo::List todos;
688 todos.fill( mCalendar->todos( qd )); 690 todos.fill( mCalendar->todos( qd ));
689 QString outStr; 691 QString outStr;
690 p.setFont( QFont( "helvetica", 8 ) ); 692 p.setFont( QFont( "helvetica", 8 ) );
691 int lineSpacing = p.fontMetrics().lineSpacing(); 693 int lineSpacing = p.fontMetrics().lineSpacing();
692 694
693 int textY=mSubHeaderHeight+3; // gives the relative y-coord of the next printed entry 695 int textY=mSubHeaderHeight+3; // gives the relative y-coord of the next printed entry
694 Event::List::ConstIterator it; 696 Event::List::ConstIterator it;
695 int entryCount = eventList.count() +todos.count(); 697 int entryCount = eventList.count() +todos.count();
696 if ( p.fontMetrics().lineSpacing()* entryCount > height-textY ) { 698 if ( p.fontMetrics().lineSpacing()* entryCount > height-textY ) {
697 if ( (p.fontMetrics().lineSpacing()-1) * entryCount > height-textY ) { 699 if ( (p.fontMetrics().lineSpacing()-1) * entryCount > height-textY ) {
698 p.setFont( QFont( "helvetica", 7 ) ); 700 p.setFont( QFont( "helvetica", 7 ) );
699 if ( (p.fontMetrics().lineSpacing()-1) * entryCount > height-textY ) 701 if ( (p.fontMetrics().lineSpacing()-1) * entryCount > height-textY )
@@ -711,52 +713,52 @@ void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd,
711 if ( fullDate ) { 713 if ( fullDate ) {
712 outStr = KGlobal::locale()->formatTime( currEvent->dtStart().time())+ 714 outStr = KGlobal::locale()->formatTime( currEvent->dtStart().time())+
713 "-"+KGlobal::locale()->formatTime( currEvent->dtEnd().time())+ 715 "-"+KGlobal::locale()->formatTime( currEvent->dtEnd().time())+
714 " "+ currEvent->summary(); 716 " "+ currEvent->summary();
715 if ( ! currEvent->location().isEmpty() ) 717 if ( ! currEvent->location().isEmpty() )
716 outStr += " (" + currEvent->location()+")"; 718 outStr += " (" + currEvent->location()+")";
717 } else { 719 } else {
718 QTime t1 = currEvent->dtStart().time(); 720 QTime t1 = currEvent->dtStart().time();
719 721
720 outStr = local->formatTime(t1); 722 outStr = local->formatTime(t1);
721 outStr += " " + currEvent->summary(); 723 outStr += " " + currEvent->summary();
722 } 724 }
723 725
724 } // doesFloat 726 } // doesFloat
725 727
726 p.drawText(x+5, y+textY, width-10, lineSpacing, 728 p.drawText(x+5, y+textY, width-10, lineSpacing,
727 AlignLeft|AlignBottom, outStr); 729 Qt::AlignLeft|Qt::AlignBottom, outStr);
728 textY+=lineSpacing; 730 textY+=lineSpacing;
729 } 731 }
730 732
731 if ( textY<height ) { 733 if ( textY<height ) {
732 734
733 Todo::List::ConstIterator it2; 735 Todo::List::ConstIterator it2;
734 for( it2 = todos.begin(); it2 != todos.end() && textY<height; ++it2 ) { 736 for( it2 = todos.begin(); it2 != todos.end() && textY<height; ++it2 ) {
735 Todo *todo = *it2; 737 Todo *todo = *it2;
736 QString text; 738 QString text;
737 if (todo->hasDueDate()) { 739 if (todo->hasDueDate()) {
738 if (!todo->doesFloat()) { 740 if (!todo->doesFloat()) {
739 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 741 text += KGlobal::locale()->formatTime(todo->dtDue().time());
740 text += " "; 742 text += " ";
741 } 743 }
742 } 744 }
743 text += i18n("To-Do: %1").arg(todo->summary()); 745 text += i18n("To-Do: %1").arg(todo->summary());
744 746
745 p.drawText(x+5, y+textY, width-10, lineSpacing, 747 p.drawText(x+5, y+textY, width-10, lineSpacing,
746 AlignLeft|AlignBottom, text); 748 Qt::AlignLeft|Qt::AlignBottom, text);
747 textY+=lineSpacing; 749 textY+=lineSpacing;
748 } 750 }
749 } 751 }
750} 752}
751 753
752 754
753/////////////////////////////////////////////////////////////////////////////// 755///////////////////////////////////////////////////////////////////////////////
754 756
755void CalPrintBase::drawWeek(QPainter &p, const QDate &qd, 757void CalPrintBase::drawWeek(QPainter &p, const QDate &qd,
756 int x, int y, int width, int height) 758 int x, int y, int width, int height)
757{ 759{
758 QDate weekDate = qd; 760 QDate weekDate = qd;
759 bool portrait = ( mPrinter->orientation() == KPrinter::Portrait ); 761 bool portrait = ( mPrinter->orientation() == KPrinter::Portrait );
760 int cellWidth, cellHeight; 762 int cellWidth, cellHeight;
761 int vcells; 763 int vcells;
762 if (portrait) { 764 if (portrait) {
@@ -836,33 +838,33 @@ void CalPrintBase::drawMonth(QPainter &p, const QDate &qd, bool weeknumbers,
836 int weekdayCol = weekdayColumn( monthDate.dayOfWeek() ); 838 int weekdayCol = weekdayColumn( monthDate.dayOfWeek() );
837 monthDate = monthDate.addDays(-weekdayCol); 839 monthDate = monthDate.addDays(-weekdayCol);
838 840
839 int rows=(weekdayCol + qd.daysInMonth() - 1)/7 +1; 841 int rows=(weekdayCol + qd.daysInMonth() - 1)/7 +1;
840 int cellHeight = (height-yoffset) / rows; 842 int cellHeight = (height-yoffset) / rows;
841 843
842 if (weeknumbers) { 844 if (weeknumbers) {
843 QFont oldFont(p.font()); 845 QFont oldFont(p.font());
844 QFont newFont(p.font()); 846 QFont newFont(p.font());
845 newFont.setPointSize(7); 847 newFont.setPointSize(7);
846 p.setFont(newFont); 848 p.setFont(newFont);
847 xoffset += 18; 849 xoffset += 18;
848 QDate weekDate(monthDate); 850 QDate weekDate(monthDate);
849 for (int row = 0; row<rows; row++) { 851 for (int row = 0; row<rows; row++) {
850 int calWeek = weekDate.weekNumber(); 852 int calWeek = weekDate.weekNumber();
851 QRect rc(x, y+yoffset+cellHeight*row, xoffset-1, cellHeight); 853 QRect rc(x, y+yoffset+cellHeight*row, xoffset-1, cellHeight);
852 p.drawText( rc, AlignRight|AlignVCenter, QString::number(calWeek) ); 854 p.drawText( rc, Qt::AlignRight|Qt::AlignVCenter, QString::number(calWeek) );
853 weekDate = weekDate.addDays(7); 855 weekDate = weekDate.addDays(7);
854 } 856 }
855 p.setFont(oldFont); 857 p.setFont(oldFont);
856 } 858 }
857 859
858 drawDaysOfWeek( p, monthDate, monthDate.addDays(6), x+xoffset, y, width-xoffset, mSubHeaderHeight ); 860 drawDaysOfWeek( p, monthDate, monthDate.addDays(6), x+xoffset, y, width-xoffset, mSubHeaderHeight );
859 int cellWidth = (width-xoffset) / 7; 861 int cellWidth = (width-xoffset) / 7;
860 862
861 QColor back = p.backgroundColor(); 863 QColor back = p.backgroundColor();
862 bool darkbg = false; 864 bool darkbg = false;
863 for (int row = 0; row < rows; row++) { 865 for (int row = 0; row < rows; row++) {
864 for (int col = 0; col < 7; col++) { 866 for (int col = 0; col < 7; col++) {
865 // show days from previous/next month with a grayed background 867 // show days from previous/next month with a grayed background
866 if ( (monthDate < monthFirst) || (monthDate > monthLast) ) { 868 if ( (monthDate < monthFirst) || (monthDate > monthLast) ) {
867 p.setBackgroundColor( QColor( 240, 240, 240) ); 869 p.setBackgroundColor( QColor( 240, 240, 240) );
868 darkbg = true; 870 darkbg = true;
@@ -884,153 +886,151 @@ void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter &
884 bool desc, int pospriority, int possummary, int posDueDt, int level, 886 bool desc, int pospriority, int possummary, int posDueDt, int level,
885 int x, int &y, int width, int &height, int pageHeight, 887 int x, int &y, int width, int &height, int pageHeight,
886 TodoParentStart *r ) 888 TodoParentStart *r )
887{ 889{
888 if ( !completed && item->isCompleted() ) 890 if ( !completed && item->isCompleted() )
889 return; 891 return;
890 QString outStr; 892 QString outStr;
891// int fontHeight = 10; 893// int fontHeight = 10;
892 const KLocale *local = KGlobal::locale(); 894 const KLocale *local = KGlobal::locale();
893 int priority=item->priority(); 895 int priority=item->priority();
894 int posdue=posDueDt; 896 int posdue=posDueDt;
895 if (posdue<0) posdue=x+width; 897 if (posdue<0) posdue=x+width;
896 QRect rect; 898 QRect rect;
897 TodoParentStart startpt; 899 TodoParentStart startpt;
898 // This list keeps all starting points of the parent todos so the connection 900 // This list keeps all starting points of the parent todos so the connection
899 // lines of the tree can easily be drawn (needed if a new page is started) 901 // lines of the tree can easily be drawn (needed if a new page is started)
900 static QPtrList<TodoParentStart> startPoints; 902 static Q3PtrList<TodoParentStart> startPoints;
901 if (level<1) { 903 if (level<1) {
902 startPoints.clear(); 904 startPoints.clear();
903 } 905 }
904 906
905 // size of item 907 // size of item
906 outStr=item->summary(); 908 outStr=item->summary();
907 if ( ! item->location().isEmpty() ) 909 if ( ! item->location().isEmpty() )
908 outStr += " ("+item->location()+")"; 910 outStr += " ("+item->location()+")";
909 if ( item->hasDueDate() && posDueDt>=0 ) { 911 if ( item->hasDueDate() && posDueDt>=0 ) {
910 outStr += " [" +local->formatDate(item->dtDue().date(),true)+"]"; 912 outStr += " [" +local->formatDate(item->dtDue().date(),true)+"]";
911 } 913 }
912 int left = possummary+(level*10); 914 int left = possummary+(level*10);
913 rect = p.boundingRect(left, y, (posdue-left-5),-1, WordBreak, outStr); 915 rect = p.boundingRect(left, y, (posdue-left-5),-1, Qt::WordBreak, outStr);
914 //qDebug("bottom1 %d ", rect.bottom() ); 916 //qDebug("bottom1 %d ", rect.bottom() );
915 if ( !item->description().isEmpty() && desc ) { 917 if ( !item->description().isEmpty() && desc ) {
916 outStr = item->description(); 918 outStr = item->description();
917 rect = p.boundingRect( left+20, rect.bottom()+5, width-(left+10-x), -1, 919 rect = p.boundingRect( left+20, rect.bottom()+5, width-(left+10-x), -1,
918 WordBreak, outStr ); 920 Qt::WordBreak, outStr );
919 } 921 }
920 //qDebug("bottom2 %d y+h %d y %d ph %d", rect.bottom(), y+height, y , pageHeight ); 922 //qDebug("bottom2 %d y+h %d y %d ph %d", rect.bottom(), y+height, y , pageHeight );
921 // if too big make new page 923 // if too big make new page
922 if ( rect.bottom() > y+height) { 924 if ( rect.bottom() > y+height) {
923 // first draw the connection lines from parent todos: 925 // first draw the connection lines from parent todos:
924 if (level > 0 && connectSubTodos) { 926 if (level > 0 && connectSubTodos) {
925 TodoParentStart *rct; 927 TodoParentStart *rct;
926 for ( rct = startPoints.first(); rct; rct = startPoints.next() ) { 928 for ( rct = startPoints.first(); rct; rct = startPoints.next() ) {
927 int start; 929 int start;
928 int center = rct->mRect.left() + (rct->mRect.width()/2); 930 int center = rct->mRect.left() + (rct->mRect.width()/2);
929 int to = p.viewport().bottom(); 931 int to = p.viewport().bottom();
930 932
931 // draw either from start point of parent or from top of the page 933 // draw either from start point of parent or from top of the page
932 if (rct->mSamePage) 934 if (rct->mSamePage)
933 start = rct->mRect.bottom() + 1; 935 start = rct->mRect.bottom() + 1;
934 else 936 else
935 start = p.viewport().top(); 937 start = p.viewport().top();
936 p.moveTo( center, start ); 938 p.drawLine( center, start, center, to );
937 p.lineTo( center, to );
938 rct->mSamePage=false; 939 rct->mSamePage=false;
939 } 940 }
940 } 941 }
941 y=0; 942 y=0;
942 height=pageHeight-y; 943 height=pageHeight-y;
943 mPrinter->newPage(); 944 mPrinter->newPage();
944 } 945 }
945 946
946 // If this is a sub-item, r will not be 0, and we want the LH side of the priority line up 947 // If this is a sub-item, r will not be 0, and we want the LH side of the priority line up
947 //to the RH side of the parent item's priority 948 //to the RH side of the parent item's priority
948 if (r && pospriority >= 0 ) { 949 if (r && pospriority >= 0 ) {
949 pospriority = r->mRect.right() + 1; 950 pospriority = r->mRect.right() + 1;
950 } 951 }
951 952
952 // Priority 953 // Priority
953 outStr.setNum(priority); 954 outStr.setNum(priority);
954 rect = p.boundingRect(pospriority, y + 10, 5, -1, AlignCenter, outStr); 955 rect = p.boundingRect(pospriority, y + 10, 5, -1, Qt::AlignCenter, outStr);
955 // Make it a more reasonable size 956 // Make it a more reasonable size
956 rect.setWidth(19); 957 rect.setWidth(19);
957 rect.setHeight(19); 958 rect.setHeight(19);
958 if ( priority > 0 && pospriority>=0 ) { 959 if ( priority > 0 && pospriority>=0 ) {
959 p.drawText(rect, AlignCenter, outStr); 960 p.drawText(rect, Qt::AlignCenter, outStr);
960 p.drawRect(rect); 961 p.drawRect(rect);
961 // cross out the rectangle for completed items 962 // cross out the rectangle for completed items
962 if ( item->isCompleted() ) { 963 if ( item->isCompleted() ) {
963 p.drawLine( rect.topLeft(), rect.bottomRight() ); 964 p.drawLine( rect.topLeft(), rect.bottomRight() );
964 p.drawLine( rect.topRight(), rect.bottomLeft() ); 965 p.drawLine( rect.topRight(), rect.bottomLeft() );
965 } else if (item->cancelled() ) { 966 } else if (item->cancelled() ) {
966 QPen pen = p.pen(); 967 QPen pen = p.pen();
967 p.setPen ( QPen ( black, 2) ); 968 p.setPen ( QPen ( Qt::black, 2) );
968 p.drawLine( rect.left()+2,rect.top()+rect.height()/2, rect.right()-2, +rect.top()+rect.height()/2 ); 969 p.drawLine( rect.left()+2,rect.top()+rect.height()/2, rect.right()-2, +rect.top()+rect.height()/2 );
969 p.setPen( pen ); 970 p.setPen( pen );
970 } 971 }
971 } 972 }
972 startpt.mRect = rect; //save for later 973 startpt.mRect = rect; //save for later
973 974
974 // Connect the dots 975 // Connect the dots
975 if (level > 0 && connectSubTodos) { 976 if (level > 0 && connectSubTodos) {
976 int bottom; 977 int bottom;
977 int center( r->mRect.left() + (r->mRect.width()/2)+1 ); 978 int center( r->mRect.left() + (r->mRect.width()/2)+1 );
978 if (r->mSamePage ) 979 if (r->mSamePage )
979 bottom = r->mRect.bottom();//lutz + 1; 980 bottom = r->mRect.bottom();//lutz + 1;
980 else 981 else
981 bottom = 0; 982 bottom = 0;
982 int to( rect.top() + (rect.height()/2)+1 ); 983 int to( rect.top() + (rect.height()/2)+1 );
983 int endx( rect.left() ); 984 int endx( rect.left() );
984 p.moveTo(center, bottom); 985 p.drawLine(center,bottom, center,to);
985 p.lineTo(center, to); 986 p.drawLine(center,to, endx,to);
986 p.lineTo(endx, to);
987 } 987 }
988 988
989 // if completed, use strike out font 989 // if completed, use strike out font
990 // LR does not work - font is underlined, not striked out 990 // LR does not work - font is underlined, not striked out
991 //QFont ft=p.font(); 991 //QFont ft=p.font();
992 //ft.setStrikeOut( item->isCompleted() ); 992 //ft.setStrikeOut( item->isCompleted() );
993 //p.setFont( ft ); 993 //p.setFont( ft );
994 // summary 994 // summary
995 outStr=item->summary(); 995 outStr=item->summary();
996 if ( ! item->location().isEmpty() ) 996 if ( ! item->location().isEmpty() )
997 outStr += " ("+item->location()+")"; 997 outStr += " ("+item->location()+")";
998 if ( item->hasDueDate() && posDueDt>=0 ) { 998 if ( item->hasDueDate() && posDueDt>=0 ) {
999 outStr += " [" +item->dtDueStr(true)+"]"; 999 outStr += " [" +item->dtDueStr(true)+"]";
1000 } 1000 }
1001 rect = p.boundingRect( left, rect.top(), (posdue-(left + rect.width() + 5)), 1001 rect = p.boundingRect( left, rect.top(), (posdue-(left + rect.width() + 5)),
1002 -1, WordBreak, outStr); 1002 -1, Qt::WordBreak, outStr);
1003 QRect newrect; 1003 QRect newrect;
1004 p.drawText( rect, WordBreak, outStr, -1, &newrect ); 1004 p.drawText( rect, Qt::WordBreak, outStr, -1, &newrect );
1005 //ft.setStrikeOut(false); 1005 //ft.setStrikeOut(false);
1006 // p.setFont(ft); 1006 // p.setFont(ft);
1007 1007
1008 // due 1008 // due
1009 // if ( item->hasDueDate() && posDueDt>=0 ) { 1009 // if ( item->hasDueDate() && posDueDt>=0 ) {
1010// outStr = local->formatDate(item->dtDue().date(),true); 1010// outStr = local->formatDate(item->dtDue().date(),true);
1011// rect = p.boundingRect(posdue, y, x+width, -1, AlignTop|AlignLeft, outStr); 1011// rect = p.boundingRect(posdue, y, x+width, -1, AlignTop|AlignLeft, outStr);
1012// p.drawText(rect, AlignTop|AlignLeft, outStr); 1012// p.drawText(rect, AlignTop|AlignLeft, outStr);
1013// } 1013// }
1014 1014
1015 if ( !item->description().isEmpty() && desc ) { 1015 if ( !item->description().isEmpty() && desc ) {
1016 y=newrect.bottom() + 5; 1016 y=newrect.bottom() + 5;
1017 outStr = item->description(); 1017 outStr = item->description();
1018 rect = p.boundingRect( left+20, y, x+width-(left+10), -1, 1018 rect = p.boundingRect( left+20, y, x+width-(left+10), -1,
1019 WordBreak, outStr ); 1019 Qt::WordBreak, outStr );
1020 p.drawText( rect, WordBreak, outStr, -1, &newrect ); 1020 p.drawText( rect, Qt::WordBreak, outStr, -1, &newrect );
1021 } 1021 }
1022 1022
1023 // Set the new line position 1023 // Set the new line position
1024 y=newrect.bottom() + 10; //set the line position 1024 y=newrect.bottom() + 10; //set the line position
1025 1025
1026 // If the item has subitems, we need to call ourselves recursively 1026 // If the item has subitems, we need to call ourselves recursively
1027 Incidence::List l;l.fill( item->relations()); 1027 Incidence::List l;l.fill( item->relations());
1028 Incidence::List::ConstIterator it; 1028 Incidence::List::ConstIterator it;
1029 startPoints.append( &startpt ); 1029 startPoints.append( &startpt );
1030 for( it = l.begin(); it != l.end(); ++it ) { 1030 for( it = l.begin(); it != l.end(); ++it ) {
1031 count++; 1031 count++;
1032 drawTodo( completed, count, static_cast<Todo *>( *it ), p, connectSubTodos, 1032 drawTodo( completed, count, static_cast<Todo *>( *it ), p, connectSubTodos,
1033 desc, pospriority, possummary, posDueDt, level+1, 1033 desc, pospriority, possummary, posDueDt, level+1,
1034 x, y, width, height, pageHeight, &startpt); 1034 x, y, width, height, pageHeight, &startpt);
1035 } 1035 }
1036 startPoints.remove(&startpt); 1036 startPoints.remove(&startpt);
@@ -1125,92 +1125,92 @@ void CalPrintBase::drawSplitWeek( QPainter &p, const QDate &fd,
1125 } 1125 }
1126 curDay = curDay.addDays(1); 1126 curDay = curDay.addDays(1);
1127 1127
1128 } while (curDay <= toDay); 1128 } while (curDay <= toDay);
1129 1129
1130} 1130}
1131 1131
1132void CalPrintBase::drawSplitHeaderRight( QPainter &p, const QDate &fd, 1132void CalPrintBase::drawSplitHeaderRight( QPainter &p, const QDate &fd,
1133 const QDate &td, 1133 const QDate &td,
1134 const QDate &, 1134 const QDate &,
1135 int width, int ) 1135 int width, int )
1136{ 1136{
1137 int tempStore = mSubHeaderHeight; 1137 int tempStore = mSubHeaderHeight;
1138 mSubHeaderHeight+= mSubHeaderHeight; 1138 mSubHeaderHeight+= mSubHeaderHeight;
1139 KLocale *local = KGlobal::locale(); 1139 KLocale *local = KGlobal::locale();
1140 QFont font("helvetica", 18, QFont::Bold); 1140 QFont font("helvetica", 18, QFont::Bold);
1141 QPen penA( black,0); 1141 QPen penA( Qt::black,0);
1142 QPen penB( black,3); 1142 QPen penB( Qt::black,3);
1143 p.setFont(font); 1143 p.setFont(font);
1144 int lineSpacing = p.fontMetrics().lineSpacing(); 1144 int lineSpacing = p.fontMetrics().lineSpacing();
1145 QString title; 1145 QString title;
1146 QString myOwner(mCalendar->getOwner()); 1146 QString myOwner(mCalendar->getOwner());
1147 if ( fd.month() == td.month() ) { 1147 if ( fd.month() == td.month() ) {
1148 title = local->monthName(fd.month(), false) + ' ' + QString::number(fd.day()) + ' ' 1148 title = local->monthName(fd.month(), false) + ' ' + QString::number(fd.day()) + ' '
1149 + '-' + ' ' + QString::number(td.day()); 1149 + '-' + ' ' + QString::number(td.day());
1150 } else { 1150 } else {
1151 title = local->monthName(fd.month(), false) + ' ' + QString::number(fd.day()) + ' ' 1151 title = local->monthName(fd.month(), false) + ' ' + QString::number(fd.day()) + ' '
1152 + '-' + ' ' + local->monthName(td.month(), false) + ' ' + QString::number(td.day()); 1152 + '-' + ' ' + local->monthName(td.month(), false) + ' ' + QString::number(td.day());
1153 } 1153 }
1154 1154
1155// Grrrrrrr! why can't I set the font to a serif font?!?!? 1155// Grrrrrrr! why can't I set the font to a serif font?!?!?
1156 QFont serifFont("Helvetica", 30); 1156 QFont serifFont("Helvetica", 30);
1157// serifFont.setFamily("Serif"); 1157// serifFont.setFamily("Serif");
1158// serifFont.setWeight(87); 1158// serifFont.setWeight(87);
1159// serifFont.setItalic(true); 1159// serifFont.setItalic(true);
1160 p.setFont(serifFont); 1160 p.setFont(serifFont);
1161 QFontInfo info(p.font()); 1161 QFontInfo info(p.font());
1162 1162
1163 lineSpacing = p.fontMetrics().lineSpacing(); 1163 lineSpacing = p.fontMetrics().lineSpacing();
1164 p.drawText(0, lineSpacing * 0, width, lineSpacing, AlignRight |AlignTop, title ); 1164 p.drawText(0, lineSpacing * 0, width, lineSpacing, Qt::AlignRight |Qt::AlignTop, title );
1165 1165
1166 title.truncate(0); 1166 title.truncate(0);
1167 1167
1168 p.setPen(penB ); 1168 p.setPen(penB );
1169 p.drawLine(200, lineSpacing * 1, width, lineSpacing * 1); 1169 p.drawLine(200, lineSpacing * 1, width, lineSpacing * 1);
1170 p.setPen(penA ); 1170 p.setPen(penA );
1171 1171
1172 p.setFont(QFont("Helvetica", 20, QFont::Bold, TRUE)); 1172 p.setFont(QFont("Helvetica", 20, QFont::Bold, TRUE));
1173 title += QString::number(fd.year()); 1173 title += QString::number(fd.year());
1174 p.drawText(0, lineSpacing * 1, width, lineSpacing, AlignRight |AlignTop, title ); 1174 p.drawText(0, lineSpacing * 1, width, lineSpacing, Qt::AlignRight |Qt::AlignTop, title );
1175 mSubHeaderHeight = tempStore ; 1175 mSubHeaderHeight = tempStore ;
1176} 1176}
1177 1177
1178void CalPrintBase::drawSplitDay( QPainter &p, const QDate &qd, int width, 1178void CalPrintBase::drawSplitDay( QPainter &p, const QDate &qd, int width,
1179 int height, int offsetLeft ) 1179 int height, int offsetLeft )
1180{ 1180{
1181 int tempStore = mSubHeaderHeight; 1181 int tempStore = mSubHeaderHeight;
1182 mSubHeaderHeight+= mSubHeaderHeight; 1182 mSubHeaderHeight+= mSubHeaderHeight;
1183 int startHour = KOPrefs::instance()->mDayBegins; 1183 int startHour = KOPrefs::instance()->mDayBegins;
1184 int endHour = 20; 1184 int endHour = 20;
1185 int offset = mHeaderHeight + mSubHeaderHeight + 10; 1185 int offset = mHeaderHeight + mSubHeaderHeight + 10;
1186 Event::List eventList; eventList.fill( mCalendar->events( qd, true )); 1186 Event::List eventList; eventList.fill( mCalendar->events( qd, true ));
1187 Event::List::Iterator it; 1187 Event::List::Iterator it;
1188 Event *currEvent; 1188 Event *currEvent;
1189 KLocale *local = KGlobal::locale(); 1189 KLocale *local = KGlobal::locale();
1190 QString dayName; 1190 QString dayName;
1191 1191
1192 dayName = local->weekDayName(qd.dayOfWeek()) + ' ' + ' ' + QString::number(qd.day()); 1192 dayName = local->weekDayName(qd.dayOfWeek()) + ' ' + ' ' + QString::number(qd.day());
1193 //p.setBrush(QBrush(black)); 1193 //p.setBrush(QBrush(black));
1194// width+1 to make sure there's a continuous, black bar across the top. 1194// width+1 to make sure there's a continuous, black bar across the top.
1195 p.setPen( QPen(Qt::black,2)); 1195 p.setPen( QPen(Qt::black,2));
1196 p.drawRect(offsetLeft, mHeaderHeight + 5, width +1, mSubHeaderHeight); 1196 p.drawRect(offsetLeft, mHeaderHeight + 5, width +1, mSubHeaderHeight);
1197 p.setPen( Qt::black); 1197 p.setPen( Qt::black);
1198 p.setFont(QFont("helvetica", 12, QFont::Bold, true)); 1198 p.setFont(QFont("helvetica", 12, QFont::Bold, true));
1199 p.drawText(offsetLeft, mHeaderHeight + 5, 1199 p.drawText(offsetLeft, mHeaderHeight + 5,
1200 width, mSubHeaderHeight, AlignHCenter | AlignVCenter, 1200 width, mSubHeaderHeight, Qt::AlignHCenter | Qt::AlignVCenter,
1201 dayName); 1201 dayName);
1202 1202
1203 p.setPen( QPen(Qt::black,2)); 1203 p.setPen( QPen(Qt::black,2));
1204 p.setFont(QFont("helvetica", 12)); 1204 p.setFont(QFont("helvetica", 12));
1205 p.setBrush(Qt::white); 1205 p.setBrush(Qt::white);
1206 it = eventList.begin(); 1206 it = eventList.begin();
1207 int allDays = 0; 1207 int allDays = 0;
1208 /* 1208 /*
1209 while( it != eventList.end() ) { 1209 while( it != eventList.end() ) {
1210 Event *currEvent = *it; 1210 Event *currEvent = *it;
1211 if ( currEvent->doesFloat() ) { 1211 if ( currEvent->doesFloat() ) {
1212 p.drawRect( offsetLeft, offset, width, 35 ); 1212 p.drawRect( offsetLeft, offset, width, 35 );
1213 p.drawText( offsetLeft + 5, offset + 10, width - 10, 30, 1213 p.drawText( offsetLeft + 5, offset + 10, width - 10, 30,
1214 AlignLeft | AlignTop, currEvent->summary() ); 1214 AlignLeft | AlignTop, currEvent->summary() );
1215 offset += 40; 1215 offset += 40;
1216 allDays++; 1216 allDays++;
@@ -1241,66 +1241,66 @@ void CalPrintBase::drawSplitDay( QPainter &p, const QDate &qd, int width,
1241 int startTime = currEvent->dtStart().time().hour(); 1241 int startTime = currEvent->dtStart().time().hour();
1242 int endTime = currEvent->dtEnd().time().hour(); 1242 int endTime = currEvent->dtEnd().time().hour();
1243 float minuteInc = cellHeight / 60.0; 1243 float minuteInc = cellHeight / 60.0;
1244 if ((startTime >= startHour) && (endTime <= (startHour + hours))) { 1244 if ((startTime >= startHour) && (endTime <= (startHour + hours))) {
1245 startTime -= startHour; 1245 startTime -= startHour;
1246 int startMinuteOff = (int) (minuteInc * 1246 int startMinuteOff = (int) (minuteInc *
1247 currEvent->dtStart().time().minute()); 1247 currEvent->dtStart().time().minute());
1248 QString text = currEvent->summary() ; 1248 QString text = currEvent->summary() ;
1249 if ( ! currEvent->location().isEmpty() ) 1249 if ( ! currEvent->location().isEmpty() )
1250 text += "\n("+currEvent->location()+")"; 1250 text += "\n("+currEvent->location()+")";
1251 int endMinuteOff = (int) (minuteInc * currEvent->dtEnd().time().minute()); 1251 int endMinuteOff = (int) (minuteInc * currEvent->dtEnd().time().minute());
1252 int cheight = (int) (minuteInc * 1252 int cheight = (int) (minuteInc *
1253 currEvent->dtStart().secsTo(currEvent->dtEnd()) / 60 ); 1253 currEvent->dtStart().secsTo(currEvent->dtEnd()) / 60 );
1254 p.drawRect(offsetLeft+2, 1+offset+startMinuteOff+startTime*cellHeight, 1254 p.drawRect(offsetLeft+2, 1+offset+startMinuteOff+startTime*cellHeight,
1255 width-4, cheight); 1255 width-4, cheight);
1256 p.drawText(offsetLeft+12, offset+startMinuteOff+startTime*cellHeight+5, width-24, 1256 p.drawText(offsetLeft+12, offset+startMinuteOff+startTime*cellHeight+5, width-24,
1257 cheight-10, AlignHCenter | AlignTop, text); 1257 cheight-10, Qt::AlignHCenter | Qt::AlignTop, text);
1258 } 1258 }
1259 } 1259 }
1260 p.setBrush(QBrush(NoBrush)); 1260 p.setBrush(QBrush(Qt::NoBrush));
1261 mSubHeaderHeight = tempStore ; 1261 mSubHeaderHeight = tempStore ;
1262} 1262}
1263 1263
1264void CalPrintBase::drawSplitTimes( QPainter &p, int width, int timeWidth, 1264void CalPrintBase::drawSplitTimes( QPainter &p, int width, int timeWidth,
1265 int height ) 1265 int height )
1266{ 1266{
1267 int tempStore = mSubHeaderHeight; 1267 int tempStore = mSubHeaderHeight;
1268 mSubHeaderHeight+= mSubHeaderHeight; 1268 mSubHeaderHeight+= mSubHeaderHeight;
1269 int startHour = KOPrefs::instance()->mDayBegins; 1269 int startHour = KOPrefs::instance()->mDayBegins;
1270 int endHour = 20; 1270 int endHour = 20;
1271 int offset = mHeaderHeight + mSubHeaderHeight + 10; 1271 int offset = mHeaderHeight + mSubHeaderHeight + 10;
1272 int hours = endHour - startHour; 1272 int hours = endHour - startHour;
1273 int cellHeight = (height-offset) / hours; // hour increments. 1273 int cellHeight = (height-offset) / hours; // hour increments.
1274 1274
1275 QString numStr; 1275 QString numStr;
1276 for (int i = 0; i < hours; i++) { 1276 for (int i = 0; i < hours; i++) {
1277 p.setPen(QPen(black,1)); 1277 p.setPen(QPen(Qt::black,1));
1278 p.drawLine(0, offset+i*cellHeight, width, offset+i*cellHeight); 1278 p.drawLine(0, offset+i*cellHeight, width, offset+i*cellHeight);
1279 p.setPen(QPen(gray,0)); 1279 p.setPen(QPen(Qt::gray,0));
1280 p.drawLine(37, offset+i*cellHeight+(cellHeight/2), 1280 p.drawLine(37, offset+i*cellHeight+(cellHeight/2),
1281 width, offset+i*cellHeight+(cellHeight/2)); 1281 width, offset+i*cellHeight+(cellHeight/2));
1282 p.setPen(QPen(black,0)); 1282 p.setPen(QPen(Qt::black,0));
1283 1283
1284 if ( !KGlobal::locale()->use12Clock() ) { 1284 if ( !KGlobal::locale()->use12Clock() ) {
1285 numStr.setNum(i+startHour); 1285 numStr.setNum(i+startHour);
1286 if (cellHeight > 40) { 1286 if (cellHeight > 40) {
1287 p.setFont(QFont("helvetica", 16, QFont::Bold)); 1287 p.setFont(QFont("helvetica", 16, QFont::Bold));
1288 } else { 1288 } else {
1289 p.setFont(QFont("helvetica", 14, QFont::Bold)); 1289 p.setFont(QFont("helvetica", 14, QFont::Bold));
1290 } 1290 }
1291 p.drawText(0, offset+i*cellHeight, 33, cellHeight/2, 1291 p.drawText(0, offset+i*cellHeight, 33, cellHeight/2,
1292 AlignTop|AlignRight, numStr); 1292 Qt::AlignTop|Qt::AlignRight, numStr);
1293 p.setFont(QFont("helvetica", 12, QFont::Bold)); 1293 p.setFont(QFont("helvetica", 12, QFont::Bold));
1294 p.drawText(37, offset+i*cellHeight, 45, cellHeight/2, 1294 p.drawText(37, offset+i*cellHeight, 45, cellHeight/2,
1295 AlignTop | AlignLeft, "00"); 1295 Qt::AlignTop | Qt::AlignLeft, "00");
1296 } else { 1296 } else {
1297 QTime time( i + startHour, 0 ); 1297 QTime time( i + startHour, 0 );
1298 numStr = KGlobal::locale()->formatTime( time ); 1298 numStr = KGlobal::locale()->formatTime( time );
1299 p.setFont(QFont("helvetica", 12, QFont::Bold)); 1299 p.setFont(QFont("helvetica", 12, QFont::Bold));
1300 p.drawText(4, offset+i*cellHeight, 70, cellHeight/2, 1300 p.drawText(4, offset+i*cellHeight, 70, cellHeight/2,
1301 AlignTop|AlignLeft, numStr); 1301 Qt::AlignTop|Qt::AlignLeft, numStr);
1302 } 1302 }
1303 } mSubHeaderHeight = tempStore ; 1303 } mSubHeaderHeight = tempStore ;
1304} 1304}
1305 1305
1306#endif 1306#endif
diff --git a/korganizer/calprinter.cpp b/korganizer/calprinter.cpp
index 0cdf28e..d4bf988 100644
--- a/korganizer/calprinter.cpp
+++ b/korganizer/calprinter.cpp
@@ -8,41 +8,44 @@
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qvbuttongroup.h> 24// #include <qvbuttongroup.h>
25#include <qwidgetstack.h> 25#include <q3widgetstack.h>
26#include <qradiobutton.h> 26#include <qradiobutton.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qcombobox.h> 29#include <qcombobox.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <qvbox.h> 31#include <q3vbox.h>
32#include <qsplitter.h> 32#include <qsplitter.h>
33//Added by qt3to4:
34#include <Q3GridLayout>
35#include <Q3PtrList>
33 36
34#include <kprinter.h> 37#include <kprinter.h>
35#include <kglobal.h> 38#include <kglobal.h>
36#include <ksimpleconfig.h> 39#include <ksimpleconfig.h>
37#include <kmessagebox.h> 40#include <kmessagebox.h>
38#include <kdebug.h> 41#include <kdebug.h>
39//#include <kdeversion.h> 42//#include <kdeversion.h>
40 43
41#include "koprefsdialog.h" 44#include "koprefsdialog.h"
42 45
43#include "calprinter.h" 46#include "calprinter.h"
44#ifndef KORG_NOPRINTER 47#ifndef KORG_NOPRINTER
45//#include "calprinter.moc" 48//#include "calprinter.moc"
46 49
47#include "calprintplugins.h" 50#include "calprintplugins.h"
48 51
@@ -161,63 +164,63 @@ void CalPrinter::doPrint( CalPrintBase *selectedStyle, bool preview )
161 break; 164 break;
162 } 165 }
163 selectedStyle->doPrint(); 166 selectedStyle->doPrint();
164 } 167 }
165 //mPrinter->setPreviewOnly( false ); 168 //mPrinter->setPreviewOnly( false );
166} 169}
167 170
168/////////////////////////////////////////////////////////////////////////////// 171///////////////////////////////////////////////////////////////////////////////
169 172
170void CalPrinter::updateConfig() 173void CalPrinter::updateConfig()
171{ 174{
172} 175}
173 176
174 177
175/****************************************************************************/ 178/****************************************************************************/
176 179
177CalPrintDialog::CalPrintDialog( QPtrList<CalPrintBase> plugins, KPrinter *p, 180CalPrintDialog::CalPrintDialog( Q3PtrList<CalPrintBase> plugins, KPrinter *p,
178 QWidget *parent, const char *name ) 181 QWidget *parent, const char *name )
179 : KDialogBase( parent, name, /*modal*/true, i18n("Print"), Ok | Cancel ), 182 : KDialogBase( parent, name, /*modal*/true, i18n("Print"), Ok | Cancel ),
180 mPrinter( p ), mPrintPlugins( plugins ) 183 mPrinter( p ), mPrintPlugins( plugins )
181{ 184{
182 QVBox *page = new QVBox(this);//makeVBoxMainWidget(); 185 Q3VBox *page = new Q3VBox(this);//makeVBoxMainWidget();
183 setMainWidget( page ); 186 setMainWidget( page );
184 QHBox *printerLayout = new QHBox( page ); 187 Q3HBox *printerLayout = new Q3HBox( page );
185 188
186 mPrinterLabel = new QLabel( printerLayout ); 189 mPrinterLabel = new QLabel( printerLayout );
187 QPushButton *setupButton = new QPushButton( i18n("&Setup Printer..."), 190 QPushButton *setupButton = new QPushButton( i18n("&Setup Printer..."),
188 printerLayout ); 191 printerLayout );
189 setupButton->setSizePolicy( QSizePolicy( 192 setupButton->setSizePolicy( QSizePolicy(
190 (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)0, 193 (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)0,
191 0, 0, setupButton->sizePolicy().hasHeightForWidth() ) ); 194 0, 0, setupButton->sizePolicy().hasHeightForWidth() ) );
192 195
193 QSplitter *splitter = new QSplitter( page ); 196 QSplitter *splitter = new QSplitter( page );
194 splitter->setOrientation( QSplitter::Horizontal ); 197 splitter->setOrientation( Qt::Horizontal );
195 198
196 mTypeGroup = new QVButtonGroup( i18n("View Type"), splitter, "buttonGroup" ); 199 mTypeGroup = new Q3VButtonGroup( i18n("View Type"), splitter, "buttonGroup" );
197 // use the minimal width possible = max width of the radio buttons, not extensible 200 // use the minimal width possible = max width of the radio buttons, not extensible
198/* mTypeGroup->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, 201/* mTypeGroup->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4,
199 (QSizePolicy::SizeType)5, 0, 0, 202 (QSizePolicy::SizeType)5, 0, 0,
200 mTypeGroup->sizePolicy().hasHeightForWidth() ) );*/ 203 mTypeGroup->sizePolicy().hasHeightForWidth() ) );*/
201 204
202 QWidget *splitterRight = new QWidget( splitter, "splitterRight" ); 205 QWidget *splitterRight = new QWidget( splitter, "splitterRight" );
203 QGridLayout *splitterRightLayout = new QGridLayout( splitterRight ); 206 Q3GridLayout *splitterRightLayout = new Q3GridLayout( splitterRight );
204 splitterRightLayout->setMargin( marginHint() ); 207 splitterRightLayout->setMargin( marginHint() );
205 splitterRightLayout->setSpacing( spacingHint() ); 208 splitterRightLayout->setSpacing( spacingHint() );
206 209
207 mConfigArea = new QWidgetStack( splitterRight, "configWidgetStack" ); 210 mConfigArea = new Q3WidgetStack( splitterRight, "configWidgetStack" );
208 splitterRightLayout->addMultiCellWidget( mConfigArea, 0,0, 0,1 ); 211 splitterRightLayout->addMultiCellWidget( mConfigArea, 0,0, 0,1 );
209 212
210 QLabel *orientationLabel = new QLabel( i18n("Page &orientation:"), 213 QLabel *orientationLabel = new QLabel( i18n("Page &orientation:"),
211 splitterRight, "orientationLabel" ); 214 splitterRight, "orientationLabel" );
212 splitterRightLayout->addWidget( orientationLabel, 1, 0 ); 215 splitterRightLayout->addWidget( orientationLabel, 1, 0 );
213 216
214 mOrientationSelection = new QComboBox( splitterRight, "orientationCombo" ); 217 mOrientationSelection = new QComboBox( splitterRight, "orientationCombo" );
215 mOrientationSelection->insertItem( i18n("Use Default of Selected Style") ); 218 mOrientationSelection->insertItem( i18n("Use Default of Selected Style") );
216 mOrientationSelection->insertItem( i18n("Use Default Setting of Printer") ); 219 mOrientationSelection->insertItem( i18n("Use Default Setting of Printer") );
217 mOrientationSelection->insertItem( i18n("Portrait") ); 220 mOrientationSelection->insertItem( i18n("Portrait") );
218 mOrientationSelection->insertItem( i18n("Landscape") ); 221 mOrientationSelection->insertItem( i18n("Landscape") );
219 splitterRightLayout->addWidget( mOrientationSelection, 1, 1 ); 222 splitterRightLayout->addWidget( mOrientationSelection, 1, 1 );
220 223
221 // signals and slots connections 224 // signals and slots connections
222 connect( setupButton, SIGNAL( clicked() ), SLOT( setupPrinter() ) ); 225 connect( setupButton, SIGNAL( clicked() ), SLOT( setupPrinter() ) );
223 connect( mTypeGroup, SIGNAL( clicked( int ) ), SLOT( setPrintType( int ) ) ); 226 connect( mTypeGroup, SIGNAL( clicked( int ) ), SLOT( setPrintType( int ) ) );
diff --git a/korganizer/calprinter.h b/korganizer/calprinter.h
index 7b58f4f..e065779 100644
--- a/korganizer/calprinter.h
+++ b/korganizer/calprinter.h
@@ -1,58 +1,60 @@
1//Added by qt3to4:
2#include <QLabel>
1/* 3/*
2 This file is part of KOrganizer. 4 This file is part of KOrganizer.
3 5
4 Copyright (c) 1998 Preston Brown 6 Copyright (c) 1998 Preston Brown
5 7
6 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 10 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 11 (at your option) any later version.
10 12
11 This program is distributed in the hope that it will be useful, 13 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 16 GNU General Public License for more details.
15 17
16 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 19 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 21
20 As a special exception, permission is given to link this program 22 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 23 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 24 without including the source code for Qt in the source distribution.
23*/ 25*/
24#ifndef _CALPRINTER_H 26#ifndef _CALPRINTER_H
25#define _CALPRINTER_H 27#define _CALPRINTER_H
26 28
27// #define KORG_NOPRINTER 29// #define KORG_NOPRINTER
28 30
29#ifndef KORG_NOPRINTER 31#ifndef KORG_NOPRINTER
30 32
31#include <qptrlist.h> 33#include <q3ptrlist.h>
32 34
33#include <kdialogbase.h> 35#include <kdialogbase.h>
34 36
35#include <korganizer/baseview.h> 37#include <korganizer/baseview.h>
36 38
37#include "calprintbase.h" 39#include "calprintbase.h"
38 40
39using namespace KCal; 41using namespace KCal;
40 42
41class QVButtonGroup; 43class Q3VButtonGroup;
42class QWidgetStack; 44class Q3WidgetStack;
43class KPrinter; 45class KPrinter;
44class CalPrintDialog; 46class CalPrintDialog;
45class KConfig; 47class KConfig;
46class QComboBox; 48class QComboBox;
47class QLabel; 49class QLabel;
48 50
49 51
50/** 52/**
51 CalPrinter is a class for printing Calendars. It can print in several 53 CalPrinter is a class for printing Calendars. It can print in several
52 different formats (day, week, month). It also provides a way for setting 54 different formats (day, week, month). It also provides a way for setting
53 up the printer and remembering these preferences. 55 up the printer and remembering these preferences.
54*/ 56*/
55class CalPrinter : public QObject, public KOrg::CalPrinterBase 57class CalPrinter : public QObject, public KOrg::CalPrinterBase
56{ 58{
57 Q_OBJECT 59 Q_OBJECT
58 60
@@ -81,62 +83,62 @@ class CalPrinter : public QObject, public KOrg::CalPrinterBase
81 \param start Start date 83 \param start Start date
82 \param end End date 84 \param end End date
83 */ 85 */
84 void setDateRange( const QDate &start, const QDate &end ); 86 void setDateRange( const QDate &start, const QDate &end );
85 87
86 public slots: 88 public slots:
87 void updateConfig(); 89 void updateConfig();
88 90
89 private slots: 91 private slots:
90 void doPrint( CalPrintBase *selectedStyle, bool preview ); 92 void doPrint( CalPrintBase *selectedStyle, bool preview );
91 93
92 public: 94 public:
93 void preview( PrintType type, const QDate &fd, const QDate &td ); 95 void preview( PrintType type, const QDate &fd, const QDate &td );
94 void print( PrintType type, const QDate &fd, const QDate &td ); 96 void print( PrintType type, const QDate &fd, const QDate &td );
95 97
96 protected: 98 protected:
97 QPtrList<CalPrintBase> mPrintPlugins; 99 Q3PtrList<CalPrintBase> mPrintPlugins;
98 100
99 private: 101 private:
100 KPrinter *mPrinter; 102 KPrinter *mPrinter;
101 Calendar *mCalendar; 103 Calendar *mCalendar;
102 QWidget *mParent; 104 QWidget *mParent;
103 KConfig *mConfig; 105 KConfig *mConfig;
104 106
105 CalPrintDialog *mPrintDialog; 107 CalPrintDialog *mPrintDialog;
106}; 108};
107 109
108class CalPrintDialog : public KDialogBase 110class CalPrintDialog : public KDialogBase
109{ 111{
110 Q_OBJECT 112 Q_OBJECT
111 public: 113 public:
112 CalPrintDialog( QPtrList<CalPrintBase> plugins, KPrinter *p, 114 CalPrintDialog( Q3PtrList<CalPrintBase> plugins, KPrinter *p,
113 QWidget *parent = 0, const char *name = 0 ); 115 QWidget *parent = 0, const char *name = 0 );
114 virtual ~CalPrintDialog(); 116 virtual ~CalPrintDialog();
115 CalPrintBase *selectedPlugin(); 117 CalPrintBase *selectedPlugin();
116 CalPrinter::ePrintOrientation orientation() { return mOrientation; } 118 CalPrinter::ePrintOrientation orientation() { return mOrientation; }
117 119
118 public slots: 120 public slots:
119 void setPrintType( int ); 121 void setPrintType( int );
120 void setPreview( bool ); 122 void setPreview( bool );
121 123
122 protected slots: 124 protected slots:
123 void slotOk(); 125 void slotOk();
124 void setupPrinter(); 126 void setupPrinter();
125 void setPrinterLabel(); 127 void setPrinterLabel();
126signals: 128signals:
127 void okClicked(); 129 void okClicked();
128 private: 130 private:
129 KPrinter *mPrinter; 131 KPrinter *mPrinter;
130 QVButtonGroup *mTypeGroup; 132 Q3VButtonGroup *mTypeGroup;
131 QWidgetStack *mConfigArea; 133 Q3WidgetStack *mConfigArea;
132 QPtrList<CalPrintBase> mPrintPlugins; 134 Q3PtrList<CalPrintBase> mPrintPlugins;
133 QLabel *mPrinterLabel; 135 QLabel *mPrinterLabel;
134 QString mPreviewText; 136 QString mPreviewText;
135 QComboBox *mOrientationSelection; 137 QComboBox *mOrientationSelection;
136 138
137 CalPrinter::ePrintOrientation mOrientation; 139 CalPrinter::ePrintOrientation mOrientation;
138}; 140};
139 141
140#endif 142#endif
141 143
142#endif 144#endif
diff --git a/korganizer/calprintplugins.cpp b/korganizer/calprintplugins.cpp
index bc35ca4..9b6dc6e 100644
--- a/korganizer/calprintplugins.cpp
+++ b/korganizer/calprintplugins.cpp
@@ -12,37 +12,37 @@
12 12
13 This program is distributed in the hope that it will be useful, 13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 GNU General Public License for more details.
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software 19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 21
22 As a special exception, permission is given to link this program 22 As a special exception, permission is given to link this program
23 with any edition of Qt, and distribute the resulting executable, 23 with any edition of Qt, and distribute the resulting executable,
24 without including the source code for Qt in the source distribution. 24 without including the source code for Qt in the source distribution.
25*/ 25*/
26 26
27#include <qpainter.h> 27#include <qpainter.h>
28#include <qdatetimeedit.h> 28#include <q3datetimeedit.h>
29#include <qdatetime.h> 29#include <qdatetime.h>
30#include <qcheckbox.h> 30#include <qcheckbox.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qbuttongroup.h> 32#include <q3buttongroup.h>
33 33
34#include <kglobal.h> 34#include <kglobal.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kdebug.h> 36#include <kdebug.h>
37#include <kprinter.h> 37#include <kprinter.h>
38#include <kconfig.h> 38#include <kconfig.h>
39#include <kcalendarsystem.h> 39#include <kcalendarsystem.h>
40 40
41#include <libkcal/todo.h> 41#include <libkcal/todo.h>
42#include <libkcal/calendar.h> 42#include <libkcal/calendar.h>
43 43
44#include <libkdepim/kdateedit.h> 44#include <libkdepim/kdateedit.h>
45 45
46#include "koprefs.h" 46#include "koprefs.h"
47#include "koglobals.h" 47#include "koglobals.h"
48#include "calprintplugins.h" 48#include "calprintplugins.h"
diff --git a/korganizer/cellitem.cpp b/korganizer/cellitem.cpp
index 61d06ac..1fd703c 100644
--- a/korganizer/cellitem.cpp
+++ b/korganizer/cellitem.cpp
@@ -14,52 +14,54 @@
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include "cellitem.h" 25#include "cellitem.h"
26 26
27#include <klocale.h> 27#include <klocale.h>
28#include <kdebug.h> 28#include <kdebug.h>
29 29
30#include <qintdict.h> 30#include <q3intdict.h>
31//Added by qt3to4:
32#include <Q3PtrList>
31 33
32using namespace KOrg; 34using namespace KOrg;
33 35
34QString CellItem::label() const 36QString CellItem::label() const
35{ 37{
36 return i18n("<undefined>"); 38 return i18n("<undefined>");
37} 39}
38 40
39QPtrList<CellItem> CellItem::placeItem( QPtrList<CellItem> cells, 41Q3PtrList<CellItem> CellItem::placeItem( Q3PtrList<CellItem> cells,
40 CellItem *placeItem ) 42 CellItem *placeItem )
41{ 43{
42 kdDebug(5855) << "Placing " << placeItem->label() << endl; 44 kdDebug(5855) << "Placing " << placeItem->label() << endl;
43 45
44 QPtrList<KOrg::CellItem> conflictItems; 46 Q3PtrList<KOrg::CellItem> conflictItems;
45 int maxSubCells = 0; 47 int maxSubCells = 0;
46 QIntDict<KOrg::CellItem> subCellDict; 48 Q3IntDict<KOrg::CellItem> subCellDict;
47 49
48 // Find all items which are in same cell 50 // Find all items which are in same cell
49 QPtrListIterator<KOrg::CellItem> it2( cells ); 51 Q3PtrListIterator<KOrg::CellItem> it2( cells );
50 for( it2.toFirst(); it2.current(); ++it2 ) { 52 for( it2.toFirst(); it2.current(); ++it2 ) {
51 KOrg::CellItem *item = it2.current(); 53 KOrg::CellItem *item = it2.current();
52 if ( item == placeItem ) continue; 54 if ( item == placeItem ) continue;
53 55
54 if ( item->overlaps( placeItem ) ) { 56 if ( item->overlaps( placeItem ) ) {
55 kdDebug(5855) << " Overlaps: " << item->label() << endl; 57 kdDebug(5855) << " Overlaps: " << item->label() << endl;
56 58
57 conflictItems.append( item ); 59 conflictItems.append( item );
58 if ( item->subCells() > maxSubCells ) maxSubCells = item->subCells(); 60 if ( item->subCells() > maxSubCells ) maxSubCells = item->subCells();
59 subCellDict.insert( item->subCell(), item ); 61 subCellDict.insert( item->subCell(), item );
60 } 62 }
61 } 63 }
62 64
63 if ( conflictItems.count() > 0 ) { 65 if ( conflictItems.count() > 0 ) {
64 // Look for unused sub cell and insert item 66 // Look for unused sub cell and insert item
65 int i; 67 int i;
@@ -70,29 +72,29 @@ QPtrList<CellItem> CellItem::placeItem( QPtrList<CellItem> cells,
70 placeItem->setSubCell( i ); 72 placeItem->setSubCell( i );
71 break; 73 break;
72 } 74 }
73 } 75 }
74 if ( i == maxSubCells ) { 76 if ( i == maxSubCells ) {
75 kdDebug(5855) << " New subcell " << i << endl; 77 kdDebug(5855) << " New subcell " << i << endl;
76 placeItem->setSubCell( maxSubCells ); 78 placeItem->setSubCell( maxSubCells );
77 maxSubCells++; // add new item to number of sub cells 79 maxSubCells++; // add new item to number of sub cells
78 } 80 }
79 81
80 kdDebug(5855) << " Sub cells: " << maxSubCells << endl; 82 kdDebug(5855) << " Sub cells: " << maxSubCells << endl;
81 83
82 // Write results to item to be placed 84 // Write results to item to be placed
83 conflictItems.append( placeItem ); 85 conflictItems.append( placeItem );
84 placeItem->setSubCells( maxSubCells ); 86 placeItem->setSubCells( maxSubCells );
85 87
86 QPtrListIterator<KOrg::CellItem> it3( conflictItems ); 88 Q3PtrListIterator<KOrg::CellItem> it3( conflictItems );
87 for( it3.toFirst(); it3.current(); ++it3 ) { 89 for( it3.toFirst(); it3.current(); ++it3 ) {
88 (*it3)->setSubCells( maxSubCells ); 90 (*it3)->setSubCells( maxSubCells );
89 } 91 }
90 // Todo: Adapt subCells of items conflicting with conflicting items 92 // Todo: Adapt subCells of items conflicting with conflicting items
91 } else { 93 } else {
92 kdDebug(5855) << " no conflicts" << endl; 94 kdDebug(5855) << " no conflicts" << endl;
93 placeItem->setSubCell( 0 ); 95 placeItem->setSubCell( 0 );
94 placeItem->setSubCells( 1 ); 96 placeItem->setSubCells( 1 );
95 } 97 }
96 98
97 return conflictItems; 99 return conflictItems;
98} 100}
diff --git a/korganizer/cellitem.h b/korganizer/cellitem.h
index 72773d0..b917bd5 100644
--- a/korganizer/cellitem.h
+++ b/korganizer/cellitem.h
@@ -12,55 +12,55 @@
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef KORG_CELLITEM_H 24#ifndef KORG_CELLITEM_H
25#define KORG_CELLITEM_H 25#define KORG_CELLITEM_H
26 26
27#include <qstring.h> 27#include <qstring.h>
28#include <qptrlist.h> 28#include <q3ptrlist.h>
29 29
30namespace KOrg { 30namespace KOrg {
31 31
32class CellItem 32class CellItem
33{ 33{
34 public: 34 public:
35 CellItem() 35 CellItem()
36 : mSubCells( 0 ), mSubCell( -1 ) 36 : mSubCells( 0 ), mSubCell( -1 )
37 { 37 {
38 } 38 }
39 39
40 void setSubCells( int v ) { mSubCells = v; } 40 void setSubCells( int v ) { mSubCells = v; }
41 int subCells() const { return mSubCells; } 41 int subCells() const { return mSubCells; }
42 42
43 void setSubCell( int v ) { mSubCell = v; } 43 void setSubCell( int v ) { mSubCell = v; }
44 int subCell() const { return mSubCell; } 44 int subCell() const { return mSubCell; }
45 45
46 virtual bool overlaps( CellItem *other ) const = 0; 46 virtual bool overlaps( CellItem *other ) const = 0;
47 47
48 virtual QString label() const; 48 virtual QString label() const;
49 49
50 /** 50 /**
51 Place item \arg placeItem into stripe containing items \arg cells in a 51 Place item \arg placeItem into stripe containing items \arg cells in a
52 way that items don't overlap. 52 way that items don't overlap.
53 53
54 \return Placed items 54 \return Placed items
55 */ 55 */
56 static QPtrList<CellItem> placeItem( QPtrList<CellItem> cells, 56 static Q3PtrList<CellItem> placeItem( Q3PtrList<CellItem> cells,
57 CellItem *placeItem ); 57 CellItem *placeItem );
58 58
59 private: 59 private:
60 int mSubCells; 60 int mSubCells;
61 int mSubCell; 61 int mSubCell;
62}; 62};
63 63
64} 64}
65 65
66#endif 66#endif
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index ea510f1..53507d3 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -21,32 +21,34 @@
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <kdebug.h> 26#include <kdebug.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29//#include "koglobals.h" 29//#include "koglobals.h"
30#include "navigatorbar.h" 30#include "navigatorbar.h"
31#include "kdatenavigator.h" 31#include "kdatenavigator.h"
32 32
33#include <kcalendarsystem.h> 33#include <kcalendarsystem.h>
34 34
35#include "datenavigatorcontainer.h" 35#include "datenavigatorcontainer.h"
36#include "koprefs.h" 36#include "koprefs.h"
37//Added by qt3to4:
38#include <QResizeEvent>
37 39
38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, 40DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
39 const char *name ) 41 const char *name )
40 : QWidget( parent, name ), mCalendar( 0 ), 42 : QWidget( parent, name ), mCalendar( 0 ),
41 mHorizontalCount( 1 ), mVerticalCount( 1 ) 43 mHorizontalCount( 1 ), mVerticalCount( 1 )
42{ 44{
43 mResizeEnabled = false; 45 mResizeEnabled = false;
44 mExtraViews.setAutoDelete( true ); 46 mExtraViews.setAutoDelete( true );
45 47
46 mNavigatorView = new KDateNavigator( this, name ); 48 mNavigatorView = new KDateNavigator( this, name );
47 mNavigatorView->hide(); 49 mNavigatorView->hide();
48 connectNavigatorView( mNavigatorView ); 50 connectNavigatorView( mNavigatorView );
49 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 51 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
50 mLastDisplayedDN = 0; 52 mLastDisplayedDN = 0;
51 mUpdateTimer = new QTimer( this ); 53 mUpdateTimer = new QTimer( this );
52 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() )); 54 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() ));
diff --git a/korganizer/datenavigatorcontainer.h b/korganizer/datenavigatorcontainer.h
index 87cc59f..75d387c 100644
--- a/korganizer/datenavigatorcontainer.h
+++ b/korganizer/datenavigatorcontainer.h
@@ -1,16 +1,19 @@
1//Added by qt3to4:
2#include <QResizeEvent>
3#include <Q3PtrList>
1/* 4/*
2 This file is part of KOrganizer. 5 This file is part of KOrganizer.
3 6
4 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> 7 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> 8 Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 9
7 This program is free software; you can redistribute it and/or modify 10 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 11 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 12 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 13 (at your option) any later version.
11 14
12 This program is distributed in the hope that it will be useful, 15 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 18 GNU General Public License for more details.
16 19
@@ -87,23 +90,23 @@ class DateNavigatorContainer: public QWidget
87 void jumpMonth( int month ); 90 void jumpMonth( int month );
88 void resizeEvent( QResizeEvent * ); 91 void resizeEvent( QResizeEvent * );
89 92
90 void setBaseDates(); 93 void setBaseDates();
91 void connectNavigatorView( KDateNavigator *v ); 94 void connectNavigatorView( KDateNavigator *v );
92 95
93 private: 96 private:
94 bool mResizeEnabled; 97 bool mResizeEnabled;
95 QTimer* mUpdateTimer; 98 QTimer* mUpdateTimer;
96 int mLastDisplayedDN; 99 int mLastDisplayedDN;
97 QDate mFirstSelectedDate; 100 QDate mFirstSelectedDate;
98 int mSelectedDateCount; 101 int mSelectedDateCount;
99 KDateNavigator *mNavigatorView; 102 KDateNavigator *mNavigatorView;
100 103
101 KCal::Calendar *mCalendar; 104 KCal::Calendar *mCalendar;
102 105
103 QPtrList<KDateNavigator> mExtraViews; 106 Q3PtrList<KDateNavigator> mExtraViews;
104 107
105 int mHorizontalCount; 108 int mHorizontalCount;
106 int mVerticalCount; 109 int mVerticalCount;
107}; 110};
108 111
109#endif 112#endif
diff --git a/korganizer/filteredit_base.cpp b/korganizer/filteredit_base.cpp
index 505edf6..9425963 100644
--- a/korganizer/filteredit_base.cpp
+++ b/korganizer/filteredit_base.cpp
@@ -1,128 +1,132 @@
1/**************************************************************************** 1/****************************************************************************
2** Form implementation generated from reading ui file 'filteredit_base.ui' 2** Form implementation generated from reading ui file 'filteredit_base.ui'
3** 3**
4** Created: Fr Jan 21 21:25:30 2005 4** Created: Fr Jan 21 21:25:30 2005
5** by: The User Interface Compiler ($Id$) 5** by: The User Interface Compiler ($Id$)
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9 9
10#include "filteredit_base.h" 10#include "filteredit_base.h"
11 11
12#include <qvariant.h> 12#include <qvariant.h>
13#include <qpushbutton.h> 13#include <qpushbutton.h>
14#include <qframe.h> 14#include <q3frame.h>
15#include <qbuttongroup.h> 15#include <q3buttongroup.h>
16#include <qapplication.h> 16#include <qapplication.h>
17#include <QDesktopWidget>
17#include <qradiobutton.h> 18#include <qradiobutton.h>
18#include <qlistbox.h> 19#include <q3listbox.h>
19#include <qlabel.h> 20#include <qlabel.h>
20#include <qcheckbox.h> 21#include <qcheckbox.h>
21#include <qlayout.h> 22#include <qlayout.h>
22#include <qtooltip.h> 23#include <qtooltip.h>
23#include <qwhatsthis.h> 24#include <q3whatsthis.h>
25//Added by qt3to4:
26#include <Q3GridLayout>
27#include <Q3HBoxLayout>
28#include <Q3VBoxLayout>
24#include "tr.h" 29#include "tr.h"
25 30
26/* 31/*
27 * Constructs a FilterEdit_base as a child of 'parent', with the 32 * Constructs a FilterEdit_base as a child of 'parent', with the
28 * name 'name' and widget flags set to 'f'. 33 * name 'name' and widget flags set to 'f'.
29 */ 34 */
30FilterEdit_base::FilterEdit_base( QWidget* parent, const char* name, WFlags fl ) 35FilterEdit_base::FilterEdit_base( QWidget* parent, const char* name, Qt::WFlags fl )
31 : QWidget( parent, name, fl ) 36 : QWidget( parent, name, fl )
32{ 37{
33 if ( !name ) 38 if ( !name )
34 setName( "FilterEdit_base" ); 39 setName( "FilterEdit_base" );
35 FilterEdit_baseLayout = new QVBoxLayout( this, 0, 0, "FilterEdit_baseLayout"); 40 FilterEdit_baseLayout = new Q3VBoxLayout( this, 0, 0, "FilterEdit_baseLayout");
36 41
37 mCriteriaFrame = new QFrame( this, "mCriteriaFrame" ); 42 mCriteriaFrame = new Q3Frame( this, "mCriteriaFrame" );
38 mCriteriaFrame->setFrameShape( QFrame::StyledPanel ); 43 mCriteriaFrame->setFrameShape( Q3Frame::StyledPanel );
39 mCriteriaFrame->setFrameShadow( QFrame::Raised ); 44 mCriteriaFrame->setFrameShadow( Q3Frame::Raised );
40 mCriteriaFrameLayout = new QVBoxLayout( mCriteriaFrame, 3, 2, "mCriteriaFrameLayout"); 45 mCriteriaFrameLayout = new Q3VBoxLayout( mCriteriaFrame, 3, 2, "mCriteriaFrameLayout");
41 46
42 ButtonGroup1 = new QButtonGroup( mCriteriaFrame, "ButtonGroup1" ); 47 ButtonGroup1 = new Q3ButtonGroup( mCriteriaFrame, "ButtonGroup1" );
43 ButtonGroup1->setColumnLayout(0, Qt::Vertical ); 48 ButtonGroup1->setColumnLayout(0, Qt::Vertical );
44 ButtonGroup1->layout()->setSpacing( 6 ); 49 ButtonGroup1->layout()->setSpacing( 6 );
45 ButtonGroup1->layout()->setMargin( 6 ); 50 ButtonGroup1->layout()->setMargin( 6 );
46 ButtonGroup1Layout = new QGridLayout( ButtonGroup1->layout() ); 51 ButtonGroup1Layout = new Q3GridLayout( ButtonGroup1->layout() );
47 ButtonGroup1Layout->setAlignment( Qt::AlignTop ); 52 ButtonGroup1Layout->setAlignment( Qt::AlignTop );
48 53
49 layout4 = new QHBoxLayout( 0, 0, 6, "layout4"); 54 layout4 = new Q3HBoxLayout( 0, 0, 6, "layout4");
50 55
51 mCatShowCheck = new QRadioButton( ButtonGroup1, "mCatShowCheck" ); 56 mCatShowCheck = new QRadioButton( ButtonGroup1, "mCatShowCheck" );
52 layout4->addWidget( mCatShowCheck ); 57 layout4->addWidget( mCatShowCheck );
53 58
54 mCatHideCheck = new QRadioButton( ButtonGroup1, "mCatHideCheck" ); 59 mCatHideCheck = new QRadioButton( ButtonGroup1, "mCatHideCheck" );
55 layout4->addWidget( mCatHideCheck ); 60 layout4->addWidget( mCatHideCheck );
56 61
57 mCatEditButton = new QPushButton( ButtonGroup1, "mCatEditButton" ); 62 mCatEditButton = new QPushButton( ButtonGroup1, "mCatEditButton" );
58 layout4->addWidget( mCatEditButton ); 63 layout4->addWidget( mCatEditButton );
59 64
60 ButtonGroup1Layout->addLayout( layout4, 0, 0 ); 65 ButtonGroup1Layout->addLayout( layout4, 0, 0 );
61 66
62 mCatList = new QListBox( ButtonGroup1, "mCatList" ); 67 mCatList = new Q3ListBox( ButtonGroup1, "mCatList" );
63 68
64 ButtonGroup1Layout->addWidget( mCatList, 1, 0 ); 69 ButtonGroup1Layout->addWidget( mCatList, 1, 0 );
65 mCriteriaFrameLayout->addWidget( ButtonGroup1 ); 70 mCriteriaFrameLayout->addWidget( ButtonGroup1 );
66 71
67 layout7 = new QHBoxLayout( 0, 0, 6, "layout7"); 72 layout7 = new Q3HBoxLayout( 0, 0, 6, "layout7");
68 73
69 textLabel1 = new QLabel( mCriteriaFrame, "textLabel1" ); 74 textLabel1 = new QLabel( mCriteriaFrame, "textLabel1" );
70 layout7->addWidget( textLabel1 ); 75 layout7->addWidget( textLabel1 );
71 76
72 mRecurringCheck = new QCheckBox( mCriteriaFrame, "mRecurringCheck" ); 77 mRecurringCheck = new QCheckBox( mCriteriaFrame, "mRecurringCheck" );
73 layout7->addWidget( mRecurringCheck ); 78 layout7->addWidget( mRecurringCheck );
74 79
75 mCompletedCheck = new QCheckBox( mCriteriaFrame, "mCompletedCheck" ); 80 mCompletedCheck = new QCheckBox( mCriteriaFrame, "mCompletedCheck" );
76 layout7->addWidget( mCompletedCheck ); 81 layout7->addWidget( mCompletedCheck );
77 mCriteriaFrameLayout->addLayout( layout7 ); 82 mCriteriaFrameLayout->addLayout( layout7 );
78 83
79 layout9 = new QHBoxLayout( 0, 0, 6, "layout9"); 84 layout9 = new Q3HBoxLayout( 0, 0, 6, "layout9");
80 85
81 textLabel1_2 = new QLabel( mCriteriaFrame, "textLabel1_2" ); 86 textLabel1_2 = new QLabel( mCriteriaFrame, "textLabel1_2" );
82 layout9->addWidget( textLabel1_2 ); 87 layout9->addWidget( textLabel1_2 );
83 88
84 mEventCheck = new QCheckBox( mCriteriaFrame, "mEventCheck" ); 89 mEventCheck = new QCheckBox( mCriteriaFrame, "mEventCheck" );
85 layout9->addWidget( mEventCheck ); 90 layout9->addWidget( mEventCheck );
86 91
87 mTodoCheck = new QCheckBox( mCriteriaFrame, "mTodoCheck" ); 92 mTodoCheck = new QCheckBox( mCriteriaFrame, "mTodoCheck" );
88 layout9->addWidget( mTodoCheck ); 93 layout9->addWidget( mTodoCheck );
89 94
90 mJournalCheck = new QCheckBox( mCriteriaFrame, "mJournalCheck" ); 95 mJournalCheck = new QCheckBox( mCriteriaFrame, "mJournalCheck" );
91 layout9->addWidget( mJournalCheck ); 96 layout9->addWidget( mJournalCheck );
92 mCriteriaFrameLayout->addLayout( layout9 ); 97 mCriteriaFrameLayout->addLayout( layout9 );
93 98
94 layout2 = new QHBoxLayout( 0, 0, 0, "layout2"); 99 layout2 = new Q3HBoxLayout( 0, 0, 0, "layout2");
95 100
96 textLabel2 = new QLabel( mCriteriaFrame, "textLabel2" ); 101 textLabel2 = new QLabel( mCriteriaFrame, "textLabel2" );
97 layout2->addWidget( textLabel2 ); 102 layout2->addWidget( textLabel2 );
98 103
99 mPublicCheck = new QCheckBox( mCriteriaFrame, "mPublicCheck" ); 104 mPublicCheck = new QCheckBox( mCriteriaFrame, "mPublicCheck" );
100 layout2->addWidget( mPublicCheck ); 105 layout2->addWidget( mPublicCheck );
101 106
102 mPrivateCheck = new QCheckBox( mCriteriaFrame, "mPrivateCheck" ); 107 mPrivateCheck = new QCheckBox( mCriteriaFrame, "mPrivateCheck" );
103 layout2->addWidget( mPrivateCheck ); 108 layout2->addWidget( mPrivateCheck );
104 109
105 mConfidentialCheck = new QCheckBox( mCriteriaFrame, "mConfidentialCheck" ); 110 mConfidentialCheck = new QCheckBox( mCriteriaFrame, "mConfidentialCheck" );
106 mConfidentialCheck->setChecked( FALSE ); 111 mConfidentialCheck->setChecked( FALSE );
107 layout2->addWidget( mConfidentialCheck ); 112 layout2->addWidget( mConfidentialCheck );
108 mCriteriaFrameLayout->addLayout( layout2 ); 113 mCriteriaFrameLayout->addLayout( layout2 );
109 FilterEdit_baseLayout->addWidget( mCriteriaFrame ); 114 FilterEdit_baseLayout->addWidget( mCriteriaFrame );
110 languageChange(); 115 languageChange();
111 resize( QSize(300, 200).expandedTo(minimumSizeHint()) ); 116 resize( QSize(300, 200).expandedTo(minimumSizeHint()) );
112 clearWState( WState_Polished );
113} 117}
114 118
115/* 119/*
116 * Destroys the object and frees any allocated resources 120 * Destroys the object and frees any allocated resources
117 */ 121 */
118FilterEdit_base::~FilterEdit_base() 122FilterEdit_base::~FilterEdit_base()
119{ 123{
120 // no need to delete child widgets, Qt does it all for us 124 // no need to delete child widgets, Qt does it all for us
121} 125}
122 126
123/* 127/*
124 * Sets the strings of the subwidgets using the current 128 * Sets the strings of the subwidgets using the current
125 * language. 129 * language.
126 */ 130 */
127void FilterEdit_base::languageChange() 131void FilterEdit_base::languageChange()
128{ 132{
diff --git a/korganizer/filteredit_base.h b/korganizer/filteredit_base.h
index 13a02c3..135f6fa 100644
--- a/korganizer/filteredit_base.h
+++ b/korganizer/filteredit_base.h
@@ -1,69 +1,75 @@
1/**************************************************************************** 1/****************************************************************************
2** Form interface generated from reading ui file 'filteredit_base.ui' 2** Form interface generated from reading ui file 'filteredit_base.ui'
3** 3**
4** Created: Fr Jan 21 21:25:30 2005 4** Created: Fr Jan 21 21:25:30 2005
5** by: The User Interface Compiler ($Id$) 5** by: The User Interface Compiler ($Id$)
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9 9
10#ifndef FILTEREDIT_BASE_H 10#ifndef FILTEREDIT_BASE_H
11#define FILTEREDIT_BASE_H 11#define FILTEREDIT_BASE_H
12 12
13#include <qvariant.h> 13#include <qvariant.h>
14#include <qwidget.h> 14#include <qwidget.h>
15//Added by qt3to4:
16#include <Q3VBoxLayout>
17#include <Q3Frame>
18#include <Q3GridLayout>
19#include <Q3HBoxLayout>
20#include <QLabel>
15 21
16class QVBoxLayout; 22class Q3VBoxLayout;
17class QHBoxLayout; 23class Q3HBoxLayout;
18class QGridLayout; 24class Q3GridLayout;
19class QSpacerItem; 25class QSpacerItem;
20class QFrame; 26class Q3Frame;
21class QButtonGroup; 27class Q3ButtonGroup;
22class QRadioButton; 28class QRadioButton;
23class QPushButton; 29class QPushButton;
24class QListBox; 30class Q3ListBox;
25class QListBoxItem; 31class Q3ListBoxItem;
26class QLabel; 32class QLabel;
27class QCheckBox; 33class QCheckBox;
28 34
29class FilterEdit_base : public QWidget 35class FilterEdit_base : public QWidget
30{ 36{
31 Q_OBJECT 37 Q_OBJECT
32 38
33public: 39public:
34 FilterEdit_base( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 40 FilterEdit_base( QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0 );
35 ~FilterEdit_base(); 41 ~FilterEdit_base();
36 42
37 QFrame* mCriteriaFrame; 43 Q3Frame* mCriteriaFrame;
38 QButtonGroup* ButtonGroup1; 44 Q3ButtonGroup* ButtonGroup1;
39 QRadioButton* mCatShowCheck; 45 QRadioButton* mCatShowCheck;
40 QRadioButton* mCatHideCheck; 46 QRadioButton* mCatHideCheck;
41 QPushButton* mCatEditButton; 47 QPushButton* mCatEditButton;
42 QListBox* mCatList; 48 Q3ListBox* mCatList;
43 QLabel* textLabel1; 49 QLabel* textLabel1;
44 QCheckBox* mRecurringCheck; 50 QCheckBox* mRecurringCheck;
45 QCheckBox* mCompletedCheck; 51 QCheckBox* mCompletedCheck;
46 QLabel* textLabel1_2; 52 QLabel* textLabel1_2;
47 QCheckBox* mEventCheck; 53 QCheckBox* mEventCheck;
48 QCheckBox* mTodoCheck; 54 QCheckBox* mTodoCheck;
49 QCheckBox* mJournalCheck; 55 QCheckBox* mJournalCheck;
50 QLabel* textLabel2; 56 QLabel* textLabel2;
51 QCheckBox* mPublicCheck; 57 QCheckBox* mPublicCheck;
52 QCheckBox* mPrivateCheck; 58 QCheckBox* mPrivateCheck;
53 QCheckBox* mConfidentialCheck; 59 QCheckBox* mConfidentialCheck;
54 60
55protected: 61protected:
56 QVBoxLayout* FilterEdit_baseLayout; 62 Q3VBoxLayout* FilterEdit_baseLayout;
57 QVBoxLayout* mCriteriaFrameLayout; 63 Q3VBoxLayout* mCriteriaFrameLayout;
58 QGridLayout* ButtonGroup1Layout; 64 Q3GridLayout* ButtonGroup1Layout;
59 QHBoxLayout* layout4; 65 Q3HBoxLayout* layout4;
60 QHBoxLayout* layout7; 66 Q3HBoxLayout* layout7;
61 QHBoxLayout* layout9; 67 Q3HBoxLayout* layout9;
62 QHBoxLayout* layout2; 68 Q3HBoxLayout* layout2;
63 69
64protected slots: 70protected slots:
65 virtual void languageChange(); 71 virtual void languageChange();
66 72
67}; 73};
68 74
69#endif // FILTEREDIT_BASE_H 75#endif // FILTEREDIT_BASE_H
diff --git a/korganizer/filtereditdialog.cpp b/korganizer/filtereditdialog.cpp
index df84911..a3cff49 100644
--- a/korganizer/filtereditdialog.cpp
+++ b/korganizer/filtereditdialog.cpp
@@ -13,87 +13,92 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qpushbutton.h> 25#include <qpushbutton.h>
26#include <qcombobox.h> 26#include <qcombobox.h>
27#include <qcheckbox.h> 27#include <qcheckbox.h>
28#include <qradiobutton.h> 28#include <qradiobutton.h>
29#include <qlistbox.h> 29#include <q3listbox.h>
30#include <qapplication.h> 30#include <qapplication.h>
31//Added by qt3to4:
32#include <Q3GridLayout>
33#include <Q3PtrList>
34
35#include <QDesktopWidget>
31 36
32#include <kdebug.h> 37#include <kdebug.h>
33#include <klocale.h> 38#include <klocale.h>
34#include <klineeditdlg.h> 39#include <klineeditdlg.h>
35#include <kmessagebox.h> 40#include <kmessagebox.h>
36 41
37#include <libkdepim/categoryselectdialog.h> 42#include <libkdepim/categoryselectdialog.h>
38 43
39#include "koprefs.h" 44#include "koprefs.h"
40#include "filteredit_base.h" 45#include "filteredit_base.h"
41 46
42#include "filtereditdialog.h" 47#include "filtereditdialog.h"
43//#include "filtereditdialog.moc" 48//#include "filtereditdialog.moc"
44 49
45// TODO: Make dialog work on a copy of the filters objects. 50// TODO: Make dialog work on a copy of the filters objects.
46 51
47class ComboFilterBox: public QComboBox 52class ComboFilterBox: public QComboBox
48{ 53{
49public: 54public:
50 ComboFilterBox( QWidget *parent=0, const char *name=0) : 55 ComboFilterBox( QWidget *parent=0, const char *name=0) :
51 QComboBox( parent,name ) { } 56 QComboBox( parent,name ) { }
52 void popupBox() { popup(); } 57 void popupBox() { popup(); }
53 58
54}; 59};
55 60
56FilterEditDialog::FilterEditDialog(QPtrList<CalFilter> *filters,QWidget *parent, 61FilterEditDialog::FilterEditDialog(Q3PtrList<CalFilter> *filters,QWidget *parent,
57 const char *name) : 62 const char *name) :
58 KDialogBase(parent,name,true,i18n("Edit Calendar Filters"), 63 KDialogBase(parent,name,true,i18n("Edit Calendar Filters"),
59 Ok|Apply|Cancel) 64 Ok|Apply|Cancel)
60{ 65{
61 mFilters = filters; 66 mFilters = filters;
62 67
63 QWidget *mainWidget = new QWidget(this); 68 QWidget *mainWidget = new QWidget(this);
64 setMainWidget(mainWidget); 69 setMainWidget(mainWidget);
65 70
66 mSelectionCombo = new ComboFilterBox(mainWidget); 71 mSelectionCombo = new ComboFilterBox(mainWidget);
67 connect(mSelectionCombo,SIGNAL(activated(int)),SLOT(filterSelected())); 72 connect(mSelectionCombo,SIGNAL(activated(int)),SLOT(filterSelected()));
68 // mSelectionCombo->setEditable ( true ); 73 // mSelectionCombo->setEditable ( true );
69 QPushButton *addButton = new QPushButton(i18n("Add Filter"),mainWidget); 74 QPushButton *addButton = new QPushButton(i18n("Add Filter"),mainWidget);
70 connect(addButton,SIGNAL(clicked()),SLOT(slotAdd())); 75 connect(addButton,SIGNAL(clicked()),SLOT(slotAdd()));
71 addButton->setMaximumSize( addButton->sizeHint()); 76 addButton->setMaximumSize( addButton->sizeHint());
72 mRemoveButton = new QPushButton( i18n("Remove"), mainWidget ); 77 mRemoveButton = new QPushButton( i18n("Remove"), mainWidget );
73 connect( mRemoveButton, SIGNAL( clicked() ), SLOT( slotRemove() ) ); 78 connect( mRemoveButton, SIGNAL( clicked() ), SLOT( slotRemove() ) );
74 mRemoveButton->setMaximumSize( mRemoveButton->sizeHint()); 79 mRemoveButton->setMaximumSize( mRemoveButton->sizeHint());
75 80
76 QPushButton *upButton = new QPushButton(i18n("Up"),mainWidget); 81 QPushButton *upButton = new QPushButton(i18n("Up"),mainWidget);
77 upButton->setMaximumSize( upButton->sizeHint()); 82 upButton->setMaximumSize( upButton->sizeHint());
78 connect(upButton,SIGNAL(clicked()),SLOT(slotUp())); 83 connect(upButton,SIGNAL(clicked()),SLOT(slotUp()));
79 84
80 85
81 mEditor = new FilterEdit_base(mainWidget); 86 mEditor = new FilterEdit_base(mainWidget);
82 87
83 QGridLayout *topLayout = new QGridLayout(mainWidget,2,2); 88 Q3GridLayout *topLayout = new Q3GridLayout(mainWidget,2,2);
84 topLayout->setSpacing(spacingHint()); 89 topLayout->setSpacing(spacingHint());
85 topLayout->addWidget(mSelectionCombo,0,0); 90 topLayout->addWidget(mSelectionCombo,0,0);
86 topLayout->addWidget(upButton,0,1); 91 topLayout->addWidget(upButton,0,1);
87 topLayout->addWidget(addButton,0,2); 92 topLayout->addWidget(addButton,0,2);
88 topLayout->addWidget(mRemoveButton,0,3); 93 topLayout->addWidget(mRemoveButton,0,3);
89 topLayout->addMultiCellWidget(mEditor,1,1,0,3); 94 topLayout->addMultiCellWidget(mEditor,1,1,0,3);
90 mSelectionCombo->setMaximumWidth ( QApplication::desktop()->width() - 95 mSelectionCombo->setMaximumWidth ( QApplication::desktop()->width() -
91 addButton->maximumWidth() - 96 addButton->maximumWidth() -
92 mRemoveButton->maximumWidth() - 97 mRemoveButton->maximumWidth() -
93 upButton->maximumWidth() - 98 upButton->maximumWidth() -
94 spacingHint() * 5 ); 99 spacingHint() * 5 );
95 connect(mEditor->mCatEditButton,SIGNAL(clicked()), 100 connect(mEditor->mCatEditButton,SIGNAL(clicked()),
96 SLOT(editCategorySelection())); 101 SLOT(editCategorySelection()));
97 102
98 // Clicking cancel exits the dialog without saving 103 // Clicking cancel exits the dialog without saving
99 connect(this,SIGNAL(cancelClicked()),SLOT(reject())); 104 connect(this,SIGNAL(cancelClicked()),SLOT(reject()));
diff --git a/korganizer/filtereditdialog.h b/korganizer/filtereditdialog.h
index 42aa3da..c1a52ed 100644
--- a/korganizer/filtereditdialog.h
+++ b/korganizer/filtereditdialog.h
@@ -10,77 +10,77 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef _FILTEREDITDIALOG_H 23#ifndef _FILTEREDITDIALOG_H
24#define _FILTEREDITDIALOG_H 24#define _FILTEREDITDIALOG_H
25 25
26#include <qptrlist.h> 26#include <q3ptrlist.h>
27 27
28#include <kdialogbase.h> 28#include <kdialogbase.h>
29 29
30#include <libkcal/calfilter.h> 30#include <libkcal/calfilter.h>
31 31
32class QComboBox; 32class QComboBox;
33class ComboFilterBox; 33class ComboFilterBox;
34class QPushButton; 34class QPushButton;
35class FilterEdit_base; 35class FilterEdit_base;
36 36
37using namespace KCal; 37using namespace KCal;
38 38
39/** 39/**
40 This is the class to add/edit a calendar filter. 40 This is the class to add/edit a calendar filter.
41 41
42 @short Creates a dialog box to create/edit a calendar filter 42 @short Creates a dialog box to create/edit a calendar filter
43 @author Cornelius Schumacher 43 @author Cornelius Schumacher
44*/ 44*/
45class FilterEditDialog : public KDialogBase 45class FilterEditDialog : public KDialogBase
46{ 46{
47 Q_OBJECT 47 Q_OBJECT
48 public: 48 public:
49 FilterEditDialog(QPtrList<CalFilter> *,QWidget *parent=0, const char *name=0); 49 FilterEditDialog(Q3PtrList<CalFilter> *,QWidget *parent=0, const char *name=0);
50 virtual ~FilterEditDialog(); 50 virtual ~FilterEditDialog();
51 51
52 public slots: 52 public slots:
53 void updateFilterList(); 53 void updateFilterList();
54 54
55 signals: 55 signals:
56 void filterChanged(); 56 void filterChanged();
57 57
58 protected slots: 58 protected slots:
59 void slotDefault(); 59 void slotDefault();
60 void slotApply(); 60 void slotApply();
61 void slotOk(); 61 void slotOk();
62 void accept(); 62 void accept();
63 63
64 void slotAdd(); 64 void slotAdd();
65 void slotUp(); 65 void slotUp();
66 void slotRemove(); 66 void slotRemove();
67 67
68 void filterSelected(); 68 void filterSelected();
69 void editCategorySelection(); 69 void editCategorySelection();
70 void updateCategorySelection(const QStringList &categories); 70 void updateCategorySelection(const QStringList &categories);
71 71
72 protected: 72 protected:
73 void readFilter(CalFilter *); 73 void readFilter(CalFilter *);
74 void writeFilter(CalFilter *); 74 void writeFilter(CalFilter *);
75 75
76 private: 76 private:
77 QPtrList<CalFilter> *mFilters; 77 Q3PtrList<CalFilter> *mFilters;
78 78
79 ComboFilterBox *mSelectionCombo; 79 ComboFilterBox *mSelectionCombo;
80 QPushButton *mRemoveButton; 80 QPushButton *mRemoveButton;
81 FilterEdit_base *mEditor; 81 FilterEdit_base *mEditor;
82 82
83 QStringList mCategories; 83 QStringList mCategories;
84}; 84};
85 85
86#endif 86#endif
diff --git a/korganizer/incomingdialog.cpp b/korganizer/incomingdialog.cpp
index fe78356..c2402d4 100644
--- a/korganizer/incomingdialog.cpp
+++ b/korganizer/incomingdialog.cpp
@@ -4,36 +4,38 @@
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qlistview.h> 20#include <q3listview.h>
21#include <qfile.h> 21#include <qfile.h>
22#include <qdir.h> 22#include <qdir.h>
23#include <qmap.h> 23#include <qmap.h>
24//Added by qt3to4:
25#include <Q3PtrList>
24 26
25#include <kglobal.h> 27#include <kglobal.h>
26#include <klocale.h> 28#include <klocale.h>
27#include <kdebug.h> 29#include <kdebug.h>
28#include <kstandarddirs.h> 30#include <kstandarddirs.h>
29#include <kmessagebox.h> 31#include <kmessagebox.h>
30 32
31#include <libkcal/incidence.h> 33#include <libkcal/incidence.h>
32#include <libkcal/event.h> 34#include <libkcal/event.h>
33#include <libkcal/calendar.h> 35#include <libkcal/calendar.h>
34#include <libkcal/freebusy.h> 36#include <libkcal/freebusy.h>
35#include <libkcal/attendee.h> 37#include <libkcal/attendee.h>
36#include <libkcal/calendarresources.h> 38#include <libkcal/calendarresources.h>
37#include <libkcal/resourcecalendar.h> 39#include <libkcal/resourcecalendar.h>
38#include <kresources/resourceselectdialog.h> 40#include <kresources/resourceselectdialog.h>
39 41
@@ -43,35 +45,35 @@
43#include <libkcal/dummyscheduler.h> 45#include <libkcal/dummyscheduler.h>
44#endif 46#endif
45 47
46 48
47#include "incomingdialog.h" 49#include "incomingdialog.h"
48#include "koeventviewerdialog.h" 50#include "koeventviewerdialog.h"
49#include "kocounterdialog.h" 51#include "kocounterdialog.h"
50#include "koprefs.h" 52#include "koprefs.h"
51 53
52#ifndef KORG_NOKABC 54#ifndef KORG_NOKABC
53#define KORG_NOKABC 55#define KORG_NOKABC
54//#include <kabc/stdaddressbook.h> 56//#include <kabc/stdaddressbook.h>
55#define size count 57#define size count
56#endif 58#endif
57 59
58 60
59ScheduleItemIn::ScheduleItemIn(QListView *parent,IncidenceBase *ev, 61ScheduleItemIn::ScheduleItemIn(Q3ListView *parent,IncidenceBase *ev,
60 Scheduler::Method method,ScheduleMessage::Status status) 62 Scheduler::Method method,ScheduleMessage::Status status)
61 : QListViewItem(parent) 63 : Q3ListViewItem(parent)
62{ 64{
63 mIncidence = ev; 65 mIncidence = ev;
64 mMethod = method; 66 mMethod = method;
65 mStatus = status; 67 mStatus = status;
66 setText(6,Scheduler::translatedMethodName(mMethod)+" "); 68 setText(6,Scheduler::translatedMethodName(mMethod)+" ");
67 setText(7,ScheduleMessage::statusName(status)); 69 setText(7,ScheduleMessage::statusName(status));
68} 70}
69 71
70 72
71/* Visitor */ 73/* Visitor */
72ScheduleItemVisitor::ScheduleItemVisitor(ScheduleItemIn *item) 74ScheduleItemVisitor::ScheduleItemVisitor(ScheduleItemIn *item)
73{ 75{
74 mItem = item; 76 mItem = item;
75} 77}
76 78
77ScheduleItemVisitor::~ScheduleItemVisitor() 79ScheduleItemVisitor::~ScheduleItemVisitor()
@@ -122,67 +124,67 @@ bool ScheduleItemVisitor::visit(Todo *e)
122} 124}
123 125
124bool ScheduleItemVisitor::visit(Journal *) 126bool ScheduleItemVisitor::visit(Journal *)
125{ 127{
126 return false; 128 return false;
127} 129}
128 130
129 131
130/* 132/*
131 * Constructs a IncomingDialog which is a child of 'parent', with the 133 * Constructs a IncomingDialog which is a child of 'parent', with the
132 * name 'name' and widget flags set to 'f' 134 * name 'name' and widget flags set to 'f'
133 * 135 *
134 * The dialog will by default be modeless, unless you set 'modal' to 136 * The dialog will by default be modeless, unless you set 'modal' to
135 * TRUE to construct a modal dialog. 137 * TRUE to construct a modal dialog.
136 */ 138 */
137IncomingDialog::IncomingDialog(Calendar *calendar,OutgoingDialog *outgoing, 139IncomingDialog::IncomingDialog(Calendar *calendar,OutgoingDialog *outgoing,
138 QWidget* parent,const char* name,bool modal,WFlags fl) : 140 QWidget* parent,const char* name,bool modal,Qt::WFlags fl) :
139 IncomingDialog_base(parent,name,modal,fl) 141 IncomingDialog_base(parent,name,modal,fl)
140{ 142{
141 mCalendar = calendar; 143 mCalendar = calendar;
142 mOutgoing = outgoing; 144 mOutgoing = outgoing;
143#ifndef KORG_NOMAIL 145#ifndef KORG_NOMAIL
144 mScheduler = new MailScheduler(mCalendar); 146 mScheduler = new MailScheduler(mCalendar);
145#else 147#else
146 mScheduler = new DummyScheduler(mCalendar); 148 mScheduler = new DummyScheduler(mCalendar);
147#endif 149#endif
148 mMessageListView->setColumnAlignment(1,AlignHCenter); 150 mMessageListView->setColumnAlignment(1,Qt::AlignHCenter);
149 mMessageListView->setColumnAlignment(2,AlignHCenter); 151 mMessageListView->setColumnAlignment(2,Qt::AlignHCenter);
150 mMessageListView->setColumnAlignment(3,AlignHCenter); 152 mMessageListView->setColumnAlignment(3,Qt::AlignHCenter);
151 mMessageListView->setColumnAlignment(4,AlignHCenter); 153 mMessageListView->setColumnAlignment(4,Qt::AlignHCenter);
152 QObject::connect(mMessageListView,SIGNAL(doubleClicked(QListViewItem *)), 154 QObject::connect(mMessageListView,SIGNAL(doubleClicked(Q3ListViewItem *)),
153 this,SLOT(showEvent(QListViewItem *))); 155 this,SLOT(showEvent(Q3ListViewItem *)));
154 retrieve(); 156 retrieve();
155} 157}
156 158
157/* 159/*
158 * Destroys the object and frees any allocated resources 160 * Destroys the object and frees any allocated resources
159 */ 161 */
160IncomingDialog::~IncomingDialog() 162IncomingDialog::~IncomingDialog()
161{ 163{
162 // no need to delete child widgets, Qt does it all for us 164 // no need to delete child widgets, Qt does it all for us
163} 165}
164 166
165void IncomingDialog::setOutgoingDialog(OutgoingDialog *outgoing) 167void IncomingDialog::setOutgoingDialog(OutgoingDialog *outgoing)
166{ 168{
167 mOutgoing = outgoing; 169 mOutgoing = outgoing;
168} 170}
169 171
170void IncomingDialog::retrieve() 172void IncomingDialog::retrieve()
171{ 173{
172 QPtrList <ScheduleMessage> messages = mScheduler->retrieveTransactions(); 174 Q3PtrList <ScheduleMessage> messages = mScheduler->retrieveTransactions();
173 175
174 ScheduleMessage *message; 176 ScheduleMessage *message;
175 for(message = messages.first();message;message = messages.next()) { 177 for(message = messages.first();message;message = messages.next()) {
176 IncidenceBase *inc = message->event(); 178 IncidenceBase *inc = message->event();
177 Scheduler::Method method = (Scheduler::Method)message->method(); 179 Scheduler::Method method = (Scheduler::Method)message->method();
178 ScheduleMessage::Status status = message->status(); 180 ScheduleMessage::Status status = message->status();
179 181
180 ScheduleItemIn *item = new ScheduleItemIn(mMessageListView,inc,method,status); 182 ScheduleItemIn *item = new ScheduleItemIn(mMessageListView,inc,method,status);
181 if(inc->typeID() != freebusyID ) { 183 if(inc->typeID() != freebusyID ) {
182 Incidence *incidence = static_cast<Incidence *>(inc); 184 Incidence *incidence = static_cast<Incidence *>(inc);
183 ScheduleItemVisitor v(item); 185 ScheduleItemVisitor v(item);
184 if (!incidence->accept(v)) delete item; 186 if (!incidence->accept(v)) delete item;
185 } else { 187 } else {
186 FreeBusy *fb = static_cast<FreeBusy *>(item->event()); 188 FreeBusy *fb = static_cast<FreeBusy *>(item->event());
187 item->setText(0, "FreeBusy"); 189 item->setText(0, "FreeBusy");
188 item->setText(1, KGlobal::locale()->formatDate( fb->dtStart().date() ) ); 190 item->setText(1, KGlobal::locale()->formatDate( fb->dtStart().date() ) );
@@ -239,50 +241,50 @@ bool IncomingDialog::acceptMessage(ScheduleItemIn *item)
239 default: 241 default:
240 return incomeDefault(item); 242 return incomeDefault(item);
241 } 243 }
242 return false; 244 return false;
243} 245}
244 246
245void IncomingDialog::rejectMessage() 247void IncomingDialog::rejectMessage()
246{ 248{
247 ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->selectedItem(); 249 ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->selectedItem();
248 if (item) { 250 if (item) {
249 mScheduler->deleteTransaction(item->event()); 251 mScheduler->deleteTransaction(item->event());
250 delete item; 252 delete item;
251 emit numMessagesChanged(mMessageListView->childCount()); 253 emit numMessagesChanged(mMessageListView->childCount());
252 } 254 }
253} 255}
254 256
255void IncomingDialog::showEvent(QListViewItem *item) 257void IncomingDialog::showEvent(Q3ListViewItem *item)
256{ 258{
257 IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); 259 IncidenceBase *incidence = ((ScheduleItemIn *)item)->event();
258 if( incidence && incidence->typeID() == eventID ) { 260 if( incidence && incidence->typeID() == eventID ) {
259 Event *event = static_cast<Event *>(incidence); 261 Event *event = static_cast<Event *>(incidence);
260 KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this); 262 KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this);
261 eventViewer->setEvent(event); 263 eventViewer->setEvent(event);
262 eventViewer->show(); 264 eventViewer->show();
263 } 265 }
264} 266}
265 267
266bool IncomingDialog::incomeRefresh(ScheduleItemIn *item) 268bool IncomingDialog::incomeRefresh(ScheduleItemIn *item)
267{ 269{
268 Event *ev = mCalendar->event(item->event()->uid()); 270 Event *ev = mCalendar->event(item->event()->uid());
269 if (ev) { 271 if (ev) {
270 //user interaction before?? 272 //user interaction before??
271 Attendee *att; 273 Attendee *att;
272 QPtrList<Attendee> attlist = ev->attendees(); 274 Q3PtrList<Attendee> attlist = ev->attendees();
273 for (att=attlist.first(); att; att=attlist.next()) { 275 for (att=attlist.first(); att; att=attlist.next()) {
274 Event *event = new Event(*ev); 276 Event *event = new Event(*ev);
275 mOutgoing->addMessage(event,Scheduler::Request,att->email()); 277 mOutgoing->addMessage(event,Scheduler::Request,att->email());
276 delete(event); 278 delete(event);
277 } 279 }
278 mScheduler->deleteTransaction(item->event()); 280 mScheduler->deleteTransaction(item->event());
279 delete item; 281 delete item;
280 emit numMessagesChanged(mMessageListView->childCount()); 282 emit numMessagesChanged(mMessageListView->childCount());
281 return true; 283 return true;
282 } 284 }
283 mScheduler->deleteTransaction(item->event()); 285 mScheduler->deleteTransaction(item->event());
284 delete item; 286 delete item;
285 emit numMessagesChanged(mMessageListView->childCount()); 287 emit numMessagesChanged(mMessageListView->childCount());
286 return false; 288 return false;
287} 289}
288 290
@@ -501,28 +503,28 @@ bool IncomingDialog::checkOrganizerInAddressbook(QString organizer)
501 bool inBook = false; 503 bool inBook = false;
502#ifndef KORG_NOKABC 504#ifndef KORG_NOKABC
503 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 505 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
504 KABC::Addressee::List addressList; 506 KABC::Addressee::List addressList;
505 addressList = add_book->findByEmail(organizer); 507 addressList = add_book->findByEmail(organizer);
506 if ( addressList.size()>0 ) inBook = true; 508 if ( addressList.size()>0 ) inBook = true;
507#endif 509#endif
508 return inBook; 510 return inBook;
509} 511}
510 512
511bool IncomingDialog::checkAttendeesInAddressbook(IncidenceBase *inc) 513bool IncomingDialog::checkAttendeesInAddressbook(IncidenceBase *inc)
512{ 514{
513 bool inBook = false; 515 bool inBook = false;
514#ifndef KORG_NOKABC 516#ifndef KORG_NOKABC
515 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 517 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
516 KABC::Addressee::List addressList; 518 KABC::Addressee::List addressList;
517 QPtrList <Attendee> attendees; 519 Q3PtrList <Attendee> attendees;
518 Attendee *att; 520 Attendee *att;
519 attendees = inc->attendees(); 521 attendees = inc->attendees();
520 for (att=attendees.first();att;att=attendees.next()) { 522 for (att=attendees.first();att;att=attendees.next()) {
521 addressList = add_book->findByEmail(att->email()); 523 addressList = add_book->findByEmail(att->email());
522 if (addressList.size()>0 ) inBook = true; 524 if (addressList.size()>0 ) inBook = true;
523 } 525 }
524#endif 526#endif
525 return inBook; 527 return inBook;
526} 528}
527 529
528//#include "incomingdialog.moc" 530//#include "incomingdialog.moc"
diff --git a/korganizer/incomingdialog.h b/korganizer/incomingdialog.h
index 413ce6a..e002b25 100644
--- a/korganizer/incomingdialog.h
+++ b/korganizer/incomingdialog.h
@@ -6,46 +6,46 @@
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19#ifndef INCOMINGDIALOG_H 19#ifndef INCOMINGDIALOG_H
20#define INCOMINGDIALOG_H 20#define INCOMINGDIALOG_H
21 21
22#include <qlistview.h> 22#include <q3listview.h>
23 23
24#include <libkcal/calendar.h> 24#include <libkcal/calendar.h>
25#include <libkcal/scheduler.h> 25#include <libkcal/scheduler.h>
26 26
27#include "incomingdialog_base.h" 27#include "incomingdialog_base.h"
28#include "outgoingdialog.h" 28#include "outgoingdialog.h"
29 29
30using namespace KCal; 30using namespace KCal;
31 31
32class ScheduleItemIn : public QListViewItem 32class ScheduleItemIn : public Q3ListViewItem
33{ 33{
34 public: 34 public:
35 ScheduleItemIn(QListView *parent,IncidenceBase *ev,Scheduler::Method method, 35 ScheduleItemIn(Q3ListView *parent,IncidenceBase *ev,Scheduler::Method method,
36 ScheduleMessage::Status status); 36 ScheduleMessage::Status status);
37 virtual ~ScheduleItemIn() {} 37 virtual ~ScheduleItemIn() {}
38 38
39 IncidenceBase *event() { return mIncidence; } 39 IncidenceBase *event() { return mIncidence; }
40 Scheduler::Method method() { return mMethod; } 40 Scheduler::Method method() { return mMethod; }
41 ScheduleMessage::Status status() { return mStatus; } 41 ScheduleMessage::Status status() { return mStatus; }
42 42
43 private: 43 private:
44 IncidenceBase *mIncidence; 44 IncidenceBase *mIncidence;
45 Scheduler::Method mMethod; 45 Scheduler::Method mMethod;
46 ScheduleMessage::Status mStatus; 46 ScheduleMessage::Status mStatus;
47}; 47};
48 48
49 49
50/** 50/**
51 This class provides the initialisation of a ScheduleItemIn for calendar 51 This class provides the initialisation of a ScheduleItemIn for calendar
@@ -59,48 +59,48 @@ class ScheduleItemVisitor : public Incidence::Visitor
59 59
60 bool visit(Event *); 60 bool visit(Event *);
61 bool visit(Todo *); 61 bool visit(Todo *);
62 bool visit(Journal *); 62 bool visit(Journal *);
63 63
64 private: 64 private:
65 ScheduleItemIn *mItem; 65 ScheduleItemIn *mItem;
66}; 66};
67 67
68 68
69 69
70class IncomingDialog : public IncomingDialog_base 70class IncomingDialog : public IncomingDialog_base
71{ 71{
72 Q_OBJECT 72 Q_OBJECT
73 public: 73 public:
74 IncomingDialog(Calendar *calendar,OutgoingDialog *outgoing, 74 IncomingDialog(Calendar *calendar,OutgoingDialog *outgoing,
75 QWidget* parent=0,const char* name=0,bool modal=false,WFlags fl=0); 75 QWidget* parent=0,const char* name=0,bool modal=false,Qt::WFlags fl=0);
76 ~IncomingDialog(); 76 ~IncomingDialog();
77 77
78 void setOutgoingDialog(OutgoingDialog *outgoing); 78 void setOutgoingDialog(OutgoingDialog *outgoing);
79 79
80 signals: 80 signals:
81 void calendarUpdated(); 81 void calendarUpdated();
82 void numMessagesChanged(int); 82 void numMessagesChanged(int);
83 public slots: 83 public slots:
84 void retrieve(); 84 void retrieve();
85 85
86 protected slots: 86 protected slots:
87 void acceptAllMessages(); 87 void acceptAllMessages();
88 void acceptMessage(); 88 void acceptMessage();
89 void rejectMessage(); 89 void rejectMessage();
90 void showEvent(QListViewItem *); 90 void showEvent(Q3ListViewItem *);
91 91
92 protected: 92 protected:
93 bool acceptMessage(ScheduleItemIn *item); 93 bool acceptMessage(ScheduleItemIn *item);
94 bool incomeRefresh(ScheduleItemIn *item); 94 bool incomeRefresh(ScheduleItemIn *item);
95 bool incomeCounter(ScheduleItemIn *item); 95 bool incomeCounter(ScheduleItemIn *item);
96 bool incomeDeclineCounter(ScheduleItemIn *item); 96 bool incomeDeclineCounter(ScheduleItemIn *item);
97 bool incomeAdd(ScheduleItemIn *item); 97 bool incomeAdd(ScheduleItemIn *item);
98 bool incomeRequest(ScheduleItemIn *item); 98 bool incomeRequest(ScheduleItemIn *item);
99 bool incomeDefault(ScheduleItemIn *item); 99 bool incomeDefault(ScheduleItemIn *item);
100 bool automaticAction(ScheduleItemIn *item); 100 bool automaticAction(ScheduleItemIn *item);
101 101
102 private: 102 private:
103 bool checkAttendeesInAddressbook(IncidenceBase *inc); 103 bool checkAttendeesInAddressbook(IncidenceBase *inc);
104 bool checkOrganizerInAddressbook(QString organizer); 104 bool checkOrganizerInAddressbook(QString organizer);
105 Calendar *mCalendar; 105 Calendar *mCalendar;
106 Scheduler *mScheduler; 106 Scheduler *mScheduler;
diff --git a/korganizer/incomingdialog_base.cpp b/korganizer/incomingdialog_base.cpp
index 8589803..5c5ace4 100644
--- a/korganizer/incomingdialog_base.cpp
+++ b/korganizer/incomingdialog_base.cpp
@@ -1,61 +1,63 @@
1#include <klocale.h> 1#include <klocale.h>
2/**************************************************************************** 2/****************************************************************************
3** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/incomingdialog_base.ui' 3** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/incomingdialog_base.ui'
4** 4**
5** Created: Sat Mar 29 22:31:27 2003 5** Created: Sat Mar 29 22:31:27 2003
6** by: The User Interface Compiler () 6** by: The User Interface Compiler ()
7** 7**
8** WARNING! All changes made in this file will be lost! 8** WARNING! All changes made in this file will be lost!
9****************************************************************************/ 9****************************************************************************/
10 10
11#include "incomingdialog_base.h" 11#include "incomingdialog_base.h"
12 12
13#include <qvariant.h> 13#include <qvariant.h>
14#include <qheader.h> 14#include <q3header.h>
15#include <qlistview.h> 15#include <q3listview.h>
16#include <qpushbutton.h> 16#include <qpushbutton.h>
17#include <qlayout.h> 17#include <qlayout.h>
18#include <qtooltip.h> 18#include <qtooltip.h>
19#include <qwhatsthis.h> 19#include <q3whatsthis.h>
20//Added by qt3to4:
21#include <Q3GridLayout>
20 22
21/* 23/*
22 * Constructs a IncomingDialog_base as a child of 'parent', with the 24 * Constructs a IncomingDialog_base as a child of 'parent', with the
23 * name 'name' and widget flags set to 'f'. 25 * name 'name' and widget flags set to 'f'.
24 * 26 *
25 * The dialog will by default be modeless, unless you set 'modal' to 27 * The dialog will by default be modeless, unless you set 'modal' to
26 * TRUE to construct a modal dialog. 28 * TRUE to construct a modal dialog.
27 */ 29 */
28IncomingDialog_base::IncomingDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl ) 30IncomingDialog_base::IncomingDialog_base( QWidget* parent, const char* name, bool modal, Qt::WFlags fl )
29 : QDialog( parent, name, modal, fl ) 31 : QDialog( parent, name, modal, fl )
30 32
31{ 33{
32 if ( !name ) 34 if ( !name )
33 setName( "IncomingDialog_base" ); 35 setName( "IncomingDialog_base" );
34 IncomingDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "IncomingDialog_baseLayout"); 36 IncomingDialog_baseLayout = new Q3GridLayout( this, 1, 1, 11, 6, "IncomingDialog_baseLayout");
35 37
36 PushButton4 = new QPushButton( this, "PushButton4" ); 38 PushButton4 = new QPushButton( this, "PushButton4" );
37 39
38 IncomingDialog_baseLayout->addWidget( PushButton4, 0, 1 ); 40 IncomingDialog_baseLayout->addWidget( PushButton4, 0, 1 );
39 41
40 PushButton7 = new QPushButton( this, "PushButton7" ); 42 PushButton7 = new QPushButton( this, "PushButton7" );
41 PushButton7->setDefault( TRUE ); 43 PushButton7->setDefault( TRUE );
42 44
43 IncomingDialog_baseLayout->addWidget( PushButton7, 5, 1 ); 45 IncomingDialog_baseLayout->addWidget( PushButton7, 5, 1 );
44 46
45 mMessageListView = new QListView( this, "mMessageListView" ); 47 mMessageListView = new Q3ListView( this, "mMessageListView" );
46 mMessageListView->addColumn( tr2i18n( "Summary" ) ); 48 mMessageListView->addColumn( tr2i18n( "Summary" ) );
47 mMessageListView->addColumn( tr2i18n( "Start Date" ) ); 49 mMessageListView->addColumn( tr2i18n( "Start Date" ) );
48 mMessageListView->addColumn( tr2i18n( "Start Time" ) ); 50 mMessageListView->addColumn( tr2i18n( "Start Time" ) );
49 mMessageListView->addColumn( tr2i18n( "End Date" ) ); 51 mMessageListView->addColumn( tr2i18n( "End Date" ) );
50 mMessageListView->addColumn( tr2i18n( "End Time" ) ); 52 mMessageListView->addColumn( tr2i18n( "End Time" ) );
51 mMessageListView->addColumn( tr2i18n( "Organizer" ) ); 53 mMessageListView->addColumn( tr2i18n( "Organizer" ) );
52 mMessageListView->addColumn( tr2i18n( "Method" ) ); 54 mMessageListView->addColumn( tr2i18n( "Method" ) );
53 mMessageListView->addColumn( tr2i18n( "Status" ) ); 55 mMessageListView->addColumn( tr2i18n( "Status" ) );
54 mMessageListView->setAllColumnsShowFocus( FALSE ); 56 mMessageListView->setAllColumnsShowFocus( FALSE );
55 57
56 IncomingDialog_baseLayout->addMultiCellWidget( mMessageListView, 0, 5, 0, 0 ); 58 IncomingDialog_baseLayout->addMultiCellWidget( mMessageListView, 0, 5, 0, 0 );
57 59
58 PushButton7_2 = new QPushButton( this, "PushButton7_2" ); 60 PushButton7_2 = new QPushButton( this, "PushButton7_2" );
59 61
60 IncomingDialog_baseLayout->addWidget( PushButton7_2, 3, 1 ); 62 IncomingDialog_baseLayout->addWidget( PushButton7_2, 3, 1 );
61 63
diff --git a/korganizer/incomingdialog_base.h b/korganizer/incomingdialog_base.h
index 7732384..537ef86 100644
--- a/korganizer/incomingdialog_base.h
+++ b/korganizer/incomingdialog_base.h
@@ -1,51 +1,55 @@
1/**************************************************************************** 1/****************************************************************************
2** Form interface generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/incomingdialog_base.ui' 2** Form interface generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/incomingdialog_base.ui'
3** 3**
4** Created: Sat Mar 29 22:24:26 2003 4** Created: Sat Mar 29 22:24:26 2003
5** by: The User Interface Compiler () 5** by: The User Interface Compiler ()
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9 9
10#ifndef INCOMINGDIALOG_BASE_H 10#ifndef INCOMINGDIALOG_BASE_H
11#define INCOMINGDIALOG_BASE_H 11#define INCOMINGDIALOG_BASE_H
12 12
13#include <qvariant.h> 13#include <qvariant.h>
14#include <qdialog.h> 14#include <qdialog.h>
15 15//Added by qt3to4:
16class QVBoxLayout; 16#include <Q3VBoxLayout>
17class QHBoxLayout; 17#include <Q3GridLayout>
18class QGridLayout; 18#include <Q3HBoxLayout>
19class QListView; 19
20class QListViewItem; 20class Q3VBoxLayout;
21class Q3HBoxLayout;
22class Q3GridLayout;
23class Q3ListView;
24class Q3ListViewItem;
21class QPushButton; 25class QPushButton;
22 26
23class IncomingDialog_base : public QDialog 27class IncomingDialog_base : public QDialog
24{ 28{
25 Q_OBJECT 29 Q_OBJECT
26 30
27public: 31public:
28 IncomingDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 32 IncomingDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
29 ~IncomingDialog_base(); 33 ~IncomingDialog_base();
30 34
31 QPushButton* PushButton4; 35 QPushButton* PushButton4;
32 QPushButton* PushButton7; 36 QPushButton* PushButton7;
33 QListView* mMessageListView; 37 Q3ListView* mMessageListView;
34 QPushButton* PushButton7_2; 38 QPushButton* PushButton7_2;
35 QPushButton* PushButton8; 39 QPushButton* PushButton8;
36 QPushButton* PushButton9; 40 QPushButton* PushButton9;
37 41
38protected: 42protected:
39 QGridLayout* IncomingDialog_baseLayout; 43 Q3GridLayout* IncomingDialog_baseLayout;
40 44
41protected slots: 45protected slots:
42 virtual void languageChange(); 46 virtual void languageChange();
43 47
44 virtual void acceptAllMessages(); 48 virtual void acceptAllMessages();
45 virtual void acceptMessage(); 49 virtual void acceptMessage();
46 virtual void rejectMessage(); 50 virtual void rejectMessage();
47 virtual void retrieve(); 51 virtual void retrieve();
48 52
49}; 53};
50 54
51#endif // INCOMINGDIALOG_BASE_H 55#endif // INCOMINGDIALOG_BASE_H
diff --git a/korganizer/interfaces/korganizer/baseview.h b/korganizer/interfaces/korganizer/baseview.h
index 2ac9de1..c828573 100644
--- a/korganizer/interfaces/korganizer/baseview.h
+++ b/korganizer/interfaces/korganizer/baseview.h
@@ -11,34 +11,34 @@
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21#ifndef KORG_BASEVIEW_H 21#ifndef KORG_BASEVIEW_H
22#define KORG_BASEVIEW_H 22#define KORG_BASEVIEW_H
23// $Id$ 23// $Id$
24// KOBaseView is the abstract base class of all calendar views. 24// KOBaseView is the abstract base class of all calendar views.
25 25
26#include <qwidget.h> 26#include <qwidget.h>
27#include <qptrlist.h> 27#include <q3ptrlist.h>
28#include <qvaluelist.h> 28#include <q3valuelist.h>
29 29
30#include <klocale.h> 30#include <klocale.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kmessagebox.h> 32#include <kmessagebox.h>
33 33
34#include <libkcal/event.h> 34#include <libkcal/event.h>
35#include <libkcal/calendar.h> 35#include <libkcal/calendar.h>
36 36
37using namespace KCal; 37using namespace KCal;
38 38
39class CalPrinter; 39class CalPrinter;
40 40
41namespace KOrg { 41namespace KOrg {
42 42
43class CalPrinterBase 43class CalPrinterBase
44{ 44{
@@ -75,33 +75,33 @@ class BaseView : public QWidget
75 75
76 /** 76 /**
77 Destructor. Views will do view-specific cleanups here. 77 Destructor. Views will do view-specific cleanups here.
78 */ 78 */
79 virtual ~BaseView() {} 79 virtual ~BaseView() {}
80 80
81 /** 81 /**
82 Return calendar object of this view. 82 Return calendar object of this view.
83 */ 83 */
84 Calendar *calendar() { return mCalendar; } 84 Calendar *calendar() { return mCalendar; }
85 85
86 /** 86 /**
87 @return a list of selected events. Most views can probably only 87 @return a list of selected events. Most views can probably only
88 select a single event at a time, but some may be able to select 88 select a single event at a time, but some may be able to select
89 more than one. 89 more than one.
90 */ 90 */
91 virtual QPtrList<Incidence> selectedIncidences() = 0; 91 virtual Q3PtrList<Incidence> selectedIncidences() = 0;
92 92
93 /** 93 /**
94 @return a list of the dates of selected events. Most views can probably only 94 @return a list of the dates of selected events. Most views can probably only
95 select a single event at a time, but some may be able to select 95 select a single event at a time, but some may be able to select
96 more than one. 96 more than one.
97 */ 97 */
98 virtual DateList selectedDates() = 0; 98 virtual DateList selectedDates() = 0;
99 99
100 /** 100 /**
101 Generate a print preview of this event view. 101 Generate a print preview of this event view.
102 102
103 @param calPrinter Calendar printer object used for printing 103 @param calPrinter Calendar printer object used for printing
104 @param fd from date 104 @param fd from date
105 @param td to date 105 @param td to date
106 */ 106 */
107/* 107/*
@@ -140,33 +140,33 @@ class BaseView : public QWidget
140 /** 140 /**
141 Show incidences for the given date range. The date range actually shown may be 141 Show incidences for the given date range. The date range actually shown may be
142 different from the requested range, depending on the particular requirements 142 different from the requested range, depending on the particular requirements
143 of the view. 143 of the view.
144 144
145 @param start Start of date range. 145 @param start Start of date range.
146 @param end End of date range. 146 @param end End of date range.
147 */ 147 */
148 virtual void showDates( const QDate &start, const QDate &end ) = 0; 148 virtual void showDates( const QDate &start, const QDate &end ) = 0;
149 149
150 /** 150 /**
151 Show given events. Depending on the actual view it might not be possible to 151 Show given events. Depending on the actual view it might not be possible to
152 show all given events. 152 show all given events.
153 153
154 @param eventList a list of events to show. 154 @param eventList a list of events to show.
155 */ 155 */
156 virtual void showEvents(QPtrList<Event> eventList) = 0; 156 virtual void showEvents(Q3PtrList<Event> eventList) = 0;
157 157
158 /** 158 /**
159 Updates the current display to reflect changes that may have happened 159 Updates the current display to reflect changes that may have happened
160 in the calendar since the last display refresh. 160 in the calendar since the last display refresh.
161 */ 161 */
162 virtual void updateView() = 0; 162 virtual void updateView() = 0;
163 163
164 /** 164 /**
165 Write all unsaved data back to calendar store. 165 Write all unsaved data back to calendar store.
166 */ 166 */
167 virtual void flushView() {} 167 virtual void flushView() {}
168 168
169 /** 169 /**
170 Updates the current display to reflect the changes to one particular event. 170 Updates the current display to reflect the changes to one particular event.
171 */ 171 */
172 virtual void changeEventDisplay(Event *, int) = 0; 172 virtual void changeEventDisplay(Event *, int) = 0;
diff --git a/korganizer/interfaces/korganizer/calendarviewbase.h b/korganizer/interfaces/korganizer/calendarviewbase.h
index 3c715b1..1f49357 100644
--- a/korganizer/interfaces/korganizer/calendarviewbase.h
+++ b/korganizer/interfaces/korganizer/calendarviewbase.h
@@ -10,50 +10,52 @@
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef KORG_CALENDARVIEWBASE_H 20#ifndef KORG_CALENDARVIEWBASE_H
21#define KORG_CALENDARVIEWBASE_H 21#define KORG_CALENDARVIEWBASE_H
22// $Id$ 22// $Id$
23 23
24#include <qwidget.h> 24#include <qwidget.h>
25#include <qlayout.h> 25#include <qlayout.h>
26//Added by qt3to4:
27#include <Q3VBoxLayout>
26 28
27 29
28#include <libkcal/calendar.h> 30#include <libkcal/calendar.h>
29 31
30#include <korganizer/baseview.h> 32#include <korganizer/baseview.h>
31 33
32namespace KOrg { 34namespace KOrg {
33 35
34/** 36/**
35 @short interface for main calendar view widget 37 @short interface for main calendar view widget
36 @author Cornelius Schumacher 38 @author Cornelius Schumacher
37*/ 39*/
38class CalendarViewBase : public QWidget 40class CalendarViewBase : public QWidget
39{ 41{
40 Q_OBJECT 42 Q_OBJECT
41 public: 43 public:
42 CalendarViewBase(QWidget *parent, const char *name) : 44 CalendarViewBase(QWidget *parent, const char *name) :
43 QWidget(parent,name) {new QVBoxLayout(this);} 45 QWidget(parent,name) {new Q3VBoxLayout(this);}
44 virtual ~CalendarViewBase() {}; 46 virtual ~CalendarViewBase() {};
45 47
46 virtual KCal::Calendar *calendar() = 0; 48 virtual KCal::Calendar *calendar() = 0;
47 49
48 virtual QDate startDate() = 0; 50 virtual QDate startDate() = 0;
49 virtual QDate endDate() = 0; 51 virtual QDate endDate() = 0;
50 52
51 virtual Incidence *currentSelection() = 0; 53 virtual Incidence *currentSelection() = 0;
52 54
53 virtual void addView(KOrg::BaseView *) = 0; 55 virtual void addView(KOrg::BaseView *) = 0;
54 56
55 /** changes the view to be the currently selected view */ 57 /** changes the view to be the currently selected view */
56 virtual void showView(KOrg::BaseView *) = 0; 58 virtual void showView(KOrg::BaseView *) = 0;
57 59
58 public slots: 60 public slots:
59 virtual void updateView() = 0; 61 virtual void updateView() = 0;
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 5269af7..2814c61 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -13,77 +13,84 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24// 24//
25// Journal Entry 25// Journal Entry
26 26
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qvbox.h> 29#include <q3vbox.h>
30#include <qfile.h> 30#include <qfile.h>
31#include <qdir.h> 31#include <qdir.h>
32#include <qtextstream.h> 32#include <q3textstream.h>
33#include <qtextcodec.h> 33#include <qtextcodec.h>
34#include <qpixmap.h> 34#include <qpixmap.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qapplication.h> 36#include <qapplication.h>
37#include <QDesktopWidget>
38//Added by qt3to4:
39#include <QResizeEvent>
40#include <Q3Frame>
41#include <QKeyEvent>
42#include <QEvent>
43#include <Q3VBoxLayout>
37 44
38#include <kdebug.h> 45#include <kdebug.h>
39#include <kglobal.h> 46#include <kglobal.h>
40#include <klocale.h> 47#include <klocale.h>
41#include <ktextedit.h> 48#include <ktextedit.h>
42#include <kfiledialog.h> 49#include <kfiledialog.h>
43#include <kmessagebox.h> 50#include <kmessagebox.h>
44#include "koprefs.h" 51#include "koprefs.h"
45#include <klineedit.h> 52#include <klineedit.h>
46#include <kdialog.h> 53#include <kdialog.h>
47#include "kolocationbox.h" 54#include "kolocationbox.h"
48 55
49#include <libkcal/journal.h> 56#include <libkcal/journal.h>
50#include <libkcal/calendarresources.h> 57#include <libkcal/calendarresources.h>
51#include <libkcal/resourcecalendar.h> 58#include <libkcal/resourcecalendar.h>
52#include <kresources/resourceselectdialog.h> 59#include <kresources/resourceselectdialog.h>
53 60
54#include "journalentry.h" 61#include "journalentry.h"
55//#include "journalentry.moc" 62//#include "journalentry.moc"
56#ifndef DESKTOP_VERSION 63#ifndef DESKTOP_VERSION
57#include <qpe/qpeapplication.h> 64#include <qpe/qpeapplication.h>
58#endif 65#endif
59JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : 66JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
60 QFrame(parent) 67 Q3Frame(parent)
61{ 68{
62 69
63 int fac = 5; 70 int fac = 5;
64 heiHint = QApplication::desktop()->height(); 71 heiHint = QApplication::desktop()->height();
65 if ( heiHint > 800 ) 72 if ( heiHint > 800 )
66 fac += 2; 73 fac += 2;
67 heiHint = heiHint / fac; 74 heiHint = heiHint / fac;
68 75
69 showOnlyMode = false; 76 showOnlyMode = false;
70 mCalendar = calendar; 77 mCalendar = calendar;
71 mJournal = 0; 78 mJournal = 0;
72 visibleMode = true; 79 visibleMode = true;
73 QHBox * vb = new QHBox ( this ); 80 Q3HBox * vb = new Q3HBox ( this );
74 QPixmap iconp; 81 QPixmap iconp;
75 vb->setMargin ( KDialog::marginHint()-1 ); 82 vb->setMargin ( KDialog::marginHint()-1 );
76 QPushButton * toggleJournal = new QPushButton( vb ); 83 QPushButton * toggleJournal = new QPushButton( vb );
77 iconp = SmallIcon("1updownarrow"); 84 iconp = SmallIcon("1updownarrow");
78 toggleJournal->setPixmap (iconp ) ; 85 toggleJournal->setPixmap (iconp ) ;
79 QLabel* textLabel = new QLabel(" "+i18n("Title: "),vb); 86 QLabel* textLabel = new QLabel(" "+i18n("Title: "),vb);
80 mTitle = new KOLocationBox(TRUE, vb, 30); 87 mTitle = new KOLocationBox(TRUE, vb, 30);
81 mTitle->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); 88 mTitle->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
82 mCalendarBox = new QComboBox(vb); 89 mCalendarBox = new QComboBox(vb);
83 mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); 90 mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
84#ifndef DESKTOP_VERSION 91#ifndef DESKTOP_VERSION
85 mTitle->setSizeLimit( 8 ); 92 mTitle->setSizeLimit( 8 );
86 mCalendarBox->setSizeLimit( 8 ); 93 mCalendarBox->setSizeLimit( 8 );
87#endif 94#endif
88 vb->setStretchFactor ( mTitle, 8 ); 95 vb->setStretchFactor ( mTitle, 8 );
89 int limit = 3; 96 int limit = 3;
@@ -116,117 +123,117 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
116 mEditor = new KTextEdit(this); 123 mEditor = new KTextEdit(this);
117#ifndef DESKTOP_VERSION 124#ifndef DESKTOP_VERSION
118 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); 125 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
119#endif 126#endif
120 mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width(); 127 mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width();
121 mDeskWid = QApplication::desktop()->width(); 128 mDeskWid = QApplication::desktop()->width();
122 int maxwid = mDeskWid - mMaxWidDiff; 129 int maxwid = mDeskWid - mMaxWidDiff;
123 if ( QApplication::desktop()->width() < 640 ) { 130 if ( QApplication::desktop()->width() < 640 ) {
124 mTitle->setMaximumWidth( maxwid/2 +20 ); 131 mTitle->setMaximumWidth( maxwid/2 +20 );
125 mCalendarBox->setMaximumWidth( maxwid/2 -20); 132 mCalendarBox->setMaximumWidth( maxwid/2 -20);
126 } else { 133 } else {
127 mTitle->setMaximumWidth( (maxwid/4)*3); 134 mTitle->setMaximumWidth( (maxwid/4)*3);
128 mCalendarBox->setMaximumWidth( maxwid/2 ); 135 mCalendarBox->setMaximumWidth( maxwid/2 );
129 } 136 }
130 //mCalendarBox->setMaximumWidth( maxwid/2 -20 ); 137 //mCalendarBox->setMaximumWidth( maxwid/2 -20 );
131 mEditor->setWordWrap( KTextEdit::WidgetWidth ); 138 mEditor->setWordWrap( KTextEdit::WidgetWidth );
132 QBoxLayout *topLayout = new QVBoxLayout(this); 139 Q3BoxLayout *topLayout = new Q3VBoxLayout(this);
133 topLayout->addWidget(vb); 140 topLayout->addWidget(vb);
134 topLayout->addWidget(mEditor); 141 topLayout->addWidget(mEditor);
135 mEditor->installEventFilter(this); 142 mEditor->installEventFilter(this);
136 installEventFilter(this); 143 installEventFilter(this);
137 mTitle->installEventFilter(this); 144 mTitle->installEventFilter(this);
138 setFocusPolicy (QWidget::NoFocus); 145 setFocusPolicy (Qt::NoFocus);
139 146
140 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 147 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
141 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 148 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
142 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); 149 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) );
143 mTitle->load( KOLocationBox::SUMMARYJOURNAL ); 150 mTitle->load( KOLocationBox::SUMMARYJOURNAL );
144 mTitle->lineEdit ()->setText(""); 151 mTitle->lineEdit ()->setText("");
145} 152}
146 153
147JournalEntry::~JournalEntry() 154JournalEntry::~JournalEntry()
148{ 155{
149 //qDebug("JournalEntry::~JournalEntry() "); 156 //qDebug("JournalEntry::~JournalEntry() ");
150} 157}
151void JournalEntry::resizeEvent(QResizeEvent* e ) 158void JournalEntry::resizeEvent(QResizeEvent* e )
152{ 159{
153#ifndef DESKTOP_VERSION 160#ifndef DESKTOP_VERSION
154 161
155 if ( mDeskWid != QApplication::desktop()->width() ) { 162 if ( mDeskWid != QApplication::desktop()->width() ) {
156 mDeskWid == QApplication::desktop()->width(); 163 mDeskWid == QApplication::desktop()->width();
157 int maxwid = mDeskWid - mMaxWidDiff; 164 int maxwid = mDeskWid - mMaxWidDiff;
158 if ( QApplication::desktop()->width() < 640 ) { 165 if ( QApplication::desktop()->width() < 640 ) {
159 mTitle->setMaximumWidth( maxwid/2 +20 ); 166 mTitle->setMaximumWidth( maxwid/2 +20 );
160 mCalendarBox->setMaximumWidth( maxwid/2 -20); 167 mCalendarBox->setMaximumWidth( maxwid/2 -20);
161 } 168 }
162 else { 169 else {
163 mTitle->setMaximumWidth( (maxwid/4)*3); 170 mTitle->setMaximumWidth( (maxwid/4)*3);
164 mCalendarBox->setMaximumWidth( maxwid/2 ); 171 mCalendarBox->setMaximumWidth( maxwid/2 );
165 } 172 }
166 //mCalendarBox->setMaximumWidth( maxwid/2 -20 ); 173 //mCalendarBox->setMaximumWidth( maxwid/2 -20 );
167 } 174 }
168 //setMaximumWidth( QApplication::desktop()->width() ); 175 //setMaximumWidth( QApplication::desktop()->width() );
169 //qDebug("MAXXX %d ", QApplication::desktop()->width()); 176 //qDebug("MAXXX %d ", QApplication::desktop()->width());
170#endif 177#endif
171 QFrame::resizeEvent( e ); 178 Q3Frame::resizeEvent( e );
172} 179}
173QSize JournalEntry::sizeHint() const 180QSize JournalEntry::sizeHint() const
174{ 181{
175 return QSize ( 240, heiHint ); 182 return QSize ( 240, heiHint );
176} 183}
177void JournalEntry::slotSaveTemplate() 184void JournalEntry::slotSaveTemplate()
178{ 185{
179 QString fileName =locateLocal( "templates", "journals" ); 186 QString fileName =locateLocal( "templates", "journals" );
180 QDir t_dir; 187 QDir t_dir;
181 if ( !t_dir.exists(fileName) ) 188 if ( !t_dir.exists(fileName) )
182 t_dir.mkdir ( fileName ); 189 t_dir.mkdir ( fileName );
183 fileName += "/journal"; 190 fileName += "/journal";
184 fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); 191 fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this );
185 if ( fileName.length() == 0 ) 192 if ( fileName.length() == 0 )
186 return; 193 return;
187 194
188 QFile fileIn( fileName ); 195 QFile fileIn( fileName );
189 if (!fileIn.open( IO_WriteOnly ) ) { 196 if (!fileIn.open( QIODevice::WriteOnly ) ) {
190 KMessageBox::error( this, i18n("Error saving template file\n '%1'.") 197 KMessageBox::error( this, i18n("Error saving template file\n '%1'.")
191 .arg( fileName ) ); 198 .arg( fileName ) );
192 return; 199 return;
193 } 200 }
194 // QString text; 201 // QString text;
195 QTextStream tsIn( &fileIn ); 202 Q3TextStream tsIn( &fileIn );
196 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 203 tsIn.setCodec( QTextCodec::codecForName("utf8") );
197 tsIn << mEditor->text(); 204 tsIn << mEditor->text();
198 fileIn.close(); 205 fileIn.close();
199} 206}
200void JournalEntry::slotLoadTemplate() 207void JournalEntry::slotLoadTemplate()
201{ 208{
202 QString fileName =locateLocal( "templates", "journals" ); 209 QString fileName =locateLocal( "templates", "journals" );
203 QDir t_dir; 210 QDir t_dir;
204 if ( !t_dir.exists(fileName) ) 211 if ( !t_dir.exists(fileName) )
205 t_dir.mkdir ( fileName ); 212 t_dir.mkdir ( fileName );
206 fileName += "/journal"; 213 fileName += "/journal";
207 fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); 214 fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this );
208 if ( fileName.length() == 0 ) 215 if ( fileName.length() == 0 )
209 return; 216 return;
210 QFile fileIn( fileName ); 217 QFile fileIn( fileName );
211 if (!fileIn.open( IO_ReadOnly ) ) { 218 if (!fileIn.open( QIODevice::ReadOnly ) ) {
212 KMessageBox::error( this, i18n("Error loading template file\n '%1'.") 219 KMessageBox::error( this, i18n("Error loading template file\n '%1'.")
213 .arg( fileName ) ); 220 .arg( fileName ) );
214 return; 221 return;
215 } 222 }
216 QTextStream tsIn( &fileIn ); 223 Q3TextStream tsIn( &fileIn );
217 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 224 tsIn.setCodec( QTextCodec::codecForName("utf8") );
218 QString text = tsIn.read(); 225 QString text = tsIn.read();
219 fileIn.close(); 226 fileIn.close();
220 int line, col; 227 int line, col;
221 mEditor->getCursorPosition (& line, & col ); 228 mEditor->getCursorPosition (& line, & col );
222 mEditor-> insertAt ( text, line, col, true ); 229 mEditor-> insertAt ( text, line, col, true );
223 //mEditor->setIgnoreMark( true ); 230 //mEditor->setIgnoreMark( true );
224} 231}
225void JournalEntry::setDate(const QDate &date) 232void JournalEntry::setDate(const QDate &date)
226{ 233{
227 showOnlyMode = false; 234 showOnlyMode = false;
228 writeJournal(); 235 writeJournal();
229 mDate = date; 236 mDate = date;
230 fillCalendar( mCalendar->defaultCalendar() ); 237 fillCalendar( mCalendar->defaultCalendar() );
231} 238}
232void JournalEntry::fillCalendar( int setToID ) 239void JournalEntry::fillCalendar( int setToID )
@@ -303,52 +310,52 @@ Journal *JournalEntry::journal() const
303 return mJournal; 310 return mJournal;
304} 311}
305 312
306 313
307void JournalEntry::clear() 314void JournalEntry::clear()
308{ 315{
309 mJournal = 0; 316 mJournal = 0;
310 mEditor->setText(""); 317 mEditor->setText("");
311 mTitle->load( KOLocationBox::SUMMARYJOURNAL ); 318 mTitle->load( KOLocationBox::SUMMARYJOURNAL );
312 mTitle->lineEdit ()->setText(""); 319 mTitle->lineEdit ()->setText("");
313} 320}
314 321
315bool JournalEntry::eventFilter( QObject *o, QEvent *e ) 322bool JournalEntry::eventFilter( QObject *o, QEvent *e )
316{ 323{
317// kdDebug() << "JournalEntry::event received " << e->type() << endl; 324// kdDebug() << "JournalEntry::event received " << e->type() << endl;
318 if ( isVisible() ) { 325 if ( isVisible() ) {
319 mEditor->setFocusPolicy (QWidget::StrongFocus); 326 mEditor->setFocusPolicy (Qt::StrongFocus);
320 mTitle->setFocusPolicy (QWidget::StrongFocus); 327 mTitle->setFocusPolicy (Qt::StrongFocus);
321 } else { 328 } else {
322 mEditor->setFocusPolicy (QWidget::NoFocus); 329 mEditor->setFocusPolicy (Qt::NoFocus);
323 mTitle->setFocusPolicy (QWidget::NoFocus); 330 mTitle->setFocusPolicy (Qt::NoFocus);
324 } 331 }
325 if ( e->type() == QEvent::FocusOut ) { 332 if ( e->type() == QEvent::FocusOut ) {
326 writeJournal(); 333 writeJournal();
327 } 334 }
328 if ( e->type() == QEvent::KeyPress ) { 335 if ( e->type() == QEvent::KeyPress ) {
329 QKeyEvent * k = (QKeyEvent *) e; 336 QKeyEvent * k = (QKeyEvent *) e;
330 if ( !isVisible() ) 337 if ( !isVisible() )
331 return true; 338 return true;
332 if ( k->state() == Qt::ControlButton ) { 339 if ( k->state() == Qt::ControlButton ) {
333 k->ignore(); 340 k->ignore();
334 //return true; 341 //return true;
335 } 342 }
336 } 343 }
337 344
338 return QFrame::eventFilter( o, e ); // standard event processing 345 return Q3Frame::eventFilter( o, e ); // standard event processing
339} 346}
340 347
341void JournalEntry::writeJournal() 348void JournalEntry::writeJournal()
342{ 349{
343 if ( !visibleMode ) return; 350 if ( !visibleMode ) return;
344 if ( !mTitle->isEnabled() ) return; 351 if ( !mTitle->isEnabled() ) return;
345 if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) { 352 if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) {
346 if ( mJournal ) { 353 if ( mJournal ) {
347 Journal* j = mJournal; 354 Journal* j = mJournal;
348 mJournal = 0; 355 mJournal = 0;
349 bool conf = KOPrefs::instance()->mConfirm; 356 bool conf = KOPrefs::instance()->mConfirm;
350 KOPrefs::instance()->mConfirm = false; 357 KOPrefs::instance()->mConfirm = false;
351 emit deleteJournal(j); 358 emit deleteJournal(j);
352 KOPrefs::instance()->mConfirm = conf; 359 KOPrefs::instance()->mConfirm = conf;
353 } 360 }
354 return; 361 return;
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index ee17da8..0adebe9 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -12,45 +12,50 @@
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef JOURNALENTRY_H 23#ifndef JOURNALENTRY_H
24#define JOURNALENTRY_H 24#define JOURNALENTRY_H
25// 25//
26// Widget showing one Journal entry 26// Widget showing one Journal entry
27 27
28#include <qframe.h> 28#include <q3frame.h>
29//Added by qt3to4:
30#include <QResizeEvent>
31#include <QEvent>
32#include <QLabel>
33#include <QKeyEvent>
29 34
30#include <libkcal/calendar.h> 35#include <libkcal/calendar.h>
31 36
32class QLabel; 37class QLabel;
33class KTextEdit; 38class KTextEdit;
34class QComboBox; 39class QComboBox;
35class KLineEdit; 40class KLineEdit;
36class KOLocationBox; 41class KOLocationBox;
37 42
38using namespace KCal; 43using namespace KCal;
39 44
40class JournalEntry : public QFrame { 45class JournalEntry : public Q3Frame {
41 Q_OBJECT 46 Q_OBJECT
42 public: 47 public:
43 JournalEntry(Calendar *,QWidget *parent); 48 JournalEntry(Calendar *,QWidget *parent);
44 virtual ~JournalEntry(); 49 virtual ~JournalEntry();
45 50
46 void setJournal(Journal *, bool saveJournal = true ); 51 void setJournal(Journal *, bool saveJournal = true );
47 Journal *journal() const; 52 Journal *journal() const;
48 53
49 void setDate(const QDate &); 54 void setDate(const QDate &);
50 55
51 void clear(); 56 void clear();
52 57
53 void flushEntry(); 58 void flushEntry();
54 void setShowOnly(); 59 void setShowOnly();
55 QSize sizeHint() const; 60 QSize sizeHint() const;
56 void setVisibleMode( bool b ) { visibleMode = b;} 61 void setVisibleMode( bool b ) { visibleMode = b;}
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index 6697602..ecc7a2f 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -9,112 +9,116 @@
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qstring.h> 24#include <qstring.h>
25#include <qkeycode.h> 25#include <qnamespace.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qtimer.h> 27#include <qtimer.h>
28#include <qframe.h> 28#include <q3frame.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qapplication.h> 30#include <qapplication.h>
31//Added by qt3to4:
32#include <QWheelEvent>
33#include <Q3GridLayout>
34#include <QEvent>
31 35
32#include <kdebug.h> 36#include <kdebug.h>
33#include <klocale.h> 37#include <klocale.h>
34#include <kglobal.h> 38#include <kglobal.h>
35 39
36#include "koglobals.h" 40#include "koglobals.h"
37#include "koprefs.h" 41#include "koprefs.h"
38#ifndef KORG_NOPLUGINS 42#ifndef KORG_NOPLUGINS
39#include "kocore.h" 43#include "kocore.h"
40#endif 44#endif
41 45
42#include <kcalendarsystem.h> 46#include <kcalendarsystem.h>
43 47
44#include "navigatorbar.h" 48#include "navigatorbar.h"
45 49
46#include "kdatenavigator.h" 50#include "kdatenavigator.h"
47 51
48KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) 52KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
49 : QFrame(parent, name), 53 : Q3Frame(parent, name),
50 updateTimer(0L) 54 updateTimer(0L)
51{ 55{
52 setFrameStyle(QFrame::NoFrame); 56 setFrameStyle(Q3Frame::NoFrame);
53 QDate startDate = QDate::currentDate(); 57 QDate startDate = QDate::currentDate();
54 QGridLayout *topLayout = new QGridLayout(this,8,8); 58 Q3GridLayout *topLayout = new Q3GridLayout(this,8,8);
55 59
56 if (! startDate.isValid()) { 60 if (! startDate.isValid()) {
57 qDebug("KDateNavigator::invalid startdate "); 61 qDebug("KDateNavigator::invalid startdate ");
58 startDate = QDate::currentDate(); 62 startDate = QDate::currentDate();
59 } 63 }
60 mMonthSignalOffset = 0; 64 mMonthSignalOffset = 0;
61 mSelectedDates.append(startDate); 65 mSelectedDates.append(startDate);
62 m_MthYr = startDate; 66 m_MthYr = startDate;
63 m_bShowWeekNums = true; 67 m_bShowWeekNums = true;
64 setFont( KOPrefs::instance()->mDateNavigatorFont ); 68 setFont( KOPrefs::instance()->mDateNavigatorFont );
65 mNavigatorBar = new NavigatorBar( startDate, this ); 69 mNavigatorBar = new NavigatorBar( startDate, this );
66 topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); 70 topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 );
67 //mNavigatorBar->resize( 1,1); 71 //mNavigatorBar->resize( 1,1);
68 connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); 72 connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );
69 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); 73 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
70 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); 74 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
71 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); 75 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
72 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); 76 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
73 77
74 // get the day of the week on the first day 78 // get the day of the week on the first day
75 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); 79 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
76 m_fstDayOfWk = dayone.dayOfWeek(); 80 m_fstDayOfWk = dayone.dayOfWeek();
77 81
78 int i; 82 int i;
79 83
80 // Set up the heading fields. 84 // Set up the heading fields.
81 for( i = 0; i < 7; i++ ) { 85 for( i = 0; i < 7; i++ ) {
82 headings[i] = new QLabel("",this); 86 headings[i] = new QLabel("",this);
83 //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); 87 //headings[i]->setFont(QFont("Arial", 10, QFont::Bold));
84 headings[i]->setAlignment(AlignCenter); 88 headings[i]->setAlignment(Qt::AlignCenter);
85 headings[i]->installEventFilter(this); 89 headings[i]->installEventFilter(this);
86 90
87 topLayout->addWidget(headings[i],1,i+1); 91 topLayout->addWidget(headings[i],1,i+1);
88 } 92 }
89 93
90 // Create the weeknumber labels 94 // Create the weeknumber labels
91 for( i = 0; i < 6; i++ ) { 95 for( i = 0; i < 6; i++ ) {
92 weeknos[i] = new QLabel(this); 96 weeknos[i] = new QLabel(this);
93 weeknos[i]->setAlignment(AlignCenter ); 97 weeknos[i]->setAlignment(Qt::AlignCenter );
94 //weeknos[i]->setFont(QFont("Arial", 10)); 98 //weeknos[i]->setFont(QFont("Arial", 10));
95 if(!m_bShowWeekNums) { 99 if(!m_bShowWeekNums) {
96 weeknos[i]->hide(); 100 weeknos[i]->hide();
97 } 101 }
98 weeknos[i]->installEventFilter(this); 102 weeknos[i]->installEventFilter(this);
99 103
100 topLayout->addWidget(weeknos[i],i+2,0); 104 topLayout->addWidget(weeknos[i],i+2,0);
101 } 105 }
102 106
103 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); 107 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix");
104 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); 108 daymatrix->setFrameStyle(Q3Frame::Panel|Q3Frame::Sunken);
105 daymatrix->setLineWidth(1); 109 daymatrix->setLineWidth(1);
106 110
107 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), 111 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ),
108 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 112 SIGNAL( datesSelected( const KCal::DateList & ) ) );
109 113
110 connect( daymatrix, SIGNAL( eventDropped( Event * ) ), 114 connect( daymatrix, SIGNAL( eventDropped( Event * ) ),
111 SIGNAL( eventDropped( Event * ) ) ); 115 SIGNAL( eventDropped( Event * ) ) );
112 116
113 topLayout->addMultiCellWidget(daymatrix,2,7,1,7); 117 topLayout->addMultiCellWidget(daymatrix,2,7,1,7);
114 118
115 // read settings from configuration file. 119 // read settings from configuration file.
116 updateConfig(); 120 updateConfig();
117 enableRollover(FollowMonth); 121 enableRollover(FollowMonth);
118 mySizeHint = sizeHintTwoButtons(); 122 mySizeHint = sizeHintTwoButtons();
119 myFullSizeHint = sizeHintTwoButtons( 4 ); 123 myFullSizeHint = sizeHintTwoButtons( 4 );
120 mFontChanged = false; 124 mFontChanged = false;
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h
index 780ebb8..2cbca76 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -10,48 +10,51 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KDATENAVIGATOR_H 23#ifndef KDATENAVIGATOR_H
24#define KDATENAVIGATOR_H 24#define KDATENAVIGATOR_H
25 25
26#include <qframe.h> 26#include <q3frame.h>
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qlabel.h> 28#include <qlabel.h>
29//Added by qt3to4:
30#include <QWheelEvent>
31#include <QEvent>
29 32
30#include <libkcal/calendar.h> 33#include <libkcal/calendar.h>
31 34
32#include "kodaymatrix.h" 35#include "kodaymatrix.h"
33 36
34class QPushButton; 37class QPushButton;
35class QTimer; 38class QTimer;
36 39
37class KCalendarSystem; 40class KCalendarSystem;
38 41
39class NavigatorBar; 42class NavigatorBar;
40 43
41class KDateNavigator: public QFrame 44class KDateNavigator: public Q3Frame
42{ 45{
43 Q_OBJECT 46 Q_OBJECT
44 public: 47 public:
45 KDateNavigator( QWidget *parent = 0,const char *name = 0 ); 48 KDateNavigator( QWidget *parent = 0,const char *name = 0 );
46 ~KDateNavigator(); 49 ~KDateNavigator();
47 50
48 /** The DateNavigator automatically checks for 51 /** The DateNavigator automatically checks for
49 * the passage of midnight. If rollover type is 52 * the passage of midnight. If rollover type is
50 * set to None, no signals are emitted and no 53 * set to None, no signals are emitted and no
51 * processing is done. With rollover set to 54 * processing is done. With rollover set to
52 * FollowDay, the day highlighter changes at 55 * FollowDay, the day highlighter changes at
53 * midnight and dayPassed() is emitted. 56 * midnight and dayPassed() is emitted.
54 * With FollowMonth, it has the same effect 57 * With FollowMonth, it has the same effect
55 * as FollowDay but also adjusts the month that is 58 * as FollowDay but also adjusts the month that is
56 * visible and emits monthPassed() when the month changes. 59 * visible and emits monthPassed() when the month changes.
57 */ 60 */
@@ -120,34 +123,34 @@ class KDateNavigator: public QFrame
120 void passedMidnight(); 123 void passedMidnight();
121 void slotMonthSelected( int m ); 124 void slotMonthSelected( int m );
122 protected: 125 protected:
123 void updateDates(); 126 void updateDates();
124 127
125 void wheelEvent (QWheelEvent *); 128 void wheelEvent (QWheelEvent *);
126 129
127 bool eventFilter (QObject *,QEvent *); 130 bool eventFilter (QObject *,QEvent *);
128 131
129 private: 132 private:
130 QSize mySizeHint; 133 QSize mySizeHint;
131 QSize myFullSizeHint; 134 QSize myFullSizeHint;
132 bool mFontChanged; 135 bool mFontChanged;
133 int mMonthSignalOffset; 136 int mMonthSignalOffset;
134 NavigatorBar *mNavigatorBar; 137 NavigatorBar *mNavigatorBar;
135 138
136 QFrame *headingSep; 139 Q3Frame *headingSep;
137 QFrame *weeknumSep; 140 Q3Frame *weeknumSep;
138 QLabel *headings[7]; 141 QLabel *headings[7];
139 QLabel *weeknos[7]; 142 QLabel *weeknos[7];
140 KODayMatrix *daymatrix; 143 KODayMatrix *daymatrix;
141 144
142 KCal::DateList mSelectedDates; 145 KCal::DateList mSelectedDates;
143 QDate m_MthYr; 146 QDate m_MthYr;
144 int m_fstDayOfWk; 147 int m_fstDayOfWk;
145 bool m_bShowWeekNums; 148 bool m_bShowWeekNums;
146 149
147 int dayNum(int row, int col); 150 int dayNum(int row, int col);
148 int dayToIndex(int dayNum); 151 int dayToIndex(int dayNum);
149 152
150 Calendar *mCalendar; 153 Calendar *mCalendar;
151 KCalendarSystem *mCalendarSystem; 154 KCalendarSystem *mCalendarSystem;
152 155
153 const QString *curHeaders; 156 const QString *curHeaders;
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 1d4d6de..fe59787 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -16,67 +16,78 @@
16 GNU General Public License for more details. 16 GNU General Public License for more details.
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software 19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 21
22 As a special exception, permission is given to link this program 22 As a special exception, permission is given to link this program
23 with any edition of Qt, and distribute the resulting executable, 23 with any edition of Qt, and distribute the resulting executable,
24 without including the source code for Qt in the source distribution. 24 without including the source code for Qt in the source distribution.
25*/ 25*/
26 26
27#ifndef _WIN32_ 27#ifndef _WIN32_
28#define protected public 28#define protected public
29#include <qwidget.h> 29#include <qwidget.h>
30#undef protected 30#undef protected
31#endif 31#endif
32#include <qintdict.h> 32#include <q3intdict.h>
33#include <qdatetime.h> 33#include <qdatetime.h>
34#include <qapplication.h> 34#include <qapplication.h>
35#include <qpopupmenu.h> 35#include <q3popupmenu.h>
36#include <qcursor.h> 36#include <qcursor.h>
37#include <qpainter.h> 37#include <qpainter.h>
38#include <QDesktopWidget>
39//Added by qt3to4:
40#include <QResizeEvent>
41#include <QLabel>
42#include <QPixmap>
43#include <QMouseEvent>
44#include <QKeyEvent>
45#include <Q3MemArray>
46#include <QEvent>
47#include <Q3Frame>
48#include <Q3PtrList>
38 49
39#include <kdebug.h> 50#include <kdebug.h>
40#include <klocale.h> 51#include <klocale.h>
41#include <kiconloader.h> 52#include <kiconloader.h>
42#include <kglobal.h> 53#include <kglobal.h>
43 54
44#include "koagendaitem.h" 55#include "koagendaitem.h"
45#include "koprefs.h" 56#include "koprefs.h"
46#include "koglobals.h" 57#include "koglobals.h"
47 58
48#include "koagenda.h" 59#include "koagenda.h"
49 60
50#include <libkcal/event.h> 61#include <libkcal/event.h>
51#include <libkcal/todo.h> 62#include <libkcal/todo.h>
52 63
53#ifndef DESKTOP_VERSION 64#ifndef DESKTOP_VERSION
54#include <qpe/qpeapplication.h> 65#include <qpe/qpeapplication.h>
55#endif 66#endif
56 67
57//extern bool globalFlagBlockPainting; 68//extern bool globalFlagBlockPainting;
58extern int globalFlagBlockAgenda; 69extern int globalFlagBlockAgenda;
59extern int globalFlagBlockAgendaItemPaint; 70extern int globalFlagBlockAgendaItemPaint;
60extern int globalFlagBlockAgendaItemUpdate; 71extern int globalFlagBlockAgendaItemUpdate;
61extern int globalFlagBlockStartup; 72extern int globalFlagBlockStartup;
62 73
63 74
64//////////////////////////////////////////////////////////////////////////// 75////////////////////////////////////////////////////////////////////////////
65MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) 76MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name)
66 : QFrame(_agenda->viewport(),name), agenda(_agenda) 77 : Q3Frame(_agenda->viewport(),name), agenda(_agenda)
67{ 78{
68 setLineWidth(0); 79 setLineWidth(0);
69 setMargin(0); 80 setMargin(0);
70 setBackgroundColor(Qt::red); 81 setBackgroundColor(Qt::red);
71 minutes = new QTimer(this); 82 minutes = new QTimer(this);
72 connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); 83 connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc()));
73 minutes->start(0, true); 84 minutes->start(0, true);
74 mTimeBox = new QLabel(this); 85 mTimeBox = new QLabel(this);
75 mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); 86 mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom);
76 QPalette pal = mTimeBox->palette(); 87 QPalette pal = mTimeBox->palette();
77 pal.setColor(QColorGroup::Foreground, Qt::red); 88 pal.setColor(QColorGroup::Foreground, Qt::red);
78 mTimeBox->setPalette(pal); 89 mTimeBox->setPalette(pal);
79 //mTimeBox->setAutoMask(true); 90 //mTimeBox->setAutoMask(true);
80 91
81 agenda->addChild(mTimeBox); 92 agenda->addChild(mTimeBox);
82 93
@@ -156,55 +167,55 @@ void MarcusBains::updateLocation(bool recalculate)
156 x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, 167 x+agenda->gridSpacingX()-mTimeBox->width()+offs-1,
157 y-mTimeBox->height()); 168 y-mTimeBox->height());
158 mTimeBox->raise(); 169 mTimeBox->raise();
159 //mTimeBox->setAutoMask(true); 170 //mTimeBox->setAutoMask(true);
160 int secs = QTime::currentTime().second(); 171 int secs = QTime::currentTime().second();
161 minutes->start( (60 - secs +1)*1000 ,true); 172 minutes->start( (60 - secs +1)*1000 ,true);
162} 173}
163 174
164 175
165//////////////////////////////////////////////////////////////////////////// 176////////////////////////////////////////////////////////////////////////////
166 177
167 178
168/* 179/*
169 Create an agenda widget with rows rows and columns columns. 180 Create an agenda widget with rows rows and columns columns.
170*/ 181*/
171KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, 182KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
172 const char *name,WFlags f) : 183 const char *name,Qt::WFlags f) :
173 QScrollView(parent,name,f) 184 Q3ScrollView(parent,name,f)
174{ 185{
175 186
176 mAllAgendaPopup = 0; 187 mAllAgendaPopup = 0;
177 mColumns = columns; 188 mColumns = columns;
178 mRows = rows; 189 mRows = rows;
179 mGridSpacingY = rowSize; 190 mGridSpacingY = rowSize;
180 mAllDayMode = false; 191 mAllDayMode = false;
181#ifndef DESKTOP_VERSION 192#ifndef DESKTOP_VERSION
182 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 193 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
183#endif 194#endif
184 mHolidayMask = 0; 195 mHolidayMask = 0;
185 init(); 196 init();
186 connect ( this, SIGNAL (contentsMoving ( int , int ) ), this, SLOT ( slotContentMove(int,int)) ); 197 connect ( this, SIGNAL (contentsMoving ( int , int ) ), this, SLOT ( slotContentMove(int,int)) );
187} 198}
188 199
189/* 200/*
190 Create an agenda widget with columns columns and one row. This is used for 201 Create an agenda widget with columns columns and one row. This is used for
191 all-day events. 202 all-day events.
192*/ 203*/
193KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : 204KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,Qt::WFlags f) :
194 QScrollView(parent,name,f) 205 Q3ScrollView(parent,name,f)
195{ 206{
196 mAllAgendaPopup = 0; 207 mAllAgendaPopup = 0;
197 blockResize = false; 208 blockResize = false;
198 mColumns = columns; 209 mColumns = columns;
199 mRows = 1; 210 mRows = 1;
200 //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); 211 //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize);
201 mGridSpacingY = KOPrefs::instance()->mAllDaySize; 212 mGridSpacingY = KOPrefs::instance()->mAllDaySize;
202 mAllDayMode = true; 213 mAllDayMode = true;
203#ifndef DESKTOP_VERSION 214#ifndef DESKTOP_VERSION
204 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 215 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
205#endif 216#endif
206 mHolidayMask = 0; 217 mHolidayMask = 0;
207 init(); 218 init();
208} 219}
209 220
210 221
@@ -218,65 +229,65 @@ Incidence *KOAgenda::selectedIncidence() const
218{ 229{
219 return (mSelectedItem ? mSelectedItem->incidence() : 0); 230 return (mSelectedItem ? mSelectedItem->incidence() : 0);
220} 231}
221 232
222 233
223QDate KOAgenda::selectedIncidenceDate() const 234QDate KOAgenda::selectedIncidenceDate() const
224{ 235{
225 return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); 236 return (mSelectedItem ? mSelectedItem->itemDate() : QDate());
226} 237}
227 238
228 239
229void KOAgenda::init() 240void KOAgenda::init()
230{ 241{
231 mPopupTimer = new QTimer(this); 242 mPopupTimer = new QTimer(this);
232 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); 243 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
233 244
234 mNewItemPopup = new QPopupMenu( this ); 245 mNewItemPopup = new Q3PopupMenu( this );
235 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); 246 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) );
236 QString pathString = ""; 247 QString pathString = "";
237 if ( !KOPrefs::instance()->mToolBarMiniIcons ) { 248 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
238 if ( QApplication::desktop()->width() < 480 ) 249 if ( QApplication::desktop()->width() < 480 )
239 pathString += "icons16/"; 250 pathString += "icons16/";
240 } else 251 } else
241 pathString += "iconsmini/"; 252 pathString += "iconsmini/";
242 253
243 mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); 254 mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 );
244 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); 255 mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 );
245 mNewItemPopup->insertSeparator ( ); 256 mNewItemPopup->insertSeparator ( );
246 mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); 257 mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"day" ), i18n("Day view"),3 );
247 mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); 258 mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"xdays" ), i18n("Next days"),8 );
248 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); 259 mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"week" ), i18n("Next week"),4 );
249 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); 260 mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 );
250 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 ); 261 mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"month" ), i18n("This month"),6 );
251 mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); 262 mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"journal" ), i18n("Journal view"),7 );
252#ifndef _WIN32_ 263#ifndef _WIN32_
253 int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase 264 Qt::WindowFlags wflags = viewport()-> windowFlags() |Qt::WRepaintNoErase;//WResizeNoErase
254 viewport()->setWFlags ( wflags); 265 viewport()->setWindowFlags ( wflags);
255#endif 266#endif
256 mGridSpacingX = 80; 267 mGridSpacingX = 80;
257 mResizeBorderWidth = 8; 268 mResizeBorderWidth = 8;
258 mScrollBorderWidth = 8; 269 mScrollBorderWidth = 8;
259 mScrollDelay = 30; 270 mScrollDelay = 30;
260 mScrollOffset = 10; 271 mScrollOffset = 10;
261 mPaintPixmap.resize( 20,20); 272 mPaintPixmap.resize( 20,20);
262 //enableClipper(true); 273 //enableClipper(true);
263 274
264 // Grab key strokes for keyboard navigation of agenda. Seems to have no 275 // Grab key strokes for keyboard navigation of agenda. Seems to have no
265 // effect. Has to be fixed. 276 // effect. Has to be fixed.
266 setFocusPolicy(WheelFocus); 277 setFocusPolicy(Qt::WheelFocus);
267 278
268 connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); 279 connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp()));
269 connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); 280 connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown()));
270 connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); 281 connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize()));
271 282
272 mStartCellX = 0; 283 mStartCellX = 0;
273 mStartCellY = 0; 284 mStartCellY = 0;
274 mCurrentCellX = 0; 285 mCurrentCellX = 0;
275 mCurrentCellY = 0; 286 mCurrentCellY = 0;
276 287
277 mSelectionCellX = 0; 288 mSelectionCellX = 0;
278 mSelectionYTop = 0; 289 mSelectionYTop = 0;
279 mSelectionHeight = 0; 290 mSelectionHeight = 0;
280 291
281 mOldLowerScrollValue = -1; 292 mOldLowerScrollValue = -1;
282 mOldUpperScrollValue = -1; 293 mOldUpperScrollValue = -1;
@@ -382,37 +393,37 @@ void KOAgenda::changeColumns(int columns)
382/* 393/*
383 This is the eventFilter function, which gets all events from the KOAgendaItems 394 This is the eventFilter function, which gets all events from the KOAgendaItems
384 contained in the agenda. It has to handle moving and resizing for all items. 395 contained in the agenda. It has to handle moving and resizing for all items.
385*/ 396*/
386bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) 397bool KOAgenda::eventFilter ( QObject *object, QEvent *event )
387{ 398{
388 // kdDebug() << "KOAgenda::eventFilter" << endl; 399 // kdDebug() << "KOAgenda::eventFilter" << endl;
389 switch(event->type()) { 400 switch(event->type()) {
390 case QEvent::MouseButtonPress: 401 case QEvent::MouseButtonPress:
391 case QEvent::MouseButtonDblClick: 402 case QEvent::MouseButtonDblClick:
392 case QEvent::MouseButtonRelease: 403 case QEvent::MouseButtonRelease:
393 case QEvent::MouseMove: 404 case QEvent::MouseMove:
394 return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); 405 return eventFilter_mouse(object, static_cast<QMouseEvent *>(event));
395 406
396 case (QEvent::Leave): 407 case (QEvent::Leave):
397 if (!mActionItem) 408 if (!mActionItem)
398 setCursor(arrowCursor); 409 setCursor(Qt::arrowCursor);
399 return true; 410 return true;
400 411
401 default: 412 default:
402 return QScrollView::eventFilter(object,event); 413 return Q3ScrollView::eventFilter(object,event);
403 } 414 }
404} 415}
405void KOAgenda::popupMenu() 416void KOAgenda::popupMenu()
406{ 417{
407 mPopupTimer->stop(); 418 mPopupTimer->stop();
408 if ( mPopupKind == 1 || mPopupKind == 3 ) { 419 if ( mPopupKind == 1 || mPopupKind == 3 ) {
409 if (mActionItem ) { 420 if (mActionItem ) {
410 endItemAction(); 421 endItemAction();
411 } 422 }
412 mLeftMouseDown = false; // no more leftMouse computation 423 mLeftMouseDown = false; // no more leftMouse computation
413 if (mPopupItem) { 424 if (mPopupItem) {
414 //mClickedItem = mPopupItem; 425 //mClickedItem = mPopupItem;
415 selectItem(mPopupItem); 426 selectItem(mPopupItem);
416 if ( mAllAgendaPopup && KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 1 ) 427 if ( mAllAgendaPopup && KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 1 )
417 mAllAgendaPopup->installEventFilter( this ); 428 mAllAgendaPopup->installEventFilter( this );
418 emit showIncidencePopupSignal(mPopupItem->incidence()); 429 emit showIncidencePopupSignal(mPopupItem->incidence());
@@ -492,37 +503,37 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
492 if ( dX > blockmoveDist || dY > blockmoveDist ) { 503 if ( dX > blockmoveDist || dY > blockmoveDist ) {
493 mAllAgendaPopup->hide(); 504 mAllAgendaPopup->hide();
494 } 505 }
495 } 506 }
496 return true; 507 return true;
497 } 508 }
498 QPoint viewportPos; 509 QPoint viewportPos;
499 if (object != viewport()) { 510 if (object != viewport()) {
500 blockmoveDist = blockmoveDist*2; 511 blockmoveDist = blockmoveDist*2;
501 viewportPos = ((QWidget *)object)->mapToParent(me->pos()); 512 viewportPos = ((QWidget *)object)->mapToParent(me->pos());
502 } else { 513 } else {
503 viewportPos = me->pos(); 514 viewportPos = me->pos();
504 } 515 }
505 bool objIsNotViewport = (object != viewport()); 516 bool objIsNotViewport = (object != viewport());
506 bool leftButt = false; 517 bool leftButt = false;
507#ifdef DESKTOP_VERSION 518#ifdef DESKTOP_VERSION
508 leftButt = (me->button() == LeftButton); 519 leftButt = (me->button() == Qt::LeftButton);
509#endif 520#endif
510 switch (me->type()) { 521 switch (me->type()) {
511 case QEvent::MouseButtonPress: 522 case QEvent::MouseButtonPress:
512 if (me->button() == LeftButton) { 523 if (me->button() == Qt::LeftButton) {
513 mPopupTimer->start( 600 ); 524 mPopupTimer->start( 600 );
514 mLeftMouseDown = true; 525 mLeftMouseDown = true;
515 } 526 }
516 blockMoving = true; 527 blockMoving = true;
517 startX = viewportPos.x(); 528 startX = viewportPos.x();
518 startY = viewportPos.y(); 529 startY = viewportPos.y();
519 mPopupPos = me->globalPos(); 530 mPopupPos = me->globalPos();
520 if ( objIsNotViewport && !leftButt ) { 531 if ( objIsNotViewport && !leftButt ) {
521 KOAgendaItem * tempItem = (KOAgendaItem *)object; 532 KOAgendaItem * tempItem = (KOAgendaItem *)object;
522 if (mAllDayMode) { 533 if (mAllDayMode) {
523 if ( tempItem->height() > 10 ) { 534 if ( tempItem->height() > 10 ) {
524 int minV = tempItem->height()/4; 535 int minV = tempItem->height()/4;
525 if ( minV > (blockmoveDist/2)-2 ) { 536 if ( minV > (blockmoveDist/2)-2 ) {
526 if ( minV > blockmoveDist ) 537 if ( minV > blockmoveDist )
527 minV = blockmoveDist; 538 minV = blockmoveDist;
528 else 539 else
@@ -565,104 +576,104 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
565 } 576 }
566 if ( ! border ) { 577 if ( ! border ) {
567 diff = tempItem->x() + tempItem->width() - viewportPos.x(); 578 diff = tempItem->x() + tempItem->width() - viewportPos.x();
568 if ( diff < 0 ) 579 if ( diff < 0 )
569 diff *= -1; 580 diff *= -1;
570 if ( diff < minH ) { 581 if ( diff < minH ) {
571 border = true; 582 border = true;
572 objIsNotViewport = false; 583 objIsNotViewport = false;
573 } 584 }
574 } 585 }
575 } 586 }
576 } 587 }
577 } 588 }
578 if ( objIsNotViewport ) { 589 if ( objIsNotViewport ) {
579 mPopupItem = (KOAgendaItem *)object; 590 mPopupItem = (KOAgendaItem *)object;
580 mPopupKind = 1; 591 mPopupKind = 1;
581 if (me->button() == RightButton) { 592 if (me->button() == Qt::RightButton) {
582 mPopupKind = 3; 593 mPopupKind = 3;
583 popupMenu(); 594 popupMenu();
584 } else if (me->button() == LeftButton) { 595 } else if (me->button() == Qt::LeftButton) {
585 mActionItem = (KOAgendaItem *)object; 596 mActionItem = (KOAgendaItem *)object;
586 if (mActionItem) { 597 if (mActionItem) {
587 emit signalClearSelection(); 598 emit signalClearSelection();
588 slotClearSelection(); 599 slotClearSelection();
589 selectItem(mActionItem); 600 selectItem(mActionItem);
590 Incidence *incidence = mActionItem->incidence(); 601 Incidence *incidence = mActionItem->incidence();
591 if ( incidence->isReadOnly() /*|| incidence->doesRecur() */) { 602 if ( incidence->isReadOnly() /*|| incidence->doesRecur() */) {
592 mActionItem = 0; 603 mActionItem = 0;
593 } else { 604 } else {
594 startItemAction(viewportPos); 605 startItemAction(viewportPos);
595 } 606 }
596 } 607 }
597 } 608 }
598 } else { // ---------- viewport() 609 } else { // ---------- viewport()
599 mPopupItem = 0; 610 mPopupItem = 0;
600 mPopupKind = 2; 611 mPopupKind = 2;
601 selectItem(0); 612 selectItem(0);
602 mActionItem = 0; 613 mActionItem = 0;
603 if (me->button() == RightButton) { 614 if (me->button() == Qt::RightButton) {
604 int x,y; 615 int x,y;
605 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 616 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
606 int gx,gy; 617 int gx,gy;
607 contentsToGrid(x,y,gx,gy); 618 contentsToGrid(x,y,gx,gy);
608 mCurrentCellX = gx; 619 mCurrentCellX = gx;
609 mCurrentCellY = gy; 620 mCurrentCellY = gy;
610 mStartCellX = gx; 621 mStartCellX = gx;
611 mStartCellY = gy; 622 mStartCellY = gy;
612 mPopupKind = 4; 623 mPopupKind = 4;
613 popupMenu(); 624 popupMenu();
614 } else if (me->button() == LeftButton) { 625 } else if (me->button() == Qt::LeftButton) {
615 setCursor(arrowCursor); 626 setCursor(Qt::arrowCursor);
616 startSelectAction(viewportPos); 627 startSelectAction(viewportPos);
617 } 628 }
618 } 629 }
619 break; 630 break;
620 631
621 case QEvent::MouseButtonRelease: 632 case QEvent::MouseButtonRelease:
622 if (me->button() == LeftButton ) { 633 if (me->button() == Qt::LeftButton ) {
623 mPopupTimer->stop(); 634 mPopupTimer->stop();
624 } 635 }
625 if (object != viewport()) { 636 if (object != viewport()) {
626 if (me->button() == LeftButton && mLeftMouseDown) { 637 if (me->button() == Qt::LeftButton && mLeftMouseDown) {
627 if (mActionItem) { 638 if (mActionItem) {
628 QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); 639 QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos));
629 //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); 640 //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 );
630 if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { 641 if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) {
631 mScrollUpTimer.stop(); 642 mScrollUpTimer.stop();
632 mScrollDownTimer.stop(); 643 mScrollDownTimer.stop();
633 mActionItem->resetMove(); 644 mActionItem->resetMove();
634 placeSubCells( mActionItem ); 645 placeSubCells( mActionItem );
635 // emit startDragSignal( mActionItem->incidence() ); 646 // emit startDragSignal( mActionItem->incidence() );
636 setCursor( arrowCursor ); 647 setCursor( Qt::arrowCursor );
637 mActionItem = 0; 648 mActionItem = 0;
638 mActionType = NOP; 649 mActionType = NOP;
639 mItemMoved = 0; 650 mItemMoved = 0;
640 mLeftMouseDown = false; 651 mLeftMouseDown = false;
641 return true; 652 return true;
642 } 653 }
643 endItemAction(); 654 endItemAction();
644 } 655 }
645 } 656 }
646 657
647 } else { // ---------- viewport() 658 } else { // ---------- viewport()
648 if (me->button() == LeftButton && mLeftMouseDown ) { //left click 659 if (me->button() == Qt::LeftButton && mLeftMouseDown ) { //left click
649 endSelectAction( true ); // emit new event signal 660 endSelectAction( true ); // emit new event signal
650 } 661 }
651 } 662 }
652 if (me->button() == LeftButton) 663 if (me->button() == Qt::LeftButton)
653 mLeftMouseDown = false; 664 mLeftMouseDown = false;
654 665
655 break; 666 break;
656 667
657 case QEvent::MouseMove: 668 case QEvent::MouseMove:
658 //qDebug("mm "); 669 //qDebug("mm ");
659 if ( !mLeftMouseDown ) 670 if ( !mLeftMouseDown )
660 return false; 671 return false;
661 if ( blockMoving ) { 672 if ( blockMoving ) {
662 int dX, dY; 673 int dX, dY;
663 dX = startX - viewportPos.x(); 674 dX = startX - viewportPos.x();
664 if ( dX < 0 ) 675 if ( dX < 0 )
665 dX = -dX; 676 dX = -dX;
666 dY = viewportPos.y() - startY; 677 dY = viewportPos.y() - startY;
667 if ( dY < 0 ) 678 if ( dY < 0 )
668 dY = -dY; 679 dY = -dY;
@@ -837,109 +848,109 @@ void KOAgenda::startItemAction(QPoint viewportPos)
837 int x,y; 848 int x,y;
838 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 849 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
839 int gx,gy; 850 int gx,gy;
840 contentsToGrid(x,y,gx,gy); 851 contentsToGrid(x,y,gx,gy);
841 852
842 mStartCellX = gx; 853 mStartCellX = gx;
843 mStartCellY = gy; 854 mStartCellY = gy;
844 mCurrentCellX = gx; 855 mCurrentCellX = gx;
845 mCurrentCellY = gy; 856 mCurrentCellY = gy;
846 bool allowResize = ( mActionItem->incidence()->typeID() != todoID ); 857 bool allowResize = ( mActionItem->incidence()->typeID() != todoID );
847 858
848 if (mAllDayMode) { 859 if (mAllDayMode) {
849 int gridDistanceX = (x - gx * mGridSpacingX); 860 int gridDistanceX = (x - gx * mGridSpacingX);
850 if ( allowResize && gridDistanceX < mResizeBorderWidth && 861 if ( allowResize && gridDistanceX < mResizeBorderWidth &&
851 mActionItem->cellX() == mCurrentCellX) { 862 mActionItem->cellX() == mCurrentCellX) {
852 mActionType = RESIZELEFT; 863 mActionType = RESIZELEFT;
853 setCursor(sizeHorCursor); 864 setCursor(Qt::sizeHorCursor);
854 } else if ( allowResize && (mGridSpacingX - gridDistanceX) < mResizeBorderWidth && 865 } else if ( allowResize && (mGridSpacingX - gridDistanceX) < mResizeBorderWidth &&
855 mActionItem->cellXWidth() == mCurrentCellX) { 866 mActionItem->cellXWidth() == mCurrentCellX) {
856 mActionType = RESIZERIGHT; 867 mActionType = RESIZERIGHT;
857 setCursor(sizeHorCursor); 868 setCursor(Qt::sizeHorCursor);
858 } else { 869 } else {
859 mActionType = MOVE; 870 mActionType = MOVE;
860 mActionItem->startMove(); 871 mActionItem->startMove();
861 setCursor(sizeAllCursor); 872 setCursor(Qt::sizeAllCursor);
862 } 873 }
863 } else { 874 } else {
864 int gridDistanceY = (y - gy * mGridSpacingY); 875 int gridDistanceY = (y - gy * mGridSpacingY);
865 if (allowResize && gridDistanceY < mResizeBorderWidth && 876 if (allowResize && gridDistanceY < mResizeBorderWidth &&
866 mActionItem->cellYTop() == mCurrentCellY && 877 mActionItem->cellYTop() == mCurrentCellY &&
867 !mActionItem->firstMultiItem()) { 878 !mActionItem->firstMultiItem()) {
868 mActionType = RESIZETOP; 879 mActionType = RESIZETOP;
869 setCursor(sizeVerCursor); 880 setCursor(Qt::sizeVerCursor);
870 } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && 881 } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth &&
871 mActionItem->cellYBottom() == mCurrentCellY && 882 mActionItem->cellYBottom() == mCurrentCellY &&
872 !mActionItem->lastMultiItem()) { 883 !mActionItem->lastMultiItem()) {
873 mActionType = RESIZEBOTTOM; 884 mActionType = RESIZEBOTTOM;
874 setCursor(sizeVerCursor); 885 setCursor(Qt::sizeVerCursor);
875 } else { 886 } else {
876 mActionType = MOVE; 887 mActionType = MOVE;
877 mActionItem->startMove(); 888 mActionItem->startMove();
878 setCursor(sizeAllCursor); 889 setCursor(Qt::sizeAllCursor);
879 } 890 }
880 } 891 }
881} 892}
882 893
883void KOAgenda::performItemAction(QPoint viewportPos) 894void KOAgenda::performItemAction(QPoint viewportPos)
884{ 895{
885// kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; 896// kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl;
886// QPoint point = viewport()->mapToGlobal(viewportPos); 897// QPoint point = viewport()->mapToGlobal(viewportPos);
887// kdDebug() << "Global: " << point.x() << "," << point.y() << endl; 898// kdDebug() << "Global: " << point.x() << "," << point.y() << endl;
888// point = clipper()->mapFromGlobal(point); 899// point = clipper()->mapFromGlobal(point);
889// kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; 900// kdDebug() << "clipper: " << point.x() << "," << point.y() << endl;
890// kdDebug() << "visible height: " << visibleHeight() << endl; 901// kdDebug() << "visible height: " << visibleHeight() << endl;
891 int x,y; 902 int x,y;
892 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 903 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
893// kdDebug() << "contents: " << x << "," << y << "\n" << endl; 904// kdDebug() << "contents: " << x << "," << y << "\n" << endl;
894 int gx,gy; 905 int gx,gy;
895 contentsToGrid(x,y,gx,gy); 906 contentsToGrid(x,y,gx,gy);
896 QPoint clipperPos = clipper()-> 907 QPoint clipperPos = clipper()->
897 mapFromGlobal(viewport()->mapToGlobal(viewportPos)); 908 mapFromGlobal(viewport()->mapToGlobal(viewportPos));
898 909
899 // Cursor left active agenda area. 910 // Cursor left active agenda area.
900 // This starts a drag. 911 // This starts a drag.
901 if ( /*clipperPos.y() < 0 || clipperPos.y() > visibleHeight() ||*/ 912 if ( /*clipperPos.y() < 0 || clipperPos.y() > visibleHeight() ||*/
902 clipperPos.x() < 0 || clipperPos.x() > visibleWidth() ) { 913 clipperPos.x() < 0 || clipperPos.x() > visibleWidth() ) {
903 if ( mActionType == MOVE ) { 914 if ( mActionType == MOVE ) {
904 mScrollUpTimer.stop(); 915 mScrollUpTimer.stop();
905 mScrollDownTimer.stop(); 916 mScrollDownTimer.stop();
906 mActionItem->resetMove(); 917 mActionItem->resetMove();
907 placeSubCells( mActionItem ); 918 placeSubCells( mActionItem );
908 // emit startDragSignal( mActionItem->incidence() ); 919 // emit startDragSignal( mActionItem->incidence() );
909 setCursor( arrowCursor ); 920 setCursor( Qt::arrowCursor );
910 mActionItem = 0; 921 mActionItem = 0;
911 mActionType = NOP; 922 mActionType = NOP;
912 mItemMoved = 0; 923 mItemMoved = 0;
913 return; 924 return;
914 } 925 }
915 } else { 926 } else {
916 switch ( mActionType ) { 927 switch ( mActionType ) {
917 case MOVE: 928 case MOVE:
918 setCursor( sizeAllCursor ); 929 setCursor( Qt::sizeAllCursor );
919 break; 930 break;
920 case RESIZETOP: 931 case RESIZETOP:
921 case RESIZEBOTTOM: 932 case RESIZEBOTTOM:
922 setCursor( sizeVerCursor ); 933 setCursor( Qt::sizeVerCursor );
923 break; 934 break;
924 case RESIZELEFT: 935 case RESIZELEFT:
925 case RESIZERIGHT: 936 case RESIZERIGHT:
926 setCursor( sizeHorCursor ); 937 setCursor( Qt::sizeHorCursor );
927 break; 938 break;
928 default: 939 default:
929 setCursor( arrowCursor ); 940 setCursor( Qt::arrowCursor );
930 } 941 }
931 } 942 }
932 943
933 // Scroll if item was moved to upper or lower end of agenda. 944 // Scroll if item was moved to upper or lower end of agenda.
934 if (clipperPos.y() < mScrollBorderWidth) { 945 if (clipperPos.y() < mScrollBorderWidth) {
935 mScrollUpTimer.start(mScrollDelay); 946 mScrollUpTimer.start(mScrollDelay);
936 } else if (visibleHeight() - clipperPos.y() < 947 } else if (visibleHeight() - clipperPos.y() <
937 mScrollBorderWidth) { 948 mScrollBorderWidth) {
938 mScrollDownTimer.start(mScrollDelay); 949 mScrollDownTimer.start(mScrollDelay);
939 } else { 950 } else {
940 mScrollUpTimer.stop(); 951 mScrollUpTimer.stop();
941 mScrollDownTimer.stop(); 952 mScrollDownTimer.stop();
942 } 953 }
943 954
944 // Move or resize item if necessary 955 // Move or resize item if necessary
945 if (mCurrentCellX != gx || mCurrentCellY != gy) { 956 if (mCurrentCellX != gx || mCurrentCellY != gy) {
@@ -958,33 +969,33 @@ void KOAgenda::performItemAction(QPoint viewportPos)
958 int x,y; 969 int x,y;
959 gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y); 970 gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y);
960 int diff = moveItem->resizeMe(mGridSpacingX, mGridSpacingX* moveItem->cellWidth(), 971 int diff = moveItem->resizeMe(mGridSpacingX, mGridSpacingX* moveItem->cellWidth(),
961 mGridSpacingY * moveItem->cellHeight()); 972 mGridSpacingY * moveItem->cellHeight());
962 moveItem->raise(); 973 moveItem->raise();
963 moveChild(moveItem,x+diff,y); 974 moveChild(moveItem,x+diff,y);
964 moveItem = moveItem->nextMultiItem(); 975 moveItem = moveItem->nextMultiItem();
965 } 976 }
966 } else if (mActionType == RESIZETOP) { 977 } else if (mActionType == RESIZETOP) {
967 if (mCurrentCellY <= mActionItem->cellYBottom()) { 978 if (mCurrentCellY <= mActionItem->cellYBottom()) {
968 mActionItem->expandTop(gy - mCurrentCellY); 979 mActionItem->expandTop(gy - mCurrentCellY);
969 mActionItem->resize(mActionItem->width(), 980 mActionItem->resize(mActionItem->width(),
970 mGridSpacingY * mActionItem->cellHeight()); 981 mGridSpacingY * mActionItem->cellHeight());
971 int x,y; 982 int x,y;
972 gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y); 983 gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y);
973 //moveChild(mActionItem,childX(mActionItem),y); 984 //moveChild(mActionItem,childX(mActionItem),y);
974 QScrollView::moveChild( mActionItem,childX(mActionItem),y ); 985 Q3ScrollView::moveChild( mActionItem,childX(mActionItem),y );
975 } 986 }
976 } else if (mActionType == RESIZEBOTTOM) { 987 } else if (mActionType == RESIZEBOTTOM) {
977 if (mCurrentCellY >= mActionItem->cellYTop()) { 988 if (mCurrentCellY >= mActionItem->cellYTop()) {
978 mActionItem->expandBottom(gy - mCurrentCellY); 989 mActionItem->expandBottom(gy - mCurrentCellY);
979 mActionItem->resize(mActionItem->width(), 990 mActionItem->resize(mActionItem->width(),
980 mGridSpacingY * mActionItem->cellHeight()); 991 mGridSpacingY * mActionItem->cellHeight());
981 } 992 }
982 } else if (mActionType == RESIZELEFT) { 993 } else if (mActionType == RESIZELEFT) {
983 if (mCurrentCellX <= mActionItem->cellXWidth()) { 994 if (mCurrentCellX <= mActionItem->cellXWidth()) {
984 mActionItem->expandLeft(gx - mCurrentCellX); 995 mActionItem->expandLeft(gx - mCurrentCellX);
985 int diff = mActionItem->resizeMe(mGridSpacingX , 996 int diff = mActionItem->resizeMe(mGridSpacingX ,
986 mGridSpacingX * mActionItem->cellWidth(), 997 mGridSpacingX * mActionItem->cellWidth(),
987 mActionItem->height()); 998 mActionItem->height());
988 int x,y; 999 int x,y;
989 gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); 1000 gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y);
990 moveChild(mActionItem,x+diff,childY(mActionItem)); 1001 moveChild(mActionItem,x+diff,childY(mActionItem));
@@ -1006,33 +1017,33 @@ void KOAgenda::endItemAction()
1006 1017
1007 if ( mItemMoved ) { 1018 if ( mItemMoved ) {
1008 KOAgendaItem *placeItem = mActionItem->firstMultiItem(); 1019 KOAgendaItem *placeItem = mActionItem->firstMultiItem();
1009 if ( !placeItem ) { 1020 if ( !placeItem ) {
1010 placeItem = mActionItem; 1021 placeItem = mActionItem;
1011 } 1022 }
1012 if ( placeItem->incidence()->doesRecur() ) { 1023 if ( placeItem->incidence()->doesRecur() ) {
1013 Incidence* oldInc = placeItem->incidence(); 1024 Incidence* oldInc = placeItem->incidence();
1014 placeItem->recreateIncidence(); 1025 placeItem->recreateIncidence();
1015 emit addToCalSignal(placeItem->incidence(), oldInc ); 1026 emit addToCalSignal(placeItem->incidence(), oldInc );
1016 } 1027 }
1017 int type = mActionType; 1028 int type = mActionType;
1018 if ( mAllDayMode ) 1029 if ( mAllDayMode )
1019 type = -1; 1030 type = -1;
1020 KOAgendaItem *modifiedItem = placeItem; 1031 KOAgendaItem *modifiedItem = placeItem;
1021 //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); 1032 //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */);
1022 QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); 1033 Q3PtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems();
1023 KOAgendaItem *item; 1034 KOAgendaItem *item;
1024 1035
1025 if ( placeItem->incidence()->typeID() == todoID ) { 1036 if ( placeItem->incidence()->typeID() == todoID ) {
1026 mSelectedItem = 0; 1037 mSelectedItem = 0;
1027 //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); 1038 //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth());
1028 modifiedItem->mLastMoveXPos = mCurrentCellX; 1039 modifiedItem->mLastMoveXPos = mCurrentCellX;
1029 emit itemModified( modifiedItem, mActionType ); 1040 emit itemModified( modifiedItem, mActionType );
1030 } 1041 }
1031 else { 1042 else {
1032 1043
1033 1044
1034 globalFlagBlockAgendaItemPaint = 1; 1045 globalFlagBlockAgendaItemPaint = 1;
1035 for ( item=oldconflictItems.first(); item != 0; 1046 for ( item=oldconflictItems.first(); item != 0;
1036 item=oldconflictItems.next() ) { 1047 item=oldconflictItems.next() ) {
1037 placeSubCells(item); 1048 placeSubCells(item);
1038 } 1049 }
@@ -1097,98 +1108,98 @@ void KOAgenda::endItemAction()
1097 item=oldconflictItems.next() ) { 1108 item=oldconflictItems.next() ) {
1098 globalFlagBlockAgendaItemUpdate = 0; 1109 globalFlagBlockAgendaItemUpdate = 0;
1099 item->paintMe(false); 1110 item->paintMe(false);
1100 globalFlagBlockAgendaItemUpdate = 1; 1111 globalFlagBlockAgendaItemUpdate = 1;
1101 item->repaint(false); 1112 item->repaint(false);
1102 } 1113 }
1103 */ 1114 */
1104 1115
1105 1116
1106 } 1117 }
1107 1118
1108 } 1119 }
1109 if ( mActionItem ) 1120 if ( mActionItem )
1110 emit incidenceSelected( mActionItem->incidence() ); 1121 emit incidenceSelected( mActionItem->incidence() );
1111 mScrollUpTimer.stop(); 1122 mScrollUpTimer.stop();
1112 mScrollDownTimer.stop(); 1123 mScrollDownTimer.stop();
1113 setCursor( arrowCursor ); 1124 setCursor( Qt::arrowCursor );
1114 mActionItem = 0; 1125 mActionItem = 0;
1115 mActionType = NOP; 1126 mActionType = NOP;
1116 mItemMoved = 0; 1127 mItemMoved = 0;
1117 1128
1118} 1129}
1119 1130
1120void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) 1131void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos)
1121{ 1132{
1122// kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; 1133// kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl;
1123// QPoint point = viewport()->mapToGlobal(viewportPos); 1134// QPoint point = viewport()->mapToGlobal(viewportPos);
1124// kdDebug() << "Global: " << point.x() << "," << point.y() << endl; 1135// kdDebug() << "Global: " << point.x() << "," << point.y() << endl;
1125// point = clipper()->mapFromGlobal(point); 1136// point = clipper()->mapFromGlobal(point);
1126// kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; 1137// kdDebug() << "clipper: " << point.x() << "," << point.y() << endl;
1127 1138
1128 int x,y; 1139 int x,y;
1129 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 1140 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
1130// kdDebug() << "contents: " << x << "," << y << "\n" << endl; 1141// kdDebug() << "contents: " << x << "," << y << "\n" << endl;
1131 int gx,gy; 1142 int gx,gy;
1132 contentsToGrid(x,y,gx,gy); 1143 contentsToGrid(x,y,gx,gy);
1133 1144
1134 // Change cursor to resize cursor if appropriate 1145 // Change cursor to resize cursor if appropriate
1135 if (mAllDayMode) { 1146 if (mAllDayMode) {
1136 int gridDistanceX = (x - gx * mGridSpacingX); 1147 int gridDistanceX = (x - gx * mGridSpacingX);
1137 if (gridDistanceX < mResizeBorderWidth && 1148 if (gridDistanceX < mResizeBorderWidth &&
1138 moveItem->cellX() == gx) { 1149 moveItem->cellX() == gx) {
1139 setCursor(sizeHorCursor); 1150 setCursor(Qt::sizeHorCursor);
1140 } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && 1151 } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth &&
1141 moveItem->cellXWidth() == gx) { 1152 moveItem->cellXWidth() == gx) {
1142 setCursor(sizeHorCursor); 1153 setCursor(Qt::sizeHorCursor);
1143 } else { 1154 } else {
1144 setCursor(arrowCursor); 1155 setCursor(Qt::arrowCursor);
1145 } 1156 }
1146 } else { 1157 } else {
1147 int gridDistanceY = (y - gy * mGridSpacingY); 1158 int gridDistanceY = (y - gy * mGridSpacingY);
1148 if (gridDistanceY < mResizeBorderWidth && 1159 if (gridDistanceY < mResizeBorderWidth &&
1149 moveItem->cellYTop() == gy && 1160 moveItem->cellYTop() == gy &&
1150 !moveItem->firstMultiItem()) { 1161 !moveItem->firstMultiItem()) {
1151 setCursor(sizeVerCursor); 1162 setCursor(Qt::sizeVerCursor);
1152 } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && 1163 } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth &&
1153 moveItem->cellYBottom() == gy && 1164 moveItem->cellYBottom() == gy &&
1154 !moveItem->lastMultiItem()) { 1165 !moveItem->lastMultiItem()) {
1155 setCursor(sizeVerCursor); 1166 setCursor(Qt::sizeVerCursor);
1156 } else { 1167 } else {
1157 setCursor(arrowCursor); 1168 setCursor(Qt::arrowCursor);
1158 } 1169 }
1159 } 1170 }
1160} 1171}
1161 1172
1162 1173
1163/* 1174/*
1164 Place item in cell and take care that multiple items using the same cell do 1175 Place item in cell and take care that multiple items using the same cell do
1165 not overlap. This method is not yet optimal. It doesn´t use the maximum space 1176 not overlap. This method is not yet optimal. It doesn´t use the maximum space
1166 it can get in all cases. 1177 it can get in all cases.
1167 At the moment the method has a bug: When an item is placed only the sub cell 1178 At the moment the method has a bug: When an item is placed only the sub cell
1168 widths of the items are changed, which are within the Y region the item to 1179 widths of the items are changed, which are within the Y region the item to
1169 place spans. When the sub cell width change of one of this items affects a 1180 place spans. When the sub cell width change of one of this items affects a
1170 cell, where other items are, which do not overlap in Y with the item to place, 1181 cell, where other items are, which do not overlap in Y with the item to place,
1171 the display gets corrupted, although the corruption looks quite nice. 1182 the display gets corrupted, although the corruption looks quite nice.
1172*/ 1183*/
1173void KOAgenda::placeSubCells(KOAgendaItem *placeItem) 1184void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
1174{ 1185{
1175 1186
1176 QPtrList<KOAgendaItem> conflictItems; 1187 Q3PtrList<KOAgendaItem> conflictItems;
1177 int maxSubCells = 0; 1188 int maxSubCells = 0;
1178 QIntDict<KOAgendaItem> subCellDict(7); 1189 Q3IntDict<KOAgendaItem> subCellDict(7);
1179 1190
1180 KOAgendaItem *item; 1191 KOAgendaItem *item;
1181 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1192 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1182 if (item != placeItem) { 1193 if (item != placeItem) {
1183 if (placeItem->cellX() <= item->cellXWidth() && 1194 if (placeItem->cellX() <= item->cellXWidth() &&
1184 placeItem->cellXWidth() >= item->cellX()) { 1195 placeItem->cellXWidth() >= item->cellX()) {
1185 if ((placeItem->cellYTop() <= item->cellYBottom()) && 1196 if ((placeItem->cellYTop() <= item->cellYBottom()) &&
1186 (placeItem->cellYBottom() >= item->cellYTop())) { 1197 (placeItem->cellYBottom() >= item->cellYTop())) {
1187 conflictItems.append(item); 1198 conflictItems.append(item);
1188 if (item->subCells() > maxSubCells) 1199 if (item->subCells() > maxSubCells)
1189 maxSubCells = item->subCells(); 1200 maxSubCells = item->subCells();
1190 subCellDict.insert(item->subCell(),item); 1201 subCellDict.insert(item->subCell(),item);
1191 } 1202 }
1192 } 1203 }
1193 } 1204 }
1194 } 1205 }
@@ -1227,33 +1238,33 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
1227 int x,y; 1238 int x,y;
1228 gridToContents(item->cellX(),item->cellYTop(),x,y); 1239 gridToContents(item->cellX(),item->cellYTop(),x,y);
1229 if (mAllDayMode) { 1240 if (mAllDayMode) {
1230 y += item->subCell() * newSubCellWidth; 1241 y += item->subCell() * newSubCellWidth;
1231 } else { 1242 } else {
1232 x += item->subCell() * newSubCellWidth; 1243 x += item->subCell() * newSubCellWidth;
1233 } 1244 }
1234 moveChild(item,x+diff,y); 1245 moveChild(item,x+diff,y);
1235 // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); 1246 // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y);
1236 //item->updateItem(); 1247 //item->updateItem();
1237 } 1248 }
1238 // Adjust sub cell geometry of all conflict items of all conflict items 1249 // Adjust sub cell geometry of all conflict items of all conflict items
1239 for ( item=conflictItems.first(); item != 0; 1250 for ( item=conflictItems.first(); item != 0;
1240 item=conflictItems.next() ) { 1251 item=conflictItems.next() ) {
1241 if ( placeItem != item ) { 1252 if ( placeItem != item ) {
1242 KOAgendaItem *item2; 1253 KOAgendaItem *item2;
1243 QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); 1254 Q3PtrList<KOAgendaItem> conflictItems2 = item->conflictItems();
1244 for ( item2=conflictItems2.first(); item2 != 0; 1255 for ( item2=conflictItems2.first(); item2 != 0;
1245 item2=conflictItems2.next() ) { 1256 item2=conflictItems2.next() ) {
1246 if ( item2->subCells() != maxSubCells) { 1257 if ( item2->subCells() != maxSubCells) {
1247 item2->setSubCells(maxSubCells); 1258 item2->setSubCells(maxSubCells);
1248 int diff = 0; 1259 int diff = 0;
1249 if (mAllDayMode) { 1260 if (mAllDayMode) {
1250 diff = item2->resizeMe(mGridSpacingX, item2->cellWidth() * mGridSpacingX, newSubCellWidth); 1261 diff = item2->resizeMe(mGridSpacingX, item2->cellWidth() * mGridSpacingX, newSubCellWidth);
1251 } else { 1262 } else {
1252 item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); 1263 item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY);
1253 } 1264 }
1254 int x,y; 1265 int x,y;
1255 gridToContents(item2->cellX(),item2->cellYTop(),x,y); 1266 gridToContents(item2->cellX(),item2->cellYTop(),x,y);
1256 if (mAllDayMode) { 1267 if (mAllDayMode) {
1257 y += item2->subCell() * newSubCellWidth; 1268 y += item2->subCell() * newSubCellWidth;
1258 } else { 1269 } else {
1259 x += item2->subCell() * newSubCellWidth; 1270 x += item2->subCell() * newSubCellWidth;
@@ -1312,87 +1323,87 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
1312 int selectionX = KOGlobals::self()->reverseLayout() ? 1323 int selectionX = KOGlobals::self()->reverseLayout() ?
1313 (mColumns - 1 - mSelectionCellX) * mGridSpacingX : 1324 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1314 mSelectionCellX * mGridSpacingX; 1325 mSelectionCellX * mGridSpacingX;
1315 contentsToViewport ( cx, cy, vx,vy); 1326 contentsToViewport ( cx, cy, vx,vy);
1316 //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; 1327 //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ;
1317 1328
1318 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { 1329 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) {
1319 if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1330 if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1320 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { 1331 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) {
1321 1332
1322 int vxSel, vySel; 1333 int vxSel, vySel;
1323 contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); 1334 contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel);
1324 int off = mSelectionHeight; 1335 int off = mSelectionHeight;
1325 if ( vySel < 0 ) 1336 if ( vySel < 0 )
1326 off += vySel; 1337 off += vySel;
1327 //qDebug("OFF %d %d %d", off,vySel, vy ); 1338 //qDebug("OFF %d %d %d", off,vySel, vy );
1328 bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); 1339 bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,QPainter::CompositionMode_Source);
1329 } else { 1340 } else {
1330 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); 1341 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,QPainter::CompositionMode_Source);
1331 } 1342 }
1332 } 1343 }
1333 if ( mSelectionHeight > 0 ) { 1344 if ( mSelectionHeight > 0 ) {
1334 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); 1345 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight );
1335 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1346 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1336 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { 1347 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1337 contentsToViewport ( selectionX, mSelectionYTop, vx,vy); 1348 contentsToViewport ( selectionX, mSelectionYTop, vx,vy);
1338 // bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); 1349 // bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP);
1339 int hei = mSelectionHeight; 1350 int hei = mSelectionHeight;
1340 int offset = 0; 1351 int offset = 0;
1341 while ( hei > 0 ) { 1352 while ( hei > 0 ) {
1342 int p_hei = 5; 1353 int p_hei = 5;
1343 if ( hei < 5 ) p_hei = hei; 1354 if ( hei < 5 ) p_hei = hei;
1344 hei -= 5; 1355 hei -= 5;
1345 bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); 1356 bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,QPainter::CompositionMode_Source);
1346 offset += 5; 1357 offset += 5;
1347 } 1358 }
1348 } 1359 }
1349 } 1360 }
1350 p->begin( pd ); 1361 p->begin( pd );
1351 } else { 1362 } else {
1352#if 0 1363#if 0
1353 qDebug("mCurPixWid %d %d ",mCurPixWid, contentsWidth() ); 1364 qDebug("mCurPixWid %d %d ",mCurPixWid, contentsWidth() );
1354 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { 1365 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) {
1355 qDebug("WAUWAU "); 1366 qDebug("WAUWAU ");
1356 drawContentsToPainter(); 1367 drawContentsToPainter();
1357 } 1368 }
1358#endif 1369#endif
1359 QPaintDevice* pd = p->device(); 1370 QPaintDevice* pd = p->device();
1360 p->end(); 1371 p->end();
1361 int vx, vy; 1372 int vx, vy;
1362 int selectionX = KOGlobals::self()->reverseLayout() ? 1373 int selectionX = KOGlobals::self()->reverseLayout() ?
1363 (mColumns - 1 - mSelectionCellX) * mGridSpacingX : 1374 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1364 mSelectionCellX * mGridSpacingX; 1375 mSelectionCellX * mGridSpacingX;
1365 contentsToViewport ( cx, cy, vx,vy); 1376 contentsToViewport ( cx, cy, vx,vy);
1366 // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; 1377 // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ;
1367 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) 1378 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) )
1368 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); 1379 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,QPainter::CompositionMode_Source);
1369 1380
1370 if ( mSelectionHeight > 0 ) { 1381 if ( mSelectionHeight > 0 ) {
1371 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); 1382 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight );
1372 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1383 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1373 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { 1384 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1374 contentsToViewport ( selectionX, mSelectionYTop, vx,vy); 1385 contentsToViewport ( selectionX, mSelectionYTop, vx,vy);
1375 //bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); 1386 //bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP);
1376 int hei = mSelectionHeight; 1387 int hei = mSelectionHeight;
1377 int offset = 0; 1388 int offset = 0;
1378 while ( hei > 0 ) { 1389 while ( hei > 0 ) {
1379 int p_hei = 5; 1390 int p_hei = 5;
1380 if ( hei < 5 ) p_hei = hei; 1391 if ( hei < 5 ) p_hei = hei;
1381 hei -= 5; 1392 hei -= 5;
1382 bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); 1393 bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,QPainter::CompositionMode_Source);
1383 offset += 5; 1394 offset += 5;
1384 } 1395 }
1385 } 1396 }
1386 } 1397 }
1387 p->begin( pd ); 1398 p->begin( pd );
1388 } 1399 }
1389 1400
1390} 1401}
1391 1402
1392void KOAgenda::finishUpdate() 1403void KOAgenda::finishUpdate()
1393{ 1404{
1394 1405
1395 KOAgendaItem *item; 1406 KOAgendaItem *item;
1396 globalFlagBlockAgendaItemPaint = 1; 1407 globalFlagBlockAgendaItemPaint = 1;
1397 // Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems 1408 // Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems
1398 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1409 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
@@ -1563,40 +1574,40 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i
1563 mSelectionHeight, KOPrefs::instance()->mHighlightColor ); 1574 mSelectionHeight, KOPrefs::instance()->mHighlightColor );
1564 } 1575 }
1565 */ 1576 */
1566 // Draw vertical lines of grid 1577 // Draw vertical lines of grid
1567 1578
1568 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; 1579 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX;
1569 if ( mGridSpacingX > 0 ) { 1580 if ( mGridSpacingX > 0 ) {
1570 while (x < cx + cw) { 1581 while (x < cx + cw) {
1571 p->drawLine(x,cy,x,cy+ch); 1582 p->drawLine(x,cy,x,cy+ch);
1572 x+=mGridSpacingX; 1583 x+=mGridSpacingX;
1573 } 1584 }
1574 } 1585 }
1575 // Draw horizontal lines of grid 1586 // Draw horizontal lines of grid
1576 int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; 1587 int y = ((int)(cy/lGridSpacingY))*lGridSpacingY;
1577 if ( lGridSpacingY > 0 ) { 1588 if ( lGridSpacingY > 0 ) {
1578 while (y < cy + ch) { 1589 while (y < cy + ch) {
1579 p->setPen( SolidLine ); 1590 p->setPen( Qt::SolidLine );
1580 p->drawLine(cx,y,cx+cw,y); 1591 p->drawLine(cx,y,cx+cw,y);
1581 y+=lGridSpacingY; 1592 y+=lGridSpacingY;
1582 p->setPen( DotLine ); 1593 p->setPen( Qt::DotLine );
1583 p->drawLine(cx,y,cx+cw,y); 1594 p->drawLine(cx,y,cx+cw,y);
1584 y+=lGridSpacingY; 1595 y+=lGridSpacingY;
1585 } 1596 }
1586 p->setPen( SolidLine ); 1597 p->setPen( Qt::SolidLine );
1587 } 1598 }
1588 mPixPainter.end() ; 1599 mPixPainter.end() ;
1589} 1600}
1590 1601
1591/* 1602/*
1592 Convert srcollview contents coordinates to agenda grid coordinates. 1603 Convert srcollview contents coordinates to agenda grid coordinates.
1593*/ 1604*/
1594void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy) 1605void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy)
1595{ 1606{
1596 gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX : 1607 gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX :
1597 x/mGridSpacingX; 1608 x/mGridSpacingX;
1598 gy = y/mGridSpacingY; 1609 gy = y/mGridSpacingY;
1599} 1610}
1600 1611
1601/* 1612/*
1602 Convert agenda grid coordinates to scrollview contents coordinates. 1613 Convert agenda grid coordinates to scrollview contents coordinates.
@@ -1704,95 +1715,95 @@ KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo )
1704 1715
1705 1716
1706void KOAgenda::updateTodo( Todo * todo, int days, bool remove) 1717void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
1707{ 1718{
1708 // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )|| 1719 // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )||
1709 KOAgendaItem *item; 1720 KOAgendaItem *item;
1710 item = getItemForTodo ( todo ); 1721 item = getItemForTodo ( todo );
1711 //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove); 1722 //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove);
1712 if ( item ) { 1723 if ( item ) {
1713 blockSignals( true ); 1724 blockSignals( true );
1714 //qDebug("item found "); 1725 //qDebug("item found ");
1715 item->hide(); 1726 item->hide();
1716 item->setCellX(-2, -1 ); 1727 item->setCellX(-2, -1 );
1717 item->select(false); 1728 item->select(false);
1718 mUnusedItems.append( item ); 1729 mUnusedItems.append( item );
1719 mItems.remove( item ); 1730 mItems.remove( item );
1720 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); 1731 Q3PtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
1721 KOAgendaItem *itemit; 1732 KOAgendaItem *itemit;
1722 //globalFlagBlockAgendaItemPaint = 1; 1733 //globalFlagBlockAgendaItemPaint = 1;
1723 for ( itemit=oldconflictItems.first(); itemit != 0; 1734 for ( itemit=oldconflictItems.first(); itemit != 0;
1724 itemit=oldconflictItems.next() ) { 1735 itemit=oldconflictItems.next() ) {
1725 if ( itemit != item ) 1736 if ( itemit != item )
1726 placeSubCells(itemit); 1737 placeSubCells(itemit);
1727 } 1738 }
1728 qApp->processEvents(); 1739 qApp->processEvents();
1729 //globalFlagBlockAgendaItemPaint = 0; 1740 //globalFlagBlockAgendaItemPaint = 0;
1730 for ( itemit=oldconflictItems.first(); itemit != 0; 1741 for ( itemit=oldconflictItems.first(); itemit != 0;
1731 itemit=oldconflictItems.next() ) { 1742 itemit=oldconflictItems.next() ) {
1732 globalFlagBlockAgendaItemUpdate = 0; 1743 globalFlagBlockAgendaItemUpdate = 0;
1733 if ( itemit != item ) 1744 if ( itemit != item )
1734 itemit->repaintMe(); 1745 itemit->repaintMe();
1735 globalFlagBlockAgendaItemUpdate = 1; 1746 globalFlagBlockAgendaItemUpdate = 1;
1736 //qDebug("sigleshot "); 1747 //qDebug("sigleshot ");
1737 QTimer::singleShot( 0, itemit, SLOT ( repaintItem() )); 1748 QTimer::singleShot( 0, itemit, SLOT ( repaintItem() ));
1738 //itemit->repaint( false ); repaintItem() 1749 //itemit->repaint( false ); repaintItem()
1739 } 1750 }
1740 blockSignals( false ); 1751 blockSignals( false );
1741 } 1752 }
1742 if ( remove ) { 1753 if ( remove ) {
1743 //qDebug("remove****************************************** "); 1754 //qDebug("remove****************************************** ");
1744 return; 1755 return;
1745 } 1756 }
1746 if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) 1757 if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda )
1747 return; 1758 return;
1748 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); 1759 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ ");
1749 QDate currentDate = QDate::currentDate(); 1760 QDate currentDate = QDate::currentDate();
1750 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda ); 1761 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < (QDateTime)currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda );
1751 QDateTime dt; 1762 QDateTime dt;
1752 if ( todo->hasCompletedDate() ) 1763 if ( todo->hasCompletedDate() )
1753 dt = todo->completed(); 1764 dt = todo->completed();
1754 else 1765 else
1755 dt = todo->dtDue(); 1766 dt = todo->dtDue();
1756 if ( overdue ) { 1767 if ( overdue ) {
1757 days += todo->dtDue().date().daysTo( currentDate ); 1768 days += todo->dtDue().date().daysTo( currentDate );
1758 } 1769 }
1759 else 1770 else
1760 currentDate = dt.date(); 1771 currentDate = dt.date();
1761 1772
1762 if (( todo->doesFloat() || overdue) && !todo->hasCompletedDate() ) { 1773 if (( todo->doesFloat() || overdue) && !todo->hasCompletedDate() ) {
1763 if ( ! mAllDayMode ) return; 1774 if ( ! mAllDayMode ) return;
1764 // aldayagenda 1775 // aldayagenda
1765 globalFlagBlockAgendaItemPaint = 1; 1776 globalFlagBlockAgendaItemPaint = 1;
1766 item = insertAllDayItem(todo, currentDate,days, days); 1777 item = insertAllDayItem(todo, currentDate,days, days);
1767 item->show(); 1778 item->show();
1768 1779
1769 } 1780 }
1770 else { 1781 else {
1771 if ( mAllDayMode ) return; 1782 if ( mAllDayMode ) return;
1772 // mAgenda 1783 // mAgenda
1773 globalFlagBlockAgendaItemPaint = 1; 1784 globalFlagBlockAgendaItemPaint = 1;
1774 int endY = timeToY(dt.time()) - 1; 1785 int endY = timeToY(dt.time()) - 1;
1775 int hi = 12/KOPrefs::instance()->mHourSize; 1786 int hi = 12/KOPrefs::instance()->mHourSize;
1776 int startY = endY - 1-hi; 1787 int startY = endY - 1-hi;
1777 item = insertItem(todo,currentDate,days,startY,endY); 1788 item = insertItem(todo,currentDate,days,startY,endY);
1778 item->show(); 1789 item->show();
1779 } 1790 }
1780 qApp->processEvents(); 1791 qApp->processEvents();
1781 globalFlagBlockAgendaItemPaint = 0; 1792 globalFlagBlockAgendaItemPaint = 0;
1782 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); 1793 Q3PtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
1783 KOAgendaItem *itemit; 1794 KOAgendaItem *itemit;
1784 for ( itemit=oldconflictItems.first(); itemit != 0; 1795 for ( itemit=oldconflictItems.first(); itemit != 0;
1785 itemit=oldconflictItems.next() ) { 1796 itemit=oldconflictItems.next() ) {
1786 globalFlagBlockAgendaItemUpdate = 0; 1797 globalFlagBlockAgendaItemUpdate = 0;
1787 itemit->repaintMe(); 1798 itemit->repaintMe();
1788 globalFlagBlockAgendaItemUpdate = 1; 1799 globalFlagBlockAgendaItemUpdate = 1;
1789 itemit->repaint(); 1800 itemit->repaint();
1790 } 1801 }
1791 globalFlagBlockAgendaItemUpdate = 0; 1802 globalFlagBlockAgendaItemUpdate = 0;
1792 item->repaintMe(); 1803 item->repaintMe();
1793 globalFlagBlockAgendaItemUpdate = 1; 1804 globalFlagBlockAgendaItemUpdate = 1;
1794 item->repaint(); 1805 item->repaint();
1795} 1806}
1796/* 1807/*
1797 Insert KOAgendaItem into agenda. 1808 Insert KOAgendaItem into agenda.
1798*/ 1809*/
@@ -1854,33 +1865,33 @@ KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,i
1854} 1865}
1855 1866
1856 1867
1857void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, 1868void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
1858 int YTop,int YBottom) 1869 int YTop,int YBottom)
1859{ 1870{
1860 if (mAllDayMode) { 1871 if (mAllDayMode) {
1861 ; 1872 ;
1862 return; 1873 return;
1863 } 1874 }
1864 1875
1865 int cellX,cellYTop,cellYBottom; 1876 int cellX,cellYTop,cellYBottom;
1866 QString newtext; 1877 QString newtext;
1867 int width = XEnd - XBegin + 1; 1878 int width = XEnd - XBegin + 1;
1868 int count = 0; 1879 int count = 0;
1869 KOAgendaItem *current = 0; 1880 KOAgendaItem *current = 0;
1870 QPtrList<KOAgendaItem> multiItems; 1881 Q3PtrList<KOAgendaItem> multiItems;
1871 for (cellX = XBegin;cellX <= XEnd;++cellX) { 1882 for (cellX = XBegin;cellX <= XEnd;++cellX) {
1872 if (cellX == XBegin) cellYTop = YTop; 1883 if (cellX == XBegin) cellYTop = YTop;
1873 else cellYTop = 0; 1884 else cellYTop = 0;
1874 if (cellX == XEnd) cellYBottom = YBottom; 1885 if (cellX == XEnd) cellYBottom = YBottom;
1875 else cellYBottom = rows() - 1; 1886 else cellYBottom = rows() - 1;
1876 newtext = QString("(%1/%2): ").arg(++count).arg(width); 1887 newtext = QString("(%1/%2): ").arg(++count).arg(width);
1877 newtext.append(event->summary()); 1888 newtext.append(event->summary());
1878 current = insertItem(event,qd,cellX,cellYTop,cellYBottom); 1889 current = insertItem(event,qd,cellX,cellYTop,cellYBottom);
1879 current->setText(newtext); 1890 current->setText(newtext);
1880 multiItems.append(current); 1891 multiItems.append(current);
1881 } 1892 }
1882 1893
1883 KOAgendaItem *next = 0; 1894 KOAgendaItem *next = 0;
1884 KOAgendaItem *last = multiItems.last(); 1895 KOAgendaItem *last = multiItems.last();
1885 KOAgendaItem *first = multiItems.first(); 1896 KOAgendaItem *first = multiItems.first();
1886 KOAgendaItem *setFirst,*setLast; 1897 KOAgendaItem *setFirst,*setLast;
@@ -1914,33 +1925,33 @@ void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
1914void KOAgenda::finishResize ( ) 1925void KOAgenda::finishResize ( )
1915{ 1926{
1916 //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) "); 1927 //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) ");
1917 if ( globalFlagBlockAgenda == 0 ) { 1928 if ( globalFlagBlockAgenda == 0 ) {
1918 finishUpdate(); 1929 finishUpdate();
1919 //qDebug("finishUpdate() called "); 1930 //qDebug("finishUpdate() called ");
1920 } 1931 }
1921} 1932}
1922/* 1933/*
1923 Overridden from QScrollView to provide proper resizing of KOAgendaItems. 1934 Overridden from QScrollView to provide proper resizing of KOAgendaItems.
1924*/ 1935*/
1925void KOAgenda::resizeEvent ( QResizeEvent *ev ) 1936void KOAgenda::resizeEvent ( QResizeEvent *ev )
1926{ 1937{
1927 mSelectionHeight = 0; 1938 mSelectionHeight = 0;
1928 mResizeTimer.start( 150 , true ); 1939 mResizeTimer.start( 150 , true );
1929 computeSizes(); 1940 computeSizes();
1930 QScrollView::resizeEvent( ev ); 1941 Q3ScrollView::resizeEvent( ev );
1931 return; 1942 return;
1932 1943
1933} 1944}
1934void KOAgenda::computeSizes() 1945void KOAgenda::computeSizes()
1935{ 1946{
1936 if ( globalFlagBlockStartup ) 1947 if ( globalFlagBlockStartup )
1937 return; 1948 return;
1938 int frameOffset = frameWidth() * 2 +1; 1949 int frameOffset = frameWidth() * 2 +1;
1939 if (mAllDayMode) { 1950 if (mAllDayMode) {
1940 mGridSpacingX = (width()-frameOffset) / mColumns; 1951 mGridSpacingX = (width()-frameOffset) / mColumns;
1941 mGridSpacingY = height() - 2 * frameWidth() - 1; 1952 mGridSpacingY = height() - 2 * frameWidth() - 1;
1942 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1); 1953 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1);
1943 // mGridSpacingY = height(); 1954 // mGridSpacingY = height();
1944 // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1955 // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1945 1956
1946 KOAgendaItem *item; 1957 KOAgendaItem *item;
@@ -2003,33 +2014,33 @@ void KOAgenda::scrollUp()
2003} 2014}
2004 2015
2005 2016
2006void KOAgenda::scrollDown() 2017void KOAgenda::scrollDown()
2007{ 2018{
2008 scrollBy(0,mScrollOffset); 2019 scrollBy(0,mScrollOffset);
2009} 2020}
2010 2021
2011void KOAgenda::popupAlarm() 2022void KOAgenda::popupAlarm()
2012{ 2023{
2013 if (!mClickedItem) { 2024 if (!mClickedItem) {
2014 qDebug("KOAgenda::popupAlarm() called without having a clicked item "); 2025 qDebug("KOAgenda::popupAlarm() called without having a clicked item ");
2015 return; 2026 return;
2016 } 2027 }
2017 // TODO: deal correctly with multiple alarms 2028 // TODO: deal correctly with multiple alarms
2018 Alarm* alarm; 2029 Alarm* alarm;
2019 QPtrList<Alarm> list(mClickedItem->incidence()->alarms()); 2030 Q3PtrList<Alarm> list(mClickedItem->incidence()->alarms());
2020 for(alarm=list.first();alarm;alarm=list.next()) { 2031 for(alarm=list.first();alarm;alarm=list.next()) {
2021 alarm->toggleAlarm(); 2032 alarm->toggleAlarm();
2022 } 2033 }
2023 emit itemModified( mClickedItem , KOGlobals::EVENTEDITED ); 2034 emit itemModified( mClickedItem , KOGlobals::EVENTEDITED );
2024 mClickedItem->paintMe( true ); 2035 mClickedItem->paintMe( true );
2025 mClickedItem->repaint( false ); 2036 mClickedItem->repaint( false );
2026} 2037}
2027 2038
2028/* 2039/*
2029 Calculates the minimum width 2040 Calculates the minimum width
2030*/ 2041*/
2031int KOAgenda::minimumWidth() const 2042int KOAgenda::minimumWidth() const
2032{ 2043{
2033 // TODO:: develop a way to dynamically determine the minimum width 2044 // TODO:: develop a way to dynamically determine the minimum width
2034 int min = 100; 2045 int min = 100;
2035 2046
@@ -2094,88 +2105,88 @@ void KOAgenda::selectItem(KOAgendaItem *item)
2094{ 2105{
2095 if ((KOAgendaItem *)mSelectedItem == item) return; 2106 if ((KOAgendaItem *)mSelectedItem == item) return;
2096 deselectItem(); 2107 deselectItem();
2097 if (item == 0) { 2108 if (item == 0) {
2098 emit incidenceSelected( 0 ); 2109 emit incidenceSelected( 0 );
2099 return; 2110 return;
2100 } 2111 }
2101 mSelectedItem = item; 2112 mSelectedItem = item;
2102 mSelectedItem->select(); 2113 mSelectedItem->select();
2103 emit incidenceSelected( mSelectedItem->incidence() ); 2114 emit incidenceSelected( mSelectedItem->incidence() );
2104} 2115}
2105 2116
2106// This function seems never be called. 2117// This function seems never be called.
2107void KOAgenda::keyPressEvent( QKeyEvent *kev ) 2118void KOAgenda::keyPressEvent( QKeyEvent *kev )
2108{ 2119{
2109 switch(kev->key()) { 2120 switch(kev->key()) {
2110 case Key_PageDown: 2121 case Qt::Key_PageDown:
2111 verticalScrollBar()->addPage(); 2122 verticalScrollBar()->addPage();
2112 break; 2123 break;
2113 case Key_PageUp: 2124 case Qt::Key_PageUp:
2114 verticalScrollBar()->subtractPage(); 2125 verticalScrollBar()->subtractPage();
2115 break; 2126 break;
2116 case Key_Down: 2127 case Qt::Key_Down:
2117 verticalScrollBar()->addLine(); 2128 verticalScrollBar()->addLine();
2118 break; 2129 break;
2119 case Key_Up: 2130 case Qt::Key_Up:
2120 verticalScrollBar()->subtractLine(); 2131 verticalScrollBar()->subtractLine();
2121 break; 2132 break;
2122 default: 2133 default:
2123 ; 2134 ;
2124 } 2135 }
2125} 2136}
2126 2137
2127void KOAgenda::calculateWorkingHours() 2138void KOAgenda::calculateWorkingHours()
2128{ 2139{
2129// mWorkingHoursEnable = KOPrefs::instance()->mEnableWorkingHours; 2140// mWorkingHoursEnable = KOPrefs::instance()->mEnableWorkingHours;
2130 mWorkingHoursEnable = !mAllDayMode; 2141 mWorkingHoursEnable = !mAllDayMode;
2131 2142
2132 mWorkingHoursYTop = mGridSpacingY * 2143 mWorkingHoursYTop = mGridSpacingY *
2133 KOPrefs::instance()->mWorkingHoursStart * 4; 2144 KOPrefs::instance()->mWorkingHoursStart * 4;
2134 mWorkingHoursYBottom = mGridSpacingY * 2145 mWorkingHoursYBottom = mGridSpacingY *
2135 KOPrefs::instance()->mWorkingHoursEnd * 4 - 1; 2146 KOPrefs::instance()->mWorkingHoursEnd * 4 - 1;
2136} 2147}
2137 2148
2138 2149
2139DateList KOAgenda::dateList() const 2150DateList KOAgenda::dateList() const
2140{ 2151{
2141 return mSelectedDates; 2152 return mSelectedDates;
2142} 2153}
2143 2154
2144void KOAgenda::setDateList(const DateList &selectedDates) 2155void KOAgenda::setDateList(const DateList &selectedDates)
2145{ 2156{
2146 mSelectedDates = selectedDates; 2157 mSelectedDates = selectedDates;
2147} 2158}
2148 2159
2149void KOAgenda::setHolidayMask(QMemArray<bool> *mask) 2160void KOAgenda::setHolidayMask(Q3MemArray<bool> *mask)
2150{ 2161{
2151 mHolidayMask = mask; 2162 mHolidayMask = mask;
2152 2163
2153/* 2164/*
2154 kdDebug() << "HolidayMask: "; 2165 kdDebug() << "HolidayMask: ";
2155 for(uint i=0;i<mask->count();++i) { 2166 for(uint i=0;i<mask->count();++i) {
2156 kdDebug() << (mask->at(i) ? "*" : "o"); 2167 kdDebug() << (mask->at(i) ? "*" : "o");
2157 } 2168 }
2158 kdDebug() << endl; 2169 kdDebug() << endl;
2159*/ 2170*/
2160} 2171}
2161 2172
2162void KOAgenda::contentsMousePressEvent ( QMouseEvent *event ) 2173void KOAgenda::contentsMousePressEvent ( QMouseEvent *event )
2163{ 2174{
2164 2175
2165 QScrollView::contentsMousePressEvent(event); 2176 Q3ScrollView::contentsMousePressEvent(event);
2166} 2177}
2167 2178
2168void KOAgenda::storePosition() 2179void KOAgenda::storePosition()
2169{ 2180{
2170 //mContentPosition 2181 //mContentPosition
2171 int max = mGridSpacingY*4*24; 2182 int max = mGridSpacingY*4*24;
2172 if ( contentsY() < 5 && max > viewport()->height()*3/2 ) 2183 if ( contentsY() < 5 && max > viewport()->height()*3/2 )
2173 mContentPosition = 0; 2184 mContentPosition = 0;
2174 else if ( contentsY() + viewport()->height() > max - 5 && max > viewport()->height()*3/2) 2185 else if ( contentsY() + viewport()->height() > max - 5 && max > viewport()->height()*3/2)
2175 mContentPosition = -1.0; 2186 mContentPosition = -1.0;
2176 else 2187 else
2177 mContentPosition = ((float) max)/ ((float)(contentsY()+ ( viewport()->height()/2))); 2188 mContentPosition = ((float) max)/ ((float)(contentsY()+ ( viewport()->height()/2)));
2178 //qDebug("mContentPosition %f %d %d %d",mContentPosition , max, contentsY() ,viewport()->height()); 2189 //qDebug("mContentPosition %f %d %d %d",mContentPosition , max, contentsY() ,viewport()->height());
2179 2190
2180} 2191}
2181void KOAgenda::restorePosition() 2192void KOAgenda::restorePosition()
@@ -2183,68 +2194,68 @@ void KOAgenda::restorePosition()
2183 int posY; 2194 int posY;
2184 int max = mGridSpacingY*4*24; 2195 int max = mGridSpacingY*4*24;
2185 if ( mContentPosition < 0 ) 2196 if ( mContentPosition < 0 )
2186 posY = max-viewport()->height(); 2197 posY = max-viewport()->height();
2187 else 2198 else
2188 if ( mContentPosition == 0 ) 2199 if ( mContentPosition == 0 )
2189 posY = 0; 2200 posY = 0;
2190 else 2201 else
2191 posY = (int) ((max/mContentPosition)-(viewport()->height()/2)); 2202 posY = (int) ((max/mContentPosition)-(viewport()->height()/2));
2192 setContentsPos (0, posY ); 2203 setContentsPos (0, posY );
2193 //qDebug("posY %d hei %d", posY, max); 2204 //qDebug("posY %d hei %d", posY, max);
2194 2205
2195} 2206}
2196void KOAgenda::moveChild( QWidget *w, int x , int y ) 2207void KOAgenda::moveChild( QWidget *w, int x , int y )
2197{ 2208{
2198 ++x; 2209 ++x;
2199 QScrollView::moveChild( w, x , y ); 2210 Q3ScrollView::moveChild( w, x , y );
2200} 2211}
2201#include <qmessagebox.h> 2212#include <qmessagebox.h>
2202#ifdef DESKTOP_VERSION 2213#ifdef DESKTOP_VERSION
2203#include <qprinter.h> 2214#include <qprinter.h>
2204#include <qpainter.h> 2215#include <qpainter.h>
2205#include <qpaintdevicemetrics.h> 2216#include <q3paintdevicemetrics.h>
2206 2217
2207#endif 2218#endif
2208void KOAgenda::printSelection() 2219void KOAgenda::printSelection()
2209{ 2220{
2210#ifdef DESKTOP_VERSION 2221#ifdef DESKTOP_VERSION
2211 if ( mStartCellY == mCurrentCellY ) { 2222 if ( mStartCellY == mCurrentCellY ) {
2212 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2223 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2213 i18n("Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. "), 2224 i18n("Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. "),
2214 i18n("OK"), 0, 0, 2225 i18n("OK"), 0, 0,
2215 0, 1 ); 2226 0, 1 );
2216 return; 2227 return;
2217 } 2228 }
2218 2229
2219 float dx, dy; 2230 float dx, dy;
2220 int x,y,w,h; 2231 int x,y,w,h;
2221 x= 0; 2232 x= 0;
2222 w= contentsWidth()+2; 2233 w= contentsWidth()+2;
2223 // h= contentsHeight(); 2234 // h= contentsHeight();
2224 y = mGridSpacingY*mStartCellY; 2235 y = mGridSpacingY*mStartCellY;
2225 h = mGridSpacingY*(mCurrentCellY+1)-y+2; 2236 h = mGridSpacingY*(mCurrentCellY+1)-y+2;
2226 2237
2227 //return; 2238 //return;
2228 QPrinter* printer = new QPrinter(); 2239 QPrinter* printer = new QPrinter();
2229 if ( !printer->setup()) { 2240 if ( !printer->setup()) {
2230 delete printer; 2241 delete printer;
2231 return; 2242 return;
2232 } 2243 }
2233 QPainter p( printer ); 2244 QPainter p( printer );
2234 QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer ); 2245 Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( printer );
2235 QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() ); 2246 QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() );
2236 //date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); 2247 //date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true );
2237 int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height(); 2248 int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height();
2238 // p.drawText( 0, 0, date ); 2249 // p.drawText( 0, 0, date );
2239 int offset = m.width()/8; 2250 int offset = m.width()/8;
2240 // compute the scale 2251 // compute the scale
2241 dx = ((float) m.width()-offset) / (float)w; 2252 dx = ((float) m.width()-offset) / (float)w;
2242 dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h; 2253 dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h;
2243 float scale; 2254 float scale;
2244 // scale to fit the width or height of the paper 2255 // scale to fit the width or height of the paper
2245 if ( dx < dy ) 2256 if ( dx < dy )
2246 scale = dx; 2257 scale = dx;
2247 else 2258 else
2248 scale = dy; 2259 scale = dy;
2249 // set the scale 2260 // set the scale
2250 p.drawText( (int) (offset* scale), (int) (offset* scale*3/4), date ); 2261 p.drawText( (int) (offset* scale), (int) (offset* scale*3/4), date );
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index 380ce62..0708341 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -10,83 +10,92 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOAGENDA_H 23#ifndef KOAGENDA_H
24#define KOAGENDA_H 24#define KOAGENDA_H
25 25
26#include <qscrollview.h> 26#include <q3scrollview.h>
27#include <qtimer.h> 27#include <qtimer.h>
28#include <qmemarray.h> 28#include <q3memarray.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qpixmap.h> 30#include <qpixmap.h>
31#include <qguardedptr.h> 31#include <qpointer.h>
32//Added by qt3to4:
33#include <QResizeEvent>
34#include <Q3Frame>
35#include <QLabel>
36#include <QMouseEvent>
37#include <Q3PtrList>
38#include <Q3PopupMenu>
39#include <QKeyEvent>
40#include <QEvent>
32 41
33#include "koagendaitem.h" 42#include "koagendaitem.h"
34#include "koeventview.h" 43#include "koeventview.h"
35 44
36class QPopupMenu; 45class Q3PopupMenu;
37class QTime; 46class QTime;
38class KConfig; 47class KConfig;
39class QFrame; 48class Q3Frame;
40class KOAgenda; 49class KOAgenda;
41class KCal::Event; 50class KCal::Event;
42class KCal::Todo; 51class KCal::Todo;
43 52
44using namespace KCal; 53using namespace KCal;
45 54
46class MarcusBains : public QFrame { 55class MarcusBains : public Q3Frame {
47 Q_OBJECT 56 Q_OBJECT
48 public: 57 public:
49 MarcusBains(KOAgenda *agenda=0,const char *name=0); 58 MarcusBains(KOAgenda *agenda=0,const char *name=0);
50 virtual ~MarcusBains(); 59 virtual ~MarcusBains();
51 void hideMe(); 60 void hideMe();
52 public slots: 61 public slots:
53 void updateLocation(bool recalculate=false); 62 void updateLocation(bool recalculate=false);
54 void updateLoc(); 63 void updateLoc();
55 64
56 private: 65 private:
57 int todayColumn(); 66 int todayColumn();
58 QTimer *minutes; 67 QTimer *minutes;
59 QLabel *mTimeBox; 68 QLabel *mTimeBox;
60 KOAgenda *agenda; 69 KOAgenda *agenda;
61 QTime oldTime; 70 QTime oldTime;
62 int oldToday; 71 int oldToday;
63}; 72};
64 73
65 74
66class KOAgenda : public QScrollView 75class KOAgenda : public Q3ScrollView
67{ 76{
68 Q_OBJECT 77 Q_OBJECT
69 public: 78 public:
70 enum MouseActionType { NOP, MOVE, SELECT, 79 enum MouseActionType { NOP, MOVE, SELECT,
71 RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT }; 80 RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT };
72 81
73 KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0, 82 KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0,
74 const char * name=0, WFlags f=0 ); 83 const char * name=0, Qt::WFlags f=0 );
75 KOAgenda ( int columns, QWidget * parent=0, 84 KOAgenda ( int columns, QWidget * parent=0,
76 const char * name=0, WFlags f=0 ); 85 const char * name=0, Qt::WFlags f=0 );
77 virtual ~KOAgenda(); 86 virtual ~KOAgenda();
78 bool mInvalidPixmap; 87 bool mInvalidPixmap;
79 88
80 Incidence *selectedIncidence() const; 89 Incidence *selectedIncidence() const;
81 QDate selectedIncidenceDate() const; 90 QDate selectedIncidenceDate() const;
82 91
83 virtual bool eventFilter ( QObject *, QEvent * ); 92 virtual bool eventFilter ( QObject *, QEvent * );
84 93
85 void contentsToGrid (int x, int y, int& gx, int& gy); 94 void contentsToGrid (int x, int y, int& gx, int& gy);
86 void gridToContents (int gx, int gy, int& x, int& y); 95 void gridToContents (int gx, int gy, int& x, int& y);
87 96
88 int timeToY (const QTime &time); 97 int timeToY (const QTime &time);
89 QTime gyToTime (int y); 98 QTime gyToTime (int y);
90 99
91 void setStartHour(int startHour); 100 void setStartHour(int startHour);
92 101
@@ -104,33 +113,33 @@ class KOAgenda : public QScrollView
104 int gridSpacingY() const { return mGridSpacingY; } 113 int gridSpacingY() const { return mGridSpacingY; }
105 114
106// virtual QSizePolicy sizePolicy() const; 115// virtual QSizePolicy sizePolicy() const;
107 116
108 void clear(); 117 void clear();
109 118
110 void clearSelection(); 119 void clearSelection();
111 void hideUnused(); 120 void hideUnused();
112 121
113 /** Calculates the minimum width */ 122 /** Calculates the minimum width */
114 virtual int minimumWidth() const; 123 virtual int minimumWidth() const;
115 /** Update configuration from preference settings */ 124 /** Update configuration from preference settings */
116 void updateConfig(); 125 void updateConfig();
117 126
118 void checkScrollBoundaries(); 127 void checkScrollBoundaries();
119 128
120 void setHolidayMask(QMemArray<bool> *); 129 void setHolidayMask(Q3MemArray<bool> *);
121 void setDateList(const DateList &selectedDates); 130 void setDateList(const DateList &selectedDates);
122 DateList dateList() const; 131 DateList dateList() const;
123 void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); 132 void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false);
124 void finishUpdate(); 133 void finishUpdate();
125 void printSelection(); 134 void printSelection();
126 void storePosition(); 135 void storePosition();
127 void restorePosition(); 136 void restorePosition();
128 void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; } 137 void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; }
129 void shrinkPixmap(); 138 void shrinkPixmap();
130 QTime getEndTime(); 139 QTime getEndTime();
131 bool invalidPixmap(); 140 bool invalidPixmap();
132 141
133 public slots: 142 public slots:
134 void slotContentMove(int,int); 143 void slotContentMove(int,int);
135 void categoryChanged(Incidence * inc); 144 void categoryChanged(Incidence * inc);
136 void slotClearSelection(); 145 void slotClearSelection();
@@ -264,45 +273,45 @@ class KOAgenda : public QScrollView
264 bool mWorkingHoursEnable; 273 bool mWorkingHoursEnable;
265 int mWorkingHoursYTop; 274 int mWorkingHoursYTop;
266 int mWorkingHoursYBottom; 275 int mWorkingHoursYBottom;
267 276
268 // Selection 277 // Selection
269 int mSelectionCellX; 278 int mSelectionCellX;
270 int mSelectionYTop; 279 int mSelectionYTop;
271 int mSelectionHeight; 280 int mSelectionHeight;
272 281
273 // List of dates to be displayed 282 // List of dates to be displayed
274 DateList mSelectedDates; 283 DateList mSelectedDates;
275 284
276 // The KOAgendaItem, which has been right-clicked last 285 // The KOAgendaItem, which has been right-clicked last
277 KOAgendaItem *mClickedItem; 286 KOAgendaItem *mClickedItem;
278 287
279 // The KOAgendaItem, which is being moved/resized 288 // The KOAgendaItem, which is being moved/resized
280 QGuardedPtr<KOAgendaItem> mActionItem; 289 QPointer<KOAgendaItem> mActionItem;
281 290
282 // Currently selected item 291 // Currently selected item
283 QGuardedPtr<KOAgendaItem> mSelectedItem; 292 QPointer<KOAgendaItem> mSelectedItem;
284 293
285 // The Marcus Bains Line widget. 294 // The Marcus Bains Line widget.
286 MarcusBains *mMarcusBains; 295 MarcusBains *mMarcusBains;
287 void computeSizes(); 296 void computeSizes();
288 297
289 MouseActionType mActionType; 298 MouseActionType mActionType;
290 299
291 bool mItemMoved; 300 bool mItemMoved;
292 301
293 // List of all Items contained in agenda 302 // List of all Items contained in agenda
294 QPtrList<KOAgendaItem> mItems; 303 Q3PtrList<KOAgendaItem> mItems;
295 QPtrList<KOAgendaItem> mUnusedItems; 304 Q3PtrList<KOAgendaItem> mUnusedItems;
296 KOAgendaItem* getNewItem(Incidence * event,QDate qd, QWidget* viewport); 305 KOAgendaItem* getNewItem(Incidence * event,QDate qd, QWidget* viewport);
297 QPopupMenu *mItemPopup; // Right mouse button popup menu for KOAgendaItems 306 Q3PopupMenu *mItemPopup; // Right mouse button popup menu for KOAgendaItems
298 QPopupMenu *mNewItemPopup; 307 Q3PopupMenu *mNewItemPopup;
299 308
300 int mOldLowerScrollValue; 309 int mOldLowerScrollValue;
301 int mOldUpperScrollValue; 310 int mOldUpperScrollValue;
302 KOAgendaItem * getItemForTodo ( Todo * todo ); 311 KOAgendaItem * getItemForTodo ( Todo * todo );
303 QMemArray<bool> *mHolidayMask; 312 Q3MemArray<bool> *mHolidayMask;
304 int mCurPixWid; 313 int mCurPixWid;
305 int mCurPixHei; 314 int mCurPixHei;
306}; 315};
307 316
308#endif // KOAGENDA_H 317#endif // KOAGENDA_H
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 407424d..0f9a38f 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -6,146 +6,156 @@
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qlabel.h> 20#include <qlabel.h>
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qhbox.h> 22#include <q3hbox.h>
23#include <qvbox.h> 23#include <q3vbox.h>
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qwhatsthis.h> 25#include <q3whatsthis.h>
26#include <qdragobject.h> 26#include <q3dragobject.h>
27#include <qdrawutil.h> 27#include <qdrawutil.h>
28#include <qpainter.h> 28#include <qpainter.h>
29#include <QDesktopWidget>
30//Added by qt3to4:
31#include <Q3PtrList>
32#include <QPixmap>
33#include <QDragEnterEvent>
34#include <QDropEvent>
35#include <QResizeEvent>
36#include <QMouseEvent>
37#include <QEvent>
38#include <QPaintEvent>
29 39
30#include <kiconloader.h> 40#include <kiconloader.h>
31#include <kdebug.h> 41#include <kdebug.h>
32#include <kglobal.h> 42#include <kglobal.h>
33#include <klocale.h> 43#include <klocale.h>
34#ifndef DESKTOP_VERSION 44#ifndef DESKTOP_VERSION
35#include <qpe/qpeapplication.h> 45#include <qpe/qpeapplication.h>
36#define AGENDA_ICON_SIZE 5 46#define AGENDA_ICON_SIZE 5
37#else 47#else
38#include <qapplication.h> 48#include <qapplication.h>
39#define AGENDA_ICON_SIZE 7 49#define AGENDA_ICON_SIZE 7
40#endif 50#endif
41#include <libkcal/icaldrag.h> 51#include <libkcal/icaldrag.h>
42#include <libkcal/vcaldrag.h> 52#include <libkcal/vcaldrag.h>
43#include <libkcal/kincidenceformatter.h> 53#include <libkcal/kincidenceformatter.h>
44extern int globalFlagBlockAgenda; 54extern int globalFlagBlockAgenda;
45extern int globalFlagBlockAgendaItemPaint; 55extern int globalFlagBlockAgendaItemPaint;
46extern int globalFlagBlockAgendaItemUpdate; 56extern int globalFlagBlockAgendaItemUpdate;
47 57
48#include "koprefs.h" 58#include "koprefs.h"
49 59
50#include "koagendaitem.h" 60#include "koagendaitem.h"
51//#include "koagendaitem.moc" 61//#include "koagendaitem.moc"
52 62
53 63
54//-------------------------------------------------------------------------- 64//--------------------------------------------------------------------------
55 65
56QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; 66QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
57 67
58//-------------------------------------------------------------------------- 68//--------------------------------------------------------------------------
59 69
60class KOAgendaItemWhatsThis :public QWhatsThis 70class KOAgendaItemWhatsThis :public Q3WhatsThis
61{ 71{
62public: 72public:
63 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; 73 KOAgendaItemWhatsThis( KOAgendaItem* view ) : Q3WhatsThis( view ),_view (view) { };
64 74
65protected: 75protected:
66 virtual QString text( const QPoint& ) 76 virtual QString text( const QPoint& )
67 { 77 {
68 return _view->getWhatsThisText() ; 78 return _view->getWhatsThisText() ;
69 } 79 }
70private: 80private:
71 KOAgendaItem * _view; 81 KOAgendaItem * _view;
72}; 82};
73 83
74KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, 84KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
75 const char *name,WFlags) : 85 const char *name,Qt::WFlags) :
76 QWidget(parent, name), mIncidence(incidence), mDate(qd) 86 QWidget(parent, name), mIncidence(incidence), mDate(qd)
77{ 87{
78#ifndef DESKTOP_VERSION 88#ifndef DESKTOP_VERSION
79 //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 89 //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
80#endif 90#endif
81 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); 91 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this);
82 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase 92 Qt::WindowFlags wflags = windowFlags() |Qt::WRepaintNoErase;// WResizeNoErase
83 setWFlags ( wflags); 93 setWindowFlags ( wflags);
84 mAllDay = allday; 94 mAllDay = allday;
85 init ( incidence, qd ); 95 init ( incidence, qd );
86 //setMouseTracking(true); 96 //setMouseTracking(true);
87 //setAcceptDrops(true); 97 //setAcceptDrops(true);
88 xPaintCoord = -1; 98 xPaintCoord = -1;
89 yPaintCoord = -1; 99 yPaintCoord = -1;
90} 100}
91QString KOAgendaItem::getWhatsThisText() 101QString KOAgendaItem::getWhatsThisText()
92{ 102{
93 if ( mIncidence ) 103 if ( mIncidence )
94 return KIncidenceFormatter::instance()->getFormattedText( mIncidence, 104 return KIncidenceFormatter::instance()->getFormattedText( mIncidence,
95 KOPrefs::instance()->mWTshowDetails, 105 KOPrefs::instance()->mWTshowDetails,
96 KOPrefs::instance()->mWTshowCreated, 106 KOPrefs::instance()->mWTshowCreated,
97 KOPrefs::instance()->mWTshowChanged); 107 KOPrefs::instance()->mWTshowChanged);
98 return "KOAgendaItem::getWhatsThisText()::internal error"; 108 return "KOAgendaItem::getWhatsThisText()::internal error";
99} 109}
100 110
101void KOAgendaItem::initColor () 111void KOAgendaItem::initColor ()
102{ 112{
103 if ( (mIncidence->typeID() == todoID ) && 113 if ( (mIncidence->typeID() == todoID ) &&
104 ( !((static_cast<Todo*>(mIncidence))->isCompleted()) && 114 ( !((static_cast<Todo*>(mIncidence))->isCompleted()) &&
105 ((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) { 115 ((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) {
106 if ( (static_cast<Todo*>(mIncidence))->dtDue() < QDateTime::currentDateTime().date()) 116 if ( (static_cast<Todo*>(mIncidence))->dtDue() < (QDateTime)QDateTime::currentDateTime().date())
107 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 117 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
108 else 118 else
109 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 119 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
110 } 120 }
111 else { 121 else {
112 QStringList categories = mIncidence->categories(); 122 QStringList categories = mIncidence->categories();
113 QString cat = categories.first(); 123 QString cat = categories.first();
114 if (cat.isEmpty()) { 124 if (cat.isEmpty()) {
115 if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) 125 if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) )
116 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 126 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
117 else 127 else
118 mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() ); 128 mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() );
119 } else { 129 } else {
120 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 130 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
121 if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) { 131 if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) {
122 if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) 132 if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
123 mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; 133 mBackgroundColor = KOPrefs::instance()->mTodoDoneColor;
124 } 134 }
125 } 135 }
126 136
127 } 137 }
128 138
129 QColor BackgroundColor ( mBackgroundColor ); 139 QColor BackgroundColor ( mBackgroundColor );
130 if ( mIncidence->calID() > 1 ) { 140 if ( mIncidence->calID() > 1 ) {
131 //BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() ); 141 //BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() );
132 } 142 }
133 mColorGroup = QColorGroup( BackgroundColor.light(), 143 mColorGroup = QColorGroup( BackgroundColor.light(),
134 BackgroundColor.dark(),BackgroundColor.light(), 144 BackgroundColor.dark(),BackgroundColor.light(),
135 BackgroundColor.dark(),BackgroundColor, black, BackgroundColor) ; 145 BackgroundColor.dark(),BackgroundColor, Qt::black, BackgroundColor) ;
136 setBackgroundColor( mBackgroundColor ); 146 setBackgroundColor( mBackgroundColor );
137 mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); 147 mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250);
138} 148}
139void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 149void KOAgendaItem::init ( Incidence *incidence, QDate qd )
140{ 150{
141 mIncidence = incidence; 151 mIncidence = incidence;
142 mDate = qd; 152 mDate = qd;
143 mFirstMultiItem = 0; 153 mFirstMultiItem = 0;
144 mNextMultiItem = 0; 154 mNextMultiItem = 0;
145 mLastMultiItem = 0; 155 mLastMultiItem = 0;
146 computeText(); 156 computeText();
147 initColor(); 157 initColor();
148 mConflictItems.clear(); 158 mConflictItems.clear();
149 setCellXY(0,0,1); 159 setCellXY(0,0,1);
150 setCellXWidth(0); 160 setCellXWidth(0);
151 setSubCell(0); 161 setSubCell(0);
@@ -215,82 +225,82 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
215 else { 225 else {
216 ++yOff; 226 ++yOff;
217 ++y; 227 ++y;
218 } 228 }
219 } 229 }
220 if (mIncidence->cancelled() && height() < 20 ) { 230 if (mIncidence->cancelled() && height() < 20 ) {
221 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; 231 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
222 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; 232 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
223 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); 233 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
224 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); 234 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
225 if ( horLayout ) 235 if ( horLayout )
226 ++xOff; 236 ++xOff;
227 else 237 else
228 ++yOff; 238 ++yOff;
229 } 239 }
230 if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) { 240 if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) {
231 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); 241 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::red );
232 if ( horLayout ) 242 if ( horLayout )
233 ++xOff; 243 ++xOff;
234 else 244 else
235 ++yOff; 245 ++yOff;
236 } 246 }
237 if (mIncidence->doesRecur()) { 247 if (mIncidence->doesRecur()) {
238 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); 248 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::blue );
239 if ( horLayout ) 249 if ( horLayout )
240 ++xOff; 250 ++xOff;
241 else 251 else
242 ++yOff; 252 ++yOff;
243 } 253 }
244 if (mIncidence->description().length() > 0) { 254 if (mIncidence->description().length() > 0) {
245 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); 255 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::darkGreen );
246 if ( horLayout ) 256 if ( horLayout )
247 ++xOff; 257 ++xOff;
248 else 258 else
249 ++yOff; 259 ++yOff;
250 } 260 }
251 if (mIncidence->isReadOnly()) { 261 if (mIncidence->isReadOnly()) {
252 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); 262 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::white );
253 if ( horLayout ) 263 if ( horLayout )
254 ++xOff; 264 ++xOff;
255 else 265 else
256 ++yOff; 266 ++yOff;
257 } 267 }
258 268
259 if (mIncidence->attendeeCount()>0) { 269 if (mIncidence->attendeeCount()>0) {
260 270
261 if (mIncidence->organizer() == KOPrefs::instance()->email()) { 271 if (mIncidence->organizer() == KOPrefs::instance()->email()) {
262 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); 272 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::black );
263 if ( horLayout ) 273 if ( horLayout )
264 ++xOff; 274 ++xOff;
265 else 275 else
266 ++yOff; 276 ++yOff;
267 } else { 277 } else {
268 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 278 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
269 if (me!=0) { 279 if (me!=0) {
270 280
271 281
272 } else { 282 } else {
273 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); 283 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::yellow );
274 if ( horLayout ) 284 if ( horLayout )
275 ++xOff; 285 ++xOff;
276 else 286 else
277 ++yOff; 287 ++yOff;
278 288
279 } 289 }
280 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); 290 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::darkYellow );
281 if ( horLayout ) 291 if ( horLayout )
282 ++xOff; 292 ++xOff;
283 else 293 else
284 ++yOff; 294 ++yOff;
285 295
286 } 296 }
287 297
288 } 298 }
289 return ( yOff || xOff ); 299 return ( yOff || xOff );
290} 300}
291 301
292 302
293void KOAgendaItem::select(bool selected) 303void KOAgendaItem::select(bool selected)
294{ 304{
295 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); 305 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() );
296 if (mSelected == selected) return; 306 if (mSelected == selected) return;
@@ -407,59 +417,59 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint )
407 qDrawWinPanel (paint, x, yy, w, h, mColorGroup, selected ,0); 417 qDrawWinPanel (paint, x, yy, w, h, mColorGroup, selected ,0);
408 //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); 418 //qDebug("draw rect %d %d %d %d ",x, yy, w, h );
409 if ( ! small ) { 419 if ( ! small ) {
410 x += 3; yy += 3;w -= 6; h-= 5; 420 x += 3; yy += 3;w -= 6; h-= 5;
411 } else { 421 } else {
412 x += 2; yy += 1;w -= 4; h-= 4; 422 x += 2; yy += 1;w -= 4; h-= 4;
413 if ( nfh < 6.01 ) { 423 if ( nfh < 6.01 ) {
414 yy -= 2; 424 yy -= 2;
415 h += 4; 425 h += 4;
416 } 426 }
417 else 427 else
418 if ( nfh < h -2 ) 428 if ( nfh < h -2 )
419 ++yy; 429 ++yy;
420 } 430 }
421 int align; 431 int align;
422#ifndef DESKTOP_VERSION 432#ifndef DESKTOP_VERSION
423 align = ( AlignLeft|WordBreak|AlignTop); 433 align = ( Qt::AlignLeft|Qt::TextWordWrap|Qt::AlignTop);
424#else 434#else
425 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 435 align = ( Qt::AlignLeft|Qt::TextWrapAnywhere|Qt::TextWordWrap|Qt::AlignTop);
426#endif 436#endif
427 if ( addIcon ) { 437 if ( addIcon ) {
428 if ( ! horLayout ) { 438 if ( ! horLayout ) {
429 x += AGENDA_ICON_SIZE+3; 439 x += AGENDA_ICON_SIZE+3;
430 w -= (AGENDA_ICON_SIZE+3); 440 w -= (AGENDA_ICON_SIZE+3);
431 } 441 }
432 else { 442 else {
433 yy+= AGENDA_ICON_SIZE+2; 443 yy+= AGENDA_ICON_SIZE+2;
434 h -=(AGENDA_ICON_SIZE+3); 444 h -=(AGENDA_ICON_SIZE+3);
435 } 445 }
436 } 446 }
437 if ( mWhiteText ) 447 if ( mWhiteText )
438 paint->setPen ( white); 448 paint->setPen ( Qt::white);
439 if ( x < 0 ) { 449 if ( x < 0 ) {
440 w = w+x-3; 450 w = w+x-3;
441 x = 3; 451 x = 3;
442 if ( !horLayout && addIcon ) 452 if ( !horLayout && addIcon )
443 x += AGENDA_ICON_SIZE+3; 453 x += AGENDA_ICON_SIZE+3;
444 if ( w > parentWidget()->width() ){ 454 if ( w > parentWidget()->width() ){
445 w = parentWidget()->width() - 6; 455 w = parentWidget()->width() - 6;
446#ifndef DESKTOP_VERSION 456#ifndef DESKTOP_VERSION
447 align = ( AlignHCenter|WordBreak|AlignTop); 457 align = ( Qt::AlignHCenter|Qt::TextWordWrap|Qt::AlignTop);
448#else 458#else
449 align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); 459 align = ( Qt::AlignHCenter|Qt::TextWrapAnywhere|Qt::TextWordWrap|Qt::AlignTop);
450#endif 460#endif
451 461
452 } 462 }
453 } 463 }
454 QRect dr; 464 QRect dr;
455 if ( w + x > parentWidget()->width() ) 465 if ( w + x > parentWidget()->width() )
456 w = parentWidget()->width()-x; 466 w = parentWidget()->width()-x;
457 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); 467 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr );
458 //qDebug("%d %d %d %d ", x, yy, w, h ); 468 //qDebug("%d %d %d %d ", x, yy, w, h );
459 if ( mIncidence->cancelled() ){ 469 if ( mIncidence->cancelled() ){
460 470
461 471
462 small = ( height() < 20 ); 472 small = ( height() < 20 );
463 473
464 if ( ! small ) { 474 if ( ! small ) {
465 QFontMetrics fm ( paint->font() ); 475 QFontMetrics fm ( paint->font() );
@@ -548,33 +558,33 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e )
548 rw = rw + xx; 558 rw = rw + xx;
549 rx -= xx; 559 rx -= xx;
550 xx = 0; 560 xx = 0;
551 if ( rw <= 1 ) { 561 if ( rw <= 1 ) {
552 //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1()); 562 //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1());
553 return; 563 return;
554 } 564 }
555 } 565 }
556 if ( paintFrom->width() < xx+rw ) { 566 if ( paintFrom->width() < xx+rw ) {
557 rw = paintFrom->width() - xx; 567 rw = paintFrom->width() - xx;
558 if ( rw <= 1 ) { 568 if ( rw <= 1 ) {
559 //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() ); 569 //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() );
560 return; 570 return;
561 } 571 }
562 } 572 }
563 //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); 573 //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh);
564 bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); 574 bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,QPainter::CompositionMode_Source);
565} 575}
566void KOAgendaItem::computeText() 576void KOAgendaItem::computeText()
567{ 577{
568 mDisplayedText = mIncidence->summary(); 578 mDisplayedText = mIncidence->summary();
569 if ( (mIncidence->typeID() == todoID ) ) { 579 if ( (mIncidence->typeID() == todoID ) ) {
570 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { 580 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
571 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) 581 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
572 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; 582 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
573 else if ( !(mIncidence->doesFloat())) 583 else if ( !(mIncidence->doesFloat()))
574 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; 584 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
575 } 585 }
576 } else { 586 } else {
577 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) 587 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
578 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; 588 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
579 589
580 if ( mAllDay ) { 590 if ( mAllDay ) {
@@ -615,33 +625,33 @@ void KOAgendaItem::computeText()
615 else if ( mIncidence->typeID() == todoID ) { 625 else if ( mIncidence->typeID() == todoID ) {
616 if (mIncidence->hasStartDate()) 626 if (mIncidence->hasStartDate())
617 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); 627 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr();
618 if (((Todo*)mIncidence)->hasDueDate()) 628 if (((Todo*)mIncidence)->hasDueDate())
619 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); 629 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr();
620 } 630 }
621 } else if ( mIncidence->typeID() == todoID ) { 631 } else if ( mIncidence->typeID() == todoID ) {
622 if (mIncidence->hasStartDate()) 632 if (mIncidence->hasStartDate())
623 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); 633 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr();
624 if (((Todo*)mIncidence)->hasDueDate()) 634 if (((Todo*)mIncidence)->hasDueDate())
625 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); 635 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr();
626 } 636 }
627 637
628 if (!mIncidence->location().isEmpty()) { 638 if (!mIncidence->location().isEmpty()) {
629 tipText += "\n"+i18n("Location: ")+mIncidence->location(); 639 tipText += "\n"+i18n("Location: ")+mIncidence->location();
630 } 640 }
631 QToolTip::add(this,tipText,toolTipGroup(),""); 641 QToolTip::add(this,tipText /*TODO:hacker: ,toolTipGroup(),"" */);
632#endif 642#endif
633} 643}
634void KOAgendaItem::updateItem() 644void KOAgendaItem::updateItem()
635{ 645{
636 computeText(); 646 computeText();
637 647
638 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); 648 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y());
639 paintMe( mSelected ); 649 paintMe( mSelected );
640 repaint( false); 650 repaint( false);
641} 651}
642 652
643void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) 653void KOAgendaItem::resizeEvent ( QResizeEvent *ev )
644{ 654{
645 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); 655 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1());
646 paintMe( mSelected ); 656 paintMe( mSelected );
647 repaint( false ); 657 repaint( false );
@@ -782,76 +792,76 @@ void KOAgendaItem::expandLeft(int dx)
782 int newX = cellX() + dx; 792 int newX = cellX() + dx;
783 int newXWidth = cellXWidth(); 793 int newXWidth = cellXWidth();
784 if (newX > newXWidth) newX = newXWidth; 794 if (newX > newXWidth) newX = newXWidth;
785 setCellX(newX,newXWidth); 795 setCellX(newX,newXWidth);
786} 796}
787 797
788void KOAgendaItem::expandRight(int dx) 798void KOAgendaItem::expandRight(int dx)
789{ 799{
790 int newX = cellX(); 800 int newX = cellX();
791 int newXWidth = cellXWidth() + dx; 801 int newXWidth = cellXWidth() + dx;
792 if (newXWidth < newX) newXWidth = newX; 802 if (newXWidth < newX) newXWidth = newX;
793 setCellX(newX,newXWidth); 803 setCellX(newX,newXWidth);
794} 804}
795 805
796QToolTipGroup *KOAgendaItem::toolTipGroup() 806QToolTipGroup *KOAgendaItem::toolTipGroup()
797{ 807{
798 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 808 /* TODO:hacker: if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); */
799 return mToolTipGroup; 809 return mToolTipGroup;
800} 810}
801 811
802void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) 812void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e )
803{ 813{
804#ifndef KORG_NODND 814#ifndef KORG_NODND
805 if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || 815 if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) ||
806 !QTextDrag::canDecode( e ) ) { 816 !Q3TextDrag::canDecode( e ) ) {
807 e->ignore(); 817 e->ignore();
808 return; 818 return;
809 } 819 }
810 e->accept(); 820 e->accept();
811#endif 821#endif
812} 822}
813 823
814void KOAgendaItem::dropEvent( QDropEvent *e ) 824void KOAgendaItem::dropEvent( QDropEvent *e )
815{ 825{
816#ifndef KORG_NODND 826#ifndef KORG_NODND
817 QString text; 827 QString text;
818 if(QTextDrag::decode(e,text)) 828 if(Q3TextDrag::decode(e,text))
819 { 829 {
820 kdDebug() << "Dropped : " << text << endl; 830 kdDebug() << "Dropped : " << text << endl;
821 QStringList emails = QStringList::split(",",text); 831 QStringList emails = QStringList::split(",",text);
822 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { 832 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) {
823 kdDebug() << " Email: " << (*it) << endl; 833 kdDebug() << " Email: " << (*it) << endl;
824 int pos = (*it).find("<"); 834 int pos = (*it).find("<");
825 QString name = (*it).left(pos); 835 QString name = (*it).left(pos);
826 QString email = (*it).mid(pos); 836 QString email = (*it).mid(pos);
827 if (!email.isEmpty()) { 837 if (!email.isEmpty()) {
828 mIncidence->addAttendee(new Attendee(name,email)); 838 mIncidence->addAttendee(new Attendee(name,email));
829 } 839 }
830 } 840 }
831 } 841 }
832#endif 842#endif
833} 843}
834 844
835 845
836QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() 846Q3PtrList<KOAgendaItem> KOAgendaItem::conflictItems()
837{ 847{
838 return mConflictItems; 848 return mConflictItems;
839} 849}
840 850
841void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) 851void KOAgendaItem::setConflictItems(Q3PtrList<KOAgendaItem> ci)
842{ 852{
843 mConflictItems = ci; 853 mConflictItems = ci;
844 KOAgendaItem *item; 854 KOAgendaItem *item;
845 for ( item=mConflictItems.first(); item != 0; 855 for ( item=mConflictItems.first(); item != 0;
846 item=mConflictItems.next() ) { 856 item=mConflictItems.next() ) {
847 item->addConflictItem(this); 857 item->addConflictItem(this);
848 } 858 }
849} 859}
850 860
851void KOAgendaItem::addConflictItem(KOAgendaItem *ci) 861void KOAgendaItem::addConflictItem(KOAgendaItem *ci)
852{ 862{
853 if (mConflictItems.find(ci)<0) 863 if (mConflictItems.find(ci)<0)
854 mConflictItems.append(ci); 864 mConflictItems.append(ci);
855} 865}
856 866
857bool KOAgendaItem::checkLayout() 867bool KOAgendaItem::checkLayout()
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h
index 27ee720..17cf975 100644
--- a/korganizer/koagendaitem.h
+++ b/korganizer/koagendaitem.h
@@ -6,59 +6,66 @@
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19#ifndef KOAGENDAITEM_H 19#ifndef KOAGENDAITEM_H
20#define KOAGENDAITEM_H 20#define KOAGENDAITEM_H
21 21
22#include <qframe.h> 22#include <q3frame.h>
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qpixmap.h> 24#include <qpixmap.h>
25#include <qdatetime.h> 25#include <qdatetime.h>
26#include <qpalette.h> 26#include <qpalette.h>
27//Added by qt3to4:
28#include <QDropEvent>
29#include <QPaintEvent>
30#include <QResizeEvent>
31#include <Q3PtrList>
32#include <QEvent>
33#include <QDragEnterEvent>
27 34
28#include <libkcal/incidence.h> 35#include <libkcal/incidence.h>
29 36
30class KOAgendaItemWhatsThis; 37class KOAgendaItemWhatsThis;
31class QToolTipGroup; 38class QToolTipGroup;
32class QDragEnterEvent; 39class QDragEnterEvent;
33class QDropEvent; 40class QDropEvent;
34 41
35using namespace KCal; 42using namespace KCal;
36 43
37/* 44/*
38 The KOAgendaItem has to make sure that it receives all mouse events, which are 45 The KOAgendaItem has to make sure that it receives all mouse events, which are
39 to be used for dragging and resizing. That means it has to be installed as 46 to be used for dragging and resizing. That means it has to be installed as
40 eventfiler for its children, if it has children, and it has to pass mouse 47 eventfiler for its children, if it has children, and it has to pass mouse
41 events from the cildren to itself. See eventFilter(). 48 events from the cildren to itself. See eventFilter().
42*/ 49*/
43class KOAgendaItem : public QWidget 50class KOAgendaItem : public QWidget
44{ 51{
45 Q_OBJECT 52 Q_OBJECT
46 public: 53 public:
47 KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent, bool allday, const char *name=0, 54 KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent, bool allday, const char *name=0,
48 WFlags f=0 ); 55 Qt::WFlags f=0 );
49 ~KOAgendaItem(); 56 ~KOAgendaItem();
50 QString getWhatsThisText(); 57 QString getWhatsThisText();
51 void init ( Incidence *incidence, QDate qd ); 58 void init ( Incidence *incidence, QDate qd );
52 int cellX() { return mCellX; } 59 int cellX() { return mCellX; }
53 int cellXWidth() { return mCellXWidth; } 60 int cellXWidth() { return mCellXWidth; }
54 int cellYTop() { return mCellYTop; } 61 int cellYTop() { return mCellYTop; }
55 int cellYBottom() { return mCellYBottom; } 62 int cellYBottom() { return mCellYBottom; }
56 int cellHeight(); 63 int cellHeight();
57 int cellWidth(); 64 int cellWidth();
58 int subCell() { return mSubCell; } 65 int subCell() { return mSubCell; }
59 int subCells() { return mSubCells; } 66 int subCells() { return mSubCells; }
60 67
61 void setCellXY(int X, int YTop, int YBottom); 68 void setCellXY(int X, int YTop, int YBottom);
62 void setCellY(int YTop, int YBottom); 69 void setCellY(int YTop, int YBottom);
63 void setCellX(int XLeft, int XRight); 70 void setCellX(int XLeft, int XRight);
64 void setCellXWidth(int xwidth); 71 void setCellXWidth(int xwidth);
@@ -83,34 +90,34 @@ class KOAgendaItem : public QWidget
83 KOAgendaItem *nextMultiItem() { return mNextMultiItem; } 90 KOAgendaItem *nextMultiItem() { return mNextMultiItem; }
84 KOAgendaItem *lastMultiItem() { return mLastMultiItem; } 91 KOAgendaItem *lastMultiItem() { return mLastMultiItem; }
85 92
86 Incidence *incidence() const { return mIncidence; } 93 Incidence *incidence() const { return mIncidence; }
87 QDate itemDate() { return mDate; } 94 QDate itemDate() { return mDate; }
88 95
89 /** Update the date of this item's occurence (not in the event) */ 96 /** Update the date of this item's occurence (not in the event) */
90 void setItemDate(QDate qd); 97 void setItemDate(QDate qd);
91 98
92 void setText ( const QString & text ) { mDisplayedText = text; } 99 void setText ( const QString & text ) { mDisplayedText = text; }
93 QString text () { return mDisplayedText; } 100 QString text () { return mDisplayedText; }
94 101
95 virtual bool eventFilter ( QObject *, QEvent * ); 102 virtual bool eventFilter ( QObject *, QEvent * );
96 103
97 static QToolTipGroup *toolTipGroup(); 104 static QToolTipGroup *toolTipGroup();
98 105
99 QPtrList<KOAgendaItem> conflictItems(); 106 Q3PtrList<KOAgendaItem> conflictItems();
100 void setConflictItems(QPtrList<KOAgendaItem>); 107 void setConflictItems(Q3PtrList<KOAgendaItem>);
101 void addConflictItem(KOAgendaItem *ci); 108 void addConflictItem(KOAgendaItem *ci);
102 void paintMe( bool, QPainter* painter = 0 ); 109 void paintMe( bool, QPainter* painter = 0 );
103 void repaintMe(); 110 void repaintMe();
104 static QPixmap * paintPix(); 111 static QPixmap * paintPix();
105 static QPixmap * paintPixAllday(); 112 static QPixmap * paintPixAllday();
106 void updateItem(); 113 void updateItem();
107 void computeText(); 114 void computeText();
108 void recreateIncidence(); 115 void recreateIncidence();
109 bool checkLayout(); 116 bool checkLayout();
110 void initColor (); 117 void initColor ();
111 bool isAllDay() { return mAllDay; } 118 bool isAllDay() { return mAllDay; }
112 int resizeMe( int grid, int wid, int hei, bool invalidWidth = false ); 119 int resizeMe( int grid, int wid, int hei, bool invalidWidth = false );
113 public slots: 120 public slots:
114 bool updateIcons( QPainter *, bool ); 121 bool updateIcons( QPainter *, bool );
115 void select(bool=true); 122 void select(bool=true);
116 void repaintItem(); 123 void repaintItem();
@@ -148,20 +155,20 @@ class KOAgendaItem : public QWidget
148 int mFontPixelSize; 155 int mFontPixelSize;
149 Incidence *mIncidence; // corresponding event or todo 156 Incidence *mIncidence; // corresponding event or todo
150 QDate mDate; //date this events occurs (for recurrence) 157 QDate mDate; //date this events occurs (for recurrence)
151 //void showIcon( QLabel*, int ); 158 //void showIcon( QLabel*, int );
152 //QLabel *mTodoIconLabel; 159 //QLabel *mTodoIconLabel;
153 //QLabel *mItemLabel; 160 //QLabel *mItemLabel;
154 //QWidget *mIconBox; 161 //QWidget *mIconBox;
155 //QLabel *mIconAlarm,*mIconRecur,*mIconReadonly; 162 //QLabel *mIconAlarm,*mIconRecur,*mIconReadonly;
156 //QLabel *mIconReply,*mIconGroup,*mIconOrganizer; 163 //QLabel *mIconReply,*mIconGroup,*mIconOrganizer;
157 //QLabel *mIconMoreInfo; 164 //QLabel *mIconMoreInfo;
158 static QToolTipGroup *mToolTipGroup; 165 static QToolTipGroup *mToolTipGroup;
159 166
160 QColor mBackgroundColor; 167 QColor mBackgroundColor;
161 QColorGroup mColorGroup; 168 QColorGroup mColorGroup;
162 QString mDisplayedText; 169 QString mDisplayedText;
163 bool mSelected; 170 bool mSelected;
164 QPtrList<KOAgendaItem> mConflictItems; 171 Q3PtrList<KOAgendaItem> mConflictItems;
165}; 172};
166 173
167#endif // KOAGENDAITEM_H 174#endif // KOAGENDAITEM_H
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 6e65a03..87993ae 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -8,47 +8,59 @@
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qhbox.h> 24#include <q3hbox.h>
25#include <qvbox.h> 25#include <q3vbox.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qframe.h> 27#include <q3frame.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#ifndef KORG_NOSPLITTER 29#ifndef KORG_NOSPLITTER
30#include <qsplitter.h> 30#include <qsplitter.h>
31#endif 31#endif
32#include <qfont.h> 32#include <qfont.h>
33#include <qfontmetrics.h> 33#include <qfontmetrics.h>
34#include <qpopupmenu.h> 34#include <q3popupmenu.h>
35#include <qtooltip.h> 35#include <qtooltip.h>
36#include <qpainter.h> 36#include <qpainter.h>
37#include <qpushbutton.h> 37#include <qpushbutton.h>
38#include <qapplication.h> 38#include <qapplication.h>
39#include <QDesktopWidget>
40//Added by qt3to4:
41#include <QResizeEvent>
42#include <QPixmap>
43#include <QMouseEvent>
44#include <Q3GridLayout>
45#include <Q3ValueList>
46#include <QKeyEvent>
47#include <Q3HBoxLayout>
48#include <Q3VBoxLayout>
49#include <QPaintEvent>
50#include <Q3PtrList>
39 51
40#include <kapplication.h> 52#include <kapplication.h>
41#include <KDGanttMinimizeSplitter.h> 53#include <KDGanttMinimizeSplitter.h>
42#include <kdebug.h> 54#include <kdebug.h>
43#include <kstandarddirs.h> 55#include <kstandarddirs.h>
44#include <kiconloader.h> 56#include <kiconloader.h>
45#include <klocale.h> 57#include <klocale.h>
46#include <kconfig.h> 58#include <kconfig.h>
47#include <kglobal.h> 59#include <kglobal.h>
48#include "calendarview.h" 60#include "calendarview.h"
49#include "koviewmanager.h" 61#include "koviewmanager.h"
50 62
51#include <libkcal/calendar.h> 63#include <libkcal/calendar.h>
52#include <libkcal/icaldrag.h> 64#include <libkcal/icaldrag.h>
53#include <libkcal/dndfactory.h> 65#include <libkcal/dndfactory.h>
54 66
@@ -65,50 +77,50 @@
65#include "calprinter.h" 77#include "calprinter.h"
66#endif 78#endif
67 79
68#include "koagendaview.h" 80#include "koagendaview.h"
69//#include "koagendaview.moc" 81//#include "koagendaview.moc"
70 82
71//extern bool globalFlagBlockPainting; 83//extern bool globalFlagBlockPainting;
72extern int globalFlagBlockAgenda; 84extern int globalFlagBlockAgenda;
73extern int globalFlagBlockStartup; 85extern int globalFlagBlockStartup;
74extern int globalFlagBlockAgendaItemPaint; 86extern int globalFlagBlockAgendaItemPaint;
75extern int globalFlagBlockAgendaItemUpdate; 87extern int globalFlagBlockAgendaItemUpdate;
76extern int globalFlagBlockLabel; 88extern int globalFlagBlockLabel;
77using namespace KOrg; 89using namespace KOrg;
78 90
79#define IDLETIMEOUT 45 91#define IDLETIMEOUT 45
80 92
81TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : 93TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,Qt::WFlags f) :
82 QScrollView(parent,name,f) 94 Q3ScrollView(parent,name,f)
83{ 95{
84 myPix.resize( 1, 1 ); 96 myPix.resize( 1, 1 );
85 mRows = rows; 97 mRows = rows;
86 98
87 mRedrawNeeded = true; 99 mRedrawNeeded = true;
88 setMinimumHeight( 20 ); 100 setMinimumHeight( 20 );
89 mCellHeight = KOPrefs::instance()->mHourSize*4; 101 mCellHeight = KOPrefs::instance()->mHourSize*4;
90 102
91 enableClipper(true); 103 enableClipper(true);
92 104
93 setHScrollBarMode(AlwaysOff); 105 setHScrollBarMode(AlwaysOff);
94 setVScrollBarMode(AlwaysOff); 106 setVScrollBarMode(AlwaysOff);
95 107
96 resizeContents(50,mRows * mCellHeight); 108 resizeContents(50,mRows * mCellHeight);
97 109
98 viewport()->setBackgroundMode( PaletteBackground ); 110 viewport()->setBackgroundMode( Qt::PaletteBackground );
99} 111}
100 112
101void TimeLabels::setCellHeight(int height) 113void TimeLabels::setCellHeight(int height)
102{ 114{
103 mCellHeight = height; 115 mCellHeight = height;
104} 116}
105 117
106/* 118/*
107 Optimization so that only the "dirty" portion of the scroll view 119 Optimization so that only the "dirty" portion of the scroll view
108 is redrawn. Unfortunately, this is not called by default paintEvent() method. 120 is redrawn. Unfortunately, this is not called by default paintEvent() method.
109*/ 121*/
110void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) 122void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
111{ 123{
112 124
113 cx = contentsX() + frameWidth()*2; 125 cx = contentsX() + frameWidth()*2;
114 cw = contentsWidth() ; 126 cw = contentsWidth() ;
@@ -270,33 +282,33 @@ void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e )
270} 282}
271 283
272/** This is called in response to repaint() */ 284/** This is called in response to repaint() */
273void TimeLabels::paintEvent(QPaintEvent*) 285void TimeLabels::paintEvent(QPaintEvent*)
274{ 286{
275 287
276 // kdDebug() << "paintevent..." << endl; 288 // kdDebug() << "paintevent..." << endl;
277 // this is another hack! 289 // this is another hack!
278 // QPainter painter(this); 290 // QPainter painter(this);
279 //QString c 291 //QString c
280 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); 292 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight());
281} 293}
282 294
283//////////////////////////////////////////////////////////////////////////// 295////////////////////////////////////////////////////////////////////////////
284 296
285EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) 297EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name)
286 : QFrame(parent,name) 298 : Q3Frame(parent,name)
287{ 299{
288 mColumns = 1; 300 mColumns = 1;
289 mTopBox = 0; 301 mTopBox = 0;
290 mLocation = loc; 302 mLocation = loc;
291 mTopLayout = 0; 303 mTopLayout = 0;
292 mPaintWidget = 0; 304 mPaintWidget = 0;
293 mXOffset = 0; 305 mXOffset = 0;
294 if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); 306 if (mLocation == Top) mPixmap = SmallIcon("1uparrow");
295 else mPixmap = SmallIcon("1downarrow"); 307 else mPixmap = SmallIcon("1downarrow");
296 mEnabled.resize(mColumns); 308 mEnabled.resize(mColumns);
297 mEnabled.fill( false ); 309 mEnabled.fill( false );
298 setMinimumHeight(mPixmap.height()); 310 setMinimumHeight(mPixmap.height());
299} 311}
300 312
301EventIndicator::~EventIndicator() 313EventIndicator::~EventIndicator()
302{ 314{
@@ -380,105 +392,105 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
380 flag_blockfillAgenda = false; 392 flag_blockfillAgenda = false;
381 mBlockUpdating = true; 393 mBlockUpdating = true;
382 mStartHour = 8; 394 mStartHour = 8;
383 mSelectedDates.append(QDate::currentDate()); 395 mSelectedDates.append(QDate::currentDate());
384 396
385 mLayoutDayLabels = 0; 397 mLayoutDayLabels = 0;
386 mDayLabelsFrame = 0; 398 mDayLabelsFrame = 0;
387 mDayLabels = 0; 399 mDayLabels = 0;
388 bool isRTL = KOGlobals::self()->reverseLayout(); 400 bool isRTL = KOGlobals::self()->reverseLayout();
389 QPixmap expandPix; 401 QPixmap expandPix;
390 if ( KOPrefs::instance()->mVerticalScreen ) { 402 if ( KOPrefs::instance()->mVerticalScreen ) {
391 expandPix = SmallIcon( "1updownarrow" ); 403 expandPix = SmallIcon( "1updownarrow" );
392 } else { 404 } else {
393 expandPix = SmallIcon("1leftrightarrow" ); 405 expandPix = SmallIcon("1leftrightarrow" );
394 } 406 }
395 407
396 QBoxLayout *topLayout = new QVBoxLayout(this); 408 Q3BoxLayout *topLayout = new Q3VBoxLayout(this);
397 409
398 // Create day name labels for agenda columns 410 // Create day name labels for agenda columns
399 // Create agenda splitter 411 // Create agenda splitter
400 412
401 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); 413 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this);
402 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 414 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
403 topLayout->addWidget( mSplitterAgenda ); 415 topLayout->addWidget( mSplitterAgenda );
404 mAllDayFrame = new QHBox(mSplitterAgenda); 416 mAllDayFrame = new Q3HBox(mSplitterAgenda);
405 mAllDayFrame->setFocusPolicy(NoFocus); 417 mAllDayFrame->setFocusPolicy(Qt::NoFocus);
406 QWidget *agendaFrame = new QWidget(mSplitterAgenda); 418 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
407 agendaFrame->setFocusPolicy(NoFocus); 419 agendaFrame->setFocusPolicy(Qt::NoFocus);
408 420
409 // Create all-day agenda widget 421 // Create all-day agenda widget
410 mDummyAllDayLeft = new QVBox( mAllDayFrame ); 422 mDummyAllDayLeft = new Q3VBox( mAllDayFrame );
411 423
412 mExpandButton = new QPushButton(mDummyAllDayLeft); 424 mExpandButton = new QPushButton(mDummyAllDayLeft);
413 mExpandButton->setPixmap( expandPix ); 425 mExpandButton->setPixmap( expandPix );
414 int widebut = mExpandButton->sizeHint().width()+4; 426 int widebut = mExpandButton->sizeHint().width()+4;
415 int heibut = mExpandButton->sizeHint().height()+4; 427 int heibut = mExpandButton->sizeHint().height()+4;
416 if ( heibut > widebut ) 428 if ( heibut > widebut )
417 widebut = heibut ; 429 widebut = heibut ;
418 430
419 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, 431 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
420 // QSizePolicy::Fixed ) ); 432 // QSizePolicy::Fixed ) );
421 mExpandButton->setFixedSize( widebut, widebut); 433 mExpandButton->setFixedSize( widebut, widebut);
422 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); 434 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
423 mExpandButton->setFocusPolicy(NoFocus); 435 mExpandButton->setFocusPolicy(Qt::NoFocus);
424 mAllDayAgenda = new KOAgenda(1,mAllDayFrame); 436 mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
425 mAllDayAgenda->setFocusPolicy(NoFocus); 437 mAllDayAgenda->setFocusPolicy(Qt::NoFocus);
426 QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); 438 QLabel *dummyAllDayRight = new QLabel (mAllDayFrame);
427 439
428 // Create event context menu for all day agenda 440 // Create event context menu for all day agenda
429 //mAllDayAgendaPopup = eventPopup(); 441 //mAllDayAgendaPopup = eventPopup();
430 442
431 // Create agenda frame 443 // Create agenda frame
432 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); 444 Q3GridLayout *agendaLayout = new Q3GridLayout(agendaFrame,4,3);
433 // QHBox *agendaFrame = new QHBox(splitterAgenda); 445 // QHBox *agendaFrame = new QHBox(splitterAgenda);
434 446
435 // create event indicator bars 447 // create event indicator bars
436 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); 448 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame);
437#ifndef DESKTOP_VERSION 449#ifndef DESKTOP_VERSION
438 mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); 450 mEventIndicatorTop->setPaintWidget( mSplitterAgenda );
439#endif 451#endif
440 mDayLabelsFrame = new QHBox(agendaFrame); 452 mDayLabelsFrame = new Q3HBox(agendaFrame);
441 //topLayout->addWidget(mDayLabelsFrame); 453 //topLayout->addWidget(mDayLabelsFrame);
442 mDayLabels = new QFrame (mDayLabelsFrame); 454 mDayLabels = new Q3Frame (mDayLabelsFrame);
443 mLayoutDayLabels = new QHBoxLayout(mDayLabels); 455 mLayoutDayLabels = new Q3HBoxLayout(mDayLabels);
444 agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); 456 agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2);
445 agendaLayout->addWidget(mEventIndicatorTop,1,1); 457 agendaLayout->addWidget(mEventIndicatorTop,1,1);
446 458
447 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, 459 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom,
448 agendaFrame); 460 agendaFrame);
449 agendaLayout->addWidget(mEventIndicatorBottom,3,1); 461 agendaLayout->addWidget(mEventIndicatorBottom,3,1);
450 QWidget *dummyAgendaRight = new QWidget(agendaFrame); 462 QWidget *dummyAgendaRight = new QWidget(agendaFrame);
451 agendaLayout->addWidget(dummyAgendaRight,1,2); 463 agendaLayout->addWidget(dummyAgendaRight,1,2);
452 464
453 // Create time labels 465 // Create time labels
454 mTimeLabels = new TimeLabels(24,agendaFrame); 466 mTimeLabels = new TimeLabels(24,agendaFrame);
455 agendaLayout->addWidget(mTimeLabels,2,0); 467 agendaLayout->addWidget(mTimeLabels,2,0);
456 connect(mTimeLabels,SIGNAL( scaleChanged()), 468 connect(mTimeLabels,SIGNAL( scaleChanged()),
457 this,SLOT(updateConfig())); 469 this,SLOT(updateConfig()));
458 470
459 // Create agenda 471 // Create agenda
460 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); 472 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame);
461 agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); 473 agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2);
462 agendaLayout->setColStretch(1,1); 474 agendaLayout->setColStretch(1,1);
463 mAgenda->setFocusPolicy(NoFocus); 475 mAgenda->setFocusPolicy(Qt::NoFocus);
464 // Create event context menu for agenda 476 // Create event context menu for agenda
465 mAllAgendaPopup = eventPopup(); 477 mAllAgendaPopup = eventPopup();
466 478
467#if 0 479#if 0
468 mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), 480 mAllAgendaPopup->addAdditionalItem(QIcon(SmallIcon("bell")),
469 i18n("Toggle Alarm"),mAgenda, 481 i18n("Toggle Alarm"),mAgenda,
470 SLOT(popupAlarm()),true); 482 SLOT(popupAlarm()),true);
471 483
472#endif 484#endif
473 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 485 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
474 mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 486 mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
475 487
476 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 488 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
477 mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 489 mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
478 490
479 connect(mAllAgendaPopup,SIGNAL(categoryChanged(Incidence *)), 491 connect(mAllAgendaPopup,SIGNAL(categoryChanged(Incidence *)),
480 this,SLOT(categoryChanged(Incidence *))); 492 this,SLOT(categoryChanged(Incidence *)));
481 493
482 494
483 mAgenda->setPopup( mAllAgendaPopup ); 495 mAgenda->setPopup( mAllAgendaPopup );
484 mAllDayAgenda->setPopup( mAllAgendaPopup ); 496 mAllDayAgenda->setPopup( mAllAgendaPopup );
@@ -905,35 +917,35 @@ void KOAgendaView::createDayLabels()
905 } 917 }
906 918
907 mDayLabelsFrame->setFixedHeight( newHight + 4 ); 919 mDayLabelsFrame->setFixedHeight( newHight + 4 );
908} 920}
909 921
910int KOAgendaView::maxDatesHint() 922int KOAgendaView::maxDatesHint()
911{ 923{
912 // Not sure about the max number of events, so return 0 for now. 924 // Not sure about the max number of events, so return 0 for now.
913 return 0; 925 return 0;
914} 926}
915 927
916int KOAgendaView::currentDateCount() 928int KOAgendaView::currentDateCount()
917{ 929{
918 return mSelectedDates.count(); 930 return mSelectedDates.count();
919} 931}
920 932
921QPtrList<Incidence> KOAgendaView::selectedIncidences() 933Q3PtrList<Incidence> KOAgendaView::selectedIncidences()
922{ 934{
923 QPtrList<Incidence> selected; 935 Q3PtrList<Incidence> selected;
924 Incidence *incidence; 936 Incidence *incidence;
925 937
926 incidence = mAgenda->selectedIncidence(); 938 incidence = mAgenda->selectedIncidence();
927 if (incidence) selected.append(incidence); 939 if (incidence) selected.append(incidence);
928 940
929 incidence = mAllDayAgenda->selectedIncidence(); 941 incidence = mAllDayAgenda->selectedIncidence();
930 if (incidence) selected.append(incidence); 942 if (incidence) selected.append(incidence);
931 943
932 return selected; 944 return selected;
933} 945}
934 946
935DateList KOAgendaView::selectedDates() 947DateList KOAgendaView::selectedDates()
936{ 948{
937 DateList selected; 949 DateList selected;
938 QDate qd; 950 QDate qd;
939 951
@@ -974,34 +986,34 @@ void KOAgendaView::updateConfig()
974 986
975 // update config for children 987 // update config for children
976 mTimeLabels->updateConfig(); 988 mTimeLabels->updateConfig();
977 mAgenda->storePosition(); 989 mAgenda->storePosition();
978 mAgenda->updateConfig(); 990 mAgenda->updateConfig();
979 mAllDayAgenda->updateConfig(); 991 mAllDayAgenda->updateConfig();
980 // widget synchronization 992 // widget synchronization
981 //TODO: find a better way, maybe signal/slot 993 //TODO: find a better way, maybe signal/slot
982 mTimeLabels->positionChanged(); 994 mTimeLabels->positionChanged();
983 995
984 // for some reason, this needs to be called explicitly 996 // for some reason, this needs to be called explicitly
985 mTimeLabels->repaint(); 997 mTimeLabels->repaint();
986 998
987 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 999 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
988 1000
989 // ToolTips displaying summary of events 1001 // ToolTips displaying summary of events
990 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() 1002 /* TODO:hacker: KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance()
991 ->mEnableToolTips); 1003 ->mEnableToolTips); */
992 1004
993 //setHolidayMasks(); 1005 //setHolidayMasks();
994 1006
995 //createDayLabels(); called by via updateView(); 1007 //createDayLabels(); called by via updateView();
996 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); 1008 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth());
997 updateView(); 1009 updateView();
998 mAgenda->restorePosition(); 1010 mAgenda->restorePosition();
999} 1011}
1000 1012
1001 1013
1002void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) 1014void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
1003{ 1015{
1004 1016
1005 1017
1006 int xxx = item->cellX(); 1018 int xxx = item->cellX();
1007 //qDebug("KOAgendaView::updateEventDates %d %d %d %d %d", xxx, mMinY.at(xxx),mMaxY.at(xxx),item->cellYTop(),item->cellYBottom() ); 1019 //qDebug("KOAgendaView::updateEventDates %d %d %d %d %d", xxx, mMinY.at(xxx),mMaxY.at(xxx),item->cellYTop(),item->cellYBottom() );
@@ -1104,33 +1116,33 @@ void KOAgendaView::showDates( const QDate &start, const QDate &end )
1104{ 1116{
1105 // kdDebug() << "KOAgendaView::selectDates" << endl; 1117 // kdDebug() << "KOAgendaView::selectDates" << endl;
1106 1118
1107 mSelectedDates.clear(); 1119 mSelectedDates.clear();
1108 // qDebug("KOAgendaView::showDates "); 1120 // qDebug("KOAgendaView::showDates ");
1109 QDate d = start; 1121 QDate d = start;
1110 while (d <= end) { 1122 while (d <= end) {
1111 mSelectedDates.append(d); 1123 mSelectedDates.append(d);
1112 d = d.addDays( 1 ); 1124 d = d.addDays( 1 );
1113 } 1125 }
1114 1126
1115 // and update the view 1127 // and update the view
1116 fillAgenda(); 1128 fillAgenda();
1117} 1129}
1118 1130
1119 1131
1120void KOAgendaView::showEvents(QPtrList<Event>) 1132void KOAgendaView::showEvents(Q3PtrList<Event>)
1121{ 1133{
1122 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; 1134 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl;
1123} 1135}
1124 1136
1125void KOAgendaView::changeEventDisplay(Event *, int) 1137void KOAgendaView::changeEventDisplay(Event *, int)
1126{ 1138{
1127 // qDebug("KOAgendaView::changeEventDisplay "); 1139 // qDebug("KOAgendaView::changeEventDisplay ");
1128 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; 1140 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl;
1129 // this should be re-written to be MUCH smarter. Right now we 1141 // this should be re-written to be MUCH smarter. Right now we
1130 // are just playing dumb. 1142 // are just playing dumb.
1131 fillAgenda(); 1143 fillAgenda();
1132} 1144}
1133 1145
1134void KOAgendaView::fillAgenda(const QDate &) 1146void KOAgendaView::fillAgenda(const QDate &)
1135{ 1147{
1136 // qDebug("KOAgendaView::fillAgenda "); 1148 // qDebug("KOAgendaView::fillAgenda ");
@@ -1152,37 +1164,37 @@ void KOAgendaView::fillAgenda()
1152 if ( globalFlagBlockAgenda == 0 ) 1164 if ( globalFlagBlockAgenda == 0 )
1153 globalFlagBlockAgenda = 1; 1165 globalFlagBlockAgenda = 1;
1154 // clearView(); 1166 // clearView();
1155 //qDebug("fillAgenda()++++ "); 1167 //qDebug("fillAgenda()++++ ");
1156 globalFlagBlockAgendaItemPaint = 1; 1168 globalFlagBlockAgendaItemPaint = 1;
1157 1169
1158 mAllDayAgenda->changeColumns(mSelectedDates.count()); 1170 mAllDayAgenda->changeColumns(mSelectedDates.count());
1159 mAgenda->changeColumns(mSelectedDates.count()); 1171 mAgenda->changeColumns(mSelectedDates.count());
1160 qApp->processEvents(); 1172 qApp->processEvents();
1161 mEventIndicatorTop->changeColumns(mSelectedDates.count()); 1173 mEventIndicatorTop->changeColumns(mSelectedDates.count());
1162 mEventIndicatorBottom->changeColumns(mSelectedDates.count()); 1174 mEventIndicatorBottom->changeColumns(mSelectedDates.count());
1163 setHolidayMasks(); 1175 setHolidayMasks();
1164 1176
1165 mMinY.resize(mSelectedDates.count()); 1177 mMinY.resize(mSelectedDates.count());
1166 mMaxY.resize(mSelectedDates.count()); 1178 mMaxY.resize(mSelectedDates.count());
1167 1179
1168 QPtrList<Event> dayEvents; 1180 Q3PtrList<Event> dayEvents;
1169 1181
1170 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1182 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1171 // Therefore, gtodoset all of them. 1183 // Therefore, gtodoset all of them.
1172 QPtrList<Todo> todos = calendar()->todos(); 1184 Q3PtrList<Todo> todos = calendar()->todos();
1173 1185
1174 mAgenda->setDateList(mSelectedDates); 1186 mAgenda->setDateList(mSelectedDates);
1175 1187
1176 QDate today = QDate::currentDate(); 1188 QDate today = QDate::currentDate();
1177 1189
1178 DateList::ConstIterator dit; 1190 DateList::ConstIterator dit;
1179 int curCol = 0; 1191 int curCol = 0;
1180 int maxCol = mSelectedDates.count()-1; 1192 int maxCol = mSelectedDates.count()-1;
1181 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { 1193 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
1182 QDate currentDate = *dit; 1194 QDate currentDate = *dit;
1183 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() 1195 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString()
1184 // << endl; 1196 // << endl;
1185 1197
1186 dayEvents = calendar()->events(currentDate,false); 1198 dayEvents = calendar()->events(currentDate,false);
1187 1199
1188 // Default values, which can never be reached 1200 // Default values, which can never be reached
@@ -1287,33 +1299,33 @@ void KOAgendaView::fillAgenda()
1287 if (endY < startY) endY = startY; 1299 if (endY < startY) endY = startY;
1288 mAgenda->insertItem(event,currentDate,curCol,startY,endY); 1300 mAgenda->insertItem(event,currentDate,curCol,startY,endY);
1289 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1301 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1290 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1302 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1291 } 1303 }
1292 } 1304 }
1293 // ---------- [display Todos -------------- 1305 // ---------- [display Todos --------------
1294 unsigned int numTodo; 1306 unsigned int numTodo;
1295 for (numTodo = 0; numTodo < todos.count(); ++numTodo) { 1307 for (numTodo = 0; numTodo < todos.count(); ++numTodo) {
1296 Todo *todo = todos.at(numTodo); 1308 Todo *todo = todos.at(numTodo);
1297 1309
1298 if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date 1310 if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date
1299 if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) continue; 1311 if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) continue;
1300 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1312 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1301 // Already completed items can be displayed on their original due date 1313 // Already completed items can be displayed on their original due date
1302 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda 1314 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda
1303 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; 1315 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < (QDateTime)today) && KOPrefs::instance()->mShowTodoInAgenda;
1304 bool fillIn = false; 1316 bool fillIn = false;
1305 if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) 1317 if ( todo->hasCompletedDate() && todo->completed().date() == currentDate )
1306 fillIn = true; 1318 fillIn = true;
1307 if ( ! fillIn && !todo->hasCompletedDate() ) 1319 if ( ! fillIn && !todo->hasCompletedDate() )
1308 fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); 1320 fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue);
1309 if ( fillIn ) { 1321 if ( fillIn ) {
1310 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue 1322 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue
1311 if ( KOPrefs::instance()->mShowTodoInAgenda ) 1323 if ( KOPrefs::instance()->mShowTodoInAgenda )
1312 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); 1324 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol);
1313 } 1325 }
1314 else { 1326 else {
1315 QDateTime dt; 1327 QDateTime dt;
1316 if ( todo->hasCompletedDate() ) 1328 if ( todo->hasCompletedDate() )
1317 dt = todo->completed(); 1329 dt = todo->completed();
1318 else 1330 else
1319 dt = todo->dtDue();; 1331 dt = todo->dtDue();;
@@ -1490,71 +1502,71 @@ void KOAgendaView::startDrag(Event *event)
1490 } 1502 }
1491#endif 1503#endif
1492} 1504}
1493 1505
1494void KOAgendaView::readSettings() 1506void KOAgendaView::readSettings()
1495{ 1507{
1496 readSettings(KOGlobals::config()); 1508 readSettings(KOGlobals::config());
1497} 1509}
1498 1510
1499void KOAgendaView::readSettings(KConfig *config) 1511void KOAgendaView::readSettings(KConfig *config)
1500{ 1512{
1501 // kdDebug() << "KOAgendaView::readSettings()" << endl; 1513 // kdDebug() << "KOAgendaView::readSettings()" << endl;
1502 1514
1503 config->setGroup("Views"); 1515 config->setGroup("Views");
1504 1516
1505 //#ifndef KORG_NOSPLITTER 1517 //#ifndef KORG_NOSPLITTER
1506 QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); 1518 Q3ValueList<int> sizes = config->readIntListEntry("Separator AgendaView");
1507 if (sizes.count() == 2) { 1519 if (sizes.count() == 2) {
1508 if ( sizes[0] < 20 ) { 1520 if ( sizes[0] < 20 ) {
1509 sizes[1] = sizes[1] +20 - sizes[0]; 1521 sizes[1] = sizes[1] +20 - sizes[0];
1510 sizes[0] = 20; 1522 sizes[0] = 20;
1511 } 1523 }
1512 mSplitterAgenda->setSizes(sizes); 1524 mSplitterAgenda->setSizes(sizes);
1513 // qDebug("read %d %d ",sizes[0],sizes[1] ); 1525 // qDebug("read %d %d ",sizes[0],sizes[1] );
1514 } 1526 }
1515 //#endif 1527 //#endif
1516 1528
1517 // updateConfig(); 1529 // updateConfig();
1518} 1530}
1519 1531
1520void KOAgendaView::writeSettings(KConfig *config) 1532void KOAgendaView::writeSettings(KConfig *config)
1521{ 1533{
1522 // kdDebug() << "KOAgendaView::writeSettings()" << endl; 1534 // kdDebug() << "KOAgendaView::writeSettings()" << endl;
1523 1535
1524 config->setGroup("Views"); 1536 config->setGroup("Views");
1525 1537
1526 //#ifndef KORG_NOSPLITTER 1538 //#ifndef KORG_NOSPLITTER
1527 QValueList<int> list = mSplitterAgenda->sizes(); 1539 Q3ValueList<int> list = mSplitterAgenda->sizes();
1528 config->writeEntry("Separator AgendaView",list); 1540 config->writeEntry("Separator AgendaView",list);
1529 //qDebug("write %d %d ", list[0],list[1] ); 1541 //qDebug("write %d %d ", list[0],list[1] );
1530 //#endif 1542 //#endif
1531} 1543}
1532 1544
1533void KOAgendaView::setHolidayMasks() 1545void KOAgendaView::setHolidayMasks()
1534{ 1546{
1535 mHolidayMask.resize(mSelectedDates.count()); 1547 mHolidayMask.resize(mSelectedDates.count());
1536 1548
1537 uint i; 1549 uint i;
1538 for(i=0;i<mSelectedDates.count();++i) { 1550 for(i=0;i<mSelectedDates.count();++i) {
1539 QDate date = mSelectedDates[i]; 1551 QDate date = mSelectedDates[i];
1540 bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); 1552 bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6);
1541 bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); 1553 bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7);
1542 bool showHoliday = false; 1554 bool showHoliday = false;
1543 if ( KOPrefs::instance()->mExcludeHolidays ) { 1555 if ( KOPrefs::instance()->mExcludeHolidays ) {
1544 QPtrList<Event> events = calendar()->events( date, true ); 1556 Q3PtrList<Event> events = calendar()->events( date, true );
1545 Event *event; 1557 Event *event;
1546 for( event = events.first(); event; event = events.next() ) { 1558 for( event = events.first(); event; event = events.next() ) {
1547 if ( event->isHoliday()) { 1559 if ( event->isHoliday()) {
1548 showHoliday = true; 1560 showHoliday = true;
1549 break; 1561 break;
1550 } 1562 }
1551 } 1563 }
1552 1564
1553 } 1565 }
1554 1566
1555#ifndef KORG_NOPLUGINS 1567#ifndef KORG_NOPLUGINS
1556 bool showHoliday = KOPrefs::instance()->mExcludeHolidays && 1568 bool showHoliday = KOPrefs::instance()->mExcludeHolidays &&
1557 !KOCore::self()->holiday(date).isEmpty(); 1569 !KOCore::self()->holiday(date).isEmpty();
1558#endif 1570#endif
1559 bool showDay = showSaturday || showSunday || showHoliday; 1571 bool showDay = showSaturday || showSunday || showHoliday;
1560 1572
@@ -1650,33 +1662,33 @@ void KOAgendaView::setInitStartHour()
1650void KOAgendaView::updateTodo( Todo * t, int ) 1662void KOAgendaView::updateTodo( Todo * t, int )
1651{ 1663{
1652 if ( !isVisible() ) 1664 if ( !isVisible() )
1653 return; 1665 return;
1654 bool remove = false; 1666 bool remove = false;
1655 bool removeAD = false; 1667 bool removeAD = false;
1656 QDate da; 1668 QDate da;
1657 if ( t->hasCompletedDate() ) 1669 if ( t->hasCompletedDate() )
1658 da = t->completed().date(); 1670 da = t->completed().date();
1659 else 1671 else
1660 da = t->dtDue().date(); 1672 da = t->dtDue().date();
1661 if ( ! t->hasDueDate() && !t->hasCompletedDate() ) { 1673 if ( ! t->hasDueDate() && !t->hasCompletedDate() ) {
1662 remove = true; 1674 remove = true;
1663 removeAD = true; 1675 removeAD = true;
1664 } 1676 }
1665 else { 1677 else {
1666 bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; 1678 bool overdue = (!t->isCompleted()) && (t->dtDue() < (QDateTime)QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ;
1667 if ( overdue && 1679 if ( overdue &&
1668 QDate::currentDate() >= mSelectedDates.first() && 1680 QDate::currentDate() >= mSelectedDates.first() &&
1669 QDate::currentDate() <= mSelectedDates.last()) { 1681 QDate::currentDate() <= mSelectedDates.last()) {
1670 removeAD = false; 1682 removeAD = false;
1671 remove = true; 1683 remove = true;
1672 } 1684 }
1673 else { 1685 else {
1674 1686
1675 if ( da < mSelectedDates.first() || 1687 if ( da < mSelectedDates.first() ||
1676 da > mSelectedDates.last() ) { 1688 da > mSelectedDates.last() ) {
1677 remove = true; 1689 remove = true;
1678 removeAD = true; 1690 removeAD = true;
1679 } else { 1691 } else {
1680 remove = t->doesFloat() && !t->hasCompletedDate(); 1692 remove = t->doesFloat() && !t->hasCompletedDate();
1681 removeAD = !remove; 1693 removeAD = !remove;
1682 } 1694 }
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 5e68146..3b871d9 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -10,83 +10,93 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOAGENDAVIEW_H 23#ifndef KOAGENDAVIEW_H
24#define KOAGENDAVIEW_H 24#define KOAGENDAVIEW_H
25 25
26#include <qscrollview.h> 26#include <q3scrollview.h>
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <Q3BoxLayout>
30#ifndef DESKTOP_VERSION 31#ifndef DESKTOP_VERSION
31#include <qksplitter.h> 32#include <qksplitter.h>
32#else 33#else
33#include <qsplitter.h> 34#include <qsplitter.h>
34#endif 35#endif
35#include <qmemarray.h> 36#include <q3memarray.h>
37//Added by qt3to4:
38#include <QPaintEvent>
39#include <QResizeEvent>
40#include <Q3Frame>
41#include <QPixmap>
42#include <QLabel>
43#include <QMouseEvent>
44#include <Q3PtrList>
45#include <QKeyEvent>
36 46
37#include "koeventview.h" 47#include "koeventview.h"
38 48
39class QHBox; 49class Q3HBox;
40class QFrame; 50class Q3Frame;
41class QLabel; 51class QLabel;
42class QPushButton; 52class QPushButton;
43class CalendarView; 53class CalendarView;
44class KOAgenda; 54class KOAgenda;
45class KOAgendaItem; 55class KOAgendaItem;
46class KConfig; 56class KConfig;
47class KDGanttMinimizeSplitter; 57class KDGanttMinimizeSplitter;
48 58
49class KOAgendaButton : public QPushButton 59class KOAgendaButton : public QPushButton
50{ 60{
51 Q_OBJECT 61 Q_OBJECT
52 public: 62 public:
53 KOAgendaButton( QWidget *parent=0, const char *name=0 ) : 63 KOAgendaButton( QWidget *parent=0, const char *name=0 ) :
54 QPushButton( parent, name ) 64 QPushButton( parent, name )
55 { 65 {
56 mNum = -3; 66 mNum = -3;
57 setFlat( true ); 67 setFlat( true );
58 setFocusPolicy(NoFocus); 68 setFocusPolicy(Qt::NoFocus);
59 setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); 69 setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding ));
60 connect( this, SIGNAL( clicked() ), this, SLOT ( bClicked() ) ); 70 connect( this, SIGNAL( clicked() ), this, SLOT ( bClicked() ) );
61 }; 71 };
62 72
63 QSize sizeHint () const { return QSize( 5,5) ;} 73 QSize sizeHint () const { return QSize( 5,5) ;}
64 void setNum( int n) { mNum = n; } 74 void setNum( int n) { mNum = n; }
65private slots: 75private slots:
66 void bClicked() {emit numClicked( mNum);} 76 void bClicked() {emit numClicked( mNum);}
67signals: 77signals:
68 void numClicked( int ); 78 void numClicked( int );
69private: 79private:
70 int mNum; 80 int mNum;
71}; 81};
72 82
73class TimeLabels : public QScrollView { 83class TimeLabels : public Q3ScrollView {
74 Q_OBJECT 84 Q_OBJECT
75 public: 85 public:
76 TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0); 86 TimeLabels(int rows,QWidget *parent=0,const char *name=0,Qt::WFlags f=0);
77 87
78 void setCellHeight(int height); 88 void setCellHeight(int height);
79 89
80 /** Calculates the minimum width */ 90 /** Calculates the minimum width */
81 virtual int minimumWidth() const; 91 virtual int minimumWidth() const;
82 92
83 /** updates widget's internal state */ 93 /** updates widget's internal state */
84 void updateConfig(); 94 void updateConfig();
85 95
86 /** */ 96 /** */
87 void setAgenda(KOAgenda* agenda); 97 void setAgenda(KOAgenda* agenda);
88 98
89 /** */ 99 /** */
90 virtual void paintEvent(QPaintEvent* e); 100 virtual void paintEvent(QPaintEvent* e);
91 void contentsMousePressEvent ( QMouseEvent * ) ; 101 void contentsMousePressEvent ( QMouseEvent * ) ;
92 void contentsMouseReleaseEvent ( QMouseEvent * ); 102 void contentsMouseReleaseEvent ( QMouseEvent * );
@@ -100,105 +110,105 @@ class TimeLabels : public QScrollView {
100 protected: 110 protected:
101 void drawContents(QPainter *p,int cx, int cy, int cw, int ch); 111 void drawContents(QPainter *p,int cx, int cy, int cw, int ch);
102 112
103 private: 113 private:
104 QPixmap myPix; 114 QPixmap myPix;
105 bool mRedrawNeeded; 115 bool mRedrawNeeded;
106 int mMiniWidth; 116 int mMiniWidth;
107 int mMouseDownY; 117 int mMouseDownY;
108 QString mOrgCap; 118 QString mOrgCap;
109 int mRows; 119 int mRows;
110 int mCellHeight; 120 int mCellHeight;
111 121
112 /** */ 122 /** */
113 KOAgenda* mAgenda; 123 KOAgenda* mAgenda;
114}; 124};
115 125
116class EventIndicator : public QFrame { 126class EventIndicator : public Q3Frame {
117 Q_OBJECT 127 Q_OBJECT
118 public: 128 public:
119 enum Location { Top, Bottom }; 129 enum Location { Top, Bottom };
120 EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); 130 EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0);
121 virtual ~EventIndicator(); 131 virtual ~EventIndicator();
122 132
123 void changeColumns(int columns); 133 void changeColumns(int columns);
124 void setPaintWidget( KDGanttMinimizeSplitter* ); 134 void setPaintWidget( KDGanttMinimizeSplitter* );
125 void setXOffset( int ); 135 void setXOffset( int );
126 void enableColumn(int column, bool enable); 136 void enableColumn(int column, bool enable);
127 137
128 protected: 138 protected:
129 void drawContents(QPainter *); 139 void drawContents(QPainter *);
130 140
131 private: 141 private:
132 int mXOffset; 142 int mXOffset;
133 KDGanttMinimizeSplitter* mPaintWidget; 143 KDGanttMinimizeSplitter* mPaintWidget;
134 int mColumns; 144 int mColumns;
135 QHBox *mTopBox; 145 Q3HBox *mTopBox;
136 QBoxLayout *mTopLayout; 146 Q3BoxLayout *mTopLayout;
137 Location mLocation; 147 Location mLocation;
138 QPixmap mPixmap; 148 QPixmap mPixmap;
139 QMemArray<bool> mEnabled; 149 Q3MemArray<bool> mEnabled;
140}; 150};
141 151
142/** 152/**
143 KOAgendaView is the agenda-like view used to display events in an one or 153 KOAgendaView is the agenda-like view used to display events in an one or
144 multi-day view. 154 multi-day view.
145*/ 155*/
146class KOAgendaView : public KOEventView { 156class KOAgendaView : public KOEventView {
147 Q_OBJECT 157 Q_OBJECT
148 public: 158 public:
149 KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); 159 KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 );
150 virtual ~KOAgendaView(); 160 virtual ~KOAgendaView();
151 void setStartHour( int ); 161 void setStartHour( int );
152 void toggleAllDay(); 162 void toggleAllDay();
153 163
154 164
155 /** Returns maximum number of days supported by the koagendaview */ 165 /** Returns maximum number of days supported by the koagendaview */
156 virtual int maxDatesHint(); 166 virtual int maxDatesHint();
157 167
158 /** Returns number of currently shown dates. */ 168 /** Returns number of currently shown dates. */
159 virtual int currentDateCount(); 169 virtual int currentDateCount();
160 170
161 /** returns the currently selected events */ 171 /** returns the currently selected events */
162 virtual QPtrList<Incidence> selectedIncidences(); 172 virtual Q3PtrList<Incidence> selectedIncidences();
163 173
164 /** returns the currently selected events */ 174 /** returns the currently selected events */
165 virtual DateList selectedDates(); 175 virtual DateList selectedDates();
166 176
167 /** Remove all events from view */ 177 /** Remove all events from view */
168 void clearView(); 178 void clearView();
169 void clearList(); 179 void clearList();
170 KOAgenda *agenda() { return mAgenda;} 180 KOAgenda *agenda() { return mAgenda;}
171 virtual void printPreview(CalPrinter *calPrinter, 181 virtual void printPreview(CalPrinter *calPrinter,
172 const QDate &, const QDate &); 182 const QDate &, const QDate &);
173 183
174 /** start-datetime of selection */ 184 /** start-datetime of selection */
175 QDateTime selectionStart() {return mTimeSpanBegin;} 185 QDateTime selectionStart() {return mTimeSpanBegin;}
176 /** end-datetime of selection */ 186 /** end-datetime of selection */
177 QDateTime selectionEnd() {return mTimeSpanEnd;} 187 QDateTime selectionEnd() {return mTimeSpanEnd;}
178 /** returns true if selection is for whole day */ 188 /** returns true if selection is for whole day */
179 bool selectedIsAllDay() {return mTimeSpanInAllDay;} 189 bool selectedIsAllDay() {return mTimeSpanInAllDay;}
180 /** make selected start/end invalid */ 190 /** make selected start/end invalid */
181 void deleteSelectedDateTime(); 191 void deleteSelectedDateTime();
182 void repaintAgenda(); 192 void repaintAgenda();
183 public slots: 193 public slots:
184 void setInitStartHour(); 194 void setInitStartHour();
185 virtual void updateView(); 195 virtual void updateView();
186 virtual void updateConfig(); 196 virtual void updateConfig();
187 virtual void showDates(const QDate &start, const QDate &end); 197 virtual void showDates(const QDate &start, const QDate &end);
188 virtual void showEvents(QPtrList<Event> eventList); 198 virtual void showEvents(Q3PtrList<Event> eventList);
189 199
190 void updateTodo( Todo *, int ); 200 void updateTodo( Todo *, int );
191 void changeEventDisplay(Event *, int); 201 void changeEventDisplay(Event *, int);
192 202
193 void clearSelection(); 203 void clearSelection();
194 204
195 void newTodo(int gx,int gy); 205 void newTodo(int gx,int gy);
196 void newEvent(int gx,int gy); 206 void newEvent(int gx,int gy);
197 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); 207 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd);
198 void newEventAllDay(int gx, int gy); 208 void newEventAllDay(int gx, int gy);
199 void newTodoAllDay(int gx, int gy); 209 void newTodoAllDay(int gx, int gy);
200 210
201 void startDrag(Event *); 211 void startDrag(Event *);
202 212
203 void readSettings(); 213 void readSettings();
204 void readSettings(KConfig *); 214 void readSettings(KConfig *);
@@ -247,53 +257,53 @@ class KOAgendaView : public KOEventView {
247 void updateEventDates(KOAgendaItem *item, int mode = -1); 257 void updateEventDates(KOAgendaItem *item, int mode = -1);
248 //void updateMovedTodo(); 258 //void updateMovedTodo();
249 259
250 void updateEventIndicatorTop(int newY); 260 void updateEventIndicatorTop(int newY);
251 void updateEventIndicatorBottom(int newY); 261 void updateEventIndicatorBottom(int newY);
252 262
253 /** Updates data for selected timespan */ 263 /** Updates data for selected timespan */
254 void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); 264 void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd);
255 /** Updates data for selected timespan for all day event*/ 265 /** Updates data for selected timespan for all day event*/
256 void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); 266 void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd);
257 267
258 private: 268 private:
259 bool flag_blockfillAgenda; 269 bool flag_blockfillAgenda;
260 QTimer* mIdleTimer; 270 QTimer* mIdleTimer;
261 QDateTime mIdleStart; 271 QDateTime mIdleStart;
262 // view widgets 272 // view widgets
263 QFrame *mDayLabels; 273 Q3Frame *mDayLabels;
264 QHBox *mDayLabelsFrame; 274 Q3HBox *mDayLabelsFrame;
265 QBoxLayout *mLayoutDayLabels; 275 Q3BoxLayout *mLayoutDayLabels;
266 QFrame *mAllDayFrame; 276 Q3Frame *mAllDayFrame;
267 KOAgenda *mAllDayAgenda; 277 KOAgenda *mAllDayAgenda;
268 KOAgenda *mAgenda; 278 KOAgenda *mAgenda;
269 TimeLabels *mTimeLabels; 279 TimeLabels *mTimeLabels;
270 QWidget *mDummyAllDayLeft; 280 QWidget *mDummyAllDayLeft;
271 281
272 KDGanttMinimizeSplitter* mSplitterAgenda; 282 KDGanttMinimizeSplitter* mSplitterAgenda;
273 QPushButton *mExpandButton; 283 QPushButton *mExpandButton;
274 284
275 DateList mSelectedDates; // List of dates to be displayed 285 DateList mSelectedDates; // List of dates to be displayed
276 int mViewType; 286 int mViewType;
277 287
278 bool mWeekStartsMonday; 288 bool mWeekStartsMonday;
279 int mStartHour; 289 int mStartHour;
280 290
281 KOEventPopupMenu *mAllAgendaPopup; 291 KOEventPopupMenu *mAllAgendaPopup;
282 //KOEventPopupMenu *mAllDayAgendaPopup; 292 //KOEventPopupMenu *mAllDayAgendaPopup;
283 293
284 EventIndicator *mEventIndicatorTop; 294 EventIndicator *mEventIndicatorTop;
285 EventIndicator *mEventIndicatorBottom; 295 EventIndicator *mEventIndicatorBottom;
286 296
287 QMemArray<int> mMinY; 297 Q3MemArray<int> mMinY;
288 QMemArray<int> mMaxY; 298 Q3MemArray<int> mMaxY;
289 299
290 QMemArray<bool> mHolidayMask; 300 Q3MemArray<bool> mHolidayMask;
291 301
292 QPtrList<KOAgendaButton> mDayLabelsList; 302 Q3PtrList<KOAgendaButton> mDayLabelsList;
293 QDateTime mTimeSpanBegin; 303 QDateTime mTimeSpanBegin;
294 QDateTime mTimeSpanEnd; 304 QDateTime mTimeSpanEnd;
295 bool mTimeSpanInAllDay; 305 bool mTimeSpanInAllDay;
296 void keyPressEvent ( QKeyEvent * e ); 306 void keyPressEvent ( QKeyEvent * e );
297}; 307};
298 308
299#endif // KOAGENDAVIEW_H 309#endif // KOAGENDAVIEW_H
diff --git a/korganizer/kocounterdialog.h b/korganizer/kocounterdialog.h
index c8dcf45..493d9e1 100644
--- a/korganizer/kocounterdialog.h
+++ b/korganizer/kocounterdialog.h
@@ -9,33 +9,33 @@
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19#ifndef KOCOUNTERDIALOG_H 19#ifndef KOCOUNTERDIALOG_H
20#define KOCOUNTERDIALOG_H 20#define KOCOUNTERDIALOG_H
21// 21//
22// Viewer dialog for counter events. 22// Viewer dialog for counter events.
23// 23//
24 24
25#include <qtextview.h> 25#include <q3textview.h>
26 26
27#include <kdialogbase.h> 27#include <kdialogbase.h>
28 28
29#include <libkcal/event.h> 29#include <libkcal/event.h>
30 30
31using namespace KCal; 31using namespace KCal;
32 32
33class KOEventViewer; 33class KOEventViewer;
34 34
35class KOCounterDialog : public KDialogBase { 35class KOCounterDialog : public KDialogBase {
36 Q_OBJECT 36 Q_OBJECT
37 public: 37 public:
38 KOCounterDialog(QWidget *parent=0,const char *name=0); 38 KOCounterDialog(QWidget *parent=0,const char *name=0);
39 virtual ~KOCounterDialog(); 39 virtual ~KOCounterDialog();
40 40
41 void setEvent(Event *event); 41 void setEvent(Event *event);
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 52fd1e8..4f681b3 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -11,112 +11,121 @@
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source ode for Qt in the source distribution. 22 without including the source ode for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qevent.h> 25#include <qevent.h>
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qptrlist.h> 27#include <q3ptrlist.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <qwhatsthis.h> 29#include <q3whatsthis.h>
30//Added by qt3to4:
31#include <QDragLeaveEvent>
32#include <Q3Frame>
33#include <QDragEnterEvent>
34#include <QDragMoveEvent>
35#include <QDropEvent>
36#include <QResizeEvent>
37#include <QMouseEvent>
38#include <QPaintEvent>
30 39
31#include <kglobal.h> 40#include <kglobal.h>
32#include <kdebug.h> 41#include <kdebug.h>
33#include <klocale.h> 42#include <klocale.h>
34 43
35#include <libkcal/vcaldrag.h> 44#include <libkcal/vcaldrag.h>
36#include <libkcal/icaldrag.h> 45#include <libkcal/icaldrag.h>
37#include <libkcal/dndfactory.h> 46#include <libkcal/dndfactory.h>
38#include <libkcal/calendarresources.h> 47#include <libkcal/calendarresources.h>
39#include <libkcal/resourcecalendar.h> 48#include <libkcal/resourcecalendar.h>
40#include <kresources/resourceselectdialog.h> 49#include <kresources/resourceselectdialog.h>
41 50
42#include <kcalendarsystem.h> 51#include <kcalendarsystem.h>
43 52
44#ifndef KORG_NOPLUGINS 53#ifndef KORG_NOPLUGINS
45#include "kocore.h" 54#include "kocore.h"
46#endif 55#endif
47#include "koprefs.h" 56#include "koprefs.h"
48#include "koglobals.h" 57#include "koglobals.h"
49 58
50#include "kodaymatrix.h" 59#include "kodaymatrix.h"
51 60
52// ============================================================================ 61// ============================================================================
53// D Y N A M I C T I P 62// D Y N A M I C T I P
54// ============================================================================ 63// ============================================================================
55 64
56DynamicTip::DynamicTip( QWidget * parent ) 65DynamicTip::DynamicTip( QWidget * parent )
57 : QToolTip( parent ) 66 /* TODO:hacker: : QToolTip( parent ) */
58{ 67{
59 matrix = (KODayMatrix*)parent; 68 matrix = (KODayMatrix*)parent;
60} 69}
61 70
62class KODaymatrixWhatsThis :public QWhatsThis 71class KODaymatrixWhatsThis :public Q3WhatsThis
63{ 72{
64public: 73public:
65 KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;}; 74 KODaymatrixWhatsThis( KODayMatrix* view ) : Q3WhatsThis( view ),_view (view) { ;};
66 ~KODaymatrixWhatsThis() { ; }; 75 ~KODaymatrixWhatsThis() { ; };
67 76
68protected: 77protected:
69 virtual QString text( const QPoint& p ) 78 virtual QString text( const QPoint& p )
70 { 79 {
71 return _view->getWhatsThisText( p ) ; 80 return _view->getWhatsThisText( p ) ;
72 } 81 }
73private: 82private:
74 KODayMatrix * _view; 83 KODayMatrix * _view;
75}; 84};
76 85
77void DynamicTip::maybeTip( const QPoint &pos ) 86void DynamicTip::maybeTip( const QPoint &pos )
78{ 87{
79 //calculate which cell of the matrix the mouse is in 88 //calculate which cell of the matrix the mouse is in
80 QRect sz = matrix->frameRect(); 89 QRect sz = matrix->frameRect();
81 int dheight = sz.height()*7 / 42; 90 int dheight = sz.height()*7 / 42;
82 int dwidth = sz.width() / 7; 91 int dwidth = sz.width() / 7;
83 int row = pos.y()/dheight; 92 int row = pos.y()/dheight;
84 int col = pos.x()/dwidth; 93 int col = pos.x()/dwidth;
85 94
86 QRect rct(col*dwidth, row*dheight, dwidth, dheight); 95 QRect rct(col*dwidth, row*dheight, dwidth, dheight);
87 96
88// kdDebug() << "DynamicTip::maybeTip matrix cell index [" << 97// kdDebug() << "DynamicTip::maybeTip matrix cell index [" <<
89// col << "][" << row << "] => " <<(col+row*7) << endl; 98// col << "][" << row << "] => " <<(col+row*7) << endl;
90 99
91 //show holiday names only 100 //show holiday names only
92 QString str = matrix->getHolidayLabel(col+row*7); 101 QString str = matrix->getHolidayLabel(col+row*7);
93 if (str.isEmpty()) return; 102 if (str.isEmpty()) return;
94 tip(rct, str); 103 /* TODO:hacker: tip(rct, str);*/
95} 104}
96 105
97 106
98// ============================================================================ 107// ============================================================================
99// K O D A Y M A T R I X 108// K O D A Y M A T R I X
100// ============================================================================ 109// ============================================================================
101 110
102const int KODayMatrix::NOSELECTION = -1000; 111const int KODayMatrix::NOSELECTION = -1000;
103const int KODayMatrix::NUMDAYS = 42; 112const int KODayMatrix::NUMDAYS = 42;
104 113
105KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) 114KODayMatrix::KODayMatrix( QWidget *parent, const char *name )
106 : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 ) 115 : Q3Frame( parent, name , Qt::WNoAutoErase ), mCalendar( 0 )
107 116
108 117
109{ 118{
110 mLastView = -1; 119 mLastView = -1;
111 oldW = 0; 120 oldW = 0;
112 oldH = 0; 121 oldH = 0;
113 myPix.resize( 150, 120 ); 122 myPix.resize( 150, 120 );
114 mRedrawNeeded = true; 123 mRedrawNeeded = true;
115 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); 124 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this);
116 mPendingUpdateBeforeRepaint = false; 125 mPendingUpdateBeforeRepaint = false;
117 mouseDown = false; 126 mouseDown = false;
118 // initialize dynamic arrays 127 // initialize dynamic arrays
119 bDays.resize ( NUMDAYS ); 128 bDays.resize ( NUMDAYS );
120 pDays.resize ( NUMDAYS ); 129 pDays.resize ( NUMDAYS );
121 hDays.resize ( NUMDAYS ); 130 hDays.resize ( NUMDAYS );
122 eDays.resize ( NUMDAYS ); 131 eDays.resize ( NUMDAYS );
@@ -138,33 +147,33 @@ KODayMatrix::KODayMatrix( QWidget *parent, const char *name )
138 //setFont( QFont("Arial", 10) ); 147 //setFont( QFont("Arial", 10) );
139 148
140 mUpdateTimer = new QTimer( this ); 149 mUpdateTimer = new QTimer( this );
141 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); 150 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() ));
142 mRepaintTimer = new QTimer( this ); 151 mRepaintTimer = new QTimer( this );
143 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); 152 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() ));
144 mDayChanged = false; 153 mDayChanged = false;
145 updateView(); 154 updateView();
146} 155}
147QString KODayMatrix::getWhatsThisText( QPoint p ) 156QString KODayMatrix::getWhatsThisText( QPoint p )
148{ 157{
149 158
150 int tmp = getDayIndexFrom(p.x(), p.y()); 159 int tmp = getDayIndexFrom(p.x(), p.y());
151 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) 160 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar )
152 return QString(); 161 return QString();
153 QDate mDate = days[tmp]; 162 QDate mDate = days[tmp];
154 QPtrList<Event> eventlist = mCalendar->events(mDate); 163 Q3PtrList<Event> eventlist = mCalendar->events(mDate);
155 Event *event; 164 Event *event;
156 QStringList mToolTip; 165 QStringList mToolTip;
157 for(event=eventlist.first();event != 0;event=eventlist.next()) { 166 for(event=eventlist.first();event != 0;event=eventlist.next()) {
158 QString mToolTipText; 167 QString mToolTipText;
159 QString text; 168 QString text;
160 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 169 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
161 if (event->isMultiDay()) { 170 if (event->isMultiDay()) {
162 QString prefix = "<->";multiday = 2; 171 QString prefix = "<->";multiday = 2;
163 QString time; 172 QString time;
164 if ( event->doesRecur() ) { 173 if ( event->doesRecur() ) {
165 if ( event->recursOn( mDate) ) { 174 if ( event->recursOn( mDate) ) {
166 prefix ="->" ;multiday = 1; 175 prefix ="->" ;multiday = 1;
167 } 176 }
168 else { 177 else {
169 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 178 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
170 if ( event->recursOn( mDate.addDays( -days)) ) { 179 if ( event->recursOn( mDate.addDays( -days)) ) {
@@ -192,48 +201,48 @@ QString KODayMatrix::getWhatsThisText( QPoint p )
192 text = event->summary(); 201 text = event->summary();
193 mToolTipText += text; 202 mToolTipText += text;
194 } 203 }
195 else { 204 else {
196 text = KGlobal::locale()->formatTime(event->dtStart().time()); 205 text = KGlobal::locale()->formatTime(event->dtStart().time());
197 text += " " + event->summary(); 206 text += " " + event->summary();
198 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 207 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
199 } 208 }
200 } 209 }
201 if ( !event->location().isEmpty() ) 210 if ( !event->location().isEmpty() )
202 mToolTipText += " (" + event->location() + ")"; 211 mToolTipText += " (" + event->location() + ")";
203 //qDebug("TTT: %s ", mToolTipText.latin1()); 212 //qDebug("TTT: %s ", mToolTipText.latin1());
204 mToolTip.append( deTag( mToolTipText ) ); 213 mToolTip.append( deTag( mToolTipText ) );
205 } 214 }
206 mToolTip.sort(); 215 mToolTip.sort();
207 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { 216 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
208 QPtrList<Todo> todolist = mCalendar->todos(mDate); 217 Q3PtrList<Todo> todolist = mCalendar->todos(mDate);
209 Todo *todo; 218 Todo *todo;
210 for(todo=todolist.first();todo != 0;todo=todolist.next()) { 219 for(todo=todolist.first();todo != 0;todo=todolist.next()) {
211 QString mToolTipText; 220 QString mToolTipText;
212 if ( !todo->doesFloat() ) 221 if ( !todo->doesFloat() )
213 mToolTipText += KGlobal::locale()->formatTime(todo->dtDue().time())+" "; 222 mToolTipText += KGlobal::locale()->formatTime(todo->dtDue().time())+" ";
214 mToolTipText += todo->summary(); 223 mToolTipText += todo->summary();
215 if ( !todo->location().isEmpty() ) 224 if ( !todo->location().isEmpty() )
216 mToolTipText += " (" + todo->location() + ")"; 225 mToolTipText += " (" + todo->location() + ")";
217 mToolTipText = deTag( mToolTipText); 226 mToolTipText = deTag( mToolTipText);
218 mToolTipText = "<b>" + i18n("Todo: ") + "</b>"+ mToolTipText; 227 mToolTipText = "<b>" + i18n("Todo: ") + "</b>"+ mToolTipText;
219 mToolTip.append( mToolTipText ); 228 mToolTip.append( mToolTipText );
220 } 229 }
221 } 230 }
222 if (KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { 231 if (KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
223 QPtrList<Journal> j_list = mCalendar->journals4Date( mDate ); 232 Q3PtrList<Journal> j_list = mCalendar->journals4Date( mDate );
224 Journal *j = j_list.first(); 233 Journal *j = j_list.first();
225 while ( j ) { 234 while ( j ) {
226 QString mToolTipText; 235 QString mToolTipText;
227 if ( !j->summary().isEmpty() ) { 236 if ( !j->summary().isEmpty() ) {
228 mToolTipText = j->summary().left(30); 237 mToolTipText = j->summary().left(30);
229 if ( j->summary().length() > 30 ) 238 if ( j->summary().length() > 30 )
230 mToolTipText += " ..."; 239 mToolTipText += " ...";
231 } else { 240 } else {
232 mToolTipText = j->description().left(25); 241 mToolTipText = j->description().left(25);
233 if ( j->description().length() > 25 ) 242 if ( j->description().length() > 25 )
234 mToolTipText += " ..."; 243 mToolTipText += " ...";
235 mToolTipText = deTag( mToolTipText); 244 mToolTipText = deTag( mToolTipText);
236 } 245 }
237 mToolTipText = "<b>" + i18n("Journal: ") + "</b>"+ mToolTipText; 246 mToolTipText = "<b>" + i18n("Journal: ") + "</b>"+ mToolTipText;
238 mToolTip.append( mToolTipText ); 247 mToolTip.append( mToolTipText );
239 j = j_list.next(); 248 j = j_list.next();
@@ -428,33 +437,33 @@ void KODayMatrix::computeEvent(Event *event, int i )
428 } 437 }
429 if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) 438 if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW )
430 eDays.setBit(i); 439 eDays.setBit(i);
431} 440}
432void KODayMatrix::updateViewTimed() 441void KODayMatrix::updateViewTimed()
433{ 442{
434 mUpdateTimer->stop(); 443 mUpdateTimer->stop();
435 if ( !mCalendar ) { 444 if ( !mCalendar ) {
436 qDebug("NOT CAL "); 445 qDebug("NOT CAL ");
437 return; 446 return;
438 } 447 }
439#if 1 448#if 1
440 449
441 450
442 int i; 451 int i;
443 int timeSpan = NUMDAYS-1; 452 int timeSpan = NUMDAYS-1;
444 QPtrList<Event> events = mCalendar->events(); 453 Q3PtrList<Event> events = mCalendar->events();
445 Event *event; 454 Event *event;
446 QDateTime dt; 455 QDateTime dt;
447 bool ok; 456 bool ok;
448 bDays.fill( false); 457 bDays.fill( false);
449 pDays.fill( false); 458 pDays.fill( false);
450 hDays.fill( false); 459 hDays.fill( false);
451 eDays.fill( false); 460 eDays.fill( false);
452 mHolidays.clear(); 461 mHolidays.clear();
453 QDate mStartDate = days[0]; 462 QDate mStartDate = days[0];
454 QDate endDate = mStartDate.addDays( timeSpan ); 463 QDate endDate = mStartDate.addDays( timeSpan );
455 for( event = events.first(); event; event = events.next() ) { // for event 464 for( event = events.first(); event; event = events.next() ) { // for event
456 ushort recurType = event->doesRecur(); 465 ushort recurType = event->doesRecur();
457 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || 466 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
458 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { 467 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
459 continue; 468 continue;
460 } 469 }
@@ -513,82 +522,82 @@ void KODayMatrix::updateViewTimed()
513 int iii; 522 int iii;
514 for ( iii = st;iii<= end;++iii) 523 for ( iii = st;iii<= end;++iii)
515 computeEvent( event, iii ); 524 computeEvent( event, iii );
516 } 525 }
517 } 526 }
518 } 527 }
519 } 528 }
520 int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday 529 int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday
521 for(i = 0; i < NUMDAYS; i++) { 530 for(i = 0; i < NUMDAYS; i++) {
522 if ( ( (i+startDay) % 7 == 0 ) ) { 531 if ( ( (i+startDay) % 7 == 0 ) ) {
523 pDays.setBit(i); 532 pDays.setBit(i);
524 } 533 }
525 } 534 }
526 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { 535 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
527 bDays.fill( false); 536 bDays.fill( false);
528 // insert due todos 537 // insert due todos
529 QPtrList<Todo> todos = mCalendar->todos( ); 538 Q3PtrList<Todo> todos = mCalendar->todos( );
530 Todo *todo; 539 Todo *todo;
531 for(todo = todos.first(); todo; todo = todos.next()) { 540 for(todo = todos.first(); todo; todo = todos.next()) {
532 //insertTodo( todo ); 541 //insertTodo( todo );
533 if ( todo->hasDueDate() ) { 542 if ( todo->hasDueDate() ) {
534 int day = mStartDate.daysTo( todo->dtDue().date() ); 543 int day = mStartDate.daysTo( todo->dtDue().date() );
535 if ( day >= 0 && day < timeSpan + 1) { 544 if ( day >= 0 && day < timeSpan + 1) {
536 int i = day; 545 int i = day;
537 QString holiStr = mHolidays[i]; 546 QString holiStr = mHolidays[i];
538 pDays.setBit(i); 547 pDays.setBit(i);
539 if ( !holiStr.isEmpty() ) 548 if ( !holiStr.isEmpty() )
540 holiStr += "\n"; 549 holiStr += "\n";
541 holiStr += i18n("Todo") + ": "+todo->summary(); 550 holiStr += i18n("Todo") + ": "+todo->summary();
542 if ( !todo->location().isEmpty() ) 551 if ( !todo->location().isEmpty() )
543 holiStr += " (" + todo->location() + ")"; 552 holiStr += " (" + todo->location() + ")";
544 bDays.setBit(i); 553 bDays.setBit(i);
545 mHolidays[i] =holiStr ; 554 mHolidays[i] =holiStr ;
546 eDays.setBit(i); 555 eDays.setBit(i);
547 } 556 }
548 } 557 }
549 } 558 }
550 } 559 }
551 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { 560 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
552 bDays.fill( false); 561 bDays.fill( false);
553 // insert due todos 562 // insert due todos
554 QPtrList<Journal> todos = mCalendar->journals( ); 563 Q3PtrList<Journal> todos = mCalendar->journals( );
555 Journal *todo; 564 Journal *todo;
556 for(todo = todos.first(); todo; todo = todos.next()) { 565 for(todo = todos.first(); todo; todo = todos.next()) {
557 int day = mStartDate.daysTo( todo->dtStart().date() ); 566 int day = mStartDate.daysTo( todo->dtStart().date() );
558 if ( day >= 0 && day < timeSpan + 1) { 567 if ( day >= 0 && day < timeSpan + 1) {
559 int i = day; 568 int i = day;
560 QString holiStr = mHolidays[i]; 569 QString holiStr = mHolidays[i];
561 pDays.setBit(i); 570 pDays.setBit(i);
562 if ( !holiStr.isEmpty() ) 571 if ( !holiStr.isEmpty() )
563 holiStr += "\n"; 572 holiStr += "\n";
564 holiStr += i18n("Journal: ")+todo->summary().left(25); 573 holiStr += i18n("Journal: ")+todo->summary().left(25);
565 if ( todo->summary().length() > 25 ) 574 if ( todo->summary().length() > 25 )
566 holiStr +="..."; 575 holiStr +="...";
567 bDays.setBit(i); 576 bDays.setBit(i);
568 mHolidays[i] =holiStr ; 577 mHolidays[i] =holiStr ;
569 eDays.setBit(i); 578 eDays.setBit(i);
570 579
571 } 580 }
572 } 581 }
573 } 582 }
574#else 583#else
575 //qDebug("KODayMatrix::updateViewTimed "); 584 //qDebug("KODayMatrix::updateViewTimed ");
576 for(int i = 0; i < NUMDAYS; i++) { 585 for(int i = 0; i < NUMDAYS; i++) {
577 // if events are set for the day then remember to draw it bold 586 // if events are set for the day then remember to draw it bold
578 QPtrList<Event> eventlist = mCalendar->events(days[i]); 587 Q3PtrList<Event> eventlist = mCalendar->events(days[i]);
579 Event *event; 588 Event *event;
580 int numEvents = eventlist.count(); 589 int numEvents = eventlist.count();
581 QString holiStr = ""; 590 QString holiStr = "";
582 bDays.clearBit(i); 591 bDays.clearBit(i);
583 hDays.clearBit(i); 592 hDays.clearBit(i);
584 eDays.clearBit(i); 593 eDays.clearBit(i);
585 for(event=eventlist.first();event != 0;event=eventlist.next()) { 594 for(event=eventlist.first();event != 0;event=eventlist.next()) {
586 ushort recurType = event->recurrence()->doesRecur(); 595 ushort recurType = event->recurrence()->doesRecur();
587 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || 596 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
588 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { 597 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
589 numEvents--; 598 numEvents--;
590 } 599 }
591 if ( event->isHoliday()) { 600 if ( event->isHoliday()) {
592 hDays.setBit(i); 601 hDays.setBit(i);
593 if ( !holiStr.isEmpty() ) 602 if ( !holiStr.isEmpty() )
594 holiStr += "\n"; 603 holiStr += "\n";
@@ -662,33 +671,33 @@ void KODayMatrix::updateView(QDate actdate)
662#ifdef DESKTOP_VERSION 671#ifdef DESKTOP_VERSION
663 //mRepaintTimer->start( 100 ); 672 //mRepaintTimer->start( 100 );
664 //updateViewTimed(); 673 //updateViewTimed();
665 mUpdateTimer->start( 50 ); 674 mUpdateTimer->start( 50 );
666#else 675#else
667 mRepaintTimer->start( 250 ); 676 mRepaintTimer->start( 250 );
668 mUpdateTimer->start( 500 ); 677 mUpdateTimer->start( 500 );
669#endif 678#endif
670 } 679 }
671} 680}
672void KODayMatrix::updateEvents() 681void KODayMatrix::updateEvents()
673{ 682{
674 if ( !mCalendar ) return; 683 if ( !mCalendar ) return;
675 684
676 for( int i = 0; i < NUMDAYS; i++ ) { 685 for( int i = 0; i < NUMDAYS; i++ ) {
677 // if events are set for the day then remember to draw it bold 686 // if events are set for the day then remember to draw it bold
678 QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); 687 Q3PtrList<Event> eventlist = mCalendar->events( days[ i ] );
679 int numEvents = eventlist.count(); 688 int numEvents = eventlist.count();
680 Event *event; 689 Event *event;
681 for( event = eventlist.first(); event != 0;event=eventlist.next()) { 690 for( event = eventlist.first(); event != 0;event=eventlist.next()) {
682 ushort recurType = event->doesRecur(); 691 ushort recurType = event->doesRecur();
683 692
684 if ( ( recurType == Recurrence::rDaily && 693 if ( ( recurType == Recurrence::rDaily &&
685 !KOPrefs::instance()->mDailyRecur ) || 694 !KOPrefs::instance()->mDailyRecur ) ||
686 ( recurType == Recurrence::rWeekly && 695 ( recurType == Recurrence::rWeekly &&
687 !KOPrefs::instance()->mWeeklyRecur ) ) { 696 !KOPrefs::instance()->mWeeklyRecur ) ) {
688 numEvents--; 697 numEvents--;
689 } 698 }
690 if ( !KOPrefs::instance()->mLongAllday && event->doesFloat()&& event->isMultiDay() ) { 699 if ( !KOPrefs::instance()->mLongAllday && event->doesFloat()&& event->isMultiDay() ) {
691 numEvents--; 700 numEvents--;
692 } 701 }
693 } 702 }
694 if ( numEvents ) 703 if ( numEvents )
@@ -726,46 +735,46 @@ int KODayMatrix::getDayIndexFrom(int x, int y)
726#endif 735#endif
727 int xVal = (x-colModulo/2-2)/daysize.width(); 736 int xVal = (x-colModulo/2-2)/daysize.width();
728 int yVal = (y-rowModulo/2-2)/daysize.height(); 737 int yVal = (y-rowModulo/2-2)/daysize.height();
729 738
730 739
731 return 7*(yVal) + xVal; 740 return 7*(yVal) + xVal;
732 741
733} 742}
734 743
735// ---------------------------------------------------------------------------- 744// ----------------------------------------------------------------------------
736// M O U S E E V E N T H A N D L I N G 745// M O U S E E V E N T H A N D L I N G
737// ---------------------------------------------------------------------------- 746// ----------------------------------------------------------------------------
738 747
739void KODayMatrix::mousePressEvent (QMouseEvent* e) 748void KODayMatrix::mousePressEvent (QMouseEvent* e)
740{ 749{
741 750
742 if ( e->button() == LeftButton ) 751 if ( e->button() == Qt::LeftButton )
743 mouseDown = true; 752 mouseDown = true;
744 mSelStart = getDayIndexFrom(e->x(), e->y()); 753 mSelStart = getDayIndexFrom(e->x(), e->y());
745 if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; 754 if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1;
746 mSelInit = mSelStart; 755 mSelInit = mSelStart;
747 mSelEnd = mSelStart; 756 mSelEnd = mSelStart;
748 mRedrawNeeded = true; 757 mRedrawNeeded = true;
749 repaint(false); 758 repaint(false);
750} 759}
751 760
752void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) 761void KODayMatrix::mouseReleaseEvent (QMouseEvent* e)
753{ 762{
754 mRedrawNeeded = true; 763 mRedrawNeeded = true;
755 if ( e->button() == LeftButton ) 764 if ( e->button() == Qt::LeftButton )
756 if ( ! mouseDown ) { 765 if ( ! mouseDown ) {
757 return; 766 return;
758 } 767 }
759 else 768 else
760 mouseDown = false; 769 mouseDown = false;
761 int tmp = getDayIndexFrom(e->x(), e->y()); 770 int tmp = getDayIndexFrom(e->x(), e->y());
762 if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; 771 if (tmp > NUMDAYS-1) tmp=NUMDAYS-1;
763 772
764 if (mSelInit > tmp) { 773 if (mSelInit > tmp) {
765 mSelEnd = mSelInit; 774 mSelEnd = mSelInit;
766 if (tmp != mSelStart) { 775 if (tmp != mSelStart) {
767 mSelStart = tmp; 776 mSelStart = tmp;
768 repaint(false); 777 repaint(false);
769 } 778 }
770 } else { 779 } else {
771 mSelStart = mSelInit; 780 mSelStart = mSelInit;
@@ -1182,42 +1191,42 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
1182 if (pDays.testBit(i)) { 1191 if (pDays.testBit(i)) {
1183 p.setPen(actcol); 1192 p.setPen(actcol);
1184 } 1193 }
1185 // reset bold font to plain font 1194 // reset bold font to plain font
1186 if ( eDays.testBit(i)) { 1195 if ( eDays.testBit(i)) {
1187 QFont myFont = font(); 1196 QFont myFont = font();
1188 myFont.setBold(false); 1197 myFont.setBold(false);
1189 p.setFont(myFont); 1198 p.setFont(myFont);
1190 } 1199 }
1191 } 1200 }
1192 p.setPen(mDefaultTextColor); 1201 p.setPen(mDefaultTextColor);
1193 p.drawRect(0, 0, width(), height()); 1202 p.drawRect(0, 0, width(), height());
1194 } else { 1203 } else {
1195 //qDebug("NO redraw "); 1204 //qDebug("NO redraw ");
1196 } 1205 }
1197 1206
1198 bitBlt (this, pevent->rect().topLeft(), &myPix , pevent->rect() ,CopyROP); 1207 bitBlt (this, pevent->rect().topLeft(), &myPix , pevent->rect() ,QPainter::CompositionMode_Source);
1199 mRedrawNeeded = false; 1208 mRedrawNeeded = false;
1200} 1209}
1201 1210
1202// ---------------------------------------------------------------------------- 1211// ----------------------------------------------------------------------------
1203// R E SI Z E E V E N T H A N D L I N G 1212// R E SI Z E E V E N T H A N D L I N G
1204// ---------------------------------------------------------------------------- 1213// ----------------------------------------------------------------------------
1205 1214
1206void KODayMatrix::resizeEvent(QResizeEvent * e) 1215void KODayMatrix::resizeEvent(QResizeEvent * e)
1207{ 1216{
1208 QRect sz = frameRect(); 1217 QRect sz = frameRect();
1209 daysize.setHeight(sz.height()*7 / NUMDAYS); 1218 daysize.setHeight(sz.height()*7 / NUMDAYS);
1210 daysize.setWidth(sz.width() / 7); 1219 daysize.setWidth(sz.width() / 7);
1211 QFrame::resizeEvent( e ); 1220 Q3Frame::resizeEvent( e );
1212} 1221}
1213 1222
1214QSize KODayMatrix::sizeHint() const 1223QSize KODayMatrix::sizeHint() const
1215{ 1224{
1216 1225
1217 QFontMetrics fm ( font() ); 1226 QFontMetrics fm ( font() );
1218 int wid = fm.width( "30") *7+3; 1227 int wid = fm.width( "30") *7+3;
1219 int hei = fm.height() * 6+3; 1228 int hei = fm.height() * 6+3;
1220 //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei); 1229 //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei);
1221 return QSize ( wid, hei ); 1230 return QSize ( wid, hei );
1222 1231
1223} 1232}
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h
index b96e08f..6edf7cd 100644
--- a/korganizer/kodaymatrix.h
+++ b/korganizer/kodaymatrix.h
@@ -13,58 +13,66 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef _KODAYMAT_H 23#ifndef _KODAYMAT_H
24#define _KODAYMAT_H 24#define _KODAYMAT_H
25 25
26#include <libkcal/calendar.h> 26#include <libkcal/calendar.h>
27 27
28#include <qstring.h> 28#include <qstring.h>
29#include <qframe.h> 29#include <q3frame.h>
30#include <qcolor.h> 30#include <qcolor.h>
31#include <qpen.h> 31#include <qpen.h>
32#include <qdatetime.h> 32#include <qdatetime.h>
33#include <qtooltip.h> 33#include <qtooltip.h>
34#include <qpixmap.h> 34#include <qpixmap.h>
35#include <qbitarray.h> 35#include <qbitarray.h>
36#include <qmap.h> 36#include <qmap.h>
37//Added by qt3to4:
38#include <QDragMoveEvent>
39#include <QDropEvent>
40#include <QDragLeaveEvent>
41#include <QPaintEvent>
42#include <QResizeEvent>
43#include <QMouseEvent>
44#include <QDragEnterEvent>
37 45
38class QDragEnterEvent; 46class QDragEnterEvent;
39class QDragMoveEvent; 47class QDragMoveEvent;
40class QDragLeaveEvent; 48class QDragLeaveEvent;
41class QDropEvent; 49class QDropEvent;
42 50
43class KODayMatrix; 51class KODayMatrix;
44class KODaymatrixWhatsThis; 52class KODaymatrixWhatsThis;
45 53
46using namespace KCal; 54using namespace KCal;
47 55
48 56
49/** 57/**
50 * small helper class to dynamically show tooltips inside the day matrix. 58 * small helper class to dynamically show tooltips inside the day matrix.
51 * This class asks the day matrix object for a appropriate label which 59 * This class asks the day matrix object for a appropriate label which
52 * is in our special case the name of the holiday or null if this day is no holiday. 60 * is in our special case the name of the holiday or null if this day is no holiday.
53 */ 61 */
54class DynamicTip : public QToolTip 62class DynamicTip /* TODO:hacker: : public QToolTip */
55{ 63{
56public: 64public:
57 65
58 /** 66 /**
59 * Constructor that expects a KODayMatrix object as parent. 67 * Constructor that expects a KODayMatrix object as parent.
60 * 68 *
61 * @param parent the parent KODayMatrix control. 69 * @param parent the parent KODayMatrix control.
62 */ 70 */
63 DynamicTip(QWidget* parent ); 71 DynamicTip(QWidget* parent );
64 72
65protected: 73protected:
66 74
67 /** 75 /**
68 * Qt's callback to ask the object to provide an approrpiate text for the 76 * Qt's callback to ask the object to provide an approrpiate text for the
69 * tooltip to be shown. 77 * tooltip to be shown.
70 * 78 *
@@ -90,33 +98,33 @@ private:
90 * o when shifting events in the agenda view from one day to another the day matrix is updated now 98 * o when shifting events in the agenda view from one day to another the day matrix is updated now
91 * o TODO ET dragging an event to the matrix will MOVE not COPY the event to the new date. 99 * o TODO ET dragging an event to the matrix will MOVE not COPY the event to the new date.
92 * o no support for Ctrl+click to create groups of dates 100 * o no support for Ctrl+click to create groups of dates
93 * (This has not really been supported in the predecessor. It was not very intuitive nor was it 101 * (This has not really been supported in the predecessor. It was not very intuitive nor was it
94 * user friendly.) 102 * user friendly.)
95 * This feature has been replaced with dragging a selection on the matrix. The matrix will 103 * This feature has been replaced with dragging a selection on the matrix. The matrix will
96 * automatically choose the appropriate selection (e.g. you are not any longer able to select 104 * automatically choose the appropriate selection (e.g. you are not any longer able to select
97 * two distinct groups of date selections as in the old class) 105 * two distinct groups of date selections as in the old class)
98 * o now that you can select more then a week it can happen that not all selected days are 106 * o now that you can select more then a week it can happen that not all selected days are
99 * displayed in the matrix. However this is preferred to the alternative which would mean to 107 * displayed in the matrix. However this is preferred to the alternative which would mean to
100 * adjust the selection and leave some days undisplayed while scrolling through the months 108 * adjust the selection and leave some days undisplayed while scrolling through the months
101 * 109 *
102 * @short day matrix widget of the KDateNavigator 110 * @short day matrix widget of the KDateNavigator
103 * 111 *
104 * @author Eitzenberger Thomas 112 * @author Eitzenberger Thomas
105 */ 113 */
106class KODayMatrix: public QFrame { 114class KODayMatrix: public Q3Frame {
107 115
108 Q_OBJECT 116 Q_OBJECT
109 117
110public: 118public:
111 119
112 /** constructor to create a day matrix widget. 120 /** constructor to create a day matrix widget.
113 * 121 *
114 * @param parent widget that is the parent of the day matrix. Normally this should 122 * @param parent widget that is the parent of the day matrix. Normally this should
115 * be a KDateNavigator 123 * be a KDateNavigator
116 * @param calendar instance of a calendar on which all calculations are based 124 * @param calendar instance of a calendar on which all calculations are based
117 * @param date start date of the matrix (is expected to be already fixed). It is 125 * @param date start date of the matrix (is expected to be already fixed). It is
118 * assumed that this date is the first week day to be shown in the matrix. 126 * assumed that this date is the first week day to be shown in the matrix.
119 * @param name name of the widget 127 * @param name name of the widget
120 */ 128 */
121 KODayMatrix( QWidget *parent, const char *name ); 129 KODayMatrix( QWidget *parent, const char *name );
122 //KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); 130 //KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name );
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp
index ea30fac..deb1e46 100644
--- a/korganizer/kodialogmanager.cpp
+++ b/korganizer/kodialogmanager.cpp
@@ -28,32 +28,34 @@
28#include "koeventeditor.h" 28#include "koeventeditor.h"
29#include "koprefs.h" 29#include "koprefs.h"
30#include "datenavigator.h" 30#include "datenavigator.h"
31#include "kotodoeditor.h" 31#include "kotodoeditor.h"
32#include "searchdialog.h" 32#include "searchdialog.h"
33#include "filtereditdialog.h" 33#include "filtereditdialog.h"
34#ifndef KORG_NOPLUGINS 34#ifndef KORG_NOPLUGINS
35#include "plugindialog.h" 35#include "plugindialog.h"
36#endif 36#endif
37#ifndef KORG_NOARCHIVE 37#ifndef KORG_NOARCHIVE
38#include "archivedialog.h" 38#include "archivedialog.h"
39#endif 39#endif
40 40
41#include "kconfig.h" 41#include "kconfig.h"
42#include "kodialogmanager.h" 42#include "kodialogmanager.h"
43#include <kapplication.h> 43#include <kapplication.h>
44//Added by qt3to4:
45#include <Q3PtrList>
44 46
45KODialogManager::KODialogManager( CalendarView *mainView ) : 47KODialogManager::KODialogManager( CalendarView *mainView ) :
46 QObject(), mMainView( mainView ) 48 QObject(), mMainView( mainView )
47{ 49{
48 mOutgoingDialog = 0; 50 mOutgoingDialog = 0;
49 mIncomingDialog = 0; 51 mIncomingDialog = 0;
50 mOptionsDialog = 0; 52 mOptionsDialog = 0;
51 mSearchDialog = 0; 53 mSearchDialog = 0;
52 mArchiveDialog = 0; 54 mArchiveDialog = 0;
53 mFilterEditDialog = 0; 55 mFilterEditDialog = 0;
54 mPluginDialog = 0; 56 mPluginDialog = 0;
55 57
56 // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView); 58 // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView);
57 //KOGlobals::fitDialogToScreen( mCategoryEditDialog ); 59 //KOGlobals::fitDialogToScreen( mCategoryEditDialog );
58} 60}
59 61
@@ -175,34 +177,34 @@ void KODialogManager::showSearchDialog()
175 if (!mSearchDialog) { 177 if (!mSearchDialog) {
176 mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView); 178 mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView);
177 KOListView * lview = mSearchDialog->listview(); 179 KOListView * lview = mSearchDialog->listview();
178 180
179 connect(lview, SIGNAL(showIncidenceSignal(Incidence *)), 181 connect(lview, SIGNAL(showIncidenceSignal(Incidence *)),
180 mMainView, SLOT(showIncidence(Incidence *))); 182 mMainView, SLOT(showIncidence(Incidence *)));
181 connect(lview, SIGNAL(editIncidenceSignal(Incidence *)), 183 connect(lview, SIGNAL(editIncidenceSignal(Incidence *)),
182 mMainView, SLOT(editIncidence(Incidence *))); 184 mMainView, SLOT(editIncidence(Incidence *)));
183 connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)), 185 connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)),
184 mMainView, SLOT(deleteIncidence(Incidence *))); 186 mMainView, SLOT(deleteIncidence(Incidence *)));
185 connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)), 187 connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)),
186 mMainView, SLOT(cloneIncidence(Incidence *))); 188 mMainView, SLOT(cloneIncidence(Incidence *)));
187 connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)), 189 connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)),
188 mMainView, SLOT(beamIncidence(Incidence *))); 190 mMainView, SLOT(beamIncidence(Incidence *)));
189 connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)), 191 connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)),
190 mMainView, SLOT(moveIncidence(Incidence *))); 192 mMainView, SLOT(moveIncidence(Incidence *)));
191 connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )), 193 connect(lview, SIGNAL(beamIncidenceList(Q3PtrList<Incidence> )),
192 mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> ))); 194 mMainView, SLOT(beamIncidenceList(Q3PtrList<Incidence> )));
193 195
194 connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig())); 196 connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig()));
195 connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList())); 197 connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList()));
196 // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ), 198 // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ),
197 // mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 199 // mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
198#ifndef DESKTOP_VERSION 200#ifndef DESKTOP_VERSION
199 mSearchDialog->setMaximumSize( QApplication::desktop()->size()); 201 mSearchDialog->setMaximumSize( QApplication::desktop()->size());
200 mSearchDialog->showMaximized(); 202 mSearchDialog->showMaximized();
201#else 203#else
202 KConfig *config = KOGlobals::config(); 204 KConfig *config = KOGlobals::config();
203 config->setGroup("WidgetLayout"); 205 config->setGroup("WidgetLayout");
204 QStringList list; 206 QStringList list;
205 list = config->readListEntry("SearchLayout"); 207 list = config->readListEntry("SearchLayout");
206 int x,y,w,h; 208 int x,y,w,h;
207 if ( ! list.isEmpty() ) { 209 if ( ! list.isEmpty() ) {
208 x = list[0].toInt(); 210 x = list[0].toInt();
@@ -233,33 +235,33 @@ SearchDialog * KODialogManager::getSearchDialog()
233void KODialogManager::showArchiveDialog() 235void KODialogManager::showArchiveDialog()
234{ 236{
235#ifndef KORG_NOARCHIVE 237#ifndef KORG_NOARCHIVE
236 if (!mArchiveDialog) { 238 if (!mArchiveDialog) {
237 mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView); 239 mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView);
238 connect(mArchiveDialog,SIGNAL(eventsDeleted()), 240 connect(mArchiveDialog,SIGNAL(eventsDeleted()),
239 mMainView,SLOT(updateView())); 241 mMainView,SLOT(updateView()));
240 } 242 }
241 mArchiveDialog->show(); 243 mArchiveDialog->show();
242 mArchiveDialog->raise(); 244 mArchiveDialog->raise();
243 245
244 // Workaround. 246 // Workaround.
245 QApplication::restoreOverrideCursor(); 247 QApplication::restoreOverrideCursor();
246#endif 248#endif
247} 249}
248 250
249void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters) 251void KODialogManager::showFilterEditDialog(Q3PtrList<CalFilter> *filters)
250{ 252{
251 if (!mFilterEditDialog) { 253 if (!mFilterEditDialog) {
252 mFilterEditDialog = new FilterEditDialog(filters,mMainView); 254 mFilterEditDialog = new FilterEditDialog(filters,mMainView);
253 connect(mFilterEditDialog,SIGNAL(filterChanged()), 255 connect(mFilterEditDialog,SIGNAL(filterChanged()),
254 mMainView,SLOT(filterEdited())); 256 mMainView,SLOT(filterEdited()));
255 257
256 } 258 }
257 259
258#ifndef DESKTOP_VERSION 260#ifndef DESKTOP_VERSION
259 mFilterEditDialog->showMaximized(); 261 mFilterEditDialog->showMaximized();
260#else 262#else
261 mFilterEditDialog->show(); 263 mFilterEditDialog->show();
262#endif 264#endif
263 mFilterEditDialog->raise(); 265 mFilterEditDialog->raise();
264} 266}
265 267
diff --git a/korganizer/kodialogmanager.h b/korganizer/kodialogmanager.h
index b68ddc2..00ad1df 100644
--- a/korganizer/kodialogmanager.h
+++ b/korganizer/kodialogmanager.h
@@ -12,33 +12,33 @@
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef KODIALOGMANAGER_H 24#ifndef KODIALOGMANAGER_H
25#define KODIALOGMANAGER_H 25#define KODIALOGMANAGER_H
26 26
27#include <qobject.h> 27#include <qobject.h>
28#include <qptrlist.h> 28#include <q3ptrlist.h>
29 29
30#include <libkcal/calfilter.h> 30#include <libkcal/calfilter.h>
31 31
32class CalendarView; 32class CalendarView;
33class OutgoingDialog; 33class OutgoingDialog;
34class IncomingDialog; 34class IncomingDialog;
35class KOPrefsDialog; 35class KOPrefsDialog;
36//namespace KPIM { class CategoryEditDialog; } 36//namespace KPIM { class CategoryEditDialog; }
37class KOEventEditor; 37class KOEventEditor;
38class KOTodoEditor; 38class KOTodoEditor;
39class SearchDialog; 39class SearchDialog;
40class ArchiveDialog; 40class ArchiveDialog;
41class PluginDialog; 41class PluginDialog;
42class KConfig; 42class KConfig;
43class FilterEditDialog; 43class FilterEditDialog;
44 44
@@ -65,33 +65,33 @@ class KODialogManager : public QObject
65 65
66 IncomingDialog *incomingDialog(); 66 IncomingDialog *incomingDialog();
67 void writeSettings( KConfig *config); 67 void writeSettings( KConfig *config);
68 void updateSearchDialog(); 68 void updateSearchDialog();
69 SearchDialog * getSearchDialog(); 69 SearchDialog * getSearchDialog();
70 void setDocumentId( const QString &id ); 70 void setDocumentId( const QString &id );
71 71
72 public slots: 72 public slots:
73 void showOptionsDialog( bool showSync = false); 73 void showOptionsDialog( bool showSync = false);
74 void showGlobalOptionsDialog(bool showSync = false); 74 void showGlobalOptionsDialog(bool showSync = false);
75 void showSyncOptions(); 75 void showSyncOptions();
76 void showIncomingDialog(); 76 void showIncomingDialog();
77 void showOutgoingDialog(); 77 void showOutgoingDialog();
78 // void showCategoryEditDialog(); 78 // void showCategoryEditDialog();
79 void showSearchDialog(); 79 void showSearchDialog();
80 void showArchiveDialog(); 80 void showArchiveDialog();
81 void showFilterEditDialog(QPtrList<CalFilter> *filters); 81 void showFilterEditDialog(Q3PtrList<CalFilter> *filters);
82 void showPluginDialog(); 82 void showPluginDialog();
83 void hideSearchDialog(); 83 void hideSearchDialog();
84 84
85 private: 85 private:
86 void createOutgoingDialog(); 86 void createOutgoingDialog();
87 void createIncomingDialog(); 87 void createIncomingDialog();
88 88
89 CalendarView *mMainView; 89 CalendarView *mMainView;
90 90
91 OutgoingDialog *mOutgoingDialog; 91 OutgoingDialog *mOutgoingDialog;
92 IncomingDialog *mIncomingDialog; 92 IncomingDialog *mIncomingDialog;
93 KOPrefsDialog *mOptionsDialog; 93 KOPrefsDialog *mOptionsDialog;
94 // KPIM::CategoryEditDialog *mCategoryEditDialog; 94 // KPIM::CategoryEditDialog *mCategoryEditDialog;
95 SearchDialog *mSearchDialog; 95 SearchDialog *mSearchDialog;
96 ArchiveDialog *mArchiveDialog; 96 ArchiveDialog *mArchiveDialog;
97 FilterEditDialog *mFilterEditDialog; 97 FilterEditDialog *mFilterEditDialog;
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp
index 9a4b4ec..a01c838 100644
--- a/korganizer/koeditordetails.cpp
+++ b/korganizer/koeditordetails.cpp
@@ -9,40 +9,46 @@
9 9
10 This program is distributed in thse hope that it will be useful, 10 This program is distributed in thse hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qfiledialog.h> 25#include <q3filedialog.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <q3vbox.h>
28#include <qbuttongroup.h> 28#include <q3buttongroup.h>
29#include <qvgroupbox.h> 29#include <q3vgroupbox.h>
30#include <qwidgetstack.h> 30#include <q3widgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qapp.h> 32#include <qapplication.h>
33#include <QDesktopWidget>
34//Added by qt3to4:
35#include <Q3GridLayout>
36#include <QLabel>
37#include <Q3PtrList>
38#include <Q3VBoxLayout>
33 39
34#include <klocale.h> 40#include <klocale.h>
35#include <kglobal.h> 41#include <kglobal.h>
36#include <kdialog.h> 42#include <kdialog.h>
37#include <kiconloader.h> 43#include <kiconloader.h>
38#include <kstandarddirs.h> 44#include <kstandarddirs.h>
39#include <kmessagebox.h> 45#include <kmessagebox.h>
40#ifndef KORG_NOKABC 46#ifndef KORG_NOKABC
41 47
42#ifdef DESKTOP_VERSION 48#ifdef DESKTOP_VERSION
43#include <kabc/addresseedialog.h> 49#include <kabc/addresseedialog.h>
44#else //DESKTOP_VERSION 50#else //DESKTOP_VERSION
45#include <externalapphandler.h> 51#include <externalapphandler.h>
46#endif //DESKTOP_VERSION 52#endif //DESKTOP_VERSION
47 53
48#endif 54#endif
@@ -67,58 +73,58 @@ void CustomListViewItem<Attendee *>::updateItem()
67 setText(2,mData->roleStr()); 73 setText(2,mData->roleStr());
68 setText(3,mData->statusStr()); 74 setText(3,mData->statusStr());
69 if (mData->RSVP() && !mData->email().isEmpty()) { 75 if (mData->RSVP() && !mData->email().isEmpty()) {
70 setPixmap(4,SmallIcon("mailappt")); 76 setPixmap(4,SmallIcon("mailappt"));
71 setSortKey(4,"j"); 77 setSortKey(4,"j");
72 } 78 }
73 else { 79 else {
74 setPixmap(4,SmallIcon("nomailappt")); 80 setPixmap(4,SmallIcon("nomailappt"));
75 setSortKey(4,"n"); 81 setSortKey(4,"n");
76 } 82 }
77} 83}
78 84
79 85
80KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) 86KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name)
81 : QWidget( parent, name), mDisableItemUpdate( false ) 87 : QWidget( parent, name), mDisableItemUpdate( false )
82{ 88{
83 QGridLayout *topLayout = new QGridLayout(this); 89 Q3GridLayout *topLayout = new Q3GridLayout(this);
84 topLayout->setSpacing(spacing); 90 topLayout->setSpacing(spacing);
85 topLayout->setMargin(KDialog::marginHint()-2); 91 topLayout->setMargin(KDialog::marginHint()-2);
86 92
87 QString organizer = KOPrefs::instance()->email(); 93 QString organizer = KOPrefs::instance()->email();
88 mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); 94 mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this);
89 95
90 mListView = new KListView(this,"mListView"); 96 mListView = new KListView(this,"mListView");
91 mListView->addColumn(i18n("Name"),180); 97 mListView->addColumn(i18n("Name"),180);
92 mListView->addColumn(i18n("Email"),180); 98 mListView->addColumn(i18n("Email"),180);
93 mListView->addColumn(i18n("Role"),60); 99 mListView->addColumn(i18n("Role"),60);
94 mListView->addColumn(i18n("Status"),100); 100 mListView->addColumn(i18n("Status"),100);
95 mListView->addColumn(i18n("RSVP"),35); 101 mListView->addColumn(i18n("RSVP"),35);
96 if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) { 102 if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) {
97 int hei = 80; 103 int hei = 80;
98 if ( QApplication::desktop()->height() <= 240 ) 104 if ( QApplication::desktop()->height() <= 240 )
99 hei = 60; 105 hei = 60;
100 mListView->setFixedHeight(hei); 106 mListView->setFixedHeight(hei);
101 } 107 }
102 mListView->setAllColumnsShowFocus (true ); 108 mListView->setAllColumnsShowFocus (true );
103 //mListView->setSingleClick( true ); 109 //mListView->setSingleClick( true );
104 connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), 110 connect(mListView,SIGNAL(selectionChanged(Q3ListViewItem *)),
105 SLOT(updateAttendeeInput())); 111 SLOT(updateAttendeeInput()));
106 112
107 connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), 113 connect(mListView,SIGNAL(executed(Q3ListViewItem * ,const QPoint&, int )),
108 SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); 114 SLOT(itemClicked(Q3ListViewItem * ,const QPoint& , int )));
109 115
110 mRsvpButton = new QCheckBox(this); 116 mRsvpButton = new QCheckBox(this);
111 mRsvpButton->setText(i18n("Request response")); 117 mRsvpButton->setText(i18n("Request response"));
112 mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); 118 mAddressBookButton = new QPushButton(i18n("Address &Book..."),this);
113 QLabel *attendeeLabel = new QLabel(this); 119 QLabel *attendeeLabel = new QLabel(this);
114 attendeeLabel->setText(i18n("Name:")); 120 attendeeLabel->setText(i18n("Name:"));
115 attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); 121 attendeeLabel->setFixedSize( attendeeLabel->sizeHint() );
116 mNameEdit = new QLineEdit(this); 122 mNameEdit = new QLineEdit(this);
117 connect(mNameEdit,SIGNAL(textChanged(const QString &)), 123 connect(mNameEdit,SIGNAL(textChanged(const QString &)),
118 SLOT(updateAttendeeItem())); 124 SLOT(updateAttendeeItem()));
119 125
120 126
121 QLabel *emailLabel = new QLabel(this); 127 QLabel *emailLabel = new QLabel(this);
122 emailLabel->setText(i18n("Email:")); 128 emailLabel->setText(i18n("Email:"));
123 mEmailEdit = new QLineEdit(this); 129 mEmailEdit = new QLineEdit(this);
124 connect(mEmailEdit,SIGNAL(textChanged(const QString &)), 130 connect(mEmailEdit,SIGNAL(textChanged(const QString &)),
@@ -127,33 +133,33 @@ KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name)
127 QLabel *attendeeRoleLabel = new QLabel(this); 133 QLabel *attendeeRoleLabel = new QLabel(this);
128 attendeeRoleLabel->setText(i18n("Role:")); 134 attendeeRoleLabel->setText(i18n("Role:"));
129 mRoleCombo = new QComboBox(false,this); 135 mRoleCombo = new QComboBox(false,this);
130 mRoleCombo->insertStringList(Attendee::roleList()); 136 mRoleCombo->insertStringList(Attendee::roleList());
131 connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); 137 connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
132 138
133 QLabel *statusLabel = new QLabel(this); 139 QLabel *statusLabel = new QLabel(this);
134 statusLabel->setText( i18n("Status:") ); 140 statusLabel->setText( i18n("Status:") );
135 141
136 mStatusCombo = new QComboBox(false,this); 142 mStatusCombo = new QComboBox(false,this);
137 mStatusCombo->insertStringList(Attendee::statusList()); 143 mStatusCombo->insertStringList(Attendee::statusList());
138 connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); 144 connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
139 145
140 146
141 connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); 147 connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem()));
142 QWidget *buttonBox = new QWidget(this); 148 QWidget *buttonBox = new QWidget(this);
143 QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); 149 Q3VBoxLayout *buttonLayout = new Q3VBoxLayout(buttonBox);
144 150
145 QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); 151 QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox);
146 buttonLayout->addWidget(newButton); 152 buttonLayout->addWidget(newButton);
147 connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); 153 connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee()));
148 154
149 mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); 155 mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox);
150 buttonLayout->addWidget(mRemoveButton); 156 buttonLayout->addWidget(mRemoveButton);
151 connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); 157 connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee()));
152 158
153 // buttonLayout->addWidget(mAddressBookButton); 159 // buttonLayout->addWidget(mAddressBookButton);
154 connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); 160 connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook()));
155 //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); 161 //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () );
156 if ( QApplication::desktop()->height() <= 240 ) { 162 if ( QApplication::desktop()->height() <= 240 ) {
157 mRoleCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); 163 mRoleCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) );
158 mStatusCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); 164 mStatusCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) );
159 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); 165 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5);
@@ -352,72 +358,72 @@ void KOEditorDetails::setDefaults()
352 clearAttendeeInput(); 358 clearAttendeeInput();
353 mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email())); 359 mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email()));
354 360
355 mNameEdit->setText(""); 361 mNameEdit->setText("");
356 mUidEdit = ""; 362 mUidEdit = "";
357 mEmailEdit->setText(""); 363 mEmailEdit->setText("");
358 mRoleCombo->setCurrentItem( 0 ); 364 mRoleCombo->setCurrentItem( 0 );
359 mStatusCombo->setCurrentItem( 0 ); 365 mStatusCombo->setCurrentItem( 0 );
360 366
361} 367}
362 368
363void KOEditorDetails::readEvent(Incidence *event) 369void KOEditorDetails::readEvent(Incidence *event)
364{ 370{
365 setDefaults(); 371 setDefaults();
366 //mListView->clear(); 372 //mListView->clear();
367 //mdelAttendees.clear(); 373 //mdelAttendees.clear();
368 QPtrList<Attendee> tmpAList = event->attendees(); 374 Q3PtrList<Attendee> tmpAList = event->attendees();
369 Attendee *a; 375 Attendee *a;
370 for (a = tmpAList.first(); a; a = tmpAList.next()) 376 for (a = tmpAList.first(); a; a = tmpAList.next())
371 insertAttendee(new Attendee(*a)); 377 insertAttendee(new Attendee(*a));
372 378
373 mListView->setSelected( mListView->firstChild(), true ); 379 mListView->setSelected( mListView->firstChild(), true );
374 mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer())); 380 mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer()));
375} 381}
376 382
377void KOEditorDetails::writeEvent(Incidence *event) 383void KOEditorDetails::writeEvent(Incidence *event)
378{ 384{
379 event->clearAttendees(); 385 event->clearAttendees();
380 QListViewItem *item; 386 Q3ListViewItem *item;
381 AttendeeListItem *a; 387 AttendeeListItem *a;
382 for (item = mListView->firstChild(); item; 388 for (item = mListView->firstChild(); item;
383 item = item->nextSibling()) { 389 item = item->nextSibling()) {
384 a = (AttendeeListItem *)item; 390 a = (AttendeeListItem *)item;
385 event->addAttendee(new Attendee(*(a->data()))); 391 event->addAttendee(new Attendee(*(a->data())));
386 } 392 }
387 event->setOrganizer(KOPrefs::instance()->email()); 393 event->setOrganizer(KOPrefs::instance()->email());
388} 394}
389 395
390void KOEditorDetails::cancelAttendeeEvent(Incidence *event) 396void KOEditorDetails::cancelAttendeeEvent(Incidence *event)
391{ 397{
392 event->clearAttendees(); 398 event->clearAttendees();
393 Attendee * att; 399 Attendee * att;
394 for (att=mdelAttendees.first();att;att=mdelAttendees.next()) { 400 for (att=mdelAttendees.first();att;att=mdelAttendees.next()) {
395 event->addAttendee(new Attendee(*att)); 401 event->addAttendee(new Attendee(*att));
396 } 402 }
397 mdelAttendees.clear(); 403 mdelAttendees.clear();
398} 404}
399 405
400bool KOEditorDetails::validateInput() 406bool KOEditorDetails::validateInput()
401{ 407{
402 return true; 408 return true;
403} 409}
404 410
405void KOEditorDetails::updateAttendeeInput() 411void KOEditorDetails::updateAttendeeInput()
406{ 412{
407 QListViewItem *item = mListView->selectedItem(); 413 Q3ListViewItem *item = mListView->selectedItem();
408 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); 414 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item );
409 if (aItem) { 415 if (aItem) {
410 fillAttendeeInput( aItem ); 416 fillAttendeeInput( aItem );
411 } else { 417 } else {
412 clearAttendeeInput(); 418 clearAttendeeInput();
413 } 419 }
414} 420}
415 421
416void KOEditorDetails::clearAttendeeInput() 422void KOEditorDetails::clearAttendeeInput()
417{ 423{
418 mNameEdit->setText(""); 424 mNameEdit->setText("");
419 mUidEdit = ""; 425 mUidEdit = "";
420 mEmailEdit->setText(""); 426 mEmailEdit->setText("");
421 mRoleCombo->setCurrentItem(0); 427 mRoleCombo->setCurrentItem(0);
422 mStatusCombo->setCurrentItem(0); 428 mStatusCombo->setCurrentItem(0);
423 mRsvpButton->setChecked(true); 429 mRsvpButton->setChecked(true);
@@ -438,43 +444,43 @@ void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem )
438 mDisableItemUpdate = false; 444 mDisableItemUpdate = false;
439 445
440 setEnabledAttendeeInput( true ); 446 setEnabledAttendeeInput( true );
441} 447}
442 448
443void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) 449void KOEditorDetails::setEnabledAttendeeInput( bool enabled )
444{ 450{
445 mNameEdit->setEnabled( enabled ); 451 mNameEdit->setEnabled( enabled );
446 mEmailEdit->setEnabled( enabled ); 452 mEmailEdit->setEnabled( enabled );
447 mRoleCombo->setEnabled( enabled ); 453 mRoleCombo->setEnabled( enabled );
448 mStatusCombo->setEnabled( enabled ); 454 mStatusCombo->setEnabled( enabled );
449 mRsvpButton->setEnabled( enabled ); 455 mRsvpButton->setEnabled( enabled );
450 456
451 mRemoveButton->setEnabled( enabled ); 457 mRemoveButton->setEnabled( enabled );
452} 458}
453 459
454void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c ) 460void KOEditorDetails::itemClicked(Q3ListViewItem * item ,const QPoint & pnt, int c )
455{ 461{
456 if ( item && c == 4 ) { 462 if ( item && c == 4 ) {
457 mRsvpButton->setChecked( !mRsvpButton->isChecked() ); 463 mRsvpButton->setChecked( !mRsvpButton->isChecked() );
458 updateAttendeeItem(); 464 updateAttendeeItem();
459 } 465 }
460} 466}
461void KOEditorDetails::updateAttendeeItem() 467void KOEditorDetails::updateAttendeeItem()
462{ 468{
463 if (mDisableItemUpdate) return; 469 if (mDisableItemUpdate) return;
464 470
465 QListViewItem *item = mListView->selectedItem(); 471 Q3ListViewItem *item = mListView->selectedItem();
466 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); 472 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item );
467 if ( !aItem ) return; 473 if ( !aItem ) return;
468 474
469 Attendee *a = aItem->data(); 475 Attendee *a = aItem->data();
470 476
471 a->setName( mNameEdit->text() ); 477 a->setName( mNameEdit->text() );
472 a->setUid( mUidEdit ); 478 a->setUid( mUidEdit );
473 a->setEmail( mEmailEdit->text() ); 479 a->setEmail( mEmailEdit->text() );
474 if ( mEmailEdit->text().isEmpty() ) 480 if ( mEmailEdit->text().isEmpty() )
475 mRsvpButton->setChecked( false ); 481 mRsvpButton->setChecked( false );
476 a->setRSVP( mRsvpButton->isChecked() ); 482 a->setRSVP( mRsvpButton->isChecked() );
477 a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); 483 a->setRole( Attendee::Role( mRoleCombo->currentItem() ) );
478 a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) ); 484 a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) );
479 aItem->updateItem(); 485 aItem->updateItem();
480} 486}
diff --git a/korganizer/koeditordetails.h b/korganizer/koeditordetails.h
index 5f8f6f2..40e896c 100644
--- a/korganizer/koeditordetails.h
+++ b/korganizer/koeditordetails.h
@@ -11,43 +11,43 @@
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef _KOEDITORDETAILS_H 23#ifndef _KOEDITORDETAILS_H
24#define _KOEDITORDETAILS_H 24#define _KOEDITORDETAILS_H
25 25
26#include <qmap.h> 26#include <qmap.h>
27#include <qframe.h> 27#include <q3frame.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qcheckbox.h> 29#include <qcheckbox.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qgroupbox.h> 31#include <q3groupbox.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qmultilineedit.h> 34#include <q3multilineedit.h>
35#include <klistview.h> 35#include <klistview.h>
36#include <qradiobutton.h> 36#include <qradiobutton.h>
37#include <qptrlist.h> 37#include <q3ptrlist.h>
38 38
39#include <kapplication.h> 39#include <kapplication.h>
40 40
41#include <libkcal/event.h> 41#include <libkcal/event.h>
42 42
43#include "ktimeedit.h" 43#include "ktimeedit.h"
44#include "customlistviewitem.h" 44#include "customlistviewitem.h"
45 45
46class KDateEdit; 46class KDateEdit;
47 47
48using namespace KCal; 48using namespace KCal;
49 49
50typedef CustomListViewItem<Attendee *> AttendeeListItem; 50typedef CustomListViewItem<Attendee *> AttendeeListItem;
51 51
52 52
53class KOEditorDetails : public QWidget 53class KOEditorDetails : public QWidget
@@ -70,40 +70,40 @@ class KOEditorDetails : public QWidget
70 bool validateInput(); 70 bool validateInput();
71 71
72 public slots: 72 public slots:
73 void insertAttendee(Attendee *); 73 void insertAttendee(Attendee *);
74 // called when the app recieves a list of name/email/uid (=addresses) from another app. Usually Ka/Pi 74 // called when the app recieves a list of name/email/uid (=addresses) from another app. Usually Ka/Pi
75 // The first parameter is a uniqueid. It can be used to identify if event 75 // The first parameter is a uniqueid. It can be used to identify if event
76 void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); 76 void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist);
77 77
78 78
79 protected slots: 79 protected slots:
80 void addNewAttendee(); 80 void addNewAttendee();
81 void removeAttendee(); 81 void removeAttendee();
82 void openAddressBook(); 82 void openAddressBook();
83 void updateAttendeeInput(); 83 void updateAttendeeInput();
84 void clearAttendeeInput(); 84 void clearAttendeeInput();
85 void fillAttendeeInput(AttendeeListItem *); 85 void fillAttendeeInput(AttendeeListItem *);
86 void itemClicked(QListViewItem *,const QPoint & pnt, int c); 86 void itemClicked(Q3ListViewItem *,const QPoint & pnt, int c);
87 void updateAttendeeItem(); 87 void updateAttendeeItem();
88 void setEnabledAttendeeInput(bool); 88 void setEnabledAttendeeInput(bool);
89 89
90 private: 90 private:
91 bool mDisableItemUpdate; 91 bool mDisableItemUpdate;
92 92
93 QLineEdit *mNameEdit; 93 QLineEdit *mNameEdit;
94 QString mUidEdit; 94 QString mUidEdit;
95 QLineEdit *mEmailEdit; 95 QLineEdit *mEmailEdit;
96 KListView *mListView; 96 KListView *mListView;
97 QComboBox* mRoleCombo; 97 QComboBox* mRoleCombo;
98 QCheckBox* mRsvpButton; 98 QCheckBox* mRsvpButton;
99 QComboBox* mStatusCombo; 99 QComboBox* mStatusCombo;
100 QLabel *mOrganizerLabel; 100 QLabel *mOrganizerLabel;
101 101
102 QPushButton* mAddButton; 102 QPushButton* mAddButton;
103 QPushButton* mRemoveButton; 103 QPushButton* mRemoveButton;
104 QPushButton* mAddressBookButton; 104 QPushButton* mAddressBookButton;
105 105
106 QPtrList<Attendee> mdelAttendees; 106 Q3PtrList<Attendee> mdelAttendees;
107}; 107};
108 108
109#endif 109#endif
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 21f220c..8105432 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -11,41 +11,48 @@
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qwidget.h> 24#include <qwidget.h>
25#include <qtooltip.h> 25#include <qtooltip.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <q3vbox.h>
28#include <qbuttongroup.h> 28#include <q3buttongroup.h>
29#include <qvgroupbox.h> 29#include <q3vgroupbox.h>
30#include <qwidgetstack.h> 30#include <q3widgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qregexp.h> 34#include <qregexp.h>
35//Added by qt3to4:
36#include <Q3HBoxLayout>
37#include <QLabel>
38#include <Q3GridLayout>
39#include <Q3PtrList>
40#include <Q3PopupMenu>
35 41
42#include <QDesktopWidget>
36 43
37#include <kglobal.h> 44#include <kglobal.h>
38#include <kdialog.h> 45#include <kdialog.h>
39#include <kdebug.h> 46#include <kdebug.h>
40#include <klocale.h> 47#include <klocale.h>
41#include <kiconloader.h> 48#include <kiconloader.h>
42#include <kmessagebox.h> 49#include <kmessagebox.h>
43#include <kfiledialog.h> 50#include <kfiledialog.h>
44#include <kstandarddirs.h> 51#include <kstandarddirs.h>
45 52
46#include <libkcal/todo.h> 53#include <libkcal/todo.h>
47#include <libkcal/event.h> 54#include <libkcal/event.h>
48#include <libkdepim/categoryselectdialog.h> 55#include <libkdepim/categoryselectdialog.h>
49#include <libkdepim/kdateedit.h> 56#include <libkdepim/kdateedit.h>
50 57
51#include "koprefs.h" 58#include "koprefs.h"
@@ -56,35 +63,35 @@
56#ifndef DESKTOP_VERSION 63#ifndef DESKTOP_VERSION
57#include <qpe/qpeapplication.h> 64#include <qpe/qpeapplication.h>
58#else 65#else
59#include <qapplication.h> 66#include <qapplication.h>
60#endif 67#endif
61 68
62KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : 69KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
63 QObject( parent, name) 70 QObject( parent, name)
64{ 71{
65 mNextFocus = 0; 72 mNextFocus = 0;
66} 73}
67 74
68KOEditorGeneral::~KOEditorGeneral() 75KOEditorGeneral::~KOEditorGeneral()
69{ 76{
70} 77}
71 78
72void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 79void KOEditorGeneral::initHeader(QWidget *parent,Q3BoxLayout *topLayout)
73{ 80{
74 QGridLayout *headerLayout = new QGridLayout(topLayout); 81 Q3GridLayout *headerLayout = new Q3GridLayout(topLayout);
75 82
76#if 0 83#if 0
77 mOwnerLabel = new QLabel(i18n("Owner:"),parent); 84 mOwnerLabel = new QLabel(i18n("Owner:"),parent);
78 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); 85 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
79#endif 86#endif
80 // 1 on pda 87 // 1 on pda
81 // 11 on desktop 88 // 11 on desktop
82 headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 ); 89 headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 );
83 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 90 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
84 headerLayout->addWidget(summaryLabel,0,0); 91 headerLayout->addWidget(summaryLabel,0,0);
85 92
86 mSummaryEdit = new KOLocationBox(TRUE,parent, 50); 93 mSummaryEdit = new KOLocationBox(TRUE,parent, 50);
87 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 94 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
88 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 95 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
89 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 96 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
90 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 97 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
@@ -182,83 +189,83 @@ void KOEditorGeneral::selectedCatPopup( int index )
182 QStringList categories = QStringList::split (",", mCategoriesLabel->text()); 189 QStringList categories = QStringList::split (",", mCategoriesLabel->text());
183 QString colcat = categories.first(); 190 QString colcat = categories.first();
184 if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) 191 if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ())
185 categories.remove (KOPrefs::instance()->mCustomCategories[index]); 192 categories.remove (KOPrefs::instance()->mCustomCategories[index]);
186 else 193 else
187 categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); 194 categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]);
188 categories.sort (); 195 categories.sort ();
189 if ( !colcat.isEmpty() ) { 196 if ( !colcat.isEmpty() ) {
190 if ( categories.find ( colcat ) != categories.end () ) { 197 if ( categories.find ( colcat ) != categories.end () ) {
191 categories.remove( colcat ); 198 categories.remove( colcat );
192 categories.prepend( colcat ); 199 categories.prepend( colcat );
193 } 200 }
194 } 201 }
195 setCategories( categories.join(",") ); 202 setCategories( categories.join(",") );
196} 203}
197 204
198void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 205void KOEditorGeneral::initCategories(QWidget *parent, Q3BoxLayout *topLayout)
199{ 206{
200 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 207 Q3BoxLayout *categoriesLayout = new Q3HBoxLayout( topLayout );
201 mCatPopup = new QPopupMenu ( parent ); 208 mCatPopup = new Q3PopupMenu ( parent );
202 mCatPopup->setCheckable (true); 209 mCatPopup->setCheckable (true);
203 connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); 210 connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup()));
204 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); 211 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int )));
205 mCategoriesButton = new QPushButton(parent); 212 mCategoriesButton = new QPushButton(parent);
206 mCategoriesButton->setText(i18n("Categories...")); 213 mCategoriesButton->setText(i18n("Categories..."));
207 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 214 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
208 //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 215 //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
209 categoriesLayout->addWidget(mCategoriesButton); 216 categoriesLayout->addWidget(mCategoriesButton);
210 mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); 217 mCategoriesLabel = new QPushButton(parent);//new QLabel(parent);
211 mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); 218 mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
212 mCategoriesLabel->setPopup( mCatPopup ); 219 mCategoriesLabel->setPopup( mCatPopup );
213 //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 220 //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
214 categoriesLayout->addWidget(mCategoriesLabel,1); 221 categoriesLayout->addWidget(mCategoriesLabel,1);
215} 222}
216 223
217void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 224void KOEditorGeneral::initSecrecy(QWidget *parent, Q3BoxLayout *topLayout)
218{ 225{
219 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 226 Q3BoxLayout *secrecyLayout = new Q3HBoxLayout( topLayout );
220 227
221 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 228 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
222 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 229 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
223 secrecyLayout->addWidget(mCancelBox); 230 secrecyLayout->addWidget(mCancelBox);
224 secrecyLayout->addWidget(secrecyLabel); 231 secrecyLayout->addWidget(secrecyLabel);
225 232
226 mSecrecyCombo = new QComboBox(parent); 233 mSecrecyCombo = new QComboBox(parent);
227 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 234 mSecrecyCombo->insertStringList(Incidence::secrecyList());
228 secrecyLayout->addWidget(mSecrecyCombo); 235 secrecyLayout->addWidget(mSecrecyCombo);
229} 236}
230 237
231void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) 238void KOEditorGeneral::initDescription(QWidget *parent,Q3BoxLayout *topLayout)
232{ 239{
233 mDescriptionEdit = new KTextEdit(parent); 240 mDescriptionEdit = new KTextEdit(parent);
234 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); 241 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
235 mDescriptionEdit->append(""); 242 mDescriptionEdit->append("");
236 mDescriptionEdit->setReadOnly(false); 243 mDescriptionEdit->setReadOnly(false);
237 mDescriptionEdit->setOverwriteMode(false); 244 mDescriptionEdit->setOverwriteMode(false);
238 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); 245 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
239 topLayout->addWidget(mDescriptionEdit); 246 topLayout->addWidget(mDescriptionEdit);
240#ifndef DESKTOP_VERSION 247#ifndef DESKTOP_VERSION
241 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); 248 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
242#endif 249#endif
243 250
244} 251}
245 252
246void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) 253void KOEditorGeneral::initAlarm(QWidget *parent,Q3BoxLayout *topLayout)
247{ 254{
248 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); 255 Q3BoxLayout *alarmLayout = new Q3HBoxLayout(topLayout);
249 256
250 //mAlarmBell = new QLabel(parent); 257 //mAlarmBell = new QLabel(parent);
251 //mAlarmBell->setPixmap(SmallIcon("bell")); 258 //mAlarmBell->setPixmap(SmallIcon("bell"));
252 //alarmLayout->addWidget(mAlarmBell); 259 //alarmLayout->addWidget(mAlarmBell);
253 if ( QApplication::desktop()->width() < 320 ) 260 if ( QApplication::desktop()->width() < 320 )
254 mAlarmButton = new QCheckBox(i18n("Rem."),parent); 261 mAlarmButton = new QCheckBox(i18n("Rem."),parent);
255 else 262 else
256 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); 263 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent);
257 264
258 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); 265 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool)));
259 alarmLayout->addWidget(mAlarmButton); 266 alarmLayout->addWidget(mAlarmButton);
260 267
261 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 268 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
262 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); 269 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus );
263 alarmLayout->addWidget(mAlarmTimeEdit); 270 alarmLayout->addWidget(mAlarmTimeEdit);
264 mAlarmIncrCombo = new QComboBox(false, parent); 271 mAlarmIncrCombo = new QComboBox(false, parent);
@@ -515,33 +522,33 @@ void KOEditorGeneral::readIncidence(Incidence *event)
515 int a[] = { 1,5,10,15,30,60,180, 1440 }; 522 int a[] = { 1,5,10,15,30,60,180, 1440 };
516 int index = KOPrefs::instance()->mAlarmTime; 523 int index = KOPrefs::instance()->mAlarmTime;
517 if (index < 0 || index > 7) { 524 if (index < 0 || index > 7) {
518 alarmTime = 15; 525 alarmTime = 15;
519 } else { 526 } else {
520 alarmTime = a[index]; 527 alarmTime = a[index];
521 } 528 }
522 mAlarmTimeEdit->setValue(alarmTime); 529 mAlarmTimeEdit->setValue(alarmTime);
523 } 530 }
524 mAlarmButton->setChecked( event->isAlarmEnabled() ); 531 mAlarmButton->setChecked( event->isAlarmEnabled() );
525 mSecrecyCombo->setCurrentItem(event->secrecy()); 532 mSecrecyCombo->setCurrentItem(event->secrecy());
526 mCancelBox->setChecked( event->cancelled() ); 533 mCancelBox->setChecked( event->cancelled() );
527 mAlarmProgramButton->setOn(false); 534 mAlarmProgramButton->setOn(false);
528 mAlarmSoundButton->setOn(false); 535 mAlarmSoundButton->setOn(false);
529 536
530 // set up alarm stuff 537 // set up alarm stuff
531 QPtrList<Alarm> alarms = event->alarms(); 538 Q3PtrList<Alarm> alarms = event->alarms();
532 Alarm* alarm; 539 Alarm* alarm;
533 mAlarmIncrCombo->setCurrentItem(0); 540 mAlarmIncrCombo->setCurrentItem(0);
534 for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { 541 for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) {
535 int offset; 542 int offset;
536 if ( alarm->hasTime() ) { 543 if ( alarm->hasTime() ) {
537 QDateTime t = alarm->time(); 544 QDateTime t = alarm->time();
538 offset = event->dtStart().secsTo( t ); 545 offset = event->dtStart().secsTo( t );
539 } else { 546 } else {
540 offset = alarm->startOffset().asSeconds(); 547 offset = alarm->startOffset().asSeconds();
541 } 548 }
542 if ( offset != 0 ) { 549 if ( offset != 0 ) {
543 offset = offset / -60; // make minutes 550 offset = offset / -60; // make minutes
544 if (offset % 60 == 0) { // divides evenly into hours? 551 if (offset % 60 == 0) { // divides evenly into hours?
545 offset = offset / 60; 552 offset = offset / 60;
546 mAlarmIncrCombo->setCurrentItem(1); 553 mAlarmIncrCombo->setCurrentItem(1);
547 if (offset % 24 == 0) { // divides evenly into days? 554 if (offset % 24 == 0) { // divides evenly into days?
@@ -577,33 +584,33 @@ void KOEditorGeneral::readIncidence(Incidence *event)
577} 584}
578 585
579void KOEditorGeneral::writeIncidence(Incidence *event) 586void KOEditorGeneral::writeIncidence(Incidence *event)
580{ 587{
581 // kdDebug() << "KOEditorGeneral::writeEvent()" << endl; 588 // kdDebug() << "KOEditorGeneral::writeEvent()" << endl;
582 mLocationEdit->save(KOLocationBox::LOCATION); 589 mLocationEdit->save(KOLocationBox::LOCATION);
583 event->setSummary(mSummaryEdit->currentText()); 590 event->setSummary(mSummaryEdit->currentText());
584 event->setLocation(mLocationEdit->currentText()); 591 event->setLocation(mLocationEdit->currentText());
585 event->setDescription(mDescriptionEdit->text()); 592 event->setDescription(mDescriptionEdit->text());
586 event->setCategories(mCategoriesLabel->text()); 593 event->setCategories(mCategoriesLabel->text());
587 event->setSecrecy(mSecrecyCombo->currentItem()); 594 event->setSecrecy(mSecrecyCombo->currentItem());
588 event->setCancelled(mCancelBox->isChecked() );; 595 event->setCancelled(mCancelBox->isChecked() );;
589 // alarm stuff 596 // alarm stuff
590 if (mAlarmButton->isChecked()) { 597 if (mAlarmButton->isChecked()) {
591 if (event->alarms().count() == 0) 598 if (event->alarms().count() == 0)
592 event->newAlarm(); 599 event->newAlarm();
593 QPtrList<Alarm> alarms = event->alarms(); 600 Q3PtrList<Alarm> alarms = event->alarms();
594 Alarm *alarm; 601 Alarm *alarm;
595 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 602 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
596 alarm->setEnabled(true); 603 alarm->setEnabled(true);
597 int j = mAlarmTimeEdit->value()* -60; 604 int j = mAlarmTimeEdit->value()* -60;
598 if (mAlarmIncrCombo->currentItem() == 1) 605 if (mAlarmIncrCombo->currentItem() == 1)
599 j = j * 60; 606 j = j * 60;
600 else if (mAlarmIncrCombo->currentItem() == 2) 607 else if (mAlarmIncrCombo->currentItem() == 2)
601 j = j * (60 * 24); 608 j = j * (60 * 24);
602 alarm->setStartOffset( j ); 609 alarm->setStartOffset( j );
603 610
604 if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) { 611 if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) {
605 alarm->setProcedureAlarm(mAlarmProgram); 612 alarm->setProcedureAlarm(mAlarmProgram);
606 } 613 }
607 else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) 614 else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn())
608 alarm->setAudioAlarm(mAlarmSound); 615 alarm->setAudioAlarm(mAlarmSound);
609 else 616 else
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h
index b10a5d4..45f26fd 100644
--- a/korganizer/koeditorgeneral.h
+++ b/korganizer/koeditorgeneral.h
@@ -10,69 +10,70 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOEDITORGENERAL_H 23#ifndef KOEDITORGENERAL_H
24#define KOEDITORGENERAL_H 24#define KOEDITORGENERAL_H
25 25
26#include <qframe.h> 26#include <q3frame.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qcheckbox.h> 28#include <qcheckbox.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qpopupmenu.h> 30#include <q3popupmenu.h>
31#include <qgroupbox.h> 31#include <q3groupbox.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qlistview.h> 34#include <q3listview.h>
35#include <qradiobutton.h> 35#include <qradiobutton.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qcombobox.h> 38#include <qcombobox.h>
39#include <Q3BoxLayout>
39 40
40#include <ktextedit.h> 41#include <ktextedit.h>
41#include <krestrictedline.h> 42#include <krestrictedline.h>
42 43
43#include <libkcal/incidence.h> 44#include <libkcal/incidence.h>
44 45
45#include "ktimeedit.h" 46#include "ktimeedit.h"
46 47
47class KDateEdit; 48class KDateEdit;
48class KOLocationBox; 49class KOLocationBox;
49using namespace KCal; 50using namespace KCal;
50 51
51class KOEditorGeneral : public QObject 52class KOEditorGeneral : public QObject
52{ 53{
53 Q_OBJECT 54 Q_OBJECT
54 public: 55 public:
55 KOEditorGeneral (QObject* parent=0,const char* name=0); 56 KOEditorGeneral (QObject* parent=0,const char* name=0);
56 virtual ~KOEditorGeneral(); 57 virtual ~KOEditorGeneral();
57 void setFocusOn( int i ); 58 void setFocusOn( int i );
58 void initHeader(QWidget *,QBoxLayout *); 59 void initHeader(QWidget *,Q3BoxLayout *);
59 void initDescription(QWidget *,QBoxLayout *); 60 void initDescription(QWidget *,Q3BoxLayout *);
60 void initSecrecy(QWidget *,QBoxLayout *); 61 void initSecrecy(QWidget *,Q3BoxLayout *);
61 void initCategories(QWidget *,QBoxLayout *); 62 void initCategories(QWidget *,Q3BoxLayout *);
62 void initAlarm(QWidget *,QBoxLayout *); 63 void initAlarm(QWidget *,Q3BoxLayout *);
63 64
64 /** Set widgets to default values */ 65 /** Set widgets to default values */
65 void setDefaults(bool allDay); 66 void setDefaults(bool allDay);
66 /** Read event object and setup widgets accordingly */ 67 /** Read event object and setup widgets accordingly */
67 void readIncidence(Incidence *); 68 void readIncidence(Incidence *);
68 /** Write event settings to event object */ 69 /** Write event settings to event object */
69 void writeIncidence(Incidence *); 70 void writeIncidence(Incidence *);
70 71
71 /** Check if the input is valid. */ 72 /** Check if the input is valid. */
72 bool validateInput() { return true; } 73 bool validateInput() { return true; }
73 74
74 void enableAlarm( bool enable ); 75 void enableAlarm( bool enable );
75 void setSecrecy( int num ); 76 void setSecrecy( int num );
76 int getCalendarID(); 77 int getCalendarID();
77 public slots: 78 public slots:
78 void setCategories(const QString &); 79 void setCategories(const QString &);
@@ -102,24 +103,24 @@ class KOEditorGeneral : public QObject
102 KOLocationBox *mLocationEdit; 103 KOLocationBox *mLocationEdit;
103 QComboBox *mCalendarBox; 104 QComboBox *mCalendarBox;
104 QLabel *mAlarmBell; 105 QLabel *mAlarmBell;
105 QCheckBox *mAlarmButton; 106 QCheckBox *mAlarmButton;
106 QSpinBox *mAlarmTimeEdit; 107 QSpinBox *mAlarmTimeEdit;
107 QPushButton *mAlarmSoundButton; 108 QPushButton *mAlarmSoundButton;
108 QPushButton *mAlarmProgramButton; 109 QPushButton *mAlarmProgramButton;
109 QComboBox *mAlarmIncrCombo; 110 QComboBox *mAlarmIncrCombo;
110 KTextEdit *mDescriptionEdit; 111 KTextEdit *mDescriptionEdit;
111 QLabel *mOwnerLabel; 112 QLabel *mOwnerLabel;
112 QComboBox *mSecrecyCombo; 113 QComboBox *mSecrecyCombo;
113 QCheckBox *mCancelBox; 114 QCheckBox *mCancelBox;
114 QPushButton *mCategoriesButton; 115 QPushButton *mCategoriesButton;
115 QPushButton *mCategoriesLabel; 116 QPushButton *mCategoriesLabel;
116 117
117 private: 118 private:
118 QPopupMenu * mCatPopup; 119 Q3PopupMenu * mCatPopup;
119 QString getFittingPath( const QString &) ; 120 QString getFittingPath( const QString &) ;
120 QString mAlarmSound; 121 QString mAlarmSound;
121 QString mAlarmProgram; 122 QString mAlarmProgram;
122 QString mAlarmMessage; 123 QString mAlarmMessage;
123}; 124};
124 125
125#endif 126#endif
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp
index 2c6ed9f..73a4139 100644
--- a/korganizer/koeditorgeneralevent.cpp
+++ b/korganizer/koeditorgeneralevent.cpp
@@ -10,37 +10,43 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qvbox.h> 26#include <q3vbox.h>
27#include <qbuttongroup.h> 27#include <q3buttongroup.h>
28#include <qvgroupbox.h> 28#include <q3vgroupbox.h>
29#include <qwidgetstack.h> 29#include <q3widgetstack.h>
30#include <qdatetime.h> 30#include <qdatetime.h>
31//Added by qt3to4:
32#include <Q3HBoxLayout>
33#include <Q3GridLayout>
34#include <Q3Frame>
35#include <QLabel>
36#include <Q3VBoxLayout>
31 37
32#include <kdebug.h> 38#include <kdebug.h>
33#include <kglobal.h> 39#include <kglobal.h>
34#include <kdialog.h> 40#include <kdialog.h>
35#include <klocale.h> 41#include <klocale.h>
36#include <kiconloader.h> 42#include <kiconloader.h>
37#include <kmessagebox.h> 43#include <kmessagebox.h>
38#include <kfiledialog.h> 44#include <kfiledialog.h>
39#include <kstandarddirs.h> 45#include <kstandarddirs.h>
40 46
41#include <libkcal/event.h> 47#include <libkcal/event.h>
42 48
43#include <libkdepim/kdateedit.h> 49#include <libkdepim/kdateedit.h>
44 50
45#include "koprefs.h" 51#include "koprefs.h"
46 52
@@ -71,98 +77,98 @@ void KOEditorGeneralEvent::finishSetup()
71// QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit ); 77// QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit );
72// QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit ); 78// QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit );
73// QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit ); 79// QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit );
74// QWidget::setTabOrder( mEndTimeEdit, mNoTimeButton ); 80// QWidget::setTabOrder( mEndTimeEdit, mNoTimeButton );
75// QWidget::setTabOrder( mNoTimeButton, mAlarmButton ); 81// QWidget::setTabOrder( mNoTimeButton, mAlarmButton );
76// QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit ); 82// QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit );
77// QWidget::setTabOrder( mFreeTimeCombo, mCategoriesButton ); 83// QWidget::setTabOrder( mFreeTimeCombo, mCategoriesButton );
78// QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo ); 84// QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo );
79// QWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit ); 85// QWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit );
80 86
81 87
82 88
83 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); 89 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT);
84 mSummaryEdit->setFocus(); 90 mSummaryEdit->setFocus();
85} 91}
86 92
87void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout) 93void KOEditorGeneralEvent::initTime(QWidget *parent,Q3BoxLayout *topLayout)
88{ 94{
89 QBoxLayout *timeLayout = new QVBoxLayout(topLayout); 95 Q3BoxLayout *timeLayout = new Q3VBoxLayout(topLayout);
90 96
91 QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, 97 Q3GroupBox *timeGroupBox = new Q3GroupBox(1,Qt::Horizontal,
92 i18n("Date && Time"),parent); 98 i18n("Date && Time"),parent);
93 timeLayout->addWidget(timeGroupBox); 99 timeLayout->addWidget(timeGroupBox);
94 100
95 timeGroupBox->layout()->setSpacing( KDialog::spacingHintSmall() ); 101 timeGroupBox->layout()->setSpacing( KDialog::spacingHintSmall() );
96 timeGroupBox->layout()->setMargin( KDialog::marginHint() ); 102 timeGroupBox->layout()->setMargin( KDialog::marginHint() );
97 QFrame *timeBoxFrame = new QFrame(timeGroupBox); 103 Q3Frame *timeBoxFrame = new Q3Frame(timeGroupBox);
98 104
99 QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,2,3); 105 Q3GridLayout *layoutTimeBox = new Q3GridLayout(timeBoxFrame,2,3);
100 layoutTimeBox->setSpacing(topLayout->spacing()); 106 layoutTimeBox->setSpacing(topLayout->spacing());
101 107
102 mStartDateLabel = new QLabel(i18n("Start:"),timeBoxFrame); 108 mStartDateLabel = new QLabel(i18n("Start:"),timeBoxFrame);
103 layoutTimeBox->addWidget(mStartDateLabel,0,0); 109 layoutTimeBox->addWidget(mStartDateLabel,0,0);
104 110
105 mStartDateEdit = new KDateEdit(timeBoxFrame); 111 mStartDateEdit = new KDateEdit(timeBoxFrame);
106 layoutTimeBox->addWidget(mStartDateEdit,0,1); 112 layoutTimeBox->addWidget(mStartDateEdit,0,1);
107 113
108 mStartTimeEdit = new KOTimeEdit(timeBoxFrame); 114 mStartTimeEdit = new KOTimeEdit(timeBoxFrame);
109 layoutTimeBox->addWidget(mStartTimeEdit,0,2); 115 layoutTimeBox->addWidget(mStartTimeEdit,0,2);
110 116
111 117
112 mEndDateLabel = new QLabel(i18n("End:"),timeBoxFrame); 118 mEndDateLabel = new QLabel(i18n("End:"),timeBoxFrame);
113 layoutTimeBox->addWidget(mEndDateLabel,1,0); 119 layoutTimeBox->addWidget(mEndDateLabel,1,0);
114 120
115 mEndDateEdit = new KDateEdit(timeBoxFrame); 121 mEndDateEdit = new KDateEdit(timeBoxFrame);
116 layoutTimeBox->addWidget(mEndDateEdit,1,1); 122 layoutTimeBox->addWidget(mEndDateEdit,1,1);
117 123
118 mEndTimeEdit = new KOTimeEdit(timeBoxFrame); 124 mEndTimeEdit = new KOTimeEdit(timeBoxFrame);
119 layoutTimeBox->addWidget(mEndTimeEdit,1,2); 125 layoutTimeBox->addWidget(mEndTimeEdit,1,2);
120 QWidget* duration = new QWidget( timeBoxFrame ); 126 QWidget* duration = new QWidget( timeBoxFrame );
121 QHBoxLayout *flagsBox = new QHBoxLayout( duration ); 127 Q3HBoxLayout *flagsBox = new Q3HBoxLayout( duration );
122 mNoTimeButton = new QCheckBox(i18n("All day event"),duration); 128 mNoTimeButton = new QCheckBox(i18n("All day event"),duration);
123 flagsBox->addWidget(mNoTimeButton); 129 flagsBox->addWidget(mNoTimeButton);
124 connect(mNoTimeButton, SIGNAL(toggled(bool)),SLOT(dontAssociateTime(bool))); 130 connect(mNoTimeButton, SIGNAL(toggled(bool)),SLOT(dontAssociateTime(bool)));
125 mDurationLabel = new QLabel( duration ); 131 mDurationLabel = new QLabel( duration );
126 // if ( KOPrefs::instance()->mCompactDialogs ) { 132 // if ( KOPrefs::instance()->mCompactDialogs ) {
127 //layoutTimeBox->addMultiCellWidget( mDurationLabel, 3, 3, 0, 3 ); 133 //layoutTimeBox->addMultiCellWidget( mDurationLabel, 3, 3, 0, 3 );
128 //} else { 134 //} else {
129 flagsBox->addWidget( mDurationLabel ); 135 flagsBox->addWidget( mDurationLabel );
130 //} 136 //}
131 flagsBox->setStretchFactor(mDurationLabel, 10 ); 137 flagsBox->setStretchFactor(mDurationLabel, 10 );
132 mDurationLabel->setAlignment( AlignRight | AlignVCenter); 138 mDurationLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter);
133 layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 ); 139 layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 );
134 140
135 // time widgets are checked if they contain a valid time 141 // time widgets are checked if they contain a valid time
136 connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)), 142 connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)),
137 this, SLOT(startTimeChanged(QTime))); 143 this, SLOT(startTimeChanged(QTime)));
138 connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)), 144 connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)),
139 this, SLOT(endTimeChanged(QTime))); 145 this, SLOT(endTimeChanged(QTime)));
140 146
141 // date widgets are checked if they contain a valid date 147 // date widgets are checked if they contain a valid date
142 connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), 148 connect(mStartDateEdit, SIGNAL(dateChanged(QDate)),
143 this, SLOT(startDateChanged(QDate))); 149 this, SLOT(startDateChanged(QDate)));
144 connect(mEndDateEdit, SIGNAL(dateChanged(QDate)), 150 connect(mEndDateEdit, SIGNAL(dateChanged(QDate)),
145 this, SLOT(endDateChanged(QDate))); 151 this, SLOT(endDateChanged(QDate)));
146 connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(sTimeChanged(QTime))); 152 connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(sTimeChanged(QTime)));
147 connect(mEndDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(eTimeChanged(QTime))); 153 connect(mEndDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(eTimeChanged(QTime)));
148} 154}
149 155
150void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout) 156void KOEditorGeneralEvent::initClass(QWidget *parent,Q3BoxLayout *topLayout)
151{ 157{
152 QBoxLayout *classLayout = new QHBoxLayout(topLayout); 158 Q3BoxLayout *classLayout = new Q3HBoxLayout(topLayout);
153 159
154 QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent); 160 QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent);
155 classLayout->addWidget(freeTimeLabel); 161 classLayout->addWidget(freeTimeLabel);
156 162
157 mFreeTimeCombo = new QComboBox(false, parent); 163 mFreeTimeCombo = new QComboBox(false, parent);
158 mFreeTimeCombo->insertItem(i18n("Busy")); 164 mFreeTimeCombo->insertItem(i18n("Busy"));
159 mFreeTimeCombo->insertItem(i18n("Free")); 165 mFreeTimeCombo->insertItem(i18n("Free"));
160 classLayout->addWidget(mFreeTimeCombo); 166 classLayout->addWidget(mFreeTimeCombo);
161} 167}
162 168
163void KOEditorGeneralEvent::timeStuffDisable(bool disable) 169void KOEditorGeneralEvent::timeStuffDisable(bool disable)
164{ 170{
165 mStartTimeEdit->setEnabled( !disable ); 171 mStartTimeEdit->setEnabled( !disable );
166 mEndTimeEdit->setEnabled( !disable ); 172 mEndTimeEdit->setEnabled( !disable );
167 173
168 setDuration(); 174 setDuration();
diff --git a/korganizer/koeditorgeneralevent.h b/korganizer/koeditorgeneralevent.h
index d798905..5d97a5c 100644
--- a/korganizer/koeditorgeneralevent.h
+++ b/korganizer/koeditorgeneralevent.h
@@ -10,62 +10,62 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef _KOEDITORGENERALEVENT_H 23#ifndef _KOEDITORGENERALEVENT_H
24#define _KOEDITORGENERALEVENT_H 24#define _KOEDITORGENERALEVENT_H
25 25
26#include <qframe.h> 26#include <q3frame.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qcheckbox.h> 28#include <qcheckbox.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qgroupbox.h> 30#include <q3groupbox.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qcombobox.h> 32#include <qcombobox.h>
33#include <qmultilineedit.h> 33#include <q3multilineedit.h>
34#include <qlistview.h> 34#include <q3listview.h>
35#include <qradiobutton.h> 35#include <qradiobutton.h>
36 36
37#include <krestrictedline.h> 37#include <krestrictedline.h>
38 38
39#include "koeditorgeneral.h" 39#include "koeditorgeneral.h"
40 40
41#include "ktimeedit.h" 41#include "ktimeedit.h"
42 42
43class KDateEdit; 43class KDateEdit;
44 44
45using namespace KCal; 45using namespace KCal;
46 46
47class KOEditorGeneralEvent : public KOEditorGeneral 47class KOEditorGeneralEvent : public KOEditorGeneral
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 KOEditorGeneralEvent (QObject* parent=0,const char* name=0); 51 KOEditorGeneralEvent (QObject* parent=0,const char* name=0);
52 virtual ~KOEditorGeneralEvent(); 52 virtual ~KOEditorGeneralEvent();
53 53
54 void initTime(QWidget *,QBoxLayout *); 54 void initTime(QWidget *,Q3BoxLayout *);
55 void initClass(QWidget *,QBoxLayout *); 55 void initClass(QWidget *,Q3BoxLayout *);
56 56
57 void finishSetup(); 57 void finishSetup();
58 58
59 /** Set widgets to default values */ 59 /** Set widgets to default values */
60 void setDefaults(QDateTime from,QDateTime to,bool allDay); 60 void setDefaults(QDateTime from,QDateTime to,bool allDay);
61 /** 61 /**
62 Read event object and setup widgets accordingly. If templ is true, the 62 Read event object and setup widgets accordingly. If templ is true, the
63 event is read as template, i.e. the time and date information isn't set. 63 event is read as template, i.e. the time and date information isn't set.
64 */ 64 */
65 void readEvent( Event *, bool tmpl = false ); 65 void readEvent( Event *, bool tmpl = false );
66 /** Write event settings to event object */ 66 /** Write event settings to event object */
67 void writeEvent(Event *); 67 void writeEvent(Event *);
68 68
69 /** Check if the input is valid. */ 69 /** Check if the input is valid. */
70 bool validateInput(); 70 bool validateInput();
71 71
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index d32d5a5..baee9fc 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -9,40 +9,47 @@
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qfiledialog.h> 25#include <q3filedialog.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <q3vbox.h>
28#include <qbuttongroup.h> 28#include <q3buttongroup.h>
29#include <qvgroupbox.h> 29#include <q3vgroupbox.h>
30#include <qwidgetstack.h> 30#include <q3widgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qapplication.h> 32#include <qapplication.h>
33#include <QDesktopWidget>
34//Added by qt3to4:
35#include <Q3HBoxLayout>
36#include <Q3GridLayout>
37#include <Q3Frame>
38#include <QLabel>
39#include <Q3VBoxLayout>
33 40
34#include <kglobal.h> 41#include <kglobal.h>
35#include <klocale.h> 42#include <klocale.h>
36#include <kiconloader.h> 43#include <kiconloader.h>
37#include <kmessagebox.h> 44#include <kmessagebox.h>
38#include <kdebug.h> 45#include <kdebug.h>
39#include <krestrictedline.h> 46#include <krestrictedline.h>
40#include <kstandarddirs.h> 47#include <kstandarddirs.h>
41#include <kfiledialog.h> 48#include <kfiledialog.h>
42#include <kdialog.h> 49#include <kdialog.h>
43 50
44#include <libkcal/todo.h> 51#include <libkcal/todo.h>
45 52
46#include <libkdepim/kdateedit.h> 53#include <libkdepim/kdateedit.h>
47 54
48#include "koprefs.h" 55#include "koprefs.h"
@@ -69,44 +76,44 @@ void KOEditorGeneralTodo::finishSetup()
69// QWidget::setTabOrder(mDueCheck, mDueDateEdit); 76// QWidget::setTabOrder(mDueCheck, mDueDateEdit);
70// QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); 77// QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit);
71// QWidget::setTabOrder(mDueTimeEdit, mStartCheck); 78// QWidget::setTabOrder(mDueTimeEdit, mStartCheck);
72// QWidget::setTabOrder(mStartCheck, mStartDateEdit); 79// QWidget::setTabOrder(mStartCheck, mStartDateEdit);
73// QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); 80// QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit);
74// QWidget::setTabOrder(mStartTimeEdit, mTimeButton); 81// QWidget::setTabOrder(mStartTimeEdit, mTimeButton);
75// QWidget::setTabOrder(mTimeButton, mCompletedCombo); 82// QWidget::setTabOrder(mTimeButton, mCompletedCombo);
76// QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); 83// QWidget::setTabOrder(mCompletedCombo, mPriorityCombo);
77// QWidget::setTabOrder(mPriorityCombo, mAlarmButton); 84// QWidget::setTabOrder(mPriorityCombo, mAlarmButton);
78// QWidget::setTabOrder(mAlarmButton, mCategoriesButton); 85// QWidget::setTabOrder(mAlarmButton, mCategoriesButton);
79// QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); 86// QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo);
80// QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); 87// QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit);
81 mSummaryEdit->load(KOLocationBox::SUMMARYTODO); 88 mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
82 mSummaryEdit->setFocus(); 89 mSummaryEdit->setFocus();
83} 90}
84 91
85void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) 92void KOEditorGeneralTodo::initTime(QWidget *parent,Q3BoxLayout *topLayout)
86{ 93{
87 QBoxLayout *timeLayout = new QVBoxLayout(topLayout); 94 Q3BoxLayout *timeLayout = new Q3VBoxLayout(topLayout);
88 95
89 QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, 96 Q3GroupBox *timeGroupBox = new Q3GroupBox(1,Qt::Horizontal,
90 i18n("Date && Time"),parent); 97 i18n("Date && Time"),parent);
91 timeLayout->addWidget(timeGroupBox); 98 timeLayout->addWidget(timeGroupBox);
92 timeGroupBox->layout()->setSpacing( KDialog::spacingHint()-2 ); 99 timeGroupBox->layout()->setSpacing( KDialog::spacingHint()-2 );
93 timeGroupBox->layout()->setMargin( KDialog::marginHint() ); 100 timeGroupBox->layout()->setMargin( KDialog::marginHint() );
94 QFrame *timeBoxFrame = new QFrame(timeGroupBox); 101 Q3Frame *timeBoxFrame = new Q3Frame(timeGroupBox);
95 102
96 QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); 103 Q3GridLayout *layoutTimeBox = new Q3GridLayout(timeBoxFrame,3,3);
97 layoutTimeBox->setSpacing(KDialog::spacingHintSmall()); 104 layoutTimeBox->setSpacing(KDialog::spacingHintSmall());
98 layoutTimeBox->setColStretch( 1, 1 ); 105 layoutTimeBox->setColStretch( 1, 1 );
99 106
100 mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); 107 mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame);
101 layoutTimeBox->addWidget(mStartCheck,0,0); 108 layoutTimeBox->addWidget(mStartCheck,0,0);
102 connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); 109 connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool)));
103 110
104 mStartDateEdit = new KDateEdit(timeBoxFrame); 111 mStartDateEdit = new KDateEdit(timeBoxFrame);
105 layoutTimeBox->addWidget(mStartDateEdit,0,1); 112 layoutTimeBox->addWidget(mStartDateEdit,0,1);
106 113
107 mStartTimeEdit = new KOTimeEdit(timeBoxFrame); 114 mStartTimeEdit = new KOTimeEdit(timeBoxFrame);
108 layoutTimeBox->addWidget(mStartTimeEdit,0,2); 115 layoutTimeBox->addWidget(mStartTimeEdit,0,2);
109 116
110 mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); 117 mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame);
111 layoutTimeBox->addWidget(mDueCheck,1,0); 118 layoutTimeBox->addWidget(mDueCheck,1,0);
112 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); 119 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool)));
@@ -120,33 +127,33 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
120 layoutTimeBox->addWidget(mDueTimeEdit,1,2); 127 layoutTimeBox->addWidget(mDueTimeEdit,1,2);
121 128
122 129
123 mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); 130 mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame);
124 layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); 131 layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1);
125 132
126 connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); 133 connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool)));
127 connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime))); 134 connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime)));
128 connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime))); 135 connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime)));
129 connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), 136 connect(mStartDateEdit, SIGNAL(dateChanged(QDate)),
130 this, SLOT(startDateChanged(QDate))); 137 this, SLOT(startDateChanged(QDate)));
131 // some more layouting 138 // some more layouting
132 //layoutTimeBox->setColStretch(3,1); 139 //layoutTimeBox->setColStretch(3,1);
133} 140}
134 141
135 142
136void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) 143void KOEditorGeneralTodo::initCompletion(QWidget *parent, Q3BoxLayout *topLayout)
137{ 144{
138 mCompletedCombo = new QComboBox(parent); 145 mCompletedCombo = new QComboBox(parent);
139 // xgettext:no-c-format 146 // xgettext:no-c-format
140 mCompletedCombo->insertItem(i18n(" 0 %")); 147 mCompletedCombo->insertItem(i18n(" 0 %"));
141 // xgettext:no-c-format 148 // xgettext:no-c-format
142 mCompletedCombo->insertItem(i18n(" 20 %")); 149 mCompletedCombo->insertItem(i18n(" 20 %"));
143 // xgettext:no-c-format 150 // xgettext:no-c-format
144 mCompletedCombo->insertItem(i18n(" 40 %")); 151 mCompletedCombo->insertItem(i18n(" 40 %"));
145 // xgettext:no-c-format 152 // xgettext:no-c-format
146 mCompletedCombo->insertItem(i18n(" 60 %")); 153 mCompletedCombo->insertItem(i18n(" 60 %"));
147 // xgettext:no-c-format 154 // xgettext:no-c-format
148 mCompletedCombo->insertItem(i18n(" 80 %")); 155 mCompletedCombo->insertItem(i18n(" 80 %"));
149 // xgettext:no-c-format 156 // xgettext:no-c-format
150 mCompletedCombo->insertItem(i18n("100 %")); 157 mCompletedCombo->insertItem(i18n("100 %"));
151 connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); 158 connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int)));
152 topLayout->addWidget(mCompletedCombo); 159 topLayout->addWidget(mCompletedCombo);
@@ -160,51 +167,51 @@ void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout)
160 mCompleteTimeEdit = new KOTimeEdit(parent); 167 mCompleteTimeEdit = new KOTimeEdit(parent);
161 topLayout->addWidget( mCompleteTimeEdit); 168 topLayout->addWidget( mCompleteTimeEdit);
162 169
163 mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); 170 mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) );
164 mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); 171 mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) );
165 connect(mCompleteDateEdit,SIGNAL(setTimeTo(QTime)),mCompleteTimeEdit,SLOT(setTime(QTime))); 172 connect(mCompleteDateEdit,SIGNAL(setTimeTo(QTime)),mCompleteTimeEdit,SLOT(setTime(QTime)));
166 173
167 if ( QApplication::desktop()->width() <= 480 ) { 174 if ( QApplication::desktop()->width() <= 480 ) {
168 if ( QApplication::desktop()->width() < 320 ) 175 if ( QApplication::desktop()->width() < 320 )
169 mCompleteDateEdit->setMaximumWidth( 85 ); 176 mCompleteDateEdit->setMaximumWidth( 85 );
170 else 177 else
171 mCompleteDateEdit->setMaximumWidth( 140 ); 178 mCompleteDateEdit->setMaximumWidth( 140 );
172 topLayout->setSpacing( 0 ); 179 topLayout->setSpacing( 0 );
173 } 180 }
174} 181}
175 182
176void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) 183void KOEditorGeneralTodo::initPriority(QWidget *parent, Q3BoxLayout *topLayout)
177{ 184{
178 185
179 QHBox* h = new QHBox ( parent ); 186 Q3HBox* h = new Q3HBox ( parent );
180 topLayout->addWidget( h ); 187 topLayout->addWidget( h );
181 QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); 188 QLabel *priorityLabel = new QLabel(i18n("Priority:"), h);
182 // topLayout->addWidget(priorityLabel); 189 // topLayout->addWidget(priorityLabel);
183 mPriorityCombo = new QComboBox( h ); 190 mPriorityCombo = new QComboBox( h );
184 mPriorityCombo->insertItem(i18n("1 (high)")); 191 mPriorityCombo->insertItem(i18n("1 (high)"));
185 mPriorityCombo->insertItem(i18n("2")); 192 mPriorityCombo->insertItem(i18n("2"));
186 mPriorityCombo->insertItem(i18n("3")); 193 mPriorityCombo->insertItem(i18n("3"));
187 mPriorityCombo->insertItem(i18n("4")); 194 mPriorityCombo->insertItem(i18n("4"));
188 mPriorityCombo->insertItem(i18n("5 (low)")); 195 mPriorityCombo->insertItem(i18n("5 (low)"));
189 //topLayout->addWidget(mPriorityCombo); 196 //topLayout->addWidget(mPriorityCombo);
190} 197}
191 198
192void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) 199void KOEditorGeneralTodo::initStatus(QWidget *parent,Q3BoxLayout *topLayout)
193{ 200{
194 QBoxLayout *statusLayout = new QHBoxLayout(topLayout); 201 Q3BoxLayout *statusLayout = new Q3HBoxLayout(topLayout);
195 202
196 initCompletion( parent, statusLayout ); 203 initCompletion( parent, statusLayout );
197 204
198 statusLayout->addStretch( 1 ); 205 statusLayout->addStretch( 1 );
199 206
200 initPriority( parent, statusLayout ); 207 initPriority( parent, statusLayout );
201} 208}
202 209
203void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) 210void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay)
204{ 211{
205 212
206 mSummaryEdit->load(KOLocationBox::SUMMARYTODO); 213 mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
207 mLocationEdit->load(KOLocationBox::LOCATION); 214 mLocationEdit->load(KOLocationBox::LOCATION);
208 KOEditorGeneral::setDefaults(allDay); 215 KOEditorGeneral::setDefaults(allDay);
209 216
210 mTimeButton->setChecked( !allDay ); 217 mTimeButton->setChecked( !allDay );
@@ -383,33 +390,33 @@ void KOEditorGeneralTodo::enableStartEdit( bool enable )
383 } 390 }
384 else { 391 else {
385 mTimeButton->setEnabled(false); 392 mTimeButton->setEnabled(false);
386 mTimeButton->setChecked(false); 393 mTimeButton->setChecked(false);
387 } 394 }
388 395
389 if (enable) { 396 if (enable) {
390 mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); 397 mStartTimeEdit->setEnabled( mTimeButton->isChecked() );
391 } else { 398 } else {
392 mStartTimeEdit->setEnabled( false ); 399 mStartTimeEdit->setEnabled( false );
393 } 400 }
394 emit datesChecked(); 401 emit datesChecked();
395} 402}
396void KOEditorGeneralTodo::startDateChanged(QDate newdate) 403void KOEditorGeneralTodo::startDateChanged(QDate newdate)
397{ 404{
398 if ( mDueCheck->isChecked() ) 405 if ( mDueCheck->isChecked() )
399 emit dateTimesChanged(newdate,mDueDateEdit->date()); 406 emit dateTimesChanged((QDateTime)newdate,(QDateTime)mDueDateEdit->date());
400} 407}
401void KOEditorGeneralTodo::enableTimeEdits(bool enable) 408void KOEditorGeneralTodo::enableTimeEdits(bool enable)
402{ 409{
403 if(mStartCheck->isChecked()) { 410 if(mStartCheck->isChecked()) {
404 mStartTimeEdit->setEnabled( enable ); 411 mStartTimeEdit->setEnabled( enable );
405 } 412 }
406 if(mDueCheck->isChecked()) { 413 if(mDueCheck->isChecked()) {
407 mDueTimeEdit->setEnabled( enable ); 414 mDueTimeEdit->setEnabled( enable );
408 } 415 }
409} 416}
410 417
411void KOEditorGeneralTodo::showAlarm() 418void KOEditorGeneralTodo::showAlarm()
412{ 419{
413 if ( mDueCheck->isChecked() ) { 420 if ( mDueCheck->isChecked() ) {
414 alarmDisable(false); 421 alarmDisable(false);
415 } 422 }
diff --git a/korganizer/koeditorgeneraltodo.h b/korganizer/koeditorgeneraltodo.h
index 2e56a7a..2e97ff5 100644
--- a/korganizer/koeditorgeneraltodo.h
+++ b/korganizer/koeditorgeneraltodo.h
@@ -10,63 +10,63 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef _KOEDITORGENERALTODO_H 23#ifndef _KOEDITORGENERALTODO_H
24#define _KOEDITORGENERALTODO_H 24#define _KOEDITORGENERALTODO_H
25 25
26#include <qframe.h> 26#include <q3frame.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qcheckbox.h> 28#include <qcheckbox.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qgroupbox.h> 30#include <q3groupbox.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qcombobox.h> 32#include <qcombobox.h>
33#include <qmultilineedit.h> 33#include <q3multilineedit.h>
34#include <qlistview.h> 34#include <q3listview.h>
35#include <qradiobutton.h> 35#include <qradiobutton.h>
36 36
37#include "koeditorgeneral.h" 37#include "koeditorgeneral.h"
38#include "koglobals.h" 38#include "koglobals.h"
39 39
40class KRestrictedLine; 40class KRestrictedLine;
41 41
42class KDateEdit; 42class KDateEdit;
43 43
44using namespace KCal; 44using namespace KCal;
45 45
46class KOEditorGeneralTodo : public KOEditorGeneral 46class KOEditorGeneralTodo : public KOEditorGeneral
47{ 47{
48 Q_OBJECT 48 Q_OBJECT
49 public: 49 public:
50 KOEditorGeneralTodo (QObject* parent=0,const char* name=0); 50 KOEditorGeneralTodo (QObject* parent=0,const char* name=0);
51 virtual ~KOEditorGeneralTodo(); 51 virtual ~KOEditorGeneralTodo();
52 52
53 void initTime(QWidget *, QBoxLayout *); 53 void initTime(QWidget *, Q3BoxLayout *);
54 void initStatus(QWidget *, QBoxLayout *); 54 void initStatus(QWidget *, Q3BoxLayout *);
55 void initCompletion(QWidget *, QBoxLayout *); 55 void initCompletion(QWidget *, Q3BoxLayout *);
56 void initPriority(QWidget *, QBoxLayout *); 56 void initPriority(QWidget *, Q3BoxLayout *);
57 57
58 void finishSetup(); 58 void finishSetup();
59 59
60 /** Set widgets to default values */ 60 /** Set widgets to default values */
61 void setDefaults(QDateTime due,bool allDay); 61 void setDefaults(QDateTime due,bool allDay);
62 /** Read todo object and setup widgets accordingly */ 62 /** Read todo object and setup widgets accordingly */
63 void readTodo(Todo *); 63 void readTodo(Todo *);
64 /** Write todo settings to event object */ 64 /** Write todo settings to event object */
65 void writeTodo(Todo *); 65 void writeTodo(Todo *);
66 66
67 /** Check if the input is valid. */ 67 /** Check if the input is valid. */
68 bool validateInput(); 68 bool validateInput();
69 69
70 /** The todo has been modified externally */ 70 /** The todo has been modified externally */
71 void modified (Todo*, int); 71 void modified (Todo*, int);
72 72
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index e0380c4..e0ae3a0 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -9,43 +9,51 @@
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qfiledialog.h> 25#include <q3filedialog.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <q3vbox.h>
28#include <qbuttongroup.h> 28#include <q3buttongroup.h>
29#include <qvgroupbox.h> 29#include <q3vgroupbox.h>
30#include <qwidgetstack.h> 30#include <q3widgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qlistbox.h> 32#include <q3listbox.h>
33#include <qspinbox.h> 33#include <qspinbox.h>
34#include <qcheckbox.h> 34#include <qcheckbox.h>
35#include <qapplication.h> 35#include <qapplication.h>
36#include <QDesktopWidget>
37//Added by qt3to4:
38#include <Q3HBoxLayout>
39#include <QLabel>
40#include <Q3GridLayout>
41#include <Q3PtrList>
42#include <Q3Frame>
43#include <Q3VBoxLayout>
36 44
37#include <kdialog.h> 45#include <kdialog.h>
38#include <kglobal.h> 46#include <kglobal.h>
39#include <klocale.h> 47#include <klocale.h>
40#include <kiconloader.h> 48#include <kiconloader.h>
41#include <kdebug.h> 49#include <kdebug.h>
42#include <knumvalidator.h> 50#include <knumvalidator.h>
43 51
44#include <libkcal/event.h> 52#include <libkcal/event.h>
45#include <libkcal/todo.h> 53#include <libkcal/todo.h>
46 54
47#include <libkdepim/kdateedit.h> 55#include <libkdepim/kdateedit.h>
48 56
49#include "koprefs.h" 57#include "koprefs.h"
50 58
51#include "koeditorrecurrence.h" 59#include "koeditorrecurrence.h"
@@ -68,69 +76,69 @@ void RecurBase::setFrequency( int f )
68{ 76{
69 if ( f < 1 ) f = 1; 77 if ( f < 1 ) f = 1;
70 78
71 mFrequencyEdit->setValue( f ); 79 mFrequencyEdit->setValue( f );
72} 80}
73 81
74int RecurBase::frequency() 82int RecurBase::frequency()
75{ 83{
76 return mFrequencyEdit->value(); 84 return mFrequencyEdit->value();
77} 85}
78 86
79/////////////////////////// RecurDaily /////////////////////////////// 87/////////////////////////// RecurDaily ///////////////////////////////
80 88
81RecurDaily::RecurDaily( QWidget *parent, const char *name ) : 89RecurDaily::RecurDaily( QWidget *parent, const char *name ) :
82 RecurBase( parent, name ) 90 RecurBase( parent, name )
83{ 91{
84 QBoxLayout *topLayout = new QHBoxLayout( this ); 92 Q3BoxLayout *topLayout = new Q3HBoxLayout( this );
85 topLayout->setSpacing( KDialog::spacingHint() ); 93 topLayout->setSpacing( KDialog::spacingHint() );
86 topLayout->setMargin( KDialog::marginHintSmall() ); 94 topLayout->setMargin( KDialog::marginHintSmall() );
87 95
88 QLabel *preLabel = new QLabel( i18n("Recur every"), this ); 96 QLabel *preLabel = new QLabel( i18n("Recur every"), this );
89 topLayout->addWidget( preLabel ); 97 topLayout->addWidget( preLabel );
90 98
91 topLayout->addWidget( frequencyEdit() ); 99 topLayout->addWidget( frequencyEdit() );
92 100
93 QLabel *postLabel = new QLabel( i18n("day(s)"), this ); 101 QLabel *postLabel = new QLabel( i18n("day(s)"), this );
94 topLayout->addWidget( postLabel ); 102 topLayout->addWidget( postLabel );
95} 103}
96 104
97 105
98/////////////////////////// RecurWeekly /////////////////////////////// 106/////////////////////////// RecurWeekly ///////////////////////////////
99 107
100RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) : 108RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) :
101 RecurBase( parent, name ) 109 RecurBase( parent, name )
102{ 110{
103 QBoxLayout *topLayout = new QVBoxLayout( this ); 111 Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
104 topLayout->setSpacing( KDialog::spacingHint() ); 112 topLayout->setSpacing( KDialog::spacingHint() );
105 topLayout->setMargin( KDialog::marginHintSmall() ); 113 topLayout->setMargin( KDialog::marginHintSmall() );
106 114
107 //topLayout->addStretch( 1 ); 115 //topLayout->addStretch( 1 );
108 116
109 QBoxLayout *weeksLayout = new QHBoxLayout( topLayout ); 117 Q3BoxLayout *weeksLayout = new Q3HBoxLayout( topLayout );
110 118
111 QLabel *preLabel = new QLabel( i18n("Recur every"), this ); 119 QLabel *preLabel = new QLabel( i18n("Recur every"), this );
112 weeksLayout->addWidget( preLabel ); 120 weeksLayout->addWidget( preLabel );
113 121
114 weeksLayout->addWidget( frequencyEdit() ); 122 weeksLayout->addWidget( frequencyEdit() );
115 123
116 QLabel *postLabel = new QLabel( i18n("week(s) on:"), this ); 124 QLabel *postLabel = new QLabel( i18n("week(s) on:"), this );
117 weeksLayout->addWidget( postLabel ); 125 weeksLayout->addWidget( postLabel );
118 126
119 QHBox *dayBox = new QHBox( this ); 127 Q3HBox *dayBox = new Q3HBox( this );
120 topLayout->addWidget( dayBox, 1, AlignVCenter ); 128 topLayout->addWidget( dayBox, 1, Qt::AlignVCenter );
121 // TODO: Respect start of week setting 129 // TODO: Respect start of week setting
122 for ( int i = 0; i < 7; ++i ) { 130 for ( int i = 0; i < 7; ++i ) {
123 QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true ); 131 QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true );
124 int left = 1; 132 int left = 1;
125 if ( QApplication::desktop()->width() > 480 ) { 133 if ( QApplication::desktop()->width() > 480 ) {
126 ++left; 134 ++left;
127 if ( QApplication::desktop()->width() > 640 ) 135 if ( QApplication::desktop()->width() > 640 )
128 ++left; 136 ++left;
129 } 137 }
130 mDayBoxes[ i ] = new QCheckBox( weekDayName.left( left ), dayBox ); 138 mDayBoxes[ i ] = new QCheckBox( weekDayName.left( left ), dayBox );
131 } 139 }
132 140
133 topLayout->addStretch( ); 141 topLayout->addStretch( );
134} 142}
135 143
136void RecurWeekly::setDays( const QBitArray &days ) 144void RecurWeekly::setDays( const QBitArray &days )
@@ -143,66 +151,66 @@ void RecurWeekly::setDays( const QBitArray &days )
143QBitArray RecurWeekly::days() 151QBitArray RecurWeekly::days()
144{ 152{
145 QBitArray days( 7 ); 153 QBitArray days( 7 );
146 154
147 for ( int i = 0; i < 7; ++i ) { 155 for ( int i = 0; i < 7; ++i ) {
148 days.setBit( i, mDayBoxes[ i ]->isChecked() ); 156 days.setBit( i, mDayBoxes[ i ]->isChecked() );
149 } 157 }
150 158
151 return days; 159 return days;
152} 160}
153 161
154/////////////////////////// RecurMonthly /////////////////////////////// 162/////////////////////////// RecurMonthly ///////////////////////////////
155 163
156RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) : 164RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) :
157 RecurBase( parent, name ) 165 RecurBase( parent, name )
158{ 166{
159 QBoxLayout *topLayout = new QVBoxLayout( this ); 167 Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
160 topLayout->setSpacing( KDialog::spacingHint() ); 168 topLayout->setSpacing( KDialog::spacingHint() );
161 topLayout->setMargin( KDialog::marginHintSmall() ); 169 topLayout->setMargin( KDialog::marginHintSmall() );
162 170
163 171
164 QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); 172 Q3BoxLayout *freqLayout = new Q3HBoxLayout( topLayout );
165 173
166 QLabel *preLabel = new QLabel( i18n("every"), this ); 174 QLabel *preLabel = new QLabel( i18n("every"), this );
167 freqLayout->addWidget( preLabel ); 175 freqLayout->addWidget( preLabel );
168 176
169 freqLayout->addWidget( frequencyEdit() ); 177 freqLayout->addWidget( frequencyEdit() );
170 178
171 QLabel *postLabel = new QLabel( i18n("month(s)"), this ); 179 QLabel *postLabel = new QLabel( i18n("month(s)"), this );
172 freqLayout->addWidget( postLabel ); 180 freqLayout->addWidget( postLabel );
173 181
174 182
175 QButtonGroup *buttonGroup = new QButtonGroup( this ); 183 Q3ButtonGroup *buttonGroup = new Q3ButtonGroup( this );
176 buttonGroup->setFrameStyle( QFrame::NoFrame ); 184 buttonGroup->setFrameStyle( Q3Frame::NoFrame );
177 topLayout->addWidget( buttonGroup, 1, AlignVCenter ); 185 topLayout->addWidget( buttonGroup, 1, Qt::AlignVCenter );
178 186
179 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 ); 187 Q3GridLayout *buttonLayout = new Q3GridLayout( buttonGroup, 3, 2 );
180 buttonLayout->setSpacing( KDialog::spacingHint() ); 188 buttonLayout->setSpacing( KDialog::spacingHint() );
181 buttonLayout->setMargin( KDialog::marginHintSmall() ); 189 buttonLayout->setMargin( KDialog::marginHintSmall() );
182 190
183 191
184 QString recurOnText; 192 QString recurOnText;
185 if ( QApplication::desktop()->width() > 320 ) { 193 if ( QApplication::desktop()->width() > 320 ) {
186 recurOnText = i18n("Recur on the"); 194 recurOnText = i18n("Recur on the");
187 } 195 }
188 196
189 mByDayRadio = new QRadioButton( recurOnText, buttonGroup ); 197 mByDayRadio = new QRadioButton( recurOnText, buttonGroup );
190 buttonLayout->addWidget( mByDayRadio, 0, 0 ); 198 buttonLayout->addWidget( mByDayRadio, 0, 0 );
191 199
192 mByDayCombo = new QComboBox( buttonGroup ); 200 mByDayCombo = new Q3ComboBox( buttonGroup );
193 mByDayCombo->setSizeLimit( 7 ); 201 mByDayCombo->setSizeLimit( 7 );
194 mByDayCombo->insertItem( i18n("1st") ); 202 mByDayCombo->insertItem( i18n("1st") );
195 mByDayCombo->insertItem( i18n("2nd") ); 203 mByDayCombo->insertItem( i18n("2nd") );
196 mByDayCombo->insertItem( i18n("3rd") ); 204 mByDayCombo->insertItem( i18n("3rd") );
197 mByDayCombo->insertItem( i18n("4th") ); 205 mByDayCombo->insertItem( i18n("4th") );
198 mByDayCombo->insertItem( i18n("5th") ); 206 mByDayCombo->insertItem( i18n("5th") );
199 mByDayCombo->insertItem( i18n("6th") ); 207 mByDayCombo->insertItem( i18n("6th") );
200 mByDayCombo->insertItem( i18n("7th") ); 208 mByDayCombo->insertItem( i18n("7th") );
201 mByDayCombo->insertItem( i18n("8th") ); 209 mByDayCombo->insertItem( i18n("8th") );
202 mByDayCombo->insertItem( i18n("9th") ); 210 mByDayCombo->insertItem( i18n("9th") );
203 mByDayCombo->insertItem( i18n("10th") ); 211 mByDayCombo->insertItem( i18n("10th") );
204 mByDayCombo->insertItem( i18n("11th") ); 212 mByDayCombo->insertItem( i18n("11th") );
205 mByDayCombo->insertItem( i18n("12th") ); 213 mByDayCombo->insertItem( i18n("12th") );
206 mByDayCombo->insertItem( i18n("13th") ); 214 mByDayCombo->insertItem( i18n("13th") );
207 mByDayCombo->insertItem( i18n("14th") ); 215 mByDayCombo->insertItem( i18n("14th") );
208 mByDayCombo->insertItem( i18n("15th") ); 216 mByDayCombo->insertItem( i18n("15th") );
@@ -280,60 +288,60 @@ int RecurMonthly::day()
280 288
281int RecurMonthly::count() 289int RecurMonthly::count()
282{ 290{
283 return mByPosCountCombo->currentItem() + 1; 291 return mByPosCountCombo->currentItem() + 1;
284} 292}
285 293
286int RecurMonthly::weekday() 294int RecurMonthly::weekday()
287{ 295{
288 return mByPosWeekdayCombo->currentItem(); 296 return mByPosWeekdayCombo->currentItem();
289} 297}
290 298
291/////////////////////////// RecurYearly /////////////////////////////// 299/////////////////////////// RecurYearly ///////////////////////////////
292 300
293RecurYearly::RecurYearly( QWidget *parent, const char *name ) : 301RecurYearly::RecurYearly( QWidget *parent, const char *name ) :
294 RecurBase( parent, name ) 302 RecurBase( parent, name )
295{ 303{
296 QBoxLayout *topLayout = new QVBoxLayout( this ); 304 Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
297 topLayout->setSpacing( KDialog::spacingHint() ); 305 topLayout->setSpacing( KDialog::spacingHint() );
298 topLayout->setMargin( KDialog::marginHintSmall() ); 306 topLayout->setMargin( KDialog::marginHintSmall() );
299 307
300 308
301 QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); 309 Q3BoxLayout *freqLayout = new Q3HBoxLayout( topLayout );
302 310
303 QLabel *preLabel = new QLabel( i18n("every"), this ); 311 QLabel *preLabel = new QLabel( i18n("every"), this );
304 freqLayout->addWidget( preLabel ); 312 freqLayout->addWidget( preLabel );
305 313
306 freqLayout->addWidget( frequencyEdit() ); 314 freqLayout->addWidget( frequencyEdit() );
307 315
308 QLabel *postLabel = new QLabel( i18n("year(s)"), this ); 316 QLabel *postLabel = new QLabel( i18n("year(s)"), this );
309 freqLayout->addWidget( postLabel ); 317 freqLayout->addWidget( postLabel );
310 318
311 319
312 QButtonGroup *buttonGroup = new QButtonGroup( this ); 320 Q3ButtonGroup *buttonGroup = new Q3ButtonGroup( this );
313 buttonGroup->setFrameStyle( QFrame::NoFrame ); 321 buttonGroup->setFrameStyle( Q3Frame::NoFrame );
314 topLayout->addWidget( buttonGroup, 1, AlignVCenter ); 322 topLayout->addWidget( buttonGroup, 1, Qt::AlignVCenter );
315 323
316 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 2, 3 ); 324 Q3GridLayout *buttonLayout = new Q3GridLayout( buttonGroup, 2, 3 );
317 325
318 mByMonthRadio = new QRadioButton( i18n("On day "), buttonGroup); 326 mByMonthRadio = new QRadioButton( i18n("On day "), buttonGroup);
319 buttonLayout->addWidget( mByMonthRadio, 0, 0 , Qt::AlignRight); 327 buttonLayout->addWidget( mByMonthRadio, 0, 0 , Qt::AlignRight);
320 mByDayLabel = new QLabel( i18n("%1 of ").arg(1), buttonGroup ); 328 mByDayLabel = new QLabel( i18n("%1 of ").arg(1), buttonGroup );
321 329
322 buttonLayout->addWidget( mByDayLabel, 0, 1 ); 330 buttonLayout->addWidget( mByDayLabel, 0, 1 );
323 mByMonthCombo = new QComboBox( buttonGroup ); 331 mByMonthCombo = new Q3ComboBox( buttonGroup );
324 mByMonthCombo->insertItem( i18n("January") ); 332 mByMonthCombo->insertItem( i18n("January") );
325 mByMonthCombo->insertItem( i18n("February") ); 333 mByMonthCombo->insertItem( i18n("February") );
326 mByMonthCombo->insertItem( i18n("March") ); 334 mByMonthCombo->insertItem( i18n("March") );
327 mByMonthCombo->insertItem( i18n("April") ); 335 mByMonthCombo->insertItem( i18n("April") );
328 mByMonthCombo->insertItem( i18n("May") ); 336 mByMonthCombo->insertItem( i18n("May") );
329 mByMonthCombo->insertItem( i18n("June") ); 337 mByMonthCombo->insertItem( i18n("June") );
330 mByMonthCombo->insertItem( i18n("July") ); 338 mByMonthCombo->insertItem( i18n("July") );
331 mByMonthCombo->insertItem( i18n("August") ); 339 mByMonthCombo->insertItem( i18n("August") );
332 mByMonthCombo->insertItem( i18n("September") ); 340 mByMonthCombo->insertItem( i18n("September") );
333 mByMonthCombo->insertItem( i18n("October") ); 341 mByMonthCombo->insertItem( i18n("October") );
334 mByMonthCombo->insertItem( i18n("November") ); 342 mByMonthCombo->insertItem( i18n("November") );
335 mByMonthCombo->insertItem( i18n("December") ); 343 mByMonthCombo->insertItem( i18n("December") );
336 buttonLayout->addWidget( mByMonthCombo, 0, 2,Qt::AlignLeft ); 344 buttonLayout->addWidget( mByMonthCombo, 0, 2,Qt::AlignLeft );
337 if ( QApplication::desktop()->width() <= 640 ) { 345 if ( QApplication::desktop()->width() <= 640 ) {
338 mByMonthCombo->setSizeLimit( 6 ); 346 mByMonthCombo->setSizeLimit( 6 );
339 } 347 }
@@ -370,53 +378,53 @@ bool RecurYearly::byDay()
370} 378}
371 379
372int RecurYearly::month() 380int RecurYearly::month()
373{ 381{
374 return mByMonthCombo->currentItem() + 1; 382 return mByMonthCombo->currentItem() + 1;
375} 383}
376int RecurYearly::day() 384int RecurYearly::day()
377{ 385{
378 return mDay;//mByDayCombo->currentItem() + 1; 386 return mDay;//mByDayCombo->currentItem() + 1;
379} 387}
380 388
381//////////////////////////// ExceptionsWidget ////////////////////////// 389//////////////////////////// ExceptionsWidget //////////////////////////
382 390
383ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) : 391ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) :
384 QWidget( parent, name ) 392 QWidget( parent, name )
385{ 393{
386 QBoxLayout *topLayout = new QVBoxLayout( this ); 394 Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
387 395
388 QGroupBox *groupBox = new QGroupBox( 1, Horizontal, i18n("Exceptions"), 396 Q3GroupBox *groupBox = new Q3GroupBox( 1, Qt::Horizontal, i18n("Exceptions"),
389 this ); 397 this );
390 topLayout->addWidget( groupBox ); 398 topLayout->addWidget( groupBox );
391 399
392 QWidget *box = new QWidget( groupBox ); 400 QWidget *box = new QWidget( groupBox );
393 401
394 QGridLayout *boxLayout = new QGridLayout( box ); 402 Q3GridLayout *boxLayout = new Q3GridLayout( box );
395 403
396 mExceptionDateEdit = new KDateEdit( box ); 404 mExceptionDateEdit = new KDateEdit( box );
397 boxLayout->addWidget( mExceptionDateEdit, 0, 0 ); 405 boxLayout->addWidget( mExceptionDateEdit, 0, 0 );
398 406
399 QPushButton *addExceptionButton = new QPushButton( i18n("Add"), box ); 407 QPushButton *addExceptionButton = new QPushButton( i18n("Add"), box );
400 boxLayout->addWidget( addExceptionButton, 1, 0 ); 408 boxLayout->addWidget( addExceptionButton, 1, 0 );
401 QPushButton *changeExceptionButton = new QPushButton( i18n("Change"), box ); 409 QPushButton *changeExceptionButton = new QPushButton( i18n("Change"), box );
402 boxLayout->addWidget( changeExceptionButton, 2, 0 ); 410 boxLayout->addWidget( changeExceptionButton, 2, 0 );
403 QPushButton *deleteExceptionButton = new QPushButton( i18n("Delete"), box ); 411 QPushButton *deleteExceptionButton = new QPushButton( i18n("Delete"), box );
404 boxLayout->addWidget( deleteExceptionButton, 3, 0 ); 412 boxLayout->addWidget( deleteExceptionButton, 3, 0 );
405 413
406 mExceptionList = new QListBox( box ); 414 mExceptionList = new Q3ListBox( box );
407 boxLayout->addMultiCellWidget( mExceptionList, 0, 3, 1, 1 ); 415 boxLayout->addMultiCellWidget( mExceptionList, 0, 3, 1, 1 );
408 416
409 boxLayout->setRowStretch( 4, 1 ); 417 boxLayout->setRowStretch( 4, 1 );
410 boxLayout->setColStretch( 1, 3 ); 418 boxLayout->setColStretch( 1, 3 );
411 419
412 connect( addExceptionButton, SIGNAL( clicked() ), 420 connect( addExceptionButton, SIGNAL( clicked() ),
413 SLOT( addException() ) ); 421 SLOT( addException() ) );
414 connect( changeExceptionButton, SIGNAL( clicked() ), 422 connect( changeExceptionButton, SIGNAL( clicked() ),
415 SLOT( changeException() ) ); 423 SLOT( changeException() ) );
416 connect( deleteExceptionButton, SIGNAL( clicked() ), 424 connect( deleteExceptionButton, SIGNAL( clicked() ),
417 SLOT( deleteException() ) ); 425 SLOT( deleteException() ) );
418 if ( QApplication::desktop()->width() < 480 ) { 426 if ( QApplication::desktop()->width() < 480 ) {
419 setMinimumWidth( 220 ); 427 setMinimumWidth( 220 );
420 } else { 428 } else {
421 setMinimumWidth( 440 ); 429 setMinimumWidth( 440 );
422 mExceptionDateEdit->setMinimumWidth( 200 ); 430 mExceptionDateEdit->setMinimumWidth( 200 );
@@ -493,66 +501,66 @@ void ExceptionsDialog::setDefaults( const QDateTime &from )
493void ExceptionsDialog::setDates( const DateList &dates ) 501void ExceptionsDialog::setDates( const DateList &dates )
494{ 502{
495 mExceptions->setDates( dates ); 503 mExceptions->setDates( dates );
496} 504}
497 505
498DateList ExceptionsDialog::dates() 506DateList ExceptionsDialog::dates()
499{ 507{
500 return mExceptions->dates(); 508 return mExceptions->dates();
501} 509}
502 510
503///////////////////////// RecurrenceRangeWidget /////////////////////////// 511///////////////////////// RecurrenceRangeWidget ///////////////////////////
504 512
505RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent, 513RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent,
506 const char *name ) 514 const char *name )
507 : QWidget( parent, name ) 515 : QWidget( parent, name )
508{ 516{
509 QBoxLayout *topLayout = new QVBoxLayout( this ); 517 Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
510 518
511 mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"), 519 mRangeGroupBox = new Q3GroupBox( 1, Qt::Horizontal, i18n("Recurrence Range"),
512 this ); 520 this );
513 topLayout->addWidget( mRangeGroupBox ); 521 topLayout->addWidget( mRangeGroupBox );
514 522
515 QWidget *rangeBox = new QWidget( mRangeGroupBox ); 523 QWidget *rangeBox = new QWidget( mRangeGroupBox );
516 QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox ); 524 Q3VBoxLayout *rangeLayout = new Q3VBoxLayout( rangeBox );
517 rangeLayout->setSpacing( KDialog::spacingHint() ); 525 rangeLayout->setSpacing( KDialog::spacingHint() );
518 rangeLayout->setMargin( KDialog::marginHintSmall() ); 526 rangeLayout->setMargin( KDialog::marginHintSmall() );
519 527
520 mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox ); 528 mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox );
521 rangeLayout->addWidget( mStartDateLabel ); 529 rangeLayout->addWidget( mStartDateLabel );
522 530
523 mRangeButtonGroup = new QButtonGroup; 531 mRangeButtonGroup = new Q3ButtonGroup;
524 532
525 mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox ); 533 mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox );
526 mRangeButtonGroup->insert( mNoEndDateButton ); 534 mRangeButtonGroup->insert( mNoEndDateButton );
527 rangeLayout->addWidget( mNoEndDateButton ); 535 rangeLayout->addWidget( mNoEndDateButton );
528 536
529 QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout ); 537 Q3BoxLayout *durationLayout = new Q3HBoxLayout( rangeLayout );
530 durationLayout->setSpacing( KDialog::spacingHint() ); 538 durationLayout->setSpacing( KDialog::spacingHint() );
531 539
532 mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox ); 540 mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox );
533 mRangeButtonGroup->insert( mEndDurationButton ); 541 mRangeButtonGroup->insert( mEndDurationButton );
534 durationLayout->addWidget( mEndDurationButton ); 542 durationLayout->addWidget( mEndDurationButton );
535 543
536 mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox ); 544 mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox );
537 durationLayout->addWidget( mEndDurationEdit ); 545 durationLayout->addWidget( mEndDurationEdit );
538 546
539 QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox ); 547 QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox );
540 durationLayout ->addWidget( endDurationLabel ); 548 durationLayout ->addWidget( endDurationLabel );
541 549
542 QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout ); 550 Q3BoxLayout *endDateLayout = new Q3HBoxLayout( rangeLayout );
543 endDateLayout->setSpacing( KDialog::spacingHint() ); 551 endDateLayout->setSpacing( KDialog::spacingHint() );
544 552
545 mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox ); 553 mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox );
546 mRangeButtonGroup->insert( mEndDateButton ); 554 mRangeButtonGroup->insert( mEndDateButton );
547 endDateLayout->addWidget( mEndDateButton ); 555 endDateLayout->addWidget( mEndDateButton );
548 556
549 mEndDateEdit = new KDateEdit( rangeBox ); 557 mEndDateEdit = new KDateEdit( rangeBox );
550 endDateLayout->addWidget( mEndDateEdit ); 558 endDateLayout->addWidget( mEndDateEdit );
551 559
552 //endDateLayout->addStretch( 1 ); 560 //endDateLayout->addStretch( 1 );
553 561
554 connect( mNoEndDateButton, SIGNAL( toggled( bool ) ), 562 connect( mNoEndDateButton, SIGNAL( toggled( bool ) ),
555 SLOT( showCurrentRange() ) ); 563 SLOT( showCurrentRange() ) );
556 connect( mEndDurationButton, SIGNAL( toggled( bool ) ), 564 connect( mEndDurationButton, SIGNAL( toggled( bool ) ),
557 SLOT( showCurrentRange() ) ); 565 SLOT( showCurrentRange() ) );
558 connect( mEndDateButton, SIGNAL( toggled( bool ) ), 566 connect( mEndDateButton, SIGNAL( toggled( bool ) ),
@@ -653,33 +661,33 @@ void RecurrenceRangeDialog::setEndDate( const QDate &date )
653QDate RecurrenceRangeDialog::endDate() 661QDate RecurrenceRangeDialog::endDate()
654{ 662{
655 return mRecurrenceRangeWidget->endDate(); 663 return mRecurrenceRangeWidget->endDate();
656} 664}
657 665
658void RecurrenceRangeDialog::setDateTimes( const QDateTime &start, 666void RecurrenceRangeDialog::setDateTimes( const QDateTime &start,
659 const QDateTime &end ) 667 const QDateTime &end )
660{ 668{
661 mRecurrenceRangeWidget->setDateTimes( start, end ); 669 mRecurrenceRangeWidget->setDateTimes( start, end );
662} 670}
663 671
664//////////////////////////// RecurrenceChooser //////////////////////// 672//////////////////////////// RecurrenceChooser ////////////////////////
665 673
666RecurrenceChooser::RecurrenceChooser( QWidget *parent, const char *name ) : 674RecurrenceChooser::RecurrenceChooser( QWidget *parent, const char *name ) :
667 QWidget( parent, name ) 675 QWidget( parent, name )
668{ 676{
669 QBoxLayout *topLayout = new QVBoxLayout( this ); 677 Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
670 678
671 mTypeCombo = new QComboBox( this ); 679 mTypeCombo = new QComboBox( this );
672 mTypeCombo->insertItem( i18n("Daily") ); 680 mTypeCombo->insertItem( i18n("Daily") );
673 mTypeCombo->insertItem( i18n("Weekly") ); 681 mTypeCombo->insertItem( i18n("Weekly") );
674 mTypeCombo->insertItem( i18n("Monthly") ); 682 mTypeCombo->insertItem( i18n("Monthly") );
675 mTypeCombo->insertItem( i18n("Yearly") ); 683 mTypeCombo->insertItem( i18n("Yearly") );
676 684
677 topLayout->addWidget( mTypeCombo ); 685 topLayout->addWidget( mTypeCombo );
678 686
679 connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( emitChoice() ) ); 687 connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( emitChoice() ) );
680 688
681} 689}
682 690
683int RecurrenceChooser::type() 691int RecurrenceChooser::type()
684{ 692{
685 if ( mTypeCombo ) { 693 if ( mTypeCombo ) {
@@ -712,67 +720,67 @@ void RecurrenceChooser::setType( int type )
712 mYearlyButton->setChecked( true ); 720 mYearlyButton->setChecked( true );
713 break; 721 break;
714 } 722 }
715 } 723 }
716} 724}
717 725
718void RecurrenceChooser::emitChoice() 726void RecurrenceChooser::emitChoice()
719{ 727{
720 emit chosen ( type() ); 728 emit chosen ( type() );
721} 729}
722 730
723/////////////////////////////// Main Widget ///////////////////////////// 731/////////////////////////////// Main Widget /////////////////////////////
724 732
725KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) : 733KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) :
726 QWidget( parent, name ) 734 QWidget( parent, name )
727{ 735{
728 QGridLayout *topLayout = new QGridLayout( this, 2,2 ); 736 Q3GridLayout *topLayout = new Q3GridLayout( this, 2,2 );
729 topLayout->setSpacing( KDialog::spacingHint() ); 737 topLayout->setSpacing( KDialog::spacingHint() );
730 topLayout->setMargin( KDialog::marginHintSmall() ); 738 topLayout->setMargin( KDialog::marginHintSmall() );
731 739
732 mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this ); 740 mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this );
733 connect( mEnabledCheck, SIGNAL( toggled( bool ) ), 741 connect( mEnabledCheck, SIGNAL( toggled( bool ) ),
734 SLOT( setEnabled( bool ) ) ); 742 SLOT( setEnabled( bool ) ) );
735 topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 ); 743 topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 );
736 744
737 745
738 mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Time"), 746 mTimeGroupBox = new Q3GroupBox( 1, Qt::Horizontal, i18n("Time"),
739 this ); 747 this );
740 topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 ); 748 topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 );
741 749
742 if ( QApplication::desktop()->width() <= 640 ) { 750 if ( QApplication::desktop()->width() <= 640 ) {
743 mTimeGroupBox->hide(); 751 mTimeGroupBox->hide();
744 } 752 }
745 753
746// QFrame *timeFrame = new QFrame( mTimeGroupBox ); 754// QFrame *timeFrame = new QFrame( mTimeGroupBox );
747// QBoxLayout *layoutTimeFrame = new QHBoxLayout( timeFrame ); 755// QBoxLayout *layoutTimeFrame = new QHBoxLayout( timeFrame );
748// layoutTimeFrame->setSpacing( KDialog::spacingHint() ); 756// layoutTimeFrame->setSpacing( KDialog::spacingHint() );
749 757
750 mDateTimeLabel = new QLabel( mTimeGroupBox ); 758 mDateTimeLabel = new QLabel( mTimeGroupBox );
751// mDateTimeLabel = new QLabel( timeFrame ); 759// mDateTimeLabel = new QLabel( timeFrame );
752// layoutTimeFrame->addWidget( mDateTimeLabel ); 760// layoutTimeFrame->addWidget( mDateTimeLabel );
753 //mTimeGroupBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) ); 761 //mTimeGroupBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) );
754 //mDateTimeLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum) ); 762 //mDateTimeLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum) );
755 mRuleBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Rule"), this ); 763 mRuleBox = new Q3GroupBox( 1, Qt::Horizontal, i18n("Recurrence Rule"), this );
756 topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 ); 764 topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 );
757 mRecurrenceChooser = new RecurrenceChooser( mRuleBox ); 765 mRecurrenceChooser = new RecurrenceChooser( mRuleBox );
758 connect( mRecurrenceChooser, SIGNAL( chosen( int ) ), 766 connect( mRecurrenceChooser, SIGNAL( chosen( int ) ),
759 SLOT( showCurrentRule( int ) ) ); 767 SLOT( showCurrentRule( int ) ) );
760 768
761 769
762 mRuleStack = new QWidgetStack( mRuleBox ); 770 mRuleStack = new Q3WidgetStack( mRuleBox );
763 771
764 mDaily = new RecurDaily( mRuleStack ); 772 mDaily = new RecurDaily( mRuleStack );
765 mRuleStack->addWidget( mDaily, 0 ); 773 mRuleStack->addWidget( mDaily, 0 );
766 774
767 mWeekly = new RecurWeekly( mRuleStack ); 775 mWeekly = new RecurWeekly( mRuleStack );
768 mRuleStack->addWidget( mWeekly, 0 ); 776 mRuleStack->addWidget( mWeekly, 0 );
769 777
770 mMonthly = new RecurMonthly( mRuleStack ); 778 mMonthly = new RecurMonthly( mRuleStack );
771 mRuleStack->addWidget( mMonthly, 0 ); 779 mRuleStack->addWidget( mMonthly, 0 );
772 780
773 mYearly = new RecurYearly( mRuleStack ); 781 mYearly = new RecurYearly( mRuleStack );
774 mRuleStack->addWidget( mYearly, 0 ); 782 mRuleStack->addWidget( mYearly, 0 );
775 783
776 showCurrentRule( mRecurrenceChooser->type() ); 784 showCurrentRule( mRecurrenceChooser->type() );
777 mRecurrenceRangeWidget = 0; 785 mRecurrenceRangeWidget = 0;
778 mRecurrenceRangeDialog = new RecurrenceRangeDialog( this ); 786 mRecurrenceRangeDialog = new RecurrenceRangeDialog( this );
@@ -883,34 +891,34 @@ void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to )
883 mMonthly->setFrequency( 1 ); 891 mMonthly->setFrequency( 1 );
884 mYearly->setFrequency( 1 ); 892 mYearly->setFrequency( 1 );
885 setDefaultsDates( from, to ); 893 setDefaultsDates( from, to );
886} 894}
887 895
888void KOEditorRecurrence::readEvent(Incidence *event) 896void KOEditorRecurrence::readEvent(Incidence *event)
889{ 897{
890 898
891 QDateTime dtEnd; 899 QDateTime dtEnd;
892 if ( event->typeID() == eventID ) 900 if ( event->typeID() == eventID )
893 dtEnd = ((Event*)event)->dtEnd(); 901 dtEnd = ((Event*)event)->dtEnd();
894 else 902 else
895 dtEnd = ((Todo*)event)->dtDue(); 903 dtEnd = ((Todo*)event)->dtDue();
896 904
897 setDefaults( event->dtStart(), dtEnd ); 905 setDefaults( event->dtStart(), dtEnd );
898 QBitArray rDays( 7 ); 906 QBitArray rDays( 7 );
899 QPtrList<Recurrence::rMonthPos> rmp; 907 Q3PtrList<Recurrence::rMonthPos> rmp;
900 QPtrList<int> rmd; 908 Q3PtrList<int> rmd;
901 int day = 0; 909 int day = 0;
902 int count = 0; 910 int count = 0;
903 int month = 0; 911 int month = 0;
904 setDateTimes( event->dtStart(), dtEnd ); 912 setDateTimes( event->dtStart(), dtEnd );
905 913
906 914
907 915
908 int recurs = event->doesRecur(); 916 int recurs = event->doesRecur();
909 917
910 mEnabledCheck->setChecked( recurs ); 918 mEnabledCheck->setChecked( recurs );
911 setEnabled( recurs ); 919 setEnabled( recurs );
912 920
913 int recurrenceType = RecurrenceChooser::Weekly; 921 int recurrenceType = RecurrenceChooser::Weekly;
914 if ( recurs ) { 922 if ( recurs ) {
915 Recurrence *r = event->recurrence(); 923 Recurrence *r = event->recurrence();
916 int f = r->frequency(); 924 int f = r->frequency();
@@ -955,33 +963,33 @@ void KOEditorRecurrence::readEvent(Incidence *event)
955 mMonthly->setFrequency( f ); 963 mMonthly->setFrequency( f );
956 964
957 break; 965 break;
958 case Recurrence::rYearlyMonth: 966 case Recurrence::rYearlyMonth:
959 { 967 {
960 recurrenceType = RecurrenceChooser::Yearly; 968 recurrenceType = RecurrenceChooser::Yearly;
961 //qDebug("Recurrence::rYearlyMonth: "); 969 //qDebug("Recurrence::rYearlyMonth: ");
962 day = event->dtStart().date().day(); 970 day = event->dtStart().date().day();
963 rmd = r->yearNums(); 971 rmd = r->yearNums();
964 if ( rmd.count() > 0 ) 972 if ( rmd.count() > 0 )
965 month = *rmd.first(); 973 month = *rmd.first();
966 else 974 else
967 month = event->dtStart().date().month() ; 975 month = event->dtStart().date().month() ;
968 mYearly->setByMonth( month, day ); 976 mYearly->setByMonth( month, day );
969#if 0 977#if 0
970 //qDebug("2day = %d ",day ); 978 //qDebug("2day = %d ",day );
971 QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions(); 979 Q3PtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions();
972 int month; 980 int month;
973 if ( !monthlist.isEmpty() ) { 981 if ( !monthlist.isEmpty() ) {
974 month = monthlist.first()->rPos ; 982 month = monthlist.first()->rPos ;
975 } else { 983 } else {
976 month = event->dtStart().date().month() ; 984 month = event->dtStart().date().month() ;
977 } 985 }
978 mYearly->setByMonth( day, month ); 986 mYearly->setByMonth( day, month );
979#endif 987#endif
980 mYearly->setFrequency( f ); 988 mYearly->setFrequency( f );
981 } 989 }
982 990
983 break; 991 break;
984 case Recurrence::rYearlyDay: 992 case Recurrence::rYearlyDay:
985 //qDebug("Recurrence::rYearlyDay: "); 993 //qDebug("Recurrence::rYearlyDay: ");
986 recurrenceType = RecurrenceChooser::Yearly; 994 recurrenceType = RecurrenceChooser::Yearly;
987 mYearly->setByDay( event->dtStart().date().dayOfYear() ); 995 mYearly->setByDay( event->dtStart().date().dayOfYear() );
diff --git a/korganizer/koeditorrecurrence.h b/korganizer/koeditorrecurrence.h
index 75e0c73..6c012bd 100644
--- a/korganizer/koeditorrecurrence.h
+++ b/korganizer/koeditorrecurrence.h
@@ -10,51 +10,53 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef _KOEDITORRECURRENCE_H 23#ifndef _KOEDITORRECURRENCE_H
24#define _KOEDITORRECURRENCE_H 24#define _KOEDITORRECURRENCE_H
25 25
26#include <qframe.h> 26#include <q3frame.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qcheckbox.h> 28#include <qcheckbox.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qgroupbox.h> 30#include <q3groupbox.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qcombobox.h> 32#include <qcombobox.h>
33#include <qmultilineedit.h> 33#include <q3multilineedit.h>
34#include <qlistview.h> 34#include <q3listview.h>
35#include <qradiobutton.h> 35#include <qradiobutton.h>
36#include <qbuttongroup.h> 36#include <q3buttongroup.h>
37#include <Q3ListBox>
38#include <Q3ComboBox>
37 39
38#include <kdialogbase.h> 40#include <kdialogbase.h>
39 41
40#include <libkcal/event.h> 42#include <libkcal/event.h>
41 43
42#include "ktimeedit.h" 44#include "ktimeedit.h"
43 45
44class QWidgetStack; 46class Q3WidgetStack;
45class QSpinBox; 47class QSpinBox;
46 48
47class KDateEdit; 49class KDateEdit;
48 50
49using namespace KCal; 51using namespace KCal;
50 52
51class RecurBase : public QWidget 53class RecurBase : public QWidget
52{ 54{
53 public: 55 public:
54 RecurBase( QWidget *parent = 0, const char *name = 0 ); 56 RecurBase( QWidget *parent = 0, const char *name = 0 );
55 57
56 void setFrequency( int ); 58 void setFrequency( int );
57 int frequency(); 59 int frequency();
58 60
59 QWidget *frequencyEdit(); 61 QWidget *frequencyEdit();
60 62
@@ -85,57 +87,57 @@ class RecurMonthly : public RecurBase
85 public: 87 public:
86 RecurMonthly( QWidget *parent = 0, const char *name = 0 ); 88 RecurMonthly( QWidget *parent = 0, const char *name = 0 );
87 89
88 void setByDay( int day ); 90 void setByDay( int day );
89 void setByPos( int count, int weekday ); 91 void setByPos( int count, int weekday );
90 92
91 bool byDay(); 93 bool byDay();
92 bool byPos(); 94 bool byPos();
93 95
94 int day(); 96 int day();
95 97
96 int count(); 98 int count();
97 int weekday(); 99 int weekday();
98 100
99 private: 101 private:
100 QRadioButton *mByDayRadio; 102 QRadioButton *mByDayRadio;
101 QComboBox *mByDayCombo; 103 Q3ComboBox *mByDayCombo;
102 104
103 QRadioButton *mByPosRadio; 105 QRadioButton *mByPosRadio;
104 QComboBox *mByPosCountCombo; 106 QComboBox *mByPosCountCombo;
105 QComboBox *mByPosWeekdayCombo; 107 QComboBox *mByPosWeekdayCombo;
106}; 108};
107 109
108class RecurYearly : public RecurBase 110class RecurYearly : public RecurBase
109{ 111{
110 public: 112 public:
111 RecurYearly( QWidget *parent = 0, const char *name = 0 ); 113 RecurYearly( QWidget *parent = 0, const char *name = 0 );
112 114
113 void setByDay( int doy ); 115 void setByDay( int doy );
114 void setByMonth( int month, int day ); 116 void setByMonth( int month, int day );
115 117
116 bool byMonth(); 118 bool byMonth();
117 bool byDay(); 119 bool byDay();
118 120
119 int month(); 121 int month();
120 int day(); 122 int day();
121 123
122 private: 124 private:
123 int mDay; 125 int mDay;
124 QRadioButton *mByMonthRadio; 126 QRadioButton *mByMonthRadio;
125 QComboBox *mByMonthCombo; 127 Q3ComboBox *mByMonthCombo;
126 QLabel* mByDayLabel; 128 QLabel* mByDayLabel;
127 QLabel* mDayOfLabel; 129 QLabel* mDayOfLabel;
128 QRadioButton *mByDayRadio; 130 QRadioButton *mByDayRadio;
129}; 131};
130 132
131class RecurrenceChooser : public QWidget 133class RecurrenceChooser : public QWidget
132{ 134{
133 Q_OBJECT 135 Q_OBJECT
134 public: 136 public:
135 RecurrenceChooser( QWidget *parent = 0, const char *name = 0 ); 137 RecurrenceChooser( QWidget *parent = 0, const char *name = 0 );
136 138
137 enum { Daily, Weekly, Monthly, Yearly }; 139 enum { Daily, Weekly, Monthly, Yearly };
138 140
139 void setType( int ); 141 void setType( int );
140 int type(); 142 int type();
141 143
@@ -167,33 +169,33 @@ class ExceptionsWidget : public QWidget, public ExceptionsBase
167 Q_OBJECT 169 Q_OBJECT
168 public: 170 public:
169 ExceptionsWidget( QWidget *parent = 0, const char *name = 0 ); 171 ExceptionsWidget( QWidget *parent = 0, const char *name = 0 );
170 172
171 void setDefaults( const QDateTime &from ); 173 void setDefaults( const QDateTime &from );
172 174
173 void setDates( const DateList & ); 175 void setDates( const DateList & );
174 DateList dates(); 176 DateList dates();
175 177
176 protected slots: 178 protected slots:
177 void addException(); 179 void addException();
178 void changeException(); 180 void changeException();
179 void deleteException(); 181 void deleteException();
180 182
181 private: 183 private:
182 KDateEdit *mExceptionDateEdit; 184 KDateEdit *mExceptionDateEdit;
183 QListBox *mExceptionList; 185 Q3ListBox *mExceptionList;
184 DateList mExceptionDates; 186 DateList mExceptionDates;
185}; 187};
186 188
187class ExceptionsDialog : public KDialogBase, public ExceptionsBase 189class ExceptionsDialog : public KDialogBase, public ExceptionsBase
188{ 190{
189 public: 191 public:
190 ExceptionsDialog( QWidget *parent, const char *name = 0 ); 192 ExceptionsDialog( QWidget *parent, const char *name = 0 );
191 193
192 void setDefaults( const QDateTime &from ); 194 void setDefaults( const QDateTime &from );
193 195
194 void setDates( const DateList & ); 196 void setDates( const DateList & );
195 DateList dates(); 197 DateList dates();
196 198
197 private: 199 private:
198 ExceptionsWidget *mExceptions; 200 ExceptionsWidget *mExceptions;
199}; 201};
@@ -222,34 +224,34 @@ class RecurrenceRangeWidget : public QWidget, public RecurrenceRangeBase
222 224
223 void setDefaults( const QDateTime &from ); 225 void setDefaults( const QDateTime &from );
224 226
225 void setDuration( int ); 227 void setDuration( int );
226 int duration(); 228 int duration();
227 229
228 void setEndDate( const QDate & ); 230 void setEndDate( const QDate & );
229 QDate endDate(); 231 QDate endDate();
230 232
231 void setDateTimes( const QDateTime &start, 233 void setDateTimes( const QDateTime &start,
232 const QDateTime &end = QDateTime() ); 234 const QDateTime &end = QDateTime() );
233 235
234 protected slots: 236 protected slots:
235 void showCurrentRange(); 237 void showCurrentRange();
236 238
237 private: 239 private:
238 QButtonGroup *mRangeButtonGroup; 240 Q3ButtonGroup *mRangeButtonGroup;
239 QGroupBox *mRangeGroupBox; 241 Q3GroupBox *mRangeGroupBox;
240 QLabel *mStartDateLabel; 242 QLabel *mStartDateLabel;
241 QRadioButton *mNoEndDateButton; 243 QRadioButton *mNoEndDateButton;
242 QRadioButton *mEndDurationButton; 244 QRadioButton *mEndDurationButton;
243 QSpinBox *mEndDurationEdit; 245 QSpinBox *mEndDurationEdit;
244 QRadioButton *mEndDateButton; 246 QRadioButton *mEndDateButton;
245 KDateEdit *mEndDateEdit; 247 KDateEdit *mEndDateEdit;
246}; 248};
247 249
248class RecurrenceRangeDialog : public KDialogBase, public RecurrenceRangeBase 250class RecurrenceRangeDialog : public KDialogBase, public RecurrenceRangeBase
249{ 251{
250 public: 252 public:
251 RecurrenceRangeDialog( QWidget *parent = 0, const char *name = 0 ); 253 RecurrenceRangeDialog( QWidget *parent = 0, const char *name = 0 );
252 254
253 void setDefaults( const QDateTime &from ); 255 void setDefaults( const QDateTime &from );
254 256
255 void setDuration( int ); 257 void setDuration( int );
@@ -287,37 +289,37 @@ class KOEditorRecurrence : public QWidget
287 void setDefaults( QDateTime from, QDateTime to ); 289 void setDefaults( QDateTime from, QDateTime to );
288 void setEnabled( bool ); 290 void setEnabled( bool );
289 void setDateTimes( QDateTime start, QDateTime end ); 291 void setDateTimes( QDateTime start, QDateTime end );
290 void setDateTimeStr( const QString & ); 292 void setDateTimeStr( const QString & );
291 293
292 signals: 294 signals:
293 void dateTimesChanged( QDateTime start, QDateTime end ); 295 void dateTimesChanged( QDateTime start, QDateTime end );
294 296
295 protected slots: 297 protected slots:
296 void showCurrentRule( int ); 298 void showCurrentRule( int );
297 void showExceptionsDialog(); 299 void showExceptionsDialog();
298 void showRecurrenceRangeDialog(); 300 void showRecurrenceRangeDialog();
299 301
300 private: 302 private:
301 QCheckBox *mEnabledCheck; 303 QCheckBox *mEnabledCheck;
302 304
303 QGroupBox *mTimeGroupBox; 305 Q3GroupBox *mTimeGroupBox;
304 QLabel *mDateTimeLabel; 306 QLabel *mDateTimeLabel;
305 307
306 QGroupBox *mRuleBox; 308 Q3GroupBox *mRuleBox;
307 QWidgetStack *mRuleStack; 309 Q3WidgetStack *mRuleStack;
308 RecurrenceChooser *mRecurrenceChooser; 310 RecurrenceChooser *mRecurrenceChooser;
309 311
310 RecurDaily *mDaily; 312 RecurDaily *mDaily;
311 RecurWeekly *mWeekly; 313 RecurWeekly *mWeekly;
312 RecurMonthly *mMonthly; 314 RecurMonthly *mMonthly;
313 RecurYearly *mYearly; 315 RecurYearly *mYearly;
314 316
315 RecurrenceRangeBase *mRecurrenceRange; 317 RecurrenceRangeBase *mRecurrenceRange;
316 RecurrenceRangeWidget *mRecurrenceRangeWidget; 318 RecurrenceRangeWidget *mRecurrenceRangeWidget;
317 RecurrenceRangeDialog *mRecurrenceRangeDialog; 319 RecurrenceRangeDialog *mRecurrenceRangeDialog;
318 QPushButton *mRecurrenceRangeButton; 320 QPushButton *mRecurrenceRangeButton;
319 321
320 ExceptionsBase *mExceptions; 322 ExceptionsBase *mExceptions;
321 ExceptionsDialog *mExceptionsDialog; 323 ExceptionsDialog *mExceptionsDialog;
322 ExceptionsWidget *mExceptionsWidget; 324 ExceptionsWidget *mExceptionsWidget;
323 QPushButton *mExceptionsButton; 325 QPushButton *mExceptionsButton;
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp
index 3e87197..62ad250 100644
--- a/korganizer/koeventeditor.cpp
+++ b/korganizer/koeventeditor.cpp
@@ -9,40 +9,45 @@
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qframe.h> 25#include <q3frame.h>
26#include <qpixmap.h> 26#include <qpixmap.h>
27#include <qhbox.h> 27#include <q3hbox.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <qdir.h> 29#include <qdir.h>
30#include <qlayout.h> 30#include <qlayout.h>
31#include <qwidgetstack.h> 31#include <q3widgetstack.h>
32#include <qapplication.h> 32#include <qapplication.h>
33#include <QDesktopWidget>
34//Added by qt3to4:
35#include <Q3HBoxLayout>
36#include <Q3PtrList>
37#include <Q3VBoxLayout>
33 38
34#include <kiconloader.h> 39#include <kiconloader.h>
35#include <kstandarddirs.h> 40#include <kstandarddirs.h>
36#include <kdebug.h> 41#include <kdebug.h>
37#include <klocale.h> 42#include <klocale.h>
38#include <kfiledialog.h> 43#include <kfiledialog.h>
39#include <kmessagebox.h> 44#include <kmessagebox.h>
40#include <libkcal/calendarresources.h> 45#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 46#include <libkcal/resourcecalendar.h>
42#include <kresources/resourceselectdialog.h> 47#include <kresources/resourceselectdialog.h>
43 48
44#include <libkdepim/categoryselectdialog.h> 49#include <libkdepim/categoryselectdialog.h>
45#include <libkcal/calendarlocal.h> 50#include <libkcal/calendarlocal.h>
46#include <libkcal/icalformat.h> 51#include <libkcal/icalformat.h>
47 52
48#include "koprefs.h" 53#include "koprefs.h"
@@ -92,111 +97,111 @@ void KOEventEditor::reload()
92 97
93void KOEventEditor::setSecrecy( int sec ) 98void KOEventEditor::setSecrecy( int sec )
94{ 99{
95 mGeneral->setSecrecy( sec ); 100 mGeneral->setSecrecy( sec );
96} 101}
97void KOEventEditor::setCategories( QString s ) 102void KOEventEditor::setCategories( QString s )
98{ 103{
99 mGeneral->setCategories(s); 104 mGeneral->setCategories(s);
100 105
101} 106}
102void KOEventEditor::setupGeneral() 107void KOEventEditor::setupGeneral()
103{ 108{
104 mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" ); 109 mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" );
105 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); 110 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
106 111
107 if( KOPrefs::instance()->mCompactDialogs ) { 112 if( KOPrefs::instance()->mCompactDialogs ) {
108 QFrame *topFrame = addPage(i18n("General")); 113 Q3Frame *topFrame = addPage(i18n("General"));
109 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 114 Q3BoxLayout *topLayout = new Q3VBoxLayout(topFrame);
110 topLayout->setSpacing(spacingHint()-1); 115 topLayout->setSpacing(spacingHint()-1);
111 topLayout->setMargin(marginHint()-1); 116 topLayout->setMargin(marginHint()-1);
112 topLayout->addStretch ( 1 ); 117 topLayout->addStretch ( 1 );
113 mGeneral->initHeader(topFrame,topLayout); 118 mGeneral->initHeader(topFrame,topLayout);
114 topLayout->addStretch ( 1 ); 119 topLayout->addStretch ( 1 );
115 mGeneral->initTime(topFrame,topLayout); 120 mGeneral->initTime(topFrame,topLayout);
116 topLayout->addStretch ( 1 ); 121 topLayout->addStretch ( 1 );
117// QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 122// QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
118 mGeneral->initAlarm(topFrame,topLayout); 123 mGeneral->initAlarm(topFrame,topLayout);
119 topLayout->addStretch ( 1 ); 124 topLayout->addStretch ( 1 );
120 mGeneral->enableAlarm( false ); 125 mGeneral->enableAlarm( false );
121 126
122 QBoxLayout *buttonLayout; 127 Q3BoxLayout *buttonLayout;
123 if ( QApplication::desktop()->width() < 500 && QApplication::desktop()->height() > 240 ) 128 if ( QApplication::desktop()->width() < 500 && QApplication::desktop()->height() > 240 )
124 buttonLayout = new QVBoxLayout( topLayout ); 129 buttonLayout = new Q3VBoxLayout( topLayout );
125 else 130 else
126 buttonLayout = new QHBoxLayout( topLayout ); 131 buttonLayout = new Q3HBoxLayout( topLayout );
127 QHBox* buttonWidget = new QHBox (topFrame); 132 Q3HBox* buttonWidget = new Q3HBox (topFrame);
128 QIconSet icon; 133 QIcon icon;
129 if ( QApplication::desktop()->width() < 321 ) 134 if ( QApplication::desktop()->width() < 321 )
130 icon = SmallIcon("fileexport16"); 135 icon = SmallIcon("fileexport16");
131 else 136 else
132 icon = SmallIcon("fileexport"); 137 icon = SmallIcon("fileexport");
133 QPushButton * loadTemplate = new QPushButton( buttonWidget); 138 QPushButton * loadTemplate = new QPushButton( buttonWidget);
134 QPushButton * saveTemplate = new QPushButton( buttonWidget); 139 QPushButton * saveTemplate = new QPushButton( buttonWidget);
135 saveTemplate->setIconSet (icon ) ; 140 saveTemplate->setIconSet (icon ) ;
136 int size = saveTemplate->sizeHint().height(); 141 int size = saveTemplate->sizeHint().height();
137 saveTemplate->setFixedSize( size, size ); 142 saveTemplate->setFixedSize( size, size );
138 if ( QApplication::desktop()->width() < 321 ) 143 if ( QApplication::desktop()->width() < 321 )
139 icon = SmallIcon("fileimport16"); 144 icon = SmallIcon("fileimport16");
140 else 145 else
141 icon = SmallIcon("fileimport"); 146 icon = SmallIcon("fileimport");
142 loadTemplate->setIconSet (icon ) ; 147 loadTemplate->setIconSet (icon ) ;
143 loadTemplate->setFixedSize( size, size ); 148 loadTemplate->setFixedSize( size, size );
144 buttonLayout->addWidget( buttonWidget ); 149 buttonLayout->addWidget( buttonWidget );
145 mGeneral->initCategories( topFrame, buttonLayout ); 150 mGeneral->initCategories( topFrame, buttonLayout );
146 151
147 topLayout->addStretch( 1 ); 152 topLayout->addStretch( 1 );
148 153
149 QFrame *topFrame2 = addPage(i18n("Details")); 154 Q3Frame *topFrame2 = addPage(i18n("Details"));
150 155
151 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); 156 Q3BoxLayout *topLayout2 = new Q3VBoxLayout(topFrame2);
152 topLayout2->setSpacing(spacingHint()-1); 157 topLayout2->setSpacing(spacingHint()-1);
153 topLayout2->setMargin(marginHint()-1); 158 topLayout2->setMargin(marginHint()-1);
154 topLayout2->setSpacing(spacingHint()); 159 topLayout2->setSpacing(spacingHint());
155 160
156 mGeneral->initClass(topFrame2,topLayout2); 161 mGeneral->initClass(topFrame2,topLayout2);
157 mGeneral->initSecrecy( topFrame2, topLayout2 ); 162 mGeneral->initSecrecy( topFrame2, topLayout2 );
158 mGeneral->initDescription(topFrame2,topLayout2); 163 mGeneral->initDescription(topFrame2,topLayout2);
159 164
160 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 165 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
161 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 166 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
162 } else { 167 } else {
163 QFrame *topFrame = addPage(i18n("General")); 168 Q3Frame *topFrame = addPage(i18n("General"));
164 169
165 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 170 Q3BoxLayout *topLayout = new Q3VBoxLayout(topFrame);
166 topLayout->setSpacing(spacingHint()); 171 topLayout->setSpacing(spacingHint());
167 172
168 mGeneral->initHeader(topFrame,topLayout); 173 mGeneral->initHeader(topFrame,topLayout);
169 mGeneral->initTime(topFrame,topLayout); 174 mGeneral->initTime(topFrame,topLayout);
170 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 175 Q3BoxLayout *alarmLineLayout = new Q3HBoxLayout(topLayout);
171 mGeneral->initAlarm(topFrame,alarmLineLayout); 176 mGeneral->initAlarm(topFrame,alarmLineLayout);
172 mGeneral->initClass(topFrame,alarmLineLayout); 177 mGeneral->initClass(topFrame,alarmLineLayout);
173 mGeneral->initDescription(topFrame,topLayout); 178 mGeneral->initDescription(topFrame,topLayout);
174 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); 179 Q3BoxLayout *detailsLayout = new Q3HBoxLayout(topLayout);
175 mGeneral->initCategories( topFrame, detailsLayout ); 180 mGeneral->initCategories( topFrame, detailsLayout );
176 mGeneral->initSecrecy( topFrame, detailsLayout ); 181 mGeneral->initSecrecy( topFrame, detailsLayout );
177 } 182 }
178 183
179 mGeneral->finishSetup(); 184 mGeneral->finishSetup();
180 185
181} 186}
182 187
183void KOEventEditor::setupRecurrence() 188void KOEventEditor::setupRecurrence()
184{ 189{
185 QFrame *topFrame = addPage( i18n("Recurrence") ); 190 Q3Frame *topFrame = addPage( i18n("Recurrence") );
186 QBoxLayout *topLayout = new QVBoxLayout( topFrame ); 191 Q3BoxLayout *topLayout = new Q3VBoxLayout( topFrame );
187 192
188 mRecurrence = new KOEditorRecurrence( topFrame ); 193 mRecurrence = new KOEditorRecurrence( topFrame );
189 topLayout->addWidget( mRecurrence ); 194 topLayout->addWidget( mRecurrence );
190} 195}
191 196
192void KOEventEditor::editEvent(Event *event, bool showDescription) 197void KOEventEditor::editEvent(Event *event, bool showDescription)
193{ 198{
194 // init(); 199 // init();
195 200
196 mEvent = event; 201 mEvent = event;
197 readEvent(mEvent); 202 readEvent(mEvent);
198 if ( showDescription ) { 203 if ( showDescription ) {
199 showPage( 1 ); 204 showPage( 1 );
200 mGeneral->setFocusOn( 1 ); 205 mGeneral->setFocusOn( 1 );
201 } else { 206 } else {
202 showPage( 0 ); 207 showPage( 0 );
@@ -343,33 +348,33 @@ void KOEventEditor::slotLoadTemplate()
343 348
344 QString fileName =locateLocal( "templates", "events" ); 349 QString fileName =locateLocal( "templates", "events" );
345 QDir t_dir; 350 QDir t_dir;
346 if ( !t_dir.exists(fileName) ) 351 if ( !t_dir.exists(fileName) )
347 t_dir.mkdir ( fileName ); 352 t_dir.mkdir ( fileName );
348 fileName += "/event"; 353 fileName += "/event";
349 fileName = KFileDialog::getOpenFileName( fileName , i18n("Load Event template"), this ); 354 fileName = KFileDialog::getOpenFileName( fileName , i18n("Load Event template"), this );
350 if ( fileName.length() == 0 ) 355 if ( fileName.length() == 0 )
351 return; 356 return;
352 CalendarLocal cal; 357 CalendarLocal cal;
353 ICalFormat format; 358 ICalFormat format;
354 if ( !format.load( &cal, fileName ) ) { 359 if ( !format.load( &cal, fileName ) ) {
355 KMessageBox::error( this, i18n("Error loading template file\n '%1'.") 360 KMessageBox::error( this, i18n("Error loading template file\n '%1'.")
356 .arg( fileName ) ); 361 .arg( fileName ) );
357 return ; 362 return ;
358 } 363 }
359 QPtrList<Event> events = cal.events(); 364 Q3PtrList<Event> events = cal.events();
360 Event* event = events.first(); 365 Event* event = events.first();
361 if ( !event ) { 366 if ( !event ) {
362 KMessageBox::error( this, 367 KMessageBox::error( this,
363 i18n("Template does not contain\na valid Event.")); 368 i18n("Template does not contain\na valid Event."));
364 } else { 369 } else {
365 kdDebug() << "KOEventEditor::slotLoadTemplate(): readTemplate" << endl; 370 kdDebug() << "KOEventEditor::slotLoadTemplate(): readTemplate" << endl;
366 readEvent( event, true ); 371 readEvent( event, true );
367 } 372 }
368} 373}
369 374
370 375
371void KOEventEditor::slotSaveTemplate() 376void KOEventEditor::slotSaveTemplate()
372{ 377{
373 QString fileName =locateLocal( "templates", "events" ); 378 QString fileName =locateLocal( "templates", "events" );
374 QDir t_dir; 379 QDir t_dir;
375 if ( !t_dir.exists(fileName) ) 380 if ( !t_dir.exists(fileName) )
diff --git a/korganizer/koeventpopupmenu.cpp b/korganizer/koeventpopupmenu.cpp
index fc4d9a4..81047c1 100644
--- a/korganizer/koeventpopupmenu.cpp
+++ b/korganizer/koeventpopupmenu.cpp
@@ -9,85 +9,88 @@
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qcursor.h> 24#include <qcursor.h>
25//Added by qt3to4:
26#include <Q3ValueList>
27#include <Q3PopupMenu>
25 28
26#include <klocale.h> 29#include <klocale.h>
27#include <kdebug.h> 30#include <kdebug.h>
28#include <kiconloader.h> 31#include <kiconloader.h>
29 32
30#include <libkcal/event.h> 33#include <libkcal/event.h>
31 34
32#include "koeventpopupmenu.h" 35#include "koeventpopupmenu.h"
33#include "koprefs.h" 36#include "koprefs.h"
34 37
35KOEventPopupMenu::KOEventPopupMenu(): QPopupMenu() 38KOEventPopupMenu::KOEventPopupMenu(): Q3PopupMenu()
36{ 39{
37 mCurrentIncidence = 0; 40 mCurrentIncidence = 0;
38 mHasAdditionalItems = false; 41 mHasAdditionalItems = false;
39 42
40 43
41 mSingleOnlyItems.append( insertItem (i18n("&Show"),this,SLOT(popupShow()))); 44 mSingleOnlyItems.append( insertItem (i18n("&Show"),this,SLOT(popupShow())));
42 mEditOnlyItems.append(insertItem (i18n("&Edit..."),this,SLOT(popupEdit()))); 45 mEditOnlyItems.append(insertItem (i18n("&Edit..."),this,SLOT(popupEdit())));
43 mEditOnlyItems.append(insertItem (i18n("&Delete..."), 46 mEditOnlyItems.append(insertItem (i18n("&Delete..."),
44 this,SLOT(popupDelete()))); 47 this,SLOT(popupDelete())));
45 mEditOnlyItems.append(insertItem (i18n("&Clone..."), 48 mEditOnlyItems.append(insertItem (i18n("&Clone..."),
46 this,SLOT(popupClone()))); 49 this,SLOT(popupClone())));
47 mEditOnlyItems.append(insertItem (i18n("&Move..."), 50 mEditOnlyItems.append(insertItem (i18n("&Move..."),
48 this,SLOT(popupMove()))); 51 this,SLOT(popupMove())));
49#ifndef DESKTOP_VERSION 52#ifndef DESKTOP_VERSION
50 mEditOnlyItems.append(insertItem (i18n("&Beam..."), 53 mEditOnlyItems.append(insertItem (i18n("&Beam..."),
51 this,SLOT(popupBeam()))); 54 this,SLOT(popupBeam())));
52#endif 55#endif
53 mEditOnlyItems.append(insertItem (i18n("&Toggle Cancel"), 56 mEditOnlyItems.append(insertItem (i18n("&Toggle Cancel"),
54 this,SLOT(popupCancel()))); 57 this,SLOT(popupCancel())));
55 isDisabled = false; 58 isDisabled = false;
56 mCatPopup = new QPopupMenu ( this ); 59 mCatPopup = new Q3PopupMenu ( this );
57 mCatPopup->setCheckable (true); 60 mCatPopup->setCheckable (true);
58 connect(mCatPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCatPopup())); 61 connect(mCatPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCatPopup()));
59 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCatPopup( int ))); 62 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCatPopup( int )));
60 mCalPopup = new QPopupMenu ( this ); 63 mCalPopup = new Q3PopupMenu ( this );
61 mCalPopup->setCheckable (true); 64 mCalPopup->setCheckable (true);
62 connect(mCalPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCalPopup())); 65 connect(mCalPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCalPopup()));
63 connect(mCalPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCalPopup( int ))); 66 connect(mCalPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCalPopup( int )));
64 //mEditOnlyItems.append(insertItem (i18n("Categories"),mCatPopup )); 67 //mEditOnlyItems.append(insertItem (i18n("Categories"),mCatPopup ));
65 //mEditOnlyItems.append(insertItem (i18n("Calendar"),mCalPopup )); 68 //mEditOnlyItems.append(insertItem (i18n("Calendar"),mCalPopup ));
66 insertItem (i18n("Categories"),mCatPopup ); 69 insertItem (i18n("Categories"),mCatPopup );
67 insertItem (i18n("Calendar"),mCalPopup ); 70 insertItem (i18n("Calendar"),mCalPopup );
68 QValueList<int>::Iterator it; 71 Q3ValueList<int>::Iterator it;
69 for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { 72 for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) {
70 mSingleOnlyItems.append(*it); 73 mSingleOnlyItems.append(*it);
71 } 74 }
72 75
73} 76}
74void KOEventPopupMenu::enableDefault( bool enable ) 77void KOEventPopupMenu::enableDefault( bool enable )
75{ 78{
76 isDisabled = !enable; 79 isDisabled = !enable;
77 QValueList<int>::Iterator it; 80 Q3ValueList<int>::Iterator it;
78 for( it = mSingleOnlyItems.begin(); it != mSingleOnlyItems.end(); ++it ) { 81 for( it = mSingleOnlyItems.begin(); it != mSingleOnlyItems.end(); ++it ) {
79 setItemEnabled(*it,enable); 82 setItemEnabled(*it,enable);
80 } 83 }
81} 84}
82 85
83void KOEventPopupMenu::fillCalPopup() // CAL 86void KOEventPopupMenu::fillCalPopup() // CAL
84{ 87{
85 mCalPopup->clear(); 88 mCalPopup->clear();
86 if (!mCurrentIncidence) return; 89 if (!mCurrentIncidence) return;
87 bool readO = mCurrentIncidence->isReadOnly()|| isDisabled; 90 bool readO = mCurrentIncidence->isReadOnly()|| isDisabled;
88 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 91 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
89 while ( kkf ) { 92 while ( kkf ) {
90 int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber); 93 int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber);
91 if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) 94 if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO )
92 mCalPopup->setItemEnabled( index, false ); 95 mCalPopup->setItemEnabled( index, false );
93 mCalPopup->setItemChecked (index, kkf->mCalNumber == mCurrentIncidence->calID()); 96 mCalPopup->setItemChecked (index, kkf->mCalNumber == mCurrentIncidence->calID());
@@ -133,42 +136,42 @@ void KOEventPopupMenu::computeCatPopup( int index )
133 if ( categories.find ( colcat ) != categories.end () ) { 136 if ( categories.find ( colcat ) != categories.end () ) {
134 categories.remove( colcat ); 137 categories.remove( colcat );
135 categories.prepend( colcat ); 138 categories.prepend( colcat );
136 } 139 }
137 } 140 }
138 mCurrentIncidence->setCategories( categories ); 141 mCurrentIncidence->setCategories( categories );
139 emit categoryChanged( mCurrentIncidence ); 142 emit categoryChanged( mCurrentIncidence );
140} 143}
141void KOEventPopupMenu::showIncidencePopup(Incidence *incidence) 144void KOEventPopupMenu::showIncidencePopup(Incidence *incidence)
142{ 145{
143 if ( !incidence) return; 146 if ( !incidence) return;
144 mCurrentIncidence = incidence; 147 mCurrentIncidence = incidence;
145 148
146 if (mCurrentIncidence) { 149 if (mCurrentIncidence) {
147 // Enable/Disabled menu items only valid for editable events. 150 // Enable/Disabled menu items only valid for editable events.
148 if ( !isDisabled ) { 151 if ( !isDisabled ) {
149 QValueList<int>::Iterator it; 152 Q3ValueList<int>::Iterator it;
150 for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { 153 for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) {
151 setItemEnabled(*it,!mCurrentIncidence->isReadOnly()); 154 setItemEnabled(*it,!mCurrentIncidence->isReadOnly());
152 } 155 }
153 } 156 }
154 popup(QCursor::pos()); 157 popup(QCursor::pos());
155 } 158 }
156} 159}
157 160
158void KOEventPopupMenu::addAdditionalItem(const QIconSet &icon,const QString &text, 161void KOEventPopupMenu::addAdditionalItem(const QIcon &icon,const QString &text,
159 const QObject *receiver, const char *member, 162 const QObject *receiver, const char *member,
160 bool editOnly) 163 bool editOnly)
161{ 164{
162 if (!mHasAdditionalItems) { 165 if (!mHasAdditionalItems) {
163 mHasAdditionalItems = true; 166 mHasAdditionalItems = true;
164 insertSeparator(); 167 insertSeparator();
165 } 168 }
166 int id = insertItem(icon,text,receiver,member); 169 int id = insertItem(icon,text,receiver,member);
167 if (editOnly) mEditOnlyItems.append(id); 170 if (editOnly) mEditOnlyItems.append(id);
168} 171}
169 172
170void KOEventPopupMenu::popupShow() 173void KOEventPopupMenu::popupShow()
171{ 174{
172 if (mCurrentIncidence) emit showIncidenceSignal(mCurrentIncidence); 175 if (mCurrentIncidence) emit showIncidenceSignal(mCurrentIncidence);
173} 176}
174 177
diff --git a/korganizer/koeventpopupmenu.h b/korganizer/koeventpopupmenu.h
index e28745b..de5220b 100644
--- a/korganizer/koeventpopupmenu.h
+++ b/korganizer/koeventpopupmenu.h
@@ -13,44 +13,46 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOEVENTPOPUPMENU_H 23#ifndef KOEVENTPOPUPMENU_H
24#define KOEVENTPOPUPMENU_H 24#define KOEVENTPOPUPMENU_H
25// 25//
26// Context menu for event views with standard event actions 26// Context menu for event views with standard event actions
27// 27//
28 28
29#include <qpopupmenu.h> 29#include <q3popupmenu.h>
30//Added by qt3to4:
31#include <Q3ValueList>
30 32
31#include <libkcal/incidence.h> 33#include <libkcal/incidence.h>
32 34
33using namespace KCal; 35using namespace KCal;
34 36
35class KOEventPopupMenu : public QPopupMenu { 37class KOEventPopupMenu : public Q3PopupMenu {
36 Q_OBJECT 38 Q_OBJECT
37 public: 39 public:
38 KOEventPopupMenu(); 40 KOEventPopupMenu();
39 41
40 void addAdditionalItem(const QIconSet &icon,const QString &text, 42 void addAdditionalItem(const QIcon &icon,const QString &text,
41 const QObject *receiver, const char *member, 43 const QObject *receiver, const char *member,
42 bool editOnly=false); 44 bool editOnly=false);
43 45
44 46
45 public slots: 47 public slots:
46 void showIncidencePopup(Incidence *); 48 void showIncidencePopup(Incidence *);
47 void enableDefault( bool ); 49 void enableDefault( bool );
48 50
49 protected slots: 51 protected slots:
50 void popupShow(); 52 void popupShow();
51 void popupEdit(); 53 void popupEdit();
52 void popupDelete(); 54 void popupDelete();
53 void popupClone(); 55 void popupClone();
54 void popupCancel(); 56 void popupCancel();
55 void popupMove(); 57 void popupMove();
56 void popupBeam(); 58 void popupBeam();
@@ -60,24 +62,24 @@ class KOEventPopupMenu : public QPopupMenu {
60 void computeCalPopup( int ); 62 void computeCalPopup( int );
61 63
62 signals: 64 signals:
63 void editIncidenceSignal(Incidence *); 65 void editIncidenceSignal(Incidence *);
64 void showIncidenceSignal(Incidence *); 66 void showIncidenceSignal(Incidence *);
65 void deleteIncidenceSignal(Incidence *); 67 void deleteIncidenceSignal(Incidence *);
66 void cloneIncidenceSignal(Incidence *); 68 void cloneIncidenceSignal(Incidence *);
67 void cancelIncidenceSignal(Incidence *); 69 void cancelIncidenceSignal(Incidence *);
68 void moveIncidenceSignal(Incidence *); 70 void moveIncidenceSignal(Incidence *);
69 void beamIncidenceSignal(Incidence *); 71 void beamIncidenceSignal(Incidence *);
70 void categoryChanged( Incidence * ); 72 void categoryChanged( Incidence * );
71 73
72 private: 74 private:
73 Incidence *mCurrentIncidence; 75 Incidence *mCurrentIncidence;
74 76
75 bool mHasAdditionalItems; 77 bool mHasAdditionalItems;
76 QValueList<int> mEditOnlyItems; 78 Q3ValueList<int> mEditOnlyItems;
77 QValueList<int> mSingleOnlyItems; 79 Q3ValueList<int> mSingleOnlyItems;
78 bool isDisabled; 80 bool isDisabled;
79 QPopupMenu *mCatPopup; 81 Q3PopupMenu *mCatPopup;
80 QPopupMenu *mCalPopup; 82 Q3PopupMenu *mCalPopup;
81}; 83};
82 84
83#endif 85#endif
diff --git a/korganizer/koeventview.cpp b/korganizer/koeventview.cpp
index 1d26930..a4ba85e 100644
--- a/korganizer/koeventview.cpp
+++ b/korganizer/koeventview.cpp
@@ -8,33 +8,33 @@
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qpopupmenu.h> 24#include <q3popupmenu.h>
25#include <qcursor.h> 25#include <qcursor.h>
26 26
27#include <klocale.h> 27#include <klocale.h>
28#include <kdebug.h> 28#include <kdebug.h>
29#include <kiconloader.h> 29#include <kiconloader.h>
30#include <kmessagebox.h> 30#include <kmessagebox.h>
31 31
32#include <libkcal/calendar.h> 32#include <libkcal/calendar.h>
33#include "koprefs.h" 33#include "koprefs.h"
34#include "koeventview.h" 34#include "koeventview.h"
35using namespace KOrg; 35using namespace KOrg;
36 36
37//--------------------------------------------------------------------------- 37//---------------------------------------------------------------------------
38 38
39KOEventView::KOEventView(Calendar *cal,QWidget *parent,const char *name) 39KOEventView::KOEventView(Calendar *cal,QWidget *parent,const char *name)
40 : KOrg::BaseView(cal,parent,name) 40 : KOrg::BaseView(cal,parent,name)
@@ -60,33 +60,33 @@ KOEventPopupMenu *KOEventView::eventPopup()
60 connect(eventPopup,SIGNAL(deleteIncidenceSignal(Incidence *)), 60 connect(eventPopup,SIGNAL(deleteIncidenceSignal(Incidence *)),
61 SIGNAL(deleteIncidenceSignal(Incidence *))); 61 SIGNAL(deleteIncidenceSignal(Incidence *)));
62 connect(eventPopup,SIGNAL(cancelIncidenceSignal(Incidence *)), 62 connect(eventPopup,SIGNAL(cancelIncidenceSignal(Incidence *)),
63 SIGNAL(cancelIncidenceSignal(Incidence *))); 63 SIGNAL(cancelIncidenceSignal(Incidence *)));
64 connect(eventPopup,SIGNAL(cloneIncidenceSignal(Incidence *)), 64 connect(eventPopup,SIGNAL(cloneIncidenceSignal(Incidence *)),
65 SIGNAL(cloneIncidenceSignal(Incidence *))); 65 SIGNAL(cloneIncidenceSignal(Incidence *)));
66 connect(eventPopup,SIGNAL(beamIncidenceSignal(Incidence *)), 66 connect(eventPopup,SIGNAL(beamIncidenceSignal(Incidence *)),
67 SIGNAL(beamIncidenceSignal(Incidence *))); 67 SIGNAL(beamIncidenceSignal(Incidence *)));
68 connect(eventPopup,SIGNAL(moveIncidenceSignal(Incidence *)), 68 connect(eventPopup,SIGNAL(moveIncidenceSignal(Incidence *)),
69 SIGNAL(moveIncidenceSignal(Incidence *))); 69 SIGNAL(moveIncidenceSignal(Incidence *)));
70 70
71 return eventPopup; 71 return eventPopup;
72} 72}
73 73
74//--------------------------------------------------------------------------- 74//---------------------------------------------------------------------------
75 75
76void KOEventView::showIncidencePopup(QPopupMenu *popup,Incidence *event) 76void KOEventView::showIncidencePopup(Q3PopupMenu *popup,Incidence *event)
77{ 77{
78 mCurrentIncidence = event; 78 mCurrentIncidence = event;
79 if (event) popup->popup(QCursor::pos()); 79 if (event) popup->popup(QCursor::pos());
80} 80}
81 81
82//--------------------------------------------------------------------------- 82//---------------------------------------------------------------------------
83 83
84void KOEventView::popupShow() 84void KOEventView::popupShow()
85{ 85{
86 emit showIncidenceSignal(mCurrentIncidence); 86 emit showIncidenceSignal(mCurrentIncidence);
87} 87}
88 88
89//--------------------------------------------------------------------------- 89//---------------------------------------------------------------------------
90 90
91void KOEventView::popupEdit() 91void KOEventView::popupEdit()
92{ 92{
diff --git a/korganizer/koeventview.h b/korganizer/koeventview.h
index 77ec111..f28e68b 100644
--- a/korganizer/koeventview.h
+++ b/korganizer/koeventview.h
@@ -17,32 +17,34 @@
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef _KOEVENTVIEW_H 24#ifndef _KOEVENTVIEW_H
25#define _KOEVENTVIEW_H 25#define _KOEVENTVIEW_H
26 26
27#include <libkcal/calendar.h> 27#include <libkcal/calendar.h>
28#include <libkcal/event.h> 28#include <libkcal/event.h>
29 29
30#include <korganizer/baseview.h> 30#include <korganizer/baseview.h>
31 31
32#include "koeventpopupmenu.h" 32#include "koeventpopupmenu.h"
33//Added by qt3to4:
34#include <Q3PopupMenu>
33 35
34using namespace KCal; 36using namespace KCal;
35 37
36class CalPrinter; 38class CalPrinter;
37 39
38/** 40/**
39 KOEventView is the abstract base class from which all other 41 KOEventView is the abstract base class from which all other
40 calendar views for event data are derived. It provides methods for 42 calendar views for event data are derived. It provides methods for
41 displaying 43 displaying
42 appointments and events on one or more days. The actual number of 44 appointments and events on one or more days. The actual number of
43 days that a view actually supports is not defined by this abstract class; 45 days that a view actually supports is not defined by this abstract class;
44 that is up to the classes that inherit from it. It also provides 46 that is up to the classes that inherit from it. It also provides
45 methods for updating the display, retrieving the currently selected 47 methods for updating the display, retrieving the currently selected
46 event (or events), and the like. 48 event (or events), and the like.
47 49
48 @short Abstract class from which all event views are derived. 50 @short Abstract class from which all event views are derived.
@@ -74,33 +76,33 @@ class KOEventView : public KOrg::BaseView
74 76
75 /** 77 /**
76 * Construct a standard context menu for an event. 78 * Construct a standard context menu for an event.
77 */ 79 */
78 KOEventPopupMenu *eventPopup(); 80 KOEventPopupMenu *eventPopup();
79 81
80 /** This view is an view for displaying events. */ 82 /** This view is an view for displaying events. */
81 bool isEventView() { return true; } 83 bool isEventView() { return true; }
82 84
83 public slots: 85 public slots:
84 86
85 /** 87 /**
86 * Show context menu for event. 88 * Show context menu for event.
87 * @param event event, which is to be manipulated by the menu actions 89 * @param event event, which is to be manipulated by the menu actions
88 * @param popup a popop menu created with eventPopup() 90 * @param popup a popop menu created with eventPopup()
89 */ 91 */
90 void showIncidencePopup(QPopupMenu *popup, Incidence *event); 92 void showIncidencePopup(Q3PopupMenu *popup, Incidence *event);
91 93
92 /** 94 /**
93 Perform the default action for an incidence, e.g. open the event editor, 95 Perform the default action for an incidence, e.g. open the event editor,
94 when double-clicking an event in the agenda view. 96 when double-clicking an event in the agenda view.
95 */ 97 */
96 void defaultAction( Incidence * ); 98 void defaultAction( Incidence * );
97 99
98 signals: 100 signals:
99 /** 101 /**
100 * when the view changes the dates that are selected in one way or 102 * when the view changes the dates that are selected in one way or
101 * another, this signal is emitted. It should be connected back to 103 * another, this signal is emitted. It should be connected back to
102 * the @see KDateNavigator object so that it changes appropriately, 104 * the @see KDateNavigator object so that it changes appropriately,
103 * and any other objects that need to be aware that the list of 105 * and any other objects that need to be aware that the list of
104 * selected dates has changed. 106 * selected dates has changed.
105 */ 107 */
106 void datesSelected(const DateList); 108 void datesSelected(const DateList);
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index c0acf34..4df26a9 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -4,102 +4,107 @@
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qcstring.h> 20#include <q3cstring.h>
21#include <qwhatsthis.h> 21#include <q3whatsthis.h>
22#include <qdialog.h> 22#include <qdialog.h>
23#include <qapplication.h> 23#include <qapplication.h>
24#include <QDesktopWidget>
24#include <qlabel.h> 25#include <qlabel.h>
25#include <qlayout.h> 26#include <qlayout.h>
27//Added by qt3to4:
28#include <QKeyEvent>
29#include <Q3PtrList>
30#include <Q3VBoxLayout>
26 31
27#include <klocale.h> 32#include <klocale.h>
28#include <kapplication.h> 33#include <kapplication.h>
29#include <libkcal/event.h> 34#include <libkcal/event.h>
30#include <libkcal/todo.h> 35#include <libkcal/todo.h>
31#include <kdebug.h> 36#include <kdebug.h>
32#include <kiconloader.h> 37#include <kiconloader.h>
33#include <krun.h> 38#include <krun.h>
34#include <kglobal.h> 39#include <kglobal.h>
35#include <kprocess.h> 40#include <kprocess.h>
36#include "koprefs.h" 41#include "koprefs.h"
37 42
38#include <kabc/stdaddressbook.h> 43#include <kabc/stdaddressbook.h>
39 44
40#ifndef KORG_NODCOP 45#ifndef KORG_NODCOP
41#include <dcopclient.h> 46#include <dcopclient.h>
42#include "korganizer.h" 47#include "korganizer.h"
43#include "koprefs.h" 48#include "koprefs.h"
44#include "actionmanager.h" 49#include "actionmanager.h"
45#endif 50#endif
46 51
47#include "koeventviewer.h" 52#include "koeventviewer.h"
48//#ifndef KORG_NOKABC 53//#ifndef KORG_NOKABC
49//#include <kabc/stdaddressbook.h> 54//#include <kabc/stdaddressbook.h>
50//#define size count 55//#define size count
51//#endif 56//#endif
52 57
53#ifdef DESKTOP_VERSION 58#ifdef DESKTOP_VERSION
54#include <kabc/addresseedialog.h> 59#include <kabc/addresseedialog.h>
55#include <kabc/addresseeview.h> 60#include <kabc/addresseeview.h>
56#include <qprinter.h> 61#include <qprinter.h>
57#include <qpainter.h> 62#include <qpainter.h>
58#include <qpaintdevicemetrics.h> 63#include <q3paintdevicemetrics.h>
59#else //DESKTOP_VERSION 64#else //DESKTOP_VERSION
60#include <qtopia/qcopenvelope_qws.h> 65#include <qtopia/qcopenvelope_qws.h>
61#endif //DESKTOP_VERSION 66#endif //DESKTOP_VERSION
62#include <externalapphandler.h> 67#include <externalapphandler.h>
63 68
64KOEventViewer::KOEventViewer(QWidget *parent,const char *name) 69KOEventViewer::KOEventViewer(QWidget *parent,const char *name)
65 : QTextBrowser(parent,name) 70 : Q3TextBrowser(parent,name)
66{ 71{
67 mSyncMode = false; 72 mSyncMode = false;
68 mColorMode = 0; 73 mColorMode = 0;
69} 74}
70 75
71KOEventViewer::~KOEventViewer() 76KOEventViewer::~KOEventViewer()
72{ 77{
73} 78}
74 79
75void KOEventViewer::printMe() 80void KOEventViewer::printMe()
76{ 81{
77#ifdef DESKTOP_VERSION 82#ifdef DESKTOP_VERSION
78 83
79 KOPrintPrefs pp ( this ); 84 KOPrintPrefs pp ( this );
80 if (!pp.exec() ) 85 if (!pp.exec() )
81 return; 86 return;
82 int scaleval = pp.printMode() ; 87 int scaleval = pp.printMode() ;
83 88
84 QPrinter printer; 89 QPrinter printer;
85 if (!printer.setup() ) 90 if (!printer.setup() )
86 return; 91 return;
87 QPainter p; 92 QPainter p;
88 p.begin ( &printer ); 93 p.begin ( &printer );
89 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 94 Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer );
90 float dx, dy; 95 float dx, dy;
91 int wid = (m.width() * 9)/10; 96 int wid = (m.width() * 9)/10;
92 dx = (float) wid/(float)contentsWidth (); 97 dx = (float) wid/(float)contentsWidth ();
93 dy = (float)(m.height()) / (float)contentsHeight (); 98 dy = (float)(m.height()) / (float)contentsHeight ();
94 float scale; 99 float scale;
95 // scale to fit the width or height of the paper 100 // scale to fit the width or height of the paper
96 if ( dx < dy ) 101 if ( dx < dy )
97 scale = dx; 102 scale = dx;
98 else 103 else
99 scale = dy; 104 scale = dy;
100 105
101 p.translate( m.width()/10,0 ); 106 p.translate( m.width()/10,0 );
102 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { 107 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
103 p.scale( scale, scale ); 108 p.scale( scale, scale );
104 } 109 }
105 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); 110 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
@@ -121,54 +126,54 @@ void KOEventViewer::setSource(const QString& n)
121 } 126 }
122 127
123 if ( n.left(3) == "uid" ) 128 if ( n.left(3) == "uid" )
124#ifdef DESKTOP_VERSION 129#ifdef DESKTOP_VERSION
125 { 130 {
126 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 131 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
127 KABC::AddressBook::Iterator it; 132 KABC::AddressBook::Iterator it;
128 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 133 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
129 // LR I do not understand, why the uid string is different on zaurus and desktop 134 // LR I do not understand, why the uid string is different on zaurus and desktop
130 QString uid = "uid://"+(*it).uid(); 135 QString uid = "uid://"+(*it).uid();
131 136
132 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); 137 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1());
133 if (n == uid ) { 138 if (n == uid ) {
134 //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); 139 //qDebug("found %s ",(*it).mobileHomePhone().latin1() );
135 QDialog dia( this,"dia123", true ); 140 QDialog dia( this,"dia123", true );
136 dia.setCaption( i18n("Details of attendee") ); 141 dia.setCaption( i18n("Details of attendee") );
137 QVBoxLayout lay ( &dia ); 142 Q3VBoxLayout lay ( &dia );
138 KABC::AddresseeView av ( &dia ); 143 KABC::AddresseeView av ( &dia );
139 av.setAddressee( (*it) ); 144 av.setAddressee( (*it) );
140 lay.addWidget( &av ); 145 lay.addWidget( &av );
141 if ( QApplication::desktop()->width() < 480 ) 146 if ( QApplication::desktop()->width() < 480 )
142 dia.resize( 220, 240); 147 dia.resize( 220, 240);
143 else { 148 else {
144 dia.resize( 400,400); 149 dia.resize( 400,400);
145 } 150 }
146 dia.exec(); 151 dia.exec();
147 break; 152 break;
148 } 153 }
149 } 154 }
150 return; 155 return;
151 } 156 }
152#else 157#else
153 { 158 {
154 if ( "uid:organizer" == n ) { 159 if ( "uid:organizer" == n ) {
155 ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); 160 ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),"");
156 return; 161 return;
157 } 162 }
158 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 163 Q3PtrList<Attendee> attendees = mCurrentIncidence->attendees();
159 if (attendees.count()) { 164 if (attendees.count()) {
160 Attendee *a; 165 Attendee *a;
161 for(a=attendees.first();a;a=attendees.next()) { 166 for(a=attendees.first();a;a=attendees.next()) {
162 if ( "uid:"+a->uid() == n ) { 167 if ( "uid:"+a->uid() == n ) {
163 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); 168 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid());
164 return; 169 return;
165 } 170 }
166 } 171 }
167 } 172 }
168 return; 173 return;
169 } 174 }
170 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 175 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
171 // the result should now arrive through method insertAttendees 176 // the result should now arrive through method insertAttendees
172 //QString uid = "uid:"+(*it).uid(); 177 //QString uid = "uid:"+(*it).uid();
173#endif 178#endif
174 if ( n.left(6) == "mailto" ) { 179 if ( n.left(6) == "mailto" ) {
@@ -187,93 +192,93 @@ void KOEventViewer::setSource(const QString& n)
187 192
188 } 193 }
189 194
190 195
191#ifndef KORG_NODCOP 196#ifndef KORG_NODCOP
192 kdDebug() << "KOEventViewer::setSource(): " << n << endl; 197 kdDebug() << "KOEventViewer::setSource(): " << n << endl;
193 QString tmpStr; 198 QString tmpStr;
194 if (n.startsWith("mailto:")) { 199 if (n.startsWith("mailto:")) {
195 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); 200 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null);
196 //emit showIncidence(n); 201 //emit showIncidence(n);
197 return; 202 return;
198 } else if (n.startsWith("uid:")) { 203 } else if (n.startsWith("uid:")) {
199 DCOPClient *client = KApplication::kApplication()->dcopClient(); 204 DCOPClient *client = KApplication::kApplication()->dcopClient();
200 const QByteArray noParamData; 205 const QByteArray noParamData;
201 const QByteArray paramData; 206 const QByteArray paramData;
202 QByteArray replyData; 207 QByteArray replyData;
203 QCString replyTypeStr; 208 Q3CString replyTypeStr;
204#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) 209#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData))
205 bool foundAbbrowser = PING_ABBROWSER; 210 bool foundAbbrowser = PING_ABBROWSER;
206 211
207 if (foundAbbrowser) { 212 if (foundAbbrowser) {
208 //KAddressbook is already running, so just DCOP to it to bring up the contact editor 213 //KAddressbook is already running, so just DCOP to it to bring up the contact editor
209 //client->send("kaddressbook","KAddressBookIface", 214 //client->send("kaddressbook","KAddressBookIface",
210 QDataStream arg(paramData, IO_WriteOnly); 215 QDataStream arg(paramData, QIODevice::WriteOnly);
211 arg << n.mid(6); 216 arg << n.mid(6);
212 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); 217 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData);
213 return; 218 return;
214 } else { 219 } else {
215 /* 220 /*
216 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. 221 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater.
217 We start it without its main interface 222 We start it without its main interface
218 */ 223 */
219 KIconLoader* iconLoader = new KIconLoader(); 224 KIconLoader* iconLoader = new KIconLoader();
220 QString iconPath = iconLoader->iconPath("go",KIcon::Small); 225 QString iconPath = iconLoader->iconPath("go",KIcon::Small);
221 ActionManager::setStartedKAddressBook(true); 226 ActionManager::setStartedKAddressBook(true);
222 tmpStr = "kaddressbook --editor-only --uid "; 227 tmpStr = "kaddressbook --editor-only --uid ";
223 tmpStr += KProcess::quote(n.mid(6)); 228 tmpStr += KProcess::quote(n.mid(6));
224 KRun::runCommand(tmpStr,"KAddressBook",iconPath); 229 KRun::runCommand(tmpStr,"KAddressBook",iconPath);
225 return; 230 return;
226 } 231 }
227 } else { 232 } else {
228 //QTextBrowser::setSource(n); 233 //QTextBrowser::setSource(n);
229 } 234 }
230#endif 235#endif
231} 236}
232void KOEventViewer::mailToAttendees( bool all ) 237void KOEventViewer::mailToAttendees( bool all )
233{ 238{
234 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 239 Q3PtrList<Attendee> attendees = mCurrentIncidence->attendees();
235 if (attendees.count() == 0) return; 240 if (attendees.count() == 0) return;
236 QStringList nameList; 241 QStringList nameList;
237 QStringList emailList; 242 QStringList emailList;
238 QStringList uidList; 243 QStringList uidList;
239 Attendee* a; 244 Attendee* a;
240 for(a=attendees.first();a;a=attendees.next()) { 245 for(a=attendees.first();a;a=attendees.next()) {
241 if ( !all && !a->RSVP() ) continue; 246 if ( !all && !a->RSVP() ) continue;
242 if (!a->email().isEmpty()) { 247 if (!a->email().isEmpty()) {
243#ifndef DESKTOP_VERSION 248#ifndef DESKTOP_VERSION
244 nameList.append (a->realName() ); 249 nameList.append (a->realName() );
245 emailList.append (a->email() ); 250 emailList.append (a->email() );
246 uidList.append (a->uid() ); 251 uidList.append (a->uid() );
247#else 252#else
248 emailList.append(a->realName() +" <" + a->email() +">"); 253 emailList.append(a->realName() +" <" + a->email() +">");
249#endif 254#endif
250 } 255 }
251 } 256 }
252#ifndef DESKTOP_VERSION 257#ifndef DESKTOP_VERSION
253 QString uid = "ComposeMailUIpick2"+mMailSubject; 258 QString uid = "ComposeMailUIpick2"+mMailSubject;
254 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 259 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
255 260
256#else 261#else
257 ExternalAppHandler::instance()->mailToMultipleContacts( emailList.join(","), mMailSubject ); 262 ExternalAppHandler::instance()->mailToMultipleContacts( emailList.join(","), mMailSubject );
258#endif 263#endif
259 264
260} 265}
261void KOEventViewer::addTag(const QString & tag,const QString & text) 266void KOEventViewer::addTag(const QString & tag,const QString & text)
262{ 267{
263 int number=text.contains("\n"); 268 int number=text.count("\n");
264 QString str = "<" + tag + ">"; 269 QString str = "<" + tag + ">";
265 QString tmpText=text; 270 QString tmpText=text;
266 QString tmpStr=str; 271 QString tmpStr=str;
267 if(number !=-1) 272 if(number !=-1)
268 { 273 {
269 if (number > 0) { 274 if (number > 0) {
270 int pos=0; 275 int pos=0;
271 QString tmp; 276 QString tmp;
272 for(int i=0;i<=number;i++) { 277 for(int i=0;i<=number;i++) {
273 pos=tmpText.find("\n"); 278 pos=tmpText.find("\n");
274 tmp=tmpText.left(pos); 279 tmp=tmpText.left(pos);
275 tmpText=tmpText.right(tmpText.length()-pos-1); 280 tmpText=tmpText.right(tmpText.length()-pos-1);
276 tmpStr+=tmp+"<br>"; 281 tmpStr+=tmp+"<br>";
277 } 282 }
278 } 283 }
279 else tmpStr += tmpText; 284 else tmpStr += tmpText;
@@ -574,33 +579,33 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
574 addTag("p",i18n("<b>Last modified: ") +" </b>"); 579 addTag("p",i18n("<b>Last modified: ") +" </b>");
575 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 580 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
576 } 581 }
577 } 582 }
578 if ( event->relatedTo() ) { 583 if ( event->relatedTo() ) {
579 addTag("b",i18n("Parent todo:<br>")); 584 addTag("b",i18n("Parent todo:<br>"));
580 585
581 QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary()); 586 QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary());
582 587
583 mText += t_name; 588 mText += t_name;
584 mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">"; 589 mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">";
585 mText += deTag(event->relatedTo()->summary()); 590 mText += deTag(event->relatedTo()->summary());
586 mText += "</a><br>"; 591 mText += "</a><br>";
587 592
588 // mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>"); 593 // mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>");
589 } 594 }
590 QPtrList<Incidence> Relations = event->relations(); 595 Q3PtrList<Incidence> Relations = event->relations();
591 Incidence *to; 596 Incidence *to;
592 if ( Relations.first() ) 597 if ( Relations.first() )
593 addTag("b",i18n("Sub todos:<br>")); 598 addTag("b",i18n("Sub todos:<br>"));
594 for (to=Relations.first();to;to=Relations.next()) { 599 for (to=Relations.first();to;to=Relations.next()) {
595 QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary()); 600 QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary());
596 mText += t_name; 601 mText += t_name;
597 mText += "<a href=\"todo_uid:" + to->uid() + "\">"; 602 mText += "<a href=\"todo_uid:" + to->uid() + "\">";
598 mText += deTag(to->summary()); 603 mText += deTag(to->summary());
599 mText += "</a><br>"; 604 mText += "</a><br>";
600 605
601 } 606 }
602 607
603 if ( KOPrefs::instance()->mEVshowDetails ) { 608 if ( KOPrefs::instance()->mEVshowDetails ) {
604 if (!event->description().isEmpty()) { 609 if (!event->description().isEmpty()) {
605 addTag("p",i18n("<b>Details: </b>")); 610 addTag("p",i18n("<b>Details: </b>"));
606 addTag("p",deTag(event->description())); 611 addTag("p",deTag(event->description()));
@@ -608,66 +613,66 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
608 } 613 }
609 setText(mText); 614 setText(mText);
610} 615}
611 616
612void KOEventViewer::formatCategories(Incidence *event) 617void KOEventViewer::formatCategories(Incidence *event)
613{ 618{
614 if (!event->categoriesStr().isEmpty()) { 619 if (!event->categoriesStr().isEmpty()) {
615 if (event->categories().count() == 1) { 620 if (event->categories().count() == 1) {
616 addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace()); 621 addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace());
617 } else { 622 } else {
618 addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ; 623 addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ;
619 } 624 }
620 } 625 }
621} 626}
622void KOEventViewer::formatAttendees(Incidence *event) 627void KOEventViewer::formatAttendees(Incidence *event)
623{ 628{
624 QPtrList<Attendee> attendees = event->attendees(); 629 Q3PtrList<Attendee> attendees = event->attendees();
625 if (attendees.count()) { 630 if (attendees.count()) {
626 631
627 632
628 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 633 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
629 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); 634 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
630 addTag("h3",i18n("Organizer")); 635 addTag("h3",i18n("Organizer"));
631 mText.append("<ul><li>"); 636 mText.append("<ul><li>");
632#ifndef KORG_NOKABC 637#ifndef KORG_NOKABC
633 638
634#ifdef DESKTOP_VERSION 639#ifdef DESKTOP_VERSION
635 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 640 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
636 KABC::Addressee::List addressList; 641 KABC::Addressee::List addressList;
637 addressList = add_book->findByEmail(event->organizer()); 642 addressList = add_book->findByEmail(event->organizer());
638 KABC::Addressee o = addressList.first(); 643 KABC::Addressee o = addressList.first();
639 if (!o.isEmpty() && addressList.size()<2) { 644 if (!o.isEmpty() && addressList.size()<2) {
640 mText += "<a href=\"uid:" + o.uid() + "\">"; 645 mText += "<a href=\"uid:" + o.uid() + "\">";
641 mText += o.formattedName(); 646 mText += o.formattedName();
642 mText += "</a>\n"; 647 mText += "</a>\n";
643 } else { 648 } else {
644 mText.append(event->organizer()); 649 mText.append(event->organizer());
645 } 650 }
646#else //DESKTOP_VERSION 651#else //DESKTOP_VERSION
647 mText += "<a href=\"uid:organizer\">"; 652 mText += "<a href=\"uid:organizer\">";
648 mText += event->organizer(); 653 mText += event->organizer();
649 mText += "</a>\n"; 654 mText += "</a>\n";
650#endif //DESKTOP_VERSION 655#endif //DESKTOP_VERSION
651 656
652 657
653#else 658#else
654 mText.append(event->organizer()); 659 mText.append(event->organizer());
655#endif 660#endif
656 661
657 if (iconPath) { 662 if (!iconPath.isEmpty()) {
658 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 663 mText += " <a href=\"mailto:" + event->organizer() + "\">";
659 mText += "<IMG src=\"" + iconPath + "\">"; 664 mText += "<IMG src=\"" + iconPath + "\">";
660 mText += "</a>\n"; 665 mText += "</a>\n";
661 } 666 }
662 mText.append("</li></ul>"); 667 mText.append("</li></ul>");
663 668
664 addTag("h3",i18n("Attendees")); 669 addTag("h3",i18n("Attendees"));
665 Attendee *a; 670 Attendee *a;
666 mText.append("<ul>"); 671 mText.append("<ul>");
667 int a_count = 0; 672 int a_count = 0;
668 int a_count_nr = 0; 673 int a_count_nr = 0;
669 674
670 for(a=attendees.first();a;a=attendees.next()) { 675 for(a=attendees.first();a;a=attendees.next()) {
671#ifndef KORG_NOKABC 676#ifndef KORG_NOKABC
672#ifdef DESKTOP_VERSION 677#ifdef DESKTOP_VERSION
673 if (a->name().isEmpty()) { 678 if (a->name().isEmpty()) {
@@ -691,33 +696,33 @@ void KOEventViewer::formatAttendees(Incidence *event)
691#else //DESKTOP_VERSION 696#else //DESKTOP_VERSION
692 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 697 mText += "<li><a href=\"uid:" + a->uid() + "\">";
693 if (!a->name().isEmpty()) mText += a->name(); 698 if (!a->name().isEmpty()) mText += a->name();
694 else mText += a->email(); 699 else mText += a->email();
695 mText += "</a>\n"; 700 mText += "</a>\n";
696#endif //DESKTOP_VERSION 701#endif //DESKTOP_VERSION
697#else 702#else
698 //qDebug("nokabc "); 703 //qDebug("nokabc ");
699 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 704 mText += "<li><a href=\"uid:" + a->uid() + "\">";
700 if (!a->name().isEmpty()) mText += a->name(); 705 if (!a->name().isEmpty()) mText += a->name();
701 else mText += a->email(); 706 else mText += a->email();
702 mText += "</a>\n"; 707 mText += "</a>\n";
703#endif 708#endif
704 709
705 710
706 if (!a->email().isEmpty()) { 711 if (!a->email().isEmpty()) {
707 if (iconPath) { 712 if (!iconPath.isEmpty()) {
708 mText += "<a href=\"mailto:" + a->realName() +" <" + a->email() + ">:" + mMailSubject + "\">"; 713 mText += "<a href=\"mailto:" + a->realName() +" <" + a->email() + ">:" + mMailSubject + "\">";
709 if ( a->RSVP() ) { 714 if ( a->RSVP() ) {
710 ++a_count_nr; 715 ++a_count_nr;
711 mText += "<IMG src=\"" + iconPath + "\">"; 716 mText += "<IMG src=\"" + iconPath + "\">";
712 } 717 }
713 else { 718 else {
714 ++a_count; 719 ++a_count;
715 mText += "<IMG src=\"" + NOiconPath + "\">"; 720 mText += "<IMG src=\"" + NOiconPath + "\">";
716 } 721 }
717 mText += "</a>\n"; 722 mText += "</a>\n";
718 } 723 }
719 } 724 }
720 if (a->status() != Attendee::NeedsAction ) 725 if (a->status() != Attendee::NeedsAction )
721 mText +="[" + a->statusStr() + "] "; 726 mText +="[" + a->statusStr() + "] ";
722 if (a->role() == Attendee::Chair ) 727 if (a->role() == Attendee::Chair )
723 mText +="(" + a->roleStr().left(1) + ".)"; 728 mText +="(" + a->roleStr().left(1) + ".)";
@@ -849,20 +854,20 @@ QString KOEventViewer::deTag(QString text)
849 text.replace( QRegExp("<") , "&lt;" ); 854 text.replace( QRegExp("<") , "&lt;" );
850 } 855 }
851 if ( text.find ('>') >= 0 ) { 856 if ( text.find ('>') >= 0 ) {
852 text.replace( QRegExp(">") , "&gt;" ); 857 text.replace( QRegExp(">") , "&gt;" );
853 } 858 }
854#endif 859#endif
855 return text; 860 return text;
856} 861}
857void KOEventViewer::keyPressEvent ( QKeyEvent * e ) 862void KOEventViewer::keyPressEvent ( QKeyEvent * e )
858{ 863{
859 switch ( e->key() ) { 864 switch ( e->key() ) {
860 case Qt::Key_Return: 865 case Qt::Key_Return:
861 case Qt::Key_Enter : 866 case Qt::Key_Enter :
862 e->ignore(); 867 e->ignore();
863 break; 868 break;
864 default: 869 default:
865 QTextBrowser::keyPressEvent ( e ); 870 Q3TextBrowser::keyPressEvent ( e );
866 break; 871 break;
867 } 872 }
868} 873}
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h
index 64eb4ff..3df667f 100644
--- a/korganizer/koeventviewer.h
+++ b/korganizer/koeventviewer.h
@@ -9,94 +9,97 @@
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19#ifndef KOEVENTVIEWER_H 19#ifndef KOEVENTVIEWER_H
20#define KOEVENTVIEWER_H 20#define KOEVENTVIEWER_H
21// 21//
22// Viewer widget for events. 22// Viewer widget for events.
23// 23//
24 24
25#include <qtextbrowser.h> 25#include <q3textbrowser.h>
26//Added by qt3to4:
27#include <Q3VBoxLayout>
28#include <QKeyEvent>
26 29
27#include <libkcal/event.h> 30#include <libkcal/event.h>
28#include <libkcal/journal.h> 31#include <libkcal/journal.h>
29 32
30 33
31using namespace KCal; 34using namespace KCal;
32 35
33#ifdef DESKTOP_VERSION 36#ifdef DESKTOP_VERSION
34 37
35#include <qradiobutton.h> 38#include <qradiobutton.h>
36#include <qpushbutton.h> 39#include <qpushbutton.h>
37#include <qlayout.h> 40#include <qlayout.h>
38#include <qdialog.h> 41#include <qdialog.h>
39#include <qlabel.h> 42#include <qlabel.h>
40#include <qbuttongroup.h> 43#include <q3buttongroup.h>
41#include <kglobal.h> 44#include <kglobal.h>
42 45
43class KOPrintPrefs : public QDialog 46class KOPrintPrefs : public QDialog
44{ 47{
45 public: 48 public:
46 KOPrintPrefs( QWidget *parent=0, const char *name=0 ) : 49 KOPrintPrefs( QWidget *parent=0, const char *name=0 ) :
47 QDialog( parent, name, true ) 50 QDialog( parent, name, true )
48 { 51 {
49 setCaption( i18n("KO/Pi Printout") ); 52 setCaption( i18n("KO/Pi Printout") );
50 QVBoxLayout* lay = new QVBoxLayout( this ); 53 Q3VBoxLayout* lay = new Q3VBoxLayout( this );
51 lay->setSpacing( 9 ); 54 lay->setSpacing( 9 );
52 lay->setMargin( 9 ); 55 lay->setMargin( 9 );
53 QLabel * lab = new QLabel( i18n("This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n"), this ); 56 QLabel * lab = new QLabel( i18n("This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n"), this );
54 lay->addWidget( lab ); 57 lay->addWidget( lab );
55 lab->setAlignment( AlignCenter ); 58 lab->setAlignment( Qt::AlignCenter );
56 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Printout Mode"), this ); 59 Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Printout Mode"), this );
57 lay->addWidget( format ); 60 lay->addWidget( format );
58 format->setExclusive ( true ) ; 61 format->setExclusive ( true ) ;
59 pmNo = new QRadioButton(i18n("Print unscaled"), format ); 62 pmNo = new QRadioButton(i18n("Print unscaled"), format );
60 pmScaledDown = new QRadioButton(i18n("Print scaled down to fit one page"), format ); 63 pmScaledDown = new QRadioButton(i18n("Print scaled down to fit one page"), format );
61 new QRadioButton(i18n("Print scaled up/down to fit one page"), format ); 64 new QRadioButton(i18n("Print scaled up/down to fit one page"), format );
62 pmScaledDown->setChecked( true ); 65 pmScaledDown->setChecked( true );
63 QPushButton * ok = new QPushButton( i18n("OK"), this ); 66 QPushButton * ok = new QPushButton( i18n("OK"), this );
64 lay->addWidget( ok ); 67 lay->addWidget( ok );
65 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 68 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
66 lay->addWidget( cancel ); 69 lay->addWidget( cancel );
67 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 70 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
68 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 71 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
69 } 72 }
70 73
71 int printMode() 74 int printMode()
72 { 75 {
73 if ( pmNo->isChecked() ) 76 if ( pmNo->isChecked() )
74 return 0; 77 return 0;
75 if ( pmScaledDown->isChecked() ) 78 if ( pmScaledDown->isChecked() )
76 return 1; 79 return 1;
77 return 2; 80 return 2;
78 } 81 }
79private: 82private:
80 QRadioButton* pmNo; 83 QRadioButton* pmNo;
81 QRadioButton* pmScaledDown; 84 QRadioButton* pmScaledDown;
82}; 85};
83 86
84#endif 87#endif
85 88
86class KOEventViewer : public QTextBrowser { 89class KOEventViewer : public Q3TextBrowser {
87 Q_OBJECT 90 Q_OBJECT
88 public: 91 public:
89 KOEventViewer(QWidget *parent=0,const char *name=0); 92 KOEventViewer(QWidget *parent=0,const char *name=0);
90 virtual ~KOEventViewer(); 93 virtual ~KOEventViewer();
91 94
92 void setSource(const QString &); 95 void setSource(const QString &);
93 void setEvent(Event *event); 96 void setEvent(Event *event);
94 void addEvent(Event *event); 97 void addEvent(Event *event);
95 void setTodo(Todo *event, bool clearV = true ); 98 void setTodo(Todo *event, bool clearV = true );
96 void setJournal(Journal *jour, bool clearV = true ); 99 void setJournal(Journal *jour, bool clearV = true );
97 100
98 void appendEvent(Event *event, int mode = 0 ); 101 void appendEvent(Event *event, int mode = 0 );
99 void appendTodo(Todo *event, int mode = 0 ); 102 void appendTodo(Todo *event, int mode = 0 );
100 void appendJournal(Journal *jour, int mode = 0 ); 103 void appendJournal(Journal *jour, int mode = 0 );
101 104
102 void clearEvents(bool now=false); 105 void clearEvents(bool now=false);
@@ -104,29 +107,29 @@ class KOEventViewer : public QTextBrowser {
104 void addText(QString text); 107 void addText(QString text);
105 void setSyncMode( bool ); 108 void setSyncMode( bool );
106 void setColorMode( int ); 109 void setColorMode( int );
107 void mailToAttendees( bool all ); 110 void mailToAttendees( bool all );
108 void printMe(); 111 void printMe();
109 112
110 protected: 113 protected:
111 int mColorMode; 114 int mColorMode;
112 void addTag(const QString & tag,const QString & text); 115 void addTag(const QString & tag,const QString & text);
113 116
114 void formatCategories(Incidence *event); 117 void formatCategories(Incidence *event);
115 void formatAttendees(Incidence *event); 118 void formatAttendees(Incidence *event);
116 void formatReadOnly(Incidence *event); 119 void formatReadOnly(Incidence *event);
117 void keyPressEvent ( QKeyEvent * e ); 120 void keyPressEvent ( QKeyEvent * e );
118 121
119 private: 122 private:
120 QTextBrowser *mEventTextView; 123 Q3TextBrowser *mEventTextView;
121 bool mSyncMode; 124 bool mSyncMode;
122 QString deTag(QString text); 125 QString deTag(QString text);
123 126
124 QString mText; 127 QString mText;
125 QString mMailSubject; 128 QString mMailSubject;
126 Incidence* mCurrentIncidence; 129 Incidence* mCurrentIncidence;
127 signals: 130 signals:
128 void launchaddressbook(QString uid); 131 void launchaddressbook(QString uid);
129 void showIncidence(QString uid); 132 void showIncidence(QString uid);
130}; 133};
131 134
132#endif 135#endif
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp
index 2e936f3..3a37852 100644
--- a/korganizer/koeventviewerdialog.cpp
+++ b/korganizer/koeventviewerdialog.cpp
@@ -9,38 +9,41 @@
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <klocale.h> 20#include <klocale.h>
21 21
22#include <libkcal/event.h> 22#include <libkcal/event.h>
23#include <qtimer.h> 23#include <qtimer.h>
24#include <qpushbutton.h> 24#include <qpushbutton.h>
25//Added by qt3to4:
26#include <QHideEvent>
27#include <QKeyEvent>
25 28
26#include "koeventviewer.h" 29#include "koeventviewer.h"
27#include <kmessagebox.h> 30#include <kmessagebox.h>
28#include "koprefs.h" 31#include "koprefs.h"
29#include <libkcal/todo.h> 32#include <libkcal/todo.h>
30#include "qapp.h" 33#include "qapplication.h"
31 34
32#include "koeventviewerdialog.h" 35#include "koeventviewerdialog.h"
33extern int globalFlagBlockAgenda; 36extern int globalFlagBlockAgenda;
34 37
35KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) 38KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name)
36 : KDialogBase(parent,name, 39 : KDialogBase(parent,name,
37#ifndef DESKTOP_VERSION 40#ifndef DESKTOP_VERSION
38 true , 41 true ,
39#else 42#else
40 false, 43 false,
41#endif 44#endif
42 i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) 45 i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda"))
43{ 46{
44 sendSignalViewerClosed = true; 47 sendSignalViewerClosed = true;
45 mEventViewer = new KOEventViewer(this); 48 mEventViewer = new KOEventViewer(this);
46 mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); 49 mEventViewer->setFont( KOPrefs::instance()->mEventViewFont );
diff --git a/korganizer/koeventviewerdialog.h b/korganizer/koeventviewerdialog.h
index 71696f4..947c10b 100644
--- a/korganizer/koeventviewerdialog.h
+++ b/korganizer/koeventviewerdialog.h
@@ -9,33 +9,36 @@
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19#ifndef KOEVENTVIEWERDIALOG_H 19#ifndef KOEVENTVIEWERDIALOG_H
20#define KOEVENTVIEWERDIALOG_H 20#define KOEVENTVIEWERDIALOG_H
21// 21//
22// Viewer dialog for events. 22// Viewer dialog for events.
23// 23//
24 24
25#include <qtextview.h> 25#include <q3textview.h>
26//Added by qt3to4:
27#include <QKeyEvent>
28#include <QHideEvent>
26 29
27#include <kdialogbase.h> 30#include <kdialogbase.h>
28 31
29#include <libkcal/event.h> 32#include <libkcal/event.h>
30 33
31using namespace KCal; 34using namespace KCal;
32 35
33class KOEventViewer; 36class KOEventViewer;
34 37
35class KOEventViewerDialog : public KDialogBase { 38class KOEventViewerDialog : public KDialogBase {
36 Q_OBJECT 39 Q_OBJECT
37 public: 40 public:
38 KOEventViewerDialog(QWidget *parent=0,const char *name=0); 41 KOEventViewerDialog(QWidget *parent=0,const char *name=0);
39 virtual ~KOEventViewerDialog(); 42 virtual ~KOEventViewerDialog();
40 43
41 void setEvent(Event *event); 44 void setEvent(Event *event);
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index ee9c9f6..8335ba9 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -14,54 +14,58 @@
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qcombobox.h> 25#include <qcombobox.h>
26#include <qpushbutton.h> 26#include <qpushbutton.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qdialog.h> 29#include <qdialog.h>
30#include <qtextstream.h> 30#include <q3textstream.h>
31#include <qtextcodec.h> 31#include <qtextcodec.h>
32#include <qwhatsthis.h> 32#include <q3whatsthis.h>
33#include <qdir.h> 33#include <qdir.h>
34//Added by qt3to4:
35#include <Q3GridLayout>
36#include <Q3Frame>
37#include <Q3PtrList>
34 38
35 39
36#include <libkcal/calfilter.h> 40#include <libkcal/calfilter.h>
37 41
38#include "kofilterview.h" 42#include "kofilterview.h"
39#include "koprefs.h" 43#include "koprefs.h"
40#include <kiconloader.h> 44#include <kiconloader.h>
41#include <kglobal.h> 45#include <kglobal.h>
42#include <kglobalsettings.h> 46#include <kglobalsettings.h>
43#include <kcolorbutton.h> 47#include <kcolorbutton.h>
44#include <kmessagebox.h> 48#include <kmessagebox.h>
45 49
46 50
47 51
48 52
49 53
50KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, 54KOFilterView::KOFilterView(Q3PtrList<CalFilter> *filterList,QWidget* parent,
51 const char* name,WFlags fl ) 55 const char* name,Qt::WFlags fl )
52 : KOFilterView_base(parent,name,fl) 56 : KOFilterView_base(parent,name,fl)
53{ 57{
54 mFilters = filterList; 58 mFilters = filterList;
55 59
56 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); 60 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged()));
57 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); 61 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged()));
58 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); 62 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters()));
59} 63}
60 64
61KOFilterView::~KOFilterView() 65KOFilterView::~KOFilterView()
62{ 66{
63 // no need to delete child widgets, Qt does it all for us 67 // no need to delete child widgets, Qt does it all for us
64} 68}
65 69
66bool KOFilterView::filtersEnabled() 70bool KOFilterView::filtersEnabled()
67{ 71{
@@ -101,40 +105,40 @@ void KOFilterView::setSelectedFilter(QString filterName)
101 mSelectionCombo->setCurrentItem(i); 105 mSelectionCombo->setCurrentItem(i);
102 } 106 }
103 emit filterChanged(); 107 emit filterChanged();
104} 108}
105void KOFilterView::setSelectedFilter( int fil ) 109void KOFilterView::setSelectedFilter( int fil )
106{ 110{
107 if ( fil >= mSelectionCombo->count() ) 111 if ( fil >= mSelectionCombo->count() )
108 return; 112 return;
109 mSelectionCombo->setCurrentItem( fil ); 113 mSelectionCombo->setCurrentItem( fil );
110 emit filterChanged(); 114 emit filterChanged();
111} 115}
112 116
113 117
114 118
115KOCalEditView::KOCalEditView(QWidget* parent, 119KOCalEditView::KOCalEditView(QWidget* parent,
116 const char* name ) 120 const char* name )
117 : QScrollView(parent,name) 121 : Q3ScrollView(parent,name)
118{ 122{
119 mw = 0; 123 mw = 0;
120 setResizePolicy( AutoOneFit ); 124 setResizePolicy( AutoOneFit );
121 setFrameStyle ( QFrame::Panel | QFrame::Plain ); 125 setFrameStyle ( Q3Frame::Panel | Q3Frame::Plain );
122 setLineWidth ( 1 ); 126 setLineWidth ( 1 );
123 setMidLineWidth ( 1 ); 127 setMidLineWidth ( 1 );
124 setFocusPolicy(NoFocus); 128 setFocusPolicy(Qt::NoFocus);
125} 129}
126 130
127KOCalEditView::~KOCalEditView() 131KOCalEditView::~KOCalEditView()
128{ 132{
129 // no need to delete child widgets, Qt does it all for us 133 // no need to delete child widgets, Qt does it all for us
130} 134}
131void KOCalEditView::selectCal(int id ,bool b) 135void KOCalEditView::selectCal(int id ,bool b)
132{ 136{
133 KOPrefs::instance()->getCalendar( id )->isEnabled = b; 137 KOPrefs::instance()->getCalendar( id )->isEnabled = b;
134 emit calendarEnabled ( id, b ); 138 emit calendarEnabled ( id, b );
135 emit needsUpdate(); 139 emit needsUpdate();
136 140
137} 141}
138void KOCalEditView::selectStdCal( int id ) 142void KOCalEditView::selectStdCal( int id )
139{ 143{
140 KOCalRadioButton* it = mStdandardB.first(); 144 KOCalRadioButton* it = mStdandardB.first();
@@ -234,81 +238,81 @@ void KOCalEditView::infoCal( int id )
234 emit requestCalendarInfo( id ); 238 emit requestCalendarInfo( id );
235 239
236 } 240 }
237} 241}
238void KOCalEditView::readConfig() 242void KOCalEditView::readConfig()
239{ 243{
240 244
241 mStdandardB.clear(); 245 mStdandardB.clear();
242 mEnabledB.clear(); 246 mEnabledB.clear();
243 mAlarmB.clear(); 247 mAlarmB.clear();
244 mROB.clear(); 248 mROB.clear();
245 249
246 if ( mw ) delete mw; 250 if ( mw ) delete mw;
247 mw = new QWidget ( viewport() ); 251 mw = new QWidget ( viewport() );
248 addChild(mw); 252 addChild(mw);
249 int ii = 0; 253 int ii = 0;
250 mainLayout = new QGridLayout ( mw , 2, 8 ); 254 mainLayout = new Q3GridLayout ( mw , 2, 8 );
251 mainLayout->setMargin( 2 ); 255 mainLayout->setMargin( 2 );
252 mainLayout->setSpacing( 2 ); 256 mainLayout->setSpacing( 2 );
253 QPushButton * addButT = new QPushButton ( mw ); 257 QPushButton * addButT = new QPushButton ( mw );
254 addButT->setFocusPolicy(NoFocus); 258 addButT->setFocusPolicy(Qt::NoFocus);
255 mainLayout->addWidget( addButT,0,0 ); 259 mainLayout->addWidget( addButT,0,0 );
256 addButT->setText( "D"); 260 addButT->setText( "D");
257 connect(addButT,SIGNAL(clicked()),SLOT(defaultInfo())); 261 connect(addButT,SIGNAL(clicked()),SLOT(defaultInfo()));
258 QWhatsThis::add( addButT, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") ); 262 Q3WhatsThis::add( addButT, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") );
259 //addBut->setPixmap ( SmallIcon("greenhook16")); 263 //addBut->setPixmap ( SmallIcon("greenhook16"));
260 QPushButton *addBut = new QPushButton ( mw ); 264 QPushButton *addBut = new QPushButton ( mw );
261 addBut->setFocusPolicy(NoFocus); 265 addBut->setFocusPolicy(Qt::NoFocus);
262 mainLayout->addWidget( addBut,0,++ii ); 266 mainLayout->addWidget( addBut,0,++ii );
263 addBut->setPixmap ( SmallIcon("eye")); 267 addBut->setPixmap ( SmallIcon("eye"));
264 QWhatsThis::add( addBut, i18n("In this column you can <b>set a calendar to be visible</b>. If a calendar is not visible its entries are not displayed in the views. You can add items to it and it is loaded/saved as usual.") ); 268 Q3WhatsThis::add( addBut, i18n("In this column you can <b>set a calendar to be visible</b>. If a calendar is not visible its entries are not displayed in the views. You can add items to it and it is loaded/saved as usual.") );
265 connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); 269 connect(addBut,SIGNAL(clicked()),SLOT(enableAll()));
266 int max = addBut->sizeHint().height(); 270 int max = addBut->sizeHint().height();
267 addBut->setMaximumWidth( max ); 271 addBut->setMaximumWidth( max );
268 addButT->setFixedSize( QSize( max, max ) ); 272 addButT->setFixedSize( QSize( max, max ) );
269 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); 273 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw );
270 mainLayout->addWidget( lab,0,++ii ); 274 mainLayout->addWidget( lab,0,++ii );
271 QWhatsThis::add( lab, i18n("In this column you can see the <b>name of the calendar</b>. If you click on the name button you will get an information box about the loaded calendar file. If the file was not loaded at startup you can try to load it here again.") ); 275 Q3WhatsThis::add( lab, i18n("In this column you can see the <b>name of the calendar</b>. If you click on the name button you will get an information box about the loaded calendar file. If the file was not loaded at startup you can try to load it here again.") );
272 //lab = new QLabel ( i18n(" "), mw ); 276 //lab = new QLabel ( i18n(" "), mw );
273 //mainLayout->addWidget( lab,0,++ii ); 277 //mainLayout->addWidget( lab,0,++ii );
274 //lab->setFixedWidth( 1 ); 278 //lab->setFixedWidth( 1 );
275 addBut = new QPushButton ( mw ); 279 addBut = new QPushButton ( mw );
276 addBut->setFocusPolicy(NoFocus); 280 addBut->setFocusPolicy(Qt::NoFocus);
277 mainLayout->addWidget( addBut,0,++ii ); 281 mainLayout->addWidget( addBut,0,++ii );
278 addBut->setPixmap ( SmallIcon("bell")); 282 addBut->setPixmap ( SmallIcon("bell"));
279 QWhatsThis::add( addBut, i18n("In this column you can <b>disable the alarms of a calendar all together</b>. The alarm data in the calendar itself is not changed, the alarms are marked internally as \"do not use\". Useful if you load a calendar of another person but do not want to get notified about alarms of that person.") ); 283 Q3WhatsThis::add( addBut, i18n("In this column you can <b>disable the alarms of a calendar all together</b>. The alarm data in the calendar itself is not changed, the alarms are marked internally as \"do not use\". Useful if you load a calendar of another person but do not want to get notified about alarms of that person.") );
280 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); 284 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm()));
281 addBut->setMaximumWidth( addBut->sizeHint().height() ); 285 addBut->setMaximumWidth( addBut->sizeHint().height() );
282 286
283 addBut = new QPushButton ( mw ); 287 addBut = new QPushButton ( mw );
284 addBut->setFocusPolicy(NoFocus); 288 addBut->setFocusPolicy(Qt::NoFocus);
285 mainLayout->addWidget( addBut,0,++ii ); 289 mainLayout->addWidget( addBut,0,++ii );
286 addBut->setPixmap ( SmallIcon("pencil")); 290 addBut->setPixmap ( SmallIcon("pencil"));
287 QWhatsThis::add( addBut, i18n("In this column you can <b>set a calendar and all entries of the calendar to read only</b>. If a calendar is readonly the entries cannot be edited and no items can be added to the calendar. If you change a setting of a calendar to readonly in this column all data will be saved because the data of a readonly calendar is not saved later.") ); 291 Q3WhatsThis::add( addBut, i18n("In this column you can <b>set a calendar and all entries of the calendar to read only</b>. If a calendar is readonly the entries cannot be edited and no items can be added to the calendar. If you change a setting of a calendar to readonly in this column all data will be saved because the data of a readonly calendar is not saved later.") );
288 connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); 292 connect(addBut,SIGNAL(clicked()),SLOT(disableRO()));
289 addBut->setMaximumWidth( addBut->sizeHint().height() ); 293 addBut->setMaximumWidth( addBut->sizeHint().height() );
290 lab = new QLabel ( "", mw ); 294 lab = new QLabel ( "", mw );
291 mainLayout->addWidget( lab,0,++ii ); 295 mainLayout->addWidget( lab,0,++ii );
292 296
293 addBut = new QPushButton ( mw ); 297 addBut = new QPushButton ( mw );
294 addBut->setFocusPolicy(NoFocus); 298 addBut->setFocusPolicy(Qt::NoFocus);
295 mainLayout->addWidget( addBut,0,++ii ); 299 mainLayout->addWidget( addBut,0,++ii );
296 addBut->setPixmap ( SmallIcon("plus")); 300 addBut->setPixmap ( SmallIcon("plus"));
297 connect(addBut,SIGNAL(clicked()),SLOT(addCal())); 301 connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
298 QWhatsThis::add( addBut, i18n("Click this button to <b>add a calendar</b>. You can add an existing calendar file or you can add a new calendar and KO/Pi creates a new empty calendar file for you.") ); 302 Q3WhatsThis::add( addBut, i18n("Click this button to <b>add a calendar</b>. You can add an existing calendar file or you can add a new calendar and KO/Pi creates a new empty calendar file for you.") );
299 lab = new QLabel ( " ", mw ); 303 lab = new QLabel ( " ", mw );
300 mainLayout->addWidget( lab,0,++ii ); 304 mainLayout->addWidget( lab,0,++ii );
301 305
302 306
303 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 307 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
304 int row = 1; 308 int row = 1;
305 bool errorLoadStandard = false; 309 bool errorLoadStandard = false;
306 while ( kkf ) { 310 while ( kkf ) {
307 int iii = 0; 311 int iii = 0;
308 KOCalRadioButton* rb = new KOCalRadioButton( mw ); 312 KOCalRadioButton* rb = new KOCalRadioButton( mw );
309 mainLayout->addWidget( rb,row,0 );mStdandardB.append( rb ); 313 mainLayout->addWidget( rb,row,0 );mStdandardB.append( rb );
310 rb->setChecked( kkf->isStandard ); 314 rb->setChecked( kkf->isStandard );
311 if ( kkf->isStandard && ( kkf->mErrorOnLoad || kkf->isReadOnly ) ) 315 if ( kkf->isStandard && ( kkf->mErrorOnLoad || kkf->isReadOnly ) )
312 errorLoadStandard = true; 316 errorLoadStandard = true;
313 rb->setNum( kkf->mCalNumber ); 317 rb->setNum( kkf->mCalNumber );
314 connect (rb, SIGNAL (selectNum(int)), SLOT ( selectStdCal(int) ) ); 318 connect (rb, SIGNAL (selectNum(int)), SLOT ( selectStdCal(int) ) );
@@ -418,37 +422,37 @@ int KOCalEditView::addCalendar( QString name, QString file, bool ask )
418 isRelative = true; 422 isRelative = true;
419 absFile = QDir::convertSeparators( KGlobalSettings::calendarDir()+file ); 423 absFile = QDir::convertSeparators( KGlobalSettings::calendarDir()+file );
420 fi.setFile( absFile ); 424 fi.setFile( absFile );
421 } else { 425 } else {
422 QString cd = QDir::convertSeparators( KGlobalSettings::calendarDir() ); 426 QString cd = QDir::convertSeparators( KGlobalSettings::calendarDir() );
423 if ( file.left( cd.length() ) == cd ) { 427 if ( file.left( cd.length() ) == cd ) {
424 isRelative = true; 428 isRelative = true;
425 file = fi.fileName (); 429 file = fi.fileName ();
426 fi.setFile( absFile ); 430 fi.setFile( absFile );
427 } 431 }
428 } 432 }
429 if (!fi.exists() ) { 433 if (!fi.exists() ) {
430 if ( ask ) 434 if ( ask )
431 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( KGlobal::formatMessage (absFile,0) ) )== KMessageBox::No ) 435 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( KGlobal::formatMessage (absFile,0) ) )== KMessageBox::No )
432 return 0; 436 return 0;
433 QFile fileIn( absFile ); 437 QFile fileIn( absFile );
434 if (!fileIn.open( IO_WriteOnly ) ) { 438 if (!fileIn.open( QIODevice::WriteOnly ) ) {
435 KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); 439 KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) );
436 return 0; 440 return 0;
437 } 441 }
438 QTextStream tsIn( &fileIn ); 442 Q3TextStream tsIn( &fileIn );
439 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 443 tsIn.setCodec( QTextCodec::codecForName("utf8") );
440 tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; 444 tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n";
441 fileIn.close(); 445 fileIn.close();
442 } 446 }
443 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); 447 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar();
444 kkf->mName = name; 448 kkf->mName = name;
445 kkf->mFileName = absFile; 449 kkf->mFileName = absFile;
446 kkf->mSavedFileName = file; 450 kkf->mSavedFileName = file;
447 kkf->isRelative = isRelative; 451 kkf->isRelative = isRelative;
448 emit calendarAdded( kkf->mCalNumber ); 452 emit calendarAdded( kkf->mCalNumber );
449 if ( ask ) 453 if ( ask )
450 emit needsUpdate(); 454 emit needsUpdate();
451 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 455 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
452 return kkf->mCalNumber; 456 return kkf->mCalNumber;
453} 457}
454int KOCalEditView::getBirtdayID() 458int KOCalEditView::getBirtdayID()
@@ -462,33 +466,33 @@ int KOCalEditView::getBirtdayID()
462 QString file = locateLocal( "data", "korganizer/birthdays.ics" ); 466 QString file = locateLocal( "data", "korganizer/birthdays.ics" );
463 return addCalendar( i18n("Birthdays"), file, false ); 467 return addCalendar( i18n("Birthdays"), file, false );
464} 468}
465 469
466void KOCalEditView::enableAll() 470void KOCalEditView::enableAll()
467{ 471{
468 toggleList( mEnabledB ); 472 toggleList( mEnabledB );
469} 473}
470void KOCalEditView::enableAlarm() 474void KOCalEditView::enableAlarm()
471{ 475{
472 toggleList( mAlarmB ); 476 toggleList( mAlarmB );
473} 477}
474void KOCalEditView::disableRO() 478void KOCalEditView::disableRO()
475{ 479{
476 toggleList( mROB, false ); 480 toggleList( mROB, false );
477} 481}
478void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list , bool enable ) 482void KOCalEditView::toggleList ( Q3PtrList<KOCalCheckButton> list , bool enable )
479{ 483{
480 bool dis = !enable; 484 bool dis = !enable;
481 KOCalCheckButton* it = list.first(); 485 KOCalCheckButton* it = list.first();
482 while ( it ) { 486 while ( it ) {
483 if ( !it->isChecked() == enable && it->isEnabled() ) { 487 if ( !it->isChecked() == enable && it->isEnabled() ) {
484 dis = !dis; 488 dis = !dis;
485 break; 489 break;
486 } 490 }
487 it = list.next(); 491 it = list.next();
488 } 492 }
489 it = list.first(); 493 it = list.first();
490 while ( it ) { 494 while ( it ) {
491 if ( it->isEnabled() ) 495 if ( it->isEnabled() )
492 it->setChecked(dis); 496 it->setChecked(dis);
493 it = list.next(); 497 it = list.next();
494 } 498 }
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h
index 0dd423a..f1bbab4 100644
--- a/korganizer/kofilterview.h
+++ b/korganizer/kofilterview.h
@@ -13,61 +13,67 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOFILTERVIEW_H 23#ifndef KOFILTERVIEW_H
24#define KOFILTERVIEW_H 24#define KOFILTERVIEW_H
25 25
26#include <qstring.h> 26#include <qstring.h>
27#include <qcheckbox.h> 27#include <qcheckbox.h>
28#include <qapplication.h> 28#include <qapplication.h>
29#include <QDesktopWidget>
29#include <qradiobutton.h> 30#include <qradiobutton.h>
30#include <qlayout.h> 31#include <qlayout.h>
31#include <qlabel.h> 32#include <qlabel.h>
32#include <qdialog.h> 33#include <qdialog.h>
33#include <qscrollview.h> 34#include <q3scrollview.h>
34#include <qpushbutton.h> 35#include <qpushbutton.h>
36//Added by qt3to4:
37#include <Q3GridLayout>
38#include <Q3PtrList>
39#include <QKeyEvent>
40#include <Q3VBoxLayout>
35#include <kconfig.h> 41#include <kconfig.h>
36#include "kofilterview_base.h" 42#include "kofilterview_base.h"
37 43
38#include <libkcal/calfilter.h> 44#include <libkcal/calfilter.h>
39 45
40#include <kurlrequester.h> 46#include <kurlrequester.h>
41#include <klineedit.h> 47#include <klineedit.h>
42#include <kglobal.h> 48#include <kglobal.h>
43#include <kmessagebox.h> 49#include <kmessagebox.h>
44 50
45class QGridLayout; 51class Q3GridLayout;
46 52
47using namespace KCal; 53using namespace KCal;
48 54
49class KONewCalPrefs : public QDialog 55class KONewCalPrefs : public QDialog
50{ 56{
51 Q_OBJECT 57 Q_OBJECT
52 public: 58 public:
53 KONewCalPrefs( QWidget *parent=0, const char *name=0 ) : 59 KONewCalPrefs( QWidget *parent=0, const char *name=0 ) :
54 QDialog( parent, name, true ) 60 QDialog( parent, name, true )
55 { 61 {
56 setCaption( i18n("Add new Calendar") ); 62 setCaption( i18n("Add new Calendar") );
57 QVBoxLayout* lay = new QVBoxLayout( this ); 63 Q3VBoxLayout* lay = new Q3VBoxLayout( this );
58 lay->setSpacing( 3 ); 64 lay->setSpacing( 3 );
59 lay->setMargin( 3 ); 65 lay->setMargin( 3 );
60 QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); 66 QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this );
61 lay->addWidget( lab ); 67 lay->addWidget( lab );
62 nameE = new KLineEdit( this ); 68 nameE = new KLineEdit( this );
63 lay->addWidget( nameE ); 69 lay->addWidget( nameE );
64 lab = new QLabel( i18n("<b>iCal (*.ics) file on disk:</b><br>(will be created, if not existing)"), this ); 70 lab = new QLabel( i18n("<b>iCal (*.ics) file on disk:</b><br>(will be created, if not existing)"), this );
65 lay->addWidget( lab ); 71 lay->addWidget( lab );
66 url = new KURLRequester ( this ); 72 url = new KURLRequester ( this );
67 lay->addWidget( url ); 73 lay->addWidget( url );
68 QPushButton * ok = new QPushButton( i18n("OK"), this ); 74 QPushButton * ok = new QPushButton( i18n("OK"), this );
69 lay->addWidget( ok ); 75 lay->addWidget( ok );
70 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 76 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
71 lay->addWidget( cancel ); 77 lay->addWidget( cancel );
72 connect ( ok,SIGNAL(clicked() ),this , SLOT ( checkValid() ) ); 78 connect ( ok,SIGNAL(clicked() ),this , SLOT ( checkValid() ) );
73 connect (cancel, SIGNAL( clicked() ), this, SLOT ( reject()) ); 79 connect (cancel, SIGNAL( clicked() ), this, SLOT ( reject()) );
@@ -97,130 +103,130 @@ void checkValid() {
97 103
98public: 104public:
99 KLineEdit* nameE; 105 KLineEdit* nameE;
100 KURLRequester *url; 106 KURLRequester *url;
101}; 107};
102 108
103class KOCalButton : public QPushButton 109class KOCalButton : public QPushButton
104{ 110{
105 Q_OBJECT 111 Q_OBJECT
106 public: 112 public:
107 KOCalButton( QWidget *parent=0, const char *name=0 ) : 113 KOCalButton( QWidget *parent=0, const char *name=0 ) :
108 QPushButton( parent, name) 114 QPushButton( parent, name)
109 { 115 {
110 connect( this, SIGNAL( clicked() ), 116 connect( this, SIGNAL( clicked() ),
111 SLOT( bottonClicked() )); 117 SLOT( bottonClicked() ));
112 mNumber = -1; 118 mNumber = -1;
113 setFocusPolicy(NoFocus); 119 setFocusPolicy(Qt::NoFocus);
114 } 120 }
115 void setNum ( int num ) {mNumber = num; } 121 void setNum ( int num ) {mNumber = num; }
116 signals: 122 signals:
117 void selectNum ( int ); 123 void selectNum ( int );
118private: 124private:
119 int mNumber; 125 int mNumber;
120 void keyPressEvent ( QKeyEvent * e ) 126 void keyPressEvent ( QKeyEvent * e )
121 { 127 {
122 e->ignore(); 128 e->ignore();
123 } 129 }
124 130
125private slots : 131private slots :
126 void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); } 132 void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); }
127}; 133};
128class KOCalCheckButton : public QCheckBox 134class KOCalCheckButton : public QCheckBox
129{ 135{
130 Q_OBJECT 136 Q_OBJECT
131 public: 137 public:
132 KOCalCheckButton( QWidget *parent=0, const char *name=0 ) : 138 KOCalCheckButton( QWidget *parent=0, const char *name=0 ) :
133 QCheckBox( parent, name) 139 QCheckBox( parent, name)
134 { 140 {
135 connect( this, SIGNAL( toggled ( bool ) ), 141 connect( this, SIGNAL( toggled ( bool ) ),
136 SLOT( bottonClicked( bool ) )); 142 SLOT( bottonClicked( bool ) ));
137 mNumber = -1; 143 mNumber = -1;
138 setFocusPolicy(NoFocus); 144 setFocusPolicy(Qt::NoFocus);
139 //setMaximumWidth( 10 ); 145 //setMaximumWidth( 10 );
140 146
141 } 147 }
142 void setNum ( int num ) {mNumber = num; } 148 void setNum ( int num ) {mNumber = num; }
143 signals: 149 signals:
144 void selectNum ( int, bool ); 150 void selectNum ( int, bool );
145private: 151private:
146 int mNumber; 152 int mNumber;
147 void keyPressEvent ( QKeyEvent * e ) 153 void keyPressEvent ( QKeyEvent * e )
148 { 154 {
149 e->ignore(); 155 e->ignore();
150 } 156 }
151 157
152private slots : 158private slots :
153 void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } 159 void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); }
154}; 160};
155 161
156class KOCalRadioButton : public QRadioButton 162class KOCalRadioButton : public QRadioButton
157{ 163{
158 Q_OBJECT 164 Q_OBJECT
159 public: 165 public:
160 KOCalRadioButton( QWidget *parent=0, const char *name=0 ) : 166 KOCalRadioButton( QWidget *parent=0, const char *name=0 ) :
161 QRadioButton( parent, name) 167 QRadioButton( parent, name)
162 { 168 {
163 connect( this, SIGNAL( toggled ( bool ) ), 169 connect( this, SIGNAL( toggled ( bool ) ),
164 SLOT( bottonClicked( bool ) )); 170 SLOT( bottonClicked( bool ) ));
165 mNumber = -1; 171 mNumber = -1;
166 setFocusPolicy(NoFocus); 172 setFocusPolicy(Qt::NoFocus);
167 //setMaximumWidth( 10 ); 173 //setMaximumWidth( 10 );
168 174
169 } 175 }
170 int num() { return mNumber;} 176 int num() { return mNumber;}
171 void setNum ( int num ) {mNumber = num; } 177 void setNum ( int num ) {mNumber = num; }
172 signals: 178 signals:
173 void selectNum ( int ); 179 void selectNum ( int );
174private: 180private:
175 int mNumber; 181 int mNumber;
176 void keyPressEvent ( QKeyEvent * e ) 182 void keyPressEvent ( QKeyEvent * e )
177 { 183 {
178 e->ignore(); 184 e->ignore();
179 } 185 }
180 186
181private slots : 187private slots :
182 void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber); } 188 void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber); }
183}; 189};
184 190
185 191
186 192
187class KOFilterView : public KOFilterView_base 193class KOFilterView : public KOFilterView_base
188{ 194{
189 Q_OBJECT 195 Q_OBJECT
190 public: 196 public:
191 KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); 197 KOFilterView(Q3PtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, Qt::WFlags fl=0);
192 ~KOFilterView(); 198 ~KOFilterView();
193 199
194 void updateFilters(); 200 void updateFilters();
195 201
196 bool filtersEnabled(); 202 bool filtersEnabled();
197 void setFiltersEnabled(bool); 203 void setFiltersEnabled(bool);
198 CalFilter *selectedFilter(); 204 CalFilter *selectedFilter();
199 void setSelectedFilter(QString); 205 void setSelectedFilter(QString);
200 void setSelectedFilter( int ); 206 void setSelectedFilter( int );
201 207
202 signals: 208 signals:
203 void filterChanged(); 209 void filterChanged();
204 void editFilters(); 210 void editFilters();
205 211
206 private: 212 private:
207 QPtrList<CalFilter> *mFilters; 213 Q3PtrList<CalFilter> *mFilters;
208}; 214};
209 215
210class KOCalEditView : public QScrollView 216class KOCalEditView : public Q3ScrollView
211{ 217{
212 Q_OBJECT 218 Q_OBJECT
213 public: 219 public:
214 KOCalEditView( QWidget* parent=0,const char* name=0); 220 KOCalEditView( QWidget* parent=0,const char* name=0);
215 ~KOCalEditView(); 221 ~KOCalEditView();
216 int addCalendar( QString calName, QString fileName, bool ask = true ); 222 int addCalendar( QString calName, QString fileName, bool ask = true );
217 int getBirtdayID(); 223 int getBirtdayID();
218 public slots: 224 public slots:
219 void addCal(); 225 void addCal();
220 void enableAll(); 226 void enableAll();
221 void enableAlarm(); 227 void enableAlarm();
222 void disableRO(); 228 void disableRO();
223 void deleteAll(); 229 void deleteAll();
224 void selectStdCal(int); 230 void selectStdCal(int);
225 void selectCal(int,bool ); 231 void selectCal(int,bool );
226 void selectCalAlarm(int,bool ); 232 void selectCalAlarm(int,bool );
@@ -231,27 +237,27 @@ class KOCalEditView : public QScrollView
231 void readConfig(); 237 void readConfig();
232 void defaultInfo(); 238 void defaultInfo();
233 void findNewStandard(); 239 void findNewStandard();
234 signals: 240 signals:
235 void alarmEnabled ( int cal, bool enable ); 241 void alarmEnabled ( int cal, bool enable );
236 void calendarEnabled ( int cal, bool enable ); 242 void calendarEnabled ( int cal, bool enable );
237 void calendarReadonly ( int cal, bool readonly ); 243 void calendarReadonly ( int cal, bool readonly );
238 void setCalendarDefault ( int cal ); 244 void setCalendarDefault ( int cal );
239 void removeCalendar ( int cal ); 245 void removeCalendar ( int cal );
240 void calendarAdded( int ); 246 void calendarAdded( int );
241 void needsUpdate(); 247 void needsUpdate();
242 void checkCalendar(); 248 void checkCalendar();
243 void requestCalendarInfo( int id ); 249 void requestCalendarInfo( int id );
244 250
245 private: 251 private:
246 QWidget *mw; 252 QWidget *mw;
247 void toggleList ( QPtrList<KOCalCheckButton> , bool b = true ); 253 void toggleList ( Q3PtrList<KOCalCheckButton> , bool b = true );
248 QPtrList<KOCalRadioButton> mStdandardB; 254 Q3PtrList<KOCalRadioButton> mStdandardB;
249 QPtrList<KOCalCheckButton> mEnabledB; 255 Q3PtrList<KOCalCheckButton> mEnabledB;
250 QPtrList<KOCalCheckButton> mAlarmB; 256 Q3PtrList<KOCalCheckButton> mAlarmB;
251 QPtrList<KOCalCheckButton> mROB; 257 Q3PtrList<KOCalCheckButton> mROB;
252 QGridLayout* mainLayout; 258 Q3GridLayout* mainLayout;
253}; 259};
254 260
255 261
256 262
257#endif // KOFILTERVIEW_H 263#endif // KOFILTERVIEW_H
diff --git a/korganizer/koimportoldialog.cpp b/korganizer/koimportoldialog.cpp
index 79b97e8..63d044c 100644
--- a/korganizer/koimportoldialog.cpp
+++ b/korganizer/koimportoldialog.cpp
@@ -9,46 +9,46 @@
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qframe.h> 25#include <q3frame.h>
26#include <qpixmap.h> 26#include <qpixmap.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qprogressbar.h> 28#include <q3progressbar.h>
29#include <qprogressdialog.h> 29#include <q3progressdialog.h>
30#include <qwidgetstack.h> 30#include <q3widgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qdir.h> 32#include <qdir.h>
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qhbox.h> 34#include <q3hbox.h>
35#include <qregexp.h> 35#include <qregexp.h>
36#include <qheader.h> 36#include <q3header.h>
37#include <qdatetime.h> 37#include <qdatetime.h>
38#include <qlistview.h> 38#include <q3listview.h>
39 39
40#include <kdebug.h> 40#include <kdebug.h>
41#include <klocale.h> 41#include <klocale.h>
42#include <kstandarddirs.h> 42#include <kstandarddirs.h>
43#include <kmessagebox.h> 43#include <kmessagebox.h>
44#include <kfiledialog.h> 44#include <kfiledialog.h>
45 45
46#include <libkdepim/categoryselectdialog.h> 46#include <libkdepim/categoryselectdialog.h>
47#include <libkdepim/kinputdialog.h> 47#include <libkdepim/kinputdialog.h>
48 48
49#include <libkcal/calendarlocal.h> 49#include <libkcal/calendarlocal.h>
50#include <libkcal/icalformat.h> 50#include <libkcal/icalformat.h>
51#include <kabc/stdaddressbook.h> 51#include <kabc/stdaddressbook.h>
52 52
53#include "koprefs.h" 53#include "koprefs.h"
54#include "koglobals.h" 54#include "koglobals.h"
@@ -57,54 +57,54 @@
57 57
58#include "../outport/msoutl9.h" 58#include "../outport/msoutl9.h"
59#include <ole2.h> 59#include <ole2.h>
60#include <comutil.h> 60#include <comutil.h>
61_Application gOlApp; 61_Application gOlApp;
62 62
63QDateTime mDdate2Qdtr( DATE dt) 63QDateTime mDdate2Qdtr( DATE dt)
64{ 64{
65 COleDateTime odt; 65 COleDateTime odt;
66 SYSTEMTIME st; 66 SYSTEMTIME st;
67 odt = dt; 67 odt = dt;
68 odt.GetAsSystemTime(st); 68 odt.GetAsSystemTime(st);
69 QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) ); 69 QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) );
70 return qdt; 70 return qdt;
71} 71}
72 72
73class OLEListViewItem : public QCheckListItem 73class OLEListViewItem : public Q3CheckListItem
74{ 74{
75 public: 75 public:
76 OLEListViewItem( QListView *parent, QString text ) : 76 OLEListViewItem( Q3ListView *parent, QString text ) :
77 QCheckListItem( parent, text, QCheckListItem::CheckBox ) { mData = 0; }; 77 Q3CheckListItem( parent, text, Q3CheckListItem::CheckBox ) { mData = 0; };
78 OLEListViewItem( QListViewItem *after, QString text ) : 78 OLEListViewItem( Q3ListViewItem *after, QString text ) :
79 QCheckListItem( after, text, QCheckListItem::CheckBox ) { mData = 0; }; 79 Q3CheckListItem( after, text, Q3CheckListItem::CheckBox ) { mData = 0; };
80 ~OLEListViewItem() {}; 80 ~OLEListViewItem() {};
81 void setData( DWORD data ) {mData= data; }; 81 void setData( DWORD data ) {mData= data; };
82 DWORD data() { return mData ;}; 82 DWORD data() { return mData ;};
83 private: 83 private:
84 DWORD mData; 84 DWORD mData;
85}; 85};
86 86
87KOImportOLdialog::KOImportOLdialog( const QString &caption, 87KOImportOLdialog::KOImportOLdialog( const QString &caption,
88 Calendar *calendar, QWidget *parent ) : 88 Calendar *calendar, QWidget *parent ) :
89 KDialogBase( Plain, caption, User1 | Close, Ok, 89 KDialogBase( Plain, caption, User1 | Close, Ok,
90 parent, caption, true, false, i18n("Import!") ) 90 parent, caption, true, false, i18n("Import!") )
91{ 91{
92 QHBox * mw = new QHBox( this ); 92 Q3HBox * mw = new Q3HBox( this );
93 setMainWidget( mw ); 93 setMainWidget( mw );
94 mListView = new QListView( mw ); 94 mListView = new Q3ListView( mw );
95 mListView->addColumn(i18n("Select Folder to import")); 95 mListView->addColumn(i18n("Select Folder to import"));
96 mListView->addColumn(i18n("Content Type")); 96 mListView->addColumn(i18n("Content Type"));
97 mCalendar = calendar; 97 mCalendar = calendar;
98 connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply())); 98 connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply()));
99 setupFolderView(); 99 setupFolderView();
100 resize( sizeHint().width()+50, sizeHint().height()+50 ); 100 resize( sizeHint().width()+50, sizeHint().height()+50 );
101} 101}
102 102
103KOImportOLdialog::~KOImportOLdialog() 103KOImportOLdialog::~KOImportOLdialog()
104{ 104{
105 105
106} 106}
107 107
108 108
109void KOImportOLdialog::setupFolderView() 109void KOImportOLdialog::setupFolderView()
110{ 110{
@@ -199,33 +199,33 @@ void KOImportOLdialog::slotApply()
199 } 199 }
200 QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems); 200 QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems);
201 KMessageBox::information(this,mes); 201 KMessageBox::information(this,mes);
202} 202}
203void KOImportOLdialog::readCalendarData( DWORD folder ) 203void KOImportOLdialog::readCalendarData( DWORD folder )
204{ 204{
205 205
206 LPDISPATCH dispItem = (LPDISPATCH)folder; 206 LPDISPATCH dispItem = (LPDISPATCH)folder;
207 dispItem->AddRef(); 207 dispItem->AddRef();
208 MAPIFolder mf(dispItem); 208 MAPIFolder mf(dispItem);
209 mf.m_lpDispatch->AddRef(); 209 mf.m_lpDispatch->AddRef();
210 _Items folderItems; 210 _Items folderItems;
211 _variant_t indx((long)0); 211 _variant_t indx((long)0);
212 LPDISPATCH itm; 212 LPDISPATCH itm;
213 int i; 213 int i;
214 folderItems = mf.GetItems(); 214 folderItems = mf.GetItems();
215 QProgressDialog bar( i18n("Importing calendar data"),i18n("Abort"), folderItems.GetCount(),this ); 215 Q3ProgressDialog bar( i18n("Importing calendar data"),i18n("Abort"), folderItems.GetCount(),this );
216 bar.setCaption (i18n("Importing!") ); 216 bar.setCaption (i18n("Importing!") );
217 int h = bar.sizeHint().height() ; 217 int h = bar.sizeHint().height() ;
218 int w = 300; 218 int w = 300;
219 int dw = QApplication::desktop()->width(); 219 int dw = QApplication::desktop()->width();
220 int dh = QApplication::desktop()->height(); 220 int dh = QApplication::desktop()->height();
221 //bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 221 //bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
222 bar.show(); 222 bar.show();
223 for(i=1; i <= folderItems.GetCount(); ++i) 223 for(i=1; i <= folderItems.GetCount(); ++i)
224 { 224 {
225 qApp->processEvents(); 225 qApp->processEvents();
226 if ( ! bar.isVisible() ) 226 if ( ! bar.isVisible() )
227 return ; 227 return ;
228 bar.setProgress( i ); 228 bar.setProgress( i );
229 bar.raise(); 229 bar.raise();
230 indx = (long)i; 230 indx = (long)i;
231 itm = folderItems.Item(indx.Detach()); 231 itm = folderItems.Item(indx.Detach());
diff --git a/korganizer/koimportoldialog.h b/korganizer/koimportoldialog.h
index c8847c5..d66f099 100644
--- a/korganizer/koimportoldialog.h
+++ b/korganizer/koimportoldialog.h
@@ -18,33 +18,33 @@
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOINCIDENCEEDITOR_H 23#ifndef KOINCIDENCEEDITOR_H
24#define KOINCIDENCEEDITOR_H 24#define KOINCIDENCEEDITOR_H
25 25
26#include <kdialogbase.h> 26#include <kdialogbase.h>
27 27
28#include <afxdisp.h> 28#include <afxdisp.h>
29#include <libkcal/calendar.h> 29#include <libkcal/calendar.h>
30#include <libkcal/event.h> 30#include <libkcal/event.h>
31 31
32 32
33class QDateTime; 33class QDateTime;
34class QListView; 34class Q3ListView;
35class OLEListViewItem; 35class OLEListViewItem;
36class _AppointmentItem; 36class _AppointmentItem;
37namespace KPIM { class CategorySelectDialog; } 37namespace KPIM { class CategorySelectDialog; }
38 38
39using namespace KCal; 39using namespace KCal;
40 40
41/** 41/**
42 This is the base class for the calendar component editors. 42 This is the base class for the calendar component editors.
43*/ 43*/
44class KOImportOLdialog : public KDialogBase 44class KOImportOLdialog : public KDialogBase
45{ 45{
46 Q_OBJECT 46 Q_OBJECT
47 public: 47 public:
48 /** 48 /**
49 Construct new IncidenceEditor. 49 Construct new IncidenceEditor.
50 */ 50 */
@@ -59,26 +59,26 @@ class KOImportOLdialog : public KDialogBase
59 59
60 60
61 signals: 61 signals:
62 62
63 protected slots: 63 protected slots:
64 void slotApply(); 64 void slotApply();
65 void slotOk(); 65 void slotOk();
66 void slotCancel(); 66 void slotCancel();
67 67
68 protected: 68 protected:
69 void setupFolderView(); 69 void setupFolderView();
70 void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent); 70 void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent);
71 void readCalendarData( DWORD folder ); 71 void readCalendarData( DWORD folder );
72 void ol2kopiCalendar( _AppointmentItem * , bool computeRecurrence = true ); 72 void ol2kopiCalendar( _AppointmentItem * , bool computeRecurrence = true );
73 73
74 Calendar *mCalendar; 74 Calendar *mCalendar;
75 QListView * mListView; 75 Q3ListView * mListView;
76 QString getUidByEmail( QString email ); 76 QString getUidByEmail( QString email );
77 77
78 private: 78 private:
79 int importedItems; 79 int importedItems;
80}; 80};
81 81
82#endif 82#endif
83 83
84 84
diff --git a/korganizer/koincidenceeditor.cpp b/korganizer/koincidenceeditor.cpp
index 236f6f9..2060ea1 100644
--- a/korganizer/koincidenceeditor.cpp
+++ b/korganizer/koincidenceeditor.cpp
@@ -9,38 +9,40 @@
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qframe.h> 25#include <q3frame.h>
26#include <qpixmap.h> 26#include <qpixmap.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qwidgetstack.h> 28#include <q3widgetstack.h>
29#include <qdatetime.h> 29#include <qdatetime.h>
30#include <qdir.h> 30#include <qdir.h>
31//Added by qt3to4:
32#include <Q3VBoxLayout>
31 33
32#include <kdebug.h> 34#include <kdebug.h>
33#include <klocale.h> 35#include <klocale.h>
34#include <kstandarddirs.h> 36#include <kstandarddirs.h>
35#include <kmessagebox.h> 37#include <kmessagebox.h>
36#include <kfiledialog.h> 38#include <kfiledialog.h>
37 39
38#include <libkdepim/categoryselectdialog.h> 40#include <libkdepim/categoryselectdialog.h>
39#include <libkdepim/kinputdialog.h> 41#include <libkdepim/kinputdialog.h>
40 42
41#include <libkcal/calendarlocal.h> 43#include <libkcal/calendarlocal.h>
42#include <libkcal/icalformat.h> 44#include <libkcal/icalformat.h>
43 45
44#include "koprefs.h" 46#include "koprefs.h"
45 47
46#include "koincidenceeditor.h" 48#include "koincidenceeditor.h"
@@ -69,35 +71,35 @@ KOIncidenceEditor::KOIncidenceEditor( const QString &caption,
69 // KOGlobals::fitDialogToScreen( mCategoryDialog ); 71 // KOGlobals::fitDialogToScreen( mCategoryDialog );
70 72
71 //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories())); 73 //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories()));
72 74
73 //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) ); 75 //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) );
74 // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) ); 76 // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) );
75 connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) ); 77 connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) );
76} 78}
77 79
78KOIncidenceEditor::~KOIncidenceEditor() 80KOIncidenceEditor::~KOIncidenceEditor()
79{ 81{
80 //delete mCategoryDialog; 82 //delete mCategoryDialog;
81} 83}
82 84
83void KOIncidenceEditor::setupAttendeesTab() 85void KOIncidenceEditor::setupAttendeesTab()
84{ 86{
85 QFrame *topFrame = addPage(i18n("Attendees")); 87 Q3Frame *topFrame = addPage(i18n("Attendees"));
86 88
87 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 89 Q3BoxLayout *topLayout = new Q3VBoxLayout(topFrame);
88 90
89 mDetails = new KOEditorDetails(spacingHint()-2,topFrame); 91 mDetails = new KOEditorDetails(spacingHint()-2,topFrame);
90 topLayout->addWidget(mDetails); 92 topLayout->addWidget(mDetails);
91} 93}
92 94
93void KOIncidenceEditor::alarmWarning() 95void KOIncidenceEditor::alarmWarning()
94{ 96{
95 KMessageBox::information( 0, i18n("The alarm for this calendar\nis currently disabled!\nEnable it in resource settings."), i18n("Alarm disabled warning")); 97 KMessageBox::information( 0, i18n("The alarm for this calendar\nis currently disabled!\nEnable it in resource settings."), i18n("Alarm disabled warning"));
96 98
97} 99}
98 100
99void KOIncidenceEditor::slotApply() 101void KOIncidenceEditor::slotApply()
100{ 102{
101 processInput( false ); 103 processInput( false );
102} 104}
103void KOIncidenceEditor::accept() 105void KOIncidenceEditor::accept()
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index 406df5a..51594ff 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -12,106 +12,112 @@
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24// 24//
25// View of Journal entries 25// View of Journal entries
26 26
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qscrollview.h> 28#include <q3scrollview.h>
29#include <qpopupmenu.h> 29#include <q3popupmenu.h>
30#include <qhbox.h> 30#include <q3hbox.h>
31#include <qpushbutton.h> 31#include <qpushbutton.h>
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qpushbutton.h> 33#include <qpushbutton.h>
34#include <qapplication.h> 34#include <qapplication.h>
35#include <QDesktopWidget>
36//Added by qt3to4:
37#include <QPixmap>
38#include <Q3PtrList>
39#include <QKeyEvent>
40#include <Q3VBoxLayout>
35 41
36#include <klocale.h> 42#include <klocale.h>
37#include <kdebug.h> 43#include <kdebug.h>
38#include "koprefs.h" 44#include "koprefs.h"
39#include <kglobal.h> 45#include <kglobal.h>
40#include <ktextedit.h> 46#include <ktextedit.h>
41 47
42#include <libkcal/calendar.h> 48#include <libkcal/calendar.h>
43 49
44#include "journalentry.h" 50#include "journalentry.h"
45 51
46#include "kojournalview.h" 52#include "kojournalview.h"
47using namespace KOrg; 53using namespace KOrg;
48 54
49KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, 55KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent,
50 const char *name) 56 const char *name)
51 : KOrg::BaseView(calendar, parent, name) 57 : KOrg::BaseView(calendar, parent, name)
52{ 58{
53 mCalendar = calendar; 59 mCalendar = calendar;
54 QHBox * vb = new QHBox ( this ); 60 Q3HBox * vb = new Q3HBox ( this );
55 QPushButton * newJournal = new QPushButton( vb ); 61 QPushButton * newJournal = new QPushButton( vb );
56 QPixmap icon; 62 QPixmap icon;
57 if ( QApplication::desktop()->width() < 321 ) 63 if ( QApplication::desktop()->width() < 321 )
58 icon = SmallIcon("ko16old"); 64 icon = SmallIcon("ko16old");
59 else 65 else
60 icon = SmallIcon("ko24old"); 66 icon = SmallIcon("ko24old");
61 newJournal->setPixmap (icon ) ; 67 newJournal->setPixmap (icon ) ;
62 int size = newJournal->sizeHint().height(); 68 int size = newJournal->sizeHint().height();
63 newJournal->setFixedSize( size, size ); 69 newJournal->setFixedSize( size, size );
64 mDateLabel = new QLabel ( vb ); 70 mDateLabel = new QLabel ( vb );
65 mDateLabel->setMargin(1); 71 mDateLabel->setMargin(1);
66 mDateLabel->setAlignment(AlignCenter); 72 mDateLabel->setAlignment(Qt::AlignCenter);
67 QScrollView * sv = new QScrollView( this ); 73 Q3ScrollView * sv = new Q3ScrollView( this );
68 QVBoxLayout * hbl = new QVBoxLayout( this ); 74 Q3VBoxLayout * hbl = new Q3VBoxLayout( this );
69 hbl->addWidget( vb ); 75 hbl->addWidget( vb );
70 hbl->addWidget( sv ); 76 hbl->addWidget( sv );
71 parWid = new QWidget( sv->viewport() ); 77 parWid = new QWidget( sv->viewport() );
72 sv->addChild(parWid); 78 sv->addChild(parWid);
73 sv->setResizePolicy( QScrollView:: AutoOneFit ); 79 sv->setResizePolicy( Q3ScrollView:: AutoOneFit );
74 mTopLayout = new QVBoxLayout(parWid); 80 mTopLayout = new Q3VBoxLayout(parWid);
75 connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) ); 81 connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) );
76 getNewEntry(); 82 getNewEntry();
77} 83}
78 84
79KOJournalView::~KOJournalView() 85KOJournalView::~KOJournalView()
80{ 86{
81} 87}
82 88
83int KOJournalView::currentDateCount() 89int KOJournalView::currentDateCount()
84{ 90{
85 return 0; 91 return 0;
86} 92}
87JournalEntry* KOJournalView::getNewEntry() 93JournalEntry* KOJournalView::getNewEntry()
88{ 94{
89 JournalEntry* Entry = new JournalEntry(mCalendar,parWid); 95 JournalEntry* Entry = new JournalEntry(mCalendar,parWid);
90 jEntries.append( Entry ); 96 jEntries.append( Entry );
91 mTopLayout->addWidget(Entry); 97 mTopLayout->addWidget(Entry);
92 Entry->setFont ( KOPrefs::instance()->mJornalViewFont ); 98 Entry->setFont ( KOPrefs::instance()->mJornalViewFont );
93 connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; 99 connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ;
94 connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ; 100 connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ;
95 connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ; 101 connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ;
96 return Entry; 102 return Entry;
97} 103}
98 104
99QPtrList<Incidence> KOJournalView::selectedIncidences() 105Q3PtrList<Incidence> KOJournalView::selectedIncidences()
100{ 106{
101 QPtrList<Incidence> eventList; 107 Q3PtrList<Incidence> eventList;
102 108
103 return eventList; 109 return eventList;
104} 110}
105void KOJournalView::updateConfig() 111void KOJournalView::updateConfig()
106{ 112{
107 JournalEntry* mEntry = jEntries.first(); 113 JournalEntry* mEntry = jEntries.first();
108 while ( mEntry ) { 114 while ( mEntry ) {
109 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 115 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
110 mEntry = jEntries.next(); 116 mEntry = jEntries.next();
111 } 117 }
112} 118}
113void KOJournalView::updateView() 119void KOJournalView::updateView()
114{ 120{
115 JournalEntry* mEntry = jEntries.first(); 121 JournalEntry* mEntry = jEntries.first();
116 while ( mEntry ) { 122 while ( mEntry ) {
117 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 123 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
@@ -149,39 +155,39 @@ void KOJournalView::newJournal()
149 //qDebug(" KOJournalView::newJournal()"); 155 //qDebug(" KOJournalView::newJournal()");
150 flushView(); 156 flushView();
151 Journal* mJournal = new Journal; 157 Journal* mJournal = new Journal;
152 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); 158 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
153 mCalendar->addJournal(mJournal); 159 mCalendar->addJournal(mJournal);
154 showDates( mDate, QDate() ); 160 showDates( mDate, QDate() );
155} 161}
156 162
157void KOJournalView::showOnly ( Journal* j ) 163void KOJournalView::showOnly ( Journal* j )
158{ 164{
159 //qDebug("showOnly %x ", j); 165 //qDebug("showOnly %x ", j);
160 flushView(); 166 flushView();
161 if ( j == 0 ) { 167 if ( j == 0 ) {
162 showDates( mDate, QDate() ); 168 showDates( mDate, QDate() );
163 return; 169 return;
164 } 170 }
165 QPtrList<Journal> jl; 171 Q3PtrList<Journal> jl;
166 jl.append ( j ); 172 jl.append ( j );
167 showList( jl ); 173 showList( jl );
168 JournalEntry* mEntry = jEntries.first(); 174 JournalEntry* mEntry = jEntries.first();
169 mEntry->setShowOnly(); 175 mEntry->setShowOnly();
170} 176}
171void KOJournalView::showList(QPtrList<Journal> jl) 177void KOJournalView::showList(Q3PtrList<Journal> jl)
172{ 178{
173 static bool ff = false; 179 static bool ff = false;
174 if ( ff ) return; 180 if ( ff ) return;
175 ff = true; 181 ff = true;
176 //qDebug("KOJournalView::showList %d",jl.count() ); 182 //qDebug("KOJournalView::showList %d",jl.count() );
177 JournalEntry* mEntry = jEntries.first(); 183 JournalEntry* mEntry = jEntries.first();
178 JournalEntry* firstEntry = mEntry; 184 JournalEntry* firstEntry = mEntry;
179 int count = jl.count(); 185 int count = jl.count();
180 int iii = 0; 186 int iii = 0;
181 QWidget* fw = qApp->focusWidget (); 187 QWidget* fw = qApp->focusWidget ();
182 while ( iii < count ) { 188 while ( iii < count ) {
183 if ( !mEntry ) { 189 if ( !mEntry ) {
184 mEntry = getNewEntry(); 190 mEntry = getNewEntry();
185 mEntry->setVisibleMode( true ); 191 mEntry->setVisibleMode( true );
186 mEntry->setDate(mDate); 192 mEntry->setDate(mDate);
187 mEntry->setJournal(jl.at(iii), false); 193 mEntry->setJournal(jl.at(iii), false);
@@ -212,37 +218,37 @@ void KOJournalView::showList(QPtrList<Journal> jl)
212 mEntry->hide(); 218 mEntry->hide();
213 mEntry->setVisibleMode( false ); 219 mEntry->setVisibleMode( false );
214 } 220 }
215 else { 221 else {
216 mEntry->setVisibleMode( true ); 222 mEntry->setVisibleMode( true );
217 mEntry->show(); 223 mEntry->show();
218 } 224 }
219 mEntry = jEntries.next(); 225 mEntry = jEntries.next();
220 } 226 }
221 ff = false; 227 ff = false;
222} 228}
223 229
224void KOJournalView::showDates(const QDate &start, const QDate &) 230void KOJournalView::showDates(const QDate &start, const QDate &)
225{ 231{
226 mDate = start; 232 mDate = start;
227 mDateLabel->setText(KGlobal::locale()->formatDate(mDate)); 233 mDateLabel->setText(KGlobal::locale()->formatDate(mDate));
228 QPtrList<Journal> jl = calendar()->journals4Date( start ); 234 Q3PtrList<Journal> jl = calendar()->journals4Date( start );
229 showList( jl ); 235 showList( jl );
230} 236}
231 237
232void KOJournalView::showEvents(QPtrList<Event>) 238void KOJournalView::showEvents(Q3PtrList<Event>)
233{ 239{
234 // After new creation of list view no events are selected. 240 // After new creation of list view no events are selected.
235// emit incidenceSelected( 0 ); 241// emit incidenceSelected( 0 );
236} 242}
237 243
238void KOJournalView::changeEventDisplay(Event *, int /*action*/) 244void KOJournalView::changeEventDisplay(Event *, int /*action*/)
239{ 245{
240 updateView(); 246 updateView();
241} 247}
242 248
243void KOJournalView::keyPressEvent ( QKeyEvent * e ) 249void KOJournalView::keyPressEvent ( QKeyEvent * e )
244{ 250{
245 //qDebug("keyPressEven "); 251 //qDebug("keyPressEven ");
246 if ( e->state() == Qt::ControlButton ) { 252 if ( e->state() == Qt::ControlButton ) {
247 if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left ) 253 if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left )
248 e->ignore(); 254 e->ignore();
diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h
index 7fa94ae..22f26cd 100644
--- a/korganizer/kojournalview.h
+++ b/korganizer/kojournalview.h
@@ -12,69 +12,74 @@
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef _KOJOURNALVIEW_H 23#ifndef _KOJOURNALVIEW_H
24#define _KOJOURNALVIEW_H 24#define _KOJOURNALVIEW_H
25 25
26#include <korganizer/baseview.h> 26#include <korganizer/baseview.h>
27#include <qlayout.h> 27#include <qlayout.h>
28//Added by qt3to4:
29#include <QKeyEvent>
30#include <Q3PtrList>
31#include <QLabel>
32#include <Q3BoxLayout>
28 33
29class JournalEntry; 34class JournalEntry;
30class QLabel; 35class QLabel;
31 36
32/** 37/**
33 * This class provides a journal view. 38 * This class provides a journal view.
34 39
35 * @short View for Journal components. 40 * @short View for Journal components.
36 * @author Cornelius Schumacher <schumacher@kde.org> 41 * @author Cornelius Schumacher <schumacher@kde.org>
37 * @see KOBaseView 42 * @see KOBaseView
38 */ 43 */
39class KOJournalView : public KOrg::BaseView 44class KOJournalView : public KOrg::BaseView
40{ 45{
41 Q_OBJECT 46 Q_OBJECT
42 public: 47 public:
43 KOJournalView(Calendar *calendar, QWidget *parent = 0, 48 KOJournalView(Calendar *calendar, QWidget *parent = 0,
44 const char *name = 0); 49 const char *name = 0);
45 ~KOJournalView(); 50 ~KOJournalView();
46 51
47 virtual int currentDateCount(); 52 virtual int currentDateCount();
48 void clearList(); 53 void clearList();
49 virtual QPtrList<Incidence> selectedIncidences(); 54 virtual Q3PtrList<Incidence> selectedIncidences();
50 DateList selectedDates() 55 DateList selectedDates()
51 {DateList q; 56 {DateList q;
52 return q;}; 57 return q;};
53 void checkModified(); 58 void checkModified();
54 signals: 59 signals:
55 void deleteJournal(Journal *); 60 void deleteJournal(Journal *);
56 public slots: 61 public slots:
57 void showOnly ( Journal* ); 62 void showOnly ( Journal* );
58 void newJournal(); 63 void newJournal();
59 void updateView(); 64 void updateView();
60 void flushView(); 65 void flushView();
61 void updateConfig(); 66 void updateConfig();
62 void showDates( const QDate &start, const QDate &end ); 67 void showDates( const QDate &start, const QDate &end );
63 void showEvents(QPtrList<Event> eventList); 68 void showEvents(Q3PtrList<Event> eventList);
64 69
65 void changeEventDisplay(Event *, int); 70 void changeEventDisplay(Event *, int);
66 71
67 private: 72 private:
68 void showList(QPtrList<Journal> jl); 73 void showList(Q3PtrList<Journal> jl);
69 Calendar *mCalendar; 74 Calendar *mCalendar;
70 JournalEntry* getNewEntry(); 75 JournalEntry* getNewEntry();
71 QPtrList<JournalEntry> jEntries; 76 Q3PtrList<JournalEntry> jEntries;
72 void keyPressEvent ( QKeyEvent * ) ; 77 void keyPressEvent ( QKeyEvent * ) ;
73 QBoxLayout *mTopLayout; 78 Q3BoxLayout *mTopLayout;
74 QWidget *parWid; 79 QWidget *parWid;
75 QLabel * mDateLabel; 80 QLabel * mDateLabel;
76 QDate mDate; 81 QDate mDate;
77 82
78}; 83};
79 84
80#endif 85#endif
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 192f8c0..0ea1d50 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -9,46 +9,55 @@
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qlistview.h> 25#include <q3listview.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qpopupmenu.h> 28#include <q3popupmenu.h>
29#include <qprogressbar.h> 29#include <q3progressbar.h>
30#include <qfileinfo.h> 30#include <qfileinfo.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qdialog.h> 32#include <qdialog.h>
33#include <qtextstream.h> 33#include <q3textstream.h>
34#include <qdir.h> 34#include <qdir.h>
35#include <qwhatsthis.h> 35#include <q3whatsthis.h>
36#include <qregexp.h> 36#include <qregexp.h>
37#include <qpainter.h> 37#include <qpainter.h>
38#include <qpaintdevicemetrics.h> 38#include <q3paintdevicemetrics.h>
39//Added by qt3to4:
40#include <QPixmap>
41#include <QMouseEvent>
42#include <QKeyEvent>
43#include <QEvent>
44#include <Q3VBoxLayout>
45#include <Q3PtrList>
46
47#include<QDesktopWidget>
39 48
40#include <klocale.h> 49#include <klocale.h>
41#include <kdebug.h> 50#include <kdebug.h>
42#include <kiconloader.h> 51#include <kiconloader.h>
43#include <kglobal.h> 52#include <kglobal.h>
44 53
45#include <libkdepim/kpimglobalprefs.h> 54#include <libkdepim/kpimglobalprefs.h>
46#include <libkcal/calendar.h> 55#include <libkcal/calendar.h>
47#include <libkcal/calendarlocal.h> 56#include <libkcal/calendarlocal.h>
48#include <libkcal/icalformat.h> 57#include <libkcal/icalformat.h>
49#include <libkcal/vcalformat.h> 58#include <libkcal/vcalformat.h>
50#include <libkcal/recurrence.h> 59#include <libkcal/recurrence.h>
51#include <libkcal/filestorage.h> 60#include <libkcal/filestorage.h>
52#include <libkdepim/categoryselectdialog.h> 61#include <libkdepim/categoryselectdialog.h>
53#include <libkcal/kincidenceformatter.h> 62#include <libkcal/kincidenceformatter.h>
54#ifndef DESKTOP_VERSION 63#ifndef DESKTOP_VERSION
@@ -57,36 +66,36 @@
57#include <qapplication.h> 66#include <qapplication.h>
58#endif 67#endif
59 68
60#ifndef KORG_NOPRINTER 69#ifndef KORG_NOPRINTER
61#include "calprinter.h" 70#include "calprinter.h"
62#endif 71#endif
63#include "koglobals.h" 72#include "koglobals.h"
64#include "koprefs.h" 73#include "koprefs.h"
65#include "kfiledialog.h" 74#include "kfiledialog.h"
66 75
67#include "kolistview.h" 76#include "kolistview.h"
68#include "koeventviewer.h" 77#include "koeventviewer.h"
69 78
70extern QPixmap* sgListViewCompletedPix[6]; 79extern QPixmap* sgListViewCompletedPix[6];
71extern QPixmap* sgListViewJournalPix; 80extern QPixmap* sgListViewJournalPix;
72 81
73class KOListViewWhatsThis :public QWhatsThis 82class KOListViewWhatsThis :public Q3WhatsThis
74{ 83{
75public: 84public:
76 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 85 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : Q3WhatsThis( wid ), _wid(wid),_view (view) { };
77 86
78protected: 87protected:
79 virtual QString text( const QPoint& p) 88 virtual QString text( const QPoint& p)
80 { 89 {
81 return _view->getWhatsThisText(p) ; 90 return _view->getWhatsThisText(p) ;
82 } 91 }
83private: 92private:
84 QWidget* _wid; 93 QWidget* _wid;
85 KOListView * _view; 94 KOListView * _view;
86}; 95};
87 96
88 97
89ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 98ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
90{ 99{
91 mItem = item; 100 mItem = item;
92 mDate = date; 101 mDate = date;
@@ -261,140 +270,140 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
261 mActiveItem = 0; 270 mActiveItem = 0;
262 mForceShowCompletedTodos = false; 271 mForceShowCompletedTodos = false;
263 mListView = new KOListViewListView(this); 272 mListView = new KOListViewListView(this);
264 mListView->addColumn(i18n("Summary")); 273 mListView->addColumn(i18n("Summary"));
265 mListView->addColumn(i18n("Start Date")); 274 mListView->addColumn(i18n("Start Date"));
266 mListView->addColumn(i18n("Start Time")); 275 mListView->addColumn(i18n("Start Time"));
267 mListView->addColumn(i18n("End/Due Date")); 276 mListView->addColumn(i18n("End/Due Date"));
268 mListView->addColumn(i18n("End/Due Time")); 277 mListView->addColumn(i18n("End/Due Time"));
269 mListView->addColumn(i18n("Duration")); 278 mListView->addColumn(i18n("Duration"));
270 mListView->addColumn(i18n("Alarm")); // alarm set? 279 mListView->addColumn(i18n("Alarm")); // alarm set?
271 mListView->addColumn(i18n("Recurs")); // recurs? 280 mListView->addColumn(i18n("Recurs")); // recurs?
272 mListView->addColumn(i18n("Cancelled")); 281 mListView->addColumn(i18n("Cancelled"));
273 mListView->addColumn(i18n("Categories")); 282 mListView->addColumn(i18n("Categories"));
274 mListView->addColumn(i18n("Calendar")); 283 mListView->addColumn(i18n("Calendar"));
275 mListView->addColumn(i18n("Last Modified")); 284 mListView->addColumn(i18n("Last Modified"));
276 285
277 mListView->setColumnAlignment(0,AlignLeft); 286 mListView->setColumnAlignment(0,Qt::AlignLeft);
278 mListView->setColumnAlignment(1,AlignLeft); 287 mListView->setColumnAlignment(1,Qt::AlignLeft);
279 mListView->setColumnAlignment(2,AlignHCenter); 288 mListView->setColumnAlignment(2,Qt::AlignHCenter);
280 mListView->setColumnAlignment(3,AlignLeft); 289 mListView->setColumnAlignment(3,Qt::AlignLeft);
281 mListView->setColumnAlignment(4,AlignHCenter); 290 mListView->setColumnAlignment(4,Qt::AlignHCenter);
282 mListView->setColumnAlignment(5,AlignLeft); 291 mListView->setColumnAlignment(5,Qt::AlignLeft);
283 mListView->setColumnAlignment(6,AlignLeft); 292 mListView->setColumnAlignment(6,Qt::AlignLeft);
284 mListView->setColumnAlignment(7,AlignLeft); 293 mListView->setColumnAlignment(7,Qt::AlignLeft);
285 mListView->setColumnAlignment(8,AlignLeft); 294 mListView->setColumnAlignment(8,Qt::AlignLeft);
286 mListView->setColumnAlignment(9,AlignLeft); 295 mListView->setColumnAlignment(9,Qt::AlignLeft);
287 mListView->setColumnAlignment(10,AlignLeft); 296 mListView->setColumnAlignment(10,Qt::AlignLeft);
288 mListView->setColumnAlignment(11,AlignLeft); 297 mListView->setColumnAlignment(11,Qt::AlignLeft);
289 mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); 298 mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this);
290 299
291 int iii = 0; 300 int iii = 0;
292 for ( iii = 0; iii< 12 ; ++iii ) 301 for ( iii = 0; iii< 12 ; ++iii )
293 mListView->setColumnWidthMode( iii, QListView::Manual ); 302 mListView->setColumnWidthMode( iii, Q3ListView::Manual );
294 303
295 QBoxLayout *layoutTop = new QVBoxLayout(this); 304 Q3BoxLayout *layoutTop = new Q3VBoxLayout(this);
296 layoutTop->addWidget(mListView); 305 layoutTop->addWidget(mListView);
297 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 306 mListView->setFont ( KOPrefs::instance()->mListViewFont );
298 mPopupMenu = eventPopup(); 307 mPopupMenu = eventPopup();
299 QPopupMenu* selPopup = new QPopupMenu ( this ); 308 Q3PopupMenu* selPopup = new Q3PopupMenu ( this );
300 mPopupMenu->insertSeparator(); 309 mPopupMenu->insertSeparator();
301 310
302 selPopup->insertItem(i18n("All"),this, 311 selPopup->insertItem(i18n("All"),this,
303 SLOT(allSelection())); 312 SLOT(allSelection()));
304 selPopup->insertItem(i18n("None"),this, 313 selPopup->insertItem(i18n("None"),this,
305 SLOT(clearSelection())); 314 SLOT(clearSelection()));
306 selPopup->insertItem(i18n("Delete selected..."),this, 315 selPopup->insertItem(i18n("Delete selected..."),this,
307 SLOT(deleteAll())); 316 SLOT(deleteAll()));
308 mPopupMenu->insertItem(i18n("Selection"), selPopup ); 317 mPopupMenu->insertItem(i18n("Selection"), selPopup );
309 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 318 mPopupMenu->addAdditionalItem(QIcon(QPixmap()),
310 i18n("Hide all selected"),this, 319 i18n("Hide all selected"),this,
311 SLOT(hideAll()),true); 320 SLOT(hideAll()),true);
312 321
313 selPopup->insertSeparator(); 322 selPopup->insertSeparator();
314 QPopupMenu * exportPO = new QPopupMenu ( this ); 323 Q3PopupMenu * exportPO = new Q3PopupMenu ( this );
315 selPopup->insertItem( i18n("Export"), exportPO ); 324 selPopup->insertItem( i18n("Export"), exportPO );
316#ifdef DESKTOP_VERSION 325#ifdef DESKTOP_VERSION
317 mPopupMenu->insertSeparator(); 326 mPopupMenu->insertSeparator();
318 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 327 mPopupMenu->addAdditionalItem(QIcon(QPixmap()),
319 i18n("Print complete list..."),this, 328 i18n("Print complete list..."),this,
320 SLOT(printList()),true); 329 SLOT(printList()),true);
321#endif 330#endif
322 mCalPopup = new QPopupMenu ( this ); 331 mCalPopup = new Q3PopupMenu ( this );
323 selPopup->insertItem( i18n("Set Calendar"), mCalPopup ); 332 selPopup->insertItem( i18n("Set Calendar"), mCalPopup );
324 333
325 selPopup->insertItem(i18n("Set categories")+"...",this, 334 selPopup->insertItem(i18n("Set categories")+"...",this,
326 SLOT(setCat()) ); 335 SLOT(setCat()) );
327 selPopup->insertItem( i18n("Set alarm..."),this, 336 selPopup->insertItem( i18n("Set alarm..."),this,
328 SLOT(setAlarm())); 337 SLOT(setAlarm()));
329#if 0 338#if 0
330 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 339 mPopupMenu->addAdditionalItem(QIcon(QPixmap()),
331 i18n("Set categories")+"...",this, 340 i18n("Set categories")+"...",this,
332 SLOT(setCat()),true); 341 SLOT(setCat()),true);
333 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 342 mPopupMenu->addAdditionalItem(QIcon(QPixmap()),
334 i18n("Set alarm..."),this, 343 i18n("Set alarm..."),this,
335 SLOT(setAlarm()),true); 344 SLOT(setAlarm()),true);
336#endif 345#endif
337 QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, 346 QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this,
338 SLOT( populateCalPopup() )); 347 SLOT( populateCalPopup() ));
339 QObject::connect(mCalPopup,SIGNAL(activated( int )),this, 348 QObject::connect(mCalPopup,SIGNAL(activated( int )),this,
340 SLOT( setCalendar( int ) )); 349 SLOT( setCalendar( int ) ));
341 QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, 350 QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this,
342 SLOT( catChanged( Incidence * ) )); 351 SLOT( catChanged( Incidence * ) ));
343 exportPO->insertItem( i18n("As iCal (ics) file..."),this, 352 exportPO->insertItem( i18n("As iCal (ics) file..."),this,
344 SLOT(saveToFile())); 353 SLOT(saveToFile()));
345 exportPO->insertItem( i18n("As vCal (vcs) file..."),this, 354 exportPO->insertItem( i18n("As vCal (vcs) file..."),this,
346 SLOT(saveToFileVCS())); 355 SLOT(saveToFileVCS()));
347 exportPO->insertItem( i18n("Journal/Details..."),this, 356 exportPO->insertItem( i18n("Journal/Details..."),this,
348 SLOT(saveDescriptionToFile())); 357 SLOT(saveDescriptionToFile()));
349 // mPopupMenu->insertSeparator(); 358 // mPopupMenu->insertSeparator();
350 // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 359 // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
351 // i18n("Add Categ. to selected..."),this, 360 // i18n("Add Categ. to selected..."),this,
352 // SLOT(addCat()),true); 361 // SLOT(addCat()),true);
353 //mPopupMenu->insertSeparator(); 362 //mPopupMenu->insertSeparator();
354#ifndef DESKTOP_VERSION 363#ifndef DESKTOP_VERSION
355 selPopup->insertSeparator(); 364 selPopup->insertSeparator();
356 selPopup->insertItem( i18n("Beam via IR..."),this, 365 selPopup->insertItem( i18n("Beam via IR..."),this,
357 SLOT(beamSelected())); 366 SLOT(beamSelected()));
358#if 0 367#if 0
359 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 368 mPopupMenu->addAdditionalItem(QIcon(QPixmap()),
360 i18n("Beam via IR"),this, 369 i18n("Beam via IR"),this,
361 SLOT(beamSelected()),true); 370 SLOT(beamSelected()),true);
362#endif 371#endif
363#endif 372#endif
364 /* 373 /*
365 mPopupMenu = new QPopupMenu; 374 mPopupMenu = new QPopupMenu;
366 mPopupMenu->insertItem(i18n("Edit Event"), this, 375 mPopupMenu->insertItem(i18n("Edit Event"), this,
367 SLOT (editEvent())); 376 SLOT (editEvent()));
368 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 377 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
369 SLOT (deleteEvent())); 378 SLOT (deleteEvent()));
370 mPopupMenu->insertSeparator(); 379 mPopupMenu->insertSeparator();
371 mPopupMenu->insertItem(i18n("Show Dates"), this, 380 mPopupMenu->insertItem(i18n("Show Dates"), this,
372 SLOT(showDates())); 381 SLOT(showDates()));
373 mPopupMenu->insertItem(i18n("Hide Dates"), this, 382 mPopupMenu->insertItem(i18n("Hide Dates"), this,
374 SLOT(hideDates())); 383 SLOT(hideDates()));
375 */ 384 */
376 QObject::connect(mListView,SIGNAL( newEvent()), 385 QObject::connect(mListView,SIGNAL( newEvent()),
377 this,SIGNAL(signalNewEvent())); 386 this,SIGNAL(signalNewEvent()));
378 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 387 QObject::connect(mListView,SIGNAL(doubleClicked(Q3ListViewItem *)),
379 this,SLOT(defaultItemAction(QListViewItem *))); 388 this,SLOT(defaultItemAction(Q3ListViewItem *)));
380 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, 389 QObject::connect(mListView,SIGNAL(rightButtonPressed( Q3ListViewItem *,
381 const QPoint &, int )), 390 const QPoint &, int )),
382 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 391 this,SLOT(popupMenu(Q3ListViewItem *,const QPoint &,int)));
383 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 392 QObject::connect(mListView,SIGNAL(currentChanged(Q3ListViewItem *)),
384 SLOT(processSelectionChange(QListViewItem *))); 393 SLOT(processSelectionChange(Q3ListViewItem *)));
385 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 394 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
386 SIGNAL(showIncidenceSignal(Incidence *)) ); 395 SIGNAL(showIncidenceSignal(Incidence *)) );
387 396
388 readSettings(KOGlobals::config(),"KOListView Layout"); 397 readSettings(KOGlobals::config(),"KOListView Layout");
389} 398}
390 399
391KOListView::~KOListView() 400KOListView::~KOListView()
392{ 401{
393 delete mPopupMenu; 402 delete mPopupMenu;
394#if QT_VERSION >= 0x030000 403#if QT_VERSION >= 0x030000
395 404
396#else 405#else
397 delete mKOListViewWhatsThis; 406 delete mKOListViewWhatsThis;
398#endif 407#endif
399} 408}
400 409
@@ -415,47 +424,47 @@ QString KOListView::getWhatsThisText(QPoint p)
415 KOPrefs::instance()->mWTshowCreated, 424 KOPrefs::instance()->mWTshowCreated,
416 KOPrefs::instance()->mWTshowChanged); 425 KOPrefs::instance()->mWTshowChanged);
417 return i18n("That is the list view" ); 426 return i18n("That is the list view" );
418 427
419} 428}
420 429
421void KOListView::setCalendar( int c ) 430void KOListView::setCalendar( int c )
422{ 431{
423 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), 432 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
424 i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), 433 i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ),
425 i18n("Continue"), i18n("Cancel"), 0, 434 i18n("Continue"), i18n("Cancel"), 0,
426 0, 1 ); 435 0, 1 );
427 if ( result != 0 ) { 436 if ( result != 0 ) {
428 return; 437 return;
429 } 438 }
430 439
431 QPtrList<Incidence> delSel = getSelectedIncidences() ; 440 Q3PtrList<Incidence> delSel = getSelectedIncidences() ;
432 int icount = delSel.count(); 441 int icount = delSel.count();
433 if ( icount ) { 442 if ( icount ) {
434 Incidence *incidence = delSel.first(); 443 Incidence *incidence = delSel.first();
435 while ( incidence ) { 444 while ( incidence ) {
436 incidence->setCalID( c ); 445 incidence->setCalID( c );
437 KOListViewItem * item = getItemForEvent( incidence ); 446 KOListViewItem * item = getItemForEvent( incidence );
438 if ( item ) { 447 if ( item ) {
439 ListItemVisitor v(item, mStartDate ); 448 ListItemVisitor v(item, mStartDate );
440 incidence->accept(v); 449 incidence->accept(v);
441 } 450 }
442 incidence = delSel.next(); 451 incidence = delSel.next();
443 } 452 }
444 } 453 }
445 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 454 Q3PtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
446 KopiCalendarFile * cal = calendars.first(); 455 KopiCalendarFile * cal = calendars.first();
447 while ( cal ) { 456 while ( cal ) {
448 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); 457 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled );
449 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); 458 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled );
450 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); 459 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly );
451 if ( cal->isStandard ) 460 if ( cal->isStandard )
452 mCalendar->setDefaultCalendar( cal->mCalNumber ); 461 mCalendar->setDefaultCalendar( cal->mCalNumber );
453 cal = calendars.next(); 462 cal = calendars.next();
454 } 463 }
455 mCalendar->setSyncEventsReadOnly(); 464 mCalendar->setSyncEventsReadOnly();
456 mCalendar->reInitAlarmSettings(); 465 mCalendar->reInitAlarmSettings();
457 466
458} 467}
459void KOListView::populateCalPopup() 468void KOListView::populateCalPopup()
460{ 469{
461 mCalPopup->clear(); 470 mCalPopup->clear();
@@ -484,123 +493,123 @@ void KOListView::setCat()
484 bool set = true; 493 bool set = true;
485 int result = KMessageBox::warningYesNoCancel(this, 494 int result = KMessageBox::warningYesNoCancel(this,
486 i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), 495 i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"),
487 i18n("Set categories"), 496 i18n("Set categories"),
488 i18n("Add"), 497 i18n("Add"),
489 i18n("Reset")); 498 i18n("Reset"));
490 if (result == KMessageBox::Cancel) return; 499 if (result == KMessageBox::Cancel) return;
491 if (result == KMessageBox::Yes) set = false; 500 if (result == KMessageBox::Yes) set = false;
492 setCategories( set ); 501 setCategories( set );
493} 502}
494 503
495void KOListView::setAlarm() 504void KOListView::setAlarm()
496{ 505{
497 KOAlarmPrefs kap( this); 506 KOAlarmPrefs kap( this);
498 if ( !kap.exec() ) 507 if ( !kap.exec() )
499 return; 508 return;
500 QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos 509 Q3PtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos
501 Incidence* inc = delSel.first(); 510 Incidence* inc = delSel.first();
502 int count = 0; 511 int count = 0;
503 while ( inc ) { 512 while ( inc ) {
504 ++count; 513 ++count;
505 if (kap.mAlarmButton->isChecked()) { 514 if (kap.mAlarmButton->isChecked()) {
506 if (inc->alarms().count() == 0) 515 if (inc->alarms().count() == 0)
507 inc->newAlarm(); 516 inc->newAlarm();
508 Alarm *alarm = inc->alarms().first(); 517 Alarm *alarm = inc->alarms().first();
509 alarm->setEnabled(true); 518 alarm->setEnabled(true);
510 int j = kap.mAlarmTimeEdit->value()* -60; 519 int j = kap.mAlarmTimeEdit->value()* -60;
511 if (kap.mAlarmIncrCombo->currentItem() == 1) 520 if (kap.mAlarmIncrCombo->currentItem() == 1)
512 j = j * 60; 521 j = j * 60;
513 else if (kap.mAlarmIncrCombo->currentItem() == 2) 522 else if (kap.mAlarmIncrCombo->currentItem() == 2)
514 j = j * (60 * 24); 523 j = j * (60 * 24);
515 alarm->setStartOffset( j ); 524 alarm->setStartOffset( j );
516 525
517 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { 526 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
518 alarm->setProcedureAlarm(kap.mAlarmProgram); 527 alarm->setProcedureAlarm(kap.mAlarmProgram);
519 } 528 }
520 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) 529 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
521 alarm->setAudioAlarm(kap.mAlarmSound); 530 alarm->setAudioAlarm(kap.mAlarmSound);
522 else 531 else
523 alarm->setType(Alarm::Invalid); 532 alarm->setType(Alarm::Invalid);
524 } else { 533 } else {
525 QPtrList<Alarm> alarms = inc->alarms(); 534 Q3PtrList<Alarm> alarms = inc->alarms();
526 Alarm *alarm; 535 Alarm *alarm;
527 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 536 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
528 alarm->setEnabled(false); 537 alarm->setEnabled(false);
529 alarm->setType(Alarm::Invalid); 538 alarm->setType(Alarm::Invalid);
530 } 539 }
531 } 540 }
532 KOListViewItem* item = getItemForEvent(inc); 541 KOListViewItem* item = getItemForEvent(inc);
533 if (item) { 542 if (item) {
534 ListItemVisitor v(item, mStartDate ); 543 ListItemVisitor v(item, mStartDate );
535 inc->accept(v); 544 inc->accept(v);
536 } 545 }
537 inc = delSel.next(); 546 inc = delSel.next();
538 } 547 }
539 topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); 548 topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) );
540 qDebug("KO: Set alarm for %d items", count); 549 qDebug("KO: Set alarm for %d items", count);
541 calendar()->reInitAlarmSettings(); 550 calendar()->reInitAlarmSettings();
542 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 551 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
543} 552}
544void KOListView::setCategories( bool removeOld ) 553void KOListView::setCategories( bool removeOld )
545{ 554{
546 555
547 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 556 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
548 csd->setColorEnabled(); 557 csd->setColorEnabled();
549 if (! csd->exec()) { 558 if (! csd->exec()) {
550 delete csd; 559 delete csd;
551 return; 560 return;
552 } 561 }
553 QStringList catList = csd->selectedCategories(); 562 QStringList catList = csd->selectedCategories();
554 delete csd; 563 delete csd;
555 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; 564 Q3PtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;
556 Incidence* inc = delSel.first(); 565 Incidence* inc = delSel.first();
557 while ( inc ) { 566 while ( inc ) {
558 if ( removeOld ) { 567 if ( removeOld ) {
559 inc->setCategories( catList, false ); 568 inc->setCategories( catList, false );
560 } else { 569 } else {
561 inc->addCategories( catList, false ); 570 inc->addCategories( catList, false );
562 } 571 }
563 KOListViewItem* item = getItemForEvent(inc); 572 KOListViewItem* item = getItemForEvent(inc);
564 if (item) { 573 if (item) {
565 ListItemVisitor v(item, mStartDate ); 574 ListItemVisitor v(item, mStartDate );
566 inc->accept(v); 575 inc->accept(v);
567 } 576 }
568 inc = delSel.next(); 577 inc = delSel.next();
569 } 578 }
570 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 579 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
571} 580}
572 581
573void KOListView::beamSelected() 582void KOListView::beamSelected()
574{ 583{
575 QPtrList<Incidence> delSel = getSelectedIncidences() ; 584 Q3PtrList<Incidence> delSel = getSelectedIncidences() ;
576 if ( delSel.count() ) 585 if ( delSel.count() )
577 emit beamIncidenceList( delSel ); 586 emit beamIncidenceList( delSel );
578} 587}
579 588
580void KOListView::saveDescriptionToFile() 589void KOListView::saveDescriptionToFile()
581{ 590{
582 591
583 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), 592 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
584 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), 593 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
585 i18n("Continue"), i18n("Cancel"), 0, 594 i18n("Continue"), i18n("Cancel"), 0,
586 0, 1 ); 595 0, 1 );
587 if ( result != 0 ) { 596 if ( result != 0 ) {
588 return; 597 return;
589 } 598 }
590 QPtrList<Incidence> delSel = getSelectedIncidences() ; 599 Q3PtrList<Incidence> delSel = getSelectedIncidences() ;
591 int icount = delSel.count(); 600 int icount = delSel.count();
592 if ( icount ) { 601 if ( icount ) {
593 QString fn = KOPrefs::instance()->mLastSaveFile; 602 QString fn = KOPrefs::instance()->mLastSaveFile;
594 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 603 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
595 604
596 if ( fn == "" ) 605 if ( fn == "" )
597 return; 606 return;
598 QFileInfo info; 607 QFileInfo info;
599 info.setFile( fn ); 608 info.setFile( fn );
600 QString mes; 609 QString mes;
601 bool createbup = true; 610 bool createbup = true;
602 if ( info. exists() ) { 611 if ( info. exists() ) {
603 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 612 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
604 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 613 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
605 i18n("Overwrite!"), i18n("Cancel"), 0, 614 i18n("Overwrite!"), i18n("Cancel"), 0,
606 0, 1 ); 615 0, 1 );
@@ -632,60 +641,60 @@ void KOListView::saveDescriptionToFile()
632 if ( incidence->typeID() == todoID ) 641 if ( incidence->typeID() == todoID )
633 text += i18n("To-Do: "); 642 text += i18n("To-Do: ");
634 text += incidence->summary(); 643 text += incidence->summary();
635 if ( !incidence->location().isEmpty() ) 644 if ( !incidence->location().isEmpty() )
636 text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; 645 text +="\n(" + i18n("Location: ") + incidence->location()+ ")";
637 if ( incidence->hasStartDate() ) 646 if ( incidence->hasStartDate() )
638 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); 647 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
639 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 648 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
640 text += "\n" + i18n("Description: ") + "\n" + incidence->description(); 649 text += "\n" + i18n("Description: ") + "\n" + incidence->description();
641 ++icount; 650 ++icount;
642 651
643 } 652 }
644 } 653 }
645 incidence = delSel.next(); 654 incidence = delSel.next();
646 } 655 }
647 QFile file( fn ); 656 QFile file( fn );
648 if (!file.open( IO_WriteOnly ) ) { 657 if (!file.open( QIODevice::WriteOnly ) ) {
649 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); 658 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") );
650 return; 659 return;
651 } 660 }
652 QTextStream ts( &file ); 661 Q3TextStream ts( &file );
653 ts << text; 662 ts << text;
654 file.close(); 663 file.close();
655 //qDebug("%s ", text.latin1()); 664 //qDebug("%s ", text.latin1());
656 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); 665 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount );
657 KOPrefs::instance()->mLastSaveFile = fn; 666 KOPrefs::instance()->mLastSaveFile = fn;
658 topLevelWidget()->setCaption(mes); 667 topLevelWidget()->setCaption(mes);
659 } 668 }
660 } 669 }
661} 670}
662void KOListView::saveToFileVCS() 671void KOListView::saveToFileVCS()
663{ 672{
664 writeToFile( false ); 673 writeToFile( false );
665} 674}
666void KOListView::saveToFile() 675void KOListView::saveToFile()
667{ 676{
668 writeToFile( true ); 677 writeToFile( true );
669} 678}
670QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) 679Q3PtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos )
671{ 680{
672 QPtrList<Incidence> delSel ; 681 Q3PtrList<Incidence> delSel ;
673 bool addSubTodos = false; 682 bool addSubTodos = false;
674 bool askSubTodos = true; 683 bool askSubTodos = true;
675 QListViewItem *item = mListView->firstChild (); 684 Q3ListViewItem *item = mListView->firstChild ();
676 while ( item ) { 685 while ( item ) {
677 if ( item->isSelected() ) { 686 if ( item->isSelected() ) {
678 Incidence* inc = ((KOListViewItem *)item)->data(); 687 Incidence* inc = ((KOListViewItem *)item)->data();
679 if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { 688 if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) {
680 if ( (inc->typeID() == todoID && includeTodos) || 689 if ( (inc->typeID() == todoID && includeTodos) ||
681 (inc->typeID() == eventID && includeEvents) || 690 (inc->typeID() == eventID && includeEvents) ||
682 (inc->typeID() == journalID && includeJournals) ) { 691 (inc->typeID() == journalID && includeJournals) ) {
683 if ( inc->typeID() == todoID && onlyDueTodos ) { 692 if ( inc->typeID() == todoID && onlyDueTodos ) {
684 if ( ((Todo*)inc)->hasDueDate() ) 693 if ( ((Todo*)inc)->hasDueDate() )
685 delSel.append( inc ); 694 delSel.append( inc );
686 } else 695 } else
687 delSel.append( inc ); 696 delSel.append( inc );
688 697
689 } 698 }
690 } 699 }
691 if ( inc->typeID() == todoID ) { 700 if ( inc->typeID() == todoID ) {
@@ -693,57 +702,57 @@ QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool
693 if ( todo->relations().count() ) { 702 if ( todo->relations().count() ) {
694 if ( askSubTodos ) { 703 if ( askSubTodos ) {
695 int result = KMessageBox::warningYesNoCancel(this, 704 int result = KMessageBox::warningYesNoCancel(this,
696 i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"), 705 i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"),
697 i18n("Todo has subtodos"), 706 i18n("Todo has subtodos"),
698 i18n("Yes"), 707 i18n("Yes"),
699 i18n("No")); 708 i18n("No"));
700 if ( result == KMessageBox::Cancel ) { 709 if ( result == KMessageBox::Cancel ) {
701 delSel.clear(); 710 delSel.clear();
702 return delSel; 711 return delSel;
703 } 712 }
704 if (result == KMessageBox::Yes) 713 if (result == KMessageBox::Yes)
705 addSubTodos = true; 714 addSubTodos = true;
706 askSubTodos = false; 715 askSubTodos = false;
707 } 716 }
708 if ( addSubTodos ) { 717 if ( addSubTodos ) {
709 QPtrList<Incidence> tempSel ; 718 Q3PtrList<Incidence> tempSel ;
710 inc->addRelationsToList( &tempSel ); 719 inc->addRelationsToList( &tempSel );
711 Incidence* tempinc = tempSel.first(); 720 Incidence* tempinc = tempSel.first();
712 while ( tempinc ) { 721 while ( tempinc ) {
713 if ( delSel.findRef( tempinc ) == -1 ) { 722 if ( delSel.findRef( tempinc ) == -1 ) {
714 if ( tempinc->typeID() == todoID && onlyDueTodos ) { 723 if ( tempinc->typeID() == todoID && onlyDueTodos ) {
715 if ( ((Todo*)tempinc)->hasDueDate() ) 724 if ( ((Todo*)tempinc)->hasDueDate() )
716 delSel.append( tempinc ); 725 delSel.append( tempinc );
717 } else 726 } else
718 delSel.append( tempinc ); 727 delSel.append( tempinc );
719 } 728 }
720 tempinc = tempSel.next(); 729 tempinc = tempSel.next();
721 } 730 }
722 } 731 }
723 } 732 }
724 } 733 }
725 } 734 }
726 item = item->nextSibling(); 735 item = item->nextSibling();
727 } 736 }
728 return delSel; 737 return delSel;
729} 738}
730 739
731void KOListView::writeToFile( bool iCal ) 740void KOListView::writeToFile( bool iCal )
732{ 741{
733 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; 742 Q3PtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;
734 if ( !iCal ) { 743 if ( !iCal ) {
735 bool journal = false; 744 bool journal = false;
736 Incidence *incidence = delSel.first(); 745 Incidence *incidence = delSel.first();
737 while ( incidence ) { 746 while ( incidence ) {
738 if ( incidence->typeID() == journalID ) { 747 if ( incidence->typeID() == journalID ) {
739 journal = true; 748 journal = true;
740 break; 749 break;
741 } 750 }
742 incidence = delSel.next(); 751 incidence = delSel.next();
743 } 752 }
744 if ( journal ) { 753 if ( journal ) {
745 int result = KMessageBox::warningContinueCancel(this, 754 int result = KMessageBox::warningContinueCancel(this,
746 i18n("The journal entries can not be\nexported to a vCalendar file."), 755 i18n("The journal entries can not be\nexported to a vCalendar file."),
747 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 756 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
748 true); 757 true);
749 if (result != KMessageBox::Continue) return; 758 if (result != KMessageBox::Continue) return;
@@ -790,72 +799,72 @@ void KOListView::writeToFile( bool iCal )
790 ICalFormat format; 799 ICalFormat format;
791 format.save( &cal, fn ); 800 format.save( &cal, fn );
792 } else { 801 } else {
793 802
794 VCalFormat format; 803 VCalFormat format;
795 format.save( &cal, fn ); 804 format.save( &cal, fn );
796 } 805 }
797 mes = i18n("KO/Pi:Saved %1").arg(fn ); 806 mes = i18n("KO/Pi:Saved %1").arg(fn );
798 KOPrefs::instance()->mLastSaveFile = fn; 807 KOPrefs::instance()->mLastSaveFile = fn;
799 topLevelWidget()->setCaption(mes); 808 topLevelWidget()->setCaption(mes);
800 } 809 }
801 } 810 }
802 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 811 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
803} 812}
804void KOListView::hideAll() 813void KOListView::hideAll()
805{ 814{
806 QPtrList<QListViewItem> delSel ; 815 Q3PtrList<Q3ListViewItem> delSel ;
807 QListViewItem *item = mListView->firstChild (); 816 Q3ListViewItem *item = mListView->firstChild ();
808 while ( item ) { 817 while ( item ) {
809 if ( item->isSelected() ) { 818 if ( item->isSelected() ) {
810 delSel.append(item); 819 delSel.append(item);
811 } 820 }
812 item = item->nextSibling(); 821 item = item->nextSibling();
813 } 822 }
814 item = delSel.first() ; 823 item = delSel.first() ;
815 while ( item ) { 824 while ( item ) {
816 QListViewItem * del = item; 825 Q3ListViewItem * del = item;
817 item = delSel.next(); 826 item = delSel.next();
818 delete del; 827 delete del;
819 } 828 }
820} 829}
821void KOListView::printList() 830void KOListView::printList()
822{ 831{
823 mListView->printList(); 832 mListView->printList();
824} 833}
825void KOListView::deleteAll() 834void KOListView::deleteAll()
826{ 835{
827 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;; 836 Q3PtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;;
828 if ( delSel.count() ) { 837 if ( delSel.count() ) {
829 int icount = delSel.count(); 838 int icount = delSel.count();
830 Incidence *incidence = delSel.first(); 839 Incidence *incidence = delSel.first();
831 Incidence *toDelete; 840 Incidence *toDelete;
832 KOPrefs *p = KOPrefs::instance(); 841 KOPrefs *p = KOPrefs::instance();
833 bool confirm = p->mConfirm; 842 bool confirm = p->mConfirm;
834 QString mess; 843 QString mess;
835 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); 844 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount );
836 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { 845 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) {
837 p->mConfirm = false; 846 p->mConfirm = false;
838 int delCounter = 0; 847 int delCounter = 0;
839 QDialog dia ( this, "p-dialog", true ); 848 QDialog dia ( this, "p-dialog", true );
840 QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); 849 QLabel lab (i18n("Close dialog to abort deletion!"), &dia );
841 QVBoxLayout lay( &dia ); 850 Q3VBoxLayout lay( &dia );
842 lay.setMargin(7); 851 lay.setMargin(7);
843 lay.setSpacing(7); 852 lay.setSpacing(7);
844 lay.addWidget( &lab); 853 lay.addWidget( &lab);
845 QProgressBar bar( icount, &dia ); 854 Q3ProgressBar bar( icount, &dia );
846 lay.addWidget( &bar); 855 lay.addWidget( &bar);
847 int w = 220; 856 int w = 220;
848 int h = 50; 857 int h = 50;
849 int dw = QApplication::desktop()->width(); 858 int dw = QApplication::desktop()->width();
850 int dh = QApplication::desktop()->height(); 859 int dh = QApplication::desktop()->height();
851 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 860 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
852 //dia.resize( 240,50 ); 861 //dia.resize( 240,50 );
853 dia.show(); 862 dia.show();
854 KOPrefs::instance()->mGlobalUpdateDisabled = true; 863 KOPrefs::instance()->mGlobalUpdateDisabled = true;
855 while ( incidence ) { 864 while ( incidence ) {
856 bar.setProgress( delCounter ); 865 bar.setProgress( delCounter );
857 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); 866 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter );
858 dia.setCaption( mess ); 867 dia.setCaption( mess );
859 qApp->processEvents(); 868 qApp->processEvents();
860 toDelete = (incidence); 869 toDelete = (incidence);
861 incidence = delSel.next(); 870 incidence = delSel.next();
@@ -871,36 +880,36 @@ void KOListView::deleteAll()
871 p->mConfirm = confirm; 880 p->mConfirm = confirm;
872 } 881 }
873 } 882 }
874 883
875 884
876} 885}
877int KOListView::maxDatesHint() 886int KOListView::maxDatesHint()
878{ 887{
879 return 0; 888 return 0;
880} 889}
881 890
882int KOListView::currentDateCount() 891int KOListView::currentDateCount()
883{ 892{
884 return 0; 893 return 0;
885} 894}
886 895
887QPtrList<Incidence> KOListView::selectedIncidences() 896Q3PtrList<Incidence> KOListView::selectedIncidences()
888{ 897{
889 QPtrList<Incidence> eventList; 898 Q3PtrList<Incidence> eventList;
890 QListViewItem *item = mListView->firstChild (); 899 Q3ListViewItem *item = mListView->firstChild ();
891 while ( item ) { 900 while ( item ) {
892 if ( item->isSelected() ) { 901 if ( item->isSelected() ) {
893 eventList.append(((KOListViewItem *)item)->data()); 902 eventList.append(((KOListViewItem *)item)->data());
894 } 903 }
895 904
896 item = item->nextSibling(); 905 item = item->nextSibling();
897 } 906 }
898 907
899 // // QListViewItem *item = mListView->selectedItem(); 908 // // QListViewItem *item = mListView->selectedItem();
900 //if (item) eventList.append(((KOListViewItem *)item)->data()); 909 //if (item) eventList.append(((KOListViewItem *)item)->data());
901 910
902 return eventList; 911 return eventList;
903} 912}
904 913
905DateList KOListView::selectedDates() 914DateList KOListView::selectedDates()
906{ 915{
@@ -974,55 +983,55 @@ void KOListView::setStartDate(const QDate &start)
974void KOListView::showDates(const QDate &start, const QDate &end) 983void KOListView::showDates(const QDate &start, const QDate &end)
975{ 984{
976 clear(); 985 clear();
977 mStartDate = start; 986 mStartDate = start;
978 QDate date = start; 987 QDate date = start;
979 while( date <= end ) { 988 while( date <= end ) {
980 addEvents(calendar()->events(date)); 989 addEvents(calendar()->events(date));
981 addTodos(calendar()->todos(date)); 990 addTodos(calendar()->todos(date));
982 addJournals( calendar()->journals4Date(date) ); 991 addJournals( calendar()->journals4Date(date) );
983 date = date.addDays( 1 ); 992 date = date.addDays( 1 );
984 } 993 }
985 //emit incidenceSelected( 0 ); 994 //emit incidenceSelected( 0 );
986 updateView(); 995 updateView();
987 996
988} 997}
989 998
990void KOListView::addEvents(QPtrList<Event> eventList) 999void KOListView::addEvents(Q3PtrList<Event> eventList)
991{ 1000{
992 1001
993 Event *ev; 1002 Event *ev;
994 for(ev = eventList.first(); ev; ev = eventList.next()) { 1003 for(ev = eventList.first(); ev; ev = eventList.next()) {
995 addIncidence(ev); 1004 addIncidence(ev);
996 } 1005 }
997 if ( !mListView->currentItem() ){ 1006 if ( !mListView->currentItem() ){
998 updateView(); 1007 updateView();
999 } 1008 }
1000} 1009}
1001 1010
1002void KOListView::addTodos(QPtrList<Todo> eventList) 1011void KOListView::addTodos(Q3PtrList<Todo> eventList)
1003{ 1012{
1004 Todo *ev; 1013 Todo *ev;
1005 for(ev = eventList.first(); ev; ev = eventList.next()) { 1014 for(ev = eventList.first(); ev; ev = eventList.next()) {
1006 addIncidence(ev); 1015 addIncidence(ev);
1007 } 1016 }
1008 if ( !mListView->currentItem() ){ 1017 if ( !mListView->currentItem() ){
1009 updateView(); 1018 updateView();
1010 } 1019 }
1011} 1020}
1012void KOListView::addJournals(QPtrList<Journal> eventList) 1021void KOListView::addJournals(Q3PtrList<Journal> eventList)
1013{ 1022{
1014 Journal *ev; 1023 Journal *ev;
1015 for(ev = eventList.first(); ev; ev = eventList.next()) { 1024 for(ev = eventList.first(); ev; ev = eventList.next()) {
1016 addIncidence(ev); 1025 addIncidence(ev);
1017 } 1026 }
1018 if ( !mListView->currentItem() ){ 1027 if ( !mListView->currentItem() ){
1019 updateView(); 1028 updateView();
1020 } 1029 }
1021} 1030}
1022 1031
1023void KOListView::showCompletedTodos() 1032void KOListView::showCompletedTodos()
1024{ 1033{
1025 mForceShowCompletedTodos = true; 1034 mForceShowCompletedTodos = true;
1026} 1035}
1027void KOListView::addIncidence(Incidence *incidence) 1036void KOListView::addIncidence(Incidence *incidence)
1028{ 1037{
@@ -1031,33 +1040,33 @@ void KOListView::addIncidence(Incidence *incidence)
1031 // mListView->setFont ( KOPrefs::instance()->mListViewFont ); 1040 // mListView->setFont ( KOPrefs::instance()->mListViewFont );
1032 if ( incidence->typeID() == todoID ) { 1041 if ( incidence->typeID() == todoID ) {
1033 if ( ! mForceShowCompletedTodos ) { 1042 if ( ! mForceShowCompletedTodos ) {
1034 if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() ) 1043 if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() )
1035 return; 1044 return;
1036 } 1045 }
1037 } 1046 }
1038 mUidDict.insert( incidence->uid(), incidence ); 1047 mUidDict.insert( incidence->uid(), incidence );
1039 KOListViewItem *item = new KOListViewItem( incidence, mListView ); 1048 KOListViewItem *item = new KOListViewItem( incidence, mListView );
1040 ListItemVisitor v(item, mStartDate ); 1049 ListItemVisitor v(item, mStartDate );
1041 if (incidence->accept(v)) { 1050 if (incidence->accept(v)) {
1042 return; 1051 return;
1043 } 1052 }
1044 else delete item; 1053 else delete item;
1045} 1054}
1046 1055
1047void KOListView::showEvents(QPtrList<Event> eventList) 1056void KOListView::showEvents(Q3PtrList<Event> eventList)
1048{ 1057{
1049 clear(); 1058 clear();
1050 1059
1051 addEvents(eventList); 1060 addEvents(eventList);
1052 1061
1053 // After new creation of list view no events are selected. 1062 // After new creation of list view no events are selected.
1054 emit incidenceSelected( 0 ); 1063 emit incidenceSelected( 0 );
1055} 1064}
1056int KOListView::count() 1065int KOListView::count()
1057{ 1066{
1058 return mListView->childCount(); 1067 return mListView->childCount();
1059} 1068}
1060 1069
1061void KOListView::changeEventDisplay(Event *event, int action) 1070void KOListView::changeEventDisplay(Event *event, int action)
1062{ 1071{
1063 KOListViewItem *item; 1072 KOListViewItem *item;
@@ -1082,69 +1091,69 @@ void KOListView::changeEventDisplay(Event *event, int action)
1082 break; 1091 break;
1083 default: 1092 default:
1084 ; 1093 ;
1085 } 1094 }
1086} 1095}
1087 1096
1088KOListViewItem *KOListView::getItemForEvent(Incidence *event) 1097KOListViewItem *KOListView::getItemForEvent(Incidence *event)
1089{ 1098{
1090 KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); 1099 KOListViewItem *item = (KOListViewItem *)mListView->firstChild();
1091 while (item) { 1100 while (item) {
1092 if (item->data() == event) return item; 1101 if (item->data() == event) return item;
1093 item = (KOListViewItem *)item->nextSibling(); 1102 item = (KOListViewItem *)item->nextSibling();
1094 } 1103 }
1095 return 0; 1104 return 0;
1096} 1105}
1097 1106
1098void KOListView::defaultItemAction(QListViewItem *i) 1107void KOListView::defaultItemAction(Q3ListViewItem *i)
1099{ 1108{
1100 KOListViewItem *item = static_cast<KOListViewItem *>( i ); 1109 KOListViewItem *item = static_cast<KOListViewItem *>( i );
1101 if ( item ) defaultAction( item->data() ); 1110 if ( item ) defaultAction( item->data() );
1102 1111
1103} 1112}
1104 1113
1105void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) 1114void KOListView::popupMenu(Q3ListViewItem *item,const QPoint &,int)
1106{ 1115{
1107 mActiveItem = (KOListViewItem *)item; 1116 mActiveItem = (KOListViewItem *)item;
1108 if (mActiveItem) { 1117 if (mActiveItem) {
1109 Incidence *incidence = mActiveItem->data(); 1118 Incidence *incidence = mActiveItem->data();
1110 mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); 1119 mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) );
1111 mPopupMenu->showIncidencePopup(incidence); 1120 mPopupMenu->showIncidencePopup(incidence);
1112 1121
1113 /* 1122 /*
1114 if ( incidence && incidence->type() == "Event" ) { 1123 if ( incidence && incidence->type() == "Event" ) {
1115 Event *event = static_cast<Event *>( incidence ); 1124 Event *event = static_cast<Event *>( incidence );
1116 mPopupMenu->showEventPopup(event); 1125 mPopupMenu->showEventPopup(event);
1117 } 1126 }
1118 */ 1127 */
1119 } 1128 }
1120} 1129}
1121 1130
1122void KOListView::readSettings(KConfig *config, QString setting) 1131void KOListView::readSettings(KConfig *config, QString setting)
1123{ 1132{
1124 // qDebug("KOListView::readSettings "); 1133 // qDebug("KOListView::readSettings ");
1125 mListView->restoreLayout(config,setting); 1134 mListView->restoreLayout(config,setting);
1126} 1135}
1127 1136
1128void KOListView::writeSettings(KConfig *config, QString setting) 1137void KOListView::writeSettings(KConfig *config, QString setting)
1129{ 1138{
1130 // qDebug("KOListView::writeSettings "); 1139 // qDebug("KOListView::writeSettings ");
1131 mListView->saveLayout(config, setting); 1140 mListView->saveLayout(config, setting);
1132} 1141}
1133 1142
1134void KOListView::processSelectionChange(QListViewItem *) 1143void KOListView::processSelectionChange(Q3ListViewItem *)
1135{ 1144{
1136 1145
1137 KOListViewItem *item = 1146 KOListViewItem *item =
1138 static_cast<KOListViewItem *>( mListView->currentItem() ); 1147 static_cast<KOListViewItem *>( mListView->currentItem() );
1139 1148
1140 if ( !item ) { 1149 if ( !item ) {
1141 emit incidenceSelected( 0 ); 1150 emit incidenceSelected( 0 );
1142 } else { 1151 } else {
1143 emit incidenceSelected( item->data() ); 1152 emit incidenceSelected( item->data() );
1144 } 1153 }
1145} 1154}
1146 1155
1147void KOListView::clearSelection() 1156void KOListView::clearSelection()
1148{ 1157{
1149 mListView->selectAll( false ); 1158 mListView->selectAll( false );
1150} 1159}
@@ -1167,260 +1176,260 @@ Incidence* KOListView::currentItem()
1167} 1176}
1168void KOListView::keyPressEvent ( QKeyEvent *e) 1177void KOListView::keyPressEvent ( QKeyEvent *e)
1169{ 1178{
1170 1179
1171 if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { 1180 if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) {
1172 deleteAll(); 1181 deleteAll();
1173 return; 1182 return;
1174 } 1183 }
1175 1184
1176 e->ignore(); 1185 e->ignore();
1177} 1186}
1178void KOListViewListView::keyPressEvent ( QKeyEvent *e) 1187void KOListViewListView::keyPressEvent ( QKeyEvent *e)
1179{ 1188{
1180 1189
1181 switch ( e->key() ) { 1190 switch ( e->key() ) {
1182 case Qt::Key_Down: 1191 case Qt::Key_Down:
1183 if ( e->state() == ShiftButton ) { 1192 if ( e->state() == Qt::ShiftButton ) {
1184 QListViewItem* cn = currentItem(); 1193 Q3ListViewItem* cn = currentItem();
1185 if ( !cn ) 1194 if ( !cn )
1186 cn = firstChild(); 1195 cn = firstChild();
1187 if ( !cn ) 1196 if ( !cn )
1188 return; 1197 return;
1189 while ( cn->nextSibling() ) 1198 while ( cn->nextSibling() )
1190 cn = cn->nextSibling(); 1199 cn = cn->nextSibling();
1191 setCurrentItem ( cn ); 1200 setCurrentItem ( cn );
1192 ensureItemVisible ( cn ); 1201 ensureItemVisible ( cn );
1193 1202
1194 e->accept(); 1203 e->accept();
1195 return; 1204 return;
1196 } 1205 }
1197 if ( e->state() == ControlButton ) { 1206 if ( e->state() == Qt::ControlButton ) {
1198 int count = childCount (); 1207 int count = childCount ();
1199 int jump = count / 5; 1208 int jump = count / 5;
1200 QListViewItem* cn; 1209 Q3ListViewItem* cn;
1201 cn = currentItem(); 1210 cn = currentItem();
1202 if ( ! cn ) 1211 if ( ! cn )
1203 return; 1212 return;
1204 if ( jump == 0 ) 1213 if ( jump == 0 )
1205 jump = 1; 1214 jump = 1;
1206 while ( jump && cn->nextSibling() ) { 1215 while ( jump && cn->nextSibling() ) {
1207 cn = cn->nextSibling(); 1216 cn = cn->nextSibling();
1208 --jump; 1217 --jump;
1209 } 1218 }
1210 setCurrentItem ( cn ); 1219 setCurrentItem ( cn );
1211 ensureItemVisible ( cn ); 1220 ensureItemVisible ( cn );
1212 1221
1213 } else 1222 } else
1214 QListView::keyPressEvent ( e ) ; 1223 Q3ListView::keyPressEvent ( e ) ;
1215 e->accept(); 1224 e->accept();
1216 break; 1225 break;
1217 1226
1218 case Qt::Key_Up: 1227 case Qt::Key_Up:
1219 if ( e->state() == ShiftButton ) { 1228 if ( e->state() == Qt::ShiftButton ) {
1220 QListViewItem* cn = firstChild(); 1229 Q3ListViewItem* cn = firstChild();
1221 if ( cn ) { 1230 if ( cn ) {
1222 setCurrentItem ( cn ); 1231 setCurrentItem ( cn );
1223 ensureItemVisible ( cn ); 1232 ensureItemVisible ( cn );
1224 } 1233 }
1225 e->accept(); 1234 e->accept();
1226 return; 1235 return;
1227 } 1236 }
1228 if ( e->state() == ControlButton ) { 1237 if ( e->state() == Qt::ControlButton ) {
1229 int count = childCount (); 1238 int count = childCount ();
1230 int jump = count / 5; 1239 int jump = count / 5;
1231 QListViewItem* cn; 1240 Q3ListViewItem* cn;
1232 cn = currentItem(); 1241 cn = currentItem();
1233 if ( ! cn ) 1242 if ( ! cn )
1234 return; 1243 return;
1235 if ( jump == 0 ) 1244 if ( jump == 0 )
1236 jump = 1; 1245 jump = 1;
1237 while ( jump && cn->itemAbove ()) { 1246 while ( jump && cn->itemAbove ()) {
1238 cn = cn->itemAbove (); 1247 cn = cn->itemAbove ();
1239 --jump; 1248 --jump;
1240 } 1249 }
1241 setCurrentItem ( cn ); 1250 setCurrentItem ( cn );
1242 ensureItemVisible ( cn ); 1251 ensureItemVisible ( cn );
1243 } else 1252 } else
1244 QListView::keyPressEvent ( e ) ; 1253 Q3ListView::keyPressEvent ( e ) ;
1245 e->accept(); 1254 e->accept();
1246 break; 1255 break;
1247 case Qt::Key_I: { 1256 case Qt::Key_I: {
1248 QListViewItem* cn; 1257 Q3ListViewItem* cn;
1249 cn = currentItem(); 1258 cn = currentItem();
1250 if ( cn ) { 1259 if ( cn ) {
1251 KOListViewItem* ci = (KOListViewItem*)( cn ); 1260 KOListViewItem* ci = (KOListViewItem*)( cn );
1252 if ( ci ){ 1261 if ( ci ){
1253 //emit showIncidence( ci->data()); 1262 //emit showIncidence( ci->data());
1254 cn = cn->nextSibling(); 1263 cn = cn->nextSibling();
1255 if ( cn ) { 1264 if ( cn ) {
1256 setCurrentItem ( cn ); 1265 setCurrentItem ( cn );
1257 ensureItemVisible ( cn ); 1266 ensureItemVisible ( cn );
1258 } 1267 }
1259 emit showIncidence( ci->data()); 1268 emit showIncidence( ci->data());
1260 } 1269 }
1261 } 1270 }
1262 e->accept(); 1271 e->accept();
1263 } 1272 }
1264 break; 1273 break;
1265 case Qt::Key_Return: 1274 case Qt::Key_Return:
1266 case Qt::Key_Enter: 1275 case Qt::Key_Enter:
1267 { 1276 {
1268 QListViewItem* cn; 1277 Q3ListViewItem* cn;
1269 cn = currentItem(); 1278 cn = currentItem();
1270 if ( cn ) { 1279 if ( cn ) {
1271 KOListViewItem* ci = (KOListViewItem*)( cn ); 1280 KOListViewItem* ci = (KOListViewItem*)( cn );
1272 if ( ci ){ 1281 if ( ci ){
1273 if ( e->state() == ShiftButton ) 1282 if ( e->state() == Qt::ShiftButton )
1274 ci->setSelected( false ); 1283 ci->setSelected( false );
1275 else 1284 else
1276 ci->setSelected( true ); 1285 ci->setSelected( true );
1277 cn = cn->nextSibling(); 1286 cn = cn->nextSibling();
1278 if ( cn ) { 1287 if ( cn ) {
1279 setCurrentItem ( cn ); 1288 setCurrentItem ( cn );
1280 ensureItemVisible ( cn ); 1289 ensureItemVisible ( cn );
1281 } else { 1290 } else {
1282 emit currentChanged( ci ); 1291 emit currentChanged( ci );
1283 } 1292 }
1284 } 1293 }
1285 } 1294 }
1286 e->accept(); 1295 e->accept();
1287 } 1296 }
1288 break; 1297 break;
1289 default: 1298 default:
1290 e->ignore(); 1299 e->ignore();
1291 } 1300 }
1292} 1301}
1293KOListViewListView::KOListViewListView(KOListView * lv ) 1302KOListViewListView::KOListViewListView(KOListView * lv )
1294 : KListView( lv, "kolistlistview", false ) 1303 : KListView( lv, "kolistlistview", false )
1295{ 1304{
1296 mYMousePos = 0; 1305 mYMousePos = 0;
1297 setAllColumnsShowFocus( true ); 1306 setAllColumnsShowFocus( true );
1298 mPopupTimer = new QTimer(this); 1307 mPopupTimer = new QTimer(this);
1299 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); 1308 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
1300#ifndef DESKTOP_VERSION 1309#ifndef DESKTOP_VERSION
1301 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 1310 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
1302#endif 1311#endif
1303 setSelectionMode( QListView::Multi ); 1312 setSelectionMode( Q3ListView::Multi );
1304 setMultiSelection( true); 1313 setMultiSelection( true);
1305} 1314}
1306bool KOListViewListView::hasMultiSelection(QListViewItem* item) 1315bool KOListViewListView::hasMultiSelection(Q3ListViewItem* item)
1307{ 1316{
1308 QListViewItem *qitem = firstChild (); 1317 Q3ListViewItem *qitem = firstChild ();
1309 while ( qitem ) { 1318 while ( qitem ) {
1310 if ( qitem->isSelected() && item != qitem ) 1319 if ( qitem->isSelected() && item != qitem )
1311 return true; 1320 return true;
1312 qitem = qitem->nextSibling(); 1321 qitem = qitem->nextSibling();
1313 } 1322 }
1314 return false; 1323 return false;
1315} 1324}
1316void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 1325void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
1317{ 1326{
1318 if (!e) return; 1327 if (!e) return;
1319 QPoint vp = contentsToViewport(e->pos()); 1328 QPoint vp = contentsToViewport(e->pos());
1320 QListViewItem *item = itemAt(vp); 1329 Q3ListViewItem *item = itemAt(vp);
1321 if (!item) { 1330 if (!item) {
1322 emit newEvent(); 1331 emit newEvent();
1323 return; 1332 return;
1324 } 1333 }
1325 KListView::contentsMouseDoubleClickEvent(e); 1334 KListView::contentsMouseDoubleClickEvent(e);
1326} 1335}
1327#if 0 1336#if 0
1328void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1337void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1329{ 1338{
1330 //qDebug("contentsMousePressEvent++++ "); 1339 //qDebug("contentsMousePressEvent++++ ");
1331 KListView::contentsMousePressEvent( e ); 1340 KListView::contentsMousePressEvent( e );
1332 if ( e->button() == RightButton ) { 1341 if ( e->button() == Qt::RightButton ) {
1333 QListViewItem* ci = currentItem(); 1342 Q3ListViewItem* ci = currentItem();
1334 clearSelection () ; 1343 clearSelection () ;
1335 if ( ci ) 1344 if ( ci )
1336 ci->setSelected( true ); 1345 ci->setSelected( true );
1337 } 1346 }
1338} 1347}
1339void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1348void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1340{ 1349{
1341 KListView::contentsMouseReleaseEvent(e); 1350 KListView::contentsMouseReleaseEvent(e);
1342} 1351}
1343void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1352void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1344{ 1353{
1345 KListView::contentsMouseMoveEvent(e); 1354 KListView::contentsMouseMoveEvent(e);
1346} 1355}
1347#endif 1356#endif
1348void KOListViewListView::popupMenu() 1357void KOListViewListView::popupMenu()
1349{ 1358{
1350 mPopupTimer->stop(); 1359 mPopupTimer->stop();
1351 QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); 1360 QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, Qt::RightButton , Qt::RightButton );
1352 QApplication::postEvent( this->viewport(), e ); 1361 QApplication::postEvent( this->viewport(), e );
1353 1362
1354} 1363}
1355void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1364void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1356{ 1365{
1357 //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y()); 1366 //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y());
1358 mYMousePos = mapToGlobal( (e->pos())).y(); 1367 mYMousePos = mapToGlobal( (e->pos())).y();
1359 if ( e->button() == LeftButton ) { 1368 if ( e->button() == Qt::LeftButton ) {
1360 mPopupTimer->start( 600 ); 1369 mPopupTimer->start( 600 );
1361 mEventPos = contentsToViewport(e->pos()); 1370 mEventPos = contentsToViewport(e->pos());
1362 mEventGlobalPos = e->globalPos(); 1371 mEventGlobalPos = e->globalPos();
1363 } 1372 }
1364 KListView::contentsMousePressEvent( e ); 1373 KListView::contentsMousePressEvent( e );
1365 if ( e->button() == RightButton ) { 1374 if ( e->button() == Qt::RightButton ) {
1366 QListViewItem* ci = currentItem(); 1375 Q3ListViewItem* ci = currentItem();
1367 //clearSelection(); 1376 //clearSelection();
1368 if ( ci ) 1377 if ( ci )
1369 ci->setSelected( true ); 1378 ci->setSelected( true );
1370 } 1379 }
1371} 1380}
1372void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1381void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1373{ 1382{
1374 mPopupTimer->stop(); 1383 mPopupTimer->stop();
1375 KListView::contentsMouseReleaseEvent(e); 1384 KListView::contentsMouseReleaseEvent(e);
1376} 1385}
1377void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1386void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1378{ 1387{
1379 // qDebug("contentsMouseMoveEv....... "); 1388 // qDebug("contentsMouseMoveEv....... ");
1380 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); 1389 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() );
1381 int diff = mYMousePos - mapToGlobal( (e->pos())).y(); 1390 int diff = mYMousePos - mapToGlobal( (e->pos())).y();
1382 if ( diff < 0 ) diff = -diff; 1391 if ( diff < 0 ) diff = -diff;
1383 if ( diff > 15 ) 1392 if ( diff > 15 )
1384 mPopupTimer->stop(); 1393 mPopupTimer->stop();
1385 else { 1394 else {
1386 mEventPos = contentsToViewport(e->pos()); 1395 mEventPos = contentsToViewport(e->pos());
1387 mEventGlobalPos = e->globalPos(); 1396 mEventGlobalPos = e->globalPos();
1388 } 1397 }
1389 KListView::contentsMouseMoveEvent(e); 1398 KListView::contentsMouseMoveEvent(e);
1390} 1399}
1391 1400
1392#define protected public 1401#define protected public
1393#include <qheader.h> 1402#include <q3header.h>
1394#undef protected 1403#undef protected
1395void KOListViewListView::printList() 1404void KOListViewListView::printList()
1396{ 1405{
1397#ifdef DESKTOP_VERSION 1406#ifdef DESKTOP_VERSION
1398 KOPrintPrefs pp ( this ); 1407 KOPrintPrefs pp ( this );
1399 if (!pp.exec() ) 1408 if (!pp.exec() )
1400 return; 1409 return;
1401 int scaleval = pp.printMode() ; 1410 int scaleval = pp.printMode() ;
1402 1411
1403 QPrinter printer; 1412 QPrinter printer;
1404 if (!printer.setup() ) 1413 if (!printer.setup() )
1405 return; 1414 return;
1406 clearSelection (); 1415 clearSelection ();
1407 QPainter p; 1416 QPainter p;
1408 p.begin ( &printer ); 1417 p.begin ( &printer );
1409 p.setFont(font()); 1418 p.setFont(font());
1410 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 1419 Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer );
1411 float dx, dy; 1420 float dx, dy;
1412 int wid = (m.width() * 9)/10; 1421 int wid = (m.width() * 9)/10;
1413 dx = (float) wid/(float)contentsWidth (); 1422 dx = (float) wid/(float)contentsWidth ();
1414 dy = (float)(m.height()) / (float)contentsHeight (); 1423 dy = (float)(m.height()) / (float)contentsHeight ();
1415 float scale; 1424 float scale;
1416 // scale to fit the width or height of the paper 1425 // scale to fit the width or height of the paper
1417 if ( dx < dy ) 1426 if ( dx < dy )
1418 scale = dx; 1427 scale = dx;
1419 else 1428 else
1420 scale = dy; 1429 scale = dy;
1421 1430
1422 p.translate( m.width()/10,m.width()/10 ); 1431 p.translate( m.width()/10,m.width()/10 );
1423 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { 1432 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
1424 p.scale( scale, scale ); 1433 p.scale( scale, scale );
1425 } 1434 }
1426 1435
@@ -1430,29 +1439,29 @@ void KOListViewListView::printList()
1430 for ( iii = 0; iii < cou; ++iii ) { 1439 for ( iii = 0; iii < cou; ++iii ) {
1431 rect.setLeft ( header()->sectionPos( iii ) ); 1440 rect.setLeft ( header()->sectionPos( iii ) );
1432 rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii)); 1441 rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii));
1433 header()->paintSection ( & p, header()->mapToIndex (iii), rect ); 1442 header()->paintSection ( & p, header()->mapToIndex (iii), rect );
1434 } 1443 }
1435 p.translate( 0, header()->height()); 1444 p.translate( 0, header()->height());
1436 //drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () ); 1445 //drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () );
1437 1446
1438 const QColorGroup &cg = colorGroup(); 1447 const QColorGroup &cg = colorGroup();
1439 KOListViewItem* item = (KOListViewItem* )firstChild(); 1448 KOListViewItem* item = (KOListViewItem* )firstChild();
1440 int yOff = 0; 1449 int yOff = 0;
1441 while ( item ) { 1450 while ( item ) {
1442 p.translate( 0, yOff ); 1451 p.translate( 0, yOff );
1443 p.save(); 1452 p.save();
1444 for ( iii = 0; iii < cou; ++iii ) { 1453 for ( iii = 0; iii < cou; ++iii ) {
1445 int align = columnAlignment( iii ); 1454 int align = columnAlignment( iii );
1446 if ( align == AlignAuto ) align = AlignLeft; 1455 if ( align == Qt::AlignLeft ) align = Qt::AlignLeft;
1447 p.restore(); 1456 p.restore();
1448 p.save(); 1457 p.save();
1449 p.translate( header()->sectionPos( iii ), 0); 1458 p.translate( header()->sectionPos( iii ), 0);
1450 item->paintCell( &p, cg, iii, header()->sectionSize (iii), align ); 1459 item->paintCell( &p, cg, iii, header()->sectionSize (iii), align );
1451 } 1460 }
1452 yOff = item->height(); 1461 yOff = item->height();
1453 item = (KOListViewItem* )(item->itemBelow()); 1462 item = (KOListViewItem* )(item->itemBelow());
1454 p.restore(); 1463 p.restore();
1455 } 1464 }
1456 p.end(); 1465 p.end();
1457#endif 1466#endif
1458} 1467}
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index 99d0561..9fb0b00 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -11,83 +11,89 @@
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef _KOLISTVIEW_H 24#ifndef _KOLISTVIEW_H
25#define _KOLISTVIEW_H 25#define _KOLISTVIEW_H
26 26
27#include <qlistview.h> 27#include <q3listview.h>
28#include <qmap.h> 28#include <qmap.h>
29#include <qdict.h> 29#include <q3dict.h>
30//Added by qt3to4:
31#include <QMouseEvent>
32#include <Q3PtrList>
33#include <Q3PopupMenu>
34#include <QKeyEvent>
35#include <Q3VBoxLayout>
30 36
31#include <klistview.h> 37#include <klistview.h>
32 38
33#include <libkcal/incidence.h> 39#include <libkcal/incidence.h>
34 40
35#include "koeventview.h" 41#include "koeventview.h"
36#include "customlistviewitem.h" 42#include "customlistviewitem.h"
37 43
38using namespace KCal; 44using namespace KCal;
39 45
40class KOListViewWhatsThis; 46class KOListViewWhatsThis;
41 47
42#include <qpushbutton.h> 48#include <qpushbutton.h>
43#include <qlayout.h> 49#include <qlayout.h>
44#include <qdialog.h> 50#include <qdialog.h>
45#include <qtimer.h> 51#include <qtimer.h>
46#include <qcombobox.h> 52#include <qcombobox.h>
47#include <qspinbox.h> 53#include <qspinbox.h>
48#include <qtooltip.h> 54#include <qtooltip.h>
49#include <qcheckbox.h> 55#include <qcheckbox.h>
50#include <qhbox.h> 56#include <q3hbox.h>
51#include <qlabel.h> 57#include <qlabel.h>
52#include <kiconloader.h> 58#include <kiconloader.h>
53#include "kfiledialog.h" 59#include "kfiledialog.h"
54#include "koprefs.h" 60#include "koprefs.h"
55class KOAlarmPrefs : public QDialog 61class KOAlarmPrefs : public QDialog
56{ 62{
57 Q_OBJECT 63 Q_OBJECT
58 public: 64 public:
59 KOAlarmPrefs( QWidget *par=0, const char *name=0 ) : 65 KOAlarmPrefs( QWidget *par=0, const char *name=0 ) :
60 QDialog( par, name, true ) 66 QDialog( par, name, true )
61 { 67 {
62 setCaption( i18n("Alarm Options") ); 68 setCaption( i18n("Alarm Options") );
63 QVBoxLayout* alarmLayout = new QVBoxLayout( this ); 69 Q3VBoxLayout* alarmLayout = new Q3VBoxLayout( this );
64 alarmLayout->setSpacing( 3 ); 70 alarmLayout->setSpacing( 3 );
65 alarmLayout->setMargin( 3 ); 71 alarmLayout->setMargin( 3 );
66 QWidget *parent = this; 72 QWidget *parent = this;
67 mAlarmButton = new QCheckBox(i18n("Set reminder ON with offset to:"),parent); 73 mAlarmButton = new QCheckBox(i18n("Set reminder ON with offset to:"),parent);
68 alarmLayout->addWidget(mAlarmButton); 74 alarmLayout->addWidget(mAlarmButton);
69 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 75 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
70 mAlarmTimeEdit->setValue( 15 ); 76 mAlarmTimeEdit->setValue( 15 );
71 alarmLayout->addWidget(mAlarmTimeEdit); 77 alarmLayout->addWidget(mAlarmTimeEdit);
72 mAlarmIncrCombo = new QComboBox(false, parent); 78 mAlarmIncrCombo = new QComboBox(false, parent);
73 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 79 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
74 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 80 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
75 mAlarmIncrCombo->insertItem(i18n("day(s)")); 81 mAlarmIncrCombo->insertItem(i18n("day(s)"));
76 alarmLayout->addWidget(mAlarmIncrCombo); 82 alarmLayout->addWidget(mAlarmIncrCombo);
77 QHBox * hb = new QHBox ( parent ); 83 Q3HBox * hb = new Q3HBox ( parent );
78 alarmLayout->addWidget(hb); 84 alarmLayout->addWidget(hb);
79 mAlarmSoundButton = new QPushButton(hb); 85 mAlarmSoundButton = new QPushButton(hb);
80 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 86 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
81 mAlarmSoundButton->setToggleButton(true); 87 mAlarmSoundButton->setToggleButton(true);
82 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 88 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
83 mAlarmProgramButton = new QPushButton(hb); 89 mAlarmProgramButton = new QPushButton(hb);
84 mAlarmProgramButton->setPixmap(SmallIcon("run")); 90 mAlarmProgramButton->setPixmap(SmallIcon("run"));
85 mAlarmProgramButton->setToggleButton(true); 91 mAlarmProgramButton->setToggleButton(true);
86 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 92 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
87 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 93 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
88 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); 94 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
89 mAlarmLabel = new QLabel( this ); 95 mAlarmLabel = new QLabel( this );
90 alarmLayout->addWidget( mAlarmLabel ); 96 alarmLayout->addWidget( mAlarmLabel );
91 mAlarmLabel->setText( "..."+KOPrefs::instance()->mDefaultAlarmFile.right( 30 ) ); 97 mAlarmLabel->setText( "..."+KOPrefs::instance()->mDefaultAlarmFile.right( 30 ) );
92 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 98 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
93 mAlarmSoundButton->setOn( true ); 99 mAlarmSoundButton->setOn( true );
@@ -197,121 +203,121 @@ class ListItemVisitor : public Incidence::Visitor
197 This class provides a multi-column list view of events. It can 203 This class provides a multi-column list view of events. It can
198 display events from one particular day or several days, it doesn't 204 display events from one particular day or several days, it doesn't
199 matter. To use a view that only handles one day at a time, use 205 matter. To use a view that only handles one day at a time, use
200 KODayListView. 206 KODayListView.
201 207
202 @short multi-column list view of various events. 208 @short multi-column list view of various events.
203 @author Preston Brown <pbrown@kde.org> 209 @author Preston Brown <pbrown@kde.org>
204 @see KOBaseView, KODayListView 210 @see KOBaseView, KODayListView
205*/ 211*/
206class KOListView; 212class KOListView;
207 213
208class KOListViewListView : public KListView 214class KOListViewListView : public KListView
209{ 215{
210 Q_OBJECT 216 Q_OBJECT
211 public: 217 public:
212 KOListViewListView(KOListView * lv ); 218 KOListViewListView(KOListView * lv );
213 bool hasMultiSelection(QListViewItem*); 219 bool hasMultiSelection(Q3ListViewItem*);
214 void printList(); 220 void printList();
215 signals: 221 signals:
216 void newEvent(); 222 void newEvent();
217 void showIncidence( Incidence* ); 223 void showIncidence( Incidence* );
218 public slots: 224 public slots:
219 void popupMenu(); 225 void popupMenu();
220 private: 226 private:
221 QPoint mEventPos; 227 QPoint mEventPos;
222 QPoint mEventGlobalPos; 228 QPoint mEventGlobalPos;
223 QTimer* mPopupTimer; 229 QTimer* mPopupTimer;
224 int mYMousePos; 230 int mYMousePos;
225 void keyPressEvent ( QKeyEvent * ) ; 231 void keyPressEvent ( QKeyEvent * ) ;
226 void contentsMouseDoubleClickEvent(QMouseEvent *e); 232 void contentsMouseDoubleClickEvent(QMouseEvent *e);
227 void contentsMousePressEvent(QMouseEvent *e); 233 void contentsMousePressEvent(QMouseEvent *e);
228 void contentsMouseReleaseEvent(QMouseEvent *e); 234 void contentsMouseReleaseEvent(QMouseEvent *e);
229 void contentsMouseMoveEvent(QMouseEvent *e); 235 void contentsMouseMoveEvent(QMouseEvent *e);
230 bool mMouseDown; 236 bool mMouseDown;
231}; 237};
232 238
233class KOListView : public KOEventView 239class KOListView : public KOEventView
234{ 240{
235 Q_OBJECT 241 Q_OBJECT
236 public: 242 public:
237 KOListView(Calendar *calendar, QWidget *parent = 0, 243 KOListView(Calendar *calendar, QWidget *parent = 0,
238 const char *name = 0); 244 const char *name = 0);
239 ~KOListView(); 245 ~KOListView();
240 246
241 virtual int maxDatesHint(); 247 virtual int maxDatesHint();
242 virtual int currentDateCount(); 248 virtual int currentDateCount();
243 virtual QPtrList<Incidence> selectedIncidences(); 249 virtual Q3PtrList<Incidence> selectedIncidences();
244 virtual DateList selectedDates(); 250 virtual DateList selectedDates();
245 251
246 void showDates(bool show); 252 void showDates(bool show);
247 Incidence* currentItem(); 253 Incidence* currentItem();
248 void addTodos(QPtrList<Todo> eventList); 254 void addTodos(Q3PtrList<Todo> eventList);
249 void addJournals(QPtrList<Journal> eventList); 255 void addJournals(Q3PtrList<Journal> eventList);
250 virtual void printPreview(CalPrinter *calPrinter, 256 virtual void printPreview(CalPrinter *calPrinter,
251 const QDate &, const QDate &); 257 const QDate &, const QDate &);
252 258
253 void readSettings(KConfig *config, QString setting = "KOListView Layout"); 259 void readSettings(KConfig *config, QString setting = "KOListView Layout");
254 void writeSettings(KConfig *config, QString setting = "KOListView Layout"); 260 void writeSettings(KConfig *config, QString setting = "KOListView Layout");
255 void updateList(); 261 void updateList();
256 void clearList(); 262 void clearList();
257 void setStartDate(const QDate &start); 263 void setStartDate(const QDate &start);
258 int count(); 264 int count();
259 QString getWhatsThisText(QPoint p); 265 QString getWhatsThisText(QPoint p);
260 QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents = true, bool includeTodos = true , bool includeJournals = true, bool onlyDueTodos = false ); 266 Q3PtrList<Incidence> getSelectedIncidences( bool includeEvents = true, bool includeTodos = true , bool includeJournals = true, bool onlyDueTodos = false );
261 void showCompletedTodos(); 267 void showCompletedTodos();
262 signals: 268 signals:
263 void signalNewEvent(); 269 void signalNewEvent();
264 void beamIncidenceList(QPtrList<Incidence>); 270 void beamIncidenceList(Q3PtrList<Incidence>);
265 271
266 public slots: 272 public slots:
267 void hideAll(); 273 void hideAll();
268 void printList(); 274 void printList();
269 void resetFocus(); 275 void resetFocus();
270 virtual void updateView(); 276 virtual void updateView();
271 virtual void showDates(const QDate &start, const QDate &end); 277 virtual void showDates(const QDate &start, const QDate &end);
272 virtual void showEvents(QPtrList<Event> eventList); 278 virtual void showEvents(Q3PtrList<Event> eventList);
273 void clearSelection(); 279 void clearSelection();
274 void allSelection(); 280 void allSelection();
275 281
276 void clear(); 282 void clear();
277 void showDates(); 283 void showDates();
278 void hideDates(); 284 void hideDates();
279 void deleteAll(); 285 void deleteAll();
280 void saveToFile(); 286 void saveToFile();
281 void saveToFileVCS(); 287 void saveToFileVCS();
282 void saveDescriptionToFile(); 288 void saveDescriptionToFile();
283 void beamSelected(); 289 void beamSelected();
284 void updateConfig(); 290 void updateConfig();
285 void setCat(); 291 void setCat();
286 void setAlarm(); 292 void setAlarm();
287 void setCategories( bool removeOld ); 293 void setCategories( bool removeOld );
288 void changeEventDisplay(Event *, int); 294 void changeEventDisplay(Event *, int);
289 295
290 void defaultItemAction(QListViewItem *item); 296 void defaultItemAction(Q3ListViewItem *item);
291 void popupMenu(QListViewItem *item,const QPoint &,int); 297 void popupMenu(Q3ListViewItem *item,const QPoint &,int);
292 void setCalendar( int c ); 298 void setCalendar( int c );
293 void populateCalPopup(); 299 void populateCalPopup();
294 300
295 protected slots: 301 protected slots:
296 void processSelectionChange(QListViewItem *); 302 void processSelectionChange(Q3ListViewItem *);
297 void catChanged( Incidence* ); 303 void catChanged( Incidence* );
298 304
299 protected: 305 protected:
300 void writeToFile( bool iCal ); 306 void writeToFile( bool iCal );
301 void addEvents(QPtrList<Event> eventList); 307 void addEvents(Q3PtrList<Event> eventList);
302 void addIncidence(Incidence *); 308 void addIncidence(Incidence *);
303 KOListViewItem *getItemForEvent(Incidence *event); 309 KOListViewItem *getItemForEvent(Incidence *event);
304 310
305 private: 311 private:
306 bool mForceShowCompletedTodos; 312 bool mForceShowCompletedTodos;
307 QPopupMenu* mCalPopup; 313 Q3PopupMenu* mCalPopup;
308 KOListViewWhatsThis *mKOListViewWhatsThis; 314 KOListViewWhatsThis *mKOListViewWhatsThis;
309 KOListViewListView *mListView; 315 KOListViewListView *mListView;
310 KOEventPopupMenu *mPopupMenu; 316 KOEventPopupMenu *mPopupMenu;
311 KOListViewItem *mActiveItem; 317 KOListViewItem *mActiveItem;
312 QDict<Incidence> mUidDict; 318 Q3Dict<Incidence> mUidDict;
313 QDate mStartDate; 319 QDate mStartDate;
314 void keyPressEvent ( QKeyEvent * ) ; 320 void keyPressEvent ( QKeyEvent * ) ;
315}; 321};
316 322
317#endif 323#endif
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 85e9166..ca55c43 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -4,300 +4,312 @@
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qpopupmenu.h> 20#include <q3popupmenu.h>
21#include <qfont.h> 21#include <qfont.h>
22#include <qfontmetrics.h> 22#include <qfontmetrics.h>
23#include <qkeycode.h> 23#include <qnamespace.h>
24#include <qhbox.h> 24#include <q3hbox.h>
25#include <qvbox.h> 25#include <q3vbox.h>
26#include <qwidgetstack.h> 26#include <q3widgetstack.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
28#include <qtooltip.h> 28#include <qtooltip.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qwhatsthis.h> 31#include <q3whatsthis.h>
32#ifndef DESKTOP_VERSION 32#ifndef DESKTOP_VERSION
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#else 34#else
35#include <qapplication.h> 35#include <qapplication.h>
36#include <QDesktopWidget>
37//Added by qt3to4:
38#include <QResizeEvent>
39#include <QLabel>
40#include <QPixmap>
41#include <QFocusEvent>
42#include <QMouseEvent>
43#include <QKeyEvent>
44#include <Q3VBoxLayout>
45#include <Q3Frame>
46#include <Q3PointArray>
47#include <Q3PtrList>
36#endif 48#endif
37 49
38#include <kdebug.h> 50#include <kdebug.h>
39#include <klocale.h> 51#include <klocale.h>
40#include <kglobal.h> 52#include <kglobal.h>
41#include <kconfig.h> 53#include <kconfig.h>
42#include <kiconloader.h> 54#include <kiconloader.h>
43 55
44#include <kcalendarsystem.h> 56#include <kcalendarsystem.h>
45 57
46#ifndef KORG_NOPRINTER 58#ifndef KORG_NOPRINTER
47#include "calprinter.h" 59#include "calprinter.h"
48#endif 60#endif
49#include "koprefs.h" 61#include "koprefs.h"
50#ifndef KORG_NOPLUGINS 62#ifndef KORG_NOPLUGINS
51#include "kocore.h" 63#include "kocore.h"
52#endif 64#endif
53#include "koglobals.h" 65#include "koglobals.h"
54#include <libkcal/kincidenceformatter.h> 66#include <libkcal/kincidenceformatter.h>
55 67
56#include "komonthview.h" 68#include "komonthview.h"
57 69
58#define PIXMAP_SIZE 5 70#define PIXMAP_SIZE 5
59#ifdef DESKTOP_VERSION 71#ifdef DESKTOP_VERSION
60QToolTipGroup *MonthViewCell::mToolTipGroup = 0; 72QToolTipGroup *MonthViewCell::mToolTipGroup = 0;
61#endif 73#endif
62class KNOWhatsThis :public QWhatsThis 74class KNOWhatsThis :public Q3WhatsThis
63{ 75{
64public: 76public:
65 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; 77 KNOWhatsThis( KNoScrollListBox* sbox ) : Q3WhatsThis( sbox ), _wid( sbox) { };
66 //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; 78 //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); };
67 79
68protected: 80protected:
69 virtual QString text( const QPoint& p) 81 virtual QString text( const QPoint& p)
70 { 82 {
71 return _wid->getWhatsThisText(p) ; 83 return _wid->getWhatsThisText(p) ;
72 }; 84 };
73private: 85private:
74 KNoScrollListBox* _wid; 86 KNoScrollListBox* _wid;
75 87
76}; 88};
77 89
78 90
79KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) 91KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
80 : QListBox(parent, name, WRepaintNoErase) 92 : Q3ListBox(parent, name, Qt::WNoAutoErase)
81{ 93{
82#ifndef DESKTOP_VERSION 94#ifndef DESKTOP_VERSION
83 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 95 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
84#endif 96#endif
85 mBlockDeselect = false; 97 mBlockDeselect = false;
86 mWT = new KNOWhatsThis(this); 98 mWT = new KNOWhatsThis(this);
87 resetOnFocusIn = true; 99 resetOnFocusIn = true;
88 setVScrollBarMode(QScrollView::AlwaysOff); 100 setVScrollBarMode(Q3ScrollView::AlwaysOff);
89 setHScrollBarMode(QScrollView::AlwaysOff); 101 setHScrollBarMode(Q3ScrollView::AlwaysOff);
90} 102}
91KNoScrollListBox::~KNoScrollListBox() 103KNoScrollListBox::~KNoScrollListBox()
92{ 104{
93#if QT_VERSION >= 0x030000 105#if QT_VERSION >= 0x030000
94 106
95#else 107#else
96 delete mWT; 108 delete mWT;
97#endif 109#endif
98} 110}
99 111
100 112
101void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) 113void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
102{ 114{
103 QListBox::focusInEvent ( e ); 115 Q3ListBox::focusInEvent ( e );
104 if ( count() ){ 116 if ( count() ){
105 int ci = currentItem(); 117 int ci = currentItem();
106 if ( ci < 0 ) ci = 0; 118 if ( ci < 0 ) ci = 0;
107 119
108 setCurrentItem( ci ); 120 setCurrentItem( ci );
109 setSelected ( ci, true ); 121 setSelected ( ci, true );
110 emit highlighted( item ( ci ) ); 122 emit highlighted( item ( ci ) );
111 123
112 resetOnFocusIn = true; 124 resetOnFocusIn = true;
113 125
114 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { 126 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) {
115 QListBoxItem *fi = firstItem (); 127 Q3ListBoxItem *fi = firstItem ();
116 if (fi ) { 128 if (fi ) {
117 int ihei = fi->height( this ); 129 int ihei = fi->height( this );
118 int hei = numRows () * ihei; 130 int hei = numRows () * ihei;
119 if ( hei < height() - horizontalScrollBar()->height () ) { 131 if ( hei < height() - horizontalScrollBar()->height () ) {
120 setVScrollBarMode(QScrollView::AlwaysOff); 132 setVScrollBarMode(Q3ScrollView::AlwaysOff);
121 } 133 }
122 else 134 else
123 setVScrollBarMode(QScrollView::Auto); 135 setVScrollBarMode(Q3ScrollView::Auto);
124 if ( ihei *3 > height() ) { 136 if ( ihei *3 > height() ) {
125 setHScrollBarMode(QScrollView::AlwaysOff); 137 setHScrollBarMode(Q3ScrollView::AlwaysOff);
126 } 138 }
127 else { 139 else {
128 setHScrollBarMode(QScrollView::Auto); 140 setHScrollBarMode(Q3ScrollView::Auto);
129 } 141 }
130 } else { 142 } else {
131 setVScrollBarMode(QScrollView::Auto); 143 setVScrollBarMode(Q3ScrollView::Auto);
132 setHScrollBarMode(QScrollView::Auto); 144 setHScrollBarMode(Q3ScrollView::Auto);
133 } 145 }
134 } 146 }
135 } 147 }
136} 148}
137void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) 149void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
138{ 150{
139 if ( ! mBlockDeselect ) { 151 if ( ! mBlockDeselect ) {
140 int i = currentItem (); 152 int i = currentItem ();
141 if ( i >= 0 ) { 153 if ( i >= 0 ) {
142 setSelected ( i, false ); 154 setSelected ( i, false );
143 } 155 }
144 QListBox::focusOutEvent ( e ); 156 Q3ListBox::focusOutEvent ( e );
145 } 157 }
146 setVScrollBarMode(QScrollView::AlwaysOff); 158 setVScrollBarMode(Q3ScrollView::AlwaysOff);
147 setHScrollBarMode(QScrollView::AlwaysOff); 159 setHScrollBarMode(Q3ScrollView::AlwaysOff);
148 if ( ! mBlockDeselect ) 160 if ( ! mBlockDeselect )
149 emit highlightIncidence( 0, (MonthViewCell*)this, 0 ); 161 emit highlightIncidence( 0, (MonthViewCell*)this, 0 );
150 mBlockDeselect = false; 162 mBlockDeselect = false;
151} 163}
152 164
153QString KNoScrollListBox::getWhatsThisText(QPoint p) 165QString KNoScrollListBox::getWhatsThisText(QPoint p)
154{ 166{
155 QListBoxItem* item = itemAt ( p ); 167 Q3ListBoxItem* item = itemAt ( p );
156 if ( ! item ) { 168 if ( ! item ) {
157 return i18n("Click in the cell\nto add an event!"); 169 return i18n("Click in the cell\nto add an event!");
158 } 170 }
159 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), 171 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(),
160 KOPrefs::instance()->mWTshowDetails, 172 KOPrefs::instance()->mWTshowDetails,
161 KOPrefs::instance()->mWTshowCreated, 173 KOPrefs::instance()->mWTshowCreated,
162 KOPrefs::instance()->mWTshowChanged); 174 KOPrefs::instance()->mWTshowChanged);
163} 175}
164void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 176void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
165{ 177{
166 //qDebug("KNoScrollListBox::keyPressEvent "); 178 //qDebug("KNoScrollListBox::keyPressEvent ");
167 switch(e->key()) { 179 switch(e->key()) {
168 case Key_Right: 180 case Qt::Key_Right:
169 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 181 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
170 { 182 {
171 e->ignore(); 183 e->ignore();
172 return; 184 return;
173 } 185 }
174 scrollBy(10,0); 186 scrollBy(10,0);
175 break; 187 break;
176 case Key_Left: 188 case Qt::Key_Left:
177 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 189 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
178 { 190 {
179 e->ignore(); 191 e->ignore();
180 return; 192 return;
181 } 193 }
182 scrollBy(-10,0); 194 scrollBy(-10,0);
183 break; 195 break;
184 case Key_Up: 196 case Qt::Key_Up:
185 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 197 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
186 e->ignore(); 198 e->ignore();
187 break; 199 break;
188 } 200 }
189 if ( count() ) { 201 if ( count() ) {
190 if ( currentItem() == 0 ) { 202 if ( currentItem() == 0 ) {
191 emit prevCell(); 203 emit prevCell();
192 } else { 204 } else {
193 setCurrentItem((currentItem()+count()-1)%count()); 205 setCurrentItem((currentItem()+count()-1)%count());
194 if(!itemVisible(currentItem())) { 206 if(!itemVisible(currentItem())) {
195 if((unsigned int) currentItem() == (count()-1)) { 207 if((unsigned int) currentItem() == (count()-1)) {
196 setTopItem(currentItem()-numItemsVisible()+1); 208 setTopItem(currentItem()-numItemsVisible()+1);
197 } else { 209 } else {
198 setTopItem(topItem()-1); 210 setTopItem(topItem()-1);
199 } 211 }
200 } 212 }
201 } 213 }
202 } 214 }
203 break; 215 break;
204 case Key_Down: 216 case Qt::Key_Down:
205 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 217 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
206 e->ignore(); 218 e->ignore();
207 break; 219 break;
208 } 220 }
209 if ( count () ) { 221 if ( count () ) {
210 if ( ((uint)currentItem()+1) == count () ) { 222 if ( ((uint)currentItem()+1) == count () ) {
211 emit nextCell(); 223 emit nextCell();
212 } else { 224 } else {
213 setCurrentItem((currentItem()+1)%count()); 225 setCurrentItem((currentItem()+1)%count());
214 if(!itemVisible(currentItem())) { 226 if(!itemVisible(currentItem())) {
215 if(currentItem() == 0) { 227 if(currentItem() == 0) {
216 setTopItem(0); 228 setTopItem(0);
217 } else { 229 } else {
218 setTopItem(topItem()+1); 230 setTopItem(topItem()+1);
219 } 231 }
220 } 232 }
221 } 233 }
222 } 234 }
223 break; 235 break;
224 case Key_I: 236 case Qt::Key_I:
225 QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); 237 QTimer::singleShot( 1, this, SLOT ( oneDown() ) );
226 e->ignore(); 238 e->ignore();
227 break; 239 break;
228 case Key_Return: 240 case Qt::Key_Return:
229 case Key_Enter: 241 case Qt::Key_Enter:
230 { 242 {
231 if ( currentItem() >= 0 ) { 243 if ( currentItem() >= 0 ) {
232 emit doubleClicked( item( currentItem() ) ); 244 emit doubleClicked( item( currentItem() ) );
233 e->accept(); 245 e->accept();
234 } else { 246 } else {
235 e->ignore(); 247 e->ignore();
236 } 248 }
237 } 249 }
238 break; 250 break;
239 case Key_Shift: 251 case Qt::Key_Shift:
240 emit shiftDown(); 252 emit shiftDown();
241 break; 253 break;
242 default: 254 default:
243 e->ignore(); 255 e->ignore();
244 break; 256 break;
245 } 257 }
246} 258}
247 259
248void KNoScrollListBox::oneDown() 260void KNoScrollListBox::oneDown()
249{ 261{
250 if ( count () ) { 262 if ( count () ) {
251 if ( ((uint)currentItem()+1) == count () ) { 263 if ( ((uint)currentItem()+1) == count () ) {
252 emit nextCell(); 264 emit nextCell();
253 } else { 265 } else {
254 resetOnFocusIn = false; 266 resetOnFocusIn = false;
255 setCurrentItem((currentItem()+1)%count()); 267 setCurrentItem((currentItem()+1)%count());
256 if(!itemVisible(currentItem())) { 268 if(!itemVisible(currentItem())) {
257 if(currentItem() == 0) { 269 if(currentItem() == 0) {
258 setTopItem(0); 270 setTopItem(0);
259 } else { 271 } else {
260 setTopItem(topItem()+1); 272 setTopItem(topItem()+1);
261 } 273 }
262 } 274 }
263 } 275 }
264 } 276 }
265} 277}
266void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 278void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
267{ 279{
268 switch(e->key()) { 280 switch(e->key()) {
269 case Key_Shift: 281 case Qt::Key_Shift:
270 emit shiftUp(); 282 emit shiftUp();
271 break; 283 break;
272 default: 284 default:
273 break; 285 break;
274 } 286 }
275} 287}
276 288
277void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 289void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
278{ 290{
279 QListBox::mousePressEvent(e); 291 Q3ListBox::mousePressEvent(e);
280 292
281 if(e->button() == RightButton) { 293 if(e->button() == Qt::RightButton) {
282 emit rightClick(); 294 emit rightClick();
283 } 295 }
284} 296}
285 297
286MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s) 298MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s)
287 : QListBoxItem() 299 : Q3ListBoxItem()
288{ 300{
289 mblockRepaint = true; 301 mblockRepaint = true;
290 isWeekItem = KOPrefs::instance()->mMonthViewWeek; 302 isWeekItem = KOPrefs::instance()->mMonthViewWeek;
291 recycle( incidence, s ); 303 recycle( incidence, s );
292} 304}
293void MonthViewItem::recycle( Incidence *incidence, const QString & s) 305void MonthViewItem::recycle( Incidence *incidence, const QString & s)
294{ 306{
295 mDisplayHighlighted = false; 307 mDisplayHighlighted = false;
296 setText( s ); 308 setText( s );
297 mMultiday = 0; 309 mMultiday = 0;
298 mIncidence = incidence; 310 mIncidence = incidence;
299 mRecur = false; 311 mRecur = false;
300 mAlarm = false; 312 mAlarm = false;
301 mReply = false; 313 mReply = false;
302 mInfo = false; 314 mInfo = false;
303 mdayPos = 0; 315 mdayPos = 0;
@@ -382,40 +394,40 @@ void MonthViewItem::paint(QPainter *p)
382 if ( sel ) p->setPen( Qt::white ); 394 if ( sel ) p->setPen( Qt::white );
383 else p->setPen( palette().color( QPalette::Normal,QColorGroup::Foreground ) ); 395 else p->setPen( palette().color( QPalette::Normal,QColorGroup::Foreground ) );
384 396
385#if 0 397#if 0
386 p->setPen( palette().color( QPalette::Normal, sel ? \ 398 p->setPen( palette().color( QPalette::Normal, sel ? \
387 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 399 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
388#endif 400#endif
389 QColor textColor = p->pen().color(); 401 QColor textColor = p->pen().color();
390 402
391 403
392 if ( mMultiday ) { 404 if ( mMultiday ) {
393 int yyy = y+(size/2); 405 int yyy = y+(size/2);
394 int sizeM = size+2; 406 int sizeM = size+2;
395 p->setBrush( QBrush( textColor ) ); 407 p->setBrush( QBrush( textColor ) );
396 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; 408 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ;
397 if ( mMultiday == 2 || mMultiday == 3 ) { 409 if ( mMultiday == 2 || mMultiday == 3 ) {
398 QPointArray pa ( 3 ); 410 Q3PointArray pa ( 3 );
399 pa.setPoint (0, x, yyy ); 411 pa.setPoint (0, x, yyy );
400 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); 412 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 );
401 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); 413 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 );
402 p->drawPolygon( pa ); 414 p->drawPolygon( pa );
403 } 415 }
404 if ( mMultiday == 2 || mMultiday == 1 ) { 416 if ( mMultiday == 2 || mMultiday == 1 ) {
405 QPointArray pa ( 3 ); 417 Q3PointArray pa ( 3 );
406 pa.setPoint (0, x+sizeM +sizeM/2, yyy ); 418 pa.setPoint (0, x+sizeM +sizeM/2, yyy );
407 pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); 419 pa.setPoint (1, x+sizeM, yyy+sizeM/2 );
408 pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); 420 pa.setPoint (2, x+sizeM, yyy-sizeM/2 );
409 p->drawPolygon( pa ); 421 p->drawPolygon( pa );
410 } 422 }
411 if ( mMultiday == 1 ) { 423 if ( mMultiday == 1 ) {
412 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 424 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
413 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); 425 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 );
414 } 426 }
415 if ( mMultiday == 3 ) { 427 if ( mMultiday == 3 ) {
416 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 428 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
417 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); 429 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 );
418 430
419 } 431 }
420 x += sizeM/2 + 1; 432 x += sizeM/2 + 1;
421 x += sizeM + 1; 433 x += sizeM + 1;
@@ -449,41 +461,41 @@ void MonthViewItem::paint(QPainter *p)
449 if ( mIncidence->cancelled() ) { 461 if ( mIncidence->cancelled() ) {
450 int wid = fm.width( text() ); 462 int wid = fm.width( text() );
451 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 463 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
452 } 464 }
453 } else { 465 } else {
454 QString pText = text(); 466 QString pText = text();
455 if( pText.mid(2,1) == ":" ) 467 if( pText.mid(2,1) == ":" )
456 pText = pText.mid( 6 ); 468 pText = pText.mid( 6 );
457 p->drawText( x, yPos, pText ); 469 p->drawText( x, yPos, pText );
458 if ( mIncidence->cancelled() ) { 470 if ( mIncidence->cancelled() ) {
459 int wid = fm.width( pText ); 471 int wid = fm.width( pText );
460 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 472 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
461 } 473 }
462 } 474 }
463} 475}
464 476
465int MonthViewItem::height(const QListBox *lb) const 477int MonthViewItem::height(const Q3ListBox *lb) const
466{ 478{
467 int ret = 10; 479 int ret = 10;
468 if ( lb ) 480 if ( lb )
469 ret = lb->fontMetrics().lineSpacing()+1; 481 ret = lb->fontMetrics().lineSpacing()+1;
470 return ret; 482 return ret;
471} 483}
472 484
473int MonthViewItem::width(const QListBox *lb) const 485int MonthViewItem::width(const Q3ListBox *lb) const
474{ 486{
475 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { 487 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) {
476 int size = PIXMAP_SIZE; 488 int size = PIXMAP_SIZE;
477 if ( QApplication::desktop()->width() < 300 ) 489 if ( QApplication::desktop()->width() < 300 )
478 size = 3; 490 size = 3;
479 int x = 1; 491 int x = 1;
480 if ( KOPrefs::instance()->mMonthShowIcons ) { 492 if ( KOPrefs::instance()->mMonthShowIcons ) {
481 if ( mInfo ) { 493 if ( mInfo ) {
482 x += size + 1; 494 x += size + 1;
483 } 495 }
484 if( mRecur ) { 496 if( mRecur ) {
485 x += size+1; 497 x += size+1;
486 } 498 }
487 if( mAlarm ) { 499 if( mAlarm ) {
488 x += size+1; 500 x += size+1;
489 } 501 }
@@ -501,64 +513,64 @@ int MonthViewItem::width(const QListBox *lb) const
501 return lb->width(); 513 return lb->width();
502} 514}
503 515
504 516
505MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) 517MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
506 : KNoScrollListBox( par ), 518 : KNoScrollListBox( par ),
507 mMonthView( parent ) 519 mMonthView( parent )
508{ 520{
509 //QVBoxLayout *topLayout = new QVBoxLayout( this ); 521 //QVBoxLayout *topLayout = new QVBoxLayout( this );
510 currentPalette = 0; 522 currentPalette = 0;
511 // mLabel = new QLabel( this );QPushButton 523 // mLabel = new QLabel( this );QPushButton
512 mLabel = new QPushButton( this ); 524 mLabel = new QPushButton( this );
513 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); 525 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain );
514 //mLabel->setLineWidth( 1 ); 526 //mLabel->setLineWidth( 1 );
515 //mLabel->setAlignment( AlignCenter ); 527 //mLabel->setAlignment( AlignCenter );
516 mLabel->setFlat( true ); 528 mLabel->setFlat( true );
517 mLabel->setFocusPolicy(NoFocus); 529 mLabel->setFocusPolicy(Qt::NoFocus);
518 //mItemList = new KNoScrollListBox( this ); 530 //mItemList = new KNoScrollListBox( this );
519 setMinimumSize( 10, 10 ); 531 setMinimumSize( 10, 10 );
520 setFrameStyle( QFrame::Panel | QFrame::Plain ); 532 setFrameStyle( Q3Frame::Panel | Q3Frame::Plain );
521 setLineWidth( 1 ); 533 setLineWidth( 1 );
522 //topLayout->addWidget( mItemList ); 534 //topLayout->addWidget( mItemList );
523 mLabel->raise(); 535 mLabel->raise();
524 // QColor( 0,0,255 ) QColor( 160,1600,255 ) 536 // QColor( 0,0,255 ) QColor( 160,1600,255 )
525 mStandardPalette = palette(); 537 mStandardPalette = palette();
526 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); 538 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) );
527 539
528 enableScrollBars( false ); 540 enableScrollBars( false );
529 updateConfig(); 541 updateConfig();
530 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); 542 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() ));
531 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); 543 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() ));
532 connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), 544 connect( this , SIGNAL( doubleClicked( Q3ListBoxItem *) ),
533 SLOT( defaultAction( QListBoxItem * ) ) ); 545 SLOT( defaultAction( Q3ListBoxItem * ) ) );
534 connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, 546 connect( this, SIGNAL( rightButtonPressed( Q3ListBoxItem *,
535 const QPoint &) ), 547 const QPoint &) ),
536 SLOT( contextMenu( QListBoxItem * ) ) ); 548 SLOT( contextMenu( Q3ListBoxItem * ) ) );
537 connect( this, SIGNAL( highlighted( QListBoxItem *) ), 549 connect( this, SIGNAL( highlighted( Q3ListBoxItem *) ),
538 SLOT( selection( QListBoxItem * ) ) ); 550 SLOT( selection( Q3ListBoxItem * ) ) );
539 551
540 /* 552 /*
541 connect( this, SIGNAL( clicked( QListBoxItem * ) ), 553 connect( this, SIGNAL( clicked( QListBoxItem * ) ),
542 SLOT( selection( QListBoxItem * ) ) ); 554 SLOT( selection( QListBoxItem * ) ) );
543 */ 555 */
544} 556}
545#ifdef DESKTOP_VERSION 557#ifdef DESKTOP_VERSION
546QToolTipGroup *MonthViewCell::toolTipGroup() 558QToolTipGroup *MonthViewCell::toolTipGroup()
547{ 559{
548 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 560 /* TODO:hacker: if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); */
549 return mToolTipGroup; 561 return mToolTipGroup;
550} 562}
551#endif 563#endif
552 564
553void MonthViewCell::setDate( const QDate &date ) 565void MonthViewCell::setDate( const QDate &date )
554{ 566{
555 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; 567 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl;
556 mDate = date; 568 mDate = date;
557 569
558 570
559 571
560 //resizeEvent( 0 ); 572 //resizeEvent( 0 );
561} 573}
562 574
563QDate MonthViewCell::date() const 575QDate MonthViewCell::date() const
564{ 576{
@@ -624,33 +636,33 @@ void MonthViewCell::setHoliday( bool holiday )
624 //setMyPalette(); 636 //setMyPalette();
625} 637}
626 638
627void MonthViewCell::setHoliday( const QString &holiday ) 639void MonthViewCell::setHoliday( const QString &holiday )
628{ 640{
629 mHolidayString = holiday; 641 mHolidayString = holiday;
630 642
631 if ( !holiday.isEmpty() ) { 643 if ( !holiday.isEmpty() ) {
632 setHoliday( true ); 644 setHoliday( true );
633 } 645 }
634} 646}
635 647
636void MonthViewCell::startUpdateCell() 648void MonthViewCell::startUpdateCell()
637{ 649{
638 blockSignals( true ); 650 blockSignals( true );
639 mdayCount = 0; 651 mdayCount = 0;
640 setFocusPolicy(NoFocus); 652 setFocusPolicy(Qt::NoFocus);
641 if ( !mMonthView->isUpdatePossible() ) 653 if ( !mMonthView->isUpdatePossible() )
642 return; 654 return;
643 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 655 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
644 while ( mitem ) { 656 while ( mitem ) {
645 mitem->setBlockRepaint( true ); 657 mitem->setBlockRepaint( true );
646 mitem = (MonthViewItem *)mitem->next(); 658 mitem = (MonthViewItem *)mitem->next();
647 } 659 }
648 if ( mAvailItemList.count() > 20 ) { 660 if ( mAvailItemList.count() > 20 ) {
649 mAvailItemList.setAutoDelete( true ); 661 mAvailItemList.setAutoDelete( true );
650 mAvailItemList.clear(); 662 mAvailItemList.clear();
651 mAvailItemList.setAutoDelete( false ); 663 mAvailItemList.setAutoDelete( false );
652 clear(); 664 clear();
653 } 665 }
654 666
655 setPrimary( mDate.month()%2 ); 667 setPrimary( mDate.month()%2 );
656 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); 668 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays);
@@ -679,33 +691,33 @@ void MonthViewCell::startUpdateCell()
679 if ( !mHolidayString.isEmpty() ) { 691 if ( !mHolidayString.isEmpty() ) {
680 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); 692 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
681 item->setPalette( mHolidayPalette ); 693 item->setPalette( mHolidayPalette );
682 insertItem( item ); 694 insertItem( item );
683 mToolTip.append ( mHolidayString ); 695 mToolTip.append ( mHolidayString );
684 } 696 }
685#endif 697#endif
686} 698}
687 699
688int MonthViewCell::insertEvent(Event *event) 700int MonthViewCell::insertEvent(Event *event)
689{ 701{
690 bool useToolTips = true; 702 bool useToolTips = true;
691#ifndef DESKTOP_VERSION 703#ifndef DESKTOP_VERSION
692 useToolTips = false; 704 useToolTips = false;
693#endif 705#endif
694 QString mToolTipText; 706 QString mToolTipText;
695 setFocusPolicy(WheelFocus); 707 setFocusPolicy(Qt::WheelFocus);
696 if ( !(event->doesRecur() == Recurrence::rNone) ) { 708 if ( !(event->doesRecur() == Recurrence::rNone) ) {
697 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) 709 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
698 return mdayCount; 710 return mdayCount;
699 else 711 else
700 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) 712 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
701 return mdayCount; 713 return mdayCount;
702 } 714 }
703 715
704 if ( event->isHoliday()) { 716 if ( event->isHoliday()) {
705 setHoliday( true ); 717 setHoliday( true );
706 if ( mDate.dayOfWeek() == 7 ) 718 if ( mDate.dayOfWeek() == 7 )
707 setLineWidth( 3 ); 719 setLineWidth( 3 );
708 } 720 }
709 QString text; 721 QString text;
710 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 722 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
711 if (event->isMultiDay()) { 723 if (event->isMultiDay()) {
@@ -821,49 +833,49 @@ int MonthViewCell::insertEvent(Event *event)
821#endif 833#endif
822 834
823 item->setMultiDay( multiday ); 835 item->setMultiDay( multiday );
824 if ( multiday ) { 836 if ( multiday ) {
825 insertItem( item ,mdayCount); 837 insertItem( item ,mdayCount);
826 ++mdayCount; 838 ++mdayCount;
827 } else { 839 } else {
828 uint i = mdayCount; 840 uint i = mdayCount;
829 uint pos = mdayCount; 841 uint pos = mdayCount;
830 uint itcount = count(); 842 uint itcount = count();
831 if ( itcount > 1000 ) { 843 if ( itcount > 1000 ) {
832 qDebug("KO: Bug in MonthViewCell::insertEvent %u ", itcount); 844 qDebug("KO: Bug in MonthViewCell::insertEvent %u ", itcount);
833 itcount = 0; 845 itcount = 0;
834 } 846 }
835 for ( i = pos; i < itcount;++i ) { 847 for ( i = pos; i < itcount;++i ) {
836 // qDebug("i %d mday %u count %d ",i,itcount,mdayCount ); 848 // qDebug("i %d mday %u count %d ",i,itcount,mdayCount );
837 QListBoxItem* it = this->item ( i ); 849 Q3ListBoxItem* it = this->item ( i );
838 if ( it && text < it->text() ) { 850 if ( it && text < it->text() ) {
839 pos = i; 851 pos = i;
840 break; 852 break;
841 } 853 }
842 ++pos; 854 ++pos;
843 } 855 }
844 insertItem( item ,pos); 856 insertItem( item ,pos);
845 } 857 }
846 if ( useToolTips ) { 858 if ( useToolTips ) {
847 mToolTip.append( mToolTipText ); 859 mToolTip.append( mToolTipText );
848 } 860 }
849 return mdayCount; 861 return mdayCount;
850} 862}
851void MonthViewCell::insertTodo(Todo *todo) 863void MonthViewCell::insertTodo(Todo *todo)
852{ 864{
853 setFocusPolicy(WheelFocus); 865 setFocusPolicy(Qt::WheelFocus);
854 QString text; 866 QString text;
855 if (todo->hasDueDate()) { 867 if (todo->hasDueDate()) {
856 if (!todo->doesFloat()) { 868 if (!todo->doesFloat()) {
857 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 869 text += KGlobal::locale()->formatTime(todo->dtDue().time());
858 text += " "; 870 text += " ";
859 } 871 }
860 } 872 }
861 text += todo->summary(); 873 text += todo->summary();
862 MonthViewItem *item ; 874 MonthViewItem *item ;
863 if ( mAvailItemList.count() ) { 875 if ( mAvailItemList.count() ) {
864 item = mAvailItemList.first(); 876 item = mAvailItemList.first();
865 mAvailItemList.remove( item ); 877 mAvailItemList.remove( item );
866 item->recycle( todo, text ); 878 item->recycle( todo, text );
867 } else { 879 } else {
868 item = new MonthViewItem( todo, text ); 880 item = new MonthViewItem( todo, text );
869 } 881 }
@@ -909,55 +921,55 @@ void MonthViewCell::repaintfinishUpdateCell()
909 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 921 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
910 while ( mitem ) { 922 while ( mitem ) {
911 mitem->setBlockRepaint( false ); 923 mitem->setBlockRepaint( false );
912 updateItem ( mitem ); 924 updateItem ( mitem );
913 mitem = (MonthViewItem *)mitem->next(); 925 mitem = (MonthViewItem *)mitem->next();
914 } 926 }
915 blockSignals( false ); 927 blockSignals( false );
916} 928}
917void MonthViewCell::finishUpdateCell() 929void MonthViewCell::finishUpdateCell()
918{ 930{
919 931
920 932
921 933
922#ifdef DESKTOP_VERSION 934#ifdef DESKTOP_VERSION
923 if (mToolTip.count() > 0 ) { 935 if (mToolTip.count() > 0 ) {
924 mToolTip.sort(); 936 mToolTip.sort();
925 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); 937 /* TODO: hacker: QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); */
926 } 938 }
927#endif 939#endif
928 //sort(); 940 //sort();
929 //setMyPalette(); 941 //setMyPalette();
930 setMyPalette(); 942 setMyPalette();
931 943
932 resizeEvent( 0 ); 944 resizeEvent( 0 );
933 945
934} 946}
935void MonthViewCell::updateCell() 947void MonthViewCell::updateCell()
936{ 948{
937 if ( !mMonthView->isUpdatePossible() ) 949 if ( !mMonthView->isUpdatePossible() )
938 return; 950 return;
939 startUpdateCell(); 951 startUpdateCell();
940 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 952 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
941 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 953 Q3PtrList<Event> events = mMonthView->calendar()->events( mDate, true );
942 Event *event; 954 Event *event;
943 for( event = events.first(); event; event = events.next() ) { // for event 955 for( event = events.first(); event; event = events.next() ) { // for event
944 insertEvent(event); 956 insertEvent(event);
945 } 957 }
946 // insert due todos 958 // insert due todos
947 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 959 Q3PtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
948 Todo *todo; 960 Todo *todo;
949 for(todo = todos.first(); todo; todo = todos.next()) { 961 for(todo = todos.first(); todo; todo = todos.next()) {
950 insertTodo( todo ); 962 insertTodo( todo );
951 } 963 }
952 finishUpdateCell(); 964 finishUpdateCell();
953 // if ( isVisible()) 965 // if ( isVisible())
954 //qApp->processEvents(); 966 //qApp->processEvents();
955} 967}
956 968
957void MonthViewCell::updateConfig( bool bigFont ) // = false 969void MonthViewCell::updateConfig( bool bigFont ) // = false
958{ 970{
959 971
960 if ( bigFont ) { 972 if ( bigFont ) {
961 QFont fo = KOPrefs::instance()->mMonthViewFont; 973 QFont fo = KOPrefs::instance()->mMonthViewFont;
962 int ps = fo.pointSize() + 2; 974 int ps = fo.pointSize() + 2;
963 if ( ps < 18 ) 975 if ( ps < 18 )
@@ -979,54 +991,54 @@ void MonthViewCell::updateConfig( bool bigFont ) // = false
979 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); 991 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark());
980 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); 992 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark());
981 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); 993 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor);
982 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); 994 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor);
983 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); 995 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark());
984 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); 996 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor);
985 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); 997 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor);
986 } 998 }
987 //updateCell(); 999 //updateCell();
988} 1000}
989 1001
990void MonthViewCell::enableScrollBars( bool enabled ) 1002void MonthViewCell::enableScrollBars( bool enabled )
991{ 1003{
992 1004
993 return; 1005 return;
994 if ( enabled ) { 1006 if ( enabled ) {
995 QListBoxItem *fi = firstItem (); 1007 Q3ListBoxItem *fi = firstItem ();
996 if (fi ) { 1008 if (fi ) {
997 int ihei = fi->height( this ); 1009 int ihei = fi->height( this );
998 int hei = numRows () * ihei; 1010 int hei = numRows () * ihei;
999 if ( hei < height() - horizontalScrollBar()->height () ) { 1011 if ( hei < height() - horizontalScrollBar()->height () ) {
1000 setVScrollBarMode(QScrollView::AlwaysOff); 1012 setVScrollBarMode(Q3ScrollView::AlwaysOff);
1001 } 1013 }
1002 else 1014 else
1003 setVScrollBarMode(QScrollView::Auto); 1015 setVScrollBarMode(Q3ScrollView::Auto);
1004 if ( ihei *3 > height() ) { 1016 if ( ihei *3 > height() ) {
1005 setHScrollBarMode(QScrollView::AlwaysOff); 1017 setHScrollBarMode(Q3ScrollView::AlwaysOff);
1006 } 1018 }
1007 else { 1019 else {
1008 setHScrollBarMode(QScrollView::Auto); 1020 setHScrollBarMode(Q3ScrollView::Auto);
1009 } 1021 }
1010 } else { 1022 } else {
1011 setVScrollBarMode(QScrollView::Auto); 1023 setVScrollBarMode(Q3ScrollView::Auto);
1012 setHScrollBarMode(QScrollView::Auto); 1024 setHScrollBarMode(Q3ScrollView::Auto);
1013 } 1025 }
1014 } else { 1026 } else {
1015 setVScrollBarMode(QScrollView::AlwaysOff); 1027 setVScrollBarMode(Q3ScrollView::AlwaysOff);
1016 setHScrollBarMode(QScrollView::AlwaysOff); 1028 setHScrollBarMode(Q3ScrollView::AlwaysOff);
1017 } 1029 }
1018} 1030}
1019 1031
1020Incidence *MonthViewCell::selectedIncidence() 1032Incidence *MonthViewCell::selectedIncidence()
1021{ 1033{
1022 int index = currentItem(); 1034 int index = currentItem();
1023 if ( index < 0 ) return 0; 1035 if ( index < 0 ) return 0;
1024 1036
1025 MonthViewItem *mitem = 1037 MonthViewItem *mitem =
1026 static_cast<MonthViewItem *>( item( index ) ); 1038 static_cast<MonthViewItem *>( item( index ) );
1027 1039
1028 if ( !mitem ) return 0; 1040 if ( !mitem ) return 0;
1029 1041
1030 return mitem->incidence(); 1042 return mitem->incidence();
1031} 1043}
1032 1044
@@ -1070,83 +1082,83 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e )
1070 mLabel->setText( text ); 1082 mLabel->setText( text );
1071 1083
1072 int size = height() - mLabel->height() - lineWidth()-1; 1084 int size = height() - mLabel->height() - lineWidth()-1;
1073 //qDebug("LW %d ", lineWidth()); 1085 //qDebug("LW %d ", lineWidth());
1074 if ( size > 0 ) 1086 if ( size > 0 )
1075 verticalScrollBar()->setMaximumHeight( size ); 1087 verticalScrollBar()->setMaximumHeight( size );
1076 size = width() - mLabel->width() -lineWidth()-1; 1088 size = width() - mLabel->width() -lineWidth()-1;
1077 if ( size > 0 ) 1089 if ( size > 0 )
1078 horizontalScrollBar()->setMaximumWidth( size ); 1090 horizontalScrollBar()->setMaximumWidth( size );
1079 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); 1091 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() );
1080 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 1092 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
1081 // mItemList->resize ( width(), height () ); 1093 // mItemList->resize ( width(), height () );
1082 if ( e ) 1094 if ( e )
1083 KNoScrollListBox::resizeEvent ( e ); 1095 KNoScrollListBox::resizeEvent ( e );
1084} 1096}
1085 1097
1086void MonthViewCell::defaultAction( QListBoxItem *item ) 1098void MonthViewCell::defaultAction( Q3ListBoxItem *item )
1087{ 1099{
1088 1100
1089 if ( !item ) { 1101 if ( !item ) {
1090 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1102 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1091 emit newEventSignal( dt ); 1103 emit newEventSignal( dt );
1092 return; 1104 return;
1093 } 1105 }
1094 1106
1095 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1107 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1096 Incidence *incidence = eventItem->incidence(); 1108 Incidence *incidence = eventItem->incidence();
1097 if ( incidence ) mMonthView->defaultAction( incidence ); 1109 if ( incidence ) mMonthView->defaultAction( incidence );
1098} 1110}
1099void MonthViewCell::showDay() 1111void MonthViewCell::showDay()
1100{ 1112{
1101 emit showDaySignal( date() ); 1113 emit showDaySignal( date() );
1102} 1114}
1103void MonthViewCell::newEvent() 1115void MonthViewCell::newEvent()
1104{ 1116{
1105 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1117 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1106 emit newEventSignal( dt ); 1118 emit newEventSignal( dt );
1107} 1119}
1108void MonthViewCell::cellClicked( QListBoxItem *item ) 1120void MonthViewCell::cellClicked( Q3ListBoxItem *item )
1109{ 1121{
1110 mMonthView->setSelectedCell( this ); 1122 mMonthView->setSelectedCell( this );
1111 if ( item == 0 ) { 1123 if ( item == 0 ) {
1112 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1124 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1113 emit newEventSignal( dt ); 1125 emit newEventSignal( dt );
1114 return; 1126 return;
1115 } 1127 }
1116 1128
1117} 1129}
1118 1130
1119void MonthViewCell::contextMenu( QListBoxItem *item ) 1131void MonthViewCell::contextMenu( Q3ListBoxItem *item )
1120{ 1132{
1121 mMonthView->setPopupCell( this ); 1133 mMonthView->setPopupCell( this );
1122 if ( !item ) { 1134 if ( !item ) {
1123 mMonthView->showContextMenu( 0 ); 1135 mMonthView->showContextMenu( 0 );
1124 return; 1136 return;
1125 } 1137 }
1126 //selection( item ); 1138 //selection( item );
1127 //qApp->processEvents(); 1139 //qApp->processEvents();
1128 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1140 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1129 Incidence *incidence = eventItem->incidence(); 1141 Incidence *incidence = eventItem->incidence();
1130 if ( incidence ) { 1142 if ( incidence ) {
1131 mBlockDeselect = true; 1143 mBlockDeselect = true;
1132 mMonthView->showContextMenu( incidence ); 1144 mMonthView->showContextMenu( incidence );
1133 } 1145 }
1134} 1146}
1135 1147
1136void MonthViewCell::selection( QListBoxItem *item ) 1148void MonthViewCell::selection( Q3ListBoxItem *item )
1137{ 1149{
1138 if ( !item ) { 1150 if ( !item ) {
1139 emit highlightIncidence( 0 , this, 0 ); 1151 emit highlightIncidence( 0 , this, 0 );
1140 return; 1152 return;
1141 } 1153 }
1142 MonthViewItem * it = (static_cast<MonthViewItem *>( item )); 1154 MonthViewItem * it = (static_cast<MonthViewItem *>( item ));
1143 emit highlightIncidence( it->incidence(), this, it->multiDay() ); 1155 emit highlightIncidence( it->incidence(), this, it->multiDay() );
1144 mMonthView->setSelectedCell( this ); 1156 mMonthView->setSelectedCell( this );
1145} 1157}
1146 1158
1147void MonthViewCell::deHighLight() 1159void MonthViewCell::deHighLight()
1148{ 1160{
1149 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 1161 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
1150 while ( mitem ) { 1162 while ( mitem ) {
1151 if ( mitem->setHighlightedFalse() ) 1163 if ( mitem->setHighlightedFalse() )
1152 updateItem ( mitem ); 1164 updateItem ( mitem );
@@ -1172,107 +1184,107 @@ bool MonthViewCell::doHighLight( Incidence * inc )
1172// ******************************************************************************* 1184// *******************************************************************************
1173// ******************************************************************************* 1185// *******************************************************************************
1174 1186
1175 1187
1176KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 1188KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1177 : KOEventView( calendar, parent, name ), 1189 : KOEventView( calendar, parent, name ),
1178 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 1190 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
1179 mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 1191 mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
1180{ 1192{
1181 mFlagKeyPressed = false; 1193 mFlagKeyPressed = false;
1182 mShortDayLabelsM = false; 1194 mShortDayLabelsM = false;
1183 mShortDayLabelsW = false; 1195 mShortDayLabelsW = false;
1184 skipResize = false; 1196 skipResize = false;
1185 clPending = true; 1197 clPending = true;
1186 mPopupCell = 0; 1198 mPopupCell = 0;
1187 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 1199 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
1188 mWidStack = new QWidgetStack( this ); 1200 mWidStack = new Q3WidgetStack( this );
1189 QVBoxLayout* hb = new QVBoxLayout( this ); 1201 Q3VBoxLayout* hb = new Q3VBoxLayout( this );
1190 mMonthView = new QWidget( mWidStack ); 1202 mMonthView = new QWidget( mWidStack );
1191 mWeekView = new QWidget( mWidStack ); 1203 mWeekView = new QWidget( mWidStack );
1192#if QT_VERSION >= 0x030000 1204#if QT_VERSION >= 0x030000
1193 mWidStack->addWidget(mMonthView ); 1205 mWidStack->addWidget(mMonthView );
1194 mWidStack->addWidget(mWeekView ); 1206 mWidStack->addWidget(mWeekView );
1195#else 1207#else
1196 mWidStack->addWidget( mMonthView, 1 ); 1208 mWidStack->addWidget( mMonthView, 1 );
1197 mWidStack->addWidget( mWeekView , 1 ); 1209 mWidStack->addWidget( mWeekView , 1 );
1198#endif 1210#endif
1199 hb->addWidget( mNavigatorBar ); 1211 hb->addWidget( mNavigatorBar );
1200 hb->addWidget( mWidStack ); 1212 hb->addWidget( mWidStack );
1201 mShowWeekView = KOPrefs::instance()->mMonthViewWeek; 1213 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
1202 updatePossible = false; 1214 updatePossible = false;
1203 //updatePossible = true; 1215 //updatePossible = true;
1204 mCells.setAutoDelete( true ); 1216 mCells.setAutoDelete( true );
1205 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1217 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1206 mDayLabels.resize( mDaysPerWeek ); 1218 mDayLabels.resize( mDaysPerWeek );
1207 mDayLabelsW.resize( mDaysPerWeek ); 1219 mDayLabelsW.resize( mDaysPerWeek );
1208 QFont bfont = font(); 1220 QFont bfont = font();
1209 if ( QApplication::desktop()->width() < 650 ) { 1221 if ( QApplication::desktop()->width() < 650 ) {
1210 bfont.setPointSize( bfont.pointSize() - 2 ); 1222 bfont.setPointSize( bfont.pointSize() - 2 );
1211 } 1223 }
1212 bfont.setBold( true ); 1224 bfont.setBold( true );
1213 int i; 1225 int i;
1214 1226
1215 for( i = 0; i < mDaysPerWeek; i++ ) { 1227 for( i = 0; i < mDaysPerWeek; i++ ) {
1216 QLabel *label = new QLabel( mMonthView ); 1228 QLabel *label = new QLabel( mMonthView );
1217 label->setFont(bfont); 1229 label->setFont(bfont);
1218 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1230 label->setFrameStyle(Q3Frame::Panel|Q3Frame::Raised);
1219 label->setLineWidth(1); 1231 label->setLineWidth(1);
1220 label->setAlignment(AlignCenter); 1232 label->setAlignment(Qt::AlignCenter);
1221 mDayLabels.insert( i, label ); 1233 mDayLabels.insert( i, label );
1222 label = new QLabel( mWeekView ); 1234 label = new QLabel( mWeekView );
1223 label->setFont(bfont); 1235 label->setFont(bfont);
1224 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1236 label->setFrameStyle(Q3Frame::Panel|Q3Frame::Raised);
1225 label->setLineWidth(1); 1237 label->setLineWidth(1);
1226 label->setAlignment(AlignCenter); 1238 label->setAlignment(Qt::AlignCenter);
1227 mDayLabelsW.insert( i, label ); 1239 mDayLabelsW.insert( i, label );
1228 } 1240 }
1229 1241
1230 bfont.setBold( false ); 1242 bfont.setBold( false );
1231 mWeekLabels.resize( mNumWeeks+1 ); 1243 mWeekLabels.resize( mNumWeeks+1 );
1232 mWeekLabelsW.resize( 2 ); 1244 mWeekLabelsW.resize( 2 );
1233 for( i = 0; i < mNumWeeks+1; i++ ) { 1245 for( i = 0; i < mNumWeeks+1; i++ ) {
1234 KOWeekButton *label = new KOWeekButton( mMonthView ); 1246 KOWeekButton *label = new KOWeekButton( mMonthView );
1235 label->setFocusPolicy(NoFocus); 1247 label->setFocusPolicy(Qt::NoFocus);
1236 label->setFont(bfont); 1248 label->setFont(bfont);
1237 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1249 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1238 label->setFlat(true); 1250 label->setFlat(true);
1239 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1251 Q3WhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1240 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1252 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1241 //label->setLineWidth(1); 1253 //label->setLineWidth(1);
1242 //label->setAlignment(AlignCenter); 1254 //label->setAlignment(AlignCenter);
1243 mWeekLabels.insert( i, label ); 1255 mWeekLabels.insert( i, label );
1244 } 1256 }
1245 mWeekLabels[mNumWeeks]->setText( i18n("W")); 1257 mWeekLabels[mNumWeeks]->setText( i18n("W"));
1246 mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); 1258 mWeekLabels[mNumWeeks]->setFocusPolicy(Qt::WheelFocus);
1247 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); 1259 Q3WhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
1248 1260
1249 for( i = 0; i < 1+1; i++ ) { 1261 for( i = 0; i < 1+1; i++ ) {
1250 KOWeekButton *label = new KOWeekButton( mWeekView ); 1262 KOWeekButton *label = new KOWeekButton( mWeekView );
1251 label->setFocusPolicy(NoFocus); 1263 label->setFocusPolicy(Qt::NoFocus);
1252 label->setFont(bfont); 1264 label->setFont(bfont);
1253 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1265 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1254 label->setFlat(true); 1266 label->setFlat(true);
1255 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1267 Q3WhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1256 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1268 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1257 //label->setLineWidth(1); 1269 //label->setLineWidth(1);
1258 //label->setAlignment(AlignCenter); 1270 //label->setAlignment(AlignCenter);
1259 mWeekLabelsW.insert( i, label ); 1271 mWeekLabelsW.insert( i, label );
1260 } 1272 }
1261 mWeekLabelsW[1]->setText( i18n("W")); 1273 mWeekLabelsW[1]->setText( i18n("W"));
1262 mWeekLabelsW[1]->setFocusPolicy(WheelFocus); 1274 mWeekLabelsW[1]->setFocusPolicy(Qt::WheelFocus);
1263 1275
1264 1276
1265 int row, col; 1277 int row, col;
1266 mCells.resize( mNumCells ); 1278 mCells.resize( mNumCells );
1267 for( row = 0; row < mNumWeeks; ++row ) { 1279 for( row = 0; row < mNumWeeks; ++row ) {
1268 for( col = 0; col < mDaysPerWeek; ++col ) { 1280 for( col = 0; col < mDaysPerWeek; ++col ) {
1269 MonthViewCell *cell = new MonthViewCell( this, mMonthView ); 1281 MonthViewCell *cell = new MonthViewCell( this, mMonthView );
1270 mCells.insert( row * mDaysPerWeek + col, cell ); 1282 mCells.insert( row * mDaysPerWeek + col, cell );
1271 1283
1272 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1284 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1273 SLOT( defaultAction( Incidence * ) ) ); 1285 SLOT( defaultAction( Incidence * ) ) );
1274 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1286 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1275 SIGNAL( newEventSignal( QDateTime ) ) ); 1287 SIGNAL( newEventSignal( QDateTime ) ) );
1276 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1288 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1277 SIGNAL( showDaySignal( QDate ) ) ); 1289 SIGNAL( showDaySignal( QDate ) ) );
1278 connect( cell, SIGNAL( nextCell() ), 1290 connect( cell, SIGNAL( nextCell() ),
@@ -1292,53 +1304,53 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1292 SLOT( defaultAction( Incidence * ) ) ); 1304 SLOT( defaultAction( Incidence * ) ) );
1293 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1305 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1294 SIGNAL( newEventSignal( QDateTime ) ) ); 1306 SIGNAL( newEventSignal( QDateTime ) ) );
1295 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1307 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1296 SIGNAL( showDaySignal( QDate ) ) ); 1308 SIGNAL( showDaySignal( QDate ) ) );
1297 connect( cell, SIGNAL( nextCell() ), 1309 connect( cell, SIGNAL( nextCell() ),
1298 SLOT( nextCell() ) ); 1310 SLOT( nextCell() ) );
1299 connect( cell, SIGNAL( prevCell() ), 1311 connect( cell, SIGNAL( prevCell() ),
1300 SLOT( prevCell() ) ); 1312 SLOT( prevCell() ) );
1301 connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ), 1313 connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ),
1302 SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); 1314 SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) ));
1303 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); 1315 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
1304 } 1316 }
1305 1317
1306 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 1318 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
1307 mContextMenu = eventPopup(); 1319 mContextMenu = eventPopup();
1308 mContextMenu->addAdditionalItem(QIconSet(QPixmap()), 1320 mContextMenu->addAdditionalItem(QIcon(QPixmap()),
1309 i18n("New Event..."),this, 1321 i18n("New Event..."),this,
1310 SLOT(slotNewEvent()),false); 1322 SLOT(slotNewEvent()),false);
1311 mContextMenu->addAdditionalItem(QIconSet(QPixmap()), 1323 mContextMenu->addAdditionalItem(QIcon(QPixmap()),
1312 i18n("New Todo..."),this, 1324 i18n("New Todo..."),this,
1313 SLOT(slotNewTodo()),false); 1325 SLOT(slotNewTodo()),false);
1314 mContextMenu->addAdditionalItem(QIconSet(QPixmap()), 1326 mContextMenu->addAdditionalItem(QIcon(QPixmap()),
1315 i18n("Journal"),this, 1327 i18n("Journal"),this,
1316 SLOT(slotEditJournal()),false); 1328 SLOT(slotEditJournal()),false);
1317 1329
1318 connect (mContextMenu ,SIGNAL(categoryChanged( Incidence * )),this, 1330 connect (mContextMenu ,SIGNAL(categoryChanged( Incidence * )),this,
1319 SLOT( catChanged( Incidence * ) )); 1331 SLOT( catChanged( Incidence * ) ));
1320 1332
1321 1333
1322 QString pathString = ""; 1334 QString pathString = "";
1323 if ( !KOPrefs::instance()->mToolBarMiniIcons ) { 1335 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
1324 if ( QApplication::desktop()->width() < 480 ) 1336 if ( QApplication::desktop()->width() < 480 )
1325 pathString += "icons16/"; 1337 pathString += "icons16/";
1326 } else 1338 } else
1327 pathString += "iconsmini/"; 1339 pathString += "iconsmini/";
1328 mNewItemMenu = new QPopupMenu( this ); 1340 mNewItemMenu = new Q3PopupMenu( this );
1329 mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent())); 1341 mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent()));
1330 mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false); 1342 mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false);
1331 mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false); 1343 mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false);
1332 1344
1333 // updateConfig(); //useless here... 1345 // updateConfig(); //useless here...
1334 // ... but we need mWidthLongDayLabel computed 1346 // ... but we need mWidthLongDayLabel computed
1335 QFontMetrics fontmetric(mDayLabels[0]->font()); 1347 QFontMetrics fontmetric(mDayLabels[0]->font());
1336 mWidthLongDayLabel = 0; 1348 mWidthLongDayLabel = 0;
1337 for (int i = 0; i < 7; i++) { 1349 for (int i = 0; i < 7; i++) {
1338 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1350 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1339 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1351 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1340 } 1352 }
1341 1353
1342 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1354 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1343 1355
1344#if 0 1356#if 0
@@ -1384,33 +1396,33 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int
1384 1396
1385 if ( lastInc == inc && lastCell == mc ) 1397 if ( lastInc == inc && lastCell == mc )
1386 return; 1398 return;
1387 lastInc = inc; 1399 lastInc = inc;
1388 lastCell = mc; 1400 lastCell = mc;
1389 //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); 1401 //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday );
1390 1402
1391 bool weekview = false; 1403 bool weekview = false;
1392 uint index = 0; 1404 uint index = 0;
1393 for (uint i = 0; i < mCellsW.count(); ++i) { 1405 for (uint i = 0; i < mCellsW.count(); ++i) {
1394 if ( mCellsW[i] == mc ) { 1406 if ( mCellsW[i] == mc ) {
1395 weekview = true; 1407 weekview = true;
1396 index = i; 1408 index = i;
1397 break; 1409 break;
1398 } 1410 }
1399 } 1411 }
1400 QPtrVector<MonthViewCell> *cells; 1412 Q3PtrVector<MonthViewCell> *cells;
1401 if ( weekview ) 1413 if ( weekview )
1402 cells = &mCellsW; 1414 cells = &mCellsW;
1403 else { 1415 else {
1404 for (uint i = 0; i < mCells.count(); ++i) { 1416 for (uint i = 0; i < mCells.count(); ++i) {
1405 if ( mCells[i] == mc ) { 1417 if ( mCells[i] == mc ) {
1406 index = i; 1418 index = i;
1407 break; 1419 break;
1408 } 1420 }
1409 } 1421 }
1410 cells = &mCells; 1422 cells = &mCells;
1411 } 1423 }
1412 for (uint i = 0; i < (*cells).count(); ++i) { 1424 for (uint i = 0; i < (*cells).count(); ++i) {
1413 (*cells)[i]->deHighLight(); 1425 (*cells)[i]->deHighLight();
1414 } 1426 }
1415 if ( ! inc ) 1427 if ( ! inc )
1416 return; 1428 return;
@@ -1482,35 +1494,35 @@ void KOMonthView::switchView()
1482 mWidStack->raiseWidget( mWeekView ); 1494 mWidStack->raiseWidget( mWeekView );
1483 else 1495 else
1484 mWidStack->raiseWidget( mMonthView ); 1496 mWidStack->raiseWidget( mMonthView );
1485 clPending = false; 1497 clPending = false;
1486} 1498}
1487 1499
1488int KOMonthView::maxDatesHint() 1500int KOMonthView::maxDatesHint()
1489{ 1501{
1490 return mNumCells; 1502 return mNumCells;
1491} 1503}
1492 1504
1493int KOMonthView::currentDateCount() 1505int KOMonthView::currentDateCount()
1494{ 1506{
1495 return mNumCells; 1507 return mNumCells;
1496} 1508}
1497 1509
1498QPtrList<Incidence> KOMonthView::selectedIncidences() 1510Q3PtrList<Incidence> KOMonthView::selectedIncidences()
1499{ 1511{
1500 QPtrList<Incidence> selected; 1512 Q3PtrList<Incidence> selected;
1501 1513
1502 if ( mSelectedCell ) { 1514 if ( mSelectedCell ) {
1503 Incidence *incidence = mSelectedCell->selectedIncidence(); 1515 Incidence *incidence = mSelectedCell->selectedIncidence();
1504 if ( incidence ) selected.append( incidence ); 1516 if ( incidence ) selected.append( incidence );
1505 } 1517 }
1506 1518
1507 return selected; 1519 return selected;
1508} 1520}
1509 1521
1510DateList KOMonthView::selectedDates() 1522DateList KOMonthView::selectedDates()
1511{ 1523{
1512 DateList selected; 1524 DateList selected;
1513 1525
1514 if ( mSelectedCell ) { 1526 if ( mSelectedCell ) {
1515 QDate qd = mSelectedCell->selectedIncidenceDate(); 1527 QDate qd = mSelectedCell->selectedIncidenceDate();
1516 if ( qd.isValid() ) selected.append( qd ); 1528 if ( qd.isValid() ) selected.append( qd );
@@ -1548,41 +1560,41 @@ void KOMonthView::updateConfig()
1548 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) 1560 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
1549 computeLayout(); 1561 computeLayout();
1550 } else 1562 } else
1551 doComputeLayoutWeek(); 1563 doComputeLayoutWeek();
1552 updateDayLabels(); 1564 updateDayLabels();
1553 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); 1565 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
1554 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; 1566 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
1555 //resizeEvent( 0 ); 1567 //resizeEvent( 0 );
1556 for (uint i = 0; i < mCells.count(); ++i) { 1568 for (uint i = 0; i < mCells.count(); ++i) {
1557 mCells[i]->updateConfig(); 1569 mCells[i]->updateConfig();
1558 } 1570 }
1559 1571
1560 for (uint i = 0; i < mCellsW.count(); ++i) { 1572 for (uint i = 0; i < mCellsW.count(); ++i) {
1561 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); 1573 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont);
1562 } 1574 }
1563#ifdef DESKTOP_VERSION 1575#ifdef DESKTOP_VERSION
1564 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); 1576 /* TODO:hacker: MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); */
1565#endif 1577#endif
1566 updateView(); 1578 updateView();
1567} 1579}
1568 1580
1569void KOMonthView::updateDayLabels() 1581void KOMonthView::updateDayLabels()
1570{ 1582{
1571 1583
1572 QPtrVector<QLabel> *mDayLabelsT; 1584 Q3PtrVector<QLabel> *mDayLabelsT;
1573 1585
1574 mDayLabelsT = &mDayLabelsW; 1586 mDayLabelsT = &mDayLabelsW;
1575 for (int i = 0; i < 7; i++) { 1587 for (int i = 0; i < 7; i++) {
1576 { 1588 {
1577 bool show = mShortDayLabelsW; 1589 bool show = mShortDayLabelsW;
1578 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1590 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1579 show = true; 1591 show = true;
1580 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1592 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1581 } 1593 }
1582 } 1594 }
1583 mDayLabelsT = &mDayLabels; 1595 mDayLabelsT = &mDayLabels;
1584 for (int i = 0; i < 7; i++) { 1596 for (int i = 0; i < 7; i++) {
1585 if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) { 1597 if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) {
1586 bool show = mShortDayLabelsM; 1598 bool show = mShortDayLabelsM;
1587 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1599 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1588 show = true; 1600 show = true;
@@ -1597,35 +1609,35 @@ void KOMonthView::updateDayLabels()
1597} 1609}
1598 1610
1599void KOMonthView::clearList() 1611void KOMonthView::clearList()
1600{ 1612{
1601 unsigned int i; 1613 unsigned int i;
1602 for( i = 0; i < mCells.size(); ++i ) { 1614 for( i = 0; i < mCells.size(); ++i ) {
1603 mCells[i]->clear(); 1615 mCells[i]->clear();
1604 } 1616 }
1605 for( i = 0; i < mCellsW.size(); ++i ) { 1617 for( i = 0; i < mCellsW.size(); ++i ) {
1606 mCellsW[i]->clear(); 1618 mCellsW[i]->clear();
1607 } 1619 }
1608} 1620}
1609void KOMonthView::showDates(const QDate &start, const QDate &) 1621void KOMonthView::showDates(const QDate &start, const QDate &)
1610{ 1622{
1611 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; 1623 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl;
1612 1624
1613 QPtrVector<MonthViewCell> *cells; 1625 Q3PtrVector<MonthViewCell> *cells;
1614 QPtrVector<QLabel> *dayLabels; 1626 Q3PtrVector<QLabel> *dayLabels;
1615 QPtrVector<KOWeekButton> *weekLabels; 1627 Q3PtrVector<KOWeekButton> *weekLabels;
1616 uint weekNum = 6; 1628 uint weekNum = 6;
1617 mStartDate = start; 1629 mStartDate = start;
1618 if ( mShowWeekView ) { 1630 if ( mShowWeekView ) {
1619 weekNum = 1; 1631 weekNum = 1;
1620 cells = &mCellsW; 1632 cells = &mCellsW;
1621 dayLabels = &mDayLabelsW; 1633 dayLabels = &mDayLabelsW;
1622 weekLabels = &mWeekLabelsW; 1634 weekLabels = &mWeekLabelsW;
1623 if ( !KGlobal::locale()->weekStartsMonday() ) { 1635 if ( !KGlobal::locale()->weekStartsMonday() ) {
1624 mStartDate = mStartDate.addDays( 1 ); 1636 mStartDate = mStartDate.addDays( 1 );
1625 } 1637 }
1626 } else { 1638 } else {
1627 cells = &mCells; 1639 cells = &mCells;
1628 dayLabels = &mDayLabels; 1640 dayLabels = &mDayLabels;
1629 weekLabels = &mWeekLabels; 1641 weekLabels = &mWeekLabels;
1630 } 1642 }
1631 1643
@@ -1655,70 +1667,70 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
1655 for( i = 0; i < weekNum; ++i ) { 1667 for( i = 0; i < weekNum; ++i ) {
1656 int wno; 1668 int wno;
1657 // remember, according to ISO 8601, the first week of the year is the 1669 // remember, according to ISO 8601, the first week of the year is the
1658 // first week that contains a thursday. Thus we must subtract off 4, 1670 // first week that contains a thursday. Thus we must subtract off 4,
1659 // not just 1. 1671 // not just 1.
1660 int dayOfYear = date.dayOfYear(); 1672 int dayOfYear = date.dayOfYear();
1661 if (dayOfYear % 7 != 0) 1673 if (dayOfYear % 7 != 0)
1662 wno = dayOfYear / 7 + 1; 1674 wno = dayOfYear / 7 + 1;
1663 else 1675 else
1664 wno =dayOfYear / 7; 1676 wno =dayOfYear / 7;
1665 (*weekLabels)[i]->setWeekNum( wno ); 1677 (*weekLabels)[i]->setWeekNum( wno );
1666 date = date.addDays( 7 ); 1678 date = date.addDays( 7 );
1667 } 1679 }
1668 updateView(); 1680 updateView();
1669} 1681}
1670 1682
1671void KOMonthView::showEvents(QPtrList<Event>) 1683void KOMonthView::showEvents(Q3PtrList<Event>)
1672{ 1684{
1673 qDebug("KOMonthView::selectEvents is not implemented yet. "); 1685 qDebug("KOMonthView::selectEvents is not implemented yet. ");
1674} 1686}
1675 1687
1676void KOMonthView::changeEventDisplay(Event *, int) 1688void KOMonthView::changeEventDisplay(Event *, int)
1677{ 1689{
1678 // this should be re-written to be much more efficient, but this 1690 // this should be re-written to be much more efficient, but this
1679 // quick-and-dirty-hack gets the job done for right now. 1691 // quick-and-dirty-hack gets the job done for right now.
1680 //qDebug("KOMonthView::changeEventDisplay "); 1692 //qDebug("KOMonthView::changeEventDisplay ");
1681 updateView(); 1693 updateView();
1682} 1694}
1683 1695
1684void KOMonthView::updateView() 1696void KOMonthView::updateView()
1685{ 1697{
1686 1698
1687 if ( !updatePossible ) 1699 if ( !updatePossible )
1688 return; 1700 return;
1689 //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); 1701 //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU ");
1690 //QTime ti; 1702 //QTime ti;
1691 //ti.start(); 1703 //ti.start();
1692 clearSelection(); 1704 clearSelection();
1693 QPtrVector<MonthViewCell> *cells; 1705 Q3PtrVector<MonthViewCell> *cells;
1694 if ( mShowWeekView ) { 1706 if ( mShowWeekView ) {
1695 cells = &mCellsW; 1707 cells = &mCellsW;
1696 } else { 1708 } else {
1697 cells = &mCells; 1709 cells = &mCells;
1698 } 1710 }
1699#if 1 1711#if 1
1700 int i; 1712 int i;
1701 int timeSpan = (*cells).size()-1; 1713 int timeSpan = (*cells).size()-1;
1702 if ( KOPrefs::instance()->mMonthViewWeek ) 1714 if ( KOPrefs::instance()->mMonthViewWeek )
1703 timeSpan = 6; 1715 timeSpan = 6;
1704 for( i = 0; i < timeSpan + 1; ++i ) { 1716 for( i = 0; i < timeSpan + 1; ++i ) {
1705 (*cells)[i]->startUpdateCell(); 1717 (*cells)[i]->startUpdateCell();
1706 } 1718 }
1707 1719
1708 QPtrList<Event> events = calendar()->events(); 1720 Q3PtrList<Event> events = calendar()->events();
1709 Event *event; 1721 Event *event;
1710 QDateTime dt; 1722 QDateTime dt;
1711 QDate endDate = mStartDate.addDays( timeSpan ); 1723 QDate endDate = mStartDate.addDays( timeSpan );
1712 for( event = events.first(); event; event = events.next() ) { // for event 1724 for( event = events.first(); event; event = events.next() ) { // for event
1713 if ( event->doesRecur() ) { 1725 if ( event->doesRecur() ) {
1714 bool last; 1726 bool last;
1715 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); 1727 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
1716 QDateTime incidenceEnd; 1728 QDateTime incidenceEnd;
1717 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); 1729 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
1718 bool invalid = false; 1730 bool invalid = false;
1719 while( true ) { 1731 while( true ) {
1720 if ( incidenceStart.isValid() ) { 1732 if ( incidenceStart.isValid() ) {
1721 incidenceEnd = incidenceStart.addDays( eventlen ); 1733 incidenceEnd = incidenceStart.addDays( eventlen );
1722 int st = incidenceStart.date().daysTo( endDate ); 1734 int st = incidenceStart.date().daysTo( endDate );
1723 if ( st >= 0 ) { // start before timeend 1735 if ( st >= 0 ) { // start before timeend
1724 int end = mStartDate.daysTo( incidenceEnd.date() ); 1736 int end = mStartDate.daysTo( incidenceEnd.date() );
@@ -1756,33 +1768,33 @@ void KOMonthView::updateView()
1756 int st = event->dtStart().date().daysTo( endDate ); 1768 int st = event->dtStart().date().daysTo( endDate );
1757 if ( st >= 0 ) { // start before timeend 1769 if ( st >= 0 ) { // start before timeend
1758 int end = mStartDate.daysTo( event->dtEnd().date() ); 1770 int end = mStartDate.daysTo( event->dtEnd().date() );
1759 if ( end >= 0 ) { // end after timestart --- got one! 1771 if ( end >= 0 ) { // end after timestart --- got one!
1760 //normalize 1772 //normalize
1761 st = timeSpan - st; 1773 st = timeSpan - st;
1762 if ( st < 0 ) st = 0; 1774 if ( st < 0 ) st = 0;
1763 if ( end > timeSpan ) end = timeSpan; 1775 if ( end > timeSpan ) end = timeSpan;
1764 int iii; 1776 int iii;
1765 for ( iii = st;iii<= end;++iii) 1777 for ( iii = st;iii<= end;++iii)
1766 (*cells)[iii]->insertEvent( event ); 1778 (*cells)[iii]->insertEvent( event );
1767 } 1779 }
1768 } 1780 }
1769 } 1781 }
1770 } 1782 }
1771 // insert due todos 1783 // insert due todos
1772 QPtrList<Todo> todos = calendar()->todos( ); 1784 Q3PtrList<Todo> todos = calendar()->todos( );
1773 Todo *todo; 1785 Todo *todo;
1774 for(todo = todos.first(); todo; todo = todos.next()) { 1786 for(todo = todos.first(); todo; todo = todos.next()) {
1775 //insertTodo( todo ); 1787 //insertTodo( todo );
1776 if ( todo->hasDueDate() ) { 1788 if ( todo->hasDueDate() ) {
1777 int day = mStartDate.daysTo( todo->dtDue().date() ); 1789 int day = mStartDate.daysTo( todo->dtDue().date() );
1778 if ( day >= 0 && day < timeSpan + 1) { 1790 if ( day >= 0 && day < timeSpan + 1) {
1779 (*cells)[day]->insertTodo( todo ); 1791 (*cells)[day]->insertTodo( todo );
1780 } 1792 }
1781 } 1793 }
1782 } 1794 }
1783 1795
1784 for( i = 0; i < timeSpan+1; ++i ) { 1796 for( i = 0; i < timeSpan+1; ++i ) {
1785 (*cells)[i]->finishUpdateCell(); 1797 (*cells)[i]->finishUpdateCell();
1786 } 1798 }
1787 processSelectionChange(); 1799 processSelectionChange();
1788 //qApp->processEvents(); 1800 //qApp->processEvents();
@@ -2212,33 +2224,33 @@ void KOMonthView::setSelectedCell( MonthViewCell *cell )
2212 if ( mSelectedCell && mSelectedCell != cell ) { 2224 if ( mSelectedCell && mSelectedCell != cell ) {
2213 MonthViewCell * mvc = mSelectedCell; 2225 MonthViewCell * mvc = mSelectedCell;
2214 mSelectedCell = cell; 2226 mSelectedCell = cell;
2215 mvc->deselect(); 2227 mvc->deselect();
2216 } else 2228 } else
2217 mSelectedCell = cell; 2229 mSelectedCell = cell;
2218 // if ( mSelectedCell ) 2230 // if ( mSelectedCell )
2219 // mSelectedCell->select(); 2231 // mSelectedCell->select();
2220 if ( !mSelectedCell ) 2232 if ( !mSelectedCell )
2221 emit incidenceSelected( 0 ); 2233 emit incidenceSelected( 0 );
2222 else 2234 else
2223 emit incidenceSelected( mSelectedCell->selectedIncidence() ); 2235 emit incidenceSelected( mSelectedCell->selectedIncidence() );
2224} 2236}
2225 2237
2226void KOMonthView::processSelectionChange() 2238void KOMonthView::processSelectionChange()
2227{ 2239{
2228 QPtrList<Incidence> incidences = selectedIncidences(); 2240 Q3PtrList<Incidence> incidences = selectedIncidences();
2229 if (incidences.count() > 0) { 2241 if (incidences.count() > 0) {
2230 emit incidenceSelected( incidences.first() ); 2242 emit incidenceSelected( incidences.first() );
2231 } else { 2243 } else {
2232 emit incidenceSelected( 0 ); 2244 emit incidenceSelected( 0 );
2233 clearSelection(); 2245 clearSelection();
2234 } 2246 }
2235} 2247}
2236 2248
2237void KOMonthView::clearSelection() 2249void KOMonthView::clearSelection()
2238{ 2250{
2239 if ( mSelectedCell ) { 2251 if ( mSelectedCell ) {
2240 mSelectedCell->deselect(); 2252 mSelectedCell->deselect();
2241 mSelectedCell = 0; 2253 mSelectedCell = 0;
2242 } 2254 }
2243} 2255}
2244 2256
@@ -2248,63 +2260,63 @@ void KOMonthView::keyReleaseEvent ( QKeyEvent * e)
2248 mFlagKeyPressed = false; 2260 mFlagKeyPressed = false;
2249 } 2261 }
2250} 2262}
2251 2263
2252void KOMonthView::keyPressEvent ( QKeyEvent * e ) 2264void KOMonthView::keyPressEvent ( QKeyEvent * e )
2253{ 2265{
2254 2266
2255 qApp->processEvents(); 2267 qApp->processEvents();
2256 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 2268 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
2257 //e->ignore(); 2269 //e->ignore();
2258 e->accept(); 2270 e->accept();
2259 return; 2271 return;
2260 } 2272 }
2261 if (! e->isAutoRepeat() ) 2273 if (! e->isAutoRepeat() )
2262 mFlagKeyPressed = true; 2274 mFlagKeyPressed = true;
2263 switch(e->key()) { 2275 switch(e->key()) {
2264 case Key_Up: 2276 case Qt::Key_Up:
2265 { 2277 {
2266 if ( mShowWeekView ) { 2278 if ( mShowWeekView ) {
2267 emit selectWeekNum ( currentWeek() - 1 ); 2279 emit selectWeekNum ( currentWeek() - 1 );
2268 } 2280 }
2269 else { 2281 else {
2270 emit prevMonth(); 2282 emit prevMonth();
2271 } 2283 }
2272 } 2284 }
2273 e->accept(); 2285 e->accept();
2274 break; 2286 break;
2275 case Key_Down: 2287 case Qt::Key_Down:
2276 { 2288 {
2277 if ( mShowWeekView ) { 2289 if ( mShowWeekView ) {
2278 emit selectWeekNum ( currentWeek() +1); 2290 emit selectWeekNum ( currentWeek() +1);
2279 } 2291 }
2280 else { 2292 else {
2281 emit nextMonth(); 2293 emit nextMonth();
2282 } 2294 }
2283 2295
2284 } 2296 }
2285 e->accept(); 2297 e->accept();
2286 break; 2298 break;
2287 case Key_Return: 2299 case Qt::Key_Return:
2288 case Key_Enter: 2300 case Qt::Key_Enter:
2289 { 2301 {
2290 selectInternalWeekNum ( currentWeek() ); 2302 selectInternalWeekNum ( currentWeek() );
2291 } 2303 }
2292 e->accept(); 2304 e->accept();
2293 break; 2305 break;
2294 case Key_D: 2306 case Qt::Key_D:
2295 if ( mSelectedCell ) { 2307 if ( mSelectedCell ) {
2296 mSelectedCell->showDay(); 2308 mSelectedCell->showDay();
2297 e->accept(); 2309 e->accept();
2298 } else { 2310 } else {
2299 e->ignore(); 2311 e->ignore();
2300 } 2312 }
2301 break; 2313 break;
2302 default: 2314 default:
2303 e->ignore(); 2315 e->ignore();
2304 break; 2316 break;
2305 } 2317 }
2306} 2318}
2307 2319
2308void KOMonthView::nextCell() 2320void KOMonthView::nextCell()
2309{ 2321{
2310 focusNextPrevChild ( true ); 2322 focusNextPrevChild ( true );
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 1a9d16d..bca76e5 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -8,43 +8,50 @@
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#ifndef _KOMONTHVIEW_H 20#ifndef _KOMONTHVIEW_H
21#define _KOMONTHVIEW_H 21#define _KOMONTHVIEW_H
22 22
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qframe.h> 24#include <q3frame.h>
25#include <qdatetime.h> 25#include <qdatetime.h>
26#include <qlistbox.h> 26#include <q3listbox.h>
27#include <qpoint.h> 27#include <qpoint.h>
28#include <qwidgetstack.h> 28#include <q3widgetstack.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qintdict.h> 31#include <q3intdict.h>
32#include <qpushbutton.h> 32#include <qpushbutton.h>
33#include <qvaluelist.h> 33#include <q3valuelist.h>
34#include <qptrvector.h> 34#include <q3ptrvector.h>
35//Added by qt3to4:
36#include <QResizeEvent>
37#include <QFocusEvent>
38#include <QMouseEvent>
39#include <Q3PtrList>
40#include <Q3PopupMenu>
41#include <QKeyEvent>
35 42
36#include <libkcal/calendar.h> 43#include <libkcal/calendar.h>
37#include <libkcal/event.h> 44#include <libkcal/event.h>
38 45
39#include "koeventview.h" 46#include "koeventview.h"
40#include "navigatorbar.h" 47#include "navigatorbar.h"
41 48
42#ifdef DESKTOP_VERSION 49#ifdef DESKTOP_VERSION
43class QToolTipGroup; 50class QToolTipGroup;
44#endif 51#endif
45 52
46class KNOWhatsThis; 53class KNOWhatsThis;
47class MonthViewCell; 54class MonthViewCell;
48class KOWeekButton : public QPushButton 55class KOWeekButton : public QPushButton
49{ 56{
50 Q_OBJECT 57 Q_OBJECT
@@ -59,88 +66,88 @@ class KOWeekButton : public QPushButton
59 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} 66 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));}
60 int getWeekNum() { return mNumber;} 67 int getWeekNum() { return mNumber;}
61 signals: 68 signals:
62 void selectWeekNum ( int ); 69 void selectWeekNum ( int );
63private: 70private:
64 void focusInEvent ( QFocusEvent * ){;} 71 void focusInEvent ( QFocusEvent * ){;}
65 int mNumber; 72 int mNumber;
66 void keyPressEvent ( QKeyEvent * e ) 73 void keyPressEvent ( QKeyEvent * e )
67 { 74 {
68 e->ignore(); 75 e->ignore();
69 } 76 }
70 77
71private slots : 78private slots :
72 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } 79 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
73}; 80};
74 81
75class KNoScrollListBox: public QListBox 82class KNoScrollListBox: public Q3ListBox
76{ 83{
77 Q_OBJECT 84 Q_OBJECT
78 public: 85 public:
79 KNoScrollListBox(QWidget *parent=0, const char *name=0); 86 KNoScrollListBox(QWidget *parent=0, const char *name=0);
80 ~KNoScrollListBox(); 87 ~KNoScrollListBox();
81 QString getWhatsThisText(QPoint p) ; 88 QString getWhatsThisText(QPoint p) ;
82 89
83 signals: 90 signals:
84 void shiftDown(); 91 void shiftDown();
85 void shiftUp(); 92 void shiftUp();
86 void rightClick(); 93 void rightClick();
87 void nextCell(); 94 void nextCell();
88 void prevCell(); 95 void prevCell();
89 void highlightIncidence( Incidence * , MonthViewCell*, int ); 96 void highlightIncidence( Incidence * , MonthViewCell*, int );
90 protected: 97 protected:
91 bool mBlockDeselect; 98 bool mBlockDeselect;
92 protected slots: 99 protected slots:
93 void oneDown(); 100 void oneDown();
94 void keyPressEvent(QKeyEvent *); 101 void keyPressEvent(QKeyEvent *);
95 void keyReleaseEvent(QKeyEvent *); 102 void keyReleaseEvent(QKeyEvent *);
96 void mousePressEvent(QMouseEvent *); 103 void mousePressEvent(QMouseEvent *);
97 void focusInEvent ( QFocusEvent * ); 104 void focusInEvent ( QFocusEvent * );
98 void focusOutEvent ( QFocusEvent * ); 105 void focusOutEvent ( QFocusEvent * );
99 106
100 private: 107 private:
101 bool resetOnFocusIn; 108 bool resetOnFocusIn;
102 KNOWhatsThis * mWT; 109 KNOWhatsThis * mWT;
103}; 110};
104 111
105 112
106class MonthViewItem: public QListBoxItem 113class MonthViewItem: public Q3ListBoxItem
107{ 114{
108 public: 115 public:
109 MonthViewItem( Incidence *,const QString & title ); 116 MonthViewItem( Incidence *,const QString & title );
110 void recycle( Incidence *incidence, const QString & s); 117 void recycle( Incidence *incidence, const QString & s);
111 void setRecur(bool on) { mRecur = on; } 118 void setRecur(bool on) { mRecur = on; }
112 void setAlarm(bool on) { mAlarm = on; } 119 void setAlarm(bool on) { mAlarm = on; }
113 void setReply(bool on) { mReply = on; } 120 void setReply(bool on) { mReply = on; }
114 void setMoreInfo(bool on) { mInfo = on; } 121 void setMoreInfo(bool on) { mInfo = on; }
115 void setMultiDay(int type) { mMultiday = type; } 122 void setMultiDay(int type) { mMultiday = type; }
116 int multiDay() { return mMultiday; } 123 int multiDay() { return mMultiday; }
117 void setMultiDayPos(int type) { mdayPos = type; } 124 void setMultiDayPos(int type) { mdayPos = type; }
118 int gettMultiDayPos() { return mdayPos; } 125 int gettMultiDayPos() { return mdayPos; }
119 void setBlockRepaint(bool on) { mblockRepaint = on; } 126 void setBlockRepaint(bool on) { mblockRepaint = on; }
120 bool setHighlighted( Incidence * ); 127 bool setHighlighted( Incidence * );
121 128
122 void setPalette(const QPalette &p) { mPalette = p; } 129 void setPalette(const QPalette &p) { mPalette = p; }
123 QPalette palette() const { return mPalette; } 130 QPalette palette() const { return mPalette; }
124 bool setHighlightedFalse(); 131 bool setHighlightedFalse();
125 Incidence *incidence() const { return mIncidence; } 132 Incidence *incidence() const { return mIncidence; }
126 133
127 protected: 134 protected:
128 virtual void paint(QPainter *); 135 virtual void paint(QPainter *);
129 virtual int height(const QListBox *) const; 136 virtual int height(const Q3ListBox *) const;
130 virtual int width(const QListBox *) const; 137 virtual int width(const Q3ListBox *) const;
131 138
132 private: 139 private:
133 int mdayPos; 140 int mdayPos;
134 bool isWeekItem; 141 bool isWeekItem;
135 bool mblockRepaint; 142 bool mblockRepaint;
136 int mMultiday; 143 int mMultiday;
137 bool mRecur; 144 bool mRecur;
138 bool mAlarm; 145 bool mAlarm;
139 bool mReply; 146 bool mReply;
140 bool mInfo; 147 bool mInfo;
141 bool mDisplayHighlighted; 148 bool mDisplayHighlighted;
142 149
143 QPalette mPalette; 150 QPalette mPalette;
144 QDate mDate; 151 QDate mDate;
145 152
146 Incidence *mIncidence; 153 Incidence *mIncidence;
@@ -185,41 +192,41 @@ class MonthViewCell : public KNoScrollListBox
185 static QToolTipGroup *toolTipGroup(); 192 static QToolTipGroup *toolTipGroup();
186#endif 193#endif
187 signals: 194 signals:
188 void defaultAction( Incidence * ); 195 void defaultAction( Incidence * );
189 void newEventSignal( QDateTime ); 196 void newEventSignal( QDateTime );
190 void showDaySignal( QDate ); 197 void showDaySignal( QDate );
191 198
192 protected: 199 protected:
193 QStringList mToolTip; 200 QStringList mToolTip;
194 void resizeEvent( QResizeEvent * ); 201 void resizeEvent( QResizeEvent * );
195 202
196public slots: 203public slots:
197 void showDay(); 204 void showDay();
198 void deHighLight(); 205 void deHighLight();
199 void repaintfinishUpdateCell(); 206 void repaintfinishUpdateCell();
200 protected slots: 207 protected slots:
201 void defaultAction( QListBoxItem * ); 208 void defaultAction( Q3ListBoxItem * );
202 void contextMenu( QListBoxItem * ); 209 void contextMenu( Q3ListBoxItem * );
203 void selection( QListBoxItem * ); 210 void selection( Q3ListBoxItem * );
204 void cellClicked( QListBoxItem * ); 211 void cellClicked( Q3ListBoxItem * );
205 void newEvent(); 212 void newEvent();
206 213
207 private: 214 private:
208 int mdayCount; 215 int mdayCount;
209 QPtrList <MonthViewItem> mAvailItemList; 216 Q3PtrList <MonthViewItem> mAvailItemList;
210 KOMonthView *mMonthView; 217 KOMonthView *mMonthView;
211 int currentPalette; 218 int currentPalette;
212 219
213 QDate mDate; 220 QDate mDate;
214 bool mPrimary; 221 bool mPrimary;
215 bool mHoliday; 222 bool mHoliday;
216 QString mHolidayString; 223 QString mHolidayString;
217 224
218 //QLabel *mLabel; 225 //QLabel *mLabel;
219 QPushButton *mLabel; 226 QPushButton *mLabel;
220 //QListBox *mItemList; 227 //QListBox *mItemList;
221#ifdef DESKTOP_VERSION 228#ifdef DESKTOP_VERSION
222 static QToolTipGroup *mToolTipGroup; 229 static QToolTipGroup *mToolTipGroup;
223#endif 230#endif
224 QSize mLabelSize; 231 QSize mLabelSize;
225 QSize mLabelBigSize; 232 QSize mLabelBigSize;
@@ -234,55 +241,55 @@ public slots:
234 241
235 242
236class KOMonthView: public KOEventView 243class KOMonthView: public KOEventView
237{ 244{
238 Q_OBJECT 245 Q_OBJECT
239 public: 246 public:
240 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 247 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
241 ~KOMonthView(); 248 ~KOMonthView();
242 249
243 /** Returns maximum number of days supported by the komonthview */ 250 /** Returns maximum number of days supported by the komonthview */
244 virtual int maxDatesHint(); 251 virtual int maxDatesHint();
245 252
246 /** Returns number of currently shown dates. */ 253 /** Returns number of currently shown dates. */
247 virtual int currentDateCount(); 254 virtual int currentDateCount();
248 255
249 /** returns the currently selected events */ 256 /** returns the currently selected events */
250 virtual QPtrList<Incidence> selectedIncidences(); 257 virtual Q3PtrList<Incidence> selectedIncidences();
251 258
252 /** returns dates of the currently selected events */ 259 /** returns dates of the currently selected events */
253 virtual DateList selectedDates(); 260 virtual DateList selectedDates();
254#if 0 261#if 0
255 virtual void printPreview(CalPrinter *calPrinter, 262 virtual void printPreview(CalPrinter *calPrinter,
256 const QDate &, const QDate &); 263 const QDate &, const QDate &);
257#endif 264#endif
258 bool isMonthView() { return !mShowWeekView; } 265 bool isMonthView() { return !mShowWeekView; }
259 bool isUpdatePossible() { return updatePossible; } 266 bool isUpdatePossible() { return updatePossible; }
260 267
261 MonthViewCell * selectedCell(); 268 MonthViewCell * selectedCell();
262 bool skipResize; 269 bool skipResize;
263 NavigatorBar* navigatorBar() { return mNavigatorBar ;} 270 NavigatorBar* navigatorBar() { return mNavigatorBar ;}
264 void clearList(); 271 void clearList();
265 public slots: 272 public slots:
266 void incidenceHighlighted( Incidence *, MonthViewCell*, int ); 273 void incidenceHighlighted( Incidence *, MonthViewCell*, int );
267 void nextCell(); 274 void nextCell();
268 void prevCell(); 275 void prevCell();
269 virtual void updateView(); 276 virtual void updateView();
270 virtual void updateConfig(); 277 virtual void updateConfig();
271 virtual void showDates(const QDate &start, const QDate &end); 278 virtual void showDates(const QDate &start, const QDate &end);
272 virtual void showEvents(QPtrList<Event> eventList); 279 virtual void showEvents(Q3PtrList<Event> eventList);
273 280
274 void changeEventDisplay(Event *, int); 281 void changeEventDisplay(Event *, int);
275 282
276 void clearSelection(); 283 void clearSelection();
277 284
278 void showContextMenu( Incidence * ); 285 void showContextMenu( Incidence * );
279 286
280 void setSelectedCell( MonthViewCell * ); 287 void setSelectedCell( MonthViewCell * );
281 void setPopupCell( MonthViewCell * ); 288 void setPopupCell( MonthViewCell * );
282 void switchView(); 289 void switchView();
283 void setKeyBFocus(); 290 void setKeyBFocus();
284 291
285 protected slots: 292 protected slots:
286 void catChanged( Incidence * ); 293 void catChanged( Incidence * );
287 void setKeyBoardFocus(); 294 void setKeyBoardFocus();
288 void slotNewTodo(); 295 void slotNewTodo();
@@ -298,54 +305,54 @@ class KOMonthView: public KOEventView
298 void selectMonth (); 305 void selectMonth ();
299 void showDaySignal( QDate ); 306 void showDaySignal( QDate );
300 void newTodoSignal( QDateTime, bool ); 307 void newTodoSignal( QDateTime, bool );
301 void showJournalSignal( int,QDate ); 308 void showJournalSignal( int,QDate );
302 protected: 309 protected:
303 void resizeEvent(QResizeEvent *); 310 void resizeEvent(QResizeEvent *);
304 void viewChanged(); 311 void viewChanged();
305 void updateDayLabels(); 312 void updateDayLabels();
306 int mapWeekLayout( int, bool ); 313 int mapWeekLayout( int, bool );
307 314
308 private: 315 private:
309 int mKBFcounter; 316 int mKBFcounter;
310 QTimer* mComputeLayoutTimer; 317 QTimer* mComputeLayoutTimer;
311 NavigatorBar* mNavigatorBar; 318 NavigatorBar* mNavigatorBar;
312 int currentWeek(); 319 int currentWeek();
313 bool clPending; 320 bool clPending;
314 QWidgetStack * mWidStack; 321 Q3WidgetStack * mWidStack;
315 QWidget* mMonthView; 322 QWidget* mMonthView;
316 QWidget* mWeekView; 323 QWidget* mWeekView;
317 bool mShowWeekView; 324 bool mShowWeekView;
318 bool updatePossible; 325 bool updatePossible;
319 int mDaysPerWeek; 326 int mDaysPerWeek;
320 int mNumWeeks; 327 int mNumWeeks;
321 int mNumCells; 328 int mNumCells;
322 //bool mWeekStartsMonday; 329 //bool mWeekStartsMonday;
323 bool mShowSatSunComp; 330 bool mShowSatSunComp;
324 void computeLayout(); 331 void computeLayout();
325 void computeLayoutWeek(); 332 void computeLayoutWeek();
326 void doComputeLayoutWeek(); 333 void doComputeLayoutWeek();
327 334
328 QPtrVector<MonthViewCell> mCells; 335 Q3PtrVector<MonthViewCell> mCells;
329 QPtrVector<QLabel> mDayLabels; 336 Q3PtrVector<QLabel> mDayLabels;
330 QPtrVector<KOWeekButton> mWeekLabels; 337 Q3PtrVector<KOWeekButton> mWeekLabels;
331 QPtrVector<MonthViewCell> mCellsW; 338 Q3PtrVector<MonthViewCell> mCellsW;
332 QPtrVector<QLabel> mDayLabelsW; 339 Q3PtrVector<QLabel> mDayLabelsW;
333 QPtrVector<KOWeekButton> mWeekLabelsW; 340 Q3PtrVector<KOWeekButton> mWeekLabelsW;
334 341
335 bool mShortDayLabelsM; 342 bool mShortDayLabelsM;
336 bool mShortDayLabelsW; 343 bool mShortDayLabelsW;
337 int mWidthLongDayLabel; 344 int mWidthLongDayLabel;
338 345
339 QDate mStartDate; 346 QDate mStartDate;
340 347
341 MonthViewCell *mSelectedCell; 348 MonthViewCell *mSelectedCell;
342 MonthViewCell *mPopupCell; 349 MonthViewCell *mPopupCell;
343 bool mFlagKeyPressed; 350 bool mFlagKeyPressed;
344 KOEventPopupMenu *mContextMenu; 351 KOEventPopupMenu *mContextMenu;
345 QPopupMenu *mNewItemMenu; 352 Q3PopupMenu *mNewItemMenu;
346 void keyPressEvent ( QKeyEvent * ) ; 353 void keyPressEvent ( QKeyEvent * ) ;
347 void keyReleaseEvent ( QKeyEvent * ) ; 354 void keyReleaseEvent ( QKeyEvent * ) ;
348 355
349}; 356};
350 357
351#endif 358#endif
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 5078c57..0bd46ea 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -13,33 +13,33 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <time.h> 24#include <time.h>
25#ifndef _WIN32_ 25#ifndef _WIN32_
26#include <unistd.h> 26#include <unistd.h>
27#endif 27#endif
28#include <qdir.h> 28#include <qdir.h>
29#include <qtextstream.h> 29#include <q3textstream.h>
30#include <qtextcodec.h> 30#include <qtextcodec.h>
31#include <qstring.h> 31#include <qstring.h>
32#include <qregexp.h> 32#include <qregexp.h>
33#include <qfont.h> 33#include <qfont.h>
34#include <qcolor.h> 34#include <qcolor.h>
35#include <qstringlist.h> 35#include <qstringlist.h>
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kglobalsettings.h> 39#include <kglobalsettings.h>
40#include <kconfig.h> 40#include <kconfig.h>
41#include <klocale.h> 41#include <klocale.h>
42#include <kdebug.h> 42#include <kdebug.h>
43#include <kemailsettings.h> 43#include <kemailsettings.h>
44#include <kstaticdeleter.h> 44#include <kstaticdeleter.h>
45#include <libkdepim/kpimglobalprefs.h> 45#include <libkdepim/kpimglobalprefs.h>
@@ -292,39 +292,39 @@ KOPrefs::KOPrefs() :
292 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 292 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
293 addItemBool("Full View Month",&mFullViewMonth,true); 293 addItemBool("Full View Month",&mFullViewMonth,true);
294 addItemBool("Full View Todo",&mFullViewTodo,true); 294 addItemBool("Full View Todo",&mFullViewTodo,true);
295 addItemBool("Quick Todo",&mEnableQuickTodo,false); 295 addItemBool("Quick Todo",&mEnableQuickTodo,false);
296 296
297 addItemInt("Next X Days",&mNextXDays,3); 297 addItemInt("Next X Days",&mNextXDays,3);
298 298
299 KPrefs::setCurrentGroup("Printer"); 299 KPrefs::setCurrentGroup("Printer");
300 300
301 KPrefs::setCurrentGroup("Layout"); 301 KPrefs::setCurrentGroup("Layout");
302 302
303 addItemBool("CompactDialogs",&mCompactDialogs,false); 303 addItemBool("CompactDialogs",&mCompactDialogs,false);
304 addItemBool("VerticalScreen",&mVerticalScreen,true); 304 addItemBool("VerticalScreen",&mVerticalScreen,true);
305 305
306 KPrefs::setCurrentGroup("KOrganizer Plugins"); 306 KPrefs::setCurrentGroup("KOrganizer Plugins");
307 307
308 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 308 addItemStringList("SelectedPlugins",&mSelectedPlugins,QStringList("holidays"));
309 309
310 KPrefs::setCurrentGroup("Group Scheduling"); 310 KPrefs::setCurrentGroup("Group Scheduling");
311 311
312 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 312 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
313 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 313 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
314 addItemStringList("AdditionalMails",&mAdditionalMails,""); 314 addItemStringList("AdditionalMails",&mAdditionalMails,QStringList());
315 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 315 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
316 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 316 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
317 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 317 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
318 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 318 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
319 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 319 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
320 320
321 KPrefs::setCurrentGroup( "Editors" ); 321 KPrefs::setCurrentGroup( "Editors" );
322 322
323 addItemStringList( "EventTemplates", &mEventTemplates ); 323 addItemStringList( "EventTemplates", &mEventTemplates );
324 addItemStringList( "TodoTemplates", &mTodoTemplates ); 324 addItemStringList( "TodoTemplates", &mTodoTemplates );
325 325
326 addItemInt("DestinationPolicy",&mDestination,standardDestination); 326 addItemInt("DestinationPolicy",&mDestination,standardDestination);
327 327
328 KPrefs::setCurrentGroup( "ViewOptions" ); 328 KPrefs::setCurrentGroup( "ViewOptions" );
329 addItemBool("EVshowDetails",&mEVshowDetails,true); 329 addItemBool("EVshowDetails",&mEVshowDetails,true);
330 addItemBool("EVshowCreated",&mEVshowCreated,true); 330 addItemBool("EVshowCreated",&mEVshowCreated,true);
@@ -553,33 +553,33 @@ QString KOPrefs::calName( int calNum) const
553} 553}
554QColor KOPrefs::defaultColor( int calNum ) const 554QColor KOPrefs::defaultColor( int calNum ) const
555{ 555{
556 if ( calNum == 1 ) return mEventColor; 556 if ( calNum == 1 ) return mEventColor;
557 return (mDefCalColors[calNum-1])->mDefaultColor; 557 return (mDefCalColors[calNum-1])->mDefaultColor;
558} 558}
559void KOPrefs::usrWriteConfig() 559void KOPrefs::usrWriteConfig()
560{ 560{
561 config()->setGroup("General"); 561 config()->setGroup("General");
562 config()->writeEntry("Custom Categories",mCustomCategories); 562 config()->writeEntry("Custom Categories",mCustomCategories);
563 563
564 config()->setGroup("Personal Settings"); 564 config()->setGroup("Personal Settings");
565 config()->writeEntry("user_name",mName); 565 config()->writeEntry("user_name",mName);
566 config()->writeEntry("user_email",mEmail); 566 config()->writeEntry("user_email",mEmail);
567 567
568 config()->setGroup("Category Colors"); 568 config()->setGroup("Category Colors");
569 QDictIterator<QColor> it(mCategoryColors); 569 Q3DictIterator<QColor> it(mCategoryColors);
570 while (it.current()) { 570 while (it.current()) {
571 config()->writeEntry(it.currentKey(),*(it.current())); 571 config()->writeEntry(it.currentKey(),*(it.current()));
572 ++it; 572 ++it;
573 } 573 }
574 KConfig fc (locateLocal("config","kopicalendarrc")); 574 KConfig fc (locateLocal("config","kopicalendarrc"));
575 fc.setGroup("CC"); 575 fc.setGroup("CC");
576 fc.deleteGroup( "CC"); 576 fc.deleteGroup( "CC");
577 fc.setGroup("CC"); 577 fc.setGroup("CC");
578 fc.writeEntry("NumberCalendars",mCalendars.count()); 578 fc.writeEntry("NumberCalendars",mCalendars.count());
579 int numCal = 1; 579 int numCal = 1;
580 int writeCal = 0; 580 int writeCal = 0;
581 while ( numCal < mNextAvailableCalendar ) { 581 while ( numCal < mNextAvailableCalendar ) {
582 KopiCalendarFile * kkf = mCalendars.first(); 582 KopiCalendarFile * kkf = mCalendars.first();
583 while ( kkf ) { 583 while ( kkf ) {
584 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); 584 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal);
585 if ( kkf->mCalNumber == numCal ) { 585 if ( kkf->mCalNumber == numCal ) {
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 94bdd33..35c6110 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -12,35 +12,38 @@
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOPREFS_H 23#ifndef KOPREFS_H
24#define KOPREFS_H 24#define KOPREFS_H
25 25
26 26
27#include <libkdepim/kpimprefs.h> 27#include <libkdepim/kpimprefs.h>
28#include <qdict.h> 28#include <q3dict.h>
29#include <qdir.h> 29#include <qdir.h>
30#include <qobject.h> 30#include <qobject.h>
31#include <QDateTime>
32//Added by qt3to4:
33#include <Q3PtrList>
31 34
32class KConfig; 35class KConfig;
33class QFont; 36class QFont;
34class QColor; 37class QColor;
35class QStringList; 38class QStringList;
36 39
37#define VIEW_WN_VIEW 1 40#define VIEW_WN_VIEW 1
38#define VIEW_NX_VIEW 2 41#define VIEW_NX_VIEW 2
39#define VIEW_J_VIEW 3 42#define VIEW_J_VIEW 3
40#define VIEW_A_VIEW 4 43#define VIEW_A_VIEW 4
41#define VIEW_ML_VIEW 5 44#define VIEW_ML_VIEW 5
42#define VIEW_M_VIEW 6 45#define VIEW_M_VIEW 6
43#define VIEW_L_VIEW 7 46#define VIEW_L_VIEW 7
44#define VIEW_T_VIEW 8 47#define VIEW_T_VIEW 8
45 48
46class KopiCalendarFile : public QObject 49class KopiCalendarFile : public QObject
@@ -334,44 +337,44 @@ class KOPrefs : public KPimPrefs
334 int mOldLanguage; 337 int mOldLanguage;
335 int mOldLoadedLanguage; 338 int mOldLoadedLanguage;
336 339
337 340
338 QString mActiveSyncPort; 341 QString mActiveSyncPort;
339 QString mActiveSyncIP; 342 QString mActiveSyncIP;
340 343
341 // settings for eventviewer 344 // settings for eventviewer
342 bool mEVshowDetails; 345 bool mEVshowDetails;
343 bool mEVshowCreated; 346 bool mEVshowCreated;
344 bool mEVshowChanged; 347 bool mEVshowChanged;
345 bool mWTshowDetails; 348 bool mWTshowDetails;
346 bool mWTshowCreated; 349 bool mWTshowCreated;
347 bool mWTshowChanged; 350 bool mWTshowChanged;
348 351
349 int mCurrentDisplayedView; 352 int mCurrentDisplayedView;
350 QPtrList<KopiCalendarFile> mCalendars; 353 Q3PtrList<KopiCalendarFile> mCalendars;
351 int mNextAvailableCalendar; 354 int mNextAvailableCalendar;
352 bool mGlobalUpdateDisabled; 355 bool mGlobalUpdateDisabled;
353 356
354 357
355 bool mDetectConflicts; 358 bool mDetectConflicts;
356 bool mIncludeFree; 359 bool mIncludeFree;
357 bool mCheckConflictsAllDayAllDay; 360 bool mCheckConflictsAllDayAllDay;
358 bool mCheckConflictsAllDayNonAD; 361 bool mCheckConflictsAllDayNonAD;
359 bool mCheckConflictsNonADAllDay; 362 bool mCheckConflictsNonADAllDay;
360 bool mCheckConflictsNonADNonAD; 363 bool mCheckConflictsNonADNonAD;
361 QString mFilterConflictEditItem; 364 QString mFilterConflictEditItem;
362 QString mFilterConflictAllItem; 365 QString mFilterConflictAllItem;
363 366
364 private: 367 private:
365 QDict<QColor> mCategoryColors; 368 Q3Dict<QColor> mCategoryColors;
366 QArray<KopiCalendarFile*> mDefCalColors; 369 QVector<KopiCalendarFile*> mDefCalColors;
367 QColor mDefaultCategoryColor; 370 QColor mDefaultCategoryColor;
368 371
369 QFont mDefaultTimeBarFont; 372 QFont mDefaultTimeBarFont;
370 QFont mDefaultViewFont; 373 QFont mDefaultViewFont;
371 QFont mDefaultMonthViewFont; 374 QFont mDefaultMonthViewFont;
372 375
373 QString mName; 376 QString mName;
374 QString mEmail; 377 QString mEmail;
375}; 378};
376 379
377#endif 380#endif
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index f1a6c3d..43c488f 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -10,50 +10,56 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qgroupbox.h> 26#include <q3groupbox.h>
27#include <qbuttongroup.h> 27#include <q3buttongroup.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qfont.h> 29#include <qfont.h>
30#include <qslider.h> 30#include <qslider.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qtextstream.h> 32#include <q3textstream.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qvbox.h> 34#include <q3vbox.h>
35#include <qhbox.h> 35#include <q3hbox.h>
36#include <qregexp.h> 36#include <qregexp.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qdatetime.h> 38#include <qdatetime.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qradiobutton.h> 40#include <qradiobutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qstrlist.h> 42#include <q3strlist.h>
43#include <qapplication.h> 43#include <qapplication.h>
44#include <QDesktopWidget>
45//Added by qt3to4:
46#include <Q3HBoxLayout>
47#include <Q3GridLayout>
48#include <QPixmap>
49#include <Q3Frame>
44 50
45#include <kcolorbutton.h> 51#include <kcolorbutton.h>
46#include <kdebug.h> 52#include <kdebug.h>
47#include <klocale.h> 53#include <klocale.h>
48#include <kglobal.h> 54#include <kglobal.h>
49#include <kfontdialog.h> 55#include <kfontdialog.h>
50#include <kfiledialog.h> 56#include <kfiledialog.h>
51#include <kmessagebox.h> 57#include <kmessagebox.h>
52#include <kcolordialog.h> 58#include <kcolordialog.h>
53#include <kiconloader.h> 59#include <kiconloader.h>
54#include <kemailsettings.h> 60#include <kemailsettings.h>
55#include <kstandarddirs.h> 61#include <kstandarddirs.h>
56#include <kglobalsettings.h> 62#include <kglobalsettings.h>
57 63
58#include <kurlrequester.h> 64#include <kurlrequester.h>
59#include <klineedit.h> 65#include <klineedit.h>
@@ -103,34 +109,34 @@ KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
103 109
104 110
105} 111}
106 112
107 113
108KOPrefsDialog::~KOPrefsDialog() 114KOPrefsDialog::~KOPrefsDialog()
109{ 115{
110} 116}
111void KOPrefsDialog::setupGlobalTab() 117void KOPrefsDialog::setupGlobalTab()
112{ 118{
113 119
114 120
115} 121}
116void KOPrefsDialog::setupLocaleDateTab() 122void KOPrefsDialog::setupLocaleDateTab()
117{ 123{
118#if 0 124#if 0
119QFrame *topFrame = addPage(i18n("Date Format"),0,0); 125Q3Frame *topFrame = addPage(i18n("Date Format"),0,0);
120 QGridLayout *topLayout = new QGridLayout(topFrame,3,2); 126 Q3GridLayout *topLayout = new Q3GridLayout(topFrame,3,2);
121 topLayout->setSpacing(mSpacingHint); 127 topLayout->setSpacing(mSpacingHint);
122 topLayout->setMargin(mMarginHint); 128 topLayout->setMargin(mMarginHint);
123 int iii = 0; 129 int iii = 0;
124 130
125 131
126 KPrefsDialogWidRadios *syncPrefsGroup = 132 KPrefsDialogWidRadios *syncPrefsGroup =
127 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); 133 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
128 QString format; 134 QString format;
129 if ( QApplication::desktop()->width() < 480 ) 135 if ( QApplication::desktop()->width() < 480 )
130 format = "(%d.%m.%Y)"; 136 format = "(%d.%m.%Y)";
131 else 137 else
132 format = "(%d.%m.%Y|%A %d %B %Y)"; 138 format = "(%d.%m.%Y|%A %d %B %Y)";
133 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 139 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
134 if ( QApplication::desktop()->width() < 480 ) 140 if ( QApplication::desktop()->width() < 480 )
135 format = "(%m.%d.%Y)"; 141 format = "(%m.%d.%Y)";
136 else 142 else
@@ -159,34 +165,34 @@ QFrame *topFrame = addPage(i18n("Date Format"),0,0);
159 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); 165 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
160 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 166 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
161 ++iii; 167 ++iii;
162 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); 168 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
163 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 169 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
164 ++iii; 170 ++iii;
165 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); 171 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
166 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 172 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
167 ++iii; 173 ++iii;
168#endif 174#endif
169 175
170} 176}
171 177
172void KOPrefsDialog::setupLocaleTab() 178void KOPrefsDialog::setupLocaleTab()
173{ 179{
174#if 0 180#if 0
175 QFrame *topFrame = addPage(i18n("Locale"),0,0); 181 Q3Frame *topFrame = addPage(i18n("Locale"),0,0);
176 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 182 Q3GridLayout *topLayout = new Q3GridLayout(topFrame,4,2);
177 topLayout->setSpacing(mSpacingHint); 183 topLayout->setSpacing(mSpacingHint);
178 topLayout->setMargin(mMarginHint); 184 topLayout->setMargin(mMarginHint);
179 int iii = 0; 185 int iii = 0;
180 KPrefsDialogWidRadios *syncPrefsGroup = 186 KPrefsDialogWidRadios *syncPrefsGroup =
181 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); 187 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame);
182 syncPrefsGroup->addRadio(i18n("English")); 188 syncPrefsGroup->addRadio(i18n("English"));
183 syncPrefsGroup->addRadio(i18n("German")); 189 syncPrefsGroup->addRadio(i18n("German"));
184 syncPrefsGroup->addRadio(i18n("French")); 190 syncPrefsGroup->addRadio(i18n("French"));
185 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 191 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
186 if ( QApplication::desktop()->width() < 300 ) 192 if ( QApplication::desktop()->width() < 300 )
187 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 193 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
188 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 194 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
189 ++iii; 195 ++iii;
190 196
191 syncPrefsGroup = 197 syncPrefsGroup =
192 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); 198 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame);
@@ -198,61 +204,61 @@ void KOPrefsDialog::setupLocaleTab()
198 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 204 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
199 ++iii; 205 ++iii;
200 KPrefsDialogWidBool *sb; 206 KPrefsDialogWidBool *sb;
201 if ( QApplication::desktop()->width() < 300 ) { 207 if ( QApplication::desktop()->width() < 300 ) {
202 sb = 208 sb =
203 addWidBool(i18n("Week starts on Sunday"), 209 addWidBool(i18n("Week starts on Sunday"),
204 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); 210 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame);
205 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 211 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
206 ++iii; 212 ++iii;
207 sb = 213 sb =
208 addWidBool(i18n("Use short date in (WN/E) view"), 214 addWidBool(i18n("Use short date in (WN/E) view"),
209 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 215 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
210 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 216 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
211 } 217 }
212 else { 218 else {
213 QWidget * hb = new QWidget( topFrame ); 219 QWidget * hb = new QWidget( topFrame );
214 QHBoxLayout *hbLayout = new QHBoxLayout(hb); 220 Q3HBoxLayout *hbLayout = new Q3HBoxLayout(hb);
215 sb = 221 sb =
216 addWidBool(i18n("Week starts on Sunday"), 222 addWidBool(i18n("Week starts on Sunday"),
217 &(KOPrefs::instance()->mWeekStartsOnSunday),hb); 223 &(KOPrefs::instance()->mWeekStartsOnSunday),hb);
218 hbLayout->addWidget(sb->checkBox() ); 224 hbLayout->addWidget(sb->checkBox() );
219 sb = 225 sb =
220 addWidBool(i18n("Use short date in (WN/E) view"), 226 addWidBool(i18n("Use short date in (WN/E) view"),
221 &(KOPrefs::instance()->mShortDateInViewer),hb); 227 &(KOPrefs::instance()->mShortDateInViewer),hb);
222 hbLayout->addWidget(sb->checkBox() ); 228 hbLayout->addWidget(sb->checkBox() );
223 topLayout->addMultiCellWidget(hb, iii,iii,0,1); 229 topLayout->addMultiCellWidget(hb, iii,iii,0,1);
224 230
225 } 231 }
226 // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION 232 // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION
227#if 0 233#if 0
228 ++iii; 234 ++iii;
229 sb = 235 sb =
230 addWidBool(i18n("Quick load/save (w/o Unicode)"), 236 addWidBool(i18n("Quick load/save (w/o Unicode)"),
231 &(KOPrefs::instance()->mUseQuicksave),topFrame); 237 &(KOPrefs::instance()->mUseQuicksave),topFrame);
232 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 238 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
233#endif 239#endif
234#endif 240#endif
235} 241}
236 242
237void KOPrefsDialog::setupMainTab() 243void KOPrefsDialog::setupMainTab()
238{ 244{
239 QFrame *topFrame = addPage(i18n("General"),0,0); 245 Q3Frame *topFrame = addPage(i18n("General"),0,0);
240 // DesktopIcon("identity",KIcon::SizeMedium)); 246 // DesktopIcon("identity",KIcon::SizeMedium));
241 247
242 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 248 Q3GridLayout *topLayout = new Q3GridLayout(topFrame,5,2);
243 topLayout->setSpacing(mSpacingHint); 249 topLayout->setSpacing(mSpacingHint);
244 topLayout->setMargin(mMarginHint); 250 topLayout->setMargin(mMarginHint);
245 251
246 // KPrefsDialogWidBool *emailControlCenter = 252 // KPrefsDialogWidBool *emailControlCenter =
247// addWidBool(i18n("&Use email settings from Control Center"), 253// addWidBool(i18n("&Use email settings from Control Center"),
248// &(KOPrefs::instance()->mEmailControlCenter),topFrame); 254// &(KOPrefs::instance()->mEmailControlCenter),topFrame);
249// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); 255// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1);
250 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), 256 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)),
251 // SLOT(toggleEmailSettings(bool))); 257 // SLOT(toggleEmailSettings(bool)));
252 258
253 mNameEdit = new QLineEdit(topFrame); 259 mNameEdit = new QLineEdit(topFrame);
254 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); 260 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
255 topLayout->addWidget(mNameLabel,0,0); 261 topLayout->addWidget(mNameLabel,0,0);
256 topLayout->addWidget(mNameEdit,0,1); 262 topLayout->addWidget(mNameEdit,0,1);
257 263
258 mEmailEdit = new QLineEdit(topFrame); 264 mEmailEdit = new QLineEdit(topFrame);
@@ -274,59 +280,59 @@ void KOPrefsDialog::setupMainTab()
274 280
275 281
276 KPrefsDialogWidBool *verticalScreen = 282 KPrefsDialogWidBool *verticalScreen =
277 addWidBool(i18n("Vertical screen layout(Needs restart)"), 283 addWidBool(i18n("Vertical screen layout(Needs restart)"),
278 &(KOPrefs::instance()->mVerticalScreen),topFrame); 284 &(KOPrefs::instance()->mVerticalScreen),topFrame);
279 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); 285 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0);
280 topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1); 286 topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1);
281 287
282 288
283 int iii = 5; 289 int iii = 5;
284 widbool = addWidBool(i18n("Block popup until mouse button release"), 290 widbool = addWidBool(i18n("Block popup until mouse button release"),
285 &(KOPrefs::instance()->mBlockPopupMenu),topFrame); 291 &(KOPrefs::instance()->mBlockPopupMenu),topFrame);
286 topLayout->addMultiCellWidget( widbool->checkBox(), iii,iii,0,1); 292 topLayout->addMultiCellWidget( widbool->checkBox(), iii,iii,0,1);
287 ++iii; 293 ++iii;
288 if ( QApplication::desktop()->height() <= 240 ) { 294 if ( QApplication::desktop()->height() <= 240 ) {
289 topFrame = addPage(i18n("General") +" 2",0,0); 295 topFrame = addPage(i18n("General") +" 2",0,0);
290 topLayout = new QGridLayout(topFrame,4,2); 296 topLayout = new Q3GridLayout(topFrame,4,2);
291 topLayout->setSpacing(2); 297 topLayout->setSpacing(2);
292 topLayout->setMargin(3); 298 topLayout->setMargin(3);
293 iii = 0; 299 iii = 0;
294 } 300 }
295 QHBox *dummy = new QHBox(topFrame); 301 Q3HBox *dummy = new Q3HBox(topFrame);
296 new QLabel(i18n("Days in Next-X-Days:"),dummy); 302 new QLabel(i18n("Days in Next-X-Days:"),dummy);
297 mNextXDaysSpin = new QSpinBox(2,14,1,dummy); 303 mNextXDaysSpin = new QSpinBox(2,14,1,dummy);
298 304
299 topLayout->addMultiCellWidget(dummy,iii,iii,0,1); 305 topLayout->addMultiCellWidget(dummy,iii,iii,0,1);
300 306
301 ++iii; 307 ++iii;
302 308
303 309
304 // KPrefsDialogWidBool *bcc = 310 // KPrefsDialogWidBool *bcc =
305// addWidBool(i18n("Send copy to owner when mailing events"), 311// addWidBool(i18n("Send copy to owner when mailing events"),
306// &(KOPrefs::instance()->mBcc),topFrame); 312// &(KOPrefs::instance()->mBcc),topFrame);
307// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); 313// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1);
308 314
309 315
310 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); 316 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame);
311 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); 317 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1);
312 318
313 // addWidBool(i18n("Enable automatic saving of calendar"), 319 // addWidBool(i18n("Enable automatic saving of calendar"),
314 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); 320 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup);
315 321
316 QHBox *intervalBox = new QHBox(topFrame); 322 Q3HBox *intervalBox = new Q3HBox(topFrame);
317 // intervalBox->setSpacing(mSpacingHint); 323 // intervalBox->setSpacing(mSpacingHint);
318 topLayout->addMultiCellWidget(intervalBox,iii,iii,0,1); 324 topLayout->addMultiCellWidget(intervalBox,iii,iii,0,1);
319 ++iii; 325 ++iii;
320 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); 326 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox);
321 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); 327 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox);
322 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); 328 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin);
323 /* 329 /*
324 QHBox * agendasize = new QHBox ( topFrame ); 330 QHBox * agendasize = new QHBox ( topFrame );
325 331
326 new QLabel (i18n("AllDayAgenda Height:"), agendasize ); 332 new QLabel (i18n("AllDayAgenda Height:"), agendasize );
327 333
328 334
329 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); 335 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize);
330 topLayout->addMultiCellWidget(agendasize,7,7,0,1); 336 topLayout->addMultiCellWidget(agendasize,7,7,0,1);
331 */ 337 */
332 338
@@ -389,116 +395,116 @@ void KOPrefsDialog::setupMainTab()
389 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); 395 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1);
390 396
391 KPrefsDialogWidRadios *destinationGroup = 397 KPrefsDialogWidRadios *destinationGroup =
392 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), 398 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination),
393 topFrame); 399 topFrame);
394 destinationGroup->addRadio(i18n("be added to the standard resource")); 400 destinationGroup->addRadio(i18n("be added to the standard resource"));
395 destinationGroup->addRadio(i18n("be asked which resource to use")); 401 destinationGroup->addRadio(i18n("be asked which resource to use"));
396 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); 402 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1);
397 403
398 topLayout->setRowStretch(14,1); 404 topLayout->setRowStretch(14,1);
399 */ 405 */
400} 406}
401 407
402 408
403void KOPrefsDialog::setupTimeTab() 409void KOPrefsDialog::setupTimeTab()
404{ 410{
405 QFrame *topFrame = addPage(i18n("Time"),0,0); 411 Q3Frame *topFrame = addPage(i18n("Time"),0,0);
406 // DesktopIcon("clock",KIcon::SizeMedium)); 412 // DesktopIcon("clock",KIcon::SizeMedium));
407 413
408 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 414 Q3GridLayout *topLayout = new Q3GridLayout(topFrame,4,2);
409 topLayout->setSpacing(mSpacingHint); 415 topLayout->setSpacing(mSpacingHint);
410 topLayout->setMargin(mMarginHint); 416 topLayout->setMargin(mMarginHint);
411 417
412 QHBox *dummy = new QHBox(topFrame); 418 Q3HBox *dummy = new Q3HBox(topFrame);
413 KPrefsDialogWidTime *dayBegins = 419 KPrefsDialogWidTime *dayBegins =
414 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 420 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
415 dummy); 421 dummy);
416 //topLayout->addWidget(dayBegins->label(),2,0); 422 //topLayout->addWidget(dayBegins->label(),2,0);
417 423
418 //topLayout->addWidget(dayBegins->spinBox(),2,1); 424 //topLayout->addWidget(dayBegins->spinBox(),2,1);
419 topLayout->addMultiCellWidget(dummy,0,0,0,1); 425 topLayout->addMultiCellWidget(dummy,0,0,0,1);
420 426
421 topLayout->addWidget(new QLabel(i18n("Default appointment time:"), 427 topLayout->addWidget(new QLabel(i18n("Default appointment time:"),
422 topFrame),1,0); 428 topFrame),1,0);
423 mStartTimeSpin = new QSpinBox(0,23,1,topFrame); 429 mStartTimeSpin = new QSpinBox(0,23,1,topFrame);
424 mStartTimeSpin->setSuffix(":00"); 430 mStartTimeSpin->setSuffix(":00");
425 topLayout->addWidget(mStartTimeSpin,1,1); 431 topLayout->addWidget(mStartTimeSpin,1,1);
426 432
427 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), 433 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"),
428 topFrame),2,0); 434 topFrame),2,0);
429 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); 435 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame);
430 mDefaultDurationSpin->setSuffix(":00"); 436 mDefaultDurationSpin->setSuffix(":00");
431 topLayout->addWidget(mDefaultDurationSpin,2,1); 437 topLayout->addWidget(mDefaultDurationSpin,2,1);
432 438
433 QStringList alarmList; 439 QStringList alarmList;
434 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") 440 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes")
435 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; 441 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ;
436 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), 442 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame),
437 3,0); 443 3,0);
438 mAlarmTimeCombo = new QComboBox(topFrame); 444 mAlarmTimeCombo = new QComboBox(topFrame);
439 mAlarmTimeCombo->insertStringList(alarmList); 445 mAlarmTimeCombo->insertStringList(alarmList);
440 topLayout->addWidget(mAlarmTimeCombo,3,1); 446 topLayout->addWidget(mAlarmTimeCombo,3,1);
441 int iii = 4; 447 int iii = 4;
442 if ( QApplication::desktop()->height() <= 240 ) { 448 if ( QApplication::desktop()->height() <= 240 ) {
443 topFrame = addPage(i18n("Time") +" 2",0,0); 449 topFrame = addPage(i18n("Time") +" 2",0,0);
444 topLayout = new QGridLayout(topFrame,1,2); 450 topLayout = new Q3GridLayout(topFrame,1,2);
445 topLayout->setSpacing(2); 451 topLayout->setSpacing(2);
446 topLayout->setMargin(3); 452 topLayout->setMargin(3);
447 iii = 0; 453 iii = 0;
448 } 454 }
449 455
450 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, 456 Q3GroupBox *workingHoursGroup = new Q3GroupBox(1,Qt::Horizontal,
451 i18n("Working Hours"), 457 i18n("Working Hours"),
452 topFrame); 458 topFrame);
453 topLayout->addMultiCellWidget(workingHoursGroup,iii,iii,0,1); 459 topLayout->addMultiCellWidget(workingHoursGroup,iii,iii,0,1);
454 workingHoursGroup->layout()->setSpacing( 0 ); 460 workingHoursGroup->layout()->setSpacing( 0 );
455 workingHoursGroup->layout()->setMargin( 4 ); 461 workingHoursGroup->layout()->setMargin( 4 );
456 QHBox *workStartBox = new QHBox(workingHoursGroup); 462 Q3HBox *workStartBox = new Q3HBox(workingHoursGroup);
457 // workStartBox->setMargin( 0 ); 463 // workStartBox->setMargin( 0 );
458 addWidTime(i18n("Daily starting hour:"), 464 addWidTime(i18n("Daily starting hour:"),
459 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); 465 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox);
460 466
461 QHBox *workEndBox = new QHBox(workingHoursGroup); 467 Q3HBox *workEndBox = new Q3HBox(workingHoursGroup);
462 //workEndBox->setMargin( 0 ); 468 //workEndBox->setMargin( 0 );
463 addWidTime(i18n("Daily ending hour:"), 469 addWidTime(i18n("Daily ending hour:"),
464 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); 470 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox);
465 QVBox *excludeBox = new QVBox(workingHoursGroup); 471 Q3VBox *excludeBox = new Q3VBox(workingHoursGroup);
466 //excludeBox->setMargin( 0 ); 472 //excludeBox->setMargin( 0 );
467 addWidBool(i18n("Exclude holidays"), 473 addWidBool(i18n("Exclude holidays"),
468 &(KOPrefs::instance()->mExcludeHolidays),excludeBox); 474 &(KOPrefs::instance()->mExcludeHolidays),excludeBox);
469 475
470 addWidBool(i18n("Exclude Saturdays"), 476 addWidBool(i18n("Exclude Saturdays"),
471 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); 477 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox);
472 478
473// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), 479// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"),
474 // &(KOPrefs::instance()->mMarcusBainsShowSeconds), 480 // &(KOPrefs::instance()->mMarcusBainsShowSeconds),
475 // topFrame); 481 // topFrame);
476// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); 482// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0);
477 483
478 // topLayout->setRowStretch(6,1); 484 // topLayout->setRowStretch(6,1);
479} 485}
480 486
481 487
482void KOPrefsDialog::setupViewsTab() 488void KOPrefsDialog::setupViewsTab()
483{ 489{
484 490
485 QFrame *topFrame = addPage(i18n("Views"),0,0); 491 Q3Frame *topFrame = addPage(i18n("Views"),0,0);
486 // DesktopIcon("viewmag",KIcon::SizeMedium)); 492 // DesktopIcon("viewmag",KIcon::SizeMedium));
487 493
488 QGridLayout *topLayout = new QGridLayout(topFrame,6,1); 494 Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,1);
489 topLayout->setSpacing(mSpacingHint); 495 topLayout->setSpacing(mSpacingHint);
490 topLayout->setMargin(mMarginHint); 496 topLayout->setMargin(mMarginHint);
491 497
492// QBoxLayout *dayBeginsLayout = new QHBoxLayout; 498// QBoxLayout *dayBeginsLayout = new QHBoxLayout;
493// topLayout->addLayout(dayBeginsLayout,0,0); 499// topLayout->addLayout(dayBeginsLayout,0,0);
494 500
495// KPrefsDialogWidTime *dayBegins = 501// KPrefsDialogWidTime *dayBegins =
496// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 502// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
497// topFrame); 503// topFrame);
498// dayBeginsLayout->addWidget(dayBegins->label()); 504// dayBeginsLayout->addWidget(dayBegins->label());
499// dayBeginsLayout->addStretch(1); 505// dayBeginsLayout->addStretch(1);
500// dayBeginsLayout->addWidget(dayBegins->spinBox()); 506// dayBeginsLayout->addWidget(dayBegins->spinBox());
501 507
502// QBoxLayout *nextDaysLayout = new QHBoxLayout; 508// QBoxLayout *nextDaysLayout = new QHBoxLayout;
503// topLayout->addLayout(nextDaysLayout,1,0); 509// topLayout->addLayout(nextDaysLayout,1,0);
504// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); 510// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame));
@@ -517,33 +523,33 @@ void KOPrefsDialog::setupViewsTab()
517 523
518 524
519 525
520 526
521 // topLayout->addWidget(hourSizeGroup,ii++,0); 527 // topLayout->addWidget(hourSizeGroup,ii++,0);
522 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); 528 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0);
523 //topLayout->setRowStretch(11,1); 529 //topLayout->setRowStretch(11,1);
524 530
525 531
526 532
527 533
528#if 0 534#if 0
529 535
530 topFrame = addPage(i18n("ViewChange"),0,0); 536 topFrame = addPage(i18n("ViewChange"),0,0);
531 // DesktopIcon("viewmag",KIcon::SizeMedium)); 537 // DesktopIcon("viewmag",KIcon::SizeMedium));
532 538
533 topLayout = new QGridLayout(topFrame,6,1); 539 topLayout = new Q3GridLayout(topFrame,6,1);
534 topLayout->setSpacing(mSpacingHint); 540 topLayout->setSpacing(mSpacingHint);
535 topLayout->setMargin(mMarginHint); 541 topLayout->setMargin(mMarginHint);
536 ii = 0; 542 ii = 0;
537 543
538#endif 544#endif
539 545
540 dummy = 546 dummy =
541 addWidBool(i18n("Hold fullscreen on view change"), 547 addWidBool(i18n("Hold fullscreen on view change"),
542 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); 548 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame);
543 topLayout->addWidget(dummy->checkBox(),ii++,0); 549 topLayout->addWidget(dummy->checkBox(),ii++,0);
544 550
545 dummy = 551 dummy =
546 addWidBool(i18n("Hold non-fullscreen on view change"), 552 addWidBool(i18n("Hold non-fullscreen on view change"),
547 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); 553 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame);
548 topLayout->addWidget(dummy->checkBox(),ii++,0); 554 topLayout->addWidget(dummy->checkBox(),ii++,0);
549 555
@@ -581,33 +587,33 @@ void KOPrefsDialog::setupViewsTab()
581 weeklyRecur = 587 weeklyRecur =
582 addWidBool(i18n("Show multiday allday ev. in date nav."), 588 addWidBool(i18n("Show multiday allday ev. in date nav."),
583 &(KOPrefs::instance()->mLongAllday),topFrame); 589 &(KOPrefs::instance()->mLongAllday),topFrame);
584 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); 590 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0);
585 591
586#ifdef DESKTOP_VERSION 592#ifdef DESKTOP_VERSION
587 KPrefsDialogWidBool *enableToolTips = 593 KPrefsDialogWidBool *enableToolTips =
588 addWidBool(i18n("Enable tooltips displaying summary of ev."), 594 addWidBool(i18n("Enable tooltips displaying summary of ev."),
589 &(KOPrefs::instance()->mEnableToolTips),topFrame); 595 &(KOPrefs::instance()->mEnableToolTips),topFrame);
590 topLayout->addWidget(enableToolTips->checkBox(),ii++,0); 596 topLayout->addWidget(enableToolTips->checkBox(),ii++,0);
591#endif 597#endif
592 // ********************************************************* 598 // *********************************************************
593 599
594 topFrame = addPage(i18n("Agenda View"),0,0); 600 topFrame = addPage(i18n("Agenda View"),0,0);
595 // DesktopIcon("viewmag",KIcon::SizeMedium)); 601 // DesktopIcon("viewmag",KIcon::SizeMedium));
596 602
597 topLayout = new QGridLayout(topFrame,5,1); 603 topLayout = new Q3GridLayout(topFrame,5,1);
598 topLayout->setSpacing(mSpacingHint); 604 topLayout->setSpacing(mSpacingHint);
599 topLayout->setMargin(mMarginHint); 605 topLayout->setMargin(mMarginHint);
600 ii = 0; 606 ii = 0;
601 607
602 608
603 dummy = 609 dummy =
604 addWidBool(i18n("Show time in agenda items"), 610 addWidBool(i18n("Show time in agenda items"),
605 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); 611 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame);
606 topLayout->addWidget(dummy->checkBox(),ii++,0); 612 topLayout->addWidget(dummy->checkBox(),ii++,0);
607 613
608 dummy = 614 dummy =
609 addWidBool(i18n("Highlight current day in agenda"), 615 addWidBool(i18n("Highlight current day in agenda"),
610 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); 616 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame);
611 topLayout->addWidget(dummy->checkBox(),ii++,0); 617 topLayout->addWidget(dummy->checkBox(),ii++,0);
612 618
613 dummy = 619 dummy =
@@ -639,58 +645,58 @@ void KOPrefsDialog::setupViewsTab()
639 topLayout->addWidget(dummy->checkBox(),ii++,0); 645 topLayout->addWidget(dummy->checkBox(),ii++,0);
640 646
641 647
642 648
643 dummy = 649 dummy =
644 addWidBool(i18n("Agenda view shows completed todos"), 650 addWidBool(i18n("Agenda view shows completed todos"),
645 &(KOPrefs::instance()->mShowCompletedTodoInAgenda),topFrame); 651 &(KOPrefs::instance()->mShowCompletedTodoInAgenda),topFrame);
646 topLayout->addWidget(dummy->checkBox(),ii++,0); 652 topLayout->addWidget(dummy->checkBox(),ii++,0);
647 653
648 654
649 655
650 656
651 657
652 topFrame = addPage(i18n("Month View"),0,0); 658 topFrame = addPage(i18n("Month View"),0,0);
653 // DesktopIcon("viewmag",KIcon::SizeMedium)); 659 // DesktopIcon("viewmag",KIcon::SizeMedium));
654 660
655 topLayout = new QGridLayout(topFrame,5,1); 661 topLayout = new Q3GridLayout(topFrame,5,1);
656 topLayout->setSpacing(mSpacingHint); 662 topLayout->setSpacing(mSpacingHint);
657 topLayout->setMargin(mMarginHint); 663 topLayout->setMargin(mMarginHint);
658 ii = 0; 664 ii = 0;
659 QLabel *lab; 665 QLabel *lab;
660 QHBox *habo = new QHBox( topFrame ); 666 Q3HBox *habo = new Q3HBox( topFrame );
661 if ( QApplication::desktop()->width() <= 480 ) { 667 if ( QApplication::desktop()->width() <= 480 ) {
662 lab = new QLabel ( i18n("Show events that recur "), topFrame ); 668 lab = new QLabel ( i18n("Show events that recur "), topFrame );
663 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 669 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
664 ii++; 670 ii++;
665 } else { 671 } else {
666 new QLabel ( i18n("Show events that recur "), habo ); 672 new QLabel ( i18n("Show events that recur "), habo );
667 } 673 }
668 dailyRecur = 674 dailyRecur =
669 addWidBool(i18n("daily"), 675 addWidBool(i18n("daily"),
670 &(KOPrefs::instance()->mMonthDailyRecur),habo); 676 &(KOPrefs::instance()->mMonthDailyRecur),habo);
671 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 677 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
672 678
673 weeklyRecur = 679 weeklyRecur =
674 addWidBool(i18n("weekly"), 680 addWidBool(i18n("weekly"),
675 &(KOPrefs::instance()->mMonthWeeklyRecur),habo); 681 &(KOPrefs::instance()->mMonthWeeklyRecur),habo);
676 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 682 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
677 ii++; 683 ii++;
678 684
679 685
680 habo = new QHBox( topFrame ); 686 habo = new Q3HBox( topFrame );
681 if ( QApplication::desktop()->width() <= 480 ) { 687 if ( QApplication::desktop()->width() <= 480 ) {
682 lab = new QLabel (i18n("Show in every cell ") , topFrame ); 688 lab = new QLabel (i18n("Show in every cell ") , topFrame );
683 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 689 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
684 ii++; 690 ii++;
685 691
686 } else { 692 } else {
687 new QLabel ( i18n("Show in every cell "), habo ); 693 new QLabel ( i18n("Show in every cell "), habo );
688 } 694 }
689 weeklyRecur = 695 weeklyRecur =
690 addWidBool(i18n("short month"), 696 addWidBool(i18n("short month"),
691 &(KOPrefs::instance()->mMonthShowShort),habo); 697 &(KOPrefs::instance()->mMonthShowShort),habo);
692 weeklyRecur = 698 weeklyRecur =
693 addWidBool(i18n("icons"), 699 addWidBool(i18n("icons"),
694 &(KOPrefs::instance()->mMonthShowIcons),habo); 700 &(KOPrefs::instance()->mMonthShowIcons),habo);
695 weeklyRecur = 701 weeklyRecur =
696 addWidBool(i18n("times"), 702 addWidBool(i18n("times"),
@@ -717,33 +723,33 @@ void KOPrefsDialog::setupViewsTab()
717 topLayout->addWidget(dummy->checkBox(),ii++,0); 723 topLayout->addWidget(dummy->checkBox(),ii++,0);
718 724
719 KPrefsDialogWidBool *coloredCategoriesInMonthView = 725 KPrefsDialogWidBool *coloredCategoriesInMonthView =
720 addWidBool(i18n("Month view uses category colors"), 726 addWidBool(i18n("Month view uses category colors"),
721 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); 727 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame);
722 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 728 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
723 729
724 dummy = 730 dummy =
725 addWidBool(i18n("Category colors are applied to text"), 731 addWidBool(i18n("Category colors are applied to text"),
726 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); 732 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame);
727 topLayout->addWidget(dummy->checkBox(),ii++,0); 733 topLayout->addWidget(dummy->checkBox(),ii++,0);
728 734
729 735
730 736
731 if ( QApplication::desktop()->height() <= 240 ) { 737 if ( QApplication::desktop()->height() <= 240 ) {
732 topFrame = addPage(i18n("Month View") +" 2",0,0); 738 topFrame = addPage(i18n("Month View") +" 2",0,0);
733 topLayout = new QGridLayout(topFrame,4,1); 739 topLayout = new Q3GridLayout(topFrame,4,1);
734 topLayout->setSpacing(2); 740 topLayout->setSpacing(2);
735 topLayout->setMargin(1); 741 topLayout->setMargin(1);
736 ii = 0; 742 ii = 0;
737 } 743 }
738 744
739 745
740 coloredCategoriesInMonthView = 746 coloredCategoriesInMonthView =
741 addWidBool(i18n("Month view uses day colors"), 747 addWidBool(i18n("Month view uses day colors"),
742 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); 748 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame);
743 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 749 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
744 750
745 KPrefsDialogWidColor *holidayColor = 751 KPrefsDialogWidColor *holidayColor =
746 addWidColor(i18n("Day color odd months"), 752 addWidColor(i18n("Day color odd months"),
747 &(KOPrefs::instance()->mMonthViewOddColor),topFrame); 753 &(KOPrefs::instance()->mMonthViewOddColor),topFrame);
748 topLayout->addWidget(holidayColor->label(),ii,0); 754 topLayout->addWidget(holidayColor->label(),ii,0);
749 topLayout->addWidget(holidayColor->button(),ii++,1); 755 topLayout->addWidget(holidayColor->button(),ii++,1);
@@ -751,45 +757,45 @@ void KOPrefsDialog::setupViewsTab()
751 holidayColor = 757 holidayColor =
752 addWidColor(i18n("Day color even months"), 758 addWidColor(i18n("Day color even months"),
753 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); 759 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame);
754 topLayout->addWidget(holidayColor->label(),ii,0); 760 topLayout->addWidget(holidayColor->label(),ii,0);
755 topLayout->addWidget(holidayColor->button(),ii++,1); 761 topLayout->addWidget(holidayColor->button(),ii++,1);
756 762
757 763
758 holidayColor = 764 holidayColor =
759 addWidColor(i18n("Color for Sundays + category \"Holiday\""), 765 addWidColor(i18n("Color for Sundays + category \"Holiday\""),
760 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); 766 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame);
761 topLayout->addWidget(holidayColor->label(),ii,0); 767 topLayout->addWidget(holidayColor->label(),ii,0);
762 topLayout->addWidget(holidayColor->button(),ii++,1); 768 topLayout->addWidget(holidayColor->button(),ii++,1);
763 // *********************** What'sNext View 769 // *********************** What'sNext View
764 topFrame = addPage(i18n("What's Next View"),0,0); 770 topFrame = addPage(i18n("What's Next View"),0,0);
765 // DesktopIcon("viewmag",KIcon::SizeMedium)); 771 // DesktopIcon("viewmag",KIcon::SizeMedium));
766 772
767 topLayout = new QGridLayout(topFrame,4,1); 773 topLayout = new Q3GridLayout(topFrame,4,1);
768 topLayout->setSpacing(mSpacingHint); 774 topLayout->setSpacing(mSpacingHint);
769 topLayout->setMargin(mMarginHint); 775 topLayout->setMargin(mMarginHint);
770 ii = 0; 776 ii = 0;
771 777
772 778
773 QHBox* hdummy = new QHBox(topFrame); 779 Q3HBox* hdummy = new Q3HBox(topFrame);
774 new QLabel(i18n("Days in What's Next:"),hdummy); 780 new QLabel(i18n("Days in What's Next:"),hdummy);
775 mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); 781 mWhatsNextSpin = new QSpinBox(1,14,1,hdummy);
776 782
777 topLayout->addWidget(hdummy,ii++,0); 783 topLayout->addWidget(hdummy,ii++,0);
778 784
779 QHBox *prioBox = new QHBox(topFrame); 785 Q3HBox *prioBox = new Q3HBox(topFrame);
780 // intervalBox->setSpacing(mSpacingHint); 786 // intervalBox->setSpacing(mSpacingHint);
781 topLayout->addWidget(prioBox,ii++,0); 787 topLayout->addWidget(prioBox,ii++,0);
782 788
783 QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); 789 QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox);
784 mPrioSpin = new QSpinBox(0,5,1,prioBox); 790 mPrioSpin = new QSpinBox(0,5,1,prioBox);
785 if ( QApplication::desktop()->width() < 300 ) 791 if ( QApplication::desktop()->width() < 300 )
786 mPrioSpin->setFixedWidth( 40 ); 792 mPrioSpin->setFixedWidth( 40 );
787 KPrefsDialogWidBool *passwdk = 793 KPrefsDialogWidBool *passwdk =
788 794
789 addWidBool(i18n("Show times on two lines"), 795 addWidBool(i18n("Show times on two lines"),
790 &(KOPrefs::instance()->mWhatsNextTime2Lines),topFrame); 796 &(KOPrefs::instance()->mWhatsNextTime2Lines),topFrame);
791 topLayout->addWidget(passwdk->checkBox(), ii++,0); 797 topLayout->addWidget(passwdk->checkBox(), ii++,0);
792 passwdk = 798 passwdk =
793 799
794 addWidBool(i18n("Show events that are done"), 800 addWidBool(i18n("Show events that are done"),
795 &(KOPrefs::instance()->mWNViewShowsPast),topFrame); 801 &(KOPrefs::instance()->mWNViewShowsPast),topFrame);
@@ -805,33 +811,33 @@ void KOPrefsDialog::setupViewsTab()
805 topLayout->addWidget(passwdk->checkBox(), ii++,0); 811 topLayout->addWidget(passwdk->checkBox(), ii++,0);
806 812
807 813
808 passwdk = 814 passwdk =
809 addWidBool(i18n("Use short date in WN+Event view"), 815 addWidBool(i18n("Use short date in WN+Event view"),
810 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 816 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
811 topLayout->addWidget(passwdk->checkBox(), ii++,0); 817 topLayout->addWidget(passwdk->checkBox(), ii++,0);
812 818
813 819
814 820
815 821
816 // *********************** Todo View 822 // *********************** Todo View
817 823
818 topFrame = addPage(i18n("Todo View"),0,0); 824 topFrame = addPage(i18n("Todo View"),0,0);
819 // DesktopIcon("viewmag",KIcon::SizeMedium)); 825 // DesktopIcon("viewmag",KIcon::SizeMedium));
820 826
821 topLayout = new QGridLayout(topFrame,4,1); 827 topLayout = new Q3GridLayout(topFrame,4,1);
822 topLayout->setSpacing(mSpacingHint); 828 topLayout->setSpacing(mSpacingHint);
823 topLayout->setMargin(mMarginHint); 829 topLayout->setMargin(mMarginHint);
824 ii = 0; 830 ii = 0;
825dummy = 831dummy =
826 addWidBool(i18n("Hide not running Todos in To-do view"), 832 addWidBool(i18n("Hide not running Todos in To-do view"),
827 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); 833 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame);
828 topLayout->addWidget(dummy->checkBox(),ii++,0); 834 topLayout->addWidget(dummy->checkBox(),ii++,0);
829 835
830 836
831 KPrefsDialogWidBool *showCompletedTodo = 837 KPrefsDialogWidBool *showCompletedTodo =
832 addWidBool(i18n("To-do view shows completed Todos"), 838 addWidBool(i18n("To-do view shows completed Todos"),
833 &(KOPrefs::instance()->mShowCompletedTodo),topFrame); 839 &(KOPrefs::instance()->mShowCompletedTodo),topFrame);
834 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); 840 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0);
835 dummy = 841 dummy =
836 addWidBool(i18n("To-do view shows complete as 'xx %'"), 842 addWidBool(i18n("To-do view shows complete as 'xx %'"),
837 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); 843 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame);
@@ -842,68 +848,68 @@ dummy =
842 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); 848 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame);
843 topLayout->addWidget(dummy->checkBox(),ii++,0); 849 topLayout->addWidget(dummy->checkBox(),ii++,0);
844 850
845 851
846 852
847 dummy = 853 dummy =
848 addWidBool(i18n("Todo view uses category colors"), 854 addWidBool(i18n("Todo view uses category colors"),
849 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); 855 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame);
850 topLayout->addWidget(dummy->checkBox(),ii++,0); 856 topLayout->addWidget(dummy->checkBox(),ii++,0);
851 857
852 858
853 QWidget* wid = new QWidget( topFrame ); 859 QWidget* wid = new QWidget( topFrame );
854 // Todo run today color 860 // Todo run today color
855 KPrefsDialogWidColor *todoRunColor = 861 KPrefsDialogWidColor *todoRunColor =
856 addWidColor(i18n("Color for running todos:"), 862 addWidColor(i18n("Color for running todos:"),
857 &(KOPrefs::instance()->mTodoRunColor),wid); 863 &(KOPrefs::instance()->mTodoRunColor),wid);
858 QHBoxLayout *widLayout = new QHBoxLayout(wid); 864 Q3HBoxLayout *widLayout = new Q3HBoxLayout(wid);
859 widLayout->addWidget( todoRunColor->label() ); 865 widLayout->addWidget( todoRunColor->label() );
860 widLayout->addWidget( todoRunColor->button() ); 866 widLayout->addWidget( todoRunColor->button() );
861 topLayout->addWidget(wid,ii++,0); 867 topLayout->addWidget(wid,ii++,0);
862 868
863 wid = new QWidget( topFrame ); 869 wid = new QWidget( topFrame );
864 // Todo due today color 870 // Todo due today color
865 KPrefsDialogWidColor *todoDueTodayColor = 871 KPrefsDialogWidColor *todoDueTodayColor =
866 addWidColor(i18n("Todo due today color:"), 872 addWidColor(i18n("Todo due today color:"),
867 &(KOPrefs::instance()->mTodoDueTodayColor),wid); 873 &(KOPrefs::instance()->mTodoDueTodayColor),wid);
868 widLayout = new QHBoxLayout(wid); 874 widLayout = new Q3HBoxLayout(wid);
869 widLayout->addWidget( todoDueTodayColor->label() ); 875 widLayout->addWidget( todoDueTodayColor->label() );
870 widLayout->addWidget( todoDueTodayColor->button() ); 876 widLayout->addWidget( todoDueTodayColor->button() );
871 topLayout->addWidget(wid,ii++,0); 877 topLayout->addWidget(wid,ii++,0);
872 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); 878 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1);
873 879
874 // Todo overdue color 880 // Todo overdue color
875 wid = new QWidget( topFrame ); 881 wid = new QWidget( topFrame );
876 widLayout = new QHBoxLayout(wid); 882 widLayout = new Q3HBoxLayout(wid);
877 KPrefsDialogWidColor *todoOverdueColor = 883 KPrefsDialogWidColor *todoOverdueColor =
878 addWidColor(i18n("Todo overdue color:"), 884 addWidColor(i18n("Todo overdue color:"),
879 &(KOPrefs::instance()->mTodoOverdueColor),wid); 885 &(KOPrefs::instance()->mTodoOverdueColor),wid);
880 widLayout->addWidget(todoOverdueColor->label()); 886 widLayout->addWidget(todoOverdueColor->label());
881 widLayout->addWidget(todoOverdueColor->button()); 887 widLayout->addWidget(todoOverdueColor->button());
882 topLayout->addWidget(wid,ii++,0); 888 topLayout->addWidget(wid,ii++,0);
883 889
884 dummy = 890 dummy =
885 addWidBool(i18n("Colors are applied to text"), 891 addWidBool(i18n("Colors are applied to text"),
886 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); 892 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame);
887 topLayout->addWidget(dummy->checkBox(),ii++,0); 893 topLayout->addWidget(dummy->checkBox(),ii++,0);
888 894
889 895
890 896
891 topFrame = addPage(i18n("View Options"),0,0); 897 topFrame = addPage(i18n("View Options"),0,0);
892 898
893 topLayout = new QGridLayout(topFrame,4,1); 899 topLayout = new Q3GridLayout(topFrame,4,1);
894 topLayout->setSpacing(mSpacingHint); 900 topLayout->setSpacing(mSpacingHint);
895 topLayout->setMargin(mMarginHint); 901 topLayout->setMargin(mMarginHint);
896 ii = 0; 902 ii = 0;
897 903
898 dummy = 904 dummy =
899 addWidBool(i18n("Show Sync Events"), 905 addWidBool(i18n("Show Sync Events"),
900 &(KOPrefs::instance()->mShowSyncEvents),topFrame); 906 &(KOPrefs::instance()->mShowSyncEvents),topFrame);
901 topLayout->addWidget(dummy->checkBox(), ii++,0); 907 topLayout->addWidget(dummy->checkBox(), ii++,0);
902 908
903 lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); 909 lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame);
904 topLayout->addWidget(lab ,ii++,0); 910 topLayout->addWidget(lab ,ii++,0);
905 911
906 dummy = addWidBool(i18n("Details"), 912 dummy = addWidBool(i18n("Details"),
907 &(KOPrefs::instance()->mEVshowDetails),topFrame); 913 &(KOPrefs::instance()->mEVshowDetails),topFrame);
908 topLayout->addWidget(dummy->checkBox(),ii++,0); 914 topLayout->addWidget(dummy->checkBox(),ii++,0);
909 dummy = addWidBool(i18n("Created time"), 915 dummy = addWidBool(i18n("Created time"),
@@ -916,119 +922,119 @@ dummy =
916 922
917 lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); 923 lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame);
918 topLayout->addWidget(lab ,ii++,0); 924 topLayout->addWidget(lab ,ii++,0);
919 925
920 dummy = addWidBool(i18n("Details"), 926 dummy = addWidBool(i18n("Details"),
921 &(KOPrefs::instance()->mWTshowDetails),topFrame); 927 &(KOPrefs::instance()->mWTshowDetails),topFrame);
922 topLayout->addWidget(dummy->checkBox(),ii++,0); 928 topLayout->addWidget(dummy->checkBox(),ii++,0);
923 dummy = addWidBool(i18n("Created time"), 929 dummy = addWidBool(i18n("Created time"),
924 &(KOPrefs::instance()->mWTshowCreated),topFrame); 930 &(KOPrefs::instance()->mWTshowCreated),topFrame);
925 topLayout->addWidget(dummy->checkBox(),ii++,0); 931 topLayout->addWidget(dummy->checkBox(),ii++,0);
926 dummy = addWidBool(i18n("Last modified time"), 932 dummy = addWidBool(i18n("Last modified time"),
927 &(KOPrefs::instance()->mWTshowChanged),topFrame); 933 &(KOPrefs::instance()->mWTshowChanged),topFrame);
928 topLayout->addWidget(dummy->checkBox(),ii++,0); 934 topLayout->addWidget(dummy->checkBox(),ii++,0);
929 935
930 topFrame = addPage(i18n("Conflict detection"),0,0); 936 topFrame = addPage(i18n("Conflict detection"),0,0);
931 937
932 topLayout = new QGridLayout(topFrame,2,1); 938 topLayout = new Q3GridLayout(topFrame,2,1);
933 topLayout->setSpacing(mSpacingHint); 939 topLayout->setSpacing(mSpacingHint);
934 topLayout->setMargin(mMarginHint); 940 topLayout->setMargin(mMarginHint);
935 ii = 0; 941 ii = 0;
936 dummy = addWidBool(i18n("Enable conflict detection"), 942 dummy = addWidBool(i18n("Enable conflict detection"),
937 &(KOPrefs::instance()->mDetectConflicts),topFrame); 943 &(KOPrefs::instance()->mDetectConflicts),topFrame);
938 topLayout->addWidget(dummy->checkBox(), ii++,0); 944 topLayout->addWidget(dummy->checkBox(), ii++,0);
939 topFrame = new QFrame( topFrame ); 945 topFrame = new Q3Frame( topFrame );
940 topLayout->addWidget(topFrame ,ii++,0); 946 topLayout->addWidget(topFrame ,ii++,0);
941 topLayout = new QGridLayout(topFrame,4,1); 947 topLayout = new Q3GridLayout(topFrame,4,1);
942 connect ( dummy->checkBox(), SIGNAL( toggled( bool ) ), topFrame, SLOT ( setEnabled( bool ) ) ); 948 connect ( dummy->checkBox(), SIGNAL( toggled( bool ) ), topFrame, SLOT ( setEnabled( bool ) ) );
943 dummy = addWidBool(i18n("Include events which \"show as free\""), 949 dummy = addWidBool(i18n("Include events which \"show as free\""),
944 &(KOPrefs::instance()->mIncludeFree),topFrame); 950 &(KOPrefs::instance()->mIncludeFree),topFrame);
945 topLayout->addWidget(dummy->checkBox(), ii++,0); 951 topLayout->addWidget(dummy->checkBox(), ii++,0);
946 topLayout->addWidget( new QLabel ( i18n("Conflict detection checks an <b>edited event</b> with <b>other events</b> for overlapping."), topFrame ) , ii++,0); 952 topLayout->addWidget( new QLabel ( i18n("Conflict detection checks an <b>edited event</b> with <b>other events</b> for overlapping."), topFrame ) , ii++,0);
947 953
948 topLayout->addWidget( new QLabel ( i18n("Filter for the edited event"), topFrame ) , ii++,0); 954 topLayout->addWidget( new QLabel ( i18n("Filter for the edited event"), topFrame ) , ii++,0);
949 mFilterEditItem = new QComboBox( topFrame ); 955 mFilterEditItem = new QComboBox( topFrame );
950 topLayout->addWidget(mFilterEditItem,ii++,0); 956 topLayout->addWidget(mFilterEditItem,ii++,0);
951 topLayout->addWidget( new QLabel ( i18n("Filter for other events"), topFrame ) , ii++,0); 957 topLayout->addWidget( new QLabel ( i18n("Filter for other events"), topFrame ) , ii++,0);
952 mFilterAllItem = new QComboBox( topFrame ); 958 mFilterAllItem = new QComboBox( topFrame );
953 topLayout->addWidget(mFilterAllItem,ii++,0); 959 topLayout->addWidget(mFilterAllItem,ii++,0);
954 dummy = addWidBool(i18n("Check Allday with Allday"), 960 dummy = addWidBool(i18n("Check Allday with Allday"),
955 &(KOPrefs::instance()->mCheckConflictsAllDayAllDay),topFrame); 961 &(KOPrefs::instance()->mCheckConflictsAllDayAllDay),topFrame);
956 topLayout->addWidget(dummy->checkBox(), ii++,0); 962 topLayout->addWidget(dummy->checkBox(), ii++,0);
957 dummy = addWidBool(i18n("Check Allday with NonAllday"), 963 dummy = addWidBool(i18n("Check Allday with NonAllday"),
958 &(KOPrefs::instance()->mCheckConflictsAllDayNonAD),topFrame); 964 &(KOPrefs::instance()->mCheckConflictsAllDayNonAD),topFrame);
959 topLayout->addWidget(dummy->checkBox(), ii++,0); 965 topLayout->addWidget(dummy->checkBox(), ii++,0);
960 dummy = addWidBool(i18n("Check NonAllday with Allday"), 966 dummy = addWidBool(i18n("Check NonAllday with Allday"),
961 &(KOPrefs::instance()->mCheckConflictsNonADAllDay),topFrame); 967 &(KOPrefs::instance()->mCheckConflictsNonADAllDay),topFrame);
962 topLayout->addWidget(dummy->checkBox(), ii++,0); 968 topLayout->addWidget(dummy->checkBox(), ii++,0);
963 dummy = addWidBool(i18n("Check NonAllday with NonAllday"), 969 dummy = addWidBool(i18n("Check NonAllday with NonAllday"),
964 &(KOPrefs::instance()->mCheckConflictsNonADNonAD),topFrame); 970 &(KOPrefs::instance()->mCheckConflictsNonADNonAD),topFrame);
965 topLayout->addWidget(dummy->checkBox(), ii++,0); 971 topLayout->addWidget(dummy->checkBox(), ii++,0);
966 972
967 973
968 974
969 975
970 topFrame = addPage(i18n("Alarm"),0,0); 976 topFrame = addPage(i18n("Alarm"),0,0);
971 // DesktopIcon("viewmag",KIcon::SizeMedium)); 977 // DesktopIcon("viewmag",KIcon::SizeMedium));
972 978
973 topLayout = new QGridLayout(topFrame,2,1); 979 topLayout = new Q3GridLayout(topFrame,2,1);
974 topLayout->setSpacing(mSpacingHint); 980 topLayout->setSpacing(mSpacingHint);
975 topLayout->setMargin(mMarginHint); 981 topLayout->setMargin(mMarginHint);
976 int iii = 0; 982 int iii = 0;
977 983
978 dummy = 984 dummy =
979 addWidBool(i18n("Use internal alarm notification"), 985 addWidBool(i18n("Use internal alarm notification"),
980 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); 986 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame);
981 topLayout->addWidget(dummy->checkBox(),iii++,0); 987 topLayout->addWidget(dummy->checkBox(),iii++,0);
982 988
983 if ( QApplication::desktop()->height() > 240 ) { 989 if ( QApplication::desktop()->height() > 240 ) {
984 990
985 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); 991 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame);
986 992
987 topLayout->addWidget(lab ,iii++,0); 993 topLayout->addWidget(lab ,iii++,0);
988 } 994 }
989#ifndef DESKTOP_VERSION 995#ifndef DESKTOP_VERSION
990 lab->setAlignment( AlignLeft|WordBreak|AlignTop); 996 lab->setAlignment( AlignLeft|WordBreak|AlignTop);
991#else 997#else
992 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 998 lab->setAlignment( Qt::AlignLeft|Qt::TextWrapAnywhere|Qt::TextWordWrap|Qt::AlignTop);
993 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 999 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
994#endif 1000#endif
995 1001
996 QHBox* dummyBox = new QHBox(topFrame); 1002 Q3HBox* dummyBox = new Q3HBox(topFrame);
997 new QLabel(i18n("Play beeps count:"),dummyBox); 1003 new QLabel(i18n("Play beeps count:"),dummyBox);
998 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); 1004 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox);
999 topLayout->addWidget(dummyBox,iii++,0); 1005 topLayout->addWidget(dummyBox,iii++,0);
1000 1006
1001 dummyBox = new QHBox(topFrame); 1007 dummyBox = new Q3HBox(topFrame);
1002 new QLabel(i18n("Beeps interval in sec:"),dummyBox); 1008 new QLabel(i18n("Beeps interval in sec:"),dummyBox);
1003 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); 1009 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox);
1004 topLayout->addWidget(dummyBox,iii++,0); 1010 topLayout->addWidget(dummyBox,iii++,0);
1005 1011
1006 dummyBox = new QHBox(topFrame); 1012 dummyBox = new Q3HBox(topFrame);
1007 new QLabel(i18n("Default suspend time in min:"),dummyBox); 1013 new QLabel(i18n("Default suspend time in min:"),dummyBox);
1008 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); 1014 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox);
1009 topLayout->addWidget(dummyBox,iii++,0); 1015 topLayout->addWidget(dummyBox,iii++,0);
1010 1016
1011 dummyBox = new QHBox(topFrame); 1017 dummyBox = new Q3HBox(topFrame);
1012 new QLabel(i18n("Auto suspend count:"),dummyBox); 1018 new QLabel(i18n("Auto suspend count:"),dummyBox);
1013 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); 1019 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox);
1014 topLayout->addWidget(dummyBox,iii++,0); 1020 topLayout->addWidget(dummyBox,iii++,0);
1015 1021
1016 1022
1017 1023
1018 QHBox* hbo = new QHBox ( topFrame ); 1024 Q3HBox* hbo = new Q3HBox ( topFrame );
1019 mDefaultAlarmFile = new QLineEdit(hbo); 1025 mDefaultAlarmFile = new QLineEdit(hbo);
1020 QPushButton * loadTemplate = new QPushButton(hbo); 1026 QPushButton * loadTemplate = new QPushButton(hbo);
1021 QPixmap icon; 1027 QPixmap icon;
1022 if ( QApplication::desktop()->width() < 321 ) 1028 if ( QApplication::desktop()->width() < 321 )
1023 icon = SmallIcon("fileimport16"); 1029 icon = SmallIcon("fileimport16");
1024 else 1030 else
1025 icon = SmallIcon("fileimport"); 1031 icon = SmallIcon("fileimport");
1026 loadTemplate->setIconSet (icon ) ; 1032 loadTemplate->setIconSet (icon ) ;
1027 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); 1033 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) );
1028 int size = loadTemplate->sizeHint().height(); 1034 int size = loadTemplate->sizeHint().height();
1029 loadTemplate->setFixedSize( size, size ); 1035 loadTemplate->setFixedSize( size, size );
1030 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); 1036 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame);
1031 // topLayout->addWidget(lab ,iii++,0); 1037 // topLayout->addWidget(lab ,iii++,0);
1032 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); 1038 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame);
1033 topLayout->addWidget(lab ,iii++,0); 1039 topLayout->addWidget(lab ,iii++,0);
1034 topLayout->addWidget(hbo,iii++,0); 1040 topLayout->addWidget(hbo,iii++,0);
@@ -1042,36 +1048,36 @@ dummy =
1042// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 1048// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
1043// #endif 1049// #endif
1044 1050
1045 1051
1046} 1052}
1047 1053
1048void KOPrefsDialog::selectSoundFile() 1054void KOPrefsDialog::selectSoundFile()
1049{ 1055{
1050 QString fileName = mDefaultAlarmFile->text(); 1056 QString fileName = mDefaultAlarmFile->text();
1051 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); 1057 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this );
1052 if ( fileName.length() > 0 ) 1058 if ( fileName.length() > 0 )
1053 mDefaultAlarmFile->setText( fileName ); 1059 mDefaultAlarmFile->setText( fileName );
1054} 1060}
1055void KOPrefsDialog::setupFontsTab() 1061void KOPrefsDialog::setupFontsTab()
1056{ 1062{
1057 1063
1058 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 1064 Q3Frame *topFrame = addPage(i18n("Fonts"),0,0);
1059 // DesktopIcon("fonts",KIcon::SizeMedium)); 1065 // DesktopIcon("fonts",KIcon::SizeMedium));
1060 1066
1061 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 1067 Q3GridLayout *topLayout = new Q3GridLayout(topFrame,7,3);
1062 topLayout->setSpacing(1); 1068 topLayout->setSpacing(1);
1063 topLayout->setMargin(3); 1069 topLayout->setMargin(3);
1064 KPrefsDialogWidFont * tVFont; 1070 KPrefsDialogWidFont * tVFont;
1065 int i = 0; 1071 int i = 0;
1066 KPrefsDialogWidFont *timeLabelsFont = 1072 KPrefsDialogWidFont *timeLabelsFont =
1067 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), 1073 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"),
1068 &(KOPrefs::instance()->mDateNavigatorFont),topFrame); 1074 &(KOPrefs::instance()->mDateNavigatorFont),topFrame);
1069 topLayout->addWidget(timeLabelsFont->label(),i,0); 1075 topLayout->addWidget(timeLabelsFont->label(),i,0);
1070 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1076 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1071 topLayout->addWidget(timeLabelsFont->button(),i,2); 1077 topLayout->addWidget(timeLabelsFont->button(),i,2);
1072 ++i; 1078 ++i;
1073 1079
1074 1080
1075 timeLabelsFont = 1081 timeLabelsFont =
1076 addWidFont(i18n("Mon 15"),i18n("Date Labels:"), 1082 addWidFont(i18n("Mon 15"),i18n("Date Labels:"),
1077 &(KOPrefs::instance()->mTimeLabelsFont),topFrame); 1083 &(KOPrefs::instance()->mTimeLabelsFont),topFrame);
@@ -1112,33 +1118,33 @@ void KOPrefsDialog::setupFontsTab()
1112 &(KOPrefs::instance()->mEditBoxFont),topFrame); 1118 &(KOPrefs::instance()->mEditBoxFont),topFrame);
1113 topLayout->addWidget(tVFont->label(),i,0); 1119 topLayout->addWidget(tVFont->label(),i,0);
1114 topLayout->addWidget(tVFont->preview(),i,1); 1120 topLayout->addWidget(tVFont->preview(),i,1);
1115 topLayout->addWidget(tVFont->button(),i,2); 1121 topLayout->addWidget(tVFont->button(),i,2);
1116 ++i; 1122 ++i;
1117 1123
1118 1124
1119 1125
1120 topLayout->setColStretch(1,1); 1126 topLayout->setColStretch(1,1);
1121 topLayout->setRowStretch(4,1); 1127 topLayout->setRowStretch(4,1);
1122 1128
1123 1129
1124 i = 0; 1130 i = 0;
1125 topFrame = addPage(i18n("View Fonts"),0, 1131 topFrame = addPage(i18n("View Fonts"),0,
1126 DesktopIcon("fonts",KIcon::SizeMedium)); 1132 DesktopIcon("fonts",KIcon::SizeMedium));
1127 1133
1128 topLayout = new QGridLayout(topFrame,7,3); 1134 topLayout = new Q3GridLayout(topFrame,7,3);
1129 topLayout->setSpacing(1); 1135 topLayout->setSpacing(1);
1130 topLayout->setMargin(3); 1136 topLayout->setMargin(3);
1131 1137
1132 tVFont = 1138 tVFont =
1133 addWidFont(i18n("Configure KO"),i18n("What's Next View:"), 1139 addWidFont(i18n("Configure KO"),i18n("What's Next View:"),
1134 &(KOPrefs::instance()->mWhatsNextFont),topFrame); 1140 &(KOPrefs::instance()->mWhatsNextFont),topFrame);
1135 topLayout->addWidget(tVFont->label(),i,0); 1141 topLayout->addWidget(tVFont->label(),i,0);
1136 topLayout->addWidget(tVFont->preview(),i,1); 1142 topLayout->addWidget(tVFont->preview(),i,1);
1137 topLayout->addWidget(tVFont->button(),i,2); 1143 topLayout->addWidget(tVFont->button(),i,2);
1138 ++i; 1144 ++i;
1139 KPrefsDialogWidFont *agendaViewFont = 1145 KPrefsDialogWidFont *agendaViewFont =
1140 addWidFont(i18n("Event text"),i18n("Agenda view:"), 1146 addWidFont(i18n("Event text"),i18n("Agenda view:"),
1141 &(KOPrefs::instance()->mAgendaViewFont),topFrame); 1147 &(KOPrefs::instance()->mAgendaViewFont),topFrame);
1142 topLayout->addWidget(agendaViewFont->label(),i,0); 1148 topLayout->addWidget(agendaViewFont->label(),i,0);
1143 topLayout->addWidget(agendaViewFont->preview(),i,1); 1149 topLayout->addWidget(agendaViewFont->preview(),i,1);
1144 topLayout->addWidget(agendaViewFont->button(),i,2); 1150 topLayout->addWidget(agendaViewFont->button(),i,2);
@@ -1180,46 +1186,46 @@ void KOPrefsDialog::setupFontsTab()
1180 topLayout->addWidget(tVFont->button(),i,2); 1186 topLayout->addWidget(tVFont->button(),i,2);
1181 ++i; 1187 ++i;
1182 1188
1183 1189
1184 1190
1185 1191
1186 topLayout->setColStretch(1,1); 1192 topLayout->setColStretch(1,1);
1187 topLayout->setRowStretch(4,1); 1193 topLayout->setRowStretch(4,1);
1188 1194
1189 1195
1190 1196
1191 1197
1192} 1198}
1193 1199
1194void KOPrefsDialog::setupColorsTab() 1200void KOPrefsDialog::setupColorsTab()
1195{ 1201{
1196 QFrame *topFrame = addPage(i18n("Colors"),0,0); 1202 Q3Frame *topFrame = addPage(i18n("Colors"),0,0);
1197 // DesktopIcon("colorize",KIcon::SizeMedium)); 1203 // DesktopIcon("colorize",KIcon::SizeMedium));
1198 1204
1199 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1205 Q3GridLayout *topLayout = new Q3GridLayout(topFrame,5,2);
1200 // topLayout->setSpacing(mSpacingHint); 1206 // topLayout->setSpacing(mSpacingHint);
1201 // topLayout->setMargin(mMarginHint); 1207 // topLayout->setMargin(mMarginHint);
1202 1208
1203 topLayout->setSpacing(2); 1209 topLayout->setSpacing(2);
1204 topLayout->setMargin(3); 1210 topLayout->setMargin(3);
1205 1211
1206 int ii = 1; 1212 int ii = 1;
1207 QGroupBox *categoryGroup ; 1213 Q3GroupBox *categoryGroup ;
1208 1214
1209 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), 1215 categoryGroup = new Q3GroupBox(1,Qt::Vertical,i18n("Categories"),
1210 topFrame); 1216 topFrame);
1211 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); 1217 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1);
1212 1218
1213 mCategoryCombo = new QComboBox(categoryGroup); 1219 mCategoryCombo = new QComboBox(categoryGroup);
1214 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1220 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1215 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); 1221 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor()));
1216 1222
1217 mCategoryButton = new KColorButton(categoryGroup); 1223 mCategoryButton = new KColorButton(categoryGroup);
1218 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); 1224 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor()));
1219 updateCategoryColor(); 1225 updateCategoryColor();
1220 1226
1221 1227
1222 // Holiday Color 1228 // Holiday Color
1223 1229
1224 KPrefsDialogWidColor *holidayColor = 1230 KPrefsDialogWidColor *holidayColor =
1225 addWidColor(i18n("Holiday color:"), 1231 addWidColor(i18n("Holiday color:"),
@@ -1237,33 +1243,33 @@ void KOPrefsDialog::setupColorsTab()
1237 // Event color 1243 // Event color
1238 KPrefsDialogWidColor *eventColor = 1244 KPrefsDialogWidColor *eventColor =
1239 addWidColor(i18n("Default event color:"), 1245 addWidColor(i18n("Default event color:"),
1240 &(KOPrefs::instance()->mEventColor),topFrame); 1246 &(KOPrefs::instance()->mEventColor),topFrame);
1241 topLayout->addWidget(eventColor->label(),ii,0); 1247 topLayout->addWidget(eventColor->label(),ii,0);
1242 topLayout->addWidget(eventColor->button(),ii++,1); 1248 topLayout->addWidget(eventColor->button(),ii++,1);
1243 eventColor = 1249 eventColor =
1244 addWidColor(i18n("Default todo done color:"), 1250 addWidColor(i18n("Default todo done color:"),
1245 &(KOPrefs::instance()->mTodoDoneColor),topFrame); 1251 &(KOPrefs::instance()->mTodoDoneColor),topFrame);
1246 topLayout->addWidget(eventColor->label(),ii,0); 1252 topLayout->addWidget(eventColor->label(),ii,0);
1247 topLayout->addWidget(eventColor->button(),ii++,1); 1253 topLayout->addWidget(eventColor->button(),ii++,1);
1248 1254
1249 if ( QApplication::desktop()->height() <= 240 ) { 1255 if ( QApplication::desktop()->height() <= 240 ) {
1250 topFrame = addPage(i18n("Colors") +" 2",0,0); 1256 topFrame = addPage(i18n("Colors") +" 2",0,0);
1251 // DesktopIcon("colorize",KIcon::SizeMedium)); 1257 // DesktopIcon("colorize",KIcon::SizeMedium));
1252 1258
1253 topLayout = new QGridLayout(topFrame,5,2); 1259 topLayout = new Q3GridLayout(topFrame,5,2);
1254 // topLayout->setSpacing(mSpacingHint); 1260 // topLayout->setSpacing(mSpacingHint);
1255 // topLayout->setMargin(mMarginHint); 1261 // topLayout->setMargin(mMarginHint);
1256 1262
1257 topLayout->setSpacing(2); 1263 topLayout->setSpacing(2);
1258 topLayout->setMargin(3); 1264 topLayout->setMargin(3);
1259 } 1265 }
1260 1266
1261 1267
1262 // agenda view background color 1268 // agenda view background color
1263 KPrefsDialogWidColor *agendaBgColor = 1269 KPrefsDialogWidColor *agendaBgColor =
1264 addWidColor(i18n("Agenda view background color:"), 1270 addWidColor(i18n("Agenda view background color:"),
1265 &(KOPrefs::instance()->mAgendaBgColor),topFrame); 1271 &(KOPrefs::instance()->mAgendaBgColor),topFrame);
1266 topLayout->addWidget(agendaBgColor->label(),ii,0); 1272 topLayout->addWidget(agendaBgColor->label(),ii,0);
1267 topLayout->addWidget(agendaBgColor->button(),ii++,1); 1273 topLayout->addWidget(agendaBgColor->button(),ii++,1);
1268 1274
1269 // working hours color 1275 // working hours color
@@ -1304,97 +1310,97 @@ void KOPrefsDialog::updateCategoryColor()
1304{ 1310{
1305 QString cat = mCategoryCombo->currentText(); 1311 QString cat = mCategoryCombo->currentText();
1306 QColor *color = mCategoryDict.find(cat); 1312 QColor *color = mCategoryDict.find(cat);
1307 if (!color) { 1313 if (!color) {
1308 color = KOPrefs::instance()->categoryColor(cat); 1314 color = KOPrefs::instance()->categoryColor(cat);
1309 } 1315 }
1310 if (color) { 1316 if (color) {
1311 mCategoryButton->setColor(*color); 1317 mCategoryButton->setColor(*color);
1312 } 1318 }
1313} 1319}
1314 1320
1315void KOPrefsDialog::setupPrinterTab() 1321void KOPrefsDialog::setupPrinterTab()
1316{ 1322{
1317 mPrinterTab = addPage(i18n("Printing"),0, 1323 mPrinterTab = addPage(i18n("Printing"),0,
1318 DesktopIcon("fileprint",KIcon::SizeMedium)); 1324 DesktopIcon("fileprint",KIcon::SizeMedium));
1319 1325
1320 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); 1326 Q3GridLayout *topLayout = new Q3GridLayout(mPrinterTab,5,2);
1321 topLayout->setSpacing(mSpacingHint); 1327 topLayout->setSpacing(mSpacingHint);
1322 topLayout->setMargin(mMarginHint); 1328 topLayout->setMargin(mMarginHint);
1323 1329
1324 topLayout->setRowStretch(4,1); 1330 topLayout->setRowStretch(4,1);
1325} 1331}
1326 1332
1327void KOPrefsDialog::setupGroupSchedulingTab() 1333void KOPrefsDialog::setupGroupSchedulingTab()
1328{ 1334{
1329#if 0 1335#if 0
1330 QFrame *topFrame = addPage(i18n("Group Scheduling"),0, 1336 Q3Frame *topFrame = addPage(i18n("Group Scheduling"),0,
1331 DesktopIcon("personal",KIcon::SizeMedium)); 1337 DesktopIcon("personal",KIcon::SizeMedium));
1332 1338
1333 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 1339 Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,2);
1334 topLayout->setSpacing(mSpacingHint); 1340 topLayout->setSpacing(mSpacingHint);
1335 topLayout->setMargin(mMarginHint); 1341 topLayout->setMargin(mMarginHint);
1336 1342
1337#if 0 1343#if 0
1338 KPrefsDialogWidRadios *schedulerGroup = 1344 KPrefsDialogWidRadios *schedulerGroup =
1339 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), 1345 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler),
1340 topFrame); 1346 topFrame);
1341 schedulerGroup->addRadio("Dummy"); // Only for debugging 1347 schedulerGroup->addRadio("Dummy"); // Only for debugging
1342 schedulerGroup->addRadio(i18n("Mail client")); 1348 schedulerGroup->addRadio(i18n("Mail client"));
1343 1349
1344 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); 1350 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1);
1345#endif 1351#endif
1346 1352
1347 KPrefsDialogWidRadios *sendGroup = 1353 KPrefsDialogWidRadios *sendGroup =
1348 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), 1354 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend),
1349 topFrame); 1355 topFrame);
1350 sendGroup->addRadio(i18n("Send to outbox")); 1356 sendGroup->addRadio(i18n("Send to outbox"));
1351 sendGroup->addRadio(i18n("Send directly")); 1357 sendGroup->addRadio(i18n("Send directly"));
1352 1358
1353 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); 1359 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1);
1354 1360
1355 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); 1361 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1);
1356 mAMails = new QListView(topFrame); 1362 mAMails = new Q3ListView(topFrame);
1357 mAMails->addColumn(i18n("Email"),300); 1363 mAMails->addColumn(i18n("Email"),300);
1358 topLayout->addMultiCellWidget(mAMails,3,3,0,1); 1364 topLayout->addMultiCellWidget(mAMails,3,3,0,1);
1359 1365
1360 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); 1366 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0);
1361 aEmailsEdit = new QLineEdit(topFrame); 1367 aEmailsEdit = new QLineEdit(topFrame);
1362 aEmailsEdit->setEnabled(false); 1368 aEmailsEdit->setEnabled(false);
1363 topLayout->addWidget(aEmailsEdit,4,1); 1369 topLayout->addWidget(aEmailsEdit,4,1);
1364 1370
1365 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); 1371 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new");
1366 topLayout->addWidget(add,5,0); 1372 topLayout->addWidget(add,5,0);
1367 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); 1373 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove");
1368 topLayout->addWidget(del,5,1); 1374 topLayout->addWidget(del,5,1);
1369 1375
1370 //topLayout->setRowStretch(2,1); 1376 //topLayout->setRowStretch(2,1);
1371 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); 1377 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) );
1372 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); 1378 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) );
1373 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); 1379 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem()));
1374 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); 1380 connect(mAMails,SIGNAL(selectionChanged(Q3ListViewItem *)),SLOT(updateInput()));
1375#endif 1381#endif
1376} 1382}
1377 1383
1378void KOPrefsDialog::setupGroupAutomationTab() 1384void KOPrefsDialog::setupGroupAutomationTab()
1379{ 1385{
1380 return; 1386 return;
1381 QFrame *topFrame = addPage(i18n("Group Automation"),0, 1387 Q3Frame *topFrame = addPage(i18n("Group Automation"),0,
1382 DesktopIcon("personal",KIcon::SizeMedium)); 1388 DesktopIcon("personal",KIcon::SizeMedium));
1383 1389
1384 QGridLayout *topLayout = new QGridLayout(topFrame,5,1); 1390 Q3GridLayout *topLayout = new Q3GridLayout(topFrame,5,1);
1385 topLayout->setSpacing(mSpacingHint); 1391 topLayout->setSpacing(mSpacingHint);
1386 topLayout->setMargin(mMarginHint); 1392 topLayout->setMargin(mMarginHint);
1387 1393
1388 KPrefsDialogWidRadios *autoRefreshGroup = 1394 KPrefsDialogWidRadios *autoRefreshGroup =
1389 addWidRadios(i18n("Auto Send Refresh"), 1395 addWidRadios(i18n("Auto Send Refresh"),
1390 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); 1396 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame);
1391 autoRefreshGroup->addRadio(i18n("Never")); 1397 autoRefreshGroup->addRadio(i18n("Never"));
1392 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); 1398 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook"));
1393 //autoRefreshGroup->addRadio(i18n("selected emails")); 1399 //autoRefreshGroup->addRadio(i18n("selected emails"));
1394 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); 1400 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0);
1395 1401
1396 KPrefsDialogWidRadios *autoInsertGroup = 1402 KPrefsDialogWidRadios *autoInsertGroup =
1397 addWidRadios(i18n("Auto Insert IMIP Replies"), 1403 addWidRadios(i18n("Auto Insert IMIP Replies"),
1398 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); 1404 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame);
1399 autoInsertGroup->addRadio(i18n("Never")); 1405 autoInsertGroup->addRadio(i18n("Never"));
1400 autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); 1406 autoInsertGroup->addRadio(i18n("If attendee is in addressbook"));
@@ -1502,33 +1508,33 @@ void KOPrefsDialog::usrWriteConfig()
1502 KOPrefs::instance()->setFullName(mNameEdit->text()); 1508 KOPrefs::instance()->setFullName(mNameEdit->text());
1503 KOPrefs::instance()->setEmail(mEmailEdit->text()); 1509 KOPrefs::instance()->setEmail(mEmailEdit->text());
1504 1510
1505 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); 1511 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value();
1506 KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); 1512 KOPrefs::instance()->mStartTime = mStartTimeSpin->value();
1507 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); 1513 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value();
1508 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); 1514 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem();
1509 if ( mCatDefaultColor != KOPrefs::instance()->mEventColor ) { 1515 if ( mCatDefaultColor != KOPrefs::instance()->mEventColor ) {
1510 QStringList cat = KOPrefs::instance()->mCustomCategories; 1516 QStringList cat = KOPrefs::instance()->mCustomCategories;
1511 int iii = 0; 1517 int iii = 0;
1512 while ( iii < cat.count() ) { 1518 while ( iii < cat.count() ) {
1513 if ( *KOPrefs::instance()->categoryColor( cat[ iii ] ) == mCatDefaultColor ) 1519 if ( *KOPrefs::instance()->categoryColor( cat[ iii ] ) == mCatDefaultColor )
1514 KOPrefs::instance()->setCategoryColor( cat[ iii ], KOPrefs::instance()->mEventColor ); 1520 KOPrefs::instance()->setCategoryColor( cat[ iii ], KOPrefs::instance()->mEventColor );
1515 ++iii; 1521 ++iii;
1516 } 1522 }
1517 } 1523 }
1518 QDictIterator<QColor> it(mCategoryDict); 1524 Q3DictIterator<QColor> it(mCategoryDict);
1519 while (it.current()) { 1525 while (it.current()) {
1520 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); 1526 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current());
1521 ++it; 1527 ++it;
1522 } 1528 }
1523 1529
1524 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); 1530 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value();
1525 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); 1531 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value();
1526 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); 1532 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value();
1527 1533
1528 KOPrefs::instance()->mAdditionalMails.clear(); 1534 KOPrefs::instance()->mAdditionalMails.clear();
1529 // QListViewItem *item; 1535 // QListViewItem *item;
1530 // item = mAMails->firstChild(); 1536 // item = mAMails->firstChild();
1531 // while (item) 1537 // while (item)
1532 // { 1538 // {
1533 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); 1539 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) );
1534 // item = item->nextSibling(); 1540 // item = item->nextSibling();
diff --git a/korganizer/koprefsdialog.h b/korganizer/koprefsdialog.h
index ee7a7aa..ccc1726 100644
--- a/korganizer/koprefsdialog.h
+++ b/korganizer/koprefsdialog.h
@@ -10,36 +10,38 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef _KOPREFSDIALOG_H 23#ifndef _KOPREFSDIALOG_H
24#define _KOPREFSDIALOG_H 24#define _KOPREFSDIALOG_H
25 25
26#include <qframe.h> 26#include <q3frame.h>
27#include <qdict.h> 27#include <q3dict.h>
28#include <qcolor.h> 28#include <qcolor.h>
29#include <qlistview.h> 29#include <q3listview.h>
30//Added by qt3to4:
31#include <QLabel>
30 32
31#include <kdialogbase.h> 33#include <kdialogbase.h>
32 34
33#include <libkdepim/kprefsdialog.h> 35#include <libkdepim/kprefsdialog.h>
34#include <libkdepim/kdateedit.h> 36#include <libkdepim/kdateedit.h>
35#include <kcmconfigs/kdepimconfigwidget.h> 37#include <kcmconfigs/kdepimconfigwidget.h>
36 38
37class KColorButton; 39class KColorButton;
38class QSpinBox; 40class QSpinBox;
39class QSlider; 41class QSlider;
40class KURLRequester; 42class KURLRequester;
41class QComboBox; 43class QComboBox;
42class QLineEdit; 44class QLineEdit;
43class QStringList; 45class QStringList;
44 46
45/** Dialog to change the korganizer configuration. 47/** Dialog to change the korganizer configuration.
@@ -81,60 +83,60 @@ class KOPrefsDialog : public KPrefsDialog
81 void setupFontsTab(); 83 void setupFontsTab();
82 void setupColorsTab(); 84 void setupColorsTab();
83 void setupViewsTab(); 85 void setupViewsTab();
84 void setupDisplayTab(); 86 void setupDisplayTab();
85 void setupPrinterTab(); 87 void setupPrinterTab();
86 void setupGroupSchedulingTab(); 88 void setupGroupSchedulingTab();
87 void setupGroupAutomationTab(); 89 void setupGroupAutomationTab();
88 90
89 void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); 91 void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0);
90 92
91 93
92 private: 94 private:
93 QColor mCatDefaultColor; 95 QColor mCatDefaultColor;
94 KPrefsDialogWidBool *mEnableGroupScheduling; 96 KPrefsDialogWidBool *mEnableGroupScheduling;
95 KPrefsDialogWidBool *mEnableProjectView; 97 KPrefsDialogWidBool *mEnableProjectView;
96 98
97 QFrame *mPrinterTab; 99 Q3Frame *mPrinterTab;
98 100
99 QLineEdit *nameEdit; 101 QLineEdit *nameEdit;
100 QLineEdit *emailEdit; 102 QLineEdit *emailEdit;
101 103
102 QComboBox *timeCombo; 104 QComboBox *timeCombo;
103 QComboBox *tzCombo; 105 QComboBox *tzCombo;
104 106
105 // widgets holding preferences data 107 // widgets holding preferences data
106 QLineEdit *mNameEdit; 108 QLineEdit *mNameEdit;
107 QLineEdit *mEmailEdit; 109 QLineEdit *mEmailEdit;
108 QLabel *mNameLabel; 110 QLabel *mNameLabel;
109 QLabel *mEmailLabel; 111 QLabel *mEmailLabel;
110 QLineEdit *mAdditionalEdit; 112 QLineEdit *mAdditionalEdit;
111 QSpinBox *mAutoSaveIntervalSpin; 113 QSpinBox *mAutoSaveIntervalSpin;
112 QSpinBox *mPrioSpin; 114 QSpinBox *mPrioSpin;
113 // QListView *mAMails; 115 // QListView *mAMails;
114 QLineEdit *aEmailsEdit; 116 QLineEdit *aEmailsEdit;
115 117
116 QComboBox *mTimeZoneCombo; 118 QComboBox *mTimeZoneCombo;
117 QStringList tzonenames; 119 QStringList tzonenames;
118 QSpinBox *mStartTimeSpin; 120 QSpinBox *mStartTimeSpin;
119 QSpinBox *mDefaultDurationSpin; 121 QSpinBox *mDefaultDurationSpin;
120 QComboBox *mAlarmTimeCombo; 122 QComboBox *mAlarmTimeCombo;
121 123
122 QComboBox *mCategoryCombo; 124 QComboBox *mCategoryCombo;
123 KColorButton *mCategoryButton; 125 KColorButton *mCategoryButton;
124 QDict<QColor> mCategoryDict; 126 Q3Dict<QColor> mCategoryDict;
125 127
126 QSlider *mHourSizeSlider; 128 QSlider *mHourSizeSlider;
127 129
128 QSpinBox *mNextXDaysSpin; 130 QSpinBox *mNextXDaysSpin;
129 QSpinBox *mWhatsNextSpin; 131 QSpinBox *mWhatsNextSpin;
130 132
131 QLineEdit * mRemoteIPEdit; 133 QLineEdit * mRemoteIPEdit;
132 QLineEdit * mRemoteUser; 134 QLineEdit * mRemoteUser;
133 QLineEdit * mRemotePassWd; 135 QLineEdit * mRemotePassWd;
134 QLineEdit * mRemoteFile; 136 QLineEdit * mRemoteFile;
135 QLineEdit * mLocalTempFile; 137 QLineEdit * mLocalTempFile;
136 QWidget* mSetupSyncAlgTab; 138 QWidget* mSetupSyncAlgTab;
137 QLineEdit * mUserDateFormatLong; 139 QLineEdit * mUserDateFormatLong;
138 QLineEdit * mUserDateFormatShort; 140 QLineEdit * mUserDateFormatShort;
139 141
140 QSpinBox *mTimezoneOffsetSpin; 142 QSpinBox *mTimezoneOffsetSpin;
diff --git a/korganizer/korganizer.pro b/korganizer/korganizer.pro
index df8f8d7..0f3b328 100644
--- a/korganizer/korganizer.pro
+++ b/korganizer/korganizer.pro
@@ -1,104 +1,105 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on 2 CONFIG += qt warn_on
3 TARGET = kopi 3 TARGET = kopi
4OBJECTS_DIR = _obj/ 4OBJECTS_DIR = _obj/
5MOC_DIR = _moc 5MOC_DIR = _moc
6DESTDIR= ../bin 6DESTDIR= ../bin
7 7
8include( ../variables.pri ) 8include( ../variables.pri )
9 9
10INCLUDEPATH += ../microkde ../ interfaces ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim 10INCLUDEPATH += ../microkde ../ interfaces ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim
11#../qtcompat 11#../qtcompat
12DEFINES += KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL 12DEFINES += KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL
13DEFINES += KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER 13DEFINES += KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
14#KORG_NOPRINTER KORG_NOKABC KORG_NODND 14#KORG_NOPRINTER KORG_NOKABC KORG_NODND
15DEFINES += KORG_NOLVALTERNATION 15DEFINES += KORG_NOLVALTERNATION
16DEFINES += DESKTOP_VERSION 16DEFINES += DESKTOP_VERSION
17unix : { 17unix : {
18staticlib: { 18staticlib: {
19 TARGET = kopi_linux 19 TARGET = kopi_linux
20LIBS += ../bin/libmicrokabc_qtopia.a 20LIBS += ../bin/libxmicrokabc_qtopia.a
21LIBS += ../bin/libmicrokabc_file.a 21LIBS += ../bin/libxmicrokabc_file.a
22LIBS += ../bin/libmicrokabc_dir.a 22LIBS += ../bin/libxmicrokabc_dir.a
23LIBS += ../bin/libmicrokdepim.a 23LIBS += ../bin/libxmicrokdepim.a
24LIBS += ../bin/libmicrokcal.a 24LIBS += ../bin/libxmicrokcal.a
25LIBS += ../bin/libmicrokabc.a 25LIBS += ../bin/libxmicrokabc.a
26LIBS += ../bin/libmicrokde.a 26LIBS += ../bin/libxmicrokde.a
27LIBS += ../bin/libmicrokabc_qtopia.a 27LIBS += ../bin/libxmicrokabc_qtopia.a
28LIBS += ../bin/libmicrokabc_file.a 28LIBS += ../bin/libxmicrokabc_file.a
29LIBS += ../bin/libmicrokabc_dir.a 29LIBS += ../bin/libxmicrokabc_dir.a
30LIBS += ../bin/libmicrokdepim.a 30LIBS += ../bin/libxmicrokdepim.a
31LIBS += ../bin/libmicrokcal.a 31LIBS += ../bin/libxmicrokcal.a
32LIBS += ../bin/libmicrokabc.a 32LIBS += ../bin/libxmicrokabc.a
33LIBS += ../bin/libmicrokde.a 33LIBS += ../bin/libxmicrokde.a
34LIBS += ../libical/lib/libical.a 34LIBS += ../libical/lib/libical.a
35LIBS += ../libical/lib/libicalss.a 35LIBS += ../libical/lib/libicalss.a
36} else { 36} else {
37LIBS += ../bin/libmicrokdepim.so 37LIBS += ../bin/libxmicrokdepim.so
38LIBS += ../bin/libmicrokcal.so 38LIBS += ../bin/libxmicrokcal.so
39LIBS += ../bin/libmicrokde.so 39LIBS += ../bin/libxmicrokde.so
40LIBS += ../bin/libmicrokabc.so 40LIBS += ../bin/libxmicrokabc.so
41#LIBS += -lbluetooth 41#LIBS += -lbluetooth
42#LIBS += -lsdp 42#LIBS += -lsdp
43 43
44#LIBS += -lldap 44#LIBS += -lldap
45} 45}
46OBJECTS_DIR = obj/unix 46OBJECTS_DIR = obj/unix
47MOC_DIR = moc/unix 47MOC_DIR = moc/unix
48} 48}
49win32: { 49win32: {
50RC_FILE = winicons.rc 50RC_FILE = winicons.rc
51DEFINES += _WIN32_ 51DEFINES += _WIN32_
52LIBS += ../bin/microkdepim.lib 52LIBS += ../bin/xmicrokdepim.lib
53LIBS += ../bin/microkcal.lib 53LIBS += ../bin/xmicrokcal.lib
54LIBS += ../bin/microkde.lib 54LIBS += ../bin/xmicrokde.lib
55LIBS += ../bin/microkabc.lib 55LIBS += ../bin/xmicrokabc.lib
56LIBS += ../libical/lib/ical.lib 56LIBS += ../libical/lib/ical.lib
57LIBS += ../libical/lib/icalss.lib 57LIBS += ../libical/lib/icalss.lib
58#LIBS += atls.lib 58#LIBS += atls.lib
59QMAKE_LINK += /NODEFAULTLIB:LIBC 59QMAKE_LINK += /NODEFAULTLIB:LIBC
60OBJECTS_DIR = obj/win 60OBJECTS_DIR = obj/win
61MOC_DIR = moc/win 61MOC_DIR = moc/win
62#olimport section 62#olimport section
63importol: { 63importol: {
64debug: { 64debug: {
65LIBS += mfc71ud.lib 65LIBS += mfc71ud.lib
66QMAKE_LINK += /NODEFAULTLIB:MSVCRT 66QMAKE_LINK += /NODEFAULTLIB:MSVCRT
67QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib 67QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib
68} 68}
69release: { 69release: {
70LIBS += mfc71u.lib 70LIBS += mfc71u.lib
71} 71}
72DEFINES += _OL_IMPORT_ 72DEFINES += _OL_IMPORT_
73 73
74HEADERS += ../outport/msoutl9.h \ 74HEADERS += ../outport/msoutl9.h \
75 koimportoldialog.h 75 koimportoldialog.h
76 76
77SOURCES += ../outport/msoutl9.cpp \ 77SOURCES += ../outport/msoutl9.cpp \
78 koimportoldialog.cpp 78 koimportoldialog.cpp
79#olimport section end 79#olimport section end
80 TARGET = kopi_xp 80 TARGET = kopi_xp
81} else { 81} else {
82 TARGET = kopi_me 82 TARGET = kopi_me
83} 83}
84 84
85} 85}
86 86
87 87
88INTERFACES = kofilterview_base.ui 88#The following line was changed from INTERFACES to FORMS3 by qt3to4
89FORMS3 = kofilterview_base.ui
89#filteredit_base.ui 90#filteredit_base.ui
90 91
91# kdateedit.h \ 92# kdateedit.h \
92 93
93HEADERS += datenavigatorcontainer.h \ 94HEADERS += datenavigatorcontainer.h \
94 filteredit_base.h \ 95 filteredit_base.h \
95 alarmclient.h \ 96 alarmclient.h \
96 calendarview.h \ 97 calendarview.h \
97 customlistviewitem.h \ 98 customlistviewitem.h \
98 datenavigator.h \ 99 datenavigator.h \
99 docprefs.h \ 100 docprefs.h \
100 filtereditdialog.h \ 101 filtereditdialog.h \
101 incomingdialog.h \ 102 incomingdialog.h \
102 incomingdialog_base.h \ 103 incomingdialog_base.h \
103 interfaces/korganizer/baseview.h \ 104 interfaces/korganizer/baseview.h \
104 interfaces/korganizer/calendarviewbase.h \ 105 interfaces/korganizer/calendarviewbase.h \
@@ -197,22 +198,28 @@ filteredit_base.cpp \
197 lineview.cpp \ 198 lineview.cpp \
198 main.cpp \ 199 main.cpp \
199 mainwindow.cpp \ 200 mainwindow.cpp \
200 navigatorbar.cpp \ 201 navigatorbar.cpp \
201 outgoingdialog.cpp \ 202 outgoingdialog.cpp \
202 outgoingdialog_base.cpp \ 203 outgoingdialog_base.cpp \
203 publishdialog.cpp \ 204 publishdialog.cpp \
204 publishdialog_base.cpp \ 205 publishdialog_base.cpp \
205 savetemplatedialog.cpp \ 206 savetemplatedialog.cpp \
206 searchdialog.cpp \ 207 searchdialog.cpp \
207 statusdialog.cpp \ 208 statusdialog.cpp \
208 timeline.cpp \ 209 timeline.cpp \
209 timespanview.cpp \ 210 timespanview.cpp \
210 ../kalarmd/alarmdialog.cpp 211 ../kalarmd/alarmdialog.cpp
211 212
212HEADERS += calprintbase.h calprinter.h calprintplugins.h cellitem.h 213HEADERS += calprintbase.h calprinter.h calprintplugins.h cellitem.h
213INTERFACES += calprintdayconfig_base.ui \ 214#The following line was changed from INTERFACES to FORMS3 by qt3to4
215FORMS3 += calprintdayconfig_base.ui \
214 calprintmonthconfig_base.ui \ 216 calprintmonthconfig_base.ui \
215 calprinttodoconfig_base.ui \ 217 calprinttodoconfig_base.ui \
216 calprintweekconfig_base.ui 218 calprintweekconfig_base.ui
217SOURCES += calprintbase.cpp calprinter.cpp calprintplugins.cpp cellitem.cpp 219SOURCES += calprintbase.cpp calprinter.cpp calprintplugins.cpp cellitem.cpp
218 220
221#The following line was inserted by qt3to4
222QT += xml qt3support
223#The following line was inserted by qt3to4
224CONFIG += uic3
225
diff --git a/korganizer/korganizerE.pro b/korganizer/korganizerE.pro
index 553c265..2c1cd42 100644
--- a/korganizer/korganizerE.pro
+++ b/korganizer/korganizerE.pro
@@ -1,32 +1,32 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3 TARGET = kopi 3 TARGET = kopi
4OBJECTS_DIR = obj/$(PLATFORM) 4OBJECTS_DIR = obj/$(PLATFORM)
5MOC_DIR = moc/$(PLATFORM) 5MOC_DIR = moc/$(PLATFORM)
6DESTDIR=$(QPEDIR)/bin 6DESTDIR=$(QPEDIR)/bin
7 7
8INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kdeui $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/libkdepim interfaces $(KDEPIMDIR)/kabc $(QPEDIR)/include 8INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kdeui $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/libkdepim interfaces $(KDEPIMDIR)/kabc $(QPEDIR)/include
9 9
10DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL 10DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL
11DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER 11DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
12DEFINES += KORG_NOLVALTERNATION 12DEFINES += KORG_NOLVALTERNATION
13#KORG_NOKABC 13#KORG_NOKABC
14LIBS += -lmicrokdepim 14LIBS += -lxmicrokdepim
15LIBS += -lmicrokcal 15LIBS += -lxmicrokcal
16LIBS += -lmicrokde 16LIBS += -lxmicrokde
17LIBS += -lmicroqtcompat 17LIBS += -lmicroqtcompat
18 18
19LIBS += $(GCC3EXTRALIB1) 19LIBS += $(GCC3EXTRALIB1)
20LIBS += $(GCC3EXTRALIB2) 20LIBS += $(GCC3EXTRALIB2)
21 21
22 22
23LIBS += -lqpe 23LIBS += -lqpe
24LIBS += -ljpeg 24LIBS += -ljpeg
25LIBS += $(QTOPIALIB) 25LIBS += $(QTOPIALIB)
26LIBS += -L$(QPEDIR)/lib 26LIBS += -L$(QPEDIR)/lib
27 27
28INTERFACES = kofilterview_base.ui 28INTERFACES = kofilterview_base.ui
29#filteredit_base.ui 29#filteredit_base.ui
30 30
31HEADERS = datenavigatorcontainer.h \ 31HEADERS = datenavigatorcontainer.h \
32 wordsgerman.h \ 32 wordsgerman.h \
diff --git a/korganizer/kotimespanview.cpp b/korganizer/kotimespanview.cpp
index 3265a3a..a214720 100644
--- a/korganizer/kotimespanview.cpp
+++ b/korganizer/kotimespanview.cpp
@@ -1,109 +1,113 @@
1#include <qlayout.h> 1#include <qlayout.h>
2//Added by qt3to4:
3#include <Q3VBoxLayout>
4#include <Q3ValueList>
5#include <Q3PtrList>
2 6
3#include <kconfig.h> 7#include <kconfig.h>
4 8
5#include "timespanview.h" 9#include "timespanview.h"
6#include "koglobals.h" 10#include "koglobals.h"
7 11
8#include "kotimespanview.h" 12#include "kotimespanview.h"
9 13
10KOTimeSpanView::KOTimeSpanView(Calendar *calendar, QWidget *parent, 14KOTimeSpanView::KOTimeSpanView(Calendar *calendar, QWidget *parent,
11 const char *name) : 15 const char *name) :
12 KOEventView( calendar, parent, name ) 16 KOEventView( calendar, parent, name )
13{ 17{
14 QBoxLayout *topLayout = new QVBoxLayout( this ); 18 Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
15 19
16 mTimeSpanView = new TimeSpanView( this ); 20 mTimeSpanView = new TimeSpanView( this );
17 topLayout->addWidget( mTimeSpanView ); 21 topLayout->addWidget( mTimeSpanView );
18 22
19 connect( mTimeSpanView, SIGNAL( dateRangeChanged() ), SLOT( updateView() ) ); 23 connect( mTimeSpanView, SIGNAL( dateRangeChanged() ), SLOT( updateView() ) );
20} 24}
21 25
22KOTimeSpanView::~KOTimeSpanView() 26KOTimeSpanView::~KOTimeSpanView()
23{ 27{
24} 28}
25 29
26void KOTimeSpanView::readSettings() 30void KOTimeSpanView::readSettings()
27{ 31{
28 readSettings(KOGlobals::config()); 32 readSettings(KOGlobals::config());
29} 33}
30 34
31void KOTimeSpanView::readSettings(KConfig *config) 35void KOTimeSpanView::readSettings(KConfig *config)
32{ 36{
33// kdDebug() << "KOTimeSpanView::readSettings()" << endl; 37// kdDebug() << "KOTimeSpanView::readSettings()" << endl;
34 38
35 config->setGroup("Views"); 39 config->setGroup("Views");
36 40
37 QValueList<int> sizes = config->readIntListEntry("Separator TimeSpanView"); 41 Q3ValueList<int> sizes = config->readIntListEntry("Separator TimeSpanView");
38 if (sizes.count() == 2) { 42 if (sizes.count() == 2) {
39 mTimeSpanView->setSplitterSizes(sizes); 43 mTimeSpanView->setSplitterSizes(sizes);
40 } 44 }
41} 45}
42 46
43void KOTimeSpanView::writeSettings(KConfig *config) 47void KOTimeSpanView::writeSettings(KConfig *config)
44{ 48{
45// kdDebug() << "KOTimeSpanView::writeSettings()" << endl; 49// kdDebug() << "KOTimeSpanView::writeSettings()" << endl;
46 50
47 config->setGroup("Views"); 51 config->setGroup("Views");
48 52
49 QValueList<int> list = mTimeSpanView->splitterSizes(); 53 Q3ValueList<int> list = mTimeSpanView->splitterSizes();
50 config->writeEntry("Separator TimeSpanView",list); 54 config->writeEntry("Separator TimeSpanView",list);
51} 55}
52 56
53int KOTimeSpanView::maxDatesHint() 57int KOTimeSpanView::maxDatesHint()
54{ 58{
55 return 0; 59 return 0;
56} 60}
57 61
58int KOTimeSpanView::currentDateCount() 62int KOTimeSpanView::currentDateCount()
59{ 63{
60 return 0; 64 return 0;
61} 65}
62 66
63QPtrList<Incidence> KOTimeSpanView::selectedIncidences() 67Q3PtrList<Incidence> KOTimeSpanView::selectedIncidences()
64{ 68{
65 QPtrList<Incidence> selected; 69 Q3PtrList<Incidence> selected;
66 70
67 return selected; 71 return selected;
68} 72}
69 73
70void KOTimeSpanView::updateView() 74void KOTimeSpanView::updateView()
71{ 75{
72 insertItems( mTimeSpanView->startDateTime().date(), 76 insertItems( mTimeSpanView->startDateTime().date(),
73 mTimeSpanView->endDateTime().date() ); 77 mTimeSpanView->endDateTime().date() );
74} 78}
75 79
76void KOTimeSpanView::showDates(const QDate &start, const QDate &end) 80void KOTimeSpanView::showDates(const QDate &start, const QDate &end)
77{ 81{
78 QDate s = start.addDays( -2 ); 82 QDate s = start.addDays( -2 );
79 QDate e = end.addDays( 2 ); 83 QDate e = end.addDays( 2 );
80 84
81 insertItems( s, e ); 85 insertItems( s, e );
82} 86}
83 87
84void KOTimeSpanView::insertItems(const QDate &start, const QDate &end) 88void KOTimeSpanView::insertItems(const QDate &start, const QDate &end)
85{ 89{
86 mTimeSpanView->clear(); 90 mTimeSpanView->clear();
87 mTimeSpanView->setDateRange( start, end ); 91 mTimeSpanView->setDateRange( (QDateTime)start, (QDateTime)end );
88 92
89 QPtrList<Event> events = calendar()->events( start, end ); 93 Q3PtrList<Event> events = calendar()->events( start, end );
90 Event *event = events.first(); 94 Event *event = events.first();
91 while( event ) { 95 while( event ) {
92// kdDebug() << "KOTimeSpanView::showDates() add event: " << event->summary() 96// kdDebug() << "KOTimeSpanView::showDates() add event: " << event->summary()
93// << endl; 97// << endl;
94 98
95 mTimeSpanView->addItem( event ); 99 mTimeSpanView->addItem( event );
96 100
97 event = events.next(); 101 event = events.next();
98 } 102 }
99 103
100 mTimeSpanView->updateView(); 104 mTimeSpanView->updateView();
101} 105}
102 106
103void KOTimeSpanView::showEvents(QPtrList<Event> eventList) 107void KOTimeSpanView::showEvents(Q3PtrList<Event> eventList)
104{ 108{
105} 109}
106 110
107void KOTimeSpanView::changeEventDisplay(Event *, int) 111void KOTimeSpanView::changeEventDisplay(Event *, int)
108{ 112{
109} 113}
diff --git a/korganizer/kotimespanview.h b/korganizer/kotimespanview.h
index c682ed8..c3e4b41 100644
--- a/korganizer/kotimespanview.h
+++ b/korganizer/kotimespanview.h
@@ -1,41 +1,43 @@
1#ifndef KOTIMESPANVIEW_H 1#ifndef KOTIMESPANVIEW_H
2#define KOTIMESPANVIEW_H 2#define KOTIMESPANVIEW_H
3 3
4#include "koeventview.h" 4#include "koeventview.h"
5//Added by qt3to4:
6#include <Q3PtrList>
5 7
6class KConfig; 8class KConfig;
7class TimeSpanView; 9class TimeSpanView;
8 10
9class KOTimeSpanView : public KOEventView 11class KOTimeSpanView : public KOEventView
10{ 12{
11 Q_OBJECT 13 Q_OBJECT
12 public: 14 public:
13 KOTimeSpanView(Calendar *calendar, QWidget *parent = 0, 15 KOTimeSpanView(Calendar *calendar, QWidget *parent = 0,
14 const char *name = 0); 16 const char *name = 0);
15 ~KOTimeSpanView(); 17 ~KOTimeSpanView();
16 18
17 virtual int maxDatesHint(); 19 virtual int maxDatesHint();
18 virtual int currentDateCount(); 20 virtual int currentDateCount();
19 virtual QPtrList<Incidence> selectedIncidences(); 21 virtual Q3PtrList<Incidence> selectedIncidences();
20 DateList selectedDates() 22 DateList selectedDates()
21 {DateList q; 23 {DateList q;
22 return q;} 24 return q;}
23 25
24 void readSettings(); 26 void readSettings();
25 void readSettings( KConfig * ); 27 void readSettings( KConfig * );
26 void writeSettings( KConfig * ); 28 void writeSettings( KConfig * );
27 29
28 public slots: 30 public slots:
29 virtual void updateView(); 31 virtual void updateView();
30 virtual void showDates(const QDate &start, const QDate &end); 32 virtual void showDates(const QDate &start, const QDate &end);
31 virtual void showEvents(QPtrList<Event> eventList); 33 virtual void showEvents(Q3PtrList<Event> eventList);
32 34
33 void changeEventDisplay(Event *, int); 35 void changeEventDisplay(Event *, int);
34 36
35 private: 37 private:
36 void insertItems( const QDate &start, const QDate & end ); 38 void insertItems( const QDate &start, const QDate & end );
37 39
38 TimeSpanView *mTimeSpanView; 40 TimeSpanView *mTimeSpanView;
39}; 41};
40 42
41#endif 43#endif
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 20a35d2..aeab92a 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -10,41 +10,46 @@
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qtooltip.h> 25#include <qtooltip.h>
26#include <qframe.h> 26#include <q3frame.h>
27#include <qpixmap.h> 27#include <qpixmap.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qhbox.h> 29#include <q3hbox.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qdir.h> 31#include <qdir.h>
32#include <qdatetime.h> 32#include <qdatetime.h>
33#include <qapplication.h> 33#include <qapplication.h>
34#include <QDesktopWidget>
34#include <qtabwidget.h> 35#include <qtabwidget.h>
36//Added by qt3to4:
37#include <Q3HBoxLayout>
38#include <Q3PtrList>
39#include <Q3VBoxLayout>
35 40
36#include <kiconloader.h> 41#include <kiconloader.h>
37#include <klocale.h> 42#include <klocale.h>
38#include <kfiledialog.h> 43#include <kfiledialog.h>
39#include <kstandarddirs.h> 44#include <kstandarddirs.h>
40#include <kmessagebox.h> 45#include <kmessagebox.h>
41 46
42#include <libkdepim/categoryselectdialog.h> 47#include <libkdepim/categoryselectdialog.h>
43#include <libkcal/calendarlocal.h> 48#include <libkcal/calendarlocal.h>
44#include <libkcal/calendarresources.h> 49#include <libkcal/calendarresources.h>
45#include <libkcal/resourcecalendar.h> 50#include <libkcal/resourcecalendar.h>
46#include <libkcal/icalformat.h> 51#include <libkcal/icalformat.h>
47#include <kresources/resourceselectdialog.h> 52#include <kresources/resourceselectdialog.h>
48#include <libkdepim/kdateedit.h> 53#include <libkdepim/kdateedit.h>
49 54
50#include "koprefs.h" 55#include "koprefs.h"
@@ -68,148 +73,148 @@ KOTodoEditor::~KOTodoEditor()
68{ 73{
69 emit dialogClose( mTodo ); 74 emit dialogClose( mTodo );
70} 75}
71 76
72void KOTodoEditor::init() 77void KOTodoEditor::init()
73{ 78{
74 setupGeneral(); 79 setupGeneral();
75 setupAttendeesTab(); 80 setupAttendeesTab();
76 setupRecurrence(); 81 setupRecurrence();
77 connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence())); 82 connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence()));
78 mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") ); 83 mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") );
79 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), 84 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
80 mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime))); 85 mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
81} 86}
82void KOTodoEditor::setupRecurrence() 87void KOTodoEditor::setupRecurrence()
83{ 88{
84 QFrame *topFrame = addPage( i18n("Recurrence") ); 89 Q3Frame *topFrame = addPage( i18n("Recurrence") );
85 QBoxLayout *topLayout = new QVBoxLayout( topFrame ); 90 Q3BoxLayout *topLayout = new Q3VBoxLayout( topFrame );
86 91
87 mRecurrence = new KOEditorRecurrence( topFrame ); 92 mRecurrence = new KOEditorRecurrence( topFrame );
88 topLayout->addWidget( mRecurrence ); 93 topLayout->addWidget( mRecurrence );
89} 94}
90 95
91void KOTodoEditor::setCategories( QString s ) 96void KOTodoEditor::setCategories( QString s )
92{ 97{
93 mGeneral->setCategories(s); 98 mGeneral->setCategories(s);
94} 99}
95void KOTodoEditor::setSecrecy( int sec ) 100void KOTodoEditor::setSecrecy( int sec )
96{ 101{
97 mGeneral->setSecrecy( sec ); 102 mGeneral->setSecrecy( sec );
98} 103}
99void KOTodoEditor::reload() 104void KOTodoEditor::reload()
100{ 105{
101 if ( mTodo ) readTodo( mTodo ); 106 if ( mTodo ) readTodo( mTodo );
102} 107}
103 108
104void KOTodoEditor::setupGeneral() 109void KOTodoEditor::setupGeneral()
105{ 110{
106 mGeneral = new KOEditorGeneralTodo(this); 111 mGeneral = new KOEditorGeneralTodo(this);
107 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); 112 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
108 113
109 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); 114 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
110 //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), 115 //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)),
111 // mGeneral,SLOT(setCategories(const QString &))); 116 // mGeneral,SLOT(setCategories(const QString &)));
112 117
113 if (KOPrefs::instance()->mCompactDialogs) { 118 if (KOPrefs::instance()->mCompactDialogs) {
114 QFrame *topFrame = addPage(i18n("General")); 119 Q3Frame *topFrame = addPage(i18n("General"));
115 120
116 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 121 Q3BoxLayout *topLayout = new Q3VBoxLayout(topFrame);
117 if ( QApplication::desktop()->width() < 480 ) { 122 if ( QApplication::desktop()->width() < 480 ) {
118 topLayout->setMargin(marginHintSmall()); 123 topLayout->setMargin(marginHintSmall());
119 topLayout->setSpacing(spacingHintSmall()); 124 topLayout->setSpacing(spacingHintSmall());
120 } else { 125 } else {
121 topLayout->setMargin(marginHint()); 126 topLayout->setMargin(marginHint());
122 topLayout->setSpacing(spacingHint()); 127 topLayout->setSpacing(spacingHint());
123 } 128 }
124 topLayout->addStretch( 1 ); 129 topLayout->addStretch( 1 );
125 mGeneral->initHeader(topFrame,topLayout); 130 mGeneral->initHeader(topFrame,topLayout);
126 topLayout->addStretch( 1 ); 131 topLayout->addStretch( 1 );
127 mGeneral->initTime(topFrame,topLayout); 132 mGeneral->initTime(topFrame,topLayout);
128 topLayout->addStretch( 1 ); 133 topLayout->addStretch( 1 );
129 mGeneral->initAlarm(topFrame,topLayout); 134 mGeneral->initAlarm(topFrame,topLayout);
130 topLayout->addStretch( 1 ); 135 topLayout->addStretch( 1 );
131 mGeneral->enableAlarm( false ); 136 mGeneral->enableAlarm( false );
132 137
133 138
134 QBoxLayout *priorityLayout; 139 Q3BoxLayout *priorityLayout;
135 if ( QApplication::desktop()->width() < 500 ) 140 if ( QApplication::desktop()->width() < 500 )
136 priorityLayout = new QVBoxLayout( topLayout ); 141 priorityLayout = new Q3VBoxLayout( topLayout );
137 else 142 else
138 priorityLayout = new QHBoxLayout( topLayout ); 143 priorityLayout = new Q3HBoxLayout( topLayout );
139 QWidget* prioWidget = new QWidget (topFrame); 144 QWidget* prioWidget = new QWidget (topFrame);
140 priorityLayout->addWidget( prioWidget ); 145 priorityLayout->addWidget( prioWidget );
141 QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget); 146 Q3HBoxLayout* priorityLayout2 = new Q3HBoxLayout( prioWidget);
142 147
143 148
144 QIconSet icon; 149 QIcon icon;
145 if ( QApplication::desktop()->width() < 321 ) 150 if ( QApplication::desktop()->width() < 321 )
146 icon = SmallIcon("fileimport16"); 151 icon = SmallIcon("fileimport16");
147 else 152 else
148 icon = SmallIcon("fileimport"); 153 icon = SmallIcon("fileimport");
149 QPushButton * loadTemplate = new QPushButton( prioWidget); 154 QPushButton * loadTemplate = new QPushButton( prioWidget);
150 loadTemplate->setIconSet (icon ) ; 155 loadTemplate->setIconSet (icon ) ;
151 int size = loadTemplate->sizeHint().height(); 156 int size = loadTemplate->sizeHint().height();
152 loadTemplate->setFixedSize( size, size ); 157 loadTemplate->setFixedSize( size, size );
153 if ( QApplication::desktop()->width() < 321 ) 158 if ( QApplication::desktop()->width() < 321 )
154 icon = SmallIcon("fileexport16"); 159 icon = SmallIcon("fileexport16");
155 else 160 else
156 icon = SmallIcon("fileexport"); 161 icon = SmallIcon("fileexport");
157 QPushButton * saveTemplate = new QPushButton( prioWidget); 162 QPushButton * saveTemplate = new QPushButton( prioWidget);
158 saveTemplate->setIconSet (icon ) ; 163 saveTemplate->setIconSet (icon ) ;
159 saveTemplate->setFixedSize( size, size ); 164 saveTemplate->setFixedSize( size, size );
160 165
161 priorityLayout2->addWidget(loadTemplate); 166 priorityLayout2->addWidget(loadTemplate);
162 priorityLayout2->addWidget(saveTemplate); 167 priorityLayout2->addWidget(saveTemplate);
163 mGeneral->initPriority(prioWidget,priorityLayout2); 168 mGeneral->initPriority(prioWidget,priorityLayout2);
164 mGeneral->initCategories( topFrame, priorityLayout ); 169 mGeneral->initCategories( topFrame, priorityLayout );
165 topLayout->addStretch(1); 170 topLayout->addStretch(1);
166 171
167 QFrame *topFrame2 = addPage(i18n("Details")); 172 Q3Frame *topFrame2 = addPage(i18n("Details"));
168 173
169 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); 174 Q3BoxLayout *topLayout2 = new Q3VBoxLayout(topFrame2);
170 topLayout2->setMargin(marginHint()); 175 topLayout2->setMargin(marginHint());
171 topLayout2->setSpacing(spacingHint()); 176 topLayout2->setSpacing(spacingHint());
172 177
173 QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 ); 178 Q3HBoxLayout *completionLayout = new Q3HBoxLayout( topLayout2 );
174 mGeneral->initCompletion(topFrame2,completionLayout); 179 mGeneral->initCompletion(topFrame2,completionLayout);
175 180
176 181
177 mGeneral->initSecrecy( topFrame2, topLayout2 ); 182 mGeneral->initSecrecy( topFrame2, topLayout2 );
178 mGeneral->initDescription(topFrame2,topLayout2); 183 mGeneral->initDescription(topFrame2,topLayout2);
179 184
180 // QHBox * hb = new QHBox ( topFrame2 ); 185 // QHBox * hb = new QHBox ( topFrame2 );
181 // topLayout2->addWidget(hb); 186 // topLayout2->addWidget(hb);
182 // hb->setSpacing( 3 ); 187 // hb->setSpacing( 3 );
183 188
184 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 189 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
185 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 190 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
186 191
187 } else { 192 } else {
188 QFrame *topFrame = addPage(i18n("General")); 193 Q3Frame *topFrame = addPage(i18n("General"));
189 194
190 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 195 Q3BoxLayout *topLayout = new Q3VBoxLayout(topFrame);
191 topLayout->setSpacing(spacingHint()); 196 topLayout->setSpacing(spacingHint());
192 197
193 mGeneral->initHeader(topFrame,topLayout); 198 mGeneral->initHeader(topFrame,topLayout);
194 mGeneral->initTime(topFrame,topLayout); 199 mGeneral->initTime(topFrame,topLayout);
195 mGeneral->initStatus(topFrame,topLayout); 200 mGeneral->initStatus(topFrame,topLayout);
196 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 201 Q3BoxLayout *alarmLineLayout = new Q3HBoxLayout(topLayout);
197 mGeneral->initAlarm(topFrame,alarmLineLayout); 202 mGeneral->initAlarm(topFrame,alarmLineLayout);
198 mGeneral->initDescription(topFrame,topLayout); 203 mGeneral->initDescription(topFrame,topLayout);
199 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); 204 Q3BoxLayout *detailsLayout = new Q3HBoxLayout(topLayout);
200 mGeneral->initCategories( topFrame, detailsLayout ); 205 mGeneral->initCategories( topFrame, detailsLayout );
201 mGeneral->initSecrecy( topFrame, detailsLayout ); 206 mGeneral->initSecrecy( topFrame, detailsLayout );
202 } 207 }
203 mGeneral->finishSetup(); 208 mGeneral->finishSetup();
204 209
205} 210}
206 211
207void KOTodoEditor::editTodo(Todo *todo, bool editDescription) 212void KOTodoEditor::editTodo(Todo *todo, bool editDescription)
208{ 213{
209 //init(); 214 //init();
210 215
211 mTodo = todo; 216 mTodo = todo;
212 readTodo(mTodo); 217 readTodo(mTodo);
213 if ( editDescription ) { 218 if ( editDescription ) {
214 showPage( 1 ); 219 showPage( 1 );
215 mGeneral->setFocusOn( 1 ); 220 mGeneral->setFocusOn( 1 );
@@ -414,33 +419,33 @@ void KOTodoEditor::slotLoadTemplate()
414 419
415 QString fileName =locateLocal( "templates", "todos" ); 420 QString fileName =locateLocal( "templates", "todos" );
416 QDir t_dir; 421 QDir t_dir;
417 if ( !t_dir.exists(fileName) ) 422 if ( !t_dir.exists(fileName) )
418 t_dir.mkdir ( fileName ); 423 t_dir.mkdir ( fileName );
419 fileName += "/todo"; 424 fileName += "/todo";
420 fileName = KFileDialog::getSaveFileName( fileName , "Load Todo template", this ); 425 fileName = KFileDialog::getSaveFileName( fileName , "Load Todo template", this );
421 if ( fileName.length() == 0 ) 426 if ( fileName.length() == 0 )
422 return; 427 return;
423 CalendarLocal cal; 428 CalendarLocal cal;
424 ICalFormat format; 429 ICalFormat format;
425 if ( !format.load( &cal, fileName ) ) { 430 if ( !format.load( &cal, fileName ) ) {
426 KMessageBox::error( this, i18n("Error loading template file\n '%1'.") 431 KMessageBox::error( this, i18n("Error loading template file\n '%1'.")
427 .arg( fileName ) ); 432 .arg( fileName ) );
428 return ; 433 return ;
429 } 434 }
430 QPtrList<Todo> todos = cal.todos(); 435 Q3PtrList<Todo> todos = cal.todos();
431 Todo * todo = todos.first(); 436 Todo * todo = todos.first();
432 if ( !todo ) { 437 if ( !todo ) {
433 KMessageBox::error( this, 438 KMessageBox::error( this,
434 i18n("Template does not\ncontain a valid Todo.")); 439 i18n("Template does not\ncontain a valid Todo."));
435 } else { 440 } else {
436 readTodo( todo ); 441 readTodo( todo );
437 } 442 }
438 443
439} 444}
440 445
441void KOTodoEditor::slotSaveTemplate() 446void KOTodoEditor::slotSaveTemplate()
442{ 447{
443 QString fileName =locateLocal( "templates", "todos" ); 448 QString fileName =locateLocal( "templates", "todos" );
444 QDir t_dir; 449 QDir t_dir;
445 if ( !t_dir.exists(fileName) ) 450 if ( !t_dir.exists(fileName) )
446 t_dir.mkdir ( fileName ); 451 t_dir.mkdir ( fileName );
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index ba94057..2b8fbd3 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -8,43 +8,59 @@
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <QDesktopWidget>
25
24#include <qlayout.h> 26#include <qlayout.h>
25#include <qheader.h> 27#include <q3header.h>
26#include <qcursor.h> 28#include <qcursor.h>
27#include <qwhatsthis.h> 29#include <q3whatsthis.h>
28#include <qdialog.h> 30#include <qdialog.h>
29#include <qlabel.h> 31#include <qlabel.h>
30#include <qpushbutton.h> 32#include <qpushbutton.h>
31 33
32#include <qinputdialog.h> 34#include <qinputdialog.h>
33 35
34#include <qvbox.h> 36#include <q3vbox.h>
37//Added by qt3to4:
38#include <QWheelEvent>
39#include <QFocusEvent>
40#include <QDragLeaveEvent>
41#include <QMouseEvent>
42#include <QDragEnterEvent>
43#include <QKeyEvent>
44#include <Q3HBoxLayout>
45#include <Q3VBoxLayout>
46#include <QDropEvent>
47#include <QDragMoveEvent>
48#include <QPaintEvent>
49#include <Q3PopupMenu>
50#include <Q3PtrList>
35#include <kdebug.h> 51#include <kdebug.h>
36#include "koprefs.h" 52#include "koprefs.h"
37#include <klocale.h> 53#include <klocale.h>
38#include <kglobal.h> 54#include <kglobal.h>
39#include <kdateedit.h> 55#include <kdateedit.h>
40#include "ktimeedit.h" 56#include "ktimeedit.h"
41#include <kiconloader.h> 57#include <kiconloader.h>
42#include <kmessagebox.h> 58#include <kmessagebox.h>
43 59
44#include <libkcal/icaldrag.h> 60#include <libkcal/icaldrag.h>
45#include <libkcal/vcaldrag.h> 61#include <libkcal/vcaldrag.h>
46#include <libkcal/calfilter.h> 62#include <libkcal/calfilter.h>
47#include <libkcal/dndfactory.h> 63#include <libkcal/dndfactory.h>
48#include <libkcal/calendarresources.h> 64#include <libkcal/calendarresources.h>
49#include <libkcal/resourcecalendar.h> 65#include <libkcal/resourcecalendar.h>
50#include <kresources/resourceselectdialog.h> 66#include <kresources/resourceselectdialog.h>
@@ -55,76 +71,76 @@
55#include <qapplication.h> 71#include <qapplication.h>
56#endif 72#endif
57#ifndef KORG_NOPRINTER 73#ifndef KORG_NOPRINTER
58#include "calprinter.h" 74#include "calprinter.h"
59#endif 75#endif
60#include "docprefs.h" 76#include "docprefs.h"
61 77
62#include "kotodoview.h" 78#include "kotodoview.h"
63using namespace KOrg; 79using namespace KOrg;
64 80
65 81
66KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) : 82KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) :
67 QDialog( parent, name, true ) 83 QDialog( parent, name, true )
68{ 84{
69 mStopAll = true; 85 mStopAll = true;
70 setCaption( i18n("Start todo") ); 86 setCaption( i18n("Start todo") );
71 QVBoxLayout* lay = new QVBoxLayout( this ); 87 Q3VBoxLayout* lay = new Q3VBoxLayout( this );
72 lay->setSpacing( 3 ); 88 lay->setSpacing( 3 );
73 lay->setMargin( 3 ); 89 lay->setMargin( 3 );
74 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this ); 90 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this );
75 lay->addWidget( lab ); 91 lay->addWidget( lab );
76 lab->setAlignment( AlignCenter ); 92 lab->setAlignment( Qt::AlignCenter );
77 93
78 QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this ); 94 QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this );
79 lay->addWidget( ok ); 95 lay->addWidget( ok );
80 ok->setDefault( true ); 96 ok->setDefault( true );
81 QPushButton * start = new QPushButton( i18n("Start todo"), this ); 97 QPushButton * start = new QPushButton( i18n("Start todo"), this );
82 lay->addWidget( start ); 98 lay->addWidget( start );
83 QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this ); 99 QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this );
84 lay->addWidget( cancel ); 100 lay->addWidget( cancel );
85 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 101 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
86 connect ( start,SIGNAL(clicked() ),this , SLOT ( doStop() ) ); 102 connect ( start,SIGNAL(clicked() ),this , SLOT ( doStop() ) );
87 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 103 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
88 resize( sizeHint() ); 104 resize( sizeHint() );
89 105
90} 106}
91void KOStartTodoPrefs::doStop() 107void KOStartTodoPrefs::doStop()
92{ 108{
93 mStopAll = false; 109 mStopAll = false;
94 accept(); 110 accept();
95} 111}
96KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : 112KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) :
97 QDialog( parent, name, true ) 113 QDialog( parent, name, true )
98{ 114{
99 mTodo = todo; 115 mTodo = todo;
100 setCaption( i18n("Stop todo") ); 116 setCaption( i18n("Stop todo") );
101 QVBoxLayout* lay = new QVBoxLayout( this ); 117 Q3VBoxLayout* lay = new Q3VBoxLayout( this );
102 lay->setSpacing( 3 ); 118 lay->setSpacing( 3 );
103 lay->setMargin( 3 ); 119 lay->setMargin( 3 );
104 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this ); 120 QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this );
105 lay->addWidget( lab ); 121 lay->addWidget( lab );
106 lab->setAlignment( AlignHCenter ); 122 lab->setAlignment( Qt::AlignHCenter );
107 lab = new QLabel( i18n("Additional Comment:"), this ); 123 lab = new QLabel( i18n("Additional Comment:"), this );
108 lay->addWidget( lab ); 124 lay->addWidget( lab );
109 mComment = new QLineEdit( this ); 125 mComment = new QLineEdit( this );
110 lay->addWidget( mComment ); 126 lay->addWidget( mComment );
111 QHBox * start = new QHBox ( this ); 127 Q3HBox * start = new Q3HBox ( this );
112 lay->addWidget( start ); 128 lay->addWidget( start );
113 lab = new QLabel( i18n("Start:"), start ); 129 lab = new QLabel( i18n("Start:"), start );
114 QHBox * end = new QHBox ( this ); 130 Q3HBox * end = new Q3HBox ( this );
115 lay->addWidget( end ); 131 lay->addWidget( end );
116 lab = new QLabel( i18n("End:"), end ); 132 lab = new QLabel( i18n("End:"), end );
117 sde = new KDateEdit( start ); 133 sde = new KDateEdit( start );
118 ste = new KOTimeEdit( start ); 134 ste = new KOTimeEdit( start );
119 connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); 135 connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) );
120 ede = new KDateEdit( end ); 136 ede = new KDateEdit( end );
121 ete = new KOTimeEdit(end ); 137 ete = new KOTimeEdit(end );
122 connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); 138 connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) );
123 sde->setDate( mTodo->runStart().date() ); 139 sde->setDate( mTodo->runStart().date() );
124 ste->setTime( mTodo->runStart().time() ); 140 ste->setTime( mTodo->runStart().time() );
125 mStop = QDateTime::currentDateTime(); 141 mStop = QDateTime::currentDateTime();
126 ede->setDate( mStop.date()); 142 ede->setDate( mStop.date());
127 ete->setTime( mStop.time() ); 143 ete->setTime( mStop.time() );
128 QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); 144 QPushButton * ok = new QPushButton( i18n("Stop and save"), this );
129 lay->addWidget( ok ); 145 lay->addWidget( ok );
130 ok->setDefault( true ); 146 ok->setDefault( true );
@@ -160,36 +176,36 @@ void KOStopTodoPrefs::accept()
160 QTime( mStop.time().hour() , mStop.time().minute() ) ) ) 176 QTime( mStop.time().hour() , mStop.time().minute() ) ) )
161 stop = mStop; 177 stop = mStop;
162 178
163 mTodo->saveRunningInfo( mComment->text(), start, stop ); 179 mTodo->saveRunningInfo( mComment->text(), start, stop );
164 QDialog::accept(); 180 QDialog::accept();
165} 181}
166void KOStopTodoPrefs::doNotSave() 182void KOStopTodoPrefs::doNotSave()
167{ 183{
168 int result = KMessageBox::warningContinueCancel(this, 184 int result = KMessageBox::warningContinueCancel(this,
169 i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") ); 185 i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") );
170 if (result != KMessageBox::Continue) return; 186 if (result != KMessageBox::Continue) return;
171 mTodo->stopRunning(); 187 mTodo->stopRunning();
172 QDialog::accept(); 188 QDialog::accept();
173} 189}
174 190
175 191
176class KOTodoViewWhatsThis :public QWhatsThis 192class KOTodoViewWhatsThis :public Q3WhatsThis
177{ 193{
178public: 194public:
179 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 195 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : Q3WhatsThis( wid ), _wid(wid),_view (view) { };
180 196
181protected: 197protected:
182 virtual QString text( const QPoint& p) 198 virtual QString text( const QPoint& p)
183 { 199 {
184 return _view->getWhatsThisText(p) ; 200 return _view->getWhatsThisText(p) ;
185 } 201 }
186private: 202private:
187 QWidget* _wid; 203 QWidget* _wid;
188 KOTodoView * _view; 204 KOTodoView * _view;
189}; 205};
190 206
191KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, 207KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
192 const char *name) : 208 const char *name) :
193 KListView(parent,name) 209 KListView(parent,name)
194{ 210{
195 mName = QString ( name ); 211 mName = QString ( name );
@@ -201,74 +217,74 @@ KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
201 mMousePressed = false; 217 mMousePressed = false;
202 218
203 setAcceptDrops(true); 219 setAcceptDrops(true);
204 viewport()->setAcceptDrops(true); 220 viewport()->setAcceptDrops(true);
205 int size = 16; 221 int size = 16;
206 if (qApp->desktop()->width() < 300 ) 222 if (qApp->desktop()->width() < 300 )
207 size = 12; 223 size = 12;
208 setTreeStepSize( size + 6 ); 224 setTreeStepSize( size + 6 );
209 225
210} 226}
211 227
212void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) 228void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e)
213{ 229{
214#ifndef KORG_NODND 230#ifndef KORG_NODND
215// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; 231// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl;
216 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 232 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
217 !QTextDrag::canDecode( e ) ) { 233 !Q3TextDrag::canDecode( e ) ) {
218 e->ignore(); 234 e->ignore();
219 return; 235 return;
220 } 236 }
221 237
222 mOldCurrent = currentItem(); 238 mOldCurrent = currentItem();
223#endif 239#endif
224} 240}
225 241
226 242
227void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) 243void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e)
228{ 244{
229#ifndef KORG_NODND 245#ifndef KORG_NODND
230// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; 246// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl;
231 247
232 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 248 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
233 !QTextDrag::canDecode( e ) ) { 249 !Q3TextDrag::canDecode( e ) ) {
234 e->ignore(); 250 e->ignore();
235 return; 251 return;
236 } 252 }
237 253
238 e->accept(); 254 e->accept();
239#endif 255#endif
240} 256}
241 257
242void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) 258void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *)
243{ 259{
244#ifndef KORG_NODND 260#ifndef KORG_NODND
245// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; 261// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl;
246 262
247 setCurrentItem(mOldCurrent); 263 setCurrentItem(mOldCurrent);
248 setSelected(mOldCurrent,true); 264 setSelected(mOldCurrent,true);
249#endif 265#endif
250} 266}
251 267
252void KOTodoListView::contentsDropEvent(QDropEvent *e) 268void KOTodoListView::contentsDropEvent(QDropEvent *e)
253{ 269{
254#ifndef KORG_NODND 270#ifndef KORG_NODND
255// kdDebug() << "KOTodoListView::contentsDropEvent" << endl; 271// kdDebug() << "KOTodoListView::contentsDropEvent" << endl;
256 272
257 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 273 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
258 !QTextDrag::canDecode( e ) ) { 274 !Q3TextDrag::canDecode( e ) ) {
259 e->ignore(); 275 e->ignore();
260 return; 276 return;
261 } 277 }
262 278
263 DndFactory factory( mCalendar ); 279 DndFactory factory( mCalendar );
264 Todo *todo = factory.createDropTodo(e); 280 Todo *todo = factory.createDropTodo(e);
265 281
266 if (todo) { 282 if (todo) {
267 e->acceptAction(); 283 e->acceptAction();
268 284
269 KOTodoViewItem *destination = 285 KOTodoViewItem *destination =
270 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); 286 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos()));
271 Todo *destinationEvent = 0; 287 Todo *destinationEvent = 0;
272 if (destination) destinationEvent = destination->todo(); 288 if (destination) destinationEvent = destination->todo();
273 289
274 Todo *existingTodo = mCalendar->todo(todo->uid()); 290 Todo *existingTodo = mCalendar->todo(todo->uid());
@@ -287,109 +303,109 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e)
287 } 303 }
288 internalDrop = true; 304 internalDrop = true;
289 if ( destinationEvent ) 305 if ( destinationEvent )
290 reparentTodoSignal( destinationEvent, existingTodo ); 306 reparentTodoSignal( destinationEvent, existingTodo );
291 else 307 else
292 unparentTodoSignal(existingTodo); 308 unparentTodoSignal(existingTodo);
293 delete todo; 309 delete todo;
294 } else { 310 } else {
295 mCalendar->addTodo(todo); 311 mCalendar->addTodo(todo);
296 emit todoDropped(todo, KOGlobals::EVENTADDED); 312 emit todoDropped(todo, KOGlobals::EVENTADDED);
297 if ( destinationEvent ) 313 if ( destinationEvent )
298 reparentTodoSignal( destinationEvent, todo ); 314 reparentTodoSignal( destinationEvent, todo );
299 } 315 }
300 } 316 }
301 else { 317 else {
302 QString text; 318 QString text;
303 if (QTextDrag::decode(e,text)) { 319 if (Q3TextDrag::decode(e,text)) {
304 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); 320 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) );
305 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); 321 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) ));
306 qDebug("Dropped : " + text); 322 qDebug("Dropped : " + text);
307 QStringList emails = QStringList::split(",",text); 323 QStringList emails = QStringList::split(",",text);
308 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { 324 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) {
309 int pos = (*it).find("<"); 325 int pos = (*it).find("<");
310 QString name = (*it).left(pos); 326 QString name = (*it).left(pos);
311 QString email = (*it).mid(pos); 327 QString email = (*it).mid(pos);
312 if (!email.isEmpty() && todoi) { 328 if (!email.isEmpty() && todoi) {
313 todoi->todo()->addAttendee(new Attendee(name,email)); 329 todoi->todo()->addAttendee(new Attendee(name,email));
314 } 330 }
315 } 331 }
316 } 332 }
317 else { 333 else {
318 qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); 334 qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable ");
319 e->ignore(); 335 e->ignore();
320 } 336 }
321 } 337 }
322#endif 338#endif
323} 339}
324void KOTodoListView::wheelEvent (QWheelEvent *e) 340void KOTodoListView::wheelEvent (QWheelEvent *e)
325{ 341{
326 QListView::wheelEvent (e); 342 Q3ListView::wheelEvent (e);
327} 343}
328 344
329void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) 345void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
330{ 346{
331 347
332 QPoint p(contentsToViewport(e->pos())); 348 QPoint p(contentsToViewport(e->pos()));
333 QListViewItem *i = itemAt(p); 349 Q3ListViewItem *i = itemAt(p);
334 bool rootClicked = true; 350 bool rootClicked = true;
335 if (i) { 351 if (i) {
336 // if the user clicked into the root decoration of the item, don't 352 // if the user clicked into the root decoration of the item, don't
337 // try to start a drag! 353 // try to start a drag!
338 int X = p.x(); 354 int X = p.x();
339 //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); 355 //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() );
340 if (X > header()->sectionPos(0) + 356 if (X > header()->sectionPos(0) +
341 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + 357 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
342 itemMargin() +i->height()|| 358 itemMargin() +i->height()||
343 X < header()->sectionPos(0)) { 359 X < header()->sectionPos(0)) {
344 rootClicked = false; 360 rootClicked = false;
345 } 361 }
346 } else { 362 } else {
347 rootClicked = false; 363 rootClicked = false;
348 } 364 }
349#ifndef KORG_NODND 365#ifndef KORG_NODND
350 mMousePressed = false; 366 mMousePressed = false;
351 if (! rootClicked && !( e->button() == RightButton) ) { 367 if (! rootClicked && !( e->button() == Qt::RightButton) ) {
352 mPressPos = e->pos(); 368 mPressPos = e->pos();
353 mMousePressed = true; 369 mMousePressed = true;
354 } else { 370 } else {
355 mMousePressed = false; 371 mMousePressed = false;
356 } 372 }
357#endif 373#endif
358 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); 374 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked);
359#ifndef DESKTOP_VERSION 375#ifndef DESKTOP_VERSION
360 if (!( e->button() == RightButton && rootClicked) ) 376 if (!( e->button() == RightButton && rootClicked) )
361 QListView::contentsMousePressEvent(e); 377 Q3ListView::contentsMousePressEvent(e);
362#else 378#else
363 QListView::contentsMousePressEvent(e); 379 Q3ListView::contentsMousePressEvent(e);
364#endif 380#endif
365} 381}
366void KOTodoListView::paintEvent(QPaintEvent* e) 382void KOTodoListView::paintEvent(QPaintEvent* e)
367{ 383{
368 emit paintNeeded(); 384 emit paintNeeded();
369 QListView::paintEvent( e); 385 Q3ListView::paintEvent( e);
370} 386}
371void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 387void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
372{ 388{
373 389
374#ifndef KORG_NODND 390#ifndef KORG_NODND
375 //QListView::contentsMouseMoveEvent(e); 391 //QListView::contentsMouseMoveEvent(e);
376 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > 392 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() >
377 QApplication::startDragDistance()*3) { 393 QApplication::startDragDistance()*3) {
378 mMousePressed = false; 394 mMousePressed = false;
379 QListViewItem *item = itemAt(contentsToViewport(mPressPos)); 395 Q3ListViewItem *item = itemAt(contentsToViewport(mPressPos));
380 if (item) { 396 if (item) {
381 DndFactory factory( mCalendar ); 397 DndFactory factory( mCalendar );
382 ICalDrag *vd = factory.createDrag( 398 ICalDrag *vd = factory.createDrag(
383 ((KOTodoViewItem *)item)->todo(),viewport()); 399 ((KOTodoViewItem *)item)->todo(),viewport());
384 internalDrop = false; 400 internalDrop = false;
385 // we cannot do any senseful here, because the DnD is still broken in Qt 401 // we cannot do any senseful here, because the DnD is still broken in Qt
386 if (vd->drag()) { 402 if (vd->drag()) {
387 if ( !internalDrop ) { 403 if ( !internalDrop ) {
388 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); 404 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() );
389 qDebug("Dnd: External move: Delete drag source "); 405 qDebug("Dnd: External move: Delete drag source ");
390 } else 406 } else
391 qDebug("Dnd: Internal move "); 407 qDebug("Dnd: Internal move ");
392 408
393 } else { 409 } else {
394 if ( !internalDrop ) { 410 if ( !internalDrop ) {
395 qDebug("Dnd: External Copy"); 411 qDebug("Dnd: External Copy");
@@ -409,141 +425,141 @@ void KOTodoListView::keyReleaseEvent ( QKeyEvent *e )
409 425
410 426
411void KOTodoListView::keyPressEvent ( QKeyEvent * e ) 427void KOTodoListView::keyPressEvent ( QKeyEvent * e )
412{ 428{
413 qApp->processEvents(); 429 qApp->processEvents();
414 if ( !isVisible() ) { 430 if ( !isVisible() ) {
415 e->ignore(); 431 e->ignore();
416 return; 432 return;
417 } 433 }
418 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 434 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
419 e->ignore(); 435 e->ignore();
420 // qDebug(" ignore %d",e->isAutoRepeat() ); 436 // qDebug(" ignore %d",e->isAutoRepeat() );
421 return; 437 return;
422 } 438 }
423 if (! e->isAutoRepeat() ) 439 if (! e->isAutoRepeat() )
424 mFlagKeyPressed = true; 440 mFlagKeyPressed = true;
425 QListViewItem* cn; 441 Q3ListViewItem* cn;
426 if ( (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) && mName != "todolistsmall") { 442 if ( (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) && mName != "todolistsmall") {
427 cn = currentItem(); 443 cn = currentItem();
428 if ( cn ) { 444 if ( cn ) {
429 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 445 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
430 if ( ci ){ 446 if ( ci ){
431 if ( e->state() == ShiftButton ) 447 if ( e->state() == Qt::ShiftButton )
432 ci->setOn( false ); 448 ci->setOn( false );
433 else 449 else
434 ci->setOn( true ); 450 ci->setOn( true );
435 cn = cn->itemBelow(); 451 cn = cn->itemBelow();
436 if ( cn ) { 452 if ( cn ) {
437 setCurrentItem ( cn ); 453 setCurrentItem ( cn );
438 ensureItemVisible ( cn ); 454 ensureItemVisible ( cn );
439 } 455 }
440 456
441 } 457 }
442 } 458 }
443 459
444 e->accept(); 460 e->accept();
445 return; 461 return;
446 } 462 }
447 463
448 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { 464 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
449 switch ( e->key() ) { 465 switch ( e->key() ) {
450 case Qt::Key_Down: 466 case Qt::Key_Down:
451 case Qt::Key_Up: 467 case Qt::Key_Up:
452 QListView::keyPressEvent ( e ); 468 Q3ListView::keyPressEvent ( e );
453 e->accept(); 469 e->accept();
454 break; 470 break;
455 case Qt::Key_Left: 471 case Qt::Key_Left:
456 case Qt::Key_Right: 472 case Qt::Key_Right:
457 QListView::keyPressEvent ( e ); 473 Q3ListView::keyPressEvent ( e );
458 e->accept(); 474 e->accept();
459 return; 475 return;
460 break; 476 break;
461 default: 477 default:
462 e->ignore(); 478 e->ignore();
463 break; 479 break;
464 } 480 }
465 return; 481 return;
466 } 482 }
467 e->ignore(); 483 e->ignore();
468} 484}
469void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 485void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
470{ 486{
471 QListView::contentsMouseReleaseEvent(e); 487 Q3ListView::contentsMouseReleaseEvent(e);
472 mMousePressed = false; 488 mMousePressed = false;
473} 489}
474 490
475void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 491void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
476{ 492{
477 if (!e) return; 493 if (!e) return;
478 494
479 QPoint vp = contentsToViewport(e->pos()); 495 QPoint vp = contentsToViewport(e->pos());
480 496
481 QListViewItem *item = itemAt(vp); 497 Q3ListViewItem *item = itemAt(vp);
482 498
483 emit double_Clicked(item); 499 emit double_Clicked(item);
484 if (!item) return; 500 if (!item) return;
485 501
486 emit doubleClicked(item,vp,0); 502 emit doubleClicked(item,vp,0);
487} 503}
488 504
489///////////////////////////////////////////////////////////////////////////// 505/////////////////////////////////////////////////////////////////////////////
490 506
491KOQuickTodo::KOQuickTodo(QWidget *parent) : 507KOQuickTodo::KOQuickTodo(QWidget *parent) :
492 QLineEdit(parent) 508 QLineEdit(parent)
493{ 509{
494 setText(i18n("Click to add new Todo")); 510 setText(i18n("Click to add new Todo"));
495 setFocusPolicy ( QWidget::ClickFocus ); 511 setFocusPolicy ( Qt::ClickFocus );
496} 512}
497 513
498void KOQuickTodo::focusInEvent(QFocusEvent *ev) 514void KOQuickTodo::focusInEvent(QFocusEvent *ev)
499{ 515{
500 if ( text()==i18n("Click to add new Todo") ) 516 if ( text()==i18n("Click to add new Todo") )
501 setText(""); 517 setText("");
502 QLineEdit::focusInEvent(ev); 518 QLineEdit::focusInEvent(ev);
503} 519}
504 520
505void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 521void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
506{ 522{
507 setText(i18n("Click to add new Todo")); 523 setText(i18n("Click to add new Todo"));
508 QLineEdit::focusOutEvent(ev); 524 QLineEdit::focusOutEvent(ev);
509} 525}
510 526
511///////////////////////////////////////////////////////////////////////////// 527/////////////////////////////////////////////////////////////////////////////
512 528
513KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 529KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
514 KOrg::BaseView(calendar,parent,name) 530 KOrg::BaseView(calendar,parent,name)
515{ 531{
516 mIsActiveWindow = false; 532 mIsActiveWindow = false;
517 mCurItem = 0; 533 mCurItem = 0;
518 mCurItemRootParent = 0; 534 mCurItemRootParent = 0;
519 mCurItemParent = 0; 535 mCurItemParent = 0;
520 mCurItemAbove = 0; 536 mCurItemAbove = 0;
521 mActiveItem = 0; 537 mActiveItem = 0;
522 mCategoryPopupMenu = 0; 538 mCategoryPopupMenu = 0;
523 mPendingUpdateBeforeRepaint = false; 539 mPendingUpdateBeforeRepaint = false;
524 isFlatDisplay = false; 540 isFlatDisplay = false;
525 mNavigator = 0; 541 mNavigator = 0;
526 QBoxLayout *topLayout = new QVBoxLayout(this); 542 Q3BoxLayout *topLayout = new Q3VBoxLayout(this);
527 mName = QString ( name ); 543 mName = QString ( name );
528 mBlockUpdate = false; 544 mBlockUpdate = false;
529 mQuickBar = new QWidget( this ); 545 mQuickBar = new QWidget( this );
530 topLayout->addWidget(mQuickBar); 546 topLayout->addWidget(mQuickBar);
531 547
532 mQuickAdd = new KOQuickTodo(mQuickBar); 548 mQuickAdd = new KOQuickTodo(mQuickBar);
533 QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); 549 Q3BoxLayout *quickLayout = new Q3HBoxLayout(mQuickBar);
534 quickLayout->addWidget( mQuickAdd ); 550 quickLayout->addWidget( mQuickAdd );
535 mNewSubBut = new QPushButton( "sub",mQuickBar ); 551 mNewSubBut = new QPushButton( "sub",mQuickBar );
536 QPushButton * s_done = new QPushButton( "D",mQuickBar ); 552 QPushButton * s_done = new QPushButton( "D",mQuickBar );
537 QPushButton * s_run = new QPushButton( "R",mQuickBar ); 553 QPushButton * s_run = new QPushButton( "R",mQuickBar );
538 QPushButton * allopen = new QPushButton( "O",mQuickBar ); 554 QPushButton * allopen = new QPushButton( "O",mQuickBar );
539 QPushButton * allclose = new QPushButton( "C",mQuickBar ); 555 QPushButton * allclose = new QPushButton( "C",mQuickBar );
540 QPushButton * flat = new QPushButton( "F",mQuickBar ); 556 QPushButton * flat = new QPushButton( "F",mQuickBar );
541 557
542 int fixwid = mQuickAdd->sizeHint().height(); 558 int fixwid = mQuickAdd->sizeHint().height();
543 int fixhei = fixwid; 559 int fixhei = fixwid;
544 if ( QApplication::desktop()->width() > 800 ) 560 if ( QApplication::desktop()->width() > 800 )
545 fixwid = (fixwid*3)/2; 561 fixwid = (fixwid*3)/2;
546 connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); 562 connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat()));
547 connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); 563 connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen()));
548 connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); 564 connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose()));
549 s_done->setPixmap( SmallIcon("greenhook16")); 565 s_done->setPixmap( SmallIcon("greenhook16"));
@@ -555,130 +571,130 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
555 571
556 mNewSubBut->setFixedWidth(mNewSubBut->sizeHint().width() ); 572 mNewSubBut->setFixedWidth(mNewSubBut->sizeHint().width() );
557 mNewSubBut->setEnabled( false ); 573 mNewSubBut->setEnabled( false );
558 flat->setFixedWidth( fixwid ); 574 flat->setFixedWidth( fixwid );
559 s_done->setFixedWidth( fixwid ); 575 s_done->setFixedWidth( fixwid );
560 allopen->setFixedWidth( fixwid ); 576 allopen->setFixedWidth( fixwid );
561 allclose->setFixedWidth( fixwid ); 577 allclose->setFixedWidth( fixwid );
562 s_run->setFixedWidth( fixwid ); 578 s_run->setFixedWidth( fixwid );
563 579
564 flat->setFixedHeight(fixhei ); 580 flat->setFixedHeight(fixhei );
565 s_done->setFixedHeight(fixhei ); 581 s_done->setFixedHeight(fixhei );
566 allopen->setFixedHeight(fixhei ); 582 allopen->setFixedHeight(fixhei );
567 allclose->setFixedHeight(fixhei ); 583 allclose->setFixedHeight(fixhei );
568 s_run->setFixedHeight(fixhei ); 584 s_run->setFixedHeight(fixhei );
569 mNewSubBut->setFixedHeight(fixhei ); 585 mNewSubBut->setFixedHeight(fixhei );
570 586
571 flat->setFocusPolicy( NoFocus ); 587 flat->setFocusPolicy( Qt::NoFocus );
572 s_done->setFocusPolicy( NoFocus ); 588 s_done->setFocusPolicy( Qt::NoFocus );
573 allopen->setFocusPolicy( NoFocus ); 589 allopen->setFocusPolicy( Qt::NoFocus );
574 allclose->setFocusPolicy( NoFocus ); 590 allclose->setFocusPolicy( Qt::NoFocus );
575 s_run->setFocusPolicy( NoFocus ); 591 s_run->setFocusPolicy( Qt::NoFocus );
576 mNewSubBut->setFocusPolicy( NoFocus ); 592 mNewSubBut->setFocusPolicy( Qt::NoFocus );
577 593
578 QWhatsThis::add( flat, i18n("Click this button to display all todos in a <b>flat</b> hierarchy" ) ); 594 Q3WhatsThis::add( flat, i18n("Click this button to display all todos in a <b>flat</b> hierarchy" ) );
579 QWhatsThis::add( allopen, i18n("Click this button to display all todos <b>openend</b>" ) ); 595 Q3WhatsThis::add( allopen, i18n("Click this button to display all todos <b>openend</b>" ) );
580 QWhatsThis::add( allclose, i18n("Click this button to display all todos <b>closed</b>" ) ); 596 Q3WhatsThis::add( allclose, i18n("Click this button to display all todos <b>closed</b>" ) );
581 QWhatsThis::add( s_run, i18n("Click this button to toggle show/hide <b>running</b> todos" ) ); 597 Q3WhatsThis::add( s_run, i18n("Click this button to toggle show/hide <b>running</b> todos" ) );
582 QWhatsThis::add( mNewSubBut, i18n("Click this button to add a new subtodo to the currently selected todo" ) ); 598 Q3WhatsThis::add( mNewSubBut, i18n("Click this button to add a new subtodo to the currently selected todo" ) );
583 QWhatsThis::add( s_done, i18n("Click this button to toggle show/hide <b>completed</b> todos" ) ); 599 Q3WhatsThis::add( s_done, i18n("Click this button to toggle show/hide <b>completed</b> todos" ) );
584 600
585 quickLayout->addWidget( mNewSubBut ); 601 quickLayout->addWidget( mNewSubBut );
586 quickLayout->addWidget( s_done ); 602 quickLayout->addWidget( s_done );
587 quickLayout->addWidget( s_run ); 603 quickLayout->addWidget( s_run );
588 quickLayout->addWidget( allopen ); 604 quickLayout->addWidget( allopen );
589 quickLayout->addWidget( allclose ); 605 quickLayout->addWidget( allclose );
590 quickLayout->addWidget( flat ); 606 quickLayout->addWidget( flat );
591 607
592 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); 608 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide();
593 609
594 mTodoListView = new KOTodoListView(calendar,this, name ); 610 mTodoListView = new KOTodoListView(calendar,this, name );
595 topLayout->addWidget(mTodoListView); 611 topLayout->addWidget(mTodoListView);
596 //mTodoListView->header()->setMaximumHeight(30); 612 //mTodoListView->header()->setMaximumHeight(30);
597 mTodoListView->setRootIsDecorated(true); 613 mTodoListView->setRootIsDecorated(true);
598 mTodoListView->setAllColumnsShowFocus(true); 614 mTodoListView->setAllColumnsShowFocus(true);
599 615
600 mTodoListView->setShowSortIndicator(true); 616 mTodoListView->setShowSortIndicator(true);
601 617
602 mTodoListView->addColumn(i18n("Todo")); 618 mTodoListView->addColumn(i18n("Todo"));
603 mTodoListView->addColumn(i18n("Prio")); 619 mTodoListView->addColumn(i18n("Prio"));
604 mTodoListView->setColumnAlignment(1,AlignHCenter); 620 mTodoListView->setColumnAlignment(1,Qt::AlignHCenter);
605 mTodoListView->addColumn(i18n("Complete")); 621 mTodoListView->addColumn(i18n("Complete"));
606 mTodoListView->setColumnAlignment(2,AlignCenter); 622 mTodoListView->setColumnAlignment(2,Qt::AlignCenter);
607 623
608 mTodoListView->addColumn(i18n("Due Date")); 624 mTodoListView->addColumn(i18n("Due Date"));
609 mTodoListView->setColumnAlignment(3,AlignLeft); 625 mTodoListView->setColumnAlignment(3,Qt::AlignLeft);
610 mTodoListView->addColumn(i18n("Due Time")); 626 mTodoListView->addColumn(i18n("Due Time"));
611 mTodoListView->setColumnAlignment(4,AlignHCenter); 627 mTodoListView->setColumnAlignment(4,Qt::AlignHCenter);
612 628
613 mTodoListView->addColumn(i18n("Start Date")); 629 mTodoListView->addColumn(i18n("Start Date"));
614 mTodoListView->setColumnAlignment(5,AlignLeft); 630 mTodoListView->setColumnAlignment(5,Qt::AlignLeft);
615 mTodoListView->addColumn(i18n("Start Time")); 631 mTodoListView->addColumn(i18n("Start Time"));
616 mTodoListView->setColumnAlignment(6,AlignHCenter); 632 mTodoListView->setColumnAlignment(6,Qt::AlignHCenter);
617 633
618 //mTodoListView->addColumn(i18n("Cancelled")); 634 //mTodoListView->addColumn(i18n("Cancelled"));
619 mTodoListView->addColumn(i18n("Categories")); 635 mTodoListView->addColumn(i18n("Categories"));
620 mTodoListView->addColumn(i18n("Calendar")); 636 mTodoListView->addColumn(i18n("Calendar"));
621 mTodoListView->addColumn(i18n("Last Modified")); 637 mTodoListView->addColumn(i18n("Last Modified"));
622 mTodoListView->addColumn(i18n("Created")); 638 mTodoListView->addColumn(i18n("Created"));
623 mTodoListView->addColumn(i18n("Last Modified Sub")); 639 mTodoListView->addColumn(i18n("Last Modified Sub"));
624#if 0 640#if 0
625 mTodoListView->addColumn(i18n("Sort Id")); 641 mTodoListView->addColumn(i18n("Sort Id"));
626 mTodoListView->setColumnAlignment(4,AlignHCenter); 642 mTodoListView->setColumnAlignment(4,Qt::AlignHCenter);
627#endif 643#endif
628 644
629 mTodoListView->setMinimumHeight( 60 ); 645 mTodoListView->setMinimumHeight( 60 );
630 mTodoListView->setItemsRenameable( true ); 646 mTodoListView->setItemsRenameable( true );
631 mTodoListView->setRenameable( 0 ); 647 mTodoListView->setRenameable( 0 );
632 mTodoListView->setColumnWidth( 0, 120 ); 648 mTodoListView->setColumnWidth( 0, 120 );
633 int iii = 0; 649 int iii = 0;
634 for ( iii = 0; iii< 12 ; ++iii ) 650 for ( iii = 0; iii< 12 ; ++iii )
635 mTodoListView->setColumnWidthMode( iii, QListView::Manual ); 651 mTodoListView->setColumnWidthMode( iii, Q3ListView::Manual );
636 652
637 653
638 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); 654 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this);
639 655
640 mPriorityPopupMenu = new QPopupMenu(this); 656 mPriorityPopupMenu = new Q3PopupMenu(this);
641 for (int i = 1; i <= 5; i++) { 657 for (int i = 1; i <= 5; i++) {
642 QString label = QString ("%1").arg (i); 658 QString label = QString ("%1").arg (i);
643 mPriority[mPriorityPopupMenu->insertItem (label)] = i; 659 mPriority[mPriorityPopupMenu->insertItem (label)] = i;
644 } 660 }
645 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); 661 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
646 662
647 mPercentageCompletedPopupMenu = new QPopupMenu(this); 663 mPercentageCompletedPopupMenu = new Q3PopupMenu(this);
648 for (int i = 0; i <= 100; i+=20) { 664 for (int i = 0; i <= 100; i+=20) {
649 QString label = QString ("%1 %").arg (i); 665 QString label = QString ("%1 %").arg (i);
650 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; 666 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
651 } 667 }
652 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); 668 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
653 669
654 670
655 mCategoryPopupMenu = new QPopupMenu (this); 671 mCategoryPopupMenu = new Q3PopupMenu (this);
656 mCategoryPopupMenu->setCheckable (true); 672 mCategoryPopupMenu->setCheckable (true);
657 connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 673 connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
658 connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); 674 connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ()));
659 675
660 mCalPopupMenu = new QPopupMenu (this); 676 mCalPopupMenu = new Q3PopupMenu (this);
661 mCalPopupMenu->setCheckable (true); 677 mCalPopupMenu->setCheckable (true);
662 connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); 678 connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int)));
663 connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); 679 connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ()));
664 680
665 681
666 682
667 683
668 mItemPopupMenu = new QPopupMenu(this); 684 mItemPopupMenu = new Q3PopupMenu(this);
669 mItemPopupMenu->insertItem(i18n("Show"), this, 685 mItemPopupMenu->insertItem(i18n("Show"), this,
670 SLOT (showTodo())); 686 SLOT (showTodo()));
671 mItemPopupMenu->insertItem(i18n("Edit..."), this, 687 mItemPopupMenu->insertItem(i18n("Edit..."), this,
672 SLOT (editTodo())); 688 SLOT (editTodo()));
673 mItemPopupMenu->insertItem( i18n("Delete..."), this, 689 mItemPopupMenu->insertItem( i18n("Delete..."), this,
674 SLOT (deleteTodo())); 690 SLOT (deleteTodo()));
675 mItemPopupMenu->insertItem( i18n("Clone..."), this, 691 mItemPopupMenu->insertItem( i18n("Clone..."), this,
676 SLOT (cloneTodo())); 692 SLOT (cloneTodo()));
677 mItemPopupMenu->insertItem( i18n("Move..."), this, 693 mItemPopupMenu->insertItem( i18n("Move..."), this,
678 SLOT (moveTodo())); 694 SLOT (moveTodo()));
679#ifndef DESKTOP_VERSION 695#ifndef DESKTOP_VERSION
680 mItemPopupMenu->insertItem( i18n("Beam..."), this, 696 mItemPopupMenu->insertItem( i18n("Beam..."), this,
681 SLOT (beamTodo())); 697 SLOT (beamTodo()));
682#endif 698#endif
683 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 699 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
684 SLOT (cancelTodo())); 700 SLOT (cancelTodo()));
@@ -697,33 +713,33 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
697 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, 713 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
698 SLOT (unparentTodo()),0,21); 714 SLOT (unparentTodo()),0,21);
699 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, 715 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
700 SLOT (reparentTodo()),0,22); 716 SLOT (reparentTodo()),0,22);
701 mItemPopupMenu->insertSeparator(); 717 mItemPopupMenu->insertSeparator();
702#if 0 718#if 0
703 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed..."), 719 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed..."),
704 this, SLOT( purgeCompleted() ) ); 720 this, SLOT( purgeCompleted() ) );
705 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), 721 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
706 this, SLOT( toggleCompleted() ),0, 33 ); 722 this, SLOT( toggleCompleted() ),0, 33 );
707 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 723 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
708 this, SLOT( toggleQuickTodo() ),0, 34 ); 724 this, SLOT( toggleQuickTodo() ),0, 34 );
709 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 725 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
710 this, SLOT( toggleRunning() ),0, 35 ); 726 this, SLOT( toggleRunning() ),0, 35 );
711 727
712#endif 728#endif
713 mPopupMenu = new QPopupMenu(this); 729 mPopupMenu = new Q3PopupMenu(this);
714 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, 730 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this,
715 SLOT (newTodo()),0,1); 731 SLOT (newTodo()),0,1);
716 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."), 732 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."),
717 this, SLOT(purgeCompleted()),0,2); 733 this, SLOT(purgeCompleted()),0,2);
718 mPopupMenu->insertItem(i18n("Show Completed"), 734 mPopupMenu->insertItem(i18n("Show Completed"),
719 this, SLOT( toggleCompleted() ),0,3 ); 735 this, SLOT( toggleCompleted() ),0,3 );
720 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 736 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
721 this, SLOT( toggleRunning() ),0,5 ); 737 this, SLOT( toggleRunning() ),0,5 );
722 mPopupMenu->insertItem(i18n(" set all open","Display all opened"), 738 mPopupMenu->insertItem(i18n(" set all open","Display all opened"),
723 this, SLOT( setAllOpen() ),0,6 ); 739 this, SLOT( setAllOpen() ),0,6 );
724 mPopupMenu->insertItem(i18n(" set all close","Display all closed"), 740 mPopupMenu->insertItem(i18n(" set all close","Display all closed"),
725 this, SLOT( setAllClose() ),0,7 ); 741 this, SLOT( setAllClose() ),0,7 );
726 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), 742 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"),
727 this, SLOT( setAllFlat() ),0,8 ); 743 this, SLOT( setAllFlat() ),0,8 );
728 mPopupMenu->insertSeparator(); 744 mPopupMenu->insertSeparator();
729 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 745 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
@@ -733,64 +749,64 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
733 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); 749 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu );
734 mPopupMenu->setCheckable( true ); 750 mPopupMenu->setCheckable( true );
735 mItemPopupMenu->setCheckable( true ); 751 mItemPopupMenu->setCheckable( true );
736 752
737 753
738 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 754 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
739 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 755 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
740 756
741 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 757 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
742 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 758 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
743 759
744 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 760 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
745 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 761 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
746 762
747 763
748 // Double clicking conflicts with opening/closing the subtree 764 // Double clicking conflicts with opening/closing the subtree
749 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 765 connect( mTodoListView, SIGNAL( doubleClicked( Q3ListViewItem *) ),
750 SLOT( editItem( QListViewItem *) ) ); 766 SLOT( editItem( Q3ListViewItem *) ) );
751 /* 767 /*
752 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 768 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
753 const QPoint &,int ) ), 769 const QPoint &,int ) ),
754 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 770 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
755 */ 771 */
756 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, 772 connect( mTodoListView, SIGNAL( contextRequest ( Q3ListViewItem *,
757 const QPoint &,int ) ), 773 const QPoint &,int ) ),
758 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 774 SLOT( popupMenu( Q3ListViewItem *, const QPoint & ,int) ) );
759 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 775 connect( mTodoListView, SIGNAL( clicked( Q3ListViewItem * ) ),
760 SLOT( itemClicked( QListViewItem * ) ) ); 776 SLOT( itemClicked( Q3ListViewItem * ) ) );
761 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 777 connect( mTodoListView, SIGNAL( double_Clicked( Q3ListViewItem * ) ),
762 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 778 SLOT( itemDoubleClicked( Q3ListViewItem * ) ) );
763 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 779 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
764 SLOT( updateView() ) ); 780 SLOT( updateView() ) );
765 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 781 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
766 SLOT( todoModified(Todo *, int) ) ); 782 SLOT( todoModified(Todo *, int) ) );
767 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 783 connect( mTodoListView, SIGNAL( expanded( Q3ListViewItem * ) ),
768 SLOT( itemStateChanged( QListViewItem * ) ) ); 784 SLOT( itemStateChanged( Q3ListViewItem * ) ) );
769 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 785 connect( mTodoListView, SIGNAL( collapsed( Q3ListViewItem * ) ),
770 SLOT( itemStateChanged( QListViewItem * ) ) ); 786 SLOT( itemStateChanged( Q3ListViewItem * ) ) );
771 connect( mTodoListView, SIGNAL( paintNeeded() ), 787 connect( mTodoListView, SIGNAL( paintNeeded() ),
772 SLOT( paintNeeded()) ); 788 SLOT( paintNeeded()) );
773 789
774#if 0 790#if 0
775 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 791 connect(mTodoListView,SIGNAL(selectionChanged(Q3ListViewItem *)),
776 SLOT(selectionChanged(QListViewItem *))); 792 SLOT(selectionChanged(Q3ListViewItem *)));
777 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 793 connect(mTodoListView,SIGNAL(clicked(Q3ListViewItem *)),
778 SLOT(selectionChanged(QListViewItem *))); 794 SLOT(selectionChanged(Q3ListViewItem *)));
779 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 795 connect(mTodoListView,SIGNAL(pressed(Q3ListViewItem *)),
780 SLOT(selectionChanged(QListViewItem *))); 796 SLOT(selectionChanged(Q3ListViewItem *)));
781#endif 797#endif
782 798
783 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); 799 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) ));
784 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); 800 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) ));
785 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); 801 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) ));
786 802
787 connect( mTodoListView, SIGNAL(selectionChanged() ), 803 connect( mTodoListView, SIGNAL(selectionChanged() ),
788 SLOT( processSelectionChange() ) ); 804 SLOT( processSelectionChange() ) );
789 connect( mQuickAdd, SIGNAL( returnPressed () ), 805 connect( mQuickAdd, SIGNAL( returnPressed () ),
790 SLOT( addQuickTodo() ) ); 806 SLOT( addQuickTodo() ) );
791 807
792} 808}
793 809
794KOTodoView::~KOTodoView() 810KOTodoView::~KOTodoView()
795{ 811{
796 812
@@ -868,33 +884,33 @@ void KOTodoView::updateView()
868 QFont fo = KOPrefs::instance()->mTodoViewFont; 884 QFont fo = KOPrefs::instance()->mTodoViewFont;
869 885
870 clearList (); 886 clearList ();
871 887
872 if ( mName == "todolistsmall" ) { 888 if ( mName == "todolistsmall" ) {
873 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 889 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
874 int ps = fo.pointSize() -2; 890 int ps = fo.pointSize() -2;
875 if ( ps > 12 ) 891 if ( ps > 12 )
876 ps -= 2; 892 ps -= 2;
877 fo.setPointSize( ps ); 893 fo.setPointSize( ps );
878 } 894 }
879 } 895 }
880 896
881 mTodoListView->setFont( fo ); 897 mTodoListView->setFont( fo );
882 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 898 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
883 //mTodoListView->header()->setMaximumHeight(fm.height()); 899 //mTodoListView->header()->setMaximumHeight(fm.height());
884 QPtrList<Todo> todoList = calendar()->todos(); 900 Q3PtrList<Todo> todoList = calendar()->todos();
885 901
886/* 902/*
887 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 903 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
888 Event *t; 904 Event *t;
889 for(t = todoList.first(); t; t = todoList.next()) { 905 for(t = todoList.first(); t; t = todoList.next()) {
890 kdDebug() << " " << t->getSummary() << endl; 906 kdDebug() << " " << t->getSummary() << endl;
891 907
892 if (t->getRelatedTo()) { 908 if (t->getRelatedTo()) {
893 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 909 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
894 } 910 }
895 911
896 QPtrList<Event> l = t->getRelations(); 912 QPtrList<Event> l = t->getRelations();
897 Event *c; 913 Event *c;
898 for(c=l.first();c;c=l.next()) { 914 for(c=l.first();c;c=l.next()) {
899 kdDebug() << " - relation: " << c->getSummary() << endl; 915 kdDebug() << " - relation: " << c->getSummary() << endl;
900 } 916 }
@@ -1031,33 +1047,33 @@ bool KOTodoView::checkTodo( Todo * todo )
1031 return false; 1047 return false;
1032 if ( !todo->isCompleted() ) { 1048 if ( !todo->isCompleted() ) {
1033 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) 1049 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() )
1034 return true; 1050 return true;
1035 } 1051 }
1036 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { 1052 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
1037 if ( todo->hasStartDate() ) 1053 if ( todo->hasStartDate() )
1038 if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) 1054 if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
1039 return false; 1055 return false;
1040 if ( todo->hasDueDate() ) 1056 if ( todo->hasDueDate() )
1041 if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) 1057 if ( mNavigator->selectedDates().first() > todo->dtDue().date() )
1042 return false; 1058 return false;
1043 } 1059 }
1044 return true; 1060 return true;
1045} 1061}
1046 1062
1047void KOTodoView::restoreItemState( QListViewItem *item ) 1063void KOTodoView::restoreItemState( Q3ListViewItem *item )
1048{ 1064{
1049 pendingSubtodo = 0; 1065 pendingSubtodo = 0;
1050 while( item ) { 1066 while( item ) {
1051 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1067 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1052 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); 1068 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) );
1053 if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); 1069 if( item->childCount() > 0 ) restoreItemState( item->firstChild() );
1054 item = item->nextSibling(); 1070 item = item->nextSibling();
1055 } 1071 }
1056} 1072}
1057 1073
1058 1074
1059QMap<Todo *,KOTodoViewItem *>::ConstIterator 1075QMap<Todo *,KOTodoViewItem *>::ConstIterator
1060KOTodoView::insertTodoItem(Todo *todo) 1076KOTodoView::insertTodoItem(Todo *todo)
1061{ 1077{
1062 1078
1063 // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; 1079 // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl;
@@ -1083,89 +1099,89 @@ KOTodoView::insertTodoItem(Todo *todo)
1083 return mTodoMap.insert(todo,todoItem); 1099 return mTodoMap.insert(todo,todoItem);
1084 } else { 1100 } else {
1085 // kdDebug() << " no Related" << endl; 1101 // kdDebug() << " no Related" << endl;
1086 // see above -zecke 1102 // see above -zecke
1087 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 1103 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
1088 return mTodoMap.insert(todo,todoItem); 1104 return mTodoMap.insert(todo,todoItem);
1089 } 1105 }
1090} 1106}
1091 1107
1092 1108
1093void KOTodoView::updateConfig() 1109void KOTodoView::updateConfig()
1094{ 1110{
1095 updateView(); 1111 updateView();
1096 mTodoListView->repaintContents(); 1112 mTodoListView->repaintContents();
1097} 1113}
1098 1114
1099QPtrList<Incidence> KOTodoView::selectedIncidences() 1115Q3PtrList<Incidence> KOTodoView::selectedIncidences()
1100{ 1116{
1101 QPtrList<Incidence> selected; 1117 Q3PtrList<Incidence> selected;
1102 1118
1103 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 1119 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
1104// if (!item) item = mActiveItem; 1120// if (!item) item = mActiveItem;
1105 if (item) selected.append(item->todo()); 1121 if (item) selected.append(item->todo());
1106 1122
1107 return selected; 1123 return selected;
1108} 1124}
1109 1125
1110QPtrList<Todo> KOTodoView::selectedTodos() 1126Q3PtrList<Todo> KOTodoView::selectedTodos()
1111{ 1127{
1112 QPtrList<Todo> selected; 1128 Q3PtrList<Todo> selected;
1113 1129
1114 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 1130 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
1115// if (!item) item = mActiveItem; 1131// if (!item) item = mActiveItem;
1116 if (item) selected.append(item->todo()); 1132 if (item) selected.append(item->todo());
1117 1133
1118 return selected; 1134 return selected;
1119} 1135}
1120 1136
1121void KOTodoView::changeEventDisplay(Event *, int) 1137void KOTodoView::changeEventDisplay(Event *, int)
1122{ 1138{
1123 updateView(); 1139 updateView();
1124} 1140}
1125 1141
1126void KOTodoView::showDates(const QDate &, const QDate &) 1142void KOTodoView::showDates(const QDate &, const QDate &)
1127{ 1143{
1128} 1144}
1129 1145
1130void KOTodoView::showEvents(QPtrList<Event>) 1146void KOTodoView::showEvents(Q3PtrList<Event>)
1131{ 1147{
1132 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; 1148 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl;
1133} 1149}
1134 1150
1135void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1151void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1136 const QDate &td) 1152 const QDate &td)
1137{ 1153{
1138#ifndef KORG_NOPRINTER 1154#ifndef KORG_NOPRINTER
1139 calPrinter->preview(CalPrinter::Todolist, fd, td); 1155 calPrinter->preview(CalPrinter::Todolist, fd, td);
1140#endif 1156#endif
1141} 1157}
1142 1158
1143void KOTodoView::editItem(QListViewItem *item ) 1159void KOTodoView::editItem(Q3ListViewItem *item )
1144{ 1160{
1145 if ( item ) 1161 if ( item )
1146 emit editTodoSignal(((KOTodoViewItem *)item)->todo()); 1162 emit editTodoSignal(((KOTodoViewItem *)item)->todo());
1147} 1163}
1148 1164
1149void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) 1165void KOTodoView::showItem(Q3ListViewItem *item,const QPoint &,int)
1150{ 1166{
1151 if ( item ) 1167 if ( item )
1152 emit showTodoSignal(((KOTodoViewItem *)item)->todo()); 1168 emit showTodoSignal(((KOTodoViewItem *)item)->todo());
1153} 1169}
1154 1170
1155void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) 1171void KOTodoView::popupMenu(Q3ListViewItem *item,const QPoint &p,int column)
1156{ 1172{
1157 pendingSubtodo = 0; 1173 pendingSubtodo = 0;
1158 mActiveItem = (KOTodoViewItem *)item; 1174 mActiveItem = (KOTodoViewItem *)item;
1159 if (item) { 1175 if (item) {
1160 switch (column){ 1176 switch (column){
1161 case 1: 1177 case 1:
1162 mPriorityPopupMenu->popup(QCursor::pos ()); break; 1178 mPriorityPopupMenu->popup(QCursor::pos ()); break;
1163 case 2: 1179 case 2:
1164 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; 1180 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break;
1165 case 3: 1181 case 3:
1166 moveTodo(); 1182 moveTodo();
1167 break; 1183 break;
1168 case 7: 1184 case 7:
1169 mCategoryPopupMenu->popup(QCursor::pos ()); break; 1185 mCategoryPopupMenu->popup(QCursor::pos ()); break;
1170 case 8: 1186 case 8:
1171 mCalPopupMenu->popup(QCursor::pos ()); break; 1187 mCalPopupMenu->popup(QCursor::pos ()); break;
@@ -1348,33 +1364,33 @@ void KOTodoView::toggleRunningItemQuick()
1348 if ( t->isRunning() ) { 1364 if ( t->isRunning() ) {
1349 if ( t->runTime() < 15) { 1365 if ( t->runTime() < 15) {
1350 t->stopRunning(); 1366 t->stopRunning();
1351 mActiveItem->construct(); 1367 mActiveItem->construct();
1352 topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); 1368 topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!"));
1353 return; 1369 return;
1354 } 1370 }
1355 else 1371 else
1356 toggleRunningItem(); 1372 toggleRunningItem();
1357 return; 1373 return;
1358 } else { 1374 } else {
1359 t->setRunning( true ); 1375 t->setRunning( true );
1360 mActiveItem->construct(); 1376 mActiveItem->construct();
1361 topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); 1377 topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!"));
1362 } 1378 }
1363} 1379}
1364void KOTodoView::itemDoubleClicked(QListViewItem *item) 1380void KOTodoView::itemDoubleClicked(Q3ListViewItem *item)
1365{ 1381{
1366 if ( pendingSubtodo != 0 ) { 1382 if ( pendingSubtodo != 0 ) {
1367 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1383 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1368 } 1384 }
1369 pendingSubtodo = 0; 1385 pendingSubtodo = 0;
1370 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1386 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1371 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); 1387 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() );
1372 //qDebug("ROW %d ", row); 1388 //qDebug("ROW %d ", row);
1373 if (!item) { 1389 if (!item) {
1374 newTodo(); 1390 newTodo();
1375 return; 1391 return;
1376 } else { 1392 } else {
1377 if ( row == 1 ) { 1393 if ( row == 1 ) {
1378 mActiveItem = (KOTodoViewItem *) item; 1394 mActiveItem = (KOTodoViewItem *) item;
1379 newSubTodo(); 1395 newSubTodo();
1380 return; 1396 return;
@@ -1415,74 +1431,74 @@ void KOTodoView::toggleRunningItem()
1415 int xx = (QApplication::desktop()->width()-wid)/2; 1431 int xx = (QApplication::desktop()->width()-wid)/2;
1416 int yy = (QApplication::desktop()->height()-hei)/2; 1432 int yy = (QApplication::desktop()->height()-hei)/2;
1417 tp.setGeometry( xx,yy,wid,hei ); 1433 tp.setGeometry( xx,yy,wid,hei );
1418 } 1434 }
1419 if ( !tp.exec() ) return; 1435 if ( !tp.exec() ) return;
1420 if ( tp.stopAll() ) { 1436 if ( tp.stopAll() ) {
1421 mCalendar->stopAllTodos(); 1437 mCalendar->stopAllTodos();
1422 t->setRunning( true ); 1438 t->setRunning( true );
1423 updateView(); 1439 updateView();
1424 } else { 1440 } else {
1425 t->setRunning( true ); 1441 t->setRunning( true );
1426 updateTodo ( t, KOGlobals::EVENTEDITED ); 1442 updateTodo ( t, KOGlobals::EVENTEDITED );
1427 } 1443 }
1428 } 1444 }
1429} 1445}
1430 1446
1431void KOTodoView::itemClicked(QListViewItem *item) 1447void KOTodoView::itemClicked(Q3ListViewItem *item)
1432{ 1448{
1433 //qDebug("KOTodoView::itemClicked %d", item); 1449 //qDebug("KOTodoView::itemClicked %d", item);
1434 if (!item) { 1450 if (!item) {
1435 if ( pendingSubtodo != 0 ) { 1451 if ( pendingSubtodo != 0 ) {
1436 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1452 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1437 } 1453 }
1438 pendingSubtodo = 0; 1454 pendingSubtodo = 0;
1439 return; 1455 return;
1440 } 1456 }
1441 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1457 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1442 if ( pendingSubtodo != 0 ) { 1458 if ( pendingSubtodo != 0 ) {
1443 bool allowReparent = true; 1459 bool allowReparent = true;
1444 QListViewItem *par = item; 1460 Q3ListViewItem *par = item;
1445 while ( par ) { 1461 while ( par ) {
1446 if ( par == pendingSubtodo ) { 1462 if ( par == pendingSubtodo ) {
1447 allowReparent = false; 1463 allowReparent = false;
1448 break; 1464 break;
1449 } 1465 }
1450 par = par->parent(); 1466 par = par->parent();
1451 } 1467 }
1452 if ( !allowReparent ) { 1468 if ( !allowReparent ) {
1453 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1469 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1454 pendingSubtodo = 0; 1470 pendingSubtodo = 0;
1455 } else { 1471 } else {
1456 Todo* newParent = todoItem->todo(); 1472 Todo* newParent = todoItem->todo();
1457 Todo* newSub = pendingSubtodo->todo(); 1473 Todo* newSub = pendingSubtodo->todo();
1458 pendingSubtodo = 0; 1474 pendingSubtodo = 0;
1459 emit reparentTodoSignal( newParent,newSub ); 1475 emit reparentTodoSignal( newParent,newSub );
1460 return; 1476 return;
1461 } 1477 }
1462 } 1478 }
1463 1479
1464} 1480}
1465 1481
1466void KOTodoView::setDocumentId( const QString &id ) 1482void KOTodoView::setDocumentId( const QString &id )
1467{ 1483{
1468 1484
1469 mDocPrefs->setDoc( id ); 1485 mDocPrefs->setDoc( id );
1470} 1486}
1471 1487
1472void KOTodoView::itemStateChanged( QListViewItem *item ) 1488void KOTodoView::itemStateChanged( Q3ListViewItem *item )
1473{ 1489{
1474 if (!item) return; 1490 if (!item) return;
1475 1491
1476 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1492 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1477 1493
1478// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1494// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1479 1495
1480 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1496 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
1481} 1497}
1482 1498
1483void KOTodoView::saveLayout(KConfig *config, const QString &group) const 1499void KOTodoView::saveLayout(KConfig *config, const QString &group) const
1484{ 1500{
1485 mTodoListView->saveLayout(config,group); 1501 mTodoListView->saveLayout(config,group);
1486} 1502}
1487 1503
1488void KOTodoView::restoreLayout(KConfig *config, const QString &group) 1504void KOTodoView::restoreLayout(KConfig *config, const QString &group)
@@ -1529,54 +1545,54 @@ void KOTodoView::setAllOpen()
1529 } 1545 }
1530 setOpen(mTodoListView->firstChild(), true); 1546 setOpen(mTodoListView->firstChild(), true);
1531 resetCurrentItem(); 1547 resetCurrentItem();
1532} 1548}
1533void KOTodoView::setAllClose() 1549void KOTodoView::setAllClose()
1534{ 1550{
1535 if ( isFlatDisplay ) { 1551 if ( isFlatDisplay ) {
1536 isFlatDisplay = false; 1552 isFlatDisplay = false;
1537 mPopupMenu->setItemChecked( 8,false ); 1553 mPopupMenu->setItemChecked( 8,false );
1538 updateView(); 1554 updateView();
1539 } else { 1555 } else {
1540 storeCurrentItem(); 1556 storeCurrentItem();
1541 } 1557 }
1542 setOpen(mTodoListView->firstChild(), false); 1558 setOpen(mTodoListView->firstChild(), false);
1543 resetCurrentItem(); 1559 resetCurrentItem();
1544} 1560}
1545void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) 1561void KOTodoView::setOpen( Q3ListViewItem* item, bool setOpenI)
1546{ 1562{
1547 1563
1548 while ( item ) { 1564 while ( item ) {
1549 setOpen( item->firstChild(), setOpenI ); 1565 setOpen( item->firstChild(), setOpenI );
1550 item->setOpen( setOpenI ); 1566 item->setOpen( setOpenI );
1551 item = item->nextSibling(); 1567 item = item->nextSibling();
1552 } 1568 }
1553} 1569}
1554 1570
1555void KOTodoView::displayAllFlat() 1571void KOTodoView::displayAllFlat()
1556{ 1572{
1557 1573
1558 mActiveItem = 0; 1574 mActiveItem = 0;
1559 pendingSubtodo = 0; 1575 pendingSubtodo = 0;
1560 if ( mBlockUpdate ) { 1576 if ( mBlockUpdate ) {
1561 return; 1577 return;
1562 } 1578 }
1563 clearList (); 1579 clearList ();
1564 mPopupMenu->setItemChecked( 8,true ); 1580 mPopupMenu->setItemChecked( 8,true );
1565 isFlatDisplay = true; 1581 isFlatDisplay = true;
1566 QPtrList<Todo> todoList = calendar()->todos(); 1582 Q3PtrList<Todo> todoList = calendar()->todos();
1567 Todo *todo; 1583 Todo *todo;
1568 for(todo = todoList.first(); todo; todo = todoList.next()) { 1584 for(todo = todoList.first(); todo; todo = todoList.next()) {
1569 if ( checkTodo( todo ) ) { 1585 if ( checkTodo( todo ) ) {
1570 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 1586 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
1571 mTodoMap.insert(todo,todoItem); 1587 mTodoMap.insert(todo,todoItem);
1572 } 1588 }
1573 } 1589 }
1574 resetCurrentItem(); 1590 resetCurrentItem();
1575} 1591}
1576 1592
1577void KOTodoView::setAllFlat() 1593void KOTodoView::setAllFlat()
1578{ 1594{
1579 if ( isFlatDisplay ) { 1595 if ( isFlatDisplay ) {
1580 isFlatDisplay = false; 1596 isFlatDisplay = false;
1581 mPopupMenu->setItemChecked( 8,false ); 1597 mPopupMenu->setItemChecked( 8,false );
1582 updateView(); 1598 updateView();
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 0cbc087..a9e7f30 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -13,41 +13,51 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOTODOVIEW_H 23#ifndef KOTODOVIEW_H
24#define KOTODOVIEW_H 24#define KOTODOVIEW_H
25 25
26#include <qfont.h> 26#include <qfont.h>
27#include <qfontmetrics.h> 27#include <qfontmetrics.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qptrlist.h> 29#include <q3ptrlist.h>
30#include <qstrlist.h> 30#include <q3strlist.h>
31#include <qlistbox.h> 31#include <q3listbox.h>
32#include <qpopupmenu.h> 32#include <q3popupmenu.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qmap.h> 34#include <qmap.h>
35#include <qdialog.h> 35#include <qdialog.h>
36#include <qlabel.h> 36#include <qlabel.h>
37#include <qlistview.h> 37#include <q3listview.h>
38//Added by qt3to4:
39#include <QDragMoveEvent>
40#include <QDropEvent>
41#include <QDragLeaveEvent>
42#include <QWheelEvent>
43#include <QPaintEvent>
44#include <QFocusEvent>
45#include <QMouseEvent>
46#include <QKeyEvent>
47#include <QDragEnterEvent>
38#include <klistview.h> 48#include <klistview.h>
39 49
40#include <libkcal/calendar.h> 50#include <libkcal/calendar.h>
41#include <libkcal/todo.h> 51#include <libkcal/todo.h>
42 52
43#include <korganizer/baseview.h> 53#include <korganizer/baseview.h>
44 54
45#include "kotodoviewitem.h" 55#include "kotodoviewitem.h"
46#include "koprefs.h" 56#include "koprefs.h"
47#include "koglobals.h" 57#include "koglobals.h"
48#include "datenavigator.h" 58#include "datenavigator.h"
49 59
50class QDragEnterEvent; 60class QDragEnterEvent;
51class QDragMoveEvent; 61class QDragMoveEvent;
52class QDragLeaveEvent; 62class QDragLeaveEvent;
53class QDropEvent; 63class QDropEvent;
@@ -88,154 +98,154 @@ private slots:
88 void doStop(); 98 void doStop();
89private: 99private:
90 bool mStopAll; 100 bool mStopAll;
91 101
92}; 102};
93 103
94class KOTodoListView : public KListView 104class KOTodoListView : public KListView
95{ 105{
96 Q_OBJECT 106 Q_OBJECT
97 public: 107 public:
98 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); 108 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0);
99 virtual ~KOTodoListView() {} 109 virtual ~KOTodoListView() {}
100 110
101 signals: 111 signals:
102 void paintNeeded(); 112 void paintNeeded();
103 void todoDropped(Todo *, int); 113 void todoDropped(Todo *, int);
104 void double_Clicked(QListViewItem *item); 114 void double_Clicked(Q3ListViewItem *item);
105 void reparentTodoSignal( Todo *,Todo * ); 115 void reparentTodoSignal( Todo *,Todo * );
106 void unparentTodoSignal(Todo *); 116 void unparentTodoSignal(Todo *);
107 void deleteTodo( Todo * ); 117 void deleteTodo( Todo * );
108 protected: 118 protected:
109 void wheelEvent (QWheelEvent *e); 119 void wheelEvent (QWheelEvent *e);
110 void contentsDragEnterEvent(QDragEnterEvent *); 120 void contentsDragEnterEvent(QDragEnterEvent *);
111 void contentsDragMoveEvent(QDragMoveEvent *); 121 void contentsDragMoveEvent(QDragMoveEvent *);
112 void contentsDragLeaveEvent(QDragLeaveEvent *); 122 void contentsDragLeaveEvent(QDragLeaveEvent *);
113 void contentsDropEvent(QDropEvent *); 123 void contentsDropEvent(QDropEvent *);
114 124
115 void contentsMousePressEvent(QMouseEvent *); 125 void contentsMousePressEvent(QMouseEvent *);
116 void contentsMouseMoveEvent(QMouseEvent *); 126 void contentsMouseMoveEvent(QMouseEvent *);
117 void contentsMouseReleaseEvent(QMouseEvent *); 127 void contentsMouseReleaseEvent(QMouseEvent *);
118 void contentsMouseDoubleClickEvent(QMouseEvent *); 128 void contentsMouseDoubleClickEvent(QMouseEvent *);
119 129
120 private: 130 private:
121 void paintEvent(QPaintEvent * pevent); 131 void paintEvent(QPaintEvent * pevent);
122 bool internalDrop; 132 bool internalDrop;
123 QString mName; 133 QString mName;
124 Calendar *mCalendar; 134 Calendar *mCalendar;
125 QPoint mPressPos; 135 QPoint mPressPos;
126 bool mMousePressed; 136 bool mMousePressed;
127 QListViewItem *mOldCurrent; 137 Q3ListViewItem *mOldCurrent;
128 bool mFlagKeyPressed; 138 bool mFlagKeyPressed;
129 void keyPressEvent ( QKeyEvent * ) ; 139 void keyPressEvent ( QKeyEvent * ) ;
130 void keyReleaseEvent ( QKeyEvent * ) ; 140 void keyReleaseEvent ( QKeyEvent * ) ;
131}; 141};
132 142
133 143
134/** 144/**
135 This is the line-edit on top of the todoview for fast addition of new todos 145 This is the line-edit on top of the todoview for fast addition of new todos
136*/ 146*/
137class KOQuickTodo : public QLineEdit 147class KOQuickTodo : public QLineEdit
138{ 148{
139 public: 149 public:
140 KOQuickTodo(QWidget *parent=0); 150 KOQuickTodo(QWidget *parent=0);
141 protected: 151 protected:
142 void focusInEvent(QFocusEvent *ev); 152 void focusInEvent(QFocusEvent *ev);
143 void focusOutEvent(QFocusEvent *ev); 153 void focusOutEvent(QFocusEvent *ev);
144}; 154};
145 155
146 156
147/** 157/**
148 This class provides a multi-column list view of todo events. 158 This class provides a multi-column list view of todo events.
149 159
150 @short multi-column list view of todo events. 160 @short multi-column list view of todo events.
151 @author Cornelius Schumacher <schumacher@kde.org> 161 @author Cornelius Schumacher <schumacher@kde.org>
152*/ 162*/
153class KOTodoView : public KOrg::BaseView 163class KOTodoView : public KOrg::BaseView
154{ 164{
155 Q_OBJECT 165 Q_OBJECT
156 public: 166 public:
157 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); 167 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 );
158 ~KOTodoView(); 168 ~KOTodoView();
159 169
160 QPtrList<Incidence> selectedIncidences(); 170 Q3PtrList<Incidence> selectedIncidences();
161 QPtrList<Todo> selectedTodos(); 171 Q3PtrList<Todo> selectedTodos();
162 172
163 DateList selectedDates() 173 DateList selectedDates()
164 {DateList q; 174 {DateList q;
165 return q;} 175 return q;}
166 176
167 /** Return number of shown dates. TodoView does not show dates, */ 177 /** Return number of shown dates. TodoView does not show dates, */
168 int currentDateCount() { return 0; } 178 int currentDateCount() { return 0; }
169 179
170 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); 180 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td);
171 181
172 void setDocumentId( const QString & ); 182 void setDocumentId( const QString & );
173 183
174 void saveLayout(KConfig *config, const QString &group) const; 184 void saveLayout(KConfig *config, const QString &group) const;
175 void restoreLayout(KConfig *config, const QString &group); 185 void restoreLayout(KConfig *config, const QString &group);
176 void setNavigator( DateNavigator* nav ) {mNavigator = nav;} 186 void setNavigator( DateNavigator* nav ) {mNavigator = nav;}
177 QString getWhatsThisText(QPoint p); 187 QString getWhatsThisText(QPoint p);
178 void clearList( bool saveCurrentItem = true ); 188 void clearList( bool saveCurrentItem = true );
179 189
180 public slots: 190 public slots:
181 void updateView(); 191 void updateView();
182 void updateConfig(); 192 void updateConfig();
183 193
184 void changeEventDisplay(Event *, int); 194 void changeEventDisplay(Event *, int);
185 195
186 void showDates(const QDate &start, const QDate &end); 196 void showDates(const QDate &start, const QDate &end);
187 void showEvents(QPtrList<Event> eventList); 197 void showEvents(Q3PtrList<Event> eventList);
188 198
189 void clearSelection(); 199 void clearSelection();
190 void jumpToDate (); 200 void jumpToDate ();
191 201
192 void editItem(QListViewItem *item); 202 void editItem(Q3ListViewItem *item);
193 void showItem(QListViewItem *item,const QPoint &,int); 203 void showItem(Q3ListViewItem *item,const QPoint &,int);
194 void popupMenu(QListViewItem *item,const QPoint &,int); 204 void popupMenu(Q3ListViewItem *item,const QPoint &,int);
195 void newTodo(); 205 void newTodo();
196 void newSubTodo(); 206 void newSubTodo();
197 void unparentTodo(); 207 void unparentTodo();
198 void reparentTodo(); 208 void reparentTodo();
199 void showTodo(); 209 void showTodo();
200 void editTodo(); 210 void editTodo();
201 void cloneTodo(); 211 void cloneTodo();
202 void cancelTodo(); 212 void cancelTodo();
203 void moveTodo(); 213 void moveTodo();
204 void beamTodo(); 214 void beamTodo();
205 void deleteTodo(); 215 void deleteTodo();
206 216
207 void setNewPriority(int); 217 void setNewPriority(int);
208 void setNewPercentage(int); 218 void setNewPercentage(int);
209 void changedCategories(int); 219 void changedCategories(int);
210 220
211 void setAllOpen(); 221 void setAllOpen();
212 void setAllClose(); 222 void setAllClose();
213 void setAllFlat(); 223 void setAllFlat();
214 void displayAllFlat(); 224 void displayAllFlat();
215 225
216 void purgeCompleted(); 226 void purgeCompleted();
217 void toggleCompleted(); 227 void toggleCompleted();
218 void toggleRunning(); 228 void toggleRunning();
219 void toggleQuickTodo(); 229 void toggleQuickTodo();
220 void updateTodo( Todo *, int ); 230 void updateTodo( Todo *, int );
221 231
222 void itemClicked(QListViewItem *); 232 void itemClicked(Q3ListViewItem *);
223 void itemStateChanged(QListViewItem *); 233 void itemStateChanged(Q3ListViewItem *);
224 void modified(bool); 234 void modified(bool);
225 void itemDoubleClicked(QListViewItem *item); 235 void itemDoubleClicked(Q3ListViewItem *item);
226 void resetFocusToList(); 236 void resetFocusToList();
227 void fillCategories (); 237 void fillCategories ();
228 void fillCal (); 238 void fillCal ();
229 void changedCal (int); 239 void changedCal (int);
230 240
231 signals: 241 signals:
232 void newTodoSignal(); 242 void newTodoSignal();
233 void newSubTodoSignal(Todo *); 243 void newSubTodoSignal(Todo *);
234 void unparentTodoSignal(Todo *); 244 void unparentTodoSignal(Todo *);
235 void reparentTodoSignal( Todo *,Todo * ); 245 void reparentTodoSignal( Todo *,Todo * );
236 void showTodoSignal(Todo *); 246 void showTodoSignal(Todo *);
237 247
238 void editTodoSignal(Todo *); 248 void editTodoSignal(Todo *);
239 void deleteTodoSignal(Todo *); 249 void deleteTodoSignal(Todo *);
240 void todoModifiedSignal (Todo *, int); 250 void todoModifiedSignal (Todo *, int);
241 251
@@ -260,44 +270,44 @@ class KOTodoView : public KOrg::BaseView
260 void addQuickTodoPar( Todo * parentTodo); 270 void addQuickTodoPar( Todo * parentTodo);
261 /* 271 /*
262 * the TodoEditor approach is rather unscaling in the long 272 * the TodoEditor approach is rather unscaling in the long
263 * run. 273 * run.
264 * Korganizer keeps it in memory and we need to update 274 * Korganizer keeps it in memory and we need to update
265 * 1. make KOTodoViewItem a QObject again? 275 * 1. make KOTodoViewItem a QObject again?
266 * 2. add a public method for setting one todo modified? 276 * 2. add a public method for setting one todo modified?
267 * 3. add a private method for setting a todo modified + friend here? 277 * 3. add a private method for setting a todo modified + friend here?
268 * -- zecke 2002-07-08 278 * -- zecke 2002-07-08
269 */ 279 */
270 KOTodoViewWhatsThis* mKOTodoViewWhatsThis; 280 KOTodoViewWhatsThis* mKOTodoViewWhatsThis;
271 friend class KOTodoListView; 281 friend class KOTodoListView;
272 void paintEvent(QPaintEvent * pevent); 282 void paintEvent(QPaintEvent * pevent);
273 bool mPendingUpdateBeforeRepaint; 283 bool mPendingUpdateBeforeRepaint;
274 friend class KOTodoViewItem; 284 friend class KOTodoViewItem;
275 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); 285 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
276 void restoreItemState( QListViewItem * ); 286 void restoreItemState( Q3ListViewItem * );
277 287
278 bool checkTodo( Todo * ); 288 bool checkTodo( Todo * );
279 bool isFlatDisplay; 289 bool isFlatDisplay;
280 void setOpen( QListViewItem*, bool setOpen); 290 void setOpen( Q3ListViewItem*, bool setOpen);
281 KOTodoListView *mTodoListView; 291 KOTodoListView *mTodoListView;
282 QPopupMenu *mItemPopupMenu; 292 Q3PopupMenu *mItemPopupMenu;
283 QPopupMenu *mPopupMenu; 293 Q3PopupMenu *mPopupMenu;
284 QPopupMenu *mPriorityPopupMenu; 294 Q3PopupMenu *mPriorityPopupMenu;
285 QPopupMenu *mPercentageCompletedPopupMenu; 295 Q3PopupMenu *mPercentageCompletedPopupMenu;
286 QPopupMenu *mCategoryPopupMenu; 296 Q3PopupMenu *mCategoryPopupMenu;
287 QPopupMenu *mCalPopupMenu; 297 Q3PopupMenu *mCalPopupMenu;
288 298
289 QMap<int, int> mPercentage; 299 QMap<int, int> mPercentage;
290 QMap<int, int> mPriority; 300 QMap<int, int> mPriority;
291 QMap<int, QString> mCategory; 301 QMap<int, QString> mCategory;
292 KOTodoViewItem *mActiveItem; 302 KOTodoViewItem *mActiveItem;
293 303
294 QMap<Todo *,KOTodoViewItem *> mTodoMap; 304 QMap<Todo *,KOTodoViewItem *> mTodoMap;
295 QString mName; 305 QString mName;
296 QWidget* mQuickBar; 306 QWidget* mQuickBar;
297 307
298 DocPrefs *mDocPrefs; 308 DocPrefs *mDocPrefs;
299 QString mCurrentDoc; 309 QString mCurrentDoc;
300 KOQuickTodo *mQuickAdd; 310 KOQuickTodo *mQuickAdd;
301 bool mBlockUpdate; 311 bool mBlockUpdate;
302 void keyPressEvent ( QKeyEvent * ) ; 312 void keyPressEvent ( QKeyEvent * ) ;
303 KOTodoViewItem * pendingSubtodo; 313 KOTodoViewItem * pendingSubtodo;
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 519bb16..c21816d 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -6,48 +6,52 @@
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <klocale.h> 20#include <klocale.h>
21#include <kdebug.h> 21#include <kdebug.h>
22#include <qapp.h> 22#include <qapplication.h>
23#include <QDesktopWidget>
24//Added by qt3to4:
25#include <Q3PointArray>
26#include <QPixmap>
23#include <kglobal.h> 27#include <kglobal.h>
24 28
25#include <kiconloader.h> 29#include <kiconloader.h>
26#include "kotodoviewitem.h" 30#include "kotodoviewitem.h"
27#include "kotodoview.h" 31#include "kotodoview.h"
28#include "koprefs.h" 32#include "koprefs.h"
29 33
30KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) 34KOTodoViewItem::KOTodoViewItem( Q3ListView *parent, Todo *todo, KOTodoView *kotodo)
31 : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) 35 : Q3CheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
32{ 36{
33 construct(); 37 construct();
34} 38}
35 39
36KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) 40KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo )
37 : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) 41 : Q3CheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
38{ 42{
39 construct(); 43 construct();
40} 44}
41 45
42QString KOTodoViewItem::key(int column,bool) const 46QString KOTodoViewItem::key(int column,bool) const
43{ 47{
44 if ( column == 0 ) 48 if ( column == 0 )
45 return text(0).lower(); 49 return text(0).lower();
46 if ( column == 1 ) { 50 if ( column == 1 ) {
47 if ( mTodo->isCompleted() ) { 51 if ( mTodo->isCompleted() ) {
48 return "6"+QString::number(mTodo->priority())+text(0).lower(); 52 return "6"+QString::number(mTodo->priority())+text(0).lower();
49 } 53 }
50 return QString::number(mTodo->priority())+text(0).lower(); 54 return QString::number(mTodo->priority())+text(0).lower();
51 } 55 }
52 QMap<int,QString>::ConstIterator it = mKeyMap.find(column); 56 QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
53 if (it == mKeyMap.end()) { 57 if (it == mKeyMap.end()) {
@@ -67,33 +71,33 @@ void KOTodoViewItem:: setup()
67 if ( listView () ) { 71 if ( listView () ) {
68 QFontMetrics fm ( listView ()->font () ); 72 QFontMetrics fm ( listView ()->font () );
69 h = fm.height(); 73 h = fm.height();
70 } 74 }
71 setHeight( h ); 75 setHeight( h );
72 76
73} 77}
74void KOTodoViewItem::setSortKey(int column,const QString &key) 78void KOTodoViewItem::setSortKey(int column,const QString &key)
75{ 79{
76 mKeyMap.insert(column,key); 80 mKeyMap.insert(column,key);
77} 81}
78 82
79#if QT_VERSION >= 0x030000 83#if QT_VERSION >= 0x030000
80void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, 84void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w,
81 int y,int h) 85 int y,int h)
82{ 86{
83 QListViewItem::paintBranches(p,cg,w,y,h); 87 Q3ListViewItem::paintBranches(p,cg,w,y,h);
84} 88}
85#else 89#else
86#endif 90#endif
87 91
88void KOTodoViewItem::construct() 92void KOTodoViewItem::construct()
89{ 93{
90 // qDebug("KOTodoViewItem::construct() "); 94 // qDebug("KOTodoViewItem::construct() ");
91 m_init = true; 95 m_init = true;
92 QString keyd = "=="; 96 QString keyd = "==";
93 QString keyt = "=="; 97 QString keyt = "==";
94 QString skeyd = "=="; 98 QString skeyd = "==";
95 QString skeyt = "=="; 99 QString skeyt = "==";
96 100
97 setOn(mTodo->isCompleted()); 101 setOn(mTodo->isCompleted());
98 setText(0,mTodo->summary()); 102 setText(0,mTodo->summary());
99 setText(1,QString::number(mTodo->priority())); 103 setText(1,QString::number(mTodo->priority()));
@@ -303,42 +307,42 @@ void KOTodoViewItem::stateChange(bool state)
303 setSortKey(5,skeyd); 307 setSortKey(5,skeyd);
304 setSortKey(6,skeyt); 308 setSortKey(6,skeyt);
305 } 309 }
306 if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); 310 if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt);
307 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 311 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
308 312
309 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); 313 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete())));
310 if (mTodo->percentComplete()<100) { 314 if (mTodo->percentComplete()<100) {
311 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 315 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
312 else setSortKey(2,QString::number(mTodo->percentComplete())); 316 else setSortKey(2,QString::number(mTodo->percentComplete()));
313 } 317 }
314 else { 318 else {
315 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 319 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
316 else setSortKey(2,QString::number(99)); 320 else setSortKey(2,QString::number(99));
317 } 321 }
318 if ( state ) { 322 if ( state ) {
319 QListViewItem * myChild = firstChild(); 323 Q3ListViewItem * myChild = firstChild();
320 KOTodoViewItem *item; 324 KOTodoViewItem *item;
321 while( myChild ) { 325 while( myChild ) {
322 //qDebug("stateCH "); 326 //qDebug("stateCH ");
323 item = static_cast<KOTodoViewItem*>(myChild); 327 item = static_cast<KOTodoViewItem*>(myChild);
324 item->stateChange(state); 328 item->stateChange(state);
325 myChild = myChild->nextSibling(); 329 myChild = myChild->nextSibling();
326 } 330 }
327 } else { 331 } else {
328 QListViewItem * myChild = parent(); 332 Q3ListViewItem * myChild = parent();
329 if ( myChild ) 333 if ( myChild )
330 (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); 334 (static_cast<KOTodoViewItem*>(myChild))->stateChange(state);
331 } 335 }
332 mTodoView->modified(true); 336 mTodoView->modified(true);
333 setMyPixmap(); 337 setMyPixmap();
334 mTodoView->setTodoModified( mTodo ); 338 mTodoView->setTodoModified( mTodo );
335} 339}
336 340
337bool KOTodoViewItem::isAlternate() 341bool KOTodoViewItem::isAlternate()
338{ 342{
339#if 0 343#if 0
340 //if ( m_known ) return m_odd; 344 //if ( m_known ) return m_odd;
341 //qDebug("test "); 345 //qDebug("test ");
342 KOTodoViewItem *item = static_cast<KOTodoViewItem *>(itemAbove()); 346 KOTodoViewItem *item = static_cast<KOTodoViewItem *>(itemAbove());
343 if ( item ) { 347 if ( item ) {
344 m_known = item->m_known; 348 m_known = item->m_known;
@@ -370,38 +374,38 @@ bool KOTodoViewItem::isAlternate()
370 374
371#else 375#else
372 376
373 //KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); 377 //KOTodoListView *lv = static_cast<KOTodoListView *>(listView());
374 //if (lv && lv->alternateBackground().isValid()) 378 //if (lv && lv->alternateBackground().isValid())
375 { 379 {
376 KOTodoViewItem *above = static_cast<KOTodoViewItem *>(itemAbove()); 380 KOTodoViewItem *above = static_cast<KOTodoViewItem *>(itemAbove());
377 m_known = above ? above->m_known : true; 381 m_known = above ? above->m_known : true;
378 if (m_known) 382 if (m_known)
379 { 383 {
380 m_odd = above ? !above->m_odd : false; 384 m_odd = above ? !above->m_odd : false;
381 } 385 }
382 else 386 else
383 { 387 {
384 KOTodoViewItem *item; 388 KOTodoViewItem *item;
385 bool previous = true; 389 bool previous = true;
386 if (QListViewItem::parent()) 390 if (Q3ListViewItem::parent())
387 { 391 {
388 item = static_cast<KOTodoViewItem *>(QListViewItem::parent()); 392 item = static_cast<KOTodoViewItem *>(Q3ListViewItem::parent());
389 if (item) 393 if (item)
390 previous = item->m_odd; 394 previous = item->m_odd;
391 item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); 395 item = static_cast<KOTodoViewItem *>(Q3ListViewItem::parent()->firstChild());
392 } 396 }
393 else 397 else
394 { 398 {
395 KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); 399 KOTodoListView *lv = static_cast<KOTodoListView *>(listView());
396 item = static_cast<KOTodoViewItem *>(lv->firstChild()); 400 item = static_cast<KOTodoViewItem *>(lv->firstChild());
397 } 401 }
398 402
399 while(item) 403 while(item)
400 { 404 {
401 item->m_odd = previous = !previous; 405 item->m_odd = previous = !previous;
402 item->m_known = true; 406 item->m_known = true;
403 item = static_cast<KOTodoViewItem *>(item->nextSibling()); 407 item = static_cast<KOTodoViewItem *>(item->nextSibling());
404 } 408 }
405 } 409 }
406 return m_odd; 410 return m_odd;
407 } 411 }
@@ -463,117 +467,117 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i
463 rgb += colorToSet.green(); 467 rgb += colorToSet.green();
464 if ( rgb < 200 ) 468 if ( rgb < 200 )
465 _cg.setColor(QColorGroup::Text,Qt::white ); 469 _cg.setColor(QColorGroup::Text,Qt::white );
466 } 470 }
467 } 471 }
468 //#endif 472 //#endif
469 if ( column > 0 ){ 473 if ( column > 0 ){
470 if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { 474 if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) {
471 p->save(); 475 p->save();
472 int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); 476 int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5);
473 477
474 p->fillRect( 0, 0, width, height(), _cg.base() ); // background 478 p->fillRect( 0, 0, width, height(), _cg.base() ); // background
475 // p->setPen(Qt::black ); //border 479 // p->setPen(Qt::black ); //border
476 // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling 480 // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling
477 QColor fc = KOPrefs::instance()->mHighlightColor; 481 QColor fc = KOPrefs::instance()->mHighlightColor;
478 if ( mTodo->percentComplete() == 100 ) 482 if ( mTodo->percentComplete() == 100 )
479 fc = darkGreen; 483 fc = Qt::darkGreen;
480 p->drawRect( 2, 2, width-4, height()-4); 484 p->drawRect( 2, 2, width-4, height()-4);
481 p->fillRect( 3, 3, progress, height()-6, 485 p->fillRect( 3, 3, progress, height()-6,
482 fc ); 486 fc );
483 p->restore(); 487 p->restore();
484 } else { 488 } else {
485 QCheckListItem::paintCell(p, _cg, column, width, alignment); 489 Q3CheckListItem::paintCell(p, _cg, column, width, alignment);
486 } 490 }
487 return; 491 return;
488 } 492 }
489 493
490 int align = alignment; 494 int align = alignment;
491 495
492 if ( !p ) 496 if ( !p )
493 return; 497 return;
494 498
495 p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); 499 p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) );
496 500
497 QListView *lv = listView(); 501 Q3ListView *lv = listView();
498 if ( !lv ) 502 if ( !lv )
499 return; 503 return;
500 int marg = 2;//lv->itemMargin(); 504 int marg = 2;//lv->itemMargin();
501 int r = 0; 505 int r = 0;
502 QCheckListItem::Type myType = QCheckListItem::CheckBox; 506 Q3CheckListItem::Type myType = Q3CheckListItem::CheckBox;
503 int BoxSize = 20; 507 int BoxSize = 20;
504 int boxOffset = 2; 508 int boxOffset = 2;
505 int xOffset = 2; 509 int xOffset = 2;
506 if (qApp->desktop()->width() < 300 ) { 510 if (qApp->desktop()->width() < 300 ) {
507 BoxSize = 14; 511 BoxSize = 14;
508 boxOffset = -1; 512 boxOffset = -1;
509 xOffset = 1; 513 xOffset = 1;
510 // marg = 0; 514 // marg = 0;
511 } 515 }
512 if ( height() < BoxSize ) { 516 if ( height() < BoxSize ) {
513 boxOffset = boxOffset - ((BoxSize - height())/2) ; 517 boxOffset = boxOffset - ((BoxSize - height())/2) ;
514 // qDebug("boxOffset %d height %d", boxOffset, height() ); 518 // qDebug("boxOffset %d height %d", boxOffset, height() );
515 BoxSize = height(); 519 BoxSize = height();
516 520
517 } 521 }
518 //bool winStyle = lv->style() == WindowsStyle; 522 //bool winStyle = lv->style() == WindowsStyle;
519 523
520 int lineStart = 5; 524 int lineStart = 5;
521 if ( myType == Controller ) { 525 if ( myType == Controller ) {
522 if ( !pixmap( 0 ) ) 526 if ( !pixmap( 0 ) )
523 r += BoxSize + 4; 527 r += BoxSize + 4;
524 } else { 528 } else {
525 ASSERT( lv ); //### 529 Q_ASSERT( lv ); //###
526 //QFontMetrics fm( lv->font() ); 530 //QFontMetrics fm( lv->font() );
527 //int d = fm.height(); 531 //int d = fm.height();
528 int x = 0; 532 int x = 0;
529 int y = (height() - BoxSize) / 2; 533 int y = (height() - BoxSize) / 2;
530 //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); 534 //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) );
531 if ( myType == CheckBox ) { 535 if ( myType == CheckBox ) {
532 if ( isEnabled() ) 536 if ( isEnabled() )
533 p->setPen( QPen( _cg.text(), 1 ) ); 537 p->setPen( QPen( _cg.text(), 1 ) );
534 else 538 else
535 p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); 539 p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) );
536 p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); 540 p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 );
537 lineStart = x+marg; 541 lineStart = x+marg;
538 ///////////////////// 542 /////////////////////
539 x++; 543 x++;
540 y++; 544 y++;
541 if ( isOn() ) { 545 if ( isOn() ) {
542 QPointArray a( 7*2 ); 546 Q3PointArray a( 7*2 );
543 int i, xx, yy; 547 int i, xx, yy;
544 xx = x+xOffset+marg+(boxOffset/2); 548 xx = x+xOffset+marg+(boxOffset/2);
545 yy = y+5+boxOffset; 549 yy = y+5+boxOffset;
546 for ( i=0; i<3; i++ ) { 550 for ( i=0; i<3; i++ ) {
547 a.setPoint( 2*i, xx, yy ); 551 a.setPoint( 2*i, xx, yy );
548 a.setPoint( 2*i+1, xx, yy+2 ); 552 a.setPoint( 2*i+1, xx, yy+2 );
549 // qDebug(" "); 553 // qDebug(" ");
550 xx++; yy++; 554 xx++; yy++;
551 } 555 }
552 yy -= 2; 556 yy -= 2;
553 for ( i=3; i<7; i++ ) { 557 for ( i=3; i<7; i++ ) {
554 a.setPoint( 2*i, xx, yy ); 558 a.setPoint( 2*i, xx, yy );
555 a.setPoint( 2*i+1, xx, yy+2 ); 559 a.setPoint( 2*i+1, xx, yy+2 );
556 xx++; yy--; 560 xx++; yy--;
557 } 561 }
558 p->setPen( darkGreen ); 562 p->setPen( Qt::darkGreen );
559 p->drawLineSegments( a ); 563 p->drawLineSegments( a );
560 } 564 }
561 //////////////////////// 565 ////////////////////////
562 } 566 }
563 r += BoxSize + 4; 567 r += BoxSize + 4;
564 } 568 }
565 569
566 p->translate( r, 0 ); 570 p->translate( r, 0 );
567 p->setPen( QPen( _cg.text() ) ); 571 p->setPen( QPen( _cg.text() ) );
568 QListViewItem::paintCell( p, _cg, column, width - r, align ); 572 Q3ListViewItem::paintCell( p, _cg, column, width - r, align );
569 if ( mTodo->cancelled () ) { 573 if ( mTodo->cancelled () ) {
570 p->setPen( black ); 574 p->setPen( Qt::black );
571 QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() ); 575 QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() );
572 int wid = br.width() +lineStart; 576 int wid = br.width() +lineStart;
573 if ( wid > width-3 ) 577 if ( wid > width-3 )
574 wid = width-3; 578 wid = width-3;
575 p->drawLine( lineStart, height()/2+1, wid, height()/2+1 ); 579 p->drawLine( lineStart, height()/2+1, wid, height()/2+1 );
576 580
577 } 581 }
578 582
579} 583}
diff --git a/korganizer/kotodoviewitem.h b/korganizer/kotodoviewitem.h
index bd024c8..62a635c 100644
--- a/korganizer/kotodoviewitem.h
+++ b/korganizer/kotodoviewitem.h
@@ -9,65 +9,65 @@
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19#ifndef KOTODOVIEWITEM_H 19#ifndef KOTODOVIEWITEM_H
20#define KOTODOVIEWITEM_H 20#define KOTODOVIEWITEM_H
21 21
22#include <qfont.h> 22#include <qfont.h>
23#include <qfontmetrics.h> 23#include <qfontmetrics.h>
24#include <qlineedit.h> 24#include <qlineedit.h>
25#include <qptrlist.h> 25#include <q3ptrlist.h>
26#include <qstrlist.h> 26#include <q3strlist.h>
27#include <qlistbox.h> 27#include <q3listbox.h>
28#include <qpopupmenu.h> 28#include <q3popupmenu.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qmap.h> 30#include <qmap.h>
31#include <qlistview.h> 31#include <q3listview.h>
32#include <qpainter.h> 32#include <qpainter.h>
33 33
34#include <libkcal/calendar.h> 34#include <libkcal/calendar.h>
35#include <libkcal/todo.h> 35#include <libkcal/todo.h>
36 36
37using namespace KCal; 37using namespace KCal;
38 38
39class KOTodoView; 39class KOTodoView;
40 40
41/** 41/**
42 This class provides a way of displaying a single Event of Todo-Type in a 42 This class provides a way of displaying a single Event of Todo-Type in a
43 KTodoView. 43 KTodoView.
44 44
45 @author Cornelius Schumacher <schumacher@kde.org> 45 @author Cornelius Schumacher <schumacher@kde.org>
46 @see KOTodoView 46 @see KOTodoView
47*/ 47*/
48class KOTodoViewItem : public QCheckListItem 48class KOTodoViewItem : public Q3CheckListItem
49{ 49{
50 public: 50 public:
51 /** 51 /**
52 Constructor. 52 Constructor.
53 53
54 @param parent is the list view to which this item belongs. 54 @param parent is the list view to which this item belongs.
55 @param ev is the event to have the item display information for. 55 @param ev is the event to have the item display information for.
56 */ 56 */
57 KOTodoViewItem(QListView *parent, Todo *todo, KOTodoView *kotodo); 57 KOTodoViewItem(Q3ListView *parent, Todo *todo, KOTodoView *kotodo);
58 KOTodoViewItem(KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo); 58 KOTodoViewItem(KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo);
59 //~KOTodoViewItem() { qDebug("~KOTodoViewItem() %s ", text(0).latin1() );} 59 //~KOTodoViewItem() { qDebug("~KOTodoViewItem() %s ", text(0).latin1() );}
60 60
61 void construct(); 61 void construct();
62 62
63 Todo *todo() { return mTodo; } 63 Todo *todo() { return mTodo; }
64 64
65 QString key(int, bool) const; 65 QString key(int, bool) const;
66 66
67 void setSortKey(int column,const QString &key); 67 void setSortKey(int column,const QString &key);
68 68
69 bool isAlternate(); 69 bool isAlternate();
70 70
71 virtual void paintCell(QPainter *p, const QColorGroup &cg, 71 virtual void paintCell(QPainter *p, const QColorGroup &cg,
72 int column, int width, int alignment); 72 int column, int width, int alignment);
73 virtual void setup(); 73 virtual void setup();
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 4057ae0..07c4295 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -10,33 +10,35 @@
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <qwidgetstack.h> 26#include <q3widgetstack.h>
27//Added by qt3to4:
28#include <Q3PtrList>
27 29
28#include <kconfig.h> 30#include <kconfig.h>
29#include <kglobal.h> 31#include <kglobal.h>
30#ifndef DESKTOP_VERSION 32#ifndef DESKTOP_VERSION
31#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
32#else 34#else
33#include <qapplication.h> 35#include <qapplication.h>
34#endif 36#endif
35#include <qdatetime.h> 37#include <qdatetime.h>
36#include "calendarview.h" 38#include "calendarview.h"
37#include "datenavigator.h" 39#include "datenavigator.h"
38#include "kotodoview.h" 40#include "kotodoview.h"
39#include "koagendaview.h" 41#include "koagendaview.h"
40#include "kodialogmanager.h" 42#include "kodialogmanager.h"
41#include "komonthview.h" 43#include "komonthview.h"
42#include "kolistview.h" 44#include "kolistview.h"
@@ -444,34 +446,34 @@ void KOViewManager::showListView()
444 mMainView, SLOT(editIncidence(Incidence *))); 446 mMainView, SLOT(editIncidence(Incidence *)));
445 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 447 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
446 mMainView, SLOT(deleteIncidence(Incidence *))); 448 mMainView, SLOT(deleteIncidence(Incidence *)));
447 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 449 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
448 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 450 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
449 connect( mListView, SIGNAL( signalNewEvent() ), 451 connect( mListView, SIGNAL( signalNewEvent() ),
450 mMainView, SLOT( newEvent() ) ); 452 mMainView, SLOT( newEvent() ) );
451 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 453 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
452 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 454 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
453 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 455 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
454 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 456 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
455 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 457 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
456 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 458 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
457 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 459 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
458 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 460 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
459 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 461 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
460 connect( mListView, SIGNAL( beamIncidenceList( QPtrList<Incidence> ) ), 462 connect( mListView, SIGNAL( beamIncidenceList( Q3PtrList<Incidence> ) ),
461 mMainView, SLOT ( beamIncidenceList( QPtrList<Incidence> ) ) ); 463 mMainView, SLOT ( beamIncidenceList( Q3PtrList<Incidence> ) ) );
462 } 464 }
463 // bool temp = mFlagShowNextxDays; 465 // bool temp = mFlagShowNextxDays;
464 //globalFlagBlockPainting = true; 466 //globalFlagBlockPainting = true;
465 globalFlagBlockAgenda = 1; 467 globalFlagBlockAgenda = 1;
466 if ( KOPrefs::instance()->mListViewMonthTimespan ) { 468 if ( KOPrefs::instance()->mListViewMonthTimespan ) {
467 mMainView->setBlockShowDates( true ); 469 mMainView->setBlockShowDates( true );
468 mMainView->dateNavigator()->selectMonth(); 470 mMainView->dateNavigator()->selectMonth();
469 mMainView->setBlockShowDates( false ); 471 mMainView->setBlockShowDates( false );
470 } 472 }
471 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; 473 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW;
472 showView(mListView, KOPrefs::instance()->mFullViewTodo); 474 showView(mListView, KOPrefs::instance()->mFullViewTodo);
473 //mFlagShowNextxDays = temp; 475 //mFlagShowNextxDays = temp;
474 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; 476 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW;
475 mMainView->setScrollBarStep( 7 ); 477 mMainView->setScrollBarStep( 7 );
476} 478}
477 479
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index f88403c..bfe930f 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -5,161 +5,167 @@
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qlayout.h> 20#include <qlayout.h>
21#include <qtextbrowser.h> 21#include <q3textbrowser.h>
22#include <qtextcodec.h> 22#include <qtextcodec.h>
23#include <qfileinfo.h> 23#include <qfileinfo.h>
24#include <qlabel.h> 24#include <qlabel.h>
25 25
26#include <qapplication.h> 26#include <qapplication.h>
27#include <QDesktopWidget>
27#ifdef DESKTOP_VERSION 28#ifdef DESKTOP_VERSION
28#include <qpaintdevicemetrics.h> 29#include <q3paintdevicemetrics.h>
30//Added by qt3to4:
31#include <Q3PtrList>
32#include <QHideEvent>
33#include <Q3VBoxLayout>
34#include <QShowEvent>
29#endif 35#endif
30#include <kglobal.h> 36#include <kglobal.h>
31#include <klocale.h> 37#include <klocale.h>
32#include <kdebug.h> 38#include <kdebug.h>
33#include <kiconloader.h> 39#include <kiconloader.h>
34#include <kmessagebox.h> 40#include <kmessagebox.h>
35 41
36#include <libkcal/calendar.h> 42#include <libkcal/calendar.h>
37 43
38#ifndef KORG_NOPRINTER 44#ifndef KORG_NOPRINTER
39#include "calprinter.h" 45#include "calprinter.h"
40#endif 46#endif
41#include "koglobals.h" 47#include "koglobals.h"
42#include "koprefs.h" 48#include "koprefs.h"
43#include "koeventviewerdialog.h" 49#include "koeventviewerdialog.h"
44#include "koeventviewer.h" 50#include "koeventviewer.h"
45#include <qstylesheet.h> 51#include <q3stylesheet.h>
46#include "kowhatsnextview.h" 52#include "kowhatsnextview.h"
47using namespace KOrg; 53using namespace KOrg;
48 54
49void WhatsNextTextBrowser::setSource(const QString& n) 55void WhatsNextTextBrowser::setSource(const QString& n)
50{ 56{
51 57
52 if (n.startsWith("event:")) { 58 if (n.startsWith("event:")) {
53 emit showIncidence(n); 59 emit showIncidence(n);
54 return; 60 return;
55 } else if (n.startsWith("todo:")) { 61 } else if (n.startsWith("todo:")) {
56 emit showIncidence(n); 62 emit showIncidence(n);
57 return; 63 return;
58 } else { 64 } else {
59 QTextBrowser::setSource(n); 65 Q3TextBrowser::setSource(n);
60 } 66 }
61} 67}
62void WhatsNextTextBrowser::printMe() 68void WhatsNextTextBrowser::printMe()
63{ 69{
64#ifdef DESKTOP_VERSION 70#ifdef DESKTOP_VERSION
65 KOPrintPrefs pp ( this ); 71 KOPrintPrefs pp ( this );
66 if (!pp.exec() ) 72 if (!pp.exec() )
67 return; 73 return;
68 int scaleval = pp.printMode() ; 74 int scaleval = pp.printMode() ;
69 75
70 QPrinter printer; 76 QPrinter printer;
71 if (!printer.setup() ) 77 if (!printer.setup() )
72 return; 78 return;
73 QPainter p; 79 QPainter p;
74 p.begin ( &printer ); 80 p.begin ( &printer );
75 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 81 Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer );
76 float dx, dy; 82 float dx, dy;
77 int wid = (m.width() * 9)/10; 83 int wid = (m.width() * 9)/10;
78 dx = (float) wid/(float)contentsWidth (); 84 dx = (float) wid/(float)contentsWidth ();
79 dy = (float)(m.height()) / (float)contentsHeight (); 85 dy = (float)(m.height()) / (float)contentsHeight ();
80 float scale; 86 float scale;
81 // scale to fit the width or height of the paper 87 // scale to fit the width or height of the paper
82 if ( dx < dy ) 88 if ( dx < dy )
83 scale = dx; 89 scale = dx;
84 else 90 else
85 scale = dy; 91 scale = dy;
86 p.translate( m.width()/10,0 ); 92 p.translate( m.width()/10,0 );
87 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { 93 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
88 p.scale( scale, scale ); 94 p.scale( scale, scale );
89 } 95 }
90 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); 96 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
91 p.end(); 97 p.end();
92#endif 98#endif
93} 99}
94 100
95KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, 101KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
96 const char *name) 102 const char *name)
97 : KOrg::BaseView(calendar, parent, name) 103 : KOrg::BaseView(calendar, parent, name)
98{ 104{
99 // mDateLabel = 105 // mDateLabel =
100 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); 106 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this);
101 // mDateLabel->setMargin(2); 107 // mDateLabel->setMargin(2);
102 // mDateLabel->setAlignment(AlignCenter); 108 // mDateLabel->setAlignment(AlignCenter);
103 setFont( KOPrefs::instance()->mWhatsNextFont ); 109 setFont( KOPrefs::instance()->mWhatsNextFont );
104 mView = new WhatsNextTextBrowser(this); 110 mView = new WhatsNextTextBrowser(this);
105 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); 111 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &)));
106 QStyleSheet* stsh = mView->styleSheet(); 112 Q3StyleSheet* stsh = mView->styleSheet();
107 QStyleSheetItem * style ; 113 Q3StyleSheetItem * style ;
108 style = stsh->item ("h2" ); 114 style = stsh->item ("h2" );
109 if ( style ) { 115 if ( style ) {
110 style->setMargin(QStyleSheetItem::MarginAll,0); 116 style->setMargin(Q3StyleSheetItem::MarginAll,0);
111 } 117 }
112 style = stsh->item ("h3" ); 118 style = stsh->item ("h3" );
113 if ( style ) { 119 if ( style ) {
114 style->setMargin(QStyleSheetItem::MarginAll,0); 120 style->setMargin(Q3StyleSheetItem::MarginAll,0);
115 } 121 }
116 mEventViewer = 0; 122 mEventViewer = 0;
117 123
118 QBoxLayout *topLayout = new QVBoxLayout(this); 124 Q3BoxLayout *topLayout = new Q3VBoxLayout(this);
119 // topLayout->addWidget(mDateLabel); 125 // topLayout->addWidget(mDateLabel);
120 topLayout->addWidget(mView); 126 topLayout->addWidget(mView);
121 mTimer = new QTimer( this ); 127 mTimer = new QTimer( this );
122 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); 128 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView()));
123 129
124 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 130 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
125 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 131 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
126} 132}
127 133
128KOWhatsNextView::~KOWhatsNextView() 134KOWhatsNextView::~KOWhatsNextView()
129{ 135{
130} 136}
131 137
132int KOWhatsNextView::maxDatesHint() 138int KOWhatsNextView::maxDatesHint()
133{ 139{
134 return 0; 140 return 0;
135} 141}
136 142
137int KOWhatsNextView::currentDateCount() 143int KOWhatsNextView::currentDateCount()
138{ 144{
139 return 0; 145 return 0;
140} 146}
141 147
142void KOWhatsNextView::clearList() 148void KOWhatsNextView::clearList()
143{ 149{
144 mTimer->stop(); 150 mTimer->stop();
145 mView->setText(" "); 151 mView->setText(" ");
146} 152}
147QPtrList<Incidence> KOWhatsNextView::selectedIncidences() 153Q3PtrList<Incidence> KOWhatsNextView::selectedIncidences()
148{ 154{
149 QPtrList<Incidence> eventList; 155 Q3PtrList<Incidence> eventList;
150 156
151 return eventList; 157 return eventList;
152} 158}
153 159
154void KOWhatsNextView::printMe() 160void KOWhatsNextView::printMe()
155{ 161{
156#ifdef DESKTOP_VERSION 162#ifdef DESKTOP_VERSION
157 mView->printMe(); 163 mView->printMe();
158#endif 164#endif
159} 165}
160void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, 166void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd,
161 const QDate &td) 167 const QDate &td)
162{ 168{
163#ifndef KORG_NOPRINTER 169#ifndef KORG_NOPRINTER
164 calPrinter->preview(CalPrinter::Day, fd, td); 170 calPrinter->preview(CalPrinter::Day, fd, td);
165#endif 171#endif
@@ -206,34 +212,34 @@ void KOWhatsNextView::updateView()
206 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; 212 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>";
207#else 213#else
208 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 214 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
209#endif 215#endif
210 // mText += "<img src=\""; 216 // mText += "<img src=\"";
211 // mText += ipath; 217 // mText += ipath;
212 // mText += "\">"; 218 // mText += "\">";
213 mEventDate = QDate::currentDate(); 219 mEventDate = QDate::currentDate();
214#ifdef DESKTOP_VERSION 220#ifdef DESKTOP_VERSION
215 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; 221 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>";
216#else 222#else
217 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; 223 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>";
218#endif 224#endif
219 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; 225 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
220 int iii; 226 int iii;
221 mTodos.clear(); 227 mTodos.clear();
222 QPtrList<Event> events; 228 Q3PtrList<Event> events;
223 QPtrList<Todo> todos = calendar()->todos(); 229 Q3PtrList<Todo> todos = calendar()->todos();
224 Todo * todo; 230 Todo * todo;
225 //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; 231 //mText += "<h2>" + i18n("Events: ") + "</h2>\n";
226 int daysToShow = KOPrefs::instance()->mWhatsNextDays ; 232 int daysToShow = KOPrefs::instance()->mWhatsNextDays ;
227 bool itemAdded = false; 233 bool itemAdded = false;
228 for ( iii = 0; iii < daysToShow; ++iii ) { 234 for ( iii = 0; iii < daysToShow; ++iii ) {
229 QString date; 235 QString date;
230 itemAdded = false; 236 itemAdded = false;
231 events = calendar()->events( mEventDate, true ); 237 events = calendar()->events( mEventDate, true );
232 238
233 if ( iii == 0 ) { // today !!! 239 if ( iii == 0 ) { // today !!!
234 todo = todos.first(); 240 todo = todos.first();
235 while(todo) { 241 while(todo) {
236 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { 242 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) {
237 if ( ! itemAdded ) { 243 if ( ! itemAdded ) {
238 appendDay ( iii, mEventDate ); 244 appendDay ( iii, mEventDate );
239 //itemAdded = true; 245 //itemAdded = true;
@@ -441,33 +447,33 @@ void KOWhatsNextView::appendDay( int i, QDate eventDate )
441 } 447 }
442 else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; 448 else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>";
443 449
444#endif 450#endif
445 mText += "<h2>" + date + "</h2>\n"; 451 mText += "<h2>" + date + "</h2>\n";
446 //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; 452 //mText += "<big><big><strong>" + date + "</strong></big></big>\n";
447 mText += "<table>\n"; 453 mText += "<table>\n";
448 } 454 }
449} 455}
450 456
451 457
452void KOWhatsNextView::showDates(const QDate &, const QDate &) 458void KOWhatsNextView::showDates(const QDate &, const QDate &)
453{ 459{
454 updateView(); 460 updateView();
455} 461}
456 462
457void KOWhatsNextView::showEvents(QPtrList<Event>) 463void KOWhatsNextView::showEvents(Q3PtrList<Event>)
458{ 464{
459} 465}
460 466
461void KOWhatsNextView::changeEventDisplay(Event *, int action) 467void KOWhatsNextView::changeEventDisplay(Event *, int action)
462{ 468{
463 switch(action) { 469 switch(action) {
464 case KOGlobals::EVENTADDED: 470 case KOGlobals::EVENTADDED:
465 updateView(); 471 updateView();
466 break; 472 break;
467 case KOGlobals::EVENTEDITED: 473 case KOGlobals::EVENTEDITED:
468 updateView(); 474 updateView();
469 break; 475 break;
470 case KOGlobals::EVENTDELETED: 476 case KOGlobals::EVENTDELETED:
471 updateView(); 477 updateView();
472 break; 478 break;
473 default: 479 default:
@@ -728,33 +734,33 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
728 KGlobal::locale()->setDateFormatShort("%d.%b"); 734 KGlobal::locale()->setDateFormatShort("%d.%b");
729 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; 735 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>";
730 KGlobal::locale()->setDateFormatShort(dfs); 736 KGlobal::locale()->setDateFormatShort(dfs);
731 } 737 }
732 if ( KOPrefs::instance()->mWNViewShowLocation ) 738 if ( KOPrefs::instance()->mWNViewShowLocation )
733 if ( !ev->location().isEmpty() ) 739 if ( !ev->location().isEmpty() )
734 mText += " ("+ev->location() +")"; 740 mText += " ("+ev->location() +")";
735 if ( !isSub ) { 741 if ( !isSub ) {
736 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) 742 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents)
737 mText += " ["+ev->relatedTo()->summary() +"]"; 743 mText += " ["+ev->relatedTo()->summary() +"]";
738 mText += "</p>\n"; 744 mText += "</p>\n";
739 } 745 }
740 else { 746 else {
741 ind += "-"; 747 ind += "-";
742 mText += "</li>\n"; 748 mText += "</li>\n";
743 } 749 }
744 QPtrList<Incidence> Relations = ev->relations(); 750 Q3PtrList<Incidence> Relations = ev->relations();
745 Incidence *to; 751 Incidence *to;
746 for (to=Relations.first();to;to=Relations.next()) { 752 for (to=Relations.first();to;to=Relations.next()) {
747 if (!((Todo*)to)->isCompleted() && ((Todo*)to)->priority() <= mCurrentMaxPrio ) 753 if (!((Todo*)to)->isCompleted() && ((Todo*)to)->priority() <= mCurrentMaxPrio )
748 appendTodo( to, ind , true ); 754 appendTodo( to, ind , true );
749 } 755 }
750 756
751 return true; 757 return true;
752} 758}
753 759
754/* 760/*
755 void KOWhatsNextView::createEventViewer() 761 void KOWhatsNextView::createEventViewer()
756 { 762 {
757 if (!mEventViewer) { 763 if (!mEventViewer) {
758 764
759 mEventViewer = new KOEventViewerDialog(this); 765 mEventViewer = new KOEventViewerDialog(this);
760 } 766 }
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h
index 93574ef..49fc448 100644
--- a/korganizer/kowhatsnextview.h
+++ b/korganizer/kowhatsnextview.h
@@ -6,97 +6,103 @@
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19#ifndef KOWHATSNEXTVIEW_H 19#ifndef KOWHATSNEXTVIEW_H
20#define KOWHATSNEXTVIEW_H 20#define KOWHATSNEXTVIEW_H
21 21
22#include <qtextbrowser.h> 22#include <q3textbrowser.h>
23#include <qtimer.h> 23#include <qtimer.h>
24//Added by qt3to4:
25#include <QShowEvent>
26#include <QHideEvent>
27#include <QLabel>
28#include <Q3ValueList>
29#include <Q3PtrList>
24 30
25#include <korganizer/baseview.h> 31#include <korganizer/baseview.h>
26 32
27class QListView; 33class Q3ListView;
28class QLabel; 34class QLabel;
29 35
30class KOEventViewerDialog; 36class KOEventViewerDialog;
31 37
32#include <qpainter.h> 38#include <qpainter.h>
33#include <qwidget.h> 39#include <qwidget.h>
34class WhatsNextTextBrowser : public QTextBrowser { 40class WhatsNextTextBrowser : public Q3TextBrowser {
35 Q_OBJECT 41 Q_OBJECT
36 public: 42 public:
37 WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {}; 43 WhatsNextTextBrowser(QWidget *parent) : Q3TextBrowser(parent) {};
38 44
39 void setSource(const QString &); 45 void setSource(const QString &);
40 void printMe(); 46 void printMe();
41 47
42 signals: 48 signals:
43 void showIncidence(const QString &uid); 49 void showIncidence(const QString &uid);
44}; 50};
45 51
46 52
47/** 53/**
48 This class provides a view of the next events and todos 54 This class provides a view of the next events and todos
49*/ 55*/
50class KOWhatsNextView : public KOrg::BaseView 56class KOWhatsNextView : public KOrg::BaseView
51{ 57{
52 Q_OBJECT 58 Q_OBJECT
53 public: 59 public:
54 KOWhatsNextView(Calendar *calendar, QWidget *parent = 0, 60 KOWhatsNextView(Calendar *calendar, QWidget *parent = 0,
55 const char *name = 0); 61 const char *name = 0);
56 ~KOWhatsNextView(); 62 ~KOWhatsNextView();
57 63
58 virtual int maxDatesHint(); 64 virtual int maxDatesHint();
59 virtual int currentDateCount(); 65 virtual int currentDateCount();
60 void setEventViewer(KOEventViewerDialog* v ); 66 void setEventViewer(KOEventViewerDialog* v );
61 virtual QPtrList<Incidence> selectedIncidences(); 67 virtual Q3PtrList<Incidence> selectedIncidences();
62 void clearList(); 68 void clearList();
63 DateList selectedDates() 69 DateList selectedDates()
64 {DateList q; 70 {DateList q;
65 return q;} 71 return q;}
66 virtual void printPreview(CalPrinter *calPrinter, 72 virtual void printPreview(CalPrinter *calPrinter,
67 const QDate &, const QDate &); 73 const QDate &, const QDate &);
68 74
69 public slots: 75 public slots:
70 virtual void updateView(); 76 virtual void updateView();
71 void printMe(); 77 void printMe();
72 virtual void showDates(const QDate &start, const QDate &end); 78 virtual void showDates(const QDate &start, const QDate &end);
73 virtual void showEvents(QPtrList<Event> eventList); 79 virtual void showEvents(Q3PtrList<Event> eventList);
74 void updateConfig(); 80 void updateConfig();
75 void changeEventDisplay(Event *, int); 81 void changeEventDisplay(Event *, int);
76 82
77 protected: 83 protected:
78 bool appendEvent(Incidence *, bool reply=false, bool notRed = true, bool appendTable = false); 84 bool appendEvent(Incidence *, bool reply=false, bool notRed = true, bool appendTable = false);
79 bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); 85 bool appendTodo(Incidence *, QString ind = "", bool isSub = false );
80 void appendDay( int i, QDate date ); 86 void appendDay( int i, QDate date );
81 QDate mEventDate; 87 QDate mEventDate;
82 virtual void showEvent ( QShowEvent * ); 88 virtual void showEvent ( QShowEvent * );
83 virtual void hideEvent ( QHideEvent * ); 89 virtual void hideEvent ( QHideEvent * );
84 90
85 private slots: 91 private slots:
86 void showIncidence(const QString &); 92 void showIncidence(const QString &);
87 void restartTimer(); 93 void restartTimer();
88 94
89 95
90 private: 96 private:
91 int mCurrentMaxPrio; 97 int mCurrentMaxPrio;
92 //void createEventViewer(); 98 //void createEventViewer();
93 QTimer* mTimer; 99 QTimer* mTimer;
94 WhatsNextTextBrowser *mView; 100 WhatsNextTextBrowser *mView;
95 QString mText; 101 QString mText;
96 // QLabel *mDateLabel; 102 // QLabel *mDateLabel;
97 KOEventViewerDialog *mEventViewer; 103 KOEventViewerDialog *mEventViewer;
98 104
99 QValueList<Incidence *> mTodos; 105 Q3ValueList<Incidence *> mTodos;
100}; 106};
101 107
102#endif 108#endif
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp
index df9b2fc..e2ae4a6 100644
--- a/korganizer/ktimeedit.cpp
+++ b/korganizer/ktimeedit.cpp
@@ -8,81 +8,84 @@
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qkeycode.h> 24#include <qnamespace.h>
25#include <qcombobox.h> 25#include <qcombobox.h>
26#include <qdatetime.h> 26#include <qdatetime.h>
27#include <qlineedit.h> 27#include <qlineedit.h>
28#include <qlistbox.h> 28#include <q3listbox.h>
29#include <qapplication.h> 29#include <qapplication.h>
30#include <QDesktopWidget>
31//Added by qt3to4:
32#include <QKeyEvent>
30 33
31#include <kmessagebox.h> 34#include <kmessagebox.h>
32#include <kglobal.h> 35#include <kglobal.h>
33#include <kdebug.h> 36#include <kdebug.h>
34#include <klocale.h> 37#include <klocale.h>
35#include <kpimglobalprefs.h> 38#include <kpimglobalprefs.h>
36 39
37#include "ktimeedit.h" 40#include "ktimeedit.h"
38#include "koprefs.h" 41#include "koprefs.h"
39#include <qvalidator.h> 42#include <qvalidator.h>
40 43
41// Validator for a time value with only hours and minutes (no seconds) 44// Validator for a time value with only hours and minutes (no seconds)
42// Mostly locale aware. Author: David Faure <faure@kde.org> 45// Mostly locale aware. Author: David Faure <faure@kde.org>
43 46
44// KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox. 47// KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox.
45// Difficult to get all in one... 48// Difficult to get all in one...
46// But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help. 49// But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help.
47KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) 50KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name)
48 : QComboBox(TRUE, parent, name) 51 : Q3ComboBox(TRUE, parent, name)
49{ 52{
50 setInsertionPolicy(NoInsertion); 53 setInsertionPolicy(NoInsertion);
51 mFlagKeyPressed = false; 54 mFlagKeyPressed = false;
52 if ( QApplication::desktop()->height() <= 480 ) { 55 if ( QApplication::desktop()->height() <= 480 ) {
53 setSizeLimit ( 6 ); 56 setSizeLimit ( 6 );
54 } else { 57 } else {
55 setSizeLimit ( 12 ); 58 setSizeLimit ( 12 );
56 } 59 }
57 mTime = qt; 60 mTime = qt;
58 61
59// mNoTimeString = i18n("No Time"); 62// mNoTimeString = i18n("No Time");
60// insertItem( mNoTimeString ); 63// insertItem( mNoTimeString );
61 64
62 // Fill combo box with selection of times in localized format. 65 // Fill combo box with selection of times in localized format.
63 QTime timeEntry(0,0,0); 66 QTime timeEntry(0,0,0);
64 do { 67 do {
65 insertItem(KGlobal::locale()->formatTime(timeEntry)); 68 insertItem(KGlobal::locale()->formatTime(timeEntry));
66 timeEntry = timeEntry.addSecs(60*15); 69 timeEntry = timeEntry.addSecs(60*15);
67 } while (!timeEntry.isNull()); 70 } while ( !( timeEntry.hour() || timeEntry.minute() ) );
68 // Add end of day. 71 // Add end of day.
69 insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) ); 72 insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) );
70 73
71 updateText(); 74 updateText();
72 setFocusPolicy(QWidget::StrongFocus); 75 setFocusPolicy(Qt::StrongFocus);
73 76
74 connect(this, SIGNAL(activated(int)), this, SLOT(activ(int))); 77 connect(this, SIGNAL(activated(int)), this, SLOT(activ(int)));
75 connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int))); 78 connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int)));
76 connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText())); 79 connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText()));
77 QFontMetrics fm ( font() ); 80 QFontMetrics fm ( font() );
78 QString timeString = "24:00"; 81 QString timeString = "24:00";
79 if ( KPimGlobalPrefs::instance()->mPreferredTime == 1 ) 82 if ( KPimGlobalPrefs::instance()->mPreferredTime == 1 )
80 timeString = "02:00pm"; 83 timeString = "02:00pm";
81 int addSpace = 32; 84 int addSpace = 32;
82 if ( QApplication::desktop()->width() > 320 ) 85 if ( QApplication::desktop()->width() > 320 )
83 timeString += ":00"; 86 timeString += ":00";
84 setFixedWidth(fm.width( timeString ) + 32 ); 87 setFixedWidth(fm.width( timeString ) + 32 );
85 88
86 // Highlight Background and Textcolor change from default 89 // Highlight Background and Textcolor change from default
87 QPalette palette = QWidget::palette(); 90 QPalette palette = QWidget::palette();
88 unsigned char red, green, blue; 91 unsigned char red, green, blue;
@@ -195,50 +198,50 @@ void KOTimeEdit::setSelect( int from, int to )
195 198
196void KOTimeEdit::keyPressEvent(QKeyEvent *e) 199void KOTimeEdit::keyPressEvent(QKeyEvent *e)
197{ 200{
198 201
199 qApp->processEvents(); 202 qApp->processEvents();
200 bool hour12Format = ( KPimGlobalPrefs::instance()->mPreferredTime == 1 ); 203 bool hour12Format = ( KPimGlobalPrefs::instance()->mPreferredTime == 1 );
201 int maxpos = hour12Format?7:5; 204 int maxpos = hour12Format?7:5;
202 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 205 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
203 e->ignore(); 206 e->ignore();
204 // qDebug(" ignore %d",e->isAutoRepeat() ); 207 // qDebug(" ignore %d",e->isAutoRepeat() );
205 return; 208 return;
206 } 209 }
207 if (! e->isAutoRepeat() ) { 210 if (! e->isAutoRepeat() ) {
208 mFlagKeyPressed = true; 211 mFlagKeyPressed = true;
209 } 212 }
210 // Tap -> Focus Next Widget 213 // Tap -> Focus Next Widget
211 if ( e->key() == Key_Tab ) { 214 if ( e->key() == Qt::Key_Tab ) {
212 QComboBox::keyPressEvent(e); 215 Q3ComboBox::keyPressEvent(e);
213 return; 216 return;
214 } 217 }
215 218
216 // save Text from QLineEdit and CursorPosition 219 // save Text from QLineEdit and CursorPosition
217 QString text = lineEdit()->text(); 220 QString text = lineEdit()->text();
218 int cpos = lineEdit()->cursorPosition(); 221 int cpos = lineEdit()->cursorPosition();
219 // qDebug("cpos %d ", cpos); 222 // qDebug("cpos %d ", cpos);
220 223
221 // Switch for arrows, backspace and escape 224 // Switch for arrows, backspace and escape
222 switch(e->key()) { 225 switch(e->key()) {
223 case Key_Escape: 226 case Qt::Key_Escape:
224 lineEdit()->deselect(); 227 lineEdit()->deselect();
225 case Key_Tab: 228 case Qt::Key_Tab:
226 QComboBox::keyPressEvent(e); 229 Q3ComboBox::keyPressEvent(e);
227 break; 230 break;
228 case Key_Up: 231 case Qt::Key_Up:
229 if ( e->state () == Qt::ControlButton ) { 232 if ( e->state () == Qt::ControlButton ) {
230 addTime(QTime(0,15,0), false ); 233 addTime(QTime(0,15,0), false );
231 lineEdit()->setCursorPosition(3); 234 lineEdit()->setCursorPosition(3);
232 setSelect( 3 , 2 ); 235 setSelect( 3 , 2 );
233 } 236 }
234 else 237 else
235 if ( e->state () == Qt::ShiftButton ) { 238 if ( e->state () == Qt::ShiftButton ) {
236 addTime(QTime(1,0,0), false ); 239 addTime(QTime(1,0,0), false );
237 lineEdit()->setCursorPosition(0); 240 lineEdit()->setCursorPosition(0);
238 setSelect( 0 , 2 ); 241 setSelect( 0 , 2 );
239 } 242 }
240 else 243 else
241 // switch time up, cursor location depend 244 // switch time up, cursor location depend
242 switch (cpos) { 245 switch (cpos) {
243 case 7: 246 case 7:
244 case 6: 247 case 6:
@@ -254,33 +257,33 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
254 addTime(QTime(0,1,0), false ); 257 addTime(QTime(0,1,0), false );
255 setSelect ( cpos , 1 ); 258 setSelect ( cpos , 1 );
256 break; 259 break;
257 case 3: 260 case 3:
258 addTime(QTime(0,10,0), false ); 261 addTime(QTime(0,10,0), false );
259 setSelect ( cpos , 1 ); 262 setSelect ( cpos , 1 );
260 break; 263 break;
261 case 2: 264 case 2:
262 lineEdit()->setCursorPosition(--cpos); 265 lineEdit()->setCursorPosition(--cpos);
263 case 1: 266 case 1:
264 case 0: 267 case 0:
265 addTime(QTime(1,0,0), false ); 268 addTime(QTime(1,0,0), false );
266 setSelect ( 0, 2 ); 269 setSelect ( 0, 2 );
267 break; 270 break;
268 } 271 }
269 break; 272 break;
270 case Key_Down: 273 case Qt::Key_Down:
271 if ( e->state () == Qt::ControlButton ) { 274 if ( e->state () == Qt::ControlButton ) {
272 subTime(QTime(0,15,0), false ); 275 subTime(QTime(0,15,0), false );
273 lineEdit()->setCursorPosition(3); 276 lineEdit()->setCursorPosition(3);
274 setSelect( 3 , 2 ); 277 setSelect( 3 , 2 );
275 } 278 }
276 else 279 else
277 if ( e->state () == Qt::ShiftButton ) { 280 if ( e->state () == Qt::ShiftButton ) {
278 subTime(QTime(1,0,0), false ); 281 subTime(QTime(1,0,0), false );
279 lineEdit()->setCursorPosition(0); 282 lineEdit()->setCursorPosition(0);
280 setSelect( 0 , 2 ); 283 setSelect( 0 , 2 );
281 } 284 }
282 else 285 else
283 // switch time down, cursor location depend 286 // switch time down, cursor location depend
284 switch (cpos) { 287 switch (cpos) {
285 case 7: 288 case 7:
286 case 6: 289 case 6:
@@ -297,154 +300,154 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
297 setSelect ( cpos , 1 ); 300 setSelect ( cpos , 1 );
298 break; 301 break;
299 case 3: 302 case 3:
300 subTime(QTime(0,10,0), false ); 303 subTime(QTime(0,10,0), false );
301 setSelect ( cpos , 1 ); 304 setSelect ( cpos , 1 );
302 break; 305 break;
303 case 2: 306 case 2:
304 lineEdit()->setCursorPosition(--cpos); 307 lineEdit()->setCursorPosition(--cpos);
305 case 1: 308 case 1:
306 case 0: 309 case 0:
307 subTime(QTime(1,0,0), false ); 310 subTime(QTime(1,0,0), false );
308 setSelect ( 0 , 2 ); 311 setSelect ( 0 , 2 );
309 break; 312 break;
310 } 313 }
311 break; 314 break;
312 // set cursor to correct place 315 // set cursor to correct place
313 case Key_Left: 316 case Qt::Key_Left:
314 if ( cpos == 3 ) 317 if ( cpos == 3 )
315 --cpos; 318 --cpos;
316 if ( cpos > 0) { 319 if ( cpos > 0) {
317 lineEdit()->setCursorPosition(--cpos); 320 lineEdit()->setCursorPosition(--cpos);
318 setSelect ( cpos , 1 ); 321 setSelect ( cpos , 1 );
319 } 322 }
320 else 323 else
321 setSelect ( 0 , 1 ); 324 setSelect ( 0 , 1 );
322 break; 325 break;
323 // set cursor to correct place 326 // set cursor to correct place
324 case Key_Right: 327 case Qt::Key_Right:
325 if ( cpos == 1 ) 328 if ( cpos == 1 )
326 ++cpos; 329 ++cpos;
327 if ( cpos < maxpos ) { 330 if ( cpos < maxpos ) {
328 lineEdit()->setCursorPosition(++cpos); 331 lineEdit()->setCursorPosition(++cpos);
329 setSelect ( cpos , 1 ); 332 setSelect ( cpos , 1 );
330 } 333 }
331 break; 334 break;
332 // rest 335 // rest
333 case Key_Prior: 336 case Qt::Key_Prior:
334 subTime(QTime(1,0,0)); 337 subTime(QTime(1,0,0));
335 break; 338 break;
336 case Key_Next: 339 case Qt::Key_Next:
337 addTime(QTime(1,0,0)); 340 addTime(QTime(1,0,0));
338 break; 341 break;
339 case Key_Backspace: 342 case Qt::Key_Backspace:
340 if ( cpos > 0) { 343 if ( cpos > 0) {
341 if ( cpos == 3 ) 344 if ( cpos == 3 )
342 --cpos; 345 --cpos;
343 if ( cpos > 5) 346 if ( cpos > 5)
344 cpos = 5; 347 cpos = 5;
345 text.at( cpos-1 ) = '0'; 348 text[ cpos-1 ] = '0';
346 lineEdit()->setText( text ); 349 lineEdit()->setText( text );
347 lineEdit()->setCursorPosition(--cpos); 350 lineEdit()->setCursorPosition(--cpos);
348 setSelect ( cpos , 1 ); 351 setSelect ( cpos , 1 );
349 changedText(); 352 changedText();
350 } 353 }
351 break; 354 break;
352 } // switch arrows 355 } // switch arrows
353 356
354 // if cursor at string end, alltext market and keyEvent don't ArrowLeft -> deselect and cpos 357 // if cursor at string end, alltext market and keyEvent don't ArrowLeft -> deselect and cpos
355 if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Key_Left ) { 358 if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Qt::Key_Left ) {
356 lineEdit()->deselect(); 359 lineEdit()->deselect();
357 cpos = 0; 360 cpos = 0;
358 lineEdit()->setCursorPosition(cpos); 361 lineEdit()->setCursorPosition(cpos);
359 setSelect(cpos , 1); 362 setSelect(cpos , 1);
360 } 363 }
361 364
362 if ( cpos == 2 ) { 365 if ( cpos == 2 ) {
363 lineEdit()->setCursorPosition(++cpos); 366 lineEdit()->setCursorPosition(++cpos);
364 } 367 }
365 368
366 // num keys when cursorPos preEnd 369 // num keys when cursorPos preEnd
367 if ( cpos < 5 ) { 370 if ( cpos < 5 ) {
368 // switch another keys 371 // switch another keys
369 switch(e->key()) { 372 switch(e->key()) {
370 case Key_Delete: 373 case Qt::Key_Delete:
371 text.at( cpos ) = '0'; 374 text[ cpos ] = '0';
372 lineEdit()->setText( text ); 375 lineEdit()->setText( text );
373 lineEdit()->setCursorPosition(cpos); 376 lineEdit()->setCursorPosition(cpos);
374 setSelect ( cpos , 1 ); 377 setSelect ( cpos , 1 );
375 changedText(); 378 changedText();
376 break; 379 break;
377 case Key_9: 380 case Qt::Key_9:
378 case Key_8: 381 case Qt::Key_8:
379 case Key_7: 382 case Qt::Key_7:
380 case Key_6: 383 case Qt::Key_6:
381 if ( !(cpos == 1 || cpos == 4) ) 384 if ( !(cpos == 1 || cpos == 4) )
382 return; 385 return;
383 if ( cpos == 1 && text.at( 0 ) > '1') 386 if ( cpos == 1 && text.at( 0 ) > '1')
384 text.at( 0 ) = '1'; 387 text[ 0 ] = '1';
385 case Key_5: 388 case Qt::Key_5:
386 case Key_4: 389 case Qt::Key_4:
387 case Key_3: 390 case Qt::Key_3:
388 if ( cpos < 1 ) 391 if ( cpos < 1 )
389 return; 392 return;
390 if ( hour12Format && cpos == 1 ) 393 if ( hour12Format && cpos == 1 )
391 return; 394 return;
392 case Key_2: 395 case Qt::Key_2:
393 if ( hour12Format && cpos == 0 ) 396 if ( hour12Format && cpos == 0 )
394 return; 397 return;
395 if ( cpos == 0 && text.at( 1 ) > '3') 398 if ( cpos == 0 && text.at( 1 ) > '3')
396 text.at( 1 ) = '3'; 399 text[ 1 ] = '3';
397 case Key_1: 400 case Qt::Key_1:
398 case Key_0: 401 case Qt::Key_0:
399 if ( hour12Format ) { 402 if ( hour12Format ) {
400 if ( e->key() == Key_0 && cpos == 1 && text.at( 0 ) == '0' ) 403 if ( e->key() == Qt::Key_0 && cpos == 1 && text.at( 0 ) == '0' )
401 return; 404 return;
402 if ( e->key() == Key_0 && cpos == 0 && text.at( 1 ) == '0' ) 405 if ( e->key() == Qt::Key_0 && cpos == 0 && text.at( 1 ) == '0' )
403 text.at( 1 ) = '1'; 406 text[ 1 ] = '1';
404 } 407 }
405 text.at( cpos ) = QChar ( e->key() ); 408 text[ cpos ] = QChar ( e->key() );
406 lineEdit()->setText( text ); 409 lineEdit()->setText( text );
407 if ( cpos == 1 ) 410 if ( cpos == 1 )
408 ++cpos; 411 ++cpos;
409 if ( cpos < 5) 412 if ( cpos < 5)
410 lineEdit()->setCursorPosition(++cpos); 413 lineEdit()->setCursorPosition(++cpos);
411 setSelect( cpos , 1 ); 414 setSelect( cpos , 1 );
412 changedText(); 415 changedText();
413 break; 416 break;
414 case Key_Home: 417 case Qt::Key_Home:
415 lineEdit()->setCursorPosition(0); 418 lineEdit()->setCursorPosition(0);
416 setSelect( cpos , 1 ); 419 setSelect( cpos , 1 );
417 break; 420 break;
418 case Key_End: 421 case Qt::Key_End:
419 lineEdit()->setCursorPosition(5); 422 lineEdit()->setCursorPosition(5);
420 lineEdit()->deselect(); 423 lineEdit()->deselect();
421 break; 424 break;
422 default: 425 default:
423// QComboBox::keyPressEvent(e); 426// QComboBox::keyPressEvent(e);
424 break; 427 break;
425 } // switch num keys 428 } // switch num keys
426 } else if ( cpos == 5 ) {// if cpos < 5 429 } else if ( cpos == 5 ) {// if cpos < 5
427 if ( hour12Format ) { 430 if ( hour12Format ) {
428 if ( e->key() == Key_A ) { 431 if ( e->key() == Qt::Key_A ) {
429 text.at( 5 ) = 'a'; 432 text[ 5 ] = 'a';
430 lineEdit()->setText( text ); 433 lineEdit()->setText( text );
431 lineEdit()->setCursorPosition(5); 434 lineEdit()->setCursorPosition(5);
432 435
433 } else if ( e->key() == Key_P ) { 436 } else if ( e->key() == Qt::Key_P ) {
434 text.at( 5 ) = 'p'; 437 text[ 5 ] = 'p';
435 lineEdit()->setText( text ); 438 lineEdit()->setText( text );
436 lineEdit()->setCursorPosition(5); 439 lineEdit()->setCursorPosition(5);
437 440
438 } 441 }
439 } 442 }
440 } 443 }
441 444
442 445
443} 446}
444 447
445void KOTimeEdit::updateText() 448void KOTimeEdit::updateText()
446{ 449{
447 listBox()->blockSignals( true ); 450 listBox()->blockSignals( true );
448 blockSignals( true ); 451 blockSignals( true );
449 QString s = KGlobal::locale()->formatTime(mTime); 452 QString s = KGlobal::locale()->formatTime(mTime);
450 // Set the text but without emitting signals, nor losing the cursor position 453 // Set the text but without emitting signals, nor losing the cursor position
diff --git a/korganizer/ktimeedit.h b/korganizer/ktimeedit.h
index b3d842d..1c7d18d 100644
--- a/korganizer/ktimeedit.h
+++ b/korganizer/ktimeedit.h
@@ -11,47 +11,50 @@
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef _KTIMEEDIT_H 23#ifndef _KTIMEEDIT_H
24#define _KTIMEEDIT_H 24#define _KTIMEEDIT_H
25 25
26#include <qevent.h> 26#include <qevent.h>
27#include <qkeycode.h> 27#include <qnamespace.h>
28#include <qstring.h> 28#include <qstring.h>
29#include <qdatetime.h> 29#include <qdatetime.h>
30#include <qcombobox.h> 30#include <qcombobox.h>
31#include <Q3ComboBox>
32//Added by qt3to4:
33#include <QKeyEvent>
31 34
32#include <kapplication.h> 35#include <kapplication.h>
33 36
34/** 37/**
35 This is a class that provides an easy, user friendly way to edit times. 38 This is a class that provides an easy, user friendly way to edit times.
36 up/down/ increase or decrease time, respectively. 39 up/down/ increase or decrease time, respectively.
37 40
38 @short Provides a way to edit times in a user-friendly manner. 41 @short Provides a way to edit times in a user-friendly manner.
39 @author Preston Brown, Ian Dawes 42 @author Preston Brown, Ian Dawes
40*/ 43*/
41class KOTimeEdit : public QComboBox 44class KOTimeEdit : public Q3ComboBox
42{ 45{
43 Q_OBJECT 46 Q_OBJECT
44 public: 47 public:
45 /** constructs a new time edit. */ 48 /** constructs a new time edit. */
46 KOTimeEdit(QWidget *parent=0, QTime qt=QTime(12,0), const char *name=0); 49 KOTimeEdit(QWidget *parent=0, QTime qt=QTime(12,0), const char *name=0);
47 50
48 virtual ~KOTimeEdit(); 51 virtual ~KOTimeEdit();
49 52
50 /** 53 /**
51 Returns, if a time is selected. Can not return false anymore.... 54 Returns, if a time is selected. Can not return false anymore....
52 */ 55 */
53 bool hasTime() const; 56 bool hasTime() const;
54 57
55 /** returns the time that is currently set in the timeLineEdit. */ 58 /** returns the time that is currently set in the timeLineEdit. */
56 QTime getTime() const; 59 QTime getTime() const;
57 60
diff --git a/korganizer/lineview.cpp b/korganizer/lineview.cpp
index e72e41c..012455e 100644
--- a/korganizer/lineview.cpp
+++ b/korganizer/lineview.cpp
@@ -1,26 +1,26 @@
1#include <qpainter.h> 1#include <qpainter.h>
2 2
3#include <kdebug.h> 3#include <kdebug.h>
4 4
5#include "koprefs.h" 5#include "koprefs.h"
6 6
7#include "lineview.h" 7#include "lineview.h"
8 8
9LineView::LineView( QWidget *parent, const char *name ) : 9LineView::LineView( QWidget *parent, const char *name ) :
10 QScrollView( parent, name ) 10 Q3ScrollView( parent, name )
11{ 11{
12 mPixelWidth = 1000; 12 mPixelWidth = 1000;
13 13
14 mLines.setAutoDelete( true ); 14 mLines.setAutoDelete( true );
15 15
16 resizeContents( mPixelWidth, contentsHeight() ); 16 resizeContents( mPixelWidth, contentsHeight() );
17 17
18 viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); 18 viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor);
19} 19}
20 20
21LineView::~LineView() 21LineView::~LineView()
22{ 22{
23} 23}
24 24
25int LineView::pixelWidth() 25int LineView::pixelWidth()
26{ 26{
diff --git a/korganizer/lineview.h b/korganizer/lineview.h
index aa34dbc..52ae9cf 100644
--- a/korganizer/lineview.h
+++ b/korganizer/lineview.h
@@ -1,36 +1,36 @@
1#ifndef LINEVIEW_H 1#ifndef LINEVIEW_H
2#define LINEVIEW_H 2#define LINEVIEW_H
3 3
4#include <qscrollview.h> 4#include <q3scrollview.h>
5#include <qptrlist.h> 5#include <q3ptrlist.h>
6 6
7class LineView : public QScrollView 7class LineView : public Q3ScrollView
8{ 8{
9 Q_OBJECT 9 Q_OBJECT
10 public: 10 public:
11 LineView( QWidget *parent = 0, const char *name = 0 ); 11 LineView( QWidget *parent = 0, const char *name = 0 );
12 virtual ~LineView(); 12 virtual ~LineView();
13 13
14 int pixelWidth(); 14 int pixelWidth();
15 15
16 void addLine( int start, int end ); 16 void addLine( int start, int end );
17 17
18 void clear(); 18 void clear();
19 19
20 protected: 20 protected:
21 void drawContents(QPainter* p, int cx, int cy, int cw, int ch); 21 void drawContents(QPainter* p, int cx, int cy, int cw, int ch);
22 22
23 private: 23 private:
24 struct Line { 24 struct Line {
25 Line( int c, int s, int e ) : column( c ), start( s ), end( e ) {} 25 Line( int c, int s, int e ) : column( c ), start( s ), end( e ) {}
26 int column; 26 int column;
27 int start; 27 int start;
28 int end; 28 int end;
29 }; 29 };
30 30
31 QPtrList<Line> mLines; 31 Q3PtrList<Line> mLines;
32 int mPixelWidth; 32 int mPixelWidth;
33}; 33};
34 34
35#endif 35#endif
36 36
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index 4a0e24f..211fde6 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -1,50 +1,50 @@
1 1
2 2
3#ifndef DESKTOP_VERSION 3#ifndef DESKTOP_VERSION
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5#include <qcopchannel_qws.h> 5#include <qcopchannel_qws.h>
6#include <qpe/global.h> 6#include <qpe/global.h>
7//Added by qt3to4:
8#include <Q3CString>
7#include <stdlib.h> 9#include <stdlib.h>
8#else 10#else
9#include <qapplication.h> 11#include <qapplication.h>
10#include <qstring.h> 12#include <qstring.h>
11#include <qwindowsstyle.h> 13#include <qwindowsstyle.h>
12#include <qplatinumstyle.h>
13#include <qsgistyle.h>
14#include <stdlib.h> 14#include <stdlib.h>
15#endif 15#endif
16#include <qtextcodec.h> 16#include <qtextcodec.h>
17 17
18#include <qdir.h> 18#include <qdir.h>
19#include <kstandarddirs.h> 19#include <kstandarddirs.h>
20#include <kglobal.h> 20#include <kglobal.h>
21#include <stdio.h> 21#include <stdio.h>
22#include "mainwindow.h" 22#include "mainwindow.h"
23#include <libkdepim/kpimglobalprefs.h> 23#include <libkdepim/kpimglobalprefs.h>
24void dumpMissing(); 24void dumpMissing();
25 25
26 26
27int main( int argc, char **argv ) 27int main( int argc, char **argv )
28{ 28{
29 if(!getenv("QPEDIR")) putenv("QPEDIR=/usr/lib/kdepimpi");
29#ifndef DESKTOP_VERSION 30#ifndef DESKTOP_VERSION
30 QPEApplication a( argc, argv ); 31 QPEApplication a( argc, argv );
31 a.setKeepRunning (); 32 a.setKeepRunning ();
32#else 33#else
33 QApplication a( argc, argv ); 34 QApplication a( argc, argv );
34 QApplication::setStyle( new QPlatinumStyle ());
35#ifdef _WIN32_ 35#ifdef _WIN32_
36 QString hdir ( getenv( "HOME") ); 36 QString hdir ( getenv( "HOME") );
37 if ( hdir.isEmpty() ) { 37 if ( hdir.isEmpty() ) {
38 QString hd ("C:/" ); 38 QString hd ("C:/" );
39 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); 39 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd );
40 if ( QDir::homeDirPath().lower() == hd.lower() ) { 40 if ( QDir::homeDirPath().lower() == hd.lower() ) {
41 _putenv( "HOME=C:"); 41 _putenv( "HOME=C:");
42 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); 42 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) );
43 } 43 }
44 } else { 44 } else {
45 QDir app_dir; 45 QDir app_dir;
46 if ( !app_dir.exists(hdir) ) 46 if ( !app_dir.exists(hdir) )
47 app_dir.mkdir (hdir); 47 app_dir.mkdir (hdir);
48 } 48 }
49#endif 49#endif
50#endif 50#endif
@@ -76,42 +76,42 @@ int main( int argc, char **argv )
76 KGlobal::setAppName( "korganizer" ); 76 KGlobal::setAppName( "korganizer" );
77 QString fileName ; 77 QString fileName ;
78#ifndef DESKTOP_VERSION 78#ifndef DESKTOP_VERSION
79 fileName = getenv("QPEDIR"); 79 fileName = getenv("QPEDIR");
80 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); 80 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/");
81#else 81#else
82 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; 82 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/";
83 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 83 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
84#endif 84#endif
85 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); 85 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer")));
86 86
87 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); 87 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont );
88 KPimGlobalPrefs::instance()->setGlobalConfig(); 88 KPimGlobalPrefs::instance()->setGlobalConfig();
89 MainWindow m; 89 MainWindow m;
90#ifndef DESKTOP_VERSION 90#ifndef DESKTOP_VERSION
91 91
92 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(receiveStart( const QCString&, const QByteArray& ))); 92 QObject::connect( &a, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )),&m, SLOT(receiveStart( const Q3CString&, const QByteArray& )));
93 a.showMainWidget(&m ); 93 a.showMainWidget(&m );
94#else 94#else
95 a.setMainWidget(&m ); 95 a.setMainWidget(&m );
96 m.show(); 96 m.show();
97 //m.resize( 800, 600 ); 97 //m.resize( 800, 600 );
98 //QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 98 //QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
99#endif 99#endif
100 if ( argc > 1 ) { 100 if ( argc > 1 ) {
101 QCString command = argv[1]; 101 Q3CString command = argv[1];
102 if ( argc > 2 ) 102 if ( argc > 2 )
103 command += argv[2]; 103 command += argv[2];
104 m.recieve(command, QByteArray() ); 104 m.recieve(command, QByteArray() );
105 105
106 } 106 }
107 107
108#ifndef DESKTOP_VERSION 108#ifndef DESKTOP_VERSION
109 // QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); 109 // QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable );
110#endif 110#endif
111 a.exec(); 111 a.exec();
112 dumpMissing(); 112 dumpMissing();
113 113
114 KPimGlobalPrefs::instance()->writeConfig(); 114 KPimGlobalPrefs::instance()->writeConfig();
115 } 115 }
116 qDebug("KO: Bye! "); 116 qDebug("KO: Bye! ");
117} 117}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 69ccde1..2004939 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,48 +1,58 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <Q3Action>
5#include <q3popupmenu.h>
5#include <qpainter.h> 6#include <qpainter.h>
6#include <qwhatsthis.h> 7#include <q3whatsthis.h>
7#include <qpushbutton.h> 8#include <qpushbutton.h>
8#include <qmessagebox.h> 9#include <qmessagebox.h>
9#include <qlineedit.h> 10#include <qlineedit.h>
10#include <qtextcodec.h> 11#include <qtextcodec.h>
11#include <qfile.h> 12#include <qfile.h>
12#include <qdir.h> 13#include <qdir.h>
13#include <qapp.h> 14#include <qapplication.h>
14#include <qfileinfo.h> 15#include <qfileinfo.h>
15#include <qlabel.h> 16#include <qlabel.h>
16#include <qspinbox.h> 17#include <qspinbox.h>
17#include <qcheckbox.h> 18#include <qcheckbox.h>
18#include <qmap.h> 19#include <qmap.h>
19#include <qwmatrix.h> 20#include <qmatrix.h>
20#include <qtextbrowser.h> 21#include <q3textbrowser.h>
21#include <qtextstream.h> 22#include <q3textstream.h>
22#ifndef DESKTOP_VERSION 23#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 24#include <qpe/global.h>
24#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
25#include <qpe/resource.h> 26#include <qpe/resource.h>
26#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
27#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
28#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
29//#include <unistd.h> // for sleep 30//#include <unistd.h> // for sleep
30#else 31#else
31#include <qtoolbar.h> 32#include <q3toolbar.h>
32#include <qapplication.h> 33#include <qapplication.h>
34//Added by qt3to4:
35#include <QResizeEvent>
36#include <QPixmap>
37#include <QCloseEvent>
38#include <QKeyEvent>
39#include <Q3VBoxLayout>
40#include <QHideEvent>
41#include <Q3CString>
42#include <Q3PtrList>
33//#include <resource.h> 43//#include <resource.h>
34 44
35#endif 45#endif
36#include <libkcal/calendarlocal.h> 46#include <libkcal/calendarlocal.h>
37#include <libkcal/todo.h> 47#include <libkcal/todo.h>
38#include <libkcal/phoneformat.h> 48#include <libkcal/phoneformat.h>
39#include <libkdepim/ksyncprofile.h> 49#include <libkdepim/ksyncprofile.h>
40#include <libkdepim/phoneaccess.h> 50#include <libkdepim/phoneaccess.h>
41#include <libkcal/kincidenceformatter.h> 51#include <libkcal/kincidenceformatter.h>
42#include <libkdepim/kpimglobalprefs.h> 52#include <libkdepim/kpimglobalprefs.h>
43 53
44#include "calendarview.h" 54#include "calendarview.h"
45#include "koviewmanager.h" 55#include "koviewmanager.h"
46#include "datenavigator.h" 56#include "datenavigator.h"
47#include "koagendaview.h" 57#include "koagendaview.h"
48#include "kojournalview.h" 58#include "kojournalview.h"
@@ -67,87 +77,87 @@ using namespace KCal;
67#include <unistd.h> 77#include <unistd.h>
68#else 78#else
69#ifdef _OL_IMPORT_ 79#ifdef _OL_IMPORT_
70#include "koimportoldialog.h" 80#include "koimportoldialog.h"
71#endif 81#endif
72#endif 82#endif
73#include "mainwindow.h" 83#include "mainwindow.h"
74 84
75 85
76class KOex2phonePrefs : public QDialog 86class KOex2phonePrefs : public QDialog
77{ 87{
78 public: 88 public:
79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 89 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
80 QDialog( parent, name, true ) 90 QDialog( parent, name, true )
81 { 91 {
82 setCaption( i18n("Export to phone options") ); 92 setCaption( i18n("Export to phone options") );
83 QVBoxLayout* lay = new QVBoxLayout( this ); 93 Q3VBoxLayout* lay = new Q3VBoxLayout( this );
84 lay->setSpacing( 3 ); 94 lay->setSpacing( 3 );
85 lay->setMargin( 3 ); 95 lay->setMargin( 3 );
86 QLabel *lab; 96 QLabel *lab;
87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 97 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
88 lab->setAlignment (AlignHCenter ); 98 lab->setAlignment (Qt::AlignHCenter );
89 QHBox* temphb; 99 Q3HBox* temphb;
90 temphb = new QHBox( this ); 100 temphb = new Q3HBox( this );
91 new QLabel( i18n("I/O device: "), temphb ); 101 new QLabel( i18n("I/O device: "), temphb );
92 mPhoneDevice = new QLineEdit( temphb); 102 mPhoneDevice = new QLineEdit( temphb);
93 lay->addWidget( temphb ); 103 lay->addWidget( temphb );
94 temphb = new QHBox( this ); 104 temphb = new Q3HBox( this );
95 new QLabel( i18n("Connection: "), temphb ); 105 new QLabel( i18n("Connection: "), temphb );
96 mPhoneConnection = new QLineEdit( temphb); 106 mPhoneConnection = new QLineEdit( temphb);
97 lay->addWidget( temphb ); 107 lay->addWidget( temphb );
98 temphb = new QHBox( this ); 108 temphb = new Q3HBox( this );
99 new QLabel( i18n("Model(opt.): "), temphb ); 109 new QLabel( i18n("Model(opt.): "), temphb );
100 mPhoneModel = new QLineEdit( temphb); 110 mPhoneModel = new QLineEdit( temphb);
101 lay->addWidget( temphb ); 111 lay->addWidget( temphb );
102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 112 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
103 mWriteBackFuture->setChecked( true ); 113 mWriteBackFuture->setChecked( true );
104 lay->addWidget( mWriteBackFuture ); 114 lay->addWidget( mWriteBackFuture );
105 temphb = new QHBox( this ); 115 temphb = new Q3HBox( this );
106 new QLabel( i18n("Max. weeks in future: ") , temphb ); 116 new QLabel( i18n("Max. weeks in future: ") , temphb );
107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 117 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
108 mWriteBackFutureWeeks->setValue( 8 ); 118 mWriteBackFutureWeeks->setValue( 8 );
109 lay->addWidget( temphb ); 119 lay->addWidget( temphb );
110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 120 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
111 lab->setAlignment (AlignHCenter ); 121 lab->setAlignment (Qt::AlignHCenter );
112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 122 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
113 lay->addWidget( ok ); 123 lay->addWidget( ok );
114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 124 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
115 lay->addWidget( cancel ); 125 lay->addWidget( cancel );
116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 126 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 127 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
118 resize( 220, 240 ); 128 resize( 220, 240 );
119 qApp->processEvents(); 129 qApp->processEvents();
120 int dw = QApplication::desktop()->width(); 130 int dw = QApplication::desktop()->width();
121 int dh = QApplication::desktop()->height(); 131 int dh = QApplication::desktop()->height();
122 move( (dw-width())/2, (dh - height() )/2 ); 132 move( (dw-width())/2, (dh - height() )/2 );
123 } 133 }
124 134
125public: 135public:
126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 136 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
127 QCheckBox* mWriteBackFuture; 137 QCheckBox* mWriteBackFuture;
128 QSpinBox* mWriteBackFutureWeeks; 138 QSpinBox* mWriteBackFutureWeeks;
129}; 139};
130 140
131QPixmap* sgListViewCompletedPix[6]; 141QPixmap* sgListViewCompletedPix[6];
132QPixmap* sgListViewJournalPix; 142QPixmap* sgListViewJournalPix;
133 143
134 144
135int globalFlagBlockStartup; 145int globalFlagBlockStartup;
136MainWindow::MainWindow( QWidget *parent, const char *name ) : 146MainWindow::MainWindow( QWidget *parent, const char *name ) :
137 QMainWindow( parent, name ) 147 Q3MainWindow( parent, name )
138{ 148{
139 sgListViewCompletedPix[5] = &listviewPix; 149 sgListViewCompletedPix[5] = &listviewPix;
140 sgListViewCompletedPix[0] = &listviewPix0; 150 sgListViewCompletedPix[0] = &listviewPix0;
141 sgListViewCompletedPix[1] = &listviewPix20; 151 sgListViewCompletedPix[1] = &listviewPix20;
142 sgListViewCompletedPix[2] = &listviewPix40; 152 sgListViewCompletedPix[2] = &listviewPix40;
143 sgListViewCompletedPix[3] = &listviewPix60; 153 sgListViewCompletedPix[3] = &listviewPix60;
144 sgListViewCompletedPix[4] = &listviewPix80; 154 sgListViewCompletedPix[4] = &listviewPix80;
145 //int size = 12; 155 //int size = 12;
146 { 156 {
147 sgListViewCompletedPix[5]->resize( 11, 11 ); 157 sgListViewCompletedPix[5]->resize( 11, 11 );
148 sgListViewCompletedPix[5]->fill( Qt::white ); 158 sgListViewCompletedPix[5]->fill( Qt::white );
149 QPainter p ( sgListViewCompletedPix[5] ); 159 QPainter p ( sgListViewCompletedPix[5] );
150 p.drawRect( 0,0,11,11); 160 p.drawRect( 0,0,11,11);
151 p.drawLine ( 2, 5, 4 , 7 ) ; 161 p.drawLine ( 2, 5, 4 , 7 ) ;
152 p.drawLine ( 4 , 7 , 8, 3) ; 162 p.drawLine ( 4 , 7 , 8, 3) ;
153 int iii = 0; 163 int iii = 0;
@@ -172,129 +182,129 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) :
172 } 182 }
173 mAutoSaveDisabled = false; 183 mAutoSaveDisabled = false;
174 mClosed = false; 184 mClosed = false;
175 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 185 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
176 QString confFile = locateLocal("config","korganizerrc"); 186 QString confFile = locateLocal("config","korganizerrc");
177 QFileInfo finf ( confFile ); 187 QFileInfo finf ( confFile );
178 bool showWarning = !finf.exists(); 188 bool showWarning = !finf.exists();
179 setIcon(SmallIcon( "ko24" ) ); 189 setIcon(SmallIcon( "ko24" ) );
180 mBlockAtStartup = true; 190 mBlockAtStartup = true;
181 mFlagKeyPressed = false; 191 mFlagKeyPressed = false;
182 setCaption("KO/Pi"); 192 setCaption("KO/Pi");
183 KOPrefs *p = KOPrefs::instance(); 193 KOPrefs *p = KOPrefs::instance();
184 //KPimGlobalPrefs::instance()->setGlobalConfig(); 194 //KPimGlobalPrefs::instance()->setGlobalConfig();
185 p->mCurrentDisplayedView = 0; 195 p->mCurrentDisplayedView = 0;
186 if ( p->mHourSize > 22 ) 196 if ( p->mHourSize > 22 )
187 p->mHourSize = 22; 197 p->mHourSize = 22;
188 QMainWindow::ToolBarDock tbd; 198 Qt::ToolBarDock tbd;
189 if ( p->mToolBarHor ) { 199 if ( p->mToolBarHor ) {
190 if ( p->mToolBarUp ) 200 if ( p->mToolBarUp )
191 tbd = Bottom; 201 tbd = Qt::Bottom;
192 else 202 else
193 tbd = Top; 203 tbd = Qt::Top;
194 } 204 }
195 else { 205 else {
196 if ( p->mToolBarUp ) 206 if ( p->mToolBarUp )
197 tbd = Right; 207 tbd = Qt::Right;
198 else 208 else
199 tbd = Left; 209 tbd = Qt::Left;
200 } 210 }
201 if ( KOPrefs::instance()->mUseAppColors ) 211 if ( KOPrefs::instance()->mUseAppColors )
202 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 212 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
203 globalFlagBlockStartup = 1; 213 globalFlagBlockStartup = 1;
204 iconToolBar = new QPEToolBar( this ); 214 iconToolBar = new QPEToolBar( this );
205 addToolBar (iconToolBar , tbd ); 215 addToolBar (iconToolBar , tbd );
206 216
207#ifdef DESKTOP_VERSION 217#ifdef DESKTOP_VERSION
208 if ( KOPrefs::instance()->mShowIconFilter ) 218 if ( KOPrefs::instance()->mShowIconFilter )
209#else 219#else
210 if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) ) 220 if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) )
211#endif 221#endif
212 222
213{ 223{
214 if ( p->mToolBarHorF ) { 224 if ( p->mToolBarHorF ) {
215 if ( p->mToolBarUpF ) 225 if ( p->mToolBarUpF )
216 tbd = Bottom; 226 tbd = Qt::Bottom;
217 else 227 else
218 tbd = Top; 228 tbd = Qt::Top;
219 } 229 }
220 else { 230 else {
221 if ( p->mToolBarUpF ) 231 if ( p->mToolBarUpF )
222 tbd = Right; 232 tbd = Qt::Right;
223 else 233 else
224 tbd = Left; 234 tbd = Qt::Left;
225 } 235 }
226 filterToolBar = new QPEToolBar ( this ); 236 filterToolBar = new QPEToolBar ( this );
227 filterMenubar = new KMenuBar( 0 ); 237 filterMenubar = new KMenuBar( 0 );
228 QFontMetrics fm ( filterMenubar->font() ); 238 QFontMetrics fm ( filterMenubar->font() );
229#ifndef DESKTOP_VERSION 239#ifndef DESKTOP_VERSION
230 filterToolBar->setFocusPolicy( NoFocus ); 240 filterToolBar->setFocusPolicy( NoFocus );
231 filterMenubar->setFocusPolicy( NoFocus ); 241 filterMenubar->setFocusPolicy( NoFocus );
232#endif 242#endif
233 filterPopupMenu = new QPopupMenu( this ); 243 filterPopupMenu = new Q3PopupMenu( this );
234 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 244 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
235 QString addTest = "A"; 245 QString addTest = "A";
236 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 246 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
237#ifdef DESKTOP_VERSION 247#ifdef DESKTOP_VERSION
238 addTest = "AAAAAABBBCCCx"; 248 addTest = "AAAAAABBBCCCx";
239#else 249#else
240 addTest = "AAAAAx"; 250 addTest = "AAAAAx";
241#endif 251#endif
242 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 252 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
243 addToolBar (filterToolBar , tbd ); 253 addToolBar (filterToolBar , tbd );
244 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 254 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
245 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 255 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
246 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 256 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
247 filterToolBar->hide(); 257 filterToolBar->hide();
248 } else { 258 } else {
249 filterToolBar = 0; 259 filterToolBar = 0;
250 filterMenubar = 0; 260 filterMenubar = 0;
251 filterPopupMenu = 0; 261 filterPopupMenu = 0;
252 } 262 }
253 if ( p->mShowIconOnetoolbar ) { 263 if ( p->mShowIconOnetoolbar ) {
254 viewToolBar = iconToolBar ; 264 viewToolBar = iconToolBar ;
255 navigatorToolBar = iconToolBar ; 265 navigatorToolBar = iconToolBar ;
256 } else { 266 } else {
257#ifndef DESKTOP_VERSION 267#ifndef DESKTOP_VERSION
258 setToolBarsMovable( false ); 268 setToolBarsMovable( false );
259#endif 269#endif
260 if ( p->mToolBarHorV ) { 270 if ( p->mToolBarHorV ) {
261 if ( p->mToolBarUpV ) 271 if ( p->mToolBarUpV )
262 tbd = Bottom; 272 tbd = Qt::Bottom;
263 else 273 else
264 tbd = Top; 274 tbd = Qt::Top;
265 } 275 }
266 else { 276 else {
267 if ( p->mToolBarUpV ) 277 if ( p->mToolBarUpV )
268 tbd = Right; 278 tbd = Qt::Right;
269 else 279 else
270 tbd = Left; 280 tbd = Qt::Left;
271 } 281 }
272 viewToolBar = new QPEToolBar( this ); 282 viewToolBar = new QPEToolBar( this );
273 addToolBar (viewToolBar , tbd ); 283 addToolBar (viewToolBar , tbd );
274 if ( p->mToolBarHorN ) { 284 if ( p->mToolBarHorN ) {
275 if ( p->mToolBarUpN ) 285 if ( p->mToolBarUpN )
276 tbd = Bottom; 286 tbd = Qt::Bottom;
277 else 287 else
278 tbd = Top; 288 tbd = Qt::Top;
279 } 289 }
280 else { 290 else {
281 if ( p->mToolBarUpN ) 291 if ( p->mToolBarUpN )
282 tbd = Right; 292 tbd = Qt::Right;
283 else 293 else
284 tbd = Left; 294 tbd = Qt::Left;
285 } 295 }
286 navigatorToolBar = new QPEToolBar( this ); 296 navigatorToolBar = new QPEToolBar( this );
287 addToolBar (navigatorToolBar , tbd ); 297 addToolBar (navigatorToolBar , tbd );
288 } 298 }
289 299
290 300
291 301
292 mCalendarModifiedFlag = false; 302 mCalendarModifiedFlag = false;
293 // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 303 // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
294 //splash->setAlignment ( AlignCenter ); 304 //splash->setAlignment ( AlignCenter );
295 //setCentralWidget( splash ); 305 //setCentralWidget( splash );
296#ifndef DESKTOP_VERSION 306#ifndef DESKTOP_VERSION
297 //showMaximized(); 307 //showMaximized();
298#endif 308#endif
299 309
300 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 310 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
@@ -427,35 +437,35 @@ void MainWindow::loadDataAfterStart()
427 qDebug("KO: Start loading files..." ); 437 qDebug("KO: Start loading files..." );
428 QTime neededSaveTime = QDateTime::currentDateTime().time(); 438 QTime neededSaveTime = QDateTime::currentDateTime().time();
429 mView->loadCalendars(); 439 mView->loadCalendars();
430 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 440 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
431 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 441 qDebug("KO: Calendar loading time: %d ms",msNeeded );
432 //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 442 //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
433 mView->setModified( false ); 443 mView->setModified( false );
434 mBlockAtStartup = false; 444 mBlockAtStartup = false;
435 mView->setModified( false ); 445 mView->setModified( false );
436 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 446 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
437 processIncidenceSelection( 0 ); 447 processIncidenceSelection( 0 );
438 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 448 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
439 SLOT( processIncidenceSelection( Incidence * ) ) ); 449 SLOT( processIncidenceSelection( Incidence * ) ) );
440 connect( mView, SIGNAL( modifiedChanged( bool ) ), 450 connect( mView, SIGNAL( modifiedChanged( bool ) ),
441 SLOT( slotModifiedChanged( bool ) ) ); 451 SLOT( slotModifiedChanged( bool ) ) );
442#ifndef DESKTOP_VERSION 452#ifndef DESKTOP_VERSION
443 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 453 connect(qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const Q3CString &, const QByteArray & )));
444 connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); 454 connect( qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), this, SLOT(recieve( const Q3CString&, const QByteArray& )));
445 disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); 455 disconnect( qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), this, SLOT(receiveStart( const Q3CString&, const QByteArray& )));
446 if ( !mCStringMess.isEmpty() ) 456 if ( !mCStringMess.isEmpty() )
447 recieve( mCStringMess, mByteData ); 457 recieve( mCStringMess, mByteData );
448#endif 458#endif
449 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 459 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
450} 460}
451 461
452void MainWindow::slotResetFocus() 462void MainWindow::slotResetFocus()
453{ 463{
454 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); 464 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar);
455 mFocusLoop = 3; 465 mFocusLoop = 3;
456 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 466 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
457} 467}
458void MainWindow::slotResetFocusLoop() 468void MainWindow::slotResetFocusLoop()
459{ 469{
460 --mFocusLoop; 470 --mFocusLoop;
461 QWidget* fw = mView->viewManager()->currentView(); 471 QWidget* fw = mView->viewManager()->currentView();
@@ -496,33 +506,33 @@ bool MainWindow::beamReceiveEnabled()
496 506
497void MainWindow::toggleBeamReceive() 507void MainWindow::toggleBeamReceive()
498{ 508{
499 if ( mBRdisabled ) 509 if ( mBRdisabled )
500 return; 510 return;
501#ifndef DESKTOP_VERSION 511#ifndef DESKTOP_VERSION
502 if ( infrared ) { 512 if ( infrared ) {
503 qDebug("KO: Disable BeamReceive "); 513 qDebug("KO: Disable BeamReceive ");
504 delete infrared; 514 delete infrared;
505 infrared = 0; 515 infrared = 0;
506 brAction->setOn(false); 516 brAction->setOn(false);
507 return; 517 return;
508 } 518 }
509 qDebug("KO: Enable BeamReceive "); 519 qDebug("KO: Enable BeamReceive ");
510 brAction->setOn(true); 520 brAction->setOn(true);
511 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 521 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
512 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 522 QObject::connect( infrared, SIGNAL (received ( const Q3CString &, const QByteArray & )),this, SLOT(recieve( const Q3CString&, const QByteArray& )));
513#endif 523#endif
514} 524}
515void MainWindow::showMaximized () 525void MainWindow::showMaximized ()
516{ 526{
517#ifndef DESKTOP_VERSION 527#ifndef DESKTOP_VERSION
518 if ( ! globalFlagBlockStartup ) 528 if ( ! globalFlagBlockStartup )
519 if ( mClosed ) 529 if ( mClosed )
520 mView->goToday(); 530 mView->goToday();
521#endif 531#endif
522 QWidget::showMaximized () ; 532 QWidget::showMaximized () ;
523 mClosed = false; 533 mClosed = false;
524} 534}
525 535
526bool MainWindow::askForQuitOnSaveError() 536bool MainWindow::askForQuitOnSaveError()
527{ 537{
528 bool retval = false; 538 bool retval = false;
@@ -587,48 +597,48 @@ void MainWindow::closeEvent( QCloseEvent* ce )
587 } 597 }
588 } 598 }
589 mClosed = true; 599 mClosed = true;
590 ce->accept(); 600 ce->accept();
591 break; 601 break;
592 case 1: 602 case 1:
593 ce->ignore(); 603 ce->ignore();
594 break; 604 break;
595 case 2: 605 case 2:
596 606
597 default: 607 default:
598 break; 608 break;
599 } 609 }
600 610
601 611
602} 612}
603void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data ) 613void MainWindow::receiveStart( const Q3CString& cmsg, const QByteArray& data )
604{ 614{
605 qDebug("KO: QCOP start message received: %s ", cmsg.data() ); 615 qDebug("KO: QCOP start message received: %s ", cmsg.data() );
606 mCStringMess = cmsg; 616 mCStringMess = cmsg;
607 mByteData = data; 617 mByteData = data;
608} 618}
609void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 619void MainWindow::recieve( const Q3CString& cmsg, const QByteArray& data )
610{ 620{
611 QDataStream stream( data, IO_ReadOnly ); 621 QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly );
612 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 622 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
613 //QString datamess; 623 //QString datamess;
614 //qDebug("message "); 624 //qDebug("message ");
615 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 625 qDebug("KO: QCOP message received: %s ", cmsg.data() );
616 626
617 if ( cmsg == "setDocument(QString)" ) { 627 if ( cmsg == "setDocument(QString)" ) {
618 QDataStream stream( data, IO_ReadOnly ); 628 QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly );
619 QString fileName; 629 QString fileName;
620 stream >> fileName; 630 stream >> fileName;
621 //qDebug("filename %s ", fileName.latin1()); 631 //qDebug("filename %s ", fileName.latin1());
622 showMaximized(); 632 showMaximized();
623 raise(); 633 raise();
624 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 634 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
625 mSyncManager->slotSyncMenu( 1002 ); 635 mSyncManager->slotSyncMenu( 1002 );
626 return; 636 return;
627 } 637 }
628 638
629 if ( cmsg == "-writeFile" ) { 639 if ( cmsg == "-writeFile" ) {
630 // I made from the "-writeFile" an "-writeAlarm" 640 // I made from the "-writeFile" an "-writeAlarm"
631 mView->viewManager()->showWhatsNextView(); 641 mView->viewManager()->showWhatsNextView();
632 mCalendar->checkAlarmForIncidence( 0, true); 642 mCalendar->checkAlarmForIncidence( 0, true);
633 showMaximized(); 643 showMaximized();
634 raise(); 644 raise();
@@ -731,698 +741,698 @@ QPixmap MainWindow::loadPixmap( QString name )
731 return SmallIcon( name ); 741 return SmallIcon( name );
732 742
733} 743}
734void MainWindow::setUsesBigPixmaps ( bool b ) 744void MainWindow::setUsesBigPixmaps ( bool b )
735{ 745{
736 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 746 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
737 if ( b ) 747 if ( b )
738 qDebug("KO: BigPixmaps are not supported "); 748 qDebug("KO: BigPixmaps are not supported ");
739} 749}
740void MainWindow::initActions() 750void MainWindow::initActions()
741{ 751{
742 //KOPrefs::instance()->mShowFullMenu 752 //KOPrefs::instance()->mShowFullMenu
743 iconToolBar->clear(); 753 iconToolBar->clear();
744 KOPrefs *p = KOPrefs::instance(); 754 KOPrefs *p = KOPrefs::instance();
745 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 755 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
746 756
747 QPopupMenu *viewMenu = new QPopupMenu( this ); 757 Q3PopupMenu *viewMenu = new Q3PopupMenu( this );
748 QPopupMenu *actionMenu = new QPopupMenu( this ); 758 Q3PopupMenu *actionMenu = new Q3PopupMenu( this );
749 mCurrentItemMenu = new QPopupMenu ( this ); 759 mCurrentItemMenu = new Q3PopupMenu ( this );
750 QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); 760 Q3PopupMenu *nextConflictMenu = new Q3PopupMenu ( this );
751 QPopupMenu *importMenu = new QPopupMenu( this ); 761 Q3PopupMenu *importMenu = new Q3PopupMenu( this );
752 QPopupMenu *importMenu_X = new QPopupMenu( this ); 762 Q3PopupMenu *importMenu_X = new Q3PopupMenu( this );
753 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 763 Q3PopupMenu *exportMenu_X = new Q3PopupMenu( this );
754 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 764 Q3PopupMenu *beamMenu_X = new Q3PopupMenu( this );
755 selectFilterMenu = new QPopupMenu( this ); 765 selectFilterMenu = new Q3PopupMenu( this );
756 selectFilterMenu->setCheckable( true ); 766 selectFilterMenu->setCheckable( true );
757 syncMenu = new QPopupMenu( this ); 767 syncMenu = new Q3PopupMenu( this );
758 configureAgendaMenu = new QPopupMenu( this ); 768 configureAgendaMenu = new Q3PopupMenu( this );
759 configureToolBarMenu = new QPopupMenu( this ); 769 configureToolBarMenu = new Q3PopupMenu( this );
760 QPopupMenu *helpMenu = new QPopupMenu( this ); 770 Q3PopupMenu *helpMenu = new Q3PopupMenu( this );
761 QIconSet icon; 771 QIcon icon;
762 int pixWid = 22, pixHei = 22; 772 int pixWid = 22, pixHei = 22;
763 QString pathString = ""; 773 QString pathString = "";
764 if ( !p->mToolBarMiniIcons ) { 774 if ( !p->mToolBarMiniIcons ) {
765 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 775 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
766 pathString += "icons16/"; 776 pathString += "icons16/";
767 pixWid = 18; pixHei = 16; 777 pixWid = 18; pixHei = 16;
768 } 778 }
769 } else { 779 } else {
770 pathString += "iconsmini/"; 780 pathString += "iconsmini/";
771 pixWid = 18; pixHei = 16; 781 pixWid = 18; pixHei = 16;
772 } 782 }
773 783
774 if ( KOPrefs::instance()->mShowFullMenu ) { 784 if ( KOPrefs::instance()->mShowFullMenu ) {
775 menuBar1 = new KMenuBar( this );//menuBar(); 785 menuBar1 = new KMenuBar( this );//menuBar();
776 //setMenuBar( menuBar1 ); 786 //setMenuBar( menuBar1 );
777 menuBar1->show(); 787 menuBar1->show();
778 menuBar1->insertItem( i18n("File"), importMenu ); 788 menuBar1->insertItem( i18n("File"), importMenu );
779 menuBar1->insertItem( i18n("View"), viewMenu ); 789 menuBar1->insertItem( i18n("View"), viewMenu );
780 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); 790 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu );
781 menuBar1->insertItem( i18n("Action"), actionMenu ); 791 menuBar1->insertItem( i18n("Action"), actionMenu );
782#ifdef DESKTOP_VERSION 792#ifdef DESKTOP_VERSION
783 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 793 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
784 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 794 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
785#else 795#else
786 menuBar1->insertItem( i18n("Sync"), syncMenu ); 796 menuBar1->insertItem( i18n("Sync"), syncMenu );
787 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 797 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
788#endif 798#endif
789 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 799 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
790 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 800 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
791 menuBar1->insertItem( i18n("Help"), helpMenu ); 801 menuBar1->insertItem( i18n("Help"), helpMenu );
792 } else { 802 } else {
793 menuBar1 = new KMenuBar( iconToolBar ); 803 menuBar1 = new KMenuBar( iconToolBar );
794 QPopupMenu *menuBar = new QPopupMenu( this ); 804 Q3PopupMenu *menuBar = new Q3PopupMenu( this );
795 icon = loadPixmap( pathString + "z_menu" ); 805 icon = loadPixmap( pathString + "z_menu" );
796 menuBar1->insertItem( icon.pixmap(), menuBar); 806 menuBar1->insertItem( icon.pixmap(), menuBar);
797 //menuBar1->insertItem( i18n("ME"), menuBar); 807 //menuBar1->insertItem( i18n("ME"), menuBar);
798 menuBar->insertItem( i18n("File"), importMenu ); 808 menuBar->insertItem( i18n("File"), importMenu );
799 menuBar->insertItem( i18n("View"), viewMenu ); 809 menuBar->insertItem( i18n("View"), viewMenu );
800 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); 810 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu );
801 menuBar->insertItem( i18n("Action"), actionMenu ); 811 menuBar->insertItem( i18n("Action"), actionMenu );
802 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 812 menuBar->insertItem( i18n("Synchronize"), syncMenu );
803 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 813 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
804 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 814 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
805 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 815 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
806 menuBar->insertItem( i18n("Help"), helpMenu ); 816 menuBar->insertItem( i18n("Help"), helpMenu );
807 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 817 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
808 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 818 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
809 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); 819 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) );
810 } 820 }
811 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); 821 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
812 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); 822 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
813 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 823 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
814 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 824 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
815 825
816 826
817 mWeekBgColor = iconToolBar->backgroundColor(); 827 mWeekBgColor = iconToolBar->backgroundColor();
818 mWeekPixmap.resize( pixWid , pixHei ); 828 mWeekPixmap.resize( pixWid , pixHei );
819 mWeekPixmap.fill( mWeekBgColor ); 829 mWeekPixmap.fill( mWeekBgColor );
820 icon = mWeekPixmap; 830 icon = mWeekPixmap;
821 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 831 mWeekAction = new Q3Action( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
822 if ( p-> mShowIconWeekNum ) 832 if ( p-> mShowIconWeekNum )
823 mWeekAction->addTo( iconToolBar ); 833 mWeekAction->addTo( iconToolBar );
824 mWeekFont = font(); 834 mWeekFont = font();
825 835
826 int fontPoint = mWeekFont.pointSize(); 836 int fontPoint = mWeekFont.pointSize();
827 QFontMetrics f( mWeekFont ); 837 QFontMetrics f( mWeekFont );
828 int fontWid = f.width( "30" ); 838 int fontWid = f.width( "30" );
829 while ( fontWid > pixWid ) { 839 while ( fontWid > pixWid ) {
830 --fontPoint; 840 --fontPoint;
831 mWeekFont.setPointSize( fontPoint ); 841 mWeekFont.setPointSize( fontPoint );
832 QFontMetrics f( mWeekFont ); 842 QFontMetrics f( mWeekFont );
833 fontWid = f.width( "30" ); 843 fontWid = f.width( "30" );
834 //qDebug("dec-- "); 844 //qDebug("dec-- ");
835 } 845 }
836 846
837 connect( mWeekAction, SIGNAL( activated() ), 847 connect( mWeekAction, SIGNAL( activated() ),
838 this, SLOT( weekAction() ) ); 848 this, SLOT( weekAction() ) );
839 849
840 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 850 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
841 if ( p->mShowIconFilterview ) { 851 if ( p->mShowIconFilterview ) {
842 icon = loadPixmap( pathString + "filter" ); 852 icon = loadPixmap( pathString + "filter" );
843 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 853 actionFilterMenuTB = new Q3Action( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
844 connect( actionFilterMenuTB, SIGNAL( activated() ), 854 connect( actionFilterMenuTB, SIGNAL( activated() ),
845 this, SLOT( fillFilterMenuTB() ) ); 855 this, SLOT( fillFilterMenuTB() ) );
846 actionFilterMenuTB->addTo( iconToolBar ); 856 actionFilterMenuTB->addTo( iconToolBar );
847 selectFilterMenuTB = new QPopupMenu( this ); 857 selectFilterMenuTB = new Q3PopupMenu( this );
848 selectFilterMenuTB->setCheckable( true ); 858 selectFilterMenuTB->setCheckable( true );
849 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 859 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
850 } 860 }
851 861
852 //#endif 862 //#endif
853 // ****************** 863 // ******************
854 QAction *action; 864 Q3Action *action;
855 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 865 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
856 configureToolBarMenu->setCheckable( true ); 866 configureToolBarMenu->setCheckable( true );
857 867
858 868
859 configureAgendaMenu->setCheckable( true ); 869 configureAgendaMenu->setCheckable( true );
860 int iii ; 870 int iii ;
861 for ( iii = 1;iii<= 10 ;++iii ){ 871 for ( iii = 1;iii<= 10 ;++iii ){
862 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 872 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
863 } 873 }
864 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 874 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
865 875
866 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 876 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
867 this, SLOT( showConfigureAgenda( ) ) ); 877 this, SLOT( showConfigureAgenda( ) ) );
868 icon = loadPixmap( pathString + "today" ); 878 icon = loadPixmap( pathString + "today" );
869 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 879 Q3Action* today_action = new Q3Action( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
870 today_action->addTo( actionMenu ); 880 today_action->addTo( actionMenu );
871 connect( today_action, SIGNAL( activated() ), 881 connect( today_action, SIGNAL( activated() ),
872 mView, SLOT( goToday() ) ); 882 mView, SLOT( goToday() ) );
873 883
874 icon = loadPixmap( pathString + "picker" ); 884 icon = loadPixmap( pathString + "picker" );
875 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); 885 Q3Action* dPickerAction = new Q3Action( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this );
876 dPickerAction->addTo( actionMenu ); 886 dPickerAction->addTo( actionMenu );
877 connect( dPickerAction, SIGNAL( activated() ), 887 connect( dPickerAction, SIGNAL( activated() ),
878 mView, SLOT( showDatePicker() ) ); 888 mView, SLOT( showDatePicker() ) );
879 889
880 icon = loadPixmap( pathString + "search" ); 890 icon = loadPixmap( pathString + "search" );
881 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 891 Q3Action* search_action = new Q3Action( i18n("Search"), icon, i18n("Search..."), 0, this );
882 search_action->addTo( actionMenu ); 892 search_action->addTo( actionMenu );
883 connect( search_action, SIGNAL( activated() ), 893 connect( search_action, SIGNAL( activated() ),
884 mView->dialogManager(), SLOT( showSearchDialog() ) ); 894 mView->dialogManager(), SLOT( showSearchDialog() ) );
885 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); 895 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu );
886 896
887 action = new QAction( "Undo Delete", i18n("All events"), 0, this ); 897 action = new Q3Action( "Undo Delete", i18n("All events"), 0, this );
888 action->addTo( nextConflictMenu ); 898 action->addTo( nextConflictMenu );
889 connect( action, SIGNAL( activated() ), 899 connect( action, SIGNAL( activated() ),
890 mView, SLOT( conflictAll() ) ); 900 mView, SLOT( conflictAll() ) );
891 901
892 action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); 902 action = new Q3Action( "Undo Delete", i18n("Allday events"), 0, this );
893 action->addTo( nextConflictMenu ); 903 action->addTo( nextConflictMenu );
894 connect( action, SIGNAL( activated() ), 904 connect( action, SIGNAL( activated() ),
895 mView, SLOT( conflictAllday() ) ); 905 mView, SLOT( conflictAllday() ) );
896 906
897 action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); 907 action = new Q3Action( "Undo Delete", i18n("Events with time"), 0, this );
898 action->addTo( nextConflictMenu ); 908 action->addTo( nextConflictMenu );
899 connect( action, SIGNAL( activated() ), 909 connect( action, SIGNAL( activated() ),
900 mView, SLOT( conflictNotAll() ) ); 910 mView, SLOT( conflictNotAll() ) );
901 911
902 actionMenu->insertSeparator(); 912 actionMenu->insertSeparator();
903 913
904 icon = loadPixmap( pathString + "newevent" ); 914 icon = loadPixmap( pathString + "newevent" );
905 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 915 Q3Action* ne_action = new Q3Action( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
906 ne_action->addTo( mCurrentItemMenu ); 916 ne_action->addTo( mCurrentItemMenu );
907 connect( ne_action, SIGNAL( activated() ), 917 connect( ne_action, SIGNAL( activated() ),
908 mView, SLOT( newEvent() ) ); 918 mView, SLOT( newEvent() ) );
909 icon = loadPixmap( pathString + "newtodo" ); 919 icon = loadPixmap( pathString + "newtodo" );
910 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 920 Q3Action* nt_action = new Q3Action( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
911 nt_action->addTo( mCurrentItemMenu ); 921 nt_action->addTo( mCurrentItemMenu );
912 connect( nt_action, SIGNAL( activated() ), 922 connect( nt_action, SIGNAL( activated() ),
913 mView, SLOT( newTodo() ) ); 923 mView, SLOT( newTodo() ) );
914 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 924 mNewSubTodoAction = new Q3Action( "new_subtodo", i18n("New Sub-Todo..."), 0,
915 this ); 925 this );
916 mNewSubTodoAction->addTo( mCurrentItemMenu ); 926 mNewSubTodoAction->addTo( mCurrentItemMenu );
917 connect( mNewSubTodoAction, SIGNAL( activated() ), 927 connect( mNewSubTodoAction, SIGNAL( activated() ),
918 mView, SLOT( newSubTodo() ) ); 928 mView, SLOT( newSubTodo() ) );
919 929
920 mCurrentItemMenu->insertSeparator(); 930 mCurrentItemMenu->insertSeparator();
921 icon = loadPixmap( pathString + "newevent" ); 931 icon = loadPixmap( pathString + "newevent" );
922 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 932 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
923 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 933 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
924 configureToolBarMenu->insertSeparator(); 934 configureToolBarMenu->insertSeparator();
925 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 935 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
926 configureToolBarMenu->insertSeparator(); 936 configureToolBarMenu->insertSeparator();
927 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 937 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
928 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 938 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
929 icon = loadPixmap( pathString + "newtodo" ); 939 icon = loadPixmap( pathString + "newtodo" );
930 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 940 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
931 941
932 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); 942 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu);
933 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); 943 mShowAction = new Q3Action( "show_incidence", i18n("Show"), 0, this );
934 mShowAction->addTo( mCurrentItemMenu ); 944 mShowAction->addTo( mCurrentItemMenu );
935 connect( mShowAction, SIGNAL( activated() ), 945 connect( mShowAction, SIGNAL( activated() ),
936 mView, SLOT( showIncidence() ) ); 946 mView, SLOT( showIncidence() ) );
937 947
938 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 948 mEditAction = new Q3Action( "edit_incidence", i18n("Edit..."), 0, this );
939 mEditAction->addTo( mCurrentItemMenu ); 949 mEditAction->addTo( mCurrentItemMenu );
940 connect( mEditAction, SIGNAL( activated() ), 950 connect( mEditAction, SIGNAL( activated() ),
941 mView, SLOT( editIncidence() ) ); 951 mView, SLOT( editIncidence() ) );
942 952
943 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 953 mDeleteAction = new Q3Action( "delete_incidence", i18n("Delete..."), 0, this );
944 mDeleteAction->addTo( mCurrentItemMenu ); 954 mDeleteAction->addTo( mCurrentItemMenu );
945 connect( mDeleteAction, SIGNAL( activated() ), 955 connect( mDeleteAction, SIGNAL( activated() ),
946 mView, SLOT( deleteIncidence() ) ); 956 mView, SLOT( deleteIncidence() ) );
947 957
948 958
949 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 959 mCloneAction = new Q3Action( "clone_incidence", i18n("Clone..."), 0, this );
950 mCloneAction->addTo( mCurrentItemMenu ); 960 mCloneAction->addTo( mCurrentItemMenu );
951 connect( mCloneAction, SIGNAL( activated() ), 961 connect( mCloneAction, SIGNAL( activated() ),
952 mView, SLOT( cloneIncidence() ) ); 962 mView, SLOT( cloneIncidence() ) );
953 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 963 mMoveAction = new Q3Action( "Move_incidence", i18n("Move..."), 0, this );
954 mMoveAction->addTo( mCurrentItemMenu ); 964 mMoveAction->addTo( mCurrentItemMenu );
955 connect( mMoveAction, SIGNAL( activated() ), 965 connect( mMoveAction, SIGNAL( activated() ),
956 mView, SLOT( moveIncidence() ) ); 966 mView, SLOT( moveIncidence() ) );
957#ifndef DESKTOP_VERSION 967#ifndef DESKTOP_VERSION
958 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 968 mBeamAction = new Q3Action( "Beam_incidence", i18n("Beam..."), 0, this );
959 mBeamAction->addTo(mCurrentItemMenu ); 969 mBeamAction->addTo(mCurrentItemMenu );
960 connect( mBeamAction, SIGNAL( activated() ), 970 connect( mBeamAction, SIGNAL( activated() ),
961 mView, SLOT( beamIncidence() ) ); 971 mView, SLOT( beamIncidence() ) );
962#endif 972#endif
963 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 973 mCancelAction = new Q3Action( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
964 mCancelAction->addTo( mCurrentItemMenu ); 974 mCancelAction->addTo( mCurrentItemMenu );
965 connect( mCancelAction, SIGNAL( activated() ), 975 connect( mCancelAction, SIGNAL( activated() ),
966 mView, SLOT( toggleCancelIncidence() ) ); 976 mView, SLOT( toggleCancelIncidence() ) );
967 977
968 978
969 mCurrentItemMenu->insertSeparator(); 979 mCurrentItemMenu->insertSeparator();
970 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 980 action = new Q3Action( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
971 action->addTo( mCurrentItemMenu ); 981 action->addTo( mCurrentItemMenu );
972 connect( action, SIGNAL( activated() ), 982 connect( action, SIGNAL( activated() ),
973 mView, SLOT( undo_delete() ) ); 983 mView, SLOT( undo_delete() ) );
974 984
975 // *********************** 985 // ***********************
976 if ( KOPrefs::instance()->mVerticalScreen ) { 986 if ( KOPrefs::instance()->mVerticalScreen ) {
977 icon = SmallIcon( "1updownarrow" ); 987 icon = SmallIcon( "1updownarrow" );
978 } else { 988 } else {
979 icon = SmallIcon("1leftrightarrow" ); 989 icon = SmallIcon("1leftrightarrow" );
980 } 990 }
981 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 991 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
982 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 992 Q3Action* FSaction = new Q3Action( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
983 FSaction->addTo( viewMenu ); 993 FSaction->addTo( viewMenu );
984 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 994 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
985 995
986 996
987 icon = loadPixmap( pathString + "filter" ); 997 icon = loadPixmap( pathString + "filter" );
988 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 998 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
989 icon = loadPixmap( pathString + "configure" ); 999 icon = loadPixmap( pathString + "configure" );
990 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); 1000 action = new Q3Action( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
991 action->addTo( viewMenu ); 1001 action->addTo( viewMenu );
992 connect( action, SIGNAL( activated() ), 1002 connect( action, SIGNAL( activated() ),
993 mView, SLOT( toggleFilter() ) ); 1003 mView, SLOT( toggleFilter() ) );
994 mToggleFilter = action; 1004 mToggleFilter = action;
995 icon = loadPixmap( pathString + "navi" ); 1005 icon = loadPixmap( pathString + "navi" );
996 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 1006 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
997 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 1007 action = new Q3Action( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
998 action->addTo( viewMenu ); 1008 action->addTo( viewMenu );
999 connect( action, SIGNAL( activated() ), 1009 connect( action, SIGNAL( activated() ),
1000 mView, SLOT( toggleDateNavigatorWidget() ) ); 1010 mView, SLOT( toggleDateNavigatorWidget() ) );
1001 mToggleNav = action ; 1011 mToggleNav = action ;
1002 icon = loadPixmap( pathString + "allday" ); 1012 icon = loadPixmap( pathString + "allday" );
1003 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 1013 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
1004 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 1014 action = new Q3Action( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
1005 action->addTo( viewMenu ); 1015 action->addTo( viewMenu );
1006 connect( action, SIGNAL( activated() ), 1016 connect( action, SIGNAL( activated() ),
1007 mView, SLOT( toggleAllDaySize() ) ); 1017 mView, SLOT( toggleAllDaySize() ) );
1008 mToggleAllday = action; 1018 mToggleAllday = action;
1009 1019
1010 1020
1011 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 1021 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
1012 mToggleNav, SLOT( setEnabled ( bool ) ) ); 1022 mToggleNav, SLOT( setEnabled ( bool ) ) );
1013 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 1023 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
1014 // mToggleFilter, SLOT( setEnabled ( bool ) ) ); 1024 // mToggleFilter, SLOT( setEnabled ( bool ) ) );
1015 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 1025 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
1016 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 1026 mToggleAllday, SLOT( setEnabled ( bool ) ) );
1017 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 1027 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
1018 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); 1028 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
1019 1029
1020 1030
1021 dPickerAction->addTo( iconToolBar ); 1031 dPickerAction->addTo( iconToolBar );
1022 viewMenu->insertSeparator(); 1032 viewMenu->insertSeparator();
1023 1033
1024 if ( p-> mShowIconToggleFull ) 1034 if ( p-> mShowIconToggleFull )
1025 FSaction->addTo( iconToolBar ); 1035 FSaction->addTo( iconToolBar );
1026 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 1036 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
1027 1037
1028 //******************** 1038 //********************
1029 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 1039 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
1030 1040
1031 1041
1032 icon = loadPixmap( pathString + "whatsnext" ); 1042 icon = loadPixmap( pathString + "whatsnext" );
1033 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 1043 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
1034 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 1044 Q3Action* whatsnext_action = new Q3Action( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
1035 whatsnext_action->addTo( viewMenu ); 1045 whatsnext_action->addTo( viewMenu );
1036 connect( whatsnext_action, SIGNAL( activated() ), 1046 connect( whatsnext_action, SIGNAL( activated() ),
1037 mView->viewManager(), SLOT( showWhatsNextView() ) ); 1047 mView->viewManager(), SLOT( showWhatsNextView() ) );
1038 1048
1039 icon = loadPixmap( pathString + "xdays" ); 1049 icon = loadPixmap( pathString + "xdays" );
1040 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 1050 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
1041 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 1051 Q3Action* xdays_action = new Q3Action( i18n("Next days"), icon, i18n("Next days"), 0, this );
1042 xdays_action->addTo( viewMenu ); 1052 xdays_action->addTo( viewMenu );
1043 connect( xdays_action, SIGNAL( activated() ), 1053 connect( xdays_action, SIGNAL( activated() ),
1044 mView->viewManager(), SLOT( showNextXView() ) ); 1054 mView->viewManager(), SLOT( showNextXView() ) );
1045 1055
1046 1056
1047 icon = loadPixmap( pathString + "journal" ); 1057 icon = loadPixmap( pathString + "journal" );
1048 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 1058 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
1049 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 1059 Q3Action* viewjournal_action = new Q3Action( i18n("Journal"), icon, i18n("Journal"), 0, this );
1050 viewjournal_action->addTo( viewMenu ); 1060 viewjournal_action->addTo( viewMenu );
1051 connect( viewjournal_action, SIGNAL( activated() ), 1061 connect( viewjournal_action, SIGNAL( activated() ),
1052 mView->viewManager(), SLOT( showJournalView() ) ); 1062 mView->viewManager(), SLOT( showJournalView() ) );
1053 1063
1054 1064
1055 icon = loadPixmap( pathString + "day" ); 1065 icon = loadPixmap( pathString + "day" );
1056 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 1066 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
1057 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 1067 Q3Action* day1_action = new Q3Action( i18n("Day View"), icon, i18n("Day View"), 0, this );
1058 day1_action->addTo( viewMenu ); 1068 day1_action->addTo( viewMenu );
1059 // action->addTo( toolBar ); 1069 // action->addTo( toolBar );
1060 connect( day1_action, SIGNAL( activated() ), 1070 connect( day1_action, SIGNAL( activated() ),
1061 mView->viewManager(), SLOT( showDayView() ) ); 1071 mView->viewManager(), SLOT( showDayView() ) );
1062 1072
1063 icon = loadPixmap( pathString + "workweek" ); 1073 icon = loadPixmap( pathString + "workweek" );
1064 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 1074 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
1065 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 1075 Q3Action* day5_action = new Q3Action( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
1066 day5_action->addTo( viewMenu ); 1076 day5_action->addTo( viewMenu );
1067 connect( day5_action, SIGNAL( activated() ), 1077 connect( day5_action, SIGNAL( activated() ),
1068 mView->viewManager(), SLOT( showWorkWeekView() ) ); 1078 mView->viewManager(), SLOT( showWorkWeekView() ) );
1069 1079
1070 icon = loadPixmap( pathString + "week" ); 1080 icon = loadPixmap( pathString + "week" );
1071 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 1081 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
1072 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 1082 Q3Action* day7_action = new Q3Action( i18n("Week"), icon, i18n("Week"), 0, this );
1073 day7_action->addTo( viewMenu ); 1083 day7_action->addTo( viewMenu );
1074 connect( day7_action, SIGNAL( activated() ), 1084 connect( day7_action, SIGNAL( activated() ),
1075 mView->viewManager(), SLOT( showWeekView() ) ); 1085 mView->viewManager(), SLOT( showWeekView() ) );
1076 1086
1077 icon = loadPixmap( pathString + "workweek2" ); 1087 icon = loadPixmap( pathString + "workweek2" );
1078 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 1088 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
1079 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 1089 Q3Action* day6_action = new Q3Action( i18n("List week"), icon, i18n("List week"), 0, this );
1080 day6_action->addTo( viewMenu ); 1090 day6_action->addTo( viewMenu );
1081 connect( day6_action, SIGNAL( activated() ), 1091 connect( day6_action, SIGNAL( activated() ),
1082 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 1092 mView->viewManager(), SLOT( showMonthViewWeek() ) );
1083 1093
1084 icon = loadPixmap( pathString + "month" ); 1094 icon = loadPixmap( pathString + "month" );
1085 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 1095 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
1086 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 1096 Q3Action* month_action = new Q3Action( i18n("Month"), icon, i18n("Month"), 0, this );
1087 month_action->addTo( viewMenu ); 1097 month_action->addTo( viewMenu );
1088 connect( month_action, SIGNAL( activated() ), 1098 connect( month_action, SIGNAL( activated() ),
1089 mView->viewManager(), SLOT( showMonthView() ) ); 1099 mView->viewManager(), SLOT( showMonthView() ) );
1090 1100
1091 icon = loadPixmap( pathString + "list" ); 1101 icon = loadPixmap( pathString + "list" );
1092 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 1102 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
1093 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 1103 Q3Action* showlist_action = new Q3Action( i18n("List View"), icon, i18n("List View"), 0, this );
1094 showlist_action->addTo( viewMenu ); 1104 showlist_action->addTo( viewMenu );
1095 connect( showlist_action, SIGNAL( activated() ), 1105 connect( showlist_action, SIGNAL( activated() ),
1096 mView->viewManager(), SLOT( showListView() ) ); 1106 mView->viewManager(), SLOT( showListView() ) );
1097 1107
1098 icon = loadPixmap( pathString + "todo" ); 1108 icon = loadPixmap( pathString + "todo" );
1099 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 1109 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
1100 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 1110 Q3Action* todoview_action = new Q3Action( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
1101 todoview_action->addTo( viewMenu ); 1111 todoview_action->addTo( viewMenu );
1102 connect( todoview_action, SIGNAL( activated() ), 1112 connect( todoview_action, SIGNAL( activated() ),
1103 mView->viewManager(), SLOT( showTodoView() ) ); 1113 mView->viewManager(), SLOT( showTodoView() ) );
1104 1114
1105 1115
1106 1116
1107#if 0 1117#if 0
1108 action = new QAction( "view_timespan", "Time Span", 0, this ); 1118 action = new Q3Action( "view_timespan", "Time Span", 0, this );
1109 action->addTo( viewMenu ); 1119 action->addTo( viewMenu );
1110 connect( action, SIGNAL( activated() ), 1120 connect( action, SIGNAL( activated() ),
1111 mView->viewManager(), SLOT( showTimeSpanView() ) ); 1121 mView->viewManager(), SLOT( showTimeSpanView() ) );
1112#endif 1122#endif
1113 1123
1114 1124
1115 1125
1116 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, 1126 action = new Q3Action( "purge_completed", i18n("Purge Completed..."), 0,
1117 this ); 1127 this );
1118 action->addTo( actionMenu ); 1128 action->addTo( actionMenu );
1119 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 1129 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
1120 1130
1121 1131
1122 icon = loadPixmap( pathString + "search" ); 1132 icon = loadPixmap( pathString + "search" );
1123 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 1133 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
1124 1134
1125 1135
1126 1136
1127 actionMenu->insertSeparator(); 1137 actionMenu->insertSeparator();
1128 action = new QAction( "manage cat", i18n("Edit category list..."), 0, 1138 action = new Q3Action( "manage cat", i18n("Edit category list..."), 0,
1129 this ); 1139 this );
1130 action->addTo( actionMenu ); 1140 action->addTo( actionMenu );
1131 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); 1141 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) );
1132 1142
1133 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1143 action = new Q3Action( "manage cat", i18n("Manage new categories..."), 0,
1134 this ); 1144 this );
1135 action->addTo( actionMenu ); 1145 action->addTo( actionMenu );
1136 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1146 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1137 1147
1138 1148
1139 actionMenu->insertSeparator(); 1149 actionMenu->insertSeparator();
1140 icon = loadPixmap( pathString + "configure" ); 1150 icon = loadPixmap( pathString + "configure" );
1141 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); 1151 action = new Q3Action( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
1142 action->addTo( actionMenu ); 1152 action->addTo( actionMenu );
1143 connect( action, SIGNAL( activated() ), 1153 connect( action, SIGNAL( activated() ),
1144 mView, SLOT( edit_options() ) ); 1154 mView, SLOT( edit_options() ) );
1145 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); 1155 action = new Q3Action( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this );
1146 action->addTo( actionMenu ); 1156 action->addTo( actionMenu );
1147 connect( action, SIGNAL( activated() ), 1157 connect( action, SIGNAL( activated() ),
1148 this, SLOT( calHint() ) ); 1158 this, SLOT( calHint() ) );
1149 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 1159 action = new Q3Action( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
1150 action->addTo( actionMenu ); 1160 action->addTo( actionMenu );
1151 connect( action, SIGNAL( activated() ), 1161 connect( action, SIGNAL( activated() ),
1152 mView, SLOT( edit_global_options() ) ); 1162 mView, SLOT( edit_global_options() ) );
1153 if ( KOPrefs::instance()->mShowFullMenu ) { 1163 if ( KOPrefs::instance()->mShowFullMenu ) {
1154 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 1164 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
1155 1165
1156 } 1166 }
1157 // actionMenu->insertSeparator(); 1167 // actionMenu->insertSeparator();
1158 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 1168 action = new Q3Action( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
1159 this ); 1169 this );
1160 action->addTo( importMenu_X ); 1170 action->addTo( importMenu_X );
1161 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 1171 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
1162 action = new QAction( "import_quick", i18n("Import last file"), 0, 1172 action = new Q3Action( "import_quick", i18n("Import last file"), 0,
1163 this ); 1173 this );
1164 action->addTo( importMenu_X ); 1174 action->addTo( importMenu_X );
1165 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 1175 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
1166 importMenu_X->insertSeparator(); 1176 importMenu_X->insertSeparator();
1167 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 1177 action = new Q3Action( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
1168 this ); 1178 this );
1169 action->addTo( importMenu_X ); 1179 action->addTo( importMenu_X );
1170 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 1180 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
1171 //#ifndef DESKTOP_VERSION 1181 //#ifndef DESKTOP_VERSION
1172 importMenu_X->insertSeparator(); 1182 importMenu_X->insertSeparator();
1173 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 1183 action = new Q3Action( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
1174 this ); 1184 this );
1175 action->addTo( importMenu_X ); 1185 action->addTo( importMenu_X );
1176 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 1186 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
1177 //#else 1187 //#else
1178#ifdef _OL_IMPORT_ 1188#ifdef _OL_IMPORT_
1179 importMenu_X->insertSeparator(); 1189 importMenu_X->insertSeparator();
1180 action = new QAction( "import_ol", i18n("Import from OL"), 0, 1190 action = new Q3Action( "import_ol", i18n("Import from OL"), 0,
1181 this ); 1191 this );
1182 action->addTo( importMenu_X ); 1192 action->addTo( importMenu_X );
1183 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 1193 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
1184#endif 1194#endif
1185 //#endif 1195 //#endif
1186 1196
1187 //importMenu->insertSeparator(); 1197 //importMenu->insertSeparator();
1188#if 0 1198#if 0
1189 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 1199 action = new Q3Action( "load_cal", i18n("Load Calendar Backup"), 0,
1190 this ); 1200 this );
1191 action->addTo( importMenu ); 1201 action->addTo( importMenu );
1192 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1202 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
1193#endif 1203#endif
1194 action = new QAction( "save_cal", i18n("Save Backup..."), 0, 1204 action = new Q3Action( "save_cal", i18n("Save Backup..."), 0,
1195 this ); 1205 this );
1196 action->addTo( importMenu ); 1206 action->addTo( importMenu );
1197 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 1207 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
1198 importMenu->insertSeparator(); 1208 importMenu->insertSeparator();
1199 importMenu->insertItem( i18n("Import"), importMenu_X ); 1209 importMenu->insertItem( i18n("Import"), importMenu_X );
1200 //importMenu->insertSeparator(); 1210 //importMenu->insertSeparator();
1201 action = new QAction( "export ical", i18n("Export All Data"), 0, 1211 action = new Q3Action( "export ical", i18n("Export All Data"), 0,
1202 this ); 1212 this );
1203 action->addTo( exportMenu_X ); 1213 action->addTo( exportMenu_X );
1204 connect( action, SIGNAL( activated() ), SLOT( exportICalendar() ) ); 1214 connect( action, SIGNAL( activated() ), SLOT( exportICalendar() ) );
1205 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 1215 action = new Q3Action( "import_qtopia", i18n("Export VCalendar"), 0,
1206 this ); 1216 this );
1207 action->addTo( exportMenu_X ); 1217 action->addTo( exportMenu_X );
1208 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1218 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1209 1219
1210 1220
1211 //LR 1221 //LR
1212 QPopupMenu *ex2phone = new QPopupMenu( this ); 1222 Q3PopupMenu *ex2phone = new Q3PopupMenu( this );
1213 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1223 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1214 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1224 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1215 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1225 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1216 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1226 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1217 1227
1218 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1228 importMenu->insertItem( i18n("Export"), exportMenu_X );
1219 mPrintSelAction = 0; 1229 mPrintSelAction = 0;
1220#ifndef DESKTOP_VERSION 1230#ifndef DESKTOP_VERSION
1221 //importMenu->insertSeparator(); 1231 //importMenu->insertSeparator();
1222 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1232 brAction = new Q3Action( "beam toggle", i18n("Beam receive enabled"), 0,
1223 this ); 1233 this );
1224 brAction->addTo( beamMenu_X ); 1234 brAction->addTo( beamMenu_X );
1225 brAction->setToggleAction (true ) ; 1235 brAction->setToggleAction (true ) ;
1226 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1236 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1227 1237
1228 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1238 action = new Q3Action( "beam all", i18n("Beam complete calendar..."), 0,
1229 this ); 1239 this );
1230 action->addTo( beamMenu_X ); 1240 action->addTo( beamMenu_X );
1231 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1241 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1232 1242
1233 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1243 action = new Q3Action( "beam all", i18n("Beam filtered calendar..."), 0,
1234 this ); 1244 this );
1235 action->addTo( beamMenu_X ); 1245 action->addTo( beamMenu_X );
1236 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1246 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1237 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1247 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1238#else 1248#else
1239 //importMenu->insertSeparator(); 1249 //importMenu->insertSeparator();
1240 icon = loadPixmap( pathString + "print" ); 1250 icon = loadPixmap( pathString + "print" );
1241 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1251 action = new Q3Action( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1242 action->addTo( beamMenu_X ); 1252 action->addTo( beamMenu_X );
1243 connect( action, SIGNAL( activated() ), 1253 connect( action, SIGNAL( activated() ),
1244 this, SLOT( printCal() ) ); 1254 this, SLOT( printCal() ) );
1245 1255
1246 icon = loadPixmap( pathString + "week" ); 1256 icon = loadPixmap( pathString + "week" );
1247 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1257 action = new Q3Action( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1248 action->addTo( beamMenu_X ); 1258 action->addTo( beamMenu_X );
1249 connect( action, SIGNAL( activated() ), 1259 connect( action, SIGNAL( activated() ),
1250 this, SLOT( printSel() ) ); 1260 this, SLOT( printSel() ) );
1251 icon = loadPixmap( pathString + "whatsnext" ); 1261 icon = loadPixmap( pathString + "whatsnext" );
1252 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1262 action = new Q3Action( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1253 action->addTo( beamMenu_X ); 1263 action->addTo( beamMenu_X );
1254 connect( action, SIGNAL( activated() ), 1264 connect( action, SIGNAL( activated() ),
1255 mView->viewManager(), SLOT( slotprintWNV() ) ); 1265 mView->viewManager(), SLOT( slotprintWNV() ) );
1256 1266
1257 1267
1258 icon = loadPixmap( pathString + "list" ); 1268 icon = loadPixmap( pathString + "list" );
1259 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); 1269 action = new Q3Action( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this );
1260 action->addTo( beamMenu_X ); 1270 action->addTo( beamMenu_X );
1261 connect( action, SIGNAL( activated() ), 1271 connect( action, SIGNAL( activated() ),
1262 this, SLOT( printListView() ) ); 1272 this, SLOT( printListView() ) );
1263 1273
1264 icon = loadPixmap( pathString + "newevent" ); 1274 icon = loadPixmap( pathString + "newevent" );
1265 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1275 action = new Q3Action( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1266 action->addTo( beamMenu_X ); 1276 action->addTo( beamMenu_X );
1267 connect( action, SIGNAL( activated() ), 1277 connect( action, SIGNAL( activated() ),
1268 mView, SLOT( slotprintSelInc() ) ); 1278 mView, SLOT( slotprintSelInc() ) );
1269 mPrintSelAction = action; 1279 mPrintSelAction = action;
1270 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1280 importMenu->insertItem( i18n("Print"), beamMenu_X );
1271#endif 1281#endif
1272 1282
1273 importMenu->insertSeparator(); 1283 importMenu->insertSeparator();
1274 action = new QAction( "beam all", i18n("Save"), 0, 1284 action = new Q3Action( "beam all", i18n("Save"), 0,
1275 this ); 1285 this );
1276 action->addTo( importMenu ); 1286 action->addTo( importMenu );
1277 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1287 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1278 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1288 action = new Q3Action( "beam all", i18n("Exit (+save)"), 0,
1279 this ); 1289 this );
1280 action->addTo( importMenu ); 1290 action->addTo( importMenu );
1281 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1291 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1282 1292
1283 //menuBar->insertItem( "Configure",configureMenu ); 1293 //menuBar->insertItem( "Configure",configureMenu );
1284 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1294 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1285 icon = loadPixmap( "korganizer/korganizer" ); 1295 icon = loadPixmap( "korganizer/korganizer" );
1286 1296
1287 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1297 action = new Q3Action( "Whats New", i18n("What's new?"), 0,this );
1288 action->addTo( helpMenu ); 1298 action->addTo( helpMenu );
1289 connect( action, SIGNAL( activated() ), 1299 connect( action, SIGNAL( activated() ),
1290 SLOT( whatsNew() ) ); 1300 SLOT( whatsNew() ) );
1291 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1301 action = new Q3Action( "featureHowto", i18n("Features + hints..."), 0,this );
1292 action->addTo( helpMenu ); 1302 action->addTo( helpMenu );
1293 connect( action, SIGNAL( activated() ), 1303 connect( action, SIGNAL( activated() ),
1294 SLOT( features() ) ); 1304 SLOT( features() ) );
1295 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1305 action = new Q3Action( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1296 action->addTo( helpMenu ); 1306 action->addTo( helpMenu );
1297 connect( action, SIGNAL( activated() ), 1307 connect( action, SIGNAL( activated() ),
1298 SLOT( keyBindings() ) ); 1308 SLOT( keyBindings() ) );
1299 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1309 action = new Q3Action( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1300 action->addTo( helpMenu ); 1310 action->addTo( helpMenu );
1301 connect( action, SIGNAL( activated() ), 1311 connect( action, SIGNAL( activated() ),
1302 SLOT( storagehowto() ) ); 1312 SLOT( storagehowto() ) );
1303 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); 1313 action = new Q3Action( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
1304 action->addTo( helpMenu ); 1314 action->addTo( helpMenu );
1305 connect( action, SIGNAL( activated() ), 1315 connect( action, SIGNAL( activated() ),
1306 SLOT( timetrackinghowto() ) ); 1316 SLOT( timetrackinghowto() ) );
1307 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1317 action = new Q3Action( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1308 action->addTo( helpMenu ); 1318 action->addTo( helpMenu );
1309 connect( action, SIGNAL( activated() ), 1319 connect( action, SIGNAL( activated() ),
1310 SLOT( synchowto() ) ); 1320 SLOT( synchowto() ) );
1311 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1321 action = new Q3Action( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1312 action->addTo( helpMenu ); 1322 action->addTo( helpMenu );
1313 connect( action, SIGNAL( activated() ), 1323 connect( action, SIGNAL( activated() ),
1314 SLOT( kdesynchowto() ) ); 1324 SLOT( kdesynchowto() ) );
1315 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1325 action = new Q3Action( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1316 action->addTo( helpMenu ); 1326 action->addTo( helpMenu );
1317 connect( action, SIGNAL( activated() ), 1327 connect( action, SIGNAL( activated() ),
1318 SLOT( multisynchowto() ) ); 1328 SLOT( multisynchowto() ) );
1319 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1329 action = new Q3Action( "Auto saving", i18n("Auto saving..."), 0, this );
1320 action->addTo( helpMenu ); 1330 action->addTo( helpMenu );
1321 connect( action, SIGNAL( activated() ), 1331 connect( action, SIGNAL( activated() ),
1322 SLOT( aboutAutoSaving() ) ); 1332 SLOT( aboutAutoSaving() ) );
1323 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1333 action = new Q3Action( "Problemd", i18n("Known Problems..."), 0,this );
1324 action->addTo( helpMenu ); 1334 action->addTo( helpMenu );
1325 connect( action, SIGNAL( activated() ), 1335 connect( action, SIGNAL( activated() ),
1326 SLOT( aboutKnownBugs() ) ); 1336 SLOT( aboutKnownBugs() ) );
1327 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1337 action = new Q3Action( "Translate Howto", i18n("User translation..."), 0,this );
1328 action->addTo( helpMenu ); 1338 action->addTo( helpMenu );
1329 connect( action, SIGNAL( activated() ), 1339 connect( action, SIGNAL( activated() ),
1330 SLOT( usertrans() ) ); 1340 SLOT( usertrans() ) );
1331 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1341 action = new Q3Action( "Frequently asked questions", i18n("FAQ..."), 0,this );
1332 action->addTo( helpMenu ); 1342 action->addTo( helpMenu );
1333 connect( action, SIGNAL( activated() ), 1343 connect( action, SIGNAL( activated() ),
1334 SLOT( faq() ) ); 1344 SLOT( faq() ) );
1335 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1345 action = new Q3Action( "licence", i18n("Licence..."), 0, this );
1336 action->addTo( helpMenu ); 1346 action->addTo( helpMenu );
1337 connect( action, SIGNAL( activated() ), 1347 connect( action, SIGNAL( activated() ),
1338 SLOT( licence() ) ); 1348 SLOT( licence() ) );
1339 action = new QAction( "about", i18n("About..."), 0, this ); 1349 action = new Q3Action( "about", i18n("About..."), 0, this );
1340 action->addTo( helpMenu ); 1350 action->addTo( helpMenu );
1341 connect( action, SIGNAL( activated() ), 1351 connect( action, SIGNAL( activated() ),
1342 SLOT( about() ) ); 1352 SLOT( about() ) );
1343 //menuBar->insertSeparator(); 1353 //menuBar->insertSeparator();
1344 1354
1345 // ****************************************************** 1355 // ******************************************************
1346 // menubar icons 1356 // menubar icons
1347 1357
1348 1358
1349 1359
1350 //menuBar->insertItem( iconToolBar ); 1360 //menuBar->insertItem( iconToolBar );
1351 //xdays_action 1361 //xdays_action
1352 if (p-> mShowIconNewEvent) 1362 if (p-> mShowIconNewEvent)
1353 ne_action->addTo( iconToolBar ); 1363 ne_action->addTo( iconToolBar );
1354 if (p->mShowIconNewTodo ) 1364 if (p->mShowIconNewTodo )
1355 nt_action->addTo( iconToolBar ); 1365 nt_action->addTo( iconToolBar );
1356 if (p-> mShowIconSearch) 1366 if (p-> mShowIconSearch)
1357 search_action->addTo( iconToolBar ); 1367 search_action->addTo( iconToolBar );
1358 if (p-> mShowIconWhatsThis) 1368 if (p-> mShowIconWhatsThis)
1359 QWhatsThis::whatsThisButton ( iconToolBar ); 1369 Q3WhatsThis::whatsThisButton ( iconToolBar );
1360 if (p-> mShowIconNext) 1370 if (p-> mShowIconNext)
1361 whatsnext_action->addTo( viewToolBar ); 1371 whatsnext_action->addTo( viewToolBar );
1362 if (p-> mShowIconNextDays) 1372 if (p-> mShowIconNextDays)
1363 xdays_action->addTo( viewToolBar ); 1373 xdays_action->addTo( viewToolBar );
1364 if (p-> mShowIconJournal) 1374 if (p-> mShowIconJournal)
1365 viewjournal_action->addTo( viewToolBar ); 1375 viewjournal_action->addTo( viewToolBar );
1366 if (p-> mShowIconDay1) 1376 if (p-> mShowIconDay1)
1367 day1_action->addTo( viewToolBar ); 1377 day1_action->addTo( viewToolBar );
1368 if (p-> mShowIconDay5) 1378 if (p-> mShowIconDay5)
1369 day5_action->addTo( viewToolBar ); 1379 day5_action->addTo( viewToolBar );
1370 if (p-> mShowIconDay7) 1380 if (p-> mShowIconDay7)
1371 day7_action->addTo( viewToolBar ); 1381 day7_action->addTo( viewToolBar );
1372 if (p-> mShowIconDay6) 1382 if (p-> mShowIconDay6)
1373 day6_action->addTo( viewToolBar ); 1383 day6_action->addTo( viewToolBar );
1374 if (p-> mShowIconMonth) 1384 if (p-> mShowIconMonth)
1375 month_action->addTo( viewToolBar ); 1385 month_action->addTo( viewToolBar );
1376 if (p-> mShowIconList) 1386 if (p-> mShowIconList)
1377 showlist_action->addTo( viewToolBar ); 1387 showlist_action->addTo( viewToolBar );
1378 if (p-> mShowIconTodoview) 1388 if (p-> mShowIconTodoview)
1379 todoview_action->addTo( viewToolBar ); 1389 todoview_action->addTo( viewToolBar );
1380 1390
1381 icon = loadPixmap( pathString + "2leftarrowB" ); 1391 icon = loadPixmap( pathString + "2leftarrowB" );
1382 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1392 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1383 if (p-> mShowIconBackFast) { 1393 if (p-> mShowIconBackFast) {
1384 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1394 action = new Q3Action( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1385 connect( action, SIGNAL( activated() ), 1395 connect( action, SIGNAL( activated() ),
1386 mView, SLOT( goPreviousMonth() ) ); 1396 mView, SLOT( goPreviousMonth() ) );
1387 action->addTo( navigatorToolBar ); 1397 action->addTo( navigatorToolBar );
1388 } 1398 }
1389 icon = loadPixmap( pathString + "1leftarrowB" ); 1399 icon = loadPixmap( pathString + "1leftarrowB" );
1390 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1400 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1391 if (p-> mShowIconBack) { 1401 if (p-> mShowIconBack) {
1392 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1402 action = new Q3Action( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1393 connect( action, SIGNAL( activated() ), 1403 connect( action, SIGNAL( activated() ),
1394 mView, SLOT( goPrevious() ) ); 1404 mView, SLOT( goPrevious() ) );
1395 action->addTo( navigatorToolBar ); 1405 action->addTo( navigatorToolBar );
1396 } 1406 }
1397 icon = loadPixmap( pathString + "today" ); 1407 icon = loadPixmap( pathString + "today" );
1398 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1408 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1399 if (p-> mShowIconToday) 1409 if (p-> mShowIconToday)
1400 today_action->addTo( navigatorToolBar ); 1410 today_action->addTo( navigatorToolBar );
1401 icon = loadPixmap( pathString + "1rightarrowB" ); 1411 icon = loadPixmap( pathString + "1rightarrowB" );
1402 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1412 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1403 if (p-> mShowIconForward) { 1413 if (p-> mShowIconForward) {
1404 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1414 action = new Q3Action( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1405 connect( action, SIGNAL( activated() ), 1415 connect( action, SIGNAL( activated() ),
1406 mView, SLOT( goNext() ) ); 1416 mView, SLOT( goNext() ) );
1407 action->addTo( navigatorToolBar ); 1417 action->addTo( navigatorToolBar );
1408 } 1418 }
1409 icon = loadPixmap( pathString + "2rightarrowB" ); 1419 icon = loadPixmap( pathString + "2rightarrowB" );
1410 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1420 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1411 if (p-> mShowIconForwardFast) { 1421 if (p-> mShowIconForwardFast) {
1412 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1422 action = new Q3Action( i18n("Next month"), icon, i18n("Next month"),0 , this );
1413 connect( action, SIGNAL( activated() ), 1423 connect( action, SIGNAL( activated() ),
1414 mView, SLOT( goNextMonth() ) ); 1424 mView, SLOT( goNextMonth() ) );
1415 action->addTo( navigatorToolBar ); 1425 action->addTo( navigatorToolBar );
1416 } 1426 }
1417 1427
1418 1428
1419 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1429 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1420 1430
1421 1431
1422 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1432 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1423 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1433 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1424 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1434 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1425 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1435 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1426 1436
1427 if (p-> mShowIconNewEvent) 1437 if (p-> mShowIconNewEvent)
1428 configureToolBarMenu->setItemChecked( 10, true ); 1438 configureToolBarMenu->setItemChecked( 10, true );
@@ -1511,33 +1521,33 @@ void MainWindow::exportToPhone( int mode )
1511 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1521 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1512 if ( mode == 1 ) 1522 if ( mode == 1 )
1513 ex2phone.setCaption(i18n("Export complete calendar")); 1523 ex2phone.setCaption(i18n("Export complete calendar"));
1514 if ( mode == 2 ) 1524 if ( mode == 2 )
1515 ex2phone.setCaption(i18n("Export filtered calendar")); 1525 ex2phone.setCaption(i18n("Export filtered calendar"));
1516 1526
1517 if ( !ex2phone.exec() ) { 1527 if ( !ex2phone.exec() ) {
1518 return; 1528 return;
1519 } 1529 }
1520 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1530 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1521 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1531 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1522 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1532 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1523 1533
1524 int inFuture = 0; 1534 int inFuture = 0;
1525 if ( ex2phone.mWriteBackFuture->isChecked() ) 1535 if ( ex2phone.mWriteBackFuture->isChecked() )
1526 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1536 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1527 QPtrList<Incidence> delSel; 1537 Q3PtrList<Incidence> delSel;
1528 if ( mode == 1 ) 1538 if ( mode == 1 )
1529 delSel = mCalendar->rawIncidences(); 1539 delSel = mCalendar->rawIncidences();
1530 if ( mode == 2 ) 1540 if ( mode == 2 )
1531 delSel = mCalendar->incidences(); 1541 delSel = mCalendar->incidences();
1532 CalendarLocal* cal = new CalendarLocal(); 1542 CalendarLocal* cal = new CalendarLocal();
1533 cal->setLocalTime(); 1543 cal->setLocalTime();
1534 Incidence *incidence = delSel.first(); 1544 Incidence *incidence = delSel.first();
1535 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1545 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1536 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1546 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1537 while ( incidence ) { 1547 while ( incidence ) {
1538 if ( incidence->typeID() != journalID ) { 1548 if ( incidence->typeID() != journalID ) {
1539 bool add = true; 1549 bool add = true;
1540 if ( inFuture ) { 1550 if ( inFuture ) {
1541 QDateTime dt; 1551 QDateTime dt;
1542 if ( incidence->typeID() == todoID ) { 1552 if ( incidence->typeID() == todoID ) {
1543 Todo * t = (Todo*)incidence; 1553 Todo * t = (Todo*)incidence;
@@ -1582,36 +1592,36 @@ void MainWindow::setDefaultPreferences()
1582 1592
1583 p->mCompactDialogs = true; 1593 p->mCompactDialogs = true;
1584 p->mConfirm = true; 1594 p->mConfirm = true;
1585 // p->mEnableQuickTodo = false; 1595 // p->mEnableQuickTodo = false;
1586 1596
1587} 1597}
1588 1598
1589QString MainWindow::resourcePath() 1599QString MainWindow::resourcePath()
1590{ 1600{
1591 return KGlobal::iconLoader()->iconPath(); 1601 return KGlobal::iconLoader()->iconPath();
1592} 1602}
1593 1603
1594void MainWindow::displayText( QString text ,QString cap ) 1604void MainWindow::displayText( QString text ,QString cap )
1595{ 1605{
1596 QDialog dia( this, "name", true ); ; 1606 QDialog dia( this, "name", true ); ;
1597 dia.setCaption( cap ); 1607 dia.setCaption( cap );
1598 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1608 Q3VBoxLayout* lay = new Q3VBoxLayout( &dia );
1599 lay->setSpacing( 3 ); 1609 lay->setSpacing( 3 );
1600 lay->setMargin( 3 ); 1610 lay->setMargin( 3 );
1601 QTextBrowser tb ( &dia ); 1611 Q3TextBrowser tb ( &dia );
1602 lay->addWidget( &tb ); 1612 lay->addWidget( &tb );
1603 tb.setText( text ); 1613 tb.setText( text );
1604#ifdef DESKTOP_VERSION 1614#ifdef DESKTOP_VERSION
1605 dia.resize( 640, 480); 1615 dia.resize( 640, 480);
1606#else 1616#else
1607 dia.showMaximized(); 1617 dia.showMaximized();
1608#endif 1618#endif
1609 dia.exec(); 1619 dia.exec();
1610} 1620}
1611 1621
1612void MainWindow::features() 1622void MainWindow::features()
1613{ 1623{
1614 1624
1615 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1625 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1616} 1626}
1617 1627
@@ -1764,68 +1774,68 @@ QString MainWindow::defaultFileName()
1764QString MainWindow::syncFileName() 1774QString MainWindow::syncFileName()
1765{ 1775{
1766#ifdef DESKTOP_VERSION 1776#ifdef DESKTOP_VERSION
1767 return QDir::convertSeparators( locateLocal( "tmp", "synccalendar.ics" ) ); 1777 return QDir::convertSeparators( locateLocal( "tmp", "synccalendar.ics" ) );
1768#else 1778#else
1769 return QString( "/tmp/synccalendar.ics" ); 1779 return QString( "/tmp/synccalendar.ics" );
1770#endif 1780#endif
1771} 1781}
1772#include "koglobals.h" 1782#include "koglobals.h"
1773#include <kcalendarsystem.h> 1783#include <kcalendarsystem.h>
1774void MainWindow::updateWeek(QDate seda) 1784void MainWindow::updateWeek(QDate seda)
1775{ 1785{
1776 int weekNum = KGlobal::locale()->weekNum ( seda ); 1786 int weekNum = KGlobal::locale()->weekNum ( seda );
1777 mWeekPixmap.fill( mWeekBgColor ); 1787 mWeekPixmap.fill( mWeekBgColor );
1778 QPainter p ( &mWeekPixmap ); 1788 QPainter p ( &mWeekPixmap );
1779 p.setFont( mWeekFont ); 1789 p.setFont( mWeekFont );
1780 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1790 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),Qt::AlignCenter, QString::number( weekNum) );
1781 p.end(); 1791 p.end();
1782 QIconSet icon3 ( mWeekPixmap ); 1792 QIcon icon3 ( mWeekPixmap );
1783 mWeekAction->setIconSet ( icon3 ); 1793 mWeekAction->setIconSet ( icon3 );
1784 1794
1785} 1795}
1786void MainWindow::updateWeekNum(const DateList &selectedDates) 1796void MainWindow::updateWeekNum(const DateList &selectedDates)
1787{ 1797{
1788 updateWeek( selectedDates.first() ); 1798 updateWeek( selectedDates.first() );
1789} 1799}
1790void MainWindow::processIncidenceSelection( Incidence *incidence ) 1800void MainWindow::processIncidenceSelection( Incidence *incidence )
1791{ 1801{
1792 if ( !incidence ) { 1802 if ( !incidence ) {
1793 mShowAction->setMenuText( i18n("Show") ); 1803 mShowAction->setMenuText( i18n("Show") );
1794 enableIncidenceActions( false ); 1804 enableIncidenceActions( false );
1795 mNewSubTodoAction->setEnabled( false ); 1805 mNewSubTodoAction->setEnabled( false );
1796 setCaptionToDates(); 1806 setCaptionToDates();
1797 return; 1807 return;
1798 } 1808 }
1799 QString startString = ""; 1809 QString startString = "";
1800 if ( incidence->typeID() != todoID ) { 1810 if ( incidence->typeID() != todoID ) {
1801 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1811 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1802 if ( incidence->doesFloat() ) { 1812 if ( incidence->doesFloat() ) {
1803 startString += ": "+incidence->dtStartDateStr( true ); 1813 startString += ": "+incidence->dtStartDateStr( true );
1804 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1814 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1805 } else { 1815 } else {
1806 startString = ": "+incidence->dtStartStr(true); 1816 startString = ": "+incidence->dtStartStr(true);
1807 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1817 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1808 } 1818 }
1809 } else { 1819 } else {
1810 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1820 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1811 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1821 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1812 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1822 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1813 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1823 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1814 bool ok; 1824 bool ok;
1815 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1825 QDateTime noc = incidence->getNextOccurence( (QDateTime)mView->startDate().addDays(-1), &ok );
1816 if ( ok ) { 1826 if ( ok ) {
1817 int years = noc.date().year() - incidence->dtStart().date().year(); 1827 int years = noc.date().year() - incidence->dtStart().date().year();
1818 startString += i18n(" (%1 y.)"). arg( years ); 1828 startString += i18n(" (%1 y.)"). arg( years );
1819 } 1829 }
1820 } 1830 }
1821 else 1831 else
1822 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1832 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1823 } 1833 }
1824 } 1834 }
1825 else { 1835 else {
1826 if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) 1836 if ( (( KCal::Todo*)incidence)->percentComplete() == 100 )
1827 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); 1837 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) );
1828 else 1838 else
1829 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1839 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1830 } 1840 }
1831 if ( !incidence->location().isEmpty() ) 1841 if ( !incidence->location().isEmpty() )
@@ -1833,39 +1843,39 @@ void MainWindow::processIncidenceSelection( Incidence *incidence )
1833 setCaption( incidence->summary()+startString); 1843 setCaption( incidence->summary()+startString);
1834 enableIncidenceActions( true ); 1844 enableIncidenceActions( true );
1835 if ( incidence->typeID() == eventID ) { 1845 if ( incidence->typeID() == eventID ) {
1836 mShowAction->setMenuText( i18n("Show Event") ); 1846 mShowAction->setMenuText( i18n("Show Event") );
1837 mNewSubTodoAction->setEnabled( false ); 1847 mNewSubTodoAction->setEnabled( false );
1838 } else if ( incidence->typeID() == todoID ) { 1848 } else if ( incidence->typeID() == todoID ) {
1839 mShowAction->setMenuText( i18n("Show Todo") ); 1849 mShowAction->setMenuText( i18n("Show Todo") );
1840 mNewSubTodoAction->setEnabled( true ); 1850 mNewSubTodoAction->setEnabled( true );
1841 } else { 1851 } else {
1842 mShowAction->setMenuText( i18n("Show") ); 1852 mShowAction->setMenuText( i18n("Show") );
1843 mNewSubTodoAction->setEnabled( false ); 1853 mNewSubTodoAction->setEnabled( false );
1844 } 1854 }
1845#ifdef DESKTOP_VERSION 1855#ifdef DESKTOP_VERSION
1846 static QPixmap jP = SmallIcon( "journal" ); 1856 static QPixmap jP = SmallIcon( "journal" );
1847 static QPixmap eP = SmallIcon( "newevent" ); 1857 static QPixmap eP = SmallIcon( "newevent" );
1848 static QPixmap tP = SmallIcon( "newtodo" ); 1858 static QPixmap tP = SmallIcon( "newtodo" );
1849 QIconSet icon; 1859 QIcon icon;
1850 if ( incidence->typeID() == todoID ) 1860 if ( incidence->typeID() == todoID )
1851 icon = QIconSet ( tP ); 1861 icon = QIcon ( tP );
1852 else if ( incidence->typeID() == eventID ) 1862 else if ( incidence->typeID() == eventID )
1853 icon = QIconSet ( eP ); 1863 icon = QIcon ( eP );
1854 else if ( incidence->typeID() == journalID ) 1864 else if ( incidence->typeID() == journalID )
1855 icon = QIconSet ( jP ); 1865 icon = QIcon ( jP );
1856 mPrintSelAction->setIconSet ( icon ); 1866 mPrintSelAction->setIconSet ( icon );
1857#endif 1867#endif
1858} 1868}
1859 1869
1860void MainWindow::enableIncidenceActions( bool enabled ) 1870void MainWindow::enableIncidenceActions( bool enabled )
1861{ 1871{
1862 mShowAction->setEnabled( enabled ); 1872 mShowAction->setEnabled( enabled );
1863 mEditAction->setEnabled( enabled ); 1873 mEditAction->setEnabled( enabled );
1864 mDeleteAction->setEnabled( enabled ); 1874 mDeleteAction->setEnabled( enabled );
1865 1875
1866 mCloneAction->setEnabled( enabled ); 1876 mCloneAction->setEnabled( enabled );
1867 mMoveAction->setEnabled( enabled ); 1877 mMoveAction->setEnabled( enabled );
1868#ifndef DESKTOP_VERSION 1878#ifndef DESKTOP_VERSION
1869 mBeamAction->setEnabled( enabled ); 1879 mBeamAction->setEnabled( enabled );
1870#else 1880#else
1871 mPrintSelAction->setEnabled( enabled ); 1881 mPrintSelAction->setEnabled( enabled );
@@ -2032,33 +2042,33 @@ void MainWindow::backupAllFiles()
2032 int daysTo = reference.daysTo ( QDate::currentDate() ); 2042 int daysTo = reference.daysTo ( QDate::currentDate() );
2033 setCaption(i18n("Creating backup ... please wait ..." )); 2043 setCaption(i18n("Creating backup ... please wait ..." ));
2034 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); 2044 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
2035 // we need the file path, the backup dir and the number of bups as param 2045 // we need the file path, the backup dir and the number of bups as param
2036 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 2046 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
2037 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 2047 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
2038 bupDir = KGlobalSettings::backupDataDir(); 2048 bupDir = KGlobalSettings::backupDataDir();
2039 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 2049 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
2040 if ( retval == 0 ) { 2050 if ( retval == 0 ) {
2041 setCaption(i18n("Backup cancelled" )); 2051 setCaption(i18n("Backup cancelled" ));
2042 qDebug("KO: Backup cancelled. Will try again tomorrow "); 2052 qDebug("KO: Backup cancelled. Will try again tomorrow ");
2043 // retval == 0 : backup skipped for today, try again tomorrow 2053 // retval == 0 : backup skipped for today, try again tomorrow
2044 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; 2054 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
2045 } else if ( retval == 1 ){ 2055 } else if ( retval == 1 ){
2046 qDebug("KO: Backup created."); 2056 qDebug("KO: Backup created.");
2047 // backup ok 2057 // backup ok
2048 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 2058 Q3PtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
2049 KopiCalendarFile * cal = calendars.first(); 2059 KopiCalendarFile * cal = calendars.first();
2050 cal = calendars.next(); 2060 cal = calendars.next();
2051 while ( cal ) { 2061 while ( cal ) {
2052 if ( !cal->mErrorOnLoad ) { 2062 if ( !cal->mErrorOnLoad ) {
2053 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 2063 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
2054 } 2064 }
2055 cal = calendars.next(); 2065 cal = calendars.next();
2056 } 2066 }
2057 KOPrefs::instance()->mLastBackupDate = daysTo; 2067 KOPrefs::instance()->mLastBackupDate = daysTo;
2058 setCaption(i18n("Backup succesfully finished" )); 2068 setCaption(i18n("Backup succesfully finished" ));
2059 } else if ( retval == 2 ){ 2069 } else if ( retval == 2 ){
2060 setCaption(i18n("Backup globally disabled" )); 2070 setCaption(i18n("Backup globally disabled" ));
2061 qDebug("KO: Backup globally cancelled."); 2071 qDebug("KO: Backup globally cancelled.");
2062 // backup globally cancelled 2072 // backup globally cancelled
2063 KPimGlobalPrefs::instance()->mBackupEnabled = false; 2073 KPimGlobalPrefs::instance()->mBackupEnabled = false;
2064 } 2074 }
@@ -2328,33 +2338,33 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
2328 if ( pro > 0 ) { 2338 if ( pro > 0 ) {
2329 selectFilter( pro+1 ); 2339 selectFilter( pro+1 );
2330 } 2340 }
2331 if ( showSelectedDates ) { 2341 if ( showSelectedDates ) {
2332 ;// setCaptionToDates(); 2342 ;// setCaptionToDates();
2333 } 2343 }
2334 2344
2335} 2345}
2336void MainWindow::fillFilterMenuTB() 2346void MainWindow::fillFilterMenuTB()
2337{ 2347{
2338 selectFilterMenuTB->clear(); 2348 selectFilterMenuTB->clear();
2339 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 2349 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
2340 selectFilterMenuTB->insertSeparator(); 2350 selectFilterMenuTB->insertSeparator();
2341 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 2351 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
2342 2352
2343 selectFilterMenuTB->insertSeparator(); 2353 selectFilterMenuTB->insertSeparator();
2344 QPtrList<CalFilter> fili = mView->filters(); 2354 Q3PtrList<CalFilter> fili = mView->filters();
2345 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2355 CalFilter *curfilter = mView->filterView()->selectedFilter();
2346 CalFilter *filter = fili.first(); 2356 CalFilter *filter = fili.first();
2347 int iii = 2; 2357 int iii = 2;
2348 bool checkitem = mView->filterView()->filtersEnabled(); 2358 bool checkitem = mView->filterView()->filtersEnabled();
2349 while(filter) { 2359 while(filter) {
2350 selectFilterMenuTB->insertItem( filter->name(), iii ); 2360 selectFilterMenuTB->insertItem( filter->name(), iii );
2351 if ( filter == curfilter) 2361 if ( filter == curfilter)
2352 selectFilterMenuTB->setItemChecked( iii, checkitem ); 2362 selectFilterMenuTB->setItemChecked( iii, checkitem );
2353 filter = fili.next(); 2363 filter = fili.next();
2354 ++iii; 2364 ++iii;
2355 } 2365 }
2356 if ( !checkitem ) 2366 if ( !checkitem )
2357 selectFilterMenuTB->setItemChecked( 1, true ); 2367 selectFilterMenuTB->setItemChecked( 1, true );
2358 2368
2359 int x = 0; 2369 int x = 0;
2360 int y = iconToolBar->height(); 2370 int y = iconToolBar->height();
@@ -2373,54 +2383,54 @@ void MainWindow::fillFilterMenuTB()
2373 } else { 2383 } else {
2374 x= iconToolBar->width(); 2384 x= iconToolBar->width();
2375 y = 0; 2385 y = 0;
2376 } 2386 }
2377 } 2387 }
2378 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2388 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2379 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); 2389 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
2380} 2390}
2381void MainWindow::fillFilterMenu() 2391void MainWindow::fillFilterMenu()
2382{ 2392{
2383 selectFilterMenu->clear(); 2393 selectFilterMenu->clear();
2384 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 2394 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
2385 selectFilterMenu->insertSeparator(); 2395 selectFilterMenu->insertSeparator();
2386 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 2396 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
2387 2397
2388 selectFilterMenu->insertSeparator(); 2398 selectFilterMenu->insertSeparator();
2389 QPtrList<CalFilter> fili = mView->filters(); 2399 Q3PtrList<CalFilter> fili = mView->filters();
2390 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2400 CalFilter *curfilter = mView->filterView()->selectedFilter();
2391 CalFilter *filter = fili.first(); 2401 CalFilter *filter = fili.first();
2392 int iii = 2; 2402 int iii = 2;
2393 bool checkitem = mView->filterView()->filtersEnabled(); 2403 bool checkitem = mView->filterView()->filtersEnabled();
2394 while(filter) { 2404 while(filter) {
2395 selectFilterMenu->insertItem( filter->name(), iii ); 2405 selectFilterMenu->insertItem( filter->name(), iii );
2396 if ( filter == curfilter) 2406 if ( filter == curfilter)
2397 selectFilterMenu->setItemChecked( iii, checkitem ); 2407 selectFilterMenu->setItemChecked( iii, checkitem );
2398 filter = fili.next(); 2408 filter = fili.next();
2399 ++iii; 2409 ++iii;
2400 } 2410 }
2401 if ( !checkitem ) 2411 if ( !checkitem )
2402 selectFilterMenu->setItemChecked( 1, true ); 2412 selectFilterMenu->setItemChecked( 1, true );
2403} 2413}
2404void MainWindow::fillFilterMenuPopup() 2414void MainWindow::fillFilterMenuPopup()
2405{ 2415{
2406 filterPopupMenu->clear(); 2416 filterPopupMenu->clear();
2407 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2417 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2408 2418
2409 filterPopupMenu->insertSeparator(); 2419 filterPopupMenu->insertSeparator();
2410 QPtrList<CalFilter> fili = mView->filters(); 2420 Q3PtrList<CalFilter> fili = mView->filters();
2411 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2421 CalFilter *curfilter = mView->filterView()->selectedFilter();
2412 CalFilter *filter = fili.first(); 2422 CalFilter *filter = fili.first();
2413 int iii = 1; 2423 int iii = 1;
2414 bool checkitem = mView->filterView()->filtersEnabled(); 2424 bool checkitem = mView->filterView()->filtersEnabled();
2415 while(filter) { 2425 while(filter) {
2416 filterPopupMenu->insertItem( filter->name(), iii ); 2426 filterPopupMenu->insertItem( filter->name(), iii );
2417 if ( filter == curfilter) 2427 if ( filter == curfilter)
2418 filterPopupMenu->setItemChecked( iii, checkitem ); 2428 filterPopupMenu->setItemChecked( iii, checkitem );
2419 filter = fili.next(); 2429 filter = fili.next();
2420 ++iii; 2430 ++iii;
2421 } 2431 }
2422 if ( !checkitem ) 2432 if ( !checkitem )
2423 filterPopupMenu->setItemChecked( 0, true ); 2433 filterPopupMenu->setItemChecked( 0, true );
2424} 2434}
2425void MainWindow::selectFilter( int fil ) 2435void MainWindow::selectFilter( int fil )
2426{ 2436{
@@ -2806,18 +2816,18 @@ void MainWindow::hideEvent ( QHideEvent * )
2806 setCaption( message ); 2816 setCaption( message );
2807 } 2817 }
2808} 2818}
2809 2819
2810void MainWindow::resizeEvent( QResizeEvent* e) 2820void MainWindow::resizeEvent( QResizeEvent* e)
2811{ 2821{
2812#ifndef DESKTOP_VERSION 2822#ifndef DESKTOP_VERSION
2813 if ( filterToolBar ) { 2823 if ( filterToolBar ) {
2814 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { 2824 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) {
2815 if (QApplication::desktop()->width() > QApplication::desktop()->height() ) 2825 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2816 filterToolBar->hide(); 2826 filterToolBar->hide();
2817 else 2827 else
2818 filterToolBar->show(); 2828 filterToolBar->show();
2819 } 2829 }
2820 } 2830 }
2821#endif 2831#endif
2822 QMainWindow::resizeEvent( e); 2832 Q3MainWindow::resizeEvent( e);
2823} 2833}
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index a533d8b..6756216 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,69 +1,77 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <q3mainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <q3dict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <q3textstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11//Added by qt3to4:
12#include <Q3CString>
13#include <QCloseEvent>
14#include <QResizeEvent>
15#include <QPixmap>
16#include <Q3PopupMenu>
17#include <QHideEvent>
18#include <QKeyEvent>
11 19
12#include <libkcal/incidence.h> 20#include <libkcal/incidence.h>
13#include <ksyncmanager.h> 21#include <ksyncmanager.h>
14#include <kpopupmenu.h> 22#include <kpopupmenu.h>
15#ifndef DESKTOP_VERSION 23#ifndef DESKTOP_VERSION
16#include <qcopchannel_qws.h> 24#include <qcopchannel_qws.h>
17#endif 25#endif
18class QAction; 26class Q3Action;
19class CalendarView; 27class CalendarView;
20class KSyncProfile; 28class KSyncProfile;
21#ifdef DESKTOP_VERSION 29#ifdef DESKTOP_VERSION
22 30
23#define QPEToolBar QToolBar 31#define QPEToolBar Q3ToolBar
24#endif 32#endif
25class QPEToolBar; 33class QPEToolBar;
26 34
27 35
28namespace KCal { 36namespace KCal {
29class CalendarLocal; 37class CalendarLocal;
30} 38}
31 39
32using namespace KCal; 40using namespace KCal;
33 41
34class MainWindow : public QMainWindow 42class MainWindow : public Q3MainWindow
35{ 43{
36 Q_OBJECT 44 Q_OBJECT
37 public: 45 public:
38 MainWindow( QWidget *parent = 0, const char *name = 0 ); 46 MainWindow( QWidget *parent = 0, const char *name = 0 );
39 ~MainWindow(); 47 ~MainWindow();
40 bool beamReceiveEnabled(); 48 bool beamReceiveEnabled();
41 static QString defaultFileName(); 49 static QString defaultFileName();
42 static QString syncFileName(); 50 static QString syncFileName();
43 static QString resourcePath(); 51 static QString resourcePath();
44 public slots: 52 public slots:
45 void setUsesBigPixmaps ( bool ); 53 void setUsesBigPixmaps ( bool );
46 void setCaption ( const QString & ); 54 void setCaption ( const QString & );
47 void updateWeekNum(const KCal::DateList &); 55 void updateWeekNum(const KCal::DateList &);
48 void updateWeek(QDate); 56 void updateWeek(QDate);
49 void updateFilterToolbar(); 57 void updateFilterToolbar();
50 virtual void showMaximized (); 58 virtual void showMaximized ();
51 void configureAgenda( int ); 59 void configureAgenda( int );
52 void recieve( const QCString& msg, const QByteArray& data ); 60 void recieve( const Q3CString& msg, const QByteArray& data );
53 void receiveStart( const QCString& msg, const QByteArray& data ); 61 void receiveStart( const Q3CString& msg, const QByteArray& data );
54 protected slots: 62 protected slots:
55 void autoSaveWarning(); 63 void autoSaveWarning();
56 void loadDataAfterStart(); 64 void loadDataAfterStart();
57 void calHint(); 65 void calHint();
58 void startMultiSync(); 66 void startMultiSync();
59 void setCaptionToDates(); 67 void setCaptionToDates();
60 void weekAction(); 68 void weekAction();
61 void about(); 69 void about();
62 void licence(); 70 void licence();
63 void faq(); 71 void faq();
64 void usertrans(); 72 void usertrans();
65 void features(); 73 void features();
66 void synchowto(); 74 void synchowto();
67 void storagehowto(); 75 void storagehowto();
68 void timetrackinghowto(); 76 void timetrackinghowto();
69 void kdesynchowto(); 77 void kdesynchowto();
@@ -111,81 +119,81 @@ class MainWindow : public QMainWindow
111 void slotResetFocusLoop(); 119 void slotResetFocusLoop();
112 void showConfigureAgenda(); 120 void showConfigureAgenda();
113 void getFile( bool ,const QString &); 121 void getFile( bool ,const QString &);
114 void syncFileRequest(const QString &); 122 void syncFileRequest(const QString &);
115 123
116 protected: 124 protected:
117 int mFocusLoop; 125 int mFocusLoop;
118 void hideEvent ( QHideEvent * ); 126 void hideEvent ( QHideEvent * );
119 QString sentSyncFile(); 127 QString sentSyncFile();
120 void displayText( QString, QString); 128 void displayText( QString, QString);
121 void enableIncidenceActions( bool ); 129 void enableIncidenceActions( bool );
122 bool askForQuitOnSaveError(); 130 bool askForQuitOnSaveError();
123 131
124 private: 132 private:
125 bool mAutoSaveDisabled; 133 bool mAutoSaveDisabled;
126 bool checkAutosave(); 134 bool checkAutosave();
127 QCString mCStringMess; 135 Q3CString mCStringMess;
128 QByteArray mByteData; 136 QByteArray mByteData;
129 137
130 //void setMenuBar( QMenuBar * ); 138 //void setMenuBar( QMenuBar * );
131 bool mBRdisabled; 139 bool mBRdisabled;
132#ifndef DESKTOP_VERSION 140#ifndef DESKTOP_VERSION
133 QCopChannel* infrared; 141 QCopChannel* infrared;
134#endif 142#endif
135 QAction* brAction; 143 Q3Action* brAction;
136 KSyncManager* mSyncManager; 144 KSyncManager* mSyncManager;
137 bool mClosed; 145 bool mClosed;
138 void saveOnClose(); 146 void saveOnClose();
139 bool mFlagKeyPressed; 147 bool mFlagKeyPressed;
140 bool mBlockAtStartup; 148 bool mBlockAtStartup;
141 KMenuBar *menuBar1; 149 KMenuBar *menuBar1;
142 QPEToolBar *iconToolBar; 150 QPEToolBar *iconToolBar;
143 QPEToolBar *viewToolBar; 151 QPEToolBar *viewToolBar;
144 QPEToolBar *navigatorToolBar; 152 QPEToolBar *navigatorToolBar;
145 QPEToolBar *filterToolBar; 153 QPEToolBar *filterToolBar;
146 KMenuBar *filterMenubar; 154 KMenuBar *filterMenubar;
147 QPopupMenu * filterPopupMenu; 155 Q3PopupMenu * filterPopupMenu;
148 QPopupMenu * mCurrentItemMenu; 156 Q3PopupMenu * mCurrentItemMenu;
149 void initActions(); 157 void initActions();
150 void setDefaultPreferences(); 158 void setDefaultPreferences();
151 void resizeEvent( QResizeEvent* e); 159 void resizeEvent( QResizeEvent* e);
152 void keyPressEvent ( QKeyEvent * ) ; 160 void keyPressEvent ( QKeyEvent * ) ;
153 void keyReleaseEvent ( QKeyEvent * ) ; 161 void keyReleaseEvent ( QKeyEvent * ) ;
154 QPopupMenu *configureToolBarMenu; 162 Q3PopupMenu *configureToolBarMenu;
155 QPopupMenu *selectFilterMenu; 163 Q3PopupMenu *selectFilterMenu;
156 QPopupMenu *selectFilterMenuTB; 164 Q3PopupMenu *selectFilterMenuTB;
157 QPopupMenu *configureAgendaMenu, *syncMenu; 165 Q3PopupMenu *configureAgendaMenu, *syncMenu;
158 CalendarLocal *mCalendar; 166 CalendarLocal *mCalendar;
159 CalendarView *mView; 167 CalendarView *mView;
160 QAction *mNewSubTodoAction; 168 Q3Action *mNewSubTodoAction;
161 QAction *mWeekAction; 169 Q3Action *mWeekAction;
162 QFont mWeekFont; 170 QFont mWeekFont;
163 QPixmap mWeekPixmap; 171 QPixmap mWeekPixmap;
164 QColor mWeekBgColor; 172 QColor mWeekBgColor;
165 173
166 QAction *mShowAction; 174 Q3Action *mShowAction;
167 QAction *mEditAction; 175 Q3Action *mEditAction;
168 QAction *mDeleteAction; 176 Q3Action *mDeleteAction;
169 QAction *mCloneAction; 177 Q3Action *mCloneAction;
170 QAction *mMoveAction; 178 Q3Action *mMoveAction;
171 QAction *mBeamAction; 179 Q3Action *mBeamAction;
172 QAction *mCancelAction; 180 Q3Action *mCancelAction;
173 QAction *mPrintSelAction; 181 Q3Action *mPrintSelAction;
174 182
175 QAction *mToggleNav; 183 Q3Action *mToggleNav;
176 QAction *mToggleFilter; 184 Q3Action *mToggleFilter;
177 QAction *mToggleAllday; 185 Q3Action *mToggleAllday;
178 QAction *actionFilterMenuTB; 186 Q3Action *actionFilterMenuTB;
179 187
180 void closeEvent( QCloseEvent* ce ); 188 void closeEvent( QCloseEvent* ce );
181 QTimer mSaveTimer; 189 QTimer mSaveTimer;
182 QDateTime mSaveTimerStart; 190 QDateTime mSaveTimerStart;
183 int mSaveDelay; 191 int mSaveDelay;
184 //bool mBlockSaveFlag; 192 //bool mBlockSaveFlag;
185 bool mCalendarModifiedFlag; 193 bool mCalendarModifiedFlag;
186 QPixmap loadPixmap( QString ); 194 QPixmap loadPixmap( QString );
187 QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix; 195 QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix;
188}; 196};
189 197
190 198
191#endif 199#endif
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index f6a1a6a..59c3e45 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -13,64 +13,67 @@
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qstring.h> 25#include <qstring.h>
26#include <qtooltip.h> 26#include <qtooltip.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qframe.h> 29#include <q3frame.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <qpopupmenu.h> 31#include <q3popupmenu.h>
32#include <qapplication.h> 32#include <qapplication.h>
33#include <QDesktopWidget>
34//Added by qt3to4:
35#include <Q3HBoxLayout>
33 36
34#include <kdebug.h> 37#include <kdebug.h>
35#include <klocale.h> 38#include <klocale.h>
36#include <kglobal.h> 39#include <kglobal.h>
37#include <kiconloader.h> 40#include <kiconloader.h>
38#include "libkdepim/kdatepicker.h" 41#include "libkdepim/kdatepicker.h"
39#include <knotifyclient.h> 42#include <knotifyclient.h>
40#include "kdatetbl.h" 43#include "kdatetbl.h"
41 44
42#include "koglobals.h" 45#include "koglobals.h"
43#include <kglobalsettings.h> 46#include <kglobalsettings.h>
44#include "koprefs.h" 47#include "koprefs.h"
45#ifndef KORG_NOPLUGINS 48#ifndef KORG_NOPLUGINS
46#include "kocore.h" 49#include "kocore.h"
47#endif 50#endif
48 51
49#include <kcalendarsystem.h> 52#include <kcalendarsystem.h>
50 53
51#include "navigatorbar.h" 54#include "navigatorbar.h"
52 55
53NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) 56NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name )
54 : QWidget( parent, name ) 57 : QWidget( parent, name )
55{ 58{
56 QBoxLayout *topLayout = new QHBoxLayout( this ); 59 Q3BoxLayout *topLayout = new Q3HBoxLayout( this );
57 60
58 // Set up the control buttons and date label 61 // Set up the control buttons and date label
59 mCtrlFrame = new QFrame( this ); 62 mCtrlFrame = new Q3Frame( this );
60 mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); 63 mCtrlFrame->setFrameStyle(Q3Frame::Panel|Q3Frame::Raised);
61 mCtrlFrame->setLineWidth(1); 64 mCtrlFrame->setLineWidth(1);
62 65
63 topLayout->addWidget( mCtrlFrame ); 66 topLayout->addWidget( mCtrlFrame );
64 67
65 68
66 69
67 bool isRTL = KOGlobals::self()->reverseLayout(); 70 bool isRTL = KOGlobals::self()->reverseLayout();
68#ifndef DESKTOP_VERSION 71#ifndef DESKTOP_VERSION
69 bool isDesktop = false; 72 bool isDesktop = false;
70#else 73#else
71 bool isDesktop = true; 74 bool isDesktop = true;
72#endif 75#endif
73 if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) 76 if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 )
74 isDesktop = true; 77 isDesktop = true;
75 // Create backward navigation buttons 78 // Create backward navigation buttons
76 mPrevYear = new QPushButton( mCtrlFrame ); 79 mPrevYear = new QPushButton( mCtrlFrame );
@@ -116,60 +119,60 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
116 119
117 mPrevYear->setAutoRepeat( true ); 120 mPrevYear->setAutoRepeat( true );
118 mPrevMonth->setAutoRepeat( true ); 121 mPrevMonth->setAutoRepeat( true );
119 mNextMonth->setAutoRepeat( true ); 122 mNextMonth->setAutoRepeat( true );
120 mPrevWeek->setAutoRepeat( true ); 123 mPrevWeek->setAutoRepeat( true );
121 mNextWeek->setAutoRepeat( true ); 124 mNextWeek->setAutoRepeat( true );
122 mNextYear->setAutoRepeat( true ); 125 mNextYear->setAutoRepeat( true );
123 } else { 126 } else {
124 mPrevWeek->hide(); 127 mPrevWeek->hide();
125 mNextWeek->hide(); 128 mNextWeek->hide();
126 } 129 }
127 130
128 resetFont( font() ); 131 resetFont( font() );
129 132
130 133
131 // set up control frame layout 134 // set up control frame layout
132 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); 135 Q3BoxLayout *ctrlLayout = new Q3HBoxLayout( mCtrlFrame, 1 );
133 ctrlLayout->addWidget( mPrevYear, 3 ); 136 ctrlLayout->addWidget( mPrevYear, 3 );
134 ctrlLayout->addWidget( mPrevMonth, 3 ); 137 ctrlLayout->addWidget( mPrevMonth, 3 );
135 ctrlLayout->addWidget( mPrevWeek, 3 ); 138 ctrlLayout->addWidget( mPrevWeek, 3 );
136 //ctrlLayout->addStretch( 1 ); 139 //ctrlLayout->addStretch( 1 );
137 // ctrlLayout->addSpacing( 1 ); 140 // ctrlLayout->addSpacing( 1 );
138 // ctrlLayout->addWidget( mDateLabel ); 141 // ctrlLayout->addWidget( mDateLabel );
139 ctrlLayout->addWidget( mSelectMonth ); 142 ctrlLayout->addWidget( mSelectMonth );
140 // ctrlLayout->addSpacing( 1 ); 143 // ctrlLayout->addSpacing( 1 );
141 // ctrlLayout->addStretch( 1 ); 144 // ctrlLayout->addStretch( 1 );
142 ctrlLayout->addWidget( mNextWeek, 3 ); 145 ctrlLayout->addWidget( mNextWeek, 3 );
143 ctrlLayout->addWidget( mNextMonth, 3 ); 146 ctrlLayout->addWidget( mNextMonth, 3 );
144 ctrlLayout->addWidget( mNextYear, 3 ); 147 ctrlLayout->addWidget( mNextYear, 3 );
145 148
146 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); 149 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) );
147 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); 150 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) );
148 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); 151 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) );
149 connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); 152 connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) );
150 connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); 153 connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) );
151 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); 154 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) );
152 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); 155 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) );
153 mPrevYear->setFocusPolicy(NoFocus); 156 mPrevYear->setFocusPolicy(Qt::NoFocus);
154 mPrevMonth->setFocusPolicy(NoFocus); 157 mPrevMonth->setFocusPolicy(Qt::NoFocus);
155 mNextMonth->setFocusPolicy(NoFocus); 158 mNextMonth->setFocusPolicy(Qt::NoFocus);
156 mPrevWeek->setFocusPolicy(NoFocus); 159 mPrevWeek->setFocusPolicy(Qt::NoFocus);
157 mNextWeek->setFocusPolicy(NoFocus); 160 mNextWeek->setFocusPolicy(Qt::NoFocus);
158 mNextYear->setFocusPolicy(NoFocus); 161 mNextYear->setFocusPolicy(Qt::NoFocus);
159 mSelectMonth->setFocusPolicy(NoFocus); 162 mSelectMonth->setFocusPolicy(Qt::NoFocus);
160 setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); 163 setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
161 164
162} 165}
163 166
164NavigatorBar::~NavigatorBar() 167NavigatorBar::~NavigatorBar()
165{ 168{
166} 169}
167QSize NavigatorBar::sizeHint() const 170QSize NavigatorBar::sizeHint() const
168{ 171{
169 int wid = mCurrentMinWid ; 172 int wid = mCurrentMinWid ;
170 if ( mPrevYear->isVisible() ) 173 if ( mPrevYear->isVisible() )
171 wid += mCurrentButtonMinWid; 174 wid += mCurrentButtonMinWid;
172 if ( mPrevMonth->isVisible() ) 175 if ( mPrevMonth->isVisible() )
173 wid += mCurrentButtonMinWid; 176 wid += mCurrentButtonMinWid;
174 if ( mPrevWeek->isVisible() ) 177 if ( mPrevWeek->isVisible() )
175 wid += mCurrentButtonMinWid; 178 wid += mCurrentButtonMinWid;
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h
index 9ccef14..a1880f5 100644
--- a/korganizer/navigatorbar.h
+++ b/korganizer/navigatorbar.h
@@ -14,63 +14,66 @@
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef NAVIGATORBAR_H 24#ifndef NAVIGATORBAR_H
25#define NAVIGATORBAR_H 25#define NAVIGATORBAR_H
26 26
27#include <libkcal/incidencebase.h> 27#include <libkcal/incidencebase.h>
28 28
29#include <qwidget.h> 29#include <qwidget.h>
30//Added by qt3to4:
31#include <Q3Frame>
32#include <QLabel>
30 33
31class QPushButton; 34class QPushButton;
32class QFrame; 35class Q3Frame;
33class QLabel; 36class QLabel;
34 37
35class NavigatorBar: public QWidget 38class NavigatorBar: public QWidget
36{ 39{
37 Q_OBJECT 40 Q_OBJECT
38 public: 41 public:
39 NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 ); 42 NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 );
40 ~NavigatorBar(); 43 ~NavigatorBar();
41 void showButtons( bool left, bool right ); 44 void showButtons( bool left, bool right );
42 void resetFont ( QFont fo ); 45 void resetFont ( QFont fo );
43 QSize sizeHint() const; 46 QSize sizeHint() const;
44 QSize sizeHintTwoButtons( int butNum = 2 ) const; 47 QSize sizeHintTwoButtons( int butNum = 2 ) const;
45 48
46 public slots: 49 public slots:
47 void selectDates( const KCal::DateList & ); 50 void selectDates( const KCal::DateList & );
48 void selectMonth(); 51 void selectMonth();
49 52
50 signals: 53 signals:
51 void goNextMonth(); 54 void goNextMonth();
52 void goPrevMonth(); 55 void goPrevMonth();
53 void goNextWeek(); 56 void goNextWeek();
54 void goPrevWeek(); 57 void goPrevWeek();
55 void goNextYear(); 58 void goNextYear();
56 void goPrevYear(); 59 void goPrevYear();
57 void monthSelected( int ); 60 void monthSelected( int );
58 61
59 private: 62 private:
60 int mCurrentHei; 63 int mCurrentHei;
61 int mCurrentMinWid; 64 int mCurrentMinWid;
62 int mCurrentButtonMinWid; 65 int mCurrentButtonMinWid;
63 QFrame *mCtrlFrame; 66 Q3Frame *mCtrlFrame;
64 67
65 QPushButton *mPrevYear; 68 QPushButton *mPrevYear;
66 QPushButton *mPrevMonth; 69 QPushButton *mPrevMonth;
67 QPushButton *mNextMonth; 70 QPushButton *mNextMonth;
68 QPushButton *mPrevWeek; 71 QPushButton *mPrevWeek;
69 QPushButton *mNextWeek; 72 QPushButton *mNextWeek;
70 QPushButton *mNextYear; 73 QPushButton *mNextYear;
71 QPushButton *mSelectMonth; 74 QPushButton *mSelectMonth;
72 75
73 //QLabel *mDateLabel; 76 //QLabel *mDateLabel;
74}; 77};
75 78
76#endif 79#endif
diff --git a/korganizer/outgoingdialog.cpp b/korganizer/outgoingdialog.cpp
index 7253c8e..ab31274 100644
--- a/korganizer/outgoingdialog.cpp
+++ b/korganizer/outgoingdialog.cpp
@@ -8,59 +8,59 @@
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <kdebug.h> 20#include <kdebug.h>
21 21
22#include <qfile.h> 22#include <qfile.h>
23#include <qdir.h> 23#include <qdir.h>
24#include <qtextstream.h> 24#include <q3textstream.h>
25 25
26#include <kglobal.h> 26#include <kglobal.h>
27#include <klocale.h> 27#include <klocale.h>
28#include <ktempfile.h> 28#include <ktempfile.h>
29#include <kstandarddirs.h> 29#include <kstandarddirs.h>
30 30
31#include <libkcal/event.h> 31#include <libkcal/event.h>
32#include <libkcal/freebusy.h> 32#include <libkcal/freebusy.h>
33//#include <libkcal/imipscheduler.h> 33//#include <libkcal/imipscheduler.h>
34#include <libkcal/dummyscheduler.h> 34#include <libkcal/dummyscheduler.h>
35#include <libkcal/icalformat.h> 35#include <libkcal/icalformat.h>
36#include <libkcal/calendar.h> 36#include <libkcal/calendar.h>
37 37
38#ifndef KORG_NOMAIL 38#ifndef KORG_NOMAIL
39#include "mailscheduler.h" 39#include "mailscheduler.h"
40#endif 40#endif
41 41
42#include "koprefs.h" 42#include "koprefs.h"
43#include "outgoingdialog.h" 43#include "outgoingdialog.h"
44#include "koeventviewerdialog.h" 44#include "koeventviewerdialog.h"
45#include "docprefs.h" 45#include "docprefs.h"
46 46
47ScheduleItemOut::ScheduleItemOut(QListView *parent,IncidenceBase *ev, 47ScheduleItemOut::ScheduleItemOut(Q3ListView *parent,IncidenceBase *ev,
48 Scheduler::Method method, 48 Scheduler::Method method,
49 const QString &recipients) 49 const QString &recipients)
50 : QListViewItem(parent) 50 : Q3ListViewItem(parent)
51{ 51{
52 mIncidence = ev; 52 mIncidence = ev;
53 mMethod = method; 53 mMethod = method;
54 mRecipients = recipients; 54 mRecipients = recipients;
55 55
56// kdDebug() << "ScheduleItemOut: setting the summary" << endl; 56// kdDebug() << "ScheduleItemOut: setting the summary" << endl;
57 //Set the summary 57 //Set the summary
58 if(ev->typeID() != freebusyID ) { 58 if(ev->typeID() != freebusyID ) {
59 Incidence *incidence = static_cast<Incidence *>(ev); 59 Incidence *incidence = static_cast<Incidence *>(ev);
60 setText(0,incidence->summary()); 60 setText(0,incidence->summary());
61 } else { 61 } else {
62 setText(0,i18n("Free Busy Object")); 62 setText(0,i18n("Free Busy Object"));
63 } 63 }
64 64
65// kdDebug() << "ScheduleItemOut: checking if the object is an event" << endl; 65// kdDebug() << "ScheduleItemOut: checking if the object is an event" << endl;
66 //If the object is an event 66 //If the object is an event
@@ -110,54 +110,54 @@ ScheduleItemOut::ScheduleItemOut(QListView *parent,IncidenceBase *ev,
110 FreeBusy *freebusy = static_cast<FreeBusy *>(ev); 110 FreeBusy *freebusy = static_cast<FreeBusy *>(ev);
111 111
112 setText(1,freebusy->dtStartDateStr()); 112 setText(1,freebusy->dtStartDateStr());
113 setText(2,freebusy->dtStartTimeStr()); 113 setText(2,freebusy->dtStartTimeStr());
114 //Must try and get this to the users local settings 114 //Must try and get this to the users local settings
115 setText(3,KGlobal::locale()->formatDate( freebusy->dtEnd().date() ) ); 115 setText(3,KGlobal::locale()->formatDate( freebusy->dtEnd().date() ) );
116 setText(4,KGlobal::locale()->formatTime( freebusy->dtEnd().time() ) ); 116 setText(4,KGlobal::locale()->formatTime( freebusy->dtEnd().time() ) );
117 } 117 }
118 118
119// kdDebug() << "ScheduleItemOut: Setting the method" << endl; 119// kdDebug() << "ScheduleItemOut: Setting the method" << endl;
120 //Set the Method 120 //Set the Method
121 setText(5,Scheduler::translatedMethodName(mMethod)); 121 setText(5,Scheduler::translatedMethodName(mMethod));
122} 122}
123 123
124OutgoingDialog::OutgoingDialog(Calendar *calendar,QWidget* parent, 124OutgoingDialog::OutgoingDialog(Calendar *calendar,QWidget* parent,
125 const char* name,bool modal, 125 const char* name,bool modal,
126 WFlags fl) 126 Qt::WFlags fl)
127 : OutgoingDialog_base(parent,name,modal,fl) 127 : OutgoingDialog_base(parent,name,modal,fl)
128{ 128{
129 mCalendar = calendar; 129 mCalendar = calendar;
130 130
131 mFormat = new ICalFormat; 131 mFormat = new ICalFormat;
132 132
133 if (KOPrefs::instance()->mIMIPScheduler == KOPrefs::IMIPDummy ) { 133 if (KOPrefs::instance()->mIMIPScheduler == KOPrefs::IMIPDummy ) {
134 mScheduler = new DummyScheduler(mCalendar); 134 mScheduler = new DummyScheduler(mCalendar);
135 } else { 135 } else {
136#ifndef KORG_NOMAIL 136#ifndef KORG_NOMAIL
137 mScheduler = new MailScheduler(mCalendar); 137 mScheduler = new MailScheduler(mCalendar);
138#else 138#else
139 mScheduler = new DummyScheduler(mCalendar); 139 mScheduler = new DummyScheduler(mCalendar);
140#endif 140#endif
141 } 141 }
142 mMessageListView->setColumnAlignment(1,AlignHCenter); 142 mMessageListView->setColumnAlignment(1,Qt::AlignHCenter);
143 mMessageListView->setColumnAlignment(2,AlignHCenter); 143 mMessageListView->setColumnAlignment(2,Qt::AlignHCenter);
144 mMessageListView->setColumnAlignment(3,AlignHCenter); 144 mMessageListView->setColumnAlignment(3,Qt::AlignHCenter);
145 mMessageListView->setColumnAlignment(4,AlignHCenter); 145 mMessageListView->setColumnAlignment(4,Qt::AlignHCenter);
146 QObject::connect(mMessageListView,SIGNAL(doubleClicked(QListViewItem *)), 146 QObject::connect(mMessageListView,SIGNAL(doubleClicked(Q3ListViewItem *)),
147 this,SLOT(showEvent(QListViewItem *))); 147 this,SLOT(showEvent(Q3ListViewItem *)));
148 mDocPrefs = new DocPrefs("groupschedule"); 148 mDocPrefs = new DocPrefs("groupschedule");
149 loadMessages(); 149 loadMessages();
150} 150}
151 151
152OutgoingDialog::~OutgoingDialog() 152OutgoingDialog::~OutgoingDialog()
153{ 153{
154 delete mDocPrefs; 154 delete mDocPrefs;
155 delete mFormat; 155 delete mFormat;
156} 156}
157 157
158bool OutgoingDialog::addMessage(IncidenceBase *incidence,Scheduler::Method method) 158bool OutgoingDialog::addMessage(IncidenceBase *incidence,Scheduler::Method method)
159{ 159{
160 kdDebug() << "Outgoing::addMessage" << "Method:" << method << endl; 160 kdDebug() << "Outgoing::addMessage" << "Method:" << method << endl;
161 if (method == Scheduler::Publish) return false; 161 if (method == Scheduler::Publish) return false;
162 if( mDocPrefs ) { 162 if( mDocPrefs ) {
163 if (method != Scheduler::Cancel) { 163 if (method != Scheduler::Cancel) {
@@ -223,33 +223,33 @@ void OutgoingDialog::send()
223 } 223 }
224 224
225 emit numMessagesChanged(mMessageListView->childCount()); 225 emit numMessagesChanged(mMessageListView->childCount());
226} 226}
227 227
228void OutgoingDialog::deleteItem() 228void OutgoingDialog::deleteItem()
229{ 229{
230 ScheduleItemOut *item = (ScheduleItemOut *)(mMessageListView->selectedItem()); 230 ScheduleItemOut *item = (ScheduleItemOut *)(mMessageListView->selectedItem());
231 if(!item) 231 if(!item)
232 return; 232 return;
233 deleteMessage(item->event()); 233 deleteMessage(item->event());
234 delete(item->event()); 234 delete(item->event());
235 mMessageListView->takeItem(item); 235 mMessageListView->takeItem(item);
236 emit numMessagesChanged(mMessageListView->childCount()); 236 emit numMessagesChanged(mMessageListView->childCount());
237} 237}
238 238
239void OutgoingDialog::showEvent(QListViewItem *qitem) 239void OutgoingDialog::showEvent(Q3ListViewItem *qitem)
240{ 240{
241 ScheduleItemOut *item = (ScheduleItemOut *)qitem; 241 ScheduleItemOut *item = (ScheduleItemOut *)qitem;
242 Event *event = 0; 242 Event *event = 0;
243 Todo *todo = 0; 243 Todo *todo = 0;
244 if ( item->event()->typeID() == eventID ) { 244 if ( item->event()->typeID() == eventID ) {
245 event = static_cast<Event *>(item->event()); 245 event = static_cast<Event *>(item->event());
246 } 246 }
247 if ( item->event()->typeID() == todoID ) { 247 if ( item->event()->typeID() == todoID ) {
248 todo = static_cast<Todo *>(item->event()); 248 todo = static_cast<Todo *>(item->event());
249 } 249 }
250 QString sendText; 250 QString sendText;
251 if (event || todo) { 251 if (event || todo) {
252 KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this); 252 KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this);
253 if (event) eventViewer->setEvent(event); 253 if (event) eventViewer->setEvent(event);
254 if (todo) eventViewer->setTodo(todo); 254 if (todo) eventViewer->setTodo(todo);
255 sendText = "<hr><h4>"+i18n("Event will be sent to:")+"</h4>"; 255 sendText = "<hr><h4>"+i18n("Event will be sent to:")+"</h4>";
@@ -281,33 +281,33 @@ void OutgoingDialog::showEvent(QListViewItem *qitem)
281 case Scheduler::NoMethod: { 281 case Scheduler::NoMethod: {
282 sendText += ""; 282 sendText += "";
283 break; } 283 break; }
284 default: 284 default:
285 sendText = ""; 285 sendText = "";
286 } 286 }
287 eventViewer->addText(sendText); 287 eventViewer->addText(sendText);
288 eventViewer->show(); 288 eventViewer->show();
289 } 289 }
290} 290}
291 291
292bool OutgoingDialog::saveMessage(IncidenceBase *incidence,Scheduler::Method method, 292bool OutgoingDialog::saveMessage(IncidenceBase *incidence,Scheduler::Method method,
293 const QString &recipients) 293 const QString &recipients)
294{ 294{
295 KTempFile ktfile(locateLocal("data","korganizer/outgoing/"),"ics"); 295 KTempFile ktfile(locateLocal("data","korganizer/outgoing/"),"ics");
296 QString messageText = mFormat->createScheduleMessage(incidence,method); 296 QString messageText = mFormat->createScheduleMessage(incidence,method);
297 QTextStream *qts = ktfile.textStream(); 297 Q3TextStream *qts = ktfile.textStream();
298 *qts << messageText; 298 *qts << messageText;
299 *qts << "METHOD-BEGIN:" << endl << method << endl << ":METHOD-END" << endl; 299 *qts << "METHOD-BEGIN:" << endl << method << endl << ":METHOD-END" << endl;
300 *qts << "RECIPIENTS-BEGIN:" << endl << recipients << endl << ":RECIPIENTS-END" << endl; 300 *qts << "RECIPIENTS-BEGIN:" << endl << recipients << endl << ":RECIPIENTS-END" << endl;
301 mMessageMap[incidence]=ktfile.name(); 301 mMessageMap[incidence]=ktfile.name();
302 302
303 return true; 303 return true;
304} 304}
305 305
306bool OutgoingDialog::deleteMessage(IncidenceBase *incidence) 306bool OutgoingDialog::deleteMessage(IncidenceBase *incidence)
307{ 307{
308 QFile f( mMessageMap[incidence] ); 308 QFile f( mMessageMap[incidence] );
309 mMessageMap.remove(incidence); 309 mMessageMap.remove(incidence);
310 if ( !f.exists() ) return false; 310 if ( !f.exists() ) return false;
311 else 311 else
312 return f.remove(); 312 return f.remove();
313} 313}
@@ -317,37 +317,37 @@ void OutgoingDialog::loadMessages()
317 Scheduler::Method method; 317 Scheduler::Method method;
318 QString recipients; 318 QString recipients;
319 319
320 QString outgoingDirName = locateLocal("data","korganizer/outgoing"); 320 QString outgoingDirName = locateLocal("data","korganizer/outgoing");
321 QDir outgoingDir(outgoingDirName); 321 QDir outgoingDir(outgoingDirName);
322 QStringList outgoing = outgoingDir.entryList(QDir::Files); 322 QStringList outgoing = outgoingDir.entryList(QDir::Files);
323 QStringList::ConstIterator it; 323 QStringList::ConstIterator it;
324 for(it = outgoing.begin(); it != outgoing.end(); ++it) { 324 for(it = outgoing.begin(); it != outgoing.end(); ++it) {
325 kdDebug() << "-- File: " << (*it) << endl; 325 kdDebug() << "-- File: " << (*it) << endl;
326 QFile f(outgoingDirName + "/" + (*it)); 326 QFile f(outgoingDirName + "/" + (*it));
327 bool inserted = false; 327 bool inserted = false;
328 QMap<IncidenceBase*, QString>::Iterator iter; 328 QMap<IncidenceBase*, QString>::Iterator iter;
329 for ( iter = mMessageMap.begin(); iter != mMessageMap.end(); ++iter ) { 329 for ( iter = mMessageMap.begin(); iter != mMessageMap.end(); ++iter ) {
330 if (iter.data() == outgoingDirName + "/" + (*it)) inserted = true; 330 if (iter.data() == outgoingDirName + "/" + (*it)) inserted = true;
331 } 331 }
332 if (!inserted) { 332 if (!inserted) {
333 if (!f.open(IO_ReadOnly)) { 333 if (!f.open(QIODevice::ReadOnly)) {
334 kdDebug() << "OutgoingDialog::loadMessage(): Can't open file'" 334 kdDebug() << "OutgoingDialog::loadMessage(): Can't open file'"
335 << (*it) << "'" << endl; 335 << (*it) << "'" << endl;
336 } else { 336 } else {
337 QTextStream t(&f); 337 Q3TextStream t(&f);
338 QString messageString = t.read(); 338 QString messageString = t.read();
339 ScheduleMessage *message = mFormat->parseScheduleMessage(mCalendar, 339 ScheduleMessage *message = mFormat->parseScheduleMessage(mCalendar,
340 messageString); 340 messageString);
341 int begin_pos = messageString.find("METHOD-BEGIN:"); 341 int begin_pos = messageString.find("METHOD-BEGIN:");
342 begin_pos = messageString.find('\n',begin_pos)+1; 342 begin_pos = messageString.find('\n',begin_pos)+1;
343 QString meth = messageString.mid(begin_pos,1); 343 QString meth = messageString.mid(begin_pos,1);
344 switch (meth.toInt()) { 344 switch (meth.toInt()) {
345 case 0:method=Scheduler::Publish; break; 345 case 0:method=Scheduler::Publish; break;
346 case 1:method=Scheduler::Request; break; 346 case 1:method=Scheduler::Request; break;
347 case 2:method=Scheduler::Refresh; break; 347 case 2:method=Scheduler::Refresh; break;
348 case 3:method=Scheduler::Cancel; break; 348 case 3:method=Scheduler::Cancel; break;
349 case 4:method=Scheduler::Add; break; 349 case 4:method=Scheduler::Add; break;
350 case 5:method=Scheduler::Reply; break; 350 case 5:method=Scheduler::Reply; break;
351 case 6:method=Scheduler::Counter; break; 351 case 6:method=Scheduler::Counter; break;
352 case 7:method=Scheduler::Declinecounter; break; 352 case 7:method=Scheduler::Declinecounter; break;
353 default :method=Scheduler::NoMethod; break; 353 default :method=Scheduler::NoMethod; break;
diff --git a/korganizer/outgoingdialog.h b/korganizer/outgoingdialog.h
index a3d561a..e727087 100644
--- a/korganizer/outgoingdialog.h
+++ b/korganizer/outgoingdialog.h
@@ -10,79 +10,79 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef OUTGOINGDIALOG_H 23#ifndef OUTGOINGDIALOG_H
24#define OUTGOINGDIALOG_H 24#define OUTGOINGDIALOG_H
25 25
26#include <qlistview.h> 26#include <q3listview.h>
27#include <qmap.h> 27#include <qmap.h>
28#include <qstring.h> 28#include <qstring.h>
29 29
30#include <libkcal/scheduler.h> 30#include <libkcal/scheduler.h>
31 31
32#include "docprefs.h" 32#include "docprefs.h"
33#include "outgoingdialog_base.h" 33#include "outgoingdialog_base.h"
34 34
35using namespace KCal; 35using namespace KCal;
36 36
37class ScheduleItemOut : public QListViewItem 37class ScheduleItemOut : public Q3ListViewItem
38{ 38{
39 public: 39 public:
40 ScheduleItemOut(QListView *parent,IncidenceBase *ev, 40 ScheduleItemOut(Q3ListView *parent,IncidenceBase *ev,
41 Scheduler::Method method, const QString &recipients=QString::null); 41 Scheduler::Method method, const QString &recipients=QString::null);
42 virtual ~ScheduleItemOut() {} 42 virtual ~ScheduleItemOut() {}
43 43
44 IncidenceBase *event() { return mIncidence; } 44 IncidenceBase *event() { return mIncidence; }
45 Scheduler::Method method() { return mMethod; } 45 Scheduler::Method method() { return mMethod; }
46 QString recipients() { return mRecipients; } 46 QString recipients() { return mRecipients; }
47 47
48 private: 48 private:
49 IncidenceBase *mIncidence; 49 IncidenceBase *mIncidence;
50 Scheduler::Method mMethod; 50 Scheduler::Method mMethod;
51 QString mRecipients; 51 QString mRecipients;
52}; 52};
53 53
54class OutgoingDialog : public OutgoingDialog_base 54class OutgoingDialog : public OutgoingDialog_base
55{ 55{
56 Q_OBJECT 56 Q_OBJECT
57 public: 57 public:
58 OutgoingDialog(Calendar *,QWidget* parent=0,const char* name=0, 58 OutgoingDialog(Calendar *,QWidget* parent=0,const char* name=0,
59 bool modal=false,WFlags fl=0); 59 bool modal=false,Qt::WFlags fl=0);
60 ~OutgoingDialog(); 60 ~OutgoingDialog();
61 61
62 bool addMessage(IncidenceBase *,Scheduler::Method); 62 bool addMessage(IncidenceBase *,Scheduler::Method);
63 bool addMessage(IncidenceBase *,Scheduler::Method,const QString &recipients); 63 bool addMessage(IncidenceBase *,Scheduler::Method,const QString &recipients);
64 void setDocumentId( const QString &id ); 64 void setDocumentId( const QString &id );
65 65
66 public slots: 66 public slots:
67 void loadMessages(); 67 void loadMessages();
68 68
69 signals: 69 signals:
70 void numMessagesChanged(int); 70 void numMessagesChanged(int);
71 71
72 protected slots: 72 protected slots:
73 void send(); 73 void send();
74 void deleteItem(); 74 void deleteItem();
75 void showEvent(QListViewItem *); 75 void showEvent(Q3ListViewItem *);
76 76
77 private: 77 private:
78 bool saveMessage(IncidenceBase *,Scheduler::Method,const QString &recipients=0); 78 bool saveMessage(IncidenceBase *,Scheduler::Method,const QString &recipients=0);
79 bool deleteMessage(IncidenceBase *); 79 bool deleteMessage(IncidenceBase *);
80 80
81 Calendar *mCalendar; 81 Calendar *mCalendar;
82 ICalFormat *mFormat; 82 ICalFormat *mFormat;
83 Scheduler *mScheduler; 83 Scheduler *mScheduler;
84 QMap<IncidenceBase*, QString> mMessageMap; 84 QMap<IncidenceBase*, QString> mMessageMap;
85 DocPrefs *mDocPrefs; 85 DocPrefs *mDocPrefs;
86}; 86};
87 87
88#endif // OUTGOINGDIALOG_H 88#endif // OUTGOINGDIALOG_H
diff --git a/korganizer/outgoingdialog_base.cpp b/korganizer/outgoingdialog_base.cpp
index 1873b44..be8a870 100644
--- a/korganizer/outgoingdialog_base.cpp
+++ b/korganizer/outgoingdialog_base.cpp
@@ -1,60 +1,62 @@
1#include <klocale.h> 1#include <klocale.h>
2/**************************************************************************** 2/****************************************************************************
3** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/outgoingdialog_base.ui' 3** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/outgoingdialog_base.ui'
4** 4**
5** Created: Sat Mar 29 22:31:21 2003 5** Created: Sat Mar 29 22:31:21 2003
6** by: The User Interface Compiler () 6** by: The User Interface Compiler ()
7** 7**
8** WARNING! All changes made in this file will be lost! 8** WARNING! All changes made in this file will be lost!
9****************************************************************************/ 9****************************************************************************/
10 10
11#include "outgoingdialog_base.h" 11#include "outgoingdialog_base.h"
12 12
13#include <qvariant.h> 13#include <qvariant.h>
14#include <qheader.h> 14#include <q3header.h>
15#include <qlistview.h> 15#include <q3listview.h>
16#include <qpushbutton.h> 16#include <qpushbutton.h>
17#include <qlayout.h> 17#include <qlayout.h>
18#include <qtooltip.h> 18#include <qtooltip.h>
19#include <qwhatsthis.h> 19#include <q3whatsthis.h>
20//Added by qt3to4:
21#include <Q3GridLayout>
20 22
21/* 23/*
22 * Constructs a OutgoingDialog_base as a child of 'parent', with the 24 * Constructs a OutgoingDialog_base as a child of 'parent', with the
23 * name 'name' and widget flags set to 'f'. 25 * name 'name' and widget flags set to 'f'.
24 * 26 *
25 * The dialog will by default be modeless, unless you set 'modal' to 27 * The dialog will by default be modeless, unless you set 'modal' to
26 * TRUE to construct a modal dialog. 28 * TRUE to construct a modal dialog.
27 */ 29 */
28OutgoingDialog_base::OutgoingDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl ) 30OutgoingDialog_base::OutgoingDialog_base( QWidget* parent, const char* name, bool modal, Qt::WFlags fl )
29 : QDialog( parent, name, modal, fl ) 31 : QDialog( parent, name, modal, fl )
30 32
31{ 33{
32 if ( !name ) 34 if ( !name )
33 setName( "OutgoingDialog_base" ); 35 setName( "OutgoingDialog_base" );
34 OutgoingDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "OutgoingDialog_baseLayout"); 36 OutgoingDialog_baseLayout = new Q3GridLayout( this, 1, 1, 11, 6, "OutgoingDialog_baseLayout");
35 37
36 mMessageListView = new QListView( this, "mMessageListView" ); 38 mMessageListView = new Q3ListView( this, "mMessageListView" );
37 mMessageListView->addColumn( tr2i18n( "Summary" ) ); 39 mMessageListView->addColumn( tr2i18n( "Summary" ) );
38 mMessageListView->addColumn( tr2i18n( "Start Date" ) ); 40 mMessageListView->addColumn( tr2i18n( "Start Date" ) );
39 mMessageListView->addColumn( tr2i18n( "Start Time" ) ); 41 mMessageListView->addColumn( tr2i18n( "Start Time" ) );
40 mMessageListView->addColumn( tr2i18n( "End Date" ) ); 42 mMessageListView->addColumn( tr2i18n( "End Date" ) );
41 mMessageListView->addColumn( tr2i18n( "End Time" ) ); 43 mMessageListView->addColumn( tr2i18n( "End Time" ) );
42 mMessageListView->addColumn( tr2i18n( "Method" ) ); 44 mMessageListView->addColumn( tr2i18n( "Method" ) );
43 mMessageListView->setFrameShape( QListView::StyledPanel ); 45 mMessageListView->setFrameShape( Q3ListView::StyledPanel );
44 mMessageListView->setFrameShadow( QListView::Sunken ); 46 mMessageListView->setFrameShadow( Q3ListView::Sunken );
45 mMessageListView->setAllColumnsShowFocus( TRUE ); 47 mMessageListView->setAllColumnsShowFocus( TRUE );
46 48
47 OutgoingDialog_baseLayout->addMultiCellWidget( mMessageListView, 0, 3, 0, 0 ); 49 OutgoingDialog_baseLayout->addMultiCellWidget( mMessageListView, 0, 3, 0, 0 );
48 50
49 PushButton5 = new QPushButton( this, "PushButton5" ); 51 PushButton5 = new QPushButton( this, "PushButton5" );
50 PushButton5->setDefault( FALSE ); 52 PushButton5->setDefault( FALSE );
51 53
52 OutgoingDialog_baseLayout->addWidget( PushButton5, 0, 1 ); 54 OutgoingDialog_baseLayout->addWidget( PushButton5, 0, 1 );
53 55
54 PushButton7 = new QPushButton( this, "PushButton7" ); 56 PushButton7 = new QPushButton( this, "PushButton7" );
55 57
56 OutgoingDialog_baseLayout->addWidget( PushButton7, 1, 1 ); 58 OutgoingDialog_baseLayout->addWidget( PushButton7, 1, 1 );
57 59
58 PushButton6 = new QPushButton( this, "PushButton6" ); 60 PushButton6 = new QPushButton( this, "PushButton6" );
59 PushButton6->setDefault( TRUE ); 61 PushButton6->setDefault( TRUE );
60 62
diff --git a/korganizer/outgoingdialog_base.h b/korganizer/outgoingdialog_base.h
index af71bb1..5e81725 100644
--- a/korganizer/outgoingdialog_base.h
+++ b/korganizer/outgoingdialog_base.h
@@ -1,47 +1,51 @@
1/**************************************************************************** 1/****************************************************************************
2** Form interface generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/outgoingdialog_base.ui' 2** Form interface generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/outgoingdialog_base.ui'
3** 3**
4** Created: Sat Mar 29 22:24:26 2003 4** Created: Sat Mar 29 22:24:26 2003
5** by: The User Interface Compiler () 5** by: The User Interface Compiler ()
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9 9
10#ifndef OUTGOINGDIALOG_BASE_H 10#ifndef OUTGOINGDIALOG_BASE_H
11#define OUTGOINGDIALOG_BASE_H 11#define OUTGOINGDIALOG_BASE_H
12 12
13#include <qvariant.h> 13#include <qvariant.h>
14#include <qdialog.h> 14#include <qdialog.h>
15 15//Added by qt3to4:
16class QVBoxLayout; 16#include <Q3GridLayout>
17class QHBoxLayout; 17#include <Q3HBoxLayout>
18class QGridLayout; 18#include <Q3VBoxLayout>
19class QListView; 19
20class QListViewItem; 20class Q3VBoxLayout;
21class Q3HBoxLayout;
22class Q3GridLayout;
23class Q3ListView;
24class Q3ListViewItem;
21class QPushButton; 25class QPushButton;
22 26
23class OutgoingDialog_base : public QDialog 27class OutgoingDialog_base : public QDialog
24{ 28{
25 Q_OBJECT 29 Q_OBJECT
26 30
27public: 31public:
28 OutgoingDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 32 OutgoingDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
29 ~OutgoingDialog_base(); 33 ~OutgoingDialog_base();
30 34
31 QListView* mMessageListView; 35 Q3ListView* mMessageListView;
32 QPushButton* PushButton5; 36 QPushButton* PushButton5;
33 QPushButton* PushButton7; 37 QPushButton* PushButton7;
34 QPushButton* PushButton6; 38 QPushButton* PushButton6;
35 39
36protected: 40protected:
37 QGridLayout* OutgoingDialog_baseLayout; 41 Q3GridLayout* OutgoingDialog_baseLayout;
38 42
39protected slots: 43protected slots:
40 virtual void languageChange(); 44 virtual void languageChange();
41 45
42 virtual void send(); 46 virtual void send();
43 virtual void deleteItem(); 47 virtual void deleteItem();
44 48
45}; 49};
46 50
47#endif // OUTGOINGDIALOG_BASE_H 51#endif // OUTGOINGDIALOG_BASE_H
diff --git a/korganizer/publishdialog.cpp b/korganizer/publishdialog.cpp
index 2ae6720..ede9840 100644
--- a/korganizer/publishdialog.cpp
+++ b/korganizer/publishdialog.cpp
@@ -22,130 +22,130 @@
22*/ 22*/
23 23
24#include <qlineedit.h> 24#include <qlineedit.h>
25#include <kdebug.h> 25#include <kdebug.h>
26 26
27#include <kglobal.h> 27#include <kglobal.h>
28#include <klocale.h> 28#include <klocale.h>
29#ifndef KORG_NOKABC 29#ifndef KORG_NOKABC
30#define KORG_NOKABC 30#define KORG_NOKABC
31//#include <kabc/addresseedialog.h> 31//#include <kabc/addresseedialog.h>
32#endif 32#endif
33 33
34#include "koprefs.h" 34#include "koprefs.h"
35#include "publishdialog.h" 35#include "publishdialog.h"
36 36
37PublishDialog::PublishDialog(QWidget* parent, const char* name, 37PublishDialog::PublishDialog(QWidget* parent, const char* name,
38 bool modal, WFlags fl) 38 bool modal, Qt::WFlags fl)
39 : PublishDialog_base(parent,name,modal,fl) 39 : PublishDialog_base(parent,name,modal,fl)
40{ 40{
41 setCaption(i18n("Select Addresses")); 41 setCaption(i18n("Select Addresses"));
42 mNameLineEdit->setEnabled(false); 42 mNameLineEdit->setEnabled(false);
43 mEmailLineEdit->setEnabled(false); 43 mEmailLineEdit->setEnabled(false);
44 connect(mAddressListView,SIGNAL(selectionChanged(QListViewItem *)), 44 connect(mAddressListView,SIGNAL(selectionChanged(Q3ListViewItem *)),
45 SLOT(updateInput())); 45 SLOT(updateInput()));
46} 46}
47 47
48PublishDialog::~PublishDialog() 48PublishDialog::~PublishDialog()
49{ 49{
50} 50}
51 51
52void PublishDialog::addAttendee(Attendee *attendee) 52void PublishDialog::addAttendee(Attendee *attendee)
53{ 53{
54 mNameLineEdit->setEnabled(true); 54 mNameLineEdit->setEnabled(true);
55 mEmailLineEdit->setEnabled(true); 55 mEmailLineEdit->setEnabled(true);
56 QListViewItem *item = new QListViewItem(mAddressListView); 56 Q3ListViewItem *item = new Q3ListViewItem(mAddressListView);
57 item->setText(0,attendee->name()); 57 item->setText(0,attendee->name());
58 item->setText(1,attendee->email()); 58 item->setText(1,attendee->email());
59 mAddressListView->insertItem(item); 59 mAddressListView->insertItem(item);
60} 60}
61 61
62QString PublishDialog::addresses() 62QString PublishDialog::addresses()
63{ 63{
64 QString to = ""; 64 QString to = "";
65 QListViewItem *item; 65 Q3ListViewItem *item;
66 int i, count; 66 int i, count;
67 count = mAddressListView->childCount(); 67 count = mAddressListView->childCount();
68 for (i=0;i<count;i++) { 68 for (i=0;i<count;i++) {
69 item = mAddressListView->firstChild(); 69 item = mAddressListView->firstChild();
70 mAddressListView->takeItem(item); 70 mAddressListView->takeItem(item);
71 to += item->text(1); 71 to += item->text(1);
72 if (i<count-1) { 72 if (i<count-1) {
73 to += ", "; 73 to += ", ";
74 } 74 }
75 } 75 }
76 return to; 76 return to;
77} 77}
78 78
79void PublishDialog::addItem() 79void PublishDialog::addItem()
80{ 80{
81 mNameLineEdit->setEnabled(true); 81 mNameLineEdit->setEnabled(true);
82 mEmailLineEdit->setEnabled(true); 82 mEmailLineEdit->setEnabled(true);
83 QListViewItem *item = new QListViewItem(mAddressListView); 83 Q3ListViewItem *item = new Q3ListViewItem(mAddressListView);
84 mAddressListView->insertItem(item); 84 mAddressListView->insertItem(item);
85 mAddressListView->setSelected(item,true); 85 mAddressListView->setSelected(item,true);
86 mNameLineEdit->setText(i18n("(EmptyName)")); 86 mNameLineEdit->setText(i18n("(EmptyName)"));
87 mEmailLineEdit->setText(i18n("(EmptyEmail)")); 87 mEmailLineEdit->setText(i18n("(EmptyEmail)"));
88} 88}
89 89
90void PublishDialog::removeItem() 90void PublishDialog::removeItem()
91{ 91{
92 QListViewItem *item; 92 Q3ListViewItem *item;
93 item = mAddressListView->selectedItem(); 93 item = mAddressListView->selectedItem();
94 if (!item) return; 94 if (!item) return;
95 mAddressListView->takeItem(item); 95 mAddressListView->takeItem(item);
96 item = mAddressListView->selectedItem(); 96 item = mAddressListView->selectedItem();
97 if (!item) { 97 if (!item) {
98 mNameLineEdit->setText(""); 98 mNameLineEdit->setText("");
99 mEmailLineEdit->setText(""); 99 mEmailLineEdit->setText("");
100 mNameLineEdit->setEnabled(false); 100 mNameLineEdit->setEnabled(false);
101 mEmailLineEdit->setEnabled(false); 101 mEmailLineEdit->setEnabled(false);
102 } 102 }
103 if (mAddressListView->childCount() == 0) { 103 if (mAddressListView->childCount() == 0) {
104 mNameLineEdit->setEnabled(false); 104 mNameLineEdit->setEnabled(false);
105 mEmailLineEdit->setEnabled(false); 105 mEmailLineEdit->setEnabled(false);
106 } 106 }
107} 107}
108 108
109void PublishDialog::openAddressbook() 109void PublishDialog::openAddressbook()
110{ 110{
111#ifndef KORG_NOKABC 111#ifndef KORG_NOKABC
112 KABC::Addressee::List addressList; 112 KABC::Addressee::List addressList;
113 addressList = KABC::AddresseeDialog::getAddressees(this); 113 addressList = KABC::AddresseeDialog::getAddressees(this);
114 //KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); 114 //KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this);
115 KABC::Addressee a = addressList.first(); 115 KABC::Addressee a = addressList.first();
116 if (!a.isEmpty()) { 116 if (!a.isEmpty()) {
117 uint i; 117 uint i;
118 for (i=0;i<addressList.count();i++) { 118 for (i=0;i<addressList.count();i++) {
119 a = addressList[i]; 119 a = addressList[i];
120 mNameLineEdit->setEnabled(true); 120 mNameLineEdit->setEnabled(true);
121 mEmailLineEdit->setEnabled(true); 121 mEmailLineEdit->setEnabled(true);
122 QListViewItem *item = new QListViewItem(mAddressListView); 122 Q3ListViewItem *item = new Q3ListViewItem(mAddressListView);
123 mAddressListView->setSelected(item,true); 123 mAddressListView->setSelected(item,true);
124 mNameLineEdit->setText(a.realName()); 124 mNameLineEdit->setText(a.realName());
125 mEmailLineEdit->setText(a.preferredEmail()); 125 mEmailLineEdit->setText(a.preferredEmail());
126 mAddressListView->insertItem(item); 126 mAddressListView->insertItem(item);
127 } 127 }
128 } 128 }
129#endif 129#endif
130} 130}
131 131
132void PublishDialog::updateItem() 132void PublishDialog::updateItem()
133{ 133{
134 QListViewItem *item; 134 Q3ListViewItem *item;
135 item = mAddressListView->selectedItem(); 135 item = mAddressListView->selectedItem();
136 if (!item) return; 136 if (!item) return;
137 item->setText(0,mNameLineEdit->text()); 137 item->setText(0,mNameLineEdit->text());
138 item->setText(1,mEmailLineEdit->text()); 138 item->setText(1,mEmailLineEdit->text());
139} 139}
140 140
141void PublishDialog::updateInput() 141void PublishDialog::updateInput()
142{ 142{
143 QListViewItem *item; 143 Q3ListViewItem *item;
144 item = mAddressListView->selectedItem(); 144 item = mAddressListView->selectedItem();
145 if (!item) return; 145 if (!item) return;
146 mNameLineEdit->setEnabled(true); 146 mNameLineEdit->setEnabled(true);
147 mEmailLineEdit->setEnabled(true); 147 mEmailLineEdit->setEnabled(true);
148 QString mail = item->text(1); 148 QString mail = item->text(1);
149 mNameLineEdit->setText(item->text(0)); 149 mNameLineEdit->setText(item->text(0));
150 mEmailLineEdit->setText(mail); 150 mEmailLineEdit->setText(mail);
151} 151}
diff --git a/korganizer/publishdialog.h b/korganizer/publishdialog.h
index 338603c..3ffeec4 100644
--- a/korganizer/publishdialog.h
+++ b/korganizer/publishdialog.h
@@ -10,45 +10,45 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef PUBLISHDIALOG_H 23#ifndef PUBLISHDIALOG_H
24#define PUBLISHDIALOG_H 24#define PUBLISHDIALOG_H
25 25
26#include <qlistview.h> 26#include <q3listview.h>
27#include <libkcal/attendee.h> 27#include <libkcal/attendee.h>
28 28
29#include "publishdialog_base.h" 29#include "publishdialog_base.h"
30 30
31using namespace KCal; 31using namespace KCal;
32 32
33class PublishDialog : public PublishDialog_base 33class PublishDialog : public PublishDialog_base
34{ 34{
35 Q_OBJECT 35 Q_OBJECT
36 public: 36 public:
37 PublishDialog(QWidget* parent=0,const char* name=0, 37 PublishDialog(QWidget* parent=0,const char* name=0,
38 bool modal=true,WFlags fl=0); 38 bool modal=true,Qt::WFlags fl=0);
39 ~PublishDialog(); 39 ~PublishDialog();
40 40
41 void addAttendee(Attendee *attendee); 41 void addAttendee(Attendee *attendee);
42 QString addresses(); 42 QString addresses();
43 43
44 signals: 44 signals:
45 void numMessagesChanged(int); 45 void numMessagesChanged(int);
46 46
47 protected slots: 47 protected slots:
48 void addItem(); 48 void addItem();
49 void removeItem(); 49 void removeItem();
50 void openAddressbook(); 50 void openAddressbook();
51 void updateItem(); 51 void updateItem();
52 void updateInput(); 52 void updateInput();
53}; 53};
54 54
diff --git a/korganizer/publishdialog_base.cpp b/korganizer/publishdialog_base.cpp
index 683f7e9..ce5c542 100644
--- a/korganizer/publishdialog_base.cpp
+++ b/korganizer/publishdialog_base.cpp
@@ -1,55 +1,58 @@
1#include <klocale.h> 1#include <klocale.h>
2/**************************************************************************** 2/****************************************************************************
3** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/publishdialog_base.ui' 3** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/publishdialog_base.ui'
4** 4**
5** Created: Sat Mar 29 22:31:35 2003 5** Created: Sat Mar 29 22:31:35 2003
6** by: The User Interface Compiler () 6** by: The User Interface Compiler ()
7** 7**
8** WARNING! All changes made in this file will be lost! 8** WARNING! All changes made in this file will be lost!
9****************************************************************************/ 9****************************************************************************/
10 10
11#include "publishdialog_base.h" 11#include "publishdialog_base.h"
12 12
13#include <qvariant.h> 13#include <qvariant.h>
14#include <qframe.h> 14#include <q3frame.h>
15#include <qheader.h> 15#include <q3header.h>
16#include <qlabel.h> 16#include <qlabel.h>
17#include <qlineedit.h> 17#include <qlineedit.h>
18#include <qlistview.h> 18#include <q3listview.h>
19#include <qpushbutton.h> 19#include <qpushbutton.h>
20#include <qlayout.h> 20#include <qlayout.h>
21#include <qtooltip.h> 21#include <qtooltip.h>
22#include <qwhatsthis.h> 22#include <q3whatsthis.h>
23//Added by qt3to4:
24#include <Q3GridLayout>
25#include <Q3HBoxLayout>
23 26
24/* 27/*
25 * Constructs a PublishDialog_base as a child of 'parent', with the 28 * Constructs a PublishDialog_base as a child of 'parent', with the
26 * name 'name' and widget flags set to 'f'. 29 * name 'name' and widget flags set to 'f'.
27 * 30 *
28 * The dialog will by default be modeless, unless you set 'modal' to 31 * The dialog will by default be modeless, unless you set 'modal' to
29 * TRUE to construct a modal dialog. 32 * TRUE to construct a modal dialog.
30 */ 33 */
31PublishDialog_base::PublishDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl ) 34PublishDialog_base::PublishDialog_base( QWidget* parent, const char* name, bool modal, Qt::WFlags fl )
32 : QDialog( parent, name, modal, fl ) 35 : QDialog( parent, name, modal, fl )
33 36
34{ 37{
35 if ( !name ) 38 if ( !name )
36 setName( "PublishDialog_base" ); 39 setName( "PublishDialog_base" );
37 PublishDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "PublishDialog_baseLayout"); 40 PublishDialog_baseLayout = new Q3GridLayout( this, 1, 1, 11, 6, "PublishDialog_baseLayout");
38 41
39 mAddressListView = new QListView( this, "mAddressListView" ); 42 mAddressListView = new Q3ListView( this, "mAddressListView" );
40 mAddressListView->addColumn( tr2i18n( "Name" ) ); 43 mAddressListView->addColumn( tr2i18n( "Name" ) );
41 mAddressListView->addColumn( tr2i18n( "Email" ) ); 44 mAddressListView->addColumn( tr2i18n( "Email" ) );
42 45
43 PublishDialog_baseLayout->addMultiCellWidget( mAddressListView, 0, 3, 0, 1 ); 46 PublishDialog_baseLayout->addMultiCellWidget( mAddressListView, 0, 3, 0, 1 );
44 47
45 TextLabel1 = new QLabel( this, "TextLabel1" ); 48 TextLabel1 = new QLabel( this, "TextLabel1" );
46 49
47 PublishDialog_baseLayout->addWidget( TextLabel1, 4, 0 ); 50 PublishDialog_baseLayout->addWidget( TextLabel1, 4, 0 );
48 51
49 TextLabel2 = new QLabel( this, "TextLabel2" ); 52 TextLabel2 = new QLabel( this, "TextLabel2" );
50 53
51 PublishDialog_baseLayout->addWidget( TextLabel2, 5, 0 ); 54 PublishDialog_baseLayout->addWidget( TextLabel2, 5, 0 );
52 55
53 mEmailLineEdit = new QLineEdit( this, "mEmailLineEdit" ); 56 mEmailLineEdit = new QLineEdit( this, "mEmailLineEdit" );
54 57
55 PublishDialog_baseLayout->addWidget( mEmailLineEdit, 5, 1 ); 58 PublishDialog_baseLayout->addWidget( mEmailLineEdit, 5, 1 );
@@ -59,40 +62,40 @@ PublishDialog_base::PublishDialog_base( QWidget* parent, const char* name, bool
59 PublishDialog_baseLayout->addWidget( mNameLineEdit, 4, 1 ); 62 PublishDialog_baseLayout->addWidget( mNameLineEdit, 4, 1 );
60 63
61 PushButton10 = new QPushButton( this, "PushButton10" ); 64 PushButton10 = new QPushButton( this, "PushButton10" );
62 65
63 PublishDialog_baseLayout->addWidget( PushButton10, 0, 2 ); 66 PublishDialog_baseLayout->addWidget( PushButton10, 0, 2 );
64 67
65 PushButton12 = new QPushButton( this, "PushButton12" ); 68 PushButton12 = new QPushButton( this, "PushButton12" );
66 69
67 PublishDialog_baseLayout->addWidget( PushButton12, 2, 2 ); 70 PublishDialog_baseLayout->addWidget( PushButton12, 2, 2 );
68 71
69 PushButton11 = new QPushButton( this, "PushButton11" ); 72 PushButton11 = new QPushButton( this, "PushButton11" );
70 73
71 PublishDialog_baseLayout->addWidget( PushButton11, 1, 2 ); 74 PublishDialog_baseLayout->addWidget( PushButton11, 1, 2 );
72 QSpacerItem* spacer = new QSpacerItem( 20, 241, QSizePolicy::Minimum, QSizePolicy::Expanding ); 75 QSpacerItem* spacer = new QSpacerItem( 20, 241, QSizePolicy::Minimum, QSizePolicy::Expanding );
73 PublishDialog_baseLayout->addMultiCell( spacer, 3, 5, 2, 2 ); 76 PublishDialog_baseLayout->addMultiCell( spacer, 3, 5, 2, 2 );
74 77
75 Line2 = new QFrame( this, "Line2" ); 78 Line2 = new Q3Frame( this, "Line2" );
76 Line2->setFrameShape( QFrame::HLine ); 79 Line2->setFrameShape( Q3Frame::HLine );
77 Line2->setFrameShadow( QFrame::Sunken ); 80 Line2->setFrameShadow( Q3Frame::Sunken );
78 Line2->setFrameShape( QFrame::HLine ); 81 Line2->setFrameShape( Q3Frame::HLine );
79 82
80 PublishDialog_baseLayout->addMultiCellWidget( Line2, 6, 6, 0, 2 ); 83 PublishDialog_baseLayout->addMultiCellWidget( Line2, 6, 6, 0, 2 );
81 84
82 layout95 = new QHBoxLayout( 0, 0, 6, "layout95"); 85 layout95 = new Q3HBoxLayout( 0, 0, 6, "layout95");
83 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); 86 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
84 layout95->addItem( spacer_2 ); 87 layout95->addItem( spacer_2 );
85 88
86 PushButton9 = new QPushButton( this, "PushButton9" ); 89 PushButton9 = new QPushButton( this, "PushButton9" );
87 PushButton9->setDefault( TRUE ); 90 PushButton9->setDefault( TRUE );
88 layout95->addWidget( PushButton9 ); 91 layout95->addWidget( PushButton9 );
89 92
90 PushButton8 = new QPushButton( this, "PushButton8" ); 93 PushButton8 = new QPushButton( this, "PushButton8" );
91 layout95->addWidget( PushButton8 ); 94 layout95->addWidget( PushButton8 );
92 95
93 PublishDialog_baseLayout->addMultiCellLayout( layout95, 7, 7, 0, 2 ); 96 PublishDialog_baseLayout->addMultiCellLayout( layout95, 7, 7, 0, 2 );
94 languageChange(); 97 languageChange();
95 resize( QSize(420, 379).expandedTo(minimumSizeHint()) ); 98 resize( QSize(420, 379).expandedTo(minimumSizeHint()) );
96 99
97 // signals and slots connections 100 // signals and slots connections
98 connect( PushButton10, SIGNAL( clicked() ), this, SLOT( addItem() ) ); 101 connect( PushButton10, SIGNAL( clicked() ), this, SLOT( addItem() ) );
diff --git a/korganizer/publishdialog_base.h b/korganizer/publishdialog_base.h
index 932474e..d1b40ae 100644
--- a/korganizer/publishdialog_base.h
+++ b/korganizer/publishdialog_base.h
@@ -1,60 +1,66 @@
1/**************************************************************************** 1/****************************************************************************
2** Form interface generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/publishdialog_base.ui' 2** Form interface generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/publishdialog_base.ui'
3** 3**
4** Created: Sat Mar 29 22:24:27 2003 4** Created: Sat Mar 29 22:24:27 2003
5** by: The User Interface Compiler () 5** by: The User Interface Compiler ()
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9 9
10#ifndef PUBLISHDIALOG_BASE_H 10#ifndef PUBLISHDIALOG_BASE_H
11#define PUBLISHDIALOG_BASE_H 11#define PUBLISHDIALOG_BASE_H
12 12
13#include <qvariant.h> 13#include <qvariant.h>
14#include <qdialog.h> 14#include <qdialog.h>
15//Added by qt3to4:
16#include <Q3VBoxLayout>
17#include <Q3Frame>
18#include <Q3GridLayout>
19#include <Q3HBoxLayout>
20#include <QLabel>
15 21
16class QVBoxLayout; 22class Q3VBoxLayout;
17class QHBoxLayout; 23class Q3HBoxLayout;
18class QGridLayout; 24class Q3GridLayout;
19class QFrame; 25class Q3Frame;
20class QLabel; 26class QLabel;
21class QLineEdit; 27class QLineEdit;
22class QListView; 28class Q3ListView;
23class QListViewItem; 29class Q3ListViewItem;
24class QPushButton; 30class QPushButton;
25 31
26class PublishDialog_base : public QDialog 32class PublishDialog_base : public QDialog
27{ 33{
28 Q_OBJECT 34 Q_OBJECT
29 35
30public: 36public:
31 PublishDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 37 PublishDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
32 ~PublishDialog_base(); 38 ~PublishDialog_base();
33 39
34 QListView* mAddressListView; 40 Q3ListView* mAddressListView;
35 QLabel* TextLabel1; 41 QLabel* TextLabel1;
36 QLabel* TextLabel2; 42 QLabel* TextLabel2;
37 QLineEdit* mEmailLineEdit; 43 QLineEdit* mEmailLineEdit;
38 QLineEdit* mNameLineEdit; 44 QLineEdit* mNameLineEdit;
39 QPushButton* PushButton10; 45 QPushButton* PushButton10;
40 QPushButton* PushButton12; 46 QPushButton* PushButton12;
41 QPushButton* PushButton11; 47 QPushButton* PushButton11;
42 QFrame* Line2; 48 Q3Frame* Line2;
43 QPushButton* PushButton9; 49 QPushButton* PushButton9;
44 QPushButton* PushButton8; 50 QPushButton* PushButton8;
45 51
46protected: 52protected:
47 QGridLayout* PublishDialog_baseLayout; 53 Q3GridLayout* PublishDialog_baseLayout;
48 QHBoxLayout* layout95; 54 Q3HBoxLayout* layout95;
49 55
50protected slots: 56protected slots:
51 virtual void languageChange(); 57 virtual void languageChange();
52 58
53 virtual void addItem(); 59 virtual void addItem();
54 virtual void removeItem(); 60 virtual void removeItem();
55 virtual void openAddressbook(); 61 virtual void openAddressbook();
56 virtual void updateItem(); 62 virtual void updateItem();
57 63
58}; 64};
59 65
60#endif // PUBLISHDIALOG_BASE_H 66#endif // PUBLISHDIALOG_BASE_H
diff --git a/korganizer/savetemplatedialog.cpp b/korganizer/savetemplatedialog.cpp
index 3544081..35bedba 100644
--- a/korganizer/savetemplatedialog.cpp
+++ b/korganizer/savetemplatedialog.cpp
@@ -9,47 +9,50 @@
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25//Added by qt3to4:
26#include <Q3VBoxLayout>
27#include <Q3Frame>
25 28
26#include <keditlistbox.h> 29#include <keditlistbox.h>
27#include <klocale.h> 30#include <klocale.h>
28 31
29#include "koprefs.h" 32#include "koprefs.h"
30 33
31#include "savetemplatedialog.h" 34#include "savetemplatedialog.h"
32 35
33SaveTemplateDialog::SaveTemplateDialog( IncidenceType type, QWidget *parent ) 36SaveTemplateDialog::SaveTemplateDialog( IncidenceType type, QWidget *parent )
34 : KDialogBase( Plain, i18n("Save Template"), Ok | Cancel, Ok, parent, 0, 37 : KDialogBase( Plain, i18n("Save Template"), Ok | Cancel, Ok, parent, 0,
35 true, false ), 38 true, false ),
36 mType( type ) 39 mType( type )
37{ 40{
38 QFrame *topFrame = plainPage(); 41 Q3Frame *topFrame = plainPage();
39 QVBoxLayout *topLayout = new QVBoxLayout( topFrame, 0, spacingHint() ); 42 Q3VBoxLayout *topLayout = new Q3VBoxLayout( topFrame, 0, spacingHint() );
40 43
41 mEditListBox = new KEditListBox( i18n("Select Template Name"), topFrame, 44 mEditListBox = new KEditListBox( i18n("Select Template Name"), topFrame,
42 0, false, KEditListBox::Add | 45 0, false, KEditListBox::Add |
43 KEditListBox::Remove ); 46 KEditListBox::Remove );
44 topLayout->addWidget( mEditListBox ); 47 topLayout->addWidget( mEditListBox );
45 connect( mEditListBox, SIGNAL( changed() ), SLOT( slotChanged() ) ); 48 connect( mEditListBox, SIGNAL( changed() ), SLOT( slotChanged() ) );
46 49
47 QStringList templates; 50 QStringList templates;
48 51
49 if ( mType == EventType ) { 52 if ( mType == EventType ) {
50 templates = KOPrefs::instance()->mEventTemplates; 53 templates = KOPrefs::instance()->mEventTemplates;
51 } else if( mType == TodoType ) { 54 } else if( mType == TodoType ) {
52 templates = KOPrefs::instance()->mTodoTemplates; 55 templates = KOPrefs::instance()->mTodoTemplates;
53 } 56 }
54 57
55 mEditListBox->insertStringList( templates ); 58 mEditListBox->insertStringList( templates );
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 9cfdc35..105b844 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -11,63 +11,70 @@
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qcheckbox.h> 26#include <qcheckbox.h>
27#include <qgroupbox.h> 27#include <q3groupbox.h>
28#include <qapplication.h> 28#include <qapplication.h>
29#include <QDesktopWidget>
29#include <qlabel.h> 30#include <qlabel.h>
30#include <qlistview.h> 31#include <q3listview.h>
31#include <qwhatsthis.h> 32#include <q3whatsthis.h>
32#include <qlineedit.h> 33#include <qlineedit.h>
33#include <qpushbutton.h> 34#include <qpushbutton.h>
34#include <qhbuttongroup.h> 35//#include <qhbuttongroup.h>
36//Added by qt3to4:
37#include <Q3HBoxLayout>
38#include <Q3Frame>
39#include <Q3PtrList>
40#include <QKeyEvent>
41#include <Q3VBoxLayout>
35#include <klocale.h> 42#include <klocale.h>
36#include <kmessagebox.h> 43#include <kmessagebox.h>
37 44
38#include <libkdepim/kdateedit.h> 45#include <libkdepim/kdateedit.h>
39 46
40#include "koglobals.h" 47#include "koglobals.h"
41#include "koprefs.h" 48#include "koprefs.h"
42#include "klineedit.h" 49#include "klineedit.h"
43 50
44#include "calendarview.h" 51#include "calendarview.h"
45#include "koviewmanager.h" 52#include "koviewmanager.h"
46#include "searchdialog.h" 53#include "searchdialog.h"
47 54
48SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) 55SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
49 : QVBox( 0 ) 56 : Q3VBox( 0 )
50 57
51{ 58{
52 mCalendar = calendar; 59 mCalendar = calendar;
53 QFrame *topFrame = new QFrame( this ) ;//plainPage(); 60 Q3Frame *topFrame = new Q3Frame( this ) ;//plainPage();
54 QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); 61 Q3VBoxLayout *layout = new Q3VBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint());
55 62
56 // Search expression 63 // Search expression
57 QHBoxLayout *subLayout = new QHBoxLayout(); 64 Q3HBoxLayout *subLayout = new Q3HBoxLayout();
58 layout->addLayout(subLayout); 65 layout->addLayout(subLayout);
59 /* 66 /*
60 searchLabel = new QLabel(topFrame); 67 searchLabel = new QLabel(topFrame);
61 searchLabel->setText(i18n("Search for:")); 68 searchLabel->setText(i18n("Search for:"));
62 subLayout->addWidget(searchLabel); 69 subLayout->addWidget(searchLabel);
63 */ 70 */
64 QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame ); 71 QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame );
65 //OkButton->setDefault( true ); 72 //OkButton->setDefault( true );
66 connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); 73 connect(OkButton,SIGNAL(clicked()),SLOT(doSearch()));
67 subLayout->addWidget(OkButton); 74 subLayout->addWidget(OkButton);
68 searchEdit = new KLineEdit(topFrame); 75 searchEdit = new KLineEdit(topFrame);
69 subLayout->addWidget(searchEdit); 76 subLayout->addWidget(searchEdit);
70 77
71 mAddItems = new QRadioButton( "+ ", topFrame ); 78 mAddItems = new QRadioButton( "+ ", topFrame );
72 mSubItems = new QRadioButton( "- ", topFrame ); 79 mSubItems = new QRadioButton( "- ", topFrame );
73 mRefineItems = new QRadioButton( "< ", topFrame ); 80 mRefineItems = new QRadioButton( "< ", topFrame );
@@ -85,70 +92,70 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
85 connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool ))); 92 connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool )));
86 93
87 QPushButton *togButton = new QPushButton( "", topFrame ); 94 QPushButton *togButton = new QPushButton( "", topFrame );
88 subLayout->addWidget(togButton); 95 subLayout->addWidget(togButton);
89 connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes())); 96 connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes()));
90 togButton->setPixmap(SmallIcon("1updownarrow")); 97 togButton->setPixmap(SmallIcon("1updownarrow"));
91 togButton->setMinimumWidth( togButton->sizeHint().height() ); 98 togButton->setMinimumWidth( togButton->sizeHint().height() );
92 99
93 searchEdit->setText("*"); // Find all events by default 100 searchEdit->setText("*"); // Find all events by default
94 searchEdit->setFocus(); 101 searchEdit->setFocus();
95 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); 102 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & )));
96 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); 103 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch()));
97 // Subjects to search 104 // Subjects to search
98 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), 105 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"),
99 // topFrame); 106 // topFrame);
100 107
101 incidenceGroup = new QHBox( topFrame ); 108 incidenceGroup = new Q3HBox( topFrame );
102 layout->addWidget(incidenceGroup); 109 layout->addWidget(incidenceGroup);
103 110
104 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); 111 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup);
105 //mSearchEvent->setChecked(true); 112 //mSearchEvent->setChecked(true);
106 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); 113 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup);
107 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); 114 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup);
108 115
109 subjectGroup = new QHBox( topFrame ); 116 subjectGroup = new Q3HBox( topFrame );
110 layout->addWidget(subjectGroup); 117 layout->addWidget(subjectGroup);
111 118
112 mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); 119 mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup);
113 mSummaryCheck->setChecked(true); 120 mSummaryCheck->setChecked(true);
114 mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); 121 mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup);
115 mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); 122 mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup);
116 123
117 attendeeGroup = new QHBox( topFrame ); 124 attendeeGroup = new Q3HBox( topFrame );
118 layout->addWidget(attendeeGroup ); 125 layout->addWidget(attendeeGroup );
119 new QLabel( i18n("Attendee:"),attendeeGroup ); 126 new QLabel( i18n("Attendee:"),attendeeGroup );
120 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); 127 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup );
121 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); 128 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup );
122 // Date range 129 // Date range
123 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), 130 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"),
124 // topFrame); 131 // topFrame);
125 // layout->addWidget(rangeGroup); 132 // layout->addWidget(rangeGroup);
126 133
127 QWidget *rangeWidget = new QWidget(topFrame); 134 QWidget *rangeWidget = new QWidget(topFrame);
128 int space = KDialog::spacingHint(); 135 int space = KDialog::spacingHint();
129 if ( QApplication::desktop()->width() <= 240 ) space = 1; 136 if ( QApplication::desktop()->width() <= 240 ) space = 1;
130 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,space); 137 Q3HBoxLayout *rangeLayout = new Q3HBoxLayout(rangeWidget,0,space);
131 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); 138 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget));
132 mStartDate = new KDateEdit(rangeWidget); 139 mStartDate = new KDateEdit(rangeWidget);
133 rangeLayout->addWidget(mStartDate); 140 rangeLayout->addWidget(mStartDate);
134 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); 141 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget));
135 mEndDate = new KDateEdit(rangeWidget); 142 mEndDate = new KDateEdit(rangeWidget);
136 mEndDate->setDate(QDate::currentDate().addDays(365)); 143 mEndDate->setDate(QDate::currentDate().addDays(365));
137 rangeLayout->addWidget(mEndDate); 144 rangeLayout->addWidget(mEndDate);
138 QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); 145 QToolButton *wt = Q3WhatsThis::whatsThisButton ( rangeWidget );
139 rangeLayout->addWidget( (QWidget*)wt ); 146 rangeLayout->addWidget( (QWidget*)wt );
140 layout->addWidget(rangeWidget); 147 layout->addWidget(rangeWidget);
141 // Results list view 148 // Results list view
142 listView = new KOListView(mCalendar,topFrame); 149 listView = new KOListView(mCalendar,topFrame);
143 layout->addWidget(listView); 150 layout->addWidget(listView);
144 listView->showCompletedTodos(); 151 listView->showCompletedTodos();
145 //layout->setStretchFactor( listView, 333 ); 152 //layout->setStretchFactor( listView, 333 );
146 //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); 153 //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) );
147 //listView->setMaximumHeight( 50 ); 154 //listView->setMaximumHeight( 50 );
148 listView->readSettings(KOGlobals::config(),"SearchListView Layout"); 155 listView->readSettings(KOGlobals::config(),"SearchListView Layout");
149 connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); 156 connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList()));
150 157
151 setCaption( i18n("KO/Pi Find: ")); 158 setCaption( i18n("KO/Pi Find: "));
152#ifdef DESKTOP_VERSION 159#ifdef DESKTOP_VERSION
153 OkButton = new QPushButton( i18n("Close"), this ); 160 OkButton = new QPushButton( i18n("Close"), this );
154 connect(OkButton,SIGNAL(clicked()),SLOT(hide())); 161 connect(OkButton,SIGNAL(clicked()),SLOT(hide()));
@@ -328,33 +335,33 @@ void SearchDialog::updateView()
328 st += "*"; 335 st += "*";
329 re.setPattern(st); 336 re.setPattern(st);
330 mMatchedEvents.clear(); 337 mMatchedEvents.clear();
331 mMatchedTodos.clear(); 338 mMatchedTodos.clear();
332 mMatchedJournals.clear(); 339 mMatchedJournals.clear();
333 if (re.isValid()) { 340 if (re.isValid()) {
334 search(re); 341 search(re);
335 } 342 }
336 listView->setStartDate( mStartDate->date() ); 343 listView->setStartDate( mStartDate->date() );
337 listView->showEvents(mMatchedEvents); 344 listView->showEvents(mMatchedEvents);
338 listView->addTodos(mMatchedTodos); 345 listView->addTodos(mMatchedTodos);
339 listView->addJournals(mMatchedJournals); 346 listView->addJournals(mMatchedJournals);
340} 347}
341 348
342void SearchDialog::search(const QRegExp &re) 349void SearchDialog::search(const QRegExp &re)
343{ 350{
344 QPtrList<Event> events; 351 Q3PtrList<Event> events;
345 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { 352 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
346 if ( mRefineItems->isChecked() ) events = mMatchedEvents; 353 if ( mRefineItems->isChecked() ) events = mMatchedEvents;
347 mMatchedEvents.clear(); 354 mMatchedEvents.clear();
348 } 355 }
349 if ( mSearchEvent->isChecked() ) { 356 if ( mSearchEvent->isChecked() ) {
350 if ( !mRefineItems->isChecked() ) 357 if ( !mRefineItems->isChecked() )
351 events = mCalendar->events( mStartDate->date(), 358 events = mCalendar->events( mStartDate->date(),
352 mEndDate->date(), 359 mEndDate->date(),
353 false /*mInclusiveCheck->isChecked()*/ ); 360 false /*mInclusiveCheck->isChecked()*/ );
354 361
355 362
356 Event *ev; 363 Event *ev;
357 for(ev=events.first();ev;ev=events.next()) { 364 for(ev=events.first();ev;ev=events.next()) {
358 if (mSummaryCheck->isChecked()) { 365 if (mSummaryCheck->isChecked()) {
359#if QT_VERSION >= 0x030000 366#if QT_VERSION >= 0x030000
360 if (re.search(ev->summary()) != -1) 367 if (re.search(ev->summary()) != -1)
@@ -406,33 +413,33 @@ void SearchDialog::search(const QRegExp &re)
406 if (re.search(ev->categoriesStr()) != -1) 413 if (re.search(ev->categoriesStr()) != -1)
407#else 414#else
408 if (re.match(ev->categoriesStr()) != -1) 415 if (re.match(ev->categoriesStr()) != -1)
409#endif 416#endif
410 { 417 {
411 418
412 if ( mSubItems->isChecked() ) 419 if ( mSubItems->isChecked() )
413 mMatchedEvents.remove(ev); 420 mMatchedEvents.remove(ev);
414 else{ 421 else{
415 if ( !mMatchedEvents.contains( ev ) ) 422 if ( !mMatchedEvents.contains( ev ) )
416 mMatchedEvents.append(ev); 423 mMatchedEvents.append(ev);
417 } 424 }
418 continue; 425 continue;
419 } 426 }
420 } 427 }
421 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { 428 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
422 QPtrList<Attendee> tmpAList = ev->attendees(); 429 Q3PtrList<Attendee> tmpAList = ev->attendees();
423 Attendee *a; 430 Attendee *a;
424 for (a = tmpAList.first(); a; a = tmpAList.next()) { 431 for (a = tmpAList.first(); a; a = tmpAList.next()) {
425 if (mSearchAName->isChecked()) { 432 if (mSearchAName->isChecked()) {
426#if QT_VERSION >= 0x030000 433#if QT_VERSION >= 0x030000
427 if (re.search(a->name()) != -1) 434 if (re.search(a->name()) != -1)
428#else 435#else
429 if (re.match(a->name()) != -1) 436 if (re.match(a->name()) != -1)
430#endif 437#endif
431 { 438 {
432 if ( mSubItems->isChecked() ) 439 if ( mSubItems->isChecked() )
433 mMatchedEvents.remove(ev); 440 mMatchedEvents.remove(ev);
434 else{ 441 else{
435 if ( !mMatchedEvents.contains( ev ) ) 442 if ( !mMatchedEvents.contains( ev ) )
436 mMatchedEvents.append(ev); 443 mMatchedEvents.append(ev);
437 } 444 }
438 break; 445 break;
@@ -445,33 +452,33 @@ void SearchDialog::search(const QRegExp &re)
445 if (re.match(a->email()) != -1) 452 if (re.match(a->email()) != -1)
446#endif 453#endif
447 { 454 {
448 if ( mSubItems->isChecked() ) 455 if ( mSubItems->isChecked() )
449 mMatchedEvents.remove(ev); 456 mMatchedEvents.remove(ev);
450 else{ 457 else{
451 if ( !mMatchedEvents.contains( ev ) ) 458 if ( !mMatchedEvents.contains( ev ) )
452 mMatchedEvents.append(ev); 459 mMatchedEvents.append(ev);
453 } 460 }
454 break; 461 break;
455 } 462 }
456 } 463 }
457 } 464 }
458 } 465 }
459 } 466 }
460 } 467 }
461 QPtrList<Todo> todos; 468 Q3PtrList<Todo> todos;
462 469
463 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { 470 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
464 if ( mRefineItems->isChecked() ) todos = mMatchedTodos ; 471 if ( mRefineItems->isChecked() ) todos = mMatchedTodos ;
465 mMatchedTodos.clear(); 472 mMatchedTodos.clear();
466 } 473 }
467 474
468 if ( mSearchTodo->isChecked() ) { 475 if ( mSearchTodo->isChecked() ) {
469 if ( !mRefineItems->isChecked() ) todos = mCalendar->todos( ); 476 if ( !mRefineItems->isChecked() ) todos = mCalendar->todos( );
470 Todo *tod; 477 Todo *tod;
471 for(tod=todos.first();tod;tod=todos.next()) { 478 for(tod=todos.first();tod;tod=todos.next()) {
472 if (mSummaryCheck->isChecked()) { 479 if (mSummaryCheck->isChecked()) {
473#if QT_VERSION >= 0x030000 480#if QT_VERSION >= 0x030000
474 if (re.search(tod->summary()) != -1) 481 if (re.search(tod->summary()) != -1)
475#else 482#else
476 if (re.match(tod->summary()) != -1) 483 if (re.match(tod->summary()) != -1)
477#endif 484#endif
@@ -499,33 +506,33 @@ void SearchDialog::search(const QRegExp &re)
499 } 506 }
500 if (mCategoryCheck->isChecked()) { 507 if (mCategoryCheck->isChecked()) {
501#if QT_VERSION >= 0x030000 508#if QT_VERSION >= 0x030000
502 if (re.search(tod->categoriesStr()) != -1) 509 if (re.search(tod->categoriesStr()) != -1)
503#else 510#else
504 if (re.match(tod->categoriesStr()) != -1) 511 if (re.match(tod->categoriesStr()) != -1)
505#endif 512#endif
506 { 513 {
507 if ( mSubItems->isChecked() ) 514 if ( mSubItems->isChecked() )
508 mMatchedTodos.remove(tod); 515 mMatchedTodos.remove(tod);
509 else if (!mMatchedTodos.contains( tod )) 516 else if (!mMatchedTodos.contains( tod ))
510 mMatchedTodos.append(tod); 517 mMatchedTodos.append(tod);
511 continue; 518 continue;
512 } 519 }
513 } 520 }
514 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { 521 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
515 QPtrList<Attendee> tmpAList = tod->attendees(); 522 Q3PtrList<Attendee> tmpAList = tod->attendees();
516 Attendee *a; 523 Attendee *a;
517 for (a = tmpAList.first(); a; a = tmpAList.next()) { 524 for (a = tmpAList.first(); a; a = tmpAList.next()) {
518 if (mSearchAName->isChecked()) { 525 if (mSearchAName->isChecked()) {
519#if QT_VERSION >= 0x030000 526#if QT_VERSION >= 0x030000
520 if (re.search(a->name()) != -1) 527 if (re.search(a->name()) != -1)
521#else 528#else
522 if (re.match(a->name()) != -1) 529 if (re.match(a->name()) != -1)
523#endif 530#endif
524 { 531 {
525 if ( mSubItems->isChecked() ) 532 if ( mSubItems->isChecked() )
526 mMatchedTodos.remove(tod); 533 mMatchedTodos.remove(tod);
527 else if (!mMatchedTodos.contains( tod )) 534 else if (!mMatchedTodos.contains( tod ))
528 mMatchedTodos.append(tod); 535 mMatchedTodos.append(tod);
529 break; 536 break;
530 } 537 }
531 } 538 }
@@ -535,33 +542,33 @@ void SearchDialog::search(const QRegExp &re)
535#else 542#else
536 if (re.match(a->email()) != -1) 543 if (re.match(a->email()) != -1)
537#endif 544#endif
538 { 545 {
539 if ( mSubItems->isChecked() ) 546 if ( mSubItems->isChecked() )
540 mMatchedTodos.remove(tod); 547 mMatchedTodos.remove(tod);
541 else if (!mMatchedTodos.contains( tod )) 548 else if (!mMatchedTodos.contains( tod ))
542 mMatchedTodos.append(tod); 549 mMatchedTodos.append(tod);
543 break; 550 break;
544 } 551 }
545 } 552 }
546 } 553 }
547 } 554 }
548 } 555 }
549 } 556 }
550 557
551 QPtrList<Journal> journals; 558 Q3PtrList<Journal> journals;
552 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { 559 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
553 if ( mRefineItems->isChecked() ) journals = mMatchedJournals ; 560 if ( mRefineItems->isChecked() ) journals = mMatchedJournals ;
554 mMatchedJournals.clear(); 561 mMatchedJournals.clear();
555 } 562 }
556 if (mSearchJournal->isChecked() ) { 563 if (mSearchJournal->isChecked() ) {
557 if ( ! mRefineItems->isChecked() ) journals = mCalendar->journals(); 564 if ( ! mRefineItems->isChecked() ) journals = mCalendar->journals();
558 Journal* journ; 565 Journal* journ;
559 566
560 for(journ=journals.first();journ;journ=journals.next()) { 567 for(journ=journals.first();journ;journ=journals.next()) {
561 if ( journ->dtStart().date() <= mEndDate->date() 568 if ( journ->dtStart().date() <= mEndDate->date()
562 &&journ->dtStart().date() >= mStartDate->date()) { 569 &&journ->dtStart().date() >= mStartDate->date()) {
563 if (mDescriptionCheck->isChecked()) { 570 if (mDescriptionCheck->isChecked()) {
564#if QT_VERSION >= 0x030000 571#if QT_VERSION >= 0x030000
565 if (re.search(journ->description()) != -1) 572 if (re.search(journ->description()) != -1)
566#else 573#else
567 if (re.match(journ->description()) != -1) 574 if (re.match(journ->description()) != -1)
diff --git a/korganizer/searchdialog.h b/korganizer/searchdialog.h
index 945ff65..5df6116 100644
--- a/korganizer/searchdialog.h
+++ b/korganizer/searchdialog.h
@@ -13,86 +13,90 @@
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef SEARCHDIALOG_H 24#ifndef SEARCHDIALOG_H
25#define SEARCHDIALOG_H 25#define SEARCHDIALOG_H
26 26
27#include <qregexp.h> 27#include <qregexp.h>
28#include <qradiobutton.h> 28#include <qradiobutton.h>
29//Added by qt3to4:
30#include <QLabel>
31#include <QKeyEvent>
32#include <Q3PtrList>
29#include <kdialogbase.h> 33#include <kdialogbase.h>
30#include <qvbox.h> 34#include <q3vbox.h>
31 35
32#include <libkcal/calendar.h> 36#include <libkcal/calendar.h>
33 37
34#include "kolistview.h" 38#include "kolistview.h"
35 39
36class KDateEdit; 40class KDateEdit;
37class QCheckBox; 41class QCheckBox;
38class QLineEdit; 42class QLineEdit;
39class KLineEdit; 43class KLineEdit;
40class QLabel; 44class QLabel;
41class CalendarView; 45class CalendarView;
42 46
43using namespace KCal; 47using namespace KCal;
44class SearchDialog : public QVBox 48class SearchDialog : public Q3VBox
45{ 49{
46 Q_OBJECT 50 Q_OBJECT
47 public: 51 public:
48 SearchDialog(Calendar *calendar,CalendarView *parent=0); 52 SearchDialog(Calendar *calendar,CalendarView *parent=0);
49 virtual ~SearchDialog(); 53 virtual ~SearchDialog();
50 KOListView *listview(){ return listView;} 54 KOListView *listview(){ return listView;}
51 void updateView(); 55 void updateView();
52 void raiseAndSelect(); 56 void raiseAndSelect();
53 57
54 public slots: 58 public slots:
55 void changeEventDisplay(Event *, int) { updateView(); } 59 void changeEventDisplay(Event *, int) { updateView(); }
56 void updateConfig(); 60 void updateConfig();
57 void updateList(); 61 void updateList();
58 protected slots: 62 protected slots:
59 void setFocusToList(); 63 void setFocusToList();
60 void accept(); 64 void accept();
61 void doSearch(); 65 void doSearch();
62 void searchTextChanged( const QString &_text ); 66 void searchTextChanged( const QString &_text );
63 void toggleCheckboxes(); 67 void toggleCheckboxes();
64 void slot_add( bool ); 68 void slot_add( bool );
65 void slot_sub( bool ); 69 void slot_sub( bool );
66 void slot_refine( bool ); 70 void slot_refine( bool );
67 71
68 signals: 72 signals:
69 void showEventSignal(Event *); 73 void showEventSignal(Event *);
70 void editEventSignal(Event *); 74 void editEventSignal(Event *);
71 void deleteEventSignal(Event *); 75 void deleteEventSignal(Event *);
72 76
73 private: 77 private:
74 78
75 QHBox *incidenceGroup ,*subjectGroup ,*attendeeGroup; 79 Q3HBox *incidenceGroup ,*subjectGroup ,*attendeeGroup;
76 void search(const QRegExp &); 80 void search(const QRegExp &);
77 81
78 Calendar *mCalendar; 82 Calendar *mCalendar;
79 83
80 QPtrList<Event> mMatchedEvents; 84 Q3PtrList<Event> mMatchedEvents;
81 QPtrList<Todo> mMatchedTodos; 85 Q3PtrList<Todo> mMatchedTodos;
82 QPtrList<Journal> mMatchedJournals; 86 Q3PtrList<Journal> mMatchedJournals;
83 87
84 QLabel *searchLabel; 88 QLabel *searchLabel;
85 KLineEdit *searchEdit; 89 KLineEdit *searchEdit;
86 KOListView *listView; 90 KOListView *listView;
87 91
88 KDateEdit *mStartDate; 92 KDateEdit *mStartDate;
89 KDateEdit *mEndDate; 93 KDateEdit *mEndDate;
90 QCheckBox *mSummaryCheck; 94 QCheckBox *mSummaryCheck;
91 QCheckBox *mDescriptionCheck; 95 QCheckBox *mDescriptionCheck;
92 QCheckBox *mCategoryCheck; 96 QCheckBox *mCategoryCheck;
93 QCheckBox *mSearchEvent; 97 QCheckBox *mSearchEvent;
94 QCheckBox *mSearchTodo; 98 QCheckBox *mSearchTodo;
95 QCheckBox *mSearchJournal; 99 QCheckBox *mSearchJournal;
96 QCheckBox *mSearchAName; 100 QCheckBox *mSearchAName;
97 QCheckBox *mSearchAEmail; 101 QCheckBox *mSearchAEmail;
98 QRadioButton *mAddItems, *mSubItems, *mRefineItems; 102 QRadioButton *mAddItems, *mSubItems, *mRefineItems;
diff --git a/korganizer/statusdialog.cpp b/korganizer/statusdialog.cpp
index 7137c49..8186ebb 100644
--- a/korganizer/statusdialog.cpp
+++ b/korganizer/statusdialog.cpp
@@ -8,57 +8,60 @@
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qlabel.h> 20#include <qlabel.h>
21#include <qpushbutton.h> 21#include <qpushbutton.h>
22#include <qstringlist.h> 22#include <qstringlist.h>
23#include <qlayout.h> 23#include <qlayout.h>
24//Added by qt3to4:
25#include <Q3VBoxLayout>
26#include <Q3HBoxLayout>
24 27
25#include <kdebug.h> 28#include <kdebug.h>
26#include <klocale.h> 29#include <klocale.h>
27 30
28#include "statusdialog.h" 31#include "statusdialog.h"
29 32
30StatusDialog::StatusDialog(QWidget* parent, const char* name) : 33StatusDialog::StatusDialog(QWidget* parent, const char* name) :
31 KDialog(parent,name,true) 34 KDialog(parent,name,true)
32{ 35{
33 setCaption(i18n("Set Your Status")); 36 setCaption(i18n("Set Your Status"));
34 37
35 QBoxLayout *topLayout = new QVBoxLayout( this ); 38 Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
36 topLayout->setSpacing( spacingHint() ); 39 topLayout->setSpacing( spacingHint() );
37 topLayout->setMargin( marginHint() ); 40 topLayout->setMargin( marginHint() );
38 41
39 QBoxLayout *statusLayout = new QHBoxLayout( topLayout ); 42 Q3BoxLayout *statusLayout = new Q3HBoxLayout( topLayout );
40 43
41 QLabel *text = new QLabel(i18n("Set your status"),this); 44 QLabel *text = new QLabel(i18n("Set your status"),this);
42 statusLayout->addWidget( text ); 45 statusLayout->addWidget( text );
43 46
44 mStatus = new QComboBox(false,this); 47 mStatus = new QComboBox(false,this);
45 mStatus->insertStringList(Attendee::statusList()); 48 mStatus->insertStringList(Attendee::statusList());
46 statusLayout->addWidget( mStatus ); 49 statusLayout->addWidget( mStatus );
47 50
48 QBoxLayout *buttonLayout = new QHBoxLayout( topLayout ); 51 Q3BoxLayout *buttonLayout = new Q3HBoxLayout( topLayout );
49 52
50 QPushButton *ok = new QPushButton(i18n("&OK"), this); 53 QPushButton *ok = new QPushButton(i18n("&OK"), this);
51 connect ( ok,SIGNAL(clicked()), this,SLOT(accept()) ); 54 connect ( ok,SIGNAL(clicked()), this,SLOT(accept()) );
52 buttonLayout->addWidget( ok ); 55 buttonLayout->addWidget( ok );
53 56
54 QPushButton *cancel = new QPushButton(i18n("&Cancel"), this); 57 QPushButton *cancel = new QPushButton(i18n("&Cancel"), this);
55 connect ( cancel,SIGNAL(clicked()), this,SLOT(reject()) ); 58 connect ( cancel,SIGNAL(clicked()), this,SLOT(reject()) );
56 buttonLayout->addWidget( cancel ); 59 buttonLayout->addWidget( cancel );
57} 60}
58 61
59StatusDialog::~StatusDialog() 62StatusDialog::~StatusDialog()
60{ 63{
61} 64}
62 65
63Attendee::PartStat StatusDialog::status() 66Attendee::PartStat StatusDialog::status()
64{ 67{
diff --git a/korganizer/timeline.cpp b/korganizer/timeline.cpp
index 11be432..a6c3cdc 100644
--- a/korganizer/timeline.cpp
+++ b/korganizer/timeline.cpp
@@ -1,30 +1,30 @@
1#include <qpainter.h> 1#include <qpainter.h>
2 2
3#include <kdebug.h> 3#include <kdebug.h>
4 4
5#include "timeline.h" 5#include "timeline.h"
6 6
7TimeLine::TimeLine( QWidget *parent, const char *name ) : 7TimeLine::TimeLine( QWidget *parent, const char *name ) :
8 QScrollView( parent, name ) 8 Q3ScrollView( parent, name )
9{ 9{
10 mPixelWidth = 1000; 10 mPixelWidth = 1000;
11 11
12 resizeContents( mPixelWidth, 20 ); 12 resizeContents( mPixelWidth, 20 );
13 13
14 viewport()->setBackgroundMode( PaletteBackground ); 14 viewport()->setBackgroundMode( Qt::PaletteBackground );
15 15
16 setHScrollBarMode(AlwaysOff); 16 setHScrollBarMode(AlwaysOff);
17 setVScrollBarMode(AlwaysOff); 17 setVScrollBarMode(AlwaysOff);
18} 18}
19 19
20TimeLine::~TimeLine() 20TimeLine::~TimeLine()
21{ 21{
22} 22}
23 23
24void TimeLine::drawContents(QPainter* p, int cx, int cy, int cw, int ch) 24void TimeLine::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
25{ 25{
26 int spacingX = mDaySpacing; 26 int spacingX = mDaySpacing;
27 int offsetX = mDayOffset; 27 int offsetX = mDayOffset;
28 28
29 // Draw vertical lines of grid 29 // Draw vertical lines of grid
30// kdDebug() << "drawContents cx: " << cx << " cy: " << cy << " cw: " << cw << " ch: " << ch << endl; 30// kdDebug() << "drawContents cx: " << cx << " cy: " << cy << " cw: " << cw << " ch: " << ch << endl;
@@ -45,18 +45,18 @@ void TimeLine::setDateRange( const QDateTime &start, const QDateTime &end )
45{ 45{
46 mStartDate = start; 46 mStartDate = start;
47 mEndDate = end; 47 mEndDate = end;
48 48
49 mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mPixelWidth; 49 mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mPixelWidth;
50 50
51 mDaySpacing = 60 * 60 * 24 / mSecsPerPixel; 51 mDaySpacing = 60 * 60 * 24 / mSecsPerPixel;
52 52
53 mDayOffset = QDateTime( mStartDate.date() ).secsTo( mStartDate ) / mSecsPerPixel; 53 mDayOffset = QDateTime( mStartDate.date() ).secsTo( mStartDate ) / mSecsPerPixel;
54 54
55 kdDebug() << "TimeLines::setDateRange(): mDaySpacing: " << mDaySpacing << " mDayOffset: " 55 kdDebug() << "TimeLines::setDateRange(): mDaySpacing: " << mDaySpacing << " mDayOffset: "
56 << mDayOffset << " mSecsPerPixel: " << mSecsPerPixel << endl; 56 << mDayOffset << " mSecsPerPixel: " << mSecsPerPixel << endl;
57} 57}
58 58
59void TimeLine::setContentsPos( int pos ) 59void TimeLine::setContentsPos( int pos )
60{ 60{
61 QScrollView::setContentsPos ( pos, 0 ); 61 Q3ScrollView::setContentsPos ( pos, 0 );
62} 62}
diff --git a/korganizer/timeline.h b/korganizer/timeline.h
index ab3e5d3..bf301fa 100644
--- a/korganizer/timeline.h
+++ b/korganizer/timeline.h
@@ -1,23 +1,23 @@
1#ifndef TIMELINE_H 1#ifndef TIMELINE_H
2#define TIMELINE_H 2#define TIMELINE_H
3 3
4#include <qscrollview.h> 4#include <q3scrollview.h>
5#include <qdatetime.h> 5#include <qdatetime.h>
6 6
7class TimeLine : public QScrollView 7class TimeLine : public Q3ScrollView
8{ 8{
9 Q_OBJECT 9 Q_OBJECT
10 public: 10 public:
11 TimeLine( QWidget *parent = 0, const char *name = 0 ); 11 TimeLine( QWidget *parent = 0, const char *name = 0 );
12 virtual ~TimeLine(); 12 virtual ~TimeLine();
13 13
14 void setDateRange( const QDateTime &start, const QDateTime &end ); 14 void setDateRange( const QDateTime &start, const QDateTime &end );
15 15
16 public slots: 16 public slots:
17 void setContentsPos( int pos ); 17 void setContentsPos( int pos );
18 18
19 protected: 19 protected:
20 void drawContents(QPainter* p, int cx, int cy, int cw, int ch); 20 void drawContents(QPainter* p, int cx, int cy, int cw, int ch);
21 21
22 private: 22 private:
23 QDateTime mStartDate; 23 QDateTime mStartDate;
diff --git a/korganizer/timespanview.cpp b/korganizer/timespanview.cpp
index df8ff88..0908056 100644
--- a/korganizer/timespanview.cpp
+++ b/korganizer/timespanview.cpp
@@ -1,95 +1,99 @@
1 1
2#ifndef DESKTOP_VERSION 2#ifndef DESKTOP_VERSION
3#include <qksplitter.h> 3#include <qksplitter.h>
4#else 4#else
5#include <qsplitter.h> 5#include <qsplitter.h>
6#endif 6#endif
7#include <qlistview.h> 7#include <q3listview.h>
8#include <qlayout.h> 8#include <qlayout.h>
9#include <qheader.h> 9#include <q3header.h>
10#include <qpushbutton.h> 10#include <qpushbutton.h>
11//Added by qt3to4:
12#include <Q3HBoxLayout>
13#include <Q3VBoxLayout>
14#include <Q3ValueList>
11 15
12#include <klocale.h> 16#include <klocale.h>
13#include <kdebug.h> 17#include <kdebug.h>
14 18
15#include "lineview.h" 19#include "lineview.h"
16#include "timeline.h" 20#include "timeline.h"
17 21
18#include "timespanview.h" 22#include "timespanview.h"
19 23
20 24
21TimeSpanView::TimeSpanView( QWidget *parent, const char *name ) : 25TimeSpanView::TimeSpanView( QWidget *parent, const char *name ) :
22 QWidget( parent, name ) 26 QWidget( parent, name )
23{ 27{
24 QBoxLayout *topLayout = new QVBoxLayout( this ); 28 Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
25#ifndef DESKTOP_VERSION 29#ifndef DESKTOP_VERSION
26 mSplitter = new QKSplitter( this ); 30 mSplitter = new QKSplitter( this );
27#else 31#else
28 mSplitter = new QSplitter( this ); 32 mSplitter = new QSplitter( this );
29#endif 33#endif
30 topLayout->addWidget( mSplitter ); 34 topLayout->addWidget( mSplitter );
31 35
32 mList = new QListView( mSplitter ); 36 mList = new Q3ListView( mSplitter );
33 mList->addColumn( i18n("Summary") ); 37 mList->addColumn( i18n("Summary") );
34 38
35 QWidget *rightPane = new QWidget( mSplitter ); 39 QWidget *rightPane = new QWidget( mSplitter );
36 QBoxLayout *rightPaneLayout = new QVBoxLayout( rightPane ); 40 Q3BoxLayout *rightPaneLayout = new Q3VBoxLayout( rightPane );
37 41
38 mTimeLine = new TimeLine( rightPane ); 42 mTimeLine = new TimeLine( rightPane );
39 mTimeLine->setFixedHeight( mList->header()->height() ); 43 mTimeLine->setFixedHeight( mList->header()->height() );
40 rightPaneLayout->addWidget( mTimeLine ); 44 rightPaneLayout->addWidget( mTimeLine );
41 45
42 mLineView = new LineView( rightPane ); 46 mLineView = new LineView( rightPane );
43 rightPaneLayout->addWidget( mLineView ); 47 rightPaneLayout->addWidget( mLineView );
44 48
45 QBoxLayout *buttonLayout = new QHBoxLayout( rightPaneLayout ); 49 Q3BoxLayout *buttonLayout = new Q3HBoxLayout( rightPaneLayout );
46 50
47 QPushButton *zoomInButton = new QPushButton( i18n("Zoom In"), rightPane ); 51 QPushButton *zoomInButton = new QPushButton( i18n("Zoom In"), rightPane );
48 connect( zoomInButton, SIGNAL( clicked() ), SLOT( zoomIn() ) ); 52 connect( zoomInButton, SIGNAL( clicked() ), SLOT( zoomIn() ) );
49 buttonLayout->addWidget( zoomInButton ); 53 buttonLayout->addWidget( zoomInButton );
50 54
51 QPushButton *zoomOutButton = new QPushButton( i18n("Zoom Out"), rightPane ); 55 QPushButton *zoomOutButton = new QPushButton( i18n("Zoom Out"), rightPane );
52 connect( zoomOutButton, SIGNAL( clicked() ), SLOT( zoomOut() ) ); 56 connect( zoomOutButton, SIGNAL( clicked() ), SLOT( zoomOut() ) );
53 buttonLayout->addWidget( zoomOutButton ); 57 buttonLayout->addWidget( zoomOutButton );
54 58
55 QPushButton *centerButton = new QPushButton( i18n("Center View"), rightPane ); 59 QPushButton *centerButton = new QPushButton( i18n("Center View"), rightPane );
56 connect( centerButton, SIGNAL( clicked() ), SLOT( centerView() ) ); 60 connect( centerButton, SIGNAL( clicked() ), SLOT( centerView() ) );
57 buttonLayout->addWidget( centerButton ); 61 buttonLayout->addWidget( centerButton );
58 62
59 connect(mLineView->horizontalScrollBar(),SIGNAL(valueChanged(int)), 63 connect(mLineView->horizontalScrollBar(),SIGNAL(valueChanged(int)),
60 mTimeLine,SLOT(setContentsPos(int))); 64 mTimeLine,SLOT(setContentsPos(int)));
61} 65}
62 66
63TimeSpanView::~TimeSpanView() 67TimeSpanView::~TimeSpanView()
64{ 68{
65} 69}
66 70
67QValueList<int> TimeSpanView::splitterSizes() 71Q3ValueList<int> TimeSpanView::splitterSizes()
68{ 72{
69 return mSplitter->sizes(); 73 return mSplitter->sizes();
70} 74}
71 75
72void TimeSpanView::setSplitterSizes( QValueList<int> sizes ) 76void TimeSpanView::setSplitterSizes( Q3ValueList<int> sizes )
73{ 77{
74 mSplitter->setSizes( sizes ); 78 mSplitter->setSizes( sizes );
75} 79}
76 80
77void TimeSpanView::addItem( KCal::Event *event ) 81void TimeSpanView::addItem( KCal::Event *event )
78{ 82{
79 new QListViewItem( mList, event->summary() ); 83 new Q3ListViewItem( mList, event->summary() );
80 84
81 QDateTime startDt = event->dtStart(); 85 QDateTime startDt = event->dtStart();
82 QDateTime endDt = event->dtEnd(); 86 QDateTime endDt = event->dtEnd();
83 87
84// kdDebug() << "TimeSpanView::addItem(): start: " << startDt.toString() 88// kdDebug() << "TimeSpanView::addItem(): start: " << startDt.toString()
85// << " end: " << endDt.toString() << endl; 89// << " end: " << endDt.toString() << endl;
86 90
87 int startSecs = mStartDate.secsTo( startDt ); 91 int startSecs = mStartDate.secsTo( startDt );
88 int durationSecs = startDt.secsTo( endDt ); 92 int durationSecs = startDt.secsTo( endDt );
89 93
90// kdDebug() << "--- startSecs: " << startSecs << " dur: " << durationSecs << endl; 94// kdDebug() << "--- startSecs: " << startSecs << " dur: " << durationSecs << endl;
91 95
92 int startX = mStartDate.secsTo( startDt ) / mSecsPerPixel; 96 int startX = mStartDate.secsTo( startDt ) / mSecsPerPixel;
93 int endX = startX + startDt.secsTo( endDt ) / mSecsPerPixel; 97 int endX = startX + startDt.secsTo( endDt ) / mSecsPerPixel;
94 98
95// kdDebug() << "TimeSpanView::addItem(): s: " << startX << " e: " << endX << endl; 99// kdDebug() << "TimeSpanView::addItem(): s: " << startX << " e: " << endX << endl;
diff --git a/korganizer/timespanview.h b/korganizer/timespanview.h
index 34cb1f7..f652374 100644
--- a/korganizer/timespanview.h
+++ b/korganizer/timespanview.h
@@ -1,60 +1,62 @@
1#ifndef TIMESPANVIEW_H 1#ifndef TIMESPANVIEW_H
2#define TIMESPANVIEW_H 2#define TIMESPANVIEW_H
3 3
4#include <qwidget.h> 4#include <qwidget.h>
5//Added by qt3to4:
6#include <Q3ValueList>
5 7
6#include <libkcal/event.h> 8#include <libkcal/event.h>
7 9
8//class QSplitter; 10//class QSplitter;
9#ifndef DESKTOP_VERSION 11#ifndef DESKTOP_VERSION
10class QKSplitter; 12class QKSplitter;
11#else 13#else
12class QSplitter; 14class QSplitter;
13#define QKSplitter QSplitter 15#define QKSplitter QSplitter
14#endif 16#endif
15class QListView; 17class Q3ListView;
16class LineView; 18class LineView;
17class TimeLine; 19class TimeLine;
18 20
19 21
20class TimeSpanView : public QWidget 22class TimeSpanView : public QWidget
21{ 23{
22 Q_OBJECT 24 Q_OBJECT
23 public: 25 public:
24 TimeSpanView( QWidget *parent=0, const char *name=0 ); 26 TimeSpanView( QWidget *parent=0, const char *name=0 );
25 virtual ~TimeSpanView(); 27 virtual ~TimeSpanView();
26 28
27 void addItem( KCal::Event * ); 29 void addItem( KCal::Event * );
28 30
29 QValueList<int> splitterSizes(); 31 Q3ValueList<int> splitterSizes();
30 void setSplitterSizes( QValueList<int> ); 32 void setSplitterSizes( Q3ValueList<int> );
31 33
32 void clear(); 34 void clear();
33 35
34 void setDateRange( const QDateTime &start, const QDateTime &end ); 36 void setDateRange( const QDateTime &start, const QDateTime &end );
35 37
36 QDateTime startDateTime(); 38 QDateTime startDateTime();
37 QDateTime endDateTime(); 39 QDateTime endDateTime();
38 40
39 public slots: 41 public slots:
40 void updateView(); 42 void updateView();
41 43
42 void zoomIn(); 44 void zoomIn();
43 void zoomOut(); 45 void zoomOut();
44 void centerView(); 46 void centerView();
45 47
46 signals: 48 signals:
47 void dateRangeChanged(); 49 void dateRangeChanged();
48 50
49 private: 51 private:
50 QKSplitter *mSplitter; 52 QKSplitter *mSplitter;
51 QListView *mList; 53 Q3ListView *mList;
52 TimeLine *mTimeLine; 54 TimeLine *mTimeLine;
53 LineView *mLineView; 55 LineView *mLineView;
54 56
55 QDateTime mStartDate; 57 QDateTime mStartDate;
56 QDateTime mEndDate; 58 QDateTime mEndDate;
57 int mSecsPerPixel; 59 int mSecsPerPixel;
58}; 60};
59 61
60#endif 62#endif