Skip to content
This repository has been archived by the owner on Nov 4, 2019. It is now read-only.

Autosave after losing focus #38

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jurriaan
Copy link

Added Autosave after losing focus feature, accessible from debug menu

@rsms
Copy link
Owner

rsms commented Jan 19, 2011

@jurriaan
Copy link
Author

I think I wasn't clear, but from reading the autosave interface docs I understand it's purpose is to save a file every x seconds, when my patch is about saving focus after cmd-tabbing away from the app.
It's a feature I use every day when I'm doing webdevelopment using Textmate

@rsms
Copy link
Owner

rsms commented Jan 20, 2011

I see, but what I would want us to do is to use the autosave mechanics (except from the interval triggering part). When the app loses focus, simply:

NSDocumentController *docController = [NSDocumentController sharedController];
if ([docController hasEditedDocuments]) {
  for (KDocument *doc in docController.documents) {
    if ([doc hasUnautosavedChanges])
      [doc autosaveDocumentWithDelegate:didAutosaveSelector:contextInfo:...
  }
}

I'd like us to avoid re-inventing a wheel which has already been invented. :)

@jurriaan
Copy link
Author

Well, ok, I understand your reasons for using autosave, but I still think it's not the best way to do it, because if a document isn't saved it'll save it to a temporary location (which is not wanted I think).
Yes, I can also check if the document has a URL like this:

if ([doc hasUnautosavedChanges] && doc.url )

But to me it feels like abusing the auto save feature :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants