Skip to content

Commit

Permalink
Remove icon of the VFS folder when removing user account.
Browse files Browse the repository at this point in the history
Signed-off-by: Camila Ayres <[email protected]>
  • Loading branch information
camilasan committed Sep 26, 2024
1 parent f19dcc0 commit e1b3cc3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/libsync/vfs/cfapi/cfapiwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,26 @@ bool deleteSyncRootRegistryKey(const QString &syncRootPath, const QString &provi
const auto currentUserSyncRootIdPattern = QString("%1!%2!%3").arg(providerName).arg(windowsSid).arg(accountDisplayName);

bool result = true;
struct RegistryKeyInfo {

Check warning on line 621 in src/libsync/vfs/cfapi/cfapiwrapper.cpp

View workflow job for this annotation

GitHub Actions / build

src/libsync/vfs/cfapi/cfapiwrapper.cpp:621:16 [cppcoreguidelines-pro-type-member-init]

constructor does not initialize these fields: subKey, valueName, type, value
QString subKey;
QString valueName;
int type;
QVariant value;
};
const auto syncRootId = QString("%1!%2!%3!%4").arg(providerName).arg(windowsSid).arg(accountDisplayName).arg(syncRootPath);
qCInfo(lcCfApiWrapper) << "syncRootPath:" << syncRootPath;
qCInfo(lcCfApiWrapper) << "syncRootId:" << syncRootId;
const QString subKey = syncRootManagerRegKey + QStringLiteral("\\") + syncRootId;

Check warning on line 630 in src/libsync/vfs/cfapi/cfapiwrapper.cpp

View workflow job for this annotation

GitHub Actions / build

src/libsync/vfs/cfapi/cfapiwrapper.cpp:630:23 [cppcoreguidelines-init-variables]

variable 'subKey' is not initialized
const QString valueName = QStringLiteral("IconResource");

Check warning on line 631 in src/libsync/vfs/cfapi/cfapiwrapper.cpp

View workflow job for this annotation

GitHub Actions / build

src/libsync/vfs/cfapi/cfapiwrapper.cpp:631:23 [cppcoreguidelines-init-variables]

variable 'valueName' is not initialized
const int type = REG_EXPAND_SZ;

Check warning on line 632 in src/libsync/vfs/cfapi/cfapiwrapper.cpp

View workflow job for this annotation

GitHub Actions / build

src/libsync/vfs/cfapi/cfapiwrapper.cpp:632:19 [cppcoreguidelines-init-variables]

variable 'type' is not initialized
const QVariant value = QString(QDir::toNativeSeparators(qApp->applicationFilePath()) + QStringLiteral(",0"));

Check warning on line 633 in src/libsync/vfs/cfapi/cfapiwrapper.cpp

View workflow job for this annotation

GitHub Actions / build

src/libsync/vfs/cfapi/cfapiwrapper.cpp:633:24 [cppcoreguidelines-init-variables]

variable 'value' is not initialized
qCInfo(lcCfApiWrapper) << "Going to delete Registry key" << subKey;
qCInfo(lcCfApiWrapper) << "with value name" << valueName;
qCInfo(lcCfApiWrapper) << "and value" << value;

if(OCC::Utility::registryDeleteKeyTree(HKEY_LOCAL_MACHINE, subKey)) {
qCInfo(lcCfApiWrapper) << "Successfully deleted icon from" << syncRootPath;
}

// walk through each registered syncRootId
OCC::Utility::registryWalkSubKeys(HKEY_LOCAL_MACHINE, syncRootManagerRegKey, [&](HKEY, const QString &syncRootId) {
Expand All @@ -631,6 +651,7 @@ bool deleteSyncRootRegistryKey(const QString &syncRootPath, const QString &provi
}
}
});

return result;
}
return true;
Expand Down

0 comments on commit e1b3cc3

Please sign in to comment.