Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/removeuser #7238

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/gui/navigationpanehelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ void NavigationPaneHelper::updateCloudStorageRegistry()
Utility::registryWalkSubKeys(HKEY_CURRENT_USER, nameSpaceKey,
[&entriesToRemove](HKEY key, const QString &subKey) {
QVariant appName = Utility::registryGetKeyValue(key, subKey, QStringLiteral("ApplicationName"));
qCDebug(lcNavPane) << "Searching for user with subKey:" << subKey;
if (appName.toString() == QLatin1String(APPLICATION_NAME)) {
QUuid clsid{ subKey };
Q_ASSERT(!clsid.isNull());
Expand Down Expand Up @@ -165,6 +166,10 @@ void NavigationPaneHelper::updateCloudStorageRegistry()

qCInfo(lcNavPane) << "Explorer Cloud storage provider: now unused, removing own CLSID" << clsidStr;
#ifdef Q_OS_WIN
Utility::registryDeleteKeyTree(HKEY_CURRENT_USER, clsidPath + QStringLiteral("\\DefaultIcon"));
qCInfo(lcNavPane) << "Removed" << clsidPath + QStringLiteral("\\DefaultIcon") << "for user" << clsidStr;
Utility::registryDeleteKeyTree(HKEY_CURRENT_USER, clsidPathWow64 + QStringLiteral("\\DefaultIcon"));
qCInfo(lcNavPane) << "Removed" << clsidPathWow64 + QStringLiteral("\\DefaultIcon") << "for user" << clsidStr;
Utility::registryDeleteKeyTree(HKEY_CURRENT_USER, clsidPath);
Utility::registryDeleteKeyTree(HKEY_CURRENT_USER, clsidPathWow64);
Utility::registryDeleteKeyTree(HKEY_CURRENT_USER, namespacePath);
Expand Down
21 changes: 21 additions & 0 deletions src/libsync/vfs/cfapi/cfapiwrapper.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*

Check notice on line 1 in src/libsync/vfs/cfapi/cfapiwrapper.cpp

View workflow job for this annotation

GitHub Actions / build

Run clang-format on src/libsync/vfs/cfapi/cfapiwrapper.cpp

File src/libsync/vfs/cfapi/cfapiwrapper.cpp does not conform to Custom style guidelines. (lines 638)
* Copyright (C) by Kevin Ottens <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -618,6 +618,26 @@
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 @@
}
}
});

return result;
}
return true;
Expand Down
Loading