Skip to content

Commit

Permalink
Use AccountPtr in serverVersionChanged signal instead of raw pointer
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Nov 20, 2024
1 parent 351701f commit e4efc6b
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/gui/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ void Application::slotAccountStateAdded(AccountState *accountState)
connect(accountState->account().data(), &Account::serverVersionChanged,
_folderManager.data(), &FolderMan::slotServerVersionChanged);

_gui->slotTrayMessageIfServerUnsupported(accountState->account().data());
_gui->slotTrayMessageIfServerUnsupported(accountState->account());
}

void Application::slotCleanup()
Expand Down
2 changes: 1 addition & 1 deletion src/gui/folderman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ void FolderMan::slotForwardFolderSyncStateChange()
}
}

void FolderMan::slotServerVersionChanged(Account *account)
void FolderMan::slotServerVersionChanged(const OCC::AccountPtr &account)
{
// Pause folders if the server version is unsupported
if (account->serverVersionUnsupported()) {
Expand Down
2 changes: 1 addition & 1 deletion src/gui/folderman.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ private slots:
// FolderMan::folderSyncStateChange(Folder*) signal.
void slotForwardFolderSyncStateChange();

void slotServerVersionChanged(OCC::Account *account);
void slotServerVersionChanged(const OCC::AccountPtr &account);

/**
* A file whose locks were being monitored has become unlocked.
Expand Down
6 changes: 3 additions & 3 deletions src/gui/owncloudgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ void ownCloudGui::slotAccountStateChanged()
slotComputeOverallSyncStatus();
}

void ownCloudGui::slotTrayMessageIfServerUnsupported(Account *account)
void ownCloudGui::slotTrayMessageIfServerUnsupported(const AccountPtr &account)
{
if (account->serverVersionUnsupported()) {
slotShowTrayMessage(
Expand All @@ -285,8 +285,8 @@ void ownCloudGui::slotTrayMessageIfServerUnsupported(Account *account)
}
}

void ownCloudGui::slotNeedToAcceptTermsOfService(OCC::AccountPtr account,
AccountState::State state)
void ownCloudGui::slotNeedToAcceptTermsOfService(const OCC::AccountPtr &account,
const OCC::AccountState::State state)
{
if (state == AccountState::NeedToSignTermsOfService) {
slotShowTrayMessage(
Expand Down
6 changes: 3 additions & 3 deletions src/gui/owncloudgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ public slots:
void slotHelp();
void slotOpenPath(const QString &path);
void slotAccountStateChanged();
void slotTrayMessageIfServerUnsupported(OCC::Account *account);
void slotNeedToAcceptTermsOfService(OCC::AccountPtr account,
OCC::AccountState::State state);
void slotTrayMessageIfServerUnsupported(const OCC::AccountPtr &account);
void slotNeedToAcceptTermsOfService(const OCC::AccountPtr &account,
const OCC::AccountState::State state);

/**
* Open a share dialog for a file or folder.
Expand Down
2 changes: 1 addition & 1 deletion src/libsync/account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ void Account::setServerVersion(const QString &version)

auto oldServerVersion = _serverVersion;
_serverVersion = version;
emit serverVersionChanged(this, oldServerVersion, version);
emit serverVersionChanged(sharedFromThis(), oldServerVersion, version);
}

void Account::writeAppPasswordOnce(QString appPassword){
Expand Down
2 changes: 1 addition & 1 deletion src/libsync/account.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ public slots:
// e.g. when the approved SSL certificates changed
void wantsAccountSaved(const OCC::AccountPtr &acc);

void serverVersionChanged(OCC::Account *account, const QString &newVersion, const QString &oldVersion);
void serverVersionChanged(const OCC::AccountPtr &account, const QString &newVersion, const QString &oldVersion);

void accountChangedAvatar();
void accountChangedDisplayName();
Expand Down

0 comments on commit e4efc6b

Please sign in to comment.