Blame SOURCES/kdenetwork-4.10.5-freerdp.patch

a0c1b7
diff -up kdenetwork-4.10.5/krdc/CMakeLists.txt.freerdp kdenetwork-4.10.5/krdc/CMakeLists.txt
a0c1b7
--- kdenetwork-4.10.5/krdc/CMakeLists.txt.freerdp	2013-07-04 21:52:45.864029571 +0200
a0c1b7
+++ kdenetwork-4.10.5/krdc/CMakeLists.txt	2013-07-04 22:05:59.950275124 +0200
a0c1b7
@@ -29,7 +29,13 @@ endif(NOT INSIDE_KDENETWORK)
a0c1b7
 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
a0c1b7
 
a0c1b7
 macro_optional_find_package(LibVNCServer)
a0c1b7
-macro_log_feature(LIBVNCSERVER_FOUND "libvncserver" "VNC Server library" "http://libvncserver.sourceforge.net/" FALSE "0.9" "Needed to build Krfb and VNC support in Krdc")
a0c1b7
+macro_log_feature(LIBVNCSERVER_FOUND "libvncserver" "VNC Server library" "http://libvncserver.sourceforge.net/" FALSE "0.9" "Needed to build Krfb and VNC support in KRDC")
a0c1b7
+
a0c1b7
+FIND_PROGRAM(FREERDP_EXECUTABLE xfreerdp)
a0c1b7
+if(FREERDP_EXECUTABLE)
a0c1b7
+    set(FREERDP_EXECUTABLE_FOUND true)
a0c1b7
+endif(FREERDP_EXECUTABLE)
a0c1b7
+macro_log_feature(FREERDP_EXECUTABLE_FOUND "freerdp" "A free Remote Desktop Protocol (RDP) Implementation" "http://www.freerdp.com" FALSE "1.0.2" "Needed for RDP support in KRDC (at runtime)")
a0c1b7
 
a0c1b7
 # NX support is not ready for KDE 4.2; disabled (uwolfer)
a0c1b7
 # macro_optional_find_package(LibNXCL)
a0c1b7
diff -up kdenetwork-4.10.5/krdc/core/krdc.kcfg.freerdp kdenetwork-4.10.5/krdc/core/krdc.kcfg
a0c1b7
--- kdenetwork-4.10.5/krdc/core/krdc.kcfg.freerdp	2013-06-28 20:08:57.390483848 +0200
a0c1b7
+++ kdenetwork-4.10.5/krdc/core/krdc.kcfg	2013-07-04 21:52:45.865029569 +0200
a0c1b7
@@ -83,7 +83,7 @@
a0c1b7
       <default>7</default>
a0c1b7
     </entry>
a0c1b7
     <entry name="ColorDepth" type="Int">
a0c1b7
-      <default>0</default>
a0c1b7
+      <default>2</default>
a0c1b7
     </entry>
a0c1b7
     <entry name="Sound" type="Int">
a0c1b7
       <default>0</default>
a0c1b7
@@ -100,6 +100,15 @@
a0c1b7
     <entry name="RecognizeLdapLogins" type="Bool">
a0c1b7
       <default>true</default>
a0c1b7
     </entry>
a0c1b7
+    <entry name="RemoteFX" type="Bool">
a0c1b7
+      <default>true</default>
a0c1b7
+    </entry>
a0c1b7
+    <entry name="Performance" type="Int">
a0c1b7
+      <default>2</default>
a0c1b7
+    </entry>
a0c1b7
+    <entry name="ShareMedia" type="String">
a0c1b7
+      <default>/media</default>
a0c1b7
+    </entry>
a0c1b7
   </group>
a0c1b7
   <group name="NX">
a0c1b7
     <entry name="NxWidth" type="Int">
a0c1b7
diff -up kdenetwork-4.10.5/krdc/rdp/CMakeLists.txt.freerdp kdenetwork-4.10.5/krdc/rdp/CMakeLists.txt
a0c1b7
--- kdenetwork-4.10.5/krdc/rdp/CMakeLists.txt.freerdp	2013-06-28 20:08:57.392483928 +0200
a0c1b7
+++ kdenetwork-4.10.5/krdc/rdp/CMakeLists.txt	2013-07-04 21:52:45.865029569 +0200
a0c1b7
@@ -1,9 +1,9 @@
a0c1b7
 
a0c1b7
 if(Q_WS_X11)
