예제 #1
0
message_view::message_view(QWidget* parent, msg_list_window* sub_parent) : QScrollArea(parent)
{
  m_pmsg=NULL;
  m_content_type_shown = 0;
  m_zoom_factor=1.0;
  m_parent = sub_parent;
  setAutoFillBackground(true);
  QPalette pal = palette();
  pal.setColor(QPalette::Active, QPalette::Background, Qt::white);
  pal.setColor(QPalette::Inactive, QPalette::Background, Qt::white);
  setPalette(pal);

  enable_page_nav(false, false);
  m_headersv = new headers_view();
  m_bodyv = new body_view();
  QVBoxLayout* top_layout=new QVBoxLayout(this);
  m_frame = new QFrame();
  m_frame->setFrameStyle(QFrame::Box | QFrame::Raised);
  m_frame->setLineWidth(0);
  m_frame->setMinimumSize(QSize(200,200));

//  m_frame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
  top_layout->addWidget(m_frame);
  QVBoxLayout* l =new QVBoxLayout(m_frame);

  l->setContentsMargins(0,0,0,0);
  l->setSpacing(0);
  l->addWidget(m_headersv);
  l->setStretchFactor(m_headersv, 0);

  l->addWidget(m_bodyv);
  l->setStretchFactor(m_bodyv, 1);

  this->setWidget(m_frame);	// for the scrollarea

  connect(m_bodyv, SIGNAL(wheel(QWheelEvent*)), this, SLOT(wheel_body(QWheelEvent*)));
  connect(m_bodyv, SIGNAL(loadFinished(bool)), this, SLOT(load_finished(bool)));
  connect(m_bodyv, SIGNAL(external_contents_requested()), this,
	  SLOT(ask_for_external_contents()));
  connect(m_bodyv, SIGNAL(key_space_pressed()), this, SLOT(page_down()));
  connect(m_bodyv, SIGNAL(popup_body_context_menu()), SIGNAL(popup_body_context_menu()));
  if (m_parent) {
    connect(m_bodyv->page(),
	    SIGNAL(linkHovered(const QString&,const QString, const QString&)),
	    m_parent, SLOT(show_status_message(const QString&)));
  }
  connect(m_headersv, SIGNAL(fetch_ext_contents()), this, SLOT(allow_external_contents()));
  connect(m_headersv, SIGNAL(to_text()), this, SLOT(show_text_part()));
  connect(m_headersv, SIGNAL(to_html()), this, SLOT(show_html_part()));
  connect(m_headersv, SIGNAL(complete_load_request()), this, SLOT(complete_body_load()));
  m_header_has_selection=false;
  connect(m_headersv, SIGNAL(copyAvailable(bool)), this, SLOT(headers_own_selection(bool)));
  connect(m_headersv, SIGNAL(selectionChanged()), this, SLOT(headers_selection_changed()));
  connect(m_headersv, SIGNAL(msg_display_request()), this, SIGNAL(on_demand_show_request()));
  connect(m_bodyv->page(), SIGNAL(selectionChanged()), this, SLOT(body_selection_changed()));
}
예제 #2
0
void
message_view::link_clicked(const QUrl& url)
{
  if (url.scheme()=="mailto") {
#if QT_VERSION<0x050000 // later
    // TODO: use more headers, particularly "body"
    mail_header header;
    if (!url.path().isEmpty())
      header.m_to=url.path();
    if (url.hasQueryItem("subject")) {
      header.m_subject=url.queryItemValue("subject");
    }
    gl_pApplication->start_new_mail(header);
#endif
  }
  else if (url.scheme().isEmpty()) {
    const QString cmd=url.toString();
    if (cmd=="#manitou-fetch") {
      allow_external_contents();
    }
    else if (cmd=="#manitou-to_text") {
      show_text_part();
    }
    else if (cmd=="#manitou-to_html") {
      show_html_part();
    }
    else if (cmd=="#manitou-show") {
      emit on_demand_show_request();
      display_commands();
    }
    else if (cmd=="#manitou-complete_load") {
      complete_body_load();
      enable_command("complete_load", false);
      display_commands();
    }    
  }
  else {
    browser::open_url(url);
  }
}