31 #include "ui_kogroupwareprefspage.h" 
   33 #include <calendarsupport/kcalprefs.h> 
   34 #include <calendarsupport/categoryconfig.h> 
   36 #include <incidenceeditor-ng/globalsettings.h> 
   37 #include <widgets/tagselectioncombo.h> 
   38 #include <widgets/tagwidgets.h> 
   40 #include <Akonadi/AgentFilterProxyModel> 
   41 #include <Akonadi/AgentInstanceCreateJob> 
   42 #include <Akonadi/AgentManager> 
   43 #include <Akonadi/AgentTypeDialog> 
   44 #include <Akonadi/CollectionComboBox> 
   45 #include <Akonadi/CollectionModel> 
   46 #include <akonadi/calendar/calendarsettings.h> 
   48 #include <KCalCore/Event> 
   49 #include <KCalCore/Journal> 
   51 #include <KHolidays/Holidays> 
   53 #include <Mailtransport/TransportManagementWidget> 
   55 #include "pimcommon/widgets/manageaccountwidget.h" 
   57 #include <KCalendarSystem> 
   58 #include <KColorButton> 
   61 #include <KIntSpinBox> 
   62 #include <KMessageBox> 
   64 #include <KStandardDirs> 
   66 #include <KTimeComboBox> 
   67 #include <KUrlRequester> 
   68 #include <KWindowSystem> 
   71 #include <QFormLayout> 
   72 #include <QGridLayout> 
   75 #include <QListWidget> 
   76 #include <QRadioButton> 
   78 #include <QTreeWidget> 
   79 #include <QVBoxLayout> 
   82   : KPrefsModule( 
KOPrefs::instance(), inst, parent )
 
   85   KTabWidget *tabWidget = 
new KTabWidget( 
this );
 
   91   tabWidget->addTab( personalFrame, KIcon( 
QLatin1String(
"preferences-desktop-personal") ),
 
   92                      i18nc( 
"@title:tab personal settings", 
"Personal" ) );
 
   94   KPIM::KPrefsWidBool *emailControlCenter =
 
   95     addWidBool( CalendarSupport::KCalPrefs::instance()->emailControlCenterItem(), personalFrame );
 
   96   connect( emailControlCenter->checkBox(), SIGNAL(toggled(
bool)), SLOT(
toggleEmailSettings(
bool)) );
 
   97   personalLayout->
addWidget( emailControlCenter->checkBox() );
 
  100     new QGroupBox( i18nc( 
"@title:group email settings", 
"Email Settings" ), personalFrame );
 
  102   personalLayout->
addWidget( mUserEmailSettings );
 
  104   KPIM::KPrefsWidString *s =
 
  105     addWidString( CalendarSupport::KCalPrefs::instance()->userNameItem(), mUserEmailSettings );
 
  106   emailSettingsLayout->
addRow ( s->label(), s->lineEdit() );
 
  108   s=addWidString( CalendarSupport::KCalPrefs::instance()->userEmailItem(), mUserEmailSettings );
 
  109   emailSettingsLayout->
addRow ( s->label(), s->lineEdit() );
 
  111   KPIM::KPrefsWidRadios *defaultEmailAttachMethod =
 
  113       IncidenceEditorNG::GlobalSettings::self()->defaultEmailAttachMethodItem(), personalFrame );
 
  114   personalLayout->
addWidget( defaultEmailAttachMethod->groupBox() );
 
  119   tabWidget->addTab( saveFrame, KIcon( 
QLatin1String(
"document-save") ),
 
  120                      i18nc( 
"@title:tab", 
"Save" ) );
 
  124     new QGroupBox( i18nc( 
"@title:group", 
"Exporting Calendar" ), saveFrame );
 
  127   saveGroupBox->
setLayout( saveGroupLayout );
 
  129   KPIM::KPrefsWidBool *autoExportHTML =
 
  131   saveGroupLayout->
addWidget( autoExportHTML->checkBox() );
 
  134   saveGroupLayout->
addLayout( intervalLayout );
 
  136   KPIM::KPrefsWidInt *autoExportInterval =
 
  138   connect( autoExportHTML->checkBox(), SIGNAL(toggled(
bool)),
 
  139            autoExportInterval->label(), SLOT(setEnabled(
bool)) );
 
  140   connect( autoExportHTML->checkBox(), SIGNAL(toggled(
bool)),
 
  141            autoExportInterval->spinBox(), SLOT(setEnabled(
bool)) );
 
  142   intervalLayout->
addWidget( autoExportInterval->label() );
 
  143   intervalLayout->
addWidget( autoExportInterval->spinBox() );
 
  144   autoExportInterval->spinBox()->setEnabled(autoExportHTML->checkBox()->isChecked());
 
  145   autoExportInterval->label()->setEnabled(autoExportHTML->checkBox()->isChecked());
 
  147   KPIM::KPrefsWidBool *confirmItem =
 
  149   saveLayout->
addWidget( confirmItem->checkBox() );
 
  150   KPIM::KPrefsWidRadios *destinationItem =
 
  153   saveLayout->
addWidget( destinationItem->groupBox() );
 
  159   tabWidget->addTab( systrayFrame, KIcon( 
QLatin1String(
"preferences-other") ),
 
  160                      i18nc( 
"@title:tab systray settings", 
"System Tray" ) );
 
  163     new QGroupBox( i18nc( 
"@title:group", 
"Show/Hide Options" ), systrayFrame );
 
  164   systrayLayout->
addWidget( systrayGroupBox );
 
  166   systrayGroupBox->
setLayout( systrayGroupLayout );
 
  168   KPIM::KPrefsWidBool *showReminderDaemonItem =
 
  170   systrayGroupLayout->
addWidget( showReminderDaemonItem->checkBox() );
 
  171   showReminderDaemonItem->checkBox()->setToolTip(
 
  172     i18nc( 
"@info:tooltip", 
"Enable this setting to show the KOrganizer " 
  173            "reminder daemon in your system tray (recommended)." ) );
 
  177            "<note>The daemon will continue running even if it is not shown " 
  178            "in the system tray.</note>" ) );
 
  185   tabWidget->addTab( calendarFrame, KIcon( 
QLatin1String(
"office-calendar") ),
 
  186                      i18nc( 
"@title:tab calendar account settings", 
"Calendars" ) );
 
  188   calendarFrame->
