Falkon Develop
Cross-platform Qt-based web browser
bookmarkstools.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2014 David Rosca <nowrep@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#ifndef BOOKMARKSTOOLS_H
19#define BOOKMARKSTOOLS_H
20
21#include <QMenu>
22#include <QPushButton>
23
24#include "qzcommon.h"
25
26class Bookmarks;
27class BookmarkItem;
28
30{
31 Q_OBJECT
32
33public:
34 explicit BookmarksFoldersMenu(QWidget* parent = nullptr);
35
36 BookmarkItem* selectedFolder() const;
37
38Q_SIGNALS:
40
41private Q_SLOTS:
42 void folderChoosed();
43
44private:
45 void init();
46 void createMenu(QMenu* menu, BookmarkItem* parent);
47
48 BookmarkItem* m_selectedFolder;
49};
50
51class FALKON_EXPORT BookmarksFoldersButton : public QPushButton
52{
53 Q_OBJECT
54
55public:
56 explicit BookmarksFoldersButton(QWidget* parent, BookmarkItem* folder = nullptr);
57
58 BookmarkItem* selectedFolder() const;
59
60Q_SIGNALS:
62
63public Q_SLOTS:
64 void setSelectedFolder(BookmarkItem* folder);
65
66private:
67 void init();
68
70 BookmarkItem* m_selectedFolder;
71};
72
73class BrowserWindow;
74class TabWidget;
75class Action;
76class Menu;
77
79{
80public:
81 // Add Bookmark Dialogs
82 static bool addBookmarkDialog(QWidget* parent, const QUrl &url, const QString &title, BookmarkItem* folder = nullptr);
83 static bool bookmarkAllTabsDialog(QWidget* parent, TabWidget* tabWidget, BookmarkItem* folder = nullptr);
84
85 // Edit Bookmark Dialog
86 static bool editBookmarkDialog(QWidget* parent, BookmarkItem* item);
87
88 // Open Bookmarks
89 static void openBookmark(BrowserWindow* window, BookmarkItem* item);
90 static void openBookmarkInNewTab(BrowserWindow* window, BookmarkItem* item);
91 static void openBookmarkInNewWindow(BookmarkItem* item);
92 static void openBookmarkInNewPrivateWindow(BookmarkItem* item);
93 static void openFolderInTabs(BrowserWindow* window, BookmarkItem* folder);
94
95 // Create Menu
96 static void addActionToMenu(QObject* receiver, Menu* menu, BookmarkItem* item);
97 static void addFolderToMenu(QObject* receiver, Menu* menu, BookmarkItem* folder);
98 static void addUrlToMenu(QObject* receiver, Menu* menu, BookmarkItem* bookmark);
99 static void addSeparatorToMenu(Menu* menu, BookmarkItem* separator);
100 static void addFolderContentsToMenu(QObject* receiver, Menu* menu, BookmarkItem* folder);
101
102 // Migration from Sql Bookmarks (returns true if bookmarks migrated)
103 static bool migrateBookmarksIfNecessary(Bookmarks* bookmarks);
104};
105
106#endif // BOOKMARKSTOOLS_H
void selectedFolderChanged(BookmarkItem *folder)
void folderSelected(BookmarkItem *folder)
#define FALKON_EXPORT
Definition: qzcommon.h:28