Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
KDE Connect
Commits
f60a7bdd
Commit
f60a7bdd
authored
Jun 01, 2021
by
Piyush Aggarwal
🎮
Browse files
plugins/lockdevice: add support for remote lock success/failure notification
parent
89f52af4
Changes
2
Hide whitespace changes
Inline
Side-by-side
plugins/kdeconnect.notifyrc
View file @
f60a7bdd
...
...
@@ -648,3 +648,13 @@ Comment[zh_CN]=收到通知
Comment[zh_TW]=收到通知
Action=Popup
ShowInHistory=false
[Event/remoteLockSuccess]
Name=Remote Lock Successful
Comment=Remote lock successful
Action=Popup
[Event/remoteLockFailure]
Name=Remote Lock Failure
Comment=Remote lock failed
Action=Popup
plugins/lockdevice/lockdeviceplugin.cpp
View file @
f60a7bdd
...
...
@@ -12,6 +12,7 @@
#include <QDebug>
#include "plugin_lock_debug.h"
#include <core/daemon.h>
#include <core/device.h>
#include <dbushelper.h>
...
...
@@ -82,12 +83,27 @@ bool LockDevicePlugin::receivePacket(const NetworkPacket & np)
sendState
();
}
// Receiving result of setLocked
if
(
np
.
has
(
QStringLiteral
(
"lockResult"
)))
{
bool
lockSuccess
=
np
.
get
<
bool
>
(
QStringLiteral
(
"lockResult"
));
if
(
lockSuccess
)
{
Daemon
::
instance
()
->
sendSimpleNotification
(
QStringLiteral
(
"remoteLockSuccess"
),
device
()
->
name
(),
i18n
(
"Remote lock successful"
),
QStringLiteral
(
"lock"
));
}
else
{
Daemon
::
instance
()
->
sendSimpleNotification
(
QStringLiteral
(
"remoteLockFailure"
),
device
()
->
name
(),
i18n
(
"Remote lock failed"
),
QStringLiteral
(
"error"
));
Daemon
::
instance
()
->
reportError
(
device
()
->
name
(),
i18n
(
"Remote lock failed"
));
}
}
if
(
np
.
has
(
QStringLiteral
(
"setLocked"
)))
{
const
bool
lock
=
np
.
get
<
bool
>
(
QStringLiteral
(
"setLocked"
));
bool
success
=
false
;
if
(
lock
)
{
m_login1Interface
.
Lock
();
}
else
{
success
=
m_login1Interface
.
lockedHint
();
NetworkPacket
np
(
PACKET_TYPE_LOCK
,
{{
QStringLiteral
(
"lockResult"
),
success
}});
sendPacket
(
np
);
}
else
{
m_login1Interface
.
Unlock
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment