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