remove qt4 code

This commit is contained in:
Helmut K. C. Tessarek 2017-09-13 00:26:56 -04:00 committed by Olivier Goffart
parent 5b01d63491
commit 709aa27031
43 changed files with 16 additions and 369 deletions

View file

@ -510,12 +510,8 @@ restart_sync:
SyncEngine engine(account, options.source_dir, folder, &db);
engine.setIgnoreHiddenFiles(options.ignoreHiddenFiles);
engine.setNetworkLimits(options.uplimit, options.downlimit);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QObject::connect(&engine, &SyncEngine::finished,
[&app](bool result) { app.exit(result ? EXIT_SUCCESS : EXIT_FAILURE); });
#else
QObject::connect(&engine, SIGNAL(finished(bool)), &app, SLOT(quit()));
#endif
QObject::connect(&engine, SIGNAL(transmissionProgress(ProgressInfo)), &cmd, SLOT(transmissionProgressSlot()));

View file

@ -33,17 +33,9 @@
#include <QThread>
#include <QDateTime>
#include <QSysInfo>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include <QTextDocument>
#else
#include <QStandardPaths>
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
#include <QCollator>
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
#include <QSysInfo>
#endif
#ifdef Q_OS_UNIX
@ -248,23 +240,9 @@ QString Utility::compactFormatDouble(double value, int prec, const QString &unit
QString Utility::escape(const QString &in)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
return Qt::escape(in);
#else
return in.toHtmlEscaped();
#endif
}
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
// In Qt 4, QThread::sleep functions are protected.
// This is a hack to make them visible in this namespace.
struct QThread : ::QThread
{
using ::QThread::sleep;
using ::QThread::usleep;
};
#endif
void Utility::sleep(int sec)
{
QThread::sleep(sec);
@ -408,22 +386,7 @@ bool Utility::hasDarkSystray()
QString Utility::platformName()
{
QString re("Windows");
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
if (isMac()) {
re = QLatin1String("MacOSX");
} else if (isLinux()) {
re = QLatin1String("Linux");
} else if (isBSD()) {
re = QLatin1String("BSD");
} else if (isUnix()) {
re = QLatin1String("Unix");
}
#else
re = QSysInfo::prettyProductName();
#endif
return re;
return QSysInfo::prettyProductName();
}
void Utility::crash()
@ -553,16 +516,10 @@ quint64 Utility::StopWatch::durationOfLap(const QString &lapName) const
void Utility::sortFilenames(QStringList &fileNames)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
QCollator collator;
collator.setNumericMode(true);
collator.setCaseSensitivity(Qt::CaseInsensitive);
qSort(fileNames.begin(), fileNames.end(), collator);
#elif QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
fileNames.sort(Qt::CaseInsensitive);
#else
fileNames.sort();
#endif
}
QUrl Utility::concatUrlPath(const QUrl &url, const QString &concatPath,

View file

@ -17,9 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QStandardPaths>
#endif
namespace OCC {
@ -42,15 +40,7 @@ static void setupFavLink_private(const QString &folder)
// and respects the XDG_CONFIG_HOME env variable
QString getUserAutostartDir_private()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QString config = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
#else
QString config = QFile::decodeName(qgetenv("XDG_CONFIG_HOME"));
if (config.isEmpty()) {
config = QDir::homePath() + QLatin1String("/.config");
}
#endif
config += QLatin1String("/autostart/");
return config;
}

View file

@ -221,13 +221,9 @@ QString AccountSettings::selectedFolderAlias() const
void AccountSettings::slotOpenAccountWizard()
{
if (
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
qgetenv("QT_QPA_PLATFORMTHEME") == "appmenu-qt5" ||
// We can't call isSystemTrayAvailable with appmenu-qt5 because it breaks the systemtray
// (issue #4693, #4944)
#endif
QSystemTrayIcon::isSystemTrayAvailable()) {
// We can't call isSystemTrayAvailable with appmenu-qt5 because it breaks the systemtray
// (issue #4693, #4944)
if (qgetenv("QT_QPA_PLATFORMTHEME") == "appmenu-qt5" || QSystemTrayIcon::isSystemTrayAvailable()) {
topLevelWidget()->close();
}
#ifdef Q_OS_MAC

View file

@ -29,10 +29,6 @@
#include "activitydata.h"
#include "activitylistmodel.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
Q_DECLARE_METATYPE(QPointer<OCC::AccountState>)
#endif
namespace OCC {
Q_LOGGING_CATEGORY(lcActivity, "gui.activity", QtInfoMsg)

View file

@ -13,9 +13,7 @@
*/
#include <QtGui>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets>
#endif
#include "activitylistmodel.h"
#include "activitywidget.h"
@ -269,9 +267,7 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList &list)
_notificationsLayout->addWidget(widget);
// _ui->_notifyScroll->setMinimumHeight( widget->height());
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
_ui->_notifyScroll->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContentsOnFirstShow);
#endif
_widgetForNotifId[activity.ident()] = widget;
newNotificationShown = true;
}

View file

@ -122,9 +122,7 @@ Application::Application(int &argc, char **argv)
setOrganizationDomain(QLatin1String(APPLICATION_REV_DOMAIN));
setApplicationName(_theme->appNameGUI());
setWindowIcon(_theme->applicationIcon());
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
setAttribute(Qt::AA_UseHighDpiPixmaps, true);
#endif
parseOptions(arguments());
//no need to waste time;
@ -134,15 +132,6 @@ Application::Application(int &argc, char **argv)
if (isRunning())
return;
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) && QT_VERSION < QT_VERSION_CHECK(5, 4, 2)
// Workaround for QTBUG-44576: Make sure a stale QSettings lock file
// is deleted. (Introduced in Qt 5.4.0 and fixed in Qt 5.4.2)
{
QString lockFilePath = ConfigFile().configFile() + QLatin1String(".lock");
QLockFile(lockFilePath).removeStaleLockFile();
}
#endif
#if defined(WITH_CRASHREPORTER)
if (ConfigFile().crashReporter())
_crashHandler.reset(new CrashReporter::Handler(QDir::tempPath(), true, CRASHREPORTER_EXECUTABLE));
@ -507,9 +496,7 @@ void Application::showVersion()
stream << "Git revision " << GIT_SHA1 << endl;
#endif
stream << "Using Qt " << qVersion() << ", built against Qt " << QT_VERSION_STR << endl;
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
stream << "Using '" << QSslSocket::sslLibraryVersionString() << "'" << endl;
#endif
displayHelpText(helpText);
}
@ -604,10 +591,6 @@ void Application::setupTranslations()
if (property("ui_lang").isNull())
setProperty("ui_lang", "C");
}
// Work around Qt 5 < 5.5.0 regression, see https://bugreports.qt.io/browse/QTBUG-43447
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) && QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
setLayoutDirection(QApplication::tr("QT_LAYOUT_DIRECTION") == QLatin1String("RTL") ? Qt::RightToLeft : Qt::LeftToRight);
#endif
}
bool Application::giveHelp()

