1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Remove remaining Qt 4 code

This commit is contained in:
David Rosca 2015-10-15 17:57:03 +02:00
parent e604120f49
commit cefe1bce54
24 changed files with 7 additions and 110 deletions

View File

@ -117,7 +117,7 @@ void NetworkManager::authentication(const QUrl &url, QAuthenticator *auth, QWidg
connect(box, SIGNAL(accepted()), dialog, SLOT(accept())); connect(box, SIGNAL(accepted()), dialog, SLOT(accept()));
label->setText(tr("A username and password are being requested by %1. " label->setText(tr("A username and password are being requested by %1. "
"The site says: \"%2\"").arg(url.host(), QzTools::escape(auth->realm()))); "The site says: \"%2\"").arg(url.host(), auth->realm().toHtmlEscaped()));
formLa->addRow(label); formLa->addRow(label);
formLa->addRow(userLab, user); formLa->addRow(userLab, user);

View File

@ -192,7 +192,7 @@ QString QupZillaSchemeReply::aboutPage()
aPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png")); aPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
aPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.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("%ABOUT-IMG%"), QLatin1String("qrc:icons/other/about.png"));
aPage.replace(QLatin1String("%COPYRIGHT-INCLUDE%"), QzTools::escape(QzTools::readAllFileContents(":html/copyright"))); aPage.replace(QLatin1String("%COPYRIGHT-INCLUDE%"), QzTools::readAllFileContents(":html/copyright").toHtmlEscaped());
aPage.replace(QLatin1String("%TITLE%"), tr("About QupZilla")); aPage.replace(QLatin1String("%TITLE%"), tr("About QupZilla"));
aPage.replace(QLatin1String("%ABOUT-QUPZILLA%"), tr("About QupZilla")); aPage.replace(QLatin1String("%ABOUT-QUPZILLA%"), tr("About QupZilla"));
@ -429,7 +429,7 @@ QString QupZillaSchemeReply::configPage()
foreach (const Plugins::Plugin &plugin, availablePlugins) { foreach (const Plugins::Plugin &plugin, availablePlugins) {
PluginSpec spec = plugin.pluginSpec; PluginSpec spec = plugin.pluginSpec;
pluginsString.append(QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td></tr>").arg( pluginsString.append(QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td></tr>").arg(
spec.name, spec.version, QzTools::escape(spec.author), spec.description)); spec.name, spec.version, spec.author.toHtmlEscaped(), spec.description));
} }
if (pluginsString.isEmpty()) { if (pluginsString.isEmpty()) {
@ -471,7 +471,7 @@ QString QupZillaSchemeReply::configPage()
keyString = QLatin1String("\"empty\""); keyString = QLatin1String("\"empty\"");
} }
groupString.append(QString("<tr><td>%1</td><td>%2</td></tr>").arg(key, QzTools::escape(keyString))); groupString.append(QString("<tr><td>%1</td><td>%2</td></tr>").arg(key, keyString.toHtmlEscaped()));
} }
settings->endGroup(); settings->endGroup();

View File

@ -128,7 +128,7 @@ void PluginsManager::refresh()
} }
item->setIcon(icon); item->setIcon(icon);
QString pluginInfo = QString("<b>%1</b> %2<br/><i>%3</i><br/>%4").arg(spec.name, spec.version, QzTools::escape(spec.author), spec.info); QString pluginInfo = QString("<b>%1</b> %2<br/><i>%3</i><br/>%4").arg(spec.name, spec.version, spec.author.toHtmlEscaped(), spec.info);
item->setToolTip(pluginInfo); item->setToolTip(pluginInfo);
item->setText(spec.name); item->setText(spec.name);

View File

