Tracker: fix logic to use custom icons.
Regression caused by refactorings in hrev55348. The logic for deciding when to use a built-in tracker icon was changed incorrectly to ignore attributes on directories, trash, etc (anything but executable applications). So the built-in icon was always used. This commit restores the previous logic. Shoud fix #17320 and #17371 Change-Id: I51ba22db59a8b6dd2bd1121b56c753ed47224c57 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4841 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
parent
a7c2c5f842
commit
abef198c1a
@ -599,7 +599,7 @@ Model::FinishSettingUpType()
|
||||
// makes sense to look for a node-based icon. This serves as a hint to the
|
||||
// icon cache, allowing it to not hit the disk again for models that do not
|
||||
// have an icon defined by the node.
|
||||
if (CheckNodeIconHint())
|
||||
if (fBaseType != kLinkNode && !CheckAppIconHint())
|
||||
fIconFrom = kUnknownNotFromNode;
|
||||
|
||||
if (fBaseType != kDirectoryNode
|
||||
@ -623,7 +623,7 @@ Model::FinishSettingUpType()
|
||||
if (fPreferredAppName)
|
||||
DeletePreferredAppVolumeNameLinkTo();
|
||||
|
||||
if (*type != '0')
|
||||
if (*type != '\0')
|
||||
fPreferredAppName = strdup(type);
|
||||
}
|
||||
}
|
||||
@ -720,11 +720,12 @@ Model::FinishSettingUpType()
|
||||
|
||||
|
||||
bool
|
||||
Model::CheckNodeIconHint() const
|
||||
Model::ShouldUseWellKnownIcon() const
|
||||
{
|
||||
return (fBaseType == kDirectoryNode || fBaseType == kVolumeNode
|
||||
|| fBaseType == kTrashNode || fBaseType == kDesktopNode)
|
||||
|| (fBaseType == kExecutableNode && !CheckAppIconHint());
|
||||
if (fBaseType == kDirectoryNode || fBaseType == kVolumeNode
|
||||
|| fBaseType == kTrashNode || fBaseType == kDesktopNode)
|
||||
return !CheckAppIconHint();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -732,13 +733,24 @@ bool
|
||||
Model::CheckAppIconHint() const
|
||||
{
|
||||
attr_info info;
|
||||
return fNode != NULL
|
||||
// node is open, and it
|
||||
&& (fNode->GetAttrInfo(kAttrIcon, &info) == B_OK
|
||||
// has a vector icon, or
|
||||
|| (fNode->GetAttrInfo(kAttrMiniIcon, &info) == B_OK
|
||||
&& fNode->GetAttrInfo(kAttrLargeIcon, &info) == B_OK));
|
||||
// has a mini _and_ large icon
|
||||
if (fNode == NULL) {
|
||||
// Node is not open.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fNode->GetAttrInfo(kAttrIcon, &info) == B_OK) {
|
||||
// Node has a vector icon
|
||||
return true;
|
||||
}
|
||||
|
||||
if (fNode->GetAttrInfo(kAttrMiniIcon, &info) == B_OK
|
||||
&& fNode->GetAttrInfo(kAttrLargeIcon, &info) == B_OK) {
|
||||
// Node has a mini _and_ large icon
|
||||
return true;
|
||||
}
|
||||
|
||||
// If there isn't either of these, we can't use the icon attribute from the node.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -750,7 +762,7 @@ Model::ResetIconFrom()
|
||||
if (InitCheck() != B_OK)
|
||||
return;
|
||||
|
||||
if (CheckNodeIconHint()) {
|
||||
if (ShouldUseWellKnownIcon()) {
|
||||
BDirectory* directory = dynamic_cast<BDirectory*>(fNode);
|
||||
if (WellKnowEntryList::Match(NodeRef()) > (directory_which)-1) {
|
||||
fIconFrom = kTrackerSupplied;
|
||||
|
@ -212,7 +212,7 @@ private:
|
||||
status_t OpenNodeCommon(bool writable);
|
||||
void SetupBaseType();
|
||||
void FinishSettingUpType();
|
||||
bool CheckNodeIconHint() const;
|
||||
bool ShouldUseWellKnownIcon() const;
|
||||
bool CheckAppIconHint() const;
|
||||
void DeletePreferredAppVolumeNameLinkTo();
|
||||
void CacheLocalizedName();
|
||||
|
Loading…
Reference in New Issue
Block a user