diff options
Diffstat (limited to 'Swift/QtUI/QtAdHocCommandWindow.cpp')
-rw-r--r-- | Swift/QtUI/QtAdHocCommandWindow.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Swift/QtUI/QtAdHocCommandWindow.cpp b/Swift/QtUI/QtAdHocCommandWindow.cpp index b148560..88aa708 100644 --- a/Swift/QtUI/QtAdHocCommandWindow.cpp +++ b/Swift/QtUI/QtAdHocCommandWindow.cpp @@ -15,7 +15,7 @@ const int FormLayoutIndex = 1; namespace Swift { QtAdHocCommandWindow::QtAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command) : command_(command) { - + someActions_ = false; formWidget_ = NULL; setAttribute(Qt::WA_DeleteOnClose); @@ -109,16 +109,19 @@ void QtAdHocCommandWindow::setForm(Form::ref form) { formWidget_ = new QtFormWidget(form, this); layout_->insertWidget(FormLayoutIndex, formWidget_); show(); + formWidget_->setEditable(someActions_); } void QtAdHocCommandWindow::setNoForm() { delete formWidget_; + formWidget_ = NULL; show(); } typedef std::pair<Command::Action, QPushButton*> ActionButton; void QtAdHocCommandWindow::setAvailableActions(Command::ref /*commandResult*/) { + someActions_ = false; foreach (ActionButton pair, actions_) { OutgoingAdHocCommandSession::ActionState state = command_->getActionState(pair.first); if (state & OutgoingAdHocCommandSession::Present) { @@ -129,11 +132,15 @@ void QtAdHocCommandWindow::setAvailableActions(Command::ref /*commandResult*/) { } if (state & OutgoingAdHocCommandSession::Enabled) { pair.second->setEnabled(true); + someActions_ = true; } else { pair.second->setEnabled(false); } } + if (formWidget_) { + formWidget_->setEditable(someActions_); + } } } |