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.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
@@ -20,33 +20,35 @@
#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";
}
@@ -82,40 +84,35 @@ QString Config::configFilename(const QString& name, Domain d)
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
{