| 40 | } |
| 41 | |
| 42 | QString GetParentPath(mitk::DataNode::Pointer dataNode) |
| 43 | { |
| 44 | if (dataNode.IsNull()) |
| 45 | return ""; |
| 46 | |
| 47 | auto dataStorage = GetDataStorage(); |
| 48 | |
| 49 | if (dataStorage.IsNull()) |
| 50 | return ""; |
| 51 | |
| 52 | auto sources = dataStorage->GetSources(dataNode); |
| 53 | |
| 54 | if (sources.IsNull() || sources->empty()) |
| 55 | return ""; |
| 56 | |
| 57 | const auto &parentNode = sources->front(); |
| 58 | |
| 59 | if (parentNode.IsNull()) |
| 60 | return ""; |
| 61 | |
| 62 | auto data = parentNode->GetData(); |
| 63 | |
| 64 | if (nullptr != data) |
| 65 | { |
| 66 | auto pathProperty = data->GetConstProperty("path"); |
| 67 | |
| 68 | if (pathProperty.IsNotNull()) |
| 69 | return QFileInfo(QString::fromStdString(pathProperty->GetValueAsString())).canonicalPath(); |
| 70 | } |
| 71 | |
| 72 | return GetParentPath(parentNode); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | class QmitkFileSaveActionPrivate |
no test coverage detected