deviceindicator: add comments to mark each menu entry
This commit is contained in:
parent
aee2b593de
commit
61de9ba315
1 changed files with 6 additions and 1 deletions
|
@ -62,12 +62,14 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
|
||||||
|
|
||||||
connect(device, SIGNAL(nameChanged(QString)), this, SLOT(setText(QString)));
|
connect(device, SIGNAL(nameChanged(QString)), this, SLOT(setText(QString)));
|
||||||
|
|
||||||
|
// Battery status
|
||||||
auto battery = new BatteryAction(device);
|
auto battery = new BatteryAction(device);
|
||||||
addAction(battery);
|
addAction(battery);
|
||||||
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_battery")),
|
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_battery")),
|
||||||
[battery](bool available) { battery->setVisible(available); }
|
[battery](bool available) { battery->setVisible(available); }
|
||||||
, this);
|
, this);
|
||||||
|
|
||||||
|
// Browse device filesystem
|
||||||
auto browse = addAction(QIcon::fromTheme(QStringLiteral("document-open-folder")), i18n("Browse device"));
|
auto browse = addAction(QIcon::fromTheme(QStringLiteral("document-open-folder")), i18n("Browse device"));
|
||||||
connect(browse, &QAction::triggered, device, [device](){
|
connect(browse, &QAction::triggered, device, [device](){
|
||||||
SftpDbusInterface* sftpIface = new SftpDbusInterface(device->id(), device);
|
SftpDbusInterface* sftpIface = new SftpDbusInterface(device->id(), device);
|
||||||
|
@ -76,6 +78,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
|
||||||
});
|
});
|
||||||
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_sftp")), [browse](bool available) { browse->setVisible(available); }, this);
|
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_sftp")), [browse](bool available) { browse->setVisible(available); }, this);
|
||||||
|
|
||||||
|
// Find device
|
||||||
auto findDevice = addAction(QIcon::fromTheme(QStringLiteral("irc-voice")), i18n("Ring device"));
|
auto findDevice = addAction(QIcon::fromTheme(QStringLiteral("irc-voice")), i18n("Ring device"));
|
||||||
connect(findDevice, &QAction::triggered, device, [device](){
|
connect(findDevice, &QAction::triggered, device, [device](){
|
||||||
FindMyPhoneDeviceDbusInterface* iface = new FindMyPhoneDeviceDbusInterface(device->id(), device);
|
FindMyPhoneDeviceDbusInterface* iface = new FindMyPhoneDeviceDbusInterface(device->id(), device);
|
||||||
|
@ -84,6 +87,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
|
||||||
});
|
});
|
||||||
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_findmyphone")), [findDevice](bool available) { findDevice->setVisible(available); }, this);
|
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_findmyphone")), [findDevice](bool available) { findDevice->setVisible(available); }, this);
|
||||||
|
|
||||||
|
// Send file
|
||||||
auto sendFile = addAction(QIcon::fromTheme(QStringLiteral("document-share")), i18n("Send file"));
|
auto sendFile = addAction(QIcon::fromTheme(QStringLiteral("document-share")), i18n("Send file"));
|
||||||
connect(sendFile, &QAction::triggered, device, [device, this](){
|
connect(sendFile, &QAction::triggered, device, [device, this](){
|
||||||
const QUrl url = QFileDialog::getOpenFileUrl(parentWidget(), i18n("Select file to send to '%1'", device->name()), QUrl::fromLocalFile(QDir::homePath()));
|
const QUrl url = QFileDialog::getOpenFileUrl(parentWidget(), i18n("Select file to send to '%1'", device->name()), QUrl::fromLocalFile(QDir::homePath()));
|
||||||
|
@ -97,7 +101,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
|
||||||
|
|
||||||
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_share")), [sendFile](bool available) { sendFile->setVisible(available); }, this);
|
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_share")), [sendFile](bool available) { sendFile->setVisible(available); }, this);
|
||||||
|
|
||||||
// Search current application path
|
// SMS Messages
|
||||||
const QString kdeconnectsmsExecutable = QStandardPaths::findExecutable(QStringLiteral("kdeconnect-sms"), { QCoreApplication::applicationDirPath() });
|
const QString kdeconnectsmsExecutable = QStandardPaths::findExecutable(QStringLiteral("kdeconnect-sms"), { QCoreApplication::applicationDirPath() });
|
||||||
if (!kdeconnectsmsExecutable.isEmpty()) {
|
if (!kdeconnectsmsExecutable.isEmpty()) {
|
||||||
auto smsapp = addAction(QIcon::fromTheme(QStringLiteral("message-new")), i18n("SMS Messages..."));
|
auto smsapp = addAction(QIcon::fromTheme(QStringLiteral("message-new")), i18n("SMS Messages..."));
|
||||||
|
@ -107,6 +111,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
|
||||||
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_sms")), [smsapp](bool available) { smsapp->setVisible(available); }, this);
|
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_sms")), [smsapp](bool available) { smsapp->setVisible(available); }, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run command
|
||||||
QMenu* remoteCommandsMenu = new QMenu(i18n("Run command"), this);
|
QMenu* remoteCommandsMenu = new QMenu(i18n("Run command"), this);
|
||||||
QAction* menuAction = remoteCommandsMenu->menuAction();
|
QAction* menuAction = remoteCommandsMenu->menuAction();
|
||||||
QAction* addCommandAction = remoteCommandsMenu->addAction(QIcon::fromTheme(QStringLiteral("list-add")), i18n("Add commands"));
|
QAction* addCommandAction = remoteCommandsMenu->addAction(QIcon::fromTheme(QStringLiteral("list-add")), i18n("Add commands"));
|
||||||
|
|
Loading…
Reference in a new issue