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.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp
index f90a5f8..6059e9b 100644
--- a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp
+++ b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp
@@ -28,25 +28,25 @@
28#include <qdir.h> 28#include <qdir.h>
29 29
30SyntaxDocument::SyntaxDocument() 30SyntaxDocument::SyntaxDocument()
31{ 31{
32 m_root=0; 32 m_root=0;
33 currentFile=""; 33 currentFile="";
34 setupModeList(); 34 setupModeList();
35} 35}
36 36
37void SyntaxDocument::setIdentifier(const QString& identifier) 37void SyntaxDocument::setIdentifier(const QString& identifier)
38{ 38{
39#warning FIXME delete m_root; 39#warning FIXME delete m_root;
40 m_root=Opie::XMLElement::load(identifier); 40 m_root=Opie::Core::XMLElement::load(identifier);
41 if (!m_root) KMessageBox::error( 0L, i18n("Can't open %1").arg(identifier) ); 41 if (!m_root) KMessageBox::error( 0L, i18n("Can't open %1").arg(identifier) );
42 42
43} 43}
44 44
45SyntaxDocument::~SyntaxDocument() 45SyntaxDocument::~SyntaxDocument()
46{ 46{
47} 47}
48 48
49void SyntaxDocument::setupModeList(bool force) 49void SyntaxDocument::setupModeList(bool force)
50{ 50{
51 51
52 if (myModeList.count() > 0) return; 52 if (myModeList.count() > 0) return;
@@ -69,25 +69,25 @@ void SyntaxDocument::setupModeList(bool force)
69 syntaxModeListItem *mli=new syntaxModeListItem; 69 syntaxModeListItem *mli=new syntaxModeListItem;
70 mli->name = config->readEntry("name",""); 70 mli->name = config->readEntry("name","");
71 mli->section = config->readEntry("section",""); 71 mli->section = config->readEntry("section","");
72 mli->mimetype = config->readEntry("mimetype",""); 72 mli->mimetype = config->readEntry("mimetype","");
73 mli->extension = config->readEntry("extension",""); 73 mli->extension = config->readEntry("extension","");
74 mli->identifier = path+*it; 74 mli->identifier = path+*it;
75 myModeList.append(mli); 75 myModeList.append(mli);
76 } 76 }
77 else 77 else
78 { 78 {
79 qDebug("Found a description file:"+path+(*it)); 79 qDebug("Found a description file:"+path+(*it));
80 setIdentifier(path+(*it)); 80 setIdentifier(path+(*it));
81 Opie::XMLElement *e=m_root; 81 Opie::Core::XMLElement *e=m_root;
82 if (e) 82 if (e)
83 { 83 {
84 e=e->firstChild(); 84 e=e->firstChild();
85 qDebug(e->tagName()); 85 qDebug(e->tagName());
86 if (e->tagName()=="language") 86 if (e->tagName()=="language")
87 { 87 {
88 syntaxModeListItem *mli=new syntaxModeListItem; 88 syntaxModeListItem *mli=new syntaxModeListItem;
89 mli->name = e->attribute("name"); 89 mli->name = e->attribute("name");
90 mli->section = e->attribute("section"); 90 mli->section = e->attribute("section");
91 mli->mimetype = e->attribute("mimetype"); 91 mli->mimetype = e->attribute("mimetype");
92 mli->extension = e->attribute("extensions"); 92 mli->extension = e->attribute("extensions");
93 qDebug(QString("valid description for: %1/%2").arg(mli->section).arg(mli->name)); 93 qDebug(QString("valid description for: %1/%2").arg(mli->section).arg(mli->name));
@@ -186,33 +186,33 @@ syntaxContextData* SyntaxDocument::getSubItems(syntaxContextData* data)
186 if (data != 0) 186 if (data != 0)
187 { 187 {
188 retval->parent=data->currentGroup; 188 retval->parent=data->currentGroup;
189 retval->currentGroup=data->item; 189 retval->currentGroup=data->item;
190 retval->item=0; 190 retval->item=0;
191 } 191 }
192 192
193 return retval; 193 return retval;
194} 194}
195 195
196syntaxContextData* SyntaxDocument::getConfig(const QString& mainGroupName, const QString &Config) 196syntaxContextData* SyntaxDocument::getConfig(const QString& mainGroupName, const QString &Config)
197{ 197{
198 Opie::XMLElement *e = m_root->firstChild()->firstChild(); 198 Opie::Core::XMLElement *e = m_root->firstChild()->firstChild();
199 199
200 while (e) 200 while (e)
201 { 201 {
202 kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (outer loop) " <<endl; 202 kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (outer loop) " <<endl;
203 203
204 if (e->tagName().compare(mainGroupName)==0 ) 204 if (e->tagName().compare(mainGroupName)==0 )
205 { 205 {
206 Opie::XMLElement *e1=e->firstChild(); 206 Opie::Core::XMLElement *e1=e->firstChild();
207 207
208 while (e1) 208 while (e1)
209 { 209 {
210 kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (inner loop) " <<endl; 210 kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (inner loop) " <<endl;
211 211
212 if (e1->tagName()==Config) 212 if (e1->tagName()==Config)
213 { 213 {
214 syntaxContextData *data=new ( syntaxContextData); 214 syntaxContextData *data=new ( syntaxContextData);
215 data->currentGroup=0; 215 data->currentGroup=0;
216 data->parent=0; 216 data->parent=0;
217 data->item=e1; 217 data->item=e1;
218 return data; 218 return data;
@@ -228,33 +228,33 @@ syntaxContextData* SyntaxDocument::getConfig(const QString& mainGroupName, const
228 e=e->nextChild(); 228 e=e->nextChild();
229 } 229 }
230 230
231 kdDebug(13010) << "WARNING :returning null 4" << endl; 231 kdDebug(13010) << "WARNING :returning null 4" << endl;
232 return 0; 232 return 0;
233} 233}
234 234
235 235
236 236
237syntaxContextData* SyntaxDocument::getGroupInfo(const QString& mainGroupName, const QString &group) 237syntaxContextData* SyntaxDocument::getGroupInfo(const QString& mainGroupName, const QString &group)
238{ 238{
239 239
240 Opie::XMLElement *e=m_root->firstChild()->firstChild(); 240 Opie::Core::XMLElement *e=m_root->firstChild()->firstChild();
241 241
242 while (e) 242 while (e)
243 { 243 {
244 kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (outer loop) " <<endl; 244 kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (outer loop) " <<endl;
245 245
246 if (e->tagName().compare(mainGroupName)==0 ) 246 if (e->tagName().compare(mainGroupName)==0 )
247 { 247 {
248 Opie::XMLElement *e1=e->firstChild(); 248 Opie::Core::XMLElement *e1=e->firstChild();
249 249
250 while (e1) 250 while (e1)
251 { 251 {
252 kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (inner loop) " <<endl; 252 kdDebug(13010)<<"in SyntaxDocument::getGroupInfo (inner loop) " <<endl;
253 if (e1->tagName()==group+"s") 253 if (e1->tagName()==group+"s")
254 { 254 {
255 syntaxContextData *data=new ( syntaxContextData); 255 syntaxContextData *data=new ( syntaxContextData);
256 data->parent=e1; 256 data->parent=e1;
257 data->currentGroup=0; 257 data->currentGroup=0;
258 data->item=0; 258 data->item=0;
259 return data; 259 return data;
260 } 260 }
@@ -267,39 +267,39 @@ syntaxContextData* SyntaxDocument::getGroupInfo(const QString& mainGroupName, co
267 } 267 }
268 268
269 e=e->nextChild(); 269 e=e->nextChild();
270 } 270 }
271 271
272 kdDebug(13010) << "WARNING : getGroupInfo returning null :2" << endl; 272 kdDebug(13010) << "WARNING : getGroupInfo returning null :2" << endl;
273 return 0; 273 return 0;
274} 274}
275 275
276 276
277QStringList& SyntaxDocument::finddata(const QString& mainGroup,const QString& type,bool clearList) 277QStringList& SyntaxDocument::finddata(const QString& mainGroup,const QString& type,bool clearList)
278{ 278{
279 Opie::XMLElement *e = m_root->firstChild(); 279 Opie::Core::XMLElement *e = m_root->firstChild();
280 if (clearList) 280 if (clearList)
281 m_data.clear(); 281 m_data.clear();
282 282
283 for(e=e->firstChild(); e; e=e->nextChild()) 283 for(e=e->firstChild(); e; e=e->nextChild())
284 { 284 {
285 if (e->tagName()==mainGroup) 285 if (e->tagName()==mainGroup)
286 { 286 {
287 for (Opie::XMLElement *e1=e->firstChild();e1;e1=e1->nextChild()) 287 for (Opie::Core::XMLElement *e1=e->firstChild();e1;e1=e1->nextChild())
288 { 288 {
289 if (e1->tagName()!="list") continue; 289 if (e1->tagName()!="list") continue;
290 290
291 if (e1->attribute("name")==type) 291 if (e1->attribute("name")==type)
292 { 292 {
293 for (Opie::XMLElement *e2=e1->firstChild();e2;e2=e2->nextChild()) 293 for (Opie::Core::XMLElement *e2=e1->firstChild();e2;e2=e2->nextChild())
294 { 294 {
295 qDebug("FOUND A LIST ENTRY("+e2->tagName()+"):"+e2->firstChild()->value()); 295 qDebug("FOUND A LIST ENTRY("+e2->tagName()+"):"+e2->firstChild()->value());
296 m_data+=e2->firstChild()->value().stripWhiteSpace(); 296 m_data+=e2->firstChild()->value().stripWhiteSpace();
297 } 297 }
298 break; 298 break;
299 } 299 }
300 } 300 }
301 break; 301 break;
302 } 302 }
303 } 303 }
304 304
305 return m_data; 305 return m_data;