Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2021-10-27 12:05:14 +0300
committerHannah von Reth <hannah.vonreth@owncloud.com>2021-10-27 15:20:55 +0300
commit2b70834dd15c16b2b34efcc3952c5238419581da (patch)
treea3fdbf5d67adf2c071be6b3e140711ab32e7c3af /src/gui/socketapi
parentd4f52b107fe5a066662a060bdbc2e7357f8be084 (diff)
Add branding parameter to disable explorer context menu icons
Fixes: #9167
Diffstat (limited to 'src/gui/socketapi')
-rw-r--r--src/gui/socketapi/socketapi.cpp51
1 files changed, 27 insertions, 24 deletions
diff --git a/src/gui/socketapi/socketapi.cpp b/src/gui/socketapi/socketapi.cpp
index ed9eb036e..97b3b4bb5 100644
--- a/src/gui/socketapi/socketapi.cpp
+++ b/src/gui/socketapi/socketapi.cpp
@@ -873,33 +873,36 @@ void SocketApi::command_V2_GET_CLIENT_ICON(const QSharedPointer<SocketApiJobV2>
return;
}
+ QByteArray data;
const Theme *theme = Theme::instance();
- OC_ASSERT(theme);
- const QIcon appIcon = theme->applicationIcon();
- qCDebug(lcSocketApi) << Q_FUNC_INFO << " got icon from theme: " << appIcon;
-
- // convert to pixmap (might be smaller if size is not available)
- const QPixmap pixmap = appIcon.pixmap(QSize(size.toInt(), size.toInt()));
-
- // Convert pixmap to in-memory PNG
- QByteArray png;
- QBuffer pngBuffer(&png);
- auto success = pngBuffer.open(QIODevice::WriteOnly);
- if (!success) {
- qCWarning(lcSocketApi) << "Error opening buffer for png in " << Q_FUNC_INFO;
- job->failure(QStringLiteral("cannot get client icon"));
- return;
- }
+ // return an empty answer if the end point was disabled
+ if (theme->enableSocketApiIconSupport()) {
+ const QIcon appIcon = theme->applicationIcon();
+ qCDebug(lcSocketApi) << Q_FUNC_INFO << " got icon from theme: " << appIcon;
+
+ // convert to pixmap (might be smaller if size is not available)
+ const QPixmap pixmap = appIcon.pixmap(QSize(size.toInt(), size.toInt()));
+
+ // Convert pixmap to in-memory PNG
+ QByteArray png;
+ QBuffer pngBuffer(&png);
+ auto success = pngBuffer.open(QIODevice::WriteOnly);
+ if (!success) {
+ qCWarning(lcSocketApi) << "Error opening buffer for png in " << Q_FUNC_INFO;
+ job->failure(QStringLiteral("cannot get client icon"));
+ return;
+ }
- success = pixmap.save(&pngBuffer, "PNG");
- if (!success) {
- qCWarning(lcSocketApi) << "Error saving client icon as png in " << Q_FUNC_INFO;
- job->failure(QStringLiteral("cannot get client icon"));
- return;
- }
+ success = pixmap.save(&pngBuffer, "PNG");
+ if (!success) {
+ qCWarning(lcSocketApi) << "Error saving client icon as png in " << Q_FUNC_INFO;
+ job->failure(QStringLiteral("cannot get client icon"));
+ return;
+ }
- const QByteArray pngAsBase64 = pngBuffer.data().toBase64();
- job->success({ { QStringLiteral("png"), QString::fromUtf8(pngAsBase64) } });
+ data = pngBuffer.data().toBase64();
+ }
+ job->success({ { QStringLiteral("png"), QString::fromUtf8(data) } });
}
void SocketApi::emailPrivateLink(const QString &link)