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

korganizer

  • sources
  • kde-4.12
  • kdepim
  • korganizer
  • plugins
  • datenums
datenums/configdialog.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KOrganizer.
3 
4  Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5  Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
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 Foundation, Inc.,
19  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21 
22 #include "configdialog.h"
23 #include "datenums.h"
24 
25 #include <KConfig>
26 
27 #include <QButtonGroup>
28 #include <QGroupBox>
29 #include <QRadioButton>
30 #include <QVBoxLayout>
31 
32 ConfigDialog::ConfigDialog( QWidget *parent )
33  : KDialog( parent )
34 {
35  setCaption( i18n( "Configure Day Numbers" ) );
36  setButtons( Ok | Cancel );
37  setDefaultButton( Ok );
38  setModal( true );
39  QFrame *topFrame = new QFrame( this );
40  setMainWidget( topFrame );
41  QVBoxLayout *topLayout = new QVBoxLayout( topFrame );
42  topLayout->setSpacing( spacingHint() );
43  topLayout->setMargin( 0 );
44 
45  QGroupBox *dayNumBox = new QGroupBox( i18n( "Show Date Number" ), topFrame );
46  topLayout->addWidget( dayNumBox );
47  QVBoxLayout *groupLayout = new QVBoxLayout( dayNumBox );
48 
49  QRadioButton *btn;
50  mDayNumGroup = new QButtonGroup( this );
51  btn = new QRadioButton( i18n( "Show day number" ), dayNumBox );
52  mDayNumGroup->addButton( btn, int( Datenums::DayOfYear ) );
53  groupLayout->addWidget( btn );
54  btn = new QRadioButton( i18n( "Show days to end of year" ), dayNumBox );
55  mDayNumGroup->addButton( btn, int( Datenums::DaysRemaining ) );
56  groupLayout->addWidget( btn );
57  btn = new QRadioButton( i18n( "Show both" ), dayNumBox );
58  mDayNumGroup->addButton( btn, int( Datenums::DayOfYear | Datenums::DaysRemaining ) );
59  groupLayout->addWidget( btn );
60 
61  connect( this, SIGNAL(okClicked()), this, SLOT(slotOk()) );
62 
63  load();
64 }
65 
66 ConfigDialog::~ConfigDialog()
67 {
68 }
69 
70 void ConfigDialog::load()
71 {
72  KConfig _config( QLatin1String("korganizerrc"), KConfig::NoGlobals );
73  KConfigGroup config( &_config, "Calendar/Datenums Plugin" );
74  int datenum = config.readEntry(
75  "ShowDayNumbers", int( Datenums::DayOfYear | Datenums::DaysRemaining ) );
76  QAbstractButton *btn = mDayNumGroup->button( datenum );
77  if ( !btn ) {
78  btn = mDayNumGroup->button( int( Datenums::DayOfYear | Datenums::DaysRemaining ) );
79  }
80  btn->setChecked( true );
81 }
82 
83 void ConfigDialog::save()
84 {
85  KConfig _config( QLatin1String("korganizerrc"), KConfig::NoGlobals );
86  KConfigGroup config( &_config, "Calendar/Datenums Plugin" );
87  config.writeEntry( "ShowDayNumbers", mDayNumGroup->checkedId() );
88  config.sync();
89 }
90 
91 void ConfigDialog::slotOk()
92 {
93  save();
94  accept();
95 }
96 
97 #include "configdialog.moc"
ConfigDialog::load
void load()
Definition: datenums/configdialog.cpp:70
Datenums::DaysRemaining
Definition: datenums.h:41
QWidget
KDialog
Datenums::DayOfYear
Definition: datenums.h:40
ConfigDialog::slotOk
void slotOk()
Definition: datenums/configdialog.cpp:91
ConfigDialog::ConfigDialog
ConfigDialog(QWidget *parent=0)
Definition: datenums/configdialog.cpp:32
ConfigDialog::save
void save()
Definition: datenums/configdialog.cpp:83
ConfigDialog::~ConfigDialog
virtual ~ConfigDialog()
Definition: datenums/configdialog.cpp:66
configdialog.h
QFrame
datenums.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

korganizer

Skip menu "korganizer"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

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