summaryrefslogtreecommitdiffstats
path: root/common/synchronizer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/synchronizer.cpp')
-rw-r--r--common/synchronizer.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp
index 959cf48..4a0ac46 100644
--- a/common/synchronizer.cpp
+++ b/common/synchronizer.cpp
@@ -49,6 +49,20 @@ Synchronizer::~Synchronizer()
49 49
50} 50}
51 51
52void Synchronizer::setSecret(const QString &s)
53{
54 mSecret = s;
55
56 if (!mSyncRequestQueue.isEmpty()) {
57 processSyncQueue().exec();
58 }
59}
60
61QString Synchronizer::secret() const
62{
63 return mSecret;
64}
65
52void Synchronizer::setup(const std::function<void(int commandId, const QByteArray &data)> &enqueueCommandCallback, MessageQueue &mq) 66void Synchronizer::setup(const std::function<void(int commandId, const QByteArray &data)> &enqueueCommandCallback, MessageQueue &mq)
53{ 67{
54 mEnqueue = enqueueCommandCallback; 68 mEnqueue = enqueueCommandCallback;
@@ -474,6 +488,10 @@ void Synchronizer::setBusy(bool busy, const QString &reason, const QByteArray re
474 488
475KAsync::Job<void> Synchronizer::processSyncQueue() 489KAsync::Job<void> Synchronizer::processSyncQueue()
476{ 490{
491 if (secret().isEmpty()) {
492 SinkLogCtx(mLogCtx) << "Secret not available but required.";
493 return KAsync::null<void>();
494 }
477 if (mSyncRequestQueue.isEmpty()) { 495 if (mSyncRequestQueue.isEmpty()) {
478 SinkLogCtx(mLogCtx) << "All requests processed."; 496 SinkLogCtx(mLogCtx) << "All requests processed.";
479 return KAsync::null<void>(); 497 return KAsync::null<void>();