on xenial help sign in
updated transfer actions
88c1c97Nick Dedekind
qml/Panel/Indicators/DefaultIndicatorPage.qml−3
@@ -135,9 +135,6 @@ IndicatorBase {
135 right: parent.right
135 right: parent.right
136 }
136 }
137
137
138− Component.onCompleted: console.log("created")
139− Component.onDestruction: console.log("destroyed")
140−
141 sourceComponent: factory.load(model)
138 sourceComponent: factory.load(model)
142
139
143 onLoaded: {
140 onLoaded: {
qml/Panel/Indicators/MenuItemFactory.qml+29−15
@@ -44,6 +44,7 @@ Item {
44 "com.canonical.indicator.alarm" : alarmMenu,
44 "com.canonical.indicator.alarm" : alarmMenu,
45 "com.canonical.indicator.appointment" : appointmentMenu,
45 "com.canonical.indicator.appointment" : appointmentMenu,
46 "com.canonical.indicator.transfer" : transferMenu,
46 "com.canonical.indicator.transfer" : transferMenu,
47+ "com.canonical.indicator.transfer-bulk-action" : bulkTransferMenu,
47
48
48 "com.canonical.indicator.messages.messageitem" : messageItem,
49 "com.canonical.indicator.messages.messageitem" : messageItem,
49 "com.canonical.indicator.messages.sourceitem" : groupedMessage,
50 "com.canonical.indicator.messages.sourceitem" : groupedMessage,
@@ -520,18 +521,18 @@ Item {
520 property QtObject cancelAction: action("cancel-transfer")
521 property QtObject cancelAction: action("cancel-transfer")
521 property QtObject pauseAction: action("pause-transfer")
522 property QtObject pauseAction: action("pause-transfer")
522 property QtObject resumeAction: action("resume-transfer")
523 property QtObject resumeAction: action("resume-transfer")
523− property QtObject transferStates: action("transfer-states")
524+ property QtObject transferStateAction: uid !== undefined ? action("transfer-state."+uid) : null
524
525
525 Component.onCompleted: actionGroup.start()
526 Component.onCompleted: actionGroup.start()
526 }
527 }
527
528
528− property var transferStateProperties: uid !== undefined && actionGroup.transferStates.valid && actionGroup.transferStates.state[uid] || undefined
529+ property var transferState: actionGroup.transferStateAction !== null && actionGroup.transferStateAction.valid && actionGroup.transferStateAction.state || undefined
529
530
530− property var transferState : transferStateProperties !== undefined && transferStateProperties["state"] || undefined
531+ property var runningState : transferState !== undefined ? transferState["state"] : undefined
531− property var secondsLeft : transferStateProperties !== undefined && transferStateProperties["seconds-left"]
532+ property var secondsLeft : transferState !== undefined ? transferState["seconds-left"] : undefined
532
533
533− active: transferStateProperties !== undefined && transferState !== Menus.TransferState.FINISHED
534+ active: runningState !== undefined && runningState !== Menus.TransferState.FINISHED
534− progress : transferStateProperties !== undefined && transferStateProperties["percent"] || 0.0
535+ progress : transferState !== undefined ? transferState["percent"] : 0.0
535
536
536 property var timeRemaining: {
537 property var timeRemaining: {
537 if (secondsLeft === undefined) return undefined;
538 if (secondsLeft === undefined) return undefined;
@@ -558,7 +559,7 @@ Item {
558 }
559 }
559
560
560 stateText: {
561 stateText: {
561− switch (transferState) {
562+ switch (runningState) {
562 case Menus.TransferState.QUEUED:
563 case Menus.TransferState.QUEUED:
563 return i18n.tr("In queue...");
564 return i18n.tr("In queue...");
564 case Menus.TransferState.HASHING:
565 case Menus.TransferState.HASHING:
@@ -587,22 +588,35 @@ Item {
587 actionGroup.activateAction.activate(uid);
588 actionGroup.activateAction.activate(uid);
588 shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
589 shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
589 }
590 }
591+ onItemRemoved: {
592+ actionGroup.cancelAction.activate(uid);
593+ }
590
594
591 function loadAttributes() {
595 function loadAttributes() {
592 if (!menuModel || menuIndex == -1) return;
596 if (!menuModel || menuIndex == -1) return;
593 menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-uid': 'string'});
597 menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-uid': 'string'});
594 }
598 }
599+ }
600+ }
595
601
596− function cancel() {
602+ Component {
597− actionGroup.cancelAction.activate(uid);
603+ id: bulkTransferMenu;
598− }
604+ ListItems.Standard {
605+ objectName: "bulkTransferMenu"
606+ property QtObject menuData: null
607+ property int menuIndex: -1
608+ showDivider: false
599
609
600− function pause() {
610+ iconSource: menuData && menuData.icon || ""
601− actionGroup.pauseAction.activate(uid);
611+ enabled: menuData && menuData.sensitive || false
602− }
612+
613+ control: Button {
614+ text: menuData && menuData.label || ""
603
615
604− function resume() {
616+ onClicked: {
605− actionGroup.resumeAction.activate(uid);
617+ menuModel.activate(menuIndex);
618+ shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
619+ }
606 }
620 }
607 }
621 }
608 }
622 }