View file

@ -739,9 +739,7 @@ void Folder::slotSyncFinished(bool success)
{
qCInfo(lcFolder) << "Client version" << qPrintable(Theme::instance()->version())
<< " Qt" << qVersion()
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
<< " SSL " << QSslSocket::sslLibraryVersionString().toUtf8().data()
#endif
;
bool syncError = !_syncResult.errorStrings().isEmpty();

View file

@ -138,12 +138,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
opt.rect.setWidth(qMin(opt.rect.width(), hint.width()));
opt.rect.adjust(0, aliasMargin, 0, -aliasMargin);
opt.rect = QStyle::visualRect(option.direction, option.rect, opt.rect);
QApplication::style()->drawControl(QStyle::CE_PushButton, &opt, painter
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
,
option.widget
#endif
);
QApplication::style()->drawControl(QStyle::CE_PushButton, &opt, painter, option.widget);
return;
}
@ -308,11 +303,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
pBRect.setHeight(barHeight);
pBRect.setWidth(overallWidth - 2 * margin);
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QStyleOptionProgressBarV2 pBarOpt;
#else
QStyleOptionProgressBar pBarOpt;
#endif
pBarOpt.state = option.state | QStyle::State_Horizontal;
pBarOpt.minimum = 0;

View file

@ -110,9 +110,7 @@ Qt::ItemFlags FolderStatusModel::flags(const QModelIndex &index) const
switch (classify(index)) {
case AddButton: {
Qt::ItemFlags ret;
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
ret = Qt::ItemNeverHasChildren;
#endif
if (!_accountState->isConnected()) {
return ret;
} else if (_folders.count() == 1) {
@ -125,11 +123,7 @@ Qt::ItemFlags FolderStatusModel::flags(const QModelIndex &index) const
return Qt::ItemIsEnabled | ret;
}
case FetchLabel:
return Qt::ItemIsEnabled
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
| Qt::ItemNeverHasChildren
#endif
;
return Qt::ItemIsEnabled | Qt::ItemNeverHasChildren;
case RootFolder:
return Qt::ItemIsEnabled;
case SubFolder:

View file

@ -163,14 +163,6 @@ private:
*/
QMap<QPersistentModelIndex, QElapsedTimer> _fetchingItems;
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
//the roles argument was added in Qt5
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>())
{
emit QAbstractItemModel::dataChanged(topLeft, bottomRight);
}
#endif
signals:
void dirtyChanged();

View file

@ -161,11 +161,9 @@ FolderWizardRemotePath::FolderWizardRemotePath(const AccountPtr &account)
_lscolTimer.setSingleShot(true);
connect(&_lscolTimer, SIGNAL(timeout()), SLOT(slotLsColFolderEntry()));
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
_ui.folderTreeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
// Make sure that there will be a scrollbar when the contents is too wide
_ui.folderTreeWidget->header()->setStretchLastSection(false);
#endif
}
void FolderWizardRemotePath::slotAddRemoteFolder()

