Changeset View
Changeset View
Standalone View
Standalone View
lgpl/generic/kpUrlFormatter.cpp
Show All 30 Lines | |||||
31 | #include <KLocalizedString> | 31 | #include <KLocalizedString> | ||
32 | #include <QUrl> | 32 | #include <QUrl> | ||
33 | 33 | | |||
34 | //--------------------------------------------------------------------- | 34 | //--------------------------------------------------------------------- | ||
35 | 35 | | |||
36 | // public static | 36 | // public static | ||
37 | QString kpUrlFormatter::PrettyUrl (const QUrl &url) | 37 | QString kpUrlFormatter::PrettyUrl (const QUrl &url) | ||
38 | { | 38 | { | ||
39 | if (url.isEmpty ()) | 39 | if (url.isEmpty ()) { | ||
40 | return i18n ("Untitled"); | 40 | return i18n ("Untitled"); | ||
41 | else | 41 | } | ||
42 | | ||||
42 | return url.url (QUrl::PreferLocalFile); | 43 | return url.url (QUrl::PreferLocalFile); | ||
43 | } | 44 | } | ||
44 | 45 | | |||
45 | //--------------------------------------------------------------------- | 46 | //--------------------------------------------------------------------- | ||
46 | 47 | | |||
47 | // public static | 48 | // public static | ||
48 | QString kpUrlFormatter::PrettyFilename (const QUrl &url) | 49 | QString kpUrlFormatter::PrettyFilename (const QUrl &url) | ||
49 | { | 50 | { | ||
50 | if (url.isEmpty ()) | 51 | if (url.isEmpty ()) { | ||
51 | return i18n ("Untitled"); | 52 | return i18n ("Untitled"); | ||
52 | else if (url.fileName ().isEmpty ()) | 53 | } | ||
54 | | ||||
55 | if (url.fileName ().isEmpty ()) { | ||||
53 | return kpUrlFormatter::PrettyUrl (url); // better than the name "" | 56 | return kpUrlFormatter::PrettyUrl (url); // better than the name "" | ||
54 | else | 57 | } | ||
58 | | ||||
55 | return url.fileName (); | 59 | return url.fileName (); | ||
56 | } | 60 | } | ||
57 | 61 | | |||
58 | //--------------------------------------------------------------------- | 62 | //--------------------------------------------------------------------- |