00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <qlayout.h>
00027 #include <qlabel.h>
00028 #include <qgroupbox.h>
00029 #include <qbuttongroup.h>
00030 #include <qlineedit.h>
00031 #include <qslider.h>
00032 #include <qfile.h>
00033 #include <qcombobox.h>
00034 #include <qhbox.h>
00035 #include <qvbox.h>
00036 #include <qgrid.h>
00037 #include <qspinbox.h>
00038 #include <qcheckbox.h>
00039 #include <qradiobutton.h>
00040 #include <qpushbutton.h>
00041 #include <qstrlist.h>
00042 #include <qlistview.h>
00043 #include <qtabwidget.h>
00044 #include <qwhatsthis.h>
00045
00046 #include <kcolorbutton.h>
00047 #include <kdebug.h>
00048 #include <klocale.h>
00049 #include <kglobal.h>
00050 #include <kmessagebox.h>
00051 #include <kiconloader.h>
00052 #include <kemailsettings.h>
00053 #include <kcalendarsystem.h>
00054 #include <ktrader.h>
00055 #include <kpushbutton.h>
00056 #include <kocore.h>
00057 #include <libkcal/calendarresources.h>
00058 #include <kstandarddirs.h>
00059 #include <ksimpleconfig.h>
00060 #include <kholidays.h>
00061
00062 #if defined(USE_SOLARIS)
00063 #include <sys/param.h>
00064
00065 #define ZONEINFODIR "/usr/share/lib/zoneinfo"
00066 #define INITFILE "/etc/default/init"
00067 #endif
00068
00069 #include "koprefs.h"
00070
00071 #include "koprefsdialog.h"
00072 #include "kogroupwareprefspage.h"
00073 #include "ktimeedit.h"
00074 #include "koglobals.h"
00075 #include "stdcalendar.h"
00076 #include <kdepimmacros.h>
00077
00078
00079 KOPrefsDialogMain::KOPrefsDialogMain( QWidget *parent, const char *name )
00080 : KPrefsModule( KOPrefs::instance(), parent, name )
00081 {
00082 QBoxLayout *topTopLayout = new QVBoxLayout( this );
00083
00084 QVBox *topFrame = new QVBox( this );
00085 topTopLayout->addWidget( topFrame );
00086
00087 topFrame->setSpacing( KDialog::spacingHint() );
00088
00089 KPrefsWidBool *emailControlCenter =
00090 addWidBool( KOPrefs::instance()->emailControlCenterItem(), topFrame );
00091 connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)),
00092 SLOT(toggleEmailSettings(bool)));
00093
00094 mUserEmailSettings = new QGrid( 2, topFrame );
00095
00096 addWidString( KOPrefs::instance()->userNameItem(), mUserEmailSettings );
00097 addWidString( KOPrefs::instance()->userEmailItem(), mUserEmailSettings );
00098
00099 QGroupBox *saveGroup = new QGroupBox(1,Horizontal,i18n("Saving Calendar"),
00100 topFrame);
00101
00102 addWidBool( KOPrefs::instance()->htmlWithSaveItem(), saveGroup );
00103
00104 KPrefsWidBool *autoSave = addWidBool( KOPrefs::instance()->autoSaveItem(), saveGroup );
00105
00106 QHBox *intervalBox = new QHBox( saveGroup );
00107 addWidInt( KOPrefs::instance()->autoSaveIntervalItem(), intervalBox );
00108 connect( autoSave->checkBox(), SIGNAL( toggled( bool ) ),
00109 intervalBox, SLOT( setEnabled( bool ) ) );
00110 intervalBox->setSpacing( KDialog::spacingHint() );
00111 new QWidget( intervalBox );
00112
00113 addWidBool( KOPrefs::instance()->confirmItem(), topFrame );
00114 addWidRadios( KOPrefs::instance()->destinationItem(), topFrame);
00115 addWidRadios( KOPrefs::instance()->defaultEmailAttachMethodItem(), topFrame );
00116
00117 topTopLayout->addStretch( 1 );
00118
00119 load();
00120 }
00121
00122 void KOPrefsDialogMain::toggleEmailSettings( bool on )
00123 {
00124 mUserEmailSettings->setEnabled( !on );
00125
00126
00127
00128
00129
00130
00131
00132
00133 }
00134
00135 extern "C"
00136 {
00137 KDE_EXPORT KCModule *create_korganizerconfigmain( QWidget *parent, const char * )
00138 {
00139 return new KOPrefsDialogMain( parent, "kcmkorganizermain" );
00140 }
00141 }
00142
00143
00144 class KOPrefsDialogTime : public KPrefsModule
00145 {
00146 public:
00147 KOPrefsDialogTime( QWidget *parent, const char *name )
00148 : KPrefsModule( KOPrefs::instance(), parent, name )
00149 {
00150 QBoxLayout *topTopLayout = new QVBoxLayout( this );
00151
00152 QWidget *topFrame = new QWidget( this );
00153 topTopLayout->addWidget( topFrame );
00154
00155 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
00156 topLayout->setSpacing( KDialog::spacingHint() );
00157
00158 QHBox *timeZoneBox = new QHBox( topFrame );
00159 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
00160
00161 QLabel *timeZoneLabel = new QLabel( i18n("Timezone:"), timeZoneBox );
00162 QString whatsThis = i18n( "Select your timezone from the list of "
00163 "locations on this drop down box. If your city "
00164 "is not listed, select one which shares the "
00165 "same timezone. KOrganizer will automatically "
00166 "adjust for daylight savings." );
00167 QWhatsThis::add( timeZoneLabel, whatsThis );
00168 mTimeZoneCombo = new QComboBox( timeZoneBox );
00169
00170 connect( mTimeZoneCombo, SIGNAL( activated( int ) ),
00171 SLOT( slotWidChanged() ) );
00172
00173 FILE *f;
00174 char tempstring[101] = "Unknown";
00175 QString sCurrentlySet(i18n("Unknown"));
00176 int nCurrentlySet = 0;
00177 QStringList list;
00178
00179
00180 #if defined(USE_SOLARIS) // MARCO
00181 char buf[MAXPATHLEN];
00182
00183 snprintf(buf, MAXPATHLEN,
00184 "/bin/fgrep 'TZ=' %s | /bin/head -n 1 | /bin/cut -b 4-",
00185 INITFILE);
00186
00187 if (f = popen(buf, "r"))
00188 {
00189 if (fgets(buf, MAXPATHLEN - 1, f) != NULL)
00190 {
00191 buf[strlen(buf) - 1] = '\0';
00192 sCurrentlySet = QString(buf);
00193 }
00194 pclose(f);
00195 }
00196 #else
00197 QFile file( "/etc/sysconfig/clock" );
00198 if( file.exists())
00199 {
00200 QString line;
00201 if ( file.open( IO_ReadOnly ) ) {
00202 QTextStream stream( &file );
00203 while ( !stream.atEnd() )
00204 {
00205 line = stream.readLine();
00206 if( line.contains("ZONE")!=0)
00207 {
00208 line = line.remove("ZONE=");
00209 break;
00210 }
00211 }
00212 file.close();
00213 }
00214 if(!line.isEmpty())
00215 sCurrentlySet = line;
00216 }
00217
00218 #endif // !USE_SOLARIS
00219
00220 mTimeZoneCombo->insertItem(i18n("[No selection]"));
00221
00222
00223 #if defined(USE_SOLARIS) // MARCO
00224 snprintf(buf, MAXPATHLEN,
00225 "/bin/find %s \\( -name src -prune \\) -o -type f -print | /bin/cut -b %d-",
00226 ZONEINFODIR, strlen(ZONEINFODIR) + 2);
00227
00228 if (f = popen(buf, "r"))
00229 {
00230 while(fgets(buf, MAXPATHLEN - 1, f) != NULL)
00231 {
00232 buf[strlen(buf) - 1] = '\0';
00233 list.append(buf);
00234 }
00235 pclose(f);
00236 }
00237
00238 #else
00239 f = popen("grep -e ^[^#] /usr/share/zoneinfo/zone.tab | cut -f 3","r");
00240 if (!f) return;
00241 while(fgets(tempstring, 100, f) != NULL) {
00242 tempstring[strlen(tempstring)-1] = '\0';
00243 list.append(i18n(tempstring));
00244 tzonenames << tempstring;
00245 }
00246 pclose(f);
00247 #endif // !USE_SOLARIS
00248 list.sort();
00249
00250 mTimeZoneCombo->insertStringList(list);
00251
00252
00253 for ( int i = 0; i < mTimeZoneCombo->count(); ++i )
00254 {
00255 if (mTimeZoneCombo->text(i) == sCurrentlySet)
00256 {
00257 nCurrentlySet = i;
00258 break;
00259 }
00260 }
00261
00262 mTimeZoneCombo->setCurrentItem(nCurrentlySet);
00263 QWhatsThis::add( mTimeZoneCombo, whatsThis );
00264
00265
00266 QHBox *holidayRegBox = new QHBox( topFrame );
00267 topLayout->addMultiCellWidget( holidayRegBox, 1, 1, 0, 1 );
00268
00269 QLabel *holidayLabel = new QLabel( i18n( "Use holiday region:" ), holidayRegBox );
00270 whatsThis = i18n( "Select from which region you want to use the "
00271 "holidays here. Defined holidays are shown as "
00272 "non-working days in the date navigator, the "
00273 "agenda view, etc." );
00274 QWhatsThis::add( holidayLabel, whatsThis );
00275
00276 mHolidayCombo = new QComboBox( holidayRegBox );
00277 connect( mHolidayCombo, SIGNAL( activated( int ) ),
00278 SLOT( slotWidChanged() ) );
00279
00280 QWhatsThis::add( mHolidayCombo, whatsThis );
00281
00282 QString currentHolidayName;
00283 QStringList holidayList;
00284 QStringList countryList = KHolidays::locations();
00285 QStringList::ConstIterator it;
00286
00287 for ( it = countryList.begin(); it != countryList.end(); ++it ) {
00288 QString countryFile = locate( "locale",
00289 "l10n/" + (*it) + "/entry.desktop" );
00290 QString regionName;
00291 if ( !countryFile.isEmpty() ) {
00292 KSimpleConfig cfg( countryFile );
00293 cfg.setGroup( "KCM Locale" );
00294 regionName = cfg.readEntry( "Name" );
00295 }
00296 if (regionName.isEmpty()) regionName = (*it);
00297
00298 holidayList << regionName;
00299 mRegionMap[regionName] = (*it);
00300
00301 if ( KOGlobals::self()->holidays()
00302 && ((*it) == KOGlobals::self()->holidays()->location()) )
00303 currentHolidayName = regionName;
00304 }
00305 holidayList.sort();
00306 holidayList.push_front( i18n("(None)") );
00307
00308 mHolidayCombo->insertStringList(holidayList);
00309
00310 for (int i=0; i < mHolidayCombo->count(); ++i) {
00311 if ( mHolidayCombo->text(i) == currentHolidayName ) {
00312 mHolidayCombo->setCurrentItem(i);
00313 break;
00314 }
00315 }
00316
00317 KPrefsWidTime *dayBegins =
00318 addWidTime( KOPrefs::instance()->dayBeginsItem(), topFrame );
00319 topLayout->addWidget( dayBegins->label(), 2, 0 );
00320 topLayout->addWidget( dayBegins->timeEdit(), 2, 1 );
00321
00322 KPrefsWidTime *defaultTime =
00323 addWidTime( KOPrefs::instance()->startTimeItem(), topFrame );
00324 topLayout->addWidget( defaultTime->label(), 3, 0);
00325 topLayout->addWidget( defaultTime->timeEdit(), 3, 1);
00326
00327 KPrefsWidDuration *defaultDuration =
00328 addWidDuration( KOPrefs::instance()->defaultDurationItem(), topFrame );
00329 topLayout->addWidget( defaultDuration->label(), 4, 0 );
00330 topLayout->addWidget( defaultDuration->timeEdit(), 4, 1 );
00331
00332 QStringList alarmList;
00333 alarmList << i18n( "1 minute" ) << i18n( "5 minutes" )
00334 << i18n( "10 minutes" ) << i18n( "15 minutes" )
00335 << i18n( "30 minutes" );
00336 QLabel *alarmLabel = new QLabel( i18n( "Default reminder time:" ), topFrame);
00337 topLayout->addWidget( alarmLabel, 5, 0 );
00338 QWhatsThis::add( alarmLabel,
00339 i18n( "Enter the default reminder time here." ) );
00340 mAlarmTimeCombo = new QComboBox( topFrame );
00341 QWhatsThis::add( mAlarmTimeCombo,
00342 i18n( "Enter the default reminder time here." ) );
00343 connect( mAlarmTimeCombo, SIGNAL( activated( int ) ),
00344 SLOT( slotWidChanged() ) );
00345 mAlarmTimeCombo->insertStringList( alarmList );
00346 topLayout->addWidget( mAlarmTimeCombo, 5, 1 );
00347
00348
00349 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal,
00350 i18n("Working Hours"),
00351 topFrame);
00352 topLayout->addMultiCellWidget( workingHoursGroup, 6, 6, 0, 1 );
00353
00354 QHBox *workDaysBox = new QHBox( workingHoursGroup );
00355
00356 int weekStart=KGlobal::locale()->weekStartDay();
00357 for ( int i = 0; i < 7; ++i ) {
00358 const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem();
00359 QString weekDayName = calSys->weekDayName( (i + weekStart + 6)%7 + 1, true );
00360 if ( KOPrefs::instance()->mCompactDialogs ) {
00361 weekDayName = weekDayName.left( 1 );
00362 }
00363 int index = ( i + weekStart + 6 ) % 7;
00364 mWorkDays[ index ] = new QCheckBox( weekDayName, workDaysBox );
00365 QWhatsThis::add( mWorkDays[ index ],
00366 i18n( "Check this box to make KOrganizer mark the "
00367 "working hours for this day of the week. "
00368 "If this is a work day for you, check "
00369 "this box, or the working hours will not be "
00370 "marked with color." ) );
00371
00372 connect( mWorkDays[ index ], SIGNAL( stateChanged( int ) ),
00373 SLOT( slotWidChanged() ) );
00374 }
00375
00376 QHBox *workStartBox = new QHBox(workingHoursGroup);
00377 addWidTime( KOPrefs::instance()->workingHoursStartItem(), workStartBox );
00378
00379 QHBox *workEndBox = new QHBox(workingHoursGroup);
00380 addWidTime( KOPrefs::instance()->workingHoursEndItem(), workEndBox );
00381
00382
00383 addWidBool( KOPrefs::instance()->excludeHolidaysItem(),
00384 workingHoursGroup );
00385
00386 topLayout->setRowStretch(7,1);
00387
00388 load();
00389 }
00390
00391 protected:
00392 void usrReadConfig()
00393 {
00394 setCombo( mTimeZoneCombo,
00395 i18n( KOPrefs::instance()->mTimeZoneId.utf8() ) );
00396
00397 mAlarmTimeCombo->setCurrentItem( KOPrefs::instance()->mAlarmTime );
00398 for ( int i = 0; i < 7; ++i ) {
00399 mWorkDays[i]->setChecked( (1<<i) & (KOPrefs::instance()->mWorkWeekMask) );
00400 }
00401 }
00402
00403 void usrWriteConfig()
00404 {
00405
00406 QStringList::Iterator tz;
00407 for ( tz = tzonenames.begin(); tz != tzonenames.end(); ++tz )
00408 if (mTimeZoneCombo->currentText() == i18n((*tz).utf8()))
00409 break;
00410 if (tz != tzonenames.end())
00411 KOPrefs::instance()->mTimeZoneId = (*tz);
00412 else
00413 KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText();
00414
00415 KOPrefs::instance()->mHolidays = ( mHolidayCombo->currentItem() == 0 ) ?
00416 QString::null :
00417 mRegionMap[mHolidayCombo->currentText()];
00418
00419 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem();
00420 int mask = 0;
00421 for ( int i = 0; i < 7; ++i ) {
00422 if (mWorkDays[i]->isChecked()) mask = mask | (1<<i);
00423 }
00424 KOPrefs::instance()->mWorkWeekMask = mask;
00425 KOPrefs::instance()->writeConfig();
00426 }
00427
00428 void setCombo( QComboBox *combo, const QString &text,
00429 const QStringList *tags = 0 )
00430 {
00431 if (tags) {
00432 int i = tags->findIndex(text);
00433 if (i > 0) combo->setCurrentItem(i);
00434 } else {
00435 for(int i=0;i<combo->count();++i) {
00436 if (combo->text(i) == text) {
00437 combo->setCurrentItem(i);
00438 break;
00439 }
00440 }
00441 }
00442 }
00443
00444 private:
00445 QComboBox *mTimeZoneCombo;
00446 QStringList tzonenames;
00447 QComboBox *mHolidayCombo;
00448 QMap<QString,QString> mRegionMap;
00449 QComboBox *mAlarmTimeCombo;
00450 QCheckBox *mWorkDays[7];
00451 };
00452
00453 extern "C"
00454 {
00455 KCModule *create_korganizerconfigtime( QWidget *parent, const char * )
00456 {
00457 KGlobal::locale()->insertCatalogue( "timezones" );
00458 return new KOPrefsDialogTime( parent, "kcmkorganizertime" );
00459 }
00460 }
00461
00462
00463 class KOPrefsDialogViews : public KPrefsModule
00464 {
00465 public:
00466 KOPrefsDialogViews( QWidget *parent, const char *name )
00467 : KPrefsModule( KOPrefs::instance(), parent, name )
00468 {
00469 QBoxLayout *topTopLayout = new QVBoxLayout( this );
00470
00471 QWidget *topFrame = new QWidget( this );
00472 topTopLayout->addWidget( topFrame );
00473
00474 QBoxLayout *topLayout = new QVBoxLayout( topFrame );
00475 topLayout->setSpacing( KDialog::spacingHint() );
00476
00477 KPrefsWidBool *enableToolTips =
00478 addWidBool( KOPrefs::instance()->enableToolTipsItem(), topFrame );
00479 topLayout->addWidget( enableToolTips->checkBox() );
00480
00481 KPrefsWidBool *showTodosAgenda =
00482 addWidBool( KOPrefs::instance()->showAllDayTodoItem(), topFrame );
00483 topLayout->addWidget( showTodosAgenda->checkBox() );
00484
00485
00486 QGroupBox *dateNavGroup = new QGroupBox( 1, Horizontal,
00487 i18n("Date Navigator"),
00488 topFrame );
00489 addWidBool( KOPrefs::instance()->dailyRecurItem(), dateNavGroup );
00490 addWidBool( KOPrefs::instance()->weeklyRecurItem(), dateNavGroup );
00491 topLayout->addWidget( dateNavGroup );
00492
00493
00494
00495 QGroupBox *agendaGroup = new QGroupBox( 1, Horizontal,
00496 i18n("Agenda View"),
00497 topFrame );
00498
00499 QHBox *hourSizeBox = new QHBox( agendaGroup );
00500 KPrefsWidInt *hourSize =
00501 addWidInt( KOPrefs::instance()->hourSizeItem(), hourSizeBox );
00502 hourSize->spinBox()->setSuffix(i18n("suffix in the hour size spin box", " pixel"));
00503
00504 new QWidget( hourSizeBox );
00505
00506 QHBox *nextDaysBox = new QHBox( agendaGroup );
00507 KPrefsWidInt *nextDays =
00508 addWidInt( KOPrefs::instance()->nextXDaysItem(), nextDaysBox );
00509 nextDays->spinBox()->setSuffix(i18n("suffix in the N days spin box", " days"));
00510 new QWidget( nextDaysBox );
00511
00512 KPrefsWidBool *marcusBainsEnabled =
00513 addWidBool( KOPrefs::instance()->marcusBainsEnabledItem(), agendaGroup );
00514
00515 KPrefsWidBool *marcusBainsShowSeconds =
00516 addWidBool( KOPrefs::instance()->marcusBainsShowSecondsItem(), agendaGroup );
00517 connect( marcusBainsEnabled->checkBox(), SIGNAL( toggled( bool ) ),
00518 marcusBainsShowSeconds->checkBox(), SLOT( setEnabled( bool ) ) );
00519
00520 addWidBool( KOPrefs::instance()->selectionStartsEditorItem(), agendaGroup );
00521
00522 addWidCombo( KOPrefs::instance()->agendaViewColorsItem(), agendaGroup );
00523
00524 addWidCombo( KOPrefs::instance()->agendaViewCalendarDisplayItem(), agendaGroup );
00525
00526 topLayout->addWidget( agendaGroup );
00527
00528
00529 QHBoxLayout *hbox = new QHBoxLayout();
00530 topLayout->addLayout( hbox );
00531
00532
00533 QGroupBox *monthGroup = new QGroupBox( 1, Horizontal,
00534 i18n("Month View"),
00535 topFrame );
00536 addWidBool( KOPrefs::instance()->enableMonthScrollItem(), monthGroup );
00537 addWidBool( KOPrefs::instance()->fullViewMonthItem(), monthGroup );
00538 addWidBool( KOPrefs::instance()->monthViewUsesCategoryColorItem(),
00539 monthGroup );
00540 addWidBool( KOPrefs::instance()->monthViewUsesResourceColorItem(), monthGroup );
00541 hbox->addWidget( monthGroup );
00542
00543
00544
00545 QGroupBox *todoGroup = new QGroupBox( 1, Horizontal,
00546 i18n("To-do View"),
00547 topFrame );
00548 addWidBool( KOPrefs::instance()->fullViewTodoItem(), todoGroup );
00549 addWidBool( KOPrefs::instance()->recordTodosInJournalsItem(), todoGroup );
00550 hbox->addWidget( todoGroup );
00551
00552 topLayout->addStretch( 1 );
00553
00554 load();
00555 }
00556 };
00557
00558 extern "C"
00559 {
00560 KCModule *create_korganizerconfigviews( QWidget *parent, const char * )
00561 {
00562 return new KOPrefsDialogViews( parent, "kcmkorganizerviews" );
00563 }
00564 }
00565
00566
00567 class KOPrefsDialogFonts : public KPrefsModule
00568 {
00569 public:
00570 KOPrefsDialogFonts( QWidget *parent, const char *name )
00571 : KPrefsModule( KOPrefs::instance(), parent, name )
00572 {
00573 QBoxLayout *topTopLayout = new QVBoxLayout( this );
00574
00575 QWidget *topFrame = new QWidget( this );
00576 topTopLayout->addWidget( topFrame );
00577
00578 QGridLayout *topLayout = new QGridLayout(topFrame,5,3);
00579 topLayout->setSpacing( KDialog::spacingHint() );
00580
00581 KPrefsWidFont *timeBarFont =
00582 addWidFont( KOPrefs::instance()->timeBarFontItem(), topFrame,
00583 KGlobal::locale()->formatTime( QTime( 12, 34 ) ) );
00584 topLayout->addWidget(timeBarFont->label(),0,0);
00585 topLayout->addWidget(timeBarFont->preview(),0,1);
00586 topLayout->addWidget(timeBarFont->button(),0,2);
00587
00588 KPrefsWidFont *monthViewFont =
00589 addWidFont( KOPrefs::instance()->monthViewFontItem(), topFrame,
00590 KGlobal::locale()->formatTime(QTime(12,34)) + " " +
00591 i18n("Event text") );
00592
00593 topLayout->addWidget(monthViewFont->label(),1,0);
00594 topLayout->addWidget(monthViewFont->preview(),1,1);
00595 topLayout->addWidget(monthViewFont->button(),1,2);
00596
00597 KPrefsWidFont *agendaViewFont =
00598 addWidFont( KOPrefs::instance()->agendaViewFontItem(),
00599 topFrame, i18n("Event text") );
00600 topLayout->addWidget(agendaViewFont->label(),2,0);
00601 topLayout->addWidget(agendaViewFont->preview(),2,1);
00602 topLayout->addWidget(agendaViewFont->button(),2,2);
00603
00604 KPrefsWidFont *marcusBainsFont =
00605 addWidFont( KOPrefs::instance()->marcusBainsFontItem(), topFrame,
00606 KGlobal::locale()->formatTime( QTime( 12, 34, 23 ) ) );
00607 topLayout->addWidget(marcusBainsFont->label(),3,0);
00608 topLayout->addWidget(marcusBainsFont->preview(),3,1);
00609 topLayout->addWidget(marcusBainsFont->button(),3,2);
00610
00611 topLayout->setColStretch(1,1);
00612 topLayout->setRowStretch(4,1);
00613
00614 load();
00615 }
00616 };
00617
00618 extern "C"
00619 {
00620 KCModule *create_korganizerconfigfonts( QWidget *parent, const char * )
00621 {
00622 return new KOPrefsDialogFonts( parent, "kcmkorganizerfonts" );
00623 }
00624 }
00625
00626
00627 KOPrefsDialogColors::KOPrefsDialogColors( QWidget *parent, const char *name )
00628 : KPrefsModule( KOPrefs::instance(), parent, name )
00629 {
00630 QBoxLayout *topTopLayout = new QVBoxLayout( this );
00631
00632 QWidget *topFrame = new QWidget( this );
00633 topTopLayout->addWidget( topFrame );
00634
00635 QGridLayout *topLayout = new QGridLayout(topFrame,7,2);
00636 topLayout->setSpacing( KDialog::spacingHint() );
00637
00638
00639 KPrefsWidColor *holidayColor =
00640 addWidColor( KOPrefs::instance()->holidayColorItem(), topFrame );
00641 topLayout->addWidget(holidayColor->label(),0,0);
00642 topLayout->addWidget(holidayColor->button(),0,1);
00643
00644
00645 KPrefsWidColor *highlightColor =
00646 addWidColor( KOPrefs::instance()->highlightColorItem(), topFrame );
00647 topLayout->addWidget(highlightColor->label(),1,0);
00648 topLayout->addWidget(highlightColor->button(),1,1);
00649
00650 KPrefsWidColor *eventColor =
00651 addWidColor( KOPrefs::instance()->eventColorItem(), topFrame );
00652 topLayout->addWidget(eventColor->label(),2,0);
00653 topLayout->addWidget(eventColor->button(),2,1);
00654
00655
00656 KPrefsWidColor *agendaBgColor =
00657 addWidColor( KOPrefs::instance()->agendaBgColorItem(), topFrame );
00658 topLayout->addWidget(agendaBgColor->label(),3,0);
00659 topLayout->addWidget(agendaBgColor->button(),3,1);
00660
00661
00662 KPrefsWidColor *workingHoursColor =
00663 addWidColor( KOPrefs::instance()->workingHoursColorItem(), topFrame );
00664 topLayout->addWidget(workingHoursColor->label(),4,0);
00665 topLayout->addWidget(workingHoursColor->button(),4,1);
00666
00667
00668 KPrefsWidColor *todoDueTodayColor =
00669 addWidColor( KOPrefs::instance()->todoDueTodayColorItem(), topFrame );
00670 topLayout->addWidget(todoDueTodayColor->label(),5,0);
00671 topLayout->addWidget(todoDueTodayColor->button(),5,1);
00672
00673
00674 KPrefsWidColor *todoOverdueColor =
00675 addWidColor( KOPrefs::instance()->todoOverdueColorItem(), topFrame );
00676 topLayout->addWidget(todoOverdueColor->label(),6,0);
00677 topLayout->addWidget(todoOverdueColor->button(),6,1);
00678
00679
00680 QGroupBox *categoryGroup = new QGroupBox(1,Horizontal,i18n("Categories"),
00681 topFrame);
00682 topLayout->addMultiCellWidget(categoryGroup,7,7,0,1);
00683
00684 mCategoryCombo = new QComboBox(categoryGroup);
00685 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
00686 QWhatsThis::add( mCategoryCombo,
00687 i18n( "Select here the event category you want to modify. "
00688 "You can change the selected category color using "
00689 "the button below." ) );
00690 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor()));
00691
00692 mCategoryButton = new KColorButton(categoryGroup);
00693 QWhatsThis::add( mCategoryButton,
00694 i18n( "Choose here the color of the event category selected "
00695 "using the combo box above." ) );
00696 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor()));
00697 updateCategoryColor();
00698
00699
00700 QGroupBox *resourceGroup = new QGroupBox(1,Horizontal,i18n("Resources"),
00701 topFrame);
00702 topLayout->addMultiCellWidget(resourceGroup,8,8,0,1);
00703
00704 mResourceCombo = new QComboBox(resourceGroup);
00705 QWhatsThis::add( mResourceCombo,
00706 i18n( "Select here resource you want to modify. "
00707 "You can change the selected resource color using "
00708 "the button below." ) );
00709 connect(mResourceCombo,SIGNAL(activated(int)),SLOT(updateResourceColor()));
00710
00711 mResourceButton = new KColorButton(resourceGroup);
00712 QWhatsThis::add( mResourceButton,
00713 i18n( "Choose here the color of the resource selected "
00714 "using the combo box above." ) );
00715 connect(mResourceButton,SIGNAL(changed(const QColor &)),SLOT(setResourceColor()));
00716 updateResources();
00717
00718 topLayout->setRowStretch(9,1);
00719
00720 load();
00721 }
00722
00723 void KOPrefsDialogColors::usrWriteConfig()
00724 {
00725 QDictIterator<QColor> itCat(mCategoryDict);
00726 while (itCat.current()) {
00727 KOPrefs::instance()->setCategoryColor(itCat.currentKey(),*itCat.current());
00728 ++itCat;
00729 }
00730
00731 QDictIterator<QColor> itRes(mResourceDict);
00732 while (itRes.current()) {
00733 KOPrefs::instance()->setResourceColor(itRes.currentKey(),*itRes.current());
00734 ++itRes;
00735 }
00736 }
00737
00738 void KOPrefsDialogColors::usrReadConfig()
00739 {
00740 updateCategories();
00741 updateResources();
00742 }
00743
00744 void KOPrefsDialogColors::updateCategories()
00745 {
00746 mCategoryCombo->clear();
00747 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
00748 updateCategoryColor();
00749 }
00750
00751 void KOPrefsDialogColors::setCategoryColor()
00752 {
00753 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color()));
00754 slotWidChanged();
00755 }
00756
00757 void KOPrefsDialogColors::updateCategoryColor()
00758 {
00759 QString cat = mCategoryCombo->currentText();
00760 QColor *color = mCategoryDict.find(cat);
00761 if (!color) {
00762 color = KOPrefs::instance()->categoryColor(cat);
00763 }
00764 if (color) {
00765 mCategoryButton->setColor(*color);
00766 }
00767 }
00768
00769 void KOPrefsDialogColors::updateResources()
00770 {
00771 mResourceCombo->clear();
00772 mResourceIdentifier.clear();
00773 kdDebug( 5850) << "KOPrefsDialogColors::updateResources()" << endl;
00774
00775 KCal::CalendarResourceManager *manager = KOrg::StdCalendar::self()->resourceManager();
00776
00777 kdDebug(5850) << "Loading Calendar resources...:" << endl;
00778 KCal::CalendarResourceManager::Iterator it;
00779 for( it = manager->begin(); it != manager->end(); ++it ) {
00780 if ( !(*it)->subresources().isEmpty() ) {
00781 QStringList subresources = (*it)->subresources();
00782 for ( uint i = 0; i < subresources.count(); ++i ) {
00783 QString resource = subresources[ i ];
00784 if ( (*it)->subresourceActive( resource ) ) {
00785 mResourceCombo->insertItem( (*it)->labelForSubresource( resource ) );
00786 mResourceIdentifier.append( resource );
00787 }
00788 }
00789 }
00790
00791 mResourceCombo->insertItem( (*it)->resourceName() );
00792 mResourceIdentifier.append( (*it)->identifier() );
00793 }
00794
00795 updateResourceColor();
00796 }
00797
00798 void KOPrefsDialogColors::setResourceColor()
00799 {
00800 kdDebug( 5850) << "KOPrefsDialogColors::setResorceColor()" << endl;
00801
00802 mResourceDict.replace( mResourceIdentifier[mResourceCombo->currentItem()],
00803 new QColor( mResourceButton->color() ) );
00804 slotWidChanged();
00805 }
00806
00807 void KOPrefsDialogColors::updateResourceColor()
00808 {
00809 kdDebug( 5850 ) << "KOPrefsDialogColors::updateResourceColor()" << endl;
00810 QString res= mResourceIdentifier[mResourceCombo->currentItem()];
00811 QColor *color = mCategoryDict.find(res);
00812 if( !color ) {
00813 color = KOPrefs::instance()->resourceColor( res );
00814 }
00815 if( color ) {
00816 mResourceButton->setColor(*color);
00817 }
00818 }
00819 extern "C"
00820 {
00821 KCModule *create_korganizerconfigcolors( QWidget *parent, const char * )
00822 {
00823 return new KOPrefsDialogColors( parent, "kcmkorganizercolors" );
00824 }
00825 }
00826
00827
00828 KOPrefsDialogGroupScheduling::KOPrefsDialogGroupScheduling( QWidget *parent, const char *name )
00829 : KPrefsModule( KOPrefs::instance(), parent, name )
00830 {
00831 QBoxLayout *topTopLayout = new QVBoxLayout( this );
00832
00833 QWidget *topFrame = new QWidget( this );
00834 topTopLayout->addWidget( topFrame );
00835
00836 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
00837 topLayout->setSpacing( KDialog::spacingHint() );
00838
00839 KPrefsWidBool *useGroupwareBool =
00840 addWidBool( KOPrefs::instance()->useGroupwareCommunicationItem(),
00841 topFrame );
00842 topLayout->addMultiCellWidget(useGroupwareBool->checkBox(),0,0,0,1);
00843
00844
00845
00846
00847 KPrefsWidBool *bcc =
00848 addWidBool( KOPrefs::instance()->bccItem(), topFrame );
00849 topLayout->addMultiCellWidget(bcc->checkBox(),1,1,0,1);
00850
00851 KPrefsWidRadios *mailClientGroup =
00852 addWidRadios( KOPrefs::instance()->mailClientItem(), topFrame );
00853 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),2,2,0,1);
00854
00855
00856 #if 0
00857 KPrefsWidRadios *schedulerGroup =
00858 addWidRadios(i18n("Scheduler Mail Client"),KOPrefs::instance()->mIMIPScheduler,
00859 topFrame);
00860 schedulerGroup->addRadio("Dummy");
00861 schedulerGroup->addRadio(i18n("Mail client"));
00862
00863 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1);
00864 #endif
00865
00866 QLabel *aMailsLabel = new QLabel(i18n("Additional email addresses:"),topFrame);
00867 QString whatsThis = i18n( "Add, edit or remove additional e-mails addresses "
00868 "here. These email addresses are the ones you "
00869 "have in addition to the one set in personal "
00870 "preferences. If you are an attendee of one event, "
00871 "but use another email address there, you need to "
00872 "list this address here so KOrganizer can "
00873 "recognize it as yours." );
00874 QWhatsThis::add( aMailsLabel, whatsThis );
00875 topLayout->addMultiCellWidget(aMailsLabel,3,3,0,1);
00876 mAMails = new QListView(topFrame);
00877 QWhatsThis::add( mAMails, whatsThis );
00878
00879 mAMails->addColumn(i18n("Email"),300);
00880 topLayout->addMultiCellWidget(mAMails,4,4,0,1);
00881
00882 QLabel *aEmailsEditLabel = new QLabel(i18n("Additional email address:"),topFrame);
00883 whatsThis = i18n( "Edit additional e-mails addresses here. To edit an "
00884 "address select it from the list above "
00885 "or press the \"New\" button below. These email "
00886 "addresses are the ones you have in addition to the "
00887 "one set in personal preferences." );
00888 QWhatsThis::add( aEmailsEditLabel, whatsThis );
00889 topLayout->addWidget(aEmailsEditLabel,5,0);
00890 aEmailsEdit = new QLineEdit(topFrame);
00891 QWhatsThis::add( aEmailsEdit, whatsThis );
00892 aEmailsEdit->setEnabled(false);
00893 topLayout->addWidget(aEmailsEdit,5,1);
00894
00895 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new");
00896 whatsThis = i18n( "Press this button to add a new entry to the "
00897 "additional e-mail addresses list. Use the edit "
00898 "box above to edit the new entry." );
00899 QWhatsThis::add( add, whatsThis );
00900 topLayout->addWidget(add,6,0);
00901 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove");
00902 QWhatsThis::add( del, whatsThis );
00903 topLayout->addWidget(del,6,1);
00904
00905
00906 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) );
00907 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) );
00908 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem()));
00909 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput()));
00910
00911 load();
00912 }
00913
00914 void KOPrefsDialogGroupScheduling::usrReadConfig()
00915 {
00916 mAMails->clear();
00917 for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin();
00918 it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) {
00919 QListViewItem *item = new QListViewItem(mAMails);
00920 item->setText(0,*it);
00921 mAMails->insertItem(item);
00922 }
00923 }
00924
00925 void KOPrefsDialogGroupScheduling::usrWriteConfig()
00926 {
00927 KOPrefs::instance()->mAdditionalMails.clear();
00928 QListViewItem *item;
00929 item = mAMails->firstChild();
00930 while (item)
00931 {
00932 KOPrefs::instance()->mAdditionalMails.append( item->text(0) );
00933 item = item->nextSibling();
00934 }
00935 }
00936
00937 void KOPrefsDialogGroupScheduling::addItem()
00938 {
00939 aEmailsEdit->setEnabled(true);
00940 QListViewItem *item = new QListViewItem(mAMails);
00941 mAMails->insertItem(item);
00942 mAMails->setSelected(item,true);
00943 aEmailsEdit->setText(i18n("(EmptyEmail)"));
00944 slotWidChanged();
00945 }
00946
00947 void KOPrefsDialogGroupScheduling::removeItem()
00948 {
00949 QListViewItem *item;
00950 item = mAMails->selectedItem();
00951 if (!item) return;
00952 mAMails->takeItem(item);
00953 item = mAMails->selectedItem();
00954 if (!item) {
00955 aEmailsEdit->setText("");
00956 aEmailsEdit->setEnabled(false);
00957 }
00958 if (mAMails->childCount() == 0) {
00959 aEmailsEdit->setEnabled(false);
00960 }
00961 slotWidChanged();
00962 }
00963
00964 void KOPrefsDialogGroupScheduling::updateItem()
00965 {
00966 QListViewItem *item;
00967 item = mAMails->selectedItem();
00968 if (!item) return;
00969 item->setText(0,aEmailsEdit->text());
00970 slotWidChanged();
00971 }
00972
00973 void KOPrefsDialogGroupScheduling::updateInput()
00974 {
00975 QListViewItem *item;
00976 item = mAMails->selectedItem();
00977 if (!item) return;
00978 aEmailsEdit->setEnabled(true);
00979 aEmailsEdit->setText(item->text(0));
00980 }
00981
00982 extern "C"
00983 {
00984 KCModule *create_korganizerconfiggroupscheduling( QWidget *parent,
00985 const char * )
00986 {
00987 return new KOPrefsDialogGroupScheduling( parent,
00988 "kcmkorganizergroupscheduling" );
00989 }
00990 }
00991
00992
00993 KOPrefsDialogGroupwareScheduling::KOPrefsDialogGroupwareScheduling( QWidget *parent, const char *name )
00994 : KPrefsModule( KOPrefs::instance(), parent, name )
00995 {
00996 mGroupwarePage = new KOGroupwarePrefsPage( this );
00997 connect( mGroupwarePage, SIGNAL( changed() ), SLOT( slotWidChanged() ) );
00998 ( new QVBoxLayout( this ) )->addWidget( mGroupwarePage );
00999
01000 load();
01001 }
01002
01003 void KOPrefsDialogGroupwareScheduling::usrReadConfig()
01004 {
01005 mGroupwarePage->publishEnable->setChecked( KOPrefs::instance()->mFreeBusyPublishAuto );
01006 mGroupwarePage->publishDelay->setValue( KOPrefs::instance()->mFreeBusyPublishDelay );
01007 mGroupwarePage->publishDays->setValue( KOPrefs::instance()->mFreeBusyPublishDays );
01008
01009 mGroupwarePage->publishUrl->setText( KOPrefs::instance()->mFreeBusyPublishUrl );
01010 mGroupwarePage->publishUser->setText( KOPrefs::instance()->mFreeBusyPublishUser );
01011 mGroupwarePage->publishPassword->setText( KOPrefs::instance()->mFreeBusyPublishPassword );
01012 mGroupwarePage->publishSavePassword->setChecked( KOPrefs::instance()->mFreeBusyPublishSavePassword );
01013
01014 mGroupwarePage->retrieveEnable->setChecked( KOPrefs::instance()->mFreeBusyRetrieveAuto );
01015 mGroupwarePage->fullDomainRetrieval->setChecked( KOPrefs::instance()->mFreeBusyFullDomainRetrieval );
01016 mGroupwarePage->retrieveUrl->setText( KOPrefs::instance()->mFreeBusyRetrieveUrl );
01017 mGroupwarePage->retrieveUser->setText( KOPrefs::instance()->mFreeBusyRetrieveUser );
01018 mGroupwarePage->retrievePassword->setText( KOPrefs::instance()->mFreeBusyRetrievePassword );
01019 mGroupwarePage->retrieveSavePassword->setChecked( KOPrefs::instance()->mFreeBusyRetrieveSavePassword );
01020 }
01021
01022 void KOPrefsDialogGroupwareScheduling::usrWriteConfig()
01023 {
01024 KOPrefs::instance()->mFreeBusyPublishAuto = mGroupwarePage->publishEnable->isChecked();
01025 KOPrefs::instance()->mFreeBusyPublishDelay = mGroupwarePage->publishDelay->value();
01026 KOPrefs::instance()->mFreeBusyPublishDays = mGroupwarePage->publishDays->value();
01027
01028 KOPrefs::instance()->mFreeBusyPublishUrl = mGroupwarePage->publishUrl->text();
01029 KOPrefs::instance()->mFreeBusyPublishUser = mGroupwarePage->publishUser->text();
01030 KOPrefs::instance()->mFreeBusyPublishPassword = mGroupwarePage->publishPassword->text();
01031 KOPrefs::instance()->mFreeBusyPublishSavePassword = mGroupwarePage->publishSavePassword->isChecked();
01032
01033 KOPrefs::instance()->mFreeBusyRetrieveAuto = mGroupwarePage->retrieveEnable->isChecked();
01034 KOPrefs::instance()->mFreeBusyFullDomainRetrieval = mGroupwarePage->fullDomainRetrieval->isChecked();
01035 KOPrefs::instance()->mFreeBusyRetrieveUrl = mGroupwarePage->retrieveUrl->text();
01036 KOPrefs::instance()->mFreeBusyRetrieveUser = mGroupwarePage->retrieveUser->text();
01037 KOPrefs::instance()->mFreeBusyRetrievePassword = mGroupwarePage->retrievePassword->text();
01038 KOPrefs::instance()->mFreeBusyRetrieveSavePassword = mGroupwarePage->retrieveSavePassword->isChecked();
01039 }
01040
01041 extern "C"
01042 {
01043 KCModule *create_korganizerconfigfreebusy( QWidget *parent, const char * )
01044 {
01045 return new KOPrefsDialogGroupwareScheduling( parent,
01046 "kcmkorganizerfreebusy" );
01047 }
01048 }
01049
01050
01051
01052 class PluginItem : public QCheckListItem {
01053 public:
01054 PluginItem( QListView *parent, KService::Ptr service ) :
01055 QCheckListItem( parent, service->name(), QCheckListItem::CheckBox ), mService( service )
01056 {}
01057 KService::Ptr service() { return mService; }
01058 private:
01059 KService::Ptr mService;
01060 };
01061
01062
01066 KOPrefsDialogPlugins::KOPrefsDialogPlugins( QWidget *parent, const char* name )
01067 : KPrefsModule( KOPrefs::instance(), parent, name )
01068 {
01069 QBoxLayout *topTopLayout = new QVBoxLayout( this );
01070
01071 QWidget *topFrame = new QWidget( this );
01072 topTopLayout->addWidget( topFrame );
01073 QBoxLayout *topLayout = new QVBoxLayout( topFrame );
01074 topLayout->setSpacing( KDialog::spacingHint() );
01075
01076 mListView = new QListView( topFrame );
01077 mListView->addColumn( i18n("Name") );
01078 mListView->setResizeMode( QListView::LastColumn );
01079 topLayout->addWidget( mListView );
01080
01081 mDescription = new QLabel( topFrame );
01082 mDescription->setAlignment( QLabel::NoAccel | QLabel::WordBreak | QLabel::AlignVCenter );
01083 mDescription->setFrameShape( QLabel::Panel );
01084 mDescription->setFrameShadow( QLabel::Sunken );
01085 mDescription->setMinimumSize( QSize( 0, 55 ) );
01086 mDescription->setSizePolicy(
01087 QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0,
01088 0, 0, mDescription->sizePolicy().hasHeightForWidth() ) );
01089 topLayout->addWidget( mDescription );
01090
01091
01092 QWidget *buttonRow = new QWidget( topFrame );
01093 QBoxLayout *buttonRowLayout = new QHBoxLayout( buttonRow );
01094 mConfigureButton = new KPushButton( KGuiItem( i18n("Configure &Plugin..."),
01095 "configure", QString::null, i18n("This button allows you to configure"
01096 " the plugin that you have selected in the list above") ), buttonRow );
01097
01098 buttonRowLayout->addWidget( mConfigureButton );
01099 buttonRowLayout->addItem( new QSpacerItem(1, 1, QSizePolicy::Expanding) );
01100 topLayout->addWidget( buttonRow );
01101 connect( mConfigureButton, SIGNAL( clicked() ), SLOT( configure() ) );
01102
01103 connect( mListView, SIGNAL( selectionChanged( QListViewItem* ) ),
01104 SLOT( selectionChanged( QListViewItem* ) ) );
01105 connect( mListView, SIGNAL( clicked( QListViewItem* ) ),
01106 SLOT( slotWidChanged() ) );
01107
01108 load();
01109
01110 selectionChanged( 0 );
01111 }
01112
01113 void KOPrefsDialogPlugins::usrReadConfig()
01114 {
01115 mListView->clear();
01116 KTrader::OfferList plugins = KOCore::self()->availablePlugins();
01117 plugins += KOCore::self()->availableParts();
01118
01119 QStringList selectedPlugins = KOPrefs::instance()->mSelectedPlugins;
01120
01121 KTrader::OfferList::ConstIterator it;
01122 for( it = plugins.begin(); it != plugins.end(); ++it ) {
01123 QCheckListItem *item = new PluginItem( mListView, *it );
01124 if ( selectedPlugins.find( (*it)->desktopEntryName() ) !=
01125 selectedPlugins.end() ) {
01126 item->setOn( true );
01127 }
01128 }
01129 }
01130
01131 void KOPrefsDialogPlugins::usrWriteConfig()
01132 {
01133 QStringList selectedPlugins;
01134
01135 PluginItem *item = static_cast<PluginItem *>( mListView->firstChild() );
01136 while( item ) {
01137 if( item->isOn() ) {
01138 selectedPlugins.append( item->service()->desktopEntryName() );
01139 }
01140 item = static_cast<PluginItem *>( item->nextSibling() );
01141 }
01142 KOPrefs::instance()->mSelectedPlugins = selectedPlugins;
01143 }
01144
01145 void KOPrefsDialogPlugins::configure()
01146 {
01147 PluginItem *item = static_cast<PluginItem *>( mListView->selectedItem() );
01148 if ( !item ) return;
01149
01150 KOrg::Plugin *plugin = KOCore::self()->loadPlugin( item->service() );
01151
01152 if ( plugin ) {
01153 plugin->configure( this );
01154 delete plugin;
01155 } else {
01156 KMessageBox::sorry( this, i18n( "Unable to configure this plugin" ),
01157 "PluginConfigUnable" );
01158 }
01159 }
01160
01161 void KOPrefsDialogPlugins::selectionChanged( QListViewItem *i )
01162 {
01163 PluginItem *item = dynamic_cast<PluginItem*>( i );
01164 if ( !item ) {
01165 mConfigureButton->setEnabled( false );
01166 mDescription->setText( QString::null );
01167 return;
01168 }
01169
01170 QVariant variant = item->service()->property( "X-KDE-KOrganizer-HasSettings" );
01171
01172 bool hasSettings = true;
01173 if ( variant.isValid() )
01174 hasSettings = variant.toBool();
01175
01176 mDescription->setText( item->service()->comment() );
01177 mConfigureButton->setEnabled( hasSettings );
01178
01179 slotWidChanged();
01180 }
01181
01182 extern "C"
01183 {
01184 KCModule *create_korganizerconfigplugins( QWidget *parent, const char * )
01185 {
01186 return new KOPrefsDialogPlugins( parent,
01187 "kcmkorganizerplugins" );
01188 }
01189 }
01190
01191
01192 extern "C"
01193 {
01194 KCModule *create_korgdesignerfields( QWidget *parent, const char * ) {
01195 return new KOPrefsDesignerFields( parent, "kcmkorgdesignerfields" );
01196 }
01197 }
01198
01199 KOPrefsDesignerFields::KOPrefsDesignerFields( QWidget *parent, const char *name )
01200 : KCMDesignerFields( parent, name )
01201 {
01202 }
01203
01204 QString KOPrefsDesignerFields::localUiDir()
01205 {
01206 QString dir = locateLocal( "data", "korganizer/designer/event/");
01207 kdDebug() << "KOPrefsDesignerFields::localUiDir(): " << dir << endl;
01208 return dir;
01209 }
01210
01211 QString KOPrefsDesignerFields::uiPath()
01212 {
01213 return "korganizer/designer/event/";
01214 }
01215
01216 void KOPrefsDesignerFields::writeActivePages( const QStringList &activePages )
01217 {
01218 KOPrefs::instance()->setActiveDesignerFields( activePages );
01219 KOPrefs::instance()->writeConfig();
01220 }
01221
01222 QStringList KOPrefsDesignerFields::readActivePages()
01223 {
01224 return KOPrefs::instance()->activeDesignerFields();
01225 }
01226
01227 QString KOPrefsDesignerFields::applicationName()
01228 {
01229 return "KORGANIZER";
01230 }
01231
01232 #include "koprefsdialog.moc"