Commit 5fd5a7f5 authored by rjw's avatar rjw

WebKit:

        Changes to support per WebController preferences.

        Reviewed by Maciej and Ken.

        * WebView.subproj/WebController.m:
        (-[WebController setPreferences:]):
        * WebView.subproj/WebControllerPrivate.h:
        * WebView.subproj/WebControllerPrivate.m:
        (-[WebControllerPrivate init]):
        (-[WebControllerPrivate dealloc]):
        (-[WebController _setFormDelegate:]):
        (-[WebController _formDelegate]):
        (-[WebController _settings]):
        (-[WebController _updateWebCoreSettingsFromPreferences:]):
        (-[WebController _releaseUserAgentStrings]):
        (-[WebController _preferencesChangedNotification:]):
        * WebView.subproj/WebFrame.m:
        (-[WebFrame initWithName:webView:controller:]):
        * WebView.subproj/WebPreferences.h:
        * WebView.subproj/WebPreferences.m:
        (-[WebPreferences _postPreferencesChangesNotification]):
        (+[WebPreferences load]):
        (-[WebPreferences _stringValueForKey:]):
        (-[WebPreferences _setStringValue:forKey:]):
        (-[WebPreferences _integerValueForKey:]):
        (-[WebPreferences _setIntegerValue:forKey:]):
        (-[WebPreferences _boolValueForKey:]):
        (-[WebPreferences _setBoolValue:forKey:]):
        (-[WebPreferences standardFontFamily]):
        (-[WebPreferences setStandardFontFamily:]):
        (-[WebPreferences fixedFontFamily]):
        (-[WebPreferences setFixedFontFamily:]):
        (-[WebPreferences serifFontFamily]):
        (-[WebPreferences setSerifFontFamily:]):
        (-[WebPreferences sansSerifFontFamily]):
        (-[WebPreferences setSansSerifFontFamily:]):
        (-[WebPreferences cursiveFontFamily]):
        (-[WebPreferences setCursiveFontFamily:]):
        (-[WebPreferences fantasyFontFamily]):
        (-[WebPreferences setFantasyFontFamily:]):
        (-[WebPreferences defaultFontSize]):
        (-[WebPreferences setDefaultFontSize:]):
        (-[WebPreferences defaultFixedFontSize]):
        (-[WebPreferences setDefaultFixedFontSize:]):
        (-[WebPreferences minimumFontSize]):
        (-[WebPreferences setMinimumFontSize:]):
        (-[WebPreferences defaultTextEncodingName]):
        (-[WebPreferences setDefaultTextEncodingName:]):
        (-[WebPreferences userStyleSheetEnabled]):
        (-[WebPreferences setUserStyleSheetEnabled:]):
        (-[WebPreferences userStyleSheetLocation]):
        (-[WebPreferences setUserStyleSheetLocation:]):
        (-[WebPreferences JavaEnabled]):
        (-[WebPreferences setJavaEnabled:]):
        (-[WebPreferences JavaScriptEnabled]):
        (-[WebPreferences setJavaScriptEnabled:]):
        (-[WebPreferences JavaScriptCanOpenWindowsAutomatically]):
        (-[WebPreferences setJavaScriptCanOpenWindowsAutomatically:]):
        (-[WebPreferences pluginsEnabled]):
        (-[WebPreferences setPluginsEnabled:]):
        (-[WebPreferences allowAnimatedImages]):
        (-[WebPreferences allowAnimatedImageLooping]):
        (-[WebPreferences setAllowAnimatedImageLooping:]):
        (-[WebPreferences setWillLoadImagesAutomatically:]):
        (-[WebPreferences willLoadImagesAutomatically]):
        (-[WebPreferences _initialTimedLayoutDelay]):
        (-[WebPreferences _initialTimedLayoutSize]):
        (-[WebPreferences _pageCacheSize]):
        (-[WebPreferences _objectCacheSize]):
        (-[WebPreferences _initialTimedLayoutEnabled]):
        (-[WebPreferences _resourceTimedLayoutDelay]):
        (-[WebPreferences _resourceTimedLayoutEnabled]):
        * WebView.subproj/WebPreferencesPrivate.h:
