certmanager/lib

cryptoconfigdialog.cpp
1/*
2 cryptoconfigdialog.h
3
4 This file is part of kgpgcertmanager
5 Copyright (c) 2004 Klarälvdalens Datakonsult AB
6
7 Libkleopatra is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License,
9 version 2, as published by the Free Software Foundation.
10
11 Libkleopatra 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 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
20 In addition, as a special exception, the copyright holders give
21 permission to link the code of this program with any edition of
22 the TQt library by Trolltech AS, Norway (or with modified versions
23 of TQt that use the same license as TQt), and distribute linked
24 combinations including the two. You must obey the GNU General
25 Public License in all respects for all of the code used other than
26 TQt. If you modify this file, you may extend this exception to
27 your version of the file, but you are not obligated to do so. If
28 you do not wish to do so, delete this exception statement from
29 your version.
30*/
31
32#include "cryptoconfigdialog.h"
33#include "cryptoconfigmodule.h"
34#include <tdelocale.h>
35#include <tdeaccelmanager.h>
36
37Kleo::CryptoConfigDialog::CryptoConfigDialog( Kleo::CryptoConfig* config, TQWidget *parent, const char* name )
38 : KDialogBase( Swallow,
39 // Remove the "whats's this" button since we have no support for it
40 WStyle_Customize | WStyle_DialogBorder | WStyle_Maximize | WStyle_Title | WStyle_SysMenu,
41 parent, name, true /*modal*/,
42 i18n( "Configure" ), Default|Cancel|Apply|Ok|User1,
43 Ok, true /*separator*/, KGuiItem( i18n( "&Reset" ), "edit-undo" ) )
44{
45 mMainWidget = new CryptoConfigModule( config, this );
46 setMainWidget( mMainWidget );
47 connect( mMainWidget, TQ_SIGNAL( changed() ), TQ_SLOT( slotChanged() ) );
48 enableButton( Apply, false );
49 if ( mMainWidget->hasError() ) {
50 showButton( Default, false );
51 showButton( User1, false );
52 showButton( Apply, false );
53 showButton( Ok, false );
54 }
55
56 // Automatically assign accelerators
57 TDEAcceleratorManager::manage( this );
58}
59
60void Kleo::CryptoConfigDialog::slotOk()
61{
62 slotApply();
63 accept();
64}
65
66void Kleo::CryptoConfigDialog::slotCancel()
67{
68 mMainWidget->cancel();
69 reject();
70}
71
72void Kleo::CryptoConfigDialog::slotDefault()
73{
74 mMainWidget->defaults();
75 slotChanged();
76}
77
78void Kleo::CryptoConfigDialog::slotApply()
79{
80 mMainWidget->save();
81 enableButton( Apply, false );
82}
83
84void Kleo::CryptoConfigDialog::slotUser1() // reset
85{
86 mMainWidget->reset();
87 enableButton( Apply, false );
88}
89
90void Kleo::CryptoConfigDialog::slotChanged()
91{
92 enableButton( Apply, true );
93}
94
95#include "cryptoconfigdialog.moc"
Main interface to crypto configuration.
Definition: cryptoconfig.h:334