From 4c76c97762c2204dea30318be67f8861ac38160a Mon Sep 17 00:00:00 2001 From: Michael Lass Date: Sat, 15 Jul 2017 23:48:51 +0200 Subject: [PATCH] Open previously opened databases in correct order In LastOpenedDatabases, the most recently opened file is listed first and the least recently opened one is listed last. If the databases are re-opened in this order, LastOpenedDatabases is reversed afterwards. To avoid this, load the files in reverse order, so LastOpenedDatabases is not modified. --- src/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 2018d29ea..354c8a3bd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -131,7 +131,8 @@ int main(int argc, char** argv) if (config()->get("OpenPreviousDatabasesOnStartup").toBool()) { const QStringList filenames = config()->get("LastOpenedDatabases").toStringList(); - for (const QString& filename : filenames) { + for (int ii = filenames.size()-1; ii >= 0; ii--) { + QString filename = filenames.at(ii); if (!filename.isEmpty() && QFile::exists(filename)) { mainWindow.openDatabase(filename, QString(), QString()); }