21 New Patches.
[webos-internals:djcin7s-modifications.git] / video-player / video-player-add-delete-buttons.patch
1 diff --git a/usr/palm/frameworks/private/metascene.videos/submission/76/javascript/assistants/details-assistant.js b/usr/palm/frameworks/private/metascene.videos/submission/76/javascript/assistants/details-assistant.js
2 index a197d1a..9c2f44e 100644
3 --- a/usr/palm/frameworks/private/metascene.videos/submission/76/javascript/assistants/details-assistant.js
4 +++ b/usr/palm/frameworks/private/metascene.videos/submission/76/javascript/assistants/details-assistant.js
5 @@ -28,6 +28,7 @@ DetailsAssistant.prototype.setup = function(){
6              visible: true,
7              items: [
8                  { icon: "video-edit", command: "edit", disabled: !this.captured },
9 +                { icon: "video-delete", command: "delete", disabled: false },
10                  { icon: "video-share", command: "share", disabled: !this.captured }
11              ]
12          }
13 @@ -95,6 +96,9 @@ DetailsAssistant.prototype.handleCommand = function(e) {
14              case "share":
15                  this.shareVideo(e);
16                  break;
17 +            case "delete":
18 +                this.handleDelete();
19 +                break;
20              case "edit":
21                  this.editVideo();
22                  break;
23 diff --git a/usr/palm/frameworks/private/metascene.videos/submission/76/javascript/assistants/nowplaying-assistant.js b/usr/palm/frameworks/private/metascene.videos/submission/76/javascript/assistants/nowplaying-assistant.js
24 index b242152..1c8f07e 100644
25 --- a/usr/palm/frameworks/private/metascene.videos/submission/76/javascript/assistants/nowplaying-assistant.js
26 +++ b/usr/palm/frameworks/private/metascene.videos/submission/76/javascript/assistants/nowplaying-assistant.js
27 @@ -73,6 +73,12 @@ var NowplayingAssistant = Class.create(metascene.Base, {
28                 }
29  
30                 this.setVideoTitle();
31 +               this.controller.get("video_delete_item").show();
32 +               this.autoListen(
33 +                       this.controller.get("video_delete_item"), 
34 +                       Mojo.Event.tap, 
35 +                       this.handleDelete.bind(this), 
36 +                       false);
37                 
38                 // setup the spinning progress widget           
39                 var spinnerAttrs = {
40 @@ -804,6 +810,30 @@ var NowplayingAssistant = Class.create(metascene.Base, {
41                 }               
42         },
43  
44 +       handleDelete: function(){ //function adapted from the details assistant
45 +               this.mediaController.pause();
46 +               this.controller.showAlertDialog({
47 +                       onChoose: function(value){
48 +                                       if(value === "confirmed"){
49 +                                               Mojo.Log.info("Deleting the following file: "+this.videoUrl);
50 +                                               this.deleteFileRequest = VideoService.deleteFile(this.controller, this.videoUrl);
51 +                                               this.controller.stageController.popScenesTo("browser");
52 +                                       }
53 +                               }.bind(this),
54 +                       title: $LF("Delete video?"),
55 +                       message: $LF("This action cannot be undone."),
56 +                       choices: [{
57 +                               label: $LF("Delete"),
58 +                               value: "confirmed",
59 +                               type: 'negative'
60 +                       },{
61 +                               label: $LF("Cancel"),
62 +                               value: "cancelled",
63 +                               type: 'dismiss'
64 +                       }]
65 +               });
66 +       },
67 +
68         /*
69          * Called by the play engine if we cannot support pausing this stream 
70                  */
71 diff --git a/usr/palm/frameworks/private/metascene.videos/submission/76/styles/media-video.css b/usr/palm/frameworks/private/metascene.videos/submission/76/styles/media-video.css
72 index ceecba9..9ce24c9 100644
73 --- a/usr/palm/frameworks/private/metascene.videos/submission/76/styles/media-video.css
74 +++ b/usr/palm/frameworks/private/metascene.videos/submission/76/styles/media-video.css
75 @@ -327,6 +327,16 @@ body.palm-default,
76      margin-right: -25px;
77  }
78  
79 +.video-delete-button {
80 +    position: static;
81 +    float: right;
82 +    margin-right: -25px;
83 +}
84 +
85 +.palm-menu-icon.video-delete{
86 +       background-image: url(/usr/palm/frameworks/mojo/submissions/338/images/menu-icon-delete.png); 
87 +}
88 +
89  .palm-menu-icon { background: url(../images/menu-icons.png) 0px 0px no-repeat; }
90  
91  .palm-menu-icon.video-play { background-position: 0px -64px; }
92 diff --git a/usr/palm/frameworks/private/metascene.videos/submission/76/views/nowplaying-scene.html b/usr/palm/frameworks/private/metascene.videos/submission/76/views/nowplaying-scene.html
93 index 865f1e2..09f877c 100644
94 --- a/usr/palm/frameworks/private/metascene.videos/submission/76/views/nowplaying-scene.html
95 +++ b/usr/palm/frameworks/private/metascene.videos/submission/76/views/nowplaying-scene.html
96 @@ -10,6 +10,9 @@
97          <div id="video_share_item" class="palm-menu-button video-share-button" style="display:none" x-mojo-touch-feedback="immediate">
98              <div class="palm-menu-icon video-share"></div>
99          </div>
100 +        <div id="video_delete_item" class="palm-menu-button video-delete-button" style="display:none" x-mojo-touch-feedback="immediate">
101 +            <div class="palm-menu-icon video-delete"></div>
102 +        </div>
103          <h1 id="video_title" class="truncating-text"></h1>
104          <div id="video_limit" class="video-limit"></div>
105      </div>