diff options
Diffstat (limited to 'languages/cpp/addmethoddialog.cpp')
-rw-r--r-- | languages/cpp/addmethoddialog.cpp | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/languages/cpp/addmethoddialog.cpp b/languages/cpp/addmethoddialog.cpp index 2b53868c..ae4e1738 100644 --- a/languages/cpp/addmethoddialog.cpp +++ b/languages/cpp/addmethoddialog.cpp @@ -34,28 +34,28 @@ #include <kdebug.h> #include <klineedit.h> -#include <qregexp.h> -#include <qfileinfo.h> -#include <qcombobox.h> -#include <qlistview.h> -#include <qcheckbox.h> -#include <qpushbutton.h> -#include <qtoolbutton.h> -#include <qtextstream.h> +#include <tqregexp.h> +#include <tqfileinfo.h> +#include <tqcombobox.h> +#include <tqlistview.h> +#include <tqcheckbox.h> +#include <tqpushbutton.h> +#include <tqtoolbutton.h> +#include <tqtextstream.h> AddMethodDialog::AddMethodDialog( CppSupportPart* cppSupport, ClassDom klass, - QWidget* parent, const char* name, bool modal, WFlags fl ) + TQWidget* parent, const char* name, bool modal, WFlags fl ) : AddMethodDialogBase( parent, name, modal, fl ), m_cppSupport( cppSupport ), m_klass( klass ), m_count( 0 ) { - QString fileName = m_klass->fileName(); + TQString fileName = m_klass->fileName(); - access->insertStringList( QStringList() << "Public" << "Protected" << "Private" << "Signals" << + access->insertStringList( TQStringList() << "Public" << "Protected" << "Private" << "Signals" << "Public Slots" << "Protected Slots" << "Private Slots" ); - storage->insertStringList( QStringList() << "Normal" << "Static" << "Virtual" << "Pure Virtual" << "Friend" ); + storage->insertStringList( TQStringList() << "Normal" << "Static" << "Virtual" << "Pure Virtual" << "Friend" ); // setup sourceFile combo - QMap<QString, bool> m; + TQMap<TQString, bool> m; #if 0 /// \FIXME ROBE FunctionList l = m_klass->functionList(); @@ -69,12 +69,12 @@ AddMethodDialog::AddMethodDialog( CppSupportPart* cppSupport, ClassDom klass, #endif { - QStringList headers = QStringList::split( ",", "h,H,hh,hxx,hpp,inl,tlh,diff,ui.h" ); - QStringList fileList; - QMap<QString, bool>::Iterator it = m.begin(); + TQStringList headers = TQStringList::split( ",", "h,H,hh,hxx,hpp,inl,tlh,diff,ui.h" ); + TQStringList fileList; + TQMap<TQString, bool>::Iterator it = m.begin(); while ( it != m.end() ) { - QString ext = QFileInfo( it.key() ).extension(); + TQString ext = TQFileInfo( it.key() ).extension(); if ( !headers.contains( ext ) ) sourceFile->insertItem( it.key() ); ++it; @@ -82,14 +82,14 @@ AddMethodDialog::AddMethodDialog( CppSupportPart* cppSupport, ClassDom klass, if ( sourceFile->count() == 0 ) { - QFileInfo info( fileName ); - QString impl = DomUtil::readEntry( *cppSupport->projectDom(), "/cppsupportpart/filetemplates/implementationsuffix", "cpp" ); + TQFileInfo info( fileName ); + TQString impl = DomUtil::readEntry( *cppSupport->projectDom(), "/cppsupportpart/filetemplates/implementationsuffix", "cpp" ); sourceFile->insertItem( info.dirPath( true ) + "/" + info.baseName() + impl ); } } returnType->setAutoCompletion( true ); - returnType->insertStringList( QStringList() + returnType->insertStringList( TQStringList() << "void" << "char" << "wchar_t" @@ -113,33 +113,33 @@ AddMethodDialog::~AddMethodDialog() void AddMethodDialog::reject() { - QDialog::reject(); + TQDialog::reject(); } -QString AddMethodDialog::accessID( FunctionDom fun ) const +TQString AddMethodDialog::accessID( FunctionDom fun ) const { if ( fun->isSignal() ) - return QString::fromLatin1( "Signals" ); + return TQString::fromLatin1( "Signals" ); switch ( fun->access() ) { case CodeModelItem::Public: if ( fun->isSlot() ) - return QString::fromLatin1( "Public Slots" ); - return QString::fromLatin1( "Public" ); + return TQString::fromLatin1( "Public Slots" ); + return TQString::fromLatin1( "Public" ); case CodeModelItem::Protected: if ( fun->isSlot() ) - return QString::fromLatin1( "Protected Slots" ); - return QString::fromLatin1( "Protected" ); + return TQString::fromLatin1( "Protected Slots" ); + return TQString::fromLatin1( "Protected" ); case CodeModelItem::Private: if ( fun->isSlot() ) - return QString::fromLatin1( "Private Slots" ); - return QString::fromLatin1( "Private" ); + return TQString::fromLatin1( "Private Slots" ); + return TQString::fromLatin1( "Private" ); } - return QString::null; + return TQString::null; } void AddMethodDialog::accept() @@ -149,7 +149,7 @@ void AddMethodDialog::accept() if ( !editIface ) { /// @todo show messagebox - QDialog::accept(); + TQDialog::accept(); return ; } @@ -157,15 +157,15 @@ void AddMethodDialog::accept() m_klass->getEndPosition( &line, &column ); // compute the insertion point map - QMap<QString, QPair<int, int> > points; - QStringList accessList; + TQMap<TQString, QPair<int, int> > points; + TQStringList accessList; const FunctionList functionList = m_klass->functionList(); for ( FunctionList::ConstIterator it = functionList.begin(); it != functionList.end(); ++it ) { int funEndLine, funEndColumn; ( *it ) ->getEndPosition( &funEndLine, &funEndColumn ); - QString access = accessID( *it ); + TQString access = accessID( *it ); QPair<int, int> funEndPoint = qMakePair( funEndLine, funEndColumn ); if ( !points.contains( access ) || points[ access ] < funEndPoint ) @@ -181,22 +181,22 @@ void AddMethodDialog::accept() accessList += newAccessList( accessList ); - for ( QStringList::iterator it = accessList.begin(); it != accessList.end(); ++it ) + for ( TQStringList::iterator it = accessList.begin(); it != accessList.end(); ++it ) { - QListViewItem* item = methods->firstChild(); + TQListViewItem* item = methods->firstChild(); while ( item ) { - QListViewItem * currentItem = item; + TQListViewItem * currentItem = item; item = item->nextSibling(); if ( currentItem->text( 1 ) != *it ) continue; - QString access = ( *it ).lower(); + TQString access = ( *it ).lower(); bool isInline = currentItem->text( 0 ) == "True"; - QString str = isInline ? functionDefinition( currentItem ) : functionDeclaration( currentItem ); + TQString str = isInline ? functionDefinition( currentItem ) : functionDeclaration( currentItem ); QPair<int, int> pt; if ( points.contains( *it ) ) @@ -211,30 +211,30 @@ void AddMethodDialog::accept() } editIface->insertText( pt.first + insertedLine + 1, 0 /*pt.second*/, str ); - insertedLine += str.contains( QChar( '\n' ) ); + insertedLine += str.contains( TQChar( '\n' ) ); } } m_cppSupport->backgroundParser() ->addFile( m_klass->fileName() ); - QString str; - QListViewItem* item = methods->firstChild(); + TQString str; + TQListViewItem* item = methods->firstChild(); while ( item ) { - QListViewItem * currentItem = item; + TQListViewItem * currentItem = item; item = item->nextSibling(); - QString str = functionDefinition( currentItem ); + TQString str = functionDefinition( currentItem ); if ( str.isEmpty() ) continue; - QString implementationFile = currentItem->text( 5 ); + TQString implementationFile = currentItem->text( 5 ); if ( currentItem->text( 0 ) == "True" ) implementationFile = m_klass->fileName(); - QFileInfo fileInfo( implementationFile ); - if ( !QFile::exists( fileInfo.absFilePath() ) ) + TQFileInfo fileInfo( implementationFile ); + if ( !TQFile::exists( fileInfo.absFilePath() ) ) { if ( KDevCreateFile * createFileSupp = m_cppSupport->extension<KDevCreateFile>( "KDevelop/CreateFile" ) ) createFileSupp->createNewFile( fileInfo.extension(), fileInfo.dirPath( true ), fileInfo.baseName() ); @@ -248,13 +248,13 @@ void AddMethodDialog::accept() bool isInline = currentItem->text( 0 ) == "True"; if ( !isInline ) { - editIface->insertLine( editIface->numLines(), QString::fromLatin1( "" ) ); + editIface->insertLine( editIface->numLines(), TQString::fromLatin1( "" ) ); editIface->insertText( editIface->numLines() - 1, 0, str ); m_cppSupport->backgroundParser() ->addFile( implementationFile ); } } - QDialog::accept(); + TQDialog::accept(); } void AddMethodDialog::updateGUI() @@ -274,7 +274,7 @@ void AddMethodDialog::updateGUI() if ( enable ) { - QListViewItem * item = methods->selectedItem(); + TQListViewItem * item = methods->selectedItem(); item->setText( 0, isInline->isChecked() ? "True" : "False" ); item->setText( 1, access->currentText() ); item->setText( 2, storage->currentText() ); @@ -292,8 +292,8 @@ void AddMethodDialog::updateGUI() void AddMethodDialog::addMethod() { - QListViewItem * item = new QListViewItem( methods, "False", "Public", "Normal", - "void", QString( "method_%1()" ).arg( ++m_count ), + TQListViewItem * item = new TQListViewItem( methods, "False", "Public", "Normal", + "void", TQString( "method_%1()" ).arg( ++m_count ), sourceFile->currentText() ); methods->setCurrentItem( item ); methods->setSelected( item, true ); @@ -307,16 +307,16 @@ void AddMethodDialog::deleteCurrentMethod() updateGUI(); } -void AddMethodDialog::currentChanged( QListViewItem* item ) +void AddMethodDialog::currentChanged( TQListViewItem* item ) { if ( item ) { - QString _isInline = item->text( 0 ); - QString _access = item->text( 1 ); - QString _storage = item->text( 2 ); - QString _returnType = item->text( 3 ); - QString _declarator = item->text( 4 ); - QString _sourceFile = item->text( 5 ); + TQString _isInline = item->text( 0 ); + TQString _access = item->text( 1 ); + TQString _storage = item->text( 2 ); + TQString _returnType = item->text( 3 ); + TQString _declarator = item->text( 4 ); + TQString _sourceFile = item->text( 5 ); isInline->setChecked( _isInline == "True" ? true : false ); access->setCurrentText( _access ); @@ -331,17 +331,17 @@ void AddMethodDialog::currentChanged( QListViewItem* item ) void AddMethodDialog::browseImplementationFile() { - QString fileName = KFileDialog::getOpenFileName(); + TQString fileName = KFileDialog::getOpenFileName(); sourceFile->setCurrentText( fileName ); updateGUI(); } -QString AddMethodDialog::functionDeclaration( QListViewItem * item ) const +TQString AddMethodDialog::functionDeclaration( TQListViewItem * item ) const { - QString str; - QTextStream stream( &str, IO_WriteOnly ); + TQString str; + TQTextStream stream( &str, IO_WriteOnly ); - QString access = item->text( 1 ).lower(); + TQString access = item->text( 1 ).lower(); stream << " "; /// @todo use AStyle if ( item->text( 2 ) == "Virtual" || item->text( 2 ) == "Pure Virtual" ) @@ -358,28 +358,28 @@ QString AddMethodDialog::functionDeclaration( QListViewItem * item ) const return str; } -QString AddMethodDialog::functionDefinition( QListViewItem* item ) const +TQString AddMethodDialog::functionDefinition( TQListViewItem* item ) const { if ( item->text( 1 ) == "Signals" || item->text( 2 ) == "Pure Virtual" || item->text( 2 ) == "Friend" ) { - return QString::null; + return TQString::null; } - QString className = m_klass->name(); - QString fullName = m_klass->scope().join( "::" ); + TQString className = m_klass->name(); + TQString fullName = m_klass->scope().join( "::" ); if ( !fullName.isEmpty() ) fullName += "::"; fullName += className; - QString str; - QTextStream stream( &str, IO_WriteOnly ); + TQString str; + TQTextStream stream( &str, IO_WriteOnly ); bool isInline = item->text( 0 ) == "True"; - QString ind; + TQString ind; if ( isInline ) - ind.fill( QChar( ' ' ), 4 ); + ind.fill( TQChar( ' ' ), 4 ); stream << "\n" << ind << "/*!\n" @@ -387,7 +387,7 @@ QString AddMethodDialog::functionDefinition( QListViewItem* item ) const << ind << " */\n"; stream - << ind << item->text( 3 ) << " " << ( isInline ? QString::fromLatin1( "" ) : fullName + "::" ) + << ind << item->text( 3 ) << " " << ( isInline ? TQString::fromLatin1( "" ) : fullName + "::" ) << item->text( 4 ) << "\n" << ind << "{\n" << ind << " /// @todo implement me\n" @@ -396,18 +396,18 @@ QString AddMethodDialog::functionDefinition( QListViewItem* item ) const return str; } -QStringList AddMethodDialog::newAccessList( const QStringList& accessList ) const +TQStringList AddMethodDialog::newAccessList( const TQStringList& accessList ) const { - QStringList newAccessList; + TQStringList newAccessList; - QListViewItem* item = methods->firstChild(); + TQListViewItem* item = methods->firstChild(); while ( item ) { - QListViewItem * currentItem = item; + TQListViewItem * currentItem = item; item = item->nextSibling(); - QString access = currentItem->text( 1 ); + TQString access = currentItem->text( 1 ); if ( !( accessList.contains( access ) || newAccessList.contains( access ) ) ) newAccessList.push_back( access ); } |