| 134 | } |
| 135 | |
| 136 | QString SessionPrivate::generatePrettyContents( const SessionInfo& info ) |
| 137 | { |
| 138 | if( info.projects.isEmpty() ) |
| 139 | return i18n("(no projects)"); |
| 140 | |
| 141 | QStringList projectNames; |
| 142 | projectNames.reserve( info.projects.size() ); |
| 143 | |
| 144 | for (const QUrl& url : info.projects) { |
| 145 | IProject* project = nullptr; |
| 146 | if( ICore::self() && ICore::self()->projectController() ) { |
| 147 | project = ICore::self()->projectController()->findProjectForUrl( url ); |
| 148 | } |
| 149 | |
| 150 | if( project ) { |
| 151 | projectNames << project->name(); |
| 152 | } else { |
| 153 | QString projectName = url.fileName(); |
| 154 | static const QRegularExpression projectFileExtensionRegex(QStringLiteral("\\.kdev4$"), |
| 155 | QRegularExpression::CaseInsensitiveOption); |
| 156 | projectName.remove(projectFileExtensionRegex); |
| 157 | projectNames << projectName; |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | if( projectNames.isEmpty() ) { |
| 162 | return i18n("(no projects)"); |
| 163 | } else { |
| 164 | return projectNames.join(QLatin1String(", ")); |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | QString SessionPrivate::generateDescription( const SessionInfo& info ) |
| 169 | { |
nothing calls this directly
no test coverage detected