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 <Directory.h> 40 #include <InterfaceDefs.h> 41 #include <Message.h> 42 #include <Node.h> 43 #include <Path.h> 44 #include <VolumeRoster.h> 45 46 #include <fs_attr.h> 47 #include <fs_index.h> 48 49 #include "pr_server.h" 50 51 #include "Attributes.h" 52 #include "AttributeStream.h" 53 #include "BackgroundImage.h" 54 #include "Bitmaps.h" 55 #include "ContainerWindow.h" 56 #include "MimeTypes.h" 57 #include "FSUtils.h" 58 #include "QueryContainerWindow.h" 59 #include "Tracker.h" 60 61 enum { 62 kForceLargeIcon = 0x1, 63 kForceMiniIcon = 0x2, 64 kForceShortDescription = 0x4, 65 kForceLongDescription = 0x8, 66 kForcePreferredApp = 0x10 67 }; 68 69 70 const char *kAttrName = "META:name"; 71 const char *kAttrCompany = "META:company"; 72 const char *kAttrAddress = "META:address"; 73 const char *kAttrCity = "META:city"; 74 const char *kAttrState = "META:state"; 75 const char *kAttrZip = "META:zip"; 76 const char *kAttrCountry = "META:country"; 77 const char *kAttrHomePhone = "META:hphone"; 78 const char *kAttrWorkPhone = "META:wphone"; 79 const char *kAttrFax = "META:fax"; 80 const char *kAttrEmail = "META:email"; 81 const char *kAttrURL = "META:url"; 82 const char *kAttrGroup = "META:group"; 83 const char *kAttrNickname = "META:nickname"; 84 85 const char *kNetPositiveSignature = "application/x-vnd.Be-NPOS"; 86 const char *kPeopleSignature = "application/x-vnd.Be-PEPL"; 87 88 namespace BPrivate { 89 90 class ExtraAttributeLazyInstaller { 91 public: 92 ExtraAttributeLazyInstaller(const char *type); 93 ~ExtraAttributeLazyInstaller(); 94 95 bool AddExtraAttribute(const char *publicName, const char *name, 96 uint32 type, bool viewable, bool editable, float width, 97 int32 alignment, bool extra); 98 99 status_t InitCheck() const; 100 public: 101 BMimeType fMimeType; 102 BMessage fExtraAttrs; 103 bool fDirty; 104 }; 105 106 } 107 108 ExtraAttributeLazyInstaller::ExtraAttributeLazyInstaller(const char *type) 109 : fMimeType(type), 110 fDirty(false) 111 { 112 if (fMimeType.InitCheck() == B_OK) 113 fMimeType.GetAttrInfo(&fExtraAttrs); 114 } 115 116 117 ExtraAttributeLazyInstaller::~ExtraAttributeLazyInstaller() 118 { 119 if (fMimeType.InitCheck() == B_OK && fDirty) 120 fMimeType.SetAttrInfo(&fExtraAttrs); 121 } 122 123 bool 124 ExtraAttributeLazyInstaller::AddExtraAttribute(const char *publicName, const char *name, 125 uint32 type, bool viewable, bool editable, float width, int32 alignment, 126 bool extra) 127 { 128 for (int32 index = 0; ; index++) { 129 const char *oldPublicName; 130 if (fExtraAttrs.FindString("attr:public_name", index, &oldPublicName) != B_OK) 131 break; 132 133 if (strcmp(oldPublicName, publicName) == 0) 134 // already got this extra atribute, no work left 135 return false; 136 } 137 138 fExtraAttrs.AddString("attr:public_name", publicName); 139 fExtraAttrs.AddString("attr:name", name); 140 fExtraAttrs.AddInt32("attr:type", (int32)type); 141 fExtraAttrs.AddBool("attr:viewable", viewable); 142 fExtraAttrs.AddBool("attr:editable", editable); 143 fExtraAttrs.AddInt32("attr:width", (int32)width); 144 fExtraAttrs.AddInt32("attr:alignment", alignment); 145 fExtraAttrs.AddBool("attr:extra", extra); 146 147 fDirty = true; 148 return true; 149 } 150 151 152 bool 153 TTracker::InstallMimeIfNeeded(const char *type, int32 bitsID, 154 const char *shortDescription, const char *longDescription, 155 const char *preferredAppSignature, uint32 forceMask) 156 { 157 // used by InitMimeTypes - checks if a metamime of a given <type> is 158 // installed and if it has all the specified attributes; if not, the 159 // whole mime type is installed and all attributes are set; nulls can 160 // be passed for attributes that don't matter; returns true if anything 161 // had to be changed 162 163 #ifndef __HAIKU__ 164 # define B_BITMAP_NO_SERVER_LINK 0 165 #endif 166 167 #ifdef __HAIKU__ 168 BBitmap vectorIcon(BRect(0, 0, 31, 31), B_BITMAP_NO_SERVER_LINK, B_RGB32); 169 #endif 170 BBitmap largeIcon(BRect(0, 0, 31, 31), B_BITMAP_NO_SERVER_LINK, B_CMAP8); 171 BBitmap miniIcon(BRect(0, 0, 15, 15), B_BITMAP_NO_SERVER_LINK, B_CMAP8); 172 char tmp[B_MIME_TYPE_LENGTH]; 173 174 BMimeType mime(type); 175 bool installed = mime.IsInstalled(); 176 177 if (!installed 178 #ifdef __HAIKU__ 179 || (bitsID >= 0 && ((forceMask & kForceLargeIcon) 180 || mime.GetIcon(&vectorIcon, B_LARGE_ICON) != B_OK)) 181 #endif 182 || (bitsID >= 0 && ((forceMask & kForceLargeIcon) 183 || mime.GetIcon(&largeIcon, B_LARGE_ICON) != B_OK)) 184 || (bitsID >= 0 && ((forceMask & kForceMiniIcon) 185 || mime.GetIcon(&miniIcon, B_MINI_ICON) != B_OK)) 186 || (shortDescription && ((forceMask & kForceShortDescription) 187 || mime.GetShortDescription(tmp) != B_OK)) 188 || (longDescription && ((forceMask & kForceLongDescription) 189 || mime.GetLongDescription(tmp) != B_OK)) 190 || (preferredAppSignature && ((forceMask & kForcePreferredApp) 191 || mime.GetPreferredApp(tmp) != B_OK))) { 192 193 if (!installed) 194 mime.Install(); 195 196 if (bitsID >= 0) { 197 #ifdef __HAIKU__ 198 const uint8* iconData; 199 size_t iconSize; 200 if (GetTrackerResources()-> 201 GetIconResource(bitsID, &iconData, &iconSize) == B_OK) 202 mime.SetIcon(iconData, iconSize); 203 #endif 204 205 if (GetTrackerResources()-> 206 GetIconResource(bitsID, B_LARGE_ICON, &largeIcon) == B_OK) 207 mime.SetIcon(&largeIcon, B_LARGE_ICON); 208 209 if (GetTrackerResources()-> 210 GetIconResource(bitsID, B_MINI_ICON, &miniIcon) == B_OK) 211 mime.SetIcon(&miniIcon, B_MINI_ICON); 212 } 213 214 if (shortDescription) 215 mime.SetShortDescription(shortDescription); 216 217 if (longDescription) 218 mime.SetLongDescription(longDescription); 219 220 if (preferredAppSignature) 221 mime.SetPreferredApp(preferredAppSignature); 222 223 return true; 224 } 225 return false; 226 } 227 228 void 229 TTracker::InitMimeTypes() 230 { 231 InstallMimeIfNeeded(B_DIR_MIMETYPE, kResFolderIcon, 232 "Folder", "Folder container for file system items.", kTrackerSignature); 233 234 InstallMimeIfNeeded(B_APP_MIME_TYPE, kResAppIcon, 235 "Be Application", "Generic Be Application executable.", kTrackerSignature); 236 237 InstallMimeIfNeeded(B_FILE_MIMETYPE, kResFileIcon, 238 "Generic file", "Generic document file.", kTrackerSignature); 239 240 InstallMimeIfNeeded(B_VOLUME_MIMETYPE, kResHardDiskIcon, 241 "Be Volume", "Disk volume.", kTrackerSignature); 242 243 InstallMimeIfNeeded(B_QUERY_MIMETYPE, kResQueryIcon, 244 "Be Query", "Query to locate items on disks.", kTrackerSignature); 245 246 InstallMimeIfNeeded(B_QUERY_TEMPLATE_MIMETYPE, kResQueryTemplateIcon, 247 "Be Query Template", "", kTrackerSignature); 248 249 InstallMimeIfNeeded(B_LINK_MIMETYPE, kResBrokenLinkIcon, 250 "Symbolic Link", "Link to another item in the file system.", kTrackerSignature); 251 252 InstallMimeIfNeeded(B_ROOT_MIMETYPE, kResBeBoxIcon, 253 "Be Root", "File system root.", kTrackerSignature); 254 255 InstallMimeIfNeeded(B_BOOKMARK_MIMETYPE, kResBookmarkIcon, 256 "Bookmark", "Bookmark for a web page.", kNetPositiveSignature); 257 258 { 259 // install a couple of extra fields for bookmark 260 261 ExtraAttributeLazyInstaller installer(B_BOOKMARK_MIMETYPE); 262 installer.AddExtraAttribute("URL", "META:url", B_STRING_TYPE, true, true, 263 170, B_ALIGN_LEFT, false); 264 installer.AddExtraAttribute("Keywords", "META:keyw", B_STRING_TYPE, true, true, 265 130, B_ALIGN_LEFT, false); 266 installer.AddExtraAttribute("Title", "META:title", B_STRING_TYPE, true, true, 267 130, B_ALIGN_LEFT, false); 268 } 269 270 InstallMimeIfNeeded(B_PERSON_MIMETYPE, kResPersonIcon, 271 "Person", "Contact information for a person.", kPeopleSignature); 272 273 { 274 ExtraAttributeLazyInstaller installer(B_PERSON_MIMETYPE); 275 installer.AddExtraAttribute("Contact Name", kAttrName, B_STRING_TYPE, true, true, 276 120, B_ALIGN_LEFT, false); 277 installer.AddExtraAttribute("Company", kAttrCompany, B_STRING_TYPE, true, true, 278 120, B_ALIGN_LEFT, false); 279 installer.AddExtraAttribute("Address", kAttrAddress, B_STRING_TYPE, true, true, 280 120, B_ALIGN_LEFT, false); 281 installer.AddExtraAttribute("City", kAttrCity, B_STRING_TYPE, true, true, 282 90, B_ALIGN_LEFT, false); 283 installer.AddExtraAttribute("State", kAttrState, B_STRING_TYPE, true, true, 284 50, B_ALIGN_LEFT, false); 285 installer.AddExtraAttribute("Zip", kAttrZip, B_STRING_TYPE, true, true, 286 50, B_ALIGN_LEFT, false); 287 installer.AddExtraAttribute("Country", kAttrCountry, B_STRING_TYPE, true, true, 288 120, B_ALIGN_LEFT, false); 289 installer.AddExtraAttribute("E-mail", kAttrEmail, B_STRING_TYPE, true, true, 290 120, B_ALIGN_LEFT, false); 291 installer.AddExtraAttribute("Home Phone", kAttrHomePhone, B_STRING_TYPE, true, true, 292 90, B_ALIGN_LEFT, false); 293 installer.AddExtraAttribute("Work Phone", kAttrWorkPhone, B_STRING_TYPE, true, true, 294 90, B_ALIGN_LEFT, false); 295 installer.AddExtraAttribute("Fax", kAttrFax, B_STRING_TYPE, true, true, 296 90, B_ALIGN_LEFT, false); 297 installer.AddExtraAttribute("URL", kAttrURL, B_STRING_TYPE, true, true, 298 120, B_ALIGN_LEFT, false); 299 installer.AddExtraAttribute("Group", kAttrGroup, B_STRING_TYPE, true, true, 300 120, B_ALIGN_LEFT, false); 301 installer.AddExtraAttribute("Nickname", kAttrNickname, B_STRING_TYPE, true, true, 302 120, B_ALIGN_LEFT, false); 303 } 304 305 InstallMimeIfNeeded(B_PRINTER_SPOOL_MIMETYPE, kResSpoolFileIcon, 306 "Printer spool", "Printer spool file.", "application/x-vnd.Be-PRNT"); 307 308 { 309 #if B_BEOS_VERSION_DANO 310 ExtraAttributeLazyInstaller installer(B_PRINTER_SPOOL_MIMETYPE); 311 installer.AddExtraAttribute("Status", PSRV_SPOOL_ATTR_STATUS, B_STRING_TYPE, true, false, 312 60, B_ALIGN_LEFT, false); 313 installer.AddExtraAttribute("Page Count", PSRV_SPOOL_ATTR_PAGECOUNT, B_INT32_TYPE, true, false, 314 40, B_ALIGN_RIGHT, false); 315 installer.AddExtraAttribute("Description", PSRV_SPOOL_ATTR_DESCRIPTION, B_STRING_TYPE, true, true, 316 100, B_ALIGN_LEFT, false); 317 installer.AddExtraAttribute("Printer Name", PSRV_SPOOL_ATTR_PRINTER, B_STRING_TYPE, true, false, 318 80, B_ALIGN_LEFT, false); 319 installer.AddExtraAttribute("Job creator type", PSRV_SPOOL_ATTR_MIMETYPE, B_ASCII_TYPE, true, false, 320 60, B_ALIGN_LEFT, false); 321 #else 322 ExtraAttributeLazyInstaller installer(B_PRINTER_SPOOL_MIMETYPE); 323 installer.AddExtraAttribute("Page Count", "_spool/Page Count", B_INT32_TYPE, true, false, 324 40, B_ALIGN_RIGHT, false); 325 installer.AddExtraAttribute("Description", "_spool/Description", B_ASCII_TYPE, true, true, 326 100, B_ALIGN_LEFT, false); 327 installer.AddExtraAttribute("Printer Name", "_spool/Printer", B_ASCII_TYPE, true, false, 328 80, B_ALIGN_LEFT, false); 329 installer.AddExtraAttribute("Job creator type", "_spool/MimeType", B_ASCII_TYPE, true, false, 330 60, B_ALIGN_LEFT, false); 331 #endif 332 } 333 334 InstallMimeIfNeeded(B_PRINTER_MIMETYPE, kResGenericPrinterIcon, 335 "Printer", "Printer queue.", kTrackerSignature /*application/x-vnd.Be-PRNT*/); 336 // for now set tracker as a default handler for the printer because we 337 // just want to open it as a folder 338 #if B_BEOS_VERSION_DANO 339 { 340 ExtraAttributeLazyInstaller installer(B_PRINTER_MIMETYPE); 341 installer.AddExtraAttribute("Driver", PSRV_PRINTER_ATTR_DRV_NAME, B_STRING_TYPE, true, false, 342 120, B_ALIGN_LEFT, false); 343 installer.AddExtraAttribute("Transport", PSRV_PRINTER_ATTR_TRANSPORT, B_STRING_TYPE, true, false, 344 60, B_ALIGN_RIGHT, false); 345 installer.AddExtraAttribute("Connection", PSRV_PRINTER_ATTR_CNX, B_STRING_TYPE, true, false, 346 40, B_ALIGN_LEFT, false); 347 installer.AddExtraAttribute("Description", PSRV_PRINTER_ATTR_COMMENTS, B_STRING_TYPE, true, true, 348 140, B_ALIGN_LEFT, false); 349 } 350 #endif 351 } 352 353 void 354 TTracker::InstallIndices() 355 { 356 BVolumeRoster roster; 357 BVolume volume; 358 359 roster.Rewind(); 360 while (roster.GetNextVolume(&volume) == B_OK) { 361 if (volume.IsReadOnly() || !volume.IsPersistent() 362 || !volume.KnowsAttr() || !volume.KnowsQuery()) 363 continue; 364 InstallIndices(volume.Device()); 365 } 366 } 367 368 void 369 TTracker::InstallIndices(dev_t device) 370 { 371 status_t error = fs_create_index(device, kAttrQueryLastChange, B_INT32_TYPE, 0); 372 error = fs_create_index(device, "_trk/recentQuery", B_INT32_TYPE, 0); 373 } 374 375 const int32 kDefaultQueryTemplateCount = 3; 376 extern const AttributeTemplate kDefaultQueryTemplate[]; 377 extern const AttributeTemplate kBookmarkQueryTemplate[]; 378 extern const AttributeTemplate kPersonQueryTemplate[]; 379 extern const AttributeTemplate kEmailQueryTemplate[]; 380 381 void 382 TTracker::InstallDefaultTemplates() 383 { 384 BNode node; 385 BString query(kQueryTemplates); 386 query += "/application_octet-stream"; 387 388 if (!BContainerWindow::DefaultStateSourceNode(query.String(), &node, false)) 389 if (BContainerWindow::DefaultStateSourceNode(query.String(), &node, true)) { 390 AttributeStreamFileNode fileNode(&node); 391 AttributeStreamTemplateNode tmp(kDefaultQueryTemplate, 3); 392 fileNode << tmp; 393 } 394 395 (query = kQueryTemplates) += "/application_x-vnd.Be-bookmark"; 396 if (!BContainerWindow::DefaultStateSourceNode(query.String(), &node, false)) 397 if (BContainerWindow::DefaultStateSourceNode(query.String(), &node, true)) { 398 AttributeStreamFileNode fileNode(&node); 399 AttributeStreamTemplateNode tmp(kBookmarkQueryTemplate, 3); 400 fileNode << tmp; 401 } 402 403 (query = kQueryTemplates) += "/application_x-person"; 404 if (!BContainerWindow::DefaultStateSourceNode(query.String(), &node, false)) 405 if (BContainerWindow::DefaultStateSourceNode(query.String(), &node, true)) { 406 AttributeStreamFileNode fileNode(&node); 407 AttributeStreamTemplateNode tmp(kPersonQueryTemplate, 3); 408 fileNode << tmp; 409 } 410 411 (query = kQueryTemplates) += "/text_x-email"; 412 if (!BContainerWindow::DefaultStateSourceNode(query.String(), &node, false)) 413 if (BContainerWindow::DefaultStateSourceNode(query.String(), &node, true)) { 414 AttributeStreamFileNode fileNode(&node); 415 AttributeStreamTemplateNode tmp(kEmailQueryTemplate, 3); 416 fileNode << tmp; 417 } 418 } 419 420 static void 421 InstallTemporaryBackgroundImages(BNode *node, BMessage *message) 422 { 423 int32 size = message->FlattenedSize(); 424 char *buffer = new char [size]; 425 message->Flatten(buffer, size); 426 node->WriteAttr(kBackgroundImageInfo, B_MESSAGE_TYPE, 0, buffer, (size_t)size); 427 delete [] buffer; 428 } 429 430 static void 431 AddTemporaryBackgroundImages(BMessage *message, const char *imagePath, 432 BackgroundImage::Mode mode, BPoint offset, uint32 workspaces, bool eraseTextWidgets) 433 { 434 message->AddString(kBackgroundImageInfoPath, imagePath); 435 message->AddInt32(kBackgroundImageInfoWorkspaces, (int32)workspaces); 436 message->AddInt32(kBackgroundImageInfoMode, mode); 437 message->AddBool(kBackgroundImageInfoEraseText, eraseTextWidgets); 438 message->AddPoint(kBackgroundImageInfoOffset, offset); 439 } 440 441 static void 442 InstallTemporaryBackgroundImagesIfNeeded(BNode *node, const char *imagePath, 443 BackgroundImage::Mode mode, BPoint offset, uint32 workspaces, bool eraseTextWidgets) 444 { 445 attr_info info; 446 if (node->GetAttrInfo(kBackgroundImageInfo, &info) != B_OK) { 447 BMessage message; 448 AddTemporaryBackgroundImages(&message, imagePath, mode, offset, workspaces, 449 eraseTextWidgets); 450 InstallTemporaryBackgroundImages(node, &message); 451 } 452 } 453 454 void 455 TTracker::InstallTemporaryBackgroundImages() 456 { 457 // TODO: make the large Haiku Logo the default background 458 459 BPath path; 460 FSFindTrackerSettingsDir(&path, false); 461 BString defaultFolderPath(path.Path()); 462 defaultFolderPath << '/' << kDefaultFolderTemplate << '/'; 463 464 BNode node; 465 if (BContainerWindow::DefaultStateSourceNode(kDefaultFolderTemplate, &node, true)) 466 InstallTemporaryBackgroundImagesIfNeeded(&node, 467 (BString(defaultFolderPath) << "backgroundTexture.tga").String(), 468 BackgroundImage::kTiled, 469 BPoint(0, 0), 0xffffffff, false); 470 471 BDirectory dir; 472 if (FSGetBootDeskDir(&dir) == B_OK) { 473 attr_info info; 474 if (dir.GetAttrInfo(kBackgroundImageInfo, &info) != B_OK) { 475 BMessage message; 476 AddTemporaryBackgroundImages(&message, 477 (BString(defaultFolderPath) << "bgdefault.tga").String(), 478 BackgroundImage::kScaledToFit, 479 BPoint(0, 0), 0xffffffff, true); 480 AddTemporaryBackgroundImages(&message, 481 (BString(defaultFolderPath) << "bg1.tga").String(), 482 BackgroundImage::kScaledToFit, 483 BPoint(0, 0), 0x00000001, true); 484 AddTemporaryBackgroundImages(&message, 485 (BString(defaultFolderPath) << "bg2.tga").String(), 486 BackgroundImage::kScaledToFit, 487 BPoint(0, 0), 0x00000002, true); 488 AddTemporaryBackgroundImages(&message, 489 (BString(defaultFolderPath) << "bg3.tga").String(), 490 BackgroundImage::kScaledToFit, 491 BPoint(0, 0), 0x00000004, true); 492 AddTemporaryBackgroundImages(&message, 493 (BString(defaultFolderPath) << "bg4.tga").String(), 494 BackgroundImage::kScaledToFit, 495 BPoint(0, 0), 0x00000008, true); 496 AddTemporaryBackgroundImages(&message, 497 (BString(defaultFolderPath) << "bg5.tga").String(), 498 BackgroundImage::kScaledToFit, 499 BPoint(0, 0), 0x00000010, true); 500 AddTemporaryBackgroundImages(&message, 501 (BString(defaultFolderPath) << "bg6.tga").String(), 502 BackgroundImage::kScaledToFit, 503 BPoint(0, 0), 0x00000020, true); 504 AddTemporaryBackgroundImages(&message, 505 (BString(defaultFolderPath) << "bg7.tga").String(), 506 BackgroundImage::kScaledToFit, 507 BPoint(0, 0), 0x00000040, true); 508 AddTemporaryBackgroundImages(&message, 509 (BString(defaultFolderPath) << "bg8.tga").String(), 510 BackgroundImage::kScaledToFit, 511 BPoint(0, 0), 0x00000080, true); 512 AddTemporaryBackgroundImages(&message, 513 (BString(defaultFolderPath) << "bg9.tga").String(), 514 BackgroundImage::kScaledToFit, 515 BPoint(0, 0), 0x00000100, true); 516 AddTemporaryBackgroundImages(&message, 517 (BString(defaultFolderPath) << "bg10.tga").String(), 518 BackgroundImage::kScaledToFit, 519 BPoint(0, 0), 0x00000200, true); 520 AddTemporaryBackgroundImages(&message, 521 (BString(defaultFolderPath) << "bg11.tga").String(), 522 BackgroundImage::kScaledToFit, 523 BPoint(0, 0), 0x00000400, true); 524 AddTemporaryBackgroundImages(&message, 525 (BString(defaultFolderPath) << "bg12.tga").String(), 526 BackgroundImage::kScaledToFit, 527 BPoint(0, 0), 0x00000800, true); 528 AddTemporaryBackgroundImages(&message, 529 (BString(defaultFolderPath) << "bg12.tga").String(), 530 BackgroundImage::kScaledToFit, 531 BPoint(0, 0), 0x00001000, true); 532 AddTemporaryBackgroundImages(&message, 533 (BString(defaultFolderPath) << "bg13.tga").String(), 534 BackgroundImage::kScaledToFit, 535 BPoint(0, 0), 0x00002000, true); 536 AddTemporaryBackgroundImages(&message, 537 (BString(defaultFolderPath) << "bg14.tga").String(), 538 BackgroundImage::kScaledToFit, 539 BPoint(0, 0), 0x00002000, true); 540 AddTemporaryBackgroundImages(&message, 541 (BString(defaultFolderPath) << "bg15.tga").String(), 542 BackgroundImage::kScaledToFit, 543 BPoint(0, 0), 0x00004000, true); 544 AddTemporaryBackgroundImages(&message, 545 (BString(defaultFolderPath) << "bg16.tga").String(), 546 BackgroundImage::kScaledToFit, 547 BPoint(0, 0), 0x00008000, true); 548 ::InstallTemporaryBackgroundImages(&dir, &message); 549 } 550 } 551 } 552 553 554 // the following templates are in big endian and we rely on the Tracker 555 // translation support to swap them on little endian machines 556 // 557 // in case there is an attribute (B_RECT_TYPE) that gets swapped by the media (unzip, 558 // file system endianness swapping, etc., the correct endianness for the 559 // correct machine has to be used here 560 561 const BRect kDefaultFrame(40, 40, 500, 350); 562 563 const AttributeTemplate kDefaultQueryTemplate[] = 564 /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/application_octet-stream */ 565 { 566 { /* default frame */ 567 kAttrWindowFrame, 568 B_RECT_TYPE, 569 16, 570 (const char *)&kDefaultFrame 571 }, 572 { /* attr: _trk/viewstate */ 573 kAttrViewState_be, 574 B_RAW_TYPE, 575 49, 576 "o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000" 577 "\000\000\000\000\000\000\000\000\000\000\357\323\335RCSTR\000\000\000" 578 "\000\000\000\000\000\000" 579 }, 580 { /* attr: _trk/columns */ 581 kAttrColumns_be, 582 B_RAW_TYPE, 583 223, 584 "O\362VR\000\000\000\025\000\000\000\004Name\000B \000\000C\021\000" 585 "\000\000\000\000\000\000\000\000\012_stat/name\000\357\323\335RCST" 586 "R\001\001O\362VR\000\000\000\025\000\000\000\004Path\000CH\000\000" 587 "Ca\000\000\000\000\000\000\000\000\000\011_trk/path\000\357_\174RC" 588 "STR\000\000O\362VR\000\000\000\025\000\000\000\004Size\000C\334\000" 589 "\000B$\000\000\000\000\000\001\000\000\000\012_stat/size\000\317\317" 590 "\306TOFFT\001\000O\362VR\000\000\000\025\000\000\000\010Modified\000" 591 "C\370\000\000C\012\000\000\000\000\000\000\000\000\000\016_stat/mo" 592 "dified\000]KmETIME\001\000" 593 } 594 }; 595 596 const AttributeTemplate kBookmarkQueryTemplate[] = 597 /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/application_x-vnd.Be-bookmark */ 598 { 599 { /* default frame */ 600 kAttrWindowFrame, 601 B_RECT_TYPE, 602 16, 603 (const char *)&kDefaultFrame 604 }, 605 { /* attr: _trk/viewstate */ 606 kAttrViewState_be, 607 B_RAW_TYPE, 608 49, 609 "o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000" 610 "\000\000\000\000\000\000\000\000\000\000w\373\175RCSTR\000\000\000" 611 "\000\000\000\000\000\000" 612 }, 613 { /* attr: _trk/columns */ 614 kAttrColumns_be, 615 B_RAW_TYPE, 616 163, 617 "O\362VR\000\000\000\025\000\000\000\005Title\000B \000\000C+\000\000" 618 "\000\000\000\000\000\000\000\012META:title\000w\373\175RCSTR\000\001" 619 "O\362VR\000\000\000\025\000\000\000\003URL\000Cb\000\000C\217\200\000" 620 "\000\000\000\000\000\000\000\010META:url\000\343[TRCSTR\000\001O\362" 621 "VR\000\000\000\025\000\000\000\010Keywords\000D\004\000\000C\002\000" 622 "\000\000\000\000\000\000\000\000\011META:keyw\000\333\363\334RCSTR" 623 "\000\001" 624 } 625 }; 626 627 const AttributeTemplate kPersonQueryTemplate[] = 628 /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/application_x-vnd.Be-bookmark */ 629 { 630 { /* default frame */ 631 kAttrWindowFrame, 632 B_RECT_TYPE, 633 16, 634 (const char *)&kDefaultFrame 635 }, 636 { /* attr: _trk/viewstate */ 637 kAttrViewState_be, 638 B_RAW_TYPE, 639 49, 640 "o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000" 641 "\000\000\000\000\000\000\000\000\000\000\357\323\335RCSTR\000\000\000" 642 "\000\000\000\000\000\000" 643 }, 644 { /* attr: _trk/columns */ 645 kAttrColumns_be, 646 B_RAW_TYPE, 647 230, 648 "O\362VR\000\000\000\025\000\000\000\004Name\000B \000\000B\346\000" 649 "\000\000\000\000\000\000\000\000\012_stat/name\000\357\323\335RCST" 650 "R\001\001O\362VR\000\000\000\025\000\000\000\012Work Phone\000C*\000" 651 "\000B\264\000\000\000\000\000\000\000\000\000\013META:wphone\000C_" 652 "uRCSTR\000\001O\362VR\000\000\000\025\000\000\000\006E-mail\000C\211" 653 "\200\000B\272\000\000\000\000\000\000\000\000\000\012META:email\000" 654 "sW\337RCSTR\000\001O\362VR\000\000\000\025\000\000\000\007Company\000" 655 "C\277\200\000B\360\000\000\000\000\000\000\000\000\000\014META:com" 656 "pany\000CS\174RCSTR\000\001" 657 }, 658 }; 659 660 const AttributeTemplate kEmailQueryTemplate[] = 661 /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/text_x-email */ 662 { 663 { /* default frame */ 664 kAttrWindowFrame, 665 B_RECT_TYPE, 666 16, 667 (const char *)&kDefaultFrame 668 }, 669 { /* attr: _trk/viewstate */ 670 kAttrViewState_be, 671 B_RAW_TYPE, 672 49, 673 "o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000" 674 "\000\000\000\000\000\000\000\000\000\000\366_\377ETIME\000\000\000" 675 "\000\000\000\000\000\000" 676 }, 677 { /* attr: _trk/columns */ 678 kAttrColumns_be, 679 B_RAW_TYPE, 680 222, 681 "O\362VR\000\000\000\025\000\000\000\007Subject\000B \000\000B\334\000" 682 "\000\000\000\000\000\000\000\000\014MAIL:subject\000\343\173\337RC" 683 "STR\000\000O\362VR\000\000\000\025\000\000\000\004From\000C%\000\000" 684 "C\031\000\000\000\000\000\000\000\000\000\011MAIL:from\000\317s_RC" 685 "STR\000\000O\362VR\000\000\000\025\000\000\000\004When\000C\246\200" 686 "\000B\360\000\000\000\000\000\000\000\000\000\011MAIL:when\000\366" 687 "_\377ETIME\000\000O\362VR\000\000\000\025\000\000\000\006Status\000" 688 "C\352\000\000BH\000\000\000\000\000\001\000\000\000\013MAIL:status" 689 "\000G\363\134RCSTR\000\001" 690 }, 691 }; 692 693