diff options
Diffstat (limited to 'lib/kotext/KoAutoFormat.cpp')
-rw-r--r-- | lib/kotext/KoAutoFormat.cpp | 524 |
1 files changed, 262 insertions, 262 deletions
diff --git a/lib/kotext/KoAutoFormat.cpp b/lib/kotext/KoAutoFormat.cpp index 4e0ad7bb..b6529b8f 100644 --- a/lib/kotext/KoAutoFormat.cpp +++ b/lib/kotext/KoAutoFormat.cpp @@ -40,43 +40,43 @@ #include <kcompletion.h> #include <kcalendarsystem.h> -#include <qfile.h> -#include <qlabel.h> -#include <qtooltip.h> -#include <qwhatsthis.h> -#include <qdom.h> -#include <qregexp.h> +#include <tqfile.h> +#include <tqlabel.h> +#include <tqtooltip.h> +#include <tqwhatsthis.h> +#include <tqdom.h> +#include <tqregexp.h> -KoCompletionBox::KoCompletionBox( QWidget * parent, const char * name, WFlags f) - : QLabel(parent,name,f) +KoCompletionBox::KoCompletionBox( TQWidget * tqparent, const char * name, WFlags f) + : TQLabel(tqparent,name,f) { - setBackgroundColor(QColor("#FFFFE6")); - setFocusPolicy(QWidget::NoFocus); - setFrameShape(QFrame::Box); + setBackgroundColor(TQColor("#FFFFE6")); + setFocusPolicy(TQ_NoFocus); + setFrameShape(TQFrame::Box); } KoCompletionBox::~KoCompletionBox() { } -void KoCompletionBox::mousePressEvent( QMouseEvent *) +void KoCompletionBox::mousePressEvent( TQMouseEvent *) { hide(); } -QString& KoCompletionBox::lastWord() +TQString& KoCompletionBox::lastWord() { return m_lastWord; } -void KoCompletionBox::setLastWord( QString const &lastword) +void KoCompletionBox::setLastWord( TQString const &lastword) { m_lastWord = lastword; } -KoAutoFormatEntry::KoAutoFormatEntry(const QString& replace) - : m_replace( replace ) +KoAutoFormatEntry::KoAutoFormatEntry(const TQString& tqreplace) + : m_tqreplace( tqreplace ) { m_formatOptions= 0L; } @@ -120,7 +120,7 @@ KoAutoFormat::KoAutoFormat( KoDocument *_doc, KoVariableCollection *_varCollecti : m_doc( _doc ), m_varCollection(_varCollection), m_varFormatCollection(_varFormatCollection), - m_autoFormatLanguage( QString::null), + m_autoFormatLanguage( TQString()), m_configRead( false ), m_convertUpperCase( false ), m_convertUpperUpper( false ), m_advancedAutoCorrect( true ), @@ -234,10 +234,10 @@ KoAutoFormat::~KoAutoFormat() void KoAutoFormat::updateMaxWords() { - QStringList list = m_listCompletion->items(); - for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) + TQStringList list = m_listCompletion->items(); + for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) { - QString tmp = *it; + TQString tmp = *it; uint maxword = 1; for (uint i=0; i < (uint)tmp.length(); i++) @@ -267,7 +267,7 @@ void KoAutoFormat::readConfig(bool force) KConfigGroupSaver cgs( config, "AutoFormat" ); //when we force don't load format language. if ( !force) - m_autoFormatLanguage = config->readEntry("formatLanguage", QString::null); + m_autoFormatLanguage = config->readEntry("formatLanguage", TQString()); m_convertUpperCase = config->readBoolEntry( "ConvertUpperCase", false ); m_convertUpperUpper = config->readBoolEntry( "ConvertUpperUpper", false ); @@ -283,8 +283,8 @@ void KoAutoFormat::readConfig(bool force) m_removeSpaceBeginEndLine = config->readBoolEntry("RemoveSpaceBeginEndLine", true); m_useBulletStyle = config->readBoolEntry("UseBulletStyle",false); - QString tmp = config->readEntry( "BulletStyle", "" ); - m_bulletStyle = tmp.isEmpty() ? QChar() : tmp[0]; + TQString tmp = config->readEntry( "BulletStyle", "" ); + m_bulletStyle = tmp.isEmpty() ? TQChar() : tmp[0]; m_autoChangeFormat = config->readBoolEntry( "AutoChangeFormat", false ); @@ -293,14 +293,14 @@ void KoAutoFormat::readConfig(bool force) m_useAutoNumberStyle = config->readBoolEntry( "AutoNumberStyle", false ); - QString beginDoubleQuote = config->readEntry( "TypographicQuotesBegin" ); - QString endDoubleQuote = config->readEntry( "TypographicQuotesEnd" ); + TQString beginDoubleQuote = config->readEntry( "TypographicQuotesBegin" ); + TQString endDoubleQuote = config->readEntry( "TypographicQuotesEnd" ); - m_typographicDoubleQuotes.replace = config->readBoolEntry( "TypographicQuotesEnabled", false ); + m_typographicDoubleQuotes.tqreplace = config->readBoolEntry( "TypographicQuotesEnabled", false ); - QString begin = config->readEntry( "TypographicSimpleQuotesBegin" ); - QString end = config->readEntry( "TypographicSimpleQuotesEnd" ); - m_typographicSimpleQuotes.replace = config->readBoolEntry( "TypographicSimpleQuotesEnabled", false ); + TQString begin = config->readEntry( "TypographicSimpleQuotesBegin" ); + TQString end = config->readEntry( "TypographicSimpleQuotesEnd" ); + m_typographicSimpleQuotes.tqreplace = config->readBoolEntry( "TypographicSimpleQuotesEnabled", false ); m_bAutoSuperScript = config->readBoolEntry( "AutoSuperScript", true ); @@ -335,7 +335,7 @@ void KoAutoFormat::readConfig(bool force) if( beginDoubleQuote.isEmpty()) { if( m_typographicDefaultDoubleQuotes.begin.isNull()) - m_typographicDoubleQuotes.begin = QChar('�'); + m_typographicDoubleQuotes.begin = TQChar('�'); else m_typographicDoubleQuotes.begin = m_typographicDefaultDoubleQuotes.begin; } @@ -345,14 +345,14 @@ void KoAutoFormat::readConfig(bool force) if( endDoubleQuote.isEmpty() ) { if( m_typographicDefaultDoubleQuotes.end.isNull()) - m_typographicDoubleQuotes.end = QChar('�'); + m_typographicDoubleQuotes.end = TQChar('�'); else m_typographicDoubleQuotes.end = m_typographicDefaultDoubleQuotes.end; } else m_typographicDoubleQuotes.end = endDoubleQuote[0]; - m_typographicDoubleQuotes.replace = m_typographicDoubleQuotes.replace + m_typographicDoubleQuotes.tqreplace = m_typographicDoubleQuotes.tqreplace && !m_typographicDoubleQuotes.begin.isNull() && !m_typographicDoubleQuotes.end.isNull(); @@ -360,7 +360,7 @@ void KoAutoFormat::readConfig(bool force) if( begin.isEmpty()) { if( m_typographicDefaultSimpleQuotes.begin.isNull()) - m_typographicSimpleQuotes.begin = QChar('\''); + m_typographicSimpleQuotes.begin = TQChar('\''); else m_typographicSimpleQuotes.begin = m_typographicDefaultSimpleQuotes.begin; } @@ -370,14 +370,14 @@ void KoAutoFormat::readConfig(bool force) if( end.isEmpty() ) { if( m_typographicDefaultSimpleQuotes.end.isNull()) - m_typographicSimpleQuotes.end = QChar('\''); + m_typographicSimpleQuotes.end = TQChar('\''); else m_typographicSimpleQuotes.end = m_typographicDefaultSimpleQuotes.end; } else m_typographicSimpleQuotes.end = end[0]; - m_typographicSimpleQuotes.replace = m_typographicSimpleQuotes.replace + m_typographicSimpleQuotes.tqreplace = m_typographicSimpleQuotes.tqreplace && !m_typographicSimpleQuotes.end.isNull() && !m_typographicSimpleQuotes.begin.isNull(); @@ -392,10 +392,10 @@ void KoAutoFormat::readAutoCorrectConfig() { Q_ASSERT( m_entries.isEmpty() ); // readConfig is only called once... KLocale klocale(m_doc->instance()->instanceName()); - QString kdelang = klocale.languageList().front(); - kdelang.remove( QRegExp( "@.*" ) ); + TQString kdelang = klocale.languageList().front(); + kdelang.remove( TQRegExp( "@.*" ) ); kdDebug(32500) << "KoAutoFormat: m_autoFormatLanguage=" << m_autoFormatLanguage << " kdelang=" << kdelang << endl; - QString fname; + TQString fname; if ( !m_autoFormatLanguage.isEmpty() ) { fname = locate( "data", "koffice/autocorrect/" + m_autoFormatLanguage + ".xml", m_doc->instance() ); @@ -404,9 +404,9 @@ void KoAutoFormat::readAutoCorrectConfig() { if ( fname.isEmpty() && !kdelang.isEmpty() ) fname = locate( "data", "koffice/autocorrect/" + kdelang + ".xml", m_doc->instance() ); - if ( fname.isEmpty() && kdelang.contains("_") ) + if ( fname.isEmpty() && kdelang.tqcontains("_") ) { - kdelang.remove( QRegExp( "_.*" ) ); + kdelang.remove( TQRegExp( "_.*" ) ); fname = locate( "data", "koffice/autocorrect/" + kdelang + ".xml", m_doc->instance() ); } if ( fname.isEmpty() ) @@ -414,59 +414,59 @@ void KoAutoFormat::readAutoCorrectConfig() } if ( fname.isEmpty() ) return; - QFile xmlFile(fname); + TQFile xmlFile(fname); if(!xmlFile.open(IO_ReadOnly)) return; - QDomDocument doc; + TQDomDocument doc; if(!doc.setContent(&xmlFile)) return; if(doc.doctype().name() != "autocorrection") { //return; } - QDomElement de=doc.documentElement(); + TQDomElement de=doc.documentElement(); loadAutoCorrection( de ); - QDomElement upper = de.namedItem( "UpperCaseExceptions" ).toElement(); + TQDomElement upper = de.namedItem( "UpperCaseExceptions" ).toElement(); if(!upper.isNull()) { - QDomNodeList nl = upper.childNodes(); + TQDomNodeList nl = upper.childNodes(); for(uint i = 0; i < nl.count(); i++) { m_upperCaseExceptions+= nl.item(i).toElement().attribute("exception"); } } - QDomElement twoUpper = de.namedItem( "TwoUpperLetterExceptions" ).toElement(); + TQDomElement twoUpper = de.namedItem( "TwoUpperLetterExceptions" ).toElement(); if(!twoUpper.isNull()) { - QDomNodeList nl = twoUpper.childNodes(); + TQDomNodeList nl = twoUpper.childNodes(); for(uint i = 0; i < nl.count(); i++) { m_twoUpperLetterException+= nl.item(i).toElement().attribute("exception"); } } - QDomElement superScript = de.namedItem( "SuperScript" ).toElement(); + TQDomElement superScript = de.namedItem( "SuperScript" ).toElement(); if(!superScript.isNull()) { - QDomNodeList nl = superScript.childNodes(); + TQDomNodeList nl = superScript.childNodes(); for(uint i = 0; i < nl.count() ; i++) { //bug in qmap we overwrite = false doesn't work //so we can't add multiple "othernb" - m_superScriptEntries.insert( nl.item(i).toElement().attribute("find"), KoAutoFormatEntry(nl.item(i).toElement().attribute("super")),FALSE ); + m_superScriptEntries.insert( nl.item(i).toElement().attribute("tqfind"), KoAutoFormatEntry(nl.item(i).toElement().attribute("super")),FALSE ); } } - QDomElement doubleQuote = de.namedItem( "DoubleQuote" ).toElement(); + TQDomElement doubleQuote = de.namedItem( "DoubleQuote" ).toElement(); if(!doubleQuote.isNull()) { - QDomElement childItem = doubleQuote.namedItem("doublequote").toElement(); + TQDomElement childItem = doubleQuote.namedItem("doublequote").toElement(); if ( !childItem.isNull() ) { - QString attr = childItem.attribute( "begin" ); + TQString attr = childItem.attribute( "begin" ); if ( !attr.isEmpty() && attr[0] != 0 ) m_typographicDefaultDoubleQuotes.begin = attr[0]; attr = childItem.attribute( "end" ); @@ -474,13 +474,13 @@ void KoAutoFormat::readAutoCorrectConfig() m_typographicDefaultDoubleQuotes.end = attr[0]; } } - QDomElement simpleQuote = de.namedItem( "SimpleQuote" ).toElement(); + TQDomElement simpleQuote = de.namedItem( "SimpleQuote" ).toElement(); if(!simpleQuote.isNull()) { - QDomElement childItem = simpleQuote.namedItem("simplequote").toElement(); + TQDomElement childItem = simpleQuote.namedItem("simplequote").toElement(); if ( !childItem.isNull() ) { - QString attr = childItem.attribute( "begin" ); + TQString attr = childItem.attribute( "begin" ); if ( !attr.isEmpty() && attr[0] != 0 ) m_typographicDefaultSimpleQuotes.begin = attr[0]; attr = childItem.attribute( "end" ); @@ -492,32 +492,32 @@ void KoAutoFormat::readAutoCorrectConfig() void KoAutoFormat::loadAllLanguagesAutoCorrection() { - QString fname = locate( "data", "koffice/autocorrect/all_languages.xml", m_doc->instance() ); + TQString fname = locate( "data", "koffice/autocorrect/all_languages.xml", m_doc->instance() ); if ( fname.isEmpty() ) return; - QFile xmlFile( fname ); + TQFile xmlFile( fname ); if(xmlFile.open(IO_ReadOnly)) { - QDomDocument doc; + TQDomDocument doc; if(!doc.setContent(&xmlFile)) { return; } if(doc.doctype().name() != "autocorrection") { //return; } - QDomElement de=doc.documentElement(); + TQDomElement de=doc.documentElement(); loadAutoCorrection( de, true ); xmlFile.close(); } } -void KoAutoFormat::loadAutoCorrection( const QDomElement & _de, bool _allLanguages ) +void KoAutoFormat::loadAutoCorrection( const TQDomElement & _de, bool _allLanguages ) { - QDomElement item = _de.namedItem( "items" ).toElement(); + TQDomElement item = _de.namedItem( "items" ).toElement(); if(!item.isNull()) { - QDomNodeList nl = item.childNodes(); + TQDomNodeList nl = item.childNodes(); m_maxFindLength=nl.count(); for(uint i = 0; i < m_maxFindLength; i++) { loadEntry( nl.item(i).toElement(), _allLanguages); @@ -525,9 +525,9 @@ void KoAutoFormat::loadAutoCorrection( const QDomElement & _de, bool _allLanguag } } -void KoAutoFormat::loadEntry( const QDomElement &nl, bool _allLanguages) +void KoAutoFormat::loadEntry( const TQDomElement &nl, bool _allLanguages) { - KoAutoFormatEntry *tmp =new KoAutoFormatEntry(nl.attribute("replace")); + KoAutoFormatEntry *tmp =new KoAutoFormatEntry(nl.attribute("tqreplace")); if ( nl.hasAttribute("FONT")) { tmp->createNewEntryContext(); @@ -544,7 +544,7 @@ void KoAutoFormat::loadEntry( const QDomElement &nl, bool _allLanguages) { tmp->createNewEntryContext(); tmp->formatEntryContext()->m_optionsMask |= KoSearchContext::Bold; - QString value = nl.attribute("BOLD"); + TQString value = nl.attribute("BOLD"); if ( value.toInt() == 1 ) tmp->formatEntryContext()->m_options |= KoSearchContext::Bold; } @@ -552,7 +552,7 @@ void KoAutoFormat::loadEntry( const QDomElement &nl, bool _allLanguages) { tmp->createNewEntryContext(); tmp->formatEntryContext()->m_optionsMask |= KoSearchContext::Italic; - QString value = nl.attribute("ITALIC"); + TQString value = nl.attribute("ITALIC"); if ( value.toInt() == 1 ) tmp->formatEntryContext()->m_options |= KoSearchContext::Italic; } @@ -560,7 +560,7 @@ void KoAutoFormat::loadEntry( const QDomElement &nl, bool _allLanguages) { tmp->createNewEntryContext(); tmp->formatEntryContext()->m_optionsMask |= KoSearchContext::Underline; - QString value = nl.attribute("UNDERLINE"); + TQString value = nl.attribute("UNDERLINE"); if ( value =="single" ) tmp->formatEntryContext()->m_underline = KoTextFormat::U_SIMPLE; else if ( value =="double" ) @@ -574,7 +574,7 @@ void KoAutoFormat::loadEntry( const QDomElement &nl, bool _allLanguages) { tmp->createNewEntryContext(); tmp->formatEntryContext()->m_optionsMask |= KoSearchContext::StrikeOut; - QString value = nl.attribute("STRIKEOUT"); + TQString value = nl.attribute("STRIKEOUT"); if ( value =="single" ) tmp->formatEntryContext()->m_strikeOut = KoTextFormat::S_SIMPLE; else if ( value =="double" ) @@ -588,7 +588,7 @@ void KoAutoFormat::loadEntry( const QDomElement &nl, bool _allLanguages) { tmp->createNewEntryContext(); tmp->formatEntryContext()->m_optionsMask |= KoSearchContext::VertAlign; - QString value = nl.attribute("VERTALIGN"); + TQString value = nl.attribute("VERTALIGN"); tmp->formatEntryContext()->m_vertAlign=static_cast<KoTextFormat::VerticalAlignment>( value.toInt() ); } @@ -596,20 +596,20 @@ void KoAutoFormat::loadEntry( const QDomElement &nl, bool _allLanguages) { tmp->createNewEntryContext(); tmp->formatEntryContext()->m_optionsMask |= KoSearchContext::Color; - QColor col( nl.attribute("TEXTCOLOR" )); + TQColor col( nl.attribute("TEXTCOLOR" )); tmp->formatEntryContext()->m_color = col; } if ( nl.hasAttribute("TEXTBGCOLOR" )) { tmp->createNewEntryContext(); tmp->formatEntryContext()->m_optionsMask |= KoSearchContext::BgColor; - QColor col( nl.attribute("TEXTBGCOLOR" )); + TQColor col( nl.attribute("TEXTBGCOLOR" )); tmp->formatEntryContext()->m_backGroundColor = col; } if ( !_allLanguages ) - m_entries.insert( nl.attribute("find"), tmp ); + m_entries.insert( nl.attribute("tqfind"), tmp ); else - m_allLanguages.insert( nl.attribute("find"), tmp ); + m_allLanguages.insert( nl.attribute("tqfind"), tmp ); } @@ -626,12 +626,12 @@ void KoAutoFormat::saveConfig() config->writeEntry( "includeTwoLetterException", m_includeTwoUpperLetterException ); config->writeEntry( "includeAbbreviation", m_includeAbbreviation ); - config->writeEntry( "TypographicQuotesBegin", QString( m_typographicDoubleQuotes.begin ) ); - config->writeEntry( "TypographicQuotesEnd", QString( m_typographicDoubleQuotes.end ) ); - config->writeEntry( "TypographicQuotesEnabled", m_typographicDoubleQuotes.replace ); - config->writeEntry( "TypographicSimpleQuotesBegin", QString( m_typographicSimpleQuotes.begin ) ); - config->writeEntry( "TypographicSimpleQuotesEnd", QString( m_typographicSimpleQuotes.end ) ); - config->writeEntry( "TypographicSimpleQuotesEnabled", m_typographicSimpleQuotes.replace ); + config->writeEntry( "TypographicQuotesBegin", TQString( m_typographicDoubleQuotes.begin ) ); + config->writeEntry( "TypographicQuotesEnd", TQString( m_typographicDoubleQuotes.end ) ); + config->writeEntry( "TypographicQuotesEnabled", m_typographicDoubleQuotes.tqreplace ); + config->writeEntry( "TypographicSimpleQuotesBegin", TQString( m_typographicSimpleQuotes.begin ) ); + config->writeEntry( "TypographicSimpleQuotesEnd", TQString( m_typographicSimpleQuotes.end ) ); + config->writeEntry( "TypographicSimpleQuotesEnabled", m_typographicSimpleQuotes.tqreplace ); config->writeEntry( "AdvancedAutocorrect", m_advancedAutoCorrect ); config->writeEntry( "AutoCorrectionWithFormat", m_bAutoCorrectionWithFormat ); @@ -643,7 +643,7 @@ void KoAutoFormat::saveConfig() config->writeEntry( "RemoveSpaceBeginEndLine",m_removeSpaceBeginEndLine ); config->writeEntry( "UseBulletStyle", m_useBulletStyle); - config->writeEntry( "BulletStyle", QString(m_bulletStyle)); + config->writeEntry( "BulletStyle", TQString(m_bulletStyle)); config->writeEntry( "AutoChangeFormat", m_autoChangeFormat); @@ -663,28 +663,28 @@ void KoAutoFormat::saveConfig() config->writeEntry( "CompletionKeyAction", ( int )m_keyCompletionAction ); config->setGroup( "AutoFormatEntries" ); - QDictIterator<KoAutoFormatEntry> it( m_entries ); + TQDictIterator<KoAutoFormatEntry> it( m_entries ); //refresh m_maxFindLength m_maxFindLength=0; - QDomDocument doc("autocorrection"); + TQDomDocument doc("autocorrection"); - QDomElement begin = doc.createElement( "Word" ); + TQDomElement begin = doc.createElement( "Word" ); doc.appendChild( begin ); - QDomElement items; + TQDomElement items; items = doc.createElement("items"); - QDomElement data; + TQDomElement data; for ( ; it.current() ; ++it ) { items.appendChild(saveEntry( it, doc)); - //m_maxFindLength=QMAX(m_maxFindLength,it.currentKey().length()); + //m_maxFindLength=TQMAX(m_maxFindLength,it.currentKey().length()); } buildMaxLen(); begin.appendChild(items); - QDomElement upper; + TQDomElement upper; upper = doc.createElement("UpperCaseExceptions"); - for ( QStringList::Iterator it = m_upperCaseExceptions.begin(); it != m_upperCaseExceptions.end();++it ) + for ( TQStringList::Iterator it = m_upperCaseExceptions.begin(); it != m_upperCaseExceptions.end();++it ) { data = doc.createElement("word"); data.setAttribute("exception",(*it) ); @@ -692,10 +692,10 @@ void KoAutoFormat::saveConfig() } begin.appendChild(upper); - QDomElement twoUpper; + TQDomElement twoUpper; twoUpper = doc.createElement("TwoUpperLetterExceptions"); - for ( QStringList::Iterator it = m_twoUpperLetterException.begin(); it != m_twoUpperLetterException.end();++it ) + for ( TQStringList::Iterator it = m_twoUpperLetterException.begin(); it != m_twoUpperLetterException.end();++it ) { data = doc.createElement("word"); data.setAttribute("exception",(*it) ); @@ -703,35 +703,35 @@ void KoAutoFormat::saveConfig() } begin.appendChild(twoUpper); - QDomElement super; + TQDomElement super; super = doc.createElement("SuperScript"); KoAutoFormatEntryMap::Iterator it2 = m_superScriptEntries.begin(); for ( ; it2 != m_superScriptEntries.end() ; ++it2 ) { data = doc.createElement("superscript"); - data.setAttribute("find", it2.key()); - data.setAttribute("super", it2.data().replace()); + data.setAttribute("tqfind", it2.key()); + data.setAttribute("super", it2.data().tqreplace()); super.appendChild(data); } begin.appendChild(super); - QDomElement doubleQuote; + TQDomElement doubleQuote; doubleQuote = doc.createElement("DoubleQuote"); data = doc.createElement("doublequote"); - data.setAttribute("begin", QString(m_typographicDefaultDoubleQuotes.begin)); - data.setAttribute("end", QString(m_typographicDefaultDoubleQuotes.end)); + data.setAttribute("begin", TQString(m_typographicDefaultDoubleQuotes.begin)); + data.setAttribute("end", TQString(m_typographicDefaultDoubleQuotes.end)); doubleQuote.appendChild(data); begin.appendChild(doubleQuote); - QDomElement simpleQuote; + TQDomElement simpleQuote; simpleQuote = doc.createElement("SimpleQuote"); data = doc.createElement("simplequote"); - data.setAttribute("begin", QString(m_typographicDefaultSimpleQuotes.begin)); - data.setAttribute("end", QString(m_typographicDefaultSimpleQuotes.end)); + data.setAttribute("begin", TQString(m_typographicDefaultSimpleQuotes.begin)); + data.setAttribute("end", TQString(m_typographicDefaultSimpleQuotes.end)); simpleQuote.appendChild(data); begin.appendChild(simpleQuote); - QFile f; + TQFile f; if ( m_autoFormatLanguage.isEmpty()) f.setName(locateLocal("data", "koffice/autocorrect/"+klocale.languageList().front() + ".xml",m_doc->instance())); else @@ -740,19 +740,19 @@ void KoAutoFormat::saveConfig() kdWarning()<<"Error during saving autoformat to " << f.name() << endl; return; } - QTextStream ts(&f); + TQTextStream ts(&f); doc.save(ts, 2); f.close(); autoFormatIsActive(); config->sync(); } -QDomElement KoAutoFormat::saveEntry( QDictIterator<KoAutoFormatEntry> _entry, QDomDocument doc) +TQDomElement KoAutoFormat::saveEntry( TQDictIterator<KoAutoFormatEntry> _entry, TQDomDocument doc) { - QDomElement data; + TQDomElement data; data = doc.createElement("item"); - data.setAttribute("find", _entry.currentKey()); - data.setAttribute("replace", _entry.current()->replace()); + data.setAttribute("tqfind", _entry.currentKey()); + data.setAttribute("tqreplace", _entry.current()->tqreplace()); if ( _entry.current()->formatEntryContext() ) { KoSearchContext *tmp = _entry.current()->formatEntryContext(); @@ -847,28 +847,28 @@ QDomElement KoAutoFormat::saveEntry( QDictIterator<KoAutoFormatEntry> _entry, QD return data; } -void KoAutoFormat::addAutoFormatEntry( const QString &key, const QString &replace ) +void KoAutoFormat::addAutoFormatEntry( const TQString &key, const TQString &tqreplace ) { - KoAutoFormatEntry *findEntry = m_entries.find( key); + KoAutoFormatEntry *findEntry = m_entries.tqfind( key); if ( findEntry ) { - if ( findEntry->replace().lower() == replace.lower() ) + if ( findEntry->tqreplace().lower() == tqreplace.lower() ) return; } - KoAutoFormatEntry *tmp = new KoAutoFormatEntry( replace ); + KoAutoFormatEntry *tmp = new KoAutoFormatEntry( tqreplace ); m_entries.insert( key, tmp ); saveConfig(); buildMaxLen(); } -QString KoAutoFormat::getLastWord(KoTextParag *parag, int const index) +TQString KoAutoFormat::getLastWord(KoTextParag *parag, int const index) { - QString lastWord; + TQString lastWord; KoTextString *s = parag->string(); for ( int i = index - 1; i >= 0; --i ) { - QChar ch = s->at( i ).c; + TQChar ch = s->at( i ).c; if ( ch.isSpace() || ch.isPunct() ) break; lastWord.prepend( ch ); @@ -876,14 +876,14 @@ QString KoAutoFormat::getLastWord(KoTextParag *parag, int const index) return lastWord; } -QString KoAutoFormat::getLastWord(const int max_words, KoTextParag *parag, int const index) +TQString KoAutoFormat::getLastWord(const int max_words, KoTextParag *parag, int const index) { - QString lastWord; + TQString lastWord; KoTextString const *s = parag->string(); int words = 0; for ( int i = index - 1; i >= 0; --i ) { - QChar ch = s->at( i ).c; + TQChar ch = s->at( i ).c; if ( ch.isSpace() || ch.isPunct() ) { ++words; @@ -895,13 +895,13 @@ QString KoAutoFormat::getLastWord(const int max_words, KoTextParag *parag, int c return lastWord; } -QString KoAutoFormat::getWordAfterSpace(KoTextParag *parag, int const index) +TQString KoAutoFormat::getWordAfterSpace(KoTextParag *parag, int const index) { - QString word; + TQString word; KoTextString *s = parag->string(); for ( int i = index - 1; i >= 0; --i ) { - QChar ch = s->at( i ).c; + TQChar ch = s->at( i ).c; if ( ch.isSpace() ) break; word.prepend( ch ); @@ -915,7 +915,7 @@ bool KoAutoFormat::doCompletion( KoTextCursor* textEditCursor, KoTextParag *para if( m_completion ) { bool part=false; - QString lastWord, word; + TQString lastWord, word; if (m_completionBox && m_completionBox->isShown() ) //word completion with the tool-tip box { word = m_completionBox->text(); @@ -923,16 +923,16 @@ bool KoAutoFormat::doCompletion( KoTextCursor* textEditCursor, KoTextParag *para } else { - QStringList wordlist, new_wordlist; + TQStringList wordlist, new_wordlist; for (uint i=1; i <= m_countMaxWords; i++ ) { lastWord = getLastWord(i, parag, index+1); wordlist += m_listCompletion->substringCompletion( lastWord ); //find all completion words that contains lastWord } uint maxlength = 0; - for ( QStringList::ConstIterator it = wordlist.begin(); it != wordlist.end(); ++it ) // several completion words were found + for ( TQStringList::ConstIterator it = wordlist.begin(); it != wordlist.end(); ++it ) // several completion words were found { - if ( (*it).startsWith( lastWord, false ) && new_wordlist.find(*it) == new_wordlist.end() ) //the completion words that begin with lastWord + if ( (*it).tqstartsWith( lastWord, false ) && new_wordlist.tqfind(*it) == new_wordlist.end() ) //the completion words that begin with lastWord { if ( (*it).length() > maxlength ) maxlength = (*it).length(); @@ -949,10 +949,10 @@ bool KoAutoFormat::doCompletion( KoTextCursor* textEditCursor, KoTextParag *para //we must extract the common part of the completions for (uint i = lastWord.length(); i<maxlength && !part; i++) //iterate through all completion words { - QChar ch = new_wordlist.first().at(i); - for (QStringList::ConstIterator it = new_wordlist.begin(); it != new_wordlist.end(); ++it ) + TQChar ch = new_wordlist.first().at(i); + for (TQStringList::ConstIterator it = new_wordlist.begin(); it != new_wordlist.end(); ++it ) { - if ( (*it).at(i).lower() != ch.lower() ) + if ( (*it).tqat(i).lower() != ch.lower() ) { word = (*it).left(i); //the completion word is truncated here //kdDebug() << "set the word completion to:" << word << endl; @@ -1026,24 +1026,24 @@ bool KoAutoFormat::doToolTipCompletion( KoTextCursor* textEditCursor, KoTextPara { if( m_completion && m_toolTipCompletion && m_completionBox && m_completionBox->isShown() ) { - if ( ( keyPressed == Qt::Key_Return && m_keyCompletionAction==Enter ) - || ( keyPressed == Qt::Key_Enter && m_keyCompletionAction==Enter ) - || ( keyPressed == Qt::Key_Tab && m_keyCompletionAction==Tab ) - || ( keyPressed == Qt::Key_Space && m_keyCompletionAction==Space ) - || ( keyPressed == Qt::Key_End && m_keyCompletionAction==End ) - || ( keyPressed == Qt::Key_Right && m_keyCompletionAction==Right )) + if ( ( keyPressed == TQt::Key_Return && m_keyCompletionAction==Enter ) + || ( keyPressed == TQt::Key_Enter && m_keyCompletionAction==Enter ) + || ( keyPressed == TQt::Key_Tab && m_keyCompletionAction==Tab ) + || ( keyPressed == TQt::Key_Space && m_keyCompletionAction==Space ) + || ( keyPressed == TQt::Key_End && m_keyCompletionAction==End ) + || ( keyPressed == TQt::Key_Right && m_keyCompletionAction==Right )) { return doCompletion(textEditCursor, parag, index, txtObj); } } return false; } -void KoAutoFormat::showToolTipBox(KoTextParag *parag, int index, QWidget *widget, const QPoint &pos ) +void KoAutoFormat::showToolTipBox(KoTextParag *parag, int index, TQWidget *widget, const TQPoint &pos ) { if( m_completion && m_toolTipCompletion) { - QString lastWord, word; + TQString lastWord, word; for (uint i=1; i <= m_countMaxWords; i++ ) { lastWord = getLastWord(i, parag, index+1); @@ -1058,12 +1058,12 @@ void KoAutoFormat::showToolTipBox(KoTextParag *parag, int index, QWidget *widge return; word=lastWord+word.right(word.length()-length); if (!m_completionBox) - m_completionBox = new KoCompletionBox(0,0,Qt::WType_Popup); - QPoint const show_pos = widget->mapToGlobal(pos); + m_completionBox = new KoCompletionBox(0,0,TQt::WType_Popup); + TQPoint const show_pos = widget->mapToGlobal(pos); m_completionBox->setText(word); m_completionBox->setLastWord(lastWord); m_completionBox->adjustSize(); - int const height = m_completionBox->sizeHint().height(); + int const height = m_completionBox->tqsizeHint().height(); m_completionBox->move( show_pos.x(), show_pos.y() - height ); if (!m_completionBox->isShown() ) @@ -1092,13 +1092,13 @@ void KoAutoFormat::autoFormatIsActive() m_autoReplaceNumber || m_autoChangeFormat || m_completion || - m_typographicDoubleQuotes.replace || - m_typographicSimpleQuotes.replace || + m_typographicDoubleQuotes.tqreplace || + m_typographicSimpleQuotes.tqreplace || m_entries.count()!=0 || m_allLanguages.count()!=0; } -void KoAutoFormat::doAutoFormat( KoTextCursor* textEditCursor, KoTextParag *parag, int index, QChar ch,KoTextObject *txtObj ) +void KoAutoFormat::doAutoFormat( KoTextCursor* textEditCursor, KoTextParag *parag, int index, TQChar ch,KoTextObject *txtObj ) { m_ignoreUpperCase = false; @@ -1114,7 +1114,7 @@ void KoAutoFormat::doAutoFormat( KoTextCursor* textEditCursor, KoTextParag *para //=>m_ignoreUpperCase = false //m_ignoreUpperCase=false; - QString word=getWordAfterSpace(parag,index); + TQString word=getWordAfterSpace(parag,index); if ( m_autoChangeFormat && index > 3) { @@ -1158,7 +1158,7 @@ void KoAutoFormat::doAutoFormat( KoTextCursor* textEditCursor, KoTextParag *para doAutoIncludeAbbreviation(textEditCursor, parag, txtObj ); } - //kdDebug(32500) << "KoAutoFormat::doAutoFormat ch=" << QString(ch) << endl; + //kdDebug(32500) << "KoAutoFormat::doAutoFormat ch=" << TQString(ch) << endl; //if ( !m_enabled ) // return; // Auto-correction happens when pressing space, tab, CR, punct etc. @@ -1166,7 +1166,7 @@ void KoAutoFormat::doAutoFormat( KoTextCursor* textEditCursor, KoTextParag *para { KCommand *cmd = 0L; KMacroCommand *macro = 0L; - QString lastWord = getWordAfterSpace(parag, index); + TQString lastWord = getWordAfterSpace(parag, index); //kdDebug(32500) << "KoAutoFormat::doAutoFormat lastWord=" << lastWord << endl; if ( ch == '.') @@ -1248,8 +1248,8 @@ void KoAutoFormat::doAutoFormat( KoTextCursor* textEditCursor, KoTextParag *para //kdDebug(32500)<<" m_listCompletion->items() :"<<m_listCompletion->items()<<endl; if( !m_ignoreUpperCase && m_completion && m_addCompletionWord && m_listCompletion->items().count() < m_nbMaxCompletionWord ) { - QString completionWord(""); - QChar ch; + TQString completionWord(""); + TQChar ch; for (uint i=0;i<lastWord.length();i++) { ch = lastWord.at(i); @@ -1323,13 +1323,13 @@ void KoAutoFormat::doAutoFormat( KoTextCursor* textEditCursor, KoTextParag *para } else { - if ( ch == '"' && m_typographicDoubleQuotes.replace ) + if ( ch == '"' && m_typographicDoubleQuotes.tqreplace ) { KCommand *cmd = doTypographicQuotes( textEditCursor, parag, index, txtObj, true /*double quote*/ ); if ( cmd ) txtObj->emitNewCommand( cmd ); } - else if ( ch == '\'' && m_typographicDoubleQuotes.replace ) + else if ( ch == '\'' && m_typographicDoubleQuotes.tqreplace ) { KCommand *cmd = doTypographicQuotes( textEditCursor, parag, index, txtObj, false /* simple quote*/ ); if ( cmd ) @@ -1345,13 +1345,13 @@ KCommand *KoAutoFormat::doAutoCorrect( KoTextCursor* textEditCursor, KoTextParag // Prepare an array with words of different lengths, all terminating at "index". // Obviously only full words are put into the array // But this allows 'find strings' with spaces and punctuation in them. - QString * wordArray = new QString[m_maxFindLength+1]; + TQString * wordArray = new TQString[m_maxFindLength+1]; { - QString word; + TQString word; KoTextString *s = parag->string(); for ( int i = index - 1; i >= 0; --i ) { - QChar ch = s->at( i ).c; + TQChar ch = s->at( i ).c; // It's necessary to stop at spaces - #99063 if ( ch.isSpace() /*|| ch.isPunct()*/ || i==0) { @@ -1373,7 +1373,7 @@ KCommand *KoAutoFormat::doAutoCorrect( KoTextCursor* textEditCursor, KoTextParag } -KCommand *KoAutoFormat::autoFormatWord( KoTextCursor* textEditCursor, KoTextParag *parag, int &index, KoTextObject *txtObj, QString * _wordArray, bool _allLanguages ) +KCommand *KoAutoFormat::autoFormatWord( KoTextCursor* textEditCursor, KoTextParag *parag, int &index, KoTextObject *txtObj, TQString * _wordArray, bool _allLanguages ) { KoTextDocument * textdoc = parag->textDocument(); @@ -1400,10 +1400,10 @@ KCommand *KoAutoFormat::autoFormatWord( KoTextCursor* textEditCursor, KoTextPara cursor.setIndex( start + length ); textdoc->setSelectionEnd( KoTextDocument::HighlightSelection, &cursor ); KCommand *cmd = 0L; - kdDebug()<<"it->replace() :"<<it->replace()<<endl; + kdDebug()<<"it->tqreplace() :"<<it->tqreplace()<<endl; if (!it->formatEntryContext() || !m_bAutoCorrectionWithFormat) { - cmd = txtObj->replaceSelectionCommand( textEditCursor, it->replace(), + cmd = txtObj->replaceSelectionCommand( textEditCursor, it->tqreplace(), i18n("Autocorrect Word"), KoTextDocument::HighlightSelection ); } @@ -1414,7 +1414,7 @@ KCommand *KoAutoFormat::autoFormatWord( KoTextCursor* textEditCursor, KoTextPara KoTextFormat * newFormat = new KoTextFormat(*lastFormat); changeTextFormat(it->formatEntryContext(), newFormat, flags ); KMacroCommand *macro = new KMacroCommand( i18n("Autocorrect Word with Format")); - KCommand *cmd2=txtObj->replaceSelectionCommand( textEditCursor, it->replace(), + KCommand *cmd2=txtObj->replaceSelectionCommand( textEditCursor, it->tqreplace(), i18n("Autocorrect Word"), KoTextDocument::HighlightSelection ); if ( cmd2 ) @@ -1423,13 +1423,13 @@ KCommand *KoAutoFormat::autoFormatWord( KoTextCursor* textEditCursor, KoTextPara cursor.setParag( parag ); cursor.setIndex( start ); textdoc->setSelectionStart( KoTextDocument::HighlightSelection, &cursor ); - cursor.setIndex( start + it->replace().length()/*+ length + 1*/ ); + cursor.setIndex( start + it->tqreplace().length()/*+ length + 1*/ ); textdoc->setSelectionEnd( KoTextDocument::HighlightSelection, &cursor ); cmd2 =txtObj->setFormatCommand( textEditCursor, &lastFormat, newFormat, flags, false, KoTextDocument::HighlightSelection ); macro->addCommand( cmd2); - index = index - length + it->replace().length(); + index = index - length + it->tqreplace().length(); textEditCursor->setIndex(index+1); cmd2 =txtObj->setFormatCommand( textEditCursor, &newFormat, lastFormat, 0 ); macro->addCommand( cmd2); @@ -1448,7 +1448,7 @@ KCommand *KoAutoFormat::autoFormatWord( KoTextCursor* textEditCursor, KoTextPara txtObj->emitHideCursor(); textEditCursor->gotoRight(); txtObj->emitShowCursor(); - index = index - length + it->replace().length(); + index = index - length + it->tqreplace().length(); return cmd; } } @@ -1477,22 +1477,22 @@ KCommand *KoAutoFormat::doTypographicQuotes( KoTextCursor* textEditCursor, KoTex // a. and the character before that is not an opening quote (so that we get quotations of single characters // right) // b. and the previous quote of a different kind (so that we get empty quotations right) - QString replacement; + TQString replacement; bool ending = true; if( index > 0 ) { - QChar::Category c1 = parag->at( index - 1 )->c.category(); + TQChar::Category c1 = parag->at( index - 1 )->c.category(); // case 1 and 2 - if ( c1 == QChar::Separator_Space || c1 == QChar::Separator_Line || c1 == QChar::Separator_Paragraph || - c1 == QChar::Punctuation_Open || c1 == QChar::Other_Control ) + if ( c1 == TQChar::Separator_Space || c1 == TQChar::Separator_Line || c1 == TQChar::Separator_Paragraph || + c1 == TQChar::Punctuation_Open || c1 == TQChar::Other_Control ) ending = false; // case 3 - if ( c1 == QChar::Punctuation_InitialQuote ) + if ( c1 == TQChar::Punctuation_InitialQuote ) { - QChar openingQuote; + TQChar openingQuote; if( doubleQuotes ) openingQuote = m_typographicDoubleQuotes.begin; @@ -1508,8 +1508,8 @@ KCommand *KoAutoFormat::doTypographicQuotes( KoTextCursor* textEditCursor, KoTex // cases 2a and 3a if( index > 1 && !ending ) { - QChar::Category c2 = parag->at( index - 2 )->c.category(); - ending = (c2 == QChar::Punctuation_InitialQuote); + TQChar::Category c2 = parag->at( index - 2 )->c.category(); + ending = (c2 == TQChar::Punctuation_InitialQuote); } if( ending ) @@ -1532,7 +1532,7 @@ KCommand *KoAutoFormat::doTypographicQuotes( KoTextCursor* textEditCursor, KoTex } KCommand * KoAutoFormat::doUpperCase( KoTextCursor *textEditCursor, KoTextParag *parag, - int index, const QString & word, KoTextObject *txtObj ) + int index, const TQString & word, KoTextObject *txtObj ) { KoTextDocument * textdoc = parag->textDocument(); unsigned int length = word.length(); @@ -1547,7 +1547,7 @@ KCommand * KoAutoFormat::doUpperCase( KoTextCursor *textEditCursor, KoTextParag backCursor.setIndex( start ); // backCursor now points at the first char of the word - QChar const firstChar = backCursor.parag()->at( backCursor.index() )->c; + TQChar const firstChar = backCursor.parag()->at( backCursor.index() )->c; bool bNeedMove = false; KCommand *cmd = 0L; @@ -1557,7 +1557,7 @@ KCommand * KoAutoFormat::doUpperCase( KoTextCursor *textEditCursor, KoTextParag // Go back over any space/tab/CR while ( backCursor.index() > 0 || backCursor.parag()->prev() ) { - beginningOfSentence = false; // we could go back -> false unless we'll find '.' + beginningOfSentence = false; // we could go back -> false unless we'll tqfind '.' backCursor.gotoLeft(); if ( !backCursor.parag()->at( backCursor.index() )->c.isSpace() ) break; @@ -1573,12 +1573,12 @@ KCommand * KoAutoFormat::doUpperCase( KoTextCursor *textEditCursor, KoTextParag // Now look for exceptions if ( beginningOfSentence ) { - QChar const punct = backCursor.parag()->at( backCursor.index() )->c; - QString const text = getLastWord( backCursor.parag(), backCursor.index() ) + TQChar const punct = backCursor.parag()->at( backCursor.index() )->c; + TQString const text = getLastWord( backCursor.parag(), backCursor.index() ) + punct; kdDebug() << "text: " << text << endl; // text has the word at the end of the 'sentence', including the termination. Example: "Mr." - beginningOfSentence = (m_upperCaseExceptions.findIndex(text)==-1); // Ok if we can't find it + beginningOfSentence = (m_upperCaseExceptions.tqfindIndex(text)==-1); // Ok if we can't find it } if ( beginningOfSentence ) @@ -1589,7 +1589,7 @@ KCommand * KoAutoFormat::doUpperCase( KoTextCursor *textEditCursor, KoTextParag textdoc->setSelectionStart( KoTextDocument::HighlightSelection, &cursor ); cursor.setIndex( start + 1 ); textdoc->setSelectionEnd( KoTextDocument::HighlightSelection, &cursor ); - cmd = txtObj->replaceSelectionCommand( textEditCursor, QString( firstChar.upper() ), + cmd = txtObj->replaceSelectionCommand( textEditCursor, TQString( firstChar.upper() ), i18n("Autocorrect (capitalize first letter)"), KoTextDocument::HighlightSelection ); bNeedMove = true; @@ -1598,14 +1598,14 @@ KCommand * KoAutoFormat::doUpperCase( KoTextCursor *textEditCursor, KoTextParag else if ( m_convertUpperUpper && isUpper( firstChar ) && length > 2 ) { backCursor.setIndex( backCursor.index() + 1 ); - QChar secondChar = backCursor.parag()->at( backCursor.index() )->c; + TQChar secondChar = backCursor.parag()->at( backCursor.index() )->c; //kdDebug(32500)<<" secondChar :"<<secondChar<<endl; if ( isUpper( secondChar ) ) { // Check next letter - we still want to be able to write fully uppercase words... backCursor.setIndex( backCursor.index() + 1 ); - QChar thirdChar = backCursor.parag()->at( backCursor.index() )->c; - if ( isLower( thirdChar ) && (m_twoUpperLetterException.findIndex(word)==-1)) + TQChar thirdChar = backCursor.parag()->at( backCursor.index() )->c; + if ( isLower( thirdChar ) && (m_twoUpperLetterException.tqfindIndex(word)==-1)) { // Ok, convert KoTextCursor cursor( parag->document() ); @@ -1615,7 +1615,7 @@ KCommand * KoAutoFormat::doUpperCase( KoTextCursor *textEditCursor, KoTextParag cursor.setIndex( start + 2 ); textdoc->setSelectionEnd( KoTextDocument::HighlightSelection, &cursor ); - QString replacement = word[1].lower(); + TQString replacement = word[1].lower(); cmd = txtObj->replaceSelectionCommand( textEditCursor, replacement, i18n("Autocorrect"), KoTextDocument::HighlightSelection ); @@ -1637,14 +1637,14 @@ KCommand * KoAutoFormat::doUpperCase( KoTextCursor *textEditCursor, KoTextParag return cmd; } -KCommand * KoAutoFormat::doAutoReplaceNumber( KoTextCursor* textEditCursor, KoTextParag *parag, int& index, const QString & word , KoTextObject *txtObj ) +KCommand * KoAutoFormat::doAutoReplaceNumber( KoTextCursor* textEditCursor, KoTextParag *parag, int& index, const TQString & word , KoTextObject *txtObj ) { unsigned int length = word.length(); if ( length != 3 ) return 0L; KoTextDocument * textdoc = parag->textDocument(); int start = index - length; - if( word == QString("1/2") || word == QString("1/4") || word == QString("3/4") ) + if( word == TQString("1/2") || word == TQString("1/4") || word == TQString("3/4") ) { KoTextCursor cursor( parag->document() ); cursor.setParag( parag ); @@ -1652,14 +1652,14 @@ KCommand * KoAutoFormat::doAutoReplaceNumber( KoTextCursor* textEditCursor, KoTe textdoc->setSelectionStart( KoTextDocument::HighlightSelection, &cursor ); cursor.setIndex( start + length ); textdoc->setSelectionEnd( KoTextDocument::HighlightSelection, &cursor ); - QString replacement; - if( word == QString("1/2") ) - replacement=QString("�"); - else if (word == QString("1/4") ) - replacement=QString("�"); - else if (word == QString("3/4") ) - replacement=QString("�"); - QString cmdName = i18n("Autocorrect for Fraction"); + TQString replacement; + if( word == TQString("1/2") ) + replacement=TQString("�"); + else if (word == TQString("1/4") ) + replacement=TQString("�"); + else if (word == TQString("3/4") ) + replacement=TQString("�"); + TQString cmdName = i18n("Autocorrect for Fraction"); KCommand *cmd =txtObj->replaceSelectionCommand( textEditCursor, replacement, cmdName, KoTextDocument::HighlightSelection ); @@ -1674,61 +1674,61 @@ KCommand * KoAutoFormat::doAutoReplaceNumber( KoTextCursor* textEditCursor, KoTe void KoAutoFormat::detectStartOfLink(KoTextParag * parag, int const index, bool const insertedDot) { - QString word; + TQString word; KoTextString *s = parag->string(); for ( int i = 0; i < index; ++i ) { word.append( s->at( i ).c ); } - if (word.find("http")!=-1 || word.find("https")!=-1 || word.find("mailto")!=-1 || word.find("ftp")!=-1 || word.find("file")!=-1 - || word.find("news")!=-1 || word.find('@')!=-1) + if (word.tqfind("http")!=-1 || word.tqfind("https")!=-1 || word.tqfind("mailto")!=-1 || word.tqfind("ftp")!=-1 || word.tqfind("file")!=-1 + || word.tqfind("news")!=-1 || word.tqfind('@')!=-1) m_ignoreUpperCase=true; else { - int const tmp_pos=word.find("www."); - if (tmp_pos!=-1 && (word.find('.',tmp_pos+4)!=-1 || insertedDot) ) + int const tmp_pos=word.tqfind("www."); + if (tmp_pos!=-1 && (word.tqfind('.',tmp_pos+4)!=-1 || insertedDot) ) m_ignoreUpperCase=true; } } -void KoAutoFormat::doAutoDetectUrl( KoTextCursor *textEditCursor, KoTextParag *parag, int &index, QString & word, KoTextObject *txtObj ) +void KoAutoFormat::doAutoDetectUrl( KoTextCursor *textEditCursor, KoTextParag *parag, int &index, TQString & word, KoTextObject *txtObj ) { kdDebug() << "link:" << word << endl; char link_type = 0; - int pos = word.find("http://"); - int tmp_pos = word.find("https://"); + int pos = word.tqfind("http://"); + int tmp_pos = word.tqfind("https://"); if(tmp_pos<pos && tmp_pos!=-1) pos = tmp_pos; - tmp_pos = word.find("mailto:/"); + tmp_pos = word.tqfind("mailto:/"); if((tmp_pos<pos || pos==-1 ) && tmp_pos!=-1) pos = tmp_pos; - tmp_pos = word.find("ftp://"); + tmp_pos = word.tqfind("ftp://"); if((tmp_pos<pos || pos==-1 ) && tmp_pos!=-1) pos = tmp_pos; - tmp_pos = word.find("ftp."); + tmp_pos = word.tqfind("ftp."); if((tmp_pos<pos || pos==-1 ) && tmp_pos!=-1) { pos = tmp_pos; link_type = 3; } - tmp_pos = word.find("file:/"); + tmp_pos = word.tqfind("file:/"); if((tmp_pos<pos || pos==-1 ) && tmp_pos!=-1) pos = tmp_pos; - tmp_pos = word.find("news:"); + tmp_pos = word.tqfind("news:"); if((tmp_pos<pos || pos==-1 ) && tmp_pos!=-1) pos = tmp_pos; - tmp_pos = word.find("www."); - if((tmp_pos<pos || pos==-1 ) && tmp_pos!=-1 && word.find('.',tmp_pos+4)!=-1 ) + tmp_pos = word.tqfind("www."); + if((tmp_pos<pos || pos==-1 ) && tmp_pos!=-1 && word.tqfind('.',tmp_pos+4)!=-1 ) { pos = tmp_pos; link_type = 2; } - tmp_pos = word.find('@'); + tmp_pos = word.tqfind('@'); if ( pos == -1 && tmp_pos != -1 ) { pos = tmp_pos-1; - QChar c; + TQChar c; while( pos>=0 ) { c = word.at(pos); @@ -1762,13 +1762,13 @@ void KoAutoFormat::doAutoDetectUrl( KoTextCursor *textEditCursor, KoTextParag *p textdoc->setSelectionStart( KoTextDocument::HighlightSelection, &cursor ); cursor.setIndex( start + length ); textdoc->setSelectionEnd( KoTextDocument::HighlightSelection, &cursor ); - QString newWord = word; + TQString newWord = word; if(link_type==1) - newWord = QString("mailto:") + word; + newWord = TQString("mailto:") + word; else if(link_type==2) - newWord = QString("http://") + word; + newWord = TQString("http://") + word; else if(link_type==3) - newWord = QString("ftp://") + word; + newWord = TQString("ftp://") + word; KoVariable* var = new KoLinkVariable( textdoc, word, newWord, m_varFormatCollection->format( "STRING" ), m_varCollection ); CustomItemsMap customItemsMap; @@ -1778,7 +1778,7 @@ void KoAutoFormat::doAutoDetectUrl( KoTextCursor *textEditCursor, KoTextParag *p txtObj->insert( textEditCursor, lastFormat, KoTextObject::customItemChar(), i18n("Insert Variable"), KoTextDocument::HighlightSelection, KoTextObject::DefaultInsertFlags, customItemsMap ); var->recalc(); - parag->invalidate(0); + parag->tqinvalidate(0); parag->setChanged( true ); // adjust index @@ -1811,17 +1811,17 @@ void KoAutoFormat::doAutoIncludeUpperUpper(KoTextCursor* /*textEditCursor*/, KoT for (int i=0; i<=(s->length() - 1);i++) { - QString word; + TQString word; for ( int j = i ; j < s->length() - 1; j++ ) { - QChar ch = s->at( j ).c; + TQChar ch = s->at( j ).c; if ( ch.isSpace() ) break; word.append( ch ); } - if( word.length() > 2 && word.left(2)==word.left(2).upper() && word.at(3)!=word.at(3).upper() ) + if( word.length() > 2 && word.left(2)==word.left(2).upper() && word.tqat(3)!=word.tqat(3).upper() ) { - if ( m_twoUpperLetterException.findIndex(word )==-1) + if ( m_twoUpperLetterException.tqfindIndex(word )==-1) m_twoUpperLetterException.append( word); } i+=word.length(); @@ -1837,12 +1837,12 @@ void KoAutoFormat::doAutoIncludeAbbreviation(KoTextCursor* /*textEditCursor*/, K return; for (int i=0; i<=(s->length() - 1);i++) { - QString wordAfter; - QString word; + TQString wordAfter; + TQString word; for ( int j = i ; j < s->length() - 1; j++ ) { - QChar ch = s->at( j ).c; + TQChar ch = s->at( j ).c; if ( ch.isSpace() ) break; word.append( ch ); @@ -1851,14 +1851,14 @@ void KoAutoFormat::doAutoIncludeAbbreviation(KoTextCursor* /*textEditCursor*/, K { for ( int j = i+word.length()+1 ; j < s->length() - 1; j++ ) { - QChar ch = s->at( j ).c; + TQChar ch = s->at( j ).c; if ( ch.isSpace() ) break; wordAfter.append( ch ); } - if( word.length()>1 && !wordAfter.isEmpty() && wordAfter.at(0)==wordAfter.at(0).lower()) + if( word.length()>1 && !wordAfter.isEmpty() && wordAfter.tqat(0)==wordAfter.tqat(0).lower()) { - if ( m_upperCaseExceptions.findIndex(word )==-1) + if ( m_upperCaseExceptions.tqfindIndex(word )==-1) m_upperCaseExceptions.append( word ); } } @@ -1872,13 +1872,13 @@ void KoAutoFormat::doAutoIncludeAbbreviation(KoTextCursor* /*textEditCursor*/, K } -KCommand * KoAutoFormat::doAutoChangeFormat( KoTextCursor *textEditCursor, KoTextParag *parag,int index, const QString & word, KoTextObject *txtObj ) +KCommand * KoAutoFormat::doAutoChangeFormat( KoTextCursor *textEditCursor, KoTextParag *parag,int index, const TQString & word, KoTextObject *txtObj ) { bool underline = (word.at(0)=='_' && word.at(word.length()-1)=='_'); bool bold = (word.at(0)=='*' && word.at(word.length()-1)=='*'); if( bold || underline) { - QString replacement=word.mid(1,word.length()-2); + TQString replacement=word.mid(1,word.length()-2); int start = index - word.length(); KoTextDocument * textdoc = parag->textDocument(); KMacroCommand *macro=new KMacroCommand(i18n("Autocorrection: Change Format")); @@ -1923,7 +1923,7 @@ KCommand *KoAutoFormat::doUseBulletStyle(KoTextCursor * /*textEditCursor*/, KoTe KoTextDocument * textdoc = parag->textDocument(); KoTextCursor cursor( parag->document() ); KoTextString *s = parag->string(); - QChar ch = s->at( 0 ).c; + TQChar ch = s->at( 0 ).c; if( m_useBulletStyle && (ch =='*' || ch == '-' || ch =='+') && (s->at(1).c).isSpace()) { @@ -1974,7 +1974,7 @@ KCommand *KoAutoFormat::doUseBulletStyle(KoTextCursor * /*textEditCursor*/, KoTe c.setStyle( KoParagCounter::STYLE_CUSTOMBULLET ); c.setCustomBulletCharacter( m_bulletStyle ); } - c.setSuffix(QString::null); + c.setSuffix(TQString()); cmd=txtObj->setCounterCommand( &cursor, c ,KoTextDocument::HighlightSelection ); if( cmd) macroCmd->addCommand(cmd); @@ -2003,18 +2003,18 @@ KCommand *KoAutoFormat::doUseNumberStyle(KoTextCursor * /*textEditCursor*/, KoTe KoTextDocument * textdoc = parag->textDocument(); KoTextCursor cursor( parag->document() ); KoTextString *s = parag->string(); - QString word; + TQString word; for ( int i = 0 ; i < s->length() - 1; i++ ) { - QChar ch = s->at( i ).c; + TQChar ch = s->at( i ).c; if ( ch.isSpace() ) break; word.append( ch ); } - QChar punct=word[word.length()-1]; + TQChar punct=word[word.length()-1]; if( punct.isPunct() ) { - QString number=word.mid(0,word.length()-1); + TQString number=word.mid(0,word.length()-1); bool ok; uint val=number.toUInt(&ok); if( ok ) @@ -2043,7 +2043,7 @@ KCommand *KoAutoFormat::doUseNumberStyle(KoTextCursor * /*textEditCursor*/, KoTe KoParagCounter c; c.setNumbering( KoParagCounter::NUM_LIST ); c.setStyle( KoParagCounter::STYLE_NUM ); - c.setSuffix(QString( punct )); + c.setSuffix(TQString( punct )); c.setStartNumber( (int)val); // Look at which number this parag will have without a restart counter flag, @@ -2083,7 +2083,7 @@ KCommand * KoAutoFormat::doRemoveSpaceBeginEndLine( KoTextCursor *textEditCursor // Cut away spaces at end of paragraph for ( int i = parag->lastCharPos(); i >= 0; --i ) { - QChar ch = s->at( i ).c; + TQChar ch = s->at( i ).c; if ( ch != ' ' ) // was: !ch.isSpace(), but this includes tabs, and this option is only about spaces { if( i == parag->lastCharPos() ) @@ -2094,7 +2094,7 @@ KCommand * KoAutoFormat::doRemoveSpaceBeginEndLine( KoTextCursor *textEditCursor cursor.setParag( parag ); cursor.setIndex( parag->lastCharPos()+1 ); textdoc->setSelectionEnd( KoTextDocument::HighlightSelection, &cursor ); - KCommand *cmd=txtObj->replaceSelectionCommand( &cursor, "", QString::null, KoTextDocument::HighlightSelection ); + KCommand *cmd=txtObj->replaceSelectionCommand( &cursor, "", TQString(), KoTextDocument::HighlightSelection ); if(cmd) { @@ -2112,7 +2112,7 @@ KCommand * KoAutoFormat::doRemoveSpaceBeginEndLine( KoTextCursor *textEditCursor for ( int i = 0 ; i <= parag->lastCharPos() ; i++ ) { - QChar ch = s->at( i ).c; + TQChar ch = s->at( i ).c; if ( ch != ' ' ) // was: !ch.isSpace(), but this includes tabs, and this option is only about spaces { if( i == 0 ) @@ -2124,7 +2124,7 @@ KCommand * KoAutoFormat::doRemoveSpaceBeginEndLine( KoTextCursor *textEditCursor cursor.setParag( parag ); cursor.setIndex( i ); textdoc->setSelectionEnd( KoTextDocument::HighlightSelection, &cursor ); - KCommand *cmd=txtObj->replaceSelectionCommand( &cursor, "", QString::null, KoTextDocument::HighlightSelection ); + KCommand *cmd=txtObj->replaceSelectionCommand( &cursor, "", TQString(), KoTextDocument::HighlightSelection ); if(cmd) { @@ -2147,27 +2147,27 @@ KCommand * KoAutoFormat::doRemoveSpaceBeginEndLine( KoTextCursor *textEditCursor return macroCmd; } -KCommand *KoAutoFormat::doCapitalizeNameOfDays( KoTextCursor* textEditCursor, KoTextParag *parag, int index, const QString & word , KoTextObject *txtObj ) +KCommand *KoAutoFormat::doCapitalizeNameOfDays( KoTextCursor* textEditCursor, KoTextParag *parag, int index, const TQString & word , KoTextObject *txtObj ) { //m_cacheNameOfDays //todo - int pos = m_cacheNameOfDays.findIndex( word.lower() ); + int pos = m_cacheNameOfDays.tqfindIndex( word.lower() ); if ( pos == -1 ) return 0L; KoTextDocument * textdoc = parag->textDocument(); - QString replaceStr= m_cacheNameOfDays[pos]; + TQString replaceStr= m_cacheNameOfDays[pos]; int start = index - replaceStr.length(); int length = replaceStr.length(); - if( word.at(0).isLetter() && word.at(0)==word.at(0).lower() ) + if( word.tqat(0).isLetter() && word.tqat(0)==word.tqat(0).lower() ) { KoTextCursor cursor( parag->document() ); cursor.setParag( parag ); cursor.setIndex( start ); textdoc->setSelectionStart( KoTextDocument::HighlightSelection, &cursor ); cursor.setIndex( start + length ); - QString replacement = replaceStr.at(0).upper() + replaceStr.right( length-1 ); + TQString replacement = replaceStr.tqat(0).upper() + replaceStr.right( length-1 ); textdoc->setSelectionEnd( KoTextDocument::HighlightSelection, &cursor ); - QString cmdName=i18n("Capitalize Name of Days"); + TQString cmdName=i18n("Capitalize Name of Days"); KCommand *cmd =txtObj->replaceSelectionCommand( textEditCursor, replacement, cmdName, KoTextDocument::HighlightSelection ); @@ -2179,23 +2179,23 @@ KCommand *KoAutoFormat::doCapitalizeNameOfDays( KoTextCursor* textEditCursor, Ko return 0L; } -KCommand *KoAutoFormat::doAutoSuperScript( KoTextCursor* textEditCursor, KoTextParag *parag, int index, const QString & word , KoTextObject *txtObj ) +KCommand *KoAutoFormat::doAutoSuperScript( KoTextCursor* textEditCursor, KoTextParag *parag, int index, const TQString & word , KoTextObject *txtObj ) { KoAutoFormatEntryMap::Iterator it = m_superScriptEntries.begin(); bool found = false; - QString replace; + TQString tqreplace; for ( ; it != m_superScriptEntries.end() ; ++it ) { if( it.key()==word) { - replace = it.data().replace(); + tqreplace = it.data().tqreplace(); found = true; break; } else if ( it.key()=="othernb") { - QString tmp = it.data().replace(); - int pos = word.find( tmp ); + TQString tmp = it.data().tqreplace(); + int pos = word.tqfind( tmp ); if( pos != -1) { if( pos + tmp.length() == word.length()) @@ -2204,7 +2204,7 @@ KCommand *KoAutoFormat::doAutoSuperScript( KoTextCursor* textEditCursor, KoTextP word.left( pos ).toInt( &ok); if( ok ) { - replace = tmp; + tqreplace = tmp; found = true; break; } @@ -2216,7 +2216,7 @@ KCommand *KoAutoFormat::doAutoSuperScript( KoTextCursor* textEditCursor, KoTextP { KoTextDocument * textdoc = parag->textDocument(); - int start = index - replace.length(); + int start = index - tqreplace.length(); KoTextFormat * lastFormat = parag->at( start )->format(); KoTextFormat * newFormat = new KoTextFormat(*lastFormat); KoTextCursor cursor( parag->document() ); @@ -2235,12 +2235,12 @@ KCommand *KoAutoFormat::doAutoSuperScript( KoTextCursor* textEditCursor, KoTextP return 0L; } -bool KoAutoFormat::doIgnoreDoubleSpace( KoTextParag *parag, int index, QChar ch ) +bool KoAutoFormat::doIgnoreDoubleSpace( KoTextParag *parag, int index, TQChar ch ) { if( m_ignoreDoubleSpace && ch==' ' && index >= 0 && !parag->hasAnySelection() ) { KoTextString *s = parag->string(); - QChar ch = s->at( index ).c; + TQChar ch = s->at( index ).c; if ( ch==' ' ) return true; } @@ -2292,7 +2292,7 @@ void KoAutoFormat::configUseBulletStyle( bool _ubs) m_useBulletStyle=_ubs; } -void KoAutoFormat::configBulletStyle( QChar b ) +void KoAutoFormat::configBulletStyle( TQChar b ) { m_bulletStyle = b; } @@ -2354,26 +2354,26 @@ void KoAutoFormat::configAddCompletionWord( bool b ) m_addCompletionWord= b; } -bool KoAutoFormat::isUpper( const QChar &c ) +bool KoAutoFormat::isUpper( const TQChar &c ) { return c.lower() != c; } -bool KoAutoFormat::isLower( const QChar &c ) +bool KoAutoFormat::isLower( const TQChar &c ) { // Note that this is not the same as !isUpper ! // For instance '1' is not lower nor upper, return c.upper() != c; } -bool KoAutoFormat::isMark( const QChar &c ) +bool KoAutoFormat::isMark( const TQChar &c ) { - return ( c == QChar( '.' ) || - c == QChar( '?' ) || - c == QChar( '!' ) ); + return ( c == TQChar( '.' ) || + c == TQChar( '?' ) || + c == TQChar( '!' ) ); } -bool KoAutoFormat::isSeparator( const QChar &c ) +bool KoAutoFormat::isSeparator( const TQChar &c ) { return ( !c.isLetter() && !c.isNumber() && !c.isDigit() ); } @@ -2381,19 +2381,19 @@ bool KoAutoFormat::isSeparator( const QChar &c ) void KoAutoFormat::buildMaxLen() { m_maxFindLength = 0; - QDictIterator<KoAutoFormatEntry> it( m_entries ); + TQDictIterator<KoAutoFormatEntry> it( m_entries ); for( ; it.current(); ++it ) { - m_maxFindLength = QMAX( m_maxFindLength, it.currentKey().length() ); + m_maxFindLength = TQMAX( m_maxFindLength, it.currentKey().length() ); } - QDictIterator<KoAutoFormatEntry> it2( m_allLanguages ); + TQDictIterator<KoAutoFormatEntry> it2( m_allLanguages ); for( ; it2.current(); ++it2 ) { - m_maxFindLength = QMAX( m_maxFindLength, it2.currentKey().length() ); + m_maxFindLength = TQMAX( m_maxFindLength, it2.currentKey().length() ); } } -QStringList KoAutoFormat::listCompletion() const +TQStringList KoAutoFormat::listCompletion() const { return m_listCompletion->items(); } @@ -2424,7 +2424,7 @@ void KoAutoFormat::configCapitalizeNameOfDays( bool b) m_bCapitalizeNameOfDays = b; } -void KoAutoFormat::configAutoFormatLanguage( const QString &_lang) +void KoAutoFormat::configAutoFormatLanguage( const TQString &_lang) { m_autoFormatLanguage=_lang; } @@ -2496,9 +2496,9 @@ void KoAutoFormat::changeTextFormat(KoSearchContext *formatOptions, KoTextFormat if ( formatOptions->m_optionsMask & KoSearchContext::Shadow) { if ( formatOptions->m_options & KoSearchContext::Shadow ) - format->setShadow( 1, 1, Qt::gray ); + format->setShadow( 1, 1, TQt::gray ); else - format->setShadow( 0, 0, QColor() ); + format->setShadow( 0, 0, TQColor() ); flags |=KoTextFormat::ShadowText; } |