void CustomBuildJob::start() { if( type == CustomBuildSystemTool::Undefined ) { setError( UndefinedBuildType ); setErrorText( i18n( "Undefined Build type" ) ); emitResult(); } else if( cmd.isEmpty() ) { setError( NoCommand ); setErrorText( i18n( "No command given" ) ); emitResult(); } else if( !enabled ) { setError( ToolDisabled ); setErrorText( i18n( "This command is disabled" ) ); emitResult(); } else { KShell::Errors err; QStringList strargs = KShell::splitArgs( arguments, KShell::AbortOnMeta, &err ); if( err != KShell::NoError ) { setError( WrongArgs ); setErrorText( i18n( "The given arguments would need a real shell, this is not supported currently." ) ); emitResult(); } setStandardToolView( KDevelop::IOutputView::BuildView ); setBehaviours( KDevelop::IOutputView::AllowUserClose | KDevelop::IOutputView::AutoScroll ); KDevelop::OutputModel* model = new KDevelop::OutputModel( builddir ); model->setFilteringStrategy( KDevelop::OutputModel::CompilerFilter ); setModel( model ); startOutput(); exec = new KDevelop::CommandExecutor( cmd, this ); exec->setArguments( strargs ); exec->setEnvironment( KDevelop::EnvironmentGroupList( KGlobal::config() ).createEnvironment( environment, KProcess::systemEnvironment() ) ); exec->setWorkingDirectory( builddir ); connect( exec, SIGNAL(completed(int)), SLOT(procFinished(int)) ); connect( exec, SIGNAL(failed( QProcess::ProcessError )), SLOT(procError( QProcess::ProcessError )) ); connect( exec, SIGNAL(receivedStandardError(QStringList)), model, SLOT(appendLines(QStringList)) ); connect( exec, SIGNAL(receivedStandardOutput(QStringList)), model, SLOT(appendLines(QStringList)) ); model->appendLine( QString("%1>%2 %3").arg( builddir ).arg( cmd ).arg( arguments ) ); exec->start(); } }
bool RdpView::start() { m_containerWidget->show(); if (m_url.userName().isEmpty()) { QString userName; bool ok = false; userName = QInputDialog::getText(this, i18n("Enter Username"), i18n("Please enter the username you would like to use for login."), QLineEdit::Normal, Settings::defaultRdpUserName(), &ok); if (ok) { m_url.setUserName(userName); } } if (!m_url.userName().isEmpty()) { const bool useLdapLogin = Settings::recognizeLdapLogins() && m_url.userName().contains(QLatin1Char('\\')); qCDebug(KRDC) << "Is LDAP login:"******"Access to the system requires a password.")); if (dialog.exec() == KPasswordDialog::Accepted) { m_url.setPassword(dialog.password()); if (m_hostPreferences->walletSupport()) { saveWalletPassword(dialog.password(), useLdapLogin); } } } } // Check the version of FreeRDP so we can use pre-1.1 switches if needed QProcess *xfreeRDPVersionCheck = new QProcess(this); xfreeRDPVersionCheck->start(QStringLiteral("xfreerdp"), QStringList(QStringLiteral("--version"))); xfreeRDPVersionCheck->waitForFinished(); QString versionOutput = QString::fromUtf8(xfreeRDPVersionCheck->readAllStandardOutput().constData()); xfreeRDPVersionCheck->deleteLater(); m_process = new QProcess(m_container); QStringList arguments; int width, height; if (m_hostPreferences->width() > 0) { width = m_hostPreferences->width(); height = m_hostPreferences->height(); } else { width = this->parentWidget()->size().width(); height = this->parentWidget()->size().height(); } m_containerWidget->setFixedWidth(width); m_containerWidget->setFixedHeight(height); setMaximumSize(width, height); if (versionOutput.contains(QLatin1String(" 1.0"))) { qCDebug(KRDC) << "Use FreeRDP 1.0 compatible arguments"; arguments << QStringLiteral("-g") << QString::number(width) + QLatin1Char('x') + QString::number(height); arguments << QStringLiteral("-k") << keymapToXfreerdp(m_hostPreferences->keyboardLayout()); if (!m_url.userName().isEmpty()) { // if username contains a domain, it needs to be set with another parameter if (m_url.userName().contains(QLatin1Char('\\'))) { const QStringList splittedName = m_url.userName().split(QLatin1Char('\\')); arguments << QStringLiteral("-d") << splittedName.at(0); arguments << QStringLiteral("-u") << splittedName.at(1); } else { arguments << QStringLiteral("-u") << m_url.userName(); } } else { arguments << QStringLiteral("-u") << QStringLiteral(""); } arguments << QStringLiteral("-D"); // request the window has no decorations arguments << QStringLiteral("-X") << QString::number(m_container->winId()); arguments << QStringLiteral("-a") << QString::number((m_hostPreferences->colorDepth() + 1) * 8); switch (m_hostPreferences->sound()) { case 1: arguments << QStringLiteral("-o"); break; case 0: arguments << QStringLiteral("--plugin") << QStringLiteral("rdpsnd"); break; case 2: default: break; } if (!m_hostPreferences->shareMedia().isEmpty()) { QStringList shareMedia; shareMedia << QStringLiteral("--plugin") << QStringLiteral("rdpdr") << QStringLiteral("--data") << QStringLiteral("disk:media:") + m_hostPreferences->shareMedia() << QStringLiteral("--"); arguments += shareMedia; } QString performance; switch (m_hostPreferences->performance()) { case 0: performance = QLatin1Char('m'); break; case 1: performance = QLatin1Char('b'); break; case 2: performance = QLatin1Char('l'); break; default: break; } arguments << QStringLiteral("-x") << performance; if (m_hostPreferences->console()) { arguments << QStringLiteral("-0"); } if (m_hostPreferences->remoteFX()) { arguments << QStringLiteral("--rfx"); } if (!m_hostPreferences->extraOptions().isEmpty()) { const QStringList additionalArguments = KShell::splitArgs(m_hostPreferences->extraOptions()); arguments += additionalArguments; } // krdc has no support for certificate management yet; it would not be possbile to connect to any host: // "The host key for example.com has changed" ... // "Add correct host key in ~/.freerdp/known_hosts to get rid of this message." arguments << QStringLiteral("--ignore-certificate"); // clipboard sharing is activated in KRDC; user can disable it at runtime arguments << QStringLiteral("--plugin") << QStringLiteral("cliprdr"); arguments << QStringLiteral("-t") << QString::number(m_port); arguments << m_host; qCDebug(KRDC) << "Starting xfreerdp with arguments: " << arguments.join(QStringLiteral(" ")); arguments.removeLast(); // host must be last, remove and re-add it after the password if (!m_url.password().isNull()) arguments << QStringLiteral("-p") << m_url.password(); arguments << m_host; } else { qCDebug(KRDC) << "Use FreeRDP 1.1+ compatible arguments"; arguments << QStringLiteral("-decorations"); arguments << QStringLiteral("/w:") + QString::number(width); arguments << QStringLiteral("/h:") + QString::number(height); arguments << QStringLiteral("/kbd:") + keymapToXfreerdp(m_hostPreferences->keyboardLayout()); if (!m_url.userName().isEmpty()) { // if username contains a domain, it needs to be set with another parameter if (m_url.userName().contains(QLatin1Char('\\'))) { const QStringList splittedName = m_url.userName().split(QLatin1Char('\\')); arguments << QStringLiteral("/d:") + splittedName.at(0); arguments << QStringLiteral("/u:") + splittedName.at(1); } else { arguments << QStringLiteral("/u:") + m_url.userName(); } } else { arguments << QStringLiteral("/u:"); } arguments << QStringLiteral("/parent-window:") + QString::number(m_container->winId()); arguments << QStringLiteral("/bpp:") + QString::number((m_hostPreferences->colorDepth() + 1) * 8); arguments << QStringLiteral("/audio-mode:") + QString::number(m_hostPreferences->sound()); switch (m_hostPreferences->soundSystem()) { case 0: arguments << QStringLiteral("/sound:sys:alsa"); break; case 1: arguments << QStringLiteral("/sound:sys:pulse"); break; default: break; } if (!m_hostPreferences->shareMedia().isEmpty()) { QStringList shareMedia; shareMedia << QStringLiteral("/drive:media,") + m_hostPreferences->shareMedia(); arguments += shareMedia; } QString performance; switch (m_hostPreferences->performance()) { case 0: performance = QStringLiteral("modem"); break; case 1: performance = QStringLiteral("broadband"); break; case 2: performance = QStringLiteral("lan"); break; default: break; } arguments << QStringLiteral("/network:") + performance; if (m_hostPreferences->console()) { arguments << QStringLiteral("/admin"); } if (m_hostPreferences->remoteFX()) { arguments << QStringLiteral("/rfx"); } if (!m_hostPreferences->extraOptions().isEmpty()) { const QStringList additionalArguments = KShell::splitArgs(m_hostPreferences->extraOptions()); arguments += additionalArguments; } // krdc has no support for certificate management yet; it would not be possbile to connect to any host: // "The host key for example.com has changed" ... // "Add correct host key in ~/.freerdp/known_hosts to get rid of this message." arguments << QStringLiteral("/cert-ignore"); // clipboard sharing is activated in KRDC; user can disable it at runtime arguments << QStringLiteral("+clipboard"); arguments << QStringLiteral("/port:") + QString::number(m_port); arguments << QStringLiteral("/v:") + m_host; qCDebug(KRDC) << "Starting xfreerdp with arguments: " << arguments.join(QStringLiteral(" ")); //avoid printing the password in debug if (!m_url.password().isNull()) { arguments << QStringLiteral("/p:") + m_url.password(); } } setStatus(Connecting); connect(m_process, SIGNAL(error(QProcess::ProcessError)), SLOT(processError(QProcess::ProcessError))); connect(m_process, SIGNAL(readyReadStandardError()), SLOT(receivedStandardError())); connect(m_process, SIGNAL(readyReadStandardOutput()), SLOT(receivedStandardOutput())); connect(m_process, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(connectionClosed())); connect(m_process, SIGNAL(started()), SLOT(connectionOpened())); m_process->start(QStringLiteral("xfreerdp"), arguments); return true; }