org.freedesktop.TextEditor

Thiago Macieira thiago at kde.org
Tue Jan 8 10:21:02 PST 2008


On Tuesday 08 January 2008 16:12:15 Michael Albinus wrote:
> Thiago Macieira <thiago-RoXCvvDuEio at public.gmane.org> writes:
> > No, that's just an example name. There is no interface or service
> > specification called org.freedesktop.TextEditor.
>
> Wouldn't it make sense to specify such a thing? Of course not only for
> Emacs' use; KWrite and/or GEdit could implement it as well.

Maybe. It depends on what would be on such a thing...

KWrite already has a lot of interfaces active. The one relevant to the 
discussion is org.kde.KTextEditor.Document, which is new in KDE 4.0.0 (it 
replaced the multiple KDE 3 DCOP interfaces with a single D-Bus one).

$ qdbus org.kate-editor.kwrite-32590 /Kate/Document/1
property read bool org.kde.KTextEditor.Document.empty
property readwrite QString org.kde.KTextEditor.Document.encoding
property read int org.kde.KTextEditor.Document.lines
property readwrite QString org.kde.KTextEditor.Document.text
property read int org.kde.KTextEditor.Document.totalCharacters
method bool org.kde.KTextEditor.Document.clear()
method bool org.kde.KTextEditor.Document.cursorInText(QPoint cursor)
method void org.kde.KTextEditor.Document.encoding()
method QPoint org.kde.KTextEditor.Document.endOfLine(int line)
method bool org.kde.KTextEditor.Document.insertLine(int line, QString text)
method bool org.kde.KTextEditor.Document.insertLines(int line, QStringList 
text)
method bool org.kde.KTextEditor.Document.insertText(QPoint cursor, QString 
text, bool block)
method bool org.kde.KTextEditor.Document.insertTextLines(QPoint cursor, 
QStringList text, bool block)
method bool org.kde.KTextEditor.Document.isEmpty()
method int org.kde.KTextEditor.Document.lineLength(int line)
method int org.kde.KTextEditor.Document.lines()
method bool org.kde.KTextEditor.Document.reload()
method bool org.kde.KTextEditor.Document.removeLine(int line)
method bool org.kde.KTextEditor.Document.save()
method bool org.kde.KTextEditor.Document.saveAs()
method bool org.kde.KTextEditor.Document.setEncoding(QString encoding)
method bool org.kde.KTextEditor.Document.setText(QString text)
method bool org.kde.KTextEditor.Document.setTextLines(QStringList text)
method QString org.kde.KTextEditor.Document.text()
method int org.kde.KTextEditor.Document.totalCharacters()
method QDBusVariant org.freedesktop.DBus.Properties.Get(QString 
interface_name, QString property_name)
method void org.freedesktop.DBus.Properties.Set(QString interface_name, 
QString property_name, QDBusVariant value)
method QString org.freedesktop.DBus.Introspectable.Introspect()

Or in XML:
$ qdbus org.kate-editor.kwrite-32590 /Kate/Document/1 Introspect
<!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.KTextEditor.Document">
    <property name="encoding" type="s" access="readwrite"/>
    <property name="text" type="s" access="readwrite"/>
    <property name="lines" type="i" access="read"/>
    <property name="empty" type="b" access="read"/>
    <property name="totalCharacters" type="i" access="read"/>
    <method name="clear">
      <arg type="b" direction="out"/>
    </method>
    <method name="reload">
      <arg type="b" direction="out"/>
    </method>
    <method name="save">
      <arg type="b" direction="out"/>
    </method>
    <method name="saveAs">
      <arg type="b" direction="out"/>
    </method>
    <method name="setTextLines">
      <arg type="b" direction="out"/>
      <arg name="text" type="as" direction="in"/>
    </method>
    <method name="isEmpty">
      <arg type="b" direction="out"/>
    </method>
    <method name="lineLength">
      <arg type="i" direction="out"/>
      <arg name="line" type="i" direction="in"/>
    </method>
    <method name="endOfLine">
      <arg type="(ii)" direction="out"/>
      <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="QPoint"/>
      <arg name="line" type="i" direction="in"/>
    </method>
    <method name="insertText">
      <arg type="b" direction="out"/>
      <arg name="cursor" type="(ii)" direction="in"/>
      <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QPoint"/>
      <arg name="text" type="s" direction="in"/>
      <arg name="block" type="b" direction="in"/>
    </method>
    <method name="insertTextLines">
      <arg type="b" direction="out"/>
      <arg name="cursor" type="(ii)" direction="in"/>
      <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QPoint"/>
      <arg name="text" type="as" direction="in"/>
      <arg name="block" type="b" direction="in"/>
    </method>
    <method name="cursorInText">
      <arg type="b" direction="out"/>
      <arg name="cursor" type="(ii)" direction="in"/>
      <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QPoint"/>
    </method>
    <method name="insertLine">
      <arg type="b" direction="out"/>
      <arg name="line" type="i" direction="in"/>
      <arg name="text" type="s" direction="in"/>
    </method>
    <method name="insertLines">
      <arg type="b" direction="out"/>
      <arg name="line" type="i" direction="in"/>
      <arg name="text" type="as" direction="in"/>
    </method>
    <method name="removeLine">
      <arg type="b" direction="out"/>
      <arg name="line" type="i" direction="in"/>
    </method>
    <method name="setEncoding">
      <arg type="b" direction="out"/>
      <arg name="encoding" type="s" direction="in"/>
    </method>
    <method name="encoding">
    </method>
    <method name="setText">
      <arg type="b" direction="out"/>
      <arg name="text" type="s" direction="in"/>
    </method>
    <method name="text">
      <arg type="s" direction="out"/>
    </method>
    <method name="lines">
      <arg type="i" direction="out"/>
    </method>
    <method name="totalCharacters">
      <arg type="i" direction="out"/>
    </method>
  </interface>
  <interface name="org.freedesktop.DBus.Properties">
    <method name="Get">
      <arg name="interface_name" type="s" direction="in"/>
      <arg name="property_name" type="s" direction="in"/>
      <arg name="value" type="v" direction="out"/>
    </method>
    <method name="Set">
      <arg name="interface_name" type="s" direction="in"/>
      <arg name="property_name" type="s" direction="in"/>
      <arg name="value" type="v" direction="in"/>
    </method>
  </interface>
  <interface name="org.freedesktop.DBus.Introspectable">
    <method name="Introspect">
      <arg name="xml_data" type="s" direction="out"/>
    </method>
  </interface>
</node>

$ qdbus org.kate-editor.kwrite-32590 /Kate/Document/1 Get 
org.kde.KTextEditor.Document empty
false
$ qdbus org.kate-editor.kwrite-32590 /Kate/Document/1 Get 
org.kde.KTextEditor.Document lines
3
$ qdbus org.kate-editor.kwrite-32590 /Kate/Document/1 Get 
org.kde.KTextEditor.Document text
foo
bar

etc.
-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20080108/1d405d19/attachment.pgp 


More information about the dbus mailing list