1 #include "selectremotedlg.h"
9 #include <QListWidgetItem>
13 #include <QMessageBox>
14 #include <QPushButton>
16 SelectRemoteDlg::SelectRemoteDlg(QWidget *parent)
19 this->setWindowTitle(tr("Select remote"));
20 this->setMinimumHeight(320);
22 layout = new QHBoxLayout(this);
24 alphabetList = new QListWidget(this);
25 alphabetList->setMaximumWidth(96);
26 layout->addWidget(alphabetList);
27 connect(alphabetList, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
28 this, SLOT(alphabetItemChanged(QListWidgetItem*, QListWidgetItem*)));
30 mfgList = new QListWidget(this);
31 layout->addWidget(mfgList);
32 connect(mfgList, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
33 this, SLOT(mfgItemChanged(QListWidgetItem*, QListWidgetItem*)));
35 modelList = new QListWidget(this);
36 layout->addWidget(modelList);
38 downloadBtn = new QPushButton(tr("Download"), this);
39 layout->addWidget(downloadBtn);
40 connect(downloadBtn, SIGNAL(clicked()),
41 this, SLOT(downloadRemote()));
43 this->setLayout(layout);
47 SelectRemoteDlg::~SelectRemoteDlg()
52 void SelectRemoteDlg::setBusy(bool busy)
54 setAttribute(Qt::WA_Maemo5ShowProgressIndicator, busy);
58 void SelectRemoteDlg::alphabetItemChanged(QListWidgetItem *current,
59 QListWidgetItem * /*previous*/)
65 mfgList->addItems(remoteDb[current->text()].keys());
69 void SelectRemoteDlg::mfgItemChanged(QListWidgetItem *current,
70 QListWidgetItem * /*previous*/)
75 QList <Remote> remotes =
76 remoteDb[alphabetList->currentItem()->text()][current->text()];
77 foreach(Remote remote, remotes) {
78 modelList.addItem(RemoteListWidgetItem(remote));
83 void SelectRemoteDlg::downloadRemote()
85 RemoteListWidgetItem *currentModel = modelList->currentItem();
88 currentModel->remote().saveFile();