diff --git a/CMakeLists.txt b/CMakeLists.txt index 20b8519..d222845 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,110 +1,119 @@ cmake_minimum_required(VERSION 3.5) set(KF5_VERSION "5.54.0") # handled by release scripts set(KF5_DEP_VERSION "5.54.0") # handled by release scripts project(KConfigWidgets VERSION ${KF5_VERSION}) include(FeatureSummary) find_package(ECM 5.54.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) set(REQUIRED_QT_VERSION 5.10.0) -find_package(Qt5 "${REQUIRED_QT_VERSION}" CONFIG REQUIRED Widgets DBus) +find_package(Qt5 "${REQUIRED_QT_VERSION}" CONFIG REQUIRED Widgets) +if (NOT ANDROID) + find_package(Qt5 "${REQUIRED_QT_VERSION}" CONFIG REQUIRED DBus) +endif() include(KDEInstallDirs) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) include(GenerateExportHeader) include(ECMSetupVersion) include(ECMGenerateHeaders) include(ECMAddQch) include(ECMQtDeclareLoggingCategory) option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") ecm_setup_version(PROJECT VARIABLE_PREFIX KCONFIGWIDGETS VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kconfigwidgets_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5ConfigWidgetsConfigVersion.cmake" SOVERSION 5) -find_package(KF5Auth ${KF5_DEP_VERSION} REQUIRED) +if (NOT ANDROID) + find_package(KF5Auth ${KF5_DEP_VERSION} REQUIRED) +endif() find_package(KF5CoreAddons ${KF5_DEP_VERSION} REQUIRED) find_package(KF5Codecs ${KF5_DEP_VERSION} REQUIRED) find_package(KF5Config ${KF5_DEP_VERSION} REQUIRED) find_package(KF5DocTools ${KF5_DEP_VERSION}) find_package(KF5GuiAddons ${KF5_DEP_VERSION} REQUIRED) find_package(KF5I18n ${KF5_DEP_VERSION} REQUIRED) find_package(KF5WidgetsAddons ${KF5_DEP_VERSION} REQUIRED) remove_definitions(-DQT_NO_CAST_FROM_ASCII) remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY) add_definitions(-DTRANSLATION_DOMAIN=\"kconfigwidgets5\") if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") ki18n_install(po) if (KF5DocTools_FOUND) kdoctools_install(po) endif() file(GLOB lang_dirs "po/*") foreach(lang_dir ${lang_dirs}) get_filename_component(lang ${lang_dir} NAME) if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/po/${lang}/kf5_entry.desktop") install( FILES po/${lang}/kf5_entry.desktop DESTINATION ${KDE_INSTALL_LOCALEDIR}/${lang} ) endif() endforeach() endif() if (KF5DocTools_FOUND) add_subdirectory(docs) endif() add_subdirectory(src) if (BUILD_TESTING) add_subdirectory(tests) add_subdirectory(autotests) endif() # create a Config.cmake and a ConfigVersion.cmake file and install them set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5ConfigWidgets") if (BUILD_QCH) ecm_install_qch_export( TARGETS KF5ConfigWidgets_QCH FILE KF5ConfigWidgetsQchTargets.cmake DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF5ConfigWidgetsQchTargets.cmake\")") endif() include(CMakePackageConfigHelpers) +set(HAVE_KAUTH FALSE) +if (TARGET KF5::Auth) + set(HAVE_KAUTH TRUE) +endif() configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/KF5ConfigWidgetsConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KF5ConfigWidgetsConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF5ConfigWidgetsConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/KF5ConfigWidgetsConfigVersion.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) install(EXPORT KF5ConfigWidgetsTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5ConfigWidgetsTargets.cmake NAMESPACE KF5:: ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kconfigwidgets_version.h DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel ) # contains list of debug categories, for kdebugsettings install(FILES kconfigwidgets.categories DESTINATION ${KDE_INSTALL_CONFDIR}) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/KF5ConfigWidgetsConfig.cmake.in b/KF5ConfigWidgetsConfig.cmake.in index 8f7ed33..7798963 100644 --- a/KF5ConfigWidgetsConfig.cmake.in +++ b/KF5ConfigWidgetsConfig.cmake.in @@ -1,10 +1,12 @@ @PACKAGE_INIT@ include(CMakeFindDependencyMacro) -find_dependency(KF5Auth "@KF5_DEP_VERSION@") +if (@HAVE_KAUTH@) + find_dependency(KF5Auth "@KF5_DEP_VERSION@") +endif() find_dependency(KF5Codecs "@KF5_DEP_VERSION@") find_dependency(KF5Config "@KF5_DEP_VERSION@") find_dependency(KF5WidgetsAddons "@KF5_DEP_VERSION@") include("${CMAKE_CURRENT_LIST_DIR}/KF5ConfigWidgetsTargets.cmake") @PACKAGE_INCLUDE_QCHTARGETS@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 09fe50b..ba7573a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,139 +1,147 @@ set(kconfigwidgets_SRCS kcodecaction.cpp kcolorscheme.cpp kcolorschememanager.cpp kconfigdialog.cpp kconfigviewstatesaver.cpp kconfigdialogmanager.cpp kcmodule.cpp khelpclient.cpp klanguagebutton.cpp klanguagename.cpp - kpastetextaction.cpp krecentfilesaction.cpp kstandardaction.cpp ktipdialog.cpp ) ecm_qt_declare_logging_category(kconfigwidgets_SRCS HEADER kconfigwidgets_debug.h IDENTIFIER KCONFIG_WIDGETS_LOG CATEGORY_NAME kf5.kconfigwidgets) +if (TARGET Qt5::DBus) + list(APPEND kconfigwidgets_SRCS kpastetextaction.cpp) +endif() qt5_add_resources(kconfigwidgets_SRCS kconfigwidgets.qrc) add_library(KF5ConfigWidgets ${kconfigwidgets_SRCS}) generate_export_header(KF5ConfigWidgets BASE_NAME KConfigWidgets) add_library(KF5::ConfigWidgets ALIAS KF5ConfigWidgets) target_include_directories(KF5ConfigWidgets INTERFACE "$") target_link_libraries(KF5ConfigWidgets PUBLIC KF5::Codecs # KCodecActions uses KCharsets, KEncodingProber KF5::WidgetsAddons # For K*Action, KPage*, KViewStateSerializer, KAcceleratorManager, K*GuiItem KF5::ConfigGui # KStandardAction uses KStandardShortcut - KF5::Auth # KCModule uses KAuth::Action PRIVATE - Qt5::DBus # KPasteTextAction talks to Klipper via DBus KF5::CoreAddons # KCModule uses KAboutData, KTipDialog uses KRandom KF5::GuiAddons # KColorScheme uses KColorUtils KF5::I18n # For action and widget texts ) +if (TARGET KF5::Auth) + target_link_libraries(KF5ConfigWidgets PUBLIC KF5::Auth) # KCModule uses KAuth::Action +else() + target_compile_definitions(KF5ConfigWidgets PUBLIC -DKCONFIGWIDGETS_NO_KAUTH) +endif() +if (TARGET Qt5::DBus) + target_link_libraries(KF5ConfigWidgets PRIVATE Qt5::DBus) # KPasteTextAction talks to Klipper via DBus +endif() set_target_properties(KF5ConfigWidgets PROPERTIES VERSION ${KCONFIGWIDGETS_VERSION_STRING} SOVERSION ${KCONFIGWIDGETS_SOVERSION} EXPORT_NAME ConfigWidgets ) ecm_generate_headers(KConfigWidgets_HEADERS HEADER_NAMES KCodecAction KColorScheme KColorSchemeManager KConfigDialog KConfigViewStateSaver KConfigDialogManager KCModule KHelpClient KLanguageButton KLanguageName KPasteTextAction KRecentFilesAction KViewStateMaintainer KStandardAction KTipDialog REQUIRED_HEADERS KConfigWidgets_HEADERS ) find_package(PythonModuleGeneration) if (PythonModuleGeneration_FOUND) ecm_generate_python_binding( TARGET KF5::ConfigWidgets PYTHONNAMESPACE PyKF5 MODULENAME KConfigWidgets SIP_INCLUDES RULES_FILE "${CMAKE_SOURCE_DIR}/cmake/rules_PyKF5.py" SIP_DEPENDS QtCore/QtCoremod.sip PyKF5/KCodecs/KCodecsmod.sip PyKF5/KWidgetsAddons/KWidgetsAddonsmod.sip PyKF5/KConfigGui/KConfigGuimod.sip PyKF5/KAuth/KAuthmod.sip HEADERS kcodecaction.h kcolorscheme.h kcolorschememanager.h kconfigdialog.h kconfigviewstatesaver.h kconfigdialogmanager.h kcmodule.h khelpclient.h klanguagebutton.h kpastetextaction.h krecentfilesaction.h kviewstatemaintainer.h kstandardaction.h ktipdialog.h ) endif() install(TARGETS KF5ConfigWidgets EXPORT KF5ConfigWidgetsTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kconfigwidgets_export.h ${KConfigWidgets_HEADERS} ktip.h DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KConfigWidgets COMPONENT Devel ) install(PROGRAMS preparetips5 DESTINATION ${KDE_INSTALL_BINDIR} ) install( FILES entry.desktop DESTINATION ${KDE_INSTALL_LOCALEDIR}/en_US RENAME kf5_entry.desktop ) if(BUILD_QCH) ecm_add_qch( KF5ConfigWidgets_QCH NAME KConfigWidgets BASE_NAME KF5ConfigWidgets VERSION ${KF5_VERSION} ORG_DOMAIN org.kde SOURCES # using only public headers, to cover only public API ${KConfigWidgets_HEADERS} MD_MAINPAGE "${CMAKE_SOURCE_DIR}/README.md" IMAGE_DIRS "${CMAKE_SOURCE_DIR}/docs/pics" LINK_QCHS KF5Codecs_QCH KF5WidgetsAddons_QCH KF5Config_QCH KF5Auth_QCH BLANK_MACROS KCONFIGWIDGETS_EXPORT KCONFIGWIDGETS_DEPRECATED KCONFIGWIDGETS_DEPRECATED_EXPORT TAGFILE_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR} QCH_INSTALL_DESTINATION ${KDE_INSTALL_QTQCHDIR} COMPONENT Devel ) endif() include(ECMGeneratePriFile) ecm_generate_pri_file(BASE_NAME KConfigWidgets LIB_NAME KF5ConfigWidgets DEPS "KCodecs KWidgetsAddons KConfigGui KAuth" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/KConfigWidgets) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) diff --git a/src/kcmodule.cpp b/src/kcmodule.cpp index 40bc465..984b882 100644 --- a/src/kcmodule.cpp +++ b/src/kcmodule.cpp @@ -1,305 +1,312 @@ /* This file is part of the KDE libraries Copyright (c) 2001 Michael Goffioul Copyright (C) 2004 Frans Englich Copyright (C) 2009 Dario Freddi This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kcmodule.h" #include "kconfigwidgets_debug.h" #include #include #include #include #include #include #include +#ifndef KCONFIGWIDGETS_NO_KAUTH #include +#endif class KCModulePrivate { public: KCModulePrivate(): _buttons(KCModule::Help | KCModule::Default | KCModule::Apply), _about(nullptr), _useRootOnlyMessage(false), _firstshow(true), _needsAuthorization(false), - _authAction(), _unmanagedWidgetChangeState(false) { } void authStatusChanged(int status); KCModule::Buttons _buttons; const KAboutData *_about; QString _rootOnlyMessage; QList managers; QString _quickHelp; QString m_ExportText; bool _useRootOnlyMessage : 1; bool _firstshow : 1; bool _needsAuthorization : 1; +#ifndef KCONFIGWIDGETS_NO_KAUTH KAuth::Action _authAction; +#endif // this member is used to record the state on non-automatically // managed widgets, allowing for mixed KConfigXT-drive and manual // widgets to coexist peacefully and do the correct thing with // the changed(bool) signal bool _unmanagedWidgetChangeState : 1; }; KCModule::KCModule(const KAboutData *aboutData, QWidget *parent, const QVariantList &) : QWidget(parent), d(new KCModulePrivate) { setAboutData(aboutData); } KCModule::KCModule(QWidget *parent, const QVariantList &) : QWidget(parent), d(new KCModulePrivate) { } void KCModule::showEvent(QShowEvent *ev) { if (d->_firstshow) { d->_firstshow = false; QMetaObject::invokeMethod(this, "load", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "changed", Qt::QueuedConnection, Q_ARG(bool, false)); } QWidget::showEvent(ev); } KCModule::Buttons KCModule::buttons() const { return d->_buttons; } void KCModule::setButtons(Buttons buttons) { d->_buttons = buttons; } KConfigDialogManager *KCModule::addConfig(KCoreConfigSkeleton *config, QWidget *widget) { KConfigDialogManager *manager = new KConfigDialogManager(widget, config); manager->setObjectName(objectName()); connect(manager, &KConfigDialogManager::widgetModified, this, &KCModule::widgetChanged); d->managers.append(manager); return manager; } KConfigDialogManager *KCModule::addConfig(KConfigSkeleton *config, QWidget *widget) { KConfigDialogManager *manager = new KConfigDialogManager(widget, config); manager->setObjectName(objectName()); connect(manager, &KConfigDialogManager::widgetModified, this, &KCModule::widgetChanged); d->managers.append(manager); return manager; } void KCModule::setNeedsAuthorization(bool needsAuth) { d->_needsAuthorization = needsAuth; +#ifndef KCONFIGWIDGETS_NO_KAUTH if (needsAuth && d->_about) { d->_authAction = KAuth::Action(QStringLiteral("org.kde.kcontrol.") + d->_about->componentName() + QStringLiteral(".save")); d->_needsAuthorization = d->_authAction.isValid(); d->_authAction.setHelperId(QStringLiteral("org.kde.kcontrol.") + d->_about->componentName()); d->_authAction.setParentWidget(this); authStatusChanged(d->_authAction.status()); } else { d->_authAction = KAuth::Action(); } +#endif } bool KCModule::needsAuthorization() const { return d->_needsAuthorization; } +#ifndef KCONFIGWIDGETS_NO_KAUTH void KCModule::setAuthAction(const KAuth::Action &action) { if (!action.isValid()) { qCWarning(KCONFIG_WIDGETS_LOG) << "Auth action" << action.name() << "is invalid"; d->_needsAuthorization = false; return; } d->_authAction = action; d->_needsAuthorization = true; d->_authAction.setParentWidget(this); authStatusChanged(d->_authAction.status()); } KAuth::Action KCModule::authAction() const { return d->_authAction; } void KCModule::authStatusChanged(KAuth::Action::AuthStatus status) { switch (status) { case KAuth::Action::AuthorizedStatus: setUseRootOnlyMessage(false); break; case KAuth::Action::AuthRequiredStatus: setUseRootOnlyMessage(true); setRootOnlyMessage(i18n("You will be asked to authenticate before saving")); break; default: setUseRootOnlyMessage(true); setRootOnlyMessage(i18n("You are not allowed to save the configuration")); break; } qCDebug(KCONFIG_WIDGETS_LOG) << useRootOnlyMessage(); } +#endif KCModule::~KCModule() { qDeleteAll(d->managers); d->managers.clear(); delete d->_about; delete d; } void KCModule::load() { KConfigDialogManager *manager; Q_FOREACH (manager, d->managers) { manager->updateWidgets(); } emit changed(false); } void KCModule::save() { KConfigDialogManager *manager; Q_FOREACH (manager, d->managers) { manager->updateSettings(); } emit changed(false); } void KCModule::defaults() { KConfigDialogManager *manager; Q_FOREACH (manager, d->managers) { manager->updateWidgetsDefault(); } } void KCModule::widgetChanged() { emit changed(d->_unmanagedWidgetChangeState || managedWidgetChangeState()); } bool KCModule::managedWidgetChangeState() const { KConfigDialogManager *manager; Q_FOREACH (manager, d->managers) { if (manager->hasChanged()) { return true; } } return false; } void KCModule::unmanagedWidgetChangeState(bool changed) { d->_unmanagedWidgetChangeState = changed; widgetChanged(); } const KAboutData *KCModule::aboutData() const { return d->_about; } void KCModule::setAboutData(const KAboutData *about) { if (about != d->_about) { delete d->_about; d->_about = about; } } void KCModule::setRootOnlyMessage(const QString &message) { d->_rootOnlyMessage = message; emit rootOnlyMessageChanged(d->_useRootOnlyMessage, d->_rootOnlyMessage); } QString KCModule::rootOnlyMessage() const { return d->_rootOnlyMessage; } void KCModule::setUseRootOnlyMessage(bool on) { d->_useRootOnlyMessage = on; emit rootOnlyMessageChanged(d->_useRootOnlyMessage, d->_rootOnlyMessage); } bool KCModule::useRootOnlyMessage() const { return d->_useRootOnlyMessage; } void KCModule::changed() { emit changed(true); } KAboutData KCModule::componentData() const { return *d->_about; } QString KCModule::exportText() const { return d->m_ExportText; } void KCModule::setExportText(const QString &text) { d->m_ExportText = text; } void KCModule::setQuickHelp(const QString &help) { d->_quickHelp = help; emit quickHelpChanged(); } QString KCModule::quickHelp() const { return d->_quickHelp; } QList KCModule::configs() const { return d->managers; } diff --git a/src/kcmodule.h b/src/kcmodule.h index 190256f..e705c94 100644 --- a/src/kcmodule.h +++ b/src/kcmodule.h @@ -1,446 +1,452 @@ /* This file is part of the KDE libraries Copyright (c) 1999 Matthias Hoelzer-Kluepfel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KCMODULE_H #define KCMODULE_H #include +#ifndef KCONFIGWIDGETS_NO_KAUTH #include +#endif #include #include class QStringList; class KAboutData; class KConfigDialogManager; class KCoreConfigSkeleton; class KConfigSkeleton; class KCModulePrivate; /** * @class KCModule kcmodule.h KCModule * * The base class for configuration modules. * * Configuration modules are realized as plugins that are loaded only when * needed. * * The module in principle is a simple widget displaying the * item to be changed. The module has a very small interface. * * All the necessary glue logic and the GUI bells and whistles * are provided by the control center and must not concern * the module author. * * To write a config module, you have to create a library * that contains a factory function like the following: * * \code * #include * * K_PLUGIN_FACTORY(MyKCModuleFactory, registerPlugin() ) * \endcode * * The constructor of the KCModule then looks like this: * \code * YourKCModule::YourKCModule( QWidget* parent ) * : KCModule( parent ) * { * KAboutData *about = new KAboutData( * , i18n( "..." ), * KDE_VERSION_STRING, QString(), KAboutLicense::GPL, * i18n( "Copyright 2006 ..." ) ); * about->addAuthor( i18n(...) ); * setAboutData( about ); * . * . * . * } * \endcode * * If you want to make the KCModule available only conditionally (i.e. show in * the list of available modules only if some test succeeds) then you can use * Hidden in the .desktop file. An example: * \code * Hidden[$e]=$(if test -e /dev/js*; then echo "false"; else echo "true"; fi) * \endcode * The example executes the given code in a shell and uses the stdout output for * the Hidden value (so it's either Hidden=true or Hidden=false). * * See http://techbase.kde.org/Development/Tutorials/KCM_HowTo * for more detailed documentation. * * @author Matthias Hoelzer-Kluepfel */ class KCONFIGWIDGETS_EXPORT KCModule : public QWidget { Q_OBJECT public: /** * An enumeration type for the buttons used by this module. * You should only use Help, Default and Apply. The rest is obsolete. * NoAdditionalButton can be used when we do not want have other button that Ok Cancel * * @see KCModule::buttons @see KCModule::setButtons */ enum Button { NoAdditionalButton = 0, Help = 1, Default = 2, Apply = 4, Export = 8 }; Q_DECLARE_FLAGS(Buttons, Button) /** * Base class for all KControlModules. * * @note do not emit changed signals here, since they are not yet connected * to any slot. * @param aboutData becomes owned by the KCModule */ explicit KCModule(const KAboutData *aboutData, QWidget *parent = nullptr, const QVariantList &args = QVariantList()); /** * Base class for all KControlModules. * * @note do not emit changed signals here, since they are not yet connected * to any slot. */ explicit KCModule(QWidget *parent = nullptr, const QVariantList &args = QVariantList()); /** * Destroys the module. */ ~KCModule() override; /** * Return a quick-help text. * * This method is called when the module is docked. * The quick-help text should contain a short description of the module and * links to the module's help files. You can use QML formatting tags in the text. * * @note make sure the quick help text gets translated (use i18n()). */ virtual QString quickHelp() const; /** * This is generally only called for the KBugReport. * If you override you should have it return a pointer to a constant. * * * @returns the KAboutData for this module */ virtual const KAboutData *aboutData() const; /** * This sets the KAboutData returned by aboutData() * The about data is now owned by KCModule. */ void setAboutData(const KAboutData *about); /** * Indicate which buttons will be used. * * The return value is a value or'ed together from * the Button enumeration type. * * @see KCModule::setButtons */ Buttons buttons() const; /** * Get the RootOnly message for this module. * * When the module must be run as root, or acts differently * for root and a normal user, it is sometimes useful to * customize the message that appears at the top of the module * when used as a normal user. This function returns this * customized message. If none has been set, a default message * will be used. * * @see KCModule::setRootOnlyMessage */ QString rootOnlyMessage() const; /** * Tell if KControl should show a RootOnly message when run as * a normal user. * * In some cases, the module don't want a RootOnly message to * appear (for example if it has already one). This function * tells KControl if a RootOnly message should be shown * * @see KCModule::setUseRootOnlyMessage */ bool useRootOnlyMessage() const; KAboutData componentData() const; /** * @return a list of @ref KConfigDialogManager's in use, if any. */ QList configs() const; /** * @brief Set if the module's save() method requires authorization to be executed. * * The module can set this property to @c true if it requires authorization. * It will still have to execute the action itself using the KAuth library, so * this method is not technically needed to perform the action, but * using this and/or the setAuthAction() method will ensure that hosting * applications like System Settings or kcmshell behave correctly. * * Called with @c true, this method will set the action to "org.kde.kcontrol.name.save" where * "name" is aboutData()->appName() return value. This default action won't be set if * the aboutData() object is not valid. * * Note that called with @c false, this method will reset the action name set with setAuthAction(). * * @param needsAuth Tells if the module's save() method requires authorization to be executed. */ void setNeedsAuthorization(bool needsAuth); /** * Returns the value previously set with setNeedsAuthorization() or setAuthAction(). By default it's @c false. * * @return @c true if the module's save() method requires authorization, @c false otherwise */ bool needsAuthorization() const; +#ifndef KCONFIGWIDGETS_NO_KAUTH /** * @brief Set if the module's save() method requires authorization to be executed * * It will still have to execute the action itself using the KAuth library, so * this method is not technically needed to perform the action, but * using this method will ensure that hosting * applications like System Settings or kcmshell behave correctly. * * @param action the action that will be used by this KCModule */ void setAuthAction(const KAuth::Action &action); /** * Returns the action previously set with setAuthAction(). By default its an invalid action. * * @return The action that has to be authorized to execute the save() method. */ KAuth::Action authAction() const; +#endif /** * Returns the value set by setExportText(); * @deprecated since 5.0, obsolete feature */ KCONFIGWIDGETS_DEPRECATED QString exportText() const; /** * Sets the export QString value, used for exporting data. * @deprecated since 5.0, obsolete feature */ KCONFIGWIDGETS_DEPRECATED void setExportText(const QString &); public Q_SLOTS: /** * Load the configuration data into the module. * * The load method sets the user interface elements of the * module to reflect the current settings stored in the * configuration files. * * This method is invoked whenever the module should read its configuration * (most of the times from a config file) and update the user interface. * This happens when the user clicks the "Reset" button in the control * center, to undo all of his changes and restore the currently valid * settings. It is also called right after construction. */ virtual void load(); /** * Save the configuration data. * * The save method stores the config information as shown * in the user interface in the config files. * * If necessary, this method also updates the running system, * e.g. by restarting applications. This normally does not apply for * KSettings::Dialog modules where the updating is taken care of by * KSettings::Dispatcher. * * save is called when the user clicks "Apply" or "Ok". * * If you use KConfigXT, saving is taken care off automatically and * you do not need to load manually. However, if you for some reason reimplement it and * also are using KConfigXT, you must call this function, otherwise the saving of KConfigXT * options will not work. Call it at the very end of your reimplementation, to avoid * changed() signals getting emitted when you modify widgets. */ virtual void save(); /** * Sets the configuration to sensible default values. * * This method is called when the user clicks the "Default" * button. It should set the display to useful values. * * If you use KConfigXT, you do not have to reimplement this function since * the fetching and settings of default values is done automatically. However, if you * reimplement and also are using KConfigXT, remember to call the base function at the * very end of your reimplementation. */ virtual void defaults(); protected: /** * Adds a KCoreConfigskeleton @p config to watch the widget @p widget * * This function is useful if you need to handle multiple configuration files. * * @return a pointer to the KCoreConfigDialogManager in use * @param config the KCoreConfigSkeleton to use * @param widget the widget to watch */ KConfigDialogManager *addConfig(KCoreConfigSkeleton *config, QWidget *widget); /** * Adds a KConfigskeleton @p config to watch the widget @p widget * * This function is useful if you need to handle multiple configuration files. * * @return a pointer to the KConfigDialogManager in use * @param config the KConfigSkeleton to use * @param widget the widget to watch */ KConfigDialogManager *addConfig(KConfigSkeleton *config, QWidget *widget); /** * Sets the quick help. */ void setQuickHelp(const QString &help); void showEvent(QShowEvent *ev) override; friend class KCModuleProxy; Q_SIGNALS: /** * Indicate that the state of the modules contents has changed. * * This signal is emitted whenever the state of the configuration * shown in the module changes. It allows the module container to * keep track of unsaved changes. */ void changed(bool state); /** * Indicate that the module's quickhelp has changed. * * Emit this signal whenever the module's quickhelp changes. * Modules implemented as tabbed dialogs might want to implement * per-tab quickhelp for example. * */ void quickHelpChanged(); /** * Indicate that the module's root message has changed. * * Emits this signal whenever the module's root message changes. * * @since 4.4 * */ void rootOnlyMessageChanged(bool use, QString message); protected Q_SLOTS: /** * Calling this slot is equivalent to emitting changed(true). */ void changed(); /** * A managed widget was changed, the widget settings and the current * settings are compared and a corresponding changed() signal is emitted */ void widgetChanged(); +#ifndef KCONFIGWIDGETS_NO_KAUTH /** * The status of the auth action, if one, has changed */ void authStatusChanged(KAuth::Action::AuthStatus status); +#endif protected: /** * Sets the buttons to display. * * Help: shows a "Help" button. * * Default: shows a "Use Defaults" button. * * Apply: in kcontrol this will show an "Apply" and "Reset" button, * in kcmshell this will show an "Ok", "Apply" and "Cancel" button. * * If Apply is not specified, kcmshell will show a "Close" button. * * @see KCModule::buttons */ void setButtons(Buttons btn); /** * Sets the RootOnly message. * * This message will be shown at the top of the module if useRootOnlyMessage is * set. If no message is set, a default one will be used. * * @see KCModule::rootOnlyMessage */ void setRootOnlyMessage(const QString &message); /** * Change whether or not the RootOnly message should be shown. * * Following the value of @p on, the RootOnly message will be * shown or not. * * @see KCModule::useRootOnlyMessage */ void setUseRootOnlyMessage(bool on); /** * Returns the changed state of automatically managed widgets in this dialog */ bool managedWidgetChangeState() const; /** * Call this method when your manually managed widgets change state between * changed and not changed */ void unmanagedWidgetChangeState(bool); private: KCModulePrivate *const d; }; Q_DECLARE_OPERATORS_FOR_FLAGS(KCModule::Buttons) #endif //KCMODULE_H diff --git a/src/kstandardaction.cpp b/src/kstandardaction.cpp index 8ca7034..a449c4a 100644 --- a/src/kstandardaction.cpp +++ b/src/kstandardaction.cpp @@ -1,732 +1,732 @@ /* This file is part of the KDE libraries Copyright (C) 1999,2000 Kurt Granroth This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kstandardaction.h" #include "kstandardaction_p.h" #include "moc_kstandardaction_p.cpp" #include "kconfigwidgets_debug.h" #include #include #include #include #include #include #include #include #include #include #include "kdualaction.h" #include "kpastetextaction.h" namespace KStandardAction { AutomaticAction::AutomaticAction(const QIcon &icon, const QString &text, const QList &shortcut, const char *slot, QObject *parent) : QAction(parent) { setText(text); setIcon(icon); setShortcuts(shortcut); setProperty("defaultShortcuts", QVariant::fromValue(shortcut)); connect(this, SIGNAL(triggered()), this, slot); } QStringList stdNames() { return internal_stdNames(); } QList actionIds() { QList result; for (uint i = 0; g_rgActionInfo[i].id != ActionNone; i++) { result.append(g_rgActionInfo[i].id); } return result; } KStandardShortcut::StandardShortcut shortcutForActionId(StandardAction id) { const KStandardActionInfo *pInfo = infoPtr(id); return (pInfo) ? pInfo->idAccel : KStandardShortcut::AccelNone; } class ShowMenubarActionFilter : public QObject { public: ShowMenubarActionFilter(QAction *parent) : QObject(parent) , wasNative(false) , wasChecked(false) , wasVisible(false) { } bool eventFilter(QObject * /*watched*/, QEvent *e) override { if (e->type() == QEvent::Show) { updateAction(); } return false; } void updateAction() { bool allMenuBarsNative = true; bool hasAnyMenuBar = false; foreach(QWidget *w, qApp->topLevelWidgets()) { QMainWindow *mw = qobject_cast(w); if (mw) { mw->installEventFilter(this); // this is just in case a new main window appeared // if we were filtering it already it is almost a noop if (mw->layout() && mw->layout()->menuBar()) { QMenuBar *mb = qobject_cast(mw->layout()->menuBar()); if (mb) { hasAnyMenuBar = true; if (!mb->isNativeMenuBar()) { allMenuBarsNative = false; } } } } } if (!hasAnyMenuBar) return; QAction *showMenubarAction = static_cast(parent()); if (allMenuBarsNative && !wasNative) { wasNative = true; wasChecked = showMenubarAction->isChecked(); wasVisible = showMenubarAction->isVisible(); showMenubarAction->setChecked(true); showMenubarAction->setVisible(false); } else if (!allMenuBarsNative && wasNative) { showMenubarAction->setChecked(wasChecked); showMenubarAction->setVisible(wasVisible); } } bool wasNative; bool wasChecked; bool wasVisible; }; QAction* _k_createInternal(StandardAction id, QObject *parent) { static bool stdNamesInitialized = false; if (!stdNamesInitialized) { KAcceleratorManager::addStandardActionNames(stdNames()); stdNamesInitialized = true; } QAction *pAction = nullptr; const KStandardActionInfo *pInfo = infoPtr(id); // qCDebug(KCONFIG_WIDGETS_LOG) << "KStandardAction::create( " << id << "=" << (pInfo ? pInfo->psName : (const char*)0) << ", " << parent << " )"; // ellis if (pInfo) { QString sLabel, iconName = pInfo->psIconName; switch (id) { case Back: sLabel = i18nc("go back", "&Back"); if (QApplication::isRightToLeft()) { iconName = QStringLiteral("go-next"); } break; case Forward: sLabel = i18nc("go forward", "&Forward"); if (QApplication::isRightToLeft()) { iconName = QStringLiteral("go-previous"); } break; case Home: sLabel = i18nc("home page", "&Home"); break; case Help: sLabel = i18nc("show help", "&Help"); break; case Preferences: case AboutApp: case HelpContents: { QString appDisplayName = QGuiApplication::applicationDisplayName(); if (appDisplayName.isEmpty()) { appDisplayName = QCoreApplication::applicationName(); } sLabel = i18n(pInfo->psLabel, appDisplayName); } break; default: sLabel = i18n(pInfo->psLabel); } if (QApplication::isRightToLeft()) { switch (id) { case Prior: iconName = QStringLiteral("go-next-view-page"); break; case Next: iconName = QStringLiteral("go-previous-view-page"); break; case FirstPage: iconName = QStringLiteral("go-last-view-page"); break; case LastPage: iconName = QStringLiteral("go-first-view-page"); break; case DocumentBack: iconName = QStringLiteral("go-next"); break; case DocumentForward: iconName = QStringLiteral("go-previous"); break; default: break; } } QIcon icon = iconName.isEmpty() ? QIcon() : QIcon::fromTheme(iconName); switch (id) { case OpenRecent: pAction = new KRecentFilesAction(parent); break; case ShowMenubar: { pAction = new KToggleAction(parent); pAction->setWhatsThis(i18n("Show Menubar