View file

@ -103,12 +103,7 @@ QSize GeneralSettings::sizeHint() const
void GeneralSettings::loadMiscSettings()
{
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
QScopedValueRollback<bool> scope(_currentlyLoading);
_currentlyLoading = true;
#else
QScopedValueRollback<bool> scope(_currentlyLoading, true);
#endif
ConfigFile cfgFile;
_ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
_ui->desktopNotificationsCheckBox->setChecked(cfgFile.optionalDesktopNotifications());

View file

@ -13,9 +13,7 @@
*/
#include <QtGui>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets>
#endif
#include "issueswidget.h"
#include "configfile.h"

View file

@ -56,11 +56,7 @@ int main(int argc, char **argv)
// We do not define it on linux so the behaviour is kept the same
// as other Qt apps in the desktop environment. (which may or may
// not set this envoronment variable)
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1");
#else
qputenv("QT_DEVICE_PIXEL_RATIO", "auto"); // See #4840, #4994
#endif
#endif // !Q_OS_WIN
#ifdef Q_OS_MAC
@ -132,11 +128,9 @@ int main(int argc, char **argv)
}
return 0;
}
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
// We can't call isSystemTrayAvailable with appmenu-qt5 begause it hides the systemtray
// (issue #4693)
if (qgetenv("QT_QPA_PLATFORMTHEME") != "appmenu-qt5")
// We can't call isSystemTrayAvailable with appmenu-qt5 begause it hides the systemtray
// (issue #4693)
#endif
{
if (!QSystemTrayIcon::isSystemTrayAvailable()) {
// If the systemtray is not there, we will wait one second for it to maybe start

View file

@ -125,27 +125,6 @@ void NetworkSettings::loadBWLimitSettings()
{
ConfigFile cfgFile;
#if QT_VERSION < QT_VERSION_CHECK(5, 3, 3)
// QNAM bandwidth limiting only works with versions of Qt greater or equal to 5.3.3
// (It needs Qt commits 097b641 and b99fa32)
const char *v = qVersion(); // "x.y.z";
if (QLatin1String(v) < QLatin1String("5.3.3")) {
QString tooltip = tr("Qt >= 5.4 is required in order to use the bandwidth limit");
_ui->downloadBox->setEnabled(false);
_ui->uploadBox->setEnabled(false);
_ui->downloadBox->setToolTip(tooltip);
_ui->uploadBox->setToolTip(tooltip);
_ui->noDownloadLimitRadioButton->setChecked(true);
_ui->noUploadLimitRadioButton->setChecked(true);
if (cfgFile.useUploadLimit() != 0 || cfgFile.useDownloadLimit() != 0) {
// Update from old mirall that was using neon propagator jobs.
saveBWLimitSettings();
}
return;
}
#endif
int useDownloadLimit = cfgFile.useDownloadLimit();
if (useDownloadLimit >= 1) {
_ui->downloadLimitRadioButton->setChecked(true);

View file

@ -13,9 +13,7 @@
*/
#include <QtGui>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets>
#endif
#include "protocolwidget.h"
#include "configfile.h"

View file

@ -90,12 +90,8 @@ SelectiveSyncWidget::SelectiveSyncWidget(AccountPtr account, QWidget *parent)
_folderTree->setSortingEnabled(true);
_folderTree->sortByColumn(0, Qt::AscendingOrder);
_folderTree->setColumnCount(2);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
_folderTree->header()->setSectionResizeMode(0, QHeaderView::QHeaderView::ResizeToContents);
_folderTree->header()->setSectionResizeMode(1, QHeaderView::QHeaderView::ResizeToContents);
#else
_folderTree->header()->resizeSection(0, sizeHint().width() / 2);
#endif
_folderTree->header()->setStretchLastSection(true);
_folderTree->headerItem()->setText(0, tr("Name"));
_folderTree->headerItem()->setText(1, tr("Size"));

View file

@ -179,9 +179,7 @@ void SettingsDialog::changeEvent(QEvent *e)
switch (e->type()) {
case QEvent::StyleChange:
case QEvent::PaletteChange:
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
case QEvent::ThemeChange:
#endif
customizeStyle();
break;
default:

View file

@ -50,10 +50,7 @@
#include <sqlite3.h>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QStandardPaths>
#endif
// This is the version that is returned when the client asks for the VERSION.
@ -188,16 +185,7 @@ SocketApi::SocketApi(QObject *parent)
socketPath = SOCKETAPI_TEAM_IDENTIFIER_PREFIX APPLICATION_REV_DOMAIN ".socketApi";
} else if (Utility::isLinux() || Utility::isBSD()) {
QString runtimeDir;
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
runtimeDir = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
#else
runtimeDir = QFile::decodeName(qgetenv("XDG_RUNTIME_DIR"));
if (runtimeDir.isEmpty()) {
runtimeDir = QDir::tempPath() + QLatin1String("/runtime-")
+ QString::fromLocal8Bit(qgetenv("USER"));
QDir().mkdir(runtimeDir);
}
#endif
socketPath = runtimeDir + "/" + Theme::instance()->appName() + "/socket";
} else {
qCWarning(lcSocketApi) << "An unexpected system detected, this probably won't work.";

View file

@ -84,15 +84,11 @@ QMenu *SslButton::buildCertMenu(QMenu *parent, const QSslCertificate &cert,
if (issuer.isEmpty())
issuer = QStringList(cert.issuerInfo(QSslCertificate::OrganizationalUnitName)).join(QChar(';'));
QString sha1 = Utility::formatFingerprint(cert.digest(QCryptographicHash::Sha1).toHex(), false);
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QString md5 = Utility::formatFingerprint(cert.digest(QCryptographicHash::Md5).toHex(), false);
#else
QByteArray sha265hash = cert.digest(QCryptographicHash::Sha256).toHex();
QString sha256escaped =
Utility::escape(Utility::formatFingerprint(sha265hash.left(sha265hash.length() / 2), false))
+ QLatin1String("<br/>")
+ Utility::escape(Utility::formatFingerprint(sha265hash.mid(sha265hash.length() / 2), false));
#endif
QString serial = QString::fromUtf8(cert.serialNumber());
QString effectiveDate = cert.effectiveDate().date().toString();
QString expiryDate = cert.expiryDate().date().toString();
@ -126,11 +122,8 @@ QMenu *SslButton::buildCertMenu(QMenu *parent, const QSslCertificate &cert,
stream << tr("<h3>Fingerprints</h3>");
stream << QLatin1String("<table>");
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
stream << addCertDetailsField(tr("MD 5:"), Utility::escape(md5));
#else
stream << addCertDetailsField(tr("SHA-256:"), sha256escaped);
#endif
stream << addCertDetailsField(tr("SHA-1:"), Utility::escape(sha1));
stream << QLatin1String("</table>");
@ -218,11 +211,9 @@ void SslButton::slotUpdateMenu()
+ ", " + account->_sessionCipher.encryptionMethod();
_menu->addAction(sslVersion)->setEnabled(false);
#if QT_VERSION > QT_VERSION_CHECK(5, 2, 0)
if (account->_sessionTicket.isEmpty()) {
_menu->addAction(tr("No support for SSL session tickets/identifiers"))->setEnabled(false);
}
#endif
QList<QSslCertificate> chain = account->_peerCertificateChain;

View file

@ -16,9 +16,7 @@
#include <QtGui>
#include <QtNetwork>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets>
#endif
#include "ui_sslerrordialog.h"
@ -27,12 +25,10 @@ namespace OCC {
Q_LOGGING_CATEGORY(lcSslErrorDialog, "gui.sslerrordialog", QtInfoMsg)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
namespace Utility {
// Used for QSSLCertificate::subjectInfo which returns a QStringList in Qt5, but a QString in Qt4
QString escape(const QStringList &l) { return escape(l.join(';')); }
}
#endif
bool SslDialogErrorHandler::handleErrors(QList<QSslError> errors, const QSslConfiguration &conf, QList<QSslCertificate> *certs, AccountPtr account)
{

View file

@ -23,9 +23,7 @@
#include <QtCore>
#include <QtNetwork>
#include <QtGui>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets>
#endif
#include <stdio.h>

View file

@ -27,22 +27,11 @@ OwncloudConnectionMethodDialog::OwncloudConnectionMethodDialog(QWidget *parent)
connect(ui->btnNoTLS, SIGNAL(clicked(bool)), this, SLOT(returnNoTLS()));
connect(ui->btnClientSideTLS, SIGNAL(clicked(bool)), this, SLOT(returnClientSideTLS()));
connect(ui->btnBack, SIGNAL(clicked(bool)), this, SLOT(returnBack()));
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
// We support only from Qt 5.4.x because of https://doc.qt.io/qt-5/qsslcertificate.html#importPkcs12
ui->btnClientSideTLS->hide();
#endif
}
void OwncloudConnectionMethodDialog::setUrl(const QUrl &url)
{
ui->label->setText(tr("<html><head/><body><p>Failed to connect to the secure server address <em>%1</em>. How do you wish to proceed?</p></body></html>")
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
.arg(OCC::Utility::escape(url.toString())));
#else
.arg(url.toDisplayString().toHtmlEscaped()));
#endif
ui->label->setText(tr("<html><head/><body><p>Failed to connect to the secure server address <em>%1</em>. How do you wish to proceed?</p></body></html>").arg(url.toDisplayString().toHtmlEscaped()));
}

View file

@ -267,10 +267,8 @@ void OwncloudSetupPage::setErrorString(const QString &err, bool retryHTTPonly)
wizard()->next();
} break;
case OwncloudConnectionMethodDialog::Client_Side_TLS:
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
addCertDial->show();
connect(addCertDial, SIGNAL(accepted()), this, SLOT(slotCertificateAccepted()));
#endif
break;
case OwncloudConnectionMethodDialog::Closed:
case OwncloudConnectionMethodDialog::Back:
@ -305,17 +303,12 @@ void OwncloudSetupPage::stopSpinner()
QString subjectInfoHelper(const QSslCertificate &cert, const QByteArray &qa)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
return cert.subjectInfo(qa);
#else
return cert.subjectInfo(qa).join(QLatin1Char('/'));
#endif
}
//called during the validation of the client certificate.
void OwncloudSetupPage::slotCertificateAccepted()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
QList<QSslCertificate> clientCaCertificates;
QFile certFile(addCertDial->getCertificatePath());
certFile.open(QFile::ReadOnly);
@ -344,7 +337,6 @@ void OwncloudSetupPage::slotCertificateAccepted()
addCertDial->showErrorMessage("Could not load certificate");
addCertDial->show();
}
#endif
}
OwncloudSetupPage::~OwncloudSetupPage()

View file

@ -103,9 +103,7 @@ void AbstractNetworkJob::setPath(const QString &path)
void AbstractNetworkJob::setupConnections(QNetworkReply *reply)
{
connect(reply, SIGNAL(finished()), SLOT(slotFinished()));
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
connect(reply, SIGNAL(encrypted()), SIGNAL(networkActivity()));
#endif
connect(reply->manager(), SIGNAL(proxyAuthenticationRequired(QNetworkProxy, QAuthenticator *)), SIGNAL(networkActivity()));
connect(reply, SIGNAL(sslErrors(QList<QSslError>)), SIGNAL(networkActivity()));
connect(reply, SIGNAL(metaDataChanged()), SIGNAL(networkActivity()));
@ -364,13 +362,7 @@ QString networkReplyErrorString(const QNetworkReply &reply)
return base;
}
return AbstractNetworkJob::tr("Server replied \"%1 %2\" to \"%3 %4\"").arg(QString::number(httpStatus), httpReason, requestVerb(reply),
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
reply.request().url().toString()
#else
reply.request().url().toDisplayString()
#endif
);
return AbstractNetworkJob::tr("Server replied \"%1 %2\" to \"%3 %4\"").arg(QString::number(httpStatus), httpReason, requestVerb(reply), reply.request().url().toDisplayString());
}
} // namespace OCC

View file

@ -34,7 +34,7 @@ Q_LOGGING_CATEGORY(lcAccessManager, "sync.accessmanager", QtInfoMsg)
AccessManager::AccessManager(QObject *parent)
: QNetworkAccessManager(parent)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) && defined(Q_OS_MAC)
#if defined(Q_OS_MAC)
// FIXME Workaround http://stackoverflow.com/a/15707366/2941 https://bugreports.qt-project.org/browse/QTBUG-30434
QNetworkProxy proxy = this->proxy();
proxy.setHostName(" ");

