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 | |||
@@ -9,40 +9,47 @@ | |||
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" |
@@ -69,44 +76,44 @@ void KOEditorGeneralTodo::finishSetup() | |||
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))); |
@@ -120,33 +127,33 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) | |||
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); |
@@ -160,51 +167,51 @@ void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) | |||
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 ); |
@@ -383,33 +390,33 @@ void KOEditorGeneralTodo::enableStartEdit( bool enable ) | |||
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 | } |