XdxfDictSelectDialog::XdxfDictSelectDialog(QList<DownloadDict> dicts,
QWidget *parent) :
QDialog(parent) {
+
+
setWindowTitle(tr("Select dictionary"));
+ //here removing already added dictionary
+ for (int i = 0; i < dicts.size(); i++){
+ if(QFile::exists(QDir::homePath() + "/.mdictionary/" + dicts[i].title() + ".xdxf")){
+ dicts.removeAt(i);
+ i--;
+ }
+ }
+
+#ifndef Q_WS_MAEMO_5
+ model2 = new DictsListModel(dicts, this);
+ proxyModel2 = new DictsProxyListModel;
+ proxyModel2->setSourceModel(model2);
+ proxyModel2->setTo("Polish");
+ view= new QDeclarativeView();
+ QDeclarativeContext* ctxt=view->rootContext();
+ ctxt->setContextProperty("dictModel", proxyModel2);
+ view->setSource(QUrl::fromLocalFile("/usr/share/mdictionary/qml/TableWidget.qml"));
+ view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ view->setAlignment(Qt::AlignCenter);
+
+ mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(view);
+ this->setLayout(mainLayout);
+ proxyModel2->setTo("English");
+
+ QGraphicsObject *rootObject = view->rootObject();
+
+ connect(rootObject,SIGNAL(dictLink(QString)),
+ this,SLOT(itemClicked(QString)));
+#else
+
layout = new QVBoxLayout;
setLayout(layout);
checkBoxLayout->addWidget(langToLabel);
checkBoxLayout->addWidget(langTo, 10);
- //here removing already added dictionary
-
- for (int i = 0; i < dicts.size(); i++){
- if(QFile::exists(QDir::homePath() + "/.mdictionary/" + dicts[i].title() + ".xdxf")){
- dicts.removeAt(i);
- i--;
- }
- }
-
model = new DictsModel(dicts, this);
proxyModel = new DictsProxyModel;
#endif
initializeDicts();
+ #endif
}
void XdxfDictSelectDialog::refreshDictList() {
+#ifndef Q_WS_MAEMO_5
+
+
+#else
+
//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());
proxyModel->setFrom(QString());
else
proxyModel->setFrom(langFrom->currentText());
+
+#endif
}
+void XdxfDictSelectDialog::itemClicked(QString link) {
+#ifndef Q_WS_MAEMO_5
+ _link = link;
+ accept();
+#endif
+}
+
void XdxfDictSelectDialog::itemClicked(QModelIndex index) {
+#ifdef Q_WS_MAEMO_5
_link = index.model()->data(index, Qt::UserRole).toString();
accept();
+#endif
}