diff options
-rw-r--r-- | src/bookmarks/bookmarkprovider.cpp | 2 | ||||
-rw-r--r-- | src/history/historymanager.cpp | 2 | ||||
-rw-r--r-- | src/iconmanager.cpp | 4 | ||||
-rw-r--r-- | src/urlbar/completionwidget.cpp | 37 | ||||
-rw-r--r-- | src/urlbar/listitem.cpp | 2 | ||||
-rw-r--r-- | src/urlbar/urlbar.cpp | 42 |
6 files changed, 62 insertions, 27 deletions
diff --git a/src/bookmarks/bookmarkprovider.cpp b/src/bookmarks/bookmarkprovider.cpp index 3e2d2814..beca5475 100644 --- a/src/bookmarks/bookmarkprovider.cpp +++ b/src/bookmarks/bookmarkprovider.cpp @@ -266,7 +266,7 @@ void BookmarkProvider::find(QList<KBookmark> *list, const KBookmark &bookmark, c } else { - QStringList words = text.split(" "); + QStringList words = text.split(' '); bool matches = true; foreach (const QString &word, words) { diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp index 4a3039f3..4a2c0459 100644 --- a/src/history/historymanager.cpp +++ b/src/history/historymanager.cpp @@ -240,7 +240,7 @@ QList<HistoryItem> HistoryManager::find(const QString &text) int index = m_historyFilterModel->historyLocation(url); HistoryItem item = m_history.at(index); - QStringList words = text.split(" "); + QStringList words = text.split(' '); bool matches = true; foreach (const QString &word, words) { diff --git a/src/iconmanager.cpp b/src/iconmanager.cpp index c4b9751d..5086c59d 100644 --- a/src/iconmanager.cpp +++ b/src/iconmanager.cpp @@ -98,7 +98,7 @@ KIcon IconManager::iconForUrl(const KUrl &url) return KIcon(faviconDir + i); } - kDebug() << "Icon NOT Found. returning text-html one"; + kDebug() << "Icon NOT Found for url: " << url; return KIcon("text-html"); } @@ -149,7 +149,7 @@ void IconManager::provideIcon(QWebPage *page, const KUrl &url, bool notify) if(!relUrlString.isEmpty()) { - faviconUrl = relUrlString.startsWith("http") + faviconUrl = relUrlString.startsWith(QL1S("http")) ? KUrl(relUrlString) : KUrl(rootUrlString + QL1C('/') + relUrlString) ; } diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp index be189001..f8bf6ee2 100644 --- a/src/urlbar/completionwidget.cpp +++ b/src/urlbar/completionwidget.cpp @@ -273,12 +273,39 @@ bool CompletionWidget::eventFilter(QObject *obj, QEvent *ev) case Qt::Key_Enter: case Qt::Key_Return: - - // let urlbar handle Return + Modifiers - if(!(kev->modifiers() & Qt::NoModifier)) - return false; - w = qobject_cast<UrlBar *>(parent()); + + if (!w->text().startsWith(QL1S("http://"), Qt::CaseInsensitive)) + { + QString append; + if (kev->modifiers() == Qt::ControlModifier) + { + append = QL1S(".com"); + } + else if (kev->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier)) + { + append = QL1S(".org"); + } + else if (kev->modifiers() == Qt::ShiftModifier) + { + append = QL1S(".net"); + } + + if (!append.isEmpty()) + { + QUrl url(QL1S("http://www.") + w->text()); + QString host = url.host(); + if (!host.endsWith(append, Qt::CaseInsensitive)) + { + host += append; + url.setHost(host); + } + + emit chosenUrl(url, Rekonq::CurrentTab); + } + } + + if( _currentIndex == -1) _currentIndex = 0; child = findChild<ListItem *>(QString::number(_currentIndex)); diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index 5ff90056..d84a5488 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -209,7 +209,7 @@ TextLabel::TextLabel(const QString &text, const QString &textToPointOut, QWidget : QLabel(parent) { QString t = text; - const bool wasItalic = t.startsWith("<i>"); + const bool wasItalic = t.startsWith(QL1S("<i>")); if (wasItalic) t.remove(QRegExp("<[/ib]*>")); diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index c8aa43ff..61c44907 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -89,9 +89,6 @@ UrlBar::UrlBar(QWidget *parent) // doesn't show the clear button setClearButtonShown(false); - // trap Key_Enter & Key_Return events, while emitting the returnPressed signal - setTrapReturnKey(true); - // insert decoded URLs setUrlDropsEnabled(true); @@ -116,9 +113,6 @@ UrlBar::UrlBar(QWidget *parent) // bookmark icon connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(const QString &, const QString &)), this, SLOT(onBookmarksChanged())); - // load typed urls - connect(this, SIGNAL(returnPressed(const QString &)), this, SLOT(loadTyped(const QString &))); - _suggestionTimer->setSingleShot(true); connect(_suggestionTimer, SIGNAL(timeout()), this, SLOT(suggest())); @@ -138,7 +132,6 @@ void UrlBar::setQUrl(const QUrl& url) { if (url.scheme() == QL1S("about")) { - _icon->setIcon(KIcon("arrow-right")); clear(); setFocus(); } @@ -241,7 +234,8 @@ void UrlBar::keyPressEvent(QKeyEvent *event) // this handles the Modifiers + Return key combinations QString currentText = text().trimmed(); if ((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) - && !currentText.startsWith(QL1S("http://"), Qt::CaseInsensitive)) + && !currentText.startsWith(QL1S("http://"), Qt::CaseInsensitive) + && event->modifiers() != Qt::NoModifier) { QString append; if (event->modifiers() == Qt::ControlModifier) @@ -257,19 +251,28 @@ void UrlBar::keyPressEvent(QKeyEvent *event) append = QL1S(".net"); } - QUrl url(QL1S("http://www.") + currentText); - QString host = url.host(); - if (!host.endsWith(append, Qt::CaseInsensitive)) + if (!append.isEmpty()) { - host += append; - url.setHost(host); + QUrl url(QL1S("http://www.") + currentText); + QString host = url.host(); + if (!host.endsWith(append, Qt::CaseInsensitive)) + { + host += append; + url.setHost(host); + } + + // now, load it! + activated(url); } + } - // now, load it! - activated(url); + else if ((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) + && !currentText.isEmpty()) + { + loadTyped(currentText); } - if (event->key() == Qt::Key_Escape) + else if (event->key() == Qt::Key_Escape) { clearFocus(); event->accept(); @@ -503,5 +506,10 @@ void UrlBar::suggest() void UrlBar::refreshFavicon() { - _icon->setIcon(Application::iconManager()->iconForUrl(_tab->view()->url())); + KUrl u = _tab->url(); + if(u.scheme() == QL1S("about")) { + _icon->setIcon(KIcon("arrow-right")); + return; + } + _icon->setIcon(Application::iconManager()->iconForUrl(u)); } |