summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate
Side-by-side diff
Diffstat (limited to 'noncore/apps/tinykate') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/document/katebuffer.cpp89
-rw-r--r--noncore/apps/tinykate/libkate/document/katedocument.cpp73
-rw-r--r--noncore/apps/tinykate/libkate/document/katehighlight.cpp126
-rw-r--r--noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp69
-rw-r--r--noncore/apps/tinykate/libkate/kateconfig.cpp219
-rw-r--r--noncore/apps/tinykate/tinykate.cpp31
6 files changed, 314 insertions, 293 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
@@ -24,13 +24,10 @@
#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>
@@ -38,6 +35,10 @@
-//
-
+/* 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>
@@ -67,31 +68,31 @@ 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;
+ }
}
@@ -123,5 +124,5 @@ 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;
@@ -150,5 +151,5 @@ 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
@@ -8,3 +8,3 @@
jowenn@kde.org
-
+
***************************************************************************/
@@ -41,16 +41,27 @@
#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>
@@ -64,17 +75,7 @@
#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>
@@ -132,3 +133,3 @@ uint KateDocument::uniqueID = 0;
-QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0;
+QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0;
@@ -143,4 +144,4 @@ KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView,
{
-
- d(this)->hlSetByUser = false;
+
+ d(this)->hlSetByUser = false;
PreHighlightedTill=0;
@@ -154,3 +155,3 @@ 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)
@@ -294,3 +295,3 @@ void KateDocument::openURL(const QString &filename)
- m_file=filename;
+ m_file=filename;
fileInfo->setFile (m_file);
@@ -300,3 +301,3 @@ void KateDocument::openURL(const QString &filename)
{
- qDebug("File doesn't exit or couldn't be read");
+ odebug << "File doesn't exit or couldn't be read" << oendl;
return ;
@@ -307,3 +308,3 @@ void KateDocument::openURL(const QString &filename)
// 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());
@@ -323,3 +324,3 @@ void KateDocument::openURL(const QString &filename)
emit fileNameChanged();
-
+
return ;
@@ -329,3 +330,3 @@ bool KateDocument::saveFile()
{
-
+
QFile f( m_file );
@@ -613,3 +614,3 @@ void KateDocument::readConfig()
colors[1] = config->readColorEntry("Color Selected", colors[1]);
-
+
// config->sync();
@@ -685,3 +686,3 @@ void KateDocument::setHighlight(int n) {
void KateDocument::makeAttribs() {
- qDebug("KateDocument::makeAttribs()");
+ odebug << "KateDocument::makeAttribs()" << oendl;
m_numAttribs = hlManager->makeAttribs(m_highlight, m_attribs, maxAttribs);
@@ -1925,4 +1926,4 @@ 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);
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
@@ -3,4 +3,4 @@
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
@@ -21,18 +21,3 @@
-#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"
@@ -41,2 +26,21 @@
+#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>
+
@@ -122,4 +126,4 @@ const QChar *HlStringDetect::checkHgl(const QChar *s, int len, bool) {
{
- 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();
}
@@ -215,6 +219,6 @@ const QChar *HlInt::checkHgl(const QChar *str, int len, bool) {
{
- 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;
}
@@ -250,10 +254,10 @@ const QChar *HlFloat::checkHgl(const QChar *s, int len, bool) {
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;
}
@@ -347,3 +351,3 @@ const QChar *HlCHex::checkHgl(const QChar *str, int len, bool) {
else
- return 0L;
+ return 0L;
@@ -402,3 +406,3 @@ const QChar *HlRegExpr::checkHgl(const QChar *s, int len, bool lineStart)
else
- return (s+Expr->matchedLength());
+ return (s+Expr->matchedLength());
};
@@ -413,5 +417,5 @@ const QChar *HlLineContinue::checkHgl(const QChar *s, int len, bool) {
if ((s[0].latin1() == '\\') && (len == 1))
- {
+ {
return s + 1;
- }
+ }
return 0L;
@@ -623,3 +627,3 @@ int Highlight::doHighlight(int ctxNum, TextLine *textLine)
{
- qDebug("An item has been detected");
+ odebug << "An item has been detected" << oendl;
textLine->setAttribs(item->attr,s1 - str,s2 - str);
@@ -855,3 +859,3 @@ void Highlight::createItemData(ItemDataList &list)
{
- qDebug("Highlight::createItemData");
+ odebug << "Highlight::createItemData" << oendl;
@@ -876,3 +880,3 @@ void Highlight::createItemData(ItemDataList &list)
- qDebug("Trying to read itemData section");
+ odebug << "Trying to read itemData section" << oendl;
@@ -884,3 +888,3 @@ void Highlight::createItemData(ItemDataList &list)
{
- qDebug("Setting up one itemData element");
+ odebug << "Setting up one itemData element" << oendl;
// read all attributes
@@ -935,8 +939,8 @@ 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;
}
@@ -1079,7 +1083,7 @@ 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");
}
@@ -1114,6 +1118,6 @@ void Highlight::readGlobalKeywordConfig()
{
- 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
@@ -1135,3 +1139,3 @@ void Highlight::readGlobalKeywordConfig()
- HlManager::self()->syntax->freeGroupInfo(data);
+ HlManager::self()->syntax->freeGroupInfo(data);
}
@@ -1206,6 +1210,6 @@ void Highlight::makeContextList()
{
-// 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);
@@ -1213,14 +1217,14 @@ void Highlight::makeContextList()
// 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;
}
@@ -1314,3 +1318,3 @@ int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) {
- qDebug("HlManager::makeAttribs");
+ odebug << "HlManager::makeAttribs" << oendl;
@@ -1323,3 +1327,3 @@ int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) {
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);
@@ -1417,3 +1421,3 @@ void HlManager::setDefaults(ItemStyleList &list) {
#warning fixme
-/*
+/*
config = KateFactory::instance()->config();
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
@@ -18,11 +18,16 @@
#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>
@@ -41,3 +46,3 @@ void SyntaxDocument::setIdentifier(const QString& identifier)
if (!m_root) KMessageBox::error( 0L, i18n("Can't open %1").arg(identifier) );
-
+
}
@@ -78,3 +83,3 @@ void SyntaxDocument::setupModeList(bool force)
{
- qDebug("Found a description file:"+path+(*it));
+ odebug << "Found a description file:"+path+(*it) << oendl;
setIdentifier(path+(*it));
@@ -83,4 +88,4 @@ void SyntaxDocument::setupModeList(bool force)
{
- e=e->firstChild();
- qDebug(e->tagName());
+ e=e->firstChild();
+ odebug << e->tagName() << oendl;
if (e->tagName()=="language")
@@ -92,3 +97,3 @@ void SyntaxDocument::setupModeList(bool force)
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())
@@ -182,5 +187,5 @@ 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)
@@ -214,4 +219,4 @@ 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;
@@ -256,4 +261,4 @@ syntaxContextData* SyntaxDocument::getGroupInfo(const QString& mainGroupName, co
data->parent=e1;
- data->currentGroup=0;
- data->item=0;
+ data->currentGroup=0;
+ data->item=0;
return data;
@@ -286,15 +291,15 @@ QStringList& SyntaxDocument::finddata(const QString& mainGroup,const QString& ty
{
- 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;
+ }
}
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
@@ -20,2 +20,10 @@
+#define QTOPIA_INTERNAL_LANGLIST
+#include "kateconfig.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+#include <qpe/global.h>
+
+/* QT */
#include <qdir.h>
@@ -27,2 +35,3 @@
+/* STD */
#include <sys/stat.h>
@@ -33,6 +42,2 @@
-#define QTOPIA_INTERNAL_LANGLIST
-#include "kateconfig.h"
-#include <qpe/global.h>
-
@@ -44,10 +49,10 @@ 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";
+ }
}
@@ -95,3 +100,3 @@ KateConfig::KateConfig( const QString &name, Domain domain )
{
- qWarning("KateConfig constructor\n");
+ owarn << "KateConfig constructor\n" << oendl;
git = groups.end();
@@ -106,3 +111,3 @@ KateConfig::KateConfig( const QString &name, Domain domain )
KateConfig::KateConfig ( const QString &name, bool what )
- : filename( configFilename(name,what ? User : File) )
+ : filename( configFilename(name,what ? User : File) )
{
@@ -120,5 +125,5 @@ KateConfig::~KateConfig()
{
- qWarning("KateConfig destructor\n");
+ owarn << "KateConfig destructor\n" << oendl;
if ( changed )
- write();
+ write();
}
@@ -131,3 +136,3 @@ bool KateConfig::hasKey( const QString &key ) const
if ( groups.end() == git )
- return FALSE;
+ return FALSE;
KateConfigGroup::ConstIterator it = ( *git ).find( key );
@@ -149,5 +154,5 @@ void KateConfig::setGroup( const QString &gname )
if ( it == groups.end() ) {
- git = groups.insert( gname, KateConfigGroup() );
- changed = TRUE;
- return;
+ git = groups.insert( gname, KateConfigGroup() );
+ changed = TRUE;
+ return;
}
@@ -174,8 +179,8 @@ 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;
}
@@ -198,8 +203,8 @@ static QString encipher(const QString& plain)
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;
}
@@ -213,7 +218,7 @@ static QString decipher(const QString& cipher)
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;
}
@@ -234,4 +239,4 @@ void KateConfig::writeEntryCrypt( const QString &key, const QString &value )
if ( git == groups.end() ) {
- qWarning( "no group set" );
- return;
+ owarn << "no group set" << oendl;
+ return;
}
@@ -239,4 +244,4 @@ void KateConfig::writeEntryCrypt( const QString &key, const QString &value )
if ( (*git)[key] != evalue ) {
- ( *git ).insert( key, evalue );
- changed = TRUE;
+ ( *git ).insert( key, evalue );
+ changed = TRUE;
}
@@ -289,3 +294,3 @@ void KateConfig::writeEntry( const QString &key, const QStringList &lst, const Q
for ( ; it != lst.end(); ++it )
- s += *it + sep;
+ s += *it + sep;
writeEntry( key, s );
@@ -299,3 +304,3 @@ void KateConfig::writeEntry( const QString &key, const QColor &val )
l.append( QString().setNum(val.blue()) );
-
+
writeEntry( key, l, QChar(',') );
@@ -311,3 +316,3 @@ void KateConfig::writeEntry( const QString &key, const QFont &val )
l.append( QString().setNum((int)val.charSet()) );
-
+
writeEntry( key, l, QChar(',') );
@@ -323,4 +328,4 @@ void KateConfig::removeEntry( const QString &key )
if ( git == groups.end() ) {
- qWarning( "no group set" );
- return;
+ owarn << "no group set" << oendl;
+ return;
}
@@ -356,7 +361,7 @@ QString KateConfig::readEntry( const QString &key, const QString &deflt )
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;
}
@@ -379,7 +384,7 @@ QString KateConfig::readEntryCrypt( const QString &key, const QString &deflt )
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);
@@ -399,4 +404,4 @@ 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;
}
@@ -404,5 +409,5 @@ QString KateConfig::readEntryDirect( const QString &key, const QString &deflt )
if ( it != ( *git ).end() )
- return *it;
+ return *it;
else
- return deflt;
+ return deflt;
}
@@ -422,5 +427,5 @@ int KateConfig::readNumEntry( const QString &key, int deflt )
if ( s.isEmpty() )
- return deflt;
+ return deflt;
else
- return s.toInt();
+ return s.toInt();
}
@@ -440,5 +445,5 @@ bool KateConfig::readBoolEntry( const QString &key, bool deflt )
if ( s.isEmpty() )
- return deflt;
+ return deflt;
else
- return (bool)s.toInt();
+ return (bool)s.toInt();
}
@@ -458,5 +463,5 @@ QStringList KateConfig::readListEntry( const QString &key, const QChar &sep )
if ( s.isEmpty() )
- return QStringList();
+ return QStringList();
else
- return QStringList::split( sep, s );
+ return QStringList::split( sep, s );
}
@@ -486,3 +491,3 @@ QValueList<int> KateConfig::readIntListEntry( const QString &key ) const
if ( s.isEmpty() )
- return il;
+ return il;
@@ -502,8 +507,8 @@ 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;
}
@@ -518,3 +523,3 @@ void KateConfig::write( const QString &fn )
if ( !fn.isEmpty() )
- filename = fn;
+ filename = fn;
strNewFile = filename + ".new";
@@ -523,9 +528,9 @@ void KateConfig::write( const QString &fn )
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();
@@ -533,9 +538,9 @@ void KateConfig::write( const QString &fn )
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;
@@ -543,9 +548,9 @@ void KateConfig::write( const QString &fn )
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();
@@ -553,6 +558,6 @@ void KateConfig::write( const QString &fn )
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 );
+ }
}
@@ -575,4 +580,4 @@ void KateConfig::read()
if ( !QFileInfo( filename ).exists() ) {
- git = groups.end();
- return;
+ git = groups.end();
+ return;
}
@@ -581,4 +586,4 @@ void KateConfig::read()
if ( !f.open( IO_ReadOnly ) ) {
- git = groups.end();
- return;
+ git = groups.end();
+ return;
}
@@ -610,21 +615,21 @@ 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 );
}
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
@@ -16,14 +16,19 @@
***************************************************************************/
-#include <qaction.h>
-#include <qtoolbutton.h>
-#include <qmenubar.h>
-#include <qpe/resource.h>
-#include <qpe/qpeapplication.h>
+#include "tinykate.h"
+
+#include "katedocument.h"
+#include "kglobal.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
#include <opie2/ofiledialog.h>
+#include <qpe/resource.h>
+#include <qpe/qpeapplication.h>
-#include "tinykate.h"
+/* QT */
+#include <qaction.h>
+#include <qtoolbutton.h>
+#include <qmenubar.h>
-#include <katedocument.h>
-#include <kglobal.h>
@@ -154,3 +159,3 @@ TinyKate::~TinyKate( )
{
- qWarning("TinyKate destructor\n");
+ owarn << "TinyKate destructor\n" << oendl;
@@ -162,3 +167,3 @@ TinyKate::~TinyKate( )
if( KGlobal::config() != 0 ) {
- qWarning("deleting KateConfig object..\n");
+ owarn << "deleting KateConfig object..\n" << oendl;
delete KGlobal::config();
@@ -183,3 +188,3 @@ void TinyKate::open(const QString & filename)
tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed );
- qDebug(filename);
+ odebug << filename << oendl;
@@ -251,3 +256,3 @@ void TinyKate::slotSave() {
KateDocument *kd = (KateDocument*) currentView->document();
- // qDebug("saving file "+kd->docName());
+ // odebug << "saving file "+kd->docName() << oendl;
if( kd->docName().isEmpty())
@@ -267,3 +272,3 @@ void TinyKate::slotSaveAs() {
if (!filename.isEmpty()) {
- qDebug("saving file "+filename);
+ odebug << "saving file "+filename << oendl;
QFileInfo fi(filename);