From 1e7c7c9c425eda25fe12b61f19b899ed28e9771f Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> Date: Tue, 5 May 2015 14:13:13 -0400 Subject: [PATCH] ciphers: Fix the default cipher option * Also add a 'modified' signal to make it easier to the clients to track the property change * Add a missing comment (for conformance with the coding guidelines) Refs #72494 (cherry picked from commit 721a154849bca53ec7df8c566e3a9bc15bc61b62) --- src/ciphermodel.cpp | 9 +++++++-- src/ciphermodel.h | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ciphermodel.cpp b/src/ciphermodel.cpp index 38f7430a..2da3db30 100644 --- a/src/ciphermodel.cpp +++ b/src/ciphermodel.cpp @@ -60,8 +60,10 @@ CipherModelPrivate::CipherModelPrivate(Account* parent) : m_pAccount(parent),m_U m_lChecked = new bool[m_slSupportedCiphers.size()]{}; foreach(const QString& cipher, parent->d_ptr->accountDetail(DRing::Account::ConfProperties::TLS::CIPHERS).split(' ')) { - m_lChecked[m_shMapping[cipher]] = true; - m_UseDefault = false; + if (!cipher.trimmed().isEmpty()) { + m_lChecked[m_shMapping[cipher]] = true; + m_UseDefault = false; + } } } @@ -131,6 +133,9 @@ bool CipherModel::setData( const QModelIndex& index, const QVariant &value, int ciphers << d_ptr->m_slSupportedCiphers[i]; } d_ptr->m_pAccount->d_ptr->setAccountProperty(DRing::Account::ConfProperties::TLS::CIPHERS,ciphers.join(QString(' '))); + + emit modified(); + return true; } return false; diff --git a/src/ciphermodel.h b/src/ciphermodel.h index c340071e..5e0690fa 100644 --- a/src/ciphermodel.h +++ b/src/ciphermodel.h @@ -42,6 +42,7 @@ class LIB_EXPORT CipherModel : public QAbstractListModel { public: + //Property Q_PROPERTY(bool useDefault READ useDefault WRITE setUseDefault) //Model functions @@ -66,6 +67,9 @@ private: CipherModelPrivate* d_ptr; Q_DECLARE_PRIVATE(CipherModel) +Q_SIGNALS: + void modified(); + }; Q_DECLARE_METATYPE(CipherModel*) #endif -- GitLab