summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-14 20:32:31 (UTC)
committer zautrix <zautrix>2005-04-14 20:32:31 (UTC)
commit7e87a287a0860882af27e26288bc9cc553dd3a0b (patch) (unidiff)
treea55374f708a8c27da182bcd8d975ad3f20f39057
parent2a449f785f955649df9de639d38dcb250fe1376d (diff)
downloadkdepimpi-7e87a287a0860882af27e26288bc9cc553dd3a0b.zip
kdepimpi-7e87a287a0860882af27e26288bc9cc553dd3a0b.tar.gz
kdepimpi-7e87a287a0860882af27e26288bc9cc553dd3a0b.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneralevent.cpp26
-rw-r--r--korganizer/koeditorgeneralevent.h2
-rw-r--r--korganizer/koeventviewerdialog.cpp7
3 files changed, 19 insertions, 16 deletions
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp
index 3b2a276..af97ee9 100644
--- a/korganizer/koeditorgeneralevent.cpp
+++ b/korganizer/koeditorgeneralevent.cpp
@@ -49,268 +49,274 @@
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 connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime))); 145 connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(sTimeChanged(QTime)));
146 connect(mEndDateEdit,SIGNAL(setTimeTo(QTime)),mEndTimeEdit,SLOT(setTime(QTime))); 146 connect(mEndDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(eTimeChanged(QTime)));
147
148} 147}
149 148
150void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout) 149void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout)
151{ 150{
152 QBoxLayout *classLayout = new QHBoxLayout(topLayout); 151 QBoxLayout *classLayout = new QHBoxLayout(topLayout);
153 152
154 QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent); 153 QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent);
155 classLayout->addWidget(freeTimeLabel); 154 classLayout->addWidget(freeTimeLabel);
156 155
157 mFreeTimeCombo = new QComboBox(false, parent); 156 mFreeTimeCombo = new QComboBox(false, parent);
158 mFreeTimeCombo->insertItem(i18n("Busy")); 157 mFreeTimeCombo->insertItem(i18n("Busy"));
159 mFreeTimeCombo->insertItem(i18n("Free")); 158 mFreeTimeCombo->insertItem(i18n("Free"));
160 classLayout->addWidget(mFreeTimeCombo); 159 classLayout->addWidget(mFreeTimeCombo);
161} 160}
162 161
163void KOEditorGeneralEvent::timeStuffDisable(bool disable) 162void KOEditorGeneralEvent::timeStuffDisable(bool disable)
164{ 163{
165 mStartTimeEdit->setEnabled( !disable ); 164 mStartTimeEdit->setEnabled( !disable );
166 mEndTimeEdit->setEnabled( !disable ); 165 mEndTimeEdit->setEnabled( !disable );
167 166
168 setDuration(); 167 setDuration();
169 emitDateTimeStr(); 168 emitDateTimeStr();
170} 169}
171 170
172void KOEditorGeneralEvent::dontAssociateTime(bool noTime) 171void KOEditorGeneralEvent::dontAssociateTime(bool noTime)
173{ 172{
174 timeStuffDisable(noTime); 173 timeStuffDisable(noTime);
175 //if(alarmButton->isChecked()) alarmStuffDisable(noTime); 174 //if(alarmButton->isChecked()) alarmStuffDisable(noTime);
176 allDayChanged(noTime); 175 allDayChanged(noTime);
177} 176}
178 177
179void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end) 178void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end)
180{ 179{
181// kdDebug() << "KOEditorGeneralEvent::setDateTimes(): Start DateTime: " << start.toString() << endl; 180// kdDebug() << "KOEditorGeneralEvent::setDateTimes(): Start DateTime: " << start.toString() << endl;
182 if ( !mTemplate ) 181 if ( !mTemplate )
183 mStartDateEdit->setDate(start.date()); 182 mStartDateEdit->setDate(start.date());
184 // KTimeEdit seems to emit some signals when setTime() is called. 183 // KTimeEdit seems to emit some signals when setTime() is called.
185 mStartTimeEdit->blockSignals( true ); 184 mStartTimeEdit->blockSignals( true );
186 mStartTimeEdit->setTime(start.time()); 185 mStartTimeEdit->setTime(start.time());
187 mStartTimeEdit->blockSignals( false ); 186 mStartTimeEdit->blockSignals( false );
188 if ( !mTemplate ) 187 if ( !mTemplate )
189 mEndDateEdit->setDate(end.date()); 188 mEndDateEdit->setDate(end.date());
190 mEndTimeEdit->setTime(end.time()); 189 mEndTimeEdit->setTime(end.time());
191 190
192 mCurrStartDateTime = start; 191 mCurrStartDateTime = start;
193 mCurrEndDateTime = end; 192 mCurrEndDateTime = end;
194 193
195 setDuration(); 194 setDuration();
196 emitDateTimeStr(); 195 emitDateTimeStr();
197} 196}
198 197
198void KOEditorGeneralEvent::sTimeChanged(QTime ti)
199{
200 mStartTimeEdit->setTime( ti );
201 startTimeChanged ( ti);
202}
203void KOEditorGeneralEvent::eTimeChanged(QTime ti )
204{
205 mEndTimeEdit->setTime( ti );
206 endTimeChanged( ti );
207}
199void KOEditorGeneralEvent::startTimeChanged(QTime newtime) 208void KOEditorGeneralEvent::startTimeChanged(QTime newtime)
200{ 209{
201 kdDebug() << "KOEditorGeneralEvent::startTimeChanged() " << newtime.toString() << endl;
202 210
203 int secsep = mCurrStartDateTime.secsTo(mCurrEndDateTime); 211 int secsep = mCurrStartDateTime.secsTo(mCurrEndDateTime);
204 212
205 mCurrStartDateTime.setTime(newtime); 213 mCurrStartDateTime = QDateTime( mStartDateEdit->date(), QTime(newtime.hour(),newtime.minute(),0) );
206
207 // adjust end time so that the event has the same duration as before. 214 // adjust end time so that the event has the same duration as before.
208 mCurrEndDateTime = mCurrStartDateTime.addSecs(secsep); 215 if( secsep > 0 )
216 mCurrEndDateTime = mCurrStartDateTime.addSecs(secsep);
209 mEndTimeEdit->setTime(mCurrEndDateTime.time()); 217 mEndTimeEdit->setTime(mCurrEndDateTime.time());
210 mEndDateEdit->setDate(mCurrEndDateTime.date()); 218 mEndDateEdit->setDate(mCurrEndDateTime.date());
211 219
212 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); 220 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
213} 221}
214 222
215void KOEditorGeneralEvent::endTimeChanged(QTime newtime) 223void KOEditorGeneralEvent::endTimeChanged(QTime newtime)
216{ 224{
217// kdDebug() << "KOEditorGeneralEvent::endTimeChanged " << newtime.toString() << endl;
218 225
219 QDateTime newdt(mCurrEndDateTime.date(), newtime); 226 mCurrEndDateTime = QDateTime ( mEndDateEdit->date(), QTime(newtime.hour(),newtime.minute(),0));
220 mCurrEndDateTime = newdt;
221 227
222 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); 228 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
223} 229}
224 230
225void KOEditorGeneralEvent::startDateChanged(QDate newdate) 231void KOEditorGeneralEvent::startDateChanged(QDate newdate)
226{ 232{
227 int daysep = mCurrStartDateTime.daysTo(mCurrEndDateTime); 233 int daysep = mCurrStartDateTime.daysTo(mCurrEndDateTime);
228 234
229 mCurrStartDateTime.setDate(newdate); 235 mCurrStartDateTime.setDate(newdate);
230 236
231 // adjust end date so that the event has the same duration as before 237 // adjust end date so that the event has the same duration as before
232 mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep)); 238 mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep));
233 mEndDateEdit->setDate(mCurrEndDateTime.date()); 239 mEndDateEdit->setDate(mCurrEndDateTime.date());
234 240
235 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); 241 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
236} 242}
237 243
238void KOEditorGeneralEvent::endDateChanged(QDate newdate) 244void KOEditorGeneralEvent::endDateChanged(QDate newdate)
239{ 245{
240 QDateTime newdt(newdate, mCurrEndDateTime.time()); 246 QDateTime newdt(newdate, mCurrEndDateTime.time());
241 247
242 if(newdt < mCurrStartDateTime) { 248 if(newdt < mCurrStartDateTime) {
243 // oops, we can't let that happen. 249 // oops, we can't let that happen.
244 newdt = mCurrStartDateTime; 250 newdt = mCurrStartDateTime;
245 mEndDateEdit->setDate(newdt.date()); 251 mEndDateEdit->setDate(newdt.date());
246 mEndTimeEdit->setTime(newdt.time()); 252 mEndTimeEdit->setTime(newdt.time());
247 } 253 }
248 mCurrEndDateTime = newdt; 254 mCurrEndDateTime = newdt;
249 255
250 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); 256 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
251} 257}
252 258
253void KOEditorGeneralEvent::setDefaults(QDateTime from,QDateTime to,bool allDay) 259void KOEditorGeneralEvent::setDefaults(QDateTime from,QDateTime to,bool allDay)
254{ 260{
255 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); 261 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT);
256 mLocationEdit->load(KOLocationBox::LOCATION); 262 mLocationEdit->load(KOLocationBox::LOCATION);
257 KOEditorGeneral::setDefaults(allDay); 263 KOEditorGeneral::setDefaults(allDay);
258 264
259 mNoTimeButton->setChecked(allDay); 265 mNoTimeButton->setChecked(allDay);
260 timeStuffDisable(allDay); 266 timeStuffDisable(allDay);
261 mFreeTimeCombo->setCurrentItem( 0 ); 267 mFreeTimeCombo->setCurrentItem( 0 );
262 setDateTimes(from,to); 268 setDateTimes(from,to);
263} 269}
264 270
265void KOEditorGeneralEvent::readEvent( Event *event, bool tmpl ) 271void KOEditorGeneralEvent::readEvent( Event *event, bool tmpl )
266{ 272{
267 QString tmpStr; 273 QString tmpStr;
268 274
269 mTemplate = tmpl; 275 mTemplate = tmpl;
270 // the rest is for the events only 276 // the rest is for the events only
271 mNoTimeButton->setChecked(event->doesFloat()); 277 mNoTimeButton->setChecked(event->doesFloat());
272 timeStuffDisable(event->doesFloat()); 278 timeStuffDisable(event->doesFloat());
273 279
274 setDateTimes(event->dtStart(),event->dtEnd()); 280 setDateTimes(event->dtStart(),event->dtEnd());
275 281
276 mTemplate = false; 282 mTemplate = false;
277 switch( event->transparency() ) { 283 switch( event->transparency() ) {
278 case Event::Transparent: 284 case Event::Transparent:
279 mFreeTimeCombo->setCurrentItem(1); 285 mFreeTimeCombo->setCurrentItem(1);
280 break; 286 break;
281 case Event::Opaque: 287 case Event::Opaque:
282 mFreeTimeCombo->setCurrentItem(0); 288 mFreeTimeCombo->setCurrentItem(0);
283 break; 289 break;
284 } 290 }
285 291
286 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); 292 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT);
287 mLocationEdit->load(KOLocationBox::LOCATION); 293 mLocationEdit->load(KOLocationBox::LOCATION);
288 readIncidence(event); 294 readIncidence(event);
289} 295}
290 296
291void KOEditorGeneralEvent::writeEvent(Event *event) 297void KOEditorGeneralEvent::writeEvent(Event *event)
292{ 298{
293// kdDebug() << "KOEditorGeneralEvent::writeEvent()" << endl; 299// kdDebug() << "KOEditorGeneralEvent::writeEvent()" << endl;
294 300
295 writeIncidence(event); 301 writeIncidence(event);
296 302
297 QDate tmpDate; 303 QDate tmpDate;
298 QTime tmpTime; 304 QTime tmpTime;
299 QDateTime tmpDT; 305 QDateTime tmpDT;
300 306
301 // temp. until something better happens. 307 // temp. until something better happens.
302 QString tmpStr; 308 QString tmpStr;
303 309
304 if (mNoTimeButton->isChecked()) { 310 if (mNoTimeButton->isChecked()) {
305 event->setFloats(true); 311 event->setFloats(true);
306 // need to change this. 312 // need to change this.
307 tmpDate = mStartDateEdit->date(); 313 tmpDate = mStartDateEdit->date();
308 tmpTime.setHMS(0,0,0); 314 tmpTime.setHMS(0,0,0);
309 tmpDT.setDate(tmpDate); 315 tmpDT.setDate(tmpDate);
310 tmpDT.setTime(tmpTime); 316 tmpDT.setTime(tmpTime);
311 event->setDtStart(tmpDT); 317 event->setDtStart(tmpDT);
312 318
313 tmpDate = mEndDateEdit->date(); 319 tmpDate = mEndDateEdit->date();
314 tmpTime.setHMS(0,0,0); 320 tmpTime.setHMS(0,0,0);
315 tmpDT.setDate(tmpDate); 321 tmpDT.setDate(tmpDate);
316 tmpDT.setTime(tmpTime); 322 tmpDT.setTime(tmpTime);
diff --git a/korganizer/koeditorgeneralevent.h b/korganizer/koeditorgeneralevent.h
index 0174788..9649806 100644
--- a/korganizer/koeditorgeneralevent.h
+++ b/korganizer/koeditorgeneralevent.h
@@ -1,109 +1,111 @@
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#ifndef _KOEDITORGENERALEVENT_H 23#ifndef _KOEDITORGENERALEVENT_H
24#define _KOEDITORGENERALEVENT_H 24#define _KOEDITORGENERALEVENT_H
25 25
26#include <qframe.h> 26#include <qframe.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qcheckbox.h> 28#include <qcheckbox.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qgroupbox.h> 30#include <qgroupbox.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qcombobox.h> 32#include <qcombobox.h>
33#include <qmultilineedit.h> 33#include <qmultilineedit.h>
34#include <qlistview.h> 34#include <qlistview.h>
35#include <qradiobutton.h> 35#include <qradiobutton.h>
36 36
37#include <krestrictedline.h> 37#include <krestrictedline.h>
38 38
39#include "koeditorgeneral.h" 39#include "koeditorgeneral.h"
40 40
41#include "ktimeedit.h" 41#include "ktimeedit.h"
42 42
43class KDateEdit; 43class KDateEdit;
44 44
45using namespace KCal; 45using namespace KCal;
46 46
47class KOEditorGeneralEvent : public KOEditorGeneral 47class KOEditorGeneralEvent : public KOEditorGeneral
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 KOEditorGeneralEvent (QObject* parent=0,const char* name=0); 51 KOEditorGeneralEvent (QObject* parent=0,const char* name=0);
52 virtual ~KOEditorGeneralEvent(); 52 virtual ~KOEditorGeneralEvent();
53 53
54 void initTime(QWidget *,QBoxLayout *); 54 void initTime(QWidget *,QBoxLayout *);
55 void initClass(QWidget *,QBoxLayout *); 55 void initClass(QWidget *,QBoxLayout *);
56 56
57 void finishSetup(); 57 void finishSetup();
58 58
59 /** Set widgets to default values */ 59 /** Set widgets to default values */
60 void setDefaults(QDateTime from,QDateTime to,bool allDay); 60 void setDefaults(QDateTime from,QDateTime to,bool allDay);
61 /** 61 /**
62 Read event object and setup widgets accordingly. If templ is true, the 62 Read event object and setup widgets accordingly. If templ is true, the
63 event is read as template, i.e. the time and date information isn't set. 63 event is read as template, i.e. the time and date information isn't set.
64 */ 64 */
65 void readEvent( Event *, bool tmpl = false ); 65 void readEvent( Event *, bool tmpl = false );
66 /** Write event settings to event object */ 66 /** Write event settings to event object */
67 void writeEvent(Event *); 67 void writeEvent(Event *);
68 68
69 /** Check if the input is valid. */ 69 /** Check if the input is valid. */
70 bool validateInput(); 70 bool validateInput();
71 71
72 public slots: 72 public slots:
73 void setDateTimes(QDateTime start, QDateTime end); 73 void setDateTimes(QDateTime start, QDateTime end);
74 void setDuration(); 74 void setDuration();
75 75
76 protected slots: 76 protected slots:
77 void timeStuffDisable(bool disable); 77 void timeStuffDisable(bool disable);
78 void dontAssociateTime(bool noTime); 78 void dontAssociateTime(bool noTime);
79 79
80 void startTimeChanged(QTime); 80 void startTimeChanged(QTime);
81 void startDateChanged(QDate); 81 void startDateChanged(QDate);
82 void endTimeChanged(QTime); 82 void endTimeChanged(QTime);
83 void endDateChanged(QDate); 83 void endDateChanged(QDate);
84 84
85 void emitDateTimeStr(); 85 void emitDateTimeStr();
86 void sTimeChanged(QTime);
87 void eTimeChanged(QTime);
86 88
87 signals: 89 signals:
88 void dateTimesChanged(QDateTime start,QDateTime end); 90 void dateTimesChanged(QDateTime start,QDateTime end);
89 void allDayChanged(bool); 91 void allDayChanged(bool);
90 void dateTimeStrChanged(const QString &); 92 void dateTimeStrChanged(const QString &);
91 93
92 private: 94 private:
93 bool mTemplate; 95 bool mTemplate;
94 QLabel *mStartDateLabel; 96 QLabel *mStartDateLabel;
95 QLabel *mEndDateLabel; 97 QLabel *mEndDateLabel;
96 KDateEdit *mStartDateEdit; 98 KDateEdit *mStartDateEdit;
97 KDateEdit *mEndDateEdit; 99 KDateEdit *mEndDateEdit;
98 KOTimeEdit *mStartTimeEdit; 100 KOTimeEdit *mStartTimeEdit;
99 KOTimeEdit *mEndTimeEdit; 101 KOTimeEdit *mEndTimeEdit;
100 QLabel *mDurationLabel; 102 QLabel *mDurationLabel;
101 QCheckBox *mNoTimeButton; 103 QCheckBox *mNoTimeButton;
102 QComboBox *mFreeTimeCombo; 104 QComboBox *mFreeTimeCombo;
103 105
104 // current start and end date and time 106 // current start and end date and time
105 QDateTime mCurrStartDateTime; 107 QDateTime mCurrStartDateTime;
106 QDateTime mCurrEndDateTime; 108 QDateTime mCurrEndDateTime;
107}; 109};
108 110
109#endif 111#endif
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp
index baa11b5..e5ff8af 100644
--- a/korganizer/koeventviewerdialog.cpp
+++ b/korganizer/koeventviewerdialog.cpp
@@ -123,190 +123,185 @@ void KOEventViewerDialog::setColorMode( int m )
123int KOEventViewerDialog::executeS( bool local ) 123int KOEventViewerDialog::executeS( bool local )
124{ 124{
125 mSyncResult = 3; 125 mSyncResult = 3;
126 if ( local ) 126 if ( local )
127 findButton( User1 )->setFocus(); 127 findButton( User1 )->setFocus();
128 else 128 else
129 findButton( Ok )->setFocus(); 129 findButton( Ok )->setFocus();
130 exec(); 130 exec();
131 return mSyncResult; 131 return mSyncResult;
132} 132}
133 133
134void KOEventViewerDialog::updateConfig() 134void KOEventViewerDialog::updateConfig()
135{ 135{
136 mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); 136 mEventViewer->setFont( KOPrefs::instance()->mEventViewFont );
137 137
138} 138}
139void KOEventViewerDialog::setEvent(Event *event) 139void KOEventViewerDialog::setEvent(Event *event)
140{ 140{
141 mEventViewer->setEvent(event); 141 mEventViewer->setEvent(event);
142 mIncidence = event; 142 mIncidence = event;
143 mEventViewer->setFocus(); 143 mEventViewer->setFocus();
144 //findButton( Close )->setFocus(); 144 //findButton( Close )->setFocus();
145 if ( !mSyncMode ) { 145 if ( !mSyncMode ) {
146 findButton( User1 )->setText( i18n("Agenda")); 146 findButton( User1 )->setText( i18n("Agenda"));
147 } 147 }
148} 148}
149void KOEventViewerDialog::setIncidence(Incidence *in ) 149void KOEventViewerDialog::setIncidence(Incidence *in )
150{ 150{
151 if ( in->type() == "Event" ) 151 if ( in->type() == "Event" )
152 setEvent( (Event*) in ); 152 setEvent( (Event*) in );
153 else if ( in->type() =="Todo" ) 153 else if ( in->type() =="Todo" )
154 setTodo( (Todo*) in ); 154 setTodo( (Todo*) in );
155 else if ( in->type() =="Journal" ) 155 else if ( in->type() =="Journal" )
156 setJournal( (Journal*) in ); 156 setJournal( (Journal*) in );
157} 157}
158void KOEventViewerDialog::addIncidence(Incidence *in) 158void KOEventViewerDialog::addIncidence(Incidence *in)
159{ 159{
160 if ( in->type() == "Event" ) 160 if ( in->type() == "Event" )
161 addEvent( (Event*) in ); 161 addEvent( (Event*) in );
162 else if ( in->type() =="Todo" ) 162 else if ( in->type() =="Todo" )
163 mEventViewer->setTodo( (Todo*) in, false ); 163 mEventViewer->setTodo( (Todo*) in, false );
164 else if ( in->type() =="Journal" ) 164 else if ( in->type() =="Journal" )
165 mEventViewer->setJournal( (Journal*) in, false ); 165 mEventViewer->setJournal( (Journal*) in, false );
166 if ( mSyncMode ) { 166 if ( mSyncMode ) {
167 findButton( User1 )->setFocus(); 167 findButton( User1 )->setFocus();
168 setCaption(i18n("Conflict! Please choose entry")); 168 setCaption(i18n("Conflict! Please choose entry"));
169 } 169 }
170} 170}
171 171
172void KOEventViewerDialog::addEvent(Event *event) 172void KOEventViewerDialog::addEvent(Event *event)
173{ 173{
174 mEventViewer->addEvent(event); 174 mEventViewer->addEvent(event);
175 mIncidence = event; 175 mIncidence = event;
176 mEventViewer->setFocus(); 176 mEventViewer->setFocus();
177 //findButton( Close )->setFocus(); 177 //findButton( Close )->setFocus();
178 if ( !mSyncMode ) { 178 if ( !mSyncMode ) {
179 findButton( User1 )->setText( i18n("Agenda")); 179 findButton( User1 )->setText( i18n("Agenda"));
180 } 180 }
181} 181}
182 182
183void KOEventViewerDialog::setTodo(Todo *event) 183void KOEventViewerDialog::setTodo(Todo *event)
184{ 184{
185 mEventViewer->setTodo(event); 185 mEventViewer->setTodo(event);
186 mIncidence = (Incidence*)event; 186 mIncidence = (Incidence*)event;
187 mEventViewer->setFocus(); 187 mEventViewer->setFocus();
188 //findButton( Close )->setFocus(); 188 //findButton( Close )->setFocus();
189 if ( !mSyncMode ) { 189 if ( !mSyncMode ) {
190 findButton( User1 )->setText( i18n("Set complete")); 190 findButton( User1 )->setText( i18n("Set complete"));
191 } 191 }
192} 192}
193void KOEventViewerDialog::setJournal(Journal *j) 193void KOEventViewerDialog::setJournal(Journal *j)
194{ 194{
195 mEventViewer->setJournal(j); 195 mEventViewer->setJournal(j);
196 mIncidence = (Incidence*)j; 196 mIncidence = (Incidence*)j;
197 mEventViewer->setFocus(); 197 mEventViewer->setFocus();
198 //findButton( Close )->setFocus(); 198 //findButton( Close )->setFocus();
199 if ( !mSyncMode ) { 199 if ( !mSyncMode ) {
200 findButton( User1 )->setText( i18n("Agenda")); 200 findButton( User1 )->setText( i18n("Agenda"));
201 } 201 }
202} 202}
203 203
204void KOEventViewerDialog::addText(QString text) 204void KOEventViewerDialog::addText(QString text)
205{ 205{
206 mEventViewer->addText(text); 206 mEventViewer->addText(text);
207 mEventViewer->setFocus(); 207 mEventViewer->setFocus();
208 //findButton( Close )->setFocus(); 208 //findButton( Close )->setFocus();
209} 209}
210void KOEventViewerDialog::editIncidence() 210void KOEventViewerDialog::editIncidence()
211{ 211{
212 sendSignalViewerClosed = false; 212 sendSignalViewerClosed = false;
213 if ( mSyncMode ) { 213 if ( mSyncMode ) {
214 mSyncResult = 2; 214 mSyncResult = 2;
215 accept(); 215 accept();
216 return; 216 return;
217 } 217 }
218 if ( mIncidence ){ 218 if ( mIncidence ){
219#ifndef DESKTOP_VERSION
220 //hide();
221 close(); 219 close();
222#endif
223 emit editIncidence( mIncidence ); 220 emit editIncidence( mIncidence );
224 } 221 }
225} 222}
226void KOEventViewerDialog::showIncidence() 223void KOEventViewerDialog::showIncidence()
227{ 224{
228 sendSignalViewerClosed = false; 225 sendSignalViewerClosed = false;
229 if ( mSyncMode ) { 226 if ( mSyncMode ) {
230 mSyncResult = 1; 227 mSyncResult = 1;
231 accept(); 228 accept();
232 return; 229 return;
233 } 230 }
234 231
235 if ( mIncidence ){ 232 if ( mIncidence ){
236 QDate date; 233 QDate date;
237 if ( mIncidence->type() == "Todo" ) { 234 if ( mIncidence->type() == "Todo" ) {
238 /* 235 /*
239 if ( ((Todo*)mIncidence)->hasDueDate() ) 236 if ( ((Todo*)mIncidence)->hasDueDate() )
240 date = ((Todo*)mIncidence)->dtDue().date(); 237 date = ((Todo*)mIncidence)->dtDue().date();
241 else { 238 else {
242 globalFlagBlockAgenda = 2; 239 globalFlagBlockAgenda = 2;
243 emit showAgendaView( false ); 240 emit showAgendaView( false );
244 return; 241 return;
245 } 242 }
246 */ 243 */
247 ((Todo*)mIncidence)->setCompleted( true ); 244 ((Todo*)mIncidence)->setCompleted( true );
248 ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); 245 ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() );
249 emit todoCompleted(((Todo*)mIncidence)); 246 emit todoCompleted(((Todo*)mIncidence));
250 } else { 247 } else {
251 date = mIncidence->dtStart().date(); 248 date = mIncidence->dtStart().date();
252 globalFlagBlockAgenda = 1; 249 globalFlagBlockAgenda = 1;
253 emit showAgendaView( false ); 250 emit showAgendaView( false );
254 globalFlagBlockAgenda = 2; 251 globalFlagBlockAgenda = 2;
255 emit jumpToTime( date ); 252 emit jumpToTime( date );
256 } 253 }
257#ifndef DESKTOP_VERSION 254 close();
258 reject();
259#endif
260 } 255 }
261} 256}
262void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) 257void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e )
263{ 258{
264 switch ( e->key() ) { 259 switch ( e->key() ) {
265 260
266 case Qt::Key_A : 261 case Qt::Key_A :
267 case Qt::Key_L : 262 case Qt::Key_L :
268 showIncidence(); 263 showIncidence();
269 break; 264 break;
270 case Qt::Key_E : 265 case Qt::Key_E :
271 case Qt::Key_R : 266 case Qt::Key_R :
272 editIncidence(); 267 editIncidence();
273 break; 268 break;
274 case Qt::Key_C: 269 case Qt::Key_C:
275 case Qt::Key_Escape: 270 case Qt::Key_Escape:
276 sendSignalViewerClosed = true; 271 sendSignalViewerClosed = true;
277 close(); 272 close();
278 break; 273 break;
279 case Qt::Key_I: 274 case Qt::Key_I:
280#ifndef DESKTOP_VERSION 275#ifndef DESKTOP_VERSION
281 sendSignalViewerClosed = true; 276 sendSignalViewerClosed = true;
282 close(); 277 close();
283#else 278#else
284 sendSignalViewerClosed = true; 279 sendSignalViewerClosed = true;
285 slotViewerClosed(); 280 slotViewerClosed();
286 //accept(); 281 //accept();
287#endif 282#endif
288 break; 283 break;
289 default: 284 default:
290 KDialogBase::keyPressEvent ( e ); 285 KDialogBase::keyPressEvent ( e );
291 break; 286 break;
292 } 287 }
293 288
294} 289}
295void KOEventViewerDialog::hideEvent ( QHideEvent * e ) 290void KOEventViewerDialog::hideEvent ( QHideEvent * e )
296{ 291{
297 KDialogBase::hideEvent ( e ); 292 KDialogBase::hideEvent ( e );
298 QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) ); 293 QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) );
299} 294}
300 295
301void KOEventViewerDialog::slotViewerClosed() 296void KOEventViewerDialog::slotViewerClosed()
302{ 297{
303 if ( mSyncMode ) 298 if ( mSyncMode )
304 return; 299 return;
305 300
306 if ( sendSignalViewerClosed ) { 301 if ( sendSignalViewerClosed ) {
307 //qDebug("KOEventViewerDialog::hideEvent "); 302 //qDebug("KOEventViewerDialog::hideEvent ");
308 emit signalViewerClosed(); 303 emit signalViewerClosed();
309 } 304 }
310 sendSignalViewerClosed = true; 305 sendSignalViewerClosed = true;
311} 306}
312 307