@ -37,7 +37,7 @@ QString CertificateInfoWidget::certificateItemText(const QSslCertificate &cert)
QString CertificateInfoWidget::clearCertSpecialSymbols(const QString &string) QString CertificateInfoWidget::clearCertSpecialSymbols(const QString &string)
{ {
QString n = QzTools::escape(string); QString n = string.toHtmlEscaped();
if (!n.contains(QLatin1String("\\"))) { if (!n.contains(QLatin1String("\\"))) {
return n; return n;

View File

@ -39,10 +39,8 @@
#include <QSysInfo> #include <QSysInfo>
#include <QProcess> #include <QProcess>
#include <QMessageBox> #include <QMessageBox>
#if QT_VERSION >= 0x050000
#include <QUrlQuery> #include <QUrlQuery>
#endif
#ifdef QZ_WS_X11 #ifdef QZ_WS_X11
#include <QX11Info> #include <QX11Info>
#include <xcb/xcb.h> #include <xcb/xcb.h>
@ -177,19 +175,11 @@ QString QzTools::urlEncodeQueryString(const QUrl &url)
QString returnString = url.toString(QUrl::RemoveQuery | QUrl::RemoveFragment); QString returnString = url.toString(QUrl::RemoveQuery | QUrl::RemoveFragment);
if (url.hasQuery()) { if (url.hasQuery()) {
#if QT_VERSION >= 0x050000
returnString += QLatin1Char('?') + url.query(QUrl::FullyEncoded); returnString += QLatin1Char('?') + url.query(QUrl::FullyEncoded);
#else
returnString += QLatin1Char('?') + url.encodedQuery();
#endif
} }
if (url.hasFragment()) { if (url.hasFragment()) {
#if QT_VERSION >= 0x050000
returnString += QLatin1Char('#') + url.fragment(QUrl::FullyEncoded); returnString += QLatin1Char('#') + url.fragment(QUrl::FullyEncoded);
#else
returnString += QLatin1Char('#') + url.encodedFragment();
#endif
} }
returnString.replace(QLatin1Char(' '), QLatin1String("%20")); returnString.replace(QLatin1Char(' '), QLatin1String("%20"));
@ -800,28 +790,6 @@ bool QzTools::startExternalProcess(const QString &executable, const QString &arg
return success; return success;
} }
// Qt5 migration help functions
bool QzTools::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 QzTools::escape(const QString &string)
{
#if QT_VERSION >= 0x050000
return string.toHtmlEscaped();
#else
return Qt::escape(string);
#endif
}
void QzTools::setWmClass(const QString &name, const QWidget* widget) void QzTools::setWmClass(const QString &name, const QWidget* widget)
{ {
#ifdef QZ_WS_X11 #ifdef QZ_WS_X11

View File

@ -82,10 +82,6 @@ public:
static QString operatingSystem(); static QString operatingSystem();
// Qt5 migration help functions
static bool isCertificateValid(const QSslCertificate &cert);
static QString escape(const QString &string);
static void setWmClass(const QString &name, const QWidget* widget); static void setWmClass(const QString &name, const QWidget* widget);
template <typename T> template <typename T>

View File

@ -119,7 +119,3 @@ bool AutoScrollPlugin::wheelEvent(const Qz::ObjectName &type, QObject *obj, QWhe
return false; return false;
} }
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(AutoScroll, AutoScrollPlugin)
#endif

View File

@ -27,10 +27,7 @@ class AutoScrollPlugin : public QObject, public PluginInterface
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(PluginInterface) Q_INTERFACES(PluginInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.TestPlugin") Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.TestPlugin")
#endif
public: public:
explicit AutoScrollPlugin(); explicit AutoScrollPlugin();

View File

@ -494,7 +494,3 @@ QString FCM_Plugin::extractOriginFrom(const QString &path)
return origin; return origin;
} }
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(FlashCookieManagerPlugin, FCM_Plugin)
#endif

View File

@ -44,10 +44,7 @@ class FCM_Plugin : public QObject, public PluginInterface
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(PluginInterface) Q_INTERFACES(PluginInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.FlashCookieManager") Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.FlashCookieManager")
#endif
public: public:
explicit FCM_Plugin(); explicit FCM_Plugin();

View File

@ -69,7 +69,3 @@ QTranslator* GnomeKeyringPlugin::getTranslator(const QString &locale)
translator->load(locale, ":/gkp/locale/"); translator->load(locale, ":/gkp/locale/");
return translator; return translator;
} }
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(GnomeKeyringPasswords, GnomeKeyringPlugin)
#endif

