From ea8ed5c4273a70136d96ffc57dd5e0ecba053156 Mon Sep 17 00:00:00 2001 From: Piyush Aggarwal Date: Sat, 3 Jul 2021 04:23:49 +0530 Subject: [PATCH] kdeconnect-handler: auto select the sendFile radio button if url is actually a local file --- urlhandler/kdeconnect-handler.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/urlhandler/kdeconnect-handler.cpp b/urlhandler/kdeconnect-handler.cpp index 1d687152d..c716695c6 100644 --- a/urlhandler/kdeconnect-handler.cpp +++ b/urlhandler/kdeconnect-handler.cpp @@ -111,6 +111,13 @@ int main(int argc, char** argv) } }); + QObject::connect(urlRequester, &KUrlRequester::textChanged, [urlRequester, &uidialog](const QString& newUrl) + { + bool isLocalFileUrl = QFileInfo(newUrl).exists() && QFileInfo(newUrl).isFile(); // we don't support sending directories yet! + uidialog.sendFileRadioButton->setChecked(isLocalFileUrl); + uidialog.sendUrlRadioButton->setChecked(!isLocalFileUrl); + }); + if (!urlToShare.isEmpty()) { uidialog.sendUrlRadioButton->setVisible(false); uidialog.sendFileRadioButton->setVisible(false);