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
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);
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);
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,
layout->addItem(buttonLayout, 1, 0, 1, 2);
}
} else {
- QHBoxLayout *layout = new QHBoxLayout(content);
+ auto *layout = new QHBoxLayout(content);
layout->addWidget(iconLabel);
layout->addWidget(textLabel);
lockfile.open(QtLockedFile::ReadWrite);
lockfile.lock(QtLockedFile::WriteLock);
- qint64 *pids = static_cast<qint64 *>(instances->data());
+ auto *pids = static_cast<qint64 *>(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
lockfile.open(QtLockedFile::ReadWrite);
lockfile.lock(QtLockedFile::WriteLock);
// Rewrite array, removing current pid and previously crashed ones
- qint64 *pids = static_cast<qint64 *>(instances->data());
+ auto *pids = static_cast<qint64 *>(instances->data());
qint64 *newpids = pids;
for (; *pids; ++pids) {
if (*pids != appPid && isRunning(*pids))
bool QtSingleApplication::event(QEvent *event)
{
if (event->type() == QEvent::FileOpen) {
- QFileOpenEvent *foe = static_cast<QFileOpenEvent*>(event);
+ auto *foe = static_cast<QFileOpenEvent*>(event);
emit fileOpenRequest(foe->file());
return true;
}
}
}
- 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);
// '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;
case QVariant::String: {
if (!value.toString().isNull()) {
// lifetime of string == lifetime of its qvariant
- const QString *str = static_cast<const QString *>(value.constData());
+ const auto *str = static_cast<const QString *>(value.constData());
res = sqlite3_bind_text16(_stmt, pos, str->utf16(),
(str->size()) * sizeof(QChar), SQLITE_TRANSIENT);
} else {
// Save cookies.
if (acc->_am) {
- CookieJar *jar = qobject_cast<CookieJar *>(acc->_am->cookieJar());
+ auto *jar = qobject_cast<CookieJar *>(acc->_am->cookieJar());
if (jar) {
qCInfo(lcAccountManager) << "Saving cookies." << acc->cookieJarPath();
jar->save(acc->cookieJarPath());
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"));
_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)
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);
{
_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);
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);
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);
void AccountSettings::slotFolderWizardAccepted()
{
- FolderWizard *folderWizard = qobject_cast<FolderWizard *>(sender());
+ auto *folderWizard = qobject_cast<FolderWizard *>(sender());
FolderMan *folderMan = FolderMan::instance();
qCInfo(lcAccountSettings) << "Folder wizard completed";
return;
}
- ConnectionValidator *conValidator = new ConnectionValidator(AccountStatePtr(this));
+ auto *conValidator = new ConnectionValidator(AccountStatePtr(this));
_connectionValidator = conValidator;
connect(conValidator, &ConnectionValidator::connectionResult,
this, &AccountState::slotConnectionValidatorResult);
}
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);
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;
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
, _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);
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
}
// 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);
// 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<QByteArray>() << "getlastmodified");
connect(job, &PropfindJob::result, this, &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();
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);
}
dialog.setLabelText(msg);
dialog.setTextValue(_previousPassword);
dialog.setTextEchoMode(QLineEdit::Password);
- if (QLabel *dialogLabel = dialog.findChild<QLabel *>()) {
+ if (auto *dialogLabel = dialog.findChild<QLabel *>()) {
dialogLabel->setOpenExternalLinks(true);
dialogLabel->setTextFormat(Qt::RichText);
}
void WriteJob::slotWriteJobDone(QKeychain::Job *incomingJob)
{
- QKeychain::WritePasswordJob *writeJob = static_cast<QKeychain::WritePasswordJob *>(incomingJob);
+ auto *writeJob = static_cast<QKeychain::WritePasswordJob *>(incomingJob);
// errors?
if (writeJob) {
_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
_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
void ReadJob::slotReadJobDone(QKeychain::Job *incomingJob)
{
// Errors or next chunk?
- QKeychain::ReadPasswordJob *readJob = static_cast<QKeychain::ReadPasswordJob *>(incomingJob);
+ auto *readJob = static_cast<QKeychain::ReadPasswordJob *>(incomingJob);
if (readJob) {
if (readJob->error() == NoError && readJob->binaryData().length() > 0) {
// 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();
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(),
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
{
_ready = false;
- CookieJar *jar = static_cast<CookieJar *>(_account->networkAccessManager()->cookieJar());
+ auto *jar = static_cast<CookieJar *>(_account->networkAccessManager()->cookieJar());
// Remove the _shibCookie
auto cookies = jar->allCookies();
{
// 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();
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();
}
}
if (job->error() == QKeychain::NoError) {
- ReadPasswordJob *readJob = static_cast<ReadPasswordJob *>(job);
+ auto *readJob = static_cast<ReadPasswordJob *>(job);
delete readJob->settings();
QList<QNetworkCookie> cookies = QNetworkCookie::parseCookies(readJob->textData().toUtf8());
if (cookies.count() > 0) {
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();
return;
}
- CookieJar *jar = static_cast<CookieJar *>(_account->networkAccessManager()->cookieJar());
+ auto *jar = static_cast<CookieJar *>(_account->networkAccessManager()->cookieJar());
// When opening a new window clear all the session cookie that might keep the user from logging in
// (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)
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*)));
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();
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);
}
// 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
default:
qCWarning(lcWebFlowCredentials) << "Error while writing password" << job->errorString();
}
- WritePasswordJob *wjob = qobject_cast<WritePasswordJob *>(job);
+ auto *wjob = qobject_cast<WritePasswordJob *>(job);
wjob->deleteLater();
}
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<DeletePasswordJob *>(job);
+ auto *djob = qobject_cast<DeletePasswordJob *>(job);
djob->deleteLater();
});
job->start();
_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
}
void WebFlowCredentials::slotReadPasswordJobDone(Job *incomingJob) {
- QKeychain::ReadPasswordJob *job = qobject_cast<ReadPasswordJob *>(incomingJob);
+ auto *job = qobject_cast<ReadPasswordJob *>(incomingJob);
QKeychain::Error error = job->error();
// If we could not find the entry try the old entries
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
oldKeychainEntries ? QString() : _account->id()));
connect(job, &Job::finished, this, [](QKeychain::Job *job) {
- DeletePasswordJob *djob = qobject_cast<DeletePasswordJob *>(job);
+ auto *djob = qobject_cast<DeletePasswordJob *>(job);
djob->deleteLater();
});
job->start();
void FolderMan::slotFolderCanSyncChanged()
{
- Folder *f = qobject_cast<Folder *>(sender());
+ auto *f = qobject_cast<Folder *>(sender());
ASSERT(f);
if (f->canSync()) {
_socketApi->slotRegisterPath(f->alias());
void FolderMan::slotAccountStateChanged()
{
- AccountState *accountState = qobject_cast<AccountState *>(sender());
+ auto *accountState = qobject_cast<AccountState *>(sender());
if (!accountState) {
return;
}
void FolderMan::slotForwardFolderSyncStateChange()
{
- if (Folder *f = qobject_cast<Folder *>(sender())) {
+ if (auto *f = qobject_cast<Folder *>(sender())) {
emit folderSyncStateChange(f);
}
}
const QString userDir = QDir::cleanPath(canonicalPath(path)) + '/';
for (auto i = _folderMap.constBegin(); i != _folderMap.constEnd(); ++i) {
- Folder *f = static_cast<Folder *>(i.value());
+ auto *f = static_cast<Folder *>(i.value());
QString folderDir = QDir::cleanPath(canonicalPath(f->path())) + '/';
bool differentPaths = QString::compare(folderDir, userDir, cs) != 0;
switch (event->type()) {
case QEvent::MouseButtonPress:
case QEvent::MouseMove:
- if (const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(option.widget)) {
- QMouseEvent *me = static_cast<QMouseEvent *>(event);
+ if (const auto *view = qobject_cast<const QAbstractItemView *>(option.widget)) {
+ auto *me = static_cast<QMouseEvent *>(event);
QModelIndex index;
if (me->buttons()) {
index = view->indexAt(me->pos());
{
if (role == Qt::CheckStateRole) {
auto info = infoForIndex(index);
- Qt::CheckState checked = static_cast<Qt::CheckState>(value.toInt());
+ auto checked = static_cast<Qt::CheckState>(value.toInt());
if (info && info->_checked != checked) {
info->_checked = checked;
_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<QByteArray>() << "resourcetype"
<< "http://owncloud.org/ns:size"
return; // for https://github.com/owncloud/client/issues/2648#issuecomment-71377909
}
- Folder *f = qobject_cast<Folder *>(sender());
+ auto *f = qobject_cast<Folder *>(sender());
if (!f) {
return;
}
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':")
}
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<void (MkColJob::*)(QNetworkReply::NetworkError)>(&MkColJob::finished),
this, &FolderWizardRemotePath::slotCreateRemoteFolderFinished);
LsColJob *FolderWizardRemotePath::runLsColJob(const QString &path)
{
- LsColJob *job = new LsColJob(_account, path, this);
+ auto *job = new LsColJob(_account, path, this);
job->setProperties(QList<QByteArray>() << "resourcetype");
connect(job, &LsColJob::directoryListingSubfolders,
this, &FolderWizardRemotePath::slotUpdateDirectories);
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<Folder *>(i.value());
+ auto *f = static_cast<Folder *>(i.value());
if (f->accountState()->account() != _account) {
continue;
}
FolderWizardSelectiveSync::FolderWizardSelectiveSync(const AccountPtr &account)
{
- QVBoxLayout *layout = new QVBoxLayout(this);
+ auto *layout = new QVBoxLayout(this);
_selectiveSync = new SelectiveSyncWidget(account, this);
layout->addWidget(_selectiveSync);
}
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);
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);
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);
// 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);
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") {
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;
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);
// 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);
// 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);
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();
{
QString errorMsg;
- PropfindJob *job = qobject_cast<PropfindJob *>(sender());
+ auto *job = qobject_cast<PropfindJob *>(sender());
if (!job) {
qCWarning(lcWizard) << "Can't check for authed redirects. This slot should be invoked from PropfindJob!";
return;
* 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 {
{
_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();
}
// Find the responsible QNAM if possible.
QNetworkAccessManager *sending_qnam = nullptr;
QWeakPointer<QNetworkAccessManager> qnam_alive;
- if (Account *account = qobject_cast<Account *>(sender())) {
+ if (auto *account = qobject_cast<Account *>(sender())) {
// Since we go into an event loop, it's possible for the account's qnam
// to be destroyed before we get back. We can use this to check for its
// liveness.
_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());
void SelectiveSyncWidget::refreshFolders()
{
- LsColJob *job = new LsColJob(_account, _folderPath, this);
+ auto *job = new LsColJob(_account, _folderPath, this);
job->setProperties(QList<QByteArray>() << "resourcetype"
<< "http://owncloud.org/ns:size");
connect(job, &LsColJob::directoryListingSubfolders,
parent->setToolTip(0, path);
parent->setData(0, Qt::UserRole, path);
} else {
- SelectiveSyncTreeViewItem *item = static_cast<SelectiveSyncTreeViewItem *>(findFirstChild(parent, pathTrail.first()));
+ auto *item = static_cast<SelectiveSyncTreeViewItem *>(findFirstChild(parent, pathTrail.first()));
if (!item) {
item = new SelectiveSyncTreeViewItem(parent);
if (parent->checkState(0) == Qt::Checked
QScopedValueRollback<bool> isInserting(_inserting);
_inserting = true;
- SelectiveSyncTreeViewItem *root = static_cast<SelectiveSyncTreeViewItem *>(_folderTree->topLevelItem(0));
+ auto *root = static_cast<SelectiveSyncTreeViewItem *>(_folderTree->topLevelItem(0));
QUrl url = _account->davUrl();
QString pathToRemove = url.path();
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<QByteArray>() << "resourcetype"
<< "http://owncloud.org/ns:size");
connect(job, &LsColJob::directoryListingSubfolders,
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;
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);
_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);
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)
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);
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);
void SettingsDialog::slotAccountAvatarChanged()
{
- Account *account = static_cast<Account *>(sender());
+ auto *account = static_cast<Account *>(sender());
if (account && _actionForAccount.contains(account)) {
QAction *action = _actionForAccount[account];
if (action) {
void SettingsDialog::slotAccountDisplayNameChanged()
{
- Account *account = static_cast<Account *>(sender());
+ auto *account = static_cast<Account *>(sender());
if (account && _actionForAccount.contains(account)) {
QAction *action = _actionForAccount[account];
if (action) {
Q_FOREACH (QAction *a, _actionGroup->actions()) {
QIcon icon = Theme::createColorAwareIcon(a->property("iconPath").toString(), palette());
a->setIcon(icon);
- QToolButton *btn = qobject_cast<QToolButton *>(_toolBar->widgetForAction(a));
+ auto *btn = qobject_cast<QToolButton *>(_toolBar->widgetForAction(a));
if (btn)
btn->setIcon(icon);
}
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);
}
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();
}
{
_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);
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);
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);
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);
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());
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);
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);
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);
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);
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);
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);
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);
_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);
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);
* 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();
}
void ShareUserLine::slotShareDeleted()
{
- QPropertyAnimation *animation = new QPropertyAnimation(this, "maximumHeight", this);
+ auto *animation = new QPropertyAnimation(this, "maximumHeight", this);
animation->setDuration(500);
animation->setStartValue(height());
void SocketApi::slotSocketDestroyed(QObject *obj)
{
- QIODevice *socket = static_cast<QIODevice *>(obj);
+ auto *socket = static_cast<QIODevice *>(obj);
_listeners.erase(std::remove_if(_listeners.begin(), _listeners.end(), ListenerHasSocketPred(socket)), _listeners.end());
}
void SocketApi::slotReadSocket()
{
- QIODevice *socket = qobject_cast<QIODevice *>(sender());
+ auto *socket = qobject_cast<QIODevice *>(sender());
ASSERT(socket);
SocketListener *listener = &*std::find_if(_listeners.begin(), _listeners.end(), ListenerHasSocketPred(socket));
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);
}
// 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);
}
msg += QL("</div></body></html>");
- 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);
bool ToolTipUpdater::eventFilter(QObject * /*obj*/, QEvent *ev)
{
if (ev->type() == QEvent::ToolTip) {
- QHelpEvent *helpEvent = static_cast<QHelpEvent *>(ev);
+ auto *helpEvent = static_cast<QHelpEvent *>(ev);
_toolTipPos = helpEvent->globalPos();
}
return false;
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);
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);
}
{
if (statusCode == successStatusCode) {
qCWarning(lcServerNotification) << "New Notification ETag Response Header received " << value;
- AccountState *account = qvariant_cast<AccountState *>(sender()->property(propertyAccountStateC));
+ auto *account = qvariant_cast<AccountState *>(sender()->property(propertyAccountStateC));
account->setNotificationsEtagResponseHeader(value);
}
}
auto notifies = json.object().value("ocs").toObject().value("data").toArray();
- AccountState *ai = qvariant_cast<AccountState *>(sender()->property(propertyAccountStateC));
+ auto *ai = qvariant_cast<AccountState *>(sender()->property(propertyAccountStateC));
ActivityList list;
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);
}
// 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);
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));
void User::slotNotifyNetworkError(QNetworkReply *reply)
{
- NotificationConfirmJob *job = qobject_cast<NotificationConfirmJob *>(sender());
+ auto *job = qobject_cast<NotificationConfirmJob *>(sender());
if (!job) {
return;
}
void User::slotNotifyServerFinished(const QString &reply, int replyCode)
{
- NotificationConfirmJob *job = qobject_cast<NotificationConfirmJob *>(sender());
+ auto *job = qobject_cast<NotificationConfirmJob *>(sender());
if (!job) {
return;
}
// 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();
void Flow2AuthCredsPage::initializePage()
{
- OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
+ auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
Q_ASSERT(ocWizard);
ocWizard->account()->setCredentials(CredentialsFactory::create("http"));
case Flow2Auth::LoggedIn: {
_user = user;
_appPassword = appPassword;
- OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
+ auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
Q_ASSERT(ocWizard);
emit connectToOCUrl(ocWizard->account()->url().toString());
void Flow2AuthCredsPage::setConnected()
{
- OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
+ auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
Q_ASSERT(ocWizard);
// bring wizard to top
AbstractCredentials *Flow2AuthCredsPage::getCredentials() const
{
- OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
+ auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
Q_ASSERT(ocWizard);
return new WebFlowCredentials(
_user,
_ui.rSyncEverything->setChecked(_selectiveSyncBlacklist.isEmpty());
AccountPtr acc = static_cast<OwncloudWizard *>(wizard())->account();
- SelectiveSyncDialog *dlg = new SelectiveSyncDialog(acc, _remoteFolder, _selectiveSyncBlacklist, this);
+ auto *dlg = new SelectiveSyncDialog(acc, _remoteFolder, _selectiveSyncBlacklist, this);
const int result = dlg->exec();
bool updateBlacklist = false;
{
WizardCommon::initErrorLabel(_ui.errorLabel);
- OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
+ auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
AbstractCredentials *cred = ocWizard->account()->credentials();
- HttpCredentials *httpCreds = qobject_cast<HttpCredentials *>(cred);
+ auto *httpCreds = qobject_cast<HttpCredentials *>(cred);
if (httpCreds) {
const QString user = httpCreds->fetchUser();
if (!user.isEmpty()) {
startSpinner();
// Reset cookies to ensure the username / password is actually used
- OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
+ auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
ocWizard->account()->clearCookieJar();
emit completeChanged();
void OwncloudOAuthCredsPage::initializePage()
{
- OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
+ auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
Q_ASSERT(ocWizard);
ocWizard->account()->setCredentials(CredentialsFactory::create("http"));
_asyncAuth.reset(new OAuth(ocWizard->account().data(), this));
switch (r) {
case OAuth::NotSupported: {
/* OAuth not supported (can't open browser), fallback to HTTP credentials */
- OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
+ auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
ocWizard->back();
ocWizard->setAuthType(DetermineAuthTypeJob::Basic);
break;
_token = token;
_user = user;
_refreshToken = refreshToken;
- OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
+ auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
Q_ASSERT(ocWizard);
emit connectToOCUrl(ocWizard->account()->url().toString());
break;
AbstractCredentials *OwncloudOAuthCredsPage::getCredentials() const
{
- OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
+ auto *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
Q_ASSERT(ocWizard);
return new HttpCredentialsGui(_user, _token, _refreshToken,
ocWizard->_clientSslCertificate, ocWizard->_clientSslKey);
{
_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);
_checking = false;
QAbstractButton *nextButton = wizard()->button(QWizard::NextButton);
- QPushButton *pushButton = qobject_cast<QPushButton *>(nextButton);
+ auto *pushButton = qobject_cast<QPushButton *>(nextButton);
if (pushButton)
pushButton->setDefault(true);
if (!_browser.isNull()) {
return;
}
- OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
+ auto *ocWizard = qobject_cast<OwncloudWizard *>(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);
QWebEnginePage * WebEnginePage::createWindow(QWebEnginePage::WebWindowType type) {
Q_UNUSED(type);
- ExternalWebEnginePage *view = new ExternalWebEnginePage(this->profile());
+ auto *view = new ExternalWebEnginePage(this->profile());
return view;
}
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);
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<WritePasswordJob *>(incoming);
+ auto *writeJob = static_cast<WritePasswordJob *>(incoming);
if (writeJob->error() == NoError)
qCInfo(lcAccount) << "appPassword stored in keychain";
else
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<ReadPasswordJob *>(incoming);
+ auto *readJob = static_cast<ReadPasswordJob *>(incoming);
QString pwd("");
// Error or no valid public key error out
if (readJob->error() == NoError &&
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<DeletePasswordJob *>(incoming);
+ auto *deleteJob = static_cast<DeletePasswordJob *>(incoming);
if (deleteJob->error() == NoError)
qCInfo(lcAccount) << "appPassword deleted from keychain";
else
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();
}
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());
void BandwidthManager::unregisterDownloadJob(QObject *o)
{
- GETFileJob *j = reinterpret_cast<GETFileJob *>(o); // note, we might already be in the ~QObject
+ auto *j = reinterpret_cast<GETFileJob *>(o); // note, we might already be in the ~QObject
_downloadJobList.removeAll(j);
if (_relativeLimitCurrentMeasuredJob == j) {
_relativeLimitCurrentMeasuredJob = nullptr;
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) {
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;
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();
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.
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.
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;
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();
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();
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);
_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);
}
void ClientSideEncryption::publicKeyFetched(Job *incoming) {
- ReadPasswordJob *readJob = static_cast<ReadPasswordJob *>(incoming);
+ auto *readJob = static_cast<ReadPasswordJob *>(incoming);
// Error or no valid public key error out
if (readJob->error() != NoError || readJob->binaryData().length() == 0) {
_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);
}
void ClientSideEncryption::privateKeyFetched(Job *incoming) {
- ReadPasswordJob *readJob = static_cast<ReadPasswordJob *>(incoming);
+ auto *readJob = static_cast<ReadPasswordJob *>(incoming);
// Error or no valid public key error out
if (readJob->error() != NoError || readJob->binaryData().length() == 0) {
_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);
}
void ClientSideEncryption::mnemonicKeyFetched(QKeychain::Job *incoming) {
- ReadPasswordJob *readJob = static_cast<ReadPasswordJob *>(incoming);
+ auto *readJob = static_cast<ReadPasswordJob *>(incoming);
// Error or no valid public key error out
if (readJob->error() != NoError || readJob->textData().length() == 0) {
_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);
_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());
_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);
_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();
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;
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;
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) {
req.setHeader(QNetworkRequest::ContentTypeHeader, QByteArrayLiteral("application/xml"));
QByteArray xml = "<d:propfind xmlns:d=\"DAV:\"> <d:prop xmlns:nc=\"http://nextcloud.org/ns\"> <nc:is-encrypted/> </d:prop> </d:propfind>";
- QBuffer *buf = new QBuffer(this);
+ auto *buf = new QBuffer(this);
buf->setData(xml);
buf->open(QIODevice::ReadOnly);
QString tmpPath = path() + (!_folder.isEmpty() ? "/" + _folder : QString());
_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);
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()));
#endif
// Store PEM in memory
- ReadPasswordJob *readJob = static_cast<ReadPasswordJob *>(incoming);
+ auto *readJob = static_cast<ReadPasswordJob *>(incoming);
if (readJob->error() == NoError && readJob->binaryData().length() > 0) {
QList<QSslCertificate> sslCertificateList = QSslCertificate::fromData(readJob->binaryData(), QSsl::Pem);
if (sslCertificateList.length() >= 1) {
_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);
void HttpCredentials::slotReadClientKeyPEMJobDone(QKeychain::Job *incoming)
{
// Store key in memory
- ReadPasswordJob *readJob = static_cast<ReadPasswordJob *>(incoming);
+ auto *readJob = static_cast<ReadPasswordJob *>(incoming);
if (readJob->error() == NoError && readJob->binaryData().length() > 0) {
QByteArray clientKeyPEM = readJob->binaryData();
_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);
void HttpCredentials::slotReadJobDone(QKeychain::Job *incomingJob)
{
- QKeychain::ReadPasswordJob *job = static_cast<ReadPasswordJob *>(incomingJob);
+ auto *job = static_cast<ReadPasswordJob *>(incomingJob);
QKeychain::Error error = job->error();
// If we can't find the credentials at the keys that include the account id,
return;
}
- DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName());
+ auto *job = new DeletePasswordJob(Theme::instance()->appName());
addSettingsToJob(_account, job);
job->setInsecureFallback(true);
job->setKey(kck);
// 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);
{
// 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);
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);
default:
qCWarning(lcHttpCredentials) << "Error while writing password" << job->errorString();
}
- WritePasswordJob *wjob = qobject_cast<WritePasswordJob *>(job);
+ auto *wjob = qobject_cast<WritePasswordJob *>(job);
wjob->deleteLater();
}
const char *dirUrl,
void *userdata)
{
- DiscoveryJob *updateJob = static_cast<DiscoveryJob *>(userdata);
+ auto *updateJob = static_cast<DiscoveryJob *>(userdata);
if (updateJob) {
// Don't wanna overload the UI
if (!updateJob->_lastUpdateProgressCallbackCall.isValid()) {
void DiscoverySingleDirectoryJob::start()
{
// Start the actual HTTP job
- LsColJob *lsColJob = new LsColJob(_account, _subPath, this);
+ auto *lsColJob = new LsColJob(_account, _subPath, this);
QList<QByteArray> props;
props << "resourcetype"
csync_vio_handle_t *DiscoveryJob::remote_vio_opendir_hook(const char *url,
void *userdata)
{
- DiscoveryJob *discoveryJob = static_cast<DiscoveryJob *>(userdata);
+ auto *discoveryJob = static_cast<DiscoveryJob *>(userdata);
if (discoveryJob) {
qCDebug(lcDiscovery) << discoveryJob << url << "Calling into main thread...";
std::unique_ptr<csync_file_stat_t> DiscoveryJob::remote_vio_readdir_hook(csync_vio_handle_t *dhandle,
void *userdata)
{
- DiscoveryJob *discoveryJob = static_cast<DiscoveryJob *>(userdata);
+ auto *discoveryJob = static_cast<DiscoveryJob *>(userdata);
if (discoveryJob) {
- DiscoveryDirectoryResult *directoryResult = static_cast<DiscoveryDirectoryResult *>(dhandle);
+ auto *directoryResult = static_cast<DiscoveryDirectoryResult *>(dhandle);
if (!directoryResult->list.empty()) {
auto file_stat = std::move(directoryResult->list.front());
directoryResult->list.pop_front();
void DiscoveryJob::remote_vio_closedir_hook(csync_vio_handle_t *dhandle, void *userdata)
{
- DiscoveryJob *discoveryJob = static_cast<DiscoveryJob *>(userdata);
+ auto *discoveryJob = static_cast<DiscoveryJob *>(userdata);
if (discoveryJob) {
- DiscoveryDirectoryResult *directoryResult = static_cast<DiscoveryDirectoryResult *>(dhandle);
+ auto *directoryResult = static_cast<DiscoveryDirectoryResult *>(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
" <d:getetag/>\n"
" </d:prop>\n"
"</d:propfind>\n");
- QBuffer *buf = new QBuffer(this);
+ auto *buf = new QBuffer(this);
buf->setData(xml);
buf->open(QIODevice::ReadOnly);
// assumes ownership
" <d:prop>\n"
+ propStr + " </d:prop>\n"
"</d:propfind>\n");
- QBuffer *buf = new QBuffer(this);
+ auto *buf = new QBuffer(this);
buf->setData(xml);
buf->open(QIODevice::ReadOnly);
if (_url.isValid()) {
+ propStr + " </d:prop>\n"
"</d:propfind>\n";
- QBuffer *buf = new QBuffer(this);
+ auto *buf = new QBuffer(this);
buf->setData(xml);
buf->open(QIODevice::ReadOnly);
sendRequest("PROPFIND", makeDavUrl(path()), req, buf);
+ propStr + " </d:prop></d:set>\n"
"</d:propertyupdate>\n";
- QBuffer *buf = new QBuffer(this);
+ auto *buf = new QBuffer(this);
buf->setData(xml);
buf->open(QIODevice::ReadOnly);
sendRequest("PROPPATCH", makeDavUrl(path()), req, buf);
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<QByteArray>()
<< "http://owncloud.org/ns:fileid" // numeric file id for fallback private link generation
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<PropagateDirectory *>(directoriesToRemove.first());
+ auto *delDirJob = qobject_cast<PropagateDirectory *>(directoriesToRemove.first());
if (item->_instruction == CSYNC_INSTRUCTION_REMOVE) {
// already taken care of. (by the removal of the parent directory)
}
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) {
void PropagatorCompositeJob::slotSubJobFinished(SyncFileItem::Status status)
{
- PropagatorJob *subJob = static_cast<PropagatorJob *>(sender());
+ auto *subJob = static_cast<PropagatorJob *>(sender());
ASSERT(subJob);
// Delete the job and remove it from our list of jobs.
if (_item->_instruction == CSYNC_INSTRUCTION_RENAME
|| _item->_instruction == CSYNC_INSTRUCTION_NEW
|| _item->_instruction == CSYNC_INSTRUCTION_UPDATE_METADATA) {
- if (PropagateRemoteMkdir *mkdir = qobject_cast<PropagateRemoteMkdir *>(_firstJob.data())) {
+ if (auto *mkdir = qobject_cast<PropagateRemoteMkdir *>(_firstJob.data())) {
// special case from MKDIR, get the fileId from the job there
if (_item->_fileId.isEmpty() && !mkdir->_item->_fileId.isEmpty()) {
_item->_fileId = mkdir->_item->_fileId;
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();
}
void CleanupPollsJob::slotPollFinished()
{
- PollJob *job = qobject_cast<PollJob *>(sender());
+ auto *job = qobject_cast<PollJob *>(sender());
ASSERT(job);
if (job->_item->_status == SyncFileItem::FatalError) {
emit aborted(job->_item->_errorString);
// 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,
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;
void PropagateUploadFileCommon::slotPollFinished()
{
- PollJob *job = qobject_cast<PollJob *>(sender());
+ auto *job = qobject_cast<PollJob *>(sender());
ASSERT(job);
propagator()->_activeJobList.removeOne(this);
// 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,
void PropagateUploadFileNG::slotPutFinished()
{
- PUTFileJob *job = qobject_cast<PUTFileJob *>(sender());
+ auto *job = qobject_cast<PUTFileJob *>(sender());
ASSERT(job);
slotJobDestroyed(job); // remove it from the _jobs list
// 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);
void PropagateUploadFileV1::slotPutFinished()
{
- PUTFileJob *job = qobject_cast<PUTFileJob *>(sender());
+ auto *job = qobject_cast<PUTFileJob *>(sender());
ASSERT(job);
slotJobDestroyed(job); // remove it from the _jobs list
abortNetworkJobs(
abortType,
[this, abortType](AbstractNetworkJob *job) {
- if (PUTFileJob *putJob = qobject_cast<PUTFileJob *>(job)){
+ if (auto *putJob = qobject_cast<PUTFileJob *>(job)){
if (abortType == AbortType::Asynchronous
&& _chunkCount > 0
&& (((_currentChunk + _startChunk) % _chunkCount) == 0)
QVector<SyncJournalDb::PollInfo> 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);
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);
#ifndef ZLIB_FOUND
QSKIP("ZLIB not found.", SkipSingle);
#else
- ComputeChecksum *vali = new ComputeChecksum(this);
+ auto *vali = new ComputeChecksum(this);
_expectedType = "Adler32";
vali->setChecksumType(_expectedType);
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)));
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)));
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);
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 );
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());
});
// For directly editing the remote checksum
- FileInfo &remoteInfo = dynamic_cast<FileInfo &>(fakeFolder.remoteModifier());
+ auto &remoteInfo = dynamic_cast<FileInfo &>(fakeFolder.remoteModifier());
// Base mtime with no ms content (filesystem is seconds only)
auto mtime = QDateTime::currentDateTimeUtc().addDays(-4);