diff options
author | Kevin Smith <git@kismith.co.uk> | 2011-04-25 17:21:25 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-04-25 17:21:25 (GMT) |
commit | bc64e2e7537d714b67697cced7215ff819b0a23e (patch) | |
tree | 3ff67039fe628d166995342ab16a328c73eaebca | |
parent | 3727dd9632007bc97962156bd131f6c8c977a7ba (diff) | |
download | swift-bc64e2e7537d714b67697cced7215ff819b0a23e.zip swift-bc64e2e7537d714b67697cced7215ff819b0a23e.tar.bz2 |
No Ad-Hoc buttons once command is completed
-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: |