You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1065 lines
33 KiB
1065 lines
33 KiB
15 years ago
|
/* This file is part of the KDE project
|
||
|
Copyright (C) 1999 David Faure <faure@kde.org>
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License as published by the Free Software Foundation; either
|
||
|
version 2 of the License, or (at your option) any later version.
|
||
|
|
||
|
This library is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
14 years ago
|
#include <tqfontdatabase.h>
|
||
15 years ago
|
|
||
12 years ago
|
#include "tdehtml_settings.h"
|
||
|
#include "tdehtmldefaults.h"
|
||
12 years ago
|
#include <tdeglobalsettings.h>
|
||
12 years ago
|
#include <tdeconfig.h>
|
||
12 years ago
|
#include <tdeglobal.h>
|
||
|
#include <tdelocale.h>
|
||
15 years ago
|
#include <kdebug.h>
|
||
14 years ago
|
#include <tqregexp.h>
|
||
|
#include <tqvaluevector.h>
|
||
12 years ago
|
#include <tdemessagebox.h>
|
||
15 years ago
|
|
||
|
/**
|
||
|
* @internal
|
||
|
* Contains all settings which are both available globally and per-domain
|
||
|
*/
|
||
|
struct KPerDomainSettings {
|
||
|
bool m_bEnableJava : 1;
|
||
|
bool m_bEnableJavaScript : 1;
|
||
|
bool m_bEnablePlugins : 1;
|
||
|
// don't forget to maintain the bitfields as the enums grow
|
||
12 years ago
|
TDEHTMLSettings::KJSWindowOpenPolicy m_windowOpenPolicy : 2;
|
||
|
TDEHTMLSettings::KJSWindowStatusPolicy m_windowStatusPolicy : 1;
|
||
|
TDEHTMLSettings::KJSWindowFocusPolicy m_windowFocusPolicy : 1;
|
||
|
TDEHTMLSettings::KJSWindowMovePolicy m_windowMovePolicy : 1;
|
||
|
TDEHTMLSettings::KJSWindowResizePolicy m_windowResizePolicy : 1;
|
||
15 years ago
|
|
||
|
#ifdef DEBUG_SETTINGS
|
||
14 years ago
|
void dump(const TQString &infix = TQString::null) const {
|
||
15 years ago
|
kdDebug() << "KPerDomainSettings " << infix << " @" << this << ":" << endl;
|
||
|
kdDebug() << " m_bEnableJava: " << m_bEnableJava << endl;
|
||
|
kdDebug() << " m_bEnableJavaScript: " << m_bEnableJavaScript << endl;
|
||
|
kdDebug() << " m_bEnablePlugins: " << m_bEnablePlugins << endl;
|
||
|
kdDebug() << " m_windowOpenPolicy: " << m_windowOpenPolicy << endl;
|
||
14 years ago
|
kdDebug() << " m_windowStatusPolicy: " << m_windowStatusPolicy << endl;
|
||
15 years ago
|
kdDebug() << " m_windowFocusPolicy: " << m_windowFocusPolicy << endl;
|
||
|
kdDebug() << " m_windowMovePolicy: " << m_windowMovePolicy << endl;
|
||
|
kdDebug() << " m_windowResizePolicy: " << m_windowResizePolicy << endl;
|
||
|
}
|
||
|
#endif
|
||
|
};
|
||
|
|
||
14 years ago
|
typedef TQMap<TQString,KPerDomainSettings> PolicyMap;
|
||
15 years ago
|
|
||
12 years ago
|
class TDEHTMLSettingsPrivate
|
||
15 years ago
|
{
|
||
|
public:
|
||
|
bool m_bChangeCursor : 1;
|
||
|
bool m_bOpenMiddleClick : 1;
|
||
|
bool m_bBackRightClick : 1;
|
||
|
bool m_underlineLink : 1;
|
||
|
bool m_hoverLink : 1;
|
||
|
bool m_bEnableJavaScriptDebug : 1;
|
||
|
bool m_bEnableJavaScriptErrorReporting : 1;
|
||
|
bool enforceCharset : 1;
|
||
|
bool m_bAutoLoadImages : 1;
|
||
|
bool m_bUnfinishedImageFrame : 1;
|
||
|
bool m_formCompletionEnabled : 1;
|
||
|
bool m_autoDelayedActionsEnabled : 1;
|
||
|
bool m_jsErrorsEnabled : 1;
|
||
|
bool m_follow_system_colors : 1;
|
||
|
bool m_allowTabulation : 1;
|
||
|
bool m_autoSpellCheck : 1;
|
||
|
bool m_adFilterEnabled : 1;
|
||
|
bool m_hideAdsEnabled : 1;
|
||
|
bool m_jsPopupBlockerPassivePopup : 1;
|
||
|
bool m_accessKeysEnabled : 1;
|
||
|
|
||
|
// the virtual global "domain"
|
||
|
KPerDomainSettings global;
|
||
|
|
||
|
int m_fontSize;
|
||
|
int m_minFontSize;
|
||
|
int m_maxFormCompletionItems;
|
||
12 years ago
|
TDEHTMLSettings::KAnimationAdvice m_showAnimations;
|
||
15 years ago
|
|
||
14 years ago
|
TQString m_encoding;
|
||
|
TQString m_userSheet;
|
||
15 years ago
|
|
||
14 years ago
|
TQColor m_textColor;
|
||
|
TQColor m_baseColor;
|
||
|
TQColor m_linkColor;
|
||
|
TQColor m_vLinkColor;
|
||
15 years ago
|
|
||
|
PolicyMap domainPolicy;
|
||
14 years ago
|
TQStringList fonts;
|
||
|
TQStringList defaultFonts;
|
||
15 years ago
|
|
||
14 years ago
|
TQValueVector<TQRegExp> adFilters;
|
||
14 years ago
|
TQValueList< TQPair< TQString, TQChar > > m_fallbackAccessKeysAssignments;
|
||
15 years ago
|
};
|
||
|
|
||
|
|
||
|
/** Returns a writeable per-domains settings instance for the given domain
|
||
|
* or a deep copy of the global settings if not existent.
|
||
|
*/
|
||
|
static KPerDomainSettings &setup_per_domain_policy(
|
||
12 years ago
|
TDEHTMLSettingsPrivate *d,
|
||
14 years ago
|
const TQString &domain) {
|
||
15 years ago
|
if (domain.isEmpty()) {
|
||
|
kdWarning() << "setup_per_domain_policy: domain is empty" << endl;
|
||
|
}
|
||
14 years ago
|
const TQString ldomain = domain.lower();
|
||
13 years ago
|
PolicyMap::iterator it = d->domainPolicy.find(ldomain);
|
||
15 years ago
|
if (it == d->domainPolicy.end()) {
|
||
|
// simply copy global domain settings (they should have been initialized
|
||
|
// by this time)
|
||
|
it = d->domainPolicy.insert(ldomain,d->global);
|
||
|
}
|
||
|
return *it;
|
||
|
}
|
||
|
|
||
|
|
||
12 years ago
|
TDEHTMLSettings::KJavaScriptAdvice TDEHTMLSettings::strToAdvice(const TQString& _str)
|
||
15 years ago
|
{
|
||
|
KJavaScriptAdvice ret = KJavaScriptDunno;
|
||
|
|
||
|
if (!_str)
|
||
|
ret = KJavaScriptDunno;
|
||
|
|
||
13 years ago
|
if (_str.lower() == TQString::fromLatin1("accept"))
|
||
15 years ago
|
ret = KJavaScriptAccept;
|
||
13 years ago
|
else if (_str.lower() == TQString::fromLatin1("reject"))
|
||
15 years ago
|
ret = KJavaScriptReject;
|
||
|
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
12 years ago
|
const char* TDEHTMLSettings::adviceToStr(KJavaScriptAdvice _advice)
|
||
15 years ago
|
{
|
||
|
switch( _advice ) {
|
||
|
case KJavaScriptAccept: return I18N_NOOP("Accept");
|
||
|
case KJavaScriptReject: return I18N_NOOP("Reject");
|
||
|
default: return 0;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|
||
12 years ago
|
void TDEHTMLSettings::splitDomainAdvice(const TQString& configStr, TQString &domain,
|
||
15 years ago
|
KJavaScriptAdvice &javaAdvice, KJavaScriptAdvice& javaScriptAdvice)
|
||
|
{
|
||
14 years ago
|
TQString tmp(configStr);
|
||
13 years ago
|
int splitIndex = tmp.find(':');
|
||
15 years ago
|
if ( splitIndex == -1)
|
||
|
{
|
||
|
domain = configStr.lower();
|
||
|
javaAdvice = KJavaScriptDunno;
|
||
|
javaScriptAdvice = KJavaScriptDunno;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
domain = tmp.left(splitIndex).lower();
|
||
14 years ago
|
TQString adviceString = tmp.mid( splitIndex+1, tmp.length() );
|
||
13 years ago
|
int splitIndex2 = adviceString.find( ':' );
|
||
15 years ago
|
if( splitIndex2 == -1 ) {
|
||
|
// Java advice only
|
||
|
javaAdvice = strToAdvice( adviceString );
|
||
|
javaScriptAdvice = KJavaScriptDunno;
|
||
|
} else {
|
||
|
// Java and JavaScript advice
|
||
|
javaAdvice = strToAdvice( adviceString.left( splitIndex2 ) );
|
||
|
javaScriptAdvice = strToAdvice( adviceString.mid( splitIndex2+1,
|
||
|
adviceString.length() ) );
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
12 years ago
|
void TDEHTMLSettings::readDomainSettings(TDEConfig *config, bool reset,
|
||
15 years ago
|
bool global, KPerDomainSettings &pd_settings) {
|
||
14 years ago
|
TQString jsPrefix = global ? TQString::null
|
||
13 years ago
|
: TQString::fromLatin1("javascript.");
|
||
14 years ago
|
TQString javaPrefix = global ? TQString::null
|
||
13 years ago
|
: TQString::fromLatin1("java.");
|
||
14 years ago
|
TQString pluginsPrefix = global ? TQString::null
|
||
13 years ago
|
: TQString::fromLatin1("plugins.");
|
||
15 years ago
|
|
||
|
// The setting for Java
|
||
13 years ago
|
TQString key = javaPrefix + TQString::fromLatin1("EnableJava");
|
||
15 years ago
|
if ( (global && reset) || config->hasKey( key ) )
|
||
|
pd_settings.m_bEnableJava = config->readBoolEntry( key, false );
|
||
|
else if ( !global )
|
||
|
pd_settings.m_bEnableJava = d->global.m_bEnableJava;
|
||
|
|
||
|
// The setting for Plugins
|
||
13 years ago
|
key = pluginsPrefix + TQString::fromLatin1("EnablePlugins");
|
||
15 years ago
|
if ( (global && reset) || config->hasKey( key ) )
|
||
|
pd_settings.m_bEnablePlugins = config->readBoolEntry( key, true );
|
||
|
else if ( !global )
|
||
|
pd_settings.m_bEnablePlugins = d->global.m_bEnablePlugins;
|
||
|
|
||
|
// The setting for JavaScript
|
||
13 years ago
|
key = jsPrefix + TQString::fromLatin1("EnableJavaScript");
|
||
15 years ago
|
if ( (global && reset) || config->hasKey( key ) )
|
||
|
pd_settings.m_bEnableJavaScript = config->readBoolEntry( key, true );
|
||
|
else if ( !global )
|
||
|
pd_settings.m_bEnableJavaScript = d->global.m_bEnableJavaScript;
|
||
|
|
||
|
// window property policies
|
||
13 years ago
|
key = jsPrefix + TQString::fromLatin1("WindowOpenPolicy");
|
||
15 years ago
|
if ( (global && reset) || config->hasKey( key ) )
|
||
|
pd_settings.m_windowOpenPolicy = (KJSWindowOpenPolicy)
|
||
|
config->readUnsignedNumEntry( key, KJSWindowOpenSmart );
|
||
|
else if ( !global )
|
||
|
pd_settings.m_windowOpenPolicy = d->global.m_windowOpenPolicy;
|
||
|
|
||
13 years ago
|
key = jsPrefix + TQString::fromLatin1("WindowMovePolicy");
|
||
15 years ago
|
if ( (global && reset) || config->hasKey( key ) )
|
||
|
pd_settings.m_windowMovePolicy = (KJSWindowMovePolicy)
|
||
|
config->readUnsignedNumEntry( key, KJSWindowMoveAllow );
|
||
|
else if ( !global )
|
||
|
pd_settings.m_windowMovePolicy = d->global.m_windowMovePolicy;
|
||
|
|
||
13 years ago
|
key = jsPrefix + TQString::fromLatin1("WindowResizePolicy");
|
||
15 years ago
|
if ( (global && reset) || config->hasKey( key ) )
|
||
|
pd_settings.m_windowResizePolicy = (KJSWindowResizePolicy)
|
||
|
config->readUnsignedNumEntry( key, KJSWindowResizeAllow );
|
||
|
else if ( !global )
|
||
|
pd_settings.m_windowResizePolicy = d->global.m_windowResizePolicy;
|
||
|
|
||
13 years ago
|
key = jsPrefix + TQString::fromLatin1("WindowStatusPolicy");
|
||
15 years ago
|
if ( (global && reset) || config->hasKey( key ) )
|
||
14 years ago
|
pd_settings.m_windowStatusPolicy = (KJSWindowStatusPolicy)
|
||
|
config->readUnsignedNumEntry( key, KJSWindowStatusAllow );
|
||
15 years ago
|
else if ( !global )
|
||
14 years ago
|
pd_settings.m_windowStatusPolicy = d->global.m_windowStatusPolicy;
|
||
15 years ago
|
|
||
13 years ago
|
key = jsPrefix + TQString::fromLatin1("WindowFocusPolicy");
|
||
15 years ago
|
if ( (global && reset) || config->hasKey( key ) )
|
||
|
pd_settings.m_windowFocusPolicy = (KJSWindowFocusPolicy)
|
||
|
config->readUnsignedNumEntry( key, KJSWindowFocusAllow );
|
||
|
else if ( !global )
|
||
|
pd_settings.m_windowFocusPolicy = d->global.m_windowFocusPolicy;
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
12 years ago
|
TDEHTMLSettings::TDEHTMLSettings()
|
||
15 years ago
|
{
|
||
12 years ago
|
d = new TDEHTMLSettingsPrivate();
|
||
15 years ago
|
init();
|
||
|
}
|
||
|
|
||
12 years ago
|
TDEHTMLSettings::TDEHTMLSettings(const TDEHTMLSettings &other)
|
||
15 years ago
|
{
|
||
12 years ago
|
d = new TDEHTMLSettingsPrivate();
|
||
15 years ago
|
*d = *other.d;
|
||
|
}
|
||
|
|
||
12 years ago
|
TDEHTMLSettings::~TDEHTMLSettings()
|
||
15 years ago
|
{
|
||
|
delete d;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::changeCursor() const
|
||
15 years ago
|
{
|
||
|
return d->m_bChangeCursor;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::underlineLink() const
|
||
15 years ago
|
{
|
||
|
return d->m_underlineLink;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::hoverLink() const
|
||
15 years ago
|
{
|
||
|
return d->m_hoverLink;
|
||
|
}
|
||
|
|
||
12 years ago
|
void TDEHTMLSettings::init()
|
||
15 years ago
|
{
|
||
12 years ago
|
TDEConfig global( "tdehtmlrc", true, false );
|
||
15 years ago
|
init( &global, true );
|
||
|
|
||
12 years ago
|
TDEConfig *local = TDEGlobal::config();
|
||
15 years ago
|
if ( !local )
|
||
|
return;
|
||
|
|
||
|
init( local, false );
|
||
|
}
|
||
|
|
||
12 years ago
|
void TDEHTMLSettings::init( TDEConfig * config, bool reset )
|
||
15 years ago
|
{
|
||
14 years ago
|
TQString group_save = config->group();
|
||
15 years ago
|
if (reset || config->hasGroup("MainView Settings"))
|
||
|
{
|
||
|
config->setGroup( "MainView Settings" );
|
||
|
|
||
|
if ( reset || config->hasKey( "OpenMiddleClick" ) )
|
||
|
d->m_bOpenMiddleClick = config->readBoolEntry( "OpenMiddleClick", true );
|
||
|
|
||
|
if ( reset || config->hasKey( "BackRightClick" ) )
|
||
|
d->m_bBackRightClick = config->readBoolEntry( "BackRightClick", false );
|
||
|
}
|
||
|
|
||
|
if (reset || config->hasGroup("Access Keys")) {
|
||
|
config->setGroup( "Access Keys" );
|
||
|
d->m_accessKeysEnabled = config->readBoolEntry( "Enabled", true );
|
||
|
}
|
||
|
|
||
|
if (reset || config->hasGroup("Filter Settings"))
|
||
|
{
|
||
|
config->setGroup( "Filter Settings" );
|
||
|
d->m_adFilterEnabled = config->readBoolEntry("Enabled", false);
|
||
|
d->m_hideAdsEnabled = config->readBoolEntry("Shrink", false);
|
||
|
|
||
|
d->adFilters.clear();
|
||
|
|
||
14 years ago
|
TQMap<TQString,TQString> entryMap = config->entryMap("Filter Settings");
|
||
|
TQMap<TQString,TQString>::ConstIterator it;
|
||
15 years ago
|
d->adFilters.reserve(entryMap.count());
|
||
|
for( it = entryMap.constBegin(); it != entryMap.constEnd(); ++it )
|
||
|
{
|
||
14 years ago
|
TQString name = it.key();
|
||
|
TQString url = it.data();
|
||
15 years ago
|
|
||
|
if (url.startsWith("!"))
|
||
|
continue;
|
||
|
|
||
|
if (name.startsWith("Filter"))
|
||
|
{
|
||
|
if (url.length()>2 && url[0]=='/' && url[url.length()-1] == '/')
|
||
|
{
|
||
14 years ago
|
TQString inside = url.mid(1, url.length()-2);
|
||
|
TQRegExp rx(inside);
|
||
15 years ago
|
d->adFilters.append(rx);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
14 years ago
|
TQRegExp rx;
|
||
15 years ago
|
int left,right;
|
||
|
|
||
|
for (right=url.length(); right>0 && url[right-1]=='*' ; --right);
|
||
|
for (left=0; left<right && url[left]=='*' ; ++left);
|
||
|
|
||
|
rx.setWildcard(true);
|
||
|
rx.setPattern(url.mid(left,right-left));
|
||
|
|
||
|
d->adFilters.append(rx);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
if (reset || config->hasGroup("HTML Settings"))
|
||
|
{
|
||
|
config->setGroup( "HTML Settings" );
|
||
|
// Fonts and colors
|
||
|
if( reset ) {
|
||
14 years ago
|
d->defaultFonts = TQStringList();
|
||
12 years ago
|
d->defaultFonts.append( config->readEntry( "StandardFont", TDEGlobalSettings::generalFont().family() ) );
|
||
|
d->defaultFonts.append( config->readEntry( "FixedFont", TDEGlobalSettings::fixedFont().family() ) );
|
||
15 years ago
|
d->defaultFonts.append( config->readEntry( "SerifFont", HTML_DEFAULT_VIEW_SERIF_FONT ) );
|
||
|
d->defaultFonts.append( config->readEntry( "SansSerifFont", HTML_DEFAULT_VIEW_SANSSERIF_FONT ) );
|
||
|
d->defaultFonts.append( config->readEntry( "CursiveFont", HTML_DEFAULT_VIEW_CURSIVE_FONT ) );
|
||
|
d->defaultFonts.append( config->readEntry( "FantasyFont", HTML_DEFAULT_VIEW_FANTASY_FONT ) );
|
||
14 years ago
|
d->defaultFonts.append( TQString( "0" ) ); // font size adjustment
|
||
15 years ago
|
}
|
||
|
|
||
|
if ( reset || config->hasKey( "MinimumFontSize" ) )
|
||
|
d->m_minFontSize = config->readNumEntry( "MinimumFontSize", HTML_DEFAULT_MIN_FONT_SIZE );
|
||
|
|
||
|
if ( reset || config->hasKey( "MediumFontSize" ) )
|
||
|
d->m_fontSize = config->readNumEntry( "MediumFontSize", 12 );
|
||
|
|
||
|
d->fonts = config->readListEntry( "Fonts" );
|
||
|
|
||
|
if ( reset || config->hasKey( "DefaultEncoding" ) )
|
||
|
d->m_encoding = config->readEntry( "DefaultEncoding", "" );
|
||
|
|
||
|
if ( reset || config->hasKey( "EnforceDefaultCharset" ) )
|
||
|
d->enforceCharset = config->readBoolEntry( "EnforceDefaultCharset", false );
|
||
|
|
||
|
// Behavior
|
||
|
if ( reset || config->hasKey( "ChangeCursor" ) )
|
||
|
d->m_bChangeCursor = config->readBoolEntry( "ChangeCursor", KDE_DEFAULT_CHANGECURSOR );
|
||
|
|
||
|
if ( reset || config->hasKey("UnderlineLinks") )
|
||
|
d->m_underlineLink = config->readBoolEntry( "UnderlineLinks", true );
|
||
|
|
||
|
if ( reset || config->hasKey( "HoverLinks" ) )
|
||
|
{
|
||
|
if ( ( d->m_hoverLink = config->readBoolEntry( "HoverLinks", false ) ) )
|
||
|
d->m_underlineLink = false;
|
||
|
}
|
||
|
|
||
|
if ( reset || config->hasKey( "AllowTabulation" ) )
|
||
|
d->m_allowTabulation = config->readBoolEntry( "AllowTabulation", false );
|
||
|
|
||
|
if ( reset || config->hasKey( "AutoSpellCheck" ) )
|
||
|
d->m_autoSpellCheck = config->readBoolEntry( "AutoSpellCheck", true );
|
||
|
|
||
|
// Other
|
||
|
if ( reset || config->hasKey( "AutoLoadImages" ) )
|
||
|
d->m_bAutoLoadImages = config->readBoolEntry( "AutoLoadImages", true );
|
||
|
|
||
|
if ( reset || config->hasKey( "UnfinishedImageFrame" ) )
|
||
|
d->m_bUnfinishedImageFrame = config->readBoolEntry( "UnfinishedImageFrame", true );
|
||
|
|
||
|
if ( reset || config->hasKey( "ShowAnimations" ) )
|
||
|
{
|
||
14 years ago
|
TQString value = config->readEntry( "ShowAnimations").lower();
|
||
15 years ago
|
if (value == "disabled")
|
||
|
d->m_showAnimations = KAnimationDisabled;
|
||
|
else if (value == "looponce")
|
||
|
d->m_showAnimations = KAnimationLoopOnce;
|
||
|
else
|
||
|
d->m_showAnimations = KAnimationEnabled;
|
||
|
}
|
||
|
|
||
|
if ( config->readBoolEntry( "UserStyleSheetEnabled", false ) == true ) {
|
||
|
if ( reset || config->hasKey( "UserStyleSheet" ) )
|
||
|
d->m_userSheet = config->readEntry( "UserStyleSheet", "" );
|
||
|
}
|
||
|
|
||
|
d->m_formCompletionEnabled = config->readBoolEntry("FormCompletion", true);
|
||
|
d->m_maxFormCompletionItems = config->readNumEntry("MaxFormCompletionItems", 10);
|
||
|
d->m_autoDelayedActionsEnabled = config->readBoolEntry ("AutoDelayedActions", true);
|
||
|
d->m_jsErrorsEnabled = config->readBoolEntry("ReportJSErrors", true);
|
||
14 years ago
|
TQStringList accesskeys = config->readListEntry("FallbackAccessKeysAssignments");
|
||
15 years ago
|
d->m_fallbackAccessKeysAssignments.clear();
|
||
14 years ago
|
for( TQStringList::ConstIterator it = accesskeys.begin(); it != accesskeys.end(); ++it )
|
||
15 years ago
|
if( (*it).length() > 2 && (*it)[ 1 ] == ':' )
|
||
14 years ago
|
d->m_fallbackAccessKeysAssignments.append( tqMakePair( (*it).mid( 2 ), (*it)[ 0 ] ));
|
||
15 years ago
|
}
|
||
|
|
||
|
// Colors
|
||
|
|
||
|
if ( reset || config->hasKey( "FollowSystemColors" ) )
|
||
|
d->m_follow_system_colors = config->readBoolEntry( "FollowSystemColors", false );
|
||
|
|
||
|
if ( reset || config->hasGroup( "General" ) )
|
||
|
{
|
||
|
config->setGroup( "General" ); // group will be restored by cgs anyway
|
||
|
if ( reset || config->hasKey( "foreground" ) )
|
||
|
d->m_textColor = config->readColorEntry( "foreground", &HTML_DEFAULT_TXT_COLOR );
|
||
|
|
||
|
if ( reset || config->hasKey( "linkColor" ) )
|
||
|
d->m_linkColor = config->readColorEntry( "linkColor", &HTML_DEFAULT_LNK_COLOR );
|
||
|
|
||
|
if ( reset || config->hasKey( "visitedLinkColor" ) )
|
||
|
d->m_vLinkColor = config->readColorEntry( "visitedLinkColor", &HTML_DEFAULT_VLNK_COLOR);
|
||
|
|
||
|
if ( reset || config->hasKey( "background" ) )
|
||
|
d->m_baseColor = config->readColorEntry( "background", &HTML_DEFAULT_BASE_COLOR);
|
||
|
}
|
||
|
|
||
|
if( reset || config->hasGroup( "Java/JavaScript Settings" ) )
|
||
|
{
|
||
|
config->setGroup( "Java/JavaScript Settings" );
|
||
|
|
||
|
// The global setting for JavaScript debugging
|
||
|
// This is currently always enabled by default
|
||
|
if ( reset || config->hasKey( "EnableJavaScriptDebug" ) )
|
||
|
d->m_bEnableJavaScriptDebug = config->readBoolEntry( "EnableJavaScriptDebug", false );
|
||
|
|
||
|
// The global setting for JavaScript error reporting
|
||
|
if ( reset || config->hasKey( "ReportJavaScriptErrors" ) )
|
||
|
d->m_bEnableJavaScriptErrorReporting = config->readBoolEntry( "ReportJavaScriptErrors", false );
|
||
|
|
||
|
// The global setting for popup block passive popup
|
||
|
if ( reset || config->hasKey( "PopupBlockerPassivePopup" ) )
|
||
|
d->m_jsPopupBlockerPassivePopup = config->readBoolEntry("PopupBlockerPassivePopup", true);
|
||
|
|
||
|
// Read options from the global "domain"
|
||
|
readDomainSettings(config,reset,true,d->global);
|
||
|
#ifdef DEBUG_SETTINGS
|
||
|
d->global.dump("init global");
|
||
|
#endif
|
||
|
|
||
|
// The domain-specific settings.
|
||
|
|
||
|
static const char *const domain_keys[] = { // always keep order of keys
|
||
|
"ECMADomains", "JavaDomains", "PluginDomains"
|
||
|
};
|
||
|
bool check_old_ecma_settings = true;
|
||
|
bool check_old_java_settings = true;
|
||
|
// merge all domains into one list
|
||
14 years ago
|
TQMap<TQString,int> domainList; // why can't Qt have a QSet?
|
||
15 years ago
|
for (unsigned i = 0; i < sizeof domain_keys/sizeof domain_keys[0]; ++i) {
|
||
|
if ( reset || config->hasKey(domain_keys[i]) ) {
|
||
|
if (i == 0) check_old_ecma_settings = false;
|
||
|
else if (i == 1) check_old_java_settings = false;
|
||
14 years ago
|
const TQStringList dl = config->readListEntry( domain_keys[i] );
|
||
|
const TQMap<TQString,int>::Iterator notfound = domainList.end();
|
||
|
TQStringList::ConstIterator it = dl.begin();
|
||
|
const TQStringList::ConstIterator itEnd = dl.end();
|
||
15 years ago
|
for (; it != itEnd; ++it) {
|
||
14 years ago
|
const TQString domain = (*it).lower();
|
||
13 years ago
|
TQMap<TQString,int>::Iterator pos = domainList.find(domain);
|
||
15 years ago
|
if (pos == notfound) domainList.insert(domain,0);
|
||
|
}/*next it*/
|
||
|
}
|
||
|
}/*next i*/
|
||
|
|
||
|
if (reset)
|
||
|
d->domainPolicy.clear();
|
||
|
|
||
14 years ago
|
TQString js_group_save = config->group();
|
||
15 years ago
|
{
|
||
14 years ago
|
TQMap<TQString,int>::ConstIterator it = domainList.begin();
|
||
|
const TQMap<TQString,int>::ConstIterator itEnd = domainList.end();
|
||
15 years ago
|
for ( ; it != itEnd; ++it)
|
||
|
{
|
||
14 years ago
|
const TQString domain = it.key();
|
||
15 years ago
|
config->setGroup(domain);
|
||
|
readDomainSettings(config,reset,false,d->domainPolicy[domain]);
|
||
|
#ifdef DEBUG_SETTINGS
|
||
|
d->domainPolicy[domain].dump("init "+domain);
|
||
|
#endif
|
||
|
}
|
||
|
}
|
||
|
config->setGroup(js_group_save);
|
||
|
|
||
|
bool check_old_java = true;
|
||
|
if( ( reset || config->hasKey( "JavaDomainSettings" ) )
|
||
|
&& check_old_java_settings )
|
||
|
{
|
||
|
check_old_java = false;
|
||
14 years ago
|
const TQStringList domainList = config->readListEntry( "JavaDomainSettings" );
|
||
|
TQStringList::ConstIterator it = domainList.begin();
|
||
|
const TQStringList::ConstIterator itEnd = domainList.end();
|
||
15 years ago
|
for ( ; it != itEnd; ++it)
|
||
|
{
|
||
14 years ago
|
TQString domain;
|
||
15 years ago
|
KJavaScriptAdvice javaAdvice;
|
||
|
KJavaScriptAdvice javaScriptAdvice;
|
||
|
splitDomainAdvice(*it, domain, javaAdvice, javaScriptAdvice);
|
||
|
setup_per_domain_policy(d,domain).m_bEnableJava =
|
||
|
javaAdvice == KJavaScriptAccept;
|
||
|
#ifdef DEBUG_SETTINGS
|
||
|
setup_per_domain_policy(d,domain).dump("JavaDomainSettings 4 "+domain);
|
||
|
#endif
|
||
|
}
|
||
|
}
|
||
|
|
||
|
bool check_old_ecma = true;
|
||
|
if( ( reset || config->hasKey( "ECMADomainSettings" ) )
|
||
|
&& check_old_ecma_settings )
|
||
|
{
|
||
|
check_old_ecma = false;
|
||
14 years ago
|
const TQStringList domainList = config->readListEntry( "ECMADomainSettings" );
|
||
|
TQStringList::ConstIterator it = domainList.begin();
|
||
|
const TQStringList::ConstIterator itEnd = domainList.end();
|
||
15 years ago
|
for ( ; it != itEnd; ++it)
|
||
|
{
|
||
14 years ago
|
TQString domain;
|
||
15 years ago
|
KJavaScriptAdvice javaAdvice;
|
||
|
KJavaScriptAdvice javaScriptAdvice;
|
||
|
splitDomainAdvice(*it, domain, javaAdvice, javaScriptAdvice);
|
||
|
setup_per_domain_policy(d,domain).m_bEnableJavaScript =
|
||
|
javaScriptAdvice == KJavaScriptAccept;
|
||
|
#ifdef DEBUG_SETTINGS
|
||
|
setup_per_domain_policy(d,domain).dump("ECMADomainSettings 4 "+domain);
|
||
|
#endif
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if( ( reset || config->hasKey( "JavaScriptDomainAdvice" ) )
|
||
|
&& ( check_old_java || check_old_ecma )
|
||
|
&& ( check_old_ecma_settings || check_old_java_settings ) )
|
||
|
{
|
||
14 years ago
|
const TQStringList domainList = config->readListEntry( "JavaScriptDomainAdvice" );
|
||
|
TQStringList::ConstIterator it = domainList.begin();
|
||
|
const TQStringList::ConstIterator itEnd = domainList.end();
|
||
15 years ago
|
for ( ; it != itEnd; ++it)
|
||
|
{
|
||
14 years ago
|
TQString domain;
|
||
15 years ago
|
KJavaScriptAdvice javaAdvice;
|
||
|
KJavaScriptAdvice javaScriptAdvice;
|
||
|
splitDomainAdvice(*it, domain, javaAdvice, javaScriptAdvice);
|
||
|
if( check_old_java )
|
||
|
setup_per_domain_policy(d,domain).m_bEnableJava =
|
||
|
javaAdvice == KJavaScriptAccept;
|
||
|
if( check_old_ecma )
|
||
|
setup_per_domain_policy(d,domain).m_bEnableJavaScript =
|
||
|
javaScriptAdvice == KJavaScriptAccept;
|
||
|
#ifdef DEBUG_SETTINGS
|
||
|
setup_per_domain_policy(d,domain).dump("JavaScriptDomainAdvice 4 "+domain);
|
||
|
#endif
|
||
|
}
|
||
|
|
||
|
//save all the settings into the new keywords if they don't exist
|
||
|
#if 0
|
||
|
if( check_old_java )
|
||
|
{
|
||
14 years ago
|
TQStringList domainConfig;
|
||
15 years ago
|
PolicyMap::Iterator it;
|
||
|
for( it = d->javaDomainPolicy.begin(); it != d->javaDomainPolicy.end(); ++it )
|
||
|
{
|
||
14 years ago
|
TQCString javaPolicy = adviceToStr( it.data() );
|
||
|
TQCString javaScriptPolicy = adviceToStr( KJavaScriptDunno );
|
||
13 years ago
|
domainConfig.append(TQString::fromLatin1("%1:%2:%3").arg(it.key()).arg(javaPolicy).arg(javaScriptPolicy));
|
||
15 years ago
|
}
|
||
|
config->writeEntry( "JavaDomainSettings", domainConfig );
|
||
|
}
|
||
|
|
||
|
if( check_old_ecma )
|
||
|
{
|
||
14 years ago
|
TQStringList domainConfig;
|
||
15 years ago
|
PolicyMap::Iterator it;
|
||
|
for( it = d->javaScriptDomainPolicy.begin(); it != d->javaScriptDomainPolicy.end(); ++it )
|
||
|
{
|
||
14 years ago
|
TQCString javaPolicy = adviceToStr( KJavaScriptDunno );
|
||
|
TQCString javaScriptPolicy = adviceToStr( it.data() );
|
||
13 years ago
|
domainConfig.append(TQString::fromLatin1("%1:%2:%3").arg(it.key()).arg(javaPolicy).arg(javaScriptPolicy));
|
||
15 years ago
|
}
|
||
|
config->writeEntry( "ECMADomainSettings", domainConfig );
|
||
|
}
|
||
|
#endif
|
||
|
}
|
||
|
}
|
||
|
config->setGroup(group_save);
|
||
|
}
|
||
|
|
||
|
|
||
|
/** Local helper for retrieving per-domain settings.
|
||
|
*
|
||
|
* In case of doubt, the global domain is returned.
|
||
|
*/
|
||
|
static const KPerDomainSettings &lookup_hostname_policy(
|
||
12 years ago
|
const TDEHTMLSettingsPrivate *d,
|
||
14 years ago
|
const TQString& hostname)
|
||
15 years ago
|
{
|
||
|
#ifdef DEBUG_SETTINGS
|
||
|
kdDebug() << "lookup_hostname_policy(" << hostname << ")" << endl;
|
||
|
#endif
|
||
|
if (hostname.isEmpty()) {
|
||
|
#ifdef DEBUG_SETTINGS
|
||
|
d->global.dump("global");
|
||
|
#endif
|
||
|
return d->global;
|
||
|
}
|
||
|
|
||
|
const PolicyMap::const_iterator notfound = d->domainPolicy.end();
|
||
|
|
||
|
// First check whether there is a perfect match.
|
||
13 years ago
|
PolicyMap::const_iterator it = d->domainPolicy.find(hostname);
|
||
15 years ago
|
if( it != notfound ) {
|
||
|
#ifdef DEBUG_SETTINGS
|
||
|
kdDebug() << "perfect match" << endl;
|
||
|
(*it).dump(hostname);
|
||
|
#endif
|
||
|
// yes, use it (unless dunno)
|
||
|
return *it;
|
||
|
}
|
||
|
|
||
|
// Now, check for partial match. Chop host from the left until
|
||
|
// there's no dots left.
|
||
14 years ago
|
TQString host_part = hostname;
|
||
15 years ago
|
int dot_idx = -1;
|
||
13 years ago
|
while( (dot_idx = host_part.find(TQChar('.'))) >= 0 ) {
|
||
15 years ago
|
host_part.remove(0,dot_idx);
|
||
13 years ago
|
it = d->domainPolicy.find(host_part);
|
||
15 years ago
|
Q_ASSERT(notfound == d->domainPolicy.end());
|
||
|
if( it != notfound ) {
|
||
|
#ifdef DEBUG_SETTINGS
|
||
|
kdDebug() << "partial match" << endl;
|
||
|
(*it).dump(host_part);
|
||
|
#endif
|
||
|
return *it;
|
||
|
}
|
||
14 years ago
|
// assert(host_part[0] == TQChar('.'));
|
||
15 years ago
|
host_part.remove(0,1); // Chop off the dot.
|
||
|
}
|
||
|
|
||
|
// No domain-specific entry: use global domain
|
||
|
#ifdef DEBUG_SETTINGS
|
||
|
kdDebug() << "no match" << endl;
|
||
|
d->global.dump("global");
|
||
|
#endif
|
||
|
return d->global;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::isOpenMiddleClickEnabled()
|
||
15 years ago
|
{
|
||
|
return d->m_bOpenMiddleClick;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::isBackRightClickEnabled()
|
||
15 years ago
|
{
|
||
|
return d->m_bBackRightClick;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::accessKeysEnabled() const
|
||
15 years ago
|
{
|
||
|
return d->m_accessKeysEnabled;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::isAdFilterEnabled() const
|
||
15 years ago
|
{
|
||
|
return d->m_adFilterEnabled;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::isHideAdsEnabled() const
|
||
15 years ago
|
{
|
||
|
return d->m_hideAdsEnabled;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::isAdFiltered( const TQString &url ) const
|
||
15 years ago
|
{
|
||
|
if (d->m_adFilterEnabled)
|
||
|
{
|
||
|
if (!url.startsWith("data:"))
|
||
|
{
|
||
14 years ago
|
TQValueVector<TQRegExp>::const_iterator it(d->adFilters.constBegin());
|
||
|
TQValueVector<TQRegExp>::const_iterator end(d->adFilters.constEnd());
|
||
15 years ago
|
for (; it != end; ++it)
|
||
|
{
|
||
|
if ((*it).search(url) != -1)
|
||
|
{
|
||
|
kdDebug( 6080 ) << "Filtered: " << url << endl;
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
12 years ago
|
void TDEHTMLSettings::addAdFilter( const TQString &url )
|
||
15 years ago
|
{
|
||
12 years ago
|
TDEConfig config( "tdehtmlrc", false, false );
|
||
15 years ago
|
config.setGroup( "Filter Settings" );
|
||
|
|
||
14 years ago
|
TQRegExp rx;
|
||
15 years ago
|
if (url.length()>2 && url[0]=='/' && url[url.length()-1] == '/')
|
||
|
{
|
||
14 years ago
|
TQString inside = url.mid(1, url.length()-2);
|
||
15 years ago
|
rx.setWildcard(false);
|
||
|
rx.setPattern(inside);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
int left,right;
|
||
|
|
||
|
rx.setWildcard(true);
|
||
|
for (right=url.length(); right>0 && url[right-1]=='*' ; --right);
|
||
|
for (left=0; left<right && url[left]=='*' ; ++left);
|
||
|
|
||
|
rx.setPattern(url.mid(left,right-left));
|
||
|
}
|
||
|
|
||
|
if (rx.isValid())
|
||
|
{
|
||
|
int last=config.readNumEntry("Count",0);
|
||
14 years ago
|
TQString key = "Filter-" + TQString::number(last);
|
||
15 years ago
|
config.writeEntry(key, url);
|
||
|
config.writeEntry("Count",last+1);
|
||
|
config.sync();
|
||
|
|
||
|
d->adFilters.append(rx);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
KMessageBox::error(0,
|
||
|
rx.errorString(),
|
||
|
i18n("Filter error"));
|
||
|
}
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::isJavaEnabled( const TQString& hostname )
|
||
15 years ago
|
{
|
||
|
return lookup_hostname_policy(d,hostname.lower()).m_bEnableJava;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::isJavaScriptEnabled( const TQString& hostname )
|
||
15 years ago
|
{
|
||
|
return lookup_hostname_policy(d,hostname.lower()).m_bEnableJavaScript;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::isJavaScriptDebugEnabled( const TQString& /*hostname*/ )
|
||
15 years ago
|
{
|
||
|
// debug setting is global for now, but could change in the future
|
||
|
return d->m_bEnableJavaScriptDebug;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::isJavaScriptErrorReportingEnabled( const TQString& /*hostname*/ ) const
|
||
15 years ago
|
{
|
||
|
// error reporting setting is global for now, but could change in the future
|
||
|
return d->m_bEnableJavaScriptErrorReporting;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::isPluginsEnabled( const TQString& hostname )
|
||
15 years ago
|
{
|
||
|
return lookup_hostname_policy(d,hostname.lower()).m_bEnablePlugins;
|
||
|
}
|
||
|
|
||
12 years ago
|
TDEHTMLSettings::KJSWindowOpenPolicy TDEHTMLSettings::windowOpenPolicy(
|
||
14 years ago
|
const TQString& hostname) const {
|
||
15 years ago
|
return lookup_hostname_policy(d,hostname.lower()).m_windowOpenPolicy;
|
||
|
}
|
||
|
|
||
12 years ago
|
TDEHTMLSettings::KJSWindowMovePolicy TDEHTMLSettings::windowMovePolicy(
|
||
14 years ago
|
const TQString& hostname) const {
|
||
15 years ago
|
return lookup_hostname_policy(d,hostname.lower()).m_windowMovePolicy;
|
||
|
}
|
||
|
|
||
12 years ago
|
TDEHTMLSettings::KJSWindowResizePolicy TDEHTMLSettings::windowResizePolicy(
|
||
14 years ago
|
const TQString& hostname) const {
|
||
15 years ago
|
return lookup_hostname_policy(d,hostname.lower()).m_windowResizePolicy;
|
||
|
}
|
||
|
|
||
12 years ago
|
TDEHTMLSettings::KJSWindowStatusPolicy TDEHTMLSettings::windowStatusPolicy(
|
||
14 years ago
|
const TQString& hostname) const {
|
||
14 years ago
|
return lookup_hostname_policy(d,hostname.lower()).m_windowStatusPolicy;
|
||
15 years ago
|
}
|
||
|
|
||
12 years ago
|
TDEHTMLSettings::KJSWindowFocusPolicy TDEHTMLSettings::windowFocusPolicy(
|
||
14 years ago
|
const TQString& hostname) const {
|
||
15 years ago
|
return lookup_hostname_policy(d,hostname.lower()).m_windowFocusPolicy;
|
||
|
}
|
||
|
|
||
12 years ago
|
int TDEHTMLSettings::mediumFontSize() const
|
||
15 years ago
|
{
|
||
|
return d->m_fontSize;
|
||
|
}
|
||
|
|
||
12 years ago
|
int TDEHTMLSettings::minFontSize() const
|
||
15 years ago
|
{
|
||
|
return d->m_minFontSize;
|
||
|
}
|
||
|
|
||
12 years ago
|
TQString TDEHTMLSettings::settingsToCSS() const
|
||
15 years ago
|
{
|
||
|
// lets start with the link properties
|
||
14 years ago
|
TQString str = "a:link {\ncolor: ";
|
||
15 years ago
|
str += d->m_linkColor.name();
|
||
|
str += ";";
|
||
|
if(d->m_underlineLink)
|
||
|
str += "\ntext-decoration: underline;";
|
||
|
|
||
|
if( d->m_bChangeCursor )
|
||
|
{
|
||
|
str += "\ncursor: pointer;";
|
||
|
str += "\n}\ninput[type=image] { cursor: pointer;";
|
||
|
}
|
||
|
str += "\n}\n";
|
||
|
str += "a:visited {\ncolor: ";
|
||
|
str += d->m_vLinkColor.name();
|
||
|
str += ";";
|
||
|
if(d->m_underlineLink)
|
||
|
str += "\ntext-decoration: underline;";
|
||
|
|
||
|
if( d->m_bChangeCursor )
|
||
|
str += "\ncursor: pointer;";
|
||
|
str += "\n}\n";
|
||
|
|
||
|
if(d->m_hoverLink)
|
||
|
str += "a:link:hover, a:visited:hover { text-decoration: underline; }\n";
|
||
|
|
||
|
return str;
|
||
|
}
|
||
|
|
||
12 years ago
|
const TQString &TDEHTMLSettings::availableFamilies()
|
||
15 years ago
|
{
|
||
|
if ( !avFamilies ) {
|
||
14 years ago
|
avFamilies = new TQString;
|
||
14 years ago
|
TQFontDatabase db;
|
||
13 years ago
|
TQStringList families = db.families();
|
||
14 years ago
|
TQStringList s;
|
||
|
TQRegExp foundryExp(" \\[.+\\]");
|
||
15 years ago
|
|
||
|
//remove foundry info
|
||
14 years ago
|
TQStringList::Iterator f = families.begin();
|
||
|
const TQStringList::Iterator fEnd = families.end();
|
||
15 years ago
|
|
||
|
for ( ; f != fEnd; ++f ) {
|
||
14 years ago
|
(*f).replace( foundryExp, "");
|
||
13 years ago
|
if (!s.contains(*f))
|
||
15 years ago
|
s << *f;
|
||
|
}
|
||
|
s.sort();
|
||
|
|
||
|
*avFamilies = ',' + s.join(",") + ',';
|
||
|
}
|
||
|
|
||
|
return *avFamilies;
|
||
|
}
|
||
|
|
||
12 years ago
|
TQString TDEHTMLSettings::lookupFont(int i) const
|
||
15 years ago
|
{
|
||
14 years ago
|
TQString font;
|
||
15 years ago
|
if (d->fonts.count() > (uint) i)
|
||
|
font = d->fonts[i];
|
||
|
if (font.isEmpty())
|
||
|
font = d->defaultFonts[i];
|
||
|
return font;
|
||
|
}
|
||
|
|
||
12 years ago
|
TQString TDEHTMLSettings::stdFontName() const
|
||
15 years ago
|
{
|
||
|
return lookupFont(0);
|
||
|
}
|
||
|
|
||
12 years ago
|
TQString TDEHTMLSettings::fixedFontName() const
|
||
15 years ago
|
{
|
||
|
return lookupFont(1);
|
||
|
}
|
||
|
|
||
12 years ago
|
TQString TDEHTMLSettings::serifFontName() const
|
||
15 years ago
|
{
|
||
|
return lookupFont(2);
|
||
|
}
|
||
|
|
||
12 years ago
|
TQString TDEHTMLSettings::sansSerifFontName() const
|
||
15 years ago
|
{
|
||
|
return lookupFont(3);
|
||
|
}
|
||
|
|
||
12 years ago
|
TQString TDEHTMLSettings::cursiveFontName() const
|
||
15 years ago
|
{
|
||
|
return lookupFont(4);
|
||
|
}
|
||
|
|
||
12 years ago
|
TQString TDEHTMLSettings::fantasyFontName() const
|
||
15 years ago
|
{
|
||
|
return lookupFont(5);
|
||
|
}
|
||
|
|
||
12 years ago
|
void TDEHTMLSettings::setStdFontName(const TQString &n)
|
||
15 years ago
|
{
|
||
|
while(d->fonts.count() <= 0)
|
||
14 years ago
|
d->fonts.append(TQString::null);
|
||
15 years ago
|
d->fonts[0] = n;
|
||
|
}
|
||
|
|
||
12 years ago
|
void TDEHTMLSettings::setFixedFontName(const TQString &n)
|
||
15 years ago
|
{
|
||
|
while(d->fonts.count() <= 1)
|
||
14 years ago
|
d->fonts.append(TQString::null);
|
||
15 years ago
|
d->fonts[1] = n;
|
||
|
}
|
||
|
|
||
12 years ago
|
TQString TDEHTMLSettings::userStyleSheet() const
|
||
15 years ago
|
{
|
||
|
return d->m_userSheet;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::isFormCompletionEnabled() const
|
||
15 years ago
|
{
|
||
|
return d->m_formCompletionEnabled;
|
||
|
}
|
||
|
|
||
12 years ago
|
int TDEHTMLSettings::maxFormCompletionItems() const
|
||
15 years ago
|
{
|
||
|
return d->m_maxFormCompletionItems;
|
||
|
}
|
||
|
|
||
12 years ago
|
const TQString &TDEHTMLSettings::encoding() const
|
||
15 years ago
|
{
|
||
|
return d->m_encoding;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::followSystemColors() const
|
||
15 years ago
|
{
|
||
|
return d->m_follow_system_colors;
|
||
|
}
|
||
|
|
||
12 years ago
|
const TQColor& TDEHTMLSettings::textColor() const
|
||
15 years ago
|
{
|
||
|
return d->m_textColor;
|
||
|
}
|
||
|
|
||
12 years ago
|
const TQColor& TDEHTMLSettings::baseColor() const
|
||
15 years ago
|
{
|
||
|
return d->m_baseColor;
|
||
|
}
|
||
|
|
||
12 years ago
|
const TQColor& TDEHTMLSettings::linkColor() const
|
||
15 years ago
|
{
|
||
|
return d->m_linkColor;
|
||
|
}
|
||
|
|
||
12 years ago
|
const TQColor& TDEHTMLSettings::vLinkColor() const
|
||
15 years ago
|
{
|
||
|
return d->m_vLinkColor;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::autoLoadImages() const
|
||
15 years ago
|
{
|
||
|
return d->m_bAutoLoadImages;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::unfinishedImageFrame() const
|
||
15 years ago
|
{
|
||
|
return d->m_bUnfinishedImageFrame;
|
||
|
}
|
||
|
|
||
12 years ago
|
TDEHTMLSettings::KAnimationAdvice TDEHTMLSettings::showAnimations() const
|
||
15 years ago
|
{
|
||
|
return d->m_showAnimations;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::isAutoDelayedActionsEnabled() const
|
||
15 years ago
|
{
|
||
|
return d->m_autoDelayedActionsEnabled;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::jsErrorsEnabled() const
|
||
15 years ago
|
{
|
||
|
return d->m_jsErrorsEnabled;
|
||
|
}
|
||
|
|
||
12 years ago
|
void TDEHTMLSettings::setJSErrorsEnabled(bool enabled)
|
||
15 years ago
|
{
|
||
|
d->m_jsErrorsEnabled = enabled;
|
||
|
// save it
|
||
12 years ago
|
TDEConfig *config = TDEGlobal::config();
|
||
15 years ago
|
config->setGroup("HTML Settings");
|
||
|
config->writeEntry("ReportJSErrors", enabled);
|
||
|
config->sync();
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::allowTabulation() const
|
||
15 years ago
|
{
|
||
|
return d->m_allowTabulation;
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::autoSpellCheck() const
|
||
15 years ago
|
{
|
||
|
return d->m_autoSpellCheck;
|
||
|
}
|
||
|
|
||
12 years ago
|
TQValueList< TQPair< TQString, TQChar > > TDEHTMLSettings::fallbackAccessKeysAssignments() const
|
||
15 years ago
|
{
|
||
|
return d->m_fallbackAccessKeysAssignments;
|
||
|
}
|
||
|
|
||
12 years ago
|
void TDEHTMLSettings::setJSPopupBlockerPassivePopup(bool enabled)
|
||
15 years ago
|
{
|
||
|
d->m_jsPopupBlockerPassivePopup = enabled;
|
||
|
// save it
|
||
12 years ago
|
TDEConfig *config = TDEGlobal::config();
|
||
15 years ago
|
config->setGroup("Java/JavaScript Settings");
|
||
|
config->writeEntry("PopupBlockerPassivePopup", enabled);
|
||
|
config->sync();
|
||
|
}
|
||
|
|
||
12 years ago
|
bool TDEHTMLSettings::jsPopupBlockerPassivePopup() const
|
||
15 years ago
|
{
|
||
|
return d->m_jsPopupBlockerPassivePopup;
|
||
|
}
|