]> git.sesse.net Git - kdenlive/commitdiff
Fix open last project opening random file:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Wed, 14 Nov 2012 07:37:46 +0000 (08:37 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Wed, 14 Nov 2012 07:37:46 +0000 (08:37 +0100)
http://kdenlive.org/mantis/view.php?id=2824

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)