28 #include <KAcceleratorManager>
29 #include <KComponentData>
33 KComponentData inst(
"kcmapptsummary" );
42 mDaysButtonGroup =
new QButtonGroup(
this );
43 mDaysButtonGroup->addButton( mDateTodayButton, 0 );
44 mDaysButtonGroup->addButton( mDateMonthButton, 1 );
45 mDaysButtonGroup->addButton( mDateRangeButton, 2 );
47 mShowButtonGroup =
new QButtonGroup(
this );
48 mShowButtonGroup->setExclusive(
false );
49 mShowButtonGroup->addButton( mShowBirthdaysFromCal );
50 mShowButtonGroup->addButton( mShowAnniversariesFromCal );
52 mGroupwareButtonGroup =
new QButtonGroup(
this );
53 mGroupwareButtonGroup->setExclusive(
false );
54 mGroupwareButtonGroup->addButton( mShowMineOnly );
56 customDaysChanged( 7 );
58 connect( mDaysButtonGroup, SIGNAL(buttonClicked(
int)), SLOT(modified()) );
59 connect( mDaysButtonGroup, SIGNAL(buttonClicked(
int)), SLOT(buttonClicked(
int)) );
60 connect( mShowButtonGroup, SIGNAL(buttonClicked(
int)), SLOT(modified()) );
61 connect( mGroupwareButtonGroup, SIGNAL(buttonClicked(
int)), SLOT(modified()) );
63 connect( mCustomDays, SIGNAL(valueChanged(
int)), SLOT(modified()) );
64 connect( mCustomDays, SIGNAL(valueChanged(
int)), SLOT(customDaysChanged(
int)) );
66 KAcceleratorManager::manage(
this );
71 void KCMApptSummary::modified()
76 void KCMApptSummary::buttonClicked(
int id )
78 mCustomDays->setEnabled(
id == 2 );
81 void KCMApptSummary::customDaysChanged(
int value )
83 mCustomDays->setSuffix( i18np(
" day",
" days", value ) );
88 KConfig config( QLatin1String(
"kcmapptsummaryrc") );
89 KConfigGroup group = config.group(
"Days" );
91 int days = group.readEntry(
"DaysToShow", 7 );
93 mDateTodayButton->setChecked(
true );
94 }
else if ( days == 31 ) {
95 mDateMonthButton->setChecked(
true );
97 mDateRangeButton->setChecked(
true );
98 mCustomDays->setValue( days );
99 mCustomDays->setEnabled(
true );
102 group = config.group(
"Show" );
104 mShowBirthdaysFromCal->setChecked( group.readEntry(
"BirthdaysFromCalendar",
true ) );
105 mShowAnniversariesFromCal->setChecked( group.readEntry(
"AnniversariesFromCalendar",
true ) );
107 group = config.group(
"Groupware" );
108 mShowMineOnly->setChecked( group.readEntry(
"ShowMineOnly",
false ) );
110 emit changed(
false );
115 KConfig config(QLatin1String(
"kcmapptsummaryrc") );
116 KConfigGroup group = config.group(
"Days" );
119 switch ( mDaysButtonGroup->checkedId() ) {
128 days = mCustomDays->value();
132 group.writeEntry(
"DaysToShow", days );
134 group = config.group(
"Show" );
135 group.writeEntry(
"BirthdaysFromCalendar", mShowBirthdaysFromCal->isChecked() );
136 group.writeEntry(
"AnniversariesFromCalendar", mShowAnniversariesFromCal->isChecked() );
138 group = config.group(
"Groupware" );
139 group.writeEntry(
"ShowMineOnly", mShowMineOnly->isChecked() );
142 emit changed(
false );
147 mDateRangeButton->setChecked(
true );
148 mCustomDays->setValue( 7 );
149 mCustomDays->setEnabled(
true );
151 mShowBirthdaysFromCal->setChecked(
true );
152 mShowAnniversariesFromCal->setChecked(
true );
154 mShowMineOnly->setChecked(
false );
156 emit changed(
true );
161 KAboutData *about =
new KAboutData(
162 I18N_NOOP(
"kcmapptsummary" ), 0,
163 ki18n(
"Upcoming Events Configuration Dialog" ),
164 0, KLocalizedString(), KAboutData::License_GPL,
165 ki18n(
"Copyright © 2003–2004 Tobias Koenig\n"
166 "Copyright © 2005–2010 Allen Winter" ) );
168 about->addAuthor( ki18n(
"Tobias Koenig" ), KLocalizedString(),
"tokoe@kde.org" );
169 about->addAuthor( ki18n(
"Allen Winter" ), KLocalizedString(),
"winter@kde.org" );
174 #include "kcmapptsummary.moc"
KCMApptSummary(const KComponentData &inst, QWidget *parent=0)
KCModule * create_apptsummary(QWidget *parent, const char *)
const KAboutData * aboutData() const