From 61d5aac2e89f57d1ae86c370b0405835c1098c7e Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 6 Dec 2013 18:30:05 -0200 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/models.cpp | 5 +---- 1 file changed, 1 insertion(+), 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 -- cgit v1.2.3-70-g09d2