• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KNewStuff

security.h

Go to the documentation of this file.
00001 /*
00002     This file is part of KNewStuff2.
00003     Copyright (c) 2004, 2005 Andras Mantia <amantia@kde.org>
00004     Copyright (c) 2007 Josef Spillner <spillner@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Lesser General Public
00008     License as published by the Free Software Foundation; either
00009     version 2.1 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Lesser General Public License for more details.
00015 
00016     You should have received a copy of the GNU Lesser General Public
00017     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
00018 */
00019 #ifndef KNEWSTUFF2_SECURITY_H
00020 #define KNEWSTUFF2_SECURITY_H
00021 
00022 //qt includes
00023 #include <QtCore/QMap>
00024 #include <QtCore/QObject>
00025 #include <QtCore/QProcess>
00026 
00027 struct KeyStruct {
00028     QString id;
00029     QString name;
00030     QString mail;
00031     bool trusted;
00032     bool secret;
00033 };
00034 
00035 class KProcess;
00036 namespace KNS
00037 {
00038 
00047 class Security : public QObject
00048 {
00049     Q_OBJECT
00050 public:
00051     static Security* ref() {
00052         static Security *m_ref;
00053         if (!m_ref) m_ref = new Security();
00054         return m_ref;
00055     }
00056     ~Security();
00057 
00058 
00064     void checkValidity(const QString &fileName);
00065 
00072     void signFile(const QString &fileName);
00073 
00080     KeyStruct signatureKey() {
00081         return m_signatureKey;
00082     }
00083 
00084     enum Results {
00085         MD5_OK = 1, 
00086         SIGNED_OK = 2, 
00087         SIGNED_BAD = 4, 
00088         TRUSTED = 8, 
00089         UNKNOWN = 16, 
00090         SIGNED_BAD_CLEAR = 27, 
00091         BAD_PASSPHRASE = 32 
00092     };
00093 
00094 public Q_SLOTS:
00095 
00097     void readKeys();
00098 
00100     void readSecretKeys();
00101 
00104     void slotCheckValidity();
00105 
00109     void slotSignFile();
00110 
00111 private:
00112     Security();
00113 
00114     enum RunMode {
00115         List = 0, 
00116         ListSecret, 
00117         Verify, 
00118         Sign 
00119     };
00120 
00121     KeyStruct m_signatureKey;
00122     int m_result;
00123     int m_runMode;
00124     bool m_gpgRunning; 
00125     bool m_keysRead; 
00126     QMap<QString, KeyStruct> m_keys; 
00127     QString m_fileName; 
00128     QString m_secretKey; 
00129     KProcess *m_process;
00130 
00131 private Q_SLOTS:
00132     void slotFinished(int exitCode, QProcess::ExitStatus exitStatus);
00133     void slotReadyReadStandardOutput();
00134 
00135 Q_SIGNALS:
00140     void validityResult(int result);
00141 
00146     void fileSigned(int result);
00147 };
00148 
00149 }
00150 
00151 #endif

KNewStuff

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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