From fb5ff96ed6b817233eb9092b94bb36d1a6766859 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 11 Nov 2018 10:56:22 +0100 Subject: [PATCH] GUI: run clang-tidy modernize-use-nullptr --- src/gui/accountsettings.cpp | 6 ++-- src/gui/accountsettings.h | 2 +- src/gui/accountstate.cpp | 2 +- src/gui/activitylistmodel.h | 2 +- src/gui/activitywidget.h | 4 +-- src/gui/addcertificatedialog.h | 2 +- src/gui/application.cpp | 4 +-- src/gui/authenticationdialog.h | 2 +- src/gui/clientproxy.h | 2 +- .../cloudproviders/cloudprovidermanager.cpp | 2 +- .../cloudproviders/cloudproviderwrapper.cpp | 34 +++++++++---------- src/gui/cloudproviders/cloudproviderwrapper.h | 4 +-- src/gui/connectionvalidator.h | 2 +- src/gui/creds/httpcredentialsgui.cpp | 6 ++-- src/gui/creds/shibboleth/shibbolethuserjob.h | 2 +- src/gui/creds/shibboleth/shibbolethwebview.h | 4 +-- src/gui/creds/shibbolethcredentials.cpp | 6 ++-- src/gui/creds/webflowcredentials.cpp | 2 +- src/gui/creds/webflowcredentialsdialog.h | 2 +- src/gui/elidedlabel.h | 2 +- src/gui/folder.h | 2 +- src/gui/folderman.cpp | 34 +++++++++---------- src/gui/folderman.h | 2 +- src/gui/folderstatusmodel.cpp | 14 ++++---- src/gui/folderstatusmodel.h | 4 +-- src/gui/folderwatcher.h | 2 +- src/gui/folderwatcher_linux.cpp | 2 +- src/gui/folderwizard.cpp | 4 +-- src/gui/folderwizard.h | 2 +- src/gui/generalsettings.cpp | 2 +- src/gui/generalsettings.h | 2 +- src/gui/iconjob.h | 2 +- src/gui/ignorelisteditor.h | 2 +- src/gui/legalnotice.h | 2 +- src/gui/lockwatcher.h | 2 +- src/gui/logbrowser.h | 4 +-- src/gui/main.cpp | 2 +- src/gui/networksettings.h | 2 +- src/gui/owncloudgui.cpp | 14 ++++---- src/gui/owncloudgui.h | 2 +- src/gui/owncloudsetupwizard.cpp | 4 +-- src/gui/owncloudsetupwizard.h | 4 +-- src/gui/proxyauthdialog.h | 2 +- src/gui/proxyauthhandler.cpp | 2 +- src/gui/quotainfo.h | 2 +- src/gui/selectivesyncdialog.cpp | 6 ++-- src/gui/selectivesyncdialog.h | 10 +++--- src/gui/servernotificationhandler.h | 2 +- src/gui/settingsdialog.cpp | 2 +- src/gui/settingsdialog.h | 2 +- src/gui/sharedialog.h | 2 +- src/gui/sharee.cpp | 2 +- src/gui/sharee.h | 2 +- src/gui/sharelinkwidget.h | 2 +- src/gui/sharemanager.h | 4 +-- src/gui/shareusergroupwidget.h | 4 +-- src/gui/socketapi.cpp | 6 ++-- src/gui/socketapi.h | 2 +- src/gui/sslbutton.cpp | 2 +- src/gui/sslbutton.h | 2 +- src/gui/sslerrordialog.cpp | 2 +- src/gui/sslerrordialog.h | 2 +- src/gui/synclogdialog.h | 2 +- src/gui/thumbnailjob.h | 2 +- src/gui/updater/ocupdater.cpp | 6 ++-- src/gui/updater/updater.cpp | 4 +-- src/gui/updater/updater.h | 2 +- src/gui/wizard/owncloudadvancedsetuppage.cpp | 2 +- .../wizard/owncloudconnectionmethoddialog.h | 2 +- src/gui/wizard/owncloudsetuppage.h | 2 +- .../wizard/owncloudshibbolethcredspage.cpp | 2 +- src/gui/wizard/owncloudwizard.cpp | 6 ++-- src/gui/wizard/owncloudwizard.h | 2 +- src/gui/wizard/webview.cpp | 4 +-- src/gui/wizard/webview.h | 2 +- src/gui/wizard/webviewpage.h | 2 +- 76 files changed, 151 insertions(+), 151 deletions(-) diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index a99e8032a..81f441f22 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -265,7 +265,7 @@ void AccountSettings::slotOpenAccountWizard() qFatal("nope"); } #endif - OwncloudSetupWizard::runWizard(qApp, SLOT(slotownCloudWizardDone(int)), 0); + OwncloudSetupWizard::runWizard(qApp, SLOT(slotownCloudWizardDone(int)), nullptr); } void AccountSettings::slotToggleSignInState() @@ -808,7 +808,7 @@ void AccountSettings::slotEnableCurrentFolder() QWidget *parent = this; Qt::WindowFlags flags = Qt::Sheet; #else - QWidget *parent = 0; + QWidget *parent = nullptr; Qt::WindowFlags flags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint; // default flags #endif QMessageBox msgbox(QMessageBox::Question, tr("Sync Running"), @@ -1152,7 +1152,7 @@ void AccountSettings::slotDeleteAccount() } // Else it might access during destruction. This should be better handled by it having a QSharedPointer - _model->setAccountState(0); + _model->setAccountState(nullptr); auto manager = AccountManager::instance(); manager->deleteAccount(_accountState); diff --git a/src/gui/accountsettings.h b/src/gui/accountsettings.h index d122d9089..3aa4a8cc3 100644 --- a/src/gui/accountsettings.h +++ b/src/gui/accountsettings.h @@ -53,7 +53,7 @@ class AccountSettings : public QWidget Q_OBJECT public: - explicit AccountSettings(AccountState *accountState, QWidget *parent = 0); + explicit AccountSettings(AccountState *accountState, QWidget *parent = nullptr); ~AccountSettings(); QSize sizeHint() const Q_DECL_OVERRIDE { return ownCloudGui::settingsDialogSize(); } bool canEncryptOrDecrypt(const FolderStatusModel::SubFolderInfo* folderInfo); diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index 05e7dbb53..ff2f7d000 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -371,7 +371,7 @@ void AccountState::slotCredentialsAsked(AbstractCredentials *credentials) // When new credentials become available we always want to restart the // connection validation, even if it's currently running. _connectionValidator->deleteLater(); - _connectionValidator = 0; + _connectionValidator = nullptr; } checkConnectivity(); diff --git a/src/gui/activitylistmodel.h b/src/gui/activitylistmodel.h index 9f278285d..3cae7a11f 100644 --- a/src/gui/activitylistmodel.h +++ b/src/gui/activitylistmodel.h @@ -38,7 +38,7 @@ class ActivityListModel : public QAbstractListModel { Q_OBJECT public: - explicit ActivityListModel(AccountState *accountState, QWidget *parent = 0); + explicit ActivityListModel(AccountState *accountState, QWidget *parent = nullptr); QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; diff --git a/src/gui/activitywidget.h b/src/gui/activitywidget.h index 11da1ad6c..cfa7b392a 100644 --- a/src/gui/activitywidget.h +++ b/src/gui/activitywidget.h @@ -56,7 +56,7 @@ class ActivityWidget : public QWidget { Q_OBJECT public: - explicit ActivityWidget(AccountState *accountState, QWidget *parent = 0); + explicit ActivityWidget(AccountState *accountState, QWidget *parent = nullptr); ~ActivityWidget(); QSize sizeHint() const Q_DECL_OVERRIDE { return ownCloudGui::settingsDialogSize(); } void storeActivityList(QTextStream &ts); @@ -128,7 +128,7 @@ class ActivitySettings : public QWidget { Q_OBJECT public: - explicit ActivitySettings(AccountState *accountState, QWidget *parent = 0); + explicit ActivitySettings(AccountState *accountState, QWidget *parent = nullptr); ~ActivitySettings(); QSize sizeHint() const Q_DECL_OVERRIDE { return ownCloudGui::settingsDialogSize(); } diff --git a/src/gui/addcertificatedialog.h b/src/gui/addcertificatedialog.h index c9e6826c2..158327b72 100644 --- a/src/gui/addcertificatedialog.h +++ b/src/gui/addcertificatedialog.h @@ -34,7 +34,7 @@ class AddCertificateDialog : public QDialog Q_OBJECT public: - explicit AddCertificateDialog(QWidget *parent = 0); + explicit AddCertificateDialog(QWidget *parent = nullptr); ~AddCertificateDialog(); QString getCertificatePath(); QString getCertificatePasswd(); diff --git a/src/gui/application.cpp b/src/gui/application.cpp index 6bebad314..e6507649d 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -96,7 +96,7 @@ namespace { Application::Application(int &argc, char **argv) : SharedTools::QtSingleApplication(Theme::instance()->appName(), argc, argv) - , _gui(0) + , _gui(nullptr) , _theme(Theme::instance()) , _helpOnly(false) , _versionOnly(false) @@ -186,7 +186,7 @@ Application::Application(int &argc, char **argv) if (!AccountManager::instance()->restore()) { qCCritical(lcApplication) << "Could not read the account settings, quitting"; QMessageBox::critical( - 0, + nullptr, tr("Error accessing the configuration file"), tr("There was an error while accessing the configuration " "file at %1.") diff --git a/src/gui/authenticationdialog.h b/src/gui/authenticationdialog.h index 3983e20a3..3bd2183d7 100644 --- a/src/gui/authenticationdialog.h +++ b/src/gui/authenticationdialog.h @@ -29,7 +29,7 @@ class AuthenticationDialog : public QDialog { Q_OBJECT public: - AuthenticationDialog(const QString &realm, const QString &domain, QWidget *parent = 0); + AuthenticationDialog(const QString &realm, const QString &domain, QWidget *parent = nullptr); QString user() const; QString password() const; diff --git a/src/gui/clientproxy.h b/src/gui/clientproxy.h index 6552d5e0f..813c291c3 100644 --- a/src/gui/clientproxy.h +++ b/src/gui/clientproxy.h @@ -36,7 +36,7 @@ class ClientProxy : public QObject { Q_OBJECT public: - explicit ClientProxy(QObject *parent = 0); + explicit ClientProxy(QObject *parent = nullptr); static bool isUsingSystemDefault(); static void lookupSystemProxyAsync(const QUrl &url, QObject *dst, const char *slot); diff --git a/src/gui/cloudproviders/cloudprovidermanager.cpp b/src/gui/cloudproviders/cloudprovidermanager.cpp index 60d222850..ee3547674 100644 --- a/src/gui/cloudproviders/cloudprovidermanager.cpp +++ b/src/gui/cloudproviders/cloudprovidermanager.cpp @@ -45,7 +45,7 @@ CloudProviderManager::CloudProviderManager(QObject *parent) : QObject(parent) { _map = new QMap(); QString busName = QString(LIBCLOUDPROVIDERS_DBUS_BUS_NAME); - g_bus_own_name (G_BUS_TYPE_SESSION, busName.toAscii().data(), G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, NULL, NULL, this, NULL); + g_bus_own_name (G_BUS_TYPE_SESSION, busName.toAscii().data(), G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, nullptr, nullptr, this, nullptr); } void CloudProviderManager::slotFolderListChanged(const Folder::Map &folderMap) diff --git a/src/gui/cloudproviders/cloudproviderwrapper.cpp b/src/gui/cloudproviders/cloudproviderwrapper.cpp index 73b6039cf..f177f4297 100644 --- a/src/gui/cloudproviders/cloudproviderwrapper.cpp +++ b/src/gui/cloudproviders/cloudproviderwrapper.cpp @@ -31,7 +31,7 @@ extern "C" { using namespace OCC; -GSimpleActionGroup *actionGroup = NULL; +GSimpleActionGroup *actionGroup = nullptr; static gchar* qstring_to_gchar(const QString &string) @@ -55,7 +55,7 @@ CloudProviderWrapper::CloudProviderWrapper(QObject *parent, Folder *folder, Clou gchar* folderName = qstring_to_gchar(folder->shortGuiLocalPath()); gchar* folderPath = qstring_to_gchar(folder->cleanPath()); cloud_providers_account_exporter_set_name (_cloudProviderAccount, folderName); - cloud_providers_account_exporter_set_icon (_cloudProviderAccount, g_icon_new_for_string(APPLICATION_ICON_NAME, NULL)); + cloud_providers_account_exporter_set_icon (_cloudProviderAccount, g_icon_new_for_string(APPLICATION_ICON_NAME, nullptr)); cloud_providers_account_exporter_set_path (_cloudProviderAccount, folderPath); cloud_providers_account_exporter_set_status (_cloudProviderAccount, CLOUD_PROVIDERS_ACCOUNT_STATUS_IDLE); cloud_providers_account_exporter_set_menu_model (_cloudProviderAccount, getMenuModel()); @@ -163,7 +163,7 @@ void CloudProviderWrapper::slotUpdateProgress(const QString &folder, const Progr g_menu_append_item(_recentMenu, item); } } else { - item = g_menu_item_new("No recently changed files", NULL); + item = g_menu_item_new("No recently changed files", nullptr); g_menu_append_item(_recentMenu, item); } } @@ -223,20 +223,20 @@ GMenuModel* CloudProviderWrapper::getMenuModel() { section = g_menu_new(); item = g_menu_item_new("Open website", "cloudprovider.openwebsite"); g_menu_append_item(section, item); - g_menu_append_section(_mainMenu, NULL, G_MENU_MODEL(section)); + g_menu_append_section(_mainMenu, nullptr, G_MENU_MODEL(section)); _recentMenu = g_menu_new(); - item = g_menu_item_new("No recently changed files", NULL); + item = g_menu_item_new("No recently changed files", nullptr); g_menu_append_item(_recentMenu, item); section = g_menu_new(); item = g_menu_item_new_submenu("Recently changed", G_MENU_MODEL(_recentMenu)); g_menu_append_item(section, item); - g_menu_append_section(_mainMenu, NULL, G_MENU_MODEL(section)); + g_menu_append_section(_mainMenu, nullptr, G_MENU_MODEL(section)); section = g_menu_new(); item = g_menu_item_new("Pause synchronization", "cloudprovider.pause"); g_menu_append_item(section, item); - g_menu_append_section(_mainMenu, NULL, G_MENU_MODEL(section)); + g_menu_append_section(_mainMenu, nullptr, G_MENU_MODEL(section)); section = g_menu_new(); item = g_menu_item_new("Help", "cloudprovider.openhelp"); @@ -247,7 +247,7 @@ GMenuModel* CloudProviderWrapper::getMenuModel() { g_menu_append_item(section, item); item = g_menu_item_new("Quit sync client", "cloudprovider.quit"); g_menu_append_item(section, item); - g_menu_append_section(_mainMenu, NULL, G_MENU_MODEL(section)); + g_menu_append_section(_mainMenu, nullptr, G_MENU_MODEL(section)); return G_MENU_MODEL(_mainMenu); } @@ -318,15 +318,15 @@ activate_action_pause (GSimpleAction *action, } static GActionEntry actions[] = { - { "openwebsite", activate_action_open, NULL, NULL, NULL, {0,0,0}}, - { "quit", activate_action_open, NULL, NULL, NULL, {0,0,0}}, - { "logout", activate_action_open, NULL, NULL, NULL, {0,0,0}}, - { "openfolder", activate_action_open, NULL, NULL, NULL, {0,0,0}}, - { "showfile", activate_action_open, "s", NULL, NULL, {0,0,0}}, - { "openhelp", activate_action_open, NULL, NULL, NULL, {0,0,0}}, - { "opensettings", activate_action_open, NULL, NULL, NULL, {0,0,0}}, - { "openrecentfile", activate_action_openrecentfile, "s", NULL, NULL, {0,0,0}}, - { "pause", activate_action_pause, NULL, "false", NULL, {0,0,0}} + { "openwebsite", activate_action_open, nullptr, nullptr, nullptr, {0,0,0}}, + { "quit", activate_action_open, nullptr, nullptr, nullptr, {0,0,0}}, + { "logout", activate_action_open, nullptr, nullptr, nullptr, {0,0,0}}, + { "openfolder", activate_action_open, nullptr, nullptr, nullptr, {0,0,0}}, + { "showfile", activate_action_open, "s", nullptr, nullptr, {0,0,0}}, + { "openhelp", activate_action_open, nullptr, nullptr, nullptr, {0,0,0}}, + { "opensettings", activate_action_open, nullptr, nullptr, nullptr, {0,0,0}}, + { "openrecentfile", activate_action_openrecentfile, "s", nullptr, nullptr, {0,0,0}}, + { "pause", activate_action_pause, nullptr, "false", nullptr, {0,0,0}} }; GActionGroup* CloudProviderWrapper::getActionGroup() diff --git a/src/gui/cloudproviders/cloudproviderwrapper.h b/src/gui/cloudproviders/cloudproviderwrapper.h index de2583013..b1ffc9c9f 100644 --- a/src/gui/cloudproviders/cloudproviderwrapper.h +++ b/src/gui/cloudproviders/cloudproviderwrapper.h @@ -59,8 +59,8 @@ private: CloudProvidersAccountExporter *_cloudProviderAccount; QList> *_recentlyChanged; bool _paused; - GMenu* _mainMenu = NULL; - GMenu* _recentMenu = NULL; + GMenu* _mainMenu = nullptr; + GMenu* _recentMenu = nullptr; }; #endif // CLOUDPROVIDER_H diff --git a/src/gui/connectionvalidator.h b/src/gui/connectionvalidator.h index e65ceb86b..779b6a8a2 100644 --- a/src/gui/connectionvalidator.h +++ b/src/gui/connectionvalidator.h @@ -83,7 +83,7 @@ class ConnectionValidator : public QObject { Q_OBJECT public: - explicit ConnectionValidator(AccountPtr account, QObject *parent = 0); + explicit ConnectionValidator(AccountPtr account, QObject *parent = nullptr); enum Status { Undefined, diff --git a/src/gui/creds/httpcredentialsgui.cpp b/src/gui/creds/httpcredentialsgui.cpp index b896cb0cc..25a057eb8 100644 --- a/src/gui/creds/httpcredentialsgui.cpp +++ b/src/gui/creds/httpcredentialsgui.cpp @@ -75,10 +75,10 @@ void HttpCredentialsGui::asyncAuthResult(OAuth::Result r, const QString &user, case OAuth::NotSupported: // We will re-enter the event loop, so better wait the next iteration QMetaObject::invokeMethod(this, "showDialog", Qt::QueuedConnection); - _asyncAuth.reset(0); + _asyncAuth.reset(nullptr); return; case OAuth::Error: - _asyncAuth.reset(0); + _asyncAuth.reset(nullptr); emit asked(); return; case OAuth::LoggedIn: @@ -91,7 +91,7 @@ void HttpCredentialsGui::asyncAuthResult(OAuth::Result r, const QString &user, _refreshToken = refreshToken; _ready = true; persist(); - _asyncAuth.reset(0); + _asyncAuth.reset(nullptr); emit asked(); } diff --git a/src/gui/creds/shibboleth/shibbolethuserjob.h b/src/gui/creds/shibboleth/shibbolethuserjob.h index 22706b1c1..2cc13b31e 100644 --- a/src/gui/creds/shibboleth/shibbolethuserjob.h +++ b/src/gui/creds/shibboleth/shibbolethuserjob.h @@ -28,7 +28,7 @@ class ShibbolethUserJob : public JsonApiJob { Q_OBJECT public: - explicit ShibbolethUserJob(AccountPtr account, QObject *parent = 0); + explicit ShibbolethUserJob(AccountPtr account, QObject *parent = nullptr); signals: // is always emitted when the job is finished. user is empty in case of error. diff --git a/src/gui/creds/shibboleth/shibbolethwebview.h b/src/gui/creds/shibboleth/shibbolethwebview.h index b2b45c1ab..6c0d5c01f 100644 --- a/src/gui/creds/shibboleth/shibbolethwebview.h +++ b/src/gui/creds/shibboleth/shibbolethwebview.h @@ -37,8 +37,8 @@ class ShibbolethWebView : public QWebView Q_OBJECT public: - ShibbolethWebView(AccountPtr account, QWidget *parent = 0); - ShibbolethWebView(AccountPtr account, ShibbolethCookieJar *jar, QWidget *parent = 0); + ShibbolethWebView(AccountPtr account, QWidget *parent = nullptr); + ShibbolethWebView(AccountPtr account, ShibbolethCookieJar *jar, QWidget *parent = nullptr); ~ShibbolethWebView(); void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; diff --git a/src/gui/creds/shibbolethcredentials.cpp b/src/gui/creds/shibbolethcredentials.cpp index fd5d096cc..a9766f8c6 100644 --- a/src/gui/creds/shibbolethcredentials.cpp +++ b/src/gui/creds/shibbolethcredentials.cpp @@ -54,7 +54,7 @@ ShibbolethCredentials::ShibbolethCredentials() , _url() , _ready(false) , _stillValid(false) - , _browser(0) + , _browser(nullptr) , _keychainMigration(false) { } @@ -62,7 +62,7 @@ ShibbolethCredentials::ShibbolethCredentials() ShibbolethCredentials::ShibbolethCredentials(const QNetworkCookie &cookie) : _ready(true) , _stillValid(true) - , _browser(0) + , _browser(nullptr) , _shibCookie(cookie) , _keychainMigration(false) { @@ -161,7 +161,7 @@ void ShibbolethCredentials::askFromUser() } else if (type == DetermineAuthTypeJob::OAuth) { // Hack: upgrade to oauth auto newCred = new HttpCredentialsGui; - job->setParent(0); + job->setParent(nullptr); job->deleteLater(); auto account = this->_account; auto user = this->_user; diff --git a/src/gui/creds/webflowcredentials.cpp b/src/gui/creds/webflowcredentials.cpp index 53f8b4387..057802529 100644 --- a/src/gui/creds/webflowcredentials.cpp +++ b/src/gui/creds/webflowcredentials.cpp @@ -160,7 +160,7 @@ void WebFlowCredentials::slotAskFromUserCredentialsProvided(const QString &user, _askDialog->close(); delete _askDialog; - _askDialog = NULL; + _askDialog = nullptr; } diff --git a/src/gui/creds/webflowcredentialsdialog.h b/src/gui/creds/webflowcredentialsdialog.h index ede816187..84ed4ea12 100644 --- a/src/gui/creds/webflowcredentialsdialog.h +++ b/src/gui/creds/webflowcredentialsdialog.h @@ -15,7 +15,7 @@ class WebFlowCredentialsDialog : public QDialog { Q_OBJECT public: - WebFlowCredentialsDialog(QWidget *parent = 0); + WebFlowCredentialsDialog(QWidget *parent = nullptr); void setUrl(const QUrl &url); void setInfo(const QString &msg); diff --git a/src/gui/elidedlabel.h b/src/gui/elidedlabel.h index a06100c5e..1101dc16b 100644 --- a/src/gui/elidedlabel.h +++ b/src/gui/elidedlabel.h @@ -24,7 +24,7 @@ class ElidedLabel : public QLabel { Q_OBJECT public: - explicit ElidedLabel(const QString &text, QWidget *parent = 0); + explicit ElidedLabel(const QString &text, QWidget *parent = nullptr); void setText(const QString &text); const QString &text() const { return _text; } diff --git a/src/gui/folder.h b/src/gui/folder.h index aa2fc4edc..05bd62a4e 100644 --- a/src/gui/folder.h +++ b/src/gui/folder.h @@ -99,7 +99,7 @@ class Folder : public QObject Q_OBJECT public: - Folder(const FolderDefinition &definition, AccountState *accountState, QObject *parent = 0L); + Folder(const FolderDefinition &definition, AccountState *accountState, QObject *parent = nullptr); ~Folder(); diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index ffd6d85b6..38b461a3e 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -43,11 +43,11 @@ namespace OCC { Q_LOGGING_CATEGORY(lcFolderMan, "nextcloud.gui.folder.manager", QtInfoMsg) -FolderMan *FolderMan::_instance = 0; +FolderMan *FolderMan::_instance = nullptr; FolderMan::FolderMan(QObject *parent) : QObject(parent) - , _currentSyncFolder(0) + , _currentSyncFolder(nullptr) , _syncEnabled(true) , _lockWatcher(new LockWatcher) , _navigationPaneHelper(this) @@ -90,7 +90,7 @@ FolderMan *FolderMan::instance() FolderMan::~FolderMan() { qDeleteAll(_folderMap); - _instance = 0; + _instance = nullptr; } OCC::Folder::Map FolderMan::map() @@ -137,8 +137,8 @@ int FolderMan::unloadAndDeleteAllFolders() } ASSERT(_folderMap.isEmpty()); - _lastSyncFolder = 0; - _currentSyncFolder = 0; + _lastSyncFolder = nullptr; + _currentSyncFolder = nullptr; _scheduledFolders.clear(); emit folderListChanged(_folderMap); emit scheduleQueueChanged(); @@ -271,7 +271,7 @@ bool FolderMan::ensureJournalGone(const QString &journalDbFile) // remove the old journal file while (QFile::exists(journalDbFile) && !QFile::remove(journalDbFile)) { qCWarning(lcFolderMan) << "Could not remove old db file at" << journalDbFile; - int ret = QMessageBox::warning(0, tr("Could not reset folder state"), + int ret = QMessageBox::warning(nullptr, tr("Could not reset folder state"), tr("An old sync journal '%1' was found, " "but could not be removed. Please make sure " "that no application is currently using it.") @@ -346,7 +346,7 @@ QString FolderMan::unescapeAlias(const QString &alias) // WARNING: Do not remove this code, it is used for predefined/automated deployments (2016) Folder *FolderMan::setupFolderFromOldConfigFile(const QString &file, AccountState *accountState) { - Folder *folder = 0; + Folder *folder = nullptr; qCInfo(lcFolderMan) << " ` -> setting up:" << file; QString escapedAlias(file); @@ -387,7 +387,7 @@ Folder *FolderMan::setupFolderFromOldConfigFile(const QString &file, AccountStat if (backend.isEmpty() || backend != QLatin1String("owncloud")) { qCWarning(lcFolderMan) << "obsolete configuration of type" << backend; - return 0; + return nullptr; } // cut off the leading slash, oCUrl always has a trailing. @@ -397,7 +397,7 @@ Folder *FolderMan::setupFolderFromOldConfigFile(const QString &file, AccountStat if (!accountState) { qCCritical(lcFolderMan) << "can't create folder without an account"; - return 0; + return nullptr; } FolderDefinition folderDefinition; @@ -471,7 +471,7 @@ Folder *FolderMan::folder(const QString &alias) return _folderMap[alias]; } } - return 0; + return nullptr; } void FolderMan::scheduleAllFolders() @@ -575,7 +575,7 @@ void FolderMan::slotRunOneEtagJob() //qCDebug(lcFolderMan) << "No more remote ETag check jobs to schedule."; /* now it might be a good time to check for restarting... */ - if (_currentSyncFolder == NULL && _appRestartRequired) { + if (_currentSyncFolder == nullptr && _appRestartRequired) { restartApplication(); } } else { @@ -633,7 +633,7 @@ void FolderMan::setSyncEnabled(bool enabled) } _syncEnabled = enabled; // force a redraw in case the network connect status changed - emit(folderSyncStateChange(0)); + emit(folderSyncStateChange(nullptr)); } void FolderMan::startScheduledSyncSoon() @@ -698,7 +698,7 @@ void FolderMan::slotStartScheduledFolderSync() } // Find the first folder in the queue that can be synced. - Folder *folder = 0; + Folder *folder = nullptr; while (!_scheduledFolders.isEmpty()) { Folder *g = _scheduledFolders.dequeue(); if (g->canSync()) { @@ -862,7 +862,7 @@ void FolderMan::slotFolderSyncFinished(const SyncResult &) qPrintable(_currentSyncFolder->remoteUrl().toString())); _lastSyncFolder = _currentSyncFolder; - _currentSyncFolder = 0; + _currentSyncFolder = nullptr; startScheduledSyncSoon(); } @@ -874,7 +874,7 @@ Folder *FolderMan::addFolder(AccountState *accountState, const FolderDefinition definition.journalPath = definition.defaultJournalPath(accountState->account()); if (!ensureJournalGone(definition.absoluteJournalPath())) { - return 0; + return nullptr; } auto folder = addFolderInternal(definition, accountState); @@ -947,7 +947,7 @@ Folder *FolderMan::folderForPath(const QString &path) } } - return 0; + return nullptr; } QStringList FolderMan::findFileInLocalFolders(const QString &relPath, const AccountPtr acc) @@ -955,7 +955,7 @@ QStringList FolderMan::findFileInLocalFolders(const QString &relPath, const Acco QStringList re; foreach (Folder *folder, this->map().values()) { - if (acc != 0 && folder->accountState()->account() != acc) { + if (acc != nullptr && folder->accountState()->account() != acc) { continue; } QString path = folder->cleanPath(); diff --git a/src/gui/folderman.h b/src/gui/folderman.h index fdf8a22d2..7ac16c98c 100644 --- a/src/gui/folderman.h +++ b/src/gui/folderman.h @@ -323,7 +323,7 @@ private: bool _appRestartRequired; static FolderMan *_instance; - explicit FolderMan(QObject *parent = 0); + explicit FolderMan(QObject *parent = nullptr); friend class OCC::Application; friend class ::TestFolderMan; }; diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index 15e4a7f8e..563166f34 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -43,7 +43,7 @@ static QString removeTrailingSlash(const QString &s) FolderStatusModel::FolderStatusModel(QObject *parent) : QAbstractItemModel(parent) - , _accountState(0) + , _accountState(nullptr) , _dirty(false) { @@ -106,7 +106,7 @@ void FolderStatusModel::setAccountState(const AccountState *accountState) Qt::ItemFlags FolderStatusModel::flags(const QModelIndex &index) const { if (!_accountState) { - return 0; + return nullptr; } switch (classify(index)) { case AddButton: { @@ -124,7 +124,7 @@ Qt::ItemFlags FolderStatusModel::flags(const QModelIndex &index) const case SubFolder: return Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable; } - return 0; + return nullptr; } QVariant FolderStatusModel::data(const QModelIndex &index, int role) const @@ -387,19 +387,19 @@ FolderStatusModel::ItemType FolderStatusModel::classify(const QModelIndex &index FolderStatusModel::SubFolderInfo *FolderStatusModel::infoForIndex(const QModelIndex &index) const { if (!index.isValid()) - return 0; + return nullptr; if (auto parentInfo = static_cast(index.internalPointer())) { if (parentInfo->hasLabel()) { - return 0; + return nullptr; } if (index.row() >= parentInfo->_subs.size()) { - return 0; + return nullptr; } return &parentInfo->_subs[index.row()]; } else { if (index.row() >= _folders.count()) { // AddButton - return 0; + return nullptr; } return const_cast(&_folders[index.row()]); } diff --git a/src/gui/folderstatusmodel.h b/src/gui/folderstatusmodel.h index 30334d569..7c658dd69 100644 --- a/src/gui/folderstatusmodel.h +++ b/src/gui/folderstatusmodel.h @@ -41,7 +41,7 @@ class FolderStatusModel : public QAbstractItemModel public: enum {FileIdRole = Qt::UserRole+1}; - FolderStatusModel(QObject *parent = 0); + FolderStatusModel(QObject *parent = nullptr); ~FolderStatusModel(); void setAccountState(const AccountState *accountState); @@ -59,7 +59,7 @@ public: struct SubFolderInfo { SubFolderInfo() - : _folder(0) + : _folder(nullptr) , _size(0) , _isExternal(false) , _fetched(false) diff --git a/src/gui/folderwatcher.h b/src/gui/folderwatcher.h index fcae5c837..a6cf006e2 100644 --- a/src/gui/folderwatcher.h +++ b/src/gui/folderwatcher.h @@ -56,7 +56,7 @@ class FolderWatcher : public QObject Q_OBJECT public: // Construct, connect signals, call init() - explicit FolderWatcher(Folder *folder = 0L); + explicit FolderWatcher(Folder *folder = nullptr); virtual ~FolderWatcher(); /** diff --git a/src/gui/folderwatcher_linux.cpp b/src/gui/folderwatcher_linux.cpp index 5f6d580b1..2929a9ff8 100644 --- a/src/gui/folderwatcher_linux.cpp +++ b/src/gui/folderwatcher_linux.cpp @@ -160,7 +160,7 @@ void FolderWatcherPrivate::slotReceivedNotification(int fd) while (i + sizeof(struct inotify_event) < static_cast(len)) { // cast an inotify_event event = (struct inotify_event *)&buffer[i]; - if (event == NULL) { + if (event == nullptr) { qCDebug(lcFolderWatcher) << "NULL event"; i += sizeof(struct inotify_event); continue; diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp index fa4dc613e..324503a4b 100644 --- a/src/gui/folderwizard.cpp +++ b/src/gui/folderwizard.cpp @@ -245,7 +245,7 @@ static QTreeWidgetItem *findFirstChild(QTreeWidgetItem *parent, const QString &t return child; } } - return 0; + return nullptr; } void FolderWizardRemotePath::recursiveInsert(QTreeWidgetItem *parent, QStringList pathTrail, QString path) @@ -534,7 +534,7 @@ void FolderWizardSelectiveSync::cleanupPage() FolderWizard::FolderWizard(AccountPtr account, QWidget *parent) : QWizard(parent) , _folderWizardSourcePage(new FolderWizardLocalPath(account)) - , _folderWizardTargetPage(0) + , _folderWizardTargetPage(nullptr) , _folderWizardSelectiveSyncPage(new FolderWizardSelectiveSync(account)) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); diff --git a/src/gui/folderwizard.h b/src/gui/folderwizard.h index b6f056f56..002f16171 100644 --- a/src/gui/folderwizard.h +++ b/src/gui/folderwizard.h @@ -146,7 +146,7 @@ public: Page_SelectiveSync }; - explicit FolderWizard(AccountPtr account, QWidget *parent = 0); + explicit FolderWizard(AccountPtr account, QWidget *parent = nullptr); ~FolderWizard(); bool eventFilter(QObject *watched, QEvent *event) override; diff --git a/src/gui/generalsettings.cpp b/src/gui/generalsettings.cpp index 28aeb1ee4..b8c10d592 100644 --- a/src/gui/generalsettings.cpp +++ b/src/gui/generalsettings.cpp @@ -131,7 +131,7 @@ void GeneralSettings::slotUpdateInfo() // Note: the sparkle-updater is not an OCUpdater OCUpdater *updater = qobject_cast(Updater::instance()); if (ConfigFile().skipUpdateCheck()) { - updater = 0; // don't show update info if updates are disabled + updater = nullptr; // don't show update info if updates are disabled } if (updater) { diff --git a/src/gui/generalsettings.h b/src/gui/generalsettings.h index b73c2f13c..57ebdbd04 100644 --- a/src/gui/generalsettings.h +++ b/src/gui/generalsettings.h @@ -35,7 +35,7 @@ class GeneralSettings : public QWidget Q_OBJECT public: - explicit GeneralSettings(QWidget *parent = 0); + explicit GeneralSettings(QWidget *parent = nullptr); ~GeneralSettings(); QSize sizeHint() const; diff --git a/src/gui/iconjob.h b/src/gui/iconjob.h index 1ad107890..efbbeb3bd 100644 --- a/src/gui/iconjob.h +++ b/src/gui/iconjob.h @@ -31,7 +31,7 @@ class IconJob : public QObject { Q_OBJECT public: - explicit IconJob(const QUrl &url, QObject *parent = 0); + explicit IconJob(const QUrl &url, QObject *parent = nullptr); signals: void jobFinished(QByteArray iconData); diff --git a/src/gui/ignorelisteditor.h b/src/gui/ignorelisteditor.h index 34b0fcd9a..74137a736 100644 --- a/src/gui/ignorelisteditor.h +++ b/src/gui/ignorelisteditor.h @@ -35,7 +35,7 @@ class IgnoreListEditor : public QDialog Q_OBJECT public: - explicit IgnoreListEditor(QWidget *parent = 0); + explicit IgnoreListEditor(QWidget *parent = nullptr); ~IgnoreListEditor(); bool ignoreHiddenFiles(); diff --git a/src/gui/legalnotice.h b/src/gui/legalnotice.h index ba776a088..38cbdd16f 100644 --- a/src/gui/legalnotice.h +++ b/src/gui/legalnotice.h @@ -34,7 +34,7 @@ class LegalNotice : public QDialog Q_OBJECT public: - explicit LegalNotice(QDialog *parent = 0); + explicit LegalNotice(QDialog *parent = nullptr); ~LegalNotice(); private: diff --git a/src/gui/lockwatcher.h b/src/gui/lockwatcher.h index ba2d8f8a7..13b845e12 100644 --- a/src/gui/lockwatcher.h +++ b/src/gui/lockwatcher.h @@ -42,7 +42,7 @@ class LockWatcher : public QObject { Q_OBJECT public: - explicit LockWatcher(QObject *parent = 0); + explicit LockWatcher(QObject *parent = nullptr); /** Start watching a file. * diff --git a/src/gui/logbrowser.h b/src/gui/logbrowser.h index b7e2d58ac..cd716b123 100644 --- a/src/gui/logbrowser.h +++ b/src/gui/logbrowser.h @@ -37,7 +37,7 @@ class LogWidget : public QPlainTextEdit { Q_OBJECT public: - explicit LogWidget(QWidget *parent = 0); + explicit LogWidget(QWidget *parent = nullptr); signals: }; @@ -50,7 +50,7 @@ class LogBrowser : public QDialog { Q_OBJECT public: - explicit LogBrowser(QWidget *parent = 0); + explicit LogBrowser(QWidget *parent = nullptr); ~LogBrowser(); void setLogFile(const QString &, bool); diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 9125c19c4..351f8f1dc 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -36,7 +36,7 @@ using namespace OCC; void warnSystray() { - QMessageBox::critical(0, qApp->translate("main.cpp", "System Tray not available"), + QMessageBox::critical(nullptr, qApp->translate("main.cpp", "System Tray not available"), qApp->translate("main.cpp", "%1 requires on a working system tray. " "If you are running XFCE, please follow " "these instructions. " diff --git a/src/gui/networksettings.h b/src/gui/networksettings.h index 8d35b14dc..ee07a39d1 100644 --- a/src/gui/networksettings.h +++ b/src/gui/networksettings.h @@ -33,7 +33,7 @@ class NetworkSettings : public QWidget Q_OBJECT public: - explicit NetworkSettings(QWidget *parent = 0); + explicit NetworkSettings(QWidget *parent = nullptr); ~NetworkSettings(); QSize sizeHint() const override; diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index 87bfb5392..4d4dda1f6 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -61,17 +61,17 @@ const char propertyAccountC[] = "oc_account"; ownCloudGui::ownCloudGui(Application *parent) : QObject(parent) - , _tray(0) + , _tray(nullptr) #if defined(Q_OS_MAC) , _settingsDialog(new SettingsDialogMac(this)) #else , _settingsDialog(new SettingsDialog(this)) #endif - , _logBrowser(0) + , _logBrowser(nullptr) #ifdef WITH_LIBCLOUDPROVIDERS , _bus(QDBusConnection::sessionBus()) #endif - , _recentActionsMenu(0) + , _recentActionsMenu(nullptr) , _app(parent) { _tray = new Systray(); @@ -794,7 +794,7 @@ void ownCloudGui::setupActions() _actionCrash = new QAction(tr("Crash now", "Only shows in debug mode to allow testing the crash handler"), this); connect(_actionCrash, &QAction::triggered, _app, &Application::slotCrash); } else { - _actionCrash = 0; + _actionCrash = nullptr; } } @@ -1129,7 +1129,7 @@ void ownCloudGui::slotHelp() void ownCloudGui::raiseDialog(QWidget *raiseWidget) { - if (raiseWidget && raiseWidget->parentWidget() == 0) { + if (raiseWidget && raiseWidget->parentWidget() == nullptr) { // Qt has a bug which causes parent-less dialogs to pop-under. raiseWidget->showNormal(); raiseWidget->raise(); @@ -1199,11 +1199,11 @@ void ownCloudGui::slotShowShareDialog(const QString &sharePath, const QString &l | SharePermissionUpdate | SharePermissionCreate | SharePermissionDelete | SharePermissionShare; if (!resharingAllowed) { - maxSharingPermissions = 0; + maxSharingPermissions = nullptr; } - ShareDialog *w = 0; + ShareDialog *w = nullptr; if (_shareDialogs.contains(localPath) && _shareDialogs[localPath]) { qCInfo(lcApplication) << "Raising share dialog" << sharePath << localPath; w = _shareDialogs[localPath]; diff --git a/src/gui/owncloudgui.h b/src/gui/owncloudgui.h index cf537b288..105235233 100644 --- a/src/gui/owncloudgui.h +++ b/src/gui/owncloudgui.h @@ -53,7 +53,7 @@ class ownCloudGui : public QObject { Q_OBJECT public: - explicit ownCloudGui(Application *parent = 0); + explicit ownCloudGui(Application *parent = nullptr); bool checkAccountExists(bool openSettings); diff --git a/src/gui/owncloudsetupwizard.cpp b/src/gui/owncloudsetupwizard.cpp index 6ddb9583e..2a037ff84 100644 --- a/src/gui/owncloudsetupwizard.cpp +++ b/src/gui/owncloudsetupwizard.cpp @@ -65,7 +65,7 @@ OwncloudSetupWizard::~OwncloudSetupWizard() _ocWizard->deleteLater(); } -static QPointer wiz = 0; +static QPointer wiz = nullptr; void OwncloudSetupWizard::runWizard(QObject *obj, const char *amember, QWidget *parent) { @@ -582,7 +582,7 @@ bool OwncloudSetupWizard::ensureStartFromScratch(const QString &localFolder) renameOk = FolderMan::instance()->startFromScratch(localFolder); if (!renameOk) { QMessageBox::StandardButton but; - but = QMessageBox::question(0, tr("Folder rename failed"), + but = QMessageBox::question(nullptr, tr("Folder rename failed"), tr("Can't remove and back up the folder because the folder or a file in it is open in another program." " Please close the folder or file and hit retry or cancel the setup."), QMessageBox::Retry | QMessageBox::Abort, QMessageBox::Retry); diff --git a/src/gui/owncloudsetupwizard.h b/src/gui/owncloudsetupwizard.h index a663af761..4762de1cd 100644 --- a/src/gui/owncloudsetupwizard.h +++ b/src/gui/owncloudsetupwizard.h @@ -42,7 +42,7 @@ class OwncloudSetupWizard : public QObject Q_OBJECT public: /** Run the wizard */ - static void runWizard(QObject *obj, const char *amember, QWidget *parent = 0); + static void runWizard(QObject *obj, const char *amember, QWidget *parent = nullptr); static bool bringWizardToFrontIfVisible(); signals: // overall dialog close signal. @@ -70,7 +70,7 @@ private slots: void slotSkipFolderConfiguration(); private: - explicit OwncloudSetupWizard(QObject *parent = 0); + explicit OwncloudSetupWizard(QObject *parent = nullptr); ~OwncloudSetupWizard(); void startWizard(); void testOwnCloudConnect(); diff --git a/src/gui/proxyauthdialog.h b/src/gui/proxyauthdialog.h index 5a6e7bd4c..9ce75f691 100644 --- a/src/gui/proxyauthdialog.h +++ b/src/gui/proxyauthdialog.h @@ -33,7 +33,7 @@ class ProxyAuthDialog : public QDialog Q_OBJECT public: - explicit ProxyAuthDialog(QWidget *parent = 0); + explicit ProxyAuthDialog(QWidget *parent = nullptr); ~ProxyAuthDialog(); void setProxyAddress(const QString &address); diff --git a/src/gui/proxyauthhandler.cpp b/src/gui/proxyauthhandler.cpp index 31dfda6e9..8fae8ee34 100644 --- a/src/gui/proxyauthhandler.cpp +++ b/src/gui/proxyauthhandler.cpp @@ -83,7 +83,7 @@ void ProxyAuthHandler::handleProxyAuthenticationRequired( } // Find the responsible QNAM if possible. - QNetworkAccessManager *sending_qnam = 0; + QNetworkAccessManager *sending_qnam = nullptr; QWeakPointer qnam_alive; if (Account *account = qobject_cast(sender())) { // Since we go into an event loop, it's possible for the account's qnam diff --git a/src/gui/quotainfo.h b/src/gui/quotainfo.h index 4fef65a95..27635fd83 100644 --- a/src/gui/quotainfo.h +++ b/src/gui/quotainfo.h @@ -47,7 +47,7 @@ class QuotaInfo : public QObject { Q_OBJECT public: - explicit QuotaInfo(OCC::AccountState *accountState, QObject *parent = 0); + explicit QuotaInfo(OCC::AccountState *accountState, QObject *parent = nullptr); qint64 lastQuotaTotalBytes() const { return _lastQuotaTotalBytes; } qint64 lastQuotaUsedBytes() const { return _lastQuotaUsedBytes; } diff --git a/src/gui/selectivesyncdialog.cpp b/src/gui/selectivesyncdialog.cpp index 7355e51ac..ea1f3618e 100644 --- a/src/gui/selectivesyncdialog.cpp +++ b/src/gui/selectivesyncdialog.cpp @@ -139,7 +139,7 @@ static QTreeWidgetItem *findFirstChild(QTreeWidgetItem *parent, const QString &t return child; } } - return 0; + return nullptr; } void SelectiveSyncWidget::recursiveInsert(QTreeWidgetItem *parent, QStringList pathTrail, QString path, qint64 size) @@ -431,7 +431,7 @@ qint64 SelectiveSyncWidget::estimatedSize(QTreeWidgetItem *root) SelectiveSyncDialog::SelectiveSyncDialog(AccountPtr account, Folder *folder, QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) , _folder(folder) - , _okButton(0) // defined in init() + , _okButton(nullptr) // defined in init() { bool ok; init(account); @@ -448,7 +448,7 @@ SelectiveSyncDialog::SelectiveSyncDialog(AccountPtr account, Folder *folder, QWi SelectiveSyncDialog::SelectiveSyncDialog(AccountPtr account, const QString &folder, const QStringList &blacklist, QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) - , _folder(0) + , _folder(nullptr) { init(account); _selectiveSync->setFolderInfo(folder, folder, blacklist); diff --git a/src/gui/selectivesyncdialog.h b/src/gui/selectivesyncdialog.h index a67f419a7..48aaa4a82 100644 --- a/src/gui/selectivesyncdialog.h +++ b/src/gui/selectivesyncdialog.h @@ -35,10 +35,10 @@ class SelectiveSyncWidget : public QWidget { Q_OBJECT public: - explicit SelectiveSyncWidget(AccountPtr account, QWidget *parent = 0); + explicit SelectiveSyncWidget(AccountPtr account, QWidget *parent = nullptr); /// Returns a list of blacklisted paths, each including the trailing / - QStringList createBlackList(QTreeWidgetItem *root = 0) const; + QStringList createBlackList(QTreeWidgetItem *root = nullptr) const; /** Returns the oldBlackList passed into setFolderInfo(), except that * a "/" entry is expanded to all top-level folder names. @@ -46,7 +46,7 @@ public: QStringList oldBlackList() const; // Estimates the total size of checked items (recursively) - qint64 estimatedSize(QTreeWidgetItem *root = 0); + qint64 estimatedSize(QTreeWidgetItem *root = nullptr); // oldBlackList is a list of excluded paths, each including a trailing / void setFolderInfo(const QString &folderPath, const QString &rootName, @@ -89,10 +89,10 @@ class SelectiveSyncDialog : public QDialog Q_OBJECT public: // Dialog for a specific folder (used from the account settings button) - explicit SelectiveSyncDialog(AccountPtr account, Folder *folder, QWidget *parent = 0, Qt::WindowFlags f = 0); + explicit SelectiveSyncDialog(AccountPtr account, Folder *folder, QWidget *parent = nullptr, Qt::WindowFlags f = nullptr); // Dialog for the whole account (Used from the wizard) - explicit SelectiveSyncDialog(AccountPtr account, const QString &folder, const QStringList &blacklist, QWidget *parent = 0, Qt::WindowFlags f = 0); + explicit SelectiveSyncDialog(AccountPtr account, const QString &folder, const QStringList &blacklist, QWidget *parent = nullptr, Qt::WindowFlags f = nullptr); virtual void accept() Q_DECL_OVERRIDE; diff --git a/src/gui/servernotificationhandler.h b/src/gui/servernotificationhandler.h index 0858dd874..f0276da52 100644 --- a/src/gui/servernotificationhandler.h +++ b/src/gui/servernotificationhandler.h @@ -27,7 +27,7 @@ class ServerNotificationHandler : public QObject { Q_OBJECT public: - explicit ServerNotificationHandler(AccountState *accountState, QObject *parent = 0); + explicit ServerNotificationHandler(AccountState *accountState, QObject *parent = nullptr); static QMap iconCache; signals: diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp index 5adef0a6a..eba7d8f16 100644 --- a/src/gui/settingsdialog.cpp +++ b/src/gui/settingsdialog.cpp @@ -387,7 +387,7 @@ public: auto toolbar = qobject_cast(parent); if (!toolbar) { // this means we are in the extention menu, no special action here - return 0; + return nullptr; } QToolButton *btn = new QToolButton(parent); diff --git a/src/gui/settingsdialog.h b/src/gui/settingsdialog.h index 2ba448f27..aab03e027 100644 --- a/src/gui/settingsdialog.h +++ b/src/gui/settingsdialog.h @@ -48,7 +48,7 @@ class SettingsDialog : public QDialog Q_OBJECT public: - explicit SettingsDialog(ownCloudGui *gui, QWidget *parent = 0); + explicit SettingsDialog(ownCloudGui *gui, QWidget *parent = nullptr); ~SettingsDialog(); void addAccount(const QString &title, QWidget *widget); diff --git a/src/gui/sharedialog.h b/src/gui/sharedialog.h index 474ba51d9..61dea8370 100644 --- a/src/gui/sharedialog.h +++ b/src/gui/sharedialog.h @@ -46,7 +46,7 @@ public: SharePermissions maxSharingPermissions, const QByteArray &numericFileId, ShareDialogStartPage startPage, - QWidget *parent = 0); + QWidget *parent = nullptr); ~ShareDialog(); private slots: diff --git a/src/gui/sharee.cpp b/src/gui/sharee.cpp index f35a818e6..b5fc11d3e 100644 --- a/src/gui/sharee.cpp +++ b/src/gui/sharee.cpp @@ -231,7 +231,7 @@ QVariant ShareeModel::data(const QModelIndex &index, int role) const QSharedPointer ShareeModel::getSharee(int at) { if (at < 0 || at > _sharees.size()) { - return QSharedPointer(NULL); + return QSharedPointer(nullptr); } return _sharees.at(at); diff --git a/src/gui/sharee.h b/src/gui/sharee.h index ec053d2a9..ffdddd8af 100644 --- a/src/gui/sharee.h +++ b/src/gui/sharee.h @@ -63,7 +63,7 @@ class ShareeModel : public QAbstractListModel { Q_OBJECT public: - explicit ShareeModel(const AccountPtr &account, const QString &type, QObject *parent = 0); + explicit ShareeModel(const AccountPtr &account, const QString &type, QObject *parent = nullptr); typedef QVector> ShareeSet; // FIXME: make it a QSet when Sharee can be compared void fetch(const QString &search, const ShareeSet &blacklist); diff --git a/src/gui/sharelinkwidget.h b/src/gui/sharelinkwidget.h index b073fa0f1..6f860c4aa 100644 --- a/src/gui/sharelinkwidget.h +++ b/src/gui/sharelinkwidget.h @@ -52,7 +52,7 @@ public: const QString &sharePath, const QString &localPath, SharePermissions maxSharingPermissions, - QWidget *parent = 0); + QWidget *parent = nullptr); ~ShareLinkWidget(); void getShares(); void toggleButton(bool show); diff --git a/src/gui/sharemanager.h b/src/gui/sharemanager.h index 2a08babe3..18d060bae 100644 --- a/src/gui/sharemanager.h +++ b/src/gui/sharemanager.h @@ -57,7 +57,7 @@ public: const QString &path, const ShareType shareType, const Permissions permissions = SharePermissionDefault, - const QSharedPointer shareWith = QSharedPointer(NULL)); + const QSharedPointer shareWith = QSharedPointer(nullptr)); /** * The account the share is defined on. @@ -234,7 +234,7 @@ class ShareManager : public QObject { Q_OBJECT public: - explicit ShareManager(AccountPtr _account, QObject *parent = NULL); + explicit ShareManager(AccountPtr _account, QObject *parent = nullptr); /** * Tell the manager to create a link share diff --git a/src/gui/shareusergroupwidget.h b/src/gui/shareusergroupwidget.h index 3d4f94792..be1e3c111 100644 --- a/src/gui/shareusergroupwidget.h +++ b/src/gui/shareusergroupwidget.h @@ -59,7 +59,7 @@ public: const QString &localPath, SharePermissions maxSharingPermissions, const QString &privateLinkUrl, - QWidget *parent = 0); + QWidget *parent = nullptr); ~ShareUserGroupWidget(); signals: @@ -118,7 +118,7 @@ public: explicit ShareUserLine(QSharedPointer Share, SharePermissions maxSharingPermissions, bool isFile, - QWidget *parent = 0); + QWidget *parent = nullptr); ~ShareUserLine(); QSharedPointer share() const; diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index 8f9e511d1..1c6ceefba 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -121,7 +121,7 @@ class SocketListener public: QIODevice *socket; - SocketListener(QIODevice *socket = 0) + SocketListener(QIODevice *socket = nullptr) : socket(socket) { } @@ -516,7 +516,7 @@ private slots: { qCWarning(lcPublicLink) << "Share fetch/create error" << code << message; QMessageBox::warning( - 0, + nullptr, tr("Sharing error"), tr("Could not retrieve or create the public link share. Error:\n\n%1").arg(message), QMessageBox::Ok, @@ -611,7 +611,7 @@ void SocketApi::emailPrivateLink(const QString &link) Utility::openEmailComposer( tr("I shared something with you"), link, - 0); + nullptr); } void OCC::SocketApi::openPrivateLink(const QString &link) diff --git a/src/gui/socketapi.h b/src/gui/socketapi.h index f39e4dcc8..e94ed5116 100644 --- a/src/gui/socketapi.h +++ b/src/gui/socketapi.h @@ -47,7 +47,7 @@ class SocketApi : public QObject Q_OBJECT public: - explicit SocketApi(QObject *parent = 0); + explicit SocketApi(QObject *parent = nullptr); virtual ~SocketApi(); public slots: diff --git a/src/gui/sslbutton.cpp b/src/gui/sslbutton.cpp index 6abd4a755..ffa0228a8 100644 --- a/src/gui/sslbutton.cpp +++ b/src/gui/sslbutton.cpp @@ -175,7 +175,7 @@ void SslButton::updateAccountState(AccountState *accountState) } else { setIcon(QIcon(QLatin1String(":/client/resources/lock-http.png"))); setToolTip(tr("This connection is NOT secure as it is not encrypted.\n")); - setMenu(0); + setMenu(nullptr); } } diff --git a/src/gui/sslbutton.h b/src/gui/sslbutton.h index 906f4b846..30fd23f04 100644 --- a/src/gui/sslbutton.h +++ b/src/gui/sslbutton.h @@ -35,7 +35,7 @@ class SslButton : public QToolButton { Q_OBJECT public: - explicit SslButton(QWidget *parent = 0); + explicit SslButton(QWidget *parent = nullptr); void updateAccountState(AccountState *accountState); public slots: diff --git a/src/gui/sslerrordialog.cpp b/src/gui/sslerrordialog.cpp index b75fd425c..8b6350efa 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(0); + QTextDocument *doc = new QTextDocument(nullptr); QString style = styleSheet(); doc->addResource(QTextDocument::StyleSheetResource, QUrl(QL("format.css")), style); doc->setHtml(msg); diff --git a/src/gui/sslerrordialog.h b/src/gui/sslerrordialog.h index d0bb40310..ee475b593 100644 --- a/src/gui/sslerrordialog.h +++ b/src/gui/sslerrordialog.h @@ -48,7 +48,7 @@ class SslErrorDialog : public QDialog { Q_OBJECT public: - explicit SslErrorDialog(AccountPtr account, QWidget *parent = 0); + explicit SslErrorDialog(AccountPtr account, QWidget *parent = nullptr); ~SslErrorDialog(); bool checkFailingCertsKnown(const QList &errors); bool trustConnection(); diff --git a/src/gui/synclogdialog.h b/src/gui/synclogdialog.h index 1a224728d..20825369e 100644 --- a/src/gui/synclogdialog.h +++ b/src/gui/synclogdialog.h @@ -35,7 +35,7 @@ class SyncLogDialog : public QDialog Q_OBJECT public: - explicit SyncLogDialog(QWidget *parent = 0); + explicit SyncLogDialog(QWidget *parent = nullptr); ~SyncLogDialog(); private slots: diff --git a/src/gui/thumbnailjob.h b/src/gui/thumbnailjob.h index 37c9ba922..ddb79ab19 100644 --- a/src/gui/thumbnailjob.h +++ b/src/gui/thumbnailjob.h @@ -31,7 +31,7 @@ class ThumbnailJob : public AbstractNetworkJob { Q_OBJECT public: - explicit ThumbnailJob(const QString &path, AccountPtr account, QObject *parent = 0); + explicit ThumbnailJob(const QString &path, AccountPtr account, QObject *parent = nullptr); public slots: void start() Q_DECL_OVERRIDE; signals: diff --git a/src/gui/updater/ocupdater.cpp b/src/gui/updater/ocupdater.cpp index e419bcbc1..c9df44a7c 100644 --- a/src/gui/updater/ocupdater.cpp +++ b/src/gui/updater/ocupdater.cpp @@ -100,7 +100,7 @@ bool OCUpdater::performUpdate() if (!updateFile.isEmpty() && QFile(updateFile).exists() && !updateSucceeded() /* Someone might have run the updater manually between restarts */) { const QString name = Theme::instance()->appNameGUI(); - if (QMessageBox::information(0, tr("New %1 Update Ready").arg(name), + if (QMessageBox::information(nullptr, tr("New %1 Update Ready").arg(name), tr("A new update for %1 is about to be installed. The updater may ask\n" "for additional privileges during the process.") .arg(name), @@ -320,8 +320,8 @@ void NSISUpdater::showDialog(const UpdateInfo &info) QDialog *msgBox = new QDialog; msgBox->setAttribute(Qt::WA_DeleteOnClose); - QIcon infoIcon = msgBox->style()->standardIcon(QStyle::SP_MessageBoxInformation, 0, 0); - int iconSize = msgBox->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, 0); + QIcon infoIcon = msgBox->style()->standardIcon(QStyle::SP_MessageBoxInformation, nullptr, nullptr); + int iconSize = msgBox->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, nullptr, nullptr); msgBox->setWindowIcon(infoIcon); diff --git a/src/gui/updater/updater.cpp b/src/gui/updater/updater.cpp index 233810df9..3a247d6b2 100644 --- a/src/gui/updater/updater.cpp +++ b/src/gui/updater/updater.cpp @@ -30,7 +30,7 @@ namespace OCC { Q_LOGGING_CATEGORY(lcUpdater, "nextcloud.gui.updater", QtInfoMsg) -Updater *Updater::_instance = 0; +Updater *Updater::_instance = nullptr; Updater *Updater::instance() { @@ -105,7 +105,7 @@ Updater *Updater::create() } if (!updateBaseUrl.isValid() || updateBaseUrl.host() == ".") { qCWarning(lcUpdater) << "Not a valid updater URL, will not do update check"; - return 0; + return nullptr; } auto urlQuery = getQueryParams(); diff --git a/src/gui/updater/updater.h b/src/gui/updater/updater.h index 04d18ac85..d74434001 100644 --- a/src/gui/updater/updater.h +++ b/src/gui/updater/updater.h @@ -45,7 +45,7 @@ public: protected: static QString clientVersion(); Updater() - : QObject(0) + : QObject(nullptr) { } diff --git a/src/gui/wizard/owncloudadvancedsetuppage.cpp b/src/gui/wizard/owncloudadvancedsetuppage.cpp index 9257918dd..981f7efae 100644 --- a/src/gui/wizard/owncloudadvancedsetuppage.cpp +++ b/src/gui/wizard/owncloudadvancedsetuppage.cpp @@ -282,7 +282,7 @@ void OwncloudAdvancedSetupPage::setRemoteFolder(const QString &remoteFolder) void OwncloudAdvancedSetupPage::slotSelectFolder() { - QString dir = QFileDialog::getExistingDirectory(0, tr("Local Sync Folder"), QDir::homePath()); + QString dir = QFileDialog::getExistingDirectory(nullptr, tr("Local Sync Folder"), QDir::homePath()); if (!dir.isEmpty()) { _ui.pbSelectLocalFolder->setText(dir); wizard()->setProperty("localFolder", dir); diff --git a/src/gui/wizard/owncloudconnectionmethoddialog.h b/src/gui/wizard/owncloudconnectionmethoddialog.h index c3e3412c1..9ccccc3f3 100644 --- a/src/gui/wizard/owncloudconnectionmethoddialog.h +++ b/src/gui/wizard/owncloudconnectionmethoddialog.h @@ -35,7 +35,7 @@ class OwncloudConnectionMethodDialog : public QDialog Q_OBJECT public: - explicit OwncloudConnectionMethodDialog(QWidget *parent = 0); + explicit OwncloudConnectionMethodDialog(QWidget *parent = nullptr); ~OwncloudConnectionMethodDialog(); enum { Closed = 0, diff --git a/src/gui/wizard/owncloudsetuppage.h b/src/gui/wizard/owncloudsetuppage.h index b8893d271..b250e035c 100644 --- a/src/gui/wizard/owncloudsetuppage.h +++ b/src/gui/wizard/owncloudsetuppage.h @@ -42,7 +42,7 @@ class OwncloudSetupPage : public QWizardPage { Q_OBJECT public: - OwncloudSetupPage(QWidget *parent = 0); + OwncloudSetupPage(QWidget *parent = nullptr); ~OwncloudSetupPage(); virtual bool isComplete() const Q_DECL_OVERRIDE; diff --git a/src/gui/wizard/owncloudshibbolethcredspage.cpp b/src/gui/wizard/owncloudshibbolethcredspage.cpp index 1467ea549..4e598d2c7 100644 --- a/src/gui/wizard/owncloudshibbolethcredspage.cpp +++ b/src/gui/wizard/owncloudshibbolethcredspage.cpp @@ -27,7 +27,7 @@ namespace OCC { OwncloudShibbolethCredsPage::OwncloudShibbolethCredsPage() : AbstractCredentialsWizardPage() - , _browser(0) + , _browser(nullptr) , _afterInitialSetup(false) { } diff --git a/src/gui/wizard/owncloudwizard.cpp b/src/gui/wizard/owncloudwizard.cpp index a9894b898..357b4e005 100644 --- a/src/gui/wizard/owncloudwizard.cpp +++ b/src/gui/wizard/owncloudwizard.cpp @@ -41,7 +41,7 @@ Q_LOGGING_CATEGORY(lcWizard, "nextcloud.gui.wizard", QtInfoMsg) OwncloudWizard::OwncloudWizard(QWidget *parent) : QWizard(parent) - , _account(0) + , _account(nullptr) , _setupPage(new OwncloudSetupPage(this)) , _httpCredsPage(new OwncloudHttpCredsPage(this)) , _browserCredsPage(new OwncloudOAuthCredsPage) @@ -50,7 +50,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) #endif , _advancedSetupPage(new OwncloudAdvancedSetupPage) , _resultPage(new OwncloudWizardResultPage) - , _credentialsPage(0) + , _credentialsPage(nullptr) , _webViewPage(new WebViewPage(this)) , _setupLog() , _registration(false) @@ -262,7 +262,7 @@ AbstractCredentials *OwncloudWizard::getCredentials() const return _credentialsPage->getCredentials(); } - return 0; + return nullptr; } } // end namespace diff --git a/src/gui/wizard/owncloudwizard.h b/src/gui/wizard/owncloudwizard.h index c2ff9ad60..1429709f1 100644 --- a/src/gui/wizard/owncloudwizard.h +++ b/src/gui/wizard/owncloudwizard.h @@ -54,7 +54,7 @@ public: LogParagraph }; - OwncloudWizard(QWidget *parent = 0); + OwncloudWizard(QWidget *parent = nullptr); void setAccount(AccountPtr account); AccountPtr account() const; diff --git a/src/gui/wizard/webview.cpp b/src/gui/wizard/webview.cpp index e73e390f7..5bf1b8008 100644 --- a/src/gui/wizard/webview.cpp +++ b/src/gui/wizard/webview.cpp @@ -22,7 +22,7 @@ class WebViewPageUrlRequestInterceptor : public QWebEngineUrlRequestInterceptor { Q_OBJECT public: - WebViewPageUrlRequestInterceptor(QObject *parent = 0); + WebViewPageUrlRequestInterceptor(QObject *parent = nullptr); void interceptRequest(QWebEngineUrlRequestInfo &info); }; @@ -30,7 +30,7 @@ class WebViewPageUrlSchemeHandler : public QWebEngineUrlSchemeHandler { Q_OBJECT public: - WebViewPageUrlSchemeHandler(QObject *parent = 0); + WebViewPageUrlSchemeHandler(QObject *parent = nullptr); void requestStarted(QWebEngineUrlRequestJob *request); Q_SIGNALS: diff --git a/src/gui/wizard/webview.h b/src/gui/wizard/webview.h index 1146cd845..e0b93ec84 100644 --- a/src/gui/wizard/webview.h +++ b/src/gui/wizard/webview.h @@ -20,7 +20,7 @@ class WebView : public QWidget { Q_OBJECT public: - WebView(QWidget *parent = 0); + WebView(QWidget *parent = nullptr); void setUrl(const QUrl &url); signals: diff --git a/src/gui/wizard/webviewpage.h b/src/gui/wizard/webviewpage.h index 8cdbcf3f6..44e21e8c5 100644 --- a/src/gui/wizard/webviewpage.h +++ b/src/gui/wizard/webviewpage.h @@ -13,7 +13,7 @@ class WebViewPage : public AbstractCredentialsWizardPage { Q_OBJECT public: - WebViewPage(QWidget *parent = 0); + WebViewPage(QWidget *parent = nullptr); void initializePage() Q_DECL_OVERRIDE; int nextId() const Q_DECL_OVERRIDE;