KXmlGui
kxmlguiclient.cpp
86 << this << "deleted without having been removed from the factory first. This will leak standalone popupmenus and could lead to crashes.";
156 if (d->m_xmlFile.isEmpty()) { // setXMLFile not called at all, can't save. Use case: ToolBarHandler
160 return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kxmlgui5/%1/%2").arg(componentName(), d->m_xmlFile);
165 // TODO: this method can't be used for the KXmlGuiWindow, since it doesn't merge in ui_standards.rc!
174 void KXMLGUIClient::setComponentName(const QString &componentName, const QString &componentDisplayName)
189 QString file = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("ui/ui_standards.rc"));
223 QStringLiteral("kxmlgui" QT_STRINGIFY(QT_VERSION_MAJOR)) + QLatin1Char('/') + filter); // KF >= 5.1
232 const QStringList compatFiles = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, filter) + // kdelibs4, KF 5.0
233 QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, _file); // kdelibs4, KF 5.0, caller passes component name
244 qCWarning(DEBUG_KXMLGUI) << "cannot find .rc file" << _file << "for component" << componentName();
249 const bool exists = QDir::isRelativePath(d->m_localXMLFile) || QFile::exists(d->m_localXMLFile);
269 void KXMLGUIClient::replaceXMLFile(const QString &xmlfile, const QString &localxmlfile, bool merge)
317 bool result = document.isEmpty() || doc.setContent(document, &errorMsg, &errorLine, &errorColumn);
323 qCCritical(DEBUG_KXMLGUI) << "Error parsing XML document:" << errorMsg << "at line" << errorLine << "column" << errorColumn;
324 setDOMDocument(QDomDocument(), merge); // otherwise empty menus from ui_standards.rc stay around
326 qCCritical(DEBUG_KXMLGUI) << "Error parsing XML document:" << errorMsg << "at line" << errorLine << "column" << errorColumn;
369 bool KXMLGUIClientPrivate::mergeXML(QDomElement &base, QDomElement &additive, KActionCollection *actionCollection)
546 bool KXMLGUIClientPrivate::isEmptyContainer(const QDomElement &base, KActionCollection *actionCollection) const
599 QDomElement KXMLGUIClientPrivate::findMatchingElement(const QDomElement &base, const QDomElement &additive)
604 n = n.nextSibling(); // Advance now so that we can safely delete e -- TODO we don't, so simplify this
721 // qCDebug(DEBUG_KXMLGUI) << "KXMLGUIClient::addStateActionEnabled( " << state << ", " << action << ")";
731 // qCDebug(DEBUG_KXMLGUI) << "KXMLGUIClient::addStateActionDisabled( " << state << ", " << action << ")";
741 void KXMLGUIClient::stateChanged(const QString &newstate, KXMLGUIClient::ReverseStateChange reverse)
void append(const T &value)
void reloadXML()
Forces this client to re-read its XML resource file.
Definition: kxmlguiclient.cpp:163
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const const
bool isNull() const const
void unplugActionList(const QString &name)
Unplugs the action list name from the XMLGUI.
Definition: kxmlguiclient.cpp:700
void setXMLGUIBuildDocument(const QDomDocument &doc)
Definition: kxmlguiclient.cpp:627
QDomNode firstChild() const const
QDomElement toElement() const const
QString fromUtf8(const char *str, int size)
CaseInsensitive
QString tagName() const const
QDomNode parentNode() const const
QDomNode removeChild(const QDomNode &oldChild)
QDomNodeList elementsByTagName(const QString &tagname) const const
bool isNull() const const
bool contains(const QString &str, Qt::CaseSensitivity cs) const const
QString arg(Args &&... args) const const
virtual void setDOMDocument(const QDomDocument &document, bool merge=false)
Sets the Document for the part, describing the layout of the GUI.
Definition: kxmlguiclient.cpp:332
void plugActionList(const QString &name, const QList< QAction * > &actionList)
ActionLists are a way for XMLGUI to support dynamic lists of actions.
Definition: kxmlguiclient.cpp:691
Definition: kxmlguifactory.h:55
bool setContent(const QByteArray &data, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn)
QString writableLocation(QStandardPaths::StandardLocation type)
const QChar * unicode() const const
QString locate(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options)
bool exists() const const
QString nodeValue() const const
void setAttribute(const QString &name, const QString &value)
Definition: kxmlguiclient.h:39
QDomDocument xmlguiBuildDocument() const
Definition: kxmlguiclient.cpp:632
void prepend(const T &value)
void insertChildClient(KXMLGUIClient *child)
Use this method to make a client a child client of another client.
Definition: kxmlguiclient.cpp:652
QDomNode item(int index) const const
void replaceXMLFile(const QString &xmlfile, const QString &localxmlfile, bool merge=false)
Sets a new xmlFile() and localXMLFile().
Definition: kxmlguiclient.cpp:269
bool isSpace() const const
void setComponentName(const QString &componentName)
Set the componentName associated with this action collection.
Definition: kactioncollection.cpp:161
static QString readConfigFile(const QString &filename, const QString &componentName=QString())
Definition: kxmlguifactory.cpp:101
QDomNode previousSibling() const const
virtual QString xmlFile() const
This will return the name of the XML file as set by setXMLFile().
Definition: kxmlguiclient.cpp:141
KCONFIGCORE_EXPORT bool authorizeAction(const QString &action)
virtual void setComponentName(const QString &componentName, const QString &componentDisplayName)
Sets the component name for this part.
Definition: kxmlguiclient.cpp:174
virtual void setXMLFile(const QString &file, bool merge=false, bool setXMLDoc=true)
Sets the name of the rc file containing the XML for the part.
Definition: kxmlguiclient.cpp:203
bool isEmpty() const const
int length() const const
KXMLGUIFactory * factory() const
Retrieves a pointer to the KXMLGUIFactory this client is associated with (will return nullptr if the ...
Definition: kxmlguiclient.cpp:642
QAction * action(int index) const
Return the QAction* at position index in the action collection.
Definition: kactioncollection.cpp:145
QDomNode lastChild() const const
virtual void setXML(const QString &document, bool merge=false)
Sets the XML for the part.
Definition: kxmlguiclient.cpp:309
int toInt(bool *ok, int base) const const
bool isEmpty() const const
QDomNamedNodeMap attributes() const const
QDomNode insertBefore(const QDomNode &newChild, const QDomNode &refChild)
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const const
KXMLGUIClient * parentClient() const
KXMLGUIClients can form a simple child/parent object tree.
Definition: kxmlguiclient.cpp:647
QDomElement documentElement() const const
QDomNode item(int index) const const
void removeChildClient(KXMLGUIClient *child)
Removes the given child from the client's children list.
Definition: kxmlguiclient.cpp:661
QString nodeName() const const
int count() const const
bool isAbsolutePath(const QString &path)
KXMLGUIClient()
Constructs a KXMLGUIClient which can be used with a KXMLGUIFactory to create a GUI from actions and a...
Definition: kxmlguiclient.cpp:65
static QString findVersionNumber(const QString &xml)
Returns the version number of the given xml data (belonging to an xml rc file)
Definition: kxmlguiclient.cpp:792
GenericDataLocation
QDomNode replaceChild(const QDomNode &newChild, const QDomNode &oldChild)
QAction * action(const char *name) const
Retrieves an action of the client by name.
Definition: kxmlguiclient.cpp:103
virtual KActionCollection * actionCollection() const
Retrieves the entire action collection for the GUI client.
Definition: kxmlguiclient.cpp:117
void setEnabled(bool)
QDomNode appendChild(const QDomNode &newChild)
QStringList locateAll(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options)
const char * name(StandardAction id)
KXMLGUIBuilder * clientBuilder() const
Retrieves the client's GUI builder or nullptr if no client specific builder has been assigned via set...
Definition: kxmlguiclient.cpp:686
const QChar at(int position) const const
Q_SCRIPTABLE Q_NOREPLY void abort()
QDomNode nextSibling() const const
virtual void setLocalXMLFile(const QString &file)
Set the full path to the "local" xml file, the one used for saving toolbar and shortcut changes.
Definition: kxmlguiclient.cpp:264
bool isRelativePath(const QString &path)
static QString standardsXmlFileLocation()
Return the full path to the ui_standards.rc, might return a resource path.
Definition: kxmlguiclient.cpp:184
int compare(const QString &other, Qt::CaseSensitivity cs) const const
QString attribute(const QString &name, const QString &defValue) const const
void setClientBuilder(KXMLGUIBuilder *builder)
A client can have an own KXMLGUIBuilder.
Definition: kxmlguiclient.cpp:681
virtual void stateChanged(const QString &newstate, ReverseStateChange reverse=StateNoReverse)
Actions can collectively be assigned a "State".
Definition: kxmlguiclient.cpp:741
Definition: kxmlguibuilder.h:33
void removeAssociatedWidget(QWidget *widget)
Remove an association between all actions in this collection and the given widget,...
Definition: kactioncollection.cpp:815
QString mid(int position, int n) const const
void setComponentDisplayName(const QString &displayName)
Set the component display name associated with this action collection.
Definition: kactioncollection.cpp:186
int length() const const
static QByteArray applicationDomain()
void addAssociatedWidget(QWidget *widget)
Associate all actions in this collection to the given widget, including any actions added after this ...
Definition: kactioncollection.cpp:803
QList< KXMLGUIClient * > childClients()
Retrieves a list of all child clients.
Definition: kxmlguiclient.cpp:676
void setFactory(KXMLGUIFactory *factory)
This method is called by the KXMLGUIFactory as soon as the client is added to the KXMLGUIFactory's GU...
Definition: kxmlguiclient.cpp:637
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Nov 30 2023 03:58:54 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Nov 30 2023 03:58:54 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.