diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-04-03 23:10:21 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-04-03 23:10:21 +0000 |
commit | 267f75a9de785e93d0d77123dfa6f745eed05def (patch) | |
tree | 7b3932c3ccde28f1db2248363a701d6f785063e3 /kdpkg-install/install.cpp | |
parent | 01a3b7ad4464682c1d4319151ab7791f6f0a9dd8 (diff) | |
download | kdpkg-267f75a9de785e93d0d77123dfa6f745eed05def.tar.gz kdpkg-267f75a9de785e93d0d77123dfa6f745eed05def.zip |
Final set of fixes; application now has proper functionality and is reasonably intuitive as well
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdpkg@1110669 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
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); |