void ToolsManager::addTool(QMenu* menu, const QString& name, AbstractTool* (*tool)(QWidget*)) { QAction* action = new QAction(name, menu); menu->addAction(action); this->m_Tools.insert(action, tool); connect(action, SIGNAL(triggered()), this, SLOT(runTool())); };
void SslCertificate::generateFingerprint(const QString& certificateFilename) { QStringList arguments; arguments.append("x509"); arguments.append("-fingerprint"); arguments.append("-sha1"); arguments.append("-noout"); arguments.append("-in"); arguments.append(certificateFilename); if (!runTool(arguments)) { return; } // find the fingerprint from the tool output int i = m_ToolOutput.indexOf("="); if (i != -1) { i++; QString fingerprint = m_ToolOutput.mid( i, m_ToolOutput.size() - i); Fingerprint::local().trust(fingerprint, false); emit info(tr("SSL fingerprint generated.")); } else { emit error(tr("Failed to find SSL fingerprint.")); } }
bool TOOL_MANAGER::runTool( const std::string& aToolName ) { TOOL_BASE* tool = FindTool( aToolName ); if( tool && tool->GetType() == INTERACTIVE ) return runTool( tool ); return false; // there is no tool with the given name }
bool TOOL_MANAGER::runTool( TOOL_ID aToolId ) { TOOL_BASE* tool = FindTool( aToolId ); if( tool && tool->GetType() == INTERACTIVE ) return runTool( tool ); return false; // there is no tool with the given id }
void SslCertificate::generateCertificate() { QStringList arguments; // self signed certificate arguments.append("req"); arguments.append("-x509"); arguments.append("-nodes"); // valide duration arguments.append("-days"); arguments.append(kCertificateLifetime); // subject information arguments.append("-subj"); QString subInfo(kCertificateSubjectInfo); arguments.append(subInfo); // private key arguments.append("-newkey"); arguments.append("rsa:1024"); QString sslDirPath = QString("%1%2%3") .arg(m_ProfileDir) .arg(QDir::separator()) .arg(kSslDir); QDir sslDir(sslDirPath); if (!sslDir.exists()) { sslDir.mkpath("."); } QString filename = QString("%1%2%3") .arg(sslDirPath) .arg(QDir::separator()) .arg(kCertificateFilename); // key output filename arguments.append("-keyout"); arguments.append(filename); // certificate output filename arguments.append("-out"); arguments.append(filename); if (!runTool(arguments)) { return; } emit info(tr("SSL certificate generated.")); generateFingerprint(filename); emit generateFinished(); }
bool TOOL_MANAGER::dispatchActivation( const TOOL_EVENT& aEvent ) { if( aEvent.IsActivate() ) { std::map<std::string, TOOL_STATE*>::iterator tool = m_toolNameIndex.find( *aEvent.GetCommandStr() ); if( tool != m_toolNameIndex.end() ) { runTool( tool->second->theTool ); return true; } } return false; }
int main(int argc, char *argv[]) { int result = 0; ATerm bottomOfStack; char* atargs[6]; int useToolbus = 0; int i = 0; atargs[0] = argv[0]; atargs[1] = "-at-termtable"; atargs[2] = "18"; atargs[3] = "-at-afuntable"; atargs[4] = "15"; atargs[5] = "-at-silent"; /*atargs[5] = "-at-verbose";*/ /* The main options haven't been set yet so we can't check if we're doing the * stats. */ SGLR_STATS_initialMRSS = STATS_ResidentSetSize(); ATinit(6, atargs, &bottomOfStack); /* Set to debug ATerms.*/ /*ATsetChecking(ATtrue);*/ SGLR_initialize(); SGLR_STATS_setCount(SGLR_STATS_initialMemAllocated, STATS_Allocated()); for (i=1; !useToolbus && i < argc; i++) { useToolbus = !strcmp(argv[i], "-TB_TOOL_NAME"); } if (useToolbus) { runTool(&bottomOfStack, argc, argv); } else { result = runCommandLineTool(argc, argv); } SGLR_STATS_setCount(SGLR_STATS_endMRSS, STATS_ResidentSetSize()); return result; }
void ToolsManager::addTool(QMenu* menu, QAction* action, AbstractTool* (*tool)(QWidget*)) { menu->addAction(action); this->m_Tools.insert(action, tool); connect(action, SIGNAL(triggered()), this, SLOT(runTool())); };