diff options
author | Kevin Smith <git@kismith.co.uk> | 2012-03-05 08:42:38 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-03-05 08:42:38 (GMT) |
commit | fe24fd560ec2302306857a52a07155c93f5dde69 (patch) | |
tree | 4e65d0c2df31550c204d76ce4a5e544098c27f47 | |
parent | 32ff425c455a489adf7f5fa3ac876b63cbd0796b (diff) | |
download | swift-contrib-fe24fd560ec2302306857a52a07155c93f5dde69.zip swift-contrib-fe24fd560ec2302306857a52a07155c93f5dde69.tar.bz2 |
Close adhoc window after cancelling.
Resolves: #955
-rw-r--r-- | Swift/QtUI/QtAdHocCommandWindow.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Swift/QtUI/QtAdHocCommandWindow.cpp b/Swift/QtUI/QtAdHocCommandWindow.cpp index 221d1f5..f8a3cd6 100644 --- a/Swift/QtUI/QtAdHocCommandWindow.cpp +++ b/Swift/QtUI/QtAdHocCommandWindow.cpp @@ -30,70 +30,71 @@ QtAdHocCommandWindow::QtAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocComman QWidget* formContainer = new QWidget(this); layout->addWidget(formContainer); formLayout_ = new QBoxLayout(QBoxLayout::TopToBottom, formContainer); QWidget* buttonsWidget = new QWidget(this); layout->addWidget(buttonsWidget); QBoxLayout* buttonsLayout = new QBoxLayout(QBoxLayout::LeftToRight, buttonsWidget); cancelButton_ = new QPushButton(tr("Cancel"), buttonsWidget); buttonsLayout->addWidget(cancelButton_); connect(cancelButton_, SIGNAL(clicked()), this, SLOT(handleCancelClicked())); backButton_ = new QPushButton(tr("Back"), buttonsWidget); buttonsLayout->addWidget(backButton_); connect(backButton_, SIGNAL(clicked()), this, SLOT(handlePrevClicked())); nextButton_ = new QPushButton(tr("Next"), buttonsWidget); buttonsLayout->addWidget(nextButton_); connect(nextButton_, SIGNAL(clicked()), this, SLOT(handleNextClicked())); completeButton_ = new QPushButton(tr("Complete"), buttonsWidget); buttonsLayout->addWidget(completeButton_); connect(completeButton_, SIGNAL(clicked()), this, SLOT(handleCompleteClicked())); nextButton_->setEnabled(false); backButton_->setEnabled(false); completeButton_->setEnabled(false); actions_[Command::Next] = nextButton_; actions_[Command::Prev] = backButton_; actions_[Command::Complete] = completeButton_; actions_[Command::Cancel] = cancelButton_; show(); } QtAdHocCommandWindow::~QtAdHocCommandWindow() { } void QtAdHocCommandWindow::handleCancelClicked() { command_->cancel(); + close(); } void QtAdHocCommandWindow::handlePrevClicked() { command_->goBack(); } void QtAdHocCommandWindow::handleNextClicked() { command_->goNext(formWidget_ ? formWidget_->getCompletedForm() : Form::ref()); } void QtAdHocCommandWindow::handleCompleteClicked() { command_->complete(formWidget_ ? formWidget_->getCompletedForm() : Form::ref()); } 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; } } } label_->setText(notes); setAvailableActions(command); } |