summaryrefslogtreecommitdiff
path: root/library/config.cpp
Side-by-side diff
Diffstat (limited to 'library/config.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/config.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/library/config.cpp b/library/config.cpp
index 1121cd4..b47c620 100644
--- a/library/config.cpp
+++ b/library/config.cpp
@@ -57,96 +57,108 @@ QString Config::configFilename(const QString& name, Domain d)
}
/*!
\class Config config.h
\brief The Config class provides for saving application cofniguration state.
You should keep a Config in existence only while you do not want others
to be able to change the state. There is no locking currently, but there
may be in the future.
*/
/*!
\enum Config::ConfigGroup
\internal
*/
/*!
\enum Config::Domain
\value File
\value User
See Config for details.
*/
/*!
Constructs a config that will load or create a configuration with the
given \a name in the given \a domain.
You must call setGroup() before doing much else with the Config.
In the default Domain, \e User,
the configuration is user-specific. \a name should not contain "/" in
this case, and in general should be the name of the C++ class that is
primarily responsible for maintaining the configuration.
In the File Domain, \a name is an absolute filename.
*/
Config::Config( const QString &name, Domain domain )
: filename( configFilename(name,domain) )
{
git = groups.end();
read();
QStringList l = Global::languageList();
lang = l[0];
glang = l[1];
}
+
+// Sharp ROM compatibility
+Config::Config ( const QString &name, bool what )
+ : filename( configFilename(name,what ? User : File) )
+{
+ git = groups.end();
+ read();
+ QStringList l = Global::languageList();
+ lang = l[0];
+ glang = l[1];
+}
+
/*!
Writes any changes to disk and destroys the in-memory object.
*/
Config::~Config()
{
if ( changed )
write();
}
/*!
Returns whether the current group has an entry called \a key.
*/
bool Config::hasKey( const QString &key ) const
{
if ( groups.end() == git )
return FALSE;
ConfigGroup::ConstIterator it = ( *git ).find( key );
return it != ( *git ).end();
}
/*!
Sets the current group for subsequent reading and writing of
entries to \a gname. Grouping allows the application to partition the namespace.
This function must be called prior to any reading or writing
of entries.
The \a gname must not be empty.
*/
void Config::setGroup( const QString &gname )
{
QMap< QString, ConfigGroup>::Iterator it = groups.find( gname );
if ( it == groups.end() ) {
git = groups.insert( gname, ConfigGroup() );
changed = TRUE;
return;
}
git = it;
}
/*!
Writes a (\a key, \a value) entry to the current group.
\sa readEntry()
*/
void Config::writeEntry( const QString &key, const char* value )
{
writeEntry(key,QString(value));