Diffstat (limited to 'noncore/apps/opie-reader/util.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/util.h | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/noncore/apps/opie-reader/util.h b/noncore/apps/opie-reader/util.h index f831ead..3964b5e 100644 --- a/noncore/apps/opie-reader/util.h +++ b/noncore/apps/opie-reader/util.h | |||
@@ -1,57 +1,9 @@ | |||
1 | #ifndef __UTIL_H | 1 | #ifndef __UTIL_H |
2 | #define __UTIL_H | 2 | #define __UTIL_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qdir.h> | ||
6 | #include <stdlib.h> | ||
7 | 5 | ||
8 | QString filesize(unsigned long l); | 6 | QString filesize(unsigned long l); |
9 | QString percent(unsigned long pos, unsigned long len); | 7 | QString percent(unsigned long pos, unsigned long len); |
10 | QString fmt(unsigned long pos, unsigned long len); | 8 | QString fmt(unsigned long pos, unsigned long len); |
11 | |||
12 | /** | ||
13 | * class with utility inline function(s) | ||
14 | * (in contrast to global functions they become available by just | ||
15 | * including util.h) | ||
16 | */ | ||
17 | class QTReaderUtil | ||
18 | { | ||
19 | public: | ||
20 | |||
21 | /** | ||
22 | * searches for a specific direcory inside OpieReader installation | ||
23 | * | ||
24 | * @param subdir name of sub directory inside installation directory which is needed | ||
25 | * @return full path name including that sub directory | ||
26 | * | ||
27 | * search order is (on all platforms): | ||
28 | * - OPIEDIR | ||
29 | * - QTDIR | ||
30 | * - READERDIR | ||
31 | */ | ||
32 | static QString getPluginPath( const char *subdir = "codecs/" ) | ||
33 | { | ||
34 | QString dirname; | ||
35 | dirname = getenv("OPIEDIR"); | ||
36 | dirname += "/plugins/reader/"; | ||
37 | dirname += subdir; | ||
38 | if (QDir(dirname).exists()) | ||
39 | return dirname; | ||
40 | |||
41 | dirname = getenv("QTDIR"); | ||
42 | dirname += "/plugins/reader/"; | ||
43 | dirname += subdir; | ||
44 | if (QDir(dirname).exists()) | ||
45 | return dirname; | ||
46 | |||
47 | dirname = getenv("READERDIR"); | ||
48 | dirname += "/"; | ||
49 | dirname += subdir; | ||
50 | if (QDir(dirname).exists()) | ||
51 | return dirname; | ||
52 | |||
53 | return ""; | ||
54 | } | ||
55 | }; | ||
56 | |||
57 | #endif | 9 | #endif |