summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kofilterview.cpp4
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
@@ -146,238 +146,238 @@ 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
153KOCalEditView::~KOCalEditView() 153KOCalEditView::~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}
157void KOCalEditView::selectCal(int id ,bool b) 157void 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}
163void KOCalEditView::selectStdCal( int id, bool b ) 163void 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
198void KOCalEditView::selectCalAlarm(int id ,bool b ) 198void 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}
203void KOCalEditView::selectReadOnly(int id ,bool b ) 203void 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}
209void KOCalEditView::setColor( const QColor& c, int id ) 209void 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}
213void KOCalEditView::deleteCal( int id ) 213void 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}
223void KOCalEditView::infoCal( int id ) 223void 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}
229void KOCalEditView::readConfig() 229void 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}
332void KOCalEditView::addCal() 332void 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}
351void KOCalEditView::enableAll() 351void KOCalEditView::enableAll()
352{ 352{
353 toggleList( mEnabledB ); 353 toggleList( mEnabledB );
354} 354}
355void KOCalEditView::enableAlarm() 355void KOCalEditView::enableAlarm()
356{ 356{
357 toggleList( mAlarmB ); 357 toggleList( mAlarmB );
358} 358}
359void KOCalEditView::disableRO() 359void KOCalEditView::disableRO()
360{ 360{
361 toggleList( mROB ); 361 toggleList( mROB );
362} 362}
363void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) 363void 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}
380void KOCalEditView::deleteAll() 380void KOCalEditView::deleteAll()
381{ 381{
382 qDebug("delteAll"); 382 qDebug("delteAll");
383} 383}