a0c1b7
-    set(HAVE_RDESKTOP true) # TODO: implement cmake check?
a0c1b7
+    set(HAVE_XFREERDP true)
a0c1b7
 endif(Q_WS_X11)
a0c1b7
 
a0c1b7
-if(HAVE_RDESKTOP)
a0c1b7
+if(HAVE_XFREERDP)
a0c1b7
     add_definitions(-DKDE_DEFAULT_DEBUG_AREA=5012)
a0c1b7
 
a0c1b7
     include_directories(
a0c1b7
@@ -49,4 +49,4 @@ if(HAVE_RDESKTOP)
a0c1b7
 
a0c1b7
     install(FILES rdp.protocol DESTINATION ${SERVICES_INSTALL_DIR})
a0c1b7
     install(FILES smb2rdc.desktop DESTINATION ${SERVICES_INSTALL_DIR}/ServiceMenus)
a0c1b7
-endif(HAVE_RDESKTOP)
a0c1b7
+endif(HAVE_XFREERDP)
a0c1b7
diff -up kdenetwork-4.10.5/krdc/rdp/rdphostpreferences.cpp.freerdp kdenetwork-4.10.5/krdc/rdp/rdphostpreferences.cpp
a0c1b7
--- kdenetwork-4.10.5/krdc/rdp/rdphostpreferences.cpp.freerdp	2013-06-28 20:08:57.392483928 +0200
a0c1b7
+++ kdenetwork-4.10.5/krdc/rdp/rdphostpreferences.cpp	2013-07-04 21:52:45.865029569 +0200
a0c1b7
@@ -1,6 +1,7 @@
a0c1b7
 /****************************************************************************
a0c1b7
 **
a0c1b7
-** Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
a0c1b7
+** Copyright (C) 2007 - 2012 Urs Wolfer <uwolfer @ kde.org>
a0c1b7
+** Copyright (C) 2012 AceLan Kao <acelan @ acelan.idv.tw>
a0c1b7
 **
a0c1b7
 ** This file is part of KDE.
a0c1b7
 **
a0c1b7
@@ -108,6 +109,9 @@ QWidget* RdpHostPreferences::createProto
a0c1b7
     rdpUi.kcfg_Sound->setCurrentIndex(sound());
a0c1b7
     rdpUi.kcfg_Console->setChecked(console());
a0c1b7
     rdpUi.kcfg_ExtraOptions->setText(extraOptions());
a0c1b7
+    rdpUi.kcfg_RemoteFX->setChecked(remoteFX());
a0c1b7
+    rdpUi.kcfg_Performance->setCurrentIndex(performance());
a0c1b7
+    rdpUi.kcfg_ShareMedia->setText(shareMedia());
a0c1b7
 
a0c1b7
     connect(rdpUi.resolutionComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateWidthHeight(int)));
a0c1b7
 
a0c1b7
@@ -172,6 +176,9 @@ void RdpHostPreferences::acceptConfig()
a0c1b7
     setSound(rdpUi.kcfg_Sound->currentIndex());
a0c1b7
     setConsole(rdpUi.kcfg_Console->isChecked());
a0c1b7
     setExtraOptions(rdpUi.kcfg_ExtraOptions->text());
a0c1b7
+    setRemoteFX(rdpUi.kcfg_RemoteFX->isChecked());
a0c1b7
+    setPerformance(rdpUi.kcfg_Performance->currentIndex());
a0c1b7
+    setShareMedia(rdpUi.kcfg_ShareMedia->text());
a0c1b7
 }
a0c1b7
 
a0c1b7
 void RdpHostPreferences::setColorDepth(int colorDepth)
a0c1b7
@@ -228,4 +235,36 @@ QString RdpHostPreferences::extraOptions
a0c1b7
     return m_configGroup.readEntry("extraOptions", Settings::extraOptions());
a0c1b7
 }
a0c1b7
 
a0c1b7
+void RdpHostPreferences::setRemoteFX(bool remoteFX)
a0c1b7
+{
a0c1b7
+    m_configGroup.writeEntry("remoteFX", remoteFX);
a0c1b7
+}
a0c1b7
+
a0c1b7
+bool RdpHostPreferences::remoteFX() const
a0c1b7
+{
a0c1b7
+    return m_configGroup.readEntry("remoteFX", Settings::remoteFX());
a0c1b7
+}
a0c1b7
+
a0c1b7
+void RdpHostPreferences::setPerformance(int performance)
a0c1b7
+{
a0c1b7
+    if (performance >= 0)
a0c1b7
+        m_configGroup.writeEntry("performance", performance);
a0c1b7
+}
a0c1b7
+
a0c1b7
+int RdpHostPreferences::performance() const
a0c1b7
+{
a0c1b7
+    return m_configGroup.readEntry("performance", Settings::performance());
a0c1b7
+}
a0c1b7
+
a0c1b7
+void RdpHostPreferences::setShareMedia(const QString &shareMedia)
a0c1b7
+{
a0c1b7
+    if (!shareMedia.isNull())
a0c1b7
+        m_configGroup.writeEntry("shareMedia", shareMedia);
a0c1b7
+}
a0c1b7
+
a0c1b7
+QString RdpHostPreferences::shareMedia() const
a0c1b7
+{
a0c1b7
+    return m_configGroup.readEntry("shareMedia", Settings::shareMedia());
a0c1b7
+}
a0c1b7
+
a0c1b7
 #include "rdphostpreferences.moc"
a0c1b7
diff -up kdenetwork-4.10.5/krdc/rdp/rdphostpreferences.h.freerdp kdenetwork-4.10.5/krdc/rdp/rdphostpreferences.h
a0c1b7
--- kdenetwork-4.10.5/krdc/rdp/rdphostpreferences.h.freerdp	2013-06-28 20:08:57.392483928 +0200
a0c1b7
+++ kdenetwork-4.10.5/krdc/rdp/rdphostpreferences.h	2013-07-04 21:52:45.866029567 +0200
a0c1b7
@@ -1,6 +1,7 @@
a0c1b7
 /****************************************************************************
a0c1b7
 **
a0c1b7
-** Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
a0c1b7
+** Copyright (C) 2007 - 2012 Urs Wolfer <uwolfer @ kde.org>
a0c1b7
+** Copyright (C) 2012 AceLan Kao <acelan @ acelan.idv.tw>
a0c1b7
 **
a0c1b7
 ** This file is part of KDE.
a0c1b7
 **
a0c1b7
@@ -45,6 +46,12 @@ public:
a0c1b7
     bool console() const;
a0c1b7
     void setExtraOptions(const QString &extraOptions);
a0c1b7
     QString extraOptions() const;
a0c1b7
+    void setRemoteFX(bool remoteFX);
a0c1b7
+    bool remoteFX() const;
a0c1b7
+    void setPerformance(int performance);
a0c1b7
+    int performance() const;
a0c1b7
+    void setShareMedia(const QString &shareMedia);
a0c1b7
+    QString shareMedia() const;
a0c1b7
 
a0c1b7
 protected:
a0c1b7
     QWidget* createProtocolSpecificConfigPage();
a0c1b7
diff -up kdenetwork-4.10.5/krdc/rdp/rdppreferences.ui.freerdp kdenetwork-4.10.5/krdc/rdp/rdppreferences.ui
a0c1b7
--- kdenetwork-4.10.5/krdc/rdp/rdppreferences.ui.freerdp	2013-06-28 20:08:57.392483928 +0200
a0c1b7
+++ kdenetwork-4.10.5/krdc/rdp/rdppreferences.ui	2013-07-04 21:52:45.866029567 +0200
a0c1b7
@@ -7,7 +7,7 @@
a0c1b7
     <x>0</x>
a0c1b7
     <y>0</y>
a0c1b7
     <width>484</width>
a0c1b7
-    <height>406</height>
a0c1b7
+    <height>452</height>
a0c1b7
    </rect>
a0c1b7
   </property>
a0c1b7
   <layout class="QVBoxLayout" name="verticalLayout_2">
a0c1b7
@@ -415,6 +415,12 @@
a0c1b7
       </item>
a0c1b7
       <item row="3" column="1">
a0c1b7
        <widget class="KComboBox" name="kcfg_Sound">
a0c1b7
+        <property name="minimumSize">
a0c1b7
+         <size>
a0c1b7
+          <width>280</width>
a0c1b7
+          <height>0</height>
a0c1b7
+         </size>
a0c1b7
+        </property>
a0c1b7
         <item>
a0c1b7
          <property name="text">
a0c1b7
           <string>On This Computer</string>
a0c1b7
@@ -432,6 +438,87 @@
a0c1b7
         </item>
a0c1b7
        </widget>
a0c1b7
       </item>
a0c1b7
+      <item row="4" column="0">
a0c1b7
+       <widget class="QLabel" name="performanceLabel">
a0c1b7
+        <property name="text">
a0c1b7
+         <string comment="label for performance settings in preferences dialog">Performance:</string>
a0c1b7
+        </property>
a0c1b7
+        <property name="buddy">
a0c1b7
+         <cstring>kcfg_Performance</cstring>
a0c1b7
+        </property>
a0c1b7
+       </widget>
a0c1b7
+      </item>
a0c1b7
+      <item row="4" column="1">
a0c1b7
+       <widget class="KComboBox" name="kcfg_Performance">
a0c1b7
+        <property name="minimumSize">
a0c1b7
+         <size>
a0c1b7
+          <width>280</width>
a0c1b7
+          <height>0</height>
a0c1b7
+         </size>
a0c1b7
+        </property>
a0c1b7
+        <item>
a0c1b7
+         <property name="text">
a0c1b7
+          <string>Modem</string>
a0c1b7
+         </property>
a0c1b7
+        </item>
a0c1b7
+        <item>
a0c1b7
+         <property name="text">
a0c1b7
+          <string>Broadband</string>
a0c1b7
+         </property>
a0c1b7
+        </item>
a0c1b7
+        <item>
a0c1b7
+         <property name="text">
a0c1b7
+          <string>LAN</string>
a0c1b7
+         </property>
a0c1b7
+        </item>
a0c1b7
+       </widget>
a0c1b7
+      </item>
a0c1b7
+      <item row="5" column="0">
a0c1b7
+       <widget class="QLabel" name="remoteFXLabel">
a0c1b7
+        <property name="text">
a0c1b7
+         <string>RemoteFX:</string>
a0c1b7
+        </property>
a0c1b7
+        <property name="buddy">
a0c1b7
+         <cstring>kcfg_RemoteFX</cstring>
a0c1b7
+        </property>
a0c1b7
+       </widget>
a0c1b7
+      </item>
a0c1b7
+      <item row="5" column="1">
a0c1b7
+       <widget class="QCheckBox" name="kcfg_RemoteFX">
a0c1b7
+        <property name="text">
a0c1b7
+         <string>Enable RemoteFX</string>
a0c1b7
+        </property>
a0c1b7
+        <property name="whatsThis">
a0c1b7
+         <string>RemoteFX covers a set of technologies that enhance visual experience of the Remote Desktop Protocol.</string>
a0c1b7
+        </property>
a0c1b7
+       </widget>
a0c1b7
+      </item>
a0c1b7
+      <item row="6" column="0">
a0c1b7
+       <widget class="QLabel" name="shareMediaLabel">
a0c1b7
+        <property name="text">
a0c1b7
+         <string>Share Media:</string>
a0c1b7
+        </property>
a0c1b7
+        <property name="buddy">
a0c1b7
+         <cstring>kcfg_ShareMedia</cstring>
a0c1b7
+        </property>
a0c1b7
+       </widget>
a0c1b7
+      </item>
a0c1b7
+      <item row="6" column="1">
a0c1b7
+       <widget class="KLineEdit" name="kcfg_ShareMedia">
a0c1b7
+        <property name="minimumSize">
a0c1b7
+         <size>
a0c1b7
+          <width>280</width>
a0c1b7
+          <height>0</height>
a0c1b7
+         </size>
a0c1b7
+        </property>
a0c1b7
+        <property name="whatsThis">
a0c1b7
+         <string>Share a local media directory with the remote host.</string>
a0c1b7
+        </property>
a0c1b7
+        <property name="showClearButton" stdset="0">
a0c1b7
+         <bool>true</bool>
a0c1b7
+        </property>
a0c1b7
+       </widget>
a0c1b7
+      </item>
a0c1b7
      </layout>
a0c1b7
     </widget>
a0c1b7
    </item>
a0c1b7
@@ -541,15 +628,15 @@
a0c1b7
  </widget>
a0c1b7
  <customwidgets>
a0c1b7
   <customwidget>
a0c1b7
-   <class>KLineEdit</class>
a0c1b7
-   <extends>QLineEdit</extends>
a0c1b7
-   <header>klineedit.h</header>
a0c1b7
-  </customwidget>
a0c1b7
-  <customwidget>
a0c1b7
    <class>KComboBox</class>
a0c1b7
    <extends>QComboBox</extends>
a0c1b7
    <header>kcombobox.h</header>
a0c1b7
   </customwidget>
a0c1b7
+  <customwidget>
a0c1b7
+   <class>KLineEdit</class>
a0c1b7
+   <extends>QLineEdit</extends>
a0c1b7
+   <header>klineedit.h</header>
a0c1b7
+  </customwidget>
a0c1b7
  </customwidgets>
a0c1b7
  <tabstops>
a0c1b7
   <tabstop>resolutionComboBox</tabstop>
a0c1b7
@@ -558,6 +645,9 @@
a0c1b7
   <tabstop>kcfg_ColorDepth</tabstop>
a0c1b7
   <tabstop>kcfg_KeyboardLayout</tabstop>
a0c1b7
   <tabstop>kcfg_Sound</tabstop>
a0c1b7
+  <tabstop>kcfg_Performance</tabstop>
a0c1b7
+  <tabstop>kcfg_RemoteFX</tabstop>
a0c1b7
+  <tabstop>kcfg_ShareMedia</tabstop>
a0c1b7
   <tabstop>kcfg_Console</tabstop>
a0c1b7
   <tabstop>kcfg_ExtraOptions</tabstop>
a0c1b7
   <tabstop>kcfg_DefaultRdpUserName</tabstop>
a0c1b7
diff -up kdenetwork-4.10.5/krdc/rdp/rdpview.cpp.freerdp kdenetwork-4.10.5/krdc/rdp/rdpview.cpp
a0c1b7
--- kdenetwork-4.10.5/krdc/rdp/rdpview.cpp.freerdp	2013-06-28 20:08:57.392483928 +0200
a0c1b7
+++ kdenetwork-4.10.5/krdc/rdp/rdpview.cpp	2013-07-04 21:52:45.866029567 +0200
a0c1b7
@@ -1,7 +1,8 @@
a0c1b7
 /****************************************************************************
a0c1b7
 **
a0c1b7
 ** Copyright (C) 2002 Arend van Beelen jr. <arend@auton.nl>
a0c1b7
-** Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
a0c1b7
+** Copyright (C) 2007 - 2012 Urs Wolfer <uwolfer @ kde.org>
a0c1b7
+** Copyright (C) 2012 AceLan Kao <acelan @ acelan.idv.tw>
a0c1b7
 **
a0c1b7
 ** This file is part of KDE.
a0c1b7
 **
a0c1b7
@@ -167,39 +168,72 @@ bool RdpView::start()
a0c1b7
     arguments << "-X" << QString::number(m_container->winId());
a0c1b7
     arguments << "-a" << QString::number((m_hostPreferences->colorDepth() + 1) * 8);
a0c1b7
 
a0c1b7
-    QString sound;
a0c1b7
     switch (m_hostPreferences->sound()) {
a0c1b7
+    case 1:
a0c1b7
+        arguments << "-o";
a0c1b7
+        break;
a0c1b7
+    case 0:
a0c1b7
+        arguments << "--plugin" << "rdpsnd";
a0c1b7
+        break;
a0c1b7
+    case 2:
a0c1b7
+    default:
a0c1b7
+        break;
a0c1b7
+    }
a0c1b7
+
a0c1b7
+    if (!m_hostPreferences->shareMedia().isEmpty()) {
a0c1b7
+        QStringList shareMedia;
a0c1b7
+        shareMedia << "--plugin" << "rdpdr" << "--data" << "disk:media:" + m_hostPreferences->shareMedia() << "--";
a0c1b7
+        arguments += shareMedia;
a0c1b7
+    }
a0c1b7
+
a0c1b7
+    QString performance;
a0c1b7
+    switch (m_hostPreferences->performance()) {
a0c1b7
     case 0:
a0c1b7
-        sound = "local";
a0c1b7
+        performance = "m";
a0c1b7
         break;
a0c1b7
     case 1:
a0c1b7
-        sound = "remote";
a0c1b7
+        performance = "b";
a0c1b7
         break;
a0c1b7
     case 2:
a0c1b7
+        performance = "l";
a0c1b7
+        break;
a0c1b7
     default:
a0c1b7
-        sound = "off";
a0c1b7
+        break;
a0c1b7
     }
a0c1b7
-    arguments << "-r" << "sound:" + sound;
a0c1b7
+
a0c1b7
+    arguments << "-x" << performance;
a0c1b7
 
a0c1b7
     if (m_hostPreferences->console()) {
a0c1b7
         arguments << "-0";
a0c1b7
     }
a0c1b7
 
a0c1b7
+    if (m_hostPreferences->remoteFX()) {
a0c1b7
+        arguments << "--rfx";
a0c1b7
+    }
a0c1b7
+
a0c1b7
     if (!m_hostPreferences->extraOptions().isEmpty()) {
a0c1b7
         const QStringList additionalArguments = KShell::splitArgs(m_hostPreferences->extraOptions());
a0c1b7
         arguments += additionalArguments;
a0c1b7
     }
a0c1b7
 
a0c1b7
+    // krdc has no support for certificate management yet; it would not be possbile to connect to any host:
a0c1b7
+    // "The host key for example.com has changed" ...
a0c1b7
+    // "Add correct host key in ~/.freerdp/known_hosts to get rid of this message."
a0c1b7
+    arguments << "--ignore-certificate";
a0c1b7
+
a0c1b7
     arguments << (m_host + ':' + QString::number(m_port));
a0c1b7
 
a0c1b7
+    kDebug(5012) << "Starting xfreerdp with arguments:" << arguments;
a0c1b7
+
a0c1b7
     setStatus(Connecting);
a0c1b7
 
a0c1b7
     connect(m_process, SIGNAL(error(QProcess::ProcessError)), SLOT(processError(QProcess::ProcessError)));
a0c1b7
     connect(m_process, SIGNAL(readyReadStandardError()), SLOT(receivedStandardError()));
a0c1b7
+    connect(m_process, SIGNAL(readyReadStandardOutput()), SLOT(receivedStandardOutput()));
a0c1b7
     connect(m_container, SIGNAL(clientClosed()), SLOT(connectionClosed()));
a0c1b7
     connect(m_container, SIGNAL(clientIsEmbedded()), SLOT(connectionOpened()));
a0c1b7
 
a0c1b7
-    m_process->start("rdesktop", arguments);
a0c1b7
+    m_process->start("xfreerdp", arguments);
a0c1b7
 
a0c1b7
     return true;
a0c1b7
 }
a0c1b7
@@ -242,45 +276,85 @@ void RdpView::connectionClosed()
a0c1b7
     m_quitFlag = true;
a0c1b7
 }
a0c1b7
 
a0c1b7
+void RdpView::connectionError()
a0c1b7
+{
a0c1b7
+    emit disconnectedError();
a0c1b7
+    connectionClosed();
a0c1b7
+}
a0c1b7
+
a0c1b7
 void RdpView::processError(QProcess::ProcessError error)
a0c1b7
 {
a0c1b7
+    kDebug(5012) << "processError:" << error;
a0c1b7
     if (m_quitFlag) // do not try to show error messages while quitting (prevent crashes)
a0c1b7
         return;
a0c1b7
 
a0c1b7
     if (m_status == Connecting) {
a0c1b7
-        setStatus(Disconnected);
a0c1b7
-
a0c1b7
         if (error == QProcess::FailedToStart) {
a0c1b7
-            KMessageBox::error(0, i18n("Could not start \"rdesktop\"; make sure rdesktop is properly installed."),
a0c1b7
+            KMessageBox::error(0, i18n("Could not start \"xfreerdp\"; make sure xfreerdp is properly installed."),
a0c1b7
                                i18n("RDP Failure"));
a0c1b7
+            connectionError();
a0c1b7
             return;
a0c1b7
         }
a0c1b7
+    }
a0c1b7
+}
a0c1b7
 
a0c1b7
-        if (m_clientVersion.isEmpty()) {
a0c1b7
-            KMessageBox::error(0, i18n("Connection attempt to host failed."),
a0c1b7
-                               i18n("Connection Failure"));
a0c1b7
-        } else {
a0c1b7
-            KMessageBox::error(0, i18n("The version of \"rdesktop\" you are using (%1) is too old:\n"
a0c1b7
-                                       "rdesktop 1.3.2 or greater is required.", m_clientVersion),
a0c1b7
+void RdpView::receivedStandardError()
a0c1b7
+{
a0c1b7
+    const QString output(m_process->readAllStandardError());
a0c1b7
+    kDebug(5012) << "receivedStandardError:" << output;
a0c1b7
+    QString line;
a0c1b7
+    int i = 0;
a0c1b7
+    while (!(line = output.section('\n', i, i)).isEmpty()) {
a0c1b7
+        
a0c1b7
+        // the following error is issued by freerdp because of a bug in freerdp 1.0.1 and below;
a0c1b7
+        // see: https://github.com/FreeRDP/FreeRDP/pull/576
a0c1b7
+        //"X Error of failed request:  BadWindow (invalid Window parameter)
a0c1b7
+        //   Major opcode of failed request:  7 (X_ReparentWindow)
a0c1b7
+        //   Resource id in failed request:  0x71303348
a0c1b7
+        //   Serial number of failed request:  36
a0c1b7
+        //   Current serial number in output stream:  36"
a0c1b7
+        if (line.contains(QLatin1String("X_ReparentWindow"))) {
a0c1b7
+            KMessageBox::error(0, i18n("The version of \"xfreerdp\" you are using is too old.\n"
a0c1b7
+                                       "xfreerdp 1.0.2 or greater is required."),
a0c1b7
                                i18n("RDP Failure"));
a0c1b7
+            connectionError();
a0c1b7
+            return;
a0c1b7
         }
a0c1b7
-        emit disconnectedError();
a0c1b7
+        i++;
a0c1b7
     }
a0c1b7
 }
a0c1b7
 
a0c1b7
-void RdpView::receivedStandardError()
a0c1b7
+void RdpView::receivedStandardOutput()
a0c1b7
 {
a0c1b7
-    const QString output(m_process->readAllStandardError());
a0c1b7
+    const QString output(m_process->readAllStandardOutput());
a0c1b7
+    kDebug(5012) << "receivedStandardOutput:" << output;
a0c1b7
     QString line;
a0c1b7
     int i = 0;
a0c1b7
     while (!(line = output.section('\n', i, i)).isEmpty()) {
a0c1b7
-        if (line.startsWith(QLatin1String("Version "))) {
a0c1b7
-            m_clientVersion = line.section(' ', 1, 1);
a0c1b7
-            m_clientVersion = m_clientVersion.left(m_clientVersion.length() - 1);
a0c1b7
+
a0c1b7
+        // full xfreerdp message: "transport_connect: getaddrinfo (Name or service not known)"
a0c1b7
+        if (line.contains(QLatin1String("Name or service not known"))) {
a0c1b7
+            KMessageBox::error(0, i18n("Name or service not known."),
a0c1b7
+                               i18n("Connection Failure"));
a0c1b7
+            connectionError();
a0c1b7
+            return;
a0c1b7
+
a0c1b7
+        // full xfreerdp message: "unable to connect to example.com:3389"
a0c1b7
+        } else if (line.contains(QLatin1String("unable to connect to"))) {
a0c1b7
+            KMessageBox::error(0, i18n("Connection attempt to host failed."),
a0c1b7
+                               i18n("Connection Failure"));
a0c1b7
+            connectionError();
a0c1b7
+            return;
a0c1b7
+
a0c1b7
+        // looks like some generic xfreerdp error message, handle it if nothing was handled:
a0c1b7
+        // "Error: protocol security negotiation failure"
a0c1b7
+        } else if (line.contains(QLatin1String("Error: protocol security negotiation failure"))) {
a0c1b7
+            KMessageBox::error(0, i18n("Connection attempt to host failed."),
a0c1b7
+                               i18n("Connection Failure"));
a0c1b7
+            connectionError();
a0c1b7
             return;
a0c1b7
-        } else {
a0c1b7
-            kDebug(5012) << "Process error output: " << line;
a0c1b7
         }
a0c1b7
+
a0c1b7
         i++;
a0c1b7
     }
a0c1b7
 }
a0c1b7
diff -up kdenetwork-4.10.5/krdc/rdp/rdpviewfactory.cpp.freerdp kdenetwork-4.10.5/krdc/rdp/rdpviewfactory.cpp
a0c1b7
--- kdenetwork-4.10.5/krdc/rdp/rdpviewfactory.cpp.freerdp	2013-06-28 20:08:57.393483968 +0200
a0c1b7
+++ kdenetwork-4.10.5/krdc/rdp/rdpviewfactory.cpp	2013-07-04 21:52:45.867029564 +0200
a0c1b7
@@ -37,7 +37,7 @@ RdpViewFactory::RdpViewFactory(QObject *
a0c1b7
 
a0c1b7
     m_connectToolTipString = i18n("Connect to a Windows Remote Desktop (RDP)");
a0c1b7
 
a0c1b7
-    QMetaObject::invokeMethod(this, "checkRdektopAvailability", Qt::DirectConnection);
a0c1b7
+    QMetaObject::invokeMethod(this, "checkFreerdpAvailability", Qt::DirectConnection);
a0c1b7
 }
a0c1b7
 
a0c1b7
 RdpViewFactory::~RdpViewFactory()
a0c1b7
@@ -80,10 +80,10 @@ QString RdpViewFactory::connectToolTipTe
a0c1b7
                 "Example: rdpserver:3389 (host:port)</html>");
a0c1b7
 }
a0c1b7
 
a0c1b7
-void RdpViewFactory::checkRdektopAvailability()
a0c1b7
+void RdpViewFactory::checkFreerdpAvailability()
a0c1b7
 {
a0c1b7
-    if (KStandardDirs::findExe("rdesktop").isEmpty()) {
a0c1b7
-        m_connectToolTipString += '\n' + i18n("The application \"rdesktop\" cannot be found on your system; make sure it is properly installed "
a0c1b7
+    if (KStandardDirs::findExe("xfreerdp").isEmpty()) {
a0c1b7
+        m_connectToolTipString += '\n' + i18n("The application \"xfreerdp\" cannot be found on your system; make sure it is properly installed "
a0c1b7
                                               "if you need RDP support.");
a0c1b7
     }
a0c1b7
 }
a0c1b7
diff -up kdenetwork-4.10.5/krdc/rdp/rdpviewfactory.h.freerdp kdenetwork-4.10.5/krdc/rdp/rdpviewfactory.h
a0c1b7
--- kdenetwork-4.10.5/krdc/rdp/rdpviewfactory.h.freerdp	2013-06-28 20:08:57.393483968 +0200
a0c1b7
+++ kdenetwork-4.10.5/krdc/rdp/rdpviewfactory.h	2013-07-04 21:52:45.867029564 +0200
a0c1b7
@@ -53,7 +53,7 @@ public:
a0c1b7
     virtual QString connectToolTipText() const;
a0c1b7
 
a0c1b7
 private Q_SLOTS:
a0c1b7
-    void checkRdektopAvailability();
a0c1b7
+    void checkFreerdpAvailability();
a0c1b7
 
a0c1b7
 private:
a0c1b7
     QString m_connectToolTipString;
a0c1b7
diff -up kdenetwork-4.10.5/krdc/rdp/rdpview.h.freerdp kdenetwork-4.10.5/krdc/rdp/rdpview.h
a0c1b7
--- kdenetwork-4.10.5/krdc/rdp/rdpview.h.freerdp	2013-06-28 20:08:57.392483928 +0200
a0c1b7
+++ kdenetwork-4.10.5/krdc/rdp/rdpview.h	2013-07-04 21:52:45.867029564 +0200
a0c1b7
@@ -84,17 +84,18 @@ private:
a0c1b7
 
a0c1b7
     // other properties
a0c1b7
     bool m_quitFlag;                // if set: die
a0c1b7
-    QString m_clientVersion;           // version number returned by rdesktop
a0c1b7
-    QX11EmbedContainer *m_container;   // container for the rdesktop window
a0c1b7
-    QProcess *m_process;              // rdesktop process
a0c1b7
+    QX11EmbedContainer *m_container;   // container for the xfreerdp window
a0c1b7
+    QProcess *m_process;              // xfreerdp process
a0c1b7
 
a0c1b7
     RdpHostPreferences *m_hostPreferences;
a0c1b7
 
a0c1b7
 private slots:
a0c1b7
-    void connectionOpened();           // called if rdesktop started
a0c1b7
-    void connectionClosed();           // called if rdesktop quits
a0c1b7
-    void processError(QProcess::ProcessError error); // called if rdesktop dies
a0c1b7
-    void receivedStandardError();      // catches rdesktop debug output
a0c1b7
+    void connectionOpened();           // called if xfreerdp started
a0c1b7
+    void connectionClosed();           // called if xfreerdp quits
a0c1b7
+    void connectionError();            // called if xfreerdp quits with error
a0c1b7
+    void processError(QProcess::ProcessError error); // called if xfreerdp dies
a0c1b7
+    void receivedStandardError();      // catches xfreerdp debug output
a0c1b7
+    void receivedStandardOutput();     // catches xfreerdp output
a0c1b7
 };
a0c1b7
 
a0c1b7
 #endif