fix small bug(wildcard), and change some comments
[mdictionary] / src / plugins / xdxf / XdxfDictSelectDialog.cpp
index db6505c..8abb1f6 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
-//Created by Mateusz Półrola
+/*!
+    \file XdxfDictSelectDialog.cpp
+    \author Mateusz Półrola <mateusz.polrola@comarch.com>
+*/
 
 #include "XdxfDictSelectDialog.h"
 
 XdxfDictSelectDialog::XdxfDictSelectDialog(QList<DownloadDict> dicts,
                                            QWidget *parent) :
-    QDialog(parent) {
-
-
+                    QDialog(parent) {
     setWindowTitle(tr("Select dictionary"));
 
     layout = new QVBoxLayout;
@@ -56,7 +56,6 @@ XdxfDictSelectDialog::XdxfDictSelectDialog(QList<DownloadDict> dicts,
     proxyModel->setDynamicSortFilter(true);
     proxyModel->setSourceModel(model);
 
-
     treeView = new QTreeView;
     treeView->setModel(proxyModel);
     treeView->setRootIsDecorated(false);
@@ -79,10 +78,8 @@ XdxfDictSelectDialog::XdxfDictSelectDialog(QList<DownloadDict> dicts,
         treeView->setColumnWidth(3, 150);
     #endif
 
-
     layout->addWidget(treeView);
 
-
     connect(langFrom, SIGNAL(currentIndexChanged(int)),
             this, SLOT(refreshDictList()));
 
@@ -103,7 +100,7 @@ XdxfDictSelectDialog::XdxfDictSelectDialog(QList<DownloadDict> dicts,
 
 
 void XdxfDictSelectDialog::initializeDicts() {
-
+    //scan of all languages of dictionaries, using QSet to get only distinct languages
     QSet<QString> languagesFrom;
     QSet<QString> languagesTo;
 
@@ -114,15 +111,19 @@ void XdxfDictSelectDialog::initializeDicts() {
                 model->data(model->index(i, 1, QModelIndex())).toString());
     }
 
+    //removes one dictionary which from and to languages are empty....
+    //bug in site with dictionaries
     languagesFrom.remove(QString());
     languagesTo.remove(QString());
 
+    //sorting of found languages
     QList<QString> langFromList = languagesFrom.toList();
     qSort(langFromList);
 
     QList<QString> langToList = languagesTo.toList();
     qSort(langToList);
 
+    //and adding them to combobox, first item in each combobox is "Any"
     langFrom->addItem(tr("Any"));
     for(int i=0; i < langFromList.count(); i++) {
          langFrom->addItem(langFromList.at(i));
@@ -134,7 +135,9 @@ void XdxfDictSelectDialog::initializeDicts() {
     }
 }
 
+
 void XdxfDictSelectDialog::refreshDictList() {
+    //if selected language is "Any"(index 0), from filter string is set to empty string, proxy model uses empty string as special case and don't filter by this field.
     if(langTo->currentIndex() == 0)
         proxyModel->setTo(QString());
     else
@@ -146,6 +149,7 @@ void XdxfDictSelectDialog::refreshDictList() {
         proxyModel->setFrom(langFrom->currentText());
 }
 
+
 void XdxfDictSelectDialog::itemClicked(QModelIndex index) {
     _link = index.model()->data(index, Qt::UserRole).toString();
     accept();