Commit b14e23f8 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

First step to port it to new kdelibs api (not finish yet)

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=548680
parent bb68f7c3
......@@ -51,6 +51,8 @@ install(TARGETS konsole DESTINATION bin)
########### next target ###############
set(konsolepart_PART_SRCS
konsoleadaptor.cpp
sessionadaptor.cpp
TEPty.cpp
BlockArray.cpp
konsole_part.cpp
......
......@@ -93,9 +93,10 @@ Time to start a requirement list.
#include <Q3PtrList>
#include <QHBoxLayout>
#include <QPixmap>
#include <kservicetypetrader.h>
#include <stdio.h>
#include <stdlib.h>
#include <dbus/qdbus.h>
#include <kfiledialog.h>
#include <kurlrequesterdlg.h>
......@@ -111,7 +112,6 @@ Time to start a requirement list.
#include <kinputdialog.h>
#include <kdebug.h>
#include <kipc.h>
#include <dcopclient.h>
#include <kglobalsettings.h>
#include <knotifydialog.h>
#include <kprinter.h>
......@@ -151,7 +151,7 @@ Time to start a requirement list.
#include <kauthorized.h>
#include <ktoolinvocation.h>
#include "printsettings.h"
#include "konsoleadaptor.h"
#define KONSOLEDEBUG kDebug(1211)
#define POPUP_NEW_SESSION_ID 121
......@@ -196,8 +196,7 @@ template class Q3PtrDict<KToggleAction>;
Konsole::Konsole(const char* name, int histon, bool menubaron, bool tabbaron, bool frameon, bool scrollbaron,
Q3CString type, bool b_inRestore, const int wanted_tabbar, const QString &workdir )
:DCOPObject( "konsole" )
,KMainWindow(0, name)
:KMainWindow(0, name)
,m_defaultSession(0)
,m_defaultSessionFilename("")
,tabwidget(0)
......@@ -278,6 +277,9 @@ Konsole::Konsole(const char* name, int histon, bool menubaron, bool tabbaron, bo
,sl_sessionShortCuts(0)
,s_workDir(workdir)
{
(void)new KonsoleAdaptor(this);
QDBus::sessionBus().registerObject(QLatin1String("/konsole"), this);
QDBus::sessionBus().busService()->requestName("org.kde.konsole", /*flags=*/0);
m_sessionGroup = new QActionGroup(this);
isRestored = b_inRestore;
......@@ -349,9 +351,9 @@ Konsole::Konsole(const char* name, int histon, bool menubaron, bool tabbaron, bo
if (te) te->setScrollbarLocation(TEWidget::SCRNONE);
}
// connect(kapp, SIGNAL(kdisplayFontChanged()), this, SLOT(slotFontChanged()));
kapp->dcopClient()->setDefaultObject( "konsole" );
// connect(kapp, SIGNAL(kdisplayFontChanged()), this, SLOT(slotFontChanged()));
QDBus::sessionBus().registerObject(QLatin1String("/konsole"), this);
QDBus::sessionBus().busService()->requestName("org.kde.konsole", /*flags=*/0);
}
......@@ -4210,7 +4212,7 @@ KonsoleFind::KonsoleFind( QWidget *parent )
void KonsoleFind::slotEditRegExp()
{
if ( m_editorDialog == 0 )
m_editorDialog = KParts::ComponentFactory::createInstanceFromQuery<QDialog>( "KRegExpEditor/KRegExpEditor", QString(), this );
m_editorDialog = KServiceTypeTrader::createInstanceFromQuery<QDialog>( "KRegExpEditor/KRegExpEditor", QString(), this );
assert( m_editorDialog );
......@@ -4260,7 +4262,8 @@ void Konsole::smallerFont(void) {
te->setVTFont( f );
activateSession();
}
#warning "kde4: port it"
#if 0
bool Konsole::processDynamic(const DCOPCString &fun, const QByteArray &data, DCOPCString& replyType, QByteArray &replyData)
{
if (b_fullScripting)
......@@ -4297,7 +4300,7 @@ DCOPCStringList Konsole::functionsDynamic()
}
return funcs;
}
#endif
void Konsole::enableFullScripting(bool b)
{
b_fullScripting = b;
......
......@@ -43,7 +43,6 @@
#include "konsolebookmarkmenu.h"
#include "konsolebookmarkhandler.h"
#include "konsoleiface.h"
#undef PACKAGE
#undef VERSION
......@@ -65,7 +64,7 @@ class KTempFile;
// Defined in main.C
const char *konsole_shell(QStringList &args);
class Konsole : public KMainWindow, virtual public KonsoleIface
class Konsole : public KMainWindow
{
Q_OBJECT
......@@ -113,10 +112,11 @@ public:
void sendAllSessions(const QString &text);
KUrl baseURL() const;
#warning "kde4: port it"
#if 0
virtual bool processDynamic(const DCOPCString &fun, const QByteArray &data, DCOPCString& replyType, QByteArray &replyData);
virtual DCOPCStringList functionsDynamic();
#endif
void callReadPropertiesInternal(KConfig *config, int number) { readPropertiesInternal(config,number); }
enum TabPosition { TabNone, TabTop, TabBottom };
......
/*
* This file was generated by dbusidl2cpp version 0.4
* when processing input file org.kde.konsole.xml
*
* dbusidl2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved.
*
* This is an auto-generated file.
*/
#include "konsoleadaptor.h"
#include "konsoleadaptor.moc"
KonsoleAdaptor::KonsoleAdaptor(QObject *parent)
: QDBusAbstractAdaptor(parent)
{
// constructor
setAutoRelaySignals(true);
}
KonsoleAdaptor::~KonsoleAdaptor()
{
// destructor
}
void KonsoleAdaptor::activateSession(const QString &sessionId)
{
// handle method call org.kde.konsole.activateSession
QMetaObject::invokeMethod(parent(), "activateSession", Q_ARG(QString, sessionId));
// Alternative:
//static_cast<YourObjectType *>(parent())->activateSession(sessionId);
}
QString KonsoleAdaptor::currentSession()
{
// handle method call org.kde.konsole.currentSession
QString out0;
QMetaObject::invokeMethod(parent(), "currentSession", Q_RETURN_ARG(QString, out0));
// Alternative:
//out0 = static_cast<YourObjectType *>(parent())->currentSession();
return out0;
}
bool KonsoleAdaptor::fullScreen()
{
// handle method call org.kde.konsole.fullScreen
bool out0;
QMetaObject::invokeMethod(parent(), "fullScreen", Q_RETURN_ARG(bool, out0));
// Alternative:
//out0 = static_cast<YourObjectType *>(parent())->fullScreen();
return out0;
}
void KonsoleAdaptor::moveSessionLeft()
{
// handle method call org.kde.konsole.moveSessionLeft
QMetaObject::invokeMethod(parent(), "moveSessionLeft");
// Alternative:
//static_cast<YourObjectType *>(parent())->moveSessionLeft();
}
void KonsoleAdaptor::moveSessionRight()
{
// handle method call org.kde.konsole.moveSessionRight
QMetaObject::invokeMethod(parent(), "moveSessionRight");
// Alternative:
//static_cast<YourObjectType *>(parent())->moveSessionRight();
}
QString KonsoleAdaptor::newSession(const QString &type)
{
// handle method call org.kde.konsole.newSession
QString out0;
QMetaObject::invokeMethod(parent(), "newSession", Q_RETURN_ARG(QString, out0), Q_ARG(QString, type));
// Alternative:
//out0 = static_cast<YourObjectType *>(parent())->newSession(type);
return out0;
}
QString KonsoleAdaptor::newSession()
{
// handle method call org.kde.konsole.newSession
QString out0;
QMetaObject::invokeMethod(parent(), "newSession", Q_RETURN_ARG(QString, out0));
// Alternative:
//out0 = static_cast<YourObjectType *>(parent())->newSession();
return out0;
}
void KonsoleAdaptor::nextSession()
{
// handle method call org.kde.konsole.nextSession
QMetaObject::invokeMethod(parent(), "nextSession");
// Alternative:
//static_cast<YourObjectType *>(parent())->nextSession();
}
void KonsoleAdaptor::prevSession()
{
// handle method call org.kde.konsole.prevSession
QMetaObject::invokeMethod(parent(), "prevSession");
// Alternative:
//static_cast<YourObjectType *>(parent())->prevSession();
}
void KonsoleAdaptor::reparseConfiguration()
{
// handle method call org.kde.konsole.reparseConfiguration
QMetaObject::invokeMethod(parent(), "reparseConfiguration");
// Alternative:
//static_cast<YourObjectType *>(parent())->reparseConfiguration();
}
int KonsoleAdaptor::sessionCount()
{
// handle method call org.kde.konsole.sessionCount
int out0;
QMetaObject::invokeMethod(parent(), "sessionCount", Q_RETURN_ARG(int, out0));
// Alternative:
//out0 = static_cast<YourObjectType *>(parent())->sessionCount();
return out0;
}
QString KonsoleAdaptor::sessionId(int position)
{
// handle method call org.kde.konsole.sessionId
QString out0;
QMetaObject::invokeMethod(parent(), "sessionId", Q_RETURN_ARG(QString, out0), Q_ARG(int, position));
// Alternative:
//out0 = static_cast<YourObjectType *>(parent())->sessionId(position);
return out0;
}
void KonsoleAdaptor::setFullScreen(bool on)
{
// handle method call org.kde.konsole.setFullScreen
QMetaObject::invokeMethod(parent(), "setFullScreen", Q_ARG(bool, on));
// Alternative:
//static_cast<YourObjectType *>(parent())->setFullScreen(on);
}
/*
* This file was generated by dbusidl2cpp version 0.4
* when processing input file org.kde.konsole.xml
*
* dbusidl2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved.
*
* This is an auto-generated file.
*/
#ifndef KONSOLEADAPTOR_H_144501149585213
#define KONSOLEADAPTOR_H_144501149585213
#include <QtCore/QObject>
#include <QtCore/QMetaObject>
#include <QtCore/QVariant>
#include <dbus/qdbus.h>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
/*
* Adaptor class for interface org.kde.konsole
*/
class KonsoleAdaptor: public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.konsole")
Q_CLASSINFO("D-Bus Introspection", ""
" <interface name=\"org.kde.konsole\" >\n"
" <method name=\"sessionCount\" >\n"
" <arg direction=\"out\" type=\"i\" />\n"
" </method>\n"
" <method name=\"currentSession\" >\n"
" <arg direction=\"out\" type=\"s\" />\n"
" </method>\n"
" <method name=\"newSession\" >\n"
" <arg direction=\"out\" type=\"s\" />\n"
" </method>\n"
" <method name=\"newSession\" >\n"
" <arg direction=\"in\" type=\"s\" name=\"type\" />\n"
" <arg direction=\"out\" type=\"s\" />\n"
" </method>\n"
" <method name=\"sessionId\" >\n"
" <arg direction=\"in\" type=\"i\" name=\"position\" />\n"
" <arg direction=\"out\" type=\"s\" />\n"
" </method>\n"
" <method name=\"activateSession\" >\n"
" <arg direction=\"in\" type=\"s\" name=\"sessionId\" />\n"
" </method>\n"
" <method name=\"nextSession\" />\n"
" <method name=\"prevSession\" />\n"
" <method name=\"moveSessionLeft\" />\n"
" <method name=\"moveSessionRight\" />\n"
" <method name=\"fullScreen\" >\n"
" <arg direction=\"out\" type=\"b\" />\n"
" </method>\n"
" <method name=\"setFullScreen\" >\n"
" <arg direction=\"in\" type=\"b\" name=\"on\" />\n"
" </method>\n"
" <method name=\"reparseConfiguration\" />\n"
" </interface>\n"
"")
public:
KonsoleAdaptor(QObject *parent);
virtual ~KonsoleAdaptor();
public: // PROPERTIES
public Q_SLOTS: // METHODS
void activateSession(const QString &sessionId);
QString currentSession();
bool fullScreen();
void moveSessionLeft();
void moveSessionRight();
QString newSession(const QString &type);
QString newSession();
void nextSession();
void prevSession();
void reparseConfiguration();
int sessionCount();
QString sessionId(int position);
void setFullScreen(bool on);
Q_SIGNALS: // SIGNALS
};
#endif
// [kwrited.C] A write(1) receiver for kde.
#include <dcopclient.h>
#include <QSocketNotifier>
#include <QContextMenuEvent>
......@@ -100,7 +99,7 @@ void KWrited::contextMenuEvent(QContextMenuEvent * e)
delete menu;
}
KWritedModule::KWritedModule( const DCOPCString& obj )
KWritedModule::KWritedModule( const QString& obj )
: KDEDModule( obj )
{
KGlobal::locale()->insertCatalog("konsole");
......@@ -114,7 +113,7 @@ KWritedModule::~KWritedModule()
}
extern "C"
KDE_EXPORT KDEDModule* create_kwrited( const DCOPCString& obj )
KDE_EXPORT KDEDModule* create_kwrited( const QString& obj )
{
return new KWritedModule( obj );
}
......
......@@ -27,9 +27,8 @@ private:
class KWritedModule : public KDEDModule
{
Q_OBJECT
K_DCOP
public:
KWritedModule( const DCOPCString& obj );
KWritedModule( const QString& obj );
~KWritedModule();
private:
KWrited* pro;
......
......@@ -23,7 +23,6 @@
#include <QStringList>
#include <dcopclient.h>
#include <klocale.h>
#include <kaboutdata.h>
......@@ -332,10 +331,11 @@ extern "C" int KDE_EXPORT kdemain(int argc, char* argv[])
full_script = args->isSet("script");
auto_close = args->isSet("close");
fixed_size = !args->isSet("resize");
#warning "kde4: port it"
#if 0
if (!full_script)
a.dcopClient()->setQtBridgeEnabled(false);
#endif
QByteArray type = "";
if(args->isSet("type")) {
......
<!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.session">
<method name="closeSession">
<arg type="b" direction="out"/>
</method>
<method name="sendSignal">
<arg type="b" direction="out"/>
<arg name="signal" type="b" direction="in"/>
</method>
<method name="clearHistory"/>
<method name="renameSession">
<arg name="name" type="s" direction="in"/>
</method>
<method name="sessionName">
<arg type="s" direction="out"/>
</method>
<method name="sessionPID">
<arg type="i" direction="out"/>
</method>
<method name="schema">
<arg type="s" direction="out"/>
</method>
<method name="setSchema">
<arg name="schema" type="s" direction="in"/>
</method>
<method name="encoding">
<arg type="s" direction="out"/>
</method>
<method name="setEncoding">
<arg name="encoding" type="s" direction="in"/>
</method>
<method name="keytab">
<arg type="s" direction="out"/>
</method>
<method name="setKeytab">
<arg name="encoding" type="s" direction="in"/>
</method>
<method name="font">
<arg type="s" direction="out"/>
</method>
<method name="setFont">
<arg name="encoding" 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">
<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"/>
</interface>
</node>
......@@ -2,7 +2,6 @@
#include "zmodem_dialog.h"
#include <config-konsole.h>
#include <kdebug.h>
#include <dcopclient.h>
#include <kmessagebox.h>
#include <knotifyclient.h>
#include <klocale.h>
......@@ -17,6 +16,8 @@
#include <QRegExp>
#include <QStringList>
#include <QByteArray>
#include "sessionadaptor.h"
#include <dbus/qdbus.h>
/*! \class TESession
......@@ -29,8 +30,7 @@
*/
TESession::TESession(TEWidget* _te, const QString &_pgm, const QStringList & _args, const QString &_term, ulong _winId, const QString &_sessionId, const QString &_initial_cwd)
: DCOPObject( _sessionId.toLatin1() )
, connected(true)
: connected(true)
, monitorActivity(false)
, monitorSilence(false)
, notifiedActivity(false)
......@@ -52,6 +52,9 @@ TESession::TESession(TEWidget* _te, const QString &_pgm, const QStringList & _ar
, zmodemProgress(0)
, encoding_no(0)
{
(void)new SessionAdaptor(this);
QDBus::sessionBus().registerObject(_sessionId.toLatin1(), this);
QDBus::sessionBus().busService()->requestName("org.kde.konsole", /*flags=*/0);
//kDebug(1211)<<"TESession ctor() new TEPty"<<endl;
sh = new TEPty();
te = _te;
......
......@@ -22,13 +22,12 @@
#include "TEWidget.h"
#include "TEmuVt102.h"
#include "sessioniface.h"
class KProcIO;
class KProcess;
class ZModemDialog;
class TESession : public QObject, virtual public SessionIface
class TESession : public QObject
{ Q_OBJECT
public:
......@@ -95,9 +94,11 @@ public:
void renameSession(const QString &name);
QString sessionName() { return title; }
int sessionPID() { return sh->pid(); }
#warning "kde4: port it"
#if 0
virtual bool processDynamic(const DCOPCString &fun, const QByteArray &data, DCOPCString& replyType, QByteArray &replyData);
virtual DCOPCStringList functionsDynamic();
#endif
void enableFullScripting(bool b) { fullScripting = b; }
void startZModem(const QString &rz, const QString &dir, const QStringList &list);
......
/*
* This file was generated by dbusidl2cpp version 0.4
* when processing input file org.kde.konsole.session.xml
*
* dbusidl2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved.
*
* This is an auto-generated file.
*/
#include "sessionadaptor.h"
#include "sessionadaptor.moc"
SessionAdaptor::SessionAdaptor(QObject *parent)
: QDBusAbstractAdaptor(parent)
{
// constructor
setAutoRelaySignals(true);
}
SessionAdaptor::~SessionAdaptor()
{
// destructor
}
void SessionAdaptor::clearHistory()
{
// handle method call org.kde.konsole.session.clearHistory
QMetaObject::invokeMethod(parent(), "clearHistory");
// Alternative:
//static_cast<YourObjectType *>(parent())->clearHistory();
}
bool SessionAdaptor::closeSession()
{
// handle method call org.kde.konsole.session.closeSession
bool out0;
QMetaObject::invokeMethod(parent(), "closeSession", Q_RETURN_ARG(bool, out0));
// Alternative:
//out0 = static_cast<YourObjectType *>(parent())->closeSession();
return out0;
}
QString SessionAdaptor::encoding()
{
// handle method call org.kde.konsole.session.encoding
QString out0;