diff base/RecentFiles.cpp @ 209:6576a208e8e7

* Add Open Location... * Add support for URLs in Recent Files * Do the right thing with the last location for file open dialogs when opening a URL (i.e. don't change it to the temporary file directory)
author Chris Cannam
date Wed, 10 Jan 2007 12:27:55 +0000
parents d5052b5fea9c
children 3b8008d09541
line wrap: on
line diff
--- a/base/RecentFiles.cpp	Mon Jan 08 17:04:35 2007 +0000
+++ b/base/RecentFiles.cpp	Wed Jan 10 12:27:55 2007 +0000
@@ -17,6 +17,7 @@
 
 #include <QFileInfo>
 #include <QSettings>
+#include <QRegExp>
 
 RecentFiles::RecentFiles(QString settingsGroup, size_t maxCount) :
     m_settingsGroup(settingsGroup),
@@ -115,7 +116,12 @@
 void
 RecentFiles::addFile(QString name)
 {
-    add(QFileInfo(name).absoluteFilePath());
+    static QRegExp schemeRE("^[a-zA-Z]{2,5}://");
+    if (schemeRE.indexIn(name) == 0) {
+        add(name);
+    } else {
+        add(QFileInfo(name).absoluteFilePath());
+    }
 }