KDevelop API Documentation

bookmarks_config.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2003 by Jens Dagerbo                                    *
00003  *   jens.dagerbo@swipnet.se                                               *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  ***************************************************************************/
00011 
00012 #include <kconfig.h>
00013 #include <kapplication.h>
00014 
00015 #include "bookmarks_config.h"
00016 
00017 BookmarksConfig::BookmarksConfig()
00018 {
00019     _context = 5;
00020     _codeline = Never; // 0 - Never, 1 - Only if Comment, 2 - Always
00021     _tooltip = true;
00022 }
00023 
00024 
00025 BookmarksConfig::~BookmarksConfig()
00026 {
00027 }
00028 
00029 
00033 void BookmarksConfig::writeConfig()
00034 {
00035     KConfig *config = kapp->config();   
00036     config->setGroup("Bookmarks");
00037     
00038     config->writeEntry("Context", _context );
00039     config->writeEntry("Codeline", _codeline );
00040     config->writeEntry("ToolTip", _tooltip );
00041     config->writeEntry("Token", _token );
00042 
00043     config->sync();
00044 }
00045 
00046 
00050 void BookmarksConfig::readConfig()
00051 {
00052     KConfig *config = kapp->config();
00053     config->setGroup("Bookmarks");
00054     
00055     _context = config->readPropertyEntry( "Context", 5 ).toInt();
00056     _tooltip = config->readBoolEntry( "ToolTip", true );
00057     _token = config->readEntry( "Token", "//" );
00058     unsigned int cl = config->readPropertyEntry( "Codeline", 0 ).toInt();
00059     
00060     switch( cl )
00061     {
00062         case 1:
00063             _codeline = Token;
00064         break;
00065         case 2: 
00066             _codeline = Always;
00067         break;
00068         default:
00069             _codeline = Never;
00070     }
00071     
00072     if ( _context > 15 ) _context = 15;
00073 }
00074 
00075 
00079 bool BookmarksConfig::toolTip()
00080 {
00081     return _tooltip;
00082 }
00083 
00084 
00088 BookmarksConfig::CodeLineType BookmarksConfig::codeline()
00089 {
00090     return _codeline;
00091 }
00092 
00093 
00097 unsigned int BookmarksConfig::context()
00098 {
00099     return _context;
00100 }
00101 
00102 
00106 void BookmarksConfig::setCodeline( CodeLineType codeline )
00107 {
00108     _codeline = codeline;
00109 }
00110 
00114 void BookmarksConfig::setContext( unsigned int context )
00115 {
00116     _context = context;
00117 }
00118 
00119 
00123 void BookmarksConfig::setToolTip( bool tooltip )
00124 {
00125     _tooltip = tooltip;
00126 }
00127 
00128 QString BookmarksConfig::token( )
00129 {
00130     return _token;
00131 }
00132 
00133 void BookmarksConfig::setToken( QString const & token )
00134 {
00135     _token = token;
00136 }
00137 
00138 // kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:37 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003