diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-04 21:11:15 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-04 21:11:15 +0000 |
commit | 9885af067f442d03025eb180e0e5472b636ac265 (patch) | |
tree | d3eea362985c3df054c9ac5ad109f2d644bca865 /kdpkg | |
parent | b155cffc1b83c93eab4a7a09d5c8a00afec0a528 (diff) | |
download | kdpkg-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')
-rw-r--r-- | kdpkg/kdpkg.cpp | 80 | ||||
-rw-r--r-- | kdpkg/kdpkg.h | 17 | ||||
-rw-r--r-- | kdpkg/kdpkgdialog.ui | 62 | ||||
-rw-r--r-- | kdpkg/main.cpp | 6 | ||||
-rw-r--r-- | kdpkg/process.cpp | 14 | ||||
-rw-r--r-- | kdpkg/process.h | 9 |
6 files changed, 95 insertions, 93 deletions
diff --git a/kdpkg/kdpkg.cpp b/kdpkg/kdpkg.cpp index e08fa3d..a8ecd01 100644 --- a/kdpkg/kdpkg.cpp +++ b/kdpkg/kdpkg.cpp @@ -24,28 +24,28 @@ #include <kaboutapplication.h> #include <kurlrequester.h> -#include <qlabel.h> -#include <qlineedit.h> -#include <qlistview.h> -#include <qlistbox.h> -#include <qtextbrowser.h> -#include <qwidgetstack.h> -#include <qprocess.h> -#include <qregexp.h> -#include <qfiledialog.h> +#include <tqlabel.h> +#include <tqlineedit.h> +#include <tqlistview.h> +#include <tqlistbox.h> +#include <tqtextbrowser.h> +#include <tqwidgetstack.h> +#include <tqprocess.h> +#include <tqregexp.h> +#include <tqfiledialog.h> #include "kdpkg.h" -kdpkg::kdpkg( const QString &url, QWidget *parent, const char *name, const QStringList &) -:KdpkgDialog(parent, name) +kdpkg::kdpkg( const TQString &url, TQWidget *tqparent, const char *name, const TQStringList &) +:KdpkgDialog(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; @@ -55,17 +55,17 @@ kdpkg::kdpkg( const QString &url, QWidget *parent, const char *name, const QStri // show fields 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() ); showFields(); // show files this->shell->setCommand("dpkg -c "+url); this->shell->start(true); - QStringList files = QStringList::split( "\n", this->shell->getBuffer().stripWhiteSpace() ); - QString tmp; + TQStringList files = TQStringList::split( "\n", this->shell->getBuffer().stripWhiteSpace() ); + TQString tmp; for(uint i = 0; i < files.count(); i++) - tmp += QStringList::split( ".", files[i])[1]+"<br>"; + tmp += TQStringList::split( ".", files[i])[1]+"<br>"; filesTextBrowser->setText( tmp ) ; @@ -87,11 +87,11 @@ void kdpkg::showFields() // common //-------- - QString pkgName = fields.grep("Package:")[0].mid(9); - QString pkgVersion = fields.grep("Version:")[0].mid(9); - QStringList versions = getVersions(fields.grep("Package:")[0].mid(9)); - QString sysVersion = versions[0]; - QString repVersion = versions[1]; + TQString pkgName = fields.grep("Package:")[0].mid(9); + TQString pkgVersion = fields.grep("Version:")[0].mid(9); + TQStringList versions = getVersions(fields.grep("Package:")[0].mid(9)); + TQString sysVersion = versions[0]; + TQString repVersion = versions[1]; package2TextLabel->setText( pkgName ); version2TextLabel->setText( pkgVersion+" (Package)<br>"+sysVersion+" (System)<br>"+repVersion+" (Repository)"); @@ -102,8 +102,8 @@ void kdpkg::showFields() // description //------------- - QStringList tmp = fields.grep( QRegExp("^ ") ); - QString description = "<b>"+fields.grep("Description:")[0].mid(13)+"</b><br><br>"; + TQStringList tmp = fields.grep( TQRegExp("^ ") ); + TQString description = "<b>"+fields.grep("Description:")[0].mid(13)+"</b><br><br>"; for(uint i = 0; i < tmp.count(); i++) { if( tmp[i] == " ." ) @@ -125,7 +125,7 @@ void kdpkg::showFields() types.append("Conflicts"); types.append("Replaces"); - for( QStringList::Iterator it = types.begin(); it != types.end(); ++it ) + for( TQStringList::Iterator it = types.begin(); it != types.end(); ++it ) dependencies.append(fields.grep(*it+":")[0]); showDependencies(0); } @@ -145,19 +145,19 @@ void kdpkg::showDependencies(int i) if(i == 0) // all { - for( QStringList::Iterator it = dependencies.begin(); it != dependencies.end(); ++it ) + for( TQStringList::Iterator it = dependencies.begin(); it != dependencies.end(); ++it ) { - QStringList tmp = QStringList::split( ", ", *it ); - QString type = QStringList::split( ":", tmp[0])[0]; - tmp[0] = QStringList::split( ": ", tmp[0] )[1]; + TQStringList tmp = TQStringList::split( ", ", *it ); + TQString type = TQStringList::split( ":", tmp[0])[0]; + tmp[0] = TQStringList::split( ": ", tmp[0] )[1]; for(uint i = 0; i < tmp.count(); i++) dependenciesListBox->insertItem( type+": "+tmp[i] ); } } else { - QString choice = types[i-1]; - dependenciesListBox->insertStringList( QStringList::split( ", ", dependencies.grep(choice+":")[0].mid(choice.length()+2) ) ); + TQString choice = types[i-1]; + dependenciesListBox->insertStringList( TQStringList::split( ", ", dependencies.grep(choice+":")[0].mid(choice.length()+2) ) ); } } @@ -166,27 +166,27 @@ void kdpkg::showDependencies(int i) //--- get --------------------------------------------------------------------// //----------------------------------------------------------------------------// -QStringList kdpkg::getVersions(QString package) +TQStringList kdpkg::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); @@ -199,7 +199,7 @@ QStringList kdpkg::getVersions(QString package) //----------------------------------------------------------------------------// -void kdpkg::checkArchitecture(QString arch) +void kdpkg::checkArchitecture(TQString arch) { if(arch == "all") return; diff --git a/kdpkg/kdpkg.h b/kdpkg/kdpkg.h index cbdc33f..9e1e7cd 100644 --- a/kdpkg/kdpkg.h +++ b/kdpkg/kdpkg.h @@ -25,23 +25,24 @@ #include <kde_terminal_interface.h> #include <kparts/part.h> #include <process.h> -#include <qprocess.h> +#include <tqprocess.h> class kdpkg : public KdpkgDialog { Q_OBJECT + TQ_OBJECT public: - kdpkg(const QString &url = QString(), QWidget *parent = 0L, const char *name = 0L, const QStringList &foo = QStringList()); + kdpkg(const TQString &url = TQString(), TQWidget *tqparent = 0L, const char *name = 0L, const TQStringList &foo = TQStringList()); - void checkArchitecture(QString); + void checkArchitecture(TQString); - QStringList getVersions(QString); + TQStringList getVersions(TQString); - QStringList fields; - QStringList types; - QStringList dependencies; - QString path; + TQStringList fields; + TQStringList types; + TQStringList dependencies; + TQString path; private: Process* shell; diff --git a/kdpkg/kdpkgdialog.ui b/kdpkg/kdpkgdialog.ui index 1b998eb..2785a6b 100644 --- a/kdpkg/kdpkgdialog.ui +++ b/kdpkg/kdpkgdialog.ui @@ -1,7 +1,7 @@ <!DOCTYPE UI><UI version="3.3" stdsetdef="1"> <class>KdpkgDialog</class> <author>Fabian Wuertz</author> -<widget class="QWidget"> +<widget class="TQWidget"> <property name="name"> <cstring>KdpkgDialog</cstring> </property> @@ -23,18 +23,18 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QTabWidget" row="2" column="0" rowspan="1" colspan="4"> + <widget class="TQTabWidget" row="2" column="0" rowspan="1" colspan="4"> <property name="name"> <cstring>tabWidget</cstring> </property> - <widget class="QWidget"> + <widget class="TQWidget"> <property name="name"> <cstring>tab</cstring> </property> <attribute name="title"> <string>Co&mmon</string> </attribute> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>package2TextLabel</cstring> </property> @@ -50,7 +50,7 @@ <string></string> </property> </widget> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>version1TextLabel</cstring> </property> @@ -66,7 +66,7 @@ <string><b>Version:</b></string> </property> </widget> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>version2TextLabel</cstring> </property> @@ -82,7 +82,7 @@ <string></string> </property> </widget> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>maintainer1TextLabel</cstring> </property> @@ -98,7 +98,7 @@ <string><b>Maintainer:</b></string> </property> </widget> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>maintainer2TextLabel</cstring> </property> @@ -114,7 +114,7 @@ <string></string> </property> </widget> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>section1TextLabel</cstring> </property> @@ -130,7 +130,7 @@ <string><b>Section:</b></string> </property> </widget> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>section2TextLabel</cstring> </property> @@ -146,7 +146,7 @@ <string></string> </property> </widget> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>size1TextLabel</cstring> </property> @@ -162,7 +162,7 @@ <string><b>Size:</b></string> </property> </widget> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>size2TextLabel</cstring> </property> @@ -178,7 +178,7 @@ <string></string> </property> </widget> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>package1TextLabel</cstring> </property> @@ -195,7 +195,7 @@ </property> </widget> </widget> - <widget class="QWidget"> + <widget class="TQWidget"> <property name="name"> <cstring>TabPage</cstring> </property> @@ -206,14 +206,14 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QTextBrowser" row="0" column="0"> + <widget class="TQTextBrowser" row="0" column="0"> <property name="name"> <cstring>descriptionTextBrowser</cstring> </property> </widget> </grid> </widget> - <widget class="QWidget"> + <widget class="TQWidget"> <property name="name"> <cstring>TabPage</cstring> </property> @@ -224,12 +224,12 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QListBox" row="1" column="0"> + <widget class="TQListBox" row="1" column="0"> <property name="name"> <cstring>dependenciesListBox</cstring> </property> </widget> - <widget class="QComboBox" row="0" column="0"> + <widget class="TQComboBox" row="0" column="0"> <item> <property name="text"> <string>All</string> @@ -281,7 +281,7 @@ </widget> </grid> </widget> - <widget class="QWidget"> + <widget class="TQWidget"> <property name="name"> <cstring>TabPage</cstring> </property> @@ -292,7 +292,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QTextBrowser" row="0" column="0"> + <widget class="TQTextBrowser" row="0" column="0"> <property name="name"> <cstring>filesTextBrowser</cstring> </property> @@ -300,7 +300,7 @@ </grid> </widget> </widget> - <widget class="QPushButton" row="3" column="0"> + <widget class="TQPushButton" row="3" column="0"> <property name="name"> <cstring>aboutPushButton</cstring> </property> @@ -324,14 +324,14 @@ <property name="sizeType"> <enum>Expanding</enum> </property> - <property name="sizeHint"> + <property name="tqsizeHint"> <size> <width>270</width> <height>20</height> </size> </property> </spacer> - <widget class="QPushButton" row="3" column="2"> + <widget class="TQPushButton" row="3" column="2"> <property name="name"> <cstring>installPushButton</cstring> </property> @@ -345,7 +345,7 @@ <iconset>image2</iconset> </property> </widget> - <widget class="QPushButton" row="3" column="3"> + <widget class="TQPushButton" row="3" column="3"> <property name="name"> <cstring>closePushButton</cstring> </property> @@ -373,7 +373,7 @@ <enum>Horizontal</enum> </property> </widget> - <widget class="QFrame" row="0" column="0" rowspan="1" colspan="4"> + <widget class="TQFrame" row="0" column="0" rowspan="1" colspan="4"> <property name="name"> <cstring>frame</cstring> </property> @@ -387,7 +387,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLabel" row="0" column="2"> + <widget class="TQLabel" row="0" column="2"> <property name="name"> <cstring>titleTextLabel</cstring> </property> @@ -403,7 +403,7 @@ <string><b>Package Information</b></string> </property> </widget> - <widget class="QLabel" row="0" column="0"> + <widget class="TQLabel" row="0" column="0"> <property name="name"> <cstring>pixmapLabel1</cstring> </property> @@ -432,7 +432,7 @@ <property name="sizeType"> <enum>Fixed</enum> </property> - <property name="sizeHint"> + <property name="tqsizeHint"> <size> <width>5</width> <height>20</height> @@ -489,10 +489,10 @@ <includes> <include location="local" impldecl="in implementation">kdialog.h</include> </includes> -<slots> +<Q_SLOTS> <slot>showDependencies(int)</slot> <slot>about()</slot> <slot>install()</slot> -</slots> -<layoutdefaults spacing="6" margin="6"/> +</Q_SLOTS> +<tqlayoutdefaults spacing="6" margin="6"/> </UI> diff --git a/kdpkg/main.cpp b/kdpkg/main.cpp index dc399ed..3db3fc5 100644 --- a/kdpkg/main.cpp +++ b/kdpkg/main.cpp @@ -40,7 +40,7 @@ int main(int argc, char **argv) // specify data for About dialog KAboutData* about = new KAboutData("kdpkg", I18N_NOOP("kdpkg"), ""); - about->setProgramLogo( QImage("/usr/share/icons/hicolor/32x32/apps/kdpkg.png") ); + about->setProgramLogo( TQImage("/usr/share/icons/hicolor/32x32/apps/kdpkg.png") ); about->setShortDescription( I18N_NOOP("Frontend for dpkg.") ); about->setLicense(KAboutData::License_GPL_V2); about->setHomepage("http://trinity.pearsoncomputing.net"); @@ -66,10 +66,10 @@ int main(int argc, char **argv) // no session.. just start up normally KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - QString url; + TQString url; for(int i = 0; i < args->count(); i++) // Counting start at 0! - url = QString::fromLocal8Bit(args->arg(i)); + url = TQString::fromLocal8Bit(args->arg(i)); //printf(url); diff --git a/kdpkg/process.cpp b/kdpkg/process.cpp index 9c02a77..3fb684d 100644 --- a/kdpkg/process.cpp +++ b/kdpkg/process.cpp @@ -5,11 +5,11 @@ Process::Process() { - _buffer = QString::null; + _buffer = TQString(); _process = new KProcess(); - connect(_process, SIGNAL(receivedStdout(KProcess*, char*, int)), - this, SLOT(slotProcessOutput(KProcess*, char*, int))); + connect(_process, TQT_SIGNAL(receivedStdout(KProcess*, char*, int)), + this, TQT_SLOT(slotProcessOutput(KProcess*, char*, int))); } @@ -17,11 +17,11 @@ { } - void Process::setCommand(QString command) + void Process::setCommand(TQString command) { // make clean _process->clearArguments(); - _buffer = QString::null; + _buffer = TQString(); *_process << "/bin/sh"; *_process << "-c"; @@ -37,7 +37,7 @@ _process->start(KProcess::DontCare, KProcess::Stdout); } - QString Process::getBuffer() + TQString Process::getBuffer() { return _buffer; } @@ -56,7 +56,7 @@ { if (process != _process) return; - _buffer.append(QString::fromLocal8Bit(buffer, len)); + _buffer.append(TQString::fromLocal8Bit(buffer, len)); } diff --git a/kdpkg/process.h b/kdpkg/process.h index c2cbe8b..68ffea4 100644 --- a/kdpkg/process.h +++ b/kdpkg/process.h @@ -11,22 +11,23 @@ class Process; -class Process : public QObject { +class Process : public TQObject { Q_OBJECT + TQ_OBJECT public: Process(); ~Process(); - QString getBuffer(); + TQString getBuffer(); int exitStatus(); bool normalExit(); - void setCommand(QString command); + void setCommand(TQString command); void start(bool block=true); protected: KProcess* _process; - QString _buffer; + TQString _buffer; protected slots: void slotProcessOutput(KProcess* process, char* buffer, int buflen); |