Skip to content

Commit 24ab40f

Browse files
committed
Fix support for separator type of action
1 parent 6a25165 commit 24ab40f

File tree

2 files changed

+32
-21
lines changed

2 files changed

+32
-21
lines changed

Diff for: src/modules/notificationitem/dbusmenu.cpp

+29-21
Original file line numberDiff line numberDiff line change
@@ -308,28 +308,36 @@ void DBusMenu::fillLayoutProperties(
308308
: 0));
309309
} else {
310310
id -= builtInIds;
311-
if (auto *ic = lastRelevantIc()) {
312-
if (auto *action = parent_->instance()
313-
->userInterfaceManager()
314-
.lookupActionById(id)) {
315-
appendProperty(properties, propertyNames, "label",
316-
dbus::Variant(action->shortText(ic)));
317-
appendProperty(properties, propertyNames, "icon-name",
318-
dbus::Variant(iconName(action->icon(ic))));
319-
if (action->isCheckable()) {
320-
appendProperty(properties, propertyNames, "toggle-type",
321-
dbus::Variant("radio"));
322-
bool checked = action->isChecked(ic);
311+
auto *ic = lastRelevantIc();
312+
if (!ic) {
313+
return;
314+
}
315+
auto *action =
316+
parent_->instance()->userInterfaceManager().lookupActionById(id);
317+
if (!action) {
318+
return;
319+
}
320+
if (action->isSeparator()) {
321+
appendProperty(properties, propertyNames, "type",
322+
dbus::Variant("separator"));
323+
return;
324+
}
323325

324-
appendProperty(properties, propertyNames, "toggle-state",
325-
dbus::Variant(checked ? 1 : 0));
326-
}
327-
if (action->menu()) {
328-
appendProperty(properties, propertyNames,
329-
"children-display",
330-
dbus::Variant("submenu"));
331-
}
332-
}
326+
appendProperty(properties, propertyNames, "label",
327+
dbus::Variant(action->shortText(ic)));
328+
appendProperty(properties, propertyNames, "icon-name",
329+
dbus::Variant(iconName(action->icon(ic))));
330+
if (action->isCheckable()) {
331+
appendProperty(properties, propertyNames, "toggle-type",
332+
dbus::Variant("radio"));
333+
bool checked = action->isChecked(ic);
334+
335+
appendProperty(properties, propertyNames, "toggle-state",
336+
dbus::Variant(checked ? 1 : 0));
337+
}
338+
if (action->menu()) {
339+
appendProperty(properties, propertyNames, "children-display",
340+
dbus::Variant("submenu"));
333341
}
334342
}
335343
}

Diff for: src/ui/kimpanel/kimpanel.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,9 @@ void Kimpanel::msgV1Handler(dbus::Message &msg) {
448448
if (auto *menu = action->menu()) {
449449
std::vector<std::string> menuitems;
450450
for (auto *menuAction : menu->actions()) {
451+
if (menuAction->isSeparator()) {
452+
continue;
453+
}
451454
menuitems.push_back(actionToStatus(menuAction, ic));
452455
}
453456
proxy_->execMenu(menuitems);

0 commit comments

Comments
 (0)