Lines 158-228
bool RdpView::start()
Link Here
|
158 |
width = this->parentWidget()->size().width(); |
158 |
width = this->parentWidget()->size().width(); |
159 |
height = this->parentWidget()->size().height(); |
159 |
height = this->parentWidget()->size().height(); |
160 |
} |
160 |
} |
161 |
arguments << "-g" << QString::number(width) + 'x' + QString::number(height); |
161 |
arguments << "-decorations"; // put this option first so we can detect xfreerdp < 1.1 |
|
|
162 |
arguments << "/w:" + QString::number(width); |
163 |
arguments << "/h:" + QString::number(height); |
162 |
|
164 |
|
163 |
arguments << "-k" << keymapToXfreerdp(m_hostPreferences->keyboardLayout()); |
165 |
arguments << "/kbd:" + keymapToXfreerdp(m_hostPreferences->keyboardLayout()); |
164 |
|
166 |
|
165 |
if (!m_url.userName().isEmpty()) { |
167 |
if (!m_url.userName().isEmpty()) { |
166 |
// if username contains a domain, it needs to be set with another parameter |
168 |
// if username contains a domain, it needs to be set with another parameter |
167 |
if (m_url.userName().contains('\\')) { |
169 |
if (m_url.userName().contains('\\')) { |
168 |
const QStringList splittedName = m_url.userName().split('\\'); |
170 |
const QStringList splittedName = m_url.userName().split('\\'); |
169 |
arguments << "-d" << splittedName.at(0); |
171 |
arguments << "/d:" + splittedName.at(0); |
170 |
arguments << "-u" << splittedName.at(1); |
172 |
arguments << "/u:" + splittedName.at(1); |
171 |
} else { |
173 |
} else { |
172 |
arguments << "-u" << m_url.userName(); |
174 |
arguments << "/u:" + m_url.userName(); |
173 |
} |
175 |
} |
174 |
} else { |
176 |
} else { |
175 |
arguments << "-u" << ""; |
177 |
arguments << "-u:"; |
176 |
} |
178 |
} |
177 |
|
179 |
|
178 |
if (!m_url.password().isNull()) |
180 |
arguments << "/parent-window:" + QString::number(m_container->winId()); |
179 |
arguments << "-p" << m_url.password(); |
181 |
arguments << "/bpp:" + QString::number((m_hostPreferences->colorDepth() + 1) * 8); |
180 |
|
182 |
arguments << "/audio-mode:" + m_hostPreferences->sound(); |
181 |
arguments << "-D"; // request the window has no decorations |
|
|
182 |
arguments << "-X" << QString::number(m_container->winId()); |
183 |
arguments << "-a" << QString::number((m_hostPreferences->colorDepth() + 1) * 8); |
184 |
|
185 |
switch (m_hostPreferences->sound()) { |
186 |
case 1: |
187 |
arguments << "-o"; |
188 |
break; |
189 |
case 0: |
190 |
arguments << "--plugin" << "rdpsnd"; |
191 |
break; |
192 |
case 2: |
193 |
default: |
194 |
break; |
195 |
} |
196 |
|
183 |
|
197 |
if (!m_hostPreferences->shareMedia().isEmpty()) { |
184 |
if (!m_hostPreferences->shareMedia().isEmpty()) { |
198 |
QStringList shareMedia; |
185 |
QStringList shareMedia; |
199 |
shareMedia << "--plugin" << "rdpdr" << "--data" << "disk:media:" + m_hostPreferences->shareMedia() << "--"; |
186 |
shareMedia << "/drive:media," + m_hostPreferences->shareMedia(); |
200 |
arguments += shareMedia; |
187 |
arguments += shareMedia; |
201 |
} |
188 |
} |
202 |
|
189 |
|
203 |
QString performance; |
190 |
QString performance; |
204 |
switch (m_hostPreferences->performance()) { |
191 |
switch (m_hostPreferences->performance()) { |
205 |
case 0: |
192 |
case 0: |
206 |
performance = 'm'; |
193 |
performance = "modem"; |
207 |
break; |
194 |
break; |
208 |
case 1: |
195 |
case 1: |
209 |
performance = 'b'; |
196 |
performance = "broadband"; |
210 |
break; |
197 |
break; |
211 |
case 2: |
198 |
case 2: |
212 |
performance = 'l'; |
199 |
performance = "lan"; |
213 |
break; |
200 |
break; |
214 |
default: |
201 |
default: |
215 |
break; |
202 |
break; |
216 |
} |
203 |
} |
217 |
|
204 |
|
218 |
arguments << "-x" << performance; |
205 |
arguments << "/network:" + performance; |
219 |
|
206 |
|
220 |
if (m_hostPreferences->console()) { |
207 |
if (m_hostPreferences->console()) { |
221 |
arguments << "-0"; |
208 |
arguments << "/admin"; |
222 |
} |
209 |
} |
223 |
|
210 |
|
224 |
if (m_hostPreferences->remoteFX()) { |
211 |
if (m_hostPreferences->remoteFX()) { |
225 |
arguments << "--rfx"; |
212 |
arguments << "/rfx"; |
226 |
} |
213 |
} |
227 |
|
214 |
|
228 |
if (!m_hostPreferences->extraOptions().isEmpty()) { |
215 |
if (!m_hostPreferences->extraOptions().isEmpty()) { |
Lines 233-248
bool RdpView::start()
Link Here
|
233 |
// krdc has no support for certificate management yet; it would not be possbile to connect to any host: |
220 |
// krdc has no support for certificate management yet; it would not be possbile to connect to any host: |
234 |
// "The host key for example.com has changed" ... |
221 |
// "The host key for example.com has changed" ... |
235 |
// "Add correct host key in ~/.freerdp/known_hosts to get rid of this message." |
222 |
// "Add correct host key in ~/.freerdp/known_hosts to get rid of this message." |
236 |
arguments << "--ignore-certificate"; |
223 |
arguments << "/cert-ignore"; |
237 |
|
224 |
|
238 |
// clipboard sharing is activated in KRDC; user can disable it at runtime |
225 |
// clipboard sharing is activated in KRDC; user can disable it at runtime |
239 |
arguments << "--plugin" << "cliprdr"; |
226 |
arguments << "/clipboard"; |
240 |
|
227 |
|
241 |
arguments << "-t" << QString::number(m_port); |
228 |
arguments << "/port:" + QString::number(m_port); |
242 |
arguments << m_host; |
229 |
arguments << "/v:" + m_host; |
243 |
|
230 |
|
244 |
kDebug(5012) << "Starting xfreerdp with arguments:" << arguments; |
231 |
kDebug(5012) << "Starting xfreerdp with arguments:" << arguments; |
245 |
|
232 |
|
|
|
233 |
//avoid printing the password in debug |
234 |
if (!m_url.password().isNull()) { |
235 |
arguments << "/p:" + m_url.password(); |
236 |
} |
237 |
|
246 |
setStatus(Connecting); |
238 |
setStatus(Connecting); |
247 |
|
239 |
|
248 |
connect(m_process, SIGNAL(error(QProcess::ProcessError)), SLOT(processError(QProcess::ProcessError))); |
240 |
connect(m_process, SIGNAL(error(QProcess::ProcessError)), SLOT(processError(QProcess::ProcessError))); |
Lines 302-308
void RdpView::connectionError()
Link Here
|
302 |
|
294 |
|
303 |
void RdpView::processError(QProcess::ProcessError error) |
295 |
void RdpView::processError(QProcess::ProcessError error) |
304 |
{ |
296 |
{ |
305 |
kDebug(5012) << "processError:" << error; |
297 |
kDebug(5012) << error; |
306 |
if (m_quitFlag) // do not try to show error messages while quitting (prevent crashes) |
298 |
if (m_quitFlag) // do not try to show error messages while quitting (prevent crashes) |
307 |
return; |
299 |
return; |
308 |
|
300 |
|
Lines 319-351
void RdpView::processError(QProcess::ProcessError error)
Link Here
|
319 |
void RdpView::receivedStandardError() |
311 |
void RdpView::receivedStandardError() |
320 |
{ |
312 |
{ |
321 |
const QString output(m_process->readAllStandardError()); |
313 |
const QString output(m_process->readAllStandardError()); |
322 |
kDebug(5012) << "receivedStandardError:" << output; |
314 |
kDebug(5012) << output; |
323 |
QString line; |
|
|
324 |
int i = 0; |
325 |
while (!(line = output.section('\n', i, i)).isEmpty()) { |
326 |
|
327 |
// the following error is issued by freerdp because of a bug in freerdp 1.0.1 and below; |
328 |
// see: https://github.com/FreeRDP/FreeRDP/pull/576 |
329 |
//"X Error of failed request: BadWindow (invalid Window parameter) |
330 |
// Major opcode of failed request: 7 (X_ReparentWindow) |
331 |
// Resource id in failed request: 0x71303348 |
332 |
// Serial number of failed request: 36 |
333 |
// Current serial number in output stream: 36" |
334 |
if (line.contains(QLatin1String("X_ReparentWindow"))) { |
335 |
KMessageBox::error(0, i18n("The version of \"xfreerdp\" you are using is too old.\n" |
336 |
"xfreerdp 1.0.2 or greater is required."), |
337 |
i18n("RDP Failure")); |
338 |
connectionError(); |
339 |
return; |
340 |
} |
341 |
i++; |
342 |
} |
343 |
} |
315 |
} |
344 |
|
316 |
|
345 |
void RdpView::receivedStandardOutput() |
317 |
void RdpView::receivedStandardOutput() |
346 |
{ |
318 |
{ |
347 |
const QString output(m_process->readAllStandardOutput()); |
319 |
const QString output(m_process->readAllStandardOutput()); |
348 |
kDebug(5012) << "receivedStandardOutput:" << output; |
320 |
kDebug(5012) << output; |
349 |
QString line; |
321 |
QString line; |
350 |
int i = 0; |
322 |
int i = 0; |
351 |
while (!(line = output.section('\n', i, i)).isEmpty()) { |
323 |
while (!(line = output.section('\n', i, i)).isEmpty()) { |
Lines 373-378
void RdpView::receivedStandardOutput()
Link Here
|
373 |
return; |
345 |
return; |
374 |
} |
346 |
} |
375 |
|
347 |
|
|
|
348 |
// we no longer support freerdp < 1.1, we only support versions with the new interface |
349 |
if (line.contains(QLatin1String("invalid option: -decorations"))) { |
350 |
KMessageBox::error(0, i18n("The version of \"xfreerdp\" you are using is too old.\n" |
351 |
"xfreerdp 1.1 or greater is required."), |
352 |
i18n("RDP Failure")); |
353 |
connectionError(); |
354 |
return; |
355 |
} |
376 |
i++; |
356 |
i++; |
377 |
} |
357 |
} |
378 |
} |
358 |
} |