setLayout(calendarFrameLayout);
 
  189   PimCommon::ManageAccountWidget *manageAccountWidget = 
new PimCommon::ManageAccountWidget(
this);
 
  190   calendarFrameLayout->
addWidget(manageAccountWidget);
 
  200     KPIM::KPrefsModule::usrWriteConfig();
 
  201     IncidenceEditorNG::GlobalSettings::self()->writeConfig();
 
  228 class KOPrefsDialogTime : 
public KPIM::KPrefsModule
 
  231     KOPrefsDialogTime( 
const KComponentData &inst, 
QWidget *parent )
 
  232       : KPIM::KPrefsModule( 
KOPrefs::instance(), inst, parent )
 
  235       KTabWidget *tabWidget = 
new KTabWidget( 
this );
 
  239       tabWidget->addTab( regionalPage, KIcon( 
QLatin1String(
"flag") ),
 
  240                          i18nc( 
"@title:tab", 
"Regional" ) );
 
  243       regionalLayout->
setSpacing( KDialog::spacingHint() );
 
  246         new QGroupBox( i18nc( 
"@title:group", 
"General Time and Date" ), regionalPage );
 
  247       regionalLayout->
addWidget( datetimeGroupBox, 0, 0 );
 
  251       KPIM::KPrefsWidTime *dayBegins =
 
  253       datetimeLayout->
addWidget( dayBegins->label(), 1, 0 );
 
  254       datetimeLayout->
addWidget( dayBegins->timeEdit(), 1, 1 );
 
  257         new QGroupBox( i18nc( 
"@title:group", 
"Holidays" ), regionalPage );
 
  258       regionalLayout->
addWidget( holidaysGroupBox, 1, 0 );
 
  263       KHBox *holidayRegBox = 
new KHBox( regionalPage );
 
  264       holidaysLayout->
addWidget( holidayRegBox, 1, 0, 1, 2 );
 
  267         i18nc( 
"@label", 
"Use holiday region:" ), holidayRegBox );
 
  270       mHolidayCombo = 
