Merge pull request #1782 from Trial97/warn_remove_account

This commit is contained in:
Sefa Eyeoglu 2023-11-03 12:56:13 +01:00 committed by GitHub
commit ef40ba8439
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,22 +42,17 @@
#include <QDebug> #include <QDebug>
#include "net/NetJob.h"
#include "ui/dialogs/CustomMessageBox.h" #include "ui/dialogs/CustomMessageBox.h"
#include "ui/dialogs/MSALoginDialog.h" #include "ui/dialogs/MSALoginDialog.h"
#include "ui/dialogs/OfflineLoginDialog.h" #include "ui/dialogs/OfflineLoginDialog.h"
#include "ui/dialogs/ProgressDialog.h" #include "ui/dialogs/ProgressDialog.h"
#include "ui/dialogs/SkinUploadDialog.h" #include "ui/dialogs/SkinUploadDialog.h"
#include "minecraft/auth/AccountTask.h"
#include "minecraft/services/SkinDelete.h" #include "minecraft/services/SkinDelete.h"
#include "tasks/Task.h" #include "tasks/Task.h"
#include "Application.h" #include "Application.h"
#include "BuildConfig.h"
AccountListPage::AccountListPage(QWidget* parent) : QMainWindow(parent), ui(new Ui::AccountListPage) AccountListPage::AccountListPage(QWidget* parent) : QMainWindow(parent), ui(new Ui::AccountListPage)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -172,6 +167,12 @@ void AccountListPage::on_actionAddOffline_triggered()
void AccountListPage::on_actionRemove_triggered() void AccountListPage::on_actionRemove_triggered()
{ {
auto response = CustomMessageBox::selectable(this, tr("Remove account?"), tr("Do you really want to delete this account?"),
QMessageBox::Question, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
->exec();
if (response != QMessageBox::Yes) {
return;
}
QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();
if (selection.size() > 0) { if (selection.size() > 0) {
QModelIndex selected = selection.first(); QModelIndex selected = selection.first();