diff options
-rw-r--r-- | scripts/cppcheck.sh | 39 | ||||
-rw-r--r-- | src/adblock/adblockmanager.cpp | 14 | ||||
-rw-r--r-- | src/application.cpp | 2 | ||||
-rw-r--r-- | src/bookmarks/bookmarksmanager.cpp | 2 | ||||
-rw-r--r-- | src/clicktoflash.cpp | 6 | ||||
-rw-r--r-- | src/history/historymodels.cpp | 2 | ||||
-rw-r--r-- | src/history/historypanel.cpp | 2 | ||||
-rw-r--r-- | src/mainview.cpp | 2 | ||||
-rw-r--r-- | src/mainwindow.cpp | 80 | ||||
-rw-r--r-- | src/tabbar.cpp | 18 | ||||
-rw-r--r-- | src/urlbar/urlbar.cpp | 10 | ||||
-rw-r--r-- | src/webpage.cpp | 2 | ||||
-rw-r--r-- | src/webview.cpp | 6 |
13 files changed, 112 insertions, 73 deletions
diff --git a/scripts/cppcheck.sh b/scripts/cppcheck.sh new file mode 100644 index 00000000..be081040 --- /dev/null +++ b/scripts/cppcheck.sh @@ -0,0 +1,39 @@ +#!/bin/sh +# +# apply rekonq coding style to all cpp and header files in src directory +# +# requirements: installed astyle +# +# rekonq use kdelibs coding style, except for brackets, so while kdelibs coding style +# is +# +# void foo() { +# ... +# } +# +# rekonq uses +# +# void foo() +# { +# ... +# } +# +# I like this way, for me more readable. :) +# +# Kdelibs coding style is defined in http://techbase.kde.org/Policies/Kdelibs_Coding_Style + + +PWD=$(pwd) + +cd $PWD +cd .. +cd src + +echo "cppcheck(ing)..." +cppcheck \ +--enable=all \ +--force \ +--verbose \ +. 2>/tmp/cppcheck.out + +echo "DONE. read output in /tmp/cppcheck.out" diff --git a/src/adblock/adblockmanager.cpp b/src/adblock/adblockmanager.cpp index 70923d7d..e195c705 100644 --- a/src/adblock/adblockmanager.cpp +++ b/src/adblock/adblockmanager.cpp @@ -127,7 +127,7 @@ void AdBlockManager::loadRules(const QStringList &rules) continue; // white rules - if (stringRule.startsWith(QLatin1String("@@"))) + if (stringRule.startsWith(QL1S("@@"))) { AdBlockRule rule(stringRule.mid(2)); _whiteList << rule; @@ -135,7 +135,7 @@ void AdBlockManager::loadRules(const QStringList &rules) } // hide (CSS) rules - if (stringRule.startsWith(QLatin1String("##"))) + if (stringRule.startsWith(QL1S("##"))) { _hideList << stringRule.mid(2); continue; @@ -153,7 +153,7 @@ QNetworkReply *AdBlockManager::block(const QNetworkRequest &request, WebPage *pa return 0; // we (ad)block just http traffic - if (request.url().scheme() != QLatin1String("http")) + if (request.url().scheme() != QL1S("http")) return 0; QString urlString = request.url().toString(); @@ -186,9 +186,9 @@ QNetworkReply *AdBlockManager::block(const QNetworkRequest &request, WebPage *pa if (filter.match(el.attribute("src"))) { kDebug() << "MATCHES ATTRIBUTE!!!!!"; - el.setStyleProperty(QLatin1String("visibility"), QLatin1String("hidden")); - el.setStyleProperty(QLatin1String("width"), QLatin1String("0")); - el.setStyleProperty(QLatin1String("height"), QLatin1String("0")); + el.setStyleProperty(QL1S("visibility"), QL1S("hidden")); + el.setStyleProperty(QL1S("width"), QL1S("0")); + el.setStyleProperty(QL1S("height"), QL1S("0")); } } @@ -225,7 +225,7 @@ void AdBlockManager::applyHidingRules(WebPage *page) if (el.isNull()) continue; kDebug() << "Hide element: " << el.localName(); - el.setStyleProperty(QLatin1String("visibility"), QLatin1String("hidden")); + el.setStyleProperty(QL1S("visibility"), QL1S("hidden")); el.removeFromDocument(); } } diff --git a/src/application.cpp b/src/application.cpp index 02ceed4b..b1419d00 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -381,7 +381,7 @@ void Application::loadResolvedUrl(ThreadWeaver::Job *job) // we are sure of the url now, let's add it to history // anyway we store here just http sites because local and ftp ones are // added trough the protocol handler and the other are ignored - if (url.protocol() == QLatin1String("http") || url.protocol() == QLatin1String("https")) + if (url.protocol() == QL1S("http") || url.protocol() == QL1S("https")) historyManager()->addHistoryEntry(url.prettyUrl()); } } diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp index 8a46ef44..73127257 100644 --- a/src/bookmarks/bookmarksmanager.cpp +++ b/src/bookmarks/bookmarksmanager.cpp @@ -137,7 +137,7 @@ BookmarkMenu::BookmarkMenu(KBookmarkManager *manager, : KBookmarkMenu(manager, owner, menu, actionCollection) { KAction *a = KStandardAction::addBookmark(this, SLOT(slotAddBookmark()), this); - actionCollection->addAction(QLatin1String("rekonq_add_bookmark"), a); + actionCollection->addAction(QL1S("rekonq_add_bookmark"), a); refill(); } diff --git a/src/clicktoflash.cpp b/src/clicktoflash.cpp index e3e86f8c..e9174470 100644 --- a/src/clicktoflash.cpp +++ b/src/clicktoflash.cpp @@ -74,7 +74,7 @@ void ClickToFlash::load() if (!view) return; - const QString selector = QLatin1String("%1[type=\"application/x-shockwave-flash\"]"); + const QString selector = QL1S("%1[type=\"application/x-shockwave-flash\"]"); hide(); @@ -86,8 +86,8 @@ void ClickToFlash::load() QWebElement docElement = frame->documentElement(); QWebElementCollection elements; - elements.append(docElement.findAll(selector.arg(QLatin1String("object")))); - elements.append(docElement.findAll(selector.arg(QLatin1String("embed")))); + elements.append(docElement.findAll(selector.arg(QL1S("object")))); + elements.append(docElement.findAll(selector.arg(QL1S("embed")))); foreach(QWebElement element, elements) { diff --git a/src/history/historymodels.cpp b/src/history/historymodels.cpp index 887a6f5c..e68eac42 100644 --- a/src/history/historymodels.cpp +++ b/src/history/historymodels.cpp @@ -696,7 +696,7 @@ QVariant HistoryTreeModel::data(const QModelIndex &index, int role) const QDate date = idx.data(HistoryModel::DateRole).toDate(); if (date == QDate::currentDate()) return i18n("Earlier Today"); - return date.toString(QLatin1String("dddd, MMMM d, yyyy")); + return date.toString(QL1S("dddd, MMMM d, yyyy")); } if (index.column() == 1) { diff --git a/src/history/historypanel.cpp b/src/history/historypanel.cpp index cc2909e7..4c4982e9 100644 --- a/src/history/historypanel.cpp +++ b/src/history/historypanel.cpp @@ -111,7 +111,7 @@ void HistoryPanel::setup() m_treeView->setExpanded(treeProxyModel->index(0, 0), true); m_treeView->header()->hideSection(1); QFontMetrics fm(font()); - int header = fm.width(QLatin1Char('m')) * 40; + int header = fm.width( QL1C('m') ) * 40; m_treeView->header()->resizeSection(0, header); connect(search, SIGNAL(textChanged(QString)), treeProxyModel, SLOT(setFilterFixedString(QString))); diff --git a/src/mainview.cpp b/src/mainview.cpp index 50c82025..4dc95b26 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -492,7 +492,7 @@ void MainView::closeTab(int index, bool del) } // store close tab except homepage - if (!tab->url().prettyUrl().startsWith(QLatin1String("about:")) && !tab->url().isEmpty()) + if (!tab->url().prettyUrl().startsWith(QL1S("about:")) && !tab->url().isEmpty()) { QString title = tab->view()->title(); QString url = tab->url().prettyUrl(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 03ba27f0..28c7dff1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -260,7 +260,7 @@ void MainWindow::setupActions() // new window action a = new KAction(KIcon("window-new"), i18n("&New Window"), this); a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_N)); - actionCollection()->addAction(QLatin1String("new_window"), a); + actionCollection()->addAction(QL1S("new_window"), a); connect(a, SIGNAL(triggered(bool)), Application::instance(), SLOT(newWindow())); // Standard Actions @@ -294,51 +294,51 @@ void MainWindow::setupActions() a = new KAction(KIcon("process-stop"), i18n("&Stop"), this); a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Period)); - actionCollection()->addAction(QLatin1String("stop"), a); + actionCollection()->addAction(QL1S("stop"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(webStop())); // stop reload Action m_stopReloadAction = new KAction(this); - actionCollection()->addAction(QLatin1String("stop_reload") , m_stopReloadAction); + actionCollection()->addAction(QL1S("stop_reload") , m_stopReloadAction); m_stopReloadAction->setShortcutConfigurable(false); connect(m_view, SIGNAL(browserTabLoading(bool)), this, SLOT(browserLoading(bool))); browserLoading(false); //first init for blank start page a = new KAction(i18n("Open Location"), this); a->setShortcut(Qt::CTRL + Qt::Key_L); - actionCollection()->addAction(QLatin1String("open_location"), a); + actionCollection()->addAction(QL1S("open_location"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(openLocation())); // ============================= Zoom Actions =================================== a = new KAction(KIcon("zoom-in"), i18n("&Zoom In"), this); a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Plus)); - actionCollection()->addAction(QLatin1String("zoom_in"), a); + actionCollection()->addAction(QL1S("zoom_in"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(zoomIn())); a = new KAction(KIcon("zoom-original"), i18n("&Normal Zoom"), this); a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_0)); - actionCollection()->addAction(QLatin1String("zoom_normal"), a); + actionCollection()->addAction(QL1S("zoom_normal"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(zoomNormal())); a = new KAction(KIcon("zoom-out"), i18n("&Zoom Out"), this); a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Minus)); - actionCollection()->addAction(QLatin1String("zoom_out"), a); + actionCollection()->addAction(QL1S("zoom_out"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(zoomOut())); // =============================== Tools Actions ================================= a = new KAction(i18n("Page S&ource"), this); a->setIcon(KIcon("application-xhtml+xml")); - actionCollection()->addAction(QLatin1String("page_source"), a); + actionCollection()->addAction(QL1S("page_source"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(viewPageSource())); a = new KAction(KIcon("view-media-artist"), i18n("Private &Browsing"), this); a->setCheckable(true); - actionCollection()->addAction(QLatin1String("private_browsing"), a); + actionCollection()->addAction(QL1S("private_browsing"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(privateBrowsing(bool))); a = new KAction(KIcon("edit-clear"), i18n("Clear Private Data..."), this); - actionCollection()->addAction(QLatin1String("clear_private_data"), a); + actionCollection()->addAction(QL1S("clear_private_data"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(clearPrivateData())); // ========================= History related actions ============================== @@ -356,42 +356,42 @@ void MainWindow::setupActions() // ============================== General Tab Actions ==================================== a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this); a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_T)); - actionCollection()->addAction(QLatin1String("new_tab"), a); + actionCollection()->addAction(QL1S("new_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newTab())); a = new KAction(KIcon("view-refresh"), i18n("Reload All Tabs"), this); - actionCollection()->addAction(QLatin1String("reload_all_tabs"), a); + actionCollection()->addAction(QL1S("reload_all_tabs"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(reloadAllTabs())); a = new KAction(i18n("Show Next Tab"), this); a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext()); - actionCollection()->addAction(QLatin1String("show_next_tab"), a); + actionCollection()->addAction(QL1S("show_next_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(nextTab())); a = new KAction(i18n("Show Previous Tab"), this); a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev()); - actionCollection()->addAction(QLatin1String("show_prev_tab"), a); + actionCollection()->addAction(QL1S("show_prev_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(previousTab())); // ============================== Indexed Tab Actions ==================================== a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); - actionCollection()->addAction(QLatin1String("close_tab"), a); + actionCollection()->addAction(QL1S("close_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(closeTab())); a = new KAction(KIcon("tab-duplicate"), i18n("Clone Tab"), this); - actionCollection()->addAction(QLatin1String("clone_tab"), a); + actionCollection()->addAction(QL1S("clone_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(cloneTab())); a = new KAction(KIcon("tab-close-other"), i18n("Close &Other Tabs"), this); - actionCollection()->addAction(QLatin1String("close_other_tabs"), a); + actionCollection()->addAction(QL1S("close_other_tabs"), a); connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(closeOtherTabs())); a = new KAction(KIcon("view-refresh"), i18n("Reload Tab"), this); - actionCollection()->addAction(QLatin1String("reload_tab"), a); + actionCollection()->addAction(QL1S("reload_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(reloadTab())); a = new KAction(KIcon("tab-detach"), i18n("Detach Tab"), this); - actionCollection()->addAction(QLatin1String("detach_tab"), a); + actionCollection()->addAction(QL1S("detach_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(detachTab())); @@ -401,23 +401,23 @@ void MainWindow::setupActions() qa = m_mainBar->toggleViewAction(); qa->setText(i18n("Main Toolbar")); qa->setIcon(KIcon("bookmark-toolbar")); - actionCollection()->addAction(QLatin1String("main_bar"), qa); + actionCollection()->addAction(QL1S("main_bar"), qa); qa = m_bmBar->toggleViewAction(); qa->setText(i18n("Bookmarks Toolbar")); qa->setIcon(KIcon("bookmark-toolbar")); - actionCollection()->addAction(QLatin1String("bm_bar"), qa); + actionCollection()->addAction(QL1S("bm_bar"), qa); // Bookmark Menu KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu(this); bmMenu->setIcon(KIcon("bookmarks")); bmMenu->setDelayed(false); - actionCollection()->addAction(QLatin1String("bookmarksActionMenu"), bmMenu); + actionCollection()->addAction(QL1S("bookmarksActionMenu"), bmMenu); // ---------------- Encodings ----------------------------------- a = new KAction(KIcon("character-set"), i18n("Set Encoding"), this); - actionCollection()->addAction(QLatin1String("encodings"), a); + actionCollection()->addAction(QL1S("encodings"), a); a->setMenu(m_encodingMenu); connect(m_encodingMenu, SIGNAL(aboutToShow()), this, SLOT(populateEncodingMenu())); connect(m_encodingMenu, SIGNAL(triggered(QAction *)), this, SLOT(setEncoding(QAction *))); @@ -438,7 +438,7 @@ void MainWindow::setupTools() QWidget *zoomWidget = new QWidget(this); QToolButton *zoomOut = new QToolButton(zoomWidget); - zoomOut->setDefaultAction(actionByName(QLatin1String("zoom_out"))); + zoomOut->setDefaultAction(actionByName(QL1S("zoom_out"))); zoomOut->setAutoRaise(true); m_zoomSlider = new QSlider(Qt::Horizontal, zoomWidget); @@ -449,11 +449,11 @@ void MainWindow::setupTools() connect(m_zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setZoomFactor(int))); QToolButton *zoomIn = new QToolButton(zoomWidget); - zoomIn->setDefaultAction(actionByName(QLatin1String("zoom_in"))); + zoomIn->setDefaultAction(actionByName(QL1S("zoom_in"))); zoomIn->setAutoRaise(true); QToolButton *zoomNormal = new QToolButton(zoomWidget); - zoomNormal->setDefaultAction(actionByName(QLatin1String("zoom_normal"))); + zoomNormal->setDefaultAction(actionByName(QL1S("zoom_normal"))); zoomNormal->setAutoRaise(true); QHBoxLayout* zoomWidgetLayout = new QHBoxLayout(zoomWidget); @@ -470,33 +470,33 @@ void MainWindow::setupTools() toolsMenu->addSeparator(); - toolsMenu->addAction(actionByName(QLatin1String("private_browsing"))); - toolsMenu->addAction(actionByName(QLatin1String("clear_private_data"))); + toolsMenu->addAction(actionByName(QL1S("private_browsing"))); + toolsMenu->addAction(actionByName(QL1S("clear_private_data"))); toolsMenu->addSeparator(); KActionMenu *webMenu = new KActionMenu(KIcon("applications-development-web"), i18n("Web Development"), this); - webMenu->addAction(actionByName(QLatin1String("web_inspector"))); - webMenu->addAction(actionByName(QLatin1String("page_source"))); + webMenu->addAction(actionByName(QL1S("web_inspector"))); + webMenu->addAction(actionByName(QL1S("page_source"))); toolsMenu->addAction(webMenu); toolsMenu->addSeparator(); - toolsMenu->addAction(actionByName(QLatin1String("bm_bar"))); - toolsMenu->addAction(actionByName(QLatin1String("show_history_panel"))); - toolsMenu->addAction(actionByName(QLatin1String("show_bookmarks_panel"))); + toolsMenu->addAction(actionByName(QL1S("bm_bar"))); + toolsMenu->addAction(actionByName(QL1S("show_history_panel"))); + toolsMenu->addAction(actionByName(QL1S("show_bookmarks_panel"))); toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::FullScreen))); toolsMenu->addSeparator(); - toolsMenu->addAction(actionByName(QLatin1String("encodings"))); + toolsMenu->addAction(actionByName(QL1S("encodings"))); helpMenu()->setIcon(KIcon("help-browser")); toolsMenu->addAction(helpMenu()->menuAction()); toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Preferences))); // adding rekonq_tools to rekonq actionCollection - actionCollection()->addAction(QLatin1String("rekonq_tools"), toolsMenu); + actionCollection()->addAction(QL1S("rekonq_tools"), toolsMenu); } @@ -517,7 +517,7 @@ void MainWindow::setupPanels() a = (KAction *) m_historyPanel->toggleViewAction(); a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_H)); a->setIcon(KIcon("view-history")); - actionCollection()->addAction(QLatin1String("show_history_panel"), a); + actionCollection()->addAction(QL1S("show_history_panel"), a); // STEP 2 // Setup bookmarks panel @@ -532,7 +532,7 @@ void MainWindow::setupPanels() a = (KAction *) m_bookmarksPanel->toggleViewAction(); a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B)); a->setIcon(KIcon("bookmarks-organize")); - actionCollection()->addAction(QLatin1String("show_bookmarks_panel"), a); + actionCollection()->addAction(QL1S("show_bookmarks_panel"), a); // STEP 3 // Setup webinspector panel @@ -541,7 +541,7 @@ void MainWindow::setupPanels() a = new KAction(KIcon("tools-report-bug"), i18n("Web &Inspector"), this); a->setCheckable(true); - actionCollection()->addAction(QLatin1String("web_inspector"), a); + actionCollection()->addAction(QL1S("web_inspector"), a); connect(a, SIGNAL(triggered(bool)), m_webInspectorPanel, SLOT(toggle(bool))); addDockWidget(Qt::BottomDockWidgetArea, m_webInspectorPanel); @@ -891,7 +891,7 @@ void MainWindow::viewPageSource() isTempFile = true; } } - KRun::runUrl(url, QLatin1String("text/plain"), this, isTempFile); + KRun::runUrl(url, QL1S("text/plain"), this, isTempFile); } @@ -1144,7 +1144,7 @@ void MainWindow::clearPrivateData() if (clearWidget.clearCachedPages->isChecked()) { KProcess::startDetached(KStandardDirs::findExe("kio_http_cache_cleaner"), - QStringList(QLatin1String("--clear-all"))); + QStringList(QL1S("--clear-all"))); } if (clearWidget.clearWebIcons->isChecked()) diff --git a/src/tabbar.cpp b/src/tabbar.cpp index a3023dac..27835892 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -277,17 +277,17 @@ void TabBar::contextMenu(int tab, const QPoint &pos) KMenu menu; MainWindow *mainWindow = Application::instance()->mainWindow(); - menu.addAction(mainWindow->actionByName(QLatin1String("new_tab"))); - menu.addAction(mainWindow->actionByName("clone_tab")); + menu.addAction(mainWindow->actionByName( QL1S("new_tab") )); + menu.addAction(mainWindow->actionByName( QL1S("clone_tab") )); if (count() > 1) - menu.addAction(mainWindow->actionByName("detach_tab")); + menu.addAction(mainWindow->actionByName( QL1S("detach_tab") )); menu.addSeparator(); - menu.addAction(mainWindow->actionByName("close_tab")); - menu.addAction(mainWindow->actionByName("close_other_tabs")); + menu.addAction(mainWindow->actionByName( QL1S("close_tab") )); + menu.addAction(mainWindow->actionByName( QL1S("close_other_tabs") )); menu.addSeparator(); - menu.addAction(mainWindow->actionByName("reload_tab")); - menu.addAction(mainWindow->actionByName("reload_all_tabs")); + menu.addAction(mainWindow->actionByName( QL1S("reload_tab") )); + menu.addAction(mainWindow->actionByName( QL1S("reload_all_tabs") )); menu.exec(pos); } @@ -298,9 +298,9 @@ void TabBar::emptyAreaContextMenu(const QPoint &pos) KMenu menu; MainWindow *mainWindow = Application::instance()->mainWindow(); - menu.addAction(mainWindow->actionByName(QLatin1String("new_tab"))); + menu.addAction(mainWindow->actionByName( QL1S("new_tab") )); menu.addSeparator(); - menu.addAction(mainWindow->actionByName("reload_all_tabs")); + menu.addAction(mainWindow->actionByName( QL1S("reload_all_tabs") )); menu.exec(pos); } diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index 32e71c23..ad0f34a1 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -206,23 +206,23 @@ 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(QLatin1String("http://"), Qt::CaseInsensitive)) + && !currentText.startsWith(QL1S("http://"), Qt::CaseInsensitive)) { QString append; if (event->modifiers() == Qt::ControlModifier) { - append = QLatin1String(".com"); + append = QL1S(".com"); } else if (event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier)) { - append = QLatin1String(".org"); + append = QL1S(".org"); } else if (event->modifiers() == Qt::ShiftModifier) { - append = QLatin1String(".net"); + append = QL1S(".net"); } - QUrl url(QLatin1String("http://www.") + currentText); + QUrl url(QL1S("http://www.") + currentText); QString host = url.host(); if (!host.endsWith(append, Qt::CaseInsensitive)) { diff --git a/src/webpage.cpp b/src/webpage.cpp index a175a02e..b510311e 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -424,7 +424,7 @@ QString WebPage::errorPage(QNetworkReply *reply) msg += "<input type=\"button\" id=\"reloadButton\" onClick=\"document.location.href='" + urlString + "';\" value=\""; msg += i18n("Try Again") + "\" />"; - QString html = QString(QLatin1String(file.readAll())) + QString html = QString(QL1S(file.readAll())) .arg(title) .arg(msg) ; diff --git a/src/webview.cpp b/src/webview.cpp index 4209829a..e7226740 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -204,9 +204,9 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) { QString text = selectedText(); - if (text.startsWith(QLatin1String("http://")) - || text.startsWith(QLatin1String("https://")) - || text.startsWith(QLatin1String("www.")) + if (text.startsWith(QL1S("http://")) + || text.startsWith(QL1S("https://")) + || text.startsWith(QL1S("www.")) ) { QString truncatedURL = text; |