void CBookReadWindow::initActions() { CLexiconReadWindow::initActions(); BtActionCollection* ac = actionCollection(); //cleanup, not a clean oo-solution Q_ASSERT(ac->action("nextEntry")); Q_ASSERT(ac->action("previousEntry")); ac->action("nextEntry")->setEnabled(false); ac->action("previousEntry")->setEnabled(false); m_treeAction = new QAction( QIcon(CResMgr::displaywindows::bookWindow::toggleTree::icon), tr("Toggle tree view"), ac ); m_treeAction->setCheckable(true); m_treeAction->setShortcut(CResMgr::displaywindows::bookWindow::toggleTree::accel); QObject::connect(m_treeAction, SIGNAL(triggered()), this, SLOT(treeToggled()) ); ac->addAction("toggleTree", m_treeAction); // CBTConfig::setupAccelSettings(CBTConfig::bookWindow, ac); }
void CLexiconReadWindow::initActions() { qDebug("CLexiconReadWindow::initActions"); BtActionCollection* ac = actionCollection(); CLexiconReadWindow::insertKeyboardActions(ac); CReadWindow::initActions(); m_actions.backInHistory = dynamic_cast<BtToolBarPopupAction*>( ac->action(CResMgr::displaywindows::general::backInHistory::actionName) ); Q_ASSERT(m_actions.backInHistory); m_actions.forwardInHistory = dynamic_cast<BtToolBarPopupAction*>( ac->action(CResMgr::displaywindows::general::forwardInHistory::actionName) ); Q_ASSERT(m_actions.forwardInHistory); QAction* kaction; kaction = new QAction(tr("Next entry"), ac ); kaction->setShortcut( CResMgr::displaywindows::lexiconWindow::nextEntry::accel); QObject::connect(kaction, SIGNAL(triggered()), this, SLOT( nextEntry() ) ); ac->addAction("nextEntry", kaction); kaction = new QAction(tr("Previous entry"), ac ); kaction->setShortcut( CResMgr::displaywindows::lexiconWindow::previousEntry::accel); QObject::connect(kaction, SIGNAL(triggered()), this, SLOT( previousEntry() ) ); ac->addAction("previousEntry", kaction); m_actions.selectAll = qobject_cast<QAction*>(ac->action("selectAll")); //TODO: Q_ASSERT(m_actions.selectAll); m_actions.findText = qobject_cast<QAction*>(ac->action("findText")); //TODO: Q_ASSERT(m_actions.findText); m_actions.findStrongs = new QAction( QIcon(CResMgr::displaywindows::general::findStrongs::icon), tr("Strong's Search"), ac ); m_actions.findStrongs->setShortcut(CResMgr::displaywindows::general::findStrongs::accel); QObject::connect(m_actions.findStrongs, SIGNAL(triggered()), this, SLOT(openSearchStrongsDialog()) ); ac->addAction(CResMgr::displaywindows::general::findStrongs::actionName, m_actions.findStrongs); m_actions.copy.reference = new QAction(tr("Reference only"), ac ); QObject::connect(m_actions.copy.reference, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(copyAnchorOnly()) ); ac->addAction("copyReferenceOnly", m_actions.copy.reference); m_actions.copy.entry = new QAction(tr("Entry with text"), ac ); QObject::connect(m_actions.copy.entry, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(copyAll()) ); ac->addAction("copyEntryWithText", m_actions.copy.entry); Q_ASSERT(ac->action("copySelectedText")); m_actions.copy.selectedText = qobject_cast<QAction*>(ac->action("copySelectedText")); m_actions.save.entryAsPlain = new QAction(tr("Entry as plain text"), ac ); QObject::connect(m_actions.save.entryAsPlain, SIGNAL(triggered()), this, SLOT(saveAsPlain()) ); ac->addAction("saveEntryAsPlain", m_actions.save.entryAsPlain); m_actions.save.entryAsHTML = new QAction(tr("Entry as HTML"), ac ); QObject::connect(m_actions.save.entryAsHTML, SIGNAL(triggered()), this, SLOT(saveAsHTML())); ac->addAction("saveEntryAsHTML", m_actions.save.entryAsHTML); m_actions.print.reference = new QAction(tr("Reference only"), ac); QObject::connect(m_actions.print.reference, SIGNAL(triggered()), this, SLOT(printAnchorWithText())); ac->addAction("printReferenceOnly", m_actions.print.reference); m_actions.print.entry = new QAction(tr("Entry with text"), ac); QObject::connect(m_actions.print.entry, SIGNAL(triggered()), this, SLOT(printAll())); ac->addAction("printEntryWithText", m_actions.print.entry); // init with the user defined settings qDebug("call CBTConfig::setupAccelSettings(CBTConfig::lexiconWindow, ac); and end CLexiconReadWindow::initActions"); // CBTConfig::setupAccelSettings(CBTConfig::lexiconWindow, ac); }