File indexing completed on 2025-02-02 04:56:52

0001 /***************************************************************************
0002  * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr
0003  * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  ***************************************************************************/
0006 #ifndef SKGBOOKMARKPLUGIN_H
0007 #define SKGBOOKMARKPLUGIN_H
0008 /** @file
0009  * This file is a plugin for bookmarks management.
0010  *
0011  * @author Stephane MANKOWSKI / Guillaume DE BURE
0012  */
0013 #include <qvariant.h>
0014 
0015 #include "skginterfaceplugin.h"
0016 #include "ui_skgbookmarkpluginwidget_pref.h"
0017 
0018 class QMenu;
0019 
0020 /**
0021  * This file is a plugin for bookmarks management
0022  */
0023 class SKGBookmarkPlugin : public SKGInterfacePlugin
0024 {
0025     Q_OBJECT
0026     Q_INTERFACES(SKGInterfacePlugin)
0027 
0028 public:
0029     /**
0030      * Default Constructor
0031      */
0032     explicit SKGBookmarkPlugin(QWidget* iWidget, QObject* iParent, const QVariantList& iArg);
0033 
0034     /**
0035      * Default Destructor
0036      */
0037     ~SKGBookmarkPlugin() override;
0038 
0039     /**
0040      * Called to setupActions the plugin
0041      * @param iDocument the main document
0042      * @return true if the plugin is compatible with the document
0043      */
0044     bool setupActions(SKGDocument* iDocument) override;
0045 
0046     /**
0047      * The preference widget of the plugin.
0048      * @return The preference widget of the plugin
0049      */
0050     QWidget* getPreferenceWidget() override;
0051 
0052     /**
0053      * The preference skeleton of the plugin.
0054      * @return The preference skeleton of the plugin
0055      */
0056     KConfigSkeleton* getPreferenceSkeleton() override;
0057 
0058     /**
0059      * Must be modified to refresh widgets after a modification.
0060      */
0061     void refresh() override;
0062 
0063     /**
0064      * The title of the plugin.
0065      * @return The title of the plugin
0066      */
0067     QString title() const override;
0068 
0069     /**
0070      * The icon of the plugin.
0071      * @return The icon of the plugin
0072      */
0073     QString icon() const override;
0074 
0075     /**
0076      * The tips list of the plugin.
0077      * @return The tips list of the plugin
0078      */
0079     QStringList tips() const override;
0080 
0081     /**
0082      * Must be implemented to set the position of the plugin.
0083      * @return integer value between 0 and 999 (default = 999)
0084      */
0085     int getOrder() const override;
0086 
0087     /**
0088      * The dock widget of the plugin.
0089      * @return The dock widget of the plugin
0090      */
0091     QDockWidget* getDockWidget() override;
0092 
0093 private Q_SLOTS:
0094     void importStandardBookmarks();
0095     void goHome();
0096 
0097     void onOpenBookmark();
0098     void onAddBookmark();
0099     void onShowBookmarkMenu();
0100 
0101 private:
0102     Q_DISABLE_COPY(SKGBookmarkPlugin)
0103 
0104     SKGDocument* m_currentDocument;
0105     QDockWidget* m_dockWidget;
0106     QString m_docUniqueIdentifier;
0107     QMenu* m_bookmarkMenu;
0108 
0109     Ui::skgbookmarkplugin_pref ui{};
0110 };
0111 
0112 #endif  // SKGBOOKMARKPLUGIN_H