ListItem::ListItem(BView *headerView, const char *text0, const char *text1, const char *text2) : CLVEasyItem(0, false, false, 20.0) { SetAssociatedHeader(headerView); SetColumnContent(1, text0); SetColumnContent(2, text1); SetColumnContent(3, text2); }
MountItem(const char *text0, const char *text1, const char *text2) : CLVEasyItem(0, false, false, 20.0) { // Here we're going to get the mini icon from a specific mime type BRect bmpRect(0.0, 0.0, 15.0, 15.0); BBitmap *icon = new BBitmap(bmpRect, B_CMAP8); BMimeType mime("application/x-vnd.BeServed-fileshare"); mime.GetIcon(icon, B_MINI_ICON); SetColumnContent(0, icon, 2.0); SetColumnContent(1, text0); SetColumnContent(2, text1); SetColumnContent(3, text2); }
ResourceItem::ResourceItem(const char *text0, int type) : CLVEasyItem(0, false, false, 20.0) { // Here we're going to get the mini icon from a specific mime type BRect bmpRect(0.0, 0.0, 15.0, 15.0); BBitmap *icon = new BBitmap(bmpRect, B_CMAP8); BMimeType mime(type == BT_SHARED_FOLDER ? "application/x-vnd.BeServed-fileshare" : "application/x-vnd.Be.printer"); mime.GetIcon(icon, B_MINI_ICON); SetColumnContent(0, icon, 2.0); SetColumnContent(1, text0); SetColumnContent(2, type == BT_SHARED_FOLDER ? "Shared Files" : "Shared Printer"); }
PickUserItem::PickUserItem(BView *headerView, const char *text0, const char *text1) : ListItem(headerView, text0, text1, "") { BBitmap *icon; BMessage archive; size_t size; char *bits = (char *) be_app->AppResources()->LoadResource(type_code('BBMP'), ICON_USER_SMALL, &size); if (bits) if (archive.Unflatten(bits) == B_OK) { icon = new BBitmap(&archive); SetAssociatedHeader(headerView); SetColumnContent(0, icon, 2.0); SetColumnContent(1, text0); SetColumnContent(2, text1); } }
/*********************************************************** * StartRefreshCache ***********************************************************/ void HQueryItem::StartRefreshCache() { PRINT(("Refresh Query\n")); EmptyMailList(); if(fThread != -1) return; fDone = false; // Set icon to open folder BBitmap *icon = ((HApp*)be_app)->GetIcon("CloseQuery"); SetColumnContent(1,icon,2.0,false,false); StartGathering(); }
void pbListItem::RefreshData(void) { BString tmp; char percent[10]; float u, t; SetColumnContent(0, fSlot->name.String()); tmp = ""; tmp << (fSlot->max - fSlot->min + 1); SetColumnContent(3, tmp.String()); if (fSlot->initialized) { tmp = ""; tmp << getNumUniquePBNames(fSlot); SetColumnContent(1, tmp.String()); tmp = ""; tmp << fSlot->pb->CountItems(); SetColumnContent(2, tmp.String()); u = fSlot->pb->CountItems(); t = fSlot->max - fSlot->min + 1; sprintf(percent, "%2.0f", (u/t)*100); tmp = ""; tmp << percent; tmp += "%"; SetColumnContent(4, tmp.String()); } else { SetColumnContent(1, "?"); SetColumnContent(2, "?"); SetColumnContent(4, "?"); } }
/*********************************************************** * Constructor ***********************************************************/ HAttachmentItem::HAttachmentItem(const char* name, off_t file_offset, int32 data_len, const char *content_type, const char *encoding, const char *charset) :CLVEasyItem(0,false,false,20.0) ,fFileOffset(file_offset) ,fDataLen(data_len) ,fExtracted(false) ,fContentType(NULL) ,fEncoding(NULL) ,fCharset(NULL) ,fName(NULL) { fName = (name)?name:_("Unknown"); Encoding().Mime2UTF8(fName); SetColumnContent(1,fName.String()); SetColumnContent(2,(content_type)?content_type:_("(Unknown)")); char *size = new char[15]; float d = 0; char *unit = new char[6]; if(data_len < 1024) { d = data_len; ::strcpy(unit,_("bytes")); }else if(data_len >= 1024 && data_len < 1024*1024){ d = data_len/1024.0; ::strcpy(unit,_("KB")); }else{ d = data_len/(1024.0*1024.0); ::strcpy(unit,_("MB")); } ::sprintf(size,"%6.2f %s",d,unit); SetColumnContent(3,size); delete[] size; delete[] unit; BBitmap *bitmap = new BBitmap(BRect(0,0,15,15),B_CMAP8); BMimeType preferredApp; if(content_type) { BMimeType mime(content_type); char prefApp[B_MIME_TYPE_LENGTH]; mime.GetPreferredApp(prefApp); preferredApp.SetTo(prefApp); fContentType = ::strdup(content_type); if(preferredApp.GetIconForType(content_type,bitmap,B_MINI_ICON) != B_OK) { mime.GetIcon(bitmap,B_MINI_ICON); } SetColumnContent(0,bitmap); } delete bitmap; if(encoding) fEncoding = ::strdup(encoding); if(charset) fCharset = ::strdup(charset); }