changeset 1253:cc434d37a126 3.0-integration

Patch from Fab Nicol to fix a problem with Recent Files menu: "Patch corrects a linux version bug already there in recent tags (at least 2.5, including in official Linux distros) and apparently remaining unnotices wrt open Recent Files submenu: an offending ampersand in paths (perhaps a Qt bug) makes the menu useless."
author Chris Cannam
date Mon, 15 Aug 2016 16:45:17 +0100
parents 8b89cefa8409
children 852a3c16dcf3
files main/MainWindow.cpp main/MainWindow.h
diffstat 2 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Mon Aug 15 16:42:19 2016 +0100
+++ b/main/MainWindow.cpp	Mon Aug 15 16:45:17 2016 +0100
@@ -1764,8 +1764,11 @@
     m_recentFilesMenu->clear();
     vector<QString> files = m_recentFiles.getRecent();
     for (size_t i = 0; i < files.size(); ++i) {
-	QAction *action = new QAction(files[i], this);
-	connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile()));
+        /* F. Nicol patch 13 Aug. 2016 */
+        const QString& path = files[i];
+        QAction *action = new QAction(path, this);
+        connect(action, &QAction::triggered, [this, path] { openRecentFile(path);});
+        /* end of patch */
         if (i == 0) {
             action->setShortcut(tr("Ctrl+R"));
             m_keyReference->registerShortcut
@@ -3073,8 +3076,10 @@
 }
 
 void
-MainWindow::openRecentFile()
+MainWindow::openRecentFile(const QString& path)
 {
+   /* F. Nicol patch 13 Aug. 2016 */
+#if 0
     QObject *obj = sender();
     QAction *action = dynamic_cast<QAction *>(obj);
     
@@ -3085,6 +3090,9 @@
     }
 
     QString path = action->text();
+#endif
+   /* End of F. Nicol patch 13 Aug. 2016 */
+
     if (path == "") return;
 
     FileOpenStatus status = openPath(path, ReplaceSession);
--- a/main/MainWindow.h	Mon Aug 15 16:42:19 2016 +0100
+++ b/main/MainWindow.h	Mon Aug 15 16:45:17 2016 +0100
@@ -52,7 +52,9 @@
     virtual void replaceMainAudio();
     virtual void openSomething();
     virtual void openLocation();
-    virtual void openRecentFile();
+       /* F. Nicol patch 13 Aug. 2016 */
+    virtual void openRecentFile(const QString& );
+       /* End of F. Nicol patch 13 Aug. 2016 */
     virtual void applyTemplate();
     virtual void exportAudio();
     virtual void exportAudioData();