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

kontact

  • sources
  • kde-4.14
  • kdepim
  • kontact
  • plugins
  • planner
kcmplanner.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) 2006-2008 Oral Timocin <oral.timocin@kdemail.net>
5  Copyright (C) 2009 Allen Winter <winter@kde.org>
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 
21  As a special exception, permission is given to link this program
22  with any edition of Qt, and distribute the resulting executable,
23  without including the source code for Qt in the source distribution.
24 */
25 
26 #include "kcmplanner.h"
27 
28 #include <KAboutData>
29 #include <KComponentData>
30 
31 extern "C"
32 {
33  KDE_EXPORT KCModule *create_planner( QWidget *parent, const char * )
34  {
35  KComponentData inst( "kcmplanner" );
36  return new KCMPlanner( inst, parent );
37  }
38 }
39 
40 KCMPlanner::KCMPlanner( const KComponentData &inst, QWidget *parent )
41  : KCModule( inst, parent )
42 {
43  setupUi( this );
44 
45  customDaysChanged( 7 );
46 
47  connect( mShowRecurrence, SIGNAL(stateChanged(int)), SLOT(modified()) );
48  connect( mShowReminder, SIGNAL(stateChanged(int)), SLOT(modified()) );
49  connect( mUnderline, SIGNAL(stateChanged(int)), SLOT(modified()) );
50  connect( mTodo, SIGNAL(stateChanged(int)), SLOT(modified()) );
51  connect( mSd, SIGNAL(stateChanged(int)), SLOT(modified()) );
52 
53  connect( mDateTodayButton, SIGNAL(clicked(bool)), SLOT(modified()) );
54  connect( mDateMonthButton, SIGNAL(clicked(bool)), SLOT(modified()) );
55  connect( mDateRangeButton, SIGNAL(clicked(bool)), SLOT(modified()) );
56 
57  connect( mHideCompletedBox, SIGNAL(stateChanged(int)), SLOT(modified()) );
58  connect( mHideOpenEndedBox, SIGNAL(stateChanged(int)), SLOT(modified()) );
59  connect( mHideUnstartedBox, SIGNAL(stateChanged(int)), SLOT(modified()) );
60  connect( mHideInProgressBox, SIGNAL(stateChanged(int)), SLOT(modified()) );
61  connect( mHideOverdueBox, SIGNAL(stateChanged(int)), SLOT(modified()) );
62 
63  connect( mCustomDays, SIGNAL(valueChanged(int)), SLOT(modified()) );
64  connect( mCustomDays, SIGNAL(valueChanged(int)), SLOT(customDaysChanged(int)) );
65 
66 // connect( mBirthdayCal, SIGNAL(stateChanged(int)), SLOT(modified()) );
67  connect( mBirthdayConList, SIGNAL(stateChanged(int)), SLOT(modified()) );
68 // connect( mAnniversariesCal, SIGNAL(stateChanged(int)), SLOT(modified()) );
69  connect( mAnniversariesConList, SIGNAL(stateChanged(int)), SLOT(modified()) );
70  connect( mHolidaysCal, SIGNAL(stateChanged(int)), SLOT(modified()) );
71  connect( mSpecialOccasionsCal, SIGNAL(stateChanged(int)), SLOT(modified()) );
72 
73  connect( mShowMyEventsOnly, SIGNAL(stateChanged(int)), SLOT(modified()) );
74  connect( mShowMyTodosOnly, SIGNAL(stateChanged(int)), SLOT(modified()) );
75 
76  load();
77 }
78 
79 KCMPlanner::~KCMPlanner()
80 {
81 }
82 
83 void KCMPlanner::modified()
84 {
85  emit changed( true );
86 }
87 
88 void KCMPlanner::customDaysChanged( int value )
89 {
90  mCustomDays->setSuffix( i18np( " day", " days", value ) );
91 }
92 
93 void KCMPlanner::buttonClicked( bool state )
94 {
95  mCustomDays->setEnabled( state );
96 }
97 
98 void KCMPlanner::load()
99 {
100  KConfig config( "plannerrc" );
101 
102  //Read general config
103  KConfigGroup group = config.group( "General" );
104 
105  mShowRecurrence->setChecked( group.readEntry( "ShowRecurrence", true ) );
106  mShowReminder->setChecked( group.readEntry( "ShowReminder", true ) );
107  mUnderline->setChecked( group.readEntry( "underlineLink", true ) );
108  mTodo->setChecked( group.readEntry( "ShowTodo", true ) );
109  mSd->setChecked( group.readEntry( "ShowSd", true ) );
110 
111  //Read Calendar Config
112  group = config.group( "Calendar" );
113 
114  //Set the count of Days from config
115  int days = group.readEntry( "DaysToShow", 7 );
116  if ( days == 1 ) {
117  mDateTodayButton->setChecked( true );
118  } else if( days == 31 ) {
119  mDateMonthButton->setChecked( true );
120  } else {
121  mDateRangeButton->setChecked( true );
122  mCustomDays->setValue( days );
123  mCustomDays->setEnabled( true );
124  }
125 
126  //Read Todo Config
127  group = config.group( "Hide" );
128  mHideInProgressBox->setChecked( group.readEntry( "InProgress", false ) );
129  mHideOverdueBox->setChecked( group.readEntry( "Overdue", false ) );
130  mHideCompletedBox->setChecked( group.readEntry( "Completed", true ) );
131  mHideOpenEndedBox->setChecked( group.readEntry( "OpenEnded", false ) );
132  mHideUnstartedBox->setChecked( group.readEntry( "NotStarted", false ) );
133 
134  //Read Special Dates Config
135  group = config.group( "SpecialDates" );
136 // mSdGroup->setChecked( group.readEntry( "SpecialDates", true ) );
137 // mBirthdayCal->setChecked( group.readEntry( "BirthdayCal", true ) );
138  mBirthdayConList->setChecked( group.readEntry( "BirthdayConList", true ) );
139 // mAnniversariesCal->setChecked( group.readEntry( "AnniversariesCal", true ) );
140  mAnniversariesConList->setChecked( group.readEntry( "AnniversariesConList", true ) );
141  mHolidaysCal->setChecked( group.readEntry ( "HolidaysCal", true ) );
142  mSpecialOccasionsCal->setChecked( group.readEntry( "SpecialOccasionsCal", true ) );
143 
144  //Read Groupware Config
145  group = config.group( "Groupware" );
146  mShowMyEventsOnly->setChecked( group.readEntry( "ShowMyEventsOnly", false ) );
147  mShowMyTodosOnly->setChecked( group.readEntry( "ShowMyTodosOnly", false ) );
148 
149  emit changed( false );
150 }
151 
152 void KCMPlanner::save()
153 {
154  KConfig config( "plannerrc" );
155 
156  //General Setion
157  KConfigGroup group = config.group( "General" );
158 
159  group.writeEntry( "ShowRecurrence", mShowRecurrence->isChecked() );
160  group.writeEntry( "ShowReminder", mShowReminder->isChecked() );
161  group.writeEntry( "underlineLink", mUnderline->isChecked() );
162  group.writeEntry( "ShowTodo", mTodo->isChecked() );
163  group.writeEntry( "ShowSd", mSd->isChecked() );
164 
165  //Calendar Section
166  group = config.group( "Calendar" );
167 
168  int days ;
169  if ( mDateTodayButton->isChecked() ) {
170  days = 1;
171  } else if ( mDateMonthButton->isChecked() ) {
172  days = 31;
173  } else {
174  days = mCustomDays->value();
175  }
176  group.writeEntry( "DaysToShow", days );
177 
178  //Todo Section
179  group = config.group( "Hide" );
180  group.writeEntry( "InProgress", mHideInProgressBox->isChecked() );
181  group.writeEntry( "Overdue", mHideOverdueBox->isChecked() );
182  group.writeEntry( "Completed", mHideCompletedBox->isChecked() );
183  group.writeEntry( "OpenEnded", mHideOpenEndedBox->isChecked() );
184  group.writeEntry( "NotStarted", mHideUnstartedBox->isChecked() );
185 
186  //SpecialDates Section
187  group = config.group( "SpecialDates" );
188 
189 // sd.writeEntry( "BirthdayCal", mBirthdayCal->isChecked() );
190  group.writeEntry( "BirthdayConList", mBirthdayConList->isChecked() );
191 // group.writeEntry( "AnniversariesCal", mAnniversariesCal->isChecked() );
192  group.writeEntry( "AnniversariesConList", mAnniversariesConList->isChecked() );
193  group.writeEntry( "HolidaysCal", mHolidaysCal->isChecked() );
194  group.writeEntry( "SpecialOccasionsCal", mSpecialOccasionsCal->isChecked() );
195 
196  //Groupware Section
197  group = config.group( "Groupware" );
198  group.writeEntry( "ShowMyEventsOnly", mShowMyEventsOnly->isChecked() );
199  group.writeEntry( "ShowMyTodosOnly", mShowMyTodosOnly->isChecked() );
200 
201  config.sync();
202 
203  emit changed( false );
204 }
205 
206 void KCMPlanner::defaults()
207 {
208  mShowRecurrence->setChecked( true );
209  mShowReminder->setChecked( true );
210  mUnderline->setChecked( true );
211  mTodo->setChecked( true );
212  mSd->setChecked( true );
213 
214  mDateRangeButton->setChecked( true );
215  mCustomDays->setValue( 7 );
216  mCustomDays->setEnabled( true );
217 
218  mHideInProgressBox->setChecked( false );
219  mHideOverdueBox->setChecked( false );
220  mHideCompletedBox->setChecked( true );
221  mHideOpenEndedBox->setChecked( false );
222  mHideUnstartedBox->setChecked( false );
223 
224 // mBirthdayCal->setChecked( true );
225  mBirthdayConList->setChecked( true );
226 // mAnniversariesCal->setChecked( true );
227  mAnniversariesConList->setChecked( true );
228  mHolidaysCal->setChecked( true );
229  mSpecialOccasionsCal->setChecked( true );
230 
231  mShowMyEventsOnly->setChecked( false );
232  mShowMyTodosOnly->setChecked( false );
233 
234  emit changed( true );
235 }
236 
237 const KAboutData *KCMPlanner::aboutData() const
238 {
239  KAboutData *about = new KAboutData(
240  I18N_NOOP( "kcmplanner" ),
241  0,
242  ki18n( "Planner Summary Configuration Dialog" ),
243  0,
244  KLocalizedString(),
245  KAboutData::License_GPL,
246  ki18n( "Copyright © 2004 Tobias Koenig\n"
247  "Copyright © 2006–2008 Oral Timocin\n"
248  "Copyright © 2009–2010 Allen Winter" ) );
249 
250  about->addAuthor( ki18n( "Tobias Koenig" ), KLocalizedString(), "tokoe@kde.org" );
251  about->addAuthor( ki18n( "Allen Winter" ), KLocalizedString(), "winter@kde.org" );
252  about->addAuthor( ki18n( "Oral Timocin" ), KLocalizedString(), "o.timocin.kde@gmx.de" );
253 
254  return about;
255 }
256 
QWidget
KCMPlanner::~KCMPlanner
virtual ~KCMPlanner()
Definition: kcmplanner.cpp:79
KCMPlanner::KCMPlanner
KCMPlanner(const KComponentData &inst, QWidget *parent=0)
Definition: kcmplanner.cpp:40
KCMPlanner::save
void save()
Definition: kcmplanner.cpp:152
KCMPlanner::aboutData
const KAboutData * aboutData() const
Definition: kcmplanner.cpp:237
KCMPlanner::load
void load()
Definition: kcmplanner.cpp:98
KCMPlanner
Definition: kcmplanner.h:30
create_planner
KCModule * create_planner(QWidget *parent, const char *)
Definition: kcmplanner.cpp:33
kcmplanner.h
KCMPlanner::defaults
void defaults()
Definition: kcmplanner.cpp:206
KCModule
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:11 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
  • pimprint

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