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

kontact

kcmplanner.cpp

Go to the documentation of this file.
00001 /*
00002   This file is part of Kontact.
00003   Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
00004   Copyright (c) 2006-2008 Oral Timocin <oral.timocin@kdemail.net>
00005   Copyright (C) 2009 Allen Winter <winter@kde.org>
00006 
00007   This program is free software; you can redistribute it and/or modify
00008   it under the terms of the GNU General Public License as published by
00009   the Free Software Foundation; either version 2 of the License, or
00010   (at your option) any later version.
00011 
00012   This program is distributed in the hope that it will be useful,
00013   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015   GNU General Public License for more details.
00016 
00017   You should have received a copy of the GNU General Public License
00018   along with this program; if not, write to the Free Software
00019   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020 
00021   As a special exception, permission is given to link this program
00022   with any edition of Qt, and distribute the resulting executable,
00023   without including the source code for Qt in the source distribution.
00024 */
00025 
00026 #include "kcmplanner.h"
00027 
00028 #include <KAboutData>
00029 #include <KComponentData>
00030 
00031 extern "C"
00032 {
00033   KDE_EXPORT KCModule *create_planner( QWidget *parent, const char * )
00034   {
00035     KComponentData inst( "kcmplanner" );
00036     return new KCMPlanner( inst, parent );
00037   }
00038 }
00039 
00040 KCMPlanner::KCMPlanner( const KComponentData &inst, QWidget *parent )
00041   : KCModule( inst, parent )
00042 {
00043   setupUi( this );
00044 
00045   customDaysChanged( 7 );
00046 
00047   connect( mShowRecurrence, SIGNAL(stateChanged(int)), SLOT(modified()) );
00048   connect( mShowReminder, SIGNAL(stateChanged(int)), SLOT(modified()) );
00049   connect( mUnderline, SIGNAL(stateChanged(int)), SLOT(modified()) );
00050   connect( mTodo, SIGNAL(stateChanged(int)), SLOT(modified()) );
00051   connect( mSd, SIGNAL(stateChanged(int)), SLOT(modified()) );
00052 
00053   connect( mDateTodayButton, SIGNAL(clicked(bool)), SLOT(modified()) );
00054   connect( mDateMonthButton, SIGNAL(clicked(bool)), SLOT(modified()) );
00055   connect( mDateRangeButton, SIGNAL(clicked(bool)), SLOT(modified()) );
00056 
00057   connect( mHideCompletedBox, SIGNAL(stateChanged(int)), SLOT(modified()) );
00058   connect( mHideOpenEndedBox, SIGNAL(stateChanged(int)), SLOT(modified()) );
00059   connect( mHideUnstartedBox, SIGNAL(stateChanged(int)), SLOT(modified()) );
00060   connect( mHideInProgressBox, SIGNAL(stateChanged(int)), SLOT(modified()) );
00061   connect( mHideOverdueBox, SIGNAL(stateChanged(int)), SLOT(modified()) );
00062 
00063   connect( mCustomDays, SIGNAL(valueChanged(int)), SLOT(modified()) );
00064   connect( mCustomDays, SIGNAL(valueChanged(int)), SLOT(customDaysChanged(int)) );
00065 
00066 //   connect( mBirthdayCal, SIGNAL(stateChanged(int)), SLOT(modified()) );
00067   connect( mBirthdayConList, SIGNAL(stateChanged(int)), SLOT(modified()) );
00068 //   connect( mAnniversariesCal, SIGNAL(stateChanged(int)), SLOT(modified()) );
00069   connect( mAnniversariesConList, SIGNAL(stateChanged(int)), SLOT(modified()) );
00070   connect( mHolidaysCal, SIGNAL(stateChanged(int)), SLOT(modified()) );
00071   connect( mSpecialOccasionsCal, SIGNAL(stateChanged(int)), SLOT(modified()) );
00072 
00073   connect( mShowMyEventsOnly, SIGNAL(stateChanged(int)), SLOT(modified()) );
00074   connect( mShowMyTodosOnly, SIGNAL(stateChanged(int)), SLOT(modified()) );
00075 
00076   load();
00077 }
00078 
00079 KCMPlanner::~KCMPlanner()
00080 {
00081 }
00082 
00083 void KCMPlanner::modified()
00084 {
00085   emit changed( true );
00086 }
00087 
00088 void KCMPlanner::customDaysChanged( int value )
00089 {
00090   mCustomDays->setSuffix( i18np( " day", " days", value ) );
00091 }
00092 
00093 void KCMPlanner::buttonClicked( bool state )
00094 {
00095   mCustomDays->setEnabled( state );
00096 }
00097 
00098 void KCMPlanner::load()
00099 {
00100   KConfig config( "plannerrc" );
00101 
00102   //Read general config
00103   KConfigGroup group = config.group( "General" );
00104 
00105   mShowRecurrence->setChecked( group.readEntry( "ShowRecurrence", true ) );
00106   mShowReminder->setChecked( group.readEntry( "ShowReminder", true ) );
00107   mUnderline->setChecked( group.readEntry( "underlineLink", true ) );
00108   mTodo->setChecked( group.readEntry( "ShowTodo", true ) );
00109   mSd->setChecked( group.readEntry( "ShowSd", true ) );
00110 
00111   //Read Calendar Config
00112   group = config.group( "Calendar" );
00113 
00114   //Set the count of Days from config
00115   int days = group.readEntry( "DaysToShow", 7 );
00116   if ( days == 1 ) {
00117     mDateTodayButton->setChecked( true );
00118   } else if( days == 31 ) {
00119     mDateMonthButton->setChecked( true );
00120   } else {
00121     mDateRangeButton->setChecked( true );
00122     mCustomDays->setValue( days );
00123     mCustomDays->setEnabled( true );
00124   }
00125 
00126   //Read Todo Config
00127   group = config.group( "Hide" );
00128   mHideInProgressBox->setChecked( group.readEntry( "InProgress", false ) );
00129   mHideOverdueBox->setChecked( group.readEntry( "Overdue", false ) );
00130   mHideCompletedBox->setChecked( group.readEntry( "Completed", true ) );
00131   mHideOpenEndedBox->setChecked( group.readEntry( "OpenEnded", false ) );
00132   mHideUnstartedBox->setChecked( group.readEntry( "NotStarted", false ) );
00133 
00134   //Read Special Dates Config
00135   group = config.group( "SpecialDates" );
00136 //   mSdGroup->setChecked( group.readEntry( "SpecialDates", true ) );
00137 //   mBirthdayCal->setChecked( group.readEntry( "BirthdayCal", true ) );
00138   mBirthdayConList->setChecked( group.readEntry( "BirthdayConList", true ) );
00139 //   mAnniversariesCal->setChecked( group.readEntry( "AnniversariesCal", true ) );
00140   mAnniversariesConList->setChecked( group.readEntry( "AnniversariesConList", true ) );
00141   mHolidaysCal->setChecked( group.readEntry ( "HolidaysCal", true ) );
00142   mSpecialOccasionsCal->setChecked( group.readEntry( "SpecialOccasionsCal", true ) );
00143 
00144   //Read Groupware Config
00145   group = config.group( "Groupware" );
00146   mShowMyEventsOnly->setChecked( group.readEntry( "ShowMyEventsOnly", false ) );
00147   mShowMyTodosOnly->setChecked( group.readEntry( "ShowMyTodosOnly", false ) );
00148 
00149   emit changed( false );
00150 }
00151 
00152 void KCMPlanner::save()
00153 {
00154   KConfig config( "plannerrc" );
00155 
00156   //General Setion
00157   KConfigGroup group = config.group( "General" );
00158 
00159   group.writeEntry( "ShowRecurrence", mShowRecurrence->isChecked() );
00160   group.writeEntry( "ShowReminder", mShowReminder->isChecked() );
00161   group.writeEntry( "underlineLink", mUnderline->isChecked() );
00162   group.writeEntry( "ShowTodo", mTodo->isChecked() );
00163   group.writeEntry( "ShowSd", mSd->isChecked() );
00164 
00165   //Calendar Section
00166   group = config.group( "Calendar" );
00167 
00168   int days ;
00169   if ( mDateTodayButton->isChecked() ) {
00170     days = 1;
00171   } else if ( mDateMonthButton->isChecked() ) {
00172     days = 31;
00173   } else {
00174     days = mCustomDays->value();
00175   }
00176   group.writeEntry( "DaysToShow", days );
00177 
00178   //Todo Section
00179   group = config.group( "Hide" );
00180   group.writeEntry( "InProgress", mHideInProgressBox->isChecked() );
00181   group.writeEntry( "Overdue", mHideOverdueBox->isChecked() );
00182   group.writeEntry( "Completed", mHideCompletedBox->isChecked() );
00183   group.writeEntry( "OpenEnded", mHideOpenEndedBox->isChecked() );
00184   group.writeEntry( "NotStarted", mHideUnstartedBox->isChecked() );
00185 
00186   //SpecialDates Section
00187   group = config.group( "SpecialDates" );
00188 
00189 //   sd.writeEntry( "BirthdayCal", mBirthdayCal->isChecked() );
00190   group.writeEntry( "BirthdayConList", mBirthdayConList->isChecked() );
00191 //   group.writeEntry( "AnniversariesCal", mAnniversariesCal->isChecked() );
00192   group.writeEntry( "AnniversariesConList", mAnniversariesConList->isChecked() );
00193   group.writeEntry( "HolidaysCal", mHolidaysCal->isChecked() );
00194   group.writeEntry( "SpecialOccasionsCal", mSpecialOccasionsCal->isChecked() );
00195 
00196   //Groupware Section
00197   group = config.group( "Groupware" );
00198   group.writeEntry( "ShowMyEventsOnly", mShowMyEventsOnly->isChecked() );
00199   group.writeEntry( "ShowMyTodosOnly", mShowMyTodosOnly->isChecked() );
00200 
00201   config.sync();
00202 
00203   emit changed( false );
00204 }
00205 
00206 void KCMPlanner::defaults()
00207 {
00208   mShowRecurrence->setChecked( true );
00209   mShowReminder->setChecked( true );
00210   mUnderline->setChecked( true );
00211   mTodo->setChecked( true );
00212   mSd->setChecked( true );
00213 
00214   mDateRangeButton->setChecked( true );
00215   mCustomDays->setValue( 7 );
00216   mCustomDays->setEnabled( true );
00217 
00218   mHideInProgressBox->setChecked( false );
00219   mHideOverdueBox->setChecked( false );
00220   mHideCompletedBox->setChecked( true );
00221   mHideOpenEndedBox->setChecked( false );
00222   mHideUnstartedBox->setChecked( false );
00223 
00224 //   mBirthdayCal->setChecked( true );
00225   mBirthdayConList->setChecked( true );
00226 //   mAnniversariesCal->setChecked( true );
00227   mAnniversariesConList->setChecked( true );
00228   mHolidaysCal->setChecked( true );
00229   mSpecialOccasionsCal->setChecked( true );
00230 
00231   mShowMyEventsOnly->setChecked( false );
00232   mShowMyTodosOnly->setChecked( false );
00233 
00234   emit changed( true );
00235 }
00236 
00237 const KAboutData *KCMPlanner::aboutData() const
00238 {
00239   KAboutData *about = new KAboutData(
00240     I18N_NOOP( "kcmplanner" ), 0, ki18n( "Planner Summary Configuration Dialog" ),
00241     0, KLocalizedString(), KAboutData::License_GPL, ki18n( "(c) 2007-2008 Oral Timocin" ) );
00242 
00243   about->addAuthor( ki18n( "Tobias Koenig" ), KLocalizedString(), "tokoe@kde.org" );
00244   about->addAuthor( ki18n( "Allen Winter" ), KLocalizedString(), "winter@kde.org" );
00245   about->addAuthor( ki18n( "Oral Timocin" ), KLocalizedString(), "o.timocin.kde@gmx.de" );
00246 
00247   return about;
00248 }
00249 
00250 #include "kcmplanner.moc"

kontact

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

kdepim

Skip menu "kdepim"
  •   akonadi_next
  •   kcal
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korganizer
  •   korgac
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • messageviewer
  • runtime
  •   kcm
  •       libmaildir
Generated for kdepim by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal