class KCompletion |
|
|
Helper to determine if the given offset in the string could be a legal alphanumeric accelerator. str - base string index - offset to check Loads all legal predefined accelerators in the (implicitly specified) collection into the given QMap. begin - start iterator end - (last+1) iterator keys - map to store output Main, maximally flexible template function that assigns accelerators to the elements of a collection of QStrings. Clients will seldom use this directly, as it's usually easier to use one of the wrapper functions that simply takes a collection (see below). The Deref template parameter is a class containing a static dereferencing function, modeled after the comparison class C in Stroustrup 13.4. begin - (you know) end - (you know) target - collection to store generated strings Another convenience function; looks up the key instead of dereferencing directly for the given iterator. begin - end - target - Convenience function; generates accelerators for all the items in a QStringList.
source - Strings for which to generate accelerators
target - Output for accelerator-added strings
Convenience function; generates accelerators for all the values in
a QMap
source - Map with input strings as VALUES.
target - Output for accelerator-added strings
Convenience function; generates an accelerator mapping from all the
keys in a QMap source - Map with input strings as KEYS. target - Output for accelerator-added strings A generic class for completing QStrings This class offers easy use of "auto-completion", "manual-completion" or "shell completion" on QString objects. A common use is completing filenames or URLs (see KUrlCompletion()). |
|
Constructor, nothing special here :) |
|
Adds an item to the list of available completions. Resets the current item-state ( previousMatch() and nextMatch() won't work anymore). item - the item to add |
|
Adds an item to the list of available completions. Resets the current item-state ( previousMatch() and nextMatch() won't work anymore). Sets the weighting of the item to weight or adds it to the current weighting if the item is already available. The weight has to be greater than 1 to take effect (default weight is 1). item - the item to add weight - the weight of the item, default is 1 |
|
Returns a list of all items matching the last completed string. Might take some time, when you have LOTS of items. Returns a list of all matches for the last completed string. See also substringCompletion |
|
Returns a list of all items matching string. string - the string to match Returns the list of all matches |
|
Returns a list of all items matching the last completed string. Might take some time, when you have LOTS of items. The matches are returned as KCompletionMatches, which also keeps the weight of the matches, allowing you to modify some matches or merge them with matches from another call to allWeightedMatches(), and sort the matches after that in order to have the matches ordered correctly. Returns a list of all completion matches See also substringCompletion |
|
Returns a list of all items matching string. string - the string to match Returns a list of all matches |
|
Removes all inserted items. |
|
Return the current completion mode. May be different from KGlobalSettings.completionMode(), if you explicitly called setCompletionMode(). Returns the current completion mode See also setCompletionMode |
|
Returns true when more than one match is found. Returns true if there are more than one match See also multipleMatches |
|
Return whether KCompletion acts case insensitively or not. Default is false (case sensitive). Returns true if the case will be ignored See also setIgnoreCase |
|
Inserts items into the list of possible completions. Does the same as setItems(), but does not call clear() before. items - the items to insert |
|
Returns true when the completion object contains no entries. |
|
Returns a list of all items inserted into KCompletion. This is useful if you need to save the state of a KCompletion object and restore it later. Important note: when order() == Weighted, then every item in the stringlist has its weight appended, delimited by a colon. E.g. an item "www.kde.org" might look like "www.kde.org:4", where 4 is the weight. This is necessary so that you can save the items along with its weighting on disk and load them back with setItems(), restoring its weight as well. If you really don't want the appended weightings, call setOrder( KCompletion.Insertion ) before calling items(). Returns a list of all items See also setItems |
|
Returns the last match. Might be useful if you need to check whether a completion is different from the last one. Returns the last match. QString() is returned when there is no last match. |
|
Attempts to find an item in the list of available completions, that begins with string. Will either return the first matching item (if there is more than one match) or QString(), if no match was found. In the latter case, a sound will be issued, depending on soundsEnabled(). If a match was found, it will also be emitted via the signal match(). If this is called twice or more often with the same string while no items were added or removed in the meantime, all available completions #matches(). This happens only in shell-completion-mode.
string - the string to complete Returns the matching item, or QString() if there is no matching item. See also slotMakeCompletion See also substringCompletion |
|
The matching item. Will be emitted by makeCompletion(), previousMatch() or nextMatch(). May be QString() if there is no matching item. item - the match, or QString() if there is none |
|
All matching items. Will be emitted by makeCompletion() in shell- completion-mode, when the same string is passed to makeCompletion twice or more often. matchlist - the list of matches |
|
This signal is emitted, when calling makeCompletion() and more than one matching item is found. See also hasMultipleMatches |
|
Returns the next item from the matching-items-list. When reaching the last item, the list is rotated, so it will return the first match and a sound is issued (depending on soundsEnabled()). Returns the next item from the matching-items-list. When there is no match, QString() is returned and a sound is issued See also slotNextMatch |
|
Returns the completion order. Returns the current completion order. See also setOrder |
|
This method is called after a completion is found and before the matching string is emitted. You can override this method to modify the string that will be emitted. This is necessary e.g. in KUrlCompletion(), where files with spaces in their names are shown escaped ("filename\ with\ spaces"), but stored unescaped inside KCompletion. Never delete that pointer! Default implementation does nothing. pMatch - the match to process See also postProcessMatches |
|
This method is called before a list of all available completions is #matches. You can override this method to modify the #matches are emitted. Never delete that pointer! Default implementation does nothing. pMatches - the matches to process See also postProcessMatch |
|
This method is called before a list of all available completions is #matches. You can override this method to modify the ##matches() are emitted. Never delete that pointer! Default implementation does nothing. pMatches - the matches to process See also postProcessMatch |
|
Returns the next item from the matching-items-list. When reaching the beginning, the list is rotated so it will return the last match and a sound is issued (depending on soundsEnabled()). Returns the next item from the matching-items-list. When there is no match, QString() is returned and a sound is be issued. See also slotPreviousMatch |
|
Removes an item from the list of available completions. Resets the current item-state ( previousMatch() and nextMatch() won't work anymore). item - the item to remove |
|
Sets the completion mode to Auto/Manual, Shell or None. If you don't set the mode explicitly, the global default value KGlobalSettings.completionMode() is used. KGlobalSettings.CompletionNone disables completion. mode - the completion mode See also completionMode See also KGlobalSettings.completionMode |
|
Setting this to true makes KCompletion behave case insensitively. E.g. makeCompletion( "CA" ); might return "carp\@cs.tu-berlin.de". Default is false (case sensitive). ignoreCase - true to ignore the case See also ignoreCase |
|
Sets the list of items available for completion. Removes all previous items. Notice: when order() == Weighted, then the weighting is looked up for every item in the stringlist. Every item should have ":number" appended, where number is an unsigned integer, specifying the weighting. If you don't like this, call setOrder( KCompletion.Insertion ) before calling setItems().
list - the list of items that are available for completion See also items |
|
KCompletion offers three different ways in which it offers its items: Choosing weighted makes KCompletion perform an implicit weighting based on how often an item is inserted. Imagine a web browser with a location bar, where the user enters URLs. The more often a URL is entered, the higher priority it gets. Note: Setting the order to sorted only affects new inserted items, already existing items will stay in the current order. So you probably want to call setOrder( Sorted ) before inserting items, when you want everything sorted. Default is insertion order. order - the new order See also order |
|
Enables/disables playing a sound when For playing the sounds, KNotifyClient() is used.
enable - true to enable sounds See also soundsEnabled |
|
Attempts to complete "string" and emits the completion via match(). Same as makeCompletion() (just as a slot). string - the string to complete See also makeCompletion |
|
Searches the next matching item and emits it via match(). Same as nextMatch() (just as a slot). See also nextMatch |
|
Searches the previous matching item and emits it via match(). Same as previousMatch() (just as a slot). See also previousMatch |
|
Tells you whether KCompletion will play sounds on certain occasions. Default is enabled. Returns true if sounds are enabled See also setSoundsEnabled |
|
Returns a list of all completion items that contain the given string. string - the string to complete Returns a list of items which all contain text as a substring, i.e. not necessarily at the beginning. See also makeCompletion |
Sorted | - | Use alphabetically sorted order | |
Insertion | - | Use order of insertion | |
Weighted | - | Use weighted order |