author | zecke <zecke> | 2004-02-20 14:01:52 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-02-20 14:01:52 (UTC) |
commit | 7d53a7812716011023e3d1242d0503f4fcaadc26 (patch) (unidiff) | |
tree | d0d905332a766ab11d78e58ed8c27ed28cc126f4 | |
parent | 132f53a7c9cdc3e14a040558f80bb45ceb3ca9b5 (diff) | |
download | opie-7d53a7812716011023e3d1242d0503f4fcaadc26.zip opie-7d53a7812716011023e3d1242d0503f4fcaadc26.tar.gz opie-7d53a7812716011023e3d1242d0503f4fcaadc26.tar.bz2 |
some more global functions for ODP
Alwin will do a clean room implementation on most of the content
-rw-r--r-- | libopie2/opiecore/oglobal.h | 77 |
1 files changed, 75 insertions, 2 deletions
diff --git a/libopie2/opiecore/oglobal.h b/libopie2/opiecore/oglobal.h index 2dc4f9e..012f240 100644 --- a/libopie2/opiecore/oglobal.h +++ b/libopie2/opiecore/oglobal.h | |||
@@ -1,49 +1,122 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef OGLOBAL_H | 30 | #ifndef OGLOBAL_H |
31 | #define OGLOBAL_H | 31 | #define OGLOBAL_H |
32 | 32 | ||
33 | #include <qpe/global.h> | ||
34 | #include <qpe/timestring.h> | ||
35 | |||
33 | #include <opie2/oconfig.h> | 36 | #include <opie2/oconfig.h> |
37 | #include <static.h> | ||
34 | 38 | ||
35 | //FIXME Is it wise or even necessary to inherit OGlobal from Global? | 39 | //FIXME Is it wise or even necessary to inherit OGlobal from Global? |
36 | // once we totally skip libqpe it should ideally swallow Global -zecke | 40 | // once we totally skip libqpe it should ideally swallow Global -zecke |
37 | // You're right. I deleted global as the base class. -mickeyl | 41 | // You're right. I deleted global as the base class. -mickeyl |
38 | 42 | ||
39 | class OGlobal | 43 | |
44 | class QFile; | ||
45 | class QString; | ||
46 | /** | ||
47 | *\brief OGlobal contains a list of generic functions | ||
48 | * | ||
49 | * The class OGlobal contains small utility functions | ||
50 | * which might be useful for other applications to use. It features access | ||
51 | * to the global device config and specialized functions to get information | ||
52 | * out of this config like Weekstart or Owner name. | ||
53 | * | ||
54 | * @todo ODP implement the things from Global which are good | ||
55 | */ | ||
56 | class OGlobal : public Global | ||
40 | { | 57 | { |
41 | public: | 58 | public: |
59 | |||
60 | // how do they relate to our Document Idea | ||
61 | /** @name Document System related functions | ||
62 | * | ||
63 | */ | ||
64 | //@{ | ||
65 | static bool isAppLnkFileName( const QString& str ); | ||
66 | static bool isDocumentFileName( const QString& file ); | ||
67 | //@} | ||
68 | |||
69 | /** @name File Operations | ||
70 | * File operations provided by OGlobal | ||
71 | */ | ||
72 | //@{ | ||
73 | static QString tempDirPath(); | ||
74 | static QString homeDirPath(); | ||
75 | static QString tempFileName( const QString& ); | ||
76 | static bool renameFile( const QString& from, const QString& to ); | ||
77 | static bool truncateFile( QFile &f, off_t size ); | ||
78 | //@} | ||
79 | |||
80 | |||
81 | static QString generateUuid(); | ||
82 | |||
83 | /** @name Convert Content | ||
84 | * Convert Content of a QByteArray | ||
85 | */ | ||
86 | //@{ | ||
87 | static QByteArray encodeBase64(const QByteArray& ); | ||
88 | static QByteArray decodeBase64(const QByteArray& ); | ||
89 | //@} | ||
90 | |||
42 | //FIXME Do we want to put that into OApplication as in KApplication? -zecke | 91 | //FIXME Do we want to put that into OApplication as in KApplication? -zecke |
43 | // We already have a per-application config in OApplication | 92 | // We already have a per-application config in OApplication |
44 | // ( accessed through oApp->config() ), but this one is the global one! -mickeyl | 93 | // ( accessed through oApp->config() ), but this one is the global one! -mickeyl |
94 | /** @name Config and Owner related Information | ||
95 | * | ||
96 | */ | ||
97 | //@{ | ||
45 | static OConfig* config(); | 98 | static OConfig* config(); |
99 | static QString ownerName(); | ||
100 | static bool weekStartsOnMonday(); | ||
101 | static bool useAMPM(); | ||
102 | #ifdef ODP | ||
103 | #error "Fix dateFormat" | ||
104 | /** | ||
105 | * For Qt3/Qt4 we can use QDate::toString(OGlobal::dateFormat) | ||
106 | * See if we need to use the function with String in it | ||
107 | * Anyway this is the future | ||
108 | * for now still use TimeString! | ||
109 | */ | ||
110 | static DateFormat dateFormat(); | ||
111 | #endif | ||
112 | |||
113 | static void setWeekStartsOnMonday( bool ); | ||
114 | static void setUseAMPM( bool ); | ||
115 | static void setDateFormat( const DateFormat& ); | ||
116 | //@} | ||
117 | |||
118 | private: | ||
46 | static OConfig* _config; | 119 | static OConfig* _config; |
47 | }; | 120 | }; |
48 | 121 | ||
49 | #endif // OGLOBAL_H | 122 | #endif // OGLOBAL_H |