1
0
mirror of https://invent.kde.org/network/krdc synced 2024-07-08 20:05:56 +00:00

Make default protocol configurable

Add a new config option for the default protocol.
Default protocol: protocol to use when passing a hostname
via command line without a scheme.
~~
$ krdc my.host
~~
expands to vnc://my.host since the dawn of time. With the
default protocol set to "rdp" it expands to rdp://my.host

The default protocol defaults to vnc to keep the current
behavior.

REVIEW: 128496
This commit is contained in:
Arno Möller 2016-07-25 19:44:12 +02:00 committed by Urs Wolfer
parent d795833e71
commit 89cd4132dc
3 changed files with 24 additions and 2 deletions

View File

@ -120,6 +120,24 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayoutP">
<item>
<widget class="QLabel" name="defaultProtocolLabel">
<property name="text">
<string>Default protocol:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="kcfg_DefaultProtocol">
<property name="text">
<string>vnc</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>

View File

@ -60,6 +60,9 @@
<entry name="ConnectionListSortOrder" type="Int">
<default>1</default>
</entry>
<entry name="DefaultProtocol" type="String">
<default>vnc</default>
</entry>
</group>
<group name="VNC">
<entry name="Quality" type="Int">

View File

@ -25,6 +25,7 @@
#include "mainwindow.h"
#include "krdc_debug.h"
#include "krdc_version.h"
#include "settings.h"
#include <KCoreAddons/KAboutData>
#include <Kdelibs4ConfigMigrator>
@ -120,9 +121,9 @@ int main(int argc, char **argv)
for (int i = 0; i < args.length(); ++i) {
QUrl url = QUrl(args.at(i));
// no URL scheme, assume argument is only a hostname
// and default to vnc as protocol.
if (url.scheme().isEmpty()) {
url.setScheme(QStringLiteral("vnc"));
QString defaultProto = Settings::defaultProtocol();
url.setScheme(defaultProto);
url.setHost(args.at(i));
url.setPath(QString());
}