Port konqy preloader to D-BUS.

svn path=/trunk/KDE/kdebase/konqueror/; revision=558861
This commit is contained in:
Kevin Ottens 2006-07-06 08:06:05 +00:00
parent 76fa9470a1
commit a3ead4122f
7 changed files with 48 additions and 18 deletions

View file

@ -15,14 +15,14 @@ endif(UNIX)
add_subdirectory( about )
add_subdirectory( pics )
add_subdirectory( sidebar )
#add_subdirectory( preloader )
add_subdirectory( preloader )
add_subdirectory( quickprint )
add_subdirectory( remoteencodingplugin )
#add_subdirectory( kttsplugin )
add_subdirectory( dirpart )
add_subdirectory( settings )
message(STATUS "kdebase/konqueror: temporarily disabled from compilation, not yet ported to DBUS: preloader kttsplugin client")
message(STATUS "kdebase/konqueror: temporarily disabled from compilation, not yet ported to DBUS: kttsplugin client")
include_directories( ${CMAKE_SOURCE_DIR}/libkonq ${CMAKE_SOURCE_DIR}/workspace/kcontrol/input )
add_subdirectory( tests )

View file

@ -129,7 +129,7 @@ extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
#ifdef Q_WS_X11
if( KonqSettings::maxPreloadCount() > 0 )
{
QDBusInterface ref( "org.kde.kded", "/modules/konqy_preloader", "org.kde.KonqyPreloader", QDBus::sessionBus() );
QDBusInterface ref( "org.kde.kded", "/modules/konqy_preloader", "org.kde.konqueror.Preloader", QDBus::sessionBus() );
QX11Info info;
QDBusReply<bool> retVal = ref.call( QDBus::Block, "registerPreloadedKonqy",
QDBus::sessionBus().baseService(), info.screen());

View file

@ -5613,7 +5613,7 @@ void KonqMainWindow::setPreloadedFlag( bool preloaded )
delete s_preloadedWindow; // preloaded state was abandoned without reusing the window
s_preloadedWindow = NULL;
kapp->enableSessionManagement(); // enable SM again
QDBusInterface ref( "org.kde.kded", "/modules/konqy_preloader", "org.kde.KonqyPreloader", QDBus::sessionBus() );
QDBusInterface ref( "org.kde.kded", "/modules/konqy_preloader", "org.kde.konqueror.Preloader", QDBus::sessionBus() );
ref.call( "unregisterPreloadedKonqy", QDBus::sessionBus().baseService() );
}
@ -5727,7 +5727,7 @@ bool KonqMainWindow::stayPreloaded()
viewManager()->clear(); // reduce resource usage before checking it
if( !checkPreloadResourceUsage())
return false;
QDBusInterface ref( "org.kde.kded", "/modules/konqy_preloader", "org.kde.KonqyPreloader", QDBus::sessionBus() );
QDBusInterface ref( "org.kde.kded", "/modules/konqy_preloader", "org.kde.konqueror.Preloader", QDBus::sessionBus() );
QX11Info info;
QDBusReply<bool> retVal = ref.call( QDBus::Block, "registerPreloadedKonqy",
QDBus::sessionBus().baseService(), info.screen());

View file

@ -6,6 +6,8 @@ set(kded_konqy_preloader_PART_SRCS preloader.cc )
kde4_add_kcfg_files(kded_konqy_preloader_PART_SRCS ${CMAKE_SOURCE_DIR}/konqueror/konq_settingsxt.kcfgc)
qt4_add_dbus_adaptor( kded_konqy_preloader_PART_SRCS org.kde.konqueror.Preloader.xml preloader.h KonqyPreloader )
kde4_automoc(${kded_konqy_preloader_PART_SRCS})

View file

@ -0,0 +1,26 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.konqueror.Preloader">
<method name="registerPreloadedKonqy">
<arg name="id" type="s" direction="in"/>
<arg name="screen" type="i" direction="in"/>
<arg type="b" direction="out"/>
</method>
<method name="getPreloadedKonqy">
<arg name="screen" type="i" direction="in"/>
<arg type="s" direction="out"/>
</method>
<method name="unregisterPreloadedKonqy">
<arg name="id" type="s" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="reconfigure"/>
<method name="unloadAllPreloaded"/>
</interface>
</node>

View file

@ -19,11 +19,10 @@
#include "preloader.h"
#include "konq_settingsxt.h"
#include "preloaderadaptor.h"
#include <kconfig.h>
#include <dcopref.h>
#include <kapplication.h>
#include <dcopclient.h>
#include <kdebug.h>
#include <ktoolinvocation.h>
@ -31,8 +30,11 @@ KonqyPreloader::KonqyPreloader()
: KDEDModule()
{
reconfigure();
connect( kapp->dcopClient(), SIGNAL( applicationRemoved( const QByteArray& )),
SLOT( appRemoved( const QByteArray& )));
(void)new PreloaderAdaptor(this);
connect( QDBus::sessionBus().interface(), SIGNAL( serviceUnregistered( const QString & )),
SLOT( appRemoved( const QString& )));
check_always_preloaded_timer.setSingleShot( true );
connect( &check_always_preloaded_timer, SIGNAL( timeout()),
SLOT( checkAlwaysPreloaded()));
@ -82,7 +84,7 @@ void KonqyPreloader::unregisterPreloadedKonqy( QString id_P )
}
}
void KonqyPreloader::appRemoved( const QByteArray& id )
void KonqyPreloader::appRemoved( const QString& id )
{
unregisterPreloadedKonqy( id );
}
@ -102,8 +104,8 @@ void KonqyPreloader::updateCount()
{
KonqyData konqy = instances.first();
instances.pop_front();
DCOPRef ref( konqy.id, "KonquerorIface" );
ref.send( "terminatePreloaded" );
QDBusInterface ref( konqy.id, "/", "org.kde.Konqueror" );
ref.call( "terminatePreloaded" );
}
if( KonqSettings::alwaysHavePreloaded() &&
KonqSettings::maxPreloadCount() > 0 &&
@ -138,8 +140,8 @@ void KonqyPreloader::unloadAllPreloaded()
{
KonqyData konqy = instances.first();
instances.pop_front();
DCOPRef ref( konqy.id, "KonquerorIface" );
ref.send( "terminatePreloaded" );
QDBusInterface ref( konqy.id, "/", "org.kde.Konqueror" );
ref.call( "terminatePreloaded" );
}
// ignore 'always_have_preloaded' here
}

View file

@ -27,18 +27,18 @@ class KonqyPreloader
: public KDEDModule
{
Q_OBJECT
K_DCOP
public:
KonqyPreloader();
virtual ~KonqyPreloader();
k_dcop:
public Q_SLOTS:
bool registerPreloadedKonqy( QString id, int screen );
QString getPreloadedKonqy( int screen );
ASYNC unregisterPreloadedKonqy( QString id );
void unregisterPreloadedKonqy( QString id );
void reconfigure();
void unloadAllPreloaded();
private Q_SLOTS:
void appRemoved( const QByteArray& id );
void appRemoved( const QString& id );
void checkAlwaysPreloaded();
private:
void updateCount();