Changeset View
Changeset View
Standalone View
Standalone View
src/statusnotifier.cpp
Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Line(s) | 115 | KNotification *notification = KNotification::event(QStringLiteral("applicationcrash"), | |||
---|---|---|---|---|---|
116 | m_title, | 116 | m_title, | ||
117 | i18n("Please report this error to help improve this software."), | 117 | i18n("Please report this error to help improve this software."), | ||
118 | !m_iconName.isEmpty() ? m_iconName : QStringLiteral("tools-report-bug"), | 118 | !m_iconName.isEmpty() ? m_iconName : QStringLiteral("tools-report-bug"), | ||
119 | nullptr, | 119 | nullptr, | ||
120 | KNotification::DefaultEvent | KNotification::SkipGrouping); | 120 | KNotification::DefaultEvent | KNotification::SkipGrouping); | ||
121 | 121 | | |||
122 | QStringList actions = {i18nc("Notification action button, keep short", "Report Bug")}; | 122 | QStringList actions = {i18nc("Notification action button, keep short", "Report Bug")}; | ||
123 | 123 | | |||
124 | bool restartEnabled = canBeRestarted(crashedApp); | 124 | if (canBeRestarted(crashedApp)) { | ||
125 | | ||||
126 | if (restartEnabled) { | | |||
127 | actions << i18nc("Notification action button, keep short", "Restart App"); | 125 | actions << i18nc("Notification action button, keep short", "Restart App"); | ||
128 | } | 126 | } | ||
129 | 127 | | |||
130 | notification->setActions(actions); | 128 | notification->setActions(actions); | ||
131 | 129 | | |||
132 | connect(notification, static_cast<void (KNotification::*)(unsigned int)>(&KNotification::activated), | 130 | connect(notification, static_cast<void (KNotification::*)(unsigned int)>(&KNotification::activated), | ||
133 | this, [this, crashedApp](int actionIndex) { | 131 | this, [this, crashedApp](int actionIndex) { | ||
134 | // 0 = default action (NOTE this is not implemented by Plasma, clicking notification popup just closes it) | 132 | // 0 = default action (NOTE this is not implemented by Plasma, clicking notification popup just closes it) | ||
Show All 24 Lines |