Skip to content

Commit

Permalink
Address PR comments and Sonar Cloud warnings.
Browse files Browse the repository at this point in the history
Signed-off-by: Camila <[email protected]>
  • Loading branch information
Camila committed Oct 26, 2021
1 parent e951f60 commit f4e5f23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
16 changes: 8 additions & 8 deletions src/gui/sharelinkwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void ShareLinkWidget::slotToggleShareLinkAnimation(const bool start)
}
}

void ShareLinkWidget::toggleButtonAnimation(QToolButton *button, QProgressIndicator *progressIndicator, const QAction *checkedAction)
void ShareLinkWidget::toggleButtonAnimation(QToolButton *button, QProgressIndicator *progressIndicator, const QAction *checkedAction) const
{
auto startAnimation = false;
const auto actionIsChecked = checkedAction->isChecked();
Expand Down Expand Up @@ -257,7 +257,7 @@ void ShareLinkWidget::setupUiOptions()
if (_linkShare->getNote().isSimpleText() && !_linkShare->getNote().isEmpty()) {
_ui->textEdit_note->setText(_linkShare->getNote());
_noteLinkAction->setChecked(true);
toggleNoteOptions(true);
toggleNoteOptions();
}

// Adds action to display password widget (check box)
Expand All @@ -267,7 +267,7 @@ void ShareLinkWidget::setupUiOptions()
if (_linkShare.data()->isPasswordSet()) {
_passwordProtectLinkAction->setChecked(true);
_ui->lineEdit_password->setPlaceholderText(QString::fromUtf8(passwordIsSetPlaceholder));
togglePasswordOptions(true);
togglePasswordOptions();
}

// If password is enforced then don't allow users to disable it
Expand All @@ -285,7 +285,7 @@ void ShareLinkWidget::setupUiOptions()
if (!expireDate.isNull()) {
_ui->calendar->setDate(expireDate);
_expirationDateLinkAction->setChecked(true);
toggleExpireDateOptions(true);
toggleExpireDateOptions();
}
connect(_ui->calendar, &QDateTimeEdit::dateChanged, this, &ShareLinkWidget::slotSetExpireDate);
connect(_linkShare.data(), &LinkShare::expireDateSet, this, &ShareLinkWidget::slotExpireDateSet);
Expand Down Expand Up @@ -344,7 +344,7 @@ void ShareLinkWidget::slotNoteSet()
toggleButtonAnimation(_ui->confirmNote, _ui->noteProgressIndicator, _noteLinkAction);
}

void ShareLinkWidget::slotCopyLinkShare(const bool clicked)
void ShareLinkWidget::slotCopyLinkShare(const bool clicked) const
{
Q_UNUSED(clicked);

Expand Down Expand Up @@ -378,7 +378,7 @@ void ShareLinkWidget::slotCreatePassword()
emit createPassword(_ui->lineEdit_password->text());
}

void ShareLinkWidget::slotCreateShareLink(bool clicked)
void ShareLinkWidget::slotCreateShareLink(const bool clicked)
{
Q_UNUSED(clicked);
slotToggleShareLinkAnimation(true);
Expand Down Expand Up @@ -406,7 +406,7 @@ void ShareLinkWidget::slotPasswordSetError(const int code, const QString &messag
toggleButtonAnimation(_ui->confirmPassword, _ui->passwordProgressIndicator, _passwordProtectLinkAction);

slotServerError(code, message);
togglePasswordOptions(true);
togglePasswordOptions();
_ui->lineEdit_password->setFocus();
emit createPasswordProcessed();
}
Expand Down Expand Up @@ -493,7 +493,7 @@ void ShareLinkWidget::slotCreateShareRequiresPassword(const QString &message)

_passwordRequired = true;

togglePasswordOptions(true);
togglePasswordOptions();
}

void ShareLinkWidget::togglePasswordOptions(const bool enable)
Expand Down
13 changes: 6 additions & 7 deletions src/gui/sharelinkwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ public slots:
void slotStyleChanged();

private slots:
void slotCreateShareLink(bool clicked);
void slotCreateShareLink(const bool clicked);
void slotCopyLinkShare(const bool clicked) const;

void slotCreatePassword();
void slotPasswordSet();
Expand Down Expand Up @@ -107,12 +108,10 @@ private slots:
private:
void displayError(const QString &errMsg);

void togglePasswordOptions(const bool enable);
void toggleNoteOptions(const bool enable);
void toggleExpireDateOptions(const bool enable);
void toggleButtonAnimation(QToolButton *button, QProgressIndicator *progressIndicator, const QAction *checkedAction);

void slotCopyLinkShare(const bool clicked);
void togglePasswordOptions(const bool enable = true);
void toggleNoteOptions(const bool enable = true);
void toggleExpireDateOptions(const bool enable = true);
void toggleButtonAnimation(QToolButton *button, QProgressIndicator *progressIndicator, const QAction *checkedAction) const;

/** Confirm with the user and then delete the share */
void confirmAndDeleteShare();
Expand Down

0 comments on commit f4e5f23

Please sign in to comment.