ShareDialog: If the password is empty, disable button
authorKlaas Freitag <freitag@owncloud.com>
Wed, 11 Mar 2015 13:57:55 +0000 (14:57 +0100)
committerKlaas Freitag <freitag@owncloud.com>
Wed, 11 Mar 2015 13:57:55 +0000 (14:57 +0100)
src/gui/sharedialog.cpp
src/gui/sharedialog.h

index ae4506cc377e2b2bb8d49a39b04f406bd8c043f8..3f9af720a2c625eac034d2ccdc250babe8ea0408 100644 (file)
@@ -66,10 +66,12 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
     connect(_ui->checkBox_shareLink, SIGNAL(clicked()), this, SLOT(slotCheckBoxShareLinkClicked()));
     connect(_ui->checkBox_password, SIGNAL(clicked()), this, SLOT(slotCheckBoxPasswordClicked()));
     connect(_ui->lineEdit_password, SIGNAL(returnPressed()), this, SLOT(slotPasswordReturnPressed()));
+    connect(_ui->lineEdit_password, SIGNAL(textChanged(QString)), this, SLOT(slotPasswordChanged(QString)));
     connect(_ui->pushButton_setPassword, SIGNAL(clicked(bool)), SLOT(slotPasswordReturnPressed()));
     connect(_ui->checkBox_expire, SIGNAL(clicked()), this, SLOT(slotCheckBoxExpireClicked()));
     connect(_ui->calendar, SIGNAL(clicked(QDate)), SLOT(slotCalendarClicked(QDate)));
 
+    _ui->pushButton_setPassword->setEnabled(false);
     _ui->widget_shareLink->hide();
     _ui->lineEdit_password->hide();
     _ui->pushButton_setPassword->hide();
@@ -179,6 +181,12 @@ void ShareDialog::slotPasswordReturnPressed()
     _ui->lineEdit_password->clearFocus();
 }
 
+void ShareDialog::slotPasswordChanged(const QString& newText)
+{
+    // disable the set-passwort button
+    _ui->pushButton_setPassword->setEnabled( newText.length() > 0 );
+}
+
 void ShareDialog::setPassword(const QString &password)
 {
     if( _passwordJobRunning ) {
@@ -356,6 +364,7 @@ void ShareDialog::slotDeleteShareFetched(const QString &reply)
     _ui->pushButton_copy->setEnabled(false);
     _ui->widget_shareLink->hide();
     _ui->lineEdit_password->hide();
+    _ui->pushButton_setPassword->setEnabled(false);
     _ui->pushButton_setPassword->hide();
     _ui->checkBox_expire->setChecked(false);
     _ui->checkBox_password->setChecked(false);
index 2d86fd0888686ee518bb6ac726af4d0ba76eb614..50710de38d467515f26505a761cd6753ef3d6bb7 100644 (file)
@@ -73,6 +73,7 @@ private slots:
     void slotCheckBoxPasswordClicked();
     void slotCheckBoxExpireClicked();
     void slotPasswordReturnPressed();
+    void slotPasswordChanged(const QString& newText);
     void slotPushButtonCopyLinkPressed();
     void slotThumbnailFetched(const int &statusCode, const QByteArray &reply);
 private: