author | zautrix <zautrix> | 2005-06-13 14:12:46 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-13 14:12:46 (UTC) |
commit | 0000f74badd326f62620d818a5e5d9944e55bda0 (patch) (unidiff) | |
tree | e5de7a34f12efab3a4fa27f6534a06a4cbf406fe /korganizer | |
parent | 56de219c5ce910a470a01a0e5003d1a113837ef4 (diff) | |
download | kdepimpi-0000f74badd326f62620d818a5e5d9944e55bda0.zip kdepimpi-0000f74badd326f62620d818a5e5d9944e55bda0.tar.gz kdepimpi-0000f74badd326f62620d818a5e5d9944e55bda0.tar.bz2 |
fixxii
-rw-r--r-- | korganizer/kofilterview.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index 2b16347..361eec8 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp | |||
@@ -1,387 +1,391 @@ | |||
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 | emit needsUpdate(); | 161 | emit needsUpdate(); |
162 | 162 | ||
163 | } | 163 | } |
164 | void KOCalEditView::selectStdCal( int id, bool b ) | 164 | void KOCalEditView::selectStdCal( int id, bool b ) |
165 | { | 165 | { |
166 | 166 | ||
167 | if ( !b ) { | 167 | if ( !b ) { |
168 | KOCalCheckButton* it = (KOCalCheckButton*) sender(); | 168 | KOCalCheckButton* it = (KOCalCheckButton*) sender(); |
169 | if ( it ) { | 169 | if ( it ) { |
170 | it->blockSignals( true ); | 170 | it->blockSignals( true ); |
171 | it->setChecked( true ); | 171 | it->setChecked( true ); |
172 | it->blockSignals( false ); | 172 | it->blockSignals( false ); |
173 | return; | 173 | return; |
174 | } | 174 | } |
175 | return; | 175 | return; |
176 | } | 176 | } |
177 | KOCalCheckButton* sen = (KOCalCheckButton*) sender(); | 177 | KOCalCheckButton* sen = (KOCalCheckButton*) sender(); |
178 | KOCalCheckButton* it = mStdandardB.first(); | 178 | KOCalCheckButton* it = mStdandardB.first(); |
179 | while ( it ) { | 179 | while ( it ) { |
180 | if ( it->isChecked() ) { | 180 | if ( it->isChecked() ) { |
181 | if ( it != sen ) { | 181 | if ( it != sen ) { |
182 | it->blockSignals( true ); | 182 | it->blockSignals( true ); |
183 | it->setChecked( false ); | 183 | it->setChecked( false ); |
184 | it->blockSignals( false ); | 184 | it->blockSignals( false ); |
185 | break; | 185 | break; |
186 | } | 186 | } |
187 | } | 187 | } |
188 | it = mStdandardB.next(); | 188 | it = mStdandardB.next(); |
189 | } | 189 | } |
190 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 190 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
191 | while ( kkf ) { | 191 | while ( kkf ) { |
192 | kkf->isStandard = false; | 192 | kkf->isStandard = false; |
193 | kkf = KOPrefs::instance()->mCalendars.next(); | 193 | kkf = KOPrefs::instance()->mCalendars.next(); |
194 | } | 194 | } |
195 | KOPrefs::instance()->getCalendar( id )->isStandard = true; | 195 | KOPrefs::instance()->getCalendar( id )->isStandard = true; |
196 | emit setCalendarDefault ( id ); | 196 | emit setCalendarDefault ( id ); |
197 | } | 197 | } |
198 | 198 | ||
199 | void KOCalEditView::selectCalAlarm(int id ,bool b ) | 199 | void KOCalEditView::selectCalAlarm(int id ,bool b ) |
200 | { | 200 | { |
201 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; | 201 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; |
202 | emit alarmEnabled ( id , b ); | 202 | emit alarmEnabled ( id , b ); |
203 | emit needsUpdate(); | 203 | emit needsUpdate(); |
204 | } | 204 | } |
205 | void KOCalEditView::selectReadOnly(int id ,bool b ) | 205 | void KOCalEditView::selectReadOnly(int id ,bool b ) |
206 | { | 206 | { |
207 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; | 207 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; |
208 | emit calendarReadonly ( id , b ); | 208 | emit calendarReadonly ( id , b ); |
209 | emit needsUpdate(); | 209 | emit needsUpdate(); |
210 | 210 | ||
211 | } | 211 | } |
212 | void KOCalEditView::setColor( const QColor& c, int id ) | 212 | void KOCalEditView::setColor( const QColor& c, int id ) |
213 | { | 213 | { |
214 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; | 214 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; |
215 | emit needsUpdate(); | 215 | emit needsUpdate(); |
216 | } | 216 | } |
217 | void KOCalEditView::deleteCal( int id ) | 217 | void KOCalEditView::deleteCal( int id ) |
218 | { | 218 | { |
219 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); | 219 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); |
220 | QString name = kkf->mName; | 220 | QString name = kkf->mName; |
221 | QString file = kkf->mFileName; | 221 | QString file = kkf->mFileName; |
222 | 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; | 222 | 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; |
223 | if ( kkf->isStandard ) | ||
224 | selectStdCal( 1, true ); | ||
223 | emit removeCalendar ( id ); | 225 | emit removeCalendar ( id ); |
224 | KOPrefs::instance()->mCalendars.remove ( kkf ); | 226 | KOPrefs::instance()->mCalendars.remove ( kkf ); |
227 | emit needsUpdate(); | ||
225 | readConfig(); | 228 | readConfig(); |
226 | } | 229 | } |
227 | void KOCalEditView::infoCal( int id ) | 230 | void KOCalEditView::infoCal( int id ) |
228 | { | 231 | { |
229 | QString name = KOPrefs::instance()->getCalendar( id )->mName; | 232 | QString name = KOPrefs::instance()->getCalendar( id )->mName; |
230 | QString file = KOPrefs::instance()->getCalendar( id )->mFileName; | 233 | QString file = KOPrefs::instance()->getCalendar( id )->mFileName; |
231 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); | 234 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); |
232 | } | 235 | } |
233 | void KOCalEditView::readConfig() | 236 | void KOCalEditView::readConfig() |
234 | { | 237 | { |
235 | 238 | ||
236 | mStdandardB.clear(); | 239 | mStdandardB.clear(); |
237 | mEnabledB.clear(); | 240 | mEnabledB.clear(); |
238 | mAlarmB.clear(); | 241 | mAlarmB.clear(); |
239 | mROB.clear(); | 242 | mROB.clear(); |
240 | 243 | ||
241 | if ( mw ) delete mw; | 244 | if ( mw ) delete mw; |
242 | mw = new QWidget ( this ); | 245 | mw = new QWidget ( this ); |
243 | ml->addWidget ( mw ); | 246 | ml->addWidget ( mw ); |
244 | 247 | ||
245 | mainLayout = new QGridLayout ( mw , 2, 8 ); | 248 | mainLayout = new QGridLayout ( mw , 2, 8 ); |
246 | //mainLayout->setSpacing( 3 ); | 249 | //mainLayout->setSpacing( 3 ); |
247 | QPushButton * addBut = new QPushButton ( mw ); | 250 | QPushButton * addBut = new QPushButton ( mw ); |
248 | mainLayout->addWidget( addBut,0,0 ); | 251 | mainLayout->addWidget( addBut,0,0 ); |
249 | addBut->setPixmap ( SmallIcon("plus")); | 252 | addBut->setPixmap ( SmallIcon("plus")); |
250 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); | 253 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); |
251 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 254 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
252 | 255 | ||
253 | addBut = new QPushButton ( mw ); | 256 | addBut = new QPushButton ( mw ); |
254 | mainLayout->addWidget( addBut,0,1 ); | 257 | mainLayout->addWidget( addBut,0,1 ); |
255 | addBut->setPixmap ( SmallIcon("eye")); | 258 | addBut->setPixmap ( SmallIcon("eye")); |
256 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); | 259 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); |
257 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 260 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
258 | 261 | ||
259 | QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw ); | 262 | QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw ); |
260 | mainLayout->addWidget( lab,0,2 ); | 263 | mainLayout->addWidget( lab,0,2 ); |
261 | 264 | ||
262 | addBut = new QPushButton ( mw ); | 265 | addBut = new QPushButton ( mw ); |
263 | mainLayout->addWidget( addBut,0,3 ); | 266 | mainLayout->addWidget( addBut,0,3 ); |
264 | addBut->setPixmap ( SmallIcon("bell")); | 267 | addBut->setPixmap ( SmallIcon("bell")); |
265 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); | 268 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); |
266 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 269 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
267 | 270 | ||
268 | addBut = new QPushButton ( mw ); | 271 | addBut = new QPushButton ( mw ); |
269 | mainLayout->addWidget( addBut,0,4 ); | 272 | mainLayout->addWidget( addBut,0,4 ); |
270 | addBut->setPixmap ( SmallIcon("pencil")); | 273 | addBut->setPixmap ( SmallIcon("pencil")); |
271 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); | 274 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); |
272 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 275 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
273 | 276 | ||
274 | lab = new QLabel ( i18n(" Color "), mw ); | 277 | lab = new QLabel ( i18n(" Color "), mw ); |
275 | mainLayout->addWidget( lab,0,5 ); | 278 | mainLayout->addWidget( lab,0,5 ); |
276 | #if 0 | 279 | #if 0 |
277 | addBut = new QPushButton ( mw ); | 280 | addBut = new QPushButton ( mw ); |
278 | mainLayout->addWidget( addBut,0,6 ); | 281 | mainLayout->addWidget( addBut,0,6 ); |
279 | addBut->setPixmap ( SmallIcon("minus")); | 282 | addBut->setPixmap ( SmallIcon("minus")); |
280 | connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); | 283 | connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); |
281 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 284 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
282 | #endif | 285 | #endif |
283 | 286 | ||
284 | 287 | ||
285 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 288 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
286 | int row = 1; | 289 | int row = 1; |
287 | while ( kkf ) { | 290 | while ( kkf ) { |
288 | 291 | ||
289 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); | 292 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); |
290 | mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); | 293 | mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); |
291 | cb->setChecked( kkf->isStandard ); | 294 | cb->setChecked( kkf->isStandard ); |
292 | cb->setNum( kkf->mCalNumber ); | 295 | cb->setNum( kkf->mCalNumber ); |
293 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); | 296 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); |
294 | cb = new KOCalCheckButton( mw ); | 297 | cb = new KOCalCheckButton( mw ); |
295 | mainLayout->addWidget( cb,row,1 );mEnabledB.append( cb ); | 298 | mainLayout->addWidget( cb,row,1 );mEnabledB.append( cb ); |
296 | cb->setChecked( kkf->isEnabled ); | 299 | cb->setChecked( kkf->isEnabled ); |
297 | cb->setNum( kkf->mCalNumber ); | 300 | cb->setNum( kkf->mCalNumber ); |
298 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); | 301 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); |
299 | KOCalButton* name = new KOCalButton( mw ); | 302 | KOCalButton* name = new KOCalButton( mw ); |
300 | name->setNum( kkf->mCalNumber ); | 303 | name->setNum( kkf->mCalNumber ); |
301 | name->setText( kkf->mName ); | 304 | name->setText( kkf->mName ); |
302 | mainLayout->addWidget( name,row,2 ); | 305 | mainLayout->addWidget( name,row,2 ); |
303 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); | 306 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); |
304 | cb = new KOCalCheckButton( mw ); | 307 | cb = new KOCalCheckButton( mw ); |
305 | mainLayout->addWidget( cb,row,3 );mAlarmB.append( cb ); | 308 | mainLayout->addWidget( cb,row,3 );mAlarmB.append( cb ); |
306 | cb->setChecked( kkf->isAlarmEnabled ); | 309 | cb->setChecked( kkf->isAlarmEnabled ); |
307 | cb->setNum( kkf->mCalNumber ); | 310 | cb->setNum( kkf->mCalNumber ); |
308 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); | 311 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); |
309 | cb = new KOCalCheckButton( mw ); | 312 | cb = new KOCalCheckButton( mw ); |
310 | mainLayout->addWidget( cb,row,4 );mROB.append( cb ); | 313 | mainLayout->addWidget( cb,row,4 );mROB.append( cb ); |
311 | cb->setChecked( kkf->isReadOnly ); | 314 | cb->setChecked( kkf->isReadOnly ); |
312 | cb->setNum( kkf->mCalNumber ); | 315 | cb->setNum( kkf->mCalNumber ); |
313 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); | 316 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); |
314 | KColorButton *colb = new KColorButton( mw ); | 317 | KColorButton *colb = new KColorButton( mw ); |
315 | mainLayout->addWidget( colb,row,5 ); | 318 | mainLayout->addWidget( colb,row,5 ); |
316 | colb->setID( kkf->mCalNumber ); | 319 | colb->setID( kkf->mCalNumber ); |
317 | colb->setColor( kkf->mDefaultColor ); | 320 | colb->setColor( kkf->mDefaultColor ); |
318 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); | 321 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); |
319 | if ( row > 1) { | 322 | if ( row > 1) { |
320 | KOCalButton* calb = new KOCalButton( mw ); | 323 | KOCalButton* calb = new KOCalButton( mw ); |
321 | mainLayout->addWidget( calb,row,6 ); | 324 | mainLayout->addWidget( calb,row,6 ); |
322 | calb->setNum( kkf->mCalNumber ); | 325 | calb->setNum( kkf->mCalNumber ); |
323 | calb->setPixmap ( SmallIcon("minus")); | 326 | calb->setPixmap ( SmallIcon("minus")); |
324 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); | 327 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); |
325 | int hei = calb->sizeHint().height(); | 328 | int hei = calb->sizeHint().height(); |
326 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); | 329 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); |
327 | } | 330 | } |
328 | ++row; | 331 | ++row; |
329 | kkf = KOPrefs::instance()->mCalendars.next(); | 332 | kkf = KOPrefs::instance()->mCalendars.next(); |
330 | } | 333 | } |
331 | lab = new QLabel ( "", mw ); | 334 | lab = new QLabel ( "", mw ); |
332 | mainLayout->addWidget( lab,row,0 ); | 335 | mainLayout->addWidget( lab,row,0 ); |
333 | mw->show(); | 336 | mw->show(); |
334 | 337 | ||
335 | } | 338 | } |
336 | void KOCalEditView::addCal() | 339 | void KOCalEditView::addCal() |
337 | { | 340 | { |
338 | qDebug("addcal "); | 341 | qDebug("addcal "); |
339 | KONewCalPrefs prefs ( this ); | 342 | KONewCalPrefs prefs ( this ); |
340 | if ( ! prefs.exec() ) | 343 | if ( ! prefs.exec() ) |
341 | return; | 344 | return; |
342 | QString name = prefs.calName(); | 345 | QString name = prefs.calName(); |
343 | QString file = prefs.calFileName(); | 346 | QString file = prefs.calFileName(); |
344 | QFileInfo fi ( file ); | 347 | QFileInfo fi ( file ); |
345 | if (!fi.exists() ) { | 348 | if (!fi.exists() ) { |
346 | KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); | 349 | KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); |
347 | return; | 350 | return; |
348 | } | 351 | } |
349 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); | 352 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); |
350 | kkf->mName = name; | 353 | kkf->mName = name; |
351 | kkf->mFileName = file; | 354 | kkf->mFileName = file; |
352 | emit calendarAdded( kkf->mCalNumber ); | 355 | emit calendarAdded( kkf->mCalNumber ); |
353 | readConfig(); | 356 | readConfig(); |
357 | emit needsUpdate(); | ||
354 | } | 358 | } |
355 | void KOCalEditView::enableAll() | 359 | void KOCalEditView::enableAll() |
356 | { | 360 | { |
357 | toggleList( mEnabledB ); | 361 | toggleList( mEnabledB ); |
358 | } | 362 | } |
359 | void KOCalEditView::enableAlarm() | 363 | void KOCalEditView::enableAlarm() |
360 | { | 364 | { |
361 | toggleList( mAlarmB ); | 365 | toggleList( mAlarmB ); |
362 | } | 366 | } |
363 | void KOCalEditView::disableRO() | 367 | void KOCalEditView::disableRO() |
364 | { | 368 | { |
365 | toggleList( mROB ); | 369 | toggleList( mROB ); |
366 | } | 370 | } |
367 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) | 371 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) |
368 | { | 372 | { |
369 | bool dis = false; | 373 | bool dis = false; |
370 | KOCalCheckButton* it = list.first(); | 374 | KOCalCheckButton* it = list.first(); |
371 | while ( it ) { | 375 | while ( it ) { |
372 | if ( !it->isChecked() ) { | 376 | if ( !it->isChecked() ) { |
373 | dis = true; | 377 | dis = true; |
374 | break; | 378 | break; |
375 | } | 379 | } |
376 | it = list.next(); | 380 | it = list.next(); |
377 | } | 381 | } |
378 | it = list.first(); | 382 | it = list.first(); |
379 | while ( it ) { | 383 | while ( it ) { |
380 | it->setChecked(dis); | 384 | it->setChecked(dis); |
381 | it = list.next(); | 385 | it = list.next(); |
382 | } | 386 | } |
383 | } | 387 | } |
384 | void KOCalEditView::deleteAll() | 388 | void KOCalEditView::deleteAll() |
385 | { | 389 | { |
386 | qDebug("delteAll"); | 390 | qDebug("delteAll"); |
387 | } | 391 | } |