mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +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 = new MainMenu(this, this);
|
||||||
m_mainMenu->initMenuBar(menuBar());
|
m_mainMenu->initMenuBar(menuBar());
|
||||||
m_mainMenu->initSuperMenu(m_superMenu);
|
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()
|
void BrowserWindow::loadSettings()
|
||||||
@ -477,6 +494,16 @@ void BrowserWindow::goForward()
|
|||||||
weView()->forward();
|
weView()->forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BrowserWindow::reload()
|
||||||
|
{
|
||||||
|
weView()->reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BrowserWindow::reloadBypassCache()
|
||||||
|
{
|
||||||
|
weView()->reloadBypassCache();
|
||||||
|
}
|
||||||
|
|
||||||
void BrowserWindow::goBack()
|
void BrowserWindow::goBack()
|
||||||
{
|
{
|
||||||
weView()->back();
|
weView()->back();
|
||||||
@ -1200,26 +1227,6 @@ void BrowserWindow::keyPressEvent(QKeyEvent* event)
|
|||||||
}
|
}
|
||||||
break;
|
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:
|
case Qt::Key_HomePage:
|
||||||
goHome();
|
goHome();
|
||||||
event->accept();
|
event->accept();
|
||||||
@ -1310,21 +1317,6 @@ void BrowserWindow::keyPressEvent(QKeyEvent* event)
|
|||||||
}
|
}
|
||||||
break;
|
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:
|
case Qt::Key_1:
|
||||||
number = 1;
|
number = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -117,6 +117,9 @@ public slots:
|
|||||||
void goBack();
|
void goBack();
|
||||||
void goForward();
|
void goForward();
|
||||||
|
|
||||||
|
void reload();
|
||||||
|
void reloadBypassCache();
|
||||||
|
|
||||||
void setWindowTitle(const QString &t);
|
void setWindowTitle(const QString &t);
|
||||||
|
|
||||||
void showWebInspector(bool toggle = true);
|
void showWebInspector(bool toggle = true);
|
||||||
@ -145,21 +148,17 @@ private slots:
|
|||||||
void openLocation();
|
void openLocation();
|
||||||
void openFile();
|
void openFile();
|
||||||
void closeWindow();
|
void closeWindow();
|
||||||
|
void closeTab();
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
void postLaunch();
|
void postLaunch();
|
||||||
|
|
||||||
void savePageScreen();
|
void savePageScreen();
|
||||||
|
|
||||||
void refreshHistory();
|
void refreshHistory();
|
||||||
|
|
||||||
void webSearch();
|
void webSearch();
|
||||||
|
|
||||||
void searchOnPage();
|
void searchOnPage();
|
||||||
|
|
||||||
void changeEncoding();
|
void changeEncoding();
|
||||||
|
|
||||||
bool quitApp();
|
bool quitApp();
|
||||||
void closeTab();
|
|
||||||
void hideNavigationSlot();
|
void hideNavigationSlot();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
isEqual(QT_MAJOR_VERSION, 5) {
|
isEqual(QT_MAJOR_VERSION, 5) {
|
||||||
QT += webkitwidgets network widgets printsupport sql script gui-private
|
QT += webkitwidgets network widgets printsupport sql script gui-private
|
||||||
} else {
|
} else {
|
||||||
QT += core gui webkit sql network script
|
QT += core gui webkit sql network script concurrent
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET = QupZilla
|
TARGET = QupZilla
|
||||||
|
@ -209,4 +209,3 @@ QString LocationCompleterRefreshJob::createDomainCompletion(const QString &compl
|
|||||||
|
|
||||||
return str.mid(m_searchString.size());
|
return str.mid(m_searchString.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,6 @@ private:
|
|||||||
|
|
||||||
QString createDomainCompletion(const QString &completion) const;
|
QString createDomainCompletion(const QString &completion) const;
|
||||||
|
|
||||||
|
|
||||||
qint64 m_timestamp;
|
qint64 m_timestamp;
|
||||||
QString m_searchString;
|
QString m_searchString;
|
||||||
QString m_domainCompletion;
|
QString m_domainCompletion;
|
||||||
|
Loading…
Reference in New Issue
Block a user