mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
Remove AccessKeysNavigation plugin
This commit is contained in:
parent
22c88c4261
commit
881615a629
|
@ -1,20 +0,0 @@
|
|||
set( AccessKeysNavigation_SRCS
|
||||
akn_plugin.cpp
|
||||
akn_handler.cpp
|
||||
akn_settings.cpp
|
||||
)
|
||||
|
||||
set( AccessKeysNavigation_UIS
|
||||
akn_settings.ui
|
||||
)
|
||||
qt5_wrap_ui(UIS ${AccessKeysNavigation_UIS})
|
||||
|
||||
set( AccessKeysNavigation_RSCS
|
||||
akn_res.qrc
|
||||
)
|
||||
qt5_add_resources(RSCS ${AccessKeysNavigation_RSCS})
|
||||
|
||||
add_library(AccessKeysNavigation MODULE ${AccessKeysNavigation_SRCS} ${UIS} ${RSCS})
|
||||
install(TARGETS AccessKeysNavigation DESTINATION ${FALKON_INSTALL_PLUGINDIR})
|
||||
target_link_libraries(AccessKeysNavigation FalkonPrivate)
|
||||
|
|
@ -1,377 +0,0 @@
|
|||
/* ============================================================
|
||||
* Access Keys Navigation plugin for Falkon
|
||||
* Copyright (C) 2012-2014 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */
|
||||
/*
|
||||
* Copyright 2008-2009 Benjamin C. Meyer <ben@meyerhome.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "akn_handler.h"
|
||||
#include "webview.h"
|
||||
#include "webpage.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QSettings>
|
||||
#include <QWebPage>
|
||||
#include <QWebFrame>
|
||||
#include <QLabel>
|
||||
#include <QTimer>
|
||||
#include <QToolTip>
|
||||
#include <QKeyEvent>
|
||||
|
||||
Qt::Key keyFromCode(int code)
|
||||
{
|
||||
switch (code) {
|
||||
case 0:
|
||||
return Qt::Key_Control;
|
||||
|
||||
case 1:
|
||||
return Qt::Key_Alt;
|
||||
|
||||
case 2:
|
||||
return Qt::Key_Shift;
|
||||
|
||||
default:
|
||||
// Using default shortcut
|
||||
return Qt::Key_Control;
|
||||
}
|
||||
}
|
||||
|
||||
AKN_Handler::AKN_Handler(const QString &sPath, QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_accessKeysVisible(false)
|
||||
, m_settingsFile(sPath + "/extensions.ini")
|
||||
{
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
QString AKN_Handler::settingsFile()
|
||||
{
|
||||
return m_settingsFile;
|
||||
}
|
||||
|
||||
void AKN_Handler::loadSettings()
|
||||
{
|
||||
QSettings settings(m_settingsFile, QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup("AccessKeysNavigation");
|
||||
m_key = keyFromCode(settings.value("Key", 0).toInt());
|
||||
m_isDoublePress = settings.value("DoublePress", true).toBool();
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
bool AKN_Handler::handleKeyPress(QObject* obj, QKeyEvent* event)
|
||||
{
|
||||
WebView* view = qobject_cast<WebView*>(obj);
|
||||
if (!view) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_accessKeysVisible) {
|
||||
handleAccessKey(event);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (event->key() != m_key) {
|
||||
m_lastKeyPressTime = QTime();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_view = view;
|
||||
|
||||
if (!m_isDoublePress) {
|
||||
triggerShowAccessKeys();
|
||||
}
|
||||
else {
|
||||
if (m_lastKeyPressTime.isNull()) {
|
||||
// It is the first press of our button
|
||||
m_lastKeyPressTime.start();
|
||||
}
|
||||
else {
|
||||
const int doublePressInterval = 500; // 500 msecs
|
||||
|
||||
// It is the second press of our button
|
||||
if (m_lastKeyPressTime.elapsed() <= doublePressInterval) {
|
||||
triggerShowAccessKeys();
|
||||
}
|
||||
else {
|
||||
m_lastKeyPressTime = QTime::currentTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AKN_Handler::eventFilter(QObject* obj, QEvent* event)
|
||||
{
|
||||
if (obj != m_view.data()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (event->type()) {
|
||||
case QEvent::MouseButtonPress:
|
||||
case QEvent::Resize:
|
||||
case QEvent::FocusOut:
|
||||
case QEvent::Wheel:
|
||||
hideAccessKeys();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void AKN_Handler::triggerShowAccessKeys()
|
||||
{
|
||||
if (m_accessKeysVisible) {
|
||||
hideAccessKeys();
|
||||
}
|
||||
else {
|
||||
QTimer::singleShot(0, this, SLOT(showAccessKeys()));
|
||||
}
|
||||
}
|
||||
|
||||
void AKN_Handler::handleAccessKey(QKeyEvent* event)
|
||||
{
|
||||
if (event->key() == m_key) {
|
||||
hideAccessKeys();
|
||||
return;
|
||||
}
|
||||
|
||||
QString text = event->text();
|
||||
if (text.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_view) {
|
||||
return;
|
||||
}
|
||||
|
||||
QChar key = text.at(0);
|
||||
|
||||
QChar other(QChar::Null);
|
||||
if (key.isLower()) {
|
||||
other = key.toUpper();
|
||||
}
|
||||
else if (key.isUpper()) {
|
||||
other = key.toLower();
|
||||
}
|
||||
|
||||
if (!other.isNull() &&
|
||||
m_accessKeyNodes.contains(other) &&
|
||||
!m_accessKeyNodes.contains(key)
|
||||
) {
|
||||
key = other;
|
||||
}
|
||||
|
||||
if (m_accessKeyNodes.contains(key)) {
|
||||
QWebElement element = m_accessKeyNodes[key];
|
||||
QPoint p = element.geometry().center();
|
||||
QWebFrame* frame = element.webFrame();
|
||||
|
||||
if (!frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
p -= frame->scrollPosition();
|
||||
frame = frame->parentFrame();
|
||||
}
|
||||
while (frame && frame != m_view.data()->page()->currentFrame());
|
||||
|
||||
QMouseEvent pevent(QEvent::MouseButtonPress, p, Qt::LeftButton, 0, 0);
|
||||
qApp->sendEvent(m_view.data(), &pevent);
|
||||
|
||||
QMouseEvent revent(QEvent::MouseButtonRelease, p, Qt::LeftButton, 0, 0);
|
||||
qApp->sendEvent(m_view.data(), &revent);
|
||||
|
||||
hideAccessKeys();
|
||||
}
|
||||
}
|
||||
|
||||
void AKN_Handler::showAccessKeys()
|
||||
{
|
||||
if (!m_view) {
|
||||
return;
|
||||
}
|
||||
|
||||
QWebPage* page = m_view.data()->page();
|
||||
|
||||
QStringList supportedElement;
|
||||
supportedElement << QLatin1String("input")
|
||||
<< QLatin1String("a")
|
||||
<< QLatin1String("area")
|
||||
<< QLatin1String("button")
|
||||
<< QLatin1String("label")
|
||||
<< QLatin1String("legend")
|
||||
<< QLatin1String("textarea");
|
||||
|
||||
QList<QChar> unusedKeys;
|
||||
for (char c = 'A'; c <= 'Z'; ++c) {
|
||||
unusedKeys << QLatin1Char(c);
|
||||
}
|
||||
for (char c = '0'; c <= '9'; ++c) {
|
||||
unusedKeys << QLatin1Char(c);
|
||||
}
|
||||
for (char c = 'a'; c <= 'z'; ++c) {
|
||||
unusedKeys << QLatin1Char(c);
|
||||
}
|
||||
|
||||
QRect viewport = QRect(page->currentFrame()->scrollPosition(), page->viewportSize());
|
||||
// Priority first goes to elements with accesskey attributes
|
||||
QList<QWebElement> alreadyLabeled;
|
||||
foreach (const QString &elementType, supportedElement) {
|
||||
QList<QWebElement> result = page->currentFrame()->findAllElements(elementType).toList();
|
||||
foreach (const QWebElement &element, result) {
|
||||
const QRect geometry = element.geometry();
|
||||
if (geometry.size().isEmpty() ||
|
||||
!viewport.contains(geometry.topLeft())
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
QString accessKeyAttribute = element.attribute(QLatin1String("accesskey")).toUpper();
|
||||
if (accessKeyAttribute.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
QChar accessKey;
|
||||
for (int i = 0; i < accessKeyAttribute.count(); i += 2) {
|
||||
const QChar possibleAccessKey = accessKeyAttribute[i];
|
||||
if (unusedKeys.contains(possibleAccessKey)) {
|
||||
accessKey = possibleAccessKey;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (accessKey.isNull()) {
|
||||
continue;
|
||||
}
|
||||
unusedKeys.removeOne(accessKey);
|
||||
makeAccessKeyLabel(accessKey, element);
|
||||
alreadyLabeled.append(element);
|
||||
}
|
||||
}
|
||||
|
||||
// Pick an access key first from the letters in the text and then from the
|
||||
// list of unused access keys
|
||||
foreach (const QString &elementType, supportedElement) {
|
||||
QWebElementCollection result = page->currentFrame()->findAllElements(elementType);
|
||||
foreach (const QWebElement &element, result) {
|
||||
const QRect geometry = element.geometry();
|
||||
if (unusedKeys.isEmpty() ||
|
||||
alreadyLabeled.contains(element) ||
|
||||
geometry.size().isEmpty() ||
|
||||
!viewport.contains(geometry.topLeft())
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
QChar accessKey;
|
||||
QString text = element.toPlainText().toLower();
|
||||
for (int i = 0; i < text.count(); ++i) {
|
||||
const QChar c = text.at(i);
|
||||
if (unusedKeys.contains(c)) {
|
||||
accessKey = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (accessKey.isNull()) {
|
||||
accessKey = unusedKeys.takeFirst();
|
||||
}
|
||||
unusedKeys.removeOne(accessKey);
|
||||
makeAccessKeyLabel(accessKey, element);
|
||||
}
|
||||
}
|
||||
|
||||
// Install event filter and connect loadStarted
|
||||
m_accessKeysVisible = !m_accessKeyLabels.isEmpty();
|
||||
if (m_accessKeysVisible) {
|
||||
m_view.data()->installEventFilter(this);
|
||||
connect(m_view.data(), SIGNAL(loadStarted()), this, SLOT(hideAccessKeys()));
|
||||
connect(m_view.data()->page(), SIGNAL(scrollRequested(int,int,QRect)), this, SLOT(hideAccessKeys()));
|
||||
#if QT_VERSION >= 0x040800
|
||||
connect(m_view.data()->page(), SIGNAL(viewportChangeRequested()), this, SLOT(hideAccessKeys()));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void AKN_Handler::hideAccessKeys()
|
||||
{
|
||||
if (!m_accessKeyLabels.isEmpty() && m_view) {
|
||||
// Fixes crash when hiding labels while closing view
|
||||
if (!m_view->inherits("WebView")) {
|
||||
m_accessKeyLabels.clear();
|
||||
m_accessKeyNodes.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_accessKeyLabels.count(); ++i) {
|
||||
QLabel* label = m_accessKeyLabels[i];
|
||||
label->hide();
|
||||
label->deleteLater();
|
||||
}
|
||||
m_accessKeyLabels.clear();
|
||||
m_accessKeyNodes.clear();
|
||||
m_view.data()->update();
|
||||
|
||||
// Uninstall event filter and disconnect loadStarted
|
||||
m_view.data()->removeEventFilter(this);
|
||||
disconnect(m_view.data(), SIGNAL(loadStarted()), this, SLOT(hideAccessKeys()));
|
||||
disconnect(m_view.data()->page(), SIGNAL(scrollRequested(int,int,QRect)), this, SLOT(hideAccessKeys()));
|
||||
#if QT_VERSION >= 0x040800
|
||||
disconnect(m_view.data()->page(), SIGNAL(viewportChangeRequested()), this, SLOT(hideAccessKeys()));
|
||||
#endif
|
||||
}
|
||||
|
||||
m_accessKeysVisible = false;
|
||||
}
|
||||
|
||||
void AKN_Handler::makeAccessKeyLabel(const QChar &accessKey, const QWebElement &element)
|
||||
{
|
||||
QLabel* label = new QLabel(m_view.data()->overlayWidget());
|
||||
label->setText(QString(QLatin1String("<b>%1</b>")).arg(accessKey));
|
||||
|
||||
QPalette p = QToolTip::palette();
|
||||
QColor color = QColor(220, 243, 253);
|
||||
color.setAlpha(175);
|
||||
p.setColor(QPalette::Window, color);
|
||||
|
||||
label->setPalette(p);
|
||||
label->setAutoFillBackground(true);
|
||||
label->setFrameStyle(QFrame::Box | QFrame::Plain);
|
||||
QPoint point = element.geometry().center();
|
||||
point -= m_view.data()->page()->currentFrame()->scrollPosition();
|
||||
label->show();
|
||||
label->resize(label->sizeHint());
|
||||
point.setX(point.x() - label->width() / 2);
|
||||
label->move(point);
|
||||
m_accessKeyLabels.append(label);
|
||||
m_accessKeyNodes[accessKey] = element;
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
/* ============================================================
|
||||
* Access Keys Navigation plugin for Falkon
|
||||
* Copyright (C) 2012-2014 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */
|
||||
#ifndef AKN_HANDLER_H
|
||||
#define AKN_HANDLER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QTime>
|
||||
#include <QHash>
|
||||
#include <QWebElement>
|
||||
#include <QPointer>
|
||||
|
||||
class QKeyEvent;
|
||||
class QWebElement;
|
||||
class QTime;
|
||||
class QLabel;
|
||||
|
||||
class WebView;
|
||||
|
||||
class AKN_Handler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AKN_Handler(const QString &sPath, QObject* parent = 0);
|
||||
|
||||
QString settingsFile();
|
||||
void loadSettings();
|
||||
|
||||
bool handleKeyPress(QObject* obj, QKeyEvent* event);
|
||||
bool eventFilter(QObject* obj, QEvent* event);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
private slots:
|
||||
void showAccessKeys();
|
||||
void hideAccessKeys();
|
||||
|
||||
private:
|
||||
void triggerShowAccessKeys();
|
||||
|
||||
void makeAccessKeyLabel(const QChar &accessKey, const QWebElement &element);
|
||||
void handleAccessKey(QKeyEvent* event);
|
||||
|
||||
QPointer<WebView> m_view;
|
||||
|
||||
QList<QLabel*> m_accessKeyLabels;
|
||||
QHash<QChar, QWebElement> m_accessKeyNodes;
|
||||
bool m_accessKeysVisible;
|
||||
|
||||
Qt::Key m_key;
|
||||
bool m_isDoublePress;
|
||||
QTime m_lastKeyPressTime;
|
||||
QString m_settingsFile;
|
||||
};
|
||||
|
||||
#endif // AKN_HANDLER_H
|
|
@ -1,98 +0,0 @@
|
|||
/* ============================================================
|
||||
* Access Keys Navigation plugin for Falkon
|
||||
* Copyright (C) 2012-2014 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */
|
||||
#include "akn_plugin.h"
|
||||
#include "akn_handler.h"
|
||||
#include "akn_settings.h"
|
||||
#include "mainapplication.h"
|
||||
#include "pluginproxy.h"
|
||||
#include "browserwindow.h"
|
||||
#include "../config.h"
|
||||
|
||||
#include <QTranslator>
|
||||
|
||||
AKN_Plugin::AKN_Plugin()
|
||||
: QObject()
|
||||
, m_handler(0)
|
||||
{
|
||||
}
|
||||
|
||||
PluginSpec AKN_Plugin::pluginSpec()
|
||||
{
|
||||
PluginSpec spec;
|
||||
spec.name = "Access Keys Navigation";
|
||||
spec.info = "Access keys navigation for Falkon";
|
||||
spec.description = "Provides support for navigating in webpages by keyboard shortcuts";
|
||||
spec.version = "0.4.3";
|
||||
spec.author = "David Rosca <nowrep@gmail.com>";
|
||||
spec.icon = QPixmap(":/accesskeysnavigation/data/icon.png");
|
||||
spec.hasSettings = true;
|
||||
|
||||
return spec;
|
||||
}
|
||||
|
||||
void AKN_Plugin::init(InitState state, const QString &sPath)
|
||||
{
|
||||
Q_UNUSED(state)
|
||||
|
||||
m_handler = new AKN_Handler(sPath, this);
|
||||
|
||||
mApp->plugins->registerAppEventHandler(PluginProxy::KeyPressHandler, this);
|
||||
}
|
||||
|
||||
void AKN_Plugin::unload()
|
||||
{
|
||||
delete m_settings.data();
|
||||
|
||||
m_handler->deleteLater();
|
||||
}
|
||||
|
||||
bool AKN_Plugin::testPlugin()
|
||||
{
|
||||
// Require the version that the plugin was built with
|
||||
return (Qz::VERSION == QLatin1String(FALKON_VERSION));
|
||||
}
|
||||
|
||||
QTranslator* AKN_Plugin::getTranslator(const QString &locale)
|
||||
{
|
||||
QTranslator* translator = new QTranslator(this);
|
||||
translator->load(locale, ":/accesskeysnavigation/locale/");
|
||||
return translator;
|
||||
}
|
||||
|
||||
void AKN_Plugin::showSettings(QWidget* parent)
|
||||
{
|
||||
if (!m_settings) {
|
||||
m_settings = new AKN_Settings(m_handler, parent);
|
||||
}
|
||||
|
||||
m_settings.data()->show();
|
||||
m_settings.data()->raise();
|
||||
}
|
||||
|
||||
bool AKN_Plugin::keyPress(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event)
|
||||
{
|
||||
if (type == Qz::ON_WebView) {
|
||||
return m_handler->handleKeyPress(obj, event);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
Q_EXPORT_PLUGIN2(AccessKeysNavigation, AKN_Plugin)
|
||||
#endif
|
|
@ -1,55 +0,0 @@
|
|||
/* ============================================================
|
||||
* Access Keys Navigation plugin for Falkon
|
||||
* Copyright (C) 2012-2014 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */
|
||||
#ifndef AKN_PLUGIN_H
|
||||
#define AKN_PLUGIN_H
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include "plugininterface.h"
|
||||
|
||||
class AKN_Handler;
|
||||
class AKN_Settings;
|
||||
|
||||
class AKN_Plugin : public QObject, public PluginInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(PluginInterface)
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
Q_PLUGIN_METADATA(IID "Falkon.Browser.plugin.AKN")
|
||||
#endif
|
||||
|
||||
public:
|
||||
AKN_Plugin();
|
||||
PluginSpec pluginSpec();
|
||||
|
||||
void init(InitState state, const QString &settingsPath);
|
||||
void unload();
|
||||
bool testPlugin();
|
||||
|
||||
QTranslator* getTranslator(const QString &locale);
|
||||
void showSettings(QWidget* parent = 0);
|
||||
|
||||
bool keyPress(const Qz::ObjectName &type, QObject* obj, QKeyEvent* event);
|
||||
|
||||
private:
|
||||
QPointer<AKN_Settings> m_settings;
|
||||
AKN_Handler* m_handler;
|
||||
};
|
||||
|
||||
#endif // AKN_PLUGIN_H
|
|
@ -1,6 +0,0 @@
|
|||
<RCC>
|
||||
<qresource prefix="/accesskeysnavigation">
|
||||
<file>data/icon.png</file>
|
||||
<file>data/copyright</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,67 +0,0 @@
|
|||
/* ============================================================
|
||||
* Access Keys Navigation plugin for Falkon
|
||||
* Copyright (C) 2012-2014 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */
|
||||
|
||||
#include "akn_settings.h"
|
||||
#include "ui_akn_settings.h"
|
||||
#include "akn_handler.h"
|
||||
#include "licenseviewer.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QTextBrowser>
|
||||
|
||||
AKN_Settings::AKN_Settings(AKN_Handler* handler, QWidget* parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::AKN_Settings)
|
||||
, m_handler(handler)
|
||||
, m_settingsFile(handler->settingsFile())
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
ui->setupUi(this);
|
||||
|
||||
QSettings settings(m_settingsFile, QSettings::IniFormat);
|
||||
settings.beginGroup("AccessKeysNavigation");
|
||||
ui->key->setCurrentIndex(settings.value("Key", 0).toInt());
|
||||
ui->doubleClick->setChecked(settings.value("DoublePress", true).toBool());
|
||||
settings.endGroup();
|
||||
|
||||
connect(ui->licence, SIGNAL(clicked()), this, SLOT(showLicence()));
|
||||
connect(this, SIGNAL(accepted()), this, SLOT(dialogAccepted()));
|
||||
}
|
||||
|
||||
void AKN_Settings::dialogAccepted()
|
||||
{
|
||||
QSettings settings(m_settingsFile, QSettings::IniFormat);
|
||||
settings.beginGroup("AccessKeysNavigation");
|
||||
settings.setValue("Key", ui->key->currentIndex());
|
||||
settings.setValue("DoublePress", ui->doubleClick->isChecked());
|
||||
settings.endGroup();
|
||||
|
||||
m_handler->loadSettings();
|
||||
}
|
||||
|
||||
void AKN_Settings::showLicence()
|
||||
{
|
||||
LicenseViewer* v = new LicenseViewer(this);
|
||||
v->setLicenseFile(":accesskeysnavigation/data/copyright");
|
||||
v->show();
|
||||
}
|
||||
|
||||
AKN_Settings::~AKN_Settings()
|
||||
{
|
||||
delete ui;
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
/* ============================================================
|
||||
* Access Keys Navigation plugin for Falkon
|
||||
* Copyright (C) 2012-2014 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */
|
||||
#ifndef AKN_SETTINGS_H
|
||||
#define AKN_SETTINGS_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class AKN_Settings;
|
||||
}
|
||||
|
||||
class AKN_Handler;
|
||||
|
||||
class AKN_Settings : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AKN_Settings(AKN_Handler* handler, QWidget* parent = 0);
|
||||
~AKN_Settings();
|
||||
|
||||
private slots:
|
||||
void dialogAccepted();
|
||||
void showLicence();
|
||||
|
||||
private:
|
||||
Ui::AKN_Settings* ui;
|
||||
|
||||
AKN_Handler* m_handler;
|
||||
QString m_settingsFile;
|
||||
};
|
||||
|
||||
#endif // AKN_SETTINGS_H
|
|
@ -1,144 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AKN_Settings</class>
|
||||
<widget class="QDialog" name="AKN_Settings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>470</width>
|
||||
<height>146</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Access Keys Navigation</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><h1>Access Keys Navigation</h1></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="key">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Ctrl</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Alt</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Shift</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="doubleClick">
|
||||
<property name="text">
|
||||
<string>Double press</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Key for showing access keys:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="licence">
|
||||
<property name="text">
|
||||
<string>License</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>AKN_Settings</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>AKN_Settings</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1,20 +0,0 @@
|
|||
Access Keys showing function is under following license:
|
||||
|
||||
/*
|
||||
* Copyright 2008-2009 Benjamin C. Meyer <ben@meyerhome.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
Binary file not shown.
Before Width: | Height: | Size: 498 B |
|
@ -1,9 +1,6 @@
|
|||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/plugins")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/plugins")
|
||||
|
||||
# QtWebEngine disable
|
||||
#add_subdirectory(AccessKeysNavigation)
|
||||
|
||||
add_subdirectory(AutoScroll)
|
||||
add_subdirectory(FlashCookieManager)
|
||||
add_subdirectory(GreaseMonkey)
|
||||
|
|
Loading…
Reference in New Issue
Block a user