View file

@ -261,12 +261,10 @@ QSslConfiguration Account::getOrCreateSslConfig()
// "An internal error number 1060 happened. SSL handshake failed, client certificate was requested: SSL error: sslv3 alert handshake failure"
QSslConfiguration sslConfig = QSslConfiguration::defaultConfiguration();
#if QT_VERSION > QT_VERSION_CHECK(5, 2, 0)
// Try hard to re-use session for different requests
sslConfig.setSslOption(QSsl::SslOptionDisableSessionTickets, false);
sslConfig.setSslOption(QSsl::SslOptionDisableSessionSharing, false);
sslConfig.setSslOption(QSsl::SslOptionDisableSessionPersistence, false);
#endif
return sslConfig;
}

View file

@ -226,12 +226,9 @@ void HttpCredentials::slotReadClientKeyPEMJobDone(QKeychain::Job *incoming)
if (_clientSslKey.isNull()) {
_clientSslKey = QSslKey(clientKeyPEM, QSsl::Dsa);
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
// ec keys are Qt 5.5
if (_clientSslKey.isNull()) {
_clientSslKey = QSslKey(clientKeyPEM, QSsl::Ec);
}
#endif
if (_clientSslKey.isNull()) {
qCWarning(lcHttpCredentials) << "Could not load SSL key into Qt!";
}

View file

@ -25,10 +25,6 @@
#include <zlib.h>
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include <qabstractfileengine.h>
#endif
#ifdef Q_OS_WIN
#include <windows.h>
#include <windef.h>
@ -300,9 +296,6 @@ bool FileSystem::uncheckedRenameReplace(const QString &originFileName,
#ifndef Q_OS_WIN
bool success;
QFile orig(originFileName);
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
success = orig.fileEngine()->rename(destinationFileName);
#else
// We want a rename that also overwites. QFile::rename does not overwite.
// Qt 5.1 has QSaveFile::renameOverwrite we could use.
// ### FIXME
@ -316,7 +309,6 @@ bool FileSystem::uncheckedRenameReplace(const QString &originFileName,
if (success) {
success = orig.rename(destinationFileName);
}
#endif
if (!success) {
*errorString = orig.errorString();
qCWarning(lcFileSystem) << "Renaming temp file to final failed: " << *errorString;

View file

@ -26,27 +26,6 @@ namespace OCC {
Q_LOGGING_CATEGORY(lcCsync, "sync.csync", QtInfoMsg)
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
// logging handler.
static void mirallLogCatcher(QtMsgType type, const char *msg)
{
Q_UNUSED(type)
// qDebug() exports to local8Bit, which is not always UTF-8
Logger::instance()->mirallLog(QString::fromLocal8Bit(msg));
}
static void qInstallMessageHandler(QtMsgHandler h)
{
qInstallMsgHandler(h);
}
#elif QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
static void mirallLogCatcher(QtMsgType, const QMessageLogContext &ctx, const QString &message)
{
QByteArray file = ctx.file;
file = file.mid(file.lastIndexOf('/') + 1);
Logger::instance()->mirallLog(QString::fromLocal8Bit(file) + QLatin1Char(':') + QString::number(ctx.line)
+ QLatin1Char(' ') + message);
}
#else
static void mirallLogCatcher(QtMsgType type, const QMessageLogContext &ctx, const QString &message)
{
auto logger = Logger::instance();
@ -54,7 +33,6 @@ static void mirallLogCatcher(QtMsgType type, const QMessageLogContext &ctx, cons
logger->doLog(qFormatLogMessage(type, ctx, message));
}
}
#endif
static void csyncLogCatcher(int verbosity,
const char *function,
@ -91,9 +69,7 @@ Logger::Logger(QObject *parent)
, _logExpire(0)
, _logDebug(false)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
qSetMessagePattern("%{time MM-dd hh:mm:ss:zzz} [ %{type} %{category} ]%{if-debug}\t[ %{function} ]%{endif}:\t%{message}");
#endif
#ifndef NO_MSG_HANDLER
qInstallMessageHandler(mirallLogCatcher);
#else
@ -154,12 +130,8 @@ void Logger::log(Log log)
*/
bool Logger::isNoop() const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
return false;
#else
QMutexLocker lock(const_cast<QMutex *>(&_mutex));
return !_logstream && !_logWindowActivated;
#endif
}

View file

@ -447,11 +447,9 @@ static void mergeSslConfigurationForSslButton(const QSslConfiguration &config, A
if (!config.sessionCipher().isNull()) {
account->_sessionCipher = config.sessionCipher();
}
#if QT_VERSION > QT_VERSION_CHECK(5, 2, 0)
if (config.sessionTicket().length() > 0) {
account->_sessionTicket = config.sessionTicket();
}
#endif
}
void CheckServerJob::encryptedSlot()
@ -486,13 +484,11 @@ void CheckServerJob::metaDataChangedSlot()
bool CheckServerJob::finished()
{
#if QT_VERSION > QT_VERSION_CHECK(5, 2, 0)
if (reply()->request().url().scheme() == QLatin1String("https")
&& reply()->sslConfiguration().sessionTicket().isEmpty()
&& reply()->error() == QNetworkReply::NoError) {
qCWarning(lcCheckServerJob) << "No SSL session identifier / session ticket is used, this might impact sync performance negatively.";
}
#endif
mergeSslConfigurationForSslButton(reply()->sslConfiguration(), account());

View file

@ -450,17 +450,6 @@ private:
AccountPtr _account;
QScopedPointer<PropagateDirectory> _rootJob;
SyncOptions _syncOptions;
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
// access to signals which are protected in Qt4
friend class PropagateDownloadFile;
friend class PropagateItemJob;
friend class PropagateLocalMkdir;
friend class PropagateLocalRename;
friend class PropagateRemoteMove;
friend class PropagateUploadFileV1;
friend class PropagateUploadFileNG;
#endif
};

View file

@ -50,14 +50,6 @@ public:
bool isSequential() const Q_DECL_OVERRIDE;
bool seek(qint64 pos) Q_DECL_OVERRIDE;
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 2)
bool reset() Q_DECL_OVERRIDE
{
emit wasReset();
return QIODevice::reset();
}
#endif
void setBandwidthLimited(bool);
bool isBandwidthLimited() { return _bandwidthLimited; }
void setChoked(bool);
@ -65,9 +57,6 @@ public:
void giveBandwidthQuota(qint64 bwq);
signals:
#if QT_VERSION < 0x050402
void wasReset();
#endif
private:
// The file data

View file

@ -351,17 +351,6 @@ void PropagateUploadFileNG::slotPutFinished()
QNetworkReply::NetworkError err = job->reply()->error();
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 2)
if (err == QNetworkReply::OperationCanceledError && job->reply()->property("owncloud-should-soft-cancel").isValid()) {
// Abort the job and try again later.
// This works around a bug in QNAM wich might reuse a non-empty buffer for the next request.
qCWarning(lcPropagateUpload) << "Forcing job abort on HTTP connection reset with Qt < 5.4.2.";
propagator()->_anotherSyncNeeded = true;
abortWithError(SyncFileItem::SoftError, tr("Forcing job abort on HTTP connection reset with Qt < 5.4.2."));
return;
}
#endif
if (err != QNetworkReply::NoError) {
_item->_httpErrorCode = job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
commonErrorHandling(job);

View file

@ -185,16 +185,6 @@ void PropagateUploadFileV1::slotPutFinished()
QNetworkReply::NetworkError err = job->reply()->error();
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 2)
if (err == QNetworkReply::OperationCanceledError && job->reply()->property("owncloud-should-soft-cancel").isValid()) { // Abort the job and try again later.
// This works around a bug in QNAM wich might reuse a non-empty buffer for the next request.
qCWarning(lcPropagateUpload) << "Forcing job abort on HTTP connection reset with Qt < 5.4.2.";
propagator()->_anotherSyncNeeded = true;
abortWithError(SyncFileItem::SoftError, tr("Forcing job abort on HTTP connection reset with Qt < 5.4.2."));
return;
}
#endif
if (err != QNetworkReply::NoError) {
_item->_httpErrorCode = job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
if (checkForProblemsWithShared(_item->_httpErrorCode,

View file

@ -24,11 +24,7 @@
#include <qdir.h>
#include <qdiriterator.h>
#include <qtemporaryfile.h>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include <qabstractfileengine.h>
#else
#include <qsavefile.h>
#endif
#include <QDateTime>
#include <qstack.h>
#include <QCoreApplication>

View file

@ -795,9 +795,7 @@ void SyncEngine::startSync()
QString verStr("Using Qt ");
verStr.append(qVersion());
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
verStr.append(" SSL library ").append(QSslSocket::sslLibraryVersionString().toUtf8().data());
#endif
verStr.append(" on ").append(Utility::platformName());
qCInfo(lcEngine) << verStr;
@ -1091,16 +1089,8 @@ void SyncEngine::setNetworkLimits(int upload, int download)
_propagator->_uploadLimit = upload;
_propagator->_downloadLimit = download;
int propDownloadLimit = _propagator->_downloadLimit
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
.load()
#endif
;
int propUploadLimit = _propagator->_uploadLimit
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
.load()
#endif
;
int propDownloadLimit = _propagator->_downloadLimit.load();
int propUploadLimit = _propagator->_uploadLimit.load();
if (propDownloadLimit != 0 || propUploadLimit != 0) {
qCInfo(lcEngine) << "Network Limits (down/up) " << propDownloadLimit << propUploadLimit;

View file

@ -173,7 +173,6 @@ QIcon Theme::themeIcon(const QString &name, bool sysTray, bool sysTrayMenuVisibl
QString Theme::hidpiFileName(const QString &fileName, QPaintDevice *dev)
{
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
qreal devicePixelRatio = dev ? dev->devicePixelRatio() : qApp->primaryScreen()->devicePixelRatio();
if (devicePixelRatio <= 1.0) {
return fileName;
@ -189,7 +188,6 @@ QString Theme::hidpiFileName(const QString &fileName, QPaintDevice *dev)
return at2xfileName;
}
}
#endif
return fileName;
}

View file

@ -15,10 +15,6 @@
#include "filesystem.h"
#include "propagatorjobs.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
// poor man QTRY_VERIFY when Qt5 is not available.
#define QTRY_VERIFY(Cond) QTest::qWait(1000); QVERIFY(Cond)
#endif
using namespace OCC;
@ -155,16 +151,6 @@ using namespace OCC;
}
};
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
// Qt4 does not have QTEST_GUILESS_MAIN, so we simulate it.
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
TestChecksumValidator tc;
return QTest::qExec(&tc, argc, argv);
}
#else
QTEST_GUILESS_MAIN(TestChecksumValidator)
#endif
#include "testchecksumvalidator.moc"

View file

@ -6,9 +6,7 @@
*/
#include <qglobal.h>
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
#include <QTemporaryDir>
#endif
#include <QtTest>
#include "common/utility.h"
@ -49,7 +47,6 @@ class TestFolderMan: public QObject
private slots:
void testCheckPathValidityForNewFolder()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
QTemporaryDir dir;
ConfigFile::setConfDir(dir.path()); // we don't want to pollute the user's config file
QVERIFY(dir.isValid());
@ -149,14 +146,10 @@ private slots:
// Should not have the rights
QVERIFY(!folderman->checkPathValidityForNewFolder("/").isNull());
QVERIFY(!folderman->checkPathValidityForNewFolder("/usr/bin/somefolder").isNull());
#else
QSKIP("Test not supported with Qt4", SkipSingle);
#endif
}
void testFindGoodPathForNewSyncFolder()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
// SETUP
QTemporaryDir dir;
@ -197,9 +190,6 @@ private slots:
QString(dirPath + "/ownCloud2/bar"));
QCOMPARE(folderman->findGoodPathForNewSyncFolder(dirPath + "/sub", url),
QString(dirPath + "/sub2"));
#else
QSKIP("Test not supported with Qt4", SkipSingle);
#endif
}
};

View file

@ -5,9 +5,7 @@
*/
#include <QtTest>
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
#include <QTemporaryDir>
#endif
#include "common/utility.h"
@ -156,15 +154,12 @@ private slots:
QVERIFY(fsCasePreserving());
qputenv("OWNCLOUD_TEST_CASE_PRESERVING", "0");
QVERIFY(! fsCasePreserving());
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
qunsetenv("OWNCLOUD_TEST_CASE_PRESERVING");
QVERIFY(isMac() || isWindows() ? fsCasePreserving() : ! fsCasePreserving());
#endif
}
void testFileNamesEqual()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
QTemporaryDir dir;
QVERIFY(dir.isValid());
QDir dir2(dir.path());
@ -190,7 +185,6 @@ private slots:
dir.remove();
qunsetenv("OWNCLOUD_TEST_CASE_PRESERVING");
#endif
}

View file

@ -441,16 +441,6 @@ private slots:
};
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
// Qt4 does not have QTEST_GUILESS_MAIN, so we simulate it.
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
TestXmlParse tc;
return QTest::qExec(&tc, argc, argv);
}
#else
QTEST_GUILESS_MAIN(TestXmlParse)
#endif
#include "testxmlparse.moc"