" "Shows the menubar again after it has been hidden

")); pAction->setChecked(true); ShowMenubarActionFilter *mf = new ShowMenubarActionFilter(pAction); foreach(QWidget *w, qApp->topLevelWidgets()) { if (qobject_cast(w)) { w->installEventFilter(mf); } } mf->updateAction(); break; } case ShowToolbar: pAction = new KToggleAction(parent); pAction->setChecked(true); break; case ShowStatusbar: pAction = new KToggleAction(parent); pAction->setWhatsThis(i18n("Show Statusbar

" "Shows the statusbar, which is the bar at the bottom of the window used for status information.

")); pAction->setChecked(true); break; case FullScreen: pAction = new KToggleFullScreenAction(parent); pAction->setCheckable(true); break; -#ifndef KDE_NO_DEPRECATED +#if !defined(KDE_NO_DEPRECATED) && defined(QT_DBUS_LIB) case PasteText: pAction = new KPasteTextAction(parent); break; #endif // Same as default, but with the app icon case AboutApp: { pAction = new QAction(parent); icon = qApp->windowIcon(); if (icon.isNull()) { const KAboutData data = KAboutData::applicationData(); if (!data.programIconName().isEmpty()) { icon = QIcon::fromTheme(data.programIconName()); } } break; } default: pAction = new QAction(parent); break; } // Set the text before setting the MenuRole, as on OS X setText will do some heuristic role guessing. // This ensures user menu items get the intended role out of the list below. pAction->setText(sLabel); switch (id) { case Quit: pAction->setMenuRole(QAction::QuitRole); break; case Preferences: pAction->setMenuRole(QAction::PreferencesRole); break; case AboutApp: pAction->setMenuRole(QAction::AboutRole); break; default: pAction->setMenuRole(QAction::NoRole); break; } if (pInfo->psToolTip) { pAction->setToolTip(i18n(pInfo->psToolTip)); } pAction->setIcon(icon); QList cut = KStandardShortcut::shortcut(pInfo->idAccel); if (!cut.isEmpty()) { // emulate KActionCollection::setDefaultShortcuts to allow the use of "configure shortcuts" pAction->setShortcuts(cut); pAction->setProperty("defaultShortcuts", QVariant::fromValue(cut)); } pAction->setObjectName(pInfo->psName); } if (pAction && parent && parent->inherits("KActionCollection")) { QMetaObject::invokeMethod(parent, "addAction", Q_ARG(QString, pAction->objectName()), Q_ARG(QAction*, pAction)); } return pAction; } QAction *create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent) { QAction* pAction = _k_createInternal(id, parent); if (recvr && slot) { if (id == OpenRecent) { // FIXME QAction port: probably a good idea to find a cleaner way to do this // Open Recent is a special case - provide the selected URL QObject::connect(pAction, SIGNAL(urlSelected(QUrl)), recvr, slot); } else if (id == ConfigureToolbars) { // #200815 QObject::connect(pAction, SIGNAL(triggered(bool)), recvr, slot, Qt::QueuedConnection); } else { QObject::connect(pAction, SIGNAL(triggered(bool)), recvr, slot); } } return pAction; } const char *name(StandardAction id) { const KStandardActionInfo *pInfo = infoPtr(id); return (pInfo) ? pInfo->psName : nullptr; } QAction *openNew(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(New, recvr, slot, parent); } QAction *open(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Open, recvr, slot, parent); } KRecentFilesAction *openRecent(const QObject *recvr, const char *slot, QObject *parent) { return (KRecentFilesAction *) KStandardAction::create(OpenRecent, recvr, slot, parent); } QAction *save(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Save, recvr, slot, parent); } QAction *saveAs(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(SaveAs, recvr, slot, parent); } QAction *revert(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Revert, recvr, slot, parent); } QAction *print(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Print, recvr, slot, parent); } QAction *printPreview(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(PrintPreview, recvr, slot, parent); } QAction *close(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Close, recvr, slot, parent); } QAction *mail(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Mail, recvr, slot, parent); } QAction *quit(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Quit, recvr, slot, parent); } QAction *undo(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Undo, recvr, slot, parent); } QAction *redo(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Redo, recvr, slot, parent); } QAction *cut(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Cut, recvr, slot, parent); } QAction *copy(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Copy, recvr, slot, parent); } QAction *paste(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Paste, recvr, slot, parent); } #ifndef KDE_NO_DEPRECATED QAction *pasteText(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(PasteText, recvr, slot, parent); } #endif QAction *clear(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Clear, recvr, slot, parent); } QAction *selectAll(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(SelectAll, recvr, slot, parent); } QAction *deselect(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Deselect, recvr, slot, parent); } QAction *find(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Find, recvr, slot, parent); } QAction *findNext(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(FindNext, recvr, slot, parent); } QAction *findPrev(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(FindPrev, recvr, slot, parent); } QAction *replace(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Replace, recvr, slot, parent); } QAction *actualSize(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(ActualSize, recvr, slot, parent); } QAction *fitToPage(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(FitToPage, recvr, slot, parent); } QAction *fitToWidth(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(FitToWidth, recvr, slot, parent); } QAction *fitToHeight(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(FitToHeight, recvr, slot, parent); } QAction *zoomIn(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(ZoomIn, recvr, slot, parent); } QAction *zoomOut(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(ZoomOut, recvr, slot, parent); } QAction *zoom(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Zoom, recvr, slot, parent); } QAction *redisplay(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Redisplay, recvr, slot, parent); } QAction *up(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Up, recvr, slot, parent); } QAction *back(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Back, recvr, slot, parent); } QAction *forward(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Forward, recvr, slot, parent); } QAction *home(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Home, recvr, slot, parent); } QAction *prior(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Prior, recvr, slot, parent); } QAction *next(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Next, recvr, slot, parent); } QAction *goTo(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Goto, recvr, slot, parent); } QAction *gotoPage(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(GotoPage, recvr, slot, parent); } QAction *gotoLine(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(GotoLine, recvr, slot, parent); } QAction *firstPage(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(FirstPage, recvr, slot, parent); } QAction *lastPage(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(LastPage, recvr, slot, parent); } QAction *documentBack(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(DocumentBack, recvr, slot, parent); } QAction *documentForward(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(DocumentForward, recvr, slot, parent); } QAction *addBookmark(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(AddBookmark, recvr, slot, parent); } QAction *editBookmarks(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(EditBookmarks, recvr, slot, parent); } QAction *spelling(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Spelling, recvr, slot, parent); } static QAction *buildAutomaticAction(QObject *parent, StandardAction id, const char *slot) { const KStandardActionInfo *p = infoPtr(id); if (!p) { return nullptr; } AutomaticAction *action = new AutomaticAction( QIcon::fromTheme(p->psIconName), i18n(p->psLabel), KStandardShortcut::shortcut(p->idAccel), slot, parent); action->setObjectName(p->psName); if (p->psToolTip) { action->setToolTip(i18n(p->psToolTip)); } if (parent && parent->inherits("KActionCollection")) { QMetaObject::invokeMethod(parent, "addAction", Q_ARG(QString, action->objectName()), Q_ARG(QAction*, action)); } return action; } QAction *cut(QObject *parent) { return buildAutomaticAction(parent, Cut, SLOT(cut())); } QAction *copy(QObject *parent) { return buildAutomaticAction(parent, Copy, SLOT(copy())); } QAction *paste(QObject *parent) { return buildAutomaticAction(parent, Paste, SLOT(paste())); } QAction *clear(QObject *parent) { return buildAutomaticAction(parent, Clear, SLOT(clear())); } QAction *selectAll(QObject *parent) { return buildAutomaticAction(parent, SelectAll, SLOT(selectAll())); } KToggleAction *showMenubar(const QObject *recvr, const char *slot, QObject *parent) { QAction* ret = KStandardAction::create(ShowMenubar, recvr, slot, parent); Q_ASSERT(qobject_cast(ret)); return static_cast(ret); } KToggleAction *showStatusbar(const QObject *recvr, const char *slot, QObject *parent) { QAction* ret = KStandardAction::create(ShowStatusbar, recvr, slot, parent); Q_ASSERT(qobject_cast(ret)); return static_cast(ret); } KToggleFullScreenAction *fullScreen(const QObject *recvr, const char *slot, QWidget *window, QObject *parent) { KToggleFullScreenAction *ret; ret = static_cast< KToggleFullScreenAction * >(KStandardAction::create(FullScreen, recvr, slot, parent)); ret->setWindow(window); return ret; } #ifndef KDE_NO_DEPRECATED QAction *saveOptions(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(SaveOptions, recvr, slot, parent); } #endif QAction *keyBindings(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(KeyBindings, recvr, slot, parent); } QAction *preferences(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Preferences, recvr, slot, parent); } QAction *configureToolbars(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(ConfigureToolbars, recvr, slot, parent); } QAction *configureNotifications(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(ConfigureNotifications, recvr, slot, parent); } #ifndef KDE_NO_DEPRECATED QAction *help(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Help, recvr, slot, parent); } #endif QAction *helpContents(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(HelpContents, recvr, slot, parent); } QAction *whatsThis(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(WhatsThis, recvr, slot, parent); } QAction *tipOfDay(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(TipofDay, recvr, slot, parent); } QAction *reportBug(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(ReportBug, recvr, slot, parent); } QAction *switchApplicationLanguage(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(SwitchApplicationLanguage, recvr, slot, parent); } QAction *aboutApp(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(AboutApp, recvr, slot, parent); } QAction *aboutKDE(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(AboutKDE, recvr, slot, parent); } QAction *deleteFile(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(DeleteFile, recvr, slot, parent); } QAction *renameFile(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(RenameFile, recvr, slot, parent); } QAction *moveToTrash(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(MoveToTrash, recvr, slot, parent); } QAction *donate(const QObject *recvr, const char *slot, QObject *parent) { return KStandardAction::create(Donate, recvr, slot, parent); } }