1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2016 The Qt Company Ltd. 4 ** Contact: https://www.qt.io/licensing/ 5 ** 6 ** This file is part of the Assistant module of the Qt Toolkit. 7 ** 8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 ** Commercial License Usage 10 ** Licensees holding valid commercial Qt licenses may use this file in 11 ** accordance with the commercial license agreement provided with the 12 ** Software or, alternatively, in accordance with the terms contained in 13 ** a written agreement between you and The Qt Company. For licensing terms 14 ** and conditions see https://www.qt.io/terms-conditions. For further 15 ** information use the contact form at https://www.qt.io/contact-us. 16 ** 17 ** GNU General Public License Usage 18 ** Alternatively, this file may be used under the terms of the GNU 19 ** General Public License version 3 as published by the Free Software 20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 ** included in the packaging of this file. Please review the following 22 ** information to ensure the GNU General Public License requirements will 23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 ** 25 ** $QT_END_LICENSE$ 26 ** 27 ****************************************************************************/ 28 29 #ifndef GLOBALACTIONS_H 30 #define GLOBALACTIONS_H 31 32 #include <QtCore/QList> 33 #include <QtCore/QObject> 34 #include <QtGui/qtguiglobal.h> 35 36 QT_BEGIN_NAMESPACE 37 38 class QAction; 39 class QMenu; 40 41 class GlobalActions : public QObject 42 { 43 Q_OBJECT 44 Q_DISABLE_COPY(GlobalActions) 45 public: 46 static GlobalActions *instance(QObject *parent = nullptr); 47 actionList()48 QList<QAction *> actionList() const { return m_actionList; } backAction()49 QAction *backAction() const { return m_backAction; } nextAction()50 QAction *nextAction() const { return m_nextAction; } homeAction()51 QAction *homeAction() const { return m_homeAction; } zoomInAction()52 QAction *zoomInAction() const { return m_zoomInAction; } zoomOutAction()53 QAction *zoomOutAction() const { return m_zoomOutAction; } 54 #if QT_CONFIG(clipboard) copyAction()55 QAction *copyAction() const { return m_copyAction; } 56 #endif printAction()57 QAction *printAction() const { return m_printAction; } findAction()58 QAction *findAction() const { return m_findAction; } 59 60 public slots: 61 #if QT_CONFIG(clipboard) 62 void setCopyAvailable(bool available); 63 #endif 64 void updateActions(); 65 66 #if defined(BROWSER_QTWEBKIT) 67 private slots: 68 void slotAboutToShowBackMenu(); 69 void slotAboutToShowNextMenu(); 70 void slotOpenActionUrl(QAction *action); 71 #endif // BROWSER_QTWEBKIT 72 73 private: 74 void setupNavigationMenus(QAction *back, QAction *next, QWidget *parent); 75 76 private: 77 GlobalActions(QObject *parent); 78 79 static GlobalActions *m_instance; 80 81 QAction *m_backAction; 82 QAction *m_nextAction; 83 QAction *m_homeAction; 84 QAction *m_zoomInAction; 85 QAction *m_zoomOutAction; 86 #if QT_CONFIG(clipboard) 87 QAction *m_copyAction; 88 #endif 89 QAction *m_printAction; 90 QAction *m_findAction; 91 92 QList<QAction *> m_actionList; 93 94 QMenu *m_backMenu; 95 QMenu *m_nextMenu; 96 }; 97 98 QT_END_NAMESPACE 99 100 #endif // GLOBALACTIONS_H 101