summaryrefslogtreecommitdiffabout
Unidiff
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
@@ -97,172 +97,178 @@ void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout)
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
diff --git a/korganizer/koeditorgeneralevent.h b/korganizer/koeditorgeneralevent.h
index 0174788..9649806 100644
--- a/korganizer/koeditorgeneralevent.h
+++ b/korganizer/koeditorgeneralevent.h
@@ -38,72 +38,74 @@
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
@@ -171,137 +171,132 @@ void KOEventViewerDialog::addIncidence(Incidence *in)
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 ");