diff options
Diffstat (limited to 'src/libs/installer')
-rw-r--r-- | src/libs/installer/commandlineparser.cpp | 2 | ||||
-rw-r--r-- | src/libs/installer/packagemanagercore.cpp | 13 | ||||
-rw-r--r-- | src/libs/installer/packagemanagercore.h | 2 |
3 files changed, 12 insertions, 5 deletions
diff --git a/src/libs/installer/commandlineparser.cpp b/src/libs/installer/commandlineparser.cpp index 24c771269..4fc295f48 100644 --- a/src/libs/installer/commandlineparser.cpp +++ b/src/libs/installer/commandlineparser.cpp @@ -54,7 +54,7 @@ CommandLineParser::CommandLineParser() .arg(CommandLineOptions::scUpdateShort, CommandLineOptions::scUpdateLong) + QString::fromLatin1("\t%1, %2 - uninstall packages and their child components - <pkg1 pkg2 pkg3...>\n") .arg(CommandLineOptions::scRemoveShort, CommandLineOptions::scRemoveLong) - + QString::fromLatin1("\t%1, %2 - list currently installed packages\n") + + QString::fromLatin1("\t%1, %2 - list currently installed packages - <regexp>\n") .arg(CommandLineOptions::scListShort, CommandLineOptions::scListLong) + QString::fromLatin1("\t%1, %2 - search available packages - <regexp>\n") .arg(CommandLineOptions::scSearchShort, CommandLineOptions::scSearchLong) diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp index eb866e436..820e939cc 100644 --- a/src/libs/installer/packagemanagercore.cpp +++ b/src/libs/installer/packagemanagercore.cpp @@ -2242,16 +2242,23 @@ bool PackageManagerCore::componentUninstallableFromCommandLine(const QString &co } /*! - Lists installed packages without GUI. + Lists installed packages without GUI. List of packages can be filtered with \a regexp. */ -void PackageManagerCore::listInstalledPackages() +void PackageManagerCore::listInstalledPackages(const QString ®exp) { LocalPackagesHash installedPackages = this->localInstalledPackages(); + if (!regexp.isEmpty()) { + qCDebug(QInstaller::lcInstallerInstallLog) + << "Searching packages with regular expression:" << regexp; + } + const QRegularExpression re(regexp); + const QStringList &keys = installedPackages.keys(); foreach (const QString &key, keys) { KDUpdater::LocalPackage package = installedPackages.value(key); - d->printLocalPackageInformation(package); + if (re.match(package.name).hasMatch()) + d->printLocalPackageInformation(package); } } diff --git a/src/libs/installer/packagemanagercore.h b/src/libs/installer/packagemanagercore.h index b0feb1a57..e7cadd4a8 100644 --- a/src/libs/installer/packagemanagercore.h +++ b/src/libs/installer/packagemanagercore.h @@ -233,7 +233,7 @@ public: ComponentModel *defaultComponentModel() const; ComponentModel *updaterComponentModel() const; - void listInstalledPackages(); + void listInstalledPackages(const QString ®exp = QString()); void listAvailablePackages(const QString ®exp); PackageManagerCore::Status updateComponentsSilently(const QStringList &componentsToUpdate); PackageManagerCore::Status installSelectedComponentsSilently(const QStringList& components); |