author | sandman <sandman> | 2002-11-26 23:34:04 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-11-26 23:34:04 (UTC) |
commit | e52158d2f9e1fdc9766d991dc672729648d5a020 (patch) (unidiff) | |
tree | 2e87e8d9a24cdb336b2d7ca654a5ffa2f80c5f8c /library | |
parent | ac4f32931212847803534a72eb5e951bd01e6ff5 (diff) | |
download | opie-e52158d2f9e1fdc9766d991dc672729648d5a020.zip opie-e52158d2f9e1fdc9766d991dc672729648d5a020.tar.gz opie-e52158d2f9e1fdc9766d991dc672729648d5a020.tar.bz2 |
Sharp ROM compatibilty upgrade:
All these functions are needed to get qtmail (from the Sharp ROM) running
on Opie - I have even tested qtmail on an iPAQ and it seems to work ..
-rw-r--r-- | library/config.cpp | 12 | ||||
-rw-r--r-- | library/config.h | 5 | ||||
-rw-r--r-- | library/datebookmonth.cpp | 12 | ||||
-rw-r--r-- | library/datebookmonth.h | 15 | ||||
-rw-r--r-- | library/qpemenubar.cpp | 9 | ||||
-rw-r--r-- | library/qpemenubar.h | 7 |
6 files changed, 59 insertions, 1 deletions
diff --git a/library/config.cpp b/library/config.cpp index 1121cd4..b47c620 100644 --- a/library/config.cpp +++ b/library/config.cpp | |||
@@ -89,32 +89,44 @@ QString Config::configFilename(const QString& name, Domain d) | |||
89 | the configuration is user-specific. \a name should not contain "/" in | 89 | the configuration is user-specific. \a name should not contain "/" in |
90 | this case, and in general should be the name of the C++ class that is | 90 | this case, and in general should be the name of the C++ class that is |
91 | primarily responsible for maintaining the configuration. | 91 | primarily responsible for maintaining the configuration. |
92 | 92 | ||
93 | In the File Domain, \a name is an absolute filename. | 93 | In the File Domain, \a name is an absolute filename. |
94 | */ | 94 | */ |
95 | Config::Config( const QString &name, Domain domain ) | 95 | Config::Config( const QString &name, Domain domain ) |
96 | : filename( configFilename(name,domain) ) | 96 | : filename( configFilename(name,domain) ) |
97 | { | 97 | { |
98 | git = groups.end(); | 98 | git = groups.end(); |
99 | read(); | 99 | read(); |
100 | QStringList l = Global::languageList(); | 100 | QStringList l = Global::languageList(); |
101 | lang = l[0]; | 101 | lang = l[0]; |
102 | glang = l[1]; | 102 | glang = l[1]; |
103 | } | 103 | } |
104 | 104 | ||
105 | |||
106 | // Sharp ROM compatibility | ||
107 | Config::Config ( const QString &name, bool what ) | ||
108 | : filename( configFilename(name,what ? User : File) ) | ||
109 | { | ||
110 | git = groups.end(); | ||
111 | read(); | ||
112 | QStringList l = Global::languageList(); | ||
113 | lang = l[0]; | ||
114 | glang = l[1]; | ||
115 | } | ||
116 | |||
105 | /*! | 117 | /*! |
106 | Writes any changes to disk and destroys the in-memory object. | 118 | Writes any changes to disk and destroys the in-memory object. |
107 | */ | 119 | */ |
108 | Config::~Config() | 120 | Config::~Config() |
109 | { | 121 | { |
110 | if ( changed ) | 122 | if ( changed ) |
111 | write(); | 123 | write(); |
112 | } | 124 | } |
113 | 125 | ||
114 | /*! | 126 | /*! |
115 | Returns whether the current group has an entry called \a key. | 127 | Returns whether the current group has an entry called \a key. |
116 | */ | 128 | */ |
117 | bool Config::hasKey( const QString &key ) const | 129 | bool Config::hasKey( const QString &key ) const |
118 | { | 130 | { |
119 | if ( groups.end() == git ) | 131 | if ( groups.end() == git ) |
120 | return FALSE; | 132 | return FALSE; |
diff --git a/library/config.h b/library/config.h index 1dc32fa..0bab7ca 100644 --- a/library/config.h +++ b/library/config.h | |||
@@ -22,33 +22,33 @@ | |||
22 | #define CONFIG_H | 22 | #define CONFIG_H |
23 | 23 | ||
24 | // ##### could use QSettings with Qt 3.0 | 24 | // ##### could use QSettings with Qt 3.0 |
25 | 25 | ||
26 | #include <qmap.h> | 26 | #include <qmap.h> |
27 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
28 | 28 | ||
29 | class ConfigPrivate; | 29 | class ConfigPrivate; |
30 | class Config | 30 | class Config |
31 | { | 31 | { |
32 | public: | 32 | public: |
33 | typedef QMap< QString, QString > ConfigGroup; | 33 | typedef QMap< QString, QString > ConfigGroup; |
34 | 34 | ||
35 | enum Domain { File, User }; | 35 | enum Domain { File, User }; |
36 | Config( const QString &name, Domain domain=User ); | 36 | Config( const QString &name, Domain domain=User ); |
37 | ~Config(); | 37 | ~Config(); |
38 | 38 | ||
39 | bool operator == ( const Config & other ) const { return (filename == other.filename); } | 39 | bool operator == ( const Config & other ) const { return (filename == other.filename); } |
40 | bool operator != ( const Config & other ) const { return (filename != other.filename); } | 40 | bool operator != ( const Config & other ) const { return (filename != other.filename); } |
41 | 41 | ||
42 | bool isValid() const; | 42 | bool isValid() const; |
43 | bool hasKey( const QString &key ) const; | 43 | bool hasKey( const QString &key ) const; |
44 | 44 | ||
45 | void setGroup( const QString &gname ); | 45 | void setGroup( const QString &gname ); |
46 | void writeEntry( const QString &key, const char* value ); | 46 | void writeEntry( const QString &key, const char* value ); |
47 | void writeEntry( const QString &key, const QString &value ); | 47 | void writeEntry( const QString &key, const QString &value ); |
48 | void writeEntryCrypt( const QString &key, const QString &value ); | 48 | void writeEntryCrypt( const QString &key, const QString &value ); |
49 | void writeEntry( const QString &key, int num ); | 49 | void writeEntry( const QString &key, int num ); |
50 | #ifdef Q_HAS_BOOL_TYPE | 50 | #ifdef Q_HAS_BOOL_TYPE |
51 | void writeEntry( const QString &key, bool b ); | 51 | void writeEntry( const QString &key, bool b ); |
52 | #endif | 52 | #endif |
53 | void writeEntry( const QString &key, const QStringList &lst, const QChar &sep ); | 53 | void writeEntry( const QString &key, const QStringList &lst, const QChar &sep ); |
54 | void removeEntry( const QString &key ); | 54 | void removeEntry( const QString &key ); |
@@ -71,32 +71,35 @@ public: | |||
71 | void clearGroup(); | 71 | void clearGroup(); |
72 | 72 | ||
73 | void write( const QString &fn = QString::null ); | 73 | void write( const QString &fn = QString::null ); |
74 | 74 | ||
75 | protected: | 75 | protected: |
76 | void read(); | 76 | void read(); |
77 | bool parse( const QString &line ); | 77 | bool parse( const QString &line ); |
78 | 78 | ||
79 | QMap< QString, ConfigGroup > groups; | 79 | QMap< QString, ConfigGroup > groups; |
80 | QMap< QString, ConfigGroup >::Iterator git; | 80 | QMap< QString, ConfigGroup >::Iterator git; |
81 | QString filename; | 81 | QString filename; |
82 | QString lang; | 82 | QString lang; |
83 | QString glang; | 83 | QString glang; |
84 | bool changed; | 84 | bool changed; |
85 | ConfigPrivate *d; | 85 | ConfigPrivate *d; |
86 | static QString configFilename(const QString& name, Domain); | 86 | static QString configFilename(const QString& name, Domain); |
87 | |||
88 | private: // Sharp ROM compatibility | ||
89 | Config( const QString &name, bool what ); | ||
87 | }; | 90 | }; |
88 | 91 | ||
89 | inline QString Config::readEntry( const QString &key, const QString &deflt ) const | 92 | inline QString Config::readEntry( const QString &key, const QString &deflt ) const |
90 | { return ((Config*)this)->readEntry(key,deflt); } | 93 | { return ((Config*)this)->readEntry(key,deflt); } |
91 | inline QString Config::readEntryCrypt( const QString &key, const QString &deflt ) const | 94 | inline QString Config::readEntryCrypt( const QString &key, const QString &deflt ) const |
92 | { return ((Config*)this)->readEntryCrypt(key,deflt); } | 95 | { return ((Config*)this)->readEntryCrypt(key,deflt); } |
93 | inline QString Config::readEntryDirect( const QString &key, const QString &deflt ) const | 96 | inline QString Config::readEntryDirect( const QString &key, const QString &deflt ) const |
94 | { return ((Config*)this)->readEntryDirect(key,deflt); } | 97 | { return ((Config*)this)->readEntryDirect(key,deflt); } |
95 | inline int Config::readNumEntry( const QString &key, int deflt ) const | 98 | inline int Config::readNumEntry( const QString &key, int deflt ) const |
96 | { return ((Config*)this)->readNumEntry(key,deflt); } | 99 | { return ((Config*)this)->readNumEntry(key,deflt); } |
97 | inline bool Config::readBoolEntry( const QString &key, bool deflt ) const | 100 | inline bool Config::readBoolEntry( const QString &key, bool deflt ) const |
98 | { return ((Config*)this)->readBoolEntry(key,deflt); } | 101 | { return ((Config*)this)->readBoolEntry(key,deflt); } |
99 | inline QStringList Config::readListEntry( const QString &key, const QChar &sep ) const | 102 | inline QStringList Config::readListEntry( const QString &key, const QChar &sep ) const |
100 | { return ((Config*)this)->readListEntry(key,sep); } | 103 | { return ((Config*)this)->readListEntry(key,sep); } |
101 | 104 | ||
102 | #endif | 105 | #endif |
diff --git a/library/datebookmonth.cpp b/library/datebookmonth.cpp index 4a9dcbd..e8be313 100644 --- a/library/datebookmonth.cpp +++ b/library/datebookmonth.cpp | |||
@@ -735,16 +735,28 @@ void DateButton::setDate( QDate d ) | |||
735 | setText( longFormat ? TimeString::longDateString( d, df ) : | 735 | setText( longFormat ? TimeString::longDateString( d, df ) : |
736 | TimeString::shortDate( d, df ) ); | 736 | TimeString::shortDate( d, df ) ); |
737 | 737 | ||
738 | } | 738 | } |
739 | 739 | ||
740 | void DateButton::setDateFormat( DateFormat f ) | 740 | void DateButton::setDateFormat( DateFormat f ) |
741 | { | 741 | { |
742 | df = f; | 742 | df = f; |
743 | setDate( currDate ); | 743 | setDate( currDate ); |
744 | } | 744 | } |
745 | 745 | ||
746 | bool DateButton::customWhatsThis() const | 746 | bool DateButton::customWhatsThis() const |
747 | { | 747 | { |
748 | return TRUE; | 748 | return TRUE; |
749 | } | 749 | } |
750 | 750 | ||
751 | |||
752 | // this class is only here for Sharp ROM compatibility | ||
753 | // I have reverse engineered this class and it seems to | ||
754 | // work (only qtmail seems to use it) - sandman | ||
755 | // DO NOT USE IT IN NEW CODE !! | ||
756 | |||
757 | DateBookMonthPopup::DateBookMonthPopup ( QWidget *w ) | ||
758 | : QPopupMenu ( w ) | ||
759 | { | ||
760 | m_dbm = new DateBookMonth( this, 0, TRUE ); | ||
761 | insertItem( m_dbm ); | ||
762 | } | ||
diff --git a/library/datebookmonth.h b/library/datebookmonth.h index 3c57c19..cb436a8 100644 --- a/library/datebookmonth.h +++ b/library/datebookmonth.h | |||
@@ -15,32 +15,33 @@ | |||
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef DATEBOOKMONTH | 20 | #ifndef DATEBOOKMONTH |
21 | #define DATEBOOKMONTH | 21 | #define DATEBOOKMONTH |
22 | 22 | ||
23 | #include <qtopia/private/event.h> | 23 | #include <qtopia/private/event.h> |
24 | 24 | ||
25 | #include <qvbox.h> | 25 | #include <qvbox.h> |
26 | #include <qhbox.h> | 26 | #include <qhbox.h> |
27 | #include <qdatetime.h> | 27 | #include <qdatetime.h> |
28 | #include <qvaluelist.h> | 28 | #include <qvaluelist.h> |
29 | #include <qtable.h> | 29 | #include <qtable.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | #include <qpopupmenu.h> | ||
31 | 32 | ||
32 | #include "calendar.h" | 33 | #include "calendar.h" |
33 | #include "timestring.h" | 34 | #include "timestring.h" |
34 | 35 | ||
35 | class QToolButton; | 36 | class QToolButton; |
36 | class QComboBox; | 37 | class QComboBox; |
37 | class QSpinBox; | 38 | class QSpinBox; |
38 | class Event; | 39 | class Event; |
39 | class DateBookDB; | 40 | class DateBookDB; |
40 | 41 | ||
41 | class DateBookMonthHeaderPrivate; | 42 | class DateBookMonthHeaderPrivate; |
42 | class DateBookMonthHeader : public QHBox | 43 | class DateBookMonthHeader : public QHBox |
43 | { | 44 | { |
44 | Q_OBJECT | 45 | Q_OBJECT |
45 | 46 | ||
46 | public: | 47 | public: |
@@ -196,18 +197,32 @@ public slots: | |||
196 | void setDate( int y, int m, int d ); | 197 | void setDate( int y, int m, int d ); |
197 | void setDate( QDate ); | 198 | void setDate( QDate ); |
198 | void setWeekStartsMonday( int ); | 199 | void setWeekStartsMonday( int ); |
199 | void setDateFormat( DateFormat ); | 200 | void setDateFormat( DateFormat ); |
200 | 201 | ||
201 | private slots: | 202 | private slots: |
202 | void pickDate(); | 203 | void pickDate(); |
203 | void gotHide(); | 204 | void gotHide(); |
204 | 205 | ||
205 | private: | 206 | private: |
206 | bool longFormat; | 207 | bool longFormat; |
207 | bool weekStartsMonday; | 208 | bool weekStartsMonday; |
208 | QDate currDate; | 209 | QDate currDate; |
209 | DateFormat df; | 210 | DateFormat df; |
210 | }; | 211 | }; |
211 | 212 | ||
213 | // this class is only here for Sharp ROM compatibility | ||
214 | // I have reverse engineered this class and it seems to | ||
215 | // work (only qtmail seems to use it) - sandman | ||
216 | // DO NOT USE IT IN NEW CODE !! | ||
217 | |||
218 | class DateBookMonthPopup : public QPopupMenu | ||
219 | { | ||
220 | Q_OBJECT | ||
221 | public: | ||
222 | DateBookMonthPopup ( QWidget *w ); | ||
223 | |||
224 | private: | ||
225 | DateBookMonth *m_dbm; | ||
226 | }; | ||
212 | 227 | ||
213 | #endif | 228 | #endif |
diff --git a/library/qpemenubar.cpp b/library/qpemenubar.cpp index c658d10..4aa0bf3 100644 --- a/library/qpemenubar.cpp +++ b/library/qpemenubar.cpp | |||
@@ -31,32 +31,41 @@ class QMenuBarHack : public QMenuBar | |||
31 | public: | 31 | public: |
32 | int activeItem() const { return actItem; } | 32 | int activeItem() const { return actItem; } |
33 | 33 | ||
34 | void goodbye() | 34 | void goodbye() |
35 | { | 35 | { |
36 | activateItemAt(-1); | 36 | activateItemAt(-1); |
37 | for ( unsigned int i = 0; i < count(); i++ ) { | 37 | for ( unsigned int i = 0; i < count(); i++ ) { |
38 | QMenuItem *mi = findItem( idAt(i) ); | 38 | QMenuItem *mi = findItem( idAt(i) ); |
39 | if ( mi->popup() ) { | 39 | if ( mi->popup() ) { |
40 | mi->popup()->hide(); | 40 | mi->popup()->hide(); |
41 | } | 41 | } |
42 | } | 42 | } |
43 | } | 43 | } |
44 | }; | 44 | }; |
45 | 45 | ||
46 | 46 | ||
47 | // Sharp ROM compatibility | ||
48 | void QPEMenuToolFocusManager::setMenukeyEnabled ( bool ) | ||
49 | { | ||
50 | } | ||
51 | int QPEMenuBar::getOldFocus ( ) | ||
52 | { | ||
53 | return 0; | ||
54 | } | ||
55 | |||
47 | QPEMenuToolFocusManager *QPEMenuToolFocusManager::me = 0; | 56 | QPEMenuToolFocusManager *QPEMenuToolFocusManager::me = 0; |
48 | 57 | ||
49 | QPEMenuToolFocusManager::QPEMenuToolFocusManager() : QObject() | 58 | QPEMenuToolFocusManager::QPEMenuToolFocusManager() : QObject() |
50 | { | 59 | { |
51 | qApp->installEventFilter( this ); | 60 | qApp->installEventFilter( this ); |
52 | } | 61 | } |
53 | 62 | ||
54 | void QPEMenuToolFocusManager::addWidget( QWidget *w ) | 63 | void QPEMenuToolFocusManager::addWidget( QWidget *w ) |
55 | { | 64 | { |
56 | list.append( GuardedWidget(w) ); | 65 | list.append( GuardedWidget(w) ); |
57 | } | 66 | } |
58 | 67 | ||
59 | void QPEMenuToolFocusManager::removeWidget( QWidget *w ) | 68 | void QPEMenuToolFocusManager::removeWidget( QWidget *w ) |
60 | { | 69 | { |
61 | list.remove( GuardedWidget(w) ); | 70 | list.remove( GuardedWidget(w) ); |
62 | } | 71 | } |
diff --git a/library/qpemenubar.h b/library/qpemenubar.h index 05abc4e..66d0c85 100644 --- a/library/qpemenubar.h +++ b/library/qpemenubar.h | |||
@@ -40,39 +40,46 @@ public: | |||
40 | static QPEMenuToolFocusManager *manager(); | 40 | static QPEMenuToolFocusManager *manager(); |
41 | static void initialize(); | 41 | static void initialize(); |
42 | 42 | ||
43 | protected: | 43 | protected: |
44 | void setFocus( QWidget *w, bool next=TRUE ); | 44 | void setFocus( QWidget *w, bool next=TRUE ); |
45 | bool eventFilter( QObject *object, QEvent *event ); | 45 | bool eventFilter( QObject *object, QEvent *event ); |
46 | 46 | ||
47 | private slots: | 47 | private slots: |
48 | void deactivate(); | 48 | void deactivate(); |
49 | 49 | ||
50 | private: | 50 | private: |
51 | typedef QGuardedPtr<QWidget> GuardedWidget; | 51 | typedef QGuardedPtr<QWidget> GuardedWidget; |
52 | QValueList<GuardedWidget> list; | 52 | QValueList<GuardedWidget> list; |
53 | GuardedWidget inFocus; | 53 | GuardedWidget inFocus; |
54 | GuardedWidget oldFocus; | 54 | GuardedWidget oldFocus; |
55 | static QPEMenuToolFocusManager *me; | 55 | static QPEMenuToolFocusManager *me; |
56 | |||
57 | private: // Sharp ROM compatibility | ||
58 | void setMenukeyEnabled ( bool b ); | ||
56 | }; | 59 | }; |
57 | 60 | ||
58 | 61 | ||
59 | class QPEMenuBar : public QMenuBar | 62 | class QPEMenuBar : public QMenuBar |
60 | { | 63 | { |
61 | Q_OBJECT | 64 | Q_OBJECT |
62 | public: | 65 | public: |
63 | QPEMenuBar( QWidget *parent=0, const char* name=0 ); | 66 | QPEMenuBar( QWidget *parent=0, const char* name=0 ); |
64 | ~QPEMenuBar(); | 67 | ~QPEMenuBar(); |
65 | 68 | ||
66 | protected: | 69 | protected: |
67 | virtual void keyPressEvent( QKeyEvent *e ); | 70 | virtual void keyPressEvent( QKeyEvent *e ); |
68 | 71 | ||
69 | /* Patch from Mickey | 72 | /* Patch from Mickey |
70 | * Sharp Qtopia1.5 seems to have these functions | 73 | * Sharp Qtopia1.5 seems to have these functions |
71 | * TO BE RESOLVED - zecke | 74 | * TO BE RESOLVED - zecke |
72 | */ | 75 | */ |
73 | void activateItem( int index ); | 76 | void activateItem( int index ); |
74 | void goodbye(); | 77 | void goodbye(); |
78 | |||
79 | // This is a special "lineo" add-on for the Sharp ROM | ||
80 | // nobody knows, what it does, though ... | ||
81 | int getOldFocus ( ); | ||
75 | }; | 82 | }; |
76 | 83 | ||
77 | #endif | 84 | #endif |
78 | 85 | ||