aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-pdf/BookmarkMenu.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2019-01-02 09:31:52 -0500
committerGitHub <noreply@github.com>2019-01-02 09:31:52 -0500
commitcd407705124fefe2b293120c845319c369929c86 (patch)
tree635f1cea2c9a39ee7495396a43aa04957dad7f2a /src-qt5/desktop-utils/lumina-pdf/BookmarkMenu.cpp
parentMerge pull request #644 from maxsteciuk/bugfix/lumina-fm-crash-on-startup (diff)
parentSwitches from keeping links in a QHash to a std::vector. This fixes some race... (diff)
downloadlumina-cd407705124fefe2b293120c845319c369929c86.tar.gz
lumina-cd407705124fefe2b293120c845319c369929c86.tar.bz2
lumina-cd407705124fefe2b293120c845319c369929c86.zip
Merge pull request #642 from stackyjoe/master
Some changes and fixes to LuminaPDF
Diffstat (limited to 'src-qt5/desktop-utils/lumina-pdf/BookmarkMenu.cpp')
-rw-r--r--src-qt5/desktop-utils/lumina-pdf/BookmarkMenu.cpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/src-qt5/desktop-utils/lumina-pdf/BookmarkMenu.cpp b/src-qt5/desktop-utils/lumina-pdf/BookmarkMenu.cpp
index 902fe0ff..bf487d2a 100644
--- a/src-qt5/desktop-utils/lumina-pdf/BookmarkMenu.cpp
+++ b/src-qt5/desktop-utils/lumina-pdf/BookmarkMenu.cpp
@@ -8,42 +8,48 @@
#include "BookmarkMenu.h"
#include "ui_BookmarkMenu.h"
#include <LuminaXDG.h>
-#include <QSplitter>
#include <QPushButton>
+#include <QSplitter>
-BookmarkMenu::BookmarkMenu(Renderer *Backend, QWidget *parent) : QWidget(parent), ui(new Ui::BookmarkMenu()), BACKEND(Backend){
+BookmarkMenu::BookmarkMenu(Renderer *Backend, QWidget *parent)
+ : QWidget(parent), ui(new Ui::BookmarkMenu()), BACKEND(Backend) {
ui->setupUi(this);
- connect(ui->closeButton, &QPushButton::clicked, parent, [=]() { static_cast<QSplitter*>(parent)->setSizes(QList<int>() << 0 << this->width()); });
- connect(ui->closeButton, &QPushButton::clicked, parent, [=]() { });
- connect(ui->bookmarks, &QTreeWidget::itemClicked, this, [=](QTreeWidgetItem *item) {
- Backend->handleLink(parent, item->data(1, Qt::UserRole).toString()); });
+ connect(ui->closeButton, &QPushButton::clicked, parent, [=]() {
+ static_cast<QSplitter *>(parent)->setSizes(QList<int>()
+ << 0 << this->width());
+ });
+ connect(ui->closeButton, &QPushButton::clicked, parent, [=]() {});
+ connect(ui->bookmarks, &QTreeWidget::itemClicked, this,
+ [=](QTreeWidgetItem *item) {
+ Backend->handleLink(parent, item->data(1, Qt::UserRole).toString());
+ });
}
void BookmarkMenu::loadBookmarks() {
- QTreeWidgetItem *item=nullptr, *parent=nullptr;
- QList<Bookmark*> bookmarks = BACKEND->getBookmarks();
+ QTreeWidgetItem *item = nullptr, *parent = nullptr;
+ QList<Bookmark *> bookmarks = BACKEND->getBookmarks();
- if(ui->bookmarks->topLevelItemCount() != 0) {
+ if (ui->bookmarks->topLevelItemCount() != 0) {
ui->bookmarks->clear();
}
- //Modfiy for more than 2 levels
- if(bookmarks.empty()) {
+ // Modfiy for more than 2 levels
+ if (bookmarks.empty()) {
item = new QTreeWidgetItem(ui->bookmarks);
item->setText(0, "No Bookmarks");
item->setData(1, Qt::UserRole, "");
item->setIcon(0, LXDG::findIcon("bookmark-remove"));
- }else{
- foreach(Bookmark *bm, bookmarks) {
- if(bm->level == 0) {
+ } else {
+ foreach (Bookmark *bm, bookmarks) {
+ if (bm->level == 0) {
item = new QTreeWidgetItem(ui->bookmarks);
parent = item;
- }else{
+ } else {
item = new QTreeWidgetItem(parent);
}
item->setText(0, bm->title);
item->setData(1, Qt::UserRole, bm->link);
- if(!bm->link.isEmpty())
+ if (!bm->link.isEmpty())
item->setIcon(0, LXDG::findIcon("bookmark-new"));
else
item->setIcon(0, LXDG::findIcon("bookmark-remove"));
bgstack15