new KComboBox( holidayRegBox );
 
  271       connect( mHolidayCombo, SIGNAL(activated(
int)), SLOT(slotWidChanged()) );
 
  275       QStringList regions = KHolidays::HolidayRegion::regionCodes();
 
  278       foreach ( 
const QString & regionCode, regions ) {
 
  279         QString name = KHolidays::HolidayRegion::name( regionCode );
 
  281           KGlobal::locale()->languageCodeToName(
 
  282             KHolidays::HolidayRegion::languageCode( regionCode ) );
 
  284         if ( languageName.
isEmpty() ) {
 
  287           label = i18nc( 
"Holday region, region language", 
"%1 (%2)", name, languageName );
 
  289         regionsMap.
insert( label, regionCode );
 
  292       mHolidayCombo->addItem( i18nc( 
"No holiday region", 
"None" ), 
QString() );
 
  294       while ( i.hasNext() ) {
 
  296         mHolidayCombo->addItem( i.key(), i.value() );
 
  300         mHolidayCombo->setCurrentIndex(
 
  303         mHolidayCombo->setCurrentIndex( 0 );
 
  307         new QGroupBox( i18nc( 
"@title:group", 
"Working Period" ), regionalPage );
 
  308       regionalLayout->
addWidget( workingHoursGroupBox, 2, 0 );
 
  313       workingHoursLayout->
addLayout( workDaysLayout );
 
  316       int weekStart = KGlobal::locale()->weekStartDay();
 
  317       for ( 
int i=0; i < 7; ++i ) {
 
  319         QString weekDayName = calSys->weekDayName( ( i + weekStart + 6 ) % 7 + 1,
 
  320                                                    KCalendarSystem::ShortDayName );
 
  321         int index = ( i + weekStart + 6 ) % 7;
 
  322         mWorkDays[ index ] = 
new QCheckBox( weekDayName );
 
  323         mWorkDays[ index ]->setWhatsThis(
 
  324           i18nc( 
"@info:whatsthis",
 
  325                  "Check this box to make KOrganizer mark the " 
  326                  "working hours for this day of the week. " 
  327                  "If this is a work day for you, check " 
  328                  "this box, or the working hours will not be " 
  329                  "marked with color." ) );
 
  331         connect( mWorkDays[ index ], SIGNAL(stateChanged(
int)), SLOT(slotWidChanged()) );
 
  333         workDaysLayout->
addWidget( mWorkDays[ index ] );
 
  336       KPIM::KPrefsWidTime *workStart =
 
  340       workingHoursLayout->
addLayout( workStartLayout );
 
  342       workStartLayout->
addWidget( workStart->label() );
 
  343       workStartLayout->
addWidget( workStart->timeEdit() );
 
  345       KPIM::KPrefsWidTime *workEnd =
 
  349       workingHoursLayout->
addLayout( workEndLayout );
 
  351       workEndLayout->
addWidget( workEnd->label() );
 
  352       workEndLayout->
addWidget( workEnd->timeEdit() );
 
  354       KPIM::KPrefsWidBool *excludeHolidays =
 
  357       workingHoursLayout->
addWidget( excludeHolidays->checkBox() );
 
  362       tabWidget->addTab( defaultPage, KIcon( 
QLatin1String(
"draw-eraser") ),
 
  363                          i18nc( 
"@title:tab", 
"Default Values" ) );
 
  365       defaultLayout->
setSpacing( KDialog::spacingHint() );
 
  368         new QGroupBox( i18nc( 
"@title:group", 
"Appointments" ), defaultPage );
 
  369       defaultLayout->
addWidget( timesGroupBox, 0, 0 );
 
  373       KPIM::KPrefsWidTime *defaultTime =
 
  374         addWidTime( CalendarSupport::KCalPrefs::instance()->startTimeItem(), defaultPage );
 
  375       timesLayout->
addWidget( defaultTime->label(), 0, 0 );
 
  376       timesLayout->
addWidget( defaultTime->timeEdit(), 0, 1 );
 
  378       KPIM::KPrefsWidDuration *defaultDuration =
 
  379         addWidDuration( CalendarSupport::KCalPrefs::instance()->defaultDurationItem(),
 
  382       timesLayout->
addWidget( defaultDuration->label(), 1, 0 );
 
  383       timesLayout->
addWidget( defaultDuration->timeEdit(), 1, 1 );
 
  386         new QGroupBox( i18nc( 
"@title:group", 
"Reminders" ), defaultPage );
 
  387       defaultLayout->
addWidget( remindersGroupBox, 1, 0 );
 
  392         new QLabel( i18nc( 
"@label", 
"Default reminder time:" ), defaultPage );
 
  393       remindersLayout->
addWidget( reminderLabel, 0, 0 );
 
  395         CalendarSupport::KCalPrefs::instance()->reminderTimeItem()->whatsThis() );
 
  396       mReminderTimeSpin  = 
new KIntSpinBox( defaultPage );
 
  397       mReminderTimeSpin->setWhatsThis(
 
  398         CalendarSupport::KCalPrefs::instance()->reminderTimeItem()->whatsThis() );
 
  399       mReminderTimeSpin->setToolTip(
 
  400         CalendarSupport::KCalPrefs::instance()->reminderTimeItem()->toolTip() );
 
  401       connect( mReminderTimeSpin, SIGNAL(valueChanged(
int)), SLOT(slotWidChanged()) );
 
  402       remindersLayout->
addWidget( mReminderTimeSpin, 0, 1 );
 
  404       mReminderUnitsCombo = 
new KComboBox( defaultPage );
 
  405       mReminderUnitsCombo->setToolTip(
 
  406         CalendarSupport::KCalPrefs::instance()->reminderTimeUnitsItem()->toolTip() );
 
  407       mReminderUnitsCombo->setWhatsThis(
 
  408         CalendarSupport::KCalPrefs::instance()->reminderTimeUnitsItem()->whatsThis() );
 
  409       connect( mReminderUnitsCombo, SIGNAL(activated(
int)), SLOT(slotWidChanged()) );
 
  410       mReminderUnitsCombo->addItem(
 
  411         i18nc( 
"@item:inlistbox reminder units in minutes", 
"minute(s)" ) );
 
  412       mReminderUnitsCombo->addItem(
 
  413         i18nc( 
"@item:inlistbox reminder time units in hours", 
"hour(s)" ) );
 
  414       mReminderUnitsCombo->addItem(
 
  415         i18nc( 
"@item:inlistbox reminder time units in days", 
"day(s)" ) );
 
  416       remindersLayout->
addWidget( mReminderUnitsCombo, 0, 2 );
 
  420           CalendarSupport::KCalPrefs::instance()->defaultAudioFileRemindersItem() )->checkBox();
 
  423       if ( CalendarSupport::KCalPrefs::instance()->audioFilePathItem()->value().isEmpty() ) {
 
  424         const QString defAudioFile = KGlobal::dirs()->locate( 
"sound", 
QLatin1String(
"KDE-Sys-Warning.ogg") );
 
  425         CalendarSupport::KCalPrefs::instance()->audioFilePathItem()->setValue(defAudioFile);
 
  428         i18n( 
"*.ogg *.wav *.mp3 *.wma *.flac *.aiff *.raw *.au *.ra|" 
  429               "Audio Files (*.ogg *.wav *.mp3 *.wma *.flac *.aiff *.raw *.au *.ra)" );
 
  430       KUrlRequester *rq = addWidPath( CalendarSupport::KCalPrefs::instance()->audioFilePathItem(),
 
  431                                       0, filter )->urlRequester();
 
  434       connect( cb, SIGNAL(toggled(
bool)), rq, SLOT(setEnabled(
bool)) );
 
  440       remindersLayout->
addLayout( audioFileRemindersBox, 1, 0 );
 
  443           CalendarSupport::KCalPrefs::instance()->defaultEventRemindersItem() )->checkBox(), 2, 0 );
 
  446           CalendarSupport::KCalPrefs::instance()->defaultTodoRemindersItem() )->checkBox(), 3, 0 );
 
  455       mReminderTimeSpin->setValue( CalendarSupport::KCalPrefs::instance()->mReminderTime );
 
  456       mReminderUnitsCombo->setCurrentIndex(
 
  457         CalendarSupport::KCalPrefs::instance()->mReminderTimeUnits );
 
  458       for ( 
int i = 0; i < 7; ++i ) {
 
  463     void usrWriteConfig()
 
  466         mHolidayCombo->itemData( mHolidayCombo->currentIndex() ).
toString();
 
  468       CalendarSupport::KCalPrefs::instance()->mReminderTime =
 
  469         mReminderTimeSpin->value();
 
  470       CalendarSupport::KCalPrefs::instance()->mReminderTimeUnits =
 
  471         mReminderUnitsCombo->currentIndex();
 
  474       for ( 
int i = 0; i < 7; ++i ) {
 
  475         if ( mWorkDays[i]->isChecked() ) {
 
  476           mask = mask | ( 1 << i );
 
  481       CalendarSupport::KCalPrefs::instance()->writeConfig();
 
  487         int i = tags->indexOf( text );
 
  489           combo->setCurrentIndex( i );
 
  492         for ( 
int i=0; i < combo->count(); ++i ) {
 
  493           if ( combo->itemText( i ) == text ) {
 
  494             combo->setCurrentIndex( i );
 
  503     KComboBox    *mHolidayCombo;
 
  504     KIntSpinBox  *mReminderTimeSpin;
 
  505     KComboBox    *mReminderUnitsCombo;
 
  513     KGlobal::locale()->insertCatalog( 
QLatin1String(
"timezones4") );
 
  514     return new KOPrefsDialogTime( 
KOGlobals::self()->componentData(), parent );
 
  521 class KOPrefsDialogViews : 
public KPIM::KPrefsModule
 
  524     KOPrefsDialogViews( 
const KComponentData &inst, 
QWidget *parent )
 
  525       : KPIM::KPrefsModule( 
KOPrefs::instance(), inst, parent ),
 
  530       KTabWidget *tabWidget = 
new KTabWidget( 
this );
 
  533       connect( mMonthIconComboBox, SIGNAL(checkedItemsChanged(
QStringList)),
 
  534                SLOT(slotWidChanged()) );
 
  535       connect( mAgendaIconComboBox, SIGNAL(checkedItemsChanged(
QStringList)),
 
  536                SLOT(slotWidChanged()) );
 
  540       tabWidget->addTab( generalFrame, KIcon( 
QLatin1String(
"view-choose") ),
 
  541                          i18nc( 
"@title:tab general settings", 
"General" ) );
 
  550       gdisplayLayout->
addLayout( nextDaysLayout );
 
  552       KPIM::KPrefsWidInt *nextDays =
 
  554       nextDays->spinBox()->setSuffix(
 
  555         i18nc( 
"@label suffix in the N days spin box", 
" days" ) );
 
  557       nextDaysLayout->
addWidget( nextDays->label() );
 
  558       nextDaysLayout->
addWidget( nextDays->spinBox() );
 
  565       gdisplayBox->
setLayout( gdisplayLayout );
 
  587       tabWidget->addTab( agendaFrame, KIcon( 
QLatin1String(
"view-calendar-workweek") ),
 
  588                          i18nc( 
"@title:tab", 
"Agenda View" ) );
 
  597       adisplayLayout->
addLayout( hourSizeLayout );
 
  599       KPIM::KPrefsWidInt *hourSize =
 
  601       hourSize->spinBox()->setSuffix(
 
  602         i18nc( 
"@label suffix in the hour size spin box", 
" pixels" ) );
 
  604       hourSizeLayout->
addWidget( hourSize->label() );
 
  605       hourSizeLayout->
addWidget( hourSize->spinBox() );
 
  612       KPIM::KPrefsWidBool *marcusBainsEnabled =
 
  614       adisplayLayout->
addWidget( marcusBainsEnabled->checkBox() );
 
  616       KPIM::KPrefsWidBool *marcusBainsShowSeconds =
 
  618       connect( marcusBainsEnabled->checkBox(), SIGNAL(toggled(
bool)),
 
  619                marcusBainsShowSeconds->checkBox(), SLOT(setEnabled(
bool)) );
 
  621       adisplayLayout->
addWidget( marcusBainsShowSeconds->checkBox() );
 
  624       mAgendaIconComboBox->setCheckedIcons(
 
  626       adisplayLayout->
addWidget( mAgendaIconComboBox );
 
  627       adisplayBox->
setLayout( adisplayLayout );
 
  639         addWidRadios( 
KOPrefs::instance()->agendaViewCalendarDisplayItem() )->groupBox() );
 
  645       tabWidget->addTab( monthFrame, KIcon( 
QLatin1String(
"view-calendar-month") ),
 
  646                          i18nc( 
"@title:tab", 
"Month View" ) );
 
  663       mdisplayBox->
setLayout( mdisplayLayout );
 
  665       mMonthIconComboBox->setCheckedIcons(
 
  667       mdisplayLayout->
addWidget( mMonthIconComboBox );
 
  672         addWidBool( 
KOPrefs::instance()->colorMonthBusyDaysEnabledItem() )->checkBox() );
 
  681       tabWidget->addTab( todoFrame, KIcon( 
QLatin1String(
"view-calendar-tasks") ),
 
  682                          i18nc( 
"@title:tab", 
"Todo View" ) );
 
  690         addWidBool( 
KOPrefs::instance()->sortCompletedTodosSeparatelyItem() )->checkBox() );
 
  691       tdisplayBox->
setLayout( tdisplayLayout );
 
  706     void usrWriteConfig()
 
  709         mAgendaIconComboBox->checkedIcons() );
 
  711         mMonthIconComboBox->checkedIcons() );
 
  722     return new KOPrefsDialogViews( 
KOGlobals::self()->componentData(), parent );
 
  731   : KPIM::KPrefsModule( 
KOPrefs::instance(), inst, parent )
 
  734   KTabWidget *tabWidget = 
new KTabWidget( 
this );
 
  740   colorLayout->
setSpacing( KDialog::spacingHint() );
 
  741   tabWidget->addTab( colorFrame, KIcon( 
QLatin1String(
"preferences-desktop-color") ),
 
  742                      i18nc( 
"@title:tab", 
"Colors" ) );
 
  745   KPIM::KPrefsWidColor *holidayColor =
 
  746     addWidColor( 
KOPrefs::instance()->agendaHolidaysBackgroundColorItem(), colorFrame );
 
  747   colorLayout->
addWidget( holidayColor->label(), 0, 0 );
 
  748   colorLayout->
addWidget( holidayColor->button(), 0, 1 );
 
  751   KPIM::KPrefsWidColor *agendaBgColor =
 
  753   colorLayout->
addWidget( agendaBgColor->label(), 3, 0 );
 
  754   colorLayout->
addWidget( agendaBgColor->button(), 3, 1 );
 
  757   KPIM::KPrefsWidColor *mblColor =
 
  758     addWidColor( 
KOPrefs::instance()->agendaMarcusBainsLineLineColorItem(), colorFrame );
 
  759   colorLayout->
addWidget( mblColor->label(), 5, 0 );
 
  760   colorLayout->
addWidget( mblColor->button(), 5, 1 );
 
  762   KPIM::KPrefsWidColor *viewBgBusyColor =
 
  764   colorLayout->
addWidget( viewBgBusyColor->label(), 4, 0 );
 
  765   colorLayout->
addWidget( viewBgBusyColor->button(), 4, 1 );
 
  768   KPIM::KPrefsWidColor *agendaGridWorkHoursBackgroundColor =
 
  770   colorLayout->
addWidget( agendaGridWorkHoursBackgroundColor->label(), 6, 0 );
 
  771   colorLayout->
addWidget( agendaGridWorkHoursBackgroundColor->button(), 6, 1 );
 
  774   KPIM::KPrefsWidColor *todoDueTodayColor =
 
  777   colorLayout->
addWidget( todoDueTodayColor->label(), 7, 0 );
 
  778   colorLayout->
addWidget( todoDueTodayColor->button(), 7, 1 );
 
  781   KPIM::KPrefsWidColor *todoOverdueColor =
 
  784   colorLayout->
addWidget( todoOverdueColor->label(), 8, 0 );
 
  785   colorLayout->
addWidget( todoOverdueColor->button(), 8, 1 );
 
  788   QGroupBox *categoryGroup = 
new QGroupBox( i18nc( 
"@title:group", 
"Categories" ), colorFrame );
 
  789   colorLayout->
addWidget( categoryGroup, 9, 0, 1, 2 );
 
  792   categoryGroup->
setLayout( categoryLayout );
 
  794   KPIM::KPrefsWidColor *unsetCategoryColor =
 
  795     addWidColor( CalendarSupport::KCalPrefs::instance()->unsetCategoryColorItem(), categoryGroup );
 
  796   categoryLayout->
addWidget( unsetCategoryColor->label(), 0, 0 );
 
  797   categoryLayout->
addWidget( unsetCategoryColor->button(), 0, 1 );
 
  798   unsetCategoryColor->label()->setWhatsThis( unsetCategoryColor->button()->whatsThis() );
 
  799   unsetCategoryColor->label()->setToolTip( unsetCategoryColor->button()->toolTip() );
 
  801   mCategoryCombo = 
new KPIM::TagCombo( categoryGroup );
 
  802   mCategoryCombo->setWhatsThis(
 
  803     i18nc( 
"@info:whatsthis",
 
  804            "Select here the event category you want to modify. " 
  805            "You can change the selected category color using " 
  806            "the button below." ) );
 
  808   categoryLayout->
addWidget( mCategoryCombo, 1, 0 );
 
  810   mCategoryButton = 
new KColorButton( categoryGroup );
 
  811   mCategoryButton->setWhatsThis(
 
  812     i18nc( 
"@info:whatsthis",
 
  813            "Choose here the color of the event category selected " 
  814            "using the combo box above." ) );
 
  816   categoryLayout->
addWidget( mCategoryButton, 1, 1 );
 
  821   QGroupBox *resourceGroup = 
new QGroupBox( i18nc( 
"@title:group", 
"Resources" ), colorFrame );
 
  822   colorLayout->
addWidget( resourceGroup, 10, 0, 1, 2 );
 
  825   resourceGroup->
setLayout( resourceLayout );
 
  827   mResourceCombo = 
new Akonadi::CollectionComboBox( resourceGroup );
 
  830   mimetypes << KCalCore::Todo::todoMimeType();
 
  831   mimetypes << KCalCore::Journal::journalMimeType();
 
  832   mimetypes << KCalCore::Event::eventMimeType();
 
  834   mResourceCombo->setMimeTypeFilter( mimetypes );
 
  835   mResourceCombo->setWhatsThis(
 
  836     i18nc( 
"@info:whatsthis",
 
  837            "Select the calendar you want to modify. " 
  838            "You can change the selected calendar color using " 
  839            "the button below." ) );
 
  841   resourceLayout->
addWidget( mResourceCombo );
 
  843   mResourceButton = 
new KColorButton( resourceGroup );
 
  844   mResourceButton->setWhatsThis(
 
  845     i18nc( 
"@info:whatsthis",
 
  846            "Choose here the color of the calendar selected " 
  847            "using the combo box above." ) );
 
  849   resourceLayout->
addWidget( mResourceButton );
 
  854   tabWidget->addTab( fontFrame, KIcon( 
QLatin1String(
"preferences-desktop-font") ),
 
  855                      i18nc( 
"@title:tab", 
"Fonts" ) );
 
  858   fontLayout->
setSpacing( KDialog::spacingHint() );
 
  860   KPIM::KPrefsWidFont *timeBarFont =
 
  862                 KGlobal::locale()->formatTime( 
QTime( 12, 34 ) ) );
 
  863   fontLayout->
addWidget( timeBarFont->label(), 0, 0 );
 
  864   fontLayout->
addWidget( timeBarFont->preview(), 0, 1 );
 
  865   fontLayout->
addWidget( timeBarFont->button(), 0, 2 );
 
  867   KPIM::KPrefsWidFont *monthViewFont =
 
  870                 i18nc( 
"@label", 
"Event text" ) );
 
  872   fontLayout->
addWidget( monthViewFont->label(), 1, 0 );
 
  873   fontLayout->
addWidget( monthViewFont->preview(), 1, 1 );
 
  874   fontLayout->
addWidget( monthViewFont->button(), 1, 2 );
 
  876   KPIM::KPrefsWidFont *agendaViewFont =
 
  878                 i18nc( 
"@label", 
"Event text" ) );
 
  879   fontLayout->