View File

@ -26,10 +26,7 @@ class GnomeKeyringPlugin : public QObject, public PluginInterface
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(PluginInterface) Q_INTERFACES(PluginInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.GnomeKeyringPasswords") Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.GnomeKeyringPasswords")
#endif
public: public:
explicit GnomeKeyringPlugin(); explicit GnomeKeyringPlugin();

View File

@ -86,7 +86,3 @@ void GM_Plugin::showSettings(QWidget* parent)
{ {
m_manager->showSettings(parent); m_manager->showSettings(parent);
} }
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(GreaseMonkey, GM_Plugin)
#endif

View File

@ -27,10 +27,7 @@ class GM_Plugin : public QObject, public PluginInterface
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(PluginInterface) Q_INTERFACES(PluginInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.GreaseMonkey") Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.GreaseMonkey")
#endif
public: public:
explicit GM_Plugin(); explicit GM_Plugin();

View File

@ -104,7 +104,3 @@ bool MouseGesturesPlugin::mouseMove(const Qz::ObjectName &type, QObject* obj, QM
return false; return false;
} }
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(MouseGestures, MouseGesturesPlugin)
#endif

View File

@ -25,10 +25,7 @@ class MouseGesturesPlugin : public QObject, public PluginInterface
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(PluginInterface) Q_INTERFACES(PluginInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.MouseGestures") Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.MouseGestures")
#endif
public: public:
MouseGesturesPlugin(); MouseGesturesPlugin();

View File

@ -95,7 +95,3 @@ bool PIM_Plugin::keyPress(const Qz::ObjectName &type, QObject* obj, QKeyEvent* e
return false; return false;
} }
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(PIM, PIM_Plugin)
#endif

View File

@ -29,10 +29,7 @@ class PIM_Plugin : public QObject, public PluginInterface
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(PluginInterface) Q_INTERFACES(PluginInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.PIM") Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.PIM")
#endif
public: public:
PIM_Plugin(); PIM_Plugin();

View File

@ -88,7 +88,3 @@ void StatusBarIconsPlugin::showSettings(QWidget* parent)
SBI_SettingsDialog* dialog = new SBI_SettingsDialog(m_manager, parent); SBI_SettingsDialog* dialog = new SBI_SettingsDialog(m_manager, parent);
dialog->open(); dialog->open();
} }
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(StatusBarIcons, StatusBarIconsPlugin)
#endif

View File

@ -26,10 +26,7 @@ class StatusBarIconsPlugin : public QObject, public PluginInterface
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(PluginInterface) Q_INTERFACES(PluginInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.StatusBarIcons") Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.StatusBarIcons")
#endif
public: public:
explicit StatusBarIconsPlugin(); explicit StatusBarIconsPlugin();

View File

@ -189,7 +189,3 @@ QString TabManagerPlugin::settingsPath()
{ {
return s_settingsPath; return s_settingsPath;
} }
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(TabManager, TabManagerPlugin)
#endif

View File

@ -34,10 +34,7 @@ class TabManagerPlugin : public QObject, public PluginInterface
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(PluginInterface) Q_INTERFACES(PluginInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.TabManagerPlugin") Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.TabManagerPlugin")
#endif
public: public:
explicit TabManagerPlugin(); explicit TabManagerPlugin();

View File

@ -178,11 +178,3 @@ void TestPlugin::actionSlot()
{ {
QMessageBox::information(m_view, tr("Hello"), tr("First plugin action works :-)")); QMessageBox::information(m_view, tr("Hello"), tr("First plugin action works :-)"));
} }
// Export plugin macro
// This macro has to be only in class derived from PluginInterface
// Don't call it in other files!
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(ExamplePlugin, TestPlugin)
#endif

View File

@ -35,10 +35,7 @@ class TestPlugin : public QObject, public PluginInterface
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(PluginInterface) Q_INTERFACES(PluginInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.TestPlugin") Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.TestPlugin")
#endif
public: public:
explicit TestPlugin(); explicit TestPlugin();