mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-13 10:32:11 +01:00
Middle click on folder opens all bookmarks in it. See #68
- it works for folders inside bookmarks toolbar only for now
This commit is contained in:
parent
d1c80b826c
commit
8bb47a0a5f
|
@ -4,8 +4,8 @@ IDI_ICON1 ICON DISCARDABLE "data\icons\exeicons\qupzilla.ico"
|
||||||
IDI_ICON2 ICON DISCARDABLE "data\icons\exeicons\page.ico"
|
IDI_ICON2 ICON DISCARDABLE "data\icons\exeicons\page.ico"
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,0,0,0
|
FILEVERSION 1,1,0,0
|
||||||
PRODUCTVERSION 1,0,0,0
|
PRODUCTVERSION 1,1,0,0
|
||||||
FILEFLAGS 0x0L
|
FILEFLAGS 0x0L
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
FILEOS 0x00040004L
|
FILEOS 0x00040004L
|
||||||
|
@ -16,14 +16,14 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "000004b0"
|
BLOCK "000004b0"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "QupZilla Association"
|
VALUE "CompanyName", "QupZilla Team"
|
||||||
VALUE "FileDescription", "QupZilla Web Browser"
|
VALUE "FileDescription", "QupZilla Web Browser"
|
||||||
VALUE "FileVersion", "1.0.0"
|
VALUE "FileVersion", "1.1.0"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2010-2011 David Rosca"
|
VALUE "LegalCopyright", "Copyright (C) 2010-2011 David Rosca"
|
||||||
VALUE "InternalName", "qupzilla"
|
VALUE "InternalName", "qupzilla"
|
||||||
VALUE "OriginalFilename", "qupzilla.exe"
|
VALUE "OriginalFilename", "qupzilla.exe"
|
||||||
VALUE "ProductName", "QupZilla"
|
VALUE "ProductName", "QupZilla"
|
||||||
VALUE "ProductVersion", "1.0.0"
|
VALUE "ProductVersion", "1.1.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
|
@ -334,6 +334,29 @@ bool BookmarksModel::renameFolder(const QString &before, const QString &after)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<Bookmark> BookmarksModel::folderBookmarks(const QString &name)
|
||||||
|
{
|
||||||
|
QList<Bookmark> list;
|
||||||
|
|
||||||
|
QSqlQuery query;
|
||||||
|
query.prepare("SELECT id, url, title, folder, icon FROM bookmarks WHERE folder=?");
|
||||||
|
query.addBindValue(name);
|
||||||
|
query.exec();
|
||||||
|
while (query.next()) {
|
||||||
|
Bookmark bookmark;
|
||||||
|
bookmark.id = query.value(0).toInt();
|
||||||
|
bookmark.url = query.value(1).toUrl();
|
||||||
|
bookmark.title = query.value(2).toString();
|
||||||
|
bookmark.folder = query.value(3).toString();
|
||||||
|
bookmark.icon = IconProvider::iconFromBase64(query.value(4).toByteArray());
|
||||||
|
bookmark.inSubfolder = isSubfolder(bookmark.folder);
|
||||||
|
|
||||||
|
list.append(bookmark);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
bool BookmarksModel::createSubfolder(const QString &name)
|
bool BookmarksModel::createSubfolder(const QString &name)
|
||||||
{
|
{
|
||||||
QSqlQuery query;
|
QSqlQuery query;
|
||||||
|
|
|
@ -79,6 +79,8 @@ public:
|
||||||
bool createFolder(const QString &name);
|
bool createFolder(const QString &name);
|
||||||
bool removeFolder(const QString &name);
|
bool removeFolder(const QString &name);
|
||||||
|
|
||||||
|
QList<Bookmark> folderBookmarks(const QString &name);
|
||||||
|
|
||||||
bool createSubfolder(const QString &name);
|
bool createSubfolder(const QString &name);
|
||||||
bool isSubfolder(const QString &name);
|
bool isSubfolder(const QString &name);
|
||||||
|
|
||||||
|
|
|
@ -212,6 +212,23 @@ void BookmarksToolbar::loadClickedBookmarkInNewTab()
|
||||||
p_QupZilla->tabWidget()->addView(bookmark.url);
|
p_QupZilla->tabWidget()->addView(bookmark.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BookmarksToolbar::loadFolderBookmarksInTabs()
|
||||||
|
{
|
||||||
|
ToolButton* b = qobject_cast<ToolButton*>(sender());
|
||||||
|
if (!b) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString folder = b->text();
|
||||||
|
if (folder.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Bookmark b, m_bookmarksModel->folderBookmarks(folder)) {
|
||||||
|
p_QupZilla->tabWidget()->addView(b.url, b.title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BookmarksToolbar::showMostVisited()
|
void BookmarksToolbar::showMostVisited()
|
||||||
{
|
{
|
||||||
m_bookmarksModel->setShowingMostVisited(!m_bookmarksModel->isShowingMostVisited());
|
m_bookmarksModel->setShowingMostVisited(!m_bookmarksModel->isShowingMostVisited());
|
||||||
|
@ -241,6 +258,7 @@ void BookmarksToolbar::subfolderAdded(const QString &name)
|
||||||
b->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
b->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
b->setIcon(style()->standardIcon(QStyle::SP_DirIcon));
|
b->setIcon(style()->standardIcon(QStyle::SP_DirIcon));
|
||||||
b->setText(name);
|
b->setText(name);
|
||||||
|
connect(b, SIGNAL(middleMouseClicked()), this, SLOT(loadFolderBookmarksInTabs()));
|
||||||
|
|
||||||
Menu* menu = new Menu(name);
|
Menu* menu = new Menu(name);
|
||||||
b->setMenu(menu);
|
b->setMenu(menu);
|
||||||
|
@ -422,6 +440,7 @@ void BookmarksToolbar::refreshBookmarks()
|
||||||
b->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
b->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
b->setIcon(style()->standardIcon(QStyle::SP_DirIcon));
|
b->setIcon(style()->standardIcon(QStyle::SP_DirIcon));
|
||||||
b->setText(query.value(0).toString());
|
b->setText(query.value(0).toString());
|
||||||
|
connect(b, SIGNAL(middleMouseClicked()), this, SLOT(loadFolderBookmarksInTabs()));
|
||||||
|
|
||||||
Menu* menu = new Menu(query.value(0).toString());
|
Menu* menu = new Menu(query.value(0).toString());
|
||||||
b->setMenu(menu);
|
b->setMenu(menu);
|
||||||
|
@ -457,21 +476,14 @@ void BookmarksToolbar::aboutToShowFolderMenu()
|
||||||
menu->clear();
|
menu->clear();
|
||||||
QString folder = menu->title();
|
QString folder = menu->title();
|
||||||
|
|
||||||
QSqlQuery query;
|
foreach (Bookmark b, m_bookmarksModel->folderBookmarks(folder)) {
|
||||||
query.prepare("SELECT title, url, icon FROM bookmarks WHERE folder=?");
|
if (b.title.length() > 40) {
|
||||||
query.addBindValue(folder);
|
b.title.truncate(40);
|
||||||
query.exec();
|
b.title += "..";
|
||||||
while (query.next()) {
|
|
||||||
QString title = query.value(0).toString();
|
|
||||||
QUrl url = query.value(1).toUrl();
|
|
||||||
QIcon icon = IconProvider::iconFromBase64(query.value(2).toByteArray());
|
|
||||||
if (title.length() > 40) {
|
|
||||||
title.truncate(40);
|
|
||||||
title += "..";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Action* act = new Action(icon, title);
|
Action* act = new Action(b.icon, b.title);
|
||||||
act->setData(url);
|
act->setData(b.url);
|
||||||
connect(act, SIGNAL(triggered()), p_QupZilla, SLOT(loadActionUrl()));
|
connect(act, SIGNAL(triggered()), p_QupZilla, SLOT(loadActionUrl()));
|
||||||
connect(act, SIGNAL(middleClicked()), p_QupZilla, SLOT(loadActionUrlInNewNotSelectedTab()));
|
connect(act, SIGNAL(middleClicked()), p_QupZilla, SLOT(loadActionUrlInNewNotSelectedTab()));
|
||||||
menu->addAction(act);
|
menu->addAction(act);
|
||||||
|
|
|
@ -46,6 +46,7 @@ public slots:
|
||||||
private slots:
|
private slots:
|
||||||
void loadClickedBookmark();
|
void loadClickedBookmark();
|
||||||
void loadClickedBookmarkInNewTab();
|
void loadClickedBookmarkInNewTab();
|
||||||
|
void loadFolderBookmarksInTabs();
|
||||||
|
|
||||||
void aboutToShowFolderMenu();
|
void aboutToShowFolderMenu();
|
||||||
void showBookmarkContextMenu(const QPoint &pos);
|
void showBookmarkContextMenu(const QPoint &pos);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user