aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function/gpg/GpgUIDOperator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/function/gpg/GpgUIDOperator.cpp')
-rw-r--r--src/core/function/gpg/GpgUIDOperator.cpp144
1 files changed, 66 insertions, 78 deletions
diff --git a/src/core/function/gpg/GpgUIDOperator.cpp b/src/core/function/gpg/GpgUIDOperator.cpp
index e34d224a..e07b4192 100644
--- a/src/core/function/gpg/GpgUIDOperator.cpp
+++ b/src/core/function/gpg/GpgUIDOperator.cpp
@@ -70,60 +70,60 @@ auto GpgUIDOperator::DeleteUID(const GpgKeyPtr& key, int uid_index) -> bool {
auto tokens = args.split(' ');
switch (state) {
- case GpgAutomatonHandler::AS_START:
+ case GpgAutomatonHandler::kAS_START:
if (status == "GET_LINE" && args == "keyedit.prompt") {
- return GpgAutomatonHandler::AS_SELECT;
+ return GpgAutomatonHandler::kAS_SELECT;
}
- return GpgAutomatonHandler::AS_ERROR;
- case GpgAutomatonHandler::AS_SELECT:
+ return GpgAutomatonHandler::kAS_ERROR;
+ case GpgAutomatonHandler::kAS_SELECT:
if (status == "GET_LINE" && args == "keyedit.prompt") {
- return GpgAutomatonHandler::AS_COMMAND;
+ return GpgAutomatonHandler::kAS_COMMAND;
}
- return GpgAutomatonHandler::AS_ERROR;
- case GpgAutomatonHandler::AS_COMMAND:
+ return GpgAutomatonHandler::kAS_ERROR;
+ case GpgAutomatonHandler::kAS_COMMAND:
if (status == "GET_LINE" && args == "keyedit.prompt") {
- return GpgAutomatonHandler::AS_QUIT;
+ return GpgAutomatonHandler::kAS_QUIT;
} else if (status == "GET_BOOL" && args == "keyedit.remove.uid.okay") {
- return GpgAutomatonHandler::AS_REALLY_ULTIMATE;
+ return GpgAutomatonHandler::kAS_REALLY_ULTIMATE;
}
- return GpgAutomatonHandler::AS_ERROR;
- case GpgAutomatonHandler::AS_REALLY_ULTIMATE:
+ return GpgAutomatonHandler::kAS_ERROR;
+ case GpgAutomatonHandler::kAS_REALLY_ULTIMATE:
if (status == "GET_LINE" && args == "keyedit.prompt") {
- return GpgAutomatonHandler::AS_QUIT;
+ return GpgAutomatonHandler::kAS_QUIT;
}
- return GpgAutomatonHandler::AS_ERROR;
- case GpgAutomatonHandler::AS_QUIT:
+ return GpgAutomatonHandler::kAS_ERROR;
+ case GpgAutomatonHandler::kAS_QUIT:
if (status == "GET_BOOL" && args == "keyedit.save.okay") {
- return GpgAutomatonHandler::AS_SAVE;
+ return GpgAutomatonHandler::kAS_SAVE;
}
- return GpgAutomatonHandler::AS_ERROR;
- case GpgAutomatonHandler::AS_ERROR:
+ return GpgAutomatonHandler::kAS_ERROR;
+ case GpgAutomatonHandler::kAS_ERROR:
if (status == "GET_LINE" && args == "keyedit.prompt") {
- return GpgAutomatonHandler::AS_QUIT;
+ return GpgAutomatonHandler::kAS_QUIT;
}
- return GpgAutomatonHandler::AS_ERROR;
+ return GpgAutomatonHandler::kAS_ERROR;
default:
- return GpgAutomatonHandler::AS_ERROR;
+ return GpgAutomatonHandler::kAS_ERROR;
};
};
AutomatonActionHandler action_handler =
[uid_index](AutomatonHandelStruct& handler, AutomatonState state) {
switch (state) {
- case GpgAutomatonHandler::AS_SELECT:
+ case GpgAutomatonHandler::kAS_SELECT:
return QString("uid %1").arg(uid_index);
- case GpgAutomatonHandler::AS_COMMAND:
+ case GpgAutomatonHandler::kAS_COMMAND:
return QString("deluid");
- case GpgAutomatonHandler::AS_REALLY_ULTIMATE:
+ case GpgAutomatonHandler::kAS_REALLY_ULTIMATE:
handler.SetSuccess(true);
return QString("Y");
- case GpgAutomatonHandler::AS_QUIT:
+ case GpgAutomatonHandler::kAS_QUIT:
return QString("quit");
- case GpgAutomatonHandler::AS_SAVE:
+ case GpgAutomatonHandler::kAS_SAVE:
handler.SetSuccess(true);
return QString("Y");
- case GpgAutomatonHandler::AS_START:
- case GpgAutomatonHandler::AS_ERROR:
+ case GpgAutomatonHandler::kAS_START:
+ case GpgAutomatonHandler::kAS_ERROR:
return QString("");
default:
return QString("");
@@ -131,12 +131,6 @@ auto GpgUIDOperator::DeleteUID(const GpgKeyPtr& key, int uid_index) -> bool {
return QString("");
};
- auto key_fpr = key->Fingerprint();
- AutomatonHandelStruct handel_struct(key_fpr);
- handel_struct.SetHandler(next_state_handler, action_handler);
-
- GpgData data_out;
-
return GpgAutomatonHandler::GetInstance(GetChannel())
.DoInteract(key, next_state_handler, action_handler);
}
@@ -164,62 +158,62 @@ auto GpgUIDOperator::RevokeUID(const GpgKeyPtr& key, int uid_index,
auto tokens = args.split(' ');
switch (state) {
- case GpgAutomatonHandler::AS_START:
+ case GpgAutomatonHandler::kAS_START:
if (status == "GET_LINE" && args == "keyedit.prompt") {
- return GpgAutomatonHandler::AS_SELECT;
+ return GpgAutomatonHandler::kAS_SELECT;
}
- return GpgAutomatonHandler::AS_ERROR;
- case GpgAutomatonHandler::AS_SELECT:
+ return GpgAutomatonHandler::kAS_ERROR;
+ case GpgAutomatonHandler::kAS_SELECT:
if (status == "GET_LINE" && args == "keyedit.prompt") {
- return GpgAutomatonHandler::AS_COMMAND;
+ return GpgAutomatonHandler::kAS_COMMAND;
}
- return GpgAutomatonHandler::AS_ERROR;
- case GpgAutomatonHandler::AS_COMMAND:
+ return GpgAutomatonHandler::kAS_ERROR;
+ case GpgAutomatonHandler::kAS_COMMAND:
if (status == "GET_LINE" && args == "keyedit.prompt") {
- return GpgAutomatonHandler::AS_QUIT;
+ return GpgAutomatonHandler::kAS_QUIT;
} else if (status == "GET_BOOL" && args == "keyedit.revoke.uid.okay") {
- return GpgAutomatonHandler::AS_REALLY_ULTIMATE;
+ return GpgAutomatonHandler::kAS_REALLY_ULTIMATE;
}
- return GpgAutomatonHandler::AS_ERROR;
- case GpgAutomatonHandler::AS_REASON_CODE:
+ return GpgAutomatonHandler::kAS_ERROR;
+ case GpgAutomatonHandler::kAS_REASON_CODE:
if (status == "GET_LINE" && args == "keyedit.prompt") {
- return GpgAutomatonHandler::AS_QUIT;
+ return GpgAutomatonHandler::kAS_QUIT;
} else if (status == "GET_LINE" &&
args == "ask_revocation_reason.text") {
- return GpgAutomatonHandler::AS_REASON_TEXT;
+ return GpgAutomatonHandler::kAS_REASON_TEXT;
}
- return GpgAutomatonHandler::AS_ERROR;
- case GpgAutomatonHandler::AS_REASON_TEXT:
+ return GpgAutomatonHandler::kAS_ERROR;
+ case GpgAutomatonHandler::kAS_REASON_TEXT:
if (status == "GET_LINE" && args == "keyedit.prompt") {
- return GpgAutomatonHandler::AS_QUIT;
+ return GpgAutomatonHandler::kAS_QUIT;
} else if (status == "GET_LINE" &&
args == "ask_revocation_reason.text") {
- return GpgAutomatonHandler::AS_REASON_TEXT;
+ return GpgAutomatonHandler::kAS_REASON_TEXT;
} else if (status == "GET_BOOL" &&
args == "ask_revocation_reason.okay") {
- return GpgAutomatonHandler::AS_REALLY_ULTIMATE;
+ return GpgAutomatonHandler::kAS_REALLY_ULTIMATE;
}
- return GpgAutomatonHandler::AS_ERROR;
- case GpgAutomatonHandler::AS_REALLY_ULTIMATE:
+ return GpgAutomatonHandler::kAS_ERROR;
+ case GpgAutomatonHandler::kAS_REALLY_ULTIMATE:
if (status == "GET_LINE" && args == "keyedit.prompt") {
- return GpgAutomatonHandler::AS_QUIT;
+ return GpgAutomatonHandler::kAS_QUIT;
} else if (status == "GET_LINE" &&
args == "ask_revocation_reason.code") {
- return GpgAutomatonHandler::AS_REASON_CODE;
+ return GpgAutomatonHandler::kAS_REASON_CODE;
}
- return GpgAutomatonHandler::AS_ERROR;
- case GpgAutomatonHandler::AS_QUIT:
+ return GpgAutomatonHandler::kAS_ERROR;
+ case GpgAutomatonHandler::kAS_QUIT:
if (status == "GET_BOOL" && args == "keyedit.save.okay") {
- return GpgAutomatonHandler::AS_SAVE;
+ return GpgAutomatonHandler::kAS_SAVE;
}
- return GpgAutomatonHandler::AS_ERROR;
- case GpgAutomatonHandler::AS_ERROR:
+ return GpgAutomatonHandler::kAS_ERROR;
+ case GpgAutomatonHandler::kAS_ERROR:
if (status == "GET_LINE" && args == "keyedit.prompt") {
- return GpgAutomatonHandler::AS_QUIT;
+ return GpgAutomatonHandler::kAS_QUIT;
}
- return GpgAutomatonHandler::AS_ERROR;
+ return GpgAutomatonHandler::kAS_ERROR;
default:
- return GpgAutomatonHandler::AS_ERROR;
+ return GpgAutomatonHandler::kAS_ERROR;
};
};
@@ -227,25 +221,25 @@ auto GpgUIDOperator::RevokeUID(const GpgKeyPtr& key, int uid_index,
[uid_index, reason_code, reason_text_lines](
AutomatonHandelStruct& handler, AutomatonState state) {
switch (state) {
- case GpgAutomatonHandler::AS_SELECT:
+ case GpgAutomatonHandler::kAS_SELECT:
return QString("uid %1").arg(uid_index);
- case GpgAutomatonHandler::AS_COMMAND:
+ case GpgAutomatonHandler::kAS_COMMAND:
return QString("revuid");
- case GpgAutomatonHandler::AS_REASON_CODE:
+ case GpgAutomatonHandler::kAS_REASON_CODE:
return QString::number(reason_code);
- case GpgAutomatonHandler::AS_REASON_TEXT:
+ case GpgAutomatonHandler::kAS_REASON_TEXT:
return reason_text_lines->isEmpty()
? QString("")
: QString(reason_text_lines->takeFirst().toUtf8());
- case GpgAutomatonHandler::AS_REALLY_ULTIMATE:
+ case GpgAutomatonHandler::kAS_REALLY_ULTIMATE:
return QString("Y");
- case GpgAutomatonHandler::AS_QUIT:
+ case GpgAutomatonHandler::kAS_QUIT:
return QString("quit");
- case GpgAutomatonHandler::AS_SAVE:
+ case GpgAutomatonHandler::kAS_SAVE:
handler.SetSuccess(true);
return QString("Y");
- case GpgAutomatonHandler::AS_START:
- case GpgAutomatonHandler::AS_ERROR:
+ case GpgAutomatonHandler::kAS_START:
+ case GpgAutomatonHandler::kAS_ERROR:
return QString("");
default:
return QString("");
@@ -253,12 +247,6 @@ auto GpgUIDOperator::RevokeUID(const GpgKeyPtr& key, int uid_index,
return QString("");
};
- auto key_fpr = key->Fingerprint();
- AutomatonHandelStruct handel_struct(key_fpr);
- handel_struct.SetHandler(next_state_handler, action_handler);
-
- GpgData data_out;
-
return GpgAutomatonHandler::GetInstance(GetChannel())
.DoInteract(key, next_state_handler, action_handler);
}