Diffstat (limited to 'noncore/apps/tinykate/libkate/document') (more/less context) (show whitespace changes)
5 files changed, 37 insertions, 44 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katedocument.cpp b/noncore/apps/tinykate/libkate/document/katedocument.cpp index df1de8d..6807544 100644 --- a/noncore/apps/tinykate/libkate/document/katedocument.cpp +++ b/noncore/apps/tinykate/libkate/document/katedocument.cpp @@ -277,12 +277,13 @@ void KateDocument::doPreHighlight() QTimer::singleShot(10,this,SLOT(doPreHighlight())); } KateDocument::~KateDocument() { m_highlight->release(); + writeConfig(); if ( !m_bSingleViewMode ) { m_views.setAutoDelete( true ); m_views.clear(); m_views.setAutoDelete( false ); @@ -593,51 +594,49 @@ void KateDocument::setModified(bool m) { bool KateDocument::isModified() const { return modified; } void KateDocument::readConfig() { - KConfig *config = KGlobal::config(); + KateConfig *config = KGlobal::config(); config->setGroup("Kate Document"); myWordWrap = config->readBoolEntry("Word Wrap On", false); myWordWrapAt = config->readNumEntry("Word Wrap At", 80); if (myWordWrap) wrapText (myWordWrapAt); setTabWidth(config->readNumEntry("TabWidth", 8)); setUndoSteps(config->readNumEntry("UndoSteps", 50)); m_singleSelection = config->readBoolEntry("SingleSelection", false); myEncoding = config->readEntry("Encoding", QString::fromLatin1(QTextCodec::codecForLocale()->name())); - setFont (config->readFontEntry("Font", &myFont)); + setFont (config->readFontEntry("Font", myFont)); - colors[0] = config->readColorEntry("Color Background", &colors[0]); - colors[1] = config->readColorEntry("Color Selected", &colors[1]); + colors[0] = config->readColorEntry("Color Background", colors[0]); + colors[1] = config->readColorEntry("Color Selected", colors[1]); - config->sync(); +// config->sync(); } void KateDocument::writeConfig() { - KConfig *config = KGlobal::config(); + KateConfig *config = KGlobal::config(); config->setGroup("Kate Document"); -#if 0 - cofig->writeEntry("Word Wrap On", myWordWrap); + config->writeEntry("Word Wrap On", myWordWrap); config->writeEntry("Word Wrap At", myWordWrapAt); config->writeEntry("TabWidth", tabChars); config->writeEntry("UndoSteps", undoSteps); config->writeEntry("SingleSelection", m_singleSelection); config->writeEntry("Encoding", myEncoding); config->writeEntry("Font", myFont); config->writeEntry("Color Background", colors[0]); config->writeEntry("Color Selected", colors[1]); -#endif - config->sync(); +// config->sync(); } -void KateDocument::readSessionConfig(KConfig *config) +void KateDocument::readSessionConfig(KateConfig *config) { m_url = config->readEntry("URL"); // ### doesn't this break the encoding? (Simon) setHighlight(hlManager->nameFind(config->readEntry("Highlight"))); // anders: restore bookmarks if possible QValueList<int> l = config->readIntListEntry("Bookmarks"); if ( l.count() ) { @@ -645,13 +644,13 @@ void KateDocument::readSessionConfig(KConfig *config) if ( numLines() < l[i] ) break; getTextLine( l[i] )->addMark( Bookmark ); } } } -void KateDocument::writeSessionConfig(KConfig *config) +void KateDocument::writeSessionConfig(KateConfig *config) { #if 0 config->writeEntry("URL", m_url); // ### encoding?? (Simon) config->writeEntry("Highlight", m_highlight->name()); // anders: save bookmarks QList<Kate::Mark> l = marks(); diff --git a/noncore/apps/tinykate/libkate/document/katedocument.h b/noncore/apps/tinykate/libkate/document/katedocument.h index 356541f..9d8ec6a 100644 --- a/noncore/apps/tinykate/libkate/document/katedocument.h +++ b/noncore/apps/tinykate/libkate/document/katedocument.h @@ -226,14 +226,14 @@ class KateDocument: public Kate::Document virtual bool isModified() const; void setSingleSelection(bool ss) {m_singleSelection = ss;} bool singleSelection() {return m_singleSelection;} void readConfig(); void writeConfig(); - void readSessionConfig(KConfig *); - void writeSessionConfig(KConfig *); + void readSessionConfig(KateConfig *); + void writeSessionConfig(KateConfig *); bool hasBrowserExtension() const { return m_bBrowserView; } protected: bool m_bBrowserView; diff --git a/noncore/apps/tinykate/libkate/document/katehighlight.cpp b/noncore/apps/tinykate/libkate/document/katehighlight.cpp index 797968b..0d2c283 100644 --- a/noncore/apps/tinykate/libkate/document/katehighlight.cpp +++ b/noncore/apps/tinykate/libkate/document/katehighlight.cpp @@ -646,43 +646,43 @@ int Highlight::doHighlight(int ctxNum, TextLine *textLine) textLine->setAttr(context->attr); //return new context return context->ctx; } -KConfig *Highlight::getKConfig() { - KConfig *config; +KateConfig *Highlight::getKateConfig() { + KateConfig *config; config=KGlobal::config(); config->setGroup(iName + QString(" Highlight")); return config; } QString Highlight::getWildcards() { - KConfig *config; + KateConfig *config; - config = getKConfig(); + config = getKateConfig(); //if wildcards not yet in config, then use iWildCards as default return config->readEntry("Wildcards", iWildcards); } QString Highlight::getMimetypes() { - KConfig *config; + KateConfig *config; - config = getKConfig(); + config = getKateConfig(); return config->readEntry("Mimetypes", iMimetypes); } HlData *Highlight::getData() { - KConfig *config; + KateConfig *config; HlData *hlData; - config = getKConfig(); + config = getKateConfig(); // iWildcards = config->readEntry("Wildcards"); // iMimetypes = config->readEntry("Mimetypes"); // hlData = new HlData(iWildcards,iMimetypes); hlData = new HlData( config->readEntry("Wildcards", iWildcards), @@ -690,33 +690,33 @@ HlData *Highlight::getData() { config->readEntry("Identifier", identifier)); getItemDataList(hlData->itemDataList, config); return hlData; } void Highlight::setData(HlData *hlData) { - KConfig *config; + KateConfig *config; - config = getKConfig(); + config = getKateConfig(); // iWildcards = hlData->wildcards; // iMimetypes = hlData->mimetypes; config->writeEntry("Wildcards",hlData->wildcards); config->writeEntry("Mimetypes",hlData->mimetypes); setItemDataList(hlData->itemDataList,config); } void Highlight::getItemDataList(ItemDataList &list) { - KConfig *config; + KateConfig *config; - config = getKConfig(); + config = getKateConfig(); getItemDataList(list, config); } -void Highlight::getItemDataList(ItemDataList &list, KConfig *config) { +void Highlight::getItemDataList(ItemDataList &list, KateConfig *config) { ItemData *p; QString s; QRgb col, selCol; list.clear(); //JW list.setAutoDelete(true); @@ -736,22 +736,22 @@ void Highlight::getItemDataList(ItemDataList &list, KConfig *config) { Highlight - setItemDataList saves the ItemData / attribute / style definitions to the apps configfile. Especially needed for user overridden values. * input: ItemDataList &list :reference to the list, whose * items should be saved - * KConfig *config :Pointer KDE configuration + * KateConfig *config :Pointer KDE configuration * class, which should be used * as storage ************* * output: none ************* * return value: none *******************************************************************************************/ -void Highlight::setItemDataList(ItemDataList &list, KConfig *config) { +void Highlight::setItemDataList(ItemDataList &list, KateConfig *config) { ItemData *p; QString s; for (p = list.first(); p != 0L; p = list.next()) { s.sprintf("%d,%X,%X,%d,%d", p->defStyle,p->col.rgb(),p->selCol.rgb(),p->bold,p->italic); @@ -1263,13 +1263,13 @@ HlManager *HlManager::self() Highlight *HlManager::getHl(int n) { if (n < 0 || n >= (int) hlList.count()) n = 0; return hlList.at(n); } int HlManager::defaultHl() { - KConfig *config; + KateConfig *config; config = KGlobal::config(); config->setGroup("General Options"); #warning fixme return nameFind(config->readEntry("Highlight")); } @@ -1371,13 +1371,13 @@ QString HlManager::defaultStyleName(int n) } return names[n]; } void HlManager::getDefaults(ItemStyleList &list) { - KConfig *config; + KateConfig *config; int z; ItemStyle *i; QString s; QRgb col, selCol; list.setAutoDelete(true); @@ -1407,13 +1407,13 @@ void HlManager::getDefaults(ItemStyleList &list) { } } */ } void HlManager::setDefaults(ItemStyleList &list) { - KConfig *config; + KateConfig *config; int z; ItemStyle *i; char s[64]; #warning fixme /* config = KateFactory::instance()->config(); diff --git a/noncore/apps/tinykate/libkate/document/katehighlight.h b/noncore/apps/tinykate/libkate/document/katehighlight.h index 1baddcc..fddf585 100644 --- a/noncore/apps/tinykate/libkate/document/katehighlight.h +++ b/noncore/apps/tinykate/libkate/document/katehighlight.h @@ -233,13 +233,13 @@ class HlData { QString identifier; }; typedef QList<HlData> HlDataList; class HlManager; -class KConfig; +class KateConfig; //context class HlContext { public: HlContext(int attribute, int lineEndContext,int _lineBeginContext); QList<HlItem> items; @@ -255,20 +255,20 @@ class Highlight public: Highlight(syntaxModeListItem *def); ~Highlight(); int doHighlight(int ctxNum, TextLine *); - KConfig *getKConfig(); + KateConfig *getKateConfig(); QString getWildcards(); QString getMimetypes(); HlData *getData(); void setData(HlData *); void getItemDataList(ItemDataList &); - void getItemDataList(ItemDataList &, KConfig *); - void setItemDataList(ItemDataList &, KConfig *); + void getItemDataList(ItemDataList &, KateConfig *); + void setItemDataList(ItemDataList &, KateConfig *); QString name() {return iName;} QString section() {return iSection;} void use(); void release(); bool isInWord(QChar c); 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 @@ -13,19 +13,19 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "katesyntaxdocument.h" +#include <kateconfig.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() { @@ -48,25 +48,24 @@ SyntaxDocument::~SyntaxDocument() void SyntaxDocument::setupModeList(bool force) { if (myModeList.count() > 0) return; - KConfig *config=KGlobal::config(); + KateConfig *config=KGlobal::config(); KStandardDirs *dirs = KGlobal::dirs(); // 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"+path+*it; - if ((config->hasGroup(Group)) && (!force)) { config->setGroup(Group); syntaxModeListItem *mli=new syntaxModeListItem; mli->name = config->readEntry("name",""); mli->section = config->readEntry("section",""); @@ -93,27 +92,22 @@ void SyntaxDocument::setupModeList(bool force) 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 = 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; |