summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtAdHocCommandWindow.cpp28
-rw-r--r--Swift/QtUI/QtAdHocCommandWindow.h2
2 files changed, 16 insertions, 14 deletions
diff --git a/Swift/QtUI/QtAdHocCommandWindow.cpp b/Swift/QtUI/QtAdHocCommandWindow.cpp
index b0281d9..5d87031 100644
--- a/Swift/QtUI/QtAdHocCommandWindow.cpp
+++ b/Swift/QtUI/QtAdHocCommandWindow.cpp
@@ -10,6 +10,7 @@
#include <QBoxLayout>
#include <Swift/QtUI/QtFormWidget.h>
#include <Swiften/Elements/Command.h>
+#include <Swift/QtUI/QtSwiftUtil.h>
const int FormLayoutIndex = 1;
@@ -75,24 +76,24 @@ void QtAdHocCommandWindow::handleCompleteClicked() {
}
void QtAdHocCommandWindow::handleNextStageReceived(Command::ref command) {
- if (command->getForm()) {
- setForm(command->getForm());
- } else {
- setNoForm();
- }
QString notes;
foreach (Command::Note note, command->getNotes()) {
if (!notes.isEmpty()) {
notes += "\n";
- QString qNote(note.note.c_str());
- switch (note.type) {
- case Command::Note::Error: notes += tr("Error: %1").arg(qNote); break;
- case Command::Note::Warn: notes += tr("Warning: %1").arg(qNote); break;
- case Command::Note::Info: notes += qNote; break;
- }
+ }
+ QString qNote(P2QSTRING(note.note));
+ switch (note.type) {
+ case Command::Note::Error: notes += tr("Error: %1").arg(qNote); break;
+ case Command::Note::Warn: notes += tr("Warning: %1").arg(qNote); break;
+ case Command::Note::Info: notes += qNote; break;
}
}
label_->setText(notes);
+ if (command->getForm()) {
+ setForm(command->getForm());
+ } else {
+ setNoForm(notes.isEmpty());
+ }
setAvailableActions(command);
}
@@ -111,11 +112,12 @@ void QtAdHocCommandWindow::setForm(Form::ref form) {
show();
}
-void QtAdHocCommandWindow::setNoForm() {
+void QtAdHocCommandWindow::setNoForm(bool andHide) {
form_.reset();
delete formWidget_;
formWidget_ = NULL;
- hide();
+ resize(minimumSize());
+ setVisible(!andHide);
}
typedef std::pair<Command::Action, QPushButton*> ActionButton;
diff --git a/Swift/QtUI/QtAdHocCommandWindow.h b/Swift/QtUI/QtAdHocCommandWindow.h
index 42e3b1c..d42a77d 100644
--- a/Swift/QtUI/QtAdHocCommandWindow.h
+++ b/Swift/QtUI/QtAdHocCommandWindow.h
@@ -26,7 +26,7 @@ namespace Swift {
void handleNextStageReceived(Command::ref command);
void handleError(ErrorPayload::ref error);
void setForm(Form::ref);
- void setNoForm();
+ void setNoForm(bool andHide);
void setAvailableActions(Command::ref commandResult);
private slots:
void handleCancelClicked();