Backup on save: Support time and date string replacements
ClosedPublic

Authored by dhaumann on Tue, Sep 10, 1:29 PM.

Details

Summary

Supported variables are:

Screenshot:

BUG: 403583
FIXED-IN: 5.63

Diff Detail

Repository
R39 KTextEditor
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dhaumann created this revision.Tue, Sep 10, 1:29 PM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptTue, Sep 10, 1:29 PM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
dhaumann requested review of this revision.Tue, Sep 10, 1:29 PM

KateDialogs contains the following:

if (uiadv->edtBackupSuffix->text().isEmpty() && uiadv->edtBackupPrefix->text().isEmpty()) {
    KMessageBox::information(
        this,
        i18n("You did not provide a backup suffix or prefix. Using default suffix: '~'"),
        i18n("No Backup Suffix or Prefix")
    );
    uiadv->edtBackupSuffix->setText(QStringLiteral("~"));
}

Theoretically, if a variable exands to nothing (JS:..., ENV:...) we could still run into both empty prefix and suffix in katedocument.cpp.

This revision was not accepted when it landed; it landed in state Needs Review.Tue, Sep 10, 1:32 PM
This revision was automatically updated to reflect the committed changes.
dhaumann reopened this revision.Tue, Sep 10, 1:35 PM

arc bug: it's not yet committed.

dhaumann updated this revision to Diff 65754.Tue, Sep 10, 1:37 PM
  • rebase to master
dhaumann edited the summary of this revision. (Show Details)Tue, Sep 10, 1:43 PM
dhaumann added a subscriber: ngraham.

@ngraham: This may be interesting to you as well (and a prereq for the External Tools plugin)

dhaumann retitled this revision from Variable expansion: Prefer return value over return argument to Backup on save: Support time and date string replacements.Tue, Sep 10, 3:23 PM
dhaumann edited the summary of this revision. (Show Details)
cullmann accepted this revision.Wed, Sep 11, 5:05 AM

Looks fine.

This revision is now accepted and ready to land.Wed, Sep 11, 5:05 AM
dhaumann added inline comments.Wed, Sep 11, 6:09 AM
src/document/katedocument.cpp
2594

Shall we wrap all this with

if (!(backupSuffix.isEmpty() && backupPrefix.isEmpty())) {...}
cullmann added inline comments.Wed, Sep 11, 7:18 AM
src/document/katedocument.cpp
2594

Why not, saves useless evals.

dhaumann added inline comments.Wed, Sep 11, 8:47 AM
src/document/katedocument.cpp
2594

No: that's exactly the point: I currently don't think it's possible, but both evals could result in empty strings.

Can you do the integration? Author does not matter.

dhaumann updated this revision to Diff 65843.Wed, Sep 11, 12:11 PM
  • Avoid running the backup when no backup prefix/suffix was provided
This revision was automatically updated to reflect the committed changes.
dhaumann marked 3 inline comments as done.