-rw-r--r-- | korganizer/kofilterview.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index d79b28e..2dd4567 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp | |||
@@ -1,383 +1,383 @@ | |||
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 <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qcombobox.h> | 25 | #include <qcombobox.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qdialog.h> | 29 | #include <qdialog.h> |
30 | 30 | ||
31 | 31 | ||
32 | #include <libkcal/calfilter.h> | 32 | #include <libkcal/calfilter.h> |
33 | 33 | ||
34 | #include "kofilterview.h" | 34 | #include "kofilterview.h" |
35 | #include "koprefs.h" | 35 | #include "koprefs.h" |
36 | #include <kiconloader.h> | 36 | #include <kiconloader.h> |
37 | #include <kglobal.h> | 37 | #include <kglobal.h> |
38 | #include <kcolorbutton.h> | 38 | #include <kcolorbutton.h> |
39 | #include <kmessagebox.h> | 39 | #include <kmessagebox.h> |
40 | 40 | ||
41 | 41 | ||
42 | #include <kurlrequester.h> | 42 | #include <kurlrequester.h> |
43 | #include <klineedit.h> | 43 | #include <klineedit.h> |
44 | 44 | ||
45 | class KONewCalPrefs : public QDialog | 45 | class KONewCalPrefs : public QDialog |
46 | { | 46 | { |
47 | public: | 47 | public: |
48 | KONewCalPrefs( QWidget *parent=0, const char *name=0 ) : | 48 | KONewCalPrefs( QWidget *parent=0, const char *name=0 ) : |
49 | QDialog( parent, name, true ) | 49 | QDialog( parent, name, true ) |
50 | { | 50 | { |
51 | setCaption( i18n("Add new Calendar") ); | 51 | setCaption( i18n("Add new Calendar") ); |
52 | QVBoxLayout* lay = new QVBoxLayout( this ); | 52 | QVBoxLayout* lay = new QVBoxLayout( this ); |
53 | lay->setSpacing( 3 ); | 53 | lay->setSpacing( 3 ); |
54 | lay->setMargin( 3 ); | 54 | lay->setMargin( 3 ); |
55 | QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); | 55 | QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); |
56 | lay->addWidget( lab ); | 56 | lay->addWidget( lab ); |
57 | nameE = new KLineEdit( this ); | 57 | nameE = new KLineEdit( this ); |
58 | lay->addWidget( nameE ); | 58 | lay->addWidget( nameE ); |
59 | lab = new QLabel( i18n("Local ical (*.ics) file:"), this ); | 59 | lab = new QLabel( i18n("Local ical (*.ics) file:"), this ); |
60 | lay->addWidget( lab ); | 60 | lay->addWidget( lab ); |
61 | url = new KURLRequester ( this ); | 61 | url = new KURLRequester ( this ); |
62 | lay->addWidget( url ); | 62 | lay->addWidget( url ); |
63 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 63 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
64 | lay->addWidget( ok ); | 64 | lay->addWidget( ok ); |
65 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 65 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
66 | lay->addWidget( cancel ); | 66 | lay->addWidget( cancel ); |
67 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 67 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
68 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 68 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
69 | resize( 200, 200 ); | 69 | resize( 200, 200 ); |
70 | } | 70 | } |
71 | 71 | ||
72 | QString calName() { return nameE->text(); } | 72 | QString calName() { return nameE->text(); } |
73 | QString calFileName() { return url->url(); } | 73 | QString calFileName() { return url->url(); } |
74 | private: | 74 | private: |
75 | KLineEdit* nameE; | 75 | KLineEdit* nameE; |
76 | KURLRequester *url; | 76 | KURLRequester *url; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | 79 | ||
80 | KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, | 80 | KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, |
81 | const char* name,WFlags fl ) | 81 | const char* name,WFlags fl ) |
82 | : KOFilterView_base(parent,name,fl) | 82 | : KOFilterView_base(parent,name,fl) |
83 | { | 83 | { |
84 | mFilters = filterList; | 84 | mFilters = filterList; |
85 | 85 | ||
86 | connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); | 86 | connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); |
87 | connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); | 87 | connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); |
88 | connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); | 88 | connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); |
89 | } | 89 | } |
90 | 90 | ||
91 | KOFilterView::~KOFilterView() | 91 | KOFilterView::~KOFilterView() |
92 | { | 92 | { |
93 | // no need to delete child widgets, Qt does it all for us | 93 | // no need to delete child widgets, Qt does it all for us |
94 | } | 94 | } |
95 | 95 | ||
96 | bool KOFilterView::filtersEnabled() | 96 | bool KOFilterView::filtersEnabled() |
97 | { | 97 | { |
98 | return mEnabledCheck->isChecked(); | 98 | return mEnabledCheck->isChecked(); |
99 | } | 99 | } |
100 | 100 | ||
101 | void KOFilterView::setFiltersEnabled(bool set) | 101 | void KOFilterView::setFiltersEnabled(bool set) |
102 | { | 102 | { |
103 | mEnabledCheck->setChecked(set); | 103 | mEnabledCheck->setChecked(set); |
104 | emit filterChanged(); | 104 | emit filterChanged(); |
105 | } | 105 | } |
106 | 106 | ||
107 | 107 | ||
108 | void KOFilterView::updateFilters() | 108 | void KOFilterView::updateFilters() |
109 | { | 109 | { |
110 | mSelectionCombo->clear(); | 110 | mSelectionCombo->clear(); |
111 | 111 | ||
112 | CalFilter *filter = mFilters->first(); | 112 | CalFilter *filter = mFilters->first(); |
113 | while(filter) { | 113 | while(filter) { |
114 | mSelectionCombo->insertItem(filter->name()); | 114 | mSelectionCombo->insertItem(filter->name()); |
115 | filter = mFilters->next(); | 115 | filter = mFilters->next(); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | CalFilter *KOFilterView::selectedFilter() | 119 | CalFilter *KOFilterView::selectedFilter() |
120 | { | 120 | { |
121 | CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); | 121 | CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); |
122 | return f; | 122 | return f; |
123 | } | 123 | } |
124 | 124 | ||
125 | void KOFilterView::setSelectedFilter(QString filterName) | 125 | void KOFilterView::setSelectedFilter(QString filterName) |
126 | { | 126 | { |
127 | int filter_num = mSelectionCombo->count(); | 127 | int filter_num = mSelectionCombo->count(); |
128 | int i; | 128 | int i; |
129 | for (i=0;i<filter_num;i++) { | 129 | for (i=0;i<filter_num;i++) { |
130 | if (mSelectionCombo->text(i)==filterName) | 130 | if (mSelectionCombo->text(i)==filterName) |
131 | mSelectionCombo->setCurrentItem(i); | 131 | mSelectionCombo->setCurrentItem(i); |
132 | } | 132 | } |
133 | emit filterChanged(); | 133 | emit filterChanged(); |
134 | } | 134 | } |
135 | void KOFilterView::setSelectedFilter( int fil ) | 135 | void KOFilterView::setSelectedFilter( int fil ) |
136 | { | 136 | { |
137 | if ( fil >= mSelectionCombo->count() ) | 137 | if ( fil >= mSelectionCombo->count() ) |
138 | return; | 138 | return; |
139 | mSelectionCombo->setCurrentItem( fil ); | 139 | mSelectionCombo->setCurrentItem( fil ); |
140 | emit filterChanged(); | 140 | emit filterChanged(); |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | 144 | ||
145 | KOCalEditView::KOCalEditView(QWidget* parent, | 145 | KOCalEditView::KOCalEditView(QWidget* parent, |
146 | const char* name ) | 146 | const char* name ) |
147 | : QWidget(parent,name) | 147 | : QWidget(parent,name) |
148 | { | 148 | { |
149 | mw = 0; | 149 | mw = 0; |
150 | ml = new QVBoxLayout ( this ); | 150 | ml = new QVBoxLayout ( this ); |
151 | } | 151 | } |
152 | 152 | ||
153 | KOCalEditView::~KOCalEditView() | 153 | KOCalEditView::~KOCalEditView() |
154 | { | 154 | { |
155 | // no need to delete child widgets, Qt does it all for us | 155 | // no need to delete child widgets, Qt does it all for us |
156 | } | 156 | } |
157 | void KOCalEditView::selectCal(int id ,bool b) | 157 | void KOCalEditView::selectCal(int id ,bool b) |
158 | { | 158 | { |
159 | KOPrefs::instance()->getCalendar( id )->isEnabled = b; | 159 | KOPrefs::instance()->getCalendar( id )->isEnabled = b; |
160 | emit calendarEnabled ( id, b ); | 160 | emit calendarEnabled ( id, b ); |
161 | 161 | ||
162 | } | 162 | } |
163 | void KOCalEditView::selectStdCal( int id, bool b ) | 163 | void KOCalEditView::selectStdCal( int id, bool b ) |
164 | { | 164 | { |
165 | 165 | ||
166 | if ( !b ) { | 166 | if ( !b ) { |
167 | KOCalCheckButton* it = (KOCalCheckButton*) sender(); | 167 | KOCalCheckButton* it = (KOCalCheckButton*) sender(); |
168 | if ( it ) { | 168 | if ( it ) { |
169 | it->blockSignals( true ); | 169 | it->blockSignals( true ); |
170 | it->setChecked( true ); | 170 | it->setChecked( true ); |
171 | it->blockSignals( false ); | 171 | it->blockSignals( false ); |
172 | return; | 172 | return; |
173 | } | 173 | } |
174 | return; | 174 | return; |
175 | } | 175 | } |
176 | KOCalCheckButton* sen = (KOCalCheckButton*) sender(); | 176 | KOCalCheckButton* sen = (KOCalCheckButton*) sender(); |
177 | KOCalCheckButton* it = mStdandardB.first(); | 177 | KOCalCheckButton* it = mStdandardB.first(); |
178 | while ( it ) { | 178 | while ( it ) { |
179 | if ( it->isChecked() ) { | 179 | if ( it->isChecked() ) { |
180 | if ( it != sen ) { | 180 | if ( it != sen ) { |
181 | it->blockSignals( true ); | 181 | it->blockSignals( true ); |
182 | it->setChecked( false ); | 182 | it->setChecked( false ); |
183 | it->blockSignals( false ); | 183 | it->blockSignals( false ); |
184 | break; | 184 | break; |
185 | } | 185 | } |
186 | } | 186 | } |
187 | it = mStdandardB.next(); | 187 | it = mStdandardB.next(); |
188 | } | 188 | } |
189 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 189 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
190 | while ( kkf ) { | 190 | while ( kkf ) { |
191 | kkf->isStandard = false; | 191 | kkf->isStandard = false; |
192 | kkf = KOPrefs::instance()->mCalendars.next(); | 192 | kkf = KOPrefs::instance()->mCalendars.next(); |
193 | } | 193 | } |
194 | KOPrefs::instance()->getCalendar( id )->isStandard = true; | 194 | KOPrefs::instance()->getCalendar( id )->isStandard = true; |
195 | emit setCalendarDefault ( id ); | 195 | emit setCalendarDefault ( id ); |
196 | } | 196 | } |
197 | 197 | ||
198 | void KOCalEditView::selectCalAlarm(int id ,bool b ) | 198 | void KOCalEditView::selectCalAlarm(int id ,bool b ) |
199 | { | 199 | { |
200 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; | 200 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; |
201 | emit alarmEnabled ( id , b ); | 201 | emit alarmEnabled ( id , b ); |
202 | } | 202 | } |
203 | void KOCalEditView::selectReadOnly(int id ,bool b ) | 203 | void KOCalEditView::selectReadOnly(int id ,bool b ) |
204 | { | 204 | { |
205 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; | 205 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; |
206 | emit calendarReadonly ( id , b ); | 206 | emit calendarReadonly ( id , b ); |
207 | 207 | ||
208 | } | 208 | } |
209 | void KOCalEditView::setColor( const QColor& c, int id ) | 209 | void KOCalEditView::setColor( const QColor& c, int id ) |
210 | { | 210 | { |
211 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; | 211 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; |
212 | } | 212 | } |
213 | void KOCalEditView::deleteCal( int id ) | 213 | void KOCalEditView::deleteCal( int id ) |
214 | { | 214 | { |
215 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); | 215 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); |
216 | QString name = kkf->mName; | 216 | QString name = kkf->mName; |
217 | QString file = kkf->mFileName; | 217 | QString file = kkf->mFileName; |
218 | if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b><tr> Do you want to remove this calendar from KO/Pi? (The file is not removed, of course!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; | 218 | if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b><tr> Do you want to remove this calendar from KO/Pi? (The file is not removed, of course!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; |
219 | emit removeCalendar ( id ); | 219 | emit removeCalendar ( id ); |
220 | KOPrefs::instance()->mCalendars.remove ( kkf ); | 220 | KOPrefs::instance()->mCalendars.remove ( kkf ); |
221 | readConfig(); | 221 | readConfig(); |
222 | } | 222 | } |
223 | void KOCalEditView::infoCal( int id ) | 223 | void KOCalEditView::infoCal( int id ) |
224 | { | 224 | { |
225 | QString name = KOPrefs::instance()->getCalendar( id )->mName; | 225 | QString name = KOPrefs::instance()->getCalendar( id )->mName; |
226 | QString file = KOPrefs::instance()->getCalendar( id )->mFileName; | 226 | QString file = KOPrefs::instance()->getCalendar( id )->mFileName; |
227 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); | 227 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); |
228 | } | 228 | } |
229 | void KOCalEditView::readConfig() | 229 | void KOCalEditView::readConfig() |
230 | { | 230 | { |
231 | 231 | ||
232 | mStdandardB.clear(); | 232 | mStdandardB.clear(); |
233 | mEnabledB.clear(); | 233 | mEnabledB.clear(); |
234 | mAlarmB.clear(); | 234 | mAlarmB.clear(); |
235 | mROB.clear(); | 235 | mROB.clear(); |
236 | 236 | ||
237 | if ( mw ) delete mw; | 237 | if ( mw ) delete mw; |
238 | mw = new QWidget ( this ); | 238 | mw = new QWidget ( this ); |
239 | ml->addWidget ( mw ); | 239 | ml->addWidget ( mw ); |
240 | 240 | ||
241 | mainLayout = new QGridLayout ( mw , 2, 8 ); | 241 | mainLayout = new QGridLayout ( mw , 2, 8 ); |
242 | mainLayout->setSpacing( 3 ); | 242 | //mainLayout->setSpacing( 3 ); |
243 | QPushButton * addBut = new QPushButton ( mw ); | 243 | QPushButton * addBut = new QPushButton ( mw ); |
244 | mainLayout->addWidget( addBut,0,0 ); | 244 | mainLayout->addWidget( addBut,0,0 ); |
245 | addBut->setPixmap ( SmallIcon("plus")); | 245 | addBut->setPixmap ( SmallIcon("plus")); |
246 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); | 246 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); |
247 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 247 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
248 | 248 | ||
249 | addBut = new QPushButton ( mw ); | 249 | addBut = new QPushButton ( mw ); |
250 | mainLayout->addWidget( addBut,0,1 ); | 250 | mainLayout->addWidget( addBut,0,1 ); |
251 | addBut->setPixmap ( SmallIcon("eye")); | 251 | addBut->setPixmap ( SmallIcon("eye")); |
252 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); | 252 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); |
253 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 253 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
254 | 254 | ||
255 | QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw ); | 255 | QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw ); |
256 | mainLayout->addWidget( lab,0,2 ); | 256 | mainLayout->addWidget( lab,0,2 ); |
257 | 257 | ||
258 | addBut = new QPushButton ( mw ); | 258 | addBut = new QPushButton ( mw ); |
259 | mainLayout->addWidget( addBut,0,3 ); | 259 | mainLayout->addWidget( addBut,0,3 ); |
260 | addBut->setPixmap ( SmallIcon("bell")); | 260 | addBut->setPixmap ( SmallIcon("bell")); |
261 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); | 261 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); |
262 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 262 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
263 | 263 | ||
264 | addBut = new QPushButton ( mw ); | 264 | addBut = new QPushButton ( mw ); |
265 | mainLayout->addWidget( addBut,0,4 ); | 265 | mainLayout->addWidget( addBut,0,4 ); |
266 | addBut->setPixmap ( SmallIcon("pencil")); | 266 | addBut->setPixmap ( SmallIcon("pencil")); |
267 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); | 267 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); |
268 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 268 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
269 | 269 | ||
270 | lab = new QLabel ( i18n(" Color "), mw ); | 270 | lab = new QLabel ( i18n(" Color "), mw ); |
271 | mainLayout->addWidget( lab,0,5 ); | 271 | mainLayout->addWidget( lab,0,5 ); |
272 | #if 0 | 272 | #if 0 |
273 | addBut = new QPushButton ( mw ); | 273 | addBut = new QPushButton ( mw ); |
274 | mainLayout->addWidget( addBut,0,6 ); | 274 | mainLayout->addWidget( addBut,0,6 ); |
275 | addBut->setPixmap ( SmallIcon("minus")); | 275 | addBut->setPixmap ( SmallIcon("minus")); |
276 | connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); | 276 | connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); |
277 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 277 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
278 | #endif | 278 | #endif |
279 | 279 | ||
280 | 280 | ||
281 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 281 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
282 | int row = 1; | 282 | int row = 1; |
283 | while ( kkf ) { | 283 | while ( kkf ) { |
284 | 284 | ||
285 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); | 285 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); |
286 | mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); | 286 | mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); |
287 | cb->setChecked( kkf->isStandard ); | 287 | cb->setChecked( kkf->isStandard ); |
288 | cb->setNum( kkf->mCalNumber ); | 288 | cb->setNum( kkf->mCalNumber ); |
289 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); | 289 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); |
290 | cb = new KOCalCheckButton( mw ); | 290 | cb = new KOCalCheckButton( mw ); |
291 | mainLayout->addWidget( cb,row,1 );mEnabledB.append( cb ); | 291 | mainLayout->addWidget( cb,row,1 );mEnabledB.append( cb ); |
292 | cb->setChecked( kkf->isEnabled ); | 292 | cb->setChecked( kkf->isEnabled ); |
293 | cb->setNum( kkf->mCalNumber ); | 293 | cb->setNum( kkf->mCalNumber ); |
294 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); | 294 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); |
295 | KOCalButton* name = new KOCalButton( mw ); | 295 | KOCalButton* name = new KOCalButton( mw ); |
296 | name->setNum( kkf->mCalNumber ); | 296 | name->setNum( kkf->mCalNumber ); |
297 | name->setText( kkf->mName ); | 297 | name->setText( kkf->mName ); |
298 | mainLayout->addWidget( name,row,2 ); | 298 | mainLayout->addWidget( name,row,2 ); |
299 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); | 299 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); |
300 | cb = new KOCalCheckButton( mw ); | 300 | cb = new KOCalCheckButton( mw ); |
301 | mainLayout->addWidget( cb,row,3 );mAlarmB.append( cb ); | 301 | mainLayout->addWidget( cb,row,3 );mAlarmB.append( cb ); |
302 | cb->setChecked( kkf->isAlarmEnabled ); | 302 | cb->setChecked( kkf->isAlarmEnabled ); |
303 | cb->setNum( kkf->mCalNumber ); | 303 | cb->setNum( kkf->mCalNumber ); |
304 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); | 304 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); |
305 | cb = new KOCalCheckButton( mw ); | 305 | cb = new KOCalCheckButton( mw ); |
306 | mainLayout->addWidget( cb,row,4 );mROB.append( cb ); | 306 | mainLayout->addWidget( cb,row,4 );mROB.append( cb ); |
307 | cb->setChecked( kkf->isReadOnly ); | 307 | cb->setChecked( kkf->isReadOnly ); |
308 | cb->setNum( kkf->mCalNumber ); | 308 | cb->setNum( kkf->mCalNumber ); |
309 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); | 309 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); |
310 | KColorButton *colb = new KColorButton( mw ); | 310 | KColorButton *colb = new KColorButton( mw ); |
311 | mainLayout->addWidget( colb,row,5 ); | 311 | mainLayout->addWidget( colb,row,5 ); |
312 | colb->setID( kkf->mCalNumber ); | 312 | colb->setID( kkf->mCalNumber ); |
313 | colb->setColor( kkf->mDefaultColor ); | 313 | colb->setColor( kkf->mDefaultColor ); |
314 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); | 314 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); |
315 | if ( row > 1) { | 315 | if ( row > 1) { |
316 | KOCalButton* calb = new KOCalButton( mw ); | 316 | KOCalButton* calb = new KOCalButton( mw ); |
317 | mainLayout->addWidget( calb,row,6 ); | 317 | mainLayout->addWidget( calb,row,6 ); |
318 | calb->setNum( kkf->mCalNumber ); | 318 | calb->setNum( kkf->mCalNumber ); |
319 | calb->setPixmap ( SmallIcon("minus")); | 319 | calb->setPixmap ( SmallIcon("minus")); |
320 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); | 320 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); |
321 | int hei = calb->sizeHint().height(); | 321 | int hei = calb->sizeHint().height(); |
322 | calb->setMaximumSize( hei*9/10, hei*9/10 ); | 322 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); |
323 | } | 323 | } |
324 | ++row; | 324 | ++row; |
325 | kkf = KOPrefs::instance()->mCalendars.next(); | 325 | kkf = KOPrefs::instance()->mCalendars.next(); |
326 | } | 326 | } |
327 | lab = new QLabel ( "", mw ); | 327 | lab = new QLabel ( "", mw ); |
328 | mainLayout->addWidget( lab,row,0 ); | 328 | mainLayout->addWidget( lab,row,0 ); |
329 | mw->show(); | 329 | mw->show(); |
330 | 330 | ||
331 | } | 331 | } |
332 | void KOCalEditView::addCal() | 332 | void KOCalEditView::addCal() |
333 | { | 333 | { |
334 | qDebug("addcal "); | 334 | qDebug("addcal "); |
335 | KONewCalPrefs prefs ( this ); | 335 | KONewCalPrefs prefs ( this ); |
336 | if ( ! prefs.exec() ) | 336 | if ( ! prefs.exec() ) |
337 | return; | 337 | return; |
338 | QString name = prefs.calName(); | 338 | QString name = prefs.calName(); |
339 | QString file = prefs.calFileName(); | 339 | QString file = prefs.calFileName(); |
340 | QFileInfo fi ( file ); | 340 | QFileInfo fi ( file ); |
341 | if (!fi.exists() ) { | 341 | if (!fi.exists() ) { |
342 | KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); | 342 | KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); |
343 | return; | 343 | return; |
344 | } | 344 | } |
345 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); | 345 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); |
346 | kkf->mName = name; | 346 | kkf->mName = name; |
347 | kkf->mFileName = file; | 347 | kkf->mFileName = file; |
348 | emit calendarAdded( kkf->mCalNumber ); | 348 | emit calendarAdded( kkf->mCalNumber ); |
349 | readConfig(); | 349 | readConfig(); |
350 | } | 350 | } |
351 | void KOCalEditView::enableAll() | 351 | void KOCalEditView::enableAll() |
352 | { | 352 | { |
353 | toggleList( mEnabledB ); | 353 | toggleList( mEnabledB ); |
354 | } | 354 | } |
355 | void KOCalEditView::enableAlarm() | 355 | void KOCalEditView::enableAlarm() |
356 | { | 356 | { |
357 | toggleList( mAlarmB ); | 357 | toggleList( mAlarmB ); |
358 | } | 358 | } |
359 | void KOCalEditView::disableRO() | 359 | void KOCalEditView::disableRO() |
360 | { | 360 | { |
361 | toggleList( mROB ); | 361 | toggleList( mROB ); |
362 | } | 362 | } |
363 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) | 363 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) |
364 | { | 364 | { |
365 | bool dis = false; | 365 | bool dis = false; |
366 | KOCalCheckButton* it = list.first(); | 366 | KOCalCheckButton* it = list.first(); |
367 | while ( it ) { | 367 | while ( it ) { |
368 | if ( !it->isChecked() ) { | 368 | if ( !it->isChecked() ) { |
369 | dis = true; | 369 | dis = true; |
370 | break; | 370 | break; |
371 | } | 371 | } |
372 | it = list.next(); | 372 | it = list.next(); |
373 | } | 373 | } |
374 | it = list.first(); | 374 | it = list.first(); |
375 | while ( it ) { | 375 | while ( it ) { |
376 | it->setChecked(dis); | 376 | it->setChecked(dis); |
377 | it = list.next(); | 377 | it = list.next(); |
378 | } | 378 | } |
379 | } | 379 | } |
380 | void KOCalEditView::deleteAll() | 380 | void KOCalEditView::deleteAll() |
381 | { | 381 | { |
382 | qDebug("delteAll"); | 382 | qDebug("delteAll"); |
383 | } | 383 | } |