summaryrefslogtreecommitdiffstats
path: root/parts/bookmarks/bookmarks_config.cpp
blob: 5fe6a4aad86606f5d8ced2c9b9e9126f202af2a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/***************************************************************************
 *   Copyright (C) 2003 by Jens Dagerbo                                    *
 *   jens.dagerbo@swipnet.se                                               *
 *                                                                         *
 *   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 <tdeconfig.h>
#include <kapplication.h>

#include "bookmarks_config.h"

BookmarksConfig::BookmarksConfig()
{
	_context = 5;
	_codeline = Never; // 0 - Never, 1 - Only if Comment, 2 - Always
	_tooltip = true;
}


BookmarksConfig::~BookmarksConfig()
{
}


/*!
    \fn BookmarksConfig::writeConfig()
 */
void BookmarksConfig::writeConfig()
{
	TDEConfig *config = kapp->config();   
	config->setGroup("Bookmarks");
	
	config->writeEntry("Context", _context );
	config->writeEntry("Codeline", _codeline );
	config->writeEntry("ToolTip", _tooltip );
	config->writeEntry("Token", _token );

	config->sync();
}


/*!
    \fn BookmarksConfig::readConfig()
 */
void BookmarksConfig::readConfig()
{
	TDEConfig *config = kapp->config();
	config->setGroup("Bookmarks");
	
	_context = config->readPropertyEntry( "Context", 5 ).toInt();
	_tooltip = config->readBoolEntry( "ToolTip", true );
	_token = config->readEntry( "Token", "//" );
	unsigned int cl = config->readPropertyEntry( "Codeline", 0 ).toInt();
	
	switch( cl )
	{
		case 1:
			_codeline = Token;
		break;
		case 2: 
			_codeline = Always;
		break;
		default:
			_codeline = Never;
	}
	
	if ( _context > 15 ) _context = 15;
}


/*!
    \fn BookmarksConfig::toolTip
 */
bool BookmarksConfig::toolTip()
{
    return _tooltip;
}


/*!
    \fn BookmarksConfig::codeline
 */
BookmarksConfig::CodeLineType BookmarksConfig::codeline()
{
    return _codeline;
}


/*!
    \fn BookmarksConfig::context()
 */
unsigned int BookmarksConfig::context()
{
    return _context;
}


/*!
    \fn BookmarksConfig::setCodeline( CodeLineType )
 */
void BookmarksConfig::setCodeline( CodeLineType codeline )
{
	_codeline = codeline;
}

/*!
    \fn BookmarksConfig::setContext( unsigned int )
 */
void BookmarksConfig::setContext( unsigned int context )
{
	_context = context;
}


/*!
    \fn BookmarksConfig::setToolTip( bool )
 */
void BookmarksConfig::setToolTip( bool tooltip )
{
	_tooltip = tooltip;
}

TQString BookmarksConfig::token( )
{
	return _token;
}

void BookmarksConfig::setToken( TQString const & token )
{
	_token = token;
}

// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;