mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
Clean the unused code
Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
parent
942608b780
commit
5032c504fb
|
@ -155,12 +155,12 @@ QHash<QWebEngineSettings::WebAttribute, bool> SiteSettingsManager::getWebAttribu
|
||||||
|
|
||||||
void SiteSettingsManager::setJavascript(const QUrl& url, const int value)
|
void SiteSettingsManager::setJavascript(const QUrl& url, const int value)
|
||||||
{
|
{
|
||||||
setOption(poJavascriptEnabled, url, value);
|
setOption(QWebEngineSettings::JavascriptEnabled, url, intToPermission(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SiteSettingsManager::setImages(const QUrl& url, const int value)
|
void SiteSettingsManager::setImages(const QUrl& url, const int value)
|
||||||
{
|
{
|
||||||
setOption(poAutoloadImages, url, value);
|
setOption(QWebEngineSettings::AutoLoadImages, url, intToPermission(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SiteSettingsManager::setOption(const QString& column, const QUrl& url, const int value)
|
void SiteSettingsManager::setOption(const QString& column, const QUrl& url, const int value)
|
||||||
|
@ -193,6 +193,11 @@ void SiteSettingsManager::setOption(const QWebEnginePage::Feature& feature, cons
|
||||||
setOption(featureToSqlColumn(feature), url, value);
|
setOption(featureToSqlColumn(feature), url, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SiteSettingsManager::setOption(const QWebEngineSettings::WebAttribute& attribute, const QUrl& url, const SiteSettingsManager::Permission& value)
|
||||||
|
{
|
||||||
|
setOption(webAttributeToSqlColumn(attribute), url, value);
|
||||||
|
}
|
||||||
|
|
||||||
SiteSettingsManager::Permission SiteSettingsManager::getPermission(const QString &column, const QUrl& url)
|
SiteSettingsManager::Permission SiteSettingsManager::getPermission(const QString &column, const QUrl& url)
|
||||||
{
|
{
|
||||||
if (column.isEmpty()) {
|
if (column.isEmpty()) {
|
||||||
|
@ -231,30 +236,10 @@ SiteSettingsManager::Permission SiteSettingsManager::getPermission(const QWebEng
|
||||||
QString SiteSettingsManager::optionToSqlColumn(const SiteSettingsManager::PageOptions &option)
|
QString SiteSettingsManager::optionToSqlColumn(const SiteSettingsManager::PageOptions &option)
|
||||||
{
|
{
|
||||||
switch (option) {
|
switch (option) {
|
||||||
case poJavascriptEnabled:
|
|
||||||
return QSL("wa_js_enabled");
|
|
||||||
case poAutoloadImages:
|
|
||||||
return QSL("wa_autoload_images");
|
|
||||||
case poAllowCookies:
|
case poAllowCookies:
|
||||||
return QSL("allow_cookies");
|
return QSL("allow_cookies");
|
||||||
case poZoomLevel:
|
case poZoomLevel:
|
||||||
return QSL("zoom_level");
|
return QSL("zoom_level");
|
||||||
case poAllowNotifications:
|
|
||||||
return QSL("f_notifications");
|
|
||||||
case poAllowGeolocation:
|
|
||||||
return QSL("f_geolocation");
|
|
||||||
case poAllowMediaAudioCapture:
|
|
||||||
return QSL("f_media_audio_capture");
|
|
||||||
case poAllowMediaVideoCapture:
|
|
||||||
return QSL("f_media_video_capture");
|
|
||||||
case poAllowMediaAudioVideoCapture:
|
|
||||||
return QSL("f_media_audio_video_capture");
|
|
||||||
case poAllowMouseLock:
|
|
||||||
return QSL("f_mouse_lock");
|
|
||||||
case poAllowDesktopVideoCapture:
|
|
||||||
return QSL("f_desktop_video_capture");
|
|
||||||
case poAllowDesktopAudioVideoCapture:
|
|
||||||
return QSL("f_desktop_audio_video_capture");
|
|
||||||
default:
|
default:
|
||||||
qWarning() << "Unknown option:" << option;
|
qWarning() << "Unknown option:" << option;
|
||||||
return QLatin1String("");
|
return QLatin1String("");
|
||||||
|
@ -264,11 +249,6 @@ QString SiteSettingsManager::optionToSqlColumn(const SiteSettingsManager::PageOp
|
||||||
SiteSettingsManager::Permission SiteSettingsManager::getDefaultPermission(const SiteSettingsManager::PageOptions& option)
|
SiteSettingsManager::Permission SiteSettingsManager::getDefaultPermission(const SiteSettingsManager::PageOptions& option)
|
||||||
{
|
{
|
||||||
switch (option) {
|
switch (option) {
|
||||||
case poJavascriptEnabled:
|
|
||||||
return testAttribute(QWebEngineSettings::JavascriptEnabled);
|
|
||||||
case poAutoloadImages:
|
|
||||||
return testAttribute(QWebEngineSettings::AutoLoadImages);
|
|
||||||
|
|
||||||
// so far not implemented
|
// so far not implemented
|
||||||
case poZoomLevel:
|
case poZoomLevel:
|
||||||
case poAllowCookies:
|
case poAllowCookies:
|
||||||
|
@ -360,30 +340,10 @@ SiteSettingsManager::Permission SiteSettingsManager::intToPermission(const int p
|
||||||
QString SiteSettingsManager::getOptionName(const SiteSettingsManager::PageOptions& option)
|
QString SiteSettingsManager::getOptionName(const SiteSettingsManager::PageOptions& option)
|
||||||
{
|
{
|
||||||
switch (option) {
|
switch (option) {
|
||||||
case poJavascriptEnabled:
|
|
||||||
return QSL("JavaScript");
|
|
||||||
case poAutoloadImages:
|
|
||||||
return QSL("Autoload Images");
|
|
||||||
case poZoomLevel:
|
case poZoomLevel:
|
||||||
return QSL("Zoom level");
|
return QSL("Zoom level");
|
||||||
case poAllowCookies:
|
case poAllowCookies:
|
||||||
return QSL("Cookies");
|
return QSL("Cookies");
|
||||||
case poAllowNotifications:
|
|
||||||
return QSL("Notifications");
|
|
||||||
case poAllowGeolocation:
|
|
||||||
return QSL("Geolocation");
|
|
||||||
case poAllowMediaAudioCapture:
|
|
||||||
return QSL("Microphone");
|
|
||||||
case poAllowMediaVideoCapture:
|
|
||||||
return QSL("Camera");
|
|
||||||
case poAllowMediaAudioVideoCapture:
|
|
||||||
return QSL("Microphone and Camera");
|
|
||||||
case poAllowMouseLock:
|
|
||||||
return QSL("Hide mouse pointer");
|
|
||||||
case poAllowDesktopVideoCapture:
|
|
||||||
return QSL("Screen capture");
|
|
||||||
case poAllowDesktopAudioVideoCapture:
|
|
||||||
return QSL("Screen capture with audio");
|
|
||||||
default:
|
default:
|
||||||
qWarning() << "Unknown option:" << option;
|
qWarning() << "Unknown option:" << option;
|
||||||
return QSL("Unknown");;
|
return QSL("Unknown");;
|
||||||
|
|
|
@ -38,36 +38,10 @@ public:
|
||||||
};
|
};
|
||||||
Q_ENUM(Permission);
|
Q_ENUM(Permission);
|
||||||
|
|
||||||
/* Keep the attributes at the top */
|
/* Broser options */
|
||||||
enum PageOptions {
|
enum PageOptions {
|
||||||
poAutoloadImages,
|
|
||||||
|
|
||||||
/* Javascript stuff */
|
|
||||||
poJavascriptEnabled,
|
|
||||||
poJavascriptCanOpenWindows,
|
|
||||||
poJavascriptCanAccessClipboard,
|
|
||||||
poJavascriptCanPaste,
|
|
||||||
poAllowWindowActivationFromJavaScript,
|
|
||||||
|
|
||||||
poLocalStorageEnabled,
|
|
||||||
poScrollAnimatorEnabled,
|
|
||||||
poFullScreenSupportEnabled,
|
|
||||||
poAllowRunningInsecureContent,
|
|
||||||
poAllowGeolocationOnInsecureOrigins,
|
|
||||||
poPlaybackRequiresUserGesture,
|
|
||||||
poWebRTCPublicInterfacesOnly,
|
|
||||||
|
|
||||||
poAllowCookies,
|
poAllowCookies,
|
||||||
poZoomLevel,
|
poZoomLevel,
|
||||||
|
|
||||||
poAllowNotifications,
|
|
||||||
poAllowGeolocation,
|
|
||||||
poAllowMediaAudioCapture,
|
|
||||||
poAllowMediaVideoCapture,
|
|
||||||
poAllowMediaAudioVideoCapture,
|
|
||||||
poAllowMouseLock,
|
|
||||||
poAllowDesktopVideoCapture,
|
|
||||||
poAllowDesktopAudioVideoCapture,
|
|
||||||
};
|
};
|
||||||
Q_ENUM(PageOptions);
|
Q_ENUM(PageOptions);
|
||||||
|
|
||||||
|
@ -99,6 +73,7 @@ public:
|
||||||
void setOption(const QString &column, const QUrl &url, const int value);
|
void setOption(const QString &column, const QUrl &url, const int value);
|
||||||
void setOption(const PageOptions option, const QUrl &url, const int value);
|
void setOption(const PageOptions option, const QUrl &url, const int value);
|
||||||
void setOption(const QWebEnginePage::Feature &feature, const QUrl &url, const Permission &value);
|
void setOption(const QWebEnginePage::Feature &feature, const QUrl &url, const Permission &value);
|
||||||
|
void setOption(const QWebEngineSettings::WebAttribute &attribute, const QUrl &url, const Permission &value);
|
||||||
|
|
||||||
Permission getDefaultPermission(const PageOptions &option);
|
Permission getDefaultPermission(const PageOptions &option);
|
||||||
Permission getDefaultPermission(const QWebEnginePage::Feature &feature);
|
Permission getDefaultPermission(const QWebEnginePage::Feature &feature);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user