1 /*******************************************************************************
3 This file is part of mDictionary.
5 mDictionary is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 mDictionary is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
18 Copyright 2010 Comarch S.A.
20 *******************************************************************************/
23 \brief Bookmarks functionality - marking words as favorite, managing marked
24 words, searching in marked words (witch cached translations)
27 \author Bartosz Szatkowski <bulislaw@linux.com>
36 #include <QStringList>
39 #include <QSqlDatabase>
43 #include "../../includes/settings.h"
44 #include "../../includes/translation.h"
45 class BookmarkTranslation;
48 /*! Bookmarks are way to store words that You think You will need to search
51 When You add bookmark (by clickin on "star" in words list) You adds it to
52 special list with cached translations from all available dictionaries so
53 You can search for them quickly even when You delete coresponding dict.
60 /*! Adds new word and translation to bookmarks
61 \param translation new translation to be saved and cached as a bookmark
63 void add(Translation* translation);
65 /*! Removes word and coresponding translation cache from bookmark list
66 \param translation translation to be removed
68 void remove(Translation* translation);
70 /*! \return all bookmarks (word and translation as a translation object
73 QList<Translation*> list();
75 /*! search in bookmarks for given word (wildcards may apply '*' and '?')
76 \param word to search for
77 \return list of matching Translation objects
79 QList<Translation*> searchWordList(QString word);
81 /*! Search for final translation of given word
82 \return word translation list in text format xml or html to be formated
84 \param word word to search for
86 QStringList search(QString word, QString dbname);
89 /*! clars bookmarks database */
93 /*! \return true if given word is already in bookmarks
96 bool inBookmarks(QString word);
101 bool checkAndCreateDb();
102 QString removeAccents(QString);
103 QSqlDatabase getDbCnx(QString dbName);
107 #endif // BOOKMARKS_H