Skip to content

Commit

Permalink
Fix: prevent deletion of loaded profile (Mudlet#7436)
Browse files Browse the repository at this point in the history
#### Brief overview of PR changes/additions
Using the same code execution that puts up the warning about a profile
being used not being editable (in some ways) to also disable the
"Remove" button.

#### Motivation for adding to Mudlet
It has already been proven to break things!

#### Other info (issues closed, discussion etc)
This should close Mudlet#2225 - and give me a $20 bounty!

This was originally built on top of Mudlet#7428 - but it was rebased onto
`development` - and neither PR is affected by the other one.

---------

Signed-off-by: Stephen Lyons <[email protected]>
Co-authored-by: Vadim Peretokin <[email protected]>
  • Loading branch information
SlySven and vadi2 authored Oct 7, 2024
1 parent 98778ee commit 9fe161e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/dlgConnectionProfiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,9 @@ void dlgConnectionProfiles::slot_itemClicked(QListWidgetItem* pItem)
const QString profileLoadedMessage = tr("This profile is currently loaded - close it before changing the connection parameters.");

if (mudlet::self()->getHostManager().getHost(profile_name)) {
remove_profile_button->setEnabled(false);
remove_profile_button->setToolTip(utils::richText(tr("A profile that is in use cannot be removed")));

profile_name_entry->setReadOnly(true);
host_name_entry->setReadOnly(true);
port_entry->setReadOnly(true);
Expand Down Expand Up @@ -979,6 +982,8 @@ void dlgConnectionProfiles::slot_itemClicked(QListWidgetItem* pItem)
if (notificationAreaMessageBox->text() == profileLoadedMessage) {
clearNotificationArea();
}
remove_profile_button->setEnabled(true);
remove_profile_button->setToolTip(QString());
}
}

Expand Down

0 comments on commit 9fe161e

Please sign in to comment.