diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
commit | d6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch) | |
tree | d109539636691d7b03036ca1c0ed29dbae6577cf /parts/ctags2/ctags2_part.cpp | |
parent | 3331a47a9cad24795c7440ee8107143ce444ef34 (diff) | |
download | tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'parts/ctags2/ctags2_part.cpp')
-rw-r--r-- | parts/ctags2/ctags2_part.cpp | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/parts/ctags2/ctags2_part.cpp b/parts/ctags2/ctags2_part.cpp index 29b564e6..b05a12a4 100644 --- a/parts/ctags2/ctags2_part.cpp +++ b/parts/ctags2/ctags2_part.cpp @@ -9,11 +9,11 @@ * * ***************************************************************************/ -#include <qwhatsthis.h> -#include <qpopupmenu.h> -#include <qtextstream.h> -#include <qfile.h> -#include <qregexp.h> +#include <tqwhatsthis.h> +#include <tqpopupmenu.h> +#include <tqtextstream.h> +#include <tqfile.h> +#include <tqregexp.h> #include <klineedit.h> #include <klistview.h> @@ -58,41 +58,41 @@ typedef KDevGenericFactory<CTags2Part> CTags2Factory; static const KDevPluginInfo data("kdevctags2"); K_EXPORT_COMPONENT_FACTORY( libkdevctags2, CTags2Factory( data ) ) -CTags2Part::CTags2Part(QObject *parent, const char *name, const QStringList& ) +CTags2Part::CTags2Part(TQObject *parent, const char *name, const TQStringList& ) : KDevPlugin(&data, parent, name ? name : "ctags2Part" ) { setInstance(CTags2Factory::instance()); setXMLFile("kdevpart_ctags2.rc"); - QDomDocument & dom = *projectDom(); - QString customTagFile = DomUtil::readEntry( dom, "/ctagspart/customTagfilePath" ); + TQDomDocument & dom = *projectDom(); + TQString customTagFile = DomUtil::readEntry( dom, "/ctagspart/customTagfilePath" ); if ( customTagFile.isEmpty() ) { customTagFile = project()->projectDirectory() + "/tags"; } - QStringList tagFiles = DomUtil::readListEntry(dom, "/ctagspart/activeTagsFiles", "file"); + TQStringList tagFiles = DomUtil::readListEntry(dom, "/ctagspart/activeTagsFiles", "file"); tagFiles.push_front(customTagFile); Tags::setTagFiles(tagFiles); m_widget = new CTags2Widget(this); - QWhatsThis::add(m_widget, i18n("<b>CTags</b><p>Result view for a tag lookup. Click a line to go to the corresponding place in the code.")); + TQWhatsThis::add(m_widget, i18n("<b>CTags</b><p>Result view for a tag lookup. Click a line to go to the corresponding place in the code.")); m_widget->setCaption(i18n("CTags Lookup")); mainWindow()->embedOutputView( m_widget, i18n( "CTags" ), i18n( "CTags lookup results" ) ); - connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)), this, SLOT(contextMenu(QPopupMenu *, const Context *)) ); + connect( core(), TQT_SIGNAL(contextMenu(TQPopupMenu *, const Context *)), this, TQT_SLOT(contextMenu(TQPopupMenu *, const Context *)) ); _configProxy = new ConfigWidgetProxy( core() ); _configProxy->createProjectConfigPage( i18n("CTags"), CTAGSSETTINGSPAGE, info()->icon() ); - connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )), - this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) ); - - new KAction( i18n("Lookup Current Text"), 0, CTRL+Key_Underscore, this, SLOT(slotLookup()), actionCollection(), "ctags_lookup_shortcut"); - new KAction( i18n("Lookup Current Text as Declaration"), 0, CTRL+Key_Semicolon, this, SLOT(slotLookupDeclaration()), actionCollection(), "ctags_declaration_shortcut"); - new KAction( i18n("Lookup Current Text as Definition"), 0, CTRL+Key_Colon, this, SLOT(slotLookupDefinition()), actionCollection(), "ctags_definition_shortcut"); - new KAction( i18n("Jump to Next Match"), 0, 0, this, SLOT(slotGoToNext()), actionCollection(), "ctags_jump_to_next"); - new KAction( i18n("Open Lookup Dialog"), 0, 0, this, SLOT(slotOpenLookup()), actionCollection(), "ctags_input_shortcut"); + connect( _configProxy, TQT_SIGNAL(insertConfigWidget(const KDialogBase*, TQWidget*, unsigned int )), + this, TQT_SLOT(insertConfigWidget(const KDialogBase*, TQWidget*, unsigned int )) ); + + new KAction( i18n("Lookup Current Text"), 0, CTRL+Key_Underscore, this, TQT_SLOT(slotLookup()), actionCollection(), "ctags_lookup_shortcut"); + new KAction( i18n("Lookup Current Text as Declaration"), 0, CTRL+Key_Semicolon, this, TQT_SLOT(slotLookupDeclaration()), actionCollection(), "ctags_declaration_shortcut"); + new KAction( i18n("Lookup Current Text as Definition"), 0, CTRL+Key_Colon, this, TQT_SLOT(slotLookupDefinition()), actionCollection(), "ctags_definition_shortcut"); + new KAction( i18n("Jump to Next Match"), 0, 0, this, TQT_SLOT(slotGoToNext()), actionCollection(), "ctags_jump_to_next"); + new KAction( i18n("Open Lookup Dialog"), 0, 0, this, TQT_SLOT(slotOpenLookup()), actionCollection(), "ctags_input_shortcut"); } @@ -106,17 +106,17 @@ CTags2Part::~CTags2Part() delete _configProxy; } -void CTags2Part::insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int pagenumber ) +void CTags2Part::insertConfigWidget( const KDialogBase * dlg, TQWidget * page, unsigned int pagenumber ) { if ( pagenumber == CTAGSSETTINGSPAGE ) { CTags2SettingsWidget * w = new CTags2SettingsWidget( this, page ); - connect( dlg, SIGNAL(okClicked()), w, SLOT(slotAccept()) ); - connect( w, SIGNAL(newTagsfileName(const QString& )), this, SLOT(updateTagsfileName(const QString& )) ); + connect( dlg, TQT_SIGNAL(okClicked()), w, TQT_SLOT(slotAccept()) ); + connect( w, TQT_SIGNAL(newTagsfileName(const TQString& )), this, TQT_SLOT(updateTagsfileName(const TQString& )) ); } } -void CTags2Part::updateTagsfileName( const QString & ) +void CTags2Part::updateTagsfileName( const TQString & ) { m_widget->updateDBDateLabel(); } @@ -125,14 +125,14 @@ void CTags2Part::updateTagsfileName( const QString & ) bool CTags2Part::createTagsFile() { // check if user specified a custom tag file name - QDomDocument & dom = *projectDom(); - QString tagsFileCustom = DomUtil::readEntry( dom, "/ctagspart/customTagfilePath" ).stripWhiteSpace(); + TQDomDocument & dom = *projectDom(); + TQString tagsFileCustom = DomUtil::readEntry( dom, "/ctagspart/customTagfilePath" ).stripWhiteSpace(); return createTagsFile(tagsFileCustom, project()->projectDirectory()); } // creates a new tag file with the specified name for the specified source directory -bool CTags2Part::createTagsFile(const QString& tagFile, const QString& dir) +bool CTags2Part::createTagsFile(const TQString& tagFile, const TQString& dir) { /* KProcess proc; @@ -149,18 +149,18 @@ bool CTags2Part::createTagsFile(const QString& tagFile, const QString& dir) // get name of the ctags binary KConfig * config = kapp->config(); config->setGroup( "CTAGS" ); - QString ctagsBinary = config->readEntry( "ctags binary" ).stripWhiteSpace(); + TQString ctagsBinary = config->readEntry( "ctags binary" ).stripWhiteSpace(); if ( ctagsBinary.isEmpty() ) { ctagsBinary = "ctags"; } // set a default argument list - QString argsDefault = "-R --c++-types=+px --excmd=pattern --exclude=Makefile --exclude=."; + TQString argsDefault = "-R --c++-types=+px --excmd=pattern --exclude=Makefile --exclude=."; - QDomDocument & dom = *projectDom(); - QString argsCustom = DomUtil::readEntry( dom, "/ctagspart/customArguments" ).stripWhiteSpace(); - QString commandline = ctagsBinary + " " + ( argsCustom.isEmpty() ? argsDefault : argsCustom ) + ( tagFile.isEmpty() ? "" : " -f " + tagFile ); + TQDomDocument & dom = *projectDom(); + TQString argsCustom = DomUtil::readEntry( dom, "/ctagspart/customArguments" ).stripWhiteSpace(); + TQString commandline = ctagsBinary + " " + ( argsCustom.isEmpty() ? argsDefault : argsCustom ) + ( tagFile.isEmpty() ? "" : " -f " + tagFile ); commandline += " "; commandline += dir; @@ -170,13 +170,13 @@ bool CTags2Part::createTagsFile(const QString& tagFile, const QString& dir) return true; } -void CTags2Part::contextMenu(QPopupMenu *popup, const Context *context) +void CTags2Part::contextMenu(TQPopupMenu *popup, const Context *context) { if (!context->hasType( Context::EditorContext )) return; const EditorContext *econtext = static_cast<const EditorContext*>(context); - QString ident = econtext->currentWord(); + TQString ident = econtext->currentWord(); if (ident.isEmpty()) return; @@ -189,18 +189,18 @@ void CTags2Part::contextMenu(QPopupMenu *popup, const Context *context) if ( Tags::hasTag( ident ) && ( showDefinition || showDeclaration || showLookup ) ) { m_contextString = ident; - QString squeezed = KStringHandler::csqueeze(ident, 30); + TQString squeezed = KStringHandler::csqueeze(ident, 30); popup->insertSeparator(); if ( showDeclaration ) - popup->insertItem( i18n("CTags - Go to Declaration: %1").arg(squeezed), this, SLOT(slotGotoDeclaration()) ); + popup->insertItem( i18n("CTags - Go to Declaration: %1").arg(squeezed), this, TQT_SLOT(slotGotoDeclaration()) ); if ( showDefinition ) - popup->insertItem( i18n("CTags - Go to Definition: %1").arg(squeezed), this, SLOT(slotGotoDefinition()) ); + popup->insertItem( i18n("CTags - Go to Definition: %1").arg(squeezed), this, TQT_SLOT(slotGotoDefinition()) ); if ( showLookup ) - popup->insertItem( i18n("CTags - Lookup: %1").arg(squeezed), this, SLOT(slotGotoTag()) ); + popup->insertItem( i18n("CTags - Lookup: %1").arg(squeezed), this, TQT_SLOT(slotGotoTag()) ); } } @@ -217,7 +217,7 @@ void CTags2Part::slotGotoTag( ) showHits( Tags::getExactMatches( m_contextString ) ); } -void CTags2Part::gotoTagForTypes( QStringList const & types ) +void CTags2Part::gotoTagForTypes( TQStringList const & types ) { Tags::TagList list = Tags::getMatches( m_contextString, false, types ); @@ -231,7 +231,7 @@ void CTags2Part::gotoTagForTypes( QStringList const & types ) { Tags::TagEntry tag = list.first(); KURL url; - QString fileWithTagInside; + TQString fileWithTagInside; // assume relative path to project directory if path does not start with slash if (tag.file[0] != '/') { fileWithTagInside = project()->projectDirectory() + "/" + tag.file; @@ -251,25 +251,25 @@ void CTags2Part::gotoTagForTypes( QStringList const & types ) void CTags2Part::slotGotoDefinition( ) { - QStringList types; + TQStringList types; types << "S" << "d" << "f" << "t" << "v"; gotoTagForTypes( types ); } void CTags2Part::slotGotoDeclaration( ) { - QStringList types; + TQStringList types; types << "L" << "c" << "e" << "g" << "m" << "n" << "p" << "s" << "u" << "x"; gotoTagForTypes( types ); } -int CTags2Part::getFileLineFromStream( QTextStream & istream, QString const & pattern ) +int CTags2Part::getFileLineFromStream( TQTextStream & istream, TQString const & pattern ) { if ( pattern.isEmpty() ) return -1; // ctags interestingly escapes "/", but apparently nothing else. lets revert that - QString unescaped = pattern; + TQString unescaped = pattern; unescaped.replace( "\\/", "/" ); // most of the time, the ctags pattern has the form /^foo$/ @@ -277,21 +277,21 @@ int CTags2Part::getFileLineFromStream( QTextStream & istream, QString const & pa // where the form is only /^foo/ // I have no idea if this is a ctags bug or not, but we have to deal with it - QString reduced, escaped, re_string; + TQString reduced, escaped, re_string; if ( unescaped.endsWith( "$/" ) ) { reduced = unescaped.mid( 2, unescaped.length() -4 ); - escaped = QRegExp::escape( reduced ); - re_string = QString( "^" + escaped + "$" ); + escaped = TQRegExp::escape( reduced ); + re_string = TQString( "^" + escaped + "$" ); } else { reduced = unescaped.mid( 2, unescaped.length() -3 ); - escaped = QRegExp::escape( reduced ); - re_string = QString( "^" + escaped ); + escaped = TQRegExp::escape( reduced ); + re_string = TQString( "^" + escaped ); } - QRegExp re( re_string ); + TQRegExp re( re_string ); int n = 0; while ( !istream.atEnd() ) @@ -305,23 +305,23 @@ int CTags2Part::getFileLineFromStream( QTextStream & istream, QString const & pa return -1; } -int CTags2Part::getFileLineFromPattern( KURL const & url, QString const & pattern ) +int CTags2Part::getFileLineFromPattern( KURL const & url, TQString const & pattern ) { // if the file is open - get the line from the editor buffer if ( KTextEditor::EditInterface * ei = dynamic_cast<KTextEditor::EditInterface*>( partController()->partForURL( url ) ) ) { - QString ibuffer = ei->text(); - QTextStream istream( &ibuffer, IO_ReadOnly ); + TQString ibuffer = ei->text(); + TQTextStream istream( &ibuffer, IO_ReadOnly ); return getFileLineFromStream( istream, pattern ); } else // else the file is not open - get the line from the file on disk { - QFile file( url.path() ); - QString buffer; + TQFile file( url.path() ); + TQString buffer; if ( file.open( IO_ReadOnly ) ) { - QTextStream istream( &file ); + TQTextStream istream( &file ); return getFileLineFromStream( istream, pattern ); } } |