Fixed remane and delete of selected skin

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-10-25 19:56:26 +03:00
parent a5938a7de9
commit 263dc5af67
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
2 changed files with 5 additions and 3 deletions

View File

@ -359,7 +359,7 @@ bool SkinList::setData(const QModelIndex& idx, const QVariant& value, int role)
int row = idx.row();
if (row < 0 || row >= m_skin_list.size())
return false;
auto skin = m_skin_list[row];
auto& skin = m_skin_list[row];
auto newName = value.toString();
if (skin.name() != newName) {
skin.rename(newName);

View File

@ -229,8 +229,10 @@ void SkinManageDialog::on_steveBtn_toggled(bool checked)
void SkinManageDialog::accept()
{
auto skin = m_list.skin(m_selected_skin);
if (!skin)
if (!skin) {
reject();
return;
}
auto path = skin->getPath();
ProgressDialog prog(this);
@ -315,7 +317,7 @@ void SkinManageDialog::on_action_Delete_Skin_triggered(bool checked)
return;
if (m_list.getSkinIndex(m_selected_skin) == m_list.getSelectedAccountSkin()) {
CustomMessageBox::selectable(this, tr("Delete error"), tr("Can not delete skin that is in use."), QMessageBox::Warning);
CustomMessageBox::selectable(this, tr("Delete error"), tr("Can not delete skin that is in use."), QMessageBox::Warning)->exec();
return;
}