[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/apps/konqueror/kttsplugin
From:       Pino Toscano <pino () kde ! org>
Date:       2008-03-07 0:57:04
Message-ID: 1204851424.631789.22690.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 783095 by pino:

- use the generated interface from org.kde.KSpeech.xml, and apply the right function calls
- port the rich text detection hopefully in the right way


 M  +1 -0      CMakeLists.txt  
 M  +9 -13     khtmlkttsd.cpp  


--- trunk/KDE/kdebase/apps/konqueror/kttsplugin/CMakeLists.txt #783094:783095
@@ -5,6 +5,7 @@
 
 set(khtmlkttsdplugin_PART_SRCS khtmlkttsd.cpp )
 
+qt4_add_dbus_interfaces(khtmlkttsdplugin_PART_SRCS ${DBUS_INTERFACES_INSTALL_DIR}/org.kde.KSpeech.xml)
 
 kde4_add_plugin(khtmlkttsdplugin ${khtmlkttsdplugin_PART_SRCS})
 
--- trunk/KDE/kdebase/apps/konqueror/kttsplugin/khtmlkttsd.cpp #783094:783095
@@ -39,6 +39,8 @@
 #include <kspeech.h>
 #include <ktoolinvocation.h>
 
+#include "kspeechinterface.h"
+
 KHTMLPluginKTTSD::KHTMLPluginKTTSD( QObject* parent, const QVariantList& )
     : Plugin( parent )
 {
@@ -74,19 +76,17 @@
             if (KToolInvocation::startServiceByDesktopName("kttsd", QStringList(), &error))
                 QMessageBox::warning(0, i18n( "Starting KTTSD Failed"), error );
         }
-#ifdef __GNUC__
-#warning "kde4: kspeech dbus doesn't have supportsMarkup function"
-#endif
         // Find out if KTTSD supports xhtml (rich speak).
         bool supportsXhtml = false;
-		QDBusInterface kttsd( "org.kde.KSpeech", "/KSpeech", "org.kde.KSpeech" );
-		QDBusReply<bool> reply = kttsd.call("supportsMarkup", "", KSpeech::soHtml);
+        org::kde::KSpeech kttsd( "org.kde.kttsd", "/KSpeech", QDBusConnection::sessionBus() );
+        QString talker = kttsd.defaultTalker();
+        QDBusReply<int> reply = kttsd.getTalkerCapabilities2(talker);
         if ( !reply.isValid())
             QMessageBox::warning( 0, i18n( "D-Bus Call Failed" ),
-                                     i18n( "The D-Bus call supportsMarkup failed." ));
+                                     i18n( "The D-Bus call getTalkerCapabilities2 failed." ));
         else
         {
-			supportsXhtml = reply;
+            supportsXhtml = reply.value() & KSpeech::tcCanParseHtml;
         }
 
         KHTMLPart *part = (KHTMLPart *) parent();
@@ -116,14 +116,10 @@
         }
         // kDebug() << "KHTMLPluginKTTSD::slotReadOut: query = " << query;
 
-		reply = kttsd.call("setText", query, "");
+        reply = kttsd.say(query, KSpeech::soNone);
         if ( !reply.isValid())
             QMessageBox::warning( 0, i18n( "D-Bus Call Failed" ),
-                                     i18n( "The D-Bus call setText failed." ));
-		reply = kttsd.call("startText", 0);
-        if ( !reply.isValid())
-            QMessageBox::warning( 0, i18n( "D-Bus Call Failed" ),
-                                     i18n( "The D-Bus call startText failed." ));
+                                     i18n( "The D-Bus call say() failed." ));
     }
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic