Skip to content

Commit

Permalink
Add BBID to backup file. Add BSN to device info.
Browse files Browse the repository at this point in the history
  • Loading branch information
xsacha committed Oct 30, 2014
1 parent d635b17 commit 192ad06
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
14 changes: 14 additions & 0 deletions qml/generic/Device.qml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ Item {
text: i.device === null ? qsTr("Unknown") : i.device.pin
}

Label {
text: qsTr("BSN")
font.bold: true
}
Label {
text: i.device === null ? qsTr("Unknown") : i.device.bsn
}
Label {
font.bold: true
}
Label {

}

Label {
text: qsTr("OS")
font.bold: true
Expand Down
4 changes: 4 additions & 0 deletions src/deviceinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class DeviceInfo : public QObject {
Q_PROPERTY(QString restrictions MEMBER restrictions WRITE setRestrictions NOTIFY restrictionsChanged)
Q_PROPERTY(QString refurbDate MEMBER refurbDate WRITE setRefurbDate NOTIFY refurbDateChanged)
Q_PROPERTY(quint64 freeSpace MEMBER freeSpace WRITE setFreeSpace NOTIFY freeSpaceChanged)
Q_PROPERTY(QString bsn MEMBER bsn WRITE setBsn NOTIFY bsnChanged)
public:
DeviceInfo()
: QObject()
Expand All @@ -46,6 +47,7 @@ class DeviceInfo : public QObject {
QString restrictions;
QString refurbDate;
quint64 freeSpace;
QString bsn;
void setFriendlyName(const QString &input) { friendlyName = input; emit friendlyNameChanged(); }
void setOs(const QString &input) { os = input; emit osChanged(); }
void setRadio(const QString &input) { radio = input; emit radioChanged(); }
Expand All @@ -67,6 +69,7 @@ class DeviceInfo : public QObject {
emit refurbDateChanged();
}
void setFreeSpace(const quint64 &input) { freeSpace = input; emit freeSpaceChanged(); }
void setBsn(const QString &input) { bsn = input; emit bsnChanged(); }

signals:
void friendlyNameChanged();
Expand All @@ -84,6 +87,7 @@ class DeviceInfo : public QObject {
void restrictionsChanged();
void refurbDateChanged();
void freeSpaceChanged();
void bsnChanged();

};
Q_DECLARE_METATYPE(DeviceInfo* );
12 changes: 9 additions & 3 deletions src/installer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,9 @@ void InstallNet::install()
}
}

void InstallNet::uninstall(QStringList packageids)
void InstallNet::uninstall(QStringList packageids, bool firmwareUpdate)
{
// Tested with OS and it removed the old OS. Not entirely what I wanted.
if (packageids.isEmpty())
return;
setInstalling(true);
Expand All @@ -461,16 +462,19 @@ void InstallNet::uninstall(QStringList packageids)
bool InstallNet::uninstallMarked()
{
QStringList marked;
bool firmwareUpdate = false;
for(Apps* app : _appList) {
if (app->isMarked()) {
marked.append(app->packageId());
app->setIsMarked(false);
if (app->type() != "application")
firmwareUpdate = true;
app->setType("");
}
}
if (marked.isEmpty())
return false;
uninstall(marked);
uninstall(marked, firmwareUpdate);
return true;
}

Expand Down Expand Up @@ -515,7 +519,7 @@ void InstallNet::backup()
"<QnxOSDevice><Archives>";
foreach(BackupCategory* cat, _back.categories) {
if (_back.modeString().contains(cat->id))
manifestXML.append("<Archive id=\"" + cat->id + "\" name=\"" + cat->name + "\" count=\"" + cat->count + "\" bytesize=\"" + cat->bytesize + "\" perimetertype=" + cat->perimetertype + "\"/>");
manifestXML.append("<Archive id=\"" + cat->id + "\" name=\"" + cat->name + "\" count=\"" + cat->count + "\" bytesize=\"" + cat->bytesize + "\" keyid=" + device->bbid + "\" perimetertype=" + cat->perimetertype + "\"/>");
}
manifestXML.append("</Archives></QnxOSDevice></BlackBerry_Backup>");
manifest->write(manifestXML.toStdString().c_str());
Expand Down Expand Up @@ -1080,6 +1084,8 @@ void InstallNet::restoreReply()
device->setRefurbDate(xml.readElementText());
} else if (xml.name() == "FreeApplicationSpace") {
device->setFreeSpace(xml.readElementText().toLongLong());
} else if (xml.name() == "BoardSerialNumber") {
device->setBsn(xml.readElementText());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/installer.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class InstallNet : public QObject {
Q_INVOKABLE void keepAlive();
Q_INVOKABLE void scanProps();
Q_INVOKABLE void install(QList<QUrl> files);
Q_INVOKABLE void uninstall(QStringList packageids);
Q_INVOKABLE void uninstall(QStringList packageids, bool firmwareUpdate);
Q_INVOKABLE bool uninstallMarked();
Q_INVOKABLE void restore(QUrl url, int options);
Q_INVOKABLE void backup(QUrl url, int options);
Expand Down

0 comments on commit 192ad06

Please sign in to comment.