summaryrefslogtreecommitdiffstats
path: root/kmouth/wordcompletion/wordcompletion.h
blob: ff87820a678cdbb73b6a19562e3bb00e34ec732a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef WORDCOMPLETION_H
#define WORDCOMPLETION_H

#include <kcompletion.h>

/**
 * This class does completion based on a dictionary of words.
 */
class WordCompletion : public TDECompletion {
   friend class WordListWidget;
   TQ_OBJECT
  
public:
   WordCompletion();
   virtual ~WordCompletion();

   /**
    * Returns the names for the available word lists
    */
   TQStringList wordLists();

   /**
    * Returns the names for those word lists that contain
    * words of a given language.
    */
   TQStringList wordLists(const TQString &language);
   
   /**
    * Returns the language of a given word list.
    */
   TQString languageOfWordList(const TQString &wordlist);

   /**
    * Returns the name of the currently active word list.
    */
   TQString currentWordList();

   /**
    * Finds completions to the given text.
    */
   virtual TQString makeCompletion(const TQString&);

   static bool isConfigured();
   
   /**
    * Adds the words from the given sentence to the list of words.
    */
   void addSentence (const TQString &sentence);
   
public slots:
   /**
    * Re-reads the configuration.
    */
   void configure();
   
   /**
    * Specify which word list gets used for the actual word completion.
    * If there is no word list with the given name the first configured
    * list gets used.
    * The method returns true if the specified word list was found.
    */
   bool setWordList(const TQString &wordlist);

   /**
    * Saves the added words to disk.
    */
   void save ();

signals:
   void wordListsChanged (const TQStringList &wordLists);
   void currentListChanged (const TQString &wordList);

private:
   class WordCompletionPrivate;
   WordCompletionPrivate *d;
};

#endif // KURLCOMPLETION_H