bugGNUstep - Bugs: bug #25116, NSDocument should not ignore...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #25116: NSDocument should not ignore readFromFileWrapper:ofType:error:

Submitted by:  Gregory John Casamento <gcasa>
Submitted on:  Thu 18 Dec 2008 01:11:37 AM UTC  
 
Category: Gui/AppKitSeverity: 3 - Normal
Item Group: Change RequestStatus: Fixed
Privacy: PublicAssigned to: Fred Kiefer <FredKiefer>
Open/Closed: Closed

Wed 08 Apr 2009 04:26:56 PM UTC, comment #5:

I thought I did. :) It works perfectly. Thanks. GC

Gregory John Casamento <gcasa>
Project Administrator
Wed 08 Apr 2009 07:03:10 AM UTC, comment #4:

Closed as the original author did not report back :-(

Fred Kiefer <FredKiefer>
Project MemberIn charge of this item.
Sat 03 Jan 2009 04:40:03 PM UTC, comment #3:

The code for all this is now in place in GNUstep, plus some additional fixes to get Bean to loads at least a few data formats. Please give it at try, but don't expect this to load MS Word files, somebody will have to write a converter first :-)

Fred Kiefer <FredKiefer>
Project MemberIn charge of this item.
Thu 18 Dec 2008 09:15:57 AM UTC, comment #2:

I looked through the documentation and our code to see how we should proceed here. The main change that is needed is to switch NSDocumentController over to the new URL methods. Most of the implementation is already there, what needs to be changed is openDocument: this doesn't call into the new method hierarchy. While doing this switch we need to make sure that at each level we call the old method when a class overrides that.
Because of this requirement, I expect that we get this change wrong in the first go and would like to suggest to start it only after the next GNUstep release.
It is not too complicated, it just requires a lot of testing with different applications, old and new ones.

Fred Kiefer <FredKiefer>
Project MemberIn charge of this item.
Thu 18 Dec 2008 08:04:16 AM UTC, comment #1:

The original topic of the bug report was a bit off. There is no magic in NSDocument to load any sort of specific file format. Indeed Bean has all the code to load formats via NSAttributedString in its method readFromFileWrapper:ofType:error:, what our implementation of NSDocument is failing to do is call this method.

What we do is check for an implementation of readFromFile:ofType: (The old method for this purpose) and call this when implemented. This handling should be extended to check for the new method as well. The whole process is a bit tricky as we have to make sure both lines still work. We already have a macro in NSDocument to check, whether a method was overloaded OVERRIDDEN, we just need to use this for reading and of cause for writting as well.

Fred Kiefer <FredKiefer>
Project MemberIn charge of this item.
Thu 18 Dec 2008 01:11:37 AM UTC, original submission:

It seems as though NSDocument on Mac OS X understands RTF, RTFD, and a few other formats by default and lets you load those if your NSDocument subclass doesn't override loadFileWrapperRepresentation:ofType:.

You can see this in Bean.app. (Please see the gap project under ported-apps/Utils for the code)

Currently it is almost completely working in Gap, but it's unable to open and save files.... editing a new one, however, is not an issue.

On Mac OS X, this works just fine... it can load and save RTF, RTFD, etc etc... no problems even though it's MyDocument.m doesn't override loadFileWrapper..., so, apparently, the implementation of that method on Cocoa will attempt to read "known" formats.

Please let me know if you think this is correct.

Thanks, GC

Gregory John Casamento <gcasa>
Project Administrator

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by FredKiefer (Posted a comment)
  • -unavailable- added by gcasa (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 08 Apr 2009 07:03:10 AM UTCFredKieferStatusReady For Test=>Fixed
      Open/ClosedIn Test=>Closed
    Sat 03 Jan 2009 04:40:03 PM UTCFredKieferOpen/ClosedOpen=>In Test
    Sat 03 Jan 2009 04:40:02 PM UTCFredKieferStatusNone=>Ready For Test
    Thu 18 Dec 2008 09:15:57 AM UTCFredKieferAssigned toNone=>FredKiefer
    Thu 18 Dec 2008 08:04:15 AM UTCFredKieferSummaryNSDocument should handle loading of "known" types....=>NSDocument should not ignore readFromFileWrapper:ofType:error:

    Back to the top


    Powered by Savane 3.1-cleanup1