Skip to content

Commit

Permalink
Sharing: Pre-check pw/expiry if the server requires it
Browse files Browse the repository at this point in the history
Since the check boxes are disabled users can't check them themselves.

For #7246
  • Loading branch information
ckamm committed Jun 17, 2019
1 parent 7d84208 commit 9a02d51
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/gui/sharelinkwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
};
retainSizeWhenHidden(_ui->pushButton_setPassword);
retainSizeWhenHidden(_ui->create);

// If this starts out empty the first call to slotShareSelectionChanged()
// will not properly initialize the ui state if "Create new..." is the
// only option. So pre-fill with an invalid share id.
_selectedShareId = QStringLiteral("!&no-share-selected");
}

ShareLinkWidget::~ShareLinkWidget()
Expand Down Expand Up @@ -341,6 +346,10 @@ void ShareLinkWidget::slotShareSelectionChanged()
_ui->checkBox_password->setChecked(true);
_ui->lineEdit_password->setPlaceholderText("********");
_ui->lineEdit_password->setEnabled(true);
} else if (createNew && _passwordRequired) {
_ui->checkBox_password->setChecked(true);
_ui->lineEdit_password->setPlaceholderText(tr("Please Set Password"));
_ui->lineEdit_password->setEnabled(true);
} else {
_ui->checkBox_password->setChecked(false);
_ui->lineEdit_password->setPlaceholderText(QString());
Expand All @@ -356,6 +365,9 @@ void ShareLinkWidget::slotShareSelectionChanged()
_ui->checkBox_expire->setChecked(true);
_ui->calendar->setDate(share->getExpireDate());
_ui->calendar->setEnabled(true);
} else if (createNew && _expiryRequired) {
_ui->checkBox_expire->setChecked(true);
_ui->calendar->setEnabled(true);
} else {
_ui->checkBox_expire->setChecked(false);
_ui->calendar->setEnabled(false);
Expand Down

0 comments on commit 9a02d51

Please sign in to comment.