00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "kateconfig.h"
00020
00021 #include "kateglobal.h"
00022 #include "katerenderer.h"
00023 #include "kateview.h"
00024 #include "katedocument.h"
00025 #include "kateschema.h"
00026 #include "katehistorymodel.h"
00027
00028 #include <math.h>
00029
00030 #include <kconfig.h>
00031 #include <kglobalsettings.h>
00032 #include <kcolorscheme.h>
00033 #include <kcolorutils.h>
00034 #include <kcharsets.h>
00035 #include <klocale.h>
00036 #include <kfinddialog.h>
00037 #include <kreplacedialog.h>
00038 #include <kcomponentdata.h>
00039 #include <kfind.h>
00040 #include <kdebug.h>
00041
00042 #include <QtCore/QTextCodec>
00043 #include <QStringListModel>
00044
00045
00046 KateConfig::KateConfig ()
00047 : configSessionNumber (0), configIsRunning (false)
00048 {
00049 }
00050
00051 KateConfig::~KateConfig ()
00052 {
00053 }
00054
00055 void KateConfig::configStart ()
00056 {
00057 configSessionNumber++;
00058
00059 if (configSessionNumber > 1)
00060 return;
00061
00062 configIsRunning = true;
00063 }
00064
00065 void KateConfig::configEnd ()
00066 {
00067 if (configSessionNumber == 0)
00068 return;
00069
00070 configSessionNumber--;
00071
00072 if (configSessionNumber > 0)
00073 return;
00074
00075 configIsRunning = false;
00076
00077 updateConfig ();
00078 }
00079
00080
00081
00082 KateDocumentConfig *KateDocumentConfig::s_global = 0;
00083 KateViewConfig *KateViewConfig::s_global = 0;
00084 KateRendererConfig *KateRendererConfig::s_global = 0;
00085
00086 KateDocumentConfig::KateDocumentConfig ()
00087 : m_indentationWidth (2),
00088 m_tabWidth (8),
00089 m_tabHandling (tabSmart),
00090 m_configFlags (0),
00091 m_wordWrapAt (80),
00092 m_proberTypeForEncodingAutoDetection(KEncodingProber::Universal),
00093 m_tabWidthSet (true),
00094 m_indentationWidthSet (true),
00095 m_indentationModeSet (true),
00096 m_wordWrapSet (true),
00097 m_wordWrapAtSet (true),
00098 m_pageUpDownMovesCursorSet (true),
00099 m_configFlagsSet (0xFFFF),
00100 m_encodingSet (true),
00101 m_eolSet (true),
00102 m_allowEolDetectionSet (false),
00103 m_allowSimpleModeSet (false),
00104 m_backupFlagsSet (true),
00105 m_searchDirConfigDepthSet (true),
00106 m_backupPrefixSet (true),
00107 m_backupSuffixSet (true),
00108 m_doc (0)
00109 {
00110 s_global = this;
00111
00112
00113 KConfigGroup cg( KGlobal::config(), "Kate Document Defaults");
00114 readConfig (cg);
00115 }
00116
00117 KateDocumentConfig::KateDocumentConfig (KateDocument *doc)
00118 : m_tabHandling (tabSmart),
00119 m_configFlags (0),
00120 m_tabWidthSet (false),
00121 m_indentationWidthSet (false),
00122 m_indentationModeSet (false),
00123 m_wordWrapSet (false),
00124 m_wordWrapAtSet (false),
00125 m_pageUpDownMovesCursorSet (false),
00126 m_configFlagsSet (0),
00127 m_encodingSet (false),
00128 m_eolSet (false),
00129 m_allowEolDetectionSet (false),
00130 m_allowSimpleModeSet (false),
00131 m_backupFlagsSet (false),
00132 m_searchDirConfigDepthSet (false),
00133 m_backupPrefixSet (false),
00134 m_backupSuffixSet (false),
00135 m_doc (doc)
00136 {
00137 m_proberTypeForEncodingAutoDetection=s_global->encodingProberType();
00138 }
00139
00140 KateDocumentConfig::~KateDocumentConfig ()
00141 {
00142 }
00143
00144 void KateDocumentConfig::readConfig (const KConfigGroup &config)
00145 {
00146 configStart ();
00147
00148 setTabWidth (config.readEntry("Tab Width", 8));
00149
00150 setIndentationWidth (config.readEntry("Indentation Width", 2));
00151
00152 setIndentationMode (config.readEntry("Indentation Mode", ""));
00153
00154 setTabHandling (config.readEntry("Tab Handling", int(KateDocumentConfig::tabSmart)));
00155
00156 setWordWrap (config.readEntry("Word Wrap", false));
00157 setWordWrapAt (config.readEntry("Word Wrap Column", 80));
00158 setPageUpDownMovesCursor (config.readEntry("PageUp/PageDown Moves Cursor", false));
00159
00160 setConfigFlags (config.readEntry("Basic Config Flags", KateDocumentConfig::cfTabIndents
00161 | KateDocumentConfig::cfWrapCursor
00162 | KateDocumentConfig::cfShowTabs
00163 | KateDocumentConfig::cfSmartHome));
00164
00165 setEncoding (config.readEntry("Encoding", ""));
00166 setEncodingProberType ((KEncodingProber::ProberType)config.readEntry("ProberType for Encoding Autodetection", 0));
00167
00168 setEol (config.readEntry("End of Line", 0));
00169 setAllowEolDetection (config.readEntry("Allow End of Line Detection", true));
00170
00171 setAllowSimpleMode (config.readEntry("Allow Simple Mode", true));
00172
00173 setBackupFlags (config.readEntry("Backup Config Flags", 1));
00174
00175 setSearchDirConfigDepth (config.readEntry("Search Dir Config Depth", 3));
00176
00177 setBackupPrefix (config.readEntry("Backup Prefix", QString ("")));
00178
00179 setBackupSuffix (config.readEntry("Backup Suffix", QString ("~")));
00180
00181 configEnd ();
00182 }
00183
00184 void KateDocumentConfig::writeConfig (KConfigGroup &config)
00185 {
00186 config.writeEntry("Tab Width", tabWidth());
00187
00188 config.writeEntry("Indentation Width", indentationWidth());
00189 config.writeEntry("Indentation Mode", indentationMode());
00190
00191 config.writeEntry("Tab Handling", tabHandling());
00192
00193 config.writeEntry("Word Wrap", wordWrap());
00194 config.writeEntry("Word Wrap Column", wordWrapAt());
00195
00196 config.writeEntry("PageUp/PageDown Moves Cursor", pageUpDownMovesCursor());
00197
00198 config.writeEntry("Basic Config Flags", configFlags());
00199
00200 config.writeEntry("Encoding", encoding());
00201 config.writeEntry("ProberType for Encoding Autodetection", (int)encodingProberType());
00202
00203 config.writeEntry("End of Line", eol());
00204 config.writeEntry("Allow End of Line Detection", allowEolDetection());
00205
00206 config.writeEntry("Allow Simple Mode", allowSimpleMode());
00207
00208 config.writeEntry("Backup Config Flags", backupFlags());
00209
00210 config.writeEntry("Search Dir Config Depth", searchDirConfigDepth());
00211
00212 config.writeEntry("Backup Prefix", backupPrefix());
00213
00214 config.writeEntry("Backup Suffix", backupSuffix());
00215 }
00216
00217 void KateDocumentConfig::updateConfig ()
00218 {
00219 if (m_doc)
00220 {
00221 m_doc->updateConfig ();
00222 return;
00223 }
00224
00225 if (isGlobal())
00226 {
00227 for (int z=0; z < KateGlobal::self()->kateDocuments().size(); ++z)
00228 (KateGlobal::self()->kateDocuments())[z]->updateConfig ();
00229 }
00230 }
00231
00232 int KateDocumentConfig::tabWidth () const
00233 {
00234 if (m_tabWidthSet || isGlobal())
00235 return m_tabWidth;
00236
00237 return s_global->tabWidth();
00238 }
00239
00240 void KateDocumentConfig::setTabWidth (int tabWidth)
00241 {
00242 if (tabWidth < 1)
00243 return;
00244
00245 configStart ();
00246
00247 m_tabWidthSet = true;
00248 m_tabWidth = tabWidth;
00249
00250 configEnd ();
00251 }
00252
00253 int KateDocumentConfig::indentationWidth () const
00254 {
00255 if (m_indentationWidthSet || isGlobal())
00256 return m_indentationWidth;
00257
00258 return s_global->indentationWidth();
00259 }
00260
00261 void KateDocumentConfig::setIndentationWidth (int indentationWidth)
00262 {
00263 if (indentationWidth < 1)
00264 return;
00265
00266 configStart ();
00267
00268 m_indentationWidthSet = true;
00269 m_indentationWidth = indentationWidth;
00270
00271 configEnd ();
00272 }
00273
00274 const QString &KateDocumentConfig::indentationMode () const
00275 {
00276 if (m_indentationModeSet || isGlobal())
00277 return m_indentationMode;
00278
00279 return s_global->indentationMode();
00280 }
00281
00282 void KateDocumentConfig::setIndentationMode (const QString &indentationMode)
00283 {
00284 configStart ();
00285
00286 m_indentationModeSet = true;
00287 m_indentationMode = indentationMode;
00288
00289 configEnd ();
00290 }
00291
00292 uint KateDocumentConfig::tabHandling () const
00293 {
00294
00295
00296 if (isGlobal())
00297 return m_tabHandling;
00298
00299 return s_global->tabHandling();
00300 }
00301
00302 void KateDocumentConfig::setTabHandling (uint tabHandling)
00303 {
00304 configStart ();
00305
00306 m_tabHandling = tabHandling;
00307
00308 configEnd ();
00309 }
00310
00311 bool KateDocumentConfig::wordWrap () const
00312 {
00313 if (m_wordWrapSet || isGlobal())
00314 return m_wordWrap;
00315
00316 return s_global->wordWrap();
00317 }
00318
00319 void KateDocumentConfig::setWordWrap (bool on)
00320 {
00321 configStart ();
00322
00323 m_wordWrapSet = true;
00324 m_wordWrap = on;
00325
00326 configEnd ();
00327 }
00328
00329 unsigned int KateDocumentConfig::wordWrapAt () const
00330 {
00331 if (m_wordWrapAtSet || isGlobal())
00332 return m_wordWrapAt;
00333
00334 return s_global->wordWrapAt();
00335 }
00336
00337 void KateDocumentConfig::setWordWrapAt (unsigned int col)
00338 {
00339 if (col < 1)
00340 return;
00341
00342 configStart ();
00343
00344 m_wordWrapAtSet = true;
00345 m_wordWrapAt = col;
00346
00347 configEnd ();
00348 }
00349
00350 bool KateDocumentConfig::pageUpDownMovesCursor () const
00351 {
00352 if (m_pageUpDownMovesCursorSet || isGlobal())
00353 return m_pageUpDownMovesCursor;
00354
00355 return s_global->pageUpDownMovesCursor();
00356 }
00357
00358 void KateDocumentConfig::setPageUpDownMovesCursor (bool on)
00359 {
00360 configStart ();
00361
00362 m_pageUpDownMovesCursorSet = true;
00363 m_pageUpDownMovesCursor = on;
00364
00365 configEnd ();
00366 }
00367
00368 uint KateDocumentConfig::configFlags () const
00369 {
00370 if (isGlobal())
00371 return m_configFlags;
00372
00373 return ((s_global->configFlags() & ~ m_configFlagsSet) | m_configFlags);
00374 }
00375
00376 void KateDocumentConfig::setConfigFlags (KateDocumentConfig::ConfigFlags flag, bool enable)
00377 {
00378 configStart ();
00379
00380 m_configFlagsSet |= flag;
00381
00382 if (enable)
00383 m_configFlags = m_configFlags | flag;
00384 else
00385 m_configFlags = m_configFlags & ~ flag;
00386
00387 configEnd ();
00388 }
00389
00390 void KateDocumentConfig::setConfigFlags (uint fullFlags)
00391 {
00392 configStart ();
00393
00394 m_configFlagsSet = 0xFFFF;
00395 m_configFlags = fullFlags;
00396
00397 configEnd ();
00398 }
00399
00400 const QString &KateDocumentConfig::encoding () const
00401 {
00402 if (m_encodingSet || isGlobal())
00403 return m_encoding;
00404
00405 return s_global->encoding();
00406 }
00407
00408 QTextCodec *KateDocumentConfig::codec () const
00409 {
00410 if (m_encodingSet || isGlobal())
00411 {
00412 if (m_encoding.isEmpty() && isGlobal())
00413 return KGlobal::locale()->codecForEncoding();
00414 else if (m_encoding.isEmpty())
00415 return s_global->codec ();
00416 else
00417 return KGlobal::charsets()->codecForName (m_encoding);
00418 }
00419
00420 return s_global->codec ();
00421 }
00422
00423 bool KateDocumentConfig::setEncoding (const QString &encoding, bool resetDetection)
00424 {
00425 QTextCodec *codec;
00426 bool found = false;
00427 if (encoding.isEmpty())
00428 {
00429 codec = s_global->codec();
00430 #ifdef DECODE_DEBUG
00431 kWarning()<<"defaulting to " << codec->name();
00432 #endif
00433 found=true;
00434 }
00435 else
00436 codec = KGlobal::charsets()->codecForName (encoding, found);
00437
00438 if (!found || !codec)
00439 return false;
00440
00441 configStart ();
00442
00443 if (resetDetection)
00444 {
00445 if (!m_encodingSet || encoding.isEmpty())
00446 m_proberTypeForEncodingAutoDetection=s_global->encodingProberType();
00447 else
00448 m_proberTypeForEncodingAutoDetection = KEncodingProber::None;
00449 }
00450 m_encodingSet = true;
00451 m_encoding = codec->name();
00452
00453 configEnd ();
00454 #ifdef DECODE_DEBUG
00455 kWarning()<<"set to " << codec->name();
00456 #endif
00457 return true;
00458 }
00459
00460 bool KateDocumentConfig::isSetEncoding () const
00461 {
00462 return m_encodingSet;
00463 }
00464
00465 KEncodingProber::ProberType KateDocumentConfig::encodingProberType() const
00466 {
00467 return m_proberTypeForEncodingAutoDetection;
00468 }
00469
00470 void KateDocumentConfig::setEncodingProberType(KEncodingProber::ProberType proberType)
00471 {
00472 configStart ();
00473
00474 m_proberTypeForEncodingAutoDetection=proberType;
00475
00476 configEnd ();
00477
00478 }
00479
00480
00481 int KateDocumentConfig::eol () const
00482 {
00483 if (m_eolSet || isGlobal())
00484 return m_eol;
00485
00486 return s_global->eol();
00487 }
00488
00489 QString KateDocumentConfig::eolString ()
00490 {
00491 if (eol() == KateDocumentConfig::eolUnix)
00492 return QString ("\n");
00493 else if (eol() == KateDocumentConfig::eolDos)
00494 return QString ("\r\n");
00495 else if (eol() == KateDocumentConfig::eolMac)
00496 return QString ("\r");
00497
00498 return QString ("\n");
00499 }
00500
00501 void KateDocumentConfig::setEol (int mode)
00502 {
00503 configStart ();
00504
00505 m_eolSet = true;
00506 m_eol = mode;
00507
00508 configEnd ();
00509 }
00510
00511 bool KateDocumentConfig::allowEolDetection () const
00512 {
00513 if (m_allowEolDetectionSet || isGlobal())
00514 return m_allowEolDetection;
00515
00516 return s_global->allowEolDetection();
00517 }
00518
00519 void KateDocumentConfig::setAllowEolDetection (bool on)
00520 {
00521 configStart ();
00522
00523 m_allowEolDetectionSet = true;
00524 m_allowEolDetection = on;
00525
00526 configEnd ();
00527 }
00528
00529
00530 bool KateDocumentConfig::allowSimpleMode () const
00531 {
00532 if (m_allowSimpleModeSet || isGlobal())
00533 return m_allowSimpleMode;
00534
00535 return s_global->allowSimpleMode();
00536 }
00537
00538 void KateDocumentConfig::setAllowSimpleMode (bool on)
00539 {
00540 configStart ();
00541
00542 m_allowSimpleModeSet = true;
00543 m_allowSimpleMode = on;
00544
00545 configEnd ();
00546 }
00547
00548 uint KateDocumentConfig::backupFlags () const
00549 {
00550 if (m_backupFlagsSet || isGlobal())
00551 return m_backupFlags;
00552
00553 return s_global->backupFlags();
00554 }
00555
00556 void KateDocumentConfig::setBackupFlags (uint flags)
00557 {
00558 configStart ();
00559
00560 m_backupFlagsSet = true;
00561 m_backupFlags = flags;
00562
00563 configEnd ();
00564 }
00565
00566 const QString &KateDocumentConfig::backupPrefix () const
00567 {
00568 if (m_backupPrefixSet || isGlobal())
00569 return m_backupPrefix;
00570
00571 return s_global->backupPrefix();
00572 }
00573
00574 const QString &KateDocumentConfig::backupSuffix () const
00575 {
00576 if (m_backupSuffixSet || isGlobal())
00577 return m_backupSuffix;
00578
00579 return s_global->backupSuffix();
00580 }
00581
00582 void KateDocumentConfig::setBackupPrefix (const QString &prefix)
00583 {
00584 configStart ();
00585
00586 m_backupPrefixSet = true;
00587 m_backupPrefix = prefix;
00588
00589 configEnd ();
00590 }
00591
00592 void KateDocumentConfig::setBackupSuffix (const QString &suffix)
00593 {
00594 configStart ();
00595
00596 m_backupSuffixSet = true;
00597 m_backupSuffix = suffix;
00598
00599 configEnd ();
00600 }
00601
00602 int KateDocumentConfig::searchDirConfigDepth () const
00603 {
00604 if (m_searchDirConfigDepthSet || isGlobal())
00605 return m_searchDirConfigDepth;
00606
00607 return s_global->searchDirConfigDepth ();
00608 }
00609
00610 void KateDocumentConfig::setSearchDirConfigDepth (int depth)
00611 {
00612 configStart ();
00613
00614 m_searchDirConfigDepthSet = true;
00615 m_searchDirConfigDepth = depth;
00616
00617 configEnd ();
00618 }
00619
00620
00621
00622
00623 KateViewConfig::KateViewConfig ()
00624 :
00625 m_dynWordWrapSet (true),
00626 m_dynWordWrapIndicatorsSet (true),
00627 m_dynWordWrapAlignIndentSet (true),
00628 m_lineNumbersSet (true),
00629 m_scrollBarMarksSet (true),
00630 m_iconBarSet (true),
00631 m_foldingBarSet (true),
00632 m_bookmarkSortSet (true),
00633 m_autoCenterLinesSet (true),
00634 m_searchFlagsSet (true),
00635 m_defaultMarkTypeSet (true),
00636 m_persistentSelectionSet (true),
00637 m_viInputModeSet (true),
00638 m_viInputModeStealKeysSet (true),
00639 m_automaticCompletionInvocationSet (true),
00640 m_view (0)
00641 {
00642 s_global = this;
00643
00644
00645 KConfigGroup config( KGlobal::config(), "Kate View Defaults");
00646 readConfig (config);
00647 }
00648
00649 KateViewConfig::KateViewConfig (KateView *view)
00650 :
00651 m_dynWordWrapSet (false),
00652 m_dynWordWrapIndicatorsSet (false),
00653 m_dynWordWrapAlignIndentSet (false),
00654 m_lineNumbersSet (false),
00655 m_scrollBarMarksSet (false),
00656 m_iconBarSet (false),
00657 m_foldingBarSet (false),
00658 m_bookmarkSortSet (false),
00659 m_autoCenterLinesSet (false),
00660 m_searchFlagsSet (false),
00661 m_defaultMarkTypeSet (false),
00662 m_persistentSelectionSet (false),
00663 m_viInputModeSet (false),
00664 m_viInputModeStealKeysSet (false),
00665 m_automaticCompletionInvocationSet (false),
00666 m_view (view)
00667 {
00668 }
00669
00670 KateViewConfig::~KateViewConfig ()
00671 {
00672 }
00673
00674
00675
00676 static const char * const KEY_SEARCH_REPLACE_FLAGS = "Search/Replace Flags";
00677 static const char * const KEY_PATTERN_HISTORY = "Search Pattern History";
00678 static const char * const KEY_REPLACEMENT_HISTORY = "Replacement Text History";
00679
00680
00681 void KateViewConfig::readConfig ( const KConfigGroup &config)
00682 {
00683 configStart ();
00684
00685
00686 setDynWordWrap (config.readEntry( "Dynamic Word Wrap", false ));
00687 setDynWordWrapIndicators (config.readEntry( "Dynamic Word Wrap Indicators", 1 ));
00688 setDynWordWrapAlignIndent (config.readEntry( "Dynamic Word Wrap Align Indent", 80 ));
00689
00690 setLineNumbers (config.readEntry( "Line Numbers", false));
00691
00692 setScrollBarMarks (config.readEntry( "Scroll Bar Marks", false));
00693
00694 setIconBar (config.readEntry( "Icon Bar", false ));
00695
00696 setFoldingBar (config.readEntry( "Folding Bar", true));
00697
00698 setBookmarkSort (config.readEntry( "Bookmark Menu Sorting", 0 ));
00699
00700 setAutoCenterLines (config.readEntry( "Auto Center Lines", 0 ));
00701
00702 setSearchFlags(config.readEntry(KEY_SEARCH_REPLACE_FLAGS,
00703 IncFromCursor|PowerMatchCase|PowerModePlainText));
00704
00705 setDefaultMarkType (config.readEntry( "Default Mark Type", int(KTextEditor::MarkInterface::markType01) ));
00706
00707 setPersistentSelection (config.readEntry( "Persistent Selection", false ));
00708
00709 setViInputMode (config.readEntry( "Vi Input Mode", false));
00710 setViInputModeStealKeys (config.readEntry( "Vi Input Mode Steal Keys", false));
00711 setViInputModeHideStatusBar (config.readEntry( "Vi Input Mode Hide Status Bar", false));
00712
00713 setAutomaticCompletionInvocation (config.readEntry( "Auto Completion", true ));
00714
00715 if (isGlobal()) {
00716 QStringList empty;
00717
00718
00719 QStringListModel * const patternHistoryModel = KateHistoryModel::getPatternHistoryModel();
00720 QStringList patternHistory = config.readEntry(KEY_PATTERN_HISTORY, empty);
00721 patternHistoryModel->setStringList(patternHistory);
00722
00723
00724 QStringListModel * const replacementHistoryModel = KateHistoryModel::getReplacementHistoryModel();
00725 QStringList replacementHistory = config.readEntry(KEY_REPLACEMENT_HISTORY, empty);
00726 replacementHistoryModel->setStringList(replacementHistory);
00727 }
00728
00729 configEnd ();
00730 }
00731
00732 void KateViewConfig::writeConfig (KConfigGroup &config)
00733 {
00734 config.writeEntry( "Dynamic Word Wrap", dynWordWrap() );
00735 config.writeEntry( "Dynamic Word Wrap Indicators", dynWordWrapIndicators() );
00736 config.writeEntry( "Dynamic Word Wrap Align Indent", dynWordWrapAlignIndent() );
00737
00738 config.writeEntry( "Line Numbers", lineNumbers() );
00739
00740 config.writeEntry( "Scroll Bar Marks", scrollBarMarks() );
00741
00742 config.writeEntry( "Icon Bar", iconBar() );
00743
00744 config.writeEntry( "Folding Bar", foldingBar() );
00745
00746 config.writeEntry( "Bookmark Menu Sorting", bookmarkSort() );
00747
00748 config.writeEntry( "Auto Center Lines", autoCenterLines() );
00749
00750 config.writeEntry(KEY_SEARCH_REPLACE_FLAGS, int(searchFlags()));
00751
00752 config.writeEntry("Default Mark Type", defaultMarkType());
00753
00754 config.writeEntry("Persistent Selection", persistentSelection());
00755
00756 config.writeEntry( "Auto Completion", automaticCompletionInvocation());
00757
00758 config.writeEntry( "Vi Input Mode", viInputMode());
00759
00760 config.writeEntry( "Vi Input Mode Steal Keys", viInputModeStealKeys());
00761
00762 config.writeEntry( "Vi Input Mode Hide Status Bar", viInputModeHideStatusBar());
00763
00764 if (isGlobal()) {
00765
00766 QStringListModel * const patternHistoryModel = KateHistoryModel::getPatternHistoryModel();
00767 config.writeEntry(KEY_PATTERN_HISTORY, patternHistoryModel->stringList());
00768
00769
00770 QStringListModel * const replacementHistoryModel = KateHistoryModel::getReplacementHistoryModel();
00771 config.writeEntry(KEY_REPLACEMENT_HISTORY, replacementHistoryModel->stringList());
00772 }
00773 }
00774
00775 void KateViewConfig::updateConfig ()
00776 {
00777 if (m_view)
00778 {
00779 m_view->updateConfig ();
00780 return;
00781 }
00782
00783 if (isGlobal())
00784 {
00785 for (int z=0; z < KateGlobal::self()->views().size(); ++z)
00786 (KateGlobal::self()->views())[z]->updateConfig ();
00787 }
00788 }
00789
00790 bool KateViewConfig::dynWordWrap () const
00791 {
00792 if (m_dynWordWrapSet || isGlobal())
00793 return m_dynWordWrap;
00794
00795 return s_global->dynWordWrap();
00796 }
00797
00798 void KateViewConfig::setDynWordWrap (bool wrap)
00799 {
00800 configStart ();
00801
00802 m_dynWordWrapSet = true;
00803 m_dynWordWrap = wrap;
00804
00805 configEnd ();
00806 }
00807
00808 int KateViewConfig::dynWordWrapIndicators () const
00809 {
00810 if (m_dynWordWrapIndicatorsSet || isGlobal())
00811 return m_dynWordWrapIndicators;
00812
00813 return s_global->dynWordWrapIndicators();
00814 }
00815
00816 void KateViewConfig::setDynWordWrapIndicators (int mode)
00817 {
00818 configStart ();
00819
00820 m_dynWordWrapIndicatorsSet = true;
00821 m_dynWordWrapIndicators = qBound(0, mode, 80);
00822
00823 configEnd ();
00824 }
00825
00826 int KateViewConfig::dynWordWrapAlignIndent () const
00827 {
00828 if (m_dynWordWrapAlignIndentSet || isGlobal())
00829 return m_dynWordWrapAlignIndent;
00830
00831 return s_global->dynWordWrapAlignIndent();
00832 }
00833
00834 void KateViewConfig::setDynWordWrapAlignIndent (int indent)
00835 {
00836 configStart ();
00837
00838 m_dynWordWrapAlignIndentSet = true;
00839 m_dynWordWrapAlignIndent = indent;
00840
00841 configEnd ();
00842 }
00843
00844 bool KateViewConfig::lineNumbers () const
00845 {
00846 if (m_lineNumbersSet || isGlobal())
00847 return m_lineNumbers;
00848
00849 return s_global->lineNumbers();
00850 }
00851
00852 void KateViewConfig::setLineNumbers (bool on)
00853 {
00854 configStart ();
00855
00856 m_lineNumbersSet = true;
00857 m_lineNumbers = on;
00858
00859 configEnd ();
00860 }
00861
00862 bool KateViewConfig::scrollBarMarks () const
00863 {
00864 if (m_scrollBarMarksSet || isGlobal())
00865 return m_scrollBarMarks;
00866
00867 return s_global->scrollBarMarks();
00868 }
00869
00870 void KateViewConfig::setScrollBarMarks (bool on)
00871 {
00872 configStart ();
00873
00874 m_scrollBarMarksSet = true;
00875 m_scrollBarMarks = on;
00876
00877 configEnd ();
00878 }
00879
00880 bool KateViewConfig::iconBar () const
00881 {
00882 if (m_iconBarSet || isGlobal())
00883 return m_iconBar;
00884
00885 return s_global->iconBar();
00886 }
00887
00888 void KateViewConfig::setIconBar (bool on)
00889 {
00890 configStart ();
00891
00892 m_iconBarSet = true;
00893 m_iconBar = on;
00894
00895 configEnd ();
00896 }
00897
00898 bool KateViewConfig::foldingBar () const
00899 {
00900 if (m_foldingBarSet || isGlobal())
00901 return m_foldingBar;
00902
00903 return s_global->foldingBar();
00904 }
00905
00906 void KateViewConfig::setFoldingBar (bool on)
00907 {
00908 configStart ();
00909
00910 m_foldingBarSet = true;
00911 m_foldingBar = on;
00912
00913 configEnd ();
00914 }
00915
00916 int KateViewConfig::bookmarkSort () const
00917 {
00918 if (m_bookmarkSortSet || isGlobal())
00919 return m_bookmarkSort;
00920
00921 return s_global->bookmarkSort();
00922 }
00923
00924 void KateViewConfig::setBookmarkSort (int mode)
00925 {
00926 configStart ();
00927
00928 m_bookmarkSortSet = true;
00929 m_bookmarkSort = mode;
00930
00931 configEnd ();
00932 }
00933
00934 int KateViewConfig::autoCenterLines () const
00935 {
00936 if (m_autoCenterLinesSet || isGlobal())
00937 return m_autoCenterLines;
00938
00939 return s_global->autoCenterLines();
00940 }
00941
00942 void KateViewConfig::setAutoCenterLines (int lines)
00943 {
00944 if (lines < 0)
00945 return;
00946
00947 configStart ();
00948
00949 m_autoCenterLinesSet = true;
00950 m_autoCenterLines = lines;
00951
00952 configEnd ();
00953 }
00954
00955 long KateViewConfig::searchFlags () const
00956 {
00957 if (m_searchFlagsSet || isGlobal())
00958 return m_searchFlags;
00959
00960 return s_global->searchFlags();
00961 }
00962
00963 void KateViewConfig::setSearchFlags (long flags)
00964 {
00965 configStart ();
00966
00967 m_searchFlagsSet = true;
00968 m_searchFlags = flags;
00969
00970 configEnd ();
00971 }
00972
00973 uint KateViewConfig::defaultMarkType () const
00974 {
00975 if (m_defaultMarkTypeSet || isGlobal())
00976 return m_defaultMarkType;
00977
00978 return s_global->defaultMarkType();
00979 }
00980
00981 void KateViewConfig::setDefaultMarkType (uint type)
00982 {
00983 configStart ();
00984
00985 m_defaultMarkTypeSet = true;
00986 m_defaultMarkType = type;
00987
00988 configEnd ();
00989 }
00990
00991 bool KateViewConfig::persistentSelection () const
00992 {
00993 if (m_persistentSelectionSet || isGlobal())
00994 return m_persistentSelection;
00995
00996 return s_global->persistentSelection();
00997 }
00998
00999 void KateViewConfig::setPersistentSelection (bool on)
01000 {
01001 configStart ();
01002
01003 m_persistentSelectionSet = true;
01004 m_persistentSelection = on;
01005
01006 configEnd ();
01007 }
01008
01009 bool KateViewConfig::viInputMode () const
01010 {
01011 if (m_viInputModeSe