Merge branch 'master' of ssh://drop.maemo.org/git/mdictionary
authorMateusz Półrola <mateusz.polrola@comarch.pl>
Tue, 7 Sep 2010 06:37:51 +0000 (08:37 +0200)
committerMateusz Półrola <mateusz.polrola@comarch.pl>
Tue, 7 Sep 2010 06:37:51 +0000 (08:37 +0200)
1  2 
src/plugins/google/GooglePlugin.cpp
src/plugins/xdxf/XdxfLoadDialog.cpp
src/plugins/xdxf/XdxfLoadDialog.h
src/plugins/xdxf/XdxfSettingsDialog.h
src/plugins/xdxf/xdxfplugin.cpp

@@@ -35,7 -35,7 +35,7 @@@ GooglePlugin::GooglePlugin(QObject *par
      _settings->setValue("type","google");
      _settings->setValue("connection_accepted","true");
      _dictDialog = new GoogleDictDialog(this,this);
 -    _icon = QIcon(":/icons/drawing.png");
 +    _icon = QIcon("/usr/share/mdictionary/google.png");
  
      stopped = false;
      languages=initLanguages();
@@@ -116,6 -116,7 +116,7 @@@ void GooglePlugin::setConnectionAccept(
          _settings->setValue("connection_accepted","false");
  }
  
  bool GooglePlugin::isConnectionAccept() const {
      if(_settings->value("connection_accepted")=="true")
          return true;
  }
  
  
- 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;
  }
  
