summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-02 19:17:50 (UTC)
committer zautrix <zautrix>2005-07-02 19:17:50 (UTC)
commit8cde05e63c63af0f3ad8048d7160798439125d43 (patch) (side-by-side diff)
tree4f1cca2213626931c0cf63eaa99bda0e31e4d330
parent27c100807f471a63d91ee08bdba3549d3a0cff8c (diff)
downloadkdepimpi-8cde05e63c63af0f3ad8048d7160798439125d43.zip
kdepimpi-8cde05e63c63af0f3ad8048d7160798439125d43.tar.gz
kdepimpi-8cde05e63c63af0f3ad8048d7160798439125d43.tar.bz2
nochn fixx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kofilterview.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 3f08ef8..ff80afc 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -96,230 +96,230 @@ void KOFilterView::setSelectedFilter(QString filterName)
for (i=0;i<filter_num;i++) {
if (mSelectionCombo->text(i)==filterName)
mSelectionCombo->setCurrentItem(i);
}
emit filterChanged();
}
void KOFilterView::setSelectedFilter( int fil )
{
if ( fil >= mSelectionCombo->count() )
return;
mSelectionCombo->setCurrentItem( fil );
emit filterChanged();
}
KOCalEditView::KOCalEditView(QWidget* parent,
const char* name )
: QScrollView(parent,name)
{
mw = 0;
setResizePolicy( AutoOneFit );
setFrameStyle ( QFrame::Panel | QFrame::Plain );
setLineWidth ( 1 );
setMidLineWidth ( 1 );
setFocusPolicy(NoFocus);
}
KOCalEditView::~KOCalEditView()
{
// no need to delete child widgets, Qt does it all for us
}
void KOCalEditView::selectCal(int id ,bool b)
{
KOPrefs::instance()->getCalendar( id )->isEnabled = b;
emit calendarEnabled ( id, b );
emit needsUpdate();
}
void KOCalEditView::selectStdCal( int id )
{
KOCalRadioButton* it = mStdandardB.first();
while ( it ) {
it->blockSignals( true );
it->setChecked( it->num() == id );
it->blockSignals( false );
it = mStdandardB.next();
}
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
while ( kkf ) {
kkf->isStandard = (kkf->mCalNumber == id );
kkf = KOPrefs::instance()->mCalendars.next();
}
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 )
{
+
+ emit calendarReadonly ( id , b );
+ KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
if ( KOPrefs::instance()->getCalendar( id )->isStandard && b ) {
findNewStandard();
- } else {
- if ( !b ){
- KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
- while ( kkf ) {
- if (kkf->isReadOnly && kkf->isStandard ) {
- selectStdCal( id );
- break;
- }
- kkf = KOPrefs::instance()->mCalendars.next();
+ }
+ if ( !b ){
+ KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
+ while ( kkf ) {
+ if (kkf->isReadOnly && kkf->isStandard ) {
+ selectStdCal( id );
+ break;
}
+ kkf = KOPrefs::instance()->mCalendars.next();
}
}
+
mStdandardB.at(id-1)->setEnabled( !b );
- emit calendarReadonly ( id , b );
- KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
emit needsUpdate();
}
void KOCalEditView::findNewStandard()
{
bool found = false;
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
while ( kkf ) {
if (!kkf->isReadOnly && !kkf->mErrorOnLoad ) {
found = true;
selectStdCal( kkf->mCalNumber );
break;
}
kkf = KOPrefs::instance()->mCalendars.next();
}
if ( !found ) {
KMessageBox::error( this,i18n("\nNO\n WRITEABLE\n CALENDAR\n FOUND!\n\nPlease fix your calendar settings!\n"),
i18n("Houston, we have a problem!") );
}
}
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 = KGlobal::formatMessage ( kkf->mFileName ,0 );
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;
bool findnewstd = kkf->isStandard;
emit removeCalendar ( id );
KOPrefs::instance()->mCalendars.remove ( kkf );
if ( findnewstd ) findNewStandard();
emit needsUpdate();
QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
}
void KOCalEditView::infoCal( int id )
{
QString name = KOPrefs::instance()->getCalendar( id )->mName;
QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 );
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 );
emit needsUpdate();
QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) );
}
}
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 ( viewport() );
addChild(mw);
int ii = 0;
mainLayout = new QGridLayout ( mw , 2, 8 );
mainLayout->setMargin( 2 );
mainLayout->setSpacing( 2 );
- QPushButton * addBut = new QPushButton ( mw );
- addBut->setFocusPolicy(NoFocus);
- mainLayout->addWidget( addBut,0,0 );
- addBut->setText( "D");
- connect(addBut,SIGNAL(clicked()),SLOT(defaultInfo()));
+ QPushButton * addButT = new QPushButton ( mw );
+ addButT->setFocusPolicy(NoFocus);
+ mainLayout->addWidget( addButT,0,0 );
+ addButT->setText( "D");
+ connect(addButT,SIGNAL(clicked()),SLOT(defaultInfo()));
//addBut->setPixmap ( SmallIcon("greenhook16"));
- addBut->setMaximumWidth( addBut->sizeHint().height() );
- int max = addBut->sizeHint().height();
- addBut = new QPushButton ( mw );
+ QPushButton *addBut = new QPushButton ( mw );
addBut->setFocusPolicy(NoFocus);
mainLayout->addWidget( addBut,0,++ii );
addBut->setPixmap ( SmallIcon("eye"));
connect(addBut,SIGNAL(clicked()),SLOT(enableAll()));
- addBut->setMaximumWidth( addBut->sizeHint().height() );
-
+ int max = addBut->sizeHint().height();
+ addBut->setMaximumWidth( max );
+ addButT->setFixedSize( QSize( max, max ) );
QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw );
mainLayout->addWidget( lab,0,++ii );
//lab = new QLabel ( i18n(" "), mw );
//mainLayout->addWidget( lab,0,++ii );
//lab->setFixedWidth( 1 );
addBut = new QPushButton ( mw );
addBut->setFocusPolicy(NoFocus);
mainLayout->addWidget( addBut,0,++ii );
addBut->setPixmap ( SmallIcon("bell"));
connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm()));
addBut->setMaximumWidth( addBut->sizeHint().height() );
addBut = new QPushButton ( mw );
addBut->setFocusPolicy(NoFocus);
mainLayout->addWidget( addBut,0,++ii );
addBut->setPixmap ( SmallIcon("pencil"));
connect(addBut,SIGNAL(clicked()),SLOT(disableRO()));
addBut->setMaximumWidth( addBut->sizeHint().height() );
lab = new QLabel ( "", mw );
mainLayout->addWidget( lab,0,++ii );
addBut = new QPushButton ( mw );
addBut->setFocusPolicy(NoFocus);
mainLayout->addWidget( addBut,0,++ii );
addBut->setPixmap ( SmallIcon("plus"));
connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
lab = new QLabel ( " ", mw );
mainLayout->addWidget( lab,0,++ii );
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
int row = 1;
bool errorLoadStandard = false;
while ( kkf ) {
int iii = 0;
KOCalRadioButton* rb = new KOCalRadioButton( mw );
mainLayout->addWidget( rb,row,0 );mStdandardB.append( rb );
rb->setChecked( kkf->isStandard );
if ( kkf->isStandard && ( kkf->mErrorOnLoad || kkf->isReadOnly ) )
errorLoadStandard = true;
rb->setNum( kkf->mCalNumber );
connect (rb, SIGNAL (selectNum(int)), SLOT ( selectStdCal(int) ) );
if ( kkf->mErrorOnLoad || kkf->isReadOnly )
rb->setEnabled( false );
KOCalCheckButton* cb = new KOCalCheckButton( mw );
mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb );
cb->setChecked( kkf->isEnabled && !kkf->mErrorOnLoad );
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,++iii );
connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) );
//lab = new QLabel (" ", mw );
//mainLayout->addWidget( lab,row,++iii );
cb = new KOCalCheckButton( mw );
mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb );
cb->setChecked( kkf->isAlarmEnabled && !kkf->mErrorOnLoad);
cb->setNum( kkf->mCalNumber );
connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) );