author | Michael Krelin <hacker@klever.net> | 2006-12-18 18:56:09 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2006-12-18 18:56:09 (UTC) |
commit | 71a2c8a80f3c7a99e893efb32c6bbf5080e16ff1 (patch) (unidiff) | |
tree | 1f9051339dee22f5c64206568638675ca9f7636a /content/fireflix.js | |
parent | 1838bc18394967371d7a1c00516db5e290f80ea3 (diff) | |
download | fireflix-71a2c8a80f3c7a99e893efb32c6bbf5080e16ff1.zip fireflix-71a2c8a80f3c7a99e893efb32c6bbf5080e16ff1.tar.gz fireflix-71a2c8a80f3c7a99e893efb32c6bbf5080e16ff1.tar.bz2 |
doubleclicking files in upload
git-svn-id: http://svn.klever.net/kin/fireflix/trunk@241 fe716a7a-6dde-0310-88d9-d003556173a8
-rw-r--r-- | content/fireflix.js | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/content/fireflix.js b/content/fireflix.js index 78e56c2..225e21c 100644 --- a/content/fireflix.js +++ b/content/fireflix.js | |||
@@ -599,64 +599,75 @@ var fireflix = { | |||
599 | this.upload_worker(); | 599 | this.upload_worker(); |
600 | }, | 600 | }, |
601 | on_clear: function() { | 601 | on_clear: function() { |
602 | this.clear_list(); | 602 | this.clear_list(); |
603 | }, | 603 | }, |
604 | on_remove: function() { | 604 | on_remove: function() { |
605 | if(this.selection.count) { | 605 | if(this.selection.count) { |
606 | this.tree.beginUpdateBatch(); | 606 | this.tree.beginUpdateBatch(); |
607 | for(var i=this.files.length-1;i>=0;--i) { | 607 | for(var i=this.files.length-1;i>=0;--i) { |
608 | if(this.selection.isSelected(i)) { | 608 | if(this.selection.isSelected(i)) { |
609 | this.files.splice(i,1); | 609 | this.files.splice(i,1); |
610 | this.rowCount--; | 610 | this.rowCount--; |
611 | } | 611 | } |
612 | } | 612 | } |
613 | this.tree.endUpdateBatch(); | 613 | this.tree.endUpdateBatch(); |
614 | this.selection.clearSelection(); | 614 | this.selection.clearSelection(); |
615 | } | 615 | } |
616 | }, | 616 | }, |
617 | on_add: function() { | 617 | on_add: function() { |
618 | var ifp = Components.interfaces.nsIFilePicker; | 618 | var ifp = Components.interfaces.nsIFilePicker; |
619 | var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(ifp); | 619 | var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(ifp); |
620 | fp.init(window, "Select a File", ifp.modeOpenMultiple); | 620 | fp.init(window, "Select a File", ifp.modeOpenMultiple); |
621 | fp.appendFilters(ifp.filterImages); | 621 | fp.appendFilters(ifp.filterImages); |
622 | var rv = fp.show(); | 622 | var rv = fp.show(); |
623 | if(rv==ifp.returnOK) { | 623 | if(rv==ifp.returnOK) { |
624 | var ff = fp.files; | 624 | var ff = fp.files; |
625 | while(ff.hasMoreElements()) { | 625 | while(ff.hasMoreElements()) { |
626 | var f = ff.getNext(); | 626 | var f = ff.getNext(); |
627 | f.QueryInterface(Components.interfaces.nsIFile); | 627 | f.QueryInterface(Components.interfaces.nsIFile); |
628 | this.add(f.path); | 628 | this.add(f.path); |
629 | } | 629 | } |
630 | } | 630 | } |
631 | }, | ||
632 | on_cmd_open: function(ev) { | ||
633 | if(this.selection.currentIndex<0) return; | ||
634 | var f = this.files[this.selection.currentIndex]; | ||
635 | if(f.photoid) { | ||
636 | this.fireflix.openTab( | ||
637 | this.fireflix.flickr.make_uploader_edit_url(f.photoid) | ||
638 | ); | ||
639 | }else{ | ||
640 | this.fireflix.openTab( 'file://'+f.file); | ||
641 | } | ||
631 | } | 642 | } |
632 | }, | 643 | }, |
633 | 644 | ||
634 | on_set_props: function() { | 645 | on_set_props: function() { |
635 | var pset = this.photosets.sets[this.photosets.selection.currentIndex]; | 646 | var pset = this.photosets.sets[this.photosets.selection.currentIndex]; |
636 | window.openDialog( | 647 | window.openDialog( |
637 | "chrome://fireflix/content/photoset-props.xul", | 648 | "chrome://fireflix/content/photoset-props.xul", |
638 | null, "dependent,modal,dialog,chrome", this, | 649 | null, "dependent,modal,dialog,chrome", this, |
639 | pset ); | 650 | pset ); |
640 | if(pset.dirty) { | 651 | if(pset.dirty) { |
641 | var _this = this; | 652 | var _this = this; |
642 | this.flickr.api_call( | 653 | this.flickr.api_call( |
643 | { | 654 | { |
644 | method: 'flickr.photosets.editMeta', | 655 | method: 'flickr.photosets.editMeta', |
645 | auth_token: 'default', | 656 | auth_token: 'default', |
646 | photoset_id: pset.id, | 657 | photoset_id: pset.id, |
647 | title: pset.title, | 658 | title: pset.title, |
648 | description: pset.description | 659 | description: pset.description |
649 | }, function(xr) { | 660 | }, function(xr) { |
650 | pset.dirty = false; | 661 | pset.dirty = false; |
651 | _this.flickr.api_call( | 662 | _this.flickr.api_call( |
652 | { | 663 | { |
653 | method: 'flickr.photosets.getPhotos', | 664 | method: 'flickr.photosets.getPhotos', |
654 | auth_token: 'default', | 665 | auth_token: 'default', |
655 | photoset_id: pset.id | 666 | photoset_id: pset.id |
656 | }, function(xr) { | 667 | }, function(xr) { |
657 | var x = xr.responseXML; | 668 | var x = xr.responseXML; |
658 | var xp = x.evaluate( | 669 | var xp = x.evaluate( |
659 | '/rsp/photoset/photo', x, null, | 670 | '/rsp/photoset/photo', x, null, |
660 | XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); | 671 | XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); |
661 | var phids = new Array(); | 672 | var phids = new Array(); |
662 | var priph = null; | 673 | var priph = null; |
@@ -884,69 +895,67 @@ var fireflix = { | |||
884 | this.searchresult_title.value = p.title; | 895 | this.searchresult_title.value = p.title; |
885 | this.searchresult_title.tooltipText = p.title; | 896 | this.searchresult_title.tooltipText = p.title; |
886 | this.render_description_frame(null); | 897 | this.render_description_frame(null); |
887 | if(p.description==null && p.description==undefined) { | 898 | if(p.description==null && p.description==undefined) { |
888 | var pid = p.id; | 899 | var pid = p.id; |
889 | var ci = this.selection.currentIndex; | 900 | var ci = this.selection.currentIndex; |
890 | var _this = this; | 901 | var _this = this; |
891 | this.fireflix.flickr.api_call( | 902 | this.fireflix.flickr.api_call( |
892 | { | 903 | { |
893 | method: 'flickr.photos.getInfo', | 904 | method: 'flickr.photos.getInfo', |
894 | auth_token: 'default', | 905 | auth_token: 'default', |
895 | photo_id: p.id, | 906 | photo_id: p.id, |
896 | secret: p.secret | 907 | secret: p.secret |
897 | }, function(xr) { | 908 | }, function(xr) { |
898 | var pp = _this.photos[ci]; | 909 | var pp = _this.photos[ci]; |
899 | if(ci==_this.selection.currentIndex && pp.id==pid) { | 910 | if(ci==_this.selection.currentIndex && pp.id==pid) { |
900 | var n = xp_node('/rsp/photo',xr.responseXML); | 911 | var n = xp_node('/rsp/photo',xr.responseXML); |
901 | pp.fromNode_(n); | 912 | pp.fromNode_(n); |
902 | _this.render_description_frame(pp.description); | 913 | _this.render_description_frame(pp.description); |
903 | } | 914 | } |
904 | }, function(x,s,c,m) { | 915 | }, function(x,s,c,m) { |
905 | _this.fireflix.flickr_failure(x,s,c,m); | 916 | _this.fireflix.flickr_failure(x,s,c,m); |
906 | } | 917 | } |
907 | ); | 918 | ); |
908 | this.searchresult_props.hidden = false; | 919 | this.searchresult_props.hidden = false; |
909 | }else{ | 920 | }else{ |
910 | this.render_description_frame(p.description); | 921 | this.render_description_frame(p.description); |
911 | } | 922 | } |
912 | } | 923 | } |
913 | } | 924 | } |
914 | }, | 925 | }, |
915 | on_cmd_open: function(ev) { | 926 | on_cmd_open: function(ev) { |
916 | if(this.selection.currentIndex<0) | 927 | if(this.selection.currentIndex<0) return; |
917 | return; | ||
918 | var p = this.photos[this.selection.currentIndex]; | 928 | var p = this.photos[this.selection.currentIndex]; |
919 | if(!p.id) | 929 | if(!p.id) return; |
920 | return; | ||
921 | this.fireflix.openTab(this.fireflix.flickr.make_photo_url(p,'p')); | 930 | this.fireflix.openTab(this.fireflix.flickr.make_photo_url(p,'p')); |
922 | } | 931 | } |
923 | }, | 932 | }, |
924 | 933 | ||
925 | photo_html: function(p,i,l) { | 934 | photo_html: function(p,i,l) { |
926 | // TODO: add alt/title when possible | 935 | // TODO: add alt/title when possible |
927 | var rv = | 936 | var rv = |
928 | '<a href="'+this.flickr.make_photo_url(p,l)+'">' + | 937 | '<a href="'+this.flickr.make_photo_url(p,l)+'">' + |
929 | '<img src="'+this.flickr.make_photo_url(p,i)+'" />'+ | 938 | '<img src="'+this.flickr.make_photo_url(p,i)+'" />'+ |
930 | '</a>'; | 939 | '</a>'; |
931 | return rv; | 940 | return rv; |
932 | }, | 941 | }, |
933 | build_html: function(photos,uti,utl) { | 942 | build_html: function(photos,uti,utl) { |
934 | var rv = ''; | 943 | var rv = ''; |
935 | for(var i in photos) { | 944 | for(var i in photos) { |
936 | var p = photos[i]; | 945 | var p = photos[i]; |
937 | rv += this.photo_html(p,uti,utl)+'\n'; | 946 | rv += this.photo_html(p,uti,utl)+'\n'; |
938 | } | 947 | } |
939 | return rv; | 948 | return rv; |
940 | }, | 949 | }, |
941 | 950 | ||
942 | popup_content: function(s) { | 951 | popup_content: function(s) { |
943 | window.openDialog( | 952 | window.openDialog( |
944 | "chrome://fireflix/content/generated-content.xul", | 953 | "chrome://fireflix/content/generated-content.xul", |
945 | null, "dialog,chrome", this, s ); | 954 | null, "dialog,chrome", this, s ); |
946 | }, | 955 | }, |
947 | copy_to_clipboard: function(s) { | 956 | copy_to_clipboard: function(s) { |
948 | var ch = Components.classes["@mozilla.org/widget/clipboardhelper;1"] | 957 | var ch = Components.classes["@mozilla.org/widget/clipboardhelper;1"] |
949 | .getService(Components.interfaces.nsIClipboardHelper); | 958 | .getService(Components.interfaces.nsIClipboardHelper); |
950 | ch.copyString(s); | 959 | ch.copyString(s); |
951 | }, | 960 | }, |
952 | openTab: function(l) { | 961 | openTab: function(l) { |