Beispiel #1
0
MixerEngine::MixerEngine(QObject *parent, const QVariantList &args)
	: Plasma::DataEngine(parent, args)
	, m_kmix(0)
{
	Q_UNUSED(args)

	interface = QDBusConnection::sessionBus().interface();
	watcher = new QDBusServiceWatcher( this );
	watcher->addWatchedService( KMIX_DBUS_SERVICE );
	watcher->setConnection( QDBusConnection::sessionBus() );
	watcher->setWatchMode( QDBusServiceWatcher::WatchForRegistration | QDBusServiceWatcher::WatchForUnregistration );
	connect( watcher, SIGNAL(serviceRegistered(QString)),
			this, SLOT(slotServiceRegistered(QString)) );
	connect( watcher, SIGNAL(serviceUnregistered(QString)),
			this, SLOT(slotServiceUnregistered(QString)) );
	init();
}
Beispiel #2
0
OkularTTS::OkularTTS( QObject *parent )
    : QObject( parent ), d( new Private( this ) )
{
    connect( &d->watcher, SIGNAL(serviceUnregistered(QString)),
             this, SLOT(slotServiceUnregistered(QString)) );
}
void SpeechClient::setupSpeechSystem()
{
  if ( KStandardDirs::findExe( "kttsd" ).isEmpty() )
  {
    kDebug() <<"KTTSD not installed, disable support";
    d->isTextSpeechInstalled = false;
  }
  else
  {
    if ( QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kttsd") )
    {
      d->isTextSpeechInstalled = true;
    }
    else
    {
      QString error;

      if (KToolInvocation::startServiceByDesktopName("kttsd", QString(), &error) != 0)
      {
        kDebug() <<"Starting KTTSD failed with message" << error;
        d->isTextSpeechInstalled = false;
      }
      else
      {
        d->isTextSpeechInstalled = true;
      }
    }
    if (d->isTextSpeechInstalled)
    {
      if ( !m_kspeech )
      {
        m_kspeech = new org::kde::KSpeech("org.kde.kttsd", "/KSpeech", QDBusConnection::sessionBus());
        m_kspeech->setParent(this);
        m_kspeech->setApplicationName("Akregator Speech Text");
        connect(m_kspeech, SIGNAL(jobStateChanged(QString,int,int)),
                    this, SLOT(textRemoved(QString,int,int)));
        connect( QDBusConnection::sessionBus().interface(), SIGNAL(serviceUnregistered(QString)), this, SLOT(slotServiceUnregistered(QString)) );
        connect( QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(QString,QString,QString)), this, SLOT(slotServiceOwnerChanged(QString,QString,QString)) );

      }
    }
  }