Skip to content

Commit

Permalink
Correct undo menu on creation context (refs #3864)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbonnissent committed Apr 2, 2013
1 parent b4dd34d commit c69dc82
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
21 changes: 14 additions & 7 deletions chrome/dcpOffline/content/main.js
Expand Up @@ -547,6 +547,11 @@ function openDocument(config) {
doc = docManager.getLocalDocument({
initid : config.documentId
});
if (!doc) {
// This is not a real document
logIHM("Try to open a non known document "+config.documentId);
return;
}
template = doc.getBinding(mode);
if (template) {
template = 'url("' + template + '")';
Expand Down Expand Up @@ -707,18 +712,20 @@ function updateOpenDocumentList() {
*/
function addDocumentToOpenList(config) {
logIHM("addDocumentToOpenList");
var currentDocs = {};
var currentDocument, currentDocs = {};
if (config && config.documentId) {
if (getListOfOpenDocuments()) {
currentDocs = getListOfOpenDocuments();
}
var title = docManager.getLocalDocument({
currentDocument = docManager.getLocalDocument({
initid : config.documentId
}).getTitle();
currentDocs[config.documentId] = {
title : title,
mode : config.mode
};
});
if (currentDocument) {
currentDocs[config.documentId] = {
title : currentDocument.getTitle(),
mode : config.mode
};
}
Preferences.set("offline.user." + getCurrentDomain()
+ ".currentListOfOpenDocuments", JSON.stringify(currentDocs));
applicationEvent.publish("postUpdateListOfOpenDocumentsPreference");
Expand Down
7 changes: 4 additions & 3 deletions chrome/dcpOffline/modules/localDocument.jsm
Expand Up @@ -133,14 +133,15 @@ localDocument.prototype = {
}
},
getTitle : function() {
return this.properties.title;
return this.properties.title || '';
},
getProperty : function(id) {
if (id) {
if (this.properties) return this.properties[id];
if (this.properties && this.properties[id]) {
return this.properties[id];
}
return null;
} else {
// FIXME
throw new ArgException("getValue :: missing arguments");
}
},
Expand Down

0 comments on commit c69dc82

Please sign in to comment.