addWidget( agendaViewFont->label(), 2, 0 );
 
  880   fontLayout->
addWidget( agendaViewFont->preview(), 2, 1 );
 
  881   fontLayout->
addWidget( agendaViewFont->button(), 2, 2 );
 
  883   KPIM::KPrefsWidFont *marcusBainsFont =
 
  885                 KGlobal::locale()->formatTime( 
QTime( 12, 34, 23 ) ) );
 
  886   fontLayout->
addWidget( marcusBainsFont->label(), 3, 0 );
 
  887   fontLayout->
addWidget( marcusBainsFont->preview(), 3, 1 );
 
  888   fontLayout->
addWidget( marcusBainsFont->button(), 3, 2 );
 
  899   while ( i != mCategoryDict.
constEnd() ) {
 
  900     CalendarSupport::KCalPrefs::instance()->setCategoryColor( i.
key(), i.
value() );
 
  905   while ( i != mResourceDict.
constEnd() ) {
 
  927   mCategoryDict.
insert( mCategoryCombo->currentText(), mCategoryButton->color() );
 
  933   const QString cat = mCategoryCombo->currentText();
 
  937     color = CalendarSupport::KCalPrefs::instance()->categoryColor( cat );
 
  940     mCategoryButton->setColor( color );
 
  954                        mResourceCombo->currentIndex(),
 
  955                        Akonadi::CollectionModel::CollectionIdRole ).toLongLong( &ok ) );
 
  959   mResourceDict.
