summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate/libkate
Unidiff
Diffstat (limited to 'noncore/apps/tinykate/libkate') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/document/katebuffer.cpp25
-rw-r--r--noncore/apps/tinykate/libkate/document/katedocument.cpp53
-rw-r--r--noncore/apps/tinykate/libkate/document/katehighlight.cpp46
-rw-r--r--noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp27
-rw-r--r--noncore/apps/tinykate/libkate/kateconfig.cpp29
5 files changed, 98 insertions, 82 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.
@@ -66,7 +67,7 @@ void
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();
@@ -121,7 +122,7 @@ 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;
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
@@ -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
67//#include <kcharsets.h>
68#include <kdebug.h>
69//#include <kinstance.h>
70
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 76
79#include "katecmd.h" 77/* STD */
78#include <sys/time.h>
79#include <unistd.h>
80#include <stdio.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) {
@@ -298,14 +299,14 @@ void KateDocument::openURL(const QString &filename)
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();
@@ -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,7 +1924,7 @@ 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);
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
@@ -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
@@ -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"));
@@ -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
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()
@@ -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
@@ -292,7 +297,7 @@ QStringList& SyntaxDocument::finddata(const QString& mainGroup,const QString& ty
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;
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
@@ -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();
@@ -118,7 +123,7 @@ 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}
@@ -172,7 +177,7 @@ 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 ) {
@@ -232,7 +237,7 @@ 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);
@@ -321,7 +326,7 @@ 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 );
@@ -397,7 +402,7 @@ 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 );
@@ -500,7 +505,7 @@ 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() ) {
@@ -521,7 +526,7 @@ void KateConfig::write( const QString &fn )
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 }