summaryrefslogtreecommitdiff
path: root/library/config.cpp
authorkergoth <kergoth>2002-06-07 18:53:14 (UTC)
committer kergoth <kergoth>2002-06-07 18:53:14 (UTC)
commit640d964cfdc7467f6cacb513087cd3acda2c04f0 (patch) (side-by-side diff)
tree9a784686c1795f8b1f81eb344598f3b549d43467 /library/config.cpp
parentdfb9c76738bb68e235114c5ad43dbd26a59b98ab (diff)
downloadopie-640d964cfdc7467f6cacb513087cd3acda2c04f0.zip
opie-640d964cfdc7467f6cacb513087cd3acda2c04f0.tar.gz
opie-640d964cfdc7467f6cacb513087cd3acda2c04f0.tar.bz2
Backing out unintentional merge from TT branch.
Diffstat (limited to 'library/config.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/config.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/library/config.cpp b/library/config.cpp
index 9634571..e07eecb 100644
--- a/library/config.cpp
+++ b/library/config.cpp
@@ -12,49 +12,51 @@
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qmessagebox.h>
#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
#include <qtextcodec.h>
#endif
#include <qtextstream.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
+#define QTOPIA_INTERNAL_LANGLIST
#include "config.h"
+#include "global.h"
/*!
\internal
*/
QString Config::configFilename(const QString& name, Domain d)
{
switch (d) {
case File:
return name;
case User: {
QDir dir = (QString(getenv("HOME")) + "/Settings");
if ( !dir.exists() )
mkdir(dir.path().local8Bit(),0700);
return dir.path() + "/" + name + ".conf";
}
}
return name;
}
/*!
\class Config config.h
\brief The Config class provides for saving application cofniguration state.
@@ -74,56 +76,51 @@ QString Config::configFilename(const QString& name, Domain d)
\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();
-
- lang = getenv("LANG");
- int i = lang.find(".");
- if ( i > 0 )
- lang = lang.left( i );
- i = lang.find( "_" );
- if ( i > 0 )
- glang = lang.left(i);
+ 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