@@@ -32,22 -32,21 +32,22 @@@ XdxfLoadDialog::XdxfLoadDialog(QWidget 
  
      setWindowTitle(tr("Add new XDXF dictionary"));
  
 -    browseLayout = new QVBoxLayout;
 +
 +
 +    browseLayout = new QHBoxLayout;
  
      browseButton =  new QPushButton(tr("Browse"));
      browseLabel = new QLabel(tr("Dictionary file: not selected"));
 -    //browseLabel->setWordWrap(true);
 -    browseLabel->setMargin(5);
 +    //browseLabel->setMargin(5);
  
      browseLayout->addWidget(browseLabel, 0, Qt::AlignLeft);
 -    browseLayout->addWidget(browseButton);
 +    browseLayout->addWidget(browseButton, 0, Qt::AlignRight);
  
      verticalLayout->addLayout(browseLayout);
  
      cacheLayout = new QHBoxLayout;
      verticalLayout->addLayout(cacheLayout);
 -    accentsCheckBox = new QCheckBox(tr("Strip accents \n(searching takes more "
 +    accentsCheckBox = new QCheckBox(tr("Strip accents (searching takes more "
                   "time, but spelling don't have to be exact)"));
      verticalLayout->addWidget(accentsCheckBox);
  
@@@ -86,7 -85,7 +86,7 @@@ void XdxfLoadDialog::setAccents(bool st
  void XdxfLoadDialog::selectFile() {
      QString fileName = QFileDialog::getOpenFileName(this,
                                       tr("Select dictionary file"),
 -                                     "",
 +                                     _dicitonaryFilePath,
                                       tr("XDXF Files (*.xdxf)"),
                                       NULL,
                                       NULL);
@@@ -103,9 -102,6 +103,6 @@@ void XdxfLoadDialog::addDictionary() 
      if(!_dicitonaryFilePath.isEmpty()) {
          accept();
      }
-     else {
-         reject();
-     }
  }
  
  QString XdxfLoadDialog::dicitonaryFilePath() {
@@@ -47,10 -47,6 +47,6 @@@ public
      //! Returns if user wants to cache dictionary
      bool generateCache();
  
- signals:
- public slots:
  private Q_SLOTS:
      void selectFile();
      void addDictionary();
@@@ -64,7 -60,7 +60,7 @@@ private
      QCheckBox* cacheCheckBox;
      QCheckBox* accentsCheckBox;
      QVBoxLayout* verticalLayout;
 -    QVBoxLayout* browseLayout;
 +    QHBoxLayout* browseLayout;
      QHBoxLayout* cacheLayout;
      QString _dicitonaryFilePath;
      bool _generateCache;
@@@ -35,42 -35,35 +35,42 @@@ class XdxfSettingsDialog : public QDial
      Q_OBJECT
  public:
      explicit XdxfSettingsDialog(XdxfPlugin* plugin, QWidget *parent = 0);
+     //! \returns settings of a given plugin
      static Settings* getSettings(XdxfPlugin* plugin, QWidget *parent);
  
-     //! Returns dictionary file path chosen by user
+     //! \returns dictionary file path chosen by user
      QString dicitonaryFilePath();
  
-     //! Returns if user wants to cache dictionary
+     //! \returns if user wants to cache dictionary
      bool generateCache();
  
  private Q_SLOTS:
 -    void selectFile();
      void setGenerateCache(bool);
      void setAccents(bool);
  
  private:
      QLabel* infoLabel;
      QPushButton* saveButton;
 -    QPushButton* browseButton;
 -    QLabel* browseLabel;
 +
 +
      QCheckBox* cacheCheckBox;
      QCheckBox* accentsCheckBox;
 -    QVBoxLayout* verticalLayout;
 -    QHBoxLayout* browseLayout;
 +
      QHBoxLayout* cacheLayout;
 +    QHBoxLayout* accentsLayout;
 +
 +    QToolButton* cacheToolButton;
 +    QToolButton* accentsToolButton;
 +
 +    QVBoxLayout* verticalLayout;
 +
      QString _dicitonaryFilePath;
      bool _generateCache;
      XdxfPlugin* plugin;
      bool lastAccents;
  
 +    QScrollArea* scrollArea;
 +
  };
  
  #endif // XDXFSETTINGSDIALOG_H
@@@ -34,7 -34,7 +34,7 @@@ XdxfPlugin::XdxfPlugin(QObject *parent
      cachingDialog = new XdxfCachingDialog(this);
  
      _settings->setValue("type","xdxf");
 -    _icon = QIcon(":/icons/xdxf.png");
 +    _icon = QIcon("/usr/share/mdictionary/xdxf.png");
      _wordsCount = -1;
      stopped = false;
  
@@@ -87,7 -87,7 +87,7 @@@ QString XdxfPlugin::type() const 
  
  
  QString XdxfPlugin::infoNote() const {
-     return  _infoNote;
+     return _infoNote;
  }
  
  
@@@ -146,7 -146,7 +146,7 @@@ QList<Translation*> XdxfPlugin::searchW
          if(ok) {  /*add key word to list*/
              translations.insert(new TranslationXdxf(
                      cur.value(0).toString().toLower(),
-                     _infoNote, this));
+                     _dictionaryInfo, this));
              i++;
          }
      }
@@@ -197,7 -197,7 +197,7 @@@ QList<Translation*> XdxfPlugin::searchW
                  }
                  if(ok) {  /*add key word to list*/
                      translations<<(new TranslationXdxf(readKey.toLower(),
-                                     _infoNote,this));
+                                     _dictionaryInfo,this));
                      i++;
                  }
                  if(i>=limit && limit!=0)
@@@ -338,24 -338,7 +338,7 @@@ bool XdxfPlugin::isAvailable() const 
  }
  
  
- void XdxfPlugin::setHash(uint _hash) {
-     this->_hash=_hash;
- }
- uint XdxfPlugin::hash() const {
-    return _hash;
- }
  Settings* XdxfPlugin::settings() {
- /*
-     Settings *returnSettings=new Settings;
-     QStringList list = _settings->keys();
-     foreach(QString key, list)
-             returnSettings->setValue(key,_settings->value(key));
-     return returnSettings;
- */
      return _settings;
  }
  
@@@ -453,10 -436,9 +436,9 @@@ bool XdxfPlugin::getDictionaryInfo() 
      if(reader.name()=="description")
          _infoNote=reader.readElementText();
  
-     QString initialPath = "/usr/share/mdictionary/xdxf.png";
-     _infoNote=" path=\""+initialPath+"\"> \n" + _name + " [" + _langFrom + "-"
+     _dictionaryInfo= _name + " [" + _langFrom + "-"
                  + _langTo + "]";
      dictionaryFile.close();
      if(okFormat)
          return true;