summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-14 20:32:31 (UTC)
committer zautrix <zautrix>2005-04-14 20:32:31 (UTC)
commit7e87a287a0860882af27e26288bc9cc553dd3a0b (patch) (unidiff)
treea55374f708a8c27da182bcd8d975ad3f20f39057 /korganizer
parent2a449f785f955649df9de639d38dcb250fe1376d (diff)
downloadkdepimpi-7e87a287a0860882af27e26288bc9cc553dd3a0b.zip
kdepimpi-7e87a287a0860882af27e26288bc9cc553dd3a0b.tar.gz
kdepimpi-7e87a287a0860882af27e26288bc9cc553dd3a0b.tar.bz2
fix
Diffstat (limited to 'korganizer') (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
@@ -133,27 +133,26 @@ void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout)
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"));
@@ -187,46 +186,53 @@ void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end)
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));
diff --git a/korganizer/koeditorgeneralevent.h b/korganizer/koeditorgeneralevent.h
index 0174788..9649806 100644
--- a/korganizer/koeditorgeneralevent.h
+++ b/korganizer/koeditorgeneralevent.h
@@ -74,24 +74,26 @@ class KOEditorGeneralEvent : public KOEditorGeneral
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;
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp
index baa11b5..e5ff8af 100644
--- a/korganizer/koeventviewerdialog.cpp
+++ b/korganizer/koeventviewerdialog.cpp
@@ -207,28 +207,25 @@ void KOEventViewerDialog::addText(QString 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
@@ -245,27 +242,25 @@ void KOEventViewerDialog::showIncidence()
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 :