From 3e5c1713d20a0719be9111a29bebaa6fe24f42af Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 29 Dec 2014 11:59:21 -0800 Subject: Facebook integration: Album name is required The upload would fail with an empty album, so disable the OK button onless an album name is set. Signed-off-by: Dirk Hohndel --- qt-ui/socialnetworks.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'qt-ui/socialnetworks.cpp') diff --git a/qt-ui/socialnetworks.cpp b/qt-ui/socialnetworks.cpp index 04c28df79..ac418f240 100644 --- a/qt-ui/socialnetworks.cpp +++ b/qt-ui/socialnetworks.cpp @@ -259,15 +259,24 @@ SocialNetworkDialog::SocialNetworkDialog(QWidget *parent) : QDialog(parent) , ui( new Ui::SocialnetworksDialog()) { ui->setupUi(this); + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); connect(ui->date, SIGNAL(clicked()), this, SLOT(selectionChanged())); connect(ui->duration, SIGNAL(clicked()), this, SLOT(selectionChanged())); connect(ui->Buddy, SIGNAL(clicked()), this, SLOT(selectionChanged())); connect(ui->Divemaster, SIGNAL(clicked()), this, SLOT(selectionChanged())); connect(ui->Location, SIGNAL(clicked()), this, SLOT(selectionChanged())); connect(ui->Notes, SIGNAL(clicked()), this, SLOT(selectionChanged())); + connect(ui->album, SIGNAL(textChanged(QString)), this, SLOT(albumChanged())); } -void SocialNetworkDialog::selectionChanged() { +void SocialNetworkDialog::albumChanged() +{ + QAbstractButton *button = ui->buttonBox->button(QDialogButtonBox::Ok); + button->setEnabled(!ui->album->text().isEmpty()); +} + +void SocialNetworkDialog::selectionChanged() +{ struct dive *d = current_dive; QString fullText; if (ui->date->isChecked()) { @@ -288,7 +297,7 @@ void SocialNetworkDialog::selectionChanged() { fullText += tr("Divemaster: %1 \n").arg(d->divemaster); } if (ui->Notes->isChecked()) { - fullText += tr("\n %1").arg(d->notes); + fullText += tr("\n%1").arg(d->notes); } ui->text->setPlainText(fullText); } -- cgit v1.2.3-70-g09d2