Fix sms indicator entry for macOS

This commit is contained in:
Weixuan Xiao 2019-08-19 05:39:05 +00:00
parent 5b13f28912
commit 16de0150ce

View file

@ -113,11 +113,12 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_share")), [sendFile](bool available) { sendFile->setVisible(available); }, this);
if (!QStandardPaths::findExecutable(QStringLiteral("kdeconnect-sms")).isEmpty()) {
// Search current application path
const QString kdeconnectsmsExecutable = QStandardPaths::findExecutable(QStringLiteral("kdeconnect-sms"), { QCoreApplication::applicationDirPath() });
if (!kdeconnectsmsExecutable.isEmpty()) {
auto smsapp = addAction(QIcon::fromTheme(QStringLiteral("message-new")), i18n("SMS Messages..."));
QObject::connect(smsapp, &QAction::triggered, device, [device] () {
QProcess::startDetached(QLatin1String("kdeconnect-sms"), { QStringLiteral("--device"), device->id() });
QObject::connect(smsapp, &QAction::triggered, device, [device, kdeconnectsmsExecutable] () {
QProcess::startDetached(kdeconnectsmsExecutable, { QStringLiteral("--device"), device->id() });
});
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_sms")), [smsapp](bool available) { smsapp->setVisible(available); }, this);
}