Prevent Canceled FileChooser from calling print
ClosedPublic

Authored by rizzitello on Fri, Nov 23, 5:29 AM.

Details

Summary

Changes from: https://phabricator.kde.org/R231:f72448828270d266acf4fbde69d09bc648337b7f Create an error dialog if the print function is called with empty filename. This checks that the dialog was accepted before sending the filename to the print function preventing the error message from showing.

Diff Detail

Branch
removeNoFileWarning
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 5327
Build 5345: arc lint + arc unit
rizzitello requested review of this revision.Fri, Nov 23, 5:29 AM
rizzitello created this revision.
rizzitello edited the summary of this revision. (Show Details)Fri, Nov 23, 5:30 AM
rizzitello added a project: Atelier.
rizzitello added a subscriber: Atelier.
patrickelectric requested changes to this revision.Fri, Nov 23, 9:48 AM
patrickelectric added inline comments.
src/mainwindow.cpp
170–171

Why is this necessary ?

This revision now requires changes to proceed.Fri, Nov 23, 9:48 AM
rizzitello marked an inline comment as done.Fri, Nov 23, 11:17 AM
rizzitello added inline comments.
src/mainwindow.cpp
170–171

There is a check in print that will make an error dialog if print is called with an empty file . So by checking here we prevent this if the user hits cancel.

rizzitello updated this revision to Diff 46078.Fri, Nov 23, 2:48 PM
rizzitello marked an inline comment as done.
  • rebase
rizzitello set the repository for this revision to R231 Atelier.Fri, Nov 23, 2:56 PM
rizzitello edited the summary of this revision. (Show Details)Fri, Nov 23, 2:58 PM
tcanabrava accepted this revision.Fri, Nov 23, 3:04 PM
rizzitello edited the summary of this revision. (Show Details)Fri, Nov 23, 3:23 PM
src/mainwindow.cpp
170–171
int result = dialog.exec();
if (result == QDialog::Rejected) {
    return;
}
if (result == QDialog::Accepted) {
    file = dialog.choosenFile();
}

Why not like this ?

int result = dialog.exec();
if (result != QDialog::Accepted) {
    return;
}
file = dialog.choosenFile();
  • Patricks suggestion
rizzitello marked an inline comment as done.Sat, Nov 24, 12:14 AM
patrickelectric requested changes to this revision.Sat, Nov 24, 3:48 PM
patrickelectric added inline comments.
src/mainwindow.cpp
168–169

!= accept makes more senses if new or a undefined behaviour happens,.

This revision now requires changes to proceed.Sat, Nov 24, 3:48 PM
rizzitello updated this revision to Diff 46147.Sat, Nov 24, 6:04 PM
  • patrick' suggestion to use != Accepted
rizzitello marked 2 inline comments as done.Sat, Nov 24, 6:04 PM
patrickelectric accepted this revision.Sat, Nov 24, 8:36 PM
This revision is now accepted and ready to land.Sat, Nov 24, 8:36 PM
rizzitello closed this revision.Sun, Nov 25, 12:13 AM