Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/plugins/folder/foldermodel.cpp
Show First 20 Lines • Show All 335 Lines • ▼ Show 20 Line(s) | |||||
336 | 336 | | |||
337 | QUrl FolderModel::resolvedUrl() const | 337 | QUrl FolderModel::resolvedUrl() const | ||
338 | { | 338 | { | ||
339 | return m_dirModel->dirLister()->url(); | 339 | return m_dirModel->dirLister()->url(); | ||
340 | } | 340 | } | ||
341 | 341 | | |||
342 | QUrl FolderModel::resolve(const QString& url) | 342 | QUrl FolderModel::resolve(const QString& url) | ||
343 | { | 343 | { | ||
344 | QString processedInput = url; | ||||
344 | QUrl resolvedUrl; | 345 | QUrl resolvedUrl; | ||
345 | 346 | | |||
346 | if (url.startsWith(QLatin1Char('~'))) { | 347 | // Strip trailing space if necessary since this will cause QUrl::fromUserInput | ||
347 | resolvedUrl = QUrl::fromLocalFile(KShell::tildeExpand(url)); | 348 | // to mangle the path | ||
349 | bool originalPathEndedWithASpace = false; | ||||
350 | if (processedInput.endsWith(QLatin1Char(' '))) { | ||||
351 | originalPathEndedWithASpace = true; | ||||
352 | processedInput.chop(1); | ||||
353 | } | ||||
354 | | ||||
355 | if (processedInput.startsWith(QLatin1Char('~'))) { | ||||
356 | resolvedUrl = QUrl::fromLocalFile(KShell::tildeExpand(processedInput)); | ||||
348 | } else { | 357 | } else { | ||
349 | resolvedUrl = QUrl::fromUserInput(url); | 358 | resolvedUrl = QUrl::fromUserInput(processedInput); | ||
359 | } | ||||
360 | | ||||
361 | // Re-add the trailing space if necessary | ||||
362 | if (originalPathEndedWithASpace) { | ||||
363 | resolvedUrl.setPath(resolvedUrl.path() + QLatin1Char(' ')); | ||||
350 | } | 364 | } | ||
351 | 365 | | |||
352 | return resolvedUrl; | 366 | return resolvedUrl; | ||
353 | } | 367 | } | ||
354 | 368 | | |||
355 | QString FolderModel::iconName() const | 369 | QString FolderModel::iconName() const | ||
356 | { | 370 | { | ||
357 | const KFileItem rootItem(m_dirModel->dirLister()->url()); | 371 | const KFileItem rootItem(m_dirModel->dirLister()->url()); | ||
▲ Show 20 Lines • Show All 1750 Lines • Show Last 20 Lines |