# class KUrlCompletion

###

Module | kio
Namespace |
Class | KUrlCompletion
Inherits | KCompletion

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

Completion of a single URL Author David Smith <dsmith@algonet.se>

### enums

- Mode { ExeCompletion, FileCompletion, DirCompletion }

enum details

### methods

- KUrlCompletion ( )

  returns ctor

  Constructs a KUrlCompletion object in FileCompletion mode.

- KUrlCompletion (a0)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  a0 | KUrlCompletion.Mode |

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

- customEvent (e)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  e | QEvent |

- dir ( )

  returns QString

  Returns the current directory, as it was given in setDir Returns the current directory (path or URL)

- isRunning ( )

  returns bool

  Check whether asynchronous completion is in progress. Returns true if asynchronous completion is in progress

- makeCompletion (text)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  text | QString |

  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 QString() for asynchronous completion (KIO or threaded).

  text - the text to complete Returns the first match, or QString() if not found

- mode ( )

  returns KUrlCompletion.Mode

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

- postProcessMatch (match)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  match | QString |

- postProcessMatches (matches)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  matches | QStringList |

- postProcessMatches (matches)

  returns Nothing
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  matches | KCompletionMatches |

- replaceEnv ( )

  returns bool

  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

- replaceHome ( )

  returns bool

  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

- replacedPath (text)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  text | QString |

  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.

  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.

- replacedPath (text, replaceHome, replaceEnv)

  returns QString
  static

  Argument | Type | Default
  --- | --- | ---
  text | QString |
  replaceHome | bool |
  replaceEnv | bool | 1

  Internal I'll let ossi add a real one to KShell :)

- setDir (dir)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  dir | QString |

  Sets the current directory (used as base for completion). Default = $HOME.

  dir - the current directory, either as a path or URL

- setMode (mode)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  mode | KUrlCompletion.Mode |

  Changes the completion mode: exe or file completion

  mode - the new completion mode

- setReplaceEnv (replace)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  replace | bool |

  Enables/disables completion and replacement (internally) of environment variables in URLs. Default is enabled.

  replace - true to replace environment variables

- setReplaceHome (replace)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  replace | bool |

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

  replace - true to replace tilde with the home directory

- stop ( )

  returns Nothing

  Stops asynchronous completion.

### enums - detail

- Mode { ExeCompletion, FileCompletion, DirCompletion }

  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.

| ExeCompletion | - 1 | - |
| FileCompletion | - | - |
| DirCompletion | - | - |