Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is Qt support autosave API for sandbox application [OSX] ?
Forum Updated to NodeBB v4.3 + New Features

Is Qt support autosave API for sandbox application [OSX] ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 499 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nen777w
    wrote on last edited by nen777w
    #1

    For OSX, the sandbox application can't save files (except special temporary folders) if the user does not initiate that (through save dialog).
    It might be a problem in two cases:

    • if you want to implement autosave functionality
    • if you want to implement safe save (save to another file then rename it to original).

    For these cases (as far I know), OSX propose use containers (autosavesInPlace(), autosavedContentsFileURL() and similar low-level API).

    Is Qt has hight level API for use that feature?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      For such highly OS specific stuff, no.

      However, what about requesting a temporary folder within the sandbox to store the file ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nen777w
        wrote on last edited by
        #3

        The problem not in keep file in a temporary folder (for the sandbox application it is allowable).
        The problem is: correctly save user file to avoid damage it.
        I.e. for example:
        The user saves file "documents/aaa.txt". When the application "decides" make autosave, it should create (for example) file in "documents/aaa.txt.autosave". Save data. And then rename it to "documents/aaa.txt"

        If something happens with the application during the save file it will help protect the original file from the damage.

        Honestly speaking I have not figured it out yet how to native autosave API work on OSX and thought Qt have hight level API for that. But looks like I should investigate native OSX API deeply. :-)

        1 Reply Last reply
        0
        • faiszalkhanF Offline
          faiszalkhanF Offline
          faiszalkhan
          wrote on last edited by
          #4

          @nen777w This could be a good place to check if that is what you're looking for.

          mrjjM 1 Reply Last reply
          1
          • faiszalkhanF faiszalkhan

            @nen777w This could be a good place to check if that is what you're looking for.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @faiszalkhan
            Nice example but I think poster wants to save to something special on OSX.

            1 Reply Last reply
            0
            • N Offline
              N Offline
              nen777w
              wrote on last edited by nen777w
              #6

              Sorry for pick up this theme again, but I just investigated Qt documentation and found that QSaveFile do that functionality.

              From the documentation:

              "QSaveFile is an I/O device for writing text and binary files, without losing existing data if the writing operation fails.

              While writing, the contents will be written to a temporary file, and if no error happened, commit() will move it to the final file. This ensures that no data at the final file is lost in case an error happens while writing, and no partially-written file is ever present at the final location. Always use QSaveFile when saving entire documents to disk."

              Hm... It will work on OSX (for sandbox application) or I miss something?

              UPDATE:
              QSaveFile - didn't work for sandbox application :-(

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved