mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
[BrowserWindow] Create shortcuts with QShortcut instead manually in keypress
This fixes eg. Ctrl+W writing W in locationbar
This commit is contained in:
parent
7e57cb63f5
commit
c395f19524
@ -363,6 +363,23 @@ void BrowserWindow::setupMenu()
|
||||
m_mainMenu = new MainMenu(this, this);
|
||||
m_mainMenu->initMenuBar(menuBar());
|
||||
m_mainMenu->initSuperMenu(m_superMenu);
|
||||
|
||||
// Setup other shortcuts
|
||||
QShortcut* reloadBypassCacheAction = new QShortcut(QKeySequence(QSL("Ctrl+F5")), this);
|
||||
QShortcut* reloadBypassCacheAction2 = new QShortcut(QKeySequence(QSL("Ctrl+Shift+R")), this);
|
||||
connect(reloadBypassCacheAction, SIGNAL(activated()), this, SLOT(reloadBypassCache()));
|
||||
connect(reloadBypassCacheAction2, SIGNAL(activated()), this, SLOT(reloadBypassCache()));
|
||||
|
||||
QShortcut* reloadAction = new QShortcut(QKeySequence("Ctrl+R"), this);
|
||||
connect(reloadAction, SIGNAL(activated()), this, SLOT(reload()));
|
||||
|
||||
QShortcut* openLocationAction = new QShortcut(QKeySequence("Alt+D"), this);
|
||||
connect(openLocationAction, SIGNAL(activated()), this, SLOT(openLocation()));
|
||||
|
||||
QShortcut* closeTabAction = new QShortcut(QKeySequence("Ctrl+W"), this);
|
||||
QShortcut* closeTabAction2 = new QShortcut(QKeySequence("Ctrl+F4"), this);
|
||||
connect(closeTabAction, SIGNAL(activated()), this, SLOT(closeTab()));
|
||||
connect(closeTabAction2, SIGNAL(activated()), this, SLOT(closeTab()));
|
||||
}
|
||||
|
||||
void BrowserWindow::loadSettings()
|
||||
@ -477,6 +494,16 @@ void BrowserWindow::goForward()
|
||||
weView()->forward();
|
||||
}
|
||||
|
||||
void BrowserWindow::reload()
|
||||
{
|
||||
weView()->reload();
|
||||
}
|
||||
|
||||
void BrowserWindow::reloadBypassCache()
|
||||
{
|
||||
weView()->reloadBypassCache();
|
||||
}
|
||||
|
||||
void BrowserWindow::goBack()
|
||||
{
|
||||
weView()->back();
|
||||
@ -1200,26 +1227,6 @@ void BrowserWindow::keyPressEvent(QKeyEvent* event)
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_F5:
|
||||
if (view && event->modifiers() == Qt::ControlModifier) {
|
||||
view->reload();
|
||||
event->accept();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_R:
|
||||
if (view) {
|
||||
if (event->modifiers() == Qt::ControlModifier) {
|
||||
view->reload();
|
||||
event->accept();
|
||||
}
|
||||
if (event->modifiers() == (Qt::ControlModifier + Qt::ShiftModifier)) {
|
||||
view->reloadBypassCache();
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_HomePage:
|
||||
goHome();
|
||||
event->accept();
|
||||
@ -1310,21 +1317,6 @@ void BrowserWindow::keyPressEvent(QKeyEvent* event)
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_D:
|
||||
if (event->modifiers() == Qt::AltModifier) {
|
||||
openLocation();
|
||||
event->accept();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_F4:
|
||||
case Qt::Key_W:
|
||||
if (event->modifiers() == Qt::ControlModifier) {
|
||||
closeTab();
|
||||
event->accept();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_1:
|
||||
number = 1;
|
||||
break;
|
||||
|
@ -117,6 +117,9 @@ public slots:
|
||||
void goBack();
|
||||
void goForward();
|
||||
|
||||
void reload();
|
||||
void reloadBypassCache();
|
||||
|
||||
void setWindowTitle(const QString &t);
|
||||
|
||||
void showWebInspector(bool toggle = true);
|
||||
@ -145,21 +148,17 @@ private slots:
|
||||
void openLocation();
|
||||
void openFile();
|
||||
void closeWindow();
|
||||
void closeTab();
|
||||
void loadSettings();
|
||||
void postLaunch();
|
||||
|
||||
void savePageScreen();
|
||||
|
||||
void refreshHistory();
|
||||
|
||||
void webSearch();
|
||||
|
||||
void searchOnPage();
|
||||
|
||||
void changeEncoding();
|
||||
|
||||
bool quitApp();
|
||||
void closeTab();
|
||||
void hideNavigationSlot();
|
||||
|
||||
private:
|
||||
|
@ -1,7 +1,7 @@
|
||||
isEqual(QT_MAJOR_VERSION, 5) {
|
||||
QT += webkitwidgets network widgets printsupport sql script gui-private
|
||||
} else {
|
||||
QT += core gui webkit sql network script
|
||||
QT += core gui webkit sql network script concurrent
|
||||
}
|
||||
|
||||
TARGET = QupZilla
|
||||
|
@ -209,4 +209,3 @@ QString LocationCompleterRefreshJob::createDomainCompletion(const QString &compl
|
||||
|
||||
return str.mid(m_searchString.size());
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,6 @@ private:
|
||||
|
||||
QString createDomainCompletion(const QString &completion) const;
|
||||
|
||||
|
||||
qint64 m_timestamp;
|
||||
QString m_searchString;
|
||||
QString m_domainCompletion;
|
||||
|
Loading…
Reference in New Issue
Block a user