]> git.sesse.net Git - kdenlive/blobdiff - src/mainwindow.cpp
Fix open last project opening random file:
[kdenlive] / src / mainwindow.cpp
index 60bb5fa1c3de1aa8dc9915ef58747a176489957c..78021b6c2d0c06b8d96bd2f308639af93f942012 100644 (file)
@@ -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)