-rw-r--r-- | korganizer/koeditorrecurrence.cpp | 83 | ||||
-rw-r--r-- | microkde/kdialog.cpp | 12 |
2 files changed, 32 insertions, 63 deletions
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index bedc75a..bf81b01 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp | |||
@@ -1,386 +1,394 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000-2003 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000-2003 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 <qfiledialog.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qbuttongroup.h> | 28 | #include <qbuttongroup.h> |
29 | #include <qvgroupbox.h> | 29 | #include <qvgroupbox.h> |
30 | #include <qwidgetstack.h> | 30 | #include <qwidgetstack.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qlistbox.h> | 32 | #include <qlistbox.h> |
33 | #include <qspinbox.h> | 33 | #include <qspinbox.h> |
34 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
35 | #include <qapplication.h> | 35 | #include <qapplication.h> |
36 | 36 | ||
37 | #include <kdialog.h> | 37 | #include <kdialog.h> |
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <klocale.h> | 39 | #include <klocale.h> |
40 | #include <kiconloader.h> | 40 | #include <kiconloader.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <knumvalidator.h> | 42 | #include <knumvalidator.h> |
43 | 43 | ||
44 | #include <libkcal/event.h> | 44 | #include <libkcal/event.h> |
45 | #include <libkcal/todo.h> | 45 | #include <libkcal/todo.h> |
46 | 46 | ||
47 | #include <libkdepim/kdateedit.h> | 47 | #include <libkdepim/kdateedit.h> |
48 | 48 | ||
49 | #include "koprefs.h" | 49 | #include "koprefs.h" |
50 | 50 | ||
51 | #include "koeditorrecurrence.h" | 51 | #include "koeditorrecurrence.h" |
52 | 52 | ||
53 | /////////////////////////// RecurBase /////////////////////////////// | 53 | /////////////////////////// RecurBase /////////////////////////////// |
54 | 54 | ||
55 | RecurBase::RecurBase( QWidget *parent, const char *name ) : | 55 | RecurBase::RecurBase( QWidget *parent, const char *name ) : |
56 | QWidget( parent, name ) | 56 | QWidget( parent, name ) |
57 | { | 57 | { |
58 | mFrequencyEdit = new QSpinBox( 1, 9999, 1, this ); | 58 | mFrequencyEdit = new QSpinBox( 1, 9999, 1, this ); |
59 | mFrequencyEdit->setValue( 1 ); | 59 | mFrequencyEdit->setValue( 1 ); |
60 | } | 60 | } |
61 | 61 | ||
62 | QWidget *RecurBase::frequencyEdit() | 62 | QWidget *RecurBase::frequencyEdit() |
63 | { | 63 | { |
64 | return mFrequencyEdit; | 64 | return mFrequencyEdit; |
65 | } | 65 | } |
66 | 66 | ||
67 | void RecurBase::setFrequency( int f ) | 67 | void RecurBase::setFrequency( int f ) |
68 | { | 68 | { |
69 | if ( f < 1 ) f = 1; | 69 | if ( f < 1 ) f = 1; |
70 | 70 | ||
71 | mFrequencyEdit->setValue( f ); | 71 | mFrequencyEdit->setValue( f ); |
72 | } | 72 | } |
73 | 73 | ||
74 | int RecurBase::frequency() | 74 | int RecurBase::frequency() |
75 | { | 75 | { |
76 | return mFrequencyEdit->value(); | 76 | return mFrequencyEdit->value(); |
77 | } | 77 | } |
78 | 78 | ||
79 | /////////////////////////// RecurDaily /////////////////////////////// | 79 | /////////////////////////// RecurDaily /////////////////////////////// |
80 | 80 | ||
81 | RecurDaily::RecurDaily( QWidget *parent, const char *name ) : | 81 | RecurDaily::RecurDaily( QWidget *parent, const char *name ) : |
82 | RecurBase( parent, name ) | 82 | RecurBase( parent, name ) |
83 | { | 83 | { |
84 | QBoxLayout *topLayout = new QHBoxLayout( this ); | 84 | QBoxLayout *topLayout = new QHBoxLayout( this ); |
85 | topLayout->setSpacing( KDialog::spacingHint() ); | 85 | topLayout->setSpacing( KDialog::spacingHint() ); |
86 | topLayout->setMargin( KDialog::marginHintSmall() ); | ||
86 | 87 | ||
87 | QLabel *preLabel = new QLabel( i18n("Recur every"), this ); | 88 | QLabel *preLabel = new QLabel( i18n("Recur every"), this ); |
88 | topLayout->addWidget( preLabel ); | 89 | topLayout->addWidget( preLabel ); |
89 | 90 | ||
90 | topLayout->addWidget( frequencyEdit() ); | 91 | topLayout->addWidget( frequencyEdit() ); |
91 | 92 | ||
92 | QLabel *postLabel = new QLabel( i18n("day(s)"), this ); | 93 | QLabel *postLabel = new QLabel( i18n("day(s)"), this ); |
93 | topLayout->addWidget( postLabel ); | 94 | topLayout->addWidget( postLabel ); |
94 | } | 95 | } |
95 | 96 | ||
96 | 97 | ||
97 | /////////////////////////// RecurWeekly /////////////////////////////// | 98 | /////////////////////////// RecurWeekly /////////////////////////////// |
98 | 99 | ||
99 | RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) : | 100 | RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) : |
100 | RecurBase( parent, name ) | 101 | RecurBase( parent, name ) |
101 | { | 102 | { |
102 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 103 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
103 | topLayout->setSpacing( KDialog::spacingHint() ); | 104 | topLayout->setSpacing( KDialog::spacingHint() ); |
105 | topLayout->setMargin( KDialog::marginHintSmall() ); | ||
104 | 106 | ||
105 | topLayout->addStretch( 1 ); | 107 | //topLayout->addStretch( 1 ); |
106 | 108 | ||
107 | QBoxLayout *weeksLayout = new QHBoxLayout( topLayout ); | 109 | QBoxLayout *weeksLayout = new QHBoxLayout( topLayout ); |
108 | 110 | ||
109 | QLabel *preLabel = new QLabel( i18n("Recur every"), this ); | 111 | QLabel *preLabel = new QLabel( i18n("Recur every"), this ); |
110 | weeksLayout->addWidget( preLabel ); | 112 | weeksLayout->addWidget( preLabel ); |
111 | 113 | ||
112 | weeksLayout->addWidget( frequencyEdit() ); | 114 | weeksLayout->addWidget( frequencyEdit() ); |
113 | 115 | ||
114 | QLabel *postLabel = new QLabel( i18n("week(s) on:"), this ); | 116 | QLabel *postLabel = new QLabel( i18n("week(s) on:"), this ); |
115 | weeksLayout->addWidget( postLabel ); | 117 | weeksLayout->addWidget( postLabel ); |
116 | 118 | ||
117 | QHBox *dayBox = new QHBox( this ); | 119 | QHBox *dayBox = new QHBox( this ); |
118 | topLayout->addWidget( dayBox, 1, AlignVCenter ); | 120 | topLayout->addWidget( dayBox, 1, AlignVCenter ); |
119 | // TODO: Respect start of week setting | 121 | // TODO: Respect start of week setting |
120 | for ( int i = 0; i < 7; ++i ) { | 122 | for ( int i = 0; i < 7; ++i ) { |
121 | QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true ); | 123 | QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true ); |
122 | if ( KOPrefs::instance()->mCompactDialogs ) { | 124 | int left = 1; |
123 | weekDayName = weekDayName.left( 1 ); | 125 | if ( QApplication::desktop()->width() > 480 ) { |
126 | ++left; | ||
127 | if ( QApplication::desktop()->width() > 640 ) | ||
128 | ++left; | ||
124 | } | 129 | } |
125 | mDayBoxes[ i ] = new QCheckBox( weekDayName, dayBox ); | 130 | mDayBoxes[ i ] = new QCheckBox( weekDayName.left( left ), dayBox ); |
126 | } | 131 | } |
127 | 132 | ||
128 | topLayout->addStretch( 1 ); | 133 | topLayout->addStretch( ); |
129 | } | 134 | } |
130 | 135 | ||
131 | void RecurWeekly::setDays( const QBitArray &days ) | 136 | void RecurWeekly::setDays( const QBitArray &days ) |
132 | { | 137 | { |
133 | for ( int i = 0; i < 7; ++i ) { | 138 | for ( int i = 0; i < 7; ++i ) { |
134 | mDayBoxes[ i ]->setChecked( days.testBit( i ) ); | 139 | mDayBoxes[ i ]->setChecked( days.testBit( i ) ); |
135 | } | 140 | } |
136 | } | 141 | } |
137 | 142 | ||
138 | QBitArray RecurWeekly::days() | 143 | QBitArray RecurWeekly::days() |
139 | { | 144 | { |
140 | QBitArray days( 7 ); | 145 | QBitArray days( 7 ); |
141 | 146 | ||
142 | for ( int i = 0; i < 7; ++i ) { | 147 | for ( int i = 0; i < 7; ++i ) { |
143 | days.setBit( i, mDayBoxes[ i ]->isChecked() ); | 148 | days.setBit( i, mDayBoxes[ i ]->isChecked() ); |
144 | } | 149 | } |
145 | 150 | ||
146 | return days; | 151 | return days; |
147 | } | 152 | } |
148 | 153 | ||
149 | /////////////////////////// RecurMonthly /////////////////////////////// | 154 | /////////////////////////// RecurMonthly /////////////////////////////// |
150 | 155 | ||
151 | RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) : | 156 | RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) : |
152 | RecurBase( parent, name ) | 157 | RecurBase( parent, name ) |
153 | { | 158 | { |
154 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 159 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
155 | topLayout->setSpacing( KDialog::spacingHint() ); | 160 | topLayout->setSpacing( KDialog::spacingHint() ); |
161 | topLayout->setMargin( KDialog::marginHintSmall() ); | ||
156 | 162 | ||
157 | 163 | ||
158 | QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); | 164 | QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); |
159 | 165 | ||
160 | QLabel *preLabel = new QLabel( i18n("every"), this ); | 166 | QLabel *preLabel = new QLabel( i18n("every"), this ); |
161 | freqLayout->addWidget( preLabel ); | 167 | freqLayout->addWidget( preLabel ); |
162 | 168 | ||
163 | freqLayout->addWidget( frequencyEdit() ); | 169 | freqLayout->addWidget( frequencyEdit() ); |
164 | 170 | ||
165 | QLabel *postLabel = new QLabel( i18n("month(s)"), this ); | 171 | QLabel *postLabel = new QLabel( i18n("month(s)"), this ); |
166 | freqLayout->addWidget( postLabel ); | 172 | freqLayout->addWidget( postLabel ); |
167 | 173 | ||
168 | 174 | ||
169 | QButtonGroup *buttonGroup = new QButtonGroup( this ); | 175 | QButtonGroup *buttonGroup = new QButtonGroup( this ); |
170 | buttonGroup->setFrameStyle( QFrame::NoFrame ); | 176 | buttonGroup->setFrameStyle( QFrame::NoFrame ); |
171 | topLayout->addWidget( buttonGroup, 1, AlignVCenter ); | 177 | topLayout->addWidget( buttonGroup, 1, AlignVCenter ); |
172 | 178 | ||
173 | QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 ); | 179 | QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 ); |
174 | buttonLayout->setSpacing( KDialog::spacingHint() ); | 180 | buttonLayout->setSpacing( KDialog::spacingHint() ); |
181 | buttonLayout->setMargin( KDialog::marginHintSmall() ); | ||
175 | 182 | ||
176 | 183 | ||
177 | QString recurOnText; | 184 | QString recurOnText; |
178 | if ( !KOPrefs::instance()->mCompactDialogs ) { | 185 | if ( QApplication::desktop()->width() > 320 ) { |
179 | recurOnText = i18n("Recur on the"); | 186 | recurOnText = i18n("Recur on the"); |
180 | } | 187 | } |
181 | 188 | ||
182 | mByDayRadio = new QRadioButton( recurOnText, buttonGroup ); | 189 | mByDayRadio = new QRadioButton( recurOnText, buttonGroup ); |
183 | buttonLayout->addWidget( mByDayRadio, 0, 0 ); | 190 | buttonLayout->addWidget( mByDayRadio, 0, 0 ); |
184 | 191 | ||
185 | mByDayCombo = new QComboBox( buttonGroup ); | 192 | mByDayCombo = new QComboBox( buttonGroup ); |
186 | mByDayCombo->setSizeLimit( 7 ); | 193 | mByDayCombo->setSizeLimit( 7 ); |
187 | mByDayCombo->insertItem( i18n("1st") ); | 194 | mByDayCombo->insertItem( i18n("1st") ); |
188 | mByDayCombo->insertItem( i18n("2nd") ); | 195 | mByDayCombo->insertItem( i18n("2nd") ); |
189 | mByDayCombo->insertItem( i18n("3rd") ); | 196 | mByDayCombo->insertItem( i18n("3rd") ); |
190 | mByDayCombo->insertItem( i18n("4th") ); | 197 | mByDayCombo->insertItem( i18n("4th") ); |
191 | mByDayCombo->insertItem( i18n("5th") ); | 198 | mByDayCombo->insertItem( i18n("5th") ); |
192 | mByDayCombo->insertItem( i18n("6th") ); | 199 | mByDayCombo->insertItem( i18n("6th") ); |
193 | mByDayCombo->insertItem( i18n("7th") ); | 200 | mByDayCombo->insertItem( i18n("7th") ); |
194 | mByDayCombo->insertItem( i18n("8th") ); | 201 | mByDayCombo->insertItem( i18n("8th") ); |
195 | mByDayCombo->insertItem( i18n("9th") ); | 202 | mByDayCombo->insertItem( i18n("9th") ); |
196 | mByDayCombo->insertItem( i18n("10th") ); | 203 | mByDayCombo->insertItem( i18n("10th") ); |
197 | mByDayCombo->insertItem( i18n("11th") ); | 204 | mByDayCombo->insertItem( i18n("11th") ); |
198 | mByDayCombo->insertItem( i18n("12th") ); | 205 | mByDayCombo->insertItem( i18n("12th") ); |
199 | mByDayCombo->insertItem( i18n("13th") ); | 206 | mByDayCombo->insertItem( i18n("13th") ); |
200 | mByDayCombo->insertItem( i18n("14th") ); | 207 | mByDayCombo->insertItem( i18n("14th") ); |
201 | mByDayCombo->insertItem( i18n("15th") ); | 208 | mByDayCombo->insertItem( i18n("15th") ); |
202 | mByDayCombo->insertItem( i18n("16th") ); | 209 | mByDayCombo->insertItem( i18n("16th") ); |
203 | mByDayCombo->insertItem( i18n("17th") ); | 210 | mByDayCombo->insertItem( i18n("17th") ); |
204 | mByDayCombo->insertItem( i18n("18th") ); | 211 | mByDayCombo->insertItem( i18n("18th") ); |
205 | mByDayCombo->insertItem( i18n("19th") ); | 212 | mByDayCombo->insertItem( i18n("19th") ); |
206 | mByDayCombo->insertItem( i18n("20th") ); | 213 | mByDayCombo->insertItem( i18n("20th") ); |
207 | mByDayCombo->insertItem( i18n("21st") ); | 214 | mByDayCombo->insertItem( i18n("21st") ); |
208 | mByDayCombo->insertItem( i18n("22nd") ); | 215 | mByDayCombo->insertItem( i18n("22nd") ); |
209 | mByDayCombo->insertItem( i18n("23rd") ); | 216 | mByDayCombo->insertItem( i18n("23rd") ); |
210 | mByDayCombo->insertItem( i18n("24th") ); | 217 | mByDayCombo->insertItem( i18n("24th") ); |
211 | mByDayCombo->insertItem( i18n("25th") ); | 218 | mByDayCombo->insertItem( i18n("25th") ); |
212 | mByDayCombo->insertItem( i18n("26th") ); | 219 | mByDayCombo->insertItem( i18n("26th") ); |
213 | mByDayCombo->insertItem( i18n("27th") ); | 220 | mByDayCombo->insertItem( i18n("27th") ); |
214 | mByDayCombo->insertItem( i18n("28th") ); | 221 | mByDayCombo->insertItem( i18n("28th") ); |
215 | mByDayCombo->insertItem( i18n("29th") ); | 222 | mByDayCombo->insertItem( i18n("29th") ); |
216 | mByDayCombo->insertItem( i18n("30th") ); | 223 | mByDayCombo->insertItem( i18n("30th") ); |
217 | mByDayCombo->insertItem( i18n("31st") ); | 224 | mByDayCombo->insertItem( i18n("31st") ); |
218 | buttonLayout->addWidget( mByDayCombo, 0, 1 ); | 225 | buttonLayout->addWidget( mByDayCombo, 0, 1 ); |
219 | 226 | ||
220 | QLabel *byDayLabel = new QLabel( i18n("day"), buttonGroup ); | 227 | QLabel *byDayLabel = new QLabel( i18n("day"), buttonGroup ); |
221 | buttonLayout->addWidget( byDayLabel, 0, 2 ); | 228 | buttonLayout->addWidget( byDayLabel, 0, 2 ); |
222 | 229 | ||
223 | 230 | ||
224 | mByPosRadio = new QRadioButton( recurOnText, buttonGroup); | 231 | mByPosRadio = new QRadioButton( recurOnText, buttonGroup); |
225 | buttonLayout->addWidget( mByPosRadio, 1, 0 ); | 232 | buttonLayout->addWidget( mByPosRadio, 1, 0 ); |
226 | 233 | ||
227 | mByPosCountCombo = new QComboBox( buttonGroup ); | 234 | mByPosCountCombo = new QComboBox( buttonGroup ); |
228 | mByPosCountCombo->insertItem( i18n("1st") ); | 235 | mByPosCountCombo->insertItem( i18n("1st") ); |
229 | mByPosCountCombo->insertItem( i18n("2nd") ); | 236 | mByPosCountCombo->insertItem( i18n("2nd") ); |
230 | mByPosCountCombo->insertItem( i18n("3rd") ); | 237 | mByPosCountCombo->insertItem( i18n("3rd") ); |
231 | mByPosCountCombo->insertItem( i18n("4th") ); | 238 | mByPosCountCombo->insertItem( i18n("4th") ); |
232 | mByPosCountCombo->insertItem( i18n("5th") ); | 239 | mByPosCountCombo->insertItem( i18n("5th") ); |
233 | buttonLayout->addWidget( mByPosCountCombo, 1, 1 ); | 240 | buttonLayout->addWidget( mByPosCountCombo, 1, 1 ); |
234 | 241 | ||
235 | mByPosWeekdayCombo = new QComboBox( buttonGroup ); | 242 | mByPosWeekdayCombo = new QComboBox( buttonGroup ); |
236 | mByPosWeekdayCombo->insertItem( i18n("Monday") ); | 243 | mByPosWeekdayCombo->insertItem( i18n("Monday") ); |
237 | mByPosWeekdayCombo->insertItem( i18n("Tuesday") ); | 244 | mByPosWeekdayCombo->insertItem( i18n("Tuesday") ); |
238 | mByPosWeekdayCombo->insertItem( i18n("Wednesday") ); | 245 | mByPosWeekdayCombo->insertItem( i18n("Wednesday") ); |
239 | mByPosWeekdayCombo->insertItem( i18n("Thursday") ); | 246 | mByPosWeekdayCombo->insertItem( i18n("Thursday") ); |
240 | mByPosWeekdayCombo->insertItem( i18n("Friday") ); | 247 | mByPosWeekdayCombo->insertItem( i18n("Friday") ); |
241 | mByPosWeekdayCombo->insertItem( i18n("Saturday") ); | 248 | mByPosWeekdayCombo->insertItem( i18n("Saturday") ); |
242 | mByPosWeekdayCombo->insertItem( i18n("Sunday") ); | 249 | mByPosWeekdayCombo->insertItem( i18n("Sunday") ); |
243 | buttonLayout->addWidget( mByPosWeekdayCombo, 1, 2 ); | 250 | buttonLayout->addWidget( mByPosWeekdayCombo, 1, 2 ); |
244 | } | 251 | } |
245 | 252 | ||
246 | void RecurMonthly::setByDay( int day ) | 253 | void RecurMonthly::setByDay( int day ) |
247 | { | 254 | { |
248 | mByDayRadio->setChecked( true ); | 255 | mByDayRadio->setChecked( true ); |
249 | mByDayCombo->setCurrentItem( day ); | 256 | mByDayCombo->setCurrentItem( day ); |
250 | } | 257 | } |
251 | 258 | ||
252 | void RecurMonthly::setByPos( int count, int weekday ) | 259 | void RecurMonthly::setByPos( int count, int weekday ) |
253 | { | 260 | { |
254 | mByPosRadio->setChecked( true ); | 261 | mByPosRadio->setChecked( true ); |
255 | mByPosCountCombo->setCurrentItem( count ); | 262 | mByPosCountCombo->setCurrentItem( count ); |
256 | mByPosWeekdayCombo->setCurrentItem( weekday ); | 263 | mByPosWeekdayCombo->setCurrentItem( weekday ); |
257 | } | 264 | } |
258 | 265 | ||
259 | bool RecurMonthly::byDay() | 266 | bool RecurMonthly::byDay() |
260 | { | 267 | { |
261 | return mByDayRadio->isChecked(); | 268 | return mByDayRadio->isChecked(); |
262 | } | 269 | } |
263 | 270 | ||
264 | bool RecurMonthly::byPos() | 271 | bool RecurMonthly::byPos() |
265 | { | 272 | { |
266 | return mByPosRadio->isChecked(); | 273 | return mByPosRadio->isChecked(); |
267 | } | 274 | } |
268 | 275 | ||
269 | int RecurMonthly::day() | 276 | int RecurMonthly::day() |
270 | { | 277 | { |
271 | return mByDayCombo->currentItem() + 1; | 278 | return mByDayCombo->currentItem() + 1; |
272 | } | 279 | } |
273 | 280 | ||
274 | int RecurMonthly::count() | 281 | int RecurMonthly::count() |
275 | { | 282 | { |
276 | return mByPosCountCombo->currentItem() + 1; | 283 | return mByPosCountCombo->currentItem() + 1; |
277 | } | 284 | } |
278 | 285 | ||
279 | int RecurMonthly::weekday() | 286 | int RecurMonthly::weekday() |
280 | { | 287 | { |
281 | return mByPosWeekdayCombo->currentItem(); | 288 | return mByPosWeekdayCombo->currentItem(); |
282 | } | 289 | } |
283 | 290 | ||
284 | /////////////////////////// RecurYearly /////////////////////////////// | 291 | /////////////////////////// RecurYearly /////////////////////////////// |
285 | 292 | ||
286 | RecurYearly::RecurYearly( QWidget *parent, const char *name ) : | 293 | RecurYearly::RecurYearly( QWidget *parent, const char *name ) : |
287 | RecurBase( parent, name ) | 294 | RecurBase( parent, name ) |
288 | { | 295 | { |
289 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 296 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
290 | topLayout->setSpacing( KDialog::spacingHint() ); | 297 | topLayout->setSpacing( KDialog::spacingHint() ); |
298 | topLayout->setMargin( KDialog::marginHintSmall() ); | ||
291 | 299 | ||
292 | 300 | ||
293 | QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); | 301 | QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); |
294 | 302 | ||
295 | QLabel *preLabel = new QLabel( i18n("every"), this ); | 303 | QLabel *preLabel = new QLabel( i18n("every"), this ); |
296 | freqLayout->addWidget( preLabel ); | 304 | freqLayout->addWidget( preLabel ); |
297 | 305 | ||
298 | freqLayout->addWidget( frequencyEdit() ); | 306 | freqLayout->addWidget( frequencyEdit() ); |
299 | 307 | ||
300 | QLabel *postLabel = new QLabel( i18n("year(s)"), this ); | 308 | QLabel *postLabel = new QLabel( i18n("year(s)"), this ); |
301 | freqLayout->addWidget( postLabel ); | 309 | freqLayout->addWidget( postLabel ); |
302 | 310 | ||
303 | 311 | ||
304 | QButtonGroup *buttonGroup = new QButtonGroup( this ); | 312 | QButtonGroup *buttonGroup = new QButtonGroup( this ); |
305 | buttonGroup->setFrameStyle( QFrame::NoFrame ); | 313 | buttonGroup->setFrameStyle( QFrame::NoFrame ); |
306 | topLayout->addWidget( buttonGroup, 1, AlignVCenter ); | 314 | topLayout->addWidget( buttonGroup, 1, AlignVCenter ); |
307 | 315 | ||
308 | QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 2, 3 ); | 316 | QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 2, 3 ); |
309 | 317 | ||
310 | mByMonthRadio = new QRadioButton( i18n("On day "), buttonGroup); | 318 | mByMonthRadio = new QRadioButton( i18n("On day "), buttonGroup); |
311 | buttonLayout->addWidget( mByMonthRadio, 0, 0 , Qt::AlignRight); | 319 | buttonLayout->addWidget( mByMonthRadio, 0, 0 , Qt::AlignRight); |
312 | mByDayLabel = new QLabel( i18n("%1 of ").arg(1), buttonGroup ); | 320 | mByDayLabel = new QLabel( i18n("%1 of ").arg(1), buttonGroup ); |
313 | 321 | ||
314 | buttonLayout->addWidget( mByDayLabel, 0, 1 ); | 322 | buttonLayout->addWidget( mByDayLabel, 0, 1 ); |
315 | mByMonthCombo = new QComboBox( buttonGroup ); | 323 | mByMonthCombo = new QComboBox( buttonGroup ); |
316 | mByMonthCombo->insertItem( i18n("January") ); | 324 | mByMonthCombo->insertItem( i18n("January") ); |
317 | mByMonthCombo->insertItem( i18n("February") ); | 325 | mByMonthCombo->insertItem( i18n("February") ); |
318 | mByMonthCombo->insertItem( i18n("March") ); | 326 | mByMonthCombo->insertItem( i18n("March") ); |
319 | mByMonthCombo->insertItem( i18n("April") ); | 327 | mByMonthCombo->insertItem( i18n("April") ); |
320 | mByMonthCombo->insertItem( i18n("May") ); | 328 | mByMonthCombo->insertItem( i18n("May") ); |
321 | mByMonthCombo->insertItem( i18n("June") ); | 329 | mByMonthCombo->insertItem( i18n("June") ); |
322 | mByMonthCombo->insertItem( i18n("July") ); | 330 | mByMonthCombo->insertItem( i18n("July") ); |
323 | mByMonthCombo->insertItem( i18n("August") ); | 331 | mByMonthCombo->insertItem( i18n("August") ); |
324 | mByMonthCombo->insertItem( i18n("September") ); | 332 | mByMonthCombo->insertItem( i18n("September") ); |
325 | mByMonthCombo->insertItem( i18n("October") ); | 333 | mByMonthCombo->insertItem( i18n("October") ); |
326 | mByMonthCombo->insertItem( i18n("November") ); | 334 | mByMonthCombo->insertItem( i18n("November") ); |
327 | mByMonthCombo->insertItem( i18n("December") ); | 335 | mByMonthCombo->insertItem( i18n("December") ); |
328 | buttonLayout->addWidget( mByMonthCombo, 0, 2,Qt::AlignLeft ); | 336 | buttonLayout->addWidget( mByMonthCombo, 0, 2,Qt::AlignLeft ); |
329 | if ( QApplication::desktop()->width() <= 640 ) { | 337 | if ( QApplication::desktop()->width() <= 640 ) { |
330 | mByMonthCombo->setSizeLimit( 6 ); | 338 | mByMonthCombo->setSizeLimit( 6 ); |
331 | } | 339 | } |
332 | 340 | ||
333 | mByDayRadio = new QRadioButton( i18n("On day "), buttonGroup); | 341 | mByDayRadio = new QRadioButton( i18n("On day "), buttonGroup); |
334 | buttonLayout->addWidget( mByDayRadio, 1, 0 , Qt::AlignRight); | 342 | buttonLayout->addWidget( mByDayRadio, 1, 0 , Qt::AlignRight); |
335 | mDayOfLabel = new QLabel( i18n("%1 of the year").arg(1), buttonGroup ); | 343 | mDayOfLabel = new QLabel( i18n("%1 of the year").arg(1), buttonGroup ); |
336 | buttonLayout->addMultiCellWidget( mDayOfLabel, 1, 1, 1,3 ); | 344 | buttonLayout->addMultiCellWidget( mDayOfLabel, 1, 1, 1,3 ); |
337 | 345 | ||
338 | } | 346 | } |
339 | 347 | ||
340 | void RecurYearly::setByDay( int doy ) | 348 | void RecurYearly::setByDay( int doy ) |
341 | { | 349 | { |
342 | mByDayRadio->setChecked( true ); | 350 | mByDayRadio->setChecked( true ); |
343 | mDayOfLabel->setText(i18n("%1 of the year").arg( doy ) ); | 351 | mDayOfLabel->setText(i18n("%1 of the year").arg( doy ) ); |
344 | } | 352 | } |
345 | 353 | ||
346 | void RecurYearly::setByMonth( int month, int day ) | 354 | void RecurYearly::setByMonth( int month, int day ) |
347 | { | 355 | { |
348 | mByMonthRadio->setChecked( true ); | 356 | mByMonthRadio->setChecked( true ); |
349 | mByMonthCombo->setCurrentItem( month - 1 ); | 357 | mByMonthCombo->setCurrentItem( month - 1 ); |
350 | mByDayLabel->setText(i18n("%1 of ").arg( day ) ); | 358 | mByDayLabel->setText(i18n("%1 of ").arg( day ) ); |
351 | mDay = day; | 359 | mDay = day; |
352 | } | 360 | } |
353 | 361 | ||
354 | bool RecurYearly::byMonth() | 362 | bool RecurYearly::byMonth() |
355 | { | 363 | { |
356 | return mByMonthRadio->isChecked(); | 364 | return mByMonthRadio->isChecked(); |
357 | } | 365 | } |
358 | 366 | ||
359 | bool RecurYearly::byDay() | 367 | bool RecurYearly::byDay() |
360 | { | 368 | { |
361 | return mByDayRadio->isChecked(); | 369 | return mByDayRadio->isChecked(); |
362 | } | 370 | } |
363 | 371 | ||
364 | int RecurYearly::month() | 372 | int RecurYearly::month() |
365 | { | 373 | { |
366 | return mByMonthCombo->currentItem() + 1; | 374 | return mByMonthCombo->currentItem() + 1; |
367 | } | 375 | } |
368 | int RecurYearly::day() | 376 | int RecurYearly::day() |
369 | { | 377 | { |
370 | return mDay;//mByDayCombo->currentItem() + 1; | 378 | return mDay;//mByDayCombo->currentItem() + 1; |
371 | } | 379 | } |
372 | 380 | ||
373 | //////////////////////////// ExceptionsWidget ////////////////////////// | 381 | //////////////////////////// ExceptionsWidget ////////////////////////// |
374 | 382 | ||
375 | ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) : | 383 | ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) : |
376 | QWidget( parent, name ) | 384 | QWidget( parent, name ) |
377 | { | 385 | { |
378 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 386 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
379 | 387 | ||
380 | QGroupBox *groupBox = new QGroupBox( 1, Horizontal, i18n("Exceptions"), | 388 | QGroupBox *groupBox = new QGroupBox( 1, Horizontal, i18n("Exceptions"), |
381 | this ); | 389 | this ); |
382 | topLayout->addWidget( groupBox ); | 390 | topLayout->addWidget( groupBox ); |
383 | 391 | ||
384 | QWidget *box = new QWidget( groupBox ); | 392 | QWidget *box = new QWidget( groupBox ); |
385 | 393 | ||
386 | QGridLayout *boxLayout = new QGridLayout( box ); | 394 | QGridLayout *boxLayout = new QGridLayout( box ); |
@@ -412,516 +420,469 @@ ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) : | |||
412 | } else { | 420 | } else { |
413 | setMinimumWidth( 440 ); | 421 | setMinimumWidth( 440 ); |
414 | mExceptionDateEdit->setMinimumWidth( 200 ); | 422 | mExceptionDateEdit->setMinimumWidth( 200 ); |
415 | } | 423 | } |
416 | } | 424 | } |
417 | 425 | ||
418 | void ExceptionsWidget::setDefaults( const QDateTime &from ) | 426 | void ExceptionsWidget::setDefaults( const QDateTime &from ) |
419 | { | 427 | { |
420 | mExceptionDateEdit->setDate( from.date() ); | 428 | mExceptionDateEdit->setDate( from.date() ); |
421 | } | 429 | } |
422 | 430 | ||
423 | void ExceptionsWidget::addException() | 431 | void ExceptionsWidget::addException() |
424 | { | 432 | { |
425 | QDate date = mExceptionDateEdit->date(); | 433 | QDate date = mExceptionDateEdit->date(); |
426 | QString dateStr = KGlobal::locale()->formatDate( date ); | 434 | QString dateStr = KGlobal::locale()->formatDate( date ); |
427 | if( !mExceptionList->findItem( dateStr ) ) { | 435 | if( !mExceptionList->findItem( dateStr ) ) { |
428 | mExceptionDates.append( date ); | 436 | mExceptionDates.append( date ); |
429 | mExceptionList->insertItem( dateStr ); | 437 | mExceptionList->insertItem( dateStr ); |
430 | } | 438 | } |
431 | } | 439 | } |
432 | 440 | ||
433 | void ExceptionsWidget::changeException() | 441 | void ExceptionsWidget::changeException() |
434 | { | 442 | { |
435 | int pos = mExceptionList->currentItem(); | 443 | int pos = mExceptionList->currentItem(); |
436 | if ( pos < 0 ) return; | 444 | if ( pos < 0 ) return; |
437 | 445 | ||
438 | QDate date = mExceptionDateEdit->date(); | 446 | QDate date = mExceptionDateEdit->date(); |
439 | mExceptionDates[ pos ] = date; | 447 | mExceptionDates[ pos ] = date; |
440 | mExceptionList->changeItem( KGlobal::locale()->formatDate( date ), pos ); | 448 | mExceptionList->changeItem( KGlobal::locale()->formatDate( date ), pos ); |
441 | } | 449 | } |
442 | 450 | ||
443 | void ExceptionsWidget::deleteException() | 451 | void ExceptionsWidget::deleteException() |
444 | { | 452 | { |
445 | int pos = mExceptionList->currentItem(); | 453 | int pos = mExceptionList->currentItem(); |
446 | if ( pos < 0 ) return; | 454 | if ( pos < 0 ) return; |
447 | 455 | ||
448 | mExceptionDates.remove( mExceptionDates.at( pos ) ); | 456 | mExceptionDates.remove( mExceptionDates.at( pos ) ); |
449 | mExceptionList->removeItem( pos ); | 457 | mExceptionList->removeItem( pos ); |
450 | } | 458 | } |
451 | 459 | ||
452 | void ExceptionsWidget::setDates( const DateList &dates ) | 460 | void ExceptionsWidget::setDates( const DateList &dates ) |
453 | { | 461 | { |
454 | mExceptionList->clear(); | 462 | mExceptionList->clear(); |
455 | mExceptionDates.clear(); | 463 | mExceptionDates.clear(); |
456 | DateList::ConstIterator dit; | 464 | DateList::ConstIterator dit; |
457 | for ( dit = dates.begin(); dit != dates.end(); ++dit ) { | 465 | for ( dit = dates.begin(); dit != dates.end(); ++dit ) { |
458 | mExceptionList->insertItem( KGlobal::locale()->formatDate(* dit ) ); | 466 | mExceptionList->insertItem( KGlobal::locale()->formatDate(* dit ) ); |
459 | mExceptionDates.append( *dit ); | 467 | mExceptionDates.append( *dit ); |
460 | } | 468 | } |
461 | } | 469 | } |
462 | 470 | ||
463 | DateList ExceptionsWidget::dates() | 471 | DateList ExceptionsWidget::dates() |
464 | { | 472 | { |
465 | return mExceptionDates; | 473 | return mExceptionDates; |
466 | } | 474 | } |
467 | 475 | ||
468 | ///////////////////////// ExceptionsDialog /////////////////////////// | 476 | ///////////////////////// ExceptionsDialog /////////////////////////// |
469 | 477 | ||
470 | ExceptionsDialog::ExceptionsDialog( QWidget *parent, const char *name ) : | 478 | ExceptionsDialog::ExceptionsDialog( QWidget *parent, const char *name ) : |
471 | KDialogBase( parent, name, true, i18n("Edit exceptions"), Ok|Cancel ) | 479 | KDialogBase( parent, name, true, i18n("Edit exceptions"), Ok|Cancel ) |
472 | { | 480 | { |
473 | mExceptions = new ExceptionsWidget( this ); | 481 | mExceptions = new ExceptionsWidget( this ); |
474 | setMainWidget( mExceptions ); | 482 | setMainWidget( mExceptions ); |
475 | resize(220,10); | 483 | resize(220,10); |
476 | } | 484 | } |
477 | 485 | ||
478 | void ExceptionsDialog::setDefaults( const QDateTime &from ) | 486 | void ExceptionsDialog::setDefaults( const QDateTime &from ) |
479 | { | 487 | { |
480 | mExceptions->setDefaults( from ); | 488 | mExceptions->setDefaults( from ); |
481 | } | 489 | } |
482 | 490 | ||
483 | void ExceptionsDialog::setDates( const DateList &dates ) | 491 | void ExceptionsDialog::setDates( const DateList &dates ) |
484 | { | 492 | { |
485 | mExceptions->setDates( dates ); | 493 | mExceptions->setDates( dates ); |
486 | } | 494 | } |
487 | 495 | ||
488 | DateList ExceptionsDialog::dates() | 496 | DateList ExceptionsDialog::dates() |
489 | { | 497 | { |
490 | return mExceptions->dates(); | 498 | return mExceptions->dates(); |
491 | } | 499 | } |
492 | 500 | ||
493 | ///////////////////////// RecurrenceRangeWidget /////////////////////////// | 501 | ///////////////////////// RecurrenceRangeWidget /////////////////////////// |
494 | 502 | ||
495 | RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent, | 503 | RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent, |
496 | const char *name ) | 504 | const char *name ) |
497 | : QWidget( parent, name ) | 505 | : QWidget( parent, name ) |
498 | { | 506 | { |
499 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 507 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
500 | 508 | ||
501 | mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"), | 509 | mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"), |
502 | this ); | 510 | this ); |
503 | topLayout->addWidget( mRangeGroupBox ); | 511 | topLayout->addWidget( mRangeGroupBox ); |
504 | 512 | ||
505 | QWidget *rangeBox = new QWidget( mRangeGroupBox ); | 513 | QWidget *rangeBox = new QWidget( mRangeGroupBox ); |
506 | QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox ); | 514 | QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox ); |
507 | rangeLayout->setSpacing( KDialog::spacingHint() ); | 515 | rangeLayout->setSpacing( KDialog::spacingHint() ); |
516 | rangeLayout->setMargin( KDialog::marginHintSmall() ); | ||
508 | 517 | ||
509 | mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox ); | 518 | mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox ); |
510 | rangeLayout->addWidget( mStartDateLabel ); | 519 | rangeLayout->addWidget( mStartDateLabel ); |
511 | 520 | ||
512 | QButtonGroup *rangeButtonGroup = new QButtonGroup; | 521 | QButtonGroup *rangeButtonGroup = new QButtonGroup; |
513 | 522 | ||
514 | mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox ); | 523 | mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox ); |
515 | rangeButtonGroup->insert( mNoEndDateButton ); | 524 | rangeButtonGroup->insert( mNoEndDateButton ); |
516 | rangeLayout->addWidget( mNoEndDateButton ); | 525 | rangeLayout->addWidget( mNoEndDateButton ); |
517 | 526 | ||
518 | QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout ); | 527 | QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout ); |
519 | durationLayout->setSpacing( KDialog::spacingHint() ); | 528 | durationLayout->setSpacing( KDialog::spacingHint() ); |
520 | 529 | ||
521 | mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox ); | 530 | mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox ); |
522 | rangeButtonGroup->insert( mEndDurationButton ); | 531 | rangeButtonGroup->insert( mEndDurationButton ); |
523 | durationLayout->addWidget( mEndDurationButton ); | 532 | durationLayout->addWidget( mEndDurationButton ); |
524 | 533 | ||
525 | mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox ); | 534 | mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox ); |
526 | durationLayout->addWidget( mEndDurationEdit ); | 535 | durationLayout->addWidget( mEndDurationEdit ); |
527 | 536 | ||
528 | QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox ); | 537 | QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox ); |
529 | durationLayout ->addWidget( endDurationLabel ); | 538 | durationLayout ->addWidget( endDurationLabel ); |
530 | 539 | ||
531 | QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout ); | 540 | QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout ); |
532 | endDateLayout->setSpacing( KDialog::spacingHint() ); | 541 | endDateLayout->setSpacing( KDialog::spacingHint() ); |
533 | 542 | ||
534 | mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox ); | 543 | mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox ); |
535 | rangeButtonGroup->insert( mEndDateButton ); | 544 | rangeButtonGroup->insert( mEndDateButton ); |
536 | endDateLayout->addWidget( mEndDateButton ); | 545 | endDateLayout->addWidget( mEndDateButton ); |
537 | 546 | ||
538 | mEndDateEdit = new KDateEdit( rangeBox ); | 547 | mEndDateEdit = new KDateEdit( rangeBox ); |
539 | endDateLayout->addWidget( mEndDateEdit ); | 548 | endDateLayout->addWidget( mEndDateEdit ); |
540 | 549 | ||
541 | endDateLayout->addStretch( 1 ); | 550 | //endDateLayout->addStretch( 1 ); |
542 | 551 | ||
543 | connect( mNoEndDateButton, SIGNAL( toggled( bool ) ), | 552 | connect( mNoEndDateButton, SIGNAL( toggled( bool ) ), |
544 | SLOT( showCurrentRange() ) ); | 553 | SLOT( showCurrentRange() ) ); |
545 | connect( mEndDurationButton, SIGNAL( toggled( bool ) ), | 554 | connect( mEndDurationButton, SIGNAL( toggled( bool ) ), |
546 | SLOT( showCurrentRange() ) ); | 555 | SLOT( showCurrentRange() ) ); |
547 | connect( mEndDateButton, SIGNAL( toggled( bool ) ), | 556 | connect( mEndDateButton, SIGNAL( toggled( bool ) ), |
548 | SLOT( showCurrentRange() ) ); | 557 | SLOT( showCurrentRange() ) ); |
549 | } | 558 | } |
550 | 559 | ||
551 | void RecurrenceRangeWidget::setDefaults( const QDateTime &from ) | 560 | void RecurrenceRangeWidget::setDefaults( const QDateTime &from ) |
552 | { | 561 | { |
553 | mNoEndDateButton->setChecked( true ); | 562 | mNoEndDateButton->setChecked( true ); |
554 | 563 | ||
555 | setDateTimes( from ); | 564 | setDateTimes( from ); |
556 | mEndDateEdit->setDate( from.date() ); | 565 | mEndDateEdit->setDate( from.date() ); |
557 | } | 566 | } |
558 | 567 | ||
559 | void RecurrenceRangeWidget::setDuration( int duration ) | 568 | void RecurrenceRangeWidget::setDuration( int duration ) |
560 | { | 569 | { |
561 | if ( duration == -1 ) { | 570 | if ( duration == -1 ) { |
562 | mNoEndDateButton->setChecked( true ); | 571 | mNoEndDateButton->setChecked( true ); |
563 | } else if ( duration == 0 ) { | 572 | } else if ( duration == 0 ) { |
564 | mEndDateButton->setChecked( true ); | 573 | mEndDateButton->setChecked( true ); |
565 | } else { | 574 | } else { |
566 | mEndDurationButton->setChecked( true ); | 575 | mEndDurationButton->setChecked( true ); |
567 | mEndDurationEdit->setValue( duration ); | 576 | mEndDurationEdit->setValue( duration ); |
568 | } | 577 | } |
569 | } | 578 | } |
570 | 579 | ||
571 | int RecurrenceRangeWidget::duration() | 580 | int RecurrenceRangeWidget::duration() |
572 | { | 581 | { |
573 | if ( mNoEndDateButton->isChecked() ) { | 582 | if ( mNoEndDateButton->isChecked() ) { |
574 | return -1; | 583 | return -1; |
575 | } else if ( mEndDurationButton->isChecked() ) { | 584 | } else if ( mEndDurationButton->isChecked() ) { |
576 | return mEndDurationEdit->value(); | 585 | return mEndDurationEdit->value(); |
577 | } else { | 586 | } else { |
578 | return 0; | 587 | return 0; |
579 | } | 588 | } |
580 | } | 589 | } |
581 | 590 | ||
582 | void RecurrenceRangeWidget::setEndDate( const QDate &date ) | 591 | void RecurrenceRangeWidget::setEndDate( const QDate &date ) |
583 | { | 592 | { |
584 | mEndDateEdit->setDate( date ); | 593 | mEndDateEdit->setDate( date ); |
585 | } | 594 | } |
586 | 595 | ||
587 | QDate RecurrenceRangeWidget::endDate() | 596 | QDate RecurrenceRangeWidget::endDate() |
588 | { | 597 | { |
589 | return mEndDateEdit->date(); | 598 | return mEndDateEdit->date(); |
590 | } | 599 | } |
591 | 600 | ||
592 | void RecurrenceRangeWidget::showCurrentRange() | 601 | void RecurrenceRangeWidget::showCurrentRange() |
593 | { | 602 | { |
594 | mEndDurationEdit->setEnabled( mEndDurationButton->isChecked() ); | 603 | mEndDurationEdit->setEnabled( mEndDurationButton->isChecked() ); |
595 | mEndDateEdit->setEnabled( mEndDateButton->isChecked() ); | 604 | mEndDateEdit->setEnabled( mEndDateButton->isChecked() ); |
596 | } | 605 | } |
597 | 606 | ||
598 | void RecurrenceRangeWidget::setDateTimes( const QDateTime &start, | 607 | void RecurrenceRangeWidget::setDateTimes( const QDateTime &start, |
599 | const QDateTime & ) | 608 | const QDateTime & ) |
600 | { | 609 | { |
601 | mStartDateLabel->setText( i18n("Start date: %1") | 610 | mStartDateLabel->setText( i18n("Start date: %1") |
602 | .arg( KGlobal::locale()->formatDate( start.date() ) ) ); | 611 | .arg( KGlobal::locale()->formatDate( start.date() ) ) ); |
603 | 612 | ||
604 | if(!mEndDateButton->isChecked()) | 613 | if(!mEndDateButton->isChecked()) |
605 | mEndDateEdit->setDate( start.date() ); | 614 | mEndDateEdit->setDate( start.date() ); |
606 | } | 615 | } |
607 | 616 | ||
608 | ///////////////////////// RecurrenceRangeDialog /////////////////////////// | 617 | ///////////////////////// RecurrenceRangeDialog /////////////////////////// |
609 | 618 | ||
610 | RecurrenceRangeDialog::RecurrenceRangeDialog( QWidget *parent, | 619 | RecurrenceRangeDialog::RecurrenceRangeDialog( QWidget *parent, |
611 | const char *name ) : | 620 | const char *name ) : |
612 | KDialogBase( parent, name, true, i18n("Edit Recurrence Range"), Ok|Cancel ) | 621 | KDialogBase( parent, name, true, i18n("Edit Recurrence Range"), Ok|Cancel ) |
613 | { | 622 | { |
614 | mRecurrenceRangeWidget = new RecurrenceRangeWidget( this ); | 623 | mRecurrenceRangeWidget = new RecurrenceRangeWidget( this ); |
615 | setMainWidget( mRecurrenceRangeWidget ); | 624 | setMainWidget( mRecurrenceRangeWidget ); |
616 | } | 625 | } |
617 | 626 | ||
618 | void RecurrenceRangeDialog::setDefaults( const QDateTime &from ) | 627 | void RecurrenceRangeDialog::setDefaults( const QDateTime &from ) |
619 | { | 628 | { |
620 | mRecurrenceRangeWidget->setDefaults( from ); | 629 | mRecurrenceRangeWidget->setDefaults( from ); |
621 | } | 630 | } |
622 | 631 | ||
623 | void RecurrenceRangeDialog::setDuration( int duration ) | 632 | void RecurrenceRangeDialog::setDuration( int duration ) |
624 | { | 633 | { |
625 | mRecurrenceRangeWidget->setDuration( duration ); | 634 | mRecurrenceRangeWidget->setDuration( duration ); |
626 | } | 635 | } |
627 | 636 | ||
628 | int RecurrenceRangeDialog::duration() | 637 | int RecurrenceRangeDialog::duration() |
629 | { | 638 | { |
630 | return mRecurrenceRangeWidget->duration(); | 639 | return mRecurrenceRangeWidget->duration(); |
631 | } | 640 | } |
632 | 641 | ||
633 | void RecurrenceRangeDialog::setEndDate( const QDate &date ) | 642 | void RecurrenceRangeDialog::setEndDate( const QDate &date ) |
634 | { | 643 | { |
635 | mRecurrenceRangeWidget->setEndDate( date ); | 644 | mRecurrenceRangeWidget->setEndDate( date ); |
636 | } | 645 | } |
637 | 646 | ||
638 | QDate RecurrenceRangeDialog::endDate() | 647 | QDate RecurrenceRangeDialog::endDate() |
639 | { | 648 | { |
640 | return mRecurrenceRangeWidget->endDate(); | 649 | return mRecurrenceRangeWidget->endDate(); |
641 | } | 650 | } |
642 | 651 | ||
643 | void RecurrenceRangeDialog::setDateTimes( const QDateTime &start, | 652 | void RecurrenceRangeDialog::setDateTimes( const QDateTime &start, |
644 | const QDateTime &end ) | 653 | const QDateTime &end ) |
645 | { | 654 | { |
646 | mRecurrenceRangeWidget->setDateTimes( start, end ); | 655 | mRecurrenceRangeWidget->setDateTimes( start, end ); |
647 | } | 656 | } |
648 | 657 | ||
649 | //////////////////////////// RecurrenceChooser //////////////////////// | 658 | //////////////////////////// RecurrenceChooser //////////////////////// |
650 | 659 | ||
651 | RecurrenceChooser::RecurrenceChooser( QWidget *parent, const char *name ) : | 660 | RecurrenceChooser::RecurrenceChooser( QWidget *parent, const char *name ) : |
652 | QWidget( parent, name ) | 661 | QWidget( parent, name ) |
653 | { | 662 | { |
654 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 663 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
655 | 664 | ||
656 | if ( KOPrefs::instance()->mCompactDialogs ) { | ||
657 | mTypeCombo = new QComboBox( this ); | 665 | mTypeCombo = new QComboBox( this ); |
658 | mTypeCombo->insertItem( i18n("Daily") ); | 666 | mTypeCombo->insertItem( i18n("Daily") ); |
659 | mTypeCombo->insertItem( i18n("Weekly") ); | 667 | mTypeCombo->insertItem( i18n("Weekly") ); |
660 | mTypeCombo->insertItem( i18n("Monthly") ); | 668 | mTypeCombo->insertItem( i18n("Monthly") ); |
661 | mTypeCombo->insertItem( i18n("Yearly") ); | 669 | mTypeCombo->insertItem( i18n("Yearly") ); |
662 | 670 | ||
663 | topLayout->addWidget( mTypeCombo ); | 671 | topLayout->addWidget( mTypeCombo ); |
664 | 672 | ||
665 | connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( emitChoice() ) ); | 673 | connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( emitChoice() ) ); |
666 | } else { | 674 | |
667 | mTypeCombo = 0; | ||
668 | |||
669 | QButtonGroup *ruleButtonGroup = new QButtonGroup( 1, Horizontal, this ); | ||
670 | ruleButtonGroup->setFrameStyle( QFrame::NoFrame ); | ||
671 | topLayout->addWidget( ruleButtonGroup ); | ||
672 | |||
673 | mDailyButton = new QRadioButton( i18n("Daily"), ruleButtonGroup ); | ||
674 | mWeeklyButton = new QRadioButton( i18n("Weekly"), ruleButtonGroup ); | ||
675 | mMonthlyButton = new QRadioButton( i18n("Monthly"), ruleButtonGroup ); | ||
676 | mYearlyButton = new QRadioButton( i18n("Yearly"), ruleButtonGroup ); | ||
677 | |||
678 | connect( mDailyButton, SIGNAL( toggled( bool ) ), | ||
679 | SLOT( emitChoice() ) ); | ||
680 | connect( mWeeklyButton, SIGNAL( toggled( bool ) ), | ||
681 | SLOT( emitChoice() ) ); | ||
682 | connect( mMonthlyButton, SIGNAL( toggled( bool ) ), | ||
683 | SLOT( emitChoice() ) ); | ||
684 | connect( mYearlyButton, SIGNAL( toggled( bool ) ), | ||
685 | SLOT( emitChoice() ) ); | ||
686 | } | ||
687 | } | 675 | } |
688 | 676 | ||
689 | int RecurrenceChooser::type() | 677 | int RecurrenceChooser::type() |
690 | { | 678 | { |
691 | if ( mTypeCombo ) { | 679 | if ( mTypeCombo ) { |
692 | return mTypeCombo->currentItem(); | 680 | return mTypeCombo->currentItem(); |
693 | } else { | 681 | } else { |
694 | if ( mDailyButton->isChecked() ) return Daily; | 682 | if ( mDailyButton->isChecked() ) return Daily; |
695 | else if ( mWeeklyButton->isChecked() ) return Weekly; | 683 | else if ( mWeeklyButton->isChecked() ) return Weekly; |
696 | else if ( mMonthlyButton->isChecked() ) return Monthly; | 684 | else if ( mMonthlyButton->isChecked() ) return Monthly; |
697 | else return Yearly; | 685 | else return Yearly; |
698 | } | 686 | } |
699 | } | 687 | } |
700 | 688 | ||
701 | void RecurrenceChooser::setType( int type ) | 689 | void RecurrenceChooser::setType( int type ) |
702 | { | 690 | { |
703 | if ( mTypeCombo ) { | 691 | if ( mTypeCombo ) { |
704 | mTypeCombo->setCurrentItem( type ); | 692 | mTypeCombo->setCurrentItem( type ); |
705 | } else { | 693 | } else { |
706 | switch ( type ) { | 694 | switch ( type ) { |
707 | case Daily: | 695 | case Daily: |
708 | mDailyButton->setChecked( true ); | 696 | mDailyButton->setChecked( true ); |
709 | break; | 697 | break; |
710 | case Weekly: | 698 | case Weekly: |
711 | mWeeklyButton->setChecked( true ); | 699 | mWeeklyButton->setChecked( true ); |
712 | break; | 700 | break; |
713 | case Monthly: | 701 | case Monthly: |
714 | mMonthlyButton->setChecked( true ); | 702 | mMonthlyButton->setChecked( true ); |
715 | break; | 703 | break; |
716 | case Yearly: | 704 | case Yearly: |
717 | default: | 705 | default: |
718 | mYearlyButton->setChecked( true ); | 706 | mYearlyButton->setChecked( true ); |
719 | break; | 707 | break; |
720 | } | 708 | } |
721 | } | 709 | } |
722 | } | 710 | } |
723 | 711 | ||
724 | void RecurrenceChooser::emitChoice() | 712 | void RecurrenceChooser::emitChoice() |
725 | { | 713 | { |
726 | emit chosen ( type() ); | 714 | emit chosen ( type() ); |
727 | } | 715 | } |
728 | 716 | ||
729 | /////////////////////////////// Main Widget ///////////////////////////// | 717 | /////////////////////////////// Main Widget ///////////////////////////// |
730 | 718 | ||
731 | KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) : | 719 | KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) : |
732 | QWidget( parent, name ) | 720 | QWidget( parent, name ) |
733 | { | 721 | { |
734 | QGridLayout *topLayout = new QGridLayout( this, 2,2 ); | 722 | QGridLayout *topLayout = new QGridLayout( this, 2,2 ); |
735 | topLayout->setSpacing( KDialog::spacingHint() ); | 723 | topLayout->setSpacing( KDialog::spacingHint() ); |
724 | topLayout->setMargin( KDialog::marginHintSmall() ); | ||
736 | 725 | ||
737 | mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this ); | 726 | mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this ); |
738 | connect( mEnabledCheck, SIGNAL( toggled( bool ) ), | 727 | connect( mEnabledCheck, SIGNAL( toggled( bool ) ), |
739 | SLOT( setEnabled( bool ) ) ); | 728 | SLOT( setEnabled( bool ) ) ); |
740 | topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 ); | 729 | topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 ); |
741 | 730 | ||
742 | 731 | ||
743 | mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Appointment Time "), | 732 | mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Appointment Time "), |
744 | this ); | 733 | this ); |
745 | topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 ); | 734 | topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 ); |
746 | 735 | ||
747 | if ( KOPrefs::instance()->mCompactDialogs ) { | 736 | if ( QApplication::desktop()->width() <= 320) { |
748 | mTimeGroupBox->hide(); | 737 | mTimeGroupBox->hide(); |
749 | } | 738 | } |
750 | 739 | ||
751 | // QFrame *timeFrame = new QFrame( mTimeGroupBox ); | 740 | // QFrame *timeFrame = new QFrame( mTimeGroupBox ); |
752 | // QBoxLayout *layoutTimeFrame = new QHBoxLayout( timeFrame ); | 741 | // QBoxLayout *layoutTimeFrame = new QHBoxLayout( timeFrame ); |
753 | // layoutTimeFrame->setSpacing( KDialog::spacingHint() ); | 742 | // layoutTimeFrame->setSpacing( KDialog::spacingHint() ); |
754 | 743 | ||
755 | mDateTimeLabel = new QLabel( mTimeGroupBox ); | 744 | mDateTimeLabel = new QLabel( mTimeGroupBox ); |
756 | // mDateTimeLabel = new QLabel( timeFrame ); | 745 | // mDateTimeLabel = new QLabel( timeFrame ); |
757 | // layoutTimeFrame->addWidget( mDateTimeLabel ); | 746 | // layoutTimeFrame->addWidget( mDateTimeLabel ); |
758 | 747 | ||
759 | Qt::Orientation orientation; | ||
760 | if ( KOPrefs::instance()->mCompactDialogs ) orientation = Horizontal; | ||
761 | else orientation = Vertical; | ||
762 | |||
763 | mRuleBox = new QGroupBox( 1, orientation, i18n("Recurrence Rule"), this ); | ||
764 | if ( KOPrefs::instance()->mCompactDialogs ) { | ||
765 | topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 ); | ||
766 | } else { | ||
767 | topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 ); | ||
768 | } | ||
769 | 748 | ||
749 | mRuleBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Rule"), this ); | ||
750 | topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 ); | ||
770 | mRecurrenceChooser = new RecurrenceChooser( mRuleBox ); | 751 | mRecurrenceChooser = new RecurrenceChooser( mRuleBox ); |
771 | connect( mRecurrenceChooser, SIGNAL( chosen( int ) ), | 752 | connect( mRecurrenceChooser, SIGNAL( chosen( int ) ), |
772 | SLOT( showCurrentRule( int ) ) ); | 753 | SLOT( showCurrentRule( int ) ) ); |
773 | 754 | ||
774 | if ( !KOPrefs::instance()->mCompactDialogs ) { | ||
775 | QFrame *ruleSepFrame = new QFrame( mRuleBox ); | ||
776 | ruleSepFrame->setFrameStyle( QFrame::VLine | QFrame::Sunken ); | ||
777 | } | ||
778 | 755 | ||
779 | mRuleStack = new QWidgetStack( mRuleBox ); | 756 | mRuleStack = new QWidgetStack( mRuleBox ); |
780 | 757 | ||
781 | mDaily = new RecurDaily( mRuleStack ); | 758 | mDaily = new RecurDaily( mRuleStack ); |
782 | mRuleStack->addWidget( mDaily, 0 ); | 759 | mRuleStack->addWidget( mDaily, 0 ); |
783 | 760 | ||
784 | mWeekly = new RecurWeekly( mRuleStack ); | 761 | mWeekly = new RecurWeekly( mRuleStack ); |
785 | mRuleStack->addWidget( mWeekly, 0 ); | 762 | mRuleStack->addWidget( mWeekly, 0 ); |
786 | 763 | ||
787 | mMonthly = new RecurMonthly( mRuleStack ); | 764 | mMonthly = new RecurMonthly( mRuleStack ); |
788 | mRuleStack->addWidget( mMonthly, 0 ); | 765 | mRuleStack->addWidget( mMonthly, 0 ); |
789 | 766 | ||
790 | mYearly = new RecurYearly( mRuleStack ); | 767 | mYearly = new RecurYearly( mRuleStack ); |
791 | mRuleStack->addWidget( mYearly, 0 ); | 768 | mRuleStack->addWidget( mYearly, 0 ); |
792 | 769 | ||
793 | showCurrentRule( mRecurrenceChooser->type() ); | 770 | showCurrentRule( mRecurrenceChooser->type() ); |
794 | |||
795 | if ( KOPrefs::instance()->mCompactDialogs ) { | ||
796 | mRecurrenceRangeWidget = 0; | 771 | mRecurrenceRangeWidget = 0; |
797 | mRecurrenceRangeDialog = new RecurrenceRangeDialog( this ); | 772 | mRecurrenceRangeDialog = new RecurrenceRangeDialog( this ); |
798 | mRecurrenceRange = mRecurrenceRangeDialog; | 773 | mRecurrenceRange = mRecurrenceRangeDialog; |
799 | mRecurrenceRangeButton = new QPushButton( i18n("Recurrence Range..."), | 774 | mRecurrenceRangeButton = new QPushButton( i18n("Recurrence Range..."), |
800 | this ); | 775 | this ); |
801 | 776 | ||
802 | connect( mRecurrenceRangeButton, SIGNAL( clicked() ), | 777 | connect( mRecurrenceRangeButton, SIGNAL( clicked() ), |
803 | SLOT( showRecurrenceRangeDialog() ) ); | 778 | SLOT( showRecurrenceRangeDialog() ) ); |
804 | 779 | ||
805 | mExceptionsWidget = 0; | 780 | mExceptionsWidget = 0; |
806 | mExceptionsDialog = new ExceptionsDialog( this ); | 781 | mExceptionsDialog = new ExceptionsDialog( this ); |
807 | mExceptions = mExceptionsDialog; | 782 | mExceptions = mExceptionsDialog; |
808 | mExceptionsButton = new QPushButton( i18n("Exceptions..."), this ); | 783 | mExceptionsButton = new QPushButton( i18n("Exceptions..."), this ); |
809 | if ( QApplication::desktop()->width() < 320 ) { | 784 | if ( QApplication::desktop()->width() < 320 ) { |
810 | topLayout->addMultiCellWidget( mRecurrenceRangeButton, 3, 3, 0, 1 ); | 785 | topLayout->addMultiCellWidget( mRecurrenceRangeButton, 3, 3, 0, 1 ); |
811 | topLayout->addMultiCellWidget( mExceptionsButton, 4, 4, 0, 1 ); | 786 | topLayout->addMultiCellWidget( mExceptionsButton, 4, 4, 0, 1 ); |
812 | } else { | 787 | } else { |
813 | topLayout->addWidget( mRecurrenceRangeButton, 3, 0 ); | 788 | topLayout->addWidget( mRecurrenceRangeButton, 3, 0 ); |
814 | topLayout->addWidget( mExceptionsButton, 3, 1 ); | 789 | topLayout->addWidget( mExceptionsButton, 3, 1 ); |
815 | } | 790 | } |
816 | connect( mExceptionsButton, SIGNAL( clicked() ), | 791 | connect( mExceptionsButton, SIGNAL( clicked() ), |
817 | SLOT( showExceptionsDialog() ) ); | 792 | SLOT( showExceptionsDialog() ) ); |
818 | |||
819 | } else { | ||
820 | mRecurrenceRangeWidget = new RecurrenceRangeWidget( this ); | ||
821 | mRecurrenceRangeDialog = 0; | ||
822 | mRecurrenceRange = mRecurrenceRangeWidget; | ||
823 | mRecurrenceRangeButton = 0; | ||
824 | topLayout->addWidget( mRecurrenceRangeWidget, 3, 0 ); | ||
825 | |||
826 | mExceptionsWidget = new ExceptionsWidget( this ); | ||
827 | mExceptionsDialog = 0; | ||
828 | mExceptions = mExceptionsWidget; | ||
829 | mExceptionsButton = 0; | ||
830 | topLayout->addWidget( mExceptionsWidget, 3, 1 ); | ||
831 | } | ||
832 | } | 793 | } |
833 | 794 | ||
834 | KOEditorRecurrence::~KOEditorRecurrence() | 795 | KOEditorRecurrence::~KOEditorRecurrence() |
835 | { | 796 | { |
836 | } | 797 | } |
837 | 798 | ||
838 | void KOEditorRecurrence::setEnabled( bool enabled ) | 799 | void KOEditorRecurrence::setEnabled( bool enabled ) |
839 | { | 800 | { |
840 | // kdDebug() << "KOEditorRecurrence::setEnabled(): " << (enabled ? "on" : "off") << endl; | 801 | // kdDebug() << "KOEditorRecurrence::setEnabled(): " << (enabled ? "on" : "off") << endl; |
841 | 802 | ||
842 | mTimeGroupBox->setEnabled( enabled ); | 803 | mTimeGroupBox->setEnabled( enabled ); |
843 | if ( mRecurrenceRangeWidget ) mRecurrenceRangeWidget->setEnabled( enabled ); | 804 | if ( mRecurrenceRangeWidget ) mRecurrenceRangeWidget->setEnabled( enabled ); |
844 | if ( mRecurrenceRangeButton ) mRecurrenceRangeButton->setEnabled( enabled ); | 805 | if ( mRecurrenceRangeButton ) mRecurrenceRangeButton->setEnabled( enabled ); |
845 | if ( mExceptionsWidget ) mExceptionsWidget->setEnabled( enabled ); | 806 | if ( mExceptionsWidget ) mExceptionsWidget->setEnabled( enabled ); |
846 | if ( mExceptionsButton ) mExceptionsButton->setEnabled( enabled ); | 807 | if ( mExceptionsButton ) mExceptionsButton->setEnabled( enabled ); |
847 | mRuleBox->setEnabled( enabled ); | 808 | mRuleBox->setEnabled( enabled ); |
848 | } | 809 | } |
849 | 810 | ||
850 | void KOEditorRecurrence::showCurrentRule( int current ) | 811 | void KOEditorRecurrence::showCurrentRule( int current ) |
851 | { | 812 | { |
852 | switch ( current ) { | 813 | switch ( current ) { |
853 | case Daily: | 814 | case Daily: |
854 | mRuleStack->raiseWidget( mDaily ); | 815 | mRuleStack->raiseWidget( mDaily ); |
855 | break; | 816 | break; |
856 | case Weekly: | 817 | case Weekly: |
857 | mRuleStack->raiseWidget( mWeekly ); | 818 | mRuleStack->raiseWidget( mWeekly ); |
858 | break; | 819 | break; |
859 | case Monthly: | 820 | case Monthly: |
860 | mRuleStack->raiseWidget( mMonthly ); | 821 | mRuleStack->raiseWidget( mMonthly ); |
861 | break; | 822 | break; |
862 | default: | 823 | default: |
863 | case Yearly: | 824 | case Yearly: |
864 | mRuleStack->raiseWidget( mYearly ); | 825 | mRuleStack->raiseWidget( mYearly ); |
865 | break; | 826 | break; |
866 | } | 827 | } |
867 | } | 828 | } |
868 | 829 | ||
869 | void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end ) | 830 | void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end ) |
870 | { | 831 | { |
871 | // kdDebug() << "KOEditorRecurrence::setDateTimes" << endl; | 832 | // kdDebug() << "KOEditorRecurrence::setDateTimes" << endl; |
872 | 833 | ||
873 | mRecurrenceRange->setDateTimes( start, end ); | 834 | mRecurrenceRange->setDateTimes( start, end ); |
874 | mExceptions->setDefaults( end ); | 835 | mExceptions->setDefaults( end ); |
875 | 836 | ||
876 | } | 837 | } |
877 | 838 | ||
878 | void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) | 839 | void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) |
879 | { | 840 | { |
880 | 841 | ||
881 | // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() ); | 842 | // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() ); |
882 | setDateTimes( from, to ); | 843 | setDateTimes( from, to ); |
883 | 844 | ||
884 | bool enabled = false; | 845 | bool enabled = false; |
885 | mEnabledCheck->setChecked( enabled ); | 846 | mEnabledCheck->setChecked( enabled ); |
886 | setEnabled( enabled ); | 847 | setEnabled( enabled ); |
887 | 848 | ||
888 | mExceptions->setDefaults( to ); | 849 | mExceptions->setDefaults( to ); |
889 | mRecurrenceRange->setDefaults( to ); | 850 | mRecurrenceRange->setDefaults( to ); |
890 | 851 | ||
891 | mRecurrenceChooser->setType( RecurrenceChooser::Weekly ); | 852 | mRecurrenceChooser->setType( RecurrenceChooser::Weekly ); |
892 | showCurrentRule( mRecurrenceChooser->type() ); | 853 | showCurrentRule( mRecurrenceChooser->type() ); |
893 | 854 | ||
894 | mDaily->setFrequency( 1 ); | 855 | mDaily->setFrequency( 1 ); |
895 | 856 | ||
896 | mWeekly->setFrequency( 1 ); | 857 | mWeekly->setFrequency( 1 ); |
897 | QBitArray days( 7 ); | 858 | QBitArray days( 7 ); |
898 | days.fill( 0 ); | 859 | days.fill( 0 ); |
899 | days.setBit( from.date().dayOfWeek()- 1); | 860 | days.setBit( from.date().dayOfWeek()- 1); |
900 | mWeekly->setDays( days ); | 861 | mWeekly->setDays( days ); |
901 | mMonthly->setFrequency( 1 ); | 862 | mMonthly->setFrequency( 1 ); |
902 | mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); | 863 | mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); |
903 | mMonthly->setByDay( from.date().day()-1 ); | 864 | mMonthly->setByDay( from.date().day()-1 ); |
904 | mYearly->setFrequency( 1 ); | 865 | mYearly->setFrequency( 1 ); |
905 | mYearly->setByDay( from.date().dayOfYear() ); | 866 | mYearly->setByDay( from.date().dayOfYear() ); |
906 | mYearly->setByMonth( from.date().month(), from.date().day() ); | 867 | mYearly->setByMonth( from.date().month(), from.date().day() ); |
907 | } | 868 | } |
908 | 869 | ||
909 | void KOEditorRecurrence::readEvent(Incidence *event) | 870 | void KOEditorRecurrence::readEvent(Incidence *event) |
910 | { | 871 | { |
911 | 872 | ||
912 | QDateTime dtEnd; | 873 | QDateTime dtEnd; |
913 | if ( event->type() == "Event" ) | 874 | if ( event->type() == "Event" ) |
914 | dtEnd = ((Event*)event)->dtEnd(); | 875 | dtEnd = ((Event*)event)->dtEnd(); |
915 | else | 876 | else |
916 | dtEnd = ((Todo*)event)->dtDue(); | 877 | dtEnd = ((Todo*)event)->dtDue(); |
917 | 878 | ||
918 | setDefaults( event->dtStart(), dtEnd, true ); | 879 | setDefaults( event->dtStart(), dtEnd, true ); |
919 | QBitArray rDays( 7 ); | 880 | QBitArray rDays( 7 ); |
920 | QPtrList<Recurrence::rMonthPos> rmp; | 881 | QPtrList<Recurrence::rMonthPos> rmp; |
921 | QPtrList<int> rmd; | 882 | QPtrList<int> rmd; |
922 | int day = 0; | 883 | int day = 0; |
923 | int count = 0; | 884 | int count = 0; |
924 | int month = 0; | 885 | int month = 0; |
925 | setDateTimes( event->dtStart(), dtEnd ); | 886 | setDateTimes( event->dtStart(), dtEnd ); |
926 | 887 | ||
927 | Recurrence *r = event->recurrence(); | 888 | Recurrence *r = event->recurrence(); |
diff --git a/microkde/kdialog.cpp b/microkde/kdialog.cpp index 3d62cdd..961631e 100644 --- a/microkde/kdialog.cpp +++ b/microkde/kdialog.cpp | |||
@@ -1,17 +1,25 @@ | |||
1 | 1 | ||
2 | #include <kdialog.h> | 2 | #include <kdialog.h> |
3 | #include <qapp.h> | 3 | #include <qapp.h> |
4 | 4 | ||
5 | 5 | ||
6 | KDialog::KDialog( QWidget *parent, const char *name, bool modal ) : | 6 | KDialog::KDialog( QWidget *parent, const char *name, bool modal ) : |
7 | QDialog( parent, name, modal ) | 7 | QDialog( parent, name, modal ) |
8 | { | 8 | { |
9 | ; | 9 | ; |
10 | 10 | ||
11 | } | 11 | } |
12 | #ifdef DESKTOP_VERSION | ||
13 | int KDialog::spacingHint() { return 7; } | ||
14 | int KDialog::marginHint() { return 7; } | ||
12 | 15 | ||
16 | int KDialog::spacingHintSmall() { return 4; } | ||
17 | int KDialog::marginHintSmall() { return 4; } | ||
18 | |||
19 | #else | ||
13 | int KDialog::spacingHint() { return 3; } | 20 | int KDialog::spacingHint() { return 3; } |
14 | int KDialog::marginHint() { return 3; } | 21 | int KDialog::marginHint() { return 3; } |
15 | 22 | ||
16 | int KDialog::spacingHintSmall() { if (QApplication::desktop()->width() < 700 ) return 1;else return 3; } | 23 | int KDialog::spacingHintSmall() { return 1; } |
17 | int KDialog::marginHintSmall() { if (QApplication::desktop()->width() < 700 ) return 1;else return 3; } | 24 | int KDialog::marginHintSmall() { return 1; } |
25 | #endif | ||