@ -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 < t qlistbox.h>
# include < t qfile.h>
# include < t qpushbutton.h>
# include < t qwidgetstack.h>
# include < t qlabel.h>
# include < t qlistview.h>
# include < t qregexp.h>
# include < t qradiobutton.h>
# include < t qfiledialog.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 T QString & url , T QWidget * tq parent, const char * name , const T QStringList & )
: InstallDialog ( tq parent, 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( ) , T QString( " *.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 = T QStringList: : 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 = T QString( 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 " ) ;
T QStrList run ; run . append ( m_kdePrefix + " /share/kdpkg/sh/kdpkg-sh " ) ;
run . append ( " update " ) ;
QWidget * consoleWidget = new console ( this , run ) ;
T QWidget * 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 " ) ;
T QStrList 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 ) ;
T QWidget * 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 )
T QStringList install : : getVersions ( T QString package )
{
this - > shell - > setCommand ( " apt-cache policy " + package ) ;
this - > shell - > start ( true ) ;
QStringList input = QStringList: : split ( " \n " , this - > shell - > getBuffer ( ) . stripWhiteSpace ( ) ) ;
T QStringList input = T QStringList: : split ( " \n " , this - > shell - > getBuffer ( ) . stripWhiteSpace ( ) ) ;
QString sysVersion = input [ 1 ] ;
sysVersion = QStringList: : split ( " : " , sysVersion ) [ 1 ] . replace( " " , " " ) ;
T QString sysVersion = input [ 1 ] ;
sysVersion = T QStringList: : split ( " : " , sysVersion ) [ 1 ] . tq replace( " " , " " ) ;
if ( sysVersion . contains( " ( " ) | | sysVersion = = " " )
if ( sysVersion . tq contains( " ( " ) | | sysVersion = = " " )
sysVersion = i18n ( " not installed " ) ;
QString repVersion = input [ 2 ] ;
repVersion = QStringList: : split ( " : " , repVersion ) [ 1 ] . replace( " " , " " ) ;
T QString repVersion = input [ 2 ] ;
repVersion = T QStringList: : split ( " : " , repVersion ) [ 1 ] . tq replace( " " , " " ) ;
if ( repVersion . contains( " ( " ) | | repVersion = = " " )
if ( repVersion . tq contains( " ( " ) | | repVersion = = " " )
repVersion = i18n ( " not available " ) ;
QStringList versions ;
T QStringList 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 " ) ) ;
T QString debianPkgName = fields . grep ( " Package: " ) [ 0 ] . mid ( 9 ) ;
T QString debianPkgVersion = fields . grep ( " Version: " ) [ 0 ] . mid ( 9 ) ;
T QStringList debianVersions = getVersions ( fields . grep ( " Package: " ) [ 0 ] . mid ( 9 ) ) ;
T QString debianSysVersion = debianVersions [ 0 ] ;
T QListViewItem * ditem = new T QListViewItem( dependenciesListView , 0 ) ;
ditem - > setPixmap ( 0 , T 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 ) ;
T QString tmpString = fields . grep ( T QRegExp( " ^Depends: " ) ) [ 0 ] . mid ( 9 ) ;
tmpString + = " , " + fields . grep ( " Pre-Depends: " ) [ 0 ] . mid ( 13 ) ;
QStringList allDepends = QStringList: : split ( " , " , tmpString ) ;
T QStringList allDepends = T QStringList: : split ( " , " , tmpString ) ;
QString missingDepends ;
QStringList tmp ;
T QString missingDepends ;
T QStringList tmp ;
for ( uint i = 0 ; i < allDepends . count ( ) ; i + + )
{
if ( allDepends [ i ] . contains( " | " ) ) {
tmp = QStringList: : split ( " | " , allDepends [ i ] ) ;
if ( allDepends [ i ] . tq contains( " | " ) ) {
tmp = T QStringList: : 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 + = T QStringList: : 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 . tq find( " ( " ) ! = - 1 ) {
start_index = missingDepends . tq find( " ( " ) ;
stop_index = missingDepends . tq find( " ) " , start_index ) ;
missingDepends . tq replace( 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 " ) ;
T QStringList installList = T QStringList: : 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( " [ " ) )
T QString name = T QStringList: : split ( " " , installList [ i ] ) [ 1 ] ;
T QString pkgVersion ;
T QString sysVersion ;
if ( installList [ i ] . tq contains( " [ " ) )
{
pkgVersion = QStringList: : split ( " " , installList [ i ] ) [ 3 ] . mid ( 1 ) ;
sysVersion = QStringList: : split ( " " , installList [ i ] ) [ 2 ] . mid ( 1 ) . replace( " ] " , " " ) ;
pkgVersion = T QStringList: : split ( " " , installList [ i ] ) [ 3 ] . mid ( 1 ) ;
sysVersion = T QStringList: : split ( " " , installList [ i ] ) [ 2 ] . mid ( 1 ) . tq replace( " ] " , " " ) ;
}
else
pkgVersion = QStringList: : split ( " " , installList [ i ] ) [ 2 ] . mid ( 1 ) ;
pkgVersion = T QStringList: : split ( " " , installList [ i ] ) [ 2 ] . mid ( 1 ) ;
QListViewItem * item = new QListViewItem( dependenciesListView , 0 ) ;
item - > setPixmap ( 0 , QPixmap( m_kdePrefix + " /share/kdpkg/icons/install.png " ) ) ;
T QListViewItem * item = new T QListViewItem( dependenciesListView , 0 ) ;
item - > setPixmap ( 0 , T QPixmap( 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 ) ;
T QString pkgName = fields . grep ( " Package: " ) [ 0 ] . mid ( 9 ) ;
T QString pkgVersion = fields . grep ( " Version: " ) [ 0 ] . mid ( 9 ) ;
QString rconflicts ;
T QString 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 ( ) ) ;
T QStringList input1 = T QStringList: : split ( " \n \n " , this - > shell - > getBuffer ( ) . stripWhiteSpace ( ) ) ;
for ( uint i = 0 ; i < input1 . count ( ) ; i + + )
{
if ( input1 [ i ] . contains( pkgName ) )
if ( input1 [ i ] . tq contains( 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 ] ;
T QStringList input2 = T QStringList: : split ( " \n " , input1 [ i ] ) ;
T QString name = T QStringList: : split ( " " , input2 . grep ( " Package: " ) [ 0 ] ) [ 1 ] ;
T QString cVersion = input2 . grep ( " Conflicts: " ) [ 0 ] . mid ( 11 ) ; // conflictVersion
cVersion = T QStringList: : split ( " , " , cVersion ) . grep ( pkgName ) [ 0 ] ;
cVersion = T QStringList: : split ( " ( " , cVersion ) [ 1 ] ;
cVersion = cVersion . tq replace( " ) " , " " ) ;
T QString op = T QStringList: : split ( " " , cVersion ) [ 0 ] ;
cVersion = T QStringList: : 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( " , " , " " ) ;
T QString conflicts = fields . grep ( " Conflicts " ) [ 0 ] . mid ( 11 ) ;
conflicts = conflicts . tq replace( " , " , " " ) ;
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 . tq find( " ( " ) ! = - 1 ) {
start_index = conflicts . tq find( " ( " ) ;
stop_index = conflicts . tq find( " ) " , start_index ) ;
conflicts . tq replace( 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 " ) ;
T QStringList removeList = T QStringList: : 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( " ] " , " " ) ;
T QString name = T QStringList: : split ( " " , removeList [ i ] ) [ 1 ] ;
T QString sysVersion = T QStringList: : split ( " [ " , removeList [ i ] ) [ 1 ] . tq replace( " ] " , " " ) ;
QListViewItem * item = new QListViewItem( dependenciesListView , 0 ) ;
item - > setPixmap ( 0 , QPixmap( m_kdePrefix + " /share/kdpkg/icons/remove.png " ) ) ;
T QListViewItem * item = new T QListViewItem( dependenciesListView , 0 ) ;
item - > setPixmap ( 0 , T QPixmap( 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 ( T QString input )
{
QString package = QStringList: : split ( " " , input ) [ 0 ] ;
QString version = QStringList: : split ( " ( " , input ) [ 1 ] . replace( " ) " , " " ) ;
T QString package = T QStringList: : split ( " " , input ) [ 0 ] ;
T QString version = T QStringList: : split ( " ( " , input ) [ 1 ] . tq replace( " ) " , " " ) ;
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( " " , " " ) ;
T QString sysVersion = T QStringList: : split ( " \n " , this - > shell - > getBuffer ( ) . stripWhiteSpace ( ) ) [ 1 ] ;
sysVersion = T QStringList: : split ( " : " , sysVersion ) [ 1 ] . tq replace( " " , " " ) ;
if ( sysVersion . contains( " ( " ) | | sysVersion = = " " )
if ( sysVersion . tq contains( " ( " ) | | sysVersion = = " " )
return FALSE ;
else if ( version ! = " " )
{
QString op = QStringList: : split ( " " , version ) [ 0 ] ;
QString pkgVersion = QStringList: : split ( " " , version ) [ 1 ] ;
T QString op = T QStringList: : split ( " " , version ) [ 0 ] ;
T QString pkgVersion = T QStringList: : 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 ) ;
T QString 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 ( ) . tq contains( " ... " ) )
return FALSE ;
else
return TRUE ;