mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-06-04 07:29:49 +08:00
fix: 修复应用信息页面安装再卸载应用后,重新进入页面,应用仍然为已安装状态问题
下载管理中存在已卸载应用的下载记录,判断应用状态时认为应用安装完成 Log: 根据下载记录判断应用状态时,若下载管理显示安装完成,额外判断应用是否已安装
This commit is contained in:
parent
230b208fcb
commit
18e13e4525
@ -55,7 +55,7 @@ void AppIntoPage::openUrl(const QUrl &url)
|
||||
ui->label_2->setText(info["More"].toString());
|
||||
|
||||
// 显示 tags
|
||||
#if (DTK_VERSION >= DTK_VERSION_CHECK(5, 15, 0, 0))
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
QStringList taglist = info["Tags"].toString().split(";", Qt::SkipEmptyParts);
|
||||
#else
|
||||
QStringList taglist = info["Tags"].toString().split(";", QString::SkipEmptyParts);
|
||||
@ -154,7 +154,7 @@ void AppIntoPage::openUrl(const QUrl &url)
|
||||
|
||||
isUpdate.start("dpkg", QStringList() << "--compare-versions" << localVersion << "ge" << info["Version"].toString());
|
||||
isUpdate.waitForFinished(180 * 1000); // 默认超时 3 分钟
|
||||
if (!isUpdate.exitCode())
|
||||
if (isUpdate.exitCode() == 0 && isUpdate.exitStatus() == QProcess::NormalExit)
|
||||
{
|
||||
isUpdated = true;
|
||||
}
|
||||
@ -342,10 +342,27 @@ void AppIntoPage::isDownloading(const QUrl &url)
|
||||
}
|
||||
if (item->download == 3)
|
||||
{
|
||||
ui->downloadButton->setEnabled(true);
|
||||
ui->downloadButton->setText(tr("Reinstall"));
|
||||
ui->downloadButton->show();
|
||||
ui->pushButton_3->show();
|
||||
QString packageName = info["Pkgname"].toString();
|
||||
QProcess process;
|
||||
process.start("/opt/durapps/spark-store/bin/store-helper/check-is-installed", {packageName});
|
||||
process.waitForFinished(-1);
|
||||
|
||||
int exitCode = process.exitCode();
|
||||
QProcess::ExitStatus exitStatus = process.exitStatus();
|
||||
process.close();
|
||||
|
||||
if (exitCode == 0 && exitStatus == QProcess::NormalExit)
|
||||
{
|
||||
ui->downloadButton->setEnabled(true);
|
||||
ui->downloadButton->setText(tr("Reinstall"));
|
||||
ui->downloadButton->show();
|
||||
ui->pushButton_3->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->downloadButton->setEnabled(true);
|
||||
ui->downloadButton->setText(tr("Download and Install"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -490,22 +507,24 @@ void AppIntoPage::on_pushButton_3_clicked()
|
||||
QProcess uninstall;
|
||||
uninstall.start("pkexec", QStringList() << "apt" << "autopurge" << "-y" << info["Pkgname"].toString().toLower());
|
||||
uninstall.waitForFinished(-1);
|
||||
uninstall.close();
|
||||
|
||||
QProcess check;
|
||||
check.start("dpkg", QStringList() << "-s" << info["Pkgname"].toString().toLower());
|
||||
check.waitForFinished(10*1000);
|
||||
check.waitForFinished(-1);
|
||||
|
||||
if (check.readAllStandardOutput().isEmpty())
|
||||
if (check.exitCode() != 0 || check.exitStatus() != QProcess::NormalExit)
|
||||
{
|
||||
ui->downloadButton->setText(tr("Download and Install"));
|
||||
ui->pushButton_3->hide();
|
||||
|
||||
updatesEnabled();
|
||||
Utils::sendNotification("spark-store",tr("Spark Store"),tr("Uninstall succeeded"));
|
||||
}
|
||||
|
||||
ui->downloadButton->setEnabled(true);
|
||||
ui->pushButton_3->setEnabled(true);
|
||||
|
||||
check.close();
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user