Diffstat (limited to 'korganizer/koeditorgeneralevent.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeditorgeneralevent.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp index 2c6ed9f..73a4139 100644 --- a/korganizer/koeditorgeneralevent.cpp +++ b/korganizer/koeditorgeneralevent.cpp | |||
@@ -1,184 +1,190 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 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 <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qvbox.h> | 26 | #include <q3vbox.h> |
27 | #include <qbuttongroup.h> | 27 | #include <q3buttongroup.h> |
28 | #include <qvgroupbox.h> | 28 | #include <q3vgroupbox.h> |
29 | #include <qwidgetstack.h> | 29 | #include <q3widgetstack.h> |
30 | #include <qdatetime.h> | 30 | #include <qdatetime.h> |
31 | //Added by qt3to4: | ||
32 | #include <Q3HBoxLayout> | ||
33 | #include <Q3GridLayout> | ||
34 | #include <Q3Frame> | ||
35 | #include <QLabel> | ||
36 | #include <Q3VBoxLayout> | ||
31 | 37 | ||
32 | #include <kdebug.h> | 38 | #include <kdebug.h> |
33 | #include <kglobal.h> | 39 | #include <kglobal.h> |
34 | #include <kdialog.h> | 40 | #include <kdialog.h> |
35 | #include <klocale.h> | 41 | #include <klocale.h> |
36 | #include <kiconloader.h> | 42 | #include <kiconloader.h> |
37 | #include <kmessagebox.h> | 43 | #include <kmessagebox.h> |
38 | #include <kfiledialog.h> | 44 | #include <kfiledialog.h> |
39 | #include <kstandarddirs.h> | 45 | #include <kstandarddirs.h> |
40 | 46 | ||
41 | #include <libkcal/event.h> | 47 | #include <libkcal/event.h> |
42 | 48 | ||
43 | #include <libkdepim/kdateedit.h> | 49 | #include <libkdepim/kdateedit.h> |
44 | 50 | ||
45 | #include "koprefs.h" | 51 | #include "koprefs.h" |
46 | 52 | ||
47 | #include "koeditorgeneralevent.h" | 53 | #include "koeditorgeneralevent.h" |
48 | #include "kolocationbox.h" | 54 | #include "kolocationbox.h" |
49 | 55 | ||
50 | KOEditorGeneralEvent::KOEditorGeneralEvent(QObject* parent, | 56 | KOEditorGeneralEvent::KOEditorGeneralEvent(QObject* parent, |
51 | const char* name) : | 57 | const char* name) : |
52 | KOEditorGeneral( parent, name) | 58 | KOEditorGeneral( parent, name) |
53 | { | 59 | { |
54 | mTemplate = false; | 60 | mTemplate = false; |
55 | connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), | 61 | connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), |
56 | SLOT(setDuration())); | 62 | SLOT(setDuration())); |
57 | connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), | 63 | connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), |
58 | SLOT(emitDateTimeStr())); | 64 | SLOT(emitDateTimeStr())); |
59 | } | 65 | } |
60 | 66 | ||
61 | KOEditorGeneralEvent::~KOEditorGeneralEvent() | 67 | KOEditorGeneralEvent::~KOEditorGeneralEvent() |
62 | { | 68 | { |
63 | } | 69 | } |
64 | 70 | ||
65 | void KOEditorGeneralEvent::finishSetup() | 71 | void KOEditorGeneralEvent::finishSetup() |
66 | { | 72 | { |
67 | 73 | ||
68 | //disabled | 74 | //disabled |
69 | // QWidget::setTabOrder( mSummaryEdit, mLocationEdit ); | 75 | // QWidget::setTabOrder( mSummaryEdit, mLocationEdit ); |
70 | // QWidget::setTabOrder( mLocationEdit, mStartDateEdit ); | 76 | // QWidget::setTabOrder( mLocationEdit, mStartDateEdit ); |
71 | // QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit ); | 77 | // QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit ); |
72 | // QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit ); | 78 | // QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit ); |
73 | // QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit ); | 79 | // QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit ); |
74 | // QWidget::setTabOrder( mEndTimeEdit, mNoTimeButton ); | 80 | // QWidget::setTabOrder( mEndTimeEdit, mNoTimeButton ); |
75 | // QWidget::setTabOrder( mNoTimeButton, mAlarmButton ); | 81 | // QWidget::setTabOrder( mNoTimeButton, mAlarmButton ); |
76 | // QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit ); | 82 | // QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit ); |
77 | // QWidget::setTabOrder( mFreeTimeCombo, mCategoriesButton ); | 83 | // QWidget::setTabOrder( mFreeTimeCombo, mCategoriesButton ); |
78 | // QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo ); | 84 | // QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo ); |
79 | // QWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit ); | 85 | // QWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit ); |
80 | 86 | ||
81 | 87 | ||
82 | 88 | ||
83 | mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); | 89 | mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); |
84 | mSummaryEdit->setFocus(); | 90 | mSummaryEdit->setFocus(); |
85 | } | 91 | } |
86 | 92 | ||
87 | void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout) | 93 | void KOEditorGeneralEvent::initTime(QWidget *parent,Q3BoxLayout *topLayout) |
88 | { | 94 | { |
89 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); | 95 | Q3BoxLayout *timeLayout = new Q3VBoxLayout(topLayout); |
90 | 96 | ||
91 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, | 97 | Q3GroupBox *timeGroupBox = new Q3GroupBox(1,Qt::Horizontal, |
92 | i18n("Date && Time"),parent); | 98 | i18n("Date && Time"),parent); |
93 | timeLayout->addWidget(timeGroupBox); | 99 | timeLayout->addWidget(timeGroupBox); |
94 | 100 | ||
95 | timeGroupBox->layout()->setSpacing( KDialog::spacingHintSmall() ); | 101 | timeGroupBox->layout()->setSpacing( KDialog::spacingHintSmall() ); |
96 | timeGroupBox->layout()->setMargin( KDialog::marginHint() ); | 102 | timeGroupBox->layout()->setMargin( KDialog::marginHint() ); |
97 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); | 103 | Q3Frame *timeBoxFrame = new Q3Frame(timeGroupBox); |
98 | 104 | ||
99 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,2,3); | 105 | Q3GridLayout *layoutTimeBox = new Q3GridLayout(timeBoxFrame,2,3); |
100 | layoutTimeBox->setSpacing(topLayout->spacing()); | 106 | layoutTimeBox->setSpacing(topLayout->spacing()); |
101 | 107 | ||
102 | mStartDateLabel = new QLabel(i18n("Start:"),timeBoxFrame); | 108 | mStartDateLabel = new QLabel(i18n("Start:"),timeBoxFrame); |
103 | layoutTimeBox->addWidget(mStartDateLabel,0,0); | 109 | layoutTimeBox->addWidget(mStartDateLabel,0,0); |
104 | 110 | ||
105 | mStartDateEdit = new KDateEdit(timeBoxFrame); | 111 | mStartDateEdit = new KDateEdit(timeBoxFrame); |
106 | layoutTimeBox->addWidget(mStartDateEdit,0,1); | 112 | layoutTimeBox->addWidget(mStartDateEdit,0,1); |
107 | 113 | ||
108 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); | 114 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); |
109 | layoutTimeBox->addWidget(mStartTimeEdit,0,2); | 115 | layoutTimeBox->addWidget(mStartTimeEdit,0,2); |
110 | 116 | ||
111 | 117 | ||
112 | mEndDateLabel = new QLabel(i18n("End:"),timeBoxFrame); | 118 | mEndDateLabel = new QLabel(i18n("End:"),timeBoxFrame); |
113 | layoutTimeBox->addWidget(mEndDateLabel,1,0); | 119 | layoutTimeBox->addWidget(mEndDateLabel,1,0); |
114 | 120 | ||
115 | mEndDateEdit = new KDateEdit(timeBoxFrame); | 121 | mEndDateEdit = new KDateEdit(timeBoxFrame); |
116 | layoutTimeBox->addWidget(mEndDateEdit,1,1); | 122 | layoutTimeBox->addWidget(mEndDateEdit,1,1); |
117 | 123 | ||
118 | mEndTimeEdit = new KOTimeEdit(timeBoxFrame); | 124 | mEndTimeEdit = new KOTimeEdit(timeBoxFrame); |
119 | layoutTimeBox->addWidget(mEndTimeEdit,1,2); | 125 | layoutTimeBox->addWidget(mEndTimeEdit,1,2); |
120 | QWidget* duration = new QWidget( timeBoxFrame ); | 126 | QWidget* duration = new QWidget( timeBoxFrame ); |
121 | QHBoxLayout *flagsBox = new QHBoxLayout( duration ); | 127 | Q3HBoxLayout *flagsBox = new Q3HBoxLayout( duration ); |
122 | mNoTimeButton = new QCheckBox(i18n("All day event"),duration); | 128 | mNoTimeButton = new QCheckBox(i18n("All day event"),duration); |
123 | flagsBox->addWidget(mNoTimeButton); | 129 | flagsBox->addWidget(mNoTimeButton); |
124 | connect(mNoTimeButton, SIGNAL(toggled(bool)),SLOT(dontAssociateTime(bool))); | 130 | connect(mNoTimeButton, SIGNAL(toggled(bool)),SLOT(dontAssociateTime(bool))); |
125 | mDurationLabel = new QLabel( duration ); | 131 | mDurationLabel = new QLabel( duration ); |
126 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 132 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
127 | //layoutTimeBox->addMultiCellWidget( mDurationLabel, 3, 3, 0, 3 ); | 133 | //layoutTimeBox->addMultiCellWidget( mDurationLabel, 3, 3, 0, 3 ); |
128 | //} else { | 134 | //} else { |
129 | flagsBox->addWidget( mDurationLabel ); | 135 | flagsBox->addWidget( mDurationLabel ); |
130 | //} | 136 | //} |
131 | flagsBox->setStretchFactor(mDurationLabel, 10 ); | 137 | flagsBox->setStretchFactor(mDurationLabel, 10 ); |
132 | mDurationLabel->setAlignment( AlignRight | AlignVCenter); | 138 | mDurationLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter); |
133 | layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 ); | 139 | layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 ); |
134 | 140 | ||
135 | // time widgets are checked if they contain a valid time | 141 | // time widgets are checked if they contain a valid time |
136 | connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)), | 142 | connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)), |
137 | this, SLOT(startTimeChanged(QTime))); | 143 | this, SLOT(startTimeChanged(QTime))); |
138 | connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)), | 144 | connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)), |
139 | this, SLOT(endTimeChanged(QTime))); | 145 | this, SLOT(endTimeChanged(QTime))); |
140 | 146 | ||
141 | // date widgets are checked if they contain a valid date | 147 | // date widgets are checked if they contain a valid date |
142 | connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), | 148 | connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), |
143 | this, SLOT(startDateChanged(QDate))); | 149 | this, SLOT(startDateChanged(QDate))); |
144 | connect(mEndDateEdit, SIGNAL(dateChanged(QDate)), | 150 | connect(mEndDateEdit, SIGNAL(dateChanged(QDate)), |
145 | this, SLOT(endDateChanged(QDate))); | 151 | this, SLOT(endDateChanged(QDate))); |
146 | connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(sTimeChanged(QTime))); | 152 | connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(sTimeChanged(QTime))); |
147 | connect(mEndDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(eTimeChanged(QTime))); | 153 | connect(mEndDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(eTimeChanged(QTime))); |
148 | } | 154 | } |
149 | 155 | ||
150 | void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout) | 156 | void KOEditorGeneralEvent::initClass(QWidget *parent,Q3BoxLayout *topLayout) |
151 | { | 157 | { |
152 | QBoxLayout *classLayout = new QHBoxLayout(topLayout); | 158 | Q3BoxLayout *classLayout = new Q3HBoxLayout(topLayout); |
153 | 159 | ||
154 | QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent); | 160 | QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent); |
155 | classLayout->addWidget(freeTimeLabel); | 161 | classLayout->addWidget(freeTimeLabel); |
156 | 162 | ||
157 | mFreeTimeCombo = new QComboBox(false, parent); | 163 | mFreeTimeCombo = new QComboBox(false, parent); |
158 | mFreeTimeCombo->insertItem(i18n("Busy")); | 164 | mFreeTimeCombo->insertItem(i18n("Busy")); |
159 | mFreeTimeCombo->insertItem(i18n("Free")); | 165 | mFreeTimeCombo->insertItem(i18n("Free")); |
160 | classLayout->addWidget(mFreeTimeCombo); | 166 | classLayout->addWidget(mFreeTimeCombo); |
161 | } | 167 | } |
162 | 168 | ||
163 | void KOEditorGeneralEvent::timeStuffDisable(bool disable) | 169 | void KOEditorGeneralEvent::timeStuffDisable(bool disable) |
164 | { | 170 | { |
165 | mStartTimeEdit->setEnabled( !disable ); | 171 | mStartTimeEdit->setEnabled( !disable ); |
166 | mEndTimeEdit->setEnabled( !disable ); | 172 | mEndTimeEdit->setEnabled( !disable ); |
167 | 173 | ||
168 | setDuration(); | 174 | setDuration(); |
169 | emitDateTimeStr(); | 175 | emitDateTimeStr(); |
170 | } | 176 | } |
171 | 177 | ||
172 | void KOEditorGeneralEvent::dontAssociateTime(bool noTime) | 178 | void KOEditorGeneralEvent::dontAssociateTime(bool noTime) |
173 | { | 179 | { |
174 | timeStuffDisable(noTime); | 180 | timeStuffDisable(noTime); |
175 | //if(alarmButton->isChecked()) alarmStuffDisable(noTime); | 181 | //if(alarmButton->isChecked()) alarmStuffDisable(noTime); |
176 | allDayChanged(noTime); | 182 | allDayChanged(noTime); |
177 | } | 183 | } |
178 | 184 | ||
179 | void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end) | 185 | void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end) |
180 | { | 186 | { |
181 | // kdDebug() << "KOEditorGeneralEvent::setDateTimes(): Start DateTime: " << start.toString() << endl; | 187 | // kdDebug() << "KOEditorGeneralEvent::setDateTimes(): Start DateTime: " << start.toString() << endl; |
182 | if ( !mTemplate ) | 188 | if ( !mTemplate ) |
183 | mStartDateEdit->setDate(start.date()); | 189 | mStartDateEdit->setDate(start.date()); |
184 | // KTimeEdit seems to emit some signals when setTime() is called. | 190 | // KTimeEdit seems to emit some signals when setTime() is called. |