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