summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate
Unidiff
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
@@ -22,24 +22,25 @@
22 22
23 23
24#include "katebuffer.h" 24#include "katebuffer.h"
25#include "kdebug.h"
25 26
26// Includes for reading file 27/* OPIE */
27#include <sys/types.h> 28#include <opie2/odebug.h>
28#include <sys/stat.h>
29#include <fcntl.h>
30#include <errno.h>
31#include <unistd.h>
32 29
30/* QT */
33#include <qfile.h> 31#include <qfile.h>
34#include <qtextstream.h> 32#include <qtextstream.h>
35
36#include <qtimer.h> 33#include <qtimer.h>
37#include <qtextcodec.h> 34#include <qtextcodec.h>
38 35
39// 36/* STD */
40 37// Includes for reading file
38#include <sys/types.h>
39#include <sys/stat.h>
40#include <fcntl.h>
41#include <errno.h>
42#include <unistd.h>
41#include <assert.h> 43#include <assert.h>
42#include <kdebug.h>
43 44
44/** 45/**
45 * Create an empty buffer. 46 * Create an empty buffer.
@@ -65,35 +66,35 @@ KWBuffer::clear()
65void 66void
66KWBuffer::insertFile(int line, const QString &file, QTextCodec *codec) 67KWBuffer::insertFile(int line, const QString &file, QTextCodec *codec)
67{ 68{
68 if (line) { 69 if (line) {
69 qDebug("insert File only supports insertion at line 0 == file opening"); 70 odebug << "insert File only supports insertion at line 0 == file opening" << oendl;
70 return; 71 return;
71 } 72 }
72 clear(); 73 clear();
73 QFile iofile(file); 74 QFile iofile(file);
74 iofile.open(IO_ReadOnly); 75 iofile.open(IO_ReadOnly);
75 QTextStream stream(&iofile); 76 QTextStream stream(&iofile);
76 stream.setCodec(codec); 77 stream.setCodec(codec);
77 QString qsl; 78 QString qsl;
78 int count=0; 79 int count=0;
79 for (count=0;((qsl=stream.readLine())!=QString::null);count++) 80 for (count=0;((qsl=stream.readLine())!=QString::null); count++)
80 { 81 {
81 if (count==0) 82 if (count==0)
82 { 83 {
83 (*m_stringListIt)->append(qsl.unicode(),qsl.length()); 84 (*m_stringListIt)->append(qsl.unicode(),qsl.length());
84 } 85 }
85 else 86 else
86 { 87 {
87 TextLine::Ptr tl=new TextLine(); 88 TextLine::Ptr tl=new TextLine();
88 tl ->append(qsl.unicode(),qsl.length()); 89 tl ->append(qsl.unicode(),qsl.length());
89 m_stringListIt=m_stringList.append(tl); 90 m_stringListIt=m_stringList.append(tl);
90 } 91 }
91 } 92 }
92 if (count!=0) 93 if (count!=0)
93 { 94 {
94 m_stringListCurrent=count-1; 95 m_stringListCurrent=count-1;
95 m_lineCount=count; 96 m_lineCount=count;
96 } 97 }
97} 98}
98 99
99void 100void
@@ -121,9 +122,9 @@ KWBuffer::slotLoadFile()
121int 122int
122KWBuffer::count() 123KWBuffer::count()
123{ 124{
124 qDebug("m_stringList.count %d",m_stringList.count()); 125 odebug << "m_stringList.count " << m_stringList.count() << "" << oendl;
125 return m_lineCount; 126 return m_lineCount;
126 //return m_stringList.count(); 127// return m_stringList.count();
127// return m_totalLines; 128// return m_totalLines;
128} 129}
129 130
@@ -148,9 +149,9 @@ void KWBuffer::seek(int i)
148TextLine::Ptr 149TextLine::Ptr
149KWBuffer::line(int i) 150KWBuffer::line(int i)
150{ 151{
151 if (i>=m_stringList.count()) return 0; 152 if (i>=m_stringList.count()) return 0;
152 seek(i); 153 seek(i);
153 return *m_stringListIt; 154 return *m_stringListIt;
154} 155}
155 156
156void 157void
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 @@
6 (C) 2002 by Joseph Wenninger 6 (C) 2002 by Joseph Wenninger
7 email : crossfire@babylon2k.de 7 email : crossfire@babylon2k.de
8 jowenn@kde.org 8 jowenn@kde.org
9 9
10***************************************************************************/ 10***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
@@ -39,20 +39,31 @@
39*/ 39*/
40 40
41#include "katedocument.h" 41#include "katedocument.h"
42#include "kmessagebox.h"
43#include "kglobal.h"
42 44
45//#include "kcharsets.h"
46#include "kdebug.h"
47//#include "kinstance.h"
43 48
44#include <qfileinfo.h> 49#include "kglobalsettings.h"
45#include <qdatetime.h> 50//#include "kaction.h"
51//#include "kstdaction.h"
46 52
47#include <kmessagebox.h> 53#include "../view/kateview.h"
48#include <qpe/config.h> 54#include "katebuffer.h"
49#include <qstring.h> 55#include "katetextline.h"
50 56
51#include <sys/time.h> 57#include "katecmd.h"
52#include <unistd.h>
53 58
54#include <stdio.h> 59/* OPIE */
60#include <opie2/odebug.h>
61#include <qpe/config.h>
55 62
63/* QT */
64#include <qfileinfo.h>
65#include <qdatetime.h>
66#include <qstring.h>
56#include <qtimer.h> 67#include <qtimer.h>
57#include <qobject.h> 68#include <qobject.h>
58#include <qapplication.h> 69#include <qapplication.h>
@@ -62,21 +73,11 @@
62#include <qfile.h> 73#include <qfile.h>
63#include <qtextstream.h> 74#include <qtextstream.h>
64#include <qtextcodec.h> 75#include <qtextcodec.h>
65#include <kglobal.h>
66 76
67//#include <kcharsets.h> 77/* STD */
68#include <kdebug.h> 78#include <sys/time.h>
69//#include <kinstance.h> 79#include <unistd.h>
70 80#include <stdio.h>
71#include <kglobalsettings.h>
72//#include <kaction.h>
73//#include <kstdaction.h>
74
75#include "../view/kateview.h"
76#include "katebuffer.h"
77#include "katetextline.h"
78
79#include "katecmd.h"
80 81
81KateAction::KateAction(Action a, PointStruc &cursor, int len, const QString &text) 82KateAction::KateAction(Action a, PointStruc &cursor, int len, const QString &text)
82 : action(a), cursor(cursor), len(len), text(text) { 83 : action(a), cursor(cursor), len(len), text(text) {
@@ -130,7 +131,7 @@ QStringList KateDocument::replaceWithList = QStringList();
130 131
131uint KateDocument::uniqueID = 0; 132uint KateDocument::uniqueID = 0;
132 133
133QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0; 134QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0;
134 135
135 136
136KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView, 137KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView,
@@ -141,8 +142,8 @@ KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView,
141 myFontMetrics (myFont), myFontMetricsBold (myFontBold), myFontMetricsItalic (myFontItalic), myFontMetricsBI (myFontBI), 142 myFontMetrics (myFont), myFontMetricsBold (myFontBold), myFontMetricsItalic (myFontItalic), myFontMetricsBI (myFontBI),
142 hlManager(HlManager::self ()) 143 hlManager(HlManager::self ())
143{ 144{
144 145
145 d(this)->hlSetByUser = false; 146 d(this)->hlSetByUser = false;
146 PreHighlightedTill=0; 147 PreHighlightedTill=0;
147 RequestPreHighlightTill=0; 148 RequestPreHighlightTill=0;
148 149
@@ -152,7 +153,7 @@ KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView,
152 m_url = QString::null; 153 m_url = QString::null;
153 154
154 // NOTE: QFont::CharSet doesn't provide all the charsets KDE supports 155 // NOTE: QFont::CharSet doesn't provide all the charsets KDE supports
155 // (esp. it doesn't distinguish between UTF-8 and iso10646-1) 156 // (esp. it doesn't distinguish between UTF-8 and iso10646-1)
156 157
157 myEncoding = QString::fromLatin1(QTextCodec::codecForLocale()->name()); 158 myEncoding = QString::fromLatin1(QTextCodec::codecForLocale()->name());
158 159
@@ -292,20 +293,20 @@ KateDocument::~KateDocument()
292void KateDocument::openURL(const QString &filename) 293void KateDocument::openURL(const QString &filename)
293{ 294{
294 295
295 m_file=filename; 296 m_file=filename;
296 fileInfo->setFile (m_file); 297 fileInfo->setFile (m_file);
297 setMTime(); 298 setMTime();
298 299
299 if (!fileInfo->exists() || !fileInfo->isReadable()) 300 if (!fileInfo->exists() || !fileInfo->isReadable())
300 { 301 {
301 qDebug("File doesn't exit or couldn't be read"); 302 odebug << "File doesn't exit or couldn't be read" << oendl;
302 return ; 303 return ;
303 } 304 }
304 305
305 buffer->clear(); 306 buffer->clear();
306#warning fixme 307#warning fixme
307// buffer->insertFile(0, m_file, KGlobal::charsets()->codecForName(myEncoding)); 308// buffer->insertFile(0, m_file, KGlobal::charsets()->codecForName(myEncoding));
308 qDebug("Telling buffer to open file"); 309 odebug << "Telling buffer to open file" << oendl;
309 buffer->insertFile(0, m_file, QTextCodec::codecForLocale()); 310 buffer->insertFile(0, m_file, QTextCodec::codecForLocale());
310 311
311 setMTime(); 312 setMTime();
@@ -321,13 +322,13 @@ void KateDocument::openURL(const QString &filename)
321 updateViews(); 322 updateViews();
322 323
323 emit fileNameChanged(); 324 emit fileNameChanged();
324 325
325 return ; 326 return ;
326} 327}
327 328
328bool KateDocument::saveFile() 329bool KateDocument::saveFile()
329{ 330{
330 331
331 QFile f( m_file ); 332 QFile f( m_file );
332 if ( !f.open( IO_WriteOnly ) ) 333 if ( !f.open( IO_WriteOnly ) )
333 return false; // Error 334 return false; // Error
@@ -611,7 +612,7 @@ void KateDocument::readConfig()
611 612
612 colors[0] = config->readColorEntry("Color Background", colors[0]); 613 colors[0] = config->readColorEntry("Color Background", colors[0]);
613 colors[1] = config->readColorEntry("Color Selected", colors[1]); 614 colors[1] = config->readColorEntry("Color Selected", colors[1]);
614 615
615// config->sync(); 616// config->sync();
616} 617}
617 618
@@ -683,7 +684,7 @@ void KateDocument::setHighlight(int n) {
683} 684}
684 685
685void KateDocument::makeAttribs() { 686void KateDocument::makeAttribs() {
686 qDebug("KateDocument::makeAttribs()"); 687 odebug << "KateDocument::makeAttribs()" << oendl;
687 m_numAttribs = hlManager->makeAttribs(m_highlight, m_attribs, maxAttribs); 688 m_numAttribs = hlManager->makeAttribs(m_highlight, m_attribs, maxAttribs);
688 updateFontData(); 689 updateFontData();
689 updateLines(); 690 updateLines();
@@ -1923,8 +1924,8 @@ void KateDocument::updateLines(int startLine, int endLine, int flags, int cursor
1923 updateMaxLength(textLine); 1924 updateMaxLength(textLine);
1924 } 1925 }
1925 endCtx = textLine->getContext(); 1926 endCtx = textLine->getContext();
1926// qDebug("DOHIGHLIGHT"); 1927// odebug << "DOHIGHLIGHT" << oendl;
1927 1928
1928 ctxNum = m_highlight->doHighlight(ctxNum,textLine); 1929 ctxNum = m_highlight->doHighlight(ctxNum,textLine);
1929 textLine->setContext(ctxNum); 1930 textLine->setContext(ctxNum);
1930 line++; 1931 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 @@
1/* 1/*
2 Copyright (C) 1998, 1999 Jochen Wilhelmy 2 Copyright (C) 1998, 1999 Jochen Wilhelmy
3 digisnap@cs.tu-berlin.de 3 digisnap@cs.tu-berlin.de
4 (C) 2002, 2001 The Kate Team <kwrite-devel@kde.org> 4 (C) 2002, 2001 The Kate Team <kwrite-devel@kde.org>
5 (C) 2002 Joseph Wenninger <jowenn@kde.org> 5 (C) 2002 Joseph Wenninger <jowenn@kde.org>
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
@@ -19,26 +19,30 @@
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#include <string.h>
23
24#include <qtextstream.h>
25#include <qpe/config.h>
26#include <kglobal.h>
27//#include <kinstance.h>
28//#include <kmimemagic.h>
29#include <klocale.h>
30//#include <kregexp.h>
31#include <kglobalsettings.h>
32#include <kdebug.h>
33#include <kstddirs.h>
34
35#include "katehighlight.h" 22#include "katehighlight.h"
36
37
38#include "katetextline.h" 23#include "katetextline.h"
39#include "katedocument.h" 24#include "katedocument.h"
40#include "katesyntaxdocument.h" 25#include "katesyntaxdocument.h"
41 26
27#include "kglobal.h"
28//#include "kinstance.h"
29//#include "kmimemagic.h"
30#include "klocale.h"
31//#include "kregexp.h"
32#include "kglobalsettings.h"
33#include "kdebug.h"
34#include "kstddirs.h"
35
36/* OPIE */
37#include <opie2/odebug.h>
38#include <qpe/config.h>
39
40/* QT */
41#include <qtextstream.h>
42
43/* STD */
44#include <string.h>
45
42 46
43HlManager *HlManager::s_pSelf = 0; 47HlManager *HlManager::s_pSelf = 0;
44 48
@@ -120,8 +124,8 @@ const QChar *HlStringDetect::checkHgl(const QChar *s, int len, bool) {
120 if (!_inSensitive) {if (memcmp(s, str.unicode(), str.length()*sizeof(QChar)) == 0) return s + str.length();} 124 if (!_inSensitive) {if (memcmp(s, str.unicode(), str.length()*sizeof(QChar)) == 0) return s + str.length();}
121 else 125 else
122 { 126 {
123 QString tmp=QString(s,str.length()).upper(); 127 QString tmp=QString(s,str.length()).upper();
124 if (tmp==str) return s+str.length(); 128 if (tmp==str) return s+str.length();
125 } 129 }
126 return 0L; 130 return 0L;
127} 131}
@@ -213,10 +217,10 @@ const QChar *HlInt::checkHgl(const QChar *str, int len, bool) {
213 { 217 {
214 if (subItems) 218 if (subItems)
215 { 219 {
216 for (HlItem *it=subItems->first();it;it=subItems->next()) 220 for (HlItem *it=subItems->first();it;it=subItems->next())
217 { 221 {
218 s1=it->checkHgl(s, len, false); 222 s1=it->checkHgl(s, len, false);
219 if (s1) return s1; 223 if (s1) return s1;
220 } 224 }
221 } 225 }
222 return s; 226 return s;
@@ -248,14 +252,14 @@ const QChar *HlFloat::checkHgl(const QChar *s, int len, bool) {
248 if ((*s&0xdf) == 'E') s++; 252 if ((*s&0xdf) == 'E') s++;
249 else 253 else
250 if (!p) return 0L; 254 if (!p) return 0L;
251 else 255 else
252 { 256 {
253 if (subItems) 257 if (subItems)
254 { 258 {
255 for (HlItem *it=subItems->first();it;it=subItems->next()) 259 for (HlItem *it=subItems->first();it;it=subItems->next())
256 { 260 {
257 s1=it->checkHgl(s, len, false); 261 s1=it->checkHgl(s, len, false);
258 if (s1) return s1; 262 if (s1) return s1;
259 } 263 }
260 } 264 }
261 return s; 265 return s;
@@ -345,7 +349,7 @@ const QChar *HlCHex::checkHgl(const QChar *str, int len, bool) {
345 int pos=rx.search(line,0); 349 int pos=rx.search(line,0);
346 if(pos > -1) return str+rx.matchedLength(); 350 if(pos > -1) return str+rx.matchedLength();
347 else 351 else
348 return 0L; 352 return 0L;
349 353
350#else 354#else
351 if (str[0] == '0' && ((str[1]&0xdf) == 'X' )) { 355 if (str[0] == '0' && ((str[1]&0xdf) == 'X' )) {
@@ -400,7 +404,7 @@ const QChar *HlRegExpr::checkHgl(const QChar *s, int len, bool lineStart)
400 int pos = Expr->search( line, 0 ); 404 int pos = Expr->search( line, 0 );
401 if (pos==-1) return 0L; 405 if (pos==-1) return 0L;
402 else 406 else
403 return (s+Expr->matchedLength()); 407 return (s+Expr->matchedLength());
404}; 408};
405 409
406 410
@@ -411,9 +415,9 @@ HlLineContinue::HlLineContinue(int attribute, int context)
411const QChar *HlLineContinue::checkHgl(const QChar *s, int len, bool) { 415const QChar *HlLineContinue::checkHgl(const QChar *s, int len, bool) {
412 416
413 if ((s[0].latin1() == '\\') && (len == 1)) 417 if ((s[0].latin1() == '\\') && (len == 1))
414 { 418 {
415 return s + 1; 419 return s + 1;
416 } 420 }
417 return 0L; 421 return 0L;
418} 422}
419 423
@@ -621,7 +625,7 @@ int Highlight::doHighlight(int ctxNum, TextLine *textLine)
621 s2 = item->checkHgl(s1, len-z, z==0); 625 s2 = item->checkHgl(s1, len-z, z==0);
622 if (s2 > s1) 626 if (s2 > s1)
623 { 627 {
624 qDebug("An item has been detected"); 628 odebug << "An item has been detected" << oendl;
625 textLine->setAttribs(item->attr,s1 - str,s2 - str); 629 textLine->setAttribs(item->attr,s1 - str,s2 - str);
626 ctxNum = item->ctx; 630 ctxNum = item->ctx;
627 context = contextList[ctxNum]; 631 context = contextList[ctxNum];
@@ -853,7 +857,7 @@ void Highlight::done()
853 857
854void Highlight::createItemData(ItemDataList &list) 858void Highlight::createItemData(ItemDataList &list)
855{ 859{
856 qDebug("Highlight::createItemData"); 860 odebug << "Highlight::createItemData" << oendl;
857 861
858 // If no highlighting is selected we need only one default. 862 // If no highlighting is selected we need only one default.
859 if (noHl) 863 if (noHl)
@@ -874,7 +878,7 @@ void Highlight::createItemData(ItemDataList &list)
874 internalIDList.setAutoDelete(true); 878 internalIDList.setAutoDelete(true);
875 syntaxContextData *data; 879 syntaxContextData *data;
876 880
877 qDebug("Trying to read itemData section"); 881 odebug << "Trying to read itemData section" << oendl;
878 882
879 //Tell the syntax document class which file we want to parse and which data group 883 //Tell the syntax document class which file we want to parse and which data group
880 HlManager::self()->syntax->setIdentifier(identifier); 884 HlManager::self()->syntax->setIdentifier(identifier);
@@ -882,7 +886,7 @@ void Highlight::createItemData(ItemDataList &list)
882 //begin with the real parsing 886 //begin with the real parsing
883 while (HlManager::self()->syntax->nextGroup(data)) 887 while (HlManager::self()->syntax->nextGroup(data))
884 { 888 {
885 qDebug("Setting up one itemData element"); 889 odebug << "Setting up one itemData element" << oendl;
886 // read all attributes 890 // read all attributes
887 color=HlManager::self()->syntax->groupData(data,QString("color")); 891 color=HlManager::self()->syntax->groupData(data,QString("color"));
888 selColor=HlManager::self()->syntax->groupData(data,QString("selColor")); 892 selColor=HlManager::self()->syntax->groupData(data,QString("selColor"));
@@ -933,12 +937,12 @@ void Highlight::createItemData(ItemDataList &list)
933 937
934int Highlight::lookupAttrName(const QString& name, ItemDataList &iDl) 938int Highlight::lookupAttrName(const QString& name, ItemDataList &iDl)
935{ 939{
936 for (int i=0;i<iDl.count();i++) 940 for (int i=0;i<iDl.count();i++)
937 { 941 {
938 if (iDl.at(i)->name==name) return i; 942 if (iDl.at(i)->name==name) return i;
939 } 943 }
940 kdDebug(13010)<<"Couldn't resolve itemDataName"<<endl; 944 kdDebug(13010)<<"Couldn't resolve itemDataName"<<endl;
941 return 0; 945 return 0;
942} 946}
943 947
944 948
@@ -1077,11 +1081,11 @@ void Highlight::readCommentConfig()
1077 { 1081 {
1078 1082
1079 if (HlManager::self()->syntax->groupData(data,"name")=="singleLine") 1083 if (HlManager::self()->syntax->groupData(data,"name")=="singleLine")
1080 cslStart=HlManager::self()->syntax->groupData(data,"start"); 1084 cslStart=HlManager::self()->syntax->groupData(data,"start");
1081 if (HlManager::self()->syntax->groupData(data,"name")=="multiLine") 1085 if (HlManager::self()->syntax->groupData(data,"name")=="multiLine")
1082 { 1086 {
1083 cmlStart=HlManager::self()->syntax->groupData(data,"start"); 1087 cmlStart=HlManager::self()->syntax->groupData(data,"start");
1084 cmlEnd=HlManager::self()->syntax->groupData(data,"end"); 1088 cmlEnd=HlManager::self()->syntax->groupData(data,"end");
1085 } 1089 }
1086 } 1090 }
1087 HlManager::self()->syntax->freeGroupInfo(data); 1091 HlManager::self()->syntax->freeGroupInfo(data);
@@ -1112,10 +1116,10 @@ void Highlight::readGlobalKeywordConfig()
1112 syntaxContextData * data=HlManager::self()->syntax->getConfig("general","keywords"); 1116 syntaxContextData * data=HlManager::self()->syntax->getConfig("general","keywords");
1113 if (data) 1117 if (data)
1114 { 1118 {
1115 kdDebug(13010)<<"Found global keyword config"<<endl; 1119 kdDebug(13010)<<"Found global keyword config"<<endl;
1116 1120
1117 if (HlManager::self()->syntax->groupItemData(data,QString("casesensitive"))!="0") 1121 if (HlManager::self()->syntax->groupItemData(data,QString("casesensitive"))!="0")
1118 casesensitive=true; else {casesensitive=false; kdDebug(13010)<<"Turning on case insensitiveness"<<endl;} 1122 casesensitive=true; else {casesensitive=false; kdDebug(13010)<<"Turning on case insensitiveness"<<endl;}
1119 //get the weak deliminators 1123 //get the weak deliminators
1120 weakDeliminator=(!HlManager::self()->syntax->groupItemData(data,QString("weakDeliminator"))); 1124 weakDeliminator=(!HlManager::self()->syntax->groupItemData(data,QString("weakDeliminator")));
1121 1125
@@ -1133,7 +1137,7 @@ void Highlight::readGlobalKeywordConfig()
1133 deliminatorChars = deliminator.unicode(); 1137 deliminatorChars = deliminator.unicode();
1134 deliminatorLen = deliminator.length(); 1138 deliminatorLen = deliminator.length();
1135 1139
1136 HlManager::self()->syntax->freeGroupInfo(data); 1140 HlManager::self()->syntax->freeGroupInfo(data);
1137 } 1141 }
1138 else 1142 else
1139 { 1143 {
@@ -1204,25 +1208,25 @@ void Highlight::makeContextList()
1204 //Let's create all items for the context 1208 //Let's create all items for the context
1205 while (HlManager::self()->syntax->nextItem(data)) 1209 while (HlManager::self()->syntax->nextItem(data))
1206 { 1210 {
1207 // kdDebug(13010)<< "In make Contextlist: Item:"<<endl; 1211// kdDebug(13010)<< "In make Contextlist: Item:"<<endl;
1208 c=createHlItem(data,iDl); 1212 c=createHlItem(data,iDl);
1209 if (c) 1213 if (c)
1210 { 1214 {
1211 contextList[i]->items.append(c); 1215 contextList[i]->items.append(c);
1212 1216
1213 // Not supported completely atm and only one level. Subitems.(all have to be matched to at once) 1217 // Not supported completely atm and only one level. Subitems.(all have to be matched to at once)
1214 datasub=HlManager::self()->syntax->getSubItems(data); 1218 datasub=HlManager::self()->syntax->getSubItems(data);
1215 bool tmpbool; 1219 bool tmpbool;
1216 if (tmpbool=HlManager::self()->syntax->nextItem(datasub)) 1220 if (tmpbool=HlManager::self()->syntax->nextItem(datasub))
1217 { 1221 {
1218 c->subItems=new QList<HlItem>; 1222 c->subItems=new QList<HlItem>;
1219 for (;tmpbool;tmpbool=HlManager::self()->syntax->nextItem(datasub)) 1223 for (;tmpbool;tmpbool=HlManager::self()->syntax->nextItem(datasub))
1220 c->subItems->append(createHlItem(datasub,iDl)); 1224 c->subItems->append(createHlItem(datasub,iDl));
1221 } 1225 }
1222 HlManager::self()->syntax->freeGroupInfo(datasub); 1226 HlManager::self()->syntax->freeGroupInfo(datasub);
1223 // end of sublevel 1227 // end of sublevel
1224 } 1228 }
1225 // kdDebug(13010)<<"Last line in loop"<<endl; 1229// kdDebug(13010)<<"Last line in loop"<<endl;
1226 } 1230 }
1227 i++; 1231 i++;
1228 } 1232 }
@@ -1312,7 +1316,7 @@ int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) {
1312 ItemData *itemData; 1316 ItemData *itemData;
1313 int nAttribs, z; 1317 int nAttribs, z;
1314 1318
1315 qDebug("HlManager::makeAttribs"); 1319 odebug << "HlManager::makeAttribs" << oendl;
1316 1320
1317 defaultStyleList.setAutoDelete(true); 1321 defaultStyleList.setAutoDelete(true);
1318 getDefaults(defaultStyleList); 1322 getDefaults(defaultStyleList);
@@ -1321,7 +1325,7 @@ int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) {
1321 highlight->getItemDataList(itemDataList); 1325 highlight->getItemDataList(itemDataList);
1322 nAttribs = itemDataList.count(); 1326 nAttribs = itemDataList.count();
1323 for (z = 0; z < nAttribs; z++) { 1327 for (z = 0; z < nAttribs; z++) {
1324 qDebug("HlManager::makeAttribs: createing one attribute definition"); 1328 odebug << "HlManager::makeAttribs: createing one attribute definition" << oendl;
1325 itemData = itemDataList.at(z); 1329 itemData = itemDataList.at(z);
1326 if (itemData->defStyle) { 1330 if (itemData->defStyle) {
1327 // default style 1331 // default style
@@ -1415,7 +1419,7 @@ void HlManager::setDefaults(ItemStyleList &list) {
1415 ItemStyle *i; 1419 ItemStyle *i;
1416 char s[64]; 1420 char s[64];
1417#warning fixme 1421#warning fixme
1418/* 1422/*
1419 config = KateFactory::instance()->config(); 1423 config = KateFactory::instance()->config();
1420 config->setGroup("Default Item Styles"); 1424 config->setGroup("Default Item Styles");
1421 for (z = 0; z < defaultStyles(); z++) { 1425 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 @@
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include "katesyntaxdocument.h" 18#include "katesyntaxdocument.h"
19#include <kateconfig.h> 19#include "kateconfig.h"
20#include "kdebug.h"
21#include "kstddirs.h"
22#include "klocale.h"
23#include "kmessagebox.h"
24#include "kglobal.h"
25
26/* OPIE */
27#include <opie2/odebug.h>
28#include <qpe/qpeapplication.h>
29
30/* QT */
20#include <qfile.h> 31#include <qfile.h>
21#include <kdebug.h>
22#include <kstddirs.h>
23#include <klocale.h>
24#include <kmessagebox.h>
25#include <qstringlist.h> 32#include <qstringlist.h>
26#include <kglobal.h>
27#include <qpe/qpeapplication.h>
28#include <qdir.h> 33#include <qdir.h>
29 34
30SyntaxDocument::SyntaxDocument() 35SyntaxDocument::SyntaxDocument()
@@ -39,7 +44,7 @@ void SyntaxDocument::setIdentifier(const QString& identifier)
39#warning FIXME delete m_root; 44#warning FIXME delete m_root;
40 m_root=Opie::Core::XMLElement::load(identifier); 45 m_root=Opie::Core::XMLElement::load(identifier);
41 if (!m_root) KMessageBox::error( 0L, i18n("Can't open %1").arg(identifier) ); 46 if (!m_root) KMessageBox::error( 0L, i18n("Can't open %1").arg(identifier) );
42 47
43} 48}
44 49
45SyntaxDocument::~SyntaxDocument() 50SyntaxDocument::~SyntaxDocument()
@@ -76,13 +81,13 @@ void SyntaxDocument::setupModeList(bool force)
76 } 81 }
77 else 82 else
78 { 83 {
79 qDebug("Found a description file:"+path+(*it)); 84 odebug << "Found a description file:"+path+(*it) << oendl;
80 setIdentifier(path+(*it)); 85 setIdentifier(path+(*it));
81 Opie::Core::XMLElement *e=m_root; 86 Opie::Core::XMLElement *e=m_root;
82 if (e) 87 if (e)
83 { 88 {
84 e=e->firstChild(); 89 e=e->firstChild();
85 qDebug(e->tagName()); 90 odebug << e->tagName() << oendl;
86 if (e->tagName()=="language") 91 if (e->tagName()=="language")
87 { 92 {
88 syntaxModeListItem *mli=new syntaxModeListItem; 93 syntaxModeListItem *mli=new syntaxModeListItem;
@@ -90,7 +95,7 @@ void SyntaxDocument::setupModeList(bool force)
90 mli->section = e->attribute("section"); 95 mli->section = e->attribute("section");
91 mli->mimetype = e->attribute("mimetype"); 96 mli->mimetype = e->attribute("mimetype");
92 mli->extension = e->attribute("extensions"); 97 mli->extension = e->attribute("extensions");
93 qDebug(QString("valid description for: %1/%2").arg(mli->section).arg(mli->name)); 98 odebug << QString("valid description for: %1/%2").arg(mli->section).arg(mli->name) << oendl;
94 if (mli->section.isEmpty()) 99 if (mli->section.isEmpty())
95 mli->section=i18n("Other"); 100 mli->section=i18n("Other");
96 101
@@ -180,9 +185,9 @@ void SyntaxDocument::freeGroupInfo( syntaxContextData* data)
180syntaxContextData* SyntaxDocument::getSubItems(syntaxContextData* data) 185syntaxContextData* SyntaxDocument::getSubItems(syntaxContextData* data)
181{ 186{
182 syntaxContextData *retval=new syntaxContextData; 187 syntaxContextData *retval=new syntaxContextData;
183 retval->parent=0; 188 retval->parent=0;
184 retval->currentGroup=0; 189 retval->currentGroup=0;
185 retval->item=0; 190 retval->item=0;
186 if (data != 0) 191 if (data != 0)
187 { 192 {
188 retval->parent=data->currentGroup; 193 retval->parent=data->currentGroup;
@@ -212,8 +217,8 @@ syntaxContextData* SyntaxDocument::getConfig(const QString& mainGroupName, const
212 if (e1->tagName()==Config) 217 if (e1->tagName()==Config)
213 { 218 {
214 syntaxContextData *data=new ( syntaxContextData); 219 syntaxContextData *data=new ( syntaxContextData);
215 data->currentGroup=0; 220 data->currentGroup=0;
216 data->parent=0; 221 data->parent=0;
217 data->item=e1; 222 data->item=e1;
218 return data; 223 return data;
219 } 224 }
@@ -254,8 +259,8 @@ syntaxContextData* SyntaxDocument::getGroupInfo(const QString& mainGroupName, co
254 { 259 {
255 syntaxContextData *data=new ( syntaxContextData); 260 syntaxContextData *data=new ( syntaxContextData);
256 data->parent=e1; 261 data->parent=e1;
257 data->currentGroup=0; 262 data->currentGroup=0;
258 data->item=0; 263 data->item=0;
259 return data; 264 return data;
260 } 265 }
261 266
@@ -284,19 +289,19 @@ QStringList& SyntaxDocument::finddata(const QString& mainGroup,const QString& ty
284 { 289 {
285 if (e->tagName()==mainGroup) 290 if (e->tagName()==mainGroup)
286 { 291 {
287 for (Opie::Core::XMLElement *e1=e->firstChild();e1;e1=e1->nextChild()) 292 for (Opie::Core::XMLElement *e1=e->firstChild();e1;e1=e1->nextChild())
288 { 293 {
289 if (e1->tagName()!="list") continue; 294 if (e1->tagName()!="list") continue;
290 295
291 if (e1->attribute("name")==type) 296 if (e1->attribute("name")==type)
292 { 297 {
293 for (Opie::Core::XMLElement *e2=e1->firstChild();e2;e2=e2->nextChild()) 298 for (Opie::Core::XMLElement *e2=e1->firstChild();e2;e2=e2->nextChild())
294 { 299 {
295 qDebug("FOUND A LIST ENTRY("+e2->tagName()+"):"+e2->firstChild()->value()); 300 odebug << "FOUND A LIST ENTRY("+e2->tagName()+"):"+e2->firstChild()->value() << oendl;
296 m_data+=e2->firstChild()->value().stripWhiteSpace(); 301 m_data+=e2->firstChild()->value().stripWhiteSpace();
297 } 302 }
298 break; 303 break;
299 } 304 }
300 } 305 }
301 break; 306 break;
302 } 307 }
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 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#define QTOPIA_INTERNAL_LANGLIST
22#include "kateconfig.h"
23
24/* OPIE */
25#include <opie2/odebug.h>
26#include <qpe/global.h>
27
28/* QT */
21#include <qdir.h> 29#include <qdir.h>
22#include <qmessagebox.h> 30#include <qmessagebox.h>
23#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 31#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
@@ -25,16 +33,13 @@
25#endif 33#endif
26#include <qtextstream.h> 34#include <qtextstream.h>
27 35
36/* STD */
28#include <sys/stat.h> 37#include <sys/stat.h>
29#include <sys/types.h> 38#include <sys/types.h>
30#include <fcntl.h> 39#include <fcntl.h>
31#include <stdlib.h> 40#include <stdlib.h>
32#include <unistd.h> 41#include <unistd.h>
33 42
34#define QTOPIA_INTERNAL_LANGLIST
35#include "kateconfig.h"
36#include <qpe/global.h>
37
38 43
39/*! 44/*!
40 \internal 45 \internal
@@ -42,14 +47,14 @@
42QString KateConfig::configFilename(const QString& name, Domain d) 47QString KateConfig::configFilename(const QString& name, Domain d)
43{ 48{
44 switch (d) { 49 switch (d) {
45 case File: 50 case File:
46 return name; 51 return name;
47 case User: { 52 case User: {
48 QDir dir = (QString(getenv("HOME")) + "/Settings"); 53 QDir dir = (QString(getenv("HOME")) + "/Settings");
49 if ( !dir.exists() ) 54 if ( !dir.exists() )
50 mkdir(dir.path().local8Bit(),0700); 55 mkdir(dir.path().local8Bit(),0700);
51 return dir.path() + "/" + name + ".conf"; 56 return dir.path() + "/" + name + ".conf";
52 } 57 }
53 } 58 }
54 return name; 59 return name;
55} 60}
@@ -93,7 +98,7 @@ QString KateConfig::configFilename(const QString& name, Domain d)
93KateConfig::KateConfig( const QString &name, Domain domain ) 98KateConfig::KateConfig( const QString &name, Domain domain )
94 : filename( configFilename(name,domain) ) 99 : filename( configFilename(name,domain) )
95{ 100{
96 qWarning("KateConfig constructor\n"); 101 owarn << "KateConfig constructor\n" << oendl;
97 git = groups.end(); 102 git = groups.end();
98 read(); 103 read();
99 QStringList l = Global::languageList(); 104 QStringList l = Global::languageList();
@@ -104,7 +109,7 @@ KateConfig::KateConfig( const QString &name, Domain domain )
104 109
105// Sharp ROM compatibility 110// Sharp ROM compatibility
106KateConfig::KateConfig ( const QString &name, bool what ) 111KateConfig::KateConfig ( const QString &name, bool what )
107 : filename( configFilename(name,what ? User : File) ) 112 : filename( configFilename(name,what ? User : File) )
108{ 113{
109 git = groups.end(); 114 git = groups.end();
110 read(); 115 read();
@@ -118,9 +123,9 @@ KateConfig::KateConfig ( const QString &name, bool what )
118*/ 123*/
119KateConfig::~KateConfig() 124KateConfig::~KateConfig()
120{ 125{
121 qWarning("KateConfig destructor\n"); 126 owarn << "KateConfig destructor\n" << oendl;
122 if ( changed ) 127 if ( changed )
123 write(); 128 write();
124} 129}
125 130
126/*! 131/*!
@@ -129,7 +134,7 @@ KateConfig::~KateConfig()
129bool KateConfig::hasKey( const QString &key ) const 134bool KateConfig::hasKey( const QString &key ) const
130{ 135{
131 if ( groups.end() == git ) 136 if ( groups.end() == git )
132 return FALSE; 137 return FALSE;
133 KateConfigGroup::ConstIterator it = ( *git ).find( key ); 138 KateConfigGroup::ConstIterator it = ( *git ).find( key );
134 return it != ( *git ).end(); 139 return it != ( *git ).end();
135} 140}
@@ -147,9 +152,9 @@ void KateConfig::setGroup( const QString &gname )
147{ 152{
148 QMap< QString, KateConfigGroup>::Iterator it = groups.find( gname ); 153 QMap< QString, KateConfigGroup>::Iterator it = groups.find( gname );
149 if ( it == groups.end() ) { 154 if ( it == groups.end() ) {
150 git = groups.insert( gname, KateConfigGroup() ); 155 git = groups.insert( gname, KateConfigGroup() );
151 changed = TRUE; 156 changed = TRUE;
152 return; 157 return;
153 } 158 }
154 git = it; 159 git = it;
155} 160}
@@ -172,12 +177,12 @@ void KateConfig::writeEntry( const QString &key, const char* value )
172void KateConfig::writeEntry( const QString &key, const QString &value ) 177void KateConfig::writeEntry( const QString &key, const QString &value )
173{ 178{
174 if ( git == groups.end() ) { 179 if ( git == groups.end() ) {
175 qWarning( "no group set" ); 180 owarn << "no group set" << oendl;
176 return; 181 return;
177 } 182 }
178 if ( (*git)[key] != value ) { 183 if ( (*git)[key] != value ) {
179 ( *git ).insert( key, value ); 184 ( *git ).insert( key, value );
180 changed = TRUE; 185 changed = TRUE;
181 } 186 }
182} 187}
183 188
@@ -196,12 +201,12 @@ static QString encipher(const QString& plain)
196 QString cipher; 201 QString cipher;
197 int mix=28730492; 202 int mix=28730492;
198 for (int i=0; i<(int)plain.length(); i++) { 203 for (int i=0; i<(int)plain.length(); i++) {
199 int u = plain[i].unicode(); 204 int u = plain[i].unicode();
200 int c = u ^ mix; 205 int c = u ^ mix;
201 QString x = QString::number(c,36); 206 QString x = QString::number(c,36);
202 cipher.append(QChar('a'+x.length())); 207 cipher.append(QChar('a'+x.length()));
203 cipher.append(x); 208 cipher.append(x);
204 mix *= u; 209 mix *= u;
205 } 210 }
206 return cipher; 211 return cipher;
207} 212}
@@ -211,11 +216,11 @@ static QString decipher(const QString& cipher)
211 QString plain; 216 QString plain;
212 int mix=28730492; 217 int mix=28730492;
213 for (int i=0; i<(int)cipher.length();) { 218 for (int i=0; i<(int)cipher.length();) {
214 int l = cipher[i].unicode()-'a'; 219 int l = cipher[i].unicode()-'a';
215 QString x = cipher.mid(i+1,l); i+=l+1; 220 QString x = cipher.mid(i+1,l); i+=l+1;
216 int u = x.toInt(0,36) ^ mix; 221 int u = x.toInt(0,36) ^ mix;
217 plain.append(QChar(u)); 222 plain.append(QChar(u));
218 mix *= u; 223 mix *= u;
219 } 224 }
220 return plain; 225 return plain;
221} 226}
@@ -232,13 +237,13 @@ static QString decipher(const QString& cipher)
232void KateConfig::writeEntryCrypt( const QString &key, const QString &value ) 237void KateConfig::writeEntryCrypt( const QString &key, const QString &value )
233{ 238{
234 if ( git == groups.end() ) { 239 if ( git == groups.end() ) {
235 qWarning( "no group set" ); 240 owarn << "no group set" << oendl;
236 return; 241 return;
237 } 242 }
238 QString evalue = encipher(value); 243 QString evalue = encipher(value);
239 if ( (*git)[key] != evalue ) { 244 if ( (*git)[key] != evalue ) {
240 ( *git ).insert( key, evalue ); 245 ( *git ).insert( key, evalue );
241 changed = TRUE; 246 changed = TRUE;
242 } 247 }
243} 248}
244 249
@@ -287,7 +292,7 @@ void KateConfig::writeEntry( const QString &key, const QStringList &lst, const Q
287 QString s; 292 QString s;
288 QStringList::ConstIterator it = lst.begin(); 293 QStringList::ConstIterator it = lst.begin();
289 for ( ; it != lst.end(); ++it ) 294 for ( ; it != lst.end(); ++it )
290 s += *it + sep; 295 s += *it + sep;
291 writeEntry( key, s ); 296 writeEntry( key, s );
292} 297}
293 298
@@ -297,7 +302,7 @@ void KateConfig::writeEntry( const QString &key, const QColor &val )
297 l.append( QString().setNum(val.red()) ); 302 l.append( QString().setNum(val.red()) );
298 l.append( QString().setNum(val.green()) ); 303 l.append( QString().setNum(val.green()) );
299 l.append( QString().setNum(val.blue()) ); 304 l.append( QString().setNum(val.blue()) );
300 305
301 writeEntry( key, l, QChar(',') ); 306 writeEntry( key, l, QChar(',') );
302} 307}
303 308
@@ -309,7 +314,7 @@ void KateConfig::writeEntry( const QString &key, const QFont &val )
309 l.append( QString().setNum(val.weight()) ); 314 l.append( QString().setNum(val.weight()) );
310 l.append( QString().setNum((int)val.italic()) ); 315 l.append( QString().setNum((int)val.italic()) );
311 l.append( QString().setNum((int)val.charSet()) ); 316 l.append( QString().setNum((int)val.charSet()) );
312 317
313 writeEntry( key, l, QChar(',') ); 318 writeEntry( key, l, QChar(',') );
314} 319}
315 320
@@ -321,8 +326,8 @@ void KateConfig::writeEntry( const QString &key, const QFont &val )
321void KateConfig::removeEntry( const QString &key ) 326void KateConfig::removeEntry( const QString &key )
322{ 327{
323 if ( git == groups.end() ) { 328 if ( git == groups.end() ) {
324 qWarning( "no group set" ); 329 owarn << "no group set" << oendl;
325 return; 330 return;
326 } 331 }
327 ( *git ).remove( key ); 332 ( *git ).remove( key );
328 changed = TRUE; 333 changed = TRUE;
@@ -354,11 +359,11 @@ QString KateConfig::readEntry( const QString &key, const QString &deflt )
354{ 359{
355 QString res = readEntryDirect( key+"["+lang+"]" ); 360 QString res = readEntryDirect( key+"["+lang+"]" );
356 if ( !res.isNull() ) 361 if ( !res.isNull() )
357 return res; 362 return res;
358 if ( !glang.isEmpty() ) { 363 if ( !glang.isEmpty() ) {
359 res = readEntryDirect( key+"["+glang+"]" ); 364 res = readEntryDirect( key+"["+glang+"]" );
360 if ( !res.isNull() ) 365 if ( !res.isNull() )
361 return res; 366 return res;
362 } 367 }
363 return readEntryDirect( key, deflt ); 368 return readEntryDirect( key, deflt );
364} 369}
@@ -377,11 +382,11 @@ QString KateConfig::readEntryCrypt( const QString &key, const QString &deflt )
377{ 382{
378 QString res = readEntryDirect( key+"["+lang+"]" ); 383 QString res = readEntryDirect( key+"["+lang+"]" );
379 if ( res.isNull() && glang.isEmpty() ) 384 if ( res.isNull() && glang.isEmpty() )
380 res = readEntryDirect( key+"["+glang+"]" ); 385 res = readEntryDirect( key+"["+glang+"]" );
381 if ( res.isNull() ) 386 if ( res.isNull() )
382 res = readEntryDirect( key, QString::null ); 387 res = readEntryDirect( key, QString::null );
383 if ( res.isNull() ) 388 if ( res.isNull() )
384 return deflt; 389 return deflt;
385 return decipher(res); 390 return decipher(res);
386} 391}
387 392
@@ -397,14 +402,14 @@ QString KateConfig::readEntryCrypt( const QString &key, const QString &deflt )
397QString KateConfig::readEntryDirect( const QString &key, const QString &deflt ) 402QString KateConfig::readEntryDirect( const QString &key, const QString &deflt )
398{ 403{
399 if ( git == groups.end() ) { 404 if ( git == groups.end() ) {
400 //qWarning( "no group set" ); 405 //owarn << "no group set" << oendl;
401 return deflt; 406 return deflt;
402 } 407 }
403 KateConfigGroup::ConstIterator it = ( *git ).find( key ); 408 KateConfigGroup::ConstIterator it = ( *git ).find( key );
404 if ( it != ( *git ).end() ) 409 if ( it != ( *git ).end() )
405 return *it; 410 return *it;
406 else 411 else
407 return deflt; 412 return deflt;
408} 413}
409 414
410/*! 415/*!
@@ -420,9 +425,9 @@ int KateConfig::readNumEntry( const QString &key, int deflt )
420{ 425{
421 QString s = readEntry( key ); 426 QString s = readEntry( key );
422 if ( s.isEmpty() ) 427 if ( s.isEmpty() )
423 return deflt; 428 return deflt;
424 else 429 else
425 return s.toInt(); 430 return s.toInt();
426} 431}
427 432
428/*! 433/*!
@@ -438,9 +443,9 @@ bool KateConfig::readBoolEntry( const QString &key, bool deflt )
438{ 443{
439 QString s = readEntry( key ); 444 QString s = readEntry( key );
440 if ( s.isEmpty() ) 445 if ( s.isEmpty() )
441 return deflt; 446 return deflt;
442 else 447 else
443 return (bool)s.toInt(); 448 return (bool)s.toInt();
444} 449}
445 450
446/*! 451/*!
@@ -456,9 +461,9 @@ QStringList KateConfig::readListEntry( const QString &key, const QChar &sep )
456{ 461{
457 QString s = readEntry( key ); 462 QString s = readEntry( key );
458 if ( s.isEmpty() ) 463 if ( s.isEmpty() )
459 return QStringList(); 464 return QStringList();
460 else 465 else
461 return QStringList::split( sep, s ); 466 return QStringList::split( sep, s );
462} 467}
463 468
464QColor KateConfig::readColorEntry( const QString &key, const QColor &def ) const 469QColor KateConfig::readColorEntry( const QString &key, const QColor &def ) const
@@ -484,7 +489,7 @@ QValueList<int> KateConfig::readIntListEntry( const QString &key ) const
484 QString s = readEntry( key ); 489 QString s = readEntry( key );
485 QValueList<int> il; 490 QValueList<int> il;
486 if ( s.isEmpty() ) 491 if ( s.isEmpty() )
487 return il; 492 return il;
488 493
489 QStringList l = QStringList::split( QChar(','), s ); 494 QStringList l = QStringList::split( QChar(','), s );
490 495
@@ -500,12 +505,12 @@ QValueList<int> KateConfig::readIntListEntry( const QString &key ) const
500void KateConfig::clearGroup() 505void KateConfig::clearGroup()
501{ 506{
502 if ( git == groups.end() ) { 507 if ( git == groups.end() ) {
503 qWarning( "no group set" ); 508 owarn << "no group set" << oendl;
504 return; 509 return;
505 } 510 }
506 if ( !(*git).isEmpty() ) { 511 if ( !(*git).isEmpty() ) {
507 ( *git ).clear(); 512 ( *git ).clear();
508 changed = TRUE; 513 changed = TRUE;
509 } 514 }
510} 515}
511 516
@@ -516,45 +521,45 @@ void KateConfig::write( const QString &fn )
516{ 521{
517 QString strNewFile; 522 QString strNewFile;
518 if ( !fn.isEmpty() ) 523 if ( !fn.isEmpty() )
519 filename = fn; 524 filename = fn;
520 strNewFile = filename + ".new"; 525 strNewFile = filename + ".new";
521 526
522 QFile f( strNewFile ); 527 QFile f( strNewFile );
523 if ( !f.open( IO_WriteOnly|IO_Raw ) ) { 528 if ( !f.open( IO_WriteOnly|IO_Raw ) ) {
524 qWarning( "could not open for writing `%s'", strNewFile.latin1() ); 529 owarn << "could not open for writing `" << strNewFile << "'" << oendl;
525 git = groups.end(); 530 git = groups.end();
526 return; 531 return;
527 } 532 }
528 533
529 QString str; 534 QString str;
530 QCString cstr; 535 QCString cstr;
531 QMap< QString, KateConfigGroup >::Iterator g_it = groups.begin(); 536 QMap< QString, KateConfigGroup >::Iterator g_it = groups.begin();
532 537
533 for ( ; g_it != groups.end(); ++g_it ) { 538 for ( ; g_it != groups.end(); ++g_it ) {
534 str += "[" + g_it.key() + "]\n"; 539 str += "[" + g_it.key() + "]\n";
535 KateConfigGroup::Iterator e_it = ( *g_it ).begin(); 540 KateConfigGroup::Iterator e_it = ( *g_it ).begin();
536 for ( ; e_it != ( *g_it ).end(); ++e_it ) 541 for ( ; e_it != ( *g_it ).end(); ++e_it )
537 str += e_it.key() + " = " + *e_it + "\n"; 542 str += e_it.key() + " = " + *e_it + "\n";
538 } 543 }
539 cstr = str.utf8(); 544 cstr = str.utf8();
540 545
541 int total_length; 546 int total_length;
542 total_length = f.writeBlock( cstr.data(), cstr.length() ); 547 total_length = f.writeBlock( cstr.data(), cstr.length() );
543 if ( total_length != int(cstr.length()) ) { 548 if ( total_length != int(cstr.length()) ) {
544 QMessageBox::critical( 0, QObject::tr("Out of Space"), 549 QMessageBox::critical( 0, QObject::tr("Out of Space"),
545 QObject::tr("There was a problem creating\nKateConfiguration Information \nfor this program.\n\nPlease free up some space and\ntry again.") ); 550 QObject::tr("There was a problem creating\nKateConfiguration Information \nfor this program.\n\nPlease free up some space and\ntry again.") );
546 f.close(); 551 f.close();
547 QFile::remove( strNewFile ); 552 QFile::remove( strNewFile );
548 return; 553 return;
549 } 554 }
550 555
551 f.close(); 556 f.close();
552 // now rename the file... 557 // now rename the file...
553 if ( rename( strNewFile, filename ) < 0 ) { 558 if ( rename( strNewFile, filename ) < 0 ) {
554 qWarning( "problem renaming the file %s to %s", strNewFile.latin1(), 559 qWarning( "problem renaming the file %s to %s", strNewFile.latin1(),
555 filename.latin1() ); 560 filename.latin1() );
556 QFile::remove( strNewFile ); 561 QFile::remove( strNewFile );
557 } 562 }
558} 563}
559 564
560/*! 565/*!
@@ -573,14 +578,14 @@ void KateConfig::read()
573 changed = FALSE; 578 changed = FALSE;
574 579
575 if ( !QFileInfo( filename ).exists() ) { 580 if ( !QFileInfo( filename ).exists() ) {
576 git = groups.end(); 581 git = groups.end();
577 return; 582 return;
578 } 583 }
579 584
580 QFile f( filename ); 585 QFile f( filename );
581 if ( !f.open( IO_ReadOnly ) ) { 586 if ( !f.open( IO_ReadOnly ) ) {
582 git = groups.end(); 587 git = groups.end();
583 return; 588 return;
584 } 589 }
585 590
586 QTextStream s( &f ); 591 QTextStream s( &f );
@@ -608,25 +613,25 @@ void KateConfig::read()
608bool KateConfig::parse( const QString &l ) 613bool KateConfig::parse( const QString &l )
609{ 614{
610 QString line = l.stripWhiteSpace(); 615 QString line = l.stripWhiteSpace();
611 616
612 if ( line [0] == QChar ( '#' )) 617 if ( line [0] == QChar ( '#' ))
613 return true; // ignore comments 618 return true; // ignore comments
614 619
615 if ( line[ 0 ] == QChar( '[' ) ) { 620 if ( line[ 0 ] == QChar( '[' ) ) {
616 QString gname = line; 621 QString gname = line;
617 gname = gname.remove( 0, 1 ); 622 gname = gname.remove( 0, 1 );
618 if ( gname[ (int)gname.length() - 1 ] == QChar( ']' ) ) 623 if ( gname[ (int)gname.length() - 1 ] == QChar( ']' ) )
619 gname = gname.remove( gname.length() - 1, 1 ); 624 gname = gname.remove( gname.length() - 1, 1 );
620 git = groups.insert( gname, KateConfigGroup() ); 625 git = groups.insert( gname, KateConfigGroup() );
621 } else if ( !line.isEmpty() ) { 626 } else if ( !line.isEmpty() ) {
622 if ( git == groups.end() ) 627 if ( git == groups.end() )
623 return FALSE; 628 return FALSE;
624 int eq = line.find( '=' ); 629 int eq = line.find( '=' );
625 if ( eq == -1 ) 630 if ( eq == -1 )
626 return FALSE; 631 return FALSE;
627 QString key = line.left(eq).stripWhiteSpace(); 632 QString key = line.left(eq).stripWhiteSpace();
628 QString value = line.mid(eq+1).stripWhiteSpace(); 633 QString value = line.mid(eq+1).stripWhiteSpace();
629 ( *git ).insert( key, value ); 634 ( *git ).insert( key, value );
630 } 635 }
631 return TRUE; 636 return TRUE;
632} 637}
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 @@
14 * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * 14 * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17#include <qaction.h>
18#include <qtoolbutton.h>
19#include <qmenubar.h>
20#include <qpe/resource.h>
21#include <qpe/qpeapplication.h>
22 17
18#include "tinykate.h"
19
20#include "katedocument.h"
21#include "kglobal.h"
22
23/* OPIE */
24#include <opie2/odebug.h>
23#include <opie2/ofiledialog.h> 25#include <opie2/ofiledialog.h>
26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h>
24 28
25#include "tinykate.h" 29/* QT */
30#include <qaction.h>
31#include <qtoolbutton.h>
32#include <qmenubar.h>
26 33
27#include <katedocument.h>
28#include <kglobal.h>
29 34
30using namespace Opie::Ui; 35using namespace Opie::Ui;
31TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : 36TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
@@ -152,7 +157,7 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
152 157
153TinyKate::~TinyKate( ) 158TinyKate::~TinyKate( )
154{ 159{
155 qWarning("TinyKate destructor\n"); 160 owarn << "TinyKate destructor\n" << oendl;
156 161
157 shutDown=true; 162 shutDown=true;
158 while (currentView!=0) { 163 while (currentView!=0) {
@@ -160,7 +165,7 @@ TinyKate::~TinyKate( )
160 } 165 }
161 166
162 if( KGlobal::config() != 0 ) { 167 if( KGlobal::config() != 0 ) {
163 qWarning("deleting KateConfig object..\n"); 168 owarn << "deleting KateConfig object..\n" << oendl;
164 delete KGlobal::config(); 169 delete KGlobal::config();
165 } 170 }
166} 171}
@@ -181,7 +186,7 @@ void TinyKate::open(const QString & filename)
181 QFileInfo fi(filename); 186 QFileInfo fi(filename);
182 QString filenamed = fi.fileName(); 187 QString filenamed = fi.fileName();
183 tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); 188 tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed );
184 qDebug(filename); 189 odebug << filename << oendl;
185 190
186 kd->setDocName( filenamed); 191 kd->setDocName( filenamed);
187 kd->open( filename ); 192 kd->open( filename );
@@ -249,7 +254,7 @@ void TinyKate::slotSave() {
249 254
250 // KateView *kv = (KateView*) currentView; 255 // KateView *kv = (KateView*) currentView;
251 KateDocument *kd = (KateDocument*) currentView->document(); 256 KateDocument *kd = (KateDocument*) currentView->document();
252 // qDebug("saving file "+kd->docName()); 257 // odebug << "saving file "+kd->docName() << oendl;
253 if( kd->docName().isEmpty()) 258 if( kd->docName().isEmpty())
254 slotSaveAs(); 259 slotSaveAs();
255 else 260 else
@@ -265,7 +270,7 @@ void TinyKate::slotSaveAs() {
265 QString filename= OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, 270 QString filename= OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL,
266 QString::null); 271 QString::null);
267 if (!filename.isEmpty()) { 272 if (!filename.isEmpty()) {
268 qDebug("saving file "+filename); 273 odebug << "saving file "+filename << oendl;
269 QFileInfo fi(filename); 274 QFileInfo fi(filename);
270 QString filenamed = fi.fileName(); 275 QString filenamed = fi.fileName();
271 kd->setDocFile( filename); 276 kd->setDocFile( filename);