summaryrefslogtreecommitdiffstats
path: root/parts/abbrev/abbrevpart.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'parts/abbrev/abbrevpart.cpp')
-rw-r--r--parts/abbrev/abbrevpart.cpp216
1 files changed, 108 insertions, 108 deletions
diff --git a/parts/abbrev/abbrevpart.cpp b/parts/abbrev/abbrevpart.cpp
index 181606f4..a86d98f8 100644
--- a/parts/abbrev/abbrevpart.cpp
+++ b/parts/abbrev/abbrevpart.cpp
@@ -15,10 +15,10 @@
#include "abbrevpart.h"
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qregexp.h>
-#include <qvbox.h>
+#include <tqfile.h>
+#include <tqfileinfo.h>
+#include <tqregexp.h>
+#include <tqvbox.h>
#include <kdebug.h>
#include <kdialogbase.h>
#include <klocale.h>
@@ -65,26 +65,26 @@ public:
K_EXPORT_COMPONENT_FACTORY( libkdevabbrev, AbbrevFactory )
-AbbrevPart::AbbrevPart(QObject *parent, const char *name, const QStringList &)
+AbbrevPart::AbbrevPart(TQObject *parent, const char *name, const TQStringList &)
: KDevPlugin(&data, parent, name ? name : "AbbrevPart")
{
setInstance(AbbrevFactory::instance());
setXMLFile("kdevabbrev.rc");
- connect(partController(), SIGNAL(activePartChanged(KParts::Part*)),
- this, SLOT(slotActivePartChanged(KParts::Part*)) );
+ connect(partController(), TQT_SIGNAL(activePartChanged(KParts::Part*)),
+ this, TQT_SLOT(slotActivePartChanged(KParts::Part*)) );
- connect(core(), SIGNAL(configWidget(KDialogBase*)), this, SLOT(configWidget(KDialogBase*)));
+ connect(core(), TQT_SIGNAL(configWidget(KDialogBase*)), this, TQT_SLOT(configWidget(KDialogBase*)));
KAction *action;
action = new KAction( i18n("Expand Text"), CTRL + Key_J,
- this, SLOT(slotExpandText()),
+ this, TQT_SLOT(slotExpandText()),
actionCollection(), "edit_expandtext" );
action->setToolTip( i18n("Expand current word") );
action->setWhatsThis( i18n("<b>Expand current word</b><p>Current word can be completed using the list of similar words in source files.") );
action = new KAction( i18n("Expand Abbreviation"), CTRL + Key_L,
- this, SLOT(slotExpandAbbrev()),
+ this, TQT_SLOT(slotExpandAbbrev()),
actionCollection(), "edit_expandabbrev" );
action->setToolTip( i18n("Expand abbreviation") );
action->setWhatsThis( i18n("<b>Expand abbreviation</b><p>Enable and configure abbreviations in <b>KDevelop Settings</b>, <b>Abbreviations</b> tab.") );
@@ -140,56 +140,56 @@ void AbbrevPart::setAutoWordCompletionEnabled( bool enabled )
disconnect( docIface->widget(), 0, this, 0 );
if( m_autoWordCompletionEnabled ){
- connect( docIface->widget(), SIGNAL(completionAborted()),
- this, SLOT(slotCompletionAborted()) );
- connect( docIface->widget(), SIGNAL(completionDone()),
- this, SLOT(slotCompletionDone()) );
- connect( docIface->widget(), SIGNAL(aboutToShowCompletionBox()),
- this, SLOT(slotAboutToShowCompletionBox()) );
-
- connect( docIface, SIGNAL(textChanged()), this, SLOT(slotTextChanged()) );
+ connect( docIface->widget(), TQT_SIGNAL(completionAborted()),
+ this, TQT_SLOT(slotCompletionAborted()) );
+ connect( docIface->widget(), TQT_SIGNAL(completionDone()),
+ this, TQT_SLOT(slotCompletionDone()) );
+ connect( docIface->widget(), TQT_SIGNAL(aboutToShowCompletionBox()),
+ this, TQT_SLOT(slotAboutToShowCompletionBox()) );
+
+ connect( docIface, TQT_SIGNAL(textChanged()), this, TQT_SLOT(slotTextChanged()) );
}
}
void AbbrevPart::load()
{
KStandardDirs *dirs = AbbrevFactory::instance()->dirs();
- QString localTemplatesFile = locateLocal("codetemplates", "templates", AbbrevFactory::instance());
- QStringList files;
- if (QFileInfo(localTemplatesFile).exists())
+ TQString localTemplatesFile = locateLocal("codetemplates", "templates", AbbrevFactory::instance());
+ TQStringList files;
+ if (TQFileInfo(localTemplatesFile).exists())
files << localTemplatesFile;
else
- files = dirs->findAllResources("codetemplates", QString::null, false, true);
+ files = dirs->findAllResources("codetemplates", TQString::null, false, true);
- QString localSourcesFile = locateLocal("sources", "sources", AbbrevFactory::instance());
- QStringList sourceFiles;
- if (QFileInfo(localSourcesFile).exists())
+ TQString localSourcesFile = locateLocal("sources", "sources", AbbrevFactory::instance());
+ TQStringList sourceFiles;
+ if (TQFileInfo(localSourcesFile).exists())
sourceFiles << localSourcesFile;
else
- sourceFiles = dirs->findAllResources("sources", QString::null, false, true);
+ sourceFiles = dirs->findAllResources("sources", TQString::null, false, true);
kdDebug(9028) << "=========> sourceFiles: " << sourceFiles.join(" ") << endl;
- this->m_completionFile = QString::null;
- for( QStringList::Iterator it=sourceFiles.begin(); it!=sourceFiles.end(); ++it ) {
- QString fn = *it;
+ this->m_completionFile = TQString::null;
+ for( TQStringList::Iterator it=sourceFiles.begin(); it!=sourceFiles.end(); ++it ) {
+ TQString fn = *it;
kdDebug(9028) << "===> load file: " << fn << endl;
- QFile f( fn );
+ TQFile f( fn );
if ( f.open(IO_ReadOnly) ) {
- QTextStream stream( &f );
- m_completionFile += ( stream.read() + QString("\n") );
+ TQTextStream stream( &f );
+ m_completionFile += ( stream.read() + TQString("\n") );
f.close();
}
}
- QStringList::ConstIterator it;
+ TQStringList::ConstIterator it;
for (it = files.begin(); it != files.end(); ++it) {
- QString fn = *it;
+ TQString fn = *it;
kdDebug(9028) << "fn = " << fn << endl;
- QFile f( fn );
+ TQFile f( fn );
if ( f.open(IO_ReadOnly) ) {
- QDomDocument doc;
+ TQDomDocument doc;
doc.setContent( &f );
- QDomElement root = doc.firstChild().toElement();
- QDomElement e = root.firstChild().toElement();
+ TQDomElement root = doc.firstChild().toElement();
+ TQDomElement e = root.firstChild().toElement();
while ( !e.isNull() ){
addTemplate( e.attribute("name"),
e.attribute("description"),
@@ -205,18 +205,18 @@ void AbbrevPart::load()
void AbbrevPart::save()
{
- QString fn = AbbrevFactory::instance()->dirs()->saveLocation("codetemplates", "", true);
+ TQString fn = AbbrevFactory::instance()->dirs()->saveLocation("codetemplates", "", true);
kdDebug(9028) << "fn = " << fn << endl;
- QDomDocument doc( "Templates" );
- QDomElement root = doc.createElement( "Templates" );
+ TQDomDocument doc( "Templates" );
+ TQDomElement root = doc.createElement( "Templates" );
doc.appendChild( root );
- QPtrList<CodeTemplate> templates = m_templates.allTemplates();
+ TQPtrList<CodeTemplate> templates = m_templates.allTemplates();
CodeTemplate *templ;
for (templ = templates.first(); templ; templ = templates.next())
{
- QDomElement e = doc.createElement( "Template" );
+ TQDomElement e = doc.createElement( "Template" );
e.setAttribute( "name", templ->name );
e.setAttribute( "description", templ->description );
e.setAttribute( "suffixes", templ->suffixes );
@@ -224,16 +224,16 @@ void AbbrevPart::save()
root.appendChild( e );
}
- QFile f( fn + "templates" );
+ TQFile f( fn + "templates" );
if( f.open(IO_WriteOnly) ){
- QTextStream stream( &f );
+ TQTextStream stream( &f );
stream << doc.toString();
f.close();
}
}
-QString AbbrevPart::currentWord() const
+TQString AbbrevPart::currentWord() const
{
return KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) );
}
@@ -241,9 +241,9 @@ QString AbbrevPart::currentWord() const
void AbbrevPart::configWidget(KDialogBase *dlg)
{
- QVBox *vbox = dlg->addVBoxPage(i18n("Abbreviations"), i18n("Abbreviations"), BarIcon( info()->icon(), KIcon::SizeMedium) );
+ TQVBox *vbox = dlg->addVBoxPage(i18n("Abbreviations"), i18n("Abbreviations"), BarIcon( info()->icon(), KIcon::SizeMedium) );
AbbrevConfigWidget *w = new AbbrevConfigWidget(this, vbox, "abbrev config widget");
- connect(dlg, SIGNAL(okClicked()), w, SLOT(accept()));
+ connect(dlg, TQT_SIGNAL(okClicked()), w, TQT_SLOT(accept()));
}
@@ -252,17 +252,17 @@ void AbbrevPart::slotExpandText()
if( !editIface || !completionIface || !viewCursorIface )
return;
- QString word = currentWord();
+ TQString word = currentWord();
if (word.isEmpty())
return;
- QValueList<KTextEditor::CompletionEntry> entries = findAllWords(editIface->text(), word);
+ TQValueList<KTextEditor::CompletionEntry> entries = findAllWords(editIface->text(), word);
if (entries.count() == 0) {
; // some statusbar message?
// } else if (entries.count() == 1) {
// uint line, col;
// viewCursorIface->cursorPositionReal(&line, &col);
-// QString txt = entries[0].text.mid(word.length());
+// TQString txt = entries[0].text.mid(word.length());
// editIface->insertText( line, col, txt );
// viewCursorIface->setCursorPositionReal( line, col + txt.length() );
} else {
@@ -272,32 +272,32 @@ void AbbrevPart::slotExpandText()
}
-QValueList<KTextEditor::CompletionEntry> AbbrevPart::findAllWords(const QString &text, const QString &prefix)
+TQValueList<KTextEditor::CompletionEntry> AbbrevPart::findAllWords(const TQString &text, const TQString &prefix)
{
- QValueList<KTextEditor::CompletionEntry> entries;
+ TQValueList<KTextEditor::CompletionEntry> entries;
KParts::ReadWritePart *part = dynamic_cast<KParts::ReadWritePart*>(partController()->activePart());
- QWidget *view = partController()->activeWidget();
+ TQWidget *view = partController()->activeWidget();
if (!part || !view) {
kdDebug(9028) << "no rw part" << endl;
return entries;
}
- QString suffix = part->url().url();
+ TQString suffix = part->url().url();
int pos = suffix.findRev('.');
if (pos != -1)
suffix.remove(0, pos+1);
kdDebug(9028) << "AbbrevPart::findAllWords with suffix " << suffix << endl;
- QMap<QString, bool> map;
- QRegExp rx( QString("\\b") + prefix + "[a-zA-Z0-9_]+\\b" );
+ TQMap<TQString, bool> map;
+ TQRegExp rx( TQString("\\b") + prefix + "[a-zA-Z0-9_]+\\b" );
int idx = 0;
pos = 0;
int len = 0;
while ( (pos = rx.search(text, idx)) != -1 ) {
len = rx.matchedLength();
- QString word = text.mid(pos, len);
+ TQString word = text.mid(pos, len);
if (map.find(word) == map.end()) {
KTextEditor::CompletionEntry e;
e.text = word;
@@ -312,7 +312,7 @@ QValueList<KTextEditor::CompletionEntry> AbbrevPart::findAllWords(const QString
len = 0;
while ( (pos = rx.search(m_completionFile, idx)) != -1 ) {
len = rx.matchedLength();
- QString word = m_completionFile.mid(pos, len);
+ TQString word = m_completionFile.mid(pos, len);
if (map.find(word) == map.end()) {
KTextEditor::CompletionEntry e;
e.text = word;
@@ -323,8 +323,8 @@ QValueList<KTextEditor::CompletionEntry> AbbrevPart::findAllWords(const QString
}
- QMap<QString, CodeTemplate*> m = m_templates[suffix];
- for (QMap<QString, CodeTemplate*>::const_iterator it = m.begin(); it != m.end() ; ++it) {
+ TQMap<TQString, CodeTemplate*> m = m_templates[suffix];
+ for (TQMap<TQString, CodeTemplate*>::const_iterator it = m.begin(); it != m.end() ; ++it) {
KTextEditor::CompletionEntry e;
e.text = it.data()->description + " <abbrev>";
e.userdata = it.key();
@@ -338,13 +338,13 @@ QValueList<KTextEditor::CompletionEntry> AbbrevPart::findAllWords(const QString
void AbbrevPart::slotExpandAbbrev()
{
KParts::ReadWritePart *part = dynamic_cast<KParts::ReadWritePart*>(partController()->activePart());
- QWidget *view = partController()->activeWidget();
+ TQWidget *view = partController()->activeWidget();
if (!part || !view) {
kdDebug(9028) << "no rw part" << endl;
return;
}
- QString suffix = part->url().url();
+ TQString suffix = part->url().url();
int pos = suffix.findRev('.');
if (pos != -1)
suffix.remove(0, pos+1);
@@ -362,18 +362,18 @@ void AbbrevPart::slotExpandAbbrev()
return;
}
- QString word = currentWord();
+ TQString word = currentWord();
kdDebug(9028) << "Expanding word " << word << " with suffix " << suffix << "." << endl;
- QMap<QString, CodeTemplate*> m = m_templates[suffix];
- for (QMap<QString, CodeTemplate*>::const_iterator it = m.begin(); it != m.end() ; ++it) {
+ TQMap<TQString, CodeTemplate*> m = m_templates[suffix];
+ for (TQMap<TQString, CodeTemplate*>::const_iterator it = m.begin(); it != m.end() ; ++it) {
if (it.key() != word)
continue;
uint line, col;
cursoriface->cursorPositionReal(&line, &col);
- QString linestr = editIface->textLine(line);
+ TQString linestr = editIface->textLine(line);
int startPos = QMAX( QMIN( (int)col, (int)linestr.length()-1 ), 0 );
int endPos = startPos;
startPos--;
@@ -388,15 +388,15 @@ void AbbrevPart::slotExpandAbbrev()
}
-void AbbrevPart::insertChars( const QString &chars )
+void AbbrevPart::insertChars( const TQString &chars )
{
unsigned line=0, col=0;
viewCursorIface->cursorPositionReal( &line, &col );
unsigned int currentLine=line, currentCol=col;
- QString spaces;
- QString s = editIface->textLine( currentLine );
+ TQString spaces;
+ TQString s = editIface->textLine( currentLine );
uint i=0;
while( i<s.length() && s[ i ].isSpace() ){
spaces += s[ i ];
@@ -404,13 +404,13 @@ void AbbrevPart::insertChars( const QString &chars )
}
bool foundPipe = false;
- QString str;
- QTextStream stream( &str, IO_WriteOnly );
- QStringList lines = QStringList::split( "\n", chars );
- QStringList::Iterator it = lines.begin();
+ TQString str;
+ TQTextStream stream( &str, IO_WriteOnly );
+ TQStringList lines = TQStringList::split( "\n", chars );
+ TQStringList::Iterator it = lines.begin();
line = currentLine;
while( it != lines.end() ){
- QString lineText = *it;
+ TQString lineText = *it;
if( it != lines.begin() ){
stream << spaces;
if( !foundPipe )
@@ -444,16 +444,16 @@ void AbbrevPart::insertChars( const QString &chars )
viewCursorIface->setCursorPositionReal( currentLine, currentCol );
}
-void AbbrevPart::addTemplate( const QString& templ,
- const QString& descr,
- const QString& suffixes,
- const QString& code)
+void AbbrevPart::addTemplate( const TQString& templ,
+ const TQString& descr,
+ const TQString& suffixes,
+ const TQString& code)
{
m_templates.insert(templ, descr, code, suffixes);
}
-void AbbrevPart::removeTemplate( const QString &suffixes, const QString &name )
+void AbbrevPart::removeTemplate( const TQString &suffixes, const TQString &name )
{
m_templates.remove( suffixes, name );
}
@@ -502,14 +502,14 @@ void AbbrevPart::slotActivePartChanged( KParts::Part* part )
disconnect( part->widget(), 0, this, 0 );
disconnect( doc, 0, this, 0 );
- connect( part->widget(), SIGNAL(filterInsertString(KTextEditor::CompletionEntry*, QString*)),
- this, SLOT(slotFilterInsertString(KTextEditor::CompletionEntry*, QString*)) );
+ connect( part->widget(), TQT_SIGNAL(filterInsertString(KTextEditor::CompletionEntry*, TQString*)),
+ this, TQT_SLOT(slotFilterInsertString(KTextEditor::CompletionEntry*, TQString*)) );
if( autoWordCompletionEnabled() ){
- connect( part->widget(), SIGNAL(completionAborted()), this, SLOT(slotCompletionAborted()) );
- connect( part->widget(), SIGNAL(completionDone()), this, SLOT(slotCompletionDone()) );
- connect( part->widget(), SIGNAL(aboutToShowCompletionBox()), this, SLOT(slotAboutToShowCompletionBox()) );
- connect( doc, SIGNAL(textChanged()), this, SLOT(slotTextChanged()) );
+ connect( part->widget(), TQT_SIGNAL(completionAborted()), this, TQT_SLOT(slotCompletionAborted()) );
+ connect( part->widget(), TQT_SIGNAL(completionDone()), this, TQT_SLOT(slotCompletionDone()) );
+ connect( part->widget(), TQT_SIGNAL(aboutToShowCompletionBox()), this, TQT_SLOT(slotAboutToShowCompletionBox()) );
+ connect( doc, TQT_SIGNAL(textChanged()), this, TQT_SLOT(slotTextChanged()) );
}
m_prevLine = -1;
@@ -533,11 +533,11 @@ void AbbrevPart::slotTextChanged()
return;
}
- QString textLine = editIface->textLine( line );
- QChar ch = textLine[ col-1 ];
- QChar currentChar = textLine[ col ];
+ TQString textLine = editIface->textLine( line );
+ TQChar ch = textLine[ col-1 ];
+ TQChar currentChar = textLine[ col ];
- if( currentChar.isLetterOrNumber() || currentChar == QChar('_') || !(ch.isLetterOrNumber() || ch == QChar('_')) ){
+ if( currentChar.isLetterOrNumber() || currentChar == TQChar('_') || !(ch.isLetterOrNumber() || ch == TQChar('_')) ){
// reset
m_prevLine = -1;
return;
@@ -551,17 +551,17 @@ void AbbrevPart::slotTextChanged()
m_prevColumn = col;
}
-void AbbrevPart::slotFilterInsertString( KTextEditor::CompletionEntry* entry, QString* text )
+void AbbrevPart::slotFilterInsertString( KTextEditor::CompletionEntry* entry, TQString* text )
{
kdDebug(9028) << "AbbrevPart::slotFilterInsertString()" << endl;
KParts::ReadWritePart *part = dynamic_cast<KParts::ReadWritePart*>(partController()->activePart());
- QWidget *view = partController()->activeWidget();
+ TQWidget *view = partController()->activeWidget();
if (!part || !view) {
kdDebug(9028) << "no rw part" << endl;
return;
}
- QString suffix = part->url().url();
+ TQString suffix = part->url().url();
int pos = suffix.findRev('.');
if (pos != -1)
suffix.remove(0, pos+1);
@@ -570,9 +570,9 @@ void AbbrevPart::slotFilterInsertString( KTextEditor::CompletionEntry* entry, QS
if( !entry || !text || !viewCursorIface || !editIface )
return;
- QString expand( " <abbrev>" );
+ TQString expand( " <abbrev>" );
if( !entry->userdata.isNull() && entry->text.endsWith(expand) ){
- QString macro = entry->text.left( entry->text.length() - expand.length() );
+ TQString macro = entry->text.left( entry->text.length() - expand.length() );
*text = "";
uint line, col;
viewCursorIface->cursorPositionReal( &line, &col );
@@ -614,19 +614,19 @@ CodeTemplateList::~ CodeTemplateList( )
{
}
-QMap< QString, CodeTemplate * > CodeTemplateList::operator [ ]( QString suffix )
+TQMap< TQString, CodeTemplate * > CodeTemplateList::operator [ ]( TQString suffix )
{
kdDebug(9028) << "CodeTemplateList::operator []" << endl;
- QMap< QString, CodeTemplate * > selectedTemplates;
- for (QMap<QString, QMap<QString, CodeTemplate* > >::const_iterator it = templates.begin(); it != templates.end(); ++it)
+ TQMap< TQString, CodeTemplate * > selectedTemplates;
+ for (TQMap<TQString, TQMap<TQString, CodeTemplate* > >::const_iterator it = templates.begin(); it != templates.end(); ++it)
{
kdDebug(9028) << "CodeTemplateList::operator [] - suffixes " << it.key() << endl;
- if (QStringList::split(",", it.key()).contains(suffix))
+ if (TQStringList::split(",", it.key()).contains(suffix))
{
kdDebug(9028) << "CodeTemplateList::operator [] - suffixes " << it.key() << " contains " << suffix << endl;
- QMap<QString, CodeTemplate* > m = it.data();
- for (QMap<QString, CodeTemplate* >::const_iterator itt = m.begin(); itt != m.end(); ++itt)
+ TQMap<TQString, CodeTemplate* > m = it.data();
+ for (TQMap<TQString, CodeTemplate* >::const_iterator itt = m.begin(); itt != m.end(); ++itt)
{
kdDebug(9028) << "x" << endl;
selectedTemplates[itt.key()] = itt.data();
@@ -636,10 +636,10 @@ QMap< QString, CodeTemplate * > CodeTemplateList::operator [ ]( QString suffix )
return selectedTemplates;
}
-void CodeTemplateList::insert( QString name, QString description, QString code, QString suffixes )
+void CodeTemplateList::insert( TQString name, TQString description, TQString code, TQString suffixes )
{
- QString origSuffixes = suffixes;
-// QStringList suffixList;
+ TQString origSuffixes = suffixes;
+// TQStringList suffixList;
int pos = suffixes.find('(');
if (pos == -1)
return;
@@ -648,7 +648,7 @@ void CodeTemplateList::insert( QString name, QString description, QString code,
if (pos == -1)
return;
suffixes.remove(pos, suffixes.length()-pos);
-// suffixList = QStringList::split(",", suffixes);
+// suffixList = TQStringList::split(",", suffixes);
CodeTemplate *t;
if (templates.contains(suffixes) && templates[suffixes].contains(name))
@@ -671,12 +671,12 @@ void CodeTemplateList::insert( QString name, QString description, QString code,
m_suffixes.append(origSuffixes);
}
-QPtrList< CodeTemplate > CodeTemplateList::allTemplates( ) const
+TQPtrList< CodeTemplate > CodeTemplateList::allTemplates( ) const
{
return allCodeTemplates;
}
-void CodeTemplateList::remove( const QString & suffixes, const QString & name )
+void CodeTemplateList::remove( const TQString & suffixes, const TQString & name )
{
allCodeTemplates.remove(templates[suffixes][name]);
templates[suffixes].remove(name);
@@ -688,7 +688,7 @@ void CodeTemplateList::clear( )
allCodeTemplates.clear();
}
-QStringList CodeTemplateList::suffixes( )
+TQStringList CodeTemplateList::suffixes( )
{
return m_suffixes;
}