void new_mail_widget::make_toolbars() { QToolBar* toolbar = addToolBar(tr("Message Operations")); toolbar->addAction(m_action_send_msg); toolbar->addAction(m_action_attach_file); toolbar->addAction(m_action_edit_note); toolbar->addAction(m_action_add_header); toolbar->addAction(m_action_open_notepad); m_toolbar_html1 = m_toolbar_html2 = NULL; if (m_html_edit) { QList<QToolBar*> toolbars = m_html_edit->create_toolbars(); for (int i=0; i<toolbars.size(); i++) { if (i==0) m_toolbar_html1 = toolbars[i]; if (i==1) { addToolBarBreak(); m_toolbar_html2 = toolbars[i]; } addToolBar(toolbars[i]); } // Add our own toggle button to the second HTML toolbar if (m_toolbar_html2 != NULL) { QToolButton* source = new QToolButton(); source->setIcon(HTML_ICON("stock_view-html-source.png")); source->setToolTip(tr("Toggle between HTML source edit and visual edit")); source->setCheckable(true); connect(source, SIGNAL(toggled(bool)), this, SLOT(toggle_edit_source(bool))); m_toolbar_html2->addWidget(source); } }
void html_editor::create_actions() { for (uint i=0; i<sizeof(m_action_definitions)/sizeof(m_action_definitions[0]); i++) { struct action_type* def = &m_action_definitions[i]; QAction* a; if (def->webaction == QWebPage::NoWebAction) { // the action is owned by us a = new QAction(tr(def->name), this); } else { // action already provided by QWebPage a = page()->action(def->webaction); } if (a) { a->setIcon(HTML_ICON(def->icon)); if (def->shortcut) a->setShortcut(tr(def->shortcut)); m_actions[def->name] = a; if (def->slot) connect(a, SIGNAL(triggered()), this, def->slot); } } }