exporting/importing config keys? plus: Mandelbrot news

Benoit Jacob jacob.benoit.1 at gmail.com
Sat Mar 13 18:39:58 CET 2010


2010/3/13 Benoit Jacob <jacob.benoit.1 at gmail.com>:
> 2010/3/13 Marco Martin <notmart at gmail.com>:
>> On Saturday 13 March 2010, Benoit Jacob wrote:
>>> Hi,
>>>
>>> I've just made a bunch of Mandelbrot improvements in trunk, plus 1
>>> bugfix backported to 4.4, see below.
>>
>> great :)
>>
>>> I would like to honor this feature request:
>>> http://forum.kde.org/brainstorm.php#idea55395_page1
>>>
>>> Basically I want to create a right-click desktop menu entry that
>>> allows to export/import Mandelbrot's configuration to/from a file.
>>>
>>> Does KDE's config system allow that right away? Or should I code my
>>> own file I/O?
>>>
>> create a new kconfig on a new file, a kconfiggroup on it, then write all your
>> config entries copied from the main kconfiggroup
>>
>>> Also, any example code for adding a right-click menu to a plasma wallpaper?
>> QList<QAction*> Wallpaper::contextualActions()
>
> I tried that but  can't get it to work: it compiles, but the actions
> don't show up in the right click menu.
>
> Here's what I did. In my Mandelbrot (inheriting Wallpaper) class I
> have new members,
>
>        QAction m_exportImageAction;
>        QAction m_exportConfigAction;
>        QAction m_importConfigAction;
>
> Then they are initialized in the initialization list of my Mandelbrot
> constructor:
>
> Mandelbrot::Mandelbrot(QObject *parent, const QVariantList &args)
>    : Plasma::Wallpaper(parent, args), m_image(0), m_tiling(this),
>      m_exportImageAction(i18n("Export image..."), 0),
>      m_exportConfigAction(i18n("Export parameters..."), 0),
>      m_importConfigAction(i18n("Import parameters..."), 0),

I also tried passing 'this' instead of '0' for the 'parent' argument
here, no difference...

>
> Then, in the body of that constructor, I do:
>
>    contextualActions().append(&m_exportImageAction);
>    contextualActions().append(&m_exportConfigAction);
>    contextualActions().append(&m_importConfigAction);
>
>    connect(&m_exportImageAction, SIGNAL(triggered()), this,
> SLOT(exportImage()));
>    connect(&m_exportConfigAction, SIGNAL(triggered()), this,
> SLOT(exportConfig()));
>    connect(&m_importConfigAction, SIGNAL(triggered()), this,
> SLOT(importConfig()));
>
> What am I doing wrong?
>
> Thanks
> Benoit
>
>>
>> (wouldn't make more sense putting it into the config dialog anyways?)
>>
>> Cheers,
>> Marco Martin
>> _______________________________________________
>> Plasma-devel mailing list
>> Plasma-devel at kde.org
>> https://mail.kde.org/mailman/listinfo/plasma-devel
>>
>


More information about the Plasma-devel mailing list