Added an option to the cli to return your own device id
This commit is contained in:
parent
6a37a3c1bd
commit
7cc39aada8
3 changed files with 10 additions and 1 deletions
|
@ -88,6 +88,7 @@ int main(int argc, char** argv)
|
|||
parser.addOption(QCommandLineOption(QStringLiteral("list-commands"), i18n("Lists remote commands and their ids")));
|
||||
parser.addOption(QCommandLineOption(QStringLiteral("execute-command"), i18n("Executes a remote command by id"), QStringLiteral("id")));
|
||||
parser.addOption(QCommandLineOption(QStringList{QStringLiteral("k"), QStringLiteral("send-keys")}, i18n("Sends keys to a said device")));
|
||||
parser.addOption(QCommandLineOption(QStringLiteral("my-id"), i18n("Display this device's id and exit")));
|
||||
about.setupCommandLine(&parser);
|
||||
|
||||
parser.addHelpOption();
|
||||
|
@ -97,7 +98,9 @@ int main(int argc, char** argv)
|
|||
const QString id = "kdeconnect-cli-"+QString::number(QCoreApplication::applicationPid());
|
||||
DaemonDbusInterface iface;
|
||||
|
||||
if(parser.isSet(QStringLiteral("l")) || parser.isSet(QStringLiteral("a"))) {
|
||||
if (parser.isSet(QStringLiteral("my-id"))) {
|
||||
QTextStream(stdout) << iface.selfId() << endl;
|
||||
} else if (parser.isSet(QStringLiteral("l")) || parser.isSet(QStringLiteral("a"))) {
|
||||
bool paired = true, reachable = false;
|
||||
if (parser.isSet(QStringLiteral("a"))) {
|
||||
reachable = true;
|
||||
|
|
|
@ -271,3 +271,8 @@ Daemon::~Daemon()
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
QString Daemon::selfId() const
|
||||
{
|
||||
return KdeConnectConfig::instance()->deviceId();
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ public:
|
|||
|
||||
QStringList pairingRequests() const;
|
||||
|
||||
Q_SCRIPTABLE QString selfId() const;
|
||||
public Q_SLOTS:
|
||||
Q_SCRIPTABLE void acquireDiscoveryMode(const QString &id);
|
||||
Q_SCRIPTABLE void releaseDiscoveryMode(const QString &id);
|
||||
|
|
Loading…
Reference in a new issue