From dc6b8e72fed2586239e3514819238c520636c9d9 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:54:04 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1157656 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- quanta/src/document.cpp | 556 ++++++++++++++++++++++++------------------------ 1 file changed, 278 insertions(+), 278 deletions(-) (limited to 'quanta/src/document.cpp') diff --git a/quanta/src/document.cpp b/quanta/src/document.cpp index 0c3c30ab..c3309a42 100644 --- a/quanta/src/document.cpp +++ b/quanta/src/document.cpp @@ -20,16 +20,16 @@ #include //QT includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // KDE includes #include @@ -93,8 +93,8 @@ extern GroupElementMapList globalGroupMap; Document::Document(KTextEditor::Document *doc, - QWidget *parent, const char *name, WFlags f ) - : QWidget(parent, name, f) + TQWidget *parent, const char *name, WFlags f ) + : TQWidget(parent, name, f) { m_dirty = false; busy = false; @@ -164,7 +164,7 @@ Document::Document(KTextEditor::Document *doc, m_encoding = encodingIf->encoding(); if (m_encoding.isEmpty()) m_encoding = "utf8"; //final fallback - m_codec = QTextCodec::codecForName(m_encoding); + m_codec = TQTextCodec::codecForName(m_encoding); selectionIf = dynamic_cast(m_doc); selectionIfExt = dynamic_cast(m_doc); @@ -190,7 +190,7 @@ Document::Document(KTextEditor::Document *doc, } tempFile = 0; - m_tempFileName = QString::null; + m_tempFileName = TQString::null; dtdName = Project::ref()->defaultDTD(); reparseEnabled = true; repaintEnabled = true; @@ -198,27 +198,27 @@ Document::Document(KTextEditor::Document *doc, docUndoRedo = new undoRedo(this); //path of the backup copy file of the document - m_backupPathValue = QString::null; + m_backupPathValue = TQString::null; - connect( m_doc, SIGNAL(charactersInteractivelyInserted (int ,int ,const QString&)), - this, SLOT(slotCharactersInserted(int ,int ,const QString&)) ); + connect( m_doc, TQT_SIGNAL(charactersInteractivelyInserted (int ,int ,const TQString&)), + this, TQT_SLOT(slotCharactersInserted(int ,int ,const TQString&)) ); - connect( m_view, SIGNAL(completionAborted()), - this, SLOT( slotCompletionAborted()) ); + connect( m_view, TQT_SIGNAL(completionAborted()), + this, TQT_SLOT( slotCompletionAborted()) ); - connect( m_view, SIGNAL(completionDone(KTextEditor::CompletionEntry)), - this, SLOT( slotCompletionDone(KTextEditor::CompletionEntry)) ); + connect( m_view, TQT_SIGNAL(completionDone(KTextEditor::CompletionEntry)), + this, TQT_SLOT( slotCompletionDone(KTextEditor::CompletionEntry)) ); - connect( m_view, SIGNAL(filterInsertString(KTextEditor::CompletionEntry*,QString *)), - this, SLOT( slotFilterCompletion(KTextEditor::CompletionEntry*,QString *)) ); - connect( m_doc, SIGNAL(textChanged()), SLOT(slotTextChanged())); + connect( m_view, TQT_SIGNAL(filterInsertString(KTextEditor::CompletionEntry*,TQString *)), + this, TQT_SLOT( slotFilterCompletion(KTextEditor::CompletionEntry*,TQString *)) ); + connect( m_doc, TQT_SIGNAL(textChanged()), TQT_SLOT(slotTextChanged())); - connect(m_view, SIGNAL(gotFocus(Kate::View*)), SIGNAL(editorGotFocus())); + connect(m_view, TQT_SIGNAL(gotFocus(Kate::View*)), TQT_SIGNAL(editorGotFocus())); - connect(fileWatcher, SIGNAL(dirty(const QString&)), SLOT(slotFileDirty(const QString&))); + connect(fileWatcher, TQT_SIGNAL(dirty(const TQString&)), TQT_SLOT(slotFileDirty(const TQString&))); -// connect(m_doc, SIGNAL(marksChanged()), this, SLOT(slotMarksChanged())); - connect(m_doc, SIGNAL(markChanged(KTextEditor::Mark, KTextEditor::MarkInterfaceExtension::MarkChangeAction)), this, SLOT(slotMarkChanged(KTextEditor::Mark, KTextEditor::MarkInterfaceExtension::MarkChangeAction))); +// connect(m_doc, TQT_SIGNAL(marksChanged()), this, TQT_SLOT(slotMarksChanged())); + connect(m_doc, TQT_SIGNAL(markChanged(KTextEditor::Mark, KTextEditor::MarkInterfaceExtension::MarkChangeAction)), this, TQT_SLOT(slotMarkChanged(KTextEditor::Mark, KTextEditor::MarkInterfaceExtension::MarkChangeAction))); } @@ -232,7 +232,7 @@ Document::~Document() delete m_doc; } -void Document::setUntitledUrl(const QString &url) +void Document::setUntitledUrl(const TQString &url) { untitledUrl = url; openURL(KURL()); @@ -250,9 +250,9 @@ KURL Document::url() // kwrite addons -void Document::insertTag(const QString &s1, const QString &s2) +void Document::insertTag(const TQString &s1, const TQString &s2) { - QString selection; + TQString selection; if (selectionIf && selectionIf->hasSelection()) { @@ -267,10 +267,10 @@ void Document::insertTag(const QString &s1, const QString &s2) /** Change the current tag's attributes with those from dict */ -void Document::changeTag(Tag *tag, QDict *dict ) +void Document::changeTag(Tag *tag, TQDict *dict ) { tag->modifyAttributes(dict); - QString tagStr = tag->toString(); + TQString tagStr = tag->toString(); reparseEnabled = false; int bLine, bCol, eLine, eCol; @@ -283,7 +283,7 @@ void Document::changeTag(Tag *tag, QDict *dict ) /**Change the namespace in a tag. Add if it's not present, or remove if the namespace argument is empty*/ -void Document::changeTagNamespace(Tag *tag, const QString& nameSpace) +void Document::changeTagNamespace(Tag *tag, const TQString& nameSpace) { int bl, bc; int nl, nc; @@ -312,9 +312,9 @@ void Document::changeTagNamespace(Tag *tag, const QString& nameSpace) } /**Change the attr value of the called attrName to attrValue*/ -void Document::changeTagAttribute(Tag *tag, const QString& attrName, const QString& attrValue) +void Document::changeTagAttribute(Tag *tag, const TQString& attrName, const TQString& attrValue) { - QString value; + TQString value; int line, col; int index = tag->attributeIndex(attrName); if (index != -1) @@ -329,7 +329,7 @@ void Document::changeTagAttribute(Tag *tag, const QString& attrName, const QStri if (line == aLine && col == aCol) { col += tag->attribute(index).length(); - value = QString("=") + qConfig.attrValueQuotation + attrValue + qConfig.attrValueQuotation; + value = TQString("=") + qConfig.attrValueQuotation + attrValue + qConfig.attrValueQuotation; } else { endCol = col + value.length(); @@ -339,7 +339,7 @@ void Document::changeTagAttribute(Tag *tag, const QString& attrName, const QStri endCol++; } reparseEnabled = false; - QString textLine = editIf->textLine(line); + TQString textLine = editIf->textLine(line); while (col > 1 && textLine[col-1].isSpace()) col--; @@ -385,7 +385,7 @@ void Document::selectText(int x1, int y1, int x2, int y2 ) } -void Document::replaceSelected(const QString &s) +void Document::replaceSelected(const TQString &s) { if (selectionIf) { @@ -401,7 +401,7 @@ void Document::replaceSelected(const QString &s) void Document::insertFile(const KURL& url) { - QString fileName; + TQString fileName; if (url.isLocalFile()) { fileName = url.path(); @@ -413,11 +413,11 @@ void Document::insertFile(const KURL& url) return; } } - QFile file(fileName); + TQFile file(fileName); if (file.open(IO_ReadOnly)) { - QTextStream stream( &file ); - stream.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream stream( &file ); + stream.setEncoding(TQTextStream::UnicodeUTF8); insertText(stream.read()); file.close(); } else @@ -425,9 +425,9 @@ void Document::insertFile(const KURL& url) } /** Inserts text at the current cursor position */ -void Document::insertText(const QString &a_text, bool adjustCursor, bool reparse) +void Document::insertText(const TQString &a_text, bool adjustCursor, bool reparse) { - QString text = a_text; + TQString text = a_text; if(text.isEmpty()) return; @@ -440,7 +440,7 @@ void Document::insertText(const QString &a_text, bool adjustCursor, bool reparse { int bLine, bCol; n->tag->beginPos(bLine, bCol); - QString s = this->text(bLine, bCol, line, col); + TQString s = this->text(bLine, bCol, line, col); bool insideQuotes = false; for (int i = 0 ; i < (int)s.length() - 1; i++) { @@ -500,7 +500,7 @@ void Document::insertText(const QString &a_text, bool adjustCursor, bool reparse } else if(!noWordWrap && !(isspace(ascii[i]))) // new word, see if it wraps { - // TOO SLOW int wordLength = (text.mid(i).section(QRegExp("[ \t\r\n]"), 0, 0).length()); + // TOO SLOW int wordLength = (text.mid(i).section(TQRegExp("[ \t\r\n]"), 0, 0).length()); wordLength = -1; for(j = i+1;ascii[j];++j) // get word size, ascii is MUCH faster { @@ -559,14 +559,14 @@ bool Document::insertChildTags(QTag *tag, QTag *lastTag) { return false; } - QMap::Iterator it; + TQMap::Iterator it; for (it = tag->childTags.begin(); it != tag->childTags.end(); ++it) { if (it.data()) { childInserted = true; QTag *childTag = QuantaCommon::tagFromDTD(tag->parentDTD, it.key()); - QString tagStr =QuantaCommon::tagCase(it.key()); + TQString tagStr =QuantaCommon::tagCase(it.key()); if ( tag->parentDTD->singleTagStyle == "xml" && ( childTag->isSingle() || (childTag->isOptional() && !qConfig.closeOptionalTags)) ) @@ -576,7 +576,7 @@ bool Document::insertChildTags(QTag *tag, QTag *lastTag) { insertText("<" +tagStr + ">", true, false); } - QString closingStr; + TQString closingStr; if (insertChildTags(childTag, tag)) { closingStr = ""; @@ -624,16 +624,16 @@ void Document::createTempFile() closeTempFile(); tempFile = new KTempFile(tmpDir); tempFile->setAutoDelete(true); - m_tempFileName = QFileInfo(*(tempFile->file())).filePath(); - QString encoding = quantaApp->defaultEncoding(); + m_tempFileName = TQFileInfo(*(tempFile->file())).filePath(); + TQString encoding = quantaApp->defaultEncoding(); if (encodingIf) encoding = encodingIf->encoding(); if (encoding.isEmpty()) encoding = "utf8"; //final fallback - tempFile->textStream()->setCodec(QTextCodec::codecForName(encoding)); + tempFile->textStream()->setCodec(TQTextCodec::codecForName(encoding)); * (tempFile->textStream()) << editIf->text(); - m_tempFileName = QFileInfo(*(tempFile->file())).filePath(); + m_tempFileName = TQFileInfo(*(tempFile->file())).filePath(); tempFile->close(); // kdDebug(24000) << "Creating tempfile " << m_tempFileName << " for " << url() << endl; } @@ -645,13 +645,13 @@ void Document::closeTempFile() delete tempFile; tempFile = 0L; } - if (QFileInfo(m_tempFileName).exists()) - QFile::remove(m_tempFileName); + if (TQFileInfo(m_tempFileName).exists()) + TQFile::remove(m_tempFileName); - m_tempFileName = QString::null; + m_tempFileName = TQString::null; } -QString Document::tempFileName() +TQString Document::tempFileName() { return m_tempFileName; } @@ -661,10 +661,10 @@ QString Document::tempFileName() It will work even if the tag has not been completed yet. An empty string will be returned if no tag is found. */ -QString Document::getTagNameAt(int line, int col ) +TQString Document::getTagNameAt(int line, int col ) { - QString name = ""; - QString textLine = editIf->textLine(line); + TQString name = ""; + TQString textLine = editIf->textLine(line); textLine = textLine.left(col); while (line >= 0) { @@ -703,7 +703,7 @@ QString Document::getTagNameAt(int line, int col ) } /** Show the code completions passed in as an argument */ -void Document::showCodeCompletions( QValueList *completions ) { +void Document::showCodeCompletions( TQValueList *completions ) { bool reparse = reparseEnabled; reparseEnabled = false; codeCompletionIf->showCompletionBox( *completions, false ); @@ -725,7 +725,7 @@ void Document::slotCompletionDone( KTextEditor::CompletionEntry completion ) /* if (completion.type == "charCompletion") { m_lastCompletionList = getCharacterCompletions(completion.userdata); - QTimer::singleShot(0, this, SLOT(slotDelayedShowCodeCompletion())); + TQTimer::singleShot(0, this, TQT_SLOT(slotDelayedShowCodeCompletion())); } else*/ if (completion.type == "attribute") { @@ -736,7 +736,7 @@ void Document::slotCompletionDone( KTextEditor::CompletionEntry completion ) if (tag) { m_lastCompletionList = getAttributeValueCompletions(tag->name(), completion.text); - QTimer::singleShot(0, this, SLOT(slotDelayedShowCodeCompletion())); + TQTimer::singleShot(0, this, TQT_SLOT(slotDelayedShowCodeCompletion())); } } } else @@ -755,7 +755,7 @@ void Document::slotCompletionDone( KTextEditor::CompletionEntry completion ) { m_lastLine = line; m_lastCol = col - 1; - QTimer::singleShot(0, this, SLOT(slotDelayedScriptAutoCompletion())); + TQTimer::singleShot(0, this, TQT_SLOT(slotDelayedScriptAutoCompletion())); } } } @@ -774,12 +774,12 @@ void Document::slotDelayedShowCodeCompletion() can filter this completion to allow more intelligent code compeltions */ -void Document::slotFilterCompletion( KTextEditor::CompletionEntry *completion ,QString *string ) +void Document::slotFilterCompletion( KTextEditor::CompletionEntry *completion ,TQString *string ) { kdDebug(24000) << *string << endl; kdDebug(24000) << completion->userdata << endl; int pos = completion->userdata.find("|"); - QString s = completion->userdata.left(pos); + TQString s = completion->userdata.left(pos); completion->userdata.remove(0,pos+1); string->remove(0, s.length()); kdDebug(24000) << *string << endl; @@ -789,7 +789,7 @@ void Document::slotFilterCompletion( KTextEditor::CompletionEntry *completion ,Q *string = completion->userdata; uint line, col; viewCursorIf->cursorPositionReal(&line, &col); - QString s2 = editIf->textLine(line).left(col); + TQString s2 = editIf->textLine(line).left(col); kdDebug(24000) << s2 << endl; int pos = s2.findRev('&'); if (pos != -1) @@ -804,8 +804,8 @@ void Document::slotFilterCompletion( KTextEditor::CompletionEntry *completion ,Q { uint line, col; viewCursorIf->cursorPositionReal(&line, &col); - QString textLine = editIf->textLine(line); - QChar tagSeparator = completionDTD->tagSeparator; + TQString textLine = editIf->textLine(line); + TQChar tagSeparator = completionDTD->tagSeparator; if (tagSeparator == '\'' || tagSeparator =='"') tagSeparator = qConfig.attrValueQuotation; if (textLine[col] != tagSeparator) @@ -813,13 +813,13 @@ void Document::slotFilterCompletion( KTextEditor::CompletionEntry *completion ,Q } else if ( completion->type == "attribute" ) { - string->append("="+QString(qConfig.attrValueQuotation)+QString(qConfig.attrValueQuotation)); + string->append("="+TQString(qConfig.attrValueQuotation)+TQString(qConfig.attrValueQuotation)); } else if (completion->type == "doctypeList") { s = *string; string->remove(0, string->length()); - QString s2 = QString("public \""+DTDs::ref()->getDTDNameFromNickName(s)+"\""); + TQString s2 = TQString("public \""+DTDs::ref()->getDTDNameFromNickName(s)+"\""); const DTDStruct *dtd = DTDs::ref()->find(DTDs::ref()->getDTDNameFromNickName(s)); if (dtd && !dtd->url.isEmpty()) { @@ -842,24 +842,24 @@ void Document::slotReplaceChar() /** Called when a user types in a character. From this we can show possibile completions based on what they are trying to input. */ -void Document::slotCharactersInserted(int line, int column, const QString& string) +void Document::slotCharactersInserted(int line, int column, const TQString& string) { if (qConfig.replaceNotInEncoding) { if (encodingIf) { - QString encoding = encodingIf->encoding(); + TQString encoding = encodingIf->encoding(); if (encoding != m_encoding) { m_encoding = encoding; - m_codec = QTextCodec::codecForName(encoding); + m_codec = TQTextCodec::codecForName(encoding); } if (!m_codec->canEncode(string[0])) { m_replaceLine = line; m_replaceCol = column; m_replaceStr = QuantaCommon::encodedChar(string[0].unicode()); - QTimer::singleShot(0, this, SLOT(slotReplaceChar())); + TQTimer::singleShot(0, this, TQT_SLOT(slotReplaceChar())); return; } } @@ -872,7 +872,7 @@ void Document::slotCharactersInserted(int line, int column, const QString& strin m_replaceLine = line; m_replaceCol = column; m_replaceStr = QuantaCommon::encodedChar(c); - QTimer::singleShot(0, this, SLOT(slotReplaceChar())); + TQTimer::singleShot(0, this, TQT_SLOT(slotReplaceChar())); return; } } @@ -934,17 +934,17 @@ void Document::slotCharactersInserted(int line, int column, const QString& strin /** Called whenever a user inputs text in an XML type document. Returns true if the code completionw as handled. */ -bool Document::xmlAutoCompletion(int line, int column, const QString & string) +bool Document::xmlAutoCompletion(int line, int column, const TQString & string) { QTag *tag; - QString tagName; + TQString tagName; bool handled = false; tagName = getTagNameAt(line, column); tag = QuantaCommon::tagFromDTD(completionDTD, tagName); if (!tag && !tagName.isEmpty()) tag = userTagList.find(tagName.lower()); - QString s = editIf->textLine(line).left(column + 1); + TQString s = editIf->textLine(line).left(column + 1); bool namespacecompletion = false; if (!tagName.isEmpty() && string ==":" && s.endsWith("<" + tagName + ":")) namespacecompletion = true; @@ -983,7 +983,7 @@ bool Document::xmlAutoCompletion(int line, int column, const QString & string) node = node->parent; if (node->tag->type == Tag::XmlTag && (!node->next || !QuantaCommon::closesTag(node->tag, node->next->tag))) { - QString name = node->tag->name; + TQString name = node->tag->name; name = name.left(name.find(" | ")); if (!node->tag->nameSpace.isEmpty()) name.prepend(node->tag->nameSpace + ":"); @@ -1041,7 +1041,7 @@ bool Document::xmlAutoCompletion(int line, int column, const QString & string) } else if ( string == " " ) { - QString textLine = editIf->textLine(line); + TQString textLine = editIf->textLine(line); if (!QuantaCommon::insideCommentsOrQuotes(column, textLine, completionDTD)) { showCodeCompletions(getAttributeCompletions(tagName, "")); @@ -1051,8 +1051,8 @@ bool Document::xmlAutoCompletion(int line, int column, const QString & string) else if ( string[0] == qConfig.attrValueQuotation ) { //we need to find the attribute name - QString textLine = editIf->textLine(line).left(column-1); - QString attribute = textLine.mid(textLine.findRev(' ')+1); + TQString textLine = editIf->textLine(line).left(column-1); + TQString attribute = textLine.mid(textLine.findRev(' ')+1); if (attribute == "style" && completionDTD->insideDTDs.contains("css")) { completionDTD = DTDs::ref()->find("text/css"); @@ -1066,7 +1066,7 @@ bool Document::xmlAutoCompletion(int line, int column, const QString & string) if (!handled) { //check if we are inside a style attribute, and use css autocompletion if we are - QString textLine = editIf->textLine(line); + TQString textLine = editIf->textLine(line); textLine = textLine.left(column); int pos = textLine.findRev('"'); if (pos != -1) @@ -1078,7 +1078,7 @@ bool Document::xmlAutoCompletion(int line, int column, const QString & string) pos = textLine.find('='); if (pos != -1) { - QString attribute = textLine.left(pos); + TQString attribute = textLine.left(pos); if (attribute == "style" && completionDTD->insideDTDs.contains("css")) { completionDTD = DTDs::ref()->find("text/css"); @@ -1088,7 +1088,7 @@ bool Document::xmlAutoCompletion(int line, int column, const QString & string) } } } - QString s = editIf->textLine(line).left(column + 1); + TQString s = editIf->textLine(line).left(column + 1); pos = s.findRev('&'); if (pos != -1) { @@ -1102,20 +1102,20 @@ bool Document::xmlAutoCompletion(int line, int column, const QString & string) } /** Return a list of possible variable name completions */ -QValueList* Document::getGroupCompletions(Node *node, const StructTreeGroup& group, int line, int col) +TQValueList* Document::getGroupCompletions(Node *node, const StructTreeGroup& group, int line, int col) { - QValueList *completions = new QValueList(); + TQValueList *completions = new TQValueList(); KTextEditor::CompletionEntry completion; completion.type = "variable"; - QString textLine = editIf->textLine(line).left(col); - QString word = findWordRev(textLine); + TQString textLine = editIf->textLine(line).left(col); + TQString word = findWordRev(textLine); if (!group.removeFromAutoCompleteWordRx.pattern().isEmpty()) word.remove(group.removeFromAutoCompleteWordRx); completion.userdata = word + "|"; GroupElementMapList::Iterator it; - QString str = group.name; + TQString str = group.name; str.append("|"); str.append(word); for ( it = globalGroupMap.begin(); it != globalGroupMap.end(); ++it ) @@ -1151,7 +1151,7 @@ QValueList* Document::getGroupCompletions(Node *no IncludedGroupElementsMap::Iterator it2; for ( it2 = elements.begin(); it2 != elements.end(); ++it2 ) { - QStringList list = it2.data()[group.name].keys(); + TQStringList list = it2.data()[group.name].keys(); list.sort(); for (uint i = 0; i < list.count(); i++) { @@ -1167,12 +1167,12 @@ QValueList* Document::getGroupCompletions(Node *no return completions; } -bool Document::isDerivatedFrom(const QString& className, const QString &baseClass) +bool Document::isDerivatedFrom(const TQString& className, const TQString &baseClass) { if (className.isEmpty() || !completionDTD->classInheritance.contains(className)) return false; - QString parentClass = completionDTD->classInheritance[className]; + TQString parentClass = completionDTD->classInheritance[className]; int result = 0; do { if (parentClass == baseClass) @@ -1191,9 +1191,9 @@ bool Document::isDerivatedFrom(const QString& className, const QString &baseClas /** Return a list of possible tag name completions */ -QValueList* Document::getTagCompletions(int line, int col) +TQValueList* Document::getTagCompletions(int line, int col) { - QValueList *completions = new QValueList(); + TQValueList *completions = new TQValueList(); KTextEditor::CompletionEntry completion; switch (completionDTD->family) { @@ -1211,10 +1211,10 @@ QValueList* Document::getTagCompletions(int line, QTag *parentQTag= 0L; if (node && node->parent) parentQTag = QuantaCommon::tagFromDTD(node->parent); - QString textLine = editIf->textLine(line).left(col); - QString word = findWordRev(textLine, completionDTD).upper(); - QString classStr = ""; - QString objStr; + TQString textLine = editIf->textLine(line).left(col); + TQString word = findWordRev(textLine, completionDTD).upper(); + TQString classStr = ""; + TQString objStr; if (completionDTD->classGroupIndex != -1 && completionDTD->objectGroupIndex != -1) { textLine = textLine.left(textLine.length() - word.length()); @@ -1222,14 +1222,14 @@ QValueList* Document::getTagCompletions(int line, if (pos != -1) { textLine = textLine.left(pos); - QRegExp *r = &(completionDTD->structTreeGroups[completionDTD->classGroupIndex].usageRx); + TQRegExp *r = &(completionDTD->structTreeGroups[completionDTD->classGroupIndex].usageRx); pos = r->searchRev(textLine); if (pos != -1) { objStr = r->cap(1); if (objStr == "this") { - QString parentGroupStr = ""; + TQString parentGroupStr = ""; bool classFound = false; parser->synchParseInDetail(); Node *n = parser->nodeAt(line, col); @@ -1285,12 +1285,12 @@ QValueList* Document::getTagCompletions(int line, return completions; } completion.userdata = word + "|"; - QStringList tagNameList; - QMap comments; - //A QMap to hold the completion type (function/string/class/etc) - QMap type; - QString tagName; - QDictIterator it(*(completionDTD->tagsList)); + TQStringList tagNameList; + TQMap comments; + //A TQMap to hold the completion type (function/string/class/etc) + TQMap type; + TQString tagName; + TQDictIterator it(*(completionDTD->tagsList)); int i = 0; for( ; it.current(); ++it ) { @@ -1303,7 +1303,7 @@ QValueList* Document::getTagCompletions(int line, { if (!parentQTag || (parentQTag && parentQTag->isChild(tagName))) { - tagName = tag->name() + QString("%1").arg(i, 10); + tagName = tag->name() + TQString("%1").arg(i, 10); tagNameList += tagName; comments.insert(tagName, tag->comment); i++; @@ -1312,14 +1312,14 @@ QValueList* Document::getTagCompletions(int line, } } - QDictIterator it2(userTagList); + TQDictIterator it2(userTagList); for( ; it2.current(); ++it2 ) { QTag *tag = it2.current(); if ((tag->className == classStr || isDerivatedFrom(classStr, tag->className)) && tag->name().upper().startsWith(word)) { - tagName = tag->name() + QString("%1").arg(i, 10); + tagName = tag->name() + TQString("%1").arg(i, 10); tagNameList += tagName; comments.insert(tagName, tag->comment); @@ -1350,8 +1350,8 @@ QValueList* Document::getTagCompletions(int line, // We only want to do this if we are completing Script DTDs // We are going to use a couple of iterators to sort the list by Type // Type Sorting is as follows: 0:Other, 1:Variables, 2: Functions (script) - QValueList::Iterator otherIt=completions->begin(); - QValueList::Iterator variableIt=completions->begin(); + TQValueList::Iterator otherIt=completions->begin(); + TQValueList::Iterator variableIt=completions->begin(); for (uint i = 0; i < tagNameList.count(); i++) { if (completionDTD->family == Xml) @@ -1400,16 +1400,16 @@ QValueList* Document::getTagCompletions(int line, } /** Return a list of valid attributes for the given tag */ -QValueList* Document::getAttributeCompletions(const QString& tagName, const QString& a_startsWith ) +TQValueList* Document::getAttributeCompletions(const TQString& tagName, const TQString& a_startsWith ) { - QValueList *completions = new QValueList(); + TQValueList *completions = new TQValueList(); KTextEditor::CompletionEntry completion; QTag *tag = QuantaCommon::tagFromDTD(completionDTD, tagName); if (!tag) { tag = userTagList.find(tagName.lower()); } - QString startsWith = a_startsWith.upper(); + TQString startsWith = a_startsWith.upper(); if (tag) { switch (completionDTD->family) @@ -1421,11 +1421,11 @@ QValueList* Document::getAttributeCompletions(cons //list specified attributes for this tag AttributeList *list = tag->attributes(); - QValueList tempCompletions; - QStringList nameList; + TQValueList tempCompletions; + TQStringList nameList; for (uint i = 0; i < list->count(); i++) { - QString item = list->at(i)->name; + TQString item = list->at(i)->name; if (item.upper().startsWith(startsWith)) { completion.text = QuantaCommon::attrCase(item); @@ -1436,12 +1436,12 @@ QValueList* Document::getAttributeCompletions(cons } //list common attributes for this tag - for (QStringList::Iterator it = tag->commonGroups.begin(); it != tag->commonGroups.end(); ++it) + for (TQStringList::Iterator it = tag->commonGroups.begin(); it != tag->commonGroups.end(); ++it) { AttributeList *attrs = tag->parentDTD->commonAttrs->find(*it); for (uint j = 0; j < attrs->count(); j++) { - QString name = attrs->at(j)->name; + TQString name = attrs->at(j)->name; if (name.upper().startsWith(startsWith)) { completion.text = QuantaCommon::attrCase(name); @@ -1454,8 +1454,8 @@ QValueList* Document::getAttributeCompletions(cons if (tag->name().contains("!doctype",false)) //special case, list all the known document types { - QStringList nickNames = DTDs::ref()->nickNameList(true); - for ( QStringList::Iterator it = nickNames.begin(); it != nickNames.end(); ++it ) + TQStringList nickNames = DTDs::ref()->nickNameList(true); + for ( TQStringList::Iterator it = nickNames.begin(); it != nickNames.end(); ++it ) { completion.type = "doctypeList"; completion.text = *it; @@ -1463,11 +1463,11 @@ QValueList* Document::getAttributeCompletions(cons nameList.append(completion.text); } } - //below isn't fast, but enough here. May be better with QMap + //below isn't fast, but enough here. May be better with TQMap nameList.sort(); - for ( QStringList::Iterator it = nameList.begin(); it != nameList.end(); ++it ) + for ( TQStringList::Iterator it = nameList.begin(); it != nameList.end(); ++it ) { - for (QValueList::Iterator compIt = tempCompletions.begin(); compIt != tempCompletions.end(); ++compIt) + for (TQValueList::Iterator compIt = tempCompletions.begin(); compIt != tempCompletions.end(); ++compIt) { if ( (*compIt).text == *it) { @@ -1485,7 +1485,7 @@ QValueList* Document::getAttributeCompletions(cons AttributeList *list = tag->attributes(); for (uint i = 0; i < list->count(); i++) { - QString item = list->at(i)->name; + TQString item = list->at(i)->name; completion.text = item; completion.comment = list->at(i)->type; completions->append( completion ); @@ -1499,21 +1499,21 @@ QValueList* Document::getAttributeCompletions(cons } /** Return a list of valid attribute values for the given tag and attribute */ -QValueList* Document::getAttributeValueCompletions(const QString& tagName, const QString& attribute, const QString& startsWith ) +TQValueList* Document::getAttributeValueCompletions(const TQString& tagName, const TQString& attribute, const TQString& startsWith ) { - QValueList *completions = new QValueList(); + TQValueList *completions = new TQValueList(); KTextEditor::CompletionEntry completion; completion.type = "attributeValue"; completion.userdata = startsWith+"|"+tagName + "," + attribute; bool deleteValues; - QStringList *values = tagAttributeValues(completionDTD->name,tagName, attribute, deleteValues); + TQStringList *values = tagAttributeValues(completionDTD->name,tagName, attribute, deleteValues); if (attribute.lower() == "class") { if (!values) { - values = new QStringList(quantaApp->selectors(tagName)); + values = new TQStringList(quantaApp->selectors(tagName)); deleteValues = true; } } else @@ -1521,13 +1521,13 @@ QValueList* Document::getAttributeValueCompletions { if (!values) { - values = new QStringList(quantaApp->idSelectors()); + values = new TQStringList(quantaApp->idSelectors()); deleteValues = true; } } if (values) { - for ( QStringList::Iterator it = values->begin(); it != values->end(); ++it ) + for ( TQStringList::Iterator it = values->begin(); it != values->end(); ++it ) { completion.text = *it; if (completion.text.startsWith(startsWith)) @@ -1541,7 +1541,7 @@ QValueList* Document::getAttributeValueCompletions int andSignPos = startsWith.find('&'); if (andSignPos != -1) { - QValueList *charCompletions = getCharacterCompletions(startsWith.mid(andSignPos + 1)); + TQValueList *charCompletions = getCharacterCompletions(startsWith.mid(andSignPos + 1)); *completions += *charCompletions; delete charCompletions; } @@ -1551,10 +1551,10 @@ QValueList* Document::getAttributeValueCompletions } /** Return a list of character completions (like   ...) */ -QValueList* Document::getCharacterCompletions(const QString& startsWith) +TQValueList* Document::getCharacterCompletions(const TQString& startsWith) { - QValueList *completions = 0L; - QMap completionMap; + TQValueList *completions = 0L; + TQMap completionMap; //first search for entities defined in the document const DTDStruct *dtdDTD = DTDs::ref()->find("dtd"); @@ -1583,18 +1583,18 @@ QValueList* Document::getCharacterCompletions(cons } if (!completions) - completions = new QValueList(); + completions = new TQValueList(); KTextEditor::CompletionEntry completion; completion.type = "charCompletion"; //add the entities from the tag files - QDictIterator it(*(completionDTD->tagsList)); + TQDictIterator it(*(completionDTD->tagsList)); for( ; it.current(); ++it ) { QTag *tag = it.current(); if (tag->type == "entity") { - QString tagName = tag->name(true); + TQString tagName = tag->name(true); if (tagName.upper().startsWith(startsWith.upper()) || startsWith.isEmpty()) { completion.text = tagName; @@ -1605,22 +1605,22 @@ QValueList* Document::getCharacterCompletions(cons } } - QValueList *completions2 = new QValueList(); - for (QMap::ConstIterator it = completionMap.constBegin(); it != completionMap.constEnd(); ++it) + TQValueList *completions2 = new TQValueList(); + for (TQMap::ConstIterator it = completionMap.constBegin(); it != completionMap.constEnd(); ++it) { completions2->append(it.data()); } delete completions; completions = completions2; - for ( QStringList::Iterator it = charList.begin(); it != charList.end(); ++it ) + for ( TQStringList::Iterator it = charList.begin(); it != charList.end(); ++it ) { completion.text = *it; int begin = completion.text.find("(&") + 2; if (begin == 1) continue; int length = completion.text.find(";)") - begin + 1; - QString s = completion.text.mid(begin, length - 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)) { @@ -1633,13 +1633,13 @@ QValueList* Document::getCharacterCompletions(cons } /** Returns the DTD identifier for the document */ -QString Document::getDTDIdentifier() +TQString Document::getDTDIdentifier() { return dtdName; } /** Sets the DTD identifier */ -void Document::setDTDIdentifier(const QString &id) +void Document::setDTDIdentifier(const TQString &id) { dtdName = id.lower(); m_groupsForDTEPs.clear(); @@ -1669,15 +1669,15 @@ const DTDStruct* Document::defaultDTD() const } /** Find the DTD name for a part of the document. */ -QString Document::findDTDName(Tag **tag) +TQString Document::findDTDName(Tag **tag) { //Do some magic to find the document type int endLine = editIf->numLines(); - QString foundText = ""; + TQString foundText = ""; int pos = 0; int i = 0; int line, startPos; - QString text; + TQString text; do { text = editIf->textLine(i); @@ -1747,7 +1747,7 @@ QString Document::findDTDName(Tag **tag) } /** Called whenever a user inputs text in a script type document. */ -bool Document::scriptAutoCompletion(int line, int column, const QString& insertedString) +bool Document::scriptAutoCompletion(int line, int column, const TQString& insertedString) { bool handled = false; Node *node = parser->nodeAt(line, column); @@ -1764,17 +1764,17 @@ bool Document::scriptAutoCompletion(int line, int column, const QString& inserte int bl, bc; node->tag->beginPos(bl, bc); - QString s = text(bl, bc, line, column); + TQString s = text(bl, bc, line, column); if (QuantaCommon::insideCommentsOrQuotes(s.length() -1, s, dtd)) return true; //again, nothing to do - QString s2 = s; + TQString s2 = s; int i = s.length() - 1; while (i > 0 && s[i].isSpace()) i--; while (i > 0 && (s[i].isLetterOrNumber() || s[i] == '_' || (completionDTD->minusAllowedInWord && s[i] == '-') ) ) i--; - QString startStr = s.mid(i + 1).stripWhiteSpace(); + TQString startStr = s.mid(i + 1).stripWhiteSpace(); s = s.left(i + 1); if (s[i] == completionDTD->attributeSeparator) { @@ -1792,26 +1792,26 @@ bool Document::scriptAutoCompletion(int line, int column, const QString& inserte if ( s[i] == completionDTD->attrAutoCompleteAfter || s[i] == completionDTD->attributeSeparator ) //if we need to list the arguments of a function { - QString textLine = s.left(i); - QString word = findWordRev(textLine, completionDTD); - QValueList tags; + TQString textLine = s.left(i); + TQString word = findWordRev(textLine, completionDTD); + TQValueList tags; if (!word.isEmpty()) { tags.append(userTagList.find(word.lower())); - QDictIterator it(*(completionDTD->tagsList)); + TQDictIterator it(*(completionDTD->tagsList)); for( ; it.current(); ++it ) { if (it.currentKey() == word) tags.append(it.current()); } } - QStringList argList; - for (QValueList::ConstIterator it = tags.constBegin(); it != tags.constEnd(); ++it) + TQStringList argList; + for (TQValueList::ConstIterator it = tags.constBegin(); it != tags.constEnd(); ++it) { QTag *tag = *it; if (!tag) continue; - QString arguments; + TQString arguments; if (tag->type != "property") { for (int i =0; i < tag->attributeCount(); i++) @@ -1873,7 +1873,7 @@ bool Document::scriptAutoCompletion(int line, int column, const QString& inserte /** Retrives the text from the specified rectangle. The KTextEditor::EditInterface::text seems to not work correctly. */ -QString Document::text(int bLine, int bCol, int eLine, int eCol) const +TQString Document::text(int bLine, int bCol, int eLine, int eCol) const { if (bLine > eLine) { @@ -1884,7 +1884,7 @@ QString Document::text(int bLine, int bCol, int eLine, int eCol) const bCol = eCol; eCol = tmp; } - QString t = editIf->textLine(bLine); + TQString t = editIf->textLine(bLine); if (bLine == eLine) { return t.mid(bCol, eCol-bCol +1); @@ -1902,18 +1902,18 @@ QString Document::text(int bLine, int bCol, int eLine, int eCol) const //TODO: profile which one is used more often and time critical places and use //that one as the default and call from that one the other version -QString Document::text(const AreaStruct &area) const +TQString Document::text(const AreaStruct &area) const { return text(area.bLine, area.bCol, area.eLine, area.eCol); } -QString Document::find(const QRegExp& 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) { - QRegExp rx = regExp; - QString foundText = ""; + TQRegExp rx = regExp; + TQString foundText = ""; int maxLine = editIf->numLines(); - QString textToSearch = text(sLine, sCol, sLine, editIf->lineLength(sLine)); + TQString textToSearch = text(sLine, sCol, sLine, editIf->lineLength(sLine)); int pos; int line = sLine; do @@ -1936,7 +1936,7 @@ QString Document::find(const QRegExp& regExp, int sLine, int sCol, int& fbLine, if (pos != -1) { foundText = rx.cap(); - QString s = textToSearch.left(pos); + TQString s = textToSearch.left(pos); int linesUntilFound = s.contains("\n"); fbLine = sLine + linesUntilFound; fbCol = s.length()-s.findRev("\n")-1; @@ -1965,13 +1965,13 @@ QString Document::find(const QRegExp& regExp, int sLine, int sCol, int& fbLine, return foundText; } -QString Document::findRev(const QRegExp& 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) { - QRegExp rx = regExp; - QString foundText = ""; + TQRegExp rx = regExp; + TQString foundText = ""; int pos = -1; int line = sLine; - QString textToSearch = text(sLine, 0, sLine, sCol); + TQString textToSearch = text(sLine, 0, sLine, sCol); do { pos = rx.searchRev(textToSearch); @@ -2003,7 +2003,7 @@ QString Document::findRev(const QRegExp& regExp, int sLine, int sCol, int& fbLin if (fbCol < 0) fbCol = 0; if (feCol < 0) feCol = 0; /* - QString s = text(fbLine, fbCol, feLine, feCol); + TQString s = text(fbLine, fbCol, feLine, feCol); if (s != foundText) //debug, error { KMessageBox::error(this,"FindRev\nFound: "+foundText+"\nRead: "+s); @@ -2046,7 +2046,7 @@ void Document::handleCodeCompletion() /* if (!handled) { completionDTD = defaultDTD(); - QString s = text(line, 0, line, col).stripWhiteSpace(); + TQString s = text(line, 0, line, col).stripWhiteSpace(); if (s.findRev("<") != -1) { //showCodeCompletions(getTagCompletions(line, col + 1)); @@ -2078,7 +2078,7 @@ void Document::codeCompletionHintRequested() completionDTD = currentDTD(); if (completionDTD->family == Script) { -// QString textLine = editIf->textLine(line).left(col); +// TQString textLine = editIf->textLine(line).left(col); // int pos = textLine.findRev("("); // int pos2 = textLine.findRev(")"); //if (pos > pos2 ) @@ -2088,13 +2088,13 @@ void Document::codeCompletionHintRequested() completionRequested = false; } -QString Document::currentWord() +TQString Document::currentWord() { uint line, col; viewCursorIf->cursorPositionReal(&line, &col); - QString textLine = editIf->textLine(line); - int startPos = textLine.findRev(QRegExp("\\W"), col); - int endPos = textLine.find(QRegExp("\\W"), col); + TQString textLine = editIf->textLine(line); + int startPos = textLine.findRev(TQRegExp("\\W"), col); + int endPos = textLine.find(TQRegExp("\\W"), col); if (startPos == -1) startPos = 0; else @@ -2105,16 +2105,16 @@ QString Document::currentWord() } /** Find the word until the first word boundary backwards */ -QString Document::findWordRev(const QString& textToSearch, const DTDStruct *dtd) +TQString Document::findWordRev(const TQString& textToSearch, const DTDStruct *dtd) { - QString t = textToSearch; + TQString t = textToSearch; while (t.endsWith(" ")) t = t.left(t.length()-1); int startPos = -1; int pos; bool end = false; do{ - pos = t.findRev(QRegExp("\\W"), startPos); + pos = t.findRev(TQRegExp("\\W"), startPos); if (t[pos] == '_' || (dtd && dtd->minusAllowedInWord && t[pos] == '-')) { @@ -2139,9 +2139,9 @@ bool Document::xmlCodeCompletion(int line, int col) Tag *tag = node->tag; int bLine, bCol; tag->beginPos(bLine, bCol); - QString s; + TQString s; int index; - QString tagName = tag->name.section('|', 0, 0).stripWhiteSpace(); + TQString tagName = tag->name.section('|', 0, 0).stripWhiteSpace(); int nameCol = bCol + tagName.length() + 1; if (!tag->nameSpace.isEmpty()) nameCol += 1 + tag->nameSpace.length(); @@ -2189,7 +2189,7 @@ bool Document::xmlCodeCompletion(int line, int col) } if (!handled) { - QString s = editIf->textLine(line).left(col); + TQString s = editIf->textLine(line).left(col); int pos = s.findRev('&'); if (pos != -1) { @@ -2214,7 +2214,7 @@ void Document::slotCompletionAborted() /** Ask for user confirmation if the file was changed outside. */ void Document::checkDirtyStatus() { - QString fileName; + TQString fileName; if (url().isLocalFile()) fileName = url().path(); if (m_dirty) @@ -2222,7 +2222,7 @@ void Document::checkDirtyStatus() createTempFile(); if (!fileName.isEmpty()) { - QDateTime modifTime = QFileInfo(fileName).lastModified(); + TQDateTime modifTime = TQFileInfo(fileName).lastModified(); if (modifTime == m_modifTime) m_dirty = false; } @@ -2230,7 +2230,7 @@ void Document::checkDirtyStatus() { if (m_md5sum.isEmpty()) { - QFile f(fileName); + TQFile f(fileName); if (f.open(IO_ReadOnly)) { const char* c = ""; @@ -2245,10 +2245,10 @@ void Document::checkDirtyStatus() { //check if the file is changed, also by file content. Might help to reduce //unwanted warning on NFS - QFile f(fileName); + TQFile f(fileName); if (f.open(IO_ReadOnly)) { - QString md5sum; + TQString md5sum; const char* c = ""; KMD5 context(c); context.reset(); @@ -2268,7 +2268,7 @@ void Document::checkDirtyStatus() { DirtyDlg *dlg = new DirtyDlg(url().path(), m_tempFileName, false, this); DirtyDialog *w = static_cast(dlg->mainWidget()); - QString kompareStr = KStandardDirs::findExe("kompare"); + TQString kompareStr = KStandardDirs::findExe("kompare"); if (kompareStr.isEmpty()) { w->buttonCompare->setEnabled(false); @@ -2279,7 +2279,7 @@ void Document::checkDirtyStatus() m_doc->setModified(false); openURL(url()); } - m_modifTime = QFileInfo(fileName).lastModified(); + m_modifTime = TQFileInfo(fileName).lastModified(); delete dlg; } closeTempFile(); @@ -2292,13 +2292,13 @@ void Document::save() { if (url().isLocalFile()) { - QString fileName; + TQString fileName; fileName = url().path(); fileWatcher->removeFile(fileName); // kdDebug(24000) << "removeFile[save]: " << fileName << endl; m_doc->save(); m_dirty = false; - m_modifTime = QFileInfo(fileName).lastModified(); + m_modifTime = TQFileInfo(fileName).lastModified(); fileWatcher->addFile(fileName); // kdDebug(24000) << "addFile[save]: " << fileName << endl; } else @@ -2317,7 +2317,7 @@ bool Document::saveAs(const KURL& url) m_md5sum = ""; if (url.isLocalFile()) { - QFile f(url.path()); + TQFile f(url.path()); if (f.open(IO_ReadOnly)) { const char* c = ""; @@ -2332,7 +2332,7 @@ bool Document::saveAs(const KURL& url) return result; } -void Document::enableGroupsForDTEP(const QString& dtepName, bool enable) +void Document::enableGroupsForDTEP(const TQString& dtepName, bool enable) { if (m_groupsForDTEPs.isEmpty()) m_groupsForDTEPs = m_DTEPList; @@ -2352,9 +2352,9 @@ void Document::resetGroupsForDTEPList() } /** Returns true if the number of " (excluding \") inside text is even. */ -bool Document::evenQuotes(const QString &text) +bool Document::evenQuotes(const TQString &text) { - int num = text.contains(QRegExp("[^\\\\]\"")); + int num = text.contains(TQRegExp("[^\\\\]\"")); return (num /2 *2 == num); } @@ -2367,7 +2367,7 @@ void Document::slotTextChanged() { kdDebug(24000) << "Delayed text changed called." << endl; //delay the handling, otherwise we may get wrong values for (line,column) - QTimer::singleShot(0, this, SLOT(slotDelayedTextChanged())); + TQTimer::singleShot(0, this, TQT_SLOT(slotDelayedTextChanged())); delayedTextChangedEnabled = false; } } @@ -2378,14 +2378,14 @@ void Document::slotDelayedTextChanged(bool forced) { kdDebug(24000) << "Reparsing delayed!" << endl; parser->setParsingNeeded(true); - QTimer::singleShot(1000, this, SLOT(slotDelayedTextChanged())); + TQTimer::singleShot(1000, this, TQT_SLOT(slotDelayedTextChanged())); reparseEnabled = false; delayedTextChangedEnabled = false; return; } uint line, column; - QString oldNodeName = ""; + TQString oldNodeName = ""; Node *node; Node *currentNode = 0L; //holds a copy of the node which is at (line,column) Node *previousNode = 0L;//holds a copy of the node before currentNode @@ -2441,7 +2441,7 @@ void Document::slotDelayedTextChanged(bool forced) if (bl == bl2 && bc == bc2 && ((node->tag->type == Tag::XmlTag && !node->tag->single) || currentNode->tag->type == Tag::XmlTagEnd)) { - QString newName = node->tag->name; + TQString newName = node->tag->name; bool updateClosing = (currentNode->tag->type == Tag::XmlTag) && !newName.startsWith("!"); int num = 1; if (!node->tag->nameSpace.isEmpty()) @@ -2517,14 +2517,14 @@ void Document::slotDelayedTextChanged(bool forced) } /** Returns list of values for attribute */ -QStringList* Document::tagAttributeValues(const QString& dtdName, const QString& tag, const QString &attribute, bool &deleteResult) +TQStringList* Document::tagAttributeValues(const TQString& dtdName, const TQString& tag, const TQString &attribute, bool &deleteResult) { - QStringList *values = 0L; + TQStringList *values = 0L; deleteResult = true; const DTDStruct* dtd = DTDs::ref()->find(dtdName); if (dtd) { - QString searchForAttr = (dtd->caseSensitive) ? attribute : attribute.upper(); + TQString searchForAttr = (dtd->caseSensitive) ? attribute : attribute.upper(); AttributeList* attrs = QuantaCommon::tagAttributes(dtdName, tag); if (attrs) { @@ -2532,17 +2532,17 @@ QStringList* Document::tagAttributeValues(const QString& dtdName, const QString& KURL u; KURL base = url(); base.setPath(base.directory(false,false)); - QString s; + TQString s; for ( attr = attrs->first(); attr; attr = attrs->next() ) { - QString attrName = (dtd->caseSensitive) ? attr->name : attr->name.upper(); + TQString attrName = (dtd->caseSensitive) ? attr->name : attr->name.upper(); if (attrName == searchForAttr) { if (attr->type == "url") { Project *project = Project::ref(); if (project->hasProject()) { - values = new QStringList(project->fileNameList()); + values = new TQStringList(project->fileNameList()); for (uint i = 0; i < values->count(); i++) { u = (*values)[i]; @@ -2553,8 +2553,8 @@ QStringList* Document::tagAttributeValues(const QString& dtdName, const QString& values->append("mailto:" + project->email()); } else { - QDir dir = QDir(url().directory()); - values = new QStringList(dir.entryList()); + TQDir dir = TQDir(url().directory()); + values = new TQStringList(dir.entryList()); } break; } else { @@ -2590,11 +2590,11 @@ void Document::paste() } /** returns all the areas that are between tag and it's closing pair */ -QStringList Document::tagAreas(const QString& tag, bool includeCoordinates, bool skipFoundContent) +TQStringList Document::tagAreas(const TQString& tag, bool includeCoordinates, bool skipFoundContent) { Node *node = baseNode; int bl, bc, el, ec; - QStringList result; + TQStringList result; while (node) { @@ -2611,10 +2611,10 @@ QStringList Document::tagAreas(const QString& tag, bool includeCoordinates, bool el = editIf->numLines()-1; ec = editIf->lineLength(el); } - QString s = text(bl, bc, el, ec); + TQString s = text(bl, bc, el, ec); if (includeCoordinates) { - s.prepend(QString("%1,%2,%3,%4\n").arg(bl).arg(bc).arg(el).arg(ec)); + s.prepend(TQString("%1,%2,%3,%4\n").arg(bl).arg(bc).arg(el).arg(ec)); } result += s; if (skipFoundContent) @@ -2647,7 +2647,7 @@ void Document::clearErrorMarks() { if (!markIf) return; - QPtrList marks = markIf->marks(); + TQPtrList marks = markIf->marks(); KTextEditor::Mark* mark; for (mark = marks.first(); mark; mark = marks.next()) { @@ -2656,12 +2656,12 @@ void Document::clearErrorMarks() } } -QString Document::backupPathEntryValue() +TQString Document::backupPathEntryValue() { return m_backupPathValue; } -void Document::setBackupPathEntryValue(const QString& ev) +void Document::setBackupPathEntryValue(const TQString& ev) { m_backupPathValue = ev; } @@ -2678,10 +2678,10 @@ void Document::createBackup(KConfig* config) { m_backupPathValue = qConfig.backupDirPath + url().fileName() + "." + hashFilePath(url().url()); } - QString backupPathValueURL = KURL::fromPathOrURL(m_backupPathValue).url(); + TQString backupPathValueURL = KURL::fromPathOrURL(m_backupPathValue).url(); //the encoding used for the current document - QString encoding = quantaApp->defaultEncoding(); + TQString encoding = quantaApp->defaultEncoding(); if (encodingIf) encoding = encodingIf->encoding(); if (encoding.isEmpty()) @@ -2689,8 +2689,8 @@ void Document::createBackup(KConfig* config) //creates an entry string in quantarc if it does not exist yet config->setGroup("General Options"); - QStringList backedupFilesEntryList = QuantaCommon::readPathListEntry(config, "List of backedup files"); //the files that were backedup - QStringList autosavedFilesEntryList = QuantaCommon::readPathListEntry(config, "List of autosaved files"); //the list of actual backup files inside $KDEHOME/share/apps/quanta/backups + 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.contains(backupPathValueURL)) //not yet backed up, add an entry for this file { autosavedFilesEntryList.append(backupPathValueURL); @@ -2704,11 +2704,11 @@ void Document::createBackup(KConfig* config) } //creates a copy of this specific document - QFile file(m_backupPathValue); + TQFile file(m_backupPathValue); if (file.open(IO_WriteOnly)) { - QTextStream stream(&file); - stream.setCodec(QTextCodec::codecForName(encoding)); + TQTextStream stream(&file); + stream.setCodec(TQTextCodec::codecForName(encoding)); stream << editIf->text(); file.close(); } @@ -2717,13 +2717,13 @@ void Document::createBackup(KConfig* config) /** if there is no more need for a backup copy then remove it */ void Document::removeBackup(KConfig *config) { - QString backupPathValueURL = KURL::fromPathOrURL(m_backupPathValue).url(); + TQString backupPathValueURL = KURL::fromPathOrURL(m_backupPathValue).url(); config->reparseConfiguration(); config->setGroup("General Options"); - QStringList backedupFilesEntryList = QuantaCommon::readPathListEntry(config, "List of backedup files"); - QStringList autosavedFilesEntryList = QuantaCommon::readPathListEntry(config, "List of autosaved files"); + TQStringList backedupFilesEntryList = QuantaCommon::readPathListEntry(config, "List of backedup files"); + TQStringList autosavedFilesEntryList = QuantaCommon::readPathListEntry(config, "List of autosaved files"); autosavedFilesEntryList.remove(backupPathValueURL); config->writePathEntry("List of autosaved files", autosavedFilesEntryList); @@ -2731,22 +2731,22 @@ void Document::removeBackup(KConfig *config) config->writePathEntry("List of backedup files", backedupFilesEntryList); config->sync(); - if(QFile::exists(m_backupPathValue)) - QFile::remove(m_backupPathValue); + if(TQFile::exists(m_backupPathValue)) + TQFile::remove(m_backupPathValue); } /** creates a string by hashing a bit the path string of this document */ -QString Document::hashFilePath(const QString& p) +TQString Document::hashFilePath(const TQString& p) { switch(p.length()) { case 1: { int c = int(p[0]); - return QString::number(c, 10) + "P" + qConfig.quantaPID; + return TQString::number(c, 10) + "P" + qConfig.quantaPID; } case 2: { int c = int(p[1]) * 2; - return QString::number(c, 10) + "P" + qConfig.quantaPID; + return TQString::number(c, 10) + "P" + qConfig.quantaPID; } default: { @@ -2759,9 +2759,9 @@ QString Document::hashFilePath(const QString& p) sign *= -1; } if( sum >= 0 ) - return QString::number(sum, 10) + "P" + qConfig.quantaPID; + return TQString::number(sum, 10) + "P" + qConfig.quantaPID; else - return QString::number(sum*(-1), 10) + "N" + qConfig.quantaPID; + return TQString::number(sum*(-1), 10) + "N" + qConfig.quantaPID; } } } @@ -2793,7 +2793,7 @@ void Document::convertCase() progressDlg.setLabel(i18n("Changing tag and attribute case. This may take some time, depending on the document complexity.")); progressDlg.setAllowCancel(false); progressDlg.show(); - kapp->eventLoop()->processEvents( QEventLoop::ExcludeUserInput | QEventLoop::ExcludeSocketNotifiers); + kapp->eventLoop()->processEvents( TQEventLoop::ExcludeUserInput | TQEventLoop::ExcludeSocketNotifiers); KProgress *pBar = progressDlg.progressBar(); pBar->setValue(0); pBar->setTotalSteps(nodeNum); @@ -2826,7 +2826,7 @@ void Document::convertCase() ec = bc + node->tag->name.length(); editIf->removeText(bl, bc, bl, ec); viewCursorIf->setCursorPositionReal(bl, bc); - QString newName = node->tag->name; + TQString newName = node->tag->name; if (tagCase == 1) newName = newName.lower(); else if (tagCase == 2) @@ -2837,7 +2837,7 @@ void Document::convertCase() } if (attrCase != 0) { - QString newName; + TQString newName; for (int i = 0; i < node->tag->attrCount(); i++) { if(editIfExt) @@ -2864,18 +2864,18 @@ void Document::convertCase() } } -void Document::open(const KURL &url, const QString &encoding) +void Document::open(const KURL &url, const TQString &encoding) { if (encodingIf) { encodingIf->setEncoding(encoding); m_encoding = encoding; - m_codec = QTextCodec::codecForName(m_encoding); + m_codec = TQTextCodec::codecForName(m_encoding); } - connect(m_doc, SIGNAL(completed()), this, SLOT(slotOpeningCompleted())); - connect(m_doc, SIGNAL(canceled(const QString&)), this, SLOT(slotOpeningFailed(const QString&))); + connect(m_doc, TQT_SIGNAL(completed()), this, TQT_SLOT(slotOpeningCompleted())); + connect(m_doc, TQT_SIGNAL(canceled(const TQString&)), this, TQT_SLOT(slotOpeningFailed(const TQString&))); if (!openURL(url)) - slotOpeningFailed(QString::null); + slotOpeningFailed(TQString::null); if (!url.isLocalFile()) { QExtFileInfo internalFileInfo; @@ -2888,38 +2888,38 @@ void Document::slotOpeningCompleted() KURL u = url(); if (!u.isLocalFile()) { - m_modifTime = QDateTime(); + m_modifTime = TQDateTime(); qApp->exit_loop(); } else { fileWatcher->addFile(u.path()); - m_modifTime = QFileInfo(u.path()).lastModified(); + m_modifTime = TQFileInfo(u.path()).lastModified(); // kdDebug(24000) << "addFile[Document::open]: " << u.path() << endl; } - disconnect(m_doc, SIGNAL(completed()), this, SLOT(slotOpeningCompleted())); - disconnect(m_doc, SIGNAL(canceled(const QString&)), this, SLOT(slotOpeningFailed(const QString&))); + disconnect(m_doc, TQT_SIGNAL(completed()), this, TQT_SLOT(slotOpeningCompleted())); + disconnect(m_doc, TQT_SIGNAL(canceled(const TQString&)), this, TQT_SLOT(slotOpeningFailed(const TQString&))); m_dirty = false; m_view->setFocus(); processDTD(); emit openingCompleted(u); } -void Document::slotOpeningFailed(const QString &errorMessage) +void Document::slotOpeningFailed(const TQString &errorMessage) { m_md5sum = ""; Q_UNUSED(errorMessage); //TODO: append the error message to our own error message if (!url().isLocalFile()) qApp->exit_loop(); - disconnect(m_doc, SIGNAL(completed()), this, SLOT(slotOpeningCompleted())); - disconnect(m_doc, SIGNAL(canceled(const QString&)), this, SLOT(slotOpeningFailed(const QString&))); + disconnect(m_doc, TQT_SIGNAL(completed()), this, TQT_SLOT(slotOpeningCompleted())); + disconnect(m_doc, TQT_SIGNAL(canceled(const TQString&)), this, TQT_SLOT(slotOpeningFailed(const TQString&))); emit openingFailed(url()); } -void Document::processDTD(const QString& documentType) +void Document::processDTD(const TQString& documentType) { - QString foundName; - QString projectDTD = Project::ref()->defaultDTD(); + TQString foundName; + TQString projectDTD = Project::ref()->defaultDTD(); setDTDIdentifier(projectDTD); Tag *tag = 0L; if (documentType.isEmpty()) @@ -2931,8 +2931,8 @@ void Document::processDTD(const QString& documentType) KDialogBase dlg(this, 0L, true, i18n("DTD Selector"), KDialogBase::Ok | KDialogBase::Cancel); DTDSelectDialog *dtdWidget = new DTDSelectDialog(&dlg); dlg.setMainWidget(dtdWidget); - QStringList lst = DTDs::ref()->nickNameList(true); - QString foundNickName = DTDs::ref()->getDTDNickNameFromName(foundName); + TQStringList lst = DTDs::ref()->nickNameList(true); + TQString foundNickName = DTDs::ref()->getDTDNickNameFromName(foundName); for (uint i = 0; i < lst.count(); i++) { dtdWidget->dtdCombo->insertItem(lst[i]); @@ -2946,14 +2946,14 @@ void Document::processDTD(const QString& documentType) if (!DTDs::ref()->find(foundName)) { //try to find the closest matching DTD - QString s = foundName.lower(); + TQString s = foundName.lower(); uint spaceNum = s.contains(' '); - QStringList dtdList = DTDs::ref()->nameList(); - QStringList lastDtdList; + TQStringList dtdList = DTDs::ref()->nameList(); + TQStringList lastDtdList; for (uint i = 0; i <= spaceNum && !dtdList.empty(); i++) { lastDtdList = dtdList; - QStringList::Iterator strIt = dtdList.begin(); + TQStringList::Iterator strIt = dtdList.begin(); while (strIt != dtdList.end()) { if (!(*strIt).startsWith(s.section(' ', 0, i))) @@ -2969,7 +2969,7 @@ void Document::processDTD(const QString& documentType) for (uint i = 0; i <= spaceNum && !dtdList.empty(); i++) { lastDtdList = dtdList; - QStringList::Iterator strIt = dtdList.begin(); + TQStringList::Iterator strIt = dtdList.begin(); while (strIt != dtdList.end()) { if (!(*strIt).endsWith(s.section(' ', -(i+1), -1))) @@ -2990,7 +2990,7 @@ void Document::processDTD(const QString& documentType) // dlg->dtdCombo->insertItem(i18n("Create New DTD Info")); dtdWidget->messageLabel->setText(i18n("This DTD is not known for Quanta. Choose a DTD or create a new one.")); dtdWidget->currentDTD->setText(DTDs::ref()->getDTDNickNameFromName(foundName)); - QString projectDTDNickName = DTDs::ref()->getDTDNickNameFromName(projectDTD); + TQString projectDTDNickName = DTDs::ref()->getDTDNickNameFromName(projectDTD); for (int i = 0; i < dtdWidget->dtdCombo->count(); i++) { if (dtdWidget->dtdCombo->text(i) == projectDTDNickName) @@ -3021,7 +3021,7 @@ void Document::processDTD(const QString& documentType) } else //DOCTYPE not found in file { KURL u = url(); - QString dtdId = DTDs::ref()->DTDforURL(u)->name; + TQString dtdId = DTDs::ref()->DTDforURL(u)->name; // if (dtdId == "empty") { const DTDStruct * dtd = DTDs::ref()->find(projectDTD); @@ -3052,7 +3052,7 @@ void Document::processDTD(const QString& documentType) /** Called when a file on the disk has changed. */ -void Document::slotFileDirty(const QString& fileName) +void Document::slotFileDirty(const TQString& fileName) { if ( url().path() == fileName && !dirty() ) { @@ -3081,7 +3081,7 @@ void Document::resetDTEPs() m_DTEPList.append(defaultDTD()->name); } -void Document::addDTEP(const QString &dtepName) +void Document::addDTEP(const TQString &dtepName) { if (m_DTEPList.contains(dtepName) == 0) { @@ -3089,7 +3089,7 @@ void Document::addDTEP(const QString &dtepName) } } -QStringList Document::groupsForDTEPs() +TQStringList Document::groupsForDTEPs() { if (m_groupsForDTEPs.isEmpty()) return m_DTEPList; @@ -3097,16 +3097,16 @@ QStringList Document::groupsForDTEPs() return m_groupsForDTEPs; } -QString Document::annotationText(uint line) +TQString Document::annotationText(uint line) { - QMap >::Iterator it = m_annotations.find(line); + TQMap >::Iterator it = m_annotations.find(line); if (it != m_annotations.end()) return it.data().first; else - return QString::null; + return TQString::null; } -void Document::setAnnotationText(uint line, const QString& text) +void Document::setAnnotationText(uint line, const TQString& text) { if (text.isEmpty()) { @@ -3115,16 +3115,16 @@ void Document::setAnnotationText(uint line, const QString& text) markIf->removeMark(line, KTextEditor::MarkInterface::markType08); } else { - m_annotations.insert(line, qMakePair(text, QString(""))); + m_annotations.insert(line, qMakePair(text, TQString(""))); if (markIf) markIf->setMark(line, KTextEditor::MarkInterface::markType08); uint line, column; viewCursorIf->cursorPositionReal(&line, &column); viewCursorIf->setCursorPositionReal(line, 0); const DTDStruct *dtd = currentDTD(true); - QString commentBegin = ""; - QString commentEnd = ""; - for (QMap::ConstIterator it = dtd->comments.constBegin(); it != dtd->comments.constEnd(); ++it) + TQString commentBegin = ""; + TQString commentEnd = ""; + for (TQMap::ConstIterator it = dtd->comments.constBegin(); it != dtd->comments.constEnd(); ++it) { commentBegin = it.key(); commentEnd = it.data(); @@ -3143,15 +3143,15 @@ void Document::setAnnotationText(uint line, const QString& text) commentEnd = "*/"; } } - QString s = "@annotation: " + text; + TQString s = "@annotation: " + text; s.prepend(commentBegin + " "); s.append(" " + commentEnd + "\n"); insertText(s, true, true); - emit showAnnotation(line, "", qMakePair(text, QString(""))); + emit showAnnotation(line, "", qMakePair(text, TQString(""))); } } -void Document::addAnnotation(uint line, const QPair& annotation) +void Document::addAnnotation(uint line, const QPair& annotation) { m_annotations.insert(line, annotation); if (markIf) @@ -3163,7 +3163,7 @@ void Document::clearAnnotations() { if (markIf) { - QPtrList m = markIf->marks(); + TQPtrList m = markIf->marks(); for (uint i=0; i < m.count(); i++) markIf->removeMark( m.at(i)->line, KTextEditor::MarkInterface::markType08 ); } @@ -3175,7 +3175,7 @@ bool Document::openURL(const KURL& url) m_md5sum = ""; if (url.isLocalFile()) { - QFile f(url.path()); + TQFile f(url.path()); if (f.open(IO_ReadOnly)) { const char* c = ""; -- cgit v1.2.1