summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-12-06 18:30:05 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-06 13:21:24 -0800
commit61d5aac2e89f57d1ae86c370b0405835c1098c7e (patch)
tree514d1de205d071af0ff203cfa59f653ce3ee3a8b /qt-ui
parentb04666922b9ca9c12007b9d5127a697b78e411b2 (diff)
downloadsubsurface-61d5aac2e89f57d1ae86c370b0405835c1098c7e.tar.gz
Do not change the current Directory
Qt has a really strange API for directories. when you create a QDir and set's the currentDir on *that* QDir you created, it's for the whole application and not just for that variable. Then when the variable is out of scope, the directory doesn't change back - ugh. The solution is not to call setCurrentDir on the newly created QDir (which was quite good since it's also a code cleanup. ) [Dirk Hohndel: modified to undo the far less elegant fix I had made in an earlier commit] Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/models.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 2585c578f..bac96f568 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -1765,9 +1765,7 @@ LanguageModel* LanguageModel::instance()
LanguageModel::LanguageModel(QObject* parent): QAbstractListModel(parent)
{
QSettings s;
- QDir d;
- QString cwd = d.currentPath();
- d.setCurrent( getSubsurfaceDataPath("translations") );
+ QDir d(getSubsurfaceDataPath("translations"));
QStringList result = d.entryList();
Q_FOREACH(const QString& s, result){
if ( !s.endsWith(".qm") ){
@@ -1775,7 +1773,6 @@ LanguageModel::LanguageModel(QObject* parent): QAbstractListModel(parent)
}
languages.push_back( (s == "subsurface_source.qm") ? "English" : s);
}
- d.setCurrent(cwd);
}
QVariant LanguageModel::data(const QModelIndex& index, int role) const