insert( 
id, mResourceButton->color() );
 
  968                        mResourceCombo->currentIndex(),
 
  969                        Akonadi::CollectionModel::CollectionIdRole ).toLongLong( &ok ) );
 
  973   kDebug() << 
id << mResourceCombo->itemText( mResourceCombo->currentIndex() );
 
  979   mResourceButton->setColor( color );
 
  995   : KPIM::KPrefsModule( 
KOPrefs::instance(), inst, parent )
 
 1003   topLayout->
setSpacing( KDialog::spacingHint() );
 
 1005   KPIM::KPrefsWidBool *useGroupwareBool =
 
 1006     addWidBool( CalendarSupport::KCalPrefs::instance()->useGroupwareCommunicationItem(), topFrame );
 
 1007   topLayout->
addWidget( useGroupwareBool->checkBox(), 0, 0, 1, 2 );
 
 1009   KPIM::KPrefsWidBool *bcc =
 
 1010     addWidBool( Akonadi::CalendarSettings::self()->bccItem(), topFrame );
 
 1011   topLayout->
addWidget( bcc->checkBox(), 1, 0, 1, 2 );
 
 1014     i18nc( 
"@label", 
"Mail transport:" ), topFrame );
 
 1015   topLayout->
addWidget( aTransportLabel, 2, 0, 1, 2 );
 
 1017   MailTransport::TransportManagementWidget *tmw =
 
 1018     new MailTransport::TransportManagementWidget( topFrame );
 
 1019   tmw->layout()->setContentsMargins( 0, 0, 0, 0 );
 
 1020   topLayout->
