• 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
kcmtodosummary.cpp
Go to the documentation of this file.
1 /*
2  This file is part of Kontact.
3 
4  Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
5  Copyright (c) 2005-2006,2008-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 along
18  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 "kcmtodosummary.h"
27 
28 #include <KAboutData>
29 #include <KAcceleratorManager>
30 #include <KComponentData>
31 
32 KCModule *create_todosummary( QWidget *parent, const char * )
33 {
34  KComponentData inst( "kcmtodosummary" );
35  return new KCMTodoSummary( inst, parent );
36 }
37 
38 KCMTodoSummary::KCMTodoSummary( const KComponentData &inst, QWidget *parent )
39  : KCModule( inst, parent )
40 {
41  setupUi( this );
42 
43  customDaysChanged( 7 );
44 
45  connect( mDateTodayButton, SIGNAL(clicked(bool)), SLOT(modified()) );
46  connect( mDateMonthButton, SIGNAL(clicked(bool)), SLOT(modified()) );
47  connect( mDateRangeButton, SIGNAL(clicked(bool)), SLOT(modified()) );
48 
49  connect( mHideCompletedBox, SIGNAL(stateChanged(int)), SLOT(modified()) );
50  connect( mHideOpenEndedBox, SIGNAL(stateChanged(int)), SLOT(modified()) );
51  connect( mHideUnstartedBox, SIGNAL(stateChanged(int)), SLOT(modified()) );
52  connect( mHideInProgressBox, SIGNAL(stateChanged(int)), SLOT(modified()) );
53  connect( mHideOverdueBox, SIGNAL(stateChanged(int)), SLOT(modified()) );
54 
55  connect( mCustomDays, SIGNAL(valueChanged(int)), SLOT(modified()) );
56  connect( mCustomDays, SIGNAL(valueChanged(int)), SLOT(customDaysChanged(int)) );
57 
58  connect( mShowMineOnly, SIGNAL(stateChanged(int)), SLOT(modified()) );
59 
60  KAcceleratorManager::manage( this );
61 
62  load();
63 }
64 
65 KCMTodoSummary::~KCMTodoSummary()
66 {
67 }
68 
69 void KCMTodoSummary::modified()
70 {
71  emit changed( true );
72 }
73 
74 void KCMTodoSummary::customDaysChanged( int value )
75 {
76  mCustomDays->setSuffix( i18np( " day", " days", value ) );
77 }
78 
79 void KCMTodoSummary::load()
80 {
81  KConfig config( QLatin1String("kcmtodosummaryrc") );
82  KConfigGroup group = config.group( "Days" );
83 
84  int days = group.readEntry( "DaysToShow", 7 );
85  if ( days == 1 ) {
86  mDateTodayButton->setChecked( true );
87  } else if ( days == 31 ) {
88  mDateMonthButton->setChecked( true );
89  } else {
90  mDateRangeButton->setChecked( true );
91  mCustomDays->setValue( days );
92  mCustomDays->setEnabled( true );
93  }
94 
95  group = config.group( "Hide" );
96  mHideInProgressBox->setChecked( group.readEntry( "InProgress", false ) );
97  mHideOverdueBox->setChecked( group.readEntry( "Overdue", false ) );
98  mHideCompletedBox->setChecked( group.readEntry( "Completed", true ) );
99  mHideOpenEndedBox->setChecked( group.readEntry( "OpenEnded", false ) );
100  mHideUnstartedBox->setChecked( group.readEntry( "NotStarted", false ) );
101 
102  group = config.group( "Groupware" );
103  mShowMineOnly->setChecked( group.readEntry( "ShowMineOnly", false ) );
104 
105  emit changed( false );
106 }
107 
108 void KCMTodoSummary::save()
109 {
110  KConfig config( QLatin1String("kcmtodosummaryrc") );
111  KConfigGroup group = config.group( "Days" );
112 
113  int days;
114  if ( mDateTodayButton->isChecked() ) {
115  days = 1;
116  } else if ( mDateMonthButton->isChecked() ) {
117  days = 31;
118  } else {
119  days = mCustomDays->value();
120  }
121  group.writeEntry( "DaysToShow", days );
122 
123  group = config.group( "Hide" );
124  group.writeEntry( "InProgress", mHideInProgressBox->isChecked() );
125  group.writeEntry( "Overdue", mHideOverdueBox->isChecked() );
126  group.writeEntry( "Completed", mHideCompletedBox->isChecked() );
127  group.writeEntry( "OpenEnded", mHideOpenEndedBox->isChecked() );
128  group.writeEntry( "NotStarted", mHideUnstartedBox->isChecked() );
129 
130  group = config.group( "Groupware" );
131  group.writeEntry( "ShowMineOnly", mShowMineOnly->isChecked() );
132 
133  config.sync();
134  emit changed( false );
135 }
136 
137 void KCMTodoSummary::defaults()
138 {
139  mDateRangeButton->setChecked( true );
140  mCustomDays->setValue( 7 );
141  mCustomDays->setEnabled( true );
142 
143  mHideInProgressBox->setChecked( false );
144  mHideOverdueBox->setChecked( false );
145  mHideCompletedBox->setChecked( true );
146  mHideOpenEndedBox->setChecked( false );
147  mHideUnstartedBox->setChecked( false );
148 
149  mShowMineOnly->setChecked( false );
150 
151  emit changed( true );
152 }
153 
154 const KAboutData *KCMTodoSummary::aboutData() const
155 {
156  KAboutData *about = new KAboutData(
157  I18N_NOOP( "kcmtodosummary" ), 0,
158  ki18n( "Pending To-dos Configuration Dialog" ),
159  0, KLocalizedString(), KAboutData::License_GPL,
160  ki18n( "Copyright © 2003–2004 Tobias Koenig\n"
161  "Copyright © 2005–2010 Allen Winter" ) );
162 
163  about->addAuthor( ki18n( "Tobias Koenig" ),
164  KLocalizedString(), "tokoe@kde.org" );
165  about->addAuthor( ki18n( "Allen Winter" ),
166  KLocalizedString(), "winter@kde.org" );
167 
168  return about;
169 }
170 
171 #include "kcmtodosummary.moc"
KCMTodoSummary::KCMTodoSummary
KCMTodoSummary(const KComponentData &inst, QWidget *parent=0)
Definition: kcmtodosummary.cpp:38
KCMTodoSummary::~KCMTodoSummary
virtual ~KCMTodoSummary()
Definition: kcmtodosummary.cpp:65
kcmtodosummary.h
QWidget
KCMTodoSummary::defaults
void defaults()
Definition: kcmtodosummary.cpp:137
create_todosummary
KCModule * create_todosummary(QWidget *parent, const char *)
Definition: kcmtodosummary.cpp:32
KCMTodoSummary::save
void save()
Definition: kcmtodosummary.cpp:108
KCMTodoSummary::aboutData
const KAboutData * aboutData() const
Definition: kcmtodosummary.cpp:154
KCMTodoSummary
Definition: kcmtodosummary.h:37
KCMTodoSummary::load
void load()
Definition: kcmtodosummary.cpp:79
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