MCPcopy Create free account
hub / github.com/KDE/kdevelop / activeDocumentPath

Method activeDocumentPath

kdevplatform/shell/documentcontroller.cpp:1006–1030  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1004}
1005
1006QString DocumentController::activeDocumentPath( const QString& target ) const
1007{
1008 if(!target.isEmpty()) {
1009 const auto projects = Core::self()->projectController()->projects();
1010 for (IProject* project : projects) {
1011 if(project->name().startsWith(target, Qt::CaseInsensitive)) {
1012 return project->path().pathOrUrl() + QLatin1String("/.");
1013 }
1014 }
1015 }
1016 IDocument* doc = activeDocument();
1017 if(!doc || target == QLatin1String("[selection]"))
1018 {
1019 Context* selection = ICore::self()->selectionController()->currentSelection();
1020 if(selection && selection->type() == Context::ProjectItemContext && !static_cast<ProjectItemContext*>(selection)->items().isEmpty())
1021 {
1022 QString ret = static_cast<ProjectItemContext*>(selection)->items().at(0)->path().pathOrUrl();
1023 if(static_cast<ProjectItemContext*>(selection)->items().at(0)->folder())
1024 ret += QLatin1String("/.");
1025 return ret;
1026 }
1027 return QString();
1028 }
1029 return doc->url().toString();
1030}
1031
1032QStringList DocumentController::activeDocumentPaths() const
1033{

Callers

nothing calls this directly

Calls 15

projectsMethod · 0.80
projectControllerMethod · 0.80
pathOrUrlMethod · 0.80
currentSelectionMethod · 0.80
selectionControllerMethod · 0.80
folderMethod · 0.80
QStringClass · 0.70
isEmptyMethod · 0.45
nameMethod · 0.45
pathMethod · 0.45
typeMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected