kdeconnect-handler: auto select the sendFile radio button if url is actually a local file

This commit is contained in:
Piyush Aggarwal 2021-07-03 04:23:49 +05:30
parent e683dd218a
commit ea8ed5c427

View file

@ -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);