diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-25 12:16:05 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-25 14:03:13 +0100 |
commit | 27ab6710b6626517d1386cd90ca9065d3d36f370 (patch) | |
tree | 63ff68ac8f7dc6156f57f6dd3f5f190a96b8797d | |
parent | ad10788ac3a60bffe053cec172e0e750f393905a (diff) | |
download | kube-27ab6710b6626517d1386cd90ca9065d3d36f370.tar.gz kube-27ab6710b6626517d1386cd90ca9065d3d36f370.zip |
Require a recipient for a mail.
-rw-r--r-- | framework/src/domain/controller.cpp | 13 | ||||
-rw-r--r-- | framework/src/domain/controller.h | 4 | ||||
-rw-r--r-- | views/composer/qml/View.qml | 2 |
3 files changed, 17 insertions, 2 deletions
diff --git a/framework/src/domain/controller.cpp b/framework/src/domain/controller.cpp index 515cfab0..226615ad 100644 --- a/framework/src/domain/controller.cpp +++ b/framework/src/domain/controller.cpp | |||
@@ -107,6 +107,9 @@ void ListPropertyController::add(const QVariantMap &value) | |||
107 | item->setData(value.value(k), mRoles[k]); | 107 | item->setData(value.value(k), mRoles[k]); |
108 | } | 108 | } |
109 | mModel->appendRow(QList<QStandardItem*>() << item); | 109 | mModel->appendRow(QList<QStandardItem*>() << item); |
110 | if (mModel->rowCount() <= 1) { | ||
111 | emit emptyChanged(); | ||
112 | } | ||
110 | emit added(id, value); | 113 | emit added(id, value); |
111 | } | 114 | } |
112 | 115 | ||
@@ -117,9 +120,17 @@ void ListPropertyController::remove(const QByteArray &id) | |||
117 | for (int row = 0; row < root->rowCount(); row++) { | 120 | for (int row = 0; row < root->rowCount(); row++) { |
118 | if (root->child(row, 0)->data(idRole).toByteArray() == id) { | 121 | if (root->child(row, 0)->data(idRole).toByteArray() == id) { |
119 | root->removeRow(row); | 122 | root->removeRow(row); |
120 | return; | 123 | break; |
121 | } | 124 | } |
122 | } | 125 | } |
126 | if (mModel->rowCount() <= 0) { | ||
127 | emit emptyChanged(); | ||
128 | } | ||
129 | } | ||
130 | |||
131 | bool ListPropertyController::empty() const | ||
132 | { | ||
133 | return mModel->rowCount() == 0; | ||
123 | } | 134 | } |
124 | 135 | ||
125 | void ListPropertyController::clear() | 136 | void ListPropertyController::clear() |
diff --git a/framework/src/domain/controller.h b/framework/src/domain/controller.h index ba7ac8fe..5f610012 100644 --- a/framework/src/domain/controller.h +++ b/framework/src/domain/controller.h | |||
@@ -109,6 +109,7 @@ class ListPropertyController : public QObject | |||
109 | { | 109 | { |
110 | Q_OBJECT | 110 | Q_OBJECT |
111 | Q_PROPERTY(QAbstractItemModel* model READ model CONSTANT) | 111 | Q_PROPERTY(QAbstractItemModel* model READ model CONSTANT) |
112 | Q_PROPERTY(bool empty READ empty NOTIFY emptyChanged) | ||
112 | 113 | ||
113 | public: | 114 | public: |
114 | ListPropertyController(const QStringList &roles); | 115 | ListPropertyController(const QStringList &roles); |
@@ -132,8 +133,11 @@ public: | |||
132 | return list; | 133 | return list; |
133 | } | 134 | } |
134 | 135 | ||
136 | bool empty() const; | ||
137 | |||
135 | Q_SIGNALS: | 138 | Q_SIGNALS: |
136 | void added(QByteArray, QVariantMap); | 139 | void added(QByteArray, QVariantMap); |
140 | void emptyChanged(); | ||
137 | 141 | ||
138 | protected: | 142 | protected: |
139 | QScopedPointer<QStandardItemModel> mModel; | 143 | QScopedPointer<QStandardItemModel> mModel; |
diff --git a/views/composer/qml/View.qml b/views/composer/qml/View.qml index 1eb88bb4..6fd3d07a 100644 --- a/views/composer/qml/View.qml +++ b/views/composer/qml/View.qml | |||
@@ -44,7 +44,7 @@ Kube.View { | |||
44 | 44 | ||
45 | property bool foundAllKeys: to.foundAllKeys && cc.foundAllKeys && bcc.foundAllKeys | 45 | property bool foundAllKeys: to.foundAllKeys && cc.foundAllKeys && bcc.foundAllKeys |
46 | 46 | ||
47 | sendAction.enabled: composerController.accountId && composerController.subject && (!composerController.encrypt || composerController.foundAllKeys) && (!composerController.sign && !composerController.encrypt || composerController.foundPersonalKeys) | 47 | sendAction.enabled: composerController.accountId && composerController.subject && (!composerController.encrypt || composerController.foundAllKeys) && (!composerController.sign && !composerController.encrypt || composerController.foundPersonalKeys) && !composerController.to.empty |
48 | saveAsDraftAction.enabled: composerController.accountId | 48 | saveAsDraftAction.enabled: composerController.accountId |
49 | } | 49 | } |
50 | ] | 50 | ] |