summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-05-02 09:19:23 (GMT)
committerSwift Review <review@swift.im>2014-07-09 09:03:34 (GMT)
commitacac7962ba04c083377f62f4265ecc754176f74e (patch)
treefa2db718854d10c76e81fc54b0b1f2b33a12963f /Swift/QtUI/QtAdHocCommandWindow.cpp
parent8ab7ca17fdde8f8fb62a0c574478aa2c4c01a9bc (diff)
downloadswift-acac7962ba04c083377f62f4265ecc754176f74e.zip
swift-acac7962ba04c083377f62f4265ecc754176f74e.tar.bz2
Refactor AdHoc forms.
Test-Information: Check that forms still open properly and can be submitted and canceled. Check that error message is displayed if disconnected when a form is open. Change-Id: I23e35730b0decdfb5cf0592fc7234bf4643b6127
Diffstat (limited to 'Swift/QtUI/QtAdHocCommandWindow.cpp')
-rw-r--r--Swift/QtUI/QtAdHocCommandWindow.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/Swift/QtUI/QtAdHocCommandWindow.cpp b/Swift/QtUI/QtAdHocCommandWindow.cpp
index 5d87031..5f99dba 100644
--- a/Swift/QtUI/QtAdHocCommandWindow.cpp
+++ b/Swift/QtUI/QtAdHocCommandWindow.cpp
@@ -1,16 +1,16 @@
/*
- * Copyright (c) 2010-2012 Kevin Smith
+ * Copyright (c) 2010-2014 Kevin Smith
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include <Swift/QtUI/QtAdHocCommandWindow.h>
-
#include <boost/bind.hpp>
#include <QBoxLayout>
+#include <Swift/QtUI/QtAdHocCommandWindow.h>
#include <Swift/QtUI/QtFormWidget.h>
-#include <Swiften/Elements/Command.h>
#include <Swift/QtUI/QtSwiftUtil.h>
+#include <Swiften/Base/format.h>
+#include <Swiften/Elements/Command.h>
const int FormLayoutIndex = 1;
@@ -29,6 +29,13 @@ QtAdHocCommandWindow::QtAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocComman
label_ = new QLabel(this);
label_->setTextFormat(Qt::PlainText);
layout_->addWidget(label_);
+
+ errorLabel_ = new QLabel(this);
+ errorLabel_->setText(QString("<b>%1</b>").arg(tr("Unable to complete the command because you have been disconnected")));
+ errorLabel_->setVisible(false);
+ errorLabel_->setFrameStyle(QFrame::Box|QFrame::Sunken);
+ layout_->addWidget(errorLabel_);
+
QWidget* buttonsWidget = new QWidget(this);
layout_->addWidget(buttonsWidget);
@@ -48,6 +55,7 @@ QtAdHocCommandWindow::QtAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocComman
nextButton_->setEnabled(false);
backButton_->setEnabled(false);
completeButton_->setEnabled(false);
+
actions_[Command::Next] = nextButton_;
actions_[Command::Prev] = backButton_;
actions_[Command::Complete] = completeButton_;
@@ -55,7 +63,19 @@ QtAdHocCommandWindow::QtAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocComman
}
QtAdHocCommandWindow::~QtAdHocCommandWindow() {
+}
+
+void QtAdHocCommandWindow::setOnline(bool online) {
+ if (!online) {
+ nextButton_->setEnabled(false);
+ backButton_->setEnabled(false);
+ completeButton_->setEnabled(false);
+ errorLabel_->setVisible(true);
+ }
+}
+void QtAdHocCommandWindow::closeEvent(QCloseEvent*) {
+ onClosing();
}
void QtAdHocCommandWindow::handleCancelClicked() {