From: Jean-Baptiste M. <jb...@kd...> - 2012-11-14 07:38:54
|
Git commit 1aa6ae8f3553169b0f2c84b4946737520db557ff by Jean-Baptiste Mardelle. Committed on 14/11/2012 at 08:37. Pushed by mardelle into branch 'master'. Fix open last project opening random file: http://kdenlive.org/mantis/view.php?id=2824 M +8 -5 src/mainwindow.cpp http://commits.kde.org/kdenlive/1aa6ae8f3553169b0f2c84b4946737520db557ff diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 60bb5fa..78021b6 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) |