mirror of
https://github.com/MatMoul/plasma-containmentactions-customdesktopmenu.git
synced 2024-12-23 14:36:12 +00:00
Implement show by name option
This commit is contained in:
parent
2f66f5cabc
commit
09a62ab6ea
@ -122,7 +122,11 @@ void CustomDesktopMenu::parseConfig()
|
|||||||
// .desktop file
|
// .desktop file
|
||||||
if(KDesktopFile::isDesktopFile(cfgLine) == true) {
|
if(KDesktopFile::isDesktopFile(cfgLine) == true) {
|
||||||
KDesktopFile desktopFile(cfgLine);
|
KDesktopFile desktopFile(cfgLine);
|
||||||
action = new QAction(QIcon::fromTheme(desktopFile.readIcon()), desktopFile.readName(), this);
|
QString text = desktopFile.name();
|
||||||
|
if (!m_showAppsByName && !desktopFile.readGenericName().isEmpty()) {
|
||||||
|
text = desktopFile.readGenericName();
|
||||||
|
}
|
||||||
|
action = new QAction(QIcon::fromTheme(desktopFile.readIcon()), text, this);
|
||||||
action->setData(cfgLine);
|
action->setData(cfgLine);
|
||||||
connect(action, &QAction::triggered, [action](){
|
connect(action, &QAction::triggered, [action](){
|
||||||
KService::Ptr service = KService::serviceByDesktopPath(action->data().toString());
|
KService::Ptr service = KService::serviceByDesktopPath(action->data().toString());
|
||||||
@ -179,7 +183,11 @@ void CustomDesktopMenu::fillPrograms(const QString& path)
|
|||||||
if(p->isType(KST_KService)) {
|
if(p->isType(KST_KService)) {
|
||||||
if(KDesktopFile::isDesktopFile(p->entryPath()) == true) {
|
if(KDesktopFile::isDesktopFile(p->entryPath()) == true) {
|
||||||
KDesktopFile desktopFile(p->entryPath());
|
KDesktopFile desktopFile(p->entryPath());
|
||||||
action = new QAction(QIcon::fromTheme(desktopFile.readIcon()), desktopFile.readName(), this);
|
QString text = p->name();
|
||||||
|
if (!m_showAppsByName && !desktopFile.readGenericName().isEmpty()) {
|
||||||
|
text = desktopFile.readGenericName();
|
||||||
|
}
|
||||||
|
action = new QAction(QIcon::fromTheme(desktopFile.readIcon()), text, this);
|
||||||
action->setData(p->entryPath());
|
action->setData(p->entryPath());
|
||||||
connect(action, &QAction::triggered, [action](){
|
connect(action, &QAction::triggered, [action](){
|
||||||
KService::Ptr service = KService::serviceByDesktopPath(action->data().toString());
|
KService::Ptr service = KService::serviceByDesktopPath(action->data().toString());
|
||||||
|
Loading…
Reference in New Issue
Block a user