Changeset View
Changeset View
Standalone View
Standalone View
src/crypto/gui/signencryptwidget.cpp
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | |||||
44 | #include <QScrollBar> | 44 | #include <QScrollBar> | ||
45 | 45 | | |||
46 | #include <Libkleo/DefaultKeyFilter> | 46 | #include <Libkleo/DefaultKeyFilter> | ||
47 | #include <Libkleo/KeyCache> | 47 | #include <Libkleo/KeyCache> | ||
48 | #include <Libkleo/KeyListModel> | 48 | #include <Libkleo/KeyListModel> | ||
49 | #include <Libkleo/KeySelectionCombo> | 49 | #include <Libkleo/KeySelectionCombo> | ||
50 | #include <Libkleo/KeyListSortFilterProxyModel> | 50 | #include <Libkleo/KeyListSortFilterProxyModel> | ||
51 | 51 | | |||
52 | #include <utils/gnupg-helper.h> | ||||
53 | | ||||
52 | #include <KLocalizedString> | 54 | #include <KLocalizedString> | ||
53 | #include <KConfigGroup> | 55 | #include <KConfigGroup> | ||
54 | #include <KSharedConfig> | 56 | #include <KSharedConfig> | ||
55 | 57 | | |||
56 | using namespace Kleo; | 58 | using namespace Kleo; | ||
57 | using namespace Kleo::Dialogs; | 59 | using namespace Kleo::Dialogs; | ||
58 | using namespace GpgME; | 60 | using namespace GpgME; | ||
59 | 61 | | |||
▲ Show 20 Lines • Show All 213 Lines • ▼ Show 20 Line(s) | 264 | { | |||
273 | } | 275 | } | ||
274 | const Key k = selfKey(); | 276 | const Key k = selfKey(); | ||
275 | if (!k.isNull()) { | 277 | if (!k.isNull()) { | ||
276 | ret << k; | 278 | ret << k; | ||
277 | } | 279 | } | ||
278 | return ret; | 280 | return ret; | ||
279 | } | 281 | } | ||
280 | 282 | | |||
283 | bool SignEncryptWidget::isDeVsAndValid() const | ||||
284 | { | ||||
285 | if (! signKey().isNull() | ||||
aheinecke: Minor style with the "! " | |||||
286 | && (! IS_DE_VS(signKey()) || keyValidity(signKey()) < GpgME::UserID::Validity::Full)) | ||||
287 | return false; | ||||
288 | | ||||
289 | if (! selfKey().isNull() | ||||
290 | && (! IS_DE_VS(selfKey()) | ||||
291 | || keyValidity(selfKey()) < GpgME::UserID::Validity::Full)) | ||||
292 | return false; | ||||
293 | | ||||
294 | for (const auto &key: recipients()) | ||||
295 | if (! IS_DE_VS(key) || keyValidity(key) < GpgME::UserID::Validity::Full) | ||||
296 | return false; | ||||
297 | | ||||
298 | return true; | ||||
299 | } | ||||
300 | | ||||
281 | void SignEncryptWidget::updateOp() | 301 | void SignEncryptWidget::updateOp() | ||
282 | { | 302 | { | ||
283 | const Key sigKey = signKey(); | 303 | const Key sigKey = signKey(); | ||
284 | const QVector<Key> recp = recipients(); | 304 | const QVector<Key> recp = recipients(); | ||
285 | 305 | | |||
286 | QString newOp; | 306 | QString newOp; | ||
287 | if (!sigKey.isNull() && (!recp.isEmpty() || encryptSymmetric())) { | 307 | if (!sigKey.isNull() && (!recp.isEmpty() || encryptSymmetric())) { | ||
288 | newOp = i18nc("@action", "Sign / Encrypt"); | 308 | newOp = i18nc("@action", "Sign / Encrypt"); | ||
289 | } else if (!recp.isEmpty() || encryptSymmetric()) { | 309 | } else if (!recp.isEmpty() || encryptSymmetric()) { | ||
290 | newOp = i18nc("@action", "Encrypt"); | 310 | newOp = i18nc("@action", "Encrypt"); | ||
291 | } else if (!sigKey.isNull()) { | 311 | } else if (!sigKey.isNull()) { | ||
292 | newOp = i18nc("@action", "Sign"); | 312 | newOp = i18nc("@action", "Sign"); | ||
293 | } else { | 313 | } else { | ||
294 | newOp = QString(); | 314 | newOp = QString(); | ||
295 | } | 315 | } | ||
296 | if (newOp != mOp) { | | |||
297 | mOp = newOp; | 316 | mOp = newOp; | ||
298 | Q_EMIT operationChanged(mOp); | 317 | Q_EMIT operationChanged(mOp); | ||
299 | } | | |||
300 | Q_EMIT keysChanged(); | 318 | Q_EMIT keysChanged(); | ||
301 | } | 319 | } | ||
302 | 320 | | |||
303 | QString SignEncryptWidget::currentOp() const | 321 | QString SignEncryptWidget::currentOp() const | ||
304 | { | 322 | { | ||
305 | return mOp; | 323 | return mOp; | ||
306 | } | 324 | } | ||
307 | 325 | | |||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |
Minor style with the "! "