summaryrefslogtreecommitdiff
path: root/src/urlbar
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-10-14 17:30:21 +0200
committerAndrea Diamantini <adjam7@gmail.com>2011-10-14 17:30:21 +0200
commit1557a5f87b7fbb0bbfe55f154291cb403ebfa2a1 (patch)
tree1aab6c474392fc0dc6435b329af089aa3a58f200 /src/urlbar
parentSanitizing strings... (diff)
downloadrekonq-1557a5f87b7fbb0bbfe55f154291cb403ebfa2a1.tar.xz
EBN Krazy fixes
It seems now we are really ready for the stable release...
Diffstat (limited to 'src/urlbar')
-rw-r--r--src/urlbar/urlbar.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 0515f58b..7b77f3db 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -294,7 +294,7 @@ void UrlBar::keyPressEvent(QKeyEvent *event)
{
clearFocus();
if (text() != rApp->mainWindow()->currentTab()->view()->url().toString()
- && !rApp->mainWindow()->currentTab()->view()->url().toString().startsWith("about"))
+ && !rApp->mainWindow()->currentTab()->view()->url().toString().startsWith(QL1S("about")))
setText(rApp->mainWindow()->currentTab()->view()->url().toString());
event->accept();
}
@@ -518,10 +518,20 @@ void UrlBar::contextMenuEvent(QContextMenuEvent* event)
bool UrlBar::isValidURL(QString url)
{
bool isValid = false;
- if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("ftp://"))
+ if (url.startsWith(QL1S("http://"))
+ || url.startsWith(QL1S("https://"))
+ || url.startsWith(QL1S("ftp://"))
+ )
url = url.remove(QRegExp("(http|https|ftp)://"));
- if (url.contains('.') && url.indexOf('.') > 0 && url.indexOf('.') < url.length() && !url.trimmed().contains(" ") && QUrl::fromUserInput(url).isValid())
+
+ if (url.contains(QL1C('.'))
+ && url.indexOf(QL1C('.')) > 0
+ && url.indexOf(QL1C('.')) < url.length()
+ && !url.trimmed().contains(QL1C(' '))
+ && QUrl::fromUserInput(url).isValid()
+ )
isValid = true;
+
return isValid;
}