1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-24 04:36:34 +01:00

Fixed shortcuts for RTL layout and fixed back/forward shortcuts

-see #809
-also fixed some little windows issues
This commit is contained in:
S. Razi Alavizadeh 2013-03-23 04:17:55 +04:30
parent 2d27c40384
commit 4e17c39dd8
3 changed files with 27 additions and 19 deletions

View File

@ -358,14 +358,9 @@ void QupZilla::setupMenu()
m_actionQuit = new QAction(QIcon::fromTheme("application-exit"), tr("Quit"), 0);
m_actionQuit->setMenuRole(QAction::QuitRole);
QKeySequence quitSequence = QKeySequence(QKeySequence::Quit);
#ifdef QZ_WS_X11
// QKeySequence::Quit returns a non-empty sequence on X11 only when running Gnome or Kde
if (quitSequence.isEmpty()) {
quitSequence = QKeySequence(Qt::CTRL + Qt::Key_Q);
}
#endif
m_actionQuit->setShortcut(quitSequence);
// QKeySequence::Quit returns an empty sequence on Windows and X11 when running desktop other than Gnome and Kde
m_actionQuit->setShortcut(actionShortcut(QKeySequence::Quit, Qt::CTRL + Qt::Key_Q));
connect(m_actionQuit, SIGNAL(triggered()), MENU_RECEIVER, SLOT(quitApp()));
/*************
@ -501,8 +496,10 @@ void QupZilla::setupMenu()
* History Menu *
****************/
m_menuHistory = new Menu(tr("Hi&story"));
m_menuHistory->addAction(qIconProvider->standardIcon(QStyle::SP_ArrowBack), tr("&Back"), MENU_RECEIVER, SLOT(goBack()))->setShortcut(QKeySequence("Ctrl+Left"));
m_menuHistory->addAction(qIconProvider->standardIcon(QStyle::SP_ArrowForward), tr("&Forward"), MENU_RECEIVER, SLOT(goNext()))->setShortcut(QKeySequence("Ctrl+Right"));
m_menuHistory->addAction(qIconProvider->standardIcon(QStyle::SP_ArrowBack), tr("&Back"),
MENU_RECEIVER, SLOT(goBack()))->setShortcut(actionShortcut(QKeySequence::Back, Qt::ALT + Qt::Key_Left, QKeySequence::Forward, Qt::ALT + Qt::Key_Right));
m_menuHistory->addAction(qIconProvider->standardIcon(QStyle::SP_ArrowForward), tr("&Forward"),
MENU_RECEIVER, SLOT(goNext()))->setShortcut(actionShortcut(QKeySequence::Forward, Qt::ALT + Qt::Key_Right, QKeySequence::Back, Qt::ALT + Qt::Key_Left));
m_menuHistory->addAction(qIconProvider->fromTheme("go-home"), tr("&Home"), MENU_RECEIVER, SLOT(goHome()))->setShortcut(QKeySequence("Alt+Home"));
m_menuHistory->addAction(QIcon(":/icons/menu/history.png"), tr("Show &All History"), MENU_RECEIVER, SLOT(showHistoryManager()))->setShortcut(QKeySequence("Ctrl+Shift+H"));
m_menuHistory->addSeparator();
@ -652,12 +649,6 @@ void QupZilla::setupOtherActions()
QShortcut* reloadAction = new QShortcut(QKeySequence("Ctrl+R"), this);
connect(reloadAction, SIGNAL(activated()), MENU_RECEIVER, SLOT(reload()));
QShortcut* backAction = new QShortcut(QKeySequence("Alt+Left"), this);
connect(backAction, SIGNAL(activated()), MENU_RECEIVER, SLOT(goBack()));
QShortcut* forwardAction = new QShortcut(QKeySequence("Alt+Right"), this);
connect(forwardAction, SIGNAL(activated()), MENU_RECEIVER, SLOT(goNext()));
QShortcut* openLocationAction = new QShortcut(QKeySequence("Alt+D"), this);
connect(openLocationAction, SIGNAL(activated()), MENU_RECEIVER, SLOT(openLocation()));
@ -666,7 +657,8 @@ void QupZilla::setupOtherActions()
// Make shortcuts available even in fullscreen (menu hidden)
QList<QAction*> actions = menuBar()->actions();
foreach (QAction* action, actions) {
for (int i = 0; i < actions.size(); ++i) {
QAction* action = actions.at(i);
if (action->menu()) {
actions += action->menu()->actions();
}
@ -674,6 +666,17 @@ void QupZilla::setupOtherActions()
}
}
QKeySequence QupZilla::actionShortcut(QKeySequence shortcut, QKeySequence fallBack,
QKeySequence shortcutRTL, QKeySequence fallbackRTL)
{
if (isRightToLeft() && (!shortcutRTL.isEmpty() || !fallbackRTL.isEmpty())) {
return (shortcutRTL.isEmpty() ? fallbackRTL : shortcutRTL);
}
else {
return (shortcut.isEmpty() ? fallBack : shortcut);
}
}
#ifdef Q_OS_MAC
void QupZilla::setupMacMenu()
{

View File

@ -212,6 +212,9 @@ private slots:
#ifdef Q_OS_MAC
void refreshStateOfAllActions();
#endif
#ifdef Q_OS_WIN
void applyBlurToMainWindow(bool force = false);
#endif
private:
bool event(QEvent* event);
@ -238,7 +241,6 @@ private:
bool nativeEvent(const QByteArray &eventType, void* _message, long* result);
#endif
void applyBlurToMainWindow(bool force = false);
void paintEvent(QPaintEvent* event);
bool eventFilter(QObject* object, QEvent* event);
#endif
@ -254,6 +256,9 @@ private:
QAction* menuBookmarksAction();
void setMenuBookmarksAction(QAction* action);
QKeySequence actionShortcut(QKeySequence shortcut, QKeySequence fallBack = QKeySequence(),
QKeySequence shortcutRTL = QKeySequence(), QKeySequence fallbackRTL = QKeySequence());
bool m_historyMenuChanged;
bool m_bookmarksMenuChanged;
bool m_isClosing;

View File

@ -111,7 +111,7 @@ void NetworkManager::loadSettings()
// QSslSocket::VerifyNone ... The connection will still be encrypted, and your socket
// will still send its local certificate to the peer if it's requested.
QSslConfiguration config = QSslConfiguration::defaultConfiguration();
config = QSslConfiguration::defaultConfiguration();
config.setPeerVerifyMode(QSslSocket::VerifyNone);
QSslConfiguration::setDefaultConfiguration(config);