From 412619441fab46fc79c695a23ccf9e38135bdfad Mon Sep 17 00:00:00 2001 From: ar Date: Mon, 03 May 2004 21:35:18 +0000 Subject: - convert qDebug to odebug --- (limited to 'noncore/apps/tinykate') 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 @@ -22,24 +22,25 @@ #include "katebuffer.h" +#include "kdebug.h" -// Includes for reading file -#include -#include -#include -#include -#include +/* OPIE */ +#include +/* QT */ #include #include - #include #include -// - +/* STD */ +// Includes for reading file +#include +#include +#include +#include +#include #include -#include /** * Create an empty buffer. @@ -65,35 +66,35 @@ KWBuffer::clear() 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; + } } void @@ -121,9 +122,9 @@ KWBuffer::slotLoadFile() 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; } @@ -148,9 +149,9 @@ void KWBuffer::seek(int i) 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; } void 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 @@ -6,7 +6,7 @@ (C) 2002 by Joseph Wenninger email : crossfire@babylon2k.de jowenn@kde.org - + ***************************************************************************/ /*************************************************************************** @@ -39,20 +39,31 @@ */ #include "katedocument.h" +#include "kmessagebox.h" +#include "kglobal.h" +//#include "kcharsets.h" +#include "kdebug.h" +//#include "kinstance.h" -#include -#include +#include "kglobalsettings.h" +//#include "kaction.h" +//#include "kstdaction.h" -#include -#include -#include +#include "../view/kateview.h" +#include "katebuffer.h" +#include "katetextline.h" -#include -#include +#include "katecmd.h" -#include +/* OPIE */ +#include +#include +/* QT */ +#include +#include +#include #include #include #include @@ -62,21 +73,11 @@ #include #include #include -#include -//#include -#include -//#include - -#include -//#include -//#include - -#include "../view/kateview.h" -#include "katebuffer.h" -#include "katetextline.h" - -#include "katecmd.h" +/* STD */ +#include +#include +#include KateAction::KateAction(Action a, PointStruc &cursor, int len, const QString &text) : action(a), cursor(cursor), len(len), text(text) { @@ -130,7 +131,7 @@ QStringList KateDocument::replaceWithList = QStringList(); uint KateDocument::uniqueID = 0; -QPtrDict* KateDocument::d_ptr = 0; +QPtrDict* KateDocument::d_ptr = 0; KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView, @@ -141,8 +142,8 @@ KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView, myFontMetrics (myFont), myFontMetricsBold (myFontBold), myFontMetricsItalic (myFontItalic), myFontMetricsBI (myFontBI), hlManager(HlManager::self ()) { - - d(this)->hlSetByUser = false; + + d(this)->hlSetByUser = false; PreHighlightedTill=0; RequestPreHighlightTill=0; @@ -152,7 +153,7 @@ KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView, m_url = QString::null; // 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()); @@ -292,20 +293,20 @@ KateDocument::~KateDocument() void KateDocument::openURL(const QString &filename) { - m_file=filename; + m_file=filename; fileInfo->setFile (m_file); setMTime(); 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 ; } buffer->clear(); #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()); setMTime(); @@ -321,13 +322,13 @@ void KateDocument::openURL(const QString &filename) updateViews(); emit fileNameChanged(); - + return ; } bool KateDocument::saveFile() { - + QFile f( m_file ); if ( !f.open( IO_WriteOnly ) ) return false; // Error @@ -611,7 +612,7 @@ void KateDocument::readConfig() colors[0] = config->readColorEntry("Color Background", colors[0]); colors[1] = config->readColorEntry("Color Selected", colors[1]); - + // config->sync(); } @@ -683,7 +684,7 @@ 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(); updateLines(); @@ -1923,8 +1924,8 @@ void KateDocument::updateLines(int startLine, int endLine, int flags, int cursor updateMaxLength(textLine); } endCtx = textLine->getContext(); -// qDebug("DOHIGHLIGHT"); - +// odebug << "DOHIGHLIGHT" << oendl; + ctxNum = m_highlight->doHighlight(ctxNum,textLine); textLine->setContext(ctxNum); line++; 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 @@ -1,8 +1,8 @@ /* Copyright (C) 1998, 1999 Jochen Wilhelmy digisnap@cs.tu-berlin.de - (C) 2002, 2001 The Kate Team - (C) 2002 Joseph Wenninger + (C) 2002, 2001 The Kate Team + (C) 2002 Joseph Wenninger This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,26 +19,30 @@ Boston, MA 02111-1307, USA. */ -#include - -#include -#include -#include -//#include -//#include -#include -//#include -#include -#include -#include - #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 +#include + +/* QT */ +#include + +/* STD */ +#include + HlManager *HlManager::s_pSelf = 0; @@ -120,8 +124,8 @@ const QChar *HlStringDetect::checkHgl(const QChar *s, int len, bool) { if (!_inSensitive) {if (memcmp(s, str.unicode(), str.length()*sizeof(QChar)) == 0) return s + str.length();} 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; } @@ -213,10 +217,10 @@ 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; } } return s; @@ -248,14 +252,14 @@ const QChar *HlFloat::checkHgl(const QChar *s, int len, bool) { if ((*s&0xdf) == 'E') s++; 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; } } return s; @@ -345,7 +349,7 @@ const QChar *HlCHex::checkHgl(const QChar *str, int len, bool) { int pos=rx.search(line,0); if(pos > -1) return str+rx.matchedLength(); else - return 0L; + return 0L; #else if (str[0] == '0' && ((str[1]&0xdf) == 'X' )) { @@ -400,7 +404,7 @@ const QChar *HlRegExpr::checkHgl(const QChar *s, int len, bool lineStart) int pos = Expr->search( line, 0 ); if (pos==-1) return 0L; else - return (s+Expr->matchedLength()); + return (s+Expr->matchedLength()); }; @@ -411,9 +415,9 @@ HlLineContinue::HlLineContinue(int attribute, int context) const QChar *HlLineContinue::checkHgl(const QChar *s, int len, bool) { if ((s[0].latin1() == '\\') && (len == 1)) - { + { return s + 1; - } + } return 0L; } @@ -621,7 +625,7 @@ int Highlight::doHighlight(int ctxNum, TextLine *textLine) s2 = item->checkHgl(s1, len-z, z==0); 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; context = contextList[ctxNum]; @@ -853,7 +857,7 @@ 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. if (noHl) @@ -874,7 +878,7 @@ void Highlight::createItemData(ItemDataList &list) internalIDList.setAutoDelete(true); 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 HlManager::self()->syntax->setIdentifier(identifier); @@ -882,7 +886,7 @@ void Highlight::createItemData(ItemDataList &list) //begin with the real parsing 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")); selColor=HlManager::self()->syntax->groupData(data,QString("selColor")); @@ -933,12 +937,12 @@ void Highlight::createItemData(ItemDataList &list) int Highlight::lookupAttrName(const QString& name, ItemDataList &iDl) { - for (int i=0;iname==name) return i; - } - kdDebug(13010)<<"Couldn't resolve itemDataName"<name==name) return i; + } + kdDebug(13010)<<"Couldn't resolve itemDataName"<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"); } } HlManager::self()->syntax->freeGroupInfo(data); @@ -1112,10 +1116,10 @@ void Highlight::readGlobalKeywordConfig() syntaxContextData * data=HlManager::self()->syntax->getConfig("general","keywords"); if (data) { - kdDebug(13010)<<"Found global keyword config"<syntax->groupItemData(data,QString("casesensitive"))!="0") - casesensitive=true; else {casesensitive=false; kdDebug(13010)<<"Turning on case insensitiveness"<syntax->groupItemData(data,QString("weakDeliminator"))); @@ -1133,7 +1137,7 @@ void Highlight::readGlobalKeywordConfig() deliminatorChars = deliminator.unicode(); deliminatorLen = deliminator.length(); - HlManager::self()->syntax->freeGroupInfo(data); + HlManager::self()->syntax->freeGroupInfo(data); } else { @@ -1204,25 +1208,25 @@ void Highlight::makeContextList() //Let's create all items for the context while (HlManager::self()->syntax->nextItem(data)) { -// kdDebug(13010)<< "In make Contextlist: Item:"<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; - 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"<getItemDataList(itemDataList); 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) { // default style @@ -1415,7 +1419,7 @@ void HlManager::setDefaults(ItemStyleList &list) { ItemStyle *i; char s[64]; #warning fixme -/* +/* config = KateFactory::instance()->config(); config->setGroup("Default Item Styles"); for (z = 0; z < defaultStyles(); z++) { 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 @@ -16,15 +16,20 @@ ***************************************************************************/ #include "katesyntaxdocument.h" -#include +#include "kateconfig.h" +#include "kdebug.h" +#include "kstddirs.h" +#include "klocale.h" +#include "kmessagebox.h" +#include "kglobal.h" + +/* OPIE */ +#include +#include + +/* QT */ #include -#include -#include -#include -#include #include -#include -#include #include SyntaxDocument::SyntaxDocument() @@ -39,7 +44,7 @@ void SyntaxDocument::setIdentifier(const QString& identifier) #warning FIXME delete m_root; m_root=Opie::Core::XMLElement::load(identifier); if (!m_root) KMessageBox::error( 0L, i18n("Can't open %1").arg(identifier) ); - + } SyntaxDocument::~SyntaxDocument() @@ -76,13 +81,13 @@ 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") { syntaxModeListItem *mli=new syntaxModeListItem; @@ -90,7 +95,7 @@ void SyntaxDocument::setupModeList(bool force) mli->section = e->attribute("section"); 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"); @@ -180,9 +185,9 @@ void SyntaxDocument::freeGroupInfo( syntaxContextData* data) 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) { retval->parent=data->currentGroup; @@ -212,8 +217,8 @@ syntaxContextData* SyntaxDocument::getConfig(const QString& mainGroupName, const if (e1->tagName()==Config) { syntaxContextData *data=new ( syntaxContextData); - data->currentGroup=0; - data->parent=0; + data->currentGroup=0; + data->parent=0; data->item=e1; return data; } @@ -254,8 +259,8 @@ 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; } @@ -284,19 +289,19 @@ 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 @@ -18,6 +18,14 @@ ** **********************************************************************/ +#define QTOPIA_INTERNAL_LANGLIST +#include "kateconfig.h" + +/* OPIE */ +#include +#include + +/* QT */ #include #include #if QT_VERSION <= 230 && defined(QT_NO_CODECS) @@ -25,16 +33,13 @@ #endif #include +/* STD */ #include #include #include #include #include -#define QTOPIA_INTERNAL_LANGLIST -#include "kateconfig.h" -#include - /*! \internal @@ -42,14 +47,14 @@ 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; } @@ -93,7 +98,7 @@ QString KateConfig::configFilename(const QString& name, Domain d) KateConfig::KateConfig( const QString &name, Domain domain ) : filename( configFilename(name,domain) ) { - qWarning("KateConfig constructor\n"); + owarn << "KateConfig constructor\n" << oendl; git = groups.end(); read(); QStringList l = Global::languageList(); @@ -104,7 +109,7 @@ 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(); read(); @@ -118,9 +123,9 @@ KateConfig::KateConfig ( const QString &name, bool what ) */ KateConfig::~KateConfig() { - qWarning("KateConfig destructor\n"); + owarn << "KateConfig destructor\n" << oendl; if ( changed ) - write(); + write(); } /*! @@ -129,7 +134,7 @@ KateConfig::~KateConfig() 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(); } @@ -147,9 +152,9 @@ 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; } @@ -172,12 +177,12 @@ void KateConfig::writeEntry( const QString &key, const char* value ) 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; } } @@ -196,12 +201,12 @@ static QString encipher(const QString& plain) QString cipher; 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; } @@ -211,11 +216,11 @@ static QString decipher(const QString& cipher) QString plain; 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; } @@ -232,13 +237,13 @@ static QString decipher(const QString& cipher) 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; } } @@ -287,7 +292,7 @@ void KateConfig::writeEntry( const QString &key, const QStringList &lst, const Q QString s; QStringList::ConstIterator it = lst.begin(); for ( ; it != lst.end(); ++it ) - s += *it + sep; + s += *it + sep; writeEntry( key, s ); } @@ -297,7 +302,7 @@ void KateConfig::writeEntry( const QString &key, const QColor &val ) l.append( QString().setNum(val.red()) ); l.append( QString().setNum(val.green()) ); l.append( QString().setNum(val.blue()) ); - + writeEntry( key, l, QChar(',') ); } @@ -309,7 +314,7 @@ void KateConfig::writeEntry( const QString &key, const QFont &val ) l.append( QString().setNum(val.weight()) ); l.append( QString().setNum((int)val.italic()) ); l.append( QString().setNum((int)val.charSet()) ); - + writeEntry( key, l, QChar(',') ); } @@ -321,8 +326,8 @@ void KateConfig::writeEntry( const QString &key, const QFont &val ) void KateConfig::removeEntry( const QString &key ) { if ( git == groups.end() ) { - qWarning( "no group set" ); - return; + owarn << "no group set" << oendl; + return; } ( *git ).remove( key ); changed = TRUE; @@ -354,11 +359,11 @@ 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 ); } @@ -377,11 +382,11 @@ 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); } @@ -397,14 +402,14 @@ QString KateConfig::readEntryCrypt( const QString &key, const QString &deflt ) 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; } /*! @@ -420,9 +425,9 @@ 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(); } /*! @@ -438,9 +443,9 @@ 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(); } /*! @@ -456,9 +461,9 @@ 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 ); } QColor KateConfig::readColorEntry( const QString &key, const QColor &def ) const @@ -484,7 +489,7 @@ QValueList KateConfig::readIntListEntry( const QString &key ) const QString s = readEntry( key ); QValueList il; if ( s.isEmpty() ) - return il; + return il; QStringList l = QStringList::split( QChar(','), s ); @@ -500,12 +505,12 @@ QValueList KateConfig::readIntListEntry( const QString &key ) const 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; } } @@ -516,45 +521,45 @@ 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 ); + } } /*! @@ -573,14 +578,14 @@ void KateConfig::read() changed = FALSE; 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; } QTextStream s( &f ); @@ -608,25 +613,25 @@ void KateConfig::read() 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; } diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp index 3c9a637..9865c35 100644 --- a/noncore/apps/tinykate/tinykate.cpp +++ b/noncore/apps/tinykate/tinykate.cpp @@ -14,18 +14,23 @@ * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * * * ***************************************************************************/ -#include -#include -#include -#include -#include +#include "tinykate.h" + +#include "katedocument.h" +#include "kglobal.h" + +/* OPIE */ +#include #include +#include +#include -#include "tinykate.h" +/* QT */ +#include +#include +#include -#include -#include using namespace Opie::Ui; TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : @@ -152,7 +157,7 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : TinyKate::~TinyKate( ) { - qWarning("TinyKate destructor\n"); + owarn << "TinyKate destructor\n" << oendl; shutDown=true; while (currentView!=0) { @@ -160,7 +165,7 @@ TinyKate::~TinyKate( ) } if( KGlobal::config() != 0 ) { - qWarning("deleting KateConfig object..\n"); + owarn << "deleting KateConfig object..\n" << oendl; delete KGlobal::config(); } } @@ -181,7 +186,7 @@ void TinyKate::open(const QString & filename) QFileInfo fi(filename); QString filenamed = fi.fileName(); tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); - qDebug(filename); + odebug << filename << oendl; kd->setDocName( filenamed); kd->open( filename ); @@ -249,7 +254,7 @@ void TinyKate::slotSave() { // KateView *kv = (KateView*) currentView; KateDocument *kd = (KateDocument*) currentView->document(); - // qDebug("saving file "+kd->docName()); + // odebug << "saving file "+kd->docName() << oendl; if( kd->docName().isEmpty()) slotSaveAs(); else @@ -265,7 +270,7 @@ void TinyKate::slotSaveAs() { QString filename= OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, QString::null); if (!filename.isEmpty()) { - qDebug("saving file "+filename); + odebug << "saving file "+filename << oendl; QFileInfo fi(filename); QString filenamed = fi.fileName(); kd->setDocFile( filename); -- cgit v0.9.0.2