6 Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
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:
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.
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.
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.
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.
36 // add code to initialize a subset of the mime database, including
37 // important sniffer rules
42 #include <Directory.h>
43 #include <InterfaceDefs.h>
49 #include <VolumeRoster.h>
54 #include "pr_server.h"
56 #include "Attributes.h"
57 #include "AttributeStream.h"
58 #include "BackgroundImage.h"
60 #include "ContainerWindow.h"
61 #include "MimeTypes.h"
63 #include "QueryContainerWindow.h"
68 kForceLargeIcon
= 0x1,
70 kForceShortDescription
= 0x4,
71 kForceLongDescription
= 0x8,
72 kForcePreferredApp
= 0x10
76 const char* kAttrName
= "META:name";
77 const char* kAttrCompany
= "META:company";
78 const char* kAttrAddress
= "META:address";
79 const char* kAttrCity
= "META:city";
80 const char* kAttrState
= "META:state";
81 const char* kAttrZip
= "META:zip";
82 const char* kAttrCountry
= "META:country";
83 const char* kAttrHomePhone
= "META:hphone";
84 const char* kAttrWorkPhone
= "META:wphone";
85 const char* kAttrFax
= "META:fax";
86 const char* kAttrEmail
= "META:email";
87 const char* kAttrURL
= "META:url";
88 const char* kAttrGroup
= "META:group";
89 const char* kAttrNickname
= "META:nickname";
91 const char* kNetPositiveSignature
= "application/x-vnd.Be-NPOS";
92 const char* kPeopleSignature
= "application/x-vnd.Be-PEPL";
94 // the following templates are in big endian and we rely on the Tracker
95 // translation support to swap them on little endian machines
97 // in case there is an attribute (B_RECT_TYPE) that gets swapped by the media
98 // (unzip, file system endianness swapping, etc., the correct endianness for
99 // the correct machine has to be used here
101 const BRect
kDefaultFrame(40, 40, 695, 350);
102 const int32 kDefaultQueryTemplateCount
= 3;
104 const AttributeTemplate kDefaultQueryTemplate
[] =
105 /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/
106 application_octet-stream */
113 (const char*)&kDefaultFrame
116 // attr: _trk/viewstate
120 "o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
121 "\000\000\000\000\000\000\000\000\000\000\357\323\335RCSTR\000\000"
122 "\000\000\000\000\000\000\000"
125 // attr: _trk/columns
129 "O\362VR\000\000\000\025\000\000\000\004Name\000B \000\000C\021\000"
130 "\000\000\000\000\000\000\000\000\012_stat/name\000\357\323\335RCST"
131 "R\001\001O\362VR\000\000\000\025\000\000\000\004Path\000CH\000\000"
132 "Ca\000\000\000\000\000\000\000\000\000\011_trk/path\000\357_\174RC"
133 "STR\000\000O\362VR\000\000\000\025\000\000\000\004Size\000C\334\000"
134 "\000B$\000\000\000\000\000\001\000\000\000\012_stat/size\000\317\317"
135 "\306TOFFT\001\000O\362VR\000\000\000\025\000\000\000\010Modified\000"
136 "C\370\000\000C\012\000\000\000\000\000\000\000\000\000\016_stat/mo"
137 "dified\000]KmETIME\001\000"
142 const AttributeTemplate kBookmarkQueryTemplate
[] =
143 /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/
144 application_x-vnd.Be-bookmark */
151 (const char*)&kDefaultFrame
154 // attr: _trk/viewstate
158 "o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
159 "\000\000\000\000\000\000\000\000\000\000w\373\175RCSTR\000\000\000"
160 "\000\000\000\000\000\000"
163 // attr: _trk/columns
167 "O\362VR\000\000\000\025\000\000\000\005Title\000B \000\000C+\000\000"
168 "\000\000\000\000\000\000\000\012META:title\000w\373\175RCSTR\000\001"
169 "O\362VR\000\000\000\025\000\000\000\003URL\000Cb\000\000C\217\200"
170 "\000\000\000\000\000\000\000\000\010META:url\000\343[TRCSTR\000\001O"
171 "\362VR\000\000\000\025\000\000\000\010Keywords\000D\004\000\000C\002"
172 "\000\000\000\000\000\000\000\000\000\011META:keyw\000\333\363\334"
178 const AttributeTemplate kPersonQueryTemplate
[] =
179 /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/
180 application_x-vnd.Be-bookmark */
187 (const char*)&kDefaultFrame
190 // attr: _trk/viewstate
194 "o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
195 "\000\000\000\000\000\000\000\000\000\000\357\323\335RCSTR\000\000"
196 "\000\000\000\000\000\000\000"
199 // attr: _trk/columns
203 "O\362VR\000\000\000\025\000\000\000\004Name\000B \000\000B\346\000"
204 "\000\000\000\000\000\000\000\000\012_stat/name\000\357\323\335RCST"
205 "R\001\001O\362VR\000\000\000\025\000\000\000\012Work Phone\000C*\000"
206 "\000B\264\000\000\000\000\000\000\000\000\000\013META:wphone\000C_"
207 "uRCSTR\000\001O\362VR\000\000\000\025\000\000\000\006E-mail\000C\211"
208 "\200\000B\272\000\000\000\000\000\000\000\000\000\012META:email\000"
209 "sW\337RCSTR\000\001O\362VR\000\000\000\025\000\000\000\007Company"
210 "\000C\277\200\000B\360\000\000\000\000\000\000\000\000\000\014"
211 "META:company\000CS\174RCSTR\000\001"
216 const AttributeTemplate kEmailQueryTemplate
[] =
217 /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/
225 (const char*)&kDefaultFrame
228 // attr: _trk/viewstate
232 "o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
233 "\000\000\000\000\000\000\000\000\000\000\366_\377ETIME\000\000\000"
234 "\000\000\000\000\000\000"
237 // attr: _trk/columns
241 "O\362VR\000\000\000\025\000\000\000\007Subject\000B \000\000B\334"
242 "\000\000\000\000\000\000\000\000\000\014MAIL:subject\000\343\173\337"
243 "RCSTR\000\000O\362VR\000\000\000\025\000\000\000\004From\000C%\000"
244 "\000C\031\000\000\000\000\000\000\000\000\000\011MAIL:from\000\317"
245 "s_RCSTR\000\000O\362VR\000\000\000\025\000\000\000\004When\000C\246"
246 "\200\000B\360\000\000\000\000\000\000\000\000\000\011MAIL:when\000"
247 "\366_\377ETIME\000\000O\362VR\000\000\000\025\000\000\000\006Status"
248 "\000C\352\000\000BH\000\000\000\000\000\001\000\000\000\013"
249 "MAIL:status\000G\363\134RCSTR\000\001"
256 class ExtraAttributeLazyInstaller
{
258 ExtraAttributeLazyInstaller(const char* type
);
259 ~ExtraAttributeLazyInstaller();
261 bool AddExtraAttribute(const char* publicName
, const char* name
,
262 uint32 type
, bool viewable
, bool editable
, float width
,
263 int32 alignment
, bool extra
);
265 status_t
InitCheck() const;
269 BMessage fExtraAttrs
;
273 } // namespace BPrivate
276 // #pragma mark - ExtraAttributeLazyInstaller
279 ExtraAttributeLazyInstaller::ExtraAttributeLazyInstaller(const char* type
)
284 if (fMimeType
.InitCheck() != B_OK
285 || fMimeType
.GetAttrInfo(&fExtraAttrs
) != B_OK
) {
286 fExtraAttrs
= BMessage();
291 ExtraAttributeLazyInstaller::~ExtraAttributeLazyInstaller()
293 if (fMimeType
.InitCheck() == B_OK
&& fDirty
294 && fMimeType
.SetAttrInfo(&fExtraAttrs
) != B_OK
) {
295 fExtraAttrs
= BMessage();
301 ExtraAttributeLazyInstaller::AddExtraAttribute(const char* publicName
,
302 const char* name
, uint32 type
, bool viewable
, bool editable
, float width
,
303 int32 alignment
, bool extra
)
305 for (int32 index
= 0; ; index
++) {
306 const char* oldPublicName
;
307 if (fExtraAttrs
.FindString("attr:public_name", index
, &oldPublicName
)
312 if (strcmp(oldPublicName
, publicName
) == 0)
313 // already got this extra atribute, no work left
317 fExtraAttrs
.AddString("attr:public_name", publicName
);
318 fExtraAttrs
.AddString("attr:name", name
);
319 fExtraAttrs
.AddInt32("attr:type", (int32
)type
);
320 fExtraAttrs
.AddBool("attr:viewable", viewable
);
321 fExtraAttrs
.AddBool("attr:editable", editable
);
322 fExtraAttrs
.AddInt32("attr:width", (int32
)width
);
323 fExtraAttrs
.AddInt32("attr:alignment", alignment
);
324 fExtraAttrs
.AddBool("attr:extra", extra
);
331 // #pragma mark - static functions
335 InstallTemporaryBackgroundImages(BNode
* node
, BMessage
* message
)
337 ssize_t size
= message
->FlattenedSize();
339 ThrowIfNotSize(size
);
340 char* buffer
= new char[(size_t)size
];
341 message
->Flatten(buffer
, size
);
342 node
->WriteAttr(kBackgroundImageInfo
, B_MESSAGE_TYPE
, 0, buffer
,
352 AddTemporaryBackgroundImages(BMessage
* message
, const char* imagePath
,
353 BackgroundImage::Mode mode
, BPoint offset
, uint32 workspaces
,
354 bool textWidgetOutlines
)
356 message
->AddString(kBackgroundImageInfoPath
, imagePath
);
357 message
->AddInt32(kBackgroundImageInfoWorkspaces
, (int32
)workspaces
);
358 message
->AddInt32(kBackgroundImageInfoMode
, mode
);
359 message
->AddBool(kBackgroundImageInfoTextOutline
, textWidgetOutlines
);
360 message
->AddPoint(kBackgroundImageInfoOffset
, offset
);
364 // #pragma mark - TrackerInitialState
367 #undef B_TRANSLATION_CONTEXT
368 #define B_TRANSLATION_CONTEXT "TrackerInitialState"
372 TTracker::InstallMimeIfNeeded(const char* type
, int32 bitsID
,
373 const char* shortDescription
, const char* longDescription
,
374 const char* preferredAppSignature
, uint32 forceMask
)
376 // used by InitMimeTypes - checks if a metamime of a given <type> is
377 // installed and if it has all the specified attributes; if not, the
378 // whole mime type is installed and all attributes are set; nulls can
379 // be passed for attributes that don't matter; returns true if anything
382 BBitmap
vectorIcon(BRect(0, 0, 31, 31), B_BITMAP_NO_SERVER_LINK
,
384 BBitmap
largeIcon(BRect(0, 0, 31, 31), B_BITMAP_NO_SERVER_LINK
, B_CMAP8
);
385 BBitmap
miniIcon(BRect(0, 0, 15, 15), B_BITMAP_NO_SERVER_LINK
, B_CMAP8
);
386 char tmp
[B_MIME_TYPE_LENGTH
];
388 BMimeType
mime(type
);
389 bool installed
= mime
.IsInstalled();
392 || (bitsID
>= 0 && ((forceMask
& kForceLargeIcon
)
393 || mime
.GetIcon(&vectorIcon
, B_LARGE_ICON
) != B_OK
))
394 || (bitsID
>= 0 && ((forceMask
& kForceLargeIcon
)
395 || mime
.GetIcon(&largeIcon
, B_LARGE_ICON
) != B_OK
))
396 || (bitsID
>= 0 && ((forceMask
& kForceMiniIcon
)
397 || mime
.GetIcon(&miniIcon
, B_MINI_ICON
) != B_OK
))
398 || (shortDescription
&& ((forceMask
& kForceShortDescription
)
399 || mime
.GetShortDescription(tmp
) != B_OK
))
400 || (longDescription
&& ((forceMask
& kForceLongDescription
)
401 || mime
.GetLongDescription(tmp
) != B_OK
))
402 || (preferredAppSignature
&& ((forceMask
& kForcePreferredApp
)
403 || mime
.GetPreferredApp(tmp
) != B_OK
))) {
409 const uint8
* iconData
;
411 if (GetTrackerResources()->
412 GetIconResource(bitsID
, &iconData
, &iconSize
) == B_OK
)
413 mime
.SetIcon(iconData
, iconSize
);
415 if (GetTrackerResources()->
416 GetIconResource(bitsID
, B_LARGE_ICON
, &largeIcon
) == B_OK
)
417 mime
.SetIcon(&largeIcon
, B_LARGE_ICON
);
419 if (GetTrackerResources()->
420 GetIconResource(bitsID
, B_MINI_ICON
, &miniIcon
) == B_OK
)
421 mime
.SetIcon(&miniIcon
, B_MINI_ICON
);
424 if (shortDescription
)
425 mime
.SetShortDescription(shortDescription
);
428 mime
.SetLongDescription(longDescription
);
430 if (preferredAppSignature
)
431 mime
.SetPreferredApp(preferredAppSignature
);
440 TTracker::InitMimeTypes()
442 InstallMimeIfNeeded(B_APP_MIME_TYPE
, R_AppIcon
, "Be Application",
443 "Generic Be application executable.", kTrackerSignature
);
445 InstallMimeIfNeeded(B_FILE_MIMETYPE
, R_FileIcon
,
446 "Generic file", "Generic document file.", kTrackerSignature
);
448 InstallMimeIfNeeded(B_VOLUME_MIMETYPE
, R_HardDiskIcon
,
449 "Be Volume", "Disk volume.", kTrackerSignature
);
451 InstallMimeIfNeeded(B_QUERY_MIMETYPE
, R_QueryDirIcon
,
452 "Be Query", "Query to locate items on disks.", kTrackerSignature
);
454 InstallMimeIfNeeded(B_QUERY_TEMPLATE_MIMETYPE
, R_QueryTemplateIcon
,
455 "Be Query template", "", kTrackerSignature
);
457 InstallMimeIfNeeded(B_LINK_MIMETYPE
, R_BrokenLinkIcon
, "Symbolic link",
458 "Link to another item in the file system.", kTrackerSignature
);
460 InstallMimeIfNeeded(B_ROOT_MIMETYPE
, R_RootIcon
,
461 "Be Root", "File system root.", kTrackerSignature
);
463 InstallMimeIfNeeded(B_BOOKMARK_MIMETYPE
, R_BookmarkIcon
,
464 "Bookmark", "Bookmark for a web page.", kNetPositiveSignature
);
467 // install a couple of extra fields for bookmark
469 ExtraAttributeLazyInstaller
installer(B_BOOKMARK_MIMETYPE
);
470 installer
.AddExtraAttribute("URL", "META:url", B_STRING_TYPE
,
471 true, true, 170, B_ALIGN_LEFT
, false);
472 installer
.AddExtraAttribute("Keywords", "META:keyw", B_STRING_TYPE
,
473 true, true, 130, B_ALIGN_LEFT
, false);
474 installer
.AddExtraAttribute("Title", "META:title", B_STRING_TYPE
,
475 true, true, 130, B_ALIGN_LEFT
, false);
478 InstallMimeIfNeeded(B_PERSON_MIMETYPE
, R_PersonIcon
,
479 "Person", "Contact information for a person.", kPeopleSignature
);
482 ExtraAttributeLazyInstaller
installer(B_PERSON_MIMETYPE
);
483 installer
.AddExtraAttribute("Contact name", kAttrName
, B_STRING_TYPE
,
484 true, true, 120, B_ALIGN_LEFT
, false);
485 installer
.AddExtraAttribute("Company", kAttrCompany
, B_STRING_TYPE
,
486 true, true, 120, B_ALIGN_LEFT
, false);
487 installer
.AddExtraAttribute("Address", kAttrAddress
, B_STRING_TYPE
,
488 true, true, 120, B_ALIGN_LEFT
, false);
489 installer
.AddExtraAttribute("City", kAttrCity
, B_STRING_TYPE
,
490 true, true, 90, B_ALIGN_LEFT
, false);
491 installer
.AddExtraAttribute("State", kAttrState
, B_STRING_TYPE
,
492 true, true, 50, B_ALIGN_LEFT
, false);
493 installer
.AddExtraAttribute("Zip", kAttrZip
, B_STRING_TYPE
,
494 true, true, 50, B_ALIGN_LEFT
, false);
495 installer
.AddExtraAttribute("Country", kAttrCountry
, B_STRING_TYPE
,
496 true, true, 120, B_ALIGN_LEFT
, false);
497 installer
.AddExtraAttribute("E-mail", kAttrEmail
, B_STRING_TYPE
,
498 true, true, 120, B_ALIGN_LEFT
, false);
499 installer
.AddExtraAttribute("Home phone", kAttrHomePhone
,
500 B_STRING_TYPE
, true, true, 90, B_ALIGN_LEFT
, false);
501 installer
.AddExtraAttribute("Work phone", kAttrWorkPhone
,
502 B_STRING_TYPE
, true, true, 90, B_ALIGN_LEFT
, false);
503 installer
.AddExtraAttribute("Fax", kAttrFax
, B_STRING_TYPE
,
504 true, true, 90, B_ALIGN_LEFT
, false);
505 installer
.AddExtraAttribute("URL", kAttrURL
, B_STRING_TYPE
,
506 true, true, 120, B_ALIGN_LEFT
, false);
507 installer
.AddExtraAttribute("Group", kAttrGroup
, B_STRING_TYPE
,
508 true, true, 120, B_ALIGN_LEFT
, false);
509 installer
.AddExtraAttribute("Nickname", kAttrNickname
, B_STRING_TYPE
,
510 true, true, 120, B_ALIGN_LEFT
, false);
513 InstallMimeIfNeeded(B_PRINTER_SPOOL_MIMETYPE
, R_SpoolFileIcon
,
514 "Printer spool", "Printer spool file.", "application/x-vnd.Be-PRNT");
517 #if B_BEOS_VERSION_DANO
518 ExtraAttributeLazyInstaller
installer(B_PRINTER_SPOOL_MIMETYPE
);
519 installer
.AddExtraAttribute("Status", PSRV_SPOOL_ATTR_STATUS
,
520 B_STRING_TYPE
, true, false, 60, B_ALIGN_LEFT
, false);
521 installer
.AddExtraAttribute("Page count", PSRV_SPOOL_ATTR_PAGECOUNT
,
522 B_INT32_TYPE
, true, false, 40, B_ALIGN_RIGHT
, false);
523 installer
.AddExtraAttribute("Description",
524 PSRV_SPOOL_ATTR_DESCRIPTION
, B_STRING_TYPE
, true, true, 100,
525 B_ALIGN_LEFT
, false);
526 installer
.AddExtraAttribute("Printer name", PSRV_SPOOL_ATTR_PRINTER
,
527 B_STRING_TYPE
, true, false, 80, B_ALIGN_LEFT
, false);
528 installer
.AddExtraAttribute("Job creator type",
529 PSRV_SPOOL_ATTR_MIMETYPE
, B_ASCII_TYPE
, true, false, 60,
530 B_ALIGN_LEFT
, false);
532 ExtraAttributeLazyInstaller
installer(B_PRINTER_SPOOL_MIMETYPE
);
533 installer
.AddExtraAttribute("Page count", "_spool/Page Count",
534 B_INT32_TYPE
, true, false, 40, B_ALIGN_RIGHT
, false);
535 installer
.AddExtraAttribute("Description", "_spool/Description",
536 B_ASCII_TYPE
, true, true, 100, B_ALIGN_LEFT
, false);
537 installer
.AddExtraAttribute("Printer name", "_spool/Printer",
538 B_ASCII_TYPE
, true, false, 80, B_ALIGN_LEFT
, false);
539 installer
.AddExtraAttribute("Job creator type", "_spool/MimeType",
540 B_ASCII_TYPE
, true, false, 60, B_ALIGN_LEFT
, false);
544 InstallMimeIfNeeded(B_PRINTER_MIMETYPE
, R_GenericPrinterIcon
,
545 "Printer", "Printer queue.", kTrackerSignature
);
546 // application/x-vnd.Be-PRNT
547 // for now set tracker as a default handler for the printer because we
548 // just want to open it as a folder
549 #if B_BEOS_VERSION_DANO
551 ExtraAttributeLazyInstaller
installer(B_PRINTER_MIMETYPE
);
552 installer
.AddExtraAttribute("Driver", PSRV_PRINTER_ATTR_DRV_NAME
,
553 B_STRING_TYPE
, true, false, 120, B_ALIGN_LEFT
, false);
554 installer
.AddExtraAttribute("Transport",
555 PSRV_PRINTER_ATTR_TRANSPORT
, B_STRING_TYPE
, true, false,
556 60, B_ALIGN_RIGHT
, false);
557 installer
.AddExtraAttribute("Connection",
558 PSRV_PRINTER_ATTR_CNX
, B_STRING_TYPE
, true, false,
559 40, B_ALIGN_LEFT
, false);
560 installer
.AddExtraAttribute("Description",
561 PSRV_PRINTER_ATTR_COMMENTS
, B_STRING_TYPE
, true, true,
562 140, B_ALIGN_LEFT
, false);
569 TTracker::InstallIndices()
571 BVolumeRoster roster
;
575 while (roster
.GetNextVolume(&volume
) == B_OK
) {
576 if (volume
.IsReadOnly() || !volume
.IsPersistent()
577 || !volume
.KnowsAttr() || !volume
.KnowsQuery())
579 InstallIndices(volume
.Device());
585 TTracker::InstallIndices(dev_t device
)
587 fs_create_index(device
, kAttrQueryLastChange
, B_INT32_TYPE
, 0);
588 fs_create_index(device
, "_trk/recentQuery", B_INT32_TYPE
, 0);
593 TTracker::InstallDefaultTemplates()
596 BString
query(kQueryTemplates
);
597 query
+= "/application_octet-stream";
599 if (!BContainerWindow::DefaultStateSourceNode(query
.String(),
601 if (BContainerWindow::DefaultStateSourceNode(query
.String(),
603 AttributeStreamFileNode
fileNode(&node
);
604 AttributeStreamTemplateNode
tmp(kDefaultQueryTemplate
, 3);
609 (query
= kQueryTemplates
) += "/application_x-vnd.Be-bookmark";
610 if (!BContainerWindow::DefaultStateSourceNode(query
.String(),
612 if (BContainerWindow::DefaultStateSourceNode(query
.String(),
614 AttributeStreamFileNode
fileNode(&node
);
615 AttributeStreamTemplateNode
tmp(kBookmarkQueryTemplate
, 3);
620 (query
= kQueryTemplates
) += "/application_x-person";
621 if (!BContainerWindow::DefaultStateSourceNode(query
.String(),
623 if (BContainerWindow::DefaultStateSourceNode(query
.String(),
625 AttributeStreamFileNode
fileNode(&node
);
626 AttributeStreamTemplateNode
tmp(kPersonQueryTemplate
, 3);
631 (query
= kQueryTemplates
) += "/text_x-email";
632 if (!BContainerWindow::DefaultStateSourceNode(query
.String(),
634 if (BContainerWindow::DefaultStateSourceNode(query
.String(),
636 AttributeStreamFileNode
fileNode(&node
);
637 AttributeStreamTemplateNode
tmp(kEmailQueryTemplate
, 3);
645 TTracker::InstallTemporaryBackgroundImages()
647 // make the large Haiku Logo the default background
650 status_t status
= find_directory(B_SYSTEM_DATA_DIRECTORY
, &path
);
652 // TODO: this error shouldn't be shown to the regular user
653 BString
errorMessage(B_TRANSLATE("At %func \nfind_directory() "
654 "failed. \nReason: %error"));
655 errorMessage
.ReplaceFirst("%func", __PRETTY_FUNCTION__
);
656 errorMessage
.ReplaceFirst("%error", strerror(status
));
657 BAlert
* alert
= new BAlert("AlertError", errorMessage
.String(),
658 B_TRANSLATE("OK"), NULL
, NULL
, B_WIDTH_AS_USUAL
, B_STOP_ALERT
);
659 alert
->SetFlags(alert
->Flags() | B_CLOSE_ON_ESCAPE
);
663 path
.Append("artwork");
665 BString
defaultBackgroundImage("/HAIKU logo - white on blue - big.png");
668 if (FSGetBootDeskDir(&dir
) == B_OK
) {
669 // install a default background if there is no background defined yet
671 if (dir
.GetAttrInfo(kBackgroundImageInfo
, &info
) != B_OK
) {
672 BScreen
screen(B_MAIN_SCREEN_ID
);
675 = floorf((screen
.Frame().Width() - 605) * (sqrtf(5) - 1) / 2);
676 logoPos
.y
= floorf((screen
.Frame().Height() - 190) * 0.9);
678 AddTemporaryBackgroundImages(&message
,
679 (BString(path
.Path()) << defaultBackgroundImage
).String(),
680 BackgroundImage::kAtOffset
, logoPos
, 0xffffffff, false);
681 ::InstallTemporaryBackgroundImages(&dir
, &message
);