WebCore:
        Changes to support per WebController preferences.
        KHTMLPart now always accesses preferences from it's m_setting.
        Changes made to WebPreferences pass to WebCoreSetting to KTMLSettings.
        Added JavaScriptCanOpenWindowsAutomatically to KHTMLSettings.

        Reviewed by Maciej and Ken.

        * khtml/ecma/kjs_window.cpp:
        (WindowFunc::tryCall):
        * khtml/khtml_part.cpp:
        (KHTMLPart::init):
        (KHTMLPart::restoreURL):
        (KHTMLPart::openURL):
        (KHTMLPart::begin):
        (KHTMLPart::reparseConfiguration):
        * khtml/khtmlpart_p.h:
        * kwq/KWQKConfigBase.h:
        * kwq/KWQKConfigBase.mm:
        (KConfig::readUnsignedNumEntry):
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::setSettings):
        * kwq/KWQKHTMLSettings.h:
        * kwq/KWQKHTMLSettings.mm:
        (KHTMLSettings::stdFontName):
        (KHTMLSettings::fixedFontName):
        (KHTMLSettings::serifFontName):
        (KHTMLSettings::sansSerifFontName):
        (KHTMLSettings::cursiveFontName):
        (KHTMLSettings::fantasyFontName):
        (KHTMLSettings::minFontSize):
        (KHTMLSettings::mediumFontSize):
        (KHTMLSettings::mediumFixedFontSize):
        (KHTMLSettings::isJavaEnabled):
        (KHTMLSettings::autoLoadImages):
        (KHTMLSettings::isPluginsEnabled):
        (KHTMLSettings::isJavaScriptEnabled):
        (KHTMLSettings::JavaScriptCanOpenWindowsAutomatically):
        (KHTMLSettings::userStyleSheet):
        (KHTMLSettings::setStdFontName):
        (KHTMLSettings::setFixedFontName):
        (KHTMLSettings::setSerifFontName):
        (KHTMLSettings::setSansSerifFontName):
        (KHTMLSettings::setCursiveFontName):
        (KHTMLSettings::setFantasyFontName):
        (KHTMLSettings::setMinFontSize):
        (KHTMLSettings::setMediumFontSize):
        (KHTMLSettings::setMediumFixedFontSize):
        (KHTMLSettings::setAutoLoadImages):
        (KHTMLSettings::setIsJavaScriptEnabled):
        (KHTMLSettings::setIsJavaEnabled):
        (KHTMLSettings::setArePluginsEnabled):
        (KHTMLSettings::setJavaScriptCanOpenWindowsAutomatically):
        (KHTMLSettings::setUserStyleSheet):
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge init]):
        (-[WebCoreBridge initializeSettings:]):
        * kwq/WebCoreSettings.h:
        * kwq/WebCoreSettings.mm:
        (-[WebCoreSettings dealloc]):
        (-[WebCoreSettings init]):
        (-[WebCoreSettings setStandardFontFamily:]):
        (-[WebCoreSettings setFixedFontFamily:]):
        (-[WebCoreSettings setSerifFontFamily:]):
        (-[WebCoreSettings setSansSerifFontFamily:]):
        (-[WebCoreSettings setCursiveFontFamily:]):
        (-[WebCoreSettings setFantasyFontFamily:]):
        (-[WebCoreSettings setMinimumFontSize:]):
        (-[WebCoreSettings setDefaultFontSize:]):
        (-[WebCoreSettings setDefaultFixedFontSize:]):
        (-[WebCoreSettings setJavaEnabled:]):
        (-[WebCoreSettings setPluginsEnabled:]):
        (-[WebCoreSettings setJavaScriptEnabled:]):
        (-[WebCoreSettings setJavaScriptCanOpenWindowsAutomatically:]):
        (-[WebCoreSettings setWillLoadImagesAutomatically:]):
        (-[WebCoreSettings setUserStyleSheetLocation:]):
        (-[WebCoreSettings userStyleSheetLocation]):
        (-[WebCoreSettings settings]):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3610 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent def5007b
