Commit 0f441a15 authored by Kurt Hindenburg's avatar Kurt Hindenburg

An initial commit to get a working DBus interface working.

CCBUG: 169024

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=941837
parent 95f20328
......@@ -27,14 +27,22 @@ configure_file (config-konsole.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-konsol
endif(KONSOLE_GENERATE_LINEFONT)
### Konsole source files shared between embedded terminal and main application
# qdbuscpp2xml -m Session.h -o org.kde.konsole.Session.xml
# qdbuscpp2xml -M -s ViewManager.h -o org.kde.konsole.Konsole.xml
qt4_add_dbus_adaptor( sessionadaptors_SRCS
org.kde.konsole.Session.xml
Session.h
Konsole::Session )
qt4_add_dbus_adaptor( konsoleadaptors_SRCS
org.kde.konsole.Konsole.xml
ViewManager.h
Konsole::ViewManager )
set(konsoleprivate_SRCS
${sessionadaptors_SRCS}
${konsoleadaptors_SRCS}
BlockArray.cpp
BookmarkHandler.cpp
ColorScheme.cpp
......
......@@ -35,6 +35,7 @@
#include <KLocale>
#include <KToggleAction>
#include <KXMLGUIFactory>
#include <QStringList>
// Konsole
#include "ColorScheme.h"
......@@ -45,6 +46,8 @@
#include "SessionManager.h"
#include "ViewContainer.h"
#include "ViewSplitter.h"
#include "konsoleadaptor.h"
#include "Profile.h"
using namespace Konsole;
......@@ -85,6 +88,11 @@ ViewManager::ViewManager(QObject* parent , KActionCollection* collection)
SLOT(profileChanged(Profile::Ptr)) );
connect( SessionManager::instance() , SIGNAL(sessionUpdated(Session*)) , this,
SLOT(updateViewsForSession(Session*)) );
//prepare DBus communication
new KonsoleAdaptor(this);
QDBusConnection::sessionBus().registerObject(QLatin1String("/Konsole"), this);
}
ViewManager::~ViewManager()
......@@ -936,6 +944,11 @@ uint qHash(QPointer<TerminalDisplay> display)
return qHash((TerminalDisplay*)display);
}
int ViewManager::sessionCount()
{
return this->_sessionMap.size();
}
#include "ViewManager.moc"
/*
......
......@@ -68,6 +68,7 @@ class ViewSplitter;
class KONSOLEPRIVATE_EXPORT ViewManager : public QObject
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.konsole.Konsole")
public:
/**
......@@ -201,6 +202,10 @@ signals:
/** Requests creation of a new view, with the selected profile. */
void newViewRequest(Profile::Ptr);
public slots:
/** DBus slot that returns the number of sessions in the current view. */
int sessionCount();
private slots:
// called when the "Split View Left/Right" menu item is selected
void splitLeftRight();
......
<!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.konsole.Konsole">
<method name="sessionCount">
<arg type="i" direction="out"/>
</method>
<method name="currentSession">
<arg type="s" direction="out"/>
</method>
<method name="newSession">
<arg type="s" direction="out"/>
</method>
<method name="newSession">
<arg name="type" type="s" direction="in"/>
<arg type="s" direction="out"/>
</method>
<method name="sessionId">
<arg name="position" type="i" direction="in"/>
<arg type="s" direction="out"/>
</method>
<method name="activateSession">
<arg name="sessionId" type="s" direction="in"/>
</method>
<method name="nextSession"/>
<method name="prevSession"/>
<method name="moveSessionLeft"/>
<method name="moveSessionRight"/>
<method name="fullScreen">
<arg type="b" direction="out"/>
</method>
<method name="setFullScreen">
<arg name="on" type="b" direction="in"/>
</method>
<method name="reparseConfiguration">
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<signal name="reloadConfig"/>
</interface>
</node>
<node>
<interface name="org.kde.konsole.Konsole">
<method name="sessionCount">
<arg type="i" direction="out"/>
</method>
</interface>
</node>
<!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.konsole.KonsoleScripting">
<method name="feedAllSessions">
<arg name="text" type="s" direction="in"/>
</method>
<method name="sendAllSessions">
<arg name="text" type="s" direction="in"/>
</method>
</interface>
</node>
<!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.konsole.SessionScripting">
<method name="feedSession">
<arg name="text" type="s" direction="in"/>
</method>
<method name="sendSession">
<arg name="text" type="s" direction="in"/>
</method>
</interface>
</node>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment