mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-20 17:01:22 +00:00
HTML moved out
svn path=/trunk/kdebase/libkonq/; revision=34539
This commit is contained in:
parent
c77d4fd473
commit
f27d82acf2
|
@ -21,6 +21,7 @@
|
|||
#include "konqdefaults.h"
|
||||
#include <kconfig.h>
|
||||
#include <kapp.h>
|
||||
#include <assert.h>
|
||||
|
||||
// We have to handle three instances of this class in the code
|
||||
// Everything's handled by arrays to avoid code duplication
|
||||
|
@ -34,11 +35,12 @@ static const char * s_sGroupName[] = { "Icon Settings", "Tree Settings" };
|
|||
|
||||
KonqFMSettings * KonqFMSettings::getInstance( int nr )
|
||||
{
|
||||
assert( nr > 0 && nr < 2 );
|
||||
if (!s_pSettings[nr])
|
||||
{
|
||||
KConfig config ( "konquerorrc", true );
|
||||
config.setGroup( s_sGroupName[nr] );
|
||||
s_pSettings[nr] = new KonqFMSettings(&config);
|
||||
KConfig *config = kapp->config();
|
||||
KConfigGroupSaver cgs(config, s_sGroupName[nr]);
|
||||
s_pSettings[nr] = new KonqFMSettings(config);
|
||||
}
|
||||
return s_pSettings[nr];
|
||||
}
|
||||
|
@ -58,13 +60,13 @@ KonqFMSettings * KonqFMSettings::defaultIconSettings()
|
|||
//static
|
||||
void KonqFMSettings::reparseConfiguration()
|
||||
{
|
||||
KConfig config ( "konquerorrc", true );
|
||||
KConfig *config = kapp->config();
|
||||
for (int i = 0 ; i < 3 ; i++ )
|
||||
{
|
||||
if (s_pSettings[i])
|
||||
{
|
||||
config.setGroup( s_sGroupName[i]) ;
|
||||
s_pSettings[i]->init( &config );
|
||||
KConfigGroupSaver cgs(config, s_sGroupName[i]);
|
||||
s_pSettings[i]->init( config );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +94,6 @@ void KonqFMSettings::init( KConfig * config )
|
|||
m_highlightedTextColor = config->readColorEntry( "HighlightedTextColor", &FM_DEFAULT_HIGHLIGHTED_TXT_COLOR );
|
||||
|
||||
// Behaviour
|
||||
KConfigGroupSaver cgs( config, "Behaviour" );
|
||||
m_bSingleClick = config->readBoolEntry("SingleClick", DEFAULT_SINGLECLICK);
|
||||
m_iAutoSelect = config->readNumEntry("AutoSelect", DEFAULT_AUTOSELECT);
|
||||
m_bChangeCursor = config->readBoolEntry( "ChangeCursor", DEFAULT_CHANGECURSOR );
|
||||
|
@ -100,67 +101,3 @@ void KonqFMSettings::init( KConfig * config )
|
|||
m_bWordWrapText = config->readBoolEntry( "WordWrapText", DEFAULT_WORDWRAPTEXT );
|
||||
|
||||
}
|
||||
|
||||
|
||||
KonqHTMLSettings * KonqHTMLSettings::s_HTMLSettings = 0L;
|
||||
|
||||
KonqHTMLSettings::KonqHTMLSettings()
|
||||
{
|
||||
KConfig config ( "konquerorrc", true );
|
||||
config.setGroup( "HTML Settings" );
|
||||
init( & config );
|
||||
}
|
||||
|
||||
void KonqHTMLSettings::init( KConfig * config )
|
||||
{
|
||||
// Fonts and colors
|
||||
m_iFontSize = config->readNumEntry( "FontSize", DEFAULT_VIEW_FONT_SIZE );
|
||||
if ( m_iFontSize < 8 )
|
||||
m_iFontSize = 8;
|
||||
else if ( m_iFontSize > 24 )
|
||||
m_iFontSize = 24;
|
||||
|
||||
m_strStdFontName = config->readEntry( "StandardFont" );
|
||||
if ( m_strStdFontName.isEmpty() )
|
||||
m_strStdFontName = DEFAULT_VIEW_FONT;
|
||||
|
||||
m_strFixedFontName = config->readEntry( "FixedFont" );
|
||||
if ( m_strFixedFontName.isEmpty() )
|
||||
m_strFixedFontName = DEFAULT_VIEW_FIXED_FONT;
|
||||
|
||||
m_bgColor = config->readColorEntry( "BgColor", &HTML_DEFAULT_BG_COLOR );
|
||||
m_textColor = config->readColorEntry( "TextColor", &HTML_DEFAULT_TXT_COLOR );
|
||||
m_linkColor = config->readColorEntry( "LinkColor", &HTML_DEFAULT_LNK_COLOR );
|
||||
m_vLinkColor = config->readColorEntry( "VLinkColor", &HTML_DEFAULT_VLNK_COLOR);
|
||||
|
||||
// Behaviour
|
||||
m_bChangeCursor = config->readBoolEntry( "ChangeCursor", DEFAULT_CHANGECURSOR );
|
||||
m_underlineLink = config->readBoolEntry( "UnderlineLink", DEFAULT_UNDERLINELINKS );
|
||||
|
||||
// Other
|
||||
config->setGroup( "HTML Settings" ); // group will be restored by cgs anyway
|
||||
m_bAutoLoadImages = config->readBoolEntry( "AutoLoadImages", true );
|
||||
m_bEnableJava = config->readBoolEntry( "EnableJava", false );
|
||||
m_bEnableJavaScript = config->readBoolEntry( "EnableJavaScript", false );
|
||||
m_strJavaPath = config->readEntry( "JavaPath", "/usr/lib/jdk" );
|
||||
|
||||
}
|
||||
|
||||
//static
|
||||
KonqHTMLSettings * KonqHTMLSettings::defaultHTMLSettings()
|
||||
{
|
||||
if (!s_HTMLSettings)
|
||||
s_HTMLSettings = new KonqHTMLSettings();
|
||||
return s_HTMLSettings;
|
||||
}
|
||||
|
||||
//static
|
||||
void KonqHTMLSettings::reparseConfiguration()
|
||||
{
|
||||
if ( s_HTMLSettings )
|
||||
{
|
||||
KConfig config ( "konquerorrc", true );
|
||||
config.setGroup( "HTML Settings" );
|
||||
s_HTMLSettings->init( &config );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,10 +30,9 @@ class KConfig;
|
|||
* There is no 'local' (per-URL) instance of it.
|
||||
* All those settings can only be changed in kcmkonq.
|
||||
*
|
||||
* There is one instance for the tree view and one for the icon view
|
||||
* (but currently no support for customizing the tree view)
|
||||
*
|
||||
* The values are read from konquerorrc, group "FM Settings"
|
||||
* There is one instance for the tree view, one for the icon view
|
||||
* in konqueror and one for the icon view in kdesktop
|
||||
* (but currently lacking support in kcontrol)
|
||||
*/
|
||||
|
||||
class KonqFMSettings
|
||||
|
@ -58,12 +57,15 @@ public:
|
|||
static KonqFMSettings * defaultTreeSettings();
|
||||
/**
|
||||
* A static instance of KonqFMSettings, holding the values for the icon view
|
||||
* (including the kdesktop one)
|
||||
*/
|
||||
static KonqFMSettings * defaultIconSettings();
|
||||
|
||||
|
||||
/**
|
||||
* Reparse the configuration to update the already-created instances
|
||||
* Warning : you need to call kapp->config()->reparseConfiguration() first
|
||||
* (This is not done here so that the caller can avoid too much reparsing
|
||||
* if having several classes from the same config file)
|
||||
*/
|
||||
static void reparseConfiguration();
|
||||
|
||||
|
@ -110,78 +112,4 @@ private:
|
|||
KonqFMSettings( const KonqFMSettings &);
|
||||
};
|
||||
|
||||
// HTML settings
|
||||
|
||||
class KonqHTMLSettings
|
||||
{
|
||||
protected:
|
||||
/**
|
||||
* @internal Constructor
|
||||
*/
|
||||
KonqHTMLSettings();
|
||||
|
||||
/** Called by constructor and reparseConfiguration */
|
||||
void init( KConfig * config );
|
||||
|
||||
/** Destructor. Don't delete any instance by yourself. */
|
||||
virtual ~KonqHTMLSettings() {};
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* The static instance of KonqHTMLSettings
|
||||
*/
|
||||
static KonqHTMLSettings * defaultHTMLSettings();
|
||||
/**
|
||||
* Reparse the configuration to update the already-created instances
|
||||
*/
|
||||
static void reparseConfiguration();
|
||||
|
||||
// Behaviour settings
|
||||
bool changeCursor() { return m_bChangeCursor; }
|
||||
bool underlineLink() { return m_underlineLink; }
|
||||
|
||||
// Font settings
|
||||
const QString& stdFontName() { return m_strStdFontName; }
|
||||
const QString& fixedFontName() { return m_strFixedFontName; }
|
||||
int fontSize() { return m_iFontSize; }
|
||||
|
||||
// Color settings
|
||||
const QColor& bgColor() { return m_bgColor; }
|
||||
const QColor& textColor() { return m_textColor; }
|
||||
const QColor& linkColor() { return m_linkColor; }
|
||||
const QColor& vLinkColor() { return m_vLinkColor; }
|
||||
|
||||
// Autoload images
|
||||
bool autoLoadImages() { return m_bAutoLoadImages; }
|
||||
|
||||
// Java and JavaScript
|
||||
bool enableJava() { return m_bEnableJava; }
|
||||
bool enableJavaScript() { return m_bEnableJavaScript; }
|
||||
QString javaPath() { return m_strJavaPath; }
|
||||
|
||||
private:
|
||||
bool m_bChangeCursor;
|
||||
bool m_underlineLink;
|
||||
|
||||
QString m_strStdFontName;
|
||||
QString m_strFixedFontName;
|
||||
int m_iFontSize;
|
||||
|
||||
QColor m_bgColor;
|
||||
QColor m_textColor;
|
||||
QColor m_linkColor;
|
||||
QColor m_vLinkColor;
|
||||
|
||||
bool m_bAutoLoadImages;
|
||||
bool m_bEnableJava;
|
||||
bool m_bEnableJavaScript;
|
||||
QString m_strJavaPath;
|
||||
|
||||
static KonqHTMLSettings * s_HTMLSettings;
|
||||
private:
|
||||
// There is no copy constructors. Use the static method
|
||||
KonqHTMLSettings( const KonqHTMLSettings &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue