Summary: | [Patch provided] Add a function KGlobalSettings::readXdgUserDir(const QString path) to retrieve xdg path | ||
---|---|---|---|
Product: | [Unmaintained] kdelibs | Reporter: | rapsys <rapsys> |
Component: | general | Assignee: | kdelibs bugs <kdelibs-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | faure |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Mandriva RPMs | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Patch that add retrieve the xdg path
Same patch but in right kstandarddirs class as requested, plz apply ;) Patch following the kde policy rules (for kde3) New patch following naming rules like localxdgconfigdir. Final version using kdelibs api |
Description
rapsys
2008-02-09 15:52:28 UTC
Created attachment 23501 [details]
Patch that add retrieve the xdg path
This patch add the readXdgUserDir function to retrieve user xdg directories.
Wrong place for the function, it should be in KStandardDirs, as it's that class responsible for handling paths. Created attachment 23508 [details]
Same patch but in right kstandarddirs class as requested, plz apply ;)
Created attachment 23510 [details]
Patch following the kde policy rules (for kde3)
Created attachment 23578 [details]
New patch following naming rules like localxdgconfigdir.
Created attachment 23654 [details]
Final version using kdelibs api
First the implementation details: * QFile f( (new KStandardDirs())->localxdgconfdir() + "/user-dirs.dirs" ): memory leak. Use something like self() instead of creating a new KStandardDirs instance. * All this line-parsing looks like something that could be done with KConfig+KConfigGroup(&cfg,QString()) instead (which handles $HOME etc.) About the API: * This method should take an enum instead of a string, otherwise there's a too big risk for typos. * The all-lowercase method name matches some old method names from Waldo but it's not good Qt/KDE API IMHO, I would make it something like userPath(...) or standardUserDirectory(...). Where's the spec for this user-dirs.dirs file? Also with this we have two notions of "the user's document directory": KGlobalSettings::documentPath() and the new KStandardDirs::localxdguserdir(KStandardDirs::Document). A complete solution to that problem would invove: * porting KGlobalSettings::desktopPath()/documentPath() to localxdguserdir(...) so that we don't have conflicting results from the two * changing the kcontrol module to write to user-dirs.dirs - otherwise the user has to edit a file by hand to set those paths.... * ... and even migrating existing paths from kdeglobals to user-dirs.dirs so that users don't lose their configuration after upgrading kde Alternatively, localxdguserdir should not provide access to the desktop and document paths for now, those can be marked as TODO for later I guess, but we still need to provide a way to set those other paths (download, music, picture, video etc) from the GUI. And finally: this is a patch for 3.5.8??? It will never go into 3.5.8, this is post-end-of-life especially for new API. This has to go into kdelibs trunk (4.1). I was hopping to have it for kde 3.5.9 release :'( (mandriva refused because too close to release date) But it's dead right now... I will try what you say, but i got a problem on kde4 version i tried to code, it was failing because of a charset problem in file reading. I will investigate it asap (around 7d before i may take a look on it). This has been implemented in Qt4 and KDE4 (Qt has the code for reading these dirs, and I extended the GUI in KDE for setting them). |