BtOpenWorkAction::BtOpenWorkAction(QObject *parent) : QAction(parent) { m_menu = new BtOpenWorkActionMenu(); m_menu->setSourceModel(CPointers::backend()->model()); setMenu(m_menu); setIcon(util::directory::getIcon("folder-open.svg")); retranslateUi(); slotModelChanged(); BtBookshelfFilterModel *filterModel = m_menu->postFilterModel(); connect(m_menu, SIGNAL(triggered(CSwordModuleInfo*)), this, SIGNAL(triggered(CSwordModuleInfo*))); connect(filterModel, SIGNAL(layoutChanged()), this, SLOT(slotModelChanged())); connect(filterModel, SIGNAL(modelReset()), this, SLOT(slotModelChanged())); connect(filterModel, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(slotModelChanged())); connect(filterModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(slotModelChanged())); }
BtOpenWorkAction::BtOpenWorkAction(const QString &groupingConfigKey, QObject *parent) : QAction(parent) { m_menu = new BtOpenWorkActionMenu(groupingConfigKey); m_menu->setSourceModel(CSwordBackend::instance()->model()); setMenu(m_menu); setIcon(CResMgr::mainWindow::icon_openAction()); retranslateUi(); slotModelChanged(); BtBookshelfFilterModel *filterModel = m_menu->postFilterModel(); connect(m_menu, SIGNAL(triggered(CSwordModuleInfo*)), this, SIGNAL(triggered(CSwordModuleInfo*))); connect(filterModel, SIGNAL(layoutChanged()), this, SLOT(slotModelChanged())); connect(filterModel, SIGNAL(modelReset()), this, SLOT(slotModelChanged())); connect(filterModel, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(slotModelChanged())); connect(filterModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(slotModelChanged())); }