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()));
#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
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);
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()
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,
* 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 {
// 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;
}
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
#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)
*/
#include <QtGui>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets>
-#endif
#include "activitylistmodel.h"
#include "activitywidget.h"
_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;
}
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;
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));
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);
}
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()
{
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();
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;
}
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;
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) {
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:
*/
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();
_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()
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());
*/
#include <QtGui>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets>
-#endif
#include "issueswidget.h"
#include "configfile.h"
// 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
}
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
{
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);
*/
#include <QtGui>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets>
-#endif
#include "protocolwidget.h"
#include "configfile.h"
_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"));
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:
#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.
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.";
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();
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>");
+ ", " + 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;
#include <QtGui>
#include <QtNetwork>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets>
-#endif
#include "ui_sslerrordialog.h"
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)
{
#include <QtCore>
#include <QtNetwork>
#include <QtGui>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets>
-#endif
#include <stdio.h>
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()));
}
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:
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);
addCertDial->showErrorMessage("Could not load certificate");
addCertDial->show();
}
-#endif
}
OwncloudSetupPage::~OwncloudSetupPage()
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()));
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
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(" ");
// "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;
}
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!";
}
#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>
#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
if (success) {
success = orig.rename(destinationFileName);
}
-#endif
if (!success) {
*errorString = orig.errorString();
qCWarning(lcFileSystem) << "Renaming temp file to final failed: " << *errorString;
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();
logger->doLog(qFormatLogMessage(type, ctx, message));
}
}
-#endif
static void csyncLogCatcher(int verbosity,
const char *function,
, _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
*/
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
}
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()
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());
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
};
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);
void giveBandwidthQuota(qint64 bwq);
signals:
-#if QT_VERSION < 0x050402
- void wasReset();
-#endif
private:
// The file data
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);
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,
#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>
// the file system in the DB, this is to avoid spurious upload on the next sync
item->_modtime = other->modtime;
// same for the size
- item->_size = other->size;
+ item->_size = other->size;
}
// If the 'W' remote permission changed, update the local filesystem
item->log._other_fileId = other->file_id;
item->log._other_instruction = other->instruction;
item->log._other_modtime = other->modtime;
- item->log._other_size = other->size;
+ item->log._other_size = other->size;
}
_syncItemMap.insert(key, item);
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;
_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;
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;
return at2xfileName;
}
}
-#endif
return fileName;
}
#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;
}
};
-#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"
*/
#include <qglobal.h>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
#include <QTemporaryDir>
-#endif
#include <QtTest>
#include "common/utility.h"
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());
// 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;
QString(dirPath + "/ownCloud2/bar"));
QCOMPARE(folderman->findGoodPathForNewSyncFolder(dirPath + "/sub", url),
QString(dirPath + "/sub2"));
-#else
- QSKIP("Test not supported with Qt4", SkipSingle);
-#endif
}
};
*/
#include <QtTest>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
#include <QTemporaryDir>
-#endif
#include "common/utility.h"
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());
dir.remove();
qunsetenv("OWNCLOUD_TEST_CASE_PRESERVING");
-#endif
}
};
-#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"