diff options
Diffstat (limited to 'framework/src')
-rw-r--r-- | framework/src/domain/folderlistmodel.cpp | 24 | ||||
-rw-r--r-- | framework/src/domain/folderlistmodel.h | 4 | ||||
-rw-r--r-- | framework/src/sinkfabric.cpp | 5 |
3 files changed, 30 insertions, 3 deletions
diff --git a/framework/src/domain/folderlistmodel.cpp b/framework/src/domain/folderlistmodel.cpp index 4437e75b..1ef6f761 100644 --- a/framework/src/domain/folderlistmodel.cpp +++ b/framework/src/domain/folderlistmodel.cpp | |||
@@ -105,7 +105,6 @@ void FolderListModel::setAccountId(const QVariant &accountId) | |||
105 | auto query = Query(); | 105 | auto query = Query(); |
106 | query.resourceFilter<SinkResource::Account>(account); | 106 | query.resourceFilter<SinkResource::Account>(account); |
107 | query.setFlags(Sink::Query::LiveQuery | Sink::Query::UpdateStatus); | 107 | query.setFlags(Sink::Query::LiveQuery | Sink::Query::UpdateStatus); |
108 | query.requestTree<Folder::Parent>(); | ||
109 | query.request<Folder::Name>() | 108 | query.request<Folder::Name>() |
110 | .request<Folder::Icon>() | 109 | .request<Folder::Icon>() |
111 | .request<Folder::Parent>() | 110 | .request<Folder::Parent>() |
@@ -115,6 +114,11 @@ void FolderListModel::setAccountId(const QVariant &accountId) | |||
115 | runQuery(query); | 114 | runQuery(query); |
116 | } | 115 | } |
117 | 116 | ||
117 | QVariant FolderListModel::accountId() const | ||
118 | { | ||
119 | return {}; | ||
120 | } | ||
121 | |||
118 | static int getPriority(const Sink::ApplicationDomain::Folder &folder) | 122 | static int getPriority(const Sink::ApplicationDomain::Folder &folder) |
119 | { | 123 | { |
120 | auto specialPurpose = folder.getSpecialPurpose(); | 124 | auto specialPurpose = folder.getSpecialPurpose(); |
@@ -144,8 +148,22 @@ bool FolderListModel::lessThan(const QModelIndex &left, const QModelIndex &right | |||
144 | return leftPriority < rightPriority; | 148 | return leftPriority < rightPriority; |
145 | } | 149 | } |
146 | 150 | ||
147 | QVariant FolderListModel::accountId() const | 151 | void FolderListModel::setFolderId(const QVariant &folderId) |
148 | { | 152 | { |
149 | return QVariant(); | 153 | const auto folder = folderId.toString().toUtf8(); |
154 | |||
155 | //Get all folders of an account | ||
156 | auto query = Query(); | ||
157 | query.filter(folder); | ||
158 | query.request<Folder::Name>() | ||
159 | .request<Folder::Icon>() | ||
160 | .request<Folder::Parent>() | ||
161 | .request<Folder::SpecialPurpose>(); | ||
162 | query.setId("folder" + folder); | ||
163 | runQuery(query); | ||
150 | } | 164 | } |
151 | 165 | ||
166 | QVariant FolderListModel::folderId() const | ||
167 | { | ||
168 | return {}; | ||
169 | } | ||
diff --git a/framework/src/domain/folderlistmodel.h b/framework/src/domain/folderlistmodel.h index 8f157ca2..0e412202 100644 --- a/framework/src/domain/folderlistmodel.h +++ b/framework/src/domain/folderlistmodel.h | |||
@@ -34,6 +34,7 @@ class FolderListModel : public QSortFilterProxyModel | |||
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | 35 | ||
36 | Q_PROPERTY (QVariant accountId READ accountId WRITE setAccountId) | 36 | Q_PROPERTY (QVariant accountId READ accountId WRITE setAccountId) |
37 | Q_PROPERTY (QVariant folderId READ folderId WRITE setFolderId) | ||
37 | 38 | ||
38 | public: | 39 | public: |
39 | enum Status { | 40 | enum Status { |
@@ -63,6 +64,9 @@ public: | |||
63 | 64 | ||
64 | void setAccountId(const QVariant &accountId); | 65 | void setAccountId(const QVariant &accountId); |
65 | QVariant accountId() const; | 66 | QVariant accountId() const; |
67 | |||
68 | void setFolderId(const QVariant &folderId); | ||
69 | QVariant folderId() const; | ||
66 | protected: | 70 | protected: |
67 | bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE; | 71 | bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE; |
68 | 72 | ||
diff --git a/framework/src/sinkfabric.cpp b/framework/src/sinkfabric.cpp index 8231b7df..82351ebb 100644 --- a/framework/src/sinkfabric.cpp +++ b/framework/src/sinkfabric.cpp | |||
@@ -160,6 +160,7 @@ public: | |||
160 | default: | 160 | default: |
161 | message["message"] = "An unknown error occurred: " + notification.message; | 161 | message["message"] = "An unknown error occurred: " + notification.message; |
162 | } | 162 | } |
163 | Fabric::Fabric{}.postMessage("errorNotification", message); | ||
163 | } else if (notification.type == Sink::Notification::Info) { | 164 | } else if (notification.type == Sink::Notification::Info) { |
164 | if (notification.code == Sink::ApplicationDomain::TransmissionSuccess) { | 165 | if (notification.code == Sink::ApplicationDomain::TransmissionSuccess) { |
165 | message["type"] = Notification::Info; | 166 | message["type"] = Notification::Info; |
@@ -170,6 +171,10 @@ public: | |||
170 | } else if (notification.type == Sink::Notification::Progress) { | 171 | } else if (notification.type == Sink::Notification::Progress) { |
171 | message["progress"] = notification.progress; | 172 | message["progress"] = notification.progress; |
172 | message["total"] = notification.total; | 173 | message["total"] = notification.total; |
174 | if (!notification.entities.isEmpty()) { | ||
175 | message["folderId"] = notification.entities.first(); | ||
176 | } | ||
177 | message["resourceId"] = notification.resource; | ||
173 | Fabric::Fabric{}.postMessage("progressNotification", message); | 178 | Fabric::Fabric{}.postMessage("progressNotification", message); |
174 | return; | 179 | return; |
175 | } else { | 180 | } else { |