Use auto to avoiding repeating type names

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
This commit is contained in:
Kevin Ottens 2020-05-18 20:54:23 +02:00 committed by Michael Schuster
parent 3d2de4fc40
commit 712869db9a
65 changed files with 242 additions and 242 deletions

View file

@ -91,7 +91,7 @@ void KMessageWidgetPrivate::init(KMessageWidget *q_ptr)
QObject::connect(textLabel, &QLabel::linkActivated, q, &KMessageWidget::linkActivated); QObject::connect(textLabel, &QLabel::linkActivated, q, &KMessageWidget::linkActivated);
QObject::connect(textLabel, &QLabel::linkHovered, q, &KMessageWidget::linkHovered); QObject::connect(textLabel, &QLabel::linkHovered, q, &KMessageWidget::linkHovered);
QAction *closeAction = new QAction(q); auto *closeAction = new QAction(q);
closeAction->setText(KMessageWidget::tr("&Close")); closeAction->setText(KMessageWidget::tr("&Close"));
closeAction->setToolTip(KMessageWidget::tr("Close message")); closeAction->setToolTip(KMessageWidget::tr("Close message"));
closeAction->setIcon(QIcon(":/client/theme/close.svg")); // ivan: NC customization closeAction->setIcon(QIcon(":/client/theme/close.svg")); // ivan: NC customization
@ -115,7 +115,7 @@ void KMessageWidgetPrivate::createLayout()
buttons.clear(); buttons.clear();
Q_FOREACH (QAction *action, q->actions()) { Q_FOREACH (QAction *action, q->actions()) {
QToolButton *button = new QToolButton(content); auto *button = new QToolButton(content);
button->setDefaultAction(action); button->setDefaultAction(action);
button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
buttons.append(button); buttons.append(button);
@ -127,7 +127,7 @@ void KMessageWidgetPrivate::createLayout()
closeButton->setAutoRaise(buttons.isEmpty()); closeButton->setAutoRaise(buttons.isEmpty());
if (wordWrap) { if (wordWrap) {
QGridLayout *layout = new QGridLayout(content); auto *layout = new QGridLayout(content);
// Set alignment to make sure icon does not move down if text wraps // Set alignment to make sure icon does not move down if text wraps
layout->addWidget(iconLabel, 0, 0, 1, 1, Qt::AlignHCenter | Qt::AlignTop); layout->addWidget(iconLabel, 0, 0, 1, 1, Qt::AlignHCenter | Qt::AlignTop);
layout->addWidget(textLabel, 0, 1); layout->addWidget(textLabel, 0, 1);
@ -137,7 +137,7 @@ void KMessageWidgetPrivate::createLayout()
layout->addWidget(closeButton, 0, 2, 1, 1, Qt::AlignHCenter | Qt::AlignTop); layout->addWidget(closeButton, 0, 2, 1, 1, Qt::AlignHCenter | Qt::AlignTop);
} else { } else {
// Use an additional layout in row 1 for the buttons. // Use an additional layout in row 1 for the buttons.
QHBoxLayout *buttonLayout = new QHBoxLayout; auto *buttonLayout = new QHBoxLayout;
buttonLayout->addStretch(); buttonLayout->addStretch();
Q_FOREACH (QToolButton *button, buttons) { Q_FOREACH (QToolButton *button, buttons) {
// For some reason, calling show() is necessary if wordwrap is true, // For some reason, calling show() is necessary if wordwrap is true,
@ -150,7 +150,7 @@ void KMessageWidgetPrivate::createLayout()
layout->addItem(buttonLayout, 1, 0, 1, 2); layout->addItem(buttonLayout, 1, 0, 1, 2);
} }
} else { } else {
QHBoxLayout *layout = new QHBoxLayout(content); auto *layout = new QHBoxLayout(content);
layout->addWidget(iconLabel); layout->addWidget(iconLabel);
layout->addWidget(textLabel); layout->addWidget(textLabel);

View file

@ -81,7 +81,7 @@ QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char *
lockfile.open(QtLockedFile::ReadWrite); lockfile.open(QtLockedFile::ReadWrite);
lockfile.lock(QtLockedFile::WriteLock); lockfile.lock(QtLockedFile::WriteLock);
qint64 *pids = static_cast<qint64 *>(instances->data()); auto *pids = static_cast<qint64 *>(instances->data());
if (!created) { if (!created) {
// Find the first instance that it still running // Find the first instance that it still running
// The whole list needs to be iterated in order to append to it // The whole list needs to be iterated in order to append to it
@ -109,7 +109,7 @@ QtSingleApplication::~QtSingleApplication()
lockfile.open(QtLockedFile::ReadWrite); lockfile.open(QtLockedFile::ReadWrite);
lockfile.lock(QtLockedFile::WriteLock); lockfile.lock(QtLockedFile::WriteLock);
// Rewrite array, removing current pid and previously crashed ones // Rewrite array, removing current pid and previously crashed ones
qint64 *pids = static_cast<qint64 *>(instances->data()); auto *pids = static_cast<qint64 *>(instances->data());
qint64 *newpids = pids; qint64 *newpids = pids;
for (; *pids; ++pids) { for (; *pids; ++pids) {
if (*pids != appPid && isRunning(*pids)) if (*pids != appPid && isRunning(*pids))
@ -122,7 +122,7 @@ QtSingleApplication::~QtSingleApplication()
bool QtSingleApplication::event(QEvent *event) bool QtSingleApplication::event(QEvent *event)
{ {
if (event->type() == QEvent::FileOpen) { if (event->type() == QEvent::FileOpen) {
QFileOpenEvent *foe = static_cast<QFileOpenEvent*>(event); auto *foe = static_cast<QFileOpenEvent*>(event);
emit fileOpenRequest(foe->file()); emit fileOpenRequest(foe->file());
return true; return true;
} }

View file

@ -437,9 +437,9 @@ int main(int argc, char **argv)
} }
} }
SimpleSslErrorHandler *sslErrorHandler = new SimpleSslErrorHandler; auto *sslErrorHandler = new SimpleSslErrorHandler;
HttpCredentialsText *cred = new HttpCredentialsText(user, password); auto *cred = new HttpCredentialsText(user, password);
if (options.trustSSL) { if (options.trustSSL) {
cred->setSSLTrusted(true); cred->setSSLTrusted(true);
@ -456,7 +456,7 @@ int main(int argc, char **argv)
// 'dav' endpoint instead of the nonshib one (which still use the old chunking) // 'dav' endpoint instead of the nonshib one (which still use the old chunking)
QEventLoop loop; QEventLoop loop;
JsonApiJob *job = new JsonApiJob(account, QLatin1String("ocs/v1.php/cloud/capabilities")); auto *job = new JsonApiJob(account, QLatin1String("ocs/v1.php/cloud/capabilities"));
QObject::connect(job, &JsonApiJob::jsonReceived, [&](const QJsonDocument &json) { QObject::connect(job, &JsonApiJob::jsonReceived, [&](const QJsonDocument &json) {
auto caps = json.object().value("ocs").toObject().value("data").toObject().value("capabilities").toObject(); auto caps = json.object().value("ocs").toObject().value("data").toObject().value("capabilities").toObject();
qDebug() << "Server capabilities" << caps; qDebug() << "Server capabilities" << caps;

View file

@ -384,7 +384,7 @@ void SqlQuery::bindValue(int pos, const QVariant &value)
case QVariant::String: { case QVariant::String: {
if (!value.toString().isNull()) { if (!value.toString().isNull()) {
// lifetime of string == lifetime of its qvariant // lifetime of string == lifetime of its qvariant
const QString *str = static_cast<const QString *>(value.constData()); const auto *str = static_cast<const QString *>(value.constData());
res = sqlite3_bind_text16(_stmt, pos, str->utf16(), res = sqlite3_bind_text16(_stmt, pos, str->utf16(),
(str->size()) * sizeof(QChar), SQLITE_TRANSIENT); (str->size()) * sizeof(QChar), SQLITE_TRANSIENT);
} else { } else {

View file

@ -211,7 +211,7 @@ void AccountManager::saveAccountHelper(Account *acc, QSettings &settings, bool s
// Save cookies. // Save cookies.
if (acc->_am) { if (acc->_am) {
CookieJar *jar = qobject_cast<CookieJar *>(acc->_am->cookieJar()); auto *jar = qobject_cast<CookieJar *>(acc->_am->cookieJar());
if (jar) { if (jar) {
qCInfo(lcAccountManager) << "Saving cookies." << acc->cookieJarPath(); qCInfo(lcAccountManager) << "Saving cookies." << acc->cookieJarPath();
jar->save(acc->cookieJarPath()); jar->save(acc->cookieJarPath());
@ -347,7 +347,7 @@ AccountPtr AccountManager::createAccount()
void AccountManager::displayMnemonic(const QString& mnemonic) void AccountManager::displayMnemonic(const QString& mnemonic)
{ {
QDialog *widget = new QDialog; auto *widget = new QDialog;
Ui_Dialog ui; Ui_Dialog ui;
ui.setupUi(widget); ui.setupUi(widget);
widget->setWindowTitle(tr("End to end encryption mnemonic")); widget->setWindowTitle(tr("End to end encryption mnemonic"));

View file

@ -120,7 +120,7 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
_model = new FolderStatusModel; _model = new FolderStatusModel;
_model->setAccountState(_accountState); _model->setAccountState(_accountState);
_model->setParent(this); _model->setParent(this);
FolderStatusDelegate *delegate = new FolderStatusDelegate; auto *delegate = new FolderStatusDelegate;
delegate->setParent(this); delegate->setParent(this);
// Connect styleChanged events to our widgets, so they can adapt (Dark-/Light-Mode switching) // Connect styleChanged events to our widgets, so they can adapt (Dark-/Light-Mode switching)
@ -159,12 +159,12 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
connect(_model, &QAbstractItemModel::rowsInserted, connect(_model, &QAbstractItemModel::rowsInserted,
this, &AccountSettings::refreshSelectiveSyncStatus); this, &AccountSettings::refreshSelectiveSyncStatus);
QAction *syncNowAction = new QAction(this); auto *syncNowAction = new QAction(this);
syncNowAction->setShortcut(QKeySequence(Qt::Key_F6)); syncNowAction->setShortcut(QKeySequence(Qt::Key_F6));
connect(syncNowAction, &QAction::triggered, this, &AccountSettings::slotScheduleCurrentFolder); connect(syncNowAction, &QAction::triggered, this, &AccountSettings::slotScheduleCurrentFolder);
addAction(syncNowAction); addAction(syncNowAction);
QAction *syncNowWithRemoteDiscovery = new QAction(this); auto *syncNowWithRemoteDiscovery = new QAction(this);
syncNowWithRemoteDiscovery->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F6)); syncNowWithRemoteDiscovery->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F6));
connect(syncNowWithRemoteDiscovery, &QAction::triggered, this, &AccountSettings::slotScheduleCurrentFolderForceRemoteDiscovery); connect(syncNowWithRemoteDiscovery, &QAction::triggered, this, &AccountSettings::slotScheduleCurrentFolderForceRemoteDiscovery);
addAction(syncNowWithRemoteDiscovery); addAction(syncNowWithRemoteDiscovery);
@ -215,7 +215,7 @@ void AccountSettings::slotNewMnemonicGenerated()
{ {
_ui->encryptionMessage->setText(tr("This account supports end-to-end encryption")); _ui->encryptionMessage->setText(tr("This account supports end-to-end encryption"));
QAction *mnemonic = new QAction(tr("Enable encryption"), this); auto *mnemonic = new QAction(tr("Enable encryption"), this);
connect(mnemonic, &QAction::triggered, this, &AccountSettings::requesetMnemonic); connect(mnemonic, &QAction::triggered, this, &AccountSettings::requesetMnemonic);
connect(mnemonic, &QAction::triggered, _ui->encryptionMessage, &KMessageWidget::hide); connect(mnemonic, &QAction::triggered, _ui->encryptionMessage, &KMessageWidget::hide);
@ -595,7 +595,7 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos)
bool folderConnected = _model->data(index, FolderStatusDelegate::FolderAccountConnected).toBool(); bool folderConnected = _model->data(index, FolderStatusDelegate::FolderAccountConnected).toBool();
auto folderMan = FolderMan::instance(); auto folderMan = FolderMan::instance();
QMenu *menu = new QMenu(tv); auto *menu = new QMenu(tv);
menu->setAttribute(Qt::WA_DeleteOnClose); menu->setAttribute(Qt::WA_DeleteOnClose);
@ -668,7 +668,7 @@ void AccountSettings::slotAddFolder()
FolderMan *folderMan = FolderMan::instance(); FolderMan *folderMan = FolderMan::instance();
folderMan->setSyncEnabled(false); // do not start more syncs. folderMan->setSyncEnabled(false); // do not start more syncs.
FolderWizard *folderWizard = new FolderWizard(_accountState->account(), this); auto *folderWizard = new FolderWizard(_accountState->account(), this);
connect(folderWizard, &QDialog::accepted, this, &AccountSettings::slotFolderWizardAccepted); connect(folderWizard, &QDialog::accepted, this, &AccountSettings::slotFolderWizardAccepted);
connect(folderWizard, &QDialog::rejected, this, &AccountSettings::slotFolderWizardRejected); connect(folderWizard, &QDialog::rejected, this, &AccountSettings::slotFolderWizardRejected);
@ -678,7 +678,7 @@ void AccountSettings::slotAddFolder()
void AccountSettings::slotFolderWizardAccepted() void AccountSettings::slotFolderWizardAccepted()
{ {
FolderWizard *folderWizard = qobject_cast<FolderWizard *>(sender()); auto *folderWizard = qobject_cast<FolderWizard *>(sender());
FolderMan *folderMan = FolderMan::instance(); FolderMan *folderMan = FolderMan::instance();
qCInfo(lcAccountSettings) << "Folder wizard completed"; qCInfo(lcAccountSettings) << "Folder wizard completed";

View file

@ -236,7 +236,7 @@ void AccountState::checkConnectivity()
return; return;
} }
ConnectionValidator *conValidator = new ConnectionValidator(AccountStatePtr(this)); auto *conValidator = new ConnectionValidator(AccountStatePtr(this));
_connectionValidator = conValidator; _connectionValidator = conValidator;
connect(conValidator, &ConnectionValidator::connectionResult, connect(conValidator, &ConnectionValidator::connectionResult,
this, &AccountState::slotConnectionValidatorResult); this, &AccountState::slotConnectionValidatorResult);
@ -419,7 +419,7 @@ std::unique_ptr<QSettings> AccountState::settings()
} }
void AccountState::fetchNavigationApps(){ void AccountState::fetchNavigationApps(){
OcsNavigationAppsJob *job = new OcsNavigationAppsJob(_account); auto *job = new OcsNavigationAppsJob(_account);
job->addRawHeader("If-None-Match", navigationAppsEtagResponseHeader()); job->addRawHeader("If-None-Match", navigationAppsEtagResponseHeader());
connect(job, &OcsNavigationAppsJob::appsJobFinished, this, &AccountState::slotNavigationAppsFetched); connect(job, &OcsNavigationAppsJob::appsJobFinished, this, &AccountState::slotNavigationAppsFetched);
connect(job, &OcsNavigationAppsJob::etagResponseHeaderReceived, this, &AccountState::slotEtagResponseHeaderReceived); connect(job, &OcsNavigationAppsJob::etagResponseHeaderReceived, this, &AccountState::slotEtagResponseHeaderReceived);
@ -456,7 +456,7 @@ void AccountState::slotNavigationAppsFetched(const QJsonDocument &reply, int sta
foreach (const QJsonValue &value, navLinks) { foreach (const QJsonValue &value, navLinks) {
auto navLink = value.toObject(); auto navLink = value.toObject();
AccountApp *app = new AccountApp(navLink.value("name").toString(), QUrl(navLink.value("href").toString()), auto *app = new AccountApp(navLink.value("name").toString(), QUrl(navLink.value("href").toString()),
navLink.value("id").toString(), QUrl(navLink.value("icon").toString())); navLink.value("id").toString(), QUrl(navLink.value("icon").toString()));
_apps << app; _apps << app;

View file

@ -608,9 +608,9 @@ void Application::setupTranslations()
if (!enforcedLocale.isEmpty()) if (!enforcedLocale.isEmpty())
uiLanguages.prepend(enforcedLocale); uiLanguages.prepend(enforcedLocale);
QTranslator *translator = new QTranslator(this); auto *translator = new QTranslator(this);
QTranslator *qtTranslator = new QTranslator(this); auto *qtTranslator = new QTranslator(this);
QTranslator *qtkeychainTranslator = new QTranslator(this); auto *qtkeychainTranslator = new QTranslator(this);
foreach (QString lang, uiLanguages) { foreach (QString lang, uiLanguages) {
lang.replace(QLatin1Char('-'), QLatin1Char('_')); // work around QTBUG-25973 lang.replace(QLatin1Char('-'), QLatin1Char('_')); // work around QTBUG-25973

View file

@ -28,18 +28,18 @@ AuthenticationDialog::AuthenticationDialog(const QString &realm, const QString &
, _password(new QLineEdit) , _password(new QLineEdit)
{ {
setWindowTitle(tr("Authentication Required")); setWindowTitle(tr("Authentication Required"));
QVBoxLayout *lay = new QVBoxLayout(this); auto *lay = new QVBoxLayout(this);
QLabel *label = new QLabel(tr("Enter username and password for '%1' at %2.").arg(realm, domain)); auto *label = new QLabel(tr("Enter username and password for '%1' at %2.").arg(realm, domain));
label->setTextFormat(Qt::PlainText); label->setTextFormat(Qt::PlainText);
lay->addWidget(label); lay->addWidget(label);
QFormLayout *form = new QFormLayout; auto *form = new QFormLayout;
form->addRow(tr("&User:"), _user); form->addRow(tr("&User:"), _user);
form->addRow(tr("&Password:"), _password); form->addRow(tr("&Password:"), _password);
lay->addLayout(form); lay->addLayout(form);
_password->setEchoMode(QLineEdit::Password); _password->setEchoMode(QLineEdit::Password);
QDialogButtonBox *box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal); auto *box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal);
connect(box, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(box, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(box, &QDialogButtonBox::rejected, this, &QDialog::reject); connect(box, &QDialogButtonBox::rejected, this, &QDialog::reject);
lay->addWidget(box); lay->addWidget(box);

View file

@ -130,7 +130,7 @@ const char *ClientProxy::proxyTypeToCStr(QNetworkProxy::ProxyType type)
void ClientProxy::lookupSystemProxyAsync(const QUrl &url, QObject *dst, const char *slot) void ClientProxy::lookupSystemProxyAsync(const QUrl &url, QObject *dst, const char *slot)
{ {
SystemProxyRunnable *runnable = new SystemProxyRunnable(url); auto *runnable = new SystemProxyRunnable(url);
QObject::connect(runnable, SIGNAL(systemProxyLookedUp(QNetworkProxy)), dst, slot); QObject::connect(runnable, SIGNAL(systemProxyLookedUp(QNetworkProxy)), dst, slot);
QThreadPool::globalInstance()->start(runnable); // takes ownership and deletes QThreadPool::globalInstance()->start(runnable); // takes ownership and deletes
} }

View file

@ -88,7 +88,7 @@ void ConnectionValidator::systemProxyLookupDone(const QNetworkProxy &proxy)
// The actual check // The actual check
void ConnectionValidator::slotCheckServerAndAuth() void ConnectionValidator::slotCheckServerAndAuth()
{ {
CheckServerJob *checkJob = new CheckServerJob(_account, this); auto *checkJob = new CheckServerJob(_account, this);
checkJob->setTimeout(timeoutToUseMsec); checkJob->setTimeout(timeoutToUseMsec);
checkJob->setIgnoreCredentialFailure(true); checkJob->setIgnoreCredentialFailure(true);
connect(checkJob, &CheckServerJob::instanceFound, this, &ConnectionValidator::slotStatusFound); connect(checkJob, &CheckServerJob::instanceFound, this, &ConnectionValidator::slotStatusFound);
@ -173,7 +173,7 @@ void ConnectionValidator::checkAuthentication()
// simply GET the webdav root, will fail if credentials are wrong. // simply GET the webdav root, will fail if credentials are wrong.
// continue in slotAuthCheck here :-) // continue in slotAuthCheck here :-)
qCDebug(lcConnectionValidator) << "# Check whether authenticated propfind works."; qCDebug(lcConnectionValidator) << "# Check whether authenticated propfind works.";
PropfindJob *job = new PropfindJob(_account, "/", this); auto *job = new PropfindJob(_account, "/", this);
job->setTimeout(timeoutToUseMsec); job->setTimeout(timeoutToUseMsec);
job->setProperties(QList<QByteArray>() << "getlastmodified"); job->setProperties(QList<QByteArray>() << "getlastmodified");
connect(job, &PropfindJob::result, this, &ConnectionValidator::slotAuthSuccess); connect(job, &PropfindJob::result, this, &ConnectionValidator::slotAuthSuccess);
@ -223,7 +223,7 @@ void ConnectionValidator::slotAuthSuccess()
void ConnectionValidator::checkServerCapabilities() void ConnectionValidator::checkServerCapabilities()
{ {
// The main flow now needs the capabilities // The main flow now needs the capabilities
JsonApiJob *job = new JsonApiJob(_account, QLatin1String("ocs/v1.php/cloud/capabilities"), this); auto *job = new JsonApiJob(_account, QLatin1String("ocs/v1.php/cloud/capabilities"), this);
job->setTimeout(timeoutToUseMsec); job->setTimeout(timeoutToUseMsec);
QObject::connect(job, &JsonApiJob::jsonReceived, this, &ConnectionValidator::slotCapabilitiesRecieved); QObject::connect(job, &JsonApiJob::jsonReceived, this, &ConnectionValidator::slotCapabilitiesRecieved);
job->start(); job->start();
@ -273,7 +273,7 @@ void ConnectionValidator::ocsConfigReceived(const QJsonDocument &json, AccountPt
void ConnectionValidator::fetchUser() void ConnectionValidator::fetchUser()
{ {
UserInfo *userInfo = new UserInfo(_accountState.data(), true, true, this); auto *userInfo = new UserInfo(_accountState.data(), true, true, this);
QObject::connect(userInfo, &UserInfo::fetchedLastInfo, this, &ConnectionValidator::slotUserFetched); QObject::connect(userInfo, &UserInfo::fetchedLastInfo, this, &ConnectionValidator::slotUserFetched);
userInfo->setActive(true); userInfo->setActive(true);
} }

View file

@ -121,7 +121,7 @@ void HttpCredentialsGui::showDialog()
dialog.setLabelText(msg); dialog.setLabelText(msg);
dialog.setTextValue(_previousPassword); dialog.setTextValue(_previousPassword);
dialog.setTextEchoMode(QLineEdit::Password); dialog.setTextEchoMode(QLineEdit::Password);
if (QLabel *dialogLabel = dialog.findChild<QLabel *>()) { if (auto *dialogLabel = dialog.findChild<QLabel *>()) {
dialogLabel->setOpenExternalLinks(true); dialogLabel->setOpenExternalLinks(true);
dialogLabel->setTextFormat(Qt::RichText); dialogLabel->setTextFormat(Qt::RichText);
} }

View file

@ -68,7 +68,7 @@ void WriteJob::start()
void WriteJob::slotWriteJobDone(QKeychain::Job *incomingJob) void WriteJob::slotWriteJobDone(QKeychain::Job *incomingJob)
{ {
QKeychain::WritePasswordJob *writeJob = static_cast<QKeychain::WritePasswordJob *>(incomingJob); auto *writeJob = static_cast<QKeychain::WritePasswordJob *>(incomingJob);
// errors? // errors?
if (writeJob) { if (writeJob) {
@ -114,7 +114,7 @@ void WriteJob::slotWriteJobDone(QKeychain::Job *incomingJob)
_key + (index > 0 ? (QString(".") + QString::number(index)) : QString()), _key + (index > 0 ? (QString(".") + QString::number(index)) : QString()),
_account->id()); _account->id());
QKeychain::WritePasswordJob *job = new QKeychain::WritePasswordJob(_serviceName); auto *job = new QKeychain::WritePasswordJob(_serviceName);
#if defined(KEYCHAINCHUNK_ENABLE_INSECURE_FALLBACK) #if defined(KEYCHAINCHUNK_ENABLE_INSECURE_FALLBACK)
addSettingsToJob(_account, job); addSettingsToJob(_account, job);
#endif #endif
@ -158,7 +158,7 @@ void ReadJob::start()
_key, _key,
_keychainMigration ? QString() : _account->id()); _keychainMigration ? QString() : _account->id());
QKeychain::ReadPasswordJob *job = new QKeychain::ReadPasswordJob(_serviceName); auto *job = new QKeychain::ReadPasswordJob(_serviceName);
#if defined(KEYCHAINCHUNK_ENABLE_INSECURE_FALLBACK) #if defined(KEYCHAINCHUNK_ENABLE_INSECURE_FALLBACK)
addSettingsToJob(_account, job); addSettingsToJob(_account, job);
#endif #endif
@ -171,7 +171,7 @@ void ReadJob::start()
void ReadJob::slotReadJobDone(QKeychain::Job *incomingJob) void ReadJob::slotReadJobDone(QKeychain::Job *incomingJob)
{ {
// Errors or next chunk? // Errors or next chunk?
QKeychain::ReadPasswordJob *readJob = static_cast<QKeychain::ReadPasswordJob *>(incomingJob); auto *readJob = static_cast<QKeychain::ReadPasswordJob *>(incomingJob);
if (readJob) { if (readJob) {
if (readJob->error() == NoError && readJob->binaryData().length() > 0) { if (readJob->error() == NoError && readJob->binaryData().length() > 0) {

View file

@ -87,9 +87,9 @@ ShibbolethWebView::ShibbolethWebView(AccountPtr account, QWidget *parent)
// open an additional window to display some cipher debug info // open an additional window to display some cipher debug info
QWebPage *debugPage = new UserAgentWebPage(this); QWebPage *debugPage = new UserAgentWebPage(this);
debugPage->mainFrame()->load(QUrl("https://cc.dcsec.uni-hannover.de/")); debugPage->mainFrame()->load(QUrl("https://cc.dcsec.uni-hannover.de/"));
QWebView *debugView = new QWebView(this); auto *debugView = new QWebView(this);
debugView->setPage(debugPage); debugView->setPage(debugPage);
QMainWindow *window = new QMainWindow(this); auto *window = new QMainWindow(this);
window->setWindowTitle(tr("SSL Cipher Debug View")); window->setWindowTitle(tr("SSL Cipher Debug View"));
window->setCentralWidget(debugView); window->setCentralWidget(debugView);
window->show(); window->show();

View file

@ -141,7 +141,7 @@ void ShibbolethCredentials::fetchFromKeychain()
void ShibbolethCredentials::fetchFromKeychainHelper() void ShibbolethCredentials::fetchFromKeychainHelper()
{ {
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); auto *job = new ReadPasswordJob(Theme::instance()->appName());
job->setSettings(ConfigFile::settingsWithGroup(Theme::instance()->appName(), job).release()); job->setSettings(ConfigFile::settingsWithGroup(Theme::instance()->appName(), job).release());
job->setInsecureFallback(false); job->setInsecureFallback(false);
job->setKey(keychainKey(_url.toString(), user(), job->setKey(keychainKey(_url.toString(), user(),
@ -153,7 +153,7 @@ void ShibbolethCredentials::fetchFromKeychainHelper()
void ShibbolethCredentials::askFromUser() void ShibbolethCredentials::askFromUser()
{ {
// First, we do a DetermineAuthTypeJob to make sure that the server is still using shibboleth and did not upgrade to oauth // First, we do a DetermineAuthTypeJob to make sure that the server is still using shibboleth and did not upgrade to oauth
DetermineAuthTypeJob *job = new DetermineAuthTypeJob(_account->sharedFromThis(), this); auto *job = new DetermineAuthTypeJob(_account->sharedFromThis(), this);
connect(job, &DetermineAuthTypeJob::authType, [this, job](DetermineAuthTypeJob::AuthType type) { connect(job, &DetermineAuthTypeJob::authType, [this, job](DetermineAuthTypeJob::AuthType type) {
if (type == DetermineAuthTypeJob::Shibboleth) { if (type == DetermineAuthTypeJob::Shibboleth) {
// Normal case, still shibboleth // Normal case, still shibboleth
@ -197,7 +197,7 @@ void ShibbolethCredentials::invalidateToken()
{ {
_ready = false; _ready = false;
CookieJar *jar = static_cast<CookieJar *>(_account->networkAccessManager()->cookieJar()); auto *jar = static_cast<CookieJar *>(_account->networkAccessManager()->cookieJar());
// Remove the _shibCookie // Remove the _shibCookie
auto cookies = jar->allCookies(); auto cookies = jar->allCookies();
@ -234,7 +234,7 @@ void ShibbolethCredentials::slotFetchUser()
{ {
// We must first do a request to webdav so the session is enabled. // We must first do a request to webdav so the session is enabled.
// (because for some reason we can't access the API without that.. a bug in the server maybe?) // (because for some reason we can't access the API without that.. a bug in the server maybe?)
EntityExistsJob *job = new EntityExistsJob(_account->sharedFromThis(), _account->davPath(), this); auto *job = new EntityExistsJob(_account->sharedFromThis(), _account->davPath(), this);
connect(job, &EntityExistsJob::exists, this, &ShibbolethCredentials::slotFetchUserHelper); connect(job, &EntityExistsJob::exists, this, &ShibbolethCredentials::slotFetchUserHelper);
job->setIgnoreCredentialFailure(true); job->setIgnoreCredentialFailure(true);
job->start(); job->start();
@ -242,7 +242,7 @@ void ShibbolethCredentials::slotFetchUser()
void ShibbolethCredentials::slotFetchUserHelper() void ShibbolethCredentials::slotFetchUserHelper()
{ {
ShibbolethUserJob *job = new ShibbolethUserJob(_account->sharedFromThis(), this); auto *job = new ShibbolethUserJob(_account->sharedFromThis(), this);
connect(job, &ShibbolethUserJob::userFetched, this, &ShibbolethCredentials::slotUserFetched); connect(job, &ShibbolethUserJob::userFetched, this, &ShibbolethCredentials::slotUserFetched);
job->start(); job->start();
} }
@ -287,7 +287,7 @@ void ShibbolethCredentials::slotReadJobDone(QKeychain::Job *job)
} }
if (job->error() == QKeychain::NoError) { if (job->error() == QKeychain::NoError) {
ReadPasswordJob *readJob = static_cast<ReadPasswordJob *>(job); auto *readJob = static_cast<ReadPasswordJob *>(job);
delete readJob->settings(); delete readJob->settings();
QList<QNetworkCookie> cookies = QNetworkCookie::parseCookies(readJob->textData().toUtf8()); QList<QNetworkCookie> cookies = QNetworkCookie::parseCookies(readJob->textData().toUtf8());
if (cookies.count() > 0) { if (cookies.count() > 0) {
@ -310,7 +310,7 @@ void ShibbolethCredentials::slotReadJobDone(QKeychain::Job *job)
if (_keychainMigration && _ready) { if (_keychainMigration && _ready) {
persist(); persist();
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName()); auto *job = new DeletePasswordJob(Theme::instance()->appName());
job->setSettings(ConfigFile::settingsWithGroup(Theme::instance()->appName(), job).release()); job->setSettings(ConfigFile::settingsWithGroup(Theme::instance()->appName(), job).release());
job->setKey(keychainKey(_account->url().toString(), user(), QString())); job->setKey(keychainKey(_account->url().toString(), user(), QString()));
job->start(); job->start();
@ -326,7 +326,7 @@ void ShibbolethCredentials::showLoginWindow()
return; return;
} }
CookieJar *jar = static_cast<CookieJar *>(_account->networkAccessManager()->cookieJar()); auto *jar = static_cast<CookieJar *>(_account->networkAccessManager()->cookieJar());
// When opening a new window clear all the session cookie that might keep the user from logging in // When opening a new window clear all the session cookie that might keep the user from logging in
// (or the session may already be open in the server, and there will not be redirect asking for the // (or the session may already be open in the server, and there will not be redirect asking for the
// real long term cookie we want to store) // real long term cookie we want to store)
@ -366,7 +366,7 @@ QByteArray ShibbolethCredentials::shibCookieName()
void ShibbolethCredentials::storeShibCookie(const QNetworkCookie &cookie) void ShibbolethCredentials::storeShibCookie(const QNetworkCookie &cookie)
{ {
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); auto *job = new WritePasswordJob(Theme::instance()->appName());
job->setSettings(ConfigFile::settingsWithGroup(Theme::instance()->appName(), job).release()); job->setSettings(ConfigFile::settingsWithGroup(Theme::instance()->appName(), job).release());
// we don't really care if it works... // we don't really care if it works...
//connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotWriteJobDone(QKeychain::Job*))); //connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotWriteJobDone(QKeychain::Job*)));
@ -377,7 +377,7 @@ void ShibbolethCredentials::storeShibCookie(const QNetworkCookie &cookie)
void ShibbolethCredentials::removeShibCookie() void ShibbolethCredentials::removeShibCookie()
{ {
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName()); auto *job = new DeletePasswordJob(Theme::instance()->appName());
job->setSettings(ConfigFile::settingsWithGroup(Theme::instance()->appName(), job).release()); job->setSettings(ConfigFile::settingsWithGroup(Theme::instance()->appName(), job).release());
job->setKey(keychainKey(_account->url().toString(), user(), _account->id())); job->setKey(keychainKey(_account->url().toString(), user(), _account->id()));
job->start(); job->start();

View file

@ -152,7 +152,7 @@ void WebFlowCredentials::fetchFromKeychain() {
void WebFlowCredentials::askFromUser() { void WebFlowCredentials::askFromUser() {
// Determine if the old flow has to be used (GS for now) // Determine if the old flow has to be used (GS for now)
// Do a DetermineAuthTypeJob to make sure that the server is still using Flow2 // Do a DetermineAuthTypeJob to make sure that the server is still using Flow2
DetermineAuthTypeJob *job = new DetermineAuthTypeJob(_account->sharedFromThis(), this); auto *job = new DetermineAuthTypeJob(_account->sharedFromThis(), this);
connect(job, &DetermineAuthTypeJob::authType, [this](DetermineAuthTypeJob::AuthType type) { connect(job, &DetermineAuthTypeJob::authType, [this](DetermineAuthTypeJob::AuthType type) {
// LoginFlowV2 > WebViewFlow > OAuth > Shib > Basic // LoginFlowV2 > WebViewFlow > OAuth > Shib > Basic
bool useFlow2 = (type != DetermineAuthTypeJob::WebViewFlow); bool useFlow2 = (type != DetermineAuthTypeJob::WebViewFlow);
@ -340,7 +340,7 @@ void WebFlowCredentials::slotWriteClientCaCertsPEMJobDone(KeychainChunk::WriteJo
} }
// done storing ca certs, time for the password // done storing ca certs, time for the password
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); auto *job = new WritePasswordJob(Theme::instance()->appName());
#if defined(KEYCHAINCHUNK_ENABLE_INSECURE_FALLBACK) #if defined(KEYCHAINCHUNK_ENABLE_INSECURE_FALLBACK)
addSettingsToJob(_account, job); addSettingsToJob(_account, job);
#endif #endif
@ -360,7 +360,7 @@ void WebFlowCredentials::slotWriteJobDone(QKeychain::Job *job)
default: default:
qCWarning(lcWebFlowCredentials) << "Error while writing password" << job->errorString(); qCWarning(lcWebFlowCredentials) << "Error while writing password" << job->errorString();
} }
WritePasswordJob *wjob = qobject_cast<WritePasswordJob *>(job); auto *wjob = qobject_cast<WritePasswordJob *>(job);
wjob->deleteLater(); wjob->deleteLater();
} }
@ -390,11 +390,11 @@ void WebFlowCredentials::forgetSensitiveData() {
return; return;
} }
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName()); auto *job = new DeletePasswordJob(Theme::instance()->appName());
job->setInsecureFallback(false); job->setInsecureFallback(false);
job->setKey(kck); job->setKey(kck);
connect(job, &Job::finished, this, [](QKeychain::Job *job) { connect(job, &Job::finished, this, [](QKeychain::Job *job) {
DeletePasswordJob *djob = qobject_cast<DeletePasswordJob *>(job); auto *djob = qobject_cast<DeletePasswordJob *>(job);
djob->deleteLater(); djob->deleteLater();
}); });
job->start(); job->start();
@ -565,7 +565,7 @@ void WebFlowCredentials::slotReadClientCaCertsPEMJobDone(KeychainChunk::ReadJob
_user, _user,
_keychainMigration ? QString() : _account->id()); _keychainMigration ? QString() : _account->id());
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); auto *job = new ReadPasswordJob(Theme::instance()->appName());
#if defined(KEYCHAINCHUNK_ENABLE_INSECURE_FALLBACK) #if defined(KEYCHAINCHUNK_ENABLE_INSECURE_FALLBACK)
addSettingsToJob(_account, job); addSettingsToJob(_account, job);
#endif #endif
@ -576,7 +576,7 @@ void WebFlowCredentials::slotReadClientCaCertsPEMJobDone(KeychainChunk::ReadJob
} }
void WebFlowCredentials::slotReadPasswordJobDone(Job *incomingJob) { void WebFlowCredentials::slotReadPasswordJobDone(Job *incomingJob) {
QKeychain::ReadPasswordJob *job = qobject_cast<ReadPasswordJob *>(incomingJob); auto *job = qobject_cast<ReadPasswordJob *>(incomingJob);
QKeychain::Error error = job->error(); QKeychain::Error error = job->error();
// If we could not find the entry try the old entries // If we could not find the entry try the old entries
@ -612,7 +612,7 @@ void WebFlowCredentials::slotReadPasswordJobDone(Job *incomingJob) {
void WebFlowCredentials::deleteKeychainEntries(bool oldKeychainEntries) { void WebFlowCredentials::deleteKeychainEntries(bool oldKeychainEntries) {
auto startDeleteJob = [this, oldKeychainEntries](QString key) { auto startDeleteJob = [this, oldKeychainEntries](QString key) {
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName()); auto *job = new DeletePasswordJob(Theme::instance()->appName());
#if defined(KEYCHAINCHUNK_ENABLE_INSECURE_FALLBACK) #if defined(KEYCHAINCHUNK_ENABLE_INSECURE_FALLBACK)
addSettingsToJob(_account, job); addSettingsToJob(_account, job);
#endif #endif
@ -622,7 +622,7 @@ void WebFlowCredentials::deleteKeychainEntries(bool oldKeychainEntries) {
oldKeychainEntries ? QString() : _account->id())); oldKeychainEntries ? QString() : _account->id()));
connect(job, &Job::finished, this, [](QKeychain::Job *job) { connect(job, &Job::finished, this, [](QKeychain::Job *job) {
DeletePasswordJob *djob = qobject_cast<DeletePasswordJob *>(job); auto *djob = qobject_cast<DeletePasswordJob *>(job);
djob->deleteLater(); djob->deleteLater();
}); });
job->start(); job->start();

View file

@ -463,7 +463,7 @@ void FolderMan::slotFolderSyncPaused(Folder *f, bool paused)
void FolderMan::slotFolderCanSyncChanged() void FolderMan::slotFolderCanSyncChanged()
{ {
Folder *f = qobject_cast<Folder *>(sender()); auto *f = qobject_cast<Folder *>(sender());
ASSERT(f); ASSERT(f);
if (f->canSync()) { if (f->canSync()) {
_socketApi->slotRegisterPath(f->alias()); _socketApi->slotRegisterPath(f->alias());
@ -608,7 +608,7 @@ void FolderMan::slotRunOneEtagJob()
void FolderMan::slotAccountStateChanged() void FolderMan::slotAccountStateChanged()
{ {
AccountState *accountState = qobject_cast<AccountState *>(sender()); auto *accountState = qobject_cast<AccountState *>(sender());
if (!accountState) { if (!accountState) {
return; return;
} }
@ -790,7 +790,7 @@ void FolderMan::slotRemoveFoldersForAccount(AccountState *accountState)
void FolderMan::slotForwardFolderSyncStateChange() void FolderMan::slotForwardFolderSyncStateChange()
{ {
if (Folder *f = qobject_cast<Folder *>(sender())) { if (auto *f = qobject_cast<Folder *>(sender())) {
emit folderSyncStateChange(f); emit folderSyncStateChange(f);
} }
} }
@ -1378,7 +1378,7 @@ QString FolderMan::checkPathValidityForNewFolder(const QString &path, const QUrl
const QString userDir = QDir::cleanPath(canonicalPath(path)) + '/'; const QString userDir = QDir::cleanPath(canonicalPath(path)) + '/';
for (auto i = _folderMap.constBegin(); i != _folderMap.constEnd(); ++i) { for (auto i = _folderMap.constBegin(); i != _folderMap.constEnd(); ++i) {
Folder *f = static_cast<Folder *>(i.value()); auto *f = static_cast<Folder *>(i.value());
QString folderDir = QDir::cleanPath(canonicalPath(f->path())) + '/'; QString folderDir = QDir::cleanPath(canonicalPath(f->path())) + '/';
bool differentPaths = QString::compare(folderDir, userDir, cs) != 0; bool differentPaths = QString::compare(folderDir, userDir, cs) != 0;

View file

@ -372,8 +372,8 @@ bool FolderStatusDelegate::editorEvent(QEvent *event, QAbstractItemModel *model,
switch (event->type()) { switch (event->type()) {
case QEvent::MouseButtonPress: case QEvent::MouseButtonPress:
case QEvent::MouseMove: case QEvent::MouseMove:
if (const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(option.widget)) { if (const auto *view = qobject_cast<const QAbstractItemView *>(option.widget)) {
QMouseEvent *me = static_cast<QMouseEvent *>(event); auto *me = static_cast<QMouseEvent *>(event);
QModelIndex index; QModelIndex index;
if (me->buttons()) { if (me->buttons()) {
index = view->indexAt(me->pos()); index = view->indexAt(me->pos());

View file

@ -286,7 +286,7 @@ bool FolderStatusModel::setData(const QModelIndex &index, const QVariant &value,
{ {
if (role == Qt::CheckStateRole) { if (role == Qt::CheckStateRole) {
auto info = infoForIndex(index); auto info = infoForIndex(index);
Qt::CheckState checked = static_cast<Qt::CheckState>(value.toInt()); auto checked = static_cast<Qt::CheckState>(value.toInt());
if (info && info->_checked != checked) { if (info && info->_checked != checked) {
info->_checked = checked; info->_checked = checked;
@ -589,7 +589,7 @@ void FolderStatusModel::fetchMore(const QModelIndex &parent)
_accountState->account()->e2e()->fetchFolderEncryptedStatus(); _accountState->account()->e2e()->fetchFolderEncryptedStatus();
} }
LsColJob *job = new LsColJob(_accountState->account(), path, this); auto *job = new LsColJob(_accountState->account(), path, this);
info->_fetchingJob = job; info->_fetchingJob = job;
job->setProperties(QList<QByteArray>() << "resourcetype" job->setProperties(QList<QByteArray>() << "resourcetype"
<< "http://owncloud.org/ns:size" << "http://owncloud.org/ns:size"
@ -893,7 +893,7 @@ void FolderStatusModel::slotSetProgress(const ProgressInfo &progress)
return; // for https://github.com/owncloud/client/issues/2648#issuecomment-71377909 return; // for https://github.com/owncloud/client/issues/2648#issuecomment-71377909
} }
Folder *f = qobject_cast<Folder *>(sender()); auto *f = qobject_cast<Folder *>(sender());
if (!f) { if (!f) {
return; return;
} }

View file

@ -178,7 +178,7 @@ void FolderWizardRemotePath::slotAddRemoteFolder()
parent = current->data(0, Qt::UserRole).toString(); parent = current->data(0, Qt::UserRole).toString();
} }
QInputDialog *dlg = new QInputDialog(this); auto *dlg = new QInputDialog(this);
dlg->setWindowTitle(tr("Create Remote Folder")); dlg->setWindowTitle(tr("Create Remote Folder"));
dlg->setLabelText(tr("Enter the name of the new folder to be created below '%1':") dlg->setLabelText(tr("Enter the name of the new folder to be created below '%1':")
@ -199,7 +199,7 @@ void FolderWizardRemotePath::slotCreateRemoteFolder(const QString &folder)
} }
fullPath += "/" + folder; fullPath += "/" + folder;
MkColJob *job = new MkColJob(_account, fullPath, this); auto *job = new MkColJob(_account, fullPath, this);
/* check the owncloud configuration file and query the ownCloud */ /* check the owncloud configuration file and query the ownCloud */
connect(job, static_cast<void (MkColJob::*)(QNetworkReply::NetworkError)>(&MkColJob::finished), connect(job, static_cast<void (MkColJob::*)(QNetworkReply::NetworkError)>(&MkColJob::finished),
this, &FolderWizardRemotePath::slotCreateRemoteFolderFinished); this, &FolderWizardRemotePath::slotCreateRemoteFolderFinished);
@ -405,7 +405,7 @@ void FolderWizardRemotePath::slotTypedPathError(QNetworkReply *reply)
LsColJob *FolderWizardRemotePath::runLsColJob(const QString &path) LsColJob *FolderWizardRemotePath::runLsColJob(const QString &path)
{ {
LsColJob *job = new LsColJob(_account, path, this); auto *job = new LsColJob(_account, path, this);
job->setProperties(QList<QByteArray>() << "resourcetype"); job->setProperties(QList<QByteArray>() << "resourcetype");
connect(job, &LsColJob::directoryListingSubfolders, connect(job, &LsColJob::directoryListingSubfolders,
this, &FolderWizardRemotePath::slotUpdateDirectories); this, &FolderWizardRemotePath::slotUpdateDirectories);
@ -435,7 +435,7 @@ bool FolderWizardRemotePath::isComplete() const
Folder::Map map = FolderMan::instance()->map(); Folder::Map map = FolderMan::instance()->map();
Folder::Map::const_iterator i = map.constBegin(); Folder::Map::const_iterator i = map.constBegin();
for (i = map.constBegin(); i != map.constEnd(); i++) { for (i = map.constBegin(); i != map.constEnd(); i++) {
Folder *f = static_cast<Folder *>(i.value()); auto *f = static_cast<Folder *>(i.value());
if (f->accountState()->account() != _account) { if (f->accountState()->account() != _account) {
continue; continue;
} }
@ -480,7 +480,7 @@ void FolderWizardRemotePath::showWarn(const QString &msg) const
FolderWizardSelectiveSync::FolderWizardSelectiveSync(const AccountPtr &account) FolderWizardSelectiveSync::FolderWizardSelectiveSync(const AccountPtr &account)
{ {
QVBoxLayout *layout = new QVBoxLayout(this); auto *layout = new QVBoxLayout(this);
_selectiveSync = new SelectiveSyncWidget(account, this); _selectiveSync = new SelectiveSyncWidget(account, this);
layout->addWidget(_selectiveSync); layout->addWidget(_selectiveSync);
} }

View file

@ -144,11 +144,11 @@ int IgnoreListTableWidget::addPattern(const QString &pattern, bool deletable, bo
int newRow = ui->tableWidget->rowCount(); int newRow = ui->tableWidget->rowCount();
ui->tableWidget->setRowCount(newRow + 1); ui->tableWidget->setRowCount(newRow + 1);
QTableWidgetItem *patternItem = new QTableWidgetItem; auto *patternItem = new QTableWidgetItem;
patternItem->setText(pattern); patternItem->setText(pattern);
ui->tableWidget->setItem(newRow, patternCol, patternItem); ui->tableWidget->setItem(newRow, patternCol, patternItem);
QTableWidgetItem *deletableItem = new QTableWidgetItem; auto *deletableItem = new QTableWidgetItem;
deletableItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); deletableItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
deletableItem->setCheckState(deletable ? Qt::Checked : Qt::Unchecked); deletableItem->setCheckState(deletable ? Qt::Checked : Qt::Unchecked);
ui->tableWidget->setItem(newRow, deletableCol, deletableItem); ui->tableWidget->setItem(newRow, deletableCol, deletableItem);

View file

@ -58,23 +58,23 @@ LogBrowser::LogBrowser(QWidget *parent)
setWindowTitle(tr("Log Output")); setWindowTitle(tr("Log Output"));
setMinimumWidth(600); setMinimumWidth(600);
QVBoxLayout *mainLayout = new QVBoxLayout; auto *mainLayout = new QVBoxLayout;
// mainLayout->setMargin(0); // mainLayout->setMargin(0);
mainLayout->addWidget(_logWidget); mainLayout->addWidget(_logWidget);
QHBoxLayout *toolLayout = new QHBoxLayout; auto *toolLayout = new QHBoxLayout;
mainLayout->addLayout(toolLayout); mainLayout->addLayout(toolLayout);
// Search input field // Search input field
QLabel *lab = new QLabel(tr("&Search:") + " "); auto *lab = new QLabel(tr("&Search:") + " ");
_findTermEdit = new QLineEdit; _findTermEdit = new QLineEdit;
lab->setBuddy(_findTermEdit); lab->setBuddy(_findTermEdit);
toolLayout->addWidget(lab); toolLayout->addWidget(lab);
toolLayout->addWidget(_findTermEdit); toolLayout->addWidget(_findTermEdit);
// find button // find button
QPushButton *findBtn = new QPushButton; auto *findBtn = new QPushButton;
findBtn->setText(tr("&Find")); findBtn->setText(tr("&Find"));
connect(findBtn, &QAbstractButton::clicked, this, &LogBrowser::slotFind); connect(findBtn, &QAbstractButton::clicked, this, &LogBrowser::slotFind);
toolLayout->addWidget(findBtn); toolLayout->addWidget(findBtn);
@ -90,7 +90,7 @@ LogBrowser::LogBrowser(QWidget *parent)
connect(_logDebugCheckBox, &QCheckBox::stateChanged, this, &LogBrowser::slotDebugCheckStateChanged); connect(_logDebugCheckBox, &QCheckBox::stateChanged, this, &LogBrowser::slotDebugCheckStateChanged);
toolLayout->addWidget(_logDebugCheckBox); toolLayout->addWidget(_logDebugCheckBox);
QDialogButtonBox *btnbox = new QDialogButtonBox; auto *btnbox = new QDialogButtonBox;
QPushButton *closeBtn = btnbox->addButton(QDialogButtonBox::Close); QPushButton *closeBtn = btnbox->addButton(QDialogButtonBox::Close);
connect(closeBtn, &QAbstractButton::clicked, this, &QWidget::close); connect(closeBtn, &QAbstractButton::clicked, this, &QWidget::close);
@ -132,7 +132,7 @@ LogBrowser::LogBrowser(QWidget *parent)
// Direct connection for log coming from this thread, and queued for the one in a different thread // Direct connection for log coming from this thread, and queued for the one in a different thread
connect(Logger::instance(), &Logger::logWindowLog, this, &LogBrowser::slotNewLog, Qt::AutoConnection); connect(Logger::instance(), &Logger::logWindowLog, this, &LogBrowser::slotNewLog, Qt::AutoConnection);
QAction *showLogWindow = new QAction(this); auto *showLogWindow = new QAction(this);
showLogWindow->setShortcut(QKeySequence("F12")); showLogWindow->setShortcut(QKeySequence("F12"));
connect(showLogWindow, &QAction::triggered, this, &QWidget::close); connect(showLogWindow, &QAction::triggered, this, &QWidget::close);
addAction(showLogWindow); addAction(showLogWindow);

View file

@ -77,7 +77,7 @@ void OcsJob::start()
addRawHeader("Ocs-APIREQUEST", "true"); addRawHeader("Ocs-APIREQUEST", "true");
addRawHeader("Content-Type", "application/x-www-form-urlencoded"); addRawHeader("Content-Type", "application/x-www-form-urlencoded");
QBuffer *buffer = new QBuffer; auto *buffer = new QBuffer;
QUrlQuery queryItems; QUrlQuery queryItems;
if (_verb == "GET") { if (_verb == "GET") {

View file

@ -443,7 +443,7 @@ void ownCloudGui::slotUpdateProgress(const QString &folder, const ProgressInfo &
QString kindStr = Progress::asResultString(progress._lastCompletedItem); QString kindStr = Progress::asResultString(progress._lastCompletedItem);
QString timeStr = QTime::currentTime().toString("hh:mm"); QString timeStr = QTime::currentTime().toString("hh:mm");
QString actionText = tr("%1 (%2, %3)").arg(progress._lastCompletedItem._file, kindStr, timeStr); QString actionText = tr("%1 (%2, %3)").arg(progress._lastCompletedItem._file, kindStr, timeStr);
QAction *action = new QAction(actionText, this); auto *action = new QAction(actionText, this);
Folder *f = FolderMan::instance()->folder(folder); Folder *f = FolderMan::instance()->folder(folder);
if (f) { if (f) {
QString fullPath = f->path() + '/' + progress._lastCompletedItem._file; QString fullPath = f->path() + '/' + progress._lastCompletedItem._file;
@ -523,7 +523,7 @@ void ownCloudGui::setPauseOnAllFoldersHelper(bool pause)
void ownCloudGui::slotShowGuiMessage(const QString &title, const QString &message) void ownCloudGui::slotShowGuiMessage(const QString &title, const QString &message)
{ {
QMessageBox *msgBox = new QMessageBox; auto *msgBox = new QMessageBox;
msgBox->setWindowFlags(msgBox->windowFlags() | Qt::WindowStaysOnTopHint); msgBox->setWindowFlags(msgBox->windowFlags() | Qt::WindowStaysOnTopHint);
msgBox->setAttribute(Qt::WA_DeleteOnClose); msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->setText(message); msgBox->setText(message);

View file

@ -195,7 +195,7 @@ void OwncloudSetupWizard::slotFindServer()
// 3. Check redirected-url/status.php with CheckServerJob // 3. Check redirected-url/status.php with CheckServerJob
// Step 1: Check url/status.php // Step 1: Check url/status.php
CheckServerJob *job = new CheckServerJob(account, this); auto *job = new CheckServerJob(account, this);
job->setIgnoreCredentialFailure(true); job->setIgnoreCredentialFailure(true);
connect(job, &CheckServerJob::instanceFound, this, &OwncloudSetupWizard::slotFoundServer); connect(job, &CheckServerJob::instanceFound, this, &OwncloudSetupWizard::slotFoundServer);
connect(job, &CheckServerJob::instanceNotFound, this, &OwncloudSetupWizard::slotFindServerBehindRedirect); connect(job, &CheckServerJob::instanceNotFound, this, &OwncloudSetupWizard::slotFindServerBehindRedirect);
@ -233,7 +233,7 @@ void OwncloudSetupWizard::slotFindServerBehindRedirect()
// Step 3: When done, start checking status.php. // Step 3: When done, start checking status.php.
connect(redirectCheckJob, &SimpleNetworkJob::finishedSignal, this, connect(redirectCheckJob, &SimpleNetworkJob::finishedSignal, this,
[this, account]() { [this, account]() {
CheckServerJob *job = new CheckServerJob(account, this); auto *job = new CheckServerJob(account, this);
job->setIgnoreCredentialFailure(true); job->setIgnoreCredentialFailure(true);
connect(job, &CheckServerJob::instanceFound, this, &OwncloudSetupWizard::slotFoundServer); connect(job, &CheckServerJob::instanceFound, this, &OwncloudSetupWizard::slotFoundServer);
connect(job, &CheckServerJob::instanceNotFound, this, &OwncloudSetupWizard::slotNoServerFound); connect(job, &CheckServerJob::instanceNotFound, this, &OwncloudSetupWizard::slotNoServerFound);
@ -319,7 +319,7 @@ void OwncloudSetupWizard::slotNoServerFoundTimeout(const QUrl &url)
void OwncloudSetupWizard::slotDetermineAuthType() void OwncloudSetupWizard::slotDetermineAuthType()
{ {
DetermineAuthTypeJob *job = new DetermineAuthTypeJob(_ocWizard->account(), this); auto *job = new DetermineAuthTypeJob(_ocWizard->account(), this);
connect(job, &DetermineAuthTypeJob::authType, connect(job, &DetermineAuthTypeJob::authType,
_ocWizard, &OwncloudWizard::setAuthType); _ocWizard, &OwncloudWizard::setAuthType);
job->start(); job->start();
@ -357,7 +357,7 @@ void OwncloudSetupWizard::slotAuthError()
{ {
QString errorMsg; QString errorMsg;
PropfindJob *job = qobject_cast<PropfindJob *>(sender()); auto *job = qobject_cast<PropfindJob *>(sender());
if (!job) { if (!job) {
qCWarning(lcWizard) << "Can't check for authed redirects. This slot should be invoked from PropfindJob!"; qCWarning(lcWizard) << "Can't check for authed redirects. This slot should be invoked from PropfindJob!";
return; return;
@ -501,7 +501,7 @@ void OwncloudSetupWizard::slotCreateLocalAndRemoteFolders(const QString &localFo
* END - Sanitize URL paths to eliminate double-slashes * END - Sanitize URL paths to eliminate double-slashes
*/ */
EntityExistsJob *job = new EntityExistsJob(_ocWizard->account(), newUrlPath, this); auto *job = new EntityExistsJob(_ocWizard->account(), newUrlPath, this);
connect(job, &EntityExistsJob::exists, this, &OwncloudSetupWizard::slotRemoteFolderExists); connect(job, &EntityExistsJob::exists, this, &OwncloudSetupWizard::slotRemoteFolderExists);
job->start(); job->start();
} else { } else {
@ -542,7 +542,7 @@ void OwncloudSetupWizard::createRemoteFolder()
{ {
_ocWizard->appendToConfigurationLog(tr("creating folder on Nextcloud: %1").arg(_remoteFolder)); _ocWizard->appendToConfigurationLog(tr("creating folder on Nextcloud: %1").arg(_remoteFolder));
MkColJob *job = new MkColJob(_ocWizard->account(), _remoteFolder, this); auto *job = new MkColJob(_ocWizard->account(), _remoteFolder, this);
connect(job, SIGNAL(finished(QNetworkReply::NetworkError)), SLOT(slotCreateRemoteFolderFinished(QNetworkReply::NetworkError))); connect(job, SIGNAL(finished(QNetworkReply::NetworkError)), SLOT(slotCreateRemoteFolderFinished(QNetworkReply::NetworkError)));
job->start(); job->start();
} }

View file

@ -85,7 +85,7 @@ void ProxyAuthHandler::handleProxyAuthenticationRequired(
// Find the responsible QNAM if possible. // Find the responsible QNAM if possible.
QNetworkAccessManager *sending_qnam = nullptr; QNetworkAccessManager *sending_qnam = nullptr;
QWeakPointer<QNetworkAccessManager> qnam_alive; QWeakPointer<QNetworkAccessManager> qnam_alive;
if (Account *account = qobject_cast<Account *>(sender())) { if (auto *account = qobject_cast<Account *>(sender())) {
// Since we go into an event loop, it's possible for the account's qnam // Since we go into an event loop, it's possible for the account's qnam
// to be destroyed before we get back. We can use this to check for its // to be destroyed before we get back. We can use this to check for its
// liveness. // liveness.
@ -236,7 +236,7 @@ void ProxyAuthHandler::storeCredsInKeychain()
_settings->setValue(keychainUsernameKey(), _username); _settings->setValue(keychainUsernameKey(), _username);
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName(), this); auto *job = new WritePasswordJob(Theme::instance()->appName(), this);
job->setSettings(_settings.data()); job->setSettings(_settings.data());
job->setInsecureFallback(false); job->setInsecureFallback(false);
job->setKey(keychainPasswordKey()); job->setKey(keychainPasswordKey());

View file

@ -106,7 +106,7 @@ QSize SelectiveSyncWidget::sizeHint() const
void SelectiveSyncWidget::refreshFolders() void SelectiveSyncWidget::refreshFolders()
{ {
LsColJob *job = new LsColJob(_account, _folderPath, this); auto *job = new LsColJob(_account, _folderPath, this);
job->setProperties(QList<QByteArray>() << "resourcetype" job->setProperties(QList<QByteArray>() << "resourcetype"
<< "http://owncloud.org/ns:size"); << "http://owncloud.org/ns:size");
connect(job, &LsColJob::directoryListingSubfolders, connect(job, &LsColJob::directoryListingSubfolders,
@ -153,7 +153,7 @@ void SelectiveSyncWidget::recursiveInsert(QTreeWidgetItem *parent, QStringList p
parent->setToolTip(0, path); parent->setToolTip(0, path);
parent->setData(0, Qt::UserRole, path); parent->setData(0, Qt::UserRole, path);
} else { } else {
SelectiveSyncTreeViewItem *item = static_cast<SelectiveSyncTreeViewItem *>(findFirstChild(parent, pathTrail.first())); auto *item = static_cast<SelectiveSyncTreeViewItem *>(findFirstChild(parent, pathTrail.first()));
if (!item) { if (!item) {
item = new SelectiveSyncTreeViewItem(parent); item = new SelectiveSyncTreeViewItem(parent);
if (parent->checkState(0) == Qt::Checked if (parent->checkState(0) == Qt::Checked
@ -191,7 +191,7 @@ void SelectiveSyncWidget::slotUpdateDirectories(QStringList list)
QScopedValueRollback<bool> isInserting(_inserting); QScopedValueRollback<bool> isInserting(_inserting);
_inserting = true; _inserting = true;
SelectiveSyncTreeViewItem *root = static_cast<SelectiveSyncTreeViewItem *>(_folderTree->topLevelItem(0)); auto *root = static_cast<SelectiveSyncTreeViewItem *>(_folderTree->topLevelItem(0));
QUrl url = _account->davUrl(); QUrl url = _account->davUrl();
QString pathToRemove = url.path(); QString pathToRemove = url.path();
@ -290,7 +290,7 @@ void SelectiveSyncWidget::slotItemExpanded(QTreeWidgetItem *item)
if (!_folderPath.isEmpty()) { if (!_folderPath.isEmpty()) {
prefix = _folderPath + QLatin1Char('/'); prefix = _folderPath + QLatin1Char('/');
} }
LsColJob *job = new LsColJob(_account, prefix + dir, this); auto *job = new LsColJob(_account, prefix + dir, this);
job->setProperties(QList<QByteArray>() << "resourcetype" job->setProperties(QList<QByteArray>() << "resourcetype"
<< "http://owncloud.org/ns:size"); << "http://owncloud.org/ns:size");
connect(job, &LsColJob::directoryListingSubfolders, connect(job, &LsColJob::directoryListingSubfolders,
@ -457,10 +457,10 @@ SelectiveSyncDialog::SelectiveSyncDialog(AccountPtr account, const QString &fold
void SelectiveSyncDialog::init(const AccountPtr &account) void SelectiveSyncDialog::init(const AccountPtr &account)
{ {
setWindowTitle(tr("Choose What to Sync")); setWindowTitle(tr("Choose What to Sync"));
QVBoxLayout *layout = new QVBoxLayout(this); auto *layout = new QVBoxLayout(this);
_selectiveSync = new SelectiveSyncWidget(account, this); _selectiveSync = new SelectiveSyncWidget(account, this);
layout->addWidget(_selectiveSync); layout->addWidget(_selectiveSync);
QDialogButtonBox *buttonBox = new QDialogButtonBox(Qt::Horizontal); auto *buttonBox = new QDialogButtonBox(Qt::Horizontal);
_okButton = buttonBox->addButton(QDialogButtonBox::Ok); _okButton = buttonBox->addButton(QDialogButtonBox::Ok);
connect(_okButton, &QPushButton::clicked, this, &SelectiveSyncDialog::accept); connect(_okButton, &QPushButton::clicked, this, &SelectiveSyncDialog::accept);
QPushButton *button; QPushButton *button;

View file

@ -70,7 +70,7 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent)
layout()->setMenuBar(_toolBar); layout()->setMenuBar(_toolBar);
// People perceive this as a Window, so also make Ctrl+W work // People perceive this as a Window, so also make Ctrl+W work
QAction *closeWindowAction = new QAction(this); auto *closeWindowAction = new QAction(this);
closeWindowAction->setShortcut(QKeySequence("Ctrl+W")); closeWindowAction->setShortcut(QKeySequence("Ctrl+W"));
connect(closeWindowAction, &QAction::triggered, this, &SettingsDialog::accept); connect(closeWindowAction, &QAction::triggered, this, &SettingsDialog::accept);
addAction(closeWindowAction); addAction(closeWindowAction);
@ -92,7 +92,7 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent)
_toolBar->addAction(_actionBefore); _toolBar->addAction(_actionBefore);
// Adds space between users + activities and general + network actions // Adds space between users + activities and general + network actions
QWidget* spacer = new QWidget(); auto* spacer = new QWidget();
spacer->setMinimumWidth(10); spacer->setMinimumWidth(10);
spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
_toolBar->addWidget(spacer); _toolBar->addWidget(spacer);
@ -100,7 +100,7 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent)
QAction *generalAction = createColorAwareAction(QLatin1String(":/client/theme/settings.svg"), tr("General")); QAction *generalAction = createColorAwareAction(QLatin1String(":/client/theme/settings.svg"), tr("General"));
_actionGroup->addAction(generalAction); _actionGroup->addAction(generalAction);
_toolBar->addAction(generalAction); _toolBar->addAction(generalAction);
GeneralSettings *generalSettings = new GeneralSettings; auto *generalSettings = new GeneralSettings;
_ui->stack->addWidget(generalSettings); _ui->stack->addWidget(generalSettings);
// Connect styleChanged events to our widgets, so they can adapt (Dark-/Light-Mode switching) // Connect styleChanged events to our widgets, so they can adapt (Dark-/Light-Mode switching)
@ -109,7 +109,7 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent)
QAction *networkAction = createColorAwareAction(QLatin1String(":/client/theme/network.svg"), tr("Network")); QAction *networkAction = createColorAwareAction(QLatin1String(":/client/theme/network.svg"), tr("Network"));
_actionGroup->addAction(networkAction); _actionGroup->addAction(networkAction);
_toolBar->addAction(networkAction); _toolBar->addAction(networkAction);
NetworkSettings *networkSettings = new NetworkSettings; auto *networkSettings = new NetworkSettings;
_ui->stack->addWidget(networkSettings); _ui->stack->addWidget(networkSettings);
_actionGroupWidgets.insert(generalAction, generalSettings); _actionGroupWidgets.insert(generalAction, generalSettings);
@ -121,7 +121,7 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent)
QTimer::singleShot(1, this, &SettingsDialog::showFirstPage); QTimer::singleShot(1, this, &SettingsDialog::showFirstPage);
QAction *showLogWindow = new QAction(this); auto *showLogWindow = new QAction(this);
showLogWindow->setShortcut(QKeySequence("F12")); showLogWindow->setShortcut(QKeySequence("F12"));
connect(showLogWindow, &QAction::triggered, gui, &ownCloudGui::slotToggleLogBrowser); connect(showLogWindow, &QAction::triggered, gui, &ownCloudGui::slotToggleLogBrowser);
addAction(showLogWindow); addAction(showLogWindow);
@ -238,7 +238,7 @@ void SettingsDialog::accountAdded(AccountState *s)
void SettingsDialog::slotAccountAvatarChanged() void SettingsDialog::slotAccountAvatarChanged()
{ {
Account *account = static_cast<Account *>(sender()); auto *account = static_cast<Account *>(sender());
if (account && _actionForAccount.contains(account)) { if (account && _actionForAccount.contains(account)) {
QAction *action = _actionForAccount[account]; QAction *action = _actionForAccount[account];
if (action) { if (action) {
@ -252,7 +252,7 @@ void SettingsDialog::slotAccountAvatarChanged()
void SettingsDialog::slotAccountDisplayNameChanged() void SettingsDialog::slotAccountDisplayNameChanged()
{ {
Account *account = static_cast<Account *>(sender()); auto *account = static_cast<Account *>(sender());
if (account && _actionForAccount.contains(account)) { if (account && _actionForAccount.contains(account)) {
QAction *action = _actionForAccount[account]; QAction *action = _actionForAccount[account];
if (action) { if (action) {
@ -308,7 +308,7 @@ void SettingsDialog::customizeStyle()
Q_FOREACH (QAction *a, _actionGroup->actions()) { Q_FOREACH (QAction *a, _actionGroup->actions()) {
QIcon icon = Theme::createColorAwareIcon(a->property("iconPath").toString(), palette()); QIcon icon = Theme::createColorAwareIcon(a->property("iconPath").toString(), palette());
a->setIcon(icon); a->setIcon(icon);
QToolButton *btn = qobject_cast<QToolButton *>(_toolBar->widgetForAction(a)); auto *btn = qobject_cast<QToolButton *>(_toolBar->widgetForAction(a));
if (btn) if (btn)
btn->setIcon(icon); btn->setIcon(icon);
} }
@ -333,7 +333,7 @@ public:
return nullptr; return nullptr;
} }
QToolButton *btn = new QToolButton(parent); auto *btn = new QToolButton(parent);
btn->setDefaultAction(this); btn->setDefaultAction(this);
btn->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); btn->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);

View file

@ -109,7 +109,7 @@ ShareDialog::ShareDialog(QPointer<AccountState> accountState,
} }
if (QFileInfo(_localPath).isFile()) { if (QFileInfo(_localPath).isFile()) {
ThumbnailJob *job = new ThumbnailJob(_sharePath, _accountState->account(), this); auto *job = new ThumbnailJob(_sharePath, _accountState->account(), this);
connect(job, &ThumbnailJob::jobFinished, this, &ShareDialog::slotThumbnailFetched); connect(job, &ThumbnailJob::jobFinished, this, &ShareDialog::slotThumbnailFetched);
job->start(); job->start();
} }

View file

@ -73,7 +73,7 @@ void ShareeModel::fetch(const QString &search, const ShareeSet &blacklist)
{ {
_search = search; _search = search;
_shareeBlacklist = blacklist; _shareeBlacklist = blacklist;
OcsShareeJob *job = new OcsShareeJob(_account); auto *job = new OcsShareeJob(_account);
connect(job, &OcsShareeJob::shareeJobFinished, this, &ShareeModel::shareesFetched); connect(job, &OcsShareeJob::shareeJobFinished, this, &ShareeModel::shareesFetched);
connect(job, &OcsJob::ocsError, this, &ShareeModel::displayErrorMessage); connect(job, &OcsJob::ocsError, this, &ShareeModel::displayErrorMessage);
job->getSharees(_search, _type, 1, 50); job->getSharees(_search, _type, 1, 50);

View file

@ -145,7 +145,7 @@ void ShareLinkWidget::setupUiOptions()
const QDate expireDate = _linkShare.data()->getExpireDate().isValid() ? _linkShare.data()->getExpireDate() : QDate(); const QDate expireDate = _linkShare.data()->getExpireDate().isValid() ? _linkShare.data()->getExpireDate() : QDate();
const SharePermissions perm = _linkShare.data()->getPermissions(); const SharePermissions perm = _linkShare.data()->getPermissions();
bool checked = false; bool checked = false;
QActionGroup *permissionsGroup = new QActionGroup(this); auto *permissionsGroup = new QActionGroup(this);
// Prepare sharing menu // Prepare sharing menu
_linkContextMenu = new QMenu(this); _linkContextMenu = new QMenu(this);
@ -335,7 +335,7 @@ void ShareLinkWidget::slotPasswordSet()
void ShareLinkWidget::startAnimation(const int start, const int end) void ShareLinkWidget::startAnimation(const int start, const int end)
{ {
QPropertyAnimation *animation = new QPropertyAnimation(this, "maximumHeight", this); auto *animation = new QPropertyAnimation(this, "maximumHeight", this);
animation->setDuration(500); animation->setDuration(500);
animation->setStartValue(start); animation->setStartValue(start);

View file

@ -106,7 +106,7 @@ QSharedPointer<Sharee> Share::getShareWith() const
void Share::setPermissions(Permissions permissions) void Share::setPermissions(Permissions permissions)
{ {
OcsShareJob *job = new OcsShareJob(_account); auto *job = new OcsShareJob(_account);
connect(job, &OcsShareJob::shareJobFinished, this, &Share::slotPermissionsSet); connect(job, &OcsShareJob::shareJobFinished, this, &Share::slotPermissionsSet);
connect(job, &OcsJob::ocsError, this, &Share::slotOcsError); connect(job, &OcsJob::ocsError, this, &Share::slotOcsError);
job->setPermissions(getId(), permissions); job->setPermissions(getId(), permissions);
@ -125,7 +125,7 @@ Share::Permissions Share::getPermissions() const
void Share::deleteShare() void Share::deleteShare()
{ {
OcsShareJob *job = new OcsShareJob(_account); auto *job = new OcsShareJob(_account);
connect(job, &OcsShareJob::shareJobFinished, this, &Share::slotDeleted); connect(job, &OcsShareJob::shareJobFinished, this, &Share::slotDeleted);
connect(job, &OcsJob::ocsError, this, &Share::slotOcsError); connect(job, &OcsJob::ocsError, this, &Share::slotOcsError);
job->deleteShare(getId()); job->deleteShare(getId());
@ -207,7 +207,7 @@ QString LinkShare::getNote() const
void LinkShare::setName(const QString &name) void LinkShare::setName(const QString &name)
{ {
OcsShareJob *job = new OcsShareJob(_account); auto *job = new OcsShareJob(_account);
connect(job, &OcsShareJob::shareJobFinished, this, &LinkShare::slotNameSet); connect(job, &OcsShareJob::shareJobFinished, this, &LinkShare::slotNameSet);
connect(job, &OcsJob::ocsError, this, &LinkShare::slotOcsError); connect(job, &OcsJob::ocsError, this, &LinkShare::slotOcsError);
job->setName(getId(), name); job->setName(getId(), name);
@ -215,7 +215,7 @@ void LinkShare::setName(const QString &name)
void LinkShare::setNote(const QString &note) void LinkShare::setNote(const QString &note)
{ {
OcsShareJob *job = new OcsShareJob(_account); auto *job = new OcsShareJob(_account);
connect(job, &OcsShareJob::shareJobFinished, this, &LinkShare::slotNoteSet); connect(job, &OcsShareJob::shareJobFinished, this, &LinkShare::slotNoteSet);
connect(job, &OcsJob::ocsError, this, &LinkShare::slotOcsError); connect(job, &OcsJob::ocsError, this, &LinkShare::slotOcsError);
job->setNote(getId(), note); job->setNote(getId(), note);
@ -234,7 +234,7 @@ QString LinkShare::getToken() const
void LinkShare::setPassword(const QString &password) void LinkShare::setPassword(const QString &password)
{ {
OcsShareJob *job = new OcsShareJob(_account); auto *job = new OcsShareJob(_account);
connect(job, &OcsShareJob::shareJobFinished, this, &LinkShare::slotPasswordSet); connect(job, &OcsShareJob::shareJobFinished, this, &LinkShare::slotPasswordSet);
connect(job, &OcsJob::ocsError, this, &LinkShare::slotSetPasswordError); connect(job, &OcsJob::ocsError, this, &LinkShare::slotSetPasswordError);
job->setPassword(getId(), password); job->setPassword(getId(), password);
@ -248,7 +248,7 @@ void LinkShare::slotPasswordSet(const QJsonDocument &, const QVariant &value)
void LinkShare::setExpireDate(const QDate &date) void LinkShare::setExpireDate(const QDate &date)
{ {
OcsShareJob *job = new OcsShareJob(_account); auto *job = new OcsShareJob(_account);
connect(job, &OcsShareJob::shareJobFinished, this, &LinkShare::slotExpireDateSet); connect(job, &OcsShareJob::shareJobFinished, this, &LinkShare::slotExpireDateSet);
connect(job, &OcsJob::ocsError, this, &LinkShare::slotOcsError); connect(job, &OcsJob::ocsError, this, &LinkShare::slotOcsError);
job->setExpireDate(getId(), date); job->setExpireDate(getId(), date);
@ -291,7 +291,7 @@ void ShareManager::createLinkShare(const QString &path,
const QString &name, const QString &name,
const QString &password) const QString &password)
{ {
OcsShareJob *job = new OcsShareJob(_account); auto *job = new OcsShareJob(_account);
connect(job, &OcsShareJob::shareJobFinished, this, &ShareManager::slotLinkShareCreated); connect(job, &OcsShareJob::shareJobFinished, this, &ShareManager::slotLinkShareCreated);
connect(job, &OcsJob::ocsError, this, &ShareManager::slotOcsError); connect(job, &OcsJob::ocsError, this, &ShareManager::slotOcsError);
job->createLinkShare(path, name, password); job->createLinkShare(path, name, password);
@ -348,7 +348,7 @@ void ShareManager::createShare(const QString &path,
validPermissions &= existingPermissions; validPermissions &= existingPermissions;
} }
OcsShareJob *job = new OcsShareJob(_account); auto *job = new OcsShareJob(_account);
connect(job, &OcsShareJob::shareJobFinished, this, &ShareManager::slotShareCreated); connect(job, &OcsShareJob::shareJobFinished, this, &ShareManager::slotShareCreated);
connect(job, &OcsJob::ocsError, this, &ShareManager::slotOcsError); connect(job, &OcsJob::ocsError, this, &ShareManager::slotOcsError);
job->createShare(path, shareType, shareWith, validPermissions); job->createShare(path, shareType, shareWith, validPermissions);
@ -370,7 +370,7 @@ void ShareManager::slotShareCreated(const QJsonDocument &reply)
void ShareManager::fetchShares(const QString &path) void ShareManager::fetchShares(const QString &path)
{ {
OcsShareJob *job = new OcsShareJob(_account); auto *job = new OcsShareJob(_account);
connect(job, &OcsShareJob::shareJobFinished, this, &ShareManager::slotSharesFetched); connect(job, &OcsShareJob::shareJobFinished, this, &ShareManager::slotSharesFetched);
connect(job, &OcsJob::ocsError, this, &ShareManager::slotOcsError); connect(job, &OcsJob::ocsError, this, &ShareManager::slotOcsError);
job->getShares(path); job->getShares(path);

View file

@ -213,7 +213,7 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
_ui->mainOwnerLabel->setText(QString("Shared with you by ").append(share->getOwnerDisplayName())); _ui->mainOwnerLabel->setText(QString("Shared with you by ").append(share->getOwnerDisplayName()));
} }
ShareUserLine *s = new ShareUserLine(share, _maxSharingPermissions, _isFile, _parentScrollArea); auto *s = new ShareUserLine(share, _maxSharingPermissions, _isFile, _parentScrollArea);
connect(s, &ShareUserLine::resizeRequested, this, &ShareUserGroupWidget::slotAdjustScrollWidgetSize); connect(s, &ShareUserLine::resizeRequested, this, &ShareUserGroupWidget::slotAdjustScrollWidgetSize);
connect(s, &ShareUserLine::visualDeletionDone, this, &ShareUserGroupWidget::getShares); connect(s, &ShareUserLine::visualDeletionDone, this, &ShareUserGroupWidget::getShares);
s->setBackgroundRole(layout->count() % 2 == 0 ? QPalette::Base : QPalette::AlternateBase); s->setBackgroundRole(layout->count() % 2 == 0 ? QPalette::Base : QPalette::AlternateBase);
@ -411,7 +411,7 @@ ShareUserLine::ShareUserLine(QSharedPointer<Share> share,
connect(_ui->permissionsEdit, &QAbstractButton::clicked, this, &ShareUserLine::slotEditPermissionsChanged); connect(_ui->permissionsEdit, &QAbstractButton::clicked, this, &ShareUserLine::slotEditPermissionsChanged);
// create menu with checkable permissions // create menu with checkable permissions
QMenu *menu = new QMenu(this); auto *menu = new QMenu(this);
_permissionReshare= new QAction(tr("Can reshare"), this); _permissionReshare= new QAction(tr("Can reshare"), this);
_permissionReshare->setCheckable(true); _permissionReshare->setCheckable(true);
_permissionReshare->setEnabled(maxSharingPermissions & SharePermissionShare); _permissionReshare->setEnabled(maxSharingPermissions & SharePermissionShare);
@ -518,7 +518,7 @@ void ShareUserLine::loadAvatar()
* Currently only regular users can have avatars. * Currently only regular users can have avatars.
*/ */
if (_share->getShareWith()->type() == Sharee::User) { if (_share->getShareWith()->type() == Sharee::User) {
AvatarJob *job = new AvatarJob(_share->account(), _share->getShareWith()->shareWith(), avatarSize, this); auto *job = new AvatarJob(_share->account(), _share->getShareWith()->shareWith(), avatarSize, this);
connect(job, &AvatarJob::avatarPixmap, this, &ShareUserLine::slotAvatarLoaded); connect(job, &AvatarJob::avatarPixmap, this, &ShareUserLine::slotAvatarLoaded);
job->start(); job->start();
} }
@ -623,7 +623,7 @@ void ShareUserLine::slotDeleteAnimationFinished()
void ShareUserLine::slotShareDeleted() void ShareUserLine::slotShareDeleted()
{ {
QPropertyAnimation *animation = new QPropertyAnimation(this, "maximumHeight", this); auto *animation = new QPropertyAnimation(this, "maximumHeight", this);
animation->setDuration(500); animation->setDuration(500);
animation->setStartValue(height()); animation->setStartValue(height());

View file

@ -271,13 +271,13 @@ void SocketApi::onLostConnection()
void SocketApi::slotSocketDestroyed(QObject *obj) void SocketApi::slotSocketDestroyed(QObject *obj)
{ {
QIODevice *socket = static_cast<QIODevice *>(obj); auto *socket = static_cast<QIODevice *>(obj);
_listeners.erase(std::remove_if(_listeners.begin(), _listeners.end(), ListenerHasSocketPred(socket)), _listeners.end()); _listeners.erase(std::remove_if(_listeners.begin(), _listeners.end(), ListenerHasSocketPred(socket)), _listeners.end());
} }
void SocketApi::slotReadSocket() void SocketApi::slotReadSocket()
{ {
QIODevice *socket = qobject_cast<QIODevice *>(sender()); auto *socket = qobject_cast<QIODevice *>(sender());
ASSERT(socket); ASSERT(socket);
SocketListener *listener = &*std::find_if(_listeners.begin(), _listeners.end(), ListenerHasSocketPred(socket)); SocketListener *listener = &*std::find_if(_listeners.begin(), _listeners.end(), ListenerHasSocketPred(socket));
@ -482,7 +482,7 @@ void SocketApi::command_EDIT(const QString &localFile, SocketListener *listener)
if (!editor) if (!editor)
return; return;
JsonApiJob *job = new JsonApiJob(fileData.folder->accountState()->account(), QLatin1String("ocs/v2.php/apps/files/api/v1/directEditing/open"), this); auto *job = new JsonApiJob(fileData.folder->accountState()->account(), QLatin1String("ocs/v2.php/apps/files/api/v1/directEditing/open"), this);
QUrlQuery params; QUrlQuery params;
params.addQueryItem("path", fileData.accountRelativePath); params.addQueryItem("path", fileData.accountRelativePath);

View file

@ -141,16 +141,16 @@ QMenu *SslButton::buildCertMenu(QMenu *parent, const QSslCertificate &cert,
} }
// create label first // create label first
QLabel *label = new QLabel(parent); auto *label = new QLabel(parent);
label->setStyleSheet(QLatin1String("QLabel { padding: 8px; }")); label->setStyleSheet(QLatin1String("QLabel { padding: 8px; }"));
label->setTextFormat(Qt::RichText); label->setTextFormat(Qt::RichText);
label->setText(details); label->setText(details);
// plug label into widget action // plug label into widget action
QWidgetAction *action = new QWidgetAction(parent); auto *action = new QWidgetAction(parent);
action->setDefaultWidget(label); action->setDefaultWidget(label);
// plug action into menu // plug action into menu
QMenu *menu = new QMenu(parent); auto *menu = new QMenu(parent);
menu->menuAction()->setText(txt); menu->menuAction()->setText(txt);
menu->addAction(action); menu->addAction(action);

View file

@ -148,7 +148,7 @@ bool SslErrorDialog::checkFailingCertsKnown(const QList<QSslError> &errors)
} }
msg += QL("</div></body></html>"); msg += QL("</div></body></html>");
QTextDocument *doc = new QTextDocument(nullptr); auto *doc = new QTextDocument(nullptr);
QString style = styleSheet(); QString style = styleSheet();
doc->addResource(QTextDocument::StyleSheetResource, QUrl(QL("format.css")), style); doc->addResource(QTextDocument::StyleSheetResource, QUrl(QL("format.css")), style);
doc->setHtml(msg); doc->setHtml(msg);

View file

@ -32,7 +32,7 @@ ToolTipUpdater::ToolTipUpdater(QTreeView *treeView)
bool ToolTipUpdater::eventFilter(QObject * /*obj*/, QEvent *ev) bool ToolTipUpdater::eventFilter(QObject * /*obj*/, QEvent *ev)
{ {
if (ev->type() == QEvent::ToolTip) { if (ev->type() == QEvent::ToolTip) {
QHelpEvent *helpEvent = static_cast<QHelpEvent *>(ev); auto *helpEvent = static_cast<QHelpEvent *>(ev);
_toolTipPos = helpEvent->globalPos(); _toolTipPos = helpEvent->globalPos();
} }
return false; return false;

View file

@ -221,7 +221,7 @@ void ActivityListModel::startFetchJob()
if (!_accountState->isConnected()) { if (!_accountState->isConnected()) {
return; return;
} }
JsonApiJob *job = new JsonApiJob(_accountState->account(), QLatin1String("ocs/v2.php/apps/activity/api/v2/activity"), this); auto *job = new JsonApiJob(_accountState->account(), QLatin1String("ocs/v2.php/apps/activity/api/v2/activity"), this);
QObject::connect(job, &JsonApiJob::jsonReceived, QObject::connect(job, &JsonApiJob::jsonReceived,
this, &ActivityListModel::slotActivitiesReceived); this, &ActivityListModel::slotActivitiesReceived);
@ -271,7 +271,7 @@ void ActivityListModel::slotActivitiesReceived(const QJsonDocument &json, int st
a._icon = json.value("icon").toString(); a._icon = json.value("icon").toString();
if (!a._icon.isEmpty()) { if (!a._icon.isEmpty()) {
IconJob *iconJob = new IconJob(QUrl(a._icon)); auto *iconJob = new IconJob(QUrl(a._icon));
iconJob->setProperty("activityId", a._id); iconJob->setProperty("activityId", a._id);
connect(iconJob, &IconJob::jobFinished, this, &ActivityListModel::slotIconDownloaded); connect(iconJob, &IconJob::jobFinished, this, &ActivityListModel::slotIconDownloaded);
} }

View file

@ -57,7 +57,7 @@ void ServerNotificationHandler::slotEtagResponseHeaderReceived(const QByteArray
{ {
if (statusCode == successStatusCode) { if (statusCode == successStatusCode) {
qCWarning(lcServerNotification) << "New Notification ETag Response Header received " << value; qCWarning(lcServerNotification) << "New Notification ETag Response Header received " << value;
AccountState *account = qvariant_cast<AccountState *>(sender()->property(propertyAccountStateC)); auto *account = qvariant_cast<AccountState *>(sender()->property(propertyAccountStateC));
account->setNotificationsEtagResponseHeader(value); account->setNotificationsEtagResponseHeader(value);
} }
} }
@ -83,7 +83,7 @@ void ServerNotificationHandler::slotNotificationsReceived(const QJsonDocument &j
auto notifies = json.object().value("ocs").toObject().value("data").toArray(); auto notifies = json.object().value("ocs").toObject().value("data").toArray();
AccountState *ai = qvariant_cast<AccountState *>(sender()->property(propertyAccountStateC)); auto *ai = qvariant_cast<AccountState *>(sender()->property(propertyAccountStateC));
ActivityList list; ActivityList list;
@ -103,7 +103,7 @@ void ServerNotificationHandler::slotNotificationsReceived(const QJsonDocument &j
a._icon = json.value("icon").toString(); a._icon = json.value("icon").toString();
if (!a._icon.isEmpty()) { if (!a._icon.isEmpty()) {
IconJob *iconJob = new IconJob(QUrl(a._icon)); auto *iconJob = new IconJob(QUrl(a._icon));
iconJob->setProperty("activityId", a._id); iconJob->setProperty("activityId", a._id);
connect(iconJob, &IconJob::jobFinished, this, &ServerNotificationHandler::slotIconDownloaded); connect(iconJob, &IconJob::jobFinished, this, &ServerNotificationHandler::slotIconDownloaded);
} }

View file

@ -137,7 +137,7 @@ void User::slotRefreshNotifications()
// start a server notification handler if no notification requests // start a server notification handler if no notification requests
// are running // are running
if (_notificationRequestsRunning == 0) { if (_notificationRequestsRunning == 0) {
ServerNotificationHandler *snh = new ServerNotificationHandler(_account.data()); auto *snh = new ServerNotificationHandler(_account.data());
connect(snh, &ServerNotificationHandler::newNotificationList, connect(snh, &ServerNotificationHandler::newNotificationList,
this, &User::slotBuildNotificationDisplay); this, &User::slotBuildNotificationDisplay);
@ -185,7 +185,7 @@ void User::slotSendNotificationRequest(const QString &accountName, const QString
if (validVerbs.contains(verb)) { if (validVerbs.contains(verb)) {
AccountStatePtr acc = AccountManager::instance()->account(accountName); AccountStatePtr acc = AccountManager::instance()->account(accountName);
if (acc) { if (acc) {
NotificationConfirmJob *job = new NotificationConfirmJob(acc->account()); auto *job = new NotificationConfirmJob(acc->account());
QUrl l(link); QUrl l(link);
job->setLinkAndVerb(l, verb); job->setLinkAndVerb(l, verb);
job->setProperty("activityRow", QVariant::fromValue(row)); job->setProperty("activityRow", QVariant::fromValue(row));
@ -206,7 +206,7 @@ void User::slotSendNotificationRequest(const QString &accountName, const QString
void User::slotNotifyNetworkError(QNetworkReply *reply) void User::slotNotifyNetworkError(QNetworkReply *reply)
{ {
NotificationConfirmJob *job = qobject_cast<NotificationConfirmJob *>(sender()); auto *job = qobject_cast<NotificationConfirmJob *>(sender());
if (!job) { if (!job) {
return; return;
} }
@ -219,7 +219,7 @@ void User::slotNotifyNetworkError(QNetworkReply *reply)
void User::slotNotifyServerFinished(const QString &reply, int replyCode) void User::slotNotifyServerFinished(const QString &reply, int replyCode)
{ {
NotificationConfirmJob *job = qobject_cast<NotificationConfirmJob *>(sender()); auto *job = qobject_cast<NotificationConfirmJob *>(sender());
if (!job) { if (!job) {
return; return;
} }

View file

@ -137,7 +137,7 @@ void UserInfo::slotUpdateLastInfo(const QJsonDocument &json)
// Avatar Image // Avatar Image
if(_fetchAvatarImage) { if(_fetchAvatarImage) {
AvatarJob *job = new AvatarJob(account, account->davUser(), 128, this); auto *job = new AvatarJob(account, account->davUser(), 128, this);
job->setTimeout(20 * 1000); job->setTimeout(20 * 1000);
QObject::connect(job, &AvatarJob::avatarPixmap, this, &UserInfo::slotAvatarImage); QObject::connect(job, &AvatarJob::avatarPixmap, this, &UserInfo::slotAvatarImage);
job->start(); job->start();

View file

@ -51,7 +51,7 @@ Flow2AuthCredsPage::Flow2AuthCredsPage()
void Flow2AuthCredsPage::initializePage() void Flow2AuthCredsPage::initializePage()
{ {
OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard()); auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
Q_ASSERT(ocWizard); Q_ASSERT(ocWizard);
ocWizard->account()->setCredentials(CredentialsFactory::create("http")); ocWizard->account()->setCredentials(CredentialsFactory::create("http"));
@ -94,7 +94,7 @@ void Flow2AuthCredsPage::slotFlow2AuthResult(Flow2Auth::Result r, const QString
case Flow2Auth::LoggedIn: { case Flow2Auth::LoggedIn: {
_user = user; _user = user;
_appPassword = appPassword; _appPassword = appPassword;
OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard()); auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
Q_ASSERT(ocWizard); Q_ASSERT(ocWizard);
emit connectToOCUrl(ocWizard->account()->url().toString()); emit connectToOCUrl(ocWizard->account()->url().toString());
@ -110,7 +110,7 @@ int Flow2AuthCredsPage::nextId() const
void Flow2AuthCredsPage::setConnected() void Flow2AuthCredsPage::setConnected()
{ {
OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard()); auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
Q_ASSERT(ocWizard); Q_ASSERT(ocWizard);
// bring wizard to top // bring wizard to top
@ -119,7 +119,7 @@ void Flow2AuthCredsPage::setConnected()
AbstractCredentials *Flow2AuthCredsPage::getCredentials() const AbstractCredentials *Flow2AuthCredsPage::getCredentials() const
{ {
OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard()); auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
Q_ASSERT(ocWizard); Q_ASSERT(ocWizard);
return new WebFlowCredentials( return new WebFlowCredentials(
_user, _user,

View file

@ -316,7 +316,7 @@ void OwncloudAdvancedSetupPage::slotSelectiveSyncClicked()
_ui.rSyncEverything->setChecked(_selectiveSyncBlacklist.isEmpty()); _ui.rSyncEverything->setChecked(_selectiveSyncBlacklist.isEmpty());
AccountPtr acc = static_cast<OwncloudWizard *>(wizard())->account(); AccountPtr acc = static_cast<OwncloudWizard *>(wizard())->account();
SelectiveSyncDialog *dlg = new SelectiveSyncDialog(acc, _remoteFolder, _selectiveSyncBlacklist, this); auto *dlg = new SelectiveSyncDialog(acc, _remoteFolder, _selectiveSyncBlacklist, this);
const int result = dlg->exec(); const int result = dlg->exec();
bool updateBlacklist = false; bool updateBlacklist = false;

View file

@ -84,9 +84,9 @@ void OwncloudHttpCredsPage::initializePage()
{ {
WizardCommon::initErrorLabel(_ui.errorLabel); WizardCommon::initErrorLabel(_ui.errorLabel);
OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard()); auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
AbstractCredentials *cred = ocWizard->account()->credentials(); AbstractCredentials *cred = ocWizard->account()->credentials();
HttpCredentials *httpCreds = qobject_cast<HttpCredentials *>(cred); auto *httpCreds = qobject_cast<HttpCredentials *>(cred);
if (httpCreds) { if (httpCreds) {
const QString user = httpCreds->fetchUser(); const QString user = httpCreds->fetchUser();
if (!user.isEmpty()) { if (!user.isEmpty()) {
@ -134,7 +134,7 @@ bool OwncloudHttpCredsPage::validatePage()
startSpinner(); startSpinner();
// Reset cookies to ensure the username / password is actually used // Reset cookies to ensure the username / password is actually used
OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard()); auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
ocWizard->account()->clearCookieJar(); ocWizard->account()->clearCookieJar();
emit completeChanged(); emit completeChanged();

View file

@ -51,7 +51,7 @@ OwncloudOAuthCredsPage::OwncloudOAuthCredsPage()
void OwncloudOAuthCredsPage::initializePage() void OwncloudOAuthCredsPage::initializePage()
{ {
OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard()); auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
Q_ASSERT(ocWizard); Q_ASSERT(ocWizard);
ocWizard->account()->setCredentials(CredentialsFactory::create("http")); ocWizard->account()->setCredentials(CredentialsFactory::create("http"));
_asyncAuth.reset(new OAuth(ocWizard->account().data(), this)); _asyncAuth.reset(new OAuth(ocWizard->account().data(), this));
@ -75,7 +75,7 @@ void OwncloudOAuthCredsPage::asyncAuthResult(OAuth::Result r, const QString &use
switch (r) { switch (r) {
case OAuth::NotSupported: { case OAuth::NotSupported: {
/* OAuth not supported (can't open browser), fallback to HTTP credentials */ /* OAuth not supported (can't open browser), fallback to HTTP credentials */
OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard()); auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
ocWizard->back(); ocWizard->back();
ocWizard->setAuthType(DetermineAuthTypeJob::Basic); ocWizard->setAuthType(DetermineAuthTypeJob::Basic);
break; break;
@ -89,7 +89,7 @@ void OwncloudOAuthCredsPage::asyncAuthResult(OAuth::Result r, const QString &use
_token = token; _token = token;
_user = user; _user = user;
_refreshToken = refreshToken; _refreshToken = refreshToken;
OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard()); auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
Q_ASSERT(ocWizard); Q_ASSERT(ocWizard);
emit connectToOCUrl(ocWizard->account()->url().toString()); emit connectToOCUrl(ocWizard->account()->url().toString());
break; break;
@ -109,7 +109,7 @@ void OwncloudOAuthCredsPage::setConnected()
AbstractCredentials *OwncloudOAuthCredsPage::getCredentials() const AbstractCredentials *OwncloudOAuthCredsPage::getCredentials() const
{ {
OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard()); auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
Q_ASSERT(ocWizard); Q_ASSERT(ocWizard);
return new HttpCredentialsGui(_user, _token, _refreshToken, return new HttpCredentialsGui(_user, _token, _refreshToken,
ocWizard->_clientSslCertificate, ocWizard->_clientSslKey); ocWizard->_clientSslCertificate, ocWizard->_clientSslKey);

View file

@ -133,7 +133,7 @@ void OwncloudSetupPage::slotLogin()
{ {
_ocWizard->setRegistration(false); _ocWizard->setRegistration(false);
_ui.login->setMaximumHeight(0); _ui.login->setMaximumHeight(0);
QPropertyAnimation *animation = new QPropertyAnimation(_ui.login, "maximumHeight"); auto *animation = new QPropertyAnimation(_ui.login, "maximumHeight");
animation->setDuration(0); animation->setDuration(0);
animation->setStartValue(500); animation->setStartValue(500);
animation->setEndValue(500); animation->setEndValue(500);
@ -210,7 +210,7 @@ void OwncloudSetupPage::initializePage()
_checking = false; _checking = false;
QAbstractButton *nextButton = wizard()->button(QWizard::NextButton); QAbstractButton *nextButton = wizard()->button(QWizard::NextButton);
QPushButton *pushButton = qobject_cast<QPushButton *>(nextButton); auto *pushButton = qobject_cast<QPushButton *>(nextButton);
if (pushButton) if (pushButton)
pushButton->setDefault(true); pushButton->setDefault(true);

View file

@ -37,13 +37,13 @@ void OwncloudShibbolethCredsPage::setupBrowser()
if (!_browser.isNull()) { if (!_browser.isNull()) {
return; return;
} }
OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard()); auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
AccountPtr account = ocWizard->account(); AccountPtr account = ocWizard->account();
// we need to reset the cookie jar to drop temporary cookies (like the shib cookie) // we need to reset the cookie jar to drop temporary cookies (like the shib cookie)
// i.e. if someone presses "back" // i.e. if someone presses "back"
QNetworkAccessManager *qnam = account->networkAccessManager(); QNetworkAccessManager *qnam = account->networkAccessManager();
CookieJar *jar = new CookieJar; auto *jar = new CookieJar;
jar->restore(account->cookieJarPath()); jar->restore(account->cookieJarPath());
// Implicitly deletes the old cookie jar, and reparents the jar // Implicitly deletes the old cookie jar, and reparents the jar
qnam->setCookieJar(jar); qnam->setCookieJar(jar);

View file

@ -184,7 +184,7 @@ WebEnginePage::WebEnginePage(QWebEngineProfile *profile, QObject* parent) : QWeb
QWebEnginePage * WebEnginePage::createWindow(QWebEnginePage::WebWindowType type) { QWebEnginePage * WebEnginePage::createWindow(QWebEnginePage::WebWindowType type) {
Q_UNUSED(type); Q_UNUSED(type);
ExternalWebEnginePage *view = new ExternalWebEnginePage(this->profile()); auto *view = new ExternalWebEnginePage(this->profile());
return view; return view;
} }

View file

@ -23,7 +23,7 @@ WebViewPage::WebViewPage(QWidget *parent)
qCInfo(lcWizardWebiewPage()) << "Time for a webview!"; qCInfo(lcWizardWebiewPage()) << "Time for a webview!";
_webView = new WebView(this); _webView = new WebView(this);
QVBoxLayout *layout = new QVBoxLayout(this); auto *layout = new QVBoxLayout(this);
layout->addWidget(_webView); layout->addWidget(_webView);
setLayout(layout); setLayout(layout);

View file

@ -534,12 +534,12 @@ void Account::writeAppPasswordOnce(QString appPassword){
id() id()
); );
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); auto *job = new WritePasswordJob(Theme::instance()->appName());
job->setInsecureFallback(false); job->setInsecureFallback(false);
job->setKey(kck); job->setKey(kck);
job->setBinaryData(appPassword.toLatin1()); job->setBinaryData(appPassword.toLatin1());
connect(job, &WritePasswordJob::finished, [this](Job *incoming) { connect(job, &WritePasswordJob::finished, [this](Job *incoming) {
WritePasswordJob *writeJob = static_cast<WritePasswordJob *>(incoming); auto *writeJob = static_cast<WritePasswordJob *>(incoming);
if (writeJob->error() == NoError) if (writeJob->error() == NoError)
qCInfo(lcAccount) << "appPassword stored in keychain"; qCInfo(lcAccount) << "appPassword stored in keychain";
else else
@ -558,11 +558,11 @@ void Account::retrieveAppPassword(){
id() id()
); );
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); auto *job = new ReadPasswordJob(Theme::instance()->appName());
job->setInsecureFallback(false); job->setInsecureFallback(false);
job->setKey(kck); job->setKey(kck);
connect(job, &ReadPasswordJob::finished, [this](Job *incoming) { connect(job, &ReadPasswordJob::finished, [this](Job *incoming) {
ReadPasswordJob *readJob = static_cast<ReadPasswordJob *>(incoming); auto *readJob = static_cast<ReadPasswordJob *>(incoming);
QString pwd(""); QString pwd("");
// Error or no valid public key error out // Error or no valid public key error out
if (readJob->error() == NoError && if (readJob->error() == NoError &&
@ -587,11 +587,11 @@ void Account::deleteAppPassword(){
return; return;
} }
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName()); auto *job = new DeletePasswordJob(Theme::instance()->appName());
job->setInsecureFallback(false); job->setInsecureFallback(false);
job->setKey(kck); job->setKey(kck);
connect(job, &DeletePasswordJob::finished, [this](Job *incoming) { connect(job, &DeletePasswordJob::finished, [this](Job *incoming) {
DeletePasswordJob *deleteJob = static_cast<DeletePasswordJob *>(incoming); auto *deleteJob = static_cast<DeletePasswordJob *>(incoming);
if (deleteJob->error() == NoError) if (deleteJob->error() == NoError)
qCInfo(lcAccount) << "appPassword deleted from keychain"; qCInfo(lcAccount) << "appPassword deleted from keychain";
else else
@ -612,7 +612,7 @@ void Account::fetchDirectEditors(const QUrl &directEditingURL, const QString &di
if (!directEditingURL.isEmpty() && if (!directEditingURL.isEmpty() &&
(directEditingETag.isEmpty() || directEditingETag != _lastDirectEditingETag)) { (directEditingETag.isEmpty() || directEditingETag != _lastDirectEditingETag)) {
// Fetch the available editors and their mime types // Fetch the available editors and their mime types
JsonApiJob *job = new JsonApiJob(sharedFromThis(), QLatin1String("ocs/v2.php/apps/files/api/v1/directEditing"), this); auto *job = new JsonApiJob(sharedFromThis(), QLatin1String("ocs/v2.php/apps/files/api/v1/directEditing"), this);
QObject::connect(job, &JsonApiJob::jsonReceived, this, &Account::slotDirectEditingRecieved); QObject::connect(job, &JsonApiJob::jsonReceived, this, &Account::slotDirectEditingRecieved);
job->start(); job->start();
} }
@ -633,7 +633,7 @@ void Account::slotDirectEditingRecieved(const QJsonDocument &json)
auto mimeTypes = editor.value("mimetypes").toArray(); auto mimeTypes = editor.value("mimetypes").toArray();
auto optionalMimeTypes = editor.value("optionalMimetypes").toArray(); auto optionalMimeTypes = editor.value("optionalMimetypes").toArray();
DirectEditor *directEditor = new DirectEditor(id, name); auto *directEditor = new DirectEditor(id, name);
foreach(auto mimeType, mimeTypes) { foreach(auto mimeType, mimeTypes) {
directEditor->addMimetype(mimeType.toString().toLatin1()); directEditor->addMimetype(mimeType.toString().toLatin1());

View file

@ -139,7 +139,7 @@ void BandwidthManager::registerDownloadJob(GETFileJob *j)
void BandwidthManager::unregisterDownloadJob(QObject *o) void BandwidthManager::unregisterDownloadJob(QObject *o)
{ {
GETFileJob *j = reinterpret_cast<GETFileJob *>(o); // note, we might already be in the ~QObject auto *j = reinterpret_cast<GETFileJob *>(o); // note, we might already be in the ~QObject
_downloadJobList.removeAll(j); _downloadJobList.removeAll(j);
if (_relativeLimitCurrentMeasuredJob == j) { if (_relativeLimitCurrentMeasuredJob == j) {
_relativeLimitCurrentMeasuredJob = nullptr; _relativeLimitCurrentMeasuredJob = nullptr;

View file

@ -91,7 +91,7 @@ QByteArray generateRandomFilename()
QByteArray generateRandom(int size) QByteArray generateRandom(int size)
{ {
unsigned char *tmp = (unsigned char *)malloc(sizeof(unsigned char) * size); auto *tmp = (unsigned char *)malloc(sizeof(unsigned char) * size);
int ret = RAND_bytes(tmp, size); int ret = RAND_bytes(tmp, size);
if (ret != 1) { if (ret != 1) {
@ -175,7 +175,7 @@ QByteArray encryptPrivateKey(
QByteArray privateKeyB64 = privateKey.toBase64(); QByteArray privateKeyB64 = privateKey.toBase64();
// Make sure we have enough room in the cipher text // Make sure we have enough room in the cipher text
unsigned char *ctext = (unsigned char *)malloc(sizeof(unsigned char) * (privateKeyB64.size() + 32)); auto *ctext = (unsigned char *)malloc(sizeof(unsigned char) * (privateKeyB64.size() + 32));
// Do the actual encryption // Do the actual encryption
int len = 0; int len = 0;
@ -196,7 +196,7 @@ QByteArray encryptPrivateKey(
clen += len; clen += len;
/* Get the tag */ /* Get the tag */
unsigned char *tag = (unsigned char *)calloc(sizeof(unsigned char), 16); auto *tag = (unsigned char *)calloc(sizeof(unsigned char), 16);
if(1 != EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, 16, tag)) { if(1 != EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, 16, tag)) {
qCInfo(lcCse()) << "Error getting the tag"; qCInfo(lcCse()) << "Error getting the tag";
handleErrors(); handleErrors();
@ -263,7 +263,7 @@ QByteArray decryptPrivateKey(const QByteArray& key, const QByteArray& data) {
return QByteArray(); return QByteArray();
} }
unsigned char *ptext = (unsigned char *)calloc(cipherTXT.size() + 16, sizeof(unsigned char)); auto *ptext = (unsigned char *)calloc(cipherTXT.size() + 16, sizeof(unsigned char));
int plen; int plen;
/* Provide the message to be decrypted, and obtain the plaintext output. /* Provide the message to be decrypted, and obtain the plaintext output.
@ -352,7 +352,7 @@ QByteArray decryptStringSymmetric(const QByteArray& key, const QByteArray& data)
return QByteArray(); return QByteArray();
} }
unsigned char *ptext = (unsigned char *)calloc(cipherTXT.size() + 16, sizeof(unsigned char)); auto *ptext = (unsigned char *)calloc(cipherTXT.size() + 16, sizeof(unsigned char));
int plen; int plen;
/* Provide the message to be decrypted, and obtain the plaintext output. /* Provide the message to be decrypted, and obtain the plaintext output.
@ -447,7 +447,7 @@ QByteArray encryptStringSymmetric(const QByteArray& key, const QByteArray& data)
QByteArray dataB64 = data.toBase64(); QByteArray dataB64 = data.toBase64();
// Make sure we have enough room in the cipher text // Make sure we have enough room in the cipher text
unsigned char *ctext = (unsigned char *)malloc(sizeof(unsigned char) * (dataB64.size() + 16)); auto *ctext = (unsigned char *)malloc(sizeof(unsigned char) * (dataB64.size() + 16));
// Do the actual encryption // Do the actual encryption
int len = 0; int len = 0;
@ -470,7 +470,7 @@ QByteArray encryptStringSymmetric(const QByteArray& key, const QByteArray& data)
clen += len; clen += len;
/* Get the tag */ /* Get the tag */
unsigned char *tag = (unsigned char *)calloc(sizeof(unsigned char), 16); auto *tag = (unsigned char *)calloc(sizeof(unsigned char), 16);
if(1 != EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, 16, tag)) { if(1 != EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, 16, tag)) {
qCInfo(lcCse()) << "Error getting the tag"; qCInfo(lcCse()) << "Error getting the tag";
handleErrors(); handleErrors();
@ -534,7 +534,7 @@ QByteArray decryptStringAsymmetric(EVP_PKEY *privateKey, const QByteArray& data)
qCInfo(lcCseDecryption()) << "Size of data is: " << data.size(); qCInfo(lcCseDecryption()) << "Size of data is: " << data.size();
} }
unsigned char *out = (unsigned char *) OPENSSL_malloc(outlen); auto *out = (unsigned char *) OPENSSL_malloc(outlen);
if (!out) { if (!out) {
qCInfo(lcCseDecryption()) << "Could not alloc space for the decrypted metadata"; qCInfo(lcCseDecryption()) << "Could not alloc space for the decrypted metadata";
handleErrors(); handleErrors();
@ -592,7 +592,7 @@ QByteArray encryptStringAsymmetric(EVP_PKEY *publicKey, const QByteArray& data)
qCInfo(lcCse()) << "Encryption Length:" << outLen; qCInfo(lcCse()) << "Encryption Length:" << outLen;
} }
unsigned char *out = (uchar*) OPENSSL_malloc(outLen); auto *out = (uchar*) OPENSSL_malloc(outLen);
if (!out) { if (!out) {
qCInfo(lcCse()) << "Error requesting memory for the encrypted contents"; qCInfo(lcCse()) << "Error requesting memory for the encrypted contents";
exit(1); exit(1);
@ -638,7 +638,7 @@ void ClientSideEncryption::fetchFromKeyChain() {
_account->id() _account->id()
); );
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); auto *job = new ReadPasswordJob(Theme::instance()->appName());
job->setInsecureFallback(false); job->setInsecureFallback(false);
job->setKey(kck); job->setKey(kck);
connect(job, &ReadPasswordJob::finished, this, &ClientSideEncryption::publicKeyFetched); connect(job, &ReadPasswordJob::finished, this, &ClientSideEncryption::publicKeyFetched);
@ -646,7 +646,7 @@ void ClientSideEncryption::fetchFromKeyChain() {
} }
void ClientSideEncryption::publicKeyFetched(Job *incoming) { void ClientSideEncryption::publicKeyFetched(Job *incoming) {
ReadPasswordJob *readJob = static_cast<ReadPasswordJob *>(incoming); auto *readJob = static_cast<ReadPasswordJob *>(incoming);
// Error or no valid public key error out // Error or no valid public key error out
if (readJob->error() != NoError || readJob->binaryData().length() == 0) { if (readJob->error() != NoError || readJob->binaryData().length() == 0) {
@ -671,7 +671,7 @@ void ClientSideEncryption::publicKeyFetched(Job *incoming) {
_account->id() _account->id()
); );
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); auto *job = new ReadPasswordJob(Theme::instance()->appName());
job->setInsecureFallback(false); job->setInsecureFallback(false);
job->setKey(kck); job->setKey(kck);
connect(job, &ReadPasswordJob::finished, this, &ClientSideEncryption::privateKeyFetched); connect(job, &ReadPasswordJob::finished, this, &ClientSideEncryption::privateKeyFetched);
@ -685,7 +685,7 @@ void ClientSideEncryption::setFolderEncryptedStatus(const QString& folder, bool
} }
void ClientSideEncryption::privateKeyFetched(Job *incoming) { void ClientSideEncryption::privateKeyFetched(Job *incoming) {
ReadPasswordJob *readJob = static_cast<ReadPasswordJob *>(incoming); auto *readJob = static_cast<ReadPasswordJob *>(incoming);
// Error or no valid public key error out // Error or no valid public key error out
if (readJob->error() != NoError || readJob->binaryData().length() == 0) { if (readJob->error() != NoError || readJob->binaryData().length() == 0) {
@ -711,7 +711,7 @@ void ClientSideEncryption::privateKeyFetched(Job *incoming) {
_account->id() _account->id()
); );
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); auto *job = new ReadPasswordJob(Theme::instance()->appName());
job->setInsecureFallback(false); job->setInsecureFallback(false);
job->setKey(kck); job->setKey(kck);
connect(job, &ReadPasswordJob::finished, this, &ClientSideEncryption::mnemonicKeyFetched); connect(job, &ReadPasswordJob::finished, this, &ClientSideEncryption::mnemonicKeyFetched);
@ -719,7 +719,7 @@ void ClientSideEncryption::privateKeyFetched(Job *incoming) {
} }
void ClientSideEncryption::mnemonicKeyFetched(QKeychain::Job *incoming) { void ClientSideEncryption::mnemonicKeyFetched(QKeychain::Job *incoming) {
ReadPasswordJob *readJob = static_cast<ReadPasswordJob *>(incoming); auto *readJob = static_cast<ReadPasswordJob *>(incoming);
// Error or no valid public key error out // Error or no valid public key error out
if (readJob->error() != NoError || readJob->textData().length() == 0) { if (readJob->error() != NoError || readJob->textData().length() == 0) {
@ -744,7 +744,7 @@ void ClientSideEncryption::writePrivateKey() {
_account->id() _account->id()
); );
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); auto *job = new WritePasswordJob(Theme::instance()->appName());
job->setInsecureFallback(false); job->setInsecureFallback(false);
job->setKey(kck); job->setKey(kck);
job->setBinaryData(_privateKey); job->setBinaryData(_privateKey);
@ -762,7 +762,7 @@ void ClientSideEncryption::writeCertificate() {
_account->id() _account->id()
); );
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); auto *job = new WritePasswordJob(Theme::instance()->appName());
job->setInsecureFallback(false); job->setInsecureFallback(false);
job->setKey(kck); job->setKey(kck);
job->setBinaryData(_certificate.toPem()); job->setBinaryData(_certificate.toPem());
@ -780,7 +780,7 @@ void ClientSideEncryption::writeMnemonic() {
_account->id() _account->id()
); );
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); auto *job = new WritePasswordJob(Theme::instance()->appName());
job->setInsecureFallback(false); job->setInsecureFallback(false);
job->setKey(kck); job->setKey(kck);
job->setTextData(_mnemonic); job->setTextData(_mnemonic);
@ -799,7 +799,7 @@ void ClientSideEncryption::forgetSensitiveData()
_mnemonic = QString(); _mnemonic = QString();
auto startDeleteJob = [this](QString user) { auto startDeleteJob = [this](QString user) {
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName()); auto *job = new DeletePasswordJob(Theme::instance()->appName());
job->setInsecureFallback(false); job->setInsecureFallback(false);
job->setKey(AbstractCredentials::keychainKey(_account->url().toString(), user, _account->id())); job->setKey(AbstractCredentials::keychainKey(_account->url().toString(), user, _account->id()));
job->start(); job->start();
@ -1408,7 +1408,7 @@ bool EncryptionHelper::fileEncryption(const QByteArray &key, const QByteArray &i
return false; return false;
} }
unsigned char *out = (unsigned char *)malloc(sizeof(unsigned char) * (1024 + 16 -1)); auto *out = (unsigned char *)malloc(sizeof(unsigned char) * (1024 + 16 -1));
int len = 0; int len = 0;
int total_len = 0; int total_len = 0;
@ -1439,7 +1439,7 @@ bool EncryptionHelper::fileEncryption(const QByteArray &key, const QByteArray &i
total_len += len; total_len += len;
/* Get the tag */ /* Get the tag */
unsigned char *tag = (unsigned char *)malloc(sizeof(unsigned char) * 16); auto *tag = (unsigned char *)malloc(sizeof(unsigned char) * 16);
if(1 != EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, 16, tag)) { if(1 != EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, 16, tag)) {
qCInfo(lcCse()) << "Could not get tag"; qCInfo(lcCse()) << "Could not get tag";
return false; return false;
@ -1495,7 +1495,7 @@ bool EncryptionHelper::fileDecryption(const QByteArray &key, const QByteArray& i
qint64 size = input->size() - 16; qint64 size = input->size() - 16;
unsigned char *out = (unsigned char *)malloc(sizeof(unsigned char) * (1024 + 16 -1)); auto *out = (unsigned char *)malloc(sizeof(unsigned char) * (1024 + 16 -1));
int len = 0; int len = 0;
while(input->pos() < size) { while(input->pos() < size) {

View file

@ -37,7 +37,7 @@ void GetFolderEncryptStatusJob::start()
req.setHeader(QNetworkRequest::ContentTypeHeader, QByteArrayLiteral("application/xml")); req.setHeader(QNetworkRequest::ContentTypeHeader, QByteArrayLiteral("application/xml"));
QByteArray xml = "<d:propfind xmlns:d=\"DAV:\"> <d:prop xmlns:nc=\"http://nextcloud.org/ns\"> <nc:is-encrypted/> </d:prop> </d:propfind>"; QByteArray xml = "<d:propfind xmlns:d=\"DAV:\"> <d:prop xmlns:nc=\"http://nextcloud.org/ns\"> <nc:is-encrypted/> </d:prop> </d:propfind>";
QBuffer *buf = new QBuffer(this); auto *buf = new QBuffer(this);
buf->setData(xml); buf->setData(xml);
buf->open(QIODevice::ReadOnly); buf->open(QIODevice::ReadOnly);
QString tmpPath = path() + (!_folder.isEmpty() ? "/" + _folder : QString()); QString tmpPath = path() + (!_folder.isEmpty() ? "/" + _folder : QString());

View file

@ -195,7 +195,7 @@ void HttpCredentials::fetchFromKeychainHelper()
_user + clientCertificatePEMC, _user + clientCertificatePEMC,
_keychainMigration ? QString() : _account->id()); _keychainMigration ? QString() : _account->id());
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); auto *job = new ReadPasswordJob(Theme::instance()->appName());
addSettingsToJob(_account, job); addSettingsToJob(_account, job);
job->setInsecureFallback(false); job->setInsecureFallback(false);
job->setKey(kck); job->setKey(kck);
@ -206,7 +206,7 @@ void HttpCredentials::fetchFromKeychainHelper()
void HttpCredentials::deleteOldKeychainEntries() void HttpCredentials::deleteOldKeychainEntries()
{ {
auto startDeleteJob = [this](QString user) { auto startDeleteJob = [this](QString user) {
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName()); auto *job = new DeletePasswordJob(Theme::instance()->appName());
addSettingsToJob(_account, job); addSettingsToJob(_account, job);
job->setInsecureFallback(true); job->setInsecureFallback(true);
job->setKey(keychainKey(_account->url().toString(), user, QString())); job->setKey(keychainKey(_account->url().toString(), user, QString()));
@ -236,7 +236,7 @@ void HttpCredentials::slotReadClientCertPEMJobDone(QKeychain::Job *incoming)
#endif #endif
// Store PEM in memory // Store PEM in memory
ReadPasswordJob *readJob = static_cast<ReadPasswordJob *>(incoming); auto *readJob = static_cast<ReadPasswordJob *>(incoming);
if (readJob->error() == NoError && readJob->binaryData().length() > 0) { if (readJob->error() == NoError && readJob->binaryData().length() > 0) {
QList<QSslCertificate> sslCertificateList = QSslCertificate::fromData(readJob->binaryData(), QSsl::Pem); QList<QSslCertificate> sslCertificateList = QSslCertificate::fromData(readJob->binaryData(), QSsl::Pem);
if (sslCertificateList.length() >= 1) { if (sslCertificateList.length() >= 1) {
@ -250,7 +250,7 @@ void HttpCredentials::slotReadClientCertPEMJobDone(QKeychain::Job *incoming)
_user + clientKeyPEMC, _user + clientKeyPEMC,
_keychainMigration ? QString() : _account->id()); _keychainMigration ? QString() : _account->id());
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); auto *job = new ReadPasswordJob(Theme::instance()->appName());
addSettingsToJob(_account, job); addSettingsToJob(_account, job);
job->setInsecureFallback(false); job->setInsecureFallback(false);
job->setKey(kck); job->setKey(kck);
@ -261,7 +261,7 @@ void HttpCredentials::slotReadClientCertPEMJobDone(QKeychain::Job *incoming)
void HttpCredentials::slotReadClientKeyPEMJobDone(QKeychain::Job *incoming) void HttpCredentials::slotReadClientKeyPEMJobDone(QKeychain::Job *incoming)
{ {
// Store key in memory // Store key in memory
ReadPasswordJob *readJob = static_cast<ReadPasswordJob *>(incoming); auto *readJob = static_cast<ReadPasswordJob *>(incoming);
if (readJob->error() == NoError && readJob->binaryData().length() > 0) { if (readJob->error() == NoError && readJob->binaryData().length() > 0) {
QByteArray clientKeyPEM = readJob->binaryData(); QByteArray clientKeyPEM = readJob->binaryData();
@ -285,7 +285,7 @@ void HttpCredentials::slotReadClientKeyPEMJobDone(QKeychain::Job *incoming)
_user, _user,
_keychainMigration ? QString() : _account->id()); _keychainMigration ? QString() : _account->id());
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); auto *job = new ReadPasswordJob(Theme::instance()->appName());
addSettingsToJob(_account, job); addSettingsToJob(_account, job);
job->setInsecureFallback(false); job->setInsecureFallback(false);
job->setKey(kck); job->setKey(kck);
@ -304,7 +304,7 @@ bool HttpCredentials::stillValid(QNetworkReply *reply)
void HttpCredentials::slotReadJobDone(QKeychain::Job *incomingJob) void HttpCredentials::slotReadJobDone(QKeychain::Job *incomingJob)
{ {
QKeychain::ReadPasswordJob *job = static_cast<ReadPasswordJob *>(incomingJob); auto *job = static_cast<ReadPasswordJob *>(incomingJob);
QKeychain::Error error = job->error(); QKeychain::Error error = job->error();
// If we can't find the credentials at the keys that include the account id, // If we can't find the credentials at the keys that include the account id,
@ -425,7 +425,7 @@ void HttpCredentials::invalidateToken()
return; return;
} }
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName()); auto *job = new DeletePasswordJob(Theme::instance()->appName());
addSettingsToJob(_account, job); addSettingsToJob(_account, job);
job->setInsecureFallback(true); job->setInsecureFallback(true);
job->setKey(kck); job->setKey(kck);
@ -461,7 +461,7 @@ void HttpCredentials::persist()
// write cert if there is one // write cert if there is one
if (!_clientSslCertificate.isNull()) { if (!_clientSslCertificate.isNull()) {
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); auto *job = new WritePasswordJob(Theme::instance()->appName());
addSettingsToJob(_account, job); addSettingsToJob(_account, job);
job->setInsecureFallback(false); job->setInsecureFallback(false);
connect(job, &Job::finished, this, &HttpCredentials::slotWriteClientCertPEMJobDone); connect(job, &Job::finished, this, &HttpCredentials::slotWriteClientCertPEMJobDone);
@ -477,7 +477,7 @@ void HttpCredentials::slotWriteClientCertPEMJobDone()
{ {
// write ssl key if there is one // write ssl key if there is one
if (!_clientSslKey.isNull()) { if (!_clientSslKey.isNull()) {
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); auto *job = new WritePasswordJob(Theme::instance()->appName());
addSettingsToJob(_account, job); addSettingsToJob(_account, job);
job->setInsecureFallback(false); job->setInsecureFallback(false);
connect(job, &Job::finished, this, &HttpCredentials::slotWriteClientKeyPEMJobDone); connect(job, &Job::finished, this, &HttpCredentials::slotWriteClientKeyPEMJobDone);
@ -491,7 +491,7 @@ void HttpCredentials::slotWriteClientCertPEMJobDone()
void HttpCredentials::slotWriteClientKeyPEMJobDone() void HttpCredentials::slotWriteClientKeyPEMJobDone()
{ {
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); auto *job = new WritePasswordJob(Theme::instance()->appName());
addSettingsToJob(_account, job); addSettingsToJob(_account, job);
job->setInsecureFallback(false); job->setInsecureFallback(false);
connect(job, &Job::finished, this, &HttpCredentials::slotWriteJobDone); connect(job, &Job::finished, this, &HttpCredentials::slotWriteJobDone);
@ -509,7 +509,7 @@ void HttpCredentials::slotWriteJobDone(QKeychain::Job *job)
default: default:
qCWarning(lcHttpCredentials) << "Error while writing password" << job->errorString(); qCWarning(lcHttpCredentials) << "Error while writing password" << job->errorString();
} }
WritePasswordJob *wjob = qobject_cast<WritePasswordJob *>(job); auto *wjob = qobject_cast<WritePasswordJob *>(job);
wjob->deleteLater(); wjob->deleteLater();
} }

View file

@ -156,7 +156,7 @@ void DiscoveryJob::update_job_update_callback(bool local,
const char *dirUrl, const char *dirUrl,
void *userdata) void *userdata)
{ {
DiscoveryJob *updateJob = static_cast<DiscoveryJob *>(userdata); auto *updateJob = static_cast<DiscoveryJob *>(userdata);
if (updateJob) { if (updateJob) {
// Don't wanna overload the UI // Don't wanna overload the UI
if (!updateJob->_lastUpdateProgressCallbackCall.isValid()) { if (!updateJob->_lastUpdateProgressCallbackCall.isValid()) {
@ -263,7 +263,7 @@ DiscoverySingleDirectoryJob::DiscoverySingleDirectoryJob(const AccountPtr &accou
void DiscoverySingleDirectoryJob::start() void DiscoverySingleDirectoryJob::start()
{ {
// Start the actual HTTP job // Start the actual HTTP job
LsColJob *lsColJob = new LsColJob(_account, _subPath, this); auto *lsColJob = new LsColJob(_account, _subPath, this);
QList<QByteArray> props; QList<QByteArray> props;
props << "resourcetype" props << "resourcetype"
@ -652,7 +652,7 @@ void DiscoveryMainThread::abort()
csync_vio_handle_t *DiscoveryJob::remote_vio_opendir_hook(const char *url, csync_vio_handle_t *DiscoveryJob::remote_vio_opendir_hook(const char *url,
void *userdata) void *userdata)
{ {
DiscoveryJob *discoveryJob = static_cast<DiscoveryJob *>(userdata); auto *discoveryJob = static_cast<DiscoveryJob *>(userdata);
if (discoveryJob) { if (discoveryJob) {
qCDebug(lcDiscovery) << discoveryJob << url << "Calling into main thread..."; qCDebug(lcDiscovery) << discoveryJob << url << "Calling into main thread...";
@ -685,9 +685,9 @@ csync_vio_handle_t *DiscoveryJob::remote_vio_opendir_hook(const char *url,
std::unique_ptr<csync_file_stat_t> DiscoveryJob::remote_vio_readdir_hook(csync_vio_handle_t *dhandle, std::unique_ptr<csync_file_stat_t> DiscoveryJob::remote_vio_readdir_hook(csync_vio_handle_t *dhandle,
void *userdata) void *userdata)
{ {
DiscoveryJob *discoveryJob = static_cast<DiscoveryJob *>(userdata); auto *discoveryJob = static_cast<DiscoveryJob *>(userdata);
if (discoveryJob) { if (discoveryJob) {
DiscoveryDirectoryResult *directoryResult = static_cast<DiscoveryDirectoryResult *>(dhandle); auto *directoryResult = static_cast<DiscoveryDirectoryResult *>(dhandle);
if (!directoryResult->list.empty()) { if (!directoryResult->list.empty()) {
auto file_stat = std::move(directoryResult->list.front()); auto file_stat = std::move(directoryResult->list.front());
directoryResult->list.pop_front(); directoryResult->list.pop_front();
@ -699,9 +699,9 @@ std::unique_ptr<csync_file_stat_t> DiscoveryJob::remote_vio_readdir_hook(csync_v
void DiscoveryJob::remote_vio_closedir_hook(csync_vio_handle_t *dhandle, void *userdata) void DiscoveryJob::remote_vio_closedir_hook(csync_vio_handle_t *dhandle, void *userdata)
{ {
DiscoveryJob *discoveryJob = static_cast<DiscoveryJob *>(userdata); auto *discoveryJob = static_cast<DiscoveryJob *>(userdata);
if (discoveryJob) { if (discoveryJob) {
DiscoveryDirectoryResult *directoryResult = static_cast<DiscoveryDirectoryResult *>(dhandle); auto *directoryResult = static_cast<DiscoveryDirectoryResult *>(dhandle);
QString path = directoryResult->path; QString path = directoryResult->path;
qCDebug(lcDiscovery) << discoveryJob << path; qCDebug(lcDiscovery) << discoveryJob << path;
// just deletes the struct and the iterator, the data itself is owned by the SyncEngine/DiscoveryMainThread // just deletes the struct and the iterator, the data itself is owned by the SyncEngine/DiscoveryMainThread

View file

@ -78,7 +78,7 @@ void RequestEtagJob::start()
" <d:getetag/>\n" " <d:getetag/>\n"
" </d:prop>\n" " </d:prop>\n"
"</d:propfind>\n"); "</d:propfind>\n");
QBuffer *buf = new QBuffer(this); auto *buf = new QBuffer(this);
buf->setData(xml); buf->setData(xml);
buf->open(QIODevice::ReadOnly); buf->open(QIODevice::ReadOnly);
// assumes ownership // assumes ownership
@ -343,7 +343,7 @@ void LsColJob::start()
" <d:prop>\n" " <d:prop>\n"
+ propStr + " </d:prop>\n" + propStr + " </d:prop>\n"
"</d:propfind>\n"); "</d:propfind>\n");
QBuffer *buf = new QBuffer(this); auto *buf = new QBuffer(this);
buf->setData(xml); buf->setData(xml);
buf->open(QIODevice::ReadOnly); buf->open(QIODevice::ReadOnly);
if (_url.isValid()) { if (_url.isValid()) {
@ -565,7 +565,7 @@ void PropfindJob::start()
+ propStr + " </d:prop>\n" + propStr + " </d:prop>\n"
"</d:propfind>\n"; "</d:propfind>\n";
QBuffer *buf = new QBuffer(this); auto *buf = new QBuffer(this);
buf->setData(xml); buf->setData(xml);
buf->open(QIODevice::ReadOnly); buf->open(QIODevice::ReadOnly);
sendRequest("PROPFIND", makeDavUrl(path()), req, buf); sendRequest("PROPFIND", makeDavUrl(path()), req, buf);
@ -727,7 +727,7 @@ void ProppatchJob::start()
+ propStr + " </d:prop></d:set>\n" + propStr + " </d:prop></d:set>\n"
"</d:propertyupdate>\n"; "</d:propertyupdate>\n";
QBuffer *buf = new QBuffer(this); auto *buf = new QBuffer(this);
buf->setData(xml); buf->setData(xml);
buf->open(QIODevice::ReadOnly); buf->open(QIODevice::ReadOnly);
sendRequest("PROPPATCH", makeDavUrl(path()), req, buf); sendRequest("PROPPATCH", makeDavUrl(path()), req, buf);
@ -1040,7 +1040,7 @@ void fetchPrivateLinkUrl(AccountPtr account, const QString &remotePath,
oldUrl = account->deprecatedPrivateLinkUrl(numericFileId).toString(QUrl::FullyEncoded); oldUrl = account->deprecatedPrivateLinkUrl(numericFileId).toString(QUrl::FullyEncoded);
// Retrieve the new link by PROPFIND // Retrieve the new link by PROPFIND
PropfindJob *job = new PropfindJob(account, remotePath, target); auto *job = new PropfindJob(account, remotePath, target);
job->setProperties( job->setProperties(
QList<QByteArray>() QList<QByteArray>()
<< "http://owncloud.org/ns:fileid" // numeric file id for fallback private link generation << "http://owncloud.org/ns:fileid" // numeric file id for fallback private link generation

View file

@ -404,7 +404,7 @@ void OwncloudPropagator::start(const SyncFileItemVector &items,
foreach (const SyncFileItemPtr &item, items) { foreach (const SyncFileItemPtr &item, items) {
if (!removedDirectory.isEmpty() && item->_file.startsWith(removedDirectory)) { if (!removedDirectory.isEmpty() && item->_file.startsWith(removedDirectory)) {
// this is an item in a directory which is going to be removed. // this is an item in a directory which is going to be removed.
PropagateDirectory *delDirJob = qobject_cast<PropagateDirectory *>(directoriesToRemove.first()); auto *delDirJob = qobject_cast<PropagateDirectory *>(directoriesToRemove.first());
if (item->_instruction == CSYNC_INSTRUCTION_REMOVE) { if (item->_instruction == CSYNC_INSTRUCTION_REMOVE) {
// already taken care of. (by the removal of the parent directory) // already taken care of. (by the removal of the parent directory)
@ -453,7 +453,7 @@ void OwncloudPropagator::start(const SyncFileItemVector &items,
} }
if (item->isDirectory()) { if (item->isDirectory()) {
PropagateDirectory *dir = new PropagateDirectory(this, item); auto *dir = new PropagateDirectory(this, item);
if (item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE if (item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE
&& item->_direction == SyncFileItem::Up) { && item->_direction == SyncFileItem::Up) {
@ -846,7 +846,7 @@ bool PropagatorCompositeJob::scheduleSelfOrChild()
void PropagatorCompositeJob::slotSubJobFinished(SyncFileItem::Status status) void PropagatorCompositeJob::slotSubJobFinished(SyncFileItem::Status status)
{ {
PropagatorJob *subJob = static_cast<PropagatorJob *>(sender()); auto *subJob = static_cast<PropagatorJob *>(sender());
ASSERT(subJob); ASSERT(subJob);
// Delete the job and remove it from our list of jobs. // Delete the job and remove it from our list of jobs.
@ -980,7 +980,7 @@ void PropagateDirectory::slotSubJobsFinished(SyncFileItem::Status status)
if (_item->_instruction == CSYNC_INSTRUCTION_RENAME if (_item->_instruction == CSYNC_INSTRUCTION_RENAME
|| _item->_instruction == CSYNC_INSTRUCTION_NEW || _item->_instruction == CSYNC_INSTRUCTION_NEW
|| _item->_instruction == CSYNC_INSTRUCTION_UPDATE_METADATA) { || _item->_instruction == CSYNC_INSTRUCTION_UPDATE_METADATA) {
if (PropagateRemoteMkdir *mkdir = qobject_cast<PropagateRemoteMkdir *>(_firstJob.data())) { if (auto *mkdir = qobject_cast<PropagateRemoteMkdir *>(_firstJob.data())) {
// special case from MKDIR, get the fileId from the job there // special case from MKDIR, get the fileId from the job there
if (_item->_fileId.isEmpty() && !mkdir->_item->_fileId.isEmpty()) { if (_item->_fileId.isEmpty() && !mkdir->_item->_fileId.isEmpty()) {
_item->_fileId = mkdir->_item->_fileId; _item->_fileId = mkdir->_item->_fileId;
@ -1018,7 +1018,7 @@ void CleanupPollsJob::start()
SyncJournalFileRecord record; SyncJournalFileRecord record;
if (_journal->getFileRecord(info._file, &record) && record.isValid()) { if (_journal->getFileRecord(info._file, &record) && record.isValid()) {
SyncFileItemPtr item = SyncFileItem::fromSyncJournalFileRecord(record); SyncFileItemPtr item = SyncFileItem::fromSyncJournalFileRecord(record);
PollJob *job = new PollJob(_account, info._url, item, _journal, _localPath, this); auto *job = new PollJob(_account, info._url, item, _journal, _localPath, this);
connect(job, &PollJob::finishedSignal, this, &CleanupPollsJob::slotPollFinished); connect(job, &PollJob::finishedSignal, this, &CleanupPollsJob::slotPollFinished);
job->start(); job->start();
} }
@ -1026,7 +1026,7 @@ void CleanupPollsJob::start()
void CleanupPollsJob::slotPollFinished() void CleanupPollsJob::slotPollFinished()
{ {
PollJob *job = qobject_cast<PollJob *>(sender()); auto *job = qobject_cast<PollJob *>(sender());
ASSERT(job); ASSERT(job);
if (job->_item->_status == SyncFileItem::FatalError) { if (job->_item->_status == SyncFileItem::FatalError) {
emit aborted(job->_item->_errorString); emit aborted(job->_item->_errorString);

View file

@ -686,7 +686,7 @@ void PropagateDownloadFile::slotGetFinished()
// Do checksum validation for the download. If there is no checksum header, the validator // Do checksum validation for the download. If there is no checksum header, the validator
// will also emit the validated() signal to continue the flow in slot transmissionChecksumValidated() // will also emit the validated() signal to continue the flow in slot transmissionChecksumValidated()
// as this is (still) also correct. // as this is (still) also correct.
ValidateChecksumHeader *validator = new ValidateChecksumHeader(this); auto *validator = new ValidateChecksumHeader(this);
connect(validator, &ValidateChecksumHeader::validated, connect(validator, &ValidateChecksumHeader::validated,
this, &PropagateDownloadFile::transmissionChecksumValidated); this, &PropagateDownloadFile::transmissionChecksumValidated);
connect(validator, &ValidateChecksumHeader::validationFailed, connect(validator, &ValidateChecksumHeader::validationFailed,

View file

@ -509,7 +509,7 @@ void UploadDevice::setChoked(bool b)
void PropagateUploadFileCommon::startPollJob(const QString &path) void PropagateUploadFileCommon::startPollJob(const QString &path)
{ {
PollJob *job = new PollJob(propagator()->account(), path, _item, auto *job = new PollJob(propagator()->account(), path, _item,
propagator()->_journal, propagator()->_localDir, this); propagator()->_journal, propagator()->_localDir, this);
connect(job, &PollJob::finishedSignal, this, &PropagateUploadFileCommon::slotPollFinished); connect(job, &PollJob::finishedSignal, this, &PropagateUploadFileCommon::slotPollFinished);
SyncJournalDb::PollInfo info; SyncJournalDb::PollInfo info;
@ -524,7 +524,7 @@ void PropagateUploadFileCommon::startPollJob(const QString &path)
void PropagateUploadFileCommon::slotPollFinished() void PropagateUploadFileCommon::slotPollFinished()
{ {
PollJob *job = qobject_cast<PollJob *>(sender()); auto *job = qobject_cast<PollJob *>(sender());
ASSERT(job); ASSERT(job);
propagator()->_activeJobList.removeOne(this); propagator()->_activeJobList.removeOne(this);

View file

@ -329,7 +329,7 @@ void PropagateUploadFileNG::startNextChunk()
// job takes ownership of device via a QScopedPointer. Job deletes itself when finishing // job takes ownership of device via a QScopedPointer. Job deletes itself when finishing
auto devicePtr = device.get(); // for connections later auto devicePtr = device.get(); // for connections later
PUTFileJob *job = new PUTFileJob(propagator()->account(), url, std::move(device), headers, _currentChunk, this); auto *job = new PUTFileJob(propagator()->account(), url, std::move(device), headers, _currentChunk, this);
_jobs.append(job); _jobs.append(job);
connect(job, &PUTFileJob::finishedSignal, this, &PropagateUploadFileNG::slotPutFinished); connect(job, &PUTFileJob::finishedSignal, this, &PropagateUploadFileNG::slotPutFinished);
connect(job, &PUTFileJob::uploadProgress, connect(job, &PUTFileJob::uploadProgress,
@ -344,7 +344,7 @@ void PropagateUploadFileNG::startNextChunk()
void PropagateUploadFileNG::slotPutFinished() void PropagateUploadFileNG::slotPutFinished()
{ {
PUTFileJob *job = qobject_cast<PUTFileJob *>(sender()); auto *job = qobject_cast<PUTFileJob *>(sender());
ASSERT(job); ASSERT(job);
slotJobDestroyed(job); // remove it from the _jobs list slotJobDestroyed(job); // remove it from the _jobs list

View file

@ -139,7 +139,7 @@ void PropagateUploadFileV1::startNextChunk()
// job takes ownership of device via a QScopedPointer. Job deletes itself when finishing // job takes ownership of device via a QScopedPointer. Job deletes itself when finishing
auto devicePtr = device.get(); // for connections later auto devicePtr = device.get(); // for connections later
PUTFileJob *job = new PUTFileJob(propagator()->account(), propagator()->_remoteFolder + path, std::move(device), headers, _currentChunk, this); auto *job = new PUTFileJob(propagator()->account(), propagator()->_remoteFolder + path, std::move(device), headers, _currentChunk, this);
_jobs.append(job); _jobs.append(job);
connect(job, &PUTFileJob::finishedSignal, this, &PropagateUploadFileV1::slotPutFinished); connect(job, &PUTFileJob::finishedSignal, this, &PropagateUploadFileV1::slotPutFinished);
connect(job, &PUTFileJob::uploadProgress, this, &PropagateUploadFileV1::slotUploadProgress); connect(job, &PUTFileJob::uploadProgress, this, &PropagateUploadFileV1::slotUploadProgress);
@ -187,7 +187,7 @@ void PropagateUploadFileV1::startNextChunk()
void PropagateUploadFileV1::slotPutFinished() void PropagateUploadFileV1::slotPutFinished()
{ {
PUTFileJob *job = qobject_cast<PUTFileJob *>(sender()); auto *job = qobject_cast<PUTFileJob *>(sender());
ASSERT(job); ASSERT(job);
slotJobDestroyed(job); // remove it from the _jobs list slotJobDestroyed(job); // remove it from the _jobs list
@ -357,7 +357,7 @@ void PropagateUploadFileV1::abort(PropagatorJob::AbortType abortType)
abortNetworkJobs( abortNetworkJobs(
abortType, abortType,
[this, abortType](AbstractNetworkJob *job) { [this, abortType](AbstractNetworkJob *job) {
if (PUTFileJob *putJob = qobject_cast<PUTFileJob *>(job)){ if (auto *putJob = qobject_cast<PUTFileJob *>(job)){
if (abortType == AbortType::Asynchronous if (abortType == AbortType::Asynchronous
&& _chunkCount > 0 && _chunkCount > 0
&& (((_currentChunk + _startChunk) % _chunkCount) == 0) && (((_currentChunk + _startChunk) % _chunkCount) == 0)

View file

@ -765,7 +765,7 @@ void SyncEngine::startSync()
QVector<SyncJournalDb::PollInfo> pollInfos = _journal->getPollInfos(); QVector<SyncJournalDb::PollInfo> pollInfos = _journal->getPollInfos();
if (!pollInfos.isEmpty()) { if (!pollInfos.isEmpty()) {
qCInfo(lcEngine) << "Finish Poll jobs before starting a sync"; qCInfo(lcEngine) << "Finish Poll jobs before starting a sync";
CleanupPollsJob *job = new CleanupPollsJob(pollInfos, _account, auto *job = new CleanupPollsJob(pollInfos, _account,
_journal, _localPath, this); _journal, _localPath, this);
connect(job, &CleanupPollsJob::finished, this, &SyncEngine::startSync); connect(job, &CleanupPollsJob::finished, this, &SyncEngine::startSync);
connect(job, &CleanupPollsJob::aborted, this, &SyncEngine::slotCleanPollsJobAborted); connect(job, &CleanupPollsJob::aborted, this, &SyncEngine::slotCleanPollsJobAborted);
@ -899,7 +899,7 @@ void SyncEngine::startSync()
connect(_discoveryMainThread.data(), &DiscoveryMainThread::etagConcatenation, this, &SyncEngine::slotRootEtagReceived); connect(_discoveryMainThread.data(), &DiscoveryMainThread::etagConcatenation, this, &SyncEngine::slotRootEtagReceived);
} }
DiscoveryJob *discoveryJob = new DiscoveryJob(_csync_ctx.data()); auto *discoveryJob = new DiscoveryJob(_csync_ctx.data());
discoveryJob->_selectiveSyncBlackList = selectiveSyncBlackList; discoveryJob->_selectiveSyncBlackList = selectiveSyncBlackList;
discoveryJob->_selectiveSyncWhiteList = discoveryJob->_selectiveSyncWhiteList =
_journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList, &ok); _journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList, &ok);

View file

@ -63,7 +63,7 @@ using namespace OCC;
#ifndef ZLIB_FOUND #ifndef ZLIB_FOUND
QSKIP("ZLIB not found.", SkipSingle); QSKIP("ZLIB not found.", SkipSingle);
#else #else
ComputeChecksum *vali = new ComputeChecksum(this); auto *vali = new ComputeChecksum(this);
_expectedType = "Adler32"; _expectedType = "Adler32";
vali->setChecksumType(_expectedType); vali->setChecksumType(_expectedType);
@ -83,7 +83,7 @@ using namespace OCC;
void testUploadChecksummingMd5() { void testUploadChecksummingMd5() {
ComputeChecksum *vali = new ComputeChecksum(this); auto *vali = new ComputeChecksum(this);
_expectedType = OCC::checkSumMD5C; _expectedType = OCC::checkSumMD5C;
vali->setChecksumType(_expectedType); vali->setChecksumType(_expectedType);
connect(vali, SIGNAL(done(QByteArray,QByteArray)), this, SLOT(slotUpValidated(QByteArray,QByteArray))); connect(vali, SIGNAL(done(QByteArray,QByteArray)), this, SLOT(slotUpValidated(QByteArray,QByteArray)));
@ -100,7 +100,7 @@ using namespace OCC;
void testUploadChecksummingSha1() { void testUploadChecksummingSha1() {
ComputeChecksum *vali = new ComputeChecksum(this); auto *vali = new ComputeChecksum(this);
_expectedType = OCC::checkSumSHA1C; _expectedType = OCC::checkSumSHA1C;
vali->setChecksumType(_expectedType); vali->setChecksumType(_expectedType);
connect(vali, SIGNAL(done(QByteArray,QByteArray)), this, SLOT(slotUpValidated(QByteArray,QByteArray))); connect(vali, SIGNAL(done(QByteArray,QByteArray)), this, SLOT(slotUpValidated(QByteArray,QByteArray)));
@ -125,7 +125,7 @@ using namespace OCC;
adler.append(FileSystem::calcAdler32( _testfile )); adler.append(FileSystem::calcAdler32( _testfile ));
_successDown = false; _successDown = false;
ValidateChecksumHeader *vali = new ValidateChecksumHeader(this); auto *vali = new ValidateChecksumHeader(this);
connect(vali, SIGNAL(validated(QByteArray,QByteArray)), this, SLOT(slotDownValidated())); connect(vali, SIGNAL(validated(QByteArray,QByteArray)), this, SLOT(slotDownValidated()));
connect(vali, SIGNAL(validationFailed(QString)), this, SLOT(slotDownError(QString))); connect(vali, SIGNAL(validationFailed(QString)), this, SLOT(slotDownError(QString)));
vali->start(_testfile, adler); vali->start(_testfile, adler);

View file

@ -45,7 +45,7 @@ private slots:
AccountPtr account = Account::create(); AccountPtr account = Account::create();
QUrl url("http://example.de"); QUrl url("http://example.de");
HttpCredentialsTest *cred = new HttpCredentialsTest("testuser", "secret"); auto *cred = new HttpCredentialsTest("testuser", "secret");
account->setCredentials(cred); account->setCredentials(cred);
account->setUrl( url ); account->setUrl( url );
@ -153,7 +153,7 @@ private slots:
AccountPtr account = Account::create(); AccountPtr account = Account::create();
QUrl url("http://example.de"); QUrl url("http://example.de");
HttpCredentialsTest *cred = new HttpCredentialsTest("testuser", "secret"); auto *cred = new HttpCredentialsTest("testuser", "secret");
account->setCredentials(cred); account->setCredentials(cred);
account->setUrl( url ); account->setUrl( url );
url.setUserName(cred->user()); url.setUserName(cred->user());

View file

@ -317,7 +317,7 @@ private slots:
}); });
// For directly editing the remote checksum // For directly editing the remote checksum
FileInfo &remoteInfo = dynamic_cast<FileInfo &>(fakeFolder.remoteModifier()); auto &remoteInfo = dynamic_cast<FileInfo &>(fakeFolder.remoteModifier());
// Base mtime with no ms content (filesystem is seconds only) // Base mtime with no ms content (filesystem is seconds only)
auto mtime = QDateTime::currentDateTimeUtc().addDays(-4); auto mtime = QDateTime::currentDateTimeUtc().addDays(-4);