• 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
  • picoftheday
picoftheday/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  Copyright (c) 2007 Loïc Corbasson <loic.corbasson@gmail.com>
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License along
19  with this program; if not, write to the Free Software Foundation, Inc.,
20  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22 
23 #include "configdialog.h"
24 
25 #include <KConfig>
26 #include <KLocale>
27 
28 #include <QButtonGroup>
29 #include <QGroupBox>
30 #include <QRadioButton>
31 #include <QVBoxLayout>
32 
33 ConfigDialog::ConfigDialog( QWidget *parent )
34  : KDialog( parent )
35 {
36  setCaption( i18n( "Configure Picture of the Day" ) );
37  setButtons( Ok|Cancel );
38  setDefaultButton( Ok );
39  setModal( true );
40  QFrame *topFrame = new QFrame( this );
41  setMainWidget( topFrame );
42  QVBoxLayout *topLayout = new QVBoxLayout( topFrame );
43  topLayout->setSpacing( spacingHint() );
44  topLayout->setMargin( 0 );
45 
46  QGroupBox *aspectRatioBox = new QGroupBox( i18n( "Thumbnail Aspect Ratio Mode" ), topFrame );
47  topLayout->addWidget( aspectRatioBox );
48  QVBoxLayout *groupLayout = new QVBoxLayout( aspectRatioBox );
49 
50  QRadioButton *btn;
51  mAspectRatioGroup = new QButtonGroup( this );
52  btn = new QRadioButton( i18n( "Ignore aspect ratio" ), aspectRatioBox );
53  btn->setWhatsThis( i18n( "The thumbnail will be scaled freely. "
54  "The aspect ratio will not be preserved." ) );
55  mAspectRatioGroup->addButton( btn, int( Qt::IgnoreAspectRatio ) );
56  groupLayout->addWidget( btn );
57  btn = new QRadioButton( i18n( "Keep aspect ratio" ), aspectRatioBox );
58  btn->setWhatsThis( i18n( "The thumbnail will be scaled to a rectangle "
59  "as large as possible inside a given rectangle, "
60  "preserving the aspect ratio." ) );
61  mAspectRatioGroup->addButton( btn, int( Qt::KeepAspectRatio ) );
62  groupLayout->addWidget( btn );
63  btn = new QRadioButton( i18n( "Keep aspect ratio by expanding" ),
64  aspectRatioBox );
65  btn->setWhatsThis( i18n( "The thumbnail will be scaled to a rectangle "
66  "as small as possible outside a given rectangle, "
67  "preserving the aspect ratio." ) );
68  mAspectRatioGroup->addButton( btn, int( Qt::KeepAspectRatioByExpanding ) );
69  groupLayout->addWidget( btn );
70 
71  connect( this, SIGNAL(okClicked()), this, SLOT(slotOk()) );
72 
73  load();
74 }
75 
76 ConfigDialog::~ConfigDialog()
77 {
78 }
79 
80 void ConfigDialog::load()
81 {
82  KConfig _config( QLatin1String("korganizerrc"), KConfig::NoGlobals );
83  KConfigGroup config( &_config, "Calendar/Picoftheday Plugin" );
84  int datenum = config.readEntry( "AspectRatioMode", 0 );
85  QAbstractButton *btn = mAspectRatioGroup->button( datenum );
86  if ( !btn ) {
87  btn = mAspectRatioGroup->button( 0 );
88  }
89  btn->setChecked( true );
90 }
91 
92 void ConfigDialog::save()
93 {
94  KConfig _config( QLatin1String("korganizerrc"), KConfig::NoGlobals );
95  KConfigGroup config( &_config, "Calendar/Picoftheday Plugin" );
96  config.writeEntry( "AspectRatioMode", mAspectRatioGroup->checkedId() );
97  config.sync();
98 }
99 
100 void ConfigDialog::slotOk()
101 {
102  save();
103  accept();
104 }
105 
106 #include "configdialog.moc"
ConfigDialog::load
void load()
Definition: datenums/configdialog.cpp:70
QWidget
configdialog.h
KDialog
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
QFrame
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