Diffstat (limited to 'noncore/apps/tinykate/libkate/document/katedocument.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katedocument.cpp | 23 |
1 files changed, 11 insertions, 12 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 | |||
@@ -271,24 +271,25 @@ void KateDocument::doPreHighlight() | |||
271 | till = max; | 271 | till = max; |
272 | } | 272 | } |
273 | PreHighlightedTill = till; | 273 | PreHighlightedTill = till; |
274 | updateLines(from,till); | 274 | updateLines(from,till); |
275 | emit preHighlightChanged(PreHighlightedTill); | 275 | emit preHighlightChanged(PreHighlightedTill); |
276 | if (PreHighlightedTill<RequestPreHighlightTill) | 276 | if (PreHighlightedTill<RequestPreHighlightTill) |
277 | QTimer::singleShot(10,this,SLOT(doPreHighlight())); | 277 | QTimer::singleShot(10,this,SLOT(doPreHighlight())); |
278 | } | 278 | } |
279 | 279 | ||
280 | KateDocument::~KateDocument() | 280 | KateDocument::~KateDocument() |
281 | { | 281 | { |
282 | m_highlight->release(); | 282 | m_highlight->release(); |
283 | writeConfig(); | ||
283 | 284 | ||
284 | if ( !m_bSingleViewMode ) | 285 | if ( !m_bSingleViewMode ) |
285 | { | 286 | { |
286 | m_views.setAutoDelete( true ); | 287 | m_views.setAutoDelete( true ); |
287 | m_views.clear(); | 288 | m_views.clear(); |
288 | m_views.setAutoDelete( false ); | 289 | m_views.setAutoDelete( false ); |
289 | } | 290 | } |
290 | delete_d(this); | 291 | delete_d(this); |
291 | } | 292 | } |
292 | 293 | ||
293 | void KateDocument::openURL(const QString &filename) | 294 | void KateDocument::openURL(const QString &filename) |
294 | { | 295 | { |
@@ -587,77 +588,75 @@ void KateDocument::setModified(bool m) { | |||
587 | emit static_cast<KateView *>( view )->newStatus(); | 588 | emit static_cast<KateView *>( view )->newStatus(); |
588 | } | 589 | } |
589 | emit modifiedChanged (); | 590 | emit modifiedChanged (); |
590 | } | 591 | } |
591 | } | 592 | } |
592 | 593 | ||
593 | bool KateDocument::isModified() const { | 594 | bool KateDocument::isModified() const { |
594 | return modified; | 595 | return modified; |
595 | } | 596 | } |
596 | 597 | ||
597 | void KateDocument::readConfig() | 598 | void KateDocument::readConfig() |
598 | { | 599 | { |
599 | KConfig *config = KGlobal::config(); | 600 | KateConfig *config = KGlobal::config(); |
600 | config->setGroup("Kate Document"); | 601 | config->setGroup("Kate Document"); |
601 | 602 | ||
602 | myWordWrap = config->readBoolEntry("Word Wrap On", false); | 603 | myWordWrap = config->readBoolEntry("Word Wrap On", false); |
603 | myWordWrapAt = config->readNumEntry("Word Wrap At", 80); | 604 | myWordWrapAt = config->readNumEntry("Word Wrap At", 80); |
604 | if (myWordWrap) | 605 | if (myWordWrap) |
605 | wrapText (myWordWrapAt); | 606 | wrapText (myWordWrapAt); |
606 | 607 | ||
607 | setTabWidth(config->readNumEntry("TabWidth", 8)); | 608 | setTabWidth(config->readNumEntry("TabWidth", 8)); |
608 | setUndoSteps(config->readNumEntry("UndoSteps", 50)); | 609 | setUndoSteps(config->readNumEntry("UndoSteps", 50)); |
609 | m_singleSelection = config->readBoolEntry("SingleSelection", false); | 610 | m_singleSelection = config->readBoolEntry("SingleSelection", false); |
610 | myEncoding = config->readEntry("Encoding", QString::fromLatin1(QTextCodec::codecForLocale()->name())); | 611 | myEncoding = config->readEntry("Encoding", QString::fromLatin1(QTextCodec::codecForLocale()->name())); |
611 | setFont (config->readFontEntry("Font", &myFont)); | 612 | setFont (config->readFontEntry("Font", myFont)); |
612 | 613 | ||
613 | colors[0] = config->readColorEntry("Color Background", &colors[0]); | 614 | colors[0] = config->readColorEntry("Color Background", colors[0]); |
614 | colors[1] = config->readColorEntry("Color Selected", &colors[1]); | 615 | colors[1] = config->readColorEntry("Color Selected", colors[1]); |
615 | 616 | ||
616 | config->sync(); | 617 | // config->sync(); |
617 | } | 618 | } |
618 | 619 | ||
619 | void KateDocument::writeConfig() | 620 | void KateDocument::writeConfig() |
620 | { | 621 | { |
621 | KConfig *config = KGlobal::config(); | 622 | KateConfig *config = KGlobal::config(); |
622 | config->setGroup("Kate Document"); | 623 | config->setGroup("Kate Document"); |
623 | #if 0 | 624 | config->writeEntry("Word Wrap On", myWordWrap); |
624 | cofig->writeEntry("Word Wrap On", myWordWrap); | ||
625 | config->writeEntry("Word Wrap At", myWordWrapAt); | 625 | config->writeEntry("Word Wrap At", myWordWrapAt); |
626 | config->writeEntry("TabWidth", tabChars); | 626 | config->writeEntry("TabWidth", tabChars); |
627 | config->writeEntry("UndoSteps", undoSteps); | 627 | config->writeEntry("UndoSteps", undoSteps); |
628 | config->writeEntry("SingleSelection", m_singleSelection); | 628 | config->writeEntry("SingleSelection", m_singleSelection); |
629 | config->writeEntry("Encoding", myEncoding); | 629 | config->writeEntry("Encoding", myEncoding); |
630 | config->writeEntry("Font", myFont); | 630 | config->writeEntry("Font", myFont); |
631 | config->writeEntry("Color Background", colors[0]); | 631 | config->writeEntry("Color Background", colors[0]); |
632 | config->writeEntry("Color Selected", colors[1]); | 632 | config->writeEntry("Color Selected", colors[1]); |
633 | #endif | 633 | // config->sync(); |
634 | config->sync(); | ||
635 | } | 634 | } |
636 | 635 | ||
637 | void KateDocument::readSessionConfig(KConfig *config) | 636 | void KateDocument::readSessionConfig(KateConfig *config) |
638 | { | 637 | { |
639 | m_url = config->readEntry("URL"); // ### doesn't this break the encoding? (Simon) | 638 | m_url = config->readEntry("URL"); // ### doesn't this break the encoding? (Simon) |
640 | setHighlight(hlManager->nameFind(config->readEntry("Highlight"))); | 639 | setHighlight(hlManager->nameFind(config->readEntry("Highlight"))); |
641 | // anders: restore bookmarks if possible | 640 | // anders: restore bookmarks if possible |
642 | QValueList<int> l = config->readIntListEntry("Bookmarks"); | 641 | QValueList<int> l = config->readIntListEntry("Bookmarks"); |
643 | if ( l.count() ) { | 642 | if ( l.count() ) { |
644 | for (uint i=0; i < l.count(); i++) { | 643 | for (uint i=0; i < l.count(); i++) { |
645 | if ( numLines() < l[i] ) break; | 644 | if ( numLines() < l[i] ) break; |
646 | getTextLine( l[i] )->addMark( Bookmark ); | 645 | getTextLine( l[i] )->addMark( Bookmark ); |
647 | } | 646 | } |
648 | } | 647 | } |
649 | } | 648 | } |
650 | 649 | ||
651 | void KateDocument::writeSessionConfig(KConfig *config) | 650 | void KateDocument::writeSessionConfig(KateConfig *config) |
652 | { | 651 | { |
653 | #if 0 | 652 | #if 0 |
654 | config->writeEntry("URL", m_url); // ### encoding?? (Simon) | 653 | config->writeEntry("URL", m_url); // ### encoding?? (Simon) |
655 | config->writeEntry("Highlight", m_highlight->name()); | 654 | config->writeEntry("Highlight", m_highlight->name()); |
656 | // anders: save bookmarks | 655 | // anders: save bookmarks |
657 | QList<Kate::Mark> l = marks(); | 656 | QList<Kate::Mark> l = marks(); |
658 | QValueList<int> ml; | 657 | QValueList<int> ml; |
659 | for (uint i=0; i < l.count(); i++) { | 658 | for (uint i=0; i < l.count(); i++) { |
660 | if ( l.at(i)->type == 1) // only save bookmarks | 659 | if ( l.at(i)->type == 1) // only save bookmarks |
661 | ml << l.at(i)->line; | 660 | ml << l.at(i)->line; |
662 | } | 661 | } |
663 | if ( ml.count() ) | 662 | if ( ml.count() ) |