Reply to topic

Where do I store plasmoid's custom data?

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
2285
Karma
5
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
4963
Karma
17
OS
fyi the paste plasmiod stores it's data in ~/.kde4/share/apps/plasma_applet_paste/snippets.xml


OpenSuse 13.1 x64, KDE 4.12.x

Problem solved? Please click on Image below the post with the best answer to mark your topic as solved.
User avatar einar
Administrator
Posts
2285
Karma
5
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
4963
Karma
17
OS
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 13.1 x64, KDE 4.12.x

Problem solved? Please click on Image below the post with the best answer to mark your topic as solved.

 
Reply to topic

Bookmarks



Who is online

Registered users: afiestas, arojas, avishekk, Baidu [Spider], Bing [Bot], bjoernbalazs, Cris70, edmael, epsi1on, Exabot [Bot], ggael, Google [Bot], google01103, Hans, ivan, jgrulich, joshaughnessy, jstaniek, koriun, La Ninje, Majestic-12 [Bot], MSNbot Media, ooker, scummos, sinclair, Sogou [Bot], TheraHedwig, Tioz, Yahoo [Bot]