Commit 03c7ff3e authored by Nate Graham's avatar Nate Graham
Browse files

Put "Add New Vault" button in header for System Tray representation

Over the past few Plasma releases, we've moved towards generally putting
applets' actions into the header in the form of icons-only toolbuttons.
A requirement is that the icon be fairly universally recognizable, which
is the case for the "plus sign" icon used to add a new vault.
Accordingly, let's move the button into the header for the system tray
representation. The button remains in its current location for panel or
desktop representations.

Internally, this is done by defining a new action--which is
automatically consumed by the system tray and displayed in the
header--and making the other "New vault" buttons pull their text and
actions from it.
parent 149a59a8
......@@ -29,6 +29,14 @@ Item {
plasmoid.nativeInterface.vaultsModel.reloadDevices();
}
function action_createNewVault() {
vaultsModelActions.requestNewVault()
}
Component.onCompleted: {
plasmoid.setAction("createNewVault", i18nd("plasmavault-kde", "Create a New Vault..."), "list-add");
}
Plasmoid.fullRepresentation: ColumnLayout {
Layout.minimumWidth: PlasmaCore.Units.gridUnit * 18
......@@ -68,9 +76,10 @@ Item {
text: i18nd("plasmavault-kde", "No Vaults have been set up")
helpfulAction: Action {
text: i18nd("plasmavault-kde", "Create a New Vault...")
text: plasmoid.action("createNewVault").text
icon.name: "list-add"
onTriggered: vaultsModelActions.requestNewVault()
onTriggered: { plasmoid.action("createNewVault").trigger() }
}
}
}
......@@ -78,12 +87,12 @@ Item {
PlasmaComponents3.Button {
id: buttonCreateNewVault
visible: vaultsList.count > 0
visible: vaultsList.count > 0 && !(plasmoid.containmentDisplayHints & PlasmaCore.Types.ContainmentDrawsPlasmoidHeading)
text: i18nd("plasmavault-kde", "Create a New Vault...")
text: plasmoid.action("createNewVault").text
icon.name: "list-add"
onClicked: vaultsModelActions.requestNewVault()
onClicked: { plasmoid.action("createNewVault").trigger() }
Layout.alignment: Qt.AlignLeft
}
}
......
Supports Markdown
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