* @brief Opens and processes the application configuration dialog, then applies * any accepted settings. * @example * config(); * * @return void - This function does not return a value. */
| 287 | * @return void - This function does not return a value. |
| 288 | */ |
| 289 | void MainWindow::config() { |
| 290 | QScopedPointer<ConfigDialog> d(new ConfigDialog(this)); |
| 291 | d->setModal(true); |
| 292 | // Automatically default to pass if it's available |
| 293 | if (m_qtPass->isFreshStart() && |
| 294 | QFile(QtPassSettings::getPassExecutable()).exists()) { |
| 295 | QtPassSettings::setUsePass(true); |
| 296 | } |
| 297 | |
| 298 | if (m_qtPass->isFreshStart()) { |
| 299 | d->wizard(); // does shit |
| 300 | } |
| 301 | if (d->exec()) { |
| 302 | if (d->result() == QDialog::Accepted) { |
| 303 | applyTextBrowserSettings(); |
| 304 | applyWindowFlagsSettings(); |
| 305 | |
| 306 | updateProfileBox(); |
| 307 | const QString passStore = QtPassSettings::getPassStore(); |
| 308 | proxyModel.setStore(passStore); |
| 309 | ui->treeView->setRootIndex( |
| 310 | proxyModel.mapFromSource(model.setRootPath(passStore))); |
| 311 | deselect(); |
| 312 | ui->treeView->setCurrentIndex(QModelIndex()); |
| 313 | |
| 314 | if (m_qtPass->isFreshStart() && !Util::configIsValid()) { |
| 315 | config(); |
| 316 | } |
| 317 | QtPassSettings::getPass()->updateEnv(); |
| 318 | clearPanelTimer.setInterval(MS_PER_SECOND * |
| 319 | QtPassSettings::getAutoclearPanelSeconds()); |
| 320 | m_qtPass->setClipboardTimer(); |
| 321 | |
| 322 | updateGitButtonVisibility(); |
| 323 | updateOtpButtonVisibility(); |
| 324 | updateGrepButtonVisibility(); |
| 325 | if (QtPassSettings::isUseTrayIcon() && tray == nullptr) { |
| 326 | initTrayIcon(); |
| 327 | } else if (!QtPassSettings::isUseTrayIcon() && tray != nullptr) { |
| 328 | destroyTrayIcon(); |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | m_qtPass->setFreshStart(false); |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | /** |
| 337 | * @brief MainWindow::onUpdate do a git pull |
no test coverage detected