Diffstat (limited to 'korganizer/koeditorrecurrence.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeditorrecurrence.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index d82172f..98356fe 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp | |||
@@ -1,243 +1,242 @@ | |||
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 | 45 | ||
46 | #include <libkdepim/kdateedit.h> | 46 | #include <libkdepim/kdateedit.h> |
47 | 47 | ||
48 | #include "koprefs.h" | 48 | #include "koprefs.h" |
49 | 49 | ||
50 | #include "koeditorrecurrence.h" | 50 | #include "koeditorrecurrence.h" |
51 | #include "koeditorrecurrence.moc" | ||
52 | 51 | ||
53 | /////////////////////////// RecurBase /////////////////////////////// | 52 | /////////////////////////// RecurBase /////////////////////////////// |
54 | 53 | ||
55 | RecurBase::RecurBase( QWidget *parent, const char *name ) : | 54 | RecurBase::RecurBase( QWidget *parent, const char *name ) : |
56 | QWidget( parent, name ) | 55 | QWidget( parent, name ) |
57 | { | 56 | { |
58 | mFrequencyEdit = new QSpinBox( 1, 9999, 1, this ); | 57 | mFrequencyEdit = new QSpinBox( 1, 9999, 1, this ); |
59 | mFrequencyEdit->setValue( 1 ); | 58 | mFrequencyEdit->setValue( 1 ); |
60 | } | 59 | } |
61 | 60 | ||
62 | QWidget *RecurBase::frequencyEdit() | 61 | QWidget *RecurBase::frequencyEdit() |
63 | { | 62 | { |
64 | return mFrequencyEdit; | 63 | return mFrequencyEdit; |
65 | } | 64 | } |
66 | 65 | ||
67 | void RecurBase::setFrequency( int f ) | 66 | void RecurBase::setFrequency( int f ) |
68 | { | 67 | { |
69 | if ( f < 1 ) f = 1; | 68 | if ( f < 1 ) f = 1; |
70 | 69 | ||
71 | mFrequencyEdit->setValue( f ); | 70 | mFrequencyEdit->setValue( f ); |
72 | } | 71 | } |
73 | 72 | ||
74 | int RecurBase::frequency() | 73 | int RecurBase::frequency() |
75 | { | 74 | { |
76 | return mFrequencyEdit->value(); | 75 | return mFrequencyEdit->value(); |
77 | } | 76 | } |
78 | 77 | ||
79 | /////////////////////////// RecurDaily /////////////////////////////// | 78 | /////////////////////////// RecurDaily /////////////////////////////// |
80 | 79 | ||
81 | RecurDaily::RecurDaily( QWidget *parent, const char *name ) : | 80 | RecurDaily::RecurDaily( QWidget *parent, const char *name ) : |
82 | RecurBase( parent, name ) | 81 | RecurBase( parent, name ) |
83 | { | 82 | { |
84 | QBoxLayout *topLayout = new QHBoxLayout( this ); | 83 | QBoxLayout *topLayout = new QHBoxLayout( this ); |
85 | topLayout->setSpacing( KDialog::spacingHint() ); | 84 | topLayout->setSpacing( KDialog::spacingHint() ); |
86 | 85 | ||
87 | QLabel *preLabel = new QLabel( i18n("Recur every"), this ); | 86 | QLabel *preLabel = new QLabel( i18n("Recur every"), this ); |
88 | topLayout->addWidget( preLabel ); | 87 | topLayout->addWidget( preLabel ); |
89 | 88 | ||
90 | topLayout->addWidget( frequencyEdit() ); | 89 | topLayout->addWidget( frequencyEdit() ); |
91 | 90 | ||
92 | QLabel *postLabel = new QLabel( i18n("day(s)"), this ); | 91 | QLabel *postLabel = new QLabel( i18n("day(s)"), this ); |
93 | topLayout->addWidget( postLabel ); | 92 | topLayout->addWidget( postLabel ); |
94 | } | 93 | } |
95 | 94 | ||
96 | 95 | ||
97 | /////////////////////////// RecurWeekly /////////////////////////////// | 96 | /////////////////////////// RecurWeekly /////////////////////////////// |
98 | 97 | ||
99 | RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) : | 98 | RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) : |
100 | RecurBase( parent, name ) | 99 | RecurBase( parent, name ) |
101 | { | 100 | { |
102 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 101 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
103 | topLayout->setSpacing( KDialog::spacingHint() ); | 102 | topLayout->setSpacing( KDialog::spacingHint() ); |
104 | 103 | ||
105 | topLayout->addStretch( 1 ); | 104 | topLayout->addStretch( 1 ); |
106 | 105 | ||
107 | QBoxLayout *weeksLayout = new QHBoxLayout( topLayout ); | 106 | QBoxLayout *weeksLayout = new QHBoxLayout( topLayout ); |
108 | 107 | ||
109 | QLabel *preLabel = new QLabel( i18n("Recur every"), this ); | 108 | QLabel *preLabel = new QLabel( i18n("Recur every"), this ); |
110 | weeksLayout->addWidget( preLabel ); | 109 | weeksLayout->addWidget( preLabel ); |
111 | 110 | ||
112 | weeksLayout->addWidget( frequencyEdit() ); | 111 | weeksLayout->addWidget( frequencyEdit() ); |
113 | 112 | ||
114 | QLabel *postLabel = new QLabel( i18n("week(s) on:"), this ); | 113 | QLabel *postLabel = new QLabel( i18n("week(s) on:"), this ); |
115 | weeksLayout->addWidget( postLabel ); | 114 | weeksLayout->addWidget( postLabel ); |
116 | 115 | ||
117 | QHBox *dayBox = new QHBox( this ); | 116 | QHBox *dayBox = new QHBox( this ); |
118 | topLayout->addWidget( dayBox, 1, AlignVCenter ); | 117 | topLayout->addWidget( dayBox, 1, AlignVCenter ); |
119 | // TODO: Respect start of week setting | 118 | // TODO: Respect start of week setting |
120 | for ( int i = 0; i < 7; ++i ) { | 119 | for ( int i = 0; i < 7; ++i ) { |
121 | QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true ); | 120 | QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true ); |
122 | if ( KOPrefs::instance()->mCompactDialogs ) { | 121 | if ( KOPrefs::instance()->mCompactDialogs ) { |
123 | weekDayName = weekDayName.left( 1 ); | 122 | weekDayName = weekDayName.left( 1 ); |
124 | } | 123 | } |
125 | mDayBoxes[ i ] = new QCheckBox( weekDayName, dayBox ); | 124 | mDayBoxes[ i ] = new QCheckBox( weekDayName, dayBox ); |
126 | } | 125 | } |
127 | 126 | ||
128 | topLayout->addStretch( 1 ); | 127 | topLayout->addStretch( 1 ); |
129 | } | 128 | } |
130 | 129 | ||
131 | void RecurWeekly::setDays( const QBitArray &days ) | 130 | void RecurWeekly::setDays( const QBitArray &days ) |
132 | { | 131 | { |
133 | for ( int i = 0; i < 7; ++i ) { | 132 | for ( int i = 0; i < 7; ++i ) { |
134 | mDayBoxes[ i ]->setChecked( days.testBit( i ) ); | 133 | mDayBoxes[ i ]->setChecked( days.testBit( i ) ); |
135 | } | 134 | } |
136 | } | 135 | } |
137 | 136 | ||
138 | QBitArray RecurWeekly::days() | 137 | QBitArray RecurWeekly::days() |
139 | { | 138 | { |
140 | QBitArray days( 7 ); | 139 | QBitArray days( 7 ); |
141 | 140 | ||
142 | for ( int i = 0; i < 7; ++i ) { | 141 | for ( int i = 0; i < 7; ++i ) { |
143 | days.setBit( i, mDayBoxes[ i ]->isChecked() ); | 142 | days.setBit( i, mDayBoxes[ i ]->isChecked() ); |
144 | } | 143 | } |
145 | 144 | ||
146 | return days; | 145 | return days; |
147 | } | 146 | } |
148 | 147 | ||
149 | /////////////////////////// RecurMonthly /////////////////////////////// | 148 | /////////////////////////// RecurMonthly /////////////////////////////// |
150 | 149 | ||
151 | RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) : | 150 | RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) : |
152 | RecurBase( parent, name ) | 151 | RecurBase( parent, name ) |
153 | { | 152 | { |
154 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 153 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
155 | topLayout->setSpacing( KDialog::spacingHint() ); | 154 | topLayout->setSpacing( KDialog::spacingHint() ); |
156 | 155 | ||
157 | 156 | ||
158 | QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); | 157 | QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); |
159 | 158 | ||
160 | QLabel *preLabel = new QLabel( i18n("every"), this ); | 159 | QLabel *preLabel = new QLabel( i18n("every"), this ); |
161 | freqLayout->addWidget( preLabel ); | 160 | freqLayout->addWidget( preLabel ); |
162 | 161 | ||
163 | freqLayout->addWidget( frequencyEdit() ); | 162 | freqLayout->addWidget( frequencyEdit() ); |
164 | 163 | ||
165 | QLabel *postLabel = new QLabel( i18n("month(s)"), this ); | 164 | QLabel *postLabel = new QLabel( i18n("month(s)"), this ); |
166 | freqLayout->addWidget( postLabel ); | 165 | freqLayout->addWidget( postLabel ); |
167 | 166 | ||
168 | 167 | ||
169 | QButtonGroup *buttonGroup = new QButtonGroup( this ); | 168 | QButtonGroup *buttonGroup = new QButtonGroup( this ); |
170 | buttonGroup->setFrameStyle( QFrame::NoFrame ); | 169 | buttonGroup->setFrameStyle( QFrame::NoFrame ); |
171 | topLayout->addWidget( buttonGroup, 1, AlignVCenter ); | 170 | topLayout->addWidget( buttonGroup, 1, AlignVCenter ); |
172 | 171 | ||
173 | QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 ); | 172 | QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 ); |
174 | buttonLayout->setSpacing( KDialog::spacingHint() ); | 173 | buttonLayout->setSpacing( KDialog::spacingHint() ); |
175 | 174 | ||
176 | 175 | ||
177 | QString recurOnText; | 176 | QString recurOnText; |
178 | if ( !KOPrefs::instance()->mCompactDialogs ) { | 177 | if ( !KOPrefs::instance()->mCompactDialogs ) { |
179 | recurOnText = i18n("Recur on the"); | 178 | recurOnText = i18n("Recur on the"); |
180 | } | 179 | } |
181 | 180 | ||
182 | mByDayRadio = new QRadioButton( recurOnText, buttonGroup ); | 181 | mByDayRadio = new QRadioButton( recurOnText, buttonGroup ); |
183 | buttonLayout->addWidget( mByDayRadio, 0, 0 ); | 182 | buttonLayout->addWidget( mByDayRadio, 0, 0 ); |
184 | 183 | ||
185 | mByDayCombo = new QComboBox( buttonGroup ); | 184 | mByDayCombo = new QComboBox( buttonGroup ); |
186 | mByDayCombo->setSizeLimit( 7 ); | 185 | mByDayCombo->setSizeLimit( 7 ); |
187 | mByDayCombo->insertItem( i18n("1st") ); | 186 | mByDayCombo->insertItem( i18n("1st") ); |
188 | mByDayCombo->insertItem( i18n("2nd") ); | 187 | mByDayCombo->insertItem( i18n("2nd") ); |
189 | mByDayCombo->insertItem( i18n("3rd") ); | 188 | mByDayCombo->insertItem( i18n("3rd") ); |
190 | mByDayCombo->insertItem( i18n("4th") ); | 189 | mByDayCombo->insertItem( i18n("4th") ); |
191 | mByDayCombo->insertItem( i18n("5th") ); | 190 | mByDayCombo->insertItem( i18n("5th") ); |
192 | mByDayCombo->insertItem( i18n("6th") ); | 191 | mByDayCombo->insertItem( i18n("6th") ); |
193 | mByDayCombo->insertItem( i18n("7th") ); | 192 | mByDayCombo->insertItem( i18n("7th") ); |
194 | mByDayCombo->insertItem( i18n("8th") ); | 193 | mByDayCombo->insertItem( i18n("8th") ); |
195 | mByDayCombo->insertItem( i18n("9th") ); | 194 | mByDayCombo->insertItem( i18n("9th") ); |
196 | mByDayCombo->insertItem( i18n("10th") ); | 195 | mByDayCombo->insertItem( i18n("10th") ); |
197 | mByDayCombo->insertItem( i18n("11th") ); | 196 | mByDayCombo->insertItem( i18n("11th") ); |
198 | mByDayCombo->insertItem( i18n("12th") ); | 197 | mByDayCombo->insertItem( i18n("12th") ); |
199 | mByDayCombo->insertItem( i18n("13th") ); | 198 | mByDayCombo->insertItem( i18n("13th") ); |
200 | mByDayCombo->insertItem( i18n("14th") ); | 199 | mByDayCombo->insertItem( i18n("14th") ); |
201 | mByDayCombo->insertItem( i18n("15th") ); | 200 | mByDayCombo->insertItem( i18n("15th") ); |
202 | mByDayCombo->insertItem( i18n("16th") ); | 201 | mByDayCombo->insertItem( i18n("16th") ); |
203 | mByDayCombo->insertItem( i18n("17th") ); | 202 | mByDayCombo->insertItem( i18n("17th") ); |
204 | mByDayCombo->insertItem( i18n("18th") ); | 203 | mByDayCombo->insertItem( i18n("18th") ); |
205 | mByDayCombo->insertItem( i18n("19th") ); | 204 | mByDayCombo->insertItem( i18n("19th") ); |
206 | mByDayCombo->insertItem( i18n("20th") ); | 205 | mByDayCombo->insertItem( i18n("20th") ); |
207 | mByDayCombo->insertItem( i18n("21st") ); | 206 | mByDayCombo->insertItem( i18n("21st") ); |
208 | mByDayCombo->insertItem( i18n("22nd") ); | 207 | mByDayCombo->insertItem( i18n("22nd") ); |
209 | mByDayCombo->insertItem( i18n("23rd") ); | 208 | mByDayCombo->insertItem( i18n("23rd") ); |
210 | mByDayCombo->insertItem( i18n("24th") ); | 209 | mByDayCombo->insertItem( i18n("24th") ); |
211 | mByDayCombo->insertItem( i18n("25th") ); | 210 | mByDayCombo->insertItem( i18n("25th") ); |
212 | mByDayCombo->insertItem( i18n("26th") ); | 211 | mByDayCombo->insertItem( i18n("26th") ); |
213 | mByDayCombo->insertItem( i18n("27th") ); | 212 | mByDayCombo->insertItem( i18n("27th") ); |
214 | mByDayCombo->insertItem( i18n("28th") ); | 213 | mByDayCombo->insertItem( i18n("28th") ); |
215 | mByDayCombo->insertItem( i18n("29th") ); | 214 | mByDayCombo->insertItem( i18n("29th") ); |
216 | mByDayCombo->insertItem( i18n("30th") ); | 215 | mByDayCombo->insertItem( i18n("30th") ); |
217 | mByDayCombo->insertItem( i18n("31st") ); | 216 | mByDayCombo->insertItem( i18n("31st") ); |
218 | buttonLayout->addWidget( mByDayCombo, 0, 1 ); | 217 | buttonLayout->addWidget( mByDayCombo, 0, 1 ); |
219 | 218 | ||
220 | QLabel *byDayLabel = new QLabel( i18n("day"), buttonGroup ); | 219 | QLabel *byDayLabel = new QLabel( i18n("day"), buttonGroup ); |
221 | buttonLayout->addWidget( byDayLabel, 0, 2 ); | 220 | buttonLayout->addWidget( byDayLabel, 0, 2 ); |
222 | 221 | ||
223 | 222 | ||
224 | mByPosRadio = new QRadioButton( recurOnText, buttonGroup); | 223 | mByPosRadio = new QRadioButton( recurOnText, buttonGroup); |
225 | buttonLayout->addWidget( mByPosRadio, 1, 0 ); | 224 | buttonLayout->addWidget( mByPosRadio, 1, 0 ); |
226 | 225 | ||
227 | mByPosCountCombo = new QComboBox( buttonGroup ); | 226 | mByPosCountCombo = new QComboBox( buttonGroup ); |
228 | mByPosCountCombo->insertItem( i18n("1st") ); | 227 | mByPosCountCombo->insertItem( i18n("1st") ); |
229 | mByPosCountCombo->insertItem( i18n("2nd") ); | 228 | mByPosCountCombo->insertItem( i18n("2nd") ); |
230 | mByPosCountCombo->insertItem( i18n("3rd") ); | 229 | mByPosCountCombo->insertItem( i18n("3rd") ); |
231 | mByPosCountCombo->insertItem( i18n("4th") ); | 230 | mByPosCountCombo->insertItem( i18n("4th") ); |
232 | mByPosCountCombo->insertItem( i18n("5th") ); | 231 | mByPosCountCombo->insertItem( i18n("5th") ); |
233 | buttonLayout->addWidget( mByPosCountCombo, 1, 1 ); | 232 | buttonLayout->addWidget( mByPosCountCombo, 1, 1 ); |
234 | 233 | ||
235 | mByPosWeekdayCombo = new QComboBox( buttonGroup ); | 234 | mByPosWeekdayCombo = new QComboBox( buttonGroup ); |
236 | mByPosWeekdayCombo->insertItem( i18n("Monday") ); | 235 | mByPosWeekdayCombo->insertItem( i18n("Monday") ); |
237 | mByPosWeekdayCombo->insertItem( i18n("Tuesday") ); | 236 | mByPosWeekdayCombo->insertItem( i18n("Tuesday") ); |
238 | mByPosWeekdayCombo->insertItem( i18n("Wednesday") ); | 237 | mByPosWeekdayCombo->insertItem( i18n("Wednesday") ); |
239 | mByPosWeekdayCombo->insertItem( i18n("Thursday") ); | 238 | mByPosWeekdayCombo->insertItem( i18n("Thursday") ); |
240 | mByPosWeekdayCombo->insertItem( i18n("Friday") ); | 239 | mByPosWeekdayCombo->insertItem( i18n("Friday") ); |
241 | mByPosWeekdayCombo->insertItem( i18n("Saturday") ); | 240 | mByPosWeekdayCombo->insertItem( i18n("Saturday") ); |
242 | mByPosWeekdayCombo->insertItem( i18n("Sunday") ); | 241 | mByPosWeekdayCombo->insertItem( i18n("Sunday") ); |
243 | buttonLayout->addWidget( mByPosWeekdayCombo, 1, 2 ); | 242 | buttonLayout->addWidget( mByPosWeekdayCombo, 1, 2 ); |