31 #include "ui_kogroupwareprefspage.h"
33 #include <calendarsupport/kcalprefs.h>
34 #include <calendarsupport/categoryconfig.h>
36 #include <incidenceeditor-ng/globalsettings.h>
38 #include <Akonadi/AgentFilterProxyModel>
39 #include <Akonadi/AgentInstanceCreateJob>
40 #include <Akonadi/AgentManager>
41 #include <Akonadi/AgentTypeDialog>
42 #include <Akonadi/CollectionComboBox>
43 #include <Akonadi/CollectionModel>
44 #include <akonadi/calendar/calendarsettings.h>
46 #include <KCalCore/Event>
47 #include <KCalCore/Journal>
49 #include <KHolidays/Holidays>
51 #include <Mailtransport/TransportManagementWidget>
53 #include <KCalendarSystem>
54 #include <KColorButton>
57 #include <KIntSpinBox>
58 #include <KMessageBox>
60 #include <KStandardDirs>
62 #include <KTimeComboBox>
63 #include <KUrlRequester>
64 #include <KWindowSystem>
67 #include <QFormLayout>
68 #include <QGridLayout>
71 #include <QListWidget>
72 #include <QRadioButton>
74 #include <QTreeWidget>
75 #include <QVBoxLayout>
78 : KPrefsModule(
KOPrefs::instance(), inst, parent )
80 QBoxLayout *topTopLayout =
new QVBoxLayout(
this );
81 KTabWidget *tabWidget =
new KTabWidget(
this );
82 topTopLayout->addWidget( tabWidget );
86 QVBoxLayout *personalLayout =
new QVBoxLayout( personalFrame );
87 tabWidget->addTab( personalFrame, KIcon( QLatin1String(
"preferences-desktop-personal") ),
88 i18nc(
"@title:tab personal settings",
"Personal" ) );
90 KPIM::KPrefsWidBool *emailControlCenter =
91 addWidBool( CalendarSupport::KCalPrefs::instance()->emailControlCenterItem(), personalFrame );
92 connect( emailControlCenter->checkBox(), SIGNAL(toggled(
bool)), SLOT(
toggleEmailSettings(
bool)) );
93 personalLayout->addWidget( emailControlCenter->checkBox() );
96 new QGroupBox( i18nc(
"@title:group email settings",
"Email Settings" ), personalFrame );
98 personalLayout->addWidget( mUserEmailSettings );
99 QFormLayout *emailSettingsLayout =
new QFormLayout( mUserEmailSettings );
100 KPIM::KPrefsWidString *s =
101 addWidString( CalendarSupport::KCalPrefs::instance()->userNameItem(), mUserEmailSettings );
102 emailSettingsLayout->addRow ( s->label(), s->lineEdit() );
104 s=addWidString( CalendarSupport::KCalPrefs::instance()->userEmailItem(), mUserEmailSettings );
105 emailSettingsLayout->addRow ( s->label(), s->lineEdit() );
107 KPIM::KPrefsWidRadios *defaultEmailAttachMethod =
109 IncidenceEditorNG::GlobalSettings::self()->defaultEmailAttachMethodItem(), personalFrame );
110 personalLayout->addWidget( defaultEmailAttachMethod->groupBox() );
111 personalLayout->addStretch( 1 );
115 tabWidget->addTab( saveFrame, KIcon( QLatin1String(
"document-save") ),
116 i18nc(
"@title:tab",
"Save" ) );
117 QVBoxLayout *saveLayout =
new QVBoxLayout( saveFrame );
119 QGroupBox *saveGroupBox =
120 new QGroupBox( i18nc(
"@title:group",
"Exporting Calendar" ), saveFrame );
121 saveLayout->addWidget( saveGroupBox );
122 QVBoxLayout *saveGroupLayout =
new QVBoxLayout;
123 saveGroupBox->setLayout( saveGroupLayout );
125 KPIM::KPrefsWidBool *autoExportHTML =
127 saveGroupLayout->addWidget( autoExportHTML->checkBox() );
129 QBoxLayout *intervalLayout =
new QHBoxLayout;
130 saveGroupLayout->addLayout( intervalLayout );
132 KPIM::KPrefsWidInt *autoExportInterval =
134 connect( autoExportHTML->checkBox(), SIGNAL(toggled(
bool)),
135 autoExportInterval->label(), SLOT(setEnabled(
bool)) );
136 connect( autoExportHTML->checkBox(), SIGNAL(toggled(
bool)),
137 autoExportInterval->spinBox(), SLOT(setEnabled(
bool)) );
138 intervalLayout->addWidget( autoExportInterval->label() );
139 intervalLayout->addWidget( autoExportInterval->spinBox() );
141 KPIM::KPrefsWidBool *confirmItem =
143 saveLayout->addWidget( confirmItem->checkBox() );
144 KPIM::KPrefsWidRadios *destinationItem =
147 saveLayout->addWidget( destinationItem->groupBox() );
148 saveLayout->addStretch( 1 );
152 QVBoxLayout *systrayLayout =
new QVBoxLayout( systrayFrame );
153 tabWidget->addTab( systrayFrame, KIcon( QLatin1String(
"preferences-other") ),
154 i18nc(
"@title:tab systray settings",
"System Tray" ) );
156 QGroupBox *systrayGroupBox =
157 new QGroupBox( i18nc(
"@title:group",
"Show/Hide Options" ), systrayFrame );
158 systrayLayout->addWidget( systrayGroupBox );
159 QVBoxLayout *systrayGroupLayout =
new QVBoxLayout;
160 systrayGroupBox->setLayout( systrayGroupLayout );
162 KPIM::KPrefsWidBool *showReminderDaemonItem =
164 systrayGroupLayout->addWidget( showReminderDaemonItem->checkBox() );
165 showReminderDaemonItem->checkBox()->setToolTip(
166 i18nc(
"@info:tooltip",
"Enable this setting to show the KOrganizer "
167 "reminder daemon in your system tray (recommended)." ) );
169 QLabel *note =
new QLabel(
171 "<note>The daemon will continue running even if it is not shown "
172 "in the system tray.</note>" ) );
173 systrayGroupLayout->addWidget( note );
175 systrayLayout->addStretch( 1 );
179 tabWidget->addTab( calendarFrame, KIcon( QLatin1String(
"office-calendar") ),
180 i18nc(
"@title:tab calendar account settings",
"Calendars" ) );
182 mAccountsCalendar.setupUi( calendarFrame );
184 mAccountsCalendar.vlay->setSpacing( KDialog::spacingHint() );
185 mAccountsCalendar.vlay->setMargin( KDialog::marginHint() );
187 mAccountsCalendar.mAccountList->agentFilterProxyModel()->
188 addMimeTypeFilter( QLatin1String(
"text/calendar") );
189 mAccountsCalendar.mAccountList->agentFilterProxyModel()->
190 addCapabilityFilter( QLatin1String(
"Resource") );
191 mAccountsCalendar.mFilterAccount->
192 setProxy( mAccountsCalendar.mAccountList->agentFilterProxyModel() );
194 connect( mAccountsCalendar.mAccountList->view()->selectionModel(),
195 SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
197 connect( mAccountsCalendar.mAccountList, SIGNAL(doubleClicked(Akonadi::AgentInstance)),
200 mAccountsCalendar.hlay->insertWidget( 0, mAccountsCalendar.mAccountList );
202 connect( mAccountsCalendar.mAddAccountButton, SIGNAL(clicked()),
205 connect( mAccountsCalendar.mModifyAccountButton, SIGNAL(clicked()),
208 const bool hasSelection = !mAccountsCalendar.mAccountList->selectedAgentInstances().isEmpty();
209 mAccountsCalendar.mModifyAccountButton->setEnabled( hasSelection );
210 mAccountsCalendar.mRemoveAccountButton->setEnabled( hasSelection );
212 connect( mAccountsCalendar.mRemoveAccountButton, SIGNAL(clicked()),
220 if ( mAccountsCalendar.mAccountList->selectedAgentInstances().isEmpty() ) {
221 mAccountsCalendar.mModifyAccountButton->setEnabled(
false );
222 mAccountsCalendar.mRemoveAccountButton->setEnabled(
false );
224 Akonadi::AgentInstance selectedAgent =
225 mAccountsCalendar.mAccountList->selectedAgentInstances().first();
227 mAccountsCalendar.mModifyAccountButton->setEnabled(
228 !selectedAgent.type().capabilities().contains( QLatin1String(
"NoConfig" ) ) );
230 mAccountsCalendar.mRemoveAccountButton->setEnabled(
true );
237 Akonadi::AgentTypeDialog dlg(
this );
238 Akonadi::AgentFilterProxyModel *filter = dlg.agentFilterProxyModel();
239 filter->addMimeTypeFilter( QLatin1String(
"text/calendar") );
240 filter->addCapabilityFilter( QLatin1String(
"Resource") );
242 const Akonadi::AgentType agentType = dlg.agentType();
244 if ( agentType.isValid() ) {
246 Akonadi::AgentInstanceCreateJob *job =
new Akonadi::AgentInstanceCreateJob( agentType,
this );
247 job->configure(
this );
255 Akonadi::AgentInstance instance = mAccountsCalendar.mAccountList->currentAgentInstance();
256 if ( instance.isValid() ) {
257 KWindowSystem::allowExternalProcessWindowActivation();
258 instance.configure(
this );
264 const Akonadi::AgentInstance instance = mAccountsCalendar.mAccountList->currentAgentInstance();
265 if ( instance.isValid() ) {
266 Akonadi::AgentManager::self()->removeInstance( instance );
274 mUserEmailSettings->setEnabled( !on );
296 class KOPrefsDialogTime :
public KPIM::KPrefsModule
299 KOPrefsDialogTime(
const KComponentData &inst,
QWidget *parent )
300 : KPIM::KPrefsModule(
KOPrefs::instance(), inst, parent )
302 QVBoxLayout *layout =
new QVBoxLayout(
this );
303 KTabWidget *tabWidget =
new KTabWidget(
this );
304 layout->addWidget( tabWidget );
307 tabWidget->addTab( regionalPage, KIcon( QLatin1String(
"flag") ),
308 i18nc(
"@title:tab",
"Regional" ) );
310 QGridLayout *regionalLayout =
new QGridLayout( regionalPage );
311 regionalLayout->setSpacing( KDialog::spacingHint() );
313 QGroupBox *datetimeGroupBox =
314 new QGroupBox( i18nc(
"@title:group",
"General Time and Date" ), regionalPage );
315 regionalLayout->addWidget( datetimeGroupBox, 0, 0 );
317 QGridLayout *datetimeLayout =
new QGridLayout( datetimeGroupBox );
319 KPIM::KPrefsWidTime *dayBegins =
321 datetimeLayout->addWidget( dayBegins->label(), 1, 0 );
322 datetimeLayout->addWidget( dayBegins->timeEdit(), 1, 1 );
324 QGroupBox *holidaysGroupBox =
325 new QGroupBox( i18nc(
"@title:group",
"Holidays" ), regionalPage );
326 regionalLayout->addWidget( holidaysGroupBox, 1, 0 );
328 QGridLayout *holidaysLayout =
new QGridLayout( holidaysGroupBox );
331 KHBox *holidayRegBox =
new KHBox( regionalPage );
332 holidaysLayout->addWidget( holidayRegBox, 1, 0, 1, 2 );
334 QLabel *holidayLabel =
new QLabel(
335 i18nc(
"@label",
"Use holiday region:" ), holidayRegBox );
338 mHolidayCombo =
new KComboBox( holidayRegBox );
339 connect( mHolidayCombo, SIGNAL(activated(
int)), SLOT(slotWidChanged()) );
343 QStringList regions = KHolidays::HolidayRegion::regionCodes();
344 QMap<QString, QString> regionsMap;
346 foreach (
const QString & regionCode, regions ) {
347 QString name = KHolidays::HolidayRegion::name( regionCode );
348 QString languageName =
349 KGlobal::locale()->languageCodeToName(
350 KHolidays::HolidayRegion::languageCode( regionCode ) );
352 if ( languageName.isEmpty() ) {
355 label = i18nc(
"Holday region, region language",
"%1 (%2)", name, languageName );
357 regionsMap.insert( label, regionCode );
360 mHolidayCombo->addItem( i18nc(
"No holiday region",
"None" ), QString() );
361 QMapIterator<QString, QString> i( regionsMap );
362 while ( i.hasNext() ) {
364 mHolidayCombo->addItem( i.key(), i.value() );
368 mHolidayCombo->setCurrentIndex(
371 mHolidayCombo->setCurrentIndex( 0 );
374 QGroupBox *workingHoursGroupBox =
375 new QGroupBox( i18nc(
"@title:group",
"Working Period" ), regionalPage );
376 regionalLayout->addWidget( workingHoursGroupBox, 2, 0 );
378 QBoxLayout *workingHoursLayout =
new QVBoxLayout( workingHoursGroupBox );
380 QBoxLayout *workDaysLayout =
new QHBoxLayout;
381 workingHoursLayout->addLayout( workDaysLayout );
384 int weekStart = KGlobal::locale()->weekStartDay();
385 for (
int i=0; i < 7; ++i ) {
387 QString weekDayName = calSys->weekDayName( ( i + weekStart + 6 ) % 7 + 1,
388 KCalendarSystem::ShortDayName );
389 int index = ( i + weekStart + 6 ) % 7;
390 mWorkDays[ index ] =
new QCheckBox( weekDayName );
391 mWorkDays[ index ]->setWhatsThis(
392 i18nc(
"@info:whatsthis",
393 "Check this box to make KOrganizer mark the "
394 "working hours for this day of the week. "
395 "If this is a work day for you, check "
396 "this box, or the working hours will not be "
397 "marked with color." ) );
399 connect( mWorkDays[ index ], SIGNAL(stateChanged(
int)), SLOT(slotWidChanged()) );
401 workDaysLayout->addWidget( mWorkDays[ index ] );
404 KPIM::KPrefsWidTime *workStart =
407 QHBoxLayout *workStartLayout =
new QHBoxLayout;
408 workingHoursLayout->addLayout( workStartLayout );
410 workStartLayout->addWidget( workStart->label() );
411 workStartLayout->addWidget( workStart->timeEdit() );
413 KPIM::KPrefsWidTime *workEnd =
416 QHBoxLayout *workEndLayout =
new QHBoxLayout;
417 workingHoursLayout->addLayout( workEndLayout );
419 workEndLayout->addWidget( workEnd->label() );
420 workEndLayout->addWidget( workEnd->timeEdit() );
422 KPIM::KPrefsWidBool *excludeHolidays =
425 workingHoursLayout->addWidget( excludeHolidays->checkBox() );
427 regionalLayout->setRowStretch( 4, 1 );
430 tabWidget->addTab( defaultPage, KIcon( QLatin1String(
"draw-eraser") ),
431 i18nc(
"@title:tab",
"Default Values" ) );
432 QGridLayout *defaultLayout =
new QGridLayout( defaultPage );
433 defaultLayout->setSpacing( KDialog::spacingHint() );
435 QGroupBox *timesGroupBox =
436 new QGroupBox( i18nc(
"@title:group",
"Appointments" ), defaultPage );
437 defaultLayout->addWidget( timesGroupBox, 0, 0 );
439 QGridLayout *timesLayout =
new QGridLayout( timesGroupBox );
441 KPIM::KPrefsWidTime *defaultTime =
442 addWidTime( CalendarSupport::KCalPrefs::instance()->startTimeItem(), defaultPage );
443 timesLayout->addWidget( defaultTime->label(), 0, 0 );
444 timesLayout->addWidget( defaultTime->timeEdit(), 0, 1 );
446 KPIM::KPrefsWidDuration *defaultDuration =
447 addWidDuration( CalendarSupport::KCalPrefs::instance()->defaultDurationItem(),
448 QLatin1String(
"hh:mm"), defaultPage );
450 timesLayout->addWidget( defaultDuration->label(), 1, 0 );
451 timesLayout->addWidget( defaultDuration->timeEdit(), 1, 1 );
453 QGroupBox *remindersGroupBox =
454 new QGroupBox( i18nc(
"@title:group",
"Reminders" ), defaultPage );
455 defaultLayout->addWidget( remindersGroupBox, 1, 0 );
457 QGridLayout *remindersLayout =
new QGridLayout( remindersGroupBox );
459 QLabel *reminderLabel =
460 new QLabel( i18nc(
"@label",
"Default reminder time:" ), defaultPage );
461 remindersLayout->addWidget( reminderLabel, 0, 0 );
462 reminderLabel->setWhatsThis(
463 CalendarSupport::KCalPrefs::instance()->reminderTimeItem()->whatsThis() );
464 mReminderTimeSpin =
new KIntSpinBox( defaultPage );
465 mReminderTimeSpin->setWhatsThis(
466 CalendarSupport::KCalPrefs::instance()->reminderTimeItem()->whatsThis() );
467 mReminderTimeSpin->setToolTip(
468 CalendarSupport::KCalPrefs::instance()->reminderTimeItem()->toolTip() );
469 connect( mReminderTimeSpin, SIGNAL(valueChanged(
int)), SLOT(slotWidChanged()) );
470 remindersLayout->addWidget( mReminderTimeSpin, 0, 1 );
472 mReminderUnitsCombo =
new KComboBox( defaultPage );
473 mReminderUnitsCombo->setToolTip(
474 CalendarSupport::KCalPrefs::instance()->reminderTimeUnitsItem()->toolTip() );
475 mReminderUnitsCombo->setWhatsThis(
476 CalendarSupport::KCalPrefs::instance()->reminderTimeUnitsItem()->whatsThis() );
477 connect( mReminderUnitsCombo, SIGNAL(activated(
int)), SLOT(slotWidChanged()) );
478 mReminderUnitsCombo->addItem(
479 i18nc(
"@item:inlistbox reminder units in minutes",
"minute(s)" ) );
480 mReminderUnitsCombo->addItem(
481 i18nc(
"@item:inlistbox reminder time units in hours",
"hour(s)" ) );
482 mReminderUnitsCombo->addItem(
483 i18nc(
"@item:inlistbox reminder time units in days",
"day(s)" ) );
484 remindersLayout->addWidget( mReminderUnitsCombo, 0, 2 );
488 CalendarSupport::KCalPrefs::instance()->defaultAudioFileRemindersItem() )->checkBox();
489 cb->setText( QString() );
491 if ( CalendarSupport::KCalPrefs::instance()->audioFilePathItem()->value().isEmpty() ) {
492 QString defAudioFile = KGlobal::dirs()->findResourceDir(
"sound", QLatin1String(
"KDE-Sys-Warning.ogg") );
493 CalendarSupport::KCalPrefs::instance()->audioFilePathItem()->setValue(
494 defAudioFile + QLatin1String(
"KDE-Sys-Warning.ogg") );
497 i18n(
"*.ogg *.wav *.mp3 *.wma *.flac *.aiff *.raw *.au *.ra|"
498 "Audio Files (*.ogg *.wav *.mp3 *.wma *.flac *.aiff *.raw *.au *.ra)" );
499 KUrlRequester *rq = addWidPath( CalendarSupport::KCalPrefs::instance()->audioFilePathItem(),
500 0, filter )->urlRequester();
501 rq->setEnabled( cb->isChecked() );
503 connect( cb, SIGNAL(toggled(
bool)), rq, SLOT(setEnabled(
bool)) );
505 QHBoxLayout *audioFileRemindersBox =
new QHBoxLayout( remindersGroupBox );
506 audioFileRemindersBox->addWidget( cb );
507 audioFileRemindersBox->addWidget( rq );
509 remindersLayout->addLayout( audioFileRemindersBox, 1, 0 );
510 remindersLayout->addWidget(
512 CalendarSupport::KCalPrefs::instance()->defaultEventRemindersItem() )->checkBox(), 2, 0 );
513 remindersLayout->addWidget(
515 CalendarSupport::KCalPrefs::instance()->defaultTodoRemindersItem() )->checkBox(), 3, 0 );
517 defaultLayout->setRowStretch( 3, 1 );
524 mReminderTimeSpin->setValue( CalendarSupport::KCalPrefs::instance()->mReminderTime );
525 mReminderUnitsCombo->setCurrentIndex(
526 CalendarSupport::KCalPrefs::instance()->mReminderTimeUnits );
527 for (
int i = 0; i < 7; ++i ) {
532 void usrWriteConfig()
535 mHolidayCombo->itemData( mHolidayCombo->currentIndex() ).toString();
537 CalendarSupport::KCalPrefs::instance()->mReminderTime =
538 mReminderTimeSpin->value();
539 CalendarSupport::KCalPrefs::instance()->mReminderTimeUnits =
540 mReminderUnitsCombo->currentIndex();
543 for (
int i = 0; i < 7; ++i ) {
544 if ( mWorkDays[i]->isChecked() ) {
545 mask = mask | ( 1 << i );
550 CalendarSupport::KCalPrefs::instance()->writeConfig();
553 void setCombo( KComboBox *combo,
const QString &text,
const QStringList *tags = 0 )
556 int i = tags->indexOf( text );
558 combo->setCurrentIndex( i );
561 for (
int i=0; i < combo->count(); ++i ) {
562 if ( combo->itemText( i ) == text ) {
563 combo->setCurrentIndex( i );
571 QStringList tzonenames;
572 KComboBox *mHolidayCombo;
573 KIntSpinBox *mReminderTimeSpin;
574 KComboBox *mReminderUnitsCombo;
575 QCheckBox *mWorkDays[7];
582 KGlobal::locale()->insertCatalog( QLatin1String(
"timezones4") );
583 return new KOPrefsDialogTime(
KOGlobals::self()->componentData(), parent );
590 class KOPrefsDialogViews :
public KPIM::KPrefsModule
593 KOPrefsDialogViews(
const KComponentData &inst,
QWidget *parent )
594 : KPIM::KPrefsModule(
KOPrefs::instance(), inst, parent ),
598 QBoxLayout *topTopLayout =
new QVBoxLayout(
this );
599 KTabWidget *tabWidget =
new KTabWidget(
this );
600 topTopLayout->addWidget( tabWidget );
602 connect( mMonthIconComboBox, SIGNAL(checkedItemsChanged(QStringList)),
603 SLOT(slotWidChanged()) );
604 connect( mAgendaIconComboBox, SIGNAL(checkedItemsChanged(QStringList)),
605 SLOT(slotWidChanged()) );
609 tabWidget->addTab( generalFrame, KIcon( QLatin1String(
"view-choose") ),
610 i18nc(
"@title:tab general settings",
"General" ) );
612 QBoxLayout *generalLayout =
new QVBoxLayout( generalFrame );
615 QVBoxLayout *gdisplayLayout =
new QVBoxLayout;
616 QGroupBox *gdisplayBox =
new QGroupBox( i18nc(
"@title:group",
"Display Options" ) );
618 QBoxLayout *nextDaysLayout =
new QHBoxLayout;
619 gdisplayLayout->addLayout( nextDaysLayout );
621 KPIM::KPrefsWidInt *nextDays =
623 nextDays->spinBox()->setSuffix(
624 i18nc(
"@label suffix in the N days spin box",
" days" ) );
626 nextDaysLayout->addWidget( nextDays->label() );
627 nextDaysLayout->addWidget( nextDays->spinBox() );
628 nextDaysLayout->addStretch( 1 );
630 gdisplayLayout->addWidget(
632 gdisplayLayout->addWidget(
634 gdisplayBox->setLayout( gdisplayLayout );
635 generalLayout->addWidget( gdisplayBox );
638 QVBoxLayout *datenavLayout =
new QVBoxLayout;
639 QGroupBox *datenavBox =
new QGroupBox( i18nc(
"@title:group",
"Date Navigator" ) );
640 datenavLayout->addWidget(
642 datenavLayout->addWidget(
644 datenavLayout->addWidget(
646 datenavLayout->addWidget(
648 datenavLayout->addWidget(
650 datenavBox->setLayout( datenavLayout );
651 generalLayout->addWidget( datenavBox );
652 generalLayout->addStretch( 1 );
656 tabWidget->addTab( agendaFrame, KIcon( QLatin1String(
"view-calendar-workweek") ),
657 i18nc(
"@title:tab",
"Agenda View" ) );
659 QBoxLayout *agendaLayout =
new QVBoxLayout( agendaFrame );
662 QVBoxLayout *adisplayLayout =
new QVBoxLayout;
663 QGroupBox *adisplayBox =
new QGroupBox( i18nc(
"@title:group",
"Display Options" ) );
665 QHBoxLayout *hourSizeLayout =
new QHBoxLayout;
666 adisplayLayout->addLayout( hourSizeLayout );
668 KPIM::KPrefsWidInt *hourSize =
670 hourSize->spinBox()->setSuffix(
671 i18nc(
"@label suffix in the hour size spin box",
" pixels" ) );
673 hourSizeLayout->addWidget( hourSize->label() );
674 hourSizeLayout->addWidget( hourSize->spinBox() );
675 hourSizeLayout->addStretch( 1 );
677 adisplayLayout->addWidget(
679 adisplayLayout->addWidget(
681 KPIM::KPrefsWidBool *marcusBainsEnabled =
683 adisplayLayout->addWidget( marcusBainsEnabled->checkBox() );
685 KPIM::KPrefsWidBool *marcusBainsShowSeconds =
687 connect( marcusBainsEnabled->checkBox(), SIGNAL(toggled(
bool)),
688 marcusBainsShowSeconds->checkBox(), SLOT(setEnabled(
bool)) );
690 adisplayLayout->addWidget( marcusBainsShowSeconds->checkBox() );
691 adisplayLayout->addWidget(
693 mAgendaIconComboBox->setCheckedIcons(
695 adisplayLayout->addWidget( mAgendaIconComboBox );
696 adisplayBox->setLayout( adisplayLayout );
697 agendaLayout->addWidget( adisplayBox );
700 agendaLayout->addWidget(
703 agendaLayout->addWidget(
707 agendaLayout->addWidget(
708 addWidRadios(
KOPrefs::instance()->agendaViewCalendarDisplayItem() )->groupBox() );
710 agendaLayout->addStretch( 1 );
714 tabWidget->addTab( monthFrame, KIcon( QLatin1String(
"view-calendar-month") ),
715 i18nc(
"@title:tab",
"Month View" ) );
717 QBoxLayout *monthLayout =
new QVBoxLayout( monthFrame );
720 QVBoxLayout *mdisplayLayout =
new QVBoxLayout;
721 QGroupBox *mdisplayBox =
new QGroupBox( i18nc(
"@title:group",
"Display Options" ) );
724 mdisplayLayout->addWidget(
726 mdisplayLayout->addWidget(
728 mdisplayLayout->addWidget(
730 mdisplayLayout->addWidget(
732 mdisplayBox->setLayout( mdisplayLayout );
734 mMonthIconComboBox->setCheckedIcons(
736 mdisplayLayout->addWidget( mMonthIconComboBox );
738 monthLayout->addWidget( mdisplayBox );
740 monthLayout->addWidget(
741 addWidBool(
KOPrefs::instance()->colorMonthBusyDaysEnabledItem() )->checkBox() );
744 monthLayout->addWidget(
746 monthLayout->addStretch( 1 );
750 tabWidget->addTab( todoFrame, KIcon( QLatin1String(
"view-calendar-tasks") ),
751 i18nc(
"@title:tab",
"Todo View" ) );
753 QBoxLayout *todoLayout =
new QVBoxLayout( todoFrame );
756 QVBoxLayout *tdisplayLayout =
new QVBoxLayout;
757 QGroupBox *tdisplayBox =
new QGroupBox( i18nc(
"@title:group",
"Display Options" ) );
758 tdisplayLayout->addWidget(
759 addWidBool(
KOPrefs::instance()->sortCompletedTodosSeparatelyItem() )->checkBox() );
760 tdisplayBox->setLayout( tdisplayLayout );
761 todoLayout->addWidget( tdisplayBox );
764 QVBoxLayout *otherLayout =
new QVBoxLayout;
765 QGroupBox *otherBox =
new QGroupBox( i18nc(
"@title:group",
"Other Options" ) );
766 otherLayout->addWidget(
768 otherBox->setLayout( otherLayout );
769 todoLayout->addWidget( otherBox );
770 todoLayout->addStretch( 1 );
775 void usrWriteConfig()
778 mAgendaIconComboBox->checkedIcons() );
780 mMonthIconComboBox->checkedIcons() );
791 return new KOPrefsDialogViews(
KOGlobals::self()->componentData(), parent );
800 : KPIM::KPrefsModule(
KOPrefs::instance(), inst, parent )
802 QBoxLayout *topTopLayout =
new QVBoxLayout(
this );
803 KTabWidget *tabWidget =
new KTabWidget(
this );
804 topTopLayout->addWidget( tabWidget );
807 topTopLayout->addWidget( colorFrame );
808 QGridLayout *colorLayout =
new QGridLayout(colorFrame);
809 colorLayout->setSpacing( KDialog::spacingHint() );
810 tabWidget->addTab( colorFrame, KIcon( QLatin1String(
"preferences-desktop-color") ),
811 i18nc(
"@title:tab",
"Colors" ) );
814 KPIM::KPrefsWidColor *holidayColor =
815 addWidColor(
KOPrefs::instance()->agendaHolidaysBackgroundColorItem(), colorFrame );
816 colorLayout->addWidget( holidayColor->label(), 0, 0 );
817 colorLayout->addWidget( holidayColor->button(), 0, 1 );
820 KPIM::KPrefsWidColor *agendaBgColor =
822 colorLayout->addWidget( agendaBgColor->label(), 3, 0 );
823 colorLayout->addWidget( agendaBgColor->button(), 3, 1 );
826 KPIM::KPrefsWidColor *mblColor =
827 addWidColor(
KOPrefs::instance()->agendaMarcusBainsLineLineColorItem(), colorFrame );
828 colorLayout->addWidget( mblColor->label(), 5, 0 );
829 colorLayout->addWidget( mblColor->button(), 5, 1 );
831 KPIM::KPrefsWidColor *viewBgBusyColor =
833 colorLayout->addWidget( viewBgBusyColor->label(), 4, 0 );
834 colorLayout->addWidget( viewBgBusyColor->button(), 4, 1 );
837 KPIM::KPrefsWidColor *agendaGridWorkHoursBackgroundColor =
839 colorLayout->addWidget( agendaGridWorkHoursBackgroundColor->label(), 6, 0 );
840 colorLayout->addWidget( agendaGridWorkHoursBackgroundColor->button(), 6, 1 );
843 KPIM::KPrefsWidColor *todoDueTodayColor =
846 colorLayout->addWidget( todoDueTodayColor->label(), 7, 0 );
847 colorLayout->addWidget( todoDueTodayColor->button(), 7, 1 );
850 KPIM::KPrefsWidColor *todoOverdueColor =
853 colorLayout->addWidget( todoOverdueColor->label(), 8, 0 );
854 colorLayout->addWidget( todoOverdueColor->button(), 8, 1 );
857 QGroupBox *categoryGroup =
new QGroupBox( i18nc(
"@title:group",
"Categories" ), colorFrame );
858 colorLayout->addWidget( categoryGroup, 9, 0, 1, 2 );
860 QGridLayout *categoryLayout =
new QGridLayout;
861 categoryGroup->setLayout( categoryLayout );
863 KPIM::KPrefsWidColor *unsetCategoryColor =
864 addWidColor( CalendarSupport::KCalPrefs::instance()->unsetCategoryColorItem(), categoryGroup );
865 categoryLayout->addWidget( unsetCategoryColor->label(), 0, 0 );
866 categoryLayout->addWidget( unsetCategoryColor->button(), 0, 1 );
867 unsetCategoryColor->label()->setWhatsThis( unsetCategoryColor->button()->whatsThis() );
868 unsetCategoryColor->label()->setToolTip( unsetCategoryColor->button()->toolTip() );
870 mCategoryCombo =
new KComboBox( categoryGroup );
871 mCategoryCombo->addItems(
873 mCategoryCombo->setWhatsThis(
874 i18nc(
"@info:whatsthis",
875 "Select here the event category you want to modify. "
876 "You can change the selected category color using "
877 "the button below." ) );
879 categoryLayout->addWidget( mCategoryCombo, 1, 0 );
881 mCategoryButton =
new KColorButton( categoryGroup );
882 mCategoryButton->setWhatsThis(
883 i18nc(
"@info:whatsthis",
884 "Choose here the color of the event category selected "
885 "using the combo box above." ) );
886 connect( mCategoryButton, SIGNAL(changed(QColor)), SLOT(
setCategoryColor()) );
887 categoryLayout->addWidget( mCategoryButton, 1, 1 );
892 QGroupBox *resourceGroup =
new QGroupBox( i18nc(
"@title:group",
"Resources" ), colorFrame );
893 colorLayout->addWidget( resourceGroup, 10, 0, 1, 2 );
895 QBoxLayout *resourceLayout =
new QHBoxLayout;
896 resourceGroup->setLayout( resourceLayout );
898 mResourceCombo =
new Akonadi::CollectionComboBox( resourceGroup );
900 QStringList mimetypes;
901 mimetypes << KCalCore::Todo::todoMimeType();
902 mimetypes << KCalCore::Journal::journalMimeType();
903 mimetypes << KCalCore::Event::eventMimeType();
905 mResourceCombo->setMimeTypeFilter( mimetypes );
906 mResourceCombo->setWhatsThis(
907 i18nc(
"@info:whatsthis",
908 "Select the calendar you want to modify. "
909 "You can change the selected calendar color using "
910 "the button below." ) );
912 resourceLayout->addWidget( mResourceCombo );
914 mResourceButton =
new KColorButton( resourceGroup );
915 mResourceButton->setWhatsThis(
916 i18nc(
"@info:whatsthis",
917 "Choose here the color of the calendar selected "
918 "using the combo box above." ) );
919 connect( mResourceButton, SIGNAL(changed(QColor)), SLOT(
setResourceColor()) );
920 resourceLayout->addWidget( mResourceButton );
922 colorLayout->setRowStretch( 11, 1 );
925 tabWidget->addTab( fontFrame, KIcon( QLatin1String(
"preferences-desktop-font") ),
926 i18nc(
"@title:tab",
"Fonts" ) );
928 QGridLayout *fontLayout =
new QGridLayout( fontFrame );
929 fontLayout->setSpacing( KDialog::spacingHint() );
931 KPIM::KPrefsWidFont *timeBarFont =
933 KGlobal::locale()->formatTime( QTime( 12, 34 ) ) );
934 fontLayout->addWidget( timeBarFont->label(), 0, 0 );
935 fontLayout->addWidget( timeBarFont->preview(), 0, 1 );
936 fontLayout->addWidget( timeBarFont->button(), 0, 2 );
938 KPIM::KPrefsWidFont *monthViewFont =
940 KGlobal::locale()->formatTime( QTime( 12, 34 ) ) + QLatin1Char(
' ') +
941 i18nc(
"@label",
"Event text" ) );
943 fontLayout->addWidget( monthViewFont->label(), 1, 0 );
944 fontLayout->addWidget( monthViewFont->preview(), 1, 1 );
945 fontLayout->addWidget( monthViewFont->button(), 1, 2 );
947 KPIM::KPrefsWidFont *agendaViewFont =
949 i18nc(
"@label",
"Event text" ) );
950 fontLayout->addWidget( agendaViewFont->label(), 2, 0 );
951 fontLayout->addWidget( agendaViewFont->preview(), 2, 1 );
952 fontLayout->addWidget( agendaViewFont->button(), 2, 2 );
954 KPIM::KPrefsWidFont *marcusBainsFont =
956 KGlobal::locale()->formatTime( QTime( 12, 34, 23 ) ) );
957 fontLayout->addWidget( marcusBainsFont->label(), 3, 0 );
958 fontLayout->addWidget( marcusBainsFont->preview(), 3, 1 );
959 fontLayout->addWidget( marcusBainsFont->button(), 3, 2 );
961 fontLayout->setColumnStretch( 1, 1 );
962 fontLayout->setRowStretch( 4, 1 );
969 QHash<QString, QColor>::const_iterator i = mCategoryDict.constBegin();
970 while ( i != mCategoryDict.constEnd() ) {
971 CalendarSupport::KCalPrefs::instance()->setCategoryColor( i.key(), i.value() );
975 i = mResourceDict.constBegin();
976 while ( i != mResourceDict.constEnd() ) {
993 mCategoryCombo->clear();
994 mCategoryCombo->addItems(
1001 mCategoryDict.insert( mCategoryCombo->currentText(), mCategoryButton->color() );
1007 const QString cat = mCategoryCombo->currentText();
1008 QColor color = mCategoryDict.value( cat );
1009 if ( !color.isValid() ) {
1010 color = CalendarSupport::KCalPrefs::instance()->categoryColor( cat );
1012 if ( color.isValid() ) {
1013 mCategoryButton->setColor( color );
1026 QString::number( mResourceCombo->itemData(
1027 mResourceCombo->currentIndex(),
1028 Akonadi::CollectionModel::CollectionIdRole ).toLongLong( &ok ) );
1032 mResourceDict.insert(
id, mResourceButton->color() );
1040 QString::number( mResourceCombo->itemData(
1041 mResourceCombo->currentIndex(),
1042 Akonadi::CollectionModel::CollectionIdRole ).toLongLong( &ok ) );
1046 kDebug() <<
id << mResourceCombo->itemText( mResourceCombo->currentIndex() );
1048 QColor color = mResourceDict.value(
id );
1049 if ( ! color.isValid() ) {
1052 mResourceButton->setColor( color );
1068 : KPIM::KPrefsModule(
KOPrefs::instance(), inst, parent )
1070 QBoxLayout *topTopLayout =
new QVBoxLayout(
this );
1073 topTopLayout->addWidget( topFrame );
1075 QGridLayout *topLayout =
new QGridLayout( topFrame );
1076 topLayout->setSpacing( KDialog::spacingHint() );
1078 KPIM::KPrefsWidBool *useGroupwareBool =
1079 addWidBool( CalendarSupport::KCalPrefs::instance()->useGroupwareCommunicationItem(), topFrame );
1080 topLayout->addWidget( useGroupwareBool->checkBox(), 0, 0, 1, 2 );
1082 KPIM::KPrefsWidBool *bcc =
1083 addWidBool( Akonadi::CalendarSettings::self()->bccItem(), topFrame );
1084 topLayout->addWidget( bcc->checkBox(), 1, 0, 1, 2 );
1086 QLabel *aTransportLabel =
new QLabel(
1087 i18nc(
"@label",
"Mail transport:" ), topFrame );
1088 topLayout->addWidget( aTransportLabel, 2, 0, 1, 2 );
1090 MailTransport::TransportManagementWidget *tmw =
1091 new MailTransport::TransportManagementWidget( topFrame );
1092 tmw->layout()->setContentsMargins( 0, 0, 0, 0 );
1093 topLayout->addWidget( tmw, 3, 0, 1, 2 );
1122 : KPrefsModule( CalendarSupport::KCalPrefs::instance(), inst, parent )
1124 mGroupwarePage =
new Ui::KOGroupwarePrefsPage();
1126 widget->setObjectName( QLatin1String(
"KOGrouparePrefsPage") );
1128 mGroupwarePage->setupUi( widget );
1130 mGroupwarePage->groupwareTab->setTabIcon( 0, KIcon( QLatin1String(
"go-up") ) );
1131 mGroupwarePage->groupwareTab->setTabIcon( 1, KIcon( QLatin1String(
"go-down") ) );
1135 connect( mGroupwarePage->publishDays, SIGNAL(valueChanged(
int)),
1136 SLOT(slotWidChanged()) );
1137 connect( mGroupwarePage->publishUrl, SIGNAL(textChanged(QString)),
1138 SLOT(slotWidChanged()) );
1139 connect( mGroupwarePage->publishUser, SIGNAL(textChanged(QString)),
1140 SLOT(slotWidChanged()) );
1141 connect( mGroupwarePage->publishPassword, SIGNAL(textChanged(QString)),
1142 SLOT(slotWidChanged()) );
1143 connect( mGroupwarePage->publishSavePassword, SIGNAL(toggled(
bool)),
1144 SLOT(slotWidChanged()) );
1145 connect( mGroupwarePage->retrieveEnable, SIGNAL(toggled(
bool)),
1146 SLOT(slotWidChanged()) );
1147 connect( mGroupwarePage->retrieveUser, SIGNAL(textChanged(QString)),
1148 SLOT(slotWidChanged()) );
1149 connect( mGroupwarePage->retrievePassword, SIGNAL(textChanged(QString)),
1150 SLOT(slotWidChanged()) );
1151 connect( mGroupwarePage->retrieveSavePassword, SIGNAL(toggled(
bool)),
1152 SLOT(slotWidChanged()) );
1153 connect( mGroupwarePage->retrieveUrl, SIGNAL(textChanged(QString)),
1154 SLOT(slotWidChanged()));
1155 connect( mGroupwarePage->publishDelay, SIGNAL(valueChanged(
int)),
1156 SLOT(slotWidChanged()) );
1157 connect( mGroupwarePage->fullDomainRetrieval, SIGNAL(toggled(
bool)),
1158 SLOT(slotWidChanged()) );
1159 connect( mGroupwarePage->publishEnable, SIGNAL(toggled(
bool)),
1160 SLOT(slotWidChanged()) );
1162 (
new QVBoxLayout(
this ) )->addWidget( widget );
1169 delete mGroupwarePage;
1174 mGroupwarePage->publishEnable->setChecked(
1175 Akonadi::CalendarSettings::self()->freeBusyPublishAuto() );
1176 mGroupwarePage->publishDelay->setValue(
1177 Akonadi::CalendarSettings::self()->freeBusyPublishDelay() );
1178 mGroupwarePage->publishDays->setValue(
1179 Akonadi::CalendarSettings::self()->freeBusyPublishDays() );
1180 mGroupwarePage->publishUrl->setText(
1181 Akonadi::CalendarSettings::self()->freeBusyPublishUrl() );
1182 mGroupwarePage->publishUser->setText(
1183 Akonadi::CalendarSettings::self()->freeBusyPublishUser() );
1184 mGroupwarePage->publishPassword->setText(
1185 Akonadi::CalendarSettings::self()->freeBusyPublishPassword() );
1186 mGroupwarePage->publishSavePassword->setChecked(
1187 Akonadi::CalendarSettings::self()->freeBusyPublishSavePassword() );
1189 mGroupwarePage->retrieveEnable->setChecked(
1190 Akonadi::CalendarSettings::self()->freeBusyRetrieveAuto() );
1191 mGroupwarePage->fullDomainRetrieval->setChecked(
1192 Akonadi::CalendarSettings::self()->freeBusyFullDomainRetrieval() );
1193 mGroupwarePage->retrieveUrl->setText(
1194 Akonadi::CalendarSettings::self()->freeBusyRetrieveUrl() );
1195 mGroupwarePage->retrieveUser->setText(
1196 Akonadi::CalendarSettings::self()->freeBusyRetrieveUser() );
1197 mGroupwarePage->retrievePassword->setText(
1198 Akonadi::CalendarSettings::self()->freeBusyRetrievePassword() );
1199 mGroupwarePage->retrieveSavePassword->setChecked(
1200 Akonadi::CalendarSettings::self()->freeBusyRetrieveSavePassword() );
1205 Akonadi::CalendarSettings::self()->setFreeBusyPublishAuto(
1206 mGroupwarePage->publishEnable->isChecked());
1207 Akonadi::CalendarSettings::self()->setFreeBusyPublishDelay(mGroupwarePage->publishDelay->value());
1208 Akonadi::CalendarSettings::self()->setFreeBusyPublishDays(
1209 mGroupwarePage->publishDays->value());
1210 Akonadi::CalendarSettings::self()->setFreeBusyPublishUrl(
1211 mGroupwarePage->publishUrl->text());
1212 Akonadi::CalendarSettings::self()->setFreeBusyPublishUser(
1213 mGroupwarePage->publishUser->text());
1214 Akonadi::CalendarSettings::self()->setFreeBusyPublishPassword(
1215 mGroupwarePage->publishPassword->text());
1216 Akonadi::CalendarSettings::self()->setFreeBusyPublishSavePassword(
1217 mGroupwarePage->publishSavePassword->isChecked());
1219 Akonadi::CalendarSettings::self()->setFreeBusyRetrieveAuto(
1220 mGroupwarePage->retrieveEnable->isChecked());
1221 Akonadi::CalendarSettings::self()->setFreeBusyFullDomainRetrieval(
1222 mGroupwarePage->fullDomainRetrieval->isChecked());
1223 Akonadi::CalendarSettings::self()->setFreeBusyRetrieveUrl(
1224 mGroupwarePage->retrieveUrl->text());
1225 Akonadi::CalendarSettings::self()->setFreeBusyRetrieveUser(
1226 mGroupwarePage->retrieveUser->text());
1227 Akonadi::CalendarSettings::self()->setFreeBusyRetrievePassword(
1228 mGroupwarePage->retrievePassword->text());
1229 Akonadi::CalendarSettings::self()->setFreeBusyRetrieveSavePassword(
1230 mGroupwarePage->retrieveSavePassword->isChecked());
1233 const QString configFile = KStandardDirs::locateLocal(
"data", QLatin1String(
"korganizer/freebusyurls") );
1234 KConfig cfg( configFile );
1235 cfg.deleteGroup( CalendarSupport::KCalPrefs::instance()->email() );
1238 Akonadi::CalendarSettings::self()->writeConfig();
1252 class PluginItem :
public QTreeWidgetItem
1255 PluginItem( QTreeWidget *parent, KService::Ptr service )
1256 : QTreeWidgetItem( parent, QStringList( service->name() ) ),
1257 mService( service ) {}
1258 PluginItem( QTreeWidgetItem *parent, KService::Ptr service )
1259 : QTreeWidgetItem( parent, QStringList( service->name() ) ),
1260 mService( service ) {}
1262 KService::Ptr service()
1263 {
return mService; }
1266 KService::Ptr mService;
1273 : KPrefsModule(
KOPrefs::instance(), inst, parent )
1275 QBoxLayout *topTopLayout =
new QVBoxLayout(
this );
1278 topTopLayout->addWidget( topFrame );
1279 QBoxLayout *topLayout =
new QVBoxLayout( topFrame );
1280 topLayout->setSpacing( KDialog::spacingHint() );
1282 mTreeWidget =
new QTreeWidget( topFrame );
1283 mTreeWidget->setColumnCount( 1 );
1284 mTreeWidget->setHeaderLabel( i18nc(
"@title:column plugin name",
"Name" ) );
1285 topLayout->addWidget( mTreeWidget );
1287 mDescription =
new QLabel( topFrame );
1288 mDescription->setAlignment( Qt::AlignVCenter );
1289 mDescription->setWordWrap(
true );
1290 mDescription->setFrameShape( QLabel::Panel );
1291 mDescription->setFrameShadow( QLabel::Sunken );
1292 mDescription->setMinimumSize( QSize( 0, 55 ) );
1293 QSizePolicy policy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
1294 policy.setHorizontalStretch( 0 );
1295 policy.setVerticalStretch( 0 );
1296 policy.setHeightForWidth( mDescription->sizePolicy().hasHeightForWidth() );
1297 mDescription->setSizePolicy( policy );
1298 topLayout->addWidget( mDescription );
1301 QBoxLayout *buttonRowLayout =
new QHBoxLayout( buttonRow );
1302 mConfigureButton =
new KPushButton(
1303 KGuiItem( i18nc(
"@action:button",
"Configure &Plugin..." ),
1304 QLatin1String(
"configure"), QString(),
1305 i18nc(
"@info:whatsthis",
1306 "This button allows you to configure"
1307 " the plugin that you have selected in the list above" ) ),
1309 buttonRowLayout->addWidget( mConfigureButton );
1310 buttonRowLayout->addItem(
new QSpacerItem( 1, 1, QSizePolicy::Expanding ) );
1311 topLayout->addWidget( buttonRow );
1313 mPositioningGroupBox =
new QGroupBox( i18nc(
"@title:group",
"Position" ), topFrame );
1316 mPositionAgendaTop =
new QRadioButton(
1317 i18nc(
"@option:check",
"Show at the top of the agenda views" ), mPositioningGroupBox );
1318 mPositionAgendaBottom =
new QRadioButton(
1319 i18nc(
"@option:check",
"Show at the bottom of the agenda views" ), mPositioningGroupBox );
1320 QVBoxLayout *positioningLayout =
new QVBoxLayout( mPositioningGroupBox );
1322 positioningLayout->addWidget( mPositionAgendaTop );
1323 positioningLayout->addWidget( mPositionAgendaBottom );
1324 positioningLayout->addStretch( 1 );
1325 topLayout->addWidget( mPositioningGroupBox );
1327 connect( mConfigureButton, SIGNAL(clicked()), SLOT(
configure()) );
1333 connect( mTreeWidget, SIGNAL(itemSelectionChanged()), SLOT(
selectionChanged()) );
1334 connect( mTreeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,
int)), SLOT(
selectionChanged()) );
1335 connect( mTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,
int)), SLOT(slotWidChanged()) );
1344 mTreeWidget->clear();
1350 QStringList selectedPlugins = viewPrefs->selectedPlugins();
1352 QTreeWidgetItem *decorations =
1353 new QTreeWidgetItem( mTreeWidget, QStringList(
1354 i18nc(
"@title:group",
"Calendar Decorations" ) ) );
1355 QTreeWidgetItem *printPlugins =
1356 new QTreeWidgetItem( mTreeWidget, QStringList(
1357 i18nc(
"@title:group",
"Print Plugins" ) ) );
1358 QTreeWidgetItem *others =
1359 new QTreeWidgetItem( mTreeWidget, QStringList(
1360 i18nc(
"@title:group",
"Other Plugins" ) ) );
1362 KService::List::ConstIterator it;
1363 for ( it = plugins.constBegin(); it != plugins.constEnd(); ++it ) {
1364 QTreeWidgetItem *item;
1365 if ( (*it)->hasServiceType( EventViews::CalendarDecoration::Decoration::serviceType() ) ) {
1366 item =
new PluginItem( decorations, *it );
1368 item =
new PluginItem( printPlugins, *it );
1370 item =
new PluginItem( others, *it );
1372 if ( selectedPlugins.contains( (*it)->desktopEntryName() ) ) {
1373 item->setCheckState( 0, Qt::Checked );
1375 item->setCheckState( 0, Qt::Unchecked );
1379 decorations->setExpanded(
true );
1380 printPlugins->setExpanded(
true );
1381 others->setExpanded(
true );
1384 mDecorationsAtAgendaViewTop = viewPrefs->decorationsAtAgendaViewTop().toSet();
1385 mDecorationsAtAgendaViewBottom = viewPrefs->decorationsAtAgendaViewBottom().toSet();
1390 QStringList selectedPlugins;
1392 for (
int i = 0; i < mTreeWidget->topLevelItemCount(); ++i) {
1393 QTreeWidgetItem *serviceTypeGroup = mTreeWidget->topLevelItem( i );
1394 for (
int j = 0; j < serviceTypeGroup->childCount(); j++) {
1395 PluginItem *item =
static_cast<PluginItem *
>( serviceTypeGroup->child( j ) );
1396 if( item->checkState( 0 ) == Qt::Checked ) {
1397 selectedPlugins.append( item->service()->desktopEntryName() );
1402 viewPrefs->setSelectedPlugins( selectedPlugins );
1405 viewPrefs->setDecorationsAtAgendaViewTop( mDecorationsAtAgendaViewTop.toList() );
1406 viewPrefs->setDecorationsAtAgendaViewBottom( mDecorationsAtAgendaViewBottom.toList() );
1411 if ( mTreeWidget->selectedItems().count() != 1 ) {
1415 PluginItem *item =
static_cast<PluginItem *
>( mTreeWidget->selectedItems().last() );
1423 plugin->configure(
this );
1428 KMessageBox::sorry(
this,
1429 i18nc(
"@info",
"Unable to configure this plugin" ),
1430 QLatin1String(
"PluginConfigUnable") );
1436 if ( mTreeWidget->selectedItems().count() != 1 ) {
1440 PluginItem *item =
dynamic_cast<PluginItem*
>( mTreeWidget->selectedItems().last() );
1445 QString decoration = item->service()->desktopEntryName();
1455 if ( mPositionAgendaTop->isChecked() ) {
1456 if ( !mDecorationsAtAgendaViewTop.contains( decoration ) ) {
1457 mDecorationsAtAgendaViewTop.insert( decoration );
1460 mDecorationsAtAgendaViewTop.remove( decoration );
1463 if ( mPositionAgendaBottom->isChecked() ) {
1464 if ( !mDecorationsAtAgendaViewBottom.contains( decoration ) ) {
1465 mDecorationsAtAgendaViewBottom.insert( decoration );
1468 mDecorationsAtAgendaViewBottom.remove( decoration );
1476 mPositioningGroupBox->hide();
1478 mPositionAgendaTop->setChecked(
false );
1479 mPositionAgendaBottom->setChecked(
false );
1481 if ( mTreeWidget->selectedItems().count() != 1 ) {
1482 mConfigureButton->setEnabled(
false );
1483 mDescription->setText( QString() );
1487 PluginItem *item =
dynamic_cast<PluginItem*
>( mTreeWidget->selectedItems().last() );
1489 mConfigureButton->setEnabled(
false );
1490 mDescription->setText( QString() );
1494 QVariant variant = item->service()->property( QLatin1String(
"X-KDE-KOrganizer-HasSettings") );
1496 bool hasSettings =
true;
1497 if ( variant.isValid() ) {
1498 hasSettings = variant.toBool();
1501 mDescription->setText( item->service()->comment() );
1502 if ( !hasSettings ) {
1503 mConfigureButton->hide();
1505 mConfigureButton->show();
1506 mConfigureButton->setEnabled( item->checkState(0) == Qt::Checked );
1509 bool hasPosition =
false;
1510 if ( item->service()->hasServiceType(
1511 EventViews::CalendarDecoration::Decoration::serviceType() ) ) {
1512 QString decoration = item->service()->desktopEntryName();
1517 if ( mDecorationsAtAgendaViewTop.contains( decoration ) ) {
1518 mPositionAgendaTop->setChecked(
true );
1521 if ( mDecorationsAtAgendaViewBottom.contains( decoration ) ) {
1522 mPositionAgendaBottom->setChecked(
true );
1526 if ( !hasPosition ) {
1528 mDecorationsAtAgendaViewTop << decoration;
1529 mPositionAgendaTop->setChecked(
true );
1532 mPositioningGroupBox->setEnabled( item->checkState(0) == Qt::Checked );
1533 mPositioningGroupBox->show();
1564 const QString dir = KStandardDirs::locateLocal(
"data", QLatin1String(
"korganizer/designer/event/") );
1570 return QLatin1String(
"korganizer/designer/event/");
1575 CalendarSupport::KCalPrefs::instance()->setActiveDesignerFields( activePages );
1576 CalendarSupport::KCalPrefs::instance()->writeConfig();
1581 return CalendarSupport::KCalPrefs::instance()->activeDesignerFields();
1586 return QLatin1String(
"KORGANIZER");
1589 #include "koprefsdialog.moc"
void setDecorationsAtMonthViewTop(const QStringList &v)
Set Decorations At Month View Top.
KCModule * create_korganizerconfigmain(QWidget *parent, const char *)
void setResourceColor(const QString &, const QColor &)
KService::List availablePlugins()
KCModule * create_korganizerconfigplugins(QWidget *parent, const char *)
void slotRemoveSelectedAccount()
void positioningChanged()
EventViews::PrefsPtr eventViewsPreferences() const
KCModule * create_korganizerconfigcolorsandfonts(QWidget *parent, const char *)
QStringList readActivePages()
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 updateResourceColor()
KOPrefsDialogGroupwareScheduling(const KComponentData &inst, QWidget *parent)
QString applicationName()
KCModule * create_korganizerconfigviews(QWidget *parent, const char *)
KCModule * create_korganizerconfigtime(QWidget *parent, const char *)
KService::List availableParts()
CalendarSupport::Plugin * loadPlugin(KService::Ptr service)
void writeActivePages(const QStringList &)
KOPrefsDialogColorsAndFonts(const KComponentData &inst, QWidget *parent)
const KCalendarSystem * calendarSystem() const
void slotAccountSelected()
static KOGlobals * self()
void toggleEmailSettings(bool on)
KOPrefsDialogPlugins(const KComponentData &inst, QWidget *parent)
Dialog for selecting and configuring KOrganizer plugins.
void updateCategoryColor()
QStringList decorationsAtMonthViewTop() const
Get Decorations At Month View Top.
KCModule * create_korganizerconfigfreebusy(QWidget *parent, const char *)
~KOPrefsDialogGroupwareScheduling()
static KOPrefs * instance()
Get instance of KOPrefs.
KOPrefsDialogMain(const KComponentData &inst, QWidget *parent)
static QString serviceType()
KOPrefsDesignerFields(const KComponentData &inst, QWidget *parent=0)
void slotModifySelectedAccount()
QColor resourceColor(const QString &)