1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Open bookmark (in new tab) from menu in bookmarks toolbar

closes #601
This commit is contained in:
nowrep 2012-10-05 22:15:18 +02:00
parent 8098241078
commit fa1ee13611
2 changed files with 26 additions and 3 deletions

View File

@ -109,6 +109,9 @@ void BookmarksToolbar::showBookmarkContextMenu(const QPoint &pos)
QVariant buttonPointer = qVariantFromValue((void*) button);
QMenu menu;
menu.addAction(tr("Open bookmark"), this, SLOT(loadClickedBookmark()))->setData(buttonPointer);
menu.addAction(tr("Open bookmark in new tab"), this, SLOT(loadClickedBookmarkInNewTab()))->setData(buttonPointer);
menu.addSeparator();
menu.addAction(qIconProvider->fromTheme("go-next"), tr("Move right"), this, SLOT(moveRight()))->setData(buttonPointer);
menu.addAction(qIconProvider->fromTheme("go-previous"), tr("Move left"), this, SLOT(moveLeft()))->setData(buttonPointer);
menu.addAction(tr("Edit bookmark"), this, SLOT(editBookmark()))->setData(buttonPointer);
@ -277,7 +280,17 @@ void BookmarksToolbar::toggleShowOnlyIcons()
void BookmarksToolbar::loadClickedBookmark()
{
ToolButton* button = qobject_cast<ToolButton*>(sender());
ToolButton* button = 0;
QAction* act = qobject_cast<QAction*> (sender());
if (act) {
button = static_cast<ToolButton*>(act->data().value<void*>());
}
if (!button) {
button = qobject_cast<ToolButton*>(sender());
}
if (!button) {
return;
}
@ -289,7 +302,17 @@ void BookmarksToolbar::loadClickedBookmark()
void BookmarksToolbar::loadClickedBookmarkInNewTab()
{
ToolButton* button = qobject_cast<ToolButton*>(sender());
ToolButton* button = 0;
QAction* act = qobject_cast<QAction*> (sender());
if (act) {
button = static_cast<ToolButton*>(act->data().value<void*>());
}
if (!button) {
button = qobject_cast<ToolButton*>(sender());
}
if (!button) {
return;
}

View File

@ -632,7 +632,7 @@ void LocationBar::paintEvent(QPaintEvent* event)
switch (m_progressStyle) {
case ProgressFilled: {
QRect bar = contentsRect.adjusted(0, 1, 0, -1);
bar.setWidth(bar.width()*m_loadProgress/100);
bar.setWidth(bar.width()*m_loadProgress / 100);
const int roundness = bar.height() / 4.0;
p.drawRoundedRect(bar, roundness, roundness);
break;