• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • kdecore
  • network
  • kssld
kssld_dbusmetatypes.h
Go to the documentation of this file.
1/*
2 This file is part of the KDE libraries
3
4 Copyright (c) 2007 Andreas Hartmetz <ahartmetz@gmail.com>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21
22#ifndef KSSLD_DBUSMETATYPES_H
23#define KSSLD_DBUSMETATYPES_H
24
25Q_DECLARE_METATYPE(QSslCertificate)
26Q_DECLARE_METATYPE(KSslCertificateRule)
27Q_DECLARE_METATYPE(QList<QSslCertificate>)
28Q_DECLARE_METATYPE(KSslError::Error)
29Q_DECLARE_METATYPE(QList<KSslError::Error>)
30
31
32QDBusArgument &operator<<(QDBusArgument &argument, const QSslCertificate &cert)
33{
34 argument.beginStructure();
35 argument << cert.toDer();
36 argument.endStructure();
37 return argument;
38}
39
40
41const QDBusArgument &operator>>(const QDBusArgument &argument, QSslCertificate &cert)
42{
43 QByteArray data;
44 argument.beginStructure();
45 argument >> data;
46 argument.endStructure();
47 cert = QSslCertificate(data, QSsl::Der);
48 return argument;
49}
50
51
52QDBusArgument &operator<<(QDBusArgument &argument, const KSslCertificateRule &rule)
53{
54 argument.beginStructure();
55 argument << rule.certificate() << rule.hostName()
56 << rule.isRejected() << rule.expiryDateTime().toString(Qt::ISODate)
57 << rule.ignoredErrors();
58 argument.endStructure();
59 return argument;
60}
61
62
63const QDBusArgument &operator>>(const QDBusArgument &argument, KSslCertificateRule &rule)
64{
65 QSslCertificate cert;
66 QString hostName;
67 bool isRejected;
68 QString expiryStr;
69 QList<KSslError::Error> ignoredErrors;
70 argument.beginStructure();
71 argument >> cert >> hostName >> isRejected >> expiryStr >> ignoredErrors;
72 argument.endStructure();
73
74 KSslCertificateRule ret(cert, hostName);
75 ret.setRejected(isRejected);
76 ret.setExpiryDateTime(QDateTime::fromString(expiryStr, Qt::ISODate));
77 ret.setIgnoredErrors(ignoredErrors);
78 rule = ret;
79 return argument;
80}
81
82
83QDBusArgument &operator<<(QDBusArgument &argument, const KSslError::Error &error)
84{
85 argument.beginStructure(); //overhead ho!
86 argument << static_cast<int>(error);
87 argument.endStructure();
88 return argument;
89}
90
91
92const QDBusArgument &operator>>(const QDBusArgument &argument, KSslError::Error &error)
93{
94 int data;
95 argument.beginStructure();
96 argument >> data;
97 argument.endStructure();
98 error = static_cast<KSslError::Error>(data);
99 return argument;
100}
101
102
103static void registerMetaTypesForKSSLD()
104{
105 qDBusRegisterMetaType<QSslCertificate>();
106 qDBusRegisterMetaType<KSslCertificateRule>();
107 qDBusRegisterMetaType<QList<QSslCertificate> >();
108 qDBusRegisterMetaType<KSslError::Error>();
109 qDBusRegisterMetaType<QList<KSslError::Error> >();
110}
111
112#endif //KSSLD_DBUSMETATYPES_H
KSslCertificateRule
Definition: ksslcertificatemanager.h:38
KSslCertificateRule::expiryDateTime
QDateTime expiryDateTime() const
Definition: ksslcertificatemanager.cpp:116
KSslCertificateRule::setRejected
void setRejected(bool rejected)
Definition: ksslcertificatemanager.cpp:122
KSslCertificateRule::hostName
QString hostName() const
Definition: ksslcertificatemanager.cpp:104
KSslCertificateRule::ignoredErrors
QList< KSslError::Error > ignoredErrors() const
Definition: ksslcertificatemanager.cpp:163
KSslCertificateRule::certificate
QSslCertificate certificate() const
Definition: ksslcertificatemanager.cpp:98
KSslCertificateRule::setExpiryDateTime
void setExpiryDateTime(const QDateTime &dateTime)
Definition: ksslcertificatemanager.cpp:110
KSslCertificateRule::isRejected
bool isRejected() const
Definition: ksslcertificatemanager.cpp:128
KSslCertificateRule::setIgnoredErrors
void setIgnoredErrors(const QList< KSslError::Error > &errors)
Definition: ksslcertificatemanager.cpp:144
KSslError::Error
Error
Definition: ktcpsocket.h:101
QList
Definition: kaboutdata.h:33
QString
operator<<
QDBusArgument & operator<<(QDBusArgument &argument, const QSslCertificate &cert)
Definition: kssld_dbusmetatypes.h:32
operator>>
const QDBusArgument & operator>>(const QDBusArgument &argument, QSslCertificate &cert)
Definition: kssld_dbusmetatypes.h:41
registerMetaTypesForKSSLD
static void registerMetaTypesForKSSLD()
Definition: kssld_dbusmetatypes.h:103
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal