[handler] Embed URL into string
Summary: E.g. Device to call +1234567 with Device to send /home/nico/foo to Device to open http://google.com on Reviewers: #kde_connect, apol Reviewed By: #kde_connect, apol Subscribers: apol, kdeconnect Tags: #kde_connect Differential Revision: https://phabricator.kde.org/D16623
This commit is contained in:
parent
357751ac68
commit
193481ce46
2 changed files with 11 additions and 13 deletions
|
@ -20,13 +20,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="urlLabel">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -85,21 +85,26 @@ int main(int argc, char** argv)
|
|||
proxyModel.setSourceModel(&model);
|
||||
|
||||
QDialog dialog;
|
||||
dialog.setWindowTitle(urlToShare.toDisplayString(QUrl::PreferLocalFile));
|
||||
|
||||
Ui::Dialog uidialog;
|
||||
uidialog.setupUi(&dialog);
|
||||
uidialog.devicePicker->setModel(&proxyModel);
|
||||
|
||||
QString displayUrl;
|
||||
|
||||
if (urlToShare.scheme() == QLatin1String("tel")) {
|
||||
uidialog.label->setText(i18n("Device to call this phone number with:"));
|
||||
uidialog.urlLabel->setText(urlToShare.toDisplayString(QUrl::RemoveScheme));
|
||||
displayUrl = urlToShare.toDisplayString(QUrl::RemoveScheme);
|
||||
uidialog.label->setText(i18n("Device to call %1 with:", displayUrl));
|
||||
} else if (urlToShare.isLocalFile()) {
|
||||
uidialog.label->setText(i18n("Device to send this file to:"));
|
||||
uidialog.urlLabel->setText(urlToShare.toDisplayString(QUrl::PreferLocalFile));
|
||||
displayUrl = urlToShare.toDisplayString(QUrl::PreferLocalFile);
|
||||
uidialog.label->setText(i18n("Device to send %1 to:", displayUrl));
|
||||
} else {
|
||||
uidialog.urlLabel->setText(urlToShare.toDisplayString());
|
||||
displayUrl = urlToShare.toDisplayString(QUrl::PreferLocalFile);
|
||||
uidialog.label->setText(i18n("Device to open %1 on:", displayUrl));
|
||||
}
|
||||
|
||||
dialog.setWindowTitle(displayUrl);
|
||||
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
QUrl url = urlToShare;
|
||||
const int currentDeviceIndex = uidialog.devicePicker->currentIndex();
|
||||
|
|
Loading…
Reference in a new issue