29 #include <KAcceleratorManager>
30 #include <KComponentData>
36 KComponentData inst(
"kcmsdsummary" );
46 customDaysChanged( 7 );
48 connect( mDateTodayButton, SIGNAL(clicked(
bool)), SLOT(modified()) );
49 connect( mDateMonthButton, SIGNAL(clicked(
bool)), SLOT(modified()) );
50 connect( mDateRangeButton, SIGNAL(clicked(
bool)), SLOT(modified()) );
52 connect( mCustomDays, SIGNAL(valueChanged(
int)), SLOT(modified()) );
53 connect( mCustomDays, SIGNAL(valueChanged(
int)), SLOT(customDaysChanged(
int)) );
55 connect( mShowBirthdaysFromCalBox, SIGNAL(stateChanged(
int)), SLOT(modified()) );
56 connect( mShowAnniversariesFromCalBox, SIGNAL(stateChanged(
int)), SLOT(modified()) );
57 connect( mShowHolidaysFromCalBox, SIGNAL(stateChanged(
int)), SLOT(modified()) );
58 connect( mShowSpecialsFromCalBox, SIGNAL(stateChanged(
int)), SLOT(modified()) );
60 connect( mShowBirthdaysFromKABBox, SIGNAL(stateChanged(
int)), SLOT(modified()) );
61 connect( mShowAnniversariesFromKABBox, SIGNAL(stateChanged(
int)), SLOT(modified()) );
63 connect( mShowMineOnly, SIGNAL(stateChanged(
int)), SLOT(modified()) );
65 KAcceleratorManager::manage(
this );
70 void KCMSDSummary::modified()
75 void KCMSDSummary::buttonClicked(
int id )
77 mCustomDays->setEnabled(
id == 2 );
80 void KCMSDSummary::customDaysChanged(
int value )
82 mCustomDays->setSuffix( i18np(
" day",
" days", value ) );
87 KConfig config( QLatin1String(
"kcmsdsummaryrc") );
89 KConfigGroup group = config.group(
"Days" );
90 int days = group.readEntry(
"DaysToShow", 7 );
92 mDateTodayButton->setChecked(
true );
93 }
else if ( days == 31 ) {
94 mDateMonthButton->setChecked(
true );
96 mDateRangeButton->setChecked(
true );
97 mCustomDays->setValue( days );
98 mCustomDays->setEnabled(
true );
101 group = config.group(
"Show" );
103 mShowBirthdaysFromKABBox->setChecked( group.readEntry(
"BirthdaysFromContacts",
true ) );
104 mShowBirthdaysFromCalBox->setChecked( group.readEntry(
"BirthdaysFromCalendar",
true ) );
106 mShowAnniversariesFromKABBox->setChecked( group.readEntry(
"AnniversariesFromContacts",
true ) );
107 mShowAnniversariesFromCalBox->setChecked( group.readEntry(
"AnniversariesFromCalendar",
true ) );
109 mShowHolidaysFromCalBox->setChecked( group.readEntry(
"HolidaysFromCalendar",
true ) );
111 mShowSpecialsFromCalBox->setChecked( group.readEntry(
"SpecialsFromCalendar",
true ) );
113 group = config.group(
"Groupware" );
114 mShowMineOnly->setChecked( group.readEntry(
"ShowMineOnly",
false ) );
116 emit changed(
false );
121 KConfig config( QLatin1String(
"kcmsdsummaryrc") );
123 KConfigGroup group = config.group(
"Days" );
126 if ( mDateTodayButton->isChecked() ) {
128 }
else if ( mDateMonthButton->isChecked() ) {
131 days = mCustomDays->value();
133 group.writeEntry(
"DaysToShow", days );
135 group = config.group(
"Show" );
137 group.writeEntry(
"BirthdaysFromContacts", mShowBirthdaysFromKABBox->isChecked() );
138 group.writeEntry(
"BirthdaysFromCalendar", mShowBirthdaysFromCalBox->isChecked() );
140 group.writeEntry(
"AnniversariesFromContacts", mShowAnniversariesFromKABBox->isChecked() );
141 group.writeEntry(
"AnniversariesFromCalendar", mShowAnniversariesFromCalBox->isChecked() );
143 group.writeEntry(
"HolidaysFromCalendar", mShowHolidaysFromCalBox->isChecked() );
145 group.writeEntry(
"SpecialsFromCalendar", mShowSpecialsFromCalBox->isChecked() );
147 group = config.group(
"Groupware" );
148 group.writeEntry(
"ShowMineOnly", mShowMineOnly->isChecked() );
151 emit changed(
false );
156 mDateRangeButton->setChecked(
true );
157 mCustomDays->setValue( 7 );
158 mCustomDays->setEnabled(
true );
160 mShowBirthdaysFromKABBox->setChecked(
true );
161 mShowBirthdaysFromCalBox->setChecked(
true );
162 mShowAnniversariesFromKABBox->setChecked(
true );
163 mShowAnniversariesFromCalBox->setChecked(
true );
164 mShowHolidaysFromCalBox->setChecked(
true );
165 mShowSpecialsFromCalBox->setChecked(
true );
167 mShowMineOnly->setChecked(
false );
169 emit changed(
true );
174 KAboutData *about =
new KAboutData(
175 I18N_NOOP(
"kcmsdsummary" ), 0,
176 ki18n(
"Upcoming Special Dates Configuration Dialog" ),
177 0, KLocalizedString(), KAboutData::License_GPL,
178 ki18n(
"Copyright © 2004 Tobias Koenig\n"
179 "Copyright © 2004–2010 Allen Winter" ) );
181 about->addAuthor( ki18n(
"Allen Winter" ), KLocalizedString(),
"winter@kde.org" );
182 about->addAuthor( ki18n(
"Tobias Koenig" ), KLocalizedString(),
"tokoe@kde.org" );
187 #include "kcmsdsummary.moc"
KCMSDSummary(const KComponentData &inst, QWidget *parent=0)
KCModule * create_sdsummary(QWidget *parent, const char *)
virtual const KAboutData * aboutData() const