Changeset View
Changeset View
Standalone View
Standalone View
src/migration/importwizard.cpp
Show First 20 Lines • Show All 509 Lines • ▼ Show 20 Line(s) | 492 | { | |||
---|---|---|---|---|---|
510 | d->finishPageItem = new KPageWidgetItem(d->finishPageWidget, xi18n("Success")); | 510 | d->finishPageItem = new KPageWidgetItem(d->finishPageWidget, xi18n("Success")); | ||
511 | addPage(d->finishPageItem); | 511 | addPage(d->finishPageItem); | ||
512 | } | 512 | } | ||
513 | 513 | | |||
514 | //=========================================================== | 514 | //=========================================================== | ||
515 | // | 515 | // | ||
516 | bool ImportWizard::checkUserInput() | 516 | bool ImportWizard::checkUserInput() | ||
517 | { | 517 | { | ||
518 | QString issues; | 518 | KLocalizedString issues; | ||
519 | 519 | | |||
520 | if (d->dstNewDBCaptionLineEdit->text().isEmpty()) { | 520 | if (d->dstNewDBCaptionLineEdit->text().isEmpty()) { | ||
521 | issues = xi18nc("@info", "<para>No new database name was entered.</para>"); | 521 | issues = kxi18nc("@info", "<para>No new database name was entered.</para>"); | ||
522 | } | 522 | } | ||
523 | 523 | | |||
524 | Kexi::ObjectStatus result; | 524 | Kexi::ObjectStatus result; | ||
525 | KexiMigrate* sourceDriver = prepareImport(result); | 525 | KexiMigrate* sourceDriver = prepareImport(result); | ||
526 | if (sourceDriver && sourceDriver->isSourceAndDestinationDataSourceTheSame()) { | 526 | if (sourceDriver && sourceDriver->isSourceAndDestinationDataSourceTheSame()) { | ||
527 | // note: we're using .arg() here because the 'issues' argument is already in rich-text format | 527 | KLocalizedString sameDbIssue = kxi18nc("@info", "%1<para>Source database is the same as destination.</para>"); | ||
528 | issues = xi18nc("@info", "%1<para>Source database is the same as destination.</para>") | 528 | issues = issues.isEmpty() ? sameDbIssue.subs("") : sameDbIssue.subs(issues); | ||
529 | .arg(issues); | | |||
530 | } | 529 | } | ||
531 | 530 | | |||
532 | if (!issues.isEmpty()) { | 531 | if (!issues.isEmpty()) { | ||
533 | // note: we're using .arg() here because the 'issues' argument is already in rich-text format | | |||
534 | d->lblImportingErrTxt->setText( | 532 | d->lblImportingErrTxt->setText( | ||
535 | xi18nc("@info", "<para>Following issues were found with the data you entered:</para>" | 533 | xi18nc("@info", "<para>Following issues were found with the data you entered:</para>" | ||
536 | "%1" | 534 | "%1" | ||
537 | "<para>Please click <interface>Back</interface> button and correct these issues.</para>") | 535 | "<para>Please click <interface>Back</interface> button and correct these issues.</para>", | ||
538 | .arg(issues)); | 536 | issues)); | ||
539 | return false; | 537 | return false; | ||
540 | } | 538 | } | ||
541 | return true; | 539 | return true; | ||
542 | } | 540 | } | ||
543 | 541 | | |||
544 | void ImportWizard::arriveSrcConnPage() | 542 | void ImportWizard::arriveSrcConnPage() | ||
545 | { | 543 | { | ||
546 | d->srcConnPageWidget->hide(); | 544 | d->srcConnPageWidget->hide(); | ||
▲ Show 20 Lines • Show All 368 Lines • ▼ Show 20 Line(s) | 910 | if (!sourceDriver || result.error()) { | |||
915 | 913 | | |||
916 | QString msg, details; | 914 | QString msg, details; | ||
917 | KexiTextMessageHandler handler(&msg, &details); | 915 | KexiTextMessageHandler handler(&msg, &details); | ||
918 | handler.showErrorMessage(&result); | 916 | handler.showErrorMessage(&result); | ||
919 | 917 | | |||
920 | qDebug() << msg << "\n" << details; | 918 | qDebug() << msg << "\n" << details; | ||
921 | 919 | | |||
922 | d->finishPageItem->setHeader(xi18n("Failure")); | 920 | d->finishPageItem->setHeader(xi18n("Failure")); | ||
923 | // note: we're using .arg() here because the msg and details arguments are already in rich-text format | 921 | // note: we're using QString.arg() here because the msg and details | ||
922 | // arguments are already in rich-text format, but leaving out the | ||||
923 | // arguments from xi18nc writes (I18N_ARGUMENT_MISSING). Thus, first | ||||
924 | // replace %n with themselves to avoid ki18n warning and then call | ||||
925 | // QString.arg() to replace them with HTML text. | ||||
924 | d->finishLbl->setText( | 926 | d->finishLbl->setText( | ||
925 | xi18nc("@info", | 927 | xi18nc("@info", | ||
926 | "<para>Import failed.</para>" | 928 | "<para>Import failed.</para>" | ||
927 | "<para>%1</para>" | 929 | "<para>%1</para>" | ||
928 | "<para>%2</para>" | 930 | "<para>%2</para>" | ||
929 | "<para>You can click <interface>Back</interface> button and try again.</para>") | 931 | "<para>You can click <interface>Back</interface> button and try again.</para>", | ||
930 | .arg(msg).arg(details)); | 932 | "%1", "%2").arg(msg).arg(details)); | ||
931 | return false; | 933 | return false; | ||
932 | } | 934 | } | ||
933 | return true; | 935 | return true; | ||
934 | } | 936 | } | ||
935 | 937 | | |||
936 | void ImportWizard::reject() | 938 | void ImportWizard::reject() | ||
937 | { | 939 | { | ||
938 | KAssistantDialog::reject(); | 940 | KAssistantDialog::reject(); | ||
▲ Show 20 Lines • Show All 199 Lines • Show Last 20 Lines |