editors/qeditor/qeditor_settings.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#include "qeditor_settings.h"
00022
#include "qeditor_factory.h"
00023
00024
#include <kinstance.h>
00025
#include <kconfig.h>
00026
00027 QEditorSettings*
QEditorSettings::m_self = 0;
00028
00029 QEditorSettings::QEditorSettings(
KConfig* config )
00030 {
00031
m_config = config;
00032
init();
00033 }
00034
00035 QEditorSettings::~QEditorSettings()
00036 {
00037 }
00038
00039 void QEditorSettings::init()
00040 {
00041
if( !
m_config )
00042
return;
00043
00044
m_config->
setGroup(
generalGroup());
00045
m_wordWrap =
m_config->
readBoolEntry(
"WordWrap",
true );
00046
m_tabStop =
m_config->
readNumEntry(
"TabStop", 8 );
00047
m_completeWordWithSpace =
m_config->
readBoolEntry(
"CompleteWordWithSpace",
false );
00048
m_parenthesesMatching =
m_config->
readBoolEntry(
"ParenthesesMatching",
true );
00049
m_showMarkers =
m_config->
readBoolEntry(
"ShowMarkers",
true );
00050
m_showLineNumber =
m_config->
readBoolEntry(
"ShowLineNumber",
false );
00051
m_showCodeFoldingMarkers =
m_config->
readBoolEntry(
"ShowCodeFoldingMarkers",
true );
00052 }
00053
00054 QEditorSettings*
QEditorSettings::self()
00055 {
00056
if( !
m_self )
00057
m_self =
new QEditorSettings( QEditorPartFactory::instance()->
config() );
00058
00059
return m_self;
00060 }
00061
00062 void QEditorSettings::setWordWrap(
bool enable )
00063 {
00064
m_wordWrap = enable;
00065
00066
KConfigGroupSaver cgs(
m_config,
generalGroup() );
00067
m_config->
writeEntry(
"WordWrap",
m_wordWrap );
00068
m_config->
sync();
00069 }
00070
00071 void QEditorSettings::setTabStop(
int tabStop )
00072 {
00073
m_tabStop = tabStop;
00074
00075
KConfigGroupSaver cgs(
m_config,
generalGroup() );
00076
m_config->
writeEntry(
"TabStop",
m_tabStop );
00077
m_config->
sync();
00078 }
00079
00080 void QEditorSettings::setCompleteWordWithSpace(
bool enable )
00081 {
00082
m_completeWordWithSpace = enable;
00083
00084
KConfigGroupSaver cgs(
m_config,
generalGroup() );
00085
m_config->
writeEntry(
"CompleteWordWithSpace",
m_completeWordWithSpace );
00086
m_config->
sync();
00087 }
00088
00089 void QEditorSettings::setParenthesesMatching(
bool enable )
00090 {
00091
m_parenthesesMatching = enable;
00092
00093
KConfigGroupSaver cgs(
m_config,
generalGroup() );
00094
m_config->
writeEntry(
"ParenthesesMatching",
m_parenthesesMatching );
00095
m_config->
sync();
00096 }
00097
00098 void QEditorSettings::setShowMarkers(
bool enable )
00099 {
00100
m_showMarkers = enable;
00101
00102
KConfigGroupSaver cgs(
m_config,
generalGroup() );
00103
m_config->
writeEntry(
"ShowMarkers",
m_showMarkers );
00104
m_config->
sync();
00105 }
00106
00107 void QEditorSettings::setShowLineNumber(
bool enable )
00108 {
00109
m_showLineNumber = enable;
00110
00111
KConfigGroupSaver cgs(
m_config,
generalGroup() );
00112
m_config->
writeEntry(
"ShowLineNumber",
m_showLineNumber );
00113
m_config->
sync();
00114 }
00115
00116 void QEditorSettings::setShowCodeFoldingMarkers(
bool enable )
00117 {
00118
m_showCodeFoldingMarkers = enable;
00119
00120
KConfigGroupSaver cgs(
m_config,
generalGroup() );
00121
m_config->
writeEntry(
"ShowCodeFoldingMarkers",
m_showCodeFoldingMarkers );
00122
m_config->
sync();
00123 }
00124
This file is part of the documentation for KDevelop Version 3.0.4.