+
+bool PIRSelectKeysetForm::selectNextKeyset()
+{
+ int currentRow = ui->keysetListWidget->currentRow();
+
+ // If we're at the end of the list, give up:
+ if (currentRow >= (ui->keysetListWidget->count() -1))
+ {
+ return false;
+ }
+
+ ui->keysetListWidget->setCurrentRow(
+ currentRow + 1,
+ QItemSelectionModel::ClearAndSelect);
+
+ mainWindow->keysetSelectionChanged(
+ ui->keysetListWidget->currentItem());
+
+ return true;
+}
+
+
+bool PIRSelectKeysetForm::selectPrevKeyset()
+{
+ int currentRow = ui->keysetListWidget->currentRow();
+
+ // If we're at the beginning of the list, give up:
+ if (currentRow <= 0)
+ {
+ return false;
+ }
+
+ ui->keysetListWidget->setCurrentRow(
+ currentRow - 1,
+ QItemSelectionModel::ClearAndSelect);
+
+ mainWindow->keysetSelectionChanged(
+ ui->keysetListWidget->currentItem());
+
+ return true;
+}
+
+
+bool PIRSelectKeysetForm::selectFirstKeyset()
+{
+ if (ui->keysetListWidget->count() == 0)
+ {
+ return false;
+ }
+
+ if (ui->keysetListWidget->currentRow() != 0)
+ {
+ ui->keysetListWidget->setCurrentRow(
+ 0, QItemSelectionModel::ClearAndSelect);
+
+ mainWindow->keysetSelectionChanged(
+ ui->keysetListWidget->currentItem());
+ }
+
+ return true;
+}
+
+
+QString PIRSelectKeysetForm::getCurrentKeysetName()
+{
+ QListWidgetItem *item = ui->keysetListWidget->currentItem();
+
+ if (item)
+ {
+ return item->text();
+ }
+ else
+ {
+ return "";
+ }
+}
+
+
+QString PIRSelectKeysetForm::getKeysetName(
+ unsigned int id)
+{
+ int count = ui->keysetListWidget->count();
+
+ if (count == 0) return "";
+
+ QListWidgetItem *localItem;
+ PIRKeysetWidgetItem *kwi;
+ int row = 0;
+
+ while (row < count)
+ {
+ localItem = ui->keysetListWidget->item(row);
+
+ if (localItem)
+ {
+ kwi = dynamic_cast<PIRKeysetWidgetItem *> (localItem);
+
+ if (kwi->getID() == id)
+ {
+ return kwi->text();
+ }
+ }
+
+ ++row;
+ }
+
+ return "";
+}
+
+
+void PIRSelectKeysetForm::keyPressEvent(
+ QKeyEvent *event)
+{
+ ui->searchStringLineEdit->show();
+ ui->searchStringLineEdit->raise();
+ ui->ssClosePushButton->show();
+
+ ui->searchStringLineEdit->setText(event->text());
+ ui->searchStringLineEdit->setFocus();
+}
+
+
+void PIRSelectKeysetForm::on_searchStringLineEdit_textChanged(
+ const QString &arg1)
+{
+ filterListByString(arg1);
+}
+
+
+void PIRSelectKeysetForm::on_ssClosePushButton_clicked()
+{
+ ui->searchStringLineEdit->hide();
+ ui->searchStringLineEdit->lower();
+ ui->ssClosePushButton->hide();
+ ui->searchStringLineEdit->clear();
+}
+
+