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
@@ -19,30 +19,31 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#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>
/**
* Create an empty buffer.
*/
KWBuffer::KWBuffer()
{
@@ -62,41 +63,41 @@ KWBuffer::clear()
/**
* Insert a file at line @p line in the buffer.
*/
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
KWBuffer::loadFilePart()
{
}
@@ -118,15 +119,15 @@ KWBuffer::slotLoadFile()
/**
* Return the total number of lines in the buffer.
*/
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;
}
void KWBuffer::seek(int i)
{
@@ -145,15 +146,15 @@ 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
KWBuffer::insertLine(int i, TextLine::Ptr line)
{
seek(i);
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
@@ -3,13 +3,13 @@
-------------------
begin : Mon Jan 15 2001
copyright : (C) 2001 by Christoph "Crossfire" Cullmann
(C) 2002 by Joseph Wenninger
email : crossfire@babylon2k.de
jowenn@kde.org
-
+
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -36,50 +36,51 @@
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#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>
#include <qapplication.h>
#include <qclipboard.h>
#include <qfont.h>
#include <qpainter.h>
#include <qfile.h>
#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)
: action(a), cursor(cursor), len(len), text(text) {
}
KateActionGroup::KateActionGroup(PointStruc &aStart, int type)
@@ -127,35 +128,35 @@ const int KateDocument::maxAttribs = 32;
QStringList KateDocument::searchForList = QStringList();
QStringList KateDocument::replaceWithList = QStringList();
uint KateDocument::uniqueID = 0;
-QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0;
+QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0;
KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView,
QWidget *parentWidget, const char *widgetName,
QObject *, const char *)
: Kate::Document (),
myFont(KGlobalSettings::generalFont()), myFontBold(KGlobalSettings::generalFont()), myFontItalic(KGlobalSettings::generalFont()), myFontBI(KGlobalSettings::generalFont()),
myFontMetrics (myFont), myFontMetricsBold (myFontBold), myFontMetricsItalic (myFontItalic), myFontMetricsBI (myFontBI),
hlManager(HlManager::self ())
{
-
- d(this)->hlSetByUser = false;
+
+ d(this)->hlSetByUser = false;
PreHighlightedTill=0;
RequestPreHighlightTill=0;
m_bSingleViewMode=bSingleViewMode;
m_bBrowserView = 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());
maxLength = -1;
setFont (KGlobalSettings::generalFont());
@@ -289,26 +290,26 @@ KateDocument::~KateDocument()
delete_d(this);
}
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();
if (myWordWrap)
wrapText (myWordWrapAt);
@@ -318,19 +319,19 @@ void KateDocument::openURL(const QString &filename)
setHighlight(hl);
updateLines();
updateViews();
emit fileNameChanged();
-
+
return ;
}
bool KateDocument::saveFile()
{
-
+
QFile f( m_file );
if ( !f.open( IO_WriteOnly ) )
return false; // Error
QTextStream stream(&f);
@@ -608,13 +609,13 @@ void KateDocument::readConfig()
m_singleSelection = config->readBoolEntry("SingleSelection", false);
myEncoding = config->readEntry("Encoding", QString::fromLatin1(QTextCodec::codecForLocale()->name()));
setFont (config->readFontEntry("Font", myFont));
colors[0] = config->readColorEntry("Color Background", colors[0]);
colors[1] = config->readColorEntry("Color Selected", colors[1]);
-
+
// config->sync();
}
void KateDocument::writeConfig()
{
KateConfig *config = KGlobal::config();
@@ -680,13 +681,13 @@ void KateDocument::setHighlight(int n) {
PreHighlightedTill=0;
RequestPreHighlightTill=0;
emit(highlightChanged());
}
void KateDocument::makeAttribs() {
- qDebug("KateDocument::makeAttribs()");
+ odebug << "KateDocument::makeAttribs()" << oendl;
m_numAttribs = hlManager->makeAttribs(m_highlight, m_attribs, maxAttribs);
updateFontData();
updateLines();
}
void KateDocument::updateFontData() {
@@ -1920,14 +1921,14 @@ void KateDocument::updateLines(int startLine, int endLine, int flags, int cursor
if (textLine==0) kdDebug(13020)<<"****updateLines()>> error textLine==0"<<endl;
if (line <= endLine && line != cursorY) {
if (flags & KateView::cfRemoveSpaces) textLine->removeSpaces();
updateMaxLength(textLine);
}
endCtx = textLine->getContext();
-// qDebug("DOHIGHLIGHT");
-
+// odebug << "DOHIGHLIGHT" << oendl;
+
ctxNum = m_highlight->doHighlight(ctxNum,textLine);
textLine->setContext(ctxNum);
line++;
} while ((buffer->line(line)!=0) && (line <= endLine || endCtx != ctxNum));
// kdDebug(13020)<<"updateLines :: while loop left"<<endl;
tagLines(startLine, line - 1);
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,11 +1,11 @@
/*
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
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
@@ -16,32 +16,36 @@
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#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;
enum Item_styles { dsNormal,dsKeyword,dsDataType,dsDecVal,dsBaseN,dsFloat,dsChar,dsString,dsComment,dsOthers};
static bool trueBool = true;
@@ -117,14 +121,14 @@ HlStringDetect::~HlStringDetect() {
}
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;
}
HlRangeDetect::HlRangeDetect(int attribute, int context, QChar ch1, QChar ch2)
@@ -210,16 +214,16 @@ const QChar *HlInt::checkHgl(const QChar *str, int len, bool) {
s = str;
while (s->isDigit()) s++;
if (s > str)
{
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;
}
return 0L;
}
@@ -245,20 +249,20 @@ const QChar *HlFloat::checkHgl(const QChar *s, int len, bool) {
}
}
if (!b) return 0L;
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;
}
if ((*s == '-')||(*s =='+')) s++;
b = false;
@@ -342,13 +346,13 @@ const QChar *HlCHex::checkHgl(const QChar *str, int len, bool) {
for (i=0;(*s)!='\0';s++,i++);
QString line(str,i);
QRegExp3 rx("0[xX][a-fA-F\\d]+[UuLl]?"); // this matches but is also matching parenthesis
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' )) {
str += 2;
s = str;
while (s->isDigit() || ((*s&0xdf) >= 'A' && (*s&0xdf) <= 'F') /*|| (*s >= 'a' && *s <= 'f')*/) s++;
@@ -397,26 +401,26 @@ const QChar *HlRegExpr::checkHgl(const QChar *s, int len, bool lineStart)
if ((!lineStart) && handlesLinestart) return 0;
QString line(s,len);
int pos = Expr->search( line, 0 );
if (pos==-1) return 0L;
else
- return (s+Expr->matchedLength());
+ return (s+Expr->matchedLength());
};
HlLineContinue::HlLineContinue(int attribute, int context)
: HlItem(attribute,context) {
}
const QChar *HlLineContinue::checkHgl(const QChar *s, int len, bool) {
if ((s[0].latin1() == '\\') && (len == 1))
- {
+ {
return s + 1;
- }
+ }
return 0L;
}
HlCStringChar::HlCStringChar(int attribute, int context)
: HlItem(attribute,context) {
@@ -618,13 +622,13 @@ int Highlight::doHighlight(int ctxNum, TextLine *textLine)
{
if (item->startEnable(lastChar))
{
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];
z = z + s2 - s1 - 1;
s1 = s2 - 1;
found = true;
@@ -850,13 +854,13 @@ void Highlight::done()
*************
* return value: none
*******************************************************************************************/
void Highlight::createItemData(ItemDataList &list)
{
- qDebug("Highlight::createItemData");
+ odebug << "Highlight::createItemData" << oendl;
// If no highlighting is selected we need only one default.
if (noHl)
{
list.append(new ItemData(I18N_NOOP("Normal Text"), dsNormal));
return;
@@ -871,21 +875,21 @@ void Highlight::createItemData(ItemDataList &list)
if (internalIDList.count()==0)
{
//if all references to the list are destried the contents will also be deleted
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);
data=HlManager::self()->syntax->getGroupInfo("highlighting","itemData");
//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"));
bold=HlManager::self()->syntax->groupData(data,QString("bold"));
italic=HlManager::self()->syntax->groupData(data,QString("italic"));
//check if the user overrides something
@@ -930,18 +934,18 @@ void Highlight::createItemData(ItemDataList &list)
* return value: int :The index of the attribute
* or 0
*******************************************************************************************/
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;
}
/*******************************************************************************************
Highlight - createHlItem
This function is a helper for makeContextList. It parses the xml file for
@@ -1074,17 +1078,17 @@ void Highlight::readCommentConfig()
{
// kdDebug(13010)<<"COMMENT DATA FOUND"<<endl;
while (HlManager::self()->syntax->nextGroup(data))
{
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");
}
}
HlManager::self()->syntax->freeGroupInfo(data);
}
}
@@ -1109,16 +1113,16 @@ void Highlight::readGlobalKeywordConfig()
HlManager::self()->syntax->setIdentifier(identifier);
// Get the keywords config entry
syntaxContextData * data=HlManager::self()->syntax->getConfig("general","keywords");
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")));
// remove any weakDelimitars (if any) from the default list and store this list.
int f;
for (int s=0; s < weakDeliminator.length(); s++)
@@ -1130,13 +1134,13 @@ void Highlight::readGlobalKeywordConfig()
deliminator.remove (f, 1);
}
deliminatorChars = deliminator.unicode();
deliminatorLen = deliminator.length();
- HlManager::self()->syntax->freeGroupInfo(data);
+ HlManager::self()->syntax->freeGroupInfo(data);
}
else
{
//Default values
casesensitive=true;
weakDeliminator=QString("");
@@ -1201,31 +1205,31 @@ void Highlight::makeContextList()
(HlManager::self()->syntax->groupData(data,QString("lineBeginContext"))).toInt());
//Let's create all items for the context
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++;
}
}
HlManager::self()->syntax->freeGroupInfo(data);
@@ -1309,22 +1313,22 @@ int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) {
ItemStyleList defaultStyleList;
ItemStyle *defaultStyle;
ItemDataList itemDataList;
ItemData *itemData;
int nAttribs, z;
- qDebug("HlManager::makeAttribs");
+ odebug << "HlManager::makeAttribs" << oendl;
defaultStyleList.setAutoDelete(true);
getDefaults(defaultStyleList);
// itemDataList.setAutoDelete(true);
highlight->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
defaultStyle = defaultStyleList.at(itemData->defStyleNum);
a[z].col = defaultStyle->col;
a[z].selCol = defaultStyle->selCol;
@@ -1412,13 +1416,13 @@ void HlManager::getDefaults(ItemStyleList &list) {
void HlManager::setDefaults(ItemStyleList &list) {
KateConfig *config;
int z;
ItemStyle *i;
char s[64];
#warning fixme
-/*
+/*
config = KateFactory::instance()->config();
config->setGroup("Default Item Styles");
for (z = 0; z < defaultStyles(); z++) {
i = list.at(z);
sprintf(s,"%X,%X,%d,%d",i->col.rgb(),i->selCol.rgb(),i->bold, i->italic);
config->writeEntry(defaultStyleName(z),s);
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
@@ -13,21 +13,26 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#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>
SyntaxDocument::SyntaxDocument()
{
m_root=0;
currentFile="";
@@ -36,13 +41,13 @@ SyntaxDocument::SyntaxDocument()
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()
{
}
@@ -73,27 +78,27 @@ void SyntaxDocument::setupModeList(bool force)
mli->extension = config->readEntry("extension","");
mli->identifier = path+*it;
myModeList.append(mli);
}
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;
mli->name = e->attribute("name");
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");
mli->identifier = path+(*it);
config->setGroup(Group);
config->writeEntry("name",mli->name);
@@ -177,15 +182,15 @@ void SyntaxDocument::freeGroupInfo( syntaxContextData* data)
delete 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;
retval->currentGroup=data->item;
retval->item=0;
}
@@ -209,14 +214,14 @@ syntaxContextData* SyntaxDocument::getConfig(const QString& mainGroupName, const
{
kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (inner loop) " <<endl;
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;
}
e1=e1->nextChild();
}
@@ -251,14 +256,14 @@ syntaxContextData* SyntaxDocument::getGroupInfo(const QString& mainGroupName, co
{
kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (inner loop) " <<endl;
if (e1->tagName()==group+"s")
{
syntaxContextData *data=new ( syntaxContextData);
data->parent=e1;
- data->currentGroup=0;
- data->item=0;
+ data->currentGroup=0;
+ data->item=0;
return data;
}
e1=e1->nextChild();
}
@@ -281,25 +286,25 @@ QStringList& SyntaxDocument::finddata(const QString& mainGroup,const QString& ty
m_data.clear();
for(e=e->firstChild(); e; e=e->nextChild())
{
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;
}
}
return m_data;
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
@@ -15,44 +15,49 @@
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
+#define QTOPIA_INTERNAL_LANGLIST
+#include "kateconfig.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+#include <qpe/global.h>
+
+/* QT */
#include <qdir.h>
#include <qmessagebox.h>
#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
#include <qtextcodec.h>
#endif
#include <qtextstream.h>
+/* STD */
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
-#define QTOPIA_INTERNAL_LANGLIST
-#include "kateconfig.h"
-#include <qpe/global.h>
-
/*!
\internal
*/
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;
}
/*!
\class KateConfig config.h
@@ -90,24 +95,24 @@ QString KateConfig::configFilename(const QString& name, Domain d)
In the File Domain, \a name is an absolute filename.
*/
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();
lang = l[0];
glang = l[1];
}
// 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();
QStringList l = Global::languageList();
lang = l[0];
glang = l[1];
@@ -115,24 +120,24 @@ KateConfig::KateConfig ( const QString &name, bool what )
/*!
Writes any changes to disk and destroys the in-memory object.
*/
KateConfig::~KateConfig()
{
- qWarning("KateConfig destructor\n");
+ owarn << "KateConfig destructor\n" << oendl;
if ( changed )
- write();
+ write();
}
/*!
Returns whether the current group has an entry called \a key.
*/
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();
}
/*!
Sets the current group for subsequent reading and writing of
@@ -144,15 +149,15 @@ bool KateConfig::hasKey( const QString &key ) const
The \a gname must not be empty.
*/
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;
}
/*!
Writes a (\a key, \a value) entry to the current group.
@@ -169,18 +174,18 @@ void KateConfig::writeEntry( const QString &key, const char* value )
\sa readEntry()
*/
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;
}
}
/*
Note that the degree of protection offered by the encryption here is
only sufficient to avoid the most casual observation of the configuration
@@ -193,32 +198,32 @@ void KateConfig::writeEntry( const QString &key, const QString &value )
static QString encipher(const QString& plain)
{
// mainly, we make it long
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;
}
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;
}
/*!
Writes an encrypted (\a key, \a value) entry to the current group.
@@ -229,19 +234,19 @@ static QString decipher(const QString& cipher)
\sa readEntry()
*/
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;
}
}
/*!
Writes a (\a key, \a num) entry to the current group.
@@ -284,48 +289,48 @@ void KateConfig::writeEntry( const QString &key, bool b )
*/
void KateConfig::writeEntry( const QString &key, const QStringList &lst, const QChar &sep )
{
QString s;
QStringList::ConstIterator it = lst.begin();
for ( ; it != lst.end(); ++it )
- s += *it + sep;
+ s += *it + sep;
writeEntry( key, s );
}
void KateConfig::writeEntry( const QString &key, const QColor &val )
{
QStringList l;
l.append( QString().setNum(val.red()) );
l.append( QString().setNum(val.green()) );
l.append( QString().setNum(val.blue()) );
-
+
writeEntry( key, l, QChar(',') );
}
void KateConfig::writeEntry( const QString &key, const QFont &val )
{
QStringList l;
l.append( val.family() );
l.append( QString().setNum(val.pointSize()) );
l.append( QString().setNum(val.weight()) );
l.append( QString().setNum((int)val.italic()) );
l.append( QString().setNum((int)val.charSet()) );
-
+
writeEntry( key, l, QChar(',') );
}
/*!
Removes the \a key entry from the current group. Does nothing if
there is no such entry.
*/
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;
}
/*!
@@ -351,17 +356,17 @@ void KateConfig::removeEntry( const QString &key )
For compatibility, non-const version.
*/
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 );
}
/*!
\fn QString KateConfig::readEntryCrypt( const QString &key, const QString &deflt ) const
@@ -374,17 +379,17 @@ QString KateConfig::readEntry( const QString &key, const QString &deflt )
For compatibility, non-const version.
*/
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);
}
/*!
\fn QString KateConfig::readEntryDirect( const QString &key, const QString &deflt ) const
\internal
@@ -394,20 +399,20 @@ QString KateConfig::readEntryCrypt( const QString &key, const QString &deflt )
\internal
For compatibility, non-const version.
*/
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;
}
/*!
\fn int KateConfig::readNumEntry( const QString &key, int deflt ) const
Reads a numeric entry stored with \a key, defaulting to \a deflt if there is no entry.
*/
@@ -417,15 +422,15 @@ QString KateConfig::readEntryDirect( const QString &key, const QString &deflt )
For compatibility, non-const version.
*/
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();
}
/*!
\fn bool KateConfig::readBoolEntry( const QString &key, bool deflt ) const
Reads a bool entry stored with \a key, defaulting to \a deflt if there is no entry.
*/
@@ -435,15 +440,15 @@ int KateConfig::readNumEntry( const QString &key, int deflt )
For compatibility, non-const version.
*/
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();
}
/*!
\fn QStringList KateConfig::readListEntry( const QString &key, const QChar &sep ) const
Reads a string list entry stored with \a key, and with \a sep as the separator.
*/
@@ -453,15 +458,15 @@ bool KateConfig::readBoolEntry( const QString &key, bool deflt )
For compatibility, non-const version.
*/
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
{
QStringList list = readListEntry(key, QChar(','));
if( list.count() != 3 )
@@ -481,13 +486,13 @@ QFont KateConfig::readFontEntry( const QString &key, const QFont &def ) const
QValueList<int> KateConfig::readIntListEntry( const QString &key ) const
{
QString s = readEntry( key );
QValueList<int> il;
if ( s.isEmpty() )
- return il;
+ return il;
QStringList l = QStringList::split( QChar(','), s );
QStringList::Iterator l_it;
for( l_it = l.begin(); l_it != l.end(); ++l_it )
il.append( (*l_it).toInt() );
@@ -497,67 +502,67 @@ QValueList<int> KateConfig::readIntListEntry( const QString &key ) const
/*!
Removes all entries from the current group.
*/
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;
}
}
/*!
\internal
*/
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 );
+ }
}
/*!
Returns whether the KateConfig is in a valid state.
*/
bool KateConfig::isValid() const
@@ -570,20 +575,20 @@ bool KateConfig::isValid() const
*/
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 );
#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
// The below should work, but doesn't in Qt 2.3.0
s.setCodec( QTextCodec::codecForMib( 106 ) );
@@ -605,28 +610,28 @@ void KateConfig::read()
/*!
\internal
*/
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
@@ -11,24 +11,29 @@
* This program is free softwaSre; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation. *
* ONLY VERSION 2 OF THE LICENSE IS APPLICABLE *
* *
***************************************************************************/
-#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>
using namespace Opie::Ui;
TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
QMainWindow( parent, name, f )
{
shutDown=false;
@@ -149,21 +154,21 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
else slotNew();
}
TinyKate::~TinyKate( )
{
- qWarning("TinyKate destructor\n");
+ owarn << "TinyKate destructor\n" << oendl;
shutDown=true;
while (currentView!=0) {
slotClose();
}
if( KGlobal::config() != 0 ) {
- qWarning("deleting KateConfig object..\n");
+ owarn << "deleting KateConfig object..\n" << oendl;
delete KGlobal::config();
}
}
void TinyKate::slotOpen( )
{
@@ -178,13 +183,13 @@ void TinyKate::open(const QString & filename)
{
KateDocument *kd= new KateDocument(false, false, this,0,this);
KTextEditor::View *kv;
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 );
viewCount++;
}
@@ -246,13 +251,13 @@ void TinyKate::slotClose( )
void TinyKate::slotSave() {
// feel free to make this how you want
if (currentView==0) return;
// 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
kd->saveFile();
// kv->save();
// kd->saveFile();
@@ -262,13 +267,13 @@ void TinyKate::slotSaveAs() {
if (currentView==0) return;
KateDocument *kd = (KateDocument*) currentView->document();
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);
kd->setDocName( filenamed);
kd->saveFile();
// KTextEditor::View *dv = currentView;