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()
45 void PIRSelectKeysetForm::addNameToList(
50 ui->keysetListWidget->addItem(new PIRKeysetWidgetItem(name, index, make));
54 void PIRSelectKeysetForm::addWidgetItem(
55 PIRKeysetWidgetItem *kwi)
57 ui->keysetListWidget->addItem(kwi);
60 QListWidget *PIRSelectKeysetForm::getKeysetListWidget()
62 return ui->keysetListWidget;
65 void PIRSelectKeysetForm::filterListByMake(
68 currentMake = (PIRMakeName) make;
72 void PIRSelectKeysetForm::refilterList()
75 int count = ui->keysetListWidget->count();
76 PIRKeysetWidgetItem *item;
79 item = dynamic_cast<PIRKeysetWidgetItem *>(
80 ui->keysetListWidget->item(index));
82 // Does the keylist have the required make?
83 if ((currentMake == Any_Make) || (item->getMake() == currentMake))
85 // Yes, we can show this keylist:
86 item->setHidden(false);
90 item->setHidden(true);