Skip to content

Commit

Permalink
fixed: can't remove packages from Package editor menu; more
Browse files Browse the repository at this point in the history
fixed: GitHub versions are not refreshed when reentering the Active Packages menu
fixed: unrecognized command showDetails
fixed: can't remove packages from Package editor menu
improve reporting of restart/reboot requirements in GUI
  • Loading branch information
kwindrem committed Mar 19, 2024
1 parent ffa1067 commit bc2dcf5
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 62 deletions.
71 changes: 41 additions & 30 deletions FileSets/VersionIndependent/PageSettingsPackageEdit.qml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ MbPage {
property bool detailsExist: incompatibleDetails != ""
property bool detailsResolvable: incompatibleResolvableItem.valid ? incompatibleResolvableItem.value : ""
property bool showProceed: ( ! detailsExist || detailsResolvable) && ! waitForAction
property bool showDetails: false
property string localError: ""

// version info may be in platform service or in vePlatform.version
Expand Down Expand Up @@ -146,7 +147,7 @@ MbPage {
waitForNameChange = true
packageIndex = newPackageIndex
requestedAction = ''

showDetails = false
}
}

Expand Down Expand Up @@ -191,6 +192,7 @@ MbPage {
{
// cancel any pending operation
requestedAction = ''
showDetails = false

acknowledgeError ()

Expand All @@ -200,18 +202,20 @@ MbPage {
}
function confirm ()
{
// provide local confirmation of action in case PackageManager doesn't act on it
if (actionPending)
if (showDetails)
{
sendCommand ( requestedAction + ':' + packageName, true )
sendCommand ( 'resolveConflicts:' + packageName, true )
showDetails = false
}
else if (actionPending)
sendCommand ( requestedAction + ':' + packageName, true )
else if (showActionNeeded)
{
if (actionNeeded == 'reboot')
if (actionNeeded.indexOf ( "REBOOT" ) != -1 )
{
sendCommand ( 'reboot', true )
}
else if (actionNeeded == 'guiRestart')
else if (actionNeeded.indexOf ( "restart" ) != -1 )
{
sendCommand ( 'restartGui', true )
}
Expand All @@ -221,22 +225,34 @@ MbPage {
function install ()
{
if (navigate && installOk && ! editError)
{
requestedAction = 'install'
showDetails = false
}
}
function uninstall ()
{
if (navigate && installedValid && ! editError)
{
requestedAction = 'uninstall'
showDetails = false
}
}
function gitHubDownload ()
{
if (navigate && downloadOk && ! editError)
{
requestedAction = 'download'
showDetails = false
}
}
function remove ()
{
id ( ! editError)
if ( ! editError)
{
requestedAction = 'remove'
showDetails = false
}
}

model: VisibleItemModel
Expand Down Expand Up @@ -316,29 +332,29 @@ MbPage {
description: ""
value: actionPending ? qsTr("Cancel") : (editError ? qsTr("OK") : qsTr("Later"))
onClicked: cancelEdit ()
show: ( actionPending || editError || showActionNeeded ) && ! waitForAction
show: ( actionPending || showDetails || editError || showActionNeeded ) && ! waitForAction
}
MbOK
{
id: confirmButton
width: 92
anchors { right: cancelButton.left; bottom: statusMessage.bottom }
description: ""
value: actionPending ? qsTr("Proceed") : qsTr ("Now") /////////// ?????????????
value: actionPending ? qsTr("Proceed") : qsTr ("Now")
onClicked: confirm ()
show: ( actionPending || showActionNeeded ) && showProceed
show: ( actionPending || (showDetails && detailsResolvable) || showActionNeeded ) && showProceed
writeAccessLevel: User.AccessInstaller
}
MbOK
{
id: showConflictsButton
id: showDetailsButton
width: 150
anchors { right: parent.right; bottom: statusMessage.bottom}
description: ""
value: qsTr("Show Details")
onClicked: requestedAction = 'showDetails'
onClicked: showDetails = true
writeAccessLevel: User.AccessInstaller
show: navigate && detailsExist && ! ( editError || actionPending || waitForAction || showActionNeeded)
show: navigate && detailsExist && ! ( editError || actionPending || waitForAction || showActionNeeded || showDetails)
}

// bottom row of buttons
Expand Down Expand Up @@ -406,8 +422,8 @@ MbPage {
smWidth -= cancelButton.width
if (confirmButton.show)
smWidth -= confirmButton.width
if (showConflictsButton.show)
smWidth -= showConflictsButton.width
if (showDetailsButton.show)
smWidth -= showDetailsButton.width
return smWidth
}
height: Math.max (paintedHeight, 35)
Expand All @@ -418,29 +434,24 @@ MbPage {
color: isSetupHelper && requestedAction == 'uninstall' ? "red" : root.style.textColor
text:
{
if (actionPending)
if (showDetails)
{
if (detailsResolvable)
return ( incompatibleDetails + qsTr ("\nResolve conflicts?") )
else
return ( incompatibleDetails )
}
else if (actionPending)
{
if (requestedAction == 'showDetails')
if (detailsResolvable)
return ( incompatibleDetails + qsTr ("\nResolve conflicts?") )
else
return ( incompatibleDetails )
else if (isSetupHelper && requestedAction == 'uninstall')
if (isSetupHelper && requestedAction == 'uninstall')
return qsTr ("WARNING: SetupHelper is required for these menus - uninstall anyway ?")
else
return (requestedAction + " " + packageName + " ?")
}
else if (editStatus.valid && editStatus.value != "")
return ( editStatus.value )
else if (showActionNeeded)
{
if (actionNeeded == 'reboot')
return qsTr ("Reboot now?")
else if (actionNeeded == 'guiRestart')
return qsTr ("restart GUI now ?")
else
return ( "unknown ActionNeeded " + actionNeeded )
}
return ( actionNeeded )
else if (incompatible)
return ( incompatibleReason )
else
Expand Down
4 changes: 0 additions & 4 deletions FileSets/VersionIndependent/PageSettingsPackageVersions.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,16 @@ MbPage {
// use DefaultCount as an indication that PackageManager is running
property VBusItem defaultCount: VBusItem { bind: Utils.path(servicePrefix, "/DefaultCount") }
property VBusItem editAction: VBusItem { bind: Utils.path(servicePrefix, "/GuiEditAction") }
property VBusItem gitHubVersionAge: VBusItem { bind: Utils.path(servicePrefix, "/Package/0/GitHubVersionAge") }

// notify PackageManager to refresh GitHub versions for all packages
// when this menu goes active (entering from parent or returning from child)
// or if first package's GitHub version age is greater than 60 seconds
onActiveChanged: refreshGitHubVersions ()
onGitHubVersionAgeChanged: refreshGitHubVersions ()

function refreshGitHubVersions ()
{
if (! active)
return
else if (! gitHubVersionAge.valid || gitHubVersionAge.value < 60 )
return
else if ( editAction.value != "" )
return

Expand Down
Loading

0 comments on commit bc2dcf5

Please sign in to comment.