1 #include "pirselectkeysetform.h"
2 #include "ui_pirselectkeysetform.h"
3 #include "pirkeysetwidgetitem.h"
6 extern PIRMakeMgr makeManager;
8 PIRSelectKeysetForm::PIRSelectKeysetForm(
11 ui(new Ui::PIRSelectKeysetForm),
16 setAttribute(Qt::WA_Maemo5StackedWindow);
17 setWindowFlags(windowFlags() | Qt::Window);
19 // push the list of makers into the make combo box:
20 makeManager.populateComboBox(ui->makeComboBox);
22 // Connection telling main window that keyset has been selected:
25 SIGNAL(itemActivated(QListWidgetItem *)),
27 SLOT(keysetSelectionChanged(QListWidgetItem *)),
28 Qt::QueuedConnection);
30 // Connection used to filter keyset list:
33 SIGNAL(currentIndexChanged(int)),
35 SLOT(filterListByMake(int)),
36 Qt::QueuedConnection);
39 PIRSelectKeysetForm::~PIRSelectKeysetForm()
44 void PIRSelectKeysetForm::addNameToList(
49 ui->keysetListWidget->addItem(new PIRKeysetWidgetItem(name, index, make));
52 void PIRSelectKeysetForm::addWidgetItem(
53 PIRKeysetWidgetItem *kwi)
55 ui->keysetListWidget->addItem(kwi);
58 QListWidget *PIRSelectKeysetForm::getKeysetListWidget()
60 return ui->keysetListWidget;
63 void PIRSelectKeysetForm::filterListByMake(
66 currentMake = (PIRMakeName) make;
70 void PIRSelectKeysetForm::refilterList()
73 int count = ui->keysetListWidget->count();
74 PIRKeysetWidgetItem *item;
77 item = dynamic_cast<PIRKeysetWidgetItem *>(
78 ui->keysetListWidget->item(index));
80 // Does the keylist have the required make?
81 if ((currentMake == Any_Make) || (item->getMake() == currentMake))
83 // Yes, we can show this keylist:
84 item->setHidden(false);
88 item->setHidden(true);