author | jowenn <jowenn> | 2002-11-10 21:47:40 (UTC) |
---|---|---|
committer | jowenn <jowenn> | 2002-11-10 21:47:40 (UTC) |
commit | 727eb9283d10cf61cc7f7a8506124cab9f37f2ed (patch) (unidiff) | |
tree | eab18cc8dcb30b390bcded5c9107af9bff42da0a /noncore/apps | |
parent | 846ab99d6f52efaf3b2cc98231fe5fc985878516 (diff) | |
download | opie-727eb9283d10cf61cc7f7a8506124cab9f37f2ed.zip opie-727eb9283d10cf61cc7f7a8506124cab9f37f2ed.tar.gz opie-727eb9283d10cf61cc7f7a8506124cab9f37f2ed.tar.bz2 |
Look in the correct directory for hl files
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp index c51221b..3390bdb 100644 --- a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp +++ b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp | |||
@@ -15,26 +15,26 @@ | |||
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include "katesyntaxdocument.h" | 18 | #include "katesyntaxdocument.h" |
19 | #include <qfile.h> | 19 | #include <qfile.h> |
20 | #include <kdebug.h> | 20 | #include <kdebug.h> |
21 | #include <kstddirs.h> | 21 | #include <kstddirs.h> |
22 | #include <klocale.h> | 22 | #include <klocale.h> |
23 | #include <kmessagebox.h> | 23 | #include <kmessagebox.h> |
24 | #include <qstringlist.h> | 24 | #include <qstringlist.h> |
25 | #include <kconfig.h> | 25 | #include <kconfig.h> |
26 | #include <kglobal.h> | 26 | #include <kglobal.h> |
27 | 27 | #include <qpe/qpeapplication.h> | |
28 | 28 | #include <qdir.h> | |
29 | 29 | ||
30 | SyntaxDocument::SyntaxDocument() | 30 | SyntaxDocument::SyntaxDocument() |
31 | { | 31 | { |
32 | m_root=0; | 32 | m_root=0; |
33 | currentFile=""; | 33 | currentFile=""; |
34 | setupModeList(); | 34 | setupModeList(); |
35 | } | 35 | } |
36 | 36 | ||
37 | void SyntaxDocument::setIdentifier(const QString& identifier) | 37 | void 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::XMLElement::load(identifier); |
@@ -45,62 +45,66 @@ void SyntaxDocument::setIdentifier(const QString& identifier) | |||
45 | SyntaxDocument::~SyntaxDocument() | 45 | SyntaxDocument::~SyntaxDocument() |
46 | { | 46 | { |
47 | } | 47 | } |
48 | 48 | ||
49 | void SyntaxDocument::setupModeList(bool force) | 49 | void 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 | KConfig *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/"; | ||
59 | |||
60 | QDir dir(path); | ||
61 | QStringList list=dir.entryList("*.xml"); | ||
58 | 62 | ||
59 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) | 63 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
60 | { | 64 | { |
61 | QString Group="Highlighting_Cache"+*it; | 65 | QString Group="Highlighting_Cache"+path+*it; |
62 | 66 | ||
63 | if ((config->hasGroup(Group)) && (!force)) | 67 | if ((config->hasGroup(Group)) && (!force)) |
64 | { | 68 | { |
65 | config->setGroup(Group); | 69 | config->setGroup(Group); |
66 | syntaxModeListItem *mli=new syntaxModeListItem; | 70 | syntaxModeListItem *mli=new syntaxModeListItem; |
67 | mli->name = config->readEntry("name",""); | 71 | mli->name = config->readEntry("name",""); |
68 | mli->section = config->readEntry("section",""); | 72 | mli->section = config->readEntry("section",""); |
69 | mli->mimetype = config->readEntry("mimetype",""); | 73 | mli->mimetype = config->readEntry("mimetype",""); |
70 | mli->extension = config->readEntry("extension",""); | 74 | mli->extension = config->readEntry("extension",""); |
71 | mli->identifier = *it; | 75 | mli->identifier = *it; |
72 | myModeList.append(mli); | 76 | myModeList.append(mli); |
73 | } | 77 | } |
74 | else | 78 | else |
75 | { | 79 | { |
76 | qDebug("Found a description file:"+(*it)); | 80 | qDebug("Found a description file:"+path+(*it)); |
77 | setIdentifier(*it); | 81 | setIdentifier(path+(*it)); |
78 | Opie::XMLElement *e=m_root; | 82 | Opie::XMLElement *e=m_root; |
79 | if (e) | 83 | if (e) |
80 | { | 84 | { |
81 | e=e->firstChild(); | 85 | e=e->firstChild(); |
82 | qDebug(e->tagName()); | 86 | qDebug(e->tagName()); |
83 | if (e->tagName()=="language") | 87 | if (e->tagName()=="language") |
84 | { | 88 | { |
85 | syntaxModeListItem *mli=new syntaxModeListItem; | 89 | syntaxModeListItem *mli=new syntaxModeListItem; |
86 | mli->name = e->attribute("name"); | 90 | mli->name = e->attribute("name"); |
87 | mli->section = e->attribute("section"); | 91 | mli->section = e->attribute("section"); |
88 | mli->mimetype = e->attribute("mimetype"); | 92 | mli->mimetype = e->attribute("mimetype"); |
89 | mli->extension = e->attribute("extensions"); | 93 | mli->extension = e->attribute("extensions"); |
90 | qDebug(QString("valid description for: %1/%2").arg(mli->section).arg(mli->name)); | 94 | qDebug(QString("valid description for: %1/%2").arg(mli->section).arg(mli->name)); |
91 | if (mli->section.isEmpty()) | 95 | if (mli->section.isEmpty()) |
92 | mli->section=i18n("Other"); | 96 | mli->section=i18n("Other"); |
93 | 97 | ||
94 | mli->identifier = *it; | 98 | mli->identifier = path+(*it); |
95 | #warning fixme | 99 | #warning fixme |
96 | /* | 100 | /* |
97 | config->setGroup(Group); | 101 | config->setGroup(Group); |
98 | config->writeEntry("name",mli->name); | 102 | config->writeEntry("name",mli->name); |
99 | config->writeEntry("section",mli->section); | 103 | config->writeEntry("section",mli->section); |
100 | config->writeEntry("mimetype",mli->mimetype); | 104 | config->writeEntry("mimetype",mli->mimetype); |
101 | config->writeEntry("extension",mli->extension); | 105 | config->writeEntry("extension",mli->extension); |
102 | */ | 106 | */ |
103 | myModeList.append(mli); | 107 | myModeList.append(mli); |
104 | } | 108 | } |
105 | } | 109 | } |
106 | } | 110 | } |