diff --git a/inc/pkgs/spkpkgmgrapt.h b/inc/pkgs/spkpkgmgrapt.h index 3c2b6c5..d5576e8 100644 --- a/inc/pkgs/spkpkgmgrapt.h +++ b/inc/pkgs/spkpkgmgrapt.h @@ -18,6 +18,9 @@ class SpkPkgMgrApt : public SpkPkgMgrBase // APT backend specific bool ChangeServerRepository(QString content); + private: + void CheckInstallerAvailability(); + private: QAction *mActAptitudeTerm, *mActAptTerm, diff --git a/src/pkgs/spkpkgmgrapt.cpp b/src/pkgs/spkpkgmgrapt.cpp index da060f2..a2d648e 100644 --- a/src/pkgs/spkpkgmgrapt.cpp +++ b/src/pkgs/spkpkgmgrapt.cpp @@ -8,6 +8,15 @@ SpkPkgMgrApt::SpkPkgMgrApt(QObject *parent) : mActDesc = new QAction("Debian APT", this); mActDesc->setDisabled(true); + mActAptTerm = new QAction(tr("APT (in terminal)"), this); + mActAptitudeTerm = new QAction(tr("Aptitude (in terminal)"), this); + mActGdebi = new QAction(tr("GDebi"), this); + mActDeepinPkgInst = new QAction(tr("Deepin Package Installer"), this); + + mMenu->addAction(mActAptTerm); + mMenu->addAction(mActAptitudeTerm); + mMenu->addAction(mActGdebi); + mMenu->addAction(mActDeepinPkgInst); mMenu->addSeparator(); mMenu->addAction(mActDesc); } @@ -15,13 +24,21 @@ SpkPkgMgrApt::SpkPkgMgrApt(QObject *parent) : bool SpkPkgMgrApt::DetectRequirements() { return QFile::exists("/usr/bin/apt") && - QFile::exists("/etc/apt/apt.conf"); + QFile::exists("/usr/bin/dpkg"); } SpkPkgMgrBase::PkgInstallResult SpkPkgMgrApt::ExecuteInstallation(QString pkgPath, int entryId) { + CheckInstallerAvailability(); return SpkPkgMgrBase::ExecuteInstallation(pkgPath, entryId); } +void SpkPkgMgrApt::CheckInstallerAvailability() +{ + mActAptitudeTerm->setEnabled(QFile::exists("/usr/bin/aptitude")); + mActGdebi->setEnabled(QFile::exists("/usr/bin/gdebi")); + mActDeepinPkgInst->setEnabled(QFile::exists("/usr/bin/deepin-deb-installer")); +} +