Commit 7661b155 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Add xmlgui to kritawidget_utils

KXMLGui is a Tier 3 framework, so it has more deps than we can use.
it's possible to cut it down, but the review request hasn't gone
forward, and I need to start building windows and osx packages soon.
parent 1f0d1b56
......@@ -205,7 +205,7 @@ find_package(KF5 ${MIN_FRAMEWORKS_VERSION} REQUIRED COMPONENTS
ItemModels
ItemViews
WidgetsAddons
XmlGui
WindowSystem
OPTIONAL_COMPONENTS
KIO
)
......@@ -230,6 +230,7 @@ find_package(Qt5 ${MIN_QT_VERSION} REQUIRED COMPONENTS
DBus
)
set(HAVE_DBUS QT5DBus_FOUND)
set(QT_QTQUICK_FOUND ${Qt5Quick_FOUND})
set(QT_QTTEST_LIBRARY Qt5::Test)
......@@ -540,7 +541,11 @@ include_directories(${KOVERSION_INCLUDES})
set(KOPLUGIN_INCLUDES ${CMAKE_SOURCE_DIR}/libs/koplugin)
set(KUNDO2_INCLUDES ${CMAKE_SOURCE_DIR}/libs/kundo2
${CMAKE_BINARY_DIR}/libs/kundo2)
${CMAKE_BINARY_DIR}/libs/kundo2
${CMAKE_SOURCE_DIR}/libs/widgetutils
${CMAKE_SOURCE_DIR}/libs/widgetutils/config
${CMAKE_SOURCE_DIR}/libs/widgetutils/xmlgui
)
# koodf is at the bottom of the stack
set(KOODF_INCLUDES ${CMAKE_SOURCE_DIR}/libs/odf
......@@ -566,8 +571,6 @@ set(FLAKE_INCLUDES ${CMAKE_SOURCE_DIR}/libs/flake
${KOODF_INCLUDES}
${PIGMENT_INCLUDES}
${KUNDO2_INCLUDES}
${CMAKE_SOURCE_DIR}/libs/widgetutils
${CMAKE_SOURCE_DIR}/libs/widgetutils/config
${CMAKE_SOURCE_DIR}/libs/flake/commands
${CMAKE_SOURCE_DIR}/libs/flake/tools
${CMAKE_SOURCE_DIR}/libs/flake/svg
......
......@@ -48,12 +48,16 @@
/* Defines if we use lcms2 */
#cmakedefine HAVE_LCMS2 1
/* Defines if we use lcms2.4 */
#cmakedefine HAVE_LCMS24 1
/* Defines if KIO is present */
#cmakedefine HAVE_KIO 1
/* Defines if DBUS is present */
#cmakedefine HAVE_DBUS 1
/* This file contains all the paths that change when changing the installation prefix */
#define CALLIGRAPREFIX "${CMAKE_INSTALL_PREFIX}"
......@@ -73,6 +73,7 @@
#include <kxmlguifactory.h>
#include <kxmlguiclient.h>
#include <kguiitem.h>
#include <kwindowconfig.h>
#include "KoDockFactoryBase.h"
#include "KoDockWidgetTitleBar.h"
......@@ -1115,7 +1116,7 @@ void KisMainWindow::saveWindowSettings()
if (d->windowSizeDirty ) {
dbgUI << "KisMainWindow::saveWindowSettings";
KConfigGroup group = config->group("MainWindow");
saveWindowSize(group);
KWindowConfig::saveWindowSize(windowHandle(), group);
config->sync();
d->windowSizeDirty = false;
}
......@@ -2184,40 +2185,38 @@ void KisMainWindow::initializeGeometry()
// if the user didn's specify the geometry on the command line (does anyone do that still?),
// we first figure out some good default size and restore the x,y position. See bug 285804Z.
KConfigGroup cfg( KSharedConfig::openConfig(), "MainWindow");
if (!initialGeometrySet()) {
QByteArray geom = QByteArray::fromBase64(cfg.readEntry("ko_geometry", QByteArray()));
if (!restoreGeometry(geom)) {
const int scnum = QApplication::desktop()->screenNumber(parentWidget());
QRect desk = QApplication::desktop()->availableGeometry(scnum);
// if the desktop is virtual then use virtual screen size
if (QApplication::desktop()->isVirtualDesktop()) {
desk = QApplication::desktop()->availableGeometry(QApplication::desktop()->screen(scnum));
}
QByteArray geom = QByteArray::fromBase64(cfg.readEntry("ko_geometry", QByteArray()));
if (!restoreGeometry(geom)) {
const int scnum = QApplication::desktop()->screenNumber(parentWidget());
QRect desk = QApplication::desktop()->availableGeometry(scnum);
// if the desktop is virtual then use virtual screen size
if (QApplication::desktop()->isVirtualDesktop()) {
desk = QApplication::desktop()->availableGeometry(QApplication::desktop()->screen(scnum));
}
quint32 x = desk.x();
quint32 y = desk.y();
quint32 w = 0;
quint32 h = 0;
// Default size -- maximize on small screens, something useful on big screens
const int deskWidth = desk.width();
if (deskWidth > 1024) {
// a nice width, and slightly less than total available
// height to componensate for the window decs
w = (deskWidth / 3) * 2;
h = (desk.height() / 3) * 2;
}
else {
w = desk.width();
h = desk.height();
}
quint32 x = desk.x();
quint32 y = desk.y();
quint32 w = 0;
quint32 h = 0;
// Default size -- maximize on small screens, something useful on big screens
const int deskWidth = desk.width();
if (deskWidth > 1024) {
// a nice width, and slightly less than total available
// height to componensate for the window decs
w = (deskWidth / 3) * 2;
h = (desk.height() / 3) * 2;
}
else {
w = desk.width();
h = desk.height();
}
x += (desk.width() - w) / 2;
y += (desk.height() - h) / 2;
x += (desk.width() - w) / 2;
y += (desk.height() - h) / 2;
move(x,y);
setGeometry(geometry().x(), geometry().y(), w, h);
}
move(x,y);
setGeometry(geometry().x(), geometry().y(), w, h);
}
restoreWorkspace(QByteArray::fromBase64(cfg.readEntry("ko_windowstate", QByteArray())));
}
......
......@@ -126,7 +126,7 @@ set(kritatext_LIB_SRCS
add_library(kritatext SHARED ${kritatext_LIB_SRCS})
generate_export_header(kritatext BASE_NAME kritatext)
target_link_libraries(kritatext kritaflake Qt5::Gui KF5::XmlGui )
target_link_libraries(kritatext kritaflake Qt5::Gui kritawidgetutils )
target_link_libraries(kritatext LINK_INTERFACE_LIBRARIES kritaflake Qt5::Gui )
set_target_properties(kritatext PROPERTIES
......
......@@ -12,7 +12,15 @@ set(kritaundo2_LIB_SRCS
add_library(kritaundo2 SHARED ${kritaundo2_LIB_SRCS})
generate_export_header(kritaundo2 BASE_NAME kritaundo2)
target_link_libraries(kritaundo2 kritawidgetutils KF5::IconThemes KF5::I18n KF5::XmlGui Qt5::Core Qt5::Widgets)
target_link_libraries(kritaundo2
PUBLIC
kritawidgetutils
KF5::IconThemes
KF5::I18n
KF5::ConfigGui
Qt5::Core
Qt5::Widgets
)
set_target_properties(kritaundo2 PROPERTIES
VERSION ${GENERIC_CALLIGRA_LIB_VERSION} SOVERSION ${GENERIC_CALLIGRA_LIB_SOVERSION}
......
......@@ -3,9 +3,6 @@ add_subdirectory( tests )
include_directories(${KOWIDGETS_INCLUDES})
include_directories(${CMAKE_SOURCE_DIR}/libs/widgetutils)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if (LIBATTICA_FOUND)
include_directories(${LIBATTICA_INCLUDE_DIR})
endif ()
set(kritawidgets_LIB_SRCS
KoGradientEditWidget.cpp
......
add_subdirectory(tests)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/config)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/xmlgui)
configure_file(xmlgui/config-xmlgui.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-xmlgui.h )
set(kritawidgetutils_LIB_SRCS
KoGroupButton.cpp
......@@ -18,11 +21,62 @@ set(kritawidgetutils_LIB_SRCS
config/krecentfilesaction.cpp
config/kstandardaction.cpp
xmlgui/kaboutkdedialog_p.cpp
xmlgui/kactioncategory.cpp
xmlgui/kactioncollection.cpp
xmlgui/kactionconflictdetector.cpp
xmlgui/kbugreport.cpp
xmlgui/kcheckaccelerators.cpp
xmlgui/kedittoolbar.cpp
xmlgui/kgesture.cpp
xmlgui/kgesturemap.cpp
xmlgui/khelpmenu.cpp
xmlgui/kkeysequencewidget.cpp
xmlgui/kmainwindow.cpp
xmlgui/kmenumenuhandler_p.cpp
xmlgui/kshortcuteditwidget.cpp
xmlgui/kshortcutschemeseditor.cpp
xmlgui/kshortcutschemeshelper.cpp
xmlgui/kshortcutsdialog.cpp
xmlgui/kshortcutseditor.cpp
xmlgui/kshortcutseditordelegate.cpp
xmlgui/kshortcutseditoritem.cpp
xmlgui/kshortcutwidget.cpp
xmlgui/kswitchlanguagedialog_p.cpp
xmlgui/ktoggletoolbaraction.cpp
xmlgui/ktoolbar.cpp
xmlgui/ktoolbarhandler.cpp
xmlgui/kundoactions.cpp
xmlgui/kxmlguibuilder.cpp
xmlgui/kxmlguiclient.cpp
xmlgui/kxmlguifactory.cpp
xmlgui/kxmlguifactory_p.cpp
xmlgui/kxmlguiversionhandler.cpp
xmlgui/kxmlguiwindow.cpp
)
if (HAVE_DBUS)
set(kritawidgetutils_LIB_SRCS ${kritawidgetutils_LIB_SRCS}
xmlgui/kmainwindowiface.cpp
)
endif()
set(kritawidgetutils_UI
xmlgui/kshortcutsdialog.ui
xmlgui/kshortcutwidget.ui
)
ki18n_wrap_ui(kritiwidgetutils_LIB_SRCS ${kritawidgetutils_UI})
qt5_add_resources(kritiwidgetutils_LIB_SRCS xmlgui/kxmlgui.qrc)
add_library(kritawidgetutils SHARED ${kritawidgetutils_LIB_SRCS})
generate_export_header(kritawidgetutils BASE_NAME kritawidgetutils)
if (HAVE_DBUS)
set (KRITA_WIDGET_UTILS_EXTRA_LIBS ${KRITA_WIDGET_UTILS_EXTRA_LIBS} Qt5::DBus)
endif ()
target_link_libraries(kritawidgetutils
PUBLIC
Qt5::Widgets
......@@ -30,11 +84,16 @@ target_link_libraries(kritawidgetutils
Qt5::Xml
Qt5::Core
PRIVATE
Qt5::PrintSupport
KF5::I18n
KF5::ConfigCore
KF5::CoreAddons
KF5::ItemViews
KF5::ConfigGui
KF5::GuiAddons
KF5::WidgetsAddons
KF5::WindowSystem
${KRITA_WIDGET_UTILS_EXTRA_LIBS}
)
set_target_properties(kritawidgetutils
......
#!/bin/sh
# Invoke the extractrc script on all .ui, .rc, and .kcfg files in the sources.
# The results are stored in a pseudo .cpp file to be picked up by xgettext.
lst=`find . -name \*.rc -o -name \*.ui -o -name \*.kcfg`
if [ -n "$lst" ] ; then
$EXTRACTRC $lst >> rc.cpp
fi
# If your framework contains tips-of-the-day, call preparetips as well.
if [ -f "data/tips" ] ; then
( cd data && $PREPARETIPS > ../tips.cpp )
fi
# Extract strings from all source files.
# If your framework depends on KI18n, use $XGETTEXT. If it uses Qt translation
# system, use $EXTRACT_TR_STRINGS.
$XGETTEXT `find . -name \*.cpp -o -name \*.h -o -name \*.qml` -o $podir/kxmlgui5.pot
# Overall summary of global shortcut implementation
## KAction, KGlobalAccel and KdedGlobalAccel
[Basic functionality]
- You call KAction::setGlobalShortcut() to set a shortcut for an action.
KAction then calls KGlobalAccel which is, among other things, the interface
to KdedGlobalAccel (communication via DBus). KdedGlobalAccel is a KDED module
as you might have guessed.
- KdedGlobalAccel then grabs the shortcut key in a platform-specific way and
makes an entry of the mapping key<->action where actions are identified by
their main component name and their own name.
- When a key grab triggers, KdedGlobalAccel calls (via DBus) KGlobalAccel
which tells the action to trigger.
The KdedGlobalAccel is responsible for actually handling the shortcuts,
loading and saving the shortcut keys to kglobalshortcutrc. It doesn't
really know the actions, it just know what KGlobalAccel gave it.
[Conflict resolution]
KdedGlobalAccel has a list of all global shortcuts. If you try to assign a key
twice, it will tell the appropriate KdedGlobalAccel/KGlobalAccel that the
corresponding shortcut was changed to an empty one, which goes back to the
KAction.
When manually assigning shortcuts, the config widget asks
KGlobalAccel/KdedGlobalAccel for conflicts and presents options to the user
to fix them.
To prevent all clashes as good as possible, KdedGlobalAccel remembers key<->
action mappings even after the corresponding application shuts down.
[More details]
KAction instances talk to the KGlobalAccel singleton to make it aware of global
shortcuts changes via KGlobalAccel::updateGlobalShortcuts() (to define the shortcut)
KGlobalAccel::updateGlobalShortcutsAllowed() (to enable/disable the shortcut)
These two methods do the following:
- Create an action "id" which is a QStringList of two items: the application
component and the action text (this is bound to cause trouble with i18n)
- Convert the KAction shortcuts to a QList<int>
- Pass all this via DBus to the KdedGlobalAccel instance, which lives in the
kded4 process.
KGlobalAccel::updateGlobalShortcutsAllowed(true) sets the "SetPresent" flag when calling
kglobalaccel, which makes kglobalaccel actually grab the key shortcut
(so that the grab is done after the action has been defined, and only if it is enabled).
kglobalaccel must know about inactive global shortcuts too (e.g. those defined in
applications not running at the moment), for conflict resolution.
## kdebase side: keyboard shortcuts KCM
The keyboard shortcuts KCM can be found in kdebase/workspace/kcontrol/keys/
The KCM gets the global shortcut info from the KdedGlobalAccel instance via
DBus. It uses KShortcutsEditor to let the user edit the shortcuts. Since
KShortcutsEditor manipulates KAction instances, the kcm creates "fake" actions.
--
Aurélien Gâteau, 2008.02.01
aurelien.gateau@free.fr
David Faure, 2008.02.05
faure@kde.org
- KActionCollection::addAction with a previously added action should replace the old one. For consistency with
the Qt associative containers (and remember to add an autotest :)
#define XMLGUI_DISTRIBUTION_TEXT "${XMLGUI_DISTRIBUTION_TEXT}"
#define XMLGUI_COMPILING_OS "${CMAKE_SYSTEM}"
#define XMLGUI_COMPILER_VERSION "${XMLGUI_COMPILER_VERSION}"
#define CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}"
#define KF5_LIBEXEC_INSTALL_DIR "${KF5_LIBEXEC_INSTALL_DIR}"
#include <KoConfig.h>
/* This file is part of the KDE libraries
Copyright (C) 2007 Urs Wolfer <uwolfer at kde.org>
Parts of this class have been take from the KAboutKDE class, which was
Copyright (C) 2000 Espen Sand <espen@kde.org>
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 "kaboutkdedialog_p.h"
#include <QDialogButtonBox>
#include <QFrame>
#include <QLabel>
#include <QLayout>
#include <QTabWidget>
#include <QStandardPaths>
#include <klocalizedstring.h>
#include <ktitlewidget.h>
#include "../kxmlgui_version.h"
namespace KDEPrivate
{
KAboutKdeDialog::KAboutKdeDialog(QWidget *parent)
: QDialog(parent),
d(0)
{
setWindowTitle(i18n("About KDE"));
KTitleWidget *titleWidget = new KTitleWidget(this);
titleWidget->setText(i18n("<html><font size=\"5\">KDE - Be Free!</font></html>"));
titleWidget->setPixmap(QIcon::fromTheme(QStringLiteral("kde")).pixmap(48), KTitleWidget::ImageLeft);
QLabel *about = new QLabel;
about->setMargin(10);
about->setAlignment(Qt::AlignTop);
about->setWordWrap(true);
about->setOpenExternalLinks(true);
about->setTextInteractionFlags(Qt::TextBrowserInteraction);
about->setText(i18n("<html>"
"<b>KDE</b> is a world-wide network of software engineers, artists, writers, translators and facilitators "
"who are committed to <a href=\"%1\">Free Software</a> development. "
"This community has created hundreds of Free Software applications as part of the KDE "
"frameworks, workspaces and applications.<br /><br />"
"KDE is a cooperative enterprise in which no single entity controls the "
"efforts or products of KDE to the exclusion of others. Everyone is welcome to join and "
"contribute to KDE, including you.<br /><br />"
"Visit <a href=\"%2\">%2</a> for "
"more information about the KDE community and the software we produce.</html>",
QStringLiteral("http://www.gnu.org/philosophy/free-sw.html"),
QStringLiteral("http://www.kde.org/")));
QLabel *report = new QLabel;
report->setMargin(10);
report->setAlignment(Qt::AlignTop);
report->setWordWrap(true);
report->setOpenExternalLinks(true);
report->setTextInteractionFlags(Qt::TextBrowserInteraction);
report->setText(i18n("<html>"
"Software can always be improved, and the KDE team is ready to "
"do so. However, you - the user - must tell us when "
"something does not work as expected or could be done better.<br /><br />"
"KDE has a bug tracking system. Visit "
"<a href=\"%1\">%1</a> or "
"use the \"Report Bug...\" dialog from the \"Help\" menu to report bugs.<br /><br />"
"If you have a suggestion for improvement then you are welcome to use "
"the bug tracking system to register your wish. Make sure you use the "
"severity called \"Wishlist\".</html>",
QStringLiteral("https://bugs.kde.org/")));
QLabel *join = new QLabel;
join->setMargin(10);
join->setAlignment(Qt::AlignTop);
join->setWordWrap(true);
join->setOpenExternalLinks(true);
join->setTextInteractionFlags(Qt::TextBrowserInteraction);
join->setText(i18n("<html>"
"You do not have to be a software developer to be a member of the "
"KDE team. You can join the national teams that translate "
"program interfaces. You can provide graphics, themes, sounds, and "
"improved documentation. You decide!"
"<br /><br />"
"Visit "
"<a href=\"%1\">%1</a> "
"for information on some projects in which you can participate."
"<br /><br />"
"If you need more information or documentation, then a visit to "
"<a href=\"%2\">%2</a> "
"will provide you with what you need.</html>",
QStringLiteral("http://www.kde.org/community/getinvolved/"),
QStringLiteral("http://techbase.kde.org/")));
QLabel *support = new QLabel;
support->setMargin(10);
support->setAlignment(Qt::AlignTop);
support->setWordWrap(true);
support->setOpenExternalLinks(true);
support->setTextInteractionFlags(Qt::TextBrowserInteraction);
support->setText(i18n("<html>"
"KDE software is and will always be available free of charge, however creating it is not free.<br /><br />"
"To support development the KDE community has formed the KDE e.V., a non-profit organization "
"legally founded in Germany. KDE e.V. represents the KDE community in legal and financial matters. "
"See <a href=\"%1\">%1</a>"
" for information on KDE e.V.<br /><br />"
"KDE benefits from many kinds of contributions, including financial. "
"We use the funds to reimburse members and others for expenses "
"they incur when contributing. Further funds are used for legal "
"support and organizing conferences and meetings. <br /> <br />"
"We would like to encourage you to support our efforts with a "
"financial donation, using one of the ways described at "
"<a href=\"%2\">%2</a>."
"<br /><br />Thank you very much in advance for your support.</html>",
QStringLiteral("http://ev.kde.org/"),
QStringLiteral("http://www.kde.org/community/donations/")) + QLatin1String("<br /><br />")); // FIXME: ugly <br /> at the end...
QTabWidget *tabWidget = new QTabWidget;
tabWidget->setUsesScrollButtons(false);
tabWidget->addTab(about, i18nc("About KDE", "&About"));
tabWidget->addTab(report, i18n("&Report Bugs or Wishes"));
tabWidget->addTab(join, i18n("&Join KDE"));
tabWidget->addTab(support, i18n("&Support KDE"));
QLabel *image = new QLabel;
image->setPixmap(QStringLiteral(":/kxmlgui5/aboutkde.png"));
QHBoxLayout *midLayout = new QHBoxLayout;
midLayout->addWidget(image);
midLayout->addWidget(tabWidget);
QDialogButtonBox *buttonBox = new QDialogButtonBox;
buttonBox->setStandardButtons(QDialogButtonBox::Close);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(titleWidget);
mainLayout->addLayout(midLayout);
mainLayout->addWidget(buttonBox);
setLayout(mainLayout);
}
}
/* This file is part of the KDE libraries
Copyright (C) 2007 Urs Wolfer <uwolfer at kde.org>
Parts of this class have been take from the KAboutKDE class, which was
Copyright (C) 2000 Espen Sand <espen@kde.org>
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.
*/
#ifndef KABOUT_KDE_DIALOG_H
#define KABOUT_KDE_DIALOG_H
#include <QDialog>
namespace KDEPrivate
{
/**
* @short Standard "About KDE" dialog box
*
* This class provides the standard "About KDE" dialog box that is used
* in KHelpMenu. Normally you should not use this class directly, but
* rather the KHelpMenu class or even better just subclass your
* toplevel window from KMainWindow. If you do the latter, the help
* menu and thereby this dialog box is available through the
* KMainWindow::helpMenu() function.
*
* @author Urs Wolfer uwolfer @ kde.org
* @internal
*/
class KAboutKdeDialog : public QDialog
{
Q_OBJECT
public:
/**
* Constructor. Creates a fully featured "About KDE" dialog box.
* Note that this dialog is made modeless in the KHelpMenu class so
* the users may expect a modeless dialog.
*
* @param parent The parent of the dialog box. You should use the
* toplevel window so that the dialog becomes centered.
*/
explicit KAboutKdeDialog(QWidget *parent = 0);
private:
class Private;
Private *const d;
Q_DISABLE_COPY(KAboutKdeDialog)
};
}
#endif
/* Copyright (C) 2008 Michael Jansen <kde@michael-jansen.biz>
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 "kactioncategory.h"
#include "config-xmlgui.h"
#include <QAction>
#include "kstandardaction.h"
struct KActionCategoryPrivate {
KActionCategoryPrivate(KActionCategory *host);
//! Our host
KActionCategory *q;
//! The text for this category
QString text;
//! List of actions
QList<QAction *> actions;
}; // class KActionCategoryPrivate
KActionCategory::KActionCategory(const QString &text, KActionCollection *parent)
: QObject(parent)
, d(new KActionCategoryPrivate(this))
{
d->text = text;
}
KActionCategory::~KActionCategory()
{
delete d;
}
const QList<QAction *> KActionCategory::actions() const
{
return d->actions;
}
QAction *KActionCategory::addAction(const QString &name, QAction *action)
{
collection()->addAction(name,