1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Fix searching for strings with special whitespaces from locationbar

This fixes eg. search terms with double byte space.

Closes #1622
This commit is contained in:
David Rosca 2015-04-16 17:28:04 +02:00
parent 27f0f9afac
commit 626bf8f4bb
3 changed files with 12 additions and 1 deletions

View File

@ -557,6 +557,15 @@ bool QzTools::isUtf8(const char* string)
return true; return true;
} }
bool QzTools::containsSpace(const QString &str)
{
Q_FOREACH (const QChar &c, str) {
if (c.isSpace())
return true;
}
return false;
}
QString QzTools::getExistingDirectory(const QString &name, QWidget* parent, const QString &caption, const QString &dir, QFileDialog::Options options) QString QzTools::getExistingDirectory(const QString &name, QWidget* parent, const QString &caption, const QString &dir, QFileDialog::Options options)
{ {
Settings settings; Settings settings;

View File

@ -72,6 +72,8 @@ public:
static QIcon iconFromFileName(const QString &fileName); static QIcon iconFromFileName(const QString &fileName);
static bool isUtf8(const char* string); static bool isUtf8(const char* string);
static bool containsSpace(const QString &str);
// QFileDialog static functions that remembers last used directory // QFileDialog static functions that remembers last used directory
static QString getExistingDirectory(const QString &name, QWidget* parent = 0, const QString &caption = QString(), const QString &dir = QString(), QFileDialog::Options options = QFileDialog::ShowDirsOnly); static QString getExistingDirectory(const QString &name, QWidget* parent = 0, const QString &caption = QString(), const QString &dir = QString(), QFileDialog::Options options = QFileDialog::ShowDirsOnly);
static QString getOpenFileName(const QString &name, QWidget* parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString* selectedFilter = 0, QFileDialog::Options options = 0); static QString getOpenFileName(const QString &name, QWidget* parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString* selectedFilter = 0, QFileDialog::Options options = 0);

View File

@ -173,7 +173,7 @@ void WebView::load(const LoadRequest &request)
// Make sure to correctly load hosts like localhost (eg. without the dot) // Make sure to correctly load hosts like localhost (eg. without the dot)
if (!reqUrl.isEmpty() && if (!reqUrl.isEmpty() &&
reqUrl.scheme().isEmpty() && reqUrl.scheme().isEmpty() &&
!reqUrl.path().contains(QL1C(' ')) && !QzTools::containsSpace(reqUrl.path()) && // See #1622
!reqUrl.path().contains(QL1C('.')) !reqUrl.path().contains(QL1C('.'))
) { ) {
QUrl u(QSL("http://") + reqUrl.path()); QUrl u(QSL("http://") + reqUrl.path());