summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRafael Roquetto <rafael.roquetto@kdab.com>2013-02-18 19:22:21 -0300
committerhjk <hjk121@nokiamail.com>2013-02-21 18:09:56 +0100
commit0a0debe3875589f734a089ab43894e73057d36fc (patch)
treeebf23f5f39cb69cb24e89b562fe3ff37c425210a /src
parent2be16feb5cd1b3455891ec20b76d19c3da098b1e (diff)
downloadqt-creator-0a0debe3875589f734a089ab43894e73057d36fc.tar.gz
Qnx: Simple BlackBerry debug token management.
This patch enables debug token creation and installation. Change-Id: I85cbb8ddc413228662cd7967e1805196212a430c Reviewed-by: Tobias Nätterlund <tobias.naetterlund@kdab.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/qnx/blackberrydebugtokenrequestdialog.cpp229
-rw-r--r--src/plugins/qnx/blackberrydebugtokenrequestdialog.h79
-rw-r--r--src/plugins/qnx/blackberrydebugtokenrequestdialog.ui153
-rw-r--r--src/plugins/qnx/blackberrydebugtokenrequester.cpp75
-rw-r--r--src/plugins/qnx/blackberrydebugtokenrequester.h63
-rw-r--r--src/plugins/qnx/blackberrydebugtokenuploader.cpp68
-rw-r--r--src/plugins/qnx/blackberrydebugtokenuploader.h66
-rw-r--r--src/plugins/qnx/blackberrydeviceconfigurationwidget.cpp86
-rw-r--r--src/plugins/qnx/blackberrydeviceconfigurationwidget.h14
-rw-r--r--src/plugins/qnx/blackberrydeviceconfigurationwidget.ui25
-rw-r--r--src/plugins/qnx/blackberrydeviceconfigurationwizardpages.cpp13
-rw-r--r--src/plugins/qnx/blackberrydeviceconfigurationwizardpages.h1
-rw-r--r--src/plugins/qnx/blackberrydeviceconfigurationwizardsetuppage.ui62
-rw-r--r--src/plugins/qnx/blackberryndkprocess.cpp145
-rw-r--r--src/plugins/qnx/blackberryndkprocess.h87
-rw-r--r--src/plugins/qnx/qnx.pro15
-rw-r--r--src/plugins/qnx/qnx.qbs9
17 files changed, 1154 insertions, 36 deletions
diff --git a/src/plugins/qnx/blackberrydebugtokenrequestdialog.cpp b/src/plugins/qnx/blackberrydebugtokenrequestdialog.cpp
new file mode 100644
index 0000000000..955ed226d4
--- /dev/null
+++ b/src/plugins/qnx/blackberrydebugtokenrequestdialog.cpp
@@ -0,0 +1,229 @@
+/**************************************************************************
+**
+** Copyright (C) 2011 - 2013 Research In Motion
+**
+** Contact: Research In Motion (blackberry-qt@qnx.com)
+** Contact: KDAB (info@kdab.com)
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "blackberrydebugtokenrequestdialog.h"
+#include "blackberrydebugtokenrequester.h"
+#include "blackberryconfiguration.h"
+#include "blackberrycertificate.h"
+#include "ui_blackberrydebugtokenrequestdialog.h"
+
+#include <QPushButton>
+#include <QDir>
+#include <QMessageBox>
+
+namespace Qnx {
+namespace Internal {
+
+BlackBerryDebugTokenRequestDialog::BlackBerryDebugTokenRequestDialog(
+ QWidget *parent, Qt::WindowFlags f) :
+ QDialog(parent, f),
+ m_ui(new Ui_BlackBerryDebugTokenRequestDialog),
+ m_requester(new BlackBerryDebugTokenRequester)
+{
+ m_ui->setupUi(this);
+ m_ui->progressBar->hide();
+ m_ui->status->clear();
+ m_ui->debugTokenPath->setExpectedKind(Utils::PathChooser::Any);
+ m_ui->debugTokenPath->setPromptDialogTitle(tr("Request Debug Token"));
+ m_ui->debugTokenPath->setPromptDialogFilter(tr("BAR Files (*.bar)"));
+
+ m_cancelButton = m_ui->buttonBox->button(QDialogButtonBox::Cancel);
+ m_okButton = m_ui->buttonBox->button(QDialogButtonBox::Ok);
+ m_okButton->setEnabled(false);
+
+ populateComboBox();
+
+ connect(m_cancelButton, SIGNAL(clicked()),
+ this, SLOT(reject()));
+ connect(m_okButton, SIGNAL(clicked()),
+ this, SLOT(requestDebugToken()));
+ connect(m_ui->debugTokenPath, SIGNAL(changed(QString)),
+ this, SLOT(validate()));
+ connect(m_ui->debugTokenPath, SIGNAL(editingFinished()),
+ this, SLOT(appendExtension()));
+ connect(m_ui->keystorePassword, SIGNAL(textChanged(QString)),
+ this, SLOT(validate()));
+ connect(m_ui->cskPassword, SIGNAL(textChanged(QString)),
+ this, SLOT(validate()));
+ connect(m_ui->devicePin, SIGNAL(textChanged(QString)),
+ this, SLOT(validate()));
+ connect(m_ui->showPassword, SIGNAL(stateChanged(int)),
+ this, SLOT(checkBoxChanged(int)));
+ connect(m_requester, SIGNAL(finished(int)),
+ this, SLOT(debugTokenArrived(int)));
+}
+
+QString BlackBerryDebugTokenRequestDialog::debugToken() const
+{
+ return m_ui->debugTokenPath->path();
+}
+
+void BlackBerryDebugTokenRequestDialog::validate()
+{
+ if (!m_ui->debugTokenPath->isValid()
+ || m_ui->keystorePassword->text().isEmpty()
+ || m_ui->devicePin->text().isEmpty()
+ || m_ui->cskPassword->text().isEmpty()) {
+ m_okButton->setEnabled(false);
+ return;
+ }
+
+ QFileInfo fileInfo(m_ui->debugTokenPath->path());
+
+ if (!fileInfo.dir().exists()) {
+ m_ui->status->setText(tr("Base directory does not exist."));
+ m_okButton->setEnabled(false);
+ return;
+ }
+
+ m_ui->status->clear();
+ m_okButton->setEnabled(true);
+}
+
+void BlackBerryDebugTokenRequestDialog::requestDebugToken()
+{
+ setBusy(true);
+
+ QFile file(m_ui->debugTokenPath->path());
+
+ if (file.exists()) {
+ const int result = QMessageBox::question(this, tr("Are you sure?"),
+ tr("The file '%1' will be overwritten. Do you want to proceed?")
+ .arg(file.fileName()), QMessageBox::Yes | QMessageBox::No);
+
+ if (result & QMessageBox::Yes) {
+ file.remove();
+ } else {
+ setBusy(false);
+ return;
+ }
+ }
+
+ m_requester->requestDebugToken(m_ui->debugTokenPath->path(),
+ m_ui->cskPassword->text(),
+ m_ui->keystore->itemText(m_ui->keystore->currentIndex()),
+ m_ui->keystorePassword->text(), m_ui->devicePin->text());
+}
+
+void BlackBerryDebugTokenRequestDialog::appendExtension()
+{
+ QString path = m_ui->debugTokenPath->path();
+
+ if (!path.endsWith(QLatin1String(".bar"))) {
+ path += QLatin1String(".bar");
+ m_ui->debugTokenPath->setPath(path);
+ }
+}
+
+void BlackBerryDebugTokenRequestDialog::checkBoxChanged(int state)
+{
+ if (state == Qt::Checked) {
+ m_ui->cskPassword->setEchoMode(QLineEdit::Normal);
+ m_ui->keystorePassword->setEchoMode(QLineEdit::Normal);
+ } else {
+ m_ui->cskPassword->setEchoMode(QLineEdit::Password);
+ m_ui->keystorePassword->setEchoMode(QLineEdit::Password);
+ }
+}
+
+void BlackBerryDebugTokenRequestDialog::debugTokenArrived(int status)
+{
+ QString errorString = tr("Failed to request debug token: ");
+
+ switch (status) {
+ case BlackBerryDebugTokenRequester::Success:
+ accept();
+ return;
+ case BlackBerryDebugTokenRequester::WrongCskPassword:
+ errorString += tr("Wrong CSK password.");
+ break;
+ case BlackBerryDebugTokenRequester::WrongKeystorePassword:
+ errorString += tr("Wrong keystore password.");
+ break;
+ case BlackBerryDebugTokenRequester::NetworkUnreachable:
+ errorString += tr("Network unreachable.");
+ break;
+ case BlackBerryDebugTokenRequester::IllegalPin:
+ errorString += tr("Illegal device PIN.");
+ break;
+ case BlackBerryDebugTokenRequester::FailedToStartInferiorProcess:
+ errorString += tr("Failed to start inferior process.");
+ break;
+ case BlackBerryDebugTokenRequester::InferiorProcessTimedOut:
+ errorString += tr("Inferior processes timed out.");
+ break;
+ case BlackBerryDebugTokenRequester::InferiorProcessCrashed:
+ errorString += tr("Inferior process has crashed.");
+ break;
+ case BlackBerryDebugTokenRequester::InferiorProcessReadError:
+ case BlackBerryDebugTokenRequester::InferiorProcessWriteError:
+ errorString += tr("Failed to communicate with the inferior process.");
+ break;
+ case BlackBerryDebugTokenRequester::UnknownError:
+ errorString += tr("An unknwon error has occurred.");
+ break;
+ }
+
+ QMessageBox::critical(this, tr("Error"), errorString);
+
+ setBusy(false);
+}
+
+void BlackBerryDebugTokenRequestDialog::setBusy(bool busy)
+{
+ m_okButton->setEnabled(!busy);
+ m_cancelButton->setEnabled(!busy);
+ m_ui->debugTokenPath->setEnabled(!busy);
+ m_ui->keystore->setEnabled(!busy);
+ m_ui->keystorePassword->setEnabled(!busy);
+ m_ui->cskPassword->setEnabled(!busy);
+ m_ui->showPassword->setEnabled(!busy);
+ m_ui->devicePin->setEnabled(!busy);
+ m_ui->progressBar->setVisible(busy);
+
+ if (busy)
+ m_ui->status->setText(tr("Requesting debug token..."));
+ else
+ m_ui->status->clear();
+}
+
+void BlackBerryDebugTokenRequestDialog::populateComboBox()
+{
+ BlackBerryConfiguration &configuration = BlackBerryConfiguration::instance();
+
+ QList<BlackBerryCertificate*> certificates = configuration.certificates();
+
+ foreach (const BlackBerryCertificate *certificate, certificates)
+ m_ui->keystore->addItem(certificate->fileName());
+}
+
+}
+} // namespace Qnx
diff --git a/src/plugins/qnx/blackberrydebugtokenrequestdialog.h b/src/plugins/qnx/blackberrydebugtokenrequestdialog.h
new file mode 100644
index 0000000000..e31a1fd888
--- /dev/null
+++ b/src/plugins/qnx/blackberrydebugtokenrequestdialog.h
@@ -0,0 +1,79 @@
+/**************************************************************************
+**
+** Copyright (C) 2011 - 2013 Research In Motion
+**
+** Contact: Research In Motion (blackberry-qt@qnx.com)
+** Contact: KDAB (info@kdab.com)
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef QNX_INTERNAL_BLACKBERRYDEBUGTOKENREQUESTDIALOG_H
+#define QNX_INTERNAL_BLACKBERRYDEBUGTOKENREQUESTDIALOG_H
+
+#include <QDialog>
+
+QT_BEGIN_NAMESPACE
+class QPushButton;
+QT_END_NAMESPACE
+
+namespace Qnx {
+namespace Internal {
+
+class Ui_BlackBerryDebugTokenRequestDialog;
+class BlackBerryDebugTokenRequester;
+
+class BlackBerryDebugTokenRequestDialog : public QDialog
+{
+Q_OBJECT
+
+public:
+ explicit BlackBerryDebugTokenRequestDialog(QWidget *parent = 0,
+ Qt::WindowFlags f = 0);
+
+ QString debugToken() const;
+
+private slots:
+ void validate();
+ void requestDebugToken();
+ void appendExtension();
+ void checkBoxChanged(int state);
+ void debugTokenArrived(int status);
+
+private:
+ void setBusy(bool busy);
+ void populateComboBox();
+
+ Ui_BlackBerryDebugTokenRequestDialog *m_ui;
+
+ BlackBerryDebugTokenRequester *m_requester;
+
+ QPushButton *m_cancelButton;
+ QPushButton *m_okButton;
+};
+
+}
+} // namespace Qnx
+
+#endif // QNX_INTERNAL_BLACKBERRYDEBUGTOKENREQUESTDIALOG_H
diff --git a/src/plugins/qnx/blackberrydebugtokenrequestdialog.ui b/src/plugins/qnx/blackberrydebugtokenrequestdialog.ui
new file mode 100644
index 0000000000..e2059c5555
--- /dev/null
+++ b/src/plugins/qnx/blackberrydebugtokenrequestdialog.ui
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Qnx::Internal::BlackBerryDebugTokenRequestDialog</class>
+ <widget class="QDialog" name="Qnx::Internal::BlackBerryDebugTokenRequestDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>388</width>
+ <height>198</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Request Debug Token</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Debug token path:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="Utils::PathChooser" name="debugTokenPath" native="true"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Keystore:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QComboBox" name="keystore"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Keystore password:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="keystorePassword">
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>CSK password:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLineEdit" name="cskPassword">
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Device PIN:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QLineEdit" name="devicePin">
+ <property name="inputMask">
+ <string notr="true">HHHHHHHH; </string>
+ </property>
+ <property name="maxLength">
+ <number>8</number>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QCheckBox" name="showPassword">
+ <property name="text">
+ <string>Show password</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QProgressBar" name="progressBar">
+ <property name="maximum">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="status">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Status</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>Utils::PathChooser</class>
+ <extends>QWidget</extends>
+ <header location="global">utils/pathchooser.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/plugins/qnx/blackberrydebugtokenrequester.cpp b/src/plugins/qnx/blackberrydebugtokenrequester.cpp
new file mode 100644
index 0000000000..b83cb37138
--- /dev/null
+++ b/src/plugins/qnx/blackberrydebugtokenrequester.cpp
@@ -0,0 +1,75 @@
+/**************************************************************************
+**
+** Copyright (C) 2011 - 2013 Research In Motion
+**
+** Contact: Research In Motion (blackberry-qt@qnx.com)
+** Contact: KDAB (info@kdab.com)
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "blackberrydebugtokenrequester.h"
+
+namespace {
+static const char PROCESS_NAME[] = "blackberry-debugtokenrequest";
+static const char ERR_WRONG_CSK_PASS[] = "The signature on the code signing request didn't verify.";
+static const char ERR_WRONG_KEYSTORE_PASS[] = "Failed to decrypt keystore, invalid password";
+static const char ERR_ILLEGAL_DEVICE_PIN[] = "Illegal device PIN";
+static const char ERR_NETWORK_UNREACHABLE[] = "Network is unreachable";
+}
+
+namespace Qnx {
+namespace Internal {
+
+BlackBerryDebugTokenRequester::BlackBerryDebugTokenRequester(QObject *parent) :
+ BlackBerryNdkProcess(QLatin1String(PROCESS_NAME), parent)
+{
+ addErrorStringMapping(QLatin1String(ERR_WRONG_CSK_PASS), WrongCskPassword);
+ addErrorStringMapping(QLatin1String(ERR_WRONG_KEYSTORE_PASS), WrongKeystorePassword);
+ addErrorStringMapping(QLatin1String(ERR_WRONG_KEYSTORE_PASS), WrongKeystorePassword);
+ addErrorStringMapping(QLatin1String(ERR_NETWORK_UNREACHABLE), NetworkUnreachable);
+}
+
+void BlackBerryDebugTokenRequester::requestDebugToken(const QString &path,
+ const QString &cskPassword, const QString &keyStore,
+ const QString &keyStorePassword, const QString &devicePin)
+{
+ QStringList arguments;
+
+ arguments << QLatin1String("-keystore")
+ << keyStore
+ << QLatin1String("-storepass")
+ << keyStorePassword
+ << QLatin1String("-cskpass")
+ << cskPassword
+ << QLatin1String("-devicepin")
+ << devicePin
+ << path;
+
+ start(arguments);
+
+}
+
+} // namespace Internal
+} // namespace Qnx
diff --git a/src/plugins/qnx/blackberrydebugtokenrequester.h b/src/plugins/qnx/blackberrydebugtokenrequester.h
new file mode 100644
index 0000000000..d91d2edb08
--- /dev/null
+++ b/src/plugins/qnx/blackberrydebugtokenrequester.h
@@ -0,0 +1,63 @@
+/**************************************************************************
+**
+** Copyright (C) 2011 - 2013 Research In Motion
+**
+** Contact: Research In Motion (blackberry-qt@qnx.com)
+** Contact: KDAB (info@kdab.com)
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef QNX_INTERNAL_BLACKBERRYDEBUGTOKENREQUESTER_H
+#define QNX_INTERNAL_BLACKBERRYDEBUGTOKENREQUESTER_H
+
+#include "blackberryndkprocess.h"
+
+namespace Qnx {
+namespace Internal {
+
+class BlackBerryDebugTokenRequester : public BlackBerryNdkProcess
+{
+ Q_OBJECT
+
+public:
+ enum ReturnStatus
+ {
+ WrongCskPassword = UserStatus,
+ WrongKeystorePassword,
+ NetworkUnreachable,
+ IllegalPin
+ };
+
+ explicit BlackBerryDebugTokenRequester(QObject *parent = 0);
+
+ void requestDebugToken(const QString &path, const QString &cskPassword,
+ const QString &keyStore, const QString &keyStorePassword,
+ const QString &devicePin);
+};
+
+}
+}
+
+#endif // QNX_INTERNAL_BLACKBERRYDEBUGTOKENREQUESTER_H
diff --git a/src/plugins/qnx/blackberrydebugtokenuploader.cpp b/src/plugins/qnx/blackberrydebugtokenuploader.cpp
new file mode 100644
index 0000000000..cb336a09ce
--- /dev/null
+++ b/src/plugins/qnx/blackberrydebugtokenuploader.cpp
@@ -0,0 +1,68 @@
+/**************************************************************************
+**
+** Copyright (C) 2011 - 2013 Research In Motion
+**
+** Contact: Research In Motion (blackberry-qt@qnx.com)
+** Contact: KDAB (info@kdab.com)
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "blackberrydebugtokenuploader.h"
+
+namespace {
+static const char PROCESS_NAME[] = "blackberry-deploy";
+static const char ERR_NO_ROUTE_HOST[] = "Cannot connect";
+static const char ERR_AUTH_FAILED[] = "Authentication failed";
+static const char ERR_DEVELOPMENT_MODE_DISABLED[] = "Device is not in the Development Mode";
+}
+
+namespace Qnx {
+namespace Internal {
+
+BlackBerryDebugTokenUploader::BlackBerryDebugTokenUploader(QObject *parent) :
+ BlackBerryNdkProcess(QLatin1String(PROCESS_NAME), parent)
+{
+ addErrorStringMapping(QLatin1String(ERR_NO_ROUTE_HOST), NoRouteToHost);
+ addErrorStringMapping(QLatin1String(ERR_AUTH_FAILED), AuthenticationFailed);
+ addErrorStringMapping(QLatin1String(ERR_DEVELOPMENT_MODE_DISABLED), DevelopmentModeDisabled);
+}
+
+void BlackBerryDebugTokenUploader::uploadDebugToken(const QString &path,
+ const QString &deviceIp, const QString &devicePassword)
+{
+ QStringList arguments;
+
+ arguments << QLatin1String("-installDebugToken")
+ << path
+ << QLatin1String("-device")
+ << deviceIp
+ << QLatin1String("-password")
+ << devicePassword;
+
+ start(arguments);
+}
+
+} // namespace Internal
+} // namespace Qnx
diff --git a/src/plugins/qnx/blackberrydebugtokenuploader.h b/src/plugins/qnx/blackberrydebugtokenuploader.h
new file mode 100644
index 0000000000..ff892b8b90
--- /dev/null
+++ b/src/plugins/qnx/blackberrydebugtokenuploader.h
@@ -0,0 +1,66 @@
+/**************************************************************************
+**
+** Copyright (C) 2011 - 2013 Research In Motion
+**
+** Contact: Research In Motion (blackberry-qt@qnx.com)
+** Contact: KDAB (info@kdab.com)
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef QNX_INTERNAL_BLACKBERRYDEBUGTOKENUPLOADER_H
+#define QNX_INTERNAL_BLACKBERRYDEBUGTOKENUPLOADER_H
+
+#include "blackberryndkprocess.h"
+
+namespace Qnx {
+namespace Internal {
+
+class BlackBerryDebugTokenUploader : public BlackBerryNdkProcess
+{
+ Q_OBJECT
+
+public:
+ enum ReturnStatus
+ {
+ NoRouteToHost = UserStatus,
+ AuthenticationFailed,
+ DevelopmentModeDisabled,
+ FailedToStartInferiorProcess,
+ InferiorProcessTimedOut,
+ InferiorProcessCrashed,
+ InferiorProcessWriteError,
+ InferiorProcessReadError
+ };
+
+ explicit BlackBerryDebugTokenUploader(QObject *parent = 0);
+
+ void uploadDebugToken(const QString &path, const QString &deviceIp,
+ const QString &devicePassword);
+};
+
+}
+}
+
+#endif // QNX_INTERNAL_BLACKBERRYDEBUGTOKENUPLOADER_H
diff --git a/src/plugins/qnx/blackberrydeviceconfigurationwidget.cpp b/src/plugins/qnx/blackberrydeviceconfigurationwidget.cpp
index b5549cb08a..c447a20676 100644
--- a/src/plugins/qnx/blackberrydeviceconfigurationwidget.cpp
+++ b/src/plugins/qnx/blackberrydeviceconfigurationwidget.cpp
@@ -29,6 +29,8 @@
**
****************************************************************************/
+#include "blackberrydebugtokenuploader.h"
+#include "blackberrydebugtokenrequestdialog.h"
#include "blackberrydeviceconfigurationwidget.h"
#include "ui_blackberrydeviceconfigurationwidget.h"
#include "qnxconstants.h"
@@ -36,12 +38,17 @@
#include <ssh/sshconnection.h>
#include <utils/pathchooser.h>
+#include <QProgressDialog>
+#include <QMessageBox>
+
using namespace ProjectExplorer;
using namespace Qnx::Internal;
BlackBerryDeviceConfigurationWidget::BlackBerryDeviceConfigurationWidget(const IDevice::Ptr &device, QWidget *parent) :
IDeviceWidget(device, parent),
- ui(new Ui::BlackBerryDeviceConfigurationWidget)
+ ui(new Ui::BlackBerryDeviceConfigurationWidget),
+ progressDialog(new QProgressDialog(this)),
+ uploader(new BlackBerryDebugTokenUploader(this))
{
ui->setupUi(this);
connect(ui->hostLineEdit, SIGNAL(editingFinished()), this, SLOT(hostNameEditingFinished()));
@@ -49,7 +56,11 @@ BlackBerryDeviceConfigurationWidget::BlackBerryDeviceConfigurationWidget(const I
connect(ui->keyFileLineEdit, SIGNAL(editingFinished()), this, SLOT(keyFileEditingFinished()));
connect(ui->keyFileLineEdit, SIGNAL(browsingFinished()), this, SLOT(keyFileEditingFinished()));
connect(ui->showPasswordCheckBox, SIGNAL(toggled(bool)), this, SLOT(showPassword(bool)));
+ connect(ui->debugToken, SIGNAL(changed(QString)), this, SLOT(updateUploadButton()));
connect(ui->debugToken, SIGNAL(editingFinished()), this, SLOT(debugTokenEditingFinished()));
+ connect(ui->requestButton, SIGNAL(clicked()), this, SLOT(requestDebugToken()));
+ connect(ui->uploadButton, SIGNAL(clicked()), this, SLOT(uploadDebugToken()));
+ connect(uploader, SIGNAL(finished(int)), this, SLOT(uploadFinished(int)));
initGui();
}
@@ -91,6 +102,72 @@ void BlackBerryDeviceConfigurationWidget::debugTokenEditingFinished()
deviceConfiguration()->setDebugToken(ui->debugToken->path());
}
+void BlackBerryDeviceConfigurationWidget::requestDebugToken()
+{
+ BlackBerryDebugTokenRequestDialog dialog;
+
+ const int result = dialog.exec();
+
+ if (result != QDialog::Accepted)
+ return;
+
+ ui->debugToken->setPath(dialog.debugToken());
+ debugTokenEditingFinished();
+}
+
+void BlackBerryDeviceConfigurationWidget::uploadDebugToken()
+{
+ progressDialog->show();
+
+ uploader->uploadDebugToken(ui->debugToken->path(),
+ ui->hostLineEdit->text(), ui->pwdLineEdit->text());
+}
+
+void BlackBerryDeviceConfigurationWidget::updateUploadButton()
+{
+ ui->uploadButton->setEnabled(!ui->debugToken->path().isEmpty());
+}
+
+void BlackBerryDeviceConfigurationWidget::uploadFinished(int status)
+{
+ progressDialog->hide();
+
+ QString errorString = tr("Failed to upload debug token: ");
+
+ switch (status) {
+ case BlackBerryDebugTokenUploader::Success:
+ QMessageBox::information(this, tr("Qt Creator"), tr("Debug token successfully uploaded."));
+ return;
+ case BlackBerryDebugTokenUploader::NoRouteToHost:
+ errorString += tr("No route to host.");
+ break;
+ case BlackBerryDebugTokenUploader::AuthenticationFailed:
+ errorString += tr("Authentication failed.");
+ break;
+ case BlackBerryDebugTokenUploader::DevelopmentModeDisabled:
+ errorString += tr("Development mode is disabled on the device.");
+ break;
+ case BlackBerryDebugTokenUploader::FailedToStartInferiorProcess:
+ errorString += tr("Failed to start inferior process.");
+ break;
+ case BlackBerryDebugTokenUploader::InferiorProcessTimedOut:
+ errorString += tr("Inferior processes timed out.");
+ break;
+ case BlackBerryDebugTokenUploader::InferiorProcessCrashed:
+ errorString += tr("Inferior process has crashed.");
+ break;
+ case BlackBerryDebugTokenUploader::InferiorProcessReadError:
+ case BlackBerryDebugTokenUploader::InferiorProcessWriteError:
+ errorString += tr("Failed to communicate with the inferior process.");
+ break;
+ case BlackBerryDebugTokenUploader::UnknownError:
+ errorString += tr("An unknwon error has happened.");
+ break;
+ }
+
+ QMessageBox::critical(this, tr("Error"), errorString);
+}
+
void BlackBerryDeviceConfigurationWidget::updateDeviceFromUi()
{
hostNameEditingFinished();
@@ -121,6 +198,13 @@ void BlackBerryDeviceConfigurationWidget::initGui()
ui->debugToken->setEnabled(false);
ui->debugTokenLabel->setEnabled(false);
}
+
+ progressDialog->setWindowModality(Qt::WindowModal);
+ progressDialog->setWindowTitle(tr("Operation in progress"));
+ progressDialog->setCancelButton(0);
+ progressDialog->setLabelText(tr("Uploading debug token"));
+ progressDialog->setMinimum(0);
+ progressDialog->setMaximum(0);
}
BlackBerryDeviceConfiguration::Ptr BlackBerryDeviceConfigurationWidget::deviceConfiguration() const
diff --git a/src/plugins/qnx/blackberrydeviceconfigurationwidget.h b/src/plugins/qnx/blackberrydeviceconfigurationwidget.h
index c7ab2cd8ac..68353abfbe 100644
--- a/src/plugins/qnx/blackberrydeviceconfigurationwidget.h
+++ b/src/plugins/qnx/blackberrydeviceconfigurationwidget.h
@@ -36,9 +36,15 @@
#include "blackberrydeviceconfiguration.h"
+QT_BEGIN_NAMESPACE
+class QProgressDialog;
+QT_END_NAMESPACE
+
namespace Qnx {
namespace Internal {
+class BlackBerryDebugTokenUploader;
+
namespace Ui {
class BlackBerryDeviceConfigurationWidget;
}
@@ -58,6 +64,10 @@ private slots:
void keyFileEditingFinished();
void showPassword(bool showClearText);
void debugTokenEditingFinished();
+ void requestDebugToken();
+ void uploadDebugToken();
+ void updateUploadButton();
+ void uploadFinished(int status);
private:
void updateDeviceFromUi();
@@ -66,6 +76,10 @@ private:
BlackBerryDeviceConfiguration::Ptr deviceConfiguration() const;
Ui::BlackBerryDeviceConfigurationWidget *ui;
+
+ QProgressDialog *progressDialog;
+
+ BlackBerryDebugTokenUploader *uploader;
};
diff --git a/src/plugins/qnx/blackberrydeviceconfigurationwidget.ui b/src/plugins/qnx/blackberrydeviceconfigurationwidget.ui
index c8d14acfba..2794b2aabd 100644
--- a/src/plugins/qnx/blackberrydeviceconfigurationwidget.ui
+++ b/src/plugins/qnx/blackberrydeviceconfigurationwidget.ui
@@ -11,9 +11,6 @@
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::FieldsStayAtSizeHint</enum>
- </property>
<item row="0" column="0">
<widget class="QLabel" name="hostNameLabel">
<property name="text">
@@ -70,7 +67,25 @@
</widget>
</item>
<item row="2" column="1">
- <widget class="Utils::PathChooser" name="debugToken" native="true"/>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="Utils::PathChooser" name="debugToken" native="true"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="requestButton">
+ <property name="text">
+ <string>Request</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="uploadButton">
+ <property name="text">
+ <string>Upload</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="keyLabel">
@@ -83,12 +98,12 @@
<widget class="Utils::PathChooser" name="keyFileLineEdit" native="true"/>
</item>
</layout>
+ <zorder>keyFileLineEdit</zorder>
<zorder>hostNameLabel</zorder>
<zorder>hostLineEdit</zorder>
<zorder>passwordLabel</zorder>
<zorder>keyLabel</zorder>
<zorder>debugTokenLabel</zorder>
- <zorder>debugToken</zorder>
</widget>
<customwidgets>
<customwidget>
diff --git a/src/plugins/qnx/blackberrydeviceconfigurationwizardpages.cpp b/src/plugins/qnx/blackberrydeviceconfigurationwizardpages.cpp
index 0d62fa430b..0092682292 100644
--- a/src/plugins/qnx/blackberrydeviceconfigurationwizardpages.cpp
+++ b/src/plugins/qnx/blackberrydeviceconfigurationwizardpages.cpp
@@ -29,6 +29,7 @@
**
****************************************************************************/
+#include "blackberrydebugtokenrequestdialog.h"
#include "blackberrydeviceconfigurationwizardpages.h"
#include "ui_blackberrydeviceconfigurationwizardsetuppage.h"
#include "ui_blackberrydeviceconfigurationwizardsshkeypage.h"
@@ -67,6 +68,7 @@ BlackBerryDeviceConfigurationWizardSetupPage::BlackBerryDeviceConfigurationWizar
connect(m_ui->physicalDevice, SIGNAL(toggled(bool)), this, SLOT(handleMachineTypeChanged()));
connect(m_ui->physicalDevice, SIGNAL(toggled(bool)), this, SIGNAL(completeChanged()));
connect(m_ui->debugToken, SIGNAL(changed(QString)), this, SIGNAL(completeChanged()));
+ connect(m_ui->requestButton, SIGNAL(clicked()), this, SLOT(requestDebugToken()));
registerField(QLatin1String(DEVICENAME_FIELD_ID), m_ui->deviceName);
}
@@ -126,6 +128,17 @@ void BlackBerryDeviceConfigurationWizardSetupPage::handleMachineTypeChanged()
m_ui->deviceHostIp->setText(defaultDeviceHostIp(machineType()));
}
+void BlackBerryDeviceConfigurationWizardSetupPage::requestDebugToken()
+{
+ BlackBerryDebugTokenRequestDialog dialog;
+
+ const int result = dialog.exec();
+
+ if (result != QDialog::Accepted)
+ return;
+
+ m_ui->debugToken->setPath(dialog.debugToken());
+}
// ----------------------------------------------------------------------------
diff --git a/src/plugins/qnx/blackberrydeviceconfigurationwizardpages.h b/src/plugins/qnx/blackberrydeviceconfigurationwizardpages.h
index 8467bcece6..95feefbbb9 100644
--- a/src/plugins/qnx/blackberrydeviceconfigurationwizardpages.h
+++ b/src/plugins/qnx/blackberrydeviceconfigurationwizardpages.h
@@ -65,6 +65,7 @@ public:
private slots:
void handleMachineTypeChanged();
+ void requestDebugToken();
private:
Ui::BlackBerryDeviceConfigurationWizardSetupPage *m_ui;
diff --git a/src/plugins/qnx/blackberrydeviceconfigurationwizardsetuppage.ui b/src/plugins/qnx/blackberrydeviceconfigurationwizardsetuppage.ui
index 47ec51805f..4437a2d7d8 100644
--- a/src/plugins/qnx/blackberrydeviceconfigurationwizardsetuppage.ui
+++ b/src/plugins/qnx/blackberrydeviceconfigurationwizardsetuppage.ui
@@ -14,9 +14,6 @@
<string>WizardPage</string>
</property>
<layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::FieldsStayAtSizeHint</enum>
- </property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
@@ -27,14 +24,39 @@
<item row="0" column="1">
<widget class="QLineEdit" name="deviceName"/>
</item>
- <item row="3" column="0">
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Device type:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QRadioButton" name="physicalDevice">
+ <property name="text">
+ <string>Physical device</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="simulator">
+ <property name="text">
+ <string>Simulator</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>The device's host name or IP address:</string>
</property>
</widget>
</item>
- <item row="3" column="1">
+ <item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="deviceHostIp"/>
@@ -54,14 +76,14 @@
</item>
</layout>
</item>
- <item row="4" column="0">
+ <item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Device password:</string>
</property>
</widget>
</item>
- <item row="4" column="1">
+ <item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="password">
@@ -85,36 +107,22 @@
</item>
</layout>
</item>
- <item row="6" column="0">
+ <item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Debug token:</string>
</property>
</widget>
</item>
- <item row="6" column="1">
- <widget class="Utils::PathChooser" name="debugToken" native="true"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Device type:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item row="4" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
- <widget class="QRadioButton" name="physicalDevice">
- <property name="text">
- <string>Physical device</string>
- </property>
- </widget>
+ <widget class="Utils::PathChooser" name="debugToken" native="true"/>
</item>
<item>
- <widget class="QRadioButton" name="simulator">
+ <widget class="QPushButton" name="requestButton">
<property name="text">
- <string>Simulator</string>
+ <string>Request</string>
</property>
</widget>
</item>
diff --git a/src/plugins/qnx/blackberryndkprocess.cpp b/src/plugins/qnx/blackberryndkprocess.cpp
new file mode 100644
index 0000000000..acbe5bd89e
--- /dev/null
+++ b/src/plugins/qnx/blackberryndkprocess.cpp
@@ -0,0 +1,145 @@
+/**************************************************************************
+**
+** Copyright (C) 2011 - 2013 Research In Motion
+**
+** Contact: Research In Motion (blackberry-qt@qnx.com)
+** Contact: KDAB (info@kdab.com)
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "blackberryndkprocess.h"
+#include "blackberryconfiguration.h"
+
+#include <utils/hostosinfo.h>
+
+#include <QTextStream>
+
+namespace Qnx {
+namespace Internal {
+
+BlackBerryNdkProcess::BlackBerryNdkProcess(const QString &command, QObject *parent) :
+ QObject(parent),
+ m_process(new QProcess(this)),
+ m_command(command)
+{
+ m_process->setProcessChannelMode(QProcess::MergedChannels);
+
+ connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)),
+ this, SLOT(processFinished()));
+ connect(m_process, SIGNAL(error(QProcess::ProcessError)),
+ this, SLOT(processError(QProcess::ProcessError)));
+}
+
+QString BlackBerryNdkProcess::command() const
+{
+ QString command = BlackBerryConfiguration::instance()
+ .qnxEnv().value(QLatin1String("QNX_HOST"))
+ + (QLatin1String("/usr/bin/")) + m_command;
+
+ if (Utils::HostOsInfo::isWindowsHost())
+ command += QLatin1String(".bat");
+
+ return command;
+}
+
+void BlackBerryNdkProcess::start(const QStringList &arguments)
+{
+ if (m_process->state() != QProcess::NotRunning)
+ return;
+
+ m_process->start(command(), arguments);
+}
+
+void BlackBerryNdkProcess::addErrorStringMapping(
+ const QString &message, int errorCode)
+{
+ m_errorStringMap.insert(message, errorCode);
+}
+
+void BlackBerryNdkProcess::processFinished()
+{
+ if (m_process->exitCode() == 0) {
+ emit finished(Success);
+ return;
+ }
+
+ QTextStream processOutput(m_process);
+
+ QString errorString;
+ int returnStatus = UnknownError;
+
+ while (!processOutput.atEnd()) {
+ const QString line = processOutput.readLine();
+
+ returnStatus = errorLineToReturnStatus(line);
+
+ if (returnStatus >= 0)
+ break;
+ }
+
+ emit finished(returnStatus);
+}
+
+void BlackBerryNdkProcess::processError(QProcess::ProcessError error)
+{
+ int errorCode;
+
+ switch (error) {
+ case QProcess::FailedToStart:
+ errorCode = FailedToStartInferiorProcess;
+ break;
+ case QProcess::Timedout:
+ errorCode = InferiorProcessTimedOut;
+ break;
+ case QProcess::Crashed:
+ errorCode = InferiorProcessCrashed;
+ break;
+ case QProcess::WriteError:
+ errorCode = InferiorProcessWriteError;
+ break;
+ case QProcess::ReadError:
+ errorCode = InferiorProcessReadError;
+ break;
+ case QProcess::UnknownError:
+ default:
+ errorCode = UnknownError;
+ break;
+ }
+
+ emit finished(errorCode);
+}
+
+int BlackBerryNdkProcess::errorLineToReturnStatus(const QString &line) const
+{
+ foreach (const QString &key, m_errorStringMap.keys()) {
+ if (line.contains(key))
+ return m_errorStringMap.value(key);
+ }
+
+ return -1;
+}
+
+} // namespace Internal
+} // namespace Qnx
diff --git a/src/plugins/qnx/blackberryndkprocess.h b/src/plugins/qnx/blackberryndkprocess.h
new file mode 100644
index 0000000000..5e38914b3b
--- /dev/null
+++ b/src/plugins/qnx/blackberryndkprocess.h
@@ -0,0 +1,87 @@
+/**************************************************************************
+**
+** Copyright (C) 2011 - 2013 Research In Motion
+**
+** Contact: Research In Motion (blackberry-qt@qnx.com)
+** Contact: KDAB (info@kdab.com)
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef QNX_INTERNAL_BLACKBERRYNDKPROCESS_H
+#define QNX_INTERNAL_BLACKBERRYNDKPROCESS_H
+
+#include <QObject>
+#include <QProcess>
+#include <QMap>
+
+namespace Qnx {
+namespace Internal {
+
+class BlackBerryNdkProcess : public QObject
+{
+ Q_OBJECT
+
+public:
+ enum ProcessStatus
+ {
+ Success,
+ FailedToStartInferiorProcess,
+ InferiorProcessTimedOut,
+ InferiorProcessCrashed,
+ InferiorProcessWriteError,
+ InferiorProcessReadError,
+ UnknownError,
+ UserStatus
+ };
+
+signals:
+ void finished(int status);
+
+protected:
+ explicit BlackBerryNdkProcess(const QString &command, QObject *parent = 0);
+
+ void start(const QStringList &arguments);
+ void addErrorStringMapping(const QString &message, int errorCode);
+
+ QString command() const;
+
+private slots:
+ void processFinished();
+ void processError(QProcess::ProcessError error);
+
+private:
+ int errorLineToReturnStatus(const QString &line) const;
+
+ QProcess *m_process;
+
+ QString m_command;
+
+ QMap<QString, int> m_errorStringMap;
+};
+
+}
+}
+
+#endif // QNX_INTERNAL_BLACKBERRYNDKPROCESS_H
diff --git a/src/plugins/qnx/qnx.pro b/src/plugins/qnx/qnx.pro
index fbc201a7e4..f065197d0c 100644
--- a/src/plugins/qnx/qnx.pro
+++ b/src/plugins/qnx/qnx.pro
@@ -68,7 +68,11 @@ SOURCES += qnxplugin.cpp \
blackberrycertificatemodel.cpp \
blackberryregisterkeydialog.cpp \
blackberryimportcertificatedialog.cpp \
- blackberrycreatecertificatedialog.cpp
+ blackberrycreatecertificatedialog.cpp \
+ blackberrydebugtokenrequester.cpp \
+ blackberrydebugtokenrequestdialog.cpp \
+ blackberrydebugtokenuploader.cpp \
+ blackberryndkprocess.cpp
HEADERS += qnxplugin.h\
qnxconstants.h \
@@ -133,7 +137,11 @@ HEADERS += qnxplugin.h\
blackberrycertificatemodel.h \
blackberryregisterkeydialog.h \
blackberryimportcertificatedialog.h \
- blackberrycreatecertificatedialog.h
+ blackberrycreatecertificatedialog.h \
+ blackberrydebugtokenrequester.h \
+ blackberrydebugtokenrequestdialog.h \
+ blackberrydebugtokenuploader.h \
+ blackberryndkprocess.h
FORMS += \
blackberrydeviceconfigurationwizardsetuppage.ui \
@@ -147,7 +155,8 @@ FORMS += \
blackberrykeyswidget.ui \
blackberryregisterkeydialog.ui \
blackberryimportcertificatedialog.ui \
- blackberrycreatecertificatedialog.ui
+ blackberrycreatecertificatedialog.ui \
+ blackberrydebugtokenrequestdialog.ui
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
diff --git a/src/plugins/qnx/qnx.qbs b/src/plugins/qnx/qnx.qbs
index 52b127492e..53b8a1c4fb 100644
--- a/src/plugins/qnx/qnx.qbs
+++ b/src/plugins/qnx/qnx.qbs
@@ -117,6 +117,15 @@ QtcPlugin {
"blackberrycreatecertificatedialog.cpp",
"blackberrycreatecertificatedialog.h",
"blackberrycreatecertificatedialog.ui",
+ "blackberrydebugtokenrequester.cpp",
+ "blackberrydebugtokenrequester.h",
+ "blackberrydebugtokenrequestdialog.cpp",
+ "blackberrydebugtokenrequestdialog.h",
+ "blackberrydebugtokenrequestdialog.ui",
+ "blackberrydebugtokenuploader.cpp",
+ "blackberrydebugtokenuploader.h",
+ "blackberryndkprocess.cpp",
+ "blackberryndkprocess.h",
"pathchooserdelegate.cpp",
"pathchooserdelegate.h",
"qnx.qrc",