-rw-r--r-- | korganizer/koeditorgeneralevent.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp index 30b792b..adc733b 100644 --- a/korganizer/koeditorgeneralevent.cpp +++ b/korganizer/koeditorgeneralevent.cpp | |||
@@ -25,193 +25,193 @@ | |||
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 | ||
49 | KOEditorGeneralEvent::KOEditorGeneralEvent(QObject* parent, | 49 | KOEditorGeneralEvent::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 | ||
60 | KOEditorGeneralEvent::~KOEditorGeneralEvent() | 60 | KOEditorGeneralEvent::~KOEditorGeneralEvent() |
61 | { | 61 | { |
62 | } | 62 | } |
63 | 63 | ||
64 | void KOEditorGeneralEvent::finishSetup() | 64 | void 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 | ||
86 | void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout) | 86 | void 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("Allday"),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 | ||
147 | void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout) | 147 | void 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 | ||
160 | void KOEditorGeneralEvent::timeStuffDisable(bool disable) | 160 | void 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 | ||
169 | void KOEditorGeneralEvent::dontAssociateTime(bool noTime) | 169 | void 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 | ||
176 | void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end) | 176 | void 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 | ||
196 | void KOEditorGeneralEvent::startTimeChanged(QTime newtime) | 196 | void 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 | ||
212 | void KOEditorGeneralEvent::endTimeChanged(QTime newtime) | 212 | void 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; |