# HG changeset patch # User Chris Cannam # Date 1168432075 0 # Node ID 6576a208e8e73df78887303b9a250936bbe712d7 # Parent 8a3d68910b372e43f1bc958b41fb6d8a1b812ff3 * 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) diff -r 8a3d68910b37 -r 6576a208e8e7 base/RecentFiles.cpp --- 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 #include +#include 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()); + } } diff -r 8a3d68910b37 -r 6576a208e8e7 base/RecentFiles.h --- a/base/RecentFiles.h Mon Jan 08 17:04:35 2007 +0000 +++ b/base/RecentFiles.h Wed Jan 10 12:27:55 2007 +0000 @@ -53,8 +53,9 @@ void add(QString name); /** - * Add a name that should be treated as a file path and - * canonicalised appropriately. + * Add a name that is known to be either a file path or a URL. If + * it looks like a URL, add it literally; otherwise treat it as a + * file path and canonicalise it appropriately. */ void addFile(QString name);