Improve adding/removing repositories a bit
This commit is contained in:
parent
b6eb6ef782
commit
ca9d60187b
@ -93,12 +93,12 @@ Repositories *SystemController::repositories() const
|
||||
return m_repositories;
|
||||
}
|
||||
|
||||
void SystemController::enableRepository(const QString &id, bool enabled)
|
||||
int SystemController::enableRepository(const QString &id, bool enabled)
|
||||
{
|
||||
QVariantMap params;
|
||||
params.insert("repositoryId", id);
|
||||
params.insert("enabled", enabled);
|
||||
m_jsonRpcClient->sendCommand("System.EnableRepository", params);
|
||||
return m_jsonRpcClient->sendCommand("System.EnableRepository", params, this, "enableRepositoryResponse");
|
||||
}
|
||||
|
||||
void SystemController::getCapabilitiesResponse(const QVariantMap &data)
|
||||
@ -158,6 +158,12 @@ void SystemController::removePackageResponse(const QVariantMap ¶ms)
|
||||
qDebug() << "Remove result" << params;
|
||||
}
|
||||
|
||||
void SystemController::enableRepositoryResponse(const QVariantMap ¶ms)
|
||||
{
|
||||
qDebug() << "Enable repo response" << params;
|
||||
emit enableRepositoryFinished(params.value("id").toInt(), params.value("params").toMap().value("success").toBool());
|
||||
}
|
||||
|
||||
void SystemController::notificationReceived(const QVariantMap &data)
|
||||
{
|
||||
QString notification = data.value("notification").toString();
|
||||
|
||||
@ -41,7 +41,7 @@ public:
|
||||
Q_INVOKABLE void removePackages(const QString packageId = QString());
|
||||
|
||||
Repositories* repositories() const;
|
||||
Q_INVOKABLE void enableRepository(const QString &id, bool enabled);
|
||||
Q_INVOKABLE int enableRepository(const QString &id, bool enabled);
|
||||
|
||||
|
||||
signals:
|
||||
@ -49,6 +49,7 @@ signals:
|
||||
void updateManagementAvailableChanged();
|
||||
void updateManagementBusyChanged();
|
||||
void updateRunningChanged();
|
||||
void enableRepositoryFinished(int id, bool success);
|
||||
|
||||
private slots:
|
||||
void getCapabilitiesResponse(const QVariantMap &data);
|
||||
@ -56,6 +57,7 @@ private slots:
|
||||
void getPackagesResponse(const QVariantMap &data);
|
||||
void getRepositoriesResponse(const QVariantMap &data);
|
||||
void removePackageResponse(const QVariantMap ¶ms);
|
||||
void enableRepositoryResponse(const QVariantMap ¶ms);
|
||||
|
||||
void notificationReceived(const QVariantMap &data);
|
||||
|
||||
|
||||
@ -21,6 +21,16 @@ Page {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: engine.systemController
|
||||
onEnableRepositoryFinished: {
|
||||
if (!success) {
|
||||
var popup = errorDialogComponent.createObject(app, {errorCode: qsTr("Failure adding repository.") })
|
||||
popup.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PackagesFilterModel {
|
||||
id: updatesModel
|
||||
packages: engine.systemController.packages
|
||||
@ -366,4 +376,12 @@ Page {
|
||||
|
||||
UpdateRunningOverlay {
|
||||
}
|
||||
|
||||
Component {
|
||||
id: errorDialogComponent
|
||||
|
||||
ErrorDialog {
|
||||
id: errorDialog
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,6 +215,7 @@ Page {
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
|
||||
case 3:
|
||||
engine.deviceManager.pairDevice(root.deviceClass.id, d.deviceDescriptor.id, root.device.name);
|
||||
break;
|
||||
@ -313,7 +314,7 @@ Page {
|
||||
}
|
||||
TextField {
|
||||
id: nameTextField
|
||||
text: d.deviceName ? d.deviceName : ""
|
||||
text: d.deviceName ? d.deviceName : root.deviceClass.displayName
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
|
||||
Reference in New Issue
Block a user