• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kleopatra

  • sources
  • kde-4.12
  • kdepim
  • kleopatra
  • commands
newcertificatecommand.cpp
Go to the documentation of this file.
1 /* -*- mode: c++; c-basic-offset:4 -*-
2  commands/newcertificatecommand.cpp
3 
4  This file is part of Kleopatra, the KDE keymanager
5  Copyright (c) 2008 Klarälvdalens Datakonsult AB
6 
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.
11 
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.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Softwarls 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 Qt library by Trolltech AS, Norway (or with modified versions
23  of Qt that use the same license as Qt), 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  Qt. 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 <config-kleopatra.h>
33 
34 #include "newcertificatecommand.h"
35 
36 #include "command_p.h"
37 
38 #include <newcertificatewizard/newcertificatewizard.h>
39 
40 using namespace Kleo;
41 using namespace Kleo::Commands;
42 using namespace GpgME;
43 
44 class NewCertificateCommand::Private : public Command::Private {
45  friend class ::Kleo::Commands::NewCertificateCommand;
46  NewCertificateCommand * q_func() const { return static_cast<NewCertificateCommand*>( q ); }
47 public:
48  explicit Private( NewCertificateCommand * qq, KeyListController * c );
49  ~Private();
50 
51  void init();
52 
53 private:
54  void slotDialogRejected();
55  void slotDialogAccepted();
56 
57 private:
58  void ensureDialogCreated();
59 
60 private:
61  Protocol protocol;
62  QPointer<NewCertificateWizard> dialog;
63 };
64 
65 
66 NewCertificateCommand::Private * NewCertificateCommand::d_func() { return static_cast<Private*>( d.get() ); }
67 const NewCertificateCommand::Private * NewCertificateCommand::d_func() const { return static_cast<const Private*>( d.get() ); }
68 
69 #define d d_func()
70 #define q q_func()
71 
72 NewCertificateCommand::Private::Private( NewCertificateCommand * qq, KeyListController * c )
73  : Command::Private( qq, c ),
74  protocol( UnknownProtocol ),
75  dialog()
76 {
77 
78 }
79 
80 NewCertificateCommand::Private::~Private() {}
81 
82 NewCertificateCommand::NewCertificateCommand( KeyListController * c )
83  : Command( new Private( this, c ) )
84 {
85  d->init();
86 }
87 
88 NewCertificateCommand::NewCertificateCommand( QAbstractItemView * v, KeyListController * c )
89  : Command( v, new Private( this, c ) )
90 {
91  d->init();
92 }
93 
94 void NewCertificateCommand::Private::init() {
95 
96 }
97 
98 NewCertificateCommand::~NewCertificateCommand() {}
99 
100 void NewCertificateCommand::setProtocol( Protocol proto ) {
101  d->protocol = proto;
102  if ( d->dialog )
103  d->dialog->setProtocol( proto );
104 }
105 
106 Protocol NewCertificateCommand::protocol() const {
107  if ( d->dialog )
108  return d->dialog->protocol();
109  else
110  return d->protocol;
111 }
112 
113 void NewCertificateCommand::doStart() {
114 
115  d->ensureDialogCreated();
116  assert( d->dialog );
117 
118  if ( d->protocol != UnknownProtocol )
119  d->dialog->setProtocol( d->protocol );
120 
121  d->dialog->show();
122 }
123 
124 void NewCertificateCommand::Private::slotDialogRejected() {
125  emit q->canceled();
126  finished();
127 }
128 
129 void NewCertificateCommand::Private::slotDialogAccepted() {
130  finished();
131 }
132 
133 void NewCertificateCommand::doCancel() {
134  if ( d->dialog )
135  d->dialog->close();
136 }
137 
138 void NewCertificateCommand::Private::ensureDialogCreated() {
139  if ( dialog )
140  return;
141 
142  dialog = new NewCertificateWizard;
143  applyWindowID( dialog );
144  dialog->setAttribute( Qt::WA_DeleteOnClose );
145 
146  connect( dialog, SIGNAL(rejected()), q, SLOT(slotDialogRejected()) );
147  connect( dialog, SIGNAL(accepted()), q, SLOT(slotDialogAccepted()) );
148 }
149 
150 #undef d
151 #undef q
152 
153 #include "moc_newcertificatecommand.cpp"
Kleo::Commands::NewCertificateCommand
Definition: newcertificatecommand.h:43
newcertificatecommand.h
Kleo::Command::Private
Definition: commands/command_p.h:52
Kleo::KeyListController
Definition: keylistcontroller.h:55
Kleo::Command::d
kdtools::pimpl_ptr< Private > d
Definition: commands/command.h:129
d
#define d
Definition: newcertificatecommand.cpp:69
Kleo::Commands::NewCertificateCommand::~NewCertificateCommand
~NewCertificateCommand()
Definition: newcertificatecommand.cpp:98
command_p.h
newcertificatewizard.h
Kleo::Commands::NewCertificateCommand::NewCertificateCommand
NewCertificateCommand(QAbstractItemView *view, KeyListController *parent)
Definition: newcertificatecommand.cpp:88
Kleo::Commands::NewCertificateCommand::protocol
GpgME::Protocol protocol() const
Definition: newcertificatecommand.cpp:106
Kleo::NewCertificateWizard
Definition: newcertificatewizard.h:54
q
#define q
Definition: newcertificatecommand.cpp:70
Kleo::Commands::NewCertificateCommand::setProtocol
void setProtocol(GpgME::Protocol proto)
Definition: newcertificatecommand.cpp:100
Kleo::Command
Definition: commands/command.h:58
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kleopatra

Skip menu "kleopatra"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



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