File indexing completed on 2024-04-28 15:29:05
0001 /* 0002 SPDX-FileCopyrightText: 2021 Oleg Solovyov <mcpain@altlinux.org> 0003 SPDX-FileCopyrightText: 2021 Alexander Lohnau <alexander.lohnau@gmx.de> 0004 0005 SPDX-License-Identifier: LGPL-2.1-or-later 0006 */ 0007 0008 #ifndef KNEWSTUFF3ACTION_H 0009 #define KNEWSTUFF3ACTION_H 0010 0011 #include <QAction> 0012 0013 #include "KNS3/Entry" 0014 #include "KNSCore/EntryInternal" 0015 #include "knewstuffwidgets_export.h" 0016 0017 namespace KNSCore 0018 { 0019 using Entry = KNSCore::EntryInternal; 0020 } 0021 0022 namespace KNSWidgets 0023 { 0024 class ActionPrivate; 0025 /** 0026 * @class Action action.h <KNSWidgets/Action> 0027 * 0028 * Shows the KNS3::QtQuickDialogWrapper when the action is triggered. 0029 * If GHNS is disabled using KAuthorized, it is hidden. 0030 * 0031 * @since 5.90 0032 */ 0033 class KNEWSTUFFWIDGETS_EXPORT Action : public QAction 0034 { 0035 Q_OBJECT 0036 0037 public: 0038 /** 0039 * Constructor used when the details of the KHotNewStuff 0040 * download is known when the action is created. 0041 * 0042 * @param text describing what is being downloaded. 0043 * It should be a text beginning with "Download New ..." for consistency 0044 * @param configFile the name of the .knsrc file 0045 * @param parent the parent object 0046 */ 0047 Action(const QString &text, const QString &configFile, QObject *parent); 0048 0049 ~Action(); 0050 0051 /** 0052 * set the name of the .knsrc file to use 0053 */ 0054 void setConfigFile(const QString &configFile); 0055 0056 Q_SIGNALS: 0057 /** 0058 * emitted when the Hot New Stuff dialog is about to be shown, usually 0059 * as a result of the user having click on the action 0060 */ 0061 void aboutToShowDialog(); 0062 0063 #if KNEWSTUFFWIDGETS_ENABLE_DEPRECATED_SINCE(5, 90) 0064 /// emitted when the Hot New Stuff dialog has been closed 0065 void dialogFinished(const KNS3::Entry::List &changedEntries); 0066 #endif 0067 // Only show this overload when we hide deprecated methods or build the lib 0068 #if !KNEWSTUFFWIDGETS_ENABLE_DEPRECATED_SINCE(5, 90) || defined(KNEWSTUFFWIDGETS_PRIVATE_BUILDING) 0069 /** 0070 * Emitted when the Hot New Stuff dialog has been closed. 0071 * This signal is only visible when hiding API deprecated in version 5.90 or newer 0072 * (5.90, not 5.91, due to an unrevertable mistake). 0073 * For that use @c KNEWSTUFFWIDGETS_DISABLE_DEPRECATED_BEFORE_AND_AT or @c KF_DISABLE_DEPRECATED_BEFORE_AND_AT 0074 * with a version hex number of 5.90.0 or newer, e.g. by using the CMake module ECMDeprecationSettings with 0075 * @code 0076 * ecm_set_disabled_deprecation_versions( 0077 * KNEWSTUFFWIDGETS 5.90 # or newer 0078 * ) 0079 * @endcode 0080 * or 0081 * @code 0082 * ecm_set_disabled_deprecation_versions( 0083 * KF 5.90 # or newer 0084 * ) 0085 * @endcode 0086 * 0087 * @since 5.91 0088 */ 0089 void dialogFinished(const QList<KNSCore::Entry> &changedEntries); 0090 #endif 0091 0092 private Q_SLOTS: 0093 KNEWSTUFFWIDGETS_NO_EXPORT void showDialog(); 0094 0095 private: 0096 void init(); 0097 0098 std::unique_ptr<ActionPrivate> d; 0099 }; 0100 0101 } 0102 0103 #endif // KNEWSTUFFACTION_H