summaryrefslogtreecommitdiffstats
path: root/kpackage/rpmInterface.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:25:18 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:25:18 +0000
commitaa3a1ca934bc541bddd3fa136a85f106f7da266e (patch)
tree9ad0b795aed8fa4ac30c2fe0fd1aacb8175714c0 /kpackage/rpmInterface.cpp
parentb10cf7066791a2f362495890cd50c984e8025412 (diff)
downloadtdeadmin-aa3a1ca934bc541bddd3fa136a85f106f7da266e.tar.gz
tdeadmin-aa3a1ca934bc541bddd3fa136a85f106f7da266e.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeadmin@1157635 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpackage/rpmInterface.cpp')
-rw-r--r--kpackage/rpmInterface.cpp174
1 files changed, 87 insertions, 87 deletions
diff --git a/kpackage/rpmInterface.cpp b/kpackage/rpmInterface.cpp
index 655e6b8..8096a78 100644
--- a/kpackage/rpmInterface.cpp
+++ b/kpackage/rpmInterface.cpp
@@ -59,8 +59,8 @@ RPM::RPM():pkgInterface()
locatedialog->dLocations(7,6, this, i18n("Folder","F"),
"Rpm","*.rpm", i18n("Location of Folders Containing RPM Packages"));
- connect(locatedialog,SIGNAL(returnVal(LcacheObj *)),
- this,SLOT(setAvail(LcacheObj *)));
+ connect(locatedialog,TQT_SIGNAL(returnVal(LcacheObj *)),
+ this,TQT_SLOT(setAvail(LcacheObj *)));
locatedialog->apply_slot();
paramsInst.append(new param(i18n("Upgrade"),TRUE,FALSE,"-U","-i"));
@@ -77,7 +77,7 @@ RPM::RPM():pkgInterface()
queryMsg = i18n("Querying RPM package list: ");
- QDict<QString> provides(1433,false);
+ TQDict<TQString> provides(1433,false);
infoList.append("name/%{NAME}");
infoList.append("version/%{VERSION}");
@@ -101,7 +101,7 @@ RPM::RPM():pkgInterface()
RPM::~RPM(){}
-bool RPM::isType(char *buf, const QString & /* fname */)
+bool RPM::isType(char *buf, const TQString & /* fname */)
{
if (hasProgram) {
if ((unsigned char)buf[0] == 0355 && (unsigned char)buf[1] == 0253 &&
@@ -114,7 +114,7 @@ bool RPM::isType(char *buf, const QString & /* fname */)
}
}
-bool RPM::parseName(const QString &name, QString *n, QString *v)
+bool RPM::parseName(const TQString &name, TQString *n, TQString *v)
{
int d1, d2, s1, s2;
@@ -136,10 +136,10 @@ bool RPM::parseName(const QString &name, QString *n, QString *v)
return FALSE;
}
-QString RPM::packageQuery() {
- QString cmd = " --queryformat '";
- for ( QStringList::Iterator it = infoList.begin(); it != infoList.end(); ++it ) {
- QStringList s = QStringList::split("/",*it);
+TQString RPM::packageQuery() {
+ TQString cmd = " --queryformat '";
+ for ( TQStringList::Iterator it = infoList.begin(); it != infoList.end(); ++it ) {
+ TQStringList s = TQStringList::split("/",*it);
cmd += "==";
cmd += s[0];
cmd += "\\n";
@@ -150,20 +150,20 @@ QString RPM::packageQuery() {
return cmd;
}
-void RPM::listInstalledPackages(QPtrList<packageInfo> *pki)
+void RPM::listInstalledPackages(TQPtrList<packageInfo> *pki)
{
int NLINES = 70000;
packageInfo *p;
- QStringList plist;
+ TQStringList plist;
- QString cmd = "rpm -q -a";
+ TQString cmd = "rpm -q -a";
cmd += packageQuery();
kpackage->setStatus(i18n("Querying RPM package list"));
kpackage->setPercent(0);
- QStringList list = kpty->run(cmd);
+ TQStringList list = kpty->run(cmd);
kpackage->setStatus(i18n("Processing RPM package list"));
// kdDebug() << "P=" << list.count() <<"\n";
kpackage->setPercent(50);
@@ -171,11 +171,11 @@ void RPM::listInstalledPackages(QPtrList<packageInfo> *pki)
if (list.count() > 0) {
- QString s;
+ TQString s;
kpackage->setPercent(0 );
int cnt = 0;
- for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
+ for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
cnt++;
if (cnt % (NLINES/20) == 0) {
kpackage->setPercent((cnt * 100)/ NLINES );
@@ -201,14 +201,14 @@ void RPM::listInstalledPackages(QPtrList<packageInfo> *pki)
kpackage->setPercent(100);
}
-packageInfo* RPM::collectInfo(QStringList &ln) {
+packageInfo* RPM::collectInfo(TQStringList &ln) {
bool haveName = FALSE;
- QMap<QString, QString> a;
+ TQMap<TQString, TQString> a;
- QString name, value;
+ TQString name, value;
- for ( QStringList::Iterator it = ln.begin(); it != ln.end(); ++it ) {
+ for ( TQStringList::Iterator it = ln.begin(); it != ln.end(); ++it ) {
if ((*it).left(2) == "==" && (*it).length() >= 2) {
name = (*it).right((*it).length() - 2);
}
@@ -231,8 +231,8 @@ packageInfo* RPM::collectInfo(QStringList &ln) {
} else if (name == "buildtime") {
a.insert("build-time", value);
} else if (name == "requires") {
- value = value.replace(QRegExp("\\(\\)"),"");
- value = value.replace(QRegExp("\\( \\)"),"");
+ value = value.replace(TQRegExp("\\(\\)"),"");
+ value = value.replace(TQRegExp("\\( \\)"),"");
value = value.stripWhiteSpace();
if (value.endsWith(",")) {
value.truncate(value.length()-1);
@@ -240,20 +240,20 @@ packageInfo* RPM::collectInfo(QStringList &ln) {
a.insert("depends", value);
} else if (name == "provides") {
int s = 0, n;
- QString t;
+ TQString t;
if (!(*a.find("name")).isEmpty()) {
while ((n = value.find(",",s)) > 0) {
t = value.mid(s,n-s);
t = t.stripWhiteSpace();
if (!t.isEmpty())
- provides.insert(t,new QString(*a.find("name")));
+ provides.insert(t,new TQString(*a.find("name")));
s = n+1;
}
t = value.mid(s);
t = t.stripWhiteSpace();
if (!t.isEmpty())
- provides.insert(t,new QString(*a.find("name")));
+ provides.insert(t,new TQString(*a.find("name")));
value = value.stripWhiteSpace();
if (value.endsWith(",")) {
@@ -268,8 +268,8 @@ packageInfo* RPM::collectInfo(QStringList &ln) {
}
- QString vers = a["version"];
- QString rel = a["release"];
+ TQString vers = a["version"];
+ TQString rel = a["release"];
if (!vers.isEmpty() && !rel.isEmpty()) {
vers += "-";
vers += rel;
@@ -289,10 +289,10 @@ packageInfo* RPM::collectInfo(QStringList &ln) {
//////////////////////////////////////////////////////////////////////////////
-QStringList RPM::getChangeLog(packageInfo *p)
+TQStringList RPM::getChangeLog(packageInfo *p)
{
- QStringList clog;
- QString fn( p->getFilename());
+ TQStringList clog;
+ TQString fn( p->getFilename());
if(!fn.isEmpty())
return getUChangeLog(fn);
@@ -304,26 +304,26 @@ QStringList RPM::getChangeLog(packageInfo *p)
// query an installed package
-QStringList RPM::getIChangeLog(packageInfo *p)
+TQStringList RPM::getIChangeLog(packageInfo *p)
{
- QString name = p->getProperty("name");
+ TQString name = p->getProperty("name");
- QString cmd = "rpm -q --changelog ";
+ TQString cmd = "rpm -q --changelog ";
cmd += name;
- QStringList filelist = kpty->run(cmd);
+ TQStringList filelist = kpty->run(cmd);
return filelist;
}
// query an uninstalled package
-QStringList RPM::getUChangeLog(const QString &fn)
+TQStringList RPM::getUChangeLog(const TQString &fn)
{
- QString cmd = "rpm -q --changelog -p ";
+ TQString cmd = "rpm -q --changelog -p ";
cmd += quotePath(fn);
- QStringList filelist = kpty->run(cmd);
+ TQStringList filelist = kpty->run(cmd);
return filelist;
}
@@ -350,10 +350,10 @@ bool RPM::changeTab(packageInfo *p) {
//////////////////////////////////////////////////////////////////////////////
-QStringList RPM::getFileList(packageInfo *p)
+TQStringList RPM::getFileList(packageInfo *p)
{
- QStringList filelist;
- QString fn( p->getFilename());
+ TQStringList filelist;
+ TQString fn( p->getFilename());
if(!fn.isEmpty())
return getUFileList(fn);
@@ -366,32 +366,32 @@ QStringList RPM::getFileList(packageInfo *p)
// query an installed package
-QStringList RPM::getIFileList(packageInfo *p)
+TQStringList RPM::getIFileList(packageInfo *p)
{
- QString name = p->getProperty("name");
+ TQString name = p->getProperty("name");
- QString cmd = "rpm -q -l ";
+ TQString cmd = "rpm -q -l ";
cmd += name;
- QStringList filelist = kpty->run(cmd);
+ TQStringList filelist = kpty->run(cmd);
return filelist;
}
// query an uninstalled package
-QStringList RPM::getUFileList(const QString &fn)
+TQStringList RPM::getUFileList(const TQString &fn)
{
- QString cmd = "rpm -q -l -p ";
+ TQString cmd = "rpm -q -l -p ";
cmd += quotePath(fn);
- QStringList filelist = kpty->run(cmd);
+ TQStringList filelist = kpty->run(cmd);
return filelist;
}
//////////////////////////////////////////////////////////////////////////////
-packageInfo *RPM::getPackageInfo(char mode, const QString &name, const QString &)
+packageInfo *RPM::getPackageInfo(char mode, const TQString &name, const TQString &)
{
if (mode == 'i') {
return getIPackageInfo(name);
@@ -399,15 +399,15 @@ packageInfo *RPM::getPackageInfo(char mode, const QString &name, const QString &
return getUPackageInfo(name);
}
-packageInfo *RPM::getIPackageInfo( const QString &name )
+packageInfo *RPM::getIPackageInfo( const TQString &name )
{
// query an installed package!
- QString cmd = "rpm -q";
+ TQString cmd = "rpm -q";
cmd += packageQuery();
cmd += " ";
cmd += name;
- QStringList infoList = kpty->run(cmd);
+ TQStringList infoList = kpty->run(cmd);
packageInfo *pki = collectInfo(infoList);
if (pki) {
pki->packageState = packageInfo::INSTALLED;
@@ -416,15 +416,15 @@ packageInfo *RPM::getIPackageInfo( const QString &name )
return pki;
}
-packageInfo *RPM::getUPackageInfo( const QString &name )
+packageInfo *RPM::getUPackageInfo( const TQString &name )
{
// query an uninstalled package
- QString cmd = "rpm -q";
+ TQString cmd = "rpm -q";
cmd += packageQuery();
cmd += " -p ";
cmd += quotePath(name);
- QStringList infoList = kpty->run(cmd);
+ TQStringList infoList = kpty->run(cmd);
packageInfo *pki = collectInfo(infoList);
if (pki) {
pki->updated = TRUE;
@@ -437,11 +437,11 @@ packageInfo *RPM::getUPackageInfo( const QString &name )
return pki;
}
-QString RPM::provMap( const QString &p )
+TQString RPM::provMap( const TQString &p )
{
- QString *r = provides[p];
+ TQString *r = provides[p];
if (r) {
- QString s = *r;
+ TQString s = *r;
// printf("%s=>%s\n",p.data(),s.data());
return s;
} else {
@@ -451,22 +451,22 @@ QString RPM::provMap( const QString &p )
//////////////////////////////////////////////////////////////////////////////
-void RPM::collectDepends(packageInfo *p, const QString &name, int src)
+void RPM::collectDepends(packageInfo *p, const TQString &name, int src)
{
- QString cmd = "rpm -V --nofiles ";
+ TQString cmd = "rpm -V --nofiles ";
if (src) {
cmd += "-p ";
}
cmd += quotePath(name);
// cmd = "cat /home/toivo/rpm.deps";
- QStringList list = kpty->run(cmd);
+ TQStringList list = kpty->run(cmd);
if (list.count() > 0) {
- QStringList::Iterator it = list.begin();
+ TQStringList::Iterator it = list.begin();
int pt = (*it).find(":");
if (pt > 0) {
- QString s = (*it).mid(pt+1);
+ TQString s = (*it).mid(pt+1);
if (!s.isEmpty()) {
// kdDebug() << "S=" << s << "\n";
p->info.insert("unsatisfied dependencies", s);
@@ -491,9 +491,9 @@ void RPM::setAvail(LcacheObj *slist)
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
-QString RPM::uninstall(int uninstallFlags, QPtrList<packageInfo> *plist, bool &test)
+TQString RPM::uninstall(int uninstallFlags, TQPtrList<packageInfo> *plist, bool &test)
{
- QStringList files;
+ TQStringList files;
packageInfo *pk;
for (pk = plist->first(); pk != 0; pk = plist->next()) {
@@ -507,9 +507,9 @@ QString RPM::uninstall(int uninstallFlags, QPtrList<packageInfo> *plist, bool &t
}
}
-QString RPM::uninstall(int uninstallFlags, packageInfo *p, bool &test)
+TQString RPM::uninstall(int uninstallFlags, packageInfo *p, bool &test)
{
- QStringList files;
+ TQStringList files;
files.append( p->getProperty("name") );
if (getuid() == 0) {
@@ -519,12 +519,12 @@ QString RPM::uninstall(int uninstallFlags, packageInfo *p, bool &test)
}
}
-QString RPM::doUninstP(int uninstallFlags, const QStringList &files, bool &test)
+TQString RPM::doUninstP(int uninstallFlags, const TQStringList &files, bool &test)
{
- QString s = "rpm -e ";
+ TQString s = "rpm -e ";
s += setOptions(uninstallFlags, paramsUninst);
- for (QStringList::ConstIterator it = files.begin(); it != files.end(); ++it ) {
+ for (TQStringList::ConstIterator it = files.begin(); it != files.end(); ++it ) {
s += " ";
s += *it;
}
@@ -541,12 +541,12 @@ QString RPM::doUninstP(int uninstallFlags, const QStringList &files, bool &test)
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
-QString RPM::install(int installFlags, QPtrList<packageInfo> *plist, bool &test)
+TQString RPM::install(int installFlags, TQPtrList<packageInfo> *plist, bool &test)
{
- QStringList files;
+ TQStringList files;
for (packageInfo *pk = plist->first(); pk != 0; pk = plist->next()) {
- QString fname( pk->fetchFilename() );
+ TQString fname( pk->fetchFilename() );
if (!fname.isEmpty()) {
files.append(quotePath(fname));
}
@@ -559,9 +559,9 @@ QString RPM::install(int installFlags, QPtrList<packageInfo> *plist, bool &test)
}
}
-QString RPM::install(int installFlags, packageInfo *p, bool &test)
+TQString RPM::install(int installFlags, packageInfo *p, bool &test)
{
- QStringList files;
+ TQStringList files;
files.append(quotePath(p->fetchFilename()));
if (getuid() == 0) {
return doinstP(installFlags,files,test);
@@ -571,12 +571,12 @@ QString RPM::install(int installFlags, packageInfo *p, bool &test)
}
-QString RPM::doinstP(int installFlags, const QStringList &files, bool &test)
+TQString RPM::doinstP(int installFlags, const TQStringList &files, bool &test)
{
- QString s = "rpm ";
+ TQString s = "rpm ";
s += setOptions(installFlags, paramsInst);
- for (QStringList::ConstIterator it = files.begin(); it != files.end(); ++it ) {
+ for (TQStringList::ConstIterator it = files.begin(); it != files.end(); ++it ) {
s += " ";
s += *it;
}
@@ -589,19 +589,19 @@ QString RPM::doinstP(int installFlags, const QStringList &files, bool &test)
return s;
}
- QStringList RPM::verify(packageInfo *p, const QStringList &files){
+ TQStringList RPM::verify(packageInfo *p, const TQStringList &files){
return pkgInterface::verify(p,files);}
//////////////////////////////////////////////////////////////////////////////
-QStringList RPM::FindFile(const QString &name, bool) {
- QString cmd = "rpm -q -a --filesbypkg";
+TQStringList RPM::FindFile(const TQString &name, bool) {
+ TQString cmd = "rpm -q -a --filesbypkg";
- QStringList list = kpty->run(cmd);
- QStringList retlist;
+ TQStringList list = kpty->run(cmd);
+ TQStringList retlist;
if (kpty->Result > 0) {
list.clear();
} else {
- for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
+ for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
int p = (*it).find(" ");
int nm = (*it).find(name,p);
if (nm >= 0) {
@@ -615,17 +615,17 @@ QStringList RPM::FindFile(const QString &name, bool) {
}
//////////////////////////////////////////////////////////////////////////////
-QString RPM::quotePath( const QString &path) {
- QString s = path;
+TQString RPM::quotePath( const TQString &path) {
+ TQString s = path;
s = s.replace(" ","\\ ");
return ( "'" + s + "'" );
}
//////////////////////////////////////////////////////////////////////////////
- QStringList RPM::depends(const QString &, int){return 0;}
+ TQStringList RPM::depends(const TQString &, int){return 0;}
- QString RPM::doUninst(int, const QStringList &, bool &){return "0=";}
- QString RPM::doinst(int, const QStringList &, bool &){return "0=";}
+ TQString RPM::doUninst(int, const TQStringList &, bool &){return "0=";}
+ TQString RPM::doinst(int, const TQStringList &, bool &){return "0=";}
#include "rpmInterface.moc"