summaryrefslogtreecommitdiffstats
path: root/quanta/src/document.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'quanta/src/document.cpp')
-rw-r--r--quanta/src/document.cpp142
1 files changed, 71 insertions, 71 deletions
diff --git a/quanta/src/document.cpp b/quanta/src/document.cpp
index 9b136e58..4e715a4a 100644
--- a/quanta/src/document.cpp
+++ b/quanta/src/document.cpp
@@ -461,8 +461,8 @@ void Document::insertText(const TQString &a_text, bool adjustCursor, bool repars
}
if (insideQuotes && closeQuotationFound)
{
- text.tqreplace("\\\"", "\"");
- text.tqreplace("\"", "\\\"");
+ text.replace("\\\"", "\"");
+ text.replace("\"", "\\\"");
}
}
@@ -669,8 +669,8 @@ TQString Document::getTagNameAt(int line, int col )
while (line >= 0)
{
QuantaCommon::removeCommentsAndQuotes(textLine, completionDTD);
- int pos = textLine.tqfindRev("<");
- int pos2 = textLine.tqfindRev(">");
+ int pos = textLine.findRev("<");
+ int pos2 = textLine.findRev(">");
if (pos != -1 && pos2 < pos)
{
textLine.remove(0, pos + 1);
@@ -680,7 +680,7 @@ TQString Document::getTagNameAt(int line, int col )
textLine[pos] != '>')
pos++;
name = textLine.left(pos).stripWhiteSpace();
- pos = name.tqfind(":");
+ pos = name.find(":");
if (pos != -1)
name = name.mid(pos + 1);
break;
@@ -778,7 +778,7 @@ void Document::slotFilterCompletion( KTextEditor::CompletionEntry *completion ,T
{
kdDebug(24000) << *string << endl;
kdDebug(24000) << completion->userdata << endl;
- int pos = completion->userdata.tqfind("|");
+ int pos = completion->userdata.find("|");
TQString s = completion->userdata.left(pos);
completion->userdata.remove(0,pos+1);
string->remove(0, s.length());
@@ -791,7 +791,7 @@ void Document::slotFilterCompletion( KTextEditor::CompletionEntry *completion ,T
viewCursorIf->cursorPositionReal(&line, &col);
TQString s2 = editIf->textLine(line).left(col);
kdDebug(24000) << s2 << endl;
- int pos = s2.tqfindRev('&');
+ int pos = s2.findRev('&');
if (pos != -1)
{
s2 = s2.mid(pos + 1);
@@ -820,7 +820,7 @@ void Document::slotFilterCompletion( KTextEditor::CompletionEntry *completion ,T
s = *string;
string->remove(0, string->length());
TQString s2 = TQString("public \""+DTDs::ref()->getDTDNameFromNickName(s)+"\"");
- const DTDStruct *dtd = DTDs::ref()->tqfind(DTDs::ref()->getDTDNameFromNickName(s));
+ const DTDStruct *dtd = DTDs::ref()->find(DTDs::ref()->getDTDNameFromNickName(s));
if (dtd && !dtd->url.isEmpty())
{
s2 += " \""+dtd->url+"\"";
@@ -942,7 +942,7 @@ bool Document::xmlAutoCompletion(int line, int column, const TQString & string)
tagName = getTagNameAt(line, column);
tag = QuantaCommon::tagFromDTD(completionDTD, tagName);
if (!tag && !tagName.isEmpty())
- tag = userTagList.tqfind(tagName.lower());
+ tag = userTagList.find(tagName.lower());
TQString s = editIf->textLine(line).left(column + 1);
bool namespacecompletion = false;
@@ -984,7 +984,7 @@ bool Document::xmlAutoCompletion(int line, int column, const TQString & string)
if (node->tag->type == Tag::XmlTag && (!node->next || !QuantaCommon::closesTag(node->tag, node->next->tag)))
{
TQString name = node->tag->name;
- name = name.left(name.tqfind(" | "));
+ name = name.left(name.find(" | "));
if (!node->tag->nameSpace.isEmpty())
name.prepend(node->tag->nameSpace + ":");
editIf->insertText(line, column + 1, name + ">");
@@ -1052,10 +1052,10 @@ bool Document::xmlAutoCompletion(int line, int column, const TQString & string)
{
//we need to find the attribute name
TQString textLine = editIf->textLine(line).left(column-1);
- TQString attribute = textLine.mid(textLine.tqfindRev(' ')+1);
- if (attribute == "style" && completionDTD->insideDTDs.tqcontains("css"))
+ TQString attribute = textLine.mid(textLine.findRev(' ')+1);
+ if (attribute == "style" && completionDTD->insideDTDs.contains("css"))
{
- completionDTD = DTDs::ref()->tqfind("text/css");
+ completionDTD = DTDs::ref()->find("text/css");
completionRequested = true;
return scriptAutoCompletion(line, column + 1, string);
}
@@ -1068,20 +1068,20 @@ bool Document::xmlAutoCompletion(int line, int column, const TQString & string)
//check if we are inside a style attribute, and use css autocompletion if we are
TQString textLine = editIf->textLine(line);
textLine = textLine.left(column);
- int pos = textLine.tqfindRev('"');
+ int pos = textLine.findRev('"');
if (pos != -1)
{
- pos = textLine.tqfindRev(' ', pos);
+ pos = textLine.findRev(' ', pos);
if (pos != -1)
{
textLine = textLine.mid(pos + 1);
- pos = textLine.tqfind('=');
+ pos = textLine.find('=');
if (pos != -1)
{
TQString attribute = textLine.left(pos);
- if (attribute == "style" && completionDTD->insideDTDs.tqcontains("css"))
+ if (attribute == "style" && completionDTD->insideDTDs.contains("css"))
{
- completionDTD = DTDs::ref()->tqfind("text/css");
+ completionDTD = DTDs::ref()->find("text/css");
completionRequested = true;
return scriptAutoCompletion(line, column + 1, string);
}
@@ -1089,7 +1089,7 @@ bool Document::xmlAutoCompletion(int line, int column, const TQString & string)
}
}
TQString s = editIf->textLine(line).left(column + 1);
- pos = s.tqfindRev('&');
+ pos = s.findRev('&');
if (pos != -1)
{
//complete character codes
@@ -1169,7 +1169,7 @@ TQValueList<KTextEditor::CompletionEntry>* Document::getGroupCompletions(Node *n
bool Document::isDerivatedFrom(const TQString& className, const TQString &baseClass)
{
- if (className.isEmpty() || !completionDTD->classInheritance.tqcontains(className))
+ if (className.isEmpty() || !completionDTD->classInheritance.contains(className))
return false;
TQString parentClass = completionDTD->classInheritance[className];
@@ -1179,7 +1179,7 @@ bool Document::isDerivatedFrom(const TQString& className, const TQString &baseCl
result = 1; //className extends baseClass
else
{
- if (completionDTD->classInheritance.tqcontains(parentClass))
+ if (completionDTD->classInheritance.contains(parentClass))
parentClass = completionDTD->classInheritance[parentClass];
else
result = -1;//nothing was found in the inheritance list
@@ -1366,7 +1366,7 @@ TQValueList<KTextEditor::CompletionEntry>* Document::getTagCompletions(int line,
// Here we actually append the completion type
completion.type = type[tagNameList[i]];
// And here is out sorting...
- if(completion.type.tqcontains("variable"))
+ if(completion.type.contains("variable"))
{
// Insert after the last variable
variableIt++;
@@ -1374,7 +1374,7 @@ TQValueList<KTextEditor::CompletionEntry>* Document::getTagCompletions(int line,
}
else
{
- if(completion.type.tqcontains("script"))
+ if(completion.type.contains("script"))
{
//Scripts can go at the end of the list
completions->append(completion);
@@ -1407,7 +1407,7 @@ TQValueList<KTextEditor::CompletionEntry>* Document::getAttributeCompletions(con
TQTag *tag = QuantaCommon::tagFromDTD(completionDTD, tagName);
if (!tag)
{
- tag = userTagList.tqfind(tagName.lower());
+ tag = userTagList.find(tagName.lower());
}
TQString startsWith = a_startsWith.upper();
if (tag)
@@ -1438,7 +1438,7 @@ TQValueList<KTextEditor::CompletionEntry>* Document::getAttributeCompletions(con
//list common attributes for this tag
for (TQStringList::Iterator it = tag->commonGroups.begin(); it != tag->commonGroups.end(); ++it)
{
- AttributeList *attrs = tag->parentDTD->commonAttrs->tqfind(*it);
+ AttributeList *attrs = tag->parentDTD->commonAttrs->find(*it);
for (uint j = 0; j < attrs->count(); j++)
{
TQString name = attrs->at(j)->name;
@@ -1452,7 +1452,7 @@ TQValueList<KTextEditor::CompletionEntry>* Document::getAttributeCompletions(con
}
}
- if (tag->name().tqcontains("!doctype",false)) //special case, list all the known document types
+ if (tag->name().contains("!doctype",false)) //special case, list all the known document types
{
TQStringList nickNames = DTDs::ref()->nickNameList(true);
for ( TQStringList::Iterator it = nickNames.begin(); it != nickNames.end(); ++it )
@@ -1538,7 +1538,7 @@ TQValueList<KTextEditor::CompletionEntry>* Document::getAttributeValueCompletion
}
if (deleteValues)
delete values;
- int andSignPos = startsWith.tqfind('&');
+ int andSignPos = startsWith.find('&');
if (andSignPos != -1)
{
TQValueList<KTextEditor::CompletionEntry> *charCompletions = getCharacterCompletions(startsWith.mid(andSignPos + 1));
@@ -1557,7 +1557,7 @@ TQValueList<KTextEditor::CompletionEntry>* Document::getCharacterCompletions(con
TQMap<TQString, KTextEditor::CompletionEntry> completionMap;
//first search for entities defined in the document
- const DTDStruct *dtdDTD = DTDs::ref()->tqfind("dtd");
+ const DTDStruct *dtdDTD = DTDs::ref()->find("dtd");
if (dtdDTD)
{
StructTreeGroup group;
@@ -1616,10 +1616,10 @@ TQValueList<KTextEditor::CompletionEntry>* Document::getCharacterCompletions(con
for ( TQStringList::Iterator it = charList.begin(); it != charList.end(); ++it )
{
completion.text = *it;
- int begin = completion.text.tqfind("(&") + 2;
+ int begin = completion.text.find("(&") + 2;
if (begin == 1)
continue;
- int length = completion.text.tqfind(";)") - begin + 1;
+ int length = completion.text.find(";)") - begin + 1;
TQString s = completion.text.mid(begin, length - 1);
completion.text = s + " : " + completion.text.left(begin -2) + " - " + completion.text.mid(begin + length + 1);
if (s.startsWith(startsWith))
@@ -1661,9 +1661,9 @@ const DTDStruct* Document::currentDTD(bool fallback)
/** Get a pointer to the default DTD (document, or app). */
const DTDStruct* Document::defaultDTD() const
{
- const DTDStruct* dtd = DTDs::ref()->tqfind(dtdName);
- if (!dtd) dtd = DTDs::ref()->tqfind(Project::ref()->defaultDTD());
- if (!dtd) dtd = DTDs::ref()->tqfind(qConfig.defaultDocType); //this will always exists
+ const DTDStruct* dtd = DTDs::ref()->find(dtdName);
+ if (!dtd) dtd = DTDs::ref()->find(Project::ref()->defaultDTD());
+ if (!dtd) dtd = DTDs::ref()->find(qConfig.defaultDocType); //this will always exists
return dtd;
}
@@ -1682,17 +1682,17 @@ TQString Document::findDTDName(Tag **tag)
{
text = editIf->textLine(i);
//search for !DOCTYPE tags
- pos = text.tqfind("!doctype",0,false);
+ pos = text.find("!doctype",0,false);
if (pos != -1) //parse the found !DOCTYPE tag
{
int bl, bc, el, ec;
line = i;
bl = line;
- startPos = text.tqfindRev('<',pos);
+ startPos = text.findRev('<',pos);
while (startPos == -1 && line >=0)
{
text = editIf->textLine(line);
- startPos = text.tqfindRev('<');
+ startPos = text.findRev('<');
bl = line;
line--;
}
@@ -1704,12 +1704,12 @@ TQString Document::findDTDName(Tag **tag)
bc = startPos;
line = i;
text = editIf->textLine(i);
- startPos = text.tqfind('>',pos);
+ startPos = text.find('>',pos);
el = line;
while (startPos == -1 && line < endLine)
{
text = editIf->textLine(line);
- startPos = text.tqfind('>');
+ startPos = text.find('>');
el = line;
line++;
}
@@ -1724,17 +1724,17 @@ TQString Document::findDTDName(Tag **tag)
text = this->text(bl, bc, el, ec);
(*tag)->parse(text, this);
(*tag)->type = Tag::XmlTag;
- text.tqreplace("\\\"", "\"");
- pos = text.tqfind("public",0,false);
+ text.replace("\\\"", "\"");
+ pos = text.find("public",0,false);
if (pos == -1) //if no PUBLIC info, use the word after !DOCTYPE as the doc.type
{
foundText = (*tag)->attribute(0);
} else
{ //use the quoted string after PUBLIC as doc. type
- pos = text.tqfind("\"", pos+1);
+ pos = text.find("\"", pos+1);
if (pos !=-1)
{
- int endPos = text.tqfind("\"",pos+1);
+ int endPos = text.find("\"",pos+1);
foundText = text.mid(pos+1, endPos-pos-1);
}
}
@@ -1797,7 +1797,7 @@ bool Document::scriptAutoCompletion(int line, int column, const TQString& insert
TQValueList<TQTag *> tags;
if (!word.isEmpty())
{
- tags.append(userTagList.tqfind(word.lower()));
+ tags.append(userTagList.find(word.lower()));
TQDictIterator<TQTag> it(*(completionDTD->tagsList));
for( ; it.current(); ++it )
{
@@ -1907,7 +1907,7 @@ TQString Document::text(const AreaStruct &area) const
return text(area.bLine, area.bCol, area.eLine, area.eCol);
}
-TQString Document::tqfind(const TQRegExp& regExp, int sLine, int sCol, int& fbLine, int&fbCol, int &feLine, int&feCol)
+TQString Document::find(const TQRegExp& regExp, int sLine, int sCol, int& fbLine, int&fbCol, int &feLine, int&feCol)
{
TQRegExp rx = regExp;
@@ -1937,11 +1937,11 @@ TQString Document::tqfind(const TQRegExp& regExp, int sLine, int sCol, int& fbLi
{
foundText = rx.cap();
TQString s = textToSearch.left(pos);
- int linesUntilFound = s.tqcontains("\n");
+ int linesUntilFound = s.contains("\n");
fbLine = sLine + linesUntilFound;
- fbCol = s.length()-s.tqfindRev("\n")-1;
- int linesInFound = foundText.tqcontains("\n");
- feCol = foundText.length()-foundText.tqfindRev("\n")-2;
+ fbCol = s.length()-s.findRev("\n")-1;
+ int linesInFound = foundText.contains("\n");
+ feCol = foundText.length()-foundText.findRev("\n")-2;
feLine = fbLine + linesInFound;
if (linesUntilFound == 0)
{
@@ -1965,7 +1965,7 @@ TQString Document::tqfind(const TQRegExp& regExp, int sLine, int sCol, int& fbLi
return foundText;
}
-TQString Document::tqfindRev(const TQRegExp& regExp, int sLine, int sCol, int& fbLine, int&fbCol, int &feLine, int&feCol)
+TQString Document::findRev(const TQRegExp& regExp, int sLine, int sCol, int& fbLine, int&fbCol, int &feLine, int&feCol)
{
TQRegExp rx = regExp;
TQString foundText = "";
@@ -1993,8 +1993,8 @@ TQString Document::tqfindRev(const TQRegExp& regExp, int sLine, int sCol, int& f
foundText = rx.cap();
fbLine = line;
fbCol = pos;
- int linesInFound = foundText.tqcontains("\n");
- feCol = foundText.length()-foundText.tqfindRev("\n")-2;
+ int linesInFound = foundText.contains("\n");
+ feCol = foundText.length()-foundText.findRev("\n")-2;
feLine = fbLine + linesInFound;
if (linesInFound == 0)
{
@@ -2047,7 +2047,7 @@ void Document::handleCodeCompletion()
{
completionDTD = defaultDTD();
TQString s = text(line, 0, line, col).stripWhiteSpace();
- if (s.tqfindRev("<") != -1)
+ if (s.findRev("<") != -1)
{
//showCodeCompletions(getTagCompletions(line, col + 1));
@@ -2079,8 +2079,8 @@ void Document::codeCompletionHintRequested()
if (completionDTD->family == Script)
{
// TQString textLine = editIf->textLine(line).left(col);
-// int pos = textLine.tqfindRev("(");
-// int pos2 = textLine.tqfindRev(")");
+// int pos = textLine.findRev("(");
+// int pos2 = textLine.findRev(")");
//if (pos > pos2 )
hintRequested = true;
scriptAutoCompletion(line, col - 1, "");
@@ -2093,8 +2093,8 @@ TQString Document::currentWord()
uint line, col;
viewCursorIf->cursorPositionReal(&line, &col);
TQString textLine = editIf->textLine(line);
- int startPos = textLine.tqfindRev(TQRegExp("\\W"), col);
- int endPos = textLine.tqfind(TQRegExp("\\W"), col);
+ int startPos = textLine.findRev(TQRegExp("\\W"), col);
+ int endPos = textLine.find(TQRegExp("\\W"), col);
if (startPos == -1)
startPos = 0;
else
@@ -2114,7 +2114,7 @@ TQString Document::findWordRev(const TQString& textToSearch, const DTDStruct *dt
int pos;
bool end = false;
do{
- pos = t.tqfindRev(TQRegExp("\\W"), startPos);
+ pos = t.findRev(TQRegExp("\\W"), startPos);
if (t[pos] == '_' ||
(dtd && dtd->minusAllowedInWord && t[pos] == '-'))
{
@@ -2155,9 +2155,9 @@ bool Document::xmlCodeCompletion(int line, int col)
if (index != -1) //inside a value
{
s = tag->attribute(index);
- if (s == "style" && completionDTD->insideDTDs.tqcontains("css"))
+ if (s == "style" && completionDTD->insideDTDs.contains("css"))
{
- completionDTD = DTDs::ref()->tqfind("text/css");
+ completionDTD = DTDs::ref()->find("text/css");
return scriptAutoCompletion(line, col, "");
} else
{
@@ -2190,7 +2190,7 @@ bool Document::xmlCodeCompletion(int line, int col)
if (!handled)
{
TQString s = editIf->textLine(line).left(col);
- int pos = s.tqfindRev('&');
+ int pos = s.findRev('&');
if (pos != -1)
{
s = s.mid(pos + 1);
@@ -2338,7 +2338,7 @@ void Document::enableGroupsForDTEP(const TQString& dtepName, bool enable)
m_groupsForDTEPs = m_DTEPList;
if (enable)
{
- if (m_groupsForDTEPs.tqcontains(dtepName) == 0)
+ if (m_groupsForDTEPs.contains(dtepName) == 0)
m_groupsForDTEPs.append(dtepName);
} else
{
@@ -2354,7 +2354,7 @@ void Document::resetGroupsForDTEPList()
/** Returns true if the number of " (excluding \") inside text is even. */
bool Document::evenQuotes(const TQString &text)
{
- int num = text.tqcontains(TQRegExp("[^\\\\]\""));
+ int num = text.contains(TQRegExp("[^\\\\]\""));
return (num /2 *2 == num);
}
@@ -2521,7 +2521,7 @@ TQStringList* Document::tagAttributeValues(const TQString& dtdName, const TQStri
{
TQStringList *values = 0L;
deleteResult = true;
- const DTDStruct* dtd = DTDs::ref()->tqfind(dtdName);
+ const DTDStruct* dtd = DTDs::ref()->find(dtdName);
if (dtd)
{
TQString searchForAttr = (dtd->caseSensitive) ? attribute : attribute.upper();
@@ -2691,7 +2691,7 @@ void Document::createBackup(KConfig* config)
config->setGroup("General Options");
TQStringList backedupFilesEntryList = QuantaCommon::readPathListEntry(config, "List of backedup files"); //the files that were backedup
TQStringList autosavedFilesEntryList = QuantaCommon::readPathListEntry(config, "List of autosaved files"); //the list of actual backup files inside $KDEHOME/share/apps/quanta/backups
- if (!autosavedFilesEntryList.tqcontains(backupPathValueURL)) //not yet backed up, add an entry for this file
+ if (!autosavedFilesEntryList.contains(backupPathValueURL)) //not yet backed up, add an entry for this file
{
autosavedFilesEntryList.append(backupPathValueURL);
config->writePathEntry("List of autosaved files", autosavedFilesEntryList);
@@ -2943,11 +2943,11 @@ void Document::processDTD(const TQString& documentType)
}
}
- if (!DTDs::ref()->tqfind(foundName))
+ if (!DTDs::ref()->find(foundName))
{
//try to find the closest matching DTD
TQString s = foundName.lower();
- uint spaceNum = s.tqcontains(' ');
+ uint spaceNum = s.contains(' ');
TQStringList dtdList = DTDs::ref()->nameList();
TQStringList lastDtdList;
for (uint i = 0; i <= spaceNum && !dtdList.empty(); i++)
@@ -3006,7 +3006,7 @@ void Document::processDTD(const TQString& documentType)
{
qConfig.showDTDSelectDialog = !dtdWidget->useClosestMatching->isChecked();
setDTDIdentifier(DTDs::ref()->getDTDNameFromNickName(dtdWidget->dtdCombo->currentText()));
- const DTDStruct *dtd = DTDs::ref()->tqfind(dtdName);
+ const DTDStruct *dtd = DTDs::ref()->find(dtdName);
if (dtdWidget->convertDTD->isChecked() && dtd->family == Xml)
{
int bLine, bCol, eLine, eCol;
@@ -3024,12 +3024,12 @@ void Document::processDTD(const TQString& documentType)
TQString dtdId = DTDs::ref()->DTDforURL(u)->name;
// if (dtdId == "empty")
{
- const DTDStruct * dtd = DTDs::ref()->tqfind(projectDTD);
+ const DTDStruct * dtd = DTDs::ref()->find(projectDTD);
if (DTDs::canHandle(dtd, u))
dtdId = projectDTD;
else
{
- dtd = DTDs::ref()->tqfind(qConfig.defaultDocType);
+ dtd = DTDs::ref()->find(qConfig.defaultDocType);
if (DTDs::canHandle(dtd, u))
dtdId = qConfig.defaultDocType;
}
@@ -3083,7 +3083,7 @@ void Document::resetDTEPs()
void Document::addDTEP(const TQString &dtepName)
{
- if (m_DTEPList.tqcontains(dtepName) == 0)
+ if (m_DTEPList.contains(dtepName) == 0)
{
m_DTEPList.append(dtepName);
}
@@ -3099,7 +3099,7 @@ TQStringList Document::groupsForDTEPs()
TQString Document::annotationText(uint line)
{
- TQMap<uint, TQPair<TQString, TQString> >::Iterator it = m_annotations.tqfind(line);
+ TQMap<uint, TQPair<TQString, TQString> >::Iterator it = m_annotations.find(line);
if (it != m_annotations.end())
return it.data().first;
else