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

KIO

kssld_dbusmetatypes.h

Go to the documentation of this file.
00001 /*
00002     This file is part of the KDE libraries
00003 
00004     Copyright (c) 2007 Andreas Hartmetz <ahartmetz@gmail.com>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 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     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef KSSLD_DBUSMETATYPES_H
00023 #define KSSLD_DBUSMETATYPES_H
00024 
00025 Q_DECLARE_METATYPE(QSslCertificate)
00026 Q_DECLARE_METATYPE(KSslCertificateRule)
00027 Q_DECLARE_METATYPE(QList<QSslCertificate>)
00028 Q_DECLARE_METATYPE(KSslError::Error)
00029 Q_DECLARE_METATYPE(QList<KSslError::Error>)
00030 
00031 
00032 QDBusArgument &operator<<(QDBusArgument &argument, const QSslCertificate &cert)
00033 {
00034     argument.beginStructure();
00035     argument << cert.toDer();
00036     argument.endStructure();
00037     return argument;
00038 }
00039 
00040 
00041 const QDBusArgument &operator>>(const QDBusArgument &argument, QSslCertificate &cert)
00042 {
00043     QByteArray data;
00044     argument.beginStructure();
00045     argument >> data;
00046     argument.endStructure();
00047     cert = QSslCertificate(data, QSsl::Der);
00048     return argument;
00049 }
00050 
00051 
00052 QDBusArgument &operator<<(QDBusArgument &argument, const KSslCertificateRule &rule)
00053 {
00054     argument.beginStructure();
00055     argument << rule.certificate() << rule.hostName()
00056              << rule.isRejected() << rule.expiryDateTime().toString(Qt::ISODate)
00057              << rule.ignoredErrors();
00058     argument.endStructure();
00059     return argument;
00060 }
00061 
00062 
00063 const QDBusArgument &operator>>(const QDBusArgument &argument, KSslCertificateRule &rule)
00064 {
00065     QSslCertificate cert;
00066     QString hostName;
00067     bool isRejected;
00068     QString expiryStr;
00069     QList<KSslError::Error> ignoredErrors;
00070     argument.beginStructure();
00071     argument >> cert >> hostName >> isRejected >> expiryStr >> ignoredErrors;
00072     argument.endStructure();
00073 
00074     KSslCertificateRule ret(cert, hostName);
00075     ret.setRejected(isRejected);
00076     ret.setExpiryDateTime(QDateTime::fromString(expiryStr, Qt::ISODate));
00077     ret.setIgnoredErrors(ignoredErrors);
00078     rule = ret;
00079     return argument;
00080 }
00081 
00082 
00083 QDBusArgument &operator<<(QDBusArgument &argument, const KSslError::Error &error)
00084 {
00085     argument.beginStructure();  //overhead ho!
00086     argument << static_cast<int>(error);
00087     argument.endStructure();
00088     return argument;
00089 }
00090 
00091 
00092 const QDBusArgument &operator>>(const QDBusArgument &argument, KSslError::Error &error)
00093 {
00094     int data;
00095     argument.beginStructure();
00096     argument >> data;
00097     argument.endStructure();
00098     error = static_cast<KSslError::Error>(data);
00099     return argument;
00100 }
00101 
00102 
00103 static void registerMetaTypesForKSSLD()
00104 {
00105     qDBusRegisterMetaType<QSslCertificate>();
00106     qDBusRegisterMetaType<KSslCertificateRule>();
00107     qDBusRegisterMetaType<QList<QSslCertificate> >();
00108     qDBusRegisterMetaType<KSslError::Error>();
00109     qDBusRegisterMetaType<QList<KSslError::Error> >();
00110 }
00111 
00112 #endif //KSSLD_DBUSMETATYPES_H

KIO

Skip menu "KIO"
  • 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
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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