addWidget( tmw, 3, 0, 1, 2 );
 
 1049   : KPrefsModule( CalendarSupport::KCalPrefs::instance(), inst, parent )
 
 1051   mGroupwarePage = 
new Ui::KOGroupwarePrefsPage();
 
 1055   mGroupwarePage->setupUi( widget );
 
 1057   mGroupwarePage->groupwareTab->setTabIcon( 0, KIcon( 
QLatin1String(
"go-up") ) );
 
 1058   mGroupwarePage->groupwareTab->setTabIcon( 1, KIcon( 
QLatin1String(
"go-down") ) );
 
 1062   connect( mGroupwarePage->publishDays, SIGNAL(valueChanged(
int)),
 
 1063            SLOT(slotWidChanged()) );
 
 1064   connect( mGroupwarePage->publishUrl, SIGNAL(textChanged(
QString)),
 
 1065            SLOT(slotWidChanged()) );
 
 1066   connect( mGroupwarePage->publishUser, SIGNAL(textChanged(
QString)),
 
 1067            SLOT(slotWidChanged()) );
 
 1068   connect( mGroupwarePage->publishPassword, SIGNAL(textChanged(
QString)),
 
 1069            SLOT(slotWidChanged()) );
 
 1070   connect( mGroupwarePage->publishSavePassword, SIGNAL(toggled(
bool)),
 
 1071            SLOT(slotWidChanged()) );
 
 1072   connect( mGroupwarePage->retrieveEnable, SIGNAL(toggled(
bool)),
 
 1073            SLOT(slotWidChanged()) );
 
 1074   connect( mGroupwarePage->retrieveUser, SIGNAL(textChanged(
QString)),
 
 1075            SLOT(slotWidChanged()) );
 
 1076   connect( mGroupwarePage->retrievePassword, SIGNAL(textChanged(
QString)),
 
 1077            SLOT(slotWidChanged()) );
 
 1078   connect( mGroupwarePage->retrieveSavePassword, SIGNAL(toggled(
bool)),
 
 1079            SLOT(slotWidChanged()) );
 
 1080   connect( mGroupwarePage->retrieveUrl, SIGNAL(textChanged(
QString)),
 
 1081            SLOT(slotWidChanged()));
 
 1082   connect( mGroupwarePage->publishDelay, SIGNAL(valueChanged(
int)),
 
 1083            SLOT(slotWidChanged()) );
 
 1084   connect( mGroupwarePage->fullDomainRetrieval, SIGNAL(toggled(
bool)),
 
 1085            SLOT(slotWidChanged()) );
 
 1086   connect( mGroupwarePage->publishEnable, SIGNAL(toggled(
bool)),
 
 1087            SLOT(slotWidChanged()) );
 
 1096   delete mGroupwarePage;
 
 1101   mGroupwarePage->publishEnable->setChecked(
 
 1102     Akonadi::CalendarSettings::self()->freeBusyPublishAuto() );
 
 1103   mGroupwarePage->publishDelay->setValue(
 
 1104     Akonadi::CalendarSettings::self()->freeBusyPublishDelay() );
 
 1105   mGroupwarePage->publishDays->setValue(
 
 1106     Akonadi::CalendarSettings::self()->freeBusyPublishDays() );
 
 1107   mGroupwarePage->publishUrl->setText(
 
 1108     Akonadi::CalendarSettings::self()->freeBusyPublishUrl() );
 
 1109   mGroupwarePage->publishUser->setText(
 
 1110     Akonadi::CalendarSettings::self()->freeBusyPublishUser() );
 
 1111   mGroupwarePage->publishPassword->setText(
 
 1112     Akonadi::CalendarSettings::self()->freeBusyPublishPassword() );
 
 1113   mGroupwarePage->publishSavePassword->setChecked(
 
 1114     Akonadi::CalendarSettings::self()->freeBusyPublishSavePassword() );
 
 1116   mGroupwarePage->retrieveEnable->setChecked(
 
 1117     Akonadi::CalendarSettings::self()->freeBusyRetrieveAuto() );
 
 1118   mGroupwarePage->fullDomainRetrieval->setChecked(
 
 1119     Akonadi::CalendarSettings::self()->freeBusyFullDomainRetrieval() );
 
 1120   mGroupwarePage->retrieveUrl->setText(
 
 1121     Akonadi::CalendarSettings::self()->freeBusyRetrieveUrl() );
 
 1122   mGroupwarePage->retrieveUser->setText(
 
 1123     Akonadi::CalendarSettings::self()->freeBusyRetrieveUser() );
 
 1124     mGroupwarePage->retrievePassword->setText(
 
 1125     Akonadi::CalendarSettings::self()->freeBusyRetrievePassword() );
 
 1126   mGroupwarePage->retrieveSavePassword->setChecked(
 
 1127     Akonadi::CalendarSettings::self()->freeBusyRetrieveSavePassword() );
 
 1132   Akonadi::CalendarSettings::self()->setFreeBusyPublishAuto(
 
 1133     mGroupwarePage->publishEnable->isChecked());
 
 1134   Akonadi::CalendarSettings::self()->setFreeBusyPublishDelay(mGroupwarePage->publishDelay->value());
 
 1135   Akonadi::CalendarSettings::self()->setFreeBusyPublishDays(
 
 1136     mGroupwarePage->publishDays->value());
 
 1137   Akonadi::CalendarSettings::self()->setFreeBusyPublishUrl(
 
 1138     mGroupwarePage->publishUrl->text());
 
 1139   Akonadi::CalendarSettings::self()->setFreeBusyPublishUser(
 
 1140     mGroupwarePage->publishUser->text());
 
 1141   Akonadi::CalendarSettings::self()->setFreeBusyPublishPassword(
 
 1142     mGroupwarePage->publishPassword->text());
 
 1143   Akonadi::CalendarSettings::self()->setFreeBusyPublishSavePassword(
 
 1144     mGroupwarePage->publishSavePassword->isChecked());
 
 1146   Akonadi::CalendarSettings::self()->setFreeBusyRetrieveAuto(
 
 1147     mGroupwarePage->retrieveEnable->isChecked());
 
 1148   Akonadi::CalendarSettings::self()->setFreeBusyFullDomainRetrieval(
 
 1149     mGroupwarePage->fullDomainRetrieval->isChecked());
 
 1150   Akonadi::CalendarSettings::self()->setFreeBusyRetrieveUrl(
 
 1151     mGroupwarePage->retrieveUrl->text());
 
 1152   Akonadi::CalendarSettings::self()->setFreeBusyRetrieveUser(
 
 1153     mGroupwarePage->retrieveUser->text());
 
 1154   Akonadi::CalendarSettings::self()->setFreeBusyRetrievePassword(
 
 1155     mGroupwarePage->retrievePassword->text());
 
 1156   Akonadi::CalendarSettings::self()->setFreeBusyRetrieveSavePassword(
 
 1157     mGroupwarePage->retrieveSavePassword->isChecked());
 
 1160   const QString configFile = KStandardDirs::locateLocal( 
"data", 
QLatin1String(
"korganizer/freebusyurls") );
 
 1161   KConfig cfg( configFile );
 
 1162   cfg.deleteGroup( CalendarSupport::KCalPrefs::instance()->email() );
 
 1165   Akonadi::CalendarSettings::self()->writeConfig();
 
 1182     PluginItem( 
QTreeWidget *parent, KService::Ptr service )
 
 1184         mService( service ) {}
 
 1187         mService( service ) {}
 
 1189     KService::Ptr service()
 
 1190     { 
return mService; }
 
 1193     KService::Ptr mService;
 
 1200   : KPrefsModule( 
KOPrefs::instance(), inst, parent )
 
 1207   topLayout->
