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