* @brief Handles changes to the selected profile in the profile combo box. * @details Ignores the event during a fresh start or when the selected profile * matches the current profile. Otherwise, it clears the password field, updates * the active profile and related settings, refreshes the environment, and * resets the tree view and action states to reflect the newly selected profile. * * @p
| 1046 | * |
| 1047 | */ |
| 1048 | void MainWindow::on_profileBox_currentTextChanged(const QString &name) { |
| 1049 | #endif |
| 1050 | if (m_qtPass->isFreshStart() || name == QtPassSettings::getProfile()) { |
| 1051 | return; |
| 1052 | } |
| 1053 | |
| 1054 | ui->lineEdit->clear(); |
| 1055 | |
| 1056 | QtPassSettings::setProfile(name); |
| 1057 | |
| 1058 | QtPassSettings::setPassStore( |
| 1059 | QtPassSettings::getProfiles().value(name).value("path")); |
| 1060 | QtPassSettings::setPassSigningKey( |
| 1061 | QtPassSettings::getProfiles().value(name).value("signingKey")); |
| 1062 | ui->statusBar->showMessage(tr("Profile changed to %1").arg(name), 2000); |
| 1063 | |
| 1064 | QtPassSettings::getPass()->updateEnv(); |
| 1065 | |
| 1066 | const QString passStore = QtPassSettings::getPassStore(); |
| 1067 | proxyModel.setStore(passStore); |
| 1068 | ui->treeView->setRootIndex( |
| 1069 | proxyModel.mapFromSource(model.setRootPath(passStore))); |
| 1070 | deselect(); |
| 1071 | ui->treeView->setCurrentIndex(QModelIndex()); |
| 1072 | } |
| 1073 | |
| 1074 | /** |
| 1075 | * @brief MainWindow::initTrayIcon show a nice tray icon on systems that |
nothing calls this directly
no test coverage detected