From 712869db9a68025362798a4ff9ccc9f3e424a417 Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Mon, 18 May 2020 20:54:23 +0200 Subject: [PATCH] Use auto to avoiding repeating type names Signed-off-by: Kevin Ottens --- .../kmessagewidget/kmessagewidget.cpp | 10 ++--- .../qtsingleapplication.cpp | 6 +-- src/cmd/cmd.cpp | 6 +-- src/common/ownsql.cpp | 2 +- src/gui/accountmanager.cpp | 4 +- src/gui/accountsettings.cpp | 14 +++--- src/gui/accountstate.cpp | 6 +-- src/gui/application.cpp | 6 +-- src/gui/authenticationdialog.cpp | 8 ++-- src/gui/clientproxy.cpp | 2 +- src/gui/connectionvalidator.cpp | 8 ++-- src/gui/creds/httpcredentialsgui.cpp | 2 +- src/gui/creds/keychainchunk.cpp | 8 ++-- .../creds/shibboleth/shibbolethwebview.cpp | 4 +- src/gui/creds/shibbolethcredentials.cpp | 20 ++++----- src/gui/creds/webflowcredentials.cpp | 18 ++++---- src/gui/folderman.cpp | 8 ++-- src/gui/folderstatusdelegate.cpp | 4 +- src/gui/folderstatusmodel.cpp | 6 +-- src/gui/folderwizard.cpp | 10 ++--- src/gui/ignorelisttablewidget.cpp | 4 +- src/gui/logbrowser.cpp | 12 ++--- src/gui/ocsjob.cpp | 2 +- src/gui/owncloudgui.cpp | 4 +- src/gui/owncloudsetupwizard.cpp | 12 ++--- src/gui/proxyauthhandler.cpp | 4 +- src/gui/selectivesyncdialog.cpp | 12 ++--- src/gui/settingsdialog.cpp | 18 ++++---- src/gui/sharedialog.cpp | 2 +- src/gui/sharee.cpp | 2 +- src/gui/sharelinkwidget.cpp | 4 +- src/gui/sharemanager.cpp | 18 ++++---- src/gui/shareusergroupwidget.cpp | 8 ++-- src/gui/socketapi.cpp | 6 +-- src/gui/sslbutton.cpp | 6 +-- src/gui/sslerrordialog.cpp | 2 +- src/gui/tooltipupdater.cpp | 2 +- src/gui/tray/ActivityListModel.cpp | 4 +- src/gui/tray/NotificationHandler.cpp | 6 +-- src/gui/tray/UserModel.cpp | 8 ++-- src/gui/userinfo.cpp | 2 +- src/gui/wizard/flow2authcredspage.cpp | 8 ++-- src/gui/wizard/owncloudadvancedsetuppage.cpp | 2 +- src/gui/wizard/owncloudhttpcredspage.cpp | 6 +-- src/gui/wizard/owncloudoauthcredspage.cpp | 8 ++-- src/gui/wizard/owncloudsetuppage.cpp | 4 +- .../wizard/owncloudshibbolethcredspage.cpp | 4 +- src/gui/wizard/webview.cpp | 2 +- src/gui/wizard/webviewpage.cpp | 2 +- src/libsync/account.cpp | 16 +++---- src/libsync/bandwidthmanager.cpp | 2 +- src/libsync/clientsideencryption.cpp | 44 +++++++++---------- src/libsync/clientsideencryptionjobs.cpp | 2 +- src/libsync/creds/httpcredentials.cpp | 24 +++++----- src/libsync/discoveryphase.cpp | 14 +++--- src/libsync/networkjobs.cpp | 10 ++--- src/libsync/owncloudpropagator.cpp | 12 ++--- src/libsync/propagatedownload.cpp | 2 +- src/libsync/propagateupload.cpp | 4 +- src/libsync/propagateuploadng.cpp | 4 +- src/libsync/propagateuploadv1.cpp | 6 +-- src/libsync/syncengine.cpp | 4 +- test/testchecksumvalidator.cpp | 8 ++-- test/testfolderman.cpp | 4 +- test/testsyncengine.cpp | 2 +- 65 files changed, 242 insertions(+), 242 deletions(-) diff --git a/src/3rdparty/kmessagewidget/kmessagewidget.cpp b/src/3rdparty/kmessagewidget/kmessagewidget.cpp index c0166f622..d2d0f12b7 100644 --- a/src/3rdparty/kmessagewidget/kmessagewidget.cpp +++ b/src/3rdparty/kmessagewidget/kmessagewidget.cpp @@ -91,7 +91,7 @@ void KMessageWidgetPrivate::init(KMessageWidget *q_ptr) QObject::connect(textLabel, &QLabel::linkActivated, q, &KMessageWidget::linkActivated); QObject::connect(textLabel, &QLabel::linkHovered, q, &KMessageWidget::linkHovered); - QAction *closeAction = new QAction(q); + auto *closeAction = new QAction(q); closeAction->setText(KMessageWidget::tr("&Close")); closeAction->setToolTip(KMessageWidget::tr("Close message")); closeAction->setIcon(QIcon(":/client/theme/close.svg")); // ivan: NC customization @@ -115,7 +115,7 @@ void KMessageWidgetPrivate::createLayout() buttons.clear(); Q_FOREACH (QAction *action, q->actions()) { - QToolButton *button = new QToolButton(content); + auto *button = new QToolButton(content); button->setDefaultAction(action); button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); buttons.append(button); @@ -127,7 +127,7 @@ void KMessageWidgetPrivate::createLayout() closeButton->setAutoRaise(buttons.isEmpty()); 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 layout->addWidget(iconLabel, 0, 0, 1, 1, Qt::AlignHCenter | Qt::AlignTop); layout->addWidget(textLabel, 0, 1); @@ -137,7 +137,7 @@ void KMessageWidgetPrivate::createLayout() layout->addWidget(closeButton, 0, 2, 1, 1, Qt::AlignHCenter | Qt::AlignTop); } else { // Use an additional layout in row 1 for the buttons. - QHBoxLayout *buttonLayout = new QHBoxLayout; + auto *buttonLayout = new QHBoxLayout; buttonLayout->addStretch(); Q_FOREACH (QToolButton *button, buttons) { // 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); } } else { - QHBoxLayout *layout = new QHBoxLayout(content); + auto *layout = new QHBoxLayout(content); layout->addWidget(iconLabel); layout->addWidget(textLabel); diff --git a/src/3rdparty/qtsingleapplication/qtsingleapplication.cpp b/src/3rdparty/qtsingleapplication/qtsingleapplication.cpp index 5934d1cb3..b1895a5a4 100644 --- a/src/3rdparty/qtsingleapplication/qtsingleapplication.cpp +++ b/src/3rdparty/qtsingleapplication/qtsingleapplication.cpp @@ -81,7 +81,7 @@ QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char * lockfile.open(QtLockedFile::ReadWrite); lockfile.lock(QtLockedFile::WriteLock); - qint64 *pids = static_cast(instances->data()); + auto *pids = static_cast(instances->data()); if (!created) { // Find the first instance that it still running // The whole list needs to be iterated in order to append to it @@ -109,7 +109,7 @@ QtSingleApplication::~QtSingleApplication() lockfile.open(QtLockedFile::ReadWrite); lockfile.lock(QtLockedFile::WriteLock); // Rewrite array, removing current pid and previously crashed ones - qint64 *pids = static_cast(instances->data()); + auto *pids = static_cast(instances->data()); qint64 *newpids = pids; for (; *pids; ++pids) { if (*pids != appPid && isRunning(*pids)) @@ -122,7 +122,7 @@ QtSingleApplication::~QtSingleApplication() bool QtSingleApplication::event(QEvent *event) { if (event->type() == QEvent::FileOpen) { - QFileOpenEvent *foe = static_cast(event); + auto *foe = static_cast(event); emit fileOpenRequest(foe->file()); return true; } diff --git a/src/cmd/cmd.cpp b/src/cmd/cmd.cpp index 290c496a1..8f8026a07 100644 --- a/src/cmd/cmd.cpp +++ b/src/cmd/cmd.cpp @@ -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) { 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) 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) { auto caps = json.object().value("ocs").toObject().value("data").toObject().value("capabilities").toObject(); qDebug() << "Server capabilities" << caps; diff --git a/src/common/ownsql.cpp b/src/common/ownsql.cpp index 6aa3649c1..937bcf918 100644 --- a/src/common/ownsql.cpp +++ b/src/common/ownsql.cpp @@ -384,7 +384,7 @@ void SqlQuery::bindValue(int pos, const QVariant &value) case QVariant::String: { if (!value.toString().isNull()) { // lifetime of string == lifetime of its qvariant - const QString *str = static_cast(value.constData()); + const auto *str = static_cast(value.constData()); res = sqlite3_bind_text16(_stmt, pos, str->utf16(), (str->size()) * sizeof(QChar), SQLITE_TRANSIENT); } else { diff --git a/src/gui/accountmanager.cpp b/src/gui/accountmanager.cpp index eec375180..34c4cbc3e 100644 --- a/src/gui/accountmanager.cpp +++ b/src/gui/accountmanager.cpp @@ -211,7 +211,7 @@ void AccountManager::saveAccountHelper(Account *acc, QSettings &settings, bool s // Save cookies. if (acc->_am) { - CookieJar *jar = qobject_cast(acc->_am->cookieJar()); + auto *jar = qobject_cast(acc->_am->cookieJar()); if (jar) { qCInfo(lcAccountManager) << "Saving cookies." << acc->cookieJarPath(); jar->save(acc->cookieJarPath()); @@ -347,7 +347,7 @@ AccountPtr AccountManager::createAccount() void AccountManager::displayMnemonic(const QString& mnemonic) { - QDialog *widget = new QDialog; + auto *widget = new QDialog; Ui_Dialog ui; ui.setupUi(widget); widget->setWindowTitle(tr("End to end encryption mnemonic")); diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index a8d07e9db..7be63b3f9 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -120,7 +120,7 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent) _model = new FolderStatusModel; _model->setAccountState(_accountState); _model->setParent(this); - FolderStatusDelegate *delegate = new FolderStatusDelegate; + auto *delegate = new FolderStatusDelegate; delegate->setParent(this); // 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, this, &AccountSettings::refreshSelectiveSyncStatus); - QAction *syncNowAction = new QAction(this); + auto *syncNowAction = new QAction(this); syncNowAction->setShortcut(QKeySequence(Qt::Key_F6)); connect(syncNowAction, &QAction::triggered, this, &AccountSettings::slotScheduleCurrentFolder); addAction(syncNowAction); - QAction *syncNowWithRemoteDiscovery = new QAction(this); + auto *syncNowWithRemoteDiscovery = new QAction(this); syncNowWithRemoteDiscovery->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F6)); connect(syncNowWithRemoteDiscovery, &QAction::triggered, this, &AccountSettings::slotScheduleCurrentFolderForceRemoteDiscovery); addAction(syncNowWithRemoteDiscovery); @@ -215,7 +215,7 @@ void AccountSettings::slotNewMnemonicGenerated() { _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, _ui->encryptionMessage, &KMessageWidget::hide); @@ -595,7 +595,7 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos) bool folderConnected = _model->data(index, FolderStatusDelegate::FolderAccountConnected).toBool(); auto folderMan = FolderMan::instance(); - QMenu *menu = new QMenu(tv); + auto *menu = new QMenu(tv); menu->setAttribute(Qt::WA_DeleteOnClose); @@ -668,7 +668,7 @@ void AccountSettings::slotAddFolder() FolderMan *folderMan = FolderMan::instance(); 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::rejected, this, &AccountSettings::slotFolderWizardRejected); @@ -678,7 +678,7 @@ void AccountSettings::slotAddFolder() void AccountSettings::slotFolderWizardAccepted() { - FolderWizard *folderWizard = qobject_cast(sender()); + auto *folderWizard = qobject_cast(sender()); FolderMan *folderMan = FolderMan::instance(); qCInfo(lcAccountSettings) << "Folder wizard completed"; diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index 90eec6275..6802dcf7f 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -236,7 +236,7 @@ void AccountState::checkConnectivity() return; } - ConnectionValidator *conValidator = new ConnectionValidator(AccountStatePtr(this)); + auto *conValidator = new ConnectionValidator(AccountStatePtr(this)); _connectionValidator = conValidator; connect(conValidator, &ConnectionValidator::connectionResult, this, &AccountState::slotConnectionValidatorResult); @@ -419,7 +419,7 @@ std::unique_ptr AccountState::settings() } void AccountState::fetchNavigationApps(){ - OcsNavigationAppsJob *job = new OcsNavigationAppsJob(_account); + auto *job = new OcsNavigationAppsJob(_account); job->addRawHeader("If-None-Match", navigationAppsEtagResponseHeader()); connect(job, &OcsNavigationAppsJob::appsJobFinished, this, &AccountState::slotNavigationAppsFetched); connect(job, &OcsNavigationAppsJob::etagResponseHeaderReceived, this, &AccountState::slotEtagResponseHeaderReceived); @@ -456,7 +456,7 @@ void AccountState::slotNavigationAppsFetched(const QJsonDocument &reply, int sta foreach (const QJsonValue &value, navLinks) { 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())); _apps << app; diff --git a/src/gui/application.cpp b/src/gui/application.cpp index 7d7cf85b3..9083924fc 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -608,9 +608,9 @@ void Application::setupTranslations() if (!enforcedLocale.isEmpty()) uiLanguages.prepend(enforcedLocale); - QTranslator *translator = new QTranslator(this); - QTranslator *qtTranslator = new QTranslator(this); - QTranslator *qtkeychainTranslator = new QTranslator(this); + auto *translator = new QTranslator(this); + auto *qtTranslator = new QTranslator(this); + auto *qtkeychainTranslator = new QTranslator(this); foreach (QString lang, uiLanguages) { lang.replace(QLatin1Char('-'), QLatin1Char('_')); // work around QTBUG-25973 diff --git a/src/gui/authenticationdialog.cpp b/src/gui/authenticationdialog.cpp index 80fea6321..c04176e15 100644 --- a/src/gui/authenticationdialog.cpp +++ b/src/gui/authenticationdialog.cpp @@ -28,18 +28,18 @@ AuthenticationDialog::AuthenticationDialog(const QString &realm, const QString & , _password(new QLineEdit) { setWindowTitle(tr("Authentication Required")); - QVBoxLayout *lay = new QVBoxLayout(this); - QLabel *label = new QLabel(tr("Enter username and password for '%1' at %2.").arg(realm, domain)); + auto *lay = new QVBoxLayout(this); + auto *label = new QLabel(tr("Enter username and password for '%1' at %2.").arg(realm, domain)); label->setTextFormat(Qt::PlainText); lay->addWidget(label); - QFormLayout *form = new QFormLayout; + auto *form = new QFormLayout; form->addRow(tr("&User:"), _user); form->addRow(tr("&Password:"), _password); lay->addLayout(form); _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::rejected, this, &QDialog::reject); lay->addWidget(box); diff --git a/src/gui/clientproxy.cpp b/src/gui/clientproxy.cpp index 657a93538..d9f851d1a 100644 --- a/src/gui/clientproxy.cpp +++ b/src/gui/clientproxy.cpp @@ -130,7 +130,7 @@ const char *ClientProxy::proxyTypeToCStr(QNetworkProxy::ProxyType type) 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); QThreadPool::globalInstance()->start(runnable); // takes ownership and deletes } diff --git a/src/gui/connectionvalidator.cpp b/src/gui/connectionvalidator.cpp index 3b9f8f4ca..eab6479da 100644 --- a/src/gui/connectionvalidator.cpp +++ b/src/gui/connectionvalidator.cpp @@ -88,7 +88,7 @@ void ConnectionValidator::systemProxyLookupDone(const QNetworkProxy &proxy) // The actual check void ConnectionValidator::slotCheckServerAndAuth() { - CheckServerJob *checkJob = new CheckServerJob(_account, this); + auto *checkJob = new CheckServerJob(_account, this); checkJob->setTimeout(timeoutToUseMsec); checkJob->setIgnoreCredentialFailure(true); 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. // continue in slotAuthCheck here :-) qCDebug(lcConnectionValidator) << "# Check whether authenticated propfind works."; - PropfindJob *job = new PropfindJob(_account, "/", this); + auto *job = new PropfindJob(_account, "/", this); job->setTimeout(timeoutToUseMsec); job->setProperties(QList() << "getlastmodified"); connect(job, &PropfindJob::result, this, &ConnectionValidator::slotAuthSuccess); @@ -223,7 +223,7 @@ void ConnectionValidator::slotAuthSuccess() void ConnectionValidator::checkServerCapabilities() { // 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); QObject::connect(job, &JsonApiJob::jsonReceived, this, &ConnectionValidator::slotCapabilitiesRecieved); job->start(); @@ -273,7 +273,7 @@ void ConnectionValidator::ocsConfigReceived(const QJsonDocument &json, AccountPt 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); userInfo->setActive(true); } diff --git a/src/gui/creds/httpcredentialsgui.cpp b/src/gui/creds/httpcredentialsgui.cpp index a59d05ea5..cf8261c97 100644 --- a/src/gui/creds/httpcredentialsgui.cpp +++ b/src/gui/creds/httpcredentialsgui.cpp @@ -121,7 +121,7 @@ void HttpCredentialsGui::showDialog() dialog.setLabelText(msg); dialog.setTextValue(_previousPassword); dialog.setTextEchoMode(QLineEdit::Password); - if (QLabel *dialogLabel = dialog.findChild()) { + if (auto *dialogLabel = dialog.findChild()) { dialogLabel->setOpenExternalLinks(true); dialogLabel->setTextFormat(Qt::RichText); } diff --git a/src/gui/creds/keychainchunk.cpp b/src/gui/creds/keychainchunk.cpp index ceacd27d7..cd6d3257f 100644 --- a/src/gui/creds/keychainchunk.cpp +++ b/src/gui/creds/keychainchunk.cpp @@ -68,7 +68,7 @@ void WriteJob::start() void WriteJob::slotWriteJobDone(QKeychain::Job *incomingJob) { - QKeychain::WritePasswordJob *writeJob = static_cast(incomingJob); + auto *writeJob = static_cast(incomingJob); // errors? if (writeJob) { @@ -114,7 +114,7 @@ void WriteJob::slotWriteJobDone(QKeychain::Job *incomingJob) _key + (index > 0 ? (QString(".") + QString::number(index)) : QString()), _account->id()); - QKeychain::WritePasswordJob *job = new QKeychain::WritePasswordJob(_serviceName); + auto *job = new QKeychain::WritePasswordJob(_serviceName); #if defined(KEYCHAINCHUNK_ENABLE_INSECURE_FALLBACK) addSettingsToJob(_account, job); #endif @@ -158,7 +158,7 @@ void ReadJob::start() _key, _keychainMigration ? QString() : _account->id()); - QKeychain::ReadPasswordJob *job = new QKeychain::ReadPasswordJob(_serviceName); + auto *job = new QKeychain::ReadPasswordJob(_serviceName); #if defined(KEYCHAINCHUNK_ENABLE_INSECURE_FALLBACK) addSettingsToJob(_account, job); #endif @@ -171,7 +171,7 @@ void ReadJob::start() void ReadJob::slotReadJobDone(QKeychain::Job *incomingJob) { // Errors or next chunk? - QKeychain::ReadPasswordJob *readJob = static_cast(incomingJob); + auto *readJob = static_cast(incomingJob); if (readJob) { if (readJob->error() == NoError && readJob->binaryData().length() > 0) { diff --git a/src/gui/creds/shibboleth/shibbolethwebview.cpp b/src/gui/creds/shibboleth/shibbolethwebview.cpp index 8e4465b3c..1fb0a7b46 100644 --- a/src/gui/creds/shibboleth/shibbolethwebview.cpp +++ b/src/gui/creds/shibboleth/shibbolethwebview.cpp @@ -87,9 +87,9 @@ ShibbolethWebView::ShibbolethWebView(AccountPtr account, QWidget *parent) // open an additional window to display some cipher debug info QWebPage *debugPage = new UserAgentWebPage(this); debugPage->mainFrame()->load(QUrl("https://cc.dcsec.uni-hannover.de/")); - QWebView *debugView = new QWebView(this); + auto *debugView = new QWebView(this); debugView->setPage(debugPage); - QMainWindow *window = new QMainWindow(this); + auto *window = new QMainWindow(this); window->setWindowTitle(tr("SSL Cipher Debug View")); window->setCentralWidget(debugView); window->show(); diff --git a/src/gui/creds/shibbolethcredentials.cpp b/src/gui/creds/shibbolethcredentials.cpp index a9766f8c6..a09136a97 100644 --- a/src/gui/creds/shibbolethcredentials.cpp +++ b/src/gui/creds/shibbolethcredentials.cpp @@ -141,7 +141,7 @@ void ShibbolethCredentials::fetchFromKeychain() 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->setInsecureFallback(false); job->setKey(keychainKey(_url.toString(), user(), @@ -153,7 +153,7 @@ void ShibbolethCredentials::fetchFromKeychainHelper() void ShibbolethCredentials::askFromUser() { // 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) { if (type == DetermineAuthTypeJob::Shibboleth) { // Normal case, still shibboleth @@ -197,7 +197,7 @@ void ShibbolethCredentials::invalidateToken() { _ready = false; - CookieJar *jar = static_cast(_account->networkAccessManager()->cookieJar()); + auto *jar = static_cast(_account->networkAccessManager()->cookieJar()); // Remove the _shibCookie auto cookies = jar->allCookies(); @@ -234,7 +234,7 @@ void ShibbolethCredentials::slotFetchUser() { // 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?) - 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); job->setIgnoreCredentialFailure(true); job->start(); @@ -242,7 +242,7 @@ void ShibbolethCredentials::slotFetchUser() void ShibbolethCredentials::slotFetchUserHelper() { - ShibbolethUserJob *job = new ShibbolethUserJob(_account->sharedFromThis(), this); + auto *job = new ShibbolethUserJob(_account->sharedFromThis(), this); connect(job, &ShibbolethUserJob::userFetched, this, &ShibbolethCredentials::slotUserFetched); job->start(); } @@ -287,7 +287,7 @@ void ShibbolethCredentials::slotReadJobDone(QKeychain::Job *job) } if (job->error() == QKeychain::NoError) { - ReadPasswordJob *readJob = static_cast(job); + auto *readJob = static_cast(job); delete readJob->settings(); QList cookies = QNetworkCookie::parseCookies(readJob->textData().toUtf8()); if (cookies.count() > 0) { @@ -310,7 +310,7 @@ void ShibbolethCredentials::slotReadJobDone(QKeychain::Job *job) if (_keychainMigration && _ready) { 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->setKey(keychainKey(_account->url().toString(), user(), QString())); job->start(); @@ -326,7 +326,7 @@ void ShibbolethCredentials::showLoginWindow() return; } - CookieJar *jar = static_cast(_account->networkAccessManager()->cookieJar()); + auto *jar = static_cast(_account->networkAccessManager()->cookieJar()); // 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 // real long term cookie we want to store) @@ -366,7 +366,7 @@ QByteArray ShibbolethCredentials::shibCookieName() 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()); // we don't really care if it works... //connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotWriteJobDone(QKeychain::Job*))); @@ -377,7 +377,7 @@ void ShibbolethCredentials::storeShibCookie(const QNetworkCookie &cookie) 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->setKey(keychainKey(_account->url().toString(), user(), _account->id())); job->start(); diff --git a/src/gui/creds/webflowcredentials.cpp b/src/gui/creds/webflowcredentials.cpp index fb85fc5d2..16d4ccd62 100644 --- a/src/gui/creds/webflowcredentials.cpp +++ b/src/gui/creds/webflowcredentials.cpp @@ -152,7 +152,7 @@ void WebFlowCredentials::fetchFromKeychain() { void WebFlowCredentials::askFromUser() { // 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 - DetermineAuthTypeJob *job = new DetermineAuthTypeJob(_account->sharedFromThis(), this); + auto *job = new DetermineAuthTypeJob(_account->sharedFromThis(), this); connect(job, &DetermineAuthTypeJob::authType, [this](DetermineAuthTypeJob::AuthType type) { // LoginFlowV2 > WebViewFlow > OAuth > Shib > Basic bool useFlow2 = (type != DetermineAuthTypeJob::WebViewFlow); @@ -340,7 +340,7 @@ void WebFlowCredentials::slotWriteClientCaCertsPEMJobDone(KeychainChunk::WriteJo } // 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) addSettingsToJob(_account, job); #endif @@ -360,7 +360,7 @@ void WebFlowCredentials::slotWriteJobDone(QKeychain::Job *job) default: qCWarning(lcWebFlowCredentials) << "Error while writing password" << job->errorString(); } - WritePasswordJob *wjob = qobject_cast(job); + auto *wjob = qobject_cast(job); wjob->deleteLater(); } @@ -390,11 +390,11 @@ void WebFlowCredentials::forgetSensitiveData() { return; } - DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName()); + auto *job = new DeletePasswordJob(Theme::instance()->appName()); job->setInsecureFallback(false); job->setKey(kck); connect(job, &Job::finished, this, [](QKeychain::Job *job) { - DeletePasswordJob *djob = qobject_cast(job); + auto *djob = qobject_cast(job); djob->deleteLater(); }); job->start(); @@ -565,7 +565,7 @@ void WebFlowCredentials::slotReadClientCaCertsPEMJobDone(KeychainChunk::ReadJob _user, _keychainMigration ? QString() : _account->id()); - ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); + auto *job = new ReadPasswordJob(Theme::instance()->appName()); #if defined(KEYCHAINCHUNK_ENABLE_INSECURE_FALLBACK) addSettingsToJob(_account, job); #endif @@ -576,7 +576,7 @@ void WebFlowCredentials::slotReadClientCaCertsPEMJobDone(KeychainChunk::ReadJob } void WebFlowCredentials::slotReadPasswordJobDone(Job *incomingJob) { - QKeychain::ReadPasswordJob *job = qobject_cast(incomingJob); + auto *job = qobject_cast(incomingJob); QKeychain::Error error = job->error(); // 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) { 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) addSettingsToJob(_account, job); #endif @@ -622,7 +622,7 @@ void WebFlowCredentials::deleteKeychainEntries(bool oldKeychainEntries) { oldKeychainEntries ? QString() : _account->id())); connect(job, &Job::finished, this, [](QKeychain::Job *job) { - DeletePasswordJob *djob = qobject_cast(job); + auto *djob = qobject_cast(job); djob->deleteLater(); }); job->start(); diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index 88b112928..71f991c71 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -463,7 +463,7 @@ void FolderMan::slotFolderSyncPaused(Folder *f, bool paused) void FolderMan::slotFolderCanSyncChanged() { - Folder *f = qobject_cast(sender()); + auto *f = qobject_cast(sender()); ASSERT(f); if (f->canSync()) { _socketApi->slotRegisterPath(f->alias()); @@ -608,7 +608,7 @@ void FolderMan::slotRunOneEtagJob() void FolderMan::slotAccountStateChanged() { - AccountState *accountState = qobject_cast(sender()); + auto *accountState = qobject_cast(sender()); if (!accountState) { return; } @@ -790,7 +790,7 @@ void FolderMan::slotRemoveFoldersForAccount(AccountState *accountState) void FolderMan::slotForwardFolderSyncStateChange() { - if (Folder *f = qobject_cast(sender())) { + if (auto *f = qobject_cast(sender())) { emit folderSyncStateChange(f); } } @@ -1378,7 +1378,7 @@ QString FolderMan::checkPathValidityForNewFolder(const QString &path, const QUrl const QString userDir = QDir::cleanPath(canonicalPath(path)) + '/'; for (auto i = _folderMap.constBegin(); i != _folderMap.constEnd(); ++i) { - Folder *f = static_cast(i.value()); + auto *f = static_cast(i.value()); QString folderDir = QDir::cleanPath(canonicalPath(f->path())) + '/'; bool differentPaths = QString::compare(folderDir, userDir, cs) != 0; diff --git a/src/gui/folderstatusdelegate.cpp b/src/gui/folderstatusdelegate.cpp index d7ba865a4..9aa41e74e 100644 --- a/src/gui/folderstatusdelegate.cpp +++ b/src/gui/folderstatusdelegate.cpp @@ -372,8 +372,8 @@ bool FolderStatusDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, switch (event->type()) { case QEvent::MouseButtonPress: case QEvent::MouseMove: - if (const QAbstractItemView *view = qobject_cast(option.widget)) { - QMouseEvent *me = static_cast(event); + if (const auto *view = qobject_cast(option.widget)) { + auto *me = static_cast(event); QModelIndex index; if (me->buttons()) { index = view->indexAt(me->pos()); diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index 3f0d20adf..ef773f555 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -286,7 +286,7 @@ bool FolderStatusModel::setData(const QModelIndex &index, const QVariant &value, { if (role == Qt::CheckStateRole) { auto info = infoForIndex(index); - Qt::CheckState checked = static_cast(value.toInt()); + auto checked = static_cast(value.toInt()); if (info && info->_checked != checked) { info->_checked = checked; @@ -589,7 +589,7 @@ void FolderStatusModel::fetchMore(const QModelIndex &parent) _accountState->account()->e2e()->fetchFolderEncryptedStatus(); } - LsColJob *job = new LsColJob(_accountState->account(), path, this); + auto *job = new LsColJob(_accountState->account(), path, this); info->_fetchingJob = job; job->setProperties(QList() << "resourcetype" << "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 } - Folder *f = qobject_cast(sender()); + auto *f = qobject_cast(sender()); if (!f) { return; } diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp index fce3dcf7f..1f51a3020 100644 --- a/src/gui/folderwizard.cpp +++ b/src/gui/folderwizard.cpp @@ -178,7 +178,7 @@ void FolderWizardRemotePath::slotAddRemoteFolder() parent = current->data(0, Qt::UserRole).toString(); } - QInputDialog *dlg = new QInputDialog(this); + auto *dlg = new QInputDialog(this); dlg->setWindowTitle(tr("Create Remote Folder")); 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; - MkColJob *job = new MkColJob(_account, fullPath, this); + auto *job = new MkColJob(_account, fullPath, this); /* check the owncloud configuration file and query the ownCloud */ connect(job, static_cast(&MkColJob::finished), this, &FolderWizardRemotePath::slotCreateRemoteFolderFinished); @@ -405,7 +405,7 @@ void FolderWizardRemotePath::slotTypedPathError(QNetworkReply *reply) LsColJob *FolderWizardRemotePath::runLsColJob(const QString &path) { - LsColJob *job = new LsColJob(_account, path, this); + auto *job = new LsColJob(_account, path, this); job->setProperties(QList() << "resourcetype"); connect(job, &LsColJob::directoryListingSubfolders, this, &FolderWizardRemotePath::slotUpdateDirectories); @@ -435,7 +435,7 @@ bool FolderWizardRemotePath::isComplete() const Folder::Map map = FolderMan::instance()->map(); Folder::Map::const_iterator i = map.constBegin(); for (i = map.constBegin(); i != map.constEnd(); i++) { - Folder *f = static_cast(i.value()); + auto *f = static_cast(i.value()); if (f->accountState()->account() != _account) { continue; } @@ -480,7 +480,7 @@ void FolderWizardRemotePath::showWarn(const QString &msg) const FolderWizardSelectiveSync::FolderWizardSelectiveSync(const AccountPtr &account) { - QVBoxLayout *layout = new QVBoxLayout(this); + auto *layout = new QVBoxLayout(this); _selectiveSync = new SelectiveSyncWidget(account, this); layout->addWidget(_selectiveSync); } diff --git a/src/gui/ignorelisttablewidget.cpp b/src/gui/ignorelisttablewidget.cpp index 67c8ab4f2..7eaab4892 100644 --- a/src/gui/ignorelisttablewidget.cpp +++ b/src/gui/ignorelisttablewidget.cpp @@ -144,11 +144,11 @@ int IgnoreListTableWidget::addPattern(const QString &pattern, bool deletable, bo int newRow = ui->tableWidget->rowCount(); ui->tableWidget->setRowCount(newRow + 1); - QTableWidgetItem *patternItem = new QTableWidgetItem; + auto *patternItem = new QTableWidgetItem; patternItem->setText(pattern); ui->tableWidget->setItem(newRow, patternCol, patternItem); - QTableWidgetItem *deletableItem = new QTableWidgetItem; + auto *deletableItem = new QTableWidgetItem; deletableItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); deletableItem->setCheckState(deletable ? Qt::Checked : Qt::Unchecked); ui->tableWidget->setItem(newRow, deletableCol, deletableItem); diff --git a/src/gui/logbrowser.cpp b/src/gui/logbrowser.cpp index 7abfeb22d..691ed2373 100644 --- a/src/gui/logbrowser.cpp +++ b/src/gui/logbrowser.cpp @@ -58,23 +58,23 @@ LogBrowser::LogBrowser(QWidget *parent) setWindowTitle(tr("Log Output")); setMinimumWidth(600); - QVBoxLayout *mainLayout = new QVBoxLayout; + auto *mainLayout = new QVBoxLayout; // mainLayout->setMargin(0); mainLayout->addWidget(_logWidget); - QHBoxLayout *toolLayout = new QHBoxLayout; + auto *toolLayout = new QHBoxLayout; mainLayout->addLayout(toolLayout); // Search input field - QLabel *lab = new QLabel(tr("&Search:") + " "); + auto *lab = new QLabel(tr("&Search:") + " "); _findTermEdit = new QLineEdit; lab->setBuddy(_findTermEdit); toolLayout->addWidget(lab); toolLayout->addWidget(_findTermEdit); // find button - QPushButton *findBtn = new QPushButton; + auto *findBtn = new QPushButton; findBtn->setText(tr("&Find")); connect(findBtn, &QAbstractButton::clicked, this, &LogBrowser::slotFind); toolLayout->addWidget(findBtn); @@ -90,7 +90,7 @@ LogBrowser::LogBrowser(QWidget *parent) connect(_logDebugCheckBox, &QCheckBox::stateChanged, this, &LogBrowser::slotDebugCheckStateChanged); toolLayout->addWidget(_logDebugCheckBox); - QDialogButtonBox *btnbox = new QDialogButtonBox; + auto *btnbox = new QDialogButtonBox; QPushButton *closeBtn = btnbox->addButton(QDialogButtonBox::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 connect(Logger::instance(), &Logger::logWindowLog, this, &LogBrowser::slotNewLog, Qt::AutoConnection); - QAction *showLogWindow = new QAction(this); + auto *showLogWindow = new QAction(this); showLogWindow->setShortcut(QKeySequence("F12")); connect(showLogWindow, &QAction::triggered, this, &QWidget::close); addAction(showLogWindow); diff --git a/src/gui/ocsjob.cpp b/src/gui/ocsjob.cpp index 11e2deffe..ab4038c05 100644 --- a/src/gui/ocsjob.cpp +++ b/src/gui/ocsjob.cpp @@ -77,7 +77,7 @@ void OcsJob::start() addRawHeader("Ocs-APIREQUEST", "true"); addRawHeader("Content-Type", "application/x-www-form-urlencoded"); - QBuffer *buffer = new QBuffer; + auto *buffer = new QBuffer; QUrlQuery queryItems; if (_verb == "GET") { diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index d271059ab..5d6cb4160 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -443,7 +443,7 @@ void ownCloudGui::slotUpdateProgress(const QString &folder, const ProgressInfo & QString kindStr = Progress::asResultString(progress._lastCompletedItem); QString timeStr = QTime::currentTime().toString("hh:mm"); 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); if (f) { 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) { - QMessageBox *msgBox = new QMessageBox; + auto *msgBox = new QMessageBox; msgBox->setWindowFlags(msgBox->windowFlags() | Qt::WindowStaysOnTopHint); msgBox->setAttribute(Qt::WA_DeleteOnClose); msgBox->setText(message); diff --git a/src/gui/owncloudsetupwizard.cpp b/src/gui/owncloudsetupwizard.cpp index 000373781..38f0f1980 100644 --- a/src/gui/owncloudsetupwizard.cpp +++ b/src/gui/owncloudsetupwizard.cpp @@ -195,7 +195,7 @@ void OwncloudSetupWizard::slotFindServer() // 3. Check redirected-url/status.php with CheckServerJob // Step 1: Check url/status.php - CheckServerJob *job = new CheckServerJob(account, this); + auto *job = new CheckServerJob(account, this); job->setIgnoreCredentialFailure(true); connect(job, &CheckServerJob::instanceFound, this, &OwncloudSetupWizard::slotFoundServer); connect(job, &CheckServerJob::instanceNotFound, this, &OwncloudSetupWizard::slotFindServerBehindRedirect); @@ -233,7 +233,7 @@ void OwncloudSetupWizard::slotFindServerBehindRedirect() // Step 3: When done, start checking status.php. connect(redirectCheckJob, &SimpleNetworkJob::finishedSignal, this, [this, account]() { - CheckServerJob *job = new CheckServerJob(account, this); + auto *job = new CheckServerJob(account, this); job->setIgnoreCredentialFailure(true); connect(job, &CheckServerJob::instanceFound, this, &OwncloudSetupWizard::slotFoundServer); connect(job, &CheckServerJob::instanceNotFound, this, &OwncloudSetupWizard::slotNoServerFound); @@ -319,7 +319,7 @@ void OwncloudSetupWizard::slotNoServerFoundTimeout(const QUrl &url) void OwncloudSetupWizard::slotDetermineAuthType() { - DetermineAuthTypeJob *job = new DetermineAuthTypeJob(_ocWizard->account(), this); + auto *job = new DetermineAuthTypeJob(_ocWizard->account(), this); connect(job, &DetermineAuthTypeJob::authType, _ocWizard, &OwncloudWizard::setAuthType); job->start(); @@ -357,7 +357,7 @@ void OwncloudSetupWizard::slotAuthError() { QString errorMsg; - PropfindJob *job = qobject_cast(sender()); + auto *job = qobject_cast(sender()); if (!job) { qCWarning(lcWizard) << "Can't check for authed redirects. This slot should be invoked from PropfindJob!"; return; @@ -501,7 +501,7 @@ void OwncloudSetupWizard::slotCreateLocalAndRemoteFolders(const QString &localFo * 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); job->start(); } else { @@ -542,7 +542,7 @@ void OwncloudSetupWizard::createRemoteFolder() { _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))); job->start(); } diff --git a/src/gui/proxyauthhandler.cpp b/src/gui/proxyauthhandler.cpp index 8fae8ee34..a75412f13 100644 --- a/src/gui/proxyauthhandler.cpp +++ b/src/gui/proxyauthhandler.cpp @@ -85,7 +85,7 @@ void ProxyAuthHandler::handleProxyAuthenticationRequired( // Find the responsible QNAM if possible. QNetworkAccessManager *sending_qnam = nullptr; QWeakPointer qnam_alive; - if (Account *account = qobject_cast(sender())) { + if (auto *account = qobject_cast(sender())) { // 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 // liveness. @@ -236,7 +236,7 @@ void ProxyAuthHandler::storeCredsInKeychain() _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->setInsecureFallback(false); job->setKey(keychainPasswordKey()); diff --git a/src/gui/selectivesyncdialog.cpp b/src/gui/selectivesyncdialog.cpp index 485880db4..8ee353fbe 100644 --- a/src/gui/selectivesyncdialog.cpp +++ b/src/gui/selectivesyncdialog.cpp @@ -106,7 +106,7 @@ QSize SelectiveSyncWidget::sizeHint() const void SelectiveSyncWidget::refreshFolders() { - LsColJob *job = new LsColJob(_account, _folderPath, this); + auto *job = new LsColJob(_account, _folderPath, this); job->setProperties(QList() << "resourcetype" << "http://owncloud.org/ns:size"); connect(job, &LsColJob::directoryListingSubfolders, @@ -153,7 +153,7 @@ void SelectiveSyncWidget::recursiveInsert(QTreeWidgetItem *parent, QStringList p parent->setToolTip(0, path); parent->setData(0, Qt::UserRole, path); } else { - SelectiveSyncTreeViewItem *item = static_cast(findFirstChild(parent, pathTrail.first())); + auto *item = static_cast(findFirstChild(parent, pathTrail.first())); if (!item) { item = new SelectiveSyncTreeViewItem(parent); if (parent->checkState(0) == Qt::Checked @@ -191,7 +191,7 @@ void SelectiveSyncWidget::slotUpdateDirectories(QStringList list) QScopedValueRollback isInserting(_inserting); _inserting = true; - SelectiveSyncTreeViewItem *root = static_cast(_folderTree->topLevelItem(0)); + auto *root = static_cast(_folderTree->topLevelItem(0)); QUrl url = _account->davUrl(); QString pathToRemove = url.path(); @@ -290,7 +290,7 @@ void SelectiveSyncWidget::slotItemExpanded(QTreeWidgetItem *item) if (!_folderPath.isEmpty()) { prefix = _folderPath + QLatin1Char('/'); } - LsColJob *job = new LsColJob(_account, prefix + dir, this); + auto *job = new LsColJob(_account, prefix + dir, this); job->setProperties(QList() << "resourcetype" << "http://owncloud.org/ns:size"); connect(job, &LsColJob::directoryListingSubfolders, @@ -457,10 +457,10 @@ SelectiveSyncDialog::SelectiveSyncDialog(AccountPtr account, const QString &fold void SelectiveSyncDialog::init(const AccountPtr &account) { setWindowTitle(tr("Choose What to Sync")); - QVBoxLayout *layout = new QVBoxLayout(this); + auto *layout = new QVBoxLayout(this); _selectiveSync = new SelectiveSyncWidget(account, this); layout->addWidget(_selectiveSync); - QDialogButtonBox *buttonBox = new QDialogButtonBox(Qt::Horizontal); + auto *buttonBox = new QDialogButtonBox(Qt::Horizontal); _okButton = buttonBox->addButton(QDialogButtonBox::Ok); connect(_okButton, &QPushButton::clicked, this, &SelectiveSyncDialog::accept); QPushButton *button; diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp index 206e4d444..1815b72cb 100644 --- a/src/gui/settingsdialog.cpp +++ b/src/gui/settingsdialog.cpp @@ -70,7 +70,7 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) layout()->setMenuBar(_toolBar); // 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")); connect(closeWindowAction, &QAction::triggered, this, &SettingsDialog::accept); addAction(closeWindowAction); @@ -92,7 +92,7 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) _toolBar->addAction(_actionBefore); // Adds space between users + activities and general + network actions - QWidget* spacer = new QWidget(); + auto* spacer = new QWidget(); spacer->setMinimumWidth(10); spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); _toolBar->addWidget(spacer); @@ -100,7 +100,7 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) QAction *generalAction = createColorAwareAction(QLatin1String(":/client/theme/settings.svg"), tr("General")); _actionGroup->addAction(generalAction); _toolBar->addAction(generalAction); - GeneralSettings *generalSettings = new GeneralSettings; + auto *generalSettings = new GeneralSettings; _ui->stack->addWidget(generalSettings); // 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")); _actionGroup->addAction(networkAction); _toolBar->addAction(networkAction); - NetworkSettings *networkSettings = new NetworkSettings; + auto *networkSettings = new NetworkSettings; _ui->stack->addWidget(networkSettings); _actionGroupWidgets.insert(generalAction, generalSettings); @@ -121,7 +121,7 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) QTimer::singleShot(1, this, &SettingsDialog::showFirstPage); - QAction *showLogWindow = new QAction(this); + auto *showLogWindow = new QAction(this); showLogWindow->setShortcut(QKeySequence("F12")); connect(showLogWindow, &QAction::triggered, gui, &ownCloudGui::slotToggleLogBrowser); addAction(showLogWindow); @@ -238,7 +238,7 @@ void SettingsDialog::accountAdded(AccountState *s) void SettingsDialog::slotAccountAvatarChanged() { - Account *account = static_cast(sender()); + auto *account = static_cast(sender()); if (account && _actionForAccount.contains(account)) { QAction *action = _actionForAccount[account]; if (action) { @@ -252,7 +252,7 @@ void SettingsDialog::slotAccountAvatarChanged() void SettingsDialog::slotAccountDisplayNameChanged() { - Account *account = static_cast(sender()); + auto *account = static_cast(sender()); if (account && _actionForAccount.contains(account)) { QAction *action = _actionForAccount[account]; if (action) { @@ -308,7 +308,7 @@ void SettingsDialog::customizeStyle() Q_FOREACH (QAction *a, _actionGroup->actions()) { QIcon icon = Theme::createColorAwareIcon(a->property("iconPath").toString(), palette()); a->setIcon(icon); - QToolButton *btn = qobject_cast(_toolBar->widgetForAction(a)); + auto *btn = qobject_cast(_toolBar->widgetForAction(a)); if (btn) btn->setIcon(icon); } @@ -333,7 +333,7 @@ public: return nullptr; } - QToolButton *btn = new QToolButton(parent); + auto *btn = new QToolButton(parent); btn->setDefaultAction(this); btn->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp index 9609a270c..91081e057 100644 --- a/src/gui/sharedialog.cpp +++ b/src/gui/sharedialog.cpp @@ -109,7 +109,7 @@ ShareDialog::ShareDialog(QPointer accountState, } 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); job->start(); } diff --git a/src/gui/sharee.cpp b/src/gui/sharee.cpp index 035a51411..aab3d00bf 100644 --- a/src/gui/sharee.cpp +++ b/src/gui/sharee.cpp @@ -73,7 +73,7 @@ void ShareeModel::fetch(const QString &search, const ShareeSet &blacklist) { _search = search; _shareeBlacklist = blacklist; - OcsShareeJob *job = new OcsShareeJob(_account); + auto *job = new OcsShareeJob(_account); connect(job, &OcsShareeJob::shareeJobFinished, this, &ShareeModel::shareesFetched); connect(job, &OcsJob::ocsError, this, &ShareeModel::displayErrorMessage); job->getSharees(_search, _type, 1, 50); diff --git a/src/gui/sharelinkwidget.cpp b/src/gui/sharelinkwidget.cpp index fb557ba41..12f2e7027 100644 --- a/src/gui/sharelinkwidget.cpp +++ b/src/gui/sharelinkwidget.cpp @@ -145,7 +145,7 @@ void ShareLinkWidget::setupUiOptions() const QDate expireDate = _linkShare.data()->getExpireDate().isValid() ? _linkShare.data()->getExpireDate() : QDate(); const SharePermissions perm = _linkShare.data()->getPermissions(); bool checked = false; - QActionGroup *permissionsGroup = new QActionGroup(this); + auto *permissionsGroup = new QActionGroup(this); // Prepare sharing menu _linkContextMenu = new QMenu(this); @@ -335,7 +335,7 @@ void ShareLinkWidget::slotPasswordSet() 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->setStartValue(start); diff --git a/src/gui/sharemanager.cpp b/src/gui/sharemanager.cpp index ca14c9b42..2b8fbd4a9 100644 --- a/src/gui/sharemanager.cpp +++ b/src/gui/sharemanager.cpp @@ -106,7 +106,7 @@ QSharedPointer Share::getShareWith() const void Share::setPermissions(Permissions permissions) { - OcsShareJob *job = new OcsShareJob(_account); + auto *job = new OcsShareJob(_account); connect(job, &OcsShareJob::shareJobFinished, this, &Share::slotPermissionsSet); connect(job, &OcsJob::ocsError, this, &Share::slotOcsError); job->setPermissions(getId(), permissions); @@ -125,7 +125,7 @@ Share::Permissions Share::getPermissions() const void Share::deleteShare() { - OcsShareJob *job = new OcsShareJob(_account); + auto *job = new OcsShareJob(_account); connect(job, &OcsShareJob::shareJobFinished, this, &Share::slotDeleted); connect(job, &OcsJob::ocsError, this, &Share::slotOcsError); job->deleteShare(getId()); @@ -207,7 +207,7 @@ QString LinkShare::getNote() const 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, &OcsJob::ocsError, this, &LinkShare::slotOcsError); job->setName(getId(), name); @@ -215,7 +215,7 @@ void LinkShare::setName(const QString &name) void LinkShare::setNote(const QString ¬e) { - OcsShareJob *job = new OcsShareJob(_account); + auto *job = new OcsShareJob(_account); connect(job, &OcsShareJob::shareJobFinished, this, &LinkShare::slotNoteSet); connect(job, &OcsJob::ocsError, this, &LinkShare::slotOcsError); job->setNote(getId(), note); @@ -234,7 +234,7 @@ QString LinkShare::getToken() const 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, &OcsJob::ocsError, this, &LinkShare::slotSetPasswordError); job->setPassword(getId(), password); @@ -248,7 +248,7 @@ void LinkShare::slotPasswordSet(const QJsonDocument &, const QVariant &value) 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, &OcsJob::ocsError, this, &LinkShare::slotOcsError); job->setExpireDate(getId(), date); @@ -291,7 +291,7 @@ void ShareManager::createLinkShare(const QString &path, const QString &name, const QString &password) { - OcsShareJob *job = new OcsShareJob(_account); + auto *job = new OcsShareJob(_account); connect(job, &OcsShareJob::shareJobFinished, this, &ShareManager::slotLinkShareCreated); connect(job, &OcsJob::ocsError, this, &ShareManager::slotOcsError); job->createLinkShare(path, name, password); @@ -348,7 +348,7 @@ void ShareManager::createShare(const QString &path, validPermissions &= existingPermissions; } - OcsShareJob *job = new OcsShareJob(_account); + auto *job = new OcsShareJob(_account); connect(job, &OcsShareJob::shareJobFinished, this, &ShareManager::slotShareCreated); connect(job, &OcsJob::ocsError, this, &ShareManager::slotOcsError); job->createShare(path, shareType, shareWith, validPermissions); @@ -370,7 +370,7 @@ void ShareManager::slotShareCreated(const QJsonDocument &reply) 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, &OcsJob::ocsError, this, &ShareManager::slotOcsError); job->getShares(path); diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp index 0a2bea6ab..41dc21808 100644 --- a/src/gui/shareusergroupwidget.cpp +++ b/src/gui/shareusergroupwidget.cpp @@ -213,7 +213,7 @@ void ShareUserGroupWidget::slotSharesFetched(const QList> _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::visualDeletionDone, this, &ShareUserGroupWidget::getShares); s->setBackgroundRole(layout->count() % 2 == 0 ? QPalette::Base : QPalette::AlternateBase); @@ -411,7 +411,7 @@ ShareUserLine::ShareUserLine(QSharedPointer share, connect(_ui->permissionsEdit, &QAbstractButton::clicked, this, &ShareUserLine::slotEditPermissionsChanged); // create menu with checkable permissions - QMenu *menu = new QMenu(this); + auto *menu = new QMenu(this); _permissionReshare= new QAction(tr("Can reshare"), this); _permissionReshare->setCheckable(true); _permissionReshare->setEnabled(maxSharingPermissions & SharePermissionShare); @@ -518,7 +518,7 @@ void ShareUserLine::loadAvatar() * Currently only regular users can have avatars. */ 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); job->start(); } @@ -623,7 +623,7 @@ void ShareUserLine::slotDeleteAnimationFinished() void ShareUserLine::slotShareDeleted() { - QPropertyAnimation *animation = new QPropertyAnimation(this, "maximumHeight", this); + auto *animation = new QPropertyAnimation(this, "maximumHeight", this); animation->setDuration(500); animation->setStartValue(height()); diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index 43bd63363..a3474c783 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -271,13 +271,13 @@ void SocketApi::onLostConnection() void SocketApi::slotSocketDestroyed(QObject *obj) { - QIODevice *socket = static_cast(obj); + auto *socket = static_cast(obj); _listeners.erase(std::remove_if(_listeners.begin(), _listeners.end(), ListenerHasSocketPred(socket)), _listeners.end()); } void SocketApi::slotReadSocket() { - QIODevice *socket = qobject_cast(sender()); + auto *socket = qobject_cast(sender()); ASSERT(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) 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; params.addQueryItem("path", fileData.accountRelativePath); diff --git a/src/gui/sslbutton.cpp b/src/gui/sslbutton.cpp index 8b4bd6e40..a2c56e5ef 100644 --- a/src/gui/sslbutton.cpp +++ b/src/gui/sslbutton.cpp @@ -141,16 +141,16 @@ QMenu *SslButton::buildCertMenu(QMenu *parent, const QSslCertificate &cert, } // create label first - QLabel *label = new QLabel(parent); + auto *label = new QLabel(parent); label->setStyleSheet(QLatin1String("QLabel { padding: 8px; }")); label->setTextFormat(Qt::RichText); label->setText(details); // plug label into widget action - QWidgetAction *action = new QWidgetAction(parent); + auto *action = new QWidgetAction(parent); action->setDefaultWidget(label); // plug action into menu - QMenu *menu = new QMenu(parent); + auto *menu = new QMenu(parent); menu->menuAction()->setText(txt); menu->addAction(action); diff --git a/src/gui/sslerrordialog.cpp b/src/gui/sslerrordialog.cpp index 814a7b0af..5c148dc85 100644 --- a/src/gui/sslerrordialog.cpp +++ b/src/gui/sslerrordialog.cpp @@ -148,7 +148,7 @@ bool SslErrorDialog::checkFailingCertsKnown(const QList &errors) } msg += QL(""); - QTextDocument *doc = new QTextDocument(nullptr); + auto *doc = new QTextDocument(nullptr); QString style = styleSheet(); doc->addResource(QTextDocument::StyleSheetResource, QUrl(QL("format.css")), style); doc->setHtml(msg); diff --git a/src/gui/tooltipupdater.cpp b/src/gui/tooltipupdater.cpp index 205dfc64f..5b4233a01 100644 --- a/src/gui/tooltipupdater.cpp +++ b/src/gui/tooltipupdater.cpp @@ -32,7 +32,7 @@ ToolTipUpdater::ToolTipUpdater(QTreeView *treeView) bool ToolTipUpdater::eventFilter(QObject * /*obj*/, QEvent *ev) { if (ev->type() == QEvent::ToolTip) { - QHelpEvent *helpEvent = static_cast(ev); + auto *helpEvent = static_cast(ev); _toolTipPos = helpEvent->globalPos(); } return false; diff --git a/src/gui/tray/ActivityListModel.cpp b/src/gui/tray/ActivityListModel.cpp index 1562b77a6..a5ec6f034 100644 --- a/src/gui/tray/ActivityListModel.cpp +++ b/src/gui/tray/ActivityListModel.cpp @@ -221,7 +221,7 @@ void ActivityListModel::startFetchJob() if (!_accountState->isConnected()) { 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, this, &ActivityListModel::slotActivitiesReceived); @@ -271,7 +271,7 @@ void ActivityListModel::slotActivitiesReceived(const QJsonDocument &json, int st a._icon = json.value("icon").toString(); if (!a._icon.isEmpty()) { - IconJob *iconJob = new IconJob(QUrl(a._icon)); + auto *iconJob = new IconJob(QUrl(a._icon)); iconJob->setProperty("activityId", a._id); connect(iconJob, &IconJob::jobFinished, this, &ActivityListModel::slotIconDownloaded); } diff --git a/src/gui/tray/NotificationHandler.cpp b/src/gui/tray/NotificationHandler.cpp index 4571f9a9d..70401b21f 100644 --- a/src/gui/tray/NotificationHandler.cpp +++ b/src/gui/tray/NotificationHandler.cpp @@ -57,7 +57,7 @@ void ServerNotificationHandler::slotEtagResponseHeaderReceived(const QByteArray { if (statusCode == successStatusCode) { qCWarning(lcServerNotification) << "New Notification ETag Response Header received " << value; - AccountState *account = qvariant_cast(sender()->property(propertyAccountStateC)); + auto *account = qvariant_cast(sender()->property(propertyAccountStateC)); account->setNotificationsEtagResponseHeader(value); } } @@ -83,7 +83,7 @@ void ServerNotificationHandler::slotNotificationsReceived(const QJsonDocument &j auto notifies = json.object().value("ocs").toObject().value("data").toArray(); - AccountState *ai = qvariant_cast(sender()->property(propertyAccountStateC)); + auto *ai = qvariant_cast(sender()->property(propertyAccountStateC)); ActivityList list; @@ -103,7 +103,7 @@ void ServerNotificationHandler::slotNotificationsReceived(const QJsonDocument &j a._icon = json.value("icon").toString(); if (!a._icon.isEmpty()) { - IconJob *iconJob = new IconJob(QUrl(a._icon)); + auto *iconJob = new IconJob(QUrl(a._icon)); iconJob->setProperty("activityId", a._id); connect(iconJob, &IconJob::jobFinished, this, &ServerNotificationHandler::slotIconDownloaded); } diff --git a/src/gui/tray/UserModel.cpp b/src/gui/tray/UserModel.cpp index be6b51dbf..6938e4c5b 100644 --- a/src/gui/tray/UserModel.cpp +++ b/src/gui/tray/UserModel.cpp @@ -137,7 +137,7 @@ void User::slotRefreshNotifications() // start a server notification handler if no notification requests // are running if (_notificationRequestsRunning == 0) { - ServerNotificationHandler *snh = new ServerNotificationHandler(_account.data()); + auto *snh = new ServerNotificationHandler(_account.data()); connect(snh, &ServerNotificationHandler::newNotificationList, this, &User::slotBuildNotificationDisplay); @@ -185,7 +185,7 @@ void User::slotSendNotificationRequest(const QString &accountName, const QString if (validVerbs.contains(verb)) { AccountStatePtr acc = AccountManager::instance()->account(accountName); if (acc) { - NotificationConfirmJob *job = new NotificationConfirmJob(acc->account()); + auto *job = new NotificationConfirmJob(acc->account()); QUrl l(link); job->setLinkAndVerb(l, verb); job->setProperty("activityRow", QVariant::fromValue(row)); @@ -206,7 +206,7 @@ void User::slotSendNotificationRequest(const QString &accountName, const QString void User::slotNotifyNetworkError(QNetworkReply *reply) { - NotificationConfirmJob *job = qobject_cast(sender()); + auto *job = qobject_cast(sender()); if (!job) { return; } @@ -219,7 +219,7 @@ void User::slotNotifyNetworkError(QNetworkReply *reply) void User::slotNotifyServerFinished(const QString &reply, int replyCode) { - NotificationConfirmJob *job = qobject_cast(sender()); + auto *job = qobject_cast(sender()); if (!job) { return; } diff --git a/src/gui/userinfo.cpp b/src/gui/userinfo.cpp index 4f1446edf..c7916c516 100644 --- a/src/gui/userinfo.cpp +++ b/src/gui/userinfo.cpp @@ -137,7 +137,7 @@ void UserInfo::slotUpdateLastInfo(const QJsonDocument &json) // Avatar Image if(_fetchAvatarImage) { - AvatarJob *job = new AvatarJob(account, account->davUser(), 128, this); + auto *job = new AvatarJob(account, account->davUser(), 128, this); job->setTimeout(20 * 1000); QObject::connect(job, &AvatarJob::avatarPixmap, this, &UserInfo::slotAvatarImage); job->start(); diff --git a/src/gui/wizard/flow2authcredspage.cpp b/src/gui/wizard/flow2authcredspage.cpp index d04d9741e..f0c63f6c8 100644 --- a/src/gui/wizard/flow2authcredspage.cpp +++ b/src/gui/wizard/flow2authcredspage.cpp @@ -51,7 +51,7 @@ Flow2AuthCredsPage::Flow2AuthCredsPage() void Flow2AuthCredsPage::initializePage() { - OwncloudWizard *ocWizard = qobject_cast(wizard()); + auto *ocWizard = qobject_cast(wizard()); Q_ASSERT(ocWizard); ocWizard->account()->setCredentials(CredentialsFactory::create("http")); @@ -94,7 +94,7 @@ void Flow2AuthCredsPage::slotFlow2AuthResult(Flow2Auth::Result r, const QString case Flow2Auth::LoggedIn: { _user = user; _appPassword = appPassword; - OwncloudWizard *ocWizard = qobject_cast(wizard()); + auto *ocWizard = qobject_cast(wizard()); Q_ASSERT(ocWizard); emit connectToOCUrl(ocWizard->account()->url().toString()); @@ -110,7 +110,7 @@ int Flow2AuthCredsPage::nextId() const void Flow2AuthCredsPage::setConnected() { - OwncloudWizard *ocWizard = qobject_cast(wizard()); + auto *ocWizard = qobject_cast(wizard()); Q_ASSERT(ocWizard); // bring wizard to top @@ -119,7 +119,7 @@ void Flow2AuthCredsPage::setConnected() AbstractCredentials *Flow2AuthCredsPage::getCredentials() const { - OwncloudWizard *ocWizard = qobject_cast(wizard()); + auto *ocWizard = qobject_cast(wizard()); Q_ASSERT(ocWizard); return new WebFlowCredentials( _user, diff --git a/src/gui/wizard/owncloudadvancedsetuppage.cpp b/src/gui/wizard/owncloudadvancedsetuppage.cpp index f83e1f43f..ce15dc105 100644 --- a/src/gui/wizard/owncloudadvancedsetuppage.cpp +++ b/src/gui/wizard/owncloudadvancedsetuppage.cpp @@ -316,7 +316,7 @@ void OwncloudAdvancedSetupPage::slotSelectiveSyncClicked() _ui.rSyncEverything->setChecked(_selectiveSyncBlacklist.isEmpty()); AccountPtr acc = static_cast(wizard())->account(); - SelectiveSyncDialog *dlg = new SelectiveSyncDialog(acc, _remoteFolder, _selectiveSyncBlacklist, this); + auto *dlg = new SelectiveSyncDialog(acc, _remoteFolder, _selectiveSyncBlacklist, this); const int result = dlg->exec(); bool updateBlacklist = false; diff --git a/src/gui/wizard/owncloudhttpcredspage.cpp b/src/gui/wizard/owncloudhttpcredspage.cpp index 092bf789d..02a82c459 100644 --- a/src/gui/wizard/owncloudhttpcredspage.cpp +++ b/src/gui/wizard/owncloudhttpcredspage.cpp @@ -84,9 +84,9 @@ void OwncloudHttpCredsPage::initializePage() { WizardCommon::initErrorLabel(_ui.errorLabel); - OwncloudWizard *ocWizard = qobject_cast(wizard()); + auto *ocWizard = qobject_cast(wizard()); AbstractCredentials *cred = ocWizard->account()->credentials(); - HttpCredentials *httpCreds = qobject_cast(cred); + auto *httpCreds = qobject_cast(cred); if (httpCreds) { const QString user = httpCreds->fetchUser(); if (!user.isEmpty()) { @@ -134,7 +134,7 @@ bool OwncloudHttpCredsPage::validatePage() startSpinner(); // Reset cookies to ensure the username / password is actually used - OwncloudWizard *ocWizard = qobject_cast(wizard()); + auto *ocWizard = qobject_cast(wizard()); ocWizard->account()->clearCookieJar(); emit completeChanged(); diff --git a/src/gui/wizard/owncloudoauthcredspage.cpp b/src/gui/wizard/owncloudoauthcredspage.cpp index 0d4c40ea7..9ed5da0d3 100644 --- a/src/gui/wizard/owncloudoauthcredspage.cpp +++ b/src/gui/wizard/owncloudoauthcredspage.cpp @@ -51,7 +51,7 @@ OwncloudOAuthCredsPage::OwncloudOAuthCredsPage() void OwncloudOAuthCredsPage::initializePage() { - OwncloudWizard *ocWizard = qobject_cast(wizard()); + auto *ocWizard = qobject_cast(wizard()); Q_ASSERT(ocWizard); ocWizard->account()->setCredentials(CredentialsFactory::create("http")); _asyncAuth.reset(new OAuth(ocWizard->account().data(), this)); @@ -75,7 +75,7 @@ void OwncloudOAuthCredsPage::asyncAuthResult(OAuth::Result r, const QString &use switch (r) { case OAuth::NotSupported: { /* OAuth not supported (can't open browser), fallback to HTTP credentials */ - OwncloudWizard *ocWizard = qobject_cast(wizard()); + auto *ocWizard = qobject_cast(wizard()); ocWizard->back(); ocWizard->setAuthType(DetermineAuthTypeJob::Basic); break; @@ -89,7 +89,7 @@ void OwncloudOAuthCredsPage::asyncAuthResult(OAuth::Result r, const QString &use _token = token; _user = user; _refreshToken = refreshToken; - OwncloudWizard *ocWizard = qobject_cast(wizard()); + auto *ocWizard = qobject_cast(wizard()); Q_ASSERT(ocWizard); emit connectToOCUrl(ocWizard->account()->url().toString()); break; @@ -109,7 +109,7 @@ void OwncloudOAuthCredsPage::setConnected() AbstractCredentials *OwncloudOAuthCredsPage::getCredentials() const { - OwncloudWizard *ocWizard = qobject_cast(wizard()); + auto *ocWizard = qobject_cast(wizard()); Q_ASSERT(ocWizard); return new HttpCredentialsGui(_user, _token, _refreshToken, ocWizard->_clientSslCertificate, ocWizard->_clientSslKey); diff --git a/src/gui/wizard/owncloudsetuppage.cpp b/src/gui/wizard/owncloudsetuppage.cpp index ac93245c6..954e3f47b 100644 --- a/src/gui/wizard/owncloudsetuppage.cpp +++ b/src/gui/wizard/owncloudsetuppage.cpp @@ -133,7 +133,7 @@ void OwncloudSetupPage::slotLogin() { _ocWizard->setRegistration(false); _ui.login->setMaximumHeight(0); - QPropertyAnimation *animation = new QPropertyAnimation(_ui.login, "maximumHeight"); + auto *animation = new QPropertyAnimation(_ui.login, "maximumHeight"); animation->setDuration(0); animation->setStartValue(500); animation->setEndValue(500); @@ -210,7 +210,7 @@ void OwncloudSetupPage::initializePage() _checking = false; QAbstractButton *nextButton = wizard()->button(QWizard::NextButton); - QPushButton *pushButton = qobject_cast(nextButton); + auto *pushButton = qobject_cast(nextButton); if (pushButton) pushButton->setDefault(true); diff --git a/src/gui/wizard/owncloudshibbolethcredspage.cpp b/src/gui/wizard/owncloudshibbolethcredspage.cpp index 4e598d2c7..3469b42dc 100644 --- a/src/gui/wizard/owncloudshibbolethcredspage.cpp +++ b/src/gui/wizard/owncloudshibbolethcredspage.cpp @@ -37,13 +37,13 @@ void OwncloudShibbolethCredsPage::setupBrowser() if (!_browser.isNull()) { return; } - OwncloudWizard *ocWizard = qobject_cast(wizard()); + auto *ocWizard = qobject_cast(wizard()); AccountPtr account = ocWizard->account(); // we need to reset the cookie jar to drop temporary cookies (like the shib cookie) // i.e. if someone presses "back" QNetworkAccessManager *qnam = account->networkAccessManager(); - CookieJar *jar = new CookieJar; + auto *jar = new CookieJar; jar->restore(account->cookieJarPath()); // Implicitly deletes the old cookie jar, and reparents the jar qnam->setCookieJar(jar); diff --git a/src/gui/wizard/webview.cpp b/src/gui/wizard/webview.cpp index a901be103..86f3df736 100644 --- a/src/gui/wizard/webview.cpp +++ b/src/gui/wizard/webview.cpp @@ -184,7 +184,7 @@ WebEnginePage::WebEnginePage(QWebEngineProfile *profile, QObject* parent) : QWeb QWebEnginePage * WebEnginePage::createWindow(QWebEnginePage::WebWindowType type) { Q_UNUSED(type); - ExternalWebEnginePage *view = new ExternalWebEnginePage(this->profile()); + auto *view = new ExternalWebEnginePage(this->profile()); return view; } diff --git a/src/gui/wizard/webviewpage.cpp b/src/gui/wizard/webviewpage.cpp index 8daa0f684..f9c5a269e 100644 --- a/src/gui/wizard/webviewpage.cpp +++ b/src/gui/wizard/webviewpage.cpp @@ -23,7 +23,7 @@ WebViewPage::WebViewPage(QWidget *parent) qCInfo(lcWizardWebiewPage()) << "Time for a webview!"; _webView = new WebView(this); - QVBoxLayout *layout = new QVBoxLayout(this); + auto *layout = new QVBoxLayout(this); layout->addWidget(_webView); setLayout(layout); diff --git a/src/libsync/account.cpp b/src/libsync/account.cpp index 97ae971a4..6908cd3b0 100644 --- a/src/libsync/account.cpp +++ b/src/libsync/account.cpp @@ -534,12 +534,12 @@ void Account::writeAppPasswordOnce(QString appPassword){ id() ); - WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); + auto *job = new WritePasswordJob(Theme::instance()->appName()); job->setInsecureFallback(false); job->setKey(kck); job->setBinaryData(appPassword.toLatin1()); connect(job, &WritePasswordJob::finished, [this](Job *incoming) { - WritePasswordJob *writeJob = static_cast(incoming); + auto *writeJob = static_cast(incoming); if (writeJob->error() == NoError) qCInfo(lcAccount) << "appPassword stored in keychain"; else @@ -558,11 +558,11 @@ void Account::retrieveAppPassword(){ id() ); - ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); + auto *job = new ReadPasswordJob(Theme::instance()->appName()); job->setInsecureFallback(false); job->setKey(kck); connect(job, &ReadPasswordJob::finished, [this](Job *incoming) { - ReadPasswordJob *readJob = static_cast(incoming); + auto *readJob = static_cast(incoming); QString pwd(""); // Error or no valid public key error out if (readJob->error() == NoError && @@ -587,11 +587,11 @@ void Account::deleteAppPassword(){ return; } - DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName()); + auto *job = new DeletePasswordJob(Theme::instance()->appName()); job->setInsecureFallback(false); job->setKey(kck); connect(job, &DeletePasswordJob::finished, [this](Job *incoming) { - DeletePasswordJob *deleteJob = static_cast(incoming); + auto *deleteJob = static_cast(incoming); if (deleteJob->error() == NoError) qCInfo(lcAccount) << "appPassword deleted from keychain"; else @@ -612,7 +612,7 @@ void Account::fetchDirectEditors(const QUrl &directEditingURL, const QString &di if (!directEditingURL.isEmpty() && (directEditingETag.isEmpty() || directEditingETag != _lastDirectEditingETag)) { // 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); job->start(); } @@ -633,7 +633,7 @@ void Account::slotDirectEditingRecieved(const QJsonDocument &json) auto mimeTypes = editor.value("mimetypes").toArray(); auto optionalMimeTypes = editor.value("optionalMimetypes").toArray(); - DirectEditor *directEditor = new DirectEditor(id, name); + auto *directEditor = new DirectEditor(id, name); foreach(auto mimeType, mimeTypes) { directEditor->addMimetype(mimeType.toString().toLatin1()); diff --git a/src/libsync/bandwidthmanager.cpp b/src/libsync/bandwidthmanager.cpp index c7191105c..95564bb7b 100644 --- a/src/libsync/bandwidthmanager.cpp +++ b/src/libsync/bandwidthmanager.cpp @@ -139,7 +139,7 @@ void BandwidthManager::registerDownloadJob(GETFileJob *j) void BandwidthManager::unregisterDownloadJob(QObject *o) { - GETFileJob *j = reinterpret_cast(o); // note, we might already be in the ~QObject + auto *j = reinterpret_cast(o); // note, we might already be in the ~QObject _downloadJobList.removeAll(j); if (_relativeLimitCurrentMeasuredJob == j) { _relativeLimitCurrentMeasuredJob = nullptr; diff --git a/src/libsync/clientsideencryption.cpp b/src/libsync/clientsideencryption.cpp index be2de5c2c..151ebcabd 100644 --- a/src/libsync/clientsideencryption.cpp +++ b/src/libsync/clientsideencryption.cpp @@ -91,7 +91,7 @@ QByteArray generateRandomFilename() 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); if (ret != 1) { @@ -175,7 +175,7 @@ QByteArray encryptPrivateKey( QByteArray privateKeyB64 = privateKey.toBase64(); // 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 int len = 0; @@ -196,7 +196,7 @@ QByteArray encryptPrivateKey( clen += len; /* 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)) { qCInfo(lcCse()) << "Error getting the tag"; handleErrors(); @@ -263,7 +263,7 @@ QByteArray decryptPrivateKey(const QByteArray& key, const QByteArray& data) { 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; /* 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(); } - 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; /* 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(); // 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 int len = 0; @@ -470,7 +470,7 @@ QByteArray encryptStringSymmetric(const QByteArray& key, const QByteArray& data) clen += len; /* 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)) { qCInfo(lcCse()) << "Error getting the tag"; handleErrors(); @@ -534,7 +534,7 @@ QByteArray decryptStringAsymmetric(EVP_PKEY *privateKey, const QByteArray& data) 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) { qCInfo(lcCseDecryption()) << "Could not alloc space for the decrypted metadata"; handleErrors(); @@ -592,7 +592,7 @@ QByteArray encryptStringAsymmetric(EVP_PKEY *publicKey, const QByteArray& data) qCInfo(lcCse()) << "Encryption Length:" << outLen; } - unsigned char *out = (uchar*) OPENSSL_malloc(outLen); + auto *out = (uchar*) OPENSSL_malloc(outLen); if (!out) { qCInfo(lcCse()) << "Error requesting memory for the encrypted contents"; exit(1); @@ -638,7 +638,7 @@ void ClientSideEncryption::fetchFromKeyChain() { _account->id() ); - ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); + auto *job = new ReadPasswordJob(Theme::instance()->appName()); job->setInsecureFallback(false); job->setKey(kck); connect(job, &ReadPasswordJob::finished, this, &ClientSideEncryption::publicKeyFetched); @@ -646,7 +646,7 @@ void ClientSideEncryption::fetchFromKeyChain() { } void ClientSideEncryption::publicKeyFetched(Job *incoming) { - ReadPasswordJob *readJob = static_cast(incoming); + auto *readJob = static_cast(incoming); // Error or no valid public key error out if (readJob->error() != NoError || readJob->binaryData().length() == 0) { @@ -671,7 +671,7 @@ void ClientSideEncryption::publicKeyFetched(Job *incoming) { _account->id() ); - ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); + auto *job = new ReadPasswordJob(Theme::instance()->appName()); job->setInsecureFallback(false); job->setKey(kck); connect(job, &ReadPasswordJob::finished, this, &ClientSideEncryption::privateKeyFetched); @@ -685,7 +685,7 @@ void ClientSideEncryption::setFolderEncryptedStatus(const QString& folder, bool } void ClientSideEncryption::privateKeyFetched(Job *incoming) { - ReadPasswordJob *readJob = static_cast(incoming); + auto *readJob = static_cast(incoming); // Error or no valid public key error out if (readJob->error() != NoError || readJob->binaryData().length() == 0) { @@ -711,7 +711,7 @@ void ClientSideEncryption::privateKeyFetched(Job *incoming) { _account->id() ); - ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); + auto *job = new ReadPasswordJob(Theme::instance()->appName()); job->setInsecureFallback(false); job->setKey(kck); connect(job, &ReadPasswordJob::finished, this, &ClientSideEncryption::mnemonicKeyFetched); @@ -719,7 +719,7 @@ void ClientSideEncryption::privateKeyFetched(Job *incoming) { } void ClientSideEncryption::mnemonicKeyFetched(QKeychain::Job *incoming) { - ReadPasswordJob *readJob = static_cast(incoming); + auto *readJob = static_cast(incoming); // Error or no valid public key error out if (readJob->error() != NoError || readJob->textData().length() == 0) { @@ -744,7 +744,7 @@ void ClientSideEncryption::writePrivateKey() { _account->id() ); - WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); + auto *job = new WritePasswordJob(Theme::instance()->appName()); job->setInsecureFallback(false); job->setKey(kck); job->setBinaryData(_privateKey); @@ -762,7 +762,7 @@ void ClientSideEncryption::writeCertificate() { _account->id() ); - WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); + auto *job = new WritePasswordJob(Theme::instance()->appName()); job->setInsecureFallback(false); job->setKey(kck); job->setBinaryData(_certificate.toPem()); @@ -780,7 +780,7 @@ void ClientSideEncryption::writeMnemonic() { _account->id() ); - WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); + auto *job = new WritePasswordJob(Theme::instance()->appName()); job->setInsecureFallback(false); job->setKey(kck); job->setTextData(_mnemonic); @@ -799,7 +799,7 @@ void ClientSideEncryption::forgetSensitiveData() _mnemonic = QString(); auto startDeleteJob = [this](QString user) { - DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName()); + auto *job = new DeletePasswordJob(Theme::instance()->appName()); job->setInsecureFallback(false); job->setKey(AbstractCredentials::keychainKey(_account->url().toString(), user, _account->id())); job->start(); @@ -1408,7 +1408,7 @@ bool EncryptionHelper::fileEncryption(const QByteArray &key, const QByteArray &i 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 total_len = 0; @@ -1439,7 +1439,7 @@ bool EncryptionHelper::fileEncryption(const QByteArray &key, const QByteArray &i total_len += len; /* 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)) { qCInfo(lcCse()) << "Could not get tag"; return false; @@ -1495,7 +1495,7 @@ bool EncryptionHelper::fileDecryption(const QByteArray &key, const QByteArray& i 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; while(input->pos() < size) { diff --git a/src/libsync/clientsideencryptionjobs.cpp b/src/libsync/clientsideencryptionjobs.cpp index 5321f938a..7608ee956 100644 --- a/src/libsync/clientsideencryptionjobs.cpp +++ b/src/libsync/clientsideencryptionjobs.cpp @@ -37,7 +37,7 @@ void GetFolderEncryptStatusJob::start() req.setHeader(QNetworkRequest::ContentTypeHeader, QByteArrayLiteral("application/xml")); QByteArray xml = " "; - QBuffer *buf = new QBuffer(this); + auto *buf = new QBuffer(this); buf->setData(xml); buf->open(QIODevice::ReadOnly); QString tmpPath = path() + (!_folder.isEmpty() ? "/" + _folder : QString()); diff --git a/src/libsync/creds/httpcredentials.cpp b/src/libsync/creds/httpcredentials.cpp index fbe01331e..31c70a119 100644 --- a/src/libsync/creds/httpcredentials.cpp +++ b/src/libsync/creds/httpcredentials.cpp @@ -195,7 +195,7 @@ void HttpCredentials::fetchFromKeychainHelper() _user + clientCertificatePEMC, _keychainMigration ? QString() : _account->id()); - ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); + auto *job = new ReadPasswordJob(Theme::instance()->appName()); addSettingsToJob(_account, job); job->setInsecureFallback(false); job->setKey(kck); @@ -206,7 +206,7 @@ void HttpCredentials::fetchFromKeychainHelper() void HttpCredentials::deleteOldKeychainEntries() { auto startDeleteJob = [this](QString user) { - DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName()); + auto *job = new DeletePasswordJob(Theme::instance()->appName()); addSettingsToJob(_account, job); job->setInsecureFallback(true); job->setKey(keychainKey(_account->url().toString(), user, QString())); @@ -236,7 +236,7 @@ void HttpCredentials::slotReadClientCertPEMJobDone(QKeychain::Job *incoming) #endif // Store PEM in memory - ReadPasswordJob *readJob = static_cast(incoming); + auto *readJob = static_cast(incoming); if (readJob->error() == NoError && readJob->binaryData().length() > 0) { QList sslCertificateList = QSslCertificate::fromData(readJob->binaryData(), QSsl::Pem); if (sslCertificateList.length() >= 1) { @@ -250,7 +250,7 @@ void HttpCredentials::slotReadClientCertPEMJobDone(QKeychain::Job *incoming) _user + clientKeyPEMC, _keychainMigration ? QString() : _account->id()); - ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); + auto *job = new ReadPasswordJob(Theme::instance()->appName()); addSettingsToJob(_account, job); job->setInsecureFallback(false); job->setKey(kck); @@ -261,7 +261,7 @@ void HttpCredentials::slotReadClientCertPEMJobDone(QKeychain::Job *incoming) void HttpCredentials::slotReadClientKeyPEMJobDone(QKeychain::Job *incoming) { // Store key in memory - ReadPasswordJob *readJob = static_cast(incoming); + auto *readJob = static_cast(incoming); if (readJob->error() == NoError && readJob->binaryData().length() > 0) { QByteArray clientKeyPEM = readJob->binaryData(); @@ -285,7 +285,7 @@ void HttpCredentials::slotReadClientKeyPEMJobDone(QKeychain::Job *incoming) _user, _keychainMigration ? QString() : _account->id()); - ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); + auto *job = new ReadPasswordJob(Theme::instance()->appName()); addSettingsToJob(_account, job); job->setInsecureFallback(false); job->setKey(kck); @@ -304,7 +304,7 @@ bool HttpCredentials::stillValid(QNetworkReply *reply) void HttpCredentials::slotReadJobDone(QKeychain::Job *incomingJob) { - QKeychain::ReadPasswordJob *job = static_cast(incomingJob); + auto *job = static_cast(incomingJob); QKeychain::Error error = job->error(); // If we can't find the credentials at the keys that include the account id, @@ -425,7 +425,7 @@ void HttpCredentials::invalidateToken() return; } - DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName()); + auto *job = new DeletePasswordJob(Theme::instance()->appName()); addSettingsToJob(_account, job); job->setInsecureFallback(true); job->setKey(kck); @@ -461,7 +461,7 @@ void HttpCredentials::persist() // write cert if there is one if (!_clientSslCertificate.isNull()) { - WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); + auto *job = new WritePasswordJob(Theme::instance()->appName()); addSettingsToJob(_account, job); job->setInsecureFallback(false); connect(job, &Job::finished, this, &HttpCredentials::slotWriteClientCertPEMJobDone); @@ -477,7 +477,7 @@ void HttpCredentials::slotWriteClientCertPEMJobDone() { // write ssl key if there is one if (!_clientSslKey.isNull()) { - WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); + auto *job = new WritePasswordJob(Theme::instance()->appName()); addSettingsToJob(_account, job); job->setInsecureFallback(false); connect(job, &Job::finished, this, &HttpCredentials::slotWriteClientKeyPEMJobDone); @@ -491,7 +491,7 @@ void HttpCredentials::slotWriteClientCertPEMJobDone() void HttpCredentials::slotWriteClientKeyPEMJobDone() { - WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName()); + auto *job = new WritePasswordJob(Theme::instance()->appName()); addSettingsToJob(_account, job); job->setInsecureFallback(false); connect(job, &Job::finished, this, &HttpCredentials::slotWriteJobDone); @@ -509,7 +509,7 @@ void HttpCredentials::slotWriteJobDone(QKeychain::Job *job) default: qCWarning(lcHttpCredentials) << "Error while writing password" << job->errorString(); } - WritePasswordJob *wjob = qobject_cast(job); + auto *wjob = qobject_cast(job); wjob->deleteLater(); } diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index b5780143b..3c25fe38a 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -156,7 +156,7 @@ void DiscoveryJob::update_job_update_callback(bool local, const char *dirUrl, void *userdata) { - DiscoveryJob *updateJob = static_cast(userdata); + auto *updateJob = static_cast(userdata); if (updateJob) { // Don't wanna overload the UI if (!updateJob->_lastUpdateProgressCallbackCall.isValid()) { @@ -263,7 +263,7 @@ DiscoverySingleDirectoryJob::DiscoverySingleDirectoryJob(const AccountPtr &accou void DiscoverySingleDirectoryJob::start() { // Start the actual HTTP job - LsColJob *lsColJob = new LsColJob(_account, _subPath, this); + auto *lsColJob = new LsColJob(_account, _subPath, this); QList props; props << "resourcetype" @@ -652,7 +652,7 @@ void DiscoveryMainThread::abort() csync_vio_handle_t *DiscoveryJob::remote_vio_opendir_hook(const char *url, void *userdata) { - DiscoveryJob *discoveryJob = static_cast(userdata); + auto *discoveryJob = static_cast(userdata); if (discoveryJob) { 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 DiscoveryJob::remote_vio_readdir_hook(csync_vio_handle_t *dhandle, void *userdata) { - DiscoveryJob *discoveryJob = static_cast(userdata); + auto *discoveryJob = static_cast(userdata); if (discoveryJob) { - DiscoveryDirectoryResult *directoryResult = static_cast(dhandle); + auto *directoryResult = static_cast(dhandle); if (!directoryResult->list.empty()) { auto file_stat = std::move(directoryResult->list.front()); directoryResult->list.pop_front(); @@ -699,9 +699,9 @@ std::unique_ptr DiscoveryJob::remote_vio_readdir_hook(csync_v void DiscoveryJob::remote_vio_closedir_hook(csync_vio_handle_t *dhandle, void *userdata) { - DiscoveryJob *discoveryJob = static_cast(userdata); + auto *discoveryJob = static_cast(userdata); if (discoveryJob) { - DiscoveryDirectoryResult *directoryResult = static_cast(dhandle); + auto *directoryResult = static_cast(dhandle); QString path = directoryResult->path; qCDebug(lcDiscovery) << discoveryJob << path; // just deletes the struct and the iterator, the data itself is owned by the SyncEngine/DiscoveryMainThread diff --git a/src/libsync/networkjobs.cpp b/src/libsync/networkjobs.cpp index 20e00f1a9..c1bf86d42 100644 --- a/src/libsync/networkjobs.cpp +++ b/src/libsync/networkjobs.cpp @@ -78,7 +78,7 @@ void RequestEtagJob::start() " \n" " \n" "\n"); - QBuffer *buf = new QBuffer(this); + auto *buf = new QBuffer(this); buf->setData(xml); buf->open(QIODevice::ReadOnly); // assumes ownership @@ -343,7 +343,7 @@ void LsColJob::start() " \n" + propStr + " \n" "\n"); - QBuffer *buf = new QBuffer(this); + auto *buf = new QBuffer(this); buf->setData(xml); buf->open(QIODevice::ReadOnly); if (_url.isValid()) { @@ -565,7 +565,7 @@ void PropfindJob::start() + propStr + " \n" "\n"; - QBuffer *buf = new QBuffer(this); + auto *buf = new QBuffer(this); buf->setData(xml); buf->open(QIODevice::ReadOnly); sendRequest("PROPFIND", makeDavUrl(path()), req, buf); @@ -727,7 +727,7 @@ void ProppatchJob::start() + propStr + " \n" "\n"; - QBuffer *buf = new QBuffer(this); + auto *buf = new QBuffer(this); buf->setData(xml); buf->open(QIODevice::ReadOnly); sendRequest("PROPPATCH", makeDavUrl(path()), req, buf); @@ -1040,7 +1040,7 @@ void fetchPrivateLinkUrl(AccountPtr account, const QString &remotePath, oldUrl = account->deprecatedPrivateLinkUrl(numericFileId).toString(QUrl::FullyEncoded); // Retrieve the new link by PROPFIND - PropfindJob *job = new PropfindJob(account, remotePath, target); + auto *job = new PropfindJob(account, remotePath, target); job->setProperties( QList() << "http://owncloud.org/ns:fileid" // numeric file id for fallback private link generation diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index 03d1dbf72..112068145 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -404,7 +404,7 @@ void OwncloudPropagator::start(const SyncFileItemVector &items, foreach (const SyncFileItemPtr &item, items) { if (!removedDirectory.isEmpty() && item->_file.startsWith(removedDirectory)) { // this is an item in a directory which is going to be removed. - PropagateDirectory *delDirJob = qobject_cast(directoriesToRemove.first()); + auto *delDirJob = qobject_cast(directoriesToRemove.first()); if (item->_instruction == CSYNC_INSTRUCTION_REMOVE) { // already taken care of. (by the removal of the parent directory) @@ -453,7 +453,7 @@ void OwncloudPropagator::start(const SyncFileItemVector &items, } if (item->isDirectory()) { - PropagateDirectory *dir = new PropagateDirectory(this, item); + auto *dir = new PropagateDirectory(this, item); if (item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE && item->_direction == SyncFileItem::Up) { @@ -846,7 +846,7 @@ bool PropagatorCompositeJob::scheduleSelfOrChild() void PropagatorCompositeJob::slotSubJobFinished(SyncFileItem::Status status) { - PropagatorJob *subJob = static_cast(sender()); + auto *subJob = static_cast(sender()); ASSERT(subJob); // 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 || _item->_instruction == CSYNC_INSTRUCTION_NEW || _item->_instruction == CSYNC_INSTRUCTION_UPDATE_METADATA) { - if (PropagateRemoteMkdir *mkdir = qobject_cast(_firstJob.data())) { + if (auto *mkdir = qobject_cast(_firstJob.data())) { // special case from MKDIR, get the fileId from the job there if (_item->_fileId.isEmpty() && !mkdir->_item->_fileId.isEmpty()) { _item->_fileId = mkdir->_item->_fileId; @@ -1018,7 +1018,7 @@ void CleanupPollsJob::start() SyncJournalFileRecord record; if (_journal->getFileRecord(info._file, &record) && record.isValid()) { 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); job->start(); } @@ -1026,7 +1026,7 @@ void CleanupPollsJob::start() void CleanupPollsJob::slotPollFinished() { - PollJob *job = qobject_cast(sender()); + auto *job = qobject_cast(sender()); ASSERT(job); if (job->_item->_status == SyncFileItem::FatalError) { emit aborted(job->_item->_errorString); diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index df182ae46..ab8a5c9a9 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -686,7 +686,7 @@ void PropagateDownloadFile::slotGetFinished() // 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() // as this is (still) also correct. - ValidateChecksumHeader *validator = new ValidateChecksumHeader(this); + auto *validator = new ValidateChecksumHeader(this); connect(validator, &ValidateChecksumHeader::validated, this, &PropagateDownloadFile::transmissionChecksumValidated); connect(validator, &ValidateChecksumHeader::validationFailed, diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp index 6ba783a86..34579b081 100644 --- a/src/libsync/propagateupload.cpp +++ b/src/libsync/propagateupload.cpp @@ -509,7 +509,7 @@ void UploadDevice::setChoked(bool b) 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); connect(job, &PollJob::finishedSignal, this, &PropagateUploadFileCommon::slotPollFinished); SyncJournalDb::PollInfo info; @@ -524,7 +524,7 @@ void PropagateUploadFileCommon::startPollJob(const QString &path) void PropagateUploadFileCommon::slotPollFinished() { - PollJob *job = qobject_cast(sender()); + auto *job = qobject_cast(sender()); ASSERT(job); propagator()->_activeJobList.removeOne(this); diff --git a/src/libsync/propagateuploadng.cpp b/src/libsync/propagateuploadng.cpp index bb93713ce..78ce82089 100644 --- a/src/libsync/propagateuploadng.cpp +++ b/src/libsync/propagateuploadng.cpp @@ -329,7 +329,7 @@ void PropagateUploadFileNG::startNextChunk() // job takes ownership of device via a QScopedPointer. Job deletes itself when finishing 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); connect(job, &PUTFileJob::finishedSignal, this, &PropagateUploadFileNG::slotPutFinished); connect(job, &PUTFileJob::uploadProgress, @@ -344,7 +344,7 @@ void PropagateUploadFileNG::startNextChunk() void PropagateUploadFileNG::slotPutFinished() { - PUTFileJob *job = qobject_cast(sender()); + auto *job = qobject_cast(sender()); ASSERT(job); slotJobDestroyed(job); // remove it from the _jobs list diff --git a/src/libsync/propagateuploadv1.cpp b/src/libsync/propagateuploadv1.cpp index 104fa9d75..29c8b4b1a 100644 --- a/src/libsync/propagateuploadv1.cpp +++ b/src/libsync/propagateuploadv1.cpp @@ -139,7 +139,7 @@ void PropagateUploadFileV1::startNextChunk() // job takes ownership of device via a QScopedPointer. Job deletes itself when finishing 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); connect(job, &PUTFileJob::finishedSignal, this, &PropagateUploadFileV1::slotPutFinished); connect(job, &PUTFileJob::uploadProgress, this, &PropagateUploadFileV1::slotUploadProgress); @@ -187,7 +187,7 @@ void PropagateUploadFileV1::startNextChunk() void PropagateUploadFileV1::slotPutFinished() { - PUTFileJob *job = qobject_cast(sender()); + auto *job = qobject_cast(sender()); ASSERT(job); slotJobDestroyed(job); // remove it from the _jobs list @@ -357,7 +357,7 @@ void PropagateUploadFileV1::abort(PropagatorJob::AbortType abortType) abortNetworkJobs( abortType, [this, abortType](AbstractNetworkJob *job) { - if (PUTFileJob *putJob = qobject_cast(job)){ + if (auto *putJob = qobject_cast(job)){ if (abortType == AbortType::Asynchronous && _chunkCount > 0 && (((_currentChunk + _startChunk) % _chunkCount) == 0) diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index 91be03ebb..c34317ac8 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -765,7 +765,7 @@ void SyncEngine::startSync() QVector pollInfos = _journal->getPollInfos(); if (!pollInfos.isEmpty()) { qCInfo(lcEngine) << "Finish Poll jobs before starting a sync"; - CleanupPollsJob *job = new CleanupPollsJob(pollInfos, _account, + auto *job = new CleanupPollsJob(pollInfos, _account, _journal, _localPath, this); connect(job, &CleanupPollsJob::finished, this, &SyncEngine::startSync); connect(job, &CleanupPollsJob::aborted, this, &SyncEngine::slotCleanPollsJobAborted); @@ -899,7 +899,7 @@ void SyncEngine::startSync() 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->_selectiveSyncWhiteList = _journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList, &ok); diff --git a/test/testchecksumvalidator.cpp b/test/testchecksumvalidator.cpp index 041dc193c..f24f8977d 100644 --- a/test/testchecksumvalidator.cpp +++ b/test/testchecksumvalidator.cpp @@ -63,7 +63,7 @@ using namespace OCC; #ifndef ZLIB_FOUND QSKIP("ZLIB not found.", SkipSingle); #else - ComputeChecksum *vali = new ComputeChecksum(this); + auto *vali = new ComputeChecksum(this); _expectedType = "Adler32"; vali->setChecksumType(_expectedType); @@ -83,7 +83,7 @@ using namespace OCC; void testUploadChecksummingMd5() { - ComputeChecksum *vali = new ComputeChecksum(this); + auto *vali = new ComputeChecksum(this); _expectedType = OCC::checkSumMD5C; vali->setChecksumType(_expectedType); connect(vali, SIGNAL(done(QByteArray,QByteArray)), this, SLOT(slotUpValidated(QByteArray,QByteArray))); @@ -100,7 +100,7 @@ using namespace OCC; void testUploadChecksummingSha1() { - ComputeChecksum *vali = new ComputeChecksum(this); + auto *vali = new ComputeChecksum(this); _expectedType = OCC::checkSumSHA1C; vali->setChecksumType(_expectedType); connect(vali, SIGNAL(done(QByteArray,QByteArray)), this, SLOT(slotUpValidated(QByteArray,QByteArray))); @@ -125,7 +125,7 @@ using namespace OCC; adler.append(FileSystem::calcAdler32( _testfile )); _successDown = false; - ValidateChecksumHeader *vali = new ValidateChecksumHeader(this); + auto *vali = new ValidateChecksumHeader(this); connect(vali, SIGNAL(validated(QByteArray,QByteArray)), this, SLOT(slotDownValidated())); connect(vali, SIGNAL(validationFailed(QString)), this, SLOT(slotDownError(QString))); vali->start(_testfile, adler); diff --git a/test/testfolderman.cpp b/test/testfolderman.cpp index 8af45f0df..6d9263db4 100644 --- a/test/testfolderman.cpp +++ b/test/testfolderman.cpp @@ -45,7 +45,7 @@ private slots: AccountPtr account = Account::create(); QUrl url("http://example.de"); - HttpCredentialsTest *cred = new HttpCredentialsTest("testuser", "secret"); + auto *cred = new HttpCredentialsTest("testuser", "secret"); account->setCredentials(cred); account->setUrl( url ); @@ -153,7 +153,7 @@ private slots: AccountPtr account = Account::create(); QUrl url("http://example.de"); - HttpCredentialsTest *cred = new HttpCredentialsTest("testuser", "secret"); + auto *cred = new HttpCredentialsTest("testuser", "secret"); account->setCredentials(cred); account->setUrl( url ); url.setUserName(cred->user()); diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp index 43117fea4..6ab28af42 100644 --- a/test/testsyncengine.cpp +++ b/test/testsyncengine.cpp @@ -317,7 +317,7 @@ private slots: }); // For directly editing the remote checksum - FileInfo &remoteInfo = dynamic_cast(fakeFolder.remoteModifier()); + auto &remoteInfo = dynamic_cast(fakeFolder.remoteModifier()); // Base mtime with no ms content (filesystem is seconds only) auto mtime = QDateTime::currentDateTimeUtc().addDays(-4);