示例#1
0
bool
PrintingParent::RecvShowPrintDialog(PPrintSettingsDialogParent* aDialog,
                                    PBrowserParent* aParent,
                                    const PrintData& aData)
{
  PrintData resultData;
  nsresult rv = ShowPrintDialog(aParent, aData, &resultData);

  // The child has been spinning an event loop while waiting
  // to hear about the print settings. We return the results
  // with an async message which frees the child process from
  // its nested event loop.
  if (NS_FAILED(rv)) {
    mozilla::Unused << aDialog->Send__delete__(aDialog, rv);
  } else {
    mozilla::Unused << aDialog->Send__delete__(aDialog, resultData);
  }
  return true;
}
示例#2
0
static void print_report(json_object *obj) {
  json_object *child;
  char *title, *printer, *oid;
  gboolean showdialog;
  LargeByteString *lbs;

  printer = "";
  title = "";
  showdialog = FALSE;

  if (!json_object_object_get_ex(obj, "object_id", &child)) {
    return;
  }
  oid = (char *)json_object_get_string(child);

  if (json_object_object_get_ex(obj, "printer", &child)) {
    printer = (char *)json_object_get_string(child);
  }
  if (json_object_object_get_ex(obj, "title", &child)) {
    title = (char *)json_object_get_string(child);
  }
  if (json_object_object_get_ex(obj, "showdialog", &child)) {
    showdialog = json_object_get_boolean(child);
  }
  if (oid == NULL || strlen(oid) <= 0) {
    return;
  }
  if (printer == NULL || strlen(printer) <= 0) {
    showdialog = TRUE;
  }
  Info("report title:%s printer:%s showdialog:%d oid:%s", title, printer,
       (int)showdialog, oid);

  setenv("GLPUSH_OID", oid, 1);
  lbs = REST_GetBLOB_via_ENV();
  if (showdialog) {
    ShowPrintDialog(title, lbs);
  } else {
    Print(oid, title, printer, lbs);
  }
  FreeLBS(lbs);
}