File indexing completed on 2024-04-28 15:21:51

0001 /*  This file is part of the KDE project
0002     Copyright (C) 2010 Andreas Hartmetz <ahartmetz@gmail.com>
0003 
0004     This library is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU Library General Public
0006     License as published by the Free Software Foundation; either
0007     version 2 of the License, or (at your option) any later version.
0008 
0009     This program is distributed in the hope that it will be useful,
0010     but WITHOUT ANY WARRANTY; without even the implied warranty of
0011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012     GNU General Public License for more details.
0013 
0014     You should have received a copy of the GNU General Public License
0015     along with this program; if not, write to the Free Software
0016     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0017     02110-1301, USA.
0018 */
0019 
0020 #ifndef CACERTIFICATESPAGE_H
0021 #define CACERTIFICATESPAGE_H
0022 
0023 #include "ui_cacertificates.h"
0024 
0025 #include <QWidget>
0026 
0027 class QTreeWidgetItem;
0028 struct KSslCaCertificate;
0029 
0030 class CaCertificatesPage : public QWidget
0031 {
0032     Q_OBJECT
0033 public:
0034     CaCertificatesPage(QWidget *parent);
0035 
0036     void load();
0037     void save();
0038     void defaults();
0039 
0040 private Q_SLOTS:
0041     void itemSelectionChanged();
0042 
0043     void displaySelectionClicked();
0044     void disableSelectionClicked();
0045     void enableSelectionClicked();
0046     void removeSelectionClicked();
0047     void addCertificateClicked();
0048     void itemChanged(QTreeWidgetItem *item, int column);
0049 
0050 Q_SIGNALS:
0051     void changed(bool state);
0052 
0053 protected:
0054     void showEvent(QShowEvent *event) override;
0055 
0056 private:
0057     bool addCertificateItem(const KSslCaCertificate &caCert);
0058     void enableDisableSelectionClicked(bool isEnable);
0059 
0060     Ui::CaCertificatesPage m_ui;
0061     QTreeWidgetItem *m_systemCertificatesParent;
0062     QTreeWidgetItem *m_userCertificatesParent;
0063     QSet<QByteArray> m_knownCertificates;
0064     bool m_firstShowEvent;
0065     bool m_blockItemChanged;
0066 };
0067 
0068 #endif