Changeset View
Changeset View
Standalone View
Standalone View
lgpl/generic/kpUrlFormatter.cpp
Show All 31 Lines | |||||
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 | { | ||||
40 | return i18n ("Untitled"); | 41 | return i18n ("Untitled"); | ||
41 | else | 42 | } | ||
43 | | ||||
42 | return url.url (QUrl::PreferLocalFile); | 44 | return url.url (QUrl::PreferLocalFile); | ||
43 | } | 45 | } | ||
44 | 46 | | |||
45 | //--------------------------------------------------------------------- | 47 | //--------------------------------------------------------------------- | ||
46 | 48 | | |||
47 | // public static | 49 | // public static | ||
48 | QString kpUrlFormatter::PrettyFilename (const QUrl &url) | 50 | QString kpUrlFormatter::PrettyFilename (const QUrl &url) | ||
49 | { | 51 | { | ||
50 | if (url.isEmpty ()) | 52 | if (url.isEmpty ()) | ||
53 | { | ||||
51 | return i18n ("Untitled"); | 54 | return i18n ("Untitled"); | ||
52 | else if (url.fileName ().isEmpty ()) | 55 | } | ||
56 | | ||||
57 | if (url.fileName ().isEmpty ()) | ||||
58 | { | ||||
53 | return kpUrlFormatter::PrettyUrl (url); // better than the name "" | 59 | return kpUrlFormatter::PrettyUrl (url); // better than the name "" | ||
54 | else | 60 | } | ||
61 | | ||||
55 | return url.fileName (); | 62 | return url.fileName (); | ||
56 | } | 63 | } | ||
57 | 64 | | |||
58 | //--------------------------------------------------------------------- | 65 | //--------------------------------------------------------------------- |