* proper check for the what field to show the config window

* if there are printers but no default one, show only the printer panel without the add dialog
* adjusted the alert message accordingly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24516 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Karsten Heimrich
2008-03-22 00:20:26 +00:00
parent 76f2895ed9
commit 77258c7702
+17 -6
View File
@@ -56,8 +56,11 @@ status_t PrintServerApp::async_thread(void* data)
case PSRV_SHOW_PRINT_SETUP: case PSRV_SHOW_PRINT_SETUP:
if (printer) { if (printer) {
if (p->app->fUseConfigWindow) { if (p->app->fUseConfigWindow) {
ConfigWindow* w = new ConfigWindow(PSRV_SHOW_PAGE_SETUP config_setup_kind kind = kJobSetup;
? kPageSetup : kJobSetup, printer, msg, &sender); if (msg->what == PSRV_SHOW_PAGE_SETUP)
kind = kPageSetup;
ConfigWindow* w = new ConfigWindow(kind, printer, msg,
&sender);
w->Go(); w->Go();
} else { } else {
BMessage reply(*msg); BMessage reply(*msg);
@@ -67,10 +70,17 @@ status_t PrintServerApp::async_thread(void* data)
} else { } else {
// If no default printer is set, give user // If no default printer is set, give user
// choice of aborting or setting up a printer // choice of aborting or setting up a printer
BAlert* alert = new BAlert("Info", "There are no printers " int32 count = Printer::CountPrinters();
"set up. Would you set one up now?", "No", "Yes"); BString alertText("There are no printers set up. ");
if (alert->Go() == 1) if (count > 0)
alertText.SetTo("There is no default printer set up. ");
BAlert* alert = new BAlert("Info", alertText.Append("Would "
"you like to set one up now?").String(), "No", "Yes");
if (alert->Go() == 1 && count == 0)
run_add_printer_panel(); run_add_printer_panel();
else
run_select_printer_panel();
} }
} break; } break;
@@ -150,7 +160,8 @@ void PrintServerApp::Handle_BeOSR5_Message(BMessage* msg)
} }
} }
reply.AddString("printer_name", printerName); reply.AddString("printer_name", printerName);
reply.AddInt32("color", BPrintJob::B_COLOR_PRINTER); // BeOS knows not if color or not, so always color // BeOS knows not if color or not, so always color
reply.AddInt32("color", BPrintJob::B_COLOR_PRINTER);
msg->SendReply(&reply); msg->SendReply(&reply);
} }
break; break;