Merge branch 'master' of ssh://drop.maemo.org/git/mdictionary
authorPiotrek <ppilar11@gmail.com>
Thu, 2 Sep 2010 13:22:05 +0000 (15:22 +0200)
committerPiotrek <ppilar11@gmail.com>
Thu, 2 Sep 2010 13:22:05 +0000 (15:22 +0200)
Conflicts:
src/common/CommonDictInterface.h
src/mdictionary/gui/DictManagerWidget.cpp
src/mdictionary/gui/DictManagerWidget.h
src/mdictionary/gui/SettingsWidget.cpp
src/mdictionary/gui/WelcomeScreenWidget.h
src/plugins/xdxf/xdxfplugin.h

30 files changed:
1  2 
src/common/AccentsNormalizer.h
src/common/CommonDictInterface.h
src/common/DictDialog.h
src/common/GUIInterface.h
src/desktopWidget/MainWidget.h
src/mdictionary/backbone/BookmarkTranslations.h
src/mdictionary/backbone/Bookmarks.h
src/mdictionary/backbone/ConfigGenerator.h
src/mdictionary/backbone/backbone.cpp
src/mdictionary/backbone/backbone.h
src/mdictionary/gui/DictManagerWidget.cpp
src/mdictionary/gui/DictManagerWidget.h
src/mdictionary/gui/MainWindow.cpp
src/mdictionary/gui/MainWindow.h
src/mdictionary/gui/MenuTabWidget.cpp
src/mdictionary/gui/MenuWidget.cpp
src/mdictionary/gui/MenuWidget.h
src/mdictionary/gui/SearchBarWidget.cpp
src/mdictionary/gui/SearchBarWidget.h
src/mdictionary/gui/SettingsWidget.cpp
src/mdictionary/gui/WelcomeScreenWidget.h
src/plugins/google/GoogleDictDialog.h
src/plugins/google/GooglePlugin.cpp
src/plugins/google/GooglePlugin.h
src/plugins/google/GoogleSettingsDialog.h
src/plugins/xdxf/TranslationXdxf.h
src/plugins/xdxf/XdxfCachingDialog.cpp
src/plugins/xdxf/XdxfDictDialog.h
src/plugins/xdxf/XdxfLoadDialog.h
src/plugins/xdxf/xdxfplugin.h

index 0000000,c786b45..0343e88
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,81 +1,81 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ /*! /file AccentsNormalizer.h
 -\brief Common funcionality for all classes that need to remove accents from strings
++\brief Common functionality for all classes that need to remove accents from strings
+ \author Bartosz Szatkowski <bulislaw@linux.com>
+ */
+ #ifndef ACCENTSNORMALIZER_H
+ #define ACCENTSNORMALIZER_H
+ #include <QMap>
+ #include <QString>
+ #include <QRegExp>
+ class AccentsNormalizer {
+   protected:
+     QMap<QChar, QRegExp> letters;
+     QRegExp noLetter;
+     QString removeAccents(QString string) {
+        string = string.toLower();
+        QString normalized = string.normalized(QString::NormalizationForm_KD);
+        foreach(QChar let, letters.keys()) {
+            normalized.replace(letters[let], QString(let));
+        }
+        normalized.replace(noLetter, "");
+        return normalized;
+     }
+     void initAccents() {
+         letters['a'] = QRegExp(QString::fromUtf8("[ÀàÁáÂÂâÃãÄäÅåæÆĀāĂ㥹ǠȀǡȁǢȂǣȃȦȧǺȺǻǼǍǽǎǞǟⱥ]"), Qt::CaseInsensitive);
+         letters['b'] = QRegExp(QString::fromUtf8("[ƀƁƂƃɃƄƅ]"), Qt::CaseInsensitive);
+         letters['c'] = QRegExp(QString::fromUtf8("[ÇçÈçŒĆćĈĉĊċČčƇƈȻȼ]"), Qt::CaseInsensitive);
+         letters['d'] = QRegExp(QString::fromUtf8("[ÐĐđĎďȡƉ]"), Qt::CaseInsensitive);
+         letters['e'] = QRegExp(QString::fromUtf8("[ÈéèÉÊêËëĒēĔĕĖėĘęĚěēȄȅȆɆȇɇȨȩ]"), Qt::CaseInsensitive);
+         letters['f'] = QRegExp(QString::fromUtf8("[ſƑƒꜰ]"), Qt::CaseInsensitive);
+         letters['g'] = QRegExp(QString::fromUtf8("[ĠġĢģĜĝĞğƓǤǴǥǵǦǧ]"), Qt::CaseInsensitive);
+         letters['h'] = QRegExp(QString::fromUtf8("[ħĤĥĦȞȟⱧⱨ]"), Qt::CaseInsensitive);
+         letters['i'] = QRegExp(QString::fromUtf8("[ÌìÍíÎîÏïİijĨĩĪīĬĭĮįǐƗȈȉȊȋǏꟾ]"), Qt::CaseInsensitive);
+         letters['j'] = QRegExp(QString::fromUtf8("[ĴĵǰȷɈɉⱼ]"), Qt::CaseInsensitive);
+         letters['k'] = QRegExp(QString::fromUtf8("[ĶķĸƘǨƙǩⱩⱪ]"), Qt::CaseInsensitive);
+         letters['l'] = QRegExp(QString::fromUtf8("[ŀŁłĹĺĻļĽľĿȴȽⱠⱡⱢꝈ]"), Qt::CaseInsensitive);
+         letters['m'] = QRegExp(QString::fromUtf8("[Ɱ]"), Qt::CaseInsensitive);
+         letters['n'] = QRegExp(QString::fromUtf8("[ÑñŃńŅņŇňʼnŊŋȵǸǹƝ]"), Qt::CaseInsensitive);
+         letters['o'] = QRegExp(QString::fromUtf8("[ÒòÓóÔÕõÖöØøŐőœŌōŎŏƠȰơǑȱǒǪȪǫȫǬȌȬǭȍȭǾȎȮǿȏȯⱺ]"), Qt::CaseInsensitive);
+         letters['p'] = QRegExp(QString::fromUtf8("[ƤƥⱣ]"), Qt::CaseInsensitive);
+         letters['q'] = QRegExp(QString::fromUtf8("[Ɋɋ]"), Qt::CaseInsensitive);
+         letters['r'] = QRegExp(QString::fromUtf8("[ŕŖŖŗŘřȐȑȒȓɌɍⱤ]"), Qt::CaseInsensitive);
+         letters['s'] = QRegExp(QString::fromUtf8("[ߊšŚśŜŝŞşȘșȿꜱ]"), Qt::CaseInsensitive);
+         letters['t'] = QRegExp(QString::fromUtf8("[ŢţŤťŦŧȶȚƫțƬƮȾⱦ]"), Qt::CaseInsensitive);
+         letters['u'] = QRegExp(QString::fromUtf8("[ÙùÚúÛûÜüŰűŲųŨũŪūŬŮůưǓǔȔɄǕȕǖȖǗȗǘǙǚǛǜƯ]"), Qt::CaseInsensitive);
+         letters['v'] = QRegExp(QString::fromUtf8("[Ʋⱱⱴⱽ]"), Qt::CaseInsensitive);
+         letters['w'] = QRegExp(QString::fromUtf8("[ŴŵⱲⱳ]"), Qt::CaseInsensitive);
+         letters['y'] = QRegExp(QString::fromUtf8("[ÿÝýŶŷŸȲƳȳƴɎɏ]"), Qt::CaseInsensitive);
+         letters['z'] = QRegExp(QString::fromUtf8("[ŹźŻżŽžɀȤƵȥƶⱫⱬ]"), Qt::CaseInsensitive);
+         noLetter = QRegExp("[^-a-z '\"]", Qt::CaseInsensitive);
+     }
+ };
+ #endif // ACCENTSNORMALIZER_H
index 0000000,24aec79..899843a
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,137 +1,141 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ /*! \file CommonDictInterface.h
+ \brief Common interface for all dicts and plugins \see CommonDictInterface
+ \author Bartosz Szatkowski <bulislaw@linux.com>
+ */
+ #ifndef COMMONDICTINTERFACE_H
+ #define COMMONDICTINTERFACE_H
+ #include <QString>
+ #include <QDialog>
+ #include <QObject>
+ #include <QList>
+ #include "translation.h"
+ #include "Notify.h"
+ #include "settings.h"
+ #include "AccentsNormalizer.h"
+ class DictDialog;
+ //! Interface for dict engines plugins
+ class CommonDictInterface : public QObject, public AccentsNormalizer {
+   Q_OBJECT
+   public:
+     CommonDictInterface(QObject *parent = 0):QObject(parent) {}
+     virtual ~CommonDictInterface() {}
+     //! returns source language code iso 639-2
+     virtual QString langFrom() const = 0;
+     //! returns destination language code iso 639-2
+     virtual QString langTo() const = 0;
 -    //! returns dictionary name (like "old English" or so
++    //! returns dictionary name (like "old English" or so)
+     virtual QString name() const = 0;
+     //! returns dictionary type (xdxf, google translate, etc)
+     virtual QString type() const = 0;
+     //! returns information about dictionary in html (name, authors, etc)
+     virtual QString infoNote() const = 0;
+     /*! returns DictDialog object that creates dialogs
+         for adding new dictionary and changing plugin settings*/
+     virtual DictDialog* dictDialog() = 0;
 -    //! returns new, clean copy of plugin with setting set as in Settings*
++
++    //! returns new, clean copy of plugin with settings set as in Settings*
+     virtual CommonDictInterface* getNew(const Settings*) const = 0;
+     //! returns whether plugin can start searching
+     virtual bool isAvailable() const = 0;
+     //! returns the actual translation of a word given in key
+     virtual QString search(QString key) = 0;
 -    //! \returns unique value (unique for every dictionary not plugin)
++    //! \returns unique value (unique for every dictionary, not plugin)
+     virtual uint hash() const = 0;
 -    //! sets unique value (unique for every dictionary not plugin)
++    //! sets unique value (unique for every dictionary, not plugin)
+     virtual void setHash(uint) = 0;
+     //! returns current plugin settings
+     virtual Settings* settings() = 0;
+     //! returns plugin icon
+     virtual QIcon* icon() = 0;
 -    //! returns empty translation object (to be fetch later) for given key
++    //! returns empty translation object (to be fetched later) for given key
+     virtual Translation* getTranslationFor(QString ) {return 0;}
 -    /*! plugin should delete any files (eg. cache) that has created and be ready
++    /*! plugin should delete any files (eg. cache) that have been created and are ready
+         to be deleted
+         */
+     virtual void clean() {}
+  public Q_SLOTS:
+     /*! performs search in dictionary
+         \param  word word to search in dictionary
+         \param  limit limit on number of results,
+                 if limit=0 all matching words are returned
+         After finishing search it has to emit
+         \see CommonDictInterface:finalTranslation  finalTranslation
+     */
+     virtual QList<Translation*> searchWordList(QString word, int limit=0) = 0;
+     //! stops current operation
+     virtual void stop() = 0;
++  Q_SIGNALS:
++
++    //! emitted when dictionary is ready to use afer being loaded
++    void loaded(CommonDictInterface*);
 -Q_SIGNALS:
 -    //! emited after change dictionary settings
++    //! emitted after change in dictionary settings
+     void settingsChanged();
 -    /*! emitted to backbone when needed to inform user about something
 -        \param Backbone::NotifyType gui my dacide to show different typet in
++    /*! emitted to backbone when it's needed to inform user about something
++        \param Backbone::NotifyType GUI may decide to show different types in
+             different ways
+         \param QString text of the notification
+     */
+     void notify(Notify::NotifyType, QString);
+     
+ protected:
+     QString removeAccents(QString string) {
+         if(settings()->value("strip_accents") == "true")
+             return AccentsNormalizer::removeAccents(string);
+         return string;
+     }
+ };
+ Q_DECLARE_INTERFACE(CommonDictInterface, "CommonDictInterface/0.1");
+ #endif
index 0000000,30e9457..fc83744
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,51 +1,51 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ //Created by Mateusz Półrola
+ #ifndef DICTDIALOG_H
+ #define DICTDIALOG_H
+ #include <QObject>
+ class Settings;
+ //! Interface for plugin dialog provider
+ class DictDialog : public QObject {
+     Q_OBJECT
+ public:
 -    DictDialog(QObject*parent=0) : QObject(parent) {}
++    DictDialog(QObject *parent = 0) : QObject(parent) {}
+     /*!
 -      Shows add new dictionary dialog and returns settings of new dict
++      Shows "add new dictionary" dialog and returns settings of new dict
+       \param parent parent widget on which dialog will be displayed
+       */
+     virtual Settings* addNewDictionary(QWidget*parent=0)=0;
+     /*!
 -      Shows settings dialog and save new settings in plugin
++      Shows "settings" dialog and saves new settings in plugin
+       \param parent parent widget on which dialog will be displayed
+       */
 -    virtual void changeSettings(QWidget*parent=0)=0;
++    virtual void changeSettings(QWidget *parent = 0) = 0;
+ };
+ #endif // DICTDIALOG_H
index 0000000,ad92b37..2f10cc1
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,195 +1,195 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ //! \file GUIInterface.h
+ //! \brief Defines interface for GUI
+ //! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ #ifndef GUIINTERFACE_H
+ #define GUIINTERFACE_H
+ #include <QMainWindow>
+ #include <QMultiHash>
+ #include "translation.h"
+ #include "CommonDictInterface.h"
+ class Settings;
+ //! Interface for different GUIs
+ /*!
+   Default base class for all GUIs is QMainWindow
+   */
+ class GUIInterface : public QMainWindow {
+     Q_OBJECT
+ public:
+     GUIInterface(QWidget *parent = 0) :QMainWindow(parent) {}
+     virtual ~GUIInterface() {}
 -    //! Returns all loaded dictionaries with infromation about that they are
++    //! Returns all loaded dictionaries with information about that they are
+     //! active/inactive
+     /*!
+         \return Hash of pointers to dictionary and boolean flag indicating if
+         dictionary is active
+      */
+     virtual QHash<CommonDictInterface*, bool> getDictionaries() = 0;
+     //! Returns all loaded plugins
+     /*!
+         \return List of pointers to plugins
+      */
+     virtual QList<CommonDictInterface*> getPlugins() = 0;
+     //! Indicates if GUI is in exact search mode.
+     /*! When GUI is in exact search mode it searches for word, and
+         if it finds exactly matching translation it directly displays it, without
+         displaying matching word list. This mode should be
+         used for browsing search history and searching words from application
+         arguments.
+         \returns flag indicating if GUI is in exact search mode
+     */
+     bool exactSearch();
+     //! Sets GUI exact search mode.
+     /*! \sa exactSearch() */
+     void setExactSearch(bool exactSearch);
+     virtual Settings* settings() = 0;
+     virtual void setSettings(Settings*) = 0;
+ public Q_SLOTS:
+     //! Searches in exact mode for given word
+     /*!
+       GUI will be automatically set into exact search mode, and after search or
 -      break will be unset from exact search mode.
++      break it will be unset from exact search mode.
+       \param word which will be searched in dictionaries
+       */
+     virtual void searchExact(QString word) = 0;
 -    //! Adds to history key words from given translations
++    //! Adds key words from given translations to history
+     /*!
 -      By default this slot is connected to signal searchTranslations, and
 -      passed translation list contains only translation with the same key, so
++      By default this slot is connected to searchTranslations signal, and
++      passed translations list contains only translations with the same key, so
+       only one word is added to history.
+       \param list of translations with key words
+       \sa searchTranslations();
+       */
+     virtual void addToHistory(QList<Translation*>) = 0;
+     //! Shows history dialog
+     virtual void showHistory(QPoint) = 0;
+     //! Shows translation of next word in history
+     /*!
 -      It will work only if there is available next word in history.
++      It will work only if there is next word available in history.
+       Translation of word is searched with searchExact() function
+       \sa searchExact()
+       */
+     virtual void historyNext() = 0;
+     //! Shows translation of previous word in history
+     /*!
 -      It will work only if there is available previous word in history.
++      It will work only if there is previous word available in history.
+       Translation of word is searched with searchExact() function
+       \sa searchExact()
+       */
+     virtual void historyPrev() = 0;
 -    //! Gets word list from backbone and prepares received list to display
++    //! Gets words list from backbone and prepares received list to display
+     /*!
 -      Checks if received list is empty, in that case displays suitable
++      Checks if received list is empty, in that case it displays suitable
+       information. If GUI is in exact search mode it will search for exact
+       word in received list, and if word is found it will emit signal to
+       display its translation. Otherwise it will display list of matching
+       words and show suitable information.
+       \sa exactSearch()
+       \sa showTranslation()
+      */
+     virtual void wordListReady() = 0;
+     //! Gets translation strings from backbone and emits signal to display them
+     virtual void translationsReady() = 0;
+ Q_SIGNALS:
+     //! Should be emitted when user wants to close application to stop
+     //! all ongoing searches
+     void quit();
+     //! Emitted when user wants to search for list of words matching given word
+     /*! \param word word which will be matched, it can contain wildcards
+     */
+     void searchWordList(QString word);
+     //! Emitted when user wants to see translation of words.
+     /*! \param list of translations for given word which will be received
+         in wordListReady() slot
+         \sa wordListReady()
+     */
+     void searchTranslations(QList<Translation*>);
+     //! Emitted when starting search, will disable GUI components
 -    //! and shows progress bars
++    //! and show progress bars
+     void setBusy();
+     //! Emitted when searching ends, will enable GUI components
+     void setIdle();
+     //! Emitted when user wants to break search
+     void stopSearching();
+     //! Emitted after receiving word list in wordListReady() slot, will display
+     //! list of matched words
 -    /*! \param hash of word and list of translation of this word found
++    /*! \param hash of word and list of translations of this word found
+          in dictionaries
+      */
+     void showWordList(QHash<QString, QList<Translation*> >);
+     //! Emitted after receiving translation strings in translationsReady() slot,
+     //! will display translation of given word
+     /*! \param list of translations from different dictionaries
+          in dictionaries
+      */
+     void showTranslation(QStringList);
+     //! Emitted when user wants to add new dictionary
+     /*! \param new dictionary returned by specific plugin dialog
+       */
+     void addNewDictionary(CommonDictInterface*);
+     //! Emitted when user wants to remove dictionary
+     /*! \param dictionary which will be removed
+       */
+     void removeDictionary(CommonDictInterface*);
+     //! Emitted when user changes dictionaries active/inactive states
+     /*! \param list of only active dictionaries
+       */
+     void selectedDictionaries(QList<CommonDictInterface* >);
+     void addToBookmarks(QList<Translation*>);
+ };
+ #endif // GUIINTERFACE_H
index 0000000,375951d..3ee4c2b
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,67 +1,67 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ //! \file MainWidget.cpp
+ //! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ #ifndef MAINWIDGET_H
+ #define MAINWIDGET_H
+ #include <QWidget>
+ #include <QtGui>
+ #include <QtDBus/QDBusConnection>
+ #include <QPushButton>
 -//! Implements widget for maemo that allows user to quick search using mdictionary right of home screen.
