GUI: run clang-tidy modernize-use-nullptr

This commit is contained in:
J-P Nurmi 2018-11-11 10:56:22 +01:00
parent 371001c9ff
commit fb5ff96ed6
76 changed files with 151 additions and 151 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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();

View file

@ -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;

View file

@ -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(); }

View file

@ -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();

View file

@ -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.")

View file

@ -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;

View file

@ -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);

View file

@ -45,7 +45,7 @@ CloudProviderManager::CloudProviderManager(QObject *parent) : QObject(parent)
{
_map = new QMap<QString, CloudProviderWrapper*>();
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)

View file

@ -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()

View file

@ -59,8 +59,8 @@ private:
CloudProvidersAccountExporter *_cloudProviderAccount;
QList<QPair<QString, QString>> *_recentlyChanged;
bool _paused;
GMenu* _mainMenu = NULL;
GMenu* _recentMenu = NULL;
GMenu* _mainMenu = nullptr;
GMenu* _recentMenu = nullptr;
};
#endif // CLOUDPROVIDER_H

View file

@ -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,

View file

@ -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();
}

View file

@ -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.

View file

@ -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;

View file

@ -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;

View file

@ -160,7 +160,7 @@ void WebFlowCredentials::slotAskFromUserCredentialsProvided(const QString &user,
_askDialog->close();
delete _askDialog;
_askDialog = NULL;
_askDialog = nullptr;
}

View file

@ -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);

View file

@ -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; }

View file

@ -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();

View file

@ -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();

View file

@ -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;
};

View file

@ -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<SubFolderInfo *>(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<SubFolderInfo *>(&_folders[index.row()]);
}

View file

@ -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)

View file

@ -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();
/**

View file

@ -160,7 +160,7 @@ void FolderWatcherPrivate::slotReceivedNotification(int fd)
while (i + sizeof(struct inotify_event) < static_cast<unsigned int>(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;

View file

@ -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);

View file

@ -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;

View file

@ -131,7 +131,7 @@ void GeneralSettings::slotUpdateInfo()
// Note: the sparkle-updater is not an OCUpdater
OCUpdater *updater = qobject_cast<OCUpdater *>(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) {

View file

@ -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;

View file

@ -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);

View file

@ -35,7 +35,7 @@ class IgnoreListEditor : public QDialog
Q_OBJECT
public:
explicit IgnoreListEditor(QWidget *parent = 0);
explicit IgnoreListEditor(QWidget *parent = nullptr);
~IgnoreListEditor();
bool ignoreHiddenFiles();

View file

@ -34,7 +34,7 @@ class LegalNotice : public QDialog
Q_OBJECT
public:
explicit LegalNotice(QDialog *parent = 0);
explicit LegalNotice(QDialog *parent = nullptr);
~LegalNotice();
private:

View file

@ -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.
*

View file

@ -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);

View file

@ -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 "
"<a href=\"http://docs.xfce.org/xfce/xfce4-panel/systray\">these instructions</a>. "

View file

@ -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;

View file

@ -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];

View file

@ -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);

View file

@ -65,7 +65,7 @@ OwncloudSetupWizard::~OwncloudSetupWizard()
_ocWizard->deleteLater();
}
static QPointer<OwncloudSetupWizard> wiz = 0;
static QPointer<OwncloudSetupWizard> 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);

View file

@ -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();

View file

@ -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);

View file

@ -83,7 +83,7 @@ void ProxyAuthHandler::handleProxyAuthenticationRequired(
}
// Find the responsible QNAM if possible.
QNetworkAccessManager *sending_qnam = 0;
QNetworkAccessManager *sending_qnam = nullptr;
QWeakPointer<QNetworkAccessManager> qnam_alive;
if (Account *account = qobject_cast<Account *>(sender())) {
// Since we go into an event loop, it's possible for the account's qnam

View file

@ -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; }

View file

@ -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);

View file

@ -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;

View file

@ -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<int, QIcon> iconCache;
signals:

View file

@ -387,7 +387,7 @@ public:
auto toolbar = qobject_cast<QToolBar *>(parent);
if (!toolbar) {
// this means we are in the extention menu, no special action here
return 0;
return nullptr;
}
QToolButton *btn = new QToolButton(parent);

View file

@ -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);

View file

@ -46,7 +46,7 @@ public:
SharePermissions maxSharingPermissions,
const QByteArray &numericFileId,
ShareDialogStartPage startPage,
QWidget *parent = 0);
QWidget *parent = nullptr);
~ShareDialog();
private slots:

View file

@ -231,7 +231,7 @@ QVariant ShareeModel::data(const QModelIndex &index, int role) const
QSharedPointer<Sharee> ShareeModel::getSharee(int at)
{
if (at < 0 || at > _sharees.size()) {
return QSharedPointer<Sharee>(NULL);
return QSharedPointer<Sharee>(nullptr);
}
return _sharees.at(at);

View file

@ -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<QSharedPointer<Sharee>> ShareeSet; // FIXME: make it a QSet<Sharee> when Sharee can be compared
void fetch(const QString &search, const ShareeSet &blacklist);

View file

@ -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);

View file

@ -57,7 +57,7 @@ public:
const QString &path,
const ShareType shareType,
const Permissions permissions = SharePermissionDefault,
const QSharedPointer<Sharee> shareWith = QSharedPointer<Sharee>(NULL));
const QSharedPointer<Sharee> shareWith = QSharedPointer<Sharee>(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

View file

@ -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> Share,
SharePermissions maxSharingPermissions,
bool isFile,
QWidget *parent = 0);
QWidget *parent = nullptr);
~ShareUserLine();
QSharedPointer<Share> share() const;

View file

@ -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)

View file

@ -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:

View file

@ -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);
}
}

View file

@ -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:

View file

@ -148,7 +148,7 @@ bool SslErrorDialog::checkFailingCertsKnown(const QList<QSslError> &errors)
}
msg += QL("</div></body></html>");
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);

View file

@ -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<QSslError> &errors);
bool trustConnection();

View file

@ -35,7 +35,7 @@ class SyncLogDialog : public QDialog
Q_OBJECT
public:
explicit SyncLogDialog(QWidget *parent = 0);
explicit SyncLogDialog(QWidget *parent = nullptr);
~SyncLogDialog();
private slots:

View file

@ -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:

View file

@ -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);

View file

@ -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();

View file

@ -45,7 +45,7 @@ public:
protected:
static QString clientVersion();
Updater()
: QObject(0)
: QObject(nullptr)
{
}

View file

@ -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);

View file

@ -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,

View file

@ -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;

View file

@ -27,7 +27,7 @@ namespace OCC {
OwncloudShibbolethCredsPage::OwncloudShibbolethCredsPage()
: AbstractCredentialsWizardPage()
, _browser(0)
, _browser(nullptr)
, _afterInitialSetup(false)
{
}

View file

@ -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

View file

@ -54,7 +54,7 @@ public:
LogParagraph
};
OwncloudWizard(QWidget *parent = 0);
OwncloudWizard(QWidget *parent = nullptr);
void setAccount(AccountPtr account);
AccountPtr account() const;

View file

@ -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:

View file

@ -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:

View file

@ -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;