if(type == New) {
connect(browseButton, SIGNAL(clicked()),
this, SLOT(selectFile()));
+
+ connect(downloadButton, SIGNAL(clicked()),
+ this, SLOT(downloadFile()));
+
+ connect(&XdxfPlugin::dictDownloader, SIGNAL(fileDownloaded(QString)),
+ this, SLOT(fileDownloaded(QString)));
}
connect(confirmButton, SIGNAL(clicked()),
}
+void XdxfDialog::fileDownloaded(QString name) {
+ infoLabel->setText(tr("Dictionary file: %1").arg(XdxfPlugin::dictDownloader.downloadedFile()));
+ _dictionaryFilePath = XdxfPlugin::dictDownloader.downloadedFile();
+ updateGeometry();
+}
+
void XdxfDialog::initializeUI() {
mainVerticalLayout = new QVBoxLayout;
setWindowTitle(tr("Add new XDXF dictionary"));
browseLayout = new QHBoxLayout;
+
+ QHBoxLayout* buttonLayout = new QHBoxLayout;
browseButton = new QPushButton(tr("Browse"));
+ browseButton->setMaximumWidth(100);
+
+ downloadButton = new QPushButton(tr("Download"));
+ downloadButton->setMaximumWidth(150);
+
+ infoLayout = new QHBoxLayout;
+ infoLayout->addWidget(infoLabel,0,Qt::AlignLeft);
infoLabel->setText(tr("Dictionary file: not selected"));
- browseLayout->addWidget(infoLabel, 0, Qt::AlignLeft);
- browseLayout->addWidget(browseButton, 0, Qt::AlignRight);
+ browseLayout->addLayout(buttonLayout);
+ buttonLayout->addWidget(browseButton);
+ buttonLayout->addWidget(downloadButton);
mainVerticalLayout->addLayout(browseLayout);
+ mainVerticalLayout->addLayout(infoLayout);
}
else {
setWindowTitle(tr("XDXF Settings"));
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
#else
if(type==New) {
- infoLabel->setMinimumWidth(200);
+ infoLabel->setMinimumWidth(550);
setMinimumSize(sizeHint().width()*1.5, sizeHint().height()*1.2);
setMaximumSize(sizeHint().width()*1.7, sizeHint().height()*1.5);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setLayout(layout);
#ifndef Q_WS_MAEMO_5
- setMinimumSize(400,200);
+ setMinimumSize(600,200);
#else
setMinimumHeight(350);
#endif
}
}
+void XdxfDialog::downloadFile() {
+ qDebug()<<"a";
+ XdxfPlugin::dictDownloader.download(this);
+}
+
void XdxfDialog::saveSettings() {
_settings = new Settings;
if(plugin) {