++//! Implements widget for maemo that allows user to search quickly right from home screen using mdictionary.
+ /*!
+   Shows tool button with logo of mDictionary which can start application.
 -  In line edit user inputs word, and using button next to it or by pressing enter, widget start mDictionary already witch started search for given word.
++  In line edit user inputs word, and using button next to it or by pressing enter, widget runs mDictionary which immediately starts searching for given word.
+   If mDictionary is already running in background it will show the program.
+   */
+ class HomeWidget : public QWidget
+ {
+     Q_OBJECT
+ public:
+     HomeWidget(QWidget *parent = 0);
+ private slots:
+     void search();
+     void logoClicked();
+ protected:
+     /*! Reimplemented paintEvent to display rounded corners with transparency */
+     void paintEvent(QPaintEvent *);
+ private:
+     /*! Initializes ui of widget*/
+     void initializeUI();
+     /*! Initializes X11 to set application type as home widget*/
+     void initializeX11();
+     QLineEdit* searchStringLineEdit;
+     QPushButton* searchButton;
+     QToolButton* logo;
+     QHBoxLayout* horizontalLayout;
+ };
+ #endif // MAINWIDGET_H
index 0000000,0748d30..34a3dfc
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,91 +1,91 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ /*! \file BookmarkTranslation.h
 -\brief Bookmarks functionality needs its own translation  object - because
++\brief Bookmarks functionality needs its own translation object - because
+     Translation object should use slightly different api of Bookmarks objects
+ \author Bartosz Szatkowski <bulislaw@linux.com>
+ */
+ #ifndef BOOKMARKTRANSLATIONS_H
+ #define BOOKMARKTRANSLATIONS_H
+ #include "../../common/settings.h"
+ #include "../../common/translation.h"
+ #include "Bookmarks.h"
+ #include "QObject"
+ class BookmarkTranslation : public Translation
+ {
+ public:
+     BookmarkTranslation(QString key, Bookmarks* bookmarks, QString dbName){
+         _key = key;
+         _dictionaryInfo = dbName;
+         _bookmarks = bookmarks;
+         _bookmark = 1;
+     }
+     //! \return word to be translated
+     QString key() const {
+         return _key;
+     }
+     /*! \returns dictionary information (plugin name, languages, <logo> etc)\
+         to be displayed in translation table header*/
+     QString dictionaryInfo() const {
+         return _dictionaryInfo;
+     }
+     //! \return parsed raw format into html
+     QString toHtml() const {
+         if(!_key.size() || !_bookmarks)
+             return "";
+         QStringList list = _bookmarks->search(_key, _dictionaryInfo);
+         QString result;
+         foreach(QString translation, list)
+             result += translation + "\n";
+         return result;
+     }
+     /*! sets the word for which we want to find a translation
+         \param word for which we want to find a translation */
+     void setKey(QString key) {
+         _key = key;
+     };
+     //! sets information about dictionary
+     void setDictionaryInfo(QString dictionaryInfo) {
+         _dictionaryInfo = dictionaryInfo;
+     }
+ private:
+     QString _key;
+     QString _dictionaryInfo;
+     Bookmarks* _bookmarks;
+ };
+ #endif // HISTORYTRANSLATION_H
index 0000000,d0fea98..5696296
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,111 +1,111 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ /*! \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>
+ */
+ #ifndef BOOKMARKS_H
+ #define BOOKMARKS_H
+ #include <QtSql>
+ #include <QString>
+ #include <QVariant>
+ #include <QStringList>
+ #include <QList>
+ #include <QSqlQuery>
+ #include <QSqlDatabase>
+ #include <QSqlError>
+ #include <QDir>
+ #include <QDebug>
+ #include "../../common/settings.h"
+ #include "../../common/translation.h"
+ #include "../../common/AccentsNormalizer.h"
+ class BookmarkTranslation;
+ /*! Bookmarks are way to store words that You think You will need to search
+   for often.
 -  When You add bookmark (by clickin on "star" in words list) You add it to
++  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.
+   */
+ 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
+     */
+     void add(Translation* translation);
+     /*! Removes word and corresponding translation cache from bookmark list
+         \param translation translation to be removed
+     */
+     void remove(Translation* translation);
+     /*! \return all bookmarks (word and translation as a translation object
+      as a list)
+      */
+     QList<Translation*> list();
+     /*! Searches in bookmarks for given word (wildcards may apply '*' and '?')
+       \param word to search for
+       \return list of matching Translation objects
+       */
+     QList<Translation*> searchWordList(QString word);
+     /*! Searches for final translation of given word
+       \return word translation list in text format xml or html to be formatted
+         and displayed
+       \param word word to search for
+       */
+     QStringList search(QString word, QString dbname);
+     /*! Clears bookmarks database */
+     void clear();
+     /*! \return true if given word is already in bookmarks
+       \param word to check
+       */
+     bool inBookmarks(QString word);
+ private:
+     bool checkAndCreateDb();
+     
+     QString dbName;
+     QSqlDatabase getDbCnx(QString dbName);
+     QMap<QChar, QRegExp> letters;
+     QRegExp noLetter;
+     QSqlDatabase mdb;
+ };
+ #endif // BOOKMARKS_H
index 0000000,9ae26c8..9d4002c
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,60 +1,60 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ /*! \file ConfigGenerator.h
+ \brief Generating default config files, css stylesheet etc
+ \author Bartosz Szatkowski <bulislaw@linux.com>
+ */
+ #ifndef CONFIGGENERATOR_H
+ #define CONFIGGENERATOR_H
+ #include <QFile>
+ #include <QString>
+ #include <QDebug>
 -/*! ConfigGenerator generatesconfiguration files (with default values),
 -if given file dosent exists.
++/*! ConfigGenerator generates configuration files (with default values),
++if given file doesn't exist.
+ */
+ class ConfigGenerator {
+ public:
+     /*! Generates default css stylesheet for xslt transformations
+         \param file file to be generated
+         \return if file was generated - returns true; if file alredy exists
 -            return true; if file dosent exists but cannot be generated returns false
++            returns true; if file doesn't exist but cannot be generated returns false
+     */
+     bool generateCss(QString file);
+     /*! Generates default configuration files
+         \param file file to be generated
+         \return if file was generated - returns true; if file alredy exists
 -            return true; if file dosent exists but cannot be generated returns false
++            returns true; if file doesn't exist but cannot be generated returns false
+     */
+     bool generateDefaultConfig(QString file);
+ private:
+     bool generateFile(QString source, QString file);
+ };
+ #endif // CONFIGGENERATOR_H
index 0000000,16bb487..c7993cb
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,629 +1,629 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ /*! \file backbone.cpp
+ \brief Backbone/core main file \see Backbone
+ \author Bartosz Szatkowski <bulislaw@linux.com>
+ */
+ #include "backbone.h"
+ #include "ConfigGenerator.h"
+ class ConfigGenerator;
+ #include <QDebug>
+ int Backbone::_searchLimit;
 -// Sadly QtConcurent::mapped dosent let me use something like calling method of
 -// some class with supplied argument; so i have to sin against art and put
 -// global function and variable so i could supply function with some parametr
