, tokenBegin(end)
, tokenEnd(begin)
, delimiters(_delims)
- , isDelim(false)
- , returnDelimiters(false)
- , returnQuotes(false)
{
}
const_iterator tokenEnd;
T delimiters;
T quotes;
- bool isDelim;
- bool returnDelimiters;
- bool returnQuotes;
+ bool isDelim = false;
+ bool returnDelimiters = false;
+ bool returnQuotes = false;
};
template <class T, class const_iterator = typename T::const_iterator>
}
QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char **argv)
- : QApplication(argc, argv),
- firstPeer(-1),
- pidPeer(nullptr)
+ : QApplication(argc, argv)
{
this->appId = appId;
private:
QString instancesFileName(const QString &appId);
- qint64 firstPeer;
+ qint64 firstPeer = -1;
QSharedMemory *instances;
- QtLocalPeer *pidPeer;
+ QtLocalPeer *pidPeer = nullptr;
QWidget *actWin;
QString appId;
bool block;
SyncJournalDb::SyncJournalDb(const QString &dbFilePath, QObject *parent)
: QObject(parent)
, _dbFile(dbFilePath)
- , _transaction(0)
- , _metadataTableIsEmpty(false)
{
// Allow forcing the journal mode for debugging
static QByteArray envJournalMode = qgetenv("OWNCLOUD_SQLITE_JOURNAL_MODE");
QString _dbFile;
QRecursiveMutex _mutex; // Public functions are protected with the mutex.
QMap<QByteArray, int> _checksymTypeCache;
- int _transaction;
- bool _metadataTableIsEmpty;
+ int _transaction = 0;
+ bool _metadataTableIsEmpty = false;
/* Storing etags to these folders, or their parent folders, is filtered out.
*
AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
: QWidget(parent)
, _ui(new Ui::AccountSettings)
- , _wasDisabledBefore(false)
, _accountState(accountState)
, _userInfo(accountState, false, true)
- , _menuShown(false)
{
_ui->setupUi(this);
FolderStatusModel *_model;
QUrl _OCUrl;
- bool _wasDisabledBefore;
+ bool _wasDisabledBefore = false;
AccountState *_accountState;
UserInfo _userInfo;
QAction *_toggleSignInOutAction = nullptr;
QAction *_addAccountAction = nullptr;
- bool _menuShown;
+ bool _menuShown = false;
QHash<QString, QMetaObject::Connection> _folderConnections;
};
, _account(account)
, _state(AccountState::Disconnected)
, _connectionStatus(ConnectionValidator::Undefined)
- , _waitingForNewCredentials(false)
, _maintenanceToConnectedDelay(60000 + (qrand() % (4 * 60000))) // 1-5min delay
, _remoteWipe(new RemoteWipe(_account))
, _isDesktopNotificationsAllowed(true)
: SharedTools::QtSingleApplication(Theme::instance()->appName(), argc, argv)
, _gui(nullptr)
, _theme(Theme::instance())
- , _helpOnly(false)
- , _versionOnly(false)
- , _showLogWindow(false)
- , _logExpire(0)
- , _logFlush(false)
- , _logDebug(true)
- , _userTriggeredConnect(false)
- , _debugMode(false)
- , _backgroundMode(false)
{
_startedAt.start();
Theme *_theme;
- bool _helpOnly;
- bool _versionOnly;
+ bool _helpOnly = false;
+ bool _versionOnly = false;
QElapsedTimer _startedAt;
// options from command line:
- bool _showLogWindow;
+ bool _showLogWindow = false;
bool _quitInstance = false;
QString _logFile;
QString _logDir;
- int _logExpire;
- bool _logFlush;
- bool _logDebug;
- bool _userTriggeredConnect;
- bool _debugMode;
- bool _backgroundMode;
+ int _logExpire = 0;
+ bool _logFlush = false;
+ bool _logDebug = true;
+ bool _userTriggeredConnect = false;
+ bool _debugMode = false;
+ bool _backgroundMode = false;
QUrl _editFileLocallyUrl;
ClientProxy _proxy;
: QObject(parent)
, _accountState(accountState)
, _account(accountState->account())
- , _isCheckingServerAndAuth(false)
{
}
QStringList _errors;
AccountStatePtr _accountState;
AccountPtr _account;
- bool _isCheckingServerAndAuth;
+ bool _isCheckingServerAndAuth = false;
};
}
Flow2Auth::Flow2Auth(Account *account, QObject *parent)
: QObject(parent)
, _account(account)
- , _isBusy(false)
- , _hasToken(false)
{
_pollTimer.setInterval(1000);
QObject::connect(&_pollTimer, &QTimer::timeout, this, &Flow2Auth::slotPollTimerTimeout);
QTimer _pollTimer;
qint64 _secondsLeft = 0LL;
qint64 _secondsInterval = 0LL;
- bool _isBusy;
- bool _hasToken;
+ bool _isBusy = false;
+ bool _hasToken = false;
bool _enforceHttps = false;
};
WebFlowCredentialsDialog::WebFlowCredentialsDialog(Account *account, bool useFlow2, QWidget *parent)
: QDialog(parent)
, _useFlow2(useFlow2)
- , _flow2AuthWidget(nullptr)
-#ifdef WITH_WEBENGINE
- , _webView(nullptr)
-#endif // WITH_WEBENGINE
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
bool _useFlow2;
- Flow2AuthWidget *_flow2AuthWidget;
+ Flow2AuthWidget *_flow2AuthWidget = nullptr;
#ifdef WITH_WEBENGINE
- WebView *_webView;
+ WebView *_webView = nullptr;
#endif // WITH_WEBENGINE
QLabel *_errorLabel;
, _accountState(accountState)
, _definition(definition)
, _lastSyncDuration(0)
- , _consecutiveFailingSyncs(0)
- , _consecutiveFollowUpSyncs(0)
, _journal(_definition.absoluteJournalPath())
, _fileLog(new SyncRunFileLog)
, _vfs(vfs.release())
/// The number of syncs that failed in a row.
/// Reset when a sync is successful.
- int _consecutiveFailingSyncs;
+ int _consecutiveFailingSyncs = 0;
/// The number of requested follow-up syncs.
/// Reset when no follow-up is requested.
- int _consecutiveFollowUpSyncs;
+ int _consecutiveFollowUpSyncs = 0;
mutable SyncJournalDb _journal;
// =================================================================================
FolderWizardRemotePath::FolderWizardRemotePath(const AccountPtr &account)
: FormatWarningsWizardPage()
- , _warnWasVisible(false)
, _account(account)
-
{
_ui.setupUi(this);
_ui.warnFrame->hide();
FolderWizard::FolderWizard(AccountPtr account, QWidget *parent)
: QWizard(parent)
, _folderWizardSourcePage(new FolderWizardLocalPath(account))
- , _folderWizardTargetPage(nullptr)
, _folderWizardSelectiveSyncPage(new FolderWizardSelectiveSync(account))
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
void recursiveInsert(QTreeWidgetItem *parent, QStringList pathTrail, QString path);
bool selectByPath(QString path);
Ui_FolderWizardTargetPage _ui{};
- bool _warnWasVisible;
+ bool _warnWasVisible = false;
AccountPtr _account;
QTimer _lscolTimer;
QStringList _encryptedPaths;
private:
FolderWizardLocalPath *_folderWizardSourcePage;
- FolderWizardRemotePath *_folderWizardTargetPage;
+ FolderWizardRemotePath *_folderWizardTargetPage = nullptr;
FolderWizardSelectiveSync *_folderWizardSelectiveSyncPage;
};
: QObject(parent),
_account(account),
_appPassword(QString()),
- _accountRemoved(false),
- _networkManager(nullptr),
- _networkReplyCheck(nullptr),
- _networkReplySuccess(nullptr)
+ _networkManager(nullptr)
{
QObject::connect(AccountManager::instance(), &AccountManager::accountRemoved,
this, [=](AccountState *) {
private:
AccountPtr _account;
QString _appPassword;
- bool _accountRemoved;
+ bool _accountRemoved = false;
QNetworkAccessManager _networkManager;
- QNetworkReply *_networkReplyCheck;
- QNetworkReply *_networkReplySuccess;
+ QNetworkReply *_networkReplyCheck = nullptr;
+ QNetworkReply *_networkReplySuccess = nullptr;
friend class ::TestRemoteWipe;
};
SelectiveSyncWidget::SelectiveSyncWidget(AccountPtr account, QWidget *parent)
: QWidget(parent)
, _account(account)
- , _inserting(false)
, _folderTree(new QTreeWidget(this))
{
_loading = new QLabel(tr("Loading …"), _folderTree);
QString _rootName;
QStringList _oldBlackList;
- bool _inserting; // set to true when we are inserting new items on the list
+ bool _inserting = false; // set to true when we are inserting new items on the list
QLabel *_loading;
QTreeWidget *_folderTree;
SslErrorDialog::SslErrorDialog(AccountPtr account, QWidget *parent)
: QDialog(parent)
- , _allTrusted(false)
, _ui(new Ui::SslErrorDialog)
, _account(account)
{
private:
[[nodiscard]] QString styleSheet() const;
- bool _allTrusted;
+ bool _allTrusted = false;
[[nodiscard]] QString certDiv(QSslCertificate) const;
UnifiedSearchResultsListModel::UnifiedSearchResultsListModel(AccountState *accountState, QObject *parent)
: QAbstractListModel(parent)
- , _waitingForSearchTermEditEnd(false)
, _accountState(accountState)
{
}
QString _searchTerm;
QString _errorString;
- bool _waitingForSearchTermEditEnd;
+ bool _waitingForSearchTermEditEnd = false;
QString _currentFetchMoreInProgressProviderId;
, _isCurrentUser(isCurrent)
, _activityModel(new ActivityListModel(_account.data(), this))
, _unifiedSearchResultsModel(new UnifiedSearchResultsListModel(_account.data(), this))
- , _notificationRequestsRunning(0)
{
connect(ProgressDispatcher::instance(), &ProgressDispatcher::progressInfo,
this, &User::slotProgressInfo);
// number of currently running notification requests. If non zero,
// no query for notifications is started.
- int _notificationRequestsRunning;
+ int _notificationRequestsRunning = 0;
};
class UserModel : public QAbstractListModel
OCUpdater::OCUpdater(const QUrl &url)
: Updater()
, _updateUrl(url)
- , _state(Unknown)
, _accessManager(new AccessManager(this))
, _timeoutWatchdog(new QTimer(this))
{
private:
QUrl _updateUrl;
- int _state;
+ int _state = Unknown;
QNetworkAccessManager *_accessManager;
QTimer *_timeoutWatchdog; /** Timer to guard the timeout of an individual network request */
UpdateInfo _updateInfo;
, _accountState(accountState)
, _allowDisconnectedAccountState(allowDisconnectedAccountState)
, _fetchAvatarImage(fetchAvatarImage)
- , _lastQuotaTotalBytes(0)
- , _lastQuotaUsedBytes(0)
- , _active(false)
{
connect(accountState, &AccountState::stateChanged,
this, &UserInfo::slotAccountStateChanged);
bool _allowDisconnectedAccountState;
bool _fetchAvatarImage;
- qint64 _lastQuotaTotalBytes;
- qint64 _lastQuotaUsedBytes;
+ qint64 _lastQuotaTotalBytes = 0;
+ qint64 _lastQuotaUsedBytes = 0;
QTimer _jobRestartTimer;
QDateTime _lastInfoReceived; // the time at which the user info and quota was received last
- bool _active; // if we should check at regular interval (when the UI is visible)
+ bool _active = false; // if we should check at regular interval (when the UI is visible)
QPointer<JsonApiJob> _job; // the currently running job
};
OwncloudHttpCredsPage::OwncloudHttpCredsPage(QWidget *parent)
: AbstractCredentialsWizardPage()
, _ui()
- , _connected(false)
, _progressIndi(new QProgressIndicator(this))
{
_ui.setupUi(this);
void customizeStyle();
Ui_OwncloudHttpCredsPage _ui;
- bool _connected;
+ bool _connected = false;
QProgressIndicator *_progressIndi;
OwncloudWizard *_ocWizard;
};
AbstractNetworkJob::AbstractNetworkJob(AccountPtr account, const QString &path, QObject *parent)
: QObject(parent)
- , _timedout(false)
- , _followRedirects(true)
, _account(account)
- , _ignoreCredentialFailure(false)
, _reply(nullptr)
, _path(path)
{
virtual void onTimedOut();
QByteArray _responseTimestamp;
- bool _timedout; // set to true when the timeout slot is received
+ bool _timedout = false; // set to true when the timeout slot is received
// Automatically follows redirects. Note that this only works for
// GET requests that don't set up any HTTP body or other flags.
- bool _followRedirects;
+ bool _followRedirects = true;
QString replyStatusString();
private:
QNetworkReply *addTimer(QNetworkReply *reply);
- bool _ignoreCredentialFailure;
+ bool _ignoreCredentialFailure = false;
QPointer<QNetworkReply> _reply; // (QPointer because the NetworkManager may be destroyed before the jobs at exit)
QString _path;
QTimer _timer;
BandwidthManager::BandwidthManager(OwncloudPropagator *p)
: QObject()
, _propagator(p)
- , _relativeLimitCurrentMeasuredDevice(nullptr)
- , _relativeUploadLimitProgressAtMeasuringRestart(0)
- , _currentUploadLimit(0)
- , _relativeLimitCurrentMeasuredJob(nullptr)
- , _currentDownloadLimit(0)
{
_currentUploadLimit = _propagator->_uploadLimit;
_currentDownloadLimit = _propagator->_downloadLimit;
QTimer _relativeUploadDelayTimer;
// the device measured
- UploadDevice *_relativeLimitCurrentMeasuredDevice;
+ UploadDevice *_relativeLimitCurrentMeasuredDevice = nullptr;
// for measuring how much progress we made at start
- qint64 _relativeUploadLimitProgressAtMeasuringRestart;
- qint64 _currentUploadLimit;
+ qint64 _relativeUploadLimitProgressAtMeasuringRestart = 0;
+ qint64 _currentUploadLimit = 0;
std::list<GETFileJob *> _downloadJobList;
QTimer _relativeDownloadMeasuringTimer;
QTimer _relativeDownloadDelayTimer;
// the device measured
- GETFileJob *_relativeLimitCurrentMeasuredJob;
+ GETFileJob *_relativeLimitCurrentMeasuredJob = nullptr;
// for measuring how much progress we made at start
qint64 _relativeDownloadLimitProgressAtMeasuringRestart = 0LL;
- qint64 _currentDownloadLimit;
+ qint64 _currentDownloadLimit = 0;
};
} // namespace OCC
: QObject(parent)
, _subPath(path)
, _account(account)
- , _ignoredFirst(false)
- , _isRootPath(false)
- , _isExternalStorage(false)
- , _isE2eEncrypted(false)
{
}
AccountPtr _account;
// The first result is for the directory itself and need to be ignored.
// This flag is true if it was already ignored.
- bool _ignoredFirst;
+ bool _ignoredFirst = false;
// Set to true if this is the root path and we need to check the data-fingerprint
- bool _isRootPath;
+ bool _isRootPath = false;
// If this directory is an external storage (The first item has 'M' in its permission)
- bool _isExternalStorage;
+ bool _isExternalStorage = false;
// If this directory is e2ee
- bool _isE2eEncrypted;
+ bool _isE2eEncrypted = false;
// If set, the discovery will finish with an error
int64_t _size = 0;
QString _error;
CheckServerJob::CheckServerJob(AccountPtr account, QObject *parent)
: AbstractNetworkJob(account, QLatin1String(statusphpC), parent)
- , _subdirFallback(false)
- , _permanentRedirects(0)
{
setIgnoreCredentialFailure(true);
connect(this, &AbstractNetworkJob::redirected,
void slotRedirected(QNetworkReply *reply, const QUrl &targetUrl, int redirectCount);
private:
- bool _subdirFallback;
+ bool _subdirFallback = false;
/** The permanent-redirect adjusted account url.
*
QUrl _serverUrl;
/** Keep track of how many permanent redirect were applied. */
- int _permanentRedirects;
+ int _permanentRedirects = 0;
};
PropagatorJob::PropagatorJob(OwncloudPropagator *propagator)
: QObject(propagator)
- , _state(NotYetStarted)
{
}
Running,
Finished
};
- JobState _state;
+ JobState _state = NotYetStarted;
Q_ENUM(JobState)
private:
QScopedPointer<PropagateItemJob> _restoreJob;
- JobParallelism _parallelism;
+ JobParallelism _parallelism = FullParallelism;
public:
PropagateItemJob(OwncloudPropagator *propagator, const SyncFileItemPtr &item)
: PropagatorJob(propagator)
- , _parallelism(FullParallelism)
, _item(item)
{
// we should always execute jobs that process the E2EE API calls as sequential jobs
QVector<PropagatorJob *> _jobsToDo;
SyncFileItemVector _tasksToDo;
QVector<PropagatorJob *> _runningJobs;
- SyncFileItem::Status _hasError; // NoStatus, or NormalError / SoftError if there was an error
- quint64 _abortsCount;
+ SyncFileItem::Status _hasError = SyncFileItem::NoStatus; // NoStatus, or NormalError / SoftError if there was an error
+ quint64 _abortsCount = 0;
explicit PropagatorCompositeJob(OwncloudPropagator *propagator)
: PropagatorJob(propagator)
- , _hasError(SyncFileItem::NoStatus), _abortsCount(0)
{
}
Q_OBJECT
public:
SyncJournalDb *const _journal;
- bool _finishedEmited; // used to ensure that finished is only emitted once
+ bool _finishedEmited = false; // used to ensure that finished is only emitted once
public:
OwncloudPropagator(AccountPtr account, const QString &localDir,
const QString &remoteFolder, SyncJournalDb *progressDb,
QSet<QString> &bulkUploadBlackList)
: _journal(progressDb)
- , _finishedEmited(false)
, _bandwidthManager(this)
- , _anotherSyncNeeded(false)
, _chunkSize(10 * 1000 * 1000) // 10 MB, overridden in setSyncOptions
, _account(account)
, _localDir((localDir.endsWith(QChar('/'))) ? localDir : localDir + '/')
QList<PropagateItemJob *> _activeJobList;
/** We detected that another sync is required after this one */
- bool _anotherSyncNeeded;
+ bool _anotherSyncNeeded = false;
/** Per-folder quota guesses.
*
public:
PropagateDownloadFile(OwncloudPropagator *propagator, const SyncFileItemPtr &item)
: PropagateItemJob(propagator, item)
- , _resumeStart(0)
- , _downloadProgress(0)
- , _deleteExisting(false)
{
}
void start() override;
void startAfterIsEncryptedIsChecked();
void deleteExistingFolder();
- qint64 _resumeStart;
- qint64 _downloadProgress;
+ qint64 _resumeStart = 0;
+ qint64 _downloadProgress = 0;
QPointer<GETFileJob> _job;
QFile _tmpFile;
- bool _deleteExisting;
+ bool _deleteExisting = false;
bool _isEncrypted = false;
EncryptedFile _encryptedInfo;
ConflictRecord _conflictRecord;
PropagateRemoteMkdir::PropagateRemoteMkdir(OwncloudPropagator *propagator, const SyncFileItemPtr &item)
: PropagateItemJob(propagator, item)
- , _deleteExisting(false)
- , _uploadEncryptedHelper(nullptr)
{
const auto path = _item->_file;
const auto slashPosition = path.lastIndexOf('/');
{
Q_OBJECT
QPointer<AbstractNetworkJob> _job;
- bool _deleteExisting;
- PropagateUploadEncrypted *_uploadEncryptedHelper;
+ bool _deleteExisting = false;
+ PropagateUploadEncrypted *_uploadEncryptedHelper = nullptr;
friend class PropagateDirectory; // So it can access the _item;
public:
PropagateRemoteMkdir(OwncloudPropagator *propagator, const SyncFileItemPtr &item);
, _finished(false)
, _deleteExisting(false)
, _aborting(false)
- , _uploadEncryptedHelper(nullptr)
- , _uploadingEncrypted(false)
{
const auto path = _item->_file;
const auto slashPosition = path.lastIndexOf('/');
/** Bases headers that need to be sent on the PUT, or in the MOVE for chunking-ng */
QMap<QByteArray, QByteArray> headers();
private:
- PropagateUploadEncrypted *_uploadEncryptedHelper;
- bool _uploadingEncrypted;
+ PropagateUploadEncrypted *_uploadEncryptedHelper = nullptr;
+ bool _uploadingEncrypted = false;
UploadStatus _uploadStatus;
};
public:
PropagateLocalMkdir(OwncloudPropagator *propagator, const SyncFileItemPtr &item)
: PropagateItemJob(propagator, item)
- , _deleteExistingFile(false)
{
}
void start() override;
void startLocalMkdir();
void startDemanglingName(const QString &parentPath);
- bool _deleteExistingFile;
+ bool _deleteExistingFile = false;
};
/**
const QString &remotePath,
OCC::SyncJournalDb *journal)
: _account(account)
- , _needsUpdate(false)
- , _syncRunning(false)
, _localPath(localPath)
, _remotePath(remotePath)
, _journal(journal)
, _progressInfo(new ProgressInfo)
- , _hasNoneFiles(false)
- , _hasRemoveFile(false)
- , _uploadLimit(0)
- , _downloadLimit(0)
, _syncOptions(syncOptions)
- , _anotherSyncNeeded(NoFollowUpSync)
{
qRegisterMetaType<SyncFileItem>("SyncFileItem");
qRegisterMetaType<SyncFileItemPtr>("SyncFileItemPtr");
QVector<SyncFileItemPtr> _syncItems;
AccountPtr _account;
- bool _needsUpdate;
- bool _syncRunning;
+ bool _needsUpdate = false;
+ bool _syncRunning = false;
QString _localPath;
QString _remotePath;
QByteArray _remoteRootEtag;
void restoreOldFiles(SyncFileItemVector &syncItems);
// true if there is at least one file which was not changed on the server
- bool _hasNoneFiles;
+ bool _hasNoneFiles = false;
// true if there is at leasr one file with instruction REMOVE
- bool _hasRemoveFile;
+ bool _hasRemoveFile = false;
// If ignored files should be ignored
bool _ignore_hidden_files = false;
- int _uploadLimit;
- int _downloadLimit;
+ int _uploadLimit = 0;
+ int _downloadLimit = 0;
SyncOptions _syncOptions;
- AnotherSyncNeeded _anotherSyncNeeded;
+ AnotherSyncNeeded _anotherSyncNeeded = NoFollowUpSync;
/** Stores the time since a job touched a file. */
QMultiMap<QElapsedTimer, QString> _touchedFiles;