summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/alarmdialog.cpp1
-rw-r--r--korganizer/calendarview.cpp4
-rw-r--r--korganizer/datenavigator.cpp2
-rw-r--r--korganizer/filtereditdialog.cpp2
-rw-r--r--korganizer/incomingdialog.cpp2
-rw-r--r--korganizer/incomingdialog_base.cpp2
-rw-r--r--korganizer/journalentry.cpp2
-rw-r--r--korganizer/kdatenavigator.cpp2
-rw-r--r--korganizer/koagenda.cpp1
-rw-r--r--korganizer/koagendaitem.cpp2
-rw-r--r--korganizer/koagendaview.cpp2
-rw-r--r--korganizer/kocounterdialog.cpp2
-rw-r--r--korganizer/kodaymatrix.cpp1
-rw-r--r--korganizer/kodialogmanager.cpp1
-rw-r--r--korganizer/koeditordetails.cpp1
-rw-r--r--korganizer/koeditorgeneral.cpp1
-rw-r--r--korganizer/koeditorgeneralevent.cpp1
-rw-r--r--korganizer/koeditorgeneraltodo.cpp1
-rw-r--r--korganizer/koeditorrecurrence.cpp1
-rw-r--r--korganizer/koeventeditor.cpp1
-rw-r--r--korganizer/koeventpopupmenu.cpp1
-rw-r--r--korganizer/koeventview.cpp3
-rw-r--r--korganizer/koeventviewer.cpp1
-rw-r--r--korganizer/koeventviewerdialog.cpp1
-rw-r--r--korganizer/kofilterview.cpp1
-rw-r--r--korganizer/koincidenceeditor.cpp1
-rw-r--r--korganizer/kojournalview.cpp1
-rw-r--r--korganizer/kolistview.cpp1
-rw-r--r--korganizer/komonthview.cpp1
-rw-r--r--korganizer/koprefsdialog.cpp1
-rw-r--r--korganizer/kosyncprefsdialog.cpp1
-rw-r--r--korganizer/kotimespanview.cpp1
-rw-r--r--korganizer/kotodoeditor.cpp1
-rw-r--r--korganizer/kotodoview.cpp1
-rw-r--r--korganizer/koviewmanager.cpp1
-rw-r--r--korganizer/kowhatsnextview.cpp1
-rw-r--r--korganizer/ktimeedit.cpp1
-rw-r--r--korganizer/lineview.cpp1
-rw-r--r--korganizer/navigatorbar.cpp1
-rw-r--r--korganizer/outgoingdialog.cpp1
-rw-r--r--korganizer/outgoingdialog_base.cpp2
-rw-r--r--korganizer/publishdialog.cpp2
-rw-r--r--korganizer/publishdialog_base.cpp2
-rw-r--r--korganizer/savetemplatedialog.cpp1
-rw-r--r--korganizer/searchdialog.cpp1
-rw-r--r--korganizer/statusdialog.cpp1
-rw-r--r--korganizer/timeline.cpp1
-rw-r--r--korganizer/timespanview.cpp1
-rw-r--r--libkcal/calendar.cpp2
49 files changed, 12 insertions, 55 deletions
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp
index b82724f..521781e 100644
--- a/kalarmd/alarmdialog.cpp
+++ b/kalarmd/alarmdialog.cpp
@@ -1,243 +1,242 @@
1/* 1/*
2 This file is part of the KDE alarm daemon. 2 This file is part of the KDE alarm daemon.
3 Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org>
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 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// $Id$ 24// $Id$
25 25
26#include <qhbox.h> 26#include <qhbox.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qapp.h> 28#include <qapp.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qlayout.h> 30#include <qlayout.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qsound.h> 33#include <qsound.h>
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35#include <qspinbox.h> 35#include <qspinbox.h>
36#include <stdlib.h> 36#include <stdlib.h>
37#ifndef _WIN32_ 37#ifndef _WIN32_
38#include <unistd.h> 38#include <unistd.h>
39#include <sys/ioctl.h> 39#include <sys/ioctl.h>
40#endif 40#endif
41#include <stdio.h> 41#include <stdio.h>
42#include <fcntl.h> 42#include <fcntl.h>
43 43
44#ifndef DESKTOP_VERSION 44#ifndef DESKTOP_VERSION
45#include <qtopia/alarmserver.h> 45#include <qtopia/alarmserver.h>
46#include <qpe/resource.h> 46#include <qpe/resource.h>
47#include <qtopia/sound.h> 47#include <qtopia/sound.h>
48#endif 48#endif
49 49
50#include "alarmdialog.h" 50#include "alarmdialog.h"
51#include "alarmdialog.moc"
52 51
53 52
54AlarmDialog::AlarmDialog(QWidget *parent,const char *name) 53AlarmDialog::AlarmDialog(QWidget *parent,const char *name)
55 : QDialog (parent, name, true, Qt::WStyle_StaysOnTop ) 54 : QDialog (parent, name, true, Qt::WStyle_StaysOnTop )
56{ 55{
57 setCaption( "KO/Pi Alarm!" ); 56 setCaption( "KO/Pi Alarm!" );
58 QVBoxLayout* layout = new QVBoxLayout( this); 57 QVBoxLayout* layout = new QVBoxLayout( this);
59 QLabel* l = new QLabel("The following event triggered alarm:",this); 58 QLabel* l = new QLabel("The following event triggered alarm:",this);
60 layout->addWidget ( l ); 59 layout->addWidget ( l );
61 l->setAlignment( AlignCenter); 60 l->setAlignment( AlignCenter);
62 mMessage = new QLabel ( " ", this ); 61 mMessage = new QLabel ( " ", this );
63 int fs = 18; 62 int fs = 18;
64 int fs2 = 12; 63 int fs2 = 12;
65 if ( QApplication::desktop()->width() < 480 ) { 64 if ( QApplication::desktop()->width() < 480 ) {
66 setMaximumSize(220, 260); 65 setMaximumSize(220, 260);
67 fs2 = 10; 66 fs2 = 10;
68 } 67 }
69 else { 68 else {
70 setMaximumSize(440, 440); 69 setMaximumSize(440, 440);
71 } 70 }
72 layout->setSpacing( 3 ); 71 layout->setSpacing( 3 );
73 layout->setMargin( 3 ); 72 layout->setMargin( 3 );
74 73
75 l->setFont( QFont("helvetica",fs2, QFont::Bold) ); 74 l->setFont( QFont("helvetica",fs2, QFont::Bold) );
76 mMessage->setFont( QFont("helvetica",fs, QFont::Bold) ); 75 mMessage->setFont( QFont("helvetica",fs, QFont::Bold) );
77 mMessage->setAlignment( AlignCenter); 76 mMessage->setAlignment( AlignCenter);
78 l = new QLabel("Missed Alarms:",this); 77 l = new QLabel("Missed Alarms:",this);
79 l->setAlignment( AlignCenter); 78 l->setAlignment( AlignCenter);
80 layout->addWidget ( mMessage ); 79 layout->addWidget ( mMessage );
81 layout->addWidget ( l ); 80 layout->addWidget ( l );
82 mMissedAlarms= new QLabel ( "", this ); 81 mMissedAlarms= new QLabel ( "", this );
83 mMissedAlarms->setAlignment( AlignCenter); 82 mMissedAlarms->setAlignment( AlignCenter);
84 83
85 playSoundTimer = new QTimer( this ); 84 playSoundTimer = new QTimer( this );
86 connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) ); 85 connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) );
87 86
88 playSoundTimer->stop(); 87 playSoundTimer->stop();
89 88
90 layout->addWidget ( mMissedAlarms ); 89 layout->addWidget ( mMissedAlarms );
91 QHBox *suspendBox = new QHBox( this ); 90 QHBox *suspendBox = new QHBox( this );
92 suspendBox->setSpacing(3); 91 suspendBox->setSpacing(3);
93 layout->addWidget ( suspendBox ); 92 layout->addWidget ( suspendBox );
94 (void)new QLabel("Suspend duration (minutes):",suspendBox); 93 (void)new QLabel("Suspend duration (minutes):",suspendBox);
95 mSuspendSpin = new QSpinBox(1,1440,1,suspendBox); 94 mSuspendSpin = new QSpinBox(1,1440,1,suspendBox);
96 mSuspendSpin->setValue(7); // default suspend duration 95 mSuspendSpin->setValue(7); // default suspend duration
97 QHBox * bbox = new QHBox ( this ); 96 QHBox * bbox = new QHBox ( this );
98 layout->addWidget ( bbox ); 97 layout->addWidget ( bbox );
99 bbox->layout()->setSpacing( 5 ); 98 bbox->layout()->setSpacing( 5 );
100 QPushButton* suspend = new QPushButton( "Suspend", bbox); 99 QPushButton* suspend = new QPushButton( "Suspend", bbox);
101 QPushButton* silen = new QPushButton( " Stop sound ", bbox); 100 QPushButton* silen = new QPushButton( " Stop sound ", bbox);
102 QPushButton* okbut = new QPushButton( "Ok", bbox); 101 QPushButton* okbut = new QPushButton( "Ok", bbox);
103 connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) ); 102 connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) );
104 connect (suspend , SIGNAL( clicked() ), this, SLOT (slotSuspend() ) ); 103 connect (suspend , SIGNAL( clicked() ), this, SLOT (slotSuspend() ) );
105 connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) ); 104 connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) );
106#ifndef _WIN32_ 105#ifndef _WIN32_
107 if ( QFile::exists ( "/dev/sharp_led" ) ) 106 if ( QFile::exists ( "/dev/sharp_led" ) )
108 fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 107 fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
109 else 108 else
110#endif 109#endif
111 fd_led = 0; 110 fd_led = 0;
112 statusLED.which = SHARP_LED_SALARM; 111 statusLED.which = SHARP_LED_SALARM;
113 mSilent = false; 112 mSilent = false;
114 mSuspendCounter = 0; 113 mSuspendCounter = 0;
115 setServerNotification( true ); 114 setServerNotification( true );
116} 115}
117void AlarmDialog::reject () 116void AlarmDialog::reject ()
118{ 117{
119 QTimer::singleShot ( 3000, this, SLOT (suspend()) ); 118 QTimer::singleShot ( 3000, this, SLOT (suspend()) );
120 slotSuspend(); 119 slotSuspend();
121} 120}
122AlarmDialog::~AlarmDialog() 121AlarmDialog::~AlarmDialog()
123{ 122{
124} 123}
125void AlarmDialog::silent () 124void AlarmDialog::silent ()
126{ 125{
127 mSilent = true; 126 mSilent = true;
128} 127}
129void AlarmDialog::accept() 128void AlarmDialog::accept()
130{ 129{
131 slotOk(); 130 slotOk();
132} 131}
133 132
134void AlarmDialog::suspend() 133void AlarmDialog::suspend()
135{ 134{
136#ifdef DESKTOP_VERSION 135#ifdef DESKTOP_VERSION
137 136
138#else 137#else
139 Sound::soundAlarm (); 138 Sound::soundAlarm ();
140#endif 139#endif
141} 140}
142void AlarmDialog::slotOk() 141void AlarmDialog::slotOk()
143{ 142{
144 mStopAlarm = true; 143 mStopAlarm = true;
145 mMissedAlarms->setText(""); 144 mMissedAlarms->setText("");
146 mMessage->setText(""); 145 mMessage->setText("");
147#ifndef _WIN32_ 146#ifndef _WIN32_
148 if ( fd_led > 0 ) { 147 if ( fd_led > 0 ) {
149 statusLED.status = LED_SALARM_OFF ; 148 statusLED.status = LED_SALARM_OFF ;
150 ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); 149 ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED);
151 } 150 }
152#endif 151#endif
153 QDialog::accept(); 152 QDialog::accept();
154} 153}
155 154
156void AlarmDialog::slotSuspend() 155void AlarmDialog::slotSuspend()
157{ 156{
158 //qDebug("AlarmDialog::suspend() "); // emit suspendSignal(mSuspendSpin->value()); 157 //qDebug("AlarmDialog::suspend() "); // emit suspendSignal(mSuspendSpin->value());
159 mStopAlarm = true; 158 mStopAlarm = true;
160 QDateTime nextA = QDateTime::currentDateTime().addSecs( mSuspendSpin->value() * 60 ); 159 QDateTime nextA = QDateTime::currentDateTime().addSecs( mSuspendSpin->value() * 60 );
161 QString mess = "suspend_alarm" +mFileName+"+++" ; 160 QString mess = "suspend_alarm" +mFileName+"+++" ;
162 if ( mMessage->text().left( 10 ) !="Suspended:" ) 161 if ( mMessage->text().left( 10 ) !="Suspended:" )
163 mess += "Suspended:\n"; 162 mess += "Suspended:\n";
164 mess +=mMessage->text(); 163 mess +=mMessage->text();
165#ifndef DESKTOP_VERSION 164#ifndef DESKTOP_VERSION
166 if ( mServerNotification ) 165 if ( mServerNotification )
167 AlarmServer::addAlarm ( nextA,"koalarm",mess.latin1()); 166 AlarmServer::addAlarm ( nextA,"koalarm",mess.latin1());
168#endif 167#endif
169 emit addAlarm( nextA , mess ); 168 emit addAlarm( nextA , mess );
170 slotOk(); 169 slotOk();
171} 170}
172 171
173void AlarmDialog::setServerNotification( bool b ) 172void AlarmDialog::setServerNotification( bool b )
174{ 173{
175 mServerNotification = b; 174 mServerNotification = b;
176} 175}
177int AlarmDialog::getSuspendTime( ) 176int AlarmDialog::getSuspendTime( )
178{ 177{
179 return mSuspendSpin->value(); 178 return mSuspendSpin->value();
180 179
181} 180}
182void AlarmDialog::setSuspendTime( int val ) 181void AlarmDialog::setSuspendTime( int val )
183{ 182{
184 mSuspendSpin->setValue( val ); 183 mSuspendSpin->setValue( val );
185} 184}
186bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, bool playwav, int pause , int suspendtimes) 185bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, bool playwav, int pause , int suspendtimes)
187{ 186{
188 if ( mess.left( 9) != "Suspended" ) 187 if ( mess.left( 9) != "Suspended" )
189 mSuspendCounter = suspendtimes; 188 mSuspendCounter = suspendtimes;
190 mPauseCount = pause; 189 mPauseCount = pause;
191 mFileName = fn; 190 mFileName = fn;
192 mPlayWav = playwav; 191 mPlayWav = playwav;
193 if ( !QFile::exists( fn ) ) 192 if ( !QFile::exists( fn ) )
194 mFileName = ""; 193 mFileName = "";
195 alarmCounter = 0 ; 194 alarmCounter = 0 ;
196 maxAlarmReplay = replay ; 195 maxAlarmReplay = replay ;
197 mStopAlarm = false; 196 mStopAlarm = false;
198 mSilent = false; 197 mSilent = false;
199 if ( mMissedAlarms->text() == "" ) 198 if ( mMissedAlarms->text() == "" )
200 mMissedAlarms->setText( mMessage->text()); 199 mMissedAlarms->setText( mMessage->text());
201 else 200 else
202 mMissedAlarms->setText( mMessage->text()+ "\n" + mMissedAlarms->text() ); 201 mMissedAlarms->setText( mMessage->text()+ "\n" + mMissedAlarms->text() );
203 if ( mMissedAlarms->text().length() > 180 ) 202 if ( mMissedAlarms->text().length() > 180 )
204 mMissedAlarms->setText(mMissedAlarms->text().left ( 180 )); 203 mMissedAlarms->setText(mMissedAlarms->text().left ( 180 ));
205 mMessage->setText(mess); 204 mMessage->setText(mess);
206 int w =sizeHint().width() ; 205 int w =sizeHint().width() ;
207 int h = sizeHint().height() ; 206 int h = sizeHint().height() ;
208 int dw = QApplication::desktop()->width(); 207 int dw = QApplication::desktop()->width();
209 int dh = QApplication::desktop()->height(); 208 int dh = QApplication::desktop()->height();
210 setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 209 setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
211 show(); 210 show();
212 raise(); 211 raise();
213 qApp->processEvents(); 212 qApp->processEvents();
214 repaint(); 213 repaint();
215 qApp->processEvents(); 214 qApp->processEvents();
216 215
217#ifndef _WIN32_ 216#ifndef _WIN32_
218 if ( fd_led > 0 ) { 217 if ( fd_led > 0 ) {
219 statusLED.status = LED_SALARM_ON ; 218 statusLED.status = LED_SALARM_ON ;
220 ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); 219 ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED);
221 } 220 }
222#endif 221#endif
223 playSoundTimer->start( 1000, true ); 222 playSoundTimer->start( 1000, true );
224 return true; 223 return true;
225 224
226} 225}
227 226
228 227
229void AlarmDialog::playSound () 228void AlarmDialog::playSound ()
230{ 229{
231 if (mStopAlarm ) 230 if (mStopAlarm )
232 return; 231 return;
233 showNormal(); 232 showNormal();
234 setActiveWindow(); 233 setActiveWindow();
235 setFocus(); 234 setFocus();
236 raise(); 235 raise();
237 236
238 qApp->processEvents(); 237 qApp->processEvents();
239 if ( alarmCounter < maxAlarmReplay && ! mSilent) { 238 if ( alarmCounter < maxAlarmReplay && ! mSilent) {
240 ++alarmCounter; 239 ++alarmCounter;
241 if ( !mPlayWav || mFileName.length() < 2 ) { 240 if ( !mPlayWav || mFileName.length() < 2 ) {
242 241
243#ifndef DESKTOP_VERSION 242#ifndef DESKTOP_VERSION
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 7ac5b11..0956c78 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3282,195 +3282,195 @@ void CalendarView::toggleAllDaySize()
3282 /* 3282 /*
3283 if ( KOPrefs::instance()->mAllDaySize > 47 ) 3283 if ( KOPrefs::instance()->mAllDaySize > 47 )
3284 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 3284 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
3285 else 3285 else
3286 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 3286 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
3287 */ 3287 */
3288 viewManager()->agendaView()->toggleAllDay(); 3288 viewManager()->agendaView()->toggleAllDay();
3289} 3289}
3290void CalendarView::toggleExpand() 3290void CalendarView::toggleExpand()
3291{ 3291{
3292 // if ( mLeftFrame->isHidden() ) { 3292 // if ( mLeftFrame->isHidden() ) {
3293 // mLeftFrame->show(); 3293 // mLeftFrame->show();
3294 // emit calendarViewExpanded( false ); 3294 // emit calendarViewExpanded( false );
3295 // } else { 3295 // } else {
3296 // mLeftFrame->hide(); 3296 // mLeftFrame->hide();
3297 // emit calendarViewExpanded( true ); 3297 // emit calendarViewExpanded( true );
3298 // } 3298 // }
3299 3299
3300 globalFlagBlockAgenda = 1; 3300 globalFlagBlockAgenda = 1;
3301 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 3301 emit calendarViewExpanded( !mLeftFrame->isHidden() );
3302 globalFlagBlockAgenda = 5; 3302 globalFlagBlockAgenda = 5;
3303 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 3303 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
3304 //mViewManager->showView( 0, true ); 3304 //mViewManager->showView( 0, true );
3305} 3305}
3306 3306
3307void CalendarView::calendarModified( bool modified, Calendar * ) 3307void CalendarView::calendarModified( bool modified, Calendar * )
3308{ 3308{
3309 setModified( modified ); 3309 setModified( modified );
3310} 3310}
3311 3311
3312Todo *CalendarView::selectedTodo() 3312Todo *CalendarView::selectedTodo()
3313{ 3313{
3314 Incidence *incidence = currentSelection(); 3314 Incidence *incidence = currentSelection();
3315 if ( incidence && incidence->type() == "Todo" ) { 3315 if ( incidence && incidence->type() == "Todo" ) {
3316 return static_cast<Todo *>( incidence ); 3316 return static_cast<Todo *>( incidence );
3317 } 3317 }
3318 3318
3319 incidence = mTodoList->selectedIncidences().first(); 3319 incidence = mTodoList->selectedIncidences().first();
3320 if ( incidence && incidence->type() == "Todo" ) { 3320 if ( incidence && incidence->type() == "Todo" ) {
3321 return static_cast<Todo *>( incidence ); 3321 return static_cast<Todo *>( incidence );
3322 } 3322 }
3323 3323
3324 return 0; 3324 return 0;
3325} 3325}
3326 3326
3327void CalendarView::dialogClosing(Incidence *in) 3327void CalendarView::dialogClosing(Incidence *in)
3328{ 3328{
3329 // mDialogList.remove(in); 3329 // mDialogList.remove(in);
3330} 3330}
3331 3331
3332void CalendarView::showIncidence() 3332void CalendarView::showIncidence()
3333{ 3333{
3334 Incidence *incidence = currentSelection(); 3334 Incidence *incidence = currentSelection();
3335 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3335 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3336 if ( incidence ) { 3336 if ( incidence ) {
3337 ShowIncidenceVisitor v; 3337 ShowIncidenceVisitor v;
3338 v.act( incidence, this ); 3338 v.act( incidence, this );
3339 } 3339 }
3340} 3340}
3341void CalendarView::editIncidenceDescription() 3341void CalendarView::editIncidenceDescription()
3342{ 3342{
3343 mFlagEditDescription = true; 3343 mFlagEditDescription = true;
3344 editIncidence(); 3344 editIncidence();
3345 mFlagEditDescription = false; 3345 mFlagEditDescription = false;
3346} 3346}
3347void CalendarView::editIncidence() 3347void CalendarView::editIncidence()
3348{ 3348{
3349 // qDebug("editIncidence() "); 3349 // qDebug("editIncidence() ");
3350 Incidence *incidence = currentSelection(); 3350 Incidence *incidence = currentSelection();
3351 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3351 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3352 if ( incidence ) { 3352 if ( incidence ) {
3353 EditIncidenceVisitor v; 3353 EditIncidenceVisitor v;
3354 v.act( incidence, this ); 3354 v.act( incidence, this );
3355 } 3355 }
3356} 3356}
3357 3357
3358void CalendarView::deleteIncidence() 3358void CalendarView::deleteIncidence()
3359{ 3359{
3360 Incidence *incidence = currentSelection(); 3360 Incidence *incidence = currentSelection();
3361 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3361 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3362 if ( incidence ) { 3362 if ( incidence ) {
3363 deleteIncidence(incidence); 3363 deleteIncidence(incidence);
3364 } 3364 }
3365} 3365}
3366 3366
3367void CalendarView::showIncidence(Incidence *incidence) 3367void CalendarView::showIncidence(Incidence *incidence)
3368{ 3368{
3369 if ( incidence ) { 3369 if ( incidence ) {
3370 ShowIncidenceVisitor v; 3370 ShowIncidenceVisitor v;
3371 v.act( incidence, this ); 3371 v.act( incidence, this );
3372 } 3372 }
3373} 3373}
3374 3374
3375void CalendarView::editIncidence(Incidence *incidence) 3375void CalendarView::editIncidence(Incidence *incidence)
3376{ 3376{
3377 if ( incidence ) { 3377 if ( incidence ) {
3378 3378
3379 EditIncidenceVisitor v; 3379 EditIncidenceVisitor v;
3380 v.act( incidence, this ); 3380 v.act( incidence, this );
3381 3381
3382 } 3382 }
3383} 3383}
3384 3384
3385void CalendarView::deleteIncidence(Incidence *incidence) 3385void CalendarView::deleteIncidence(Incidence *incidence)
3386{ 3386{
3387 //qDebug(" CalendarView::deleteIncidence "); 3387 //qDebug(" CalendarView::deleteIncidence ");
3388 if ( incidence ) { 3388 if ( incidence ) {
3389 DeleteIncidenceVisitor v; 3389 DeleteIncidenceVisitor v;
3390 v.act( incidence, this ); 3390 v.act( incidence, this );
3391 } 3391 }
3392} 3392}
3393 3393
3394 3394
3395void CalendarView::lookForOutgoingMessages() 3395void CalendarView::lookForOutgoingMessages()
3396{ 3396{
3397 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 3397 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
3398 ogd->loadMessages(); 3398 ogd->loadMessages();
3399} 3399}
3400 3400
3401void CalendarView::lookForIncomingMessages() 3401void CalendarView::lookForIncomingMessages()
3402{ 3402{
3403 IncomingDialog *icd = mDialogManager->incomingDialog(); 3403 IncomingDialog *icd = mDialogManager->incomingDialog();
3404 icd->retrieve(); 3404 icd->retrieve();
3405} 3405}
3406 3406
3407bool CalendarView::removeCompletedSubTodos( Todo* t ) 3407bool CalendarView::removeCompletedSubTodos( Todo* t )
3408{ 3408{
3409 bool deleteTodo = true; 3409 bool deleteTodo = true;
3410 QPtrList<Incidence> subTodos; 3410 QPtrList<Incidence> subTodos;
3411 Incidence *aTodo; 3411 Incidence *aTodo;
3412 subTodos = t->relations(); 3412 subTodos = t->relations();
3413 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 3413 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
3414 if (! removeCompletedSubTodos( (Todo*) aTodo )) 3414 if (! removeCompletedSubTodos( (Todo*) aTodo ))
3415 deleteTodo = false; 3415 deleteTodo = false;
3416 } 3416 }
3417 if ( deleteTodo ) { 3417 if ( deleteTodo ) {
3418 if ( t->isCompleted() ) { 3418 if ( t->isCompleted() ) {
3419 checkZaurusId( t->zaurusId(), true ); 3419 checkZaurusId( t->zaurusId(), true );
3420 mCalendar->deleteTodo( t ); 3420 mCalendar->deleteTodo( t );
3421 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 3421 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
3422 } 3422 }
3423 else 3423 else
3424 deleteTodo = false; 3424 deleteTodo = false;
3425 } 3425 }
3426 return deleteTodo; 3426 return deleteTodo;
3427 3427
3428} 3428}
3429void CalendarView::purgeCompleted() 3429void CalendarView::purgeCompleted()
3430{ 3430{
3431 int result = KMessageBox::warningContinueCancel(this, 3431 int result = KMessageBox::warningContinueCancel(this,
3432 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); 3432 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge"));
3433 3433
3434 if (result == KMessageBox::Continue) { 3434 if (result == KMessageBox::Continue) {
3435 3435
3436 QPtrList<Todo> todoCal; 3436 QPtrList<Todo> todoCal;
3437 QPtrList<Todo> rootTodos; 3437 QPtrList<Todo> rootTodos;
3438 //QPtrList<Incidence> rel; 3438 //QPtrList<Incidence> rel;
3439 Todo *aTodo;//, *rTodo; 3439 Todo *aTodo;//, *rTodo;
3440 Incidence *rIncidence; 3440 Incidence *rIncidence;
3441 bool childDelete = false; 3441 bool childDelete = false;
3442 bool deletedOne = true; 3442 bool deletedOne = true;
3443 todoCal = calendar()->todos(); 3443 todoCal = calendar()->todos();
3444 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 3444 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
3445 if ( !aTodo->relatedTo() ) 3445 if ( !aTodo->relatedTo() )
3446 rootTodos.append( aTodo ); 3446 rootTodos.append( aTodo );
3447 } 3447 }
3448 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 3448 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
3449 removeCompletedSubTodos( aTodo ); 3449 removeCompletedSubTodos( aTodo );
3450 } 3450 }
3451 3451
3452 updateView(); 3452 updateView();
3453 } 3453 }
3454} 3454}
3455 3455
3456void CalendarView::slotCalendarChanged() 3456void CalendarView::slotCalendarChanged()
3457{ 3457{
3458 ; 3458 ;
3459} 3459}
3460 3460
3461NavigatorBar *CalendarView::navigatorBar() 3461NavigatorBar *CalendarView::navigatorBar()
3462{ 3462{
3463 return mNavigatorBar; 3463 return mNavigatorBar;
3464} 3464}
3465 3465
3466 3466
3467 3467
3468void CalendarView::keyPressEvent ( QKeyEvent *e) 3468void CalendarView::keyPressEvent ( QKeyEvent *e)
3469{ 3469{
3470 //qDebug(" alendarView::keyPressEvent "); 3470 //qDebug(" alendarView::keyPressEvent ");
3471 e->ignore(); 3471 e->ignore();
3472} 3472}
3473 3473
3474#include "calendarview.moc" 3474//#include "calendarview.moc"
3475 3475
3476#include "calendarviewbase.moc" 3476//#include "calendarviewbase.moc"
diff --git a/korganizer/datenavigator.cpp b/korganizer/datenavigator.cpp
index 8d35c42..e26e20b 100644
--- a/korganizer/datenavigator.cpp
+++ b/korganizer/datenavigator.cpp
@@ -95,193 +95,193 @@ int DateNavigator::datesCount() const
95} 95}
96 96
97void DateNavigator::selectDates( const DateList& dateList ) 97void DateNavigator::selectDates( const DateList& dateList )
98{ 98{
99 if (dateList.count() > 0) { 99 if (dateList.count() > 0) {
100 mSelectedDates = dateList; 100 mSelectedDates = dateList;
101 emitSelected(); 101 emitSelected();
102 } 102 }
103} 103}
104 104
105void DateNavigator::selectDate( const QDate &date ) 105void DateNavigator::selectDate( const QDate &date )
106{ 106{
107 QDate d = date; 107 QDate d = date;
108 108
109 if ( !d.isValid() ) { 109 if ( !d.isValid() ) {
110 d = QDate::currentDate(); 110 d = QDate::currentDate();
111 } 111 }
112 112
113 mSelectedDates.clear(); 113 mSelectedDates.clear();
114 mSelectedDates.append( d ); 114 mSelectedDates.append( d );
115 115
116 emitSelected(); 116 emitSelected();
117} 117}
118 118
119void DateNavigator::selectDates( int count ) 119void DateNavigator::selectDates( int count )
120{ 120{
121 121
122 QDate d = mSelectedDates.first(); 122 QDate d = mSelectedDates.first();
123 selectDates( d, count ); 123 selectDates( d, count );
124} 124}
125 125
126void DateNavigator::selectDates( const QDate &d, int count ) 126void DateNavigator::selectDates( const QDate &d, int count )
127{ 127{
128 DateList dates; 128 DateList dates;
129 129
130 int i; 130 int i;
131 for( i = 0; i < count; ++i ) { 131 for( i = 0; i < count; ++i ) {
132 dates.append( d.addDays( i ) ); 132 dates.append( d.addDays( i ) );
133 } 133 }
134 134
135 mSelectedDates = dates; 135 mSelectedDates = dates;
136 136
137 emitSelected(); 137 emitSelected();
138} 138}
139 139
140void DateNavigator::selectWeekByDay( int weekDay, const QDate &d ) 140void DateNavigator::selectWeekByDay( int weekDay, const QDate &d )
141{ 141{
142 // qDebug("selectWeekByDay( %d %s ", weekDay, d.toString().latin1()); 142 // qDebug("selectWeekByDay( %d %s ", weekDay, d.toString().latin1());
143 int dateCount = mSelectedDates.count(); 143 int dateCount = mSelectedDates.count();
144 bool weekStart = ( weekDay == KGlobal::locale()->weekStartDay() ); 144 bool weekStart = ( weekDay == KGlobal::locale()->weekStartDay() );
145 if ( weekDay == 1 && dateCount == 5 ) selectWorkWeek( d ); 145 if ( weekDay == 1 && dateCount == 5 ) selectWorkWeek( d );
146 else if ( weekStart && dateCount == 7 ) selectWeek( d ); 146 else if ( weekStart && dateCount == 7 ) selectWeek( d );
147 else selectDates( d, dateCount ); 147 else selectDates( d, dateCount );
148} 148}
149 149
150void DateNavigator::selectWeek() 150void DateNavigator::selectWeek()
151{ 151{
152 QDate d = mSelectedDates.first(); 152 QDate d = mSelectedDates.first();
153 selectWeek( d ); 153 selectWeek( d );
154} 154}
155void DateNavigator::selectWeek( int num ) 155void DateNavigator::selectWeek( int num )
156{ 156{
157 int year = mSelectedDates.first().year(); 157 int year = mSelectedDates.first().year();
158 if ( mSelectedDates.first().dayOfYear() > 300 && num < 10 ) 158 if ( mSelectedDates.first().dayOfYear() > 300 && num < 10 )
159 ++year; 159 ++year;
160 if ( mSelectedDates.first().dayOfYear() < 70 && num > 40 ) 160 if ( mSelectedDates.first().dayOfYear() < 70 && num > 40 )
161 --year; 161 --year;
162 QDate d = QDate ( year, 1,1); 162 QDate d = QDate ( year, 1,1);
163 while ( d.dayOfWeek() != 4 ) 163 while ( d.dayOfWeek() != 4 )
164 d = d.addDays( 1 ); 164 d = d.addDays( 1 );
165 selectWeek( d.addDays ( (num-1) *7 ) ); 165 selectWeek( d.addDays ( (num-1) *7 ) );
166} 166}
167void DateNavigator::selectWeek( const QDate &d ) 167void DateNavigator::selectWeek( const QDate &d )
168{ 168{
169 int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); 169 int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d );
170 170
171 int weekStart = KGlobal::locale()->weekStartDay(); 171 int weekStart = KGlobal::locale()->weekStartDay();
172 QDate firstDate = d.addDays( weekStart - dayOfWeek ); 172 QDate firstDate = d.addDays( weekStart - dayOfWeek );
173 173
174 if ( weekStart != 1 && dayOfWeek < weekStart ) { 174 if ( weekStart != 1 && dayOfWeek < weekStart ) {
175 firstDate = firstDate.addDays(-7 ); 175 firstDate = firstDate.addDays(-7 );
176 } 176 }
177 177
178 178
179 selectDates( firstDate, 7 ); 179 selectDates( firstDate, 7 );
180} 180}
181 181
182void DateNavigator::selectWorkWeek() 182void DateNavigator::selectWorkWeek()
183{ 183{
184 QDate d = mSelectedDates.first(); 184 QDate d = mSelectedDates.first();
185 selectWorkWeek( d ); 185 selectWorkWeek( d );
186} 186}
187 187
188void DateNavigator::selectWorkWeek( const QDate &d ) 188void DateNavigator::selectWorkWeek( const QDate &d )
189{ 189{
190 int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); 190 int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d );
191 191
192 QDate firstDate = d.addDays( 1 - dayOfWeek ); 192 QDate firstDate = d.addDays( 1 - dayOfWeek );
193 193
194 int weekStart = KGlobal::locale()->weekStartDay(); 194 int weekStart = KGlobal::locale()->weekStartDay();
195 if ( weekStart != 1 && dayOfWeek >= weekStart ) { 195 if ( weekStart != 1 && dayOfWeek >= weekStart ) {
196 firstDate = firstDate.addDays( 7 ); 196 firstDate = firstDate.addDays( 7 );
197 } 197 }
198 198
199 selectDates( firstDate, 5 ); 199 selectDates( firstDate, 5 );
200} 200}
201 201
202void DateNavigator::selectToday() 202void DateNavigator::selectToday()
203{ 203{
204 QDate d = QDate::currentDate(); 204 QDate d = QDate::currentDate();
205 205
206 int dateCount = mSelectedDates.count(); 206 int dateCount = mSelectedDates.count();
207 207
208 if ( dateCount == 5 ) selectWorkWeek( d ); 208 if ( dateCount == 5 ) selectWorkWeek( d );
209 else if ( dateCount == 7 ) selectWeek( d ); 209 else if ( dateCount == 7 ) selectWeek( d );
210 else selectDates( d, dateCount ); 210 else selectDates( d, dateCount );
211} 211}
212 212
213void DateNavigator::selectPreviousYear() 213void DateNavigator::selectPreviousYear()
214{ 214{
215 QDate firstSelected = mSelectedDates.first(); 215 QDate firstSelected = mSelectedDates.first();
216 int weekDay = firstSelected.dayOfWeek(); 216 int weekDay = firstSelected.dayOfWeek();
217 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 ); 217 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 );
218 218
219 selectWeekByDay( weekDay, firstSelected ); 219 selectWeekByDay( weekDay, firstSelected );
220} 220}
221 221
222void DateNavigator::selectPreviousMonth() 222void DateNavigator::selectPreviousMonth()
223{ 223{
224 QDate firstSelected = mSelectedDates.first(); 224 QDate firstSelected = mSelectedDates.first();
225 int weekDay = firstSelected.dayOfWeek(); 225 int weekDay = firstSelected.dayOfWeek();
226 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, -1 ); 226 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, -1 );
227 227
228 228
229 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) 229 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 )
230 selectMonthByDate( firstSelected ); 230 selectMonthByDate( firstSelected );
231 else 231 else
232 selectWeekByDay( weekDay, firstSelected ); 232 selectWeekByDay( weekDay, firstSelected );
233} 233}
234 234
235void DateNavigator::selectNextMonth() 235void DateNavigator::selectNextMonth()
236{ 236{
237 QDate firstSelected = mSelectedDates.first(); 237 QDate firstSelected = mSelectedDates.first();
238 int weekDay = firstSelected.dayOfWeek(); 238 int weekDay = firstSelected.dayOfWeek();
239 239
240 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, 1 ); 240 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, 1 );
241 241
242 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) 242 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 )
243 selectMonthByDate( firstSelected ); 243 selectMonthByDate( firstSelected );
244 else 244 else
245 selectWeekByDay( weekDay, firstSelected ); 245 selectWeekByDay( weekDay, firstSelected );
246 246
247} 247}
248 248
249void DateNavigator::selectNextYear() 249void DateNavigator::selectNextYear()
250{ 250{
251 QDate firstSelected = mSelectedDates.first(); 251 QDate firstSelected = mSelectedDates.first();
252 int weekDay = firstSelected.dayOfWeek(); 252 int weekDay = firstSelected.dayOfWeek();
253 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 ); 253 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 );
254 254
255 selectWeekByDay( weekDay, firstSelected ); 255 selectWeekByDay( weekDay, firstSelected );
256} 256}
257 257
258void DateNavigator::selectPrevious() 258void DateNavigator::selectPrevious()
259{ 259{
260 int offset = -7; 260 int offset = -7;
261 if ( datesCount() == 1 ) { 261 if ( datesCount() == 1 ) {
262 offset = -1; 262 offset = -1;
263 } 263 }
264 if ( mViewManager ) 264 if ( mViewManager )
265 if ( mViewManager->showsNextDays() ) 265 if ( mViewManager->showsNextDays() )
266 offset = -datesCount(); 266 offset = -datesCount();
267 selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); 267 selectDates( mSelectedDates.first().addDays( offset ), datesCount() );
268} 268}
269 269
270void DateNavigator::selectNext() 270void DateNavigator::selectNext()
271{ 271{
272 int offset = 7; 272 int offset = 7;
273 if ( datesCount() == 1 ) { 273 if ( datesCount() == 1 ) {
274 offset = 1; 274 offset = 1;
275 } 275 }
276 if ( mViewManager ) 276 if ( mViewManager )
277 if ( mViewManager->showsNextDays() ) 277 if ( mViewManager->showsNextDays() )
278 offset = datesCount(); 278 offset = datesCount();
279 selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); 279 selectDates( mSelectedDates.first().addDays( offset ), datesCount() );
280} 280}
281 281
282void DateNavigator::emitSelected() 282void DateNavigator::emitSelected()
283{ 283{
284 emit datesSelected( mSelectedDates ); 284 emit datesSelected( mSelectedDates );
285} 285}
286 286
287#include "datenavigator.moc" 287//#include "datenavigator.moc"
diff --git a/korganizer/filtereditdialog.cpp b/korganizer/filtereditdialog.cpp
index 2943e41..ca09844 100644
--- a/korganizer/filtereditdialog.cpp
+++ b/korganizer/filtereditdialog.cpp
@@ -1,235 +1,235 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
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 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 <qlistbox.h>
30#include <qapplication.h> 30#include <qapplication.h>
31 31
32#include <kdebug.h> 32#include <kdebug.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <klineeditdlg.h> 34#include <klineeditdlg.h>
35#include <kmessagebox.h> 35#include <kmessagebox.h>
36 36
37#include <libkdepim/categoryselectdialog.h> 37#include <libkdepim/categoryselectdialog.h>
38 38
39#include "koprefs.h" 39#include "koprefs.h"
40#include "filteredit_base.h" 40#include "filteredit_base.h"
41 41
42#include "filtereditdialog.h" 42#include "filtereditdialog.h"
43#include "filtereditdialog.moc" 43//#include "filtereditdialog.moc"
44 44
45// TODO: Make dialog work on a copy of the filters objects. 45// TODO: Make dialog work on a copy of the filters objects.
46 46
47class ComboFilterBox: public QComboBox 47class ComboFilterBox: public QComboBox
48{ 48{
49public: 49public:
50 ComboFilterBox( QWidget *parent=0, const char *name=0) : 50 ComboFilterBox( QWidget *parent=0, const char *name=0) :
51 QComboBox( parent,name ) { } 51 QComboBox( parent,name ) { }
52 void popupBox() { popup(); } 52 void popupBox() { popup(); }
53 53
54}; 54};
55 55
56FilterEditDialog::FilterEditDialog(QPtrList<CalFilter> *filters,QWidget *parent, 56FilterEditDialog::FilterEditDialog(QPtrList<CalFilter> *filters,QWidget *parent,
57 const char *name) : 57 const char *name) :
58 KDialogBase(parent,name,true,i18n("Edit Calendar Filters"), 58 KDialogBase(parent,name,true,i18n("Edit Calendar Filters"),
59 Ok|Apply|Cancel) 59 Ok|Apply|Cancel)
60{ 60{
61 mFilters = filters; 61 mFilters = filters;
62 62
63 QWidget *mainWidget = new QWidget(this); 63 QWidget *mainWidget = new QWidget(this);
64 setMainWidget(mainWidget); 64 setMainWidget(mainWidget);
65 65
66 mSelectionCombo = new ComboFilterBox(mainWidget); 66 mSelectionCombo = new ComboFilterBox(mainWidget);
67 connect(mSelectionCombo,SIGNAL(activated(int)),SLOT(filterSelected())); 67 connect(mSelectionCombo,SIGNAL(activated(int)),SLOT(filterSelected()));
68 // mSelectionCombo->setEditable ( true ); 68 // mSelectionCombo->setEditable ( true );
69 QPushButton *addButton = new QPushButton(i18n("Add Filter"),mainWidget); 69 QPushButton *addButton = new QPushButton(i18n("Add Filter"),mainWidget);
70 connect(addButton,SIGNAL(clicked()),SLOT(slotAdd())); 70 connect(addButton,SIGNAL(clicked()),SLOT(slotAdd()));
71 addButton->setMaximumSize( addButton->sizeHint()); 71 addButton->setMaximumSize( addButton->sizeHint());
72 mRemoveButton = new QPushButton( i18n("Remove"), mainWidget ); 72 mRemoveButton = new QPushButton( i18n("Remove"), mainWidget );
73 connect( mRemoveButton, SIGNAL( clicked() ), SLOT( slotRemove() ) ); 73 connect( mRemoveButton, SIGNAL( clicked() ), SLOT( slotRemove() ) );
74 mRemoveButton->setMaximumSize( mRemoveButton->sizeHint()); 74 mRemoveButton->setMaximumSize( mRemoveButton->sizeHint());
75 75
76 QPushButton *upButton = new QPushButton(i18n("Up"),mainWidget); 76 QPushButton *upButton = new QPushButton(i18n("Up"),mainWidget);
77 upButton->setMaximumSize( upButton->sizeHint()); 77 upButton->setMaximumSize( upButton->sizeHint());
78 connect(upButton,SIGNAL(clicked()),SLOT(slotUp())); 78 connect(upButton,SIGNAL(clicked()),SLOT(slotUp()));
79 79
80 80
81 mEditor = new FilterEdit_base(mainWidget); 81 mEditor = new FilterEdit_base(mainWidget);
82 82
83 QGridLayout *topLayout = new QGridLayout(mainWidget,2,2); 83 QGridLayout *topLayout = new QGridLayout(mainWidget,2,2);
84 topLayout->setSpacing(spacingHint()); 84 topLayout->setSpacing(spacingHint());
85 topLayout->addWidget(mSelectionCombo,0,0); 85 topLayout->addWidget(mSelectionCombo,0,0);
86 topLayout->addWidget(upButton,0,1); 86 topLayout->addWidget(upButton,0,1);
87 topLayout->addWidget(addButton,0,2); 87 topLayout->addWidget(addButton,0,2);
88 topLayout->addWidget(mRemoveButton,0,3); 88 topLayout->addWidget(mRemoveButton,0,3);
89 topLayout->addMultiCellWidget(mEditor,1,1,0,3); 89 topLayout->addMultiCellWidget(mEditor,1,1,0,3);
90 mSelectionCombo->setMaximumWidth ( QApplication::desktop()->width() - 90 mSelectionCombo->setMaximumWidth ( QApplication::desktop()->width() -
91 addButton->maximumWidth() - 91 addButton->maximumWidth() -
92 mRemoveButton->maximumWidth() - 92 mRemoveButton->maximumWidth() -
93 upButton->maximumWidth() - 93 upButton->maximumWidth() -
94 spacingHint() * 5 ); 94 spacingHint() * 5 );
95 connect(mEditor->mCatEditButton,SIGNAL(clicked()), 95 connect(mEditor->mCatEditButton,SIGNAL(clicked()),
96 SLOT(editCategorySelection())); 96 SLOT(editCategorySelection()));
97 97
98 // Clicking cancel exits the dialog without saving 98 // Clicking cancel exits the dialog without saving
99 connect(this,SIGNAL(cancelClicked()),SLOT(reject())); 99 connect(this,SIGNAL(cancelClicked()),SLOT(reject()));
100 updateFilterList(); 100 updateFilterList();
101} 101}
102 102
103FilterEditDialog::~FilterEditDialog() 103FilterEditDialog::~FilterEditDialog()
104{ 104{
105} 105}
106void FilterEditDialog::slotUp() 106void FilterEditDialog::slotUp()
107{ 107{
108 108
109 if ( mFilters->count() <= 1 ) return; 109 if ( mFilters->count() <= 1 ) return;
110 if ( mSelectionCombo->currentItem() == 0 ) return; 110 if ( mSelectionCombo->currentItem() == 0 ) return;
111 int num = mSelectionCombo->currentItem(); 111 int num = mSelectionCombo->currentItem();
112 CalFilter* f = new CalFilter( ); 112 CalFilter* f = new CalFilter( );
113 *f = *(mFilters->at( num )); 113 *f = *(mFilters->at( num ));
114 mFilters->remove( num ); 114 mFilters->remove( num );
115 mFilters->insert( num-1, f ); 115 mFilters->insert( num-1, f );
116 updateFilterList(); 116 updateFilterList();
117 mSelectionCombo->setCurrentItem( num-1 ); 117 mSelectionCombo->setCurrentItem( num-1 );
118 readFilter(f); 118 readFilter(f);
119 //qApp->processEvents(); 119 //qApp->processEvents();
120 //mSelectionCombo->popupBox(); 120 //mSelectionCombo->popupBox();
121} 121}
122void FilterEditDialog::updateFilterList() 122void FilterEditDialog::updateFilterList()
123{ 123{
124 mSelectionCombo->clear(); 124 mSelectionCombo->clear();
125 125
126 CalFilter *filter = mFilters->first(); 126 CalFilter *filter = mFilters->first();
127 127
128 if (!filter) { 128 if (!filter) {
129 enableButtonOK(false); 129 enableButtonOK(false);
130 enableButtonApply(false); 130 enableButtonApply(false);
131 } else { 131 } else {
132 while(filter) { 132 while(filter) {
133 mSelectionCombo->insertItem(filter->name()); 133 mSelectionCombo->insertItem(filter->name());
134 filter = mFilters->next(); 134 filter = mFilters->next();
135 } 135 }
136 CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); 136 CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
137 if (f) readFilter(f); 137 if (f) readFilter(f);
138 138
139 enableButtonOK(true); 139 enableButtonOK(true);
140 enableButtonApply(true); 140 enableButtonApply(true);
141 } 141 }
142 142
143 mRemoveButton->setEnabled( mFilters->count() > 1 ); 143 mRemoveButton->setEnabled( mFilters->count() > 1 );
144} 144}
145 145
146void FilterEditDialog::slotDefault() 146void FilterEditDialog::slotDefault()
147{ 147{
148} 148}
149 149
150void FilterEditDialog::slotApply() 150void FilterEditDialog::slotApply()
151{ 151{
152 CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); 152 CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
153 writeFilter(f); 153 writeFilter(f);
154 emit filterChanged(); 154 emit filterChanged();
155} 155}
156void FilterEditDialog::accept() 156void FilterEditDialog::accept()
157{ 157{
158 slotOk(); 158 slotOk();
159} 159}
160void FilterEditDialog::slotOk() 160void FilterEditDialog::slotOk()
161{ 161{
162 CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); 162 CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
163 writeFilter(f); 163 writeFilter(f);
164 emit filterChanged(); 164 emit filterChanged();
165 QDialog::accept(); 165 QDialog::accept();
166} 166}
167 167
168void FilterEditDialog::slotAdd() 168void FilterEditDialog::slotAdd()
169{ 169{
170 KLineEditDlg dlg(i18n("Enter filter name:"), "New Filter", this); 170 KLineEditDlg dlg(i18n("Enter filter name:"), "New Filter", this);
171 dlg.setCaption(i18n("Add Filter")); 171 dlg.setCaption(i18n("Add Filter"));
172 if (dlg.exec()) { 172 if (dlg.exec()) {
173 if ( dlg.text().length() > 0 ) { 173 if ( dlg.text().length() > 0 ) {
174 mFilters->append(new CalFilter(dlg.text())); 174 mFilters->append(new CalFilter(dlg.text()));
175 updateFilterList(); 175 updateFilterList();
176 int num = mSelectionCombo->count() -1 ; 176 int num = mSelectionCombo->count() -1 ;
177 mSelectionCombo->setCurrentItem( num ); 177 mSelectionCombo->setCurrentItem( num );
178 readFilter(mFilters->at( num ) ); 178 readFilter(mFilters->at( num ) );
179 } 179 }
180 } 180 }
181} 181}
182 182
183void FilterEditDialog::slotRemove() 183void FilterEditDialog::slotRemove()
184{ 184{
185 int currentItem = mSelectionCombo->currentItem(); 185 int currentItem = mSelectionCombo->currentItem();
186 if ( currentItem < 0 ) return; 186 if ( currentItem < 0 ) return;
187 187
188 // We need at least a default filter object. 188 // We need at least a default filter object.
189 if ( mFilters->count() <= 1 ) return; 189 if ( mFilters->count() <= 1 ) return;
190 190
191 int result = KMessageBox::questionYesNo( this, 191 int result = KMessageBox::questionYesNo( this,
192 i18n("This item will be\npermanently deleted.") ); 192 i18n("This item will be\npermanently deleted.") );
193 193
194 if ( result != KMessageBox::Yes ) { 194 if ( result != KMessageBox::Yes ) {
195 return; 195 return;
196 } 196 }
197 197
198 mFilters->remove( currentItem ); 198 mFilters->remove( currentItem );
199 updateFilterList(); 199 updateFilterList();
200 emit filterChanged(); 200 emit filterChanged();
201} 201}
202 202
203void FilterEditDialog::editCategorySelection() 203void FilterEditDialog::editCategorySelection()
204{ 204{
205 KPIM::CategorySelectDialog *dlg = new KPIM::CategorySelectDialog( 205 KPIM::CategorySelectDialog *dlg = new KPIM::CategorySelectDialog(
206 KOPrefs::instance(), this, "filterCatSelect", true ); 206 KOPrefs::instance(), this, "filterCatSelect", true );
207 dlg->setSelected(mCategories); 207 dlg->setSelected(mCategories);
208 208
209 connect(dlg,SIGNAL(categoriesSelected(const QStringList &)), 209 connect(dlg,SIGNAL(categoriesSelected(const QStringList &)),
210 SLOT(updateCategorySelection(const QStringList &))); 210 SLOT(updateCategorySelection(const QStringList &)));
211 211
212 dlg->exec(); 212 dlg->exec();
213} 213}
214 214
215void FilterEditDialog::updateCategorySelection(const QStringList &categories) 215void FilterEditDialog::updateCategorySelection(const QStringList &categories)
216{ 216{
217 mCategories = categories; 217 mCategories = categories;
218 218
219 mEditor->mCatList->clear(); 219 mEditor->mCatList->clear();
220 mEditor->mCatList->insertStringList(mCategories); 220 mEditor->mCatList->insertStringList(mCategories);
221} 221}
222 222
223void FilterEditDialog::filterSelected() 223void FilterEditDialog::filterSelected()
224{ 224{
225 CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); 225 CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
226 if (f) readFilter(f); 226 if (f) readFilter(f);
227} 227}
228 228
229void FilterEditDialog::readFilter(CalFilter *filter) 229void FilterEditDialog::readFilter(CalFilter *filter)
230{ 230{
231 int c = filter->criteria(); 231 int c = filter->criteria();
232 232
233 mEditor->mCompletedCheck->setChecked(c & CalFilter::HideCompleted); 233 mEditor->mCompletedCheck->setChecked(c & CalFilter::HideCompleted);
234 mEditor->mRecurringCheck->setChecked(c & CalFilter::HideRecurring); 234 mEditor->mRecurringCheck->setChecked(c & CalFilter::HideRecurring);
235 mEditor->mPublicCheck->setChecked(c & CalFilter::ShowPublic); 235 mEditor->mPublicCheck->setChecked(c & CalFilter::ShowPublic);
diff --git a/korganizer/incomingdialog.cpp b/korganizer/incomingdialog.cpp
index 490d21e..f3bd09f 100644
--- a/korganizer/incomingdialog.cpp
+++ b/korganizer/incomingdialog.cpp
@@ -335,193 +335,193 @@ bool IncomingDialog::incomeCounter(ScheduleItemIn *item)
335 //the counter-sender's email is missing... 335 //the counter-sender's email is missing...
336 //now every attendee gets an declinecounter :-( 336 //now every attendee gets an declinecounter :-(
337 mOutgoing->addMessage(counterEvent,Scheduler::Declinecounter); 337 mOutgoing->addMessage(counterEvent,Scheduler::Declinecounter);
338 delete item; 338 delete item;
339 emit numMessagesChanged(mMessageListView->childCount()); 339 emit numMessagesChanged(mMessageListView->childCount());
340 mScheduler->deleteTransaction(item->event()); 340 mScheduler->deleteTransaction(item->event());
341 delete item; 341 delete item;
342 emit numMessagesChanged(mMessageListView->childCount()); 342 emit numMessagesChanged(mMessageListView->childCount());
343 return true; 343 return true;
344 } 344 }
345 //mScheduler->deleteTransaction(item->event()); 345 //mScheduler->deleteTransaction(item->event());
346 delete item; 346 delete item;
347 emit numMessagesChanged(mMessageListView->childCount()); 347 emit numMessagesChanged(mMessageListView->childCount());
348 return false; 348 return false;
349} 349}
350 350
351bool IncomingDialog::incomeDeclineCounter(ScheduleItemIn *item) 351bool IncomingDialog::incomeDeclineCounter(ScheduleItemIn *item)
352{ 352{
353 Event *even = mCalendar->event(item->event()->uid()); 353 Event *even = mCalendar->event(item->event()->uid());
354 if (even) { 354 if (even) {
355 mOutgoing->addMessage(even,Scheduler::Refresh); 355 mOutgoing->addMessage(even,Scheduler::Refresh);
356 mScheduler->deleteTransaction(item->event()); 356 mScheduler->deleteTransaction(item->event());
357 delete item; 357 delete item;
358 emit numMessagesChanged(mMessageListView->childCount()); 358 emit numMessagesChanged(mMessageListView->childCount());
359 return true; 359 return true;
360 } 360 }
361 mScheduler->deleteTransaction(item->event()); 361 mScheduler->deleteTransaction(item->event());
362 delete item; 362 delete item;
363 emit numMessagesChanged(mMessageListView->childCount()); 363 emit numMessagesChanged(mMessageListView->childCount());
364 return false; 364 return false;
365} 365}
366 366
367bool IncomingDialog::incomeAdd(ScheduleItemIn *item) 367bool IncomingDialog::incomeAdd(ScheduleItemIn *item)
368{ 368{
369 IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); 369 IncidenceBase *incidence = ((ScheduleItemIn *)item)->event();
370 if (incidence->type() == "Event" ) { 370 if (incidence->type() == "Event" ) {
371 Event *refr = static_cast<Event *>( incidence ); 371 Event *refr = static_cast<Event *>( incidence );
372 mOutgoing->addMessage(refr,Scheduler::Refresh); 372 mOutgoing->addMessage(refr,Scheduler::Refresh);
373 mScheduler->deleteTransaction( incidence ); 373 mScheduler->deleteTransaction( incidence );
374 delete item; 374 delete item;
375 emit numMessagesChanged(mMessageListView->childCount()); 375 emit numMessagesChanged(mMessageListView->childCount());
376 return true; 376 return true;
377 } 377 }
378 else { 378 else {
379 kdDebug() << "IncomingDialog::incomeAdd - only Events are supportet yet" << endl; 379 kdDebug() << "IncomingDialog::incomeAdd - only Events are supportet yet" << endl;
380 mScheduler->deleteTransaction( incidence ); 380 mScheduler->deleteTransaction( incidence );
381 delete item; 381 delete item;
382 emit numMessagesChanged(mMessageListView->childCount()); 382 emit numMessagesChanged(mMessageListView->childCount());
383 return false; 383 return false;
384 } 384 }
385} 385}
386 386
387bool IncomingDialog::incomeDefault(ScheduleItemIn *item) 387bool IncomingDialog::incomeDefault(ScheduleItemIn *item)
388{ 388{
389 if (mScheduler->acceptTransaction(item->event(),item->method(),item->status())) { 389 if (mScheduler->acceptTransaction(item->event(),item->method(),item->status())) {
390 delete item; 390 delete item;
391 emit numMessagesChanged(mMessageListView->childCount()); 391 emit numMessagesChanged(mMessageListView->childCount());
392 return true; 392 return true;
393 } 393 }
394 else { 394 else {
395 KMessageBox::error(this,i18n("Unable to accept the IMIP-message. It may be a problem with the email addresses.")); 395 KMessageBox::error(this,i18n("Unable to accept the IMIP-message. It may be a problem with the email addresses."));
396 kdDebug() << "IncomingDialog::acceptMessage(): Error!" << endl; 396 kdDebug() << "IncomingDialog::acceptMessage(): Error!" << endl;
397 return false; 397 return false;
398 } 398 }
399 return false; 399 return false;
400} 400}
401 401
402bool IncomingDialog::incomeRequest(ScheduleItemIn *item) 402bool IncomingDialog::incomeRequest(ScheduleItemIn *item)
403{ 403{
404 if (item->event()->type()=="FreeBusy") { 404 if (item->event()->type()=="FreeBusy") {
405 //handel freebusy request 405 //handel freebusy request
406 IncidenceBase *inc = item->event(); 406 IncidenceBase *inc = item->event();
407 QDateTime start = inc->dtStart(); 407 QDateTime start = inc->dtStart();
408 QDateTime end = start.addDays(inc->duration()/86400); 408 QDateTime end = start.addDays(inc->duration()/86400);
409 409
410 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); 410 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end);
411 freebusy->setOrganizer(inc->organizer()); 411 freebusy->setOrganizer(inc->organizer());
412 Attendee *att = new Attendee(KOPrefs::instance()->fullName(), 412 Attendee *att = new Attendee(KOPrefs::instance()->fullName(),
413 KOPrefs::instance()->email()); 413 KOPrefs::instance()->email());
414 freebusy->addAttendee(att); 414 freebusy->addAttendee(att);
415 415
416 kdDebug() << "calendarview: schedule_publish_freebusy: startDate: " 416 kdDebug() << "calendarview: schedule_publish_freebusy: startDate: "
417 << KGlobal::locale()->formatDateTime( start ) << " End Date: " 417 << KGlobal::locale()->formatDateTime( start ) << " End Date: "
418 << KGlobal::locale()->formatDateTime( end ) << endl; 418 << KGlobal::locale()->formatDateTime( end ) << endl;
419 419
420 if (mOutgoing->addMessage(freebusy,Scheduler::Reply)) { 420 if (mOutgoing->addMessage(freebusy,Scheduler::Reply)) {
421 delete item; 421 delete item;
422 emit numMessagesChanged(mMessageListView->childCount()); 422 emit numMessagesChanged(mMessageListView->childCount());
423 delete(freebusy); 423 delete(freebusy);
424 return true; 424 return true;
425 } 425 }
426 return false; 426 return false;
427 } else { 427 } else {
428 return incomeDefault(item); 428 return incomeDefault(item);
429 } 429 }
430 return false; 430 return false;
431} 431}
432 432
433bool IncomingDialog::automaticAction(ScheduleItemIn *item) 433bool IncomingDialog::automaticAction(ScheduleItemIn *item)
434{ 434{
435 bool autoAction = false; 435 bool autoAction = false;
436 IncidenceBase *inc = item->event(); 436 IncidenceBase *inc = item->event();
437 Scheduler::Method method = item->method(); 437 Scheduler::Method method = item->method();
438 438
439 if( inc->type()=="FreeBusy" ) { 439 if( inc->type()=="FreeBusy" ) {
440 if ( method==Scheduler::Request ) { 440 if ( method==Scheduler::Request ) {
441 if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) { 441 if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) {
442 // reply freebusy information 442 // reply freebusy information
443 if ( checkOrganizerInAddressbook(inc->organizer()) ) { 443 if ( checkOrganizerInAddressbook(inc->organizer()) ) {
444 incomeRequest(item); 444 incomeRequest(item);
445 } 445 }
446 } else return false; 446 } else return false;
447 } else { 447 } else {
448 448
449 if ( method==Scheduler::Reply ) { 449 if ( method==Scheduler::Reply ) {
450 if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) { 450 if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) {
451 // insert freebusy information 451 // insert freebusy information
452 //if ( checkAttendeesInAddressbook(inc) ) 452 //if ( checkAttendeesInAddressbook(inc) )
453 453
454 } else return false; 454 } else return false;
455 } else { 455 } else {
456 if ( method==Scheduler::Publish) { 456 if ( method==Scheduler::Publish) {
457 if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) { 457 if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) {
458 // insert freebusy information 458 // insert freebusy information
459 //if ( checkOrganizerInAddressbook(inc->organizer()) ) 459 //if ( checkOrganizerInAddressbook(inc->organizer()) )
460 460
461 } 461 }
462 } else return false; 462 } else return false;
463 } 463 }
464 } 464 }
465 } 465 }
466 466
467 if ( inc->type()=="Event" ) { 467 if ( inc->type()=="Event" ) {
468 if ( method==Scheduler::Request || method==Scheduler::Publish ) { 468 if ( method==Scheduler::Request || method==Scheduler::Publish ) {
469 if ( KOPrefs::instance()->mIMIPAutoInsertRequest==KOPrefs::addressbookAuto ) { 469 if ( KOPrefs::instance()->mIMIPAutoInsertRequest==KOPrefs::addressbookAuto ) {
470 // insert event 470 // insert event
471 if ( checkOrganizerInAddressbook(inc->organizer()) ) 471 if ( checkOrganizerInAddressbook(inc->organizer()) )
472 autoAction = acceptMessage(item); 472 autoAction = acceptMessage(item);
473 } else return false; 473 } else return false;
474 } else { 474 } else {
475 475
476 if ( method==Scheduler::Reply ) { 476 if ( method==Scheduler::Reply ) {
477 if ( KOPrefs::instance()->mIMIPAutoInsertReply==KOPrefs::addressbookAuto ) { 477 if ( KOPrefs::instance()->mIMIPAutoInsertReply==KOPrefs::addressbookAuto ) {
478 // update event information 478 // update event information
479 if ( checkAttendeesInAddressbook(inc) ) 479 if ( checkAttendeesInAddressbook(inc) )
480 autoAction = acceptMessage(item); 480 autoAction = acceptMessage(item);
481 } else return false; 481 } else return false;
482 } else { 482 } else {
483 483
484 if ( method==Scheduler::Refresh ) { 484 if ( method==Scheduler::Refresh ) {
485 if ( KOPrefs::instance()->mIMIPAutoRefresh==KOPrefs::addressbookAuto ) { 485 if ( KOPrefs::instance()->mIMIPAutoRefresh==KOPrefs::addressbookAuto ) {
486 // send refresh-information 486 // send refresh-information
487 if ( checkAttendeesInAddressbook(inc) ) 487 if ( checkAttendeesInAddressbook(inc) )
488 autoAction = acceptMessage(item); 488 autoAction = acceptMessage(item);
489 else return false; 489 else return false;
490 } else return false; 490 } else return false;
491 } else return false; 491 } else return false;
492 } 492 }
493 } 493 }
494 } 494 }
495 return autoAction; 495 return autoAction;
496} 496}
497 497
498bool IncomingDialog::checkOrganizerInAddressbook(QString organizer) 498bool IncomingDialog::checkOrganizerInAddressbook(QString organizer)
499{ 499{
500 bool inBook = false; 500 bool inBook = false;
501#ifndef KORG_NOKABC 501#ifndef KORG_NOKABC
502 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 502 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
503 KABC::Addressee::List addressList; 503 KABC::Addressee::List addressList;
504 addressList = add_book->findByEmail(organizer); 504 addressList = add_book->findByEmail(organizer);
505 if ( addressList.size()>0 ) inBook = true; 505 if ( addressList.size()>0 ) inBook = true;
506#endif 506#endif
507 return inBook; 507 return inBook;
508} 508}
509 509
510bool IncomingDialog::checkAttendeesInAddressbook(IncidenceBase *inc) 510bool IncomingDialog::checkAttendeesInAddressbook(IncidenceBase *inc)
511{ 511{
512 bool inBook = false; 512 bool inBook = false;
513#ifndef KORG_NOKABC 513#ifndef KORG_NOKABC
514 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 514 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
515 KABC::Addressee::List addressList; 515 KABC::Addressee::List addressList;
516 QPtrList <Attendee> attendees; 516 QPtrList <Attendee> attendees;
517 Attendee *att; 517 Attendee *att;
518 attendees = inc->attendees(); 518 attendees = inc->attendees();
519 for (att=attendees.first();att;att=attendees.next()) { 519 for (att=attendees.first();att;att=attendees.next()) {
520 addressList = add_book->findByEmail(att->email()); 520 addressList = add_book->findByEmail(att->email());
521 if (addressList.size()>0 ) inBook = true; 521 if (addressList.size()>0 ) inBook = true;
522 } 522 }
523#endif 523#endif
524 return inBook; 524 return inBook;
525} 525}
526 526
527#include "incomingdialog.moc" 527//#include "incomingdialog.moc"
diff --git a/korganizer/incomingdialog_base.cpp b/korganizer/incomingdialog_base.cpp
index 91740a4..8589803 100644
--- a/korganizer/incomingdialog_base.cpp
+++ b/korganizer/incomingdialog_base.cpp
@@ -1,137 +1,137 @@
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 <qheader.h>
15#include <qlistview.h> 15#include <qlistview.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 <qwhatsthis.h>
20 20
21/* 21/*
22 * Constructs a IncomingDialog_base as a child of 'parent', with the 22 * Constructs a IncomingDialog_base as a child of 'parent', with the
23 * name 'name' and widget flags set to 'f'. 23 * name 'name' and widget flags set to 'f'.
24 * 24 *
25 * The dialog will by default be modeless, unless you set 'modal' to 25 * The dialog will by default be modeless, unless you set 'modal' to
26 * TRUE to construct a modal dialog. 26 * TRUE to construct a modal dialog.
27 */ 27 */
28IncomingDialog_base::IncomingDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl ) 28IncomingDialog_base::IncomingDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl )
29 : QDialog( parent, name, modal, fl ) 29 : QDialog( parent, name, modal, fl )
30 30
31{ 31{
32 if ( !name ) 32 if ( !name )
33 setName( "IncomingDialog_base" ); 33 setName( "IncomingDialog_base" );
34 IncomingDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "IncomingDialog_baseLayout"); 34 IncomingDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "IncomingDialog_baseLayout");
35 35
36 PushButton4 = new QPushButton( this, "PushButton4" ); 36 PushButton4 = new QPushButton( this, "PushButton4" );
37 37
38 IncomingDialog_baseLayout->addWidget( PushButton4, 0, 1 ); 38 IncomingDialog_baseLayout->addWidget( PushButton4, 0, 1 );
39 39
40 PushButton7 = new QPushButton( this, "PushButton7" ); 40 PushButton7 = new QPushButton( this, "PushButton7" );
41 PushButton7->setDefault( TRUE ); 41 PushButton7->setDefault( TRUE );
42 42
43 IncomingDialog_baseLayout->addWidget( PushButton7, 5, 1 ); 43 IncomingDialog_baseLayout->addWidget( PushButton7, 5, 1 );
44 44
45 mMessageListView = new QListView( this, "mMessageListView" ); 45 mMessageListView = new QListView( this, "mMessageListView" );
46 mMessageListView->addColumn( tr2i18n( "Summary" ) ); 46 mMessageListView->addColumn( tr2i18n( "Summary" ) );
47 mMessageListView->addColumn( tr2i18n( "Start Date" ) ); 47 mMessageListView->addColumn( tr2i18n( "Start Date" ) );
48 mMessageListView->addColumn( tr2i18n( "Start Time" ) ); 48 mMessageListView->addColumn( tr2i18n( "Start Time" ) );
49 mMessageListView->addColumn( tr2i18n( "End Date" ) ); 49 mMessageListView->addColumn( tr2i18n( "End Date" ) );
50 mMessageListView->addColumn( tr2i18n( "End Time" ) ); 50 mMessageListView->addColumn( tr2i18n( "End Time" ) );
51 mMessageListView->addColumn( tr2i18n( "Organizer" ) ); 51 mMessageListView->addColumn( tr2i18n( "Organizer" ) );
52 mMessageListView->addColumn( tr2i18n( "Method" ) ); 52 mMessageListView->addColumn( tr2i18n( "Method" ) );
53 mMessageListView->addColumn( tr2i18n( "Status" ) ); 53 mMessageListView->addColumn( tr2i18n( "Status" ) );
54 mMessageListView->setAllColumnsShowFocus( FALSE ); 54 mMessageListView->setAllColumnsShowFocus( FALSE );
55 55
56 IncomingDialog_baseLayout->addMultiCellWidget( mMessageListView, 0, 5, 0, 0 ); 56 IncomingDialog_baseLayout->addMultiCellWidget( mMessageListView, 0, 5, 0, 0 );
57 57
58 PushButton7_2 = new QPushButton( this, "PushButton7_2" ); 58 PushButton7_2 = new QPushButton( this, "PushButton7_2" );
59 59
60 IncomingDialog_baseLayout->addWidget( PushButton7_2, 3, 1 ); 60 IncomingDialog_baseLayout->addWidget( PushButton7_2, 3, 1 );
61 61
62 PushButton8 = new QPushButton( this, "PushButton8" ); 62 PushButton8 = new QPushButton( this, "PushButton8" );
63 63
64 IncomingDialog_baseLayout->addWidget( PushButton8, 1, 1 ); 64 IncomingDialog_baseLayout->addWidget( PushButton8, 1, 1 );
65 65
66 PushButton9 = new QPushButton( this, "PushButton9" ); 66 PushButton9 = new QPushButton( this, "PushButton9" );
67 67
68 IncomingDialog_baseLayout->addWidget( PushButton9, 2, 1 ); 68 IncomingDialog_baseLayout->addWidget( PushButton9, 2, 1 );
69 QSpacerItem* spacer = new QSpacerItem( 20, 70, QSizePolicy::Minimum, QSizePolicy::Expanding ); 69 QSpacerItem* spacer = new QSpacerItem( 20, 70, QSizePolicy::Minimum, QSizePolicy::Expanding );
70 IncomingDialog_baseLayout->addItem( spacer, 4, 1 ); 70 IncomingDialog_baseLayout->addItem( spacer, 4, 1 );
71 languageChange(); 71 languageChange();
72 resize( QSize(525, 262).expandedTo(minimumSizeHint()) ); 72 resize( QSize(525, 262).expandedTo(minimumSizeHint()) );
73 73
74 // signals and slots connections 74 // signals and slots connections
75 connect( PushButton7, SIGNAL( clicked() ), this, SLOT( accept() ) ); 75 connect( PushButton7, SIGNAL( clicked() ), this, SLOT( accept() ) );
76 connect( PushButton4, SIGNAL( clicked() ), this, SLOT( retrieve() ) ); 76 connect( PushButton4, SIGNAL( clicked() ), this, SLOT( retrieve() ) );
77 connect( PushButton7_2, SIGNAL( clicked() ), this, SLOT( acceptAllMessages() ) ); 77 connect( PushButton7_2, SIGNAL( clicked() ), this, SLOT( acceptAllMessages() ) );
78 78
79 // tab order 79 // tab order
80 setTabOrder( PushButton7, PushButton4 ); 80 setTabOrder( PushButton7, PushButton4 );
81 setTabOrder( PushButton4, PushButton7_2 ); 81 setTabOrder( PushButton4, PushButton7_2 );
82 setTabOrder( PushButton7_2, mMessageListView ); 82 setTabOrder( PushButton7_2, mMessageListView );
83 setTabOrder( mMessageListView, PushButton8 ); 83 setTabOrder( mMessageListView, PushButton8 );
84 setTabOrder( PushButton8, PushButton9 ); 84 setTabOrder( PushButton8, PushButton9 );
85} 85}
86 86
87/* 87/*
88 * Destroys the object and frees any allocated resources 88 * Destroys the object and frees any allocated resources
89 */ 89 */
90IncomingDialog_base::~IncomingDialog_base() 90IncomingDialog_base::~IncomingDialog_base()
91{ 91{
92 // no need to delete child widgets, Qt does it all for us 92 // no need to delete child widgets, Qt does it all for us
93} 93}
94 94
95/* 95/*
96 * Sets the strings of the subwidgets using the current 96 * Sets the strings of the subwidgets using the current
97 * language. 97 * language.
98 */ 98 */
99void IncomingDialog_base::languageChange() 99void IncomingDialog_base::languageChange()
100{ 100{
101 setCaption( tr2i18n( "Scheduler - Incoming Messages" ) ); 101 setCaption( tr2i18n( "Scheduler - Incoming Messages" ) );
102 PushButton4->setText( tr2i18n( "Retrieve &Messages" ) ); 102 PushButton4->setText( tr2i18n( "Retrieve &Messages" ) );
103 PushButton7->setText( tr2i18n( "&Close" ) ); 103 PushButton7->setText( tr2i18n( "&Close" ) );
104 mMessageListView->header()->setLabel( 0, tr2i18n( "Summary" ) ); 104 mMessageListView->header()->setLabel( 0, tr2i18n( "Summary" ) );
105 mMessageListView->header()->setLabel( 1, tr2i18n( "Start Date" ) ); 105 mMessageListView->header()->setLabel( 1, tr2i18n( "Start Date" ) );
106 mMessageListView->header()->setLabel( 2, tr2i18n( "Start Time" ) ); 106 mMessageListView->header()->setLabel( 2, tr2i18n( "Start Time" ) );
107 mMessageListView->header()->setLabel( 3, tr2i18n( "End Date" ) ); 107 mMessageListView->header()->setLabel( 3, tr2i18n( "End Date" ) );
108 mMessageListView->header()->setLabel( 4, tr2i18n( "End Time" ) ); 108 mMessageListView->header()->setLabel( 4, tr2i18n( "End Time" ) );
109 mMessageListView->header()->setLabel( 5, tr2i18n( "Organizer" ) ); 109 mMessageListView->header()->setLabel( 5, tr2i18n( "Organizer" ) );
110 mMessageListView->header()->setLabel( 6, tr2i18n( "Method" ) ); 110 mMessageListView->header()->setLabel( 6, tr2i18n( "Method" ) );
111 mMessageListView->header()->setLabel( 7, tr2i18n( "Status" ) ); 111 mMessageListView->header()->setLabel( 7, tr2i18n( "Status" ) );
112 PushButton7_2->setText( tr2i18n( "Accept A&ll" ) ); 112 PushButton7_2->setText( tr2i18n( "Accept A&ll" ) );
113 PushButton8->setText( tr2i18n( "&Accept" ) ); 113 PushButton8->setText( tr2i18n( "&Accept" ) );
114 PushButton9->setText( tr2i18n( "&Reject" ) ); 114 PushButton9->setText( tr2i18n( "&Reject" ) );
115} 115}
116 116
117void IncomingDialog_base::acceptAllMessages() 117void IncomingDialog_base::acceptAllMessages()
118{ 118{
119 qWarning( "IncomingDialog_base::acceptAllMessages(): Not implemented yet" ); 119 qWarning( "IncomingDialog_base::acceptAllMessages(): Not implemented yet" );
120} 120}
121 121
122void IncomingDialog_base::acceptMessage() 122void IncomingDialog_base::acceptMessage()
123{ 123{
124 qWarning( "IncomingDialog_base::acceptMessage(): Not implemented yet" ); 124 qWarning( "IncomingDialog_base::acceptMessage(): Not implemented yet" );
125} 125}
126 126
127void IncomingDialog_base::rejectMessage() 127void IncomingDialog_base::rejectMessage()
128{ 128{
129 qWarning( "IncomingDialog_base::rejectMessage(): Not implemented yet" ); 129 qWarning( "IncomingDialog_base::rejectMessage(): Not implemented yet" );
130} 130}
131 131
132void IncomingDialog_base::retrieve() 132void IncomingDialog_base::retrieve()
133{ 133{
134 qWarning( "IncomingDialog_base::retrieve(): Not implemented yet" ); 134 qWarning( "IncomingDialog_base::retrieve(): Not implemented yet" );
135} 135}
136 136
137#include "incomingdialog_base.moc" 137//#include "incomingdialog_base.moc"
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index d1d7946..7af5cf4 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -1,170 +1,170 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
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 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 29
30#include <kdebug.h> 30#include <kdebug.h>
31#include <kglobal.h> 31#include <kglobal.h>
32#include <klocale.h> 32#include <klocale.h>
33#include <ktextedit.h> 33#include <ktextedit.h>
34#include "koprefs.h" 34#include "koprefs.h"
35 35
36#include <libkcal/journal.h> 36#include <libkcal/journal.h>
37#include <libkcal/calendarresources.h> 37#include <libkcal/calendarresources.h>
38#include <libkcal/resourcecalendar.h> 38#include <libkcal/resourcecalendar.h>
39#include <kresources/resourceselectdialog.h> 39#include <kresources/resourceselectdialog.h>
40 40
41#include "journalentry.h" 41#include "journalentry.h"
42#include "journalentry.moc" 42//#include "journalentry.moc"
43#ifndef DESKTOP_VERSION 43#ifndef DESKTOP_VERSION
44#include <qpe/qpeapplication.h> 44#include <qpe/qpeapplication.h>
45#endif 45#endif
46JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : 46JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
47 QFrame(parent) 47 QFrame(parent)
48{ 48{
49 mCalendar = calendar; 49 mCalendar = calendar;
50 mJournal = 0; 50 mJournal = 0;
51 mDirty = false; 51 mDirty = false;
52 52
53 mTitleLabel = new QLabel(i18n("Title"),this); 53 mTitleLabel = new QLabel(i18n("Title"),this);
54 mTitleLabel->setMargin(2); 54 mTitleLabel->setMargin(2);
55 mTitleLabel->setAlignment(AlignCenter); 55 mTitleLabel->setAlignment(AlignCenter);
56 56
57 mEditor = new KTextEdit(this); 57 mEditor = new KTextEdit(this);
58 connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty())); 58 connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty()));
59#ifndef DESKTOP_VERSION 59#ifndef DESKTOP_VERSION
60 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); 60 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
61#endif 61#endif
62 mEditor->setWordWrap( KTextEdit::WidgetWidth ); 62 mEditor->setWordWrap( KTextEdit::WidgetWidth );
63 QBoxLayout *topLayout = new QVBoxLayout(this); 63 QBoxLayout *topLayout = new QVBoxLayout(this);
64 topLayout->addWidget(mTitleLabel); 64 topLayout->addWidget(mTitleLabel);
65 topLayout->addWidget(mEditor); 65 topLayout->addWidget(mEditor);
66 mEditor->installEventFilter(this); 66 mEditor->installEventFilter(this);
67} 67}
68 68
69JournalEntry::~JournalEntry() 69JournalEntry::~JournalEntry()
70{ 70{
71} 71}
72 72
73void JournalEntry::setDate(const QDate &date) 73void JournalEntry::setDate(const QDate &date)
74{ 74{
75 writeJournal(); 75 writeJournal();
76 76
77 mTitleLabel->setText(KGlobal::locale()->formatDate(date)); 77 mTitleLabel->setText(KGlobal::locale()->formatDate(date));
78 78
79 79
80 mDate = date; 80 mDate = date;
81} 81}
82 82
83void JournalEntry::setJournal(Journal *journal) 83void JournalEntry::setJournal(Journal *journal)
84{ 84{
85 writeJournal(); 85 writeJournal();
86 86
87 mJournal = journal; 87 mJournal = journal;
88 88
89 mEditor->setText(mJournal->description()); 89 mEditor->setText(mJournal->description());
90 90
91 mDirty = false; 91 mDirty = false;
92} 92}
93 93
94Journal *JournalEntry::journal() const 94Journal *JournalEntry::journal() const
95{ 95{
96 return mJournal; 96 return mJournal;
97} 97}
98 98
99void JournalEntry::setDirty() 99void JournalEntry::setDirty()
100{ 100{
101 mDirty = true; 101 mDirty = true;
102 102
103// kdDebug() << "JournalEntry::setDirty()" << endl; 103// kdDebug() << "JournalEntry::setDirty()" << endl;
104} 104}
105 105
106void JournalEntry::clear() 106void JournalEntry::clear()
107{ 107{
108 mJournal = 0; 108 mJournal = 0;
109 mEditor->setText(""); 109 mEditor->setText("");
110} 110}
111 111
112bool JournalEntry::eventFilter( QObject *o, QEvent *e ) 112bool JournalEntry::eventFilter( QObject *o, QEvent *e )
113{ 113{
114// kdDebug() << "JournalEntry::event received " << e->type() << endl; 114// kdDebug() << "JournalEntry::event received " << e->type() << endl;
115 115
116 if ( e->type() == QEvent::FocusOut ) { 116 if ( e->type() == QEvent::FocusOut ) {
117 writeJournal(); 117 writeJournal();
118 } 118 }
119 if ( e->type() == QEvent::KeyPress ) { 119 if ( e->type() == QEvent::KeyPress ) {
120 QKeyEvent * k = (QKeyEvent *) e; 120 QKeyEvent * k = (QKeyEvent *) e;
121 if ( k->state() == Qt::ControlButton ) { 121 if ( k->state() == Qt::ControlButton ) {
122 k->ignore(); 122 k->ignore();
123 //return true; 123 //return true;
124 } 124 }
125 } 125 }
126 126
127 return QFrame::eventFilter( o, e ); // standard event processing 127 return QFrame::eventFilter( o, e ); // standard event processing
128} 128}
129 129
130void JournalEntry::writeJournal() 130void JournalEntry::writeJournal()
131{ 131{
132// kdDebug() << "JournalEntry::writeJournal()" << endl; 132// kdDebug() << "JournalEntry::writeJournal()" << endl;
133 if (!mDirty) return; 133 if (!mDirty) return;
134 134
135 if (mEditor->text().isEmpty()) { 135 if (mEditor->text().isEmpty()) {
136 if ( mJournal ) { 136 if ( mJournal ) {
137 mDirty = false; 137 mDirty = false;
138 bool conf = KOPrefs::instance()->mConfirm; 138 bool conf = KOPrefs::instance()->mConfirm;
139 KOPrefs::instance()->mConfirm = false; 139 KOPrefs::instance()->mConfirm = false;
140 emit deleteJournal(mJournal); 140 emit deleteJournal(mJournal);
141 KOPrefs::instance()->mConfirm = conf; 141 KOPrefs::instance()->mConfirm = conf;
142 mJournal = 0; 142 mJournal = 0;
143 } 143 }
144 return; 144 return;
145 } 145 }
146 146
147// kdDebug() << "JournalEntry::writeJournal()..." << endl; 147// kdDebug() << "JournalEntry::writeJournal()..." << endl;
148 148
149 if (!mJournal) { 149 if (!mJournal) {
150 mJournal = new Journal; 150 mJournal = new Journal;
151 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); 151 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
152 mCalendar->addJournal(mJournal); 152 mCalendar->addJournal(mJournal);
153 } 153 }
154 154
155 mJournal->setDescription(mEditor->text()); 155 mJournal->setDescription(mEditor->text());
156 156
157 mDirty = false; 157 mDirty = false;
158} 158}
159 159
160void JournalEntry::flushEntry() 160void JournalEntry::flushEntry()
161{ 161{
162 if (!mDirty) return; 162 if (!mDirty) return;
163 163
164 writeJournal(); 164 writeJournal();
165} 165}
166void JournalEntry::keyPressEvent ( QKeyEvent * e ) 166void JournalEntry::keyPressEvent ( QKeyEvent * e )
167{ 167{
168 e->ignore(); 168 e->ignore();
169 169
170} 170}
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index 12e983b..7d0c516 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -172,193 +172,193 @@ void KDateNavigator::passedMidnight()
172 daymatrix->repaint(); 172 daymatrix->repaint();
173 emit dayPassed(today); 173 emit dayPassed(today);
174 if (emitMonth) { emit monthPassed(today); } 174 if (emitMonth) { emit monthPassed(today); }
175} 175}
176 176
177/* slot */ void KDateNavigator::possiblyPastMidnight() 177/* slot */ void KDateNavigator::possiblyPastMidnight()
178{ 178{
179 if (lastDayChecked!=QDate::currentDate()) 179 if (lastDayChecked!=QDate::currentDate())
180 { 180 {
181 passedMidnight(); 181 passedMidnight();
182 lastDayChecked=QDate::currentDate(); 182 lastDayChecked=QDate::currentDate();
183 } 183 }
184 // Set the timer to go off 1 second after midnight 184 // Set the timer to go off 1 second after midnight
185 // or after 8 minutes, whichever comes first. 185 // or after 8 minutes, whichever comes first.
186 if (updateTimer) 186 if (updateTimer)
187 { 187 {
188 QTime now = QTime::currentTime(); 188 QTime now = QTime::currentTime();
189 QTime midnight = QTime(23,59,59); 189 QTime midnight = QTime(23,59,59);
190 int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000); 190 int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000);
191 191
192 // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait)) 192 // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait))
193 //.arg(now.toString()).arg(midnight.toString())); 193 //.arg(now.toString()).arg(midnight.toString()));
194 194
195 updateTimer->stop(); 195 updateTimer->stop();
196 updateTimer->start(msecsWait,true); 196 updateTimer->start(msecsWait,true);
197 } 197 }
198} 198}
199 199
200void KDateNavigator::updateDates() 200void KDateNavigator::updateDates()
201{ 201{
202 // Find the first day of the week of the current month. 202 // Find the first day of the week of the current month.
203 //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr ); 203 //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr );
204 QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() ); 204 QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() );
205 int d2 = KOGlobals::self()->calendarSystem()->day( dayone ); 205 int d2 = KOGlobals::self()->calendarSystem()->day( dayone );
206 //int di = d1 - d2 + 1; 206 //int di = d1 - d2 + 1;
207 dayone = dayone.addDays( -d2 + 1 ); 207 dayone = dayone.addDays( -d2 + 1 );
208 208
209 int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone ); 209 int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone );
210 210
211 // If month begins on Monday and Monday is first day of week, 211 // If month begins on Monday and Monday is first day of week,
212 // month should begin on second line. Sunday doesn't have this problem. 212 // month should begin on second line. Sunday doesn't have this problem.
213 int nextLine = ( ( m_fstDayOfWkCalsys == 1) && 213 int nextLine = ( ( m_fstDayOfWkCalsys == 1) &&
214 ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0; 214 ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0;
215 215
216 // update the matrix dates 216 // update the matrix dates
217 int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine; 217 int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine;
218 218
219 219
220 daymatrix->updateView(dayone.addDays(index)); 220 daymatrix->updateView(dayone.addDays(index));
221//each updateDates is followed by an updateView -> repaint is issued there ! 221//each updateDates is followed by an updateView -> repaint is issued there !
222// daymatrix->repaint(); 222// daymatrix->repaint();
223} 223}
224 224
225void KDateNavigator::updateDayMatrix() 225void KDateNavigator::updateDayMatrix()
226{ 226{
227 daymatrix->updateView(); 227 daymatrix->updateView();
228 daymatrix->repaint(); 228 daymatrix->repaint();
229} 229}
230 230
231 231
232void KDateNavigator::updateView() 232void KDateNavigator::updateView()
233{ 233{
234 234
235 setUpdatesEnabled( false ); 235 setUpdatesEnabled( false );
236 236
237 int i; 237 int i;
238 238
239// kdDebug() << "updateView() -> daymatrix->updateView()" << endl; 239// kdDebug() << "updateView() -> daymatrix->updateView()" << endl;
240 daymatrix->updateView(); 240 daymatrix->updateView();
241 241
242 // set the week numbers. 242 // set the week numbers.
243 for(i = 0; i < 6; i++) { 243 for(i = 0; i < 6; i++) {
244 QString weeknum; 244 QString weeknum;
245 // remember, according to ISO 8601, the first week of the year is the 245 // remember, according to ISO 8601, the first week of the year is the
246 // first week that contains a thursday. Thus we must subtract off 4, 246 // first week that contains a thursday. Thus we must subtract off 4,
247 // not just 1. 247 // not just 1.
248 248
249 //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); 249 //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear();
250 int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4))); 250 int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4)));
251 251
252 if (dayOfYear % 7 != 0) 252 if (dayOfYear % 7 != 0)
253 weeknum.setNum(dayOfYear / 7 + 1); 253 weeknum.setNum(dayOfYear / 7 + 1);
254 else 254 else
255 weeknum.setNum(dayOfYear / 7); 255 weeknum.setNum(dayOfYear / 7);
256 weeknos[i]->setText(weeknum); 256 weeknos[i]->setText(weeknum);
257 } 257 }
258 258
259 setUpdatesEnabled( true ); 259 setUpdatesEnabled( true );
260// kdDebug() << "updateView() -> repaint()" << endl; 260// kdDebug() << "updateView() -> repaint()" << endl;
261 repaint(); 261 repaint();
262 daymatrix->repaint(); 262 daymatrix->repaint();
263} 263}
264 264
265void KDateNavigator::updateConfig() 265void KDateNavigator::updateConfig()
266{ 266{
267 int day; 267 int day;
268 for(int i=0; i<7; i++) { 268 for(int i=0; i<7; i++) {
269 // take the first letter of the day name to be the abbreviation 269 // take the first letter of the day name to be the abbreviation
270 if (KGlobal::locale()->weekStartsMonday()) { 270 if (KGlobal::locale()->weekStartsMonday()) {
271 day = i+1; 271 day = i+1;
272 } else { 272 } else {
273 if (i==0) day = 7; 273 if (i==0) day = 7;
274 else day = i; 274 else day = i;
275 } 275 }
276 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, 276 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day,
277 true ); 277 true );
278 if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); 278 if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 );
279 headings[i]->setText( dayName ); 279 headings[i]->setText( dayName );
280 } 280 }
281 updateDates(); 281 updateDates();
282 updateView(); 282 updateView();
283} 283}
284 284
285void KDateNavigator::setShowWeekNums(bool enabled) 285void KDateNavigator::setShowWeekNums(bool enabled)
286{ 286{
287 m_bShowWeekNums = enabled; 287 m_bShowWeekNums = enabled;
288 for(int i=0; i<6; i++) { 288 for(int i=0; i<6; i++) {
289 if(enabled) 289 if(enabled)
290 weeknos[i]->show(); 290 weeknos[i]->show();
291 else 291 else
292 weeknos[i]->hide(); 292 weeknos[i]->hide();
293 } 293 }
294 resize(size()); 294 resize(size());
295} 295}
296 296
297void KDateNavigator::selectDates(const DateList& dateList) 297void KDateNavigator::selectDates(const DateList& dateList)
298{ 298{
299 299
300 if (dateList.count() > 0) { 300 if (dateList.count() > 0) {
301 mNavigatorBar->selectDates( dateList ); 301 mNavigatorBar->selectDates( dateList );
302 mSelectedDates = dateList; 302 mSelectedDates = dateList;
303 303
304 // set our record of the month and year that this datetbl is 304 // set our record of the month and year that this datetbl is
305 // displaying. 305 // displaying.
306 m_MthYr = mSelectedDates.first(); 306 m_MthYr = mSelectedDates.first();
307 307
308 308
309 // set our record of the first day of the week of the current 309 // set our record of the first day of the week of the current
310 // month. This needs to be done before calling dayToIndex, since it 310 // month. This needs to be done before calling dayToIndex, since it
311 // relies on this information being up to date. 311 // relies on this information being up to date.
312 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); 312 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
313 m_fstDayOfWk = dayone.dayOfWeek(); 313 m_fstDayOfWk = dayone.dayOfWeek();
314 314
315 updateDates(); 315 updateDates();
316 316
317 daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); 317 daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
318 318
319 updateView(); 319 updateView();
320 } 320 }
321} 321}
322 322
323int KDateNavigator::dayNum(int row, int col) 323int KDateNavigator::dayNum(int row, int col)
324{ 324{
325 return 7 * (row - 1) + (col + 1) - m_fstDayOfWk; 325 return 7 * (row - 1) + (col + 1) - m_fstDayOfWk;
326} 326}
327 327
328int KDateNavigator::dayToIndex(int dayNum) 328int KDateNavigator::dayToIndex(int dayNum)
329{ 329{
330 int row, col; 330 int row, col;
331 331
332 row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7; 332 row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7;
333 if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1)) 333 if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1))
334 row++; 334 row++;
335 col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7; 335 col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7;
336 return row * 7 + col; 336 return row * 7 + col;
337} 337}
338 338
339void KDateNavigator::wheelEvent (QWheelEvent *e) 339void KDateNavigator::wheelEvent (QWheelEvent *e)
340{ 340{
341 if(e->delta()>0) emit goPrevious(); 341 if(e->delta()>0) emit goPrevious();
342 else emit goNext(); 342 else emit goNext();
343 343
344 e->accept(); 344 e->accept();
345} 345}
346 346
347bool KDateNavigator::eventFilter (QObject *o,QEvent *e) 347bool KDateNavigator::eventFilter (QObject *o,QEvent *e)
348{ 348{
349 if (e->type() == QEvent::MouseButtonPress) { 349 if (e->type() == QEvent::MouseButtonPress) {
350 int i; 350 int i;
351 for(i=0;i<6;++i) { 351 for(i=0;i<6;++i) {
352 if (o == weeknos[i]) { 352 if (o == weeknos[i]) {
353 QDate weekstart = daymatrix->getDate(i*7); 353 QDate weekstart = daymatrix->getDate(i*7);
354 emit weekClicked(weekstart); 354 emit weekClicked(weekstart);
355 break; 355 break;
356 } 356 }
357 } 357 }
358 return true; 358 return true;
359 } else { 359 } else {
360 return false; 360 return false;
361 } 361 }
362} 362}
363 363
364#include "kdatenavigator.moc" 364//#include "kdatenavigator.moc"
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 607c250..6532705 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1,241 +1,240 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 Marcus Bains line. 5 Marcus Bains line.
6 Copyright (c) 2001 Ali Rahimi 6 Copyright (c) 2001 Ali Rahimi
7 7
8 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
9 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
10 the Free Software Foundation; either version 2 of the License, or 10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version. 11 (at your option) any later version.
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#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 <qintdict.h>
33#include <qdatetime.h> 33#include <qdatetime.h>
34#include <qapplication.h> 34#include <qapplication.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36#include <qcursor.h> 36#include <qcursor.h>
37#include <qpainter.h> 37#include <qpainter.h>
38 38
39#include <kdebug.h> 39#include <kdebug.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kiconloader.h> 41#include <kiconloader.h>
42#include <kglobal.h> 42#include <kglobal.h>
43 43
44#include "koagendaitem.h" 44#include "koagendaitem.h"
45#include "koprefs.h" 45#include "koprefs.h"
46#include "koglobals.h" 46#include "koglobals.h"
47 47
48#include "koagenda.h" 48#include "koagenda.h"
49#include "koagenda.moc"
50 49
51#include <libkcal/event.h> 50#include <libkcal/event.h>
52#include <libkcal/todo.h> 51#include <libkcal/todo.h>
53 52
54#ifndef DESKTOP_VERSION 53#ifndef DESKTOP_VERSION
55#include <qpe/qpeapplication.h> 54#include <qpe/qpeapplication.h>
56#endif 55#endif
57 56
58//extern bool globalFlagBlockPainting; 57//extern bool globalFlagBlockPainting;
59extern int globalFlagBlockAgenda; 58extern int globalFlagBlockAgenda;
60extern int globalFlagBlockAgendaItemPaint; 59extern int globalFlagBlockAgendaItemPaint;
61extern int globalFlagBlockAgendaItemUpdate; 60extern int globalFlagBlockAgendaItemUpdate;
62extern int globalFlagBlockStartup; 61extern int globalFlagBlockStartup;
63 62
64//////////////////////////////////////////////////////////////////////////// 63////////////////////////////////////////////////////////////////////////////
65MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) 64MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name)
66 : QFrame(_agenda->viewport(),name), agenda(_agenda) 65 : QFrame(_agenda->viewport(),name), agenda(_agenda)
67{ 66{
68 setLineWidth(0); 67 setLineWidth(0);
69 setMargin(0); 68 setMargin(0);
70 setBackgroundColor(Qt::red); 69 setBackgroundColor(Qt::red);
71 minutes = new QTimer(this); 70 minutes = new QTimer(this);
72 connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); 71 connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc()));
73 minutes->start(0, true); 72 minutes->start(0, true);
74 73
75 mTimeBox = new QLabel(this); 74 mTimeBox = new QLabel(this);
76 mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); 75 mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom);
77 QPalette pal = mTimeBox->palette(); 76 QPalette pal = mTimeBox->palette();
78 pal.setColor(QColorGroup::Foreground, Qt::red); 77 pal.setColor(QColorGroup::Foreground, Qt::red);
79 mTimeBox->setPalette(pal); 78 mTimeBox->setPalette(pal);
80 //mTimeBox->setAutoMask(true); 79 //mTimeBox->setAutoMask(true);
81 80
82 agenda->addChild(mTimeBox); 81 agenda->addChild(mTimeBox);
83 82
84 oldToday = -1; 83 oldToday = -1;
85} 84}
86 85
87MarcusBains::~MarcusBains() 86MarcusBains::~MarcusBains()
88{ 87{
89 delete minutes; 88 delete minutes;
90} 89}
91 90
92int MarcusBains::todayColumn() 91int MarcusBains::todayColumn()
93{ 92{
94 QDate currentDate = QDate::currentDate(); 93 QDate currentDate = QDate::currentDate();
95 94
96 DateList dateList = agenda->dateList(); 95 DateList dateList = agenda->dateList();
97 DateList::ConstIterator it; 96 DateList::ConstIterator it;
98 int col = 0; 97 int col = 0;
99 for(it = dateList.begin(); it != dateList.end(); ++it) { 98 for(it = dateList.begin(); it != dateList.end(); ++it) {
100 if((*it) == currentDate) 99 if((*it) == currentDate)
101 return KOGlobals::self()->reverseLayout() ? 100 return KOGlobals::self()->reverseLayout() ?
102 agenda->columns() - 1 - col : col; 101 agenda->columns() - 1 - col : col;
103 ++col; 102 ++col;
104 } 103 }
105 104
106 return -1; 105 return -1;
107} 106}
108void MarcusBains::updateLoc() 107void MarcusBains::updateLoc()
109{ 108{
110 updateLocation(); 109 updateLocation();
111} 110}
112void MarcusBains::updateLocation(bool recalculate) 111void MarcusBains::updateLocation(bool recalculate)
113{ 112{
114 113
115 QTime tim = QTime::currentTime(); 114 QTime tim = QTime::currentTime();
116 //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); 115 //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1());
117 if((tim.hour() == 0) && (oldTime.hour()==23)) 116 if((tim.hour() == 0) && (oldTime.hour()==23))
118 recalculate = true; 117 recalculate = true;
119 118
120 int mins = tim.hour()*60 + tim.minute(); 119 int mins = tim.hour()*60 + tim.minute();
121 int minutesPerCell = 24 * 60 / agenda->rows(); 120 int minutesPerCell = 24 * 60 / agenda->rows();
122 int y = mins*agenda->gridSpacingY()/minutesPerCell; 121 int y = mins*agenda->gridSpacingY()/minutesPerCell;
123 int today = recalculate ? todayColumn() : oldToday; 122 int today = recalculate ? todayColumn() : oldToday;
124 int x = agenda->gridSpacingX()*today; 123 int x = agenda->gridSpacingX()*today;
125 bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); 124 bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled);
126 125
127 oldTime = tim; 126 oldTime = tim;
128 oldToday = today; 127 oldToday = today;
129 128
130 if(disabled || (today<0)) { 129 if(disabled || (today<0)) {
131 hide(); mTimeBox->hide(); 130 hide(); mTimeBox->hide();
132 return; 131 return;
133 } else { 132 } else {
134 show(); mTimeBox->show(); 133 show(); mTimeBox->show();
135 } 134 }
136 135
137 if(recalculate) 136 if(recalculate)
138 setFixedSize(agenda->gridSpacingX(),1); 137 setFixedSize(agenda->gridSpacingX(),1);
139 agenda->moveChild(this, x, y); 138 agenda->moveChild(this, x, y);
140 raise(); 139 raise();
141 140
142 if(recalculate) 141 if(recalculate)
143 //mTimeBox->setFont(QFont("helvetica",10)); 142 //mTimeBox->setFont(QFont("helvetica",10));
144 mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); 143 mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont);
145 144
146 mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); 145 mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds));
147 mTimeBox->adjustSize(); 146 mTimeBox->adjustSize();
148 // the -2 below is there because there is a bug in this program 147 // the -2 below is there because there is a bug in this program
149 // somewhere, where the last column of this widget is a few pixels 148 // somewhere, where the last column of this widget is a few pixels
150 // narrower than the other columns. 149 // narrower than the other columns.
151 int offs = (today==agenda->columns()-1) ? -4 : 0; 150 int offs = (today==agenda->columns()-1) ? -4 : 0;
152 agenda->moveChild(mTimeBox, 151 agenda->moveChild(mTimeBox,
153 x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, 152 x+agenda->gridSpacingX()-mTimeBox->width()+offs-1,
154 y-mTimeBox->height()); 153 y-mTimeBox->height());
155 154
156 mTimeBox->raise(); 155 mTimeBox->raise();
157 //mTimeBox->setAutoMask(true); 156 //mTimeBox->setAutoMask(true);
158 minutes->start(5000,true); 157 minutes->start(5000,true);
159} 158}
160 159
161 160
162//////////////////////////////////////////////////////////////////////////// 161////////////////////////////////////////////////////////////////////////////
163 162
164 163
165/* 164/*
166 Create an agenda widget with rows rows and columns columns. 165 Create an agenda widget with rows rows and columns columns.
167*/ 166*/
168KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, 167KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
169 const char *name,WFlags f) : 168 const char *name,WFlags f) :
170 QScrollView(parent,name,f) 169 QScrollView(parent,name,f)
171{ 170{
172 171
173 mColumns = columns; 172 mColumns = columns;
174 mRows = rows; 173 mRows = rows;
175 mGridSpacingY = rowSize; 174 mGridSpacingY = rowSize;
176 mAllDayMode = false; 175 mAllDayMode = false;
177#ifndef DESKTOP_VERSION 176#ifndef DESKTOP_VERSION
178 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 177 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
179#endif 178#endif
180 mHolidayMask = 0; 179 mHolidayMask = 0;
181 init(); 180 init();
182} 181}
183 182
184/* 183/*
185 Create an agenda widget with columns columns and one row. This is used for 184 Create an agenda widget with columns columns and one row. This is used for
186 all-day events. 185 all-day events.
187*/ 186*/
188KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : 187KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) :
189 QScrollView(parent,name,f) 188 QScrollView(parent,name,f)
190{ 189{
191 190
192 blockResize = false; 191 blockResize = false;
193 mColumns = columns; 192 mColumns = columns;
194 mRows = 1; 193 mRows = 1;
195 //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); 194 //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize);
196 mGridSpacingY = KOPrefs::instance()->mAllDaySize; 195 mGridSpacingY = KOPrefs::instance()->mAllDaySize;
197 mAllDayMode = true; 196 mAllDayMode = true;
198#ifndef DESKTOP_VERSION 197#ifndef DESKTOP_VERSION
199 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 198 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
200#endif 199#endif
201 mHolidayMask = 0; 200 mHolidayMask = 0;
202 init(); 201 init();
203} 202}
204 203
205 204
206KOAgenda::~KOAgenda() 205KOAgenda::~KOAgenda()
207{ 206{
208 if(mMarcusBains) delete mMarcusBains; 207 if(mMarcusBains) delete mMarcusBains;
209 208
210} 209}
211 210
212Incidence *KOAgenda::selectedIncidence() const 211Incidence *KOAgenda::selectedIncidence() const
213{ 212{
214 return (mSelectedItem ? mSelectedItem->incidence() : 0); 213 return (mSelectedItem ? mSelectedItem->incidence() : 0);
215} 214}
216 215
217 216
218QDate KOAgenda::selectedIncidenceDate() const 217QDate KOAgenda::selectedIncidenceDate() const
219{ 218{
220 return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); 219 return (mSelectedItem ? mSelectedItem->itemDate() : QDate());
221} 220}
222 221
223 222
224void KOAgenda::init() 223void KOAgenda::init()
225{ 224{
226#ifndef _WIN32_ 225#ifndef _WIN32_
227 int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase 226 int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase
228 viewport()->setWFlags ( wflags); 227 viewport()->setWFlags ( wflags);
229#endif 228#endif
230 mGridSpacingX = 80; 229 mGridSpacingX = 80;
231 mResizeBorderWidth = 8; 230 mResizeBorderWidth = 8;
232 mScrollBorderWidth = 8; 231 mScrollBorderWidth = 8;
233 mScrollDelay = 30; 232 mScrollDelay = 30;
234 mScrollOffset = 10; 233 mScrollOffset = 10;
235 mPaintPixmap.resize( 20,20); 234 mPaintPixmap.resize( 20,20);
236 //enableClipper(true); 235 //enableClipper(true);
237 236
238 // Grab key strokes for keyboard navigation of agenda. Seems to have no 237 // Grab key strokes for keyboard navigation of agenda. Seems to have no
239 // effect. Has to be fixed. 238 // effect. Has to be fixed.
240 setFocusPolicy(WheelFocus); 239 setFocusPolicy(WheelFocus);
241 240
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 02fd33b..a39feb1 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -1,242 +1,242 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
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 <qlabel.h> 20#include <qlabel.h>
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qvbox.h> 23#include <qvbox.h>
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qwhatsthis.h> 25#include <qwhatsthis.h>
26#include <qdragobject.h> 26#include <qdragobject.h>
27#include <qdrawutil.h> 27#include <qdrawutil.h>
28#include <qpainter.h> 28#include <qpainter.h>
29 29
30#include <kiconloader.h> 30#include <kiconloader.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <klocale.h> 33#include <klocale.h>
34#ifndef DESKTOP_VERSION 34#ifndef DESKTOP_VERSION
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#define AGENDA_ICON_SIZE 5 36#define AGENDA_ICON_SIZE 5
37#else 37#else
38#define AGENDA_ICON_SIZE 7 38#define AGENDA_ICON_SIZE 7
39#endif 39#endif
40#include <libkcal/icaldrag.h> 40#include <libkcal/icaldrag.h>
41#include <libkcal/vcaldrag.h> 41#include <libkcal/vcaldrag.h>
42#include <libkdepim/kincidenceformatter.h> 42#include <libkdepim/kincidenceformatter.h>
43extern int globalFlagBlockAgenda; 43extern int globalFlagBlockAgenda;
44extern int globalFlagBlockAgendaItemPaint; 44extern int globalFlagBlockAgendaItemPaint;
45extern int globalFlagBlockAgendaItemUpdate; 45extern int globalFlagBlockAgendaItemUpdate;
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48 48
49#include "koagendaitem.h" 49#include "koagendaitem.h"
50#include "koagendaitem.moc" 50//#include "koagendaitem.moc"
51 51
52 52
53//-------------------------------------------------------------------------- 53//--------------------------------------------------------------------------
54 54
55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; 55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
56 56
57//-------------------------------------------------------------------------- 57//--------------------------------------------------------------------------
58 58
59KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, 59KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
60 const char *name,WFlags) : 60 const char *name,WFlags) :
61 QWidget(parent, name), mIncidence(incidence), mDate(qd) 61 QWidget(parent, name), mIncidence(incidence), mDate(qd)
62{ 62{
63#ifndef DESKTOP_VERSION 63#ifndef DESKTOP_VERSION
64 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 64 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
65#endif 65#endif
66 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase 66 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase
67 setWFlags ( wflags); 67 setWFlags ( wflags);
68 mAllDay = allday; 68 mAllDay = allday;
69 init ( incidence, qd ); 69 init ( incidence, qd );
70 setMouseTracking(true); 70 setMouseTracking(true);
71 //setAcceptDrops(true); 71 //setAcceptDrops(true);
72 xPaintCoord = -1; 72 xPaintCoord = -1;
73 yPaintCoord = -1; 73 yPaintCoord = -1;
74} 74}
75 75
76void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 76void KOAgendaItem::init ( Incidence *incidence, QDate qd )
77{ 77{
78 mIncidence = incidence; 78 mIncidence = incidence;
79 mDate = qd; 79 mDate = qd;
80 mFirstMultiItem = 0; 80 mFirstMultiItem = 0;
81 mNextMultiItem = 0; 81 mNextMultiItem = 0;
82 mLastMultiItem = 0; 82 mLastMultiItem = 0;
83 computeText(); 83 computeText();
84 84
85 if ( (incidence->type() == "Todo") && 85 if ( (incidence->type() == "Todo") &&
86 ( !((static_cast<Todo*>(incidence))->isCompleted()) && 86 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
87 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { 87 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
88 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) 88 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
89 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 89 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
90 else 90 else
91 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 91 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
92 } 92 }
93 else { 93 else {
94 QStringList categories = mIncidence->categories(); 94 QStringList categories = mIncidence->categories();
95 QString cat = categories.first(); 95 QString cat = categories.first();
96 if (cat.isEmpty()) { 96 if (cat.isEmpty()) {
97 mBackgroundColor =KOPrefs::instance()->mEventColor; 97 mBackgroundColor =KOPrefs::instance()->mEventColor;
98 } else { 98 } else {
99 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 99 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
100 } 100 }
101 } 101 }
102 mColorGroup = QColorGroup( mBackgroundColor.light(), 102 mColorGroup = QColorGroup( mBackgroundColor.light(),
103 mBackgroundColor.dark(),mBackgroundColor.light(), 103 mBackgroundColor.dark(),mBackgroundColor.light(),
104 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; 104 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ;
105 setBackgroundColor( mBackgroundColor ); 105 setBackgroundColor( mBackgroundColor );
106 106
107 setCellXY(0,0,1); 107 setCellXY(0,0,1);
108 setCellXWidth(0); 108 setCellXWidth(0);
109 setSubCell(0); 109 setSubCell(0);
110 setSubCells(1); 110 setSubCells(1);
111 setMultiItem(0,0,0); 111 setMultiItem(0,0,0);
112 startMove(); 112 startMove();
113 mSelected = true; 113 mSelected = true;
114 select(false); 114 select(false);
115 QString tipText = mIncidence->summary(); 115 QString tipText = mIncidence->summary();
116 // QToolTip::add(this,tipText); 116 // QToolTip::add(this,tipText);
117 QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); 117 QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence ));
118 if ( !mIncidence->doesFloat() ) 118 if ( !mIncidence->doesFloat() )
119 if ( mIncidence->type() == "Event" ) { 119 if ( mIncidence->type() == "Event" ) {
120 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { 120 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
121 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); 121 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
122 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); 122 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
123 } 123 }
124 else { 124 else {
125 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); 125 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
126 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); 126 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
127 } 127 }
128 } 128 }
129 else if ( mIncidence->type() == "Todo" ) { 129 else if ( mIncidence->type() == "Todo" ) {
130 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr(); 130 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr();
131 } 131 }
132 132
133 if (!mIncidence->location().isEmpty()) { 133 if (!mIncidence->location().isEmpty()) {
134 tipText += "\n"+i18n("Location: ")+mIncidence->location(); 134 tipText += "\n"+i18n("Location: ")+mIncidence->location();
135 } 135 }
136 QToolTip::add(this,tipText,toolTipGroup(),""); 136 QToolTip::add(this,tipText,toolTipGroup(),"");
137 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); 137 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
138 mFontPixelSize = fontinf.height();; 138 mFontPixelSize = fontinf.height();;
139 hide(); 139 hide();
140 xPaintCoord = -1; 140 xPaintCoord = -1;
141 yPaintCoord = -1; 141 yPaintCoord = -1;
142} 142}
143 143
144 144
145KOAgendaItem::~KOAgendaItem() 145KOAgendaItem::~KOAgendaItem()
146{ 146{
147 // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); 147 // qDebug("deleteKOAgendaItem::~KOAgendaItem( ");
148 148
149} 149}
150 150
151void KOAgendaItem::recreateIncidence() 151void KOAgendaItem::recreateIncidence()
152{ 152{
153 Incidence* newInc = mIncidence->clone(); 153 Incidence* newInc = mIncidence->clone();
154 newInc->recreate(); 154 newInc->recreate();
155 if ( mIncidence->doesRecur() ) { 155 if ( mIncidence->doesRecur() ) {
156 mIncidence->addExDate( mDate ); 156 mIncidence->addExDate( mDate );
157 newInc->recurrence()->unsetRecurs(); 157 newInc->recurrence()->unsetRecurs();
158 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); 158 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd());
159 QTime tim = mIncidence->dtStart().time(); 159 QTime tim = mIncidence->dtStart().time();
160 newInc->setDtStart( QDateTime(mDate, tim) ); 160 newInc->setDtStart( QDateTime(mDate, tim) );
161 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 161 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
162 } 162 }
163 mIncidence = newInc; 163 mIncidence = newInc;
164} 164}
165bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) 165bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
166{ 166{
167 int size = AGENDA_ICON_SIZE; 167 int size = AGENDA_ICON_SIZE;
168 168
169 int yOff = 0; 169 int yOff = 0;
170 int xOff = 0; 170 int xOff = 0;
171 int x = pos().x() +3; 171 int x = pos().x() +3;
172 int y; 172 int y;
173 if ( mAllDay ) 173 if ( mAllDay )
174 y = pos().y()+3; 174 y = pos().y()+3;
175 else 175 else
176 y = mCellYTop * ( height() / cellHeight() ) +3; 176 y = mCellYTop * ( height() / cellHeight() ) +3;
177 if (mIncidence->cancelled()) { 177 if (mIncidence->cancelled()) {
178 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; 178 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
179 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; 179 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
180 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); 180 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
181 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); 181 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
182 if ( horLayout ) 182 if ( horLayout )
183 ++xOff; 183 ++xOff;
184 else 184 else
185 ++yOff; 185 ++yOff;
186 } 186 }
187 if (mIncidence->isAlarmEnabled()) { 187 if (mIncidence->isAlarmEnabled()) {
188 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); 188 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
189 if ( horLayout ) 189 if ( horLayout )
190 ++xOff; 190 ++xOff;
191 else 191 else
192 ++yOff; 192 ++yOff;
193 } 193 }
194 if (mIncidence->recurrence()->doesRecur()) { 194 if (mIncidence->recurrence()->doesRecur()) {
195 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); 195 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
196 if ( horLayout ) 196 if ( horLayout )
197 ++xOff; 197 ++xOff;
198 else 198 else
199 ++yOff; 199 ++yOff;
200 } 200 }
201 if (mIncidence->description().length() > 0) { 201 if (mIncidence->description().length() > 0) {
202 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); 202 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen );
203 if ( horLayout ) 203 if ( horLayout )
204 ++xOff; 204 ++xOff;
205 else 205 else
206 ++yOff; 206 ++yOff;
207 } 207 }
208 if (mIncidence->isReadOnly()) { 208 if (mIncidence->isReadOnly()) {
209 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); 209 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
210 if ( horLayout ) 210 if ( horLayout )
211 ++xOff; 211 ++xOff;
212 else 212 else
213 ++yOff; 213 ++yOff;
214 } 214 }
215 215
216 if (mIncidence->attendeeCount()>0) { 216 if (mIncidence->attendeeCount()>0) {
217 217
218 if (mIncidence->organizer() == KOPrefs::instance()->email()) { 218 if (mIncidence->organizer() == KOPrefs::instance()->email()) {
219 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); 219 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
220 if ( horLayout ) 220 if ( horLayout )
221 ++xOff; 221 ++xOff;
222 else 222 else
223 ++yOff; 223 ++yOff;
224 } else { 224 } else {
225 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 225 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
226 if (me!=0) { 226 if (me!=0) {
227 227
228 228
229 } else { 229 } else {
230 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); 230 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow );
231 if ( horLayout ) 231 if ( horLayout )
232 ++xOff; 232 ++xOff;
233 else 233 else
234 ++yOff; 234 ++yOff;
235 235
236 } 236 }
237 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); 237 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow );
238 if ( horLayout ) 238 if ( horLayout )
239 ++xOff; 239 ++xOff;
240 else 240 else
241 ++yOff; 241 ++yOff;
242 242
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 9e057e4..77a3164 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1,261 +1,261 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
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 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 <qhbox.h>
25#include <qvbox.h> 25#include <qvbox.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qframe.h> 27#include <qframe.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 <qpopupmenu.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 39
40#include <kapplication.h> 40#include <kapplication.h>
41#include <KDGanttMinimizeSplitter.h> 41#include <KDGanttMinimizeSplitter.h>
42#include <kdebug.h> 42#include <kdebug.h>
43#include <kstandarddirs.h> 43#include <kstandarddirs.h>
44#include <kiconloader.h> 44#include <kiconloader.h>
45#include <klocale.h> 45#include <klocale.h>
46#include <kconfig.h> 46#include <kconfig.h>
47#include <kglobal.h> 47#include <kglobal.h>
48#include "calendarview.h" 48#include "calendarview.h"
49#include "koviewmanager.h" 49#include "koviewmanager.h"
50 50
51#include <libkcal/calendar.h> 51#include <libkcal/calendar.h>
52#include <libkcal/icaldrag.h> 52#include <libkcal/icaldrag.h>
53#include <libkcal/dndfactory.h> 53#include <libkcal/dndfactory.h>
54 54
55#include <kcalendarsystem.h> 55#include <kcalendarsystem.h>
56 56
57#include "koglobals.h" 57#include "koglobals.h"
58#ifndef KORG_NOPLUGINS 58#ifndef KORG_NOPLUGINS
59#include "kocore.h" 59#include "kocore.h"
60#endif 60#endif
61#include "koprefs.h" 61#include "koprefs.h"
62#include "koagenda.h" 62#include "koagenda.h"
63#include "koagendaitem.h" 63#include "koagendaitem.h"
64#ifndef KORG_NOPRINTER 64#ifndef KORG_NOPRINTER
65#include "calprinter.h" 65#include "calprinter.h"
66#endif 66#endif
67 67
68#include "koagendaview.h" 68#include "koagendaview.h"
69#include "koagendaview.moc" 69//#include "koagendaview.moc"
70 70
71//extern bool globalFlagBlockPainting; 71//extern bool globalFlagBlockPainting;
72extern int globalFlagBlockAgenda; 72extern int globalFlagBlockAgenda;
73extern int globalFlagBlockStartup; 73extern int globalFlagBlockStartup;
74extern int globalFlagBlockAgendaItemPaint; 74extern int globalFlagBlockAgendaItemPaint;
75extern int globalFlagBlockAgendaItemUpdate; 75extern int globalFlagBlockAgendaItemUpdate;
76extern int globalFlagBlockLabel; 76extern int globalFlagBlockLabel;
77using namespace KOrg; 77using namespace KOrg;
78 78
79TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : 79TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
80 QScrollView(parent,name,f) 80 QScrollView(parent,name,f)
81{ 81{
82 mRows = rows; 82 mRows = rows;
83 83
84 setMinimumHeight( 20 ); 84 setMinimumHeight( 20 );
85 mCellHeight = KOPrefs::instance()->mHourSize*4; 85 mCellHeight = KOPrefs::instance()->mHourSize*4;
86 86
87 enableClipper(true); 87 enableClipper(true);
88 88
89 setHScrollBarMode(AlwaysOff); 89 setHScrollBarMode(AlwaysOff);
90 setVScrollBarMode(AlwaysOff); 90 setVScrollBarMode(AlwaysOff);
91 91
92 resizeContents(50,mRows * mCellHeight); 92 resizeContents(50,mRows * mCellHeight);
93 93
94 viewport()->setBackgroundMode( PaletteBackground ); 94 viewport()->setBackgroundMode( PaletteBackground );
95} 95}
96 96
97void TimeLabels::setCellHeight(int height) 97void TimeLabels::setCellHeight(int height)
98{ 98{
99 mCellHeight = height; 99 mCellHeight = height;
100} 100}
101 101
102/* 102/*
103 Optimization so that only the "dirty" portion of the scroll view 103 Optimization so that only the "dirty" portion of the scroll view
104 is redrawn. Unfortunately, this is not called by default paintEvent() method. 104 is redrawn. Unfortunately, this is not called by default paintEvent() method.
105*/ 105*/
106void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) 106void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
107{ 107{
108 108
109 // if ( globalFlagBlockAgenda ) 109 // if ( globalFlagBlockAgenda )
110 // return; 110 // return;
111 // bug: the parameters cx, cy, cw, ch are the areas that need to be 111 // bug: the parameters cx, cy, cw, ch are the areas that need to be
112 // redrawn, not the area of the widget. unfortunately, this 112 // redrawn, not the area of the widget. unfortunately, this
113 // code assumes the latter... 113 // code assumes the latter...
114 114
115 // now, for a workaround... 115 // now, for a workaround...
116 // these two assignments fix the weird redraw bug 116 // these two assignments fix the weird redraw bug
117 cx = contentsX() + 2; 117 cx = contentsX() + 2;
118 cw = contentsWidth() - 2; 118 cw = contentsWidth() - 2;
119 // end of workaround 119 // end of workaround
120 120
121 int cell = ((int)(cy/mCellHeight)); 121 int cell = ((int)(cy/mCellHeight));
122 int y = cell * mCellHeight; 122 int y = cell * mCellHeight;
123 QFontMetrics fm = fontMetrics(); 123 QFontMetrics fm = fontMetrics();
124 QString hour; 124 QString hour;
125 QString suffix; 125 QString suffix;
126 QString fullTime; 126 QString fullTime;
127 int tW = fm.width("24:00i"); 127 int tW = fm.width("24:00i");
128 128
129 while (y < cy + ch) { 129 while (y < cy + ch) {
130 p->drawLine(cx,y,cx+tW,y); 130 p->drawLine(cx,y,cx+tW,y);
131 hour.setNum(cell); 131 hour.setNum(cell);
132 suffix = "am"; 132 suffix = "am";
133 133
134 // handle 24h and am/pm time formats 134 // handle 24h and am/pm time formats
135 if (KGlobal::locale()->use12Clock()) { 135 if (KGlobal::locale()->use12Clock()) {
136 if (cell > 11) suffix = "pm"; 136 if (cell > 11) suffix = "pm";
137 if (cell == 0) hour.setNum(12); 137 if (cell == 0) hour.setNum(12);
138 if (cell > 12) hour.setNum(cell - 12); 138 if (cell > 12) hour.setNum(cell - 12);
139 } else { 139 } else {
140 suffix = ":00"; 140 suffix = ":00";
141 } 141 }
142 142
143 // create string in format of "XX:XX" or "XXpm/am" 143 // create string in format of "XX:XX" or "XXpm/am"
144 fullTime = hour + suffix; 144 fullTime = hour + suffix;
145 145
146 // center and draw the time label 146 // center and draw the time label
147 int timeWidth = fm.width(fullTime+"i"); 147 int timeWidth = fm.width(fullTime+"i");
148 int offset = this->width() - timeWidth; 148 int offset = this->width() - timeWidth;
149 int borderWidth = 5; 149 int borderWidth = 5;
150 int timeHeight = fm.height(); 150 int timeHeight = fm.height();
151 timeHeight = timeHeight + 2 - ( timeHeight / 4 ); 151 timeHeight = timeHeight + 2 - ( timeHeight / 4 );
152 p->drawText(cx -borderWidth + offset, y+ timeHeight, fullTime); 152 p->drawText(cx -borderWidth + offset, y+ timeHeight, fullTime);
153 153
154 // increment indices 154 // increment indices
155 y += mCellHeight; 155 y += mCellHeight;
156 cell++; 156 cell++;
157 } 157 }
158} 158}
159 159
160/** 160/**
161 Calculates the minimum width. 161 Calculates the minimum width.
162*/ 162*/
163int TimeLabels::minimumWidth() const 163int TimeLabels::minimumWidth() const
164{ 164{
165 QFontMetrics fm = fontMetrics(); 165 QFontMetrics fm = fontMetrics();
166 166
167 //TODO: calculate this value 167 //TODO: calculate this value
168 int borderWidth = 4; 168 int borderWidth = 4;
169 169
170 // the maximum width possible 170 // the maximum width possible
171 int width = fm.width("88:88x") + borderWidth; 171 int width = fm.width("88:88x") + borderWidth;
172 172
173 return width; 173 return width;
174} 174}
175 175
176/** updates widget's internal state */ 176/** updates widget's internal state */
177void TimeLabels::updateConfig() 177void TimeLabels::updateConfig()
178{ 178{
179 // set the font 179 // set the font
180 // config->setGroup("Fonts"); 180 // config->setGroup("Fonts");
181 // QFont font = config->readFontEntry("TimeBar Font"); 181 // QFont font = config->readFontEntry("TimeBar Font");
182 setFont(KOPrefs::instance()->mTimeBarFont); 182 setFont(KOPrefs::instance()->mTimeBarFont);
183 183
184 // update geometry restrictions based on new settings 184 // update geometry restrictions based on new settings
185 setFixedWidth(minimumWidth()); 185 setFixedWidth(minimumWidth());
186 186
187 // update HourSize 187 // update HourSize
188 mCellHeight = KOPrefs::instance()->mHourSize*4; 188 mCellHeight = KOPrefs::instance()->mHourSize*4;
189 resizeContents(50,mRows * mCellHeight); 189 resizeContents(50,mRows * mCellHeight);
190} 190}
191 191
192/** update time label positions */ 192/** update time label positions */
193void TimeLabels::positionChanged() 193void TimeLabels::positionChanged()
194{ 194{
195 int adjustment = mAgenda->contentsY(); 195 int adjustment = mAgenda->contentsY();
196 setContentsPos(0, adjustment); 196 setContentsPos(0, adjustment);
197} 197}
198 198
199/** */ 199/** */
200void TimeLabels::setAgenda(KOAgenda* agenda) 200void TimeLabels::setAgenda(KOAgenda* agenda)
201{ 201{
202 mAgenda = agenda; 202 mAgenda = agenda;
203} 203}
204 204
205 205
206/** This is called in response to repaint() */ 206/** This is called in response to repaint() */
207void TimeLabels::paintEvent(QPaintEvent*) 207void TimeLabels::paintEvent(QPaintEvent*)
208{ 208{
209 209
210 // kdDebug() << "paintevent..." << endl; 210 // kdDebug() << "paintevent..." << endl;
211 // this is another hack! 211 // this is another hack!
212 // QPainter painter(this); 212 // QPainter painter(this);
213 //QString c 213 //QString c
214 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); 214 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight());
215} 215}
216 216
217//////////////////////////////////////////////////////////////////////////// 217////////////////////////////////////////////////////////////////////////////
218 218
219EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) 219EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name)
220 : QFrame(parent,name) 220 : QFrame(parent,name)
221{ 221{
222 mColumns = 1; 222 mColumns = 1;
223 mTopBox = 0; 223 mTopBox = 0;
224 mLocation = loc; 224 mLocation = loc;
225 mTopLayout = 0; 225 mTopLayout = 0;
226 mPaintWidget = 0; 226 mPaintWidget = 0;
227 mXOffset = 0; 227 mXOffset = 0;
228 if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); 228 if (mLocation == Top) mPixmap = SmallIcon("1uparrow");
229 else mPixmap = SmallIcon("1downarrow"); 229 else mPixmap = SmallIcon("1downarrow");
230 mEnabled.resize(mColumns); 230 mEnabled.resize(mColumns);
231 if (mLocation == Top) 231 if (mLocation == Top)
232 setMaximumHeight(0); 232 setMaximumHeight(0);
233 else 233 else
234 setMinimumHeight(mPixmap.height()); 234 setMinimumHeight(mPixmap.height());
235} 235}
236 236
237EventIndicator::~EventIndicator() 237EventIndicator::~EventIndicator()
238{ 238{
239} 239}
240 240
241void EventIndicator::drawContents(QPainter *p) 241void EventIndicator::drawContents(QPainter *p)
242{ 242{
243 243
244 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; 244 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl;
245 KDGanttSplitterHandle* han = 0; 245 KDGanttSplitterHandle* han = 0;
246 if ( mPaintWidget ) 246 if ( mPaintWidget )
247 han = mPaintWidget->firstHandle(); 247 han = mPaintWidget->firstHandle();
248 if ( ! han ) { 248 if ( ! han ) {
249 int i; 249 int i;
250 for(i=0;i<mColumns;++i) { 250 for(i=0;i<mColumns;++i) {
251 if (mEnabled[i]) { 251 if (mEnabled[i]) {
252 int cellWidth = contentsRect().right()/mColumns; 252 int cellWidth = contentsRect().right()/mColumns;
253 int xOffset = KOGlobals::self()->reverseLayout() ? 253 int xOffset = KOGlobals::self()->reverseLayout() ?
254 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : 254 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 :
255 i*cellWidth + cellWidth/2 -mPixmap.width()/2; 255 i*cellWidth + cellWidth/2 -mPixmap.width()/2;
256 p->drawPixmap(QPoint(xOffset,0),mPixmap); 256 p->drawPixmap(QPoint(xOffset,0),mPixmap);
257 } 257 }
258 } 258 }
259 } else { 259 } else {
260 han->repaint(); 260 han->repaint();
261 //mPaintWidget->setBackgroundColor( red ); 261 //mPaintWidget->setBackgroundColor( red );
diff --git a/korganizer/kocounterdialog.cpp b/korganizer/kocounterdialog.cpp
index 8a9ae44..82a7072 100644
--- a/korganizer/kocounterdialog.cpp
+++ b/korganizer/kocounterdialog.cpp
@@ -1,66 +1,66 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
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 20
21#include <klocale.h> 21#include <klocale.h>
22 22
23#include <libkcal/event.h> 23#include <libkcal/event.h>
24#include "koeventviewer.h" 24#include "koeventviewer.h"
25 25
26#include "kocounterdialog.h" 26#include "kocounterdialog.h"
27#include "kocounterdialog.moc" 27//#include "kocounterdialog.moc"
28 28
29KOCounterDialog::KOCounterDialog(QWidget *parent,const char *name) 29KOCounterDialog::KOCounterDialog(QWidget *parent,const char *name)
30 : KDialogBase(parent,name,false,i18n("Counter-event Viewer"),User1|User2,User1, 30 : KDialogBase(parent,name,false,i18n("Counter-event Viewer"),User1|User2,User1,
31 false,i18n("Decline"),i18n("Accept")) 31 false,i18n("Decline"),i18n("Accept"))
32{ 32{
33 mEventViewer = new KOEventViewer(this); 33 mEventViewer = new KOEventViewer(this);
34 setMainWidget(mEventViewer); 34 setMainWidget(mEventViewer);
35 35
36 connect(this,SIGNAL(user1Clicked()),this,SLOT(slotCancel())); 36 connect(this,SIGNAL(user1Clicked()),this,SLOT(slotCancel()));
37 connect(this,SIGNAL(user2Clicked()),this,SLOT(slotOk())); 37 connect(this,SIGNAL(user2Clicked()),this,SLOT(slotOk()));
38 38
39 // TODO: Set a sensible size (based on the content?). 39 // TODO: Set a sensible size (based on the content?).
40 setMinimumSize(300,200); 40 setMinimumSize(300,200);
41 resize(320,300); 41 resize(320,300);
42} 42}
43 43
44KOCounterDialog::~KOCounterDialog() 44KOCounterDialog::~KOCounterDialog()
45{ 45{
46} 46}
47 47
48void KOCounterDialog::setEvent(Event *event) 48void KOCounterDialog::setEvent(Event *event)
49{ 49{
50 mEventViewer->setEvent(event); 50 mEventViewer->setEvent(event);
51} 51}
52 52
53void KOCounterDialog::addEvent(Event *event) 53void KOCounterDialog::addEvent(Event *event)
54{ 54{
55 mEventViewer->addEvent(event); 55 mEventViewer->addEvent(event);
56} 56}
57 57
58void KOCounterDialog::setTodo(Todo *event) 58void KOCounterDialog::setTodo(Todo *event)
59{ 59{
60 mEventViewer->setTodo(event); 60 mEventViewer->setTodo(event);
61} 61}
62 62
63void KOCounterDialog::addText(QString text) 63void KOCounterDialog::addText(QString text)
64{ 64{
65 mEventViewer->addText(text); 65 mEventViewer->addText(text);
66} 66}
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 779d67c..fc00828 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -1,241 +1,240 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> 3 Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at>
4 Parts of the source code have been copied from kdpdatebutton.cpp 4 Parts of the source code have been copied from kdpdatebutton.cpp
5 5
6 This program is free software; you can redistribute it and/or modify 6 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 7 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 8 the Free Software Foundation; either version 2 of the License, or
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 <qevent.h> 25#include <qevent.h>
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qptrlist.h> 27#include <qptrlist.h>
28 28
29#include <kglobal.h> 29#include <kglobal.h>
30#include <kdebug.h> 30#include <kdebug.h>
31#include <klocale.h> 31#include <klocale.h>
32 32
33#include <libkcal/vcaldrag.h> 33#include <libkcal/vcaldrag.h>
34#include <libkcal/icaldrag.h> 34#include <libkcal/icaldrag.h>
35#include <libkcal/dndfactory.h> 35#include <libkcal/dndfactory.h>
36#include <libkcal/calendarresources.h> 36#include <libkcal/calendarresources.h>
37#include <libkcal/resourcecalendar.h> 37#include <libkcal/resourcecalendar.h>
38#include <kresources/resourceselectdialog.h> 38#include <kresources/resourceselectdialog.h>
39 39
40#include <kcalendarsystem.h> 40#include <kcalendarsystem.h>
41 41
42#ifndef KORG_NOPLUGINS 42#ifndef KORG_NOPLUGINS
43#include "kocore.h" 43#include "kocore.h"
44#endif 44#endif
45#include "koprefs.h" 45#include "koprefs.h"
46#include "koglobals.h" 46#include "koglobals.h"
47 47
48#include "kodaymatrix.h" 48#include "kodaymatrix.h"
49#include "kodaymatrix.moc"
50 49
51// ============================================================================ 50// ============================================================================
52// D Y N A M I C T I P 51// D Y N A M I C T I P
53// ============================================================================ 52// ============================================================================
54 53
55DynamicTip::DynamicTip( QWidget * parent ) 54DynamicTip::DynamicTip( QWidget * parent )
56 : QToolTip( parent ) 55 : QToolTip( parent )
57{ 56{
58 matrix = (KODayMatrix*)parent; 57 matrix = (KODayMatrix*)parent;
59} 58}
60 59
61 60
62void DynamicTip::maybeTip( const QPoint &pos ) 61void DynamicTip::maybeTip( const QPoint &pos )
63{ 62{
64 //calculate which cell of the matrix the mouse is in 63 //calculate which cell of the matrix the mouse is in
65 QRect sz = matrix->frameRect(); 64 QRect sz = matrix->frameRect();
66 int dheight = sz.height()*7 / 42; 65 int dheight = sz.height()*7 / 42;
67 int dwidth = sz.width() / 7; 66 int dwidth = sz.width() / 7;
68 int row = pos.y()/dheight; 67 int row = pos.y()/dheight;
69 int col = pos.x()/dwidth; 68 int col = pos.x()/dwidth;
70 69
71 QRect rct(col*dwidth, row*dheight, dwidth, dheight); 70 QRect rct(col*dwidth, row*dheight, dwidth, dheight);
72 71
73// kdDebug() << "DynamicTip::maybeTip matrix cell index [" << 72// kdDebug() << "DynamicTip::maybeTip matrix cell index [" <<
74// col << "][" << row << "] => " <<(col+row*7) << endl; 73// col << "][" << row << "] => " <<(col+row*7) << endl;
75 74
76 //show holiday names only 75 //show holiday names only
77 QString str = matrix->getHolidayLabel(col+row*7); 76 QString str = matrix->getHolidayLabel(col+row*7);
78 if (str.isEmpty()) return; 77 if (str.isEmpty()) return;
79 tip(rct, str); 78 tip(rct, str);
80} 79}
81 80
82 81
83// ============================================================================ 82// ============================================================================
84// K O D A Y M A T R I X 83// K O D A Y M A T R I X
85// ============================================================================ 84// ============================================================================
86 85
87const int KODayMatrix::NOSELECTION = -1000; 86const int KODayMatrix::NOSELECTION = -1000;
88const int KODayMatrix::NUMDAYS = 42; 87const int KODayMatrix::NUMDAYS = 42;
89 88
90KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : 89KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) :
91 QFrame(parent, name) 90 QFrame(parent, name)
92{ 91{
93 mCalendar = calendar; 92 mCalendar = calendar;
94 93
95 // initialize dynamic arrays 94 // initialize dynamic arrays
96 days = new QDate[NUMDAYS]; 95 days = new QDate[NUMDAYS];
97 daylbls = new QString[NUMDAYS]; 96 daylbls = new QString[NUMDAYS];
98 events = new int[NUMDAYS]; 97 events = new int[NUMDAYS];
99 mToolTip = new DynamicTip(this); 98 mToolTip = new DynamicTip(this);
100 99
101 // set default values used for drawing the matrix 100 // set default values used for drawing the matrix
102 mDefaultBackColor = palette().active().base(); 101 mDefaultBackColor = palette().active().base();
103 mDefaultTextColor = palette().active().foreground(); 102 mDefaultTextColor = palette().active().foreground();
104 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); 103 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor);
105 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); 104 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor);
106 mSelectedDaysColor = QColor("white"); 105 mSelectedDaysColor = QColor("white");
107 mTodayMarginWidth = 2; 106 mTodayMarginWidth = 2;
108 mSelEnd = mSelStart = NOSELECTION; 107 mSelEnd = mSelStart = NOSELECTION;
109 108
110 setAcceptDrops(true); 109 setAcceptDrops(true);
111 //setFont( QFont("Arial", 10) ); 110 //setFont( QFont("Arial", 10) );
112 updateView(date); 111 updateView(date);
113} 112}
114 113
115QColor KODayMatrix::getShadedColor(QColor color) 114QColor KODayMatrix::getShadedColor(QColor color)
116{ 115{
117 QColor shaded; 116 QColor shaded;
118 int h=0; 117 int h=0;
119 int s=0; 118 int s=0;
120 int v=0; 119 int v=0;
121 color.hsv(&h,&s,&v); 120 color.hsv(&h,&s,&v);
122 s = s/4; 121 s = s/4;
123 v = 192+v/4; 122 v = 192+v/4;
124 shaded.setHsv(h,s,v); 123 shaded.setHsv(h,s,v);
125 124
126 return shaded; 125 return shaded;
127} 126}
128 127
129KODayMatrix::~KODayMatrix() 128KODayMatrix::~KODayMatrix()
130{ 129{
131 delete [] days; 130 delete [] days;
132 delete [] daylbls; 131 delete [] daylbls;
133 delete [] events; 132 delete [] events;
134 delete mToolTip; 133 delete mToolTip;
135} 134}
136 135
137/* 136/*
138void KODayMatrix::setStartDate(QDate start) 137void KODayMatrix::setStartDate(QDate start)
139{ 138{
140 updateView(start); 139 updateView(start);
141} 140}
142*/ 141*/
143 142
144void KODayMatrix::addSelectedDaysTo(DateList& selDays) 143void KODayMatrix::addSelectedDaysTo(DateList& selDays)
145{ 144{
146 kdDebug() << "KODayMatrix::addSelectedDaysTo() - " << "mSelStart:" << mSelStart << endl; 145 kdDebug() << "KODayMatrix::addSelectedDaysTo() - " << "mSelStart:" << mSelStart << endl;
147 146
148 if (mSelStart == NOSELECTION) { 147 if (mSelStart == NOSELECTION) {
149 return; 148 return;
150 } 149 }
151 150
152 //cope with selection being out of matrix limits at top (< 0) 151 //cope with selection being out of matrix limits at top (< 0)
153 int i0 = mSelStart; 152 int i0 = mSelStart;
154 if (i0 < 0) { 153 if (i0 < 0) {
155 for (int i = i0; i < 0; i++) { 154 for (int i = i0; i < 0; i++) {
156 selDays.append(days[0].addDays(i)); 155 selDays.append(days[0].addDays(i));
157 } 156 }
158 i0 = 0; 157 i0 = 0;
159 } 158 }
160 159
161 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) 160 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1)
162 if (mSelEnd > NUMDAYS-1) { 161 if (mSelEnd > NUMDAYS-1) {
163 for (int i = i0; i <= NUMDAYS-1; i++) { 162 for (int i = i0; i <= NUMDAYS-1; i++) {
164 selDays.append(days[i]); 163 selDays.append(days[i]);
165 } 164 }
166 for (int i = NUMDAYS; i < mSelEnd; i++) { 165 for (int i = NUMDAYS; i < mSelEnd; i++) {
167 selDays.append(days[0].addDays(i)); 166 selDays.append(days[0].addDays(i));
168 } 167 }
169 168
170 // apply normal routine to selection being entirely within matrix limits 169 // apply normal routine to selection being entirely within matrix limits
171 } else { 170 } else {
172 for (int i = i0; i <= mSelEnd; i++) { 171 for (int i = i0; i <= mSelEnd; i++) {
173 selDays.append(days[i]); 172 selDays.append(days[i]);
174 } 173 }
175 } 174 }
176} 175}
177 176
178void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) 177void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
179{ 178{
180 mSelStart = startdate.daysTo(start); 179 mSelStart = startdate.daysTo(start);
181 mSelEnd = startdate.daysTo(end); 180 mSelEnd = startdate.daysTo(end);
182} 181}
183 182
184 183
185void KODayMatrix::recalculateToday() 184void KODayMatrix::recalculateToday()
186{ 185{
187 today = -1; 186 today = -1;
188 for (int i=0; i<NUMDAYS; i++) { 187 for (int i=0; i<NUMDAYS; i++) {
189 days[i] = startdate.addDays(i); 188 days[i] = startdate.addDays(i);
190 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); 189 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] ));
191 190
192 // if today is in the currently displayed month, hilight today 191 // if today is in the currently displayed month, hilight today
193 if (days[i].year() == QDate::currentDate().year() && 192 if (days[i].year() == QDate::currentDate().year() &&
194 days[i].month() == QDate::currentDate().month() && 193 days[i].month() == QDate::currentDate().month() &&
195 days[i].day() == QDate::currentDate().day()) { 194 days[i].day() == QDate::currentDate().day()) {
196 today = i; 195 today = i;
197 } 196 }
198 } 197 }
199 // qDebug(QString("Today is visible at %1.").arg(today)); 198 // qDebug(QString("Today is visible at %1.").arg(today));
200} 199}
201 200
202void KODayMatrix::updateView() 201void KODayMatrix::updateView()
203{ 202{
204 updateView(startdate); 203 updateView(startdate);
205} 204}
206 205
207void KODayMatrix::updateView(QDate actdate) 206void KODayMatrix::updateView(QDate actdate)
208{ 207{
209 208
210// kdDebug() << "KODayMatrix::updateView() " << actdate.toString() << endl; 209// kdDebug() << "KODayMatrix::updateView() " << actdate.toString() << endl;
211 210
212 //flag to indicate if the starting day of the matrix has changed by this call 211 //flag to indicate if the starting day of the matrix has changed by this call
213 bool daychanged = false; 212 bool daychanged = false;
214 // if a new startdate is to be set then apply Cornelius's calculation 213 // if a new startdate is to be set then apply Cornelius's calculation
215 // of the first day to be shown 214 // of the first day to be shown
216 if (actdate != startdate) { 215 if (actdate != startdate) {
217 // reset index of selection according to shift of starting date from startdate to actdate 216 // reset index of selection according to shift of starting date from startdate to actdate
218 if (mSelStart != NOSELECTION) { 217 if (mSelStart != NOSELECTION) {
219 int tmp = actdate.daysTo(startdate); 218 int tmp = actdate.daysTo(startdate);
220 //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; 219 //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl;
221 // shift selection if new one would be visible at least partly ! 220 // shift selection if new one would be visible at least partly !
222 221
223 if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { 222 if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) {
224 // nested if is required for next X display pushed from a different month - correction required 223 // nested if is required for next X display pushed from a different month - correction required
225 // otherwise, for month forward and backward, it must be avoided 224 // otherwise, for month forward and backward, it must be avoided
226 if( mSelStart > NUMDAYS || mSelStart < 0 ) 225 if( mSelStart > NUMDAYS || mSelStart < 0 )
227 mSelStart = mSelStart + tmp; 226 mSelStart = mSelStart + tmp;
228 if( mSelEnd > NUMDAYS || mSelEnd < 0 ) 227 if( mSelEnd > NUMDAYS || mSelEnd < 0 )
229 mSelEnd = mSelEnd + tmp; 228 mSelEnd = mSelEnd + tmp;
230 } 229 }
231 } 230 }
232 231
233 startdate = actdate; 232 startdate = actdate;
234 daychanged = true; 233 daychanged = true;
235 } 234 }
236 235
237 if (daychanged) { 236 if (daychanged) {
238 recalculateToday(); 237 recalculateToday();
239 } 238 }
240 239
241 for(int i = 0; i < NUMDAYS; i++) { 240 for(int i = 0; i < NUMDAYS; i++) {
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp
index caf7599..58198a2 100644
--- a/korganizer/kodialogmanager.cpp
+++ b/korganizer/kodialogmanager.cpp
@@ -1,235 +1,234 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2001 4 Copyright (c) 2001
5 Cornelius Schumacher <schumacher@kde.org> 5 Cornelius Schumacher <schumacher@kde.org>
6 6
7 This program is free software; you can redistribute it and/or modify 7 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 8 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 9 the Free Software Foundation; either version 2 of the License, or
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 21
22#include <libkdepim/categoryeditdialog.h> 22#include <libkdepim/categoryeditdialog.h>
23 23
24#include "calendarview.h" 24#include "calendarview.h"
25#include "incomingdialog.h" 25#include "incomingdialog.h"
26#include "outgoingdialog.h" 26#include "outgoingdialog.h"
27#include "koprefsdialog.h" 27#include "koprefsdialog.h"
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 "kodialogmanager.moc"
44 43
45KODialogManager::KODialogManager( CalendarView *mainView ) : 44KODialogManager::KODialogManager( CalendarView *mainView ) :
46 QObject(), mMainView( mainView ) 45 QObject(), mMainView( mainView )
47{ 46{
48 mOutgoingDialog = 0; 47 mOutgoingDialog = 0;
49 mIncomingDialog = 0; 48 mIncomingDialog = 0;
50 mOptionsDialog = 0; 49 mOptionsDialog = 0;
51 mSearchDialog = 0; 50 mSearchDialog = 0;
52 mArchiveDialog = 0; 51 mArchiveDialog = 0;
53 mFilterEditDialog = 0; 52 mFilterEditDialog = 0;
54 mPluginDialog = 0; 53 mPluginDialog = 0;
55 54
56 // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView); 55 // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView);
57 //KOGlobals::fitDialogToScreen( mCategoryEditDialog ); 56 //KOGlobals::fitDialogToScreen( mCategoryEditDialog );
58} 57}
59 58
60KODialogManager::~KODialogManager() 59KODialogManager::~KODialogManager()
61{ 60{
62 delete mOutgoingDialog; 61 delete mOutgoingDialog;
63 delete mIncomingDialog; 62 delete mIncomingDialog;
64 delete mOptionsDialog; 63 delete mOptionsDialog;
65 delete mSearchDialog; 64 delete mSearchDialog;
66#ifndef KORG_NOARCHIVE 65#ifndef KORG_NOARCHIVE
67 delete mArchiveDialog; 66 delete mArchiveDialog;
68#endif 67#endif
69 delete mFilterEditDialog; 68 delete mFilterEditDialog;
70#ifndef KORG_NOPLUGINS 69#ifndef KORG_NOPLUGINS
71 delete mPluginDialog; 70 delete mPluginDialog;
72#endif 71#endif
73} 72}
74 73
75OutgoingDialog *KODialogManager::outgoingDialog() 74OutgoingDialog *KODialogManager::outgoingDialog()
76{ 75{
77 createOutgoingDialog(); 76 createOutgoingDialog();
78 return mOutgoingDialog; 77 return mOutgoingDialog;
79} 78}
80 79
81void KODialogManager::createOutgoingDialog() 80void KODialogManager::createOutgoingDialog()
82{ 81{
83 if (!mOutgoingDialog) { 82 if (!mOutgoingDialog) {
84 mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView); 83 mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView);
85 if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog); 84 if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog);
86 connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)), 85 connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)),
87 mMainView,SIGNAL(numOutgoingChanged(int))); 86 mMainView,SIGNAL(numOutgoingChanged(int)));
88 } 87 }
89} 88}
90 89
91void KODialogManager::showOptionsDialog( bool showSync ) 90void KODialogManager::showOptionsDialog( bool showSync )
92{ 91{
93 int curLanguage = KOPrefs::instance()->mPreferredLanguage; 92 int curLanguage = KOPrefs::instance()->mPreferredLanguage;
94 if (!mOptionsDialog) { 93 if (!mOptionsDialog) {
95 mOptionsDialog = new KOPrefsDialog(mMainView); 94 mOptionsDialog = new KOPrefsDialog(mMainView);
96 //mOptionsDialog->readConfig(); 95 //mOptionsDialog->readConfig();
97 connect(mOptionsDialog,SIGNAL(configChanged()), 96 connect(mOptionsDialog,SIGNAL(configChanged()),
98 mMainView,SLOT(updateConfig())); 97 mMainView,SLOT(updateConfig()));
99 //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), 98 //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
100 // mOptionsDialog,SLOT(updateCategories())); 99 // mOptionsDialog,SLOT(updateCategories()));
101 100
102 } 101 }
103 mOptionsDialog->readConfig(); 102 mOptionsDialog->readConfig();
104#ifndef DESKTOP_VERSION 103#ifndef DESKTOP_VERSION
105 mOptionsDialog->showMaximized(); 104 mOptionsDialog->showMaximized();
106#else 105#else
107 mOptionsDialog->show(); 106 mOptionsDialog->show();
108#endif 107#endif
109 if ( showSync ) 108 if ( showSync )
110 mOptionsDialog->showSyncPage(); 109 mOptionsDialog->showSyncPage();
111 mOptionsDialog->exec(); 110 mOptionsDialog->exec();
112 if ( curLanguage != KOPrefs::instance()->mPreferredLanguage ) 111 if ( curLanguage != KOPrefs::instance()->mPreferredLanguage )
113 KOPrefs::instance()->mLanguageChanged = true; 112 KOPrefs::instance()->mLanguageChanged = true;
114} 113}
115void KODialogManager::showSyncOptions() 114void KODialogManager::showSyncOptions()
116{ 115{
117 showOptionsDialog( true ); 116 showOptionsDialog( true );
118 117
119} 118}
120void KODialogManager::showOutgoingDialog() 119void KODialogManager::showOutgoingDialog()
121{ 120{
122 createOutgoingDialog(); 121 createOutgoingDialog();
123 mOutgoingDialog->show(); 122 mOutgoingDialog->show();
124 mOutgoingDialog->raise(); 123 mOutgoingDialog->raise();
125} 124}
126 125
127IncomingDialog *KODialogManager::incomingDialog() 126IncomingDialog *KODialogManager::incomingDialog()
128{ 127{
129 createOutgoingDialog(); 128 createOutgoingDialog();
130 if (!mIncomingDialog) { 129 if (!mIncomingDialog) {
131 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); 130 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView);
132 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), 131 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)),
133 mMainView,SIGNAL(numIncomingChanged(int))); 132 mMainView,SIGNAL(numIncomingChanged(int)));
134 connect(mIncomingDialog,SIGNAL(calendarUpdated()), 133 connect(mIncomingDialog,SIGNAL(calendarUpdated()),
135 mMainView,SLOT(updateView())); 134 mMainView,SLOT(updateView()));
136 } 135 }
137 return mIncomingDialog; 136 return mIncomingDialog;
138} 137}
139 138
140void KODialogManager::createIncomingDialog() 139void KODialogManager::createIncomingDialog()
141{ 140{
142 createOutgoingDialog(); 141 createOutgoingDialog();
143 if (!mIncomingDialog) { 142 if (!mIncomingDialog) {
144 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); 143 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView);
145 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), 144 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)),
146 mMainView,SIGNAL(numIncomingChanged(int))); 145 mMainView,SIGNAL(numIncomingChanged(int)));
147 connect(mIncomingDialog,SIGNAL(calendarUpdated()), 146 connect(mIncomingDialog,SIGNAL(calendarUpdated()),
148 mMainView,SLOT(updateView())); 147 mMainView,SLOT(updateView()));
149 } 148 }
150} 149}
151 150
152void KODialogManager::showIncomingDialog() 151void KODialogManager::showIncomingDialog()
153{ 152{
154 createIncomingDialog(); 153 createIncomingDialog();
155 mIncomingDialog->show(); 154 mIncomingDialog->show();
156 mIncomingDialog->raise(); 155 mIncomingDialog->raise();
157} 156}
158/* 157/*
159void KODialogManager::showCategoryEditDialog() 158void KODialogManager::showCategoryEditDialog()
160{ 159{
161 mCategoryEditDialog->show(); 160 mCategoryEditDialog->show();
162} 161}
163*/ 162*/
164void KODialogManager::hideSearchDialog() 163void KODialogManager::hideSearchDialog()
165{ 164{
166 if (mSearchDialog) 165 if (mSearchDialog)
167 mSearchDialog->hide(); 166 mSearchDialog->hide();
168} 167}
169 168
170void KODialogManager::showSearchDialog() 169void KODialogManager::showSearchDialog()
171{ 170{
172 if (!mSearchDialog) { 171 if (!mSearchDialog) {
173 mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView); 172 mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView);
174 KOListView * lview = mSearchDialog->listview(); 173 KOListView * lview = mSearchDialog->listview();
175 174
176 connect(lview, SIGNAL(showIncidenceSignal(Incidence *)), 175 connect(lview, SIGNAL(showIncidenceSignal(Incidence *)),
177 mMainView, SLOT(showIncidence(Incidence *))); 176 mMainView, SLOT(showIncidence(Incidence *)));
178 connect(lview, SIGNAL(editIncidenceSignal(Incidence *)), 177 connect(lview, SIGNAL(editIncidenceSignal(Incidence *)),
179 mMainView, SLOT(editIncidence(Incidence *))); 178 mMainView, SLOT(editIncidence(Incidence *)));
180 connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)), 179 connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)),
181 mMainView, SLOT(deleteIncidence(Incidence *))); 180 mMainView, SLOT(deleteIncidence(Incidence *)));
182 connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)), 181 connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)),
183 mMainView, SLOT(cloneIncidence(Incidence *))); 182 mMainView, SLOT(cloneIncidence(Incidence *)));
184 connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)), 183 connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)),
185 mMainView, SLOT(beamIncidence(Incidence *))); 184 mMainView, SLOT(beamIncidence(Incidence *)));
186 connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)), 185 connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)),
187 mMainView, SLOT(moveIncidence(Incidence *))); 186 mMainView, SLOT(moveIncidence(Incidence *)));
188 connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )), 187 connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )),
189 mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> ))); 188 mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> )));
190 189
191 connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig())); 190 connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig()));
192 connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList())); 191 connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList()));
193 // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ), 192 // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ),
194 // mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 193 // mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
195#ifndef DESKTOP_VERSION 194#ifndef DESKTOP_VERSION
196 mSearchDialog->setMaximumSize( 640, 480 ); 195 mSearchDialog->setMaximumSize( 640, 480 );
197 //mSearchDialog->setGeometry( 40,40, 400, 300); 196 //mSearchDialog->setGeometry( 40,40, 400, 300);
198 mSearchDialog->showMaximized(); 197 mSearchDialog->showMaximized();
199#else 198#else
200 KConfig *config = KOGlobals::config(); 199 KConfig *config = KOGlobals::config();
201 config->setGroup("WidgetLayout"); 200 config->setGroup("WidgetLayout");
202 QStringList list; 201 QStringList list;
203 list = config->readListEntry("SearchLayout"); 202 list = config->readListEntry("SearchLayout");
204 int x,y,w,h; 203 int x,y,w,h;
205 if ( ! list.isEmpty() ) { 204 if ( ! list.isEmpty() ) {
206 x = list[0].toInt(); 205 x = list[0].toInt();
207 y = list[1].toInt(); 206 y = list[1].toInt();
208 w = list[2].toInt(); 207 w = list[2].toInt();
209 h = list[3].toInt(); 208 h = list[3].toInt();
210 mSearchDialog->setGeometry(x,y,w,h); 209 mSearchDialog->setGeometry(x,y,w,h);
211 210
212 } 211 }
213 212
214#endif 213#endif
215 } 214 }
216 // make sure the widget is on top again 215 // make sure the widget is on top again
217 mSearchDialog->show(); 216 mSearchDialog->show();
218 mSearchDialog->raise(); 217 mSearchDialog->raise();
219} 218}
220 219
221SearchDialog * KODialogManager::getSearchDialog() 220SearchDialog * KODialogManager::getSearchDialog()
222{ 221{
223 return mSearchDialog; 222 return mSearchDialog;
224} 223}
225void KODialogManager::showArchiveDialog() 224void KODialogManager::showArchiveDialog()
226{ 225{
227#ifndef KORG_NOARCHIVE 226#ifndef KORG_NOARCHIVE
228 if (!mArchiveDialog) { 227 if (!mArchiveDialog) {
229 mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView); 228 mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView);
230 connect(mArchiveDialog,SIGNAL(eventsDeleted()), 229 connect(mArchiveDialog,SIGNAL(eventsDeleted()),
231 mMainView,SLOT(updateView())); 230 mMainView,SLOT(updateView()));
232 } 231 }
233 mArchiveDialog->show(); 232 mArchiveDialog->show();
234 mArchiveDialog->raise(); 233 mArchiveDialog->raise();
235 234
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp
index 7c4c382..c0e7bdd 100644
--- a/korganizer/koeditordetails.cpp
+++ b/korganizer/koeditordetails.cpp
@@ -1,240 +1,239 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
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 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 <qfiledialog.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qapp.h> 32#include <qapp.h>
33 33
34#include <klocale.h> 34#include <klocale.h>
35#include <kglobal.h> 35#include <kglobal.h>
36#include <kiconloader.h> 36#include <kiconloader.h>
37#include <kstandarddirs.h> 37#include <kstandarddirs.h>
38#include <kmessagebox.h> 38#include <kmessagebox.h>
39#ifndef KORG_NOKABC 39#ifndef KORG_NOKABC
40#include <kabc/addresseedialog.h> 40#include <kabc/addresseedialog.h>
41#endif 41#endif
42 42
43#include <libkcal/incidence.h> 43#include <libkcal/incidence.h>
44 44
45#include "koprefs.h" 45#include "koprefs.h"
46 46
47#include "koeditordetails.h" 47#include "koeditordetails.h"
48#include "koeditordetails.moc"
49 48
50template <> 49template <>
51CustomListViewItem<class Attendee *>::~CustomListViewItem() 50CustomListViewItem<class Attendee *>::~CustomListViewItem()
52{ 51{
53 delete mData; 52 delete mData;
54} 53}
55 54
56template <> 55template <>
57void CustomListViewItem<class Attendee *>::updateItem() 56void CustomListViewItem<class Attendee *>::updateItem()
58{ 57{
59 setText(0,mData->name()); 58 setText(0,mData->name());
60 setText(1,mData->email()); 59 setText(1,mData->email());
61 setText(2,mData->roleStr()); 60 setText(2,mData->roleStr());
62 setText(3,mData->statusStr()); 61 setText(3,mData->statusStr());
63 if (mData->RSVP() && !mData->email().isEmpty()) 62 if (mData->RSVP() && !mData->email().isEmpty())
64 setPixmap(4,SmallIcon("mailappt")); 63 setPixmap(4,SmallIcon("mailappt"));
65 else 64 else
66 setPixmap(4,SmallIcon("nomailappt")); 65 setPixmap(4,SmallIcon("nomailappt"));
67} 66}
68 67
69 68
70KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) 69KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name)
71 : QWidget( parent, name), mDisableItemUpdate( false ) 70 : QWidget( parent, name), mDisableItemUpdate( false )
72{ 71{
73 QGridLayout *topLayout = new QGridLayout(this); 72 QGridLayout *topLayout = new QGridLayout(this);
74 topLayout->setSpacing(spacing); 73 topLayout->setSpacing(spacing);
75 74
76 QString organizer = KOPrefs::instance()->email(); 75 QString organizer = KOPrefs::instance()->email();
77 mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); 76 mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this);
78 77
79 mListView = new KListView(this,"mListView"); 78 mListView = new KListView(this,"mListView");
80 mListView->addColumn(i18n("Name"),180); 79 mListView->addColumn(i18n("Name"),180);
81 mListView->addColumn(i18n("Email"),180); 80 mListView->addColumn(i18n("Email"),180);
82 mListView->addColumn(i18n("Role"),60); 81 mListView->addColumn(i18n("Role"),60);
83 mListView->addColumn(i18n("Status"),100); 82 mListView->addColumn(i18n("Status"),100);
84 mListView->addColumn(i18n("RSVP"),35); 83 mListView->addColumn(i18n("RSVP"),35);
85 if ( KOPrefs::instance()->mCompactDialogs ) { 84 if ( KOPrefs::instance()->mCompactDialogs ) {
86 //mListView->setFixedHeight(78); 85 //mListView->setFixedHeight(78);
87 } 86 }
88 87
89 connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), 88 connect(mListView,SIGNAL(selectionChanged(QListViewItem *)),
90 SLOT(updateAttendeeInput())); 89 SLOT(updateAttendeeInput()));
91 90
92 QLabel *attendeeLabel = new QLabel(this); 91 QLabel *attendeeLabel = new QLabel(this);
93 attendeeLabel->setText(i18n("Name:")); 92 attendeeLabel->setText(i18n("Name:"));
94 attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); 93 attendeeLabel->setFixedSize( attendeeLabel->sizeHint() );
95 mNameEdit = new QLineEdit(this); 94 mNameEdit = new QLineEdit(this);
96 connect(mNameEdit,SIGNAL(textChanged(const QString &)), 95 connect(mNameEdit,SIGNAL(textChanged(const QString &)),
97 SLOT(updateAttendeeItem())); 96 SLOT(updateAttendeeItem()));
98 97
99 mUidEdit = new QLineEdit(0); 98 mUidEdit = new QLineEdit(0);
100 mUidEdit->setText(""); 99 mUidEdit->setText("");
101 100
102 QLabel *emailLabel = new QLabel(this); 101 QLabel *emailLabel = new QLabel(this);
103 emailLabel->setText(i18n("Email:")); 102 emailLabel->setText(i18n("Email:"));
104 mEmailEdit = new QLineEdit(this); 103 mEmailEdit = new QLineEdit(this);
105 connect(mEmailEdit,SIGNAL(textChanged(const QString &)), 104 connect(mEmailEdit,SIGNAL(textChanged(const QString &)),
106 SLOT(updateAttendeeItem())); 105 SLOT(updateAttendeeItem()));
107 106
108 QLabel *attendeeRoleLabel = new QLabel(this); 107 QLabel *attendeeRoleLabel = new QLabel(this);
109 attendeeRoleLabel->setText(i18n("Role:")); 108 attendeeRoleLabel->setText(i18n("Role:"));
110 mRoleCombo = new QComboBox(false,this); 109 mRoleCombo = new QComboBox(false,this);
111 mRoleCombo->insertStringList(Attendee::roleList()); 110 mRoleCombo->insertStringList(Attendee::roleList());
112 connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); 111 connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
113 112
114 QLabel *statusLabel = new QLabel(this); 113 QLabel *statusLabel = new QLabel(this);
115 statusLabel->setText( i18n("Status:") ); 114 statusLabel->setText( i18n("Status:") );
116 115
117 mStatusCombo = new QComboBox(false,this); 116 mStatusCombo = new QComboBox(false,this);
118 mStatusCombo->insertStringList(Attendee::statusList()); 117 mStatusCombo->insertStringList(Attendee::statusList());
119 connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); 118 connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
120 119
121 mRsvpButton = new QCheckBox(this); 120 mRsvpButton = new QCheckBox(this);
122 mRsvpButton->setText(i18n("Request response")); 121 mRsvpButton->setText(i18n("Request response"));
123 connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); 122 connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem()));
124 QWidget *buttonBox = new QWidget(this); 123 QWidget *buttonBox = new QWidget(this);
125 QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); 124 QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox);
126 125
127 QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); 126 QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox);
128 buttonLayout->addWidget(newButton); 127 buttonLayout->addWidget(newButton);
129 connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); 128 connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee()));
130 129
131 mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); 130 mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox);
132 buttonLayout->addWidget(mRemoveButton); 131 buttonLayout->addWidget(mRemoveButton);
133 connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); 132 connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee()));
134 133
135 mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); 134 mAddressBookButton = new QPushButton(i18n("Address &Book..."),this);
136 // buttonLayout->addWidget(mAddressBookButton); 135 // buttonLayout->addWidget(mAddressBookButton);
137 connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); 136 connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook()));
138 //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); 137 //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () );
139 138
140 if (qApp->desktop()->width() < 300 ) { 139 if (qApp->desktop()->width() < 300 ) {
141 mListView->setFixedHeight(80); 140 mListView->setFixedHeight(80);
142 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); 141 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3);
143 topLayout->addMultiCellWidget(mListView,1,1,0,3); 142 topLayout->addMultiCellWidget(mListView,1,1,0,3);
144 topLayout->addWidget(attendeeLabel,3,0); 143 topLayout->addWidget(attendeeLabel,3,0);
145 topLayout->addMultiCellWidget(mNameEdit,3,3,1,2); 144 topLayout->addMultiCellWidget(mNameEdit,3,3,1,2);
146 topLayout->addWidget(emailLabel,4,0); 145 topLayout->addWidget(emailLabel,4,0);
147 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2); 146 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2);
148 topLayout->addWidget(attendeeRoleLabel,5,0); 147 topLayout->addWidget(attendeeRoleLabel,5,0);
149 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); 148 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2);
150 topLayout->addWidget(statusLabel,6,0); 149 topLayout->addWidget(statusLabel,6,0);
151 topLayout->addMultiCellWidget(mStatusCombo,6,6,1,2); 150 topLayout->addMultiCellWidget(mStatusCombo,6,6,1,2);
152 topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3); 151 topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3);
153 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); 152 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1);
154 topLayout->addMultiCellWidget(buttonBox,3,4,3,3); 153 topLayout->addMultiCellWidget(buttonBox,3,4,3,3);
155 topLayout->setRowStretch(1,2); 154 topLayout->setRowStretch(1,2);
156 topLayout->setColStretch(0,0); 155 topLayout->setColStretch(0,0);
157 topLayout->setColStretch(1,2); 156 topLayout->setColStretch(1,2);
158 topLayout->setColStretch(2,1); 157 topLayout->setColStretch(2,1);
159 topLayout->setColStretch(3,1); 158 topLayout->setColStretch(3,1);
160 159
161 } else { 160 } else {
162 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); 161 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5);
163 topLayout->addMultiCellWidget(mListView,1,1,0,5); 162 topLayout->addMultiCellWidget(mListView,1,1,0,5);
164 topLayout->addWidget(attendeeLabel,3,0); 163 topLayout->addWidget(attendeeLabel,3,0);
165 topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); 164 topLayout->addMultiCellWidget(mNameEdit,3,3,1,4);
166 topLayout->addWidget(emailLabel,4,0); 165 topLayout->addWidget(emailLabel,4,0);
167 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); 166 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4);
168 topLayout->addWidget(attendeeRoleLabel,5,0); 167 topLayout->addWidget(attendeeRoleLabel,5,0);
169 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); 168 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2);
170 topLayout->addWidget(statusLabel,5,3); 169 topLayout->addWidget(statusLabel,5,3);
171 topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); 170 topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5);
172 topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5); 171 topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5);
173 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); 172 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1);
174 topLayout->addMultiCellWidget(buttonBox,3,4,5,5); 173 topLayout->addMultiCellWidget(buttonBox,3,4,5,5);
175 topLayout->setRowStretch(1,5); 174 topLayout->setRowStretch(1,5);
176 topLayout->setColStretch(0,0); 175 topLayout->setColStretch(0,0);
177 } 176 }
178// #if 0 177// #if 0
179// topLayout->setColStretch(2,1); 178// topLayout->setColStretch(2,1);
180// topLayout->addWidget(statusLabel,3,3); 179// topLayout->addWidget(statusLabel,3,3);
181// topLayout->addWidget(mStatusCombo,3,4); 180// topLayout->addWidget(mStatusCombo,3,4);
182// #else 181// #else
183// topLayout->addWidget(statusLabel,4,3); 182// topLayout->addWidget(statusLabel,4,3);
184// // topLayout->addWidget(mStatusCombo,4,3); 183// // topLayout->addWidget(mStatusCombo,4,3);
185// topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); 184// topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5);
186 185
187// #endif 186// #endif
188// // topLayout->setRowStretch(5,1); 187// // topLayout->setRowStretch(5,1);
189// topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); 188// topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1);
190// topLayout->addMultiCellWidget(buttonBox,2,3,5,5); 189// topLayout->addMultiCellWidget(buttonBox,2,3,5,5);
191// topLayout->setRowStretch(1,5); 190// topLayout->setRowStretch(1,5);
192// topLayout->setColStretch(0,0); 191// topLayout->setColStretch(0,0);
193 192
194#ifdef KORG_NOKABC 193#ifdef KORG_NOKABC
195 mAddressBookButton->hide(); 194 mAddressBookButton->hide();
196#endif 195#endif
197 196
198 updateAttendeeInput(); 197 updateAttendeeInput();
199} 198}
200 199
201KOEditorDetails::~KOEditorDetails() 200KOEditorDetails::~KOEditorDetails()
202{ 201{
203} 202}
204 203
205void KOEditorDetails::removeAttendee() 204void KOEditorDetails::removeAttendee()
206{ 205{
207 AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem(); 206 AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem();
208 if (!aItem) return; 207 if (!aItem) return;
209 208
210 Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(), 209 Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(),
211 aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(), 210 aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(),
212 aItem->data()->uid()); 211 aItem->data()->uid());
213 mdelAttendees.append(delA); 212 mdelAttendees.append(delA);
214 213
215 delete aItem; 214 delete aItem;
216 215
217 updateAttendeeInput(); 216 updateAttendeeInput();
218} 217}
219 218
220 219
221void KOEditorDetails::openAddressBook() 220void KOEditorDetails::openAddressBook()
222{ 221{
223#ifndef KORG_NOKABC 222#ifndef KORG_NOKABC
224 223
225 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 224 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
226 uint i=0; 225 uint i=0;
227 for (i=0; i < list.count(); i++) { 226 for (i=0; i < list.count(); i++) {
228 insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); 227 insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) );
229 } 228 }
230 229
231#if 0 230#if 0
232 KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); 231 KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this);
233 if (!a.isEmpty()) { 232 if (!a.isEmpty()) {
234 insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); 233 insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) );
235 } 234 }
236#endif 235#endif
237#endif 236#endif
238} 237}
239 238
240 239
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index ad1389f..94e1f4c 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -1,245 +1,244 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
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 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 <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qfile.h> 32#include <qfile.h>
33 33
34 34
35#include <kglobal.h> 35#include <kglobal.h>
36#include <kdebug.h> 36#include <kdebug.h>
37#include <klocale.h> 37#include <klocale.h>
38#include <kiconloader.h> 38#include <kiconloader.h>
39#include <kmessagebox.h> 39#include <kmessagebox.h>
40#include <kfiledialog.h> 40#include <kfiledialog.h>
41#include <kstandarddirs.h> 41#include <kstandarddirs.h>
42 42
43#include <libkcal/todo.h> 43#include <libkcal/todo.h>
44#include <libkcal/event.h> 44#include <libkcal/event.h>
45#include <libkdepim/categoryselectdialog.h> 45#include <libkdepim/categoryselectdialog.h>
46#include <libkdepim/kdateedit.h> 46#include <libkdepim/kdateedit.h>
47 47
48#include "koprefs.h" 48#include "koprefs.h"
49#include "koglobals.h" 49#include "koglobals.h"
50 50
51#include "koeditorgeneral.h" 51#include "koeditorgeneral.h"
52#include "kolocationbox.h" 52#include "kolocationbox.h"
53#include "koeditorgeneral.moc"
54#ifndef DESKTOP_VERSION 53#ifndef DESKTOP_VERSION
55#include <qpe/qpeapplication.h> 54#include <qpe/qpeapplication.h>
56#else 55#else
57#include <qapplication.h> 56#include <qapplication.h>
58#endif 57#endif
59 58
60KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : 59KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
61 QObject( parent, name) 60 QObject( parent, name)
62{ 61{
63} 62}
64 63
65KOEditorGeneral::~KOEditorGeneral() 64KOEditorGeneral::~KOEditorGeneral()
66{ 65{
67} 66}
68 67
69void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 68void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
70{ 69{
71 QGridLayout *headerLayout = new QGridLayout(topLayout); 70 QGridLayout *headerLayout = new QGridLayout(topLayout);
72 71
73#if 0 72#if 0
74 mOwnerLabel = new QLabel(i18n("Owner:"),parent); 73 mOwnerLabel = new QLabel(i18n("Owner:"),parent);
75 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); 74 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
76#endif 75#endif
77 76
78 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 77 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
79 headerLayout->addWidget(summaryLabel,1,0); 78 headerLayout->addWidget(summaryLabel,1,0);
80 79
81 mSummaryEdit = new KOLocationBox(TRUE,parent, 10); 80 mSummaryEdit = new KOLocationBox(TRUE,parent, 10);
82 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 81 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
83 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 82 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
84 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 83 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
85 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 84 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
86 if ( QApplication::desktop()->width() > 320 ) 85 if ( QApplication::desktop()->width() > 320 )
87 mSummaryEdit->setMaximumHeight( hei +6 ); 86 mSummaryEdit->setMaximumHeight( hei +6 );
88 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); 87 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
89 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } 88 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
90 // mSummaryEdit = new QLineEdit(parent); 89 // mSummaryEdit = new QLineEdit(parent);
91 headerLayout->addWidget(mSummaryEdit,1,1); 90 headerLayout->addWidget(mSummaryEdit,1,1);
92 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 91 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
93 92
94 QLabel *locationLabel = new QLabel(i18n("Location:"),parent); 93 QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
95 headerLayout->addWidget(locationLabel,2,0); 94 headerLayout->addWidget(locationLabel,2,0);
96 95
97 mLocationEdit = new KOLocationBox(TRUE,parent,10); 96 mLocationEdit = new KOLocationBox(TRUE,parent,10);
98 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 97 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
99 if ( QApplication::desktop()->width() > 320 ) 98 if ( QApplication::desktop()->width() > 320 )
100 mLocationEdit->setMaximumHeight( hei + 6); 99 mLocationEdit->setMaximumHeight( hei + 6);
101 100
102 // mLocationEdit = new QLineEdit(parent); 101 // mLocationEdit = new QLineEdit(parent);
103 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 102 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
104 headerLayout->addWidget(mLocationEdit,2,1); 103 headerLayout->addWidget(mLocationEdit,2,1);
105 headerLayout->setColStretch( 1, 10); 104 headerLayout->setColStretch( 1, 10);
106} 105}
107void KOEditorGeneral::setFocusOn( int i ) 106void KOEditorGeneral::setFocusOn( int i )
108{ 107{
109 qApp->processEvents(); 108 qApp->processEvents();
110 if ( i == 1 ) { 109 if ( i == 1 ) {
111 mDescriptionEdit->setFocus(); 110 mDescriptionEdit->setFocus();
112 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 111 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
113 } 112 }
114 if ( i == 2 ) { 113 if ( i == 2 ) {
115 mSummaryEdit->setFocus(); 114 mSummaryEdit->setFocus();
116 } 115 }
117 116
118} 117}
119void KOEditorGeneral::editCategories() 118void KOEditorGeneral::editCategories()
120{ 119{
121 // qDebug("KOEditorGeneral::editCategories() "); 120 // qDebug("KOEditorGeneral::editCategories() ");
122 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 121 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
123 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 122 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
124 //KOGlobals::fitDialogToScreen( csd ); 123 //KOGlobals::fitDialogToScreen( csd );
125 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 124 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
126 csd->exec(); 125 csd->exec();
127 delete csd; 126 delete csd;
128} 127}
129void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 128void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
130{ 129{
131 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 130 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
132 131
133 mCategoriesButton = new QPushButton(parent); 132 mCategoriesButton = new QPushButton(parent);
134 mCategoriesButton->setText(i18n("Categories...")); 133 mCategoriesButton->setText(i18n("Categories..."));
135 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 134 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
136 categoriesLayout->addWidget(mCategoriesButton); 135 categoriesLayout->addWidget(mCategoriesButton);
137 136
138 mCategoriesLabel = new QLabel(parent); 137 mCategoriesLabel = new QLabel(parent);
139 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 138 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
140 categoriesLayout->addWidget(mCategoriesLabel,1); 139 categoriesLayout->addWidget(mCategoriesLabel,1);
141} 140}
142 141
143void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 142void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
144{ 143{
145 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 144 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
146 145
147 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 146 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
148 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 147 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
149 secrecyLayout->addWidget(mCancelBox); 148 secrecyLayout->addWidget(mCancelBox);
150 secrecyLayout->addWidget(secrecyLabel); 149 secrecyLayout->addWidget(secrecyLabel);
151 150
152 mSecrecyCombo = new QComboBox(parent); 151 mSecrecyCombo = new QComboBox(parent);
153 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 152 mSecrecyCombo->insertStringList(Incidence::secrecyList());
154 secrecyLayout->addWidget(mSecrecyCombo); 153 secrecyLayout->addWidget(mSecrecyCombo);
155} 154}
156 155
157void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) 156void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
158{ 157{
159 mDescriptionEdit = new KTextEdit(parent); 158 mDescriptionEdit = new KTextEdit(parent);
160 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); 159 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
161 mDescriptionEdit->append(""); 160 mDescriptionEdit->append("");
162 mDescriptionEdit->setReadOnly(false); 161 mDescriptionEdit->setReadOnly(false);
163 mDescriptionEdit->setOverwriteMode(false); 162 mDescriptionEdit->setOverwriteMode(false);
164 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); 163 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
165 topLayout->addWidget(mDescriptionEdit); 164 topLayout->addWidget(mDescriptionEdit);
166#ifndef DESKTOP_VERSION 165#ifndef DESKTOP_VERSION
167 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); 166 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
168#endif 167#endif
169 168
170} 169}
171 170
172void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) 171void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
173{ 172{
174 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); 173 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout);
175 174
176 //mAlarmBell = new QLabel(parent); 175 //mAlarmBell = new QLabel(parent);
177 //mAlarmBell->setPixmap(SmallIcon("bell")); 176 //mAlarmBell->setPixmap(SmallIcon("bell"));
178 //alarmLayout->addWidget(mAlarmBell); 177 //alarmLayout->addWidget(mAlarmBell);
179 if ( QApplication::desktop()->width() < 320 ) 178 if ( QApplication::desktop()->width() < 320 )
180 mAlarmButton = new QCheckBox(i18n("Rem."),parent); 179 mAlarmButton = new QCheckBox(i18n("Rem."),parent);
181 else 180 else
182 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); 181 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent);
183 182
184 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); 183 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool)));
185 alarmLayout->addWidget(mAlarmButton); 184 alarmLayout->addWidget(mAlarmButton);
186 185
187 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 186 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
188 alarmLayout->addWidget(mAlarmTimeEdit); 187 alarmLayout->addWidget(mAlarmTimeEdit);
189 mAlarmIncrCombo = new QComboBox(false, parent); 188 mAlarmIncrCombo = new QComboBox(false, parent);
190 if ( QApplication::desktop()->width() < 320 ) { 189 if ( QApplication::desktop()->width() < 320 ) {
191 mAlarmIncrCombo->insertItem(i18n("min")); 190 mAlarmIncrCombo->insertItem(i18n("min"));
192 mAlarmIncrCombo->insertItem(i18n("hou")); 191 mAlarmIncrCombo->insertItem(i18n("hou"));
193 mAlarmIncrCombo->insertItem(i18n("day")); 192 mAlarmIncrCombo->insertItem(i18n("day"));
194 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); 193 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() );
195 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); 194 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() );
196 } else { 195 } else {
197 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 196 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
198 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 197 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
199 mAlarmIncrCombo->insertItem(i18n("day(s)")); 198 mAlarmIncrCombo->insertItem(i18n("day(s)"));
200 } 199 }
201 200
202 // mAlarmIncrCombo->setMinimumHeight(20); 201 // mAlarmIncrCombo->setMinimumHeight(20);
203 alarmLayout->addWidget(mAlarmIncrCombo); 202 alarmLayout->addWidget(mAlarmIncrCombo);
204 mAlarmSoundButton = new QPushButton(parent); 203 mAlarmSoundButton = new QPushButton(parent);
205 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 204 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
206 mAlarmSoundButton->setToggleButton(true); 205 mAlarmSoundButton->setToggleButton(true);
207 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 206 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
208 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 207 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
209 alarmLayout->addWidget(mAlarmSoundButton); 208 alarmLayout->addWidget(mAlarmSoundButton);
210 209
211 mAlarmProgramButton = new QPushButton(parent); 210 mAlarmProgramButton = new QPushButton(parent);
212 mAlarmProgramButton->setPixmap(SmallIcon("run")); 211 mAlarmProgramButton->setPixmap(SmallIcon("run"));
213 mAlarmProgramButton->setToggleButton(true); 212 mAlarmProgramButton->setToggleButton(true);
214 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 213 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
215 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 214 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
216 alarmLayout->addWidget(mAlarmProgramButton); 215 alarmLayout->addWidget(mAlarmProgramButton);
217 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 216 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
218 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); 217 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
219 // if ( KOPrefs::instance()->mCompactDialogs ) { 218 // if ( KOPrefs::instance()->mCompactDialogs ) {
220 // mAlarmSoundButton->hide(); 219 // mAlarmSoundButton->hide();
221 // mAlarmProgramButton->hide(); 220 // mAlarmProgramButton->hide();
222 // } 221 // }
223} 222}
224 223
225void KOEditorGeneral::pickAlarmSound() 224void KOEditorGeneral::pickAlarmSound()
226{ 225{
227 226
228 //QString prefix = mAlarmSound; 227 //QString prefix = mAlarmSound;
229 if (!mAlarmSoundButton->isOn()) { 228 if (!mAlarmSoundButton->isOn()) {
230 //mAlarmSound = ""; 229 //mAlarmSound = "";
231 QToolTip::remove(mAlarmSoundButton); 230 QToolTip::remove(mAlarmSoundButton);
232 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 231 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
233 mAlarmProgramButton->setOn(true); 232 mAlarmProgramButton->setOn(true);
234 mAlarmSoundButton->setOn(false); 233 mAlarmSoundButton->setOn(false);
235 } else { 234 } else {
236 QString fileName(KFileDialog::getOpenFileName(mAlarmSound, 235 QString fileName(KFileDialog::getOpenFileName(mAlarmSound,
237 i18n("*.wav|Wav Files"), 0)); 236 i18n("*.wav|Wav Files"), 0));
238 if (!fileName.isEmpty()) { 237 if (!fileName.isEmpty()) {
239 mAlarmSound = fileName; 238 mAlarmSound = fileName;
240 QToolTip::remove(mAlarmSoundButton); 239 QToolTip::remove(mAlarmSoundButton);
241 QString dispStr = i18n("Playing '%1'").arg(fileName); 240 QString dispStr = i18n("Playing '%1'").arg(fileName);
242 QToolTip::add(mAlarmSoundButton, dispStr); 241 QToolTip::add(mAlarmSoundButton, dispStr);
243 mAlarmProgramButton->setOn(false); 242 mAlarmProgramButton->setOn(false);
244 mAlarmSoundButton->setOn(true); 243 mAlarmSoundButton->setOn(true);
245 } else { 244 } else {
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp
index 9b93e7e..42c3df1 100644
--- a/korganizer/koeditorgeneralevent.cpp
+++ b/korganizer/koeditorgeneralevent.cpp
@@ -1,240 +1,239 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
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 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 <qvbox.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.h>
28#include <qvgroupbox.h> 28#include <qvgroupbox.h>
29#include <qwidgetstack.h> 29#include <qwidgetstack.h>
30#include <qdatetime.h> 30#include <qdatetime.h>
31 31
32#include <kdebug.h> 32#include <kdebug.h>
33#include <kglobal.h> 33#include <kglobal.h>
34#include <klocale.h> 34#include <klocale.h>
35#include <kiconloader.h> 35#include <kiconloader.h>
36#include <kmessagebox.h> 36#include <kmessagebox.h>
37#include <kfiledialog.h> 37#include <kfiledialog.h>
38#include <kstandarddirs.h> 38#include <kstandarddirs.h>
39 39
40#include <libkcal/event.h> 40#include <libkcal/event.h>
41 41
42#include <libkdepim/kdateedit.h> 42#include <libkdepim/kdateedit.h>
43 43
44#include "koprefs.h" 44#include "koprefs.h"
45 45
46#include "koeditorgeneralevent.h" 46#include "koeditorgeneralevent.h"
47#include "kolocationbox.h" 47#include "kolocationbox.h"
48#include "koeditorgeneralevent.moc"
49 48
50KOEditorGeneralEvent::KOEditorGeneralEvent(QObject* parent, 49KOEditorGeneralEvent::KOEditorGeneralEvent(QObject* parent,
51 const char* name) : 50 const char* name) :
52 KOEditorGeneral( parent, name) 51 KOEditorGeneral( parent, name)
53{ 52{
54 connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), 53 connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
55 SLOT(setDuration())); 54 SLOT(setDuration()));
56 connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), 55 connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
57 SLOT(emitDateTimeStr())); 56 SLOT(emitDateTimeStr()));
58} 57}
59 58
60KOEditorGeneralEvent::~KOEditorGeneralEvent() 59KOEditorGeneralEvent::~KOEditorGeneralEvent()
61{ 60{
62} 61}
63 62
64void KOEditorGeneralEvent::finishSetup() 63void KOEditorGeneralEvent::finishSetup()
65{ 64{
66 65
67 //disabled 66 //disabled
68// QWidget::setTabOrder( mSummaryEdit, mLocationEdit ); 67// QWidget::setTabOrder( mSummaryEdit, mLocationEdit );
69// QWidget::setTabOrder( mLocationEdit, mStartDateEdit ); 68// QWidget::setTabOrder( mLocationEdit, mStartDateEdit );
70// QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit ); 69// QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit );
71// QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit ); 70// QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit );
72// QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit ); 71// QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit );
73// QWidget::setTabOrder( mEndTimeEdit, mNoTimeButton ); 72// QWidget::setTabOrder( mEndTimeEdit, mNoTimeButton );
74// QWidget::setTabOrder( mNoTimeButton, mAlarmButton ); 73// QWidget::setTabOrder( mNoTimeButton, mAlarmButton );
75// QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit ); 74// QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit );
76// QWidget::setTabOrder( mFreeTimeCombo, mCategoriesButton ); 75// QWidget::setTabOrder( mFreeTimeCombo, mCategoriesButton );
77// QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo ); 76// QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo );
78// QWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit ); 77// QWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit );
79 78
80 79
81 80
82 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); 81 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT);
83 mSummaryEdit->setFocus(); 82 mSummaryEdit->setFocus();
84} 83}
85 84
86void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout) 85void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout)
87{ 86{
88 QBoxLayout *timeLayout = new QVBoxLayout(topLayout); 87 QBoxLayout *timeLayout = new QVBoxLayout(topLayout);
89 88
90 QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, 89 QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal,
91 i18n("Date && Time"),parent); 90 i18n("Date && Time"),parent);
92 timeLayout->addWidget(timeGroupBox); 91 timeLayout->addWidget(timeGroupBox);
93 92
94 timeGroupBox->layout()->setSpacing( 0 ); 93 timeGroupBox->layout()->setSpacing( 0 );
95 timeGroupBox->layout()->setMargin( 5 ); 94 timeGroupBox->layout()->setMargin( 5 );
96 QFrame *timeBoxFrame = new QFrame(timeGroupBox); 95 QFrame *timeBoxFrame = new QFrame(timeGroupBox);
97 96
98 QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,2,3); 97 QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,2,3);
99 layoutTimeBox->setSpacing(topLayout->spacing()); 98 layoutTimeBox->setSpacing(topLayout->spacing());
100 99
101 mStartDateLabel = new QLabel(i18n("Start:"),timeBoxFrame); 100 mStartDateLabel = new QLabel(i18n("Start:"),timeBoxFrame);
102 layoutTimeBox->addWidget(mStartDateLabel,0,0); 101 layoutTimeBox->addWidget(mStartDateLabel,0,0);
103 102
104 mStartDateEdit = new KDateEdit(timeBoxFrame); 103 mStartDateEdit = new KDateEdit(timeBoxFrame);
105 layoutTimeBox->addWidget(mStartDateEdit,0,1); 104 layoutTimeBox->addWidget(mStartDateEdit,0,1);
106 105
107 mStartTimeEdit = new KOTimeEdit(timeBoxFrame); 106 mStartTimeEdit = new KOTimeEdit(timeBoxFrame);
108 layoutTimeBox->addWidget(mStartTimeEdit,0,2); 107 layoutTimeBox->addWidget(mStartTimeEdit,0,2);
109 108
110 109
111 mEndDateLabel = new QLabel(i18n("End:"),timeBoxFrame); 110 mEndDateLabel = new QLabel(i18n("End:"),timeBoxFrame);
112 layoutTimeBox->addWidget(mEndDateLabel,1,0); 111 layoutTimeBox->addWidget(mEndDateLabel,1,0);
113 112
114 mEndDateEdit = new KDateEdit(timeBoxFrame); 113 mEndDateEdit = new KDateEdit(timeBoxFrame);
115 layoutTimeBox->addWidget(mEndDateEdit,1,1); 114 layoutTimeBox->addWidget(mEndDateEdit,1,1);
116 115
117 mEndTimeEdit = new KOTimeEdit(timeBoxFrame); 116 mEndTimeEdit = new KOTimeEdit(timeBoxFrame);
118 layoutTimeBox->addWidget(mEndTimeEdit,1,2); 117 layoutTimeBox->addWidget(mEndTimeEdit,1,2);
119 QWidget* duration = new QWidget( timeBoxFrame ); 118 QWidget* duration = new QWidget( timeBoxFrame );
120 QHBoxLayout *flagsBox = new QHBoxLayout( duration ); 119 QHBoxLayout *flagsBox = new QHBoxLayout( duration );
121 mNoTimeButton = new QCheckBox(i18n("Allday"),duration); 120 mNoTimeButton = new QCheckBox(i18n("Allday"),duration);
122 flagsBox->addWidget(mNoTimeButton); 121 flagsBox->addWidget(mNoTimeButton);
123 connect(mNoTimeButton, SIGNAL(toggled(bool)),SLOT(dontAssociateTime(bool))); 122 connect(mNoTimeButton, SIGNAL(toggled(bool)),SLOT(dontAssociateTime(bool)));
124 mDurationLabel = new QLabel( duration ); 123 mDurationLabel = new QLabel( duration );
125 // if ( KOPrefs::instance()->mCompactDialogs ) { 124 // if ( KOPrefs::instance()->mCompactDialogs ) {
126 //layoutTimeBox->addMultiCellWidget( mDurationLabel, 3, 3, 0, 3 ); 125 //layoutTimeBox->addMultiCellWidget( mDurationLabel, 3, 3, 0, 3 );
127 //} else { 126 //} else {
128 flagsBox->addWidget( mDurationLabel ); 127 flagsBox->addWidget( mDurationLabel );
129 //} 128 //}
130 flagsBox->setStretchFactor(mDurationLabel, 10 ); 129 flagsBox->setStretchFactor(mDurationLabel, 10 );
131 mDurationLabel->setAlignment( AlignRight | AlignVCenter); 130 mDurationLabel->setAlignment( AlignRight | AlignVCenter);
132 layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 ); 131 layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 );
133 132
134 // time widgets are checked if they contain a valid time 133 // time widgets are checked if they contain a valid time
135 connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)), 134 connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)),
136 this, SLOT(startTimeChanged(QTime))); 135 this, SLOT(startTimeChanged(QTime)));
137 connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)), 136 connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)),
138 this, SLOT(endTimeChanged(QTime))); 137 this, SLOT(endTimeChanged(QTime)));
139 138
140 // date widgets are checked if they contain a valid date 139 // date widgets are checked if they contain a valid date
141 connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), 140 connect(mStartDateEdit, SIGNAL(dateChanged(QDate)),
142 this, SLOT(startDateChanged(QDate))); 141 this, SLOT(startDateChanged(QDate)));
143 connect(mEndDateEdit, SIGNAL(dateChanged(QDate)), 142 connect(mEndDateEdit, SIGNAL(dateChanged(QDate)),
144 this, SLOT(endDateChanged(QDate))); 143 this, SLOT(endDateChanged(QDate)));
145} 144}
146 145
147void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout) 146void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout)
148{ 147{
149 QBoxLayout *classLayout = new QHBoxLayout(topLayout); 148 QBoxLayout *classLayout = new QHBoxLayout(topLayout);
150 149
151 QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent); 150 QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent);
152 classLayout->addWidget(freeTimeLabel); 151 classLayout->addWidget(freeTimeLabel);
153 152
154 mFreeTimeCombo = new QComboBox(false, parent); 153 mFreeTimeCombo = new QComboBox(false, parent);
155 mFreeTimeCombo->insertItem(i18n("Busy")); 154 mFreeTimeCombo->insertItem(i18n("Busy"));
156 mFreeTimeCombo->insertItem(i18n("Free")); 155 mFreeTimeCombo->insertItem(i18n("Free"));
157 classLayout->addWidget(mFreeTimeCombo); 156 classLayout->addWidget(mFreeTimeCombo);
158} 157}
159 158
160void KOEditorGeneralEvent::timeStuffDisable(bool disable) 159void KOEditorGeneralEvent::timeStuffDisable(bool disable)
161{ 160{
162 mStartTimeEdit->setEnabled( !disable ); 161 mStartTimeEdit->setEnabled( !disable );
163 mEndTimeEdit->setEnabled( !disable ); 162 mEndTimeEdit->setEnabled( !disable );
164 163
165 setDuration(); 164 setDuration();
166 emitDateTimeStr(); 165 emitDateTimeStr();
167} 166}
168 167
169void KOEditorGeneralEvent::dontAssociateTime(bool noTime) 168void KOEditorGeneralEvent::dontAssociateTime(bool noTime)
170{ 169{
171 timeStuffDisable(noTime); 170 timeStuffDisable(noTime);
172 //if(alarmButton->isChecked()) alarmStuffDisable(noTime); 171 //if(alarmButton->isChecked()) alarmStuffDisable(noTime);
173 allDayChanged(noTime); 172 allDayChanged(noTime);
174} 173}
175 174
176void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end) 175void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end)
177{ 176{
178// kdDebug() << "KOEditorGeneralEvent::setDateTimes(): Start DateTime: " << start.toString() << endl; 177// kdDebug() << "KOEditorGeneralEvent::setDateTimes(): Start DateTime: " << start.toString() << endl;
179 178
180 mStartDateEdit->setDate(start.date()); 179 mStartDateEdit->setDate(start.date());
181 // KTimeEdit seems to emit some signals when setTime() is called. 180 // KTimeEdit seems to emit some signals when setTime() is called.
182 mStartTimeEdit->blockSignals( true ); 181 mStartTimeEdit->blockSignals( true );
183 mStartTimeEdit->setTime(start.time()); 182 mStartTimeEdit->setTime(start.time());
184 mStartTimeEdit->blockSignals( false ); 183 mStartTimeEdit->blockSignals( false );
185 mEndDateEdit->setDate(end.date()); 184 mEndDateEdit->setDate(end.date());
186 mEndTimeEdit->setTime(end.time()); 185 mEndTimeEdit->setTime(end.time());
187 186
188 mCurrStartDateTime = start; 187 mCurrStartDateTime = start;
189 mCurrEndDateTime = end; 188 mCurrEndDateTime = end;
190 189
191 setDuration(); 190 setDuration();
192 emitDateTimeStr(); 191 emitDateTimeStr();
193} 192}
194 193
195void KOEditorGeneralEvent::startTimeChanged(QTime newtime) 194void KOEditorGeneralEvent::startTimeChanged(QTime newtime)
196{ 195{
197 kdDebug() << "KOEditorGeneralEvent::startTimeChanged() " << newtime.toString() << endl; 196 kdDebug() << "KOEditorGeneralEvent::startTimeChanged() " << newtime.toString() << endl;
198 197
199 int secsep = mCurrStartDateTime.secsTo(mCurrEndDateTime); 198 int secsep = mCurrStartDateTime.secsTo(mCurrEndDateTime);
200 199
201 mCurrStartDateTime.setTime(newtime); 200 mCurrStartDateTime.setTime(newtime);
202 201
203 // adjust end time so that the event has the same duration as before. 202 // adjust end time so that the event has the same duration as before.
204 mCurrEndDateTime = mCurrStartDateTime.addSecs(secsep); 203 mCurrEndDateTime = mCurrStartDateTime.addSecs(secsep);
205 mEndTimeEdit->setTime(mCurrEndDateTime.time()); 204 mEndTimeEdit->setTime(mCurrEndDateTime.time());
206 mEndDateEdit->setDate(mCurrEndDateTime.date()); 205 mEndDateEdit->setDate(mCurrEndDateTime.date());
207 206
208 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); 207 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
209} 208}
210 209
211void KOEditorGeneralEvent::endTimeChanged(QTime newtime) 210void KOEditorGeneralEvent::endTimeChanged(QTime newtime)
212{ 211{
213// kdDebug() << "KOEditorGeneralEvent::endTimeChanged " << newtime.toString() << endl; 212// kdDebug() << "KOEditorGeneralEvent::endTimeChanged " << newtime.toString() << endl;
214 213
215 QDateTime newdt(mCurrEndDateTime.date(), newtime); 214 QDateTime newdt(mCurrEndDateTime.date(), newtime);
216 mCurrEndDateTime = newdt; 215 mCurrEndDateTime = newdt;
217 216
218 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); 217 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
219} 218}
220 219
221void KOEditorGeneralEvent::startDateChanged(QDate newdate) 220void KOEditorGeneralEvent::startDateChanged(QDate newdate)
222{ 221{
223 int daysep = mCurrStartDateTime.daysTo(mCurrEndDateTime); 222 int daysep = mCurrStartDateTime.daysTo(mCurrEndDateTime);
224 223
225 mCurrStartDateTime.setDate(newdate); 224 mCurrStartDateTime.setDate(newdate);
226 225
227 // adjust end date so that the event has the same duration as before 226 // adjust end date so that the event has the same duration as before
228 mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep)); 227 mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep));
229 mEndDateEdit->setDate(mCurrEndDateTime.date()); 228 mEndDateEdit->setDate(mCurrEndDateTime.date());
230 229
231 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); 230 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
232} 231}
233 232
234void KOEditorGeneralEvent::endDateChanged(QDate newdate) 233void KOEditorGeneralEvent::endDateChanged(QDate newdate)
235{ 234{
236 QDateTime newdt(newdate, mCurrEndDateTime.time()); 235 QDateTime newdt(newdate, mCurrEndDateTime.time());
237 236
238 if(newdt < mCurrStartDateTime) { 237 if(newdt < mCurrStartDateTime) {
239 // oops, we can't let that happen. 238 // oops, we can't let that happen.
240 newdt = mCurrStartDateTime; 239 newdt = mCurrStartDateTime;
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index 57837bb..7db7da0 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -1,243 +1,242 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
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 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 <qfiledialog.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32 32
33#include <kglobal.h> 33#include <kglobal.h>
34#include <klocale.h> 34#include <klocale.h>
35#include <kiconloader.h> 35#include <kiconloader.h>
36#include <kmessagebox.h> 36#include <kmessagebox.h>
37#include <kdebug.h> 37#include <kdebug.h>
38#include <krestrictedline.h> 38#include <krestrictedline.h>
39#include <kstandarddirs.h> 39#include <kstandarddirs.h>
40#include <kfiledialog.h> 40#include <kfiledialog.h>
41 41
42#include <libkcal/todo.h> 42#include <libkcal/todo.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 "ktimeedit.h" 47#include "ktimeedit.h"
48 48
49#include "koeditorgeneraltodo.h" 49#include "koeditorgeneraltodo.h"
50#include "kolocationbox.h" 50#include "kolocationbox.h"
51#include "koeditorgeneraltodo.moc"
52 51
53KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, 52KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent,
54 const char* name) 53 const char* name)
55 : KOEditorGeneral( parent, name) 54 : KOEditorGeneral( parent, name)
56{ 55{
57} 56}
58 57
59KOEditorGeneralTodo::~KOEditorGeneralTodo() 58KOEditorGeneralTodo::~KOEditorGeneralTodo()
60{ 59{
61} 60}
62 61
63void KOEditorGeneralTodo::finishSetup() 62void KOEditorGeneralTodo::finishSetup()
64{ 63{
65 64
66// QWidget::setTabOrder(mSummaryEdit, mLocationEdit); 65// QWidget::setTabOrder(mSummaryEdit, mLocationEdit);
67// QWidget::setTabOrder(mLocationEdit, mDueCheck); 66// QWidget::setTabOrder(mLocationEdit, mDueCheck);
68// QWidget::setTabOrder(mDueCheck, mDueDateEdit); 67// QWidget::setTabOrder(mDueCheck, mDueDateEdit);
69// QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); 68// QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit);
70// QWidget::setTabOrder(mDueTimeEdit, mStartCheck); 69// QWidget::setTabOrder(mDueTimeEdit, mStartCheck);
71// QWidget::setTabOrder(mStartCheck, mStartDateEdit); 70// QWidget::setTabOrder(mStartCheck, mStartDateEdit);
72// QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); 71// QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit);
73// QWidget::setTabOrder(mStartTimeEdit, mTimeButton); 72// QWidget::setTabOrder(mStartTimeEdit, mTimeButton);
74// QWidget::setTabOrder(mTimeButton, mCompletedCombo); 73// QWidget::setTabOrder(mTimeButton, mCompletedCombo);
75// QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); 74// QWidget::setTabOrder(mCompletedCombo, mPriorityCombo);
76// QWidget::setTabOrder(mPriorityCombo, mAlarmButton); 75// QWidget::setTabOrder(mPriorityCombo, mAlarmButton);
77// QWidget::setTabOrder(mAlarmButton, mCategoriesButton); 76// QWidget::setTabOrder(mAlarmButton, mCategoriesButton);
78// QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); 77// QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo);
79// QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); 78// QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit);
80 mSummaryEdit->load(KOLocationBox::SUMMARYTODO); 79 mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
81 mSummaryEdit->setFocus(); 80 mSummaryEdit->setFocus();
82} 81}
83 82
84void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) 83void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
85{ 84{
86 QBoxLayout *timeLayout = new QVBoxLayout(topLayout); 85 QBoxLayout *timeLayout = new QVBoxLayout(topLayout);
87 86
88 QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, 87 QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal,
89 i18n("Date && Time"),parent); 88 i18n("Date && Time"),parent);
90 timeLayout->addWidget(timeGroupBox); 89 timeLayout->addWidget(timeGroupBox);
91 timeGroupBox->layout()->setSpacing( 0 ); 90 timeGroupBox->layout()->setSpacing( 0 );
92 timeGroupBox->layout()->setMargin( 5 ); 91 timeGroupBox->layout()->setMargin( 5 );
93 QFrame *timeBoxFrame = new QFrame(timeGroupBox); 92 QFrame *timeBoxFrame = new QFrame(timeGroupBox);
94 93
95 QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); 94 QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3);
96 layoutTimeBox->setSpacing(topLayout->spacing()); 95 layoutTimeBox->setSpacing(topLayout->spacing());
97 layoutTimeBox->setColStretch( 1, 1 ); 96 layoutTimeBox->setColStretch( 1, 1 );
98 97
99 mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); 98 mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame);
100 layoutTimeBox->addWidget(mDueCheck,0,0); 99 layoutTimeBox->addWidget(mDueCheck,0,0);
101 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); 100 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool)));
102 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); 101 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm()));
103 102
104 103
105 mDueDateEdit = new KDateEdit(timeBoxFrame); 104 mDueDateEdit = new KDateEdit(timeBoxFrame);
106 layoutTimeBox->addWidget(mDueDateEdit,0,1); 105 layoutTimeBox->addWidget(mDueDateEdit,0,1);
107 106
108 mDueTimeEdit = new KOTimeEdit(timeBoxFrame); 107 mDueTimeEdit = new KOTimeEdit(timeBoxFrame);
109 layoutTimeBox->addWidget(mDueTimeEdit,0,2); 108 layoutTimeBox->addWidget(mDueTimeEdit,0,2);
110 109
111 110
112 mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); 111 mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame);
113 layoutTimeBox->addWidget(mStartCheck,1,0); 112 layoutTimeBox->addWidget(mStartCheck,1,0);
114 connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); 113 connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool)));
115 114
116 mStartDateEdit = new KDateEdit(timeBoxFrame); 115 mStartDateEdit = new KDateEdit(timeBoxFrame);
117 layoutTimeBox->addWidget(mStartDateEdit,1,1); 116 layoutTimeBox->addWidget(mStartDateEdit,1,1);
118 117
119 mStartTimeEdit = new KOTimeEdit(timeBoxFrame); 118 mStartTimeEdit = new KOTimeEdit(timeBoxFrame);
120 layoutTimeBox->addWidget(mStartTimeEdit,1,2); 119 layoutTimeBox->addWidget(mStartTimeEdit,1,2);
121 120
122 121
123 mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); 122 mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame);
124 layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); 123 layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1);
125 124
126 connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); 125 connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool)));
127 126
128 // some more layouting 127 // some more layouting
129 //layoutTimeBox->setColStretch(3,1); 128 //layoutTimeBox->setColStretch(3,1);
130} 129}
131 130
132 131
133void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) 132void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout)
134{ 133{
135 mCompletedCombo = new QComboBox(parent); 134 mCompletedCombo = new QComboBox(parent);
136 // xgettext:no-c-format 135 // xgettext:no-c-format
137 mCompletedCombo->insertItem(i18n(" 0 %")); 136 mCompletedCombo->insertItem(i18n(" 0 %"));
138 // xgettext:no-c-format 137 // xgettext:no-c-format
139 mCompletedCombo->insertItem(i18n(" 20 %")); 138 mCompletedCombo->insertItem(i18n(" 20 %"));
140 // xgettext:no-c-format 139 // xgettext:no-c-format
141 mCompletedCombo->insertItem(i18n(" 40 %")); 140 mCompletedCombo->insertItem(i18n(" 40 %"));
142 // xgettext:no-c-format 141 // xgettext:no-c-format
143 mCompletedCombo->insertItem(i18n(" 60 %")); 142 mCompletedCombo->insertItem(i18n(" 60 %"));
144 // xgettext:no-c-format 143 // xgettext:no-c-format
145 mCompletedCombo->insertItem(i18n(" 80 %")); 144 mCompletedCombo->insertItem(i18n(" 80 %"));
146 // xgettext:no-c-format 145 // xgettext:no-c-format
147 mCompletedCombo->insertItem(i18n("100 %")); 146 mCompletedCombo->insertItem(i18n("100 %"));
148 connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); 147 connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int)));
149 topLayout->addWidget(mCompletedCombo); 148 topLayout->addWidget(mCompletedCombo);
150 149
151 mCompletedLabel = new QLabel(i18n("completed"),parent); 150 mCompletedLabel = new QLabel(i18n("completed"),parent);
152 topLayout->addWidget(mCompletedLabel); 151 topLayout->addWidget(mCompletedLabel);
153} 152}
154 153
155void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) 154void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout)
156{ 155{
157 156
158 QHBox* h = new QHBox ( parent ); 157 QHBox* h = new QHBox ( parent );
159 topLayout->addWidget( h ); 158 topLayout->addWidget( h );
160 QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); 159 QLabel *priorityLabel = new QLabel(i18n("Priority:"), h);
161 // topLayout->addWidget(priorityLabel); 160 // topLayout->addWidget(priorityLabel);
162 161
163 mPriorityCombo = new QComboBox( h ); 162 mPriorityCombo = new QComboBox( h );
164 mPriorityCombo->insertItem(i18n("1 (high)")); 163 mPriorityCombo->insertItem(i18n("1 (high)"));
165 mPriorityCombo->insertItem(i18n("2")); 164 mPriorityCombo->insertItem(i18n("2"));
166 mPriorityCombo->insertItem(i18n("3")); 165 mPriorityCombo->insertItem(i18n("3"));
167 mPriorityCombo->insertItem(i18n("4")); 166 mPriorityCombo->insertItem(i18n("4"));
168 mPriorityCombo->insertItem(i18n("5 (low)")); 167 mPriorityCombo->insertItem(i18n("5 (low)"));
169 //topLayout->addWidget(mPriorityCombo); 168 //topLayout->addWidget(mPriorityCombo);
170} 169}
171 170
172void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) 171void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout)
173{ 172{
174 QBoxLayout *statusLayout = new QHBoxLayout(topLayout); 173 QBoxLayout *statusLayout = new QHBoxLayout(topLayout);
175 174
176 initCompletion( parent, statusLayout ); 175 initCompletion( parent, statusLayout );
177 176
178 statusLayout->addStretch( 1 ); 177 statusLayout->addStretch( 1 );
179 178
180 initPriority( parent, statusLayout ); 179 initPriority( parent, statusLayout );
181} 180}
182 181
183void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) 182void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay)
184{ 183{
185 184
186 mSummaryEdit->load(KOLocationBox::SUMMARYTODO); 185 mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
187 mLocationEdit->load(KOLocationBox::LOCATION); 186 mLocationEdit->load(KOLocationBox::LOCATION);
188 KOEditorGeneral::setDefaults(allDay); 187 KOEditorGeneral::setDefaults(allDay);
189 188
190 mTimeButton->setChecked( !allDay ); 189 mTimeButton->setChecked( !allDay );
191 if(mTimeButton->isChecked()) { 190 if(mTimeButton->isChecked()) {
192 mTimeButton->setEnabled(true); 191 mTimeButton->setEnabled(true);
193 } 192 }
194 else { 193 else {
195 mTimeButton->setEnabled(false); 194 mTimeButton->setEnabled(false);
196 } 195 }
197 196
198 enableTimeEdits( !allDay ); 197 enableTimeEdits( !allDay );
199 198
200 mDueCheck->setChecked(false); 199 mDueCheck->setChecked(false);
201 enableDueEdit(false); 200 enableDueEdit(false);
202 201
203 alarmDisable(true); 202 alarmDisable(true);
204 203
205 mStartCheck->setChecked(false); 204 mStartCheck->setChecked(false);
206 enableStartEdit(false); 205 enableStartEdit(false);
207 206
208 mDueDateEdit->setDate(due.date()); 207 mDueDateEdit->setDate(due.date());
209 mDueTimeEdit->setTime(due.time()); 208 mDueTimeEdit->setTime(due.time());
210 209
211 mStartDateEdit->setDate(QDate::currentDate()); 210 mStartDateEdit->setDate(QDate::currentDate());
212 mStartTimeEdit->setTime(QTime::currentTime()); 211 mStartTimeEdit->setTime(QTime::currentTime());
213 212
214 mPriorityCombo->setCurrentItem(2); 213 mPriorityCombo->setCurrentItem(2);
215 mCompletedLabel->setText(i18n("completed"));; 214 mCompletedLabel->setText(i18n("completed"));;
216 mCompletedCombo->setCurrentItem(0); 215 mCompletedCombo->setCurrentItem(0);
217} 216}
218 217
219void KOEditorGeneralTodo::readTodo(Todo *todo) 218void KOEditorGeneralTodo::readTodo(Todo *todo)
220{ 219{
221 220
222 mSummaryEdit->load(KOLocationBox::SUMMARYTODO); 221 mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
223 mLocationEdit->load(KOLocationBox::LOCATION); 222 mLocationEdit->load(KOLocationBox::LOCATION);
224 KOEditorGeneral::readIncidence(todo); 223 KOEditorGeneral::readIncidence(todo);
225 224
226 QDateTime dueDT; 225 QDateTime dueDT;
227 226
228 if (todo->hasDueDate()) { 227 if (todo->hasDueDate()) {
229 enableAlarmEdit(true); 228 enableAlarmEdit(true);
230 dueDT = todo->dtDue(); 229 dueDT = todo->dtDue();
231 mDueDateEdit->setDate(todo->dtDue().date()); 230 mDueDateEdit->setDate(todo->dtDue().date());
232 mDueTimeEdit->setTime(todo->dtDue().time()); 231 mDueTimeEdit->setTime(todo->dtDue().time());
233 mDueCheck->setChecked(true); 232 mDueCheck->setChecked(true);
234 } else { 233 } else {
235 alarmDisable(true); 234 alarmDisable(true);
236 mDueDateEdit->setEnabled(false); 235 mDueDateEdit->setEnabled(false);
237 mDueTimeEdit->setEnabled(false); 236 mDueTimeEdit->setEnabled(false);
238 mDueDateEdit->setDate(QDate::currentDate()); 237 mDueDateEdit->setDate(QDate::currentDate());
239 mDueTimeEdit->setTime(QTime::currentTime()); 238 mDueTimeEdit->setTime(QTime::currentTime());
240 mDueCheck->setChecked(false); 239 mDueCheck->setChecked(false);
241 } 240 }
242 241
243 if (todo->hasStartDate()) { 242 if (todo->hasStartDate()) {
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index d82172f..98356fe 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -1,243 +1,242 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000-2003 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000-2003 Cornelius Schumacher <schumacher@kde.org>
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 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 <qfiledialog.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qlistbox.h> 32#include <qlistbox.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 36
37#include <kdialog.h> 37#include <kdialog.h>
38#include <kglobal.h> 38#include <kglobal.h>
39#include <klocale.h> 39#include <klocale.h>
40#include <kiconloader.h> 40#include <kiconloader.h>
41#include <kdebug.h> 41#include <kdebug.h>
42#include <knumvalidator.h> 42#include <knumvalidator.h>
43 43
44#include <libkcal/event.h> 44#include <libkcal/event.h>
45 45
46#include <libkdepim/kdateedit.h> 46#include <libkdepim/kdateedit.h>
47 47
48#include "koprefs.h" 48#include "koprefs.h"
49 49
50#include "koeditorrecurrence.h" 50#include "koeditorrecurrence.h"
51#include "koeditorrecurrence.moc"
52 51
53/////////////////////////// RecurBase /////////////////////////////// 52/////////////////////////// RecurBase ///////////////////////////////
54 53
55RecurBase::RecurBase( QWidget *parent, const char *name ) : 54RecurBase::RecurBase( QWidget *parent, const char *name ) :
56 QWidget( parent, name ) 55 QWidget( parent, name )
57{ 56{
58 mFrequencyEdit = new QSpinBox( 1, 9999, 1, this ); 57 mFrequencyEdit = new QSpinBox( 1, 9999, 1, this );
59 mFrequencyEdit->setValue( 1 ); 58 mFrequencyEdit->setValue( 1 );
60} 59}
61 60
62QWidget *RecurBase::frequencyEdit() 61QWidget *RecurBase::frequencyEdit()
63{ 62{
64 return mFrequencyEdit; 63 return mFrequencyEdit;
65} 64}
66 65
67void RecurBase::setFrequency( int f ) 66void RecurBase::setFrequency( int f )
68{ 67{
69 if ( f < 1 ) f = 1; 68 if ( f < 1 ) f = 1;
70 69
71 mFrequencyEdit->setValue( f ); 70 mFrequencyEdit->setValue( f );
72} 71}
73 72
74int RecurBase::frequency() 73int RecurBase::frequency()
75{ 74{
76 return mFrequencyEdit->value(); 75 return mFrequencyEdit->value();
77} 76}
78 77
79/////////////////////////// RecurDaily /////////////////////////////// 78/////////////////////////// RecurDaily ///////////////////////////////
80 79
81RecurDaily::RecurDaily( QWidget *parent, const char *name ) : 80RecurDaily::RecurDaily( QWidget *parent, const char *name ) :
82 RecurBase( parent, name ) 81 RecurBase( parent, name )
83{ 82{
84 QBoxLayout *topLayout = new QHBoxLayout( this ); 83 QBoxLayout *topLayout = new QHBoxLayout( this );
85 topLayout->setSpacing( KDialog::spacingHint() ); 84 topLayout->setSpacing( KDialog::spacingHint() );
86 85
87 QLabel *preLabel = new QLabel( i18n("Recur every"), this ); 86 QLabel *preLabel = new QLabel( i18n("Recur every"), this );
88 topLayout->addWidget( preLabel ); 87 topLayout->addWidget( preLabel );
89 88
90 topLayout->addWidget( frequencyEdit() ); 89 topLayout->addWidget( frequencyEdit() );
91 90
92 QLabel *postLabel = new QLabel( i18n("day(s)"), this ); 91 QLabel *postLabel = new QLabel( i18n("day(s)"), this );
93 topLayout->addWidget( postLabel ); 92 topLayout->addWidget( postLabel );
94} 93}
95 94
96 95
97/////////////////////////// RecurWeekly /////////////////////////////// 96/////////////////////////// RecurWeekly ///////////////////////////////
98 97
99RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) : 98RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) :
100 RecurBase( parent, name ) 99 RecurBase( parent, name )
101{ 100{
102 QBoxLayout *topLayout = new QVBoxLayout( this ); 101 QBoxLayout *topLayout = new QVBoxLayout( this );
103 topLayout->setSpacing( KDialog::spacingHint() ); 102 topLayout->setSpacing( KDialog::spacingHint() );
104 103
105 topLayout->addStretch( 1 ); 104 topLayout->addStretch( 1 );
106 105
107 QBoxLayout *weeksLayout = new QHBoxLayout( topLayout ); 106 QBoxLayout *weeksLayout = new QHBoxLayout( topLayout );
108 107
109 QLabel *preLabel = new QLabel( i18n("Recur every"), this ); 108 QLabel *preLabel = new QLabel( i18n("Recur every"), this );
110 weeksLayout->addWidget( preLabel ); 109 weeksLayout->addWidget( preLabel );
111 110
112 weeksLayout->addWidget( frequencyEdit() ); 111 weeksLayout->addWidget( frequencyEdit() );
113 112
114 QLabel *postLabel = new QLabel( i18n("week(s) on:"), this ); 113 QLabel *postLabel = new QLabel( i18n("week(s) on:"), this );
115 weeksLayout->addWidget( postLabel ); 114 weeksLayout->addWidget( postLabel );
116 115
117 QHBox *dayBox = new QHBox( this ); 116 QHBox *dayBox = new QHBox( this );
118 topLayout->addWidget( dayBox, 1, AlignVCenter ); 117 topLayout->addWidget( dayBox, 1, AlignVCenter );
119 // TODO: Respect start of week setting 118 // TODO: Respect start of week setting
120 for ( int i = 0; i < 7; ++i ) { 119 for ( int i = 0; i < 7; ++i ) {
121 QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true ); 120 QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true );
122 if ( KOPrefs::instance()->mCompactDialogs ) { 121 if ( KOPrefs::instance()->mCompactDialogs ) {
123 weekDayName = weekDayName.left( 1 ); 122 weekDayName = weekDayName.left( 1 );
124 } 123 }
125 mDayBoxes[ i ] = new QCheckBox( weekDayName, dayBox ); 124 mDayBoxes[ i ] = new QCheckBox( weekDayName, dayBox );
126 } 125 }
127 126
128 topLayout->addStretch( 1 ); 127 topLayout->addStretch( 1 );
129} 128}
130 129
131void RecurWeekly::setDays( const QBitArray &days ) 130void RecurWeekly::setDays( const QBitArray &days )
132{ 131{
133 for ( int i = 0; i < 7; ++i ) { 132 for ( int i = 0; i < 7; ++i ) {
134 mDayBoxes[ i ]->setChecked( days.testBit( i ) ); 133 mDayBoxes[ i ]->setChecked( days.testBit( i ) );
135 } 134 }
136} 135}
137 136
138QBitArray RecurWeekly::days() 137QBitArray RecurWeekly::days()
139{ 138{
140 QBitArray days( 7 ); 139 QBitArray days( 7 );
141 140
142 for ( int i = 0; i < 7; ++i ) { 141 for ( int i = 0; i < 7; ++i ) {
143 days.setBit( i, mDayBoxes[ i ]->isChecked() ); 142 days.setBit( i, mDayBoxes[ i ]->isChecked() );
144 } 143 }
145 144
146 return days; 145 return days;
147} 146}
148 147
149/////////////////////////// RecurMonthly /////////////////////////////// 148/////////////////////////// RecurMonthly ///////////////////////////////
150 149
151RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) : 150RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) :
152 RecurBase( parent, name ) 151 RecurBase( parent, name )
153{ 152{
154 QBoxLayout *topLayout = new QVBoxLayout( this ); 153 QBoxLayout *topLayout = new QVBoxLayout( this );
155 topLayout->setSpacing( KDialog::spacingHint() ); 154 topLayout->setSpacing( KDialog::spacingHint() );
156 155
157 156
158 QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); 157 QBoxLayout *freqLayout = new QHBoxLayout( topLayout );
159 158
160 QLabel *preLabel = new QLabel( i18n("every"), this ); 159 QLabel *preLabel = new QLabel( i18n("every"), this );
161 freqLayout->addWidget( preLabel ); 160 freqLayout->addWidget( preLabel );
162 161
163 freqLayout->addWidget( frequencyEdit() ); 162 freqLayout->addWidget( frequencyEdit() );
164 163
165 QLabel *postLabel = new QLabel( i18n("month(s)"), this ); 164 QLabel *postLabel = new QLabel( i18n("month(s)"), this );
166 freqLayout->addWidget( postLabel ); 165 freqLayout->addWidget( postLabel );
167 166
168 167
169 QButtonGroup *buttonGroup = new QButtonGroup( this ); 168 QButtonGroup *buttonGroup = new QButtonGroup( this );
170 buttonGroup->setFrameStyle( QFrame::NoFrame ); 169 buttonGroup->setFrameStyle( QFrame::NoFrame );
171 topLayout->addWidget( buttonGroup, 1, AlignVCenter ); 170 topLayout->addWidget( buttonGroup, 1, AlignVCenter );
172 171
173 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 ); 172 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 );
174 buttonLayout->setSpacing( KDialog::spacingHint() ); 173 buttonLayout->setSpacing( KDialog::spacingHint() );
175 174
176 175
177 QString recurOnText; 176 QString recurOnText;
178 if ( !KOPrefs::instance()->mCompactDialogs ) { 177 if ( !KOPrefs::instance()->mCompactDialogs ) {
179 recurOnText = i18n("Recur on the"); 178 recurOnText = i18n("Recur on the");
180 } 179 }
181 180
182 mByDayRadio = new QRadioButton( recurOnText, buttonGroup ); 181 mByDayRadio = new QRadioButton( recurOnText, buttonGroup );
183 buttonLayout->addWidget( mByDayRadio, 0, 0 ); 182 buttonLayout->addWidget( mByDayRadio, 0, 0 );
184 183
185 mByDayCombo = new QComboBox( buttonGroup ); 184 mByDayCombo = new QComboBox( buttonGroup );
186 mByDayCombo->setSizeLimit( 7 ); 185 mByDayCombo->setSizeLimit( 7 );
187 mByDayCombo->insertItem( i18n("1st") ); 186 mByDayCombo->insertItem( i18n("1st") );
188 mByDayCombo->insertItem( i18n("2nd") ); 187 mByDayCombo->insertItem( i18n("2nd") );
189 mByDayCombo->insertItem( i18n("3rd") ); 188 mByDayCombo->insertItem( i18n("3rd") );
190 mByDayCombo->insertItem( i18n("4th") ); 189 mByDayCombo->insertItem( i18n("4th") );
191 mByDayCombo->insertItem( i18n("5th") ); 190 mByDayCombo->insertItem( i18n("5th") );
192 mByDayCombo->insertItem( i18n("6th") ); 191 mByDayCombo->insertItem( i18n("6th") );
193 mByDayCombo->insertItem( i18n("7th") ); 192 mByDayCombo->insertItem( i18n("7th") );
194 mByDayCombo->insertItem( i18n("8th") ); 193 mByDayCombo->insertItem( i18n("8th") );
195 mByDayCombo->insertItem( i18n("9th") ); 194 mByDayCombo->insertItem( i18n("9th") );
196 mByDayCombo->insertItem( i18n("10th") ); 195 mByDayCombo->insertItem( i18n("10th") );
197 mByDayCombo->insertItem( i18n("11th") ); 196 mByDayCombo->insertItem( i18n("11th") );
198 mByDayCombo->insertItem( i18n("12th") ); 197 mByDayCombo->insertItem( i18n("12th") );
199 mByDayCombo->insertItem( i18n("13th") ); 198 mByDayCombo->insertItem( i18n("13th") );
200 mByDayCombo->insertItem( i18n("14th") ); 199 mByDayCombo->insertItem( i18n("14th") );
201 mByDayCombo->insertItem( i18n("15th") ); 200 mByDayCombo->insertItem( i18n("15th") );
202 mByDayCombo->insertItem( i18n("16th") ); 201 mByDayCombo->insertItem( i18n("16th") );
203 mByDayCombo->insertItem( i18n("17th") ); 202 mByDayCombo->insertItem( i18n("17th") );
204 mByDayCombo->insertItem( i18n("18th") ); 203 mByDayCombo->insertItem( i18n("18th") );
205 mByDayCombo->insertItem( i18n("19th") ); 204 mByDayCombo->insertItem( i18n("19th") );
206 mByDayCombo->insertItem( i18n("20th") ); 205 mByDayCombo->insertItem( i18n("20th") );
207 mByDayCombo->insertItem( i18n("21st") ); 206 mByDayCombo->insertItem( i18n("21st") );
208 mByDayCombo->insertItem( i18n("22nd") ); 207 mByDayCombo->insertItem( i18n("22nd") );
209 mByDayCombo->insertItem( i18n("23rd") ); 208 mByDayCombo->insertItem( i18n("23rd") );
210 mByDayCombo->insertItem( i18n("24th") ); 209 mByDayCombo->insertItem( i18n("24th") );
211 mByDayCombo->insertItem( i18n("25th") ); 210 mByDayCombo->insertItem( i18n("25th") );
212 mByDayCombo->insertItem( i18n("26th") ); 211 mByDayCombo->insertItem( i18n("26th") );
213 mByDayCombo->insertItem( i18n("27th") ); 212 mByDayCombo->insertItem( i18n("27th") );
214 mByDayCombo->insertItem( i18n("28th") ); 213 mByDayCombo->insertItem( i18n("28th") );
215 mByDayCombo->insertItem( i18n("29th") ); 214 mByDayCombo->insertItem( i18n("29th") );
216 mByDayCombo->insertItem( i18n("30th") ); 215 mByDayCombo->insertItem( i18n("30th") );
217 mByDayCombo->insertItem( i18n("31st") ); 216 mByDayCombo->insertItem( i18n("31st") );
218 buttonLayout->addWidget( mByDayCombo, 0, 1 ); 217 buttonLayout->addWidget( mByDayCombo, 0, 1 );
219 218
220 QLabel *byDayLabel = new QLabel( i18n("day"), buttonGroup ); 219 QLabel *byDayLabel = new QLabel( i18n("day"), buttonGroup );
221 buttonLayout->addWidget( byDayLabel, 0, 2 ); 220 buttonLayout->addWidget( byDayLabel, 0, 2 );
222 221
223 222
224 mByPosRadio = new QRadioButton( recurOnText, buttonGroup); 223 mByPosRadio = new QRadioButton( recurOnText, buttonGroup);
225 buttonLayout->addWidget( mByPosRadio, 1, 0 ); 224 buttonLayout->addWidget( mByPosRadio, 1, 0 );
226 225
227 mByPosCountCombo = new QComboBox( buttonGroup ); 226 mByPosCountCombo = new QComboBox( buttonGroup );
228 mByPosCountCombo->insertItem( i18n("1st") ); 227 mByPosCountCombo->insertItem( i18n("1st") );
229 mByPosCountCombo->insertItem( i18n("2nd") ); 228 mByPosCountCombo->insertItem( i18n("2nd") );
230 mByPosCountCombo->insertItem( i18n("3rd") ); 229 mByPosCountCombo->insertItem( i18n("3rd") );
231 mByPosCountCombo->insertItem( i18n("4th") ); 230 mByPosCountCombo->insertItem( i18n("4th") );
232 mByPosCountCombo->insertItem( i18n("5th") ); 231 mByPosCountCombo->insertItem( i18n("5th") );
233 buttonLayout->addWidget( mByPosCountCombo, 1, 1 ); 232 buttonLayout->addWidget( mByPosCountCombo, 1, 1 );
234 233
235 mByPosWeekdayCombo = new QComboBox( buttonGroup ); 234 mByPosWeekdayCombo = new QComboBox( buttonGroup );
236 mByPosWeekdayCombo->insertItem( i18n("Monday") ); 235 mByPosWeekdayCombo->insertItem( i18n("Monday") );
237 mByPosWeekdayCombo->insertItem( i18n("Tuesday") ); 236 mByPosWeekdayCombo->insertItem( i18n("Tuesday") );
238 mByPosWeekdayCombo->insertItem( i18n("Wednesday") ); 237 mByPosWeekdayCombo->insertItem( i18n("Wednesday") );
239 mByPosWeekdayCombo->insertItem( i18n("Thursday") ); 238 mByPosWeekdayCombo->insertItem( i18n("Thursday") );
240 mByPosWeekdayCombo->insertItem( i18n("Friday") ); 239 mByPosWeekdayCombo->insertItem( i18n("Friday") );
241 mByPosWeekdayCombo->insertItem( i18n("Saturday") ); 240 mByPosWeekdayCombo->insertItem( i18n("Saturday") );
242 mByPosWeekdayCombo->insertItem( i18n("Sunday") ); 241 mByPosWeekdayCombo->insertItem( i18n("Sunday") );
243 buttonLayout->addWidget( mByPosWeekdayCombo, 1, 2 ); 242 buttonLayout->addWidget( mByPosWeekdayCombo, 1, 2 );
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp
index b3edec6..0ff99a4 100644
--- a/korganizer/koeventeditor.cpp
+++ b/korganizer/koeventeditor.cpp
@@ -1,242 +1,241 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org>
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 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 <qframe.h>
26#include <qpixmap.h> 26#include <qpixmap.h>
27#include <qhbox.h> 27#include <qhbox.h>
28#include <qdir.h> 28#include <qdir.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qapplication.h> 31#include <qapplication.h>
32 32
33#include <kiconloader.h> 33#include <kiconloader.h>
34#include <kstandarddirs.h> 34#include <kstandarddirs.h>
35#include <kdebug.h> 35#include <kdebug.h>
36#include <klocale.h> 36#include <klocale.h>
37#include <kfiledialog.h> 37#include <kfiledialog.h>
38#include <kmessagebox.h> 38#include <kmessagebox.h>
39#include <libkcal/calendarresources.h> 39#include <libkcal/calendarresources.h>
40#include <libkcal/resourcecalendar.h> 40#include <libkcal/resourcecalendar.h>
41#include <kresources/resourceselectdialog.h> 41#include <kresources/resourceselectdialog.h>
42 42
43#include <libkdepim/categoryselectdialog.h> 43#include <libkdepim/categoryselectdialog.h>
44#include <libkcal/calendarlocal.h> 44#include <libkcal/calendarlocal.h>
45#include <libkcal/icalformat.h> 45#include <libkcal/icalformat.h>
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48 48
49#include "koeventeditor.h" 49#include "koeventeditor.h"
50#include "koeventeditor.moc"
51extern int globalFlagBlockAgenda; 50extern int globalFlagBlockAgenda;
52 51
53KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) : 52KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) :
54 KOIncidenceEditor( i18n("Edit Event"), calendar, parent ) 53 KOIncidenceEditor( i18n("Edit Event"), calendar, parent )
55{ 54{
56 mEvent = 0; 55 mEvent = 0;
57 init(); 56 init();
58} 57}
59 58
60KOEventEditor::~KOEventEditor() 59KOEventEditor::~KOEventEditor()
61{ 60{
62 //emit dialogClose( mEvent ); 61 //emit dialogClose( mEvent );
63} 62}
64 63
65void KOEventEditor::init() 64void KOEventEditor::init()
66{ 65{
67 66
68 setupGeneral(); 67 setupGeneral();
69 setupAttendeesTab(); 68 setupAttendeesTab();
70 setupRecurrence(); 69 setupRecurrence();
71 70
72 // Propagate date time settings to recurrence tab 71 // Propagate date time settings to recurrence tab
73 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), 72 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
74 mRecurrence,SLOT(setDateTimes(QDateTime,QDateTime))); 73 mRecurrence,SLOT(setDateTimes(QDateTime,QDateTime)));
75 connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)), 74 connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)),
76 mRecurrence,SLOT(setDateTimeStr(const QString &))); 75 mRecurrence,SLOT(setDateTimeStr(const QString &)));
77 76
78 // Category dialog 77 // Category dialog
79 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); 78 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
80 //connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)), 79 //connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)),
81 // mGeneral,SLOT(setCategories(const QString &))); 80 // mGeneral,SLOT(setCategories(const QString &)));
82 81
83 82
84} 83}
85 84
86void KOEventEditor::reload() 85void KOEventEditor::reload()
87{ 86{
88 if ( mEvent ) readEvent( mEvent ); 87 if ( mEvent ) readEvent( mEvent );
89} 88}
90 89
91void KOEventEditor::setSecrecy( int sec ) 90void KOEventEditor::setSecrecy( int sec )
92{ 91{
93 mGeneral->setSecrecy( sec ); 92 mGeneral->setSecrecy( sec );
94} 93}
95void KOEventEditor::setCategories( QString s ) 94void KOEventEditor::setCategories( QString s )
96{ 95{
97 mGeneral->setCategories(s); 96 mGeneral->setCategories(s);
98 97
99} 98}
100void KOEventEditor::setupGeneral() 99void KOEventEditor::setupGeneral()
101{ 100{
102 mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" ); 101 mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" );
103 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); 102 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
104 103
105 if( KOPrefs::instance()->mCompactDialogs ) { 104 if( KOPrefs::instance()->mCompactDialogs ) {
106 QFrame *topFrame = addPage(i18n("General")); 105 QFrame *topFrame = addPage(i18n("General"));
107 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 106 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
108 topLayout->setSpacing(spacingHint()-1); 107 topLayout->setSpacing(spacingHint()-1);
109 topLayout->setMargin(marginHint()-1); 108 topLayout->setMargin(marginHint()-1);
110 mGeneral->initHeader(topFrame,topLayout); 109 mGeneral->initHeader(topFrame,topLayout);
111 mGeneral->initTime(topFrame,topLayout); 110 mGeneral->initTime(topFrame,topLayout);
112// QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 111// QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
113 mGeneral->initAlarm(topFrame,topLayout); 112 mGeneral->initAlarm(topFrame,topLayout);
114 mGeneral->enableAlarm( false ); 113 mGeneral->enableAlarm( false );
115 114
116 QBoxLayout *buttonLayout; 115 QBoxLayout *buttonLayout;
117 if ( QApplication::desktop()->width() < 500 ) 116 if ( QApplication::desktop()->width() < 500 )
118 buttonLayout = new QVBoxLayout( topLayout ); 117 buttonLayout = new QVBoxLayout( topLayout );
119 else 118 else
120 buttonLayout = new QHBoxLayout( topLayout ); 119 buttonLayout = new QHBoxLayout( topLayout );
121 QHBox* buttonWidget = new QHBox (topFrame); 120 QHBox* buttonWidget = new QHBox (topFrame);
122 QIconSet icon; 121 QIconSet icon;
123 if ( QApplication::desktop()->width() < 321 ) 122 if ( QApplication::desktop()->width() < 321 )
124 icon = SmallIcon("fileexport16"); 123 icon = SmallIcon("fileexport16");
125 else 124 else
126 icon = SmallIcon("fileexport"); 125 icon = SmallIcon("fileexport");
127 QPushButton * loadTemplate = new QPushButton( buttonWidget); 126 QPushButton * loadTemplate = new QPushButton( buttonWidget);
128 QPushButton * saveTemplate = new QPushButton( buttonWidget); 127 QPushButton * saveTemplate = new QPushButton( buttonWidget);
129 saveTemplate->setIconSet (icon ) ; 128 saveTemplate->setIconSet (icon ) ;
130 int size = saveTemplate->sizeHint().height(); 129 int size = saveTemplate->sizeHint().height();
131 saveTemplate->setFixedSize( size, size ); 130 saveTemplate->setFixedSize( size, size );
132 if ( QApplication::desktop()->width() < 321 ) 131 if ( QApplication::desktop()->width() < 321 )
133 icon = SmallIcon("fileimport16"); 132 icon = SmallIcon("fileimport16");
134 else 133 else
135 icon = SmallIcon("fileimport"); 134 icon = SmallIcon("fileimport");
136 loadTemplate->setIconSet (icon ) ; 135 loadTemplate->setIconSet (icon ) ;
137 loadTemplate->setFixedSize( size, size ); 136 loadTemplate->setFixedSize( size, size );
138 buttonLayout->addWidget( buttonWidget ); 137 buttonLayout->addWidget( buttonWidget );
139 mGeneral->initCategories( topFrame, buttonLayout ); 138 mGeneral->initCategories( topFrame, buttonLayout );
140 139
141 topLayout->addStretch( 1 ); 140 topLayout->addStretch( 1 );
142 141
143 QFrame *topFrame2 = addPage(i18n("Details")); 142 QFrame *topFrame2 = addPage(i18n("Details"));
144 143
145 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); 144 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2);
146 topLayout2->setSpacing(spacingHint()); 145 topLayout2->setSpacing(spacingHint());
147 146
148 mGeneral->initClass(topFrame2,topLayout2); 147 mGeneral->initClass(topFrame2,topLayout2);
149 mGeneral->initSecrecy( topFrame2, topLayout2 ); 148 mGeneral->initSecrecy( topFrame2, topLayout2 );
150 mGeneral->initDescription(topFrame2,topLayout2); 149 mGeneral->initDescription(topFrame2,topLayout2);
151 150
152 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 151 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
153 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 152 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
154 } else { 153 } else {
155 QFrame *topFrame = addPage(i18n("General")); 154 QFrame *topFrame = addPage(i18n("General"));
156 155
157 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 156 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
158 topLayout->setSpacing(spacingHint()); 157 topLayout->setSpacing(spacingHint());
159 158
160 mGeneral->initHeader(topFrame,topLayout); 159 mGeneral->initHeader(topFrame,topLayout);
161 mGeneral->initTime(topFrame,topLayout); 160 mGeneral->initTime(topFrame,topLayout);
162 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 161 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
163 mGeneral->initAlarm(topFrame,alarmLineLayout); 162 mGeneral->initAlarm(topFrame,alarmLineLayout);
164 mGeneral->initClass(topFrame,alarmLineLayout); 163 mGeneral->initClass(topFrame,alarmLineLayout);
165 mGeneral->initDescription(topFrame,topLayout); 164 mGeneral->initDescription(topFrame,topLayout);
166 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); 165 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout);
167 mGeneral->initCategories( topFrame, detailsLayout ); 166 mGeneral->initCategories( topFrame, detailsLayout );
168 mGeneral->initSecrecy( topFrame, detailsLayout ); 167 mGeneral->initSecrecy( topFrame, detailsLayout );
169 } 168 }
170 169
171 mGeneral->finishSetup(); 170 mGeneral->finishSetup();
172 171
173} 172}
174 173
175void KOEventEditor::setupRecurrence() 174void KOEventEditor::setupRecurrence()
176{ 175{
177 QFrame *topFrame = addPage( i18n("Recurrence") ); 176 QFrame *topFrame = addPage( i18n("Recurrence") );
178 QBoxLayout *topLayout = new QVBoxLayout( topFrame ); 177 QBoxLayout *topLayout = new QVBoxLayout( topFrame );
179 178
180 mRecurrence = new KOEditorRecurrence( topFrame ); 179 mRecurrence = new KOEditorRecurrence( topFrame );
181 topLayout->addWidget( mRecurrence ); 180 topLayout->addWidget( mRecurrence );
182} 181}
183 182
184void KOEventEditor::editEvent(Event *event, bool showDescription) 183void KOEventEditor::editEvent(Event *event, bool showDescription)
185{ 184{
186 // init(); 185 // init();
187 186
188 mEvent = event; 187 mEvent = event;
189 readEvent(mEvent); 188 readEvent(mEvent);
190 qApp->processEvents(); 189 qApp->processEvents();
191 if ( showDescription ) { 190 if ( showDescription ) {
192 showPage( 1 ); 191 showPage( 1 );
193 mGeneral->setFocusOn( 1 ); 192 mGeneral->setFocusOn( 1 );
194 } else { 193 } else {
195 showPage( 0 ); 194 showPage( 0 );
196 mGeneral->setFocusOn( 2 ); 195 mGeneral->setFocusOn( 2 );
197 } 196 }
198} 197}
199 198
200void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay ) 199void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay )
201{ 200{
202 // init(); 201 // init();
203 202
204 mEvent = 0; 203 mEvent = 0;
205 setDefaults(from,to,allDay); 204 setDefaults(from,to,allDay);
206} 205}
207 206
208void KOEventEditor::loadDefaults() 207void KOEventEditor::loadDefaults()
209{ 208{
210 int fmt = KOPrefs::instance()->mStartTime; 209 int fmt = KOPrefs::instance()->mStartTime;
211 210
212 QDateTime from(QDate::currentDate(), QTime(fmt,0,0)); 211 QDateTime from(QDate::currentDate(), QTime(fmt,0,0));
213 QDateTime to(QDate::currentDate(), 212 QDateTime to(QDate::currentDate(),
214 QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0)); 213 QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0));
215 214
216 setDefaults(from,to,false); 215 setDefaults(from,to,false);
217} 216}
218 217
219bool KOEventEditor::processInput( bool emitTime ) 218bool KOEventEditor::processInput( bool emitTime )
220{ 219{
221 if (!validateInput()) return false; 220 if (!validateInput()) return false;
222 221
223 Event *event = 0; 222 Event *event = 0;
224 223
225 if (mEvent) event = mEvent; 224 if (mEvent) event = mEvent;
226 else { 225 else {
227 event = new Event; 226 event = new Event;
228 event->setOrganizer(KOPrefs::instance()->email()); 227 event->setOrganizer(KOPrefs::instance()->email());
229 } 228 }
230 229
231 writeEvent(event); 230 writeEvent(event);
232 if ( emitTime ) { 231 if ( emitTime ) {
233 globalFlagBlockAgenda = 1; 232 globalFlagBlockAgenda = 1;
234 emit showAgendaView( false ); 233 emit showAgendaView( false );
235 emit jumpToTime( event->dtStart().date() ); 234 emit jumpToTime( event->dtStart().date() );
236 globalFlagBlockAgenda = 2; 235 globalFlagBlockAgenda = 2;
237 236
238 } 237 }
239 if (mEvent) { 238 if (mEvent) {
240 event->setRevision(event->revision()+1); 239 event->setRevision(event->revision()+1);
241 emit eventChanged(event); 240 emit eventChanged(event);
242 } else { 241 } else {
diff --git a/korganizer/koeventpopupmenu.cpp b/korganizer/koeventpopupmenu.cpp
index 410bceb..b274810 100644
--- a/korganizer/koeventpopupmenu.cpp
+++ b/korganizer/koeventpopupmenu.cpp
@@ -1,114 +1,113 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
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 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 25
26#include <klocale.h> 26#include <klocale.h>
27#include <kdebug.h> 27#include <kdebug.h>
28#include <kiconloader.h> 28#include <kiconloader.h>
29 29
30#include <libkcal/event.h> 30#include <libkcal/event.h>
31 31
32#include "koeventpopupmenu.h" 32#include "koeventpopupmenu.h"
33#include "koeventpopupmenu.moc"
34 33
35KOEventPopupMenu::KOEventPopupMenu() 34KOEventPopupMenu::KOEventPopupMenu()
36{ 35{
37 mCurrentIncidence = 0; 36 mCurrentIncidence = 0;
38 mHasAdditionalItems = false; 37 mHasAdditionalItems = false;
39 38
40 insertItem (i18n("&Show"),this,SLOT(popupShow())); 39 insertItem (i18n("&Show"),this,SLOT(popupShow()));
41 mEditOnlyItems.append(insertItem (i18n("&Edit..."),this,SLOT(popupEdit()))); 40 mEditOnlyItems.append(insertItem (i18n("&Edit..."),this,SLOT(popupEdit())));
42 mEditOnlyItems.append(insertItem (i18n("&Delete"), 41 mEditOnlyItems.append(insertItem (i18n("&Delete"),
43 this,SLOT(popupDelete()))); 42 this,SLOT(popupDelete())));
44 mEditOnlyItems.append(insertItem (i18n("&Clone..."), 43 mEditOnlyItems.append(insertItem (i18n("&Clone..."),
45 this,SLOT(popupClone()))); 44 this,SLOT(popupClone())));
46 mEditOnlyItems.append(insertItem (i18n("&Move..."), 45 mEditOnlyItems.append(insertItem (i18n("&Move..."),
47 this,SLOT(popupMove()))); 46 this,SLOT(popupMove())));
48#ifndef DESKTOP_VERSION 47#ifndef DESKTOP_VERSION
49 mEditOnlyItems.append(insertItem (i18n("&Beam..."), 48 mEditOnlyItems.append(insertItem (i18n("&Beam..."),
50 this,SLOT(popupBeam()))); 49 this,SLOT(popupBeam())));
51#endif 50#endif
52 mEditOnlyItems.append(insertItem (i18n("&Toggle Cancel"), 51 mEditOnlyItems.append(insertItem (i18n("&Toggle Cancel"),
53 this,SLOT(popupCancel()))); 52 this,SLOT(popupCancel())));
54} 53}
55 54
56void KOEventPopupMenu::showIncidencePopup(Incidence *incidence) 55void KOEventPopupMenu::showIncidencePopup(Incidence *incidence)
57{ 56{
58 mCurrentIncidence = incidence; 57 mCurrentIncidence = incidence;
59 58
60 if (mCurrentIncidence) { 59 if (mCurrentIncidence) {
61 // Enable/Disabled menu items only valid for editable events. 60 // Enable/Disabled menu items only valid for editable events.
62 QValueList<int>::Iterator it; 61 QValueList<int>::Iterator it;
63 for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { 62 for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) {
64 setItemEnabled(*it,!mCurrentIncidence->isReadOnly()); 63 setItemEnabled(*it,!mCurrentIncidence->isReadOnly());
65 } 64 }
66 popup(QCursor::pos()); 65 popup(QCursor::pos());
67 } else { 66 } else {
68 kdDebug() << "KOEventPopupMenu::showEventPopup(): No event selected" << endl; 67 kdDebug() << "KOEventPopupMenu::showEventPopup(): No event selected" << endl;
69 } 68 }
70} 69}
71 70
72void KOEventPopupMenu::addAdditionalItem(const QIconSet &icon,const QString &text, 71void KOEventPopupMenu::addAdditionalItem(const QIconSet &icon,const QString &text,
73 const QObject *receiver, const char *member, 72 const QObject *receiver, const char *member,
74 bool editOnly) 73 bool editOnly)
75{ 74{
76 if (!mHasAdditionalItems) { 75 if (!mHasAdditionalItems) {
77 mHasAdditionalItems = true; 76 mHasAdditionalItems = true;
78 insertSeparator(); 77 insertSeparator();
79 } 78 }
80 int id = insertItem(icon,text,receiver,member); 79 int id = insertItem(icon,text,receiver,member);
81 if (editOnly) mEditOnlyItems.append(id); 80 if (editOnly) mEditOnlyItems.append(id);
82} 81}
83 82
84void KOEventPopupMenu::popupShow() 83void KOEventPopupMenu::popupShow()
85{ 84{
86 if (mCurrentIncidence) emit showIncidenceSignal(mCurrentIncidence); 85 if (mCurrentIncidence) emit showIncidenceSignal(mCurrentIncidence);
87} 86}
88 87
89void KOEventPopupMenu::popupEdit() 88void KOEventPopupMenu::popupEdit()
90{ 89{
91 if (mCurrentIncidence) emit editIncidenceSignal(mCurrentIncidence); 90 if (mCurrentIncidence) emit editIncidenceSignal(mCurrentIncidence);
92} 91}
93 92
94void KOEventPopupMenu::popupDelete() 93void KOEventPopupMenu::popupDelete()
95{ 94{
96 if (mCurrentIncidence) emit deleteIncidenceSignal(mCurrentIncidence); 95 if (mCurrentIncidence) emit deleteIncidenceSignal(mCurrentIncidence);
97} 96}
98void KOEventPopupMenu::popupClone() 97void KOEventPopupMenu::popupClone()
99{ 98{
100 if (mCurrentIncidence) emit cloneIncidenceSignal(mCurrentIncidence); 99 if (mCurrentIncidence) emit cloneIncidenceSignal(mCurrentIncidence);
101} 100}
102void KOEventPopupMenu::popupCancel() 101void KOEventPopupMenu::popupCancel()
103{ 102{
104 if (mCurrentIncidence) emit cancelIncidenceSignal(mCurrentIncidence); 103 if (mCurrentIncidence) emit cancelIncidenceSignal(mCurrentIncidence);
105} 104}
106void KOEventPopupMenu::popupMove() 105void KOEventPopupMenu::popupMove()
107{ 106{
108 if (mCurrentIncidence) emit moveIncidenceSignal(mCurrentIncidence); 107 if (mCurrentIncidence) emit moveIncidenceSignal(mCurrentIncidence);
109} 108}
110 109
111void KOEventPopupMenu::popupBeam() 110void KOEventPopupMenu::popupBeam()
112{ 111{
113 if (mCurrentIncidence) emit beamIncidenceSignal(mCurrentIncidence); 112 if (mCurrentIncidence) emit beamIncidenceSignal(mCurrentIncidence);
114} 113}
diff --git a/korganizer/koeventview.cpp b/korganizer/koeventview.cpp
index 4553b0b..bce2626 100644
--- a/korganizer/koeventview.cpp
+++ b/korganizer/koeventview.cpp
@@ -1,133 +1,130 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
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 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 <qpopupmenu.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#include "koeventview.moc"
37 36
38//--------------------------------------------------------------------------- 37//---------------------------------------------------------------------------
39 38
40KOEventView::KOEventView(Calendar *cal,QWidget *parent,const char *name) 39KOEventView::KOEventView(Calendar *cal,QWidget *parent,const char *name)
41 : KOrg::BaseView(cal,parent,name) 40 : KOrg::BaseView(cal,parent,name)
42{ 41{
43} 42}
44 43
45//--------------------------------------------------------------------------- 44//---------------------------------------------------------------------------
46 45
47KOEventView::~KOEventView() 46KOEventView::~KOEventView()
48{ 47{
49} 48}
50 49
51//--------------------------------------------------------------------------- 50//---------------------------------------------------------------------------
52 51
53KOEventPopupMenu *KOEventView::eventPopup() 52KOEventPopupMenu *KOEventView::eventPopup()
54{ 53{
55 KOEventPopupMenu *eventPopup = new KOEventPopupMenu; 54 KOEventPopupMenu *eventPopup = new KOEventPopupMenu;
56 55
57 connect(eventPopup,SIGNAL(editIncidenceSignal(Incidence *)), 56 connect(eventPopup,SIGNAL(editIncidenceSignal(Incidence *)),
58 SIGNAL(editIncidenceSignal(Incidence *))); 57 SIGNAL(editIncidenceSignal(Incidence *)));
59 connect(eventPopup,SIGNAL(showIncidenceSignal(Incidence *)), 58 connect(eventPopup,SIGNAL(showIncidenceSignal(Incidence *)),
60 SIGNAL(showIncidenceSignal(Incidence *))); 59 SIGNAL(showIncidenceSignal(Incidence *)));
61 connect(eventPopup,SIGNAL(deleteIncidenceSignal(Incidence *)), 60 connect(eventPopup,SIGNAL(deleteIncidenceSignal(Incidence *)),
62 SIGNAL(deleteIncidenceSignal(Incidence *))); 61 SIGNAL(deleteIncidenceSignal(Incidence *)));
63 connect(eventPopup,SIGNAL(cancelIncidenceSignal(Incidence *)), 62 connect(eventPopup,SIGNAL(cancelIncidenceSignal(Incidence *)),
64 SIGNAL(cancelIncidenceSignal(Incidence *))); 63 SIGNAL(cancelIncidenceSignal(Incidence *)));
65 connect(eventPopup,SIGNAL(cloneIncidenceSignal(Incidence *)), 64 connect(eventPopup,SIGNAL(cloneIncidenceSignal(Incidence *)),
66 SIGNAL(cloneIncidenceSignal(Incidence *))); 65 SIGNAL(cloneIncidenceSignal(Incidence *)));
67 connect(eventPopup,SIGNAL(beamIncidenceSignal(Incidence *)), 66 connect(eventPopup,SIGNAL(beamIncidenceSignal(Incidence *)),
68 SIGNAL(beamIncidenceSignal(Incidence *))); 67 SIGNAL(beamIncidenceSignal(Incidence *)));
69 connect(eventPopup,SIGNAL(moveIncidenceSignal(Incidence *)), 68 connect(eventPopup,SIGNAL(moveIncidenceSignal(Incidence *)),
70 SIGNAL(moveIncidenceSignal(Incidence *))); 69 SIGNAL(moveIncidenceSignal(Incidence *)));
71 70
72 return eventPopup; 71 return eventPopup;
73} 72}
74 73
75//--------------------------------------------------------------------------- 74//---------------------------------------------------------------------------
76 75
77void KOEventView::showIncidencePopup(QPopupMenu *popup,Incidence *event) 76void KOEventView::showIncidencePopup(QPopupMenu *popup,Incidence *event)
78{ 77{
79 mCurrentIncidence = event; 78 mCurrentIncidence = event;
80 if (event) popup->popup(QCursor::pos()); 79 if (event) popup->popup(QCursor::pos());
81 else kdDebug() << "KOEventView::showEventPopup(): No event selected" << endl; 80 else kdDebug() << "KOEventView::showEventPopup(): No event selected" << endl;
82} 81}
83 82
84//--------------------------------------------------------------------------- 83//---------------------------------------------------------------------------
85 84
86void KOEventView::popupShow() 85void KOEventView::popupShow()
87{ 86{
88 emit showIncidenceSignal(mCurrentIncidence); 87 emit showIncidenceSignal(mCurrentIncidence);
89} 88}
90 89
91//--------------------------------------------------------------------------- 90//---------------------------------------------------------------------------
92 91
93void KOEventView::popupEdit() 92void KOEventView::popupEdit()
94{ 93{
95 emit editIncidenceSignal(mCurrentIncidence); 94 emit editIncidenceSignal(mCurrentIncidence);
96} 95}
97 96
98//--------------------------------------------------------------------------- 97//---------------------------------------------------------------------------
99 98
100void KOEventView::popupDelete() 99void KOEventView::popupDelete()
101{ 100{
102 emit deleteIncidenceSignal(mCurrentIncidence); 101 emit deleteIncidenceSignal(mCurrentIncidence);
103} 102}
104void KOEventView::popupClone() 103void KOEventView::popupClone()
105{ 104{
106 emit cloneIncidenceSignal(mCurrentIncidence); 105 emit cloneIncidenceSignal(mCurrentIncidence);
107} 106}
108void KOEventView::popupCancel() 107void KOEventView::popupCancel()
109{ 108{
110 emit cancelIncidenceSignal(mCurrentIncidence); 109 emit cancelIncidenceSignal(mCurrentIncidence);
111} 110}
112 111
113//--------------------------------------------------------------------------- 112//---------------------------------------------------------------------------
114 113
115void KOEventView::defaultAction( Incidence *incidence ) 114void KOEventView::defaultAction( Incidence *incidence )
116{ 115{
117 116
118 if ( !incidence ) return; 117 if ( !incidence ) return;
119 118
120 if ( incidence->isReadOnly() ) 119 if ( incidence->isReadOnly() )
121 emit showIncidenceSignal(incidence); 120 emit showIncidenceSignal(incidence);
122 else { 121 else {
123 if ( KOPrefs::instance()->mEditOnDoubleClick ) 122 if ( KOPrefs::instance()->mEditOnDoubleClick )
124 emit editIncidenceSignal(incidence); 123 emit editIncidenceSignal(incidence);
125 else 124 else
126 emit showIncidenceSignal(incidence); 125 emit showIncidenceSignal(incidence);
127 } 126 }
128} 127}
129 128
130//--------------------------------------------------------------------------- 129//---------------------------------------------------------------------------
131 130
132#include "baseview.moc"
133
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 9f8bd9b..bac66d3 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -1,241 +1,240 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
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 <qcstring.h>
21#include <qwhatsthis.h> 21#include <qwhatsthis.h>
22#include <qdialog.h> 22#include <qdialog.h>
23#include <qapplication.h> 23#include <qapplication.h>
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qlayout.h> 25#include <qlayout.h>
26 26
27#include <klocale.h> 27#include <klocale.h>
28#include <kapplication.h> 28#include <kapplication.h>
29#include <libkcal/event.h> 29#include <libkcal/event.h>
30#include <libkcal/todo.h> 30#include <libkcal/todo.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kiconloader.h> 32#include <kiconloader.h>
33#include <krun.h> 33#include <krun.h>
34#include <kglobal.h> 34#include <kglobal.h>
35#include <kprocess.h> 35#include <kprocess.h>
36#include "koprefs.h" 36#include "koprefs.h"
37 37
38#include <libkdepim/addresseeview.h> 38#include <libkdepim/addresseeview.h>
39#include <kabc/stdaddressbook.h> 39#include <kabc/stdaddressbook.h>
40 40
41#ifndef KORG_NODCOP 41#ifndef KORG_NODCOP
42#include <dcopclient.h> 42#include <dcopclient.h>
43#include "korganizer.h" 43#include "korganizer.h"
44#include "koprefs.h" 44#include "koprefs.h"
45#include "actionmanager.h" 45#include "actionmanager.h"
46#endif 46#endif
47 47
48#include "koeventviewer.h" 48#include "koeventviewer.h"
49#include "koeventviewer.moc"
50#ifndef KORG_NOKABC 49#ifndef KORG_NOKABC
51#include <kabc/stdaddressbook.h> 50#include <kabc/stdaddressbook.h>
52#define size count 51#define size count
53#endif 52#endif
54KOEventViewer::KOEventViewer(QWidget *parent,const char *name) 53KOEventViewer::KOEventViewer(QWidget *parent,const char *name)
55 : QTextBrowser(parent,name) 54 : QTextBrowser(parent,name)
56{ 55{
57 mSyncMode = false; 56 mSyncMode = false;
58 mColorMode = 0; 57 mColorMode = 0;
59} 58}
60 59
61KOEventViewer::~KOEventViewer() 60KOEventViewer::~KOEventViewer()
62{ 61{
63} 62}
64 63
65void KOEventViewer::setSource(const QString& n) 64void KOEventViewer::setSource(const QString& n)
66{ 65{
67 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 66 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
68 KABC::AddressBook::Iterator it; 67 KABC::AddressBook::Iterator it;
69 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 68 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
70 // LR I do not understand, why the uid string is different on zaurus and desktop 69 // LR I do not understand, why the uid string is different on zaurus and desktop
71#ifdef DESKTOP_VERSION 70#ifdef DESKTOP_VERSION
72 QString uid = "uid://"+(*it).uid(); 71 QString uid = "uid://"+(*it).uid();
73#else 72#else
74 QString uid = "uid:"+(*it).uid(); 73 QString uid = "uid:"+(*it).uid();
75#endif 74#endif
76 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); 75 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1());
77 if (n == uid ) { 76 if (n == uid ) {
78 //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); 77 //qDebug("found %s ",(*it).mobileHomePhone().latin1() );
79 QDialog dia( this,"dia123", true ); 78 QDialog dia( this,"dia123", true );
80 dia.setCaption( i18n("Details of attendee") ); 79 dia.setCaption( i18n("Details of attendee") );
81 QVBoxLayout lay ( &dia ); 80 QVBoxLayout lay ( &dia );
82 KPIM::AddresseeView av ( &dia ); 81 KPIM::AddresseeView av ( &dia );
83 av.setAddressee( (*it) ); 82 av.setAddressee( (*it) );
84 lay.addWidget( &av ); 83 lay.addWidget( &av );
85 if ( QApplication::desktop()->width() < 480 ) 84 if ( QApplication::desktop()->width() < 480 )
86 dia.resize( 220, 240); 85 dia.resize( 220, 240);
87 else { 86 else {
88 dia.resize( 400,400); 87 dia.resize( 400,400);
89 88
90 } 89 }
91 dia.exec(); 90 dia.exec();
92 break; 91 break;
93 } 92 }
94 } 93 }
95 94
96 95
97#ifndef KORG_NODCOP 96#ifndef KORG_NODCOP
98 kdDebug() << "KOEventViewer::setSource(): " << n << endl; 97 kdDebug() << "KOEventViewer::setSource(): " << n << endl;
99 QString tmpStr; 98 QString tmpStr;
100 if (n.startsWith("mailto:")) { 99 if (n.startsWith("mailto:")) {
101 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); 100 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null);
102 //emit showIncidence(n); 101 //emit showIncidence(n);
103 return; 102 return;
104 } else if (n.startsWith("uid:")) { 103 } else if (n.startsWith("uid:")) {
105 DCOPClient *client = KApplication::kApplication()->dcopClient(); 104 DCOPClient *client = KApplication::kApplication()->dcopClient();
106 const QByteArray noParamData; 105 const QByteArray noParamData;
107 const QByteArray paramData; 106 const QByteArray paramData;
108 QByteArray replyData; 107 QByteArray replyData;
109 QCString replyTypeStr; 108 QCString replyTypeStr;
110#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) 109#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData))
111 bool foundAbbrowser = PING_ABBROWSER; 110 bool foundAbbrowser = PING_ABBROWSER;
112 111
113 if (foundAbbrowser) { 112 if (foundAbbrowser) {
114 //KAddressbook is already running, so just DCOP to it to bring up the contact editor 113 //KAddressbook is already running, so just DCOP to it to bring up the contact editor
115 //client->send("kaddressbook","KAddressBookIface", 114 //client->send("kaddressbook","KAddressBookIface",
116 QDataStream arg(paramData, IO_WriteOnly); 115 QDataStream arg(paramData, IO_WriteOnly);
117 arg << n.mid(6); 116 arg << n.mid(6);
118 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); 117 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData);
119 return; 118 return;
120 } else { 119 } else {
121 /* 120 /*
122 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. 121 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater.
123 We start it without its main interface 122 We start it without its main interface
124 */ 123 */
125 KIconLoader* iconLoader = new KIconLoader(); 124 KIconLoader* iconLoader = new KIconLoader();
126 QString iconPath = iconLoader->iconPath("go",KIcon::Small); 125 QString iconPath = iconLoader->iconPath("go",KIcon::Small);
127 ActionManager::setStartedKAddressBook(true); 126 ActionManager::setStartedKAddressBook(true);
128 tmpStr = "kaddressbook --editor-only --uid "; 127 tmpStr = "kaddressbook --editor-only --uid ";
129 tmpStr += KProcess::quote(n.mid(6)); 128 tmpStr += KProcess::quote(n.mid(6));
130 KRun::runCommand(tmpStr,"KAddressBook",iconPath); 129 KRun::runCommand(tmpStr,"KAddressBook",iconPath);
131 return; 130 return;
132 } 131 }
133 } else { 132 } else {
134 //QTextBrowser::setSource(n); 133 //QTextBrowser::setSource(n);
135 } 134 }
136#endif 135#endif
137} 136}
138 137
139void KOEventViewer::addTag(const QString & tag,const QString & text) 138void KOEventViewer::addTag(const QString & tag,const QString & text)
140{ 139{
141 int number=text.contains("\n"); 140 int number=text.contains("\n");
142 QString str = "<" + tag + ">"; 141 QString str = "<" + tag + ">";
143 QString tmpText=text; 142 QString tmpText=text;
144 QString tmpStr=str; 143 QString tmpStr=str;
145 if(number !=-1) 144 if(number !=-1)
146 { 145 {
147 if (number > 0) { 146 if (number > 0) {
148 int pos=0; 147 int pos=0;
149 QString tmp; 148 QString tmp;
150 for(int i=0;i<=number;i++) { 149 for(int i=0;i<=number;i++) {
151 pos=tmpText.find("\n"); 150 pos=tmpText.find("\n");
152 tmp=tmpText.left(pos); 151 tmp=tmpText.left(pos);
153 tmpText=tmpText.right(tmpText.length()-pos-1); 152 tmpText=tmpText.right(tmpText.length()-pos-1);
154 tmpStr+=tmp+"<br>"; 153 tmpStr+=tmp+"<br>";
155 } 154 }
156 } 155 }
157 else tmpStr += tmpText; 156 else tmpStr += tmpText;
158 tmpStr+="</" + tag + ">"; 157 tmpStr+="</" + tag + ">";
159 mText.append(tmpStr); 158 mText.append(tmpStr);
160 } 159 }
161 else 160 else
162 { 161 {
163 str += text + "</" + tag + ">"; 162 str += text + "</" + tag + ">";
164 mText.append(str); 163 mText.append(str);
165 } 164 }
166} 165}
167 166
168void KOEventViewer::setColorMode( int m ) 167void KOEventViewer::setColorMode( int m )
169{ 168{
170 mColorMode = m; 169 mColorMode = m;
171} 170}
172void KOEventViewer::appendEvent(Event *event, int mode ) 171void KOEventViewer::appendEvent(Event *event, int mode )
173{ 172{
174 mCurrentIncidence = event; 173 mCurrentIncidence = event;
175 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 174 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
176 topLevelWidget()->setCaption(i18n("Event Viewer")); 175 topLevelWidget()->setCaption(i18n("Event Viewer"));
177 if ( mode == 0 ) { 176 if ( mode == 0 ) {
178 addTag("h2",event->summary()); 177 addTag("h2",event->summary());
179 } 178 }
180 else { 179 else {
181 if ( mColorMode == 1 ) { 180 if ( mColorMode == 1 ) {
182 mText +="<font color=\"#00A000\">"; 181 mText +="<font color=\"#00A000\">";
183 } 182 }
184 if ( mColorMode == 2 ) { 183 if ( mColorMode == 2 ) {
185 mText +="<font color=\"#C00000\">"; 184 mText +="<font color=\"#C00000\">";
186 } 185 }
187 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 186 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
188 if ( mode == 1 ) { 187 if ( mode == 1 ) {
189 addTag("h2",i18n( "Local: " ) +event->summary()); 188 addTag("h2",i18n( "Local: " ) +event->summary());
190 } else { 189 } else {
191 addTag("h2",i18n( "Remote: " ) +event->summary()); 190 addTag("h2",i18n( "Remote: " ) +event->summary());
192 } 191 }
193 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 192 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
194 if ( mColorMode ) 193 if ( mColorMode )
195 mText += "</font>"; 194 mText += "</font>";
196 } 195 }
197 if (event->cancelled ()) { 196 if (event->cancelled ()) {
198 mText +="<font color=\"#B00000\">"; 197 mText +="<font color=\"#B00000\">";
199 addTag("i",i18n("This event has been cancelled!")); 198 addTag("i",i18n("This event has been cancelled!"));
200 mText.append("<br>"); 199 mText.append("<br>");
201 mText += "</font>"; 200 mText += "</font>";
202 } 201 }
203 if (!event->location().isEmpty()) { 202 if (!event->location().isEmpty()) {
204 addTag("b",i18n("Location: ")); 203 addTag("b",i18n("Location: "));
205 mText.append(event->location()+"<br>"); 204 mText.append(event->location()+"<br>");
206 } 205 }
207 if (event->doesFloat()) { 206 if (event->doesFloat()) {
208 if (event->isMultiDay()) { 207 if (event->isMultiDay()) {
209 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 208 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
210 .arg(event->dtStartDateStr(shortDate)) 209 .arg(event->dtStartDateStr(shortDate))
211 .arg(event->dtEndDateStr(shortDate))); 210 .arg(event->dtEndDateStr(shortDate)));
212 } else { 211 } else {
213 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 212 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
214 } 213 }
215 } else { 214 } else {
216 if (event->isMultiDay()) { 215 if (event->isMultiDay()) {
217 mText.append(i18n("<p><b>From:</b> %1</p> ") 216 mText.append(i18n("<p><b>From:</b> %1</p> ")
218 .arg(event->dtStartStr( shortDate))); 217 .arg(event->dtStartStr( shortDate)));
219 mText.append(i18n("<p><b>To:</b> %1</p>") 218 mText.append(i18n("<p><b>To:</b> %1</p>")
220 .arg(event->dtEndStr(shortDate))); 219 .arg(event->dtEndStr(shortDate)));
221 } else { 220 } else {
222 mText.append(i18n("<p><b>On:</b> %1</p> ") 221 mText.append(i18n("<p><b>On:</b> %1</p> ")
223 .arg(event->dtStartDateStr( shortDate ))); 222 .arg(event->dtStartDateStr( shortDate )));
224 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 223 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
225 .arg(event->dtStartTimeStr()) 224 .arg(event->dtStartTimeStr())
226 .arg(event->dtEndTimeStr())); 225 .arg(event->dtEndTimeStr()));
227 } 226 }
228 } 227 }
229 228
230 if (event->recurrence()->doesRecur()) { 229 if (event->recurrence()->doesRecur()) {
231 230
232 QString recurText = event->recurrence()->recurrenceText(); 231 QString recurText = event->recurrence()->recurrenceText();
233 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 232 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
234 bool last; 233 bool last;
235 QDate start = QDate::currentDate(); 234 QDate start = QDate::currentDate();
236 QDate next; 235 QDate next;
237 next = event->recurrence()->getPreviousDate( start , &last ); 236 next = event->recurrence()->getPreviousDate( start , &last );
238 if ( !last ) { 237 if ( !last ) {
239 next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); 238 next = event->recurrence()->getNextDate( start.addDays( - 1 ) );
240 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 239 addTag("p",i18n("<b>Next recurrence is on:</b>") );
241 addTag("p", KGlobal::locale()->formatDate( next, shortDate )); 240 addTag("p", KGlobal::locale()->formatDate( next, shortDate ));
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp
index 64ab94d..be183eb 100644
--- a/korganizer/koeventviewerdialog.cpp
+++ b/korganizer/koeventviewerdialog.cpp
@@ -1,223 +1,222 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
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 <klocale.h> 20#include <klocale.h>
21 21
22#include <libkcal/event.h> 22#include <libkcal/event.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24 24
25#include "koeventviewer.h" 25#include "koeventviewer.h"
26#include "koprefs.h" 26#include "koprefs.h"
27#include <libkcal/todo.h> 27#include <libkcal/todo.h>
28#include "qapp.h" 28#include "qapp.h"
29 29
30#include "koeventviewerdialog.h" 30#include "koeventviewerdialog.h"
31#include "koeventviewerdialog.moc"
32extern int globalFlagBlockAgenda; 31extern int globalFlagBlockAgenda;
33 32
34KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) 33KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name)
35 : KDialogBase(parent,name, 34 : KDialogBase(parent,name,
36#ifndef DESKTOP_VERSION 35#ifndef DESKTOP_VERSION
37 true , 36 true ,
38#else 37#else
39 false, 38 false,
40#endif 39#endif
41 i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) 40 i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda"))
42{ 41{
43 42
44 mEventViewer = new KOEventViewer(this); 43 mEventViewer = new KOEventViewer(this);
45 mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); 44 mEventViewer->setFont( KOPrefs::instance()->mEventViewFont );
46 setMainWidget(mEventViewer); 45 setMainWidget(mEventViewer);
47 setButtonText(Ok, i18n("Edit") ); 46 setButtonText(Ok, i18n("Edit") );
48 47
49 QObject::connect(findButton( Ok ),SIGNAL(clicked()), 48 QObject::connect(findButton( Ok ),SIGNAL(clicked()),
50 SLOT(editIncidence())); 49 SLOT(editIncidence()));
51 QObject::connect(this,SIGNAL(user1Clicked()), 50 QObject::connect(this,SIGNAL(user1Clicked()),
52 SLOT(showIncidence())); 51 SLOT(showIncidence()));
53 mIncidence = 0; 52 mIncidence = 0;
54 // TODO: Set a sensible size (based on the content?). 53 // TODO: Set a sensible size (based on the content?).
55 //showMaximized(); 54 //showMaximized();
56 //qDebug("++++++++++++KOEventViewerDialog() "); 55 //qDebug("++++++++++++KOEventViewerDialog() ");
57 // if ( KOPrefs::instance()->mCompactDialogs ) { 56 // if ( KOPrefs::instance()->mCompactDialogs ) {
58// setFixedSize( 240,284 ); 57// setFixedSize( 240,284 );
59// move( 0, 15 ); 58// move( 0, 15 );
60// } else { 59// } else {
61// setMinimumSize(300,200); 60// setMinimumSize(300,200);
62// resize(320,300); 61// resize(320,300);
63// } 62// }
64 mSyncMode = false; 63 mSyncMode = false;
65 mSyncResult = 0; 64 mSyncResult = 0;
66 65
67} 66}
68 67
69KOEventViewerDialog::~KOEventViewerDialog() 68KOEventViewerDialog::~KOEventViewerDialog()
70{ 69{
71 //qDebug("-------~KOEventViewerDialog() "); 70 //qDebug("-------~KOEventViewerDialog() ");
72} 71}
73void KOEventViewerDialog::showMe() 72void KOEventViewerDialog::showMe()
74{ 73{
75 74
76#ifdef DESKTOP_VERSION 75#ifdef DESKTOP_VERSION
77 show(); 76 show();
78#else 77#else
79 showMaximized(); 78 showMaximized();
80#endif 79#endif
81 setFocus(); 80 setFocus();
82 setActiveWindow(); 81 setActiveWindow();
83 82
84} 83}
85void KOEventViewerDialog::setSyncMode( bool b ) 84void KOEventViewerDialog::setSyncMode( bool b )
86{ 85{
87 mSyncMode = b; 86 mSyncMode = b;
88 //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); 87 //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode );
89 if ( mSyncMode ) { 88 if ( mSyncMode ) {
90 findButton( Close )->setText( i18n("Cancel Sync")); 89 findButton( Close )->setText( i18n("Cancel Sync"));
91 findButton( Ok )->setText( i18n("Remote")); 90 findButton( Ok )->setText( i18n("Remote"));
92 findButton( User1 )->setText( i18n("Local")); 91 findButton( User1 )->setText( i18n("Local"));
93 } else { 92 } else {
94 findButton( Close )->setText( i18n("Close")); 93 findButton( Close )->setText( i18n("Close"));
95 findButton( Ok )->setText( i18n("Edit")); 94 findButton( Ok )->setText( i18n("Edit"));
96 findButton( User1 )->setText( i18n("Agenda")); 95 findButton( User1 )->setText( i18n("Agenda"));
97 } 96 }
98 mEventViewer->setSyncMode( b ); 97 mEventViewer->setSyncMode( b );
99} 98}
100void KOEventViewerDialog::setColorMode( int m ) 99void KOEventViewerDialog::setColorMode( int m )
101{ 100{
102 mEventViewer->setColorMode( m ); 101 mEventViewer->setColorMode( m );
103} 102}
104int KOEventViewerDialog::executeS( bool local ) 103int KOEventViewerDialog::executeS( bool local )
105{ 104{
106 mSyncResult = 3; 105 mSyncResult = 3;
107 if ( local ) 106 if ( local )
108 findButton( User1 )->setFocus(); 107 findButton( User1 )->setFocus();
109 else 108 else
110 findButton( Ok )->setFocus(); 109 findButton( Ok )->setFocus();
111 exec(); 110 exec();
112 return mSyncResult; 111 return mSyncResult;
113} 112}
114 113
115void KOEventViewerDialog::updateConfig() 114void KOEventViewerDialog::updateConfig()
116{ 115{
117 mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); 116 mEventViewer->setFont( KOPrefs::instance()->mEventViewFont );
118 117
119} 118}
120void KOEventViewerDialog::setEvent(Event *event) 119void KOEventViewerDialog::setEvent(Event *event)
121{ 120{
122 mEventViewer->setEvent(event); 121 mEventViewer->setEvent(event);
123 mIncidence = event; 122 mIncidence = event;
124 findButton( Close )->setFocus(); 123 findButton( Close )->setFocus();
125} 124}
126void KOEventViewerDialog::setIncidence(Incidence *in ) 125void KOEventViewerDialog::setIncidence(Incidence *in )
127{ 126{
128 if ( in->type() == "Event" ) 127 if ( in->type() == "Event" )
129 setEvent( (Event*) in ); 128 setEvent( (Event*) in );
130 else if ( in->type() =="Todo" ) 129 else if ( in->type() =="Todo" )
131 setTodo( (Todo*) in ); 130 setTodo( (Todo*) in );
132 else if ( in->type() =="Journal" ) 131 else if ( in->type() =="Journal" )
133 setJournal( (Journal*) in ); 132 setJournal( (Journal*) in );
134} 133}
135void KOEventViewerDialog::addIncidence(Incidence *in) 134void KOEventViewerDialog::addIncidence(Incidence *in)
136{ 135{
137 if ( in->type() == "Event" ) 136 if ( in->type() == "Event" )
138 addEvent( (Event*) in ); 137 addEvent( (Event*) in );
139 else if ( in->type() =="Todo" ) 138 else if ( in->type() =="Todo" )
140 mEventViewer->setTodo( (Todo*) in, false ); 139 mEventViewer->setTodo( (Todo*) in, false );
141 else if ( in->type() =="Journal" ) 140 else if ( in->type() =="Journal" )
142 mEventViewer->setJournal( (Journal*) in, false ); 141 mEventViewer->setJournal( (Journal*) in, false );
143 if ( mSyncMode ) { 142 if ( mSyncMode ) {
144 findButton( User1 )->setFocus(); 143 findButton( User1 )->setFocus();
145 setCaption(i18n("Conflict! Please choose entry")); 144 setCaption(i18n("Conflict! Please choose entry"));
146 } 145 }
147} 146}
148 147
149void KOEventViewerDialog::addEvent(Event *event) 148void KOEventViewerDialog::addEvent(Event *event)
150{ 149{
151 mEventViewer->addEvent(event); 150 mEventViewer->addEvent(event);
152 mIncidence = event; 151 mIncidence = event;
153 findButton( Close )->setFocus(); 152 findButton( Close )->setFocus();
154} 153}
155 154
156void KOEventViewerDialog::setTodo(Todo *event) 155void KOEventViewerDialog::setTodo(Todo *event)
157{ 156{
158 mEventViewer->setTodo(event); 157 mEventViewer->setTodo(event);
159 mIncidence = (Incidence*)event; 158 mIncidence = (Incidence*)event;
160 findButton( Close )->setFocus(); 159 findButton( Close )->setFocus();
161} 160}
162void KOEventViewerDialog::setJournal(Journal *j) 161void KOEventViewerDialog::setJournal(Journal *j)
163{ 162{
164 mEventViewer->setJournal(j); 163 mEventViewer->setJournal(j);
165 mIncidence = (Incidence*)j; 164 mIncidence = (Incidence*)j;
166 findButton( Close )->setFocus(); 165 findButton( Close )->setFocus();
167} 166}
168 167
169void KOEventViewerDialog::addText(QString text) 168void KOEventViewerDialog::addText(QString text)
170{ 169{
171 mEventViewer->addText(text); 170 mEventViewer->addText(text);
172 findButton( Close )->setFocus(); 171 findButton( Close )->setFocus();
173} 172}
174void KOEventViewerDialog::editIncidence() 173void KOEventViewerDialog::editIncidence()
175{ 174{
176 if ( mSyncMode ) { 175 if ( mSyncMode ) {
177 mSyncResult = 2; 176 mSyncResult = 2;
178 accept(); 177 accept();
179 return; 178 return;
180 } 179 }
181 if ( mIncidence ){ 180 if ( mIncidence ){
182#ifndef DESKTOP_VERSION 181#ifndef DESKTOP_VERSION
183 hide(); 182 hide();
184#endif 183#endif
185 emit editIncidence( mIncidence ); 184 emit editIncidence( mIncidence );
186 } 185 }
187} 186}
188void KOEventViewerDialog::showIncidence() 187void KOEventViewerDialog::showIncidence()
189{ 188{
190 189
191 if ( mSyncMode ) { 190 if ( mSyncMode ) {
192 mSyncResult = 1; 191 mSyncResult = 1;
193 accept(); 192 accept();
194 return; 193 return;
195 } 194 }
196 195
197 if ( mIncidence ){ 196 if ( mIncidence ){
198#ifndef DESKTOP_VERSION 197#ifndef DESKTOP_VERSION
199 hide(); 198 hide();
200#endif 199#endif
201 QDate date; 200 QDate date;
202 if ( mIncidence->type() == "Todo" ) { 201 if ( mIncidence->type() == "Todo" ) {
203 if ( ((Todo*)mIncidence)->hasDueDate() ) 202 if ( ((Todo*)mIncidence)->hasDueDate() )
204 date = ((Todo*)mIncidence)->dtDue().date(); 203 date = ((Todo*)mIncidence)->dtDue().date();
205 else { 204 else {
206 globalFlagBlockAgenda = 2; 205 globalFlagBlockAgenda = 2;
207 emit showAgendaView( false ); 206 emit showAgendaView( false );
208 return; 207 return;
209 } 208 }
210 } else 209 } else
211 date = mIncidence->dtStart().date(); 210 date = mIncidence->dtStart().date();
212 globalFlagBlockAgenda = 1; 211 globalFlagBlockAgenda = 1;
213 emit showAgendaView( false ); 212 emit showAgendaView( false );
214 globalFlagBlockAgenda = 2; 213 globalFlagBlockAgenda = 2;
215 emit jumpToTime( date ); 214 emit jumpToTime( date );
216 } 215 }
217} 216}
218void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) 217void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e )
219{ 218{
220 switch ( e->key() ) { 219 switch ( e->key() ) {
221 220
222 case Qt::Key_A : 221 case Qt::Key_A :
223 case Qt::Key_L : 222 case Qt::Key_L :
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index b22bc54..1479208 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -1,96 +1,95 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
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 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 27
28#include <libkcal/calfilter.h> 28#include <libkcal/calfilter.h>
29 29
30#include "kofilterview.h" 30#include "kofilterview.h"
31#include "kofilterview.moc"
32 31
33KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, 32KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent,
34 const char* name,WFlags fl ) 33 const char* name,WFlags fl )
35 : KOFilterView_base(parent,name,fl) 34 : KOFilterView_base(parent,name,fl)
36{ 35{
37 mFilters = filterList; 36 mFilters = filterList;
38 37
39 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); 38 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged()));
40 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); 39 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged()));
41 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); 40 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters()));
42} 41}
43 42
44KOFilterView::~KOFilterView() 43KOFilterView::~KOFilterView()
45{ 44{
46 // no need to delete child widgets, Qt does it all for us 45 // no need to delete child widgets, Qt does it all for us
47} 46}
48 47
49bool KOFilterView::filtersEnabled() 48bool KOFilterView::filtersEnabled()
50{ 49{
51 return mEnabledCheck->isChecked(); 50 return mEnabledCheck->isChecked();
52} 51}
53 52
54void KOFilterView::setFiltersEnabled(bool set) 53void KOFilterView::setFiltersEnabled(bool set)
55{ 54{
56 mEnabledCheck->setChecked(set); 55 mEnabledCheck->setChecked(set);
57 emit filterChanged(); 56 emit filterChanged();
58} 57}
59 58
60 59
61void KOFilterView::updateFilters() 60void KOFilterView::updateFilters()
62{ 61{
63 mSelectionCombo->clear(); 62 mSelectionCombo->clear();
64 63
65 CalFilter *filter = mFilters->first(); 64 CalFilter *filter = mFilters->first();
66 while(filter) { 65 while(filter) {
67 mSelectionCombo->insertItem(filter->name()); 66 mSelectionCombo->insertItem(filter->name());
68 filter = mFilters->next(); 67 filter = mFilters->next();
69 } 68 }
70} 69}
71 70
72CalFilter *KOFilterView::selectedFilter() 71CalFilter *KOFilterView::selectedFilter()
73{ 72{
74 CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); 73 CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
75 return f; 74 return f;
76} 75}
77 76
78void KOFilterView::setSelectedFilter(QString filterName) 77void KOFilterView::setSelectedFilter(QString filterName)
79{ 78{
80 int filter_num = mSelectionCombo->count(); 79 int filter_num = mSelectionCombo->count();
81 int i; 80 int i;
82 for (i=0;i<filter_num;i++) { 81 for (i=0;i<filter_num;i++) {
83 if (mSelectionCombo->text(i)==filterName) 82 if (mSelectionCombo->text(i)==filterName)
84 mSelectionCombo->setCurrentItem(i); 83 mSelectionCombo->setCurrentItem(i);
85 } 84 }
86 emit filterChanged(); 85 emit filterChanged();
87} 86}
88void KOFilterView::setSelectedFilter( int fil ) 87void KOFilterView::setSelectedFilter( int fil )
89{ 88{
90 if ( fil >= mSelectionCombo->count() ) 89 if ( fil >= mSelectionCombo->count() )
91 return; 90 return;
92 mSelectionCombo->setCurrentItem( fil ); 91 mSelectionCombo->setCurrentItem( fil );
93 emit filterChanged(); 92 emit filterChanged();
94} 93}
95 94
96 95
diff --git a/korganizer/koincidenceeditor.cpp b/korganizer/koincidenceeditor.cpp
index e10a188..51df123 100644
--- a/korganizer/koincidenceeditor.cpp
+++ b/korganizer/koincidenceeditor.cpp
@@ -1,187 +1,186 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
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 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 <qframe.h>
26#include <qpixmap.h> 26#include <qpixmap.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qwidgetstack.h> 28#include <qwidgetstack.h>
29#include <qdatetime.h> 29#include <qdatetime.h>
30#include <qdir.h> 30#include <qdir.h>
31 31
32#include <kdebug.h> 32#include <kdebug.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kstandarddirs.h> 34#include <kstandarddirs.h>
35#include <kmessagebox.h> 35#include <kmessagebox.h>
36#include <kfiledialog.h> 36#include <kfiledialog.h>
37 37
38#include <libkdepim/categoryselectdialog.h> 38#include <libkdepim/categoryselectdialog.h>
39#include <libkdepim/kinputdialog.h> 39#include <libkdepim/kinputdialog.h>
40 40
41#include <libkcal/calendarlocal.h> 41#include <libkcal/calendarlocal.h>
42#include <libkcal/icalformat.h> 42#include <libkcal/icalformat.h>
43 43
44#include "koprefs.h" 44#include "koprefs.h"
45#include "koglobals.h" 45#include "koglobals.h"
46 46
47#include "koincidenceeditor.h" 47#include "koincidenceeditor.h"
48#include "koincidenceeditor.moc"
49 48
50KOIncidenceEditor::KOIncidenceEditor( const QString &caption, 49KOIncidenceEditor::KOIncidenceEditor( const QString &caption,
51 Calendar *calendar, QWidget *parent ) : 50 Calendar *calendar, QWidget *parent ) :
52 KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok, 51 KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok,
53 parent, caption, true, false ), 52 parent, caption, true, false ),
54 mSaveTemplateDialog( 0 ) 53 mSaveTemplateDialog( 0 )
55{ 54{
56 mCalendar = calendar; 55 mCalendar = calendar;
57 56
58 setButtonText( Default, i18n("Template...") ); 57 setButtonText( Default, i18n("Template...") );
59 58
60 QString saveTemplateText; 59 QString saveTemplateText;
61 // if ( KOPrefs::instance()->mCompactDialogs ) { 60 // if ( KOPrefs::instance()->mCompactDialogs ) {
62// showButton( User1, false ); 61// showButton( User1, false );
63// showButton( Apply, false ); 62// showButton( Apply, false );
64// } else { 63// } else {
65 showButton( Apply, false ); 64 showButton( Apply, false );
66 saveTemplateText = i18n("Ok+Agenda"); 65 saveTemplateText = i18n("Ok+Agenda");
67 // } 66 // }
68 setButtonText( User1, saveTemplateText ); 67 setButtonText( User1, saveTemplateText );
69 68
70 //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this ); 69 //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this );
71 // KOGlobals::fitDialogToScreen( mCategoryDialog ); 70 // KOGlobals::fitDialogToScreen( mCategoryDialog );
72 71
73 //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories())); 72 //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories()));
74 73
75 //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) ); 74 //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) );
76 // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) ); 75 // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) );
77 connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) ); 76 connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) );
78} 77}
79 78
80KOIncidenceEditor::~KOIncidenceEditor() 79KOIncidenceEditor::~KOIncidenceEditor()
81{ 80{
82 //delete mCategoryDialog; 81 //delete mCategoryDialog;
83} 82}
84 83
85void KOIncidenceEditor::setupAttendeesTab() 84void KOIncidenceEditor::setupAttendeesTab()
86{ 85{
87 QFrame *topFrame = addPage(i18n("Attendees")); 86 QFrame *topFrame = addPage(i18n("Attendees"));
88 87
89 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 88 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
90 89
91 mDetails = new KOEditorDetails(spacingHint(),topFrame); 90 mDetails = new KOEditorDetails(spacingHint(),topFrame);
92 topLayout->addWidget(mDetails); 91 topLayout->addWidget(mDetails);
93} 92}
94 93
95 94
96void KOIncidenceEditor::slotApply() 95void KOIncidenceEditor::slotApply()
97{ 96{
98 processInput( false ); 97 processInput( false );
99} 98}
100void KOIncidenceEditor::accept() 99void KOIncidenceEditor::accept()
101{ 100{
102 slotOk(); 101 slotOk();
103} 102}
104void KOIncidenceEditor::slotOk() 103void KOIncidenceEditor::slotOk()
105{ 104{
106 if ( processInput( false ) ) QDialog::accept(); 105 if ( processInput( false ) ) QDialog::accept();
107} 106}
108 107
109void KOIncidenceEditor::updateCategoryConfig() 108void KOIncidenceEditor::updateCategoryConfig()
110{ 109{
111 qDebug("KOIncidenceEditor::updateCategoryConfig() is dead! "); 110 qDebug("KOIncidenceEditor::updateCategoryConfig() is dead! ");
112 //mCategoryDialog->updateCategoryConfig(); 111 //mCategoryDialog->updateCategoryConfig();
113} 112}
114 113
115void KOIncidenceEditor::slotCancel() 114void KOIncidenceEditor::slotCancel()
116{ 115{
117 reject(); 116 reject();
118} 117}
119 118
120void KOIncidenceEditor::slotLoadTemplate() 119void KOIncidenceEditor::slotLoadTemplate()
121{ 120{
122 kdDebug() << "KOIncidenceEditor::loadTemplate()" << endl; 121 kdDebug() << "KOIncidenceEditor::loadTemplate()" << endl;
123} 122}
124void KOIncidenceEditor::slotShowIncidence() 123void KOIncidenceEditor::slotShowIncidence()
125{ 124{
126 125
127 if ( processInput(true ) ) { 126 if ( processInput(true ) ) {
128 accept(); 127 accept();
129 } 128 }
130} 129}
131 130
132void KOIncidenceEditor::slotSaveTemplate() 131void KOIncidenceEditor::slotSaveTemplate()
133{ 132{
134 kdDebug() << "KOIncidenceEditor::saveTemplate()" << endl; 133 kdDebug() << "KOIncidenceEditor::saveTemplate()" << endl;
135} 134}
136 135
137void KOIncidenceEditor::createSaveTemplateDialog( SaveTemplateDialog::IncidenceType type ) 136void KOIncidenceEditor::createSaveTemplateDialog( SaveTemplateDialog::IncidenceType type )
138{ 137{
139 if ( !mSaveTemplateDialog ) { 138 if ( !mSaveTemplateDialog ) {
140 mSaveTemplateDialog = new SaveTemplateDialog( type, this ); 139 mSaveTemplateDialog = new SaveTemplateDialog( type, this );
141 connect( mSaveTemplateDialog, SIGNAL( templateSelected( const QString & ) ), 140 connect( mSaveTemplateDialog, SIGNAL( templateSelected( const QString & ) ),
142 SLOT( saveTemplate( const QString & ) ) ); 141 SLOT( saveTemplate( const QString & ) ) );
143 } 142 }
144 mSaveTemplateDialog->show(); 143 mSaveTemplateDialog->show();
145 mSaveTemplateDialog->raise(); 144 mSaveTemplateDialog->raise();
146} 145}
147 146
148void KOIncidenceEditor::saveAsTemplate( Incidence *incidence, 147void KOIncidenceEditor::saveAsTemplate( Incidence *incidence,
149 const QString &templateName ) 148 const QString &templateName )
150{ 149{
151 CalendarLocal cal; 150 CalendarLocal cal;
152 cal.addIncidence( incidence ); 151 cal.addIncidence( incidence );
153 ICalFormat format; 152 ICalFormat format;
154 format.save( &cal, templateName ); 153 format.save( &cal, templateName );
155} 154}
156 155
157QString KOIncidenceEditor::loadTemplate( Calendar *cal, const QString &type, 156QString KOIncidenceEditor::loadTemplate( Calendar *cal, const QString &type,
158 const QStringList &templates ) 157 const QStringList &templates )
159{ 158{
160 // bool ok = false; 159 // bool ok = false;
161// QString templateName = KInputDialog::getItem( i18n("Load Template"), 160// QString templateName = KInputDialog::getItem( i18n("Load Template"),
162// i18n("Select a template to load:"), templates, 0, &ok ); 161// i18n("Select a template to load:"), templates, 0, &ok );
163// if ( !ok || templateName.isEmpty() ) return QString::null; 162// if ( !ok || templateName.isEmpty() ) return QString::null;
164 163
165// QString fileName = locateLocal( "data", "korganizer/templates/" + type + "/" + 164// QString fileName = locateLocal( "data", "korganizer/templates/" + type + "/" +
166// templateName ); 165// templateName );
167// fn =KFileDialog:: getOpenFileName( fn, "Import filename(*.ics/*.vcs)", this ); 166// fn =KFileDialog:: getOpenFileName( fn, "Import filename(*.ics/*.vcs)", this );
168 167
169 // QString fileName;// =locateLocal( "templates", incidence->type() ); 168 // QString fileName;// =locateLocal( "templates", incidence->type() );
170// fileName=KFileDialog:: getOpenFileName( fileName, "Load "+incidence()->type(), this ); 169// fileName=KFileDialog:: getOpenFileName( fileName, "Load "+incidence()->type(), this );
171// if ( fileNamelength() == 0) 170// if ( fileNamelength() == 0)
172// return QString::null; 171// return QString::null;
173// if ( fileName.isEmpty() ) { 172// if ( fileName.isEmpty() ) {
174// KMessageBox::error( this, i18n("Unable to find template '%1'.") 173// KMessageBox::error( this, i18n("Unable to find template '%1'.")
175// .arg( fileName ) ); 174// .arg( fileName ) );
176// return QString::null; 175// return QString::null;
177// } else { 176// } else {
178// ICalFormat format; 177// ICalFormat format;
179// if ( !format.load( cal, fileName ) ) { 178// if ( !format.load( cal, fileName ) ) {
180// KMessageBox::error( this, i18n("Error loading template file '%1'.") 179// KMessageBox::error( this, i18n("Error loading template file '%1'.")
181// .arg( fileName ) ); 180// .arg( fileName ) );
182// return QString::null; 181// return QString::null;
183// } 182// }
184// } 183// }
185 184
186 return ""; 185 return "";
187} 186}
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index 579f24d..6e6a939 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -1,113 +1,112 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
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 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 <qpopupmenu.h> 28#include <qpopupmenu.h>
29 29
30#include <klocale.h> 30#include <klocale.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include "koprefs.h" 32#include "koprefs.h"
33 33
34#include <libkcal/calendar.h> 34#include <libkcal/calendar.h>
35 35
36#include "journalentry.h" 36#include "journalentry.h"
37 37
38#include "kojournalview.h" 38#include "kojournalview.h"
39using namespace KOrg; 39using namespace KOrg;
40#include "kojournalview.moc"
41 40
42KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, 41KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent,
43 const char *name) 42 const char *name)
44 : KOrg::BaseView(calendar, parent, name) 43 : KOrg::BaseView(calendar, parent, name)
45{ 44{
46 mEntry = new JournalEntry(calendar,this); 45 mEntry = new JournalEntry(calendar,this);
47 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 46 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
48 QBoxLayout *topLayout = new QVBoxLayout(this); 47 QBoxLayout *topLayout = new QVBoxLayout(this);
49 topLayout->addWidget(mEntry); 48 topLayout->addWidget(mEntry);
50 connect ( mEntry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; 49 connect ( mEntry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ;
51} 50}
52 51
53KOJournalView::~KOJournalView() 52KOJournalView::~KOJournalView()
54{ 53{
55} 54}
56 55
57int KOJournalView::currentDateCount() 56int KOJournalView::currentDateCount()
58{ 57{
59 return 0; 58 return 0;
60} 59}
61 60
62QPtrList<Incidence> KOJournalView::selectedIncidences() 61QPtrList<Incidence> KOJournalView::selectedIncidences()
63{ 62{
64 QPtrList<Incidence> eventList; 63 QPtrList<Incidence> eventList;
65 64
66 return eventList; 65 return eventList;
67} 66}
68void KOJournalView::updateConfig() 67void KOJournalView::updateConfig()
69{ 68{
70 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 69 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
71} 70}
72void KOJournalView::updateView() 71void KOJournalView::updateView()
73{ 72{
74 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 73 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
75} 74}
76 75
77void KOJournalView::flushView() 76void KOJournalView::flushView()
78{ 77{
79 mEntry->flushEntry(); 78 mEntry->flushEntry();
80} 79}
81 80
82void KOJournalView::showDates(const QDate &start, const QDate &) 81void KOJournalView::showDates(const QDate &start, const QDate &)
83{ 82{
84// kdDebug() << "KOJournalView::selectDates()" << endl; 83// kdDebug() << "KOJournalView::selectDates()" << endl;
85 84
86 mEntry->setDate(start); 85 mEntry->setDate(start);
87 86
88 Journal *j = calendar()->journal(start); 87 Journal *j = calendar()->journal(start);
89 if (j) mEntry->setJournal(j); 88 if (j) mEntry->setJournal(j);
90 else mEntry->clear(); 89 else mEntry->clear();
91 90
92// emit incidenceSelected( 0 ); 91// emit incidenceSelected( 0 );
93} 92}
94 93
95void KOJournalView::showEvents(QPtrList<Event>) 94void KOJournalView::showEvents(QPtrList<Event>)
96{ 95{
97 // After new creation of list view no events are selected. 96 // After new creation of list view no events are selected.
98// emit incidenceSelected( 0 ); 97// emit incidenceSelected( 0 );
99} 98}
100 99
101void KOJournalView::changeEventDisplay(Event *, int /*action*/) 100void KOJournalView::changeEventDisplay(Event *, int /*action*/)
102{ 101{
103 updateView(); 102 updateView();
104} 103}
105 104
106void KOJournalView::keyPressEvent ( QKeyEvent * e ) 105void KOJournalView::keyPressEvent ( QKeyEvent * e )
107{ 106{
108 //qDebug("keyPressEven "); 107 //qDebug("keyPressEven ");
109 if ( e->state() == Qt::ControlButton ) { 108 if ( e->state() == Qt::ControlButton ) {
110 if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left ) 109 if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left )
111 e->ignore(); 110 e->ignore();
112 } 111 }
113} 112}
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index b6061d0..9a3ba73 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1,254 +1,253 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1999 Preston Brown 3 Copyright (c) 1999 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 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 7 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 8 the Free Software Foundation; either version 2 of the License, or
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 <qlistview.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qprogressbar.h> 29#include <qprogressbar.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 <qtextstream.h>
34#include <qdir.h> 34#include <qdir.h>
35 35
36#include <klocale.h> 36#include <klocale.h>
37#include <kdebug.h> 37#include <kdebug.h>
38#include <kiconloader.h> 38#include <kiconloader.h>
39#include <kglobal.h> 39#include <kglobal.h>
40 40
41#include <libkcal/calendar.h> 41#include <libkcal/calendar.h>
42#include <libkcal/calendarlocal.h> 42#include <libkcal/calendarlocal.h>
43#include <libkcal/icalformat.h> 43#include <libkcal/icalformat.h>
44#include <libkcal/vcalformat.h> 44#include <libkcal/vcalformat.h>
45#include <libkcal/recurrence.h> 45#include <libkcal/recurrence.h>
46#include <libkcal/filestorage.h> 46#include <libkcal/filestorage.h>
47#include <libkdepim/categoryselectdialog.h> 47#include <libkdepim/categoryselectdialog.h>
48#ifndef DESKTOP_VERSION 48#ifndef DESKTOP_VERSION
49#include <qpe/qpeapplication.h> 49#include <qpe/qpeapplication.h>
50#else 50#else
51#include <qapplication.h> 51#include <qapplication.h>
52#endif 52#endif
53 53
54#ifndef KORG_NOPRINTER 54#ifndef KORG_NOPRINTER
55#include "calprinter.h" 55#include "calprinter.h"
56#endif 56#endif
57#include "koglobals.h" 57#include "koglobals.h"
58#include "koprefs.h" 58#include "koprefs.h"
59#include "kfiledialog.h" 59#include "kfiledialog.h"
60 60
61#include "kolistview.h" 61#include "kolistview.h"
62#include "kolistview.moc"
63 62
64ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 63ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
65{ 64{
66 mItem = item; 65 mItem = item;
67 mDate = date; 66 mDate = date;
68} 67}
69 68
70ListItemVisitor::~ListItemVisitor() 69ListItemVisitor::~ListItemVisitor()
71{ 70{
72} 71}
73 72
74bool ListItemVisitor::visit(Event *e) 73bool ListItemVisitor::visit(Event *e)
75{ 74{
76 75
77 bool ok = false; 76 bool ok = false;
78 QString start, end; 77 QString start, end;
79 if ( e->doesRecur() ) { 78 if ( e->doesRecur() ) {
80 QDate d = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); 79 QDate d = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
81 if ( ok ) { 80 if ( ok ) {
82 int days = e->dtStart().date().daysTo(e->dtEnd().date() ); 81 int days = e->dtStart().date().daysTo(e->dtEnd().date() );
83 start = KGlobal::locale()->formatDate(d,true); 82 start = KGlobal::locale()->formatDate(d,true);
84 end = KGlobal::locale()->formatDate(d.addDays( days),true); 83 end = KGlobal::locale()->formatDate(d.addDays( days),true);
85 } 84 }
86 85
87 } 86 }
88 if ( ! ok ) { 87 if ( ! ok ) {
89 start =e->dtStartDateStr(); 88 start =e->dtStartDateStr();
90 end = e->dtEndDateStr(); 89 end = e->dtEndDateStr();
91 } 90 }
92 mItem->setText(0,e->summary()); 91 mItem->setText(0,e->summary());
93 mItem->setText(1,start); 92 mItem->setText(1,start);
94 mItem->setText(2,e->dtStartTimeStr()); 93 mItem->setText(2,e->dtStartTimeStr());
95 mItem->setText(3,end); 94 mItem->setText(3,end);
96 mItem->setText(4,e->dtEndTimeStr()); 95 mItem->setText(4,e->dtEndTimeStr());
97 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); 96 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
98 mItem->setText(6, e->recurrence()->recurrenceText()); 97 mItem->setText(6, e->recurrence()->recurrenceText());
99 mItem->setText(7,"---"); 98 mItem->setText(7,"---");
100 mItem->setText(8,"---"); 99 mItem->setText(8,"---");
101 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 100 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
102 mItem->setText(10,e->categoriesStr()); 101 mItem->setText(10,e->categoriesStr());
103 102
104 QString key; 103 QString key;
105 QDate d = e->dtStart().date(); 104 QDate d = e->dtStart().date();
106 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 105 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
107 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute()); 106 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute());
108 mItem->setSortKey(1,key); 107 mItem->setSortKey(1,key);
109 108
110 d = e->dtEnd().date(); 109 d = e->dtEnd().date();
111 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); 110 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time();
112 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute()); 111 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute());
113 mItem->setSortKey(3,key); 112 mItem->setSortKey(3,key);
114 113
115 return true; 114 return true;
116} 115}
117 116
118bool ListItemVisitor::visit(Todo *t) 117bool ListItemVisitor::visit(Todo *t)
119{ 118{
120 mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); 119 mItem->setText(0,i18n("To-Do: %1").arg(t->summary()));
121 if (t->hasStartDate()) { 120 if (t->hasStartDate()) {
122 mItem->setText(1,t->dtStartDateStr()); 121 mItem->setText(1,t->dtStartDateStr());
123 if (t->doesFloat()) { 122 if (t->doesFloat()) {
124 mItem->setText(2,"---"); 123 mItem->setText(2,"---");
125 } else { 124 } else {
126 mItem->setText(2,t->dtStartTimeStr()); 125 mItem->setText(2,t->dtStartTimeStr());
127 } 126 }
128 } else { 127 } else {
129 mItem->setText(1,"---"); 128 mItem->setText(1,"---");
130 mItem->setText(2,"---"); 129 mItem->setText(2,"---");
131 } 130 }
132 mItem->setText(3,"---"); 131 mItem->setText(3,"---");
133 mItem->setText(4,"---"); 132 mItem->setText(4,"---");
134 mItem->setText(5,"---"); 133 mItem->setText(5,"---");
135 mItem->setText(6,"---"); 134 mItem->setText(6,"---");
136 if (t->hasDueDate()) { 135 if (t->hasDueDate()) {
137 mItem->setText(7,t->dtDueDateStr()); 136 mItem->setText(7,t->dtDueDateStr());
138 if (t->doesFloat()) { 137 if (t->doesFloat()) {
139 mItem->setText(8,"---"); 138 mItem->setText(8,"---");
140 } else { 139 } else {
141 mItem->setText(8,t->dtDueTimeStr()); 140 mItem->setText(8,t->dtDueTimeStr());
142 } 141 }
143 } else { 142 } else {
144 mItem->setText(7,"---"); 143 mItem->setText(7,"---");
145 mItem->setText(8,"---"); 144 mItem->setText(8,"---");
146 } 145 }
147 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 146 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
148 mItem->setText(10,t->categoriesStr()); 147 mItem->setText(10,t->categoriesStr());
149 148
150 QString key; 149 QString key;
151 QDate d; 150 QDate d;
152 if (t->hasDueDate()) { 151 if (t->hasDueDate()) {
153 d = t->dtDue().date(); 152 d = t->dtDue().date();
154 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 153 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
155 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 154 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
156 mItem->setSortKey(7,key); 155 mItem->setSortKey(7,key);
157 } 156 }
158 if ( t->hasStartDate() ) { 157 if ( t->hasStartDate() ) {
159 d = t->dtStart().date(); 158 d = t->dtStart().date();
160 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 159 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
161 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 160 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
162 mItem->setSortKey(1,key); 161 mItem->setSortKey(1,key);
163 } 162 }
164 return true; 163 return true;
165} 164}
166 165
167bool ListItemVisitor::visit(Journal * j) 166bool ListItemVisitor::visit(Journal * j)
168{ 167{
169 mItem->setText(0,i18n("Journal")); 168 mItem->setText(0,i18n("Journal"));
170 mItem->setText(1,j->dtStartDateStr()); 169 mItem->setText(1,j->dtStartDateStr());
171 mItem->setText(2,"---"); 170 mItem->setText(2,"---");
172 mItem->setText(3,"---"); 171 mItem->setText(3,"---");
173 mItem->setText(4,"---"); 172 mItem->setText(4,"---");
174 mItem->setText(5,"---"); 173 mItem->setText(5,"---");
175 mItem->setText(6,"---"); 174 mItem->setText(6,"---");
176 mItem->setText(7,j->dtStartDateStr()); 175 mItem->setText(7,j->dtStartDateStr());
177 mItem->setText(8,"---"); 176 mItem->setText(8,"---");
178 mItem->setText(9,"---"); 177 mItem->setText(9,"---");
179 178
180 QString key; 179 QString key;
181 QDate d = j->dtStart().date(); 180 QDate d = j->dtStart().date();
182 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 181 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
183 mItem->setSortKey(1,key); 182 mItem->setSortKey(1,key);
184 mItem->setSortKey(7,key); 183 mItem->setSortKey(7,key);
185 184
186 return true; 185 return true;
187} 186}
188 187
189KOListView::KOListView(Calendar *calendar, QWidget *parent, 188KOListView::KOListView(Calendar *calendar, QWidget *parent,
190 const char *name) 189 const char *name)
191 : KOEventView(calendar, parent, name) 190 : KOEventView(calendar, parent, name)
192{ 191{
193 mActiveItem = 0; 192 mActiveItem = 0;
194 mListView = new KOListViewListView(this); 193 mListView = new KOListViewListView(this);
195 mListView->addColumn(i18n("Summary")); 194 mListView->addColumn(i18n("Summary"));
196 mListView->addColumn(i18n("Start Date")); 195 mListView->addColumn(i18n("Start Date"));
197 mListView->addColumn(i18n("Start Time")); 196 mListView->addColumn(i18n("Start Time"));
198 mListView->addColumn(i18n("End Date")); 197 mListView->addColumn(i18n("End Date"));
199 mListView->addColumn(i18n("End Time")); 198 mListView->addColumn(i18n("End Time"));
200 mListView->addColumn(i18n("Alarm")); // alarm set? 199 mListView->addColumn(i18n("Alarm")); // alarm set?
201 mListView->addColumn(i18n("Recurs")); // recurs? 200 mListView->addColumn(i18n("Recurs")); // recurs?
202 mListView->addColumn(i18n("Due Date")); 201 mListView->addColumn(i18n("Due Date"));
203 mListView->addColumn(i18n("Due Time")); 202 mListView->addColumn(i18n("Due Time"));
204 mListView->addColumn(i18n("Cancelled")); 203 mListView->addColumn(i18n("Cancelled"));
205 mListView->addColumn(i18n("Categories")); 204 mListView->addColumn(i18n("Categories"));
206 205
207 mListView->setColumnAlignment(0,AlignLeft); 206 mListView->setColumnAlignment(0,AlignLeft);
208 mListView->setColumnAlignment(1,AlignLeft); 207 mListView->setColumnAlignment(1,AlignLeft);
209 mListView->setColumnAlignment(2,AlignHCenter); 208 mListView->setColumnAlignment(2,AlignHCenter);
210 mListView->setColumnAlignment(3,AlignLeft); 209 mListView->setColumnAlignment(3,AlignLeft);
211 mListView->setColumnAlignment(4,AlignHCenter); 210 mListView->setColumnAlignment(4,AlignHCenter);
212 mListView->setColumnAlignment(5,AlignLeft); 211 mListView->setColumnAlignment(5,AlignLeft);
213 mListView->setColumnAlignment(6,AlignLeft); 212 mListView->setColumnAlignment(6,AlignLeft);
214 mListView->setColumnAlignment(7,AlignLeft); 213 mListView->setColumnAlignment(7,AlignLeft);
215 mListView->setColumnAlignment(8,AlignLeft); 214 mListView->setColumnAlignment(8,AlignLeft);
216 mListView->setColumnAlignment(9,AlignLeft); 215 mListView->setColumnAlignment(9,AlignLeft);
217 mListView->setColumnAlignment(10,AlignLeft); 216 mListView->setColumnAlignment(10,AlignLeft);
218 217
219 int iii = 0; 218 int iii = 0;
220 for ( iii = 0; iii< 10 ; ++iii ) 219 for ( iii = 0; iii< 10 ; ++iii )
221 mListView->setColumnWidthMode( iii, QListView::Manual ); 220 mListView->setColumnWidthMode( iii, QListView::Manual );
222 221
223 QBoxLayout *layoutTop = new QVBoxLayout(this); 222 QBoxLayout *layoutTop = new QVBoxLayout(this);
224 layoutTop->addWidget(mListView); 223 layoutTop->addWidget(mListView);
225 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 224 mListView->setFont ( KOPrefs::instance()->mListViewFont );
226 mPopupMenu = eventPopup(); 225 mPopupMenu = eventPopup();
227 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 226 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
228 i18n("Select all"),this, 227 i18n("Select all"),this,
229 SLOT(allSelection()),true); 228 SLOT(allSelection()),true);
230 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 229 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
231 i18n("Deselect All"),this, 230 i18n("Deselect All"),this,
232 SLOT(clearSelection()),true); 231 SLOT(clearSelection()),true);
233 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 232 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
234 i18n("Delete all selected"),this, 233 i18n("Delete all selected"),this,
235 SLOT(deleteAll()),true); 234 SLOT(deleteAll()),true);
236 mPopupMenu->insertSeparator(); 235 mPopupMenu->insertSeparator();
237 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 236 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
238 i18n("Save selected to file..."),this, 237 i18n("Save selected to file..."),this,
239 SLOT(saveToFile()),true); 238 SLOT(saveToFile()),true);
240 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 239 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
241 i18n("Save Journal/Description..."),this, 240 i18n("Save Journal/Description..."),this,
242 SLOT(saveDescriptionToFile()),true); 241 SLOT(saveDescriptionToFile()),true);
243 mPopupMenu->insertSeparator(); 242 mPopupMenu->insertSeparator();
244 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 243 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
245 i18n("Add Categ. to selected..."),this, 244 i18n("Add Categ. to selected..."),this,
246 SLOT(addCat()),true); 245 SLOT(addCat()),true);
247 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 246 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
248 i18n("Set Categ. for selected..."),this, 247 i18n("Set Categ. for selected..."),this,
249 SLOT(setCat()),true); 248 SLOT(setCat()),true);
250 mPopupMenu->insertSeparator(); 249 mPopupMenu->insertSeparator();
251 250
252 251
253#ifndef DESKTOP_VERSION 252#ifndef DESKTOP_VERSION
254 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 253 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index c4bc51b..df60564 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1,247 +1,246 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
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 <qpopupmenu.h>
21#include <qfont.h> 21#include <qfont.h>
22#include <qfontmetrics.h> 22#include <qfontmetrics.h>
23#include <qkeycode.h> 23#include <qkeycode.h>
24#include <qhbox.h> 24#include <qhbox.h>
25#include <qvbox.h> 25#include <qvbox.h>
26#include <qpushbutton.h> 26#include <qpushbutton.h>
27#include <qtooltip.h> 27#include <qtooltip.h>
28#include <qpainter.h> 28#include <qpainter.h>
29#include <qwhatsthis.h> 29#include <qwhatsthis.h>
30#ifndef DESKTOP_VERSION 30#ifndef DESKTOP_VERSION
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
32#else 32#else
33#include <qapplication.h> 33#include <qapplication.h>
34#endif 34#endif
35 35
36#include <kdebug.h> 36#include <kdebug.h>
37#include <klocale.h> 37#include <klocale.h>
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kconfig.h> 39#include <kconfig.h>
40#include <kiconloader.h> 40#include <kiconloader.h>
41 41
42#include <kcalendarsystem.h> 42#include <kcalendarsystem.h>
43 43
44#ifndef KORG_NOPRINTER 44#ifndef KORG_NOPRINTER
45#include "calprinter.h" 45#include "calprinter.h"
46#endif 46#endif
47#include "koprefs.h" 47#include "koprefs.h"
48#ifndef KORG_NOPLUGINS 48#ifndef KORG_NOPLUGINS
49#include "kocore.h" 49#include "kocore.h"
50#endif 50#endif
51#include "koglobals.h" 51#include "koglobals.h"
52#include <libkdepim/kincidenceformatter.h> 52#include <libkdepim/kincidenceformatter.h>
53 53
54#include "komonthview.h" 54#include "komonthview.h"
55#include "komonthview.moc"
56 55
57#define PIXMAP_SIZE 5 56#define PIXMAP_SIZE 5
58 57
59class KNOWhatsThis :public QWhatsThis 58class KNOWhatsThis :public QWhatsThis
60{ 59{
61public: 60public:
62 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; 61 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { };
63 62
64protected: 63protected:
65 virtual QString text( const QPoint& p) 64 virtual QString text( const QPoint& p)
66 { 65 {
67 return _wid->getWhatsThisText(p) ; 66 return _wid->getWhatsThisText(p) ;
68 }; 67 };
69private: 68private:
70 KNoScrollListBox* _wid; 69 KNoScrollListBox* _wid;
71 70
72}; 71};
73 72
74 73
75KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) 74KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
76 : QListBox(parent, name) 75 : QListBox(parent, name)
77{ 76{
78#ifndef DESKTOP_VERSION 77#ifndef DESKTOP_VERSION
79 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 78 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
80#endif 79#endif
81 new KNOWhatsThis(this); 80 new KNOWhatsThis(this);
82} 81}
83 82
84QString KNoScrollListBox::getWhatsThisText(QPoint p) 83QString KNoScrollListBox::getWhatsThisText(QPoint p)
85{ 84{
86 QListBoxItem* item = itemAt ( p ); 85 QListBoxItem* item = itemAt ( p );
87 if ( ! item ) { 86 if ( ! item ) {
88 return i18n("Click in the cell or\non the date label\nto add an event!"); 87 return i18n("Click in the cell or\non the date label\nto add an event!");
89 } 88 }
90 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); 89 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence());
91} 90}
92void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 91void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
93{ 92{
94 93
95 switch(e->key()) { 94 switch(e->key()) {
96 case Key_Right: 95 case Key_Right:
97 // if ( e->state() == Qt::ControlButton ) 96 // if ( e->state() == Qt::ControlButton )
98 { 97 {
99 e->ignore(); 98 e->ignore();
100 return; 99 return;
101 } 100 }
102 scrollBy(4,0); 101 scrollBy(4,0);
103 break; 102 break;
104 case Key_Left: 103 case Key_Left:
105 // if ( e->state() == Qt::ControlButton ) 104 // if ( e->state() == Qt::ControlButton )
106 { 105 {
107 e->ignore(); 106 e->ignore();
108 return; 107 return;
109 } 108 }
110 scrollBy(-4,0); 109 scrollBy(-4,0);
111 break; 110 break;
112 case Key_Up: 111 case Key_Up:
113 if(!count()) break; 112 if(!count()) break;
114 setCurrentItem((currentItem()+count()-1)%count()); 113 setCurrentItem((currentItem()+count()-1)%count());
115 if(!itemVisible(currentItem())) { 114 if(!itemVisible(currentItem())) {
116 if((unsigned int) currentItem() == (count()-1)) { 115 if((unsigned int) currentItem() == (count()-1)) {
117 setTopItem(currentItem()-numItemsVisible()+1); 116 setTopItem(currentItem()-numItemsVisible()+1);
118 } else { 117 } else {
119 setTopItem(topItem()-1); 118 setTopItem(topItem()-1);
120 } 119 }
121 } 120 }
122 break; 121 break;
123 case Key_Down: 122 case Key_Down:
124 if(!count()) break; 123 if(!count()) break;
125 setCurrentItem((currentItem()+1)%count()); 124 setCurrentItem((currentItem()+1)%count());
126 if(!itemVisible(currentItem())) { 125 if(!itemVisible(currentItem())) {
127 if(currentItem() == 0) { 126 if(currentItem() == 0) {
128 setTopItem(0); 127 setTopItem(0);
129 } else { 128 } else {
130 setTopItem(topItem()+1); 129 setTopItem(topItem()+1);
131 } 130 }
132 } 131 }
133 break; 132 break;
134 case Key_Shift: 133 case Key_Shift:
135 emit shiftDown(); 134 emit shiftDown();
136 break; 135 break;
137 default: 136 default:
138 e->ignore(); 137 e->ignore();
139 break; 138 break;
140 } 139 }
141} 140}
142 141
143void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 142void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
144{ 143{
145 switch(e->key()) { 144 switch(e->key()) {
146 case Key_Shift: 145 case Key_Shift:
147 emit shiftUp(); 146 emit shiftUp();
148 break; 147 break;
149 default: 148 default:
150 break; 149 break;
151 } 150 }
152} 151}
153 152
154void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 153void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
155{ 154{
156 QListBox::mousePressEvent(e); 155 QListBox::mousePressEvent(e);
157 156
158 if(e->button() == RightButton) { 157 if(e->button() == RightButton) {
159 emit rightClick(); 158 emit rightClick();
160 } 159 }
161} 160}
162 161
163MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) 162MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
164 : QListBoxItem() 163 : QListBoxItem()
165{ 164{
166 setText( s ); 165 setText( s );
167 166
168 mIncidence = incidence; 167 mIncidence = incidence;
169 mDate = qd; 168 mDate = qd;
170 // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); 169 // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence ));
171 mRecur = false; 170 mRecur = false;
172 mAlarm = false; 171 mAlarm = false;
173 mReply = false; 172 mReply = false;
174 mInfo = false; 173 mInfo = false;
175} 174}
176 175
177void MonthViewItem::paint(QPainter *p) 176void MonthViewItem::paint(QPainter *p)
178{ 177{
179#if QT_VERSION >= 0x030000 178#if QT_VERSION >= 0x030000
180 bool sel = isSelected(); 179 bool sel = isSelected();
181#else 180#else
182 bool sel = selected(); 181 bool sel = selected();
183#endif 182#endif
184 183
185 184
186 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) 185 if (KOPrefs::instance()->mMonthViewUsesCategoryColor)
187 { 186 {
188 p->setBackgroundColor( palette().color( QPalette::Normal, \ 187 p->setBackgroundColor( palette().color( QPalette::Normal, \
189 sel ? QColorGroup::Highlight : QColorGroup::Background ) ); 188 sel ? QColorGroup::Highlight : QColorGroup::Background ) );
190 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); 189 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) );
191 } 190 }
192 int x = 1; 191 int x = 1;
193 int y = 3;//(height() - mRecurPixmap.height()) /2; 192 int y = 3;//(height() - mRecurPixmap.height()) /2;
194 int size = PIXMAP_SIZE; 193 int size = PIXMAP_SIZE;
195 if ( QApplication::desktop()->width() < 300 ) 194 if ( QApplication::desktop()->width() < 300 )
196 size = 3; 195 size = 3;
197 if ( KOPrefs::instance()->mMonthShowIcons ) { 196 if ( KOPrefs::instance()->mMonthShowIcons ) {
198 if ( mInfo ) { 197 if ( mInfo ) {
199 p->fillRect ( x, y,size,size, Qt::darkGreen ); 198 p->fillRect ( x, y,size,size, Qt::darkGreen );
200 x += size + 1; 199 x += size + 1;
201 } 200 }
202 if ( mRecur ) { 201 if ( mRecur ) {
203 p->fillRect ( x, y,size,size, Qt::blue ); 202 p->fillRect ( x, y,size,size, Qt::blue );
204 x += size + 1; 203 x += size + 1;
205 } 204 }
206 if ( mAlarm ) { 205 if ( mAlarm ) {
207 p->fillRect ( x, y,size,size, Qt::red ); 206 p->fillRect ( x, y,size,size, Qt::red );
208 x += size + 1; 207 x += size + 1;
209 } 208 }
210 if ( mReply ) { 209 if ( mReply ) {
211 p->fillRect ( x, y,size,size, Qt::yellow ); 210 p->fillRect ( x, y,size,size, Qt::yellow );
212 x += size + 1; 211 x += size + 1;
213 } 212 }
214 } 213 }
215 QFontMetrics fm = p->fontMetrics(); 214 QFontMetrics fm = p->fontMetrics();
216 int yPos; 215 int yPos;
217 int pmheight = size; 216 int pmheight = size;
218 if( pmheight < fm.height() ) 217 if( pmheight < fm.height() )
219 yPos = fm.ascent() + fm.leading()/2; 218 yPos = fm.ascent() + fm.leading()/2;
220 else 219 else
221 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 220 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
222 p->setPen( palette().color( QPalette::Normal, sel ? \ 221 p->setPen( palette().color( QPalette::Normal, sel ? \
223 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 222 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
224 p->drawText( x, yPos, text() ); 223 p->drawText( x, yPos, text() );
225 if ( mIncidence->cancelled() ) { 224 if ( mIncidence->cancelled() ) {
226 int wid = fm.width( text() ); 225 int wid = fm.width( text() );
227 p->drawLine( x, yPos- fm.height()/2+2,x+wid, yPos- fm.height()/2 +2); 226 p->drawLine( x, yPos- fm.height()/2+2,x+wid, yPos- fm.height()/2 +2);
228 } 227 }
229 228
230} 229}
231 230
232int MonthViewItem::height(const QListBox *lb) const 231int MonthViewItem::height(const QListBox *lb) const
233{ 232{
234 return lb->fontMetrics().lineSpacing()+1; 233 return lb->fontMetrics().lineSpacing()+1;
235} 234}
236 235
237int MonthViewItem::width(const QListBox *lb) const 236int MonthViewItem::width(const QListBox *lb) const
238{ 237{
239 int size = PIXMAP_SIZE; 238 int size = PIXMAP_SIZE;
240 if ( QApplication::desktop()->width() < 300 ) 239 if ( QApplication::desktop()->width() < 300 )
241 size = 3; 240 size = 3;
242 int x = 1; 241 int x = 1;
243 if ( mInfo ) { 242 if ( mInfo ) {
244 x += size + 1; 243 x += size + 1;
245 } 244 }
246 if( mRecur ) { 245 if( mRecur ) {
247 x += size+1; 246 x += size+1;
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index 04fffe2..da6644f 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -1,262 +1,261 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
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 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 <qgroupbox.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.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 <qtextstream.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qvbox.h> 34#include <qvbox.h>
35#include <qhbox.h> 35#include <qhbox.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 <qstrlist.h>
43#include <qapplication.h> 43#include <qapplication.h>
44 44
45#include <kcolorbutton.h> 45#include <kcolorbutton.h>
46#include <kdebug.h> 46#include <kdebug.h>
47#include <klocale.h> 47#include <klocale.h>
48#include <kglobal.h> 48#include <kglobal.h>
49#include <kfontdialog.h> 49#include <kfontdialog.h>
50#include <kfiledialog.h> 50#include <kfiledialog.h>
51#include <kmessagebox.h> 51#include <kmessagebox.h>
52#include <kcolordialog.h> 52#include <kcolordialog.h>
53#include <kiconloader.h> 53#include <kiconloader.h>
54#include <kemailsettings.h> 54#include <kemailsettings.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56 56
57#include <kurlrequester.h> 57#include <kurlrequester.h>
58#include <klineedit.h> 58#include <klineedit.h>
59 59
60#if defined(USE_SOLARIS) 60#if defined(USE_SOLARIS)
61#include <sys/param.h> 61#include <sys/param.h>
62 62
63#define ZONEINFODIR "/usr/share/lib/zoneinfo" 63#define ZONEINFODIR "/usr/share/lib/zoneinfo"
64#define INITFILE "/etc/default/init" 64#define INITFILE "/etc/default/init"
65#endif 65#endif
66 66
67#include "koprefs.h" 67#include "koprefs.h"
68 68
69#include "koprefsdialog.h" 69#include "koprefsdialog.h"
70#include "koprefsdialog.moc"
71 70
72 71
73KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : 72KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
74 KPrefsDialog(KOPrefs::instance(),parent,name,true) 73 KPrefsDialog(KOPrefs::instance(),parent,name,true)
75{ 74{
76 75
77 setCaption( i18n("Preferences - some settings need a restart (nr)")); 76 setCaption( i18n("Preferences - some settings need a restart (nr)"));
78 mCategoryDict.setAutoDelete(true); 77 mCategoryDict.setAutoDelete(true);
79 78
80 KGlobal::locale()->insertCatalogue("timezones"); 79 KGlobal::locale()->insertCatalogue("timezones");
81 80
82 setupMainTab(); 81 setupMainTab();
83 setupLocaleTab(); 82 setupLocaleTab();
84 setupTimeZoneTab(); 83 setupTimeZoneTab();
85 setupTimeTab(); 84 setupTimeTab();
86 setupLocaleDateTab(); 85 setupLocaleDateTab();
87 setupFontsTab(); 86 setupFontsTab();
88 setupColorsTab(); 87 setupColorsTab();
89 setupViewsTab(); 88 setupViewsTab();
90 //setupSyncTab(); 89 //setupSyncTab();
91 //setupSyncAlgTab(); 90 //setupSyncAlgTab();
92 //setupPrinterTab(); 91 //setupPrinterTab();
93 //setupGroupSchedulingTab(); 92 //setupGroupSchedulingTab();
94 //setupGroupAutomationTab(); 93 //setupGroupAutomationTab();
95} 94}
96 95
97 96
98KOPrefsDialog::~KOPrefsDialog() 97KOPrefsDialog::~KOPrefsDialog()
99{ 98{
100} 99}
101 100
102void KOPrefsDialog::setupLocaleDateTab() 101void KOPrefsDialog::setupLocaleDateTab()
103{ 102{
104QFrame *topFrame = addPage(i18n("Date Format"),0,0); 103QFrame *topFrame = addPage(i18n("Date Format"),0,0);
105 QGridLayout *topLayout = new QGridLayout(topFrame,3,2); 104 QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
106 topLayout->setSpacing(spacingHint()); 105 topLayout->setSpacing(spacingHint());
107 topLayout->setMargin(marginHint()); 106 topLayout->setMargin(marginHint());
108 int iii = 0; 107 int iii = 0;
109 108
110 109
111 KPrefsWidRadios *syncPrefsGroup = 110 KPrefsWidRadios *syncPrefsGroup =
112 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); 111 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
113 QString format; 112 QString format;
114 if ( QApplication::desktop()->width() < 480 ) 113 if ( QApplication::desktop()->width() < 480 )
115 format = "(%d.%m.%Y)"; 114 format = "(%d.%m.%Y)";
116 else 115 else
117 format = "(%d.%m.%Y|%A %d %B %Y)"; 116 format = "(%d.%m.%Y|%A %d %B %Y)";
118 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 117 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
119 if ( QApplication::desktop()->width() < 480 ) 118 if ( QApplication::desktop()->width() < 480 )
120 format = "(%m.%d.%Y)"; 119 format = "(%m.%d.%Y)";
121 else 120 else
122 format = "(%m.%d.%Y|%A %B %d %Y)"; 121 format = "(%m.%d.%Y|%A %B %d %Y)";
123 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 122 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
124 if ( QApplication::desktop()->width() < 480 ) 123 if ( QApplication::desktop()->width() < 480 )
125 format = "(%Y-%m-%d)"; 124 format = "(%Y-%m-%d)";
126 else 125 else
127 format = "(%Y-%m-%d|%A %Y %B %d)"; 126 format = "(%Y-%m-%d|%A %Y %B %d)";
128 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 127 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
129 syncPrefsGroup->addRadio(i18n("User defined")); 128 syncPrefsGroup->addRadio(i18n("User defined"));
130 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 129 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
131 ++iii; 130 ++iii;
132 ++iii; 131 ++iii;
133 QLabel * lab; 132 QLabel * lab;
134 mUserDateFormatLong = new QLineEdit(topFrame); 133 mUserDateFormatLong = new QLineEdit(topFrame);
135 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); 134 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
136 topLayout->addWidget(lab ,iii,0); 135 topLayout->addWidget(lab ,iii,0);
137 topLayout->addWidget(mUserDateFormatLong,iii,1); 136 topLayout->addWidget(mUserDateFormatLong,iii,1);
138 ++iii; 137 ++iii;
139 mUserDateFormatShort = new QLineEdit(topFrame); 138 mUserDateFormatShort = new QLineEdit(topFrame);
140 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); 139 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
141 topLayout->addWidget(lab ,iii,0); 140 topLayout->addWidget(lab ,iii,0);
142 topLayout->addWidget(mUserDateFormatShort,iii,1); 141 topLayout->addWidget(mUserDateFormatShort,iii,1);
143 ++iii; 142 ++iii;
144 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); 143 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
145 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 144 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
146 ++iii; 145 ++iii;
147 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); 146 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
148 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 147 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
149 ++iii; 148 ++iii;
150 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); 149 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
151 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 150 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
152 ++iii; 151 ++iii;
153 152
154} 153}
155 154
156void KOPrefsDialog::setupLocaleTab() 155void KOPrefsDialog::setupLocaleTab()
157{ 156{
158 QFrame *topFrame = addPage(i18n("Locale"),0,0); 157 QFrame *topFrame = addPage(i18n("Locale"),0,0);
159 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 158 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
160 topLayout->setSpacing(spacingHint()); 159 topLayout->setSpacing(spacingHint());
161 topLayout->setMargin(marginHint()); 160 topLayout->setMargin(marginHint());
162 int iii = 0; 161 int iii = 0;
163 KPrefsWidRadios *syncPrefsGroup = 162 KPrefsWidRadios *syncPrefsGroup =
164 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); 163 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame);
165 syncPrefsGroup->addRadio(i18n("English")); 164 syncPrefsGroup->addRadio(i18n("English"));
166 syncPrefsGroup->addRadio(i18n("German")); 165 syncPrefsGroup->addRadio(i18n("German"));
167 syncPrefsGroup->addRadio(i18n("French(nyi)")); 166 syncPrefsGroup->addRadio(i18n("French(nyi)"));
168 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 167 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
169 if ( QApplication::desktop()->width() < 300 ) 168 if ( QApplication::desktop()->width() < 300 )
170 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 169 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
171 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 170 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
172 ++iii; 171 ++iii;
173 172
174 syncPrefsGroup = 173 syncPrefsGroup =
175 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); 174 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame);
176 if ( QApplication::desktop()->width() > 300 ) 175 if ( QApplication::desktop()->width() > 300 )
177 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 176 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
178 syncPrefsGroup->addRadio(i18n("24:00")); 177 syncPrefsGroup->addRadio(i18n("24:00"));
179 syncPrefsGroup->addRadio(i18n("12:00am")); 178 syncPrefsGroup->addRadio(i18n("12:00am"));
180 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 179 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
181 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 180 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
182 ++iii; 181 ++iii;
183 KPrefsWidBool *sb; 182 KPrefsWidBool *sb;
184 if ( QApplication::desktop()->width() < 300 ) { 183 if ( QApplication::desktop()->width() < 300 ) {
185 sb = 184 sb =
186 addWidBool(i18n("Week starts on Sunday"), 185 addWidBool(i18n("Week starts on Sunday"),
187 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); 186 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame);
188 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 187 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
189 ++iii; 188 ++iii;
190 sb = 189 sb =
191 addWidBool(i18n("Use short date in (WN/E) view"), 190 addWidBool(i18n("Use short date in (WN/E) view"),
192 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 191 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
193 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 192 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
194 } 193 }
195 else { 194 else {
196 QWidget * hb = new QWidget( topFrame ); 195 QWidget * hb = new QWidget( topFrame );
197 QHBoxLayout *hbLayout = new QHBoxLayout(hb); 196 QHBoxLayout *hbLayout = new QHBoxLayout(hb);
198 sb = 197 sb =
199 addWidBool(i18n("Week starts on Sunday"), 198 addWidBool(i18n("Week starts on Sunday"),
200 &(KOPrefs::instance()->mWeekStartsOnSunday),hb); 199 &(KOPrefs::instance()->mWeekStartsOnSunday),hb);
201 hbLayout->addWidget(sb->checkBox() ); 200 hbLayout->addWidget(sb->checkBox() );
202 sb = 201 sb =
203 addWidBool(i18n("Use short date in (WN/E) view"), 202 addWidBool(i18n("Use short date in (WN/E) view"),
204 &(KOPrefs::instance()->mShortDateInViewer),hb); 203 &(KOPrefs::instance()->mShortDateInViewer),hb);
205 hbLayout->addWidget(sb->checkBox() ); 204 hbLayout->addWidget(sb->checkBox() );
206 topLayout->addMultiCellWidget(hb, iii,iii,0,1); 205 topLayout->addMultiCellWidget(hb, iii,iii,0,1);
207 206
208 } 207 }
209 //#ifndef DESKTOP_VERSION 208 //#ifndef DESKTOP_VERSION
210#if 0 209#if 0
211 ++iii; 210 ++iii;
212 sb = 211 sb =
213 addWidBool(i18n("Quick load/save (w/o Unicode)"), 212 addWidBool(i18n("Quick load/save (w/o Unicode)"),
214 &(KOPrefs::instance()->mUseQuicksave),topFrame); 213 &(KOPrefs::instance()->mUseQuicksave),topFrame);
215 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 214 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
216#endif 215#endif
217} 216}
218void KOPrefsDialog::showSyncPage() 217void KOPrefsDialog::showSyncPage()
219{ 218{
220 showPage ( 2 ) ; 219 showPage ( 2 ) ;
221 220
222} 221}
223void KOPrefsDialog::setupSyncAlgTab() 222void KOPrefsDialog::setupSyncAlgTab()
224{ 223{
225#if 0 224#if 0
226 QLabel * lab; 225 QLabel * lab;
227 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); 226 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0);
228 mSetupSyncAlgTab = topFrame; 227 mSetupSyncAlgTab = topFrame;
229 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 228 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
230 topLayout->setSpacing(spacingHint()); 229 topLayout->setSpacing(spacingHint());
231 topLayout->setMargin(marginHint()); 230 topLayout->setMargin(marginHint());
232 int iii = 0; 231 int iii = 0;
233 232
234 KPrefsWidBool *sb = 233 KPrefsWidBool *sb =
235 addWidBool(i18n("Ask for preferences before syncing"), 234 addWidBool(i18n("Ask for preferences before syncing"),
236 &(KOPrefs::instance()->mAskForPreferences),topFrame); 235 &(KOPrefs::instance()->mAskForPreferences),topFrame);
237 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 236 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
238 237
239 ++iii; 238 ++iii;
240 239
241 KPrefsWidRadios *syncPrefsGroup = 240 KPrefsWidRadios *syncPrefsGroup =
242 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), 241 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs),
243 topFrame); 242 topFrame);
244 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 243 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
245 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 244 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
246 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 245 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
247 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 246 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
248 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 247 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
249 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 248 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
250 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 249 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
251 ++iii; 250 ++iii;
252 sb = 251 sb =
253 addWidBool(i18n("Show summary after syncing"), 252 addWidBool(i18n("Show summary after syncing"),
254 &(KOPrefs::instance()->mShowSyncSummary),topFrame); 253 &(KOPrefs::instance()->mShowSyncSummary),topFrame);
255 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 254 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
256 255
257 ++iii; 256 ++iii;
258#endif 257#endif
259 258
260 259
261 260
262} 261}
diff --git a/korganizer/kosyncprefsdialog.cpp b/korganizer/kosyncprefsdialog.cpp
index 2e051f2..b7e4265 100644
--- a/korganizer/kosyncprefsdialog.cpp
+++ b/korganizer/kosyncprefsdialog.cpp
@@ -1,258 +1,257 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> 3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
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 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 <qgroupbox.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.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 <qtextstream.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qvbox.h> 34#include <qvbox.h>
35#include <qhbox.h> 35#include <qhbox.h>
36#include <qspinbox.h> 36#include <qspinbox.h>
37#include <qdatetime.h> 37#include <qdatetime.h>
38#include <qcheckbox.h> 38#include <qcheckbox.h>
39#include <qradiobutton.h> 39#include <qradiobutton.h>
40#include <qpushbutton.h> 40#include <qpushbutton.h>
41#include <qstrlist.h> 41#include <qstrlist.h>
42#include <qapplication.h> 42#include <qapplication.h>
43 43
44#include <kcolorbutton.h> 44#include <kcolorbutton.h>
45#include <kdebug.h> 45#include <kdebug.h>
46#include <klocale.h> 46#include <klocale.h>
47#include <kglobal.h> 47#include <kglobal.h>
48#include <kfontdialog.h> 48#include <kfontdialog.h>
49#include <kmessagebox.h> 49#include <kmessagebox.h>
50#include <kcolordialog.h> 50#include <kcolordialog.h>
51#include <kiconloader.h> 51#include <kiconloader.h>
52#include <kemailsettings.h> 52#include <kemailsettings.h>
53#include <kstandarddirs.h> 53#include <kstandarddirs.h>
54#include <kfiledialog.h> 54#include <kfiledialog.h>
55#include <kmessagebox.h> 55#include <kmessagebox.h>
56 56
57#include <kurlrequester.h> 57#include <kurlrequester.h>
58#include <klineedit.h> 58#include <klineedit.h>
59#include <libkdepim/ksyncprofile.h> 59#include <libkdepim/ksyncprofile.h>
60 60
61 61
62#include "koprefs.h" 62#include "koprefs.h"
63 63
64#include "kosyncprefsdialog.h" 64#include "kosyncprefsdialog.h"
65#include "koglobals.h" 65#include "koglobals.h"
66#include "kosyncprefsdialog.moc"
67 66
68 67
69KOSyncPrefsDialog::KOSyncPrefsDialog(QWidget *parent, char *name, bool modal) : 68KOSyncPrefsDialog::KOSyncPrefsDialog(QWidget *parent, char *name, bool modal) :
70 KDialog(parent,name,true) 69 KDialog(parent,name,true)
71{ 70{
72 71
73 setCaption( i18n("Synchronization Preferences")); 72 setCaption( i18n("Synchronization Preferences"));
74 73
75 mSyncProfiles.setAutoDelete( true ); 74 mSyncProfiles.setAutoDelete( true );
76 setupSyncAlgTab(); 75 setupSyncAlgTab();
77} 76}
78 77
79 78
80KOSyncPrefsDialog::~KOSyncPrefsDialog() 79KOSyncPrefsDialog::~KOSyncPrefsDialog()
81{ 80{
82} 81}
83 82
84#include <qlayout.h> 83#include <qlayout.h>
85#include <qscrollview.h> 84#include <qscrollview.h>
86void KOSyncPrefsDialog::setupSyncAlgTab() 85void KOSyncPrefsDialog::setupSyncAlgTab()
87{ 86{
88 QLabel * lab; 87 QLabel * lab;
89 //QFrame *page = addPage(i18n("Sync Prefs"),0,0); 88 //QFrame *page = addPage(i18n("Sync Prefs"),0,0);
90 QVBox * mainbox = new QVBox( this ); 89 QVBox * mainbox = new QVBox( this );
91 QScrollView* sv = new QScrollView( mainbox ); 90 QScrollView* sv = new QScrollView( mainbox );
92 QHBoxLayout * lay = new QHBoxLayout( this ); 91 QHBoxLayout * lay = new QHBoxLayout( this );
93 lay->addWidget( mainbox ); 92 lay->addWidget( mainbox );
94 QHBox * b_box = new QHBox( mainbox ); 93 QHBox * b_box = new QHBox( mainbox );
95 94
96 QPushButton* button = new QPushButton( i18n("Ok"), b_box ); 95 QPushButton* button = new QPushButton( i18n("Ok"), b_box );
97 connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); 96 connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) );
98 button = new QPushButton( i18n("Cancel"), b_box ); 97 button = new QPushButton( i18n("Cancel"), b_box );
99 connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); 98 connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) );
100 //QBoxLayout * sl = new QVBoxLayout(this ); 99 //QBoxLayout * sl = new QVBoxLayout(this );
101 //sl->addWidget ( sv ); 100 //sl->addWidget ( sv );
102 sv->setResizePolicy ( QScrollView::AutoOneFit ); 101 sv->setResizePolicy ( QScrollView::AutoOneFit );
103 QFrame *topFrame = new QFrame ( sv ); 102 QFrame *topFrame = new QFrame ( sv );
104 sv->addChild( topFrame ); 103 sv->addChild( topFrame );
105 mSetupSyncAlgTab = topFrame; 104 mSetupSyncAlgTab = topFrame;
106 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 105 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
107 topLayout->setSpacing(spacingHint()); 106 topLayout->setSpacing(spacingHint());
108 topLayout->setMargin(marginHint()); 107 topLayout->setMargin(marginHint());
109 108
110 //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); 109 //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame);
111 int iii = 0; 110 int iii = 0;
112 //topLayout->addMultiCellWidget(lab , iii,iii,0,1); 111 //topLayout->addMultiCellWidget(lab , iii,iii,0,1);
113 //++iii; 112 //++iii;
114 113
115 mMyMachineName = new QLineEdit(topFrame); 114 mMyMachineName = new QLineEdit(topFrame);
116 lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); 115 lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame);
117 topLayout->addWidget(lab ,iii,0); 116 topLayout->addWidget(lab ,iii,0);
118 topLayout->addWidget(mMyMachineName,iii,1); 117 topLayout->addWidget(mMyMachineName,iii,1);
119 ++iii; 118 ++iii;
120 119
121 QHBox* buttonbox = new QHBox( topFrame); 120 QHBox* buttonbox = new QHBox( topFrame);
122 topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); 121 topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1);
123 ++iii; 122 ++iii;
124 button = new QPushButton( i18n("New profile"), buttonbox ); 123 button = new QPushButton( i18n("New profile"), buttonbox );
125 connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); 124 connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) );
126 125
127 button = new QPushButton( i18n("Clone profile"), buttonbox ); 126 button = new QPushButton( i18n("Clone profile"), buttonbox );
128 connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); 127 connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) );
129 128
130 button = new QPushButton( i18n("Delete profile"), buttonbox ); 129 button = new QPushButton( i18n("Delete profile"), buttonbox );
131 connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); 130 connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) );
132 131
133 mProfileBox = new QComboBox(topFrame); 132 mProfileBox = new QComboBox(topFrame);
134 mProfileBox->setEditable ( true ); 133 mProfileBox->setEditable ( true );
135 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); 134 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) );
136 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); 135 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) );
137 136
138 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); 137 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame);
139 topLayout->addWidget(lab ,iii,0); 138 topLayout->addWidget(lab ,iii,0);
140 topLayout->addWidget(mProfileBox, iii,1); 139 topLayout->addWidget(mProfileBox, iii,1);
141 ++iii; 140 ++iii;
142 141
143 mIncludeInRing = new QCheckBox( i18n("Include in multiple sync"), topFrame ); 142 mIncludeInRing = new QCheckBox( i18n("Include in multiple sync"), topFrame );
144 topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1); 143 topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1);
145 ++iii; 144 ++iii;
146 145
147 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); 146 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame );
148 topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); 147 topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1);
149 ++iii; 148 ++iii;
150 QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); 149 QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
151 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 150 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
152 ++iii; 151 ++iii;
153 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); 152 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr );
154 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); 153 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr );
155 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); 154 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr );
156 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); 155 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr );
157 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); 156 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr );
158 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); 157 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr );
159 // both = new QRadioButton ( i18n("Take both on conflict"), gr ); 158 // both = new QRadioButton ( i18n("Take both on conflict"), gr );
160 159
161 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); 160 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame );
162 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); 161 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
163 ++iii; 162 ++iii;
164 163
165 mWriteBackExisting= new QCheckBox( i18n("Write back existing entries only"), topFrame ); 164 mWriteBackExisting= new QCheckBox( i18n("Write back existing entries only"), topFrame );
166 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); 165 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1);
167 ++iii; 166 ++iii;
168 167
169 mWriteBackFile = new QCheckBox( i18n("Write back file"), topFrame ); 168 mWriteBackFile = new QCheckBox( i18n("Write back file"), topFrame );
170 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); 169 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
171 ++iii; 170 ++iii;
172 171
173 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); 172 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
174 gr = proGr; 173 gr = proGr;
175 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 174 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
176 ++iii; 175 ++iii;
177 mIsLocal = new QRadioButton ( i18n("Local file"), gr ); 176 mIsLocal = new QRadioButton ( i18n("Local file"), gr );
178 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); 177 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
179 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 178 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
180 179
181 localFileWidget = new QVBox( topFrame); 180 localFileWidget = new QVBox( topFrame);
182 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); 181 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1);
183 ++iii; 182 ++iii;
184 QHBox* temphb = new QHBox( localFileWidget ); 183 QHBox* temphb = new QHBox( localFileWidget );
185 lab = new QLabel( i18n("Local file:"), temphb); 184 lab = new QLabel( i18n("Local file:"), temphb);
186 mRemoteFile = new QLineEdit(localFileWidget); 185 mRemoteFile = new QLineEdit(localFileWidget);
187 186
188 button = new QPushButton( i18n("Choose..."), temphb ); 187 button = new QPushButton( i18n("Choose..."), temphb );
189 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); 188 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) );
190 189
191 190
192 remoteFileWidget = new QVBox( topFrame); 191 remoteFileWidget = new QVBox( topFrame);
193 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); 192 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1);
194 ++iii; 193 ++iii;
195 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); 194 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget);
196 mRemotePrecommand = new QLineEdit(remoteFileWidget); 195 mRemotePrecommand = new QLineEdit(remoteFileWidget);
197 196
198 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); 197 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget);
199 mLocalTempFile = new QLineEdit(remoteFileWidget); 198 mLocalTempFile = new QLineEdit(remoteFileWidget);
200 199
201 200
202 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); 201 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget);
203 mRemotePostcommand = new QLineEdit(remoteFileWidget); 202 mRemotePostcommand = new QLineEdit(remoteFileWidget);
204 203
205 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); 204 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget);
206 temphb = new QHBox( remoteFileWidget ); 205 temphb = new QHBox( remoteFileWidget );
207 button = new QPushButton( i18n("ssh/scp"), temphb ); 206 button = new QPushButton( i18n("ssh/scp"), temphb );
208 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); 207 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
209 button = new QPushButton( i18n("ftp"), temphb ); 208 button = new QPushButton( i18n("ftp"), temphb );
210 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); 209 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
211 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); 210 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
212 211
213 212
214} 213}
215void KOSyncPrefsDialog::slotOK() 214void KOSyncPrefsDialog::slotOK()
216{ 215{
217 if ( mMyMachineName->text() == "undefined" ) { 216 if ( mMyMachineName->text() == "undefined" ) {
218 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); 217 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error"));
219 return; 218 return;
220 } 219 }
221 int i; 220 int i;
222 for (i = 0; i < mSyncProfileNames.count(); ++ i) { 221 for (i = 0; i < mSyncProfileNames.count(); ++ i) {
223 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { 222 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) {
224 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); 223 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error"));
225 return; 224 return;
226 } 225 }
227 } 226 }
228 usrWriteConfig(); 227 usrWriteConfig();
229 QDialog::accept(); 228 QDialog::accept();
230} 229}
231void KOSyncPrefsDialog::accept() 230void KOSyncPrefsDialog::accept()
232{ 231{
233 slotOK(); 232 slotOK();
234} 233}
235void KOSyncPrefsDialog::chooseFile() 234void KOSyncPrefsDialog::chooseFile()
236{ 235{
237 QString fn =KOPrefs::instance()->mLastSyncedLocalFile; 236 QString fn =KOPrefs::instance()->mLastSyncedLocalFile;
238 237
239 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 238 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
240 if ( fn == "" ) 239 if ( fn == "" )
241 return; 240 return;
242 mRemoteFile->setText( fn ); 241 mRemoteFile->setText( fn );
243} 242}
244 243
245void KOSyncPrefsDialog::textChanged( const QString & s ) 244void KOSyncPrefsDialog::textChanged( const QString & s )
246{ 245{
247 if ( mProfileBox->count() == 0 ) 246 if ( mProfileBox->count() == 0 )
248 return; 247 return;
249 if ( currentSelection < 3 ) { 248 if ( currentSelection < 3 ) {
250 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); 249 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error"));
251 mProfileBox->blockSignals( true ); 250 mProfileBox->blockSignals( true );
252 mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); 251 mProfileBox->setCurrentItem(mProfileBox-> currentItem ());
253 mProfileBox->blockSignals( false ); 252 mProfileBox->blockSignals( false );
254 return; 253 return;
255 } 254 }
256 //qDebug("cur i %d ",mProfileBox-> currentItem () ); 255 //qDebug("cur i %d ",mProfileBox-> currentItem () );
257 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; 256 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ;
258 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; 257 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ;
diff --git a/korganizer/kotimespanview.cpp b/korganizer/kotimespanview.cpp
index 266a403..3265a3a 100644
--- a/korganizer/kotimespanview.cpp
+++ b/korganizer/kotimespanview.cpp
@@ -1,110 +1,109 @@
1#include <qlayout.h> 1#include <qlayout.h>
2 2
3#include <kconfig.h> 3#include <kconfig.h>
4 4
5#include "timespanview.h" 5#include "timespanview.h"
6#include "koglobals.h" 6#include "koglobals.h"
7 7
8#include "kotimespanview.h" 8#include "kotimespanview.h"
9#include "kotimespanview.moc"
10 9
11KOTimeSpanView::KOTimeSpanView(Calendar *calendar, QWidget *parent, 10KOTimeSpanView::KOTimeSpanView(Calendar *calendar, QWidget *parent,
12 const char *name) : 11 const char *name) :
13 KOEventView( calendar, parent, name ) 12 KOEventView( calendar, parent, name )
14{ 13{
15 QBoxLayout *topLayout = new QVBoxLayout( this ); 14 QBoxLayout *topLayout = new QVBoxLayout( this );
16 15
17 mTimeSpanView = new TimeSpanView( this ); 16 mTimeSpanView = new TimeSpanView( this );
18 topLayout->addWidget( mTimeSpanView ); 17 topLayout->addWidget( mTimeSpanView );
19 18
20 connect( mTimeSpanView, SIGNAL( dateRangeChanged() ), SLOT( updateView() ) ); 19 connect( mTimeSpanView, SIGNAL( dateRangeChanged() ), SLOT( updateView() ) );
21} 20}
22 21
23KOTimeSpanView::~KOTimeSpanView() 22KOTimeSpanView::~KOTimeSpanView()
24{ 23{
25} 24}
26 25
27void KOTimeSpanView::readSettings() 26void KOTimeSpanView::readSettings()
28{ 27{
29 readSettings(KOGlobals::config()); 28 readSettings(KOGlobals::config());
30} 29}
31 30
32void KOTimeSpanView::readSettings(KConfig *config) 31void KOTimeSpanView::readSettings(KConfig *config)
33{ 32{
34// kdDebug() << "KOTimeSpanView::readSettings()" << endl; 33// kdDebug() << "KOTimeSpanView::readSettings()" << endl;
35 34
36 config->setGroup("Views"); 35 config->setGroup("Views");
37 36
38 QValueList<int> sizes = config->readIntListEntry("Separator TimeSpanView"); 37 QValueList<int> sizes = config->readIntListEntry("Separator TimeSpanView");
39 if (sizes.count() == 2) { 38 if (sizes.count() == 2) {
40 mTimeSpanView->setSplitterSizes(sizes); 39 mTimeSpanView->setSplitterSizes(sizes);
41 } 40 }
42} 41}
43 42
44void KOTimeSpanView::writeSettings(KConfig *config) 43void KOTimeSpanView::writeSettings(KConfig *config)
45{ 44{
46// kdDebug() << "KOTimeSpanView::writeSettings()" << endl; 45// kdDebug() << "KOTimeSpanView::writeSettings()" << endl;
47 46
48 config->setGroup("Views"); 47 config->setGroup("Views");
49 48
50 QValueList<int> list = mTimeSpanView->splitterSizes(); 49 QValueList<int> list = mTimeSpanView->splitterSizes();
51 config->writeEntry("Separator TimeSpanView",list); 50 config->writeEntry("Separator TimeSpanView",list);
52} 51}
53 52
54int KOTimeSpanView::maxDatesHint() 53int KOTimeSpanView::maxDatesHint()
55{ 54{
56 return 0; 55 return 0;
57} 56}
58 57
59int KOTimeSpanView::currentDateCount() 58int KOTimeSpanView::currentDateCount()
60{ 59{
61 return 0; 60 return 0;
62} 61}
63 62
64QPtrList<Incidence> KOTimeSpanView::selectedIncidences() 63QPtrList<Incidence> KOTimeSpanView::selectedIncidences()
65{ 64{
66 QPtrList<Incidence> selected; 65 QPtrList<Incidence> selected;
67 66
68 return selected; 67 return selected;
69} 68}
70 69
71void KOTimeSpanView::updateView() 70void KOTimeSpanView::updateView()
72{ 71{
73 insertItems( mTimeSpanView->startDateTime().date(), 72 insertItems( mTimeSpanView->startDateTime().date(),
74 mTimeSpanView->endDateTime().date() ); 73 mTimeSpanView->endDateTime().date() );
75} 74}
76 75
77void KOTimeSpanView::showDates(const QDate &start, const QDate &end) 76void KOTimeSpanView::showDates(const QDate &start, const QDate &end)
78{ 77{
79 QDate s = start.addDays( -2 ); 78 QDate s = start.addDays( -2 );
80 QDate e = end.addDays( 2 ); 79 QDate e = end.addDays( 2 );
81 80
82 insertItems( s, e ); 81 insertItems( s, e );
83} 82}
84 83
85void KOTimeSpanView::insertItems(const QDate &start, const QDate &end) 84void KOTimeSpanView::insertItems(const QDate &start, const QDate &end)
86{ 85{
87 mTimeSpanView->clear(); 86 mTimeSpanView->clear();
88 mTimeSpanView->setDateRange( start, end ); 87 mTimeSpanView->setDateRange( start, end );
89 88
90 QPtrList<Event> events = calendar()->events( start, end ); 89 QPtrList<Event> events = calendar()->events( start, end );
91 Event *event = events.first(); 90 Event *event = events.first();
92 while( event ) { 91 while( event ) {
93// kdDebug() << "KOTimeSpanView::showDates() add event: " << event->summary() 92// kdDebug() << "KOTimeSpanView::showDates() add event: " << event->summary()
94// << endl; 93// << endl;
95 94
96 mTimeSpanView->addItem( event ); 95 mTimeSpanView->addItem( event );
97 96
98 event = events.next(); 97 event = events.next();
99 } 98 }
100 99
101 mTimeSpanView->updateView(); 100 mTimeSpanView->updateView();
102} 101}
103 102
104void KOTimeSpanView::showEvents(QPtrList<Event> eventList) 103void KOTimeSpanView::showEvents(QPtrList<Event> eventList)
105{ 104{
106} 105}
107 106
108void KOTimeSpanView::changeEventDisplay(Event *, int) 107void KOTimeSpanView::changeEventDisplay(Event *, int)
109{ 108{
110} 109}
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 1c44f2b..abeb068 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -1,242 +1,241 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1997, 1998 Preston Brown 3 Copyright (c) 1997, 1998 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 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 7 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 8 the Free Software Foundation; either version 2 of the License, or
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 <qtooltip.h> 25#include <qtooltip.h>
26#include <qframe.h> 26#include <qframe.h>
27#include <qpixmap.h> 27#include <qpixmap.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qhbox.h> 29#include <qhbox.h>
30#include <qdir.h> 30#include <qdir.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qapplication.h> 32#include <qapplication.h>
33 33
34#include <kiconloader.h> 34#include <kiconloader.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kfiledialog.h> 36#include <kfiledialog.h>
37#include <kstandarddirs.h> 37#include <kstandarddirs.h>
38#include <kmessagebox.h> 38#include <kmessagebox.h>
39 39
40#include <libkdepim/categoryselectdialog.h> 40#include <libkdepim/categoryselectdialog.h>
41#include <libkcal/calendarlocal.h> 41#include <libkcal/calendarlocal.h>
42#include <libkcal/calendarresources.h> 42#include <libkcal/calendarresources.h>
43#include <libkcal/resourcecalendar.h> 43#include <libkcal/resourcecalendar.h>
44#include <libkcal/icalformat.h> 44#include <libkcal/icalformat.h>
45#include <kresources/resourceselectdialog.h> 45#include <kresources/resourceselectdialog.h>
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48 48
49#include "kotodoeditor.h" 49#include "kotodoeditor.h"
50#include "kotodoeditor.moc"
51extern int globalFlagBlockAgenda; 50extern int globalFlagBlockAgenda;
52 51
53KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : 52KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) :
54 KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent ) 53 KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent )
55{ 54{
56 mTodo = 0; 55 mTodo = 0;
57 mRelatedTodo = 0; 56 mRelatedTodo = 0;
58 findButton(User1)->hide(); 57 findButton(User1)->hide();
59 init(); 58 init();
60} 59}
61 60
62KOTodoEditor::~KOTodoEditor() 61KOTodoEditor::~KOTodoEditor()
63{ 62{
64 emit dialogClose( mTodo ); 63 emit dialogClose( mTodo );
65} 64}
66 65
67void KOTodoEditor::init() 66void KOTodoEditor::init()
68{ 67{
69 setupGeneral(); 68 setupGeneral();
70 setupAttendeesTab(); 69 setupAttendeesTab();
71} 70}
72void KOTodoEditor::setCategories( QString s ) 71void KOTodoEditor::setCategories( QString s )
73{ 72{
74 mGeneral->setCategories(s); 73 mGeneral->setCategories(s);
75} 74}
76void KOTodoEditor::setSecrecy( int sec ) 75void KOTodoEditor::setSecrecy( int sec )
77{ 76{
78 mGeneral->setSecrecy( sec ); 77 mGeneral->setSecrecy( sec );
79} 78}
80void KOTodoEditor::reload() 79void KOTodoEditor::reload()
81{ 80{
82 if ( mTodo ) readTodo( mTodo ); 81 if ( mTodo ) readTodo( mTodo );
83} 82}
84 83
85void KOTodoEditor::setupGeneral() 84void KOTodoEditor::setupGeneral()
86{ 85{
87 mGeneral = new KOEditorGeneralTodo(this); 86 mGeneral = new KOEditorGeneralTodo(this);
88 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); 87 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
89 88
90 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); 89 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
91 //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), 90 //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)),
92 // mGeneral,SLOT(setCategories(const QString &))); 91 // mGeneral,SLOT(setCategories(const QString &)));
93 92
94 if (KOPrefs::instance()->mCompactDialogs) { 93 if (KOPrefs::instance()->mCompactDialogs) {
95 QFrame *topFrame = addPage(i18n("General")); 94 QFrame *topFrame = addPage(i18n("General"));
96 95
97 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 96 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
98 if ( QApplication::desktop()->width() < 480 ) { 97 if ( QApplication::desktop()->width() < 480 ) {
99 topLayout->setMargin(1); 98 topLayout->setMargin(1);
100 topLayout->setSpacing(1); 99 topLayout->setSpacing(1);
101 } else { 100 } else {
102 topLayout->setMargin(marginHint()-1); 101 topLayout->setMargin(marginHint()-1);
103 topLayout->setSpacing(spacingHint()-1); 102 topLayout->setSpacing(spacingHint()-1);
104 } 103 }
105 mGeneral->initHeader(topFrame,topLayout); 104 mGeneral->initHeader(topFrame,topLayout);
106 mGeneral->initTime(topFrame,topLayout); 105 mGeneral->initTime(topFrame,topLayout);
107 mGeneral->initAlarm(topFrame,topLayout); 106 mGeneral->initAlarm(topFrame,topLayout);
108 mGeneral->enableAlarm( false ); 107 mGeneral->enableAlarm( false );
109 108
110 109
111 QBoxLayout *priorityLayout; 110 QBoxLayout *priorityLayout;
112 if ( QApplication::desktop()->width() < 500 ) 111 if ( QApplication::desktop()->width() < 500 )
113 priorityLayout = new QVBoxLayout( topLayout ); 112 priorityLayout = new QVBoxLayout( topLayout );
114 else 113 else
115 priorityLayout = new QHBoxLayout( topLayout ); 114 priorityLayout = new QHBoxLayout( topLayout );
116 QWidget* prioWidget = new QWidget (topFrame); 115 QWidget* prioWidget = new QWidget (topFrame);
117 priorityLayout->addWidget( prioWidget ); 116 priorityLayout->addWidget( prioWidget );
118 QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget); 117 QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget);
119 118
120 119
121 QIconSet icon; 120 QIconSet icon;
122 if ( QApplication::desktop()->width() < 321 ) 121 if ( QApplication::desktop()->width() < 321 )
123 icon = SmallIcon("fileexport16"); 122 icon = SmallIcon("fileexport16");
124 else 123 else
125 icon = SmallIcon("fileexport"); 124 icon = SmallIcon("fileexport");
126 QPushButton * saveTemplate = new QPushButton( prioWidget); 125 QPushButton * saveTemplate = new QPushButton( prioWidget);
127 saveTemplate->setIconSet (icon ) ; 126 saveTemplate->setIconSet (icon ) ;
128 int size = saveTemplate->sizeHint().height(); 127 int size = saveTemplate->sizeHint().height();
129 saveTemplate->setFixedSize( size, size ); 128 saveTemplate->setFixedSize( size, size );
130 if ( QApplication::desktop()->width() < 321 ) 129 if ( QApplication::desktop()->width() < 321 )
131 icon = SmallIcon("fileimport16"); 130 icon = SmallIcon("fileimport16");
132 else 131 else
133 icon = SmallIcon("fileimport"); 132 icon = SmallIcon("fileimport");
134 QPushButton * loadTemplate = new QPushButton( prioWidget); 133 QPushButton * loadTemplate = new QPushButton( prioWidget);
135 loadTemplate->setIconSet (icon ) ; 134 loadTemplate->setIconSet (icon ) ;
136 loadTemplate->setFixedSize( size, size ); 135 loadTemplate->setFixedSize( size, size );
137 136
138 priorityLayout2->addWidget(loadTemplate); 137 priorityLayout2->addWidget(loadTemplate);
139 priorityLayout2->addWidget(saveTemplate); 138 priorityLayout2->addWidget(saveTemplate);
140 mGeneral->initPriority(prioWidget,priorityLayout2); 139 mGeneral->initPriority(prioWidget,priorityLayout2);
141 mGeneral->initCategories( topFrame, priorityLayout ); 140 mGeneral->initCategories( topFrame, priorityLayout );
142 topLayout->addStretch(1); 141 topLayout->addStretch(1);
143 142
144 QFrame *topFrame2 = addPage(i18n("Details")); 143 QFrame *topFrame2 = addPage(i18n("Details"));
145 144
146 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); 145 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2);
147 topLayout2->setMargin(marginHint()); 146 topLayout2->setMargin(marginHint());
148 topLayout2->setSpacing(spacingHint()); 147 topLayout2->setSpacing(spacingHint());
149 148
150 QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 ); 149 QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 );
151 mGeneral->initCompletion(topFrame2,completionLayout); 150 mGeneral->initCompletion(topFrame2,completionLayout);
152 151
153 152
154 mGeneral->initSecrecy( topFrame2, topLayout2 ); 153 mGeneral->initSecrecy( topFrame2, topLayout2 );
155 mGeneral->initDescription(topFrame2,topLayout2); 154 mGeneral->initDescription(topFrame2,topLayout2);
156 155
157 // QHBox * hb = new QHBox ( topFrame2 ); 156 // QHBox * hb = new QHBox ( topFrame2 );
158 // topLayout2->addWidget(hb); 157 // topLayout2->addWidget(hb);
159 // hb->setSpacing( 3 ); 158 // hb->setSpacing( 3 );
160 159
161 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 160 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
162 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 161 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
163 162
164 } else { 163 } else {
165 QFrame *topFrame = addPage(i18n("General")); 164 QFrame *topFrame = addPage(i18n("General"));
166 165
167 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 166 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
168 topLayout->setSpacing(spacingHint()); 167 topLayout->setSpacing(spacingHint());
169 168
170 mGeneral->initHeader(topFrame,topLayout); 169 mGeneral->initHeader(topFrame,topLayout);
171 mGeneral->initTime(topFrame,topLayout); 170 mGeneral->initTime(topFrame,topLayout);
172 mGeneral->initStatus(topFrame,topLayout); 171 mGeneral->initStatus(topFrame,topLayout);
173 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 172 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
174 mGeneral->initAlarm(topFrame,alarmLineLayout); 173 mGeneral->initAlarm(topFrame,alarmLineLayout);
175 mGeneral->initDescription(topFrame,topLayout); 174 mGeneral->initDescription(topFrame,topLayout);
176 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); 175 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout);
177 mGeneral->initCategories( topFrame, detailsLayout ); 176 mGeneral->initCategories( topFrame, detailsLayout );
178 mGeneral->initSecrecy( topFrame, detailsLayout ); 177 mGeneral->initSecrecy( topFrame, detailsLayout );
179 } 178 }
180 mGeneral->finishSetup(); 179 mGeneral->finishSetup();
181 180
182} 181}
183 182
184void KOTodoEditor::editTodo(Todo *todo, bool editDescription) 183void KOTodoEditor::editTodo(Todo *todo, bool editDescription)
185{ 184{
186 //init(); 185 //init();
187 186
188 mTodo = todo; 187 mTodo = todo;
189 readTodo(mTodo); 188 readTodo(mTodo);
190 if ( editDescription ) { 189 if ( editDescription ) {
191 showPage( 1 ); 190 showPage( 1 );
192 mGeneral->setFocusOn( 1 ); 191 mGeneral->setFocusOn( 1 );
193 } else { 192 } else {
194 showPage( 0 ); 193 showPage( 0 );
195 mGeneral->setFocusOn( 2 ); 194 mGeneral->setFocusOn( 2 );
196 } 195 }
197} 196}
198 197
199void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay) 198void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay)
200{ 199{
201 //init(); 200 //init();
202 201
203 mTodo = 0; 202 mTodo = 0;
204 setDefaults(due,relatedTodo,allDay); 203 setDefaults(due,relatedTodo,allDay);
205} 204}
206 205
207void KOTodoEditor::loadDefaults() 206void KOTodoEditor::loadDefaults()
208{ 207{
209 setDefaults(QDateTime::currentDateTime().addDays(7),0,false); 208 setDefaults(QDateTime::currentDateTime().addDays(7),0,false);
210} 209}
211 210
212bool KOTodoEditor::processInput( bool emitTime ) 211bool KOTodoEditor::processInput( bool emitTime )
213{ 212{
214 if (!validateInput()) return false; 213 if (!validateInput()) return false;
215 214
216 Todo *todo = 0; 215 Todo *todo = 0;
217 216
218 if (mTodo) todo = mTodo; 217 if (mTodo) todo = mTodo;
219 else { 218 else {
220 todo = new Todo; 219 todo = new Todo;
221 todo->setOrganizer(KOPrefs::instance()->email()); 220 todo->setOrganizer(KOPrefs::instance()->email());
222 } 221 }
223 222
224 writeTodo(todo); 223 writeTodo(todo);
225 if ( emitTime ) { 224 if ( emitTime ) {
226 globalFlagBlockAgenda = 1; 225 globalFlagBlockAgenda = 1;
227 emit showAgendaView( false ); 226 emit showAgendaView( false );
228 if ( todo->hasDueDate() ) 227 if ( todo->hasDueDate() )
229 emit jumpToTime( todo->dtDue().date() ); 228 emit jumpToTime( todo->dtDue().date() );
230 globalFlagBlockAgenda = 2; 229 globalFlagBlockAgenda = 2;
231 } 230 }
232 if (mTodo) { 231 if (mTodo) {
233 todo->setRevision(todo->revision()+1); 232 todo->setRevision(todo->revision()+1);
234 emit todoChanged(todo); 233 emit todoChanged(todo);
235 } else { 234 } else {
236 mCalendar->addTodo(todo); 235 mCalendar->addTodo(todo);
237 mTodo = todo; 236 mTodo = todo;
238 emit todoAdded(todo); 237 emit todoAdded(todo);
239 } 238 }
240 239
241 return true; 240 return true;
242} 241}
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 0708a69..d9e0a03 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -1,247 +1,246 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
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 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 <qheader.h> 25#include <qheader.h>
26#include <qcursor.h> 26#include <qcursor.h>
27 27
28#include <qvbox.h> 28#include <qvbox.h>
29#include <kdebug.h> 29#include <kdebug.h>
30#include "koprefs.h" 30#include "koprefs.h"
31#include <klocale.h> 31#include <klocale.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <kiconloader.h> 33#include <kiconloader.h>
34#include <kmessagebox.h> 34#include <kmessagebox.h>
35 35
36#include <libkcal/icaldrag.h> 36#include <libkcal/icaldrag.h>
37#include <libkcal/vcaldrag.h> 37#include <libkcal/vcaldrag.h>
38#include <libkcal/calfilter.h> 38#include <libkcal/calfilter.h>
39#include <libkcal/dndfactory.h> 39#include <libkcal/dndfactory.h>
40#include <libkcal/calendarresources.h> 40#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 41#include <libkcal/resourcecalendar.h>
42#include <kresources/resourceselectdialog.h> 42#include <kresources/resourceselectdialog.h>
43#ifndef DESKTOP_VERSION 43#ifndef DESKTOP_VERSION
44#include <qpe/qpeapplication.h> 44#include <qpe/qpeapplication.h>
45#else 45#else
46#include <qapplication.h> 46#include <qapplication.h>
47#endif 47#endif
48#ifndef KORG_NOPRINTER 48#ifndef KORG_NOPRINTER
49#include "calprinter.h" 49#include "calprinter.h"
50#endif 50#endif
51#include "docprefs.h" 51#include "docprefs.h"
52 52
53#include "kotodoview.h" 53#include "kotodoview.h"
54using namespace KOrg; 54using namespace KOrg;
55#include "kotodoview.moc"
56 55
57KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, 56KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
58 const char *name) : 57 const char *name) :
59 KListView(parent,name) 58 KListView(parent,name)
60{ 59{
61 mCalendar = calendar; 60 mCalendar = calendar;
62#ifndef DESKTOP_VERSION 61#ifndef DESKTOP_VERSION
63 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 62 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
64#endif 63#endif
65 mOldCurrent = 0; 64 mOldCurrent = 0;
66 mMousePressed = false; 65 mMousePressed = false;
67 66
68 setAcceptDrops(true); 67 setAcceptDrops(true);
69 viewport()->setAcceptDrops(true); 68 viewport()->setAcceptDrops(true);
70 int size = 16; 69 int size = 16;
71 if (qApp->desktop()->width() < 300 ) 70 if (qApp->desktop()->width() < 300 )
72 size = 12; 71 size = 12;
73 setTreeStepSize( size + 6 ); 72 setTreeStepSize( size + 6 );
74 73
75} 74}
76 75
77void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) 76void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e)
78{ 77{
79#ifndef KORG_NODND 78#ifndef KORG_NODND
80// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; 79// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl;
81 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 80 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
82 !QTextDrag::canDecode( e ) ) { 81 !QTextDrag::canDecode( e ) ) {
83 e->ignore(); 82 e->ignore();
84 return; 83 return;
85 } 84 }
86 85
87 mOldCurrent = currentItem(); 86 mOldCurrent = currentItem();
88#endif 87#endif
89} 88}
90 89
91 90
92void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) 91void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e)
93{ 92{
94#ifndef KORG_NODND 93#ifndef KORG_NODND
95// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; 94// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl;
96 95
97 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 96 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
98 !QTextDrag::canDecode( e ) ) { 97 !QTextDrag::canDecode( e ) ) {
99 e->ignore(); 98 e->ignore();
100 return; 99 return;
101 } 100 }
102 101
103 e->accept(); 102 e->accept();
104#endif 103#endif
105} 104}
106 105
107void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) 106void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *)
108{ 107{
109#ifndef KORG_NODND 108#ifndef KORG_NODND
110// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; 109// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl;
111 110
112 setCurrentItem(mOldCurrent); 111 setCurrentItem(mOldCurrent);
113 setSelected(mOldCurrent,true); 112 setSelected(mOldCurrent,true);
114#endif 113#endif
115} 114}
116 115
117void KOTodoListView::contentsDropEvent(QDropEvent *e) 116void KOTodoListView::contentsDropEvent(QDropEvent *e)
118{ 117{
119#ifndef KORG_NODND 118#ifndef KORG_NODND
120// kdDebug() << "KOTodoListView::contentsDropEvent" << endl; 119// kdDebug() << "KOTodoListView::contentsDropEvent" << endl;
121 120
122 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 121 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
123 !QTextDrag::canDecode( e ) ) { 122 !QTextDrag::canDecode( e ) ) {
124 e->ignore(); 123 e->ignore();
125 return; 124 return;
126 } 125 }
127 126
128 DndFactory factory( mCalendar ); 127 DndFactory factory( mCalendar );
129 Todo *todo = factory.createDropTodo(e); 128 Todo *todo = factory.createDropTodo(e);
130 129
131 if (todo) { 130 if (todo) {
132 e->acceptAction(); 131 e->acceptAction();
133 132
134 KOTodoViewItem *destination = 133 KOTodoViewItem *destination =
135 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); 134 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos()));
136 Todo *destinationEvent = 0; 135 Todo *destinationEvent = 0;
137 if (destination) destinationEvent = destination->todo(); 136 if (destination) destinationEvent = destination->todo();
138 137
139 Todo *existingTodo = mCalendar->todo(todo->uid()); 138 Todo *existingTodo = mCalendar->todo(todo->uid());
140 139
141 if(existingTodo) { 140 if(existingTodo) {
142// kdDebug() << "Drop existing Todo" << endl; 141// kdDebug() << "Drop existing Todo" << endl;
143 Incidence *to = destinationEvent; 142 Incidence *to = destinationEvent;
144 while(to) { 143 while(to) {
145 if (to->uid() == todo->uid()) { 144 if (to->uid() == todo->uid()) {
146 KMessageBox::sorry(this, 145 KMessageBox::sorry(this,
147 i18n("Cannot move To-Do to itself or a child of itself"), 146 i18n("Cannot move To-Do to itself or a child of itself"),
148 i18n("Drop To-Do")); 147 i18n("Drop To-Do"));
149 delete todo; 148 delete todo;
150 return; 149 return;
151 } 150 }
152 to = to->relatedTo(); 151 to = to->relatedTo();
153 } 152 }
154 existingTodo->setRelatedTo(destinationEvent); 153 existingTodo->setRelatedTo(destinationEvent);
155 emit todoDropped(todo); 154 emit todoDropped(todo);
156 delete todo; 155 delete todo;
157 } else { 156 } else {
158// kdDebug() << "Drop new Todo" << endl; 157// kdDebug() << "Drop new Todo" << endl;
159 todo->setRelatedTo(destinationEvent); 158 todo->setRelatedTo(destinationEvent);
160 mCalendar->addTodo(todo); 159 mCalendar->addTodo(todo);
161 160
162 emit todoDropped(todo); 161 emit todoDropped(todo);
163 } 162 }
164 } 163 }
165 else { 164 else {
166 QString text; 165 QString text;
167 if (QTextDrag::decode(e,text)) { 166 if (QTextDrag::decode(e,text)) {
168 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); 167 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) );
169 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); 168 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) ));
170 kdDebug() << "Dropped : " << text << endl; 169 kdDebug() << "Dropped : " << text << endl;
171 QStringList emails = QStringList::split(",",text); 170 QStringList emails = QStringList::split(",",text);
172 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { 171 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) {
173 kdDebug() << " Email: " << (*it) << endl; 172 kdDebug() << " Email: " << (*it) << endl;
174 int pos = (*it).find("<"); 173 int pos = (*it).find("<");
175 QString name = (*it).left(pos); 174 QString name = (*it).left(pos);
176 QString email = (*it).mid(pos); 175 QString email = (*it).mid(pos);
177 if (!email.isEmpty() && todoi) { 176 if (!email.isEmpty() && todoi) {
178 todoi->todo()->addAttendee(new Attendee(name,email)); 177 todoi->todo()->addAttendee(new Attendee(name,email));
179 } 178 }
180 } 179 }
181 } 180 }
182 else { 181 else {
183 kdDebug() << "KOTodoListView::contentsDropEvent(): Todo from drop not decodable" << endl; 182 kdDebug() << "KOTodoListView::contentsDropEvent(): Todo from drop not decodable" << endl;
184 e->ignore(); 183 e->ignore();
185 } 184 }
186 } 185 }
187#endif 186#endif
188} 187}
189 188
190void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) 189void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
191{ 190{
192 QListView::contentsMousePressEvent(e); 191 QListView::contentsMousePressEvent(e);
193#ifndef KORG_NODND 192#ifndef KORG_NODND
194 QPoint p(contentsToViewport(e->pos())); 193 QPoint p(contentsToViewport(e->pos()));
195 QListViewItem *i = itemAt(p); 194 QListViewItem *i = itemAt(p);
196 if (i) { 195 if (i) {
197 // if the user clicked into the root decoration of the item, don't 196 // if the user clicked into the root decoration of the item, don't
198 // try to start a drag! 197 // try to start a drag!
199 if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + 198 if (p.x() > header()->sectionPos(header()->mapToIndex(0)) +
200 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + 199 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
201 itemMargin() || 200 itemMargin() ||
202 p.x() < header()->sectionPos(header()->mapToIndex(0))) { 201 p.x() < header()->sectionPos(header()->mapToIndex(0))) {
203 if (e->button()==Qt::LeftButton) { 202 if (e->button()==Qt::LeftButton) {
204 mPressPos = e->pos(); 203 mPressPos = e->pos();
205 mMousePressed = true; 204 mMousePressed = true;
206 } 205 }
207 } 206 }
208 } 207 }
209#endif 208#endif
210} 209}
211 210
212void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 211void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
213{ 212{
214#ifndef KORG_NODND 213#ifndef KORG_NODND
215// kdDebug() << "KOTodoListView::contentsMouseMoveEvent()" << endl; 214// kdDebug() << "KOTodoListView::contentsMouseMoveEvent()" << endl;
216 QListView::contentsMouseMoveEvent(e); 215 QListView::contentsMouseMoveEvent(e);
217 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > 216 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() >
218 QApplication::startDragDistance()) { 217 QApplication::startDragDistance()) {
219 mMousePressed = false; 218 mMousePressed = false;
220 QListViewItem *item = itemAt(contentsToViewport(mPressPos)); 219 QListViewItem *item = itemAt(contentsToViewport(mPressPos));
221 if (item) { 220 if (item) {
222// kdDebug() << "Start Drag for item " << item->text(0) << endl; 221// kdDebug() << "Start Drag for item " << item->text(0) << endl;
223 DndFactory factory( mCalendar ); 222 DndFactory factory( mCalendar );
224 ICalDrag *vd = factory.createDragTodo( 223 ICalDrag *vd = factory.createDragTodo(
225 ((KOTodoViewItem *)item)->todo(),viewport()); 224 ((KOTodoViewItem *)item)->todo(),viewport());
226 if (vd->drag()) { 225 if (vd->drag()) {
227 kdDebug() << "KOTodoListView::contentsMouseMoveEvent(): Delete drag source" << endl; 226 kdDebug() << "KOTodoListView::contentsMouseMoveEvent(): Delete drag source" << endl;
228 } 227 }
229/* 228/*
230 QString source = fullPath(item); 229 QString source = fullPath(item);
231 if ( QFile::exists(source) ) { 230 if ( QFile::exists(source) ) {
232 QUriDrag* ud = new QUriDrag(viewport()); 231 QUriDrag* ud = new QUriDrag(viewport());
233 ud->setFilenames( source ); 232 ud->setFilenames( source );
234 if ( ud->drag() ) 233 if ( ud->drag() )
235 QMessageBox::information( this, "Drag source", 234 QMessageBox::information( this, "Drag source",
236 QString("Delete ")+source, "Not implemented" ); 235 QString("Delete ")+source, "Not implemented" );
237*/ 236*/
238 } 237 }
239 } 238 }
240#endif 239#endif
241} 240}
242void KOTodoListView::keyPressEvent ( QKeyEvent * e ) 241void KOTodoListView::keyPressEvent ( QKeyEvent * e )
243{ 242{
244 243
245 QListViewItem* cn; 244 QListViewItem* cn;
246 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { 245 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) {
247 cn = currentItem(); 246 cn = currentItem();
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 88d69c6..fc2bc77 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -1,241 +1,240 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2001 4 Copyright (c) 2001
5 Cornelius Schumacher <schumacher@kde.org> 5 Cornelius Schumacher <schumacher@kde.org>
6 6
7 This program is free software; you can redistribute it and/or modify 7 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 8 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 9 the Free Software Foundation; either version 2 of the License, or
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 <qwidgetstack.h>
27 27
28#include <kconfig.h> 28#include <kconfig.h>
29#include <kglobal.h> 29#include <kglobal.h>
30#ifndef DESKTOP_VERSION 30#ifndef DESKTOP_VERSION
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
32#else 32#else
33#include <qapplication.h> 33#include <qapplication.h>
34#endif 34#endif
35#include "calendarview.h" 35#include "calendarview.h"
36#include "datenavigator.h" 36#include "datenavigator.h"
37#include "kotodoview.h" 37#include "kotodoview.h"
38#include "koagendaview.h" 38#include "koagendaview.h"
39#include "kodialogmanager.h" 39#include "kodialogmanager.h"
40#include "komonthview.h" 40#include "komonthview.h"
41#include "kolistview.h" 41#include "kolistview.h"
42#include "kowhatsnextview.h" 42#include "kowhatsnextview.h"
43#include "kojournalview.h" 43#include "kojournalview.h"
44#include "kotimespanview.h" 44#include "kotimespanview.h"
45#include "koprefs.h" 45#include "koprefs.h"
46#include "navigatorbar.h" 46#include "navigatorbar.h"
47 47
48#include "koviewmanager.h" 48#include "koviewmanager.h"
49#include "koviewmanager.moc"
50//extern bool externFlagMonthviewBlockPainting; 49//extern bool externFlagMonthviewBlockPainting;
51 50
52//bool globalFlagBlockPainting = false; 51//bool globalFlagBlockPainting = false;
53int globalFlagBlockAgenda = 0; 52int globalFlagBlockAgenda = 0;
54int globalFlagBlockLabel = 0; 53int globalFlagBlockLabel = 0;
55int globalFlagBlockAgendaItemPaint = 1; 54int globalFlagBlockAgendaItemPaint = 1;
56int globalFlagBlockAgendaItemUpdate = 1; 55int globalFlagBlockAgendaItemUpdate = 1;
57 56
58 57
59KOViewManager::KOViewManager( CalendarView *mainView ) : 58KOViewManager::KOViewManager( CalendarView *mainView ) :
60 QObject(), mMainView( mainView ) 59 QObject(), mMainView( mainView )
61{ 60{
62 mCurrentView = 0; 61 mCurrentView = 0;
63 62
64 mWhatsNextView = 0; 63 mWhatsNextView = 0;
65 mTodoView = 0; 64 mTodoView = 0;
66 mAgendaView = 0; 65 mAgendaView = 0;
67 mMonthView = 0; 66 mMonthView = 0;
68 mListView = 0; 67 mListView = 0;
69 mJournalView = 0; 68 mJournalView = 0;
70 mTimeSpanView = 0; 69 mTimeSpanView = 0;
71 mCurrentAgendaView = 0 ; 70 mCurrentAgendaView = 0 ;
72 mFlagShowNextxDays = false; 71 mFlagShowNextxDays = false;
73} 72}
74 73
75KOViewManager::~KOViewManager() 74KOViewManager::~KOViewManager()
76{ 75{
77} 76}
78 77
79 78
80KOrg::BaseView *KOViewManager::currentView() 79KOrg::BaseView *KOViewManager::currentView()
81{ 80{
82 return mCurrentView; 81 return mCurrentView;
83} 82}
84 83
85void KOViewManager::readSettings(KConfig *config) 84void KOViewManager::readSettings(KConfig *config)
86{ 85{
87 config->setGroup("General"); 86 config->setGroup("General");
88 QString view = config->readEntry("Current View"); 87 QString view = config->readEntry("Current View");
89 if (view == "WhatsNext") showWhatsNextView(); 88 if (view == "WhatsNext") showWhatsNextView();
90 else if (view == "Month") showMonthView(); 89 else if (view == "Month") showMonthView();
91 else if (view == "List") showListView(); 90 else if (view == "List") showListView();
92 else if (view == "Journal") showJournalView(); 91 else if (view == "Journal") showJournalView();
93 else if (view == "TimeSpan") showTimeSpanView(); 92 else if (view == "TimeSpan") showTimeSpanView();
94 else if (view == "Todo") showTodoView(); 93 else if (view == "Todo") showTodoView();
95 else { 94 else {
96 showAgendaView(); 95 showAgendaView();
97 } 96 }
98} 97}
99 98
100void KOViewManager::writeSettings(KConfig *config) 99void KOViewManager::writeSettings(KConfig *config)
101{ 100{
102 config->setGroup("General"); 101 config->setGroup("General");
103 102
104 QString view; 103 QString view;
105 if (mCurrentView == mWhatsNextView) view = "WhatsNext"; 104 if (mCurrentView == mWhatsNextView) view = "WhatsNext";
106 else if (mCurrentView == mMonthView) view = "Month"; 105 else if (mCurrentView == mMonthView) view = "Month";
107 else if (mCurrentView == mListView) view = "List"; 106 else if (mCurrentView == mListView) view = "List";
108 else if (mCurrentView == mJournalView) view = "Journal"; 107 else if (mCurrentView == mJournalView) view = "Journal";
109 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 108 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
110 else if (mCurrentView == mTodoView) view = "Todo"; 109 else if (mCurrentView == mTodoView) view = "Todo";
111 else view = "Agenda"; 110 else view = "Agenda";
112 111
113 config->writeEntry("Current View",view); 112 config->writeEntry("Current View",view);
114 113
115 if (mAgendaView) { 114 if (mAgendaView) {
116 mAgendaView->writeSettings(config); 115 mAgendaView->writeSettings(config);
117 } 116 }
118 if (mTimeSpanView) { 117 if (mTimeSpanView) {
119 mTimeSpanView->writeSettings(config); 118 mTimeSpanView->writeSettings(config);
120 } 119 }
121 if (mListView) { 120 if (mListView) {
122 mListView->writeSettings(config); 121 mListView->writeSettings(config);
123 } 122 }
124 if (mTodoView) { 123 if (mTodoView) {
125 mTodoView->saveLayout(config,"Todo View"); 124 mTodoView->saveLayout(config,"Todo View");
126 } 125 }
127} 126}
128 127
129void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 128void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
130{ 129{
131 130
132 //mFlagShowNextxDays = false; 131 //mFlagShowNextxDays = false;
133 //if(view == mCurrentView) return; 132 //if(view == mCurrentView) return;
134 if ( view == 0 ) { 133 if ( view == 0 ) {
135 view = mCurrentView; 134 view = mCurrentView;
136 if ( view == 0 ) 135 if ( view == 0 )
137 return; 136 return;
138 } 137 }
139 bool full = fullScreen; 138 bool full = fullScreen;
140 if(view == mCurrentView && view != mWhatsNextView ) { 139 if(view == mCurrentView && view != mWhatsNextView ) {
141 if ( mCurrentAgendaView < 0 ) 140 if ( mCurrentAgendaView < 0 )
142 return; 141 return;
143 full = mMainView->leftFrame()->isVisible(); 142 full = mMainView->leftFrame()->isVisible();
144 } else { 143 } else {
145 mCurrentView = view; 144 mCurrentView = view;
146 145
147 // bool full = fullScreen; 146 // bool full = fullScreen;
148 bool isFull = !mMainView->leftFrame()->isVisible(); 147 bool isFull = !mMainView->leftFrame()->isVisible();
149 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 148 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
150 full = true; 149 full = true;
151 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 150 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
152 full = false; 151 full = false;
153 } 152 }
154 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 153 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
155 raiseCurrentView( full ); 154 raiseCurrentView( full );
156 mMainView->processIncidenceSelection( 0 ); 155 mMainView->processIncidenceSelection( 0 );
157 mMainView->updateView(); 156 mMainView->updateView();
158 mMainView->adaptNavigationUnits(); 157 mMainView->adaptNavigationUnits();
159} 158}
160 159
161void KOViewManager::raiseCurrentView( bool fullScreen ) 160void KOViewManager::raiseCurrentView( bool fullScreen )
162{ 161{
163 //qDebug("raiseCurrentView "); 162 //qDebug("raiseCurrentView ");
164 mCurrentAgendaView = 0; 163 mCurrentAgendaView = 0;
165 int wid = mMainView->width() ; 164 int wid = mMainView->width() ;
166 int hei = mMainView->height(); 165 int hei = mMainView->height();
167 if ( mCurrentView == mMonthView ) { 166 if ( mCurrentView == mMonthView ) {
168 mMainView->navigatorBar()->show(); 167 mMainView->navigatorBar()->show();
169 hei -= mMainView->navigatorBar()->sizeHint().height(); 168 hei -= mMainView->navigatorBar()->sizeHint().height();
170 //mMainView->navigatorBar()->hide(); 169 //mMainView->navigatorBar()->hide();
171 } else { 170 } else {
172 mMainView->navigatorBar()->hide(); 171 mMainView->navigatorBar()->hide();
173 } 172 }
174 if ( fullScreen ) { 173 if ( fullScreen ) {
175 mMainView->leftFrame()->hide(); 174 mMainView->leftFrame()->hide();
176 } else { 175 } else {
177 mMainView->leftFrame()->show(); 176 mMainView->leftFrame()->show();
178 if ( KOPrefs::instance()->mVerticalScreen ) 177 if ( KOPrefs::instance()->mVerticalScreen )
179 hei -= mMainView->leftFrame()->height(); 178 hei -= mMainView->leftFrame()->height();
180 else 179 else
181 wid -= mMainView->leftFrame()->width(); 180 wid -= mMainView->leftFrame()->width();
182 } 181 }
183 182
184 if ( globalFlagBlockAgenda == 5 ) { 183 if ( globalFlagBlockAgenda == 5 ) {
185 globalFlagBlockAgenda = 4; 184 globalFlagBlockAgenda = 4;
186 globalFlagBlockAgendaItemPaint = 1; 185 globalFlagBlockAgendaItemPaint = 1;
187 } 186 }
188 mMainView->viewStack()->raiseWidget(mCurrentView); 187 mMainView->viewStack()->raiseWidget(mCurrentView);
189 if ( globalFlagBlockAgenda == 4 ) { 188 if ( globalFlagBlockAgenda == 4 ) {
190 if ( mCurrentView == mAgendaView ) { 189 if ( mCurrentView == mAgendaView ) {
191 //globalFlagBlockAgenda =1 ; 190 //globalFlagBlockAgenda =1 ;
192 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 191 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
193 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 192 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
194 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 193 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
195 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 194 mAgendaView->setStartHour( QTime::currentTime ().hour() );
196 qApp->processEvents(); 195 qApp->processEvents();
197 //qDebug("qApp->processEvents() "); 196 //qDebug("qApp->processEvents() ");
198 globalFlagBlockAgenda = 0; 197 globalFlagBlockAgenda = 0;
199 mAgendaView->repaintAgenda(); 198 mAgendaView->repaintAgenda();
200 199
201 } 200 }
202 globalFlagBlockAgenda = 0; 201 globalFlagBlockAgenda = 0;
203 } 202 }
204 //qDebug("raiseCurrentView ende "); 203 //qDebug("raiseCurrentView ende ");
205} 204}
206 205
207void KOViewManager::updateView() 206void KOViewManager::updateView()
208{ 207{
209 // qDebug("KOViewManager::updateView() "); 208 // qDebug("KOViewManager::updateView() ");
210 // if we are updating mTodoView, we get endless recursion 209 // if we are updating mTodoView, we get endless recursion
211 if ( mTodoView == mCurrentView ) 210 if ( mTodoView == mCurrentView )
212 return; 211 return;
213 if ( mCurrentView ) mCurrentView->updateView(); 212 if ( mCurrentView ) mCurrentView->updateView();
214 213
215} 214}
216 215
217void KOViewManager::updateView(const QDate &start, const QDate &end) 216void KOViewManager::updateView(const QDate &start, const QDate &end)
218{ 217{
219 // kdDebug() << "KOViewManager::updateView()" << endl; 218 // kdDebug() << "KOViewManager::updateView()" << endl;
220 219
221 if (mCurrentView) mCurrentView->showDates(start, end); 220 if (mCurrentView) mCurrentView->showDates(start, end);
222 221
223 if (mTodoView) mTodoView->updateView(); 222 if (mTodoView) mTodoView->updateView();
224} 223}
225 224
226 225
227void KOViewManager::showWhatsNextView() 226void KOViewManager::showWhatsNextView()
228{ 227{
229 if (!mWhatsNextView) { 228 if (!mWhatsNextView) {
230 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 229 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
231 "KOViewManager::WhatsNextView"); 230 "KOViewManager::WhatsNextView");
232 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 231 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
233 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 232 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
234 addView(mWhatsNextView); 233 addView(mWhatsNextView);
235 } 234 }
236 globalFlagBlockAgenda = 1; 235 globalFlagBlockAgenda = 1;
237 showView(mWhatsNextView, true ); 236 showView(mWhatsNextView, true );
238 mWhatsNextView->updateView(); 237 mWhatsNextView->updateView();
239 238
240} 239}
241 240
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index ffaea37..0547a2e 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -1,237 +1,236 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
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 <qlayout.h> 20#include <qlayout.h>
21#include <qtextbrowser.h> 21#include <qtextbrowser.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 27
28#include <kglobal.h> 28#include <kglobal.h>
29#include <klocale.h> 29#include <klocale.h>
30#include <kdebug.h> 30#include <kdebug.h>
31#include <kiconloader.h> 31#include <kiconloader.h>
32#include <kmessagebox.h> 32#include <kmessagebox.h>
33 33
34#include <libkcal/calendar.h> 34#include <libkcal/calendar.h>
35 35
36#ifndef KORG_NOPRINTER 36#ifndef KORG_NOPRINTER
37#include "calprinter.h" 37#include "calprinter.h"
38#endif 38#endif
39#include "koglobals.h" 39#include "koglobals.h"
40#include "koprefs.h" 40#include "koprefs.h"
41#include "koeventviewerdialog.h" 41#include "koeventviewerdialog.h"
42 42
43#include "kowhatsnextview.h" 43#include "kowhatsnextview.h"
44using namespace KOrg; 44using namespace KOrg;
45#include "kowhatsnextview.moc"
46 45
47void WhatsNextTextBrowser::setSource(const QString& n) 46void WhatsNextTextBrowser::setSource(const QString& n)
48{ 47{
49 48
50 if (n.startsWith("event:")) { 49 if (n.startsWith("event:")) {
51 emit showIncidence(n); 50 emit showIncidence(n);
52 return; 51 return;
53 } else if (n.startsWith("todo:")) { 52 } else if (n.startsWith("todo:")) {
54 emit showIncidence(n); 53 emit showIncidence(n);
55 return; 54 return;
56 } else { 55 } else {
57 QTextBrowser::setSource(n); 56 QTextBrowser::setSource(n);
58 } 57 }
59} 58}
60 59
61KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, 60KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
62 const char *name) 61 const char *name)
63 : KOrg::BaseView(calendar, parent, name) 62 : KOrg::BaseView(calendar, parent, name)
64{ 63{
65 // mDateLabel = 64 // mDateLabel =
66 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); 65 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this);
67 // mDateLabel->setMargin(2); 66 // mDateLabel->setMargin(2);
68 // mDateLabel->setAlignment(AlignCenter); 67 // mDateLabel->setAlignment(AlignCenter);
69 setFont( KOPrefs::instance()->mWhatsNextFont ); 68 setFont( KOPrefs::instance()->mWhatsNextFont );
70 mView = new WhatsNextTextBrowser(this); 69 mView = new WhatsNextTextBrowser(this);
71 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); 70 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &)));
72 71
73 mEventViewer = 0; 72 mEventViewer = 0;
74 73
75 QBoxLayout *topLayout = new QVBoxLayout(this); 74 QBoxLayout *topLayout = new QVBoxLayout(this);
76 // topLayout->addWidget(mDateLabel); 75 // topLayout->addWidget(mDateLabel);
77 topLayout->addWidget(mView); 76 topLayout->addWidget(mView);
78} 77}
79 78
80KOWhatsNextView::~KOWhatsNextView() 79KOWhatsNextView::~KOWhatsNextView()
81{ 80{
82} 81}
83 82
84int KOWhatsNextView::maxDatesHint() 83int KOWhatsNextView::maxDatesHint()
85{ 84{
86 return 0; 85 return 0;
87} 86}
88 87
89int KOWhatsNextView::currentDateCount() 88int KOWhatsNextView::currentDateCount()
90{ 89{
91 return 0; 90 return 0;
92} 91}
93 92
94QPtrList<Incidence> KOWhatsNextView::selectedIncidences() 93QPtrList<Incidence> KOWhatsNextView::selectedIncidences()
95{ 94{
96 QPtrList<Incidence> eventList; 95 QPtrList<Incidence> eventList;
97 96
98 return eventList; 97 return eventList;
99} 98}
100 99
101 100
102void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, 101void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd,
103 const QDate &td) 102 const QDate &td)
104{ 103{
105#ifndef KORG_NOPRINTER 104#ifndef KORG_NOPRINTER
106 calPrinter->preview(CalPrinter::Day, fd, td); 105 calPrinter->preview(CalPrinter::Day, fd, td);
107#endif 106#endif
108} 107}
109void KOWhatsNextView::updateConfig() 108void KOWhatsNextView::updateConfig()
110{ 109{
111 setFont( KOPrefs::instance()->mWhatsNextFont ); 110 setFont( KOPrefs::instance()->mWhatsNextFont );
112 updateView(); 111 updateView();
113 112
114} 113}
115void KOWhatsNextView::updateView() 114void KOWhatsNextView::updateView()
116{ 115{
117 116
118 // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); 117 // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate()));
119 KIconLoader kil("korganizer"); 118 KIconLoader kil("korganizer");
120 QString ipath;// = new QString(); 119 QString ipath;// = new QString();
121 // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); 120 // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath);
122 //<big><big><strong>" + date + "</strong></big></big>\n"; 121 //<big><big><strong>" + date + "</strong></big></big>\n";
123 mText = "<table width=\"100%\">\n"; 122 mText = "<table width=\"100%\">\n";
124 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 123 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
125#ifdef DESKTOP_VERSION 124#ifdef DESKTOP_VERSION
126 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; 125 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>";
127#else 126#else
128 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 127 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
129#endif 128#endif
130 // mText += "<img src=\""; 129 // mText += "<img src=\"";
131 // mText += ipath; 130 // mText += ipath;
132 // mText += "\">"; 131 // mText += "\">";
133 mEventDate = QDate::currentDate(); 132 mEventDate = QDate::currentDate();
134#ifdef DESKTOP_VERSION 133#ifdef DESKTOP_VERSION
135 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; 134 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>";
136#else 135#else
137 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; 136 mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>";
138#endif 137#endif
139 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; 138 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
140 int iii; 139 int iii;
141 mTodos.clear(); 140 mTodos.clear();
142 QPtrList<Event> events; 141 QPtrList<Event> events;
143 QPtrList<Todo> todos = calendar()->todos(); 142 QPtrList<Todo> todos = calendar()->todos();
144 Todo * todo; 143 Todo * todo;
145 //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; 144 //mText += "<h2>" + i18n("Events: ") + "</h2>\n";
146 int daysToShow = KOPrefs::instance()->mWhatsNextDays ; 145 int daysToShow = KOPrefs::instance()->mWhatsNextDays ;
147 bool itemAdded = false; 146 bool itemAdded = false;
148 for ( iii = 0; iii < daysToShow; ++iii ) { 147 for ( iii = 0; iii < daysToShow; ++iii ) {
149 QString date; 148 QString date;
150 itemAdded = false; 149 itemAdded = false;
151 events = calendar()->events( mEventDate, true ); 150 events = calendar()->events( mEventDate, true );
152 151
153 if ( iii == 0 ) { // today !!! 152 if ( iii == 0 ) { // today !!!
154 todo = todos.first(); 153 todo = todos.first();
155 while(todo) { 154 while(todo) {
156 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { 155 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) {
157 if ( ! itemAdded ) { 156 if ( ! itemAdded ) {
158 appendDay ( iii, mEventDate ); 157 appendDay ( iii, mEventDate );
159 itemAdded = true; 158 itemAdded = true;
160 159
161 } 160 }
162 appendEvent(todo); 161 appendEvent(todo);
163 } 162 }
164 todo = todos.next(); 163 todo = todos.next();
165 } 164 }
166 } 165 }
167 166
168 167
169 if (events.count() > 0) { 168 if (events.count() > 0) {
170 // mText += "<p></p>"; 169 // mText += "<p></p>";
171 // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 170 // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
172 // mText += "<h2>"; 171 // mText += "<h2>";
173 //mText += " <img src=\""; 172 //mText += " <img src=\"";
174 //mText += ipath; 173 //mText += ipath;
175 //mText += "\">"; 174 //mText += "\">";
176 if ( ! itemAdded ) { 175 if ( ! itemAdded ) {
177 appendDay ( iii, mEventDate ); 176 appendDay ( iii, mEventDate );
178 itemAdded = true; 177 itemAdded = true;
179 178
180 } 179 }
181 Event *ev = events.first(); 180 Event *ev = events.first();
182 while(ev) { 181 while(ev) {
183 //qDebug("+++++event append %s", ev->summary().latin1()); 182 //qDebug("+++++event append %s", ev->summary().latin1());
184 if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { 183 if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) {
185 appendEvent(ev, false , iii!= 0 ); 184 appendEvent(ev, false , iii!= 0 );
186 } 185 }
187 ev = events.next(); 186 ev = events.next();
188 } 187 }
189 188
190 //mText += "</table>\n"; 189 //mText += "</table>\n";
191 } 190 }
192 191
193 todo = todos.first(); 192 todo = todos.first();
194 while(todo) { 193 while(todo) {
195 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { 194 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) {
196 if ( ! itemAdded ) { 195 if ( ! itemAdded ) {
197 appendDay ( iii, mEventDate ); 196 appendDay ( iii, mEventDate );
198 itemAdded = true; 197 itemAdded = true;
199 } 198 }
200 appendEvent(todo); 199 appendEvent(todo);
201 } 200 }
202 todo = todos.next(); 201 todo = todos.next();
203 } 202 }
204 if ( !itemAdded && iii == 0 ) { 203 if ( !itemAdded && iii == 0 ) {
205 // appendDay ( iii, mEventDate ); 204 // appendDay ( iii, mEventDate );
206 //mText += "<table>"; 205 //mText += "<table>";
207 // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; 206 // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n";
208 mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n"; 207 mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n";
209 //mText +="</table>"; 208 //mText +="</table>";
210 } 209 }
211 if ( itemAdded ) 210 if ( itemAdded )
212 mText += "</table>\n"; 211 mText += "</table>\n";
213 mEventDate = mEventDate.addDays( 1 ); 212 mEventDate = mEventDate.addDays( 1 );
214 } 213 }
215 214
216 int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; 215 int topmostPrios = KOPrefs::instance()->mWhatsNextPrios;
217 if (todos.count() > 0 && topmostPrios > 0 ) { 216 if (todos.count() > 0 && topmostPrios > 0 ) {
218 // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 217 // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
219 // mText += "<h2>"; 218 // mText += "<h2>";
220 //<img src=\""; 219 //<img src=\"";
221 // mText += ipath; 220 // mText += ipath;
222 // mText += "\">"; 221 // mText += "\">";
223 // mText += i18n("Overdue To-Do:") + "</h2>\n"; 222 // mText += i18n("Overdue To-Do:") + "</h2>\n";
224 223
225 //mText += "<ul>\n"; 224 //mText += "<ul>\n";
226 bool gotone = false; 225 bool gotone = false;
227 int priority = 1; 226 int priority = 1;
228 int priosFound = 0; 227 int priosFound = 0;
229#ifdef DESKTOP_VERSION 228#ifdef DESKTOP_VERSION
230 mText +="<p></p>"; 229 mText +="<p></p>";
231#endif 230#endif
232 231
233 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></strong></big></big>\n"; 232 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></strong></big></big>\n";
234 mText += "<ul>\n"; 233 mText += "<ul>\n";
235 while (!gotone && priority<6) { 234 while (!gotone && priority<6) {
236 todo = todos.first(); 235 todo = todos.first();
237 while(todo) { 236 while(todo) {
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp
index f9720f6..cf07a1a 100644
--- a/korganizer/ktimeedit.cpp
+++ b/korganizer/ktimeedit.cpp
@@ -1,230 +1,229 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1999 Preston Brown, Ian Dawes 3 Copyright (c) 1999 Preston Brown, Ian Dawes
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 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 <qkeycode.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 <qapplication.h> 28#include <qapplication.h>
29 29
30#include <kmessagebox.h> 30#include <kmessagebox.h>
31#include <kglobal.h> 31#include <kglobal.h>
32#include <kdebug.h> 32#include <kdebug.h>
33#include <klocale.h> 33#include <klocale.h>
34 34
35#include "ktimeedit.h" 35#include "ktimeedit.h"
36#include "koprefs.h" 36#include "koprefs.h"
37#include <qvalidator.h> 37#include <qvalidator.h>
38#include "ktimeedit.moc"
39 38
40// Validator for a time value with only hours and minutes (no seconds) 39// Validator for a time value with only hours and minutes (no seconds)
41// Mostly locale aware. Author: David Faure <faure@kde.org> 40// Mostly locale aware. Author: David Faure <faure@kde.org>
42class KOTimeValidator : public QValidator 41class KOTimeValidator : public QValidator
43{ 42{
44public: 43public:
45 KOTimeValidator(QWidget* parent, const char* name=0) : QValidator(parent, name) {} 44 KOTimeValidator(QWidget* parent, const char* name=0) : QValidator(parent, name) {}
46 45
47 virtual State validate(QString& str, int& /*cursorPos*/) const 46 virtual State validate(QString& str, int& /*cursorPos*/) const
48 { 47 {
49 return Acceptable; 48 return Acceptable;
50 bool ok = false; 49 bool ok = false;
51 // TODO use KLocale::WithoutSeconds in HEAD 50 // TODO use KLocale::WithoutSeconds in HEAD
52 /*QTime time =*/ KGlobal::locale()->readTime(str, &ok); 51 /*QTime time =*/ KGlobal::locale()->readTime(str, &ok);
53 if ( ok ) 52 if ( ok )
54 return Acceptable; 53 return Acceptable;
55 // readTime doesn't help knowing when the string is "Intermediate". 54 // readTime doesn't help knowing when the string is "Intermediate".
56 int length = str.length(); 55 int length = str.length();
57 if ( !str ) // empty string? 56 if ( !str ) // empty string?
58 return Invalid; // there should always be a ':' in it, right? 57 return Invalid; // there should always be a ':' in it, right?
59 // HACK. Not fully locale aware etc. (esp. the separator is '.' in sv_SE...) 58 // HACK. Not fully locale aware etc. (esp. the separator is '.' in sv_SE...)
60 QChar sep = ':'; 59 QChar sep = ':';
61 // I want to allow "HH:", ":MM" and ":" to make editing easier 60 // I want to allow "HH:", ":MM" and ":" to make editing easier
62 if ( str[0] == sep ) 61 if ( str[0] == sep )
63 { 62 {
64 if ( length == 1 ) // just ":" 63 if ( length == 1 ) // just ":"
65 return Intermediate; 64 return Intermediate;
66 QString minutes = str.mid(1); 65 QString minutes = str.mid(1);
67 int m = minutes.toInt(&ok); 66 int m = minutes.toInt(&ok);
68 if ( ok && m >= 0 && m < 60 ) 67 if ( ok && m >= 0 && m < 60 )
69 return Intermediate; 68 return Intermediate;
70 } else if ( str.at(str.length()-1) == sep ) 69 } else if ( str.at(str.length()-1) == sep )
71 { 70 {
72 QString hours = str.left(length-1); 71 QString hours = str.left(length-1);
73 int h = hours.toInt(&ok); 72 int h = hours.toInt(&ok);
74 if ( ok && h >= 0 && h < 24 ) 73 if ( ok && h >= 0 && h < 24 )
75 return Intermediate; 74 return Intermediate;
76 } 75 }
77 return Invalid; 76 return Invalid;
78 } 77 }
79}; 78};
80 79
81// KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox. 80// KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox.
82// Difficult to get all in one... 81// Difficult to get all in one...
83// But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help. 82// But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help.
84KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) 83KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name)
85 : QComboBox(TRUE, parent, name) 84 : QComboBox(TRUE, parent, name)
86{ 85{
87 setInsertionPolicy(NoInsertion); 86 setInsertionPolicy(NoInsertion);
88 setValidator( new KOTimeValidator( this ) ); 87 setValidator( new KOTimeValidator( this ) );
89 mFlagKeyPressed = false; 88 mFlagKeyPressed = false;
90 89
91 if ( QApplication::desktop()->width() < 650 ) 90 if ( QApplication::desktop()->width() < 650 )
92 setSizeLimit ( 6 ); 91 setSizeLimit ( 6 );
93 mTime = qt; 92 mTime = qt;
94 93
95// mNoTimeString = i18n("No Time"); 94// mNoTimeString = i18n("No Time");
96// insertItem( mNoTimeString ); 95// insertItem( mNoTimeString );
97 96
98 // Fill combo box with selection of times in localized format. 97 // Fill combo box with selection of times in localized format.
99 QTime timeEntry(0,0,0); 98 QTime timeEntry(0,0,0);
100 do { 99 do {
101 insertItem(KGlobal::locale()->formatTime(timeEntry)); 100 insertItem(KGlobal::locale()->formatTime(timeEntry));
102 timeEntry = timeEntry.addSecs(60*15); 101 timeEntry = timeEntry.addSecs(60*15);
103 } while (!timeEntry.isNull()); 102 } while (!timeEntry.isNull());
104 // Add end of day. 103 // Add end of day.
105 insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) ); 104 insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) );
106 105
107 updateText(); 106 updateText();
108 setFocusPolicy(QWidget::StrongFocus); 107 setFocusPolicy(QWidget::StrongFocus);
109 108
110 connect(this, SIGNAL(activated(int)), this, SLOT(activ(int))); 109 connect(this, SIGNAL(activated(int)), this, SLOT(activ(int)));
111 connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int))); 110 connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int)));
112 connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText())); 111 connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText()));
113 QFontMetrics fm ( font() ); 112 QFontMetrics fm ( font() );
114 QString timeString = "24:00"; 113 QString timeString = "24:00";
115 if ( KOPrefs::instance()->mPreferredTime == 1 ) 114 if ( KOPrefs::instance()->mPreferredTime == 1 )
116 timeString = "02:00pm"; 115 timeString = "02:00pm";
117 int addSpace = 32; 116 int addSpace = 32;
118 if ( QApplication::desktop()->width() > 320 ) 117 if ( QApplication::desktop()->width() > 320 )
119 timeString += ":00"; 118 timeString += ":00";
120 setFixedWidth(fm.width( timeString ) + 32 ); 119 setFixedWidth(fm.width( timeString ) + 32 );
121 120
122 // Highlight Background and Textcolor change from default 121 // Highlight Background and Textcolor change from default
123 QPalette palette = QWidget::palette(); 122 QPalette palette = QWidget::palette();
124 unsigned char red, green, blue; 123 unsigned char red, green, blue;
125 red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10; 124 red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10;
126 green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10; 125 green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10;
127 blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10; 126 blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10;
128 palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) ); 127 palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) );
129 palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) ); 128 palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) );
130 setPalette( palette ); 129 setPalette( palette );
131} 130}
132 131
133KOTimeEdit::~KOTimeEdit() 132KOTimeEdit::~KOTimeEdit()
134{ 133{
135} 134}
136 135
137bool KOTimeEdit::hasTime() const 136bool KOTimeEdit::hasTime() const
138{ 137{
139 // Can't happen 138 // Can't happen
140 if ( currentText().isEmpty() ) return false; 139 if ( currentText().isEmpty() ) return false;
141 //if ( currentText() == mNoTimeString ) return false; 140 //if ( currentText() == mNoTimeString ) return false;
142 141
143 return true; // always 142 return true; // always
144} 143}
145 144
146QTime KOTimeEdit::getTime() const 145QTime KOTimeEdit::getTime() const
147{ 146{
148 //kdDebug(5850) << "KOTimeEdit::getTime(), currentText() = " << currentText() << endl; 147 //kdDebug(5850) << "KOTimeEdit::getTime(), currentText() = " << currentText() << endl;
149 // TODO use KLocale::WithoutSeconds in HEAD 148 // TODO use KLocale::WithoutSeconds in HEAD
150 QTime time = KGlobal::locale()->readTime(currentText()); 149 QTime time = KGlobal::locale()->readTime(currentText());
151 // kdDebug(5850) << "KOTimeEdit::getTime(): " << time.toString() << endl; 150 // kdDebug(5850) << "KOTimeEdit::getTime(): " << time.toString() << endl;
152 return time; 151 return time;
153} 152}
154/* 153/*
155QSizePolicy KOTimeEdit::sizePolicy() const 154QSizePolicy KOTimeEdit::sizePolicy() const
156{ 155{
157 // Set size policy to Fixed, because edit cannot contain more text than the 156 // Set size policy to Fixed, because edit cannot contain more text than the
158 // string representing the time. It doesn't make sense to provide more space. 157 // string representing the time. It doesn't make sense to provide more space.
159 QSizePolicy sizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); 158 QSizePolicy sizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
160 159
161 return sizePolicy; 160 return sizePolicy;
162} 161}
163*/ 162*/
164void KOTimeEdit::setTime(QTime newTime) 163void KOTimeEdit::setTime(QTime newTime)
165{ 164{
166 if ( mTime != newTime ) 165 if ( mTime != newTime )
167 { 166 {
168 kdDebug(5850) << "KOTimeEdit::setTime(): " << newTime.toString() << endl; 167 kdDebug(5850) << "KOTimeEdit::setTime(): " << newTime.toString() << endl;
169 168
170 mTime = newTime; 169 mTime = newTime;
171 updateText(); 170 updateText();
172 } 171 }
173 172
174} 173}
175 174
176void KOTimeEdit::activ(int i) 175void KOTimeEdit::activ(int i)
177{ 176{
178 // The last entry, 23:59, is a special case 177 // The last entry, 23:59, is a special case
179 if( i == count() - 1 ) 178 if( i == count() - 1 )
180 mTime = QTime( 23, 59, 0 ); 179 mTime = QTime( 23, 59, 0 );
181 else 180 else
182 mTime = QTime(0,0,0).addSecs(i*15*60); 181 mTime = QTime(0,0,0).addSecs(i*15*60);
183 emit timeChanged(mTime); 182 emit timeChanged(mTime);
184} 183}
185 184
186void KOTimeEdit::hilit(int ) 185void KOTimeEdit::hilit(int )
187{ 186{
188 // we don't currently need to do anything here. 187 // we don't currently need to do anything here.
189} 188}
190 189
191void KOTimeEdit::addTime(QTime qt, bool update) 190void KOTimeEdit::addTime(QTime qt, bool update)
192{ 191{
193 // Calculate the new time. 192 // Calculate the new time.
194 //qDebug("add h %d min %d ", qt.hour(),qt.minute() ); 193 //qDebug("add h %d min %d ", qt.hour(),qt.minute() );
195 mTime = mTime.addSecs(qt.minute()*60+qt.hour()*3600); 194 mTime = mTime.addSecs(qt.minute()*60+qt.hour()*3600);
196 // if ( update ) 195 // if ( update )
197 updateText(); 196 updateText();
198 emit timeChanged(mTime); 197 emit timeChanged(mTime);
199} 198}
200 199
201void KOTimeEdit::subTime(QTime qt, bool update) 200void KOTimeEdit::subTime(QTime qt, bool update)
202{ 201{
203 int h, m; 202 int h, m;
204 //qDebug("sub h %d min %d ", qt.hour(),qt.minute() ); 203 //qDebug("sub h %d min %d ", qt.hour(),qt.minute() );
205 204
206 mTime = mTime.addSecs(-(qt.minute()*60+qt.hour()*3600)); 205 mTime = mTime.addSecs(-(qt.minute()*60+qt.hour()*3600));
207 // store the newly calculated time. 206 // store the newly calculated time.
208 // mTime.setHMS(h, m, 0); 207 // mTime.setHMS(h, m, 0);
209 //if ( update ) 208 //if ( update )
210 updateText(); 209 updateText();
211 emit timeChanged(mTime); 210 emit timeChanged(mTime);
212} 211}
213 212
214// void KOTimeEdit::mouseReleaseEvent ( QMouseEvent * ) 213// void KOTimeEdit::mouseReleaseEvent ( QMouseEvent * )
215// { 214// {
216// qDebug("mouseReleaseEvent ( QMouseEvent * ) "); 215// qDebug("mouseReleaseEvent ( QMouseEvent * ) ");
217// } 216// }
218 217
219// void KOTimeEdit::focusInEvent ( QFocusEvent * ) 218// void KOTimeEdit::focusInEvent ( QFocusEvent * )
220// { 219// {
221// qDebug("focusInEvent ( QFocusEvent * ) "); 220// qDebug("focusInEvent ( QFocusEvent * ) ");
222// } 221// }
223 222
224void KOTimeEdit::keyReleaseEvent(QKeyEvent *e) 223void KOTimeEdit::keyReleaseEvent(QKeyEvent *e)
225{ 224{
226 if ( !e->isAutoRepeat() ) { 225 if ( !e->isAutoRepeat() ) {
227 mFlagKeyPressed = false; 226 mFlagKeyPressed = false;
228 } 227 }
229 228
230} 229}
diff --git a/korganizer/lineview.cpp b/korganizer/lineview.cpp
index f1ff29f..e72e41c 100644
--- a/korganizer/lineview.cpp
+++ b/korganizer/lineview.cpp
@@ -1,94 +1,93 @@
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#include "lineview.moc"
9 8
10LineView::LineView( QWidget *parent, const char *name ) : 9LineView::LineView( QWidget *parent, const char *name ) :
11 QScrollView( parent, name ) 10 QScrollView( parent, name )
12{ 11{
13 mPixelWidth = 1000; 12 mPixelWidth = 1000;
14 13
15 mLines.setAutoDelete( true ); 14 mLines.setAutoDelete( true );
16 15
17 resizeContents( mPixelWidth, contentsHeight() ); 16 resizeContents( mPixelWidth, contentsHeight() );
18 17
19 viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); 18 viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor);
20} 19}
21 20
22LineView::~LineView() 21LineView::~LineView()
23{ 22{
24} 23}
25 24
26int LineView::pixelWidth() 25int LineView::pixelWidth()
27{ 26{
28 return mPixelWidth; 27 return mPixelWidth;
29} 28}
30 29
31void LineView::addLine( int start, int end ) 30void LineView::addLine( int start, int end )
32{ 31{
33 int count = mLines.count(); 32 int count = mLines.count();
34 33
35 if( start < 0 ) start = 0; 34 if( start < 0 ) start = 0;
36 if( end > mPixelWidth) end = mPixelWidth; 35 if( end > mPixelWidth) end = mPixelWidth;
37 36
38 kdDebug() << "LineView::addLine() col: " << count << " start: " << start 37 kdDebug() << "LineView::addLine() col: " << count << " start: " << start
39 << " end: " << end << endl; 38 << " end: " << end << endl;
40 39
41 mLines.append( new Line( count, start, end ) ); 40 mLines.append( new Line( count, start, end ) );
42} 41}
43 42
44void LineView::clear() 43void LineView::clear()
45{ 44{
46 mLines.clear(); 45 mLines.clear();
47 update(); 46 update();
48} 47}
49 48
50void LineView::drawContents(QPainter* p, int cx, int cy, int cw, int ch) 49void LineView::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
51{ 50{
52// kdDebug() << "LineView::drawContents()" << endl; 51// kdDebug() << "LineView::drawContents()" << endl;
53 52
54 int mGridSpacingX = 10; 53 int mGridSpacingX = 10;
55 int mGridSpacingY = 20; 54 int mGridSpacingY = 20;
56 55
57#if 0 56#if 0
58 // Draw vertical lines of grid 57 // Draw vertical lines of grid
59 // kdDebug() << "drawContents cx: " << cx << " cy: " << cy << " cw: " << cw << " ch: " << ch << endl; 58 // kdDebug() << "drawContents cx: " << cx << " cy: " << cy << " cw: " << cw << " ch: " << ch << endl;
60 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; 59 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX;
61 while (x < cx + cw) { 60 while (x < cx + cw) {
62 p->drawLine(x,cy,x,cy+ch); 61 p->drawLine(x,cy,x,cy+ch);
63 x+=mGridSpacingX; 62 x+=mGridSpacingX;
64 } 63 }
65#endif 64#endif
66 65
67 // Draw horizontal lines of grid 66 // Draw horizontal lines of grid
68 int y = ((int)(cy/mGridSpacingY))*mGridSpacingY + 10; 67 int y = ((int)(cy/mGridSpacingY))*mGridSpacingY + 10;
69 while (y < cy + ch) { 68 while (y < cy + ch) {
70// kdDebug() << " y: " << y << endl; 69// kdDebug() << " y: " << y << endl;
71 p->drawLine(cx,y,cx+cw,y); 70 p->drawLine(cx,y,cx+cw,y);
72 y+=mGridSpacingY; 71 y+=mGridSpacingY;
73 } 72 }
74 73
75 Line *line; 74 Line *line;
76 for( line = mLines.first(); line; line = mLines.next() ) { 75 for( line = mLines.first(); line; line = mLines.next() ) {
77 int ctop = line->column * 20 + 10 - 5; 76 int ctop = line->column * 20 + 10 - 5;
78 int cbottom = line->column * 20 + 10 + 5; 77 int cbottom = line->column * 20 + 10 + 5;
79 int s = line->start; 78 int s = line->start;
80 int e = line->end; 79 int e = line->end;
81// kdDebug() << " LineView::drawContents(): ctop: " << ctop << " cbottom: " 80// kdDebug() << " LineView::drawContents(): ctop: " << ctop << " cbottom: "
82// << cbottom << " s: " << s << " e: " << e << endl; 81// << cbottom << " s: " << s << " e: " << e << endl;
83 if ( ctop <= (cy+ch) && cbottom >= cy && 82 if ( ctop <= (cy+ch) && cbottom >= cy &&
84 s <= (cx+cw) && e >= cx ) { 83 s <= (cx+cw) && e >= cx ) {
85 if ( s < cx ) s = cx; 84 if ( s < cx ) s = cx;
86 if ( e > (cx+cw) ) e = cx+cw; 85 if ( e > (cx+cw) ) e = cx+cw;
87 if ( ctop < cy ) ctop = cy; 86 if ( ctop < cy ) ctop = cy;
88 if ( cbottom > (cy+ch) ) cbottom = cy+ch; 87 if ( cbottom > (cy+ch) ) cbottom = cy+ch;
89// kdDebug() << " drawContents(): ctop: " << ctop << " cbottom: " 88// kdDebug() << " drawContents(): ctop: " << ctop << " cbottom: "
90// << cbottom << " s: " << s << " e: " << e << endl; 89// << cbottom << " s: " << s << " e: " << e << endl;
91 p->fillRect( s, ctop, e - s + 1, cbottom - ctop + 1, QBrush("red") ); 90 p->fillRect( s, ctop, e - s + 1, cbottom - ctop + 1, QBrush("red") );
92 } 91 }
93 } 92 }
94} 93}
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 1052a99..f339c67 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -7,193 +7,192 @@
7 it under the terms of the GNU General Public License as published by 7 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 8 the Free Software Foundation; either version 2 of the License, or
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 <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 <qframe.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <qapplication.h> 31#include <qapplication.h>
32 32
33#include <kdebug.h> 33#include <kdebug.h>
34#include <klocale.h> 34#include <klocale.h>
35#include <kglobal.h> 35#include <kglobal.h>
36#include <kiconloader.h> 36#include <kiconloader.h>
37#include "libkdepim/kdatepicker.h" 37#include "libkdepim/kdatepicker.h"
38#include <knotifyclient.h> 38#include <knotifyclient.h>
39#include "kdatetbl.h" 39#include "kdatetbl.h"
40 40
41#include "koglobals.h" 41#include "koglobals.h"
42#include "koprefs.h" 42#include "koprefs.h"
43#ifndef KORG_NOPLUGINS 43#ifndef KORG_NOPLUGINS
44#include "kocore.h" 44#include "kocore.h"
45#endif 45#endif
46 46
47#include <kcalendarsystem.h> 47#include <kcalendarsystem.h>
48 48
49#include "navigatorbar.h" 49#include "navigatorbar.h"
50 50
51NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) 51NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name )
52 : QWidget( parent, name ) 52 : QWidget( parent, name )
53{ 53{
54 QBoxLayout *topLayout = new QHBoxLayout( this ); 54 QBoxLayout *topLayout = new QHBoxLayout( this );
55 55
56 // Set up the control buttons and date label 56 // Set up the control buttons and date label
57 mCtrlFrame = new QFrame( this ); 57 mCtrlFrame = new QFrame( this );
58 mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); 58 mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised);
59 mCtrlFrame->setLineWidth(1); 59 mCtrlFrame->setLineWidth(1);
60 60
61 topLayout->addWidget( mCtrlFrame ); 61 topLayout->addWidget( mCtrlFrame );
62 62
63 QFont tfont = font(); 63 QFont tfont = font();
64 if ( QApplication::desktop()->width() >= 480 ) 64 if ( QApplication::desktop()->width() >= 480 )
65 tfont.setPointSize(tfont.pointSize()+2); 65 tfont.setPointSize(tfont.pointSize()+2);
66 tfont.setBold(true); 66 tfont.setBold(true);
67 67
68 bool isRTL = KOGlobals::self()->reverseLayout(); 68 bool isRTL = KOGlobals::self()->reverseLayout();
69#ifndef DESKTOP_VERSION 69#ifndef DESKTOP_VERSION
70 bool isDesktop = false; 70 bool isDesktop = false;
71#else 71#else
72 bool isDesktop = true; 72 bool isDesktop = true;
73#endif 73#endif
74 if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) 74 if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 )
75 isDesktop = true; 75 isDesktop = true;
76 // Create backward navigation buttons 76 // Create backward navigation buttons
77 mPrevYear = new QPushButton( mCtrlFrame ); 77 mPrevYear = new QPushButton( mCtrlFrame );
78 mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); 78 mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) );
79 QToolTip::add( mPrevYear, i18n("Previous Year") ); 79 QToolTip::add( mPrevYear, i18n("Previous Year") );
80 80
81 mPrevMonth = new QPushButton( mCtrlFrame ); 81 mPrevMonth = new QPushButton( mCtrlFrame );
82 mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); 82 mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") );
83 QToolTip::add( mPrevMonth, i18n("Previous Month") ); 83 QToolTip::add( mPrevMonth, i18n("Previous Month") );
84 84
85 // Create forward navigation buttons 85 // Create forward navigation buttons
86 mNextMonth = new QPushButton( mCtrlFrame ); 86 mNextMonth = new QPushButton( mCtrlFrame );
87 mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); 87 mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") );
88 QToolTip::add( mNextMonth, i18n("Next Month") ); 88 QToolTip::add( mNextMonth, i18n("Next Month") );
89 89
90 mNextYear = new QPushButton( mCtrlFrame ); 90 mNextYear = new QPushButton( mCtrlFrame );
91 mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); 91 mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") );
92 QToolTip::add( mNextYear, i18n("Next Year") ); 92 QToolTip::add( mNextYear, i18n("Next Year") );
93 mSelectMonth = new QPushButton( mCtrlFrame ); 93 mSelectMonth = new QPushButton( mCtrlFrame );
94 // Create month name label 94 // Create month name label
95 //selectMonth->setFont( tfont ); 95 //selectMonth->setFont( tfont );
96 // selectMonth->setAlignment( AlignCenter ); 96 // selectMonth->setAlignment( AlignCenter );
97 //mDateLabel = new QLabel( selectMonth ); 97 //mDateLabel = new QLabel( selectMonth );
98 //mDateLabel->setFont( tfont ); 98 //mDateLabel->setFont( tfont );
99 //mDateLabel->setAlignment( AlignCenter ); 99 //mDateLabel->setAlignment( AlignCenter );
100 if ( QString ( name ) == QString("useBigPixmaps") ) { 100 if ( QString ( name ) == QString("useBigPixmaps") ) {
101 mNextMonth->setFlat( true); 101 mNextMonth->setFlat( true);
102 mNextYear->setFlat( true); 102 mNextYear->setFlat( true);
103 mSelectMonth->setFlat( true); 103 mSelectMonth->setFlat( true);
104 mPrevYear->setFlat( true); 104 mPrevYear->setFlat( true);
105 mPrevMonth->setFlat( true); 105 mPrevMonth->setFlat( true);
106 } 106 }
107 mSelectMonth->setFont( tfont ); 107 mSelectMonth->setFont( tfont );
108 // Set minimum width to width of widest month name label 108 // Set minimum width to width of widest month name label
109 int i; 109 int i;
110 int maxwidth = 0; 110 int maxwidth = 0;
111 QFontMetrics fm ( mSelectMonth->font() ); 111 QFontMetrics fm ( mSelectMonth->font() );
112 int width = fm.width("September '00" ); 112 int width = fm.width("September '00" );
113// for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); 113// for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date);
114// ++i ) { 114// ++i ) {
115// //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, 115// //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i,
116// // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); 116// // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" );
117// int width = fm.width("September 2000" ); 117// int width = fm.width("September 2000" );
118// if ( width > maxwidth ) maxwidth = width; 118// if ( width > maxwidth ) maxwidth = width;
119// } 119// }
120 maxwidth = width+2; 120 maxwidth = width+2;
121 int size = fm.height()+2; 121 int size = fm.height()+2;
122 if ( QApplication::desktop()->width() >= 480 ) { 122 if ( QApplication::desktop()->width() >= 480 ) {
123 size += 6; 123 size += 6;
124 maxwidth+= 6; 124 maxwidth+= 6;
125 } 125 }
126 mSelectMonth->setFixedWidth( maxwidth ); 126 mSelectMonth->setFixedWidth( maxwidth );
127 mSelectMonth->setFixedHeight( size ); 127 mSelectMonth->setFixedHeight( size );
128 mPrevYear->setFixedHeight( size ); 128 mPrevYear->setFixedHeight( size );
129 mPrevMonth->setFixedHeight( size ); 129 mPrevMonth->setFixedHeight( size );
130 mNextMonth->setFixedHeight( size ); 130 mNextMonth->setFixedHeight( size );
131 mNextYear->setFixedHeight ( size ); 131 mNextYear->setFixedHeight ( size );
132 // set up control frame layout 132 // set up control frame layout
133 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); 133 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 );
134 ctrlLayout->addWidget( mPrevYear, 3 ); 134 ctrlLayout->addWidget( mPrevYear, 3 );
135 ctrlLayout->addWidget( mPrevMonth, 3 ); 135 ctrlLayout->addWidget( mPrevMonth, 3 );
136 //ctrlLayout->addStretch( 1 ); 136 //ctrlLayout->addStretch( 1 );
137 // ctrlLayout->addSpacing( 1 ); 137 // ctrlLayout->addSpacing( 1 );
138 // ctrlLayout->addWidget( mDateLabel ); 138 // ctrlLayout->addWidget( mDateLabel );
139 ctrlLayout->addWidget( mSelectMonth ); 139 ctrlLayout->addWidget( mSelectMonth );
140 // ctrlLayout->addSpacing( 1 ); 140 // ctrlLayout->addSpacing( 1 );
141 // ctrlLayout->addStretch( 1 ); 141 // ctrlLayout->addStretch( 1 );
142 ctrlLayout->addWidget( mNextMonth, 3 ); 142 ctrlLayout->addWidget( mNextMonth, 3 );
143 ctrlLayout->addWidget( mNextYear, 3 ); 143 ctrlLayout->addWidget( mNextYear, 3 );
144 144
145 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); 145 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) );
146 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); 146 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) );
147 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); 147 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) );
148 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); 148 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) );
149 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); 149 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) );
150 mPrevYear->setFocusPolicy(NoFocus); 150 mPrevYear->setFocusPolicy(NoFocus);
151 mPrevMonth->setFocusPolicy(NoFocus); 151 mPrevMonth->setFocusPolicy(NoFocus);
152 mNextMonth->setFocusPolicy(NoFocus); 152 mNextMonth->setFocusPolicy(NoFocus);
153 mNextYear->setFocusPolicy(NoFocus); 153 mNextYear->setFocusPolicy(NoFocus);
154 mSelectMonth->setFocusPolicy(NoFocus); 154 mSelectMonth->setFocusPolicy(NoFocus);
155} 155}
156 156
157NavigatorBar::~NavigatorBar() 157NavigatorBar::~NavigatorBar()
158{ 158{
159} 159}
160 160
161void NavigatorBar::selectMonth() 161void NavigatorBar::selectMonth()
162{ 162{
163 163
164 int month; 164 int month;
165 KPopupFrame* popup = new KPopupFrame(this); 165 KPopupFrame* popup = new KPopupFrame(this);
166 int size = 12; 166 int size = 12;
167 if ( QApplication::desktop()->width() >= 480 ) 167 if ( QApplication::desktop()->width() >= 480 )
168 size = 18; 168 size = 18;
169 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(size, popup); 169 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(size, popup);
170 // ----- 170 // -----
171 picker->resize(picker->sizeHint()); 171 picker->resize(picker->sizeHint());
172 popup->setMainWidget(picker); 172 popup->setMainWidget(picker);
173 picker->setFocus(); 173 picker->setFocus();
174 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 174 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
175 if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) 175 if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height()))))
176 { 176 {
177 month = picker->getResult(); 177 month = picker->getResult();
178 emit monthSelected ( month ); 178 emit monthSelected ( month );
179 } else { 179 } else {
180 KNotifyClient::beep(); 180 KNotifyClient::beep();
181 } 181 }
182 delete popup; 182 delete popup;
183} 183}
184void NavigatorBar::selectDates( const KCal::DateList &dateList ) 184void NavigatorBar::selectDates( const KCal::DateList &dateList )
185{ 185{
186 if (dateList.count() > 0) { 186 if (dateList.count() > 0) {
187 QDate date = dateList.first(); 187 QDate date = dateList.first();
188 188
189 const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); 189 const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem();
190 190
191 // compute the label at the top of the navigator 191 // compute the label at the top of the navigator
192 QString dtstr = i18n(calSys->monthName( date )) + " '" + 192 QString dtstr = i18n(calSys->monthName( date )) + " '" +
193 QString::number( calSys->year( date ) ).right(2); 193 QString::number( calSys->year( date ) ).right(2);
194 194
195 mSelectMonth->setText( dtstr ); 195 mSelectMonth->setText( dtstr );
196 } 196 }
197} 197}
198 198
199#include "navigatorbar.moc"
diff --git a/korganizer/outgoingdialog.cpp b/korganizer/outgoingdialog.cpp
index 4eb64f3..0fc90c4 100644
--- a/korganizer/outgoingdialog.cpp
+++ b/korganizer/outgoingdialog.cpp
@@ -202,193 +202,192 @@ bool OutgoingDialog::addMessage(IncidenceBase *incidence,Scheduler::Method metho
202 return true; 202 return true;
203} 203}
204 204
205void OutgoingDialog::send() 205void OutgoingDialog::send()
206{ 206{
207 kdDebug() << "OutgoingDialog::send" << endl; 207 kdDebug() << "OutgoingDialog::send" << endl;
208 ScheduleItemOut *item = (ScheduleItemOut *)(mMessageListView->firstChild()); 208 ScheduleItemOut *item = (ScheduleItemOut *)(mMessageListView->firstChild());
209 while(item) { 209 while(item) {
210 bool success; 210 bool success;
211 if (item->method() == Scheduler::Publish) { 211 if (item->method() == Scheduler::Publish) {
212 success = mScheduler->publish(item->event(),item->recipients()); 212 success = mScheduler->publish(item->event(),item->recipients());
213 } else { 213 } else {
214 success = mScheduler->performTransaction(item->event(),item->method()); 214 success = mScheduler->performTransaction(item->event(),item->method());
215 } 215 }
216 ScheduleItemOut *oldItem = item; 216 ScheduleItemOut *oldItem = item;
217 item = (ScheduleItemOut *)(item->nextSibling()); 217 item = (ScheduleItemOut *)(item->nextSibling());
218 if (success) { 218 if (success) {
219 deleteMessage(oldItem->event()); 219 deleteMessage(oldItem->event());
220 delete (oldItem->event()); 220 delete (oldItem->event());
221 delete oldItem; 221 delete oldItem;
222 } 222 }
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(QListViewItem *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()->type()=="Event" ) { 244 if ( item->event()->type()=="Event" ) {
245 event = static_cast<Event *>(item->event()); 245 event = static_cast<Event *>(item->event());
246 } 246 }
247 if ( item->event()->type()=="Todo" ) { 247 if ( item->event()->type()=="Todo" ) {
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>";
256 switch (item->method()) { 256 switch (item->method()) {
257 case Scheduler::Publish: { 257 case Scheduler::Publish: {
258 sendText += item->recipients(); 258 sendText += item->recipients();
259 break; } 259 break; }
260 case Scheduler::Request: { 260 case Scheduler::Request: {
261 sendText += i18n("All attendees"); 261 sendText += i18n("All attendees");
262 break; } 262 break; }
263 case Scheduler::Refresh: { 263 case Scheduler::Refresh: {
264 sendText += i18n("All attendees"); 264 sendText += i18n("All attendees");
265 break; } 265 break; }
266 case Scheduler::Cancel: { 266 case Scheduler::Cancel: {
267 sendText += i18n("All attendees"); 267 sendText += i18n("All attendees");
268 break; } 268 break; }
269 case Scheduler::Add: { 269 case Scheduler::Add: {
270 sendText += i18n("All attendees"); 270 sendText += i18n("All attendees");
271 break; } 271 break; }
272 case Scheduler::Reply: { 272 case Scheduler::Reply: {
273 sendText += i18n("The organizer %1").arg(item->event()->organizer()); 273 sendText += i18n("The organizer %1").arg(item->event()->organizer());
274 break; } 274 break; }
275 case Scheduler::Counter: { 275 case Scheduler::Counter: {
276 sendText += i18n("The organizer %1").arg(item->event()->organizer()); 276 sendText += i18n("The organizer %1").arg(item->event()->organizer());
277 break; } 277 break; }
278 case Scheduler::Declinecounter: { 278 case Scheduler::Declinecounter: {
279 sendText += i18n("All attendees"); 279 sendText += i18n("All attendees");
280 break; } 280 break; }
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 QTextStream *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}
314 314
315void OutgoingDialog::loadMessages() 315void OutgoingDialog::loadMessages()
316{ 316{
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(IO_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 QTextStream 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;
354 } 354 }
355 begin_pos = messageString.find("RECIPIENTS-BEGIN:"); 355 begin_pos = messageString.find("RECIPIENTS-BEGIN:");
356 begin_pos = messageString.find('\n',begin_pos)+1; 356 begin_pos = messageString.find('\n',begin_pos)+1;
357 int end_pos = messageString.find(":RECIPIENTS-END",begin_pos)-1; 357 int end_pos = messageString.find(":RECIPIENTS-END",begin_pos)-1;
358 recipients = messageString.mid(begin_pos, end_pos-begin_pos); 358 recipients = messageString.mid(begin_pos, end_pos-begin_pos);
359 kdDebug() << "Outgoing::loadMessage(): Recipients: " << recipients << endl; 359 kdDebug() << "Outgoing::loadMessage(): Recipients: " << recipients << endl;
360 360
361 if (message) { 361 if (message) {
362 bool inserted = false; 362 bool inserted = false;
363 QMap<IncidenceBase*, QString>::Iterator iter; 363 QMap<IncidenceBase*, QString>::Iterator iter;
364 for ( iter = mMessageMap.begin(); iter != mMessageMap.end(); ++iter ) { 364 for ( iter = mMessageMap.begin(); iter != mMessageMap.end(); ++iter ) {
365 if (iter.data() == outgoingDirName + "/" + (*it)) inserted = true; 365 if (iter.data() == outgoingDirName + "/" + (*it)) inserted = true;
366 } 366 }
367 if (!inserted) { 367 if (!inserted) {
368 kdDebug() << "OutgoingDialog::loadMessage(): got message '" 368 kdDebug() << "OutgoingDialog::loadMessage(): got message '"
369 << (*it) << "'" << endl; 369 << (*it) << "'" << endl;
370 IncidenceBase *inc = message->event(); 370 IncidenceBase *inc = message->event();
371 new ScheduleItemOut(mMessageListView,inc,method,recipients); 371 new ScheduleItemOut(mMessageListView,inc,method,recipients);
372 mMessageMap[message->event()]=outgoingDirName + "/" + (*it); 372 mMessageMap[message->event()]=outgoingDirName + "/" + (*it);
373 } 373 }
374 } else { 374 } else {
375 QString errorMessage; 375 QString errorMessage;
376 if (mFormat->exception()) { 376 if (mFormat->exception()) {
377 errorMessage = mFormat->exception()->message(); 377 errorMessage = mFormat->exception()->message();
378 } 378 }
379 kdDebug() << "OutgoingDialog::loadMessage(): Error parsing " 379 kdDebug() << "OutgoingDialog::loadMessage(): Error parsing "
380 "message: " << errorMessage << endl; 380 "message: " << errorMessage << endl;
381 } 381 }
382 f.close(); 382 f.close();
383 } 383 }
384 } 384 }
385 } 385 }
386 emit numMessagesChanged(mMessageListView->childCount()); 386 emit numMessagesChanged(mMessageListView->childCount());
387} 387}
388 388
389void OutgoingDialog::setDocumentId( const QString &id ) 389void OutgoingDialog::setDocumentId( const QString &id )
390{ 390{
391 mDocPrefs->setDoc( id ); 391 mDocPrefs->setDoc( id );
392} 392}
393 393
394#include "outgoingdialog.moc"
diff --git a/korganizer/outgoingdialog_base.cpp b/korganizer/outgoingdialog_base.cpp
index e5b913a..1873b44 100644
--- a/korganizer/outgoingdialog_base.cpp
+++ b/korganizer/outgoingdialog_base.cpp
@@ -1,109 +1,107 @@
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 <qheader.h>
15#include <qlistview.h> 15#include <qlistview.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 <qwhatsthis.h>
20 20
21/* 21/*
22 * Constructs a OutgoingDialog_base as a child of 'parent', with the 22 * Constructs a OutgoingDialog_base as a child of 'parent', with the
23 * name 'name' and widget flags set to 'f'. 23 * name 'name' and widget flags set to 'f'.
24 * 24 *
25 * The dialog will by default be modeless, unless you set 'modal' to 25 * The dialog will by default be modeless, unless you set 'modal' to
26 * TRUE to construct a modal dialog. 26 * TRUE to construct a modal dialog.
27 */ 27 */
28OutgoingDialog_base::OutgoingDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl ) 28OutgoingDialog_base::OutgoingDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl )
29 : QDialog( parent, name, modal, fl ) 29 : QDialog( parent, name, modal, fl )
30 30
31{ 31{
32 if ( !name ) 32 if ( !name )
33 setName( "OutgoingDialog_base" ); 33 setName( "OutgoingDialog_base" );
34 OutgoingDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "OutgoingDialog_baseLayout"); 34 OutgoingDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "OutgoingDialog_baseLayout");
35 35
36 mMessageListView = new QListView( this, "mMessageListView" ); 36 mMessageListView = new QListView( this, "mMessageListView" );
37 mMessageListView->addColumn( tr2i18n( "Summary" ) ); 37 mMessageListView->addColumn( tr2i18n( "Summary" ) );
38 mMessageListView->addColumn( tr2i18n( "Start Date" ) ); 38 mMessageListView->addColumn( tr2i18n( "Start Date" ) );
39 mMessageListView->addColumn( tr2i18n( "Start Time" ) ); 39 mMessageListView->addColumn( tr2i18n( "Start Time" ) );
40 mMessageListView->addColumn( tr2i18n( "End Date" ) ); 40 mMessageListView->addColumn( tr2i18n( "End Date" ) );
41 mMessageListView->addColumn( tr2i18n( "End Time" ) ); 41 mMessageListView->addColumn( tr2i18n( "End Time" ) );
42 mMessageListView->addColumn( tr2i18n( "Method" ) ); 42 mMessageListView->addColumn( tr2i18n( "Method" ) );
43 mMessageListView->setFrameShape( QListView::StyledPanel ); 43 mMessageListView->setFrameShape( QListView::StyledPanel );
44 mMessageListView->setFrameShadow( QListView::Sunken ); 44 mMessageListView->setFrameShadow( QListView::Sunken );
45 mMessageListView->setAllColumnsShowFocus( TRUE ); 45 mMessageListView->setAllColumnsShowFocus( TRUE );
46 46
47 OutgoingDialog_baseLayout->addMultiCellWidget( mMessageListView, 0, 3, 0, 0 ); 47 OutgoingDialog_baseLayout->addMultiCellWidget( mMessageListView, 0, 3, 0, 0 );
48 48
49 PushButton5 = new QPushButton( this, "PushButton5" ); 49 PushButton5 = new QPushButton( this, "PushButton5" );
50 PushButton5->setDefault( FALSE ); 50 PushButton5->setDefault( FALSE );
51 51
52 OutgoingDialog_baseLayout->addWidget( PushButton5, 0, 1 ); 52 OutgoingDialog_baseLayout->addWidget( PushButton5, 0, 1 );
53 53
54 PushButton7 = new QPushButton( this, "PushButton7" ); 54 PushButton7 = new QPushButton( this, "PushButton7" );
55 55
56 OutgoingDialog_baseLayout->addWidget( PushButton7, 1, 1 ); 56 OutgoingDialog_baseLayout->addWidget( PushButton7, 1, 1 );
57 57
58 PushButton6 = new QPushButton( this, "PushButton6" ); 58 PushButton6 = new QPushButton( this, "PushButton6" );
59 PushButton6->setDefault( TRUE ); 59 PushButton6->setDefault( TRUE );
60 60
61 OutgoingDialog_baseLayout->addWidget( PushButton6, 3, 1 ); 61 OutgoingDialog_baseLayout->addWidget( PushButton6, 3, 1 );
62 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 62 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
63 OutgoingDialog_baseLayout->addItem( spacer, 2, 1 ); 63 OutgoingDialog_baseLayout->addItem( spacer, 2, 1 );
64 languageChange(); 64 languageChange();
65 resize( QSize(582, 274).expandedTo(minimumSizeHint()) ); 65 resize( QSize(582, 274).expandedTo(minimumSizeHint()) );
66 66
67 // signals and slots connections 67 // signals and slots connections
68 connect( PushButton6, SIGNAL( clicked() ), this, SLOT( accept() ) ); 68 connect( PushButton6, SIGNAL( clicked() ), this, SLOT( accept() ) );
69 connect( PushButton5, SIGNAL( clicked() ), this, SLOT( send() ) ); 69 connect( PushButton5, SIGNAL( clicked() ), this, SLOT( send() ) );
70 connect( PushButton7, SIGNAL( clicked() ), this, SLOT( deleteItem() ) ); 70 connect( PushButton7, SIGNAL( clicked() ), this, SLOT( deleteItem() ) );
71} 71}
72 72
73/* 73/*
74 * Destroys the object and frees any allocated resources 74 * Destroys the object and frees any allocated resources
75 */ 75 */
76OutgoingDialog_base::~OutgoingDialog_base() 76OutgoingDialog_base::~OutgoingDialog_base()
77{ 77{
78 // no need to delete child widgets, Qt does it all for us 78 // no need to delete child widgets, Qt does it all for us
79} 79}
80 80
81/* 81/*
82 * Sets the strings of the subwidgets using the current 82 * Sets the strings of the subwidgets using the current
83 * language. 83 * language.
84 */ 84 */
85void OutgoingDialog_base::languageChange() 85void OutgoingDialog_base::languageChange()
86{ 86{
87 setCaption( tr2i18n( "Scheduler - Outgoing Messages" ) ); 87 setCaption( tr2i18n( "Scheduler - Outgoing Messages" ) );
88 mMessageListView->header()->setLabel( 0, tr2i18n( "Summary" ) ); 88 mMessageListView->header()->setLabel( 0, tr2i18n( "Summary" ) );
89 mMessageListView->header()->setLabel( 1, tr2i18n( "Start Date" ) ); 89 mMessageListView->header()->setLabel( 1, tr2i18n( "Start Date" ) );
90 mMessageListView->header()->setLabel( 2, tr2i18n( "Start Time" ) ); 90 mMessageListView->header()->setLabel( 2, tr2i18n( "Start Time" ) );
91 mMessageListView->header()->setLabel( 3, tr2i18n( "End Date" ) ); 91 mMessageListView->header()->setLabel( 3, tr2i18n( "End Date" ) );
92 mMessageListView->header()->setLabel( 4, tr2i18n( "End Time" ) ); 92 mMessageListView->header()->setLabel( 4, tr2i18n( "End Time" ) );
93 mMessageListView->header()->setLabel( 5, tr2i18n( "Method" ) ); 93 mMessageListView->header()->setLabel( 5, tr2i18n( "Method" ) );
94 PushButton5->setText( tr2i18n( "&Send Messages" ) ); 94 PushButton5->setText( tr2i18n( "&Send Messages" ) );
95 PushButton7->setText( tr2i18n( "&Remove" ) ); 95 PushButton7->setText( tr2i18n( "&Remove" ) );
96 PushButton6->setText( tr2i18n( "&Close" ) ); 96 PushButton6->setText( tr2i18n( "&Close" ) );
97} 97}
98 98
99void OutgoingDialog_base::send() 99void OutgoingDialog_base::send()
100{ 100{
101 qWarning( "OutgoingDialog_base::send(): Not implemented yet" ); 101 qWarning( "OutgoingDialog_base::send(): Not implemented yet" );
102} 102}
103 103
104void OutgoingDialog_base::deleteItem() 104void OutgoingDialog_base::deleteItem()
105{ 105{
106 qWarning( "OutgoingDialog_base::deleteItem(): Not implemented yet" ); 106 qWarning( "OutgoingDialog_base::deleteItem(): Not implemented yet" );
107} 107}
108
109#include "outgoingdialog_base.moc"
diff --git a/korganizer/publishdialog.cpp b/korganizer/publishdialog.cpp
index 176595a..4323b91 100644
--- a/korganizer/publishdialog.cpp
+++ b/korganizer/publishdialog.cpp
@@ -1,152 +1,150 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
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 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 <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#include <kabc/addresseedialog.h> 30#include <kabc/addresseedialog.h>
31#endif 31#endif
32 32
33#include "koprefs.h" 33#include "koprefs.h"
34#include "publishdialog.h" 34#include "publishdialog.h"
35 35
36PublishDialog::PublishDialog(QWidget* parent, const char* name, 36PublishDialog::PublishDialog(QWidget* parent, const char* name,
37 bool modal, WFlags fl) 37 bool modal, WFlags fl)
38 : PublishDialog_base(parent,name,modal,fl) 38 : PublishDialog_base(parent,name,modal,fl)
39{ 39{
40 setCaption(i18n("Select Addresses")); 40 setCaption(i18n("Select Addresses"));
41 mNameLineEdit->setEnabled(false); 41 mNameLineEdit->setEnabled(false);
42 mEmailLineEdit->setEnabled(false); 42 mEmailLineEdit->setEnabled(false);
43 connect(mAddressListView,SIGNAL(selectionChanged(QListViewItem *)), 43 connect(mAddressListView,SIGNAL(selectionChanged(QListViewItem *)),
44 SLOT(updateInput())); 44 SLOT(updateInput()));
45} 45}
46 46
47PublishDialog::~PublishDialog() 47PublishDialog::~PublishDialog()
48{ 48{
49} 49}
50 50
51void PublishDialog::addAttendee(Attendee *attendee) 51void PublishDialog::addAttendee(Attendee *attendee)
52{ 52{
53 mNameLineEdit->setEnabled(true); 53 mNameLineEdit->setEnabled(true);
54 mEmailLineEdit->setEnabled(true); 54 mEmailLineEdit->setEnabled(true);
55 QListViewItem *item = new QListViewItem(mAddressListView); 55 QListViewItem *item = new QListViewItem(mAddressListView);
56 item->setText(0,attendee->name()); 56 item->setText(0,attendee->name());
57 item->setText(1,attendee->email()); 57 item->setText(1,attendee->email());
58 mAddressListView->insertItem(item); 58 mAddressListView->insertItem(item);
59} 59}
60 60
61QString PublishDialog::addresses() 61QString PublishDialog::addresses()
62{ 62{
63 QString to = ""; 63 QString to = "";
64 QListViewItem *item; 64 QListViewItem *item;
65 int i, count; 65 int i, count;
66 count = mAddressListView->childCount(); 66 count = mAddressListView->childCount();
67 for (i=0;i<count;i++) { 67 for (i=0;i<count;i++) {
68 item = mAddressListView->firstChild(); 68 item = mAddressListView->firstChild();
69 mAddressListView->takeItem(item); 69 mAddressListView->takeItem(item);
70 to += item->text(1); 70 to += item->text(1);
71 if (i<count-1) { 71 if (i<count-1) {
72 to += ", "; 72 to += ", ";
73 } 73 }
74 } 74 }
75 return to; 75 return to;
76} 76}
77 77
78void PublishDialog::addItem() 78void PublishDialog::addItem()
79{ 79{
80 mNameLineEdit->setEnabled(true); 80 mNameLineEdit->setEnabled(true);
81 mEmailLineEdit->setEnabled(true); 81 mEmailLineEdit->setEnabled(true);
82 QListViewItem *item = new QListViewItem(mAddressListView); 82 QListViewItem *item = new QListViewItem(mAddressListView);
83 mAddressListView->insertItem(item); 83 mAddressListView->insertItem(item);
84 mAddressListView->setSelected(item,true); 84 mAddressListView->setSelected(item,true);
85 mNameLineEdit->setText(i18n("(EmptyName)")); 85 mNameLineEdit->setText(i18n("(EmptyName)"));
86 mEmailLineEdit->setText(i18n("(EmptyEmail)")); 86 mEmailLineEdit->setText(i18n("(EmptyEmail)"));
87} 87}
88 88
89void PublishDialog::removeItem() 89void PublishDialog::removeItem()
90{ 90{
91 QListViewItem *item; 91 QListViewItem *item;
92 item = mAddressListView->selectedItem(); 92 item = mAddressListView->selectedItem();
93 if (!item) return; 93 if (!item) return;
94 mAddressListView->takeItem(item); 94 mAddressListView->takeItem(item);
95 item = mAddressListView->selectedItem(); 95 item = mAddressListView->selectedItem();
96 if (!item) { 96 if (!item) {
97 mNameLineEdit->setText(""); 97 mNameLineEdit->setText("");
98 mEmailLineEdit->setText(""); 98 mEmailLineEdit->setText("");
99 mNameLineEdit->setEnabled(false); 99 mNameLineEdit->setEnabled(false);
100 mEmailLineEdit->setEnabled(false); 100 mEmailLineEdit->setEnabled(false);
101 } 101 }
102 if (mAddressListView->childCount() == 0) { 102 if (mAddressListView->childCount() == 0) {
103 mNameLineEdit->setEnabled(false); 103 mNameLineEdit->setEnabled(false);
104 mEmailLineEdit->setEnabled(false); 104 mEmailLineEdit->setEnabled(false);
105 } 105 }
106} 106}
107 107
108void PublishDialog::openAddressbook() 108void PublishDialog::openAddressbook()
109{ 109{
110#ifndef KORG_NOKABC 110#ifndef KORG_NOKABC
111 KABC::Addressee::List addressList; 111 KABC::Addressee::List addressList;
112 addressList = KABC::AddresseeDialog::getAddressees(this); 112 addressList = KABC::AddresseeDialog::getAddressees(this);
113 //KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); 113 //KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this);
114 KABC::Addressee a = addressList.first(); 114 KABC::Addressee a = addressList.first();
115 if (!a.isEmpty()) { 115 if (!a.isEmpty()) {
116 uint i; 116 uint i;
117 for (i=0;i<addressList.count();i++) { 117 for (i=0;i<addressList.count();i++) {
118 a = addressList[i]; 118 a = addressList[i];
119 mNameLineEdit->setEnabled(true); 119 mNameLineEdit->setEnabled(true);
120 mEmailLineEdit->setEnabled(true); 120 mEmailLineEdit->setEnabled(true);
121 QListViewItem *item = new QListViewItem(mAddressListView); 121 QListViewItem *item = new QListViewItem(mAddressListView);
122 mAddressListView->setSelected(item,true); 122 mAddressListView->setSelected(item,true);
123 mNameLineEdit->setText(a.realName()); 123 mNameLineEdit->setText(a.realName());
124 mEmailLineEdit->setText(a.preferredEmail()); 124 mEmailLineEdit->setText(a.preferredEmail());
125 mAddressListView->insertItem(item); 125 mAddressListView->insertItem(item);
126 } 126 }
127 } 127 }
128#endif 128#endif
129} 129}
130 130
131void PublishDialog::updateItem() 131void PublishDialog::updateItem()
132{ 132{
133 QListViewItem *item; 133 QListViewItem *item;
134 item = mAddressListView->selectedItem(); 134 item = mAddressListView->selectedItem();
135 if (!item) return; 135 if (!item) return;
136 item->setText(0,mNameLineEdit->text()); 136 item->setText(0,mNameLineEdit->text());
137 item->setText(1,mEmailLineEdit->text()); 137 item->setText(1,mEmailLineEdit->text());
138} 138}
139 139
140void PublishDialog::updateInput() 140void PublishDialog::updateInput()
141{ 141{
142 QListViewItem *item; 142 QListViewItem *item;
143 item = mAddressListView->selectedItem(); 143 item = mAddressListView->selectedItem();
144 if (!item) return; 144 if (!item) return;
145 mNameLineEdit->setEnabled(true); 145 mNameLineEdit->setEnabled(true);
146 mEmailLineEdit->setEnabled(true); 146 mEmailLineEdit->setEnabled(true);
147 QString mail = item->text(1); 147 QString mail = item->text(1);
148 mNameLineEdit->setText(item->text(0)); 148 mNameLineEdit->setText(item->text(0));
149 mEmailLineEdit->setText(mail); 149 mEmailLineEdit->setText(mail);
150} 150}
151
152#include "publishdialog.moc"
diff --git a/korganizer/publishdialog_base.cpp b/korganizer/publishdialog_base.cpp
index 75e4746..683f7e9 100644
--- a/korganizer/publishdialog_base.cpp
+++ b/korganizer/publishdialog_base.cpp
@@ -1,162 +1,160 @@
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 <qframe.h>
15#include <qheader.h> 15#include <qheader.h>
16#include <qlabel.h> 16#include <qlabel.h>
17#include <qlineedit.h> 17#include <qlineedit.h>
18#include <qlistview.h> 18#include <qlistview.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 <qwhatsthis.h>
23 23
24/* 24/*
25 * Constructs a PublishDialog_base as a child of 'parent', with the 25 * Constructs a PublishDialog_base as a child of 'parent', with the
26 * name 'name' and widget flags set to 'f'. 26 * name 'name' and widget flags set to 'f'.
27 * 27 *
28 * The dialog will by default be modeless, unless you set 'modal' to 28 * The dialog will by default be modeless, unless you set 'modal' to
29 * TRUE to construct a modal dialog. 29 * TRUE to construct a modal dialog.
30 */ 30 */
31PublishDialog_base::PublishDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl ) 31PublishDialog_base::PublishDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl )
32 : QDialog( parent, name, modal, fl ) 32 : QDialog( parent, name, modal, fl )
33 33
34{ 34{
35 if ( !name ) 35 if ( !name )
36 setName( "PublishDialog_base" ); 36 setName( "PublishDialog_base" );
37 PublishDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "PublishDialog_baseLayout"); 37 PublishDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "PublishDialog_baseLayout");
38 38
39 mAddressListView = new QListView( this, "mAddressListView" ); 39 mAddressListView = new QListView( this, "mAddressListView" );
40 mAddressListView->addColumn( tr2i18n( "Name" ) ); 40 mAddressListView->addColumn( tr2i18n( "Name" ) );
41 mAddressListView->addColumn( tr2i18n( "Email" ) ); 41 mAddressListView->addColumn( tr2i18n( "Email" ) );
42 42
43 PublishDialog_baseLayout->addMultiCellWidget( mAddressListView, 0, 3, 0, 1 ); 43 PublishDialog_baseLayout->addMultiCellWidget( mAddressListView, 0, 3, 0, 1 );
44 44
45 TextLabel1 = new QLabel( this, "TextLabel1" ); 45 TextLabel1 = new QLabel( this, "TextLabel1" );
46 46
47 PublishDialog_baseLayout->addWidget( TextLabel1, 4, 0 ); 47 PublishDialog_baseLayout->addWidget( TextLabel1, 4, 0 );
48 48
49 TextLabel2 = new QLabel( this, "TextLabel2" ); 49 TextLabel2 = new QLabel( this, "TextLabel2" );
50 50
51 PublishDialog_baseLayout->addWidget( TextLabel2, 5, 0 ); 51 PublishDialog_baseLayout->addWidget( TextLabel2, 5, 0 );
52 52
53 mEmailLineEdit = new QLineEdit( this, "mEmailLineEdit" ); 53 mEmailLineEdit = new QLineEdit( this, "mEmailLineEdit" );
54 54
55 PublishDialog_baseLayout->addWidget( mEmailLineEdit, 5, 1 ); 55 PublishDialog_baseLayout->addWidget( mEmailLineEdit, 5, 1 );
56 56
57 mNameLineEdit = new QLineEdit( this, "mNameLineEdit" ); 57 mNameLineEdit = new QLineEdit( this, "mNameLineEdit" );
58 58
59 PublishDialog_baseLayout->addWidget( mNameLineEdit, 4, 1 ); 59 PublishDialog_baseLayout->addWidget( mNameLineEdit, 4, 1 );
60 60
61 PushButton10 = new QPushButton( this, "PushButton10" ); 61 PushButton10 = new QPushButton( this, "PushButton10" );
62 62
63 PublishDialog_baseLayout->addWidget( PushButton10, 0, 2 ); 63 PublishDialog_baseLayout->addWidget( PushButton10, 0, 2 );
64 64
65 PushButton12 = new QPushButton( this, "PushButton12" ); 65 PushButton12 = new QPushButton( this, "PushButton12" );
66 66
67 PublishDialog_baseLayout->addWidget( PushButton12, 2, 2 ); 67 PublishDialog_baseLayout->addWidget( PushButton12, 2, 2 );
68 68
69 PushButton11 = new QPushButton( this, "PushButton11" ); 69 PushButton11 = new QPushButton( this, "PushButton11" );
70 70
71 PublishDialog_baseLayout->addWidget( PushButton11, 1, 2 ); 71 PublishDialog_baseLayout->addWidget( PushButton11, 1, 2 );
72 QSpacerItem* spacer = new QSpacerItem( 20, 241, QSizePolicy::Minimum, QSizePolicy::Expanding ); 72 QSpacerItem* spacer = new QSpacerItem( 20, 241, QSizePolicy::Minimum, QSizePolicy::Expanding );
73 PublishDialog_baseLayout->addMultiCell( spacer, 3, 5, 2, 2 ); 73 PublishDialog_baseLayout->addMultiCell( spacer, 3, 5, 2, 2 );
74 74
75 Line2 = new QFrame( this, "Line2" ); 75 Line2 = new QFrame( this, "Line2" );
76 Line2->setFrameShape( QFrame::HLine ); 76 Line2->setFrameShape( QFrame::HLine );
77 Line2->setFrameShadow( QFrame::Sunken ); 77 Line2->setFrameShadow( QFrame::Sunken );
78 Line2->setFrameShape( QFrame::HLine ); 78 Line2->setFrameShape( QFrame::HLine );
79 79
80 PublishDialog_baseLayout->addMultiCellWidget( Line2, 6, 6, 0, 2 ); 80 PublishDialog_baseLayout->addMultiCellWidget( Line2, 6, 6, 0, 2 );
81 81
82 layout95 = new QHBoxLayout( 0, 0, 6, "layout95"); 82 layout95 = new QHBoxLayout( 0, 0, 6, "layout95");
83 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); 83 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
84 layout95->addItem( spacer_2 ); 84 layout95->addItem( spacer_2 );
85 85
86 PushButton9 = new QPushButton( this, "PushButton9" ); 86 PushButton9 = new QPushButton( this, "PushButton9" );
87 PushButton9->setDefault( TRUE ); 87 PushButton9->setDefault( TRUE );
88 layout95->addWidget( PushButton9 ); 88 layout95->addWidget( PushButton9 );
89 89
90 PushButton8 = new QPushButton( this, "PushButton8" ); 90 PushButton8 = new QPushButton( this, "PushButton8" );
91 layout95->addWidget( PushButton8 ); 91 layout95->addWidget( PushButton8 );
92 92
93 PublishDialog_baseLayout->addMultiCellLayout( layout95, 7, 7, 0, 2 ); 93 PublishDialog_baseLayout->addMultiCellLayout( layout95, 7, 7, 0, 2 );
94 languageChange(); 94 languageChange();
95 resize( QSize(420, 379).expandedTo(minimumSizeHint()) ); 95 resize( QSize(420, 379).expandedTo(minimumSizeHint()) );
96 96
97 // signals and slots connections 97 // signals and slots connections
98 connect( PushButton10, SIGNAL( clicked() ), this, SLOT( addItem() ) ); 98 connect( PushButton10, SIGNAL( clicked() ), this, SLOT( addItem() ) );
99 connect( PushButton11, SIGNAL( clicked() ), this, SLOT( removeItem() ) ); 99 connect( PushButton11, SIGNAL( clicked() ), this, SLOT( removeItem() ) );
100 connect( PushButton12, SIGNAL( clicked() ), this, SLOT( openAddressbook() ) ); 100 connect( PushButton12, SIGNAL( clicked() ), this, SLOT( openAddressbook() ) );
101 connect( PushButton9, SIGNAL( clicked() ), this, SLOT( accept() ) ); 101 connect( PushButton9, SIGNAL( clicked() ), this, SLOT( accept() ) );
102 connect( mNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( updateItem() ) ); 102 connect( mNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( updateItem() ) );
103 connect( mEmailLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( updateItem() ) ); 103 connect( mEmailLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( updateItem() ) );
104 connect( PushButton8, SIGNAL( clicked() ), this, SLOT( reject() ) ); 104 connect( PushButton8, SIGNAL( clicked() ), this, SLOT( reject() ) );
105 105
106 // tab order 106 // tab order
107 setTabOrder( mAddressListView, mNameLineEdit ); 107 setTabOrder( mAddressListView, mNameLineEdit );
108 setTabOrder( mNameLineEdit, mEmailLineEdit ); 108 setTabOrder( mNameLineEdit, mEmailLineEdit );
109 setTabOrder( mEmailLineEdit, PushButton10 ); 109 setTabOrder( mEmailLineEdit, PushButton10 );
110 setTabOrder( PushButton10, PushButton11 ); 110 setTabOrder( PushButton10, PushButton11 );
111 setTabOrder( PushButton11, PushButton12 ); 111 setTabOrder( PushButton11, PushButton12 );
112 setTabOrder( PushButton12, PushButton9 ); 112 setTabOrder( PushButton12, PushButton9 );
113 setTabOrder( PushButton9, PushButton8 ); 113 setTabOrder( PushButton9, PushButton8 );
114} 114}
115 115
116/* 116/*
117 * Destroys the object and frees any allocated resources 117 * Destroys the object and frees any allocated resources
118 */ 118 */
119PublishDialog_base::~PublishDialog_base() 119PublishDialog_base::~PublishDialog_base()
120{ 120{
121 // no need to delete child widgets, Qt does it all for us 121 // no need to delete child widgets, Qt does it all for us
122} 122}
123 123
124/* 124/*
125 * Sets the strings of the subwidgets using the current 125 * Sets the strings of the subwidgets using the current
126 * language. 126 * language.
127 */ 127 */
128void PublishDialog_base::languageChange() 128void PublishDialog_base::languageChange()
129{ 129{
130 setCaption( tr2i18n( "Form1" ) ); 130 setCaption( tr2i18n( "Form1" ) );
131 mAddressListView->header()->setLabel( 0, tr2i18n( "Name" ) ); 131 mAddressListView->header()->setLabel( 0, tr2i18n( "Name" ) );
132 mAddressListView->header()->setLabel( 1, tr2i18n( "Email" ) ); 132 mAddressListView->header()->setLabel( 1, tr2i18n( "Email" ) );
133 TextLabel1->setText( tr2i18n( "Name:" ) ); 133 TextLabel1->setText( tr2i18n( "Name:" ) );
134 TextLabel2->setText( tr2i18n( "Email:" ) ); 134 TextLabel2->setText( tr2i18n( "Email:" ) );
135 PushButton10->setText( tr2i18n( "&New" ) ); 135 PushButton10->setText( tr2i18n( "&New" ) );
136 PushButton12->setText( tr2i18n( "&Addressbook" ) ); 136 PushButton12->setText( tr2i18n( "&Addressbook" ) );
137 PushButton11->setText( tr2i18n( "&Remove" ) ); 137 PushButton11->setText( tr2i18n( "&Remove" ) );
138 PushButton9->setText( tr2i18n( "&OK" ) ); 138 PushButton9->setText( tr2i18n( "&OK" ) );
139 PushButton8->setText( tr2i18n( "&Cancel" ) ); 139 PushButton8->setText( tr2i18n( "&Cancel" ) );
140} 140}
141 141
142void PublishDialog_base::addItem() 142void PublishDialog_base::addItem()
143{ 143{
144 qWarning( "PublishDialog_base::addItem(): Not implemented yet" ); 144 qWarning( "PublishDialog_base::addItem(): Not implemented yet" );
145} 145}
146 146
147void PublishDialog_base::removeItem() 147void PublishDialog_base::removeItem()
148{ 148{
149 qWarning( "PublishDialog_base::removeItem(): Not implemented yet" ); 149 qWarning( "PublishDialog_base::removeItem(): Not implemented yet" );
150} 150}
151 151
152void PublishDialog_base::openAddressbook() 152void PublishDialog_base::openAddressbook()
153{ 153{
154 qWarning( "PublishDialog_base::openAddressbook(): Not implemented yet" ); 154 qWarning( "PublishDialog_base::openAddressbook(): Not implemented yet" );
155} 155}
156 156
157void PublishDialog_base::updateItem() 157void PublishDialog_base::updateItem()
158{ 158{
159 qWarning( "PublishDialog_base::updateItem(): Not implemented yet" ); 159 qWarning( "PublishDialog_base::updateItem(): Not implemented yet" );
160} 160}
161
162#include "publishdialog_base.moc"
diff --git a/korganizer/savetemplatedialog.cpp b/korganizer/savetemplatedialog.cpp
index 0da524f..3544081 100644
--- a/korganizer/savetemplatedialog.cpp
+++ b/korganizer/savetemplatedialog.cpp
@@ -1,76 +1,75 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
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 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 25
26#include <keditlistbox.h> 26#include <keditlistbox.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29#include "koprefs.h" 29#include "koprefs.h"
30 30
31#include "savetemplatedialog.h" 31#include "savetemplatedialog.h"
32#include "savetemplatedialog.moc"
33 32
34SaveTemplateDialog::SaveTemplateDialog( IncidenceType type, QWidget *parent ) 33SaveTemplateDialog::SaveTemplateDialog( IncidenceType type, QWidget *parent )
35 : KDialogBase( Plain, i18n("Save Template"), Ok | Cancel, Ok, parent, 0, 34 : KDialogBase( Plain, i18n("Save Template"), Ok | Cancel, Ok, parent, 0,
36 true, false ), 35 true, false ),
37 mType( type ) 36 mType( type )
38{ 37{
39 QFrame *topFrame = plainPage(); 38 QFrame *topFrame = plainPage();
40 QVBoxLayout *topLayout = new QVBoxLayout( topFrame, 0, spacingHint() ); 39 QVBoxLayout *topLayout = new QVBoxLayout( topFrame, 0, spacingHint() );
41 40
42 mEditListBox = new KEditListBox( i18n("Select Template Name"), topFrame, 41 mEditListBox = new KEditListBox( i18n("Select Template Name"), topFrame,
43 0, false, KEditListBox::Add | 42 0, false, KEditListBox::Add |
44 KEditListBox::Remove ); 43 KEditListBox::Remove );
45 topLayout->addWidget( mEditListBox ); 44 topLayout->addWidget( mEditListBox );
46 connect( mEditListBox, SIGNAL( changed() ), SLOT( slotChanged() ) ); 45 connect( mEditListBox, SIGNAL( changed() ), SLOT( slotChanged() ) );
47 46
48 QStringList templates; 47 QStringList templates;
49 48
50 if ( mType == EventType ) { 49 if ( mType == EventType ) {
51 templates = KOPrefs::instance()->mEventTemplates; 50 templates = KOPrefs::instance()->mEventTemplates;
52 } else if( mType == TodoType ) { 51 } else if( mType == TodoType ) {
53 templates = KOPrefs::instance()->mTodoTemplates; 52 templates = KOPrefs::instance()->mTodoTemplates;
54 } 53 }
55 54
56 mEditListBox->insertStringList( templates ); 55 mEditListBox->insertStringList( templates );
57} 56}
58 57
59SaveTemplateDialog::~SaveTemplateDialog() 58SaveTemplateDialog::~SaveTemplateDialog()
60{ 59{
61} 60}
62 61
63void SaveTemplateDialog::slotOk() 62void SaveTemplateDialog::slotOk()
64{ 63{
65 emit templateSelected( mEditListBox->currentText() ); 64 emit templateSelected( mEditListBox->currentText() );
66 accept(); 65 accept();
67} 66}
68 67
69void SaveTemplateDialog::slotChanged() 68void SaveTemplateDialog::slotChanged()
70{ 69{
71 if ( mType == EventType ) { 70 if ( mType == EventType ) {
72 KOPrefs::instance()->mEventTemplates = mEditListBox->items(); 71 KOPrefs::instance()->mEventTemplates = mEditListBox->items();
73 } else if( mType == TodoType ) { 72 } else if( mType == TodoType ) {
74 KOPrefs::instance()->mTodoTemplates = mEditListBox->items(); 73 KOPrefs::instance()->mTodoTemplates = mEditListBox->items();
75 } 74 }
76} 75}
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 74d48b9..5bd7c6f 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -1,235 +1,234 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1998 Preston Brown 3 Copyright (c) 1998 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 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 7 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 8 the Free Software Foundation; either version 2 of the License, or
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 <qlayout.h> 25#include <qlayout.h>
26#include <qcheckbox.h> 26#include <qcheckbox.h>
27#include <qgroupbox.h> 27#include <qgroupbox.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qlineedit.h> 29#include <qlineedit.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31 31
32#include <klocale.h> 32#include <klocale.h>
33#include <kmessagebox.h> 33#include <kmessagebox.h>
34 34
35#include <libkdepim/kdateedit.h> 35#include <libkdepim/kdateedit.h>
36 36
37#include "koglobals.h" 37#include "koglobals.h"
38#include "koprefs.h" 38#include "koprefs.h"
39 39
40#include "calendarview.h" 40#include "calendarview.h"
41#include "koviewmanager.h" 41#include "koviewmanager.h"
42#include "searchdialog.h" 42#include "searchdialog.h"
43#include "searchdialog.moc"
44 43
45SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) 44SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
46 : KDialogBase(Plain,i18n("KO/Pi Find "),User1|Close,User1,parent,0,false,false, 45 : KDialogBase(Plain,i18n("KO/Pi Find "),User1|Close,User1,parent,0,false,false,
47 i18n("&Find")) 46 i18n("&Find"))
48{ 47{
49 mCalendar = calendar; 48 mCalendar = calendar;
50 QFrame *topFrame = plainPage(); 49 QFrame *topFrame = plainPage();
51 QVBoxLayout *layout = new QVBoxLayout(topFrame,0,spacingHint()); 50 QVBoxLayout *layout = new QVBoxLayout(topFrame,0,spacingHint());
52 51
53 // Search expression 52 // Search expression
54 QHBoxLayout *subLayout = new QHBoxLayout(); 53 QHBoxLayout *subLayout = new QHBoxLayout();
55 layout->addLayout(subLayout); 54 layout->addLayout(subLayout);
56 55
57 searchLabel = new QLabel(topFrame); 56 searchLabel = new QLabel(topFrame);
58 searchLabel->setText(i18n("Search for:")); 57 searchLabel->setText(i18n("Search for:"));
59 subLayout->addWidget(searchLabel); 58 subLayout->addWidget(searchLabel);
60 59
61 searchEdit = new QLineEdit(topFrame); 60 searchEdit = new QLineEdit(topFrame);
62 subLayout->addWidget(searchEdit); 61 subLayout->addWidget(searchEdit);
63 searchEdit->setText("*"); // Find all events by default 62 searchEdit->setText("*"); // Find all events by default
64 searchEdit->setFocus(); 63 searchEdit->setFocus();
65 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); 64 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & )));
66 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); 65 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch()));
67 // Subjects to search 66 // Subjects to search
68 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), 67 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"),
69 // topFrame); 68 // topFrame);
70 69
71 70
72 71
73 QHBox *incidenceGroup = new QHBox( topFrame ); 72 QHBox *incidenceGroup = new QHBox( topFrame );
74 layout->addWidget(incidenceGroup); 73 layout->addWidget(incidenceGroup);
75 74
76 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); 75 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup);
77 mSearchEvent->setChecked(true); 76 mSearchEvent->setChecked(true);
78 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); 77 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup);
79 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); 78 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup);
80 79
81 QHBox *subjectGroup = new QHBox( topFrame ); 80 QHBox *subjectGroup = new QHBox( topFrame );
82 layout->addWidget(subjectGroup); 81 layout->addWidget(subjectGroup);
83 82
84 mSummaryCheck = new QCheckBox(i18n("Summaries"),subjectGroup); 83 mSummaryCheck = new QCheckBox(i18n("Summaries"),subjectGroup);
85 mSummaryCheck->setChecked(true); 84 mSummaryCheck->setChecked(true);
86 mDescriptionCheck = new QCheckBox(i18n("Descriptions"),subjectGroup); 85 mDescriptionCheck = new QCheckBox(i18n("Descriptions"),subjectGroup);
87 mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); 86 mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup);
88 87
89 QHBox *attendeeGroup = new QHBox( topFrame ); 88 QHBox *attendeeGroup = new QHBox( topFrame );
90 layout->addWidget(attendeeGroup ); 89 layout->addWidget(attendeeGroup );
91 new QLabel( i18n("Attendee:"),attendeeGroup ); 90 new QLabel( i18n("Attendee:"),attendeeGroup );
92 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); 91 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup );
93 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); 92 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup );
94 // Date range 93 // Date range
95 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), 94 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"),
96 // topFrame); 95 // topFrame);
97 // layout->addWidget(rangeGroup); 96 // layout->addWidget(rangeGroup);
98 97
99 QWidget *rangeWidget = new QWidget(topFrame); 98 QWidget *rangeWidget = new QWidget(topFrame);
100 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,spacingHint()); 99 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,spacingHint());
101 100
102 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); 101 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget));
103 mStartDate = new KDateEdit(rangeWidget); 102 mStartDate = new KDateEdit(rangeWidget);
104 rangeLayout->addWidget(mStartDate); 103 rangeLayout->addWidget(mStartDate);
105 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); 104 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget));
106 mEndDate = new KDateEdit(rangeWidget); 105 mEndDate = new KDateEdit(rangeWidget);
107 mEndDate->setDate(QDate::currentDate().addDays(365)); 106 mEndDate->setDate(QDate::currentDate().addDays(365));
108 rangeLayout->addWidget(mEndDate); 107 rangeLayout->addWidget(mEndDate);
109 108
110 // mInclusiveCheck = new QCheckBox(i18n("Events have to be completely included"), topFrame); 109 // mInclusiveCheck = new QCheckBox(i18n("Events have to be completely included"), topFrame);
111 //mInclusiveCheck->setChecked(false); 110 //mInclusiveCheck->setChecked(false);
112 layout->addWidget(rangeWidget); 111 layout->addWidget(rangeWidget);
113 //layout->addWidget(mInclusiveCheck); 112 //layout->addWidget(mInclusiveCheck);
114 // Subjects to search 113 // Subjects to search
115 114
116 115
117 // Results list view 116 // Results list view
118 listView = new KOListView(mCalendar,topFrame); 117 listView = new KOListView(mCalendar,topFrame);
119 //listView->showDates(); 118 //listView->showDates();
120 119
121 120
122 layout->addWidget(listView); 121 layout->addWidget(listView);
123 122
124 // if ( KOPrefs::instance()->mCompactDialogs ) { 123 // if ( KOPrefs::instance()->mCompactDialogs ) {
125 // KOGlobals::fitDialogToScreen( this, true ); 124 // KOGlobals::fitDialogToScreen( this, true );
126 // } 125 // }
127 126
128 listView->readSettings(KOGlobals::config(),"SearchListView Layout"); 127 listView->readSettings(KOGlobals::config(),"SearchListView Layout");
129 connect(this,SIGNAL(user1Clicked()),SLOT(doSearch())); 128 connect(this,SIGNAL(user1Clicked()),SLOT(doSearch()));
130 QPushButton *CloseButton = findButton( Close ); 129 QPushButton *CloseButton = findButton( Close );
131 //connect(CloseButton,SIGNAL(clicked()),listView, SLOT(clear())); 130 //connect(CloseButton,SIGNAL(clicked()),listView, SLOT(clear()));
132 131
133#ifndef DESKTOP_VERSION 132#ifndef DESKTOP_VERSION
134 setCaption(i18n("Click OK to search ->")); 133 setCaption(i18n("Click OK to search ->"));
135 hideButtons(); 134 hideButtons();
136#endif 135#endif
137} 136}
138 137
139SearchDialog::~SearchDialog() 138SearchDialog::~SearchDialog()
140{ 139{
141 140
142} 141}
143void SearchDialog::accept() 142void SearchDialog::accept()
144{ 143{
145 doSearch(); 144 doSearch();
146} 145}
147void SearchDialog::updateList() 146void SearchDialog::updateList()
148{ 147{
149 //listView->updateList(); 148 //listView->updateList();
150 if ( isVisible() ) { 149 if ( isVisible() ) {
151 updateView(); 150 updateView();
152 //qDebug("SearchDialog::updated "); 151 //qDebug("SearchDialog::updated ");
153 } 152 }
154 else { 153 else {
155 listView->clear(); 154 listView->clear();
156 //qDebug("SearchDialog::cleared "); 155 //qDebug("SearchDialog::cleared ");
157 156
158 } 157 }
159} 158}
160void SearchDialog::searchTextChanged( const QString &_text ) 159void SearchDialog::searchTextChanged( const QString &_text )
161{ 160{
162 enableButton( KDialogBase::User1, !_text.isEmpty() ); 161 enableButton( KDialogBase::User1, !_text.isEmpty() );
163} 162}
164 163
165void SearchDialog::doSearch() 164void SearchDialog::doSearch()
166{ 165{
167 QRegExp re; 166 QRegExp re;
168 167
169 re.setWildcard(true); // most people understand these better. 168 re.setWildcard(true); // most people understand these better.
170 re.setCaseSensitive(false); 169 re.setCaseSensitive(false);
171 re.setPattern(searchEdit->text()); 170 re.setPattern(searchEdit->text());
172 if (!re.isValid() ) { 171 if (!re.isValid() ) {
173 KMessageBox::sorry(this, 172 KMessageBox::sorry(this,
174 i18n("Invalid search expression,\ncannot perform " 173 i18n("Invalid search expression,\ncannot perform "
175 "the search.\nPlease enter a search expression\n" 174 "the search.\nPlease enter a search expression\n"
176 "using the wildcard characters\n '*' and '?'" 175 "using the wildcard characters\n '*' and '?'"
177 "where needed.")); 176 "where needed."));
178 return; 177 return;
179 } 178 }
180 179
181 search(re); 180 search(re);
182 181
183 listView->setStartDate( mStartDate->date() ); 182 listView->setStartDate( mStartDate->date() );
184 listView->showEvents(mMatchedEvents); 183 listView->showEvents(mMatchedEvents);
185 listView->addTodos(mMatchedTodos); 184 listView->addTodos(mMatchedTodos);
186 listView->addJournals(mMatchedJournals); 185 listView->addJournals(mMatchedJournals);
187 186
188 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { 187 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) {
189 KMessageBox::information(this, 188 KMessageBox::information(this,
190 i18n("No event/todo were found matching\nyour search expression.\nUse the wildcard characters\n ' * ' and ' ? ' where needed.")); 189 i18n("No event/todo were found matching\nyour search expression.\nUse the wildcard characters\n ' * ' and ' ? ' where needed."));
191#ifndef DESKTOP_VERSION 190#ifndef DESKTOP_VERSION
192 setCaption(i18n("Click OK to search ->")); 191 setCaption(i18n("Click OK to search ->"));
193#else 192#else
194 setCaption(i18n("KO/Pi Find ")); 193 setCaption(i18n("KO/Pi Find "));
195#endif 194#endif
196 } else { 195 } else {
197 QString mess; 196 QString mess;
198 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); 197 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() );
199 setCaption( i18n("KO/Pi Find: ") + mess); 198 setCaption( i18n("KO/Pi Find: ") + mess);
200 199
201 } 200 }
202} 201}
203void SearchDialog::updateConfig() 202void SearchDialog::updateConfig()
204{ 203{
205 listView->updateConfig(); 204 listView->updateConfig();
206} 205}
207void SearchDialog::updateView() 206void SearchDialog::updateView()
208{ 207{
209 208
210 QRegExp re; 209 QRegExp re;
211 re.setWildcard(true); // most people understand these better. 210 re.setWildcard(true); // most people understand these better.
212 re.setCaseSensitive(false); 211 re.setCaseSensitive(false);
213 re.setPattern(searchEdit->text()); 212 re.setPattern(searchEdit->text());
214 if (re.isValid()) { 213 if (re.isValid()) {
215 search(re); 214 search(re);
216 } else { 215 } else {
217 mMatchedEvents.clear(); 216 mMatchedEvents.clear();
218 mMatchedTodos.clear(); 217 mMatchedTodos.clear();
219 mMatchedJournals.clear(); 218 mMatchedJournals.clear();
220 } 219 }
221 listView->setStartDate( mStartDate->date() ); 220 listView->setStartDate( mStartDate->date() );
222 listView->showEvents(mMatchedEvents); 221 listView->showEvents(mMatchedEvents);
223 listView->addTodos(mMatchedTodos); 222 listView->addTodos(mMatchedTodos);
224 listView->addJournals(mMatchedJournals); 223 listView->addJournals(mMatchedJournals);
225} 224}
226 225
227void SearchDialog::search(const QRegExp &re) 226void SearchDialog::search(const QRegExp &re)
228{ 227{
229 QPtrList<Event> events = mCalendar->events( mStartDate->date(), 228 QPtrList<Event> events = mCalendar->events( mStartDate->date(),
230 mEndDate->date(), 229 mEndDate->date(),
231 false /*mInclusiveCheck->isChecked()*/ ); 230 false /*mInclusiveCheck->isChecked()*/ );
232 231
233 mMatchedEvents.clear(); 232 mMatchedEvents.clear();
234 if ( mSearchEvent->isChecked() ) { 233 if ( mSearchEvent->isChecked() ) {
235 Event *ev; 234 Event *ev;
diff --git a/korganizer/statusdialog.cpp b/korganizer/statusdialog.cpp
index 78efeb0..7137c49 100644
--- a/korganizer/statusdialog.cpp
+++ b/korganizer/statusdialog.cpp
@@ -1,67 +1,66 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
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 <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 24
25#include <kdebug.h> 25#include <kdebug.h>
26#include <klocale.h> 26#include <klocale.h>
27 27
28#include "statusdialog.h" 28#include "statusdialog.h"
29#include "statusdialog.moc"
30 29
31StatusDialog::StatusDialog(QWidget* parent, const char* name) : 30StatusDialog::StatusDialog(QWidget* parent, const char* name) :
32 KDialog(parent,name,true) 31 KDialog(parent,name,true)
33{ 32{
34 setCaption(i18n("Set Your Status")); 33 setCaption(i18n("Set Your Status"));
35 34
36 QBoxLayout *topLayout = new QVBoxLayout( this ); 35 QBoxLayout *topLayout = new QVBoxLayout( this );
37 topLayout->setSpacing( spacingHint() ); 36 topLayout->setSpacing( spacingHint() );
38 topLayout->setMargin( marginHint() ); 37 topLayout->setMargin( marginHint() );
39 38
40 QBoxLayout *statusLayout = new QHBoxLayout( topLayout ); 39 QBoxLayout *statusLayout = new QHBoxLayout( topLayout );
41 40
42 QLabel *text = new QLabel(i18n("Set your status"),this); 41 QLabel *text = new QLabel(i18n("Set your status"),this);
43 statusLayout->addWidget( text ); 42 statusLayout->addWidget( text );
44 43
45 mStatus = new QComboBox(false,this); 44 mStatus = new QComboBox(false,this);
46 mStatus->insertStringList(Attendee::statusList()); 45 mStatus->insertStringList(Attendee::statusList());
47 statusLayout->addWidget( mStatus ); 46 statusLayout->addWidget( mStatus );
48 47
49 QBoxLayout *buttonLayout = new QHBoxLayout( topLayout ); 48 QBoxLayout *buttonLayout = new QHBoxLayout( topLayout );
50 49
51 QPushButton *ok = new QPushButton(i18n("&OK"), this); 50 QPushButton *ok = new QPushButton(i18n("&OK"), this);
52 connect ( ok,SIGNAL(clicked()), this,SLOT(accept()) ); 51 connect ( ok,SIGNAL(clicked()), this,SLOT(accept()) );
53 buttonLayout->addWidget( ok ); 52 buttonLayout->addWidget( ok );
54 53
55 QPushButton *cancel = new QPushButton(i18n("&Cancel"), this); 54 QPushButton *cancel = new QPushButton(i18n("&Cancel"), this);
56 connect ( cancel,SIGNAL(clicked()), this,SLOT(reject()) ); 55 connect ( cancel,SIGNAL(clicked()), this,SLOT(reject()) );
57 buttonLayout->addWidget( cancel ); 56 buttonLayout->addWidget( cancel );
58} 57}
59 58
60StatusDialog::~StatusDialog() 59StatusDialog::~StatusDialog()
61{ 60{
62} 61}
63 62
64Attendee::PartStat StatusDialog::status() 63Attendee::PartStat StatusDialog::status()
65{ 64{
66 return Attendee::PartStat( mStatus->currentItem() ) ; 65 return Attendee::PartStat( mStatus->currentItem() ) ;
67} 66}
diff --git a/korganizer/timeline.cpp b/korganizer/timeline.cpp
index 6f9c8dd..11be432 100644
--- a/korganizer/timeline.cpp
+++ b/korganizer/timeline.cpp
@@ -1,63 +1,62 @@
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#include "timeline.moc"
7 6
8TimeLine::TimeLine( QWidget *parent, const char *name ) : 7TimeLine::TimeLine( QWidget *parent, const char *name ) :
9 QScrollView( parent, name ) 8 QScrollView( parent, name )
10{ 9{
11 mPixelWidth = 1000; 10 mPixelWidth = 1000;
12 11
13 resizeContents( mPixelWidth, 20 ); 12 resizeContents( mPixelWidth, 20 );
14 13
15 viewport()->setBackgroundMode( PaletteBackground ); 14 viewport()->setBackgroundMode( PaletteBackground );
16 15
17 setHScrollBarMode(AlwaysOff); 16 setHScrollBarMode(AlwaysOff);
18 setVScrollBarMode(AlwaysOff); 17 setVScrollBarMode(AlwaysOff);
19} 18}
20 19
21TimeLine::~TimeLine() 20TimeLine::~TimeLine()
22{ 21{
23} 22}
24 23
25void 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)
26{ 25{
27 int spacingX = mDaySpacing; 26 int spacingX = mDaySpacing;
28 int offsetX = mDayOffset; 27 int offsetX = mDayOffset;
29 28
30 // Draw vertical lines of grid 29 // Draw vertical lines of grid
31// kdDebug() << "drawContents cx: " << cx << " cy: " << cy << " cw: " << cw << " ch: " << ch << endl; 30// kdDebug() << "drawContents cx: " << cx << " cy: " << cy << " cw: " << cw << " ch: " << ch << endl;
32 int cell = int( (cx - ( spacingX - offsetX ) ) / spacingX ); 31 int cell = int( (cx - ( spacingX - offsetX ) ) / spacingX );
33 int x = cell * spacingX + ( spacingX - offsetX ); 32 int x = cell * spacingX + ( spacingX - offsetX );
34// kdDebug() << " x: " << x << endl; 33// kdDebug() << " x: " << x << endl;
35 while (x < cx + cw) { 34 while (x < cx + cw) {
36// kdDebug() << " x: " << x << endl; 35// kdDebug() << " x: " << x << endl;
37 p->drawLine(x,cy,x,cy+ch); 36 p->drawLine(x,cy,x,cy+ch);
38 p->drawText( x + 5, 15, QString::number( mStartDate.addDays( cell + 1 ).date().day() ) ); 37 p->drawText( x + 5, 15, QString::number( mStartDate.addDays( cell + 1 ).date().day() ) );
39 38
40 x += spacingX; 39 x += spacingX;
41 cell++; 40 cell++;
42 } 41 }
43} 42}
44 43
45void TimeLine::setDateRange( const QDateTime &start, const QDateTime &end ) 44void TimeLine::setDateRange( const QDateTime &start, const QDateTime &end )
46{ 45{
47 mStartDate = start; 46 mStartDate = start;
48 mEndDate = end; 47 mEndDate = end;
49 48
50 mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mPixelWidth; 49 mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mPixelWidth;
51 50
52 mDaySpacing = 60 * 60 * 24 / mSecsPerPixel; 51 mDaySpacing = 60 * 60 * 24 / mSecsPerPixel;
53 52
54 mDayOffset = QDateTime( mStartDate.date() ).secsTo( mStartDate ) / mSecsPerPixel; 53 mDayOffset = QDateTime( mStartDate.date() ).secsTo( mStartDate ) / mSecsPerPixel;
55 54
56 kdDebug() << "TimeLines::setDateRange(): mDaySpacing: " << mDaySpacing << " mDayOffset: " 55 kdDebug() << "TimeLines::setDateRange(): mDaySpacing: " << mDaySpacing << " mDayOffset: "
57 << mDayOffset << " mSecsPerPixel: " << mSecsPerPixel << endl; 56 << mDayOffset << " mSecsPerPixel: " << mSecsPerPixel << endl;
58} 57}
59 58
60void TimeLine::setContentsPos( int pos ) 59void TimeLine::setContentsPos( int pos )
61{ 60{
62 QScrollView::setContentsPos ( pos, 0 ); 61 QScrollView::setContentsPos ( pos, 0 );
63} 62}
diff --git a/korganizer/timespanview.cpp b/korganizer/timespanview.cpp
index f8314e7..67a3811 100644
--- a/korganizer/timespanview.cpp
+++ b/korganizer/timespanview.cpp
@@ -1,158 +1,157 @@
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 <qlistview.h>
8#include <qlayout.h> 8#include <qlayout.h>
9#include <qheader.h> 9#include <qheader.h>
10#include <qpushbutton.h> 10#include <qpushbutton.h>
11 11
12#include <klocale.h> 12#include <klocale.h>
13#include <kdebug.h> 13#include <kdebug.h>
14 14
15#include "lineview.h" 15#include "lineview.h"
16#include "timeline.h" 16#include "timeline.h"
17 17
18#include "timespanview.h" 18#include "timespanview.h"
19#include "timespanview.moc"
20 19
21 20
22TimeSpanView::TimeSpanView( QWidget *parent, const char *name ) : 21TimeSpanView::TimeSpanView( QWidget *parent, const char *name ) :
23 QWidget( parent, name ) 22 QWidget( parent, name )
24{ 23{
25 QBoxLayout *topLayout = new QVBoxLayout( this ); 24 QBoxLayout *topLayout = new QVBoxLayout( this );
26#ifndef DESKTOP_VERSION 25#ifndef DESKTOP_VERSION
27 mSplitter = new QKSplitter( this ); 26 mSplitter = new QKSplitter( this );
28#else 27#else
29 mSplitter = new QSplitter( this ); 28 mSplitter = new QSplitter( this );
30#endif 29#endif
31 topLayout->addWidget( mSplitter ); 30 topLayout->addWidget( mSplitter );
32 31
33 mList = new QListView( mSplitter ); 32 mList = new QListView( mSplitter );
34 mList->addColumn( i18n("Summary") ); 33 mList->addColumn( i18n("Summary") );
35 34
36 QWidget *rightPane = new QWidget( mSplitter ); 35 QWidget *rightPane = new QWidget( mSplitter );
37 QBoxLayout *rightPaneLayout = new QVBoxLayout( rightPane ); 36 QBoxLayout *rightPaneLayout = new QVBoxLayout( rightPane );
38 37
39 mTimeLine = new TimeLine( rightPane ); 38 mTimeLine = new TimeLine( rightPane );
40 mTimeLine->setFixedHeight( mList->header()->height() ); 39 mTimeLine->setFixedHeight( mList->header()->height() );
41 rightPaneLayout->addWidget( mTimeLine ); 40 rightPaneLayout->addWidget( mTimeLine );
42 41
43 mLineView = new LineView( rightPane ); 42 mLineView = new LineView( rightPane );
44 rightPaneLayout->addWidget( mLineView ); 43 rightPaneLayout->addWidget( mLineView );
45 44
46 QBoxLayout *buttonLayout = new QHBoxLayout( rightPaneLayout ); 45 QBoxLayout *buttonLayout = new QHBoxLayout( rightPaneLayout );
47 46
48 QPushButton *zoomInButton = new QPushButton( i18n("Zoom In"), rightPane ); 47 QPushButton *zoomInButton = new QPushButton( i18n("Zoom In"), rightPane );
49 connect( zoomInButton, SIGNAL( clicked() ), SLOT( zoomIn() ) ); 48 connect( zoomInButton, SIGNAL( clicked() ), SLOT( zoomIn() ) );
50 buttonLayout->addWidget( zoomInButton ); 49 buttonLayout->addWidget( zoomInButton );
51 50
52 QPushButton *zoomOutButton = new QPushButton( i18n("Zoom Out"), rightPane ); 51 QPushButton *zoomOutButton = new QPushButton( i18n("Zoom Out"), rightPane );
53 connect( zoomOutButton, SIGNAL( clicked() ), SLOT( zoomOut() ) ); 52 connect( zoomOutButton, SIGNAL( clicked() ), SLOT( zoomOut() ) );
54 buttonLayout->addWidget( zoomOutButton ); 53 buttonLayout->addWidget( zoomOutButton );
55 54
56 QPushButton *centerButton = new QPushButton( i18n("Center View"), rightPane ); 55 QPushButton *centerButton = new QPushButton( i18n("Center View"), rightPane );
57 connect( centerButton, SIGNAL( clicked() ), SLOT( centerView() ) ); 56 connect( centerButton, SIGNAL( clicked() ), SLOT( centerView() ) );
58 buttonLayout->addWidget( centerButton ); 57 buttonLayout->addWidget( centerButton );
59 58
60 connect(mLineView->horizontalScrollBar(),SIGNAL(valueChanged(int)), 59 connect(mLineView->horizontalScrollBar(),SIGNAL(valueChanged(int)),
61 mTimeLine,SLOT(setContentsPos(int))); 60 mTimeLine,SLOT(setContentsPos(int)));
62} 61}
63 62
64TimeSpanView::~TimeSpanView() 63TimeSpanView::~TimeSpanView()
65{ 64{
66} 65}
67 66
68QValueList<int> TimeSpanView::splitterSizes() 67QValueList<int> TimeSpanView::splitterSizes()
69{ 68{
70 return mSplitter->sizes(); 69 return mSplitter->sizes();
71} 70}
72 71
73void TimeSpanView::setSplitterSizes( QValueList<int> sizes ) 72void TimeSpanView::setSplitterSizes( QValueList<int> sizes )
74{ 73{
75 mSplitter->setSizes( sizes ); 74 mSplitter->setSizes( sizes );
76} 75}
77 76
78void TimeSpanView::addItem( KCal::Event *event ) 77void TimeSpanView::addItem( KCal::Event *event )
79{ 78{
80 new QListViewItem( mList, event->summary() ); 79 new QListViewItem( mList, event->summary() );
81 80
82 QDateTime startDt = event->dtStart(); 81 QDateTime startDt = event->dtStart();
83 QDateTime endDt = event->dtEnd(); 82 QDateTime endDt = event->dtEnd();
84 83
85// kdDebug() << "TimeSpanView::addItem(): start: " << startDt.toString() 84// kdDebug() << "TimeSpanView::addItem(): start: " << startDt.toString()
86// << " end: " << endDt.toString() << endl; 85// << " end: " << endDt.toString() << endl;
87 86
88 int startSecs = mStartDate.secsTo( startDt ); 87 int startSecs = mStartDate.secsTo( startDt );
89 int durationSecs = startDt.secsTo( endDt ); 88 int durationSecs = startDt.secsTo( endDt );
90 89
91// kdDebug() << "--- startSecs: " << startSecs << " dur: " << durationSecs << endl; 90// kdDebug() << "--- startSecs: " << startSecs << " dur: " << durationSecs << endl;
92 91
93 int startX = mStartDate.secsTo( startDt ) / mSecsPerPixel; 92 int startX = mStartDate.secsTo( startDt ) / mSecsPerPixel;
94 int endX = startX + startDt.secsTo( endDt ) / mSecsPerPixel; 93 int endX = startX + startDt.secsTo( endDt ) / mSecsPerPixel;
95 94
96// kdDebug() << "TimeSpanView::addItem(): s: " << startX << " e: " << endX << endl; 95// kdDebug() << "TimeSpanView::addItem(): s: " << startX << " e: " << endX << endl;
97 96
98 mLineView->addLine( startX, endX ); 97 mLineView->addLine( startX, endX );
99} 98}
100 99
101void TimeSpanView::clear() 100void TimeSpanView::clear()
102{ 101{
103 mList->clear(); 102 mList->clear();
104 mLineView->clear(); 103 mLineView->clear();
105} 104}
106 105
107void TimeSpanView::updateView() 106void TimeSpanView::updateView()
108{ 107{
109#if QT_VERSION >= 300 108#if QT_VERSION >= 300
110 mLineView->updateContents(); 109 mLineView->updateContents();
111 mTimeLine->updateContents(); 110 mTimeLine->updateContents();
112#else 111#else
113#endif 112#endif
114} 113}
115 114
116void TimeSpanView::setDateRange( const QDateTime &start, const QDateTime &end ) 115void TimeSpanView::setDateRange( const QDateTime &start, const QDateTime &end )
117{ 116{
118 mStartDate = start; 117 mStartDate = start;
119 mEndDate = end; 118 mEndDate = end;
120 119
121 mTimeLine->setDateRange( start, end ); 120 mTimeLine->setDateRange( start, end );
122 121
123 mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mLineView->pixelWidth(); 122 mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mLineView->pixelWidth();
124} 123}
125 124
126QDateTime TimeSpanView::startDateTime() 125QDateTime TimeSpanView::startDateTime()
127{ 126{
128 return mStartDate; 127 return mStartDate;
129} 128}
130 129
131QDateTime TimeSpanView::endDateTime() 130QDateTime TimeSpanView::endDateTime()
132{ 131{
133 return mEndDate; 132 return mEndDate;
134} 133}
135 134
136void TimeSpanView::zoomIn() 135void TimeSpanView::zoomIn()
137{ 136{
138 int span = mStartDate.daysTo( mEndDate ); 137 int span = mStartDate.daysTo( mEndDate );
139 setDateRange( mStartDate.addDays( span / 4 ), mEndDate.addDays( span / -4 ) ); 138 setDateRange( mStartDate.addDays( span / 4 ), mEndDate.addDays( span / -4 ) );
140 139
141 emit dateRangeChanged(); 140 emit dateRangeChanged();
142} 141}
143 142
144void TimeSpanView::zoomOut() 143void TimeSpanView::zoomOut()
145{ 144{
146 int span = mStartDate.daysTo( mEndDate ); 145 int span = mStartDate.daysTo( mEndDate );
147 setDateRange( mStartDate.addDays( span / -4 ), mEndDate.addDays( span / 4 ) ); 146 setDateRange( mStartDate.addDays( span / -4 ), mEndDate.addDays( span / 4 ) );
148 147
149 emit dateRangeChanged(); 148 emit dateRangeChanged();
150} 149}
151 150
152void TimeSpanView::centerView() 151void TimeSpanView::centerView()
153{ 152{
154 QScrollBar *scrollBar = mLineView->horizontalScrollBar(); 153 QScrollBar *scrollBar = mLineView->horizontalScrollBar();
155 int min = scrollBar->minValue(); 154 int min = scrollBar->minValue();
156 int max = scrollBar->maxValue(); 155 int max = scrollBar->maxValue();
157 scrollBar->setValue( min + (max-min) / 2 ); 156 scrollBar->setValue( min + (max-min) / 2 );
158} 157}
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index dc198bd..32aac7a 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -234,193 +234,193 @@ QPtrList<Incidence> Calendar::incidences()
234{ 234{
235 QPtrList<Incidence> incidences; 235 QPtrList<Incidence> incidences;
236 236
237 Incidence *i; 237 Incidence *i;
238 238
239 QPtrList<Event> e = events(); 239 QPtrList<Event> e = events();
240 for( i = e.first(); i; i = e.next() ) incidences.append( i ); 240 for( i = e.first(); i; i = e.next() ) incidences.append( i );
241 241
242 QPtrList<Todo> t = todos(); 242 QPtrList<Todo> t = todos();
243 for( i = t.first(); i; i = t.next() ) incidences.append( i ); 243 for( i = t.first(); i; i = t.next() ) incidences.append( i );
244 244
245 QPtrList<Journal> j = journals(); 245 QPtrList<Journal> j = journals();
246 for( i = j.first(); i; i = j.next() ) incidences.append( i ); 246 for( i = j.first(); i; i = j.next() ) incidences.append( i );
247 247
248 return incidences; 248 return incidences;
249} 249}
250 250
251QPtrList<Incidence> Calendar::rawIncidences() 251QPtrList<Incidence> Calendar::rawIncidences()
252{ 252{
253 QPtrList<Incidence> incidences; 253 QPtrList<Incidence> incidences;
254 254
255 Incidence *i; 255 Incidence *i;
256 256
257 QPtrList<Event> e = rawEvents(); 257 QPtrList<Event> e = rawEvents();
258 for( i = e.first(); i; i = e.next() ) incidences.append( i ); 258 for( i = e.first(); i; i = e.next() ) incidences.append( i );
259 259
260 QPtrList<Todo> t = rawTodos(); 260 QPtrList<Todo> t = rawTodos();
261 for( i = t.first(); i; i = t.next() ) incidences.append( i ); 261 for( i = t.first(); i; i = t.next() ) incidences.append( i );
262 262
263 QPtrList<Journal> j = journals(); 263 QPtrList<Journal> j = journals();
264 for( i = j.first(); i; i = j.next() ) incidences.append( i ); 264 for( i = j.first(); i; i = j.next() ) incidences.append( i );
265 265
266 return incidences; 266 return incidences;
267} 267}
268 268
269QPtrList<Event> Calendar::events( const QDate &date, bool sorted ) 269QPtrList<Event> Calendar::events( const QDate &date, bool sorted )
270{ 270{
271 QPtrList<Event> el = rawEventsForDate(date,sorted); 271 QPtrList<Event> el = rawEventsForDate(date,sorted);
272 mFilter->apply(&el); 272 mFilter->apply(&el);
273 return el; 273 return el;
274} 274}
275 275
276QPtrList<Event> Calendar::events( const QDateTime &qdt ) 276QPtrList<Event> Calendar::events( const QDateTime &qdt )
277{ 277{
278 QPtrList<Event> el = rawEventsForDate(qdt); 278 QPtrList<Event> el = rawEventsForDate(qdt);
279 mFilter->apply(&el); 279 mFilter->apply(&el);
280 return el; 280 return el;
281} 281}
282 282
283QPtrList<Event> Calendar::events( const QDate &start, const QDate &end, 283QPtrList<Event> Calendar::events( const QDate &start, const QDate &end,
284 bool inclusive) 284 bool inclusive)
285{ 285{
286 QPtrList<Event> el = rawEvents(start,end,inclusive); 286 QPtrList<Event> el = rawEvents(start,end,inclusive);
287 mFilter->apply(&el); 287 mFilter->apply(&el);
288 return el; 288 return el;
289} 289}
290 290
291QPtrList<Event> Calendar::events() 291QPtrList<Event> Calendar::events()
292{ 292{
293 QPtrList<Event> el = rawEvents(); 293 QPtrList<Event> el = rawEvents();
294 mFilter->apply(&el); 294 mFilter->apply(&el);
295 return el; 295 return el;
296} 296}
297 297
298 298
299bool Calendar::addIncidence(Incidence *i) 299bool Calendar::addIncidence(Incidence *i)
300{ 300{
301 Incidence::AddVisitor<Calendar> v(this); 301 Incidence::AddVisitor<Calendar> v(this);
302 302
303 return i->accept(v); 303 return i->accept(v);
304} 304}
305void Calendar::deleteIncidence(Incidence *in) 305void Calendar::deleteIncidence(Incidence *in)
306{ 306{
307 if ( in->type() == "Event" ) 307 if ( in->type() == "Event" )
308 deleteEvent( (Event*) in ); 308 deleteEvent( (Event*) in );
309 else if ( in->type() =="Todo" ) 309 else if ( in->type() =="Todo" )
310 deleteTodo( (Todo*) in); 310 deleteTodo( (Todo*) in);
311 else if ( in->type() =="Journal" ) 311 else if ( in->type() =="Journal" )
312 deleteJournal( (Journal*) in ); 312 deleteJournal( (Journal*) in );
313} 313}
314 314
315Incidence* Calendar::incidence( const QString& uid ) 315Incidence* Calendar::incidence( const QString& uid )
316{ 316{
317 Incidence* i; 317 Incidence* i;
318 318
319 if( (i = todo( uid )) != 0 ) 319 if( (i = todo( uid )) != 0 )
320 return i; 320 return i;
321 if( (i = event( uid )) != 0 ) 321 if( (i = event( uid )) != 0 )
322 return i; 322 return i;
323 if( (i = journal( uid )) != 0 ) 323 if( (i = journal( uid )) != 0 )
324 return i; 324 return i;
325 325
326 return 0; 326 return 0;
327} 327}
328 328
329QPtrList<Todo> Calendar::todos() 329QPtrList<Todo> Calendar::todos()
330{ 330{
331 QPtrList<Todo> tl = rawTodos(); 331 QPtrList<Todo> tl = rawTodos();
332 mFilter->apply( &tl ); 332 mFilter->apply( &tl );
333 return tl; 333 return tl;
334} 334}
335 335
336// When this is called, the todo have already been added to the calendar. 336// When this is called, the todo have already been added to the calendar.
337// This method is only about linking related todos 337// This method is only about linking related todos
338void Calendar::setupRelations( Incidence *incidence ) 338void Calendar::setupRelations( Incidence *incidence )
339{ 339{
340 QString uid = incidence->uid(); 340 QString uid = incidence->uid();
341 //qDebug("Calendar::setupRelations "); 341 //qDebug("Calendar::setupRelations ");
342 // First, go over the list of orphans and see if this is their parent 342 // First, go over the list of orphans and see if this is their parent
343 while( Incidence* i = mOrphans[ uid ] ) { 343 while( Incidence* i = mOrphans[ uid ] ) {
344 mOrphans.remove( uid ); 344 mOrphans.remove( uid );
345 i->setRelatedTo( incidence ); 345 i->setRelatedTo( incidence );
346 incidence->addRelation( i ); 346 incidence->addRelation( i );
347 mOrphanUids.remove( i->uid() ); 347 mOrphanUids.remove( i->uid() );
348 } 348 }
349 349
350 // Now see about this incidences parent 350 // Now see about this incidences parent
351 if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) { 351 if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) {
352 // This incidence has a uid it is related to, but is not registered to it yet 352 // This incidence has a uid it is related to, but is not registered to it yet
353 // Try to find it 353 // Try to find it
354 Incidence* parent = this->incidence( incidence->relatedToUid() ); 354 Incidence* parent = this->incidence( incidence->relatedToUid() );
355 if( parent ) { 355 if( parent ) {
356 // Found it 356 // Found it
357 incidence->setRelatedTo( parent ); 357 incidence->setRelatedTo( parent );
358 parent->addRelation( incidence ); 358 parent->addRelation( incidence );
359 } else { 359 } else {
360 // Not found, put this in the mOrphans list 360 // Not found, put this in the mOrphans list
361 mOrphans.insert( incidence->relatedToUid(), incidence ); 361 mOrphans.insert( incidence->relatedToUid(), incidence );
362 mOrphanUids.insert( incidence->uid(), incidence ); 362 mOrphanUids.insert( incidence->uid(), incidence );
363 } 363 }
364 } 364 }
365} 365}
366 366
367// If a task with subtasks is deleted, move it's subtasks to the orphans list 367// If a task with subtasks is deleted, move it's subtasks to the orphans list
368void Calendar::removeRelations( Incidence *incidence ) 368void Calendar::removeRelations( Incidence *incidence )
369{ 369{
370 // qDebug("Calendar::removeRelations "); 370 // qDebug("Calendar::removeRelations ");
371 QString uid = incidence->uid(); 371 QString uid = incidence->uid();
372 372
373 QPtrList<Incidence> relations = incidence->relations(); 373 QPtrList<Incidence> relations = incidence->relations();
374 for( Incidence* i = relations.first(); i; i = relations.next() ) 374 for( Incidence* i = relations.first(); i; i = relations.next() )
375 if( !mOrphanUids.find( i->uid() ) ) { 375 if( !mOrphanUids.find( i->uid() ) ) {
376 mOrphans.insert( uid, i ); 376 mOrphans.insert( uid, i );
377 mOrphanUids.insert( i->uid(), i ); 377 mOrphanUids.insert( i->uid(), i );
378 i->setRelatedTo( 0 ); 378 i->setRelatedTo( 0 );
379 i->setRelatedToUid( uid ); 379 i->setRelatedToUid( uid );
380 } 380 }
381 381
382 // If this incidence is related to something else, tell that about it 382 // If this incidence is related to something else, tell that about it
383 if( incidence->relatedTo() ) 383 if( incidence->relatedTo() )
384 incidence->relatedTo()->removeRelation( incidence ); 384 incidence->relatedTo()->removeRelation( incidence );
385 385
386 // Remove this one from the orphans list 386 // Remove this one from the orphans list
387 if( mOrphanUids.remove( uid ) ) 387 if( mOrphanUids.remove( uid ) )
388 // This incidence is located in the orphans list - it should be removed 388 // This incidence is located in the orphans list - it should be removed
389 if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) { 389 if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) {
390 // Removing wasn't that easy 390 // Removing wasn't that easy
391 for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) { 391 for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) {
392 if( it.current()->uid() == uid ) { 392 if( it.current()->uid() == uid ) {
393 mOrphans.remove( it.currentKey() ); 393 mOrphans.remove( it.currentKey() );
394 break; 394 break;
395 } 395 }
396 } 396 }
397 } 397 }
398} 398}
399 399
400void Calendar::registerObserver( Observer *observer ) 400void Calendar::registerObserver( Observer *observer )
401{ 401{
402 mObserver = observer; 402 mObserver = observer;
403 mNewObserver = true; 403 mNewObserver = true;
404} 404}
405 405
406void Calendar::setModified( bool modified ) 406void Calendar::setModified( bool modified )
407{ 407{
408 if ( mObserver ) mObserver->calendarModified( modified, this ); 408 if ( mObserver ) mObserver->calendarModified( modified, this );
409 if ( modified != mModified || mNewObserver ) { 409 if ( modified != mModified || mNewObserver ) {
410 mNewObserver = false; 410 mNewObserver = false;
411 // if ( mObserver ) mObserver->calendarModified( modified, this ); 411 // if ( mObserver ) mObserver->calendarModified( modified, this );
412 mModified = modified; 412 mModified = modified;
413 } 413 }
414} 414}
415 415
416void Calendar::setLoadedProductId( const QString &id ) 416void Calendar::setLoadedProductId( const QString &id )
417{ 417{
418 mLoadedProductId = id; 418 mLoadedProductId = id;
419} 419}
420 420
421QString Calendar::loadedProductId() 421QString Calendar::loadedProductId()
422{ 422{
423 return mLoadedProductId; 423 return mLoadedProductId;
424} 424}
425 425
426#include "calendar.moc" 426//#include "calendar.moc"