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

[Sidebar] Expand/collapse buttons for bookmarks sidebar

This commit is contained in:
Mladen Pejaković 2014-01-01 12:29:19 +01:00
parent 252c55dd2b
commit 22880ade4e
5 changed files with 78 additions and 27 deletions

View File

@ -75,5 +75,7 @@
<file>icons/browsers/internet-explorer.png</file> <file>icons/browsers/internet-explorer.png</file>
<file>icons/sites/startpage.png</file> <file>icons/sites/startpage.png</file>
<file>icons/sites/w3.png</file> <file>icons/sites/w3.png</file>
<file>icons/faenza/expand.png</file>
<file>icons/faenza/collapse.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

View File

@ -46,12 +46,17 @@ BookmarksSideBar::BookmarksSideBar(QupZilla* mainClass, QWidget* parent)
ui->bookmarksTree->setDragDropReceiver(true, m_bookmarksModel); ui->bookmarksTree->setDragDropReceiver(true, m_bookmarksModel);
ui->bookmarksTree->setMimeType(QLatin1String("application/qupzilla.treewidgetitem.bookmarks")); ui->bookmarksTree->setMimeType(QLatin1String("application/qupzilla.treewidgetitem.bookmarks"));
ui->expandAll->setIcon(QIcon::fromTheme("view-sort-ascending", QIcon(":/icons/faenza/expand.png")));
ui->collapseAll->setIcon(QIcon::fromTheme("view-sort-descending", QIcon(":/icons/faenza/collapse.png")));
ui->bookmarksTree->setDefaultItemShowMode(TreeWidget::ItemsExpanded); ui->bookmarksTree->setDefaultItemShowMode(TreeWidget::ItemsExpanded);
connect(ui->bookmarksTree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint))); connect(ui->bookmarksTree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
connect(ui->bookmarksTree, SIGNAL(itemControlClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*))); connect(ui->bookmarksTree, SIGNAL(itemControlClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*)));
connect(ui->bookmarksTree, SIGNAL(itemMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*))); connect(ui->bookmarksTree, SIGNAL(itemMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(itemControlClicked(QTreeWidgetItem*)));
connect(ui->bookmarksTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*))); connect(ui->bookmarksTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*)));
connect(ui->search, SIGNAL(textChanged(QString)), ui->bookmarksTree, SLOT(filterString(QString))); connect(ui->search, SIGNAL(textChanged(QString)), ui->bookmarksTree, SLOT(filterString(QString)));
connect(ui->collapseAll, SIGNAL(clicked()), ui->bookmarksTree, SLOT(collapseAll()));
connect(ui->expandAll, SIGNAL(clicked()), ui->bookmarksTree, SLOT(expandAll()));
connect(m_bookmarksModel, SIGNAL(bookmarkAdded(BookmarksModel::Bookmark)), this, SLOT(addBookmark(BookmarksModel::Bookmark))); connect(m_bookmarksModel, SIGNAL(bookmarkAdded(BookmarksModel::Bookmark)), this, SLOT(addBookmark(BookmarksModel::Bookmark)));
connect(m_bookmarksModel, SIGNAL(bookmarkDeleted(BookmarksModel::Bookmark)), this, SLOT(removeBookmark(BookmarksModel::Bookmark))); connect(m_bookmarksModel, SIGNAL(bookmarkDeleted(BookmarksModel::Bookmark)), this, SLOT(removeBookmark(BookmarksModel::Bookmark)));

View File

@ -27,34 +27,78 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QLineEdit" name="search"> <widget class="QWidget" name="widget" native="true">
<property name="placeholderText"> <layout class="QGridLayout" name="gridLayout">
<string>Search...</string> <property name="margin">
</property> <number>0</number>
</widget>
</item>
<item>
<widget class="BookmarksTree" name="bookmarksTree">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ContiguousSelection</enum>
</property>
<property name="headerHidden">
<bool>true</bool>
</property>
<attribute name="headerDefaultSectionSize">
<number>330</number>
</attribute>
<column>
<property name="text">
<string notr="true">Bookmark</string>
</property> </property>
</column> <property name="spacing">
<number>0</number>
</property>
<item row="3" column="0" colspan="3">
<widget class="BookmarksTree" name="bookmarksTree">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ContiguousSelection</enum>
</property>
<property name="headerHidden">
<bool>true</bool>
</property>
<attribute name="headerDefaultSectionSize">
<number>330</number>
</attribute>
<column>
<property name="text">
<string notr="true">Bookmark</string>
</property>
</column>
</widget>
</item>
<item row="0" column="0">
<widget class="QLineEdit" name="search">
<property name="placeholderText">
<string>Search...</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="collapseAll">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Collapse All</string>
</property>
<property name="text">
<string/>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QToolButton" name="expandAll">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Expand All</string>
</property>
<property name="text">
<string/>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
</layout> </layout>