summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-09 14:00:22 (UTC)
committer zautrix <zautrix>2005-04-09 14:00:22 (UTC)
commit16546abfab89df8dcf3168eaa7c0c346b8e400b4 (patch) (unidiff)
treec5bad46ec2ee88cb1f6b1035dbfe1e367ee0cb0e /korganizer
parentab7957df1a71a392d71cb898b59a35c32461ec6a (diff)
downloadkdepimpi-16546abfab89df8dcf3168eaa7c0c346b8e400b4.zip
kdepimpi-16546abfab89df8dcf3168eaa7c0c346b8e400b4.tar.gz
kdepimpi-16546abfab89df8dcf3168eaa7c0c346b8e400b4.tar.bz2
some fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneralevent.cpp31
-rw-r--r--korganizer/koeditorrecurrence.cpp6
-rw-r--r--korganizer/kotodoeditor.cpp1
-rw-r--r--korganizer/mainwindow.cpp3
4 files changed, 25 insertions, 16 deletions
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp
index 2a49528..d4aa78c 100644
--- a/korganizer/koeditorgeneralevent.cpp
+++ b/korganizer/koeditorgeneralevent.cpp
@@ -1,427 +1,434 @@
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 48
49KOEditorGeneralEvent::KOEditorGeneralEvent(QObject* parent, 49KOEditorGeneralEvent::KOEditorGeneralEvent(QObject* parent,
50 const char* name) : 50 const char* name) :
51 KOEditorGeneral( parent, name) 51 KOEditorGeneral( parent, name)
52{ 52{
53 mTemplate = false; 53 mTemplate = false;
54 connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), 54 connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
55 SLOT(setDuration())); 55 SLOT(setDuration()));
56 connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), 56 connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
57 SLOT(emitDateTimeStr())); 57 SLOT(emitDateTimeStr()));
58} 58}
59 59
60KOEditorGeneralEvent::~KOEditorGeneralEvent() 60KOEditorGeneralEvent::~KOEditorGeneralEvent()
61{ 61{
62} 62}
63 63
64void KOEditorGeneralEvent::finishSetup() 64void KOEditorGeneralEvent::finishSetup()
65{ 65{
66 66
67 //disabled 67 //disabled
68// QWidget::setTabOrder( mSummaryEdit, mLocationEdit ); 68// QWidget::setTabOrder( mSummaryEdit, mLocationEdit );
69// QWidget::setTabOrder( mLocationEdit, mStartDateEdit ); 69// QWidget::setTabOrder( mLocationEdit, mStartDateEdit );
70// QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit ); 70// QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit );
71// QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit ); 71// QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit );
72// QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit ); 72// QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit );
73// QWidget::setTabOrder( mEndTimeEdit, mNoTimeButton ); 73// QWidget::setTabOrder( mEndTimeEdit, mNoTimeButton );
74// QWidget::setTabOrder( mNoTimeButton, mAlarmButton ); 74// QWidget::setTabOrder( mNoTimeButton, mAlarmButton );
75// QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit ); 75// QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit );
76// QWidget::setTabOrder( mFreeTimeCombo, mCategoriesButton ); 76// QWidget::setTabOrder( mFreeTimeCombo, mCategoriesButton );
77// QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo ); 77// QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo );
78// QWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit ); 78// QWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit );
79 79
80 80
81 81
82 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); 82 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT);
83 mSummaryEdit->setFocus(); 83 mSummaryEdit->setFocus();
84} 84}
85 85
86void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout) 86void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout)
87{ 87{
88 QBoxLayout *timeLayout = new QVBoxLayout(topLayout); 88 QBoxLayout *timeLayout = new QVBoxLayout(topLayout);
89 89
90 QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, 90 QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal,
91 i18n("Date && Time"),parent); 91 i18n("Date && Time"),parent);
92 timeLayout->addWidget(timeGroupBox); 92 timeLayout->addWidget(timeGroupBox);
93 93
94 timeGroupBox->layout()->setSpacing( 0 ); 94 timeGroupBox->layout()->setSpacing( 0 );
95 timeGroupBox->layout()->setMargin( 5 ); 95 timeGroupBox->layout()->setMargin( 5 );
96 QFrame *timeBoxFrame = new QFrame(timeGroupBox); 96 QFrame *timeBoxFrame = new QFrame(timeGroupBox);
97 97
98 QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,2,3); 98 QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,2,3);
99 layoutTimeBox->setSpacing(topLayout->spacing()); 99 layoutTimeBox->setSpacing(topLayout->spacing());
100 100
101 mStartDateLabel = new QLabel(i18n("Start:"),timeBoxFrame); 101 mStartDateLabel = new QLabel(i18n("Start:"),timeBoxFrame);
102 layoutTimeBox->addWidget(mStartDateLabel,0,0); 102 layoutTimeBox->addWidget(mStartDateLabel,0,0);
103 103
104 mStartDateEdit = new KDateEdit(timeBoxFrame); 104 mStartDateEdit = new KDateEdit(timeBoxFrame);
105 layoutTimeBox->addWidget(mStartDateEdit,0,1); 105 layoutTimeBox->addWidget(mStartDateEdit,0,1);
106 106
107 mStartTimeEdit = new KOTimeEdit(timeBoxFrame); 107 mStartTimeEdit = new KOTimeEdit(timeBoxFrame);
108 layoutTimeBox->addWidget(mStartTimeEdit,0,2); 108 layoutTimeBox->addWidget(mStartTimeEdit,0,2);
109 109
110 110
111 mEndDateLabel = new QLabel(i18n("End:"),timeBoxFrame); 111 mEndDateLabel = new QLabel(i18n("End:"),timeBoxFrame);
112 layoutTimeBox->addWidget(mEndDateLabel,1,0); 112 layoutTimeBox->addWidget(mEndDateLabel,1,0);
113 113
114 mEndDateEdit = new KDateEdit(timeBoxFrame); 114 mEndDateEdit = new KDateEdit(timeBoxFrame);
115 layoutTimeBox->addWidget(mEndDateEdit,1,1); 115 layoutTimeBox->addWidget(mEndDateEdit,1,1);
116 116
117 mEndTimeEdit = new KOTimeEdit(timeBoxFrame); 117 mEndTimeEdit = new KOTimeEdit(timeBoxFrame);
118 layoutTimeBox->addWidget(mEndTimeEdit,1,2); 118 layoutTimeBox->addWidget(mEndTimeEdit,1,2);
119 QWidget* duration = new QWidget( timeBoxFrame ); 119 QWidget* duration = new QWidget( timeBoxFrame );
120 QHBoxLayout *flagsBox = new QHBoxLayout( duration ); 120 QHBoxLayout *flagsBox = new QHBoxLayout( duration );
121 mNoTimeButton = new QCheckBox(i18n("All day event"),duration); 121 mNoTimeButton = new QCheckBox(i18n("All day event"),duration);
122 flagsBox->addWidget(mNoTimeButton); 122 flagsBox->addWidget(mNoTimeButton);
123 connect(mNoTimeButton, SIGNAL(toggled(bool)),SLOT(dontAssociateTime(bool))); 123 connect(mNoTimeButton, SIGNAL(toggled(bool)),SLOT(dontAssociateTime(bool)));
124 mDurationLabel = new QLabel( duration ); 124 mDurationLabel = new QLabel( duration );
125 // if ( KOPrefs::instance()->mCompactDialogs ) { 125 // if ( KOPrefs::instance()->mCompactDialogs ) {
126 //layoutTimeBox->addMultiCellWidget( mDurationLabel, 3, 3, 0, 3 ); 126 //layoutTimeBox->addMultiCellWidget( mDurationLabel, 3, 3, 0, 3 );
127 //} else { 127 //} else {
128 flagsBox->addWidget( mDurationLabel ); 128 flagsBox->addWidget( mDurationLabel );
129 //} 129 //}
130 flagsBox->setStretchFactor(mDurationLabel, 10 ); 130 flagsBox->setStretchFactor(mDurationLabel, 10 );
131 mDurationLabel->setAlignment( AlignRight | AlignVCenter); 131 mDurationLabel->setAlignment( AlignRight | AlignVCenter);
132 layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 ); 132 layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 );
133 133
134 // time widgets are checked if they contain a valid time 134 // time widgets are checked if they contain a valid time
135 connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)), 135 connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)),
136 this, SLOT(startTimeChanged(QTime))); 136 this, SLOT(startTimeChanged(QTime)));
137 connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)), 137 connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)),
138 this, SLOT(endTimeChanged(QTime))); 138 this, SLOT(endTimeChanged(QTime)));
139 139
140 // date widgets are checked if they contain a valid date 140 // date widgets are checked if they contain a valid date
141 connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), 141 connect(mStartDateEdit, SIGNAL(dateChanged(QDate)),
142 this, SLOT(startDateChanged(QDate))); 142 this, SLOT(startDateChanged(QDate)));
143 connect(mEndDateEdit, SIGNAL(dateChanged(QDate)), 143 connect(mEndDateEdit, SIGNAL(dateChanged(QDate)),
144 this, SLOT(endDateChanged(QDate))); 144 this, SLOT(endDateChanged(QDate)));
145} 145}
146 146
147void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout) 147void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout)
148{ 148{
149 QBoxLayout *classLayout = new QHBoxLayout(topLayout); 149 QBoxLayout *classLayout = new QHBoxLayout(topLayout);
150 150
151 QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent); 151 QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent);
152 classLayout->addWidget(freeTimeLabel); 152 classLayout->addWidget(freeTimeLabel);
153 153
154 mFreeTimeCombo = new QComboBox(false, parent); 154 mFreeTimeCombo = new QComboBox(false, parent);
155 mFreeTimeCombo->insertItem(i18n("Busy")); 155 mFreeTimeCombo->insertItem(i18n("Busy"));
156 mFreeTimeCombo->insertItem(i18n("Free")); 156 mFreeTimeCombo->insertItem(i18n("Free"));
157 classLayout->addWidget(mFreeTimeCombo); 157 classLayout->addWidget(mFreeTimeCombo);
158} 158}
159 159
160void KOEditorGeneralEvent::timeStuffDisable(bool disable) 160void KOEditorGeneralEvent::timeStuffDisable(bool disable)
161{ 161{
162 mStartTimeEdit->setEnabled( !disable ); 162 mStartTimeEdit->setEnabled( !disable );
163 mEndTimeEdit->setEnabled( !disable ); 163 mEndTimeEdit->setEnabled( !disable );
164 164
165 setDuration(); 165 setDuration();
166 emitDateTimeStr(); 166 emitDateTimeStr();
167} 167}
168 168
169void KOEditorGeneralEvent::dontAssociateTime(bool noTime) 169void KOEditorGeneralEvent::dontAssociateTime(bool noTime)
170{ 170{
171 timeStuffDisable(noTime); 171 timeStuffDisable(noTime);
172 //if(alarmButton->isChecked()) alarmStuffDisable(noTime); 172 //if(alarmButton->isChecked()) alarmStuffDisable(noTime);
173 allDayChanged(noTime); 173 allDayChanged(noTime);
174} 174}
175 175
176void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end) 176void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end)
177{ 177{
178// kdDebug() << "KOEditorGeneralEvent::setDateTimes(): Start DateTime: " << start.toString() << endl; 178// kdDebug() << "KOEditorGeneralEvent::setDateTimes(): Start DateTime: " << start.toString() << endl;
179 if ( !mTemplate ) 179 if ( !mTemplate )
180 mStartDateEdit->setDate(start.date()); 180 mStartDateEdit->setDate(start.date());
181 // KTimeEdit seems to emit some signals when setTime() is called. 181 // KTimeEdit seems to emit some signals when setTime() is called.
182 mStartTimeEdit->blockSignals( true ); 182 mStartTimeEdit->blockSignals( true );
183 mStartTimeEdit->setTime(start.time()); 183 mStartTimeEdit->setTime(start.time());
184 mStartTimeEdit->blockSignals( false ); 184 mStartTimeEdit->blockSignals( false );
185 if ( !mTemplate ) 185 if ( !mTemplate )
186 mEndDateEdit->setDate(end.date()); 186 mEndDateEdit->setDate(end.date());
187 mEndTimeEdit->setTime(end.time()); 187 mEndTimeEdit->setTime(end.time());
188 188
189 mCurrStartDateTime = start; 189 mCurrStartDateTime = start;
190 mCurrEndDateTime = end; 190 mCurrEndDateTime = end;
191 191
192 setDuration(); 192 setDuration();
193 emitDateTimeStr(); 193 emitDateTimeStr();
194} 194}
195 195
196void KOEditorGeneralEvent::startTimeChanged(QTime newtime) 196void KOEditorGeneralEvent::startTimeChanged(QTime newtime)
197{ 197{
198 kdDebug() << "KOEditorGeneralEvent::startTimeChanged() " << newtime.toString() << endl; 198 kdDebug() << "KOEditorGeneralEvent::startTimeChanged() " << newtime.toString() << endl;
199 199
200 int secsep = mCurrStartDateTime.secsTo(mCurrEndDateTime); 200 int secsep = mCurrStartDateTime.secsTo(mCurrEndDateTime);
201 201
202 mCurrStartDateTime.setTime(newtime); 202 mCurrStartDateTime.setTime(newtime);
203 203
204 // adjust end time so that the event has the same duration as before. 204 // adjust end time so that the event has the same duration as before.
205 mCurrEndDateTime = mCurrStartDateTime.addSecs(secsep); 205 mCurrEndDateTime = mCurrStartDateTime.addSecs(secsep);
206 mEndTimeEdit->setTime(mCurrEndDateTime.time()); 206 mEndTimeEdit->setTime(mCurrEndDateTime.time());
207 mEndDateEdit->setDate(mCurrEndDateTime.date()); 207 mEndDateEdit->setDate(mCurrEndDateTime.date());
208 208
209 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); 209 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
210} 210}
211 211
212void KOEditorGeneralEvent::endTimeChanged(QTime newtime) 212void KOEditorGeneralEvent::endTimeChanged(QTime newtime)
213{ 213{
214// kdDebug() << "KOEditorGeneralEvent::endTimeChanged " << newtime.toString() << endl; 214// kdDebug() << "KOEditorGeneralEvent::endTimeChanged " << newtime.toString() << endl;
215 215
216 QDateTime newdt(mCurrEndDateTime.date(), newtime); 216 QDateTime newdt(mCurrEndDateTime.date(), newtime);
217 mCurrEndDateTime = newdt; 217 mCurrEndDateTime = newdt;
218 218
219 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); 219 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
220} 220}
221 221
222void KOEditorGeneralEvent::startDateChanged(QDate newdate) 222void KOEditorGeneralEvent::startDateChanged(QDate newdate)
223{ 223{
224 int daysep = mCurrStartDateTime.daysTo(mCurrEndDateTime); 224 int daysep = mCurrStartDateTime.daysTo(mCurrEndDateTime);
225 225
226 mCurrStartDateTime.setDate(newdate); 226 mCurrStartDateTime.setDate(newdate);
227 227
228 // adjust end date so that the event has the same duration as before 228 // adjust end date so that the event has the same duration as before
229 mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep)); 229 mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep));
230 mEndDateEdit->setDate(mCurrEndDateTime.date()); 230 mEndDateEdit->setDate(mCurrEndDateTime.date());
231 231
232 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); 232 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
233} 233}
234 234
235void KOEditorGeneralEvent::endDateChanged(QDate newdate) 235void KOEditorGeneralEvent::endDateChanged(QDate newdate)
236{ 236{
237 QDateTime newdt(newdate, mCurrEndDateTime.time()); 237 QDateTime newdt(newdate, mCurrEndDateTime.time());
238 238
239 if(newdt < mCurrStartDateTime) { 239 if(newdt < mCurrStartDateTime) {
240 // oops, we can't let that happen. 240 // oops, we can't let that happen.
241 newdt = mCurrStartDateTime; 241 newdt = mCurrStartDateTime;
242 mEndDateEdit->setDate(newdt.date()); 242 mEndDateEdit->setDate(newdt.date());
243 mEndTimeEdit->setTime(newdt.time()); 243 mEndTimeEdit->setTime(newdt.time());
244 } 244 }
245 mCurrEndDateTime = newdt; 245 mCurrEndDateTime = newdt;
246 246
247 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); 247 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
248} 248}
249 249
250void KOEditorGeneralEvent::setDefaults(QDateTime from,QDateTime to,bool allDay) 250void KOEditorGeneralEvent::setDefaults(QDateTime from,QDateTime to,bool allDay)
251{ 251{
252 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); 252 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT);
253 mLocationEdit->load(KOLocationBox::LOCATION); 253 mLocationEdit->load(KOLocationBox::LOCATION);
254 KOEditorGeneral::setDefaults(allDay); 254 KOEditorGeneral::setDefaults(allDay);
255 255
256 mNoTimeButton->setChecked(allDay); 256 mNoTimeButton->setChecked(allDay);
257 timeStuffDisable(allDay); 257 timeStuffDisable(allDay);
258 mFreeTimeCombo->setCurrentItem( 0 ); 258 mFreeTimeCombo->setCurrentItem( 0 );
259 setDateTimes(from,to); 259 setDateTimes(from,to);
260} 260}
261 261
262void KOEditorGeneralEvent::readEvent( Event *event, bool tmpl ) 262void KOEditorGeneralEvent::readEvent( Event *event, bool tmpl )
263{ 263{
264 QString tmpStr; 264 QString tmpStr;
265 265
266 mTemplate = tmpl; 266 mTemplate = tmpl;
267 // the rest is for the events only 267 // the rest is for the events only
268 mNoTimeButton->setChecked(event->doesFloat()); 268 mNoTimeButton->setChecked(event->doesFloat());
269 timeStuffDisable(event->doesFloat()); 269 timeStuffDisable(event->doesFloat());
270 270
271 setDateTimes(event->dtStart(),event->dtEnd()); 271 setDateTimes(event->dtStart(),event->dtEnd());
272 272
273 mTemplate = false; 273 mTemplate = false;
274 switch( event->transparency() ) { 274 switch( event->transparency() ) {
275 case Event::Transparent: 275 case Event::Transparent:
276 mFreeTimeCombo->setCurrentItem(1); 276 mFreeTimeCombo->setCurrentItem(1);
277 break; 277 break;
278 case Event::Opaque: 278 case Event::Opaque:
279 mFreeTimeCombo->setCurrentItem(0); 279 mFreeTimeCombo->setCurrentItem(0);
280 break; 280 break;
281 } 281 }
282 282
283 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); 283 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT);
284 mLocationEdit->load(KOLocationBox::LOCATION); 284 mLocationEdit->load(KOLocationBox::LOCATION);
285 readIncidence(event); 285 readIncidence(event);
286} 286}
287 287
288void KOEditorGeneralEvent::writeEvent(Event *event) 288void KOEditorGeneralEvent::writeEvent(Event *event)
289{ 289{
290// kdDebug() << "KOEditorGeneralEvent::writeEvent()" << endl; 290// kdDebug() << "KOEditorGeneralEvent::writeEvent()" << endl;
291 291
292 writeIncidence(event); 292 writeIncidence(event);
293 293
294 QDate tmpDate; 294 QDate tmpDate;
295 QTime tmpTime; 295 QTime tmpTime;
296 QDateTime tmpDT; 296 QDateTime tmpDT;
297 297
298 // temp. until something better happens. 298 // temp. until something better happens.
299 QString tmpStr; 299 QString tmpStr;
300 300
301 if (mNoTimeButton->isChecked()) { 301 if (mNoTimeButton->isChecked()) {
302 event->setFloats(true); 302 event->setFloats(true);
303 // need to change this. 303 // need to change this.
304 tmpDate = mStartDateEdit->date(); 304 tmpDate = mStartDateEdit->date();
305 tmpTime.setHMS(0,0,0); 305 tmpTime.setHMS(0,0,0);
306 tmpDT.setDate(tmpDate); 306 tmpDT.setDate(tmpDate);
307 tmpDT.setTime(tmpTime); 307 tmpDT.setTime(tmpTime);
308 event->setDtStart(tmpDT); 308 event->setDtStart(tmpDT);
309 309
310 tmpDate = mEndDateEdit->date(); 310 tmpDate = mEndDateEdit->date();
311 tmpTime.setHMS(0,0,0); 311 tmpTime.setHMS(0,0,0);
312 tmpDT.setDate(tmpDate); 312 tmpDT.setDate(tmpDate);
313 tmpDT.setTime(tmpTime); 313 tmpDT.setTime(tmpTime);
314 event->setDtEnd(tmpDT); 314 event->setDtEnd(tmpDT);
315 } else { 315 } else {
316 event->setFloats(false); 316 event->setFloats(false);
317 317
318 // set date/time end 318 // set date/time end
319 tmpDate = mEndDateEdit->date(); 319 tmpDate = mEndDateEdit->date();
320 tmpTime = mEndTimeEdit->getTime(); 320 tmpTime = mEndTimeEdit->getTime();
321 tmpDT.setDate(tmpDate); 321 tmpDT.setDate(tmpDate);
322 tmpDT.setTime(tmpTime); 322 tmpDT.setTime(tmpTime);
323 event->setDtEnd(tmpDT); 323 event->setDtEnd(tmpDT);
324 324
325 // set date/time start 325 // set date/time start
326 tmpDate = mStartDateEdit->date(); 326 tmpDate = mStartDateEdit->date();
327 tmpTime = mStartTimeEdit->getTime(); 327 tmpTime = mStartTimeEdit->getTime();
328 tmpDT.setDate(tmpDate); 328 tmpDT.setDate(tmpDate);
329 tmpDT.setTime(tmpTime); 329 tmpDT.setTime(tmpTime);
330 event->setDtStart(tmpDT); 330 event->setDtStart(tmpDT);
331 } // check for float 331 } // check for float
332 mSummaryEdit->save(KOLocationBox::SUMMARYEVENT); 332 mSummaryEdit->save(KOLocationBox::SUMMARYEVENT);
333 333
334 event->setTransparency(mFreeTimeCombo->currentItem() > 0 334 event->setTransparency(mFreeTimeCombo->currentItem() > 0
335 ? KCal::Event::Transparent 335 ? KCal::Event::Transparent
336 : KCal::Event::Opaque); 336 : KCal::Event::Opaque);
337 337
338// kdDebug() << "KOEditorGeneralEvent::writeEvent() done" << endl; 338// kdDebug() << "KOEditorGeneralEvent::writeEvent() done" << endl;
339} 339}
340 340
341void KOEditorGeneralEvent::setDuration() 341void KOEditorGeneralEvent::setDuration()
342{ 342{
343 QString tmpStr = "", catStr; 343 QString tmpStr = "", catStr;
344 int hourdiff, minutediff; 344 int hourdiff, minutediff;
345 // end<date is an accepted temporary state while typing, but don't show 345 // end<date is an accepted temporary state while typing, but don't show
346 // any duration if this happens 346 // any duration if this happens
347 if(mCurrEndDateTime >= mCurrStartDateTime) { 347 if(mCurrEndDateTime >= mCurrStartDateTime) {
348 348
349 if (mNoTimeButton->isChecked()) { 349 if (mNoTimeButton->isChecked()) {
350 int daydiff = mCurrStartDateTime.date().daysTo(mCurrEndDateTime.date()) + 1; 350 int daydiff = mCurrStartDateTime.date().daysTo(mCurrEndDateTime.date()) + 1;
351 tmpStr = i18n("Duration: "); 351 tmpStr = i18n("Duration: ");
352 tmpStr.append(i18n("1 Day","%n Days",daydiff)); 352 tmpStr.append(i18n("1 Day","%n Days",daydiff));
353 } else { 353 } else {
354 int secto = mCurrStartDateTime.secsTo( mCurrEndDateTime ); 354 int secto = mCurrStartDateTime.secsTo( mCurrEndDateTime );
355 hourdiff = secto / 3600; 355 hourdiff = secto / 3600;
356 minutediff = (secto/60 ) % 60; 356 minutediff = (secto/60 ) % 60;
357 if (hourdiff || minutediff){ 357 if (hourdiff || minutediff){
358 tmpStr = i18n("Duration: "); 358 tmpStr = i18n("Duration: ");
359 if (hourdiff){ 359 if (hourdiff){
360 catStr = i18n("1 h","%n h",hourdiff); 360 catStr = i18n("1 h","%n h",hourdiff);
361 tmpStr.append(catStr); 361 tmpStr.append(catStr);
362 } 362 }
363 if (hourdiff && minutediff){ 363 if (hourdiff && minutediff){
364 tmpStr += i18n(", "); 364 tmpStr += i18n(", ");
365 } 365 }
366 if (minutediff){ 366 if (minutediff){
367 catStr = i18n("1 min","%n min",minutediff); 367 catStr = i18n("1 min","%n min",minutediff);
368 tmpStr += catStr; 368 tmpStr += catStr;
369 } 369 }
370 } else tmpStr = ""; 370 } else tmpStr = "";
371 } 371 }
372 } 372 }
373 mDurationLabel->setText(tmpStr); 373 mDurationLabel->setText(tmpStr);
374} 374}
375 375
376void KOEditorGeneralEvent::emitDateTimeStr() 376void KOEditorGeneralEvent::emitDateTimeStr()
377{ 377{
378 KLocale *l = KGlobal::locale(); 378 KLocale *l = KGlobal::locale();
379 379 QString startString = "";
380 QString from,to; 380 if ( mCurrStartDateTime.date() < mCurrEndDateTime.date() ) {
381 if (mNoTimeButton->isChecked()) { 381 if ( mNoTimeButton->isChecked() ) {
382 from = l->formatDate(mCurrStartDateTime.date()); 382 startString = i18n("From: ") + l->formatDate(mCurrStartDateTime.date() );
383 to = l->formatDate(mCurrEndDateTime.date()); 383 startString += "\n"+i18n("To: ")+ l->formatDate(mCurrEndDateTime.date());
384
385 } else {
386 startString = i18n("From: ") +l->formatDateTime(mCurrStartDateTime, false);
387 startString += "\n"+i18n("To: ")+l->formatDateTime(mCurrEndDateTime, false);
388 }
384 } else { 389 } else {
385 from = l->formatDateTime(mCurrStartDateTime); 390 if ( mNoTimeButton->isChecked() ) {
386 to = l->formatDateTime(mCurrEndDateTime); 391 startString = i18n("On: ") + l->formatDate(mCurrStartDateTime.date() );
392 } else {
393 startString = i18n("From: ") + KGlobal::locale()->formatTime(mCurrStartDateTime.time())+
394 "-"+KGlobal::locale()->formatTime(mCurrEndDateTime.time());
395 startString += i18n(" on ")+KGlobal::locale()->formatDate( mCurrStartDateTime.date(), true);
396 }
387 } 397 }
388 398 startString +="\n"+mDurationLabel->text();
389 QString str = i18n("From: %1 To: %2 %3").arg(from).arg(to) 399 emit dateTimeStrChanged(startString);
390 .arg(mDurationLabel->text());
391
392 emit dateTimeStrChanged(str);
393} 400}
394 401
395bool KOEditorGeneralEvent::validateInput() 402bool KOEditorGeneralEvent::validateInput()
396{ 403{
397 404
398 if (!mStartDateEdit->inputIsValid()) { 405 if (!mStartDateEdit->inputIsValid()) {
399 KMessageBox::sorry( 0, 406 KMessageBox::sorry( 0,
400 i18n("Please specify a valid start date,\nfor example '%1'.") 407 i18n("Please specify a valid start date,\nfor example '%1'.")
401 .arg( KGlobal::locale()->formatDate( QDate::currentDate(), true ) ) ); 408 .arg( KGlobal::locale()->formatDate( QDate::currentDate(), true ) ) );
402 return false; 409 return false;
403 } 410 }
404 411
405 if (!mEndDateEdit->inputIsValid()) { 412 if (!mEndDateEdit->inputIsValid()) {
406 KMessageBox::sorry( 0, 413 KMessageBox::sorry( 0,
407 i18n("Please specify a valid end date,\nfor example '%1'.") 414 i18n("Please specify a valid end date,\nfor example '%1'.")
408 .arg( KGlobal::locale()->formatDate( QDate::currentDate(), true ) ) ); 415 .arg( KGlobal::locale()->formatDate( QDate::currentDate(), true ) ) );
409 return false; 416 return false;
410 } 417 }
411 418
412 QDateTime startDt,endDt; 419 QDateTime startDt,endDt;
413 startDt.setDate(mStartDateEdit->date()); 420 startDt.setDate(mStartDateEdit->date());
414 endDt.setDate(mEndDateEdit->date()); 421 endDt.setDate(mEndDateEdit->date());
415 if (!mNoTimeButton->isChecked()) { 422 if (!mNoTimeButton->isChecked()) {
416 startDt.setTime(mStartTimeEdit->getTime()); 423 startDt.setTime(mStartTimeEdit->getTime());
417 endDt.setTime(mEndTimeEdit->getTime()); 424 endDt.setTime(mEndTimeEdit->getTime());
418 } 425 }
419 426
420 if (startDt > endDt) { 427 if (startDt > endDt) {
421 KMessageBox::sorry(0,i18n("The event ends before it starts.\n" 428 KMessageBox::sorry(0,i18n("The event ends before it starts.\n"
422 "Please correct dates and times.")); 429 "Please correct dates and times."));
423 return false; 430 return false;
424 } 431 }
425 432
426 return KOEditorGeneral::validateInput(); 433 return KOEditorGeneral::validateInput();
427} 434}
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index bf81b01..01c5773 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -1,1108 +1,1108 @@
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#include <libkcal/todo.h> 45#include <libkcal/todo.h>
46 46
47#include <libkdepim/kdateedit.h> 47#include <libkdepim/kdateedit.h>
48 48
49#include "koprefs.h" 49#include "koprefs.h"
50 50
51#include "koeditorrecurrence.h" 51#include "koeditorrecurrence.h"
52 52
53/////////////////////////// RecurBase /////////////////////////////// 53/////////////////////////// RecurBase ///////////////////////////////
54 54
55RecurBase::RecurBase( QWidget *parent, const char *name ) : 55RecurBase::RecurBase( QWidget *parent, const char *name ) :
56 QWidget( parent, name ) 56 QWidget( parent, name )
57{ 57{
58 mFrequencyEdit = new QSpinBox( 1, 9999, 1, this ); 58 mFrequencyEdit = new QSpinBox( 1, 9999, 1, this );
59 mFrequencyEdit->setValue( 1 ); 59 mFrequencyEdit->setValue( 1 );
60} 60}
61 61
62QWidget *RecurBase::frequencyEdit() 62QWidget *RecurBase::frequencyEdit()
63{ 63{
64 return mFrequencyEdit; 64 return mFrequencyEdit;
65} 65}
66 66
67void RecurBase::setFrequency( int f ) 67void RecurBase::setFrequency( int f )
68{ 68{
69 if ( f < 1 ) f = 1; 69 if ( f < 1 ) f = 1;
70 70
71 mFrequencyEdit->setValue( f ); 71 mFrequencyEdit->setValue( f );
72} 72}
73 73
74int RecurBase::frequency() 74int RecurBase::frequency()
75{ 75{
76 return mFrequencyEdit->value(); 76 return mFrequencyEdit->value();
77} 77}
78 78
79/////////////////////////// RecurDaily /////////////////////////////// 79/////////////////////////// RecurDaily ///////////////////////////////
80 80
81RecurDaily::RecurDaily( QWidget *parent, const char *name ) : 81RecurDaily::RecurDaily( QWidget *parent, const char *name ) :
82 RecurBase( parent, name ) 82 RecurBase( parent, name )
83{ 83{
84 QBoxLayout *topLayout = new QHBoxLayout( this ); 84 QBoxLayout *topLayout = new QHBoxLayout( this );
85 topLayout->setSpacing( KDialog::spacingHint() ); 85 topLayout->setSpacing( KDialog::spacingHint() );
86 topLayout->setMargin( KDialog::marginHintSmall() ); 86 topLayout->setMargin( KDialog::marginHintSmall() );
87 87
88 QLabel *preLabel = new QLabel( i18n("Recur every"), this ); 88 QLabel *preLabel = new QLabel( i18n("Recur every"), this );
89 topLayout->addWidget( preLabel ); 89 topLayout->addWidget( preLabel );
90 90
91 topLayout->addWidget( frequencyEdit() ); 91 topLayout->addWidget( frequencyEdit() );
92 92
93 QLabel *postLabel = new QLabel( i18n("day(s)"), this ); 93 QLabel *postLabel = new QLabel( i18n("day(s)"), this );
94 topLayout->addWidget( postLabel ); 94 topLayout->addWidget( postLabel );
95} 95}
96 96
97 97
98/////////////////////////// RecurWeekly /////////////////////////////// 98/////////////////////////// RecurWeekly ///////////////////////////////
99 99
100RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) : 100RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) :
101 RecurBase( parent, name ) 101 RecurBase( parent, name )
102{ 102{
103 QBoxLayout *topLayout = new QVBoxLayout( this ); 103 QBoxLayout *topLayout = new QVBoxLayout( this );
104 topLayout->setSpacing( KDialog::spacingHint() ); 104 topLayout->setSpacing( KDialog::spacingHint() );
105 topLayout->setMargin( KDialog::marginHintSmall() ); 105 topLayout->setMargin( KDialog::marginHintSmall() );
106 106
107 //topLayout->addStretch( 1 ); 107 //topLayout->addStretch( 1 );
108 108
109 QBoxLayout *weeksLayout = new QHBoxLayout( topLayout ); 109 QBoxLayout *weeksLayout = new QHBoxLayout( topLayout );
110 110
111 QLabel *preLabel = new QLabel( i18n("Recur every"), this ); 111 QLabel *preLabel = new QLabel( i18n("Recur every"), this );
112 weeksLayout->addWidget( preLabel ); 112 weeksLayout->addWidget( preLabel );
113 113
114 weeksLayout->addWidget( frequencyEdit() ); 114 weeksLayout->addWidget( frequencyEdit() );
115 115
116 QLabel *postLabel = new QLabel( i18n("week(s) on:"), this ); 116 QLabel *postLabel = new QLabel( i18n("week(s) on:"), this );
117 weeksLayout->addWidget( postLabel ); 117 weeksLayout->addWidget( postLabel );
118 118
119 QHBox *dayBox = new QHBox( this ); 119 QHBox *dayBox = new QHBox( this );
120 topLayout->addWidget( dayBox, 1, AlignVCenter ); 120 topLayout->addWidget( dayBox, 1, AlignVCenter );
121 // TODO: Respect start of week setting 121 // TODO: Respect start of week setting
122 for ( int i = 0; i < 7; ++i ) { 122 for ( int i = 0; i < 7; ++i ) {
123 QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true ); 123 QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true );
124 int left = 1; 124 int left = 1;
125 if ( QApplication::desktop()->width() > 480 ) { 125 if ( QApplication::desktop()->width() > 480 ) {
126 ++left; 126 ++left;
127 if ( QApplication::desktop()->width() > 640 ) 127 if ( QApplication::desktop()->width() > 640 )
128 ++left; 128 ++left;
129 } 129 }
130 mDayBoxes[ i ] = new QCheckBox( weekDayName.left( left ), dayBox ); 130 mDayBoxes[ i ] = new QCheckBox( weekDayName.left( left ), dayBox );
131 } 131 }
132 132
133 topLayout->addStretch( ); 133 topLayout->addStretch( );
134} 134}
135 135
136void RecurWeekly::setDays( const QBitArray &days ) 136void RecurWeekly::setDays( const QBitArray &days )
137{ 137{
138 for ( int i = 0; i < 7; ++i ) { 138 for ( int i = 0; i < 7; ++i ) {
139 mDayBoxes[ i ]->setChecked( days.testBit( i ) ); 139 mDayBoxes[ i ]->setChecked( days.testBit( i ) );
140 } 140 }
141} 141}
142 142
143QBitArray RecurWeekly::days() 143QBitArray RecurWeekly::days()
144{ 144{
145 QBitArray days( 7 ); 145 QBitArray days( 7 );
146 146
147 for ( int i = 0; i < 7; ++i ) { 147 for ( int i = 0; i < 7; ++i ) {
148 days.setBit( i, mDayBoxes[ i ]->isChecked() ); 148 days.setBit( i, mDayBoxes[ i ]->isChecked() );
149 } 149 }
150 150
151 return days; 151 return days;
152} 152}
153 153
154/////////////////////////// RecurMonthly /////////////////////////////// 154/////////////////////////// RecurMonthly ///////////////////////////////
155 155
156RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) : 156RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) :
157 RecurBase( parent, name ) 157 RecurBase( parent, name )
158{ 158{
159 QBoxLayout *topLayout = new QVBoxLayout( this ); 159 QBoxLayout *topLayout = new QVBoxLayout( this );
160 topLayout->setSpacing( KDialog::spacingHint() ); 160 topLayout->setSpacing( KDialog::spacingHint() );
161 topLayout->setMargin( KDialog::marginHintSmall() ); 161 topLayout->setMargin( KDialog::marginHintSmall() );
162 162
163 163
164 QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); 164 QBoxLayout *freqLayout = new QHBoxLayout( topLayout );
165 165
166 QLabel *preLabel = new QLabel( i18n("every"), this ); 166 QLabel *preLabel = new QLabel( i18n("every"), this );
167 freqLayout->addWidget( preLabel ); 167 freqLayout->addWidget( preLabel );
168 168
169 freqLayout->addWidget( frequencyEdit() ); 169 freqLayout->addWidget( frequencyEdit() );
170 170
171 QLabel *postLabel = new QLabel( i18n("month(s)"), this ); 171 QLabel *postLabel = new QLabel( i18n("month(s)"), this );
172 freqLayout->addWidget( postLabel ); 172 freqLayout->addWidget( postLabel );
173 173
174 174
175 QButtonGroup *buttonGroup = new QButtonGroup( this ); 175 QButtonGroup *buttonGroup = new QButtonGroup( this );
176 buttonGroup->setFrameStyle( QFrame::NoFrame ); 176 buttonGroup->setFrameStyle( QFrame::NoFrame );
177 topLayout->addWidget( buttonGroup, 1, AlignVCenter ); 177 topLayout->addWidget( buttonGroup, 1, AlignVCenter );
178 178
179 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 ); 179 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 );
180 buttonLayout->setSpacing( KDialog::spacingHint() ); 180 buttonLayout->setSpacing( KDialog::spacingHint() );
181 buttonLayout->setMargin( KDialog::marginHintSmall() ); 181 buttonLayout->setMargin( KDialog::marginHintSmall() );
182 182
183 183
184 QString recurOnText; 184 QString recurOnText;
185 if ( QApplication::desktop()->width() > 320 ) { 185 if ( QApplication::desktop()->width() > 320 ) {
186 recurOnText = i18n("Recur on the"); 186 recurOnText = i18n("Recur on the");
187 } 187 }
188 188
189 mByDayRadio = new QRadioButton( recurOnText, buttonGroup ); 189 mByDayRadio = new QRadioButton( recurOnText, buttonGroup );
190 buttonLayout->addWidget( mByDayRadio, 0, 0 ); 190 buttonLayout->addWidget( mByDayRadio, 0, 0 );
191 191
192 mByDayCombo = new QComboBox( buttonGroup ); 192 mByDayCombo = new QComboBox( buttonGroup );
193 mByDayCombo->setSizeLimit( 7 ); 193 mByDayCombo->setSizeLimit( 7 );
194 mByDayCombo->insertItem( i18n("1st") ); 194 mByDayCombo->insertItem( i18n("1st") );
195 mByDayCombo->insertItem( i18n("2nd") ); 195 mByDayCombo->insertItem( i18n("2nd") );
196 mByDayCombo->insertItem( i18n("3rd") ); 196 mByDayCombo->insertItem( i18n("3rd") );
197 mByDayCombo->insertItem( i18n("4th") ); 197 mByDayCombo->insertItem( i18n("4th") );
198 mByDayCombo->insertItem( i18n("5th") ); 198 mByDayCombo->insertItem( i18n("5th") );
199 mByDayCombo->insertItem( i18n("6th") ); 199 mByDayCombo->insertItem( i18n("6th") );
200 mByDayCombo->insertItem( i18n("7th") ); 200 mByDayCombo->insertItem( i18n("7th") );
201 mByDayCombo->insertItem( i18n("8th") ); 201 mByDayCombo->insertItem( i18n("8th") );
202 mByDayCombo->insertItem( i18n("9th") ); 202 mByDayCombo->insertItem( i18n("9th") );
203 mByDayCombo->insertItem( i18n("10th") ); 203 mByDayCombo->insertItem( i18n("10th") );
204 mByDayCombo->insertItem( i18n("11th") ); 204 mByDayCombo->insertItem( i18n("11th") );
205 mByDayCombo->insertItem( i18n("12th") ); 205 mByDayCombo->insertItem( i18n("12th") );
206 mByDayCombo->insertItem( i18n("13th") ); 206 mByDayCombo->insertItem( i18n("13th") );
207 mByDayCombo->insertItem( i18n("14th") ); 207 mByDayCombo->insertItem( i18n("14th") );
208 mByDayCombo->insertItem( i18n("15th") ); 208 mByDayCombo->insertItem( i18n("15th") );
209 mByDayCombo->insertItem( i18n("16th") ); 209 mByDayCombo->insertItem( i18n("16th") );
210 mByDayCombo->insertItem( i18n("17th") ); 210 mByDayCombo->insertItem( i18n("17th") );
211 mByDayCombo->insertItem( i18n("18th") ); 211 mByDayCombo->insertItem( i18n("18th") );
212 mByDayCombo->insertItem( i18n("19th") ); 212 mByDayCombo->insertItem( i18n("19th") );
213 mByDayCombo->insertItem( i18n("20th") ); 213 mByDayCombo->insertItem( i18n("20th") );
214 mByDayCombo->insertItem( i18n("21st") ); 214 mByDayCombo->insertItem( i18n("21st") );
215 mByDayCombo->insertItem( i18n("22nd") ); 215 mByDayCombo->insertItem( i18n("22nd") );
216 mByDayCombo->insertItem( i18n("23rd") ); 216 mByDayCombo->insertItem( i18n("23rd") );
217 mByDayCombo->insertItem( i18n("24th") ); 217 mByDayCombo->insertItem( i18n("24th") );
218 mByDayCombo->insertItem( i18n("25th") ); 218 mByDayCombo->insertItem( i18n("25th") );
219 mByDayCombo->insertItem( i18n("26th") ); 219 mByDayCombo->insertItem( i18n("26th") );
220 mByDayCombo->insertItem( i18n("27th") ); 220 mByDayCombo->insertItem( i18n("27th") );
221 mByDayCombo->insertItem( i18n("28th") ); 221 mByDayCombo->insertItem( i18n("28th") );
222 mByDayCombo->insertItem( i18n("29th") ); 222 mByDayCombo->insertItem( i18n("29th") );
223 mByDayCombo->insertItem( i18n("30th") ); 223 mByDayCombo->insertItem( i18n("30th") );
224 mByDayCombo->insertItem( i18n("31st") ); 224 mByDayCombo->insertItem( i18n("31st") );
225 buttonLayout->addWidget( mByDayCombo, 0, 1 ); 225 buttonLayout->addWidget( mByDayCombo, 0, 1 );
226 226
227 QLabel *byDayLabel = new QLabel( i18n("day"), buttonGroup ); 227 QLabel *byDayLabel = new QLabel( i18n("day"), buttonGroup );
228 buttonLayout->addWidget( byDayLabel, 0, 2 ); 228 buttonLayout->addWidget( byDayLabel, 0, 2 );
229 229
230 230
231 mByPosRadio = new QRadioButton( recurOnText, buttonGroup); 231 mByPosRadio = new QRadioButton( recurOnText, buttonGroup);
232 buttonLayout->addWidget( mByPosRadio, 1, 0 ); 232 buttonLayout->addWidget( mByPosRadio, 1, 0 );
233 233
234 mByPosCountCombo = new QComboBox( buttonGroup ); 234 mByPosCountCombo = new QComboBox( buttonGroup );
235 mByPosCountCombo->insertItem( i18n("1st") ); 235 mByPosCountCombo->insertItem( i18n("1st") );
236 mByPosCountCombo->insertItem( i18n("2nd") ); 236 mByPosCountCombo->insertItem( i18n("2nd") );
237 mByPosCountCombo->insertItem( i18n("3rd") ); 237 mByPosCountCombo->insertItem( i18n("3rd") );
238 mByPosCountCombo->insertItem( i18n("4th") ); 238 mByPosCountCombo->insertItem( i18n("4th") );
239 mByPosCountCombo->insertItem( i18n("5th") ); 239 mByPosCountCombo->insertItem( i18n("5th") );
240 buttonLayout->addWidget( mByPosCountCombo, 1, 1 ); 240 buttonLayout->addWidget( mByPosCountCombo, 1, 1 );
241 241
242 mByPosWeekdayCombo = new QComboBox( buttonGroup ); 242 mByPosWeekdayCombo = new QComboBox( buttonGroup );
243 mByPosWeekdayCombo->insertItem( i18n("Monday") ); 243 mByPosWeekdayCombo->insertItem( i18n("Monday") );
244 mByPosWeekdayCombo->insertItem( i18n("Tuesday") ); 244 mByPosWeekdayCombo->insertItem( i18n("Tuesday") );
245 mByPosWeekdayCombo->insertItem( i18n("Wednesday") ); 245 mByPosWeekdayCombo->insertItem( i18n("Wednesday") );
246 mByPosWeekdayCombo->insertItem( i18n("Thursday") ); 246 mByPosWeekdayCombo->insertItem( i18n("Thursday") );
247 mByPosWeekdayCombo->insertItem( i18n("Friday") ); 247 mByPosWeekdayCombo->insertItem( i18n("Friday") );
248 mByPosWeekdayCombo->insertItem( i18n("Saturday") ); 248 mByPosWeekdayCombo->insertItem( i18n("Saturday") );
249 mByPosWeekdayCombo->insertItem( i18n("Sunday") ); 249 mByPosWeekdayCombo->insertItem( i18n("Sunday") );
250 buttonLayout->addWidget( mByPosWeekdayCombo, 1, 2 ); 250 buttonLayout->addWidget( mByPosWeekdayCombo, 1, 2 );
251} 251}
252 252
253void RecurMonthly::setByDay( int day ) 253void RecurMonthly::setByDay( int day )
254{ 254{
255 mByDayRadio->setChecked( true ); 255 mByDayRadio->setChecked( true );
256 mByDayCombo->setCurrentItem( day ); 256 mByDayCombo->setCurrentItem( day );
257} 257}
258 258
259void RecurMonthly::setByPos( int count, int weekday ) 259void RecurMonthly::setByPos( int count, int weekday )
260{ 260{
261 mByPosRadio->setChecked( true ); 261 mByPosRadio->setChecked( true );
262 mByPosCountCombo->setCurrentItem( count ); 262 mByPosCountCombo->setCurrentItem( count );
263 mByPosWeekdayCombo->setCurrentItem( weekday ); 263 mByPosWeekdayCombo->setCurrentItem( weekday );
264} 264}
265 265
266bool RecurMonthly::byDay() 266bool RecurMonthly::byDay()
267{ 267{
268 return mByDayRadio->isChecked(); 268 return mByDayRadio->isChecked();
269} 269}
270 270
271bool RecurMonthly::byPos() 271bool RecurMonthly::byPos()
272{ 272{
273 return mByPosRadio->isChecked(); 273 return mByPosRadio->isChecked();
274} 274}
275 275
276int RecurMonthly::day() 276int RecurMonthly::day()
277{ 277{
278 return mByDayCombo->currentItem() + 1; 278 return mByDayCombo->currentItem() + 1;
279} 279}
280 280
281int RecurMonthly::count() 281int RecurMonthly::count()
282{ 282{
283 return mByPosCountCombo->currentItem() + 1; 283 return mByPosCountCombo->currentItem() + 1;
284} 284}
285 285
286int RecurMonthly::weekday() 286int RecurMonthly::weekday()
287{ 287{
288 return mByPosWeekdayCombo->currentItem(); 288 return mByPosWeekdayCombo->currentItem();
289} 289}
290 290
291/////////////////////////// RecurYearly /////////////////////////////// 291/////////////////////////// RecurYearly ///////////////////////////////
292 292
293RecurYearly::RecurYearly( QWidget *parent, const char *name ) : 293RecurYearly::RecurYearly( QWidget *parent, const char *name ) :
294 RecurBase( parent, name ) 294 RecurBase( parent, name )
295{ 295{
296 QBoxLayout *topLayout = new QVBoxLayout( this ); 296 QBoxLayout *topLayout = new QVBoxLayout( this );
297 topLayout->setSpacing( KDialog::spacingHint() ); 297 topLayout->setSpacing( KDialog::spacingHint() );
298 topLayout->setMargin( KDialog::marginHintSmall() ); 298 topLayout->setMargin( KDialog::marginHintSmall() );
299 299
300 300
301 QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); 301 QBoxLayout *freqLayout = new QHBoxLayout( topLayout );
302 302
303 QLabel *preLabel = new QLabel( i18n("every"), this ); 303 QLabel *preLabel = new QLabel( i18n("every"), this );
304 freqLayout->addWidget( preLabel ); 304 freqLayout->addWidget( preLabel );
305 305
306 freqLayout->addWidget( frequencyEdit() ); 306 freqLayout->addWidget( frequencyEdit() );
307 307
308 QLabel *postLabel = new QLabel( i18n("year(s)"), this ); 308 QLabel *postLabel = new QLabel( i18n("year(s)"), this );
309 freqLayout->addWidget( postLabel ); 309 freqLayout->addWidget( postLabel );
310 310
311 311
312 QButtonGroup *buttonGroup = new QButtonGroup( this ); 312 QButtonGroup *buttonGroup = new QButtonGroup( this );
313 buttonGroup->setFrameStyle( QFrame::NoFrame ); 313 buttonGroup->setFrameStyle( QFrame::NoFrame );
314 topLayout->addWidget( buttonGroup, 1, AlignVCenter ); 314 topLayout->addWidget( buttonGroup, 1, AlignVCenter );
315 315
316 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 2, 3 ); 316 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 2, 3 );
317 317
318 mByMonthRadio = new QRadioButton( i18n("On day "), buttonGroup); 318 mByMonthRadio = new QRadioButton( i18n("On day "), buttonGroup);
319 buttonLayout->addWidget( mByMonthRadio, 0, 0 , Qt::AlignRight); 319 buttonLayout->addWidget( mByMonthRadio, 0, 0 , Qt::AlignRight);
320 mByDayLabel = new QLabel( i18n("%1 of ").arg(1), buttonGroup ); 320 mByDayLabel = new QLabel( i18n("%1 of ").arg(1), buttonGroup );
321 321
322 buttonLayout->addWidget( mByDayLabel, 0, 1 ); 322 buttonLayout->addWidget( mByDayLabel, 0, 1 );
323 mByMonthCombo = new QComboBox( buttonGroup ); 323 mByMonthCombo = new QComboBox( buttonGroup );
324 mByMonthCombo->insertItem( i18n("January") ); 324 mByMonthCombo->insertItem( i18n("January") );
325 mByMonthCombo->insertItem( i18n("February") ); 325 mByMonthCombo->insertItem( i18n("February") );
326 mByMonthCombo->insertItem( i18n("March") ); 326 mByMonthCombo->insertItem( i18n("March") );
327 mByMonthCombo->insertItem( i18n("April") ); 327 mByMonthCombo->insertItem( i18n("April") );
328 mByMonthCombo->insertItem( i18n("May") ); 328 mByMonthCombo->insertItem( i18n("May") );
329 mByMonthCombo->insertItem( i18n("June") ); 329 mByMonthCombo->insertItem( i18n("June") );
330 mByMonthCombo->insertItem( i18n("July") ); 330 mByMonthCombo->insertItem( i18n("July") );
331 mByMonthCombo->insertItem( i18n("August") ); 331 mByMonthCombo->insertItem( i18n("August") );
332 mByMonthCombo->insertItem( i18n("September") ); 332 mByMonthCombo->insertItem( i18n("September") );
333 mByMonthCombo->insertItem( i18n("October") ); 333 mByMonthCombo->insertItem( i18n("October") );
334 mByMonthCombo->insertItem( i18n("November") ); 334 mByMonthCombo->insertItem( i18n("November") );
335 mByMonthCombo->insertItem( i18n("December") ); 335 mByMonthCombo->insertItem( i18n("December") );
336 buttonLayout->addWidget( mByMonthCombo, 0, 2,Qt::AlignLeft ); 336 buttonLayout->addWidget( mByMonthCombo, 0, 2,Qt::AlignLeft );
337 if ( QApplication::desktop()->width() <= 640 ) { 337 if ( QApplication::desktop()->width() <= 640 ) {
338 mByMonthCombo->setSizeLimit( 6 ); 338 mByMonthCombo->setSizeLimit( 6 );
339 } 339 }
340 340
341 mByDayRadio = new QRadioButton( i18n("On day "), buttonGroup); 341 mByDayRadio = new QRadioButton( i18n("On day "), buttonGroup);
342 buttonLayout->addWidget( mByDayRadio, 1, 0 , Qt::AlignRight); 342 buttonLayout->addWidget( mByDayRadio, 1, 0 , Qt::AlignRight);
343 mDayOfLabel = new QLabel( i18n("%1 of the year").arg(1), buttonGroup ); 343 mDayOfLabel = new QLabel( i18n("%1 of the year").arg(1), buttonGroup );
344 buttonLayout->addMultiCellWidget( mDayOfLabel, 1, 1, 1,3 ); 344 buttonLayout->addMultiCellWidget( mDayOfLabel, 1, 1, 1,3 );
345 345
346} 346}
347 347
348void RecurYearly::setByDay( int doy ) 348void RecurYearly::setByDay( int doy )
349{ 349{
350 mByDayRadio->setChecked( true ); 350 mByDayRadio->setChecked( true );
351 mDayOfLabel->setText(i18n("%1 of the year").arg( doy ) ); 351 mDayOfLabel->setText(i18n("%1 of the year").arg( doy ) );
352} 352}
353 353
354void RecurYearly::setByMonth( int month, int day ) 354void RecurYearly::setByMonth( int month, int day )
355{ 355{
356 mByMonthRadio->setChecked( true ); 356 mByMonthRadio->setChecked( true );
357 mByMonthCombo->setCurrentItem( month - 1 ); 357 mByMonthCombo->setCurrentItem( month - 1 );
358 mByDayLabel->setText(i18n("%1 of ").arg( day ) ); 358 mByDayLabel->setText(i18n("%1 of ").arg( day ) );
359 mDay = day; 359 mDay = day;
360} 360}
361 361
362bool RecurYearly::byMonth() 362bool RecurYearly::byMonth()
363{ 363{
364 return mByMonthRadio->isChecked(); 364 return mByMonthRadio->isChecked();
365} 365}
366 366
367bool RecurYearly::byDay() 367bool RecurYearly::byDay()
368{ 368{
369 return mByDayRadio->isChecked(); 369 return mByDayRadio->isChecked();
370} 370}
371 371
372int RecurYearly::month() 372int RecurYearly::month()
373{ 373{
374 return mByMonthCombo->currentItem() + 1; 374 return mByMonthCombo->currentItem() + 1;
375} 375}
376int RecurYearly::day() 376int RecurYearly::day()
377{ 377{
378 return mDay;//mByDayCombo->currentItem() + 1; 378 return mDay;//mByDayCombo->currentItem() + 1;
379} 379}
380 380
381//////////////////////////// ExceptionsWidget ////////////////////////// 381//////////////////////////// ExceptionsWidget //////////////////////////
382 382
383ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) : 383ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) :
384 QWidget( parent, name ) 384 QWidget( parent, name )
385{ 385{
386 QBoxLayout *topLayout = new QVBoxLayout( this ); 386 QBoxLayout *topLayout = new QVBoxLayout( this );
387 387
388 QGroupBox *groupBox = new QGroupBox( 1, Horizontal, i18n("Exceptions"), 388 QGroupBox *groupBox = new QGroupBox( 1, Horizontal, i18n("Exceptions"),
389 this ); 389 this );
390 topLayout->addWidget( groupBox ); 390 topLayout->addWidget( groupBox );
391 391
392 QWidget *box = new QWidget( groupBox ); 392 QWidget *box = new QWidget( groupBox );
393 393
394 QGridLayout *boxLayout = new QGridLayout( box ); 394 QGridLayout *boxLayout = new QGridLayout( box );
395 395
396 mExceptionDateEdit = new KDateEdit( box ); 396 mExceptionDateEdit = new KDateEdit( box );
397 boxLayout->addWidget( mExceptionDateEdit, 0, 0 ); 397 boxLayout->addWidget( mExceptionDateEdit, 0, 0 );
398 398
399 QPushButton *addExceptionButton = new QPushButton( i18n("Add"), box ); 399 QPushButton *addExceptionButton = new QPushButton( i18n("Add"), box );
400 boxLayout->addWidget( addExceptionButton, 1, 0 ); 400 boxLayout->addWidget( addExceptionButton, 1, 0 );
401 QPushButton *changeExceptionButton = new QPushButton( i18n("Change"), box ); 401 QPushButton *changeExceptionButton = new QPushButton( i18n("Change"), box );
402 boxLayout->addWidget( changeExceptionButton, 2, 0 ); 402 boxLayout->addWidget( changeExceptionButton, 2, 0 );
403 QPushButton *deleteExceptionButton = new QPushButton( i18n("Delete"), box ); 403 QPushButton *deleteExceptionButton = new QPushButton( i18n("Delete"), box );
404 boxLayout->addWidget( deleteExceptionButton, 3, 0 ); 404 boxLayout->addWidget( deleteExceptionButton, 3, 0 );
405 405
406 mExceptionList = new QListBox( box ); 406 mExceptionList = new QListBox( box );
407 boxLayout->addMultiCellWidget( mExceptionList, 0, 3, 1, 1 ); 407 boxLayout->addMultiCellWidget( mExceptionList, 0, 3, 1, 1 );
408 408
409 boxLayout->setRowStretch( 4, 1 ); 409 boxLayout->setRowStretch( 4, 1 );
410 boxLayout->setColStretch( 1, 3 ); 410 boxLayout->setColStretch( 1, 3 );
411 411
412 connect( addExceptionButton, SIGNAL( clicked() ), 412 connect( addExceptionButton, SIGNAL( clicked() ),
413 SLOT( addException() ) ); 413 SLOT( addException() ) );
414 connect( changeExceptionButton, SIGNAL( clicked() ), 414 connect( changeExceptionButton, SIGNAL( clicked() ),
415 SLOT( changeException() ) ); 415 SLOT( changeException() ) );
416 connect( deleteExceptionButton, SIGNAL( clicked() ), 416 connect( deleteExceptionButton, SIGNAL( clicked() ),
417 SLOT( deleteException() ) ); 417 SLOT( deleteException() ) );
418 if ( QApplication::desktop()->width() < 480 ) { 418 if ( QApplication::desktop()->width() < 480 ) {
419 setMinimumWidth( 220 ); 419 setMinimumWidth( 220 );
420 } else { 420 } else {
421 setMinimumWidth( 440 ); 421 setMinimumWidth( 440 );
422 mExceptionDateEdit->setMinimumWidth( 200 ); 422 mExceptionDateEdit->setMinimumWidth( 200 );
423 } 423 }
424} 424}
425 425
426void ExceptionsWidget::setDefaults( const QDateTime &from ) 426void ExceptionsWidget::setDefaults( const QDateTime &from )
427{ 427{
428 mExceptionDateEdit->setDate( from.date() ); 428 mExceptionDateEdit->setDate( from.date() );
429} 429}
430 430
431void ExceptionsWidget::addException() 431void ExceptionsWidget::addException()
432{ 432{
433 QDate date = mExceptionDateEdit->date(); 433 QDate date = mExceptionDateEdit->date();
434 QString dateStr = KGlobal::locale()->formatDate( date ); 434 QString dateStr = KGlobal::locale()->formatDate( date );
435 if( !mExceptionList->findItem( dateStr ) ) { 435 if( !mExceptionList->findItem( dateStr ) ) {
436 mExceptionDates.append( date ); 436 mExceptionDates.append( date );
437 mExceptionList->insertItem( dateStr ); 437 mExceptionList->insertItem( dateStr );
438 } 438 }
439} 439}
440 440
441void ExceptionsWidget::changeException() 441void ExceptionsWidget::changeException()
442{ 442{
443 int pos = mExceptionList->currentItem(); 443 int pos = mExceptionList->currentItem();
444 if ( pos < 0 ) return; 444 if ( pos < 0 ) return;
445 445
446 QDate date = mExceptionDateEdit->date(); 446 QDate date = mExceptionDateEdit->date();
447 mExceptionDates[ pos ] = date; 447 mExceptionDates[ pos ] = date;
448 mExceptionList->changeItem( KGlobal::locale()->formatDate( date ), pos ); 448 mExceptionList->changeItem( KGlobal::locale()->formatDate( date ), pos );
449} 449}
450 450
451void ExceptionsWidget::deleteException() 451void ExceptionsWidget::deleteException()
452{ 452{
453 int pos = mExceptionList->currentItem(); 453 int pos = mExceptionList->currentItem();
454 if ( pos < 0 ) return; 454 if ( pos < 0 ) return;
455 455
456 mExceptionDates.remove( mExceptionDates.at( pos ) ); 456 mExceptionDates.remove( mExceptionDates.at( pos ) );
457 mExceptionList->removeItem( pos ); 457 mExceptionList->removeItem( pos );
458} 458}
459 459
460void ExceptionsWidget::setDates( const DateList &dates ) 460void ExceptionsWidget::setDates( const DateList &dates )
461{ 461{
462 mExceptionList->clear(); 462 mExceptionList->clear();
463 mExceptionDates.clear(); 463 mExceptionDates.clear();
464 DateList::ConstIterator dit; 464 DateList::ConstIterator dit;
465 for ( dit = dates.begin(); dit != dates.end(); ++dit ) { 465 for ( dit = dates.begin(); dit != dates.end(); ++dit ) {
466 mExceptionList->insertItem( KGlobal::locale()->formatDate(* dit ) ); 466 mExceptionList->insertItem( KGlobal::locale()->formatDate(* dit ) );
467 mExceptionDates.append( *dit ); 467 mExceptionDates.append( *dit );
468 } 468 }
469} 469}
470 470
471DateList ExceptionsWidget::dates() 471DateList ExceptionsWidget::dates()
472{ 472{
473 return mExceptionDates; 473 return mExceptionDates;
474} 474}
475 475
476///////////////////////// ExceptionsDialog /////////////////////////// 476///////////////////////// ExceptionsDialog ///////////////////////////
477 477
478ExceptionsDialog::ExceptionsDialog( QWidget *parent, const char *name ) : 478ExceptionsDialog::ExceptionsDialog( QWidget *parent, const char *name ) :
479 KDialogBase( parent, name, true, i18n("Edit exceptions"), Ok|Cancel ) 479 KDialogBase( parent, name, true, i18n("Edit exceptions"), Ok|Cancel )
480{ 480{
481 mExceptions = new ExceptionsWidget( this ); 481 mExceptions = new ExceptionsWidget( this );
482 setMainWidget( mExceptions ); 482 setMainWidget( mExceptions );
483 resize(220,10); 483 resize(220,10);
484} 484}
485 485
486void ExceptionsDialog::setDefaults( const QDateTime &from ) 486void ExceptionsDialog::setDefaults( const QDateTime &from )
487{ 487{
488 mExceptions->setDefaults( from ); 488 mExceptions->setDefaults( from );
489} 489}
490 490
491void ExceptionsDialog::setDates( const DateList &dates ) 491void ExceptionsDialog::setDates( const DateList &dates )
492{ 492{
493 mExceptions->setDates( dates ); 493 mExceptions->setDates( dates );
494} 494}
495 495
496DateList ExceptionsDialog::dates() 496DateList ExceptionsDialog::dates()
497{ 497{
498 return mExceptions->dates(); 498 return mExceptions->dates();
499} 499}
500 500
501///////////////////////// RecurrenceRangeWidget /////////////////////////// 501///////////////////////// RecurrenceRangeWidget ///////////////////////////
502 502
503RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent, 503RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent,
504 const char *name ) 504 const char *name )
505 : QWidget( parent, name ) 505 : QWidget( parent, name )
506{ 506{
507 QBoxLayout *topLayout = new QVBoxLayout( this ); 507 QBoxLayout *topLayout = new QVBoxLayout( this );
508 508
509 mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"), 509 mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"),
510 this ); 510 this );
511 topLayout->addWidget( mRangeGroupBox ); 511 topLayout->addWidget( mRangeGroupBox );
512 512
513 QWidget *rangeBox = new QWidget( mRangeGroupBox ); 513 QWidget *rangeBox = new QWidget( mRangeGroupBox );
514 QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox ); 514 QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox );
515 rangeLayout->setSpacing( KDialog::spacingHint() ); 515 rangeLayout->setSpacing( KDialog::spacingHint() );
516 rangeLayout->setMargin( KDialog::marginHintSmall() ); 516 rangeLayout->setMargin( KDialog::marginHintSmall() );
517 517
518 mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox ); 518 mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox );
519 rangeLayout->addWidget( mStartDateLabel ); 519 rangeLayout->addWidget( mStartDateLabel );
520 520
521 QButtonGroup *rangeButtonGroup = new QButtonGroup; 521 QButtonGroup *rangeButtonGroup = new QButtonGroup;
522 522
523 mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox ); 523 mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox );
524 rangeButtonGroup->insert( mNoEndDateButton ); 524 rangeButtonGroup->insert( mNoEndDateButton );
525 rangeLayout->addWidget( mNoEndDateButton ); 525 rangeLayout->addWidget( mNoEndDateButton );
526 526
527 QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout ); 527 QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout );
528 durationLayout->setSpacing( KDialog::spacingHint() ); 528 durationLayout->setSpacing( KDialog::spacingHint() );
529 529
530 mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox ); 530 mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox );
531 rangeButtonGroup->insert( mEndDurationButton ); 531 rangeButtonGroup->insert( mEndDurationButton );
532 durationLayout->addWidget( mEndDurationButton ); 532 durationLayout->addWidget( mEndDurationButton );
533 533
534 mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox ); 534 mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox );
535 durationLayout->addWidget( mEndDurationEdit ); 535 durationLayout->addWidget( mEndDurationEdit );
536 536
537 QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox ); 537 QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox );
538 durationLayout ->addWidget( endDurationLabel ); 538 durationLayout ->addWidget( endDurationLabel );
539 539
540 QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout ); 540 QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout );
541 endDateLayout->setSpacing( KDialog::spacingHint() ); 541 endDateLayout->setSpacing( KDialog::spacingHint() );
542 542
543 mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox ); 543 mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox );
544 rangeButtonGroup->insert( mEndDateButton ); 544 rangeButtonGroup->insert( mEndDateButton );
545 endDateLayout->addWidget( mEndDateButton ); 545 endDateLayout->addWidget( mEndDateButton );
546 546
547 mEndDateEdit = new KDateEdit( rangeBox ); 547 mEndDateEdit = new KDateEdit( rangeBox );
548 endDateLayout->addWidget( mEndDateEdit ); 548 endDateLayout->addWidget( mEndDateEdit );
549 549
550 //endDateLayout->addStretch( 1 ); 550 //endDateLayout->addStretch( 1 );
551 551
552 connect( mNoEndDateButton, SIGNAL( toggled( bool ) ), 552 connect( mNoEndDateButton, SIGNAL( toggled( bool ) ),
553 SLOT( showCurrentRange() ) ); 553 SLOT( showCurrentRange() ) );
554 connect( mEndDurationButton, SIGNAL( toggled( bool ) ), 554 connect( mEndDurationButton, SIGNAL( toggled( bool ) ),
555 SLOT( showCurrentRange() ) ); 555 SLOT( showCurrentRange() ) );
556 connect( mEndDateButton, SIGNAL( toggled( bool ) ), 556 connect( mEndDateButton, SIGNAL( toggled( bool ) ),
557 SLOT( showCurrentRange() ) ); 557 SLOT( showCurrentRange() ) );
558} 558}
559 559
560void RecurrenceRangeWidget::setDefaults( const QDateTime &from ) 560void RecurrenceRangeWidget::setDefaults( const QDateTime &from )
561{ 561{
562 mNoEndDateButton->setChecked( true ); 562 mNoEndDateButton->setChecked( true );
563 563
564 setDateTimes( from ); 564 setDateTimes( from );
565 mEndDateEdit->setDate( from.date() ); 565 mEndDateEdit->setDate( from.date() );
566} 566}
567 567
568void RecurrenceRangeWidget::setDuration( int duration ) 568void RecurrenceRangeWidget::setDuration( int duration )
569{ 569{
570 if ( duration == -1 ) { 570 if ( duration == -1 ) {
571 mNoEndDateButton->setChecked( true ); 571 mNoEndDateButton->setChecked( true );
572 } else if ( duration == 0 ) { 572 } else if ( duration == 0 ) {
573 mEndDateButton->setChecked( true ); 573 mEndDateButton->setChecked( true );
574 } else { 574 } else {
575 mEndDurationButton->setChecked( true ); 575 mEndDurationButton->setChecked( true );
576 mEndDurationEdit->setValue( duration ); 576 mEndDurationEdit->setValue( duration );
577 } 577 }
578} 578}
579 579
580int RecurrenceRangeWidget::duration() 580int RecurrenceRangeWidget::duration()
581{ 581{
582 if ( mNoEndDateButton->isChecked() ) { 582 if ( mNoEndDateButton->isChecked() ) {
583 return -1; 583 return -1;
584 } else if ( mEndDurationButton->isChecked() ) { 584 } else if ( mEndDurationButton->isChecked() ) {
585 return mEndDurationEdit->value(); 585 return mEndDurationEdit->value();
586 } else { 586 } else {
587 return 0; 587 return 0;
588 } 588 }
589} 589}
590 590
591void RecurrenceRangeWidget::setEndDate( const QDate &date ) 591void RecurrenceRangeWidget::setEndDate( const QDate &date )
592{ 592{
593 mEndDateEdit->setDate( date ); 593 mEndDateEdit->setDate( date );
594} 594}
595 595
596QDate RecurrenceRangeWidget::endDate() 596QDate RecurrenceRangeWidget::endDate()
597{ 597{
598 return mEndDateEdit->date(); 598 return mEndDateEdit->date();
599} 599}
600 600
601void RecurrenceRangeWidget::showCurrentRange() 601void RecurrenceRangeWidget::showCurrentRange()
602{ 602{
603 mEndDurationEdit->setEnabled( mEndDurationButton->isChecked() ); 603 mEndDurationEdit->setEnabled( mEndDurationButton->isChecked() );
604 mEndDateEdit->setEnabled( mEndDateButton->isChecked() ); 604 mEndDateEdit->setEnabled( mEndDateButton->isChecked() );
605} 605}
606 606
607void RecurrenceRangeWidget::setDateTimes( const QDateTime &start, 607void RecurrenceRangeWidget::setDateTimes( const QDateTime &start,
608 const QDateTime & ) 608 const QDateTime & )
609{ 609{
610 mStartDateLabel->setText( i18n("Start date: %1") 610 mStartDateLabel->setText( i18n("Start date: %1")
611 .arg( KGlobal::locale()->formatDate( start.date() ) ) ); 611 .arg( KGlobal::locale()->formatDate( start.date() ) ) );
612 612
613 if(!mEndDateButton->isChecked()) 613 if(!mEndDateButton->isChecked())
614 mEndDateEdit->setDate( start.date() ); 614 mEndDateEdit->setDate( start.date() );
615} 615}
616 616
617///////////////////////// RecurrenceRangeDialog /////////////////////////// 617///////////////////////// RecurrenceRangeDialog ///////////////////////////
618 618
619RecurrenceRangeDialog::RecurrenceRangeDialog( QWidget *parent, 619RecurrenceRangeDialog::RecurrenceRangeDialog( QWidget *parent,
620 const char *name ) : 620 const char *name ) :
621 KDialogBase( parent, name, true, i18n("Edit Recurrence Range"), Ok|Cancel ) 621 KDialogBase( parent, name, true, i18n("Edit Recurrence Range"), Ok|Cancel )
622{ 622{
623 mRecurrenceRangeWidget = new RecurrenceRangeWidget( this ); 623 mRecurrenceRangeWidget = new RecurrenceRangeWidget( this );
624 setMainWidget( mRecurrenceRangeWidget ); 624 setMainWidget( mRecurrenceRangeWidget );
625} 625}
626 626
627void RecurrenceRangeDialog::setDefaults( const QDateTime &from ) 627void RecurrenceRangeDialog::setDefaults( const QDateTime &from )
628{ 628{
629 mRecurrenceRangeWidget->setDefaults( from ); 629 mRecurrenceRangeWidget->setDefaults( from );
630} 630}
631 631
632void RecurrenceRangeDialog::setDuration( int duration ) 632void RecurrenceRangeDialog::setDuration( int duration )
633{ 633{
634 mRecurrenceRangeWidget->setDuration( duration ); 634 mRecurrenceRangeWidget->setDuration( duration );
635} 635}
636 636
637int RecurrenceRangeDialog::duration() 637int RecurrenceRangeDialog::duration()
638{ 638{
639 return mRecurrenceRangeWidget->duration(); 639 return mRecurrenceRangeWidget->duration();
640} 640}
641 641
642void RecurrenceRangeDialog::setEndDate( const QDate &date ) 642void RecurrenceRangeDialog::setEndDate( const QDate &date )
643{ 643{
644 mRecurrenceRangeWidget->setEndDate( date ); 644 mRecurrenceRangeWidget->setEndDate( date );
645} 645}
646 646
647QDate RecurrenceRangeDialog::endDate() 647QDate RecurrenceRangeDialog::endDate()
648{ 648{
649 return mRecurrenceRangeWidget->endDate(); 649 return mRecurrenceRangeWidget->endDate();
650} 650}
651 651
652void RecurrenceRangeDialog::setDateTimes( const QDateTime &start, 652void RecurrenceRangeDialog::setDateTimes( const QDateTime &start,
653 const QDateTime &end ) 653 const QDateTime &end )
654{ 654{
655 mRecurrenceRangeWidget->setDateTimes( start, end ); 655 mRecurrenceRangeWidget->setDateTimes( start, end );
656} 656}
657 657
658//////////////////////////// RecurrenceChooser //////////////////////// 658//////////////////////////// RecurrenceChooser ////////////////////////
659 659
660RecurrenceChooser::RecurrenceChooser( QWidget *parent, const char *name ) : 660RecurrenceChooser::RecurrenceChooser( QWidget *parent, const char *name ) :
661 QWidget( parent, name ) 661 QWidget( parent, name )
662{ 662{
663 QBoxLayout *topLayout = new QVBoxLayout( this ); 663 QBoxLayout *topLayout = new QVBoxLayout( this );
664 664
665 mTypeCombo = new QComboBox( this ); 665 mTypeCombo = new QComboBox( this );
666 mTypeCombo->insertItem( i18n("Daily") ); 666 mTypeCombo->insertItem( i18n("Daily") );
667 mTypeCombo->insertItem( i18n("Weekly") ); 667 mTypeCombo->insertItem( i18n("Weekly") );
668 mTypeCombo->insertItem( i18n("Monthly") ); 668 mTypeCombo->insertItem( i18n("Monthly") );
669 mTypeCombo->insertItem( i18n("Yearly") ); 669 mTypeCombo->insertItem( i18n("Yearly") );
670 670
671 topLayout->addWidget( mTypeCombo ); 671 topLayout->addWidget( mTypeCombo );
672 672
673 connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( emitChoice() ) ); 673 connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( emitChoice() ) );
674 674
675} 675}
676 676
677int RecurrenceChooser::type() 677int RecurrenceChooser::type()
678{ 678{
679 if ( mTypeCombo ) { 679 if ( mTypeCombo ) {
680 return mTypeCombo->currentItem(); 680 return mTypeCombo->currentItem();
681 } else { 681 } else {
682 if ( mDailyButton->isChecked() ) return Daily; 682 if ( mDailyButton->isChecked() ) return Daily;
683 else if ( mWeeklyButton->isChecked() ) return Weekly; 683 else if ( mWeeklyButton->isChecked() ) return Weekly;
684 else if ( mMonthlyButton->isChecked() ) return Monthly; 684 else if ( mMonthlyButton->isChecked() ) return Monthly;
685 else return Yearly; 685 else return Yearly;
686 } 686 }
687} 687}
688 688
689void RecurrenceChooser::setType( int type ) 689void RecurrenceChooser::setType( int type )
690{ 690{
691 if ( mTypeCombo ) { 691 if ( mTypeCombo ) {
692 mTypeCombo->setCurrentItem( type ); 692 mTypeCombo->setCurrentItem( type );
693 } else { 693 } else {
694 switch ( type ) { 694 switch ( type ) {
695 case Daily: 695 case Daily:
696 mDailyButton->setChecked( true ); 696 mDailyButton->setChecked( true );
697 break; 697 break;
698 case Weekly: 698 case Weekly:
699 mWeeklyButton->setChecked( true ); 699 mWeeklyButton->setChecked( true );
700 break; 700 break;
701 case Monthly: 701 case Monthly:
702 mMonthlyButton->setChecked( true ); 702 mMonthlyButton->setChecked( true );
703 break; 703 break;
704 case Yearly: 704 case Yearly:
705 default: 705 default:
706 mYearlyButton->setChecked( true ); 706 mYearlyButton->setChecked( true );
707 break; 707 break;
708 } 708 }
709 } 709 }
710} 710}
711 711
712void RecurrenceChooser::emitChoice() 712void RecurrenceChooser::emitChoice()
713{ 713{
714 emit chosen ( type() ); 714 emit chosen ( type() );
715} 715}
716 716
717/////////////////////////////// Main Widget ///////////////////////////// 717/////////////////////////////// Main Widget /////////////////////////////
718 718
719KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) : 719KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) :
720 QWidget( parent, name ) 720 QWidget( parent, name )
721{ 721{
722 QGridLayout *topLayout = new QGridLayout( this, 2,2 ); 722 QGridLayout *topLayout = new QGridLayout( this, 2,2 );
723 topLayout->setSpacing( KDialog::spacingHint() ); 723 topLayout->setSpacing( KDialog::spacingHint() );
724 topLayout->setMargin( KDialog::marginHintSmall() ); 724 topLayout->setMargin( KDialog::marginHintSmall() );
725 725
726 mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this ); 726 mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this );
727 connect( mEnabledCheck, SIGNAL( toggled( bool ) ), 727 connect( mEnabledCheck, SIGNAL( toggled( bool ) ),
728 SLOT( setEnabled( bool ) ) ); 728 SLOT( setEnabled( bool ) ) );
729 topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 ); 729 topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 );
730 730
731 731
732 mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Appointment Time "), 732 mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Time"),
733 this ); 733 this );
734 topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 ); 734 topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 );
735 735
736 if ( QApplication::desktop()->width() <= 320) { 736 if ( QApplication::desktop()->width() <= 320) {
737 mTimeGroupBox->hide(); 737 mTimeGroupBox->hide();
738 } 738 }
739 739
740// QFrame *timeFrame = new QFrame( mTimeGroupBox ); 740// QFrame *timeFrame = new QFrame( mTimeGroupBox );
741// QBoxLayout *layoutTimeFrame = new QHBoxLayout( timeFrame ); 741// QBoxLayout *layoutTimeFrame = new QHBoxLayout( timeFrame );
742// layoutTimeFrame->setSpacing( KDialog::spacingHint() ); 742// layoutTimeFrame->setSpacing( KDialog::spacingHint() );
743 743
744 mDateTimeLabel = new QLabel( mTimeGroupBox ); 744 mDateTimeLabel = new QLabel( mTimeGroupBox );
745// mDateTimeLabel = new QLabel( timeFrame ); 745// mDateTimeLabel = new QLabel( timeFrame );
746// layoutTimeFrame->addWidget( mDateTimeLabel ); 746// layoutTimeFrame->addWidget( mDateTimeLabel );
747 747 //mTimeGroupBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) );
748 748 //mDateTimeLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum) );
749 mRuleBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Rule"), this ); 749 mRuleBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Rule"), this );
750 topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 ); 750 topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 );
751 mRecurrenceChooser = new RecurrenceChooser( mRuleBox ); 751 mRecurrenceChooser = new RecurrenceChooser( mRuleBox );
752 connect( mRecurrenceChooser, SIGNAL( chosen( int ) ), 752 connect( mRecurrenceChooser, SIGNAL( chosen( int ) ),
753 SLOT( showCurrentRule( int ) ) ); 753 SLOT( showCurrentRule( int ) ) );
754 754
755 755
756 mRuleStack = new QWidgetStack( mRuleBox ); 756 mRuleStack = new QWidgetStack( mRuleBox );
757 757
758 mDaily = new RecurDaily( mRuleStack ); 758 mDaily = new RecurDaily( mRuleStack );
759 mRuleStack->addWidget( mDaily, 0 ); 759 mRuleStack->addWidget( mDaily, 0 );
760 760
761 mWeekly = new RecurWeekly( mRuleStack ); 761 mWeekly = new RecurWeekly( mRuleStack );
762 mRuleStack->addWidget( mWeekly, 0 ); 762 mRuleStack->addWidget( mWeekly, 0 );
763 763
764 mMonthly = new RecurMonthly( mRuleStack ); 764 mMonthly = new RecurMonthly( mRuleStack );
765 mRuleStack->addWidget( mMonthly, 0 ); 765 mRuleStack->addWidget( mMonthly, 0 );
766 766
767 mYearly = new RecurYearly( mRuleStack ); 767 mYearly = new RecurYearly( mRuleStack );
768 mRuleStack->addWidget( mYearly, 0 ); 768 mRuleStack->addWidget( mYearly, 0 );
769 769
770 showCurrentRule( mRecurrenceChooser->type() ); 770 showCurrentRule( mRecurrenceChooser->type() );
771 mRecurrenceRangeWidget = 0; 771 mRecurrenceRangeWidget = 0;
772 mRecurrenceRangeDialog = new RecurrenceRangeDialog( this ); 772 mRecurrenceRangeDialog = new RecurrenceRangeDialog( this );
773 mRecurrenceRange = mRecurrenceRangeDialog; 773 mRecurrenceRange = mRecurrenceRangeDialog;
774 mRecurrenceRangeButton = new QPushButton( i18n("Recurrence Range..."), 774 mRecurrenceRangeButton = new QPushButton( i18n("Recurrence Range..."),
775 this ); 775 this );
776 776
777 connect( mRecurrenceRangeButton, SIGNAL( clicked() ), 777 connect( mRecurrenceRangeButton, SIGNAL( clicked() ),
778 SLOT( showRecurrenceRangeDialog() ) ); 778 SLOT( showRecurrenceRangeDialog() ) );
779 779
780 mExceptionsWidget = 0; 780 mExceptionsWidget = 0;
781 mExceptionsDialog = new ExceptionsDialog( this ); 781 mExceptionsDialog = new ExceptionsDialog( this );
782 mExceptions = mExceptionsDialog; 782 mExceptions = mExceptionsDialog;
783 mExceptionsButton = new QPushButton( i18n("Exceptions..."), this ); 783 mExceptionsButton = new QPushButton( i18n("Exceptions..."), this );
784 if ( QApplication::desktop()->width() < 320 ) { 784 if ( QApplication::desktop()->width() < 320 ) {
785 topLayout->addMultiCellWidget( mRecurrenceRangeButton, 3, 3, 0, 1 ); 785 topLayout->addMultiCellWidget( mRecurrenceRangeButton, 3, 3, 0, 1 );
786 topLayout->addMultiCellWidget( mExceptionsButton, 4, 4, 0, 1 ); 786 topLayout->addMultiCellWidget( mExceptionsButton, 4, 4, 0, 1 );
787 } else { 787 } else {
788 topLayout->addWidget( mRecurrenceRangeButton, 3, 0 ); 788 topLayout->addWidget( mRecurrenceRangeButton, 3, 0 );
789 topLayout->addWidget( mExceptionsButton, 3, 1 ); 789 topLayout->addWidget( mExceptionsButton, 3, 1 );
790 } 790 }
791 connect( mExceptionsButton, SIGNAL( clicked() ), 791 connect( mExceptionsButton, SIGNAL( clicked() ),
792 SLOT( showExceptionsDialog() ) ); 792 SLOT( showExceptionsDialog() ) );
793} 793}
794 794
795KOEditorRecurrence::~KOEditorRecurrence() 795KOEditorRecurrence::~KOEditorRecurrence()
796{ 796{
797} 797}
798 798
799void KOEditorRecurrence::setEnabled( bool enabled ) 799void KOEditorRecurrence::setEnabled( bool enabled )
800{ 800{
801// kdDebug() << "KOEditorRecurrence::setEnabled(): " << (enabled ? "on" : "off") << endl; 801// kdDebug() << "KOEditorRecurrence::setEnabled(): " << (enabled ? "on" : "off") << endl;
802 802
803 mTimeGroupBox->setEnabled( enabled ); 803 mTimeGroupBox->setEnabled( enabled );
804 if ( mRecurrenceRangeWidget ) mRecurrenceRangeWidget->setEnabled( enabled ); 804 if ( mRecurrenceRangeWidget ) mRecurrenceRangeWidget->setEnabled( enabled );
805 if ( mRecurrenceRangeButton ) mRecurrenceRangeButton->setEnabled( enabled ); 805 if ( mRecurrenceRangeButton ) mRecurrenceRangeButton->setEnabled( enabled );
806 if ( mExceptionsWidget ) mExceptionsWidget->setEnabled( enabled ); 806 if ( mExceptionsWidget ) mExceptionsWidget->setEnabled( enabled );
807 if ( mExceptionsButton ) mExceptionsButton->setEnabled( enabled ); 807 if ( mExceptionsButton ) mExceptionsButton->setEnabled( enabled );
808 mRuleBox->setEnabled( enabled ); 808 mRuleBox->setEnabled( enabled );
809} 809}
810 810
811void KOEditorRecurrence::showCurrentRule( int current ) 811void KOEditorRecurrence::showCurrentRule( int current )
812{ 812{
813 switch ( current ) { 813 switch ( current ) {
814 case Daily: 814 case Daily:
815 mRuleStack->raiseWidget( mDaily ); 815 mRuleStack->raiseWidget( mDaily );
816 break; 816 break;
817 case Weekly: 817 case Weekly:
818 mRuleStack->raiseWidget( mWeekly ); 818 mRuleStack->raiseWidget( mWeekly );
819 break; 819 break;
820 case Monthly: 820 case Monthly:
821 mRuleStack->raiseWidget( mMonthly ); 821 mRuleStack->raiseWidget( mMonthly );
822 break; 822 break;
823 default: 823 default:
824 case Yearly: 824 case Yearly:
825 mRuleStack->raiseWidget( mYearly ); 825 mRuleStack->raiseWidget( mYearly );
826 break; 826 break;
827 } 827 }
828} 828}
829 829
830void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end ) 830void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end )
831{ 831{
832// kdDebug() << "KOEditorRecurrence::setDateTimes" << endl; 832// kdDebug() << "KOEditorRecurrence::setDateTimes" << endl;
833 833
834 mRecurrenceRange->setDateTimes( start, end ); 834 mRecurrenceRange->setDateTimes( start, end );
835 mExceptions->setDefaults( end ); 835 mExceptions->setDefaults( end );
836 836
837} 837}
838 838
839void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) 839void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool )
840{ 840{
841 841
842 // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() ); 842 // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() );
843 setDateTimes( from, to ); 843 setDateTimes( from, to );
844 844
845 bool enabled = false; 845 bool enabled = false;
846 mEnabledCheck->setChecked( enabled ); 846 mEnabledCheck->setChecked( enabled );
847 setEnabled( enabled ); 847 setEnabled( enabled );
848 848
849 mExceptions->setDefaults( to ); 849 mExceptions->setDefaults( to );
850 mRecurrenceRange->setDefaults( to ); 850 mRecurrenceRange->setDefaults( to );
851 851
852 mRecurrenceChooser->setType( RecurrenceChooser::Weekly ); 852 mRecurrenceChooser->setType( RecurrenceChooser::Weekly );
853 showCurrentRule( mRecurrenceChooser->type() ); 853 showCurrentRule( mRecurrenceChooser->type() );
854 854
855 mDaily->setFrequency( 1 ); 855 mDaily->setFrequency( 1 );
856 856
857 mWeekly->setFrequency( 1 ); 857 mWeekly->setFrequency( 1 );
858 QBitArray days( 7 ); 858 QBitArray days( 7 );
859 days.fill( 0 ); 859 days.fill( 0 );
860 days.setBit( from.date().dayOfWeek()- 1); 860 days.setBit( from.date().dayOfWeek()- 1);
861 mWeekly->setDays( days ); 861 mWeekly->setDays( days );
862 mMonthly->setFrequency( 1 ); 862 mMonthly->setFrequency( 1 );
863 mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); 863 mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 );
864 mMonthly->setByDay( from.date().day()-1 ); 864 mMonthly->setByDay( from.date().day()-1 );
865 mYearly->setFrequency( 1 ); 865 mYearly->setFrequency( 1 );
866 mYearly->setByDay( from.date().dayOfYear() ); 866 mYearly->setByDay( from.date().dayOfYear() );
867 mYearly->setByMonth( from.date().month(), from.date().day() ); 867 mYearly->setByMonth( from.date().month(), from.date().day() );
868} 868}
869 869
870void KOEditorRecurrence::readEvent(Incidence *event) 870void KOEditorRecurrence::readEvent(Incidence *event)
871{ 871{
872 872
873 QDateTime dtEnd; 873 QDateTime dtEnd;
874 if ( event->type() == "Event" ) 874 if ( event->type() == "Event" )
875 dtEnd = ((Event*)event)->dtEnd(); 875 dtEnd = ((Event*)event)->dtEnd();
876 else 876 else
877 dtEnd = ((Todo*)event)->dtDue(); 877 dtEnd = ((Todo*)event)->dtDue();
878 878
879 setDefaults( event->dtStart(), dtEnd, true ); 879 setDefaults( event->dtStart(), dtEnd, true );
880 QBitArray rDays( 7 ); 880 QBitArray rDays( 7 );
881 QPtrList<Recurrence::rMonthPos> rmp; 881 QPtrList<Recurrence::rMonthPos> rmp;
882 QPtrList<int> rmd; 882 QPtrList<int> rmd;
883 int day = 0; 883 int day = 0;
884 int count = 0; 884 int count = 0;
885 int month = 0; 885 int month = 0;
886 setDateTimes( event->dtStart(), dtEnd ); 886 setDateTimes( event->dtStart(), dtEnd );
887 887
888 Recurrence *r = event->recurrence(); 888 Recurrence *r = event->recurrence();
889 int f = r->frequency(); 889 int f = r->frequency();
890 890
891 int recurs = r->doesRecur(); 891 int recurs = r->doesRecur();
892 892
893 mEnabledCheck->setChecked( recurs ); 893 mEnabledCheck->setChecked( recurs );
894 setEnabled( recurs ); 894 setEnabled( recurs );
895 895
896 int recurrenceType = RecurrenceChooser::Weekly; 896 int recurrenceType = RecurrenceChooser::Weekly;
897 897
898 switch ( recurs ) { 898 switch ( recurs ) {
899 case Recurrence::rNone: 899 case Recurrence::rNone:
900 setDefaults( event->dtStart(), dtEnd, true ); 900 setDefaults( event->dtStart(), dtEnd, true );
901 break; 901 break;
902 case Recurrence::rDaily: 902 case Recurrence::rDaily:
903 recurrenceType = RecurrenceChooser::Daily; 903 recurrenceType = RecurrenceChooser::Daily;
904 mDaily->setFrequency( f ); 904 mDaily->setFrequency( f );
905 break; 905 break;
906 case Recurrence::rWeekly: 906 case Recurrence::rWeekly:
907 recurrenceType = RecurrenceChooser::Weekly; 907 recurrenceType = RecurrenceChooser::Weekly;
908 mWeekly->setFrequency( f ); 908 mWeekly->setFrequency( f );
909 mWeekly->setDays( r->days() ); 909 mWeekly->setDays( r->days() );
910 break; 910 break;
911 case Recurrence::rMonthlyPos: 911 case Recurrence::rMonthlyPos:
912 // we only handle one possibility in the list right now, 912 // we only handle one possibility in the list right now,
913 // so I have hardcoded calls with first(). If we make the GUI 913 // so I have hardcoded calls with first(). If we make the GUI
914 // more extended, this can be changed. 914 // more extended, this can be changed.
915 recurrenceType = RecurrenceChooser::Monthly; 915 recurrenceType = RecurrenceChooser::Monthly;
916 916
917 rmp = r->monthPositions(); 917 rmp = r->monthPositions();
918 if ( rmp.first()->negative ) 918 if ( rmp.first()->negative )
919 count = 5 - rmp.first()->rPos - 1; 919 count = 5 - rmp.first()->rPos - 1;
920 else 920 else
921 count = rmp.first()->rPos - 1; 921 count = rmp.first()->rPos - 1;
922 day = 0; 922 day = 0;
923 while ( !rmp.first()->rDays.testBit( day ) ) ++day; 923 while ( !rmp.first()->rDays.testBit( day ) ) ++day;
924 mMonthly->setByPos( count, day ); 924 mMonthly->setByPos( count, day );
925 925
926 mMonthly->setFrequency( f ); 926 mMonthly->setFrequency( f );
927 927
928 break; 928 break;
929 case Recurrence::rMonthlyDay: 929 case Recurrence::rMonthlyDay:
930 recurrenceType = RecurrenceChooser::Monthly; 930 recurrenceType = RecurrenceChooser::Monthly;
931 931
932 rmd = r->monthDays(); 932 rmd = r->monthDays();
933 day = *rmd.first() - 1; 933 day = *rmd.first() - 1;
934 mMonthly->setByDay( day ); 934 mMonthly->setByDay( day );
935 935
936 mMonthly->setFrequency( f ); 936 mMonthly->setFrequency( f );
937 937
938 break; 938 break;
939 case Recurrence::rYearlyMonth: 939 case Recurrence::rYearlyMonth:
940 { 940 {
941 recurrenceType = RecurrenceChooser::Yearly; 941 recurrenceType = RecurrenceChooser::Yearly;
942 qDebug("Recurrence::rYearlyMonth: "); 942 qDebug("Recurrence::rYearlyMonth: ");
943 day = event->dtStart().date().day(); 943 day = event->dtStart().date().day();
944 rmd = r->yearNums(); 944 rmd = r->yearNums();
945 if ( rmd.count() > 0 ) 945 if ( rmd.count() > 0 )
946 month = *rmd.first(); 946 month = *rmd.first();
947 else 947 else
948 month = event->dtStart().date().month() ; 948 month = event->dtStart().date().month() ;
949 mYearly->setByMonth( month, day ); 949 mYearly->setByMonth( month, day );
950#if 0 950#if 0
951 qDebug("2day = %d ",day ); 951 qDebug("2day = %d ",day );
952 QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions(); 952 QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions();
953 int month; 953 int month;
954 if ( !monthlist.isEmpty() ) { 954 if ( !monthlist.isEmpty() ) {
955 month = monthlist.first()->rPos ; 955 month = monthlist.first()->rPos ;
956 } else { 956 } else {
957 month = event->dtStart().date().month() ; 957 month = event->dtStart().date().month() ;
958 } 958 }
959 mYearly->setByMonth( day, month ); 959 mYearly->setByMonth( day, month );
960#endif 960#endif
961 mYearly->setFrequency( f ); 961 mYearly->setFrequency( f );
962 } 962 }
963 963
964 break; 964 break;
965 case Recurrence::rYearlyDay: 965 case Recurrence::rYearlyDay:
966 qDebug("Recurrence::rYearlyDay: "); 966 qDebug("Recurrence::rYearlyDay: ");
967 recurrenceType = RecurrenceChooser::Yearly; 967 recurrenceType = RecurrenceChooser::Yearly;
968 mYearly->setByDay( event->dtStart().date().dayOfYear() ); 968 mYearly->setByDay( event->dtStart().date().dayOfYear() );
969 mYearly->setFrequency( f ); 969 mYearly->setFrequency( f );
970 break; 970 break;
971 default: 971 default:
972 setDefaults( event->dtStart(), dtEnd, true ); 972 setDefaults( event->dtStart(), dtEnd, true );
973 break; 973 break;
974 } 974 }
975 975
976 mRecurrenceChooser->setType( recurrenceType ); 976 mRecurrenceChooser->setType( recurrenceType );
977 showCurrentRule( recurrenceType ); 977 showCurrentRule( recurrenceType );
978 978
979 mRecurrenceRange->setDateTimes( event->dtStart() ); 979 mRecurrenceRange->setDateTimes( event->dtStart() );
980 980
981 if ( r->doesRecur() ) { 981 if ( r->doesRecur() ) {
982 mRecurrenceRange->setDuration( r->duration() ); 982 mRecurrenceRange->setDuration( r->duration() );
983 if ( r->duration() == 0 ) 983 if ( r->duration() == 0 )
984 { 984 {
985 if ( r->endDate() < event->dtStart().date() ) 985 if ( r->endDate() < event->dtStart().date() )
986 mRecurrenceRange->setEndDate( event->dtStart().date() ); 986 mRecurrenceRange->setEndDate( event->dtStart().date() );
987 else 987 else
988 mRecurrenceRange->setEndDate( r->endDate() ); 988 mRecurrenceRange->setEndDate( r->endDate() );
989 } else 989 } else
990 mRecurrenceRange->setEndDate( event->dtStart().date() ); 990 mRecurrenceRange->setEndDate( event->dtStart().date() );
991 } 991 }
992 992
993 mExceptions->setDates( event->exDates() ); 993 mExceptions->setDates( event->exDates() );
994} 994}
995 995
996void KOEditorRecurrence::writeEvent( Incidence *event ) 996void KOEditorRecurrence::writeEvent( Incidence *event )
997{ 997{
998 Recurrence *r = event->recurrence(); 998 Recurrence *r = event->recurrence();
999 999
1000 // clear out any old settings; 1000 // clear out any old settings;
1001 r->unsetRecurs(); 1001 r->unsetRecurs();
1002 1002
1003 if ( mEnabledCheck->isChecked() ) { 1003 if ( mEnabledCheck->isChecked() ) {
1004 int duration = mRecurrenceRange->duration(); 1004 int duration = mRecurrenceRange->duration();
1005 QDate endDate; 1005 QDate endDate;
1006 if ( duration == 0 ) endDate = mRecurrenceRange->endDate(); 1006 if ( duration == 0 ) endDate = mRecurrenceRange->endDate();
1007 1007
1008 int recurrenceType = mRecurrenceChooser->type(); 1008 int recurrenceType = mRecurrenceChooser->type();
1009 1009
1010 if ( recurrenceType == RecurrenceChooser::Daily ) { 1010 if ( recurrenceType == RecurrenceChooser::Daily ) {
1011 int freq = mDaily->frequency(); 1011 int freq = mDaily->frequency();
1012 if ( duration != 0 ) r->setDaily( freq, duration ); 1012 if ( duration != 0 ) r->setDaily( freq, duration );
1013 else r->setDaily( freq, endDate ); 1013 else r->setDaily( freq, endDate );
1014 } else if ( recurrenceType == RecurrenceChooser::Weekly ) { 1014 } else if ( recurrenceType == RecurrenceChooser::Weekly ) {
1015 int freq = mWeekly->frequency(); 1015 int freq = mWeekly->frequency();
1016 QBitArray days = mWeekly->days(); 1016 QBitArray days = mWeekly->days();
1017 int j; 1017 int j;
1018 bool found = false; 1018 bool found = false;
1019 for (j = 0; j < 7 ; ++j ) { 1019 for (j = 0; j < 7 ; ++j ) {
1020 found |=days.at(j); 1020 found |=days.at(j);
1021 } 1021 }
1022 if ( !found ) { 1022 if ( !found ) {
1023 days.setBit( event->dtStart().date().dayOfWeek()-1); 1023 days.setBit( event->dtStart().date().dayOfWeek()-1);
1024 qDebug("bit set %d ", event->dtStart().date().dayOfWeek()-1); 1024 qDebug("bit set %d ", event->dtStart().date().dayOfWeek()-1);
1025 } 1025 }
1026 if ( duration != 0 ) r->setWeekly( freq, days, duration ); 1026 if ( duration != 0 ) r->setWeekly( freq, days, duration );
1027 else r->setWeekly( freq, days, endDate ); 1027 else r->setWeekly( freq, days, endDate );
1028 } else if ( recurrenceType == RecurrenceChooser::Monthly ) { 1028 } else if ( recurrenceType == RecurrenceChooser::Monthly ) {
1029 int freq = mMonthly->frequency(); 1029 int freq = mMonthly->frequency();
1030 if ( mMonthly->byPos() ) { 1030 if ( mMonthly->byPos() ) {
1031 int pos = mMonthly->count(); 1031 int pos = mMonthly->count();
1032 1032
1033 QBitArray days( 7 ); 1033 QBitArray days( 7 );
1034 days.fill( false ); 1034 days.fill( false );
1035 1035
1036 days.setBit( mMonthly->weekday() ); 1036 days.setBit( mMonthly->weekday() );
1037 if ( duration != 0 ) 1037 if ( duration != 0 )
1038 r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); 1038 r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
1039 else 1039 else
1040 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); 1040 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
1041 r->addMonthlyPos( pos, days ); 1041 r->addMonthlyPos( pos, days );
1042 } else { 1042 } else {
1043 // it's by day 1043 // it's by day
1044 int day = mMonthly->day(); 1044 int day = mMonthly->day();
1045 1045
1046 if ( duration != 0 ) { 1046 if ( duration != 0 ) {
1047 r->setMonthly( Recurrence::rMonthlyDay, freq, duration ); 1047 r->setMonthly( Recurrence::rMonthlyDay, freq, duration );
1048 } else { 1048 } else {
1049 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); 1049 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate );
1050 } 1050 }
1051 r->addMonthlyDay( day ); 1051 r->addMonthlyDay( day );
1052 } 1052 }
1053 } else if ( recurrenceType == RecurrenceChooser::Yearly ) { 1053 } else if ( recurrenceType == RecurrenceChooser::Yearly ) {
1054 qDebug("RecurrenceChooser::Yearly "); 1054 qDebug("RecurrenceChooser::Yearly ");
1055 int freq = mYearly->frequency(); 1055 int freq = mYearly->frequency();
1056 if ( mYearly->byDay() ) { 1056 if ( mYearly->byDay() ) {
1057 if ( duration != 0 ) { 1057 if ( duration != 0 ) {
1058 r->setYearly( Recurrence::rYearlyDay, freq, duration ); 1058 r->setYearly( Recurrence::rYearlyDay, freq, duration );
1059 } else { 1059 } else {
1060 r->setYearly( Recurrence::rYearlyDay, freq, endDate ); 1060 r->setYearly( Recurrence::rYearlyDay, freq, endDate );
1061 } 1061 }
1062 r->addYearlyNum( event->dtStart().date().dayOfYear() ); 1062 r->addYearlyNum( event->dtStart().date().dayOfYear() );
1063 } else { 1063 } else {
1064 if ( duration != 0 ) { 1064 if ( duration != 0 ) {
1065 r->setYearly( Recurrence::rYearlyMonth, freq, duration ); 1065 r->setYearly( Recurrence::rYearlyMonth, freq, duration );
1066 } else { 1066 } else {
1067 r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); 1067 r->setYearly( Recurrence::rYearlyMonth, freq, endDate );
1068 } 1068 }
1069 r->addYearlyNum( mYearly->month() ); 1069 r->addYearlyNum( mYearly->month() );
1070 } 1070 }
1071 1071
1072 } 1072 }
1073 1073
1074 event->setExDates( mExceptions->dates() ); 1074 event->setExDates( mExceptions->dates() );
1075 } 1075 }
1076} 1076}
1077 1077
1078void KOEditorRecurrence::setDateTimeStr( const QString &str ) 1078void KOEditorRecurrence::setDateTimeStr( const QString &str )
1079{ 1079{
1080 mDateTimeLabel->setText( str ); 1080 mDateTimeLabel->setText( str );
1081} 1081}
1082 1082
1083bool KOEditorRecurrence::validateInput() 1083bool KOEditorRecurrence::validateInput()
1084{ 1084{
1085 // Check input here 1085 // Check input here
1086 1086
1087 return true; 1087 return true;
1088} 1088}
1089 1089
1090void KOEditorRecurrence::showExceptionsDialog() 1090void KOEditorRecurrence::showExceptionsDialog()
1091{ 1091{
1092 DateList dates = mExceptions->dates(); 1092 DateList dates = mExceptions->dates();
1093 int result = mExceptionsDialog->exec(); 1093 int result = mExceptionsDialog->exec();
1094 if ( result == QDialog::Rejected ) mExceptions->setDates( dates ); 1094 if ( result == QDialog::Rejected ) mExceptions->setDates( dates );
1095} 1095}
1096 1096
1097void KOEditorRecurrence::showRecurrenceRangeDialog() 1097void KOEditorRecurrence::showRecurrenceRangeDialog()
1098{ 1098{
1099 int duration = mRecurrenceRange->duration(); 1099 int duration = mRecurrenceRange->duration();
1100 QDate endDate = mRecurrenceRange->endDate(); 1100 QDate endDate = mRecurrenceRange->endDate();
1101 1101
1102 int result = mRecurrenceRangeDialog->exec(); 1102 int result = mRecurrenceRangeDialog->exec();
1103 if ( result == QDialog::Rejected ) { 1103 if ( result == QDialog::Rejected ) {
1104 mRecurrenceRange->setDuration( duration ); 1104 mRecurrenceRange->setDuration( duration );
1105 mRecurrenceRange->setEndDate( endDate ); 1105 mRecurrenceRange->setEndDate( endDate );
1106 } 1106 }
1107 1107
1108} 1108}
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 51e2524..6a05cc8 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -1,436 +1,437 @@
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#include <qtabwidget.h> 33#include <qtabwidget.h>
34 34
35#include <kiconloader.h> 35#include <kiconloader.h>
36#include <klocale.h> 36#include <klocale.h>
37#include <kfiledialog.h> 37#include <kfiledialog.h>
38#include <kstandarddirs.h> 38#include <kstandarddirs.h>
39#include <kmessagebox.h> 39#include <kmessagebox.h>
40 40
41#include <libkdepim/categoryselectdialog.h> 41#include <libkdepim/categoryselectdialog.h>
42#include <libkcal/calendarlocal.h> 42#include <libkcal/calendarlocal.h>
43#include <libkcal/calendarresources.h> 43#include <libkcal/calendarresources.h>
44#include <libkcal/resourcecalendar.h> 44#include <libkcal/resourcecalendar.h>
45#include <libkcal/icalformat.h> 45#include <libkcal/icalformat.h>
46#include <kresources/resourceselectdialog.h> 46#include <kresources/resourceselectdialog.h>
47#include <libkdepim/kdateedit.h> 47#include <libkdepim/kdateedit.h>
48 48
49#include "koprefs.h" 49#include "koprefs.h"
50#include "kolocationbox.h" 50#include "kolocationbox.h"
51 51
52#include "kotodoeditor.h" 52#include "kotodoeditor.h"
53extern int globalFlagBlockAgenda; 53extern int globalFlagBlockAgenda;
54 54
55KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : 55KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) :
56 KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent ) 56 KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent )
57{ 57{
58 mTodo = 0; 58 mTodo = 0;
59 mRelatedTodo = 0; 59 mRelatedTodo = 0;
60 findButton(User1)->hide(); 60 findButton(User1)->hide();
61 init(); 61 init();
62} 62}
63 63
64KOTodoEditor::~KOTodoEditor() 64KOTodoEditor::~KOTodoEditor()
65{ 65{
66 emit dialogClose( mTodo ); 66 emit dialogClose( mTodo );
67} 67}
68 68
69void KOTodoEditor::init() 69void KOTodoEditor::init()
70{ 70{
71 setupGeneral(); 71 setupGeneral();
72 setupAttendeesTab(); 72 setupAttendeesTab();
73 setupRecurrence(); 73 setupRecurrence();
74 connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence())); 74 connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence()));
75 mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") );
75} 76}
76void KOTodoEditor::setupRecurrence() 77void KOTodoEditor::setupRecurrence()
77{ 78{
78 QFrame *topFrame = addPage( i18n("Recurrence") ); 79 QFrame *topFrame = addPage( i18n("Recurrence") );
79 QBoxLayout *topLayout = new QVBoxLayout( topFrame ); 80 QBoxLayout *topLayout = new QVBoxLayout( topFrame );
80 81
81 mRecurrence = new KOEditorRecurrence( topFrame ); 82 mRecurrence = new KOEditorRecurrence( topFrame );
82 topLayout->addWidget( mRecurrence ); 83 topLayout->addWidget( mRecurrence );
83} 84}
84 85
85void KOTodoEditor::setCategories( QString s ) 86void KOTodoEditor::setCategories( QString s )
86{ 87{
87 mGeneral->setCategories(s); 88 mGeneral->setCategories(s);
88} 89}
89void KOTodoEditor::setSecrecy( int sec ) 90void KOTodoEditor::setSecrecy( int sec )
90{ 91{
91 mGeneral->setSecrecy( sec ); 92 mGeneral->setSecrecy( sec );
92} 93}
93void KOTodoEditor::reload() 94void KOTodoEditor::reload()
94{ 95{
95 if ( mTodo ) readTodo( mTodo ); 96 if ( mTodo ) readTodo( mTodo );
96} 97}
97 98
98void KOTodoEditor::setupGeneral() 99void KOTodoEditor::setupGeneral()
99{ 100{
100 mGeneral = new KOEditorGeneralTodo(this); 101 mGeneral = new KOEditorGeneralTodo(this);
101 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); 102 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
102 103
103 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); 104 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
104 //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), 105 //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)),
105 // mGeneral,SLOT(setCategories(const QString &))); 106 // mGeneral,SLOT(setCategories(const QString &)));
106 107
107 if (KOPrefs::instance()->mCompactDialogs) { 108 if (KOPrefs::instance()->mCompactDialogs) {
108 QFrame *topFrame = addPage(i18n("General")); 109 QFrame *topFrame = addPage(i18n("General"));
109 110
110 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 111 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
111 if ( QApplication::desktop()->width() < 480 ) { 112 if ( QApplication::desktop()->width() < 480 ) {
112 topLayout->setMargin(1); 113 topLayout->setMargin(1);
113 topLayout->setSpacing(1); 114 topLayout->setSpacing(1);
114 } else { 115 } else {
115 topLayout->setMargin(marginHint()-1); 116 topLayout->setMargin(marginHint()-1);
116 topLayout->setSpacing(spacingHint()-1); 117 topLayout->setSpacing(spacingHint()-1);
117 } 118 }
118 mGeneral->initHeader(topFrame,topLayout); 119 mGeneral->initHeader(topFrame,topLayout);
119 mGeneral->initTime(topFrame,topLayout); 120 mGeneral->initTime(topFrame,topLayout);
120 mGeneral->initAlarm(topFrame,topLayout); 121 mGeneral->initAlarm(topFrame,topLayout);
121 mGeneral->enableAlarm( false ); 122 mGeneral->enableAlarm( false );
122 123
123 124
124 QBoxLayout *priorityLayout; 125 QBoxLayout *priorityLayout;
125 if ( QApplication::desktop()->width() < 500 ) 126 if ( QApplication::desktop()->width() < 500 )
126 priorityLayout = new QVBoxLayout( topLayout ); 127 priorityLayout = new QVBoxLayout( topLayout );
127 else 128 else
128 priorityLayout = new QHBoxLayout( topLayout ); 129 priorityLayout = new QHBoxLayout( topLayout );
129 QWidget* prioWidget = new QWidget (topFrame); 130 QWidget* prioWidget = new QWidget (topFrame);
130 priorityLayout->addWidget( prioWidget ); 131 priorityLayout->addWidget( prioWidget );
131 QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget); 132 QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget);
132 133
133 134
134 QIconSet icon; 135 QIconSet icon;
135 if ( QApplication::desktop()->width() < 321 ) 136 if ( QApplication::desktop()->width() < 321 )
136 icon = SmallIcon("fileimport16"); 137 icon = SmallIcon("fileimport16");
137 else 138 else
138 icon = SmallIcon("fileimport"); 139 icon = SmallIcon("fileimport");
139 QPushButton * loadTemplate = new QPushButton( prioWidget); 140 QPushButton * loadTemplate = new QPushButton( prioWidget);
140 loadTemplate->setIconSet (icon ) ; 141 loadTemplate->setIconSet (icon ) ;
141 int size = loadTemplate->sizeHint().height(); 142 int size = loadTemplate->sizeHint().height();
142 loadTemplate->setFixedSize( size, size ); 143 loadTemplate->setFixedSize( size, size );
143 if ( QApplication::desktop()->width() < 321 ) 144 if ( QApplication::desktop()->width() < 321 )
144 icon = SmallIcon("fileexport16"); 145 icon = SmallIcon("fileexport16");
145 else 146 else
146 icon = SmallIcon("fileexport"); 147 icon = SmallIcon("fileexport");
147 QPushButton * saveTemplate = new QPushButton( prioWidget); 148 QPushButton * saveTemplate = new QPushButton( prioWidget);
148 saveTemplate->setIconSet (icon ) ; 149 saveTemplate->setIconSet (icon ) ;
149 saveTemplate->setFixedSize( size, size ); 150 saveTemplate->setFixedSize( size, size );
150 151
151 priorityLayout2->addWidget(loadTemplate); 152 priorityLayout2->addWidget(loadTemplate);
152 priorityLayout2->addWidget(saveTemplate); 153 priorityLayout2->addWidget(saveTemplate);
153 mGeneral->initPriority(prioWidget,priorityLayout2); 154 mGeneral->initPriority(prioWidget,priorityLayout2);
154 mGeneral->initCategories( topFrame, priorityLayout ); 155 mGeneral->initCategories( topFrame, priorityLayout );
155 topLayout->addStretch(1); 156 topLayout->addStretch(1);
156 157
157 QFrame *topFrame2 = addPage(i18n("Details")); 158 QFrame *topFrame2 = addPage(i18n("Details"));
158 159
159 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); 160 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2);
160 topLayout2->setMargin(marginHint()); 161 topLayout2->setMargin(marginHint());
161 topLayout2->setSpacing(spacingHint()); 162 topLayout2->setSpacing(spacingHint());
162 163
163 QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 ); 164 QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 );
164 mGeneral->initCompletion(topFrame2,completionLayout); 165 mGeneral->initCompletion(topFrame2,completionLayout);
165 166
166 167
167 mGeneral->initSecrecy( topFrame2, topLayout2 ); 168 mGeneral->initSecrecy( topFrame2, topLayout2 );
168 mGeneral->initDescription(topFrame2,topLayout2); 169 mGeneral->initDescription(topFrame2,topLayout2);
169 170
170 // QHBox * hb = new QHBox ( topFrame2 ); 171 // QHBox * hb = new QHBox ( topFrame2 );
171 // topLayout2->addWidget(hb); 172 // topLayout2->addWidget(hb);
172 // hb->setSpacing( 3 ); 173 // hb->setSpacing( 3 );
173 174
174 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 175 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
175 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 176 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
176 177
177 } else { 178 } else {
178 QFrame *topFrame = addPage(i18n("General")); 179 QFrame *topFrame = addPage(i18n("General"));
179 180
180 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 181 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
181 topLayout->setSpacing(spacingHint()); 182 topLayout->setSpacing(spacingHint());
182 183
183 mGeneral->initHeader(topFrame,topLayout); 184 mGeneral->initHeader(topFrame,topLayout);
184 mGeneral->initTime(topFrame,topLayout); 185 mGeneral->initTime(topFrame,topLayout);
185 mGeneral->initStatus(topFrame,topLayout); 186 mGeneral->initStatus(topFrame,topLayout);
186 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 187 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
187 mGeneral->initAlarm(topFrame,alarmLineLayout); 188 mGeneral->initAlarm(topFrame,alarmLineLayout);
188 mGeneral->initDescription(topFrame,topLayout); 189 mGeneral->initDescription(topFrame,topLayout);
189 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); 190 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout);
190 mGeneral->initCategories( topFrame, detailsLayout ); 191 mGeneral->initCategories( topFrame, detailsLayout );
191 mGeneral->initSecrecy( topFrame, detailsLayout ); 192 mGeneral->initSecrecy( topFrame, detailsLayout );
192 } 193 }
193 mGeneral->finishSetup(); 194 mGeneral->finishSetup();
194 195
195} 196}
196 197
197void KOTodoEditor::editTodo(Todo *todo, bool editDescription) 198void KOTodoEditor::editTodo(Todo *todo, bool editDescription)
198{ 199{
199 //init(); 200 //init();
200 201
201 mTodo = todo; 202 mTodo = todo;
202 readTodo(mTodo); 203 readTodo(mTodo);
203 if ( editDescription ) { 204 if ( editDescription ) {
204 showPage( 1 ); 205 showPage( 1 );
205 mGeneral->setFocusOn( 1 ); 206 mGeneral->setFocusOn( 1 );
206 } else { 207 } else {
207 showPage( 0 ); 208 showPage( 0 );
208 mGeneral->setFocusOn( 2 ); 209 mGeneral->setFocusOn( 2 );
209 } 210 }
210 checkRecurrence(); 211 checkRecurrence();
211} 212}
212 213
213void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay) 214void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay)
214{ 215{
215 //init(); 216 //init();
216 217
217 mTodo = 0; 218 mTodo = 0;
218 setDefaults(due,relatedTodo,allDay); 219 setDefaults(due,relatedTodo,allDay);
219} 220}
220 221
221void KOTodoEditor::loadDefaults() 222void KOTodoEditor::loadDefaults()
222{ 223{
223 setDefaults(QDateTime::currentDateTime().addDays(7),0,false); 224 setDefaults(QDateTime::currentDateTime().addDays(7),0,false);
224} 225}
225 226
226bool KOTodoEditor::processInput( bool emitTime ) 227bool KOTodoEditor::processInput( bool emitTime )
227{ 228{
228 if (!validateInput()) return false; 229 if (!validateInput()) return false;
229 230
230 Todo *todo = 0; 231 Todo *todo = 0;
231 232
232 if (mTodo) todo = mTodo; 233 if (mTodo) todo = mTodo;
233 else { 234 else {
234 todo = new Todo; 235 todo = new Todo;
235 todo->setOrganizer(KOPrefs::instance()->email()); 236 todo->setOrganizer(KOPrefs::instance()->email());
236 } 237 }
237 238
238 writeTodo(todo); 239 writeTodo(todo);
239 if ( emitTime ) { 240 if ( emitTime ) {
240 globalFlagBlockAgenda = 1; 241 globalFlagBlockAgenda = 1;
241 emit showAgendaView( false ); 242 emit showAgendaView( false );
242 if ( todo->hasDueDate() ) 243 if ( todo->hasDueDate() )
243 emit jumpToTime( todo->dtDue().date() ); 244 emit jumpToTime( todo->dtDue().date() );
244 globalFlagBlockAgenda = 2; 245 globalFlagBlockAgenda = 2;
245 } 246 }
246 if (mTodo) { 247 if (mTodo) {
247 todo->setRevision(todo->revision()+1); 248 todo->setRevision(todo->revision()+1);
248 emit todoChanged(todo); 249 emit todoChanged(todo);
249 } else { 250 } else {
250 mCalendar->addTodo(todo); 251 mCalendar->addTodo(todo);
251 mTodo = todo; 252 mTodo = todo;
252 emit todoAdded(todo); 253 emit todoAdded(todo);
253 } 254 }
254 255
255 return true; 256 return true;
256} 257}
257 258
258void KOTodoEditor::deleteTodo() 259void KOTodoEditor::deleteTodo()
259{ 260{
260 if (mTodo) { 261 if (mTodo) {
261 if (KOPrefs::instance()->mConfirm) { 262 if (KOPrefs::instance()->mConfirm) {
262 switch (msgItemDelete()) { 263 switch (msgItemDelete()) {
263 case KMessageBox::Continue: // OK 264 case KMessageBox::Continue: // OK
264 emit todoToBeDeleted(mTodo); 265 emit todoToBeDeleted(mTodo);
265 emit dialogClose(mTodo); 266 emit dialogClose(mTodo);
266 mCalendar->deleteTodo(mTodo); 267 mCalendar->deleteTodo(mTodo);
267 emit todoDeleted(); 268 emit todoDeleted();
268 reject(); 269 reject();
269 break; 270 break;
270 } 271 }
271 } 272 }
272 else { 273 else {
273 emit todoToBeDeleted(mTodo); 274 emit todoToBeDeleted(mTodo);
274 emit dialogClose(mTodo); 275 emit dialogClose(mTodo);
275 mCalendar->deleteTodo(mTodo); 276 mCalendar->deleteTodo(mTodo);
276 emit todoDeleted(); 277 emit todoDeleted();
277 reject(); 278 reject();
278 } 279 }
279 } else { 280 } else {
280 reject(); 281 reject();
281 } 282 }
282} 283}
283 284
284void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay) 285void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay)
285{ 286{
286 mRelatedTodo = relatedEvent; 287 mRelatedTodo = relatedEvent;
287 288
288 mGeneral->setDefaults(due,allDay); 289 mGeneral->setDefaults(due,allDay);
289 mDetails->setDefaults(); 290 mDetails->setDefaults();
290 showPage( 0 ); 291 showPage( 0 );
291 if ( mRelatedTodo ) { 292 if ( mRelatedTodo ) {
292 mGeneral->setCategories (mRelatedTodo->categoriesStr ()); 293 mGeneral->setCategories (mRelatedTodo->categoriesStr ());
293 mGeneral->setSecrecy (mRelatedTodo->secrecy ()); 294 mGeneral->setSecrecy (mRelatedTodo->secrecy ());
294 if ( mRelatedTodo->priority() < 3 ) 295 if ( mRelatedTodo->priority() < 3 )
295 mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1); 296 mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1);
296 mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": "); 297 mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": ");
297 int len = mRelatedTodo->summary().length(); 298 int len = mRelatedTodo->summary().length();
298 mGeneral->mSummaryEdit->lineEdit()->setFocus(); 299 mGeneral->mSummaryEdit->lineEdit()->setFocus();
299 mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 ); 300 mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 );
300 mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 ); 301 mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 );
301 302
302 } else 303 } else
303 mGeneral->setFocusOn( 2 ); 304 mGeneral->setFocusOn( 2 );
304 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); 305 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
305 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true); 306 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true);
306} 307}
307void KOTodoEditor::checkRecurrence() 308void KOTodoEditor::checkRecurrence()
308{ 309{
309 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { 310 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
310 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true ); 311 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true );
311 312
312 if ( mTodo ) 313 if ( mTodo )
313 mRecurrence->readEvent( mTodo ); 314 mRecurrence->readEvent( mTodo );
314 else { 315 else {
315 bool time = mGeneral->mTimeButton->isChecked(); 316 bool time = mGeneral->mTimeButton->isChecked();
316 QDateTime from,to; 317 QDateTime from,to;
317 if ( time ) { 318 if ( time ) {
318 to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ; 319 to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ;
319 from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ; 320 from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ;
320 } else { 321 } else {
321 to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ; 322 to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ;
322 from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ; 323 from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ;
323 } 324 }
324 if ( to < from ) 325 if ( to < from )
325 to = from; 326 to = from;
326 mRecurrence->setDefaults(from,to,!time); 327 mRecurrence->setDefaults(from,to,!time);
327 } 328 }
328 } else { 329 } else {
329 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); 330 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
330 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true); 331 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true);
331 } 332 }
332} 333}
333void KOTodoEditor::readTodo(Todo *todo) 334void KOTodoEditor::readTodo(Todo *todo)
334{ 335{
335 mGeneral->readTodo(todo); 336 mGeneral->readTodo(todo);
336 mDetails->readEvent(todo); 337 mDetails->readEvent(todo);
337 mRelatedTodo = 0;//todo->relatedTo(); 338 mRelatedTodo = 0;//todo->relatedTo();
338 // categories 339 // categories
339 // mCategoryDialog->setSelected(todo->categories()); 340 // mCategoryDialog->setSelected(todo->categories());
340 341
341 // We should handle read-only events here. 342 // We should handle read-only events here.
342} 343}
343 344
344void KOTodoEditor::writeTodo(Todo *event) 345void KOTodoEditor::writeTodo(Todo *event)
345{ 346{
346 mGeneral->writeTodo(event); 347 mGeneral->writeTodo(event);
347 mDetails->writeEvent(event); 348 mDetails->writeEvent(event);
348 349
349 // set related event, i.e. parent to-do in this case. 350 // set related event, i.e. parent to-do in this case.
350 if (mRelatedTodo) { 351 if (mRelatedTodo) {
351 event->setRelatedTo(mRelatedTodo); 352 event->setRelatedTo(mRelatedTodo);
352 } 353 }
353 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { 354 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
354 mRecurrence->writeEvent(event); 355 mRecurrence->writeEvent(event);
355 if ( event->doesRecur() ) { 356 if ( event->doesRecur() ) {
356 event->setRecurrenceID( event->dtStart().addSecs(-1) ); 357 event->setRecurrenceID( event->dtStart().addSecs(-1) );
357 event->setRecurDates(); 358 event->setRecurDates();
358 } else { 359 } else {
359 event->setHasRecurrenceID( false ); 360 event->setHasRecurrenceID( false );
360 } 361 }
361 } else { 362 } else {
362 event->setHasRecurrenceID( false ); 363 event->setHasRecurrenceID( false );
363 event->recurrence()->unsetRecurs(); 364 event->recurrence()->unsetRecurs();
364 } 365 }
365} 366}
366 367
367bool KOTodoEditor::validateInput() 368bool KOTodoEditor::validateInput()
368{ 369{
369 if (!mGeneral->validateInput()) return false; 370 if (!mGeneral->validateInput()) return false;
370 if (!mDetails->validateInput()) return false; 371 if (!mDetails->validateInput()) return false;
371 return true; 372 return true;
372} 373}
373 374
374int KOTodoEditor::msgItemDelete() 375int KOTodoEditor::msgItemDelete()
375{ 376{
376 return KMessageBox::warningContinueCancel(this, 377 return KMessageBox::warningContinueCancel(this,
377 i18n("This item will be permanently deleted."), 378 i18n("This item will be permanently deleted."),
378 i18n("KOrganizer Confirmation"),i18n("Delete")); 379 i18n("KOrganizer Confirmation"),i18n("Delete"));
379} 380}
380 381
381void KOTodoEditor::modified (int modification) 382void KOTodoEditor::modified (int modification)
382{ 383{
383 if (modification == KOGlobals::CATEGORY_MODIFIED || 384 if (modification == KOGlobals::CATEGORY_MODIFIED ||
384 KOGlobals::UNKNOWN_MODIFIED == modification ) 385 KOGlobals::UNKNOWN_MODIFIED == modification )
385 // mCategoryDialog->setSelected (mTodo->categories ()); 386 // mCategoryDialog->setSelected (mTodo->categories ());
386 mGeneral->modified (mTodo, modification); 387 mGeneral->modified (mTodo, modification);
387 388
388} 389}
389 390
390void KOTodoEditor::slotLoadTemplate() 391void KOTodoEditor::slotLoadTemplate()
391{ 392{
392 393
393 QString fileName =locateLocal( "templates", "todos" ); 394 QString fileName =locateLocal( "templates", "todos" );
394 QDir t_dir; 395 QDir t_dir;
395 if ( !t_dir.exists(fileName) ) 396 if ( !t_dir.exists(fileName) )
396 t_dir.mkdir ( fileName ); 397 t_dir.mkdir ( fileName );
397 fileName += "/todo"; 398 fileName += "/todo";
398 fileName = KFileDialog::getSaveFileName( fileName , "Load Todo template", this ); 399 fileName = KFileDialog::getSaveFileName( fileName , "Load Todo template", this );
399 if ( fileName.length() == 0 ) 400 if ( fileName.length() == 0 )
400 return; 401 return;
401 CalendarLocal cal; 402 CalendarLocal cal;
402 ICalFormat format; 403 ICalFormat format;
403 if ( !format.load( &cal, fileName ) ) { 404 if ( !format.load( &cal, fileName ) ) {
404 KMessageBox::error( this, i18n("Error loading template file\n '%1'.") 405 KMessageBox::error( this, i18n("Error loading template file\n '%1'.")
405 .arg( fileName ) ); 406 .arg( fileName ) );
406 return ; 407 return ;
407 } 408 }
408 QPtrList<Todo> todos = cal.todos(); 409 QPtrList<Todo> todos = cal.todos();
409 Todo * todo = todos.first(); 410 Todo * todo = todos.first();
410 if ( !todo ) { 411 if ( !todo ) {
411 KMessageBox::error( this, 412 KMessageBox::error( this,
412 i18n("Template does not\ncontain a valid Todo.")); 413 i18n("Template does not\ncontain a valid Todo."));
413 } else { 414 } else {
414 readTodo( todo ); 415 readTodo( todo );
415 } 416 }
416 417
417} 418}
418 419
419void KOTodoEditor::slotSaveTemplate() 420void KOTodoEditor::slotSaveTemplate()
420{ 421{
421 QString fileName =locateLocal( "templates", "todos" ); 422 QString fileName =locateLocal( "templates", "todos" );
422 QDir t_dir; 423 QDir t_dir;
423 if ( !t_dir.exists(fileName) ) 424 if ( !t_dir.exists(fileName) )
424 t_dir.mkdir ( fileName ); 425 t_dir.mkdir ( fileName );
425 fileName += "/todo"; 426 fileName += "/todo";
426 fileName = KFileDialog::getSaveFileName( fileName , "Save as Todo template", this ); 427 fileName = KFileDialog::getSaveFileName( fileName , "Save as Todo template", this );
427 if ( fileName.length() > 0 ) 428 if ( fileName.length() > 0 )
428 saveTemplate( fileName ); 429 saveTemplate( fileName );
429} 430}
430 431
431void KOTodoEditor::saveTemplate( const QString &templateName ) 432void KOTodoEditor::saveTemplate( const QString &templateName )
432{ 433{
433 Todo *todo = new Todo; 434 Todo *todo = new Todo;
434 writeTodo( todo ); 435 writeTodo( todo );
435 saveAsTemplate( todo, templateName ); 436 saveAsTemplate( todo, templateName );
436} 437}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 94f4677..ffc4d9a 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -566,1878 +566,1879 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
566 } 566 }
567 else if ( msg == "-showKO" ) { 567 else if ( msg == "-showKO" ) {
568 mView->viewManager()->showNextXView(); 568 mView->viewManager()->showNextXView();
569 } 569 }
570 else if ( msg == "-showWNext" ) { 570 else if ( msg == "-showWNext" ) {
571 mView->viewManager()->showWhatsNextView(); 571 mView->viewManager()->showWhatsNextView();
572 } 572 }
573 else if ( msg == "nextView()" ) { 573 else if ( msg == "nextView()" ) {
574 mView->viewManager()->showNextView(); 574 mView->viewManager()->showNextView();
575 } 575 }
576 else if ( msg == "-showNextXView" ) { 576 else if ( msg == "-showNextXView" ) {
577 mView->viewManager()->showNextXView(); 577 mView->viewManager()->showNextXView();
578 } 578 }
579 579
580 580
581 } 581 }
582 582
583 showMaximized(); 583 showMaximized();
584 raise(); 584 raise();
585} 585}
586 586
587QPixmap MainWindow::loadPixmap( QString name ) 587QPixmap MainWindow::loadPixmap( QString name )
588{ 588{
589 return SmallIcon( name ); 589 return SmallIcon( name );
590 590
591} 591}
592void MainWindow::initActions() 592void MainWindow::initActions()
593{ 593{
594 //KOPrefs::instance()->mShowFullMenu 594 //KOPrefs::instance()->mShowFullMenu
595 iconToolBar->clear(); 595 iconToolBar->clear();
596 KOPrefs *p = KOPrefs::instance(); 596 KOPrefs *p = KOPrefs::instance();
597 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 597 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
598 598
599 QPopupMenu *viewMenu = new QPopupMenu( this ); 599 QPopupMenu *viewMenu = new QPopupMenu( this );
600 QPopupMenu *actionMenu = new QPopupMenu( this ); 600 QPopupMenu *actionMenu = new QPopupMenu( this );
601 QPopupMenu *importMenu = new QPopupMenu( this ); 601 QPopupMenu *importMenu = new QPopupMenu( this );
602 QPopupMenu *importMenu_X = new QPopupMenu( this ); 602 QPopupMenu *importMenu_X = new QPopupMenu( this );
603 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 603 QPopupMenu *exportMenu_X = new QPopupMenu( this );
604 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 604 QPopupMenu *beamMenu_X = new QPopupMenu( this );
605 selectFilterMenu = new QPopupMenu( this ); 605 selectFilterMenu = new QPopupMenu( this );
606 selectFilterMenu->setCheckable( true ); 606 selectFilterMenu->setCheckable( true );
607 syncMenu = new QPopupMenu( this ); 607 syncMenu = new QPopupMenu( this );
608 configureAgendaMenu = new QPopupMenu( this ); 608 configureAgendaMenu = new QPopupMenu( this );
609 configureToolBarMenu = new QPopupMenu( this ); 609 configureToolBarMenu = new QPopupMenu( this );
610 QPopupMenu *helpMenu = new QPopupMenu( this ); 610 QPopupMenu *helpMenu = new QPopupMenu( this );
611 QIconSet icon; 611 QIconSet icon;
612 int pixWid = 22, pixHei = 22; 612 int pixWid = 22, pixHei = 22;
613 QString pathString = ""; 613 QString pathString = "";
614 if ( !p->mToolBarMiniIcons ) { 614 if ( !p->mToolBarMiniIcons ) {
615 if ( QApplication::desktop()->width() < 480 ) { 615 if ( QApplication::desktop()->width() < 480 ) {
616 pathString += "icons16/"; 616 pathString += "icons16/";
617 pixWid = 18; pixHei = 16; 617 pixWid = 18; pixHei = 16;
618 } 618 }
619 } else { 619 } else {
620 pathString += "iconsmini/"; 620 pathString += "iconsmini/";
621 pixWid = 18; pixHei = 16; 621 pixWid = 18; pixHei = 16;
622 } 622 }
623 if ( KOPrefs::instance()->mShowFullMenu ) { 623 if ( KOPrefs::instance()->mShowFullMenu ) {
624 QMenuBar *menuBar1; 624 QMenuBar *menuBar1;
625 menuBar1 = menuBar(); 625 menuBar1 = menuBar();
626 menuBar1->insertItem( i18n("File"), importMenu ); 626 menuBar1->insertItem( i18n("File"), importMenu );
627 menuBar1->insertItem( i18n("View"), viewMenu ); 627 menuBar1->insertItem( i18n("View"), viewMenu );
628 menuBar1->insertItem( i18n("Actions"), actionMenu ); 628 menuBar1->insertItem( i18n("Actions"), actionMenu );
629#ifdef DESKTOP_VERSION 629#ifdef DESKTOP_VERSION
630 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 630 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
631 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 631 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
632#else 632#else
633 menuBar1->insertItem( i18n("Sync"), syncMenu ); 633 menuBar1->insertItem( i18n("Sync"), syncMenu );
634 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 634 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
635#endif 635#endif
636 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 636 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
637 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 637 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
638 menuBar1->insertItem( i18n("Help"), helpMenu ); 638 menuBar1->insertItem( i18n("Help"), helpMenu );
639 } else { 639 } else {
640 QPEMenuBar *menuBar1; 640 QPEMenuBar *menuBar1;
641 menuBar1 = new QPEMenuBar( iconToolBar ); 641 menuBar1 = new QPEMenuBar( iconToolBar );
642 QPopupMenu *menuBar = new QPopupMenu( this ); 642 QPopupMenu *menuBar = new QPopupMenu( this );
643 icon = loadPixmap( pathString + "z_menu" ); 643 icon = loadPixmap( pathString + "z_menu" );
644 menuBar1->insertItem( icon.pixmap(), menuBar); 644 menuBar1->insertItem( icon.pixmap(), menuBar);
645 //menuBar1->insertItem( i18n("ME"), menuBar); 645 //menuBar1->insertItem( i18n("ME"), menuBar);
646 menuBar->insertItem( i18n("File"), importMenu ); 646 menuBar->insertItem( i18n("File"), importMenu );
647 menuBar->insertItem( i18n("View"), viewMenu ); 647 menuBar->insertItem( i18n("View"), viewMenu );
648 menuBar->insertItem( i18n("Actions"), actionMenu ); 648 menuBar->insertItem( i18n("Actions"), actionMenu );
649 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 649 menuBar->insertItem( i18n("Synchronize"), syncMenu );
650 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 650 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
651 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 651 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
652 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 652 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
653 menuBar->insertItem( i18n("Help"), helpMenu ); 653 menuBar->insertItem( i18n("Help"), helpMenu );
654 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 654 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
655 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 655 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
656 } 656 }
657 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 657 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
658 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 658 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
659 659
660 660
661 mWeekBgColor = iconToolBar->backgroundColor(); 661 mWeekBgColor = iconToolBar->backgroundColor();
662 mWeekPixmap.resize( pixWid , pixHei ); 662 mWeekPixmap.resize( pixWid , pixHei );
663 mWeekPixmap.fill( mWeekBgColor ); 663 mWeekPixmap.fill( mWeekBgColor );
664 icon = mWeekPixmap; 664 icon = mWeekPixmap;
665 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 665 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
666 if ( p-> mShowIconWeekNum ) 666 if ( p-> mShowIconWeekNum )
667 mWeekAction->addTo( iconToolBar ); 667 mWeekAction->addTo( iconToolBar );
668 mWeekFont = font(); 668 mWeekFont = font();
669 669
670 int fontPoint = mWeekFont.pointSize(); 670 int fontPoint = mWeekFont.pointSize();
671 QFontMetrics f( mWeekFont ); 671 QFontMetrics f( mWeekFont );
672 int fontWid = f.width( "30" ); 672 int fontWid = f.width( "30" );
673 while ( fontWid > pixWid ) { 673 while ( fontWid > pixWid ) {
674 --fontPoint; 674 --fontPoint;
675 mWeekFont.setPointSize( fontPoint ); 675 mWeekFont.setPointSize( fontPoint );
676 QFontMetrics f( mWeekFont ); 676 QFontMetrics f( mWeekFont );
677 fontWid = f.width( "30" ); 677 fontWid = f.width( "30" );
678 //qDebug("dec-- "); 678 //qDebug("dec-- ");
679 } 679 }
680 680
681 connect( mWeekAction, SIGNAL( activated() ), 681 connect( mWeekAction, SIGNAL( activated() ),
682 this, SLOT( weekAction() ) ); 682 this, SLOT( weekAction() ) );
683 683
684 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 684 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
685 if ( p->mShowIconFilterview ) { 685 if ( p->mShowIconFilterview ) {
686 icon = loadPixmap( pathString + "filter" ); 686 icon = loadPixmap( pathString + "filter" );
687 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 687 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
688 connect( actionFilterMenuTB, SIGNAL( activated() ), 688 connect( actionFilterMenuTB, SIGNAL( activated() ),
689 this, SLOT( fillFilterMenuTB() ) ); 689 this, SLOT( fillFilterMenuTB() ) );
690 actionFilterMenuTB->addTo( iconToolBar ); 690 actionFilterMenuTB->addTo( iconToolBar );
691 selectFilterMenuTB = new QPopupMenu( this ); 691 selectFilterMenuTB = new QPopupMenu( this );
692 selectFilterMenuTB->setCheckable( true ); 692 selectFilterMenuTB->setCheckable( true );
693 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 693 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
694 } 694 }
695 695
696 //#endif 696 //#endif
697 // ****************** 697 // ******************
698 QAction *action; 698 QAction *action;
699 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 699 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
700 configureToolBarMenu->setCheckable( true ); 700 configureToolBarMenu->setCheckable( true );
701 701
702 702
703 configureAgendaMenu->setCheckable( true ); 703 configureAgendaMenu->setCheckable( true );
704 int iii ; 704 int iii ;
705 for ( iii = 1;iii<= 10 ;++iii ){ 705 for ( iii = 1;iii<= 10 ;++iii ){
706 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 706 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
707 } 707 }
708 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 708 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
709 709
710 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 710 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
711 this, SLOT( showConfigureAgenda( ) ) ); 711 this, SLOT( showConfigureAgenda( ) ) );
712 712
713 icon = loadPixmap( pathString + "configure" ); 713 icon = loadPixmap( pathString + "configure" );
714 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 714 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
715 action->addTo( actionMenu ); 715 action->addTo( actionMenu );
716 connect( action, SIGNAL( activated() ), 716 connect( action, SIGNAL( activated() ),
717 mView, SLOT( edit_options() ) ); 717 mView, SLOT( edit_options() ) );
718 actionMenu->insertSeparator(); 718 actionMenu->insertSeparator();
719 719
720 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 720 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
721 action->addTo( actionMenu ); 721 action->addTo( actionMenu );
722 connect( action, SIGNAL( activated() ), 722 connect( action, SIGNAL( activated() ),
723 mView, SLOT( undo_delete() ) ); 723 mView, SLOT( undo_delete() ) );
724 actionMenu->insertSeparator(); 724 actionMenu->insertSeparator();
725 725
726 icon = loadPixmap( pathString + "newevent" ); 726 icon = loadPixmap( pathString + "newevent" );
727 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 727 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
728 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 728 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
729 configureToolBarMenu->insertSeparator(); 729 configureToolBarMenu->insertSeparator();
730 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 730 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
731 configureToolBarMenu->insertSeparator(); 731 configureToolBarMenu->insertSeparator();
732 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 732 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
733 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 733 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
734 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 734 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
735 ne_action->addTo( actionMenu ); 735 ne_action->addTo( actionMenu );
736 connect( ne_action, SIGNAL( activated() ), 736 connect( ne_action, SIGNAL( activated() ),
737 mView, SLOT( newEvent() ) ); 737 mView, SLOT( newEvent() ) );
738 icon = loadPixmap( pathString + "newtodo" ); 738 icon = loadPixmap( pathString + "newtodo" );
739 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 739 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
740 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 740 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
741 nt_action->addTo( actionMenu ); 741 nt_action->addTo( actionMenu );
742 connect( nt_action, SIGNAL( activated() ), 742 connect( nt_action, SIGNAL( activated() ),
743 mView, SLOT( newTodo() ) ); 743 mView, SLOT( newTodo() ) );
744 744
745 icon = loadPixmap( pathString + "today" ); 745 icon = loadPixmap( pathString + "today" );
746 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 746 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
747 today_action->addTo( viewMenu ); 747 today_action->addTo( viewMenu );
748 connect( today_action, SIGNAL( activated() ), 748 connect( today_action, SIGNAL( activated() ),
749 mView, SLOT( goToday() ) ); 749 mView, SLOT( goToday() ) );
750 viewMenu->insertSeparator(); 750 viewMenu->insertSeparator();
751 751
752 // *********************** 752 // ***********************
753 if ( KOPrefs::instance()->mVerticalScreen ) { 753 if ( KOPrefs::instance()->mVerticalScreen ) {
754 icon = SmallIcon( "1updownarrow" ); 754 icon = SmallIcon( "1updownarrow" );
755 } else { 755 } else {
756 icon = SmallIcon("1leftrightarrow" ); 756 icon = SmallIcon("1leftrightarrow" );
757 } 757 }
758 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 758 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
759 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 759 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
760 FSaction->addTo( viewMenu ); 760 FSaction->addTo( viewMenu );
761 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 761 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
762 762
763 icon = loadPixmap( pathString + "navi" ); 763 icon = loadPixmap( pathString + "navi" );
764 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 764 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
765 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 765 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
766 action->addTo( viewMenu ); 766 action->addTo( viewMenu );
767 connect( action, SIGNAL( activated() ), 767 connect( action, SIGNAL( activated() ),
768 mView, SLOT( toggleDateNavigatorWidget() ) ); 768 mView, SLOT( toggleDateNavigatorWidget() ) );
769 mToggleNav = action ; 769 mToggleNav = action ;
770 icon = loadPixmap( pathString + "filter" ); 770 icon = loadPixmap( pathString + "filter" );
771 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 771 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
772 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 772 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
773 action->addTo( viewMenu ); 773 action->addTo( viewMenu );
774 connect( action, SIGNAL( activated() ), 774 connect( action, SIGNAL( activated() ),
775 mView, SLOT( toggleFilter() ) ); 775 mView, SLOT( toggleFilter() ) );
776 mToggleFilter = action; 776 mToggleFilter = action;
777 icon = loadPixmap( pathString + "allday" ); 777 icon = loadPixmap( pathString + "allday" );
778 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 778 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
779 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 779 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
780 action->addTo( viewMenu ); 780 action->addTo( viewMenu );
781 connect( action, SIGNAL( activated() ), 781 connect( action, SIGNAL( activated() ),
782 mView, SLOT( toggleAllDaySize() ) ); 782 mView, SLOT( toggleAllDaySize() ) );
783 mToggleAllday = action; 783 mToggleAllday = action;
784 784
785 785
786 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 786 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
787 mToggleNav, SLOT( setEnabled ( bool ) ) ); 787 mToggleNav, SLOT( setEnabled ( bool ) ) );
788 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 788 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
789 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 789 mToggleFilter, SLOT( setEnabled ( bool ) ) );
790 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 790 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
791 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 791 mToggleAllday, SLOT( setEnabled ( bool ) ) );
792 792
793 viewMenu->insertSeparator(); 793 viewMenu->insertSeparator();
794 icon = loadPixmap( pathString + "picker" ); 794 icon = loadPixmap( pathString + "picker" );
795 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 795 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
796 action->addTo( viewMenu ); 796 action->addTo( viewMenu );
797 connect( action, SIGNAL( activated() ), 797 connect( action, SIGNAL( activated() ),
798 mView, SLOT( showDatePicker() ) ); 798 mView, SLOT( showDatePicker() ) );
799 action->addTo( iconToolBar ); 799 action->addTo( iconToolBar );
800 viewMenu->insertSeparator(); 800 viewMenu->insertSeparator();
801 801
802 if ( p-> mShowIconToggleFull ) 802 if ( p-> mShowIconToggleFull )
803 FSaction->addTo( iconToolBar ); 803 FSaction->addTo( iconToolBar );
804 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 804 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
805 805
806 //******************** 806 //********************
807 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 807 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
808 808
809 809
810 icon = loadPixmap( pathString + "whatsnext" ); 810 icon = loadPixmap( pathString + "whatsnext" );
811 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 811 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
812 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 812 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
813 whatsnext_action->addTo( viewMenu ); 813 whatsnext_action->addTo( viewMenu );
814 connect( whatsnext_action, SIGNAL( activated() ), 814 connect( whatsnext_action, SIGNAL( activated() ),
815 mView->viewManager(), SLOT( showWhatsNextView() ) ); 815 mView->viewManager(), SLOT( showWhatsNextView() ) );
816 816
817 icon = loadPixmap( pathString + "xdays" ); 817 icon = loadPixmap( pathString + "xdays" );
818 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 818 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
819 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 819 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
820 xdays_action->addTo( viewMenu ); 820 xdays_action->addTo( viewMenu );
821 connect( xdays_action, SIGNAL( activated() ), 821 connect( xdays_action, SIGNAL( activated() ),
822 mView->viewManager(), SLOT( showNextXView() ) ); 822 mView->viewManager(), SLOT( showNextXView() ) );
823 823
824 824
825 icon = loadPixmap( pathString + "journal" ); 825 icon = loadPixmap( pathString + "journal" );
826 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 826 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
827 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 827 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
828 viewjournal_action->addTo( viewMenu ); 828 viewjournal_action->addTo( viewMenu );
829 connect( viewjournal_action, SIGNAL( activated() ), 829 connect( viewjournal_action, SIGNAL( activated() ),
830 mView->viewManager(), SLOT( showJournalView() ) ); 830 mView->viewManager(), SLOT( showJournalView() ) );
831 831
832 832
833 icon = loadPixmap( pathString + "day" ); 833 icon = loadPixmap( pathString + "day" );
834 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 834 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
835 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 835 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
836 day1_action->addTo( viewMenu ); 836 day1_action->addTo( viewMenu );
837 // action->addTo( toolBar ); 837 // action->addTo( toolBar );
838 connect( day1_action, SIGNAL( activated() ), 838 connect( day1_action, SIGNAL( activated() ),
839 mView->viewManager(), SLOT( showDayView() ) ); 839 mView->viewManager(), SLOT( showDayView() ) );
840 840
841 icon = loadPixmap( pathString + "workweek" ); 841 icon = loadPixmap( pathString + "workweek" );
842 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 842 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
843 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 843 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
844 day5_action->addTo( viewMenu ); 844 day5_action->addTo( viewMenu );
845 connect( day5_action, SIGNAL( activated() ), 845 connect( day5_action, SIGNAL( activated() ),
846 mView->viewManager(), SLOT( showWorkWeekView() ) ); 846 mView->viewManager(), SLOT( showWorkWeekView() ) );
847 847
848 icon = loadPixmap( pathString + "week" ); 848 icon = loadPixmap( pathString + "week" );
849 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 849 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
850 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 850 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
851 day7_action->addTo( viewMenu ); 851 day7_action->addTo( viewMenu );
852 connect( day7_action, SIGNAL( activated() ), 852 connect( day7_action, SIGNAL( activated() ),
853 mView->viewManager(), SLOT( showWeekView() ) ); 853 mView->viewManager(), SLOT( showWeekView() ) );
854 854
855 icon = loadPixmap( pathString + "workweek2" ); 855 icon = loadPixmap( pathString + "workweek2" );
856 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 856 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
857 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 857 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
858 day6_action->addTo( viewMenu ); 858 day6_action->addTo( viewMenu );
859 connect( day6_action, SIGNAL( activated() ), 859 connect( day6_action, SIGNAL( activated() ),
860 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 860 mView->viewManager(), SLOT( showMonthViewWeek() ) );
861 861
862 icon = loadPixmap( pathString + "month" ); 862 icon = loadPixmap( pathString + "month" );
863 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 863 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
864 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 864 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
865 month_action->addTo( viewMenu ); 865 month_action->addTo( viewMenu );
866 connect( month_action, SIGNAL( activated() ), 866 connect( month_action, SIGNAL( activated() ),
867 mView->viewManager(), SLOT( showMonthView() ) ); 867 mView->viewManager(), SLOT( showMonthView() ) );
868 868
869 icon = loadPixmap( pathString + "list" ); 869 icon = loadPixmap( pathString + "list" );
870 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 870 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
871 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 871 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
872 showlist_action->addTo( viewMenu ); 872 showlist_action->addTo( viewMenu );
873 connect( showlist_action, SIGNAL( activated() ), 873 connect( showlist_action, SIGNAL( activated() ),
874 mView->viewManager(), SLOT( showListView() ) ); 874 mView->viewManager(), SLOT( showListView() ) );
875 875
876 icon = loadPixmap( pathString + "todo" ); 876 icon = loadPixmap( pathString + "todo" );
877 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 877 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
878 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 878 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
879 todoview_action->addTo( viewMenu ); 879 todoview_action->addTo( viewMenu );
880 connect( todoview_action, SIGNAL( activated() ), 880 connect( todoview_action, SIGNAL( activated() ),
881 mView->viewManager(), SLOT( showTodoView() ) ); 881 mView->viewManager(), SLOT( showTodoView() ) );
882 882
883 883
884 884
885#if 0 885#if 0
886 action = new QAction( "view_timespan", "Time Span", 0, this ); 886 action = new QAction( "view_timespan", "Time Span", 0, this );
887 action->addTo( viewMenu ); 887 action->addTo( viewMenu );
888 connect( action, SIGNAL( activated() ), 888 connect( action, SIGNAL( activated() ),
889 mView->viewManager(), SLOT( showTimeSpanView() ) ); 889 mView->viewManager(), SLOT( showTimeSpanView() ) );
890#endif 890#endif
891 891
892 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 892 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
893 this ); 893 this );
894 mNewSubTodoAction->addTo( actionMenu ); 894 mNewSubTodoAction->addTo( actionMenu );
895 connect( mNewSubTodoAction, SIGNAL( activated() ), 895 connect( mNewSubTodoAction, SIGNAL( activated() ),
896 mView, SLOT( newSubTodo() ) ); 896 mView, SLOT( newSubTodo() ) );
897 897
898 actionMenu->insertSeparator(); 898 actionMenu->insertSeparator();
899 899
900 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 900 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
901 mShowAction->addTo( actionMenu ); 901 mShowAction->addTo( actionMenu );
902 connect( mShowAction, SIGNAL( activated() ), 902 connect( mShowAction, SIGNAL( activated() ),
903 mView, SLOT( showIncidence() ) ); 903 mView, SLOT( showIncidence() ) );
904 904
905 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 905 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
906 mEditAction->addTo( actionMenu ); 906 mEditAction->addTo( actionMenu );
907 connect( mEditAction, SIGNAL( activated() ), 907 connect( mEditAction, SIGNAL( activated() ),
908 mView, SLOT( editIncidence() ) ); 908 mView, SLOT( editIncidence() ) );
909 909
910 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 910 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
911 mDeleteAction->addTo( actionMenu ); 911 mDeleteAction->addTo( actionMenu );
912 connect( mDeleteAction, SIGNAL( activated() ), 912 connect( mDeleteAction, SIGNAL( activated() ),
913 mView, SLOT( deleteIncidence() ) ); 913 mView, SLOT( deleteIncidence() ) );
914 914
915 915
916 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 916 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
917 mCloneAction->addTo( actionMenu ); 917 mCloneAction->addTo( actionMenu );
918 connect( mCloneAction, SIGNAL( activated() ), 918 connect( mCloneAction, SIGNAL( activated() ),
919 mView, SLOT( cloneIncidence() ) ); 919 mView, SLOT( cloneIncidence() ) );
920 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 920 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
921 mMoveAction->addTo( actionMenu ); 921 mMoveAction->addTo( actionMenu );
922 connect( mMoveAction, SIGNAL( activated() ), 922 connect( mMoveAction, SIGNAL( activated() ),
923 mView, SLOT( moveIncidence() ) ); 923 mView, SLOT( moveIncidence() ) );
924 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 924 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
925 mBeamAction->addTo( actionMenu ); 925 mBeamAction->addTo( actionMenu );
926 connect( mBeamAction, SIGNAL( activated() ), 926 connect( mBeamAction, SIGNAL( activated() ),
927 mView, SLOT( beamIncidence() ) ); 927 mView, SLOT( beamIncidence() ) );
928 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 928 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
929 mCancelAction->addTo( actionMenu ); 929 mCancelAction->addTo( actionMenu );
930 connect( mCancelAction, SIGNAL( activated() ), 930 connect( mCancelAction, SIGNAL( activated() ),
931 mView, SLOT( toggleCancelIncidence() ) ); 931 mView, SLOT( toggleCancelIncidence() ) );
932 932
933 actionMenu->insertSeparator(); 933 actionMenu->insertSeparator();
934 934
935 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 935 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
936 this ); 936 this );
937 action->addTo( actionMenu ); 937 action->addTo( actionMenu );
938 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 938 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
939 939
940 icon = loadPixmap( pathString + "search" ); 940 icon = loadPixmap( pathString + "search" );
941 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 941 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
942 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 942 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
943 search_action->addTo( actionMenu ); 943 search_action->addTo( actionMenu );
944 connect( search_action, SIGNAL( activated() ), 944 connect( search_action, SIGNAL( activated() ),
945 mView->dialogManager(), SLOT( showSearchDialog() ) ); 945 mView->dialogManager(), SLOT( showSearchDialog() ) );
946 946
947 947
948 948
949 if ( KOPrefs::instance()->mShowFullMenu ) { 949 if ( KOPrefs::instance()->mShowFullMenu ) {
950 actionMenu->insertSeparator(); 950 actionMenu->insertSeparator();
951 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 951 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
952 952
953 } 953 }
954 // actionMenu->insertSeparator(); 954 // actionMenu->insertSeparator();
955 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 955 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
956 this ); 956 this );
957 action->addTo( importMenu_X ); 957 action->addTo( importMenu_X );
958 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 958 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
959 action = new QAction( "import_quick", i18n("Import last file"), 0, 959 action = new QAction( "import_quick", i18n("Import last file"), 0,
960 this ); 960 this );
961 action->addTo( importMenu_X ); 961 action->addTo( importMenu_X );
962 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 962 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
963 importMenu_X->insertSeparator(); 963 importMenu_X->insertSeparator();
964 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 964 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
965 this ); 965 this );
966 action->addTo( importMenu_X ); 966 action->addTo( importMenu_X );
967 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 967 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
968 //#ifndef DESKTOP_VERSION 968 //#ifndef DESKTOP_VERSION
969 importMenu_X->insertSeparator(); 969 importMenu_X->insertSeparator();
970 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 970 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
971 this ); 971 this );
972 action->addTo( importMenu_X ); 972 action->addTo( importMenu_X );
973 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 973 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
974 //#else 974 //#else
975#ifdef _OL_IMPORT_ 975#ifdef _OL_IMPORT_
976 importMenu_X->insertSeparator(); 976 importMenu_X->insertSeparator();
977 action = new QAction( "import_ol", i18n("Import from OL"), 0, 977 action = new QAction( "import_ol", i18n("Import from OL"), 0,
978 this ); 978 this );
979 action->addTo( importMenu_X ); 979 action->addTo( importMenu_X );
980 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 980 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
981#endif 981#endif
982 //#endif 982 //#endif
983 983
984 //importMenu->insertSeparator(); 984 //importMenu->insertSeparator();
985 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 985 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
986 this ); 986 this );
987 action->addTo( importMenu ); 987 action->addTo( importMenu );
988 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 988 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
989 989
990 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 990 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
991 this ); 991 this );
992 action->addTo( importMenu ); 992 action->addTo( importMenu );
993 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 993 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
994 importMenu->insertSeparator(); 994 importMenu->insertSeparator();
995 importMenu->insertItem( i18n("Import"), importMenu_X ); 995 importMenu->insertItem( i18n("Import"), importMenu_X );
996 //importMenu->insertSeparator(); 996 //importMenu->insertSeparator();
997 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 997 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
998 this ); 998 this );
999 action->addTo( exportMenu_X ); 999 action->addTo( exportMenu_X );
1000 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1000 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1001 1001
1002 1002
1003 //LR 1003 //LR
1004 QPopupMenu *ex2phone = new QPopupMenu( this ); 1004 QPopupMenu *ex2phone = new QPopupMenu( this );
1005 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1005 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1006 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1006 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1007 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1007 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1008 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1008 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1009 1009
1010 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1010 importMenu->insertItem( i18n("Export"), exportMenu_X );
1011#ifndef DESKTOP_VERSION 1011#ifndef DESKTOP_VERSION
1012 //importMenu->insertSeparator(); 1012 //importMenu->insertSeparator();
1013 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1013 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
1014 this ); 1014 this );
1015 brAction->addTo( beamMenu_X ); 1015 brAction->addTo( beamMenu_X );
1016 brAction->setToggleAction (true ) ; 1016 brAction->setToggleAction (true ) ;
1017 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1017 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1018 1018
1019 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1019 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
1020 this ); 1020 this );
1021 action->addTo( beamMenu_X ); 1021 action->addTo( beamMenu_X );
1022 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1022 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1023 1023
1024 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1024 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
1025 this ); 1025 this );
1026 action->addTo( beamMenu_X ); 1026 action->addTo( beamMenu_X );
1027 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1027 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1028 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1028 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1029#else 1029#else
1030 //importMenu->insertSeparator(); 1030 //importMenu->insertSeparator();
1031 icon = loadPixmap( pathString + "print" ); 1031 icon = loadPixmap( pathString + "print" );
1032 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1032 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1033 action->addTo( beamMenu_X ); 1033 action->addTo( beamMenu_X );
1034 connect( action, SIGNAL( activated() ), 1034 connect( action, SIGNAL( activated() ),
1035 this, SLOT( printCal() ) ); 1035 this, SLOT( printCal() ) );
1036 1036
1037 icon = loadPixmap( pathString + "print" ); 1037 icon = loadPixmap( pathString + "print" );
1038 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1038 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1039 action->addTo( beamMenu_X ); 1039 action->addTo( beamMenu_X );
1040 connect( action, SIGNAL( activated() ), 1040 connect( action, SIGNAL( activated() ),
1041 this, SLOT( printSel() ) ); 1041 this, SLOT( printSel() ) );
1042 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1042 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1043 action->addTo( beamMenu_X ); 1043 action->addTo( beamMenu_X );
1044 connect( action, SIGNAL( activated() ), 1044 connect( action, SIGNAL( activated() ),
1045 mView->viewManager(), SLOT( slotprintWNV() ) ); 1045 mView->viewManager(), SLOT( slotprintWNV() ) );
1046 1046
1047 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1047 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1048 action->addTo( beamMenu_X ); 1048 action->addTo( beamMenu_X );
1049 connect( action, SIGNAL( activated() ), 1049 connect( action, SIGNAL( activated() ),
1050 mView, SLOT( slotprintSelInc() ) ); 1050 mView, SLOT( slotprintSelInc() ) );
1051 1051
1052 1052
1053 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1053 importMenu->insertItem( i18n("Print"), beamMenu_X );
1054#endif 1054#endif
1055 importMenu->insertSeparator(); 1055 importMenu->insertSeparator();
1056 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1056 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1057 this ); 1057 this );
1058 action->addTo( importMenu ); 1058 action->addTo( importMenu );
1059 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1059 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1060 importMenu->insertSeparator(); 1060 importMenu->insertSeparator();
1061 action = new QAction( "beam all", i18n("Save"), 0, 1061 action = new QAction( "beam all", i18n("Save"), 0,
1062 this ); 1062 this );
1063 action->addTo( importMenu ); 1063 action->addTo( importMenu );
1064 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1064 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1065 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1065 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1066 this ); 1066 this );
1067 action->addTo( importMenu ); 1067 action->addTo( importMenu );
1068 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1068 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1069 1069
1070 //menuBar->insertItem( "Configure",configureMenu ); 1070 //menuBar->insertItem( "Configure",configureMenu );
1071 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1071 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1072 icon = loadPixmap( "korganizer/korganizer" ); 1072 icon = loadPixmap( "korganizer/korganizer" );
1073 1073
1074 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1074 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1075 action->addTo( helpMenu ); 1075 action->addTo( helpMenu );
1076 connect( action, SIGNAL( activated() ), 1076 connect( action, SIGNAL( activated() ),
1077 SLOT( whatsNew() ) ); 1077 SLOT( whatsNew() ) );
1078 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1078 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1079 action->addTo( helpMenu ); 1079 action->addTo( helpMenu );
1080 connect( action, SIGNAL( activated() ), 1080 connect( action, SIGNAL( activated() ),
1081 SLOT( features() ) ); 1081 SLOT( features() ) );
1082 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1082 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1083 action->addTo( helpMenu ); 1083 action->addTo( helpMenu );
1084 connect( action, SIGNAL( activated() ), 1084 connect( action, SIGNAL( activated() ),
1085 SLOT( keyBindings() ) ); 1085 SLOT( keyBindings() ) );
1086 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1086 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1087 action->addTo( helpMenu ); 1087 action->addTo( helpMenu );
1088 connect( action, SIGNAL( activated() ), 1088 connect( action, SIGNAL( activated() ),
1089 SLOT( storagehowto() ) ); 1089 SLOT( storagehowto() ) );
1090 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1090 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1091 action->addTo( helpMenu ); 1091 action->addTo( helpMenu );
1092 connect( action, SIGNAL( activated() ), 1092 connect( action, SIGNAL( activated() ),
1093 SLOT( synchowto() ) ); 1093 SLOT( synchowto() ) );
1094 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1094 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1095 action->addTo( helpMenu ); 1095 action->addTo( helpMenu );
1096 connect( action, SIGNAL( activated() ), 1096 connect( action, SIGNAL( activated() ),
1097 SLOT( kdesynchowto() ) ); 1097 SLOT( kdesynchowto() ) );
1098 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1098 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1099 action->addTo( helpMenu ); 1099 action->addTo( helpMenu );
1100 connect( action, SIGNAL( activated() ), 1100 connect( action, SIGNAL( activated() ),
1101 SLOT( multisynchowto() ) ); 1101 SLOT( multisynchowto() ) );
1102 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1102 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1103 action->addTo( helpMenu ); 1103 action->addTo( helpMenu );
1104 connect( action, SIGNAL( activated() ), 1104 connect( action, SIGNAL( activated() ),
1105 SLOT( aboutAutoSaving() ) ); 1105 SLOT( aboutAutoSaving() ) );
1106 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1106 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1107 action->addTo( helpMenu ); 1107 action->addTo( helpMenu );
1108 connect( action, SIGNAL( activated() ), 1108 connect( action, SIGNAL( activated() ),
1109 SLOT( aboutKnownBugs() ) ); 1109 SLOT( aboutKnownBugs() ) );
1110 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1110 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1111 action->addTo( helpMenu ); 1111 action->addTo( helpMenu );
1112 connect( action, SIGNAL( activated() ), 1112 connect( action, SIGNAL( activated() ),
1113 SLOT( usertrans() ) ); 1113 SLOT( usertrans() ) );
1114 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1114 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1115 action->addTo( helpMenu ); 1115 action->addTo( helpMenu );
1116 connect( action, SIGNAL( activated() ), 1116 connect( action, SIGNAL( activated() ),
1117 SLOT( faq() ) ); 1117 SLOT( faq() ) );
1118 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1118 action = new QAction( "licence", i18n("Licence..."), 0, this );
1119 action->addTo( helpMenu ); 1119 action->addTo( helpMenu );
1120 connect( action, SIGNAL( activated() ), 1120 connect( action, SIGNAL( activated() ),
1121 SLOT( licence() ) ); 1121 SLOT( licence() ) );
1122 action = new QAction( "about", i18n("About..."), 0, this ); 1122 action = new QAction( "about", i18n("About..."), 0, this );
1123 action->addTo( helpMenu ); 1123 action->addTo( helpMenu );
1124 connect( action, SIGNAL( activated() ), 1124 connect( action, SIGNAL( activated() ),
1125 SLOT( about() ) ); 1125 SLOT( about() ) );
1126 //menuBar->insertSeparator(); 1126 //menuBar->insertSeparator();
1127 1127
1128 // ****************************************************** 1128 // ******************************************************
1129 // menubar icons 1129 // menubar icons
1130 1130
1131 1131
1132 1132
1133 //menuBar->insertItem( iconToolBar ); 1133 //menuBar->insertItem( iconToolBar );
1134 //xdays_action 1134 //xdays_action
1135 if (p-> mShowIconNewEvent) 1135 if (p-> mShowIconNewEvent)
1136 ne_action->addTo( iconToolBar ); 1136 ne_action->addTo( iconToolBar );
1137 if (p->mShowIconNewTodo ) 1137 if (p->mShowIconNewTodo )
1138 nt_action->addTo( iconToolBar ); 1138 nt_action->addTo( iconToolBar );
1139 if (p-> mShowIconSearch) 1139 if (p-> mShowIconSearch)
1140 search_action->addTo( iconToolBar ); 1140 search_action->addTo( iconToolBar );
1141 if (p-> mShowIconWhatsThis) 1141 if (p-> mShowIconWhatsThis)
1142 QWhatsThis::whatsThisButton ( iconToolBar ); 1142 QWhatsThis::whatsThisButton ( iconToolBar );
1143 if (p-> mShowIconNext) 1143 if (p-> mShowIconNext)
1144 whatsnext_action->addTo( viewToolBar ); 1144 whatsnext_action->addTo( viewToolBar );
1145 if (p-> mShowIconNextDays) 1145 if (p-> mShowIconNextDays)
1146 xdays_action->addTo( viewToolBar ); 1146 xdays_action->addTo( viewToolBar );
1147 if (p-> mShowIconJournal) 1147 if (p-> mShowIconJournal)
1148 viewjournal_action->addTo( viewToolBar ); 1148 viewjournal_action->addTo( viewToolBar );
1149 if (p-> mShowIconDay1) 1149 if (p-> mShowIconDay1)
1150 day1_action->addTo( viewToolBar ); 1150 day1_action->addTo( viewToolBar );
1151 if (p-> mShowIconDay5) 1151 if (p-> mShowIconDay5)
1152 day5_action->addTo( viewToolBar ); 1152 day5_action->addTo( viewToolBar );
1153 if (p-> mShowIconDay7) 1153 if (p-> mShowIconDay7)
1154 day7_action->addTo( viewToolBar ); 1154 day7_action->addTo( viewToolBar );
1155 if (p-> mShowIconDay6) 1155 if (p-> mShowIconDay6)
1156 day6_action->addTo( viewToolBar ); 1156 day6_action->addTo( viewToolBar );
1157 if (p-> mShowIconMonth) 1157 if (p-> mShowIconMonth)
1158 month_action->addTo( viewToolBar ); 1158 month_action->addTo( viewToolBar );
1159 if (p-> mShowIconList) 1159 if (p-> mShowIconList)
1160 showlist_action->addTo( viewToolBar ); 1160 showlist_action->addTo( viewToolBar );
1161 if (p-> mShowIconTodoview) 1161 if (p-> mShowIconTodoview)
1162 todoview_action->addTo( viewToolBar ); 1162 todoview_action->addTo( viewToolBar );
1163 1163
1164 icon = loadPixmap( pathString + "2leftarrowB" ); 1164 icon = loadPixmap( pathString + "2leftarrowB" );
1165 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1165 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1166 if (p-> mShowIconBackFast) { 1166 if (p-> mShowIconBackFast) {
1167 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1167 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1168 connect( action, SIGNAL( activated() ), 1168 connect( action, SIGNAL( activated() ),
1169 mView, SLOT( goPreviousMonth() ) ); 1169 mView, SLOT( goPreviousMonth() ) );
1170 action->addTo( navigatorToolBar ); 1170 action->addTo( navigatorToolBar );
1171 } 1171 }
1172 icon = loadPixmap( pathString + "1leftarrowB" ); 1172 icon = loadPixmap( pathString + "1leftarrowB" );
1173 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1173 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1174 if (p-> mShowIconBack) { 1174 if (p-> mShowIconBack) {
1175 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1175 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1176 connect( action, SIGNAL( activated() ), 1176 connect( action, SIGNAL( activated() ),
1177 mView, SLOT( goPrevious() ) ); 1177 mView, SLOT( goPrevious() ) );
1178 action->addTo( navigatorToolBar ); 1178 action->addTo( navigatorToolBar );
1179 } 1179 }
1180 icon = loadPixmap( pathString + "today" ); 1180 icon = loadPixmap( pathString + "today" );
1181 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1181 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1182 if (p-> mShowIconToday) 1182 if (p-> mShowIconToday)
1183 today_action->addTo( navigatorToolBar ); 1183 today_action->addTo( navigatorToolBar );
1184 icon = loadPixmap( pathString + "1rightarrowB" ); 1184 icon = loadPixmap( pathString + "1rightarrowB" );
1185 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1185 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1186 if (p-> mShowIconForward) { 1186 if (p-> mShowIconForward) {
1187 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1187 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1188 connect( action, SIGNAL( activated() ), 1188 connect( action, SIGNAL( activated() ),
1189 mView, SLOT( goNext() ) ); 1189 mView, SLOT( goNext() ) );
1190 action->addTo( navigatorToolBar ); 1190 action->addTo( navigatorToolBar );
1191 } 1191 }
1192 icon = loadPixmap( pathString + "2rightarrowB" ); 1192 icon = loadPixmap( pathString + "2rightarrowB" );
1193 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1193 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1194 if (p-> mShowIconForwardFast) { 1194 if (p-> mShowIconForwardFast) {
1195 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1195 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1196 connect( action, SIGNAL( activated() ), 1196 connect( action, SIGNAL( activated() ),
1197 mView, SLOT( goNextMonth() ) ); 1197 mView, SLOT( goNextMonth() ) );
1198 action->addTo( navigatorToolBar ); 1198 action->addTo( navigatorToolBar );
1199 } 1199 }
1200 1200
1201 1201
1202 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1202 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1203 1203
1204 1204
1205 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1205 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1206 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1206 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1207 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1207 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1208 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1208 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1209 1209
1210 if (p-> mShowIconNewEvent) 1210 if (p-> mShowIconNewEvent)
1211 configureToolBarMenu->setItemChecked( 10, true ); 1211 configureToolBarMenu->setItemChecked( 10, true );
1212 if (p->mShowIconNewTodo ) 1212 if (p->mShowIconNewTodo )
1213 configureToolBarMenu->setItemChecked( 20, true ); 1213 configureToolBarMenu->setItemChecked( 20, true );
1214 if (p-> mShowIconSearch) 1214 if (p-> mShowIconSearch)
1215 configureToolBarMenu->setItemChecked( 120, true ); 1215 configureToolBarMenu->setItemChecked( 120, true );
1216 if (p-> mShowIconList) 1216 if (p-> mShowIconList)
1217 configureToolBarMenu->setItemChecked( 30, true ); 1217 configureToolBarMenu->setItemChecked( 30, true );
1218 if (p-> mShowIconDay1) 1218 if (p-> mShowIconDay1)
1219 configureToolBarMenu->setItemChecked( 40, true ); 1219 configureToolBarMenu->setItemChecked( 40, true );
1220 if (p-> mShowIconDay5) 1220 if (p-> mShowIconDay5)
1221 configureToolBarMenu->setItemChecked( 50, true ); 1221 configureToolBarMenu->setItemChecked( 50, true );
1222 if (p-> mShowIconDay6) 1222 if (p-> mShowIconDay6)
1223 configureToolBarMenu->setItemChecked( 75, true ); 1223 configureToolBarMenu->setItemChecked( 75, true );
1224 if (p-> mShowIconDay7) 1224 if (p-> mShowIconDay7)
1225 configureToolBarMenu->setItemChecked( 60, true ); 1225 configureToolBarMenu->setItemChecked( 60, true );
1226 if (p-> mShowIconMonth) 1226 if (p-> mShowIconMonth)
1227 configureToolBarMenu->setItemChecked( 70, true ); 1227 configureToolBarMenu->setItemChecked( 70, true );
1228 if (p-> mShowIconTodoview) 1228 if (p-> mShowIconTodoview)
1229 configureToolBarMenu->setItemChecked( 80, true ); 1229 configureToolBarMenu->setItemChecked( 80, true );
1230 if (p-> mShowIconBackFast) 1230 if (p-> mShowIconBackFast)
1231 configureToolBarMenu->setItemChecked( 200, true ); 1231 configureToolBarMenu->setItemChecked( 200, true );
1232 if (p-> mShowIconBack) 1232 if (p-> mShowIconBack)
1233 configureToolBarMenu->setItemChecked( 210, true ); 1233 configureToolBarMenu->setItemChecked( 210, true );
1234 if (p-> mShowIconToday) 1234 if (p-> mShowIconToday)
1235 configureToolBarMenu->setItemChecked( 130, true ); 1235 configureToolBarMenu->setItemChecked( 130, true );
1236 if (p-> mShowIconForward) 1236 if (p-> mShowIconForward)
1237 configureToolBarMenu->setItemChecked( 220, true ); 1237 configureToolBarMenu->setItemChecked( 220, true );
1238 if (p-> mShowIconForwardFast) 1238 if (p-> mShowIconForwardFast)
1239 configureToolBarMenu->setItemChecked( 230, true ); 1239 configureToolBarMenu->setItemChecked( 230, true );
1240 if (p-> mShowIconNextDays) 1240 if (p-> mShowIconNextDays)
1241 configureToolBarMenu->setItemChecked( 100, true ); 1241 configureToolBarMenu->setItemChecked( 100, true );
1242 if (p-> mShowIconNext) 1242 if (p-> mShowIconNext)
1243 configureToolBarMenu->setItemChecked( 110, true ); 1243 configureToolBarMenu->setItemChecked( 110, true );
1244 if (p-> mShowIconJournal) 1244 if (p-> mShowIconJournal)
1245 configureToolBarMenu->setItemChecked( 90, true ); 1245 configureToolBarMenu->setItemChecked( 90, true );
1246 if (p-> mShowIconWhatsThis) 1246 if (p-> mShowIconWhatsThis)
1247 configureToolBarMenu->setItemChecked( 300, true ); 1247 configureToolBarMenu->setItemChecked( 300, true );
1248 if (p-> mShowIconWeekNum) 1248 if (p-> mShowIconWeekNum)
1249 configureToolBarMenu->setItemChecked( 400, true ); 1249 configureToolBarMenu->setItemChecked( 400, true );
1250 if (!p-> mShowIconStretch) { 1250 if (!p-> mShowIconStretch) {
1251 QLabel* dummy = new QLabel( iconToolBar ); 1251 QLabel* dummy = new QLabel( iconToolBar );
1252 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1252 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1253 dummy->setMinimumWidth( 0 ); 1253 dummy->setMinimumWidth( 0 );
1254 iconToolBar->setStretchableWidget ( dummy ) ; 1254 iconToolBar->setStretchableWidget ( dummy ) ;
1255 } 1255 }
1256 else { 1256 else {
1257 iconToolBar->setHorizontalStretchable (true ); 1257 iconToolBar->setHorizontalStretchable (true );
1258 viewToolBar->setHorizontalStretchable (true ); 1258 viewToolBar->setHorizontalStretchable (true );
1259 navigatorToolBar->setHorizontalStretchable (true ); 1259 navigatorToolBar->setHorizontalStretchable (true );
1260 iconToolBar->setVerticalStretchable (true ); 1260 iconToolBar->setVerticalStretchable (true );
1261 viewToolBar->setVerticalStretchable (true ); 1261 viewToolBar->setVerticalStretchable (true );
1262 navigatorToolBar->setVerticalStretchable (true ); 1262 navigatorToolBar->setVerticalStretchable (true );
1263 configureToolBarMenu->setItemChecked( 5, true ); 1263 configureToolBarMenu->setItemChecked( 5, true );
1264 } 1264 }
1265 if (p-> mShowIconFilter) 1265 if (p-> mShowIconFilter)
1266 configureToolBarMenu->setItemChecked( 7, true ); 1266 configureToolBarMenu->setItemChecked( 7, true );
1267 if (p-> mShowIconOnetoolbar) 1267 if (p-> mShowIconOnetoolbar)
1268 configureToolBarMenu->setItemChecked( 6, true ); 1268 configureToolBarMenu->setItemChecked( 6, true );
1269 1269
1270 1270
1271 if ( filterMenubar ) 1271 if ( filterMenubar )
1272 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); 1272 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) );
1273 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1273 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1274 configureAgenda( p->mHourSize ); 1274 configureAgenda( p->mHourSize );
1275 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1275 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1276} 1276}
1277 1277
1278void MainWindow::exportToPhone( int mode ) 1278void MainWindow::exportToPhone( int mode )
1279{ 1279{
1280 1280
1281 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1281 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1282 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1282 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1283 KOex2phonePrefs ex2phone; 1283 KOex2phonePrefs ex2phone;
1284 1284
1285 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1285 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1286 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1286 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1287 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1287 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1288 if ( mode == 1 ) 1288 if ( mode == 1 )
1289 ex2phone.setCaption(i18n("Export complete calendar")); 1289 ex2phone.setCaption(i18n("Export complete calendar"));
1290 if ( mode == 2 ) 1290 if ( mode == 2 )
1291 ex2phone.setCaption(i18n("Export filtered calendar")); 1291 ex2phone.setCaption(i18n("Export filtered calendar"));
1292 1292
1293 if ( !ex2phone.exec() ) { 1293 if ( !ex2phone.exec() ) {
1294 return; 1294 return;
1295 } 1295 }
1296 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1296 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1297 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1297 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1298 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1298 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1299 1299
1300 int inFuture = 0; 1300 int inFuture = 0;
1301 if ( ex2phone.mWriteBackFuture->isChecked() ) 1301 if ( ex2phone.mWriteBackFuture->isChecked() )
1302 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1302 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1303 QPtrList<Incidence> delSel; 1303 QPtrList<Incidence> delSel;
1304 if ( mode == 1 ) 1304 if ( mode == 1 )
1305 delSel = mCalendar->rawIncidences(); 1305 delSel = mCalendar->rawIncidences();
1306 if ( mode == 2 ) 1306 if ( mode == 2 )
1307 delSel = mCalendar->incidences(); 1307 delSel = mCalendar->incidences();
1308 CalendarLocal* cal = new CalendarLocal(); 1308 CalendarLocal* cal = new CalendarLocal();
1309 cal->setLocalTime(); 1309 cal->setLocalTime();
1310 Incidence *incidence = delSel.first(); 1310 Incidence *incidence = delSel.first();
1311 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1311 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1312 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1312 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1313 while ( incidence ) { 1313 while ( incidence ) {
1314 if ( incidence->type() != "Journal" ) { 1314 if ( incidence->type() != "Journal" ) {
1315 bool add = true; 1315 bool add = true;
1316 if ( inFuture ) { 1316 if ( inFuture ) {
1317 QDateTime dt; 1317 QDateTime dt;
1318 if ( incidence->type() == "Todo" ) { 1318 if ( incidence->type() == "Todo" ) {
1319 Todo * t = (Todo*)incidence; 1319 Todo * t = (Todo*)incidence;
1320 if ( t->hasDueDate() ) 1320 if ( t->hasDueDate() )
1321 dt = t->dtDue(); 1321 dt = t->dtDue();
1322 else 1322 else
1323 dt = cur.addSecs( 62 ); 1323 dt = cur.addSecs( 62 );
1324 } 1324 }
1325 else { 1325 else {
1326 bool ok; 1326 bool ok;
1327 dt = incidence->getNextOccurence( cur, &ok ); 1327 dt = incidence->getNextOccurence( cur, &ok );
1328 if ( !ok ) 1328 if ( !ok )
1329 dt = cur.addSecs( -62 ); 1329 dt = cur.addSecs( -62 );
1330 } 1330 }
1331 if ( dt < cur || dt > end ) { 1331 if ( dt < cur || dt > end ) {
1332 add = false; 1332 add = false;
1333 } 1333 }
1334 } 1334 }
1335 if ( add ) { 1335 if ( add ) {
1336 Incidence *in = incidence->clone(); 1336 Incidence *in = incidence->clone();
1337 cal->addIncidence( in ); 1337 cal->addIncidence( in );
1338 } 1338 }
1339 } 1339 }
1340 incidence = delSel.next(); 1340 incidence = delSel.next();
1341 } 1341 }
1342 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1342 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1343 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1343 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1344 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1344 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1345 1345
1346 setCaption( i18n("Writing to phone...")); 1346 setCaption( i18n("Writing to phone..."));
1347 if ( PhoneFormat::writeToPhone( cal ) ) 1347 if ( PhoneFormat::writeToPhone( cal ) )
1348 setCaption( i18n("Export to phone successful!")); 1348 setCaption( i18n("Export to phone successful!"));
1349 else 1349 else
1350 setCaption( i18n("Error exporting to phone!")); 1350 setCaption( i18n("Error exporting to phone!"));
1351 delete cal; 1351 delete cal;
1352} 1352}
1353 1353
1354 1354
1355void MainWindow::setDefaultPreferences() 1355void MainWindow::setDefaultPreferences()
1356{ 1356{
1357 KOPrefs *p = KOPrefs::instance(); 1357 KOPrefs *p = KOPrefs::instance();
1358 1358
1359 p->mCompactDialogs = true; 1359 p->mCompactDialogs = true;
1360 p->mConfirm = true; 1360 p->mConfirm = true;
1361 // p->mEnableQuickTodo = false; 1361 // p->mEnableQuickTodo = false;
1362 1362
1363} 1363}
1364 1364
1365QString MainWindow::resourcePath() 1365QString MainWindow::resourcePath()
1366{ 1366{
1367 return KGlobal::iconLoader()->iconPath(); 1367 return KGlobal::iconLoader()->iconPath();
1368} 1368}
1369 1369
1370void MainWindow::displayText( QString text ,QString cap ) 1370void MainWindow::displayText( QString text ,QString cap )
1371{ 1371{
1372 QDialog dia( this, "name", true ); ; 1372 QDialog dia( this, "name", true ); ;
1373 dia.setCaption( cap ); 1373 dia.setCaption( cap );
1374 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1374 QVBoxLayout* lay = new QVBoxLayout( &dia );
1375 lay->setSpacing( 3 ); 1375 lay->setSpacing( 3 );
1376 lay->setMargin( 3 ); 1376 lay->setMargin( 3 );
1377 QTextBrowser tb ( &dia ); 1377 QTextBrowser tb ( &dia );
1378 lay->addWidget( &tb ); 1378 lay->addWidget( &tb );
1379 tb.setText( text ); 1379 tb.setText( text );
1380#ifdef DESKTOP_VERSION 1380#ifdef DESKTOP_VERSION
1381 dia.resize( 640, 480); 1381 dia.resize( 640, 480);
1382#else 1382#else
1383 dia.showMaximized(); 1383 dia.showMaximized();
1384#endif 1384#endif
1385 dia.exec(); 1385 dia.exec();
1386} 1386}
1387 1387
1388void MainWindow::features() 1388void MainWindow::features()
1389{ 1389{
1390 1390
1391 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1391 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1392} 1392}
1393 1393
1394void MainWindow::usertrans() 1394void MainWindow::usertrans()
1395{ 1395{
1396 1396
1397 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1397 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1398} 1398}
1399 1399
1400void MainWindow::storagehowto() 1400void MainWindow::storagehowto()
1401{ 1401{
1402 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1402 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1403} 1403}
1404void MainWindow::kdesynchowto() 1404void MainWindow::kdesynchowto()
1405{ 1405{
1406 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1406 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1407} 1407}
1408void MainWindow::multisynchowto() 1408void MainWindow::multisynchowto()
1409{ 1409{
1410 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1410 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1411} 1411}
1412void MainWindow::synchowto() 1412void MainWindow::synchowto()
1413{ 1413{
1414 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1414 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1415} 1415}
1416void MainWindow::faq() 1416void MainWindow::faq()
1417{ 1417{
1418 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1418 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1419 1419
1420} 1420}
1421void MainWindow::whatsNew() 1421void MainWindow::whatsNew()
1422{ 1422{
1423 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1423 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1424 1424
1425} 1425}
1426void MainWindow::licence() 1426void MainWindow::licence()
1427{ 1427{
1428 KApplication::showLicence(); 1428 KApplication::showLicence();
1429 1429
1430} 1430}
1431void MainWindow::about() 1431void MainWindow::about()
1432{ 1432{
1433 QString version; 1433 QString version;
1434#include <../version> 1434#include <../version>
1435 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1435 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1436 i18n("KOrganizer/Platform-independent\n") + 1436 i18n("KOrganizer/Platform-independent\n") +
1437 "(KO/Pi) " + version + " - " + 1437 "(KO/Pi) " + version + " - " +
1438 1438
1439#ifdef DESKTOP_VERSION 1439#ifdef DESKTOP_VERSION
1440 i18n("Desktop Edition\n") + 1440 i18n("Desktop Edition\n") +
1441#else 1441#else
1442 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1442 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1443#endif 1443#endif
1444 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1444 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1445} 1445}
1446void MainWindow::keyBindings() 1446void MainWindow::keyBindings()
1447{ 1447{
1448 QString cap = i18n("KO/Pi Keys + Colors"); 1448 QString cap = i18n("KO/Pi Keys + Colors");
1449 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1449 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1450 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1450 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1451 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1451 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1452 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1452 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1453 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1453 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1454 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1454 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1455 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1455 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1456 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1456 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1457 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1457 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1458 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1458 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1459 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1459 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1460 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1460 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1461 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1461 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1462 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1462 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1463 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1463 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1464 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1464 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1465 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1465 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1466 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1466 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1467 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1467 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1468 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1468 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1469 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1469 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1470 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1470 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1471 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1471 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1472 i18n("<p><h3>In agenda view:</h3></p>\n") + 1472 i18n("<p><h3>In agenda view:</h3></p>\n") +
1473 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1473 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1474 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1474 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1475 i18n("<p><h3>In todo view:</h3></p>\n") + 1475 i18n("<p><h3>In todo view:</h3></p>\n") +
1476 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1476 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1477 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1477 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1478 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1478 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1479 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1479 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1480 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1480 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1481 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1481 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1482 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1482 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1483 i18n("<p><h3>In list view:</h3></p>\n") + 1483 i18n("<p><h3>In list view:</h3></p>\n") +
1484 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1484 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1485 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1485 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1486 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1486 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1487 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1487 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1488 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1488 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1489 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1489 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1490 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1490 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1491 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1491 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1492 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1492 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1493 i18n("<p><b>E</b>: Edit item</p>\n") + 1493 i18n("<p><b>E</b>: Edit item</p>\n") +
1494 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1494 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1495 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1495 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1496 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1496 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1497 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1497 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1498 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1498 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1499 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1499 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1500 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1500 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1501 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1501 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1502 i18n("<p><b>White</b>: Item readonly</p>\n"); 1502 i18n("<p><b>White</b>: Item readonly</p>\n");
1503 displayText( text, cap); 1503 displayText( text, cap);
1504} 1504}
1505void MainWindow::aboutAutoSaving() 1505void MainWindow::aboutAutoSaving()
1506{ 1506{
1507 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1507 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1508 1508
1509 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1509 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1510 1510
1511} 1511}
1512void MainWindow::aboutKnownBugs() 1512void MainWindow::aboutKnownBugs()
1513{ 1513{
1514 QMessageBox* msg; 1514 QMessageBox* msg;
1515 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1515 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1516 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1516 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1517 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1517 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1518 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1518 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1519 i18n("\nor report them in the bugtracker on\n") + 1519 i18n("\nor report them in the bugtracker on\n") +
1520 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1520 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1521 QMessageBox::NoIcon, 1521 QMessageBox::NoIcon,
1522 QMessageBox::Ok, 1522 QMessageBox::Ok,
1523 QMessageBox::NoButton, 1523 QMessageBox::NoButton,
1524 QMessageBox::NoButton); 1524 QMessageBox::NoButton);
1525 msg->exec(); 1525 msg->exec();
1526 delete msg; 1526 delete msg;
1527 1527
1528} 1528}
1529 1529
1530QString MainWindow::defaultFileName() 1530QString MainWindow::defaultFileName()
1531{ 1531{
1532 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1532 return locateLocal( "data", "korganizer/mycalendar.ics" );
1533} 1533}
1534QString MainWindow::syncFileName() 1534QString MainWindow::syncFileName()
1535{ 1535{
1536#ifdef DESKTOP_VERSION 1536#ifdef DESKTOP_VERSION
1537 return locateLocal( "tmp", "synccalendar.ics" ); 1537 return locateLocal( "tmp", "synccalendar.ics" );
1538#else 1538#else
1539 return QString( "/tmp/synccalendar.ics" ); 1539 return QString( "/tmp/synccalendar.ics" );
1540#endif 1540#endif
1541} 1541}
1542#include "koglobals.h" 1542#include "koglobals.h"
1543#include <kcalendarsystem.h> 1543#include <kcalendarsystem.h>
1544void MainWindow::updateWeek(QDate seda) 1544void MainWindow::updateWeek(QDate seda)
1545{ 1545{
1546 int weekNum = KGlobal::locale()->weekNum ( seda ); 1546 int weekNum = KGlobal::locale()->weekNum ( seda );
1547 mWeekPixmap.fill( mWeekBgColor ); 1547 mWeekPixmap.fill( mWeekBgColor );
1548 QPainter p ( &mWeekPixmap ); 1548 QPainter p ( &mWeekPixmap );
1549 p.setFont( mWeekFont ); 1549 p.setFont( mWeekFont );
1550 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1550 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1551 p.end(); 1551 p.end();
1552 QIconSet icon3 ( mWeekPixmap ); 1552 QIconSet icon3 ( mWeekPixmap );
1553 mWeekAction->setIconSet ( icon3 ); 1553 mWeekAction->setIconSet ( icon3 );
1554 1554
1555} 1555}
1556void MainWindow::updateWeekNum(const DateList &selectedDates) 1556void MainWindow::updateWeekNum(const DateList &selectedDates)
1557{ 1557{
1558 updateWeek( selectedDates.first() ); 1558 updateWeek( selectedDates.first() );
1559} 1559}
1560void MainWindow::processIncidenceSelection( Incidence *incidence ) 1560void MainWindow::processIncidenceSelection( Incidence *incidence )
1561{ 1561{
1562 1562
1563 if ( !incidence ) { 1563 if ( !incidence ) {
1564 enableIncidenceActions( false ); 1564 enableIncidenceActions( false );
1565 1565
1566 mNewSubTodoAction->setEnabled( false ); 1566 mNewSubTodoAction->setEnabled( false );
1567 setCaptionToDates(); 1567 setCaptionToDates();
1568 return; 1568 return;
1569 1569
1570 } 1570 }
1571 1571
1572 //KGlobal::locale()->formatDateTime(nextA, true); 1572 //KGlobal::locale()->formatDateTime(nextA, true);
1573 QString startString = ""; 1573 QString startString = "";
1574 if ( incidence->type() != "Todo" ) { 1574 if ( incidence->type() != "Todo" ) {
1575 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1575 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1576 if ( incidence->doesFloat() ) { 1576 if ( incidence->doesFloat() ) {
1577 startString += ": "+incidence->dtStartDateStr( true ); 1577 startString += ": "+incidence->dtStartDateStr( true );
1578 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1578 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1579 1579
1580 } else { 1580 } else {
1581 startString = ": "+incidence->dtStartStr(true); 1581 startString = ": "+incidence->dtStartStr(true);
1582 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1582 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1583 1583
1584 } 1584 }
1585 1585
1586 } else { 1586 } else {
1587 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1587 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1588 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1588 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1589 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1589 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1590 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { 1590
1591 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1591 bool ok; 1592 bool ok;
1592 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1593 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1593 if ( ok ) { 1594 if ( ok ) {
1594 int years = noc.date().year() - incidence->dtStart().date().year(); 1595 int years = noc.date().year() - incidence->dtStart().date().year();
1595 startString += i18n(" (%1 y.)"). arg( years ); 1596 startString += i18n(" (%1 y.)"). arg( years );
1596 } 1597 }
1597 } 1598 }
1598 else 1599 else
1599 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1600 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1600 } 1601 }
1601 1602
1602 } 1603 }
1603 else 1604 else
1604 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1605 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1605 if ( !incidence->location().isEmpty() ) 1606 if ( !incidence->location().isEmpty() )
1606 startString += " (" +incidence->location()+")"; 1607 startString += " (" +incidence->location()+")";
1607 setCaption( incidence->summary()+startString); 1608 setCaption( incidence->summary()+startString);
1608 1609
1609 enableIncidenceActions( true ); 1610 enableIncidenceActions( true );
1610 1611
1611 if ( incidence->type() == "Event" ) { 1612 if ( incidence->type() == "Event" ) {
1612 mShowAction->setText( i18n("Show Event...") ); 1613 mShowAction->setText( i18n("Show Event...") );
1613 mEditAction->setText( i18n("Edit Event...") ); 1614 mEditAction->setText( i18n("Edit Event...") );
1614 mDeleteAction->setText( i18n("Delete Event...") ); 1615 mDeleteAction->setText( i18n("Delete Event...") );
1615 1616
1616 mNewSubTodoAction->setEnabled( false ); 1617 mNewSubTodoAction->setEnabled( false );
1617 } else if ( incidence->type() == "Todo" ) { 1618 } else if ( incidence->type() == "Todo" ) {
1618 mShowAction->setText( i18n("Show Todo...") ); 1619 mShowAction->setText( i18n("Show Todo...") );
1619 mEditAction->setText( i18n("Edit Todo...") ); 1620 mEditAction->setText( i18n("Edit Todo...") );
1620 mDeleteAction->setText( i18n("Delete Todo...") ); 1621 mDeleteAction->setText( i18n("Delete Todo...") );
1621 1622
1622 mNewSubTodoAction->setEnabled( true ); 1623 mNewSubTodoAction->setEnabled( true );
1623 } else { 1624 } else {
1624 mShowAction->setText( i18n("Show...") ); 1625 mShowAction->setText( i18n("Show...") );
1625 mShowAction->setText( i18n("Edit...") ); 1626 mShowAction->setText( i18n("Edit...") );
1626 mShowAction->setText( i18n("Delete...") ); 1627 mShowAction->setText( i18n("Delete...") );
1627 1628
1628 mNewSubTodoAction->setEnabled( false ); 1629 mNewSubTodoAction->setEnabled( false );
1629 } 1630 }
1630} 1631}
1631 1632
1632void MainWindow::enableIncidenceActions( bool enabled ) 1633void MainWindow::enableIncidenceActions( bool enabled )
1633{ 1634{
1634 mShowAction->setEnabled( enabled ); 1635 mShowAction->setEnabled( enabled );
1635 mEditAction->setEnabled( enabled ); 1636 mEditAction->setEnabled( enabled );
1636 mDeleteAction->setEnabled( enabled ); 1637 mDeleteAction->setEnabled( enabled );
1637 1638
1638 mCloneAction->setEnabled( enabled ); 1639 mCloneAction->setEnabled( enabled );
1639 mMoveAction->setEnabled( enabled ); 1640 mMoveAction->setEnabled( enabled );
1640 mBeamAction->setEnabled( enabled ); 1641 mBeamAction->setEnabled( enabled );
1641 mCancelAction->setEnabled( enabled ); 1642 mCancelAction->setEnabled( enabled );
1642} 1643}
1643 1644
1644void MainWindow::importOL() 1645void MainWindow::importOL()
1645{ 1646{
1646#ifdef _OL_IMPORT_ 1647#ifdef _OL_IMPORT_
1647 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1648 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1648 id->exec(); 1649 id->exec();
1649 delete id; 1650 delete id;
1650 mView->updateView(); 1651 mView->updateView();
1651#endif 1652#endif
1652} 1653}
1653void MainWindow::importBday() 1654void MainWindow::importBday()
1654{ 1655{
1655 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1656 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1656 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1657 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1657 i18n("Import!"), i18n("Cancel"), 0, 1658 i18n("Import!"), i18n("Cancel"), 0,
1658 0, 1 ); 1659 0, 1 );
1659 if ( result == 0 ) { 1660 if ( result == 0 ) {
1660 mView->importBday(); 1661 mView->importBday();
1661 1662
1662 } 1663 }
1663 1664
1664 1665
1665} 1666}
1666void MainWindow::importQtopia() 1667void MainWindow::importQtopia()
1667{ 1668{
1668 //#ifndef DESKTOP_VERSION 1669 //#ifndef DESKTOP_VERSION
1669 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); 1670 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing");
1670#ifdef DESKTOP_VERSION 1671#ifdef DESKTOP_VERSION
1671 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1672 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1672#endif 1673#endif
1673 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1674 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1674 i18n("Import!"), i18n("Cancel"), 0, 1675 i18n("Import!"), i18n("Cancel"), 0,
1675 0, 1 ); 1676 0, 1 );
1676 if ( result == 0 ) { 1677 if ( result == 0 ) {
1677#ifndef DESKTOP_VERSION 1678#ifndef DESKTOP_VERSION
1678 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1679 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1679 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1680 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1680 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1681 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1681#else 1682#else
1682 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1683 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1683 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1684 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1684 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1685 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1685#endif 1686#endif
1686 mView->importQtopia( categories, datebook, todolist ); 1687 mView->importQtopia( categories, datebook, todolist );
1687 } 1688 }
1688#if 0 1689#if 0
1689 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1690 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1690 i18n("Not supported \non desktop!\n"), 1691 i18n("Not supported \non desktop!\n"),
1691 i18n("Ok"), i18n("Cancel"), 0, 1692 i18n("Ok"), i18n("Cancel"), 0,
1692 0, 1 ); 1693 0, 1 );
1693 1694
1694#endif 1695#endif
1695} 1696}
1696 1697
1697void MainWindow::saveOnClose() 1698void MainWindow::saveOnClose()
1698{ 1699{
1699 KOPrefs *p = KOPrefs::instance(); 1700 KOPrefs *p = KOPrefs::instance();
1700 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1701 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1701 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1702 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1702 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1703 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1703 if ( filterToolBar ) { 1704 if ( filterToolBar ) {
1704 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1705 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1705 } 1706 }
1706#ifdef DESKTOP_VERSION 1707#ifdef DESKTOP_VERSION
1707 1708
1708 QPoint myP; 1709 QPoint myP;
1709 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1710 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1710 if ( p->mToolBarHor ) 1711 if ( p->mToolBarHor )
1711 p->mToolBarUp = myP.y() > height()/2; 1712 p->mToolBarUp = myP.y() > height()/2;
1712 else 1713 else
1713 p->mToolBarUp = myP.x() > width()/2; 1714 p->mToolBarUp = myP.x() > width()/2;
1714 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1715 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1715 if ( p->mToolBarHorV ) 1716 if ( p->mToolBarHorV )
1716 p->mToolBarUpV = myP.y() > height()/2; 1717 p->mToolBarUpV = myP.y() > height()/2;
1717 else 1718 else
1718 p->mToolBarUpV = myP.x() > width()/2 ; 1719 p->mToolBarUpV = myP.x() > width()/2 ;
1719 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1720 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1720 if ( p->mToolBarHorN ) 1721 if ( p->mToolBarHorN )
1721 p->mToolBarUpN = myP.y() > height()/2; 1722 p->mToolBarUpN = myP.y() > height()/2;
1722 else 1723 else
1723 p->mToolBarUpN = myP.x() > width()/2 ; 1724 p->mToolBarUpN = myP.x() > width()/2 ;
1724 if ( filterToolBar ) { 1725 if ( filterToolBar ) {
1725 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1726 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1726 if ( p->mToolBarHorF ) 1727 if ( p->mToolBarHorF )
1727 p->mToolBarUpF = myP.y() > height()/2; 1728 p->mToolBarUpF = myP.y() > height()/2;
1728 else 1729 else
1729 p->mToolBarUpF = myP.x() > width()/2 ; 1730 p->mToolBarUpF = myP.x() > width()/2 ;
1730 } 1731 }
1731#else 1732#else
1732 if ( p->mToolBarHor ) 1733 if ( p->mToolBarHor )
1733 p->mToolBarUp = iconToolBar->y() > height()/2; 1734 p->mToolBarUp = iconToolBar->y() > height()/2;
1734 else 1735 else
1735 p->mToolBarUp = iconToolBar->x() > width()/2; 1736 p->mToolBarUp = iconToolBar->x() > width()/2;
1736 if ( p->mToolBarHorV ) 1737 if ( p->mToolBarHorV )
1737 p->mToolBarUpV = viewToolBar->y() > height()/2; 1738 p->mToolBarUpV = viewToolBar->y() > height()/2;
1738 else 1739 else
1739 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1740 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1740 1741
1741 if ( p->mToolBarHorN ) 1742 if ( p->mToolBarHorN )
1742 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1743 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1743 else 1744 else
1744 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1745 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1745 if ( filterToolBar ) { 1746 if ( filterToolBar ) {
1746 if ( p->mToolBarHorF ) 1747 if ( p->mToolBarHorF )
1747 p->mToolBarUpF = filterToolBar->y() > height()/2; 1748 p->mToolBarUpF = filterToolBar->y() > height()/2;
1748 else 1749 else
1749 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1750 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1750 } 1751 }
1751#endif 1752#endif
1752 1753
1753 1754
1754 mView->writeSettings(); 1755 mView->writeSettings();
1755 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1756 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1756 save(); 1757 save();
1757} 1758}
1758void MainWindow::slotModifiedChanged( bool changed ) 1759void MainWindow::slotModifiedChanged( bool changed )
1759{ 1760{
1760 if ( mBlockAtStartup ) 1761 if ( mBlockAtStartup )
1761 return; 1762 return;
1762 1763
1763 int msec; 1764 int msec;
1764 // we store the changes after 1 minute, 1765 // we store the changes after 1 minute,
1765 // and for safety reasons after 10 minutes again 1766 // and for safety reasons after 10 minutes again
1766 if ( !mSyncManager->blockSave() ) 1767 if ( !mSyncManager->blockSave() )
1767 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1768 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1768 else 1769 else
1769 msec = 1000 * 600; 1770 msec = 1000 * 600;
1770 mSaveTimer.start( msec, true ); // 1 minute 1771 mSaveTimer.start( msec, true ); // 1 minute
1771 qDebug("KO: Saving File in %d secs!", msec/1000); 1772 qDebug("KO: Saving File in %d secs!", msec/1000);
1772 mCalendarModifiedFlag = true; 1773 mCalendarModifiedFlag = true;
1773} 1774}
1774void MainWindow::saveStopTimer() 1775void MainWindow::saveStopTimer()
1775{ 1776{
1776 mSaveTimer.stop(); 1777 mSaveTimer.stop();
1777} 1778}
1778void MainWindow::save() 1779void MainWindow::save()
1779{ 1780{
1780 if ( !mCalendarModifiedFlag ) { 1781 if ( !mCalendarModifiedFlag ) {
1781 qDebug("KO: Calendar not modified. Nothing saved."); 1782 qDebug("KO: Calendar not modified. Nothing saved.");
1782 return; 1783 return;
1783 } 1784 }
1784 if ( mSyncManager->blockSave() ) 1785 if ( mSyncManager->blockSave() )
1785 return; 1786 return;
1786 mSyncManager->setBlockSave(true); 1787 mSyncManager->setBlockSave(true);
1787 if ( mView->checkFileVersion( defaultFileName()) ) { 1788 if ( mView->checkFileVersion( defaultFileName()) ) {
1788 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1789 QTime neededSaveTime = QDateTime::currentDateTime().time();
1789 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1790 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1790 qDebug("KO: Start saving data to file!"); 1791 qDebug("KO: Start saving data to file!");
1791 mView->saveCalendar( defaultFileName() ); 1792 mView->saveCalendar( defaultFileName() );
1792 mCalendarModifiedFlag = false; 1793 mCalendarModifiedFlag = false;
1793 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1794 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1794 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1795 qDebug("KO: Needed %d ms for saving.",msNeeded );
1795 QString savemes; 1796 QString savemes;
1796 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1797 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1797 setCaption(savemes); 1798 setCaption(savemes);
1798 } else 1799 } else
1799 setCaption(i18n("Saving cancelled!")); 1800 setCaption(i18n("Saving cancelled!"));
1800 mSyncManager->setBlockSave( false ); 1801 mSyncManager->setBlockSave( false );
1801} 1802}
1802 1803
1803void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1804void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1804{ 1805{
1805 if ( !e->isAutoRepeat() ) { 1806 if ( !e->isAutoRepeat() ) {
1806 mFlagKeyPressed = false; 1807 mFlagKeyPressed = false;
1807 } 1808 }
1808} 1809}
1809void MainWindow::keyPressEvent ( QKeyEvent * e ) 1810void MainWindow::keyPressEvent ( QKeyEvent * e )
1810{ 1811{
1811 qApp->processEvents(); 1812 qApp->processEvents();
1812 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1813 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1813 e->ignore(); 1814 e->ignore();
1814 // qDebug(" ignore %d",e->isAutoRepeat() ); 1815 // qDebug(" ignore %d",e->isAutoRepeat() );
1815 return; 1816 return;
1816 } 1817 }
1817 if (! e->isAutoRepeat() ) 1818 if (! e->isAutoRepeat() )
1818 mFlagKeyPressed = true; 1819 mFlagKeyPressed = true;
1819 KOPrefs *p = KOPrefs::instance(); 1820 KOPrefs *p = KOPrefs::instance();
1820 bool showSelectedDates = false; 1821 bool showSelectedDates = false;
1821 int size; 1822 int size;
1822 int pro = 0; 1823 int pro = 0;
1823 //qDebug("MainWindow::keyPressEvent "); 1824 //qDebug("MainWindow::keyPressEvent ");
1824 switch ( e->key() ) { 1825 switch ( e->key() ) {
1825 case Qt::Key_Right: 1826 case Qt::Key_Right:
1826 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1827 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1827 mView->goNextMonth(); 1828 mView->goNextMonth();
1828 else 1829 else
1829 mView->goNext(); 1830 mView->goNext();
1830 showSelectedDates = true; 1831 showSelectedDates = true;
1831 break; 1832 break;
1832 case Qt::Key_Left: 1833 case Qt::Key_Left:
1833 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1834 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1834 mView->goPreviousMonth(); 1835 mView->goPreviousMonth();
1835 else 1836 else
1836 mView->goPrevious(); 1837 mView->goPrevious();
1837 showSelectedDates = true; 1838 showSelectedDates = true;
1838 break; 1839 break;
1839 case Qt::Key_Down: 1840 case Qt::Key_Down:
1840 mView->viewManager()->agendaView()->scrollOneHourDown(); 1841 mView->viewManager()->agendaView()->scrollOneHourDown();
1841 break; 1842 break;
1842 case Qt::Key_Up: 1843 case Qt::Key_Up:
1843 mView->viewManager()->agendaView()->scrollOneHourUp(); 1844 mView->viewManager()->agendaView()->scrollOneHourUp();
1844 break; 1845 break;
1845 case Qt::Key_K: 1846 case Qt::Key_K:
1846 mView->viewManager()->showMonthViewWeek(); 1847 mView->viewManager()->showMonthViewWeek();
1847 break; 1848 break;
1848 case Qt::Key_I: 1849 case Qt::Key_I:
1849 mView->showIncidence(); 1850 mView->showIncidence();
1850 break; 1851 break;
1851 case Qt::Key_Delete: 1852 case Qt::Key_Delete:
1852 case Qt::Key_Backspace: 1853 case Qt::Key_Backspace:
1853 mView->deleteIncidence(); 1854 mView->deleteIncidence();
1854 break; 1855 break;
1855 case Qt::Key_D: 1856 case Qt::Key_D:
1856 mView->viewManager()->showDayView(); 1857 mView->viewManager()->showDayView();
1857 showSelectedDates = true; 1858 showSelectedDates = true;
1858 break; 1859 break;
1859 case Qt::Key_O: 1860 case Qt::Key_O:
1860 mView->toggleFilerEnabled( ); 1861 mView->toggleFilerEnabled( );
1861 break; 1862 break;
1862 case Qt::Key_0: 1863 case Qt::Key_0:
1863 case Qt::Key_1: 1864 case Qt::Key_1:
1864 case Qt::Key_2: 1865 case Qt::Key_2:
1865 case Qt::Key_3: 1866 case Qt::Key_3:
1866 case Qt::Key_4: 1867 case Qt::Key_4:
1867 case Qt::Key_5: 1868 case Qt::Key_5:
1868 case Qt::Key_6: 1869 case Qt::Key_6:
1869 case Qt::Key_7: 1870 case Qt::Key_7:
1870 case Qt::Key_8: 1871 case Qt::Key_8:
1871 case Qt::Key_9: 1872 case Qt::Key_9:
1872 pro = e->key()-48; 1873 pro = e->key()-48;
1873 if ( pro == 0 ) 1874 if ( pro == 0 )
1874 pro = 10; 1875 pro = 10;
1875 if ( e->state() == Qt::ControlButton) 1876 if ( e->state() == Qt::ControlButton)
1876 pro += 10; 1877 pro += 10;
1877 break; 1878 break;
1878 case Qt::Key_M: 1879 case Qt::Key_M:
1879 mView->viewManager()->showMonthView(); 1880 mView->viewManager()->showMonthView();
1880 showSelectedDates = true; 1881 showSelectedDates = true;
1881 break; 1882 break;
1882 case Qt::Key_Insert: 1883 case Qt::Key_Insert:
1883 mView->newEvent(); 1884 mView->newEvent();
1884 break; 1885 break;
1885 case Qt::Key_S : 1886 case Qt::Key_S :
1886 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1887 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1887 mView->newSubTodo(); 1888 mView->newSubTodo();
1888 else 1889 else
1889 mView->dialogManager()->showSearchDialog(); 1890 mView->dialogManager()->showSearchDialog();
1890 break; 1891 break;
1891 case Qt::Key_Y : 1892 case Qt::Key_Y :
1892 case Qt::Key_Z : 1893 case Qt::Key_Z :
1893 mView->viewManager()->showWorkWeekView(); 1894 mView->viewManager()->showWorkWeekView();
1894 showSelectedDates = true; 1895 showSelectedDates = true;
1895 break; 1896 break;
1896 case Qt::Key_U : 1897 case Qt::Key_U :
1897 mView->viewManager()->showWeekView(); 1898 mView->viewManager()->showWeekView();
1898 showSelectedDates = true; 1899 showSelectedDates = true;
1899 break; 1900 break;
1900 case Qt::Key_H : 1901 case Qt::Key_H :
1901 keyBindings(); 1902 keyBindings();
1902 break; 1903 break;
1903 case Qt::Key_W: 1904 case Qt::Key_W:
1904 mView->viewManager()->showWhatsNextView(); 1905 mView->viewManager()->showWhatsNextView();
1905 break; 1906 break;
1906 case Qt::Key_L: 1907 case Qt::Key_L:
1907 mView->viewManager()->showListView(); 1908 mView->viewManager()->showListView();
1908 break; 1909 break;
1909 case Qt::Key_N: 1910 case Qt::Key_N:
1910 mView->viewManager()->showNextView(); 1911 mView->viewManager()->showNextView();
1911 break; 1912 break;
1912 case Qt::Key_V: 1913 case Qt::Key_V:
1913 mView->viewManager()->showTodoView(); 1914 mView->viewManager()->showTodoView();
1914 break; 1915 break;
1915 case Qt::Key_C: 1916 case Qt::Key_C:
1916 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1917 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1917 break; 1918 break;
1918 case Qt::Key_P: 1919 case Qt::Key_P:
1919 mView->showDatePicker( ); 1920 mView->showDatePicker( );
1920 break; 1921 break;
1921 case Qt::Key_F: 1922 case Qt::Key_F:
1922 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1923 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1923 mView->editFilters(); 1924 mView->editFilters();
1924 else 1925 else
1925 mView->toggleFilter(); 1926 mView->toggleFilter();
1926 break; 1927 break;
1927 case Qt::Key_X: 1928 case Qt::Key_X:
1928 if ( e->state() == Qt::ControlButton ) 1929 if ( e->state() == Qt::ControlButton )
1929 mView->toggleDateNavigatorWidget(); 1930 mView->toggleDateNavigatorWidget();
1930 else { 1931 else {
1931 mView->viewManager()->showNextXView(); 1932 mView->viewManager()->showNextXView();
1932 showSelectedDates = true; 1933 showSelectedDates = true;
1933 } 1934 }
1934 break; 1935 break;
1935 case Qt::Key_Space: 1936 case Qt::Key_Space:
1936 mView->toggleExpand(); 1937 mView->toggleExpand();
1937 break; 1938 break;
1938 case Qt::Key_A: 1939 case Qt::Key_A:
1939 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 1940 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
1940 mView->showNextAlarms(); 1941 mView->showNextAlarms();
1941 else 1942 else
1942 mView->toggleAllDaySize(); 1943 mView->toggleAllDaySize();
1943 break; 1944 break;
1944 case Qt::Key_T: 1945 case Qt::Key_T:
1945 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1946 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1946 mView->newTodo(); 1947 mView->newTodo();
1947 else { 1948 else {
1948 mView->goToday(); 1949 mView->goToday();
1949 showSelectedDates = true; 1950 showSelectedDates = true;
1950 } 1951 }
1951 break; 1952 break;
1952 case Qt::Key_J: 1953 case Qt::Key_J:
1953 mView->viewManager()->showJournalView(); 1954 mView->viewManager()->showJournalView();
1954 break; 1955 break;
1955 case Qt::Key_B: 1956 case Qt::Key_B:
1956 mView->editIncidenceDescription();; 1957 mView->editIncidenceDescription();;
1957 break; 1958 break;
1958 // case Qt::Key_Return: 1959 // case Qt::Key_Return:
1959 case Qt::Key_E: 1960 case Qt::Key_E:
1960 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1961 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1961 mView->newEvent(); 1962 mView->newEvent();
1962 else 1963 else
1963 mView->editIncidence(); 1964 mView->editIncidence();
1964 break; 1965 break;
1965 case Qt::Key_Plus: 1966 case Qt::Key_Plus:
1966 size = p->mHourSize +2; 1967 size = p->mHourSize +2;
1967 if ( size <= 22 ) 1968 if ( size <= 22 )
1968 configureAgenda( size ); 1969 configureAgenda( size );
1969 break; 1970 break;
1970 case Qt::Key_Minus: 1971 case Qt::Key_Minus:
1971 size = p->mHourSize - 2; 1972 size = p->mHourSize - 2;
1972 if ( size >= 4 ) 1973 if ( size >= 4 )
1973 configureAgenda( size ); 1974 configureAgenda( size );
1974 break; 1975 break;
1975 1976
1976 1977
1977 default: 1978 default:
1978 e->ignore(); 1979 e->ignore();
1979 } 1980 }
1980 if ( pro > 0 ) { 1981 if ( pro > 0 ) {
1981 mView->selectFilter( pro-1 ); 1982 mView->selectFilter( pro-1 );
1982 } 1983 }
1983 if ( showSelectedDates ) { 1984 if ( showSelectedDates ) {
1984 ;// setCaptionToDates(); 1985 ;// setCaptionToDates();
1985 } 1986 }
1986 1987
1987} 1988}
1988void MainWindow::fillFilterMenuTB() 1989void MainWindow::fillFilterMenuTB()
1989{ 1990{
1990 selectFilterMenuTB->clear(); 1991 selectFilterMenuTB->clear();
1991 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 1992 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
1992 selectFilterMenuTB->insertSeparator(); 1993 selectFilterMenuTB->insertSeparator();
1993 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 1994 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
1994 1995
1995 selectFilterMenuTB->insertSeparator(); 1996 selectFilterMenuTB->insertSeparator();
1996 QPtrList<CalFilter> fili = mView->filters(); 1997 QPtrList<CalFilter> fili = mView->filters();
1997 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1998 CalFilter *curfilter = mView->filterView()->selectedFilter();
1998 CalFilter *filter = fili.first(); 1999 CalFilter *filter = fili.first();
1999 int iii = 2; 2000 int iii = 2;
2000 bool checkitem = mView->filterView()->filtersEnabled(); 2001 bool checkitem = mView->filterView()->filtersEnabled();
2001 while(filter) { 2002 while(filter) {
2002 selectFilterMenuTB->insertItem( filter->name(), iii ); 2003 selectFilterMenuTB->insertItem( filter->name(), iii );
2003 if ( filter == curfilter) 2004 if ( filter == curfilter)
2004 selectFilterMenuTB->setItemChecked( iii, checkitem ); 2005 selectFilterMenuTB->setItemChecked( iii, checkitem );
2005 filter = fili.next(); 2006 filter = fili.next();
2006 ++iii; 2007 ++iii;
2007 } 2008 }
2008 if ( !checkitem ) 2009 if ( !checkitem )
2009 selectFilterMenuTB->setItemChecked( 1, true ); 2010 selectFilterMenuTB->setItemChecked( 1, true );
2010 2011
2011 int x = 0; 2012 int x = 0;
2012 int y = iconToolBar->height(); 2013 int y = iconToolBar->height();
2013 int dX = 0; 2014 int dX = 0;
2014 int dY = 0; 2015 int dY = 0;
2015 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2016 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2016 if ( iconToolBar->y() > height()/2 ) { 2017 if ( iconToolBar->y() > height()/2 ) {
2017 dY = selectFilterMenuTB->sizeHint().height()+8; 2018 dY = selectFilterMenuTB->sizeHint().height()+8;
2018 y = 0; 2019 y = 0;
2019 } 2020 }
2020 } else { 2021 } else {
2021 if ( iconToolBar->x() > width()/2 ) { // right side 2022 if ( iconToolBar->x() > width()/2 ) { // right side
2022 x=0; 2023 x=0;
2023 dX= selectFilterMenuTB->sizeHint().width()+8; 2024 dX= selectFilterMenuTB->sizeHint().width()+8;
2024 y = 0; 2025 y = 0;
2025 } else { 2026 } else {
2026 x= iconToolBar->width(); 2027 x= iconToolBar->width();
2027 y = 0; 2028 y = 0;
2028 } 2029 }
2029 } 2030 }
2030 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2031 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2031 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); 2032 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
2032} 2033}
2033void MainWindow::fillFilterMenu() 2034void MainWindow::fillFilterMenu()
2034{ 2035{
2035 selectFilterMenu->clear(); 2036 selectFilterMenu->clear();
2036 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 2037 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
2037 selectFilterMenu->insertSeparator(); 2038 selectFilterMenu->insertSeparator();
2038 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 2039 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
2039 2040
2040 selectFilterMenu->insertSeparator(); 2041 selectFilterMenu->insertSeparator();
2041 QPtrList<CalFilter> fili = mView->filters(); 2042 QPtrList<CalFilter> fili = mView->filters();
2042 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2043 CalFilter *curfilter = mView->filterView()->selectedFilter();
2043 CalFilter *filter = fili.first(); 2044 CalFilter *filter = fili.first();
2044 int iii = 2; 2045 int iii = 2;
2045 bool checkitem = mView->filterView()->filtersEnabled(); 2046 bool checkitem = mView->filterView()->filtersEnabled();
2046 while(filter) { 2047 while(filter) {
2047 selectFilterMenu->insertItem( filter->name(), iii ); 2048 selectFilterMenu->insertItem( filter->name(), iii );
2048 if ( filter == curfilter) 2049 if ( filter == curfilter)
2049 selectFilterMenu->setItemChecked( iii, checkitem ); 2050 selectFilterMenu->setItemChecked( iii, checkitem );
2050 filter = fili.next(); 2051 filter = fili.next();
2051 ++iii; 2052 ++iii;
2052 } 2053 }
2053 if ( !checkitem ) 2054 if ( !checkitem )
2054 selectFilterMenu->setItemChecked( 1, true ); 2055 selectFilterMenu->setItemChecked( 1, true );
2055} 2056}
2056void MainWindow::fillFilterMenuPopup() 2057void MainWindow::fillFilterMenuPopup()
2057{ 2058{
2058 filterPopupMenu->clear(); 2059 filterPopupMenu->clear();
2059 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2060 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2060 2061
2061 filterPopupMenu->insertSeparator(); 2062 filterPopupMenu->insertSeparator();
2062 QPtrList<CalFilter> fili = mView->filters(); 2063 QPtrList<CalFilter> fili = mView->filters();
2063 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2064 CalFilter *curfilter = mView->filterView()->selectedFilter();
2064 CalFilter *filter = fili.first(); 2065 CalFilter *filter = fili.first();
2065 int iii = 1; 2066 int iii = 1;
2066 bool checkitem = mView->filterView()->filtersEnabled(); 2067 bool checkitem = mView->filterView()->filtersEnabled();
2067 while(filter) { 2068 while(filter) {
2068 filterPopupMenu->insertItem( filter->name(), iii ); 2069 filterPopupMenu->insertItem( filter->name(), iii );
2069 if ( filter == curfilter) 2070 if ( filter == curfilter)
2070 filterPopupMenu->setItemChecked( iii, checkitem ); 2071 filterPopupMenu->setItemChecked( iii, checkitem );
2071 filter = fili.next(); 2072 filter = fili.next();
2072 ++iii; 2073 ++iii;
2073 } 2074 }
2074 if ( !checkitem ) 2075 if ( !checkitem )
2075 filterPopupMenu->setItemChecked( 0, true ); 2076 filterPopupMenu->setItemChecked( 0, true );
2076} 2077}
2077void MainWindow::selectFilter( int fil ) 2078void MainWindow::selectFilter( int fil )
2078{ 2079{
2079 2080
2080 if ( fil == 0 ) { 2081 if ( fil == 0 ) {
2081 mView->editFilters( ); 2082 mView->editFilters( );
2082 } else if ( fil == 1 ){ 2083 } else if ( fil == 1 ){
2083 if ( mView->filterView()->filtersEnabled() ) 2084 if ( mView->filterView()->filtersEnabled() )
2084 mView->toggleFilerEnabled( ); 2085 mView->toggleFilerEnabled( );
2085 } else { 2086 } else {
2086 if ( !mView->filterView()->filtersEnabled() ) { 2087 if ( !mView->filterView()->filtersEnabled() ) {
2087 mView->filterView()->blockSignals( true ); 2088 mView->filterView()->blockSignals( true );
2088 mView->toggleFilerEnabled( ); 2089 mView->toggleFilerEnabled( );
2089 mView->filterView()->blockSignals( false ); 2090 mView->filterView()->blockSignals( false );
2090 } 2091 }
2091 mView->selectFilter( fil-2 ); 2092 mView->selectFilter( fil-2 );
2092 } 2093 }
2093} 2094}
2094void MainWindow::updateFilterToolbar() 2095void MainWindow::updateFilterToolbar()
2095{ 2096{
2096 if ( filterMenubar ) { 2097 if ( filterMenubar ) {
2097 if ( !mView->filterView()->filtersEnabled() ) { 2098 if ( !mView->filterView()->filtersEnabled() ) {
2098 filterMenubar->changeItem( 0, i18n("No Filter") ); 2099 filterMenubar->changeItem( 0, i18n("No Filter") );
2099 } else { 2100 } else {
2100 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2101 CalFilter *curfilter = mView->filterView()->selectedFilter();
2101 if ( curfilter ) { 2102 if ( curfilter ) {
2102 filterMenubar->changeItem( 0, curfilter->name() ); 2103 filterMenubar->changeItem( 0, curfilter->name() );
2103 } 2104 }
2104 } 2105 }
2105 } 2106 }
2106} 2107}
2107void MainWindow::selectFilterPopup( int fil ) 2108void MainWindow::selectFilterPopup( int fil )
2108{ 2109{
2109 selectFilter( fil + 1 ); 2110 selectFilter( fil + 1 );
2110 2111
2111} 2112}
2112void MainWindow::configureToolBar( int item ) 2113void MainWindow::configureToolBar( int item )
2113{ 2114{
2114 2115
2115 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 2116 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
2116 KOPrefs *p = KOPrefs::instance(); 2117 KOPrefs *p = KOPrefs::instance();
2117 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 2118 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
2118 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); 2119 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 );
2119 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); 2120 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
2120 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 2121 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
2121 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 2122 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
2122 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); 2123 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 );
2123 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); 2124 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 );
2124 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); 2125 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 );
2125 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); 2126 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 );
2126 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 2127 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
2127 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 2128 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
2128 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 2129 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
2129 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 2130 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
2130 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 2131 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
2131 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 2132 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
2132 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 2133 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
2133 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 2134 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
2134 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 2135 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
2135 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 2136 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
2136 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 2137 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
2137 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2138 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
2138 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2139 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
2139 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2140 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
2140 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2141 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
2141 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2142 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
2142 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2143 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
2143 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2144 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
2144 // initActions(); 2145 // initActions();
2145} 2146}
2146void MainWindow::setCaption ( const QString & c ) 2147void MainWindow::setCaption ( const QString & c )
2147{ 2148{
2148 QString cap = c; 2149 QString cap = c;
2149 cap.replace( QRegExp("\n"), " " ); 2150 cap.replace( QRegExp("\n"), " " );
2150 cap = cap.stripWhiteSpace(); 2151 cap = cap.stripWhiteSpace();
2151 if ( cap.isEmpty() ) 2152 if ( cap.isEmpty() )
2152 cap = "KO/Pi"; 2153 cap = "KO/Pi";
2153 QWidget::setCaption( cap ); 2154 QWidget::setCaption( cap );
2154} 2155}
2155void MainWindow::setCaptionToDates() 2156void MainWindow::setCaptionToDates()
2156{ 2157{
2157 QString selDates; 2158 QString selDates;
2158 QDate date = mView->startDate(); 2159 QDate date = mView->startDate();
2159 if ( ! date.isValid() ) { 2160 if ( ! date.isValid() ) {
2160 setCaption(""); 2161 setCaption("");
2161 return; 2162 return;
2162 } 2163 }
2163 selDates = KGlobal::locale()->formatDate( date, true); 2164 selDates = KGlobal::locale()->formatDate( date, true);
2164 if (mView->startDate() < mView->endDate() ) 2165 if (mView->startDate() < mView->endDate() )
2165 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2166 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2166 else { 2167 else {
2167 QString addString; 2168 QString addString;
2168 if ( date == QDateTime::currentDateTime().date() ) 2169 if ( date == QDateTime::currentDateTime().date() )
2169 addString = i18n("Today"); 2170 addString = i18n("Today");
2170 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2171 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2171 addString = i18n("Tomorrow"); 2172 addString = i18n("Tomorrow");
2172 if ( !addString.isEmpty() ) 2173 if ( !addString.isEmpty() )
2173 selDates = addString+", "+selDates ; 2174 selDates = addString+", "+selDates ;
2174 } 2175 }
2175 setCaption( i18n("Dates: ") + selDates ); 2176 setCaption( i18n("Dates: ") + selDates );
2176 2177
2177} 2178}
2178void MainWindow::showConfigureAgenda( ) 2179void MainWindow::showConfigureAgenda( )
2179{ 2180{
2180 int iii; 2181 int iii;
2181 for ( iii = 1;iii<= 10 ;++iii ){ 2182 for ( iii = 1;iii<= 10 ;++iii ){
2182 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2183 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2183 } 2184 }
2184 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2185 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2185} 2186}
2186void MainWindow::configureAgenda( int item ) 2187void MainWindow::configureAgenda( int item )
2187{ 2188{
2188 if ( KOPrefs::instance()->mHourSize == item ) 2189 if ( KOPrefs::instance()->mHourSize == item )
2189 return; 2190 return;
2190 KOPrefs::instance()->mHourSize=item; 2191 KOPrefs::instance()->mHourSize=item;
2191 mView->viewManager()->agendaView()->updateConfig(); 2192 mView->viewManager()->agendaView()->updateConfig();
2192} 2193}
2193 2194
2194void MainWindow::saveCalendar() 2195void MainWindow::saveCalendar()
2195{ 2196{
2196 QString fn = KOPrefs::instance()->mLastSaveFile; 2197 QString fn = KOPrefs::instance()->mLastSaveFile;
2197 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 2198 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
2198 2199
2199 if ( fn == "" ) 2200 if ( fn == "" )
2200 return; 2201 return;
2201 QFileInfo info; 2202 QFileInfo info;
2202 info.setFile( fn ); 2203 info.setFile( fn );
2203 QString mes; 2204 QString mes;
2204 bool createbup = true; 2205 bool createbup = true;
2205 if ( info. exists() ) { 2206 if ( info. exists() ) {
2206 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 2207 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
2207 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2208 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2208 i18n("Overwrite!"), i18n("Cancel"), 0, 2209 i18n("Overwrite!"), i18n("Cancel"), 0,
2209 0, 1 ); 2210 0, 1 );
2210 if ( result != 0 ) { 2211 if ( result != 0 ) {
2211 createbup = false; 2212 createbup = false;
2212 } 2213 }
2213 } 2214 }
2214 if ( createbup ) { 2215 if ( createbup ) {
2215 mView->saveCalendar( fn ); 2216 mView->saveCalendar( fn );
2216 mes = i18n("KO/Pi:Saved %1").arg(fn); 2217 mes = i18n("KO/Pi:Saved %1").arg(fn);
2217 KOPrefs::instance()->mLastSaveFile = fn; 2218 KOPrefs::instance()->mLastSaveFile = fn;
2218 setCaption(mes); 2219 setCaption(mes);
2219 } 2220 }
2220} 2221}
2221void MainWindow::loadCalendar() 2222void MainWindow::loadCalendar()
2222{ 2223{
2223 2224
2224 QString fn = KOPrefs::instance()->mLastLoadFile; 2225 QString fn = KOPrefs::instance()->mLastLoadFile;
2225 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2226 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2226 2227
2227 if ( fn == "" ) 2228 if ( fn == "" )
2228 return; 2229 return;
2229 QFileInfo info; 2230 QFileInfo info;
2230 info.setFile( fn ); 2231 info.setFile( fn );
2231 QString mess; 2232 QString mess;
2232 bool loadbup = true; 2233 bool loadbup = true;
2233 if ( info. exists() ) { 2234 if ( info. exists() ) {
2234 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2235 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2235 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2236 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2236 mess, 2237 mess,
2237 i18n("Load!"), i18n("Cancel"), 0, 2238 i18n("Load!"), i18n("Cancel"), 0,
2238 0, 1 ); 2239 0, 1 );
2239 if ( result != 0 ) { 2240 if ( result != 0 ) {
2240 loadbup = false; 2241 loadbup = false;
2241 } 2242 }
2242 } else { 2243 } else {
2243 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2244 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2244 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2245 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2245 0, 1 ); 2246 0, 1 );
2246 2247
2247 return; 2248 return;
2248 } 2249 }
2249 if ( loadbup ) { 2250 if ( loadbup ) {
2250 mView->openCalendar( fn ); 2251 mView->openCalendar( fn );
2251 KOPrefs::instance()->mLastLoadFile = fn; 2252 KOPrefs::instance()->mLastLoadFile = fn;
2252 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2253 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2253 setCaption(mess); 2254 setCaption(mess);
2254 } 2255 }
2255 2256
2256} 2257}
2257void MainWindow::quickImportIcal() 2258void MainWindow::quickImportIcal()
2258{ 2259{
2259 importFile( KOPrefs::instance()->mLastImportFile, false ); 2260 importFile( KOPrefs::instance()->mLastImportFile, false );
2260} 2261}
2261void MainWindow::importFile( QString fn, bool quick ) 2262void MainWindow::importFile( QString fn, bool quick )
2262{ 2263{
2263 QFileInfo info; 2264 QFileInfo info;
2264 info.setFile( fn ); 2265 info.setFile( fn );
2265 QString mess; 2266 QString mess;
2266 bool loadbup = true; 2267 bool loadbup = true;
2267 if ( !info. exists() ) { 2268 if ( !info. exists() ) {
2268 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2269 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2269 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2270 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2270 mess ); 2271 mess );
2271 return; 2272 return;
2272 } 2273 }
2273 int result = 0; 2274 int result = 0;
2274 if ( !quick ) { 2275 if ( !quick ) {
2275 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2276 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2276 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2277 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2277 mess, 2278 mess,
2278 "Import", "Cancel", 0, 2279 "Import", "Cancel", 0,
2279 0, 1 ); 2280 0, 1 );
2280 } 2281 }
2281 if ( result == 0 ) { 2282 if ( result == 0 ) {
2282 if ( mView->openCalendar( fn, true )) { 2283 if ( mView->openCalendar( fn, true )) {
2283 KOPrefs::instance()->mLastImportFile = fn; 2284 KOPrefs::instance()->mLastImportFile = fn;
2284 setCaption(i18n("Imported file successfully")); 2285 setCaption(i18n("Imported file successfully"));
2285 } else { 2286 } else {
2286 setCaption(i18n("Error importing file")); 2287 setCaption(i18n("Error importing file"));
2287 } 2288 }
2288 } 2289 }
2289} 2290}
2290 2291
2291void MainWindow::importIcal() 2292void MainWindow::importIcal()
2292{ 2293{
2293 2294
2294 QString fn =KOPrefs::instance()->mLastImportFile; 2295 QString fn =KOPrefs::instance()->mLastImportFile;
2295 2296
2296 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2297 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2297 if ( fn == "" ) 2298 if ( fn == "" )
2298 return; 2299 return;
2299 importFile( fn, true ); 2300 importFile( fn, true );
2300 2301
2301} 2302}
2302 2303
2303void MainWindow::exportVCalendar() 2304void MainWindow::exportVCalendar()
2304{ 2305{
2305 QString fn = KOPrefs::instance()->mLastVcalFile; 2306 QString fn = KOPrefs::instance()->mLastVcalFile;
2306 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2307 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2307 if ( fn == "" ) 2308 if ( fn == "" )
2308 return; 2309 return;
2309 QFileInfo info; 2310 QFileInfo info;
2310 info.setFile( fn ); 2311 info.setFile( fn );
2311 QString mes; 2312 QString mes;
2312 bool createbup = true; 2313 bool createbup = true;
2313 if ( info. exists() ) { 2314 if ( info. exists() ) {
2314 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2315 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2315 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2316 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2316 i18n("Overwrite!"), i18n("Cancel"), 0, 2317 i18n("Overwrite!"), i18n("Cancel"), 0,
2317 0, 1 ); 2318 0, 1 );
2318 if ( result != 0 ) { 2319 if ( result != 0 ) {
2319 createbup = false; 2320 createbup = false;
2320 } 2321 }
2321 } 2322 }
2322 if ( createbup ) { 2323 if ( createbup ) {
2323 if ( mView->exportVCalendar( fn ) ) { 2324 if ( mView->exportVCalendar( fn ) ) {
2324 KOPrefs::instance()->mLastVcalFile = fn; 2325 KOPrefs::instance()->mLastVcalFile = fn;
2325 if ( fn.length() > 20 ) 2326 if ( fn.length() > 20 )
2326 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2327 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2327 else 2328 else
2328 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2329 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2329 setCaption(mes); 2330 setCaption(mes);
2330 } 2331 }
2331 } 2332 }
2332 2333
2333} 2334}
2334QString MainWindow::sentSyncFile() 2335QString MainWindow::sentSyncFile()
2335{ 2336{
2336#ifdef DESKTOP_VERSION 2337#ifdef DESKTOP_VERSION
2337 return locateLocal( "tmp", "copysynccal.ics" ); 2338 return locateLocal( "tmp", "copysynccal.ics" );
2338#else 2339#else
2339 return QString( "/tmp/copysynccal.ics" ); 2340 return QString( "/tmp/copysynccal.ics" );
2340#endif 2341#endif
2341} 2342}
2342 2343
2343void MainWindow::syncFileRequest() 2344void MainWindow::syncFileRequest()
2344{ 2345{
2345 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2346 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2346 mSyncManager->slotSyncMenu( 999 ); 2347 mSyncManager->slotSyncMenu( 999 );
2347 } 2348 }
2348 2349
2349 setCaption(i18n("Saving Data to temp file ..." )); 2350 setCaption(i18n("Saving Data to temp file ..." ));
2350 mView->saveCalendar( sentSyncFile() ); 2351 mView->saveCalendar( sentSyncFile() );
2351 setCaption(i18n("Data saved to temp file!" )); 2352 setCaption(i18n("Data saved to temp file!" ));
2352 2353
2353} 2354}
2354void MainWindow::getFile( bool success ) 2355void MainWindow::getFile( bool success )
2355{ 2356{
2356 if ( ! success ) { 2357 if ( ! success ) {
2357 setCaption( i18n("Error receiving file. Nothing changed!") ); 2358 setCaption( i18n("Error receiving file. Nothing changed!") );
2358 return; 2359 return;
2359 } 2360 }
2360 mView->openCalendar( sentSyncFile() ); 2361 mView->openCalendar( sentSyncFile() );
2361 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2362 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2362 mSyncManager->slotSyncMenu( 999 ); 2363 mSyncManager->slotSyncMenu( 999 );
2363 } 2364 }
2364 setCaption( i18n("Pi-Sync successful!") ); 2365 setCaption( i18n("Pi-Sync successful!") );
2365} 2366}
2366 2367
2367void MainWindow::printSel( ) 2368void MainWindow::printSel( )
2368{ 2369{
2369 mView->viewManager()->agendaView()->agenda()->printSelection(); 2370 mView->viewManager()->agendaView()->agenda()->printSelection();
2370} 2371}
2371 2372
2372void MainWindow::printCal() 2373void MainWindow::printCal()
2373{ 2374{
2374 mView->print();//mCp->showDialog(); 2375 mView->print();//mCp->showDialog();
2375} 2376}
2376 2377
2377 2378
2378#include "libkdepim/kdatepicker.h" 2379#include "libkdepim/kdatepicker.h"
2379#include <kdatetbl.h> 2380#include <kdatetbl.h>
2380 2381
2381void MainWindow::weekAction() 2382void MainWindow::weekAction()
2382{ 2383{
2383 int month; 2384 int month;
2384 KPopupFrame* popup = new KPopupFrame(this); 2385 KPopupFrame* popup = new KPopupFrame(this);
2385 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2386 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2386 // ----- 2387 // -----
2387 picker->resize(picker->sizeHint()); 2388 picker->resize(picker->sizeHint());
2388 popup->setMainWidget(picker); 2389 popup->setMainWidget(picker);
2389 picker->setFocus(); 2390 picker->setFocus();
2390 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2391 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2391 int x = 0; 2392 int x = 0;
2392 int y = iconToolBar->height(); 2393 int y = iconToolBar->height();
2393 int dX = 0; 2394 int dX = 0;
2394 int dY = 0; 2395 int dY = 0;
2395 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2396 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2396 if ( iconToolBar->y() > height()/2 ) { 2397 if ( iconToolBar->y() > height()/2 ) {
2397 dY = picker->sizeHint().height()+8; 2398 dY = picker->sizeHint().height()+8;
2398 y = 0; 2399 y = 0;
2399 } 2400 }
2400 } else { 2401 } else {
2401 if ( iconToolBar->x() > width()/2 ) { // right side 2402 if ( iconToolBar->x() > width()/2 ) { // right side
2402 x=0; 2403 x=0;
2403 dX= picker->sizeHint().width()+8; 2404 dX= picker->sizeHint().width()+8;
2404 y = 0; 2405 y = 0;
2405 } else { 2406 } else {
2406 x= iconToolBar->width(); 2407 x= iconToolBar->width();
2407 y = 0; 2408 y = 0;
2408 } 2409 }
2409 } 2410 }
2410 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2411 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2411 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2412 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2412 { 2413 {
2413 month = picker->getResult(); 2414 month = picker->getResult();
2414 emit selectWeek ( month ); 2415 emit selectWeek ( month );
2415 //qDebug("weekSelected %d ", month); 2416 //qDebug("weekSelected %d ", month);
2416 } 2417 }
2417 delete popup; 2418 delete popup;
2418} 2419}
2419 2420
2420void MainWindow::hideEvent ( QHideEvent * ) 2421void MainWindow::hideEvent ( QHideEvent * )
2421{ 2422{
2422 QString message; 2423 QString message;
2423 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2424 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2424 if ( nextA.isValid() ) { 2425 if ( nextA.isValid() ) {
2425 QString sum = mCalendar->nextSummary(); 2426 QString sum = mCalendar->nextSummary();
2426 2427
2427 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2428 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2428 setCaption( message ); 2429 setCaption( message );
2429 } 2430 }
2430} 2431}
2431 2432
2432void MainWindow::resizeEvent( QResizeEvent* e) 2433void MainWindow::resizeEvent( QResizeEvent* e)
2433{ 2434{
2434#ifndef DESKTOP_VERSION 2435#ifndef DESKTOP_VERSION
2435 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { 2436 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) {
2436 if (QApplication::desktop()->width() > QApplication::desktop()->height() ) 2437 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2437 filterToolBar->hide(); 2438 filterToolBar->hide();
2438 else 2439 else
2439 filterToolBar->show(); 2440 filterToolBar->show();
2440 } 2441 }
2441#endif 2442#endif
2442 QMainWindow::resizeEvent( e); 2443 QMainWindow::resizeEvent( e);
2443} 2444}