Return success if print to file dialog has been canceled (so that print_server will delete spool file).

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2528 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Pfeiffer 2003-01-22 06:50:50 +00:00
parent 822ea83244
commit 7af3c68cbf
2 changed files with 15 additions and 7 deletions

View File

@ -122,6 +122,9 @@ PrinterDriver::PrintJob
if (OpenTransport() != B_OK) {
return B_ERROR;
}
if (PrintToFileCanceled()) {
return B_OK;
}
// read print file header
fJobFile->Seek(0, SEEK_SET);
@ -382,13 +385,6 @@ PrinterDriver::OpenTransport()
delete msg;
delete path;
// The BeOS "Print To File" transport returns a non-NULL BDataIO *
// even after user filepanel cancellation!
BFile* file = dynamic_cast<BFile*>(fTransport);
if (file && file->InitCheck() != B_OK)
// Quietly return
return B_ERROR;
if (fTransport == 0) {
BAlert *alert = new BAlert("Uh oh!", "Couldn't open transport.", "OK");
@ -400,6 +396,17 @@ PrinterDriver::OpenTransport()
}
// --------------------------------------------------
bool
PrinterDriver::PrintToFileCanceled()
{
// The BeOS "Print To File" transport returns a non-NULL BDataIO *
// even after user filepanel cancellation!
BFile* file = dynamic_cast<BFile*>(fTransport);
return file && file->InitCheck() != B_OK;
}
// --------------------------------------------------
status_t
PrinterDriver::CloseTransport()

View File

@ -86,6 +86,7 @@ public:
// transport-related methods
status_t OpenTransport();
status_t CloseTransport();
bool PrintToFileCanceled();
// accessors
inline BFile *JobFile() { return fJobFile; }