From a1b660daae9dd252d84ec44e8a5102277539b395 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 12 Dec 2012 18:47:35 +0100 Subject: - Code style check (codestyle script round) - restored CTRL + ENTER code - applied Vedant's patch about (thanks!!!) CCMAIL: vedant.kota@gmail.com REVIEW: 107662 REVIEWED-BY: Tirtha and me --- src/urlbar/adblockwidget.cpp | 10 +++---- src/urlbar/completionwidget.cpp | 63 +++++++++++++++++++++-------------------- src/urlbar/completionwidget.h | 2 +- src/urlbar/urlbar.cpp | 2 +- src/urlbar/urlbar.h | 2 +- src/urlbar/urlsuggester.cpp | 8 +++--- src/urlbar/urlsuggester.h | 2 +- 7 files changed, 46 insertions(+), 43 deletions(-) (limited to 'src/urlbar') diff --git a/src/urlbar/adblockwidget.cpp b/src/urlbar/adblockwidget.cpp index 136fd2f2..063658eb 100644 --- a/src/urlbar/adblockwidget.cpp +++ b/src/urlbar/adblockwidget.cpp @@ -65,7 +65,7 @@ AdBlockWidget::AdBlockWidget(const QUrl &url, QWidget *parent) QStringList hList = ReKonfig::whiteReferer(); const QString urlHost = _pageUrl.host(); - Q_FOREACH(const QString &host, hList) + Q_FOREACH(const QString & host, hList) { if (host.contains(urlHost)) { @@ -73,11 +73,11 @@ AdBlockWidget::AdBlockWidget(const QUrl &url, QWidget *parent) break; } } - + // Checkbox _chBox->setText(i18n("Enable adblock for this site")); _chBox->setChecked(_isAdblockEnabledHere); - + layout->addWidget(title); layout->addWidget(_chBox); @@ -110,7 +110,7 @@ void AdBlockWidget::accept() if (on != _isAdblockEnabledHere) { QStringList hosts = ReKonfig::whiteReferer(); - + if (on) { kDebug() << "REMOVING IT..."; @@ -122,7 +122,7 @@ void AdBlockWidget::accept() } ReKonfig::setWhiteReferer(hosts); - + emit updateIcon(); } close(); diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp index f227eec1..207cc3ca 100644 --- a/src/urlbar/completionwidget.cpp +++ b/src/urlbar/completionwidget.cpp @@ -264,39 +264,42 @@ bool CompletionWidget::eventFilter(QObject *obj, QEvent *ev) { w = qobject_cast(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://") + w->text()); -// QString host = url.host(); -// if (!host.endsWith(append, Qt::CaseInsensitive)) -// { -// host += append; -// url.setHost(host); -// } -// -// emit chosenUrl(url, Rekonq::CurrentTab); -// } -// } + 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://") + w->text()); + QString host = url.host(); + if (!host.endsWith(append, Qt::CaseInsensitive)) + { + host += append; + url.setHost(host); + } + + emit chosenUrl(url, Rekonq::CurrentTab); + kev->accept(); + hide(); + return true; + } + } KUrl urlToLoad; Rekonq::OpenType type = Rekonq::CurrentTab; - + if (_currentIndex == -1) _currentIndex = 0; child = findChild(QString::number(_currentIndex)); diff --git a/src/urlbar/completionwidget.h b/src/urlbar/completionwidget.h index bd73584a..2857bacf 100644 --- a/src/urlbar/completionwidget.h +++ b/src/urlbar/completionwidget.h @@ -57,7 +57,7 @@ public: void suggestUrls(const QString &text); KUrl activeSuggestion(); - + private Q_SLOTS: void itemChosen(ListItem *item, Qt::MouseButton = Qt::LeftButton, Qt::KeyboardModifiers = Qt::NoModifier); void updateSuggestionList(const UrlSuggestionList &list, const QString& text); diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index 1bab4ae3..b980cd95 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -217,7 +217,7 @@ void UrlBar::loadTypedUrl() // fallback here urlToLoad = UrlResolver::urlFromTextTyped(text()); - loadRequestedUrl(urlToLoad); + loadRequestedUrl(urlToLoad); } diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h index 48447975..beb1caf4 100644 --- a/src/urlbar/urlbar.h +++ b/src/urlbar/urlbar.h @@ -138,7 +138,7 @@ protected: Q_SIGNALS: void focusIn(); - + private: /** * Updates right icon position, given its number in the right icons list diff --git a/src/urlbar/urlsuggester.cpp b/src/urlbar/urlsuggester.cpp index 7fbb2204..d6aaaf52 100644 --- a/src/urlbar/urlsuggester.cpp +++ b/src/urlbar/urlsuggester.cpp @@ -139,7 +139,7 @@ UrlSuggestionList UrlSuggester::orderedSearchItems() // << QL1S("about:tabs") // << QL1S("about:info") ; - + QStringList aboutUrlResults = aboutUrlList.filter(_typedString, Qt::CaseInsensitive); UrlSuggestionList list; @@ -281,7 +281,7 @@ UrlSuggestionList UrlSuggester::orderLists() list += browseSearch + relevant + _history + _bookmarks; else list += relevant + browseSearch + _history + _bookmarks; - + return list; } @@ -328,7 +328,7 @@ void UrlSuggester::computeWebSearches() { engine = SearchEngine::defaultEngine(); } - + if (engine) { UrlSuggestionItem item = UrlSuggestionItem(UrlSuggestionItem::Search, SearchEngine::buildQuery(engine, query), query, engine->name()); @@ -451,6 +451,6 @@ void UrlSuggester::removeBookmarksDuplicates() _bookmarks.removeOne(item); break; } - } + } } } diff --git a/src/urlbar/urlsuggester.h b/src/urlbar/urlsuggester.h index f3732d91..18b63bd4 100644 --- a/src/urlbar/urlsuggester.h +++ b/src/urlbar/urlsuggester.h @@ -137,7 +137,7 @@ private: void computeBookmarks(); void removeBookmarksDuplicates(); - + UrlSuggestionList orderLists(); QString _typedString; -- cgit v1.2.1