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.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp index 844f27d..f90a5f8 100644 --- a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp +++ b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp | |||
@@ -50,82 +50,83 @@ void SyntaxDocument::setupModeList(bool force) | |||
50 | { | 50 | { |
51 | 51 | ||
52 | if (myModeList.count() > 0) return; | 52 | if (myModeList.count() > 0) return; |
53 | 53 | ||
54 | KateConfig *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 | if ((config->hasGroup(Group)) && (!force)) | 66 | if ((config->hasGroup(Group)) && (!force)) |
67 | { | 67 | { |
68 | config->setGroup(Group); | 68 | config->setGroup(Group); |
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 = *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::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)); |
94 | if (mli->section.isEmpty()) | 94 | if (mli->section.isEmpty()) |
95 | mli->section=i18n("Other"); | 95 | mli->section=i18n("Other"); |
96 | 96 | ||
97 | mli->identifier = path+(*it); | 97 | mli->identifier = path+(*it); |
98 | config->setGroup(Group); | 98 | config->setGroup(Group); |
99 | config->writeEntry("name",mli->name); | 99 | config->writeEntry("name",mli->name); |
100 | config->writeEntry("section",mli->section); | 100 | config->writeEntry("section",mli->section); |
101 | config->writeEntry("mimetype",mli->mimetype); | 101 | config->writeEntry("mimetype",mli->mimetype); |
102 | config->writeEntry("extension",mli->extension); | 102 | config->writeEntry("extension",mli->extension); |
103 | myModeList.append(mli); | 103 | myModeList.append(mli); |
104 | } | 104 | } |
105 | } | 105 | } |
106 | } | 106 | } |
107 | } | 107 | } |
108 | config->write(); | ||
108 | // config->sync(); | 109 | // config->sync(); |
109 | } | 110 | } |
110 | 111 | ||
111 | SyntaxModeList SyntaxDocument::modeList() | 112 | SyntaxModeList SyntaxDocument::modeList() |
112 | { | 113 | { |
113 | return myModeList; | 114 | return myModeList; |
114 | } | 115 | } |
115 | 116 | ||
116 | bool SyntaxDocument::nextGroup( syntaxContextData* data) | 117 | bool SyntaxDocument::nextGroup( syntaxContextData* data) |
117 | { | 118 | { |
118 | if(!data) return false; | 119 | if(!data) return false; |
119 | 120 | ||
120 | if (!data->currentGroup) | 121 | if (!data->currentGroup) |
121 | data->currentGroup=data->parent->firstChild(); | 122 | data->currentGroup=data->parent->firstChild(); |
122 | else | 123 | else |
123 | data->currentGroup=data->currentGroup->nextChild(); | 124 | data->currentGroup=data->currentGroup->nextChild(); |
124 | 125 | ||
125 | data->item=0; | 126 | data->item=0; |
126 | 127 | ||
127 | if (!data->currentGroup) | 128 | if (!data->currentGroup) |
128 | return false; | 129 | return false; |
129 | else | 130 | else |
130 | return true; | 131 | return true; |
131 | } | 132 | } |