Skip to content
GitLab
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
98077b86
Commit
98077b86
authored
Jun 12, 2021
by
Piyush Aggarwal
🎮
Browse files
indicator: replace send file invocation with urlhandler
parent
de02b9b5
Changes
1
Show whitespace changes
Inline
Side-by-side
indicator/deviceindicator.cpp
View file @
98077b86
...
...
@@ -55,18 +55,14 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
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"
));
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
()));
if
(
url
.
isEmpty
())
return
;
QDBusMessage
msg
=
QDBusMessage
::
createMethodCall
(
QStringLiteral
(
"org.kde.kdeconnect"
),
QStringLiteral
(
"/modules/kdeconnect/devices/"
)
+
device
->
id
()
+
QStringLiteral
(
"/share"
),
QStringLiteral
(
"org.kde.kdeconnect.device.share"
),
QStringLiteral
(
"shareUrl"
));
msg
.
setArguments
(
QVariantList
()
<<
url
.
toString
());
DBusHelper
::
sessionBus
().
call
(
msg
);
const
QString
kdeconnectHandlerExecutable
=
QStandardPaths
::
findExecutable
(
QStringLiteral
(
"kdeconnect-handler"
));
if
(
!
kdeconnectHandlerExecutable
.
isEmpty
())
{
auto
handlerApp
=
addAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"document-share"
)),
i18n
(
"Send a file/URL"
));
QObject
::
connect
(
handlerApp
,
&
QAction
::
triggered
,
device
,
[
device
,
kdeconnectHandlerExecutable
]
()
{
QProcess
::
startDetached
(
kdeconnectHandlerExecutable
,
{
QStringLiteral
(
"--device"
),
device
->
id
()
});
});
setWhenAvailable
(
device
->
hasPlugin
(
QStringLiteral
(
"kdeconnect_share"
)),
[
sendFile
](
bool
available
)
{
sendFile
->
setVisible
(
available
);
},
this
);
handlerApp
->
setVisible
(
true
);
}
// SMS Messages
const
QString
kdeconnectsmsExecutable
=
QStandardPaths
::
findExecutable
(
QStringLiteral
(
"kdeconnect-sms"
),
{
QCoreApplication
::
applicationDirPath
()
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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