summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kofilterview.cpp14
-rw-r--r--korganizer/kofilterview.h2
2 files changed, 11 insertions, 5 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 9633b2c..3333ac2 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -197,54 +197,60 @@ void KOCalEditView::selectStdCal( int id, bool b )
197} 197}
198 198
199void KOCalEditView::selectCalAlarm(int id ,bool b ) 199void 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}
205void KOCalEditView::selectReadOnly(int id ,bool b ) 205void 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 if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) {
210 KOPrefs::instance()->getCalendar( id )->isStandard = false;
211 KOPrefs::instance()->getCalendar( 1 )->isStandard = true;
212 emit setCalendarDefault ( 1 );
213 }
209 emit needsUpdate(); 214 emit needsUpdate();
215 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
210 216
211} 217}
212void KOCalEditView::setColor( const QColor& c, int id ) 218void KOCalEditView::setColor( const QColor& c, int id )
213{ 219{
214 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; 220 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c;
215 emit needsUpdate(); 221 emit needsUpdate();
216} 222}
217void KOCalEditView::deleteCal( int id ) 223void KOCalEditView::deleteCal( int id )
218{ 224{
219 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); 225 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id );
220 QString name = kkf->mName; 226 QString name = kkf->mName;
221 QString file = kkf->mFileName; 227 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; 228 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 ) 229 if ( kkf->isStandard )
224 selectStdCal( 1, true ); 230 selectStdCal( 1, true );
225 emit removeCalendar ( id ); 231 emit removeCalendar ( id );
226 KOPrefs::instance()->mCalendars.remove ( kkf ); 232 KOPrefs::instance()->mCalendars.remove ( kkf );
227 emit needsUpdate(); 233 emit needsUpdate();
228 readConfig(); 234 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
229} 235}
230void KOCalEditView::infoCal( int id ) 236void KOCalEditView::infoCal( int id )
231{ 237{
232 QString name = KOPrefs::instance()->getCalendar( id )->mName; 238 QString name = KOPrefs::instance()->getCalendar( id )->mName;
233 QString file = KOPrefs::instance()->getCalendar( id )->mFileName; 239 QString file = KOPrefs::instance()->getCalendar( id )->mFileName;
234 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { 240 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) {
235 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) ) ) { 241 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) ) ) {
236 emit calendarAdded( id ); 242 emit calendarAdded( id );
237 readConfig();
238 emit needsUpdate(); 243 emit needsUpdate();
244 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
239 } 245 }
240 } 246 }
241 else 247 else
242 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); 248 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) );
243} 249}
244void KOCalEditView::readConfig() 250void KOCalEditView::readConfig()
245{ 251{
246 252
247 mStdandardB.clear(); 253 mStdandardB.clear();
248 mEnabledB.clear(); 254 mEnabledB.clear();
249 mAlarmB.clear(); 255 mAlarmB.clear();
250 mROB.clear(); 256 mROB.clear();
@@ -293,25 +299,25 @@ void KOCalEditView::readConfig()
293#endif 299#endif
294 300
295 301
296 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 302 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
297 int row = 1; 303 int row = 1;
298 while ( kkf ) { 304 while ( kkf ) {
299 305
300 KOCalCheckButton* cb = new KOCalCheckButton( mw ); 306 KOCalCheckButton* cb = new KOCalCheckButton( mw );
301 mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); 307 mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb );
302 cb->setChecked( kkf->isStandard ); 308 cb->setChecked( kkf->isStandard );
303 cb->setNum( kkf->mCalNumber ); 309 cb->setNum( kkf->mCalNumber );
304 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); 310 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) );
305 if ( kkf->mErrorOnLoad ) 311 if ( kkf->mErrorOnLoad || kkf->isReadOnly )
306 cb->setEnabled( false ); 312 cb->setEnabled( false );
307 cb = new KOCalCheckButton( mw ); 313 cb = new KOCalCheckButton( mw );
308 mainLayout->addWidget( cb,row,1 );mEnabledB.append( cb ); 314 mainLayout->addWidget( cb,row,1 );mEnabledB.append( cb );
309 cb->setChecked( kkf->isEnabled ); 315 cb->setChecked( kkf->isEnabled );
310 cb->setNum( kkf->mCalNumber ); 316 cb->setNum( kkf->mCalNumber );
311 if ( kkf->mErrorOnLoad ) 317 if ( kkf->mErrorOnLoad )
312 cb->setEnabled( false ); 318 cb->setEnabled( false );
313 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); 319 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) );
314 KOCalButton* name = new KOCalButton( mw ); 320 KOCalButton* name = new KOCalButton( mw );
315 name->setNum( kkf->mCalNumber ); 321 name->setNum( kkf->mCalNumber );
316 name->setText( kkf->mName ); 322 name->setText( kkf->mName );
317 mainLayout->addWidget( name,row,2 ); 323 mainLayout->addWidget( name,row,2 );
@@ -359,26 +365,26 @@ void KOCalEditView::addCal()
359 return; 365 return;
360 QString name = prefs.calName(); 366 QString name = prefs.calName();
361 QString file = prefs.calFileName(); 367 QString file = prefs.calFileName();
362 QFileInfo fi ( file ); 368 QFileInfo fi ( file );
363 if (!fi.exists() ) { 369 if (!fi.exists() ) {
364 KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); 370 KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!"));
365 return; 371 return;
366 } 372 }
367 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); 373 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar();
368 kkf->mName = name; 374 kkf->mName = name;
369 kkf->mFileName = file; 375 kkf->mFileName = file;
370 emit calendarAdded( kkf->mCalNumber ); 376 emit calendarAdded( kkf->mCalNumber );
371 readConfig();
372 emit needsUpdate(); 377 emit needsUpdate();
378 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
373} 379}
374void KOCalEditView::enableAll() 380void KOCalEditView::enableAll()
375{ 381{
376 toggleList( mEnabledB ); 382 toggleList( mEnabledB );
377} 383}
378void KOCalEditView::enableAlarm() 384void KOCalEditView::enableAlarm()
379{ 385{
380 toggleList( mAlarmB ); 386 toggleList( mAlarmB );
381} 387}
382void KOCalEditView::disableRO() 388void KOCalEditView::disableRO()
383{ 389{
384 toggleList( mROB ); 390 toggleList( mROB );
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h
index 4a0cd8a..1849e36 100644
--- a/korganizer/kofilterview.h
+++ b/korganizer/kofilterview.h
@@ -108,38 +108,38 @@ class KOFilterView : public KOFilterView_base
108 108
109 private: 109 private:
110 QPtrList<CalFilter> *mFilters; 110 QPtrList<CalFilter> *mFilters;
111}; 111};
112 112
113class KOCalEditView : public QWidget 113class KOCalEditView : public QWidget
114{ 114{
115 Q_OBJECT 115 Q_OBJECT
116 public: 116 public:
117 KOCalEditView( QWidget* parent=0,const char* name=0); 117 KOCalEditView( QWidget* parent=0,const char* name=0);
118 ~KOCalEditView(); 118 ~KOCalEditView();
119 119
120 void readConfig();
121 public slots: 120 public slots:
122 void addCal(); 121 void addCal();
123 void enableAll(); 122 void enableAll();
124 void enableAlarm(); 123 void enableAlarm();
125 void disableRO(); 124 void disableRO();
126 void deleteAll(); 125 void deleteAll();
127 void selectStdCal(int,bool ); 126 void selectStdCal(int,bool );
128 void selectCal(int,bool ); 127 void selectCal(int,bool );
129 void selectCalAlarm(int,bool ); 128 void selectCalAlarm(int,bool );
130 void selectReadOnly(int,bool ); 129 void selectReadOnly(int,bool );
131 void setColor(const QColor &,int) ; 130 void setColor(const QColor &,int) ;
132 void deleteCal(int) ; 131 void deleteCal(int) ;
133 void infoCal(int) ; 132 void infoCal(int) ;
133 void readConfig();
134 signals: 134 signals:
135 void alarmEnabled ( int cal, bool enable ); 135 void alarmEnabled ( int cal, bool enable );
136 void calendarEnabled ( int cal, bool enable ); 136 void calendarEnabled ( int cal, bool enable );
137 void calendarReadonly ( int cal, bool readonly ); 137 void calendarReadonly ( int cal, bool readonly );
138 void setCalendarDefault ( int cal ); 138 void setCalendarDefault ( int cal );
139 void removeCalendar ( int cal ); 139 void removeCalendar ( int cal );
140 void calendarAdded( int ); 140 void calendarAdded( int );
141 void needsUpdate(); 141 void needsUpdate();
142 142
143 private: 143 private:
144 QVBoxLayout* ml; 144 QVBoxLayout* ml;
145 QWidget *mw; 145 QWidget *mw;