24 files changed, 348 insertions, 147 deletions
@@ -110,6 +110,8 @@ $(OPIEDIR)/stamp-headers : | |||
110 | ( cd include/opie2 && ln -sf ../../libopie2/opiedb/*.h .; ) | 110 | ( cd include/opie2 && ln -sf ../../libopie2/opiedb/*.h .; ) |
111 | ( cd include/opie2 && ln -sf ../../libopie2/opienet/*.h .; ) | 111 | ( cd include/opie2 && ln -sf ../../libopie2/opienet/*.h .; ) |
112 | ( cd include/opie2 && ln -sf ../../libopie2/opiepim/*.h .; ) | 112 | ( cd include/opie2 && ln -sf ../../libopie2/opiepim/*.h .; ) |
113 | ( cd include/opie2 && ln -sf ../../libopie2/opiepim/core/*.h .; ) | ||
114 | ( cd include/opie2 && ln -sf ../../libopie2/opiepim/core/backends/*.h .; ) | ||
113 | ( cd include/opie2 && ln -sf ../../libopie2/opieui/*.h .; ) | 115 | ( cd include/opie2 && ln -sf ../../libopie2/opieui/*.h .; ) |
114 | ( cd include/opie2 && ln -sf ../../libopie2/opieui/fileselector/*.h .; ) | 116 | ( cd include/opie2 && ln -sf ../../libopie2/opieui/fileselector/*.h .; ) |
115 | ( cd include/opie2 && ln -sf ../../libopie2/opieui/big-screen/*.h .; ) | 117 | ( cd include/opie2 && ln -sf ../../libopie2/opieui/big-screen/*.h .; ) |
diff --git a/libopie2/opiepim/core/oconversion.cpp b/libopie2/opiepim/core/oconversion.cpp index b7eebef..160c2c6 100644 --- a/libopie2/opiepim/core/oconversion.cpp +++ b/libopie2/opiepim/core/oconversion.cpp | |||
@@ -1,6 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Main Author <main-author@whereever.org> | ||
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 4 | .=l. |
6 | .>+-= | 5 | .>+-= |
@@ -27,11 +26,12 @@ | |||
27 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
28 | */ | 27 | */ |
29 | 28 | ||
29 | /* OPIE */ | ||
30 | #include <opie2/oconversion.h> | 30 | #include <opie2/oconversion.h> |
31 | #include <qpe/timeconversion.h> | 31 | #include <qpe/timeconversion.h> |
32 | 32 | ||
33 | 33 | namespace Opie | |
34 | namespace Opie { | 34 | { |
35 | 35 | ||
36 | QString OConversion::dateToString( const QDate &d ) | 36 | QString OConversion::dateToString( const QDate &d ) |
37 | { | 37 | { |
@@ -51,6 +51,7 @@ QString OConversion::dateToString( const QDate &d ) | |||
51 | return str; | 51 | return str; |
52 | } | 52 | } |
53 | 53 | ||
54 | |||
54 | QDate OConversion::dateFromString( const QString& s ) | 55 | QDate OConversion::dateFromString( const QString& s ) |
55 | { | 56 | { |
56 | QDate date; | 57 | QDate date; |
@@ -71,29 +72,37 @@ QDate OConversion::dateFromString( const QString& s ) | |||
71 | 72 | ||
72 | // do some quick sanity checking -eilers | 73 | // do some quick sanity checking -eilers |
73 | // but we isValid() again? -zecke | 74 | // but we isValid() again? -zecke |
74 | if ( year < 1900 || year > 3000 ) { | 75 | if ( year < 1900 || year > 3000 ) |
76 | { | ||
75 | qWarning( "PimContact year is not in range"); | 77 | qWarning( "PimContact year is not in range"); |
76 | return date; | 78 | return date; |
77 | } | 79 | } |
78 | if ( month < 0 || month > 12 ) { | 80 | if ( month < 0 || month > 12 ) |
81 | { | ||
79 | qWarning( "PimContact month is not in range"); | 82 | qWarning( "PimContact month is not in range"); |
80 | return date; | 83 | return date; |
81 | } | 84 | } |
82 | if ( day < 0 || day > 31 ) { | 85 | if ( day < 0 || day > 31 ) |
86 | { | ||
83 | qWarning( "PimContact day is not in range"); | 87 | qWarning( "PimContact day is not in range"); |
84 | return date; | 88 | return date; |
85 | } | 89 | } |
86 | 90 | ||
87 | date.setYMD( year, month, day ); | 91 | date.setYMD( year, month, day ); |
88 | if ( !date.isValid() ) { | 92 | if ( !date.isValid() ) |
93 | { | ||
89 | qWarning( "PimContact date is not valid"); | 94 | qWarning( "PimContact date is not valid"); |
90 | return date; | 95 | return date; |
91 | } | 96 | } |
92 | 97 | ||
93 | return date; | 98 | return date; |
94 | } | 99 | } |
95 | QString OConversion::dateTimeToString( const QDateTime& dt ) { | 100 | |
96 | if (!dt.isValid() || dt.isNull() ) return QString::null; | 101 | |
102 | QString OConversion::dateTimeToString( const QDateTime& dt ) | ||
103 | { | ||
104 | if ( !dt.isValid() || dt.isNull() ) | ||
105 | return QString::null; | ||
97 | 106 | ||
98 | QString year = QString::number( dt.date().year() ); | 107 | QString year = QString::number( dt.date().year() ); |
99 | QString month = QString::number( dt.date().month() ); | 108 | QString month = QString::number( dt.date().month() ); |
@@ -109,13 +118,15 @@ QString OConversion::dateTimeToString( const QDateTime& dt ) { | |||
109 | min = min. rightJustify( 2, '0' ); | 118 | min = min. rightJustify( 2, '0' ); |
110 | sec = sec. rightJustify( 2, '0' ); | 119 | sec = sec. rightJustify( 2, '0' ); |
111 | 120 | ||
112 | QString str = day + month + year + hour + min + sec; | 121 | return day + month + year + hour + min + sec; |
113 | |||
114 | return str; | ||
115 | } | 122 | } |
116 | QDateTime OConversion::dateTimeFromString( const QString& str) { | ||
117 | 123 | ||
118 | if ( str.isEmpty() ) return QDateTime(); | 124 | |
125 | QDateTime OConversion::dateTimeFromString( const QString& str ) | ||
126 | { | ||
127 | |||
128 | if ( str.isEmpty() ) | ||
129 | return QDateTime(); | ||
119 | int day = str.mid(0, 2).toInt(); | 130 | int day = str.mid(0, 2).toInt(); |
120 | int month = str.mid(2, 2).toInt(); | 131 | int month = str.mid(2, 2).toInt(); |
121 | int year = str.mid(4, 4).toInt(); | 132 | int year = str.mid(4, 4).toInt(); |
diff --git a/libopie2/opiepim/core/oconversion.h b/libopie2/opiepim/core/oconversion.h index 3c4fdf3..eeb97e5 100644 --- a/libopie2/opiepim/core/oconversion.h +++ b/libopie2/opiepim/core/oconversion.h | |||
@@ -27,11 +27,10 @@ | |||
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef __oconversion_h__ | 30 | #ifndef OCONVERSION_H |
31 | #define __oconversion_h__ | 31 | #define OCONVERSION_H |
32 | 32 | ||
33 | /* #include <time.h> */ | 33 | /* QT */ |
34 | /* #include <sys/types.h> */ | ||
35 | #include <qdatetime.h> | 34 | #include <qdatetime.h> |
36 | 35 | ||
37 | namespace Opie { | 36 | namespace Opie { |
diff --git a/libopie2/opiepim/core/opimcache.h b/libopie2/opiepim/core/opimcache.h index e70a910..a033574 100644 --- a/libopie2/opiepim/core/opimcache.h +++ b/libopie2/opiepim/core/opimcache.h | |||
@@ -26,13 +26,15 @@ | |||
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 | #ifndef OPIE_PIM_CACHE_H | 29 | #ifndef OPIMCACHE_H |
30 | #define OPIE_PIM_CACHE_H | 30 | #define OPIMCACHE_H |
31 | |||
32 | #include <qintcache.h> | ||
33 | 31 | ||
32 | /* OPIE */ | ||
34 | #include <opie2/opimrecord.h> | 33 | #include <opie2/opimrecord.h> |
35 | 34 | ||
35 | /* QT */ | ||
36 | #include <qintcache.h> | ||
37 | |||
36 | namespace Opie { | 38 | namespace Opie { |
37 | class OPimCacheItemPrivate; | 39 | class OPimCacheItemPrivate; |
38 | 40 | ||
diff --git a/libopie2/opiepim/core/opimmaintainer.cpp b/libopie2/opiepim/core/opimmaintainer.cpp index b2eff12..b8d829a 100644 --- a/libopie2/opiepim/core/opimmaintainer.cpp +++ b/libopie2/opiepim/core/opimmaintainer.cpp | |||
@@ -27,7 +27,7 @@ | |||
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <opie2/opimmaintainer.h> | 30 | #include "opimmaintainer.h" |
31 | 31 | ||
32 | namespace Opie { | 32 | namespace Opie { |
33 | OPimMaintainer::OPimMaintainer( int mode, int uid ) | 33 | OPimMaintainer::OPimMaintainer( int mode, int uid ) |
diff --git a/libopie2/opiepim/core/opimmaintainer.h b/libopie2/opiepim/core/opimmaintainer.h index 46bc9d2..e7e7eeb 100644 --- a/libopie2/opiepim/core/opimmaintainer.h +++ b/libopie2/opiepim/core/opimmaintainer.h | |||
@@ -26,9 +26,10 @@ | |||
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 | #ifndef OPIE_PIM_MAINTAINER_H | 29 | #ifndef OPIMMAINTAINER_H |
30 | #define OPIE_PIM_MAINTAINER_H | 30 | #define OPIMMAINTAINER_H |
31 | 31 | ||
32 | /* QT */ | ||
32 | #include <qstring.h> | 33 | #include <qstring.h> |
33 | 34 | ||
34 | namespace Opie { | 35 | namespace Opie { |
diff --git a/libopie2/opiepim/core/opimresolver.cpp b/libopie2/opiepim/core/opimresolver.cpp index eceabcb..73d7de1 100644 --- a/libopie2/opiepim/core/opimresolver.cpp +++ b/libopie2/opiepim/core/opimresolver.cpp | |||
@@ -26,15 +26,16 @@ | |||
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 | #include <qcopchannel_qws.h> | ||
30 | 29 | ||
31 | #include <qpe/qcopenvelope_qws.h> | 30 | #include "opimresolver.h" |
32 | 31 | ||
33 | #include <opie2/otodoaccess.h> | 32 | /* OPIE */ |
34 | #include <opie2/ocontactaccess.h> | 33 | #include <opie2/ocontactaccess.h> |
34 | #include <opie2/otodoaccess.h> | ||
35 | #include <qpe/qcopenvelope_qws.h> | ||
35 | 36 | ||
36 | //#include "opimfactory.h" | 37 | /* QT */ |
37 | #include <opie2/opimresolver.h> | 38 | #include <qcopchannel_qws.h> |
38 | 39 | ||
39 | namespace Opie { | 40 | namespace Opie { |
40 | 41 | ||
diff --git a/libopie2/opiepim/core/opimresolver.h b/libopie2/opiepim/core/opimresolver.h index adc7c16..dd6f07f 100644 --- a/libopie2/opiepim/core/opimresolver.h +++ b/libopie2/opiepim/core/opimresolver.h | |||
@@ -26,14 +26,16 @@ | |||
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 | #ifndef OPIE_PIM_RESOLVER | 29 | #ifndef OPIMRESOLVER_H |
30 | #define OPIE_PIM_RESOLVER | 30 | #define OPIMRESOLVER_H |
31 | 31 | ||
32 | /* OPIE */ | ||
33 | #include <opie2/otemplatebase.h> | ||
34 | |||
35 | /* QT */ | ||
32 | #include <qstring.h> | 36 | #include <qstring.h> |
33 | #include <qvaluelist.h> | 37 | #include <qvaluelist.h> |
34 | 38 | ||
35 | #include <opie2/otemplatebase.h> | ||
36 | |||
37 | namespace Opie { | 39 | namespace Opie { |
38 | /** | 40 | /** |
39 | * OPimResolver is a MetaClass to access | 41 | * OPimResolver is a MetaClass to access |
@@ -47,6 +49,7 @@ namespace Opie { | |||
47 | * USING XML is a waste of memory!!!!! | 49 | * USING XML is a waste of memory!!!!! |
48 | */ | 50 | */ |
49 | class OPimResolver { | 51 | class OPimResolver { |
52 | |||
50 | public: | 53 | public: |
51 | enum BuiltIn { TodoList = 0, | 54 | enum BuiltIn { TodoList = 0, |
52 | DateBook, | 55 | DateBook, |
@@ -100,6 +103,7 @@ public: | |||
100 | */ | 103 | */ |
101 | OPimBase* backend( const QString& service ); | 104 | OPimBase* backend( const QString& service ); |
102 | OPimBase* backend( int rtti ); | 105 | OPimBase* backend( int rtti ); |
106 | |||
103 | private: | 107 | private: |
104 | OPimResolver(); | 108 | OPimResolver(); |
105 | void loadData(); | 109 | void loadData(); |
diff --git a/libopie2/opiepim/core/opimstate.cpp b/libopie2/opiepim/core/opimstate.cpp index 1013a1c..8aff558 100644 --- a/libopie2/opiepim/core/opimstate.cpp +++ b/libopie2/opiepim/core/opimstate.cpp | |||
@@ -26,10 +26,11 @@ | |||
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 | #include <qshared.h> | ||
30 | |||
31 | #include "opimstate.h" | 29 | #include "opimstate.h" |
32 | 30 | ||
31 | /* QT */ | ||
32 | #include <qshared.h> | ||
33 | |||
33 | namespace Opie { | 34 | namespace Opie { |
34 | /* | 35 | /* |
35 | * for one int this does not make | 36 | * for one int this does not make |
diff --git a/libopie2/opiepim/core/opimstate.h b/libopie2/opiepim/core/opimstate.h index 78e8cd0..8336b3e 100644 --- a/libopie2/opiepim/core/opimstate.h +++ b/libopie2/opiepim/core/opimstate.h | |||
@@ -26,9 +26,10 @@ | |||
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 | #ifndef OPIE_PIM_STATE_H | 29 | #ifndef OPIMSTATE_H |
30 | #define OPIE_PIM_STATE_H | 30 | #define OPIMSTATE_H |
31 | 31 | ||
32 | /* QT */ | ||
32 | #include <qstring.h> | 33 | #include <qstring.h> |
33 | 34 | ||
34 | namespace Opie { | 35 | namespace Opie { |
@@ -44,6 +45,7 @@ namespace Opie { | |||
44 | * ;) | 45 | * ;) |
45 | */ | 46 | */ |
46 | class OPimState { | 47 | class OPimState { |
48 | |||
47 | public: | 49 | public: |
48 | enum State { | 50 | enum State { |
49 | Started = 0, | 51 | Started = 0, |
@@ -60,6 +62,7 @@ public: | |||
60 | OPimState &operator=( const OPimState& ); | 62 | OPimState &operator=( const OPimState& ); |
61 | void setState( int state); | 63 | void setState( int state); |
62 | int state()const; | 64 | int state()const; |
65 | |||
63 | private: | 66 | private: |
64 | void deref(); | 67 | void deref(); |
65 | inline void copyInternally(); | 68 | inline void copyInternally(); |
diff --git a/libopie2/opiepim/core/opimxref.cpp b/libopie2/opiepim/core/opimxref.cpp index 85d3345..f58ebb5 100644 --- a/libopie2/opiepim/core/opimxref.cpp +++ b/libopie2/opiepim/core/opimxref.cpp | |||
@@ -26,7 +26,7 @@ | |||
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 | #include <opie2/opimxref.h> | 29 | #include "opimxref.h" |
30 | 30 | ||
31 | namespace Opie { | 31 | namespace Opie { |
32 | 32 | ||
@@ -36,22 +36,25 @@ OPimXRef::OPimXRef( const OPimXRefPartner& one, const OPimXRefPartner& two ) | |||
36 | m_partners[0] = one; | 36 | m_partners[0] = one; |
37 | m_partners[1] = two; | 37 | m_partners[1] = two; |
38 | } | 38 | } |
39 | OPimXRef::OPimXRef() | 39 | OPimXRef::OPimXRef():m_partners(2) |
40 | : m_partners(2) | ||
41 | { | 40 | { |
42 | 41 | ||
43 | } | 42 | } |
43 | |||
44 | OPimXRef::OPimXRef( const OPimXRef& ref) { | 44 | OPimXRef::OPimXRef( const OPimXRef& ref) { |
45 | *this = ref; | 45 | *this = ref; |
46 | } | 46 | } |
47 | |||
47 | OPimXRef::~OPimXRef() { | 48 | OPimXRef::~OPimXRef() { |
48 | } | 49 | } |
50 | |||
49 | OPimXRef &OPimXRef::operator=( const OPimXRef& ref) { | 51 | OPimXRef &OPimXRef::operator=( const OPimXRef& ref) { |
50 | m_partners = ref.m_partners; | 52 | m_partners = ref.m_partners; |
51 | m_partners.detach(); | 53 | m_partners.detach(); |
52 | 54 | ||
53 | return* this; | 55 | return* this; |
54 | } | 56 | } |
57 | |||
55 | bool OPimXRef::operator==( const OPimXRef& oper ) { | 58 | bool OPimXRef::operator==( const OPimXRef& oper ) { |
56 | if ( m_partners == oper.m_partners ) return true; | 59 | if ( m_partners == oper.m_partners ) return true; |
57 | 60 | ||
@@ -60,15 +63,18 @@ bool OPimXRef::operator==( const OPimXRef& oper ) { | |||
60 | OPimXRefPartner OPimXRef::partner( enum Partners par) const{ | 63 | OPimXRefPartner OPimXRef::partner( enum Partners par) const{ |
61 | return m_partners[par]; | 64 | return m_partners[par]; |
62 | } | 65 | } |
66 | |||
63 | void OPimXRef::setPartner( enum Partners par, const OPimXRefPartner& part) { | 67 | void OPimXRef::setPartner( enum Partners par, const OPimXRefPartner& part) { |
64 | m_partners[par] = part; | 68 | m_partners[par] = part; |
65 | } | 69 | } |
70 | |||
66 | bool OPimXRef::containsString( const QString& string ) const{ | 71 | bool OPimXRef::containsString( const QString& string ) const{ |
67 | if ( m_partners[One].service() == string || | 72 | if ( m_partners[One].service() == string || |
68 | m_partners[Two].service() == string ) return true; | 73 | m_partners[Two].service() == string ) return true; |
69 | 74 | ||
70 | return false; | 75 | return false; |
71 | } | 76 | } |
77 | |||
72 | bool OPimXRef::containsUid( int uid ) const{ | 78 | bool OPimXRef::containsUid( int uid ) const{ |
73 | if ( m_partners[One].uid() == uid || | 79 | if ( m_partners[One].uid() == uid || |
74 | m_partners[Two].uid() == uid ) return true; | 80 | m_partners[Two].uid() == uid ) return true; |
diff --git a/libopie2/opiepim/core/opimxref.h b/libopie2/opiepim/core/opimxref.h index 820c9c4..f3e814e 100644 --- a/libopie2/opiepim/core/opimxref.h +++ b/libopie2/opiepim/core/opimxref.h | |||
@@ -27,14 +27,16 @@ | |||
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef OPIM_XREF_H | 30 | #ifndef OPIMXREF_H |
31 | #define OPIM_XREF_H | 31 | #define OPIMXREF_H |
32 | 32 | ||
33 | /* OPIE */ | ||
34 | #include <opie2/opimxrefpartner.h> | ||
35 | |||
36 | /* QT */ | ||
33 | #include <qarray.h> | 37 | #include <qarray.h> |
34 | #include <qvaluelist.h> | 38 | #include <qvaluelist.h> |
35 | 39 | ||
36 | #include <opie2/opimxrefpartner.h> | ||
37 | |||
38 | namespace Opie { | 40 | namespace Opie { |
39 | /** | 41 | /** |
40 | * this is a Cross Referecne between | 42 | * this is a Cross Referecne between |
diff --git a/libopie2/opiepim/core/opimxrefmanager.cpp b/libopie2/opiepim/core/opimxrefmanager.cpp index bf6fed6..e7c6c5a 100644 --- a/libopie2/opiepim/core/opimxrefmanager.cpp +++ b/libopie2/opiepim/core/opimxrefmanager.cpp | |||
@@ -26,39 +26,48 @@ | |||
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 | #include <opie2/opimxrefmanager.h> | 29 | #include "opimxrefmanager.h" |
30 | 30 | ||
31 | namespace Opie { | 31 | namespace Opie { |
32 | 32 | ||
33 | OPimXRefManager::OPimXRefManager() { | 33 | OPimXRefManager::OPimXRefManager() { |
34 | } | 34 | } |
35 | |||
35 | OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) { | 36 | OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) { |
36 | m_list = ref.m_list; | 37 | m_list = ref.m_list; |
37 | } | 38 | } |
39 | |||
38 | OPimXRefManager::~OPimXRefManager() { | 40 | OPimXRefManager::~OPimXRefManager() { |
39 | } | 41 | } |
42 | |||
40 | OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) { | 43 | OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) { |
41 | m_list = ref.m_list; | 44 | m_list = ref.m_list; |
42 | return *this; | 45 | return *this; |
43 | } | 46 | } |
47 | |||
44 | bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) { | 48 | bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) { |
45 | // if ( m_list == ref.m_list ) return true; | 49 | // if ( m_list == ref.m_list ) return true; |
46 | 50 | ||
47 | return false; | 51 | return false; |
48 | } | 52 | } |
53 | |||
49 | void OPimXRefManager::add( const OPimXRef& ref) { | 54 | void OPimXRefManager::add( const OPimXRef& ref) { |
50 | m_list.append( ref ); | 55 | m_list.append( ref ); |
51 | } | 56 | } |
57 | |||
52 | void OPimXRefManager::remove( const OPimXRef& ref) { | 58 | void OPimXRefManager::remove( const OPimXRef& ref) { |
53 | m_list.remove( ref ); | 59 | m_list.remove( ref ); |
54 | } | 60 | } |
61 | |||
55 | void OPimXRefManager::replace( const OPimXRef& ref) { | 62 | void OPimXRefManager::replace( const OPimXRef& ref) { |
56 | m_list.remove( ref ); | 63 | m_list.remove( ref ); |
57 | m_list.append( ref ); | 64 | m_list.append( ref ); |
58 | } | 65 | } |
66 | |||
59 | void OPimXRefManager::clear() { | 67 | void OPimXRefManager::clear() { |
60 | m_list.clear(); | 68 | m_list.clear(); |
61 | } | 69 | } |
70 | |||
62 | QStringList OPimXRefManager::apps()const { | 71 | QStringList OPimXRefManager::apps()const { |
63 | OPimXRef::ValueList::ConstIterator it; | 72 | OPimXRef::ValueList::ConstIterator it; |
64 | QStringList list; | 73 | QStringList list; |
@@ -73,9 +82,11 @@ QStringList OPimXRefManager::apps()const { | |||
73 | } | 82 | } |
74 | return list; | 83 | return list; |
75 | } | 84 | } |
85 | |||
76 | OPimXRef::ValueList OPimXRefManager::list()const { | 86 | OPimXRef::ValueList OPimXRefManager::list()const { |
77 | return m_list; | 87 | return m_list; |
78 | } | 88 | } |
89 | |||
79 | OPimXRef::ValueList OPimXRefManager::list( const QString& appName )const{ | 90 | OPimXRef::ValueList OPimXRefManager::list( const QString& appName )const{ |
80 | OPimXRef::ValueList list; | 91 | OPimXRef::ValueList list; |
81 | OPimXRef::ValueList::ConstIterator it; | 92 | OPimXRef::ValueList::ConstIterator it; |
@@ -87,6 +98,7 @@ OPimXRef::ValueList OPimXRefManager::list( const QString& appName )const{ | |||
87 | 98 | ||
88 | return list; | 99 | return list; |
89 | } | 100 | } |
101 | |||
90 | OPimXRef::ValueList OPimXRefManager::list( int uid )const { | 102 | OPimXRef::ValueList OPimXRefManager::list( int uid )const { |
91 | OPimXRef::ValueList list; | 103 | OPimXRef::ValueList list; |
92 | OPimXRef::ValueList::ConstIterator it; | 104 | OPimXRef::ValueList::ConstIterator it; |
diff --git a/libopie2/opiepim/core/opimxrefmanager.h b/libopie2/opiepim/core/opimxrefmanager.h index fa2d7f4..b80a645 100644 --- a/libopie2/opiepim/core/opimxrefmanager.h +++ b/libopie2/opiepim/core/opimxrefmanager.h | |||
@@ -26,13 +26,16 @@ | |||
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 | #ifndef OPIM_XREF_MANAGER_H | ||
30 | #define OPIM_XREF_MANAGER_H | ||
31 | 29 | ||
32 | #include <qstringlist.h> | 30 | #ifndef OPIMXREFMANAGER_H |
31 | #define OPIMXREFMANAGER_H | ||
33 | 32 | ||
33 | /* OPIE */ | ||
34 | #include <opie2/opimxref.h> | 34 | #include <opie2/opimxref.h> |
35 | 35 | ||
36 | /* QT */ | ||
37 | #include <qstringlist.h> | ||
38 | |||
36 | namespace Opie { | 39 | namespace Opie { |
37 | /** | 40 | /** |
38 | * This is a simple manager for | 41 | * This is a simple manager for |
diff --git a/libopie2/opiepim/core/opimxrefpartner.cpp b/libopie2/opiepim/core/opimxrefpartner.cpp index f6ccc7f..3741bc3 100644 --- a/libopie2/opiepim/core/opimxrefpartner.cpp +++ b/libopie2/opiepim/core/opimxrefpartner.cpp | |||
@@ -26,7 +26,7 @@ | |||
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 | #include <opie2/opimxrefpartner.h> | 29 | #include "opimxrefpartner.h" |
30 | 30 | ||
31 | namespace Opie { | 31 | namespace Opie { |
32 | 32 | ||
@@ -34,11 +34,14 @@ OPimXRefPartner::OPimXRefPartner( const QString& appName, | |||
34 | int uid, int field ) | 34 | int uid, int field ) |
35 | : m_app(appName), m_uid(uid), m_field( field ) { | 35 | : m_app(appName), m_uid(uid), m_field( field ) { |
36 | } | 36 | } |
37 | |||
37 | OPimXRefPartner::OPimXRefPartner( const OPimXRefPartner& ref ) { | 38 | OPimXRefPartner::OPimXRefPartner( const OPimXRefPartner& ref ) { |
38 | *this = ref; | 39 | *this = ref; |
39 | } | 40 | } |
41 | |||
40 | OPimXRefPartner::~OPimXRefPartner() { | 42 | OPimXRefPartner::~OPimXRefPartner() { |
41 | } | 43 | } |
44 | |||
42 | OPimXRefPartner &OPimXRefPartner::operator=( const OPimXRefPartner& par ) { | 45 | OPimXRefPartner &OPimXRefPartner::operator=( const OPimXRefPartner& par ) { |
43 | m_app = par.m_app; | 46 | m_app = par.m_app; |
44 | m_uid = par.m_uid; | 47 | m_uid = par.m_uid; |
@@ -46,6 +49,7 @@ OPimXRefPartner &OPimXRefPartner::operator=( const OPimXRefPartner& par ) { | |||
46 | 49 | ||
47 | return *this; | 50 | return *this; |
48 | } | 51 | } |
52 | |||
49 | bool OPimXRefPartner::operator==( const OPimXRefPartner& par ) { | 53 | bool OPimXRefPartner::operator==( const OPimXRefPartner& par ) { |
50 | if ( m_app != par.m_app ) return false; | 54 | if ( m_app != par.m_app ) return false; |
51 | if ( m_uid != par.m_uid ) return false; | 55 | if ( m_uid != par.m_uid ) return false; |
@@ -53,21 +57,27 @@ bool OPimXRefPartner::operator==( const OPimXRefPartner& par ) { | |||
53 | 57 | ||
54 | return true; | 58 | return true; |
55 | } | 59 | } |
60 | |||
56 | QString OPimXRefPartner::service()const { | 61 | QString OPimXRefPartner::service()const { |
57 | return m_app; | 62 | return m_app; |
58 | } | 63 | } |
64 | |||
59 | int OPimXRefPartner::uid()const { | 65 | int OPimXRefPartner::uid()const { |
60 | return m_uid; | 66 | return m_uid; |
61 | } | 67 | } |
68 | |||
62 | int OPimXRefPartner::field()const { | 69 | int OPimXRefPartner::field()const { |
63 | return m_field; | 70 | return m_field; |
64 | } | 71 | } |
72 | |||
65 | void OPimXRefPartner::setService( const QString& appName ) { | 73 | void OPimXRefPartner::setService( const QString& appName ) { |
66 | m_app = appName; | 74 | m_app = appName; |
67 | } | 75 | } |
76 | |||
68 | void OPimXRefPartner::setUid( int uid ) { | 77 | void OPimXRefPartner::setUid( int uid ) { |
69 | m_uid = uid; | 78 | m_uid = uid; |
70 | } | 79 | } |
80 | |||
71 | void OPimXRefPartner::setField( int field ) { | 81 | void OPimXRefPartner::setField( int field ) { |
72 | m_field = field; | 82 | m_field = field; |
73 | } | 83 | } |
diff --git a/libopie2/opiepim/core/opimxrefpartner.h b/libopie2/opiepim/core/opimxrefpartner.h index 6853d5b..005dbc0 100644 --- a/libopie2/opiepim/core/opimxrefpartner.h +++ b/libopie2/opiepim/core/opimxrefpartner.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #ifndef OPIM_XREF_PARTNER_H | 29 | #ifndef OPIM_XREF_PARTNER_H |
30 | #define OPIM_XREF_PARTNER_H | 30 | #define OPIM_XREF_PARTNER_H |
31 | 31 | ||
32 | /* QT */ | ||
32 | #include <qstring.h> | 33 | #include <qstring.h> |
33 | 34 | ||
34 | namespace Opie { | 35 | namespace Opie { |
@@ -40,6 +41,7 @@ namespace Opie { | |||
40 | * with one tableId( fieldId ) to another. | 41 | * with one tableId( fieldId ) to another. |
41 | */ | 42 | */ |
42 | class OPimXRefPartner { | 43 | class OPimXRefPartner { |
44 | |||
43 | public: | 45 | public: |
44 | OPimXRefPartner( const QString& service = QString::null, | 46 | OPimXRefPartner( const QString& service = QString::null, |
45 | int uid = 0, int field = -1 ); | 47 | int uid = 0, int field = -1 ); |
@@ -56,6 +58,7 @@ public: | |||
56 | void setService( const QString& service ); | 58 | void setService( const QString& service ); |
57 | void setUid( int uid ); | 59 | void setUid( int uid ); |
58 | void setField( int field ); | 60 | void setField( int field ); |
61 | |||
59 | private: | 62 | private: |
60 | QString m_app; | 63 | QString m_app; |
61 | int m_uid; | 64 | int m_uid; |
diff --git a/libopie2/opiepim/core/orecur.cpp b/libopie2/opiepim/core/orecur.cpp index 033f264..5e2da25 100644 --- a/libopie2/opiepim/core/orecur.cpp +++ b/libopie2/opiepim/core/orecur.cpp | |||
@@ -27,16 +27,20 @@ | |||
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <time.h> | 30 | #include "orecur.h" |
31 | 31 | ||
32 | #include <qshared.h> | 32 | /* OPIE */ |
33 | #include <opie2/otimezone.h> | ||
34 | #include <qpe/timeconversion.h> | ||
33 | 35 | ||
34 | #include <qtopia/timeconversion.h> | 36 | /* QT */ |
37 | #include <qshared.h> | ||
35 | 38 | ||
36 | #include <opie2/otimezone.h> | 39 | /* STD */ |
37 | #include <opie2/orecur.h> | 40 | #include <time.h> |
38 | 41 | ||
39 | namespace Opie { | 42 | namespace Opie { |
43 | |||
40 | struct ORecur::Data : public QShared { | 44 | struct ORecur::Data : public QShared { |
41 | Data() : QShared() { | 45 | Data() : QShared() { |
42 | type = ORecur::NoRepeat; | 46 | type = ORecur::NoRepeat; |
@@ -77,21 +81,29 @@ ORecur::ORecur( const ORecur& rec) | |||
77 | { | 81 | { |
78 | data->ref(); | 82 | data->ref(); |
79 | } | 83 | } |
84 | |||
85 | |||
80 | ORecur::~ORecur() { | 86 | ORecur::~ORecur() { |
81 | if ( data->deref() ) { | 87 | if ( data->deref() ) { |
82 | delete data; | 88 | delete data; |
83 | data = 0l; | 89 | data = 0l; |
84 | } | 90 | } |
85 | } | 91 | } |
92 | |||
93 | |||
86 | void ORecur::deref() { | 94 | void ORecur::deref() { |
87 | if ( data->deref() ) { | 95 | if ( data->deref() ) { |
88 | delete data; | 96 | delete data; |
89 | data = 0l; | 97 | data = 0l; |
90 | } | 98 | } |
91 | } | 99 | } |
100 | |||
101 | |||
92 | bool ORecur::operator==( const ORecur& )const { | 102 | bool ORecur::operator==( const ORecur& )const { |
93 | return false; | 103 | return false; |
94 | } | 104 | } |
105 | |||
106 | |||
95 | ORecur &ORecur::operator=( const ORecur& re) { | 107 | ORecur &ORecur::operator=( const ORecur& re) { |
96 | if ( *this == re ) return *this; | 108 | if ( *this == re ) return *this; |
97 | 109 | ||
@@ -101,9 +113,13 @@ ORecur &ORecur::operator=( const ORecur& re) { | |||
101 | 113 | ||
102 | return *this; | 114 | return *this; |
103 | } | 115 | } |
116 | |||
117 | |||
104 | bool ORecur::doesRecur()const { | 118 | bool ORecur::doesRecur()const { |
105 | return !( type() == NoRepeat ); | 119 | return !( type() == NoRepeat ); |
106 | } | 120 | } |
121 | |||
122 | |||
107 | /* | 123 | /* |
108 | * we try to be smart here | 124 | * we try to be smart here |
109 | * | 125 | * |
@@ -118,6 +134,8 @@ bool ORecur::doesRecur( const QDate& date ) { | |||
118 | 134 | ||
119 | return (recur == date); | 135 | return (recur == date); |
120 | } | 136 | } |
137 | |||
138 | |||
121 | // FIXME unuglify! | 139 | // FIXME unuglify! |
122 | // GPL from Datebookdb.cpp | 140 | // GPL from Datebookdb.cpp |
123 | // FIXME exception list! | 141 | // FIXME exception list! |
@@ -129,6 +147,8 @@ bool ORecur::nextOcurrence( const QDate& from, QDate& next ) { | |||
129 | 147 | ||
130 | return stillLooking; | 148 | return stillLooking; |
131 | } | 149 | } |
150 | |||
151 | |||
132 | bool ORecur::p_nextOccurrence( const QDate& from, QDate& next ) { | 152 | bool ORecur::p_nextOccurrence( const QDate& from, QDate& next ) { |
133 | 153 | ||
134 | // easy checks, first are we too far in the future or too far in the past? | 154 | // easy checks, first are we too far in the future or too far in the past? |
@@ -401,79 +421,123 @@ bool ORecur::p_nextOccurrence( const QDate& from, QDate& next ) { | |||
401 | return FALSE; | 421 | return FALSE; |
402 | } | 422 | } |
403 | } | 423 | } |
424 | |||
425 | |||
404 | ORecur::RepeatType ORecur::type()const{ | 426 | ORecur::RepeatType ORecur::type()const{ |
405 | return data->type; | 427 | return data->type; |
406 | } | 428 | } |
429 | |||
430 | |||
407 | int ORecur::frequency()const { | 431 | int ORecur::frequency()const { |
408 | return data->freq; | 432 | return data->freq; |
409 | } | 433 | } |
434 | |||
435 | |||
410 | int ORecur::position()const { | 436 | int ORecur::position()const { |
411 | return data->pos; | 437 | return data->pos; |
412 | } | 438 | } |
439 | |||
440 | |||
413 | char ORecur::days() const{ | 441 | char ORecur::days() const{ |
414 | return data->days; | 442 | return data->days; |
415 | } | 443 | } |
444 | |||
445 | |||
416 | bool ORecur::hasEndDate()const { | 446 | bool ORecur::hasEndDate()const { |
417 | return data->hasEnd; | 447 | return data->hasEnd; |
418 | } | 448 | } |
449 | |||
450 | |||
419 | QDate ORecur::endDate()const { | 451 | QDate ORecur::endDate()const { |
420 | return data->end; | 452 | return data->end; |
421 | } | 453 | } |
454 | |||
455 | |||
422 | QDate ORecur::start()const{ | 456 | QDate ORecur::start()const{ |
423 | return data->start; | 457 | return data->start; |
424 | } | 458 | } |
459 | |||
460 | |||
425 | QDateTime ORecur::createdDateTime()const { | 461 | QDateTime ORecur::createdDateTime()const { |
426 | return data->create; | 462 | return data->create; |
427 | } | 463 | } |
464 | |||
465 | |||
428 | int ORecur::repetition()const { | 466 | int ORecur::repetition()const { |
429 | return data->rep; | 467 | return data->rep; |
430 | } | 468 | } |
469 | |||
470 | |||
431 | QString ORecur::service()const { | 471 | QString ORecur::service()const { |
432 | return data->app; | 472 | return data->app; |
433 | } | 473 | } |
474 | |||
475 | |||
434 | ORecur::ExceptionList& ORecur::exceptions() { | 476 | ORecur::ExceptionList& ORecur::exceptions() { |
435 | return data->list; | 477 | return data->list; |
436 | } | 478 | } |
479 | |||
480 | |||
437 | void ORecur::setType( const RepeatType& z) { | 481 | void ORecur::setType( const RepeatType& z) { |
438 | checkOrModify(); | 482 | checkOrModify(); |
439 | data->type = z; | 483 | data->type = z; |
440 | } | 484 | } |
485 | |||
486 | |||
441 | void ORecur::setFrequency( int freq ) { | 487 | void ORecur::setFrequency( int freq ) { |
442 | checkOrModify(); | 488 | checkOrModify(); |
443 | data->freq = freq; | 489 | data->freq = freq; |
444 | } | 490 | } |
491 | |||
492 | |||
445 | void ORecur::setPosition( int pos ) { | 493 | void ORecur::setPosition( int pos ) { |
446 | checkOrModify(); | 494 | checkOrModify(); |
447 | data->pos = pos; | 495 | data->pos = pos; |
448 | } | 496 | } |
497 | |||
498 | |||
449 | void ORecur::setDays( char c ) { | 499 | void ORecur::setDays( char c ) { |
450 | checkOrModify(); | 500 | checkOrModify(); |
451 | data->days = c; | 501 | data->days = c; |
452 | } | 502 | } |
503 | |||
504 | |||
453 | void ORecur::setEndDate( const QDate& dt) { | 505 | void ORecur::setEndDate( const QDate& dt) { |
454 | checkOrModify(); | 506 | checkOrModify(); |
455 | data->end = dt; | 507 | data->end = dt; |
456 | } | 508 | } |
509 | |||
510 | |||
457 | void ORecur::setCreatedDateTime( const QDateTime& t) { | 511 | void ORecur::setCreatedDateTime( const QDateTime& t) { |
458 | checkOrModify(); | 512 | checkOrModify(); |
459 | data->create = t; | 513 | data->create = t; |
460 | } | 514 | } |
515 | |||
516 | |||
461 | void ORecur::setHasEndDate( bool b) { | 517 | void ORecur::setHasEndDate( bool b) { |
462 | checkOrModify(); | 518 | checkOrModify(); |
463 | data->hasEnd = b; | 519 | data->hasEnd = b; |
464 | } | 520 | } |
521 | |||
522 | |||
465 | void ORecur::setRepitition( int rep ) { | 523 | void ORecur::setRepitition( int rep ) { |
466 | checkOrModify(); | 524 | checkOrModify(); |
467 | data->rep = rep; | 525 | data->rep = rep; |
468 | } | 526 | } |
527 | |||
528 | |||
469 | void ORecur::setService( const QString& app ) { | 529 | void ORecur::setService( const QString& app ) { |
470 | checkOrModify(); | 530 | checkOrModify(); |
471 | data->app = app; | 531 | data->app = app; |
472 | } | 532 | } |
533 | |||
534 | |||
473 | void ORecur::setStart( const QDate& dt ) { | 535 | void ORecur::setStart( const QDate& dt ) { |
474 | checkOrModify(); | 536 | checkOrModify(); |
475 | data->start = dt; | 537 | data->start = dt; |
476 | } | 538 | } |
539 | |||
540 | |||
477 | void ORecur::checkOrModify() { | 541 | void ORecur::checkOrModify() { |
478 | if ( data->count != 1 ) { | 542 | if ( data->count != 1 ) { |
479 | data->deref(); | 543 | data->deref(); |
@@ -492,6 +556,8 @@ void ORecur::checkOrModify() { | |||
492 | data = d2; | 556 | data = d2; |
493 | } | 557 | } |
494 | } | 558 | } |
559 | |||
560 | |||
495 | QString ORecur::toString()const { | 561 | QString ORecur::toString()const { |
496 | QString buf; | 562 | QString buf; |
497 | QMap<int, QString> recMap = toMap(); | 563 | QMap<int, QString> recMap = toMap(); |
diff --git a/libopie2/opiepim/core/orecur.h b/libopie2/opiepim/core/orecur.h index 60508f5..7808897 100644 --- a/libopie2/opiepim/core/orecur.h +++ b/libopie2/opiepim/core/orecur.h | |||
@@ -27,15 +27,16 @@ | |||
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef OPIE_RECUR_H | 30 | #ifndef ORECUR_H |
31 | #define OPIE_RECUR_H | 31 | #define ORECUR_H |
32 | |||
33 | #include <sys/types.h> | ||
34 | 32 | ||
33 | /* QT */ | ||
35 | #include <qdatetime.h> | 34 | #include <qdatetime.h> |
36 | #include <qvaluelist.h> | 35 | #include <qvaluelist.h> |
37 | #include <qmap.h> | 36 | #include <qmap.h> |
38 | 37 | ||
38 | /* STD */ | ||
39 | #include <sys/types.h> | ||
39 | 40 | ||
40 | namespace Opie { | 41 | namespace Opie { |
41 | /** | 42 | /** |
@@ -43,6 +44,7 @@ namespace Opie { | |||
43 | */ | 44 | */ |
44 | 45 | ||
45 | class ORecur { | 46 | class ORecur { |
47 | |||
46 | public: | 48 | public: |
47 | typedef QValueList<QDate> ExceptionList; | 49 | typedef QValueList<QDate> ExceptionList; |
48 | enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay, | 50 | enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay, |
@@ -114,6 +116,7 @@ public: | |||
114 | 116 | ||
115 | /* almost internal */ | 117 | /* almost internal */ |
116 | QString toString()const; | 118 | QString toString()const; |
119 | |||
117 | private: | 120 | private: |
118 | bool p_nextOccurrence( const QDate& from, QDate& next ); | 121 | bool p_nextOccurrence( const QDate& from, QDate& next ); |
119 | void deref(); | 122 | void deref(); |
diff --git a/libopie2/opiepim/core/otemplatebase.h b/libopie2/opiepim/core/otemplatebase.h index 17d9961..58cbfeb 100644 --- a/libopie2/opiepim/core/otemplatebase.h +++ b/libopie2/opiepim/core/otemplatebase.h | |||
@@ -26,13 +26,14 @@ | |||
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 | #ifndef OPIE_TEMPLATE_BASE_H | 29 | #ifndef OTEMPLATEBASE_H |
30 | #define OPIE_TEMPLATE_BASE_H | 30 | #define OTEMPLATEBASE_H |
31 | |||
32 | #include <qarray.h> | ||
33 | 31 | ||
32 | /* OPIE */ | ||
34 | #include <opie2/opimrecord.h> | 33 | #include <opie2/opimrecord.h> |
35 | 34 | ||
35 | /* QT */ | ||
36 | #include <qarray.h> | ||
36 | 37 | ||
37 | namespace Opie { | 38 | namespace Opie { |
38 | /** | 39 | /** |
diff --git a/libopie2/opiepim/core/otimezone.cpp b/libopie2/opiepim/core/otimezone.cpp index dab68af..e67715f 100644 --- a/libopie2/opiepim/core/otimezone.cpp +++ b/libopie2/opiepim/core/otimezone.cpp | |||
@@ -27,25 +27,29 @@ | |||
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "otimezone.h" | ||
31 | |||
32 | /* STD */ | ||
30 | #include <stdio.h> | 33 | #include <stdio.h> |
31 | #include <stdlib.h> | 34 | #include <stdlib.h> |
32 | |||
33 | #include <sys/types.h> | 35 | #include <sys/types.h> |
34 | 36 | ||
35 | #include <opie2/otimezone.h> | 37 | namespace Opie |
38 | { | ||
36 | 39 | ||
37 | namespace Opie { | 40 | QDateTime utcTime( time_t t ) |
38 | 41 | { | |
39 | QDateTime utcTime( time_t t) { | ||
40 | tm* broken = ::gmtime( &t ); | 42 | tm* broken = ::gmtime( &t ); |
41 | QDateTime ret; | 43 | QDateTime ret; |
42 | ret.setDate( QDate( broken->tm_year + 1900, broken->tm_mon +1, broken->tm_mday ) ); | 44 | ret.setDate( QDate( broken->tm_year + 1900, broken->tm_mon +1, broken->tm_mday ) ); |
43 | ret.setTime( QTime( broken->tm_hour, broken->tm_min, broken->tm_sec ) ); | 45 | ret.setTime( QTime( broken->tm_hour, broken->tm_min, broken->tm_sec ) ); |
44 | return ret; | 46 | return ret; |
45 | } | 47 | } |
46 | QDateTime utcTime( time_t t, const QString& zone) { | 48 | QDateTime utcTime( time_t t, const QString& zone ) |
49 | { | ||
47 | QCString org = ::getenv( "TZ" ); | 50 | QCString org = ::getenv( "TZ" ); |
48 | #ifndef Q_OS_MACX // Following line causes bus errors on Mac | 51 | #ifndef Q_OS_MACX // Following line causes bus errors on Mac |
52 | |||
49 | ::setenv( "TZ", zone.latin1(), true ); | 53 | ::setenv( "TZ", zone.latin1(), true ); |
50 | ::tzset(); | 54 | ::tzset(); |
51 | 55 | ||
@@ -53,6 +57,7 @@ namespace Opie { | |||
53 | ::setenv( "TZ", org, true ); | 57 | ::setenv( "TZ", org, true ); |
54 | #else | 58 | #else |
55 | #warning "Need a replacement for MacOSX!!" | 59 | #warning "Need a replacement for MacOSX!!" |
60 | |||
56 | tm* broken = ::localtime( &t ); | 61 | tm* broken = ::localtime( &t ); |
57 | #endif | 62 | #endif |
58 | 63 | ||
@@ -62,7 +67,8 @@ namespace Opie { | |||
62 | 67 | ||
63 | return ret; | 68 | return ret; |
64 | } | 69 | } |
65 | time_t to_Time_t( const QDateTime& utc, const QString& str ) { | 70 | time_t to_Time_t( const QDateTime& utc, const QString& str ) |
71 | { | ||
66 | QDate d = utc.date(); | 72 | QDate d = utc.date(); |
67 | QTime t = utc.time(); | 73 | QTime t = utc.time(); |
68 | 74 | ||
@@ -76,6 +82,7 @@ namespace Opie { | |||
76 | 82 | ||
77 | QCString org = ::getenv( "TZ" ); | 83 | QCString org = ::getenv( "TZ" ); |
78 | #ifndef Q_OS_MACX // Following line causes bus errors on Mac | 84 | #ifndef Q_OS_MACX // Following line causes bus errors on Mac |
85 | |||
79 | ::setenv( "TZ", str.latin1(), true ); | 86 | ::setenv( "TZ", str.latin1(), true ); |
80 | ::tzset(); | 87 | ::tzset(); |
81 | 88 | ||
@@ -83,20 +90,27 @@ namespace Opie { | |||
83 | ::setenv( "TZ", org, true ); | 90 | ::setenv( "TZ", org, true ); |
84 | #else | 91 | #else |
85 | #warning "Need a replacement for MacOSX!!" | 92 | #warning "Need a replacement for MacOSX!!" |
93 | |||
86 | time_t ti = ::mktime( &broken ); | 94 | time_t ti = ::mktime( &broken ); |
87 | #endif | 95 | #endif |
96 | |||
88 | return ti; | 97 | return ti; |
89 | } | 98 | } |
90 | } | 99 | } |
91 | 100 | ||
92 | namespace Opie { | 101 | namespace Opie |
102 | { | ||
93 | OTimeZone::OTimeZone( const ZoneName& zone ) | 103 | OTimeZone::OTimeZone( const ZoneName& zone ) |
94 | : m_name(zone) { | 104 | : m_name( zone ) |
95 | } | 105 | {} |
96 | OTimeZone::~OTimeZone() { | 106 | |
97 | } | 107 | |
108 | OTimeZone::~OTimeZone() | ||
109 | {} | ||
98 | 110 | ||
99 | bool OTimeZone::isValid()const { | 111 | |
112 | bool OTimeZone::isValid() const | ||
113 | { | ||
100 | return !m_name.isEmpty(); | 114 | return !m_name.isEmpty(); |
101 | } | 115 | } |
102 | 116 | ||
@@ -104,42 +118,70 @@ bool OTimeZone::isValid()const { | |||
104 | * we will get the current timezone | 118 | * we will get the current timezone |
105 | * and ask it to convert to the timezone date | 119 | * and ask it to convert to the timezone date |
106 | */ | 120 | */ |
107 | QDateTime OTimeZone::toLocalDateTime( const QDateTime& dt) { | 121 | QDateTime OTimeZone::toLocalDateTime( const QDateTime& dt ) |
122 | { | ||
108 | return OTimeZone::current().toDateTime( dt, *this ); | 123 | return OTimeZone::current().toDateTime( dt, *this ); |
109 | } | 124 | } |
110 | QDateTime OTimeZone::toUTCDateTime( const QDateTime& dt ) { | 125 | |
126 | |||
127 | QDateTime OTimeZone::toUTCDateTime( const QDateTime& dt ) | ||
128 | { | ||
111 | return OTimeZone::utc().toDateTime( dt, *this ); | 129 | return OTimeZone::utc().toDateTime( dt, *this ); |
112 | } | 130 | } |
113 | QDateTime OTimeZone::fromUTCDateTime( time_t t) { | 131 | |
132 | |||
133 | QDateTime OTimeZone::fromUTCDateTime( time_t t ) | ||
134 | { | ||
114 | return utcTime( t ); | 135 | return utcTime( t ); |
115 | } | 136 | } |
116 | QDateTime OTimeZone::toDateTime( time_t t) { | 137 | |
138 | |||
139 | QDateTime OTimeZone::toDateTime( time_t t ) | ||
140 | { | ||
117 | return utcTime( t, m_name ); | 141 | return utcTime( t, m_name ); |
118 | } | 142 | } |
143 | |||
144 | |||
119 | /* | 145 | /* |
120 | * convert dt to utc using zone.m_name | 146 | * convert dt to utc using zone.m_name |
121 | * convert utc -> timeZoneDT using this->m_name | 147 | * convert utc -> timeZoneDT using this->m_name |
122 | */ | 148 | */ |
123 | QDateTime OTimeZone::toDateTime( const QDateTime& dt, const OTimeZone& zone ) { | 149 | QDateTime OTimeZone::toDateTime( const QDateTime& dt, const OTimeZone& zone ) |
150 | { | ||
124 | time_t utc = to_Time_t( dt, zone.m_name ); | 151 | time_t utc = to_Time_t( dt, zone.m_name ); |
125 | qWarning("%d %s", utc, zone.m_name.latin1() ); | 152 | qWarning("%d %s", utc, zone.m_name.latin1() ); |
126 | return utcTime( utc, m_name ); | 153 | return utcTime( utc, m_name ); |
127 | } | 154 | } |
128 | time_t OTimeZone::fromDateTime( const QDateTime& time ) { | 155 | |
156 | |||
157 | time_t OTimeZone::fromDateTime( const QDateTime& time ) | ||
158 | { | ||
129 | return to_Time_t( time, m_name ); | 159 | return to_Time_t( time, m_name ); |
130 | } | 160 | } |
131 | time_t OTimeZone::fromUTCDateTime( const QDateTime& time ) { | 161 | |
162 | |||
163 | time_t OTimeZone::fromUTCDateTime( const QDateTime& time ) | ||
164 | { | ||
132 | return to_Time_t( time, "UTC" ); | 165 | return to_Time_t( time, "UTC" ); |
133 | } | 166 | } |
134 | OTimeZone OTimeZone::current() { | 167 | |
168 | |||
169 | OTimeZone OTimeZone::current() | ||
170 | { | ||
135 | QCString str = ::getenv("TZ"); | 171 | QCString str = ::getenv("TZ"); |
136 | OTimeZone zone( str ); | 172 | OTimeZone zone( str ); |
137 | return zone; | 173 | return zone; |
138 | } | 174 | } |
139 | OTimeZone OTimeZone::utc() { | 175 | |
176 | |||
177 | OTimeZone OTimeZone::utc() | ||
178 | { | ||
140 | return OTimeZone("UTC"); | 179 | return OTimeZone("UTC"); |
141 | } | 180 | } |
142 | QString OTimeZone::timeZone()const { | 181 | |
182 | |||
183 | QString OTimeZone::timeZone() const | ||
184 | { | ||
143 | return m_name; | 185 | return m_name; |
144 | } | 186 | } |
145 | 187 | ||
diff --git a/libopie2/opiepim/core/otimezone.h b/libopie2/opiepim/core/otimezone.h index 28ae6cb..f0b4022 100644 --- a/libopie2/opiepim/core/otimezone.h +++ b/libopie2/opiepim/core/otimezone.h | |||
@@ -27,12 +27,15 @@ | |||
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef OPIE_TIME_ZONE_H | 30 | #ifndef OTIMEZONE_H |
31 | #define OPIE_TIME_ZONE_H | 31 | #define OTIMEZONE_H |
32 | 32 | ||
33 | #include <time.h> | 33 | /* QT */ |
34 | #include <qdatetime.h> | 34 | #include <qdatetime.h> |
35 | 35 | ||
36 | /* STD */ | ||
37 | #include <time.h> | ||
38 | |||
36 | namespace Opie | 39 | namespace Opie |
37 | { | 40 | { |
38 | /** | 41 | /** |
@@ -42,6 +45,7 @@ namespace Opie | |||
42 | * and time_t | 45 | * and time_t |
43 | */ | 46 | */ |
44 | class OTimeZone { | 47 | class OTimeZone { |
48 | |||
45 | public: | 49 | public: |
46 | typedef QString ZoneName; | 50 | typedef QString ZoneName; |
47 | OTimeZone( const ZoneName& = ZoneName::null ); | 51 | OTimeZone( const ZoneName& = ZoneName::null ); |
@@ -92,6 +96,7 @@ class OTimeZone { | |||
92 | static OTimeZone utc(); | 96 | static OTimeZone utc(); |
93 | 97 | ||
94 | QString timeZone()const; | 98 | QString timeZone()const; |
99 | |||
95 | private: | 100 | private: |
96 | ZoneName m_name; | 101 | ZoneName m_name; |
97 | class Private; | 102 | class Private; |
diff --git a/libopie2/opieui/otabwidget.h b/libopie2/opieui/otabwidget.h index 51d1c6d..c7d32c2 100644 --- a/libopie2/opieui/otabwidget.h +++ b/libopie2/opieui/otabwidget.h | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | Copyright (C) 2002 Dan Williams <williamsdr@acm.org> | |
4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | ||
5 | =. | 4 | =. |
6 | .=l. | 5 | .=l. |
7 | .>+-= | 6 | .>+-= |
@@ -69,8 +68,8 @@ class OTabBar; | |||
69 | class OTabWidget : public QWidget | 68 | class OTabWidget : public QWidget |
70 | { | 69 | { |
71 | Q_OBJECT | 70 | Q_OBJECT |
72 | public: | ||
73 | 71 | ||
72 | public: | ||
74 | /** | 73 | /** |
75 | * @enum TabStyle | 74 | * @enum TabStyle |
76 | * @brief Defines how the widget selection control is displayed. | 75 | * @brief Defines how the widget selection control is displayed. |
@@ -107,7 +106,6 @@ public: | |||
107 | * Constructs a new OTabWidget control with parent and name. The style and position parameters | 106 | * Constructs a new OTabWidget control with parent and name. The style and position parameters |
108 | * determine how the widget selection control will be displayed. | 107 | * determine how the widget selection control will be displayed. |
109 | */ | 108 | */ |
110 | // FIXME WFlags? -zecke | ||
111 | OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top ); | 109 | OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top ); |
112 | 110 | ||
113 | /** | 111 | /** |
diff --git a/libopie2/opieui/owait.cpp b/libopie2/opieui/owait.cpp index 0fdf08d..8bb4ed6 100644 --- a/libopie2/opieui/owait.cpp +++ b/libopie2/opieui/owait.cpp | |||
@@ -1,32 +1,43 @@ | |||
1 | /* This file is part of the OPIE libraries | 1 | /* |
2 | Copyright (C) 2003 Maximilian Reiss (harlekin@handhelds.org) | 2 | This file is part of the Opie Project |
3 | 3 | Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org> | |
4 | This library is free software; you can redistribute it and/or | 4 | =. |
5 | modify it under the terms of the GNU Library General Public | 5 | .=l. |
6 | License as published by the Free Software Foundation; either | 6 | .>+-= |
7 | version 2 of the License, or (at your option) any later version. | 7 | _;:, .> :=|. This program is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | This library is distributed in the hope that it will be useful, | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | Library General Public License for more details. | 12 | ._= =} : or (at your option) any later version. |
13 | 13 | .%`+i> _;_. | |
14 | You should have received a copy of the GNU Library General Public License | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
17 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
18 | */ | ||
19 | 28 | ||
20 | #include <qlabel.h> | 29 | */ |
21 | #include <qlayout.h> | ||
22 | #include <qtimer.h> | ||
23 | #include <qpe/qpeapplication.h> | ||
24 | #include <qpainter.h> | ||
25 | 30 | ||
26 | #include "owait.h" | 31 | #include "owait.h" |
27 | 32 | ||
33 | /* OPIE */ | ||
34 | #include <qpe/qpeapplication.h> | ||
28 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
29 | 36 | ||
37 | /* QT */ | ||
38 | #include <qlayout.h> | ||
39 | #include <qpainter.h> | ||
40 | |||
30 | static int frame = 0; | 41 | static int frame = 0; |
31 | 42 | ||
32 | /** | 43 | /** |
@@ -39,7 +50,8 @@ static int frame = 0; | |||
39 | * @param dispIcon Display Icon? | 50 | * @param dispIcon Display Icon? |
40 | */ | 51 | */ |
41 | OWait::OWait(QWidget *parent, const char* msg, bool dispIcon ) | 52 | OWait::OWait(QWidget *parent, const char* msg, bool dispIcon ) |
42 | :QDialog(parent, msg, TRUE,WStyle_Customize) { | 53 | :QDialog( parent, msg, TRUE, WStyle_Customize ) |
54 | { | ||
43 | 55 | ||
44 | 56 | ||
45 | QHBoxLayout *hbox = new QHBoxLayout( this ); | 57 | QHBoxLayout *hbox = new QHBoxLayout( this ); |
@@ -60,17 +72,20 @@ OWait::OWait(QWidget *parent, const char* msg, bool dispIcon ) | |||
60 | connect( m_waitTimer, SIGNAL( timeout() ), this, SLOT( hide() ) ); | 72 | connect( m_waitTimer, SIGNAL( timeout() ), this, SLOT( hide() ) ); |
61 | } | 73 | } |
62 | 74 | ||
63 | void OWait::timerEvent( QTimerEvent * ) { | 75 | void OWait::timerEvent( QTimerEvent * ) |
76 | { | ||
64 | frame = (++frame) % 4; | 77 | frame = (++frame) % 4; |
65 | repaint(); | 78 | repaint(); |
66 | } | 79 | } |
67 | 80 | ||
68 | void OWait::paintEvent( QPaintEvent * ) { | 81 | void OWait::paintEvent( QPaintEvent * ) |
82 | { | ||
69 | QPainter p( m_lb ); | 83 | QPainter p( m_lb ); |
70 | p.drawPixmap( 0, 0, m_pix, m_aniSize * frame, 0, m_aniSize, m_aniSize ); | 84 | p.drawPixmap( 0, 0, m_pix, m_aniSize * frame, 0, m_aniSize, m_aniSize ); |
71 | } | 85 | } |
72 | 86 | ||
73 | void OWait::show() { | 87 | void OWait::show() |
88 | { | ||
74 | 89 | ||
75 | move( ( ( qApp->desktop()->width() ) / 2 ) - ( m_aniSize / 2 ), ( ( qApp->desktop()->height() ) / 2 ) - ( m_aniSize / 2 ) ); | 90 | move( ( ( qApp->desktop()->width() ) / 2 ) - ( m_aniSize / 2 ), ( ( qApp->desktop()->height() ) / 2 ) - ( m_aniSize / 2 ) ); |
76 | startTimer( 300 ); | 91 | startTimer( 300 ); |
@@ -78,16 +93,18 @@ void OWait::show() { | |||
78 | QDialog::show(); | 93 | QDialog::show(); |
79 | } | 94 | } |
80 | 95 | ||
81 | void OWait::hide() { | 96 | void OWait::hide() |
97 | { | ||
82 | killTimers(); | 98 | killTimers(); |
83 | m_waitTimer->stop(); | 99 | m_waitTimer->stop(); |
84 | frame = 0; | 100 | frame = 0; |
85 | QDialog::hide(); | 101 | QDialog::hide(); |
86 | } | 102 | } |
87 | 103 | ||
88 | void OWait::setTimerLength( int length ) { | 104 | void OWait::setTimerLength( int length ) |
105 | { | ||
89 | m_timerLength = length; | 106 | m_timerLength = length; |
90 | } | 107 | } |
91 | 108 | ||
92 | OWait::~OWait() { | 109 | OWait::~OWait() |
93 | } | 110 | {} |
diff --git a/libopie2/opieui/owait.h b/libopie2/opieui/owait.h index cbfc8d6..3267064 100644 --- a/libopie2/opieui/owait.h +++ b/libopie2/opieui/owait.h | |||
@@ -1,30 +1,40 @@ | |||
1 | /* This file is part of the OPIE libraries | 1 | /* |
2 | Copyright (C) 2003 Maximilian Reiss (harlekin@handhelds.org) | 2 | This file is part of the Opie Project |
3 | 3 | Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org> | |
4 | This library is free software; you can redistribute it and/or | 4 | =. |
5 | modify it under the terms of the GNU Library General Public | 5 | .=l. |
6 | License as published by the Free Software Foundation; either | 6 | .>+-= |
7 | version 2 of the License, or (at your option) any later version. | 7 | _;:, .> :=|. This program is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | This library is distributed in the hope that it will be useful, | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | Library General Public License for more details. | 12 | ._= =} : or (at your option) any later version. |
13 | 13 | .%`+i> _;_. | |
14 | You should have received a copy of the GNU Library General Public License | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
17 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
18 | */ | ||
19 | |||
20 | 28 | ||
29 | */ | ||
21 | 30 | ||
22 | #ifndef WAITPOPUP_H | 31 | #ifndef OWAIT_H |
23 | #define WAITPOPUP_H | 32 | #define OWAIT_H |
24 | 33 | ||
34 | /* QT */ | ||
25 | #include <qdialog.h> | 35 | #include <qdialog.h> |
26 | #include <qpixmap.h> | ||
27 | #include <qlabel.h> | 36 | #include <qlabel.h> |
37 | #include <qpixmap.h> | ||
28 | #include <qtimer.h> | 38 | #include <qtimer.h> |
29 | 39 | ||
30 | /** | 40 | /** |
@@ -34,12 +44,11 @@ | |||
34 | * @see QDialog | 44 | * @see QDialog |
35 | * @author Maximilian Reiß | 45 | * @author Maximilian Reiß |
36 | */ | 46 | */ |
37 | class OWait : public QDialog { | 47 | class OWait : public QDialog |
38 | 48 | { | |
39 | Q_OBJECT | 49 | Q_OBJECT |
40 | 50 | ||
41 | public: | 51 | public: |
42 | // FIXME Wflags -zecke? | ||
43 | OWait(QWidget *parent=0,const char* name=0, bool dispIcon=TRUE); | 52 | OWait(QWidget *parent=0,const char* name=0, bool dispIcon=TRUE); |
44 | ~OWait(); | 53 | ~OWait(); |
45 | 54 | ||