setSpacing( KDialog::spacingHint() );
 
 1211   mTreeWidget->
setHeaderLabel( i18nc( 
"@title:column plugin name", 
"Name" ) );
 
 1214   mDescription = 
new QLabel( topFrame );
 
 1220   QSizePolicy policy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
 
 1229   mConfigureButton = 
new KPushButton(
 
 1230     KGuiItem( i18nc( 
"@action:button", 
"Configure &Plugin..." ),
 
 1232               i18nc( 
"@info:whatsthis",
 
 1233                      "This button allows you to configure" 
 1234                      " the plugin that you have selected in the list above" ) ),
 
 1236   buttonRowLayout->
addWidget( mConfigureButton );
 
 1240   mPositioningGroupBox = 
new QGroupBox( i18nc( 
"@title:group", 
"Position" ), topFrame );
 
 1244     i18nc( 
"@option:check", 
"Show at the top of the agenda views" ), mPositioningGroupBox );
 
 1246     i18nc( 
"@option:check", 
"Show at the bottom of the agenda views" ), mPositioningGroupBox );
 
 1249   positioningLayout->
addWidget( mPositionAgendaTop );
 
 1250   positioningLayout->
addWidget( mPositionAgendaBottom );
 
 1252   topLayout->
addWidget( mPositioningGroupBox );
 
 1254   connect( mConfigureButton, SIGNAL(clicked()), SLOT(
configure()) );
 
 1260   connect( mTreeWidget, SIGNAL(itemSelectionChanged()), SLOT(
selectionChanged()) );
 
 1262   connect( mTreeWidget, SIGNAL(itemClicked(
QTreeWidgetItem*,
int)), SLOT(slotWidChanged()) );
 
 1271   mTreeWidget->
