From d79b659e2686c66740e0609427b608efbf889238 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Sat, 3 Dec 2011 19:47:38 +0100 Subject: [PATCH] Terminal:Fix printing and windows settings path. * Fixes #7986 - behavior of Print command fixed to be consistent with other application, like StyledEdit. This change display the print job settings dialog instead of "Printing was cancelled" alert; * Fixes #6998 - the path to storing windows settings changed from ~/config/settings/Terminal_windows to ~/c/s/Terminal/Windows; This patch was created during GCI 2011 by doctorkohaku. Thanks for the contribution! --- src/apps/terminal/TermWindow.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp index 31307d14c9..8c67d4fbed 100644 --- a/src/apps/terminal/TermWindow.cpp +++ b/src/apps/terminal/TermWindow.cpp @@ -517,7 +517,11 @@ TermWindow::_GetWindowPositionFile(BFile* file, uint32 openMode) if (status != B_OK) return status; - status = path.Append("Terminal_windows"); + status = path.Append("Terminal"); + if (status != B_OK) + return status; + + status = path.Append("Windows"); if (status != B_OK) return status; @@ -1035,23 +1039,19 @@ TermWindow::_DoPageSetup() void TermWindow::_DoPrint() { - if (!fPrintSettings || _DoPageSetup() != B_OK) { - BAlert* alert = new BAlert(B_TRANSLATE("Cancel"), - B_TRANSLATE("Print cancelled."), B_TRANSLATE("OK")); - alert->SetShortcut(0, B_ESCAPE); - alert->Go(); - return; - } - BPrintJob job("Print"); - job.SetSettings(new BMessage(*fPrintSettings)); + if (fPrintSettings) + job.SetSettings(new BMessage(*fPrintSettings)); + + if (job.ConfigJob() != B_OK) + return; BRect pageRect = job.PrintableRect(); BRect curPageRect = pageRect; int pHeight = (int)pageRect.Height(); int pWidth = (int)pageRect.Width(); - float w,h; + float w, h; _ActiveTermView()->GetFrameSize(&w, &h); int xPages = (int)ceil(w / pWidth); int yPages = (int)ceil(h / pHeight);