blob: ac096107dfe6984e09cf2c1ca0ace32fe80b3fe9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
/*
* Copyright (C) 2008,2009,2012 Rolf Eike Beer <[email protected]>
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "kgpgdelkey.h"
#include "../gpgproc.h"
#include <QString>
#include <QStringList>
/*KGpgDelKey::KGpgDelKey(QObject *parent, KGpgKeyNode *key)
: KGpgTransaction(parent)
{
m_keys << key;
setCmdLine();
}*/
KGpgDelKey::KGpgDelKey(QObject *parent, const QStringList &uids)
: KGpgTransaction(parent),
m_uids(uids)
{
setCmdLine();
}
KGpgDelKey::~KGpgDelKey()
{
}
QStringList
KGpgDelKey::keys() const
{
return m_uids;
}
bool
KGpgDelKey::nextLine(const QString &line)
{
if (!line.startsWith(QLatin1String("[GNUPG:] GOT_IT")))
setSuccess(KGpgTransaction::TS_MSG_SEQUENCE);
return false;
}
KGpgTransaction::ts_boolanswer
KGpgDelKey::boolQuestion(const QString &line)
{
if (line.startsWith(QLatin1String("delete_key.okay")))
return KGpgTransaction::BA_YES;
if (line.startsWith(QLatin1String("delete_key.secret.okay")))
return KGpgTransaction::BA_YES;
return KGpgTransaction::boolQuestion(line);
}
bool
KGpgDelKey::preStart()
{
GPGProc *proc = getProcess();
QStringList args = proc->program();
/*foreach (const KGpgKeyNode *key, m_keys)
args << key->getFingerprint();*/
foreach (const QString uid, m_uids)
args << uid;
proc->setProgram(args);
setSuccess(KGpgTransaction::TS_OK);
return true;
}
void
KGpgDelKey::setCmdLine()
{
addArgument(QLatin1String( "--status-fd=1" ));
addArgument(QLatin1String( "--command-fd=0" ));
addArgument(QLatin1String( "--delete-secret-and-public-key" ));
m_argscount = getProcess()->program().count();
}
//#include "kgpgdelkey.moc"
|