[Parley-devel] Simple DBus interface for vocabulary building
Frederik Gladhorn
gladhorn at kde.org
Sat Jan 18 00:30:25 UTC 2014
Hi Jakub,
I currently don't find the time to work on Parley.
Please upload your patch to kde's reviewboard and add the kde-edu group as
reviewers.
Thanks for contributing to Parley!
Greetings,
Frederik
On Friday 10. January 2014 23.18.32 Jakub Kicinski wrote:
> Hello!
>
> I've added a DBus interface to Parley to be able to add entries from
> other applications. I use it in my dictionary app to save interesting
> words in Parley with a single click instead of coping or error-prone
> typing...
>
> I wonder if you could include this interface in the official Parley
> code so others may use it as well? I think it's pretty useful.
>
> -- kuba
>
> ---
> src/CMakeLists.txt | 3 +++
> src/editor/editor.cpp | 14 ++++++++++++++
> src/editor/editor.h | 7 ++++++-
> src/editor/org.kde.parley.xml | 8 ++++++++
> 4 files changed, 31 insertions(+), 1 deletion(-)
> create mode 100644 src/editor/org.kde.parley.xml
>
> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
> index 9b0857d..33a9a53 100644
> --- a/src/CMakeLists.txt
> +++ b/src/CMakeLists.txt
> @@ -143,6 +143,9 @@ kde4_add_kcfg_files(parley_SRCS
> settings/languagesettings.kcfgc
> )
>
> +qt4_add_dbus_adaptor(parley_SRCS editor/org.kde.parley.xml
> + editor/editor.h Editor::EditorWindow)
> +
> #### XSLT Support ####
> # to transform the document xml to html or other
> if(HAVE_LIBXSLT)
> diff --git a/src/editor/editor.cpp b/src/editor/editor.cpp
> index f3787a3..a376c9b 100644
> --- a/src/editor/editor.cpp
> +++ b/src/editor/editor.cpp
> @@ -345,6 +345,8 @@ void EditorWindow::initDockWidgets()
>
> }
>
> +#include "parleyadaptor.h"
> +
> void EditorWindow::initActions()
> {
> ParleyActions::create(ParleyActions::RemoveGrades, this,
> SLOT(removeGrades()), actionCollection()); @@ -364,6 +366,18 @@ void
> EditorWindow::initActions()
> ParleyActions::create(ParleyActions::ShowScriptManager, this,
> SLOT(slotShowScriptManager()), actionCollection());
> ParleyActions::create(ParleyActions::LanguagesProperties,
> m_mainWindow->parleyDocument(), SLOT(languageProperties()),
> actionCollection());
> ParleyActions::createUploadAction(m_mainWindow->parleyDocument(),
> SLOT(uploadFile()), actionCollection()); +
> + new EditorWindowAdaptor(this);
> +
> + QDBusConnection dbus = QDBusConnection::sessionBus();
> + dbus.registerObject("/AddWithTranslation", this);
> +}
> +
> +void EditorWindow::addWordWithTranslation(QStringList w)
> +{
> + KEduVocExpression *kexpr = new KEduVocExpression(w);
> +
> + m_vocabularyModel->appendEntry(kexpr);
> }
>
> void EditorWindow::initModel()
> diff --git a/src/editor/editor.h b/src/editor/editor.h
> index 2497938..0de6ec3 100644
> --- a/src/editor/editor.h
> +++ b/src/editor/editor.h
> @@ -101,7 +101,12 @@ public slots:
> * Set the current doc (after creating a new one or opening a file)
> */
> void updateDocument(KEduVocDocument *doc);
> -
> +
> + /**
> + * DBus method for adding words by external apps
> + */
> + void addWordWithTranslation(QStringList w);
> +
> private slots:
>
> /** Make the search bar visible and focus it */
> diff --git a/src/editor/org.kde.parley.xml b/src/editor/org.kde.parley.xml
> new file mode 100644
> index 0000000..0d98783
> --- /dev/null
> +++ b/src/editor/org.kde.parley.xml
> @@ -0,0 +1,8 @@
> +<!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="local.Editor.EditorWindow">
> + <method name="addWordWithTranslation">
> + <arg name="w" type="as" direction="in"/>
> + </method>
> + </interface>
> +</node>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/parley-devel/attachments/20140118/69b2c001/attachment.html>
More information about the Parley-devel
mailing list