summaryrefslogtreecommitdiff
path: root/library
Unidiff
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/config.cpp12
-rw-r--r--library/config.h5
-rw-r--r--library/datebookmonth.cpp12
-rw-r--r--library/datebookmonth.h15
-rw-r--r--library/qpemenubar.cpp9
-rw-r--r--library/qpemenubar.h7
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
@@ -9,192 +9,204 @@
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
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 20
21#include <qdir.h> 21#include <qdir.h>
22#include <qfile.h> 22#include <qfile.h>
23#include <qfileinfo.h> 23#include <qfileinfo.h>
24#include <qmessagebox.h> 24#include <qmessagebox.h>
25#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 25#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
26#include <qtextcodec.h> 26#include <qtextcodec.h>
27#endif 27#endif
28#include <qtextstream.h> 28#include <qtextstream.h>
29 29
30#include <sys/stat.h> 30#include <sys/stat.h>
31#include <sys/types.h> 31#include <sys/types.h>
32#include <fcntl.h> 32#include <fcntl.h>
33#include <stdlib.h> 33#include <stdlib.h>
34#include <unistd.h> 34#include <unistd.h>
35 35
36#define QTOPIA_INTERNAL_LANGLIST 36#define QTOPIA_INTERNAL_LANGLIST
37#include "config.h" 37#include "config.h"
38#include "global.h" 38#include "global.h"
39 39
40 40
41/*! 41/*!
42 \internal 42 \internal
43*/ 43*/
44QString Config::configFilename(const QString& name, Domain d) 44QString Config::configFilename(const QString& name, Domain d)
45{ 45{
46 switch (d) { 46 switch (d) {
47 case File: 47 case File:
48 return name; 48 return name;
49 case User: { 49 case User: {
50 QDir dir = (QString(getenv("HOME")) + "/Settings"); 50 QDir dir = (QString(getenv("HOME")) + "/Settings");
51 if ( !dir.exists() ) 51 if ( !dir.exists() )
52 mkdir(dir.path().local8Bit(),0700); 52 mkdir(dir.path().local8Bit(),0700);
53 return dir.path() + "/" + name + ".conf"; 53 return dir.path() + "/" + name + ".conf";
54 } 54 }
55 } 55 }
56 return name; 56 return name;
57} 57}
58 58
59/*! 59/*!
60 \class Config config.h 60 \class Config config.h
61 \brief The Config class provides for saving application cofniguration state. 61 \brief The Config class provides for saving application cofniguration state.
62 62
63 You should keep a Config in existence only while you do not want others 63 You should keep a Config in existence only while you do not want others
64 to be able to change the state. There is no locking currently, but there 64 to be able to change the state. There is no locking currently, but there
65 may be in the future. 65 may be in the future.
66*/ 66*/
67 67
68/*! 68/*!
69 \enum Config::ConfigGroup 69 \enum Config::ConfigGroup
70 \internal 70 \internal
71*/ 71*/
72 72
73/*! 73/*!
74 \enum Config::Domain 74 \enum Config::Domain
75 75
76 \value File 76 \value File
77 \value User 77 \value User
78 78
79 See Config for details. 79 See Config for details.
80*/ 80*/
81 81
82/*! 82/*!
83 Constructs a config that will load or create a configuration with the 83 Constructs a config that will load or create a configuration with the
84 given \a name in the given \a domain. 84 given \a name in the given \a domain.
85 85
86 You must call setGroup() before doing much else with the Config. 86 You must call setGroup() before doing much else with the Config.
87 87
88 In the default Domain, \e User, 88 In the default Domain, \e User,
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*/
95Config::Config( const QString &name, Domain domain ) 95Config::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
107Config::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*/
108Config::~Config() 120Config::~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*/
117bool Config::hasKey( const QString &key ) const 129bool Config::hasKey( const QString &key ) const
118{ 130{
119 if ( groups.end() == git ) 131 if ( groups.end() == git )
120 return FALSE; 132 return FALSE;
121 ConfigGroup::ConstIterator it = ( *git ).find( key ); 133 ConfigGroup::ConstIterator it = ( *git ).find( key );
122 return it != ( *git ).end(); 134 return it != ( *git ).end();
123} 135}
124 136
125/*! 137/*!
126 Sets the current group for subsequent reading and writing of 138 Sets the current group for subsequent reading and writing of
127 entries to \a gname. Grouping allows the application to partition the namespace. 139 entries to \a gname. Grouping allows the application to partition the namespace.
128 140
129 This function must be called prior to any reading or writing 141 This function must be called prior to any reading or writing
130 of entries. 142 of entries.
131 143
132 The \a gname must not be empty. 144 The \a gname must not be empty.
133*/ 145*/
134void Config::setGroup( const QString &gname ) 146void Config::setGroup( const QString &gname )
135{ 147{
136 QMap< QString, ConfigGroup>::Iterator it = groups.find( gname ); 148 QMap< QString, ConfigGroup>::Iterator it = groups.find( gname );
137 if ( it == groups.end() ) { 149 if ( it == groups.end() ) {
138 git = groups.insert( gname, ConfigGroup() ); 150 git = groups.insert( gname, ConfigGroup() );
139 changed = TRUE; 151 changed = TRUE;
140 return; 152 return;
141 } 153 }
142 git = it; 154 git = it;
143} 155}
144 156
145/*! 157/*!
146 Writes a (\a key, \a value) entry to the current group. 158 Writes a (\a key, \a value) entry to the current group.
147 159
148 \sa readEntry() 160 \sa readEntry()
149*/ 161*/
150void Config::writeEntry( const QString &key, const char* value ) 162void Config::writeEntry( const QString &key, const char* value )
151{ 163{
152 writeEntry(key,QString(value)); 164 writeEntry(key,QString(value));
153} 165}
154 166
155/*! 167/*!
156 Writes a (\a key, \a value) entry to the current group. 168 Writes a (\a key, \a value) entry to the current group.
157 169
158 \sa readEntry() 170 \sa readEntry()
159*/ 171*/
160void Config::writeEntry( const QString &key, const QString &value ) 172void Config::writeEntry( const QString &key, const QString &value )
161{ 173{
162 if ( git == groups.end() ) { 174 if ( git == groups.end() ) {
163 qWarning( "no group set" ); 175 qWarning( "no group set" );
164 return; 176 return;
165 } 177 }
166 if ( (*git)[key] != value ) { 178 if ( (*git)[key] != value ) {
167 ( *git ).insert( key, value ); 179 ( *git ).insert( key, value );
168 changed = TRUE; 180 changed = TRUE;
169 } 181 }
170} 182}
171 183
172/* 184/*
173 Note that the degree of protection offered by the encryption here is 185 Note that the degree of protection offered by the encryption here is
174 only sufficient to avoid the most casual observation of the configuration 186 only sufficient to avoid the most casual observation of the configuration
175 files. People with access to the files can write down the contents and 187 files. People with access to the files can write down the contents and
176 decrypt it using this source code. 188 decrypt it using this source code.
177 189
178 Conceivably, and at some burden to the user, this encryption could 190 Conceivably, and at some burden to the user, this encryption could
179 be improved. 191 be improved.
180*/ 192*/
181static QString encipher(const QString& plain) 193static QString encipher(const QString& plain)
182{ 194{
183 // mainly, we make it long 195 // mainly, we make it long
184 QString cipher; 196 QString cipher;
185 int mix=28730492; 197 int mix=28730492;
186 for (int i=0; i<(int)plain.length(); i++) { 198 for (int i=0; i<(int)plain.length(); i++) {
187 int u = plain[i].unicode(); 199 int u = plain[i].unicode();
188 int c = u ^ mix; 200 int c = u ^ mix;
189 QString x = QString::number(c,36); 201 QString x = QString::number(c,36);
190 cipher.append(QChar('a'+x.length())); 202 cipher.append(QChar('a'+x.length()));
191 cipher.append(x); 203 cipher.append(x);
192 mix *= u; 204 mix *= u;
193 } 205 }
194 return cipher; 206 return cipher;
195} 207}
196 208
197static QString decipher(const QString& cipher) 209static QString decipher(const QString& cipher)
198{ 210{
199 QString plain; 211 QString plain;
200 int mix=28730492; 212 int mix=28730492;
diff --git a/library/config.h b/library/config.h
index 1dc32fa..0bab7ca 100644
--- a/library/config.h
+++ b/library/config.h
@@ -1,102 +1,105 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
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 20
21#ifndef CONFIG_H 21#ifndef CONFIG_H
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
29class ConfigPrivate; 29class ConfigPrivate;
30class Config 30class Config
31{ 31{
32public: 32public:
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 );
55 55
56 QString readEntry( const QString &key, const QString &deflt = QString::null ) const; 56 QString readEntry( const QString &key, const QString &deflt = QString::null ) const;
57 QString readEntryCrypt( const QString &key, const QString &deflt = QString::null ) const; 57 QString readEntryCrypt( const QString &key, const QString &deflt = QString::null ) const;
58 QString readEntryDirect( const QString &key, const QString &deflt = QString::null ) const; 58 QString readEntryDirect( const QString &key, const QString &deflt = QString::null ) const;
59 int readNumEntry( const QString &key, int deflt = -1 ) const; 59 int readNumEntry( const QString &key, int deflt = -1 ) const;
60 bool readBoolEntry( const QString &key, bool deflt = FALSE ) const; 60 bool readBoolEntry( const QString &key, bool deflt = FALSE ) const;
61 QStringList readListEntry( const QString &key, const QChar &sep ) const; 61 QStringList readListEntry( const QString &key, const QChar &sep ) const;
62 62
63 // For compatibility, non-const versions. 63 // For compatibility, non-const versions.
64 QString readEntry( const QString &key, const QString &deflt ); 64 QString readEntry( const QString &key, const QString &deflt );
65 QString readEntryCrypt( const QString &key, const QString &deflt ); 65 QString readEntryCrypt( const QString &key, const QString &deflt );
66 QString readEntryDirect( const QString &key, const QString &deflt ); 66 QString readEntryDirect( const QString &key, const QString &deflt );
67 int readNumEntry( const QString &key, int deflt ); 67 int readNumEntry( const QString &key, int deflt );
68 bool readBoolEntry( const QString &key, bool deflt ); 68 bool readBoolEntry( const QString &key, bool deflt );
69 QStringList readListEntry( const QString &key, const QChar &sep ); 69 QStringList readListEntry( const QString &key, const QChar &sep );
70 70
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
75protected: 75protected:
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
88private: // Sharp ROM compatibility
89 Config( const QString &name, bool what );
87}; 90};
88 91
89inline QString Config::readEntry( const QString &key, const QString &deflt ) const 92inline QString Config::readEntry( const QString &key, const QString &deflt ) const
90{ return ((Config*)this)->readEntry(key,deflt); } 93{ return ((Config*)this)->readEntry(key,deflt); }
91inline QString Config::readEntryCrypt( const QString &key, const QString &deflt ) const 94inline QString Config::readEntryCrypt( const QString &key, const QString &deflt ) const
92{ return ((Config*)this)->readEntryCrypt(key,deflt); } 95{ return ((Config*)this)->readEntryCrypt(key,deflt); }
93inline QString Config::readEntryDirect( const QString &key, const QString &deflt ) const 96inline QString Config::readEntryDirect( const QString &key, const QString &deflt ) const
94{ return ((Config*)this)->readEntryDirect(key,deflt); } 97{ return ((Config*)this)->readEntryDirect(key,deflt); }
95inline int Config::readNumEntry( const QString &key, int deflt ) const 98inline int Config::readNumEntry( const QString &key, int deflt ) const
96{ return ((Config*)this)->readNumEntry(key,deflt); } 99{ return ((Config*)this)->readNumEntry(key,deflt); }
97inline bool Config::readBoolEntry( const QString &key, bool deflt ) const 100inline bool Config::readBoolEntry( const QString &key, bool deflt ) const
98{ return ((Config*)this)->readBoolEntry(key,deflt); } 101{ return ((Config*)this)->readBoolEntry(key,deflt); }
99inline QStringList Config::readListEntry( const QString &key, const QChar &sep ) const 102inline 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
@@ -655,96 +655,108 @@ void DayItemMonth::paint( QPainter *p, const QColorGroup &cg,
655 p->restore(); 655 p->restore();
656} 656}
657 657
658 658
659 659
660void DayItemMonth::setType( Calendar::Day::Type t ) 660void DayItemMonth::setType( Calendar::Day::Type t )
661{ 661{
662 switch ( t ) { 662 switch ( t ) {
663 case Calendar::Day::PrevMonth: 663 case Calendar::Day::PrevMonth:
664 case Calendar::Day::NextMonth: 664 case Calendar::Day::NextMonth:
665 back = QBrush( QColor( 224, 224, 224 ) ); 665 back = QBrush( QColor( 224, 224, 224 ) );
666 forg = black; 666 forg = black;
667 break; 667 break;
668 case Calendar::Day::ThisMonth: 668 case Calendar::Day::ThisMonth:
669 back = QBrush( white ); 669 back = QBrush( white );
670 forg = black; 670 forg = black;
671 break; 671 break;
672 } 672 }
673 typ = t; 673 typ = t;
674} 674}
675 675
676 676
677 677
678DateButton::DateButton( bool longDate, QWidget *parent, const char * name ) 678DateButton::DateButton( bool longDate, QWidget *parent, const char * name )
679 :QPushButton( parent, name ) 679 :QPushButton( parent, name )
680{ 680{
681 longFormat = longDate; 681 longFormat = longDate;
682 df = DateFormat('/', DateFormat::MonthDayYear, DateFormat::MonthDayYear); 682 df = DateFormat('/', DateFormat::MonthDayYear, DateFormat::MonthDayYear);
683 setDate( QDate::currentDate() ); 683 setDate( QDate::currentDate() );
684 684
685 connect(this,SIGNAL(pressed()),this,SLOT(pickDate())); 685 connect(this,SIGNAL(pressed()),this,SLOT(pickDate()));
686 686
687 687
688} 688}
689 689
690 690
691void DateButton::pickDate() 691void DateButton::pickDate()
692{ 692{
693 static QPopupMenu *m1 = 0; 693 static QPopupMenu *m1 = 0;
694 static DateBookMonth *picker = 0; 694 static DateBookMonth *picker = 0;
695 if ( !m1 ) { 695 if ( !m1 ) {
696 m1 = new QPopupMenu( this ); 696 m1 = new QPopupMenu( this );
697 picker = new DateBookMonth( m1, 0, TRUE ); 697 picker = new DateBookMonth( m1, 0, TRUE );
698 m1->insertItem( picker ); 698 m1->insertItem( picker );
699 connect( picker, SIGNAL( dateClicked( int, int, int ) ), 699 connect( picker, SIGNAL( dateClicked( int, int, int ) ),
700 this, SLOT( setDate( int, int, int ) ) ); 700 this, SLOT( setDate( int, int, int ) ) );
701 connect( picker, SIGNAL( dateClicked( int, int, int ) ), 701 connect( picker, SIGNAL( dateClicked( int, int, int ) ),
702 this, SIGNAL( dateSelected( int, int, int ) ) ); 702 this, SIGNAL( dateSelected( int, int, int ) ) );
703 connect( m1, SIGNAL( aboutToHide() ), 703 connect( m1, SIGNAL( aboutToHide() ),
704 this, SLOT( gotHide() ) ); 704 this, SLOT( gotHide() ) );
705 } 705 }
706 picker->slotWeekChange( weekStartsMonday ); 706 picker->slotWeekChange( weekStartsMonday );
707 picker->setDate( currDate.year(), currDate.month(), currDate.day() ); 707 picker->setDate( currDate.year(), currDate.month(), currDate.day() );
708 m1->popup(mapToGlobal(QPoint(0,height()))); 708 m1->popup(mapToGlobal(QPoint(0,height())));
709 picker->setFocus(); 709 picker->setFocus();
710} 710}
711 711
712 712
713void DateButton::gotHide() 713void DateButton::gotHide()
714{ 714{
715 // we have to redo the button... 715 // we have to redo the button...
716 setDown( false ); 716 setDown( false );
717} 717}
718 718
719 719
720// void dateSelected( int year, int month, int day ); 720// void dateSelected( int year, int month, int day );
721 721
722void DateButton::setWeekStartsMonday( int b ) 722void DateButton::setWeekStartsMonday( int b )
723{ 723{
724 weekStartsMonday = b; 724 weekStartsMonday = b;
725} 725}
726 726
727void DateButton::setDate( int y, int m, int d ) 727void DateButton::setDate( int y, int m, int d )
728{ 728{
729 setDate( QDate( y,m,d) ); 729 setDate( QDate( y,m,d) );
730} 730}
731 731
732void DateButton::setDate( QDate d ) 732void DateButton::setDate( QDate d )
733{ 733{
734 currDate = d; 734 currDate = 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
740void DateButton::setDateFormat( DateFormat f ) 740void DateButton::setDateFormat( DateFormat f )
741{ 741{
742 df = f; 742 df = f;
743 setDate( currDate ); 743 setDate( currDate );
744} 744}
745 745
746bool DateButton::customWhatsThis() const 746bool 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
757DateBookMonthPopup::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
@@ -1,213 +1,228 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
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
35class QToolButton; 36class QToolButton;
36class QComboBox; 37class QComboBox;
37class QSpinBox; 38class QSpinBox;
38class Event; 39class Event;
39class DateBookDB; 40class DateBookDB;
40 41
41class DateBookMonthHeaderPrivate; 42class DateBookMonthHeaderPrivate;
42class DateBookMonthHeader : public QHBox 43class DateBookMonthHeader : public QHBox
43{ 44{
44 Q_OBJECT 45 Q_OBJECT
45 46
46public: 47public:
47 DateBookMonthHeader( QWidget *parent = 0, const char *name = 0 ); 48 DateBookMonthHeader( QWidget *parent = 0, const char *name = 0 );
48 ~DateBookMonthHeader(); 49 ~DateBookMonthHeader();
49 void setDate( int year, int month ); 50 void setDate( int year, int month );
50 51
51signals: 52signals:
52 void dateChanged( int year, int month ); 53 void dateChanged( int year, int month );
53 54
54protected slots: 55protected slots:
55 void keyPressEvent(QKeyEvent *e ) { 56 void keyPressEvent(QKeyEvent *e ) {
56 e->ignore(); 57 e->ignore();
57 } 58 }
58 59
59private slots: 60private slots:
60 void updateDate(); 61 void updateDate();
61 void firstMonth(); 62 void firstMonth();
62 void lastMonth(); 63 void lastMonth();
63 void monthBack(); 64 void monthBack();
64 void monthForward(); 65 void monthForward();
65 66
66private: 67private:
67 QToolButton *begin, *back, *next, *end; 68 QToolButton *begin, *back, *next, *end;
68 QComboBox *month; 69 QComboBox *month;
69 QSpinBox *year; 70 QSpinBox *year;
70 DateBookMonthHeaderPrivate *d; 71 DateBookMonthHeaderPrivate *d;
71 int focus; 72 int focus;
72}; 73};
73 74
74class DayItemMonthPrivate; 75class DayItemMonthPrivate;
75class DayItemMonth : public QTableItem 76class DayItemMonth : public QTableItem
76{ 77{
77public: 78public:
78 DayItemMonth( QTable *table, EditType et, const QString &t ); 79 DayItemMonth( QTable *table, EditType et, const QString &t );
79 ~DayItemMonth(); 80 ~DayItemMonth();
80 void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected ); 81 void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected );
81 void setDay( int d ) { dy = d; } 82 void setDay( int d ) { dy = d; }
82 void setEvents( const QValueList<Event> &events ) { daysEvents = events; }; 83 void setEvents( const QValueList<Event> &events ) { daysEvents = events; };
83 void setEvents( const QValueList<EffectiveEvent> &effEvents ); 84 void setEvents( const QValueList<EffectiveEvent> &effEvents );
84 void clearEvents() { daysEvents.clear(); }; 85 void clearEvents() { daysEvents.clear(); };
85 void clearEffEvents(); 86 void clearEffEvents();
86 int day() const { return dy; } 87 int day() const { return dy; }
87 void setType( Calendar::Day::Type t ); 88 void setType( Calendar::Day::Type t );
88 Calendar::Day::Type type() const { return typ; } 89 Calendar::Day::Type type() const { return typ; }
89 90
90private: 91private:
91 QBrush back; 92 QBrush back;
92 QColor forg; 93 QColor forg;
93 int dy; 94 int dy;
94 Calendar::Day::Type typ; 95 Calendar::Day::Type typ;
95 QValueList<Event> daysEvents; // not used anymore... 96 QValueList<Event> daysEvents; // not used anymore...
96 DayItemMonthPrivate *d; 97 DayItemMonthPrivate *d;
97}; 98};
98 99
99class DateBookMonthTablePrivate; 100class DateBookMonthTablePrivate;
100class DateBookMonthTable : public QTable 101class DateBookMonthTable : public QTable
101{ 102{
102 Q_OBJECT 103 Q_OBJECT
103 104
104public: 105public:
105 DateBookMonthTable( QWidget *parent = 0, const char *name = 0, 106 DateBookMonthTable( QWidget *parent = 0, const char *name = 0,
106 DateBookDB *newDb = 0 ); 107 DateBookDB *newDb = 0 );
107 ~DateBookMonthTable(); 108 ~DateBookMonthTable();
108 void setDate( int y, int m, int d ); 109 void setDate( int y, int m, int d );
109 void redraw(); 110 void redraw();
110 111
111 QSize minimumSizeHint() const { return sizeHint(); } 112 QSize minimumSizeHint() const { return sizeHint(); }
112 QSize minimumSize() const { return sizeHint(); } 113 QSize minimumSize() const { return sizeHint(); }
113 void getDate( int& y, int &m, int &d ) const {y=selYear;m=selMonth;d=selDay;} 114 void getDate( int& y, int &m, int &d ) const {y=selYear;m=selMonth;d=selDay;}
114 void setWeekStart( bool onMonday ); 115 void setWeekStart( bool onMonday );
115signals: 116signals:
116 void dateClicked( int year, int month, int day ); 117 void dateClicked( int year, int month, int day );
117 118
118protected: 119protected:
119 void viewportMouseReleaseEvent( QMouseEvent * ); 120 void viewportMouseReleaseEvent( QMouseEvent * );
120 121
121protected slots: 122protected slots:
122 123
123 void keyPressEvent(QKeyEvent *e ) { 124 void keyPressEvent(QKeyEvent *e ) {
124 e->ignore(); 125 e->ignore();
125 } 126 }
126 127
127private slots: 128private slots:
128 void dayClicked( int row, int col ); 129 void dayClicked( int row, int col );
129 void dragDay( int row, int col ); 130 void dragDay( int row, int col );
130 131
131private: 132private:
132 void setupTable(); 133 void setupTable();
133 void setupLabels(); 134 void setupLabels();
134 135
135 void findDay( int day, int &row, int &col ); 136 void findDay( int day, int &row, int &col );
136 void getEvents(); 137 void getEvents();
137 void changeDaySelection( int row, int col ); 138 void changeDaySelection( int row, int col );
138 139
139 int year, month, day; 140 int year, month, day;
140 int selYear, selMonth, selDay; 141 int selYear, selMonth, selDay;
141 QValueList<Event> monthsEvents; // not used anymore... 142 QValueList<Event> monthsEvents; // not used anymore...
142 DateBookDB *db; 143 DateBookDB *db;
143 DateBookMonthTablePrivate *d; 144 DateBookMonthTablePrivate *d;
144}; 145};
145 146
146class DateBookMonthPrivate; 147class DateBookMonthPrivate;
147class DateBookMonth : public QVBox 148class DateBookMonth : public QVBox
148{ 149{
149 Q_OBJECT 150 Q_OBJECT
150 151
151public: 152public:
152 DateBookMonth( QWidget *parent = 0, const char *name = 0, bool ac = FALSE, 153 DateBookMonth( QWidget *parent = 0, const char *name = 0, bool ac = FALSE,
153 DateBookDB *data = 0 ); 154 DateBookDB *data = 0 );
154 ~DateBookMonth(); 155 ~DateBookMonth();
155 QDate selectedDate() const; 156 QDate selectedDate() const;
156 157
157signals: 158signals:
158 void dateClicked( int year, int month, int day ); 159 void dateClicked( int year, int month, int day );
159 160
160public slots: 161public slots:
161 void setDate( int y, int m ); 162 void setDate( int y, int m );
162 void setDate( int y, int m, int d ); 163 void setDate( int y, int m, int d );
163 void setDate( QDate ); 164 void setDate( QDate );
164 void redraw(); 165 void redraw();
165 void slotWeekChange( bool ); 166 void slotWeekChange( bool );
166 167
167protected slots: 168protected slots:
168 virtual void keyPressEvent(QKeyEvent *e); 169 virtual void keyPressEvent(QKeyEvent *e);
169 170
170private slots: 171private slots:
171 void forwardDateClicked( int y, int m, int d ) { emit dateClicked( y, m, d ); } 172 void forwardDateClicked( int y, int m, int d ) { emit dateClicked( y, m, d ); }
172 void finalDate(int, int, int); 173 void finalDate(int, int, int);
173 174
174private: 175private:
175 DateBookMonthHeader *header; 176 DateBookMonthHeader *header;
176 DateBookMonthTable *table; 177 DateBookMonthTable *table;
177 int year, month, day; 178 int year, month, day;
178 bool autoClose; 179 bool autoClose;
179 class DateBookMonthPrivate *d; 180 class DateBookMonthPrivate *d;
180}; 181};
181 182
182class DateButton : public QPushButton 183class DateButton : public QPushButton
183{ 184{
184 Q_OBJECT 185 Q_OBJECT
185 186
186public: 187public:
187 DateButton( bool longDate, QWidget *parent, const char * name = 0 ); 188 DateButton( bool longDate, QWidget *parent, const char * name = 0 );
188 QDate date() const { return currDate; } 189 QDate date() const { return currDate; }
189 190
190 bool customWhatsThis() const; 191 bool customWhatsThis() const;
191 192
192signals: 193signals:
193 void dateSelected( int year, int month, int day ); 194 void dateSelected( int year, int month, int day );
194 195
195public slots: 196public 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
201private slots: 202private slots:
202 void pickDate(); 203 void pickDate();
203 void gotHide(); 204 void gotHide();
204 205
205private: 206private:
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
218class DateBookMonthPopup : public QPopupMenu
219{
220 Q_OBJECT
221public:
222 DateBookMonthPopup ( QWidget *w );
223
224private:
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
@@ -1,142 +1,151 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
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 20
21#define INCLUDE_MENUITEM_DEF 21#define INCLUDE_MENUITEM_DEF
22 22
23#include "qpemenubar.h" 23#include "qpemenubar.h"
24#include <qapplication.h> 24#include <qapplication.h>
25#include <qguardedptr.h> 25#include <qguardedptr.h>
26#include <qtimer.h> 26#include <qtimer.h>
27 27
28 28
29class QMenuBarHack : public QMenuBar 29class QMenuBarHack : public QMenuBar
30{ 30{
31public: 31public:
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
48void QPEMenuToolFocusManager::setMenukeyEnabled ( bool )
49{
50}
51int QPEMenuBar::getOldFocus ( )
52{
53 return 0;
54}
55
47QPEMenuToolFocusManager *QPEMenuToolFocusManager::me = 0; 56QPEMenuToolFocusManager *QPEMenuToolFocusManager::me = 0;
48 57
49QPEMenuToolFocusManager::QPEMenuToolFocusManager() : QObject() 58QPEMenuToolFocusManager::QPEMenuToolFocusManager() : QObject()
50{ 59{
51 qApp->installEventFilter( this ); 60 qApp->installEventFilter( this );
52} 61}
53 62
54void QPEMenuToolFocusManager::addWidget( QWidget *w ) 63void QPEMenuToolFocusManager::addWidget( QWidget *w )
55{ 64{
56 list.append( GuardedWidget(w) ); 65 list.append( GuardedWidget(w) );
57} 66}
58 67
59void QPEMenuToolFocusManager::removeWidget( QWidget *w ) 68void QPEMenuToolFocusManager::removeWidget( QWidget *w )
60{ 69{
61 list.remove( GuardedWidget(w) ); 70 list.remove( GuardedWidget(w) );
62} 71}
63 72
64void QPEMenuToolFocusManager::setActive( bool a ) 73void QPEMenuToolFocusManager::setActive( bool a )
65{ 74{
66 if ( a ) { 75 if ( a ) {
67 oldFocus = qApp->focusWidget(); 76 oldFocus = qApp->focusWidget();
68 QValueList<GuardedWidget>::Iterator it; 77 QValueList<GuardedWidget>::Iterator it;
69 it = list.begin(); 78 it = list.begin();
70 while ( it != list.end() ) { 79 while ( it != list.end() ) {
71 QWidget *w = (*it); 80 QWidget *w = (*it);
72 if ( w && w->isEnabled() && w->isVisible() && 81 if ( w && w->isEnabled() && w->isVisible() &&
73 w->topLevelWidget() == qApp->activeWindow() ) { 82 w->topLevelWidget() == qApp->activeWindow() ) {
74 setFocus( w ); 83 setFocus( w );
75 return; 84 return;
76 } 85 }
77 ++it; 86 ++it;
78 } 87 }
79 } else { 88 } else {
80 if ( inFocus ) { 89 if ( inFocus ) {
81 if ( inFocus->inherits( "QMenuBar" ) ) 90 if ( inFocus->inherits( "QMenuBar" ) )
82 ((QMenuBarHack *)(QWidget *)inFocus)->goodbye(); 91 ((QMenuBarHack *)(QWidget *)inFocus)->goodbye();
83 if ( inFocus->hasFocus() ) { 92 if ( inFocus->hasFocus() ) {
84 if ( oldFocus && oldFocus->isVisible() && oldFocus->isEnabled() ) { 93 if ( oldFocus && oldFocus->isVisible() && oldFocus->isEnabled() ) {
85 oldFocus->setFocus(); 94 oldFocus->setFocus();
86 } else { 95 } else {
87 inFocus->clearFocus(); 96 inFocus->clearFocus();
88 } 97 }
89 } 98 }
90 } 99 }
91 inFocus = 0; 100 inFocus = 0;
92 oldFocus = 0; 101 oldFocus = 0;
93 } 102 }
94} 103}
95 104
96bool QPEMenuToolFocusManager::isActive() const 105bool QPEMenuToolFocusManager::isActive() const
97{ 106{
98 return !inFocus.isNull(); 107 return !inFocus.isNull();
99} 108}
100 109
101void QPEMenuToolFocusManager::moveFocus( bool next ) 110void QPEMenuToolFocusManager::moveFocus( bool next )
102{ 111{
103 if ( !isActive() ) 112 if ( !isActive() )
104 return; 113 return;
105 114
106 int n = list.count(); 115 int n = list.count();
107 QValueList<GuardedWidget>::Iterator it; 116 QValueList<GuardedWidget>::Iterator it;
108 it = list.find( inFocus ); 117 it = list.find( inFocus );
109 if ( it == list.end() ) 118 if ( it == list.end() )
110 it = list.begin(); 119 it = list.begin();
111 while ( --n ) { 120 while ( --n ) {
112 if ( next ) { 121 if ( next ) {
113 ++it; 122 ++it;
114 if ( it == list.end() ) 123 if ( it == list.end() )
115 it = list.begin(); 124 it = list.begin();
116 } else { 125 } else {
117 if ( it == list.begin() ) 126 if ( it == list.begin() )
118 it = list.end(); 127 it = list.end();
119 --it; 128 --it;
120 } 129 }
121 QWidget *w = (*it); 130 QWidget *w = (*it);
122 if ( w && w->isEnabled() && w->isVisible() && !w->inherits("QToolBarSeparator") && 131 if ( w && w->isEnabled() && w->isVisible() && !w->inherits("QToolBarSeparator") &&
123 w->topLevelWidget() == qApp->activeWindow() ) { 132 w->topLevelWidget() == qApp->activeWindow() ) {
124 setFocus( w, next ); 133 setFocus( w, next );
125 return; 134 return;
126 } 135 }
127 } 136 }
128} 137}
129 138
130void QPEMenuToolFocusManager::initialize() 139void QPEMenuToolFocusManager::initialize()
131{ 140{
132 if ( !me ) 141 if ( !me )
133 me = new QPEMenuToolFocusManager; 142 me = new QPEMenuToolFocusManager;
134} 143}
135 144
136QPEMenuToolFocusManager *QPEMenuToolFocusManager::manager() 145QPEMenuToolFocusManager *QPEMenuToolFocusManager::manager()
137{ 146{
138 if ( !me ) 147 if ( !me )
139 me = new QPEMenuToolFocusManager; 148 me = new QPEMenuToolFocusManager;
140 149
141 return me; 150 return me;
142} 151}
diff --git a/library/qpemenubar.h b/library/qpemenubar.h
index 05abc4e..66d0c85 100644
--- a/library/qpemenubar.h
+++ b/library/qpemenubar.h
@@ -1,78 +1,85 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
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 20
21#ifndef QPEMENUBAR_H 21#ifndef QPEMENUBAR_H
22#define QPEMENUBAR_H 22#define QPEMENUBAR_H
23 23
24#include <qmenubar.h> 24#include <qmenubar.h>
25#include <qguardedptr.h> 25#include <qguardedptr.h>
26#include <qvaluelist.h> 26#include <qvaluelist.h>
27 27
28class QPEMenuToolFocusManager : public QObject 28class QPEMenuToolFocusManager : public QObject
29{ 29{
30 Q_OBJECT 30 Q_OBJECT
31public: 31public:
32 QPEMenuToolFocusManager(); 32 QPEMenuToolFocusManager();
33 33
34 void addWidget( QWidget *w ); 34 void addWidget( QWidget *w );
35 void removeWidget( QWidget *w ); 35 void removeWidget( QWidget *w );
36 void setActive( bool a ); 36 void setActive( bool a );
37 bool isActive() const; 37 bool isActive() const;
38 void moveFocus( bool next ); 38 void moveFocus( bool next );
39 39
40 static QPEMenuToolFocusManager *manager(); 40 static QPEMenuToolFocusManager *manager();
41 static void initialize(); 41 static void initialize();
42 42
43protected: 43protected:
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
47private slots: 47private slots:
48 void deactivate(); 48 void deactivate();
49 49
50private: 50private:
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
57private: // Sharp ROM compatibility
58 void setMenukeyEnabled ( bool b );
56}; 59};
57 60
58 61
59class QPEMenuBar : public QMenuBar 62class QPEMenuBar : public QMenuBar
60{ 63{
61 Q_OBJECT 64 Q_OBJECT
62public: 65public:
63 QPEMenuBar( QWidget *parent=0, const char* name=0 ); 66 QPEMenuBar( QWidget *parent=0, const char* name=0 );
64 ~QPEMenuBar(); 67 ~QPEMenuBar();
65 68
66protected: 69protected:
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