After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 692102 - edit mode for google docs
edit mode for google docs
Status: RESOLVED FIXED
Product: gnome-documents
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GNOME documents maintainer(s)
GNOME documents maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-01-19 21:07 UTC by William Jon McCann
Modified: 2013-01-23 00:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
An an edit mode for google documents (15.73 KB, patch)
2013-01-22 18:47 UTC, William Jon McCann
none Details | Review
An an edit mode for google documents (17.41 KB, patch)
2013-01-22 22:22 UTC, William Jon McCann
none Details | Review
An an edit mode for google documents (17.41 KB, patch)
2013-01-22 22:39 UTC, William Jon McCann
needs-work Details | Review
An an edit mode for google documents (17.07 KB, patch)
2013-01-23 00:20 UTC, William Jon McCann
committed Details | Review

Description William Jon McCann 2013-01-19 21:07:44 UTC
I think it would be nice to be able to directly manipulate Google documents in Documents. One way to do this is to offer an Edit action in the menu which would replace the PDF view with a webkit view of the online document editing interface.

The view could be switched back to the preview by clicking a View button.
Comment 1 William Jon McCann 2013-01-22 18:47:20 UTC
Created attachment 234127 [details] [review]
An an edit mode for google documents
Comment 2 Jakub Steiner 2013-01-22 19:03:06 UTC
I absolutely love this. I would even go as far as to use it by default for google documents as the PDF exported versions always feel like a 2nd class view. I don't consider the editing part to be the important bit, just a 'first class' rendering of the document is what I like about this.
Comment 3 William Jon McCann 2013-01-22 22:22:00 UTC
Created attachment 234146 [details] [review]
An an edit mode for google documents
Comment 4 William Jon McCann 2013-01-22 22:39:43 UTC
Created attachment 234149 [details] [review]
An an edit mode for google documents

Fix logic bug with fullscreen
Comment 5 Cosimo Cecchi 2013-01-22 23:39:55 UTC
Review of attachment 234149 [details] [review]:

Thanks Jon, this looks great! I put some comments below

::: src/edit.js
@@ +40,3 @@
+const View = imports.view;
+
+const _FULLSCREEN_TOOLBAR_TIMEOUT = 2; // seconds

This isn't needed here

@@ +57,3 @@
+
+        this._session = WebKit.get_default_session ();
+        Soup.Session.prototype.add_feature.call(this._session, new Soup.ProxyResolverDefault());

Ouch, this._session.add_feature() doesn't work?

@@ +58,3 @@
+        this._session = WebKit.get_default_session ();
+        Soup.Session.prototype.add_feature.call(this._session, new Soup.ProxyResolverDefault());
+        Soup.Session.prototype.remove_feature.call(this._session, new Soup.CookieJar());

Is this really needed? Why do we have to call remove_feature() with an object we just created? Maybe we need to call remove_feature_by_type() instead?

@@ +92,3 @@
+
+    _onProgressChanged: function() {
+        if (!this.view.uri || this.view.uri == "about:blank")

Use a define for about:blank, since it appears twice.

@@ +125,3 @@
+
+        if (uri == null)
+            uri = 'about:blank';

I'd check for if(!uri), since that also catches empty/undefined values.

@@ +183,3 @@
+    },
+
+    setModel: function(model) {

This isn't used here.

::: src/embed.js
@@ +398,3 @@
+            function() {
+                Application.modeController.setWindowMode(WindowMode.WindowMode.PREVIEW);
+                if (!doc)

I'd rather move all the logic related to these actions in edit.js directly. Note that you can connect to the load signals from there too, using Application.documentManager

@@ +488,3 @@
+            if (oldMode == WindowMode.WindowMode.EDIT) {
+                Application.documentManager.reloadActiveItem();
+            }

No braces for single-line blocks

@@ +533,3 @@
+            if (doc instanceof Documents.GoogleDocument) {
+                this._editAction.enabled = true;
+            }

No braces here

@@ +547,3 @@
     _prepareForOverview: function() {
+        if (this._preview) {
+            this._preview.controlsVisible = false;

This shouldn't be needed, preview.setModel() should already reset it to false.

@@ +585,3 @@
+    _prepareForEdit: function() {
+        if (this._preview) {
+            this._preview.controlsVisible = false;

Can't you call setModel(null) here as well?
Comment 6 Cosimo Cecchi 2013-01-22 23:40:08 UTC
Review of attachment 234149 [details] [review]:

Thanks Jon, this looks great! I put some comments below

::: src/edit.js
@@ +40,3 @@
+const View = imports.view;
+
+const _FULLSCREEN_TOOLBAR_TIMEOUT = 2; // seconds

This isn't needed here

@@ +57,3 @@
+
+        this._session = WebKit.get_default_session ();
+        Soup.Session.prototype.add_feature.call(this._session, new Soup.ProxyResolverDefault());

Ouch, this._session.add_feature() doesn't work?

@@ +58,3 @@
+        this._session = WebKit.get_default_session ();
+        Soup.Session.prototype.add_feature.call(this._session, new Soup.ProxyResolverDefault());
+        Soup.Session.prototype.remove_feature.call(this._session, new Soup.CookieJar());

Is this really needed? Why do we have to call remove_feature() with an object we just created? Maybe we need to call remove_feature_by_type() instead?

@@ +92,3 @@
+
+    _onProgressChanged: function() {
+        if (!this.view.uri || this.view.uri == "about:blank")

Use a define for about:blank, since it appears twice.

@@ +125,3 @@
+
+        if (uri == null)
+            uri = 'about:blank';

I'd check for if(!uri), since that also catches empty/undefined values.

@@ +183,3 @@
+    },
+
+    setModel: function(model) {

This isn't used here.

::: src/embed.js
@@ +398,3 @@
+            function() {
+                Application.modeController.setWindowMode(WindowMode.WindowMode.PREVIEW);
+                if (!doc)

I'd rather move all the logic related to these actions in edit.js directly. Note that you can connect to the load signals from there too, using Application.documentManager

@@ +488,3 @@
+            if (oldMode == WindowMode.WindowMode.EDIT) {
+                Application.documentManager.reloadActiveItem();
+            }

No braces for single-line blocks

@@ +533,3 @@
+            if (doc instanceof Documents.GoogleDocument) {
+                this._editAction.enabled = true;
+            }

No braces here

@@ +547,3 @@
     _prepareForOverview: function() {
+        if (this._preview) {
+            this._preview.controlsVisible = false;

This shouldn't be needed, preview.setModel() should already reset it to false.

@@ +585,3 @@
+    _prepareForEdit: function() {
+        if (this._preview) {
+            this._preview.controlsVisible = false;

Can't you call setModel(null) here as well?
Comment 7 William Jon McCann 2013-01-23 00:20:09 UTC
Created attachment 234158 [details] [review]
An an edit mode for google documents
Comment 8 Cosimo Cecchi 2013-01-23 00:23:31 UTC
Review of attachment 234158 [details] [review]:

Looks good!
Comment 9 William Jon McCann 2013-01-23 00:24:29 UTC
Attachment 234158 [details] pushed as b8b207a - An an edit mode for google documents