From 758fd6c6875b87d762a6c0e9676586d83cba0271 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sun, 30 Aug 2015 17:42:58 +0200 Subject: [PATCH] Fix all build warnings --- .travis.yml | 2 +- src/lib/adblock/adblockrule.cpp | 1 + src/lib/app/browserwindow.cpp | 1 + src/lib/app/profilemanager.cpp | 2 - src/lib/autofill/autofill.cpp | 4 ++ src/lib/autofill/pageformcompleter.cpp | 1 + src/lib/bookmarks/bookmarkstreeview.cpp | 4 +- src/lib/bookmarks/bookmarkstreeview.h | 2 +- src/lib/lib.pro | 34 ++++----- src/lib/opensearch/searchenginesmanager.cpp | 2 + src/lib/popupwindow/popupstatusbarmessage.cpp | 17 +---- src/lib/preferences/sslmanager.cpp | 2 + src/lib/tools/qztools.cpp | 9 --- src/lib/tools/qztools.h | 2 - src/lib/webengine/webpage.cpp | 71 +------------------ src/lib/webengine/webpage.h | 3 - 16 files changed, 37 insertions(+), 120 deletions(-) diff --git a/.travis.yml b/.travis.yml index 722226468..6308ee1a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,6 @@ script: - QMAKE="qmake" - if [[ "$QT" == "qt55" ]]; then QMAKE="/opt/qt55/bin/qmake"; fi - $QMAKE -# - $QMAKE QMAKE_CXXFLAGS+="-Wextra -Werror" + - $QMAKE QMAKE_CXXFLAGS+="-Wextra -Werror" - make || exit 1 # - cd scripts && ./run_tests.sh $QMAKE diff --git a/src/lib/adblock/adblockrule.cpp b/src/lib/adblock/adblockrule.cpp index 37de3b1f6..4f47d3043 100644 --- a/src/lib/adblock/adblockrule.cpp +++ b/src/lib/adblock/adblockrule.cpp @@ -337,6 +337,7 @@ bool AdBlockRule::matchObject(const QNetworkRequest &request) const bool AdBlockRule::matchSubdocument(const QNetworkRequest &request) const { + Q_UNUSED(request) #if QTWEBENGINE_DISABLED QWebEngineFrame* originatingFrame = static_cast(request.originatingObject()); if (!originatingFrame) { diff --git a/src/lib/app/browserwindow.cpp b/src/lib/app/browserwindow.cpp index 9a941f6da..79bfbfb74 100644 --- a/src/lib/app/browserwindow.cpp +++ b/src/lib/app/browserwindow.cpp @@ -1190,6 +1190,7 @@ bool BrowserWindow::event(QEvent* event) void BrowserWindow::printPage(QWebEngineFrame* frame) { + Q_UNUSED(frame) #if QTWEBENGINE_DISABLED QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this); dialog->setAttribute(Qt::WA_DeleteOnClose); diff --git a/src/lib/app/profilemanager.cpp b/src/lib/app/profilemanager.cpp index 4a526dac9..1f90e128c 100644 --- a/src/lib/app/profilemanager.cpp +++ b/src/lib/app/profilemanager.cpp @@ -142,10 +142,8 @@ QString ProfileManager::startingProfile() const void ProfileManager::setStartingProfile(const QString &profileName) { -#if QTWEBENGINE_DISABLED QSettings settings(DataPaths::path(DataPaths::Profiles) + QLatin1String("/profiles.ini"), QSettings::IniFormat); settings.setValue(QLatin1String("Profiles/startProfile"), profileName); -#endif } QStringList ProfileManager::availableProfiles() const diff --git a/src/lib/autofill/autofill.cpp b/src/lib/autofill/autofill.cpp index bb5630da5..9fdc8d2fe 100644 --- a/src/lib/autofill/autofill.cpp +++ b/src/lib/autofill/autofill.cpp @@ -176,12 +176,14 @@ QVector AutoFill::completeFrame(QWebEngineFrame* frame) return list; } +#if QTWEBENGINE_DISABLED const QUrl frameUrl = QzTools::frameUrl(frame); if (!isStored(frameUrl)) { return list; } list = getFormData(frameUrl); +#endif if (!list.isEmpty()) { const PasswordEntry entry = list.first(); @@ -199,6 +201,8 @@ QVector AutoFill::completeFrame(QWebEngineFrame* frame) void AutoFill::post(const QNetworkRequest &request, const QByteArray &outgoingData) { + Q_UNUSED(request) + Q_UNUSED(outgoingData) #if QTWEBENGINE_DISABLED // Don't save in private browsing if (mApp->isPrivate()) { diff --git a/src/lib/autofill/pageformcompleter.cpp b/src/lib/autofill/pageformcompleter.cpp index 0cb774901..424789c2e 100644 --- a/src/lib/autofill/pageformcompleter.cpp +++ b/src/lib/autofill/pageformcompleter.cpp @@ -212,6 +212,7 @@ QByteArray PageFormCompleter::convertWebKitFormBoundaryIfNecessary(const QByteAr PageFormCompleter::QueryItem PageFormCompleter::findUsername(const QWebElement &form) const { + Q_UNUSED(form) #if QTWEBENGINE_DISABLED // Try to find username (or email) field in the form. QStringList selectors; diff --git a/src/lib/bookmarks/bookmarkstreeview.cpp b/src/lib/bookmarks/bookmarkstreeview.cpp index 92473fbe5..82b52dfcd 100644 --- a/src/lib/bookmarks/bookmarkstreeview.cpp +++ b/src/lib/bookmarks/bookmarkstreeview.cpp @@ -43,7 +43,7 @@ BookmarksTreeView::BookmarksTreeView(QWidget* parent) connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(indexExpanded(QModelIndex))); connect(this, SIGNAL(collapsed(QModelIndex)), this, SLOT(indexCollapsed(QModelIndex))); - connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(selectionChanged())); + connect(this, SIGNAL(slotSelectionChanged(QItemSelection,QItemSelection)), this, SLOT(slotSelectionChanged())); } BookmarksTreeView::ViewType BookmarksTreeView::viewType() const @@ -151,7 +151,7 @@ void BookmarksTreeView::indexCollapsed(const QModelIndex &parent) } } -void BookmarksTreeView::selectionChanged() +void BookmarksTreeView::slotSelectionChanged() { emit bookmarksSelected(selectedBookmarks()); } diff --git a/src/lib/bookmarks/bookmarkstreeview.h b/src/lib/bookmarks/bookmarkstreeview.h index a7bf5968b..407687a63 100644 --- a/src/lib/bookmarks/bookmarkstreeview.h +++ b/src/lib/bookmarks/bookmarkstreeview.h @@ -70,7 +70,7 @@ private slots: void indexExpanded(const QModelIndex &parent); void indexCollapsed(const QModelIndex &parent); - void selectionChanged(); + void slotSelectionChanged(); private: void restoreExpandedState(const QModelIndex &parent); diff --git a/src/lib/lib.pro b/src/lib/lib.pro index 64d6bb2a3..3fdbb5881 100644 --- a/src/lib/lib.pro +++ b/src/lib/lib.pro @@ -105,7 +105,7 @@ SOURCES += \ bookmarks/bookmarkswidget.cpp \ cookies/cookiejar.cpp \ cookies/cookiemanager.cpp \ - downloads/downloadfilehelper.cpp \ + #downloads/downloadfilehelper.cpp \ downloads/downloaditem.cpp \ downloads/downloadmanager.cpp \ downloads/downloadoptionsdialog.cpp \ @@ -129,15 +129,15 @@ SOURCES += \ navigation/reloadstopbutton.cpp \ navigation/siteicon.cpp \ navigation/websearchbar.cpp \ - network/cabundleupdater.cpp \ - network/networkmanager.cpp \ + #network/cabundleupdater.cpp \ + #network/networkmanager.cpp \ network/networkmanagerproxy.cpp \ network/networkproxyfactory.cpp \ network/pac/pacmanager.cpp \ network/pac/proxyautoconfig.cpp \ network/schemehandlers/adblockschemehandler.cpp \ network/schemehandlers/fileschemehandler.cpp \ - network/schemehandlers/ftpschemehandler.cpp \ + #network/schemehandlers/ftpschemehandler.cpp \ network/schemehandlers/qupzillaschemehandler.cpp \ network/sslerrordialog.cpp \ notifications/desktopnotification.cpp \ @@ -154,16 +154,16 @@ SOURCES += \ other/checkboxdialog.cpp \ other/iconchooser.cpp \ other/licenseviewer.cpp \ - other/pagescreen.cpp \ + #other/pagescreen.cpp \ other/qzsettings.cpp \ - other/siteinfo.cpp \ + #other/siteinfo.cpp \ other/siteinfowidget.cpp \ - other/sourceviewer.cpp \ - other/sourceviewersearch.cpp \ + #other/sourceviewer.cpp \ + #other/sourceviewersearch.cpp \ other/statusbarmessage.cpp \ other/updater.cpp \ other/useragentmanager.cpp \ - plugins/clicktoflash.cpp \ + #plugins/clicktoflash.cpp \ plugins/pluginproxy.cpp \ plugins/plugins.cpp \ plugins/speeddial.cpp \ @@ -301,7 +301,7 @@ HEADERS += \ bookmarks/bookmarkswidget.h \ cookies/cookiejar.h \ cookies/cookiemanager.h \ - downloads/downloadfilehelper.h \ + #downloads/downloadfilehelper.h \ downloads/downloaditem.h \ downloads/downloadmanager.h \ downloads/downloadoptionsdialog.h \ @@ -325,7 +325,7 @@ HEADERS += \ navigation/reloadstopbutton.h \ navigation/siteicon.h \ navigation/websearchbar.h \ - network/cabundleupdater.h \ + #network/cabundleupdater.h \ network/networkmanager.h \ network/networkmanagerproxy.h \ network/networkproxyfactory.h \ @@ -334,7 +334,7 @@ HEADERS += \ network/pac/proxyautoconfig.h \ network/schemehandlers/adblockschemehandler.h \ network/schemehandlers/fileschemehandler.h \ - network/schemehandlers/ftpschemehandler.h \ + #network/schemehandlers/ftpschemehandler.h \ network/schemehandlers/qupzillaschemehandler.h \ network/schemehandlers/schemehandler.h \ network/sslerrordialog.h \ @@ -352,16 +352,16 @@ HEADERS += \ other/checkboxdialog.h \ other/iconchooser.h \ other/licenseviewer.h \ - other/pagescreen.h \ + #other/pagescreen.h \ other/qzsettings.h \ - other/siteinfo.h \ + #other/siteinfo.h \ other/siteinfowidget.h \ - other/sourceviewer.h \ - other/sourceviewersearch.h \ + #other/sourceviewer.h \ + #other/sourceviewersearch.h \ other/statusbarmessage.h \ other/updater.h \ other/useragentmanager.h \ - plugins/clicktoflash.h \ + #plugins/clicktoflash.h \ plugins/plugininterface.h \ plugins/pluginproxy.h \ plugins/plugins.h \ diff --git a/src/lib/opensearch/searchenginesmanager.cpp b/src/lib/opensearch/searchenginesmanager.cpp index 2a0a49593..07e444b03 100644 --- a/src/lib/opensearch/searchenginesmanager.cpp +++ b/src/lib/opensearch/searchenginesmanager.cpp @@ -256,6 +256,8 @@ void SearchEnginesManager::addEngine(const Engine &engine) void SearchEnginesManager::addEngineFromForm(const QWebElement &element, WebView* view) { + Q_UNUSED(element) + Q_UNUSED(view) #if QTWEBENGINE_DISABLED QWebElement formElement = element.parent(); diff --git a/src/lib/popupwindow/popupstatusbarmessage.cpp b/src/lib/popupwindow/popupstatusbarmessage.cpp index 1f1d28057..0913b4da0 100644 --- a/src/lib/popupwindow/popupstatusbarmessage.cpp +++ b/src/lib/popupwindow/popupstatusbarmessage.cpp @@ -46,25 +46,12 @@ void PopupStatusBarMessage::showMessage(const QString &message) QWebEngineFrame* mainFrame = view->page()->mainFrame(); #endif - int horizontalScrollSize = 0; - int verticalScrollSize = 0; - const int scrollbarSize = m_popupWindow->style()->pixelMetric(QStyle::PM_ScrollBarExtent); - -#if QTWEBENGINE_DISABLED - if (mainFrame->scrollBarMaximum(Qt::Horizontal)) { - horizontalScrollSize = scrollbarSize; - } - if (mainFrame->scrollBarMaximum(Qt::Vertical)) { - verticalScrollSize = scrollbarSize; - } -#endif - m_statusBarText->setText(message); - m_statusBarText->setMaximumWidth(view->width() - verticalScrollSize); + m_statusBarText->setMaximumWidth(view->width()); m_statusBarText->resize(m_statusBarText->sizeHint()); QPoint position; - position.setY(view->height() - horizontalScrollSize - m_statusBarText->height()); + position.setY(view->height() - m_statusBarText->height()); QRect statusRect = QRect(view->mapToGlobal(QPoint(0, position.y())), m_statusBarText->size()); diff --git a/src/lib/preferences/sslmanager.cpp b/src/lib/preferences/sslmanager.cpp index a1afb77d6..826b5872c 100644 --- a/src/lib/preferences/sslmanager.cpp +++ b/src/lib/preferences/sslmanager.cpp @@ -202,6 +202,7 @@ void SSLManager::deleteCertificate() void SSLManager::ignoreAll(bool state) { + Q_UNUSED(state) #if QTWEBENGINE_DISABLED mApp->networkManager()->setIgnoreAllWarnings(state); #endif @@ -209,6 +210,7 @@ void SSLManager::ignoreAll(bool state) void SSLManager::disableWeakCiphers(bool state) { + Q_UNUSED(state) #if QTWEBENGINE_DISABLED mApp->networkManager()->setDisableWeakCiphers(state); #endif diff --git a/src/lib/tools/qztools.cpp b/src/lib/tools/qztools.cpp index 20a31cbb7..c8429d41d 100644 --- a/src/lib/tools/qztools.cpp +++ b/src/lib/tools/qztools.cpp @@ -213,15 +213,6 @@ QString QzTools::escapeSqlString(QString urlString) return urlString; } -QUrl QzTools::frameUrl(QWebEngineFrame* frame) -{ -#if QTWEBENGINE_DISABLED - return frame->url().isEmpty() ? frame->baseUrl() : frame->url(); -#else - return QUrl(); -#endif -} - QString QzTools::ensureUniqueFilename(const QString &name, const QString &appendFormat) { if (!QFile::exists(name)) { diff --git a/src/lib/tools/qztools.h b/src/lib/tools/qztools.h index ed3d7c854..4f359d37f 100644 --- a/src/lib/tools/qztools.h +++ b/src/lib/tools/qztools.h @@ -24,7 +24,6 @@ class QSslCertificate; class QFontMetrics; -class QWebEngineFrame; class QPixmap; class QIcon; class QWidget; @@ -49,7 +48,6 @@ public: static QString urlEncodeQueryString(const QUrl &url); static QString fromPunycode(const QString &str); static QString escapeSqlString(QString urlString); - static QUrl frameUrl(QWebEngineFrame *frame); static QString ensureUniqueFilename(const QString &name, const QString &appendFormat = QString("(%1)")); static QString getFileNameFromUrl(const QUrl &url); diff --git a/src/lib/webengine/webpage.cpp b/src/lib/webengine/webpage.cpp index 6b19aa3c6..4f394a108 100644 --- a/src/lib/webengine/webpage.cpp +++ b/src/lib/webengine/webpage.cpp @@ -83,13 +83,13 @@ WebPage::WebPage(QObject* parent) , m_secureStatus(false) , m_adjustingScheduled(false) { + setupWebChannel(); + connect(this, &QWebEnginePage::loadProgress, this, &WebPage::progress); connect(this, &QWebEnginePage::loadFinished, this, &WebPage::finished); connect(this, &QWebEnginePage::urlChanged, this, &WebPage::urlChanged); connect(this, &QWebEnginePage::featurePermissionRequested, this, &WebPage::featurePermissionRequested); connect(this, &QWebEnginePage::windowCloseRequested, this, &WebPage::windowCloseRequested); - - setupWebChannel(); } WebPage::~WebPage() @@ -159,12 +159,7 @@ bool WebPage::isLoading() const void WebPage::urlChanged(const QUrl &url) { -#if QTWEBENGINE_DISABLED - // Make sure JavaScript is enabled for qupzilla pages regardless of user settings - if (url.scheme() == QLatin1String("qupzilla")) { - settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true); - } -#endif + Q_UNUSED(url) if (isLoading()) { m_adBlockedEntries.clear(); @@ -225,65 +220,6 @@ void WebPage::watchedFileChanged(const QString &file) } } -void WebPage::handleUnsupportedContent(QNetworkReply* reply) -{ - if (!reply) { - return; - } - - const QUrl url = reply->url(); - - switch (reply->error()) { - case QNetworkReply::NoError: - if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) { - QString requestUrl = reply->request().url().toString(QUrl::RemoveFragment | QUrl::RemoveQuery); -#if QTWEBENGINE_DISABLED - if (requestUrl.endsWith(QLatin1String(".swf"))) { - const QWebElement docElement = mainFrame()->documentElement(); - const QWebElement object = docElement.findFirst(QString("object[src=\"%1\"]").arg(requestUrl)); - const QWebElement embed = docElement.findFirst(QString("embed[src=\"%1\"]").arg(requestUrl)); - - if (!object.isNull() || !embed.isNull()) { - qDebug() << "WebPage::UnsupportedContent" << url << "Attempt to download flash object on site!"; - reply->deleteLater(); - return; - } - } - DownloadManager* dManager = mApp->downloadManager(); - dManager->handleUnsupportedContent(reply, this); -#endif - return; - } - // Falling unsupported content with invalid ContentTypeHeader to be handled as UnknownProtocol - - case QNetworkReply::ProtocolUnknownError: { - if (url.scheme() == QLatin1String("file")) { - FileSchemeHandler::handleUrl(url); - return; - } - - if (url.scheme() == QLatin1String("ftp")) { - DownloadManager* dManager = mApp->downloadManager(); -#if QTWEBENGINE_DISABLED - dManager->handleUnsupportedContent(reply, this); -#endif - return; - } - - qDebug() << "WebPage::UnsupportedContent" << url << "ProtocolUnknowError"; - desktopServicesOpen(url); - - reply->deleteLater(); - return; - } - default: - break; - } - - qDebug() << "WebPage::UnsupportedContent error" << url << reply->errorString(); - reply->deleteLater(); -} - void WebPage::handleUnknownProtocol(const QUrl &url) { const QString protocol = url.scheme(); @@ -1040,7 +976,6 @@ void WebPage::javaScriptAlert(const QUrl &securityOrigin, const QString &msg) void WebPage::setJavaScriptEnabled(bool enabled) { settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, enabled); - m_javaScriptEnabled = enabled; } QWebEnginePage* WebPage::createWindow(QWebEnginePage::WebWindowType type) diff --git a/src/lib/webengine/webpage.h b/src/lib/webengine/webpage.h index ce3ec67ec..01acfe792 100644 --- a/src/lib/webengine/webpage.h +++ b/src/lib/webengine/webpage.h @@ -81,8 +81,6 @@ signals: void privacyChanged(bool status); protected slots: - void handleUnsupportedContent(QNetworkReply* url); - void progress(int prog); void finished(); @@ -131,7 +129,6 @@ private: int m_loadProgress; bool m_blockAlerts; bool m_secureStatus; - bool m_javaScriptEnabled; bool m_adjustingScheduled; };