setAttribute(Qt::WA_Maemo5StackedWindow);
// Collect the keysets:
- myKeysets = new PIRKeysetManager(this);
+ myKeysets = new PIRKeysetManager();
// Set up the keyset selection window:
selectKeysetForm = new PIRSelectKeysetForm(this);
}
enableButtons();
- secondaryForm->enableButtons(myKeysets, currentKeyset);
connect(
ui->favoriteKeysetsWidget,
-// SIGNAL(itemActivated(QListWidgetItem *)),
- SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
+ SIGNAL(itemActivated(QListWidgetItem *)),
this,
SLOT(keysetSelectionChanged(QListWidgetItem *)),
Qt::QueuedConnection);
void MainWindow::enableButtons()
{
+ // Just to be sure, check to see if the keyset has been populated:
+ myKeysets->populateKeyset(this, currentKeyset);
+
// This is going to be a little painful...
// Main keys
emit powerEnabled(myKeysets->hasKey(currentKeyset, Power_Key));
emit pauseEnabled(myKeysets->hasKey(currentKeyset, Pause_Key));
emit stopEnabled(myKeysets->hasKey(currentKeyset, Stop_Key));
emit ejectEnabled(myKeysets->hasKey(currentKeyset, Eject_Key));
+
+ // Also enable the buttons on the secondary form:
+ secondaryForm->enableButtons(myKeysets, currentKeyset);
}
void MainWindow::keysetSelectionChanged(
QListWidgetItem *item)
{
- if (!item) return; // Should probably say something here!
+ if (!item) return; // Should probably display error message here!
PIRKeysetWidgetItem *kwi = dynamic_cast<PIRKeysetWidgetItem *>(item);
if (!kwi) return; // Also need to say something here
+
+ if (currentKeyset == kwi->getID())
+ {
+ // We're already on that keyset, so nothing to do:
+ return;
+ }
currentKeyset = kwi->getID();
myKeysets->getDisplayName(currentKeyset));
enableButtons();
- secondaryForm->enableButtons(myKeysets, currentKeyset);
}
position,
QItemSelectionModel::ClearAndSelect);
+ keysetSelectionChanged(ui->favoriteKeysetsWidget->currentItem());
+
// Tell the user about the change:
QMaemo5InformationBox::information(
0,
position,
QItemSelectionModel::ClearAndSelect);
+ keysetSelectionChanged(ui->favoriteKeysetsWidget->currentItem());
+
// Tell the user about the change:
QMaemo5InformationBox::information(
0,