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

List:       kde-commits
Subject:    kdegraphics/kpdf
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2005-03-02 23:20:44
Message-ID: 20050302232044.88CEF16EF1 () office ! kde ! org
[Download RAW message or body]

CVS commit by aacid: 

Do not start kttsd only to see if we can use it, use ktrader for that. Only start \
kttsd when the user really ask for a text to be spoken. Same patch as the one sent to \
core-devel + a i18n() we are not allowed to backport


  M +3 -4      part.cpp   1.29
  M +30 -16    ui/pageview.cpp   1.46


--- kdegraphics/kpdf/part.cpp  #1.28:1.29
@@ -50,4 +50,5 @@
 #include <kxmlguiclient.h>
 #include <kxmlguifactory.h>
+#include <ktrader.h>
 
 // local includes
@@ -252,8 +253,6 @@ Part::Part(QWidget *parentWidget, const 
 
         // [SPEECH] check for KTTSD presence and usability
-        Settings::setUseKTTSD( true );
-        if ( !kapp->dcopClient()->isApplicationRegistered("kttsd") )
-                if ( KApplication::startServiceByDesktopName( "kttsd" ) )
-                        Settings::setUseKTTSD( false );
+        KTrader::OfferList offers = KTrader::self()->query("DCOP/Text-to-Speech", \
"Name == 'KTTSD'"); +        Settings::setUseKTTSD( (offers.count() > 0) );
 
         // set our XML-UI resource file

--- kdegraphics/kpdf/ui/pageview.cpp  #1.45:1.46
@@ -36,4 +36,5 @@
 #include <kimageeffect.h>
 #include <kimageio.h>
+#include <kapplication.h>
 #include <kdebug.h>
 
@@ -1040,6 +1041,18 @@ void PageView::contentsMouseReleaseEvent
                     // Albert says is this ever necessary?
                     // we already attached on Part constructor
-                    if ( !client->isAttached() )
-                        client->attach();
+                    // if ( !client->isAttached() )
+                    //    client->attach();
+                    // If KTTSD not running, start it.
+                    if (!client->isApplicationRegistered("kttsd"))
+                    {
+                        QString error;
+                        if (KApplication::startServiceByDesktopName("kttsd", \
QStringList(), &error)) +                        {
+                            d->messageWindow->display( i18n("Starting KTTSD Failed: \
%1").arg(error) ); +                            Settings::setUseKTTSD(false);
+                        }
+                    }
+                    if ( Settings::useKTTSD() )
+                    {
                     // serialize the text to speech (selectedText) and the
                     // preferred reader ("" is the default voice) ...
@@ -1060,4 +1073,5 @@ void PageView::contentsMouseReleaseEvent
                 }
             }
+            }
 
             // clear widget selection and invalidate rect


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

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