message_view::message_view(QWidget* parent, msg_list_window* sub_parent) : QWidget(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_bodyv = new body_view(); QVBoxLayout* top_layout=new QVBoxLayout(this); top_layout->setContentsMargins(0,0,0,0); top_layout->setSpacing(0); top_layout->addWidget(m_bodyv); 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(popup_body_context_menu()), SIGNAL(popup_body_context_menu())); if (m_parent) { connect(m_bodyv->page(), SIGNAL(linkHovered(const QString&,const QString, const QString&)), this, SLOT(display_link(const QString&))); } connect(m_bodyv, SIGNAL(linkClicked(const QUrl&)), this, SLOT(link_clicked(const QUrl&))); QShortcut* t = new QShortcut(QKeySequence(tr("Ctrl+A", "Select all")), this); t->setContext(Qt::WidgetWithChildrenShortcut); connect(t, SIGNAL(activated()), this, SLOT(select_all_text())); }
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())); }