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