xref: /haiku/src/kits/tracker/TrackerInitialState.cpp (revision 91054f1d38dd7827c0f0ba9490c213775ec7b471)
1 /*
2 Open Tracker License
3 
4 Terms and Conditions
5 
6 Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
7 
8 Permission is hereby granted, free of charge, to any person obtaining a copy of
9 this software and associated documentation files (the "Software"), to deal in
10 the Software without restriction, including without limitation the rights to
11 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
12 of the Software, and to permit persons to whom the Software is furnished to do
13 so, subject to the following conditions:
14 
15 The above copyright notice and this permission notice applies to all licensees
16 and shall be included in all copies or substantial portions of the Software.
17 
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
23 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 
25 Except as contained in this notice, the name of Be Incorporated shall not be
26 used in advertising or otherwise to promote the sale, use or other dealings in
27 this Software without prior written authorization from Be Incorporated.
28 
29 Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
30 of Be Incorporated in the United States and other countries. Other brand product
31 names are registered trademarks or trademarks of their respective holders.
32 All rights reserved.
33 */
34 
35 // ToDo:
36 // add code to initialize a subset of the mime database, including
37 // important sniffer rules
38 
39 #include <Alert.h>
40 #include <Directory.h>
41 #include <InterfaceDefs.h>
42 #include <Message.h>
43 #include <Node.h>
44 #include <Path.h>
45 #include <Screen.h>
46 #include <VolumeRoster.h>
47 
48 #include <fs_attr.h>
49 #include <fs_index.h>
50 
51 #include "pr_server.h"
52 
53 #include "Attributes.h"
54 #include "AttributeStream.h"
55 #include "BackgroundImage.h"
56 #include "Bitmaps.h"
57 #include "ContainerWindow.h"
58 #include "MimeTypes.h"
59 #include "FSUtils.h"
60 #include "QueryContainerWindow.h"
61 #include "Tracker.h"
62 
63 enum {
64 	kForceLargeIcon = 0x1,
65 	kForceMiniIcon = 0x2,
66 	kForceShortDescription = 0x4,
67 	kForceLongDescription = 0x8,
68 	kForcePreferredApp = 0x10
69 };
70 
71 
72 const char *kAttrName = "META:name";
73 const char *kAttrCompany = "META:company";
74 const char *kAttrAddress = "META:address";
75 const char *kAttrCity = "META:city";
76 const char *kAttrState = "META:state";
77 const char *kAttrZip = "META:zip";
78 const char *kAttrCountry = "META:country";
79 const char *kAttrHomePhone = "META:hphone";
80 const char *kAttrWorkPhone = "META:wphone";
81 const char *kAttrFax = "META:fax";
82 const char *kAttrEmail = "META:email";
83 const char *kAttrURL = "META:url";
84 const char *kAttrGroup = "META:group";
85 const char *kAttrNickname = "META:nickname";
86 
87 const char *kNetPositiveSignature = "application/x-vnd.Be-NPOS";
88 const char *kPeopleSignature = "application/x-vnd.Be-PEPL";
89 
90 namespace BPrivate {
91 
92 class ExtraAttributeLazyInstaller {
93 public:
94 	ExtraAttributeLazyInstaller(const char *type);
95 	~ExtraAttributeLazyInstaller();
96 
97 	bool AddExtraAttribute(const char *publicName, const char *name,
98 		uint32 type, bool viewable, bool editable, float width,
99 		int32 alignment, bool extra);
100 
101 	status_t InitCheck() const;
102 public:
103 	BMimeType fMimeType;
104 	BMessage fExtraAttrs;
105 	bool fDirty;
106 };
107 
108 }
109 
110 ExtraAttributeLazyInstaller::ExtraAttributeLazyInstaller(const char *type)
111 	:	fMimeType(type),
112 		fDirty(false)
113 {
114 	if (fMimeType.InitCheck() == B_OK)
115 		fMimeType.GetAttrInfo(&fExtraAttrs);
116 }
117 
118 
119 ExtraAttributeLazyInstaller::~ExtraAttributeLazyInstaller()
120 {
121 	if (fMimeType.InitCheck() == B_OK && fDirty)
122 		fMimeType.SetAttrInfo(&fExtraAttrs);
123 }
124 
125 bool
126 ExtraAttributeLazyInstaller::AddExtraAttribute(const char *publicName, const char *name,
127 	uint32 type, bool viewable, bool editable, float width, int32 alignment,
128 	bool extra)
129 {
130 	for (int32 index = 0; ; index++) {
131 		const char *oldPublicName;
132 		if (fExtraAttrs.FindString("attr:public_name", index, &oldPublicName) != B_OK)
133 			break;
134 
135 		if (strcmp(oldPublicName, publicName) == 0)
136 			// already got this extra atribute, no work left
137 			return false;
138 	}
139 
140 	fExtraAttrs.AddString("attr:public_name", publicName);
141 	fExtraAttrs.AddString("attr:name", name);
142 	fExtraAttrs.AddInt32("attr:type", (int32)type);
143 	fExtraAttrs.AddBool("attr:viewable", viewable);
144 	fExtraAttrs.AddBool("attr:editable", editable);
145 	fExtraAttrs.AddInt32("attr:width", (int32)width);
146 	fExtraAttrs.AddInt32("attr:alignment", alignment);
147 	fExtraAttrs.AddBool("attr:extra", extra);
148 
149 	fDirty = true;
150 	return true;
151 }
152 
153 
154 bool
155 TTracker::InstallMimeIfNeeded(const char *type, int32 bitsID,
156 	const char *shortDescription, const char *longDescription,
157 	const char *preferredAppSignature, uint32 forceMask)
158 {
159 	// used by InitMimeTypes - checks if a metamime of a given <type> is
160 	// installed and if it has all the specified attributes; if not, the
161 	// whole mime type is installed and all attributes are set; nulls can
162 	// be passed for attributes that don't matter; returns true if anything
163 	// had to be changed
164 
165 #ifndef __HAIKU__
166 # define B_BITMAP_NO_SERVER_LINK 0
167 #endif
168 
169 #ifdef __HAIKU__
170 	BBitmap vectorIcon(BRect(0, 0, 31, 31), B_BITMAP_NO_SERVER_LINK, B_RGBA32);
171 #endif
172 	BBitmap largeIcon(BRect(0, 0, 31, 31), B_BITMAP_NO_SERVER_LINK, B_CMAP8);
173 	BBitmap miniIcon(BRect(0, 0, 15, 15), B_BITMAP_NO_SERVER_LINK, B_CMAP8);
174 	char tmp[B_MIME_TYPE_LENGTH];
175 
176 	BMimeType mime(type);
177 	bool installed = mime.IsInstalled();
178 
179 	if (!installed
180 #ifdef __HAIKU__
181 		|| (bitsID >= 0 && ((forceMask & kForceLargeIcon)
182 			|| mime.GetIcon(&vectorIcon, B_LARGE_ICON) != B_OK))
183 #endif
184 		|| (bitsID >= 0 && ((forceMask & kForceLargeIcon)
185 			|| mime.GetIcon(&largeIcon, B_LARGE_ICON) != B_OK))
186 		|| (bitsID >= 0 && ((forceMask & kForceMiniIcon)
187 			|| mime.GetIcon(&miniIcon, B_MINI_ICON) != B_OK))
188 		|| (shortDescription && ((forceMask & kForceShortDescription)
189 			|| mime.GetShortDescription(tmp) != B_OK))
190 		|| (longDescription && ((forceMask & kForceLongDescription)
191 			|| mime.GetLongDescription(tmp) != B_OK))
192 		|| (preferredAppSignature && ((forceMask & kForcePreferredApp)
193 			|| mime.GetPreferredApp(tmp) != B_OK))) {
194 
195 		if (!installed)
196 			mime.Install();
197 
198 		if (bitsID >= 0) {
199 #ifdef __HAIKU__
200 			const uint8* iconData;
201 			size_t iconSize;
202 			if (GetTrackerResources()->
203 					GetIconResource(bitsID, &iconData, &iconSize) == B_OK)
204 				mime.SetIcon(iconData, iconSize);
205 #endif
206 
207 			if (GetTrackerResources()->
208 					GetIconResource(bitsID, B_LARGE_ICON, &largeIcon) == B_OK)
209 				mime.SetIcon(&largeIcon, B_LARGE_ICON);
210 
211 			if (GetTrackerResources()->
212 					GetIconResource(bitsID, B_MINI_ICON, &miniIcon) == B_OK)
213 				mime.SetIcon(&miniIcon, B_MINI_ICON);
214 		}
215 
216 		if (shortDescription)
217 			mime.SetShortDescription(shortDescription);
218 
219 		if (longDescription)
220 			mime.SetLongDescription(longDescription);
221 
222 		if (preferredAppSignature)
223 			mime.SetPreferredApp(preferredAppSignature);
224 
225 		return true;
226 	}
227 	return false;
228 }
229 
230 void
231 TTracker::InitMimeTypes()
232 {
233 	InstallMimeIfNeeded(B_DIR_MIMETYPE, kResFolderIcon,
234 		"Folder", "Folder container for file system items.", kTrackerSignature);
235 
236 	InstallMimeIfNeeded(B_APP_MIME_TYPE, kResAppIcon,
237 		"Be Application", "Generic Be Application executable.", kTrackerSignature);
238 
239 	InstallMimeIfNeeded(B_FILE_MIMETYPE, kResFileIcon,
240 		"Generic file", "Generic document file.", kTrackerSignature);
241 
242 	InstallMimeIfNeeded(B_VOLUME_MIMETYPE, kResHardDiskIcon,
243 		"Be Volume", "Disk volume.", kTrackerSignature);
244 
245 	InstallMimeIfNeeded(B_QUERY_MIMETYPE, kResQueryIcon,
246 		"Be Query", "Query to locate items on disks.", kTrackerSignature);
247 
248 	InstallMimeIfNeeded(B_QUERY_TEMPLATE_MIMETYPE, kResQueryTemplateIcon,
249 		"Be Query Template", "", kTrackerSignature);
250 
251 	InstallMimeIfNeeded(B_LINK_MIMETYPE, kResBrokenLinkIcon,
252 		"Symbolic Link", "Link to another item in the file system.", kTrackerSignature);
253 
254 	InstallMimeIfNeeded(B_ROOT_MIMETYPE, kResRootIcon,
255 		"Be Root", "File system root.", kTrackerSignature);
256 
257 	InstallMimeIfNeeded(B_BOOKMARK_MIMETYPE, kResBookmarkIcon,
258 		"Bookmark", "Bookmark for a web page.", kNetPositiveSignature);
259 
260 	{
261 		// install a couple of extra fields for bookmark
262 
263 		ExtraAttributeLazyInstaller installer(B_BOOKMARK_MIMETYPE);
264 		installer.AddExtraAttribute("URL", "META:url", B_STRING_TYPE, true, true,
265 			170, B_ALIGN_LEFT, false);
266 		installer.AddExtraAttribute("Keywords", "META:keyw", B_STRING_TYPE, true, true,
267 			130, B_ALIGN_LEFT, false);
268 		installer.AddExtraAttribute("Title", "META:title", B_STRING_TYPE, true, true,
269 			130, B_ALIGN_LEFT, false);
270 	}
271 
272 	InstallMimeIfNeeded(B_PERSON_MIMETYPE, kResPersonIcon,
273 		"Person", "Contact information for a person.", kPeopleSignature);
274 
275 	{
276 		ExtraAttributeLazyInstaller installer(B_PERSON_MIMETYPE);
277 		installer.AddExtraAttribute("Contact Name", kAttrName, B_STRING_TYPE, true, true,
278 			120, B_ALIGN_LEFT, false);
279 		installer.AddExtraAttribute("Company", kAttrCompany, B_STRING_TYPE, true, true,
280 			120, B_ALIGN_LEFT, false);
281 		installer.AddExtraAttribute("Address", kAttrAddress, B_STRING_TYPE, true, true,
282 			120, B_ALIGN_LEFT, false);
283 		installer.AddExtraAttribute("City", kAttrCity, B_STRING_TYPE, true, true,
284 			90, B_ALIGN_LEFT, false);
285 		installer.AddExtraAttribute("State", kAttrState, B_STRING_TYPE, true, true,
286 			50, B_ALIGN_LEFT, false);
287 		installer.AddExtraAttribute("Zip", kAttrZip, B_STRING_TYPE, true, true,
288 			50, B_ALIGN_LEFT, false);
289 		installer.AddExtraAttribute("Country", kAttrCountry, B_STRING_TYPE, true, true,
290 			120, B_ALIGN_LEFT, false);
291 		installer.AddExtraAttribute("E-mail", kAttrEmail, B_STRING_TYPE, true, true,
292 			120, B_ALIGN_LEFT, false);
293 		installer.AddExtraAttribute("Home Phone", kAttrHomePhone, B_STRING_TYPE, true, true,
294 			90, B_ALIGN_LEFT, false);
295 		installer.AddExtraAttribute("Work Phone", kAttrWorkPhone, B_STRING_TYPE, true, true,
296 			90, B_ALIGN_LEFT, false);
297 		installer.AddExtraAttribute("Fax", kAttrFax, B_STRING_TYPE, true, true,
298 			90, B_ALIGN_LEFT, false);
299 		installer.AddExtraAttribute("URL", kAttrURL, B_STRING_TYPE, true, true,
300 			120, B_ALIGN_LEFT, false);
301 		installer.AddExtraAttribute("Group", kAttrGroup, B_STRING_TYPE, true, true,
302 			120, B_ALIGN_LEFT, false);
303 		installer.AddExtraAttribute("Nickname", kAttrNickname, B_STRING_TYPE, true, true,
304 			120, B_ALIGN_LEFT, false);
305 	}
306 
307 	InstallMimeIfNeeded(B_PRINTER_SPOOL_MIMETYPE, kResSpoolFileIcon,
308 		"Printer spool", "Printer spool file.", "application/x-vnd.Be-PRNT");
309 
310 	{
311 #if B_BEOS_VERSION_DANO
312 		ExtraAttributeLazyInstaller installer(B_PRINTER_SPOOL_MIMETYPE);
313 		installer.AddExtraAttribute("Status", PSRV_SPOOL_ATTR_STATUS, B_STRING_TYPE, true, false,
314 			60, B_ALIGN_LEFT, false);
315 		installer.AddExtraAttribute("Page Count", PSRV_SPOOL_ATTR_PAGECOUNT, B_INT32_TYPE, true, false,
316 			40, B_ALIGN_RIGHT, false);
317 		installer.AddExtraAttribute("Description", PSRV_SPOOL_ATTR_DESCRIPTION, B_STRING_TYPE, true, true,
318 			100, B_ALIGN_LEFT, false);
319 		installer.AddExtraAttribute("Printer Name", PSRV_SPOOL_ATTR_PRINTER, B_STRING_TYPE, true, false,
320 			80, B_ALIGN_LEFT, false);
321 		installer.AddExtraAttribute("Job creator type", PSRV_SPOOL_ATTR_MIMETYPE, B_ASCII_TYPE, true, false,
322 			60, B_ALIGN_LEFT, false);
323 #else
324 		ExtraAttributeLazyInstaller installer(B_PRINTER_SPOOL_MIMETYPE);
325 		installer.AddExtraAttribute("Page Count", "_spool/Page Count", B_INT32_TYPE, true, false,
326 			40, B_ALIGN_RIGHT, false);
327 		installer.AddExtraAttribute("Description", "_spool/Description", B_ASCII_TYPE, true, true,
328 			100, B_ALIGN_LEFT, false);
329 		installer.AddExtraAttribute("Printer Name", "_spool/Printer", B_ASCII_TYPE, true, false,
330 			80, B_ALIGN_LEFT, false);
331 		installer.AddExtraAttribute("Job creator type", "_spool/MimeType", B_ASCII_TYPE, true, false,
332 			60, B_ALIGN_LEFT, false);
333 #endif
334 	}
335 
336 	InstallMimeIfNeeded(B_PRINTER_MIMETYPE, kResGenericPrinterIcon,
337 		"Printer", "Printer queue.", kTrackerSignature /*application/x-vnd.Be-PRNT*/);
338 		// for now set tracker as a default handler for the printer because we
339 		// just want to open it as a folder
340 #if B_BEOS_VERSION_DANO
341 	{
342 		ExtraAttributeLazyInstaller installer(B_PRINTER_MIMETYPE);
343 		installer.AddExtraAttribute("Driver", PSRV_PRINTER_ATTR_DRV_NAME, B_STRING_TYPE, true, false,
344 			120, B_ALIGN_LEFT, false);
345 		installer.AddExtraAttribute("Transport", PSRV_PRINTER_ATTR_TRANSPORT, B_STRING_TYPE, true, false,
346 			60, B_ALIGN_RIGHT, false);
347 		installer.AddExtraAttribute("Connection", PSRV_PRINTER_ATTR_CNX, B_STRING_TYPE, true, false,
348 			40, B_ALIGN_LEFT, false);
349 		installer.AddExtraAttribute("Description", PSRV_PRINTER_ATTR_COMMENTS, B_STRING_TYPE, true, true,
350 			140, B_ALIGN_LEFT, false);
351 	}
352 #endif
353 }
354 
355 void
356 TTracker::InstallIndices()
357 {
358 	BVolumeRoster roster;
359 	BVolume volume;
360 
361 	roster.Rewind();
362 	while (roster.GetNextVolume(&volume) == B_OK) {
363 		if (volume.IsReadOnly() || !volume.IsPersistent()
364 			|| !volume.KnowsAttr() || !volume.KnowsQuery())
365 			continue;
366 		InstallIndices(volume.Device());
367 	}
368 }
369 
370 void
371 TTracker::InstallIndices(dev_t device)
372 {
373 	status_t error = fs_create_index(device, kAttrQueryLastChange, B_INT32_TYPE, 0);
374 	error = fs_create_index(device, "_trk/recentQuery", B_INT32_TYPE, 0);
375 }
376 
377 const int32 kDefaultQueryTemplateCount = 3;
378 extern const AttributeTemplate kDefaultQueryTemplate[];
379 extern const AttributeTemplate kBookmarkQueryTemplate[];
380 extern const AttributeTemplate kPersonQueryTemplate[];
381 extern const AttributeTemplate kEmailQueryTemplate[];
382 
383 void
384 TTracker::InstallDefaultTemplates()
385 {
386 	BNode node;
387 	BString query(kQueryTemplates);
388 	query += "/application_octet-stream";
389 
390 	if (!BContainerWindow::DefaultStateSourceNode(query.String(), &node, false))
391 		if (BContainerWindow::DefaultStateSourceNode(query.String(), &node, true)) {
392 			AttributeStreamFileNode fileNode(&node);
393 			AttributeStreamTemplateNode tmp(kDefaultQueryTemplate, 3);
394 			fileNode << tmp;
395 		}
396 
397 	(query = kQueryTemplates) += "/application_x-vnd.Be-bookmark";
398 	if (!BContainerWindow::DefaultStateSourceNode(query.String(), &node, false))
399 		if (BContainerWindow::DefaultStateSourceNode(query.String(), &node, true)) {
400 			AttributeStreamFileNode fileNode(&node);
401 			AttributeStreamTemplateNode tmp(kBookmarkQueryTemplate, 3);
402 			fileNode << tmp;
403 		}
404 
405 	(query = kQueryTemplates) += "/application_x-person";
406 	if (!BContainerWindow::DefaultStateSourceNode(query.String(), &node, false))
407 		if (BContainerWindow::DefaultStateSourceNode(query.String(), &node, true)) {
408 			AttributeStreamFileNode fileNode(&node);
409 			AttributeStreamTemplateNode tmp(kPersonQueryTemplate, 3);
410 			fileNode << tmp;
411 		}
412 
413 	(query = kQueryTemplates) += "/text_x-email";
414 	if (!BContainerWindow::DefaultStateSourceNode(query.String(), &node, false))
415 		if (BContainerWindow::DefaultStateSourceNode(query.String(), &node, true)) {
416 			AttributeStreamFileNode fileNode(&node);
417 			AttributeStreamTemplateNode tmp(kEmailQueryTemplate, 3);
418 			fileNode << tmp;
419 		}
420 }
421 
422 static void
423 InstallTemporaryBackgroundImages(BNode *node, BMessage *message)
424 {
425 	int32 size = message->FlattenedSize();
426 	char *buffer = new char [size];
427 	message->Flatten(buffer, size);
428 	node->WriteAttr(kBackgroundImageInfo, B_MESSAGE_TYPE, 0, buffer, (size_t)size);
429 	delete [] buffer;
430 }
431 
432 static void
433 AddTemporaryBackgroundImages(BMessage *message, const char *imagePath,
434 	BackgroundImage::Mode mode, BPoint offset, uint32 workspaces, bool textWidgetOutlines)
435 {
436 	message->AddString(kBackgroundImageInfoPath, imagePath);
437 	message->AddInt32(kBackgroundImageInfoWorkspaces, (int32)workspaces);
438 	message->AddInt32(kBackgroundImageInfoMode, mode);
439 	message->AddBool(kBackgroundImageInfoTextOutline, textWidgetOutlines);
440 	message->AddPoint(kBackgroundImageInfoOffset, offset);
441 }
442 
443 #if 0 // dead code, don't know what it was used for
444 static void
445 InstallTemporaryBackgroundImagesIfNeeded(BNode *node, const char *imagePath,
446 	BackgroundImage::Mode mode, BPoint offset, uint32 workspaces, bool textWidgetOutlines)
447 {
448 	attr_info info;
449 	if (node->GetAttrInfo(kBackgroundImageInfo, &info) != B_OK) {
450 		BMessage message;
451 		AddTemporaryBackgroundImages(&message, imagePath, mode, offset, workspaces,
452 			textWidgetOutlines);
453 		InstallTemporaryBackgroundImages(node, &message);
454 	}
455 }
456 #endif
457 
458 void
459 TTracker::InstallTemporaryBackgroundImages()
460 {
461 	// make the large Haiku Logo the default background
462 
463 	BPath path;
464 	status_t status = find_directory(B_SYSTEM_DATA_DIRECTORY, &path);
465 	if (status < B_OK) {
466 		BString errorMessage;
467 		errorMessage << "At " << __PRETTY_FUNCTION__ << "\n";
468 		errorMessage << "find_directory() failed. \nReason: ";
469 		errorMessage << strerror(status);
470 		(new BAlert("AlertError", errorMessage.String(), "OK", NULL, NULL,
471 			B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
472 		return;
473 	}
474 	path.Append("artwork");
475 //	FSFindTrackerSettingsDir(&path, false);
476 //	path.Append(kDefaultFolderTemplate);
477 
478 	BString defaultBackgroundImage("/HAIKU logo - white on blue - big.png");
479 #if 0
480 	BString defaultBackgroundTexture("/backgroundTexture.tga");
481 
482 	BNode node;
483 	if (BContainerWindow::DefaultStateSourceNode(kDefaultFolderTemplate, &node, true)) {
484 		// install a default background texture for folders in icon view mode
485 		InstallTemporaryBackgroundImagesIfNeeded(&node,
486 			(BString(path.Path()) << defaultBackgroundTexture).String(),
487 			BackgroundImage::kTiled,
488 			BPoint(0, 0), 0xffffffff, false);
489 	}
490 #endif
491 
492 	BDirectory dir;
493 	if (FSGetBootDeskDir(&dir) == B_OK) {
494 		// install a default background if there is no background defined yet
495 		attr_info info;
496 		if (dir.GetAttrInfo(kBackgroundImageInfo, &info) != B_OK) {
497 			BScreen screen(B_MAIN_SCREEN_ID);
498 			BPoint logoPos;
499 			logoPos.x = floorf((screen.Frame().Width() - 605) * (sqrtf(5) - 1) / 2);
500 			logoPos.y = floorf((screen.Frame().Height() - 190) * 0.9);
501 			BMessage message;
502 			AddTemporaryBackgroundImages(&message,
503 				(BString(path.Path()) << defaultBackgroundImage).String(),
504 				BackgroundImage::kAtOffset,
505 				logoPos, 0xffffffff, false);
506 			::InstallTemporaryBackgroundImages(&dir, &message);
507 		}
508 	}
509 }
510 
511 
512 // the following templates are in big endian and we rely on the Tracker
513 // translation support to swap them on little endian machines
514 //
515 // in case there is an attribute (B_RECT_TYPE) that gets swapped by the media (unzip,
516 // file system endianness swapping, etc., the correct endianness for the
517 // correct machine has to be used here
518 
519 const BRect kDefaultFrame(40, 40, 500, 350);
520 
521 const AttributeTemplate kDefaultQueryTemplate[] =
522 	/* /boot/home/config/settings/Tracker/DefaultQueryTemplates/application_octet-stream */
523 {
524 	{		 /* default frame */
525 		kAttrWindowFrame,
526 		B_RECT_TYPE,
527 		16,
528 		(const char *)&kDefaultFrame
529 	},
530 	{		 /* attr: _trk/viewstate */
531 		kAttrViewState_be,
532 		B_RAW_TYPE,
533 		49,
534 		"o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
535 		"\000\000\000\000\000\000\000\000\000\000\357\323\335RCSTR\000\000\000"
536 		"\000\000\000\000\000\000"
537 	},
538 	{		 /* attr: _trk/columns */
539 		kAttrColumns_be,
540 		B_RAW_TYPE,
541 		223,
542 		"O\362VR\000\000\000\025\000\000\000\004Name\000B \000\000C\021\000"
543 		"\000\000\000\000\000\000\000\000\012_stat/name\000\357\323\335RCST"
544 		"R\001\001O\362VR\000\000\000\025\000\000\000\004Path\000CH\000\000"
545 		"Ca\000\000\000\000\000\000\000\000\000\011_trk/path\000\357_\174RC"
546 		"STR\000\000O\362VR\000\000\000\025\000\000\000\004Size\000C\334\000"
547 		"\000B$\000\000\000\000\000\001\000\000\000\012_stat/size\000\317\317"
548 		"\306TOFFT\001\000O\362VR\000\000\000\025\000\000\000\010Modified\000"
549 		"C\370\000\000C\012\000\000\000\000\000\000\000\000\000\016_stat/mo"
550 		"dified\000]KmETIME\001\000"
551 	}
552 };
553 
554 const AttributeTemplate kBookmarkQueryTemplate[] =
555 	/* /boot/home/config/settings/Tracker/DefaultQueryTemplates/application_x-vnd.Be-bookmark */
556 {
557 	{		 /* default frame */
558 		kAttrWindowFrame,
559 		B_RECT_TYPE,
560 		16,
561 		(const char *)&kDefaultFrame
562 	},
563 	{		 /* attr: _trk/viewstate */
564 		kAttrViewState_be,
565 		B_RAW_TYPE,
566 		49,
567 		"o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
568 		"\000\000\000\000\000\000\000\000\000\000w\373\175RCSTR\000\000\000"
569 		"\000\000\000\000\000\000"
570 	},
571 	{		 /* attr: _trk/columns */
572 		kAttrColumns_be,
573 		B_RAW_TYPE,
574 		163,
575 		"O\362VR\000\000\000\025\000\000\000\005Title\000B \000\000C+\000\000"
576 		"\000\000\000\000\000\000\000\012META:title\000w\373\175RCSTR\000\001"
577 		"O\362VR\000\000\000\025\000\000\000\003URL\000Cb\000\000C\217\200\000"
578 		"\000\000\000\000\000\000\000\010META:url\000\343[TRCSTR\000\001O\362"
579 		"VR\000\000\000\025\000\000\000\010Keywords\000D\004\000\000C\002\000"
580 		"\000\000\000\000\000\000\000\000\011META:keyw\000\333\363\334RCSTR"
581 		"\000\001"
582 	}
583 };
584 
585 const AttributeTemplate kPersonQueryTemplate[] =
586 	/* /boot/home/config/settings/Tracker/DefaultQueryTemplates/application_x-vnd.Be-bookmark */
587 {
588 	{		 /* default frame */
589 		kAttrWindowFrame,
590 		B_RECT_TYPE,
591 		16,
592 		(const char *)&kDefaultFrame
593 	},
594 	{		 /* attr: _trk/viewstate */
595 		kAttrViewState_be,
596 		B_RAW_TYPE,
597 		49,
598 		"o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
599 		"\000\000\000\000\000\000\000\000\000\000\357\323\335RCSTR\000\000\000"
600 		"\000\000\000\000\000\000"
601 	},
602 	{		 /* attr: _trk/columns */
603 		kAttrColumns_be,
604 		B_RAW_TYPE,
605 		230,
606 		"O\362VR\000\000\000\025\000\000\000\004Name\000B \000\000B\346\000"
607 		"\000\000\000\000\000\000\000\000\012_stat/name\000\357\323\335RCST"
608 		"R\001\001O\362VR\000\000\000\025\000\000\000\012Work Phone\000C*\000"
609 		"\000B\264\000\000\000\000\000\000\000\000\000\013META:wphone\000C_"
610 		"uRCSTR\000\001O\362VR\000\000\000\025\000\000\000\006E-mail\000C\211"
611 		"\200\000B\272\000\000\000\000\000\000\000\000\000\012META:email\000"
612 		"sW\337RCSTR\000\001O\362VR\000\000\000\025\000\000\000\007Company\000"
613 		"C\277\200\000B\360\000\000\000\000\000\000\000\000\000\014META:com"
614 		"pany\000CS\174RCSTR\000\001"
615 	},
616 };
617 
618 const AttributeTemplate kEmailQueryTemplate[] =
619 	/* /boot/home/config/settings/Tracker/DefaultQueryTemplates/text_x-email */
620 {
621 	{		 /* default frame */
622 		kAttrWindowFrame,
623 		B_RECT_TYPE,
624 		16,
625 		(const char *)&kDefaultFrame
626 	},
627 	{		 /* attr: _trk/viewstate */
628 		kAttrViewState_be,
629 		B_RAW_TYPE,
630 		49,
631 		"o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
632 		"\000\000\000\000\000\000\000\000\000\000\366_\377ETIME\000\000\000"
633 		"\000\000\000\000\000\000"
634 	},
635 	{		 /* attr: _trk/columns */
636 		kAttrColumns_be,
637 		B_RAW_TYPE,
638 		222,
639 		"O\362VR\000\000\000\025\000\000\000\007Subject\000B \000\000B\334\000"
640 		"\000\000\000\000\000\000\000\000\014MAIL:subject\000\343\173\337RC"
641 		"STR\000\000O\362VR\000\000\000\025\000\000\000\004From\000C%\000\000"
642 		"C\031\000\000\000\000\000\000\000\000\000\011MAIL:from\000\317s_RC"
643 		"STR\000\000O\362VR\000\000\000\025\000\000\000\004When\000C\246\200"
644 		"\000B\360\000\000\000\000\000\000\000\000\000\011MAIL:when\000\366"
645 		"_\377ETIME\000\000O\362VR\000\000\000\025\000\000\000\006Status\000"
646 		"C\352\000\000BH\000\000\000\000\000\001\000\000\000\013MAIL:status"
647 		"\000G\363\134RCSTR\000\001"
648 	},
649 };
650 
651