bool BlackBerryCheckDevModeStep::init()
{
    if (!BlackBerryAbstractDeployStep::init())
        return false;

    QString deployCmd = target()->activeBuildConfiguration()->environment().searchInPath(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD));
    if (deployCmd.isEmpty()) {
        raiseError(tr("Could not find command '%1' in the build environment")
                       .arg(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD)));
        return false;
    }

    BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(target()->kit());
    QString deviceHost = device ? device->sshParameters().host : QString();
    if (deviceHost.isEmpty()) {
        raiseError(tr("No hostname specified for device"));
        return false;
    }

    QStringList args;
    args << QLatin1String("-listDeviceInfo");
    args << deviceHost;
    if (!device->sshParameters().password.isEmpty()) {
        args << QLatin1String("-password");
        args << device->sshParameters().password;
    }

    addCommand(deployCmd, args);

    return true;
}
Debugger::DebuggerStartParameters BlackBerryRunControlFactory::startParameters(
    const BlackBerryRunConfiguration *runConfig)
{
    Debugger::DebuggerStartParameters params;
    ProjectExplorer::Target *target = runConfig->target();
    ProjectExplorer::Profile *profile = target->profile();

    params.startMode = Debugger::AttachToRemoteServer;
    params.debuggerCommand = Debugger::DebuggerProfileInformation::debuggerCommand(profile).toString();
    params.sysRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(profile).toString();

    if (ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainProfileInformation::toolChain(profile)) {
        params.toolChainAbi = tc->targetAbi();
        params.remoteArchitecture = ProjectExplorer::Abi::toString(tc->targetAbi().architecture());
    }

    params.executable = runConfig->localExecutableFilePath();
    params.remoteChannel = runConfig->deployConfiguration()->deviceHost() + QLatin1String(":8000");
    params.displayName = runConfig->displayName();
    params.remoteSetupNeeded = true;

    if (runConfig->debuggerAspect()->useQmlDebugger()) {
        BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(runConfig->target()->profile());
        if (device) {
            params.qmlServerAddress = device->sshParameters().host;
            params.qmlServerPort = runConfig->debuggerAspect()->qmlDebugServerPort();
            params.languages |= Debugger::QmlLanguage;
        }
    }
    if (runConfig->debuggerAspect()->useCppDebugger())
        params.languages |= Debugger::CppLanguage;

    if (const ProjectExplorer::Project *project = runConfig->target()->project()) {
        params.projectSourceDirectory = project->projectDirectory();
        if (const ProjectExplorer::BuildConfiguration *buildConfig = runConfig->target()->activeBuildConfiguration()) {
            params.projectBuildDirectory = buildConfig->buildDirectory();
        }
        params.projectSourceFiles = project->files(ProjectExplorer::Project::ExcludeGeneratedFiles);
    }

    BlackBerryQtVersion *qtVersion =
        dynamic_cast<BlackBerryQtVersion *>(QtSupport::QtProfileInformation::qtVersion(profile));
    if (qtVersion)
        params.solibSearchPath = QnxUtils::searchPaths(qtVersion);

    return params;
}
QString BlackBerryCheckDevModeStep::password() const
{
    BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(target()->kit());
    return device ? device->sshParameters().password : QString();
}