KMoreTools
kmoretoolsmenufactory.cpp
83static void addItemFromKmtService(KMoreToolsMenuBuilder *menuBuilder, QMenu *menu, KMoreToolsService *kmtService, const QUrl &url, bool isMoreSection)
85 auto menuItem = menuBuilder->addMenuItem(kmtService, isMoreSection ? KMoreTools::MenuSection_More : KMoreTools::MenuSection_Main);
95 qCDebug(KMORETOOLS) << "Desktop file not installed:" << kmtService->desktopEntryName() << "=> Use desktop file provided by KMoreTools";
156 auto filelightAppIter = std::find_if(kmtServiceList.begin(), kmtServiceList.end(), [](KMoreToolsService *s) {
172 filelightApp->formatString(i18nc("@action:inmenu %1=\"$GenericName\"", "%1 - current folder", QStringLiteral("$GenericName"))));
173 menu->connect(filelight1Item->action(), &QAction::triggered, menu, [filelightService, url](bool) {
181 filelightApp->formatString(i18nc("@action:inmenu %1=\"$GenericName\"", "%1 - current device", QStringLiteral("$GenericName"))));
182 menu->connect(filelight2Item->action(), &QAction::triggered, menu, [filelightService, url](bool) {
194 filelightApp->formatString(i18nc("@action:inmenu %1=\"$GenericName\"", "%1 - all devices", QStringLiteral("$GenericName"))));
209 addItemsFromKmtServiceList(menuBuilder, menu, kmtServiceList, url, isMoreSection, firstMoreSectionDesktopEntryName);
220 menuBuilder->setInitialItemTextTemplate(QStringLiteral("$Name")); // just use the application name
229 if (url.isLocalFile()) { // this can only be done for local files, remote urls probably won't work for git clients anyway
231 // (this impl currently leads to wrong behaviour if the root dir of a git repo is chosen because it always goes one level up)
251 menuBuilder->setInitialItemTextTemplate(QStringLiteral("$Name")); // just use the application name
252 addItemsFromKmtServiceList(menuBuilder, menu, kmtServiceList, url, isMoreSection, firstMoreSectionDesktopEntryName);
256QMenu *KMoreToolsMenuFactory::createMenuFromGroupingNames(const QStringList &groupingNames, const QUrl &url)
269void KMoreToolsMenuFactory::fillMenuFromGroupingNames(QMenu *menu, const QStringList &groupingNames, const QUrl &url)
283 auto kmtServiceList = KMoreToolsPresetsPrivate::registerServicesByGroupingNames(&firstMoreSectionDesktopEntryName, d->kmt, {groupingName});
AutoHandlingEnabled
Define how the default structure of the menu should look like.
Definition kmoretools.h:525
void buildByAppendingToMenu(QMenu *menu, KMoreTools::ConfigureDialogAccessibleSetting configureDialogAccessibleSetting=KMoreTools::ConfigureDialogAccessible_Always, QMenu **outMoreMenu=nullptr)
Builds the actual menu and appends all items (main items, more submenu with a potential "not installe...
Definition kmoretools.cpp:600
KMoreToolsMenuItem * addMenuItem(KMoreToolsService *registeredService, KMoreTools::MenuSection defaultLocation=KMoreTools::MenuSection_Main)
Adds a registered service (which can installed or not) to the menu.
Definition kmoretools.cpp:553
void setInitialItemTextTemplate(const QString &templateText)
Affects addMenuItem() if called before it.
Definition kmoretools.cpp:548
QMenu * createMenuFromGroupingNames(const QStringList &groupingNames, const QUrl &url=QUrl())
For each grouping name menu items will be created an appended to a lazy menu which is returned.
Definition kmoretoolsmenufactory.cpp:256
void fillMenuFromGroupingNames(QMenu *menu, const QStringList &groupingNames, const QUrl &url=QUrl())
See createMenuFromGroupingNames except that the menu is not created but you have to provide one yours...
Definition kmoretoolsmenufactory.cpp:269
KMoreToolsMenuFactory(const QString &uniqueId)
Definition kmoretoolsmenufactory.cpp:59
void setParentWidget(QWidget *widget)
Set widget as the parent widget of the QMenu that will be created by createMenuFromGroupingNames().
Definition kmoretoolsmenufactory.cpp:291
A service described in a .desktop file (kmt-desktopfile) which will be called "registered service".
Definition kmoretools.h:357
KService::Ptr kmtProvidedService() const
Definition kmoretools.cpp:257
KService::Ptr installedService() const
Definition kmoretools.cpp:252
Helps to create user-configurable menus with tools which are potentially not yet installed.
Definition kmoretools.h:163
QString i18nc(const char *context, const char *text, const TYPE &arg...)
void setText(const QString &text)
void triggered(bool checked)
iterator begin()
iterator end()
bool removeOne(const AT &t)
Q_SLOTSQ_SLOTS
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * parent() const const
bool isEmpty() const const
bool isLocalFile() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Aug 30 2024 11:52:31 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Aug 30 2024 11:52:31 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.