author | jowenn <jowenn> | 2002-11-10 21:47:40 (UTC) |
---|---|---|
committer | jowenn <jowenn> | 2002-11-10 21:47:40 (UTC) |
commit | 727eb9283d10cf61cc7f7a8506124cab9f37f2ed (patch) (side-by-side diff) | |
tree | eab18cc8dcb30b390bcded5c9107af9bff42da0a | |
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 @@ -1,158 +1,162 @@ /*************************************************************************** katesyntaxdocument.cpp - description ------------------- begin : Sat 31 March 2001 copyright : (C) 2001,2002 by Joseph Wenninger email : jowenn@kde.org ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "katesyntaxdocument.h" #include <qfile.h> #include <kdebug.h> #include <kstddirs.h> #include <klocale.h> #include <kmessagebox.h> #include <qstringlist.h> #include <kconfig.h> #include <kglobal.h> - - +#include <qpe/qpeapplication.h> +#include <qdir.h> SyntaxDocument::SyntaxDocument() { m_root=0; currentFile=""; setupModeList(); } void SyntaxDocument::setIdentifier(const QString& identifier) { #warning FIXME delete m_root; m_root=Opie::XMLElement::load(identifier); if (!m_root) KMessageBox::error( 0L, i18n("Can't open %1").arg(identifier) ); } SyntaxDocument::~SyntaxDocument() { } void SyntaxDocument::setupModeList(bool force) { if (myModeList.count() > 0) return; KConfig *config=KGlobal::config(); KStandardDirs *dirs = KGlobal::dirs(); - QStringList list=dirs->findAllResources("data","kate/syntax/*.xml",false,true); +// QStringList list=dirs->findAllResources("data","kate/syntax/*.xml",false,true); + QString path=QPEApplication::qpeDir() +"share/tinykate/syntax/"; + + QDir dir(path); + QStringList list=dir.entryList("*.xml"); for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { - QString Group="Highlighting_Cache"+*it; + QString Group="Highlighting_Cache"+path+*it; if ((config->hasGroup(Group)) && (!force)) { config->setGroup(Group); syntaxModeListItem *mli=new syntaxModeListItem; mli->name = config->readEntry("name",""); mli->section = config->readEntry("section",""); mli->mimetype = config->readEntry("mimetype",""); mli->extension = config->readEntry("extension",""); mli->identifier = *it; myModeList.append(mli); } else { - qDebug("Found a description file:"+(*it)); - setIdentifier(*it); + qDebug("Found a description file:"+path+(*it)); + setIdentifier(path+(*it)); Opie::XMLElement *e=m_root; if (e) { e=e->firstChild(); qDebug(e->tagName()); if (e->tagName()=="language") { syntaxModeListItem *mli=new syntaxModeListItem; mli->name = e->attribute("name"); mli->section = e->attribute("section"); mli->mimetype = e->attribute("mimetype"); mli->extension = e->attribute("extensions"); qDebug(QString("valid description for: %1/%2").arg(mli->section).arg(mli->name)); if (mli->section.isEmpty()) mli->section=i18n("Other"); - mli->identifier = *it; + mli->identifier = path+(*it); #warning fixme /* config->setGroup(Group); config->writeEntry("name",mli->name); config->writeEntry("section",mli->section); config->writeEntry("mimetype",mli->mimetype); config->writeEntry("extension",mli->extension); */ myModeList.append(mli); } } } } // } // config->sync(); } SyntaxModeList SyntaxDocument::modeList() { return myModeList; } bool SyntaxDocument::nextGroup( syntaxContextData* data) { if(!data) return false; if (!data->currentGroup) data->currentGroup=data->parent->firstChild(); else data->currentGroup=data->currentGroup->nextChild(); data->item=0; if (!data->currentGroup) return false; else return true; } bool SyntaxDocument::nextItem( syntaxContextData* data) { if(!data) return false; if (!data->item) data->item=data->currentGroup->firstChild(); else data->item=data->item->nextChild(); if (!data->item) return false; else return true; } QString SyntaxDocument::groupItemData( syntaxContextData* data,QString name) { if(!data) return QString::null; if ( (data->item) && (name.isEmpty())) return data->item->tagName(); if (data->item) |