++// Sadly QtConcurrent::mapped doesn't let me use something like calling method of
++// some class with supplied argument; so I have to sin against art and put
++// global function and variable so I could supply function with some parameter
+ QString mappedSearch;
+ QList<Translation*> mapSearch(CommonDictInterface *dict) {
+     if(dict)
+         return dict->searchWordList(mappedSearch, Backbone::_searchLimit);
+     return QList<Translation*>();
+ }
+ /*! Smart pointer (kind of) for translation object
 -    QtConcurent::mapped  use collection of data and one function, what i need is
 -    to map signle data object to method calls for multiple objects. TranslationPtr
 -    is try to store method call as a data -> moreover QtConcurent allow only for
++    QtConcurrent::mapped uses collection of data and one function, what I need is
++    to map single data object to method calls for multiple objects. TranslationPtr
++    is an attempt to store method call as a data -> moreover QtConcurrent allows only for
+     methods without any parameters so TranslationPtr is created with Translation
+     object -> ready to call toHtml() for supplied Translation.
 -    Another thing is that QtConcurent dont like pointers in data collection
 -    so TranslationPtr is way to hide real translation object (pointer for object)
++    Another thing is that QtConcurrent doesn't like pointers in data collection
++    so TranslationPtr is a way to hide real translation object (pointer to object)
+     */
+ class TranslationPtr {
+     Translation* _tr;
+ public:
+     TranslationPtr(Translation* tr) :_tr(tr) {}
+     /*! \return translation text for corresponding Translation object */
+     QString toHtml() const {
+         QString trans;
+         trans = _tr->toHtml();
+         return trans;
+     }
+ };
+ void Backbone::init() {
+    _dictNum = 0;
+    _dir = QDir::homePath() + "/.mdictionary/";
+    if(!QDir(_dir).exists())
+        QDir().mkdir(_dir);
+    if(!_configPath.size())
+        _configPath = _dir + "mdictionary.config";
+    if(!_pluginPath.size())
+        _pluginPath = "/usr/lib/mdictionary/plugins";
+    //Install default config files
+    ConfigGenerator confGen;
+    confGen.generateCss(_dir + "style.css");
+    confGen.generateDefaultConfig(_configPath);
+    loadPrefs(_configPath);
+    loadPlugins();
+    loadDicts(_configPath);
+    connect(&_resultWatcher, SIGNAL(finished()), this, SLOT(translationReady()));
+    connect(&_htmlResultWatcher, SIGNAL(finished()), this,
+            SLOT(htmlTranslationReady()));
+    connect(&_bookmarkWatcher, SIGNAL(finished()), this,
+            SLOT(bookmarksListReady()));
+    connect(&_bookmarkSearchWatcher, SIGNAL(finished()), this,
+            SLOT(translationReady()));
+    // In common opinion perfect thread count is cores_number+1 (in qt perfect
 -   // thread count is set to cores number
++   // thread count is set to cores number)
+    QThreadPool::globalInstance()->setMaxThreadCount(
+            QThreadPool::globalInstance()->maxThreadCount()+1);
+    _history = new History(_historyLen, this);
+ }
+ Backbone::Backbone(QString pluginPath, QString configPath, bool dry,
+                    QObject *parent)
+     : QObject(parent)
+ {
+     _pluginPath = pluginPath;
+     _configPath = configPath;
+     dryRun = false;
+     if(dry)
+         dryRun = true;
+     init();
+ }
+ Backbone::~Backbone()
+ {
+     QListIterator<CommonDictInterface*> it(_dicts.keys());
+     while(it.hasNext())
+         delete it.next();
+     it = QListIterator<CommonDictInterface*>(_plugins);
+     while(it.hasNext())
+         delete it.next();
+     QHashIterator<QString, Translation*> it2(_result);
+     while(it2.hasNext())
+         delete it2.next().value();
+ }
+ Backbone::Backbone(const Backbone &b) :QObject(b.parent()) {
+     init();
+     _dicts = QHash<CommonDictInterface*, bool > (b._dicts);
+     _plugins = QList<CommonDictInterface* > (b._plugins);
+     _result = QHash<QString, Translation* > (b._result);
+     _searchLimit = b.searchLimit();
+ }
+ int Backbone::searchLimit() const {
+     return _searchLimit;
+ }
+ QHash<CommonDictInterface*, bool > Backbone::getDictionaries() {
+     return _dicts;
+ }
+ QList<CommonDictInterface* > Backbone::getPlugins() {
+     return _plugins;
+ }
+ History* Backbone::history() {
+     return _history;
+ }
+ QMultiHash<QString, Translation*> Backbone::result() {
+     return _result;
+ }
+ void Backbone::stopSearching() {
+     if(stopped)
+         return;
+     foreach(CommonDictInterface* dict, _dicts.keys())
+         dict->stop();
+     stopped = true;
+     _innerHtmlResult.cancel();
+     _innerResult.cancel();
+     Q_EMIT searchCanceled();
+ }
+ void Backbone::search(QString word){
+     _result.clear();
+     mappedSearch = word.toLower();
+     stopped = false;
+     // When dictFin and bookmarkFin is set to true then translationReady()
 -    // signal is emited see translationReady(),
 -    // so when searching only in one of them, coresponding *Fin is set to false
++    // signal is emitted see translationReady(),
++    // so when searching only in one of them, corresponding *Fin is set to false
+     // and other to true so program is waiting only for one translation
+     dictFin = !_searchDicts;
+     bookmarkFin = !_searchBookmarks;
+     if(!_searchDicts && !_searchBookmarks) {
+         Q_EMIT ready();
+         Q_EMIT notify(Notify::Warning, tr("You have to specify where You want "
+                 "to look for translations"));
+     }
+     if (_searchDicts) {
+         _innerResult = QtConcurrent::mapped(activeDicts(), mapSearch);
+         _resultWatcher.setFuture(_innerResult);
+     }
+     if(_searchBookmarks) {
+         _innerBookmarks = QtConcurrent::run(_bookmarks,
+                 &Bookmarks::searchWordList, word);
+         _bookmarkSearchWatcher.setFuture(_innerBookmarks);
+     }
+ }
+ void Backbone::selectedDictionaries(QList<CommonDictInterface* > activeDicts) {
+     foreach(CommonDictInterface* dict, _dicts.keys())
+         if(activeDicts.contains(dict))
+             _dicts[dict] = 1;
+         else
+             _dicts[dict] = 0;
+     dictUpdated();
+  }
+ void Backbone::addDictionary(CommonDictInterface *dict, bool active) {
+     addInternalDictionary(dict,active);
+     dictUpdated();
+ }
+  void Backbone::addInternalDictionary(CommonDictInterface* dict, bool active) {
+      dict->setHash(++_dictNum); // Hash must be uniqe in every session but not between
+      _dicts[dict] = active;
+      connect(dict, SIGNAL(settingsChanged()), this, SLOT(dictUpdated()));
+      connect(dict, SIGNAL(notify(Notify::NotifyType,QString)), this,
+              SIGNAL(notify(Notify::NotifyType,QString)));
+  }
+  void Backbone::removeDictionary(CommonDictInterface *dict) {
+      _dicts.remove(dict);
+      if(dict)
+         dict->clean();
+      else
+         qDebug()<<"delete empty dict";
+      delete dict;
+      dictUpdated();
+  }
+  void Backbone::quit() {
+     stopSearching();
+     Q_EMIT closeOk();
+ }
+ void Backbone::translationReady() {
 -    bool changed = 0; // prevents doubling ready() signal, when both if's are
++    bool changed = 0; // prevents from doubling ready() signal, when both if's are
+                       //  executed in one translationReady() call then second
+                       // translationReady() call doubles ready*() emit
+     if(!dictFin && _innerResult.isFinished()) {
+         changed = 1;
+         dictFin = 1;
+         QFutureIterator<QList<Translation*> > it(_innerResult);
+         while(it.hasNext()) {
+             QList<Translation* > list = it.next();
+             foreach(Translation* trans, list) {
+                 if(!trans)
+                     continue;
+                 if(!_searchBookmarks)
+                     trans->setBookmark(_bookmarks.
+                             inBookmarks(trans->key()));
+                 _result.insert(trans->key().toLower(), trans);
+            }
+         }
+     }
+     if(!bookmarkFin && _innerBookmarks.isFinished()) {
+         changed = 1;
+         bookmarkFin = 1;
+         QList<Translation*> list = _innerBookmarks.result();
+         foreach(Translation* trans, list)
+                 _result.insert(trans->key().toLower(), trans);
+     }
+     if(!stopped && bookmarkFin && dictFin && changed) {
+         Q_EMIT ready();
+     }
+ }
+ QStringList Backbone::getFilesFromDir(QString dir, QStringList nameFilter) {
+     QDir plug(QDir::toNativeSeparators(dir));
+     if(!plug.exists()) {
+         qDebug() << plug.absolutePath() << " folder doesn't exist";
+         Q_EMIT notify(Notify::Warning,
 -                QString("%1 folder doesn't exist.").arg(plug.path()));
++                tr("%1 folder doesn't exist.").arg(plug.path()));
+         return QStringList();
+     }
+     plug.setFilter(QDir::Files);
+     QStringList list = plug.entryList(nameFilter);
+     for(int i = 0; i < list.size(); i++)
+         list[i] = plug.absoluteFilePath(list.at(i));
+     return list;
+ }
+ void Backbone::loadPlugins() {
+     if(dryRun)
+         return;
+     QStringList nameFilter;
+     nameFilter << "*.so" << "*.so.*";
+     QStringList files = getFilesFromDir(_pluginPath, nameFilter);
+     foreach(QString file, files) {
+         QPluginLoader loader(file);
+         if(!loader.load()) {
+             Q_EMIT notify(Notify::Error,
 -                    QString("%1 plugin cannot be loaded: %2.")
++                    tr("%1 plugin cannot be loaded: %2.")
+                     .arg(file).arg(loader.errorString()));
+             continue;
+         }
+         QObject *pl = loader.instance();
+         bool exists = 0;
+         CommonDictInterface *plugin = qobject_cast<CommonDictInterface*>(pl);
+         foreach(CommonDictInterface* pl, _plugins)
+             if(pl->type() == plugin->type()) {
+                 exists = 1;
+                 break;
+            }
+         if(!exists)
+             _plugins.append(plugin);
+     }
+ }
+ CommonDictInterface* Backbone::plugin(QString type) {
+     foreach(CommonDictInterface* plugin, _plugins)
+         if(plugin->type() == type)
+             return plugin;
+     return 0;
+ }
+ void Backbone::loadPrefs(QString fileName) {
+     if(dryRun)
+         return;
+     QFileInfo file(QDir::toNativeSeparators(fileName));
+     QDir confDir(file.dir());
+     if(!confDir.exists()){
+         qDebug() << "Configuration file doesn't exist ("
+                 << file.filePath() << ")";
+         Q_EMIT notify(Notify::Warning,
 -                QString("%1 configuration file doesn't exist.")
++                tr("%1 configuration file doesn't exist.")
+                 .arg(file.filePath()));
+         return;
+     }
+     QSettings set(file.filePath(), QSettings::IniFormat);
+     _pluginPath = set.value("general/plugin_path", _pluginPath).toString();
+     _historyLen = set.value("general/history_size", 10).toInt();
+     _searchLimit = set.value("general/search_limit", 15).toInt();
+     _searchBookmarks = set.value("general/search_bookmarks",1).toBool();
+     _searchDicts = set.value("general/search_dictionaries",1).toBool();
+     _zoom = set.value("general/zoom", 1.0).toReal();
+ }
+ void Backbone::savePrefs(QSettings *set) {
+     if(dryRun)
+         return;
+     set->setValue("general/plugin_path", _pluginPath);
+     set->setValue("general/history_size", _historyLen);
+     set->setValue("general/search_limit", _searchLimit);
+     set->setValue("general/search_bookmarks", _searchBookmarks);
+     set->setValue("general/search_dictionaries", _searchDicts);
+     set->setValue("general/zoom", _zoom);
+ }
+ void Backbone::loadDicts(QString fileName) {
+     if(dryRun)
+         return;
+     QFileInfo file(QDir::toNativeSeparators(fileName));
+     QDir confDir(file.dir());
+     if(!confDir.exists()){
+         qDebug() << "Configuration file doesn't exist ("
+                 << file.filePath() << ")";
+         Q_EMIT notify(Notify::Warning,
 -                QString("%1 configurationfile doesn't exist.")
++                tr("%1 configuration file doesn't exist.")
+                 .arg(file.filePath()));
+         return;
+     }
+     QSettings set(file.filePath(), QSettings::IniFormat);
+     QStringList dicts = set.childGroups();
+     foreach(QString dict, dicts) {
+         if(!dict.contains("dictionary_"))
+             continue;
+         CommonDictInterface* plug = plugin
+                                     (set.value(dict + "/type", "").toString());
+         if(!plug) {
+             qDebug() << "Config file error: "
+                     << set.value(dict + "/type", "").toString()
+                     << " doesn't exist";
+             Q_EMIT notify(Notify::Warning,
 -                    QString("Configuration file error. %2 plugin doesn't exist.")
++                    tr("Configuration file error. %2 plugin doesn't exist.")
+                     .arg(set.value(dict + "/type", "").toString()));
+             continue;
+         }
+         Settings* plugSet = new Settings();
+         set.beginGroup(dict);
+         QStringList items = set.childKeys();
+         foreach(QString item, items) {
+             plugSet->setValue(item, set.value(item, "").toString());
+         }
+         bool active = set.value("active",1).toBool();
+         set.endGroup();
+         addInternalDictionary(plug->getNew(plugSet), active);
+         delete plugSet;
+     }
+ }
+ void Backbone::dictUpdated() {
+     if(dryRun)
+         return;
+     // For convienence this function is called for each change in dictionaries
+     // and each call dumps configuration for all dictionaries into file.
+     // Maybe better way would be to store new/changed configuration but
+     // parsing settings file and figuring out what was changed, in my opinion,
+     // would take more time
+     _history->setMaxSize(_historyLen);
+     QFileInfo file(QDir::toNativeSeparators(_configPath));
+     QDir confDir(file.dir());
+     if(!confDir.exists())
+         confDir.mkpath(file.dir().path());
+     QSettings set(file.filePath(), QSettings::IniFormat);
+     set.clear();
+     savePrefs(&set);
+     foreach(CommonDictInterface* dict, _dicts.keys()){
+         if(!dict || !dict->settings())
+             continue;
+         saveState(&set, dict->settings(), _dicts[dict], dict->hash());
+     }
+ }
+ void Backbone::saveState(QSettings* set, Settings* plugSet, bool active
+                          , uint hash) {
+     if(dryRun)
+         return;
+     if(!set || !plugSet)
+         return;
+     QString section;
+     section.append(QString("dictionary_%1").arg(hash));
+     QList<QString> keys = plugSet->keys();
+     foreach(QString key, keys)
+         set->setValue(section + "/" + key, plugSet->value(key));
+     set->setValue(section + "/active", active);
+ }
+ QStringList Backbone::htmls() {
+     return _htmlResult;
+ }
+ void Backbone::searchHtml(QList<Translation *> translations) {
+     _htmlResult.clear();
+     QList<TranslationPtr> dummy;
+     stopped = false;
+     foreach(Translation* tr, translations) {
+          if(containsDict(tr->dict()) || !tr->dict())
+             dummy.append(TranslationPtr(tr));
+   /*      foreach(CommonDictInterface* dict, activeDicts()) {
+             Translation* trans = dict->getTranslationFor(tr->key());
+             if(trans)
+                 dummy.append(TranslationPtr(trans));
+         } */
+     }
+     if(translations.size()>0) {
+         Translation *tr = translations.at(0);
+         foreach(CommonDictInterface* dict, activeDicts()) {
+             Translation* trans = dict->getTranslationFor(tr->key());
+             if(trans)
+                 dummy.append(TranslationPtr(trans));
+         }
+     }
+    _innerHtmlResult = QtConcurrent::mapped(dummy,
+                                             &TranslationPtr::toHtml);
+    _htmlResultWatcher.setFuture(_innerHtmlResult);
+ }
+ void Backbone::htmlTranslationReady() {
+     QFutureIterator<QString> it(_innerHtmlResult);
+     QSet<QString> uniqe;
+     while(it.hasNext())
+         uniqe.insert(it.next());
+     _htmlResult.clear();
+     _htmlResult = uniqe.toList();
+     if(!stopped)
+         Q_EMIT htmlReady();
+ }
+ QList<CommonDictInterface*> Backbone::activeDicts() {
+     QList<CommonDictInterface*>res;
+     foreach(CommonDictInterface* dict, _dicts.keys())
+         if(_dicts[dict])
+             res.append(dict);
+     return res;
+ }
+ void Backbone::bookmarksListReady() {
+    _bookmarksResult = _innerBookmarks.result();
+    Q_EMIT bookmarksReady();
+ }
+ void Backbone::setSettings(Settings *settings) {
+     _historyLen = settings->value("history_size").toInt();
+     _searchLimit = settings->value("search_limit").toInt();
+     if(settings->value("search_dictionaries") == "true")
+         _searchDicts = 1;
+     else
+         _searchDicts = 0;
+     if(settings->value("search_bookmarks") == "true")
+         _searchBookmarks = 1;
+     else
+         _searchBookmarks = 0;
+     _zoom = settings->value("zoom").toFloat();
+     if(!_zoom)
+         _zoom ++;
+     dictUpdated();
+     if(settings)
+         delete settings;
+ }
+ Settings* Backbone::settings() {
+     Settings * settings = new Settings();
+     settings->setValue("history_size", QString("%1").arg(_historyLen));
+     settings->setValue("search_limit", QString("%1").arg(_searchLimit));
+     settings->setValue("zoom", QString("%1").arg(_zoom));
+     if(_searchBookmarks)
+         settings->setValue("search_bookmarks", "true");
+     else
+         settings->setValue("search_bookmarks", "false");
+     if(_searchDicts)
+         settings->setValue("search_dictionaries", "true");
+     else
+         settings->setValue("search_dictionaries", "false");
+     return settings;
+ }
+ bool Backbone::containsDict(uint hash) const {
+     QHashIterator<CommonDictInterface*, bool> it(_dicts);
+     if (!hash)
+         return false;
+     while(it.hasNext())
+         if(it.next().key()->hash() == hash)
+             return true;
+     return false;
+ }
index 0000000,1fcc887..3e8396c
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,342 +1,342 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ /*! \file backbone.cpp
+ \brief Backbone/core main header \see Backbone
+ \author Bartosz Szatkowski <bulislaw@linux.com>
+ */
+ #ifndef BACKBONE_H
+ #define BACKBONE_H
+ #include <QObject>
+ #include <QList>
+ #include <QHash>
+ #include <QSet>
+ #include <QPluginLoader>
+ #include <QFuture>
+ #include <QtConcurrentRun>
+ #include <QtConcurrentMap>
+ #include <QFutureIterator>
+ #include <QTimer>
+ #include <QTime>
+ #include <QDir>
+ #include <QThread>
+ #include <QSettings>
+ #include <QFutureWatcher>
+ #include "../../common/CommonDictInterface.h"
+ #include "../../common/settings.h"
+ #include "../../common/translation.h"
+ #include "../../common/History.h"
+ #include "../../common/Notify.h"
+ #include "ConfigGenerator.h"
+ #include "Bookmarks.h"
+ /*! Inner part of dictionary - glues together GUI and plugins, also kind of
+     GoF facade (for GUI) cover few classes \see Bookmarks \see History
+   Backbone is responsible for managing plugins and dictionaries, starting
+   new searches and threads, merging search results from multiple dictionaries.
+   Each plugin may live in multiple instances - each with its own dictionary,
+   backbone must provide way to create them at start (with specific Settings) and
+   distinguish each ditionary.
 -  Backbone also manages bookmarks and history: providing interface to gui.
++  Backbone also manages bookmarks and history: providing interface to GUI.
+   Backbone is also responsible for saving and spawning session via configs
+   file (stored in ~/.mdictionary) -> configs are kind of tricky because
+   mDictionary is delivered with two simple dicts -> it's necessary to separate default
+   configs from user configs (updating/reinstalling app results in overwritten
+   default config file), moreover config file there is general mdictionary
+   configuration (apart from dictionaries and plugin ones).
+   Other modules may set some internal backbone behaviour via \see setSettings():
 -  Settings object with option given:
++  Settings object with options given:
+      * history_size - int, size of stored searches
+      * search_limit - int, how many different words each dictionary may return
+      * search_dictionaries - true/false, whether search in dictionaries
+      * search_bookmarks - true/false, whether search in bookmarks
+     Searching schema:
 -        First GUI should ask for list of words matching given pattern
++        At first GUI should ask for list of words matching given pattern,
+         then each Translation object is capable of finding its own final translation
+       List of words:
 -        - Gui calls search(...)
++        - GUI calls search(...)
+         - Backbone calls plugins searchWordList(...) in idealThreadCount()+1 threads
 -        - Backbone sets  the FutureWatcher to be notifed when plugins are done
 -        - Backbone fetches results from Future<..> and formats it for gui then
++        - Backbone sets the FutureWatcher to be notified when plugins are done
++        - Backbone fetches results from Future<..> and formats it for GUI, then
+            emits ready()
 -        - Gui calls result()
++        - GUI calls result()
+       Final translation:
 -         - Gui calls searchHtml()
 -         - Backbone starts for each translation object toHtml in separate threads
++         - GUI calls searchHtml()
++         - Backbone starts toHtml for each translation object in separate threads
+          - Backbone sets FutureWatcher to be notified after last toHtml returns
+          - Backbone fetches translation from Future<...> objects and calls
+              htmlReady()
+          - Gui calls htmlResult()
+ */
+ class Backbone : public QObject
+ {
+     Q_OBJECT
+ public:
+     /*!\param pluginPath path to plugins (leave blank for default)
+       \param configPath path to folder with configuration files
+       \param dry dry run is mode without paying attention to configuration etc
+           mainly for testing
+       */
+     Backbone(QString pluginPath="", QString configPath="",
+              bool dry = 0, QObject *parent = 0);
+     ~Backbone();
+     Backbone(const Backbone& b);
+     //! \return all loaded dictionaries with activity state flag
+     QHash<CommonDictInterface*, bool> getDictionaries();
+     //! \return all loaded plugins
+     QList<CommonDictInterface*> getPlugins();
+     //! \return history of performed searches
+     History* history();
+     //! \return return search fesult
+     QMultiHash<QString, Translation*> result();
+     //! \return maximum number of words that plugin could find
+     int searchLimit() const;
+     //! \return final translation (after searching for html)
+     QStringList htmls();
+     /*! maximum number of translations that each plugin may return; it must be
+         public static because of QtConcurent::mapped restrictions about
+         what kind of function may be used there see Qt docs */
+     static int _searchLimit;
+ public Q_SLOTS:
+     //! stops all current searches and emits searchCanceled signal
+     void stopSearching();
+     /*! searches for a word translation
+        \param word to be translated
+       */
+     void search(QString word);
+     /*! sets active dictionaries (searches are performed only in active dicts
+        \param List of dictionaries to be activated
+       */
+     void selectedDictionaries(QList<CommonDictInterface* >);
+     /*! adds new dictionary and activates it
+       \param dict dictionary to be added
+       \param active decides whether searches are perfomed in given dictionaries
+       */
+     void addDictionary(CommonDictInterface* dict, bool active = 1);
+     //! stops all current activity - emitting signal \see closeOk
+     void quit();
+     /*! Fired by FutureWatcher when list of words is ready (after calling search)
+         fetch Future<...> to final result
+       */
+     void translationReady();
+     /*! Fired by FutureWatcher when search result is ready, fetch Future to
+         final result
+       */
+     void htmlTranslationReady();
+     /*! Removes given dictionary
+         \param dict dictionary to be deleted
+       */
+     void removeDictionary(CommonDictInterface* dict);
+     /*! Saves plugins new state/configuration after each change */
+     void dictUpdated();
+     /*! Performs search for final translation (html/xml) form
+       \param list of Translation* to be searched for
+       */
+     void searchHtml(QList<Translation*>);
+     /*! adds bookmarks to given translations (translation object is fetched and
+       added to bookmarks data base (key and translation stored in db))
+       \param translation translation object to be stored in db
+       */
+     void addBookmark(QList<Translation*> translations) {
+         foreach(Translation* translation, translations)
+             //_bookmarks.add(translation);
+             QtConcurrent::run(_bookmarks, &Bookmarks::add, translation);
+     }
+     /*! Removes bookmarks to given translations
+       \param translation remove bookmark to this translation
+       */
+     void removeBookmark(QList<Translation*> translations) {
+         foreach(Translation* translation, translations)
+             _bookmarks.remove(translation);
+     }
+     /*! Removes all bookmarks
+       */
+     void removeAllBookmarks(){
+         _bookmarks.clear();
+     }
+    /*! Searching for list of bookmarks may take some time, so I moved it to
 -       new thread (to avoid gui blocking), further it's consistent with ordinary
++       new thread (to avoid GUI blocking), further it's consistent with ordinary
+        searching for list of words (\see search)
+        */
+    void fetchBookmarks() {
+         _result.clear();
+         stopped = false;
+         dictFin = 1;
+         bookmarkFin = 0;
+         _innerBookmarks = QtConcurrent::run(_bookmarks,
+                 &Bookmarks::list);
+         _bookmarkSearchWatcher.setFuture(_innerBookmarks);
+    }
+    /*! Sets settings for backbone: history_size, search_limit,
+        searching backends (search_bookmarks, search_dictionaries)
+        \param settings settings object with options set
+        */
+     void setSettings(Settings* settings);
+     /*! \return corresponding settings object with history_size, search_limit,
+        searching backends (search_bookmarks, search_dictionaries)
+        */
+     Settings* settings();
+ Q_SIGNALS:
+     /*! emitted when backbone is ready to close - after getting stop signal it
+         should kill all threads and so on */
+     void closeOk();
+     //! emitted when there are search results ready to fetch
+     void ready();
+     //! emitted when html result is ready to fetch
+     void htmlReady();
+     //! thrown when searches are stopped
+     void searchCanceled();
+     //! emitted when bookmark list is ready to fetch
+     void bookmarksReady();
+     /*! emitted by direct connection to plugins notifying signals
 -        \param Notify::NotifyType gui may decide to show different types in
++        \param Notify::NotifyType GUI may decide to show different types in
+             different ways
+         \param QString text of the notification
+     */
+     void notify(Notify::NotifyType, QString);
+ private Q_SLOTS:
+     void bookmarksListReady();
+ private:
+     QHash<CommonDictInterface*, bool> _dicts; // List of dictionaries
+     QList<CommonDictInterface*> _plugins;  // List of plugins
+     QFuture<QList<Translation*> > _innerResult; //Res of concurrent word search
+     QFuture<QString> _innerHtmlResult;  // Result of html search
+     QFuture<QList<Translation*> > _innerBookmarks; //Res of search in bookmarks
+     QFuture<QList<Translation*> > _innerListBookmarks; //Res of search in bookmarks
+     QFuture<QStringList> _innerHtmlBookmarks; //Html result of bookmarks search
+     QMultiHash<QString, Translation*> _result; //Final result of word search
+     QStringList _htmlResult; // Final result of html search
+     QList<Translation*> _bookmarksResult; // Final result of search in bookmarks
+     // Keeps track of concurent computations
+     QFutureWatcher<QList<Translation*> > _resultWatcher;
+     QFutureWatcher<QList<Translation*> > _bookmarkWatcher;
+     QFutureWatcher<QList<Translation*> > _bookmarkSearchWatcher;
+     QFutureWatcher<QString> _htmlResultWatcher;
+     QString _pluginPath;
+     QString _configPath;
+     QString _dir;
+     int _historyLen;
+     qreal _zoom;
+     bool dryRun; // mainly for testing - when true then doesn't bother configs etc
+     bool stopped; // true when user stops searching/fetching
 -    bool bookmarkFin, dictFin; // inform whether given search type is ready
++    bool bookmarkFin, dictFin; // informs whether given search type is ready
+     bool _searchDicts, _searchBookmarks; // whether search performed in given source
+     Bookmarks _bookmarks;
+     void init();
+     QStringList getFilesFromDir(QString dir, QStringList nameFilter);
+     void loadPlugins(); //< locate and load plugins
+     void loadPrefs(QString fileName);
+     void loadDicts(QString fileName);
+     void saveState(QSettings*, Settings*, bool, uint);
+     void addInternalDictionary(CommonDictInterface*, bool);
+     void savePrefs(QSettings*);
 -    CommonDictInterface* plugin(QString type); // search for given type plugin
++    CommonDictInterface* plugin(QString type); // searches for plugin of given type
+     QList<CommonDictInterface*> activeDicts();
+     bool containsDict(uint hash) const;
+     int _dictNum;
+     History* _history;
+     friend class BackboneTest;
+ };
+ #endif // BACKBONE_H
index 0000000,4794eb1..292e47c
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,237 +1,238 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ //! \file DictManagerWidget.cpp
++//! \brief Dictionaries management widget
+ //! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ #include "DictManagerWidget.h"
+ #include "DictTypeSelectDialog.h"
+ #include <QDebug>
+ #include "../../common/DictDialog.h"
+ DictManagerWidget::DictManagerWidget(GUIInterface *parent) :
+     QDialog(parent) {
+     setWindowTitle(tr("Dictionaries"));
+     this->guiInterface = parent;
+     initalizeUI();
+ }
+ void DictManagerWidget::initalizeUI() {
+     verticalLayout = new QVBoxLayout;
+     setLayout(verticalLayout);
+     dictListWidget = new QListWidget;
+     verticalLayout->addWidget(dictListWidget);
+     dictListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
+     dictListWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+     addNewDictButton = new QPushButton(tr("Add"));
+     removeDictButton = new QPushButton(tr("Remove"));
+     settingsButton = new QPushButton(tr("Settings"));
+     removeDictButton->setEnabled(false);
+     settingsButton->setEnabled(false);
+     buttonGroup = new QHBoxLayout;
+     buttonGroup->addWidget(addNewDictButton);
+     buttonGroup->addWidget(removeDictButton);
+     buttonGroup->addWidget(settingsButton);
+     verticalLayout->addLayout(buttonGroup, Qt::AlignBottom);
+     connect(addNewDictButton, SIGNAL(clicked()),
+             this, SLOT(saveChanges()));
+     connect(addNewDictButton, SIGNAL(clicked()),
+             this, SLOT(addNewDictButtonClicked()));
+     connect(removeDictButton, SIGNAL(clicked()),
+             this, SLOT(saveChanges()));
+     connect(removeDictButton, SIGNAL(clicked()),
+             this, SLOT(removeButtonClicked()));
+     connect(settingsButton, SIGNAL(clicked()),
+             this, SLOT(saveChanges()));
+     connect(settingsButton, SIGNAL(clicked()),
+             this, SLOT(settingsButtonClicked()));
+     connect(dictListWidget, SIGNAL(itemClicked(QListWidgetItem*)),
+             this, SLOT(itemSelected(QListWidgetItem*)));
+     connect(dictListWidget, SIGNAL(itemChanged(QListWidgetItem*)),
+             this, SLOT(changed()));
+     refreshDictsList();
+     #ifndef Q_WS_MAEMO_5
+         setMinimumSize(500,300);
+         closeButton = new QPushButton(tr("Save"));
+         buttonGroup->addWidget(closeButton);
+         connect(closeButton, SIGNAL(clicked()), this, SLOT(save()));
+     #endif
+ }
+ void DictManagerWidget::refreshDictsList() {
+     dictListWidget->clear();
+     dictsHash.clear();
+     removeDictButton->setEnabled(false);
+     settingsButton->setEnabled(false);
+     QHash<CommonDictInterface*, bool> dicts = guiInterface->getDictionaries();
+     QHashIterator<CommonDictInterface*, bool> i(dicts);
+     while(i.hasNext()) {
+         i.next();
+         QListWidgetItem* item = new QListWidgetItem();
+         QString name = i.key()->langFrom() + " - " + i.key()->langTo() + " (" +
+                        i.key()->type() + " " + i.key()->name() + ")";
+         item->setText(name);
+         item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
+         if(i.value()) {
+             item->setCheckState(Qt::Checked);
+         }
+         else {
+             item->setCheckState(Qt::Unchecked);
+         }
+         item->setIcon(*i.key()->icon());
+         dictListWidget->addItem(item);
+         dictsHash.insert(item, i.key());
+     }
+ }
+ void DictManagerWidget::showEvent(QShowEvent *e) {
+     _changed = false;
+     #ifndef Q_WS_MAEMO_5
+       _save = false;
+     #endif
+     refreshDictsList();
+     QWidget::showEvent(e);
+ }
+ void DictManagerWidget::saveChanges() {
+     #ifndef Q_WS_MAEMO_5
+         if(_save) {
+     #else
+         if(_changed &&
+                 QMessageBox::question(this, tr("Save"),
+                                       tr("Do you want to save changes?"),
+                 QMessageBox::Save, QMessageBox::Cancel) == QMessageBox::Save) {
+     #endif
+         QList<CommonDictInterface*> checkedDicts;
+         for(int i=0; i<dictListWidget->count(); i++) {
+             QListWidgetItem* item = dictListWidget->item(i);
+             if(item->checkState() == Qt::Checked) {
+                 checkedDicts.push_back(dictsHash[item]);
+             }
+         }
+         _changed = false;
+         emit selectedDictionaries(checkedDicts);
+     }
+ }
+ void DictManagerWidget::hideEvent(QHideEvent *e) {
+     saveChanges();
+     QWidget::hideEvent(e);
+ }
+ void DictManagerWidget::addNewDictButtonClicked() {
+     #ifndef Q_WS_MAEMO_5
+     if(!_changed || QMessageBox::question(this,
 -            "Save", "Do you want to save changes?",
++            tr("Save"), tr("Do you want to save changes?"),
+             QMessageBox::Save, QMessageBox::Cancel) == QMessageBox::Save) {
+         _save = true;
+         saveChanges();
+         _save = false;
+     }
+     #endif
+    CommonDictInterface* selectedPlugin =
+            DictTypeSelectDialog::addNewDict(guiInterface->getPlugins(),this);
+    if(selectedPlugin != NULL) {
+        Settings* settings =
+                selectedPlugin->dictDialog()->addNewDictionary(this);
+        if(settings != NULL) {
+            CommonDictInterface* newDict = selectedPlugin->getNew(settings);
+            delete settings;
+            Q_EMIT addDictionary(newDict);
+        }
+    }
+    refreshDictsList();
+ }
+ void DictManagerWidget::itemSelected(QListWidgetItem *) {
+     removeDictButton->setEnabled(true);
+     settingsButton->setEnabled(true);
+ }
+ void DictManagerWidget::removeButtonClicked() {
+     if(QMessageBox::question(this, tr("Remove dictionary"),
+             tr("Do you want to remove selected dictionary?"),
+             QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
+         QList<QListWidgetItem*> selected = dictListWidget->selectedItems();
+         if(selected.count() > 0) {
+             emit removeDictionary(dictsHash[selected[0]]);
+             refreshDictsList();
+         }
+    }
+ }
+ void DictManagerWidget::settingsButtonClicked() {
+     #ifndef Q_WS_MAEMO_5
+     if(!_changed || QMessageBox::question(this,
 -            "Save", "Do you want to save changes?",
++            tr("Save"), tr("Do you want to save changes?"),
+             QMessageBox::Save, QMessageBox::Cancel) == QMessageBox::Save) {
+         _save = true;
+         saveChanges();
+         _save = false;
+     }
+     #endif
+    QList<QListWidgetItem*> selected = dictListWidget->selectedItems();
+    if(selected.count() > 0) {
+        dictsHash[selected[0]]->dictDialog()->changeSettings(this);
+    }
+    refreshDictsList();
+ }
+ void DictManagerWidget::changed() {
+     _changed=true;
+ }
+ #ifndef Q_WS_MAEMO_5
+     void DictManagerWidget::save() {
+         _save = true;
+         hide();
+     }
+ #endif
index 0000000,990d654..324be83
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,131 +1,127 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ //! \file DictManagerWidget.h
+ //! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ #ifndef DICTMANAGERWIDGET_H
+ #define DICTMANAGERWIDGET_H
+ #include <QWidget>
+ #include <QtGui>
+ #include "../../common/GUIInterface.h"
+ //! Implements dictionaries management widget
+ /*!
+   Shows list of loaded dictionaries and their states (active/inactive).
+   It allows to change dicts states, add new dict, remove selected one or
+   change settings of selected dict. All changes are saved automatically after
+   hiding of this widget.
+ */
+ class DictManagerWidget : public QDialog {
+     Q_OBJECT
+ public:
+     //! Constructor
+     /*!
+       \param parent parent of this widget, which must be subclass of
+       GUIInterface, because it will use it to get info about loaded plugins
+       and dicts.
+     */
+     explicit DictManagerWidget(GUIInterface *parent = 0);
+ protected:
+     void showEvent(QShowEvent *e);
+     void hideEvent(QHideEvent *e);
+ Q_SIGNALS:
+     //! Emitted when hiding widget, it will save states of dictionaries
+     /*!
+         \param list of only active dictionaries
+     */
+     void selectedDictionaries(QList<CommonDictInterface*>);
+     //! Emitted when user wants to add new dictionary
+     /*!
+         \param new dictionary returned by specific plugin dialog
+     */
+     void addDictionary(CommonDictInterface*);
+     //! Emitted when user wants to remove dictionary
+     /*!
+         \param dictionary which will be removed
+     */
+     void removeDictionary(CommonDictInterface*);
+ public Q_SLOTS:
+     #ifndef Q_WS_MAEMO_5
+         void save();
+     #endif
+ private Q_SLOTS:
 -    /*!
 -        Shows plugin select dialog and then specific plugin add new dictionary
 -        dialog, which will return new CommonDictInterface* object, which is
 -        later passed as parameter of addDictionary signal
 -    */
++    /*! Shows "plugin select" dialog and then plugin specific "add new dictionary
++        dialog", which will return new CommonDictInterface* object, which is
++        later passed as parameter of addDictionary signal*/
+     void addNewDictButtonClicked();
 -    /*!
 -        Passes selected dictionary from list as parameter of removeDictionary
 -        signal
 -    */
++    /*! Passes dictionary selected from list as parameter of removeDictionary
++        signal */
+     void removeButtonClicked();
+     //! user select one of items
+     void itemSelected(QListWidgetItem*);
+     //! Shows plugin's settings dialog
+     void settingsButtonClicked();
+     //! Each change of state (that needs to be saved) should call this to
+     //! indicate state change
+     void changed();
+     //! saves changes
+     void saveChanges();
+ private:
+     void initalizeUI();
+     QPushButton* addNewDictButton;
+     QPushButton* removeDictButton;
+     QPushButton* settingsButton;
+     QVBoxLayout* verticalLayout;
+     QHBoxLayout* buttonGroup;
+     QListWidget* dictListWidget;
+     //holds association between items on list and CommonDictInterface objects
+     QHash<QListWidgetItem*, CommonDictInterface*> dictsHash;
+     GUIInterface* guiInterface;
+     bool _changed;
+     void refreshDictsList();
+     #ifndef Q_WS_MAEMO_5
+         QPushButton* closeButton;
+         bool _save;
+     #endif
+ };
+ #endif // DICTMANAGERWIDGET_H
index 0000000,d07553a..6039f08
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,571 +1,571 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ //! \file MainWindow.cpp
+ //! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ #include "MainWindow.h"
+ #include <QtGui>
+ #ifdef Q_WS_MAEMO_5
+     #include <QMaemo5InformationBox>
+ #endif
+ MainWindow::MainWindow(Backbone *backbone, QWidget *parent):
+     GUIInterface(parent) {
+     this->backbone = backbone;
+     initializeUI();
+     connectBackbone();
+     connectSearchBar();
+     connectWordList();
+     connectTranslationWidget();
+     connectDictManager();
+     connectMenu();
+     connectBookmarksWidget();
+     setExactSearch(false);
+     showMaximized();
+ }
+ MainWindow::~MainWindow() {
+ }
+ void MainWindow::initializeUI() {
+     #ifdef Q_WS_MAEMO_5
+         setAttribute(Qt::WA_Maemo5StackedWindow);
+     #endif
+     setWindowIcon(QIcon(":/icons/64x64/mdictionary.png"));
+     setWindowTitle("mDictionary");
+     /*translationWidget is another stacked window, so we don't add it to
 -      layout only create it with this widget as parent
++      layout, only create it with this widget as parent
+       it must be created as first object in main window, otherwise sometimes
 -      when app starts in maemo, when trying to set stacked window attribure
++      when app starts in maemo, when trying to set stacked window attribute
+       it segfaults*/
+     translationWidget = new TranslationWidget(this);
+     mainLayout = new QVBoxLayout();
+     QWidget* w = new QWidget();
+     w->setLayout(mainLayout);
+     setCentralWidget(w);
+     menuBar = new QMenuBar();
+     setMenuBar(menuBar);
+     initializeSearchWidgets();
+     initializeMenu();
+     notifyManager = new NotifyManager(this);
+ }
+ void MainWindow::initializeSearchWidgets() {
+     searchBarWidget = new SearchBarWidget();
+     wordListWidget = new WordListWidget();
+     welcomeScreenWidget = new WelcomeScreenWidget();
+     #ifdef Q_WS_MAEMO_5
+         //At start we set widget as welcome screen widget
+         mainLayout->addWidget(welcomeScreenWidget);
+         mainLayout->addWidget(searchBarWidget, 0, Qt::AlignBottom);
+     #else
+         translationWidget->hide();
 -        //we add to splitter word list and welcome screen
++        //we add word list and welcome screen to splitter
+         splitter = new QSplitter(Qt::Horizontal);
+         splitter->addWidget(wordListWidget);
+         splitter->addWidget(welcomeScreenWidget);
+         splitter->setStretchFactor(1, 150);
+         mainLayout->addWidget(splitter);
+         mainLayout->addWidget(searchBarWidget);
+     #endif
+ }
+ void MainWindow::initializeMenu() {
+     initializeMenuWidgets();
+ #ifdef Q_WS_MAEMO_5
+     menuWidget = new MenuWidget(this);
+     menuWidget->addSubMenu(tr("Settings"), settingsWidget);
+     menuWidget->addSubMenu(tr("Dictionaries"), dictManagerWidget);
+     menuWidget->addSubMenu(tr("Bookmarks"), bookmarksWidget);
+     menuWidget->addSubMenu(tr("About"), aboutWidget);
+     menuBar->addAction(menuWidget);
+ #else
+     dictionariesAction = menuBar->addAction(tr("Dictionaries"));
+     connect(dictionariesAction, SIGNAL(triggered()),
+             dictManagerWidget, SLOT(show()));
+     settingsAction = menuBar->addAction(tr("Settings"));
+     connect(settingsAction, SIGNAL(triggered()),
+             settingsWidget, SLOT(show()));
+     QMenu* m = menuBar->addMenu(tr("Bookmarks"));
+     bookmarksShowAllAction = new QAction(tr("Show all"), m);
+     bookmarksRemoveAllAction = new QAction(tr("Remove all"), m);
+     m->addAction(bookmarksShowAllAction);
+     m->addAction(bookmarksRemoveAllAction);
+     aboutAction = menuBar->addAction(tr("About"));
+     connect(aboutAction, SIGNAL(triggered()),
+             aboutWidget, SLOT(show()));
+ #endif
+ }
+ void MainWindow::initializeMenuWidgets() {
+     dictManagerWidget = new DictManagerWidget(this);
+     dictManagerWidget->hide();
+     settingsWidget = new SettingsWidget(this);
+     settingsWidget->hide();
+     bookmarksWidget = new BookmarksWidget(this);
+     bookmarksWidget->hide();
+     aboutWidget = new AboutWidget(this);
+     aboutWidget->hide();
+ }
+ void MainWindow::closeEvent(QCloseEvent *event) {
+     //request to stop all searches and close app
+     Q_EMIT quit();
+     event->accept();
+ }
+ bool MainWindow::isInExactSearch() {
+     return _exactSearch;
+ }
+ void MainWindow::setExactSearch(bool exact) {
+     _exactSearch = exact;
+ }
+ void MainWindow::setExactSearchString(QString word) {
+     searchString = word;
+ }
+ void MainWindow::wordListReady() {
+     //gets results from backbone
+     QMultiHash<QString, Translation*> backboneResult = backbone->result();
+     QHash<QString, QList<Translation*> > searchResult;
+     #ifdef Q_WS_MAEMO_5
+         hideWelcomeScreen();
+     #endif
+     //if nothing was found
+     if(backboneResult.count() == 0) {
+         showNotification(Notify::Info, tr("Can't find any matching words"));
+         //show empty list to remove results of old search
+         Q_EMIT showWordList(searchResult);
+     }
+     else {
+         //find translations of the same key word
+         QMultiHash<QString, Translation*>::iterator i;
+         for(i = backboneResult.begin(); i != backboneResult.end(); i++) {
+             searchResult[i.key()].push_back(i.value());
+         }
+         //show search results
+         Q_EMIT showWordList(searchResult);
+         if(isInExactSearch()) {
+             QList<Translation*> exactTranslation;
+             if(checkExactSearch(searchResult, exactTranslation)) {
+                 Q_EMIT searchTranslations(exactTranslation);
+             }
+             else {
+                 showNotification(Notify::Info,
+                            tr("Can't find exactly matching word"));
+             }
+             setExactSearch(false);
+         }
+     }
+ }
+ bool MainWindow::checkExactSearch(
+         QHash<QString, QList<Translation *> > searchResult,
+         QList<Translation *> &found) {
+     bool foundExactMatch = false;
+     QHash<QString, QList<Translation*> >::iterator j;
+     for(j = searchResult.begin(); j != searchResult.end(); j++) {
+         if(j.key().toLower() == searchString.toLower()
+             && !foundExactMatch) {
+             found = j.value();
+             return true;
+         }
+     }
+     return false;
+ }
+ void MainWindow::translationsReady() {
+     #ifndef Q_WS_MAEMO_5
+         hideWelcomeScreen();
+     #endif
+     Q_EMIT showTranslation(backbone->htmls());
+     notifyManager->screenChanged();
+ }
+ void MainWindow::hideWelcomeScreen() {
+ #ifdef Q_WS_MAEMO_5
+     //switch welcome screen with word list
+     if(!wordListWidget->isVisible()) {
+         mainLayout->removeWidget(welcomeScreenWidget);
+         welcomeScreenWidget->deleteLater();
+         mainLayout->insertWidget(0, wordListWidget);
+     }
+ #else
+     //switch welcome screen with translation widget
+     if(!translationWidget->isVisible()) {
+         splitter->insertWidget(1,translationWidget);
+         splitter->setStretchFactor(1, 150);
+         welcomeScreenWidget->deleteLater();
+     }
+ #endif
+ }
+ QList<CommonDictInterface*> MainWindow::getPlugins() {
+     return backbone->getPlugins();
+ }
+ QHash<CommonDictInterface*, bool> MainWindow::getDictionaries() {
+     return backbone->getDictionaries();
+ }
+ void MainWindow::search(QString word) {
+     setExactSearch(false);
+     searchBarWidget->search(word);
+ }
+ void MainWindow::searchExact(QString word) {
+     setExactSearch(true);
+     searchBarWidget->search(word);
+ }
+ void MainWindow::searchDelay(QString word) {
+     searchBarWidget->searchDelay(word);
+ }
+ void MainWindow::searchingInterrupted() {
+     //make sure to unset exact search mode
+     setExactSearch(false);
+ }
+ void MainWindow::addToHistory(QList<Translation *> trans) {
+     if(trans.count() > 0) {
+         backbone->history()->add(trans[0]->key());
+     }
+ }
+ void MainWindow::historyNext() {
+     if(backbone->history()->nextAvailable()) {
+         QString next = backbone->history()->next();
+         #ifndef Q_WS_MAEMO_5
+             setExactSearch(true);
+         #endif
+         searchDelay(next);
+     }
+ }
+ void MainWindow::historyPrev() {
+     if(backbone->history()->prevAvailable()) {
+         #ifndef Q_WS_MAEMO_5
+             setExactSearch(true);
+         #endif
+         QString prev = backbone->history()->previous();
+         searchDelay(prev);
+     }
+ }
+ void MainWindow::disableMenu() {
+     #ifdef Q_WS_MAEMO_5
+         if(menuBar->actions().contains(menuWidget)) {
+               menuBar->removeAction(menuWidget);
+         }
+     #else
+         menuBar->setEnabled(false);
+     #endif
+ }
+ void MainWindow::enableMenu() {
+     #ifdef Q_WS_MAEMO_5
+         if(!menuBar->actions().contains(menuWidget)) {
+             menuBar->addAction(menuWidget);
+         }
+     #else
+         menuBar->setEnabled(true);
+     #endif
+ }
+ void MainWindow::showHistory(QPoint p) {
+     HistoryListDialog historyDialog(backbone->history()->list(), searchBarWidget);
+     #ifndef Q_WS_MAEMO_5
+         QPoint newPos = mapFromGlobal(p);
+         newPos.setY(searchBarWidget->pos().y() -
+                     historyDialog.sizeHint().height());
+         newPos.setX(width() - historyDialog.sizeHint().width());
+         historyDialog.move(newPos);
+     #endif
+     if(historyDialog.exec() == QDialog::Accepted) {
+         backbone->history()->setCurrentElement(historyDialog.selectedRow());
+         searchExact(historyDialog.selectedWord());
+     }
+ }
+ void MainWindow::setSettings(Settings *s) {
+     backbone->setSettings(s);
+ }
+ Settings* MainWindow::settings() {
+     return backbone->settings();
+ }
+ void MainWindow::showNotification(Notify::NotifyType type, QString text) {
+     notifyManager->showNotification(type, text);
+ }
+ void MainWindow::connectBackbone() {
+     connect(this, SIGNAL(searchWordList(QString)),
+             this, SIGNAL(setBusy()));
+     connect(this, SIGNAL(searchTranslations(QList<Translation*>)),
+             this, SIGNAL(setBusy()));
+     connect(this, SIGNAL(stopSearching()),
+             this, SIGNAL(setIdle()));
+     connect(this, SIGNAL(searchWordList(QString)),
+             this, SLOT(setExactSearchString(QString)));
+     connect(this, SIGNAL(searchTranslations(QList<Translation*>)),
+             this, SLOT(addToHistory(QList<Translation*>)));
+     connect(this, SIGNAL(quit()),
+             backbone, SLOT(quit()));
+     connect(this, SIGNAL(searchWordList(QString)),
+             backbone, SLOT(search(QString)));
+     connect(this, SIGNAL(searchTranslations(QList<Translation*>)),
+             backbone, SLOT(searchHtml(QList<Translation*>)));
+     connect(this, SIGNAL(stopSearching()),
+             backbone, SLOT(stopSearching()));
+     connect(this, SIGNAL(stopSearching()),
+             this, SLOT(searchingInterrupted()));
+     connect(this, SIGNAL(addNewDictionary(CommonDictInterface*)),
+             backbone, SLOT(addDictionary(CommonDictInterface*)));
+     connect(this, SIGNAL(removeDictionary(CommonDictInterface*)),
+             backbone, SLOT(removeDictionary(CommonDictInterface*)));
+     connect(this, SIGNAL(selectedDictionaries(QList<CommonDictInterface*>)),
+             backbone, SLOT(selectedDictionaries(QList<CommonDictInterface*>)));
+     connect(backbone, SIGNAL(ready()),
+             this, SIGNAL(setIdle()));
+     connect(backbone, SIGNAL(htmlReady()),
+             this, SIGNAL(setIdle()));
+     connect(backbone, SIGNAL(ready()),
+             this, SLOT(wordListReady()));
+     connect(backbone, SIGNAL(htmlReady()),
+             this, SLOT(translationsReady()));
+     connect(backbone, SIGNAL(searchCanceled()),
+             this, SIGNAL(setIdle()));
+     connect(backbone, SIGNAL(notify(Notify::NotifyType,QString)),
+             this, SLOT(showNotification(Notify::NotifyType,QString)));
+ }
+ void MainWindow::connectSearchBar() {
+     connect(searchBarWidget, SIGNAL(searchForTranslations(QString)),
+             this, SIGNAL(searchWordList(QString)));
+     connect(searchBarWidget, SIGNAL(stopSearching()),
+             this, SIGNAL(stopSearching()));
+     connect(this, SIGNAL(setBusy()),
+             searchBarWidget, SLOT(setBusy()));
+     connect(this, SIGNAL(setIdle()),
+             searchBarWidget, SLOT(setIdle()));
+     connect(searchBarWidget, SIGNAL(historyNext()),
+             this, SLOT(historyNext()));
+     connect(searchBarWidget, SIGNAL(historyPrev()),
+             this, SLOT(historyPrev()));
+     connect(searchBarWidget, SIGNAL(historyShow(QPoint)),
+             this, SLOT(showHistory(QPoint)));
+     connect(searchBarWidget, SIGNAL(refreshHistoryButtons()),
+             backbone->history(), SLOT(refreshStatus()));
+     connect(backbone->history(), SIGNAL(historyChanged(bool,bool,bool)),
+             searchBarWidget, SLOT(updateHistoryButtons(bool,bool,bool)));
+ }
+ void MainWindow::connectWordList() {
+     connect(this,
+             SIGNAL(showWordList(QHash<QString, QList<Translation*> >)),
+             wordListWidget,
+             SLOT(showSearchResults(QHash<QString,QList<Translation*> >)));
+     connect(wordListWidget, SIGNAL(showTranslation(QList<Translation*>)),
+             this, SIGNAL(searchTranslations(QList<Translation*>)));
+     connect(this, SIGNAL(setBusy()),
+             wordListWidget, SLOT(lockList()));
+     connect(this, SIGNAL(setIdle()),
+             wordListWidget, SLOT(unlockList()));
+     connect(wordListWidget, SIGNAL(addBookmark(QList<Translation*>)),
+             backbone, SLOT(addBookmark(QList<Translation*>)));
+     connect(wordListWidget, SIGNAL(removeBookmark(QList<Translation*>)),
+             backbone, SLOT(removeBookmark(QList<Translation*>)));
+ }
+ void MainWindow::connectTranslationWidget() {
+     connect(this, SIGNAL(showTranslation(QStringList)),
+             translationWidget, SLOT(show(QStringList)));
+      #ifdef Q_WS_MAEMO_5
+         connect(translationWidget, SIGNAL(search(QString)),
+                 this, SLOT(search(QString)));
+     #else
+         connect(translationWidget, SIGNAL(search(QString)),
+                 this, SLOT(searchExact(QString)));
+     #endif
+ }
+ void MainWindow::connectDictManager() {
+     connect(dictManagerWidget, SIGNAL(addDictionary(CommonDictInterface*)),
+             this, SIGNAL(addNewDictionary(CommonDictInterface*)));
+     connect(dictManagerWidget, SIGNAL(removeDictionary(CommonDictInterface*)),
+             this, SIGNAL(removeDictionary(CommonDictInterface*)));
+     connect(dictManagerWidget,
+             SIGNAL(selectedDictionaries(QList<CommonDictInterface*>)),
+             this, SIGNAL(selectedDictionaries(QList<CommonDictInterface*>)));
+ }
+ void MainWindow::connectMenu() {
+     connect(this, SIGNAL(setBusy()),
+             this, SLOT(disableMenu()));
+     connect(this, SIGNAL(setIdle()),
+             this, SLOT(enableMenu()));
+ }
+ void MainWindow::connectBookmarksWidget() {
+     #ifdef Q_WS_MAEMO_5
 -        //after removing bookmarks we search for it once again to clear word list
++        //after removing bookmarks we search for them once again to clear word list
+         connect(bookmarksWidget, SIGNAL(removeAllBookmarks()),
+                 this, SLOT(removeBookmarks()));
+         connect(bookmarksWidget, SIGNAL(showAllBookmarks()),
+                 menuWidget, SLOT(hideMenu()));
+         connect(bookmarksWidget, SIGNAL(showAllBookmarks()),
+                 backbone, SLOT(fetchBookmarks()));
+     #else
+         connect(bookmarksRemoveAllAction, SIGNAL(triggered()),
+                 this, SLOT(removeBookmarks()));
+         connect(bookmarksShowAllAction, SIGNAL(triggered()),
+                 backbone, SLOT(fetchBookmarks()));
+     #endif
+ }
+ void MainWindow::removeBookmarks() {
+     QWidget* par;
+     #ifdef Q_WS_MAEMO_5
+         par = bookmarksWidget;
+     #else
+         par = this;
+     #endif
+     if(QMessageBox::question(par, tr("Delete all bookmarks"),
+              tr("Do you want to delete all bookmarks? (This action cannot be revoked)"),
+              QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok) {
+         backbone->removeAllBookmarks();
+         if(searchString.size())
+             backbone->search(searchString);
+     }
+ }
index 0000000,7053195..9e9a988
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,295 +1,295 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ //! \file MainWindow.h
+ //! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ #ifndef MAINWINDOW_H
+ #define MAINWINDOW_H
+ #include <QMainWindow>
+ #include "../../common/GUIInterface.h"
+ #include "../../common/settings.h"
+ #include "../backbone/backbone.h"
+ #include "TranslationWidget.h"
+ #include "WordListWidget.h"
+ #include "SearchBarWidget.h"
+ #include "MenuWidget.h"
+ #include "DictManagerWidget.h"
+ #include "SettingsWidget.h"
+ #include "HistoryListDialog.h"
+ #include "BookmarksWidget.h"
+ #include "WelcomeScreenWidget.h"
+ #include "AboutWidget.h"
+ #include "NotifyManager.h"
+ //! Implements interface for GUI
+ /*!
+   Creates all of GUI subcomponents, and connects all GUI interface signals
+   with suitable backbone signals and slots.
+   Only this class has direct access to backbone object.
+   It manages all requests of subcomponents e. g. searching of given word,
+   displaying history, removing dictionary.
 -  It also provide data from backbone to subcomponents e. g. result of search.
++  It also provides data from backbone to subcomponents e. g. result of search.
+ */
+ class MainWindow : public GUIInterface
+ {
+     Q_OBJECT
+ public:
+     //! Constructor
+     /*!
+       \param backbone object which will be doing all searches and returning data
+       \param parent parent widget of this window
+     */
+     MainWindow(Backbone* backbone, QWidget *parent = 0);
+     ~MainWindow();
+     //! Returns all loaded dictionaries with infromation about that they are
+     //! active/inactive
+     /*!
+         \return Hash of pointers to dictionary and boolean flag indicating if
+         dictionary is active
+     */
+     QHash<CommonDictInterface*, bool> getDictionaries();
+     //! Returns all loaded plugins
+     /*!
+         \return List of pointers to plugins
+     */
+     QList<CommonDictInterface*> getPlugins();
+     //! Indicates if GUI is in exact search mode.
+     /*! When GUI is in exact search mode it searches for word, and if it
 -        finds exactly matching translation it displaying matching words list
++        finds exactly matching translation it displays matching words list
+         and then directly displays translation of first exactly matched word.
+         This mode is used for browsing search history and searching words
+         from application arguments.
+         \returns flag indicating if GUI is in exact search mode
+         \sa setExactSearch()
+         \sa setExactSearchString()
+     */
+     bool isInExactSearch();
+     //! Returns current application settings.
+     /*!
+        \returns Settings object containing current application settings
+     */
+     Settings* settings();
+     //! Sets new settings.
+     /*!
+        \param Settings object containing new application settings
+     */
+     void setSettings(Settings*);
+  public Q_SLOTS:
+     //! Searches in exact mode for given word
+     /*!
+       GUI will be automatically set into exact search mode, and after search or
 -      when user break the search it will be unset from exact search mode.
++      when user breaks the search it will be unset from exact search mode.
+       \param word which will be searched in dictionaries
+       \sa search()
+     */
+     void searchExact(QString);
 -    //! Search for given word
++    //! Searches for given word
+     /*!
 -      It sets passed word in line edit of search bar and search for given word.
++      It sets passed word in line edit of search bar and searches for given word.
+       \param word which will be searched in dictionaries
+       \sa SearchBarWidget
+       \sa searchExact()
+     */
+     void search(QString);
 -    //! Start searching for given word after 500 ms delay
++    //! Starts searching for given word after 500 ms delay
+     /*!
 -      After times up it sets passed word in line edit of search bar and search
++      After time's up it sets passed word in line edit of search bar and searches
+       for given word.
+       \param word which will be searched in dictionaries
+       \sa SearchBarWidget
+       \sa searchExact()
+       \sa search()
+     */
+     void searchDelay(QString);
+     //! Sets string for exact search
+     /*!
+         Sets string for which current search is ongoing, is used to find exact
+         word when GUI is in search exact mode.
+     */
+     void setExactSearchString(QString);
+     //! Sets GUI exact search mode.
+     /*! When GUI is in exact search mode it searches for word, and if it
 -        finds exactly matching translation it displaying matching words list
++        finds exactly matching translation it displays matching words list
+         and then directly displays translation of first exactly matched word.
+         This mode is used for browsing search history and searching words
+         from application arguments.
 -        \param exactSearch flag indicating if GUI will be in exact search mode
++        \param exactSearch flag indicating if GUI is in exact search mode
+         \sa isInExactSearch()
+         \sa setExactSearchString()
+     */
+     void setExactSearch(bool);
+     //! Gets word list from backbone and prepares received list to display
+     /*!
 -      Checks if received list is empty, in that case displays suitable
 -      information. Otherwise it merge results of the same key word and emit
++      Checks if received list is empty, in that case it displays suitable
++      information. Otherwise it merges results of the same key word and emits
+       signal to display word list.
+       If GUI is in exact search mode it will search for exact word in received
 -      list and if any of found words match exacly the word passed to
++      list and if any of found words match exactly the word passed to
+       searchExact() method.
+       \sa isInExactSearch()
+       \sa searchExact()
+       \sa showTranslation()
+       \sa setExactSearchString()
+      */
+     void wordListReady();
+     //! Gets translation strings from backbone and emits signal to display them
+     void translationsReady();
 -    //! Adds to history key words from given translations
++    //! Adds key words from given translations to history
+     /*!
+       By default this slot is connected to searchTranslations signal, and
+       passed translation list contains only translations with the same key, so
+       only one word is added to history.
+       \param list of translations with key words
+       \sa searchTranslations()
+       */
+     void addToHistory(QList<Translation*>);
+     //! Shows history dialog
+     /*!
 -       In meamo shows dialog with history.
 -       In desktop shows popup containing history, which bottom edge is on the
++       In maemo it shows dialog with history.
++       In desktop it shows popup containing history, whose bottom edge is on the
+        same height as passed point.
 -       \param point on screen when popup has to show
++       \param point on screen where popup has to show
+     */
+     void showHistory(QPoint);
+     //! Shows translation of next word in history
+     /*!
 -      It will work only if there is available next word in history.
++      It will work only if there is next word available in history.
+       Translation of word is searched with searchDelay() function.
+       On maemo search is in normal mode, on desktop in exact search mode.
+       \sa searchDelay()
+       \sa searchExact()
+       */
+     void historyNext();
+     //! Shows translation of previous word in history
+     /*!
+       It will work only if there is available previous word in history.
+       Translation of word is searched with searchDelay() function.
+       On maemo search is in normal mode, on desktop in exact search mode.
+       \sa searchDelay()
+       \sa searchExact()
+       */
+     void historyPrev();
 -    //! Shows notify to user
++    //! Shows notification to user
+     /*!
 -      It shows different type of notyfies as informations, warnings and errors.
++      It shows different types of notifications such as information, warnings and errors.
+       In maemo they are represented as notes, on desktop as message boxes.
 -      \param type type of notify
 -      \param message notify message
++      \param type type of notification
++      \param message notification message
+     */
+     void showNotification(Notify::NotifyType type, QString message);
+ private Q_SLOTS:
+     //! Disables menu
+     void disableMenu();
+     //! Enables menu
+     void enableMenu();
+     //! When user breaks searching it makes sure that exact search mode will be
+     //! disabled
+     void searchingInterrupted();
 -    //! Asks for confirmation when user click on "delete all bookmarks"
++    //! Asks for confirmation when user clicks on "delete all bookmarks"
+     void removeBookmarks();
+ protected:
+     /*!
+         When user wants to close application, we first send signal to stop all
+         ongoing searches.
+     */
+     void closeEvent(QCloseEvent *);
+ private:
+     Backbone* backbone;
+     void initializeUI();
+     void initializeSearchWidgets();
+     void initializeMenu();
+     void initializeMenuWidgets();
+     void hideWelcomeScreen();
+     bool checkExactSearch(QHash<QString, QList<Translation*> > searchResult,
+                           QList<Translation*> &found);
+     SearchBarWidget* searchBarWidget;
+     QWidget* translationWidget;
+     QWidget* wordListWidget;
+     MenuWidget* menuWidget;
+     DictManagerWidget* dictManagerWidget;
+     SettingsWidget* settingsWidget;
+     BookmarksWidget* bookmarksWidget;
+     QWidget* welcomeScreenWidget;
+     AboutWidget* aboutWidget;
+     QMenuBar* menuBar;
+     QVBoxLayout* mainLayout;
+     NotifyManager* notifyManager;
+     #ifndef Q_WS_MAEMO_5
+         QSplitter* splitter;
+         QAction* dictionariesAction;
+         QAction* bookmarksShowAllAction;
+         QAction* bookmarksRemoveAllAction;
+         QAction* settingsAction;
+         QAction* aboutAction;
+     #endif
+     bool _exactSearch;
+     QString searchString;
+     void connectBackbone();
+     void connectSearchBar();
+     void connectWordList();
+     void connectTranslationWidget();
+     void connectDictManager();
+     void connectMenu();
+     void connectBookmarksWidget();
+ };
+ #endif // MAINWINDOW_H
index 0000000,e4320eb..30908e3
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,40 +1,40 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ //! \file MenuTabWidget.cpp
+ //! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ #include "MenuTabWidget.h"
+ #include <QDebug>
+ MenuTabWidget::MenuTabWidget(QWidget *parent) :
+     QTabWidget(parent) {
+     setMinimumHeight(400);
+ }
+ void MenuTabWidget::hideEvent(QHideEvent *e) {
 -    //just set parent to null, and allow event to be handled by default handler
++    //just sets parent to null, and allows event to be handled by default handler
+     setParent(NULL);
+     QTabWidget::hideEvent(e);
+ }
index 0000000,e5c2fd1..f2d894a
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,72 +1,72 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ //! \file MenuWidget.cpp
+ //! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ #include "MenuWidget.h"
+ #include <QDebug>
+ #include <QtGui>
+ MenuWidget::MenuWidget(QWidget *parent) :
+     QWidgetAction(parent) {
 -    //creating custom tab widget, and sets style sheet to have centered tabs
++    //creates custom tab widget, and sets style sheet to have centered tabs
+     tabWidget = new MenuTabWidget();
+     tabWidget->setStyleSheet("QTabWidget::tab-bar {alignment: center;}");
+ }
+ MenuWidget::~MenuWidget() {
+     //because tabWidget has no parent we must destroy it
+    delete tabWidget;
+ }
+ void MenuWidget::addSubMenu(QString title, QWidget *widget) {
+     QScrollArea* sa = new QScrollArea(tabWidget);
+     sa->setWidget(widget);
+     sa->setWidgetResizable(true);
+     sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+     tabWidget->addTab(sa, title);
+ }
+ void MenuWidget::removeSubMenu(QString title) {
+     for(int i = 0; i < tabWidget->count(); i++) {
+         if(tabWidget->tabText(i) == title) {
+             tabWidget->removeTab(i);
+             break;
+         }
+     }
+ }
+ QWidget* MenuWidget::createWidget(QWidget *) {
+     /*When we have request to create new widget we return tabWidget.
+     When the menu is closing, tabWidget will receive hideEvent which will set
+     its parent to NULL and prevent it from delete, so we can still use this
+     widget*/
+     return tabWidget;
+ }
+ void MenuWidget::hideMenu() {
+     tabWidget->parentWidget()->hide();
+ }
index 0000000,4fe7278..238bff8
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,64 +1,64 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ //! \file MenuWidget.h
+ //! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ #ifndef MENUWIDGET_H
+ #define MENUWIDGET_H
+ #include <QWidgetAction>
+ #include "MenuTabWidget.h"
+ /*! Displays custom menu with tab widget containing all submenus.
+   Each submenu is simply QWidget.
+ */
+ class MenuWidget : public QWidgetAction {
+     Q_OBJECT
+ public:
+     explicit MenuWidget(QWidget *parent = 0);
+     virtual ~MenuWidget();
+     /*!
 -        Add new submenu to menu. It is possible to have many submenus with the
++        Adds new submenu to menu. It is possible to have many submenus with the
+         same title.
+         \param title Name of new submenu which will be displayed in submenu tab.
+         \param widget Widget of the submenu.
+      */
+     void addSubMenu(QString title, QWidget* widget);
+     /*!
+         Removes submenu from menu. It will remove first menu with passed title.
+         /param title Name of submenu which will be removed.
+     */
+     void removeSubMenu(QString title);
+ public Q_SLOTS:
+     /*!
+       Hides menu
+       */
+     void hideMenu();
+ protected:
+     MenuTabWidget* tabWidget;
+     QWidget* createWidget(QWidget *parent);
+ };
+ #endif // MENUWIDGET_H
index 0000000,62ee99a..ea7d30d
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,316 +1,316 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ //! \file SearchBarWidget.cpp
+ //! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ #include "SearchBarWidget.h"
+ #include <QDebug>
+ #include "../../common/DictDialog.h"
+ #include "HistoryListDialog.h"
+ SearchBarWidget::SearchBarWidget(QWidget *parent) :
+     QWidget(parent) {
+     initializeUI();
+     busy = false;
+     connect(searchPushButton, SIGNAL(clicked()),
+             this, SLOT(searchPushButtonClicked()));
+     connect(searchWordLineEdit, SIGNAL(returnPressed()),
+             this, SLOT(searchPushButtonClicked()));
+     connect(historyNextToolButton, SIGNAL(clicked()),
+             this, SIGNAL(historyNext()));
+     connect(historyPrevToolButton, SIGNAL(clicked()),
+             this, SIGNAL(historyPrev()));
+     connect(historyShowToolButton, SIGNAL(clicked()),
+             this, SLOT(showHistoryButtonClicked()));
+     connect(clearSearchWordToolButton, SIGNAL(clicked()),
+             this, SLOT(clearSearchWordToolButtonClicked()));
+     connect(&delayTimer, SIGNAL(timeout()),
+             this, SLOT(delaySearchTimeout()));
+     searchWordLineEdit->setFocus();
+     historyPrevToolButton->setEnabled(false);
+     historyNextToolButton->setEnabled(false);
+     historyShowToolButton->setEnabled(false);
+     setEnabled(true);
+ }
+ SearchBarWidget::~SearchBarWidget() {
+ }
+ QIcon SearchBarWidget::generateIcon(QIcon oryginal, qreal rotation) {
+     QPixmap p = oryginal.pixmap(64);
+     if(rotation != 0) {
+         QMatrix m;
+         m.rotate(rotation);
+         p = p.transformed(m);
+     }
+     QIcon newIcon;
+     newIcon.addPixmap(p);
+     #ifdef Q_WS_MAEMO_5
+         QPainter painter(&p);
+         painter.fillRect(p.rect(), QColor(0,0,0,192));
+         newIcon.addPixmap(p, QIcon::Disabled, QIcon::Off);
+     #endif
+     return newIcon;
+ }
+ void SearchBarWidget::initializeUI() {
+     #ifdef Q_WS_MAEMO_5
+         setMaximumHeight(150);
+     #else
+         setMaximumHeight(100);
+     #endif
+     horizontalLayout = new QHBoxLayout;
+     verticalLayout = new QVBoxLayout;
+     searchPushButton = new QPushButton(tr("Search"));
+     searchPushButton->setMinimumWidth(125);
+     searchWordLineEdit = new QLineEdit;
+     searchWordLineEdit->setMinimumWidth(250);
+     completerModel = new QStringListModel(this);
+     lineEditCompleter = new QCompleter(searchWordLineEdit);
+     lineEditCompleter->setModel(completerModel);
+     lineEditCompleter->setCaseSensitivity(Qt::CaseInsensitive);
+     lineEditCompleter->setCompletionMode(QCompleter::InlineCompletion);
+     searchWordLineEdit->setCompleter(lineEditCompleter);
+     #ifndef Q_WS_MAEMO_5
+         searchWordLineEdit->setMinimumHeight(
+                 searchWordLineEdit->sizeHint().height()*3/2);
+     #endif
+     //create layout for lineEdit to have clear button on it
+     QHBoxLayout* lineEditLayout = new QHBoxLayout;
+     searchWordLineEdit->setLayout(lineEditLayout);
+     clearSearchWordToolButton = new QToolButton;
+     #ifdef Q_WS_MAEMO_5
+         clearSearchWordToolButton->setIcon(QIcon::fromTheme("general_stop"));
+         clearSearchWordToolButton->setMaximumSize(
+                 clearSearchWordToolButton->sizeHint().height()/2,
+                 clearSearchWordToolButton->sizeHint().height()/2);
+         lineEditLayout->setContentsMargins(0,0,10,0);
+     #else
+         clearSearchWordToolButton->setIcon(QIcon::fromTheme("edit-clear"));
+         clearSearchWordToolButton->setMinimumSize(
+                 searchWordLineEdit->sizeHint().height()*1.2,
+                 searchWordLineEdit->sizeHint().height()*1.2);
+         lineEditLayout->setContentsMargins(0,0,5,0);
+     #endif
+     historyNextToolButton = new QToolButton;
+     #ifdef Q_WS_MAEMO_5
+         historyNextToolButton->setIcon(
+                 generateIcon(QIcon::fromTheme("general_forward")));
+     #else
+         historyNextToolButton->setIcon(
+                 generateIcon(QIcon::fromTheme("go-next")));
+     #endif
+     historyPrevToolButton = new QToolButton;
+     #ifdef Q_WS_MAEMO_5
+         historyPrevToolButton->setIcon(
+                 generateIcon(QIcon::fromTheme("general_back")));
+     #else
+         historyPrevToolButton->setIcon(
+                 generateIcon(QIcon::fromTheme("go-previous")));
+     #endif
+     historyShowToolButton = new QToolButton;
+     #ifdef Q_WS_MAEMO_5
+         historyShowToolButton->setIcon(
+                 generateIcon(QIcon::fromTheme("general_back"), 90));
+     #else
+         historyShowToolButton->setIcon(
+                 generateIcon(QIcon::fromTheme("go-up")));
+     #endif
+     searchingProgressBar = new QProgressBar;
 -    //progress bar have minimum and maximum values set to 0, which will effect
++    //progress bar has minimum and maximum values set to 0, which will effect
+     //with "I'm alive" bar
+     searchingProgressBar->setMinimum(0);
+     searchingProgressBar->setMaximum(0);
+     #ifdef Q_WS_MAEMO_5
+         searchingProgressBar->setMaximumHeight(50);
+     #endif
+     searchingProgressBar->hide();
+     setLayout(verticalLayout);
+     verticalLayout->addWidget(searchingProgressBar);
+     //adding widgets to layout
+     horizontalLayout->addWidget(searchWordLineEdit);
+     horizontalLayout->addWidget(searchPushButton);
+     horizontalLayout->addWidget(historyPrevToolButton);
+     horizontalLayout->addWidget(historyShowToolButton);
+     horizontalLayout->addWidget(historyNextToolButton);
+     //adding clear toolButton to textEdit with right alignment
+     lineEditLayout->addWidget(clearSearchWordToolButton, 0, Qt::AlignRight);
+     verticalLayout->addLayout(horizontalLayout);
+ }
+ void SearchBarWidget::searchPushButtonClicked() {
+     if(busy) {
+         Q_EMIT stopSearching();
+     }
+     else {
+         search(searchWordLineEdit->text());
+     }
+ }
+ void SearchBarWidget::search(QString word) {
+     if(!busy && !word.isEmpty()) {
+         completerModel->insertRow(completerModel->rowCount());
+         QModelIndex index =
+                 completerModel->index(completerModel->rowCount() -1);
+         completerModel->setData(index, word);
+         searchWordLineEdit->setText(word);
+         Q_EMIT searchForTranslations(word);
+     }
+ }
+ void SearchBarWidget::searchDelay(QString word) {
+     if(!busy && !word.isEmpty()) {
+         searchWordLineEdit->setText(word);
+         if(delayTimer.isActive()) {
+             delayTimer.stop();
+         }
+         delayString = word;
+         delayTimer.start(500);
+     }
+ }
+ void SearchBarWidget::delaySearchTimeout() {
+     delayTimer.stop();
+     if(!busy) {
+         Q_EMIT searchForTranslations(delayString);
+     }
+ }
+ void SearchBarWidget::setEnabled(bool enabled) {
+     searchWordLineEdit->setEnabled(enabled);
+     if(!enabled) {
+         historyPrevToolButton->setEnabled(false);
+         historyNextToolButton->setEnabled(false);
+         historyShowToolButton->setEnabled(false);
+     }
+ }
+ void SearchBarWidget::setBusy() {
+     if(busy) return;
+     searchingProgressBar->show();
+     searchPushButton->setText(tr("Stop"));
+     setEnabled(false);
+     busy = true;
+ }
+ void SearchBarWidget::setIdle() {
+     if(!busy) return;
+     searchingProgressBar->hide();
+     searchPushButton->setText(tr("Search"));
+     setEnabled(true);
+     busy = false;
+     Q_EMIT refreshHistoryButtons();
+ }
+ void SearchBarWidget::clearSearchWordToolButtonClicked() {
+     searchWordLineEdit->clear();
+ }
+ void SearchBarWidget::updateHistoryButtons(bool prev, bool next, bool list) {
+     if(!busy) {
+         historyPrevToolButton->setEnabled(prev);
+         historyNextToolButton->setEnabled(next);
+         historyShowToolButton->setEnabled(list);
+     }
+ }
+ void SearchBarWidget::showHistoryButtonClicked() {
+     #ifdef Q_WS_MAEMO_5
+         emit historyShow();
+     #else
+         QPoint p = historyShowToolButton->pos();
+         p.setY(p.y());
+         emit historyShow(mapToGlobal(p));
+     #endif
+ }
index 0000000,09e1e8e..71d33cb
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,161 +1,161 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ //! \file SearchBarWidget.h
+ //! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ #ifndef SEARCHBARWIDGET_H
+ #define SEARCHBARWIDGET_H
+ #include <QWidget>
+ #include <QtGui>
+ #include "../backbone/backbone.h"
+ #include "../../common/History.h"
+ //! Displays search bar
+ /*!
+     Contains line edit field to input word which user would like to find
+     and buttons to start/stop search and browse search history.
+     Line edit and history buttons are disabled when search is ongoing,
+     only start/stop button stays active. When searching it also displays
+     progress bar.
+ */
+ class SearchBarWidget : public QWidget {
+     Q_OBJECT
+ public:
+     explicit SearchBarWidget(QWidget *parent = 0);
+     ~SearchBarWidget();
+ Q_SIGNALS:
+     //! Requests to search for list of words matching word passed as
+     //! parameter
+     void searchForTranslations(QString);
+     //! Requests to stop all active searchings
+     void stopSearching();
+     //! Requests to show previous translation in history
+     void historyPrev();
+     //! Requests to show next translation in history
+     void historyNext();
+     //! Requests to show history list
+     /*!
+       \param p this argument is used only on desktop, it defines place on
+       which popup with history will be shown
+     */
+     void historyShow(QPoint p = QPoint(-1,-1));
+     //! Requests to refresh state of history buttons
+     void refreshHistoryButtons();
+ public Q_SLOTS:
+     //! Enables or disables search word line edit and history buttons
+     /*!
+       While searching it disables only history button and line edit.
+       Search/Stop button is always enabled.
+     */
+     void setEnabled(bool);
+     //! Sets search bar in busy state
+     /*!
+       Displays "busy" bar and disables search word text edit and history buttons
+     */
+     void setBusy();
+     //! Sets search bar in idle state
+     /*!
+       Hides "busy" bar and enables all widgets, refreshes state of history buttons
+       by emitting refreshHistoryButtons signal
+     */
+     void setIdle();
+     //! Searches for given word
+     /*!
+       Sets word as text in search word line edit
+     */
+     void search(QString word);
+     //! Starts to search for given word after 500 ms delay
+     /*!
+       Sets word as text in search word line edit, and waits 500 ms to start
 -      search. If in meanwhile this slot is called again it will stop previous
++      search. If in the meantime this slot is called again it will stop previous
+       timers.
+     */
+     void searchDelay(QString word);
+     //! Updates state of history buttons
+     /*!
 -      \param prev if set to true, the history have some previous words
 -      \param next if set to true, the history have some next words
++      \param prev if set to true, the history has some previous words
++      \param next if set to true, the history has some next words
+       \param list if set to true, the history can show word list
+     */
+     void updateHistoryButtons(bool prev, bool next, bool list);
+ private Q_SLOTS:
+     //! Clears search word line edit
+     void clearSearchWordToolButtonClicked();
+     //! Starts to search for given words
+     void searchPushButtonClicked();
 -    //! starts to search word wich was passed to searchDelay
++    //! starts to search word which was passed to searchDelay
+     void delaySearchTimeout();
+     //! shows history
+     void showHistoryButtonClicked();
+ private:
+     QLineEdit* searchWordLineEdit;
+     QCompleter* lineEditCompleter;
+     QStringListModel* completerModel;
+     QToolButton* clearSearchWordToolButton;
+     QPushButton* searchPushButton;
+     QToolButton* historyPrevToolButton;
+     QToolButton* historyNextToolButton;
+     QToolButton* historyShowToolButton;
+     QToolButton* fullScreenToolButton;
+     QHBoxLayout* horizontalLayout;
+     QProgressBar* searchingProgressBar;
+     //! generates icon for maemo (some of icons we use don't have inactive
+     //! pixmaps, so we generate them
+     /*!
+       \param oryginal oryginal icon
+       \param rotation rotation of resulting icon
+     */
+     QIcon generateIcon(QIcon oryginal, qreal rotation=0);
+     QVBoxLayout* verticalLayout;
+     bool busy;
+     QTimer delayTimer;
+     QString delayString;
+     void initializeUI();
+ };
+ #endif // SEARCHBARWIDGET_H
index 0000000,25ccc90..e5c5f87
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,189 +1,188 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ //! \file SettingsWidget.cpp
+ //! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ #include "SettingsWidget.h"
+ #include <QDebug>
+ SettingsWidget::SettingsWidget(GUIInterface *parent) :
+     QDialog(parent)
+ {
+     guiInterface = parent;
+     setWindowTitle(tr("Settings"));
+     initalizeUI();
+ }
+ void SettingsWidget::initalizeUI() {
+     verticalLayout = new QVBoxLayout;
+     setLayout(verticalLayout);
+     historySizeSpinBox = new QSpinBox;
+     searchResultSizeSpinBox = new QSpinBox;
 -
 -    limitTip = "Limit maximal number of finded words, affect only when "
 -                "searching in file";
++    limitTip = "Limits maximum number of found words, affects only when "
++                "searching in file.";
+     searchResultSizeSpinBox->setToolTip(limitTip);
+     spinBoxesFormLayout = new QFormLayout;
+     spinBoxesFormLayout->addRow(tr("Search result size"),
+                                 searchResultSizeSpinBox);
+     spinBoxesFormLayout->addRow(tr("History size"),
+                                 historySizeSpinBox);
+     searchResultSizeSpinBox->setMinimum(0);
+     searchResultSizeSpinBox->setSpecialValueText(tr("Unlimited"));
+     historySizeSpinBox->setMinimum(1);
+     searchResultSizeSpinBox->setMaximum(500);
+     historySizeSpinBox->setMaximum(50);
+     #ifdef Q_WS_MAEMO_5
+         verticalLayout->addSpacing(20);
+     #endif
+     verticalLayout->addLayout(spinBoxesFormLayout);
+     checkBoxesLabel = new QLabel(tr("Search in:"),this);
+     searchInBookmarksCheckBox = new QCheckBox(tr("Bookmarks"),this);
+     searchInDictionariesCheckBox = new QCheckBox(tr("Dictionaries"),this);
+     verticalLayout->addSpacing(20);
+     verticalLayout->addWidget(checkBoxesLabel);
+     verticalLayout->addWidget(searchInDictionariesCheckBox);
+     verticalLayout->addWidget(searchInBookmarksCheckBox);
+     connect(historySizeSpinBox, SIGNAL(valueChanged(int)), this,
+             SLOT(changed()));
+     connect(searchResultSizeSpinBox, SIGNAL(valueChanged(int)), this,
+             SLOT(changed()));
+     connect(searchInDictionariesCheckBox, SIGNAL(toggled(bool)), this,
+             SLOT(changed()));
+     connect(searchInBookmarksCheckBox, SIGNAL(toggled(bool)), this,
+             SLOT(changed()));
+     settings = 0;
+     #ifndef Q_WS_MAEMO_5
+         setMinimumWidth(250);
+         setMaximumWidth(250);
+         footerLayout = new QHBoxLayout;
+         closeButton = new QPushButton(tr("Save"));
+         footerLayout->addStretch(0);
+         footerLayout->addWidget(closeButton);
+         verticalLayout->addLayout(footerLayout);
+         connect(closeButton, SIGNAL(clicked()), this, SLOT(save()));
+     #endif
+ }
+ void SettingsWidget::showEvent(QShowEvent *e) {
+    #ifndef Q_WS_MAEMO_5
+        _save = false;
+    #endif
+    settings = guiInterface->settings();
+    historySizeSpinBox->setValue(
+             settings->value("history_size").toInt());
+     searchResultSizeSpinBox->setValue(
+             settings->value("search_limit").toInt());
+     if(settings->value("search_bookmarks") == "true")
+         searchInBookmarksCheckBox->setChecked(true);
+     else
+         searchInBookmarksCheckBox->setChecked(false);
+     if(settings->value("search_dictionaries") == "true")
+         searchInDictionariesCheckBox->setChecked(true);
+     else
+         searchInDictionariesCheckBox->setChecked(false);
+     _changed = false;
+     QDialog::showEvent(e);
+ }
+ void SettingsWidget::hideEvent(QHideEvent *e) {
+     QDialog::hideEvent(e);
+     #ifndef Q_WS_MAEMO_5
+         if(settings && _save) {
+     #else
+         if(settings && _changed &&
+            QMessageBox::question(this,
+                                  tr("Save"),
+                                  tr("Do you want to save changes?"),
+              QMessageBox::Save, QMessageBox::Cancel) == QMessageBox::Save) {
+     #endif
+         Settings* newSettings = new Settings;
+         newSettings->setValue("history_size",
+                               QString::number(historySizeSpinBox->value()));
+         newSettings->setValue("search_limit",
+                               QString::number(
+                                       searchResultSizeSpinBox->value()));
+         if(searchInDictionariesCheckBox->isChecked())
+             newSettings->setValue("search_dictionaries", "true");
+         else
+             newSettings->setValue("search_dictionaries", "false");
+         if(searchInBookmarksCheckBox->isChecked())
+             newSettings->setValue("search_bookmarks", "true");
+         else
+             newSettings->setValue("search_bookmarks", "false");
 -        //setting new settings only if they are different that old ones
++        //setting new settings only if they are different than old ones
+         QString key;
+         foreach(key, newSettings->keys()) {
+             if(settings->value(key) != newSettings->value(key)) {
+                 guiInterface->setSettings(newSettings);
+                 break;
+             }
+         }
+     }
+     if(settings) {
+         delete settings;
+         settings = 0;
+     }
+     _changed = false;
+ }
+ void SettingsWidget::changed() {
+     _changed = true;
+ }
+ #ifndef Q_WS_MAEMO_5
+     void SettingsWidget::save() {
+         _save = true;
+         hide();
+     }
+ #endif
index 0000000,cbfec7e..a8d1ff6
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,43 +1,44 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ //! \file WelcomeScreenWidget.h
++//! \brief Implements widget that displays welcome screen to user
+ //! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ #ifndef WELCOMESCREENWIDGET_H
+ #define WELCOMESCREENWIDGET_H
+ #include <QWidget>
+ #include <QScrollArea>
+ #include <QtGui>
+ //! Displays welcome screen with logo and name of application
+ class WelcomeScreenWidget : public QScrollArea
+ {
+     Q_OBJECT
+ public:
+     explicit WelcomeScreenWidget(QWidget *parent = 0);
+ private:
+     QVBoxLayout* mainLayout;
+     QLabel* mainLabel, * licenseLabel, *imageLabel;
+ };
+ #endif // WELCOMESCREENWIDGET_H
index 0000000,0bfb235..3929032
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,59 +1,59 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ /*! \file GoogleDictDialog.h
 -    \brief Class launch a dialogs witch generete new dictionary, or change
++    \brief Class launches dialog which generates new dictionary, or changes
+     settings
+     \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
+ */
+ #ifndef GOOGLEDICTDIALOG_H
+ #define GOOGLEDICTDIALOG_H
+ #include "../../common/DictDialog.h"
+ #include "../../common/settings.h"
+ #include "GooglePlugin.h"
+ #include "GoogleSettingsDialog.h"
+ class GooglePlugin;
+ class GoogleDictDialog : public DictDialog
+ {
+      Q_OBJECT
+ public:
+     explicit GoogleDictDialog(GooglePlugin* plugin, QObject *parent = 0);
+     /*!
 -      Shows add new google dictionary dialog and returns settings of new dict
 -      \param parent parent widget on which will be displayed dialog
++      Shows "add new google dictionary" dialog and returns settings of new dict
++      \param parent parent widget on which dialog will be displayed
+       */
+     Settings* addNewDictionary(QWidget *parent);
+     /*!
 -      Shows settings dialog and save new settings in plugin
++      Shows "settings" dialog and saves new settings in plugin
+       \param parent parent widget on which dialog will be displayed
+       */
+     void changeSettings(QWidget *parent);
+ private:
+     GooglePlugin* plugin;
+ };
+ #endif // GOOGLEDICTDIALOG_H
index 0000000,4e53601..61f5c34
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,424 +1,424 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ /*! \file GooglePlugin.cpp
+     \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
+ */
+ #include "GooglePlugin.h"
+ #include <QDebug>
+ #include "GoogleDictDialog.h"
+ GooglePlugin::GooglePlugin(QObject *parent): CommonDictInterface(parent),
+                     _name(""),_infoNote("") {
+     _settings = new Settings();
+     _settings->setValue("lang_to","");
+     _settings->setValue("lang_from","");
+     _settings->setValue("type","google");
+     _settings->setValue("connection_accepted","true");
+     _dictDialog = new GoogleDictDialog(this,this);
+     _icon = QIcon(":/icons/drawing.png");
+     stopped = false;
+     languages=initLanguages();
+     http = new QHttp(this);
+     connect(http, SIGNAL(done(bool)), this, SLOT(done()));
+ }
+ GooglePlugin::~GooglePlugin() {
+     delete _settings;
+     delete _dictDialog;
+ }
+ QString GooglePlugin::langFrom() const {
+     return languages.key(_settings->value("lang_from"));
+ }
+ QString GooglePlugin::langTo() const {
+     return languages.key(_settings->value("lang_to"));
+ }
+ QString GooglePlugin::name() const {
+     return QString("dictionary");
+ }
+ QString GooglePlugin::type() const {
+     return QString("google");
+ }
+ QString GooglePlugin::infoNote() const {
+     return _infoNote;
+ }
+ void GooglePlugin::setLangTo(QString langTo){
+     _settings->setValue("lang_to",langTo);
+ }
+ void GooglePlugin::setLangFrom(QString langFrom){
+     _settings->setValue("lang_from",langFrom);;
+ }
+ DictDialog* GooglePlugin::dictDialog() {
+     return _dictDialog;
+ }
+ bool GooglePlugin::isAvailable() const {
+     return isConnectionAccept();
+ }
+ void GooglePlugin::setConnectionAccept(QString connectionAcepted) {
+     if(connectionAcepted=="true")
+         _settings->setValue("connection_accepted","true");
+     else
+         _settings->setValue("connection_accepted","false");
+ }
+ bool GooglePlugin::isConnectionAccept() const {
+     if(_settings->value("connection_accepted")=="true")
+         return true;
+     else
+         return false;
+ }
+ uint GooglePlugin::hash() const {
+     return _hash;
+ }
+ void GooglePlugin::setHash(uint _hash) {
+     this->_hash=_hash;
+ }
+ Settings* GooglePlugin::settings() {
+ /*    Settings *returnSettings=new Settings;
+     QStringList list = _settings->keys();
+     foreach(QString key, list)
+             returnSettings->setValue(key,_settings->value(key));
+     return returnSettings;
+ */
+     return _settings;
+ }
+ void GooglePlugin::setSettings(const Settings* settings) {
+     if(settings) {
+         QStringList list = settings->keys();
+         foreach(QString key, list)
+             _settings->setValue(key, settings->value(key));
+         getDictionaryInfo();
+         Q_EMIT settingsChanged();
+     }
+ }
+ QIcon* GooglePlugin::icon() {
+     return &_icon;
+ }
+ CommonDictInterface* GooglePlugin::getNew(const Settings* settings) const {
+     GooglePlugin *plugin = new GooglePlugin();
+     if(settings)
+         plugin->setSettings(settings);
+     return plugin;
+ }
+ QString GooglePlugin::search(QString) {
 -    qDebug() << "function is not used this plugin";
++    qDebug() << "function is not used in this plugin";
+     return QString("");
+ }
+ Translation* GooglePlugin::getTranslationFor(QString key) {
+     return (new TranslationGoogle(key,"",_infoNote,this));
+ }
+ QList<Translation*> GooglePlugin::searchWordList(QString word, int ) {
+     QList<Translation*> translations;
+     if(isAvailable()) {
+         QString error("");
+         word.replace("*","");   /*remove wildcard*/
+         word.replace("?","");
+         QString url=QString("/translate_a/t?client=t&sl=%1&tl=%2").arg(
+                                               _settings->value("lang_from"),
+                                               _settings->value("lang_to"));
+         QHttpRequestHeader head = QHttpRequestHeader("POST", url, 1,1);
+         head.setValue("Host","www.google.pl");
+         head.setValue("User-Agent", "Mozilla/5.0");
+         head.setValue("Accept-Encoding", "deflate");
+         head.setContentLength(word.length());
+         head.setValue("Connection", "Close");
+         QByteArray data("text=");
+         data.append(word.toUtf8());
+         http->setHost("www.google.pl");
+         wait=true;      /* bool - change in slot done (initiate by http) */
+         stopped=false;  /* bool - change in slot stop (initiate in gui)  */
+         http->request(head, data);
+         while(wait && (error=="" || error=="Unknown error") && !stopped)
+             error=http->errorString();
+         if(error!="" && error!="Unknown error") {
+             qDebug()<<error;
+             Q_EMIT notify(Notify::Warning,
 -                    QString("GooglePlugin: %1").arg(error));
++                    tr("GooglePlugin: %1").arg(error));
+         }
+         QString text = QString::fromUtf8(http->readAll());
+         text=jsonParse(text);
+         if(text!="") {
+             text="<key>" + word + "</key>" + "<t>" + text + "</t>";
+             translations<<(new TranslationGoogle(word,text,_infoNote,this));
+         }
+     }
+     return translations;
+ }
+ QString GooglePlugin::jsonParse(QString result) {
+     int pos=0,pos2=0,index=0,size=0;
+     QString returnLang;
+     QString translation;
+     QString original;
+     QList<QString> partOfSpeach;
+     QList<QList<QString>* > words;
+     QStringList list1 = result.split("\"");
+     size=(list1.size()-1)/2;
+     if(size<=2)
+         return QString(""); // wrong format of data
+     translation=list1.at(index*2+1);
+     index++;
+     original=list1.at(index*2+1);
+     pos=result.indexOf("]");
+     index++;
+     while(result.at(pos+1)==QChar(',')) {
+         index++;
+         translation+=list1.at(index*2+1);
+         index++;
+         original=list1.at(index*2+1);
+         pos=result.indexOf("]",pos+1);
+         index++;
+     }
+     pos=result.indexOf("]",pos+1);
+     pos++;
+     index++;
+     if(result.at(pos+1)==QChar(','))
+         returnLang=list1.at(index*2+1); /*return when translate sentence*/
+     while(result.indexOf("[",pos+1)!=-1){
+         partOfSpeach.append(list1.at(index*2+1));
+         pos2=result.indexOf("]",pos+1);
+         pos=result.indexOf("\"",pos+1);
+         pos=result.indexOf("\"",pos+1);
+         pos=result.indexOf("\"",pos+1);
+         pos=result.indexOf("\"",pos+1);
+         QList<QString> *list=new QList<QString>;
+         while(pos2>pos && pos2!=-1 && pos!= -1) {
+             index++;
+             if(size==index)
+                 return QString("");
+             list->append(list1.at(index*2+1));
+             pos=result.indexOf("\"",pos+1);
+             pos=result.indexOf("\"",pos+1);
+         }
+         words.append(list);
+         index++;
+         if(size==index)
+             return QString("");
+         pos=pos2+2;
+     }
+     if(words.size()!=partOfSpeach.size()) {
+         qDebug()<<"Error in Google Plugin (JsonParse)";
+         Q_EMIT notify(Notify::Warning,
 -                QString("GooglePlugin: can't parse Json"));
++                tr("GooglePlugin: can't parse Json"));
+         return QString("");
+     }
+     returnLang=list1.at(index*2+1);
+     if(partOfSpeach.size()==0){
+         if(translation.toLower()==original.toLower()){
 -            return QString(""); // word don't exist";
++            return QString(""); // word doesn't exist";
+         }
+         else
+             return "\""+translation+"\"";
+     }
+     result=translation;
+     for(int i=0; i<words.size();i++) {
+         result+="<br/><pos>"+partOfSpeach.at(i)+"</pos>: ";
+         for(int j=0; j<words.at(i)->size();j++)
+             result+=words.at(i)->at(j)+", ";
+         result.remove(result.size()-2,2);
+     }
+     return result;
+ }
+ void GooglePlugin::done() {
+     wait=false;
+ }
+ void GooglePlugin::stop() {
+     stopped=true;
+ }
+ QMap<QString, QString> GooglePlugin::initLanguages() {
+     QMap<QString, QString> languages;
+     languages["Afrikaans"] = "af";
+     languages["Albanian"] = "sq";
+     languages["Arabic"] = "ar";
+     languages["Armenian"] = "hy";
+     languages["Azerbaijani"] = "az";
+     languages["Basque"] = "eu";
+     languages["Belarusian"] = "be";
+     languages["Bulgarian"] = "bg";
+     languages["Catalan"] = "ca";
+     languages["Chinese"] = "zh";
+     languages["Croatian"] = "hr";
+     languages["Czech"] = "cs";
+     languages["Danish"] = "da";
+     languages["Dutch"] = "nl";
+     languages["English"] = "en";
+     languages["Estonian"] = "et";
+     languages["Filipino"] = "tl";
+     languages["Finnish"] = "fi";
+     languages["French"] = "fr";
+     languages["Galician"] = "gl";
+     languages["Georgian"] = "ka";
+     languages["German"] = "de";
+     languages["Greek"] = "el";
+     languages["Haitian_creole"] = "ht";
+     languages["Hebrew"] = "iw";
+     languages["Hindi"] = "hi";
+     languages["Hungarian"] = "hu";
+     languages["Icelandic"] = "is";
+     languages["Indonesian"] = "id";
+     languages["Irish"] = "ga";
+     languages["Italian"] = "it";
+     languages["Japanese"] = "ja";
+     languages["Korean"] = "ko";
+     languages["Latvian"] = "lv";
+     languages["Lithuanian"] = "lt";
+     languages["Macedonian"] = "mk";
+     languages["Malay"] = "ms";
+     languages["Maltese"] = "mt";
+     languages["Norwegian"] = "no";
+     languages["Persian"] = "fa";
+     languages["Polish"] = "pl";
+     languages["Portuguese"] = "pt";
+     languages["Romanian"] = "ro";
+     languages["Russian"] = "ru";
+     languages["Serbian"] = "sr";
+     languages["Slovak"] = "sk";
+     languages["Slovenian"] = "sl";
+     languages["Spanish"] = "es";
+     languages["Swahili"] = "sw";
+     languages["Swedish"] = "sv";
+     languages["Thai"] = "th";
+     languages["Turkish"] = "tr";
+     languages["Ukrainian"] = "uk";
+     languages["Urdu"] = "ur";
+     languages["Vietnamese"] = "vi";
+     languages["Welsh"] = "cy";
+     languages["Yiddish"] = "yi";
+     languages["Detect langlage"] = "";
+ //    languages["AMHARIC"] = "am";
+ //    languages["BENGALI"] = "bn";
+ //    languages["BIHARI"] = "bh";
+ //    languages["BRETON"] = "br";
+ //    languages["BURMESE"] = "my";
+ //    languages["CHEROKEE"] = "chr";
+ //    languages["CHINESE_SIMPLIFIED"] = "zh-CN";
+ //    languages["CHINESE_TRADITIONAL"] = "zh-TW";
+ //    languages["CORSICAN"] = "co";
+ //    languages["DHIVEHI"] = "dv";
+ //    languages["ESPERANTO"] = "eo";
+ //    languages["FAROESE"] = "fo";
+ //    languages["FRISIAN"] = "fy";
+ //    languages["GUJARATI"] = "gu";
+ //    languages["INUKTITUT"] = "iu";
+ //    languages["JAVANESE"] = "jw";
+ //    languages["KANNADA"] = "kn";
+ //    languages["KAZAKH"] = "kk";
+ //    languages["KHMER"] = "km";
+ //    languages["KURDISH"] = "ku";
+ //    languages["KYRGYZ"] = "ky";
+ //    languages["LAO"] = "lo";
+ //    languages["LATIN"] = "la";
+ //    languages["LUXEMBOURGISH"] = "lb";
+ //    languages["MALAYALAM"] = "ml";
+ //    languages["MAORI"] = "mi";
+ //    languages["MARATHI"] = "mr";
+ //    languages["MONGOLIAN"] = "mn";
+ //    languages["NEPALI"] = "ne";
+ //    languages["OCCITAN"] = "oc";
+ //    languages["ORIYA"] = "or";
+ //    languages["PASHTO"] = "ps";
+ //    languages["PORTUGUESE_PORTUGAL"] = "pt-PT";
+ //    languages["PUNJABI"] = "pa";
+ //    languages["QUECHUA"] = "qu";
+ //    languages["SANSKRIT"] = "sa";
+ //    languages["SCOTS_GAELIC"] = "gd";
+ //    languages["SINDHI"] = "sd";
+ //    languages["SINHALESE"] = "si";
+ //    languages["SUNDANESE"] = "su";
+ //    languages["SYRIAC"] = "syr";
+ //    languages["TAJIK"] = "tg";
+ //    languages["TAMIL"] = "ta";
+ //    languages["TATAR"] = "tt";
+ //    languages["TELUGU"] = "te";
+ //    languages["TIBETAN"] = "bo";
+ //    languages["TONGA"] = "to";
+ //    languages["UZBEK"] = "uz";
+ //    languages["UIGHUR"] = "ug";
+     return languages;  
+ }
+ void GooglePlugin::getDictionaryInfo() {
+     QString fullLangFrom=languages.key(_settings->value("lang_from"));
+     QString fullLangTo=languages.key(_settings->value("lang_to"));
+     _infoNote=" [" + fullLangFrom + "-" + fullLangTo + "] (Google)";
+ }
+ Q_EXPORT_PLUGIN2(google, GooglePlugin)
index 0000000,596eaaa..87c709a
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,146 +1,146 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ /*! \file GooglePlugin.h
+     \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
+ */
+ #ifndef GOOGLEPLUGIN_H
+ #define GOOGLEPLUGIN_H
+ #include <QObject>
+ #include <QDialog>
+ #include <QtPlugin>
+ #include <QIcon>
+ #include <QtNetwork>
+ #include "../../common/CommonDictInterface.h"
+ #include "../../common/settings.h"
+ #include "../../common/DictDialog.h"
+ #include "TranslationGoogle.h"
+ #include "GoogleDictDialog.h"
+ class GoogleDictDialog;
+ class GooglePlugin : public CommonDictInterface
+ {
+     Q_OBJECT
+     Q_INTERFACES(CommonDictInterface)
+ public:
+     GooglePlugin(QObject *parent=0);
+     ~GooglePlugin();
+     //! returns source language code iso 639-2
+     QString langFrom() const;
+     //! returns destination language code iso 639-2
+     QString langTo() const;
+     //! returns dictionary name (like "old English" or so)
+     QString name() const;
+     //! returns dictionary type (xdxf, google translate, etc)
+     QString type() const;
+     //! returns information about dictionary in html (name, authors, etc)
+     QString infoNote() const;
+     void setLangTo(QString langTo);
+     void setLangFrom(QString langFrom);
+     /*! returns DictDialog object that creates dialogs
+         for adding new dictionaries and changing plugin things
+       */
+     DictDialog* dictDialog();
 -    //! returns new, clean copy of plugin with setting set as in Settings*
++    //! returns new, clean copy of plugin with settings set as in Settings*
+     CommonDictInterface* getNew(const Settings*) const;
+     //! returns whether plugin can start searching
+     bool isAvailable() const;
+     void setConnectionAccept(QString connectionAcepted);
+     bool isConnectionAccept() const;
+     //! returns a description of a word given by a QString
+     QString search(QString key);
+     //! returns a unique hash for a dictionary
+     uint hash() const;
 -    //! sets unique value (unique for every dictionary not plugin)
++    //! sets unique value (unique for every dictionary, not plugin)
+     void setHash(uint);
+     //! returns current plugin settings
+     Settings* settings();
+     //! Sets new settings
+     void setSettings(const Settings*);
+     //! returns plugin icon
+     QIcon* icon();
+     Translation* getTranslationFor(QString key);
+     static QMap<QString, QString> initLanguages();
+ public slots:
+     /*! performs search in dictionary
+       \param  word word to search in dictionary
+       \param limit limit on number of results
+       After finishing search it has to emit
+       \see CommonDictInterface:finalTranslation  finalTranslation
+     */
+     QList<Translation*> searchWordList(QString word, int limit=0);
+     //! stop current operation
+     void stop();
+     void done();
+     QString jsonParse(QString result);
+     void getDictionaryInfo();
+ private:
+     QMap<QString, QString> languages;
+     QString _name;
+     //! type of a dictionary
+     QString _type;
+     //! information about dictionary
+     QString _infoNote;
+     uint _hash;
+     QIcon _icon;
+     Settings *_settings;
+     bool stopped;
+     bool _connectionAccept;
+     volatile bool wait;
+     QHttp *http;
+     GoogleDictDialog *_dictDialog;
+ };
+ #endif // GOOGLEPLUGIN_H
index 0000000,97e2c75..ff4503f
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,104 +1,104 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ /*! \file GoogleSettingsDialog.h
+     \brief Class creates dialog to get or change settings for Google Plugin
+     \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
+ */
+ #ifndef GOOGLESETTINGSDIALOG_H
+ #define GOOGLESETTINGSDIALOG_H
+ #include <QDialog>
+ #include "../../common/settings.h"
+ #include <QtGui>
+ #include "GooglePlugin.h"
+ class GooglePlugin;
+ class GoogleSettingsDialog : public QDialog
+ {
+     Q_OBJECT
+ public:
+     explicit GoogleSettingsDialog(QWidget *parent = 0,
+                                   Settings *pluginSettings=0,
+                                   QString acceptButtonLabel = tr("Add"));
+     /*!
+         \param parent parent widget on which dialog will be displayed
+         \param langTo language which is displayed in the comboBox as a startup item
+         \param langFrom language which is displayed in the comboBox as a startup item
 -        \returns function return settings to GooglePlugin
++        \returns function returns settings to GooglePlugin
+     */
+     static Settings* getSettings(QWidget *parent,
+                                  Settings *pluginSettings=0,
+                                  QString acceptButtonLabel = tr("Add"));
+     /*!
+         function sets a new settings in plugin;
+         \param plugin plugin whose settings you will change
+         \param parent parent widget on which dialog will be displayed
+     */
+     static void changeSettings(GooglePlugin* plugin, QWidget *parent);
+     //! \return source language code iso 639-2
+     QString langFrom();
+     //! \return destination language code iso 639-2
+     QString langTo();
+ private slots:
+     void activatedFrom(int);
+     void activatedTo(int);
+     void changeLangButtonClicked();
+ private:
+     QLabel* infoLabel;
+     QLabel* langFromLabel;
+     QLabel* langToLabel;
+     QLabel* connectInfoLabel;
+     QPushButton* saveButton;
+     QPushButton* changeLangButton;
+     QComboBox *langFromComboBox;
+     QComboBox *langToComboBox;
+     QVBoxLayout* verticalLayout;
+     QVBoxLayout* langLayout;
+     QHBoxLayout* langFromLayout;
+     QHBoxLayout* langToLayout;
+     QHBoxLayout* changelangLayout;
+     QString _langFrom;
+     QString _langTo;
+ /*  QPushButton* browseButton;
+     QLabel* browseLabel;
+     QCheckBox* cacheCheckBox;
+     QHBoxLayout* browseLayout;
+     QHBoxLayout* cacheLayout;
+ */
+ };
+ #endif // GOOGLESETTINGSDIALOG_H
index 0000000,4abd748..7809758
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,70 +1,70 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ /*! \file TranslationXdxf.h
+ */
+ #ifndef TRANSLATIONXDXF_H
+ #define TRANSLATIONXDXF_H
+ #include <QString>
+ #include "../../common/translation.h"
+ #include "xdxfplugin.h"
+ class TranslationXdxf : public Translation
+ {
+ public:
+     TranslationXdxf();
+     TranslationXdxf(QString _key,QString _dictionaryInfo, XdxfPlugin *xdxfPlugin);
+     ~TranslationXdxf();
+     //! \return word to be translated
+     QString key() const;
+     /*! \returns dictionary information (plugin name, languages, <logo> etc)\
+         to be displayed in translation table header*/
+     QString dictionaryInfo() const;
+     //! \return parsed raw format into html
+     QString toHtml() const;
+     /*! sets the word for which we want to find a translation
+         \param word for which we want to find a translation */
+     void setKey(QString);
+     //! sets information about dictionary
+     void setDictionaryInfo(QString);
 -    //! \retrun whether given translation is taken from bookmarks
++    //! \return whether given translation is taken from bookmarks
+     bool isBookmark() const {
+         return _bookmark;
+    }
+     //! returns coresponding dict object
+     uint dict() const {return _dictHash;}
+ private:
+     QString _key;
+     QString _dictionaryInfo;
+     XdxfPlugin *xdxfPlugin;
+     int _dictHash;
+ };
+ #endif // TRANSLATIONXDXF_H
index 0000000,3cf5bf3..7ad2f59
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,84 +1,84 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ /*! \file XdxfCachingDialog.cpp
+ */
+ //Created by Mateusz Półrola
+ #include "XdxfCachingDialog.h"
+ #include "xdxfplugin.h"
+ #include <QDebug>
+ XdxfCachingDialog::XdxfCachingDialog(XdxfPlugin *parent) //:
+ //    QDialog((QWidget*)parent)
+ {
+     verticalLayout = new QVBoxLayout(this);
+     setLayout(verticalLayout);
+     setWindowTitle(tr("Caching dictionary, please wait"));
+     cachingProgressBar = new QProgressBar(this);
+     cachingProgressBar->setMinimum(0);
+     cachingProgressBar->setMaximum(100);
+     cachingProgressBar->setTextVisible(true);
+     cancelButton = new QPushButton(tr("Cancel"),this);
+     cachingLabel = new QLabel(this);
+     cachingLabel->hide();
+     verticalLayout->addWidget(cachingLabel);
+     verticalLayout->addWidget(cachingProgressBar);
+     verticalLayout->addWidget(cancelButton);
+     connect(cancelButton, SIGNAL(clicked()),
+             this, SIGNAL(cancelCaching()));
+    connect(parent, SIGNAL(updateCachingProgress(int, int)),
+            this, SLOT(updateCachingProgress(int, int)));
+     time.start();
+ }
+ void XdxfCachingDialog::updateCachingProgress(int progress, int time) {
+     cachingProgressBar->setValue(progress);
+     if(!cachingLabel->isVisible())
+         cachingLabel->show();
+     int seconds = float((100 - progress)*time) / (5*1000);
+     cachingLabel->setText(tr("Estimated time left: ") +
 -                     /*QString::number(seconds)*/  tr("%n second(s)", "", seconds));
++                          tr("%n second(s)", "", seconds));
+     if(progress >= 100)
+         this->hide();
+         
+ }
+ void XdxfCachingDialog::reject() {
+     return;
+ }
+ void XdxfCachingDialog::cancelButtonClicked(){
+     return;
+ }
index 0000000,19763d6..34649c6
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,55 +1,55 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ /*! \file XdxfDictDialog.h
+ */
+ //Created by Mateusz Półrola
+ #ifndef XDXFDICTDIALOG_H
+ #define XDXFDICTDIALOG_H
+ #include "../../common/DictDialog.h"
+ #include "XdxfLoadDialog.h"
+ class XdxfPlugin;
+ //! Implementation of DictDialog interface for xdxf plugin
+ class XdxfDictDialog : public DictDialog {
+     Q_OBJECT
+ public:
+     explicit XdxfDictDialog(XdxfPlugin* plugin, QObject *parent = 0);
+     /*!
 -      Shows add new xdxf dictionary dialog and returns settings of new dict
++      Shows "add new xdxf dictionary" dialog and returns settings of new dict
+       \param parent parent widget on which dialog will be displayed
+       */
+     Settings* addNewDictionary(QWidget *parent);
+     /*!
 -      Shows settings dialog and save new settings in plugin
++      Shows settings dialog and saves new settings in plugin
+       \param parent parent widget on which dialog will be displayed
+       */
+     void changeSettings(QWidget *parent);
+ private:
+     XdxfPlugin* plugin;
+ };
+ #endif // XDXFDICTDIALOG_H
index 0000000,2c6d47f..6d1129f
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,72 +1,72 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ /*! \file XdxfLoadDialog.h
+ */
+ //Created by Mateusz Półrola
+ #ifndef XDXFLOADDIALOG_H
+ #define XDXFLOADDIALOG_H
+ #include <QDialog>
+ #include <QtGui>
+ #include "../../common/settings.h"
+ //! Displays dialog which allows user to add new xdxf dictionary
+ class XdxfLoadDialog : public QDialog {
+     Q_OBJECT
+ public:
+     explicit XdxfLoadDialog(QWidget *parent = 0);
+     /*! Displays dialog and returns settings of new dictionary
 -        \return Setting object containing new dictionary settings or NULL in
++        \return Settings object containing new dictionary settings or NULL in
+         case user cancels dialog
+     */
+     static Settings* getSettings(QWidget *parent);
+     //! Returns dictionary file path chosen by user
+     QString dicitonaryFilePath();
+     //! Returns if user wants to cache dictionary
+     bool generateCache();
+ signals:
+ public slots:
+ private Q_SLOTS:
+     void selectFile();
+     void addDictionary();
+ private:
+     QPushButton* addButton;
+     QPushButton* browseButton;
+     QLabel* browseLabel;
+     QCheckBox* cacheCheckBox;
+     QCheckBox* accentsCheckBox;
+     QVBoxLayout* verticalLayout;
+     QVBoxLayout* browseLayout;
+     QHBoxLayout* cacheLayout;
+     QString _dicitonaryFilePath;
+     bool _generateCache;
+ };
+ #endif // XDXFLOADDIALOG_H
index 0000000,e825772..23444a0
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,182 +1,181 @@@
+ /*******************************************************************************
+     This file is part of mDictionary.
+     mDictionary is free software: you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation, either version 3 of the License, or
+     (at your option) any later version.
+     mDictionary is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+     You should have received a copy of the GNU General Public License
+     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+     Copyright 2010 Comarch S.A.
+ *******************************************************************************/
+ /*! \file xdxfplugin.h
+ */
+ #ifndef XDXFPLUGIN_H
+ #define XDXFPLUGIN_H
+ #include <QObject>
+ #include <QDialog>
+ #include <QRegExp>
+ #include <QTime>
+ #include <QSqlQuery>
+ #include <QSqlDatabase>
+ #include <QSqlError>
+ #include <QFile>
+ #include <QXmlStreamReader>
+ #include <QtPlugin>
+ #include "../../common/CommonDictInterface.h"
+ #include "../../common/settings.h"
+ #include "XdxfDictDialog.h"
+ #include "XdxfCachingDialog.h"
+ #include "TranslationXdxf.h"
+ class TranslationXdxf;
+ class XdxfPlugin : public CommonDictInterface
+ {
+     Q_OBJECT
+     Q_INTERFACES(CommonDictInterface)
+ public:
+     XdxfPlugin(QObject *parent=0);
+     ~XdxfPlugin();
+     //! returns source language code iso 639-2
+     QString langFrom() const;
+     //! returns destination language code iso 639-2
+     QString langTo() const;
+     //! returns dictionary name (like "old English" or so)
+     QString name() const;
+     //! returns dictionary type (xdxf, google translate, etc)
+     QString type() const;
+     //! returns information about dictionary in html (name, authors, etc)
+     QString infoNote() const;
+     /*! returns DictDialog object that creates dialogs
+         for adding new dictionary and changing plugin things
+       */
+     DictDialog* dictDialog();
 -    //! returns new, clean copy of plugin with setting set as in Settings*
++    //! returns new, clean copy of plugin with settings set as in Settings*
+     CommonDictInterface* getNew(const Settings*) const;
+     //! returns whether plugin can start searching
+     bool isAvailable() const;
+     //! returns a description of a word given by a QString
+     QString search(QString key);
+     //! returns a unique hash for a dictionary
+     uint hash() const;
 -    //! sets unique value (unique for every dictionary not plugin)
++    //! sets unique value (unique for every dictionary, not plugin)
+     void setHash(uint);
+     //! returns current plugin settings
+     Settings* settings();
+     //! returns words count in dictionary
+     long wordsCount();
+     //! Sets new settings
+     void setSettings(const Settings*);
+     //! returns plugin icon
+     QIcon* icon();
 -    /*! plugin should delete any files (eg. cache) that has created and be ready
++    /*! plugin should delete any files (eg. cache) that have been created and are ready
+         to be deleted
+         */
+     void clean();
+ public Q_SLOTS:
+     /*! performs search in dictionary
+       \param  word word to search in dictionary
+       \param limit limit on number of results
+       After finishing search it has to emit
+       \see CommonDictInterface:finalTranslation  finalTranslation
+     */
+     QList<Translation*> searchWordList(QString word, int limit=0);
+     //! stop current operation
+     void stop();
+ Q_SIGNALS:
+     //! emitted with percent count of caching progress, and time elapsed from
+     //! last signal emit
+     void updateCachingProgress(int, int);
+ private:
+ /*! returns true or false depending on whether the dictionary is cached
+     or not, not implemented yet
+  */
+     bool isCached();
+ //! sets the path to dictionary file and adds it to settings
+  //   void setPath(QString);
+     QList<Translation*> searchWordListCache(QString word, int limit=0);
+     QList<Translation*> searchWordListFile(QString word, int limit=0);
+     QString searchFile(QString key);
+     QString searchCache(QString key);
 -
 -    //! scan dictionary file to get information about it
++    //! scans dictionary file to get information about it
+     void getDictionaryInfo();
+     int countWords();
+     bool makeCache(QString dir);
+     //! language from which we translate
+     QString _langFrom;
+     //! language to which we translate
+     QString _langTo;
+     //! name of a dictionary
+     QString _name;
+     //! information about dictionary
+     QString _infoNote;
+     //! path to dictionary file
+  //   QString path;
+     uint _hash;
+     QIcon _icon;
+     QSqlDatabase db;
+     QString db_name;
+     //! number of words in dictionary
+     long _wordsCount;
+     volatile bool stopped;
+     Settings *_settings;
+     XdxfDictDialog* _dictDialog;
+     XdxfCachingDialog* cachingDialog;
+ };
+ #endif // XDXFPLUGIN_H