mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
BookmarksSideBar: Get focus to search line when opening sidebar
- also addeed support for opening bookmarks with Enter * Enter - opens bookmark in current tab * Ctrl + Enter - opens bookmark in new tab
This commit is contained in:
parent
2c57528d29
commit
d5e21ab911
@ -30,6 +30,7 @@
|
||||
#include <QTimer>
|
||||
#include <QClipboard>
|
||||
#include <QSqlQuery>
|
||||
#include <QKeyEvent>
|
||||
|
||||
BookmarksSideBar::BookmarksSideBar(QupZilla* mainClass, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
@ -233,6 +234,24 @@ void BookmarksSideBar::renameFolder(const QString &before, const QString &after)
|
||||
item->setText(0, after);
|
||||
}
|
||||
|
||||
void BookmarksSideBar::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
|
||||
QTreeWidgetItem* item = ui->bookmarksTree->currentItem();
|
||||
|
||||
if (event->modifiers() & Qt::ControlModifier) {
|
||||
itemControlClicked(item);
|
||||
}
|
||||
else {
|
||||
itemDoubleClicked(item);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
QWidget::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void BookmarksSideBar::refreshTable()
|
||||
{
|
||||
m_isRefreshing = true;
|
||||
@ -293,6 +312,8 @@ void BookmarksSideBar::refreshTable()
|
||||
|
||||
ui->bookmarksTree->setUpdatesEnabled(true);
|
||||
m_isRefreshing = false;
|
||||
|
||||
ui->search->setFocus();
|
||||
}
|
||||
|
||||
BookmarksSideBar::~BookmarksSideBar()
|
||||
|
@ -62,6 +62,8 @@ private slots:
|
||||
void renameFolder(const QString &before, const QString &after);
|
||||
|
||||
private:
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
|
||||
QupZilla* getQupZilla();
|
||||
|
||||
bool m_isRefreshing;
|
||||
|
@ -31,6 +31,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="closeButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
|
Loading…
Reference in New Issue
Block a user