author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/koeditorgeneraltodo.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'korganizer/koeditorgeneraltodo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeditorgeneraltodo.cpp | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index d32d5a5..baee9fc 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp | |||
@@ -1,242 +1,249 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,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 <qfiledialog.h> | 25 | #include <q3filedialog.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qvbox.h> | 27 | #include <q3vbox.h> |
28 | #include <qbuttongroup.h> | 28 | #include <q3buttongroup.h> |
29 | #include <qvgroupbox.h> | 29 | #include <q3vgroupbox.h> |
30 | #include <qwidgetstack.h> | 30 | #include <q3widgetstack.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | #include <QDesktopWidget> | ||
34 | //Added by qt3to4: | ||
35 | #include <Q3HBoxLayout> | ||
36 | #include <Q3GridLayout> | ||
37 | #include <Q3Frame> | ||
38 | #include <QLabel> | ||
39 | #include <Q3VBoxLayout> | ||
33 | 40 | ||
34 | #include <kglobal.h> | 41 | #include <kglobal.h> |
35 | #include <klocale.h> | 42 | #include <klocale.h> |
36 | #include <kiconloader.h> | 43 | #include <kiconloader.h> |
37 | #include <kmessagebox.h> | 44 | #include <kmessagebox.h> |
38 | #include <kdebug.h> | 45 | #include <kdebug.h> |
39 | #include <krestrictedline.h> | 46 | #include <krestrictedline.h> |
40 | #include <kstandarddirs.h> | 47 | #include <kstandarddirs.h> |
41 | #include <kfiledialog.h> | 48 | #include <kfiledialog.h> |
42 | #include <kdialog.h> | 49 | #include <kdialog.h> |
43 | 50 | ||
44 | #include <libkcal/todo.h> | 51 | #include <libkcal/todo.h> |
45 | 52 | ||
46 | #include <libkdepim/kdateedit.h> | 53 | #include <libkdepim/kdateedit.h> |
47 | 54 | ||
48 | #include "koprefs.h" | 55 | #include "koprefs.h" |
49 | #include "ktimeedit.h" | 56 | #include "ktimeedit.h" |
50 | 57 | ||
51 | #include "koeditorgeneraltodo.h" | 58 | #include "koeditorgeneraltodo.h" |
52 | #include "kolocationbox.h" | 59 | #include "kolocationbox.h" |
53 | 60 | ||
54 | KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, | 61 | KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, |
55 | const char* name) | 62 | const char* name) |
56 | : KOEditorGeneral( parent, name) | 63 | : KOEditorGeneral( parent, name) |
57 | { | 64 | { |
58 | } | 65 | } |
59 | 66 | ||
60 | KOEditorGeneralTodo::~KOEditorGeneralTodo() | 67 | KOEditorGeneralTodo::~KOEditorGeneralTodo() |
61 | { | 68 | { |
62 | } | 69 | } |
63 | 70 | ||
64 | void KOEditorGeneralTodo::finishSetup() | 71 | void KOEditorGeneralTodo::finishSetup() |
65 | { | 72 | { |
66 | 73 | ||
67 | // QWidget::setTabOrder(mSummaryEdit, mLocationEdit); | 74 | // QWidget::setTabOrder(mSummaryEdit, mLocationEdit); |
68 | // QWidget::setTabOrder(mLocationEdit, mDueCheck); | 75 | // QWidget::setTabOrder(mLocationEdit, mDueCheck); |
69 | // QWidget::setTabOrder(mDueCheck, mDueDateEdit); | 76 | // QWidget::setTabOrder(mDueCheck, mDueDateEdit); |
70 | // QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); | 77 | // QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); |
71 | // QWidget::setTabOrder(mDueTimeEdit, mStartCheck); | 78 | // QWidget::setTabOrder(mDueTimeEdit, mStartCheck); |
72 | // QWidget::setTabOrder(mStartCheck, mStartDateEdit); | 79 | // QWidget::setTabOrder(mStartCheck, mStartDateEdit); |
73 | // QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); | 80 | // QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); |
74 | // QWidget::setTabOrder(mStartTimeEdit, mTimeButton); | 81 | // QWidget::setTabOrder(mStartTimeEdit, mTimeButton); |
75 | // QWidget::setTabOrder(mTimeButton, mCompletedCombo); | 82 | // QWidget::setTabOrder(mTimeButton, mCompletedCombo); |
76 | // QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); | 83 | // QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); |
77 | // QWidget::setTabOrder(mPriorityCombo, mAlarmButton); | 84 | // QWidget::setTabOrder(mPriorityCombo, mAlarmButton); |
78 | // QWidget::setTabOrder(mAlarmButton, mCategoriesButton); | 85 | // QWidget::setTabOrder(mAlarmButton, mCategoriesButton); |
79 | // QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); | 86 | // QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); |
80 | // QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); | 87 | // QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); |
81 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 88 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
82 | mSummaryEdit->setFocus(); | 89 | mSummaryEdit->setFocus(); |
83 | } | 90 | } |
84 | 91 | ||
85 | void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) | 92 | void KOEditorGeneralTodo::initTime(QWidget *parent,Q3BoxLayout *topLayout) |
86 | { | 93 | { |
87 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); | 94 | Q3BoxLayout *timeLayout = new Q3VBoxLayout(topLayout); |
88 | 95 | ||
89 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, | 96 | Q3GroupBox *timeGroupBox = new Q3GroupBox(1,Qt::Horizontal, |
90 | i18n("Date && Time"),parent); | 97 | i18n("Date && Time"),parent); |
91 | timeLayout->addWidget(timeGroupBox); | 98 | timeLayout->addWidget(timeGroupBox); |
92 | timeGroupBox->layout()->setSpacing( KDialog::spacingHint()-2 ); | 99 | timeGroupBox->layout()->setSpacing( KDialog::spacingHint()-2 ); |
93 | timeGroupBox->layout()->setMargin( KDialog::marginHint() ); | 100 | timeGroupBox->layout()->setMargin( KDialog::marginHint() ); |
94 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); | 101 | Q3Frame *timeBoxFrame = new Q3Frame(timeGroupBox); |
95 | 102 | ||
96 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); | 103 | Q3GridLayout *layoutTimeBox = new Q3GridLayout(timeBoxFrame,3,3); |
97 | layoutTimeBox->setSpacing(KDialog::spacingHintSmall()); | 104 | layoutTimeBox->setSpacing(KDialog::spacingHintSmall()); |
98 | layoutTimeBox->setColStretch( 1, 1 ); | 105 | layoutTimeBox->setColStretch( 1, 1 ); |
99 | 106 | ||
100 | mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); | 107 | mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); |
101 | layoutTimeBox->addWidget(mStartCheck,0,0); | 108 | layoutTimeBox->addWidget(mStartCheck,0,0); |
102 | connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); | 109 | connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); |
103 | 110 | ||
104 | mStartDateEdit = new KDateEdit(timeBoxFrame); | 111 | mStartDateEdit = new KDateEdit(timeBoxFrame); |
105 | layoutTimeBox->addWidget(mStartDateEdit,0,1); | 112 | layoutTimeBox->addWidget(mStartDateEdit,0,1); |
106 | 113 | ||
107 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); | 114 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); |
108 | layoutTimeBox->addWidget(mStartTimeEdit,0,2); | 115 | layoutTimeBox->addWidget(mStartTimeEdit,0,2); |
109 | 116 | ||
110 | mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); | 117 | mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); |
111 | layoutTimeBox->addWidget(mDueCheck,1,0); | 118 | layoutTimeBox->addWidget(mDueCheck,1,0); |
112 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); | 119 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); |
113 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); | 120 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); |
114 | 121 | ||
115 | 122 | ||
116 | mDueDateEdit = new KDateEdit(timeBoxFrame); | 123 | mDueDateEdit = new KDateEdit(timeBoxFrame); |
117 | layoutTimeBox->addWidget(mDueDateEdit,1,1); | 124 | layoutTimeBox->addWidget(mDueDateEdit,1,1); |
118 | 125 | ||
119 | mDueTimeEdit = new KOTimeEdit(timeBoxFrame); | 126 | mDueTimeEdit = new KOTimeEdit(timeBoxFrame); |
120 | layoutTimeBox->addWidget(mDueTimeEdit,1,2); | 127 | layoutTimeBox->addWidget(mDueTimeEdit,1,2); |
121 | 128 | ||
122 | 129 | ||
123 | mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); | 130 | mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); |
124 | layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); | 131 | layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); |
125 | 132 | ||
126 | connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); | 133 | connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); |
127 | connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime))); | 134 | connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime))); |
128 | connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime))); | 135 | connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime))); |
129 | connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), | 136 | connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), |
130 | this, SLOT(startDateChanged(QDate))); | 137 | this, SLOT(startDateChanged(QDate))); |
131 | // some more layouting | 138 | // some more layouting |
132 | //layoutTimeBox->setColStretch(3,1); | 139 | //layoutTimeBox->setColStretch(3,1); |
133 | } | 140 | } |
134 | 141 | ||
135 | 142 | ||
136 | void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) | 143 | void KOEditorGeneralTodo::initCompletion(QWidget *parent, Q3BoxLayout *topLayout) |
137 | { | 144 | { |
138 | mCompletedCombo = new QComboBox(parent); | 145 | mCompletedCombo = new QComboBox(parent); |
139 | // xgettext:no-c-format | 146 | // xgettext:no-c-format |
140 | mCompletedCombo->insertItem(i18n(" 0 %")); | 147 | mCompletedCombo->insertItem(i18n(" 0 %")); |
141 | // xgettext:no-c-format | 148 | // xgettext:no-c-format |
142 | mCompletedCombo->insertItem(i18n(" 20 %")); | 149 | mCompletedCombo->insertItem(i18n(" 20 %")); |
143 | // xgettext:no-c-format | 150 | // xgettext:no-c-format |
144 | mCompletedCombo->insertItem(i18n(" 40 %")); | 151 | mCompletedCombo->insertItem(i18n(" 40 %")); |
145 | // xgettext:no-c-format | 152 | // xgettext:no-c-format |
146 | mCompletedCombo->insertItem(i18n(" 60 %")); | 153 | mCompletedCombo->insertItem(i18n(" 60 %")); |
147 | // xgettext:no-c-format | 154 | // xgettext:no-c-format |
148 | mCompletedCombo->insertItem(i18n(" 80 %")); | 155 | mCompletedCombo->insertItem(i18n(" 80 %")); |
149 | // xgettext:no-c-format | 156 | // xgettext:no-c-format |
150 | mCompletedCombo->insertItem(i18n("100 %")); | 157 | mCompletedCombo->insertItem(i18n("100 %")); |
151 | connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); | 158 | connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); |
152 | topLayout->addWidget(mCompletedCombo); | 159 | topLayout->addWidget(mCompletedCombo); |
153 | 160 | ||
154 | mCompletedLabel = new QLabel(i18n("completed"),parent); | 161 | mCompletedLabel = new QLabel(i18n("completed"),parent); |
155 | topLayout->addWidget(mCompletedLabel); | 162 | topLayout->addWidget(mCompletedLabel); |
156 | 163 | ||
157 | mCompleteDateEdit = new KDateEdit(parent); | 164 | mCompleteDateEdit = new KDateEdit(parent); |
158 | topLayout->addWidget(mCompleteDateEdit ); | 165 | topLayout->addWidget(mCompleteDateEdit ); |
159 | 166 | ||
160 | mCompleteTimeEdit = new KOTimeEdit(parent); | 167 | mCompleteTimeEdit = new KOTimeEdit(parent); |
161 | topLayout->addWidget( mCompleteTimeEdit); | 168 | topLayout->addWidget( mCompleteTimeEdit); |
162 | 169 | ||
163 | mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); | 170 | mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); |
164 | mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); | 171 | mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); |
165 | connect(mCompleteDateEdit,SIGNAL(setTimeTo(QTime)),mCompleteTimeEdit,SLOT(setTime(QTime))); | 172 | connect(mCompleteDateEdit,SIGNAL(setTimeTo(QTime)),mCompleteTimeEdit,SLOT(setTime(QTime))); |
166 | 173 | ||
167 | if ( QApplication::desktop()->width() <= 480 ) { | 174 | if ( QApplication::desktop()->width() <= 480 ) { |
168 | if ( QApplication::desktop()->width() < 320 ) | 175 | if ( QApplication::desktop()->width() < 320 ) |
169 | mCompleteDateEdit->setMaximumWidth( 85 ); | 176 | mCompleteDateEdit->setMaximumWidth( 85 ); |
170 | else | 177 | else |
171 | mCompleteDateEdit->setMaximumWidth( 140 ); | 178 | mCompleteDateEdit->setMaximumWidth( 140 ); |
172 | topLayout->setSpacing( 0 ); | 179 | topLayout->setSpacing( 0 ); |
173 | } | 180 | } |
174 | } | 181 | } |
175 | 182 | ||
176 | void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) | 183 | void KOEditorGeneralTodo::initPriority(QWidget *parent, Q3BoxLayout *topLayout) |
177 | { | 184 | { |
178 | 185 | ||
179 | QHBox* h = new QHBox ( parent ); | 186 | Q3HBox* h = new Q3HBox ( parent ); |
180 | topLayout->addWidget( h ); | 187 | topLayout->addWidget( h ); |
181 | QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); | 188 | QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); |
182 | // topLayout->addWidget(priorityLabel); | 189 | // topLayout->addWidget(priorityLabel); |
183 | mPriorityCombo = new QComboBox( h ); | 190 | mPriorityCombo = new QComboBox( h ); |
184 | mPriorityCombo->insertItem(i18n("1 (high)")); | 191 | mPriorityCombo->insertItem(i18n("1 (high)")); |
185 | mPriorityCombo->insertItem(i18n("2")); | 192 | mPriorityCombo->insertItem(i18n("2")); |
186 | mPriorityCombo->insertItem(i18n("3")); | 193 | mPriorityCombo->insertItem(i18n("3")); |
187 | mPriorityCombo->insertItem(i18n("4")); | 194 | mPriorityCombo->insertItem(i18n("4")); |
188 | mPriorityCombo->insertItem(i18n("5 (low)")); | 195 | mPriorityCombo->insertItem(i18n("5 (low)")); |
189 | //topLayout->addWidget(mPriorityCombo); | 196 | //topLayout->addWidget(mPriorityCombo); |
190 | } | 197 | } |
191 | 198 | ||
192 | void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) | 199 | void KOEditorGeneralTodo::initStatus(QWidget *parent,Q3BoxLayout *topLayout) |
193 | { | 200 | { |
194 | QBoxLayout *statusLayout = new QHBoxLayout(topLayout); | 201 | Q3BoxLayout *statusLayout = new Q3HBoxLayout(topLayout); |
195 | 202 | ||
196 | initCompletion( parent, statusLayout ); | 203 | initCompletion( parent, statusLayout ); |
197 | 204 | ||
198 | statusLayout->addStretch( 1 ); | 205 | statusLayout->addStretch( 1 ); |
199 | 206 | ||
200 | initPriority( parent, statusLayout ); | 207 | initPriority( parent, statusLayout ); |
201 | } | 208 | } |
202 | 209 | ||
203 | void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) | 210 | void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) |
204 | { | 211 | { |
205 | 212 | ||
206 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 213 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
207 | mLocationEdit->load(KOLocationBox::LOCATION); | 214 | mLocationEdit->load(KOLocationBox::LOCATION); |
208 | KOEditorGeneral::setDefaults(allDay); | 215 | KOEditorGeneral::setDefaults(allDay); |
209 | 216 | ||
210 | mTimeButton->setChecked( !allDay ); | 217 | mTimeButton->setChecked( !allDay ); |
211 | mTimeButton->setEnabled( !allDay ); | 218 | mTimeButton->setEnabled( !allDay ); |
212 | 219 | ||
213 | enableTimeEdits( !allDay ); | 220 | enableTimeEdits( !allDay ); |
214 | if ( due.isValid() ) { | 221 | if ( due.isValid() ) { |
215 | mDueCheck->setChecked(true); | 222 | mDueCheck->setChecked(true); |
216 | enableDueEdit(true); | 223 | enableDueEdit(true); |
217 | alarmDisable(false); | 224 | alarmDisable(false); |
218 | } else { | 225 | } else { |
219 | mDueCheck->setChecked(false); | 226 | mDueCheck->setChecked(false); |
220 | enableDueEdit(false); | 227 | enableDueEdit(false); |
221 | due = QDateTime::currentDateTime().addDays(7); | 228 | due = QDateTime::currentDateTime().addDays(7); |
222 | alarmDisable(true); | 229 | alarmDisable(true); |
223 | } | 230 | } |
224 | 231 | ||
225 | 232 | ||
226 | mStartCheck->setChecked(false); | 233 | mStartCheck->setChecked(false); |
227 | enableStartEdit(false); | 234 | enableStartEdit(false); |
228 | 235 | ||
229 | mDueDateEdit->setDate(due.date()); | 236 | mDueDateEdit->setDate(due.date()); |
230 | mDueTimeEdit->setTime(due.time()); | 237 | mDueTimeEdit->setTime(due.time()); |
231 | due = due.addDays(-7); | 238 | due = due.addDays(-7); |
232 | mStartDateEdit->setDate(due.date()); | 239 | mStartDateEdit->setDate(due.date()); |
233 | mStartTimeEdit->setTime(due.time()); | 240 | mStartTimeEdit->setTime(due.time()); |
234 | 241 | ||
235 | mPriorityCombo->setCurrentItem(2); | 242 | mPriorityCombo->setCurrentItem(2); |
236 | mCompletedLabel->setText(i18n(" completed"));; | 243 | mCompletedLabel->setText(i18n(" completed"));; |
237 | mCompletedCombo->setCurrentItem(0); | 244 | mCompletedCombo->setCurrentItem(0); |
238 | mCompleteDateEdit->hide(); | 245 | mCompleteDateEdit->hide(); |
239 | mCompleteTimeEdit->hide(); | 246 | mCompleteTimeEdit->hide(); |
240 | } | 247 | } |
241 | 248 | ||
242 | void KOEditorGeneralTodo::readTodo(Todo *todo) | 249 | void KOEditorGeneralTodo::readTodo(Todo *todo) |
@@ -351,97 +358,97 @@ void KOEditorGeneralTodo::writeTodo(Todo *todo) | |||
351 | todo->setPercentComplete(mCompletedCombo->currentItem() * 20); | 358 | todo->setPercentComplete(mCompletedCombo->currentItem() * 20); |
352 | } | 359 | } |
353 | 360 | ||
354 | mSummaryEdit->save(KOLocationBox::SUMMARYTODO); | 361 | mSummaryEdit->save(KOLocationBox::SUMMARYTODO); |
355 | } | 362 | } |
356 | 363 | ||
357 | void KOEditorGeneralTodo::enableDueEdit(bool enable) | 364 | void KOEditorGeneralTodo::enableDueEdit(bool enable) |
358 | { | 365 | { |
359 | mDueDateEdit->setEnabled( enable ); | 366 | mDueDateEdit->setEnabled( enable ); |
360 | 367 | ||
361 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { | 368 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { |
362 | mTimeButton->setEnabled(true); | 369 | mTimeButton->setEnabled(true); |
363 | } | 370 | } |
364 | else { | 371 | else { |
365 | mTimeButton->setEnabled(false); | 372 | mTimeButton->setEnabled(false); |
366 | mTimeButton->setChecked(false); | 373 | mTimeButton->setChecked(false); |
367 | } | 374 | } |
368 | 375 | ||
369 | if (enable) { | 376 | if (enable) { |
370 | mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); | 377 | mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); |
371 | } else { | 378 | } else { |
372 | mDueTimeEdit->setEnabled( false ); | 379 | mDueTimeEdit->setEnabled( false ); |
373 | } | 380 | } |
374 | emit datesChecked(); | 381 | emit datesChecked(); |
375 | } | 382 | } |
376 | 383 | ||
377 | void KOEditorGeneralTodo::enableStartEdit( bool enable ) | 384 | void KOEditorGeneralTodo::enableStartEdit( bool enable ) |
378 | { | 385 | { |
379 | mStartDateEdit->setEnabled( enable ); | 386 | mStartDateEdit->setEnabled( enable ); |
380 | 387 | ||
381 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { | 388 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { |
382 | mTimeButton->setEnabled(true); | 389 | mTimeButton->setEnabled(true); |
383 | } | 390 | } |
384 | else { | 391 | else { |
385 | mTimeButton->setEnabled(false); | 392 | mTimeButton->setEnabled(false); |
386 | mTimeButton->setChecked(false); | 393 | mTimeButton->setChecked(false); |
387 | } | 394 | } |
388 | 395 | ||
389 | if (enable) { | 396 | if (enable) { |
390 | mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); | 397 | mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); |
391 | } else { | 398 | } else { |
392 | mStartTimeEdit->setEnabled( false ); | 399 | mStartTimeEdit->setEnabled( false ); |
393 | } | 400 | } |
394 | emit datesChecked(); | 401 | emit datesChecked(); |
395 | } | 402 | } |
396 | void KOEditorGeneralTodo::startDateChanged(QDate newdate) | 403 | void KOEditorGeneralTodo::startDateChanged(QDate newdate) |
397 | { | 404 | { |
398 | if ( mDueCheck->isChecked() ) | 405 | if ( mDueCheck->isChecked() ) |
399 | emit dateTimesChanged(newdate,mDueDateEdit->date()); | 406 | emit dateTimesChanged((QDateTime)newdate,(QDateTime)mDueDateEdit->date()); |
400 | } | 407 | } |
401 | void KOEditorGeneralTodo::enableTimeEdits(bool enable) | 408 | void KOEditorGeneralTodo::enableTimeEdits(bool enable) |
402 | { | 409 | { |
403 | if(mStartCheck->isChecked()) { | 410 | if(mStartCheck->isChecked()) { |
404 | mStartTimeEdit->setEnabled( enable ); | 411 | mStartTimeEdit->setEnabled( enable ); |
405 | } | 412 | } |
406 | if(mDueCheck->isChecked()) { | 413 | if(mDueCheck->isChecked()) { |
407 | mDueTimeEdit->setEnabled( enable ); | 414 | mDueTimeEdit->setEnabled( enable ); |
408 | } | 415 | } |
409 | } | 416 | } |
410 | 417 | ||
411 | void KOEditorGeneralTodo::showAlarm() | 418 | void KOEditorGeneralTodo::showAlarm() |
412 | { | 419 | { |
413 | if ( mDueCheck->isChecked() ) { | 420 | if ( mDueCheck->isChecked() ) { |
414 | alarmDisable(false); | 421 | alarmDisable(false); |
415 | } | 422 | } |
416 | else { | 423 | else { |
417 | alarmDisable(true); | 424 | alarmDisable(true); |
418 | } | 425 | } |
419 | } | 426 | } |
420 | 427 | ||
421 | bool KOEditorGeneralTodo::validateInput() | 428 | bool KOEditorGeneralTodo::validateInput() |
422 | { | 429 | { |
423 | if (mDueCheck->isChecked()) { | 430 | if (mDueCheck->isChecked()) { |
424 | if (!mDueDateEdit->inputIsValid()) { | 431 | if (!mDueDateEdit->inputIsValid()) { |
425 | KMessageBox::sorry(0,i18n("Please specify a valid due date.")); | 432 | KMessageBox::sorry(0,i18n("Please specify a valid due date.")); |
426 | return false; | 433 | return false; |
427 | } | 434 | } |
428 | } | 435 | } |
429 | 436 | ||
430 | if (mStartCheck->isChecked()) { | 437 | if (mStartCheck->isChecked()) { |
431 | if (!mStartDateEdit->inputIsValid()) { | 438 | if (!mStartDateEdit->inputIsValid()) { |
432 | KMessageBox::sorry(0,i18n("Please specify a valid start date.")); | 439 | KMessageBox::sorry(0,i18n("Please specify a valid start date.")); |
433 | return false; | 440 | return false; |
434 | } | 441 | } |
435 | } | 442 | } |
436 | 443 | ||
437 | if (mStartCheck->isChecked() && mDueCheck->isChecked()) { | 444 | if (mStartCheck->isChecked() && mDueCheck->isChecked()) { |
438 | QDateTime startDate; | 445 | QDateTime startDate; |
439 | QDateTime dueDate; | 446 | QDateTime dueDate; |
440 | startDate.setDate(mStartDateEdit->date()); | 447 | startDate.setDate(mStartDateEdit->date()); |
441 | dueDate.setDate(mDueDateEdit->date()); | 448 | dueDate.setDate(mDueDateEdit->date()); |
442 | if (mTimeButton->isChecked()) { | 449 | if (mTimeButton->isChecked()) { |
443 | startDate.setTime(mStartTimeEdit->getTime()); | 450 | startDate.setTime(mStartTimeEdit->getTime()); |
444 | dueDate.setTime(mDueTimeEdit->getTime()); | 451 | dueDate.setTime(mDueTimeEdit->getTime()); |
445 | } | 452 | } |
446 | if (startDate > dueDate) { | 453 | if (startDate > dueDate) { |
447 | KMessageBox::sorry(0, | 454 | KMessageBox::sorry(0, |