MCPcopy Create free account
hub / github.com/IJHack/QtPass / updateProfileBox

Method updateProfileBox

src/mainwindow.cpp:1004–1027  ·  view source on GitHub ↗

* @brief MainWindow::updateProfileBox update the list of profiles, optionally * select a more appropriate one to view too */

Source from the content-addressed store, hash-verified

1002 * select a more appropriate one to view too
1003 */
1004void MainWindow::updateProfileBox() {
1005 QHash<QString, QHash<QString, QString>> profiles =
1006 QtPassSettings::getProfiles();
1007
1008 if (profiles.isEmpty()) {
1009 ui->profileWidget->hide();
1010 } else {
1011 ui->profileWidget->show();
1012 ui->profileBox->setEnabled(profiles.size() > 1);
1013 ui->profileBox->clear();
1014 QHashIterator<QString, QHash<QString, QString>> i(profiles);
1015 while (i.hasNext()) {
1016 i.next();
1017 if (!i.key().isEmpty()) {
1018 ui->profileBox->addItem(i.key());
1019 }
1020 }
1021 ui->profileBox->model()->sort(0);
1022 }
1023 int index = ui->profileBox->findText(QtPassSettings::getProfile());
1024 if (index != -1) { // -1 for not found
1025 ui->profileBox->setCurrentIndex(index);
1026 }
1027}
1028
1029/**
1030 * @brief MainWindow::on_profileBox_currentIndexChanged make sure we show the

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected