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

Merge pull request #822 from srazi/master

Fixed a few shortcuts problems.

Closes #809
This commit is contained in:
David Rosca 2013-03-23 05:44:30 -07:00
commit 90923d5127
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();
@ -651,12 +648,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()));
@ -665,7 +656,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();
}
@ -673,6 +665,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);