From 62ac0e2fdeb1450c7346c40368c76eacd0a8650f Mon Sep 17 00:00:00 2001 From: nowrep Date: Wed, 5 Sep 2012 19:57:36 +0200 Subject: [PATCH] More QLatin1String and QLatin1Char work --- src/lib/bookmarks/bookmarksmanager.cpp | 4 ++-- src/lib/bookmarks/bookmarkstoolbar.cpp | 2 +- src/lib/navigation/websearchbar.cpp | 2 +- src/lib/network/schemehandlers/qupzillaschemehandler.cpp | 2 +- src/lib/plugins/speeddial.cpp | 2 +- src/lib/plugins/webpluginfactory.cpp | 4 ++-- src/lib/sidebar/bookmarkssidebar.cpp | 4 ++-- src/lib/tools/globalfunctions.cpp | 2 +- src/lib/webview/tabbar.cpp | 7 +++++++ src/lib/webview/tabbar.h | 2 ++ src/lib/webview/webpage.cpp | 2 +- 11 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/lib/bookmarks/bookmarksmanager.cpp b/src/lib/bookmarks/bookmarksmanager.cpp index 88a5276b5..da1b4412a 100644 --- a/src/lib/bookmarks/bookmarksmanager.cpp +++ b/src/lib/bookmarks/bookmarksmanager.cpp @@ -352,7 +352,7 @@ void BookmarksManager::refreshTable() folder = _bookmarksToolbar; } - if (folder != "unsorted") { + if (folder != QLatin1String("unsorted")) { QList findParent = ui->bookmarksTree->findItems(folder, 0); if (findParent.count() != 1) { continue; @@ -432,7 +432,7 @@ void BookmarksManager::addBookmark(const BookmarksModel::Bookmark &bookmark) } } } - else if (bookmark.folder != "unsorted") { + else if (bookmark.folder != QLatin1String("unsorted")) { ui->bookmarksTree->appendToParentItem(translatedFolder, item); } else { diff --git a/src/lib/bookmarks/bookmarkstoolbar.cpp b/src/lib/bookmarks/bookmarkstoolbar.cpp index 12efcb4c0..fe75830eb 100644 --- a/src/lib/bookmarks/bookmarkstoolbar.cpp +++ b/src/lib/bookmarks/bookmarkstoolbar.cpp @@ -389,7 +389,7 @@ void BookmarksToolbar::folderRenamed(const QString &before, const QString &after void BookmarksToolbar::addBookmark(const BookmarksModel::Bookmark &bookmark) { - if (bookmark.folder != "bookmarksToolbar") { + if (bookmark.folder != QLatin1String("bookmarksToolbar")) { return; } QString title = bookmark.title; diff --git a/src/lib/navigation/websearchbar.cpp b/src/lib/navigation/websearchbar.cpp index 46da4ec5e..afa11c823 100644 --- a/src/lib/navigation/websearchbar.cpp +++ b/src/lib/navigation/websearchbar.cpp @@ -209,7 +209,7 @@ void WebSearchBar::completeMenuWithAvailableEngines(QMenu* menu) QWebElementCollection elements = frame->documentElement().findAll(QLatin1String("link[rel=search]")); foreach(const QWebElement & element, elements) { - if (element.attribute("type") != "application/opensearchdescription+xml") { + if (element.attribute("type") != QLatin1String("application/opensearchdescription+xml")) { continue; } QUrl url = view->url().resolved(QUrl::fromEncoded(element.attribute("href").toUtf8())); diff --git a/src/lib/network/schemehandlers/qupzillaschemehandler.cpp b/src/lib/network/schemehandlers/qupzillaschemehandler.cpp index 545eeef71..0397320aa 100644 --- a/src/lib/network/schemehandlers/qupzillaschemehandler.cpp +++ b/src/lib/network/schemehandlers/qupzillaschemehandler.cpp @@ -146,7 +146,7 @@ QString QupZillaSchemeReply::reportbugPage() bPage.replace(QLatin1String("%TITLE%"), tr("Report Issue")); bPage.replace(QLatin1String("%REPORT-ISSUE%"), tr("Report Issue")); bPage.replace(QLatin1String("%PLUGINS-TEXT%"), tr("If you are experiencing problems with QupZilla, please try to disable" - " all extensions first.
If this does not fix it, then please fill out this form: ")); + " all extensions first.
If this does not fix it, then please fill out this form: ")); bPage.replace(QLatin1String("%EMAIL%"), tr("Your E-mail")); bPage.replace(QLatin1String("%TYPE%"), tr("Issue type")); bPage.replace(QLatin1String("%DESCRIPTION%"), tr("Issue description")); diff --git a/src/lib/plugins/speeddial.cpp b/src/lib/plugins/speeddial.cpp index 366874cac..5f30ae4c9 100644 --- a/src/lib/plugins/speeddial.cpp +++ b/src/lib/plugins/speeddial.cpp @@ -383,7 +383,7 @@ QList SpeedDial::cleanFrames() for (int i = 0; i < m_webFrames.count(); i++) { QWebFrame* frame = m_webFrames.at(i).data(); - if (!frame || frame->url().toString() != "qupzilla:speeddial") { + if (!frame || frame->url().toString() != QLatin1String("qupzilla:speeddial")) { m_webFrames.removeAt(i); i--; continue; diff --git a/src/lib/plugins/webpluginfactory.cpp b/src/lib/plugins/webpluginfactory.cpp index 38f123b3d..de531c728 100644 --- a/src/lib/plugins/webpluginfactory.cpp +++ b/src/lib/plugins/webpluginfactory.cpp @@ -47,8 +47,8 @@ QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, cons } } - if (mime != "application/x-shockwave-flash") { - if (mime != "application/futuresplash" && mime != "application/x-java-applet") { + if (mime != QLatin1String("application/x-shockwave-flash")) { + if (mime != QLatin1String("application/futuresplash") && mime != QLatin1String("application/x-java-applet")) { qDebug() << "WebPluginFactory::create creating object of mimeType : " << mime; } return 0; diff --git a/src/lib/sidebar/bookmarkssidebar.cpp b/src/lib/sidebar/bookmarkssidebar.cpp index 674b50da4..bab9552ce 100644 --- a/src/lib/sidebar/bookmarkssidebar.cpp +++ b/src/lib/sidebar/bookmarkssidebar.cpp @@ -150,7 +150,7 @@ void BookmarksSideBar::addBookmark(const BookmarksModel::Bookmark &bookmark) item->setIcon(0, qIconProvider->iconFromImage(bookmark.image)); item->setToolTip(0, bookmark.url.toEncoded()); - if (bookmark.folder != "unsorted") { + if (bookmark.folder != QLatin1String("unsorted")) { ui->bookmarksTree->appendToParentItem(translatedFolder, item); } else { @@ -287,7 +287,7 @@ void BookmarksSideBar::refreshTable() continue; } - if (folder != "unsorted") { + if (folder != QLatin1String("unsorted")) { QList findParent = ui->bookmarksTree->findItems(folder, 0); if (findParent.count() != 1) { continue; diff --git a/src/lib/tools/globalfunctions.cpp b/src/lib/tools/globalfunctions.cpp index c06b84791..dbfb6192a 100644 --- a/src/lib/tools/globalfunctions.cpp +++ b/src/lib/tools/globalfunctions.cpp @@ -104,7 +104,7 @@ void qz_removeDir(const QString &d) QFileInfo fi; for (int l = 0; l < list.size(); l++) { fi = list.at(l); - if (fi.isDir() && fi.fileName() != "." && fi.fileName() != "..") { + if (fi.isDir() && fi.fileName() != QLatin1String(".") && fi.fileName() != QLatin1String("..")) { qz_removeDir(fi.absoluteFilePath()); } else if (fi.isFile()) { diff --git a/src/lib/webview/tabbar.cpp b/src/lib/webview/tabbar.cpp index 81725c322..28922e7f9 100644 --- a/src/lib/webview/tabbar.cpp +++ b/src/lib/webview/tabbar.cpp @@ -442,6 +442,13 @@ void TabBar::hideTabPreview(bool delayed) } } +void TabBar::tabRemoved(int index) +{ + Q_UNUSED(index) + + showCloseButton(currentIndex()); +} + void TabBar::mouseDoubleClickEvent(QMouseEvent* event) { if (mApp->plugins()->processMouseDoubleClick(Qz::ON_TabBar, this, event)) { diff --git a/src/lib/webview/tabbar.h b/src/lib/webview/tabbar.h index 3257397d1..19bc22aef 100644 --- a/src/lib/webview/tabbar.h +++ b/src/lib/webview/tabbar.h @@ -82,6 +82,8 @@ private slots: private: inline bool validIndex(int index) const { return index >= 0 && index < count(); } + void tabRemoved(int index); + void hideCloseButton(int index); void showCloseButton(int index); diff --git a/src/lib/webview/webpage.cpp b/src/lib/webview/webpage.cpp index 58a896e6e..8bb07dc36 100644 --- a/src/lib/webview/webpage.cpp +++ b/src/lib/webview/webpage.cpp @@ -728,7 +728,7 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte errorString = tr("Content Access Denied"); break; default: - if (exOption->errorString != "QupZilla:No Error") { + if (exOption->errorString != QLatin1String("QupZilla:No Error")) { qDebug() << "Content error: " << exOption->errorString << exOption->error; } return false;