• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kontact

  • sources
  • kde-4.12
  • kdepim
  • kontact
  • plugins
  • korganizer
kcmapptsummary.cpp
Go to the documentation of this file.
1 /*
2  This file is part of Kontact.
3  Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
4  Copyright (c) 2005-2006,2008-2009 Allen Winter <winter@kde.org>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License along
17  with this program; if not, write to the Free Software Foundation, Inc.,
18  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20  As a special exception, permission is given to link this program
21  with any edition of Qt, and distribute the resulting executable,
22  without including the source code for Qt in the source distribution.
23 */
24 
25 #include "kcmapptsummary.h"
26 
27 #include <KAboutData>
28 #include <KAcceleratorManager>
29 #include <KComponentData>
30 
31 KCModule *create_apptsummary( QWidget *parent, const char * )
32 {
33  KComponentData inst( "kcmapptsummary" );
34  return new KCMApptSummary( inst, parent );
35 }
36 
37 KCMApptSummary::KCMApptSummary( const KComponentData &inst, QWidget *parent )
38  : KCModule( inst, parent )
39 {
40  setupUi( this );
41 
42  mDaysButtonGroup = new QButtonGroup( this ); //krazy:exclude=tipsandthis
43  mDaysButtonGroup->addButton( mDateTodayButton, 0 );
44  mDaysButtonGroup->addButton( mDateMonthButton, 1 );
45  mDaysButtonGroup->addButton( mDateRangeButton, 2 );
46 
47  mShowButtonGroup = new QButtonGroup( this ); //krazy:exclude=tipsandthis
48  mShowButtonGroup->setExclusive( false );
49  mShowButtonGroup->addButton( mShowBirthdaysFromCal );
50  mShowButtonGroup->addButton( mShowAnniversariesFromCal );
51 
52  mGroupwareButtonGroup = new QButtonGroup( this ); //krazy:exclude=tipsandthis
53  mGroupwareButtonGroup->setExclusive( false );
54  mGroupwareButtonGroup->addButton( mShowMineOnly );
55 
56  customDaysChanged( 7 );
57 
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()) );
62 
63  connect( mCustomDays, SIGNAL(valueChanged(int)), SLOT(modified()) );
64  connect( mCustomDays, SIGNAL(valueChanged(int)), SLOT(customDaysChanged(int)) );
65 
66  KAcceleratorManager::manage( this );
67 
68  load();
69 }
70 
71 void KCMApptSummary::modified()
72 {
73  emit changed( true );
74 }
75 
76 void KCMApptSummary::buttonClicked( int id )
77 {
78  mCustomDays->setEnabled( id == 2 );
79 }
80 
81 void KCMApptSummary::customDaysChanged( int value )
82 {
83  mCustomDays->setSuffix( i18np( " day", " days", value ) );
84 }
85 
86 void KCMApptSummary::load()
87 {
88  KConfig config( QLatin1String("kcmapptsummaryrc") );
89  KConfigGroup group = config.group( "Days" );
90 
91  int days = group.readEntry( "DaysToShow", 7 );
92  if ( days == 1 ) {
93  mDateTodayButton->setChecked( true );
94  } else if ( days == 31 ) {
95  mDateMonthButton->setChecked( true );
96  } else {
97  mDateRangeButton->setChecked( true );
98  mCustomDays->setValue( days );
99  mCustomDays->setEnabled( true );
100  }
101 
102  group = config.group( "Show" );
103 
104  mShowBirthdaysFromCal->setChecked( group.readEntry( "BirthdaysFromCalendar", true ) );
105  mShowAnniversariesFromCal->setChecked( group.readEntry( "AnniversariesFromCalendar", true ) );
106 
107  group = config.group( "Groupware" );
108  mShowMineOnly->setChecked( group.readEntry( "ShowMineOnly", false ) );
109 
110  emit changed( false );
111 }
112 
113 void KCMApptSummary::save()
114 {
115  KConfig config(QLatin1String( "kcmapptsummaryrc") );
116  KConfigGroup group = config.group( "Days" );
117 
118  int days;
119  switch ( mDaysButtonGroup->checkedId() ) {
120  case 0:
121  days = 1;
122  break;
123  case 1:
124  days = 31;
125  break;
126  case 2:
127  default:
128  days = mCustomDays->value();
129  break;
130  }
131 
132  group.writeEntry( "DaysToShow", days );
133 
134  group = config.group( "Show" );
135  group.writeEntry( "BirthdaysFromCalendar", mShowBirthdaysFromCal->isChecked() );
136  group.writeEntry( "AnniversariesFromCalendar", mShowAnniversariesFromCal->isChecked() );
137 
138  group = config.group( "Groupware" );
139  group.writeEntry( "ShowMineOnly", mShowMineOnly->isChecked() );
140 
141  config.sync();
142  emit changed( false );
143 }
144 
145 void KCMApptSummary::defaults()
146 {
147  mDateRangeButton->setChecked( true );
148  mCustomDays->setValue( 7 );
149  mCustomDays->setEnabled( true );
150 
151  mShowBirthdaysFromCal->setChecked( true );
152  mShowAnniversariesFromCal->setChecked( true );
153 
154  mShowMineOnly->setChecked( false );
155 
156  emit changed( true );
157 }
158 
159 const KAboutData *KCMApptSummary::aboutData() const
160 {
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" ) );
167 
168  about->addAuthor( ki18n( "Tobias Koenig" ), KLocalizedString(), "tokoe@kde.org" );
169  about->addAuthor( ki18n( "Allen Winter" ), KLocalizedString(), "winter@kde.org" );
170 
171  return about;
172 }
173 
174 #include "kcmapptsummary.moc"
kcmapptsummary.h
QWidget
KCMApptSummary::defaults
void defaults()
Definition: kcmapptsummary.cpp:145
KCMApptSummary::KCMApptSummary
KCMApptSummary(const KComponentData &inst, QWidget *parent=0)
Definition: kcmapptsummary.cpp:37
create_apptsummary
KCModule * create_apptsummary(QWidget *parent, const char *)
Definition: kcmapptsummary.cpp:31
KCMApptSummary::save
void save()
Definition: kcmapptsummary.cpp:113
KCMApptSummary::aboutData
const KAboutData * aboutData() const
Definition: kcmapptsummary.cpp:159
KCMApptSummary::load
void load()
Definition: kcmapptsummary.cpp:86
KCMApptSummary
Definition: kcmapptsummary.h:36
KCModule
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:30 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kontact

Skip menu "kontact"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal