setWindowTitle(tr("Dictionaries"));
this->guiInterface = parent;
+ #ifndef Q_WS_MAEMO_5
+ model = 0;
+ #endif
initalizeUI();
setModal(true);
verticalLayout = new QVBoxLayout;
setLayout(verticalLayout);
+ #ifndef Q_WS_MAEMO_5
+ qmlView = new QDeclarativeView(this);
+ qmlView->setSource(QUrl::fromLocalFile("/usr/share/mdictionary/qml/DictManagerWidget.qml"));
+ ctxt = qmlView->rootContext();
+
+ refreshDictsList();
+ ctxt->setContextProperty("dictModel", &(*model));
+
+ QGraphicsObject *rootObject = qmlView->rootObject();
+ //connect(rootObject, SIGNAL(selectedRow(int)),
+ // this, SLOT(pluginSelected(int)));
+
+ qmlView->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ verticalLayout->addWidget(qmlView);
+
+ //connecty zwrotne
+ #endif
+
+ #ifdef Q_WS_MAEMO_5
dictList = new QListWidget;
verticalLayout->addWidget(dictList);
connect(dictList, SIGNAL(itemChanged(QListWidgetItem*)),
this, SLOT(changed()));
+ #endif
#ifndef Q_WS_MAEMO_5
- connect(dictList, SIGNAL(itemActivated(QListWidgetItem*)),
- this, SLOT(saveChanges()));
- connect(dictList, SIGNAL(itemActivated(QListWidgetItem*)),
- this, SLOT(itemSelected(QListWidgetItem*)));
- connect(dictList, SIGNAL(itemActivated(QListWidgetItem*)),
- settingsButton, SIGNAL(clicked()));
+ //pozmieniać connecty
+// connect(dictList, SIGNAL(itemActivated(QListWidgetItem*)),
+// this, SLOT(saveChanges()));
+// connect(dictList, SIGNAL(itemActivated(QListWidgetItem*)),
+// this, SLOT(itemSelected(QListWidgetItem*)));
+// connect(dictList, SIGNAL(itemActivated(QListWidgetItem*)),
+// settingsButton, SIGNAL(clicked()));
#endif
+ #ifdef Q_WS_MAEMO_5
refreshDictsList();
+ #endif
#ifndef Q_WS_MAEMO_5
setMinimumSize(500,300);
- closeButton = new QPushButton(tr("Save"));
- buttonGroup->addWidget(closeButton);
-
- setMinimumWidth(sizeHint().width()*1.2);
- setMaximumWidth(sizeHint().width()*2);
- setMinimumHeight(sizeHint().height());
- setMaximumHeight(sizeHint().height()*2);
- connect(closeButton, SIGNAL(clicked()), this, SLOT(save()));
+ //closeButton = new QPushButton(tr("Save"));
+ //buttonGroup->addWidget(closeButton);
+
+// setMinimumWidth(sizeHint().width()*1.2);
+// setMaximumWidth(sizeHint().width()*2);
+// setMinimumHeight(sizeHint().height());
+// setMaximumHeight(sizeHint().height()*2);
+ //connect(closeButton, SIGNAL(clicked()), this, SLOT(save()));
#endif
}
void DictManagerWidget::refreshDictsList() {
+ #ifndef Q_WS_MAEMO_5
+ QHash<CommonDictInterface*, bool> dicts = guiInterface->getDictionaries();
+
+ if (model == 0){
+ qDebug("ok");
+ model = new DictManagerModel(dicts, this);
+ } else {
+ qDebug("lol");
+ model->clear();
+ model->setDictionaries(dicts);
+ }
+
+ #endif
+
+ #ifdef Q_WS_MAEMO_5
dictList->clear();
dictsHash.clear();
removeDictButton->setEnabled(false);
while(i.hasNext()) {
i.next();
+
QListWidgetItem* item = new QListWidgetItem();
QString name;
if (i.key()->type() == "stardict") {
}
dictList->sortItems();
+ #endif
}
void DictManagerWidget::showEvent(QShowEvent *e) {