1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-13 10:32:11 +01:00

LoadRequest: Replace isEmpty with isValid

Also test for QUrl being valid, not just not empty
This commit is contained in:
David Rosca 2017-10-09 12:06:25 +02:00
parent 71ef1cefd0
commit 40d42f1230
3 changed files with 5 additions and 5 deletions

View File

@ -204,7 +204,7 @@ LoadRequest LocationBar::createLoadRequest() const
req.setUrl(item->url()); req.setUrl(item->url());
} }
if (req.isEmpty()) { if (!req.isValid()) {
// One word needs special handling, because QUrl::fromUserInput // One word needs special handling, because QUrl::fromUserInput
// would convert it to QUrl("http://WORD") // would convert it to QUrl("http://WORD")
if (!t.contains(QL1C(' ')) && !t.contains(QL1C('.'))) { if (!t.contains(QL1C(' ')) && !t.contains(QL1C('.'))) {
@ -219,7 +219,7 @@ LoadRequest LocationBar::createLoadRequest() const
} }
// Search when creating url failed // Search when creating url failed
if (!req.url().isValid()) { if (!req.isValid()) {
req = mApp->searchEnginesManager()->searchResult(t); req = mApp->searchEnginesManager()->searchResult(t);
} }

View File

@ -44,9 +44,9 @@ LoadRequest &LoadRequest::operator=(const LoadRequest &other)
return *this; return *this;
} }
bool LoadRequest::isEmpty() const bool LoadRequest::isValid() const
{ {
return m_url.isEmpty(); return m_url.isValid();
} }
QUrl LoadRequest::url() const QUrl LoadRequest::url() const

View File

@ -40,7 +40,7 @@ public:
LoadRequest &operator=(const LoadRequest &other); LoadRequest &operator=(const LoadRequest &other);
bool isEmpty() const; bool isValid() const;
QUrl url() const; QUrl url() const;
void setUrl(const QUrl &url); void setUrl(const QUrl &url);