diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-11-27 14:56:49 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-11-27 14:57:46 +0100 |
commit | 29846c929e742f875983db249f54d882560ecf74 (patch) | |
tree | 33d13b211aeb798758bd260abef465c020cfa376 | |
parent | f232ff26c961768b2276f44100f522be243c598b (diff) | |
download | kube-29846c929e742f875983db249f54d882560ecf74.tar.gz kube-29846c929e742f875983db249f54d882560ecf74.zip |
Disable encryption buttons if keys are missing
-rw-r--r-- | components/kube/contents/ui/ComposerView.qml | 8 | ||||
-rw-r--r-- | framework/src/domain/composercontroller.cpp | 1 | ||||
-rw-r--r-- | framework/src/domain/composercontroller.h | 1 |
3 files changed, 10 insertions, 0 deletions
diff --git a/components/kube/contents/ui/ComposerView.qml b/components/kube/contents/ui/ComposerView.qml index 520b8113..0b81ab2a 100644 --- a/components/kube/contents/ui/ComposerView.qml +++ b/components/kube/contents/ui/ComposerView.qml | |||
@@ -445,6 +445,7 @@ Kube.View { | |||
445 | } | 445 | } |
446 | 446 | ||
447 | RowLayout { | 447 | RowLayout { |
448 | enabled: composerController.encryptionAvailable | ||
448 | Kube.CheckBox { | 449 | Kube.CheckBox { |
449 | id: encryptCheckbox | 450 | id: encryptCheckbox |
450 | checked: composerController.encrypt | 451 | checked: composerController.encrypt |
@@ -455,6 +456,7 @@ Kube.View { | |||
455 | } | 456 | } |
456 | 457 | ||
457 | RowLayout { | 458 | RowLayout { |
459 | enabled: composerController.encryptionAvailable | ||
458 | Kube.CheckBox { | 460 | Kube.CheckBox { |
459 | id: signCheckbox | 461 | id: signCheckbox |
460 | checked: composerController.sign | 462 | checked: composerController.sign |
@@ -463,6 +465,12 @@ Kube.View { | |||
463 | text: qsTr("sign") | 465 | text: qsTr("sign") |
464 | } | 466 | } |
465 | } | 467 | } |
468 | Kube.Label { | ||
469 | visible: !composerController.encryptionAvailable | ||
470 | Layout.maximumWidth: parent.width | ||
471 | text: qsTr("Encryption is not available because your personal key has not been found.") | ||
472 | wrapMode: Text.Wrap | ||
473 | } | ||
466 | 474 | ||
467 | RowLayout { | 475 | RowLayout { |
468 | Layout.maximumWidth: parent.width | 476 | Layout.maximumWidth: parent.width |
diff --git a/framework/src/domain/composercontroller.cpp b/framework/src/domain/composercontroller.cpp index 01aba8c7..4ec1a72c 100644 --- a/framework/src/domain/composercontroller.cpp +++ b/framework/src/domain/composercontroller.cpp | |||
@@ -297,6 +297,7 @@ void ComposerController::findPersonalKey() | |||
297 | SinkLog() << "Found personal key: " << mPersonalKeys.front().primaryFingerprint(); | 297 | SinkLog() << "Found personal key: " << mPersonalKeys.front().primaryFingerprint(); |
298 | } | 298 | } |
299 | updateSendAction(); | 299 | updateSendAction(); |
300 | setEncryptionAvailable(!mPersonalKeys.empty()); | ||
300 | }); | 301 | }); |
301 | } | 302 | } |
302 | 303 | ||
diff --git a/framework/src/domain/composercontroller.h b/framework/src/domain/composercontroller.h index 00386c5c..995f4a2e 100644 --- a/framework/src/domain/composercontroller.h +++ b/framework/src/domain/composercontroller.h | |||
@@ -57,6 +57,7 @@ class ComposerController : public Kube::Controller | |||
57 | KUBE_CONTROLLER_PROPERTY(bool, HtmlBody, htmlBody) | 57 | KUBE_CONTROLLER_PROPERTY(bool, HtmlBody, htmlBody) |
58 | KUBE_CONTROLLER_PROPERTY(bool, Encrypt, encrypt) | 58 | KUBE_CONTROLLER_PROPERTY(bool, Encrypt, encrypt) |
59 | KUBE_CONTROLLER_PROPERTY(bool, Sign, sign) | 59 | KUBE_CONTROLLER_PROPERTY(bool, Sign, sign) |
60 | KUBE_CONTROLLER_PROPERTY(bool, EncryptionAvailable, encryptionAvailable) | ||
60 | 61 | ||
61 | //Set by identitySelector | 62 | //Set by identitySelector |
62 | KUBE_CONTROLLER_PROPERTY(KMime::Types::Mailbox, Identity, identity) | 63 | KUBE_CONTROLLER_PROPERTY(KMime::Types::Mailbox, Identity, identity) |