summaryrefslogtreecommitdiffabout
path: root/korganizer/kofilterview.cpp
authorzautrix <zautrix>2005-06-14 09:10:19 (UTC)
committer zautrix <zautrix>2005-06-14 09:10:19 (UTC)
commitbd2fd522c0ba5c5a7897df0941032a9af9842dfc (patch) (side-by-side diff)
treed76d64810cbcde88f0b56d5924ac4dd52e9abe13 /korganizer/kofilterview.cpp
parent1dccb9dd9ea32989ecec33c72a3ebd873dce048e (diff)
downloadkdepimpi-bd2fd522c0ba5c5a7897df0941032a9af9842dfc.zip
kdepimpi-bd2fd522c0ba5c5a7897df0941032a9af9842dfc.tar.gz
kdepimpi-bd2fd522c0ba5c5a7897df0941032a9af9842dfc.tar.bz2
fixxeess
Diffstat (limited to 'korganizer/kofilterview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kofilterview.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 9633b2c..3333ac2 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -185,78 +185,84 @@ void KOCalEditView::selectStdCal( int id, bool b )
break;
}
}
it = mStdandardB.next();
}
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
while ( kkf ) {
kkf->isStandard = false;
kkf = KOPrefs::instance()->mCalendars.next();
}
KOPrefs::instance()->getCalendar( id )->isStandard = true;
emit setCalendarDefault ( id );
}
void KOCalEditView::selectCalAlarm(int id ,bool b )
{
KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b;
emit alarmEnabled ( id , b );
emit needsUpdate();
}
void KOCalEditView::selectReadOnly(int id ,bool b )
{
KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
emit calendarReadonly ( id , b );
+ if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) {
+ KOPrefs::instance()->getCalendar( id )->isStandard = false;
+ KOPrefs::instance()->getCalendar( 1 )->isStandard = true;
+ emit setCalendarDefault ( 1 );
+ }
emit needsUpdate();
+ QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
}
void KOCalEditView::setColor( const QColor& c, int id )
{
KOPrefs::instance()->getCalendar( id )->mDefaultColor = c;
emit needsUpdate();
}
void KOCalEditView::deleteCal( int id )
{
KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id );
QString name = kkf->mName;
QString file = kkf->mFileName;
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;
if ( kkf->isStandard )
selectStdCal( 1, true );
emit removeCalendar ( id );
KOPrefs::instance()->mCalendars.remove ( kkf );
emit needsUpdate();
- readConfig();
+ QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
}
void KOCalEditView::infoCal( int id )
{
QString name = KOPrefs::instance()->getCalendar( id )->mName;
QString file = KOPrefs::instance()->getCalendar( id )->mFileName;
if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) {
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) ) ) {
emit calendarAdded( id );
- readConfig();
emit needsUpdate();
+ QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
}
}
else
KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) );
}
void KOCalEditView::readConfig()
{
mStdandardB.clear();
mEnabledB.clear();
mAlarmB.clear();
mROB.clear();
if ( mw ) delete mw;
mw = new QWidget ( this );
ml->addWidget ( mw );
mainLayout = new QGridLayout ( mw , 2, 8 );
//mainLayout->setSpacing( 3 );
QPushButton * addBut = new QPushButton ( mw );
mainLayout->addWidget( addBut,0,0 );
addBut->setPixmap ( SmallIcon("plus"));
connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
addBut->setMaximumWidth( addBut->sizeHint().height() );
@@ -281,49 +287,49 @@ void KOCalEditView::readConfig()
addBut->setPixmap ( SmallIcon("pencil"));
connect(addBut,SIGNAL(clicked()),SLOT(disableRO()));
addBut->setMaximumWidth( addBut->sizeHint().height() );
lab = new QLabel ( i18n(" Color "), mw );
mainLayout->addWidget( lab,0,5 );
#if 0
addBut = new QPushButton ( mw );
mainLayout->addWidget( addBut,0,6 );
addBut->setPixmap ( SmallIcon("minus"));
connect(addBut,SIGNAL(clicked()),SLOT(deleteAll()));
addBut->setMaximumWidth( addBut->sizeHint().height() );
#endif
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
int row = 1;
while ( kkf ) {
KOCalCheckButton* cb = new KOCalCheckButton( mw );
mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb );
cb->setChecked( kkf->isStandard );
cb->setNum( kkf->mCalNumber );
connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) );
- if ( kkf->mErrorOnLoad )
+ if ( kkf->mErrorOnLoad || kkf->isReadOnly )
cb->setEnabled( false );
cb = new KOCalCheckButton( mw );
mainLayout->addWidget( cb,row,1 );mEnabledB.append( cb );
cb->setChecked( kkf->isEnabled );
cb->setNum( kkf->mCalNumber );
if ( kkf->mErrorOnLoad )
cb->setEnabled( false );
connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) );
KOCalButton* name = new KOCalButton( mw );
name->setNum( kkf->mCalNumber );
name->setText( kkf->mName );
mainLayout->addWidget( name,row,2 );
connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) );
cb = new KOCalCheckButton( mw );
mainLayout->addWidget( cb,row,3 );mAlarmB.append( cb );
cb->setChecked( kkf->isAlarmEnabled );
cb->setNum( kkf->mCalNumber );
connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) );
if ( kkf->mErrorOnLoad )
cb->setEnabled( false );
cb = new KOCalCheckButton( mw );
mainLayout->addWidget( cb,row,4 );mROB.append( cb );
cb->setChecked( kkf->isReadOnly );
cb->setNum( kkf->mCalNumber );
@@ -347,50 +353,50 @@ void KOCalEditView::readConfig()
++row;
kkf = KOPrefs::instance()->mCalendars.next();
}
lab = new QLabel ( "", mw );
mainLayout->addWidget( lab,row,0 );
mw->show();
}
void KOCalEditView::addCal()
{
KONewCalPrefs prefs ( this );
if ( ! prefs.exec() )
return;
QString name = prefs.calName();
QString file = prefs.calFileName();
QFileInfo fi ( file );
if (!fi.exists() ) {
KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!"));
return;
}
KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar();
kkf->mName = name;
kkf->mFileName = file;
emit calendarAdded( kkf->mCalNumber );
- readConfig();
emit needsUpdate();
+ QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
}
void KOCalEditView::enableAll()
{
toggleList( mEnabledB );
}
void KOCalEditView::enableAlarm()
{
toggleList( mAlarmB );
}
void KOCalEditView::disableRO()
{
toggleList( mROB );
}
void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list )
{
bool dis = false;
KOCalCheckButton* it = list.first();
while ( it ) {
if ( !it->isChecked() ) {
dis = true;
break;
}
it = list.next();
}