Development/Tutorials/Plasma4/JavaScript/API-LocalIO: Difference between revisions

    From KDE TechBase
    (Created page with ' = LocalIO = This Extension provides access to local files. Functions: * ''IOJob'' '''getUrl(Url url)''': attempts to fetch the file using an IOJob * ''I...')
     
    Line 1: Line 1:


    = LocalIO =  
    = LocalIO =  
    This [[../API-Extensions|Extension]] provides access to local files.  
    This [[../API-Extensions|Extension]] provides access to local files using asynchronous [[../API-IOJobs|IOJob]] objects.  


    Functions:
    Functions:

    Revision as of 12:23, 24 June 2011

    LocalIO

    This Extension provides access to local files using asynchronous IOJob objects.

    Functions:

    • IOJob getUrl(Url url): attempts to fetch the file using an IOJob
    • IOJob getUrl(String url): attempts to fetch the file using an IOJob
    • String userDataPath([String type, String path]): (scripting version >= 4) returns the default path for user data. Called with no parameters, it returns the user's home directory. If only one string is passed in, the standard directory for that type of data in the user's home directory will be located; the following values are recognized:
      • documents
      • music
      • video
      • downloads
      • pictures
      • autostart
      • desktop (should be considered deprecated for Plasma workspaces)

    If a second string is passed in, it is considered a request for a specific path and the following types are recognized:

      • apps - Applications menu (.desktop files).
      • autostart - Autostart directories (both XDG and kde-specific)
      • cache - Cached information (e.g. favicons, web-pages)
      • cgi - CGIs to run from kdehelp.
      • config - Configuration files.
      • data - Where applications store data.
      • emoticons - Emoticons themes
      • exe - Executables in $prefix/bin. findExe() for a function that takes $PATH into account.
      • html - HTML documentation.
      • icon - Icons, see KIconLoader.
      • kcfg - KConfigXT config files.
      • lib - Libraries.
      • locale - Translation files for KLocale.
      • mime - Mime types defined by KDE-specific .desktop files.
      • module - Module (dynamically loaded library).
      • qtplugins - Qt plugins (dynamically loaded objects for Qt)
      • services - Services.
      • servicetypes - Service types.
      • sound - Application sounds.
      • templates - Templates for the "Create new file" functionality.
      • wallpaper - Wallpapers.
      • tmp - Temporary files (specific for both current host and current user)
      • socket - UNIX Sockets (specific for both current host and current user)
      • xdgconf-menu - Freedesktop.org standard location for menu layout (.menu) files.
      • xdgdata-apps - Freedesktop.org standard location for application desktop files.
      • xdgdata-dirs - Freedesktop.org standard location for menu descriptions (.directory files).
      • xdgdata-mime - Freedesktop.org standard location for MIME type definitions.
      • xdgdata-icon - Freedesktop.org standard location for icons.
      • xdgdata-pixmap - Gnome-compatibility location for pixmaps.

    The second parameter should be a specific resource to find the path to. An example might be userDataPath("data", "plasma-desktop").