mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-10-10 04:12:20 +08:00
fix: 修复软件包卸载问题
fix: 修复软件包卸载失败以及取消卸载后显示成功的问题 fix: 修复下载列表不显示应用缩略图的问题 chore: 优化部分代码
This commit is contained in:
parent
7d4944279f
commit
f23809b28e
@ -144,35 +144,17 @@ void downloadlist::install(int t)
|
||||
QtConcurrent::run([=]()
|
||||
{
|
||||
QProcess installer;
|
||||
if(!reinstall)
|
||||
switch(t)
|
||||
{
|
||||
switch(t)
|
||||
{
|
||||
case 0:
|
||||
installer.start("pkexec ssinstall /tmp/spark-store/" + ui->label_filename->text().toUtf8());
|
||||
break;
|
||||
case 1:
|
||||
installer.start("deepin-deb-installer /tmp/spark-store/" + ui->label_filename->text().toUtf8());
|
||||
break;
|
||||
case 2:
|
||||
installer.start("pkexec gdebi -n /tmp/spark-store/" + ui->label_filename->text().toUtf8());
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(t)
|
||||
{
|
||||
case 0:
|
||||
installer.start("pkexec ssinstall /tmp/spark-store/" + ui->label_filename->text().toUtf8());
|
||||
break;
|
||||
case 1:
|
||||
installer.start("deepin-deb-installer /tmp/spark-store/" + ui->label_filename->text().toUtf8());
|
||||
break;
|
||||
case 2:
|
||||
installer.start("pkexec gdebi -n /tmp/spark-store/" + ui->label_filename->text().toUtf8());
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
installer.start("pkexec", QStringList() << "ssinstall" << "/tmp/spark-store/" + ui->label_filename->text().toUtf8());
|
||||
break;
|
||||
case 1:
|
||||
installer.start("deepin-deb-installer", QStringList() << "/tmp/spark-store/" + ui->label_filename->text().toUtf8());
|
||||
break;
|
||||
case 2:
|
||||
installer.start("pkexec", QStringList() << "gdebi" << "-n" << "/tmp/spark-store/" + ui->label_filename->text().toUtf8());
|
||||
break;
|
||||
}
|
||||
|
||||
bool haveError = false;
|
||||
|
@ -629,8 +629,8 @@ void Widget::on_pushButton_download_clicked()
|
||||
download_list[allDownload - 1].setFileName(fileName);
|
||||
|
||||
QPixmap icon;
|
||||
icon.load("icon.png");
|
||||
system("cp icon.png icon_" + QString::number(allDownload - 1).toUtf8() + ".png");
|
||||
icon.load("/tmp/spark-store/icon.png", "PNG");
|
||||
system("cp /tmp/spark-store/icon.png /tmp/spark-store/icon_" + QString::number(allDownload - 1).toUtf8() + ".png");
|
||||
download_list[allDownload - 1].seticon(icon);
|
||||
|
||||
if(!isBusy)
|
||||
@ -1159,16 +1159,24 @@ void Widget::on_pushButton_uninstall_clicked()
|
||||
ui->pushButton_uninstall->setEnabled(false);
|
||||
|
||||
QProcess uninstall;
|
||||
uninstall.start("pkexec apt purge -y " + pkgName.toLower());
|
||||
uninstall.start("pkexec", QStringList() << "apt" << "purge" << "-y" << pkgName.toLower());
|
||||
uninstall.waitForFinished();
|
||||
|
||||
ui->pushButton_download->setEnabled(true);
|
||||
ui->pushButton_download->setText("Install");
|
||||
ui->pushButton_uninstall->hide();
|
||||
ui->pushButton_uninstall->setEnabled(true);
|
||||
QProcess check;
|
||||
check.start("dpkg", QStringList() << "-s" << pkgName.toLower());
|
||||
check.waitForFinished();
|
||||
|
||||
updatesEnabled();
|
||||
sendNotification(tr("Uninstall succeeded"));
|
||||
if (check.readAllStandardOutput().isEmpty())
|
||||
{
|
||||
ui->pushButton_download->setText(tr("Install"));
|
||||
ui->pushButton_uninstall->hide();
|
||||
|
||||
updatesEnabled();
|
||||
sendNotification(tr("Uninstall succeeded"));
|
||||
}
|
||||
|
||||
ui->pushButton_download->setEnabled(true);
|
||||
ui->pushButton_uninstall->setEnabled(true);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -109,6 +109,11 @@ void SpkAppInfoLoaderThread::run()
|
||||
QPixmap appicon;
|
||||
appicon.loadFromData(imgData);
|
||||
emit finishedIconLoad(&appicon);
|
||||
|
||||
QFile icon("/tmp/spark-store/icon.png");
|
||||
icon.open(QFile::WriteOnly);
|
||||
appicon.save(&icon, "PNG");
|
||||
icon.close();
|
||||
})
|
||||
.onError([this](QString errorStr)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user