Ejemplo n.º 1
0
void MailEditorMainWindow::LoadMessage(const TStoredMailMessage& srcMsgHeader,
  const TPhysicalMailMessage& srcMsg)
  {
  DraftMessageInfo.first = srcMsgHeader;
  DraftMessageInfo.second = true;

  /// Now load source message contents into editor controls.
  loadContents(srcMsgHeader.from_key, srcMsg);
  }
Ejemplo n.º 2
0
/** Load the contents of the help topics tree from the specified XML file. */
void
HelpBrowser::loadContentsFromXml(QString xmlFile)
{
  QString errorString;
  QFile file(xmlFile);
  QDomDocument document;
  
  /* Load the XML contents into the DOM document */
  if (!document.setContent(&file, true, &errorString)) {
    ui.txtBrowser->setPlainText(tr("Error Loading Help Contents:")+" "+errorString);
    return;
  }
  /* Load the DOM document contents into the tree view */
  if (!loadContents(&document, errorString)) {
    ui.txtBrowser->setPlainText(tr("Error Loading Help Contents:")+" "+errorString);
    return;
  }
}
Ejemplo n.º 3
0
void MailEditorMainWindow::LoadMessage(Mailbox* mailbox, const TStoredMailMessage& srcMsgHeader,
  const TPhysicalMailMessage& srcMsg, TLoadForm loadForm)
  {
  TPublicKeyIndex allRecipients, toRecipients;
  TRecipientPublicKeys sourceToList, sourceCCList;
  QString newSubject;

  switch(loadForm)
    {
    case TLoadForm::Draft:
      DraftMessage = srcMsgHeader;
      /// Now load source message contents into editor controls.
      loadContents(srcMsgHeader.from_key, srcMsg);
      break;
    case TLoadForm::ReplyAll:
      transformRecipientList(srcMsgHeader.from_key, srcMsg.to_list, srcMsg.cc_list);
      newSubject = transformMailBody(loadForm, srcMsgHeader, srcMsg);
      MailFields->SetSubject(newSubject);
      break;
    case TLoadForm::Reply:
      if(srcMsg.to_list.empty() == false)
        sourceToList.push_back(srcMsg.to_list.front());
      transformRecipientList(srcMsgHeader.from_key, sourceToList, sourceCCList);
      newSubject = transformMailBody(loadForm, srcMsgHeader, srcMsg);
      MailFields->SetSubject(newSubject);
      break;
    case TLoadForm::Forward:
      FileAttachment->LoadAttachedFiles(srcMsg.attachments);
      newSubject = transformMailBody(loadForm, srcMsgHeader, srcMsg);
      MailFields->SetSubject(newSubject);
      break;
    default:
      assert(false);
    }
  
  ui->messageEdit->moveCursor(QTextCursor::MoveOperation::Start, QTextCursor::MoveMode::MoveAnchor);
  onFileAttachementTriggered( FileAttachment->hasAttachment() );
  
  if ( !EditMode && FileAttachment->hasAttachment())
    {
    mailbox->previewImages(ui->messageEdit);
    ui->messageEdit->document()->setModified(false);
    }
  }
Ejemplo n.º 4
0
bool WidgetBoxTreeWidget::load(QDesignerWidgetBox::LoadMode loadMode)
{
    switch (loadMode) {
    case QDesignerWidgetBox::LoadReplace:
        clear();
        break;
    case QDesignerWidgetBox::LoadCustomWidgetsOnly:
        addCustomCategories(true);
        updateGeometries();
        return true;
    default:
        break;
    }

    const QString name = fileName();

    QFile f(name);
    if (!f.open(QIODevice::ReadOnly)) // Might not exist at first startup
        return false;

    const QString contents = QString::fromUtf8(f.readAll());
    return loadContents(contents);
}