| 22 | #include <QTextStream> |
| 23 | |
| 24 | bool InfoPlistDockIcon::readShowDockIcon() { |
| 25 | const bool show_default = true; |
| 26 | |
| 27 | QString infoPlistPath = |
| 28 | QFileInfo(QCoreApplication::applicationDirPath() + "/../Info.plist") |
| 29 | .canonicalFilePath(); |
| 30 | |
| 31 | QFile plistFile(infoPlistPath); |
| 32 | |
| 33 | QDomDocument doc; |
| 34 | if (!doc.setContent(&plistFile)) return show_default; |
| 35 | |
| 36 | if (!doc.hasChildNodes()) return show_default; |
| 37 | |
| 38 | QDomNodeList nodes = doc.childNodes(); |
| 39 | |
| 40 | QDomNode node; |
| 41 | int i; |
| 42 | for (i = 0; i < nodes.size(); ++i) { |
| 43 | node = nodes.at(i); |
| 44 | if (node.nodeName() == "plist") break; |
| 45 | } |
| 46 | |
| 47 | if (i == nodes.size()) return show_default; |
| 48 | |
| 49 | if (!node.hasChildNodes()) return show_default; |
| 50 | |
| 51 | nodes = node.childNodes(); |
| 52 | |
| 53 | for (i = 0; i < nodes.size(); ++i) { |
| 54 | node = nodes.at(i); |
| 55 | if (node.nodeName() == "dict") break; |
| 56 | } |
| 57 | |
| 58 | if (i == nodes.size()) return show_default; |
| 59 | |
| 60 | if (!node.hasChildNodes()) return show_default; |
| 61 | |
| 62 | nodes = node.childNodes(); |
| 63 | |
| 64 | for (i = 0; i < nodes.size(); ++i) { |
| 65 | node = nodes.at(i); |
| 66 | |
| 67 | QString subText; |
| 68 | |
| 69 | if (node.hasChildNodes()) { |
| 70 | subText = node.childNodes().at(0).toText().data(); |
| 71 | } |
| 72 | |
| 73 | if (subText == "LSUIElement") break; |
| 74 | } |
| 75 | |
| 76 | if (i < nodes.size()) { |
| 77 | node = node.nextSibling(); |
| 78 | return (node.nodeName() != "true"); |
| 79 | } |
| 80 | |
| 81 | return show_default; |
nothing calls this directly
no outgoing calls
no test coverage detected