diff options
Diffstat (limited to 'kdpkg-install/install.cpp')
-rw-r--r-- | kdpkg-install/install.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/kdpkg-install/install.cpp b/kdpkg-install/install.cpp index 9904018..7b26e58 100644 --- a/kdpkg-install/install.cpp +++ b/kdpkg-install/install.cpp @@ -200,6 +200,36 @@ void install::page4() } +//----------------------------------------------------------------------------// +//--- get --------------------------------------------------------------------// +//----------------------------------------------------------------------------// + +QStringList install::getVersions(QString package) +{ + this->shell->setCommand("apt-cache policy "+package); + this->shell->start(true); + QStringList input = QStringList::split( "\n", this->shell->getBuffer().stripWhiteSpace() ); + + QString sysVersion = input[1]; + sysVersion = QStringList::split( ":", sysVersion)[1].replace(" ",""); + + if( sysVersion.contains("(") || sysVersion == "" ) + sysVersion = i18n("not installed"); + + + QString repVersion = input[2]; + repVersion = QStringList::split( ":", repVersion)[1].replace(" ",""); + + if( repVersion.contains("(") || repVersion == "" ) + repVersion = i18n("not available"); + + + QStringList versions; + versions.append(sysVersion); + versions.append(repVersion); + + return versions; +} //----------------------------------------------------------------------------// //--- showDependencies -------------------------------------------------------// @@ -212,6 +242,17 @@ void install::showDependencies() // show packages which will be installed + QString debianPkgName = fields.grep("Package:")[0].mid(9); + QString debianPkgVersion = fields.grep("Version:")[0].mid(9); + QStringList debianVersions = getVersions(fields.grep("Package:")[0].mid(9)); + QString debianSysVersion = debianVersions[0]; + QListViewItem * ditem = new QListViewItem( dependenciesListView, 0 ); + ditem->setPixmap( 0, QPixmap( m_kdePrefix + "/share/kdpkg/icons/install.png") ); + ditem->setText( 1, debianPkgName ); + ditem->setText( 2, debianPkgVersion ); + ditem->setText( 3, debianSysVersion ); + + QString tmpString = fields.grep( QRegExp("^Depends:") )[0].mid(9); tmpString += ", "+fields.grep( "Pre-Depends:" )[0].mid(13); |