• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdecore
 

kdecore

Functions
Locate Functions

Functions

TQString locate (const char *type, const TQString &filename, const KInstance *instance=KGlobal::instance())
 
TQString locateLocal (const char *type, const TQString &filename, const KInstance *instance=KGlobal::instance())
 
TQString locateLocal (const char *type, const TQString &filename, bool createDir, const KInstance *instance=KGlobal::instance())
 

Detailed Description

On The Usage Of 'locate' and 'locateLocal'.

Typical KDE applications use resource files in one out of three ways:

1) A resource file is read but is never written. A system default is supplied but the user can override this default in his local .kde directory:

// Code example
myFile = locate("appdata", "groups.lst");
myData = myReadGroups(myFile); // myFile may be null

2) A resource file is read and written. If the user has no local version of the file the system default is used. The resource file is always written to the users local .kde directory.

// Code example
myFile = locate("appdata", "groups.lst")
myData = myReadGroups(myFile);
...
doSomething(myData);
...
myFile = locateLocal("appdata", "groups.lst");
myWriteGroups(myFile, myData);

3) A resource file is read and written. No system default is used if the user has no local version of the file. The resource file is always written to the users local .kde directory.

// Code example
myFile = locateLocal("appdata", "groups.lst");
myData = myReadGroups(myFile);
...
doSomething(myData);
...
myFile = locateLocal("appdata", "groups.lst");
myWriteGroups(myFile, myData);

Function Documentation

TQString locate ( const char *  type,
const TQString &  filename,
const KInstance *  instance = KGlobal::instance() 
)
related

This function is just for convenience. It simply calls instance->dirs()->findResource(type, filename).

Definition at line 1689 of file kstandarddirs.cpp.

TQString locateLocal ( const char *  type,
const TQString &  filename,
const KInstance *  instance = KGlobal::instance() 
)
related

This function is much like locate. However it returns a filename suitable for writing to. No check is made if the specified filename actually exists. Missing directories are created. If filename is only a directory, without a specific file, filename must have a trailing slash.

Definition at line 1695 of file kstandarddirs.cpp.

TQString locateLocal ( const char *  type,
const TQString &  filename,
bool  createDir,
const KInstance *  instance = KGlobal::instance() 
)
related

This function is much like locate. No check is made if the specified filename actually exists. Missing directories are created if createDir is true. If filename is only a directory, without a specific file, filename must have a trailing slash.

Definition at line 1701 of file kstandarddirs.cpp.

kdecore

Skip menu "kdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdecore

Skip menu "kdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdecore by doxygen 1.8.6
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |