From: Jean-Baptiste Mardelle Date: Wed, 14 Nov 2012 07:37:46 +0000 (+0100) Subject: Fix open last project opening random file: X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=1aa6ae8f3553169b0f2c84b4946737520db557ff;p=kdenlive Fix open last project opening random file: http://kdenlive.org/mantis/view.php?id=2824 --- diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 60bb5fa1..78021b6c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2058,11 +2058,14 @@ void MainWindow::openFile() void MainWindow::openLastFile() { - KSharedConfigPtr config = KGlobal::config(); - KUrl::List urls = m_fileOpenRecent->urls(); - //WARNING: this is buggy, we get a random url, not the last one. Bug in KRecentFileAction? - if (urls.isEmpty()) newFile(false); - else openFile(urls.last()); + if (m_fileOpenRecent->selectableActionGroup()->actions().isEmpty()) { + // No files in history + newFile(false); + return; + } + QAction *firstUrlAction = m_fileOpenRecent->selectableActionGroup()->actions().first(); + if (firstUrlAction) firstUrlAction->trigger(); + else newFile(false); } void MainWindow::openFile(const KUrl &url)