async: add Promise and use it for AsyncDialogBox
This commit is contained in:
parent
4f868a1f3c
commit
0302bfdc22
7 changed files with 208 additions and 36 deletions
|
|
@ -169,7 +169,14 @@ void CANRManager::SANRData::runDialog(const std::string& title, const std::strin
|
|||
appClass.empty() ? "unknown" : appClass),
|
||||
std::vector<std::string>{"Terminate", "Wait"});
|
||||
|
||||
dialogBox->open([dialogWmPID, this](std::string result) {
|
||||
dialogBox->open()->then([dialogWmPID, this](SP<CPromiseResult<std::string>> r) {
|
||||
if (r->hasError()) {
|
||||
Debug::log(ERR, "CANRManager::SANRData::runDialog: error spawning dialog");
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& result = r->result();
|
||||
|
||||
if (result.starts_with("Terminate"))
|
||||
::kill(dialogWmPID, SIGKILL);
|
||||
else if (result.starts_with("Wait"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue