00001
#ifdef HAVE_CONFIG_H
00002
#include <config.h>
00003
#endif
00004
00005
#include "certificatehandlingdialogimpl.h"
00006
#include "certificatewizardimpl.h"
00007
00008
#include <qlistview.h>
00009
#include <qpopupmenu.h>
00010
#include <qpushbutton.h>
00011
#include <qlabel.h>
00012
00013
#include <klocale.h>
00014
#include <kdebug.h>
00015
00016
00017
00018
00019 CertificateHandlingDialogImpl::CertificateHandlingDialogImpl(
QWidget* parent,
const char* name, WFlags fl )
00020 : CertificateHandlingDialog( parent, name, fl )
00021 {
00022 }
00023
00024
00025
00026
00027 CertificateHandlingDialogImpl::~CertificateHandlingDialogImpl()
00028 {
00029
00030 }
00031
00032
00033
00034
00035
void CertificateHandlingDialogImpl::slotDeleteCertificate()
00036 {
00037
00038
00039
QListViewItem* item = certificatesLV->selectedItem();
00040 Q_ASSERT( item );
00041
delete item;
00042 }
00043
00044
00045
00046
00047
void CertificateHandlingDialogImpl::slotCertificateSelectionChanged(
QListViewItem* item )
00048 {
00049
if( item ) {
00050 requestPopup->setItemEnabled(1,
true);
00051 requestPopup->setItemEnabled(2,
true);
00052 deletePB->setEnabled(
true );
00053
if( item->text( 2 ) == i18n(
"Sign/Encrypt" ) ) {
00054 useForSigningPB->setEnabled(
true );
00055 useForEncryptingPB->setEnabled(
true );
00056 }
else if( item->text( 2 ) == i18n(
"Sign" ) ) {
00057 useForSigningPB->setEnabled(
true );
00058 useForEncryptingPB->setEnabled(
false );
00059 }
else if( item->text( 2 ) == i18n(
"Encrypt" ) ) {
00060 useForSigningPB->setEnabled(
false );
00061 useForEncryptingPB->setEnabled(
true );
00062 }
else {
00063
00064 useForSigningPB->setEnabled(
false );
00065 useForEncryptingPB->setEnabled(
false );
00066 }
00067 }
else {
00068 useForSigningPB->setEnabled(
false );
00069 useForEncryptingPB->setEnabled(
false );
00070 requestPopup->setItemEnabled(1,
false);
00071 requestPopup->setItemEnabled(2,
true);
00072 deletePB->setEnabled(
false );
00073 }
00074 }
00075
00076
00077
00078
00079
void CertificateHandlingDialogImpl::slotRequestChangedCertificate()
00080 {
00081
00082 kdWarning() <<
"CertificateHandlingDialogImpl::slotRequestChangedCertificate() not yet implemented!" << endl;
00083 }
00084
00085
00086
00087
00088
void CertificateHandlingDialogImpl::slotRequestExtendedCertificate()
00089 {
00090
00091 kdWarning() <<
"CertificateHandlingDialogImpl::slotRequestExtendedCertificate() not yet implemented!" << endl;
00092 }
00093
00094
00095
00096
00097
void CertificateHandlingDialogImpl::slotRequestNewCertificate()
00098 {
00099 CertificateWizardImpl wizard;
00100
if( wizard.exec() == QDialog::Accepted ) {
00101
00102
00103
00104
00105
new QListViewItem( certificatesLV,
"BlahCertificate",
"0x58643BFE", i18n(
"Sign/Encrypt" ) );
00106 }
00107 }
00108
00109
00110
00111
00112
void CertificateHandlingDialogImpl::slotUseForEncrypting()
00113 {
00114
QListViewItem* item = certificatesLV->selectedItem();
00115 Q_ASSERT( item );
00116
if( item ) {
00117
00118 encryptCertLA->setText( item->text( 0 ) );
00119
00120
00121
QListViewItemIterator it( certificatesLV );
00122
QListViewItem* current;
00123
while( ( current = it.current() ) ) {
00124
if( current->text( 3 ) == i18n(
"Sign/Encrypt" ) )
00125 current->setText( 3, i18n(
"Sign" ) );
00126
else if( current->text( 3 ) == i18n(
"Encrypt" ) )
00127 current->setText( 3,
"" );
00128 ++it;
00129 }
00130
00131
00132
if( item->text( 3 ) == i18n(
"Sign" ) )
00133 item->setText( 3, i18n(
"Sign/Encrypt" ) );
00134
else if( item->text( 3 ).isEmpty() )
00135 item->setText( 3, i18n(
"Encrypt" ) );
00136 }
00137 }
00138
00139
00140
00141
00142
void CertificateHandlingDialogImpl::slotUseForSigning()
00143 {
00144
QListViewItem* item = certificatesLV->selectedItem();
00145 Q_ASSERT( item );
00146
if( item ) {
00147
00148 signCertLA->setText( item->text( 0 ) );
00149
00150
00151
QListViewItemIterator it( certificatesLV );
00152
QListViewItem* current;
00153
while( ( current = it.current() ) ) {
00154 ++it;
00155
if( current->text( 3 ) == i18n(
"Sign/Encrypt" ) )
00156 current->setText( 3, i18n(
"Encrypt" ) );
00157
else if( current->text( 3 ) == i18n(
"Sign" ) )
00158 current->setText( 3,
"" );
00159 }
00160
00161
00162
if( item->text( 3 ) == i18n(
"Encrypt" ) )
00163 item->setText( 3, i18n(
"Sign/Encrypt" ) );
00164
else if( item->text( 3 ).isEmpty() )
00165 item->setText( 3, i18n(
"Sign" ) );
00166 }
00167 }
00168
00169
00170
#include "certificatehandlingdialogimpl.moc"