Ejemplo n.º 1
0
nsresult
gfxWindowsSurface::BeginPrinting(const nsAString& aTitle,
                                 const nsAString& aPrintToFileName)
{
#ifdef NS_PRINTING
#define DOC_TITLE_LENGTH (MAX_PATH-1)
    DOCINFOW docinfo;

    nsString titleStr(aTitle);
    if (titleStr.Length() > DOC_TITLE_LENGTH) {
        titleStr.SetLength(DOC_TITLE_LENGTH-3);
        titleStr.AppendLiteral("...");
    }

    nsString docName(aPrintToFileName);
    docinfo.cbSize = sizeof(docinfo);
    docinfo.lpszDocName = titleStr.Length() > 0 ? titleStr.get() : L"Mozilla Document";
    docinfo.lpszOutput = docName.Length() > 0 ? docName.get() : nullptr;
    docinfo.lpszDatatype = nullptr;
    docinfo.fwType = 0;

    ::StartDocW(mDC, &docinfo);

    return NS_OK;
#else
    return NS_ERROR_FAILURE;
#endif
}
Ejemplo n.º 2
0
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
                                  const CefString& title) {
    CEF_REQUIRE_UI_THREAD();

    std::string titleStr(title);
    std::cout << "title changed to %s" << titleStr;
}
Ejemplo n.º 3
0
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
                                  const CefString& title) {
  REQUIRE_UI_THREAD();

  GtkWidget* window = gtk_widget_get_ancestor(
      GTK_WIDGET(browser->GetHost()->GetWindowHandle()),
      GTK_TYPE_WINDOW);
  std::string titleStr(title);
  gtk_window_set_title(GTK_WINDOW(window), titleStr.c_str());
}
Ejemplo n.º 4
0
OsStatus SmsNotifier::handleAlarm(const OsTime alarmTime,
      const UtlString& callingHost,
      const cAlarmData* alarmData,
      const UtlString& alarmMsg)
{
   OsStatus retval = OS_FAILED;

   //execute the mail command for each user
   UtlString groupKey(alarmData->getGroupName());
   if (!groupKey.isNull())
   {
      UtlContainable* pContact = mContacts.findValue(&groupKey);
      if (pContact)
      {
         // Process the comma separated list of contacts
         UtlString* contactList = dynamic_cast<UtlString*> (pContact);
         if (!contactList->isNull())
         {
            MailMessage message(mSmsStrFrom, mReplyTo, mSmtpServer);
            UtlTokenizer tokenList(*contactList);

            UtlString entry;
            while (tokenList.next(entry, ","))
            {
               message.To(entry, entry);
            }

            UtlString body;
            UtlString tempStr;

            UtlString sevStr = Os::Logger::instance().priorityName(alarmData->getSeverity());
            body.append(alarmMsg);

            Os::Logger::instance().log(FAC_ALARM, PRI_DEBUG, "AlarmServer: sms body is %s", body.data());

            message.Body(body);

            UtlSList subjectParams;
            UtlString codeStr(alarmData->getCode());
            UtlString titleStr(sevStr);
            subjectParams.append(&codeStr);
            subjectParams.append(&titleStr);
            assembleMsg(mSmsStrSubject, subjectParams, tempStr);
            message.Subject(tempStr);

            // delegate send to separate task so as not to block
            EmailSendTask::getInstance()->sendMessage(message);
         }
      }
   }

   return retval;
}
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
                                  const CefString& title) {
  CEF_REQUIRE_UI_THREAD();

  std::string titleStr(title);

  if (!browser->IsPopup()) {
    // Set the GTK parent window title.
    GtkWidget* window = gtk_widget_get_ancestor(main_handle_,
        GTK_TYPE_WINDOW);
    gtk_window_set_title(GTK_WINDOW(window), titleStr.c_str());
  } else {
    // Retrieve the X11 display shared with Chromium.
    ::Display* display = cef_get_xdisplay();
    DCHECK(display);

    // Retrieve the X11 window handle for the browser.
    ::Window window = browser->GetHost()->GetWindowHandle();
    DCHECK(window != kNullWindowHandle);

    // Retrieve the atoms required by the below XChangeProperty call.
    const char* kAtoms[] = {
      "_NET_WM_NAME",
      "UTF8_STRING"
    };
    Atom atoms[2];
    int result = XInternAtoms(display, const_cast<char**>(kAtoms), 2, false,
                              atoms);
    if (!result)
      NOTREACHED();

    // Set the window title.
    XChangeProperty(display,
                    window,
                    atoms[0],
                    atoms[1],
                    8,
                    PropModeReplace,
                    reinterpret_cast<const unsigned char*>(titleStr.c_str()),
                    titleStr.size());

    // TODO(erg): This is technically wrong. So XStoreName and friends expect
    // this in Host Portable Character Encoding instead of UTF-8, which I
    // believe is Compound Text. This shouldn't matter 90% of the time since
    // this is the fallback to the UTF8 property above.
    XStoreName(display, browser->GetHost()->GetWindowHandle(),
               titleStr.c_str());
  }
}
Ejemplo n.º 6
0
void YbSendCoinsDialog::createWidget()
{
    QPixmap sendPix(":icons/sendindialog");
    QString titleStr(tr("发送"));
    QString titleInfoStr(tr("立即向任意元宝币地址发送元宝币。"));
    title = new YbMessageDialogTitle(sendPix, titleStr, titleInfoStr, this);
    this->setMinimumHeight(370);
    this->setMinimumWidth(550);
    setAutoFillBackground(true);
    QPalette pa = palette();
    pa.setColor(QPalette::Background,QColor(255, 255, 255));
    setStyleSheet("QLineEdit{border: 2px groove rgb(211, 211, 211)} QScrollArea{border: hide}");
    this->setPalette(pa);

    connect(buttonBar, SIGNAL(cancel()), this, SLOT(cancel()));
    connect(buttonBar, SIGNAL(deleteAll()), this, SLOT(deleteAll()));
    connect(buttonBar, SIGNAL(clear()), this, SLOT(clear()));
    connect(buttonBar, SIGNAL(send()), this, SLOT(send()));

    receiversForm = new ReceiversForm(this);
    connect(receiversForm, SIGNAL(addAsLabel(QString&)), this, SLOT(getAddAsLabel(QString&)));

    boldFont.setBold(true);

    addAsLabel->setMinimumHeight(25);
    addAsLabel->setMinimumWidth(382);
    addAsLabel->setToolTip(tr("输入标签"));
    QHBoxLayout *labelLayout = new QHBoxLayout;
    QLabel *labelText = new QLabel(tr("标签:"));
    labelText->setFont(boldFont);
    labelLayout->addSpacing(20);
    labelLayout->addWidget(labelText);
    labelLayout->addWidget(addAsLabel);
    labelLayout->addSpacing(28);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);
    mainLayout->addWidget(title);
    mainLayout->addWidget(receiversForm);
    mainLayout->addLayout(labelLayout);
    mainLayout->addWidget(buttonBar);

    setLayout(mainLayout);
}
Ejemplo n.º 7
0
OsStatus EmailNotifier::handleAlarm(const OsTime alarmTime,
      const UtlString& callingHost,
      const cAlarmData* alarmData,
      const UtlString& alarmMsg)
{
   OsStatus retval = OS_FAILED;

   //execute the mail command for each user
   UtlString groupKey(alarmData->getGroupName());
   if (!groupKey.isNull())
   {
      UtlContainable* pContact = mContacts.findValue(&groupKey);
      if (pContact)
      {
         // Process the comma separated list of contacts
         UtlString* contactList = dynamic_cast<UtlString*> (pContact);
         if (!contactList->isNull())
         {
            MailMessage message(mEmailStrFrom, mReplyTo, mSmtpServer);
            UtlTokenizer tokenList(*contactList);

            UtlString entry;
            while (tokenList.next(entry, ","))
            {
               message.To(entry, entry);
            }

            UtlString body;
            UtlString tempStr;

            body = mEmailStrIntro;
            body.append("\n");

            assembleMsg(mEmailStrAlarm, alarmData->getCode(), tempStr);
            body.append(tempStr);
            body.append("\n");

            assembleMsg(mEmailStrHost, callingHost, tempStr);
            body.append(tempStr);
            body.append("\n");

            OsDateTime logTime(alarmTime);
            UtlString strTime;
            logTime.getIsoTimeStringZus(strTime);
            assembleMsg(mEmailStrTime, strTime, tempStr);
            body.append(tempStr);
            body.append("\n");

            UtlString sevStr = OsSysLog::priorityName(alarmData->getSeverity());
            assembleMsg(mEmailStrSeverity, sevStr, tempStr);
            body.append(tempStr);
            body.append("\n");
            assembleMsg(mEmailStrDescription, alarmMsg, tempStr);
            body.append(tempStr);
            body.append("\n");
            assembleMsg(mEmailStrResolution, alarmData->getResolution(), tempStr);
            body.append(tempStr);
            OsSysLog::add(FAC_ALARM, PRI_DEBUG, "AlarmServer: email body is %s", body.data());

            message.Body(body);

            UtlSList subjectParams;
            UtlString codeStr(alarmData->getCode());
            UtlString titleStr(alarmData->getShortTitle());
            subjectParams.append(&codeStr);
            subjectParams.append(&titleStr);
            assembleMsg(mEmailStrSubject, subjectParams, tempStr);
            message.Subject(tempStr);

            // delegate send to separate task so as not to block
            EmailSendTask::getInstance()->sendMessage(message);
         }
      }
   }

   return retval;
}
Ejemplo n.º 8
0
OsStatus EmailNotifier::handleAlarm(const OsTime alarmTime, 
      const UtlString& callingHost, 
      const cAlarmData* alarmData, 
      const UtlString& alarmMsg)
{
   OsStatus retval = OS_FAILED;

   UtlString body;
   UtlString tempStr;

   body = mEmailStrIntro;
   body.append("\n");
   
   assembleMsg(mEmailStrAlarm, alarmData->getCode(), tempStr);
   body.append(tempStr);
   body.append("\n");
   
   assembleMsg(mEmailStrHost, callingHost, tempStr);
   body.append(tempStr);
   body.append("\n");
   
   OsDateTime logTime(alarmTime);
   UtlString strTime;
   logTime.getIsoTimeStringZus(strTime);
   assembleMsg(mEmailStrTime, strTime, tempStr);
   body.append(tempStr);
   body.append("\n");
   
   UtlString sevStr = OsSysLog::priorityName(alarmData->getSeverity());
   assembleMsg(mEmailStrSeverity, sevStr, tempStr);
   body.append(tempStr);
   body.append("\n");
   assembleMsg(mEmailStrDescription, alarmMsg, tempStr);
   body.append(tempStr);
   body.append("\n");
   assembleMsg(mEmailStrResolution, alarmData->getResolution(), tempStr);
   body.append(tempStr);
   OsSysLog::add(FAC_ALARM, PRI_DEBUG, "AlarmServer: email body is %s", body.data());

   MailMessage message( mEmailStrFrom, mReplyTo, mSmtpServer );
   message.Body(body);
   
   UtlSList subjectParams;
   UtlString codeStr(alarmData->getCode());
   UtlString titleStr(alarmData->getShortTitle());
   subjectParams.append(&codeStr);
   subjectParams.append(&titleStr);
   assembleMsg(mEmailStrSubject, subjectParams, tempStr);
   message.Subject(tempStr);

   //execute the mail command for each user
   UtlSListIterator iterator(mContacts);
   UtlString* pObject;
   while ( (pObject = dynamic_cast<UtlString*>(iterator())))
   {
      message.To(*pObject, *pObject);
   }

   // delegate send to separate task so as not to block
   EmailSendTask::getInstance()->sendMessage(message);

   return retval;
}