summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-04-27 16:19:30 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-04-27 16:19:30 (GMT)
commitd197c6b11748a7e98ca8ddacf5f43023f25e667a (patch)
treeb9100af44e19f8498f430ee8d48dd9a45f62f8b1 /Swift/QtUI/QtAdHocCommandWindow.cpp
parent74df18dda93f154339af1137e8676337233b4a61 (diff)
downloadswift-contrib-d197c6b11748a7e98ca8ddacf5f43023f25e667a.zip
swift-contrib-d197c6b11748a7e98ca8ddacf5f43023f25e667a.tar.bz2
Clean up AdHoc to a usable state
Diffstat (limited to 'Swift/QtUI/QtAdHocCommandWindow.cpp')
-rw-r--r--Swift/QtUI/QtAdHocCommandWindow.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/Swift/QtUI/QtAdHocCommandWindow.cpp b/Swift/QtUI/QtAdHocCommandWindow.cpp
index 88aa708..b0281d9 100644
--- a/Swift/QtUI/QtAdHocCommandWindow.cpp
+++ b/Swift/QtUI/QtAdHocCommandWindow.cpp
@@ -15,7 +15,6 @@ const int FormLayoutIndex = 1;
namespace Swift {
QtAdHocCommandWindow::QtAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command) : command_(command) {
- someActions_ = false;
formWidget_ = NULL;
setAttribute(Qt::WA_DeleteOnClose);
@@ -105,23 +104,23 @@ void QtAdHocCommandWindow::handleError(ErrorPayload::ref /*error*/) {
}
void QtAdHocCommandWindow::setForm(Form::ref form) {
+ form_ = form;
delete formWidget_;
formWidget_ = new QtFormWidget(form, this);
layout_->insertWidget(FormLayoutIndex, formWidget_);
show();
- formWidget_->setEditable(someActions_);
}
void QtAdHocCommandWindow::setNoForm() {
+ form_.reset();
delete formWidget_;
formWidget_ = NULL;
- show();
+ hide();
}
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) {
@@ -132,15 +131,11 @@ 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_);
- }
}
}