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

KDEUI

  • sources
  • kde-4.12
  • kdelibs
  • kdeui
  • config
kconfigskeleton.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KOrganizer.
3  Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4  Copyright (c) 2003 Waldo Bastian <bastian@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #include "kconfigskeleton.h"
23 
24 #include <kcoreconfigskeleton_p.h>
25 
26 KConfigSkeleton::KConfigSkeleton(const QString &configname, QObject* parent)
27  : KCoreConfigSkeleton(configname, parent)
28 {
29 }
30 
31 KConfigSkeleton::KConfigSkeleton(KSharedConfig::Ptr pConfig, QObject* parent)
32  : KCoreConfigSkeleton(pConfig, parent)
33 {
34 }
35 
36 
37 KConfigSkeleton::ItemColor::ItemColor( const QString &_group, const QString &_key,
38  QColor &reference,
39  const QColor &defaultValue )
40  : KConfigSkeletonGenericItem<QColor>( _group, _key, reference, defaultValue )
41 {
42 }
43 
44 void KConfigSkeleton::ItemColor::readConfig( KConfig *config )
45 {
46  KConfigGroup cg(config, mGroup );
47  mReference = cg.readEntry( mKey, mDefault );
48  mLoadedValue = mReference;
49 
50  readImmutability( cg );
51 }
52 
53 void KConfigSkeleton::ItemColor::setProperty(const QVariant & p)
54 {
55  mReference = qvariant_cast<QColor>(p);
56 }
57 
58 bool KConfigSkeleton::ItemColor::isEqual(const QVariant &v) const
59 {
60  return mReference == qvariant_cast<QColor>(v);
61 }
62 
63 QVariant KConfigSkeleton::ItemColor::property() const
64 {
65  return QVariant(mReference);
66 }
67 
68 
69 KConfigSkeleton::ItemFont::ItemFont( const QString &_group, const QString &_key,
70  QFont &reference,
71  const QFont &defaultValue )
72  : KConfigSkeletonGenericItem<QFont>( _group, _key, reference, defaultValue )
73 {
74 }
75 
76 void KConfigSkeleton::ItemFont::readConfig( KConfig *config )
77 {
78  KConfigGroup cg(config, mGroup );
79  mReference = cg.readEntry( mKey, mDefault );
80  mLoadedValue = mReference;
81 
82  readImmutability( cg );
83 }
84 
85 void KConfigSkeleton::ItemFont::setProperty(const QVariant & p)
86 {
87  mReference = qvariant_cast<QFont>(p);
88 }
89 
90 bool KConfigSkeleton::ItemFont::isEqual(const QVariant &v) const
91 {
92  return mReference == qvariant_cast<QFont>(v);
93 }
94 
95 QVariant KConfigSkeleton::ItemFont::property() const
96 {
97  return QVariant(mReference);
98 }
99 
100 
101 KConfigSkeleton::ItemColor *KConfigSkeleton::addItemColor( const QString &name, QColor &reference,
102  const QColor &defaultValue, const QString &key )
103 {
104  KConfigSkeleton::ItemColor *item;
105  item = new KConfigSkeleton::ItemColor( d->mCurrentGroup, key.isNull() ? name : key,
106  reference, defaultValue );
107  addItem( item, name );
108  return item;
109 }
110 
111 KConfigSkeleton::ItemFont *KConfigSkeleton::addItemFont( const QString &name, QFont &reference,
112  const QFont &defaultValue, const QString &key )
113 {
114  KConfigSkeleton::ItemFont *item;
115  item = new KConfigSkeleton::ItemFont( d->mCurrentGroup, key.isNull() ? name : key,
116  reference, defaultValue );
117  addItem( item, name );
118  return item;
119 }
120 
121 #include "kconfigskeleton.moc"
122 
QVariant
QColor
KSharedPtr< KSharedConfig >
KCoreConfigSkeleton::config
KConfig * config()
KConfigSkeletonGenericItem
KConfigSkeleton::ItemColor::isEqual
bool isEqual(const QVariant &p) const
Definition: kconfigskeleton.cpp:58
KConfigSkeleton::ItemFont::ItemFont
ItemFont(const QString &_group, const QString &_key, QFont &reference, const QFont &defaultValue=QFont())
Definition: kconfigskeleton.cpp:69
KConfigSkeleton::ItemColor::setProperty
void setProperty(const QVariant &p)
Definition: kconfigskeleton.cpp:53
KStandardAction::name
const char * name(StandardAction id)
This will return the internal name of a given standard action.
Definition: kstandardaction.cpp:223
KConfigSkeleton::ItemFont::setProperty
void setProperty(const QVariant &p)
Definition: kconfigskeleton.cpp:85
QString
QObject
KConfigSkeleton::ItemColor::ItemColor
ItemColor(const QString &_group, const QString &_key, QColor &reference, const QColor &defaultValue=QColor(128, 128, 128))
Definition: kconfigskeleton.cpp:37
KConfigSkeleton::ItemFont::property
QVariant property() const
Definition: kconfigskeleton.cpp:95
KConfigSkeleton::ItemFont
Class for handling a font preferences item.
Definition: kconfigskeleton.h:72
KCoreConfigSkeleton
kcoreconfigskeleton_p.h
KConfigSkeleton::addItemFont
ItemFont * addItemFont(const QString &name, QFont &reference, const QFont &defaultValue=QFont(), const QString &key=QString())
Register an item of type QFont.
Definition: kconfigskeleton.cpp:111
KConfigSkeleton::KConfigSkeleton
KConfigSkeleton(const QString &configname=QString(), QObject *parent=0)
Constructor.
Definition: kconfigskeleton.cpp:26
KConfigSkeleton::ItemFont::readConfig
void readConfig(KConfig *config)
Definition: kconfigskeleton.cpp:76
KConfigSkeleton::ItemFont::isEqual
bool isEqual(const QVariant &p) const
Definition: kconfigskeleton.cpp:90
KConfigSkeleton::addItemColor
ItemColor * addItemColor(const QString &name, QColor &reference, const QColor &defaultValue=QColor(128, 128, 128), const QString &key=QString())
Register an item of type QColor.
Definition: kconfigskeleton.cpp:101
KConfigGroup
KConfigSkeleton::ItemColor::readConfig
void readConfig(KConfig *config)
Definition: kconfigskeleton.cpp:44
QFont
KConfig
KConfigSkeleton::ItemColor::property
QVariant property() const
Definition: kconfigskeleton.cpp:63
KCoreConfigSkeleton::addItem
void addItem(KConfigSkeletonItem *, const QString &name=QString())
KConfigSkeleton::ItemColor
Class for handling a color preferences item.
Definition: kconfigskeleton.h:47
KConfigGroup::readEntry
T readEntry(const QString &key, const T &aDefault) const
kconfigskeleton.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:14 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

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