diff options
Diffstat (limited to 'Swiften/AdHoc')
-rw-r--r-- | Swiften/AdHoc/OutgoingAdHocCommandSession.cpp | 28 | ||||
-rw-r--r-- | Swiften/AdHoc/OutgoingAdHocCommandSession.h | 1 |
2 files changed, 16 insertions, 13 deletions
diff --git a/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp b/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp index edacf94..da7f042 100644 --- a/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp +++ b/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp @@ -21,22 +21,24 @@ void OutgoingAdHocCommandSession::handleResponse(boost::shared_ptr<Command> payl } else { const std::vector<Command::Action> actions = payload->getAvailableActions(); actionStates_.clear(); - actionStates_[Command::Cancel] = EnabledAndPresent; - actionStates_[Command::Complete] = Present; - if (std::find(actions.begin(), actions.end(), Command::Complete) != actions.end()) { - actionStates_[Command::Complete] = EnabledAndPresent; - } - - if (getIsMultiStage()) { - actionStates_[Command::Next] = Present; - actionStates_[Command::Prev] = Present; - } + if (payload->getStatus() == Command::Executing ) { + actionStates_[Command::Cancel] = EnabledAndPresent; + actionStates_[Command::Complete] = Present; + if (std::find(actions.begin(), actions.end(), Command::Complete) != actions.end()) { + actionStates_[Command::Complete] = EnabledAndPresent; + } + + if (getIsMultiStage()) { + actionStates_[Command::Next] = Present; + actionStates_[Command::Prev] = Present; + } if (std::find(actions.begin(), actions.end(), Command::Next) != actions.end()) { - actionStates_[Command::Next] = EnabledAndPresent; - } + actionStates_[Command::Next] = EnabledAndPresent; + } if (std::find(actions.begin(), actions.end(), Command::Prev) != actions.end()) { - actionStates_[Command::Prev] = EnabledAndPresent; + actionStates_[Command::Prev] = EnabledAndPresent; + } } sessionID_ = payload->getSessionID(); diff --git a/Swiften/AdHoc/OutgoingAdHocCommandSession.h b/Swiften/AdHoc/OutgoingAdHocCommandSession.h index fcc93e7..f4b5242 100644 --- a/Swiften/AdHoc/OutgoingAdHocCommandSession.h +++ b/Swiften/AdHoc/OutgoingAdHocCommandSession.h @@ -73,6 +73,7 @@ namespace Swift { * This is useful for a UI to determine which buttons should be visible, * and which enabled. * Use for Next, Prev, Cancel and Complete only. + * If no actions are available, the command has completed. */ ActionState getActionState(Command::Action action); private: |