mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +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"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,0
|
||||
PRODUCTVERSION 1,0,0,0
|
||||
FILEVERSION 1,1,0,0
|
||||
PRODUCTVERSION 1,1,0,0
|
||||
FILEFLAGS 0x0L
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEOS 0x00040004L
|
||||
|
@ -16,14 +16,14 @@ BEGIN
|
|||
BEGIN
|
||||
BLOCK "000004b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "QupZilla Association"
|
||||
VALUE "CompanyName", "QupZilla Team"
|
||||
VALUE "FileDescription", "QupZilla Web Browser"
|
||||
VALUE "FileVersion", "1.0.0"
|
||||
VALUE "FileVersion", "1.1.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2010-2011 David Rosca"
|
||||
VALUE "InternalName", "qupzilla"
|
||||
VALUE "OriginalFilename", "qupzilla.exe"
|
||||
VALUE "ProductName", "QupZilla"
|
||||
VALUE "ProductVersion", "1.0.0"
|
||||
VALUE "ProductVersion", "1.1.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -334,6 +334,29 @@ bool BookmarksModel::renameFolder(const QString &before, const QString &after)
|
|||
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)
|
||||
{
|
||||
QSqlQuery query;
|
||||
|
|
|
@ -79,6 +79,8 @@ public:
|
|||
bool createFolder(const QString &name);
|
||||
bool removeFolder(const QString &name);
|
||||
|
||||
QList<Bookmark> folderBookmarks(const QString &name);
|
||||
|
||||
bool createSubfolder(const QString &name);
|
||||
bool isSubfolder(const QString &name);
|
||||
|
||||
|
|
|
@ -212,6 +212,23 @@ void BookmarksToolbar::loadClickedBookmarkInNewTab()
|
|||
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()
|
||||
{
|
||||
m_bookmarksModel->setShowingMostVisited(!m_bookmarksModel->isShowingMostVisited());
|
||||
|
@ -241,6 +258,7 @@ void BookmarksToolbar::subfolderAdded(const QString &name)
|
|||
b->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
b->setIcon(style()->standardIcon(QStyle::SP_DirIcon));
|
||||
b->setText(name);
|
||||
connect(b, SIGNAL(middleMouseClicked()), this, SLOT(loadFolderBookmarksInTabs()));
|
||||
|
||||
Menu* menu = new Menu(name);
|
||||
b->setMenu(menu);
|
||||
|
@ -422,6 +440,7 @@ void BookmarksToolbar::refreshBookmarks()
|
|||
b->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
b->setIcon(style()->standardIcon(QStyle::SP_DirIcon));
|
||||
b->setText(query.value(0).toString());
|
||||
connect(b, SIGNAL(middleMouseClicked()), this, SLOT(loadFolderBookmarksInTabs()));
|
||||
|
||||
Menu* menu = new Menu(query.value(0).toString());
|
||||
b->setMenu(menu);
|
||||
|
@ -457,21 +476,14 @@ void BookmarksToolbar::aboutToShowFolderMenu()
|
|||
menu->clear();
|
||||
QString folder = menu->title();
|
||||
|
||||
QSqlQuery query;
|
||||
query.prepare("SELECT title, url, icon FROM bookmarks WHERE folder=?");
|
||||
query.addBindValue(folder);
|
||||
query.exec();
|
||||
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 += "..";
|
||||
foreach (Bookmark b, m_bookmarksModel->folderBookmarks(folder)) {
|
||||
if (b.title.length() > 40) {
|
||||
b.title.truncate(40);
|
||||
b.title += "..";
|
||||
}
|
||||
|
||||
Action* act = new Action(icon, title);
|
||||
act->setData(url);
|
||||
Action* act = new Action(b.icon, b.title);
|
||||
act->setData(b.url);
|
||||
connect(act, SIGNAL(triggered()), p_QupZilla, SLOT(loadActionUrl()));
|
||||
connect(act, SIGNAL(middleClicked()), p_QupZilla, SLOT(loadActionUrlInNewNotSelectedTab()));
|
||||
menu->addAction(act);
|
||||
|
|
|
@ -46,6 +46,7 @@ public slots:
|
|||
private slots:
|
||||
void loadClickedBookmark();
|
||||
void loadClickedBookmarkInNewTab();
|
||||
void loadFolderBookmarksInTabs();
|
||||
|
||||
void aboutToShowFolderMenu();
|
||||
void showBookmarkContextMenu(const QPoint &pos);
|
||||
|
|
Loading…
Reference in New Issue
Block a user