| 20 | #include <QStringList> |
| 21 | |
| 22 | ExportDialog::ExportDialog(QWidget *w, const QString &title, |
| 23 | const QString &filt, const QModelIndexList &indexes, |
| 24 | const QPixmap &img, QList<const pki_export*> types, |
| 25 | const QString &help_ctx) |
| 26 | : QDialog(w ? w : mainwin), filter(filt), savedFile(), alltypes(types) |
| 27 | { |
| 28 | QString fname = "selected_items"; |
| 29 | setupUi(this); |
| 30 | setWindowTitle(XCA_TITLE); |
| 31 | if (indexes.size() == 1) { |
| 32 | pki_base *pki = db_base::fromIndex(indexes[0]); |
| 33 | if (pki) { |
| 34 | description->setText(pki->getIntName()); |
| 35 | fname = pki->getUnderlinedName(); |
| 36 | } |
| 37 | separateFiles->hide(); |
| 38 | samePassword->hide(); |
| 39 | setupExportFormat(F_MULTI); |
| 40 | } else { |
| 41 | // Plural form not required for < 2 items |
| 42 | // Will only be called for 2 or more items |
| 43 | description->setText(tr("%n selected item(s)", "", indexes.size())); |
| 44 | setupExportFormat(F_SINGLE); |
| 45 | } |
| 46 | description->setReadOnly(true); |
| 47 | image->setPixmap(img); |
| 48 | label->setText(title); |
| 49 | mainwin->helpdlg->register_ctxhelp_button(this, help_ctx); |
| 50 | |
| 51 | fname = Settings["workingdir"] + fname + "." + types[0]->extension; |
| 52 | filename->setText(nativeSeparator(fname)); |
| 53 | filter = tr("All files ( * )") + ";;" + filter; |
| 54 | filenameLabelOrig = filenameLabel->text(); |
| 55 | } |
| 56 | |
| 57 | void ExportDialog::setupExportFormat(int disable_flag) |
| 58 | { |
nothing calls this directly
no test coverage detected