void TabContainer::gotoTabByName(const std::string & name){ try { gotoTab(findTab(name)); } catch (const TabContainer::NoSuchTab & ex){ throw ex; } }
void KNoteBook::menuChoiceRedirect(int c) { //debug("ActivatedRedirect: %d", c); if(pnote->tabbar->isTabEnabled(pnote->currentmenu) && sections->at(pnote->currentmenu)->isPageEnabled(c)) { gotoTab(pnote->currentmenu); pnote->currentwiz->gotoPage(c); } }
void NewX509::accept() { x509name xn; on_tabWidget_currentChanged(0); try { xn = getX509name(1); } catch (errorEx &err) { gotoTab(1); QMessageBox msg(QMessageBox::Warning, XCA_TITLE, err.getString(), QMessageBox::NoButton, this); msg.addButton(QMessageBox::Ok); msg.addButton(QMessageBox::Close)->setText(tr("Abort rollout")); if (msg.exec() == QMessageBox::Close) { reject(); } return; } QString lenErr = xn.checkLength(); if (!lenErr.isEmpty()) { gotoTab(1); lenErr = tr("The following length restrictions of RFC3280 are violated:") + "\n" + lenErr; QMessageBox msg(QMessageBox::Warning, XCA_TITLE, lenErr, QMessageBox::NoButton, this); msg.addButton(QMessageBox::Ok)->setText(tr("Edit subject")); msg.addButton(QMessageBox::Close)->setText(tr("Abort rollout")); msg.addButton(QMessageBox::Apply)->setText(tr("Continue rollout")); switch (msg.exec()) { case QMessageBox::Ok: case QMessageBox::Cancel: return; case QMessageBox::Close: reject(); return; case QMessageBox::Apply: break; } } if (fromReqCB->isChecked() && !getSelectedReq()->verify()) { gotoTab(0); QMessageBox msg(QMessageBox::Warning, XCA_TITLE, tr("The verification of the Certificate request failed.\nThe rollout should be aborted."), QMessageBox::NoButton, this); msg.addButton(QMessageBox::Ok)->setText(tr("Continue anyway")); msg.addButton(QMessageBox::Close)->setText(tr("Abort rollout")); if (msg.exec() == QMessageBox::Close) { reject(); } } if (description->text().isEmpty() && !fromReqCB->isChecked()) { if (commonName->text().isEmpty()) { gotoTab(1); QMessageBox msg(QMessageBox::Warning, XCA_TITLE, tr("The internal name and the common name are empty.\nPlease set at least the internal name."), QMessageBox::NoButton, this); msg.addButton(QMessageBox::Ok)->setText(tr("Edit name")); msg.addButton(QMessageBox::Close)->setText(tr("Abort rollout")); if (msg.exec() == QMessageBox::Close) { reject(); } return; } else { description->setText(commonName->text()); } } if (keyList->count() == 0 && keyList->isEnabled() && !fromReqCB->isChecked()) { gotoTab(1); QMessageBox msg(QMessageBox::Warning, XCA_TITLE, tr("There is no Key selected for signing."), QMessageBox::NoButton, this); msg.addButton(QMessageBox::Ok)->setText(tr("Select key")); msg.addButton(QMessageBox::Close)->setText(tr("Abort rollout")); if (msg.exec() == QMessageBox::Close) { reject(); } return; } QString unsetDN; if (pt != tmpl) unsetDN = mandatoryDnRemain(); if (!unsetDN.isEmpty()) { gotoTab(1); QString text = tr("The following distinguished name entries are empty:\n%1\nthough you have declared them as mandatory in the options menu.").arg(unsetDN); QMessageBox msg(QMessageBox::Warning, XCA_TITLE, text, QMessageBox::NoButton, this); msg.addButton(QMessageBox::Ok)->setText(tr("Edit subject")); msg.addButton(QMessageBox::Close)->setText(tr("Abort rollout")); msg.addButton(QMessageBox::Apply)->setText(tr("Continue rollout")); switch (msg.exec()) { case QMessageBox::Ok: case QMessageBox::Cancel: return; case QMessageBox::Close: reject(); return; case QMessageBox::Apply: break; } } pki_x509 *signer = NULL; if (!selfSignRB->isChecked()) signer = getSelectedSigner(); pki_key *signkey = getSelectedKey(); if (signer) signkey = signer->getRefKey(); if ((!signkey || signkey->isPubKey()) && pt != tmpl) { QString txt; gotoTab(signer ? 0 : 1); QMessageBox msg(QMessageBox::Warning, XCA_TITLE, tr("The key you selected for signing is not a private one."), QMessageBox::NoButton, this); txt = signer ? tr("Select other signer"):tr("Select other key"); msg.addButton(QMessageBox::Ok)->setText(txt); msg.addButton(QMessageBox::Close)->setText(tr("Abort rollout")); if (msg.exec() == QMessageBox::Close) { reject(); } return; } if (signer && notBefore->getDate() < signer->getNotBefore()) { gotoTab(2); QString text = tr("The certificate will be earlier valid than the signer. This is probably not what you want."); QMessageBox msg(QMessageBox::Warning, XCA_TITLE, text, QMessageBox::NoButton, this); msg.addButton(QMessageBox::Ok)->setText(tr("Edit dates")); msg.addButton(QMessageBox::Close)->setText(tr("Abort rollout")); msg.addButton(QMessageBox::Apply)->setText(tr("Continue rollout")); msg.addButton(QMessageBox::Yes)->setText(tr("Adjust date and continue")); switch (msg.exec()) { case QMessageBox::Ok: case QMessageBox::Cancel: return; case QMessageBox::Close: reject(); return; case QMessageBox::Apply: break; case QMessageBox::Yes: notBefore->setDate(signer->getNotBefore()); } } if (signer && notAfter->getDate() > signer->getNotAfter() && !noWellDefinedExpDate->isChecked()) { gotoTab(2); QString text = tr("The certificate will be longer valid than the signer. This is probably not what you want."); QMessageBox msg(QMessageBox::Warning, XCA_TITLE, text, QMessageBox::NoButton, this); msg.addButton(QMessageBox::Ok)->setText(tr("Edit dates")); msg.addButton(QMessageBox::Close)->setText(tr("Abort rollout")); msg.addButton(QMessageBox::Apply)->setText(tr("Continue rollout")); msg.addButton(QMessageBox::Yes)->setText(tr("Adjust date and continue")); switch (msg.exec()) { case QMessageBox::Ok: case QMessageBox::Cancel: return; case QMessageBox::Close: reject(); return; case QMessageBox::Apply: break; case QMessageBox::Yes: notAfter->setDate(signer->getNotAfter()); } } if (notBefore->getDate() > notAfter->getDate()) { gotoTab(2); QString text = tr("The certificate will be out of date before it becomes valid. You most probably mixed up both dates."); QMessageBox msg(QMessageBox::Warning, XCA_TITLE, text, QMessageBox::NoButton, this); msg.addButton(QMessageBox::Ok)->setText(tr("Edit dates")); msg.addButton(QMessageBox::Close)->setText(tr("Abort rollout")); msg.addButton(QMessageBox::Apply)->setText("Continue rollout"); switch (msg.exec()) { case QMessageBox::Ok: case QMessageBox::Cancel: return; case QMessageBox::Close: reject(); return; case QMessageBox::Apply: break; } } on_adv_validate_clicked(); if (checkExtDuplicates()) { gotoTab(5); QString text = tr("The certificate contains duplicated extensions. Check the validation on the advanced tab."); QMessageBox msg(QMessageBox::Warning, XCA_TITLE, text, QMessageBox::NoButton, this); msg.addButton(QMessageBox::Ok)->setText(tr("Edit extensions")); msg.addButton(QMessageBox::Close)->setText(tr("Abort rollout")); msg.addButton(QMessageBox::Apply)->setText(tr("Continue rollout")); switch (msg.exec()) { case QMessageBox::Ok: case QMessageBox::Cancel: return; case QMessageBox::Close: reject(); return; case QMessageBox::Apply: break; } } QDialog::accept(); }
void KNoteBook::directionButton(bool changetab, bool forward) { //debug("directionButton"); QButton *button, *arrow; QString str; if(changetab) { if(forward) { //debug("changing to tab: %d", current+1); gotoTab(pnote->current+1); button = pnote->currentwiz->getPreviousButton(); arrow = pnote->currentwiz->getLeftArrow(); if(pnote->directionsreflectspage) { str = "<< "; str += sections->at(pnote->current-1)->getTitle(sections->at(pnote->current-1)->numPages()-1); button->setText(str.data()); } else button->setText(PREV); //debug("Setting previous to: %s", str.data()); button->show(); if(pnote->enablearrowbuttons) arrow->show(); } else { //debug("changing to tab: %d", pnote->current-1); gotoTab(pnote->current-1); pnote->currentwiz->gotoPage(pnote->currentwiz->numPages()-1); button = pnote->currentwiz->getNextButton(); arrow = pnote->currentwiz->getRightArrow(); if(pnote->directionsreflectspage) { str = sections->at(pnote->current+1)->getTitle(0); str += " >>"; button->setText(str.data()); } else button->setText(NEXT); //debug("Setting next to: %s", str.data()); button->show(); if(pnote->enablearrowbuttons) arrow->show(); } } else { //debug("dont change tab"); if(forward) { button = pnote->currentwiz->getNextButton(); arrow = pnote->currentwiz->getRightArrow(); if((pnote->current+1) >= pnote->numtabs) { button->hide(); if(pnote->enablearrowbuttons) arrow->hide(); } else { str = sections->at(pnote->current+1)->getTitle(0); str += " >>"; //debug("Setting next to: %s", str.data()); button->setText(str.data()); button->show(); if(pnote->enablearrowbuttons) arrow->show(); } } else { button = pnote->currentwiz->getPreviousButton(); arrow = pnote->currentwiz->getLeftArrow(); if((pnote->current) == 0) { button->hide(); if(pnote->enablearrowbuttons) arrow->hide(); } else { str = "<< "; str += sections->at(pnote->current-1)->getTitle(sections->at(pnote->current-1)->numPages()-1); //debug("Setting previous to: %s", str.data()); button->setText(str.data()); button->show(); if(pnote->enablearrowbuttons) arrow->show(); } } } }