diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-24 22:15:18 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-24 22:15:18 +0100 |
commit | 9ea268a6d0f4054c31b2729ecd6cfcc9d07a2d6a (patch) | |
tree | 41fef7daac9e5ae64d61452a3f38c82243d29fdd /common/resourceaccess.cpp | |
parent | 84d70933c0cd0987d5fee5a78f413fec82bb1288 (diff) | |
download | sink-9ea268a6d0f4054c31b2729ecd6cfcc9d07a2d6a.tar.gz sink-9ea268a6d0f4054c31b2729ecd6cfcc9d07a2d6a.zip |
Implemented notification support in the model.
This will allow us to fold things like progress and sync status directly
into the model. Usecases are mail download progress and folder sync
progress.
Ideally we would also solve the resource/account state through this.
Diffstat (limited to 'common/resourceaccess.cpp')
-rw-r--r-- | common/resourceaccess.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp index e48b624..9f4f14c 100644 --- a/common/resourceaccess.cpp +++ b/common/resourceaccess.cpp | |||
@@ -547,6 +547,7 @@ static Sink::Notification getNotification(const Sink::Commands::Notification *bu | |||
547 | } | 547 | } |
548 | n.type = buffer->type(); | 548 | n.type = buffer->type(); |
549 | n.code = buffer->code(); | 549 | n.code = buffer->code(); |
550 | n.entities = BufferUtils::fromVector(*buffer->entities()); | ||
550 | return n; | 551 | return n; |
551 | } | 552 | } |
552 | 553 | ||
@@ -608,13 +609,17 @@ bool ResourceAccess::processMessageBuffer() | |||
608 | mResourceStatus = buffer->code(); | 609 | mResourceStatus = buffer->code(); |
609 | SinkTrace() << "Updated status: " << mResourceStatus; | 610 | SinkTrace() << "Updated status: " << mResourceStatus; |
610 | [[clang::fallthrough]]; | 611 | [[clang::fallthrough]]; |
612 | case Sink::Notification::Info: | ||
613 | [[clang::fallthrough]]; | ||
611 | case Sink::Notification::Warning: | 614 | case Sink::Notification::Warning: |
612 | [[clang::fallthrough]]; | 615 | [[clang::fallthrough]]; |
616 | case Sink::Notification::Error: | ||
617 | [[clang::fallthrough]]; | ||
613 | case Sink::Notification::FlushCompletion: | 618 | case Sink::Notification::FlushCompletion: |
614 | [[clang::fallthrough]]; | 619 | [[clang::fallthrough]]; |
615 | case Sink::Notification::Progress: { | 620 | case Sink::Notification::Progress: { |
616 | auto n = getNotification(buffer); | 621 | auto n = getNotification(buffer); |
617 | SinkTrace() << "Received notification: Type:" << n.type << "Message: " << n.message << "Code: " << n.code; | 622 | SinkTrace() << "Received notification: " << n; |
618 | n.resource = d->resourceInstanceIdentifier; | 623 | n.resource = d->resourceInstanceIdentifier; |
619 | emit notification(n); | 624 | emit notification(n); |
620 | } break; | 625 | } break; |