kleopatra
changepassphrasecommand.cpp
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 #include <config-kleopatra.h>
00034
00035 #include "changepassphrasecommand.h"
00036
00037 #include "command_p.h"
00038
00039 #include <utils/gnupg-helper.h>
00040
00041 #include <gpgme++/key.h>
00042
00043 #include <KLocale>
00044 #include <KMessageBox>
00045
00046 using namespace Kleo;
00047 using namespace Kleo::Commands;
00048 using namespace GpgME;
00049
00050 ChangePassphraseCommand::ChangePassphraseCommand( KeyListController * c )
00051 : GnuPGProcessCommand( c )
00052 {
00053
00054 }
00055
00056 ChangePassphraseCommand::ChangePassphraseCommand( QAbstractItemView * v, KeyListController * c )
00057 : GnuPGProcessCommand( v, c )
00058 {
00059
00060 }
00061
00062 ChangePassphraseCommand::ChangePassphraseCommand( const Key & key )
00063 : GnuPGProcessCommand( key )
00064 {
00065
00066 }
00067
00068 ChangePassphraseCommand::~ChangePassphraseCommand() {}
00069
00070 QStringList ChangePassphraseCommand::arguments() const {
00071 const Key key = d->key();
00072 if ( key.protocol() == OpenPGP )
00073 return QStringList() << gpgPath() << "--batch" << "--edit-key" << key.primaryFingerprint() << "passwd";
00074 else
00075 return QStringList() << gpgSmPath() << "--passwd" << key.primaryFingerprint();
00076 }
00077
00078 QString ChangePassphraseCommand::errorCaption() const {
00079 return i18n( "Passphrase Change Error" );
00080 }
00081
00082 QString ChangePassphraseCommand::successCaption() const {
00083 return i18n( "Passphrase Change Finished" );
00084 }
00085
00086 QString ChangePassphraseCommand::crashExitMessage( const QStringList & args ) const {
00087 return i18nc("@info",
00088 "<para>The GPG or GpgSM process that tried to change the passphrase "
00089 "ended prematurely because of an unexpected error.</para>"
00090 "<para>Please check the output of <icode>%1</icode> for details.</para>", args.join( " " ) ) ;
00091 }
00092
00093 QString ChangePassphraseCommand::errorExitMessage( const QStringList & args ) const {
00094 return i18nc("@info",
00095 "<para>An error occurred while trying to change the passphrase.</para> "
00096 "<para>The output from <command>%1</command> was: <message>%2</message></para>",
00097 args[0], errorString() );
00098 }
00099
00100 QString ChangePassphraseCommand::successMessage( const QStringList & ) const {
00101 return i18n( "Passphrase changed successfully." );
00102 }
00103
00104 #include "moc_changepassphrasecommand.cpp"