summaryrefslogtreecommitdiffabout
path: root/content
authorMichael Krelin <hacker@klever.net>2006-12-18 18:56:09 (UTC)
committer Michael Krelin <hacker@klever.net>2006-12-18 18:56:09 (UTC)
commit71a2c8a80f3c7a99e893efb32c6bbf5080e16ff1 (patch) (unidiff)
tree1f9051339dee22f5c64206568638675ca9f7636a /content
parent1838bc18394967371d7a1c00516db5e290f80ea3 (diff)
downloadfireflix-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
Diffstat (limited to 'content') (more/less context) (ignore whitespace changes)
-rw-r--r--content/fireflix-panel.xul3
-rw-r--r--content/fireflix.js17
-rw-r--r--content/flickr.js5
3 files changed, 20 insertions, 5 deletions
diff --git a/content/fireflix-panel.xul b/content/fireflix-panel.xul
index 405804c..8aec0e4 100644
--- a/content/fireflix-panel.xul
+++ b/content/fireflix-panel.xul
@@ -235,25 +235,26 @@
235 <listheader label="&panel.tagslist.tag.label;"/> 235 <listheader label="&panel.tagslist.tag.label;"/>
236 </listhead> 236 </listhead>
237 <listcols> 237 <listcols>
238 <listcol flex="1"/> 238 <listcol flex="1"/>
239 </listcols> 239 </listcols>
240 </listbox> 240 </listbox>
241 </tabpanel> 241 </tabpanel>
242 242
243 <tabpanel id="tabpanel_upload"> 243 <tabpanel id="tabpanel_upload">
244 <vbox flex="1"> 244 <vbox flex="1">
245 <tree id="uploadlist" rows="2" flex="1" 245 <tree id="uploadlist" rows="2" flex="1"
246 onselect="fireflix.uploads.selectionChanged()" 246 onselect="fireflix.uploads.selectionChanged()"
247 context="uploads_menu"> 247 context="uploads_menu" ondblclick="fireflix.uploads.on_cmd_open(event)"
248 onkeypress="if(event.keyCode==event.DOM_VK_RETURN) fireflix.uploads.on_cmd_open(event)" >
248 <treecols> 249 <treecols>
249 <treecol id="up_file" label="&panel.uploadlist.file.label;" flex="4" crop="start" align="start"/> 250 <treecol id="up_file" label="&panel.uploadlist.file.label;" flex="4" crop="start" align="start"/>
250 <splitter class="tree-splitter" /> 251 <splitter class="tree-splitter" />
251 <treecol id="up_title" label="&panel.uploadlist.title.label;" flex="5" crop="end" align="start" /> 252 <treecol id="up_title" label="&panel.uploadlist.title.label;" flex="5" crop="end" align="start" />
252 <splitter class="tree-splitter" /> 253 <splitter class="tree-splitter" />
253 <treecol id="up_status" label="&panel.uploadlist.status.label;" flex="1" crop="end" align="start" /> 254 <treecol id="up_status" label="&panel.uploadlist.status.label;" flex="1" crop="end" align="start" />
254 </treecols> 255 </treecols>
255 <treechildren/> 256 <treechildren/>
256 </tree> 257 </tree>
257 <progressmeter id="upload_progress" mode="undetermined" hidden="true" /> 258 <progressmeter id="upload_progress" mode="undetermined" hidden="true" />
258 <groupbox id="upload_file_props" orient="vertical" hidden="true"> 259 <groupbox id="upload_file_props" orient="vertical" hidden="true">
259 <hbox> 260 <hbox>
diff --git a/content/fireflix.js b/content/fireflix.js
index 78e56c2..225e21c 100644
--- a/content/fireflix.js
+++ b/content/fireflix.js
@@ -619,24 +619,35 @@ var fireflix = {
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(
@@ -904,29 +915,27 @@ var fireflix = {
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 },
diff --git a/content/flickr.js b/content/flickr.js
index b8360c1..e09d5f0 100644
--- a/content/flickr.js
+++ b/content/flickr.js
@@ -88,24 +88,25 @@ Photo.prototype = {
88 // TODO: urls/url/@type urls/url 88 // TODO: urls/url/@type urls/url
89 } 89 }
90}; 90};
91 91
92function Flickr() { } 92function Flickr() { }
93Flickr.prototype = { 93Flickr.prototype = {
94 94
95 rest_url: 'http://www.flickr.com/services/rest/', 95 rest_url: 'http://www.flickr.com/services/rest/',
96 auth_url: 'http://flickr.com/services/auth/', 96 auth_url: 'http://flickr.com/services/auth/',
97 photo_url: 'http://static.flickr.com/', 97 photo_url: 'http://static.flickr.com/',
98 photos_url: 'http://www.flickr.com/photos/', 98 photos_url: 'http://www.flickr.com/photos/',
99 upload_url: 'http://www.flickr.com/services/upload/', 99 upload_url: 'http://www.flickr.com/services/upload/',
100 uploader_edit_url: 'http://www.flickr.com/tools/uploader_edit.gne',
100 101
101 api_sig: function(paramstr) { 102 api_sig: function(paramstr) {
102 return MD5(toutf8(this.api_shs+paramstr)); 103 return MD5(toutf8(this.api_shs+paramstr));
103 }, 104 },
104 api_call_url: function(params,url) { 105 api_call_url: function(params,url) {
105 params.api_key = this.api_key; 106 params.api_key = this.api_key;
106 var pp = new Array(); 107 var pp = new Array();
107 for(var p in params) { 108 for(var p in params) {
108 pp.push(p); 109 pp.push(p);
109 } 110 }
110 var pstr = ''; 111 var pstr = '';
111 var rv = (url?url:this.rest_url)+'?'; 112 var rv = (url?url:this.rest_url)+'?';
@@ -266,24 +267,28 @@ Flickr.prototype = {
266 return this.photos_url + this.user.nsid + '/' + p; 267 return this.photos_url + this.user.nsid + '/' + p;
267 }, 268 },
268 make_photo_url: function(p,sfx) { 269 make_photo_url: function(p,sfx) {
269 if(sfx=='p') 270 if(sfx=='p')
270 return this.get_photo_page_url(p); 271 return this.get_photo_page_url(p);
271 else 272 else
272 return this.get_image_url(p,sfx); 273 return this.get_image_url(p,sfx);
273 }, 274 },
274 make_photoset_url: function(ps) { 275 make_photoset_url: function(ps) {
275 // TODO: allow for using someone else's photoset? 276 // TODO: allow for using someone else's photoset?
276 return this.photos_url+this.user.nsid+'/sets/'+ps.id; 277 return this.photos_url+this.user.nsid+'/sets/'+ps.id;
277 }, 278 },
279 make_uploader_edit_url: function(pid) {
280 // TODO: handle arrays
281 return this.uploader_edit_url+'?ids='+pid;
282 },
278 283
279 upload_file: function(f,fa,on_success,on_failure) { 284 upload_file: function(f,fa,on_success,on_failure) {
280 try { 285 try {
281 var fi = Components.classes["@mozilla.org/file/local;1"] 286 var fi = Components.classes["@mozilla.org/file/local;1"]
282 .createInstance(Components.interfaces.nsILocalFile); 287 .createInstance(Components.interfaces.nsILocalFile);
283 fi.initWithPath( f ); 288 fi.initWithPath( f );
284 var st = Components.classes["@mozilla.org/network/file-input-stream;1"] 289 var st = Components.classes["@mozilla.org/network/file-input-stream;1"]
285 .createInstance(Components.interfaces.nsIFileInputStream); 290 .createInstance(Components.interfaces.nsIFileInputStream);
286 st.init(fi,0x01,00004,null); 291 st.init(fi,0x01,00004,null);
287 var bis = Components.classes["@mozilla.org/binaryinputstream;1"] 292 var bis = Components.classes["@mozilla.org/binaryinputstream;1"]
288 .createInstance(Components.interfaces.nsIBinaryInputStream); 293 .createInstance(Components.interfaces.nsIBinaryInputStream);
289 bis.setInputStream(st); 294 bis.setInputStream(st);