*******************************************************************************/
-/*! \file Bookmarks.h
-\brief Bookmarks functionality - marking words as favorite, managing marked
+/*!
+ \file Bookmarks.h
+ \brief Bookmarks functionality - marking words as favorite, managing marked
words, searching in marked words (with cached translations)
-
-\author Bartosz Szatkowski <bulislaw@linux.com>
+ \author Bartosz Szatkowski <bulislaw@linux.com>
*/
#ifndef BOOKMARKS_H
class BookmarkTranslation;
-/*! Bookmarks are a way to store words that You think You will need to search
- for often.
+/*!
+ Bookmarks are a way to store words that You think You will need to search
+ for often.
- When You add bookmark (by clicking on "star" in words list) You add it to
- special list with cached translations from all available dictionaries so
- You can search for them quickly even when You delete corresponding dict.
- */
+ When You add a bookmark (by clicking on "star" in words list) You add it to
+ a special list with cached translations from all available dictionaries so
+ You can search for them quickly even when You delete corresponding dict.
+*/
class Bookmarks : public AccentsNormalizer {
public:
Bookmarks();
~Bookmarks();
- /*! Adds new word and translation to bookmarks
- \param translation new translation to be saved and cached as a bookmark
+ /*!
+ Adds new word and translation to bookmarks
+ \param translation new translation to be saved and cached as a bookmark
*/
void add(Translation* translation);
- /*! Removes word and corresponding translation cache from bookmark list
+ void add(QString key,QString removeAccentKey,QString value);
+
+ /*!
+ Removes word and corresponding translation cache from bookmarks list
\param translation translation to be removed
*/
void remove(Translation* translation);
- /*! \return all bookmarks (word and translation as a translation object
- as a list)
- */
+ /*!
+ \return all bookmarks (word and translation as a translation object
+ as a list)
+ */
QList<Translation*> list();
- /*! Searches in bookmarks for a given word (wildcards may apply '*' and '?')
- \param word to search for
- \return list of matching Translation objects
- */
+ /*!
+ Searches in bookmarks for a given word (wildcards may apply '*' and '?')
+ \param word word to search for
+ \return list of matching Translation objects
+ */
QList<Translation*> searchWordList(QString word);
- /*! Searches for final translation of a given word
- \return word translation list in text format xml to be formatted
+ /*!
+ Searches for final translation of a given word
+ \return word translation list in text format xml to be formatted
and displayed
- \param word word to search for
- */
+ \param word word to search for
+ */
QStringList search(QString word, QString dbname);
-
- /*! Clears bookmarks database */
+ /*!
+ Clears bookmarks database
+ */
void clear();
-
- /*! \return true if a given word is already in bookmarks
- \param word to check
- */
+ /*!
+ \return true if a given word is already in bookmarks
+ \param word word to check
+ */
bool inBookmarks(QString word);
private:
- bool checkAndCreateDb();
+ bool checkAndCreateDb(QString dbName = "");
QString dbName;
- QSqlDatabase getDbCnx(QString dbName);
+ QSqlDatabase getDbCnx();
QMap<QChar, QRegExp> letters;
QRegExp noLetter;
QSqlDatabase mdb;