Fix remaining review threads on the alts search controls

- Disable keyboard tracking on the depth and window spin boxes so typing a
  two-digit value sends one search, not one per digit.
- Reload the user under investigation on a filter change instead of reading
  the search box, which could switch to a name never submitted.
- Keep a chip's last match count while it is unchecked; the server omits
  unchecked match types, so the label used to drop to "(0)".
This commit is contained in:
Lukas Brübach 2026-11-01 06:02:50 +01:00
parent a82d8f3021
commit a1a5aae467
2 changed files with 23 additions and 5 deletions

View file

@ -95,6 +95,7 @@ TabAlts::TabAlts(TabSupervisor *_tabSupervisor, AbstractClient *_client, const Q
depthSpin->setMinimum(1);
depthSpin->setMaximum(MAX_ALT_DEPTH);
depthSpin->setValue(1);
depthSpin->setKeyboardTracking(false);
connect(depthSpin, &QSpinBox::valueChanged, this, &TabAlts::onSearchFilterChanged);
investigateButton = new QPushButton;
@ -145,6 +146,7 @@ TabAlts::TabAlts(TabSupervisor *_tabSupervisor, AbstractClient *_client, const Q
monthsSpin->setMinimum(1);
monthsSpin->setMaximum(24);
monthsSpin->setValue(6);
monthsSpin->setKeyboardTracking(false);
connect(monthsSpin, &QSpinBox::valueChanged, this, &TabAlts::onSearchFilterChanged);
auto *filterBar = new QHBoxLayout;
@ -355,12 +357,17 @@ void TabAlts::investigateUser()
}
currentUser = userName;
updateTrail();
reloadCurrentUser();
}
void TabAlts::reloadCurrentUser()
{
lastAlts.clear();
selectedUser.clear();
clearDetails();
altsTable->setRowCount(0);
statusLabel->setText(tr("Loading alts for %1...").arg(currentUser));
requestAlts(userName, depthSpin->value());
requestAlts(currentUser, depthSpin->value());
}
void TabAlts::requestAlts(const QString &userName, int depth)
@ -445,9 +452,17 @@ void TabAlts::renderTable()
++ipCount;
}
}
// The server omits unchecked match types, so keep the last count while a
// chip is off instead of relabelling it "(0)".
if (emailChip->isChecked()) {
emailChip->setText(tr("Email (%1)").arg(emailCount));
}
if (clientIdChip->isChecked()) {
clientIdChip->setText(tr("Client ID (%1)").arg(clientIdCount));
}
if (ipChip->isChecked()) {
ipChip->setText(tr("IP (%1)").arg(ipCount));
}
QFont userFont = altsTable->font();
userFont.setBold(true);
@ -538,7 +553,9 @@ void TabAlts::onSearchFilterChanged()
if (currentUser.isEmpty()) {
return;
}
investigateUser();
// A filter change reloads the user being investigated; it must not switch
// to a name that was typed into the search box but never submitted.
reloadCurrentUser();
}
void TabAlts::onDisplayFilterChanged()

View file

@ -55,6 +55,7 @@ private:
void loadUser(const QString &userName);
void goToTrailEntry(const QString &userName);
void updateTrail();
void reloadCurrentUser();
void requestAlts(const QString &userName, int depth);
void requestDetails(const QString &userName);
void clearDetails();