Skip to content

Commit 7def06b

Browse files
committed
Add HYDRATE_FILE job stub to socketapi
1 parent 8cb1702 commit 7def06b

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

src/gui/socketapi/socketapi.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ SocketApi::SocketApi(QObject *parent)
158158
unregisterAccount(accountState->account());
159159
}
160160
});
161+
162+
const QJsonObject args { { QStringLiteral("size"), 5 } };
163+
const QJsonObject obj { { QStringLiteral("id"), QString::number(17) }, { QStringLiteral("arguments"), args } };
164+
const auto json = QJsonDocument(obj).toJson(QJsonDocument::Indented);
165+
166+
qCDebug(lcSocketApi) << u"JSON:" << json;
167+
161168
}
162169

163170
SocketApi::~SocketApi()
@@ -283,7 +290,7 @@ void SocketApi::slotReadSocket()
283290
}
284291
} else if (command.startsWith(QLatin1String("V2/"))) {
285292
QJsonParseError error;
286-
const auto json = QJsonDocument::fromJson(argument.toUtf8(), &error).object();
293+
const auto json = QJsonDocument::fromJson(argument.trimmed().toUtf8(), &error).object();
287294
if (error.error != QJsonParseError::NoError) {
288295
qCWarning(lcSocketApi()) << u"Invalid json" << argument << error.errorString();
289296
listener->sendError(error.errorString());
@@ -709,6 +716,16 @@ void SocketApi::command_V2_GET_CLIENT_ICON(const QSharedPointer<SocketApiJobV2>
709716
job->success({ { QStringLiteral("png"), QString::fromUtf8(data) } });
710717
}
711718

719+
void SocketApi::command_V2_HYDRATE_FILE(const QSharedPointer<SocketApiJobV2> &job) const
720+
{
721+
OC_ASSERT(job);
722+
const auto &arguments = job->arguments();
723+
724+
hydrate_the_file ähnlich zu VfsXattr::handleAction.
725+
726+
job->success({ {QStringLiteral("hydration"), QStringLiteral("STARTED") } });
727+
}
728+
712729
void SocketApi::emailPrivateLink(const QUrl &link)
713730
{
714731
Utility::openEmailComposer(

src/gui/socketapi/socketapi.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ private Q_SLOTS:
120120
Q_INVOKABLE void command_OPEN_APP_LINK(const QString &localFile, SocketListener *listener);
121121
// External sync
122122
Q_INVOKABLE void command_V2_LIST_ACCOUNTS(const QSharedPointer<SocketApiJobV2> &job) const;
123+
// VFS
124+
Q_INVOKABLE void command_V2_HYDRATE_FILE(const QSharedPointer<SocketApiJobV2> &job) const;
125+
123126

124127
// Sends the id and the client icon as PNG image (base64 encoded) in Json key "png"
125128
// e.g. { "id" : "1", "arguments" : { "png" : "hswehs343dj8..." } } or an error message in key "error"

src/plugins/vfs/xattr/vfs_xattr.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,7 @@ bool VfsXAttr::handleAction(const QString& path, const XAttrWrapper::PlaceHolder
238238
// .extraArgs = std::move(extraArgs)};
239239
// All good, let's hydrate now
240240

241-
const auto invokeResult = QMetaObject::invokeMethod(context.vfs, [=]
242-
{
241+
const auto invokeResult = QMetaObject::invokeMethod(context.vfs, [=] {
243242
context.vfs->requestHydration(context, attribs.size());
244243
}, Qt::QueuedConnection);
245244
if (!invokeResult) {

0 commit comments

Comments
 (0)