[Kmymoney-devel] Plugin Config File Install
Thomas Baumgart
thb at net-bembel.de
Fri Dec 30 15:04:10 UTC 2011
Hi,
on Friday 30 December 2011 14:13:15 Allan wrote:
> I'm progressing with adding profiles to the csv plugin, and have a
> startup-type query.
>
> Each profile has its own group within the config file, and because the
> config for brokers is, well, complicated, I want to include the two
> broker configs that I've done in the plugin config file, which I install
> in /user/share/.....
>
> So, after installation, those two sections are available, and I load
> into memory from the default config file the parameters for the chosen
> profile. When the plugin is closed, the current parameters are saved to
> the user's ~/.kde/4 config location, but this new file contains only the
> one profile, the one that was first loaded.
>
> So, the question is, how do I get the two profiles into the user's
> config file? Is there a way to install into the user's .kde folder
> rather than /usr/share/... ? I could, I suppose supply the absolute
> path, but is there a KDEDIR version I can use? (I've used the absolute
> path now, which is OK, but doesn't allow for distros that use ~/.kde
> instead of ~/.kde4.) Or, do I have to resort to copying groups from the
> default config into the one that gets saved locally? That doesn't seem
> the right approach, but...
Instead of using
KSharedConfigPtr config =
KSharedConfig::openConfig(KStandardDirs::locateLocal("config",
"csvimporterrc"));
I suggest to supply a method in CsvImporterPlugin as follows:
KSharedConfigPtr* CsvImporterPlugin::config(void)
{
return component().isValid() ? component().config() : 0;
}
and use that to extract the config pointer. You could also pass that pointer
to CsvDialog and it's sub-ordinate objects in the ctor if you like.
Your config file will be named kmm_csvimportrc just like the plugin. This does
not solve your initial problem, but adds to have clean code.
I am not sure if I understand the problem 100%. You say you have two groups in
your global config file and you can select from them. Then in the local file,
only one appears. Does this mean, you cannot access the other one at all after
you have once selected a profile or what?
A pointer to the code locations you talk about would be of help here.
--
Regards
Thomas Baumgart
GPG-FP: E55E D592 F45F 116B 8429 4F99 9C59 DB40 B75D D3BA
-------------------------------------------------------------
Embedded Linux: because you can't do control-alt-delete on a pacemaker.
-------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 225 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20111230/5b4bc785/attachment.sig>
More information about the KMyMoney-devel
mailing list