mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-13 05:37:42 +02:00
NOISSUE implement deleting skins
This commit is contained in:
@ -30,6 +30,7 @@
|
||||
#include "dialogs/SkinUploadDialog.h"
|
||||
#include "tasks/Task.h"
|
||||
#include "minecraft/auth/YggdrasilTask.h"
|
||||
#include "minecraft/services/SkinDelete.h"
|
||||
|
||||
#include "MultiMC.h"
|
||||
|
||||
@ -142,6 +143,7 @@ void AccountListPage::updateButtonStates()
|
||||
ui->actionRemove->setEnabled(selection.size() > 0);
|
||||
ui->actionSetDefault->setEnabled(selection.size() > 0);
|
||||
ui->actionUploadSkin->setEnabled(selection.size() > 0);
|
||||
ui->actionDeleteSkin->setEnabled(selection.size() > 0);
|
||||
|
||||
if(m_accounts->activeAccount().get() == nullptr) {
|
||||
ui->actionNoDefault->setEnabled(false);
|
||||
@ -191,3 +193,25 @@ void AccountListPage::on_actionUploadSkin_triggered()
|
||||
dialog.exec();
|
||||
}
|
||||
}
|
||||
|
||||
void AccountListPage::on_actionDeleteSkin_triggered()
|
||||
{
|
||||
QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();
|
||||
if (selection.size() <= 0)
|
||||
return;
|
||||
|
||||
QModelIndex selected = selection.first();
|
||||
AuthSessionPtr session = std::make_shared<AuthSession>();
|
||||
MojangAccountPtr account = selected.data(MojangAccountList::PointerRole).value<MojangAccountPtr>();
|
||||
auto login = account->login(session);
|
||||
ProgressDialog prog(this);
|
||||
if (prog.execWithTask((Task*)login.get()) != QDialog::Accepted) {
|
||||
CustomMessageBox::selectable(this, tr("Skin Delete"), tr("Failed to login!"), QMessageBox::Warning)->exec();
|
||||
return;
|
||||
}
|
||||
auto deleteSkinTask = std::make_shared<SkinDelete>(this, session);
|
||||
if (prog.execWithTask((Task*)deleteSkinTask.get()) != QDialog::Accepted) {
|
||||
CustomMessageBox::selectable(this, tr("Skin Delete"), tr("Failed to delete current skin!"), QMessageBox::Warning)->exec();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user