2003-02-07 Richard Williamson <rjw@apple.com>
Changes to support per WebController preferences.
KHTMLPart now always accesses preferences from it's m_setting.
Changes made to WebPreferences pass to WebCoreSetting to KTMLSettings.
Added JavaScriptCanOpenWindowsAutomatically to KHTMLSettings.
Reviewed by Maciej and Ken.
* khtml/ecma/kjs_window.cpp:
(WindowFunc::tryCall):
* khtml/khtml_part.cpp:
(KHTMLPart::init):
(KHTMLPart::restoreURL):
(KHTMLPart::openURL):
(KHTMLPart::begin):
(KHTMLPart::reparseConfiguration):
* khtml/khtmlpart_p.h:
* kwq/KWQKConfigBase.h:
* kwq/KWQKConfigBase.mm:
(KConfig::readUnsignedNumEntry):
* kwq/KWQKHTMLPart.h:
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::setSettings):
* kwq/KWQKHTMLSettings.h:
* kwq/KWQKHTMLSettings.mm:
(KHTMLSettings::stdFontName):
(KHTMLSettings::fixedFontName):
(KHTMLSettings::serifFontName):
(KHTMLSettings::sansSerifFontName):
(KHTMLSettings::cursiveFontName):
(KHTMLSettings::fantasyFontName):
(KHTMLSettings::minFontSize):
(KHTMLSettings::mediumFontSize):
(KHTMLSettings::mediumFixedFontSize):
(KHTMLSettings::isJavaEnabled):
(KHTMLSettings::autoLoadImages):
(KHTMLSettings::isPluginsEnabled):
(KHTMLSettings::isJavaScriptEnabled):
(KHTMLSettings::JavaScriptCanOpenWindowsAutomatically):
(KHTMLSettings::userStyleSheet):
(KHTMLSettings::setStdFontName):
(KHTMLSettings::setFixedFontName):
(KHTMLSettings::setSerifFontName):
(KHTMLSettings::setSansSerifFontName):
(KHTMLSettings::setCursiveFontName):
(KHTMLSettings::setFantasyFontName):
(KHTMLSettings::setMinFontSize):
(KHTMLSettings::setMediumFontSize):
(KHTMLSettings::setMediumFixedFontSize):
(KHTMLSettings::setAutoLoadImages):
(KHTMLSettings::setIsJavaScriptEnabled):
(KHTMLSettings::setIsJavaEnabled):
(KHTMLSettings::setArePluginsEnabled):
(KHTMLSettings::setJavaScriptCanOpenWindowsAutomatically):
(KHTMLSettings::setUserStyleSheet):
* kwq/WebCoreBridge.h:
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge init]):
(-[WebCoreBridge initializeSettings:]):
* kwq/WebCoreSettings.h:
* kwq/WebCoreSettings.mm:
(-[WebCoreSettings dealloc]):
(-[WebCoreSettings init]):
(-[WebCoreSettings setStandardFontFamily:]):
(-[WebCoreSettings setFixedFontFamily:]):
(-[WebCoreSettings setSerifFontFamily:]):
(-[WebCoreSettings setSansSerifFontFamily:]):
(-[WebCoreSettings setCursiveFontFamily:]):
(-[WebCoreSettings setFantasyFontFamily:]):
(-[WebCoreSettings setMinimumFontSize:]):
(-[WebCoreSettings setDefaultFontSize:]):
(-[WebCoreSettings setDefaultFixedFontSize:]):
(-[WebCoreSettings setJavaEnabled:]):
(-[WebCoreSettings setPluginsEnabled:]):
(-[WebCoreSettings setJavaScriptEnabled:]):
(-[WebCoreSettings setJavaScriptCanOpenWindowsAutomatically:]):
(-[WebCoreSettings setWillLoadImagesAutomatically:]):
(-[WebCoreSettings setUserStyleSheetLocation:]):
(-[WebCoreSettings userStyleSheetLocation]):
(-[WebCoreSettings settings]):
2003-02-07 Darin Adler <darin@apple.com>
* khtml/rendering/render_table.h: Added copyright date.
......
2003-02-07 Richard Williamson <rjw@apple.com>
Changes to support per WebController preferences.
KHTMLPart now always accesses preferences from it's m_setting.
Changes made to WebPreferences pass to WebCoreSetting to KTMLSettings.
Added JavaScriptCanOpenWindowsAutomatically to KHTMLSettings.
Reviewed by Maciej and Ken.
* khtml/ecma/kjs_window.cpp:
(WindowFunc::tryCall):
* khtml/khtml_part.cpp:
(KHTMLPart::init):
(KHTMLPart::restoreURL):
(KHTMLPart::openURL):
(KHTMLPart::begin):
(KHTMLPart::reparseConfiguration):
* khtml/khtmlpart_p.h:
* kwq/KWQKConfigBase.h:
* kwq/KWQKConfigBase.mm:
(KConfig::readUnsignedNumEntry):
* kwq/KWQKHTMLPart.h:
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::setSettings):
* kwq/KWQKHTMLSettings.h:
* kwq/KWQKHTMLSettings.mm:
(KHTMLSettings::stdFontName):
(KHTMLSettings::fixedFontName):
(KHTMLSettings::serifFontName):
(KHTMLSettings::sansSerifFontName):
(KHTMLSettings::cursiveFontName):
(KHTMLSettings::fantasyFontName):
(KHTMLSettings::minFontSize):
(KHTMLSettings::mediumFontSize):
(KHTMLSettings::mediumFixedFontSize):
(KHTMLSettings::isJavaEnabled):
(KHTMLSettings::autoLoadImages):
(KHTMLSettings::isPluginsEnabled):
(KHTMLSettings::isJavaScriptEnabled):
(KHTMLSettings::JavaScriptCanOpenWindowsAutomatically):
(KHTMLSettings::userStyleSheet):
(KHTMLSettings::setStdFontName):
(KHTMLSettings::setFixedFontName):
(KHTMLSettings::setSerifFontName):
(KHTMLSettings::setSansSerifFontName):
(KHTMLSettings::setCursiveFontName):
(KHTMLSettings::setFantasyFontName):
(KHTMLSettings::setMinFontSize):
(KHTMLSettings::setMediumFontSize):
(KHTMLSettings::setMediumFixedFontSize):
(KHTMLSettings::setAutoLoadImages):
(KHTMLSettings::setIsJavaScriptEnabled):
(KHTMLSettings::setIsJavaEnabled):
(KHTMLSettings::setArePluginsEnabled):
(KHTMLSettings::setJavaScriptCanOpenWindowsAutomatically):
(KHTMLSettings::setUserStyleSheet):
* kwq/WebCoreBridge.h:
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge init]):
(-[WebCoreBridge initializeSettings:]):
* kwq/WebCoreSettings.h:
* kwq/WebCoreSettings.mm:
(-[WebCoreSettings dealloc]):
(-[WebCoreSettings init]):
(-[WebCoreSettings setStandardFontFamily:]):
(-[WebCoreSettings setFixedFontFamily:]):
(-[WebCoreSettings setSerifFontFamily:]):
(-[WebCoreSettings setSansSerifFontFamily:]):
(-[WebCoreSettings setCursiveFontFamily:]):
(-[WebCoreSettings setFantasyFontFamily:]):
(-[WebCoreSettings setMinimumFontSize:]):
(-[WebCoreSettings setDefaultFontSize:]):
(-[WebCoreSettings setDefaultFixedFontSize:]):
(-[WebCoreSettings setJavaEnabled:]):
(-[WebCoreSettings setPluginsEnabled:]):
(-[WebCoreSettings setJavaScriptEnabled:]):
(-[WebCoreSettings setJavaScriptCanOpenWindowsAutomatically:]):
(-[WebCoreSettings setWillLoadImagesAutomatically:]):
(-[WebCoreSettings setUserStyleSheetLocation:]):
(-[WebCoreSettings userStyleSheetLocation]):
(-[WebCoreSettings settings]):
2003-02-07 Darin Adler <darin@apple.com>
* khtml/rendering/render_table.h: Added copyright date.
......
......@@ -36,6 +36,7 @@
#if APPLE_CHANGES
#include "KWQLogging.h"
#include "KWQKConfigBase.h"
#endif
#include <kjs/collector.h>
#include "kjs_proxy.h"
......@@ -1087,7 +1088,11 @@ Value WindowFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
{
KConfig *config = new KConfig("konquerorrc");
config->setGroup("Java/JavaScript Settings");
#if !APPLE_CHANGES
int policy = config->readUnsignedNumEntry( "WindowOpenPolicy", 0 ); // 0=allow, 1=ask, 2=deny, 3=smart
#else
int policy = config->readUnsignedNumEntry( part->settings(), "WindowOpenPolicy", 0 ); // 0=allow, 1=ask, 2=deny, 3=smart
#endif
delete config;
if ( policy == 1 ) {
#if !APPLE_CHANGES
......
......@@ -222,11 +222,16 @@ void KHTMLPart::init( KHTMLView *view, GUIProfile prof )
d->m_paSelectAll->setShortcut( KShortcut() ); // avoid clashes
#endif
#if !APPLE_CHANGES
// set the default java(script) flags according to the current host.
d->m_bJScriptEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaScriptEnabled();
d->m_bJScriptDebugEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaScriptDebugEnabled();
d->m_bJavaEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaEnabled();
d->m_bPluginsEnabled = KHTMLFactory::defaultHTMLSettings()->isPluginsEnabled();
#else
// The java, javascript, and plugin settings will be set after the settings
// have been initialized.
#endif
#if !APPLE_CHANGES
connect( this, SIGNAL( completed() ),
......@@ -324,10 +329,17 @@ bool KHTMLPart::restoreURL( const KURL &url )
d->m_workingURL = url;
// set the java(script) flags according to the current host.
#if !APPLE_CHANGES
d->m_bJScriptEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaScriptEnabled(url.host());
d->m_bJScriptDebugEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaScriptDebugEnabled();
d->m_bJavaEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaEnabled(url.host());
d->m_bPluginsEnabled = KHTMLFactory::defaultHTMLSettings()->isPluginsEnabled(url.host());
#else
d->m_bJScriptEnabled = d->m_settings->isJavaScriptEnabled(url.host());
d->m_bJScriptDebugEnabled = d->m_settings->isJavaScriptDebugEnabled();
d->m_bJavaEnabled = d->m_settings->isJavaEnabled(url.host());
d->m_bPluginsEnabled = d->m_settings->isPluginsEnabled(url.host());
#endif
m_url = url;
......@@ -463,9 +475,15 @@ bool KHTMLPart::openURL( const KURL &url )
}
// set the javascript flags according to the current url
#if !APPLE_CHANGES
d->m_bJScriptDebugEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaScriptDebugEnabled();
d->m_bJavaEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaEnabled(url.host());
d->m_bPluginsEnabled = KHTMLFactory::defaultHTMLSettings()->isPluginsEnabled(url.host());
#else
d->m_bJScriptDebugEnabled = d->m_settings->isJavaScriptDebugEnabled();
d->m_bJavaEnabled = d->m_settings->isJavaEnabled(url.host());
d->m_bPluginsEnabled = d->m_settings->isPluginsEnabled(url.host());
#endif
// initializing m_url to the new url breaks relative links when opening such a link after this call and _before_ begin() is called (when the first
// data arrives) (Simon)
......@@ -1328,7 +1346,11 @@ void KHTMLPart::begin( const KURL &url, int xOffset, int yOffset )
// Only do this after clearing the part, so that JavaScript can
// clean up properly if it was on for the last load.
#if !APPLE_CHANGES
d->m_bJScriptEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaScriptEnabled(url.host());
#else
d->m_bJScriptEnabled = d->m_settings->isJavaScriptEnabled(url.host());
#endif
d->m_bCleared = false;
d->m_cacheId = 0;
......@@ -1395,7 +1417,11 @@ void KHTMLPart::begin( const KURL &url, int xOffset, int yOffset )
// We prefer m_baseURL over m_url because m_url changes when we are
// about to load a new page.
d->m_doc->setBaseURL( baseurl.url() );
#if !APPLE_CHANGES
d->m_doc->docLoader()->setShowAnimations( KHTMLFactory::defaultHTMLSettings()->showAnimations() );
#else
d->m_doc->docLoader()->setShowAnimations( d->m_settings->showAnimations() );
#endif
#if APPLE_CHANGES
KWQ(this)->updatePolicyBaseURL();
......@@ -1406,8 +1432,14 @@ void KHTMLPart::begin( const KURL &url, int xOffset, int yOffset )
d->m_paUseStylesheet->setEnabled( false );
#endif
#if !APPLE_CHANGES
setAutoloadImages( KHTMLFactory::defaultHTMLSettings()->autoLoadImages() );
QString userStyleSheet = KHTMLFactory::defaultHTMLSettings()->userStyleSheet();
#else
setAutoloadImages( d->m_settings->autoLoadImages() );
QString userStyleSheet = d->m_settings->userStyleSheet();
#endif
if ( !userStyleSheet.isEmpty() )
setUserStyleSheet( KURL( userStyleSheet ) );
......@@ -3874,9 +3906,7 @@ void KHTMLPart::slotLoadImages()
void KHTMLPart::reparseConfiguration()
{
KHTMLSettings *settings = KHTMLFactory::defaultHTMLSettings();
settings->init();
#if !APPLE_CHANGES
setAutoloadImages( settings->autoLoadImages() );
if (d->m_doc)
d->m_doc->docLoader()->setShowAnimations( settings->showAnimations() );
......@@ -3889,6 +3919,18 @@ void KHTMLPart::reparseConfiguration()
d->m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings());
QString userStyleSheet = KHTMLFactory::defaultHTMLSettings()->userStyleSheet();
#else
setAutoloadImages( d->m_settings->autoLoadImages() );
if (d->m_doc)
d->m_doc->docLoader()->setShowAnimations( d->m_settings->showAnimations() );
d->m_bJScriptEnabled = d->m_settings->isJavaScriptEnabled(m_url.host());
d->m_bJScriptDebugEnabled = d->m_settings->isJavaScriptDebugEnabled();
d->m_bJavaEnabled = d->m_settings->isJavaEnabled(m_url.host());
d->m_bPluginsEnabled = d->m_settings->isPluginsEnabled(m_url.host());
QString userStyleSheet = d->m_settings->userStyleSheet();
#endif
if ( !userStyleSheet.isEmpty() )
setUserStyleSheet( KURL( userStyleSheet ) );
else
......
......@@ -109,7 +109,9 @@ public:
m_bUnloadEventEmitted = true;
m_cachePolicy = KIO::CC_Verify;
m_manager = 0L;
#if !APPLE_CHANGES
m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings());
#endif
m_bClearing = false;
m_bCleared = false;
m_zoomFactor = 100;
......@@ -183,7 +185,9 @@ public:
{
delete m_dcopobject;
delete m_extension;
#if !APPLE_CHANGES
delete m_settings;
#endif
delete m_jscript;
if ( m_kjs_lib)
m_kjs_lib->unload();
......
......@@ -27,6 +27,9 @@
#define KCONFIG_H_
#include "KWQString.h"
#if APPLE_CHANGES
#include "KWQKHTMLSettings.h"
#endif
class QColor;
class QStringList;
......@@ -44,7 +47,7 @@ public:
QString readEntry(const char *pKey, const QString& aDefault=QString::null) const;
int readNumEntry(const char *pKey, int nDefault=0) const;
unsigned int readUnsignedNumEntry(const char *pKey, unsigned int nDefault=0) const;
unsigned int readUnsignedNumEntry(const KHTMLSettings *settings, const char *pKey, unsigned int nDefault=0) const;
bool readBoolEntry(const char *pKey, bool nDefault=0) const;
......
......@@ -27,6 +27,7 @@
#import "KWQLogging.h"
#import "KWQColor.h"
#import "KWQKHTMLSettings.h"
#import "KWQStringList.h"
#import "WebCoreSettings.h"
#import "WebCoreViewFactory.h"
......@@ -112,10 +113,10 @@ int KConfig::readNumEntry(const char *pKey, int nDefault) const
return nDefault;
}
unsigned int KConfig::readUnsignedNumEntry(const char *pKey, unsigned int nDefault) const
unsigned int KConfig::readUnsignedNumEntry(const KHTMLSettings *settings, const char *pKey, unsigned int nDefault) const
{
if (impl->isKonquerorRC && strcmp(pKey, "WindowOpenPolicy") == 0) {
if ([[WebCoreSettings sharedSettings] JavaScriptCanOpenWindowsAutomatically]) {
if (settings->JavaScriptCanOpenWindowsAutomatically()) {
return 0;
} else {
return 3;
......
......@@ -176,6 +176,8 @@ public:
void clearRecordedFormValues();
void recordFormValue(const QString &name, const QString &value);
void setSettings (KHTMLSettings *s);
private:
virtual void khtmlMousePressEvent(khtml::MousePressEvent *);
virtual void khtmlMouseDoubleClickEvent(khtml::MouseDoubleClickEvent *);
......
......@@ -148,6 +148,11 @@ KWQKHTMLPart::~KWQKHTMLPart()
[_formValues release];
}
void KWQKHTMLPart::setSettings (KHTMLSettings *settings)
{
d->m_settings = settings;
}
WebCoreBridge *KWQKHTMLPart::bridgeForFrameName(const QString &frameName)
{
WebCoreBridge *frame;
......
......@@ -40,59 +40,81 @@ public:
KAnimationEnabled
};
static void init() { }
KHTMLSettings() {};
// Font settings
static const QString &stdFontName();
static const QString &fixedFontName();
static const QString &serifFontName();
static const QString &sansSerifFontName();
static const QString &cursiveFontName();
static const QString &fantasyFontName();
const QString &stdFontName() const;
const QString &fixedFontName() const;
const QString &serifFontName() const;
const QString &sansSerifFontName() const;
const QString &cursiveFontName() const;
const QString &fantasyFontName() const;
static const QString &settingsToCSS() { return QString::null; }
static const QString &encoding();
static int minFontSize();
static int mediumFontSize();
static int mediumFixedFontSize();
int minFontSize() const;
int mediumFontSize() const;
int mediumFixedFontSize() const;
static bool changeCursor() { return true; }
static bool isFormCompletionEnabled() { return false; }
static int maxFormCompletionItems() { return 0; }
static bool autoLoadImages();
bool autoLoadImages() const;
static KAnimationAdvice showAnimations() { return KAnimationEnabled; }
static bool isJavaScriptEnabled();
static bool isJavaScriptEnabled(const QString &host) { return isJavaScriptEnabled(); }
static bool isJavaScriptDebugEnabled() { return false; }
static bool isJavaEnabled();
static bool isJavaEnabled(const QString &host) { return isJavaEnabled(); }
static bool isPluginsEnabled();
static bool isPluginsEnabled(const QString &host) { return isPluginsEnabled(); }
bool isJavaScriptEnabled() const;
bool JavaScriptCanOpenWindowsAutomatically() const;
bool isJavaScriptEnabled(const QString &host) const { return isJavaScriptEnabled(); }
bool isJavaScriptDebugEnabled() const { return false; }
bool isJavaEnabled() const;
bool isJavaEnabled(const QString &host) const { return isJavaEnabled(); }
bool isPluginsEnabled() const;
bool isPluginsEnabled(const QString &host) const { return isPluginsEnabled(); }
static const QString &userStyleSheet();
const QString &userStyleSheet();
static void setStdFontName(const QString &);
static void setFixedFontName(const QString &);
static void setSerifFontName(const QString &);
static void setSansSerifFontName(const QString &);
static void setCursiveFontName(const QString &);
static void setFantasyFontName(const QString &);
void setStdFontName(const QString &);
void setFixedFontName(const QString &);
void setSerifFontName(const QString &);
void setSansSerifFontName(const QString &);
void setCursiveFontName(const QString &);
void setFantasyFontName(const QString &);
static void setMinFontSize(int);
static void setMediumFontSize(int);
static void setMediumFixedFontSize(int);
void setMinFontSize(int);
void setMediumFontSize(int);
void setMediumFixedFontSize(int);
static void setAutoLoadImages(bool);
static void setIsJavaScriptEnabled(bool);
static void setIsJavaEnabled(bool);
static void setArePluginsEnabled(bool);
void setAutoLoadImages(bool);
void setIsJavaScriptEnabled(bool);
void setIsJavaEnabled(bool);
void setArePluginsEnabled(bool);
void setJavaScriptCanOpenWindowsAutomatically(bool);
void setUserStyleSheet(const QString &);
static void setUserStyleSheet(const QString &);
private:
QString _stdFontName;
QString _fixedFontName;
QString _serifFontName;
QString _sansSerifFontName;
QString _cursiveFontName;
QString _fantasyFontName;
QString _encoding;
QString _userStyleSheetLocation;
int _minimumFontSize;
int _defaultFontSize;
int _defaultFixedFontSize;
uint _JavaEnabled:1;
uint _willLoadImagesAutomatically:1;
uint _pluginsEnabled:1;
uint _JavaScriptEnabled:1;
uint _JavaScriptCanOpenWindowsAutomatically:1;
};
#endif
......@@ -25,48 +25,34 @@
#import "KWQKHTMLSettings.h"
static int minimumFontSize;
static int defaultFontSize;
static int defaultFixedFontSize;
static bool JavaEnabled;
static bool willLoadImagesAutomatically;
static bool pluginsEnabled;
static bool JavaScriptEnabled;
const QString &KHTMLSettings::stdFontName()
const QString &KHTMLSettings::stdFontName() const
{
static QString name;
return name;
return _stdFontName;
}
const QString &KHTMLSettings::fixedFontName()
const QString &KHTMLSettings::fixedFontName() const
{
static QString name;
return name;
return _fixedFontName;
}
const QString &KHTMLSettings::serifFontName()
const QString &KHTMLSettings::serifFontName() const
{
static QString name;
return name;
return _fixedFontName;
}
const QString &KHTMLSettings::sansSerifFontName()
const QString &KHTMLSettings::sansSerifFontName() const
{
static QString name;
return name;
return _sansSerifFontName;
}
const QString &KHTMLSettings::cursiveFontName()
const QString &KHTMLSettings::cursiveFontName() const
{
static QString name;
return name;
return _cursiveFontName;
}
const QString &KHTMLSettings::fantasyFontName()
const QString &KHTMLSettings::fantasyFontName() const
{
static QString name;
return name;
return _fantasyFontName;
}
const QString &KHTMLSettings::encoding()
......@@ -75,113 +61,122 @@ const QString &KHTMLSettings::encoding()
return latin1;
}
int KHTMLSettings::minFontSize()
int KHTMLSettings::minFontSize() const
{
return _minimumFontSize;
}
int KHTMLSettings::mediumFontSize() const
{
return minimumFontSize;
return _defaultFontSize;
}
int KHTMLSettings::mediumFontSize()
int KHTMLSettings::mediumFixedFontSize() const
{
return defaultFontSize;
return _defaultFixedFontSize;
}
int KHTMLSettings::mediumFixedFontSize()
bool KHTMLSettings::isJavaEnabled() const
{
return defaultFixedFontSize;
return _JavaEnabled;
}
bool KHTMLSettings::isJavaEnabled()
bool KHTMLSettings::autoLoadImages() const
{
return JavaEnabled;
return _willLoadImagesAutomatically;
}
bool KHTMLSettings::autoLoadImages()
bool KHTMLSettings::isPluginsEnabled() const
{
return willLoadImagesAutomatically;
return _pluginsEnabled;
}
bool KHTMLSettings::isPluginsEnabled()
bool KHTMLSettings::isJavaScriptEnabled() const
{
return pluginsEnabled;
return _JavaScriptEnabled;
}
bool KHTMLSettings::isJavaScriptEnabled()
bool KHTMLSettings::JavaScriptCanOpenWindowsAutomatically() const
{
return JavaScriptEnabled;
return _JavaScriptCanOpenWindowsAutomatically;
}
const QString &KHTMLSettings::userStyleSheet()
{
static QString location;
return location;