Commit a64c4010 authored by El Mehdi Fekari's avatar El Mehdi Fekari Committed by Mehdi Fekari

Qnx: Add import button when selecting device's debug token

Change-Id: I97c86761e7ff89c7720ae9ca9369895a62ca6244
Reviewed-by: default avatarRafael Roquetto <rafael.roquetto@kdab.com>
parent 81a3ac3a
......@@ -36,6 +36,7 @@
#include "blackberryconfiguration.h"
#include "blackberrydeviceconnectionmanager.h"
#include "blackberrysigningutils.h"
#include "blackberrydebugtokenreader.h"
#include "qnxconstants.h"
#include "qnxutils.h"
......@@ -48,6 +49,7 @@
#include <QProgressDialog>
#include <QMessageBox>
#include <QFileInfo>
#include <QFileDialog>
#include <QDir>
#include <QAbstractButton>
......@@ -81,6 +83,7 @@ BlackBerryDeviceConfigurationWidget::BlackBerryDeviceConfigurationWidget(const I
connect(BlackBerryDeviceConnectionManager::instance(), SIGNAL(deviceAboutToConnect(Core::Id)),
this, SLOT(clearConnectionLog(Core::Id)));
connect(ui->importButton, SIGNAL(clicked()), this, SLOT(importDebugToken()));
connect(ui->requestButton, SIGNAL(clicked()), this, SLOT(requestDebugToken()));
connect(ui->uploadButton, SIGNAL(clicked()), this, SLOT(uploadDebugToken()));
......@@ -127,6 +130,26 @@ void BlackBerryDeviceConfigurationWidget::debugTokenEditingFinished()
deviceConfiguration()->setDebugToken(ui->debugToken->currentText());
}
void BlackBerryDeviceConfigurationWidget::importDebugToken()
{
const QString debugToken = QFileDialog::getOpenFileName(this, tr("Select Debug Token"),
QString(), tr("Bar file (*.bar)"));
if (debugToken.isEmpty())
return;
BlackBerryDebugTokenReader debugTokenReader(debugToken);
if (!debugTokenReader.isValid()) {
QMessageBox::warning(this, tr("Invalid Debug Token"),
tr("Debug token file %1 cannot be read.").arg(debugToken));
return;
}
m_utils.addDebugToken(debugToken);
populateDebugTokenCombo(debugToken);
debugTokenEditingFinished();
}
void BlackBerryDeviceConfigurationWidget::requestDebugToken()
{
BlackBerryDebugTokenRequestDialog dialog;
......
......@@ -66,6 +66,7 @@ private slots:
void keyFileEditingFinished();
void showPassword(bool showClearText);
void debugTokenEditingFinished();
void importDebugToken();
void requestDebugToken();
void uploadDebugToken();
void updateUploadButton();
......
......@@ -114,6 +114,13 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="importButton">
<property name="text">
<string>Import</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="requestButton">
<property name="text">
......
......@@ -27,7 +27,7 @@
</property>
</widget>
</item>
<item row="2" column="2">
<item row="2" column="3">
<widget class="QPushButton" name="generateButton">
<property name="text">
<string>Generate</string>
......@@ -47,7 +47,7 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<item row="4" column="0" colspan="4">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
......@@ -62,6 +62,13 @@
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="importButton">
<property name="text">
<string>Import</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......
......@@ -32,6 +32,7 @@
#include "blackberrydeviceconfigurationwizardpages.h"
#include "blackberryconfiguration.h"
#include "blackberrydebugtokenrequestdialog.h"
#include "blackberrydebugtokenreader.h"
#include "blackberrysshkeysgenerator.h"
#include "blackberrydeviceinformation.h"
#include "ui_blackberrydeviceconfigurationwizardsetuppage.h"
......@@ -364,6 +365,7 @@ BlackBerryDeviceConfigurationWizardConfigPage::BlackBerryDeviceConfigurationWiza
connect(m_ui->configurationNameField, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged()));
connect(m_ui->debugTokenCombo, SIGNAL(currentTextChanged(QString)), this, SIGNAL(completeChanged()));
connect(m_ui->generateButton, SIGNAL(clicked()), this, SLOT(generateDebugToken()));
connect(m_ui->importButton, SIGNAL(clicked()), this, SLOT(importDebugToken()));
registerField(QLatin1String(CONFIGURATIONNAME_FIELD_ID), m_ui->configurationNameField);
registerField(QLatin1String(DEBUGTOKENPATH_FIELD_ID), m_ui->debugTokenCombo);
......@@ -407,6 +409,31 @@ void BlackBerryDeviceConfigurationWizardConfigPage::generateDebugToken()
m_utils.addDebugToken(dialog.debugToken());
m_ui->debugTokenCombo->addItem(dialog.debugToken());
const int index = m_ui->debugTokenCombo->findText(dialog.debugToken());
if (index != -1)
m_ui->debugTokenCombo->setCurrentIndex(index);
}
void BlackBerryDeviceConfigurationWizardConfigPage::importDebugToken()
{
const QString debugToken = QFileDialog::getOpenFileName(this, tr("Select Debug Token"),
QString(), tr("Bar file (*.bar)"));
if (debugToken.isEmpty())
return;
BlackBerryDebugTokenReader debugTokenReader(debugToken);
if (!debugTokenReader.isValid()) {
QMessageBox::warning(this, tr("Invalid Debug Token"),
tr("Debug token file %1 cannot be read.").arg(debugToken));
return;
}
m_utils.addDebugToken(debugToken);
m_ui->debugTokenCombo->addItem(debugToken);
const int index = m_ui->debugTokenCombo->findText(debugToken);
if (index != -1)
m_ui->debugTokenCombo->setCurrentIndex(index);
}
QString BlackBerryDeviceConfigurationWizardConfigPage::configurationName() const
......
......@@ -146,6 +146,7 @@ public:
QString debugToken() const;
private slots:
void generateDebugToken();
void importDebugToken();
private:
Ui::BlackBerryDeviceConfigurationWizardConfigPage *m_ui;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment