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 addWidBool( KOPrefs::instance()->weekNumbersShowWorkItem(), dateNavGroup );
00493 topLayout->addWidget( dateNavGroup );
00494
00495
00496
00497 QGroupBox *agendaGroup = new QGroupBox( 1, Horizontal,
00498 i18n("Agenda View"),
00499 topFrame );
00500
00501 QHBox *hourSizeBox = new QHBox( agendaGroup );
00502 KPrefsWidInt *hourSize =
00503 addWidInt( KOPrefs::instance()->hourSizeItem(), hourSizeBox );
00504 hourSize->spinBox()->setSuffix(i18n("suffix in the hour size spin box", " pixel"));
00505
00506 new QWidget( hourSizeBox );
00507
00508 QHBox *nextDaysBox = new QHBox( agendaGroup );
00509 KPrefsWidInt *nextDays =
00510 addWidInt( KOPrefs::instance()->nextXDaysItem(), nextDaysBox );
00511 nextDays->spinBox()->setSuffix(i18n("suffix in the N days spin box", " days"));
00512 new QWidget( nextDaysBox );
00513
00514 KPrefsWidBool *marcusBainsEnabled =
00515 addWidBool( KOPrefs::instance()->marcusBainsEnabledItem(), agendaGroup );
00516
00517 KPrefsWidBool *marcusBainsShowSeconds =
00518 addWidBool( KOPrefs::instance()->marcusBainsShowSecondsItem(), agendaGroup );
00519 connect( marcusBainsEnabled->checkBox(), SIGNAL( toggled( bool ) ),
00520 marcusBainsShowSeconds->checkBox(), SLOT( setEnabled( bool ) ) );
00521
00522 addWidBool( KOPrefs::instance()->selectionStartsEditorItem(), agendaGroup );
00523
00524 addWidCombo( KOPrefs::instance()->agendaViewColorsItem(), agendaGroup );
00525
00526 addWidCombo( KOPrefs::instance()->agendaViewCalendarDisplayItem(), agendaGroup );
00527
00528 topLayout->addWidget( agendaGroup );
00529
00530
00531 QGroupBox *monthGroup = new QGroupBox( 1, Horizontal,
00532 i18n("Month View"),
00533 topFrame );
00534 addWidBool( KOPrefs::instance()->enableMonthScrollItem(), monthGroup );
00535 addWidBool( KOPrefs::instance()->fullViewMonthItem(), monthGroup );
00536 addWidCombo( KOPrefs::instance()->monthItemColorsItem(), monthGroup );
00537 topLayout->addWidget( monthGroup );
00538
00539
00540
00541 QGroupBox *todoGroup = new QGroupBox( 1, Horizontal,
00542 i18n("To-do View"),
00543 topFrame );
00544 addWidBool( KOPrefs::instance()->fullViewTodoItem(), todoGroup );
00545 addWidBool( KOPrefs::instance()->recordTodosInJournalsItem(), todoGroup );
00546 topLayout->addWidget( todoGroup );
00547
00548 topLayout->addStretch( 1 );
00549
00550 load();
00551 }
00552 };
00553
00554 extern "C"
00555 {
00556 KCModule *create_korganizerconfigviews( QWidget *parent, const char * )
00557 {
00558 return new KOPrefsDialogViews( parent, "kcmkorganizerviews" );
00559 }
00560 }
00561
00562
00563 class KOPrefsDialogFonts : public KPrefsModule
00564 {
00565 public:
00566 KOPrefsDialogFonts( QWidget *parent, const char *name )
00567 : KPrefsModule( KOPrefs::instance(), parent, name )
00568 {
00569 QBoxLayout *topTopLayout = new QVBoxLayout( this );
00570
00571 QWidget *topFrame = new QWidget( this );
00572 topTopLayout->addWidget( topFrame );
00573
00574 QGridLayout *topLayout = new QGridLayout(topFrame,5,3);
00575 topLayout->setSpacing( KDialog::spacingHint() );
00576
00577 KPrefsWidFont *timeBarFont =
00578 addWidFont( KOPrefs::instance()->timeBarFontItem(), topFrame,
00579 KGlobal::locale()->formatTime( QTime( 12, 34 ) ) );
00580 topLayout->addWidget(timeBarFont->label(),0,0);
00581 topLayout->addWidget(timeBarFont->preview(),0,1);
00582 topLayout->addWidget(timeBarFont->button(),0,2);
00583
00584 KPrefsWidFont *monthViewFont =
00585 addWidFont( KOPrefs::instance()->monthViewFontItem(), topFrame,
00586 KGlobal::locale()->formatTime(QTime(12,34)) + " " +
00587 i18n("Event text") );
00588
00589 topLayout->addWidget(monthViewFont->label(),1,0);
00590 topLayout->addWidget(monthViewFont->preview(),1,1);
00591 topLayout->addWidget(monthViewFont->button(),1,2);
00592
00593 KPrefsWidFont *agendaViewFont =
00594 addWidFont( KOPrefs::instance()->agendaViewFontItem(),
00595 topFrame, i18n("Event text") );
00596 topLayout->addWidget(agendaViewFont->label(),2,0);
00597 topLayout->addWidget(agendaViewFont->preview(),2,1);
00598 topLayout->addWidget(agendaViewFont->button(),2,2);
00599
00600 KPrefsWidFont *marcusBainsFont =
00601 addWidFont( KOPrefs::instance()->marcusBainsFontItem(), topFrame,
00602 KGlobal::locale()->formatTime( QTime( 12, 34, 23 ) ) );
00603 topLayout->addWidget(marcusBainsFont->label(),3,0);
00604 topLayout->addWidget(marcusBainsFont->preview(),3,1);
00605 topLayout->addWidget(marcusBainsFont->button(),3,2);
00606
00607 topLayout->setColStretch(1,1);
00608 topLayout->setRowStretch(4,1);
00609
00610 load();
00611 }
00612 };
00613
00614 extern "C"
00615 {
00616 KCModule *create_korganizerconfigfonts( QWidget *parent, const char * )
00617 {
00618 return new KOPrefsDialogFonts( parent, "kcmkorganizerfonts" );
00619 }
00620 }
00621
00622
00623 KOPrefsDialogColors::KOPrefsDialogColors( QWidget *parent, const char *name )
00624 : KPrefsModule( KOPrefs::instance(), parent, name )
00625 {
00626 QBoxLayout *topTopLayout = new QVBoxLayout( this );
00627
00628 QWidget *topFrame = new QWidget( this );
00629 topTopLayout->addWidget( topFrame );
00630
00631 QGridLayout *topLayout = new QGridLayout(topFrame,7,2);
00632 topLayout->setSpacing( KDialog::spacingHint() );
00633
00634
00635 KPrefsWidColor *holidayColor =
00636 addWidColor( KOPrefs::instance()->holidayColorItem(), topFrame );
00637 topLayout->addWidget(holidayColor->label(),0,0);
00638 topLayout->addWidget(holidayColor->button(),0,1);
00639
00640
00641 KPrefsWidColor *highlightColor =
00642 addWidColor( KOPrefs::instance()->highlightColorItem(), topFrame );
00643 topLayout->addWidget(highlightColor->label(),1,0);
00644 topLayout->addWidget(highlightColor->button(),1,1);
00645
00646
00647 KPrefsWidColor *agendaBgColor =
00648 addWidColor( KOPrefs::instance()->agendaBgColorItem(), topFrame );
00649 topLayout->addWidget(agendaBgColor->label(),2,0);
00650 topLayout->addWidget(agendaBgColor->button(),2,1);
00651
00652
00653 KPrefsWidColor *workingHoursColor =
00654 addWidColor( KOPrefs::instance()->workingHoursColorItem(), topFrame );
00655 topLayout->addWidget(workingHoursColor->label(),3,0);
00656 topLayout->addWidget(workingHoursColor->button(),3,1);
00657
00658
00659 KPrefsWidColor *todoDueTodayColor =
00660 addWidColor( KOPrefs::instance()->todoDueTodayColorItem(), topFrame );
00661 topLayout->addWidget(todoDueTodayColor->label(),4,0);
00662 topLayout->addWidget(todoDueTodayColor->button(),4,1);
00663
00664
00665 KPrefsWidColor *todoOverdueColor =
00666 addWidColor( KOPrefs::instance()->todoOverdueColorItem(), topFrame );
00667 topLayout->addWidget(todoOverdueColor->label(),5,0);
00668 topLayout->addWidget(todoOverdueColor->button(),5,1);
00669
00670
00671 KPrefsWidColor *unsetCategoryColor =
00672 addWidColor( KOPrefs::instance()->unsetCategoryColorItem(), topFrame );
00673 topLayout->addWidget( unsetCategoryColor->label(), 6, 0 );
00674 topLayout->addWidget( unsetCategoryColor->button(), 6, 1 );
00675
00676
00677 QGroupBox *categoryGroup = new QGroupBox(1,Horizontal,i18n("Categories"),
00678 topFrame);
00679 topLayout->addMultiCellWidget(categoryGroup,7,7,0,1);
00680
00681
00682 mCategoryCombo = new QComboBox(categoryGroup);
00683 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
00684 QWhatsThis::add( mCategoryCombo,
00685 i18n( "Select here the event category you want to modify. "
00686 "You can change the selected category color using "
00687 "the button below." ) );
00688 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor()));
00689
00690 mCategoryButton = new KColorButton(categoryGroup);
00691 QWhatsThis::add( mCategoryButton,
00692 i18n( "Choose here the color of the event category selected "
00693 "using the combo box above." ) );
00694 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor()));
00695 updateCategoryColor();
00696
00697
00698 QGroupBox *resourceGroup = new QGroupBox(1,Horizontal,i18n("Resources"),
00699 topFrame);
00700 topLayout->addMultiCellWidget(resourceGroup,8,8,0,1);
00701
00702 mResourceCombo = new QComboBox(resourceGroup);
00703 QWhatsThis::add( mResourceCombo,
00704 i18n( "Select here resource you want to modify. "
00705 "You can change the selected resource color using "
00706 "the button below." ) );
00707 connect(mResourceCombo,SIGNAL(activated(int)),SLOT(updateResourceColor()));
00708
00709 mResourceButton = new KColorButton(resourceGroup);
00710 QWhatsThis::add( mResourceButton,
00711 i18n( "Choose here the color of the resource selected "
00712 "using the combo box above." ) );
00713 connect(mResourceButton,SIGNAL(changed(const QColor &)),SLOT(setResourceColor()));
00714 updateResources();
00715
00716 topLayout->setRowStretch(9,1);
00717
00718 load();
00719 }
00720
00721 void KOPrefsDialogColors::usrWriteConfig()
00722 {
00723 QDictIterator<QColor> itCat(mCategoryDict);
00724 while (itCat.current()) {
00725 KOPrefs::instance()->setCategoryColor(itCat.currentKey(),*itCat.current());
00726 ++itCat;
00727 }
00728
00729 QDictIterator<QColor> itRes(mResourceDict);
00730 while (itRes.current()) {
00731 KOPrefs::instance()->setResourceColor(itRes.currentKey(),*itRes.current());
00732 ++itRes;
00733 }
00734 }
00735
00736 void KOPrefsDialogColors::usrReadConfig()
00737 {
00738 updateCategories();
00739 updateResources();
00740 }
00741
00742 void KOPrefsDialogColors::updateCategories()
00743 {
00744 mCategoryCombo->clear();
00745 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
00746 updateCategoryColor();
00747 }
00748
00749 void KOPrefsDialogColors::setCategoryColor()
00750 {
00751 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color()));
00752 slotWidChanged();
00753 }
00754
00755 void KOPrefsDialogColors::updateCategoryColor()
00756 {
00757 QString cat = mCategoryCombo->currentText();
00758 QColor *color = mCategoryDict.find(cat);
00759 if (!color) {
00760 color = KOPrefs::instance()->categoryColor(cat);
00761 }
00762 if (color) {
00763 mCategoryButton->setColor(*color);
00764 }
00765 }
00766
00767 void KOPrefsDialogColors::updateResources()
00768 {
00769 mResourceCombo->clear();
00770 mResourceIdentifier.clear();
00771 kdDebug( 5850) << "KOPrefsDialogColors::updateResources()" << endl;
00772
00773 KCal::CalendarResourceManager *manager = KOrg::StdCalendar::self()->resourceManager();
00774
00775 kdDebug(5850) << "Loading Calendar resources...:" << endl;
00776 KCal::CalendarResourceManager::Iterator it;
00777 for( it = manager->begin(); it != manager->end(); ++it ) {
00778 if ( !(*it)->subresources().isEmpty() ) {
00779 QStringList subresources = (*it)->subresources();
00780 for ( uint i = 0; i < subresources.count(); ++i ) {
00781 QString resource = subresources[ i ];
00782 if ( (*it)->subresourceActive( resource ) ) {
00783 mResourceCombo->insertItem( (*it)->labelForSubresource( resource ) );
00784 mResourceIdentifier.append( resource );
00785 }
00786 }
00787 }
00788
00789 mResourceCombo->insertItem( (*it)->resourceName() );
00790 mResourceIdentifier.append( (*it)->identifier() );
00791 }
00792
00793 updateResourceColor();
00794 }
00795
00796 void KOPrefsDialogColors::setResourceColor()
00797 {
00798 kdDebug( 5850) << "KOPrefsDialogColors::setResorceColor()" << endl;
00799
00800 mResourceDict.replace( mResourceIdentifier[mResourceCombo->currentItem()],
00801 new QColor( mResourceButton->color() ) );
00802 slotWidChanged();
00803 }
00804
00805 void KOPrefsDialogColors::updateResourceColor()
00806 {
00807 kdDebug( 5850 ) << "KOPrefsDialogColors::updateResourceColor()" << endl;
00808 QString res= mResourceIdentifier[mResourceCombo->currentItem()];
00809 QColor *color = mCategoryDict.find(res);
00810 if( !color ) {
00811 color = KOPrefs::instance()->resourceColor( res );
00812 }
00813 if( color ) {
00814 mResourceButton->setColor(*color);
00815 }
00816 }
00817 extern "C"
00818 {
00819 KCModule *create_korganizerconfigcolors( QWidget *parent, const char * )
00820 {
00821 return new KOPrefsDialogColors( parent, "kcmkorganizercolors" );
00822 }
00823 }
00824
00825
00826 KOPrefsDialogGroupScheduling::KOPrefsDialogGroupScheduling( QWidget *parent, const char *name )
00827 : KPrefsModule( KOPrefs::instance(), parent, name )
00828 {
00829 QBoxLayout *topTopLayout = new QVBoxLayout( this );
00830
00831 QWidget *topFrame = new QWidget( this );
00832 topTopLayout->addWidget( topFrame );
00833
00834 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
00835 topLayout->setSpacing( KDialog::spacingHint() );
00836
00837 KPrefsWidBool *useGroupwareBool =
00838 addWidBool( KOPrefs::instance()->useGroupwareCommunicationItem(),
00839 topFrame );
00840 topLayout->addMultiCellWidget(useGroupwareBool->checkBox(),0,0,0,1);
00841
00842
00843
00844
00845 KPrefsWidBool *bcc =
00846 addWidBool( KOPrefs::instance()->bccItem(), topFrame );
00847 topLayout->addMultiCellWidget(bcc->checkBox(),1,1,0,1);
00848
00849 KPrefsWidRadios *mailClientGroup =
00850 addWidRadios( KOPrefs::instance()->mailClientItem(), topFrame );
00851 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),2,2,0,1);
00852
00853
00854 #if 0
00855 KPrefsWidRadios *schedulerGroup =
00856 addWidRadios(i18n("Scheduler Mail Client"),KOPrefs::instance()->mIMIPScheduler,
00857 topFrame);
00858 schedulerGroup->addRadio("Dummy");
00859 schedulerGroup->addRadio(i18n("Mail client"));
00860
00861 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1);
00862 #endif
00863
00864 QLabel *aMailsLabel = new QLabel(i18n("Additional email addresses:"),topFrame);
00865 QString whatsThis = i18n( "Add, edit or remove additional e-mails addresses "
00866 "here. These email addresses are the ones you "
00867 "have in addition to the one set in personal "
00868 "preferences. If you are an attendee of one event, "
00869 "but use another email address there, you need to "
00870 "list this address here so KOrganizer can "
00871 "recognize it as yours." );
00872 QWhatsThis::add( aMailsLabel, whatsThis );
00873 topLayout->addMultiCellWidget(aMailsLabel,3,3,0,1);
00874 mAMails = new QListView(topFrame);
00875 QWhatsThis::add( mAMails, whatsThis );
00876
00877 mAMails->addColumn(i18n("Email"),300);
00878 topLayout->addMultiCellWidget(mAMails,4,4,0,1);
00879
00880 QLabel *aEmailsEditLabel = new QLabel(i18n("Additional email address:"),topFrame);
00881 whatsThis = i18n( "Edit additional e-mails addresses here. To edit an "
00882 "address select it from the list above "
00883 "or press the \"New\" button below. These email "
00884 "addresses are the ones you have in addition to the "
00885 "one set in personal preferences." );
00886 QWhatsThis::add( aEmailsEditLabel, whatsThis );
00887 topLayout->addWidget(aEmailsEditLabel,5,0);
00888 aEmailsEdit = new QLineEdit(topFrame);
00889 QWhatsThis::add( aEmailsEdit, whatsThis );
00890 aEmailsEdit->setEnabled(false);
00891 topLayout->addWidget(aEmailsEdit,5,1);
00892
00893 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new");
00894 whatsThis = i18n( "Press this button to add a new entry to the "
00895 "additional e-mail addresses list. Use the edit "
00896 "box above to edit the new entry." );
00897 QWhatsThis::add( add, whatsThis );
00898 topLayout->addWidget(add,6,0);
00899 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove");
00900 QWhatsThis::add( del, whatsThis );
00901 topLayout->addWidget(del,6,1);
00902
00903
00904 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) );
00905 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) );
00906 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem()));
00907 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput()));
00908
00909 load();
00910 }
00911
00912 void KOPrefsDialogGroupScheduling::usrReadConfig()
00913 {
00914 mAMails->clear();
00915 for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin();
00916 it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) {
00917 QListViewItem *item = new QListViewItem(mAMails);
00918 item->setText(0,*it);
00919 mAMails->insertItem(item);
00920 }
00921 }
00922
00923 void KOPrefsDialogGroupScheduling::usrWriteConfig()
00924 {
00925 KOPrefs::instance()->mAdditionalMails.clear();
00926 QListViewItem *item;
00927 item = mAMails->firstChild();
00928 while (item)
00929 {
00930 KOPrefs::instance()->mAdditionalMails.append( item->text(0) );
00931 item = item->nextSibling();
00932 }
00933 }
00934
00935 void KOPrefsDialogGroupScheduling::addItem()
00936 {
00937 aEmailsEdit->setEnabled(true);
00938 QListViewItem *item = new QListViewItem(mAMails);
00939 mAMails->insertItem(item);
00940 mAMails->setSelected(item,true);
00941 aEmailsEdit->setText(i18n("(EmptyEmail)"));
00942 slotWidChanged();
00943 }
00944
00945 void KOPrefsDialogGroupScheduling::removeItem()
00946 {
00947 QListViewItem *item;
00948 item = mAMails->selectedItem();
00949 if (!item) return;
00950 mAMails->takeItem(item);
00951 item = mAMails->selectedItem();
00952 if (!item) {
00953 aEmailsEdit->setText("");
00954 aEmailsEdit->setEnabled(false);
00955 }
00956 if (mAMails->childCount() == 0) {
00957 aEmailsEdit->setEnabled(false);
00958 }
00959 slotWidChanged();
00960 }
00961
00962 void KOPrefsDialogGroupScheduling::updateItem()
00963 {
00964 QListViewItem *item;
00965 item = mAMails->selectedItem();
00966 if (!item) return;
00967 item->setText(0,aEmailsEdit->text());
00968 slotWidChanged();
00969 }
00970
00971 void KOPrefsDialogGroupScheduling::updateInput()
00972 {
00973 QListViewItem *item;
00974 item = mAMails->selectedItem();
00975 if (!item) return;
00976 aEmailsEdit->setEnabled(true);
00977 aEmailsEdit->setText(item->text(0));
00978 }
00979
00980 extern "C"
00981 {
00982 KCModule *create_korganizerconfiggroupscheduling( QWidget *parent,
00983 const char * )
00984 {
00985 return new KOPrefsDialogGroupScheduling( parent,
00986 "kcmkorganizergroupscheduling" );
00987 }
00988 }
00989
00990
00991 KOPrefsDialogGroupwareScheduling::KOPrefsDialogGroupwareScheduling( QWidget *parent, const char *name )
00992 : KPrefsModule( KOPrefs::instance(), parent, name )
00993 {
00994 mGroupwarePage = new KOGroupwarePrefsPage( this );
00995 connect( mGroupwarePage, SIGNAL( changed() ), SLOT( slotWidChanged() ) );
00996 ( new QVBoxLayout( this ) )->addWidget( mGroupwarePage );
00997
00998 load();
00999 }
01000
01001 void KOPrefsDialogGroupwareScheduling::usrReadConfig()
01002 {
01003 mGroupwarePage->publishEnable->setChecked( KOPrefs::instance()->mFreeBusyPublishAuto );
01004 mGroupwarePage->publishDelay->setValue( KOPrefs::instance()->mFreeBusyPublishDelay );
01005 mGroupwarePage->publishDays->setValue( KOPrefs::instance()->mFreeBusyPublishDays );
01006
01007 mGroupwarePage->publishUrl->setText( KOPrefs::instance()->mFreeBusyPublishUrl );
01008 mGroupwarePage->publishUser->setText( KOPrefs::instance()->mFreeBusyPublishUser );
01009 mGroupwarePage->publishPassword->setText( KOPrefs::instance()->mFreeBusyPublishPassword );
01010 mGroupwarePage->publishSavePassword->setChecked( KOPrefs::instance()->mFreeBusyPublishSavePassword );
01011
01012 mGroupwarePage->retrieveEnable->setChecked( KOPrefs::instance()->mFreeBusyRetrieveAuto );
01013 mGroupwarePage->fullDomainRetrieval->setChecked( KOPrefs::instance()->mFreeBusyFullDomainRetrieval );
01014 mGroupwarePage->retrieveUrl->setText( KOPrefs::instance()->mFreeBusyRetrieveUrl );
01015 mGroupwarePage->retrieveUser->setText( KOPrefs::instance()->mFreeBusyRetrieveUser );
01016 mGroupwarePage->retrievePassword->setText( KOPrefs::instance()->mFreeBusyRetrievePassword );
01017 mGroupwarePage->retrieveSavePassword->setChecked( KOPrefs::instance()->mFreeBusyRetrieveSavePassword );
01018 }
01019
01020 void KOPrefsDialogGroupwareScheduling::usrWriteConfig()
01021 {
01022 KOPrefs::instance()->mFreeBusyPublishAuto = mGroupwarePage->publishEnable->isChecked();
01023 KOPrefs::instance()->mFreeBusyPublishDelay = mGroupwarePage->publishDelay->value();
01024 KOPrefs::instance()->mFreeBusyPublishDays = mGroupwarePage->publishDays->value();
01025
01026 KOPrefs::instance()->mFreeBusyPublishUrl = mGroupwarePage->publishUrl->text();
01027 KOPrefs::instance()->mFreeBusyPublishUser = mGroupwarePage->publishUser->text();
01028 KOPrefs::instance()->mFreeBusyPublishPassword = mGroupwarePage->publishPassword->text();
01029 KOPrefs::instance()->mFreeBusyPublishSavePassword = mGroupwarePage->publishSavePassword->isChecked();
01030
01031 KOPrefs::instance()->mFreeBusyRetrieveAuto = mGroupwarePage->retrieveEnable->isChecked();
01032 KOPrefs::instance()->mFreeBusyFullDomainRetrieval = mGroupwarePage->fullDomainRetrieval->isChecked();
01033 KOPrefs::instance()->mFreeBusyRetrieveUrl = mGroupwarePage->retrieveUrl->text();
01034 KOPrefs::instance()->mFreeBusyRetrieveUser = mGroupwarePage->retrieveUser->text();
01035 KOPrefs::instance()->mFreeBusyRetrievePassword = mGroupwarePage->retrievePassword->text();
01036 KOPrefs::instance()->mFreeBusyRetrieveSavePassword = mGroupwarePage->retrieveSavePassword->isChecked();
01037 }
01038
01039 extern "C"
01040 {
01041 KCModule *create_korganizerconfigfreebusy( QWidget *parent, const char * )
01042 {
01043 return new KOPrefsDialogGroupwareScheduling( parent,
01044 "kcmkorganizerfreebusy" );
01045 }
01046 }
01047
01048
01049
01050 class PluginItem : public QCheckListItem {
01051 public:
01052 PluginItem( QListView *parent, KService::Ptr service ) :
01053 QCheckListItem( parent, service->name(), QCheckListItem::CheckBox ), mService( service )
01054 {}
01055 KService::Ptr service() { return mService; }
01056 private:
01057 KService::Ptr mService;
01058 };
01059
01060
01064 KOPrefsDialogPlugins::KOPrefsDialogPlugins( QWidget *parent, const char* name )
01065 : KPrefsModule( KOPrefs::instance(), parent, name )
01066 {
01067 QBoxLayout *topTopLayout = new QVBoxLayout( this );
01068
01069 QWidget *topFrame = new QWidget( this );
01070 topTopLayout->addWidget( topFrame );
01071 QBoxLayout *topLayout = new QVBoxLayout( topFrame );
01072 topLayout->setSpacing( KDialog::spacingHint() );
01073
01074 mListView = new QListView( topFrame );
01075 mListView->addColumn( i18n("Name") );
01076 mListView->setResizeMode( QListView::LastColumn );
01077 topLayout->addWidget( mListView );
01078
01079 mDescription = new QLabel( topFrame );
01080 mDescription->setAlignment( QLabel::NoAccel | QLabel::WordBreak | QLabel::AlignVCenter );
01081 mDescription->setFrameShape( QLabel::Panel );
01082 mDescription->setFrameShadow( QLabel::Sunken );
01083 mDescription->setMinimumSize( QSize( 0, 55 ) );
01084 mDescription->setSizePolicy(
01085 QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0,
01086 0, 0, mDescription->sizePolicy().hasHeightForWidth() ) );
01087 topLayout->addWidget( mDescription );
01088
01089
01090 QWidget *buttonRow = new QWidget( topFrame );
01091 QBoxLayout *buttonRowLayout = new QHBoxLayout( buttonRow );
01092 mConfigureButton = new KPushButton( KGuiItem( i18n("Configure &Plugin..."),
01093 "configure", QString::null, i18n("This button allows you to configure"
01094 " the plugin that you have selected in the list above") ), buttonRow );
01095
01096 buttonRowLayout->addWidget( mConfigureButton );
01097 buttonRowLayout->addItem( new QSpacerItem(1, 1, QSizePolicy::Expanding) );
01098 topLayout->addWidget( buttonRow );
01099 connect( mConfigureButton, SIGNAL( clicked() ), SLOT( configure() ) );
01100
01101 connect( mListView, SIGNAL( selectionChanged( QListViewItem* ) ),
01102 SLOT( selectionChanged( QListViewItem* ) ) );
01103 connect( mListView, SIGNAL( clicked( QListViewItem* ) ),
01104 SLOT( slotWidChanged() ) );
01105
01106 load();
01107
01108 selectionChanged( 0 );
01109 }
01110
01111 void KOPrefsDialogPlugins::usrReadConfig()
01112 {
01113 mListView->clear();
01114 KTrader::OfferList plugins = KOCore::self()->availablePlugins();
01115 plugins += KOCore::self()->availableParts();
01116
01117 QStringList selectedPlugins = KOPrefs::instance()->mSelectedPlugins;
01118
01119 KTrader::OfferList::ConstIterator it;
01120 for( it = plugins.begin(); it != plugins.end(); ++it ) {
01121 QCheckListItem *item = new PluginItem( mListView, *it );
01122 if ( selectedPlugins.find( (*it)->desktopEntryName() ) !=
01123 selectedPlugins.end() ) {
01124 item->setOn( true );
01125 }
01126 }
01127 }
01128
01129 void KOPrefsDialogPlugins::usrWriteConfig()
01130 {
01131 QStringList selectedPlugins;
01132
01133 PluginItem *item = static_cast<PluginItem *>( mListView->firstChild() );
01134 while( item ) {
01135 if( item->isOn() ) {
01136 selectedPlugins.append( item->service()->desktopEntryName() );
01137 }
01138 item = static_cast<PluginItem *>( item->nextSibling() );
01139 }
01140 KOPrefs::instance()->mSelectedPlugins = selectedPlugins;
01141 }
01142
01143 void KOPrefsDialogPlugins::configure()
01144 {
01145 PluginItem *item = static_cast<PluginItem *>( mListView->selectedItem() );
01146 if ( !item ) return;
01147
01148 KOrg::Plugin *plugin = KOCore::self()->loadPlugin( item->service() );
01149
01150 if ( plugin ) {
01151 plugin->configure( this );
01152 delete plugin;
01153 } else {
01154 KMessageBox::sorry( this, i18n( "Unable to configure this plugin" ),
01155 "PluginConfigUnable" );
01156 }
01157 }
01158
01159 void KOPrefsDialogPlugins::selectionChanged( QListViewItem *i )
01160 {
01161 PluginItem *item = dynamic_cast<PluginItem*>( i );
01162 if ( !item ) {
01163 mConfigureButton->setEnabled( false );
01164 mDescription->setText( QString::null );
01165 return;
01166 }
01167
01168 QVariant variant = item->service()->property( "X-KDE-KOrganizer-HasSettings" );
01169
01170 bool hasSettings = true;
01171 if ( variant.isValid() )
01172 hasSettings = variant.toBool();
01173
01174 mDescription->setText( item->service()->comment() );
01175 mConfigureButton->setEnabled( hasSettings );
01176
01177 slotWidChanged();
01178 }
01179
01180 extern "C"
01181 {
01182 KCModule *create_korganizerconfigplugins( QWidget *parent, const char * )
01183 {
01184 return new KOPrefsDialogPlugins( parent,
01185 "kcmkorganizerplugins" );
01186 }
01187 }
01188
01189
01190 extern "C"
01191 {
01192 KCModule *create_korgdesignerfields( QWidget *parent, const char * ) {
01193 return new KOPrefsDesignerFields( parent, "kcmkorgdesignerfields" );
01194 }
01195 }
01196
01197 KOPrefsDesignerFields::KOPrefsDesignerFields( QWidget *parent, const char *name )
01198 : KCMDesignerFields( parent, name )
01199 {
01200 }
01201
01202 QString KOPrefsDesignerFields::localUiDir()
01203 {
01204 QString dir = locateLocal( "data", "korganizer/designer/event/");
01205 kdDebug() << "KOPrefsDesignerFields::localUiDir(): " << dir << endl;
01206 return dir;
01207 }
01208
01209 QString KOPrefsDesignerFields::uiPath()
01210 {
01211 return "korganizer/designer/event/";
01212 }
01213
01214 void KOPrefsDesignerFields::writeActivePages( const QStringList &activePages )
01215 {
01216 KOPrefs::instance()->setActiveDesignerFields( activePages );
01217 KOPrefs::instance()->writeConfig();
01218 }
01219
01220 QStringList KOPrefsDesignerFields::readActivePages()
01221 {
01222 return KOPrefs::instance()->activeDesignerFields();
01223 }
01224
01225 QString KOPrefsDesignerFields::applicationName()
01226 {
01227 return "KORGANIZER";
01228 }
01229
01230 #include "koprefsdialog.moc"