org.kde.koala

Class KURLCompletion

public class KURLCompletion extends KCompletion

This class does completion of URLs including user directories (~user) and environment variables. Remote URLs are passed to KIO.

Author: David Smith

UNKNOWN: Completion of a single URL.

Field Summary
static intDirCompletion
static intExeCompletion
Determines how completion is done.
static intFileCompletion
Constructor Summary
protected KURLCompletion(Class dummy)
KURLCompletion()
Constructs a KURLCompletion object in FileCompletion mode.
KURLCompletion(int arg1)
This overloaded constructor allows you to set the Mode to ExeCompletion or FileCompletion without using setMode.
Method Summary
StringclassName()
protected voidcustomEvent(QCustomEvent e)
Stringdir()
Returns the current directory, as it was given in setDir
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
protected voidfinalize()
Deletes the wrapped C++ instance
booleanisDisposed()
Has the wrapped C++ instance been deleted?
booleanisRunning()
Check whether asynchronous completion is in progress.
StringmakeCompletion(String text)
Finds completions to the given text.
QMetaObjectmetaObject()
intmode()
Returns the completion mode: exe or file completion (default FileCompletion).
protected voidpostProcessMatch(StringBuffer match)
protected voidpostProcessMatches(String[] matches)
StringreplacedPath(String text)
Replaces username and/or environment variables, depending on the current settings and returns the filtered url.
static StringreplacedPath(String text, boolean replaceHome, boolean replaceEnv)
static StringreplacedPath(String text, boolean replaceHome)
booleanreplaceEnv()
Checks whether environment variables are completed and whether they are replaced internally while finding completions.
booleanreplaceHome()
Returns whether ~username is completed and whether ~username is replaced internally with the user's home directory while finding completions.
voidsetDir(String dir)
Sets the current directory (used as base for completion).
voidsetMode(int mode)
Changes the completion mode: exe or file completion
voidsetReplaceEnv(boolean replace)
Enables/disables completion and replacement (internally) of environment variables in URLs.
voidsetReplaceHome(boolean replace)
Enables/disables completion of ~username and replacement (internally) of ~username with the user's home directory.
protected voidslotIOFinished(Job arg1)
voidstop()
Stops asynchronous completion.

Field Detail

DirCompletion

public static final int DirCompletion

ExeCompletion

public static final int ExeCompletion
Determines how completion is done.
  • ExeCompletion - executables in $PATH or with full path.
  • FileCompletion - all files with full path or in dir(), URLs are listed using KIO.
  • DirCompletion - Same as FileCompletion but only returns directories.
  • @short Determines how completion is done.

    FileCompletion

    public static final int FileCompletion

    Constructor Detail

    KURLCompletion

    protected KURLCompletion(Class dummy)

    KURLCompletion

    public KURLCompletion()
    Constructs a KURLCompletion object in FileCompletion mode.

    UNKNOWN: Constructs a KURLCompletion object in FileCompletion mode.

    KURLCompletion

    public KURLCompletion(int arg1)
    This overloaded constructor allows you to set the Mode to ExeCompletion or FileCompletion without using setMode. Default is FileCompletion.

    UNKNOWN: This overloaded constructor allows you to set the Mode to ExeCompletion or FileCompletion without using setMode.

    Method Detail

    className

    public String className()

    customEvent

    protected void customEvent(QCustomEvent e)

    dir

    public String dir()
    Returns the current directory, as it was given in setDir

    Returns: the current directory (path or URL)

    UNKNOWN: Returns the current directory, as it was given in setDir

    dispose

    public void dispose()
    Delete the wrapped C++ instance ahead of finalize()

    finalize

    protected void finalize()
    Deletes the wrapped C++ instance

    isDisposed

    public boolean isDisposed()
    Has the wrapped C++ instance been deleted?

    isRunning

    public boolean isRunning()
    Check whether asynchronous completion is in progress.

    Returns: true if asynchronous completion is in progress

    UNKNOWN: Check whether asynchronous completion is in progress.

    makeCompletion

    public String makeCompletion(String text)
    Finds completions to the given text. Remote URLs are listed with KIO. For performance reasons, local files are listed with KIO only if KURLCOMPLETION_LOCAL_KIO is set. The completion is done asyncronously if KIO is used. Returns the first match for user, environment, and local dir completion and null for asynchronous completion (KIO or threaded).

    Parameters: text the text to complete

    Returns: the first match, or null if not found

    UNKNOWN: Finds completions to the given text.

    metaObject

    public QMetaObject metaObject()

    mode

    public int mode()
    Returns the completion mode: exe or file completion (default FileCompletion).

    Returns: the completion mode

    UNKNOWN: Returns the completion mode: exe or file completion (default FileCompletion).

    postProcessMatch

    protected void postProcessMatch(StringBuffer match)

    postProcessMatches

    protected void postProcessMatches(String[] matches)

    replacedPath

    public String replacedPath(String text)
    Replaces username and/or environment variables, depending on the current settings and returns the filtered url. Only works with local files, i.e. returns back the original string for non-local urls.

    Parameters: text the text to process

    Returns: the path or URL resulting from this operation. If you want to convert it to a KURL, use KURL.fromPathOrURL.

    UNKNOWN: Replaces username and/or environment variables, depending on the current settings and returns the filtered url.

    replacedPath

    public static String replacedPath(String text, boolean replaceHome, boolean replaceEnv)

    UNKNOWN:

    replacedPath

    public static String replacedPath(String text, boolean replaceHome)

    replaceEnv

    public boolean replaceEnv()
    Checks whether environment variables are completed and whether they are replaced internally while finding completions. Default is enabled.

    Returns: true if environment vvariables will be replaced

    UNKNOWN: Checks whether environment variables are completed and whether they are replaced internally while finding completions.

    replaceHome

    public boolean replaceHome()
    Returns whether ~username is completed and whether ~username is replaced internally with the user's home directory while finding completions. Default is enabled.

    Returns: true to replace tilde with the home directory

    UNKNOWN: Returns whether ~username is completed and whether ~username is replaced internally with the user's home directory while finding completions.

    setDir

    public void setDir(String dir)
    Sets the current directory (used as base for completion). Default = $HOME.

    Parameters: dir the current directory, either as a path or URL

    UNKNOWN: Sets the current directory (used as base for completion).

    setMode

    public void setMode(int mode)
    Changes the completion mode: exe or file completion

    Parameters: mode the new completion mode

    UNKNOWN: Changes the completion mode: exe or file completion

    setReplaceEnv

    public void setReplaceEnv(boolean replace)
    Enables/disables completion and replacement (internally) of environment variables in URLs. Default is enabled.

    Parameters: replace true to replace environment variables

    UNKNOWN: Enables/disables completion and replacement (internally) of environment variables in URLs.

    setReplaceHome

    public void setReplaceHome(boolean replace)
    Enables/disables completion of ~username and replacement (internally) of ~username with the user's home directory. Default is enabled.

    Parameters: replace true to replace tilde with the home directory

    UNKNOWN: Enables/disables completion of ~username and replacement (internally) of ~username with the user's home directory.

    slotIOFinished

    protected void slotIOFinished(Job arg1)

    stop

    public void stop()
    Stops asynchronous completion.

    UNKNOWN: Stops asynchronous completion.