Exemplo n.º 1
0
bool MailEditorMainWindow::onSave()
  {
  ui->messageEdit->document()->setModified(false);
  TPhysicalMailMessage msg;
  if(prepareMailMessage(&msg))
    {
      if(!isMsgSizeOK(msg))
      {
        ui->messageEdit->document()->setModified(true);
        return false;
      }
    const IMailProcessor::TIdentity& senderId = MailFields->GetSenderIdentity();

    auto app = bts::application::instance();
    auto profile = app->get_profile();
    auto idents = profile->identities();

    if(0 == idents.size())
      {
      QMessageBox::StandardButton ret = QMessageBox::warning(this, tr("Keyhotee"),
      tr("Cannot save this draft. No Identity is present.\nPlease create an Identity to save this draft"),
      QMessageBox::Ok);
      return false;
      }
    //DLN we should probably add get_pointer implementation to fc::optional to avoid code like this
    TStoredMailMessage* oldMessage = DraftMessage.valid() ? &(*DraftMessage) : nullptr;
    DraftMessage = MailProcessor.Save(senderId, msg, oldMessage);
    }
  return true;
  }
Exemplo n.º 2
0
void MailEditorMainWindow::on_actionSend_triggered()
  {
  TPhysicalMailMessage msg;
  if(prepareMailMessage(&msg))
    {
    const IMailProcessor::TIdentity& senderId = MailFields->GetSenderIdentity();
    MailProcessor.Send(senderId, msg);
    /// Clear potential modified flag to avoid asking for saving changes.
    ui->messageEdit->document()->setModified(false);
    close();
    }
  }
Exemplo n.º 3
0
void MailEditorMainWindow::onSave()
  {
  ui->messageEdit->document()->setModified(false);
  TPhysicalMailMessage msg;
  if(prepareMailMessage(&msg))
    {
    const IMailProcessor::TIdentity& senderId = MailFields->GetSenderIdentity();
    //DLN we should probably add get_pointer implementation to fc::optional to avoid code like this
    TStoredMailMessage* oldMessage = DraftMessage.valid() ? &(*DraftMessage) : nullptr;
    DraftMessage = MailProcessor.Save(senderId, msg, oldMessage);
    }
  }
Exemplo n.º 4
0
void MailEditorMainWindow::onSave()
  {
  ui->messageEdit->document()->setModified(false);
  TPhysicalMailMessage msg;
  if(prepareMailMessage(&msg))
    {
    const IMailProcessor::TIdentity& senderId = MailFields->GetSenderIdentity();
    MailProcessor.Save(senderId, msg, 
      DraftMessageInfo.second ? &DraftMessageInfo.first : nullptr, &DraftMessageInfo.first);

    DraftMessageInfo.second = true;
    }
  }
Exemplo n.º 5
0
void MailEditorMainWindow::on_actionSend_triggered()
  {
  TPhysicalMailMessage msg;
  if(prepareMailMessage(&msg))
    {
    if(checkMsgSize(msg) == false)
      return;

    const IMailProcessor::TIdentity& senderId = MailFields->GetSenderIdentity();
    MailProcessor.Send(senderId, msg, DraftMessage.valid() ? &(*DraftMessage) : nullptr);
    /// Clear potential modified flag to avoid asking for saving changes.
    ui->messageEdit->document()->setModified(false);
    close();
    }
  }