aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolger Schroeder <holger.schroeder.ext@basyskom.de>2011-01-13 21:27:49 +0100
committerHolger Schroeder <holger.schroeder.ext@basyskom.de>2011-01-13 22:32:30 +0100
commit8f779043386416c8e20c456dc7bd171e0febf0e8 (patch)
tree480f4e7089e1d0a1d1c7ea4c0e36fdfe23d112fe
parent7b8435759b90a7c9c63f5e7cf1e2b808c604fa14 (diff)
Changes: fix directory pathes for windows
RevBy: TrustMe Details: under windows path names like //var/cache... are interpreted as directory "cache" on file server "var". and when we try to access these, windows tries to connect to the server, and most times this does not work and the connect will timeout, for me in around 20 seconds. by not accessing non-existing remote servers the widgetsgallery startup is happening in less than a second again.
-rw-r--r--src/corelib/core/mcomponentdata.cpp4
-rw-r--r--src/corelib/i18n/mlocale.cpp15
-rw-r--r--src/corelib/style/muniquestringcache.cpp19
-rw-r--r--src/corelib/theme/mlogicalvalues.cpp15
-rw-r--r--src/corelib/theme/mthemedaemon.cpp34
-rw-r--r--src/corelib/workspace/mdeviceprofile.cpp1
6 files changed, 82 insertions, 6 deletions
diff --git a/src/corelib/core/mcomponentdata.cpp b/src/corelib/core/mcomponentdata.cpp
index 928c0ec4..610b21dc 100644
--- a/src/corelib/core/mcomponentdata.cpp
+++ b/src/corelib/core/mcomponentdata.cpp
@@ -376,6 +376,8 @@ void MComponentDataPrivate::init(int &argc, char **argv, const QString &appIdent
#ifdef __arm__
MTheme::ThemeService themeService = MTheme::RemoteTheme;
+#elif defined Q_OS_WIN
+ MTheme::ThemeService themeService = MTheme::LocalTheme;
#else
MTheme::ThemeService themeService = MTheme::AnyTheme;
#endif
@@ -458,11 +460,13 @@ void MComponentDataPrivate::init(int &argc, char **argv, const QString &appIdent
}
}
+#ifndef Q_OS_WIN
feedbackPlayer = new MFeedbackPlayer();
if (!feedbackPlayer->d_ptr->init(themeIdentifier)) {
delete feedbackPlayer;
feedbackPlayer = 0;
}
+#endif
// register dbus service
appName = themeIdentifier;
diff --git a/src/corelib/i18n/mlocale.cpp b/src/corelib/i18n/mlocale.cpp
index b222d273..63018ddf 100644
--- a/src/corelib/i18n/mlocale.cpp
+++ b/src/corelib/i18n/mlocale.cpp
@@ -631,7 +631,22 @@ MLocalePrivate::MLocalePrivate()
q_ptr(0)
{
if (translationPaths.isEmpty())
+ {
+#ifdef Q_OS_WIN
+ // walk to translation dir relative to bin dir
+ QDir appDir(QCoreApplication::applicationDirPath());
+
+ appDir.cdUp();
+ appDir.cd("share");
+ appDir.cd("l10n");
+ appDir.cd("meegotouch");
+
+ translationPaths = (QStringList() << appDir.absolutePath());
+#else
translationPaths = (QStringList() << QString(TRANSLATION_DIR));
+#endif
+ }
+
if (dataPaths.isEmpty())
MLocale::setDataPath(M_ICUEXTRADATA_DIR);
}
diff --git a/src/corelib/style/muniquestringcache.cpp b/src/corelib/style/muniquestringcache.cpp
index b70d2f77..a2eb504d 100644
--- a/src/corelib/style/muniquestringcache.cpp
+++ b/src/corelib/style/muniquestringcache.cpp
@@ -28,6 +28,7 @@
#include <QHash>
#include <QByteArray>
#include <QElapsedTimer>
+#include <QCoreApplication>
const int MAX_CACHE_SIZE = 1024*1024;
#define CACHE_NAME "MTF_UNIQUE_STRING_CACHE"
@@ -109,7 +110,23 @@ private:
}
QString createCacheFileName() {
- return QString(CACHEDIR) + "/css/" + CACHE_NAME;
+ QString cacheDir;
+#ifdef Q_OS_WIN
+ QDir appDir(QCoreApplication::applicationDirPath());
+ appDir.cdUp();
+
+ cacheDir = appDir.absolutePath()
+ + QDir::separator() + "var"
+ + QDir::separator() + "cache"
+ + QDir::separator() + "meegotouch";
+#else
+ cacheDir = QString(CACHEDIR);
+#endif
+ cacheDir = cacheDir
+ + QDir::separator() + "css"
+ + QDir::separator() + CACHE_NAME;
+
+ return cacheDir;
}
QFile cacheFile;
diff --git a/src/corelib/theme/mlogicalvalues.cpp b/src/corelib/theme/mlogicalvalues.cpp
index 1eea43c9..381dbb1d 100644
--- a/src/corelib/theme/mlogicalvalues.cpp
+++ b/src/corelib/theme/mlogicalvalues.cpp
@@ -27,6 +27,7 @@
#include <QStringList>
#include <QTextCodec>
#include <QDateTime>
+#include <QCoreApplication>
namespace {
const unsigned int CACHE_VERSION = 1;
@@ -175,7 +176,19 @@ bool MLogicalValuesPrivate::saveToBinaryCache(const QFileInfo &fileInfo, const G
}
QString MLogicalValuesPrivate::createBinaryFilename(const QFileInfo &fileInfo) const {
- QString binaryDirectory = QString(CACHEDIR) + "/logicalValues/";
+ QString binaryDirectory;
+#ifdef Q_OS_WIN
+ QDir appDir(QCoreApplication::applicationDirPath());
+ appDir.cdUp();
+
+ binaryDirectory = appDir.absolutePath()
+ + QDir::separator() + "var"
+ + QDir::separator() + "cache"
+ + QDir::separator() + "meegotouch"
+ + QDir::separator() + "logicalvalues";
+#else
+ binaryDirectory = QString(CACHEDIR) + "/logicalValues/";
+#endif
QString binaryFilename(binaryDirectory);
QString absoluteFilePathEncoded(fileInfo.absoluteFilePath());
diff --git a/src/corelib/theme/mthemedaemon.cpp b/src/corelib/theme/mthemedaemon.cpp
index c6dd5352..3bfbe3d8 100644
--- a/src/corelib/theme/mthemedaemon.cpp
+++ b/src/corelib/theme/mthemedaemon.cpp
@@ -30,6 +30,7 @@
#include <QStringList>
#include <MGConfItem>
#include <QPainter>
+#include <QDesktopServices>
#include "mthemedaemonclient.h"
#include "mimagedirectory.h"
#include "mthemedaemonprotocol.h"
@@ -78,11 +79,38 @@ QString MThemeDaemon::systemThemeDirectory()
QString MThemeDaemon::systemThemeCacheDirectory()
{
-#ifdef Q_WS_X11
- return QString(CACHEDIR) + "/themedaemon/";
+ static QString cacheDir;
+ if (cacheDir.isEmpty()) {
+ // first check if we can write to CACHEDIR
+#ifdef Q_OS_WIN
+ QDir appDir(QCoreApplication::applicationDirPath());
+
+ appDir.cdUp();
+
+ cacheDir = appDir.absolutePath()
+ + QDir::separator() + "var"
+ + QDir::separator() + "cache"
+ + QDir::separator() + "meegotouch";
#else
- return QDir::tempPath();
+ cacheDir = CACHEDIR;
#endif
+ QDir().mkpath(cacheDir);
+ QFile testFile(cacheDir + QDir::separator() + "permission_test_file");
+ if (!testFile.open(QFile::WriteOnly)) {
+ // now we try a standard cache location
+ cacheDir = QDesktopServices::storageLocation(QDesktopServices::CacheLocation)
+ + QDir::separator() + QLatin1String("meegotouch");
+ QDir().mkpath(cacheDir);
+ testFile.setFileName(cacheDir + QDir::separator() + "permission_test_file");
+ if (!testFile.open(QFile::WriteOnly)) {
+ exit(EXIT_FAILURE);
+ }
+ }
+ testFile.remove();
+ testFile.close();
+ }
+
+ return cacheDir + QDir::separator() + QLatin1String("themedaemon");
}
void MThemeDaemon::addClient(MThemeDaemonClient *client)
diff --git a/src/corelib/workspace/mdeviceprofile.cpp b/src/corelib/workspace/mdeviceprofile.cpp
index 110ec12b..3db9459e 100644
--- a/src/corelib/workspace/mdeviceprofile.cpp
+++ b/src/corelib/workspace/mdeviceprofile.cpp
@@ -55,7 +55,6 @@ MDeviceProfilePrivate::MDeviceProfilePrivate()
#ifdef Q_OS_WIN
QDir appDir(QCoreApplication::applicationDirPath());
appDir.cdUp();
- appDir.cd("usr");
appDir.cd("share");
appDir.cd("meegotouch");
appDir.cd("targets");