Closed Bug 293231 Opened 20 years ago Closed 19 years ago

Spotlight Importer plugin for Mac-OS-X 10.4

Categories

(Firefox :: Bookmarks & History, enhancement)

PowerPC
macOS
enhancement
Not set
normal

Tracking

()

RESOLVED EXPIRED

People

(Reporter: d4ve, Unassigned)

References

Details

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; de-DE; rv:1.7.7) Gecko/20050416 Firefox/1.0.3 (PPC-970-optimiert, 1.0.3-DE, 17.4.2005, Hilarious)
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; de-DE; rv:1.7.7) Gecko/20050416 Firefox/1.0.3 (PPC-970-optimiert, 1.0.3-DE, 17.4.2005, Hilarious)

Mac-OS-X 10.4 new search engine offers safari bookmark indexing. I would like to
have the same thing for Firefox, too

Reproducible: Always




I have tried to build an .mdimporter bundle of myself:

http://developer.apple.com/documentation/Carbon/Conceptual/MDImporters/index.html#//apple_ref/doc/uid/TP40001267


But it looks like it's to complicated to me.

My first problem: How to identify the file 'bookmarks.html'? the .mdimporter
identfies its files by file type, not by name or path. sadly the mozilla
bookmarks are a standard html file. I have defined this ( in info.plist):

<key>UTExportedTypeDeclarations</key>
	<array>
		<dict>
			<key>UTTypeIdentifier</key>
			<string>org.mozilla.firefox.bookmarks</string>
			<key>UTTypeReferenceURL</key>
			<string>http://www.mozilla.org/firefox</string>
			<key>UTTypeDescription</key>
			<string>Firefox Bookmarks</string>
			<key>UTTypeConformsTo</key>
			<array>
				<string>public.html</string>
				<string>public.text</string>
			</array>
			<key>UTTypeTagSpecification</key>
			<dict>
				<key>public.filename-extension</key>
				<string>bookmarks.html</string>
			</dict>
		</dict>
	</array>


I am not sure how if "public.filename-extension" = "bookmarks.html" will work?
normaly this has to be something like only "html". but i dont want to index all
.html files

My second problem is how to extrack the data. this has to be done in
GetMetadataForFile.c GetMetadataForFile():

Boolean GetMetadataForFile(void* thisInterface, 
			   CFMutableDictionaryRef attributes, 
			   CFStringRef contentTypeUTI,
			   CFStringRef pathToFile)
{
    /* Pull any available metadata from the file at the specified path */
    /* Return the attribute keys and attribute values in the dict */
    /* Return true if successful, false if there was no data provided */
    Boolean success=NO;
    NSDictionary *tempDict;
    NSAutoreleasePool *pool;

    // Don't assume that there is an autorelease pool around the calling of this
function.
    pool = [[NSAutoreleasePool alloc] init];
    // load the document at the specified location
    tempDict=[[NSDictionary alloc] initWithContentsOfFile:(NSString *)pathToFile];
    if (tempDict)
    {
    // set the kMDItemTitle attribute to the Name of the Bookmark
    [(NSMutableDictionary *)attributes setObject:[tempDict objectForKey:@"title"]
                          forKey:(NSString *)kMDItemTitle];

    // set the kMDItemWhereFroms attribute to an URL of the Bookmark
    // value
    [(NSMutableDictionary *)attributes setObject:[NSArray
arrayWithObject:[tempDict objectForKey:@"author"]]
                          forKey:(NSString *)kMDItemWhereFroms];


    // set our custom document notes attribute to the Notes value
    // (in the real world, you'd likely use the kMDItemTextContent attribute,
however that
    // would make it hard to demonstrate using a custom key!)
    [(NSMutableDictionary *)attributes setObject:[tempDict objectForKey:@"notes"]

                         
forKey:@"com_apple_myCocoaDocumentApp_myCustomDocument_notes"];


    // return YES so that the attributes are imported
    success=YES;

    // release the loaded document
    [tempDict release];
    }
    [pool release];
    return success;

if someone knows how to help me or wants the entire source code, please contact me
Pink is already experimenting in Camino :
http://weblogs.mozillazine.org/pinkerton/archives/008096.html
i have looked at his code. it seams that he exports the camino bookmarks to an
extra file that is compatible with the safari spotlight importer. this is a
great idea. maybe this could be done in firefox with a firefox plugin.

//
308 // -writeBookmarksMetaDatatoPath:
309 //
310 // Writes out the meta data for this bookmark to a file with the name of
this item's UUID
311 // in the given path. Using the suffix "webbookmark" allows us to pick up on
the Spotlight
312 // importer already on Tiger for Safari.
313 //
314 -(void)writeBookmarksMetadataToPath:(NSString*)inPath
315 {
316   NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys: 
317                                       mTitle, @"Name",
318                                       mURL, @"URL",
319                                       nil];
320   NSString* file = [self UUID];
321   NSString* path = [NSString stringWithFormat:@"%@/%@.webbookmark", inPath,
file];
322   [dict writeToFile:path atomically:YES];
323 }
324 
*** Bug 293256 has been marked as a duplicate of this bug. ***
xref bug 290057 (Spotlight in Thunderbird)
What is the relation with the Spotlight-integration in Camino (
http://weblogs.mozillazine.org/pinkerton/archives/008096.html ) ?
why do you need an importer? why not just re-use the one safari uses? that's
what we did in camino.

i see no reason to do this work.
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
This bug has been automatically resolved after a period of inactivity (see above
comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → EXPIRED
You need to log in before you can comment on or make changes to this bug.