summaryrefslogtreecommitdiffstats
path: root/kdpkg-install/install.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 21:11:15 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 21:11:15 +0000
commit9885af067f442d03025eb180e0e5472b636ac265 (patch)
treed3eea362985c3df054c9ac5ad109f2d644bca865 /kdpkg-install/install.cpp
parentb155cffc1b83c93eab4a7a09d5c8a00afec0a528 (diff)
downloadkdpkg-9885af067f442d03025eb180e0e5472b636ac265.tar.gz
kdpkg-9885af067f442d03025eb180e0e5472b636ac265.zip
TQt4 port kdpkg
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdpkg@1239294 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdpkg-install/install.cpp')
-rw-r--r--kdpkg-install/install.cpp182
1 files changed, 91 insertions, 91 deletions
diff --git a/kdpkg-install/install.cpp b/kdpkg-install/install.cpp
index ca08a3c..8e3efe8 100644
--- a/kdpkg-install/install.cpp
+++ b/kdpkg-install/install.cpp
@@ -25,15 +25,15 @@
#include <kurlrequester.h>
#include <kaboutapplication.h>
-#include <qlistbox.h>
-#include <qfile.h>
-#include <qpushbutton.h>
-#include <qwidgetstack.h>
-#include <qlabel.h>
-#include <qlistview.h>
-#include <qregexp.h>
-#include <qradiobutton.h>
-#include <qfiledialog.h>
+#include <tqlistbox.h>
+#include <tqfile.h>
+#include <tqpushbutton.h>
+#include <tqwidgetstack.h>
+#include <tqlabel.h>
+#include <tqlistview.h>
+#include <tqregexp.h>
+#include <tqradiobutton.h>
+#include <tqfiledialog.h>
#include <console.h>
#include <install.h>
@@ -43,12 +43,12 @@
using namespace std;
-install::install( const QString &url, QWidget *parent, const char *name, const QStringList &)
-:InstallDialog(parent, name)
+install::install( const TQString &url, TQWidget *tqparent, const char *name, const TQStringList &)
+:InstallDialog(tqparent, name)
{
if( !url )
- path = KFileDialog::getOpenFileName( QString::null, QString("*.deb|") + i18n("Debian Package (*.deb)"), this, i18n("Choose a Debian package file to open"));
+ path = KFileDialog::getOpenFileName( TQString(), TQString("*.deb|") + i18n("Debian Package (*.deb)"), this, i18n("Choose a Debian package file to open"));
else
path = url;
@@ -56,7 +56,7 @@ install::install( const QString &url, QWidget *parent, const char *name, const Q
this->shell->setCommand("dpkg -f "+path);
this->shell->start(true);
- fields = QStringList::split( "\n", this->shell->getBuffer().stripWhiteSpace() );
+ fields = TQStringList::split( "\n", this->shell->getBuffer().stripWhiteSpace() );
installPushButton->hide();
nextPushButton1->hide();
@@ -81,7 +81,7 @@ install::install( const QString &url, QWidget *parent, const char *name, const Q
i=2048;
}
}
- m_kdePrefix = QString(prefix_result);
+ m_kdePrefix = TQString(prefix_result);
}
if( !checkArchitecture() )
@@ -163,14 +163,14 @@ void install::page3()
titleTextLabel->setText( "<b>"+i18n( "Resynchronize Package Index")+"</b>" );
closePushButton->hide();
- QStrList run; run.append( m_kdePrefix + "/share/kdpkg/sh/kdpkg-sh" );
+ TQStrList run; run.append( m_kdePrefix + "/share/kdpkg/sh/kdpkg-sh" );
run.append( "update" );
- QWidget *consoleWidget = new console(this, run );
+ TQWidget *consoleWidget = new console(this, run );
widgetStack->addWidget(consoleWidget, 4);
widgetStack->raiseWidget(4);
- connect( consoleWidget, SIGNAL( finished(bool) ), this, SLOT( page1() ));
+ connect( consoleWidget, TQT_SIGNAL( finished(bool) ), this, TQT_SLOT( page1() ));
}
@@ -186,18 +186,18 @@ void install::page4()
if( !removePkg )
removePkg = "none";
- QStrList run; run.append( m_kdePrefix + "/share/kdpkg/sh/kdpkg-sh" );
+ TQStrList run; run.append( m_kdePrefix + "/share/kdpkg/sh/kdpkg-sh" );
run.append( "install" );
run.append( path );
run.append( installPkg );
run.append( removePkg );
- QWidget *consoleWidget = new console(this, run );
+ TQWidget *consoleWidget = new console(this, run );
widgetStack->addWidget(consoleWidget, 5);
widgetStack->raiseWidget(5);
- //connect( consoleWidget, SIGNAL( finished(bool) ), this, SLOT( close() ));
- connect( consoleWidget, SIGNAL( finished(bool) ), this, SLOT( page5() ));
+ //connect( consoleWidget, TQT_SIGNAL( finished(bool) ), this, TQT_SLOT( close() ));
+ connect( consoleWidget, TQT_SIGNAL( finished(bool) ), this, TQT_SLOT( page5() ));
}
@@ -215,27 +215,27 @@ void install::page5()
//--- get --------------------------------------------------------------------//
//----------------------------------------------------------------------------//
-QStringList install::getVersions(QString package)
+TQStringList install::getVersions(TQString package)
{
this->shell->setCommand("apt-cache policy "+package);
this->shell->start(true);
- QStringList input = QStringList::split( "\n", this->shell->getBuffer().stripWhiteSpace() );
+ TQStringList input = TQStringList::split( "\n", this->shell->getBuffer().stripWhiteSpace() );
- QString sysVersion = input[1];
- sysVersion = QStringList::split( ":", sysVersion)[1].replace(" ","");
+ TQString sysVersion = input[1];
+ sysVersion = TQStringList::split( ":", sysVersion)[1].tqreplace(" ","");
- if( sysVersion.contains("(") || sysVersion == "" )
+ if( sysVersion.tqcontains("(") || sysVersion == "" )
sysVersion = i18n("not installed");
- QString repVersion = input[2];
- repVersion = QStringList::split( ":", repVersion)[1].replace(" ","");
+ TQString repVersion = input[2];
+ repVersion = TQStringList::split( ":", repVersion)[1].tqreplace(" ","");
- if( repVersion.contains("(") || repVersion == "" )
+ if( repVersion.tqcontains("(") || repVersion == "" )
repVersion = i18n("not available");
- QStringList versions;
+ TQStringList versions;
versions.append(sysVersion);
versions.append(repVersion);
@@ -253,30 +253,30 @@ 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") );
+ TQString debianPkgName = fields.grep("Package:")[0].mid(9);
+ TQString debianPkgVersion = fields.grep("Version:")[0].mid(9);
+ TQStringList debianVersions = getVersions(fields.grep("Package:")[0].mid(9));
+ TQString debianSysVersion = debianVersions[0];
+ TQListViewItem * ditem = new TQListViewItem( dependenciesListView, 0 );
+ ditem->setPixmap( 0, TQPixmap( 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);
+ TQString tmpString = fields.grep( TQRegExp("^Depends:") )[0].mid(9);
tmpString += ", "+fields.grep( "Pre-Depends:" )[0].mid(13);
- QStringList allDepends = QStringList::split( ", ", tmpString );
+ TQStringList allDepends = TQStringList::split( ", ", tmpString );
- QString missingDepends;
- QStringList tmp;
+ TQString missingDepends;
+ TQStringList tmp;
for(uint i = 0; i < allDepends.count(); i++)
{
- if( allDepends[i].contains("|") ) {
- tmp = QStringList::split( " | ", allDepends[i] );
+ if( allDepends[i].tqcontains("|") ) {
+ tmp = TQStringList::split( " | ", allDepends[i] );
uint j = 0;
bool exit = FALSE;
while ( !exit && j < tmp.count() ) {
@@ -290,35 +290,35 @@ void install::showDependencies()
else
{
if( !isInstalled( allDepends[i] ) )
- missingDepends += QStringList::split( " ", allDepends[i] )[0]+" ";
+ missingDepends += TQStringList::split( " ", allDepends[i] )[0]+" ";
}
}
- while (missingDepends.find("(") != -1) {
- start_index = missingDepends.find("(");
- stop_index = missingDepends.find(")", start_index);
- missingDepends.replace(start_index, stop_index-start_index+1, "");
+ while (missingDepends.tqfind("(") != -1) {
+ start_index = missingDepends.tqfind("(");
+ stop_index = missingDepends.tqfind(")", start_index);
+ missingDepends.tqreplace(start_index, stop_index-start_index+1, "");
}
this->shell->setCommand("apt-get -s install "+missingDepends);
this->shell->start(true);
- QStringList installList = QStringList::split( "\n", this->shell->getBuffer().stripWhiteSpace() ).grep("Inst");
+ TQStringList installList = TQStringList::split( "\n", this->shell->getBuffer().stripWhiteSpace() ).grep("Inst");
for(uint i = 0; i < installList.count(); i++)
{
- QString name = QStringList::split( " ", installList[i] )[1];
- QString pkgVersion;
- QString sysVersion;
- if( installList[i].contains("[") )
+ TQString name = TQStringList::split( " ", installList[i] )[1];
+ TQString pkgVersion;
+ TQString sysVersion;
+ if( installList[i].tqcontains("[") )
{
- pkgVersion = QStringList::split( " ", installList[i] )[3].mid(1);
- sysVersion = QStringList::split( " ", installList[i] )[2].mid(1).replace("]", "");
+ pkgVersion = TQStringList::split( " ", installList[i] )[3].mid(1);
+ sysVersion = TQStringList::split( " ", installList[i] )[2].mid(1).tqreplace("]", "");
}
else
- pkgVersion = QStringList::split( " ", installList[i] )[2].mid(1);
+ pkgVersion = TQStringList::split( " ", installList[i] )[2].mid(1);
- QListViewItem * item = new QListViewItem( dependenciesListView, 0 );
- item->setPixmap( 0, QPixmap( m_kdePrefix + "/share/kdpkg/icons/install.png") );
+ TQListViewItem * item = new TQListViewItem( dependenciesListView, 0 );
+ item->setPixmap( 0, TQPixmap( m_kdePrefix + "/share/kdpkg/icons/install.png") );
item->setText( 1, name );
item->setText( 2, pkgVersion );
item->setText( 3, sysVersion );
@@ -328,27 +328,27 @@ void install::showDependencies()
// find rconflicts
- QString pkgName = fields.grep("Package:")[0].mid(9);
- QString pkgVersion = fields.grep("Version:")[0].mid(9);
+ TQString pkgName = fields.grep("Package:")[0].mid(9);
+ TQString pkgVersion = fields.grep("Version:")[0].mid(9);
- QString rconflicts;
+ TQString rconflicts;
this->shell->setCommand("cat /var/lib/dpkg/status | grep "+pkgName+" -B 16| grep Conflicts -B 16");
this->shell->start(true);
- QStringList input1 = QStringList::split( "\n\n", this->shell->getBuffer().stripWhiteSpace() );
+ TQStringList input1 = TQStringList::split( "\n\n", this->shell->getBuffer().stripWhiteSpace() );
for(uint i = 0; i < input1.count(); i++)
{
- if( input1[i].contains(pkgName) )
+ if( input1[i].tqcontains(pkgName) )
{
- QStringList input2 = QStringList::split( "\n", input1[i] );
- QString name = QStringList::split( " ", input2.grep("Package:")[0] )[1];
- QString cVersion = input2.grep("Conflicts:")[0].mid(11); // conflictVersion
- cVersion = QStringList::split( ",", cVersion ).grep(pkgName)[0];
- cVersion = QStringList::split( "(", cVersion )[1];
- cVersion = cVersion.replace(")", "");
- QString op = QStringList::split( " ", cVersion )[0];
- cVersion = QStringList::split( " ", cVersion )[1];
+ TQStringList input2 = TQStringList::split( "\n", input1[i] );
+ TQString name = TQStringList::split( " ", input2.grep("Package:")[0] )[1];
+ TQString cVersion = input2.grep("Conflicts:")[0].mid(11); // conflictVersion
+ cVersion = TQStringList::split( ",", cVersion ).grep(pkgName)[0];
+ cVersion = TQStringList::split( "(", cVersion )[1];
+ cVersion = cVersion.tqreplace(")", "");
+ TQString op = TQStringList::split( " ", cVersion )[0];
+ cVersion = TQStringList::split( " ", cVersion )[1];
if( cVersion == "")
{
@@ -369,27 +369,27 @@ void install::showDependencies()
// show packages which will be removed
- QString conflicts = fields.grep( "Conflicts" )[0].mid(11);
- conflicts = conflicts.replace( ",", "" );
+ TQString conflicts = fields.grep( "Conflicts" )[0].mid(11);
+ conflicts = conflicts.tqreplace( ",", "" );
conflicts = conflicts+" "+rconflicts;
- while (conflicts.find("(") != -1) {
- start_index = conflicts.find("(");
- stop_index = conflicts.find(")", start_index);
- conflicts.replace(start_index, stop_index-start_index+1, "");
+ while (conflicts.tqfind("(") != -1) {
+ start_index = conflicts.tqfind("(");
+ stop_index = conflicts.tqfind(")", start_index);
+ conflicts.tqreplace(start_index, stop_index-start_index+1, "");
}
this->shell->setCommand("apt-get -s remove "+conflicts);
this->shell->start(true);
- QStringList removeList = QStringList::split( "\n", this->shell->getBuffer().stripWhiteSpace() ).grep("Remv");
+ TQStringList removeList = TQStringList::split( "\n", this->shell->getBuffer().stripWhiteSpace() ).grep("Remv");
for(uint i = 0; i < removeList.count(); i++)
{
- QString name = QStringList::split( " ", removeList[i] )[1];
- QString sysVersion = QStringList::split( " [", removeList[i] )[1].replace("]", "");
+ TQString name = TQStringList::split( " ", removeList[i] )[1];
+ TQString sysVersion = TQStringList::split( " [", removeList[i] )[1].tqreplace("]", "");
- QListViewItem * item = new QListViewItem( dependenciesListView, 0 );
- item->setPixmap( 0, QPixmap( m_kdePrefix + "/share/kdpkg/icons/remove.png") );
+ TQListViewItem * item = new TQListViewItem( dependenciesListView, 0 );
+ item->setPixmap( 0, TQPixmap( m_kdePrefix + "/share/kdpkg/icons/remove.png") );
item->setText( 1, name );
item->setText( 3, sysVersion );
@@ -401,24 +401,24 @@ void install::showDependencies()
//--- isInstalled ------------------------------------------------------------//
//----------------------------------------------------------------------------//
-bool install::isInstalled(QString input)
+bool install::isInstalled(TQString input)
{
- QString package = QStringList::split( " ", input )[0];
- QString version = QStringList::split( " (", input )[1].replace(")", "");
+ TQString package = TQStringList::split( " ", input )[0];
+ TQString version = TQStringList::split( " (", input )[1].tqreplace(")", "");
this->shell->setCommand("apt-cache policy "+package);
this->shell->start(true);
- QString sysVersion = QStringList::split( "\n", this->shell->getBuffer().stripWhiteSpace() )[1];
- sysVersion = QStringList::split( ":", sysVersion)[1].replace(" ","");
+ TQString sysVersion = TQStringList::split( "\n", this->shell->getBuffer().stripWhiteSpace() )[1];
+ sysVersion = TQStringList::split( ":", sysVersion)[1].tqreplace(" ","");
- if( sysVersion.contains("(") || sysVersion == "" )
+ if( sysVersion.tqcontains("(") || sysVersion == "" )
return FALSE;
else if( version != "" )
{
- QString op = QStringList::split( " ", version )[0];
- QString pkgVersion = QStringList::split( " ", version )[1];
+ TQString op = TQStringList::split( " ", version )[0];
+ TQString pkgVersion = TQStringList::split( " ", version )[1];
this->shell->setCommand("if dpkg --compare-versions "+sysVersion+" \""+op+"\" "+pkgVersion+"; then echo \"TRUE\"; fi");
this->shell->start(true);
@@ -447,7 +447,7 @@ void install::showAbout()
bool install::checkArchitecture()
{
- QString arch = fields.grep("Architecture:")[0].mid(14);
+ TQString arch = fields.grep("Architecture:")[0].mid(14);
if(arch == "all")
return TRUE;
@@ -468,7 +468,7 @@ bool install::isLocked()
{
this->shell->setCommand("apt-get install -s" );
this->shell->start(true);
- if( this->shell->getBuffer().stripWhiteSpace().contains("...") )
+ if( this->shell->getBuffer().stripWhiteSpace().tqcontains("...") )
return FALSE;
else
return TRUE;