Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Network
KRDC
Commits
a9e514b2
Commit
a9e514b2
authored
Jan 02, 2015
by
Tony Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for FreeRDP 1.0.2 and newer. Including 1.1 and 1.2.
FEATURE: BUG: 341284 FIXED-IN: 14.12.1 REVIEW: 115059
parent
3b5682f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
184 additions
and
81 deletions
+184
-81
rdp/rdpview.cpp
rdp/rdpview.cpp
+184
-81
No files found.
rdp/rdpview.cpp
View file @
a9e514b2
...
@@ -146,102 +146,205 @@ bool RdpView::start()
...
@@ -146,102 +146,205 @@ bool RdpView::start()
}
}
}
}
// Check the version of FreeRDP so we can use pre-1.1 switches if needed
QProcess
*
xfreeRDPVersionCheck
=
new
QProcess
(
this
);
xfreeRDPVersionCheck
->
start
(
"xfreerdp"
,
QStringList
(
"--version"
));
xfreeRDPVersionCheck
->
waitForFinished
();
QString
versionOutput
=
xfreeRDPVersionCheck
->
readAllStandardOutput
();
xfreeRDPVersionCheck
->
deleteLater
();
m_process
=
new
QProcess
(
m_container
);
m_process
=
new
QProcess
(
m_container
);
QStringList
arguments
;
QStringList
arguments
;
int
width
,
height
;
if
(
versionOutput
.
contains
(
QLatin1String
(
" 1.0"
)))
{
if
(
m_hostPreferences
->
width
()
>
0
)
{
kDebug
(
5012
)
<<
"Use FreeRDP 1.0 compatible arguments"
;
width
=
m_hostPreferences
->
width
();
height
=
m_hostPreferences
->
height
();
}
else
{
width
=
this
->
parentWidget
()
->
size
().
width
();
height
=
this
->
parentWidget
()
->
size
().
height
();
}
arguments
<<
"-g"
<<
QString
::
number
(
width
)
+
'x'
+
QString
::
number
(
height
);
arguments
<<
"-k"
<<
keymapToXfreerdp
(
m_hostPreferences
->
keyboardLayout
());
if
(
!
m_url
.
userName
().
isEmpty
())
{
int
width
,
height
;
// if username contains a domain, it needs to be set with another parameter
if
(
m_hostPreferences
->
width
()
>
0
)
{
if
(
m_url
.
userName
().
contains
(
'\\'
))
{
width
=
m_hostPreferences
->
width
();
const
QStringList
splittedName
=
m_url
.
userName
().
split
(
'\\'
);
height
=
m_hostPreferences
->
height
();
arguments
<<
"-d"
<<
splittedName
.
at
(
0
);
arguments
<<
"-u"
<<
splittedName
.
at
(
1
);
}
else
{
}
else
{
arguments
<<
"-u"
<<
m_url
.
userName
();
width
=
this
->
parentWidget
()
->
size
().
width
();
height
=
this
->
parentWidget
()
->
size
().
height
();
}
}
arguments
<<
"-g"
<<
QString
::
number
(
width
)
+
'x'
+
QString
::
number
(
height
);
arguments
<<
"-k"
<<
keymapToXfreerdp
(
m_hostPreferences
->
keyboardLayout
());
if
(
!
m_url
.
userName
().
isEmpty
())
{
// if username contains a domain, it needs to be set with another parameter
if
(
m_url
.
userName
().
contains
(
'\\'
))
{
const
QStringList
splittedName
=
m_url
.
userName
().
split
(
'\\'
);
arguments
<<
"-d"
<<
splittedName
.
at
(
0
);
arguments
<<
"-u"
<<
splittedName
.
at
(
1
);
}
else
{
arguments
<<
"-u"
<<
m_url
.
userName
();
}
}
else
{
arguments
<<
"-u"
<<
""
;
}
arguments
<<
"-D"
;
// request the window has no decorations
arguments
<<
"-X"
<<
QString
::
number
(
m_container
->
winId
());
arguments
<<
"-a"
<<
QString
::
number
((
m_hostPreferences
->
colorDepth
()
+
1
)
*
8
);
switch
(
m_hostPreferences
->
sound
())
{
case
1
:
arguments
<<
"-o"
;
break
;
case
0
:
arguments
<<
"--plugin"
<<
"rdpsnd"
;
break
;
case
2
:
default:
break
;
}
if
(
!
m_hostPreferences
->
shareMedia
().
isEmpty
())
{
QStringList
shareMedia
;
shareMedia
<<
"--plugin"
<<
"rdpdr"
<<
"--data"
<<
"disk:media:"
+
m_hostPreferences
->
shareMedia
()
<<
"--"
;
arguments
+=
shareMedia
;
}
QString
performance
;
switch
(
m_hostPreferences
->
performance
())
{
case
0
:
performance
=
'm'
;
break
;
case
1
:
performance
=
'b'
;
break
;
case
2
:
performance
=
'l'
;
break
;
default:
break
;
}
arguments
<<
"-x"
<<
performance
;
if
(
m_hostPreferences
->
console
())
{
arguments
<<
"-0"
;
}
if
(
m_hostPreferences
->
remoteFX
())
{
arguments
<<
"--rfx"
;
}
if
(
!
m_hostPreferences
->
extraOptions
().
isEmpty
())
{
const
QStringList
additionalArguments
=
KShell
::
splitArgs
(
m_hostPreferences
->
extraOptions
());
arguments
+=
additionalArguments
;
}
// krdc has no support for certificate management yet; it would not be possbile to connect to any host:
// "The host key for example.com has changed" ...
// "Add correct host key in ~/.freerdp/known_hosts to get rid of this message."
arguments
<<
"--ignore-certificate"
;
// clipboard sharing is activated in KRDC; user can disable it at runtime
arguments
<<
"--plugin"
<<
"cliprdr"
;
arguments
<<
"-t"
<<
QString
::
number
(
m_port
);
arguments
<<
m_host
;
kDebug
(
5012
)
<<
"Starting xfreerdp with arguments: "
<<
arguments
.
join
(
" "
);
arguments
.
removeLast
();
// host must be last, remove and re-add it after the password
if
(
!
m_url
.
password
().
isNull
())
arguments
<<
"-p"
<<
m_url
.
password
();
arguments
<<
m_host
;
}
else
{
}
else
{
arguments
<<
"-u"
<<
""
;
kDebug
(
5012
)
<<
"Use FreeRDP 1.1+ compatible arguments"
;
}
if
(
!
m_url
.
password
().
isNull
())
int
width
,
height
;
arguments
<<
"-p"
<<
m_url
.
password
();
if
(
m_hostPreferences
->
width
()
>
0
)
{
width
=
m_hostPreferences
->
width
();
arguments
<<
"-D"
;
// request the window has no decorations
height
=
m_hostPreferences
->
height
();
arguments
<<
"-X"
<<
QString
::
number
(
m_container
->
winId
());
}
else
{
arguments
<<
"-a"
<<
QString
::
number
((
m_hostPreferences
->
colorDepth
()
+
1
)
*
8
);
width
=
this
->
parentWidget
()
->
size
().
width
();
height
=
this
->
parentWidget
()
->
size
().
height
();
switch
(
m_hostPreferences
->
sound
())
{
}
case
1
:
arguments
<<
"-decorations"
;
arguments
<<
"-o"
;
arguments
<<
"/w:"
+
QString
::
number
(
width
);
break
;
arguments
<<
"/h:"
+
QString
::
number
(
height
);
case
0
:
arguments
<<
"--plugin"
<<
"rdpsnd"
;
arguments
<<
"/kbd:"
+
keymapToXfreerdp
(
m_hostPreferences
->
keyboardLayout
());
break
;
case
2
:
if
(
!
m_url
.
userName
().
isEmpty
())
{
default:
// if username contains a domain, it needs to be set with another parameter
break
;
if
(
m_url
.
userName
().
contains
(
'\\'
))
{
}
const
QStringList
splittedName
=
m_url
.
userName
().
split
(
'\\'
);
arguments
<<
"/d:"
+
splittedName
.
at
(
0
);
arguments
<<
"/u:"
+
splittedName
.
at
(
1
);
}
else
{
arguments
<<
"/u:"
+
m_url
.
userName
();
}
}
else
{
arguments
<<
"/u:"
;
}
if
(
!
m_hostPreferences
->
shareMedia
().
isEmpty
())
{
arguments
<<
"/parent-window:"
+
QString
::
number
(
m_container
->
winId
());
QStringList
shareMedia
;
arguments
<<
"/bpp:"
+
QString
::
number
((
m_hostPreferences
->
colorDepth
()
+
1
)
*
8
);
shareMedia
<<
"--plugin"
<<
"rdpdr"
<<
"--data"
<<
"disk:media:"
+
m_hostPreferences
->
shareMedia
()
<<
"--"
;
arguments
<<
"/audio-mode:"
+
QString
::
number
(
m_hostPreferences
->
sound
());
arguments
+=
shareMedia
;
}
QString
performance
;
if
(
!
m_hostPreferences
->
shareMedia
().
isEmpty
())
{
switch
(
m_hostPreferences
->
performance
())
{
QStringList
shareMedia
;
case
0
:
shareMedia
<<
"/drive:media,"
+
m_hostPreferences
->
shareMedia
();
performance
=
'm'
;
arguments
+=
shareMedia
;
break
;
}
case
1
:
performance
=
'b'
;
break
;
case
2
:
performance
=
'l'
;
break
;
default:
break
;
}
arguments
<<
"-x"
<<
performance
;
QString
performance
;
switch
(
m_hostPreferences
->
performance
())
{
case
0
:
performance
=
"modem"
;
break
;
case
1
:
performance
=
"broadband"
;
break
;
case
2
:
performance
=
"lan"
;
break
;
default:
break
;
}
if
(
m_hostPreferences
->
console
())
{
arguments
<<
"/network:"
+
performance
;
arguments
<<
"-0"
;
}
if
(
m_hostPreferences
->
remoteFX
())
{
if
(
m_hostPreferences
->
console
())
{
arguments
<<
"
--rfx
"
;
arguments
<<
"
/admin
"
;
}
}
if
(
!
m_hostPreferences
->
extraOptions
().
isEmpty
())
{
if
(
m_hostPreferences
->
remoteFX
())
{
const
QStringList
additionalArguments
=
KShell
::
splitArgs
(
m_hostPreferences
->
extraOptions
());
arguments
<<
"/rfx"
;
arguments
+=
additionalArguments
;
}
}
if
(
!
m_hostPreferences
->
extraOptions
().
isEmpty
())
{
const
QStringList
additionalArguments
=
KShell
::
splitArgs
(
m_hostPreferences
->
extraOptions
());
arguments
+=
additionalArguments
;
}
// krdc has no support for certificate management yet; it would not be possbile to connect to any host:
// "The host key for example.com has changed" ...
// "Add correct host key in ~/.freerdp/known_hosts to get rid of this message."
arguments
<<
"/cert-ignore"
;
// clipboard sharing is activated in KRDC; user can disable it at runtime
arguments
<<
"+clipboard"
;
// krdc has no support for certificate management yet; it would not be possbile to connect to any host:
arguments
<<
"/port:"
+
QString
::
number
(
m_port
);
// "The host key for example.com has changed" ...
arguments
<<
"/v:"
+
m_host
;
// "Add correct host key in ~/.freerdp/known_hosts to get rid of this message."
arguments
<<
"--ignore-certificate"
;
// clipboard sharing is activated in KRDC; user can disable it at runtime
kDebug
(
5012
)
<<
"Starting xfreerdp with arguments: "
<<
arguments
.
join
(
" "
);
arguments
<<
"--plugin"
<<
"cliprdr"
;
arguments
<<
"-t"
<<
QString
::
number
(
m_port
);
//avoid printing the password in debug
arguments
<<
m_host
;
if
(
!
m_url
.
password
().
isNull
())
{
arguments
<<
"/p:"
+
m_url
.
password
();
}
kDebug
(
5012
)
<<
"Starting xfreerdp with arguments: "
<<
arguments
.
join
(
" "
);
kDebug
(
5012
)
<<
"Starting xfreerdp with arguments:"
<<
arguments
;
}
setStatus
(
Connecting
);
setStatus
(
Connecting
);
...
@@ -302,7 +405,7 @@ void RdpView::connectionError()
...
@@ -302,7 +405,7 @@ void RdpView::connectionError()
void
RdpView
::
processError
(
QProcess
::
ProcessError
error
)
void
RdpView
::
processError
(
QProcess
::
ProcessError
error
)
{
{
kDebug
(
5012
)
<<
"processError:"
<<
error
;
kDebug
(
5012
)
<<
error
;
if
(
m_quitFlag
)
// do not try to show error messages while quitting (prevent crashes)
if
(
m_quitFlag
)
// do not try to show error messages while quitting (prevent crashes)
return
;
return
;
...
@@ -319,11 +422,11 @@ void RdpView::processError(QProcess::ProcessError error)
...
@@ -319,11 +422,11 @@ void RdpView::processError(QProcess::ProcessError error)
void
RdpView
::
receivedStandardError
()
void
RdpView
::
receivedStandardError
()
{
{
const
QString
output
(
m_process
->
readAllStandardError
());
const
QString
output
(
m_process
->
readAllStandardError
());
kDebug
(
5012
)
<<
"receivedStandardError:"
<<
output
;
kDebug
(
5012
)
<<
output
;
QString
line
;
QString
line
;
int
i
=
0
;
int
i
=
0
;
while
(
!
(
line
=
output
.
section
(
'\n'
,
i
,
i
)).
isEmpty
())
{
while
(
!
(
line
=
output
.
section
(
'\n'
,
i
,
i
)).
isEmpty
())
{
// the following error is issued by freerdp because of a bug in freerdp 1.0.1 and below;
// the following error is issued by freerdp because of a bug in freerdp 1.0.1 and below;
// see: https://github.com/FreeRDP/FreeRDP/pull/576
// see: https://github.com/FreeRDP/FreeRDP/pull/576
//"X Error of failed request: BadWindow (invalid Window parameter)
//"X Error of failed request: BadWindow (invalid Window parameter)
...
@@ -345,7 +448,7 @@ void RdpView::receivedStandardError()
...
@@ -345,7 +448,7 @@ void RdpView::receivedStandardError()
void
RdpView
::
receivedStandardOutput
()
void
RdpView
::
receivedStandardOutput
()
{
{
const
QString
output
(
m_process
->
readAllStandardOutput
());
const
QString
output
(
m_process
->
readAllStandardOutput
());
kDebug
(
5012
)
<<
"receivedStandardOutput:"
<<
output
;
kDebug
(
5012
)
<<
output
;
QString
line
;
QString
line
;
int
i
=
0
;
int
i
=
0
;
while
(
!
(
line
=
output
.
section
(
'\n'
,
i
,
i
)).
isEmpty
())
{
while
(
!
(
line
=
output
.
section
(
'\n'
,
i
,
i
)).
isEmpty
())
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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