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.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp
index e45daa4..844f27d 100644
--- a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp
+++ b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp
@@ -7,31 +7,31 @@
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 <qfile.h> 20#include <qfile.h>
20#include <kdebug.h> 21#include <kdebug.h>
21#include <kstddirs.h> 22#include <kstddirs.h>
22#include <klocale.h> 23#include <klocale.h>
23#include <kmessagebox.h> 24#include <kmessagebox.h>
24#include <qstringlist.h> 25#include <qstringlist.h>
25#include <kconfig.h>
26#include <kglobal.h> 26#include <kglobal.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
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)
@@ -42,37 +42,36 @@ void SyntaxDocument::setIdentifier(const QString& 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;
53 53
54 KConfig *config=KGlobal::config(); 54 KateConfig *config=KGlobal::config();
55 KStandardDirs *dirs = KGlobal::dirs(); 55 KStandardDirs *dirs = KGlobal::dirs();
56 56
57// QStringList list=dirs->findAllResources("data","kate/syntax/*.xml",false,true); 57// QStringList list=dirs->findAllResources("data","kate/syntax/*.xml",false,true);
58 QString path=QPEApplication::qpeDir() +"share/tinykate/syntax/"; 58 QString path=QPEApplication::qpeDir() +"share/tinykate/syntax/";
59 59
60 QDir dir(path); 60 QDir dir(path);
61 QStringList list=dir.entryList("*.xml"); 61 QStringList list=dir.entryList("*.xml");
62 62
63 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) 63 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
64 { 64 {
65 QString Group="Highlighting_Cache"+path+*it; 65 QString Group="Highlighting_Cache"+path+*it;
66
67 if ((config->hasGroup(Group)) && (!force)) 66 if ((config->hasGroup(Group)) && (!force))
68 { 67 {
69 config->setGroup(Group); 68 config->setGroup(Group);
70 syntaxModeListItem *mli=new syntaxModeListItem; 69 syntaxModeListItem *mli=new syntaxModeListItem;
71 mli->name = config->readEntry("name",""); 70 mli->name = config->readEntry("name","");
72 mli->section = config->readEntry("section",""); 71 mli->section = config->readEntry("section","");
73 mli->mimetype = config->readEntry("mimetype",""); 72 mli->mimetype = config->readEntry("mimetype","");
74 mli->extension = config->readEntry("extension",""); 73 mli->extension = config->readEntry("extension","");
75 mli->identifier = *it; 74 mli->identifier = *it;
76 myModeList.append(mli); 75 myModeList.append(mli);
77 } 76 }
78 else 77 else
@@ -87,39 +86,34 @@ void SyntaxDocument::setupModeList(bool force)
87 if (e->tagName()=="language") 86 if (e->tagName()=="language")
88 { 87 {
89 syntaxModeListItem *mli=new syntaxModeListItem; 88 syntaxModeListItem *mli=new syntaxModeListItem;
90 mli->name = e->attribute("name"); 89 mli->name = e->attribute("name");
91 mli->section = e->attribute("section"); 90 mli->section = e->attribute("section");
92 mli->mimetype = e->attribute("mimetype"); 91 mli->mimetype = e->attribute("mimetype");
93 mli->extension = e->attribute("extensions"); 92 mli->extension = e->attribute("extensions");
94 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));
95 if (mli->section.isEmpty()) 94 if (mli->section.isEmpty())
96 mli->section=i18n("Other"); 95 mli->section=i18n("Other");
97 96
98 mli->identifier = path+(*it); 97 mli->identifier = path+(*it);
99#warning fixme
100/*
101 config->setGroup(Group); 98 config->setGroup(Group);
102 config->writeEntry("name",mli->name); 99 config->writeEntry("name",mli->name);
103 config->writeEntry("section",mli->section); 100 config->writeEntry("section",mli->section);
104 config->writeEntry("mimetype",mli->mimetype); 101 config->writeEntry("mimetype",mli->mimetype);
105 config->writeEntry("extension",mli->extension); 102 config->writeEntry("extension",mli->extension);
106*/
107 myModeList.append(mli); 103 myModeList.append(mli);
108 } 104 }
109 } 105 }
110 } 106 }
111 } 107 }
112// }
113
114// config->sync(); 108// config->sync();
115} 109}
116 110
117SyntaxModeList SyntaxDocument::modeList() 111SyntaxModeList SyntaxDocument::modeList()
118{ 112{
119 return myModeList; 113 return myModeList;
120} 114}
121 115
122bool SyntaxDocument::nextGroup( syntaxContextData* data) 116bool SyntaxDocument::nextGroup( syntaxContextData* data)
123{ 117{
124 if(!data) return false; 118 if(!data) return false;
125 119