void BtBookshelfDockWidget::slotPrepareItemContextMenu() { void *v = m_itemContextMenu->property("BtModule").value<void*>(); CSwordModuleInfo *module = static_cast<CSwordModuleInfo*>(v); m_itemOpenAction->setEnabled(!module->isLocked()); m_itemSearchAction->setText(tr("&Search in %1...").arg(module->name())); m_itemSearchAction->setEnabled(!module->isLocked()); m_itemUnlockAction->setEnabled(module->isLocked()); }
bool ModuleInterface::isLocked(const QString& moduleName) { CSwordModuleInfo* module = CSwordBackend::instance()->findModuleByName(moduleName); if (module) { // Verse intros must be false for checking lock if (module->type() == CSwordModuleInfo::Bible || module->type() == CSwordModuleInfo::Commentary) { ((sword::VerseKey*)(module->module()->getKey()))->setIntros(false); } bool locked = module->isLocked(); return locked; } return false; }