void BtInstallThread::removeModule() { qDebug() << "BtInstallThread::removeModule start"; CSwordModuleInfo* m; m = CPointers::backend()->findModuleByName(m_module); if (!m) { m = instbackend::backend(instbackend::source(m_destination.toLatin1()))->findModuleByName(m_module); } if (m) { //module found? qDebug() << "BtInstallThread::removeModule, module" << m_module << "found"; QString prefixPath = m->config(CSwordModuleInfo::AbsoluteDataPath) + "/"; QString dataPath = m->config(CSwordModuleInfo::DataPath); if (dataPath.left(2) == "./") { dataPath = dataPath.mid(2); } if (prefixPath.contains(dataPath)) { prefixPath.remove( prefixPath.indexOf(dataPath), dataPath.length() ); } else { prefixPath = QString::fromLatin1(CPointers::backend()->prefixPath); } sword::SWMgr mgr(prefixPath.toLatin1()); BtInstallMgr iMgr; iMgr.removeModule(&mgr, m->name().toLatin1()); } else { qDebug() << "BtInstallThread::removeModule, module" << m_module << "not found"; } }
QString remoteModuleToolTip(const CSwordModuleInfo & module, const QString & localVer) { QString text = "<p style='white-space:pre'><b>"; text += module.name(); text += "</b> "; if (module.category() == CSwordModuleInfo::Cult) { text += "<small><b>"; text += QObject::tr("Take care, this work contains cult / questionable " "material!"); text += "</b></small><br/>"; } text += "<small>("; text += module.config(CSwordModuleInfo::Description); text += ")</small><hr/>"; if (module.isEncrypted()) { text += QObject::tr("Encrypted - needs unlock key"); text += "<br/>"; } if (!localVer.isEmpty()) { text += "<b>"; text += QObject::tr("Updated version available!"); text += "</b><br/>"; } if (module.hasVersion()) { text += QObject::tr("Version"); text += ": "; text += module.config(CSwordModuleInfo::ModuleVersion); } // if installed already if (!localVer.isEmpty()) { text += " "; text += QObject::tr("Installed version"); text += ": "; text += localVer; } text += "<br/><small>("; text += QObject::tr("Double click for more information"); text += ")</small></p>"; return text; }
void BtInstallThread::removeModule() { CSwordModuleInfo* m = CPointers::backend()->findModuleByName(m_module); if (m) { //module found? QString prefixPath = m->config(CSwordModuleInfo::AbsoluteDataPath) + "/"; QString dataPath = m->config(CSwordModuleInfo::DataPath); if (dataPath.left(2) == "./") { dataPath = dataPath.mid(2); } if (prefixPath.contains(dataPath)) { prefixPath.remove( prefixPath.indexOf(dataPath), dataPath.length() ); } else { prefixPath = QString::fromLatin1(CPointers::backend()->prefixPath); } sword::SWMgr mgr(prefixPath.toLatin1()); //BtInstallMgr iMgr; //TODO: use SWModule name, see also removepage m_iMgr.removeModule(&mgr, m->name().toLatin1()); } }
void BtInstallThread::removeTempFiles() { qDebug("BtInstallThread::removeTempFiles start"); // (take the remote conf file for this module, take DataPath, // take the absolute path of the InstallMgr) //sword::InstallSource is = instbackend::source(m_source); if (instbackend::isRemote(*m_installSource)) { // get the path for the module temp files CSwordModuleInfo* mInfo = m_backendForSource->findModuleByName(m_module); QString dataPath = mInfo->config(CSwordModuleInfo::AbsoluteDataPath); qDebug() << "Delete path:" << dataPath; // it's easier to use sword than qt sword::FileMgr::removeDir(dataPath.toLatin1().data()); } }