mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
b04666922b
commit
61d5aac2e8
1 changed files with 1 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue