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

KDEUI

  • 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
26KConfigSkeleton::KConfigSkeleton(const QString &configname, QObject* parent)
27 : KCoreConfigSkeleton(configname, parent)
28{
29}
30
31KConfigSkeleton::KConfigSkeleton(KSharedConfig::Ptr pConfig, QObject* parent)
32 : KCoreConfigSkeleton(pConfig, parent)
33{
34}
35
36
37KConfigSkeleton::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
44void 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
53void KConfigSkeleton::ItemColor::setProperty(const QVariant & p)
54{
55 mReference = qvariant_cast<QColor>(p);
56}
57
58bool KConfigSkeleton::ItemColor::isEqual(const QVariant &v) const
59{
60 return mReference == qvariant_cast<QColor>(v);
61}
62
63QVariant KConfigSkeleton::ItemColor::property() const
64{
65 return QVariant(mReference);
66}
67
68
69KConfigSkeleton::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
76void 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
85void KConfigSkeleton::ItemFont::setProperty(const QVariant & p)
86{
87 mReference = qvariant_cast<QFont>(p);
88}
89
90bool KConfigSkeleton::ItemFont::isEqual(const QVariant &v) const
91{
92 return mReference == qvariant_cast<QFont>(v);
93}
94
95QVariant KConfigSkeleton::ItemFont::property() const
96{
97 return QVariant(mReference);
98}
99
100
101KConfigSkeleton::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
111KConfigSkeleton::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
KConfigGroup
KConfigGroup::readEntry
QString readEntry(const char *key, const char *aDefault=0) const
KConfigSkeletonGenericItem
KConfigSkeleton::ItemColor
Class for handling a color preferences item.
Definition: kconfigskeleton.h:48
KConfigSkeleton::ItemColor::property
QVariant property() const
Definition: kconfigskeleton.cpp:63
KConfigSkeleton::ItemColor::isEqual
bool isEqual(const QVariant &p) const
Definition: kconfigskeleton.cpp:58
KConfigSkeleton::ItemColor::setProperty
void setProperty(const QVariant &p)
Definition: kconfigskeleton.cpp:53
KConfigSkeleton::ItemColor::readConfig
void readConfig(KConfig *config)
Definition: kconfigskeleton.cpp:44
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
Class for handling a font preferences item.
Definition: kconfigskeleton.h:73
KConfigSkeleton::ItemFont::setProperty
void setProperty(const QVariant &p)
Definition: kconfigskeleton.cpp:85
KConfigSkeleton::ItemFont::isEqual
bool isEqual(const QVariant &p) const
Definition: kconfigskeleton.cpp:90
KConfigSkeleton::ItemFont::ItemFont
ItemFont(const QString &_group, const QString &_key, QFont &reference, const QFont &defaultValue=QFont())
Definition: kconfigskeleton.cpp:69
KConfigSkeleton::ItemFont::readConfig
void readConfig(KConfig *config)
Definition: kconfigskeleton.cpp:76
KConfigSkeleton::ItemFont::property
QVariant property() const
Definition: kconfigskeleton.cpp:95
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
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
KConfig
KCoreConfigSkeleton::addItem
void addItem(KConfigSkeletonItem *, const QString &name=QString())
KCoreConfigSkeleton::KConfigSkeleton
friend friend class KConfigSkeleton
KSharedPtr< KSharedConfig >
QObject
defaultValue
QString defaultValue(const QString &t)
kconfigskeleton.h
kcoreconfigskeleton_p.h
config
KSharedConfigPtr config()
KCoreConfigSkeleton
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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