File indexing completed on 2024-11-24 04:50:43
0001 // SPDX-FileCopyrightText: 2023 Claudio Cambra <claudio.cambra@kde.org> 0002 // SPDX-License-Identifier: GPL-2.0-or-later 0003 0004 #include "identitycryptographybackend.h" 0005 0006 #include "identitykeylistmodel.h" 0007 0008 IdentityCryptographyBackend::IdentityCryptographyBackend(QObject *parent) 0009 : QObject(parent) 0010 , KIdentityManagementQuick::CryptographyBackendInterface() 0011 , m_openPgpKeyListModel(new IdentityKeyListModel(this, IdentityKeyListModel::TypeKeys::OpenPGPTypeKeys)) 0012 , m_smimeKeyListModel(new IdentityKeyListModel(this, IdentityKeyListModel::TypeKeys::SMimeTypeKeys)) 0013 { 0014 } 0015 0016 QAbstractItemModel *IdentityCryptographyBackend::openPgpKeyListModel() const 0017 { 0018 return m_openPgpKeyListModel; 0019 } 0020 0021 QAbstractItemModel *IdentityCryptographyBackend::smimeKeyListModel() const 0022 { 0023 return m_smimeKeyListModel; 0024 } 0025 0026 KIdentityManagementCore::Identity IdentityCryptographyBackend::identity() const 0027 { 0028 return m_identity; 0029 } 0030 0031 void IdentityCryptographyBackend::setIdentity(const KIdentityManagementCore::Identity &identity) 0032 { 0033 if (identity == m_identity) { 0034 return; 0035 } 0036 0037 m_identity = identity; 0038 m_openPgpKeyListModel->setEmailFilter(identity.primaryEmailAddress()); 0039 m_smimeKeyListModel->setEmailFilter(identity.primaryEmailAddress()); 0040 } 0041 0042 #include "moc_identitycryptographybackend.cpp"