diff --git a/src/icons/delete.svg b/src/icons/delete.svg new file mode 100644 --- /dev/null +++ b/src/icons/delete.svg @@ -0,0 +1,13 @@ + + + + + + diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -425,6 +425,16 @@ auto hLayout = new QHBoxLayout(); auto saveBtn = new QPushButton(QIcon::fromTheme("document-save", QIcon(QStringLiteral(":/%1/save").arg(m_theme))), i18n("Save Selected")); saveBtn->setIconSize(iconSize); + saveBtn->setEnabled(false); + + connect(listWidget, &QListWidget::currentRowChanged, this, [saveBtn](const int currentRow) { + if (currentRow < 0) { + saveBtn->setEnabled(false); + } else { + saveBtn->setEnabled(true); + } + }); + connect(saveBtn, &QPushButton::clicked, this, [this, &listWidget, &fileList, &dialog] { if (!m_gcodeEditor->saveFile(fileList.at(listWidget->currentRow()))) { @@ -470,7 +480,7 @@ }); hLayout->addWidget(cancelBtn); - auto ignoreBtn = new QPushButton(QIcon::fromTheme("window-close", QIcon(QStringLiteral(":/icon/close"))), i18n("Ignore")); + auto ignoreBtn = new QPushButton(QIcon::fromTheme("edit-delete", QIcon(QStringLiteral(":/icon/delete"))), i18n("Discard Changes"), dialog); ignoreBtn->setIconSize(iconSize); connect(ignoreBtn, &QPushButton::clicked, this, [&dialog] { dialog->accept(); diff --git a/src/resources.qrc b/src/resources.qrc --- a/src/resources.qrc +++ b/src/resources.qrc @@ -6,6 +6,7 @@ icons/camera-web.svg icons/kwrite.svg icons/logo.svg + icons/delete.svg icons/light_cancel.svg