-
Notifications
You must be signed in to change notification settings - Fork 806
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: allexzander <blackslayer4@gmail.com>
- Loading branch information
1 parent
601a55b
commit fd30889
Showing
24 changed files
with
432 additions
and
256 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "shellextensionutils.h" | ||
#include <QJsonDocument> | ||
#include <QLoggingCategory> | ||
|
||
namespace VfsShellExtensions { | ||
|
||
Q_LOGGING_CATEGORY(lcShellExtensionUtils, "nextcloud.gui.shellextensionutils", QtInfoMsg) | ||
|
||
QString VfsShellExtensions::serverNameForApplicationName(const QString &applicationName) | ||
{ | ||
return applicationName + QStringLiteral(":VfsShellExtensionsServer"); | ||
} | ||
|
||
QString VfsShellExtensions::serverNameForApplicationNameDefault() | ||
{ | ||
return serverNameForApplicationName(APPLICATION_NAME); | ||
} | ||
namespace Protocol { | ||
QByteArray createJsonMessage(const QVariantMap &message) | ||
{ | ||
QVariantMap messageCopy = message; | ||
messageCopy[QStringLiteral("version")] = Version; | ||
return QJsonDocument::fromVariant((messageCopy)).toJson(QJsonDocument::Compact); | ||
} | ||
|
||
bool validatProtocolVersion(const QVariantMap &message) | ||
{ | ||
const auto valid = message.value(QStringLiteral("version")) == Version; | ||
if (!valid) { | ||
qCWarning(lcShellExtensionUtils) << "Invalid shell extensions IPC protocol: " << message.value(QStringLiteral("version")) << " vs " << Version; | ||
} | ||
Q_ASSERT(valid); | ||
return valid; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (C) by Oleksandr Zolotov <alex@nextcloud.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* for more details. | ||
*/ | ||
|
||
#pragma once | ||
#include "config.h" | ||
#include <QByteArray> | ||
#include <QString> | ||
#include <QVariantMap> | ||
|
||
namespace VfsShellExtensions { | ||
QString serverNameForApplicationName(const QString &applicationName); | ||
QString serverNameForApplicationNameDefault(); | ||
|
||
namespace Protocol { | ||
static constexpr auto ThumbnailProviderRequestKey = "thumbnailProviderRequest"; | ||
static constexpr auto ThumbnailProviderRequestFilePathKey = "filePath"; | ||
static constexpr auto ThumbnailProviderRequestFileSizeKey = "size"; | ||
static constexpr auto ThumnailProviderDataKey = "thumbnailData"; | ||
static constexpr auto Version = "1.0"; | ||
|
||
QByteArray createJsonMessage(const QVariantMap &message); | ||
bool validatProtocolVersion(const QVariantMap &message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.