summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-16 06:30:09 (UTC)
committer zautrix <zautrix>2005-06-16 06:30:09 (UTC)
commit9f60da2b6768e94d2aeb2f94a4479b6678f2aa76 (patch) (unidiff)
treeeea4e7ee02afc86a543c142efa7b5c8c83e0f1f8
parentb8b1547f1f4ae54ace16e5faf55aad1274ec2e57 (diff)
downloadkdepimpi-9f60da2b6768e94d2aeb2f94a4479b6678f2aa76.zip
kdepimpi-9f60da2b6768e94d2aeb2f94a4479b6678f2aa76.tar.gz
kdepimpi-9f60da2b6768e94d2aeb2f94a4479b6678f2aa76.tar.bz2
fixxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kofilterview.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 36ee2eb..e4dc751 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -193,33 +193,33 @@ void KOCalEditView::setColor( const QColor& c, int id )
193} 193}
194void KOCalEditView::deleteCal( int id ) 194void KOCalEditView::deleteCal( int id )
195{ 195{
196 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); 196 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id );
197 QString name = kkf->mName; 197 QString name = kkf->mName;
198 QString file = kkf->mFileName; 198 QString file = kkf->mFileName;
199 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar<tr><b>%1</b><tr>is displaying file<tr><b>%2</b><tr>Do you want to remove<tr>this calendar from KO/Pi?<tr>(The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; 199 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;
200 if ( kkf->isStandard ) 200 if ( kkf->isStandard )
201 selectStdCal( 1, true ); 201 selectStdCal( 1, true );
202 emit removeCalendar ( id ); 202 emit removeCalendar ( id );
203 KOPrefs::instance()->mCalendars.remove ( kkf ); 203 KOPrefs::instance()->mCalendars.remove ( kkf );
204 emit needsUpdate(); 204 emit needsUpdate();
205 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 205 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
206} 206}
207void KOCalEditView::infoCal( int id ) 207void KOCalEditView::infoCal( int id )
208{ 208{
209 QString name = KOPrefs::instance()->getCalendar( id )->mName; 209 QString name = KOPrefs::instance()->getCalendar( id )->mName;
210 QString file = KOPrefs::instance()->getCalendar( id )->mFileName; 210 QString file = KOPrefs::instance()->getCalendar( id )->mFileName;
211 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { 211 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) {
212 if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <tr><b>%1</b><tr> is not loaded! Loading of file <tr><b>%2</b><tr>failed!<tr><b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { 212 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) ) ) {
213 emit calendarAdded( id ); 213 emit calendarAdded( id );
214 emit needsUpdate(); 214 emit needsUpdate();
215 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 215 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
216 } 216 }
217 } 217 }
218 else 218 else
219 KMessageBox::information( this, i18n("The calendar <tr><b>%1</b><tr>is displaying file<tr><b>%2</b>").arg(name).arg(file) ); 219 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) );
220} 220}
221void KOCalEditView::readConfig() 221void KOCalEditView::readConfig()
222{ 222{
223 223
224 mStdandardB.clear(); 224 mStdandardB.clear();
225 mEnabledB.clear(); 225 mEnabledB.clear();
@@ -341,42 +341,43 @@ void KOCalEditView::readConfig()
341void KOCalEditView::addCal() 341void KOCalEditView::addCal()
342{ 342{
343 bool tryagain = true; 343 bool tryagain = true;
344 QString name, file; 344 QString name, file;
345 while ( tryagain ) { 345 while ( tryagain ) {
346 KONewCalPrefs prefs ( this ); 346 KONewCalPrefs prefs ( this );
347 if ( !name.isEmpty() ) prefs.nameE->setText( name ); 347 prefs.nameE->setText( name );
348 if ( !file.isEmpty() ) prefs.url->setURL( file ); 348 prefs.url->setURL( file );
349 if ( ! prefs.exec() ) 349 if ( ! prefs.exec() )
350 return; 350 return;
351 name = prefs.calName(); 351 name = prefs.calName();
352 file = prefs.calFileName(); 352 file = prefs.calFileName();
353 tryagain = false; 353 tryagain = false;
354 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 354 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
355 while ( kkf ) { 355 while ( kkf ) {
356 if ( kkf->mName == name ) { 356 if ( kkf->mName == name ) {
357 KMessageBox::information( this, i18n("Sorry, the calendar name already exists!\nPlease choose another name!") ); 357 KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) );
358 name = ""; 358 name = "";
359 tryagain = true;
359 break; 360 break;
360 tryagain = true;
361 } 361 }
362 if ( kkf->mFileName == file ) { 362 if ( kkf->mFileName == file ) {
363 363 KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( file) );
364 break;
365 tryagain = true; 364 tryagain = true;
365 file = "";
366 break;
366 } 367 }
367 kkf = KOPrefs::instance()->mCalendars.next(); 368 kkf = KOPrefs::instance()->mCalendars.next();
368 } 369 }
369 } 370 }
370 QFileInfo fi ( file ); 371 QFileInfo fi ( file );
371 if (!fi.exists() ) { 372 if (!fi.exists() ) {
372 if ( KMessageBox::questionYesNo(this, i18n("The file does not exist!\nShall I create it for you?")) == KMessageBox::No ) 373 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No )
373 return; 374 return;
374 QFile fileIn( file ); 375 QFile fileIn( file );
375 if (!fileIn.open( IO_WriteOnly ) ) { 376 if (!fileIn.open( IO_WriteOnly ) ) {
376 KMessageBox::sorry( this, i18n("Sorry, cannot create the file!\nNo calendar added!") ); 377 KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) );
377 return; 378 return;
378 } 379 }
379 QTextStream tsIn( &fileIn ); 380 QTextStream tsIn( &fileIn );
380 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 381 tsIn.setCodec( QTextCodec::codecForName("utf8") );
381 tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; 382 tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n";
382 fileIn.close(); 383 fileIn.close();