.TH "Locate Functions" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdecore Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
Locate Functions \- 
.SS "Functions"

.in +1c
.ti -1c
.RI "KDECORE_EXPORT \fBQString\fP \fBKStandardDirs::locate\fP (const char *type, const \fBQString\fP &filename, const \fBKInstance\fP *instance=KGlobal::instance())"
.br
.ti -1c
.RI "KDECORE_EXPORT \fBQString\fP \fBKStandardDirs::locateLocal\fP (const char *type, const \fBQString\fP &filename, const \fBKInstance\fP *instance=KGlobal::instance())"
.br
.ti -1c
.RI "KDECORE_EXPORT \fBQString\fP \fBKStandardDirs::locateLocal\fP (const char *type, const \fBQString\fP &filename, bool createDir, const \fBKInstance\fP *instance=KGlobal::instance())"
.br
.in -1c
.SH "Detailed Description"
.PP 
On The Usage Of 'locate' and 'locateLocal'
.PP
Typical \fBKDE\fP applications use resource files in one out of three ways:
.PP
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:
.PP
.PP
.nf
    // Code example
    myFile = locate('appdata', 'groups.lst');
    myData =  myReadGroups(myFile); // myFile may be null
.fi
.PP
.PP
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.
.PP
.PP
.nf
    // Code example
    myFile = locate('appdata', 'groups.lst')
    myData =  myReadGroups(myFile);
    ...
    doSomething(myData);
    ...
    myFile = locateLocal('appdata', 'groups.lst');
    myWriteGroups(myFile, myData);
.fi
.PP
.PP
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.
.PP
.PP
.nf
    // Code example
    myFile = locateLocal('appdata', 'groups.lst');
    myData =  myReadGroups(myFile);
    ...
    doSomething(myData);
    ...
    myFile = locateLocal('appdata', 'groups.lst');
    myWriteGroups(myFile, myData);
.fi
.PP
 
.SH "Function Documentation"
.PP 
.SS "KDECORE_EXPORT \fBQString\fP locate (const char * type, const \fBQString\fP & filename, const \fBKInstance\fP * instance = \fCKGlobal::instance()\fP)\fC [related, inherited]\fP"
.PP
This function is just for convenience. It simply calls instance->dirs()->\fBfindResource\fP(type, filename). 
.PP
Definition at line 1648 of file kstandarddirs.cpp.
.SS "KDECORE_EXPORT \fBQString\fP locateLocal (const char * type, const \fBQString\fP & filename, const \fBKInstance\fP * instance = \fCKGlobal::instance()\fP)\fC [related, inherited]\fP"
.PP
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. 
.PP
Definition at line 1654 of file kstandarddirs.cpp.
.SS "KDECORE_EXPORT \fBQString\fP locateLocal (const char * type, const \fBQString\fP & filename, bool createDir, const \fBKInstance\fP * instance = \fCKGlobal::instance()\fP)\fC [related, inherited]\fP"
.PP
This function is much like locate. No check is made if the specified filename actually exists. Missing directories are created if \fCcreateDir\fP is true. If filename is only a directory, without a specific file, filename must have a trailing slash. 
.PP
Definition at line 1660 of file kstandarddirs.cpp.
.PP
References QString::findRev(), QString::left(), and QString::mid().
