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