summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kofilterview.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index ea53043..ce2880a 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -47,385 +47,387 @@
47KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, 47KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent,
48 const char* name,WFlags fl ) 48 const char* name,WFlags fl )
49 : KOFilterView_base(parent,name,fl) 49 : KOFilterView_base(parent,name,fl)
50{ 50{
51 mFilters = filterList; 51 mFilters = filterList;
52 52
53 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); 53 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged()));
54 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); 54 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged()));
55 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); 55 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters()));
56} 56}
57 57
58KOFilterView::~KOFilterView() 58KOFilterView::~KOFilterView()
59{ 59{
60 // no need to delete child widgets, Qt does it all for us 60 // no need to delete child widgets, Qt does it all for us
61} 61}
62 62
63bool KOFilterView::filtersEnabled() 63bool KOFilterView::filtersEnabled()
64{ 64{
65 return mEnabledCheck->isChecked(); 65 return mEnabledCheck->isChecked();
66} 66}
67 67
68void KOFilterView::setFiltersEnabled(bool set) 68void KOFilterView::setFiltersEnabled(bool set)
69{ 69{
70 mEnabledCheck->setChecked(set); 70 mEnabledCheck->setChecked(set);
71 emit filterChanged(); 71 emit filterChanged();
72} 72}
73 73
74 74
75void KOFilterView::updateFilters() 75void KOFilterView::updateFilters()
76{ 76{
77 mSelectionCombo->clear(); 77 mSelectionCombo->clear();
78 78
79 CalFilter *filter = mFilters->first(); 79 CalFilter *filter = mFilters->first();
80 while(filter) { 80 while(filter) {
81 mSelectionCombo->insertItem(filter->name()); 81 mSelectionCombo->insertItem(filter->name());
82 filter = mFilters->next(); 82 filter = mFilters->next();
83 } 83 }
84} 84}
85 85
86CalFilter *KOFilterView::selectedFilter() 86CalFilter *KOFilterView::selectedFilter()
87{ 87{
88 CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); 88 CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
89 return f; 89 return f;
90} 90}
91 91
92void KOFilterView::setSelectedFilter(QString filterName) 92void KOFilterView::setSelectedFilter(QString filterName)
93{ 93{
94 int filter_num = mSelectionCombo->count(); 94 int filter_num = mSelectionCombo->count();
95 int i; 95 int i;
96 for (i=0;i<filter_num;i++) { 96 for (i=0;i<filter_num;i++) {
97 if (mSelectionCombo->text(i)==filterName) 97 if (mSelectionCombo->text(i)==filterName)
98 mSelectionCombo->setCurrentItem(i); 98 mSelectionCombo->setCurrentItem(i);
99 } 99 }
100 emit filterChanged(); 100 emit filterChanged();
101} 101}
102void KOFilterView::setSelectedFilter( int fil ) 102void KOFilterView::setSelectedFilter( int fil )
103{ 103{
104 if ( fil >= mSelectionCombo->count() ) 104 if ( fil >= mSelectionCombo->count() )
105 return; 105 return;
106 mSelectionCombo->setCurrentItem( fil ); 106 mSelectionCombo->setCurrentItem( fil );
107 emit filterChanged(); 107 emit filterChanged();
108} 108}
109 109
110 110
111 111
112KOCalEditView::KOCalEditView(QWidget* parent, 112KOCalEditView::KOCalEditView(QWidget* parent,
113 const char* name ) 113 const char* name )
114 : QScrollView(parent,name) 114 : QScrollView(parent,name)
115{ 115{
116 mw = 0; 116 mw = 0;
117 setResizePolicy( AutoOneFit ); 117 setResizePolicy( AutoOneFit );
118 setFrameStyle ( QFrame::Panel | QFrame::Plain ); 118 setFrameStyle ( QFrame::Panel | QFrame::Plain );
119 setLineWidth ( 1 ); 119 setLineWidth ( 1 );
120 setMidLineWidth ( 1 ); 120 setMidLineWidth ( 1 );
121 setFocusPolicy(NoFocus); 121 setFocusPolicy(NoFocus);
122} 122}
123 123
124KOCalEditView::~KOCalEditView() 124KOCalEditView::~KOCalEditView()
125{ 125{
126 // no need to delete child widgets, Qt does it all for us 126 // no need to delete child widgets, Qt does it all for us
127} 127}
128void KOCalEditView::selectCal(int id ,bool b) 128void KOCalEditView::selectCal(int id ,bool b)
129{ 129{
130 KOPrefs::instance()->getCalendar( id )->isEnabled = b; 130 KOPrefs::instance()->getCalendar( id )->isEnabled = b;
131 emit calendarEnabled ( id, b ); 131 emit calendarEnabled ( id, b );
132 emit needsUpdate(); 132 emit needsUpdate();
133 133
134} 134}
135void KOCalEditView::selectStdCal( int id, bool b ) 135void KOCalEditView::selectStdCal( int id, bool b )
136{ 136{
137 137
138 if ( !b ) { 138 if ( !b ) {
139 KOCalCheckButton* it = (KOCalCheckButton*) sender(); 139 KOCalCheckButton* it = (KOCalCheckButton*) sender();
140 if ( it ) { 140 if ( it ) {
141 it->blockSignals( true ); 141 it->blockSignals( true );
142 it->setChecked( true ); 142 it->setChecked( true );
143 it->blockSignals( false ); 143 it->blockSignals( false );
144 return; 144 return;
145 } 145 }
146 return; 146 return;
147 } 147 }
148 KOCalCheckButton* sen = (KOCalCheckButton*) sender(); 148 KOCalCheckButton* sen = (KOCalCheckButton*) sender();
149 KOCalCheckButton* it = mStdandardB.first(); 149 KOCalCheckButton* it = mStdandardB.first();
150 while ( it ) { 150 while ( it ) {
151 if ( it->isChecked() ) { 151 if ( it->isChecked() ) {
152 if ( it != sen ) { 152 if ( it != sen ) {
153 it->blockSignals( true ); 153 it->blockSignals( true );
154 it->setChecked( false ); 154 it->setChecked( false );
155 it->blockSignals( false ); 155 it->blockSignals( false );
156 break; 156 break;
157 } 157 }
158 } 158 }
159 it = mStdandardB.next(); 159 it = mStdandardB.next();
160 } 160 }
161 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 161 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
162 while ( kkf ) { 162 while ( kkf ) {
163 kkf->isStandard = false; 163 kkf->isStandard = false;
164 kkf = KOPrefs::instance()->mCalendars.next(); 164 kkf = KOPrefs::instance()->mCalendars.next();
165 } 165 }
166 KOPrefs::instance()->getCalendar( id )->isStandard = true; 166 KOPrefs::instance()->getCalendar( id )->isStandard = true;
167 emit setCalendarDefault ( id ); 167 emit setCalendarDefault ( id );
168} 168}
169 169
170void KOCalEditView::selectCalAlarm(int id ,bool b ) 170void KOCalEditView::selectCalAlarm(int id ,bool b )
171{ 171{
172 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; 172 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b;
173 emit alarmEnabled ( id , b ); 173 emit alarmEnabled ( id , b );
174 emit needsUpdate(); 174 emit needsUpdate();
175} 175}
176void KOCalEditView::selectReadOnly(int id ,bool b ) 176void KOCalEditView::selectReadOnly(int id ,bool b )
177{ 177{
178 KOPrefs::instance()->getCalendar( id )->isReadOnly = b; 178 KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
179 emit calendarReadonly ( id , b ); 179 emit calendarReadonly ( id , b );
180 if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) { 180 if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) {
181 KOPrefs::instance()->getCalendar( id )->isStandard = false; 181 KOPrefs::instance()->getCalendar( id )->isStandard = false;
182 KOPrefs::instance()->getCalendar( 1 )->isStandard = true; 182 KOPrefs::instance()->getCalendar( 1 )->isStandard = true;
183 emit setCalendarDefault ( 1 ); 183 emit setCalendarDefault ( 1 );
184 } 184 }
185 emit needsUpdate(); 185 emit needsUpdate();
186 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 186 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
187 187
188} 188}
189void KOCalEditView::setColor( const QColor& c, int id ) 189void KOCalEditView::setColor( const QColor& c, int id )
190{ 190{
191 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; 191 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c;
192 emit needsUpdate(); 192 emit needsUpdate();
193} 193}
194void KOCalEditView::deleteCal( int id ) 194void KOCalEditView::deleteCal( int id )
195{ 195{
196 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); 196 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id );
197 QString name = kkf->mName; 197 QString name = kkf->mName;
198 QString file = KGlobal::formatMessage ( kkf->mFileName ,0 ); 198 QString file = KGlobal::formatMessage ( kkf->mFileName ,0 );
199 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; 199 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return;
200 if ( kkf->isStandard ) 200 if ( kkf->isStandard )
201 selectStdCal( 1, true ); 201 selectStdCal( 1, true );
202 emit removeCalendar ( id ); 202 emit removeCalendar ( id );
203 KOPrefs::instance()->mCalendars.remove ( kkf ); 203 KOPrefs::instance()->mCalendars.remove ( kkf );
204 emit needsUpdate(); 204 emit needsUpdate();
205 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 205 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
206} 206}
207void KOCalEditView::infoCal( int id ) 207void KOCalEditView::infoCal( int id )
208{ 208{
209 QString name = KOPrefs::instance()->getCalendar( id )->mName; 209 QString name = KOPrefs::instance()->getCalendar( id )->mName;
210 QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 ); 210 QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 );
211 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { 211 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) {
212 if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { 212 if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) {
213 emit calendarAdded( id ); 213 emit calendarAdded( id );
214 emit needsUpdate(); 214 emit needsUpdate();
215 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 215 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
216 } 216 }
217 } 217 }
218 else 218 else
219 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); 219 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) );
220} 220}
221void KOCalEditView::readConfig() 221void KOCalEditView::readConfig()
222{ 222{
223 223
224 mStdandardB.clear(); 224 mStdandardB.clear();
225 mEnabledB.clear(); 225 mEnabledB.clear();
226 mAlarmB.clear(); 226 mAlarmB.clear();
227 mROB.clear(); 227 mROB.clear();
228 228
229 if ( mw ) delete mw; 229 if ( mw ) delete mw;
230 mw = new QWidget ( viewport() ); 230 mw = new QWidget ( viewport() );
231 addChild(mw); 231 addChild(mw);
232 int ii = 0; 232 int ii = 0;
233 mainLayout = new QGridLayout ( mw , 2, 8 ); 233 mainLayout = new QGridLayout ( mw , 2, 8 );
234 mainLayout->setMargin( 2 ); 234 mainLayout->setMargin( 2 );
235 mainLayout->setSpacing( 2 ); 235 mainLayout->setSpacing( 2 );
236 QPushButton * addBut = new QPushButton ( mw ); 236 QPushButton * addBut = new QPushButton ( mw );
237 addBut->setFocusPolicy(NoFocus); 237 addBut->setFocusPolicy(NoFocus);
238 mainLayout->addWidget( addBut,0,0 ); 238 mainLayout->addWidget( addBut,0,0 );
239 addBut->setPixmap ( SmallIcon("plus")); 239 addBut->setPixmap ( SmallIcon("greenhook16"));
240 connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
241 addBut->setMaximumWidth( addBut->sizeHint().height() ); 240 addBut->setMaximumWidth( addBut->sizeHint().height() );
242 int max = addBut->sizeHint().height(); 241 int max = addBut->sizeHint().height();
243 addBut = new QPushButton ( mw ); 242 addBut = new QPushButton ( mw );
244 addBut->setFocusPolicy(NoFocus); 243 addBut->setFocusPolicy(NoFocus);
245 mainLayout->addWidget( addBut,0,++ii ); 244 mainLayout->addWidget( addBut,0,++ii );
246 addBut->setPixmap ( SmallIcon("eye")); 245 addBut->setPixmap ( SmallIcon("eye"));
247 connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); 246 connect(addBut,SIGNAL(clicked()),SLOT(enableAll()));
248 addBut->setMaximumWidth( addBut->sizeHint().height() ); 247 addBut->setMaximumWidth( addBut->sizeHint().height() );
249 248
250 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); 249 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw );
251 mainLayout->addWidget( lab,0,++ii ); 250 mainLayout->addWidget( lab,0,++ii );
252 //lab = new QLabel ( i18n(" "), mw ); 251 //lab = new QLabel ( i18n(" "), mw );
253 //mainLayout->addWidget( lab,0,++ii ); 252 //mainLayout->addWidget( lab,0,++ii );
254 //lab->setFixedWidth( 1 ); 253 //lab->setFixedWidth( 1 );
255 addBut = new QPushButton ( mw ); 254 addBut = new QPushButton ( mw );
256 addBut->setFocusPolicy(NoFocus); 255 addBut->setFocusPolicy(NoFocus);
257 mainLayout->addWidget( addBut,0,++ii ); 256 mainLayout->addWidget( addBut,0,++ii );
258 addBut->setPixmap ( SmallIcon("bell")); 257 addBut->setPixmap ( SmallIcon("bell"));
259 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); 258 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm()));
260 addBut->setMaximumWidth( addBut->sizeHint().height() ); 259 addBut->setMaximumWidth( addBut->sizeHint().height() );
261 260
262 addBut = new QPushButton ( mw ); 261 addBut = new QPushButton ( mw );
263 addBut->setFocusPolicy(NoFocus); 262 addBut->setFocusPolicy(NoFocus);
264 mainLayout->addWidget( addBut,0,++ii ); 263 mainLayout->addWidget( addBut,0,++ii );
265 addBut->setPixmap ( SmallIcon("pencil")); 264 addBut->setPixmap ( SmallIcon("pencil"));
266 connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); 265 connect(addBut,SIGNAL(clicked()),SLOT(disableRO()));
267 addBut->setMaximumWidth( addBut->sizeHint().height() ); 266 addBut->setMaximumWidth( addBut->sizeHint().height() );
268
269 lab = new QLabel ( i18n(" Color "), mw );
270 mainLayout->addWidget( lab,0,++ii );
271 lab = new QLabel ( "", mw ); 267 lab = new QLabel ( "", mw );
272 mainLayout->addWidget( lab,0,++ii ); 268 mainLayout->addWidget( lab,0,++ii );
273 lab->setMaximumWidth( max+4 ); 269
274 lab = new QLabel ( "", mw ); 270 addBut = new QPushButton ( mw );
271 addBut->setFocusPolicy(NoFocus);
272 mainLayout->addWidget( addBut,0,++ii );
273 addBut->setPixmap ( SmallIcon("plus"));
274 connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
275
276 lab = new QLabel ( " ", mw );
275 mainLayout->addWidget( lab,0,++ii ); 277 mainLayout->addWidget( lab,0,++ii );
276 278
277 279
278#if 0 280#if 0
279 addBut = new QPushButton ( mw ); 281 addBut = new QPushButton ( mw );
280 mainLayout->addWidget( addBut,0,6 ); 282 mainLayout->addWidget( addBut,0,6 );
281 addBut->setPixmap ( SmallIcon("minus")); 283 addBut->setPixmap ( SmallIcon("minus"));
282 connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); 284 connect(addBut,SIGNAL(clicked()),SLOT(deleteAll()));
283 addBut->setMaximumWidth( addBut->sizeHint().height() ); 285 addBut->setMaximumWidth( addBut->sizeHint().height() );
284#endif 286#endif
285 287
286 288
287 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 289 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
288 int row = 1; 290 int row = 1;
289 while ( kkf ) { 291 while ( kkf ) {
290 int iii = 0; 292 int iii = 0;
291 KOCalCheckButton* cb = new KOCalCheckButton( mw ); 293 KOCalCheckButton* cb = new KOCalCheckButton( mw );
292 mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); 294 mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb );
293 cb->setChecked( kkf->isStandard ); 295 cb->setChecked( kkf->isStandard );
294 cb->setNum( kkf->mCalNumber ); 296 cb->setNum( kkf->mCalNumber );
295 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); 297 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) );
296 if ( kkf->mErrorOnLoad || kkf->isReadOnly ) 298 if ( kkf->mErrorOnLoad || kkf->isReadOnly )
297 cb->setEnabled( false ); 299 cb->setEnabled( false );
298 cb = new KOCalCheckButton( mw ); 300 cb = new KOCalCheckButton( mw );
299 mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); 301 mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb );
300 cb->setChecked( kkf->isEnabled ); 302 cb->setChecked( kkf->isEnabled );
301 cb->setNum( kkf->mCalNumber ); 303 cb->setNum( kkf->mCalNumber );
302 if ( kkf->mErrorOnLoad ) 304 if ( kkf->mErrorOnLoad )
303 cb->setEnabled( false ); 305 cb->setEnabled( false );
304 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); 306 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) );
305 KOCalButton* name = new KOCalButton( mw ); 307 KOCalButton* name = new KOCalButton( mw );
306 name->setNum( kkf->mCalNumber ); 308 name->setNum( kkf->mCalNumber );
307 name->setText( kkf->mName ); 309 name->setText( kkf->mName );
308 mainLayout->addWidget( name,row,++iii ); 310 mainLayout->addWidget( name,row,++iii );
309 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); 311 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) );
310 //lab = new QLabel (" ", mw ); 312 //lab = new QLabel (" ", mw );
311 //mainLayout->addWidget( lab,row,++iii ); 313 //mainLayout->addWidget( lab,row,++iii );
312 cb = new KOCalCheckButton( mw ); 314 cb = new KOCalCheckButton( mw );
313 mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); 315 mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb );
314 cb->setChecked( kkf->isAlarmEnabled ); 316 cb->setChecked( kkf->isAlarmEnabled );
315 cb->setNum( kkf->mCalNumber ); 317 cb->setNum( kkf->mCalNumber );
316 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); 318 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) );
317 if ( kkf->mErrorOnLoad ) 319 if ( kkf->mErrorOnLoad )
318 cb->setEnabled( false ); 320 cb->setEnabled( false );
319 cb = new KOCalCheckButton( mw ); 321 cb = new KOCalCheckButton( mw );
320 mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); 322 mainLayout->addWidget( cb,row,++iii );mROB.append( cb );
321 cb->setChecked( kkf->isReadOnly ); 323 cb->setChecked( kkf->isReadOnly );
322 cb->setNum( kkf->mCalNumber ); 324 cb->setNum( kkf->mCalNumber );
323 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); 325 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) );
324 if ( kkf->mErrorOnLoad ) 326 if ( kkf->mErrorOnLoad )
325 cb->setEnabled( false ); 327 cb->setEnabled( false );
326 if ( row > 1) { 328 if ( row > 1) {
327 KColorButton *colb = new KColorButton( mw ); 329 KColorButton *colb = new KColorButton( mw );
328 mainLayout->addWidget( colb,row,++iii ); 330 mainLayout->addWidget( colb,row,++iii );
329 colb->setID( kkf->mCalNumber ); 331 colb->setID( kkf->mCalNumber );
330 colb->setColor( kkf->mDefaultColor ); 332 colb->setColor( kkf->mDefaultColor );
331 connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); 333 connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) );
332 KOCalButton* calb = new KOCalButton( mw ); 334 KOCalButton* calb = new KOCalButton( mw );
333 mainLayout->addWidget( calb,row,++iii ); 335 mainLayout->addWidget( calb,row,++iii );
334 calb->setNum( kkf->mCalNumber ); 336 calb->setNum( kkf->mCalNumber );
335 calb->setPixmap ( SmallIcon("minus")); 337 calb->setPixmap ( SmallIcon("minus"));
336 connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); 338 connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) );
337 int hei = calb->sizeHint().height(); 339 int hei = calb->sizeHint().height();
338 //calb->setMaximumSize( hei*9/10, hei*9/10 ); 340 //calb->setMaximumSize( hei*9/10, hei*9/10 );
339 } 341 }
340 ++row; 342 ++row;
341 kkf = KOPrefs::instance()->mCalendars.next(); 343 kkf = KOPrefs::instance()->mCalendars.next();
342 } 344 }
343 lab = new QLabel ( "", mw ); 345 lab = new QLabel ( "", mw );
344 mainLayout->addWidget( lab,row,0 ); 346 mainLayout->addWidget( lab,row,0 );
345 mw->show(); 347 mw->show();
346 348
347} 349}
348void KOCalEditView::addCal() 350void KOCalEditView::addCal()
349{ 351{
350 bool tryagain = true; 352 bool tryagain = true;
351 QString name, file; 353 QString name, file;
352 while ( tryagain ) { 354 while ( tryagain ) {
353 KONewCalPrefs prefs ( this ); 355 KONewCalPrefs prefs ( this );
354 prefs.nameE->setText( name ); 356 prefs.nameE->setText( name );
355 prefs.url->setURL( file ); 357 prefs.url->setURL( file );
356 if ( ! prefs.exec() ) 358 if ( ! prefs.exec() )
357 return; 359 return;
358 name = prefs.calName(); 360 name = prefs.calName();
359 file = prefs.calFileName(); 361 file = prefs.calFileName();
360 tryagain = false; 362 tryagain = false;
361 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 363 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
362 while ( kkf ) { 364 while ( kkf ) {
363 if ( kkf->mName == name ) { 365 if ( kkf->mName == name ) {
364 KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); 366 KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) );
365 name = ""; 367 name = "";
366 tryagain = true; 368 tryagain = true;
367 break; 369 break;
368 } 370 }
369 if ( kkf->mFileName == file ) { 371 if ( kkf->mFileName == file ) {
370 KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) ); 372 KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) );
371 tryagain = true; 373 tryagain = true;
372 file = ""; 374 file = "";
373 break; 375 break;
374 } 376 }
375 kkf = KOPrefs::instance()->mCalendars.next(); 377 kkf = KOPrefs::instance()->mCalendars.next();
376 } 378 }
377 } 379 }
378 QFileInfo fi ( file ); 380 QFileInfo fi ( file );
379 if (!fi.exists() ) { 381 if (!fi.exists() ) {
380 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No ) 382 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No )
381 return; 383 return;
382 QFile fileIn( file ); 384 QFile fileIn( file );
383 if (!fileIn.open( IO_WriteOnly ) ) { 385 if (!fileIn.open( IO_WriteOnly ) ) {
384 KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); 386 KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) );
385 return; 387 return;
386 } 388 }
387 QTextStream tsIn( &fileIn ); 389 QTextStream tsIn( &fileIn );
388 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 390 tsIn.setCodec( QTextCodec::codecForName("utf8") );
389 tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; 391 tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n";
390 fileIn.close(); 392 fileIn.close();
391 } 393 }
392 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); 394 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar();
393 kkf->mName = name; 395 kkf->mName = name;
394 kkf->mFileName = file; 396 kkf->mFileName = file;
395 emit calendarAdded( kkf->mCalNumber ); 397 emit calendarAdded( kkf->mCalNumber );
396 emit needsUpdate(); 398 emit needsUpdate();
397 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 399 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
398} 400}
399void KOCalEditView::enableAll() 401void KOCalEditView::enableAll()
400{ 402{
401 toggleList( mEnabledB ); 403 toggleList( mEnabledB );
402} 404}
403void KOCalEditView::enableAlarm() 405void KOCalEditView::enableAlarm()
404{ 406{
405 toggleList( mAlarmB ); 407 toggleList( mAlarmB );
406} 408}
407void KOCalEditView::disableRO() 409void KOCalEditView::disableRO()
408{ 410{
409 toggleList( mROB ); 411 toggleList( mROB );
410} 412}
411void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) 413void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list )
412{ 414{
413 bool dis = false; 415 bool dis = false;
414 KOCalCheckButton* it = list.first(); 416 KOCalCheckButton* it = list.first();
415 while ( it ) { 417 while ( it ) {
416 if ( !it->isChecked() ) { 418 if ( !it->isChecked() ) {
417 dis = true; 419 dis = true;
418 break; 420 break;
419 } 421 }
420 it = list.next(); 422 it = list.next();
421 } 423 }
422 it = list.first(); 424 it = list.first();
423 while ( it ) { 425 while ( it ) {
424 it->setChecked(dis); 426 it->setChecked(dis);
425 it = list.next(); 427 it = list.next();
426 } 428 }
427} 429}
428void KOCalEditView::deleteAll() 430void KOCalEditView::deleteAll()
429{ 431{
430 qDebug("delteAll"); 432 qDebug("delteAll");
431} 433}