clear();
 
 1277   QStringList selectedPlugins = viewPrefs->selectedPlugins();
 
 1281                            i18nc( 
"@title:group", 
"Calendar Decorations" ) ) );
 
 1284                            i18nc( 
"@title:group", 
"Other Plugins" ) ) );
 
 1286   KService::List::ConstIterator it;
 
 1287   KService::List::ConstIterator end(plugins.constEnd());
 
 1288   for ( it = plugins.constBegin(); it != end; ++it ) {
 
 1290     if ( (*it)->hasServiceType( EventViews::CalendarDecoration::Decoration::serviceType() ) ) {
 
 1291       item = 
new PluginItem( decorations, *it );
 
 1292     } 
else if ( !(*it)->hasServiceType( 
QLatin1String( 
"KOrganizer/PrintPlugin"  ) ) ) {
 
 1294       item = 
new PluginItem( others, *it );
 
 1298     if ( selectedPlugins.
contains( (*it)->desktopEntryName() ) ) {
 
 1308   mDecorationsAtMonthViewTop = 
KOPrefs::instance()->decorationsAtMonthViewTop().toSet();
 
 1309   mDecorationsAtAgendaViewTop = viewPrefs->decorationsAtAgendaViewTop().toSet();
 
 1310   mDecorationsAtAgendaViewBottom = viewPrefs->decorationsAtAgendaViewBottom().toSet();
 
 1319     for ( 
int j = 0; j < serviceTypeGroup->
childCount(); ++j) {
 
 1320       PluginItem *item = 
static_cast<PluginItem *
>( serviceTypeGroup->
child( j ) );
 
 1321       if( item->checkState( 0 ) == Qt::Checked ) {
 
 1322         selectedPlugins.
append( item->service()->desktopEntryName() );
 
 1327   viewPrefs->setSelectedPlugins( selectedPlugins );
 
 1330   viewPrefs->setDecorationsAtAgendaViewTop( mDecorationsAtAgendaViewTop.
toList() );
 
 1331   viewPrefs->setDecorationsAtAgendaViewBottom( mDecorationsAtAgendaViewBottom.
toList() );
 
 1340   PluginItem *item = 
static_cast<PluginItem *
>( mTreeWidget->
selectedItems().last() );
 
 1348     plugin->configure( 
this );
 
 1353     KMessageBox::sorry( 
this,
 
 1354                         i18nc( 
"@info", 
"Unable to configure this plugin" ),
 
 1365   PluginItem *item = 
dynamic_cast<PluginItem*
>( mTreeWidget->
selectedItems().last() );
 
 1370   QString decoration = item->service()->desktopEntryName();
 
 1380   if ( mPositionAgendaTop->
isChecked() ) {
 
 1381     if ( !mDecorationsAtAgendaViewTop.
contains( decoration ) ) {
 
 1382       mDecorationsAtAgendaViewTop.
insert( decoration );
 
 1385     mDecorationsAtAgendaViewTop.
remove( decoration );
 
 1388   if ( mPositionAgendaBottom->
isChecked() ) {
 
 1389     if ( !mDecorationsAtAgendaViewBottom.
contains( decoration ) ) {
 
 1390       mDecorationsAtAgendaViewBottom.
insert( decoration );
 
 1393     mDecorationsAtAgendaViewBottom.
remove( decoration );
 
 1401   mPositioningGroupBox->
hide();
 
 1407     mConfigureButton->setEnabled( 
false );
 
 1412   PluginItem *item = 
dynamic_cast<PluginItem*
>( mTreeWidget->
selectedItems().last() );
 
 1414     mConfigureButton->setEnabled( 
false );
 
 1421   bool hasSettings = 
true;
 
 1423     hasSettings = variant.
toBool();
 
 1426   mDescription->
setText( item->service()->comment() );
 
 1427   if ( !hasSettings ) {
 
 1428     mConfigureButton->hide();
 
 1430     mConfigureButton->show();
 
 1431     mConfigureButton->setEnabled( item->checkState(0) == Qt::Checked );
 
 1434   bool hasPosition = 
false;
 
 1435   if ( item->service()->hasServiceType(
 
 1436          EventViews::CalendarDecoration::Decoration::serviceType() ) ) {
 
 1437     QString decoration = item->service()->desktopEntryName();
 
 1442     if ( mDecorationsAtAgendaViewTop.
contains( decoration ) ) {
 
 1446     if ( mDecorationsAtAgendaViewBottom.
contains( decoration ) ) {
 
 1451     if ( !hasPosition ) {
 
 1453       mDecorationsAtAgendaViewTop << decoration;
 
 1457     mPositioningGroupBox->
setEnabled( item->checkState(0) == Qt::Checked );
 
 1458     mPositioningGroupBox->
show();
 
 1489   const QString dir = KStandardDirs::locateLocal( 
"data", 
QLatin1String(
"korganizer/designer/event/") );
 
 1500   CalendarSupport::KCalPrefs::instance()->setActiveDesignerFields( activePages );
 
 1501   CalendarSupport::KCalPrefs::instance()->writeConfig();
 
 1506   return CalendarSupport::KCalPrefs::instance()->activeDesignerFields();
 
void setVerticalStretch(uchar stretchFactor)
iterator insert(const Key &key, const T &value)
KCModule * create_korganizerconfigmain(QWidget *parent, const char *)
void setResourceColor(const QString &, const QColor &)
KService::List availablePlugins()
const Key key(const T &value) const
KCModule * create_korganizerconfigplugins(QWidget *parent, const char *)
void positioningChanged()
EventViews::PrefsPtr eventViewsPreferences() const 
void setFrameShape(Shape)
bool contains(const QString &str, Qt::CaseSensitivity cs) const
void setAlignment(QFlags< Qt::AlignmentFlag >)
KCModule * create_korganizerconfigcolorsandfonts(QWidget *parent, const char *)
QStringList readActivePages()
const_iterator insert(const T &value)
KCModule * create_korganizerconfiggroupscheduling(QWidget *parent, const char *)
KOPrefsDialogGroupScheduling(const KComponentData &inst, QWidget *parent)
KCModule * create_korgdesignerfields(QWidget *parent, const char *)
KHolidays::HolidayRegion * holidays() const 
return the HolidayRegion object or 0 if none has been defined 
void setSpacing(int spacing)
void updateResourceColor()
KOPrefsDialogGroupwareScheduling(const KComponentData &inst, QWidget *parent)
QString number(int n, int base)
void append(const T &value)
void setRowStretch(int row, int stretch)
const_iterator constEnd() const
QString applicationName()
KCModule * create_korganizerconfigviews(QWidget *parent, const char *)
virtual void addItem(QLayoutItem *item)
void setObjectName(const QString &name)
KCModule * create_korganizerconfigtime(QWidget *parent, const char *)
void setText(const QString &)
KService::List availableParts()
CalendarSupport::Plugin * loadPlugin(KService::Ptr service)
const T value(const Key &key) const
void writeActivePages(const QStringList &)
KOPrefsDialogColorsAndFonts(const KComponentData &inst, QWidget *parent)
bool contains(const T &value) const
void setFrameShadow(Shadow)
const KCalendarSystem * calendarSystem() const 
static KOGlobals * self()
void addLayout(QLayout *layout, int row, int column, QFlags< Qt::AlignmentFlag > alignment)
void toggleEmailSettings(bool on)
KOPrefsDialogPlugins(const KComponentData &inst, QWidget *parent)
Dialog for selecting and configuring KOrganizer plugins. 
const_iterator constBegin() const
bool remove(const T &value)
void updateCategoryColor()
char * toString(const T &value)
void addStretch(int stretch)
KCModule * create_korganizerconfigfreebusy(QWidget *parent, const char *)
void setColumnStretch(int column, int stretch)
~KOPrefsDialogGroupwareScheduling()
static KOPrefs * instance()
Get instance of KOPrefs. 
void setText(const QString &text)
QList< T > toList() const
iterator insert(const Key &key, const T &value)
void setHorizontalStretch(uchar stretchFactor)
KOPrefsDialogMain(const KComponentData &inst, QWidget *parent)
QFuture< void > filter(Sequence &sequence, FilterFunction filterFunction)
KOPrefsDesignerFields(const KComponentData &inst, QWidget *parent=0)
QColor resourceColor(const QString &)
void setWordWrap(bool on)
void setSpacing(int spacing)
void setHeightForWidth(bool dependent)
void addLayout(QLayout *layout, int stretch)