This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Where do I store plasmoid's custom data?

Tags: None
(comma "," separated)
User avatar
gdr
Registered Member
Posts
10
Karma
0
OS
Hi,

I'm new to KDE development. I wrote a plasmoid (http://kde-look.org/content/show.php/Google+Calendar+Agenda?content=134032) that needs to store its data somewhere, namely - ical feeds need to be stored for offline usage.

While I could just write it to ~/.ical/, I'd like to know what is the proper way of doing it - is there an API i can query about the path to store my private data?


User avatar
einar
Administrator
Posts
3402
Karma
7
OS
I think you can use KStandardDirs to create a directory inside the user's KDEHOME, in a specific path for your application (I suggest using "data" for that).


"Violence is the last refuge of the incompetent."
Image
Plasma FAQ maintainer - Plasma programming with Python
User avatar
google01103
Manager
Posts
6668
Karma
25
fyi the paste plasmiod stores it's data in ~/.kde4/share/apps/plasma_applet_paste/snippets.xml


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
einar
Administrator
Posts
3402
Karma
7
OS
That's exactly the use of KStandardDirs I mentioned. The good thing about using the API, rather than hardcoded directories, is that the code would work regardless if the user had the settings in .kde, .kde4, or other location.


"Violence is the last refuge of the incompetent."
Image
Plasma FAQ maintainer - Plasma programming with Python
User avatar
gdr
Registered Member
Posts
10
Karma
0
OS
Thank you very much einar, this solves my issue.


User avatar
gdr
Registered Member
Posts
10
Karma
0
OS
Regarding what google01103 suggested - that's what exactly I wanted to avoid, from my experience hardcoding anything sooner or later becomes major pain.


User avatar
google01103
Manager
Posts
6668
Karma
25
gdr wrote:Regarding what google01103 suggested - that's what exactly I wanted to avoid, from my experience hardcoding anything sooner or later becomes major pain.


I never suggested anything, I only gave an example of a plasmoid that stored data in a manner similar to what you were looking to do and posted that file's path as it resides on my machine


OpenSuse Leap 42.1 x64, Plasma 5.x



Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient