[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 1:09:49
Message-ID: 1204852189.437439.22900.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 783096 by pino:
- fix action icon
- cast the parent into a KHTMLPart in the Right Way (qobject_cast)
- QMessageBox -> KMessageBox
- turn the failure of the getTalkerCapabilities2 into a debug message, as it'll work \
anyway (assuming non-XHTML support)
M +11 -13 khtmlkttsd.cpp
--- trunk/KDE/kdebase/apps/konqueror/kttsplugin/khtmlkttsd.cpp #783095:783096
@@ -49,7 +49,7 @@
if (offers.count() > 0)
{
QAction *action = actionCollection()->addAction( "tools_kttsd" );
- action->setIcon( KIcon("preferences-desktop-text-to-speech") );
+ action->setIcon( KIcon("text-speak") );
action->setText( i18n("&Speak Text") );
connect(action, SIGNAL(triggered(bool) ), SLOT(slotReadOut()));
}
@@ -63,18 +63,19 @@
void KHTMLPluginKTTSD::slotReadOut()
{
+ KHTMLPart *part = qobject_cast<KHTMLPart *>(parent());
+
// The parent is assumed to be a KHTMLPart
- if ( !parent()->inherits("KHTMLPart") )
- QMessageBox::warning( 0, i18n( "Cannot Read source" ),
- i18n( "You cannot read anything except web pages \
with\n"
- "this plugin, sorry." ));
+ if (!part)
+ KMessageBox::sorry( 0, i18n( "You cannot read anything except web pages with \
this plugin, sorry." ), + i18n( "Cannot Read source" ) \
); else
{
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kttsd"))
{
QString error;
if (KToolInvocation::startServiceByDesktopName("kttsd", QStringList(), \
&error))
- QMessageBox::warning(0, i18n( "Starting KTTSD Failed"), error );
+ KMessageBox::error(0, error, i18n( "Starting KTTSD Failed") );
}
// Find out if KTTSD supports xhtml (rich speak).
bool supportsXhtml = false;
@@ -82,15 +83,12 @@
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 getTalkerCapabilities2 \
failed." )); + kDebug() << "D-Bus call getTalkerCapabilities2() failed, \
assuming non-XHTML support."; else
{
supportsXhtml = reply.value() & KSpeech::tcCanParseHtml;
}
- KHTMLPart *part = (KHTMLPart *) parent();
-
QString query;
if (supportsXhtml)
{
@@ -114,12 +112,12 @@
else
query = part->htmlDocument().body().innerText().string();
}
- // kDebug() << "KHTMLPluginKTTSD::slotReadOut: query = " << query;
+ // kDebug() << "query =" << query;
reply = kttsd.say(query, KSpeech::soNone);
if ( !reply.isValid())
- QMessageBox::warning( 0, i18n( "D-Bus Call Failed" ),
- i18n( "The D-Bus call say() failed." ));
+ KMessageBox::sorry( 0, i18n( "The D-Bus call say() failed." ),
+ i18n( "D-Bus Call Failed" ));
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic