| 22 | namespace { |
| 23 | |
| 24 | static QUrl rebaseMatchingUrl(const QUrl& toRebase, const KConfigGroup& config, const QString& baseEntry, const QString& rebaseEntry) |
| 25 | { |
| 26 | const QUrl::UrlFormattingOption matchOpts = QUrl::NormalizePathSegments; |
| 27 | const auto configGroups = config.groupList(); |
| 28 | for (const QString& group : configGroups) { |
| 29 | KConfigGroup pathCfg = config.group(group); |
| 30 | const QString baseStr = pathCfg.readEntry(baseEntry, QUrl()).url(matchOpts); |
| 31 | const QString searchStr = toRebase.url(matchOpts); |
| 32 | if (searchStr.contains(baseStr)) { |
| 33 | const QUrl rebase = pathCfg.readEntry(rebaseEntry, QUrl()); |
| 34 | return rebase.resolved(QUrl(searchStr.mid(baseStr.length()))); |
| 35 | } |
| 36 | } |
| 37 | //No mapping found |
| 38 | return toRebase; |
| 39 | } |
| 40 | |
| 41 | } |
| 42 | |