Better wording
[kdepim.git] / kleopatra / dialogs / exportcertificatesdialog.cpp
blob4ab197622031046b1e52854cb36e5e64b1ae7d6b
1 /* -*- mode: c++; c-basic-offset:4 -*-
2 dialogs/exportcertificatesdialog.cpp
4 This file is part of Kleopatra, the KDE keymanager
5 Copyright (c) 2007 Klarälvdalens Datakonsult AB
7 Kleopatra is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 Kleopatra is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 In addition, as a special exception, the copyright holders give
22 permission to link the code of this program with any edition of
23 the Qt library by Trolltech AS, Norway (or with modified versions
24 of Qt that use the same license as Qt), and distribute linked
25 combinations including the two. You must obey the GNU General
26 Public License in all respects for all of the code used other than
27 Qt. If you modify this file, you may extend this exception to
28 your version of the file, but you are not obligated to do so. If
29 you do not wish to do so, delete this exception statement from
30 your version.
33 #include <config-kleopatra.h>
35 #include "exportcertificatesdialog.h"
37 #include "libkleo/ui/filenamerequester.h"
39 #include <KGuiItem>
40 #include <KLocale>
41 #include <KPushButton>
43 #include <QGridLayout>
44 #include <QLabel>
46 using namespace Kleo;
47 using namespace Kleo::Dialogs;
49 class ExportCertificatesDialog::Private {
50 friend class ::Kleo::Dialogs::ExportCertificatesDialog;
51 ExportCertificatesDialog * const q;
52 public:
53 explicit Private( ExportCertificatesDialog * qq );
54 ~Private();
55 void fileNamesChanged();
57 private:
58 FileNameRequester* pgpRequester;
59 FileNameRequester* cmsRequester;
63 ExportCertificatesDialog::Private::Private( ExportCertificatesDialog * qq )
64 : q( qq )
66 q->setButtons( KDialog::Ok | KDialog::Cancel );
67 q->setButtonGuiItem( KDialog::Ok, KGuiItem( i18n( "Export" ) ) );
68 QWidget* const main = new QWidget;
69 QGridLayout* const grid = new QGridLayout( main );
70 QLabel* const pgpLabel = new QLabel;
71 pgpLabel->setText( i18n(" OpenPGP export file:" ) );
72 grid->addWidget( pgpLabel, 0, 0 );
73 pgpRequester = new FileNameRequester;
74 connect( pgpRequester, SIGNAL(fileNameChanged(QString)), q, SLOT(fileNamesChanged()) );
75 grid->addWidget( pgpRequester, 0, 1 );
76 QLabel* const cmsLabel = new QLabel;
77 cmsLabel->setText( i18n( "S/MIME export file:" ) );
78 grid->addWidget( cmsLabel, 1, 0 );
79 cmsRequester = new FileNameRequester;
80 connect( cmsRequester, SIGNAL(fileNameChanged(QString)), q, SLOT(fileNamesChanged()) );
81 grid->addWidget( cmsRequester, 1, 1 );
82 q->setMainWidget( main );
83 fileNamesChanged();
86 ExportCertificatesDialog::Private::~Private() {}
90 ExportCertificatesDialog::ExportCertificatesDialog( QWidget * parent, Qt::WFlags f )
91 : KDialog( parent, f ), d( new Private( this ) )
96 void ExportCertificatesDialog::Private::fileNamesChanged()
98 q->button( KDialog::Ok )->setEnabled( !pgpRequester->fileName().isEmpty() && !cmsRequester->fileName().isEmpty() );
101 ExportCertificatesDialog::~ExportCertificatesDialog() {}
104 void ExportCertificatesDialog::setOpenPgpExportFileName( const QString & fileName )
106 d->pgpRequester->setFileName( fileName );
109 QString ExportCertificatesDialog::openPgpExportFileName() const
111 return d->pgpRequester->fileName();
114 void ExportCertificatesDialog::setCmsExportFileName( const QString & fileName )
116 d->cmsRequester->setFileName( fileName );
119 QString ExportCertificatesDialog::cmsExportFileName() const
121 return d->cmsRequester->fileName();
124 #include "moc_exportcertificatesdialog.cpp"