Merge branch 'http' of ssh://drop.maemo.org/git/mdictionary into http
authorPrzemyslaw Wojtysiak <pwojtysiak88@gmail.com>
Tue, 5 Oct 2010 06:56:05 +0000 (08:56 +0200)
committerPrzemyslaw Wojtysiak <pwojtysiak88@gmail.com>
Tue, 5 Oct 2010 06:56:05 +0000 (08:56 +0200)
1  2 
src/plugins/xdxf/XdxfDialog.cpp

@@@ -54,6 -54,12 +54,12 @@@ XdxfDialog::XdxfDialog(XdxfPlugin *plug
      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"));
      cacheCheckBox = new QCheckBox(tr("Optimize"));
      cacheCheckBox->setToolTip(cacheToolTip);
      cacheLayout->addWidget(cacheCheckBox);
 +
      #ifdef Q_WS_MAEMO_5
          cacheInfoToolButton = new QToolButton;
          cacheInfoToolButton->setIcon(QIcon::fromTheme("general_information"));
          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
@@@ -221,6 -243,11 +244,11 @@@ void XdxfDialog::selectFile() 
      }
  }
  
+ void XdxfDialog::downloadFile() {
+    qDebug()<<"a";
+    XdxfPlugin::dictDownloader.download(this);
+ }
  void XdxfDialog::saveSettings() {
      _settings = new Settings;
      if(plugin) {