kiten/lib
DictionaryManager Class Reference
#include <DictionaryManager.h>
Detailed Description
The DictionaryManager class is the fundamental dictionary management class.All interfaces with the rest of the programs using the various dictionaries will work through this "interface class" to keep the formatting and other such nasty details away from programs and sections which just want to use the dictionary without bothering with the internal formatting details. As a general rule, call this class with a DictQuery to get a list of entries as the result.
The idea is that the interfaces need to know how to load a query, pass the query to dictionary. DictionaryManager will return to them an EntryList object, each Entry knows how to display itself (via the magic of C++ polymorphism). There are some setup and preference handling methods which complicate things, but generally speaking this is the way this should work.
Definition at line 57 of file DictionaryManager.h.
Public Member Functions | |
| bool | addDictionary (const QString &file, const QString &name, const QString &type) |
| DictionaryManager () | |
| EntryList * | doSearch (const DictQuery &query) const |
| EntryList * | doSearchInList (const DictQuery &query, const EntryList *list) const |
| QStringList | listDictionaries () const |
| QStringList | listDictionariesOfType (const QString &type) const |
| QPair< QString, QString > | listDictionaryInfo (const QString &name) const |
| void | loadDictSettings (const QString &dict, KConfigSkeleton *config) |
| void | loadSettings (const KConfig &) |
| bool | removeDictionary (const QString &name) |
| virtual | ~DictionaryManager () |
Static Public Member Functions | |
| static QMap< QString, QString > | generateExtendedFieldsList () |
| static QMap< QString, DictionaryPreferenceDialog * > | generatePreferenceDialogs (KConfigSkeleton *config, QWidget *parent=NULL) |
| static QStringList | listDictFileTypes () |
Constructor & Destructor Documentation
| DictionaryManager::DictionaryManager | ( | ) |
| DictionaryManager::~DictionaryManager | ( | ) | [virtual] |
Member Function Documentation
| bool DictionaryManager::addDictionary | ( | const QString & | file, | |
| const QString & | name, | |||
| const QString & | type | |||
| ) |
Open a specified dictionary, and load it under this manager's control.
- Parameters:
-
file the filename, suitable for using with QFile::setFileName() name the name of the file, which may be related to file, but perhaps not, for all future dealings with this file, this name will be the key value type the known dictionary type of this file
Definition at line 96 of file DictionaryManager.cpp.
This is the main search routine that most of kiten should use.
- Parameters:
-
query the DictQuery object describing the search to conduct
Definition at line 179 of file DictionaryManager.cpp.
| EntryList * DictionaryManager::doSearchInList | ( | const DictQuery & | query, | |
| const EntryList * | list | |||
| ) | const |
A simple method for searching inside of a given set of results.
- Parameters:
-
query the new query that will pare down our results list, there is no requirement that this query includes the query that generated the EntryList, the results are calculated only out of the second parameter list the list of results to search for the above query in.
Definition at line 222 of file DictionaryManager.cpp.
Compiles a list of all fields beyond the basic three (word/pronunciation/meaning) that all dictionary types support.
This can be used to generate a preference dialog, or provide more direct references. The return value is "full name of the field" => "abbreviation useable in search string"
Definition at line 264 of file DictionaryManager.cpp.
| QMap< QString, DictionaryPreferenceDialog * > DictionaryManager::generatePreferenceDialogs | ( | KConfigSkeleton * | config, | |
| QWidget * | parent = NULL | |||
| ) | [static] |
Given a config and parent widget, return a mapping from dictionary types to preference dialogs.
If a particular dictionary type does not provide a preference dialog, it will not be included in this list, so occasionally keys(returnvalue) != listDictFileTypes()
- Parameters:
-
config the config skeleton parent the parent widget, as per the normal Qt widget system
Definition at line 248 of file DictionaryManager.cpp.
| QStringList DictionaryManager::listDictFileTypes | ( | ) | [static] |
Get a list of all supported dictionary types.
IMPORTANT: To add a dictionary type, you have to manually add the creation step here, the prev method, and #include your header file above.
Useful for preference code
If you have fully implemented the interface in DictionaryManager.h, It should simply work.
Definition at line 79 of file DictionaryManager.cpp.
| QStringList DictionaryManager::listDictionaries | ( | ) | const |
| QStringList DictionaryManager::listDictionariesOfType | ( | const QString & | type | ) | const |
Lists all dictionaries of a given type (Convenient for preference dialogs).
- Parameters:
-
type the type of dictionaries to list
Definition at line 164 of file DictionaryManager.cpp.
Returns type and file for an open dictionary of a given.
- Parameters:
-
name the name of the dictionary whose information we are looking for
Definition at line 156 of file DictionaryManager.cpp.
| void DictionaryManager::loadDictSettings | ( | const QString & | dict, | |
| KConfigSkeleton * | config | |||
| ) |
Trigger loading preferences from a given KConfigSkeleton config object for a dictionary of type dict.
- Parameters:
-
dict the dictionary type to load settings for config the config skeleton object
Definition at line 236 of file DictionaryManager.cpp.
| void DictionaryManager::loadSettings | ( | const KConfig & | config | ) |
| bool DictionaryManager::removeDictionary | ( | const QString & | name | ) |
Close a dictionary by name.
- Parameters:
-
name the name of the dictionary file, as given in addDictionary
Definition at line 137 of file DictionaryManager.cpp.
The documentation for this class was generated from the following files:
KDE 4.2 API Reference