OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /* | 5 /* |
6 * Base class that Ribbon uses to display photos. | 6 * Base class that Ribbon uses to display photos. |
7 */ | 7 */ |
8 | 8 |
9 function RibbonClient() {} | 9 function RibbonClient() {} |
10 | 10 |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
534 function onError() { | 534 function onError() { |
535 console.log('Rename error: "' + originalName + '" to "' + newName + '"'); | 535 console.log('Rename error: "' + originalName + '" to "' + newName + '"'); |
536 } | 536 } |
537 | 537 |
538 function onSuccess(entry) { | 538 function onSuccess(entry) { |
539 item.setUrl(entry.toURL()); | 539 item.setUrl(entry.toURL()); |
540 self.updateFilename_(); | 540 self.updateFilename_(); |
541 } | 541 } |
542 | 542 |
543 function doRename() { | 543 function doRename() { |
544 if (self.imageChanges_ > 0) { | 544 if (item.hasNameForSaving()) { |
545 //if (self.imageChanges_ > 0) { | |
Vladislav Kaznacheev
2012/05/15 15:05:12
Code in comment
dgozman
2012/05/15 15:10:33
Done.
| |
545 // Use this name in the next save operation. | 546 // Use this name in the next save operation. |
546 item.setNameForSaving(newName); | 547 item.setNameForSaving(newName); |
547 self.filenameSpacer_.removeAttribute('overwrite'); | 548 self.filenameSpacer_.removeAttribute('overwrite'); |
548 self.updateFilename_(); | 549 self.updateFilename_(); |
549 } else { | 550 } else { |
550 // Rename file in place. | 551 // Rename file in place. |
551 dir.getFile( | 552 dir.getFile( |
552 ImageUtil.getFullNameFromUrl(item.getUrl()), | 553 ImageUtil.getFullNameFromUrl(item.getUrl()), |
553 {create: false}, | 554 {create: false}, |
554 function(entry) { entry.moveTo(dir, newName, onSuccess, onError); }, | 555 function(entry) { entry.moveTo(dir, newName, onSuccess, onError); }, |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1174 | 1175 |
1175 Ribbon.Item.prototype.isOriginal = function () { return this.original_ }; | 1176 Ribbon.Item.prototype.isOriginal = function () { return this.original_ }; |
1176 | 1177 |
1177 Ribbon.Item.prototype.getUrl = function () { return this.url_ }; | 1178 Ribbon.Item.prototype.getUrl = function () { return this.url_ }; |
1178 Ribbon.Item.prototype.setUrl = function (url) { this.url_ = url }; | 1179 Ribbon.Item.prototype.setUrl = function (url) { this.url_ = url }; |
1179 | 1180 |
1180 Ribbon.Item.prototype.getNameAfterSaving = function () { | 1181 Ribbon.Item.prototype.getNameAfterSaving = function () { |
1181 return this.nameForSaving_ || ImageUtil.getFullNameFromUrl(this.url_); | 1182 return this.nameForSaving_ || ImageUtil.getFullNameFromUrl(this.url_); |
1182 }; | 1183 }; |
1183 | 1184 |
1185 Ribbon.Item.prototype.hasNameForSaving = function() { | |
1186 return !!this.nameForSaving_; | |
1187 }; | |
1188 | |
1184 Ribbon.Item.prototype.isSelected = function() { | 1189 Ribbon.Item.prototype.isSelected = function() { |
1185 return this.box_.hasAttribute('selected'); | 1190 return this.box_.hasAttribute('selected'); |
1186 }; | 1191 }; |
1187 | 1192 |
1188 Ribbon.Item.prototype.select = function(on) { | 1193 Ribbon.Item.prototype.select = function(on) { |
1189 ImageUtil.setAttribute(this.box_, 'selected', on); | 1194 ImageUtil.setAttribute(this.box_, 'selected', on); |
1190 }; | 1195 }; |
1191 | 1196 |
1192 Ribbon.Item.prototype.updateThumbnail = function(canvas) { | 1197 Ribbon.Item.prototype.updateThumbnail = function(canvas) { |
1193 if (this.canvas_) | 1198 if (this.canvas_) |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1485 ShareMode.prototype.setUp = function() { | 1490 ShareMode.prototype.setUp = function() { |
1486 ImageEditor.Mode.prototype.setUp.apply(this, arguments); | 1491 ImageEditor.Mode.prototype.setUp.apply(this, arguments); |
1487 ImageUtil.setAttribute(this.menu_, 'hidden', false); | 1492 ImageUtil.setAttribute(this.menu_, 'hidden', false); |
1488 ImageUtil.setAttribute(this.button_, 'pressed', false); | 1493 ImageUtil.setAttribute(this.button_, 'pressed', false); |
1489 }; | 1494 }; |
1490 | 1495 |
1491 ShareMode.prototype.cleanUpUI = function() { | 1496 ShareMode.prototype.cleanUpUI = function() { |
1492 ImageEditor.Mode.prototype.cleanUpUI.apply(this, arguments); | 1497 ImageEditor.Mode.prototype.cleanUpUI.apply(this, arguments); |
1493 ImageUtil.setAttribute(this.menu_, 'hidden', true); | 1498 ImageUtil.setAttribute(this.menu_, 'hidden', true); |
1494 }; | 1499 }; |
OLD | NEW |