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
|
// 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
|
// icon cache, allowing it to not hit the disk again for models that do not
|
||||||
// have an icon defined by the node.
|
// have an icon defined by the node.
|
||||||
if (CheckNodeIconHint())
|
if (fBaseType != kLinkNode && !CheckAppIconHint())
|
||||||
fIconFrom = kUnknownNotFromNode;
|
fIconFrom = kUnknownNotFromNode;
|
||||||
|
|
||||||
if (fBaseType != kDirectoryNode
|
if (fBaseType != kDirectoryNode
|
||||||
@ -623,7 +623,7 @@ Model::FinishSettingUpType()
|
|||||||
if (fPreferredAppName)
|
if (fPreferredAppName)
|
||||||
DeletePreferredAppVolumeNameLinkTo();
|
DeletePreferredAppVolumeNameLinkTo();
|
||||||
|
|
||||||
if (*type != '0')
|
if (*type != '\0')
|
||||||
fPreferredAppName = strdup(type);
|
fPreferredAppName = strdup(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -720,11 +720,12 @@ Model::FinishSettingUpType()
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Model::CheckNodeIconHint() const
|
Model::ShouldUseWellKnownIcon() const
|
||||||
{
|
{
|
||||||
return (fBaseType == kDirectoryNode || fBaseType == kVolumeNode
|
if (fBaseType == kDirectoryNode || fBaseType == kVolumeNode
|
||||||
|| fBaseType == kTrashNode || fBaseType == kDesktopNode)
|
|| fBaseType == kTrashNode || fBaseType == kDesktopNode)
|
||||||
|| (fBaseType == kExecutableNode && !CheckAppIconHint());
|
return !CheckAppIconHint();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -732,13 +733,24 @@ bool
|
|||||||
Model::CheckAppIconHint() const
|
Model::CheckAppIconHint() const
|
||||||
{
|
{
|
||||||
attr_info info;
|
attr_info info;
|
||||||
return fNode != NULL
|
if (fNode == NULL) {
|
||||||
// node is open, and it
|
// Node is not open.
|
||||||
&& (fNode->GetAttrInfo(kAttrIcon, &info) == B_OK
|
return false;
|
||||||
// has a vector icon, or
|
}
|
||||||
|| (fNode->GetAttrInfo(kAttrMiniIcon, &info) == B_OK
|
|
||||||
&& fNode->GetAttrInfo(kAttrLargeIcon, &info) == B_OK));
|
if (fNode->GetAttrInfo(kAttrIcon, &info) == B_OK) {
|
||||||
// has a mini _and_ large icon
|
// 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)
|
if (InitCheck() != B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (CheckNodeIconHint()) {
|
if (ShouldUseWellKnownIcon()) {
|
||||||
BDirectory* directory = dynamic_cast<BDirectory*>(fNode);
|
BDirectory* directory = dynamic_cast<BDirectory*>(fNode);
|
||||||
if (WellKnowEntryList::Match(NodeRef()) > (directory_which)-1) {
|
if (WellKnowEntryList::Match(NodeRef()) > (directory_which)-1) {
|
||||||
fIconFrom = kTrackerSupplied;
|
fIconFrom = kTrackerSupplied;
|
||||||
|
@ -212,7 +212,7 @@ private:
|
|||||||
status_t OpenNodeCommon(bool writable);
|
status_t OpenNodeCommon(bool writable);
|
||||||
void SetupBaseType();
|
void SetupBaseType();
|
||||||
void FinishSettingUpType();
|
void FinishSettingUpType();
|
||||||
bool CheckNodeIconHint() const;
|
bool ShouldUseWellKnownIcon() const;
|
||||||
bool CheckAppIconHint() const;
|
bool CheckAppIconHint() const;
|
||||||
void DeletePreferredAppVolumeNameLinkTo();
|
void DeletePreferredAppVolumeNameLinkTo();
|
||||||
void CacheLocalizedName();
|
void CacheLocalizedName();
|
||||||
|
Loading…
Reference in New Issue
Block a user