summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp
Unidiff
Diffstat (limited to 'noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp27
1 files changed, 16 insertions, 11 deletions
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
@@ -7,33 +7,38 @@
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
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()
31{ 36{
32 m_root=0; 37 m_root=0;
33 currentFile=""; 38 currentFile="";
34 setupModeList(); 39 setupModeList();
35} 40}
36 41
37void SyntaxDocument::setIdentifier(const QString& identifier) 42void SyntaxDocument::setIdentifier(const QString& identifier)
38{ 43{
39#warning FIXME delete m_root; 44#warning FIXME delete m_root;
@@ -67,39 +72,39 @@ void SyntaxDocument::setupModeList(bool force)
67 { 72 {
68 config->setGroup(Group); 73 config->setGroup(Group);
69 syntaxModeListItem *mli=new syntaxModeListItem; 74 syntaxModeListItem *mli=new syntaxModeListItem;
70 mli->name = config->readEntry("name",""); 75 mli->name = config->readEntry("name","");
71 mli->section = config->readEntry("section",""); 76 mli->section = config->readEntry("section","");
72 mli->mimetype = config->readEntry("mimetype",""); 77 mli->mimetype = config->readEntry("mimetype","");
73 mli->extension = config->readEntry("extension",""); 78 mli->extension = config->readEntry("extension","");
74 mli->identifier = path+*it; 79 mli->identifier = path+*it;
75 myModeList.append(mli); 80 myModeList.append(mli);
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;
89 mli->name = e->attribute("name"); 94 mli->name = e->attribute("name");
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
97 mli->identifier = path+(*it); 102 mli->identifier = path+(*it);
98 config->setGroup(Group); 103 config->setGroup(Group);
99 config->writeEntry("name",mli->name); 104 config->writeEntry("name",mli->name);
100 config->writeEntry("section",mli->section); 105 config->writeEntry("section",mli->section);
101 config->writeEntry("mimetype",mli->mimetype); 106 config->writeEntry("mimetype",mli->mimetype);
102 config->writeEntry("extension",mli->extension); 107 config->writeEntry("extension",mli->extension);
103 myModeList.append(mli); 108 myModeList.append(mli);
104 } 109 }
105 } 110 }
@@ -283,24 +288,24 @@ QStringList& SyntaxDocument::finddata(const QString& mainGroup,const QString& ty
283 for(e=e->firstChild(); e; e=e->nextChild()) 288 for(e=e->firstChild(); e; e=e->nextChild())
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 }
303 } 308 }
304 309
305 return m_data; 310 return m_data;
306} 311}