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 <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-12-29 11:59:21 -08:00
parent dd51b434e6
commit 3e5c1713d2
2 changed files with 12 additions and 2 deletions

View file

@ -259,15 +259,24 @@ SocialNetworkDialog::SocialNetworkDialog(QWidget *parent) : QDialog(parent)
, ui( new Ui::SocialnetworksDialog()) , ui( new Ui::SocialnetworksDialog())
{ {
ui->setupUi(this); ui->setupUi(this);
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
connect(ui->date, SIGNAL(clicked()), this, SLOT(selectionChanged())); connect(ui->date, SIGNAL(clicked()), this, SLOT(selectionChanged()));
connect(ui->duration, SIGNAL(clicked()), this, SLOT(selectionChanged())); connect(ui->duration, SIGNAL(clicked()), this, SLOT(selectionChanged()));
connect(ui->Buddy, SIGNAL(clicked()), this, SLOT(selectionChanged())); connect(ui->Buddy, SIGNAL(clicked()), this, SLOT(selectionChanged()));
connect(ui->Divemaster, SIGNAL(clicked()), this, SLOT(selectionChanged())); connect(ui->Divemaster, SIGNAL(clicked()), this, SLOT(selectionChanged()));
connect(ui->Location, SIGNAL(clicked()), this, SLOT(selectionChanged())); connect(ui->Location, SIGNAL(clicked()), this, SLOT(selectionChanged()));
connect(ui->Notes, 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; struct dive *d = current_dive;
QString fullText; QString fullText;
if (ui->date->isChecked()) { if (ui->date->isChecked()) {

View file

@ -42,6 +42,7 @@ public:
QString album() const; QString album() const;
public slots: public slots:
void selectionChanged(); void selectionChanged();
void albumChanged();
private: private:
Ui::SocialnetworksDialog *ui; Ui::SocialnetworksDialog *ui;
}; };