diff options
34 files changed, 215 insertions, 207 deletions
diff --git a/src/adblock/adblockhostmatcher.cpp b/src/adblock/adblockhostmatcher.cpp index 60936ec0..4a1ea443 100644 --- a/src/adblock/adblockhostmatcher.cpp +++ b/src/adblock/adblockhostmatcher.cpp @@ -3,6 +3,7 @@ * This file is a part of the rekonq project * * Copyright (C) 2010-2011 by Benjamin Poulain <ikipou at gmail dot com> +* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com> * * * This program is free software; you can redistribute it and/or @@ -55,13 +56,13 @@ bool AdBlockHostMatcher::tryAddFilter(const QString &filter) if (filter.startsWith(QL1S("@@"))) { QString domain = filter.mid(2); - + if (domain.contains(QL1C('^'))) return false; if (domain.contains(QL1C('$'))) return false; - + if (domain.contains(QL1C('*'))) return false; @@ -77,6 +78,6 @@ bool AdBlockHostMatcher::tryAddFilter(const QString &filter) m_hostList.insert(domain); return true; } - + return false; } diff --git a/src/adblock/adblockhostmatcher.h b/src/adblock/adblockhostmatcher.h index 79918239..9e1b68ef 100644 --- a/src/adblock/adblockhostmatcher.h +++ b/src/adblock/adblockhostmatcher.h @@ -3,6 +3,7 @@ * This file is a part of the rekonq project * * Copyright (C) 2010-2011 by Benjamin Poulain <ikipou at gmail dot com> +* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com> * * * This program is free software; you can redistribute it and/or @@ -48,7 +49,7 @@ public: { m_hostList.clear(); } - + private: QSet<QString> m_hostList; }; diff --git a/src/adblock/adblockmanager.cpp b/src/adblock/adblockmanager.cpp index d5a3e27c..f30a997c 100644 --- a/src/adblock/adblockmanager.cpp +++ b/src/adblock/adblockmanager.cpp @@ -243,7 +243,7 @@ bool AdBlockManager::blockRequest(const QNetworkRequest &request) QStringList whiteRefererList = ReKonfig::whiteReferer(); const QString referer = request.rawHeader("referer"); - Q_FOREACH(const QString &host, whiteRefererList) + Q_FOREACH(const QString & host, whiteRefererList) { if (referer.contains(host)) return false; diff --git a/src/adblock/adblockmanager.h b/src/adblock/adblockmanager.h index 993fa9a7..7f044f3e 100644 --- a/src/adblock/adblockmanager.h +++ b/src/adblock/adblockmanager.h @@ -167,7 +167,7 @@ public: void addCustomRule(const QString &, bool reloadPage = true); bool isAdblockEnabledForHost(const QString &host); - + private: AdBlockManager(QObject *parent = 0); diff --git a/src/application.cpp b/src/application.cpp index 0f15c3e8..9d1e3fea 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -123,13 +123,13 @@ int Application::newInstance() KMessageBox::error(0, i18n("Error"), i18n("Cannot launch webapp mode without an URL to load")); return 1; } - + if (args->count() > 1) { KMessageBox::error(0, i18n("Error"), i18n("Cannot load more than one URL in webapp mode")); return 1; } - + KUrl u = args->url(0); if (!u.isLocalFile() || !QFile::exists(u.toLocalFile())) { @@ -140,7 +140,7 @@ int Application::newInstance() WebTab *tab = newWebApp(); connect(tab->page(), SIGNAL(pageCreated(WebPage *)), this, SLOT(pageCreated(WebPage *))); tab->view()->load(u); - + if (isFirstLoad) { // updating rekonq configuration @@ -156,7 +156,7 @@ int Application::newInstance() isFirstLoad = false; return 0; } - + if (areThereArguments) { kDebug() << "DEFAULT MODE, WITH ARGUMENTS..."; @@ -209,15 +209,14 @@ int Application::newInstance() { loadUrl(urlList.at(0), Rekonq::NewPrivateWindow); } + else if (!ReKonfig::openExternalLinksInNewWindow()) + { + loadUrl(urlList.at(0), Rekonq::NewFocusedTab); + } else - if (!ReKonfig::openExternalLinksInNewWindow()) - { - loadUrl(urlList.at(0), Rekonq::NewFocusedTab); - } - else - { - loadUrl(urlList.at(0), Rekonq::NewWindow); - } + { + loadUrl(urlList.at(0), Rekonq::NewWindow); + } if (!tabWindow()->isActiveWindow()) KWindowSystem::demandAttention(tabWindow()->winId(), true); @@ -291,7 +290,7 @@ int Application::newInstance() else { Rekonq::OpenType type = incognito ? Rekonq::NewPrivateWindow : Rekonq::NewWindow; - + switch (ReKonfig::newTabsBehaviour()) { case 0: // new tab page @@ -397,7 +396,7 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type) newType = Rekonq::CurrentTab; } else if (newType == Rekonq::NewWindow - || ((newType == Rekonq::NewTab || newType == Rekonq::NewFocusedTab) && tabWindowList().count() == 0)) + || ((newType == Rekonq::NewTab || newType == Rekonq::NewFocusedTab) && tabWindowList().count() == 0)) { w = newTabWindow(); newType = Rekonq::CurrentTab; @@ -476,7 +475,7 @@ bool Application::eventFilter(QObject* watched, QEvent* event) WebTab *webApp = qobject_cast<WebTab*>(watched); m_webApps.removeOne(webApp); - + if (m_tabWindows.count() == 0 && m_webApps.count() == 0) quit(); } @@ -618,9 +617,9 @@ void Application::queryQuit() if (m_webApps.count() > 0) { tabWindow()->close(); - return; + return; } - + if (tabWindowList().count() > 1) { int answer = KMessageBox::questionYesNoCancel( @@ -768,7 +767,7 @@ void Application::createWebAppShortcut() QString webAppDescription; if (!wAppWidget.descriptionLineEdit->text().isEmpty()) webAppDescription = wAppWidget.descriptionLineEdit->text(); - + QString shortcutString = QL1S("#!/usr/bin/env xdg-open\n") + QL1S("[Desktop Entry]\n") + QL1S("Name=") + webAppTitle diff --git a/src/application.h b/src/application.h index d5165a55..a80c9fa3 100644 --- a/src/application.h +++ b/src/application.h @@ -93,7 +93,7 @@ public Q_SLOTS: TabWindow *newTabWindow(bool withTab = true, bool PrivateBrowsingMode = false); WebTab *newWebApp(); - + protected: // This is used to track which window was activated most recently bool eventFilter(QObject *watched, QEvent *event); @@ -114,7 +114,7 @@ private Q_SLOTS: void newPrivateBrowsingWindow(); void pageCreated(WebPage *); - + private: TabWindowList m_tabWindows; WebAppList m_webApps; diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp index 54a34b36..20a602a6 100644 --- a/src/bookmarks/bookmarkowner.cpp +++ b/src/bookmarks/bookmarkowner.cpp @@ -249,7 +249,7 @@ KBookmarkGroup BookmarkOwner::newBookmarkFolder(const KBookmark &bookmark, const folderName = i18n("New folder"); else folderName = name; - + if (!bookmark.isNull()) { if (bookmark.isGroup()) diff --git a/src/main.cpp b/src/main.cpp index 8507aa0e..7874e84b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -57,7 +57,7 @@ extern "C" KDE_EXPORT int kdemain(int argc, char **argv) "http://rekonq.kde.org" ); - + // --------------- about authors ----------------------------- about.addAuthor(ki18n("Andrea Diamantini"), ki18n("Project Lead, Developer, Maintainer"), @@ -114,7 +114,7 @@ extern "C" KDE_EXPORT int kdemain(int argc, char **argv) "lindsay.mathieson@gmail.com", ""); - + // --------------- about credits ----------------------------- about.addCredit(ki18n("Dawit Alemayehu"), ki18n("KDEWebKit (main) developer. And KIO. And KUriFilter. And more.."), @@ -186,7 +186,7 @@ extern "C" KDE_EXPORT int kdemain(int argc, char **argv) "pino@kde.org", ""); - + // Initialize command line args KCmdLineArgs::init(argc, argv, &about); diff --git a/src/rekonqpage/newtabpage.cpp b/src/rekonqpage/newtabpage.cpp index 90bba3b6..2d06f1dc 100644 --- a/src/rekonqpage/newtabpage.cpp +++ b/src/rekonqpage/newtabpage.cpp @@ -92,7 +92,7 @@ void NewTabPage::generate(const KUrl &url) QWebPage *pg = parentFrame->page(); WebView *view = qobject_cast<WebView *>(pg->parent()); WebTab *tab = qobject_cast<WebTab *>(view->parent()); - + // about:preview links if (KUrl("about:settings").isParentOf(url)) { @@ -178,38 +178,38 @@ void NewTabPage::generate(const KUrl &url) // { // const int winIndex = url.queryItem(QL1S("win")).toInt(); // const int tabIndex = url.queryItem(QL1S("tab")).toInt(); -// +// // MainWindow *w = rApp->mainWindowList().at(winIndex).data(); -// +// // // close about:tabs tab // rApp->mainWindow()->mainView()->closeTab(rApp->mainWindow()->mainView()->currentIndex()); -// +// // // show requested tab // w->mainView()->setCurrentIndex(tabIndex); // if (w != rApp->mainWindow()) // w->raise(); // return; // } -// +// // if (url.fileName() == QL1S("remove")) // { // const int winIndex = url.queryItem(QL1S("win")).toInt(); // const int tabIndex = url.queryItem(QL1S("tab")).toInt(); -// +// // MainWindow *w = rApp->mainWindowList().at(winIndex).data(); // w->mainView()->closeTab(tabIndex); // loadPageForUrl(KUrl("about:tabs")); // return; // } // } -// +// // // about:closedTabs links // if (KUrl("about:closedTabs").isParentOf(url)) // { // if (url.fileName() == QL1S("restore")) // { // const int tabIndex = url.queryItem(QL1S("tab")).toInt(); -// +// // rApp->mainWindow()->mainView()->restoreClosedTab(tabIndex, false); // return; // } @@ -579,32 +579,32 @@ void NewTabPage::bookmarksPage() // void NewTabPage::closedTabsPage() // { // m_root.addClass(QL1S("closedTabs")); -// +// // QList<TabHistory> links = rApp->mainWindow()->mainView()->recentlyClosedTabs(); -// +// // if (links.isEmpty()) // { // m_root.addClass(QL1S("empty")); // m_root.setPlainText(i18n("There are no recently closed tabs")); // return; // } -// +// // for (int i = 0; i < links.count(); ++i) // { // TabHistory item = links.at(i); // QWebElement prev; -// +// // if (item.url.isEmpty()) // continue; -// +// // prev = closedTabPreview(i, item.url, item.title); -// +// // prev.setAttribute(QL1S("id"), QL1S("preview") + QVariant(i).toString()); -// +// // // hide controls // prev.findFirst(QL1S(".right")).setStyleProperty(QL1S("visibility"), QL1S("hidden")); // prev.findFirst(QL1S(".left")).setStyleProperty(QL1S("visibility"), QL1S("hidden")); -// +// // m_root.appendInside(prev); // } // } @@ -737,20 +737,20 @@ void NewTabPage::downloadsPage(const QString & filter) // void NewTabPage::tabsPage() // { // m_root.addClass(QL1S("tabs")); -// +// // int wins = 0; // Q_FOREACH(const QWeakPointer<MainWindow> &wPointer, rApp->mainWindowList()) // { // m_root.appendInside(markup(QL1S("h3"))); // m_root.lastChild().setPlainText(i18n("Window")); -// +// // MainWindow *w = wPointer.data(); -// +// // const int tabCount = w->mainView()->count(); // for (int i = 0; i < tabCount; ++i) // { // KUrl url = w->mainView()->webTab(i)->url(); -// +// // if (!WebSnap::existsImage(url)) // { // kDebug() << "image doesn't exist for url: " << url; @@ -760,12 +760,12 @@ void NewTabPage::downloadsPage(const QString & filter) // } // QString name = w->mainView()->webTab(i)->view()->title(); // QWebElement prev; -// +// // prev = tabPreview(wins, i, url, name); -// +// // m_root.appendInside(prev); // } -// +// // wins++; // } // } diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp index 08f576a4..850a709e 100644 --- a/src/sessionmanager.cpp +++ b/src/sessionmanager.cpp @@ -122,7 +122,7 @@ int loadTabs(TabWindow *tw, QDomElement & window, bool useFirstTab, bool justThe bool areTherePinnedTabs(QDomElement & window) { bool b = false; - + for (unsigned int tabNo = 0; tabNo < window.elementsByTagName("tab").length(); tabNo++) { QDomElement tab = window.elementsByTagName("tab").at(tabNo).toElement(); diff --git a/src/tabwindow/rekonqwindow.cpp b/src/tabwindow/rekonqwindow.cpp index e1f54f28..afebf79c 100644 --- a/src/tabwindow/rekonqwindow.cpp +++ b/src/tabwindow/rekonqwindow.cpp @@ -226,7 +226,7 @@ void RekonqWindow::restoreWindowSize(const KConfigGroup & _cg) { QSize defaultSize = desktopRect.size() * 0.8; resize(defaultSize); - + move((desktopRect.width() - width()) / 2, (desktopRect.height() - height()) / 2); } @@ -405,7 +405,7 @@ void RekonqWindow::checkPosition() // no need to check trivial positions... if (isMaximized()) return; - + QList<RekonqWindow*> wList = RekonqWindow::windowList(); int wNumber = wList.count(); @@ -434,7 +434,7 @@ void RekonqWindow::checkPosition() break; case 1: // right top - move(0,0); + move(0, 0); break; default: kDebug() << "OOPS...THIS SHOULD NEVER HAPPEN!!"; diff --git a/src/tabwindow/rekonqwindow.h b/src/tabwindow/rekonqwindow.h index 1c543ce2..ed018e4a 100644 --- a/src/tabwindow/rekonqwindow.h +++ b/src/tabwindow/rekonqwindow.h @@ -89,7 +89,7 @@ public: int insertTab(int index, QWidget *page, const QString &label); int insertTab(int index, QWidget *page, const QIcon &icon, const QString &label); // -------------------------------------------------------------------------------------- - + protected: /** * Save your instance-specific properties. The function is diff --git a/src/tabwindow/tabbar.cpp b/src/tabwindow/tabbar.cpp index aaf18dc7..24494f15 100644 --- a/src/tabwindow/tabbar.cpp +++ b/src/tabwindow/tabbar.cpp @@ -109,14 +109,14 @@ QSize TabBar::tabSizeHint(int index) const } } } - + int h = size().height(); // this because it may happen sometimes (eg: exiting fullscreen) // that tabbar height is set to ZERO. And this is NOT good... if (h == 0) h = 30; - + QSize ts = QSize(w, h); return ts; } @@ -351,7 +351,7 @@ void TabBar::tabInserted(int index) TabWindow *w = qobject_cast<TabWindow *>(parent()); w->moveTab(index, availableIndex); } - + KTabBar::tabInserted(index); } @@ -425,14 +425,14 @@ void TabBar::mouseReleaseEvent(QMouseEvent *event) { // count pinned tabs int pinnedTabs = 0; - for(int i = 0; i < count(); i++) + for (int i = 0; i < count(); i++) { if (tabData(i).toBool()) - pinnedTabs++; + pinnedTabs++; } // fix unpinned ones - for(int i = 0; i < pinnedTabs; i++) + for (int i = 0; i < pinnedTabs; i++) { if (!tabData(i).toBool()) { @@ -448,7 +448,7 @@ void TabBar::mouseReleaseEvent(QMouseEvent *event) if (tabData(i).toBool()) { TabWindow *w = qobject_cast<TabWindow *>(parent()); - w->moveTab(i, pinnedTabs - 1); + w->moveTab(i, pinnedTabs - 1); w->setCurrentIndex(pinnedTabs - 1); } } @@ -522,7 +522,7 @@ void TabBar::pinTab() KAction *a = qobject_cast<KAction *>(sender()); if (!a) return; - + int index = a->data().toInt(); // Find the available index to move @@ -539,7 +539,7 @@ void TabBar::pinTab() TabWindow *w = qobject_cast<TabWindow *>(parent()); w->moveTab(index, availableIndex); index = availableIndex; - + // set this tab data true to know this has been pinned setTabData(index, true); @@ -550,7 +550,7 @@ void TabBar::pinTab() QLabel *label = qobject_cast<QLabel* >(tabButton(index, QTabBar::LeftSide)); if (!label) label = new QLabel(this); - + setTabButton(index, QTabBar::LeftSide, 0); setTabButton(index, QTabBar::LeftSide, label); @@ -586,7 +586,7 @@ void TabBar::unpinTab() TabWindow *w = qobject_cast<TabWindow *>(parent()); w->moveTab(index, availableIndex); index = availableIndex; - + tabButton(index, QTabBar::RightSide)->show(); setTabText(index, w->webWindow(index)->title()); diff --git a/src/tabwindow/tabbar.h b/src/tabwindow/tabbar.h index b325eab8..c27b238f 100644 --- a/src/tabwindow/tabbar.h +++ b/src/tabwindow/tabbar.h @@ -64,7 +64,7 @@ protected: virtual void tabInserted(int index); virtual void tabRemoved(int index); - + virtual void tabLayoutChange(); Q_SIGNALS: @@ -84,7 +84,7 @@ private Q_SLOTS: void pinTab(); void unpinTab(); - + void contextMenu(int, const QPoint &); void emptyAreaContextMenu(const QPoint &); @@ -92,7 +92,7 @@ private Q_SLOTS: void showTabPreview(); void hideTabPreview(); - + private: // highlightAnimation TabHighlightEffect *m_tabHighlightEffect; diff --git a/src/tabwindow/tabwindow.cpp b/src/tabwindow/tabwindow.cpp index e1d239a7..59aa1275 100644 --- a/src/tabwindow/tabwindow.cpp +++ b/src/tabwindow/tabwindow.cpp @@ -97,7 +97,7 @@ TabWindow::TabWindow(WebPage *pg, QWidget *parent) , _ac(new KActionCollection(this)) { init(); - + WebWindow *tab = prepareNewTab(pg); addTab(tab, i18n("new tab")); setCurrentWidget(tab); @@ -170,7 +170,7 @@ void TabWindow::init() _addTabButton->raise(); _addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); - connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int))); + connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int))); } @@ -185,7 +185,7 @@ KActionCollection *TabWindow::actionCollection() const QAction *TabWindow::actionByName(const QString &name) { - return actionCollection()->action(name); + return actionCollection()->action(name); } @@ -230,7 +230,7 @@ WebWindow *TabWindow::prepareNewTab(WebPage *page) connect(tab, SIGNAL(pageCreated(WebPage *)), this, SLOT(pageCreated(WebPage *))); connect(tab, SIGNAL(setFullScreen(bool)), this, SLOT(setFullScreen(bool))); - + return tab; } @@ -283,7 +283,7 @@ void TabWindow::newTab(WebPage *page) // no need to load an url if we already have a page... if (page) return; - + switch (ReKonfig::newTabsBehaviour()) { case 0: // new tab page @@ -450,7 +450,7 @@ void TabWindow::tabLoadFinished(bool ok) movie->stop(); delete movie; } - + label->setMovie(0); KIcon ic = IconManager::self()->iconForUrl(tab->url()); @@ -514,7 +514,7 @@ void TabWindow::closeTab(int index, bool del) history.title = tabToClose->title(); history.url = tabToClose->url().url(); history.position = index; - + m_recentlyClosedTabs.removeAll(history); if (m_recentlyClosedTabs.count() == recentlyClosedTabsLimit) m_recentlyClosedTabs.removeLast(); @@ -623,7 +623,7 @@ void TabWindow::reloadAllTabs() void TabWindow::bookmarkAllTabs() { KBookmarkGroup rGroup = BookmarkManager::self()->rootGroup(); - KBookmarkGroup folderGroup = rGroup.createNewFolder( i18n("Bookmarked tabs: ") + QDate::currentDate().toString()); + KBookmarkGroup folderGroup = rGroup.createNewFolder(i18n("Bookmarked tabs: ") + QDate::currentDate().toString()); for (int i = 0; i < count(); ++i) { WebWindow *tab = webWindow(i); @@ -642,7 +642,7 @@ void TabWindow::restoreLastClosedTab() QUrl u = QUrl(history.url); int restorePosition = history.position; - + WebWindow *tab = prepareNewTab(); if (restorePosition < count()) @@ -663,10 +663,10 @@ void TabWindow::setFullScreen(bool makeFullScreen) { tabBar()->setVisible(!makeFullScreen); _addTabButton->setVisible(!makeFullScreen); - + KToggleFullScreenAction::setFullScreen(this, makeFullScreen); - for(int i = 0; i < count(); i++) + for (int i = 0; i < count(); i++) webWindow(i)->setWidgetsHidden(makeFullScreen); } diff --git a/src/tabwindow/tabwindow.h b/src/tabwindow/tabwindow.h index fc2cc4de..4da4f213 100644 --- a/src/tabwindow/tabwindow.h +++ b/src/tabwindow/tabwindow.h @@ -76,7 +76,7 @@ public: public Q_SLOTS: void loadUrl(const KUrl &, Rekonq::OpenType type = Rekonq::CurrentTab, TabHistory *history = 0); void newTab(WebPage *page = 0); - + private: /** * Prepares the new WebWindow to be open @@ -84,7 +84,7 @@ private: WebWindow *prepareNewTab(WebPage *page = 0); void init(); - + private Q_SLOTS: /** * Updates new tab button position @@ -113,7 +113,7 @@ private Q_SLOTS: void restoreLastClosedTab(); void setFullScreen(bool); - + private: // the new tab button QToolButton *_addTabButton; 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<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://") + 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<ListItem *>(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; diff --git a/src/webtab/networkaccessmanager.cpp b/src/webtab/networkaccessmanager.cpp index ce10e10d..95bfa47d 100644 --- a/src/webtab/networkaccessmanager.cpp +++ b/src/webtab/networkaccessmanager.cpp @@ -181,5 +181,5 @@ void NetworkAccessManager::slotFinished(bool ok) collection += frame->parentFrame()->findAllElements(HIDABLE_ELEMENTS); Q_FOREACH(const QUrl & url, urls) - hideBlockedElements(url, collection); + hideBlockedElements(url, collection); } diff --git a/src/webtab/webpage.cpp b/src/webtab/webpage.cpp index ca2a23b2..171e7113 100644 --- a/src/webtab/webpage.cpp +++ b/src/webtab/webpage.cpp @@ -297,9 +297,11 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r // Make sure nothing is cached when private browsing mode is enabled... if (settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) { - if (manager) { + if (manager) + { KIO::Integration::CookieJar *cookieJar = manager ? qobject_cast<KIO::Integration::CookieJar*>(manager->cookieJar()) : 0; - if (cookieJar) { + if (cookieJar) + { cookieJar->setDisableCookieStorage(true); kDebug() << "COOKIE DISABLED -------------------------------------------------------------"; } @@ -308,15 +310,17 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r } else { - if (manager) { + if (manager) + { KIO::Integration::CookieJar *cookieJar = manager ? qobject_cast<KIO::Integration::CookieJar*>(manager->cookieJar()) : 0; - if (cookieJar) { + if (cookieJar) + { cookieJar->setDisableCookieStorage(false); } } removeSessionMetaData(QL1S("no-cache")); } - + return KWebPage::acceptNavigationRequest(frame, request, type); } @@ -376,12 +380,12 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) return; } - DownloadManager::self()->downloadResource( reply->url(), - KIO::MetaData(), - view(), - false, - _suggestedFileName, - !settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); + DownloadManager::self()->downloadResource(reply->url(), + KIO::MetaData(), + view(), + false, + _suggestedFileName, + !settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); return; } @@ -397,12 +401,12 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) return; } - DownloadManager::self()->downloadResource( reply->url(), - KIO::MetaData(), - view(), - false, - _suggestedFileName, - !settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); + DownloadManager::self()->downloadResource(reply->url(), + KIO::MetaData(), + view(), + false, + _suggestedFileName, + !settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); return; } @@ -428,12 +432,12 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) switch (dlg.askEmbedOrSave()) { case KParts::BrowserOpenOrSaveQuestion::Save: - DownloadManager::self()->downloadResource( reply->url(), - KIO::MetaData(), - view(), - !hideDialog, - _suggestedFileName, - !settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); + DownloadManager::self()->downloadResource(reply->url(), + KIO::MetaData(), + view(), + !hideDialog, + _suggestedFileName, + !settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); return; case KParts::BrowserOpenOrSaveQuestion::Cancel: @@ -617,7 +621,7 @@ QString WebPage::errorPage(QNetworkReply *reply) QString msg; // test to see if networking is enabled on the system - if(Solid::Networking::status() != Solid::Networking::Connected) + if (Solid::Networking::status() != Solid::Networking::Connected) { msg += QL1S("<h2>") + i18n("Network is NOT available") + QL1S("</h2>"); @@ -629,8 +633,8 @@ QString WebPage::errorPage(QNetworkReply *reply) msg += QL1S("<p>"); - msg += i18n("Maybe you are having problems with your network settings.<br />Try checking your <a href=\"%1\">network connections</a>, your <a href=\"%2\">proxy settings</a> and your <a href=\"%3\">firewall</a>.<br /><br />Then <a href=\"%4\">try again</a>.<br />",QL1S("about:settings/network"), QL1S("about:settings/proxy"),QL1S("about:settings/firewall"), urlString ); - + msg += i18n("Maybe you are having problems with your network settings.<br />Try checking your <a href=\"%1\">network connections</a>, your <a href=\"%2\">proxy settings</a> and your <a href=\"%3\">firewall</a>.<br /><br />Then <a href=\"%4\">try again</a>.<br />", QL1S("about:settings/network"), QL1S("about:settings/proxy"), QL1S("about:settings/firewall"), urlString); + msg += QL1S("</p>"); msg += QL1S("</td></tr></table>"); @@ -694,23 +698,23 @@ QString WebPage::errorPage(QNetworkReply *reply) void WebPage::downloadRequest(const QNetworkRequest &request) { - DownloadManager::self()->downloadResource( request.url(), - request.attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)).toMap(), - view(), - false, - _suggestedFileName, - !settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); + DownloadManager::self()->downloadResource(request.url(), + request.attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)).toMap(), + view(), + false, + _suggestedFileName, + !settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); } void WebPage::downloadUrl(const KUrl &url) { - DownloadManager::self()->downloadResource( url, - KIO::MetaData(), - view(), - false, - QString(), - !settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); + DownloadManager::self()->downloadResource(url, + KIO::MetaData(), + view(), + false, + QString(), + !settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); } diff --git a/src/webtab/webpage.h b/src/webtab/webpage.h index 96cc5634..0ce95ae1 100644 --- a/src/webtab/webpage.h +++ b/src/webtab/webpage.h @@ -53,7 +53,7 @@ public: ~WebPage(); void setWindow(QWidget *); - + bool isOnRekonqPage() const; void setIsOnRekonqPage(bool b); diff --git a/src/webtab/webtab.cpp b/src/webtab/webtab.cpp index 2622a96a..1d80198c 100644 --- a/src/webtab/webtab.cpp +++ b/src/webtab/webtab.cpp @@ -86,15 +86,15 @@ WebTab::WebTab(QWidget *parent) // NOTE: this line of code moves the web inspector in the usual position, // BUT my wife prefers it on the right part. Following hint about. - // Let's hear people comments about... + // Let's hear people comments about... // m_splitter->setOrientation(Qt::Vertical); - + l->addWidget(m_splitter); // fix focus handling setFocusProxy(view()); - + KWebWallet *wallet = page()->wallet(); if (wallet) @@ -116,7 +116,7 @@ WebTab::WebTab(QWidget *parent) connect(view(), SIGNAL(titleChanged(QString)), this, SLOT(webAppTitleChanged(QString))); connect(view(), SIGNAL(iconChanged()), this, SLOT(webAppIconChanged())); } - + // Session Manager connect(view(), SIGNAL(loadFinished(bool)), SessionManager::self(), SLOT(saveSession())); } @@ -306,7 +306,7 @@ void WebTab::setPart(KParts::ReadOnlyPart *p, const KUrl &u) void WebTab::showCrashMessageBar() { CrashMessageBar *msgBar = new CrashMessageBar(i18n("It seems rekonq was not closed properly. Do you want " - "to restore the last saved session?"), this); + "to restore the last saved session?"), this); qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, msgBar); msgBar->animatedShow(); @@ -383,9 +383,9 @@ void WebTab::zoomIn() emit infoToShow(i18n("Max zoom reached: ") + QString::number(m_zoomFactor * 10) + QL1S("%")); return; } - + if (m_zoomFactor >= 20) - m_zoomFactor+=5; + m_zoomFactor += 5; else m_zoomFactor++; @@ -451,9 +451,9 @@ void WebTab::toggleInspector(bool on) m_inspector.data()->show(); return; - } + } // else - + m_inspector.data()->hide(); page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, on); diff --git a/src/webtab/webtab.h b/src/webtab/webtab.h index 75f975d8..d016e6b2 100644 --- a/src/webtab/webtab.h +++ b/src/webtab/webtab.h @@ -105,7 +105,7 @@ private Q_SLOTS: void webAppIconChanged(); void toggleInspector(bool); - + Q_SIGNALS: void loadProgressing(); void titleChanged(const QString &); @@ -113,7 +113,7 @@ Q_SIGNALS: void triggerPartPrint(); void infoToShow(QString); - + private: WebView *m_webView; @@ -122,7 +122,7 @@ private: QWeakPointer<WalletBar> m_walletBar; QWeakPointer<PreviewSelectorBar> m_previewSelectorBar; QWeakPointer<QWebInspector> m_inspector; - + KParts::ReadOnlyPart *m_part; int m_zoomFactor; diff --git a/src/webtab/webview.cpp b/src/webtab/webview.cpp index fa2676e0..e61c1986 100644 --- a/src/webtab/webview.cpp +++ b/src/webtab/webview.cpp @@ -167,7 +167,7 @@ void WebView::setPage(WebPage *pg) WebWindow *w = m_parentTab->webWindow(); if (w && w->window()) pg->setWindow(w->window()); -} +} bool WebView::popupSpellMenu(QContextMenuEvent *event) @@ -274,7 +274,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) if (popupSpellMenu(event)) return; } - + WebWindow *webwin = m_parentTab->webWindow(); KMenu menu(this); @@ -374,7 +374,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) a->setData(m_contextMenuHitResult.linkUrl()); connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewTab())); menu.addAction(a); - + a = new KAction(KIcon("window-new"), i18n("Open in New &Window"), &menu); a->setData(m_contextMenuHitResult.linkUrl()); connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewWindow())); @@ -387,7 +387,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInPrivateWindow())); menu.addAction(a); } - + menu.addSeparator(); // Don't show dots if we are NOT going to ask for download path @@ -541,7 +541,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) menu.addAction(a); } } - + menu.addAction(sendByMailAction); if (webwin) @@ -1495,10 +1495,10 @@ void WebView::saveImage() KAction *a = qobject_cast<KAction*>(sender()); KUrl imageUrl(a->data().toUrl()); - DownloadManager::self()->downloadResource( imageUrl, - KIO::MetaData(), - this, - true, - QString(), - !settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); + DownloadManager::self()->downloadResource(imageUrl, + KIO::MetaData(), + this, + true, + QString(), + !settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); } diff --git a/src/webtab/webview.h b/src/webtab/webview.h index 161d8c65..9d3a16dc 100644 --- a/src/webtab/webview.h +++ b/src/webtab/webview.h @@ -70,7 +70,7 @@ public: void setPage(WebPage *); WebTab *parentTab(); - + void load(const QUrl &url); void load(const QNetworkRequest &req, QNetworkAccessManager::Operation op = QNetworkAccessManager::GetOperation, diff --git a/src/webwindow/rekonqfactory.cpp b/src/webwindow/rekonqfactory.cpp index 9de9e367..60ba3872 100644 --- a/src/webwindow/rekonqfactory.cpp +++ b/src/webwindow/rekonqfactory.cpp @@ -76,7 +76,7 @@ QAction *actionByName(const QString &name) // NOTE: last action collection created is surely the one interests us more! // So let's start from the end... int lac_count = lac.count(); - for(int i = lac_count - 1; i>=0; i--) + for (int i = lac_count - 1; i >= 0; i--) { KActionCollection *ac = lac.at(i); QAction *a = ac->action(name); diff --git a/src/webwindow/rekonqmenu.cpp b/src/webwindow/rekonqmenu.cpp index a89d883e..4ea01708 100644 --- a/src/webwindow/rekonqmenu.cpp +++ b/src/webwindow/rekonqmenu.cpp @@ -54,10 +54,10 @@ void RekonqMenu::showEvent(QShowEvent* event) int w = width(); QWidget *parentWidget = qobject_cast<QWidget *>(parent()); - QPoint widgetGlobalPos = parentWidget->mapToGlobal(QPoint(0,0)); + QPoint widgetGlobalPos = parentWidget->mapToGlobal(QPoint(0, 0)); int pw = parentWidget->width(); int px = widgetGlobalPos.x(); - + QPoint newPosition = QPoint(px + pw - w, y); // Finally, move it there... diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp index 35c6aed9..616ccc69 100644 --- a/src/webwindow/webwindow.cpp +++ b/src/webwindow/webwindow.cpp @@ -128,7 +128,7 @@ WebWindow::WebWindow(QWidget *parent, WebPage *pg) connect(_tab->view(), SIGNAL(loadProgress(int)), this, SLOT(webLoadProgress(int))); connect(_bar, SIGNAL(focusIn()), this, SLOT(urlbarFocused())); - + // page signals connect(page(), SIGNAL(pageCreated(WebPage *)), this, SIGNAL(pageCreated(WebPage *))); @@ -140,7 +140,7 @@ WebWindow::WebWindow(QWidget *parent, WebPage *pg) connect(m_hidePopupTimer, SIGNAL(timeout()), m_popup, SLOT(hide())); connect(_tab->page(), SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(notifyMessage(QString))); connect(_tab, SIGNAL(infoToShow(QString)), this, SLOT(notifyMessage(QString))); - + updateHistoryActions(); if (parent && parent->isFullScreen()) @@ -246,7 +246,7 @@ void WebWindow::setupActions() KStandardAction::findNext(m_findBar, SLOT(findNext()), actionCollection()); KStandardAction::findPrev(m_findBar, SLOT(findPrevious()), actionCollection()); - + a = KStandardAction::redisplay(_tab->view(), SLOT(reload()), actionCollection()); a->setText(i18n("Reload")); KShortcut reloadShortcut = KStandardShortcut::reload(); @@ -406,8 +406,8 @@ void WebWindow::webLoadFinished(bool b) m_loadStopReloadAction->setText(i18n("Reload")); connect(m_loadStopReloadAction, SIGNAL(triggered(bool)), _tab->view(), SLOT(reload())); } - - updateHistoryActions(); + + updateHistoryActions(); } @@ -415,7 +415,7 @@ void WebWindow::urlbarFocused() { m_loadStopReloadAction->setIcon(KIcon("go-jump-locationbar")); m_loadStopReloadAction->setToolTip(i18n("Go")); - m_loadStopReloadAction->setText(i18n("Go")); + m_loadStopReloadAction->setText(i18n("Go")); connect(m_loadStopReloadAction, SIGNAL(triggered(bool)), _bar, SLOT(loadTypedUrl())); } @@ -933,19 +933,19 @@ void WebWindow::checkFocus() void WebWindow::openDownloadsPage() { - rApp->loadUrl( QUrl("about:downloads"), Rekonq::NewFocusedTab ); + rApp->loadUrl(QUrl("about:downloads"), Rekonq::NewFocusedTab); } void WebWindow::openHistoryPage() { - rApp->loadUrl( QUrl("about:history"), Rekonq::NewFocusedTab ); + rApp->loadUrl(QUrl("about:history"), Rekonq::NewFocusedTab); } void WebWindow::openBookmarksPage() { - rApp->loadUrl( QUrl("about:bookmarks"), Rekonq::NewFocusedTab ); + rApp->loadUrl(QUrl("about:bookmarks"), Rekonq::NewFocusedTab); } diff --git a/src/webwindow/webwindow.h b/src/webwindow/webwindow.h index ce71e7b9..3f7fcc54 100644 --- a/src/webwindow/webwindow.h +++ b/src/webwindow/webwindow.h @@ -93,7 +93,7 @@ private: public Q_SLOTS: void setWidgetsHidden(bool hide); void setPrivateBrowsing(bool); - + private Q_SLOTS: void webLoadProgress(int); void webLoadStarted(); @@ -131,7 +131,7 @@ private Q_SLOTS: void openHistoryPage(); void openBookmarksPage(); void openHomePage(Qt::MouseButtons, Qt::KeyboardModifiers); - + // Tools Menu slots void viewPageSource(); |