1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Fixed text in locationbar on HTTPS sites when using dark theme.

- added WheelEvent as another event in Plugin API
This commit is contained in:
nowrep 2012-03-07 12:19:08 +01:00
parent 5ea084c09d
commit b5db8a21c9
6 changed files with 43 additions and 8 deletions

View File

@ -117,6 +117,7 @@
#locationbar[secured="true"] #locationbar[secured="true"]
{ {
color: black;
background-color: #ffffbc; background-color: #ffffbc;
} }

View File

@ -72,6 +72,8 @@ public:
virtual bool mouseRelease(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; } virtual bool mouseRelease(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
virtual bool mouseMove(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; } virtual bool mouseMove(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
virtual bool wheelEvent(const Qz::ObjectName &type, QObject* obj, QWheelEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
virtual bool keyPress(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; } virtual bool keyPress(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
virtual bool keyRelease(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; } virtual bool keyRelease(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event) { Q_UNUSED(type) Q_UNUSED(obj) Q_UNUSED(event) return false; }
}; };

View File

@ -78,6 +78,12 @@ void PluginProxy::registerAppEventHandler(const PluginProxy::EventHandlerType &t
} }
break; break;
case WheelEventHandler:
if (!m_wheelEventHandlers.contains(obj)) {
m_wheelEventHandlers.append(obj);
}
break;
default: default:
qWarning("PluginProxy::registerAppEventHandler registering unknown event handler type"); qWarning("PluginProxy::registerAppEventHandler registering unknown event handler type");
break; break;
@ -154,6 +160,19 @@ bool PluginProxy::processMouseMove(const Qz::ObjectName &type, QObject* obj, QMo
return accepted; return accepted;
} }
bool PluginProxy::processWheelEvent(const Qz::ObjectName &type, QObject *obj, QWheelEvent *event)
{
bool accepted = false;
foreach(PluginInterface * iPlugin, m_wheelEventHandlers) {
if (iPlugin->wheelEvent(type, obj, event)) {
accepted = true;
}
}
return accepted;
}
bool PluginProxy::processKeyPress(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event) bool PluginProxy::processKeyPress(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event)
{ {
bool accepted = false; bool accepted = false;

View File

@ -26,7 +26,9 @@ class QT_QUPZILLA_EXPORT PluginProxy : public Plugins
{ {
Q_OBJECT Q_OBJECT
public: public:
enum EventHandlerType { MouseDoubleClickHandler, MousePressHandler, MouseReleaseHandler, MouseMoveHandler, KeyPressHandler, KeyReleaseHandler }; enum EventHandlerType { MouseDoubleClickHandler, MousePressHandler, MouseReleaseHandler,
MouseMoveHandler, KeyPressHandler, KeyReleaseHandler,
WheelEventHandler};
explicit PluginProxy(); explicit PluginProxy();
@ -37,11 +39,13 @@ public:
bool processMouseDoubleClick(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event); bool processMouseDoubleClick(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event);
bool processMousePress(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event); bool processMousePress(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event);
bool processMouseRelease(const Qz::ObjectName &object, QObject* obj, QMouseEvent* event); bool processMouseRelease(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event);
bool processMouseMove(const Qz::ObjectName &object, QObject* obj, QMouseEvent* event); bool processMouseMove(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event);
bool processKeyPress(const Qz::ObjectName &object, QObject* obj, QKeyEvent* event); bool processWheelEvent(const Qz::ObjectName &type, QObject* obj, QWheelEvent* event);
bool processKeyRelease(const Qz::ObjectName &object, QObject* obj, QKeyEvent* event);
bool processKeyPress(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event);
bool processKeyRelease(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event);
void emitWebViewCreated(WebView* view); void emitWebViewCreated(WebView* view);
void emitWebViewDeleted(WebView* view); void emitWebViewDeleted(WebView* view);
@ -62,6 +66,8 @@ private:
QList<PluginInterface*> m_mouseReleaseHandlers; QList<PluginInterface*> m_mouseReleaseHandlers;
QList<PluginInterface*> m_mouseMoveHandlers; QList<PluginInterface*> m_mouseMoveHandlers;
QList<PluginInterface*> m_wheelEventHandlers;
QList<PluginInterface*> m_keyPressHandlers; QList<PluginInterface*> m_keyPressHandlers;
QList<PluginInterface*> m_keyReleaseHandlers; QList<PluginInterface*> m_keyReleaseHandlers;
}; };

View File

@ -50,9 +50,12 @@ bool Plugins::loadPlugin(Plugins::Plugin* plugin)
return false; return false;
} }
m_availablePlugins.removeOne(*plugin); int index = m_availablePlugins.indexOf(*plugin);
plugin->instance = initPlugin(iPlugin, plugin->pluginLoader); if (index == -1) {
m_availablePlugins.append(*plugin); return false;
}
m_availablePlugins[index].instance = initPlugin(iPlugin, plugin->pluginLoader);
refreshLoadedPlugins(); refreshLoadedPlugins();

View File

@ -780,6 +780,10 @@ void WebView::muteMedia()
void WebView::wheelEvent(QWheelEvent* event) void WebView::wheelEvent(QWheelEvent* event)
{ {
if (mApp->plugins()->processWheelEvent(Qz::ON_WebView, this, event)) {
return;
}
if (event->modifiers() & Qt::ControlModifier) { if (event->modifiers() & Qt::ControlModifier) {
int numDegrees = event->delta() / 8; int numDegrees = event->delta() / 8;
int numSteps = numDegrees / 15; int numSteps = numDegrees / 15;