Skip to content
Snippets Groups Projects
Commit 905aeead authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Bookmarks: Handle enter and delete keys


Change-Id: I169dcc02f02a647b0a2ae6478227a852be922de2
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent fdaddec7
No related branches found
No related tags found
No related merge requests found
......@@ -219,6 +219,8 @@ BookmarkView::BookmarkView(QWidget *parent) :
connect(this, SIGNAL(clicked(QModelIndex)),
this, SLOT(gotoBookmark(QModelIndex)));
connect(this, SIGNAL(activated(QModelIndex)),
this, SLOT(gotoBookmark(QModelIndex)));
ICore::addContextObject(m_bookmarkContext);
......@@ -280,6 +282,16 @@ void BookmarkView::removeBookmark(const QModelIndex& index)
m_manager->removeBookmark(bm);
}
void BookmarkView::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Delete) {
removeBookmark(currentIndex());
event->accept();
return;
}
QListView::keyPressEvent(event);
}
void BookmarkView::removeAll()
{
const QString key = QLatin1String("Bookmarks.DontAskAgain");
......
......@@ -161,6 +161,7 @@ protected slots:
protected:
void contextMenuEvent(QContextMenuEvent *event);
void removeBookmark(const QModelIndex &index);
void keyPressEvent(QKeyEvent *event);
private:
BookmarkContext *m_bookmarkContext;
QModelIndex m_contextMenuIndex;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment