![]() Registered Member ![]()
|
What's the canonical way of reading a local file for a plasmoid? Do I have to use JavaScript for that?
If so, there's apparently a File class, but after reading many **** descriptions on the web I'm still not sure if File actually reads local files. I've also found suggestions of using XMLHttpRequest. Or maybe there is some kind of Data Source that would provide the contents of a file? In Qt4 using Python, this was obviously a piece of cake. |
![]() Registered Member ![]()
|
Hi!
The usual way of reading and writing files is using a cpp-File. Depending on what you want to read, you can also use Plasma Widget Configuration which uses the KDE Frameworks read and write methods, so you don't have to implement your own. |
![]() Registered Member ![]()
|
Thanks for your suggestion. I suppose you're referring to FileDialog here? I didn't mention it explicitly, but I'm looking for a way to open a file without user interaction. Right now I'm using XMLHttpRequest, but I thought there might be a better way (without using C++). |
![]() Registered Member ![]()
|
Afaik there is no way of file IO in JS/QML natively, so you have to use one of the C++-backends available. Another way of data storage is Local Storage for accessing a local sqlite database.
|
![]() Registered Member ![]()
|
I see, thanks for answering. |
Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]