Exemplo n.º 1
0
bool RecentFiles::eventFilter(QObject *obj, QEvent *evt)
{
    if (obj == m_menu && evt->type() == QEvent::Show && m_dirty) {
        m_menu->clear();
        foreach (QString filePath, m_fileList) {
            QString title = QFontMetrics(m_menu->font()).elidedText(filePath, Qt::ElideMiddle, m_maxPathLength);
            QAction *act = new QAction(title, m_menu.data());
            act->setData(filePath);
            m_menu->addAction(act);

            connect(act, SIGNAL(triggered()), SLOT(onActionTriggered()));
        }
Exemplo n.º 2
0
bool MassMessaging::load()
{
	ActionGenerator *gen = new ActionGenerator(Icon("mail-send"),
											   QT_TRANSLATE_NOOP("MassMessaging", "&Mass Messaging"),
											   this,
											   SLOT(onActionTriggered())
											   );
	gen->setType(ActionTypeAdditional);
	MenuController *contactList = ServiceManager::getByName<MenuController*>("ContactList");
	if (contactList)
		contactList->addAction(gen);

	return true;
}