diff --git a/QupZilla.pro b/QupZilla.pro index 775422fc6..2df11d4a0 100644 --- a/QupZilla.pro +++ b/QupZilla.pro @@ -14,5 +14,10 @@ lessThan(QT_VERSION, 4.7) { mac|unix: system(test -d bin/plugins || mkdir bin/plugins) TEMPLATE = subdirs -SUBDIRS = src/lib src/main src/plugins +SUBDIRS = src/lib src/main CONFIG += ordered + +# TODO: Fix plugins for Qt5 +!isEqual(QT_MAJOR_VERSION, 5) { + SUBDIRS += src/plugins +} diff --git a/src/lib/3rdparty/fancytabwidget.cpp b/src/lib/3rdparty/fancytabwidget.cpp index 78180be25..7b6829b3a 100644 --- a/src/lib/3rdparty/fancytabwidget.cpp +++ b/src/lib/3rdparty/fancytabwidget.cpp @@ -45,7 +45,7 @@ #include #include #include -#include +//#include using namespace Core; using namespace Internal; @@ -250,7 +250,7 @@ FancyTabBar::FancyTabBar(QWidget* parent) : QWidget(parent) { setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); - setStyle(new QWindowsStyle); + //setStyle(new QWindowsStyle); setMinimumWidth(qMax(2 * m_rounding, 40)); setAttribute(Qt::WA_Hover, true); setFocusPolicy(Qt::NoFocus); diff --git a/src/lib/3rdparty/lineedit.cpp b/src/lib/3rdparty/lineedit.cpp index 5ff65fad0..62e7a20d2 100644 --- a/src/lib/3rdparty/lineedit.cpp +++ b/src/lib/3rdparty/lineedit.cpp @@ -86,7 +86,8 @@ void LineEdit::init() mainLayout->addWidget(m_leftWidget, 0, Qt::AlignVCenter | Qt::AlignLeft); mainLayout->addItem(horizontalSpacer); mainLayout->addWidget(m_rightWidget, 0, Qt::AlignVCenter | Qt::AlignRight); - //by this we undo reversing of layout when direction is RTL. //TODO: don't do this and show reversed icon when needed + // by this we undo reversing of layout when direction is RTL. + // TODO: don't do this and show reversed icon when needed mainLayout->setDirection(isRightToLeft() ? QBoxLayout::RightToLeft : QBoxLayout::LeftToRight); setWidgetSpacing(3); diff --git a/src/lib/3rdparty/qtsingleapplication.cpp b/src/lib/3rdparty/qtsingleapplication.cpp index 76043da73..6aa38cd94 100644 --- a/src/lib/3rdparty/qtsingleapplication.cpp +++ b/src/lib/3rdparty/qtsingleapplication.cpp @@ -47,7 +47,7 @@ #include "qtsingleapplication.h" #include "qtlocalpeer.h" -#include +#include /*! @@ -179,20 +179,6 @@ QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char** sysInit(appId); } - -/*! - Creates a QtSingleApplication object. The application identifier - will be QCoreApplication::applicationFilePath(). \a argc, \a - argv, and \a type are passed on to the QAppliation constructor. -*/ -QtSingleApplication::QtSingleApplication(int &argc, char** argv, Type type) - : QApplication(argc, argv, type) - , peer(0) - , actWin(0) -{ -} - - #if defined(Q_WS_X11) /*! Special constructor for X11, ref. the documentation of diff --git a/src/lib/3rdparty/qtsingleapplication.h b/src/lib/3rdparty/qtsingleapplication.h index 8734d0d94..0532656c1 100644 --- a/src/lib/3rdparty/qtsingleapplication.h +++ b/src/lib/3rdparty/qtsingleapplication.h @@ -45,7 +45,7 @@ ****************************************************************************/ -#include +#include class QtLocalPeer; @@ -72,7 +72,6 @@ class QT_QTSINGLEAPPLICATION_EXPORT QtSingleApplication : public QApplication public: QtSingleApplication(int &argc, char** argv, bool GUIenabled = true); QtSingleApplication(const QString &id, int &argc, char** argv); - QtSingleApplication(int &argc, char** argv, Type type); #if defined(Q_WS_X11) QtSingleApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); QtSingleApplication(Display* dpy, int &argc, char** argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0); diff --git a/src/lib/3rdparty/squeezelabelv2.cpp b/src/lib/3rdparty/squeezelabelv2.cpp index 0e371f285..5059438d8 100644 --- a/src/lib/3rdparty/squeezelabelv2.cpp +++ b/src/lib/3rdparty/squeezelabelv2.cpp @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include SqueezeLabelV2::SqueezeLabelV2(QWidget* parent) diff --git a/src/lib/3rdparty/stylehelper.cpp b/src/lib/3rdparty/stylehelper.cpp index 52c5c860b..5aba52a4a 100644 --- a/src/lib/3rdparty/stylehelper.cpp +++ b/src/lib/3rdparty/stylehelper.cpp @@ -29,13 +29,13 @@ #include "stylehelper.h" -#include -#include +#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include // Clamps float color values within (0, 255) diff --git a/src/lib/3rdparty/stylehelper.h b/src/lib/3rdparty/stylehelper.h index c1a52c819..c97144678 100644 --- a/src/lib/3rdparty/stylehelper.h +++ b/src/lib/3rdparty/stylehelper.h @@ -32,8 +32,8 @@ #include "qz_namespace.h" -#include -#include +#include +#include QT_BEGIN_NAMESPACE class QPalette; diff --git a/src/lib/adblock/adblockmanager.cpp b/src/lib/adblock/adblockmanager.cpp index cc1eb45c3..d00681cdb 100644 --- a/src/lib/adblock/adblockmanager.cpp +++ b/src/lib/adblock/adblockmanager.cpp @@ -131,7 +131,7 @@ AdBlockSubscription* AdBlockManager::addSubscription(const QString &title, const QString fileName = qz_filterCharsFromFilename(title.toLower()) + ".txt"; QString filePath = qz_ensureUniqueFilename(mApp->currentProfilePath() + "adblock/" + fileName); - QByteArray data = QString("Title: %1\nUrl: %2\n[Adblock Plus 1.1.1]").arg(title, url).toAscii(); + QByteArray data = QString("Title: %1\nUrl: %2\n[Adblock Plus 1.1.1]").arg(title, url).toLatin1(); QFile file(filePath); if (!file.open(QFile::WriteOnly | QFile::Truncate)) { diff --git a/src/lib/adblock/adblockmanager.h b/src/lib/adblock/adblockmanager.h index 5051c28f4..2c3e1cd2b 100644 --- a/src/lib/adblock/adblockmanager.h +++ b/src/lib/adblock/adblockmanager.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include "qz_namespace.h" @@ -81,7 +81,7 @@ private: QList m_subscriptions; QStringList m_disabledRules; - QWeakPointer m_adBlockDialog; + QPointer m_adBlockDialog; }; #endif // ADBLOCKMANAGER_H diff --git a/src/lib/app/commandlineoptions.h b/src/lib/app/commandlineoptions.h index b3c6be2e4..c9e6d8b5b 100644 --- a/src/lib/app/commandlineoptions.h +++ b/src/lib/app/commandlineoptions.h @@ -19,6 +19,8 @@ #define COMMANDLINEOPTIONS_H #include +#include +#include #include #include "qz_namespace.h" diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index af6bbbe72..bf75aa214 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -866,7 +866,7 @@ QUrl MainApplication::userStyleSheet(const QString &filePath) const file.close(); } - const QString &encodedStyle = userStyle.toAscii().toBase64(); + const QString &encodedStyle = userStyle.toLatin1().toBase64(); const QString &dataString = QString("data:text/css;charset=utf-8;base64,%1").arg(encodedStyle); return QUrl(dataString); diff --git a/src/lib/app/mainapplication.h b/src/lib/app/mainapplication.h index 61e3c988c..20989dcd3 100644 --- a/src/lib/app/mainapplication.h +++ b/src/lib/app/mainapplication.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include "restoremanager.h" #include "qtsingleapplication.h" @@ -164,7 +164,7 @@ private: DatabaseWriter* m_dbWriter; UserAgentManager* m_uaManager; - QList > m_mainWindows; + QList > m_mainWindows; QString m_activeProfil; QString m_activeLanguage; diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index fbda28124..4fcf8ce26 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -87,6 +87,10 @@ #include #endif +#if QT_VERSION < 0x050000 +#include "qwebkitversion.h" +#endif + const QString QupZilla::VERSION = "1.3.5"; const QString QupZilla::BUILDTIME = __DATE__" "__TIME__; const QString QupZilla::AUTHOR = "David Rosca"; @@ -1842,7 +1846,7 @@ void QupZilla::disconnectObjects() tab->view()->page()->disconnectObjects(); } - foreach(const QWeakPointer &pointer, m_deleteOnCloseWidgets) { + foreach(const QPointer &pointer, m_deleteOnCloseWidgets) { if (pointer) { pointer.data()->deleteLater(); } diff --git a/src/lib/app/qupzilla.h b/src/lib/app/qupzilla.h index 908a3a585..b997a92d8 100644 --- a/src/lib/app/qupzilla.h +++ b/src/lib/app/qupzilla.h @@ -20,7 +20,6 @@ #include #include -#include "qwebkitversion.h" #include "restoremanager.h" #include "qz_namespace.h" @@ -265,11 +264,11 @@ private: QLabel* m_privateBrowsing; AdBlockIcon* m_adblockIcon; - QWeakPointer m_webInspectorDock; + QPointer m_webInspectorDock; BookmarksToolbar* m_bookmarksToolbar; TabWidget* m_tabWidget; - QWeakPointer m_sideBar; + QPointer m_sideBar; SideBarManager* m_sideBarManager; StatusBarMessage* m_statusBarMessage; NavigationBar* m_navigationBar; @@ -294,7 +293,7 @@ private: bool m_navigationVisible; bool m_bookmarksToolBarVisible; - QList > m_deleteOnCloseWidgets; + QList > m_deleteOnCloseWidgets; }; #endif // QUPZILLA_H diff --git a/src/lib/autofill/autofillmodel.cpp b/src/lib/autofill/autofillmodel.cpp index 87283e6dd..ed6644355 100644 --- a/src/lib/autofill/autofillmodel.cpp +++ b/src/lib/autofill/autofillmodel.cpp @@ -30,6 +30,10 @@ #include #include +#if QT_VERSION >= 0x050000 +#include +#endif + AutoFillModel::AutoFillModel(QupZilla* mainClass, QObject* parent) : QObject(parent) , p_QupZilla(mainClass) @@ -224,8 +228,11 @@ void AutoFillModel::completePage(WebPage* page) // Why not to use encodedQueryItems = QByteArrays ? // Because we need to filter "+" characters that must be spaces // (not real "+" characters "%2B") - +#if QT_VERSION >= 0x050000 + QueryItems arguments = QUrlQuery(QUrl::fromEncoded("http://bla.com/?" + data)).queryItems(); +#else QueryItems arguments = QUrl::fromEncoded("http://bla.com/?" + data).queryItems(); +#endif for (int i = 0; i < arguments.count(); i++) { QString key = arguments.at(i).first; QString value = arguments.at(i).second; @@ -345,7 +352,11 @@ QString AutoFillModel::getValueFromData(const QByteArray &data, QWebElement elem QString value = element.evaluateJavaScript("this.value").toString(); if (value.isEmpty()) { +#if QT_VERSION >= 0x050000 + QueryItems queryItems = QUrlQuery(QUrl::fromEncoded("http://a.b/?" + data)).queryItems(); +#else QueryItems queryItems = QUrl::fromEncoded("http://a.b/?" + data).queryItems(); +#endif for (int i = 0; i < queryItems.count(); i++) { QueryItem item = queryItems.at(i); @@ -404,7 +415,11 @@ QByteArray AutoFillModel::convertWebKitFormBoundaryIfNecessary(const QByteArray bool AutoFillModel::dataContains(const QByteArray &data, const QString &attributeName) { +#if QT_VERSION >= 0x050000 + QueryItems queryItems = QUrlQuery(QUrl::fromEncoded("http://a.b/?" + data)).queryItems(); +#else QueryItems queryItems = QUrl::fromEncoded("http://a.b/?" + data).queryItems(); +#endif for (int i = 0; i < queryItems.count(); i++) { QueryItem item = queryItems.at(i); diff --git a/src/lib/autofill/autofillmodel.h b/src/lib/autofill/autofillmodel.h index aa431c3aa..437be38fd 100644 --- a/src/lib/autofill/autofillmodel.h +++ b/src/lib/autofill/autofillmodel.h @@ -18,6 +18,7 @@ #ifndef AUTOFILLMODEL_H #define AUTOFILLMODEL_H +#include #include #include "qz_namespace.h" diff --git a/src/lib/bookmarks/bookmarksmanager.cpp b/src/lib/bookmarks/bookmarksmanager.cpp index de6f916eb..50e978d51 100644 --- a/src/lib/bookmarks/bookmarksmanager.cpp +++ b/src/lib/bookmarks/bookmarksmanager.cpp @@ -169,7 +169,7 @@ void BookmarksManager::changeIcon() QIcon icon; IconChooser chooser(this); - icon = chooser.exec(); + icon = chooser.getIcon(); if (!icon.isNull()) { m_bookmarksModel->changeIcon(id, icon); diff --git a/src/lib/bookmarks/bookmarksmanager.h b/src/lib/bookmarks/bookmarksmanager.h index 272814cda..76f9dfdd2 100644 --- a/src/lib/bookmarks/bookmarksmanager.h +++ b/src/lib/bookmarks/bookmarksmanager.h @@ -19,7 +19,7 @@ #define BOOKMARKSMANAGER_H #include -#include +#include #include "bookmarksmodel.h" #include "qz_namespace.h" @@ -84,7 +84,7 @@ private: bool m_isRefreshing; Ui::BookmarksManager* ui; - QWeakPointer p_QupZilla; + QPointer p_QupZilla; BookmarksModel* m_bookmarksModel; }; diff --git a/src/lib/cookies/cookiejar.cpp b/src/lib/cookies/cookiejar.cpp index e7f682940..e729f06cf 100644 --- a/src/lib/cookies/cookiejar.cpp +++ b/src/lib/cookies/cookiejar.cpp @@ -20,6 +20,7 @@ #include "mainapplication.h" #include "settings.h" +#include #include #include diff --git a/src/lib/cookies/cookiemanager.cpp b/src/lib/cookies/cookiemanager.cpp index 199a74a1d..4d3a7271a 100644 --- a/src/lib/cookies/cookiemanager.cpp +++ b/src/lib/cookies/cookiemanager.cpp @@ -23,6 +23,7 @@ #include "globalfunctions.h" #include "settings.h" +#include #include #include #include @@ -153,7 +154,7 @@ void CookieManager::slotRefreshTable() ui->cookieTree->clear(); int counter = 0; - QWeakPointer guard = this; + QPointer guard = this; QHash hash; for (int i = 0; i < allCookies.count(); ++i) { const QNetworkCookie &cookie = allCookies.at(i); diff --git a/src/lib/desktopnotifications/desktopnotificationsfactory.h b/src/lib/desktopnotifications/desktopnotificationsfactory.h index 83a127af0..d03651ea8 100644 --- a/src/lib/desktopnotifications/desktopnotificationsfactory.h +++ b/src/lib/desktopnotifications/desktopnotificationsfactory.h @@ -22,7 +22,7 @@ #include #include -#include +#include class QPixmap; @@ -48,7 +48,7 @@ private: Type m_notifType; QPoint m_position; - QWeakPointer m_desktopNotif; + QPointer m_desktopNotif; quint32 m_uint; }; diff --git a/src/lib/downloads/downloadfilehelper.cpp b/src/lib/downloads/downloadfilehelper.cpp index e805b3c98..93258d847 100644 --- a/src/lib/downloads/downloadfilehelper.cpp +++ b/src/lib/downloads/downloadfilehelper.cpp @@ -32,7 +32,12 @@ #include #include #include + +#if QT_VERSION >= 0x050000 +#include +#else #include +#endif DownloadFileHelper::DownloadFileHelper(const QString &lastDownloadPath, const QString &downloadPath, bool useNativeDialog) : QObject() @@ -165,12 +170,22 @@ void DownloadFileHelper::optionsDialogAccepted(int finish) dialog->selectFile(m_h_fileName); QList urls; - urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::HomeLocation)) + urls << +#if QT_VERSION >= 0x050000 + QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)) + << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)) + << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)) + << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)) + << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::MusicLocation)) + << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::MoviesLocation)); +#else + QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::HomeLocation)) << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)) << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)) << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::PicturesLocation)) << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MusicLocation)) << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation)); +#endif dialog->setSidebarUrls(urls); dialog->show(); diff --git a/src/lib/history/historymanager.h b/src/lib/history/historymanager.h index 401a3aa1e..66793756f 100644 --- a/src/lib/history/historymanager.h +++ b/src/lib/history/historymanager.h @@ -19,7 +19,7 @@ #define HISTORYMANAGER_H #include -#include +#include #include "qz_namespace.h" #include "historyview.h" @@ -58,7 +58,7 @@ private: QupZilla* getQupZilla(); Ui::HistoryManager* ui; - QWeakPointer p_QupZilla; + QPointer p_QupZilla; }; #endif // HISTORYMANAGER_H diff --git a/src/lib/lib.pro b/src/lib/lib.pro index 6ac168f8e..095b1aafa 100644 --- a/src/lib/lib.pro +++ b/src/lib/lib.pro @@ -1,4 +1,9 @@ -QT += core gui webkit sql network script +isEqual(QT_MAJOR_VERSION, 5) { + QT += webkitwidgets network widgets printsupport sql script +} else { + QT += core gui webkit sql network script +} + TARGET = QupZilla TEMPLATE = lib diff --git a/src/lib/navigation/locationbar.cpp b/src/lib/navigation/locationbar.cpp index 4ec67c961..d50fde91c 100644 --- a/src/lib/navigation/locationbar.cpp +++ b/src/lib/navigation/locationbar.cpp @@ -40,6 +40,7 @@ #include "qzsettings.h" #include "colors.h" +#include #include #include #include diff --git a/src/lib/navigation/siteicon.cpp b/src/lib/navigation/siteicon.cpp index b0809560a..67ccdf4c4 100644 --- a/src/lib/navigation/siteicon.cpp +++ b/src/lib/navigation/siteicon.cpp @@ -20,6 +20,8 @@ #include "tabbedwebview.h" #include "globalfunctions.h" +#include +#include #include #include diff --git a/src/lib/navigation/websearchbar.cpp b/src/lib/navigation/websearchbar.cpp index 42a759ac3..1cad06d36 100644 --- a/src/lib/navigation/websearchbar.cpp +++ b/src/lib/navigation/websearchbar.cpp @@ -29,6 +29,8 @@ #include "searchenginesdialog.h" #include "networkmanager.h" +#include +#include #include #include #include diff --git a/src/lib/navigation/websearchbar.h b/src/lib/navigation/websearchbar.h index 4f7891562..c57e476f2 100644 --- a/src/lib/navigation/websearchbar.h +++ b/src/lib/navigation/websearchbar.h @@ -18,7 +18,7 @@ #ifndef WEBSEARCHBAR_H #define WEBSEARCHBAR_H -#include +#include #include "qz_namespace.h" #include "lineedit.h" @@ -91,7 +91,7 @@ private: WebSearchBar_Button* m_buttonSearch; ButtonWithMenu* m_boxSearchType; SearchEnginesManager* m_searchManager; - QWeakPointer m_searchDialog; + QPointer m_searchDialog; QAction* m_pasteAndGoAction; QAction* m_clearAction; diff --git a/src/lib/network/networkmanager.cpp b/src/lib/network/networkmanager.cpp index b7ad191eb..eb49d719b 100644 --- a/src/lib/network/networkmanager.cpp +++ b/src/lib/network/networkmanager.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -130,7 +129,7 @@ void NetworkManager::setSSLConfiguration(QNetworkReply* reply) { if (!reply->sslConfiguration().isNull()) { QSslCertificate cert = reply->sslConfiguration().peerCertificate(); - if (!cert.isValid() || reply->property("downReply").toBool()) { + if (!qz_isCertificateValid(cert) || reply->property("downReply").toBool()) { return; } @@ -269,7 +268,7 @@ void NetworkManager::authentication(QNetworkReply* reply, QAuthenticator* auth) connect(box, SIGNAL(accepted()), dialog, SLOT(accept())); label->setText(tr("A username and password are being requested by %1. " - "The site says: \"%2\"").arg(reply->url().toEncoded(), Qt::escape(auth->realm()))); + "The site says: \"%2\"").arg(reply->url().toEncoded(), qz_escape(auth->realm()))); formLa->addRow(label); formLa->addRow(userLab, user); diff --git a/src/lib/network/schemehandlers/adblockschemehandler.cpp b/src/lib/network/schemehandlers/adblockschemehandler.cpp index 29c5b6d39..6374f23ab 100644 --- a/src/lib/network/schemehandlers/adblockschemehandler.cpp +++ b/src/lib/network/schemehandlers/adblockschemehandler.cpp @@ -22,6 +22,10 @@ #include #include +#if QT_VERSION >= 0x050000 +#include +#endif + AdBlockSchemeHandler::AdBlockSchemeHandler() : SchemeHandler() { @@ -36,7 +40,12 @@ QNetworkReply* AdBlockSchemeHandler::createRequest(QNetworkAccessManager::Operat } const QUrl &url = request.url(); - const QList > queryItems = url.queryItems(); + const QList > queryItems = +#if QT_VERSION >= 0x050000 + QUrlQuery(url).queryItems(); +#else + url.queryItems(); +#endif QString subscriptionTitle; QString subscriptionUrl; diff --git a/src/lib/network/schemehandlers/qupzillaschemehandler.cpp b/src/lib/network/schemehandlers/qupzillaschemehandler.cpp index 0397320aa..eb5b0c4f9 100644 --- a/src/lib/network/schemehandlers/qupzillaschemehandler.cpp +++ b/src/lib/network/schemehandlers/qupzillaschemehandler.cpp @@ -27,7 +27,6 @@ #include "settings.h" #include "iconprovider.h" -#include #include #include #include @@ -191,7 +190,7 @@ QString QupZillaSchemeReply::aboutPage() aPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png")); aPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png")); aPage.replace(QLatin1String("%ABOUT-IMG%"), QLatin1String("qrc:icons/other/about.png")); - aPage.replace(QLatin1String("%COPYRIGHT-INCLUDE%"), Qt::escape(qz_readAllFileContents(":html/copyright"))); + aPage.replace(QLatin1String("%COPYRIGHT-INCLUDE%"), qz_escape(qz_readAllFileContents(":html/copyright"))); aPage.replace(QLatin1String("%TITLE%"), tr("About QupZilla")); aPage.replace(QLatin1String("%ABOUT-QUPZILLA%"), tr("About QupZilla")); @@ -420,7 +419,7 @@ QString QupZillaSchemeReply::configPage() foreach(const Plugins::Plugin & plugin, availablePlugins) { PluginSpec spec = plugin.pluginSpec; pluginsString.append(QString("%1%2%3%4").arg( - spec.name, spec.version, Qt::escape(spec.author), spec.description)); + spec.name, spec.version, qz_escape(spec.author), spec.description)); } if (pluginsString.isEmpty()) { @@ -462,7 +461,7 @@ QString QupZillaSchemeReply::configPage() keyString = QLatin1String("\"empty\""); } - groupString.append(QString("%1%2").arg(key, Qt::escape(keyString))); + groupString.append(QString("%1%2").arg(key, qz_escape(keyString))); } settings->endGroup(); diff --git a/src/lib/opensearch/editsearchengine.cpp b/src/lib/opensearch/editsearchengine.cpp index 7ee292097..5f3042d71 100644 --- a/src/lib/opensearch/editsearchengine.cpp +++ b/src/lib/opensearch/editsearchengine.cpp @@ -89,7 +89,7 @@ void EditSearchEngine::hideIconLabels() void EditSearchEngine::chooseIcon() { IconChooser chooser(this); - QIcon icon = chooser.exec(); + QIcon icon = chooser.getIcon(); if (!icon.isNull()) { setIcon(icon); diff --git a/src/lib/opensearch/opensearchengine.cpp b/src/lib/opensearch/opensearchengine.cpp index dc7a21597..bb144a26e 100644 --- a/src/lib/opensearch/opensearchengine.cpp +++ b/src/lib/opensearch/opensearchengine.cpp @@ -48,6 +48,11 @@ #include #include +#if QT_VERSION >= 0x050000 +#include +#endif + + /*! \class OpenSearchEngine \brief A class representing a single search engine described in OpenSearch format @@ -226,12 +231,22 @@ QUrl OpenSearchEngine::searchUrl(const QString &searchTerm) const QUrl retVal = QUrl::fromEncoded(parseTemplate(searchTerm, m_searchUrlTemplate).toUtf8()); +#if QT_VERSION >= 0x050000 + QUrlQuery query(retVal); +#endif if (m_searchMethod != QLatin1String("post")) { Parameters::const_iterator end = m_searchParameters.constEnd(); Parameters::const_iterator i = m_searchParameters.constBegin(); for (; i != end; ++i) { +#if QT_VERSION >= 0x050000 + query.addQueryItem(i->first, parseTemplate(searchTerm, i->second)); +#else retVal.addQueryItem(i->first, parseTemplate(searchTerm, i->second)); +#endif } +#if QT_VERSION >= 0x050000 + retVal.setQuery(query); +#endif } return retVal; @@ -286,12 +301,22 @@ QUrl OpenSearchEngine::suggestionsUrl(const QString &searchTerm) const QUrl retVal = QUrl::fromEncoded(parseTemplate(searchTerm, m_suggestionsUrlTemplate).toUtf8()); +#if QT_VERSION >= 0x050000 + QUrlQuery query(retVal); +#endif if (m_suggestionsMethod != QLatin1String("post")) { Parameters::const_iterator end = m_suggestionsParameters.constEnd(); Parameters::const_iterator i = m_suggestionsParameters.constBegin(); for (; i != end; ++i) { +#if QT_VERSION >= 0x050000 + query.addQueryItem(i->first, parseTemplate(searchTerm, i->second)); +#else retVal.addQueryItem(i->first, parseTemplate(searchTerm, i->second)); +#endif } +#if QT_VERSION >= 0x050000 + retVal.setQuery(query); +#endif } return retVal; diff --git a/src/lib/opensearch/searchenginesmanager.cpp b/src/lib/opensearch/searchenginesmanager.cpp index 049c2aca7..f6bcfd243 100644 --- a/src/lib/opensearch/searchenginesmanager.cpp +++ b/src/lib/opensearch/searchenginesmanager.cpp @@ -32,6 +32,10 @@ #include #include +#if QT_VERSION >= 0x050000 +#include +#endif + #define ENSURE_LOADED if (!m_settingsLoaded) loadSettings(); QIcon SearchEnginesManager::iconForSearchEngine(const QUrl &url) @@ -224,7 +228,21 @@ void SearchEnginesManager::addEngineFromForm(const QWebElement &element, WebView if (actionUrl.isRelative()) { actionUrl = view->url().resolved(actionUrl); } +#if QT_VERSION >= 0x050000 + QUrlQuery query(actionUrl); + query.addQueryItem(element.attribute("name"), "%s"); + QWebElementCollection allInputs = formElement.findAll("input"); + foreach(QWebElement e, allInputs) { + if (element == e || !e.hasAttribute("name")) { + continue; + } + + query.addQueryItem(e.attribute("name"), e.evaluateJavaScript("this.value").toString()); + } + + actionUrl.setQuery(query); +#else actionUrl.addQueryItem(element.attribute("name"), "%s"); QList > queryItems; @@ -242,6 +260,7 @@ void SearchEnginesManager::addEngineFromForm(const QWebElement &element, WebView } actionUrl.setEncodedQueryItems(queryItems + actionUrl.encodedQueryItems()); +#endif SearchEngine engine; engine.name = view->title(); diff --git a/src/lib/other/clearprivatedata.cpp b/src/lib/other/clearprivatedata.cpp index 6a48d5ff5..b6e8c5343 100644 --- a/src/lib/other/clearprivatedata.cpp +++ b/src/lib/other/clearprivatedata.cpp @@ -28,6 +28,7 @@ #include "iconprovider.h" #include "globalfunctions.h" +#include #include #include #include diff --git a/src/lib/other/iconchooser.cpp b/src/lib/other/iconchooser.cpp index ca9ae590d..968fa6c7c 100644 --- a/src/lib/other/iconchooser.cpp +++ b/src/lib/other/iconchooser.cpp @@ -75,7 +75,7 @@ void IconChooser::searchIcon(const QString &string) } } -QIcon IconChooser::exec() +QIcon IconChooser::getIcon() { QIcon icon; int status = QDialog::exec(); diff --git a/src/lib/other/iconchooser.h b/src/lib/other/iconchooser.h index ad7bb7502..51f153fae 100644 --- a/src/lib/other/iconchooser.h +++ b/src/lib/other/iconchooser.h @@ -38,7 +38,7 @@ public: explicit IconChooser(QWidget* parent = 0); ~IconChooser(); - QIcon exec(); + QIcon getIcon(); private slots: void chooseFile(); diff --git a/src/lib/other/pagescreen.cpp b/src/lib/other/pagescreen.cpp index 0d249a9d1..8b751b1f4 100644 --- a/src/lib/other/pagescreen.cpp +++ b/src/lib/other/pagescreen.cpp @@ -25,9 +25,15 @@ #include #include #include -#include #include +#if QT_VERSION >= 0x050000 +#include +#else +#include +#endif + + PageScreen::PageScreen(WebView* view, QWidget* parent) : QDialog(parent) , ui(new Ui::PageScreen) diff --git a/src/lib/other/registerqappassociation.h b/src/lib/other/registerqappassociation.h index 3b83785a9..f9a5a58df 100644 --- a/src/lib/other/registerqappassociation.h +++ b/src/lib/other/registerqappassociation.h @@ -19,6 +19,7 @@ #ifndef REGISTERQAPPASSOCIATION_H #define REGISTERQAPPASSOCIATION_H +#include #include #include diff --git a/src/lib/other/sourceviewer.h b/src/lib/other/sourceviewer.h index 39358ec26..4895bee29 100644 --- a/src/lib/other/sourceviewer.h +++ b/src/lib/other/sourceviewer.h @@ -19,7 +19,7 @@ #define SOURCEVIEWER_H #include -#include +#include #include "qz_namespace.h" @@ -53,7 +53,7 @@ private slots: private: QBoxLayout* m_layout; PlainEditWithLines* m_sourceEdit; - QWeakPointer m_frame; + QPointer m_frame; QStatusBar* m_statusBar; QString m_selectedHtml; diff --git a/src/lib/other/useragentmanager.h b/src/lib/other/useragentmanager.h index c311af636..401c6c512 100644 --- a/src/lib/other/useragentmanager.h +++ b/src/lib/other/useragentmanager.h @@ -19,6 +19,7 @@ #define USERAGENTMANAGER_H #include +#include #include "qz_namespace.h" diff --git a/src/lib/plugins/plugins.h b/src/lib/plugins/plugins.h index 9405fa073..ec5d681e6 100644 --- a/src/lib/plugins/plugins.h +++ b/src/lib/plugins/plugins.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include "qz_namespace.h" #include "plugininterface.h" diff --git a/src/lib/plugins/speeddial.h b/src/lib/plugins/speeddial.h index 9840aa16c..df6102ff1 100644 --- a/src/lib/plugins/speeddial.h +++ b/src/lib/plugins/speeddial.h @@ -19,7 +19,7 @@ #define SPEEDDIAL_H #include -#include +#include #include "qz_namespace.h" @@ -97,7 +97,7 @@ private: int m_sizeOfSpeedDials; int m_sdcentered; - QList > m_webFrames; + QList > m_webFrames; QList m_webPages; bool m_loaded; diff --git a/src/lib/preferences/pluginsmanager.cpp b/src/lib/preferences/pluginsmanager.cpp index 3bfe21983..8c5809637 100644 --- a/src/lib/preferences/pluginsmanager.cpp +++ b/src/lib/preferences/pluginsmanager.cpp @@ -21,10 +21,10 @@ #include "mainapplication.h" #include "plugininterface.h" #include "pluginlistdelegate.h" +#include "globalfunctions.h" #include "settings.h" #include -#include #include #include @@ -177,7 +177,7 @@ void PluginsManager::refresh() } item->setIcon(icon); - QString pluginInfo = QString("%1 %2
%3
%4").arg(spec.name, spec.version, Qt::escape(spec.author), spec.info); + QString pluginInfo = QString("%1 %2
%3
%4").arg(spec.name, spec.version, qz_escape(spec.author), spec.info); item->setToolTip(pluginInfo); item->setText(spec.name); diff --git a/src/lib/preferences/preferences.h b/src/lib/preferences/preferences.h index 0655b1002..914d9d4cc 100644 --- a/src/lib/preferences/preferences.h +++ b/src/lib/preferences/preferences.h @@ -19,7 +19,7 @@ #define PREFERENCES_H #include -#include +#include #include "qz_namespace.h" @@ -98,7 +98,7 @@ private: AutoFillManager* m_autoFillManager; PluginsManager* m_pluginsList; ThemeManager* m_themesManager; - QWeakPointer m_notification; + QPointer m_notification; QString m_homepage; QString m_newTabUrl; diff --git a/src/lib/rss/rssmanager.h b/src/lib/rss/rssmanager.h index 57f07b0d2..932af113c 100644 --- a/src/lib/rss/rssmanager.h +++ b/src/lib/rss/rssmanager.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -72,7 +72,7 @@ private: Ui::RSSManager* ui; QToolButton* m_reloadButton; - QWeakPointer p_QupZilla; + QPointer p_QupZilla; }; #endif // RSSMANAGER_H diff --git a/src/lib/rss/rssnotification.cpp b/src/lib/rss/rssnotification.cpp index 089d33861..1403dcbc7 100644 --- a/src/lib/rss/rssnotification.cpp +++ b/src/lib/rss/rssnotification.cpp @@ -103,7 +103,7 @@ void RSSNotification::addRss() switch (ui->comboBox->itemData(index).toInt()) { case WebApplication: { const RssApp &app = m_rssApps.at(index); - const QUrl &url = QUrl::fromEncoded(QString(app.address + QUrl::toPercentEncoding(m_url.toString())).toAscii()); + const QUrl &url = QUrl::fromEncoded(QString(app.address + QUrl::toPercentEncoding(m_url.toString())).toLatin1()); m_view->openUrlInNewTab(url, Qz::NT_SelectedTab); success = true; diff --git a/src/lib/sidebar/sidebar.cpp b/src/lib/sidebar/sidebar.cpp index 16673778d..125201e51 100644 --- a/src/lib/sidebar/sidebar.cpp +++ b/src/lib/sidebar/sidebar.cpp @@ -26,7 +26,7 @@ #include -QHash > SideBarManager::s_sidebars; +QHash > SideBarManager::s_sidebars; SideBar::SideBar(SideBarManager* manager, QupZilla* mainClass) : QWidget(mainClass) @@ -134,7 +134,7 @@ void SideBarManager::refreshMenu() act->setShortcut(QKeySequence("Ctrl+H")); act->setData("History"); - foreach(const QWeakPointer &sidebar, s_sidebars) { + foreach(const QPointer &sidebar, s_sidebars) { if (!sidebar) { continue; } diff --git a/src/lib/sidebar/sidebar.h b/src/lib/sidebar/sidebar.h index 5eef86e25..76e51a7c3 100644 --- a/src/lib/sidebar/sidebar.h +++ b/src/lib/sidebar/sidebar.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include "qz_namespace.h" @@ -67,7 +67,7 @@ public: void sideBarRemoved(const QString &id); void closeSideBar(); - static QHash > s_sidebars; + static QHash > s_sidebars; static void addSidebar(const QString &id, SideBarInterface* interface); static void removeSidebar(const QString &id); @@ -78,7 +78,7 @@ private: void updateActions(); QupZilla* p_QupZilla; - QWeakPointer m_sideBar; + QPointer m_sideBar; QMenu* m_menu; QString m_activeBar; diff --git a/src/lib/tools/certificateinfowidget.cpp b/src/lib/tools/certificateinfowidget.cpp index 93c0aa595..1b3577551 100644 --- a/src/lib/tools/certificateinfowidget.cpp +++ b/src/lib/tools/certificateinfowidget.cpp @@ -18,15 +18,20 @@ #include "certificateinfowidget.h" #include "ui_certificateinfowidget.h" #include "mainapplication.h" +#include "globalfunctions.h" #include -#include #include QString CertificateInfoWidget::certificateItemText(const QSslCertificate &cert) { +#if QT_VERSION >= 0x050000 + QString commonName = cert.subjectInfo(QSslCertificate::CommonName).isEmpty() ? QString() : cert.subjectInfo(QSslCertificate::CommonName).at(0); + QString organization = cert.subjectInfo(QSslCertificate::Organization).isEmpty() ? QString() : cert.subjectInfo(QSslCertificate::Organization).at(0); +#else QString commonName = cert.subjectInfo(QSslCertificate::CommonName); QString organization = cert.subjectInfo(QSslCertificate::Organization); +#endif if (commonName.isEmpty()) { return clearCertSpecialSymbols(organization); @@ -37,7 +42,7 @@ QString CertificateInfoWidget::certificateItemText(const QSslCertificate &cert) QString CertificateInfoWidget::clearCertSpecialSymbols(const QString &string) { - QString n = Qt::escape(string); + QString n = qz_escape(string); if (!n.contains(QLatin1String("\\"))) { return n; @@ -285,6 +290,15 @@ QString CertificateInfoWidget::clearCertSpecialSymbols(const QString &string) return n; } +QString CertificateInfoWidget::clearCertSpecialSymbols(const QStringList &stringList) +{ + if (stringList.isEmpty()) { + return QString(); + } + + return clearCertSpecialSymbols(stringList.at(0)); +} + QString CertificateInfoWidget::showCertInfo(const QString &string) { if (string.isEmpty()) { @@ -295,6 +309,15 @@ QString CertificateInfoWidget::showCertInfo(const QString &string) } } +QString CertificateInfoWidget::showCertInfo(const QStringList &stringList) +{ + if (stringList.isEmpty()) { + return QString(); + } + + return showCertInfo(stringList.at(0)); +} + CertificateInfoWidget::CertificateInfoWidget(const QSslCertificate &cert, QWidget* parent) : QWidget(parent) , ui(new Ui::CertificateInfoWidget) diff --git a/src/lib/tools/certificateinfowidget.h b/src/lib/tools/certificateinfowidget.h index 8b3f27678..657a39011 100644 --- a/src/lib/tools/certificateinfowidget.h +++ b/src/lib/tools/certificateinfowidget.h @@ -35,8 +35,16 @@ public: explicit CertificateInfoWidget(const QSslCertificate &cert, QWidget* parent = 0); ~CertificateInfoWidget(); + // Qt5 compatibility + // QSslCertificate::subjectInfo returns: + // QString in Qt 4 + // QStringList in Qt 5 + // static QString showCertInfo(const QString &string); + static QString showCertInfo(const QStringList &stringList); static QString clearCertSpecialSymbols(const QString &string); + static QString clearCertSpecialSymbols(const QStringList &stringList); + static QString certificateItemText(const QSslCertificate &cert); private: diff --git a/src/lib/tools/globalfunctions.cpp b/src/lib/tools/globalfunctions.cpp index dbfb6192a..4867b269e 100644 --- a/src/lib/tools/globalfunctions.cpp +++ b/src/lib/tools/globalfunctions.cpp @@ -17,6 +17,8 @@ * ============================================================ */ #include "globalfunctions.h" +#include +#include #include #include #include @@ -25,10 +27,15 @@ #include #include #include +#include #include #include #include +#if QT_VERSION >= 0x050000 +#include +#endif + QByteArray qz_pixmapToByteArray(const QPixmap &pix) { QByteArray bytes; @@ -166,11 +173,19 @@ QString qz_urlEncodeQueryString(const QUrl &url) QString returnString = url.toString(QUrl::RemoveQuery | QUrl::RemoveFragment); if (url.hasQuery()) { +#if QT_VERSION >= 0x050000 + returnString += QLatin1Char('?') + url.query(QUrl::FullyEncoded); +#else returnString += QLatin1Char('?') + url.encodedQuery(); +#endif } if (url.hasFragment()) { +#if QT_VERSION >= 0x050000 + returnString += QLatin1Char('#') + url.fragment(QUrl::FullyEncoded); +#else returnString += QLatin1Char('#') + url.encodedFragment(); +#endif } returnString.replace(QLatin1Char(' '), QLatin1String("%20")); @@ -342,6 +357,28 @@ QString QT_QUPZILLA_EXPORT qz_applyDirectionToPage(QString &pageContents) return pageContents; } +// Qt5 migration help functions +bool QT_QUPZILLA_EXPORT qz_isCertificateValid(const QSslCertificate &cert) +{ +#if QT_VERSION >= 0x050000 + const QDateTime currentTime = QDateTime::currentDateTime(); + return currentTime >= cert.effectiveDate() && + currentTime <= cert.expiryDate() && + !cert.isBlacklisted(); +#else + return cert.isValid(); +#endif +} + +QString QT_QUPZILLA_EXPORT qz_escape(const QString &string) +{ +#if QT_VERSION >= 0x050000 + return string.toHtmlEscaped(); +#else + return qz_escape(string); +#endif +} + QString qz_buildSystem() { #ifdef Q_OS_LINUX diff --git a/src/lib/tools/globalfunctions.h b/src/lib/tools/globalfunctions.h index b60e0526e..0a1e5fab6 100644 --- a/src/lib/tools/globalfunctions.h +++ b/src/lib/tools/globalfunctions.h @@ -23,6 +23,7 @@ #include "qz_namespace.h" +class QSslCertificate; class QFontMetrics; class QPixmap; class QIcon; @@ -56,6 +57,10 @@ QString QT_QUPZILLA_EXPORT qz_applyDirectionToPage(QString &pageContents); QString QT_QUPZILLA_EXPORT qz_buildSystem(); +// Qt5 migration help functions +bool QT_QUPZILLA_EXPORT qz_isCertificateValid(const QSslCertificate &cert); +QString QT_QUPZILLA_EXPORT qz_escape(const QString &string); + template bool qz_listContainsIndex(const QList &list, int index) { diff --git a/src/lib/tools/headerview.cpp b/src/lib/tools/headerview.cpp index 571b1f145..78c63cfc0 100644 --- a/src/lib/tools/headerview.cpp +++ b/src/lib/tools/headerview.cpp @@ -25,7 +25,11 @@ HeaderView::HeaderView(QAbstractItemView* parent) , m_parent(parent) , m_menu(0) { +#if QT_VERSION >= 0x050000 + setSectionsMovable(true); +#else setMovable(true); +#endif setStretchLastSection(true); setDefaultAlignment(Qt::AlignLeft); setMinimumSectionSize(60); diff --git a/src/lib/tools/treewidget.cpp b/src/lib/tools/treewidget.cpp index 3ac8a57be..a1984231a 100644 --- a/src/lib/tools/treewidget.cpp +++ b/src/lib/tools/treewidget.cpp @@ -18,6 +18,7 @@ #include "treewidget.h" #include "bookmarksmodel.h" +#include #include #include #include @@ -455,7 +456,10 @@ void TreeWidget::setDragDropReceiver(bool enable, QObject* receiver) viewport()->setAcceptDrops(enable); setDropIndicatorShown(enable); if (enable) { +// TODO: It won't probably work in Qt5 +#if QT_VERSION < 0x050000 model()->setSupportedDragActions(Qt::CopyAction); +#endif connect(this, SIGNAL(folderParentChanged(QString, bool, bool*)), receiver, SLOT(changeFolderParent(QString, bool, bool*))); connect(this, SIGNAL(bookmarkParentChanged(int, QString, QString, bool*)), receiver, SLOT(changeBookmarkParent(int, QString, QString, bool*))); connect(this, SIGNAL(linkWasDroped(QUrl, QString, QVariant, QString, bool*)), receiver, SLOT(bookmarkDropedLink(QUrl, QString, QVariant, QString, bool*))); diff --git a/src/lib/webview/siteinfo.cpp b/src/lib/webview/siteinfo.cpp index 5ccfb81c7..3ea712091 100644 --- a/src/lib/webview/siteinfo.cpp +++ b/src/lib/webview/siteinfo.cpp @@ -146,12 +146,11 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent) } //SECURITY - if (cert.isValid()) { + if (qz_isCertificateValid(cert)) { ui->securityLabel->setText(tr("Connection is Encrypted.")); ui->certLabel->setText(tr("Your connection to this page is secured with this certificate: ")); m_certWidget = new CertificateInfoWidget(cert); ui->certFrame->addWidget(m_certWidget); - } else { ui->securityLabel->setText(tr("Connection Not Encrypted.")); diff --git a/src/lib/webview/siteinfowidget.cpp b/src/lib/webview/siteinfowidget.cpp index ab6dfe5f0..cb8c2021a 100644 --- a/src/lib/webview/siteinfowidget.cpp +++ b/src/lib/webview/siteinfowidget.cpp @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * ============================================================ */ +#include "globalfunctions.h" #include "siteinfowidget.h" #include "ui_siteinfowidget.h" #include "qupzilla.h" @@ -39,7 +40,7 @@ SiteInfoWidget::SiteInfoWidget(QupZilla* mainClass, QWidget* parent) WebPage* webPage = view->page(); QUrl url = view->url(); - if (webPage->sslCertificate().isValid()) { + if (qz_isCertificateValid(webPage->sslCertificate())) { ui->secureLabel->setText(tr("Your connection to this site is secured.")); ui->secureIcon->setPixmap(QPixmap(":/icons/locationbar/accept.png")); } diff --git a/src/lib/webview/tabbar.cpp b/src/lib/webview/tabbar.cpp index e4a1b264f..a4fbf3a13 100644 --- a/src/lib/webview/tabbar.cpp +++ b/src/lib/webview/tabbar.cpp @@ -28,6 +28,7 @@ #include "pluginproxy.h" #include +#include #include #include #include @@ -213,7 +214,6 @@ QSize TabBar::tabSizeHint(int index) const if (maxWidthForTab < PINNED_TAB_WIDTH) { // FIXME: It overflows now - m_normalTabWidth = PINNED_TAB_WIDTH; if (index == currentIndex()) { size.setWidth(m_activeTabWidth); diff --git a/src/lib/webview/tabwidget.cpp b/src/lib/webview/tabwidget.cpp index c9b8abf39..391195765 100644 --- a/src/lib/webview/tabwidget.cpp +++ b/src/lib/webview/tabwidget.cpp @@ -33,6 +33,7 @@ #include #include +#include #include #include #include diff --git a/src/lib/webview/webinspectordockwidget.cpp b/src/lib/webview/webinspectordockwidget.cpp index 55a0204a3..76f4a5b56 100644 --- a/src/lib/webview/webinspectordockwidget.cpp +++ b/src/lib/webview/webinspectordockwidget.cpp @@ -55,7 +55,7 @@ void WebInspectorDockWidget::close() void WebInspectorDockWidget::show() { QWebPage* page = p_QupZilla->weView()->page(); - QWeakPointer inspector = m_inspectors[page]; + QPointer inspector = m_inspectors[page]; if (!inspector) { inspector = new WebInspector(this); diff --git a/src/lib/webview/webinspectordockwidget.h b/src/lib/webview/webinspectordockwidget.h index 1c24d1090..e5159b39c 100644 --- a/src/lib/webview/webinspectordockwidget.h +++ b/src/lib/webview/webinspectordockwidget.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include "qz_namespace.h" @@ -56,9 +56,9 @@ public slots: private: QupZilla* p_QupZilla; - QHash > m_inspectors; + QHash > m_inspectors; - QWeakPointer m_currentInspector; + QPointer m_currentInspector; }; #endif // WEBINSPECTORDOCKWIDGET_H diff --git a/src/lib/webview/webpage.cpp b/src/lib/webview/webpage.cpp index 8bb07dc36..3978430d8 100644 --- a/src/lib/webview/webpage.cpp +++ b/src/lib/webview/webpage.cpp @@ -196,11 +196,11 @@ void WebPage::progress(int prog) { m_loadProgress = prog; - bool secStatus = sslCertificate().isValid(); + bool secStatus = qz_isCertificateValid(sslCertificate()); if (secStatus != m_secureStatus) { m_secureStatus = secStatus; - emit privacyChanged(sslCertificate().isValid()); + emit privacyChanged(qz_isCertificateValid(sslCertificate())); } } @@ -451,7 +451,7 @@ void WebPage::setSSLCertificate(const QSslCertificate &cert) QSslCertificate WebPage::sslCertificate() { - if (url().scheme() == QLatin1String("https") && m_sslCert.isValid()) { + if (url().scheme() == QLatin1String("https") && qz_isCertificateValid(m_sslCert)) { return m_sslCert; } diff --git a/src/lib/webview/webtab.h b/src/lib/webview/webtab.h index 036beca2f..15e50f345 100644 --- a/src/lib/webview/webtab.h +++ b/src/lib/webview/webtab.h @@ -19,7 +19,7 @@ #define WEBTAB_H #include -#include +#include #include #include @@ -102,7 +102,7 @@ private: QupZilla* p_QupZilla; TabbedWebView* m_view; QVBoxLayout* m_layout; - QWeakPointer m_locationBar; + QPointer m_locationBar; SavedTab m_savedTab; diff --git a/src/lib/webview/webview.cpp b/src/lib/webview/webview.cpp index 8c7168658..6a372b530 100644 --- a/src/lib/webview/webview.cpp +++ b/src/lib/webview/webview.cpp @@ -504,7 +504,7 @@ void WebView::searchSelectedText() SearchEngine engine = mApp->searchEnginesManager()->activeEngine(); if (QAction* act = qobject_cast(sender())) { if (act->data().isValid()) { - engine = qVariantValue(act->data()); + engine = act->data().value(); } } @@ -517,7 +517,7 @@ void WebView::searchSelectedTextInBackgroundTab() SearchEngine engine = mApp->searchEnginesManager()->activeEngine(); if (QAction* act = qobject_cast(sender())) { if (act->data().isValid()) { - engine = qVariantValue(act->data()); + engine = act->data().value(); } } diff --git a/src/main/main.cpp b/src/main/main.cpp index d6723df3c..69f539d97 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -31,6 +31,12 @@ #include #include +#if QT_VERSION >= 0x050000 +#include +#else +#include "qwebkitversion.h" +#endif + void qupzilla_signal_handler(int s) { switch (s) { diff --git a/src/main/main.pro b/src/main/main.pro index b11972458..29add2ed3 100644 --- a/src/main/main.pro +++ b/src/main/main.pro @@ -1,4 +1,8 @@ -QT += core gui webkit sql network script +isEqual(QT_MAJOR_VERSION, 5) { + QT += webkitwidgets network widgets printsupport sql script +} else { + QT += core gui webkit sql network script +} TARGET = qupzilla mac: TARGET = QupZilla diff --git a/src/plugins.pri b/src/plugins.pri index 3c28e6c4f..790093e16 100644 --- a/src/plugins.pri +++ b/src/plugins.pri @@ -27,9 +27,14 @@ INCLUDEPATH += $$PWD/lib/3rdparty\ TEMPLATE = lib CONFIG += plugin -QT *= webkit network DESTDIR = $$PWD/../bin/plugins/ +isEqual(QT_MAJOR_VERSION, 5) { + QT *= webkitwidgets network +} else { + QT *= webkit network +} + OBJECTS_DIR = build MOC_DIR = build RCC_DIR = build diff --git a/src/plugins/AccessKeysNavigation/akn_handler.h b/src/plugins/AccessKeysNavigation/akn_handler.h index c7a86fbc8..2520f25d7 100644 --- a/src/plugins/AccessKeysNavigation/akn_handler.h +++ b/src/plugins/AccessKeysNavigation/akn_handler.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include class QKeyEvent; class QWebElement; @@ -57,7 +57,7 @@ private: void makeAccessKeyLabel(const QChar &accessKey, const QWebElement &element); void handleAccessKey(QKeyEvent* event); - QWeakPointer m_view; + QPointer m_view; QList m_accessKeyLabels; QHash m_accessKeyNodes; diff --git a/src/plugins/AccessKeysNavigation/akn_plugin.h b/src/plugins/AccessKeysNavigation/akn_plugin.h index 83ec943d6..c9660ccc7 100644 --- a/src/plugins/AccessKeysNavigation/akn_plugin.h +++ b/src/plugins/AccessKeysNavigation/akn_plugin.h @@ -18,7 +18,7 @@ #ifndef AKN_PLUGIN_H #define AKN_PLUGIN_H -#include +#include #include "plugininterface.h" @@ -44,7 +44,7 @@ public: bool keyPress(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event); private: - QWeakPointer m_settings; + QPointer m_settings; AKN_Handler* m_handler; }; diff --git a/src/plugins/GreaseMonkey/gm_manager.h b/src/plugins/GreaseMonkey/gm_manager.h index f15c5c4be..81cb98cf1 100644 --- a/src/plugins/GreaseMonkey/gm_manager.h +++ b/src/plugins/GreaseMonkey/gm_manager.h @@ -20,7 +20,7 @@ #include #include -#include +#include class QUrl; class QNetworkRequest; @@ -68,7 +68,7 @@ private slots: private: QString m_settingsPath; QString m_bootstrap; - QWeakPointer m_settings; + QPointer m_settings; QStringList m_disabledScripts; QList m_endScripts; diff --git a/src/plugins/MouseGestures/mousegestures.h b/src/plugins/MouseGestures/mousegestures.h index c98a3116f..5168122b2 100644 --- a/src/plugins/MouseGestures/mousegestures.h +++ b/src/plugins/MouseGestures/mousegestures.h @@ -19,7 +19,7 @@ #define MOUSEGESTURES_H #include -#include +#include class QMouseEvent; @@ -56,8 +56,8 @@ private slots: private: QjtMouseGestureFilter* m_filter; - QWeakPointer m_settings; - QWeakPointer m_view; + QPointer m_settings; + QPointer m_view; }; #endif // MOUSEGESTURES_H diff --git a/src/plugins/PIM/PIM_handler.cpp b/src/plugins/PIM/PIM_handler.cpp index 86b4a2cda..e0407cc2e 100644 --- a/src/plugins/PIM/PIM_handler.cpp +++ b/src/plugins/PIM/PIM_handler.cpp @@ -114,7 +114,7 @@ void PIM_Handler::populateWebViewMenu(QMenu* menu, WebView* view, const QWebHitT QMenu* pimMenu = new QMenu(tr("Insert Personal Information")); pimMenu->setIcon(QIcon(":/PIM/data/PIM.png")); - + if (!m_allInfo[PI_FirstName].isEmpty() && !m_allInfo[PI_LastName].isEmpty()) { const QString fullname = m_allInfo[PI_FirstName] + " " + m_allInfo[PI_LastName]; QAction* action = pimMenu->addAction(fullname, this, SLOT(pimInsert())); diff --git a/src/plugins/PIM/PIM_handler.h b/src/plugins/PIM/PIM_handler.h index 9a1ff4eea..7b485cf63 100644 --- a/src/plugins/PIM/PIM_handler.h +++ b/src/plugins/PIM/PIM_handler.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include class WebView; @@ -81,8 +81,8 @@ private: QHash m_infoMatches; QHash m_translations; - QWeakPointer m_settings; - QWeakPointer m_view; + QPointer m_settings; + QPointer m_view; QWebElement m_element; QString m_settingsFile;