libkleo
directoryserviceswidget.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef DIRECTORYSERVICESWIDGET_H
00034 #define DIRECTORYSERVICESWIDGET_H
00035
00036 #include "kleo/kleo_export.h"
00037 #include <kurl.h>
00038 #include <QtGui/QWidget>
00039
00040 namespace Kleo {
00041
00042 class KLEO_EXPORT DirectoryServicesWidget : public QWidget {
00043 Q_OBJECT
00044 public:
00045 explicit DirectoryServicesWidget( QWidget * parent=0, Qt::WindowFlags f=0 );
00046 ~DirectoryServicesWidget();
00047
00048 enum Scheme {
00049 NoScheme = 0,
00050 HKP = 1,
00051 HTTP = 2,
00052 FTP = 4,
00053 LDAP = 8,
00054
00055 AllSchemes = HKP|HTTP|FTP|LDAP
00056 };
00057 Q_DECLARE_FLAGS( Schemes, Scheme )
00058
00059 enum Protocol {
00060 NoProtocol = 0,
00061 X509Protocol = 1,
00062 OpenPGPProtocol = 2,
00063
00064 AllProtocols = X509Protocol|OpenPGPProtocol
00065 };
00066 Q_DECLARE_FLAGS( Protocols, Protocol )
00067
00068 void setAllowedSchemes( Schemes schemes );
00069 Schemes allowedSchemes() const;
00070
00071 void setAllowedProtocols( Protocols protocols );
00072 Protocols allowedProtocols() const;
00073
00074 void setX509Allowed( bool allowed );
00075 void setOpenPGPAllowed( bool allowed );
00076
00077 void setReadOnlyProtocols( Protocols protocols );
00078 Protocols readOnlyProtocols() const;
00079
00080 void setOpenPGPReadOnly( bool ro );
00081 void setX509ReadOnly( bool ro );
00082
00083 void addOpenPGPServices( const KUrl::List& urls );
00084 KUrl::List openPGPServices() const;
00085
00086 void addX509Services( const KUrl::List& urls );
00087 KUrl::List x509Services() const;
00088
00089 public Q_SLOTS:
00090 void clear();
00091
00092 Q_SIGNALS:
00093 void changed();
00094
00095 private:
00096 class Private;
00097 Private * const d;
00098 Q_PRIVATE_SLOT( d, void slotNewClicked() )
00099 Q_PRIVATE_SLOT( d, void slotNewX509Clicked() )
00100 Q_PRIVATE_SLOT( d, void slotNewOpenPGPClicked() )
00101 Q_PRIVATE_SLOT( d, void slotDeleteClicked() )
00102 Q_PRIVATE_SLOT( d, void slotSelectionChanged() )
00103 Q_PRIVATE_SLOT( d, void slotShowUserAndPasswordToggled(bool) )
00104 };
00105
00106 }
00107
00108 inline void Kleo::DirectoryServicesWidget::setOpenPGPAllowed( bool allowed ) {
00109 if ( allowed )
00110 setAllowedProtocols( allowedProtocols() | OpenPGPProtocol );
00111 else
00112 setAllowedProtocols( allowedProtocols() & ~OpenPGPProtocol );
00113 }
00114
00115 inline void Kleo::DirectoryServicesWidget::setX509Allowed( bool allowed ) {
00116 if ( allowed )
00117 setAllowedProtocols( allowedProtocols() | X509Protocol );
00118 else
00119 setAllowedProtocols( allowedProtocols() & ~X509Protocol );
00120 }
00121
00122 inline void Kleo::DirectoryServicesWidget::setOpenPGPReadOnly( bool ro ) {
00123 if ( ro )
00124 setReadOnlyProtocols( readOnlyProtocols() | OpenPGPProtocol );
00125 else
00126 setReadOnlyProtocols( readOnlyProtocols() & ~OpenPGPProtocol );
00127 }
00128
00129 inline void Kleo::DirectoryServicesWidget::setX509ReadOnly( bool ro ) {
00130 if ( ro )
00131 setReadOnlyProtocols( readOnlyProtocols() | X509Protocol );
00132 else
00133 setReadOnlyProtocols( readOnlyProtocols() & ~X509Protocol );
00134 }
00135
00136 #endif // DIRECTORYSERVICESWIDGET_H