author | ar <ar> | 2004-05-03 21:35:18 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-03 21:35:18 (UTC) |
commit | 412619441fab46fc79c695a23ccf9e38135bdfad (patch) (side-by-side diff) | |
tree | 19d9b8af14cf6c345ef532bb32368b9c7b43c50f /noncore/apps/tinykate/libkate | |
parent | d1095d71394779557f446e2a67ba55bc62eec859 (diff) | |
download | opie-412619441fab46fc79c695a23ccf9e38135bdfad.zip opie-412619441fab46fc79c695a23ccf9e38135bdfad.tar.gz opie-412619441fab46fc79c695a23ccf9e38135bdfad.tar.bz2 |
- convert qDebug to odebug
Diffstat (limited to 'noncore/apps/tinykate/libkate') (more/less context) (ignore whitespace changes)
5 files changed, 296 insertions, 280 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katebuffer.cpp b/noncore/apps/tinykate/libkate/document/katebuffer.cpp index 22a4917..4c15fd0 100644 --- a/noncore/apps/tinykate/libkate/document/katebuffer.cpp +++ b/noncore/apps/tinykate/libkate/document/katebuffer.cpp @@ -23,22 +23,23 @@ #include "katebuffer.h" +#include "kdebug.h" -// Includes for reading file -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <errno.h> -#include <unistd.h> +/* OPIE */ +#include <opie2/odebug.h> +/* QT */ #include <qfile.h> #include <qtextstream.h> - #include <qtimer.h> #include <qtextcodec.h> -// - +/* STD */ +// Includes for reading file +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#include <unistd.h> #include <assert.h> -#include <kdebug.h> /** @@ -66,33 +67,33 @@ void KWBuffer::insertFile(int line, const QString &file, QTextCodec *codec) { - if (line) { - qDebug("insert File only supports insertion at line 0 == file opening"); - return; - } - clear(); - QFile iofile(file); - iofile.open(IO_ReadOnly); - QTextStream stream(&iofile); - stream.setCodec(codec); - QString qsl; - int count=0; - for (count=0;((qsl=stream.readLine())!=QString::null); count++) - { - if (count==0) - { - (*m_stringListIt)->append(qsl.unicode(),qsl.length()); - } - else - { - TextLine::Ptr tl=new TextLine(); - tl ->append(qsl.unicode(),qsl.length()); - m_stringListIt=m_stringList.append(tl); - } - } - if (count!=0) - { - m_stringListCurrent=count-1; - m_lineCount=count; - } + if (line) { + odebug << "insert File only supports insertion at line 0 == file opening" << oendl; + return; + } + clear(); + QFile iofile(file); + iofile.open(IO_ReadOnly); + QTextStream stream(&iofile); + stream.setCodec(codec); + QString qsl; + int count=0; + for (count=0;((qsl=stream.readLine())!=QString::null); count++) + { + if (count==0) + { + (*m_stringListIt)->append(qsl.unicode(),qsl.length()); + } + else + { + TextLine::Ptr tl=new TextLine(); + tl ->append(qsl.unicode(),qsl.length()); + m_stringListIt=m_stringList.append(tl); + } + } + if (count!=0) + { + m_stringListCurrent=count-1; + m_lineCount=count; + } } @@ -122,7 +123,7 @@ int KWBuffer::count() { - qDebug("m_stringList.count %d",m_stringList.count()); + odebug << "m_stringList.count " << m_stringList.count() << "" << oendl; return m_lineCount; -// return m_stringList.count(); +// return m_stringList.count(); // return m_totalLines; } @@ -149,7 +150,7 @@ TextLine::Ptr KWBuffer::line(int i) { - if (i>=m_stringList.count()) return 0; - seek(i); - return *m_stringListIt; + if (i>=m_stringList.count()) return 0; + seek(i); + return *m_stringListIt; } diff --git a/noncore/apps/tinykate/libkate/document/katedocument.cpp b/noncore/apps/tinykate/libkate/document/katedocument.cpp index 0c742d7..6dc4fd2 100644 --- a/noncore/apps/tinykate/libkate/document/katedocument.cpp +++ b/noncore/apps/tinykate/libkate/document/katedocument.cpp @@ -7,5 +7,5 @@ email : crossfire@babylon2k.de jowenn@kde.org - + ***************************************************************************/ @@ -40,18 +40,29 @@ #include "katedocument.h" +#include "kmessagebox.h" +#include "kglobal.h" +//#include "kcharsets.h" +#include "kdebug.h" +//#include "kinstance.h" -#include <qfileinfo.h> -#include <qdatetime.h> +#include "kglobalsettings.h" +//#include "kaction.h" +//#include "kstdaction.h" -#include <kmessagebox.h> -#include <qpe/config.h> -#include <qstring.h> +#include "../view/kateview.h" +#include "katebuffer.h" +#include "katetextline.h" -#include <sys/time.h> -#include <unistd.h> +#include "katecmd.h" -#include <stdio.h> +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> +/* QT */ +#include <qfileinfo.h> +#include <qdatetime.h> +#include <qstring.h> #include <qtimer.h> #include <qobject.h> @@ -63,19 +74,9 @@ #include <qtextstream.h> #include <qtextcodec.h> -#include <kglobal.h> -//#include <kcharsets.h> -#include <kdebug.h> -//#include <kinstance.h> - -#include <kglobalsettings.h> -//#include <kaction.h> -//#include <kstdaction.h> - -#include "../view/kateview.h" -#include "katebuffer.h" -#include "katetextline.h" - -#include "katecmd.h" +/* STD */ +#include <sys/time.h> +#include <unistd.h> +#include <stdio.h> KateAction::KateAction(Action a, PointStruc &cursor, int len, const QString &text) @@ -131,5 +132,5 @@ QStringList KateDocument::replaceWithList = QStringList(); uint KateDocument::uniqueID = 0; -QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0; +QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0; @@ -142,6 +143,6 @@ KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView, hlManager(HlManager::self ()) { - - d(this)->hlSetByUser = false; + + d(this)->hlSetByUser = false; PreHighlightedTill=0; RequestPreHighlightTill=0; @@ -153,5 +154,5 @@ KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView, // NOTE: QFont::CharSet doesn't provide all the charsets KDE supports - // (esp. it doesn't distinguish between UTF-8 and iso10646-1) + // (esp. it doesn't distinguish between UTF-8 and iso10646-1) myEncoding = QString::fromLatin1(QTextCodec::codecForLocale()->name()); @@ -293,5 +294,5 @@ void KateDocument::openURL(const QString &filename) { - m_file=filename; + m_file=filename; fileInfo->setFile (m_file); setMTime(); @@ -299,5 +300,5 @@ void KateDocument::openURL(const QString &filename) if (!fileInfo->exists() || !fileInfo->isReadable()) { - qDebug("File doesn't exit or couldn't be read"); + odebug << "File doesn't exit or couldn't be read" << oendl; return ; } @@ -306,5 +307,5 @@ void KateDocument::openURL(const QString &filename) #warning fixme // buffer->insertFile(0, m_file, KGlobal::charsets()->codecForName(myEncoding)); - qDebug("Telling buffer to open file"); + odebug << "Telling buffer to open file" << oendl; buffer->insertFile(0, m_file, QTextCodec::codecForLocale()); @@ -322,5 +323,5 @@ void KateDocument::openURL(const QString &filename) emit fileNameChanged(); - + return ; } @@ -328,5 +329,5 @@ void KateDocument::openURL(const QString &filename) bool KateDocument::saveFile() { - + QFile f( m_file ); if ( !f.open( IO_WriteOnly ) ) @@ -612,5 +613,5 @@ void KateDocument::readConfig() colors[0] = config->readColorEntry("Color Background", colors[0]); colors[1] = config->readColorEntry("Color Selected", colors[1]); - + // config->sync(); } @@ -684,5 +685,5 @@ void KateDocument::setHighlight(int n) { void KateDocument::makeAttribs() { - qDebug("KateDocument::makeAttribs()"); + odebug << "KateDocument::makeAttribs()" << oendl; m_numAttribs = hlManager->makeAttribs(m_highlight, m_attribs, maxAttribs); updateFontData(); @@ -1924,6 +1925,6 @@ void KateDocument::updateLines(int startLine, int endLine, int flags, int cursor } endCtx = textLine->getContext(); -// qDebug("DOHIGHLIGHT"); - +// odebug << "DOHIGHLIGHT" << oendl; + ctxNum = m_highlight->doHighlight(ctxNum,textLine); textLine->setContext(ctxNum); diff --git a/noncore/apps/tinykate/libkate/document/katehighlight.cpp b/noncore/apps/tinykate/libkate/document/katehighlight.cpp index 0d2c283..539d356 100644 --- a/noncore/apps/tinykate/libkate/document/katehighlight.cpp +++ b/noncore/apps/tinykate/libkate/document/katehighlight.cpp @@ -2,6 +2,6 @@ Copyright (C) 1998, 1999 Jochen Wilhelmy digisnap@cs.tu-berlin.de - (C) 2002, 2001 The Kate Team <kwrite-devel@kde.org> - (C) 2002 Joseph Wenninger <jowenn@kde.org> + (C) 2002, 2001 The Kate Team <kwrite-devel@kde.org> + (C) 2002 Joseph Wenninger <jowenn@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -20,24 +20,28 @@ */ -#include <string.h> - -#include <qtextstream.h> -#include <qpe/config.h> -#include <kglobal.h> -//#include <kinstance.h> -//#include <kmimemagic.h> -#include <klocale.h> -//#include <kregexp.h> -#include <kglobalsettings.h> -#include <kdebug.h> -#include <kstddirs.h> - #include "katehighlight.h" - - #include "katetextline.h" #include "katedocument.h" #include "katesyntaxdocument.h" +#include "kglobal.h" +//#include "kinstance.h" +//#include "kmimemagic.h" +#include "klocale.h" +//#include "kregexp.h" +#include "kglobalsettings.h" +#include "kdebug.h" +#include "kstddirs.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> + +/* QT */ +#include <qtextstream.h> + +/* STD */ +#include <string.h> + HlManager *HlManager::s_pSelf = 0; @@ -121,6 +125,6 @@ const QChar *HlStringDetect::checkHgl(const QChar *s, int len, bool) { else { - QString tmp=QString(s,str.length()).upper(); - if (tmp==str) return s+str.length(); + QString tmp=QString(s,str.length()).upper(); + if (tmp==str) return s+str.length(); } return 0L; @@ -214,8 +218,8 @@ const QChar *HlInt::checkHgl(const QChar *str, int len, bool) { if (subItems) { - for (HlItem *it=subItems->first();it;it=subItems->next()) + for (HlItem *it=subItems->first();it;it=subItems->next()) { s1=it->checkHgl(s, len, false); - if (s1) return s1; + if (s1) return s1; } } @@ -249,12 +253,12 @@ const QChar *HlFloat::checkHgl(const QChar *s, int len, bool) { else if (!p) return 0L; - else - { + else + { if (subItems) { - for (HlItem *it=subItems->first();it;it=subItems->next()) + for (HlItem *it=subItems->first();it;it=subItems->next()) { s1=it->checkHgl(s, len, false); - if (s1) return s1; + if (s1) return s1; } } @@ -346,5 +350,5 @@ const QChar *HlCHex::checkHgl(const QChar *str, int len, bool) { if(pos > -1) return str+rx.matchedLength(); else - return 0L; + return 0L; #else @@ -401,5 +405,5 @@ const QChar *HlRegExpr::checkHgl(const QChar *s, int len, bool lineStart) if (pos==-1) return 0L; else - return (s+Expr->matchedLength()); + return (s+Expr->matchedLength()); }; @@ -412,7 +416,7 @@ const QChar *HlLineContinue::checkHgl(const QChar *s, int len, bool) { if ((s[0].latin1() == '\\') && (len == 1)) - { + { return s + 1; - } + } return 0L; } @@ -622,5 +626,5 @@ int Highlight::doHighlight(int ctxNum, TextLine *textLine) if (s2 > s1) { - qDebug("An item has been detected"); + odebug << "An item has been detected" << oendl; textLine->setAttribs(item->attr,s1 - str,s2 - str); ctxNum = item->ctx; @@ -854,5 +858,5 @@ void Highlight::done() void Highlight::createItemData(ItemDataList &list) { - qDebug("Highlight::createItemData"); + odebug << "Highlight::createItemData" << oendl; // If no highlighting is selected we need only one default. @@ -875,5 +879,5 @@ void Highlight::createItemData(ItemDataList &list) syntaxContextData *data; - qDebug("Trying to read itemData section"); + odebug << "Trying to read itemData section" << oendl; //Tell the syntax document class which file we want to parse and which data group @@ -883,5 +887,5 @@ void Highlight::createItemData(ItemDataList &list) while (HlManager::self()->syntax->nextGroup(data)) { - qDebug("Setting up one itemData element"); + odebug << "Setting up one itemData element" << oendl; // read all attributes color=HlManager::self()->syntax->groupData(data,QString("color")); @@ -934,10 +938,10 @@ void Highlight::createItemData(ItemDataList &list) int Highlight::lookupAttrName(const QString& name, ItemDataList &iDl) { - for (int i=0;i<iDl.count();i++) - { - if (iDl.at(i)->name==name) return i; - } - kdDebug(13010)<<"Couldn't resolve itemDataName"<<endl; - return 0; + for (int i=0;i<iDl.count();i++) + { + if (iDl.at(i)->name==name) return i; + } + kdDebug(13010)<<"Couldn't resolve itemDataName"<<endl; + return 0; } @@ -1078,9 +1082,9 @@ void Highlight::readCommentConfig() if (HlManager::self()->syntax->groupData(data,"name")=="singleLine") - cslStart=HlManager::self()->syntax->groupData(data,"start"); - if (HlManager::self()->syntax->groupData(data,"name")=="multiLine") + cslStart=HlManager::self()->syntax->groupData(data,"start"); + if (HlManager::self()->syntax->groupData(data,"name")=="multiLine") { - cmlStart=HlManager::self()->syntax->groupData(data,"start"); - cmlEnd=HlManager::self()->syntax->groupData(data,"end"); + cmlStart=HlManager::self()->syntax->groupData(data,"start"); + cmlEnd=HlManager::self()->syntax->groupData(data,"end"); } } @@ -1113,8 +1117,8 @@ void Highlight::readGlobalKeywordConfig() if (data) { - kdDebug(13010)<<"Found global keyword config"<<endl; + kdDebug(13010)<<"Found global keyword config"<<endl; if (HlManager::self()->syntax->groupItemData(data,QString("casesensitive"))!="0") - casesensitive=true; else {casesensitive=false; kdDebug(13010)<<"Turning on case insensitiveness"<<endl;} + casesensitive=true; else {casesensitive=false; kdDebug(13010)<<"Turning on case insensitiveness"<<endl;} //get the weak deliminators weakDeliminator=(!HlManager::self()->syntax->groupItemData(data,QString("weakDeliminator"))); @@ -1134,5 +1138,5 @@ void Highlight::readGlobalKeywordConfig() deliminatorLen = deliminator.length(); - HlManager::self()->syntax->freeGroupInfo(data); + HlManager::self()->syntax->freeGroupInfo(data); } else @@ -1205,23 +1209,23 @@ void Highlight::makeContextList() while (HlManager::self()->syntax->nextItem(data)) { -// kdDebug(13010)<< "In make Contextlist: Item:"<<endl; - c=createHlItem(data,iDl); - if (c) - { +// kdDebug(13010)<< "In make Contextlist: Item:"<<endl; + c=createHlItem(data,iDl); + if (c) + { contextList[i]->items.append(c); // Not supported completely atm and only one level. Subitems.(all have to be matched to at once) - datasub=HlManager::self()->syntax->getSubItems(data); - bool tmpbool; - if (tmpbool=HlManager::self()->syntax->nextItem(datasub)) - { + datasub=HlManager::self()->syntax->getSubItems(data); + bool tmpbool; + if (tmpbool=HlManager::self()->syntax->nextItem(datasub)) + { c->subItems=new QList<HlItem>; - for (;tmpbool;tmpbool=HlManager::self()->syntax->nextItem(datasub)) + for (;tmpbool;tmpbool=HlManager::self()->syntax->nextItem(datasub)) c->subItems->append(createHlItem(datasub,iDl)); } - HlManager::self()->syntax->freeGroupInfo(datasub); + HlManager::self()->syntax->freeGroupInfo(datasub); // end of sublevel - } -// kdDebug(13010)<<"Last line in loop"<<endl; + } +// kdDebug(13010)<<"Last line in loop"<<endl; } i++; @@ -1313,5 +1317,5 @@ int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) { int nAttribs, z; - qDebug("HlManager::makeAttribs"); + odebug << "HlManager::makeAttribs" << oendl; defaultStyleList.setAutoDelete(true); @@ -1322,5 +1326,5 @@ int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) { nAttribs = itemDataList.count(); for (z = 0; z < nAttribs; z++) { - qDebug("HlManager::makeAttribs: createing one attribute definition"); + odebug << "HlManager::makeAttribs: createing one attribute definition" << oendl; itemData = itemDataList.at(z); if (itemData->defStyle) { @@ -1416,5 +1420,5 @@ void HlManager::setDefaults(ItemStyleList &list) { char s[64]; #warning fixme -/* +/* config = KateFactory::instance()->config(); config->setGroup("Default Item Styles"); diff --git a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp index 6059e9b..9fa4452 100644 --- a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp +++ b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp @@ -17,13 +17,18 @@ #include "katesyntaxdocument.h" -#include <kateconfig.h> +#include "kateconfig.h" +#include "kdebug.h" +#include "kstddirs.h" +#include "klocale.h" +#include "kmessagebox.h" +#include "kglobal.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/qpeapplication.h> + +/* QT */ #include <qfile.h> -#include <kdebug.h> -#include <kstddirs.h> -#include <klocale.h> -#include <kmessagebox.h> #include <qstringlist.h> -#include <kglobal.h> -#include <qpe/qpeapplication.h> #include <qdir.h> @@ -40,5 +45,5 @@ void SyntaxDocument::setIdentifier(const QString& identifier) m_root=Opie::Core::XMLElement::load(identifier); if (!m_root) KMessageBox::error( 0L, i18n("Can't open %1").arg(identifier) ); - + } @@ -77,11 +82,11 @@ void SyntaxDocument::setupModeList(bool force) else { - qDebug("Found a description file:"+path+(*it)); + odebug << "Found a description file:"+path+(*it) << oendl; setIdentifier(path+(*it)); Opie::Core::XMLElement *e=m_root; if (e) { - e=e->firstChild(); - qDebug(e->tagName()); + e=e->firstChild(); + odebug << e->tagName() << oendl; if (e->tagName()=="language") { @@ -91,5 +96,5 @@ void SyntaxDocument::setupModeList(bool force) mli->mimetype = e->attribute("mimetype"); mli->extension = e->attribute("extensions"); - qDebug(QString("valid description for: %1/%2").arg(mli->section).arg(mli->name)); + odebug << QString("valid description for: %1/%2").arg(mli->section).arg(mli->name) << oendl; if (mli->section.isEmpty()) mli->section=i18n("Other"); @@ -181,7 +186,7 @@ syntaxContextData* SyntaxDocument::getSubItems(syntaxContextData* data) { syntaxContextData *retval=new syntaxContextData; - retval->parent=0; - retval->currentGroup=0; - retval->item=0; + retval->parent=0; + retval->currentGroup=0; + retval->item=0; if (data != 0) { @@ -213,6 +218,6 @@ syntaxContextData* SyntaxDocument::getConfig(const QString& mainGroupName, const { syntaxContextData *data=new ( syntaxContextData); - data->currentGroup=0; - data->parent=0; + data->currentGroup=0; + data->parent=0; data->item=e1; return data; @@ -255,6 +260,6 @@ syntaxContextData* SyntaxDocument::getGroupInfo(const QString& mainGroupName, co syntaxContextData *data=new ( syntaxContextData); data->parent=e1; - data->currentGroup=0; - data->item=0; + data->currentGroup=0; + data->item=0; return data; } @@ -285,17 +290,17 @@ QStringList& SyntaxDocument::finddata(const QString& mainGroup,const QString& ty if (e->tagName()==mainGroup) { - for (Opie::Core::XMLElement *e1=e->firstChild();e1;e1=e1->nextChild()) - { - if (e1->tagName()!="list") continue; - - if (e1->attribute("name")==type) - { - for (Opie::Core::XMLElement *e2=e1->firstChild();e2;e2=e2->nextChild()) - { - qDebug("FOUND A LIST ENTRY("+e2->tagName()+"):"+e2->firstChild()->value()); - m_data+=e2->firstChild()->value().stripWhiteSpace(); - } - break; - } + for (Opie::Core::XMLElement *e1=e->firstChild();e1;e1=e1->nextChild()) + { + if (e1->tagName()!="list") continue; + + if (e1->attribute("name")==type) + { + for (Opie::Core::XMLElement *e2=e1->firstChild();e2;e2=e2->nextChild()) + { + odebug << "FOUND A LIST ENTRY("+e2->tagName()+"):"+e2->firstChild()->value() << oendl; + m_data+=e2->firstChild()->value().stripWhiteSpace(); + } + break; + } } break; diff --git a/noncore/apps/tinykate/libkate/kateconfig.cpp b/noncore/apps/tinykate/libkate/kateconfig.cpp index 96f91fb..782b629 100644 --- a/noncore/apps/tinykate/libkate/kateconfig.cpp +++ b/noncore/apps/tinykate/libkate/kateconfig.cpp @@ -19,4 +19,12 @@ **********************************************************************/ +#define QTOPIA_INTERNAL_LANGLIST +#include "kateconfig.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/global.h> + +/* QT */ #include <qdir.h> #include <qmessagebox.h> @@ -26,4 +34,5 @@ #include <qtextstream.h> +/* STD */ #include <sys/stat.h> #include <sys/types.h> @@ -32,8 +41,4 @@ #include <unistd.h> -#define QTOPIA_INTERNAL_LANGLIST -#include "kateconfig.h" -#include <qpe/global.h> - /*! @@ -43,12 +48,12 @@ QString KateConfig::configFilename(const QString& name, Domain d) { switch (d) { - case File: - return name; - case User: { - QDir dir = (QString(getenv("HOME")) + "/Settings"); - if ( !dir.exists() ) - mkdir(dir.path().local8Bit(),0700); - return dir.path() + "/" + name + ".conf"; - } + case File: + return name; + case User: { + QDir dir = (QString(getenv("HOME")) + "/Settings"); + if ( !dir.exists() ) + mkdir(dir.path().local8Bit(),0700); + return dir.path() + "/" + name + ".conf"; + } } return name; @@ -94,5 +99,5 @@ KateConfig::KateConfig( const QString &name, Domain domain ) : filename( configFilename(name,domain) ) { - qWarning("KateConfig constructor\n"); + owarn << "KateConfig constructor\n" << oendl; git = groups.end(); read(); @@ -105,5 +110,5 @@ KateConfig::KateConfig( const QString &name, Domain domain ) // Sharp ROM compatibility KateConfig::KateConfig ( const QString &name, bool what ) - : filename( configFilename(name,what ? User : File) ) + : filename( configFilename(name,what ? User : File) ) { git = groups.end(); @@ -119,7 +124,7 @@ KateConfig::KateConfig ( const QString &name, bool what ) KateConfig::~KateConfig() { - qWarning("KateConfig destructor\n"); + owarn << "KateConfig destructor\n" << oendl; if ( changed ) - write(); + write(); } @@ -130,5 +135,5 @@ bool KateConfig::hasKey( const QString &key ) const { if ( groups.end() == git ) - return FALSE; + return FALSE; KateConfigGroup::ConstIterator it = ( *git ).find( key ); return it != ( *git ).end(); @@ -148,7 +153,7 @@ void KateConfig::setGroup( const QString &gname ) QMap< QString, KateConfigGroup>::Iterator it = groups.find( gname ); if ( it == groups.end() ) { - git = groups.insert( gname, KateConfigGroup() ); - changed = TRUE; - return; + git = groups.insert( gname, KateConfigGroup() ); + changed = TRUE; + return; } git = it; @@ -173,10 +178,10 @@ void KateConfig::writeEntry( const QString &key, const QString &value ) { if ( git == groups.end() ) { - qWarning( "no group set" ); - return; + owarn << "no group set" << oendl; + return; } if ( (*git)[key] != value ) { - ( *git ).insert( key, value ); - changed = TRUE; + ( *git ).insert( key, value ); + changed = TRUE; } } @@ -197,10 +202,10 @@ static QString encipher(const QString& plain) int mix=28730492; for (int i=0; i<(int)plain.length(); i++) { - int u = plain[i].unicode(); - int c = u ^ mix; - QString x = QString::number(c,36); - cipher.append(QChar('a'+x.length())); - cipher.append(x); - mix *= u; + int u = plain[i].unicode(); + int c = u ^ mix; + QString x = QString::number(c,36); + cipher.append(QChar('a'+x.length())); + cipher.append(x); + mix *= u; } return cipher; @@ -212,9 +217,9 @@ static QString decipher(const QString& cipher) int mix=28730492; for (int i=0; i<(int)cipher.length();) { - int l = cipher[i].unicode()-'a'; - QString x = cipher.mid(i+1,l); i+=l+1; - int u = x.toInt(0,36) ^ mix; - plain.append(QChar(u)); - mix *= u; + int l = cipher[i].unicode()-'a'; + QString x = cipher.mid(i+1,l); i+=l+1; + int u = x.toInt(0,36) ^ mix; + plain.append(QChar(u)); + mix *= u; } return plain; @@ -233,11 +238,11 @@ void KateConfig::writeEntryCrypt( const QString &key, const QString &value ) { if ( git == groups.end() ) { - qWarning( "no group set" ); - return; + owarn << "no group set" << oendl; + return; } QString evalue = encipher(value); if ( (*git)[key] != evalue ) { - ( *git ).insert( key, evalue ); - changed = TRUE; + ( *git ).insert( key, evalue ); + changed = TRUE; } } @@ -288,5 +293,5 @@ void KateConfig::writeEntry( const QString &key, const QStringList &lst, const Q QStringList::ConstIterator it = lst.begin(); for ( ; it != lst.end(); ++it ) - s += *it + sep; + s += *it + sep; writeEntry( key, s ); } @@ -298,5 +303,5 @@ void KateConfig::writeEntry( const QString &key, const QColor &val ) l.append( QString().setNum(val.green()) ); l.append( QString().setNum(val.blue()) ); - + writeEntry( key, l, QChar(',') ); } @@ -310,5 +315,5 @@ void KateConfig::writeEntry( const QString &key, const QFont &val ) l.append( QString().setNum((int)val.italic()) ); l.append( QString().setNum((int)val.charSet()) ); - + writeEntry( key, l, QChar(',') ); } @@ -322,6 +327,6 @@ void KateConfig::removeEntry( const QString &key ) { if ( git == groups.end() ) { - qWarning( "no group set" ); - return; + owarn << "no group set" << oendl; + return; } ( *git ).remove( key ); @@ -355,9 +360,9 @@ QString KateConfig::readEntry( const QString &key, const QString &deflt ) QString res = readEntryDirect( key+"["+lang+"]" ); if ( !res.isNull() ) - return res; + return res; if ( !glang.isEmpty() ) { - res = readEntryDirect( key+"["+glang+"]" ); - if ( !res.isNull() ) - return res; + res = readEntryDirect( key+"["+glang+"]" ); + if ( !res.isNull() ) + return res; } return readEntryDirect( key, deflt ); @@ -378,9 +383,9 @@ QString KateConfig::readEntryCrypt( const QString &key, const QString &deflt ) QString res = readEntryDirect( key+"["+lang+"]" ); if ( res.isNull() && glang.isEmpty() ) - res = readEntryDirect( key+"["+glang+"]" ); + res = readEntryDirect( key+"["+glang+"]" ); if ( res.isNull() ) - res = readEntryDirect( key, QString::null ); + res = readEntryDirect( key, QString::null ); if ( res.isNull() ) - return deflt; + return deflt; return decipher(res); } @@ -398,12 +403,12 @@ QString KateConfig::readEntryDirect( const QString &key, const QString &deflt ) { if ( git == groups.end() ) { - //qWarning( "no group set" ); - return deflt; + //owarn << "no group set" << oendl; + return deflt; } KateConfigGroup::ConstIterator it = ( *git ).find( key ); if ( it != ( *git ).end() ) - return *it; + return *it; else - return deflt; + return deflt; } @@ -421,7 +426,7 @@ int KateConfig::readNumEntry( const QString &key, int deflt ) QString s = readEntry( key ); if ( s.isEmpty() ) - return deflt; + return deflt; else - return s.toInt(); + return s.toInt(); } @@ -439,7 +444,7 @@ bool KateConfig::readBoolEntry( const QString &key, bool deflt ) QString s = readEntry( key ); if ( s.isEmpty() ) - return deflt; + return deflt; else - return (bool)s.toInt(); + return (bool)s.toInt(); } @@ -457,7 +462,7 @@ QStringList KateConfig::readListEntry( const QString &key, const QChar &sep ) QString s = readEntry( key ); if ( s.isEmpty() ) - return QStringList(); + return QStringList(); else - return QStringList::split( sep, s ); + return QStringList::split( sep, s ); } @@ -485,5 +490,5 @@ QValueList<int> KateConfig::readIntListEntry( const QString &key ) const QValueList<int> il; if ( s.isEmpty() ) - return il; + return il; QStringList l = QStringList::split( QChar(','), s ); @@ -501,10 +506,10 @@ void KateConfig::clearGroup() { if ( git == groups.end() ) { - qWarning( "no group set" ); - return; + owarn << "no group set" << oendl; + return; } if ( !(*git).isEmpty() ) { - ( *git ).clear(); - changed = TRUE; + ( *git ).clear(); + changed = TRUE; } } @@ -517,43 +522,43 @@ void KateConfig::write( const QString &fn ) QString strNewFile; if ( !fn.isEmpty() ) - filename = fn; + filename = fn; strNewFile = filename + ".new"; QFile f( strNewFile ); if ( !f.open( IO_WriteOnly|IO_Raw ) ) { - qWarning( "could not open for writing `%s'", strNewFile.latin1() ); - git = groups.end(); - return; + owarn << "could not open for writing `" << strNewFile << "'" << oendl; + git = groups.end(); + return; } - + QString str; - QCString cstr; + QCString cstr; QMap< QString, KateConfigGroup >::Iterator g_it = groups.begin(); for ( ; g_it != groups.end(); ++g_it ) { - str += "[" + g_it.key() + "]\n"; - KateConfigGroup::Iterator e_it = ( *g_it ).begin(); - for ( ; e_it != ( *g_it ).end(); ++e_it ) - str += e_it.key() + " = " + *e_it + "\n"; + str += "[" + g_it.key() + "]\n"; + KateConfigGroup::Iterator e_it = ( *g_it ).begin(); + for ( ; e_it != ( *g_it ).end(); ++e_it ) + str += e_it.key() + " = " + *e_it + "\n"; } cstr = str.utf8(); - + int total_length; total_length = f.writeBlock( cstr.data(), cstr.length() ); if ( total_length != int(cstr.length()) ) { - QMessageBox::critical( 0, QObject::tr("Out of Space"), - QObject::tr("There was a problem creating\nKateConfiguration Information \nfor this program.\n\nPlease free up some space and\ntry again.") ); - f.close(); - QFile::remove( strNewFile ); - return; + QMessageBox::critical( 0, QObject::tr("Out of Space"), + QObject::tr("There was a problem creating\nKateConfiguration Information \nfor this program.\n\nPlease free up some space and\ntry again.") ); + f.close(); + QFile::remove( strNewFile ); + return; } - + f.close(); // now rename the file... if ( rename( strNewFile, filename ) < 0 ) { - qWarning( "problem renaming the file %s to %s", strNewFile.latin1(), - filename.latin1() ); - QFile::remove( strNewFile ); - } + qWarning( "problem renaming the file %s to %s", strNewFile.latin1(), + filename.latin1() ); + QFile::remove( strNewFile ); + } } @@ -574,12 +579,12 @@ void KateConfig::read() if ( !QFileInfo( filename ).exists() ) { - git = groups.end(); - return; + git = groups.end(); + return; } QFile f( filename ); if ( !f.open( IO_ReadOnly ) ) { - git = groups.end(); - return; + git = groups.end(); + return; } @@ -609,23 +614,23 @@ bool KateConfig::parse( const QString &l ) { QString line = l.stripWhiteSpace(); - + if ( line [0] == QChar ( '#' )) - return true; // ignore comments - + return true; // ignore comments + if ( line[ 0 ] == QChar( '[' ) ) { - QString gname = line; - gname = gname.remove( 0, 1 ); - if ( gname[ (int)gname.length() - 1 ] == QChar( ']' ) ) - gname = gname.remove( gname.length() - 1, 1 ); - git = groups.insert( gname, KateConfigGroup() ); + QString gname = line; + gname = gname.remove( 0, 1 ); + if ( gname[ (int)gname.length() - 1 ] == QChar( ']' ) ) + gname = gname.remove( gname.length() - 1, 1 ); + git = groups.insert( gname, KateConfigGroup() ); } else if ( !line.isEmpty() ) { - if ( git == groups.end() ) - return FALSE; - int eq = line.find( '=' ); - if ( eq == -1 ) - return FALSE; - QString key = line.left(eq).stripWhiteSpace(); - QString value = line.mid(eq+1).stripWhiteSpace(); - ( *git ).insert( key, value ); + if ( git == groups.end() ) + return FALSE; + int eq = line.find( '=' ); + if ( eq == -1 ) + return FALSE; + QString key = line.left(eq).stripWhiteSpace(); + QString value = line.mid(eq+1).stripWhiteSpace(); + ( *git ).insert( key, value ); } return TRUE; |