From c663b6440964f6ac48027143ac9e63298991f9d0 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:33:34 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1157639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kappfinder/common.cpp | 44 ++++++++++++------------ kappfinder/common.h | 22 ++++++------ kappfinder/main_install.cpp | 10 +++--- kappfinder/toplevel.cpp | 82 ++++++++++++++++++++++----------------------- kappfinder/toplevel.h | 30 ++++++++--------- 5 files changed, 94 insertions(+), 94 deletions(-) (limited to 'kappfinder') diff --git a/kappfinder/common.cpp b/kappfinder/common.cpp index c6cd95a65..71ae2319e 100644 --- a/kappfinder/common.cpp +++ b/kappfinder/common.cpp @@ -24,8 +24,8 @@ #include #include -#include -#include +#include +#include #include @@ -33,11 +33,11 @@ #define DBG_CODE 1213 -void copyFile( const QString &inFileName, const QString &outFileName ) +void copyFile( const TQString &inFileName, const TQString &outFileName ) { - QFile inFile( inFileName ); + TQFile inFile( inFileName ); if ( inFile.open( IO_ReadOnly ) ) { - QFile outFile( outFileName ); + TQFile outFile( outFileName ); if ( outFile.open( IO_WriteOnly ) ) { outFile.writeBlock( inFile.readAll() ); outFile.close(); @@ -47,13 +47,13 @@ void copyFile( const QString &inFileName, const QString &outFileName ) } } -bool scanDesktopFile( QPtrList &appCache, const QString &templ, - QString destDir ) +bool scanDesktopFile( TQPtrList &appCache, const TQString &templ, + TQString destDir ) { KDesktopFile desktop( templ, true ); // find out where to put the .desktop files - QString destName; + TQString destName; if ( destDir.isNull() ) destDir = KGlobal::dirs()->saveLocation( "apps" ); else @@ -74,7 +74,7 @@ bool scanDesktopFile( QPtrList &appCache, const QString &templ, } // determine for which executable to look - QString exec = desktop.readPathEntry( "TryExec" ); + TQString exec = desktop.readPathEntry( "TryExec" ); if ( exec.isEmpty() ) exec = desktop.readPathEntry( "Exec" ); pos = exec.find( ' ' ); @@ -82,8 +82,8 @@ bool scanDesktopFile( QPtrList &appCache, const QString &templ, exec = exec.left( pos ); // try to locate the binary - QString pexec = KGlobal::dirs()->findExe( exec, - QString( ::getenv( "PATH" ) ) + ":/usr/X11R6/bin:/usr/games" ); + TQString pexec = KGlobal::dirs()->findExe( exec, + TQString( ::getenv( "PATH" ) ) + ":/usr/X11R6/bin:/usr/games" ); if ( pexec.isEmpty() ) { kdDebug(DBG_CODE) << "looking for " << exec.local8Bit() << "\t\tnot found" << endl; @@ -103,22 +103,22 @@ bool scanDesktopFile( QPtrList &appCache, const QString &templ, return true; } -void createDesktopFiles( QPtrList &appCache, int &added ) +void createDesktopFiles( TQPtrList &appCache, int &added ) { AppLnkCache* cache; for ( cache = appCache.first(); cache; cache = appCache.next() ) { if ( cache->item == 0 || ( cache->item && cache->item->isOn() ) ) { added++; - QString destDir = cache->destDir; - QString destName = cache->destName; - QString templ = cache->templ; + TQString destDir = cache->destDir; + TQString destName = cache->destName; + TQString templ = cache->templ; destDir += "/"; - QDir d; + TQDir d; int pos = -1; while ( ( pos = destDir.find( '/', pos + 1 ) ) >= 0 ) { - QString path = destDir.left( pos + 1 ); + TQString path = destDir.left( pos + 1 ); d = path; if ( !d.exists() ) d.mkdir( path ); @@ -130,7 +130,7 @@ void createDesktopFiles( QPtrList &appCache, int &added ) } } -void decorateDirs( QString destDir ) +void decorateDirs( TQString destDir ) { // find out where to put the .directory files if ( destDir.isNull() ) @@ -138,19 +138,19 @@ void decorateDirs( QString destDir ) else destDir += "/"; - QStringList dirs = KGlobal::dirs()->findAllResources( "data", "kappfinder/apps/*.directory", true ); + TQStringList dirs = KGlobal::dirs()->findAllResources( "data", "kappfinder/apps/*.directory", true ); - QStringList::Iterator it; + TQStringList::Iterator it; for ( it = dirs.begin(); it != dirs.end(); ++it ) { // find out the name of the file to store - QString destName = *it; + TQString destName = *it; int pos = destName.find( "kappfinder/apps/" ); if ( pos > 0 ) destName = destName.mid( pos + strlen( "kappfinder/apps/" ) ); destName = destDir + "/" + destName; - if ( !QFile::exists( destName ) ) { + if ( !TQFile::exists( destName ) ) { kdDebug(DBG_CODE) << "Copy " << *it << " to " << destName << endl; copyFile( *it, destName ); } diff --git a/kappfinder/common.h b/kappfinder/common.h index 699b9dfdc..f18139b3c 100644 --- a/kappfinder/common.h +++ b/kappfinder/common.h @@ -22,22 +22,22 @@ #ifndef COMMON_H #define COMMON_H -#include -#include -#include +#include +#include +#include class AppLnkCache { public: - QString destDir; - QString destName; - QString templ; - QCheckListItem *item; + TQString destDir; + TQString destName; + TQString templ; + TQCheckListItem *item; }; -bool scanDesktopFile( QPtrList &appCache, const QString &templ, - QString destDir = QString::null ); -void createDesktopFiles( QPtrList &appCache, int &added ); -void decorateDirs( QString destDir = QString::null ); +bool scanDesktopFile( TQPtrList &appCache, const TQString &templ, + TQString destDir = TQString::null ); +void createDesktopFiles( TQPtrList &appCache, int &added ); +void decorateDirs( TQString destDir = TQString::null ); #endif diff --git a/kappfinder/main_install.cpp b/kappfinder/main_install.cpp index 46bbaa06b..298ff06bb 100644 --- a/kappfinder/main_install.cpp +++ b/kappfinder/main_install.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include @@ -42,14 +42,14 @@ int main( int argc, char *argv[] ) return -1; } - QStringList templates = KGlobal::dirs()->findAllResources( "data", "kappfinder/apps/*.desktop", true ); + TQStringList templates = KGlobal::dirs()->findAllResources( "data", "kappfinder/apps/*.desktop", true ); - QString dir = QString( argv[ 1 ] ) + "/"; + TQString dir = TQString( argv[ 1 ] ) + "/"; - QPtrList appCache; + TQPtrList appCache; appCache.setAutoDelete( true ); - QStringList::Iterator it; + TQStringList::Iterator it; for ( it = templates.begin(); it != templates.end(); ++it ) scanDesktopFile( appCache, *it, dir ); diff --git a/kappfinder/toplevel.cpp b/kappfinder/toplevel.cpp index dfae10938..660c5b498 100644 --- a/kappfinder/toplevel.cpp +++ b/kappfinder/toplevel.cpp @@ -35,22 +35,22 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include "toplevel.h" -TopLevel::TopLevel( const QString &destDir, QWidget *parent, const char *name ) +TopLevel::TopLevel( const TQString &destDir, TQWidget *parent, const char *name ) : KDialog( parent, name, true ) { setCaption( i18n( "KAppfinder" ) ); - QVBoxLayout *layout = new QVBoxLayout( this, marginHint() ); + TQVBoxLayout *layout = new TQVBoxLayout( this, marginHint() ); - QLabel *label = new QLabel( i18n( "The application finder looks for non-KDE " + TQLabel *label = new TQLabel( i18n( "The application finder looks for non-KDE " "applications on your system and adds " "them to the KDE menu system. " "Click 'Scan' to begin, select the desired applications and then click 'Apply'."), this); @@ -59,53 +59,53 @@ TopLevel::TopLevel( const QString &destDir, QWidget *parent, const char *name ) layout->addSpacing( 5 ); - mListView = new QListView( this ); + mListView = new TQListView( this ); mListView->addColumn( i18n( "Application" ) ); mListView->addColumn( i18n( "Description" ) ); mListView->addColumn( i18n( "Command" ) ); mListView->setMinimumSize( 300, 300 ); mListView->setRootIsDecorated( true ); mListView->setAllColumnsShowFocus( true ); - mListView->setSelectionMode(QListView::NoSelection); + mListView->setSelectionMode(TQListView::NoSelection); layout->addWidget( mListView ); mProgress = new KProgress( this ); mProgress->setPercentageVisible( false ); layout->addWidget( mProgress ); - mSummary = new QLabel( i18n( "Summary:" ), this ); + mSummary = new TQLabel( i18n( "Summary:" ), this ); layout->addWidget( mSummary ); KButtonBox* bbox = new KButtonBox( this ); - mScanButton = bbox->addButton( KGuiItem( i18n( "Scan" ), "find"), this, SLOT( slotScan() ) ); + mScanButton = bbox->addButton( KGuiItem( i18n( "Scan" ), "find"), this, TQT_SLOT( slotScan() ) ); bbox->addStretch( 5 ); mSelectButton = bbox->addButton( i18n( "Select All" ), this, - SLOT( slotSelectAll() ) ); + TQT_SLOT( slotSelectAll() ) ); mSelectButton->setEnabled( false ); mUnSelectButton = bbox->addButton( i18n( "Unselect All" ), this, - SLOT( slotUnselectAll() ) ); + TQT_SLOT( slotUnselectAll() ) ); mUnSelectButton->setEnabled( false ); bbox->addStretch( 5 ); - mApplyButton = bbox->addButton( KStdGuiItem::apply(), this, SLOT( slotCreate() ) ); + mApplyButton = bbox->addButton( KStdGuiItem::apply(), this, TQT_SLOT( slotCreate() ) ); mApplyButton->setEnabled( false ); - bbox->addButton( KStdGuiItem::close(), kapp, SLOT( quit() ) ); + bbox->addButton( KStdGuiItem::close(), kapp, TQT_SLOT( quit() ) ); bbox->layout(); layout->addWidget( bbox ); - connect( kapp, SIGNAL( lastWindowClosed() ), kapp, SLOT( quit() ) ); + connect( kapp, TQT_SIGNAL( lastWindowClosed() ), kapp, TQT_SLOT( quit() ) ); mAppCache.setAutoDelete( true ); adjustSize(); mDestDir = destDir; - mDestDir = mDestDir.replace( QRegExp( "^~/" ), QDir::homeDirPath() + "/" ); + mDestDir = mDestDir.replace( TQRegExp( "^~/" ), TQDir::homeDirPath() + "/" ); KStartupInfo::appStarted(); - QAccel *accel = new QAccel( this ); - accel->connectItem( accel->insertItem( Key_Q + CTRL ), kapp, SLOT( quit() ) ); + TQAccel *accel = new TQAccel( this ); + accel->connectItem( accel->insertItem( Key_Q + CTRL ), kapp, TQT_SLOT( quit() ) ); KAcceleratorManager::manage( this ); } @@ -116,8 +116,8 @@ TopLevel::~TopLevel() mAppCache.clear(); } -QListViewItem* TopLevel::addGroupItem( QListViewItem *parent, const QString &relPath, - const QString &name ) +TQListViewItem* TopLevel::addGroupItem( TQListViewItem *parent, const TQString &relPath, + const TQString &name ) { KServiceGroup::Ptr root = KServiceGroup::group( relPath ); if( !root ) @@ -129,8 +129,8 @@ QListViewItem* TopLevel::addGroupItem( QListViewItem *parent, const QString &rel KSycocaEntry *p = (*it); if ( p->isType( KST_KServiceGroup ) ) { KServiceGroup* serviceGroup = static_cast( p ); - if ( QString( "%1%2/" ).arg( relPath ).arg( name ) == serviceGroup->relPath() ) { - QListViewItem* retval; + if ( TQString( "%1%2/" ).arg( relPath ).arg( name ) == serviceGroup->relPath() ) { + TQListViewItem* retval; if ( parent ) retval = parent->firstChild(); else @@ -143,11 +143,11 @@ QListViewItem* TopLevel::addGroupItem( QListViewItem *parent, const QString &rel retval = retval->nextSibling(); } - QListViewItem *item; + TQListViewItem *item; if ( parent ) - item = new QListViewItem( parent, serviceGroup->caption() ); + item = new TQListViewItem( parent, serviceGroup->caption() ); else - item = new QListViewItem( mListView, serviceGroup->caption() ); + item = new TQListViewItem( mListView, serviceGroup->caption() ); item->setPixmap( 0, SmallIcon( serviceGroup->icon() ) ); item->setOpen( true ); @@ -177,12 +177,12 @@ void TopLevel::slotScan() mListView->clear(); - QStringList::Iterator it; + TQStringList::Iterator it; for ( it = mTemplates.begin(); it != mTemplates.end(); ++it ) { // eye candy mProgress->setProgress( mProgress->progress() + 1 ); - QString desktopName = *it; + TQString desktopName = *it; int i = desktopName.findRev('/'); desktopName = desktopName.mid(i+1); i = desktopName.findRev('.'); @@ -206,16 +206,16 @@ void TopLevel::slotScan() // copy over the desktop file, if exists if ( scanDesktopFile( mAppCache, *it, mDestDir ) ) { - QString relPath = *it; + TQString relPath = *it; int pos = relPath.find( "kappfinder/apps/" ); relPath = relPath.mid( pos + strlen( "kappfinder/apps/" ) ); relPath = relPath.left( relPath.findRev( '/' ) + 1 ); - QStringList dirList = QStringList::split( '/', relPath ); + TQStringList dirList = TQStringList::split( '/', relPath ); - QListViewItem *dirItem = 0; - QString tmpRelPath = QString::null; + TQListViewItem *dirItem = 0; + TQString tmpRelPath = TQString::null; - QStringList::Iterator tmpIt; + TQStringList::Iterator tmpIt; for ( tmpIt = dirList.begin(); tmpIt != dirList.end(); ++tmpIt ) { dirItem = addGroupItem( dirItem, tmpRelPath, *tmpIt ); tmpRelPath += *tmpIt + '/'; @@ -223,11 +223,11 @@ void TopLevel::slotScan() mFound++; - QCheckListItem *item; + TQCheckListItem *item; if ( dirItem ) - item = new QCheckListItem( dirItem, desktop.readName(), QCheckListItem::CheckBox ); + item = new TQCheckListItem( dirItem, desktop.readName(), TQCheckListItem::CheckBox ); else - item = new QCheckListItem( mListView, desktop.readName(), QCheckListItem::CheckBox ); + item = new TQCheckListItem( mListView, desktop.readName(), TQCheckListItem::CheckBox ); item->setPixmap( 0, loader->loadIcon( desktop.readIcon(), KIcon::Small ) ); item->setText( 1, desktop.readGenericName() ); @@ -241,7 +241,7 @@ void TopLevel::slotScan() } // update summary - QString sum( i18n( "Summary: found %n application", + TQString sum( i18n( "Summary: found %n application", "Summary: found %n applications", mFound ) ); mSummary->setText( sum ); } @@ -284,9 +284,9 @@ void TopLevel::slotCreate() KService::rebuildKSycoca(this); - QString message( i18n( "%n application was added to the KDE menu system.", + TQString message( i18n( "%n application was added to the KDE menu system.", "%n applications were added to the KDE menu system.", mAdded ) ); - KMessageBox::information( this, message, QString::null, "ShowInformation" ); + KMessageBox::information( this, message, TQString::null, "ShowInformation" ); } #include "toplevel.moc" diff --git a/kappfinder/toplevel.h b/kappfinder/toplevel.h index 972e5adfb..a1765444c 100644 --- a/kappfinder/toplevel.h +++ b/kappfinder/toplevel.h @@ -24,7 +24,7 @@ #include -#include +#include #include "common.h" @@ -38,7 +38,7 @@ class TopLevel : public KDialog Q_OBJECT public: - TopLevel( const QString &destDir, QWidget *parent = 0, const char *name = 0 ); + TopLevel( const TQString &destDir, TQWidget *parent = 0, const char *name = 0 ); ~TopLevel(); public slots: @@ -48,21 +48,21 @@ class TopLevel : public KDialog void slotUnselectAll(); private: - QListViewItem *addGroupItem( QListViewItem *parent, const QString &relPath, - const QString &name ); + TQListViewItem *addGroupItem( TQListViewItem *parent, const TQString &relPath, + const TQString &name ); KProgress *mProgress; - QLabel *mSummary; - QListView *mListView; - QPushButton *mApplyButton; - QPushButton *mQuitButton; - QPushButton *mScanButton; - QPushButton *mSelectButton; - QPushButton *mUnSelectButton; - QString mDestDir; - QStringList mTemplates; - - QPtrList mAppCache; + TQLabel *mSummary; + TQListView *mListView; + TQPushButton *mApplyButton; + TQPushButton *mQuitButton; + TQPushButton *mScanButton; + TQPushButton *mSelectButton; + TQPushButton *mUnSelectButton; + TQString mDestDir; + TQStringList mTemplates; + + TQPtrList mAppCache; int mFound, mAdded; }; -- cgit v1.2.3