summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp
Unidiff
Diffstat (limited to 'noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp69
1 files changed, 37 insertions, 32 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
@@ -13,21 +13,26 @@
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="";
@@ -36,13 +41,13 @@ SyntaxDocument::SyntaxDocument()
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;
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()
46{ 51{
47} 52}
48 53
@@ -73,27 +78,27 @@ void SyntaxDocument::setupModeList(bool force)
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);
@@ -177,15 +182,15 @@ void SyntaxDocument::freeGroupInfo( syntaxContextData* data)
177 delete data; 182 delete data;
178} 183}
179 184
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;
189 retval->currentGroup=data->item; 194 retval->currentGroup=data->item;
190 retval->item=0; 195 retval->item=0;
191 } 196 }
@@ -209,14 +214,14 @@ syntaxContextData* SyntaxDocument::getConfig(const QString& mainGroupName, const
209 { 214 {
210 kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (inner loop) " <<endl; 215 kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (inner loop) " <<endl;
211 216
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 }
220 225
221 e1=e1->nextChild(); 226 e1=e1->nextChild();
222 } 227 }
@@ -251,14 +256,14 @@ syntaxContextData* SyntaxDocument::getGroupInfo(const QString& mainGroupName, co
251 { 256 {
252 kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (inner loop) " <<endl; 257 kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (inner loop) " <<endl;
253 if (e1->tagName()==group+"s") 258 if (e1->tagName()==group+"s")
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
262 e1=e1->nextChild(); 267 e1=e1->nextChild();
263 } 268 }
264 269
@@ -281,25 +286,25 @@ QStringList& SyntaxDocument::finddata(const QString& mainGroup,const QString& ty
281 m_data.clear(); 286 m_data.clear();
282 287
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;