Skip to content

Commit

Permalink
Added a warning dialog when removing the palette.
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Mar 30, 2020
1 parent 4030280 commit 4b3f9b4
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/preferences/colorpaletteeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,20 @@ void ColorPaletteEditor::slotCloseButtonClicked() {

void ColorPaletteEditor::slotRemoveButtonClicked() {
QString paletteName = m_pSaveAsEdit->text().trimmed();
ColorPaletteSettings colorPaletteSettings(m_pConfig);
colorPaletteSettings.removePalette(paletteName);
emit paletteRemoved(paletteName);
accept();

QMessageBox msgBox;
msgBox.setWindowTitle(tr("Remove Palette"));
msgBox.setText(tr(
"Do you really want to remove the palette permanently?"));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Cancel);
int ret = msgBox.exec();
if (ret == QMessageBox::Ok) {
ColorPaletteSettings colorPaletteSettings(m_pConfig);
colorPaletteSettings.removePalette(paletteName);
emit paletteRemoved(paletteName);
accept();
}
}

void ColorPaletteEditor::slotSaveButtonClicked() {
Expand Down

0 comments on commit 4b3f9b4

Please sign in to comment.