From 1aa6ae8f3553169b0f2c84b4946737520db557ff Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Wed, 14 Nov 2012 08:37:46 +0100 Subject: [PATCH] Fix open last project opening random file: http://kdenlive.org/mantis/view.php?id=2824 --- src/mainwindow.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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) -- 2.39.2