• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • KDE Support
  • Sitemap
  • Contact Us
 

qca

certitem.h

Go to the documentation of this file.
00001 /*
00002  Copyright (C) 2007 Justin Karneges <justin@affinix.com>
00003 
00004  Permission is hereby granted, free of charge, to any person obtaining a copy
00005  of this software and associated documentation files (the "Software"), to deal
00006  in the Software without restriction, including without limitation the rights
00007  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00008  copies of the Software, and to permit persons to whom the Software is
00009  furnished to do so, subject to the following conditions:
00010 
00011  The above copyright notice and this permission notice shall be included in
00012  all copies or substantial portions of the Software.
00013 
00014  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
00017  AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00018  AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00019  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00020 */
00021 
00022 #ifndef CERTITEM_H
00023 #define CERTITEM_H
00024 
00025 #include <QAbstractListModel>
00026 #include <QSharedDataPointer>
00027 
00028 class QString;
00029 class QStringList;
00030 
00031 namespace QCA
00032 {
00033     class PrivateKey;
00034     class CertificateChain;
00035     class KeyStoreEntry;
00036 }
00037 
00038 class CertItemStore;
00039 class CertItemStorePrivate;
00040 class CertItemPrivateLoaderPrivate;
00041 
00042 class CertItem
00043 {
00044 public:
00045     enum StorageType
00046     {
00047         File,
00048         KeyStore
00049     };
00050 
00051     CertItem();
00052     CertItem(const CertItem &from);
00053     ~CertItem();
00054     CertItem & operator=(const CertItem &from);
00055 
00056     QString name() const;
00057     QCA::CertificateChain certificateChain() const;
00058     bool havePrivate() const;
00059     StorageType storageType() const; // private key storage type
00060     bool isUsable() const; // file/provider present
00061 
00062 private:
00063     class Private;
00064     QSharedDataPointer<Private> d;
00065 
00066     friend class CertItemStore;
00067     friend class CertItemStorePrivate;
00068     friend class CertItemPrivateLoader;
00069     friend class CertItemPrivateLoaderPrivate;
00070 };
00071 
00072 class CertItemStore : public QAbstractListModel
00073 {
00074     Q_OBJECT
00075 public:
00076     enum IconType
00077     {
00078         IconCert,
00079         IconCrl,
00080         IconKeyBundle,
00081         IconPgpPub,
00082         IconPgpSec
00083     };
00084 
00085     CertItemStore(QObject *parent = 0);
00086     ~CertItemStore();
00087 
00088     int idFromRow(int row) const;
00089     int rowFromId(int id) const;
00090     CertItem itemFromId(int id) const;
00091     CertItem itemFromRow(int row) const;
00092 
00093     QList<CertItem> items() const;
00094 
00095     QStringList save() const;
00096     bool load(const QStringList &in);
00097 
00098     // returns a reqId
00099     int addFromFile(const QString &fileName);
00100     int addFromKeyStore(const QCA::KeyStoreEntry &entry);
00101     int addUser(const QCA::CertificateChain &chain);
00102 
00103     void updateChain(int id, const QCA::CertificateChain &chain);
00104 
00105     void removeItem(int id);
00106 
00107     void setIcon(IconType type, const QPixmap &icon);
00108 
00109     // reimplemented
00110     int rowCount(const QModelIndex &parent = QModelIndex()) const;
00111     QVariant data(const QModelIndex &index, int role) const;
00112     Qt::ItemFlags flags(const QModelIndex &index) const;
00113     bool setData(const QModelIndex &index, const QVariant &value, int role);
00114 
00115 signals:
00116     void addSuccess(int reqId, int id);
00117     void addFailed(int reqId);
00118 
00119 private:
00120     friend class CertItemStorePrivate;
00121     CertItemStorePrivate *d;
00122 
00123     friend class CertItemPrivateLoader;
00124     friend class CertItemPrivateLoaderPrivate;
00125 };
00126 
00127 class CertItemPrivateLoader : public QObject
00128 {
00129     Q_OBJECT
00130 public:
00131     explicit CertItemPrivateLoader(CertItemStore *store, QObject *parent = 0);
00132     ~CertItemPrivateLoader();
00133 
00134     void start(int id);
00135 
00136     QCA::PrivateKey privateKey() const;
00137 
00138 signals:
00139     void finished();
00140 
00141 private:
00142     friend class CertItemPrivateLoaderPrivate;
00143     CertItemPrivateLoaderPrivate *d;
00144 };
00145 
00146 #endif

qca

Skip menu "qca"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE Support

Skip menu "KDE Support"
  • akonadi
  • Decibel
  • grantlee
  • kdewin
  • phonon
  •     Backend
  • polkit-qt
  • qca
  • qimageblitz
  • soprano
  • strigi
  •     searchclient
  •     streamanalyzer
  •     streams
Generated for KDE Support by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal