summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-04-27 16:02:10 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-04-27 16:02:10 (GMT)
commit74df18dda93f154339af1137e8676337233b4a61 (patch)
treec10364de0d828a2b397bcb46408ff3d7bf66b331 /Swift/QtUI/QtAdHocCommandWindow.cpp
parent9e57b31133edad6a543da05aca54ee94d589b090 (diff)
downloadswift-74df18dda93f154339af1137e8676337233b4a61.zip
swift-74df18dda93f154339af1137e8676337233b4a61.tar.bz2
Don't allow editing of AdHoc result forms.
Resolves: #1090
Diffstat (limited to 'Swift/QtUI/QtAdHocCommandWindow.cpp')
-rw-r--r--Swift/QtUI/QtAdHocCommandWindow.cpp9
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_);
+ }
}
}