summaryrefslogtreecommitdiffabout
path: root/korganizer/kofilterview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/kofilterview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kofilterview.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index e4dc751..bb88386 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -150,109 +150,109 @@ void KOCalEditView::selectStdCal( int id, bool b )
while ( it ) {
if ( it->isChecked() ) {
if ( it != sen ) {
it->blockSignals( true );
it->setChecked( false );
it->blockSignals( false );
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;
+ 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;
if ( kkf->isStandard )
selectStdCal( 1, true );
emit removeCalendar ( id );
KOPrefs::instance()->mCalendars.remove ( kkf );
emit needsUpdate();
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;
+ 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() ) );
}
}
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);
mainLayout = new QGridLayout ( mw , 2, 8 );
mainLayout->setMargin( 3);
mainLayout->setSpacing( 2);
QPushButton * addBut = new QPushButton ( mw );
addBut->setFocusPolicy(NoFocus);
mainLayout->addWidget( addBut,0,0 );
addBut->setPixmap ( SmallIcon("plus"));
connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
addBut->setMaximumWidth( addBut->sizeHint().height() );
addBut = new QPushButton ( mw );
addBut->setFocusPolicy(NoFocus);
mainLayout->addWidget( addBut,0,1 );
addBut->setPixmap ( SmallIcon("eye"));
connect(addBut,SIGNAL(clicked()),SLOT(enableAll()));
addBut->setMaximumWidth( addBut->sizeHint().height() );
QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw );
mainLayout->addWidget( lab,0,2 );
lab = new QLabel ( i18n(" "), mw );
mainLayout->addWidget( lab,0,3 );
lab->setFixedWidth( 6 );
addBut = new QPushButton ( mw );
addBut->setFocusPolicy(NoFocus);
mainLayout->addWidget( addBut,0,4 );
addBut->setPixmap ( SmallIcon("bell"));
@@ -315,97 +315,97 @@ void KOCalEditView::readConfig()
cb->setNum( kkf->mCalNumber );
connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) );
if ( kkf->mErrorOnLoad )
cb->setEnabled( false );
if ( row > 1) {
KColorButton *colb = new KColorButton( mw );
mainLayout->addWidget( colb,row,++iii );
colb->setID( kkf->mCalNumber );
colb->setColor( kkf->mDefaultColor );
connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) );
KOCalButton* calb = new KOCalButton( mw );
mainLayout->addWidget( calb,row,++iii );
calb->setNum( kkf->mCalNumber );
calb->setPixmap ( SmallIcon("minus"));
connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) );
int hei = calb->sizeHint().height();
//calb->setMaximumSize( hei*9/10, hei*9/10 );
}
++row;
kkf = KOPrefs::instance()->mCalendars.next();
}
lab = new QLabel ( "", mw );
mainLayout->addWidget( lab,row,0 );
mw->show();
}
void KOCalEditView::addCal()
{
bool tryagain = true;
QString name, file;
while ( tryagain ) {
KONewCalPrefs prefs ( this );
prefs.nameE->setText( name );
prefs.url->setURL( file );
if ( ! prefs.exec() )
return;
name = prefs.calName();
file = prefs.calFileName();
tryagain = false;
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
while ( kkf ) {
if ( kkf->mName == name ) {
KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) );
name = "";
tryagain = true;
break;
}
if ( kkf->mFileName == file ) {
- KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( file) );
+ KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) );
tryagain = true;
file = "";
break;
}
kkf = KOPrefs::instance()->mCalendars.next();
}
}
QFileInfo fi ( file );
if (!fi.exists() ) {
if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No )
return;
QFile fileIn( file );
if (!fileIn.open( IO_WriteOnly ) ) {
KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) );
return;
}
QTextStream tsIn( &fileIn );
tsIn.setCodec( QTextCodec::codecForName("utf8") );
tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n";
fileIn.close();
}
KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar();
kkf->mName = name;
kkf->mFileName = file;
emit calendarAdded( kkf->mCalNumber );
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;