summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--configs/linux-arm-g++-sharedx1197
-rw-r--r--configs/linux-generic-g++-sharedx1194
-rw-r--r--core/pim/datebook/layoutmanager.cpp177
-rw-r--r--core/pim/datebook/layoutmanager.h78
-rw-r--r--docs/inputmethodinterface.doc49
-rw-r--r--examples/application/Example.pngbin1262 -> 0 bytes
-rw-r--r--examples/application/README2
-rw-r--r--examples/application/example.control11
-rw-r--r--examples/application/example.cpp28
-rw-r--r--examples/application/example.desktop6
-rw-r--r--examples/application/example.h17
-rw-r--r--examples/application/example.html15
-rw-r--r--examples/application/example.pro10
-rw-r--r--examples/application/examplebase.ui55
-rw-r--r--examples/application/index.html23
-rw-r--r--examples/application/main.cpp12
-rw-r--r--examples/qpepim-addressbook/abexample.desktop6
-rw-r--r--examples/qpepim-addressbook/abexample.pngbin1262 -> 0 bytes
-rw-r--r--examples/qpepim-addressbook/addressbookdumper.cpp65
-rw-r--r--examples/qpepim-addressbook/addressbookdumper.h39
-rw-r--r--examples/qpepim-addressbook/main.cpp47
-rw-r--r--examples/qpepim-addressbook/qpepim-abexample.control9
-rw-r--r--examples/qpepim-addressbook/qpepim-addressbook.pro8
-rw-r--r--inputmethods/handwriting/qimpenchar.cpp2
-rw-r--r--library/alarmserver.h3
-rw-r--r--library/applnk.h3
-rw-r--r--library/backend/categories.cpp146
-rw-r--r--library/backend/categories.h12
-rw-r--r--library/backend/contact.cpp107
-rw-r--r--library/backend/contact.h7
-rw-r--r--library/backend/event.h5
-rw-r--r--library/backend/recordfields.h46
-rw-r--r--library/backend/task.h4
-rw-r--r--library/backend/vobject.cpp9
-rw-r--r--library/backend/vobject_p.h3
-rw-r--r--library/categoryedit_p.cpp6
-rw-r--r--library/categoryselect.cpp185
-rw-r--r--library/categoryselect.h26
-rw-r--r--library/config.cpp13
-rw-r--r--library/custom-linux-sharp-g++.h147
-rw-r--r--library/datebookmonth.h1
-rw-r--r--library/fileselector.h32
-rw-r--r--library/finddialog.cpp4
-rw-r--r--library/finddialog.h11
-rw-r--r--library/mimetype.cpp19
-rw-r--r--library/mimetype.h5
-rw-r--r--library/network.cpp19
-rw-r--r--library/power.cpp2
-rw-r--r--library/qcopmessage_qws.h99
-rw-r--r--library/qpedecoration_qws.cpp9
-rw-r--r--noncore/games/go/gowidget.cpp15
-rw-r--r--noncore/games/minesweep/minefield.h30
-rw-r--r--noncore/games/minesweep/minesweep.cpp35
-rw-r--r--noncore/games/snake/interface.h2
-rw-r--r--noncore/games/snake/obstacle.cpp35
-rw-r--r--noncore/games/snake/obstacle.h4
-rw-r--r--noncore/games/solitaire/canvascard.cpp71
-rw-r--r--noncore/games/solitaire/canvasshapes.cpp52
-rw-r--r--noncore/games/solitaire/freecellcardgame.cpp11
-rw-r--r--noncore/games/solitaire/patiencecardgame.cpp49
-rw-r--r--noncore/games/solitaire/patiencecardgame.h7
-rw-r--r--noncore/games/wordgame/wordgame.cpp71
-rw-r--r--noncore/games/wordgame/wordgame.h6
-rw-r--r--noncore/multimedia/showimg/settingsdialog.cpp57
-rw-r--r--noncore/multimedia/showimg/settingsdialog.h42
-rw-r--r--noncore/multimedia/showimg/settingsdialogbase.ui149
-rw-r--r--pics/cards/circle.pngbin436 -> 0 bytes
-rw-r--r--pics/cards/cross.pngbin480 -> 0 bytes
-rw-r--r--pics/inline/today.pngbin486 -> 0 bytes
-rw-r--r--pics/slideshow.pngbin207 -> 0 bytes
70 files changed, 724 insertions, 1685 deletions
diff --git a/configs/linux-arm-g++-sharedx11 b/configs/linux-arm-g++-sharedx11
deleted file mode 100644
index b810b05..0000000
--- a/configs/linux-arm-g++-sharedx11
+++ b/dev/null
@@ -1,97 +0,0 @@
1# Compiling
2 INTERFACE_DECL_PATH = .
3 SYSCONF_CXX = arm-linux-g++
4 SYSCONF_CC = arm-linux-gcc
5 DASHCROSS = -arm
6
7# Set XROOT to the root directory of the arm X11 files for cross compiling
8XROOT=/scratch/src/xfree86.41/xbinaries
9# Compiling with support libraries
10 SYSCONF_CXXFLAGS_X11=
11 SYSCONF_CXXFLAGS_QT= -I$(QTDIR)/include
12 SYSCONF_CXXFLAGS_OPENGL= -I$(XROOT)/usr/X11R6/include
13
14# Compiling YACC output
15SYSCONF_CXXFLAGS_YACC = -Wno-unused -Wno-parentheses
16
17# Linking with support libraries
18 SYSCONF_RPATH_X11=
19 SYSCONF_RPATH_QT= -Wl,-rpath,$(QTDIR)/lib,-rpath,$(XROOT)/usr/X11R6/lib
20 SYSCONF_RPATH_OPENGL= -Wl,-rpath,$(XROOT)/usr/X11R6/lib
21
22# Linking with support libraries
23# X11
24 SYSCONF_LFLAGS_X11=
25 SYSCONF_LIBS_X11=
26# Qt, Qt+OpenGL
27 SYSCONF_LFLAGS_QT= -L$(QTDIR)/lib
28 SYSCONF_LIBS_QT = -lqt$(QT_THREAD_SUFFIX)
29 SYSCONF_LIBS_QT_OPENGL=
30# OpenGL
31 SYSCONF_LFLAGS_OPENGL= -L$(XROOT)/usr/X11R6/lib
32 SYSCONF_LIBS_OPENGL=
33# Yacc
34 SYSCONF_LIBS_YACC=
35
36# Linking applications
37 SYSCONF_LINK = arm-linux-gcc
38 SYSCONF_LFLAGS =
39 SYSCONF_LIBS =
40
41# Link flags for shared objects
42 SYSCONF_LFLAGS_SHOBJ= -shared
43
44# Flags for threading
45 SYSCONF_CFLAGS_THREAD= -D_REENTRANT
46 SYSCONF_CXXFLAGS_THREAD= -D_REENTRANT
47 SYSCONF_LFLAGS_THREAD=
48 SYSCONF_LIBS_THREAD= -lpthread
49
50# Point to /usr/bin for moc and uic since we are cross compiling here
51# Meta-object compiler
52 SYSCONF_MOC = /usr/bin/moc
53
54# UI compiler
55 SYSCONF_UIC = /usr/bin/uic
56
57# Linking shared libraries
58# - Build the $(TARGET) library, eg. lib$(TARGET).so.2.2.2
59# - Place target in $(DESTDIR) - which has a trailing /
60# - Usually needs to incorporate $(VER_MAJ), $(VER_MIN) and $(VER_PATCH)
61#
62 SYSCONF_LINK_SHLIB= arm-linux-gcc
63 SYSCONF_LINK_TARGET_SHARED= lib$(TARGET).so.$(VER_MAJ).$(VER_MIN).$(VER_PATCH)
64 SYSCONF_LINK_LIB_SHARED= $(SYSCONF_LINK_SHLIB) -shared -Wl,-soname,lib$(TARGET).so.$(VER_MAJ) \
65 $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \
66 $(OBJECTS) $(OBJMOC) $(LIBS) && \
67 mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \
68 cd $(DESTDIR) && \
69 rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN); \
70 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so; \
71 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ); \
72 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN)
73
74# Linking static libraries
75# - Build the $(TARGET) library, eg. lib$(TARGET).a
76# - Place target in $(DESTDIR) - which has a trailing /
77#
78 SYSCONF_AR = arm-linux-ar cqs
79SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a
80 SYSCONF_LINK_LIB_STATIC= rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) ; \
81 $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC)
82# Compiling application source
83 SYSCONF_CXXFLAGS= -pipe -DQT_NO_COP -fno-exceptions -fno-rtti -O2 -Wall -W
84 SYSCONF_CFLAGS = -pipe -O2 -Wall -W
85# Default link type (static linking is still be used where required)
86 SYSCONF_LINK_LIB= $(SYSCONF_LINK_LIB_SHARED)
87 SYSCONF_LINK_TARGET= $(SYSCONF_LINK_TARGET_SHARED)
88# Compiling library source
89 SYSCONF_CXXFLAGS_LIB= -fPIC
90 SYSCONF_CFLAGS_LIB= -fPIC
91# Compiling shared-object source
92 SYSCONF_CXXFLAGS_SHOBJ= -fPIC
93 SYSCONF_CFLAGS_SHOBJ= -fPIC
94# Linking Qt
95 SYSCONF_LIBS_QTLIB= $(SYSCONF_LFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT)
96# Linking Qt applications
97 SYSCONF_LIBS_QTAPP=
diff --git a/configs/linux-generic-g++-sharedx11 b/configs/linux-generic-g++-sharedx11
deleted file mode 100644
index 1cd7a46..0000000
--- a/configs/linux-generic-g++-sharedx11
+++ b/dev/null
@@ -1,94 +0,0 @@
1# Compiling
2 INTERFACE_DECL_PATH = .
3 SYSCONF_CXX = g++
4 SYSCONF_CC = gcc
5 DASHCROSS =
6
7# Compiling with support libraries
8 SYSCONF_CXXFLAGS_X11=
9 SYSCONF_CXXFLAGS_QT= -I$(QTDIR)/include
10 SYSCONF_CXXFLAGS_OPENGL= -I/usr/X11R6/include
11
12# Compiling YACC output
13SYSCONF_CXXFLAGS_YACC = -Wno-unused -Wno-parentheses
14
15# Linking with support libraries
16 SYSCONF_RPATH_X11=
17 SYSCONF_RPATH_QT= -Wl,-rpath,$(QTDIR)/lib
18 SYSCONF_RPATH_OPENGL= -Wl,-rpath,/usr/X11R6/lib
19
20# Linking with support libraries
21# X11
22 SYSCONF_LFLAGS_X11=
23 SYSCONF_LIBS_X11=
24# Qt, Qt+OpenGL
25 SYSCONF_LFLAGS_QT= -L$(QTDIR)/lib
26 SYSCONF_LIBS_QT = -lqt$(QT_THREAD_SUFFIX)
27 SYSCONF_LIBS_QT_OPENGL=
28# OpenGL
29 SYSCONF_LFLAGS_OPENGL= -L/usr/X11R6/lib
30 SYSCONF_LIBS_OPENGL=
31# Yacc
32 SYSCONF_LIBS_YACC=
33
34# Linking applications
35 SYSCONF_LINK = gcc
36 SYSCONF_LFLAGS =
37 SYSCONF_LIBS =
38
39# Link flags for shared objects
40 SYSCONF_LFLAGS_SHOBJ= -shared
41
42# Flags for threading
43 SYSCONF_CFLAGS_THREAD= -D_REENTRANT
44 SYSCONF_CXXFLAGS_THREAD= -D_REENTRANT
45 SYSCONF_LFLAGS_THREAD=
46 SYSCONF_LIBS_THREAD= -lpthread
47
48# Meta-object compiler
49 SYSCONF_MOC = $(QTDIR)/bin/moc
50
51# UI compiler
52 SYSCONF_UIC = $(QTDIR)/bin/uic
53
54# Linking shared libraries
55# - Build the $(TARGET) library, eg. lib$(TARGET).so.2.2.2
56# - Place target in $(DESTDIR) - which has a trailing /
57# - Usually needs to incorporate $(VER_MAJ), $(VER_MIN) and $(VER_PATCH)
58#
59 SYSCONF_LINK_SHLIB= gcc
60 SYSCONF_LINK_TARGET_SHARED= lib$(TARGET).so.$(VER_MAJ).$(VER_MIN).$(VER_PATCH)
61 SYSCONF_LINK_LIB_SHARED= $(SYSCONF_LINK_SHLIB) -shared -Wl,-soname,lib$(TARGET).so.$(VER_MAJ) \
62 $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \
63 $(OBJECTS) $(OBJMOC) $(LIBS) && \
64 mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \
65 cd $(DESTDIR) && \
66 rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN); \
67 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so; \
68 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ); \
69 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN)
70
71# Linking static libraries
72# - Build the $(TARGET) library, eg. lib$(TARGET).a
73# - Place target in $(DESTDIR) - which has a trailing /
74#
75 SYSCONF_AR = ar cqs
76SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a
77 SYSCONF_LINK_LIB_STATIC= rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) ; \
78 $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC)
79# Compiling application source
80 SYSCONF_CXXFLAGS= -pipe -DQT_NO_COP -fno-exceptions -fno-rtti -O2 -Wall -W
81 SYSCONF_CFLAGS = -pipe -O2 -Wall -W
82# Default link type (static linking is still be used where required)
83 SYSCONF_LINK_LIB= $(SYSCONF_LINK_LIB_SHARED)
84 SYSCONF_LINK_TARGET= $(SYSCONF_LINK_TARGET_SHARED)
85# Compiling library source
86 SYSCONF_CXXFLAGS_LIB= -fPIC
87 SYSCONF_CFLAGS_LIB= -fPIC
88# Compiling shared-object source
89 SYSCONF_CXXFLAGS_SHOBJ= -fPIC
90 SYSCONF_CFLAGS_SHOBJ= -fPIC
91# Linking Qt
92 SYSCONF_LIBS_QTLIB= $(SYSCONF_LFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT)
93# Linking Qt applications
94 SYSCONF_LIBS_QTAPP=
diff --git a/core/pim/datebook/layoutmanager.cpp b/core/pim/datebook/layoutmanager.cpp
deleted file mode 100644
index 23058ed..0000000
--- a/core/pim/datebook/layoutmanager.cpp
+++ b/dev/null
@@ -1,177 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "layoutmanager.h"
22
23static const int min_height = 15;
24
25LayoutItem::LayoutItem( const EffectiveEvent e ) : eevent(e) { }
26
27LayoutManager::LayoutManager(int w, int h) : width(w), height(h), maxWidth(w) { }
28
29LayoutManager::~LayoutManager() { }
30
31void LayoutManager::setSize(int w, int h)
32{
33 height = h;
34 maxWidth = width = w;
35 // with changed, re-init, re-layout items.
36 for (uint i = 0; i < mItems.count(); i++)
37 initializeGeometry(mItems.at(i));
38}
39
40void LayoutManager::setOccurances(QValueList<EffectiveEvent> &events)
41{
42 mItems.clear();
43
44 QValueListIterator<EffectiveEvent> it;
45 for ( it = events.begin(); it != events.end(); ++it ) {
46 addOccurance(*it);
47 }
48 layoutItems(TRUE);
49}
50
51void LayoutManager::addOccurance(EffectiveEvent &event)
52{
53 LayoutItem *i = new LayoutItem(event);
54 initializeGeometry(i);
55 addItem(i);
56}
57
58void LayoutManager::addItem(LayoutItem *i)
59{
60 mItems.resize(mItems.size() + 1);
61 mItems.insert(mItems.size() - 1, i);
62}
63
64void LayoutManager::layoutItems(bool resetMaxWidth)
65{
66 if (resetMaxWidth)
67 maxWidth = width;
68
69 int iCount = mItems.count();
70 int itemWidth = QMIN(width, maxWidth);
71 int n = 1;
72
73 if (width < 1)
74 return;
75 if (iCount < (width/4)) {
76 int i = 0;
77 while (i < iCount) {
78 LayoutItem *item = mItems.at(i);
79 int x = 0;
80 int xp = 0;
81 QRect geom = item->geometry();
82 geom.setX( x );
83 geom.setWidth(itemWidth);
84 while ( xp < n && intersects(item, geom)) {
85 x += itemWidth;
86 xp++;
87 geom.moveBy(itemWidth, 0);
88 }
89 if (xp >= n) {
90 n++;
91 itemWidth = QMIN(width / n, maxWidth);
92 i = 0; // Start again.
93 } else {
94 item->setGeometry( geom );
95 i++;
96 }
97 }
98 } else {
99 // alturnate algorithm. // same as above, but just overlap
100 // if fail.
101 itemWidth = 4;
102 n = width / itemWidth;
103 int i = 0;
104 int rovingXp = 0;
105 while (i < iCount) {
106 LayoutItem *item = mItems.at(i);
107 int x = 0;
108 int xp = 0;
109 QRect geom = item->geometry();
110 geom.setX( x );
111 geom.setWidth(itemWidth);
112 while ( xp < n && intersects(item, geom)) {
113 x += itemWidth;
114 xp++;
115 geom.moveBy(itemWidth, 0);
116 }
117 if (xp >= n) {
118 geom.setX(rovingXp * itemWidth);
119 geom.setWidth(itemWidth);
120 rovingXp++;
121 item->setGeometry( geom );
122 } else {
123 item->setGeometry( geom );
124 }
125 i++;
126 }
127 }
128 if (itemWidth < maxWidth)
129 maxWidth = itemWidth;
130}
131
132int LayoutManager::timeToHeight( const QTime &time ) const
133{
134 int y = time.hour() * 60 + time.minute();
135 if (y)
136 y = (y * (height / 24)) / 60;
137 return y;
138}
139
140QTime LayoutManager::heightToTime( int h ) const
141{
142 // broken
143 return QTime(0,0,0);
144}
145
146LayoutItem *LayoutManager::intersects(LayoutItem *item, QRect geom) const
147{
148 int i = 0;
149 // allow overlapping
150 geom.moveBy(1,1);
151 geom.setSize( geom.size() - QSize(2,2) );
152
153 LayoutItem *it = mItems.at(i);
154 int count = mItems.count();
155 while (i < count && it != item) {
156 if (it->geometry().intersects( geom ) )
157 return it;
158 it = mItems.at(++i);
159 }
160 return 0;
161}
162
163void LayoutManager::initializeGeometry(LayoutItem *item)
164{
165 int y = timeToHeight(item->occurance().start());
166 int yend = timeToHeight(item->occurance().end());
167
168 int h = yend - y;
169 if (h < min_height)
170 h = min_height;
171 if (y + min_height > height) {
172 y = height - min_height;
173 h = min_height;
174 }
175
176 item->setGeometry(QRect(0, y, width, h));
177}
diff --git a/core/pim/datebook/layoutmanager.h b/core/pim/datebook/layoutmanager.h
deleted file mode 100644
index 128f927..0000000
--- a/core/pim/datebook/layoutmanager.h
+++ b/dev/null
@@ -1,78 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include <qvector.h>
22#include <qvaluelist.h>
23#include <qrect.h>
24#include <qdatetime.h>
25#include <qpe/event.h>
26
27class LayoutItem
28{
29public:
30 LayoutItem( const EffectiveEvent e );
31
32 void setGeometry(const QRect &rect) { r = rect; }
33 void setGeometry(int x, int y, int w, int h)
34 { setGeometry(QRect(x,y,w,h)); }
35 QRect geometry() const { return r; }
36
37 EffectiveEvent occurance() const { return eevent; }
38 Event event() const { return eevent.event(); }
39
40private:
41 EffectiveEvent eevent;
42 QRect r;
43};
44
45class LayoutManager
46{
47public:
48 LayoutManager(int w, int h);
49 virtual ~LayoutManager();
50
51 void setSize(int w, int h);
52 void setMaximumColumnWidth(int x) { maxWidth = x; };
53 int maximumColumnWidth() const { return maxWidth; };
54 void setOccurances(QValueList<EffectiveEvent> &events);
55 virtual void addOccurance(EffectiveEvent &event);
56
57 void clear() { mItems.clear(); }
58
59 QVector<LayoutItem> items() const { return mItems; }
60 QSize size() const { return QSize(width, height); }
61 int count() const { return mItems.count(); }
62
63 virtual void layoutItems(bool resetMaxWidth = FALSE);
64
65 virtual int timeToHeight(const QTime &) const;
66 virtual QTime heightToTime(int) const;
67
68protected:
69 void initializeGeometry(LayoutItem *);
70 LayoutItem *intersects(LayoutItem *, QRect) const;
71 void addItem(LayoutItem *);
72
73private:
74 QVector<LayoutItem> mItems;
75 int width;
76 int height;
77 int maxWidth;
78};
diff --git a/docs/inputmethodinterface.doc b/docs/inputmethodinterface.doc
deleted file mode 100644
index 465182b..0000000
--- a/docs/inputmethodinterface.doc
+++ b/dev/null
@@ -1,49 +0,0 @@
1/*! \class InputMethodInterface inputmethodinterface.h
2 \brief The InputMethodInterface class provides an interface for Qtopia
3 input methods.
4
5 Input methods must supply a QWidget that will be shown above the task bar
6 and emit a signal when a key is pressed:
7
8 Input methods may be added to Qtopia via plugins. In order to write an
9 input method plugin you must create an interface to your input method by
10 deriving from the InputMethodInterface class and implementing the pure
11 virtual functions.
12
13 See also: <a href=inputmethods.html>Input Method Tutorial</a>
14*/
15
16
17/*! \fn QWidget *InputMethodInterface::inputMethod( QWidget *parent, Qt::WFlags f )
18
19 The inputMethod() function returns the input method widget. This
20 widget will be display just above the task bar when the user needs to input
21 text. You should always return the same widget if this function is called
22 multiple times.
23*/
24
25/*! \fn void InputMethodInterface::resetState()
26
27 The resetState() function should return the input method to its default
28 state.
29*/
30
31/*! \fn QString InputMethodInterface::name()
32
33 The name() function returns the name of the input method. This will
34 be displayed in the popup list of available input methods.
35*/
36
37/*! \fn QPixmap *InputMethodInterface::icon()
38
39 The icon() function returns the icon for the input method. This will
40 be displayed in the taskbar when the input method is selected.
41*/
42
43
44/*! \fn void InputMethodInterface::onKeyPress( QObject *receiver, const char *slot )
45
46 The onKeyPress() function must connect the supplied slot to the signal
47 that is emitted when a key press is generated.
48*/
49
diff --git a/examples/application/Example.png b/examples/application/Example.png
deleted file mode 100644
index f63d0bc..0000000
--- a/examples/application/Example.png
+++ b/dev/null
Binary files differ
diff --git a/examples/application/README b/examples/application/README
deleted file mode 100644
index 63986f4..0000000
--- a/examples/application/README
+++ b/dev/null
@@ -1,2 +0,0 @@
1See /opt/Qtopia/doc/index.html for help.
2See doc.trolltech.com for more recent documentation updates.
diff --git a/examples/application/example.control b/examples/application/example.control
deleted file mode 100644
index e79c6f6..0000000
--- a/examples/application/example.control
+++ b/dev/null
@@ -1,11 +0,0 @@
1Files: bin/example apps/Applications/example.desktop pics/Example.png help/html/example.html
2Priority: optional
3Section: qpe/applications
4Maintainer: Your Name <you@your.domain.com>
5Architecture: arm
6Version: 1.0.0
7Depends: qpe-base ($QPE_VERSION)
8License: Public Domain
9Description: Example program
10 An example program for the Qtopia environment.
11 Does nothing interesting.
diff --git a/examples/application/example.cpp b/examples/application/example.cpp
deleted file mode 100644
index 1e0bbe9..0000000
--- a/examples/application/example.cpp
+++ b/dev/null
@@ -1,28 +0,0 @@
1#include "example.h"
2#include <qpushbutton.h>
3
4/*
5 * Constructs a Example which is a child of 'parent', with the
6 * name 'name' and widget flags set to 'f'
7 */
8Example::Example( QWidget* parent, const char* name, WFlags fl )
9 : ExampleBase( parent, name, fl )
10{
11 connect(quit, SIGNAL(clicked()), this, SLOT(goodBye()));
12}
13
14/*
15 * Destroys the object and frees any allocated resources
16 */
17Example::~Example()
18{
19 // no need to delete child widgets, Qt does it all for us
20}
21
22/*
23 * A simple slot... not very interesting.
24 */
25void Example::goodBye()
26{
27 close();
28}
diff --git a/examples/application/example.desktop b/examples/application/example.desktop
deleted file mode 100644
index f1e6f06..0000000
--- a/examples/application/example.desktop
+++ b/dev/null
@@ -1,6 +0,0 @@
1[Desktop Entry]
2Comment=An Example Program
3Exec=example
4Icon=Example
5Type=Application
6Name=Example
diff --git a/examples/application/example.h b/examples/application/example.h
deleted file mode 100644
index 24c58c0..0000000
--- a/examples/application/example.h
+++ b/dev/null
@@ -1,17 +0,0 @@
1#ifndef EXAMPLE_H
2#define EXAMPLE_H
3#include "examplebase.h"
4
5class Example : public ExampleBase
6{
7 Q_OBJECT
8
9public:
10 Example( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
11 ~Example();
12
13private slots:
14 void goodBye();
15};
16
17#endif // EXAMPLE_H
diff --git a/examples/application/example.html b/examples/application/example.html
deleted file mode 100644
index 9163573..0000000
--- a/examples/application/example.html
+++ b/dev/null
@@ -1,15 +0,0 @@
1<html>
2<h1>Example</h1>
3
4<p>This is the help for the Example program.
5
6<p>To user this application:
7
8<ol>
9 <li>Press the <img width=12 height=12 src=Example.png> icon in the Qtopia launcher.
10 <li>Read the label.
11 <li>Press the button.
12 <li>Read the source code provided.
13</ol>
14
15Now you know how to make a Qtopia application!
diff --git a/examples/application/example.pro b/examples/application/example.pro
deleted file mode 100644
index 2d89311..0000000
--- a/examples/application/example.pro
+++ b/dev/null
@@ -1,10 +0,0 @@
1 TEMPLATE= app
2 #CONFIG = qt warn_on debug
3 CONFIG = qt warn_on release
4 HEADERS = example.h
5 SOURCES = main.cpp example.cpp
6 INCLUDEPATH+= $(QPEDIR)/include
7 DEPENDPATH+= $(QPEDIR)/include
8LIBS += -lqpe
9 INTERFACES= examplebase.ui
10 TARGET = example
diff --git a/examples/application/examplebase.ui b/examples/application/examplebase.ui
deleted file mode 100644
index b47d20c..0000000
--- a/examples/application/examplebase.ui
+++ b/dev/null
@@ -1,55 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>ExampleBase</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>ExampleBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>196</width>
15 <height>245</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Example</string>
21 </property>
22 <vbox>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget>
32 <class>QLabel</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>TextLabel1</cstring>
36 </property>
37 <property stdset="1">
38 <name>text</name>
39 <string>&lt;p&gt;This is just an &lt;i&gt;example&lt;/i&gt;. It doesn't do anything interesting at all.</string>
40 </property>
41 </widget>
42 <widget>
43 <class>QPushButton</class>
44 <property stdset="1">
45 <name>name</name>
46 <cstring>quit</cstring>
47 </property>
48 <property stdset="1">
49 <name>text</name>
50 <string>Quit</string>
51 </property>
52 </widget>
53 </vbox>
54</widget>
55</UI>
diff --git a/examples/application/index.html b/examples/application/index.html
deleted file mode 100644
index ad97378..0000000
--- a/examples/application/index.html
+++ b/dev/null
@@ -1,23 +0,0 @@
1<h1 align=center><small>Welcome to the</small><br>Qtopia SDK</h1>
2
3<h3>API Documentation</h3>
4<p>
5For API documentation, point a web browser at
6/opt/Qtopia/doc/html/qtopia/index.html
7
8<h3>Application Documentation</h3>
9Put English documentation for applications in:
10
11<p>
12&nbsp;&nbsp;&nbsp;$QPEDIR/help/html/<i>appname</i>.html
13
14<p>
15Put non-English documentation for applications in:
16
17<p>
18&nbsp;&nbsp;&nbsp;$QPEDIR/help/<i>lang</i>/html/<i>appname</i>.html
19
20<p>
21Where <i>lang</i> is the language specifier (eg. "de" for German),
22and <i>appname</i> is the program name of your application.
23
diff --git a/examples/application/main.cpp b/examples/application/main.cpp
deleted file mode 100644
index b705c44..0000000
--- a/examples/application/main.cpp
+++ b/dev/null
@@ -1,12 +0,0 @@
1#include "example.h"
2#include <qpe/qpeapplication.h>
3
4int main( int argc, char ** argv )
5{
6 QPEApplication a( argc, argv );
7
8 Example mw;
9 a.showMainWidget( &mw );
10
11 return a.exec();
12}
diff --git a/examples/qpepim-addressbook/abexample.desktop b/examples/qpepim-addressbook/abexample.desktop
deleted file mode 100644
index 24b44d1..0000000
--- a/examples/qpepim-addressbook/abexample.desktop
+++ b/dev/null
@@ -1,6 +0,0 @@
1[Desktop Entry]
2Comment=Simple QPEPIM Example
3Exec=abexample
4Icon=abexample
5Type=Application
6Name=AB QPEPIM
diff --git a/examples/qpepim-addressbook/abexample.png b/examples/qpepim-addressbook/abexample.png
deleted file mode 100644
index f63d0bc..0000000
--- a/examples/qpepim-addressbook/abexample.png
+++ b/dev/null
Binary files differ
diff --git a/examples/qpepim-addressbook/addressbookdumper.cpp b/examples/qpepim-addressbook/addressbookdumper.cpp
deleted file mode 100644
index c47e05c..0000000
--- a/examples/qpepim-addressbook/addressbookdumper.cpp
+++ b/dev/null
@@ -1,65 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include <qpe/contact.h>
22#include <qvaluelist.h>
23#include "addressbookdumper.h"
24
25AddressBookDumper::AddressBookDumper(QWidget* parent) : QMultiLineEdit(parent) {
26 // connect(&m_ABAccess, SIGNAL(addressbookUpdated()), this, SLOT(abChanged()));
27}
28
29AddressBookDumper::~AddressBookDumper() {
30}
31
32void AddressBookDumper::abChanged() {
33 QString newText;
34 QValueList<Contact> contacts = m_ABAccess.contacts();
35 QValueListConstIterator<Contact> it;
36 for (it = contacts.begin() ; it != contacts.end(); it++) {
37 newText.append((*it).firstName() + " " + (*it).lastName() + "\n");
38 }
39 setText(newText);
40}
41
42void AddressBookDumper::startBigEdit() {
43 if (m_ABAccess.startBlockEdit())
44 qDebug("*** Block edit successfully started.");
45 else
46 qDebug("*** Block edit start failed.");
47}
48
49void AddressBookDumper::endBigEdit() {
50 if (m_ABAccess.endBlockEdit())
51 qDebug("*** Block edit successfully ended.");
52 else
53 qDebug("*** Block edit end failed.");
54}
55
56void AddressBookDumper::addContact() {
57 Contact foo;
58 foo.setFirstName("Foo");
59 foo.setLastName("Bar");
60 foo.setFileAs();
61 if (m_ABAccess.addContact(foo))
62 qDebug("*** Add succeeded..");
63 else
64 qDebug("*** Add failed..");
65}
diff --git a/examples/qpepim-addressbook/addressbookdumper.h b/examples/qpepim-addressbook/addressbookdumper.h
deleted file mode 100644
index cc83d32..0000000
--- a/examples/qpepim-addressbook/addressbookdumper.h
+++ b/dev/null
@@ -1,39 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include <qmultilineedit.h>
22#include <qpe/pim/addressbookaccess.h>
23
24class AddressBookDumper : public QMultiLineEdit {
25 Q_OBJECT
26
27 public:
28 AddressBookDumper(QWidget* parent);
29 ~AddressBookDumper();
30
31 public slots:
32 void abChanged();
33 void startBigEdit();
34 void endBigEdit();
35 void addContact();
36
37 private:
38 AddressBookAccess m_ABAccess;
39};
diff --git a/examples/qpepim-addressbook/main.cpp b/examples/qpepim-addressbook/main.cpp
deleted file mode 100644
index 590fffe..0000000
--- a/examples/qpepim-addressbook/main.cpp
+++ b/dev/null
@@ -1,47 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include <qpe/qpeapplication.h>
22#ifdef QWS
23#include <qpe/qcopenvelope_qws.h>
24#endif
25#include <qapplication.h>
26#include <qpe/pim/addressbookaccess.h>
27#include "addressbookdumper.h"
28#include <qvbox.h>
29#include <qpushbutton.h>
30
31int main( int argc, char ** argv )
32{
33 QPEApplication a( argc, argv );
34 QVBox* vbox = new QVBox(0L);
35 QPushButton* clicker = new QPushButton("Refresh", vbox);
36 QPushButton* startBigEditButton = new QPushButton("Start Big Edit", vbox);
37 QPushButton* endBigEditButton = new QPushButton("End Big Edit", vbox);
38 QPushButton* addContactButton = new QPushButton("Add Contact", vbox);
39 AddressBookDumper* abDumper = new AddressBookDumper(vbox);
40 QObject::connect(clicker, SIGNAL(clicked()), abDumper, SLOT(abChanged()));
41 QObject::connect(startBigEditButton, SIGNAL(clicked()), abDumper, SLOT(startBigEdit()));
42 QObject::connect(endBigEditButton, SIGNAL(clicked()), abDumper, SLOT(endBigEdit()));
43 QObject::connect(addContactButton, SIGNAL(clicked()), abDumper, SLOT(addContact()));
44 a.setMainWidget(vbox);
45 vbox->show();
46 return a.exec();
47}
diff --git a/examples/qpepim-addressbook/qpepim-abexample.control b/examples/qpepim-addressbook/qpepim-abexample.control
deleted file mode 100644
index 5a31c97..0000000
--- a/examples/qpepim-addressbook/qpepim-abexample.control
+++ b/dev/null
@@ -1,9 +0,0 @@
1Files: bin/abexample apps/Applications/abexample.desktop
2Priority: optional
3Section: qpe/applications
4Maintainer: Warwick Allison <warwick@trolltech.com>
5Architecture: arm
6Version: $QPE_VERSION-1
7Depends: qpe-pim, qpe-base ($QPE_VERSION)
8Description: Example Addressbook reader
9 Simple example for using the QPEPIM access library.
diff --git a/examples/qpepim-addressbook/qpepim-addressbook.pro b/examples/qpepim-addressbook/qpepim-addressbook.pro
deleted file mode 100644
index 7e918e0..0000000
--- a/examples/qpepim-addressbook/qpepim-addressbook.pro
+++ b/dev/null
@@ -1,8 +0,0 @@
1TEMPLATE = app
2CONFIG = qt warn_on debug
3
4HEADERS = addressbookdumper.h
5SOURCES = main.cpp addressbookdumper.cpp
6TARGET = abexample
7INCLUDEPATH = $(QPEDIR)/include
8LIBS += -lqpepim -lqpe -lqte
diff --git a/inputmethods/handwriting/qimpenchar.cpp b/inputmethods/handwriting/qimpenchar.cpp
index 9c38ec9..152bfec 100644
--- a/inputmethods/handwriting/qimpenchar.cpp
+++ b/inputmethods/handwriting/qimpenchar.cpp
@@ -429,7 +429,7 @@ QIMPenCharMatchList QIMPenCharSet::match( QIMPenChar *ch )
429 err = ch->match( tmplChar ); 429 err = ch->match( tmplChar );
430 if ( err <= QIMPEN_MATCH_THRESHOLD ) { 430 if ( err <= QIMPEN_MATCH_THRESHOLD ) {
431 if (tmplChar->penStrokes().count() != ch->penStrokes().count()) 431 if (tmplChar->penStrokes().count() != ch->penStrokes().count())
432 err = QIMPEN_MATCH_THRESHOLD; 432 err = QMIN(err*3, QIMPEN_MATCH_THRESHOLD);
433 QIMPenCharMatchList::Iterator it; 433 QIMPenCharMatchList::Iterator it;
434 for ( it = matches.begin(); it != matches.end(); ++it ) { 434 for ( it = matches.begin(); it != matches.end(); ++it ) {
435 if ( (*it).penChar->character() == tmplChar->character() && 435 if ( (*it).penChar->character() == tmplChar->character() &&
diff --git a/library/alarmserver.h b/library/alarmserver.h
index 665c3ae..f12a63d 100644
--- a/library/alarmserver.h
+++ b/library/alarmserver.h
@@ -28,6 +28,9 @@ class AlarmServer
28public: 28public:
29 static void addAlarm ( QDateTime when, const QCString& channel, const QCString& msg, int data=0); 29 static void addAlarm ( QDateTime when, const QCString& channel, const QCString& msg, int data=0);
30 static void deleteAlarm (QDateTime when, const QCString& channel, const QCString& msg, int data=0); 30 static void deleteAlarm (QDateTime when, const QCString& channel, const QCString& msg, int data=0);
31
32private:
33 friend int initApplication(int, char **);
31 static void initialize(); 34 static void initialize();
32}; 35};
33 36
diff --git a/library/applnk.h b/library/applnk.h
index c6f92a3..18e20b6 100644
--- a/library/applnk.h
+++ b/library/applnk.h
@@ -58,6 +58,8 @@ public:
58 const QArray<int> &categories() const; 58 const QArray<int> &categories() const;
59 int id() const { return mId; } 59 int id() const { return mId; }
60 60
61 bool linkFileKnown() const { return !mLinkFile.isNull(); }
62
61 void execute() const; 63 void execute() const;
62 void execute(const QStringList& args) const; 64 void execute(const QStringList& args) const;
63 void removeFiles(); 65 void removeFiles();
@@ -96,6 +98,7 @@ protected:
96 98
97 virtual void invoke(const QStringList& args) const; 99 virtual void invoke(const QStringList& args) const;
98 bool ensureLinkExists() const; 100 bool ensureLinkExists() const;
101 void storeLink() const;
99}; 102};
100 103
101class DocLnk : public AppLnk 104class DocLnk : public AppLnk
diff --git a/library/backend/categories.cpp b/library/backend/categories.cpp
index 91331db..6e011c4 100644
--- a/library/backend/categories.cpp
+++ b/library/backend/categories.cpp
@@ -171,36 +171,6 @@ QStringList CategoryGroup::labels(const QArray<int> &catids ) const
171 return labels; 171 return labels;
172} 172}
173 173
174QArray<int> CategoryGroup::ids( const QStringList &cats ) const
175{
176 QArray<int> results;
177
178 for ( QStringList::ConstIterator catIt = cats.begin();
179 catIt != cats.end(); ++catIt ) {
180 if ( *catIt == QObject::tr("All") || *catIt == QObject::tr("Unfiled") )
181 continue;
182 int value = id( *catIt );
183 if ( value != 0 ) {
184 int tmp = results.size();
185 results.resize( tmp + 1 );
186 results[ tmp ] = value;
187 }
188 }
189
190 return results;
191}
192
193QArray<int> CategoryGroup::ids() const
194{
195 QArray<int> results( mIdLabelMap.count() );
196 int i = 0;
197 for ( QMap<int, QString>::ConstIterator it = mIdLabelMap.begin();
198 it != mIdLabelMap.end(); ++it )
199 results[i++] = it.key();
200
201 return results;
202}
203
204/*********************************************************** 174/***********************************************************
205 * 175 *
206 * Categories 176 * Categories
@@ -343,6 +313,14 @@ QStringList Categories::labels( const QString &app,
343 QMap< QString, CategoryGroup >::ConstIterator 313 QMap< QString, CategoryGroup >::ConstIterator
344 appIt = mAppCats.find( app ); 314 appIt = mAppCats.find( app );
345 QStringList cats; 315 QStringList cats;
316
317 if ( appIt != mAppCats.end() )
318 cats += (*appIt).labels();
319 else qDebug("Categories::labels didn't find app %s", app.latin1() );
320 if ( includeGlobal )
321 cats += mGlobalCats.labels();
322
323 cats.sort();
346 switch ( extra ) { 324 switch ( extra ) {
347 case NoExtra: break; 325 case NoExtra: break;
348 case AllUnfiled: 326 case AllUnfiled:
@@ -356,14 +334,7 @@ QStringList Categories::labels( const QString &app,
356 cats.append( tr("Unfiled") ); 334 cats.append( tr("Unfiled") );
357 break; 335 break;
358 } 336 }
359 if ( appIt != mAppCats.end() ) 337
360 cats += (*appIt).labels();
361 else qDebug("Categories::labels didn't find app %s", app.latin1() );
362 if ( includeGlobal )
363 cats += mGlobalCats.labels();
364 // I don't think a sorted list is useful, the user might find prefer
365 // it in the original order.
366// cats.sort();
367 return cats; 338 return cats;
368} 339}
369 340
@@ -378,14 +349,6 @@ QString Categories::label( const QString &app, int id ) const
378 return (*appIt).label( id ); 349 return (*appIt).label( id );
379} 350}
380 351
381QStringList Categories::labels( const QString & app,
382 const QArray<int> &catids ) const
383{
384 QStringList strs = mGlobalCats.labels( catids );
385 strs += mAppCats[app].labels( catids );
386 return strs;
387}
388
389/** Returns a single string associated with the cat ids for display in 352/** Returns a single string associated with the cat ids for display in
390 * a combobox or any area that requires one string. If catids are empty 353 * a combobox or any area that requires one string. If catids are empty
391 * then "Unfiled" will be returned. If multiple categories are assigned 354 * then "Unfiled" will be returned. If multiple categories are assigned
@@ -417,33 +380,21 @@ QString Categories::displaySingle( const QString &app,
417 return r; 380 return r;
418} 381}
419 382
420QArray<int> Categories::ids( const QString &app ) const 383QArray<int> Categories::ids( const QString &app, const QStringList &labels) const
421{
422 QArray<int> allIds = mGlobalCats.ids();
423 QArray<int> appIds = mAppCats[app].ids();
424
425 // we should make the guarentee that the ids are in the
426 // same order as the labels, (i.e. app cats then global)
427 // otherwise there is no point in having these two separate functions.
428 uint appSize = appIds.size();
429 appIds.resize( appSize + allIds.size() );
430 for ( uint i = appSize; i < appIds.size(); ++i )
431 appIds[int(i)] = allIds[int(i - appSize)];
432
433 return appIds;
434}
435
436QArray<int> Categories::ids( const QString &app, const QStringList &cats ) const
437{ 384{
438 QArray<int> allIds = mGlobalCats.ids( cats ); 385 QArray<int> results;
439 QArray<int> appIds = mAppCats[app].ids( cats ); 386 QStringList::ConstIterator it;
440 387 int i;
441 uint appSize = appIds.size(); 388
442 appIds.resize( appSize + allIds.size() ); 389 for ( i=0, it=labels.begin(); it!=labels.end(); i++, ++it ) {
443 for ( uint i = appSize; i < appIds.size(); ++i ) 390 int value = id( app, *it );
444 appIds[int(i)] = allIds[int(i - appSize)]; 391 if ( value != 0 ) {
445 392 int tmp = results.size();
446 return appIds; 393 results.resize( tmp + 1 );
394 results[ tmp ] = value;
395 }
396 }
397 return results;
447} 398}
448 399
449int Categories::id( const QString &app, const QString &cat ) const 400int Categories::id( const QString &app, const QString &cat ) const
@@ -539,23 +490,28 @@ bool Categories::exists( const QString &appname,
539 return (*appIt).contains( catname ); 490 return (*appIt).contains( catname );
540} 491}
541 492
493
542bool Categories::save( const QString &fname ) const 494bool Categories::save( const QString &fname ) const
543{ 495{
544 QFile file( fname ); 496 QString strNewFile = fname + ".new";
545 if ( !file.open( IO_WriteOnly ) ) { 497 QFile f( strNewFile );
498 QString out;
499 int total_written;
500
501 if ( !f.open( IO_WriteOnly|IO_Raw ) ) {
546 qWarning("Unable to write to %s", fname.latin1()); 502 qWarning("Unable to write to %s", fname.latin1());
547 return FALSE; 503 return FALSE;
548 } 504 }
549 505
550 QTextStream ts( &file ); 506 out = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
551 ts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; 507 out += "<!DOCTYPE CategoryList>\n";
552 ts << "<!DOCTYPE CategoryList>" << endl; 508
509 out += "<Categories>\n";
553 510
554 ts << "<Categories>" << endl;
555 for ( QMap<int, QString>::ConstIterator git = mGlobalCats.idMap().begin(); 511 for ( QMap<int, QString>::ConstIterator git = mGlobalCats.idMap().begin();
556 git != mGlobalCats.idMap().end(); ++git ) 512 git != mGlobalCats.idMap().end(); ++git )
557 ts << "<Category id=\"" << git.key() << "\"" 513 out += "<Category id=\"" + QString::number(git.key()) + "\"" +
558 << " name=\"" << escapeString(*git) << "\" />" << endl; 514 " name=\"" + escapeString(*git) + "\" />\n";
559 515
560 for ( QMap<QString, CategoryGroup>::ConstIterator appsIt=mAppCats.begin(); 516 for ( QMap<QString, CategoryGroup>::ConstIterator appsIt=mAppCats.begin();
561 appsIt != mAppCats.end(); ++appsIt ) { 517 appsIt != mAppCats.end(); ++appsIt ) {
@@ -563,13 +519,28 @@ bool Categories::save( const QString &fname ) const
563 const QMap<int, QString> &appcats = (*appsIt).idMap(); 519 const QMap<int, QString> &appcats = (*appsIt).idMap();
564 for ( QMap<int, QString>::ConstIterator appcatit = appcats.begin(); 520 for ( QMap<int, QString>::ConstIterator appcatit = appcats.begin();
565 appcatit != appcats.end(); ++appcatit ) 521 appcatit != appcats.end(); ++appcatit )
566 ts << "<Category id=\"" << appcatit.key() << "\"" 522 out += "<Category id=\"" + QString::number(appcatit.key()) + "\"" +
567 << " app=\"" << escapeString(app) << "\"" 523 " app=\"" + escapeString(app) + "\"" +
568 << " name=\"" << escapeString(*appcatit) << "\" />" << endl; 524 " name=\"" + escapeString(*appcatit) + "\" />\n";
525 }
526 out += "</Categories>\n";
527
528 QCString cstr = out.utf8();
529 total_written = f.writeBlock( cstr.data(), cstr.length() );
530 if ( total_written != int(cstr.length()) ) {
531 f.close();
532 QFile::remove( strNewFile );
533 return FALSE;
534 }
535 f.close();
536
537 if ( ::rename( strNewFile.latin1(), fname.latin1() ) < 0 ) {
538 qWarning( "problem renaming file %s to %s",
539 strNewFile.latin1(), fname.latin1());
540 // remove the tmp file...
541 QFile::remove( strNewFile );
569 } 542 }
570 ts << "</Categories>" << endl;
571 543
572 file.close();
573 return TRUE; 544 return TRUE;
574} 545}
575 546
@@ -578,6 +549,11 @@ bool Categories::load( const QString &fname )
578 QFile file( fname ); 549 QFile file( fname );
579 if ( !file.open( IO_ReadOnly ) ) { 550 if ( !file.open( IO_ReadOnly ) ) {
580 qWarning("Unable to open %s", fname.latin1()); 551 qWarning("Unable to open %s", fname.latin1());
552
553 addGlobalCategory(tr("Business"));
554 addGlobalCategory(tr("Personal"));
555 save(fname);
556
581 return FALSE; 557 return FALSE;
582 } 558 }
583 559
diff --git a/library/backend/categories.h b/library/backend/categories.h
index 82d765b..ba65ee3 100644
--- a/library/backend/categories.h
+++ b/library/backend/categories.h
@@ -71,8 +71,7 @@ public:
71 71
72 /** Returns a sorted list of labels */ 72 /** Returns a sorted list of labels */
73 QStringList labels() const; 73 QStringList labels() const;
74 QArray<int> ids( const QStringList &cats ) const; 74
75 QArray<int> ids() const;
76 QStringList labels( const QArray<int> &catids ) const; 75 QStringList labels( const QArray<int> &catids ) const;
77 76
78 const QMap<int, QString> &idMap() const { return mIdLabelMap; } 77 const QMap<int, QString> &idMap() const { return mIdLabelMap; }
@@ -130,9 +129,8 @@ public:
130 bool removeGlobalCategory( const QString &catName ); 129 bool removeGlobalCategory( const QString &catName );
131 bool removeGlobalCategory( int uid ); 130 bool removeGlobalCategory( int uid );
132 131
133 QArray<int> ids( const QString &app ) const; 132 QArray<int> ids( const QString &app, const QStringList &labels) const;
134 QArray<int> ids( const QString &app, 133
135 const QStringList &cats ) const;
136 /** Returns the id associated with the app */ 134 /** Returns the id associated with the app */
137 int id( const QString &app, const QString &cat ) const; 135 int id( const QString &app, const QString &cat ) const;
138 /** Returns the label associated with the id */ 136 /** Returns the label associated with the id */
@@ -153,10 +151,6 @@ public:
153 bool includeGlobal = TRUE, 151 bool includeGlobal = TRUE,
154 ExtraLabels extra = NoExtra ) const; 152 ExtraLabels extra = NoExtra ) const;
155 153
156 /** Returns the labels of the categories associated with the uids */
157 QStringList labels( const QString & app,
158 const QArray<int> &catids ) const;
159
160 enum DisplaySingle { ShowMulti, ShowAll, ShowFirst }; 154 enum DisplaySingle { ShowMulti, ShowAll, ShowFirst };
161 155
162 /** Returns a single string associated with the cat ids for display in 156 /** Returns a single string associated with the cat ids for display in
diff --git a/library/backend/contact.cpp b/library/backend/contact.cpp
index a5f10ab..b10b19a 100644
--- a/library/backend/contact.cpp
+++ b/library/backend/contact.cpp
@@ -18,9 +18,11 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#define QTOPIA_INTERNAL_CONTACT_MRE
22
21#include "contact.h" 23#include "contact.h"
22#include "vobject_p.h" 24#include "vobject_p.h"
23#include "qfiledirect_p.h" 25#include "qfiledirect_p.h"
24 26
25#include <qpe/stringutil.h> 27#include <qpe/stringutil.h>
26#include <qpe/timeconversion.h> 28#include <qpe/timeconversion.h>
@@ -386,45 +388,49 @@ QStringList Contact::fields()
386 list.append( "Suffix" ); 388 list.append( "Suffix" );
387 list.append( "FileAs" ); 389 list.append( "FileAs" );
388 390
391 list.append( "JobTitle" );
392 list.append( "Department" );
393 list.append( "Company" );
394 list.append( "BusinessPhone" );
395 list.append( "BusinessFax" );
396 list.append( "BusinessMobile" );
397
389 list.append( "DefaultEmail" ); 398 list.append( "DefaultEmail" );
390 list.append( "Emails" ); 399 list.append( "Emails" );
391 400
392 list.append( "HomeStreet" );
393 list.append( "HomeCity" );
394 list.append( "HomeState" );
395 list.append( "HomeZip" );
396 list.append( "HomeCountry" );
397 list.append( "HomePhone" ); 401 list.append( "HomePhone" );
398 list.append( "HomeFax" ); 402 list.append( "HomeFax" );
399 list.append( "HomeMobile" ); 403 list.append( "HomeMobile" );
400 list.append( "HomeWebPage" );
401 404
402 list.append( "Company" );
403 list.append( "BusinessStreet" ); 405 list.append( "BusinessStreet" );
404 list.append( "BusinessCity" ); 406 list.append( "BusinessCity" );
405 list.append( "BusinessState" ); 407 list.append( "BusinessState" );
406 list.append( "BusinessZip" ); 408 list.append( "BusinessZip" );
407 list.append( "BusinessCountry" ); 409 list.append( "BusinessCountry" );
410 list.append( "BusinessPager" );
408 list.append( "BusinessWebPage" ); 411 list.append( "BusinessWebPage" );
409 list.append( "JobTitle" ); 412
410 list.append( "Department" );
411 list.append( "Office" ); 413 list.append( "Office" );
412 list.append( "BusinessPhone" );
413 list.append( "BusinessFax" );
414 list.append( "BusinessMobile" );
415 list.append( "BusinessPager" );
416 list.append( "Profession" ); 414 list.append( "Profession" );
417 list.append( "Assistant" ); 415 list.append( "Assistant" );
418 list.append( "Manager" ); 416 list.append( "Manager" );
419 417
418 list.append( "HomeStreet" );
419 list.append( "HomeCity" );
420 list.append( "HomeState" );
421 list.append( "HomeZip" );
422 list.append( "HomeCountry" );
423 list.append( "HomeWebPage" );
424
420 list.append( "Spouse" ); 425 list.append( "Spouse" );
421 list.append( "Gender" ); 426 list.append( "Gender" );
422 list.append( "Birthday" ); 427 list.append( "Birthday" );
423 list.append( "Anniversary" ); 428 list.append( "Anniversary" );
424 list.append( "Nickname" ); 429 list.append( "Nickname" );
425
426 list.append( "Children" ); 430 list.append( "Children" );
431
427 list.append( "Notes" ); 432 list.append( "Notes" );
433 list.append( "Groups" );
428 434
429 return list; 435 return list;
430} 436}
@@ -440,45 +446,49 @@ QStringList Contact::trfields()
440 list.append( QObject::tr( "Suffix" ) ); 446 list.append( QObject::tr( "Suffix" ) );
441 list.append( QObject::tr( "File As" ) ); 447 list.append( QObject::tr( "File As" ) );
442 448
449 list.append( QObject::tr( "Job Title" ) );
450 list.append( QObject::tr( "Department" ) );
451 list.append( QObject::tr( "Company" ) );
452 list.append( QObject::tr( "Business Phone" ) );
453 list.append( QObject::tr( "Business Fax" ) );
454 list.append( QObject::tr( "Business Mobile" ) );
455
443 list.append( QObject::tr( "Default Email" ) ); 456 list.append( QObject::tr( "Default Email" ) );
444 list.append( QObject::tr( "Emails" ) ); 457 list.append( QObject::tr( "Emails" ) );
445 458
446 list.append( QObject::tr( "Home Street" ) );
447 list.append( QObject::tr( "Home City" ) );
448 list.append( QObject::tr( "Home State" ) );
449 list.append( QObject::tr( "Home Zip" ) );
450 list.append( QObject::tr( "Home Country" ) );
451 list.append( QObject::tr( "Home Phone" ) ); 459 list.append( QObject::tr( "Home Phone" ) );
452 list.append( QObject::tr( "Home Fax" ) ); 460 list.append( QObject::tr( "Home Fax" ) );
453 list.append( QObject::tr( "Home Mobile" ) ); 461 list.append( QObject::tr( "Home Mobile" ) );
454 list.append( QObject::tr( "Home Web Page" ) );
455 462
456 list.append( QObject::tr( "Company" ) );
457 list.append( QObject::tr( "Business Street" ) ); 463 list.append( QObject::tr( "Business Street" ) );
458 list.append( QObject::tr( "Business City" ) ); 464 list.append( QObject::tr( "Business City" ) );
459 list.append( QObject::tr( "Business State" ) ); 465 list.append( QObject::tr( "Business State" ) );
460 list.append( QObject::tr( "Business Zip" ) ); 466 list.append( QObject::tr( "Business Zip" ) );
461 list.append( QObject::tr( "Business Country" ) ); 467 list.append( QObject::tr( "Business Country" ) );
468 list.append( QObject::tr( "Business Pager" ) );
462 list.append( QObject::tr( "Business WebPage" ) ); 469 list.append( QObject::tr( "Business WebPage" ) );
463 list.append( QObject::tr( "Job Title" ) ); 470
464 list.append( QObject::tr( "Department" ) );
465 list.append( QObject::tr( "Office" ) ); 471 list.append( QObject::tr( "Office" ) );
466 list.append( QObject::tr( "Business Phone" ) );
467 list.append( QObject::tr( "Business Fax" ) );
468 list.append( QObject::tr( "Business Mobile" ) );
469 list.append( QObject::tr( "Business Pager" ) );
470 list.append( QObject::tr( "Profession" ) ); 472 list.append( QObject::tr( "Profession" ) );
471 list.append( QObject::tr( "Assistant" ) ); 473 list.append( QObject::tr( "Assistant" ) );
472 list.append( QObject::tr( "Manager" ) ); 474 list.append( QObject::tr( "Manager" ) );
473 475
476 list.append( QObject::tr( "Home Street" ) );
477 list.append( QObject::tr( "Home City" ) );
478 list.append( QObject::tr( "Home State" ) );
479 list.append( QObject::tr( "Home Zip" ) );
480 list.append( QObject::tr( "Home Country" ) );
481 list.append( QObject::tr( "Home Web Page" ) );
482
474 list.append( QObject::tr( "Spouse" ) ); 483 list.append( QObject::tr( "Spouse" ) );
475 list.append( QObject::tr( "Gender" ) ); 484 list.append( QObject::tr( "Gender" ) );
476 list.append( QObject::tr( "Birthday" ) ); 485 list.append( QObject::tr( "Birthday" ) );
477 list.append( QObject::tr( "Anniversary" ) ); 486 list.append( QObject::tr( "Anniversary" ) );
478 list.append( QObject::tr( "Nickname" ) ); 487 list.append( QObject::tr( "Nickname" ) );
479
480 list.append( QObject::tr( "Children" ) ); 488 list.append( QObject::tr( "Children" ) );
489
481 list.append( QObject::tr( "Notes" ) ); 490 list.append( QObject::tr( "Notes" ) );
491 list.append( QObject::tr( "Groups" ) );
482 492
483 return list; 493 return list;
484} 494}
@@ -629,7 +639,7 @@ static Contact parseVObject( VObject *obj )
629 initPropIterator( &nit, o ); 639 initPropIterator( &nit, o );
630 while( moreIteration( &nit ) ) { 640 while( moreIteration( &nit ) ) {
631 VObject *o = nextVObject( &nit ); 641 VObject *o = nextVObject( &nit );
632 QCString name = vObjectName( o ); 642 QCString name = vObjectTypeInfo( o );
633 QString value = vObjectStringZValue( o ); 643 QString value = vObjectStringZValue( o );
634 if ( name == VCNamePrefixesProp ) 644 if ( name == VCNamePrefixesProp )
635 c.setTitle( value ); 645 c.setTitle( value );
@@ -702,7 +712,7 @@ static Contact parseVObject( VObject *obj )
702 initPropIterator( &nit, o ); 712 initPropIterator( &nit, o );
703 while( moreIteration( &nit ) ) { 713 while( moreIteration( &nit ) ) {
704 VObject *o = nextVObject( &nit ); 714 VObject *o = nextVObject( &nit );
705 QCString name = vObjectName( o ); 715 QCString name = vObjectTypeInfo( o );
706 if ( name == VCHomeProp ) 716 if ( name == VCHomeProp )
707 type |= HOME; 717 type |= HOME;
708 else if ( name == VCWorkProp ) 718 else if ( name == VCWorkProp )
@@ -749,7 +759,7 @@ static Contact parseVObject( VObject *obj )
749 initPropIterator( &nit, o ); 759 initPropIterator( &nit, o );
750 while( moreIteration( &nit ) ) { 760 while( moreIteration( &nit ) ) {
751 VObject *o = nextVObject( &nit ); 761 VObject *o = nextVObject( &nit );
752 QCString name = vObjectName( o ); 762 QCString name = vObjectTypeInfo( o );
753 if ( name != VCInternetProp && name != VCHomeProp && 763 if ( name != VCInternetProp && name != VCHomeProp &&
754 name != VCWorkProp && 764 name != VCWorkProp &&
755 name != VCPreferredProp ) 765 name != VCPreferredProp )
@@ -772,7 +782,7 @@ static Contact parseVObject( VObject *obj )
772 initPropIterator( &nit, o ); 782 initPropIterator( &nit, o );
773 while( moreIteration( &nit ) ) { 783 while( moreIteration( &nit ) ) {
774 VObject *o = nextVObject( &nit ); 784 VObject *o = nextVObject( &nit );
775 QCString name = vObjectName( o ); 785 QCString name = vObjectTypeInfo( o );
776 if ( name == VCHomeProp ) 786 if ( name == VCHomeProp )
777 c.setHomeWebpage( value ); 787 c.setHomeWebpage( value );
778 else if ( name == VCWorkProp ) 788 else if ( name == VCWorkProp )
@@ -842,12 +852,12 @@ static Contact parseVObject( VObject *obj )
842} 852}
843 853
844void Contact::writeVCard( const QString &filename, const QValueList<Contact> &contacts) 854void Contact::writeVCard( const QString &filename, const QValueList<Contact> &contacts)
845{ 855{
846 QFileDirect f( filename.utf8().data() ); 856 QFileDirect f( filename.utf8().data() );
847 if ( !f.open( IO_WriteOnly ) ) { 857 if ( !f.open( IO_WriteOnly ) ) {
848 qWarning("Unable to open vcard write"); 858 qWarning("Unable to open vcard write");
849 return; 859 return;
850 } 860 }
851 861
852 QValueList<Contact>::ConstIterator it; 862 QValueList<Contact>::ConstIterator it;
853 for( it = contacts.begin(); it != contacts.end(); ++it ) { 863 for( it = contacts.begin(); it != contacts.end(); ++it ) {
@@ -859,12 +869,12 @@ void Contact::writeVCard( const QString &filename, const QValueList<Contact> &co
859} 869}
860 870
861void Contact::writeVCard( const QString &filename, const Contact &contact) 871void Contact::writeVCard( const QString &filename, const Contact &contact)
862{ 872{
863 QFileDirect f( filename.utf8().data() ); 873 QFileDirect f( filename.utf8().data() );
864 if ( !f.open( IO_WriteOnly ) ) { 874 if ( !f.open( IO_WriteOnly ) ) {
865 qWarning("Unable to open vcard write"); 875 qWarning("Unable to open vcard write");
866 return; 876 return;
867 } 877 }
868 878
869 VObject *obj = createVObject( contact ); 879 VObject *obj = createVObject( contact );
870 writeVObject( f.directHandle() , obj ); 880 writeVObject( f.directHandle() , obj );
@@ -894,6 +904,11 @@ QValueList<Contact> Contact::readVCard( const QString &filename )
894 return contacts; 904 return contacts;
895} 905}
896 906
907bool Contact::match( const QString &regexp ) const
908{
909 return match(QRegExp(regexp));
910}
911
897bool Contact::match( const QRegExp &r ) const 912bool Contact::match( const QRegExp &r ) const
898{ 913{
899 bool match; 914 bool match;
diff --git a/library/backend/contact.h b/library/backend/contact.h
index 6abdab6..a74cbbe 100644
--- a/library/backend/contact.h
+++ b/library/backend/contact.h
@@ -101,7 +101,12 @@ public:
101 // other 101 // other
102 void setNotes( const QString &v ) { replace( Qtopia::Notes, v); } 102 void setNotes( const QString &v ) { replace( Qtopia::Notes, v); }
103 103
104 bool match( const QRegExp &r ) const; 104 bool match( const QString &regexp ) const;
105
106// DON'T ATTEMPT TO USE THIS
107#ifdef QTOPIA_INTERNAL_CONTACT_MRE
108 bool match( const QRegExp &regexp ) const;
109#endif
105 110
106// // custom 111// // custom
107// void setCustomField( const QString &key, const QString &v ) 112// void setCustomField( const QString &key, const QString &v )
diff --git a/library/backend/event.h b/library/backend/event.h
index 0ebe9ea..277aadd 100644
--- a/library/backend/event.h
+++ b/library/backend/event.h
@@ -140,7 +140,12 @@ private:
140 SoundTypeChoice aSound; 140 SoundTypeChoice aSound;
141 RepeatPattern pattern; 141 RepeatPattern pattern;
142 QString note; 142 QString note;
143 // ADDITION
144 int mRid;// Recode ID
145 int mRinfo;// Recode Info
146 //
143 EventPrivate *d; 147 EventPrivate *d;
148
144}; 149};
145 150
146// Since an event spans multiple day, it is better to have this 151// Since an event spans multiple day, it is better to have this
diff --git a/library/backend/recordfields.h b/library/backend/recordfields.h
index 3cddde2..4196c8b 100644
--- a/library/backend/recordfields.h
+++ b/library/backend/recordfields.h
@@ -31,7 +31,9 @@ namespace Qtopia
31 enum AddressBookFields { 31 enum AddressBookFields {
32 AddressUid = UID_ID, 32 AddressUid = UID_ID,
33 AddressCategory = CATEGORY_ID, 33 AddressCategory = CATEGORY_ID,
34 34
35 // NOTE: Order of fields dependency in backend/contact.cpp
36
35 Title, 37 Title,
36 FirstName, 38 FirstName,
37 MiddleName, 39 MiddleName,
@@ -39,40 +41,43 @@ namespace Qtopia
39 Suffix, 41 Suffix,
40 FileAs, 42 FileAs,
41 43
44 JobTitle,
45 Department,
46 Company,
47 BusinessPhone,
48 BusinessFax,
49 BusinessMobile,
50
42 // email 51 // email
43 DefaultEmail, 52 DefaultEmail,
44 Emails, 53 Emails,
45 54
46 // home
47 HomeStreet,
48 HomeCity,
49 HomeState,
50 HomeZip,
51 HomeCountry,
52 HomePhone, 55 HomePhone,
53 HomeFax, 56 HomeFax,
54 HomeMobile, 57 HomeMobile,
55 HomeWebPage,
56 58
57 // business 59 // business
58 Company,
59 BusinessStreet, 60 BusinessStreet,
60 BusinessCity, 61 BusinessCity,
61 BusinessState, 62 BusinessState,
62 BusinessZip, 63 BusinessZip,
63 BusinessCountry, 64 BusinessCountry,
65 BusinessPager,
64 BusinessWebPage, 66 BusinessWebPage,
65 JobTitle, 67
66 Department,
67 Office, 68 Office,
68 BusinessPhone,
69 BusinessFax,
70 BusinessMobile,
71 BusinessPager,
72 Profession, 69 Profession,
73 Assistant, 70 Assistant,
74 Manager, 71 Manager,
75 72
73 // home
74 HomeStreet,
75 HomeCity,
76 HomeState,
77 HomeZip,
78 HomeCountry,
79 HomeWebPage,
80
76 //personal 81 //personal
77 Spouse, 82 Spouse,
78 Gender, 83 Gender,
@@ -84,6 +89,9 @@ namespace Qtopia
84 // other 89 // other
85 Notes, 90 Notes,
86 Groups 91 Groups
92
93 ,rid,
94 rinfo
87 }; 95 };
88 96
89 // dataset = "todolist" 97 // dataset = "todolist"
@@ -95,7 +103,10 @@ namespace Qtopia
95 Completed, 103 Completed,
96 TaskDescription, 104 TaskDescription,
97 Priority, 105 Priority,
98 Date 106 Date,
107
108 TaskRid,
109 TaskRinfo
99 }; 110 };
100 111
101 // dataset = "categories" for todos 112 // dataset = "categories" for todos
@@ -128,6 +139,9 @@ namespace Qtopia
128 RepeatPatternDays, 139 RepeatPatternDays,
129 RepeatPatternHasEndDate, 140 RepeatPatternHasEndDate,
130 RepeatPatternEndDate, 141 RepeatPatternEndDate,
142
143 DateBookRid,
144 DateBookRinfo
131 }; 145 };
132}; 146};
133 147
diff --git a/library/backend/task.h b/library/backend/task.h
index ffe26b0..6f383b8 100644
--- a/library/backend/task.h
+++ b/library/backend/task.h
@@ -72,6 +72,10 @@ private:
72 int mPriority; 72 int mPriority;
73 QString mDesc; 73 QString mDesc;
74 TaskPrivate *d; 74 TaskPrivate *d;
75 // ADDITION
76 int recordId;
77 int recordInfo;
78 //
75}; 79};
76 80
77#endif 81#endif
diff --git a/library/backend/vobject.cpp b/library/backend/vobject.cpp
index af112a7..9c2ba3b 100644
--- a/library/backend/vobject.cpp
+++ b/library/backend/vobject.cpp
@@ -1207,4 +1207,13 @@ DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list)
1207 } 1207 }
1208} 1208}
1209 1209
1210DLLEXPORT(const char *) vObjectTypeInfo(VObject *o)
1211{
1212 const char *type = vObjectName( o );
1213 if ( strcmp( type, "TYPE" ) == 0 )
1214 type = vObjectStringZValue( o );
1215 return type;
1216}
1217
1218
1210// end of source file vobject.c 1219// end of source file vobject.c
diff --git a/library/backend/vobject_p.h b/library/backend/vobject_p.h
index b6a2c0a..a0d921e 100644
--- a/library/backend/vobject_p.h
+++ b/library/backend/vobject_p.h
@@ -396,6 +396,9 @@ extern VObject* Parse_MIME_FromFile(CFile *file);
396extern VObject* Parse_MIME_FromFile(FILE *file); 396extern VObject* Parse_MIME_FromFile(FILE *file);
397#endif 397#endif
398 398
399extern DLLEXPORT(const char *) vObjectTypeInfo(VObject *o);
400
401
399#endif /* __VOBJECT_H__ */ 402#endif /* __VOBJECT_H__ */
400 403
401 404
diff --git a/library/categoryedit_p.cpp b/library/categoryedit_p.cpp
index 06e5fec..07e707e 100644
--- a/library/categoryedit_p.cpp
+++ b/library/categoryedit_p.cpp
@@ -75,9 +75,11 @@ void CategoryEdit::setCategories( const QArray<int> &recCats,
75 d = new CategoryEditPrivate( (QWidget*)parent(), name() ); 75 d = new CategoryEditPrivate( (QWidget*)parent(), name() );
76 d->mStrApp = appName; 76 d->mStrApp = appName;
77 d->mVisible = visibleName; 77 d->mVisible = visibleName;
78 QArray<int> cats = d->mCategories.ids( d->mStrApp ); 78
79 lvView->clear();
80 QStringList appCats = d->mCategories.labels( d->mStrApp ); 79 QStringList appCats = d->mCategories.labels( d->mStrApp );
80 QArray<int> cats = d->mCategories.ids(d->mStrApp, appCats);
81 lvView->clear();
82
81 QStringList::ConstIterator it; 83 QStringList::ConstIterator it;
82 int i, j; 84 int i, j;
83 for ( i = 0, it = appCats.begin(); it != appCats.end(); i++, ++it ) { 85 for ( i = 0, it = appCats.begin(); it != appCats.end(); i++, ++it ) {
diff --git a/library/categoryselect.cpp b/library/categoryselect.cpp
index dc5d1fa..21b3f91 100644
--- a/library/categoryselect.cpp
+++ b/library/categoryselect.cpp
@@ -19,14 +19,24 @@
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <qpe/categories.h> 21#include <qpe/categories.h>
22#include <qpe/palmtoprecord.h>
22 23
23#include <qdialog.h> 24#include <qmessagebox.h>
24#include <qlayout.h> 25#include <qlayout.h>
25#include <qtoolbutton.h> 26#include <qtoolbutton.h>
27#include <qfile.h>
26 28
27#include "categorywidget.h" 29#include "categorywidget.h"
28#include "categoryselect.h" 30#include "categoryselect.h"
29 31
32#include <stdlib.h>
33
34static QString categoryEdittingFileName()
35{
36 QString str = getenv("HOME");
37 str +="/.cateditting";
38 return str;
39}
30 40
31class CategoryComboPrivate 41class CategoryComboPrivate
32{ 42{
@@ -57,10 +67,12 @@ public:
57 QString mVisibleName; 67 QString mVisibleName;
58}; 68};
59 69
60CategoryCombo::CategoryCombo( QWidget *parent, const char *name ) 70CategoryCombo::CategoryCombo( QWidget *parent, const char *name , int width)
61 : QComboBox( parent, name ) 71 : QComboBox( parent, name )
62{ 72{
63 d = new CategoryComboPrivate(this); 73 d = new CategoryComboPrivate(this);
74 if (width)
75 setFixedWidth(width);
64} 76}
65 77
66void CategoryCombo::initCombo( const QArray<int> &recCats, 78void CategoryCombo::initCombo( const QArray<int> &recCats,
@@ -78,11 +90,15 @@ void CategoryCombo::initCombo( const QArray<int> &recCats,
78 clear(); 90 clear();
79 QStringList slApp; 91 QStringList slApp;
80 92
93 QObject::disconnect( this, SIGNAL(activated(int)),
94 this, SLOT(slotValueChanged(int)) );
95
81 QObject::connect( this, SIGNAL(activated(int)), 96 QObject::connect( this, SIGNAL(activated(int)),
82 this, SLOT(slotValueChanged(int)) ); 97 this, SLOT(slotValueChanged(int)) );
83 bool loadOk = d->mCat.load( categoryFileName() ); 98 bool loadOk = d->mCat.load( categoryFileName() );
84 slApp = d->mCat.labels( d->mStrAppName, TRUE, Categories::UnfiledLabel ); 99 slApp = d->mCat.labels( d->mStrAppName, TRUE, Categories::UnfiledLabel );
85 d->mAppCats = d->mCat.ids( d->mStrAppName ); 100
101 d->mAppCats = d->mCat.ids( d->mStrAppName, slApp);
86 102
87 int i, 103 int i,
88 j, 104 j,
@@ -94,9 +110,7 @@ void CategoryCombo::initCombo( const QArray<int> &recCats,
94 saveMe = -1; 110 saveMe = -1;
95 if ( recCount > 1 && loadOk ) { 111 if ( recCount > 1 && loadOk ) {
96 it = slApp.begin(); 112 it = slApp.begin();
97 insertItem( *it ); 113 for ( j = 0; j< (int)(slApp.count()-1); ++it, j++ ) {
98 ++it;
99 for ( j = 0; it != slApp.end(); ++it, j++ ) {
100 // grr... we have to go through and compare... 114 // grr... we have to go through and compare...
101 if ( j < int(d->mAppCats.size()) ) { 115 if ( j < int(d->mAppCats.size()) ) {
102 for ( i = 0; i < recCount; i++ ) { 116 for ( i = 0; i < recCount; i++ ) {
@@ -111,22 +125,121 @@ void CategoryCombo::initCombo( const QArray<int> &recCats,
111 } 125 }
112 insertItem( *it ); 126 insertItem( *it );
113 } 127 }
128 insertItem( *it );
114 } else 129 } else
115 insertStringList( slApp ); 130 insertStringList( slApp );
116 131
117 if ( recCount > 0 && loadOk ) { 132 if ( recCount > 0 && loadOk ) {
118 for ( i = 0; i < int(d->mAppCats.size()); i++ ) { 133 for ( i = 0; i < int(d->mAppCats.size()); i++ ) {
119 if ( d->mAppCats[i] == recCats[0] ) { 134 if ( d->mAppCats[i] == recCats[0] ) {
120 setCurrentItem( i + 1 ); 135 setCurrentItem( i );
136 break;
137 }
138 }
139 } else
140 {
141 setCurrentItem( slApp.count()-1 ); // unfiled
142 }
143}
144
145// this is a new function by SHARP instead of initCombo()
146QArray<int> CategoryCombo::initComboWithRefind( const QArray<int> &recCats,
147 const QString &appName)
148{
149 QString visibleName = appName;
150 d->mStrAppName = appName;
151 d->mStrVisibleName = visibleName;
152 clear();
153 QStringList slApp;
154 QArray<int> results;
155
156 QObject::disconnect( this, SIGNAL(activated(int)),
157 this, SLOT(slotValueChanged(int)) );
158
159 QObject::connect( this, SIGNAL(activated(int)),
160 this, SLOT(slotValueChanged(int)) );
161 bool loadOk = d->mCat.load( categoryFileName() );
162 slApp = d->mCat.labels( d->mStrAppName, TRUE, Categories::UnfiledLabel );
163
164 d->mAppCats = d->mCat.ids( d->mStrAppName, slApp);
165
166 // addition part
167 // make new recCats
168 if (loadOk){
169 int i,j;
170 int value;
171 int rCount = recCats.count();
172 int mCount = d->mAppCats.count();
173
174 for (i=0; i<rCount; i++){
175 value = 0;
176 for (j=0; j<mCount; j++){
177 if (recCats[i] == d->mAppCats[j]){
178 value = recCats[i];
179 break;
180 }
181 }
182 if (value != 0){
183 int tmp = results.size();
184 results.resize( tmp + 1 );
185 results[ tmp ] = value;
186 }
187 }
188 }
189 else{
190 results = recCats;
191 }
192 // addition end
193
194 int i,
195 j,
196 saveMe,
197 recCount;
198 QStringList::Iterator it;
199 // now add in all the items...
200 recCount = results.count();
201 saveMe = -1;
202 if ( recCount > 1 && loadOk ) {
203 it = slApp.begin();
204 for ( j = 0; j< (int)(slApp.count()-1); ++it, j++ ) {
205
206 // grr... we have to go through and compare...
207 if ( j < int(d->mAppCats.size()) ) {
208 for ( i = 0; i < recCount; i++ ) {
209 if ( results[i] == d->mAppCats[j] ) {
210 (*it).append( tr(" (Multi.)") );
211 if ( saveMe < 0 )
212 saveMe = j;
213 // no need to continue through the list.
214 break;
215 }
216 }
217 }
218 insertItem( *it );
219 }
220 insertItem( *it );
221 } else
222 insertStringList( slApp );
223
224 if ( recCount > 0 && loadOk ) {
225 for ( i = 0; i < int(d->mAppCats.size()); i++ ) {
226 if ( d->mAppCats[i] == results[0] ) {
227 setCurrentItem( i );
121 break; 228 break;
122 } 229 }
123 } 230 }
124 } else 231 } else
125 setCurrentItem( 0 ); // unfiled 232 {
233 setCurrentItem( slApp.count()-1 ); // unfiled
234 }
235/*
126 QObject::connect( this, SIGNAL(activated(int)), 236 QObject::connect( this, SIGNAL(activated(int)),
127 this, SLOT(slotValueChanged(int)) ); 237 this, SLOT(slotValueChanged(int)) );
238*/
239 return results;
128} 240}
129 241
242
130CategoryCombo::~CategoryCombo() 243CategoryCombo::~CategoryCombo()
131{ 244{
132 delete d; 245 delete d;
@@ -136,13 +249,13 @@ int CategoryCombo::currentCategory() const
136{ 249{
137 int returnMe; 250 int returnMe;
138 returnMe = currentItem(); 251 returnMe = currentItem();
139 // unfiled is now 0... 252
140 if ( returnMe == 0 ) 253 if ( returnMe == (int)d->mAppCats.count() )
141 returnMe = -1; 254 returnMe = -1;
142 else if ( returnMe > (int)d->mAppCats.count() ) // only happen on "All" 255 else if ( returnMe > (int)d->mAppCats.count() ) // only happen on "All"
143 returnMe = -2; 256 returnMe = -2;
144 else 257 else
145 returnMe = d->mAppCats[returnMe - 1]; 258 returnMe = d->mAppCats[returnMe];
146 return returnMe; 259 return returnMe;
147} 260}
148 261
@@ -173,34 +286,36 @@ void CategoryCombo::slotValueChanged( int )
173 emit sigCatChanged( currentCategory() ); 286 emit sigCatChanged( currentCategory() );
174} 287}
175 288
176CategorySelect::CategorySelect( QWidget *parent, const char *name ) 289CategorySelect::CategorySelect( QWidget *parent, const char *name,int width)
177 : QHBox( parent, name ), 290 : QHBox( parent, name ),
178 cmbCat( 0 ), 291 cmbCat( 0 ),
179 cmdCat( 0 ), 292 cmdCat( 0 ),
180 d( 0 ) 293 d( 0 )
181{ 294{
182 d = new CategorySelectPrivate(); 295 d = new CategorySelectPrivate();
183 init(); 296 init(width);
184} 297}
185 298
186CategorySelect::CategorySelect( const QArray<int> &vl, 299CategorySelect::CategorySelect( const QArray<int> &vl,
187 const QString &appName, QWidget *parent, 300 const QString &appName, QWidget *parent,
188 const char *name ) 301 const char *name ,int width)
189 : QHBox( parent, name ) 302 : QHBox( parent, name )
190{ 303{
191 d = new CategorySelectPrivate( vl ); 304 d = new CategorySelectPrivate( vl );
192 init(); 305
306 init(width);
307
193 setCategories( vl, appName, appName ); 308 setCategories( vl, appName, appName );
194} 309}
195 310
196CategorySelect::CategorySelect( const QArray<int> &vl, 311CategorySelect::CategorySelect( const QArray<int> &vl,
197 const QString &appName, 312 const QString &appName,
198 const QString &visibleName, 313 const QString &visibleName,
199 QWidget *parent, const char *name ) 314 QWidget *parent, const char *name , int width)
200 : QHBox( parent, name ) 315 : QHBox( parent, name )
201{ 316{
202 d = new CategorySelectPrivate( vl ); 317 d = new CategorySelectPrivate( vl );
203 init(); 318 init(width);
204 setCategories( vl, appName, visibleName ); 319 setCategories( vl, appName, visibleName );
205} 320}
206 321
@@ -211,6 +326,17 @@ CategorySelect::~CategorySelect()
211 326
212void CategorySelect::slotDialog() 327void CategorySelect::slotDialog()
213{ 328{
329 if (QFile::exists( categoryEdittingFileName() )){
330 QMessageBox::warning(this,tr("Error"),
331 tr("Sorry, another application is\nediting categories.") );
332 return;
333 }
334
335 QFile f( categoryEdittingFileName() );
336 if ( !f.open( IO_WriteOnly) ){
337 return;
338 }
339
214 QDialog editDlg( this, 0, TRUE ); 340 QDialog editDlg( this, 0, TRUE );
215 editDlg.setCaption( tr("Edit Categories") ); 341 editDlg.setCaption( tr("Edit Categories") );
216 QVBoxLayout *vb = new QVBoxLayout( &editDlg ); 342 QVBoxLayout *vb = new QVBoxLayout( &editDlg );
@@ -226,6 +352,9 @@ void CategorySelect::slotDialog()
226 d->mRec = ce.newCategories(); 352 d->mRec = ce.newCategories();
227 cmbCat->initCombo( d->mRec, mStrAppName ); 353 cmbCat->initCombo( d->mRec, mStrAppName );
228 } 354 }
355
356 f.close();
357 QFile::remove( categoryEdittingFileName() );
229} 358}
230 359
231void CategorySelect::slotNewCat( int newUid ) 360void CategorySelect::slotNewCat( int newUid )
@@ -247,25 +376,26 @@ void CategorySelect::slotNewCat( int newUid )
247 emit signalSelected( currentCategory() ); 376 emit signalSelected( currentCategory() );
248} 377}
249 378
250void CategorySelect::setCategories( const QArray<int> &rec, 379QString CategorySelect::setCategories( const QArray<int> &rec,
251 const QString &appName ) 380 const QString &appName )
252{ 381{
253 setCategories( rec, appName, appName ); 382 return setCategories( rec, appName, appName );
254} 383}
255 384
256void CategorySelect::setCategories( const QArray<int> &rec, 385QString CategorySelect::setCategories( const QArray<int> &rec,
257 const QString &appName, 386 const QString &appName,
258 const QString &visibleName ) 387 const QString &visibleName )
259{ 388{
260 d->mRec = rec;
261 d->mVisibleName = visibleName; 389 d->mVisibleName = visibleName;
262 mStrAppName = appName; 390 mStrAppName = appName;
263 cmbCat->initCombo( rec, appName ); 391 d->mRec = cmbCat->initComboWithRefind( rec, appName );
392 return Qtopia::Record::idsToString(d->mRec);
264} 393}
265 394
266void CategorySelect::init() 395void CategorySelect::init(int width)
267{ 396{
268 cmbCat = new CategoryCombo( this ); 397 cmbCat = new CategoryCombo( this, 0, width);
398
269 QObject::connect( cmbCat, SIGNAL(sigCatChanged(int)), 399 QObject::connect( cmbCat, SIGNAL(sigCatChanged(int)),
270 this, SLOT(slotNewCat(int)) ); 400 this, SLOT(slotNewCat(int)) );
271 cmdCat = new QToolButton( this ); 401 cmdCat = new QToolButton( this );
@@ -313,3 +443,10 @@ void CategorySelect::setAllCategories( bool add )
313 } else 443 } else
314 cmbCat->removeItem( cmbCat->count() - 1 ); 444 cmbCat->removeItem( cmbCat->count() - 1 );
315} 445}
446
447// 01.12.21 added
448void CategorySelect::setFixedWidth(int width)
449{
450 width -= cmdCat->width();
451 cmbCat->setFixedWidth(width);
452}
diff --git a/library/categoryselect.h b/library/categoryselect.h
index 5c6b565..7a8e491 100644
--- a/library/categoryselect.h
+++ b/library/categoryselect.h
@@ -36,7 +36,8 @@ class CategoryCombo : public QComboBox
36 Q_OBJECT 36 Q_OBJECT
37 37
38public: 38public:
39 CategoryCombo( QWidget *parent, const char* name = 0 ); 39 CategoryCombo( QWidget *parent, const char* name = 0, int width=0);
40
40 ~CategoryCombo(); 41 ~CategoryCombo();
41 42
42 int currentCategory() const; 43 int currentCategory() const;
@@ -46,6 +47,8 @@ public:
46 void initCombo( const QArray<int> &recCats, const QString &appName, 47 void initCombo( const QArray<int> &recCats, const QString &appName,
47 const QString &visibleName /* = appName */ ); 48 const QString &visibleName /* = appName */ );
48 49
50 QArray<int> initComboWithRefind( const QArray<int> &recCats, const QString &appName );
51
49signals: 52signals:
50 void sigCatChanged( int newUid ); 53 void sigCatChanged( int newUid );
51 54
@@ -65,13 +68,16 @@ class CategorySelect : public QHBox
65 Q_OBJECT 68 Q_OBJECT
66public: 69public:
67 // we need two constructors, the first gets around designer limitations 70 // we need two constructors, the first gets around designer limitations
68 CategorySelect( QWidget *parent = 0, const char *name = 0 ); 71
72 CategorySelect( QWidget *parent = 0, const char *name = 0, int width = 0 );
69 73
70 CategorySelect( const QArray<int> &vlCats, const QString &appName, 74 CategorySelect( const QArray<int> &vlCats, const QString &appName,
71 QWidget *parent = 0, const char *name = 0 ); 75 QWidget *parent = 0, const char *name = 0,
76 int width = 0);
72 CategorySelect( const QArray<int> &vlCats, const QString &appName, 77 CategorySelect( const QArray<int> &vlCats, const QString &appName,
73 const QString &visibleName, QWidget *parent = 0, 78 const QString &visibleName, QWidget *parent = 0,
74 const char *name = 0 ); 79 const char *name = 0 , int width = 0);
80
75 ~CategorySelect(); 81 ~CategorySelect();
76 82
77 const QArray<int> &currentCategories() const; 83 const QArray<int> &currentCategories() const;
@@ -80,24 +86,26 @@ public:
80 // pretty much if you don't set it the constructor, you need to 86 // pretty much if you don't set it the constructor, you need to
81 // call it here ASAP! 87 // call it here ASAP!
82 // however this call is depreciated... 88 // however this call is depreciated...
83 void setCategories( const QArray<int> &vlCats, const QString &appName );
84 // use this one instead (for translating )
85 void setCategories( const QArray<int> &vlCats, const QString &appName,
86 const QString &visibleName );
87 89
90 QString setCategories( const QArray<int> &vlCats, const QString &appName );
91 QString setCategories( const QArray<int> &vlCats, const QString &appName,
92 const QString &visibleName );
88 // these were added for find dialog. 93 // these were added for find dialog.
89 void setRemoveCategoryEdit( bool remove ); 94 void setRemoveCategoryEdit( bool remove );
90 void setAllCategories( bool add ); 95 void setAllCategories( bool add );
91 96
97 void setFixedWidth(int width);
92signals: 98signals:
93 void signalSelected( int ); 99 void signalSelected( int );
94 100
95private slots: 101private slots:
96 void slotDialog(); 102 void slotDialog();
103
104public slots:
97 void slotNewCat( int id ); 105 void slotNewCat( int id );
98 106
99private: 107private:
100 void init(); 108 void init(int width=0);
101 QString mStrAppName; 109 QString mStrAppName;
102 CategoryCombo *cmbCat; 110 CategoryCombo *cmbCat;
103 QToolButton *cmdCat; 111 QToolButton *cmdCat;
diff --git a/library/config.cpp b/library/config.cpp
index 9634571..e07eecb 100644
--- a/library/config.cpp
+++ b/library/config.cpp
@@ -33,7 +33,9 @@
33#include <stdlib.h> 33#include <stdlib.h>
34#include <unistd.h> 34#include <unistd.h>
35 35
36#define QTOPIA_INTERNAL_LANGLIST
36#include "config.h" 37#include "config.h"
38#include "global.h"
37 39
38 40
39/*! 41/*!
@@ -95,14 +97,9 @@ Config::Config( const QString &name, Domain domain )
95{ 97{
96 git = groups.end(); 98 git = groups.end();
97 read(); 99 read();
98 100 QStringList l = Global::languageList();
99 lang = getenv("LANG"); 101 lang = l[0];
100 int i = lang.find("."); 102 glang = l[1];
101 if ( i > 0 )
102 lang = lang.left( i );
103 i = lang.find( "_" );
104 if ( i > 0 )
105 glang = lang.left(i);
106} 103}
107 104
108/*! 105/*!
diff --git a/library/custom-linux-sharp-g++.h b/library/custom-linux-sharp-g++.h
deleted file mode 100644
index f65d474..0000000
--- a/library/custom-linux-sharp-g++.h
+++ b/dev/null
@@ -1,147 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#define QPE_OWNAPM
22#define QPE_HAVE_TOGGLELIGHT
23#define QPE_NOCIBAUD
24#define QPE_STARTMENU
25#include <asm/sharp_apm.h>
26#ifndef APM_IOC_BATTERY_BACK_CHK
27#define APM_IOC_BATTERY_BACK_CHK _IO(APM_IOC_MAGIC, 32)
28#endif
29#ifndef APM_IOC_BATTERY_MAIN_CHK
30#define APM_IOC_BATTERY_MAIN_CHK _IO(APM_IOC_MAGIC, 33)
31#endif
32
33#include <unistd.h>
34#include <stdio.h>
35#include <signal.h>
36#include <fcntl.h>
37#include <sys/ioctl.h>
38
39#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
40
41/* --- for SHARP_BUZZER device --- */
42 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
43#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
44#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
45#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
46#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
47#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
48#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
49
50#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
51#define SHARP_BUZ_KEYSOUND 2 /* key sound */
52#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */
53#define SHARP_PDA_WARNSOUND 4 /* warning occurred */
54#define SHARP_PDA_ERRORSOUND 5 /* error occurred */
55#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */
56#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */
57#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */
58#define SHARP_PDA_APPSTART 9 /* application start */
59#define SHARP_PDA_APPQUIT 10 /* application ends */
60#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
61#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */
62#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */
63#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */
64
65
66#define CUSTOM_BUZZER( sound ) \
67{ \
68 static int fd = open( "/dev/sharp_buz", O_RDWR|O_NONBLOCK ); \
69 ioctl( fd, SHARP_BUZZER_MAKESOUND, sound ); \
70}
71
72#define CUSTOM_SOUND_ALARM CUSTOM_BUZZER( SHARP_BUZ_SCHEDULE_ALARM )
73
74#include <sys/ioctl.h>
75#include <asm/sharp_char.h>
76
77// a bit awkward, as this value is defined in emailclient.cpp aswell...
78#define LED_MAIL 0
79#define SHARP_LED_MAIL 9
80
81#define CUSTOM_LEDS( led, status ) \
82{ \
83 if ( led == LED_MAIL ) \
84 led = SHARP_LED_MAIL; \
85 static int fd = open( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); \
86 sharp_led_status leds; \
87 memset(&leds, 0, sizeof(leds)); \
88 leds.which = led; \
89 leds.status = status; \
90 ioctl( fd, SHARP_LED_SETSTATUS, (char*)&leds ); \
91}
92
93#define QPE_HAVE_MEMALERTER
94
95#define QPE_MEMALERTER_IMPL \
96static void sig_handler(int sig) \
97{ \
98 switch (sig) { \
99 case SIGHUP: \
100 memstate = VeryLow; \
101 break; \
102 case SIGUSR1: \
103 memstate = Normal; \
104 break; \
105 case SIGUSR2: \
106 memstate = Low; \
107 break; \
108 } \
109} \
110static void initMemalerter() \
111{ \
112 struct sigaction sa; \
113 memset(&sa, '\0', sizeof sa); \
114 sa.sa_handler = sig_handler; \
115 sa.sa_flags = SA_RESTART; \
116 if (sigaction(SIGHUP, &sa, NULL) < 0) { \
117 return; \
118 } \
119 if (sigaction(SIGUSR1, &sa, NULL) < 0) { \
120 return; \
121 } \
122 if (sigaction(SIGUSR2, &sa, NULL) < 0) { \
123 return; \
124 } \
125 FILE *fo = fopen("/proc/sys/vm/freepg_signal_proc", "w"); \
126 \
127 if (!fo) \
128 return; \
129 fprintf(fo, "qpe\n"); \
130 fclose(fo); \
131}
132
133#define QPE_INITIAL_NUMLOCK_STATE \
134{ \
135 bool numLock = FALSE; \
136 sharp_kbdctl_modifstat st; \
137 int dev = ::open("/dev/sharp_kbdctl", O_RDWR); \
138 if( dev >= 0 ) { \
139 memset(&st, 0, sizeof(st)); \
140 st.which = 3; \
141 int ret = ioctl(dev, SHARP_KBDCTL_GETMODIFSTAT, (char*)&st); \
142 if( !ret ) \
143 numLock = (bool)st.stat; \
144 ::close(dev); \
145 } \
146 return numLock; \
147}
diff --git a/library/datebookmonth.h b/library/datebookmonth.h
index 6cd1ac5..a7647ae 100644
--- a/library/datebookmonth.h
+++ b/library/datebookmonth.h
@@ -68,6 +68,7 @@ private:
68 QComboBox *month; 68 QComboBox *month;
69 QSpinBox *year; 69 QSpinBox *year;
70 DateBookMonthHeaderPrivate *d; 70 DateBookMonthHeaderPrivate *d;
71 int focus;
71}; 72};
72 73
73class DayItemMonthPrivate; 74class DayItemMonthPrivate;
diff --git a/library/fileselector.h b/library/fileselector.h
index ef8efea..8cfdf13 100644
--- a/library/fileselector.h
+++ b/library/fileselector.h
@@ -22,14 +22,15 @@
22 22
23#include <qhbox.h> 23#include <qhbox.h>
24#include <qvbox.h> 24#include <qvbox.h>
25#include <qlistview.h>
26#include <qtoolbutton.h> 25#include <qtoolbutton.h>
26#include <qlistview.h>
27 27
28#include "filemanager.h" 28#include "filemanager.h"
29#include "applnk.h" 29#include "applnk.h"
30 30
31class QPopupMenu; 31class QPopupMenu;
32class QPushButton; 32class QPushButton;
33class FileSelectorView;
33 34
34class FileSelectorItem : public QListViewItem 35class FileSelectorItem : public QListViewItem
35{ 36{
@@ -43,34 +44,6 @@ private:
43 DocLnk fl; 44 DocLnk fl;
44}; 45};
45 46
46class CategoryMenu;
47class FileSelectorViewPrivate;
48class FileSelectorView : public QListView
49{
50 Q_OBJECT
51
52public:
53 FileSelectorView( const QString &mimefilter, QWidget *parent, const char *name );
54 ~FileSelectorView();
55 void reread();
56 int fileCount() { return count; }
57
58 void setCategoryFilter(CategoryMenu *);
59protected:
60 void keyPressEvent( QKeyEvent *e );
61
62protected slots:
63 void cardMessage( const QCString &, const QByteArray &);
64
65 void categoryChanged();
66
67private:
68 QString filter;
69 FileManager *fileManager;
70 int count;
71 FileSelectorViewPrivate *d;
72};
73
74class FileSelectorPrivate; 47class FileSelectorPrivate;
75class FileSelector : public QVBox 48class FileSelector : public QVBox
76{ 49{
@@ -81,7 +54,6 @@ public:
81 ~FileSelector(); 54 ~FileSelector();
82 void setNewVisible( bool b ); 55 void setNewVisible( bool b );
83 void setCloseVisible( bool b ); 56 void setCloseVisible( bool b );
84 void setCategoriesVisible( bool b );
85 void reread(); 57 void reread();
86 int fileCount(); 58 int fileCount();
87 const DocLnk *selected(); 59 const DocLnk *selected();
diff --git a/library/finddialog.cpp b/library/finddialog.cpp
index 7a9367b..904e952 100644
--- a/library/finddialog.cpp
+++ b/library/finddialog.cpp
@@ -18,6 +18,10 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT
22// have this class.
23#define QTOPIA_INTERNAL_FD
24
21#include "finddialog.h" 25#include "finddialog.h"
22#include "findwidget_p.h" 26#include "findwidget_p.h"
23 27
diff --git a/library/finddialog.h b/library/finddialog.h
index 265b5ae..00c7b45 100644
--- a/library/finddialog.h
+++ b/library/finddialog.h
@@ -18,6 +18,11 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21
22//
23// DO NOT ATTEMPT TO USE THIS CLASS
24//
25
21#ifndef __FINDDIALOG_H__ 26#ifndef __FINDDIALOG_H__
22#define __FINDDIALOG_H__ 27#define __FINDDIALOG_H__
23 28
@@ -31,9 +36,15 @@ class FindDialog : public QDialog
31{ 36{
32 Q_OBJECT 37 Q_OBJECT
33public: 38public:
39
40// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT
41// have this class.
42#ifdef QTOPIA_INTERNAL_FD
43
34 FindDialog( const QString &appName, 44 FindDialog( const QString &appName,
35 QWidget *parent = 0, const char *name = 0, bool modal = TRUE ); 45 QWidget *parent = 0, const char *name = 0, bool modal = TRUE );
36 ~FindDialog(); 46 ~FindDialog();
47#endif
37 48
38 QString findText() const; 49 QString findText() const;
39 void setUseDate( bool show ); 50 void setUseDate( bool show );
diff --git a/library/mimetype.cpp b/library/mimetype.cpp
index c6a4453..9fab160 100644
--- a/library/mimetype.cpp
+++ b/library/mimetype.cpp
@@ -18,6 +18,7 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#define QTOPIA_INTERNAL_MIMEEXT
21#include "mimetype.h" 22#include "mimetype.h"
22#include "applnk.h" 23#include "applnk.h"
23#include "resource.h" 24#include "resource.h"
@@ -46,6 +47,7 @@ public:
46 } 47 }
47 } 48 }
48 QString id; 49 QString id;
50 QString extension;
49 QString desc; 51 QString desc;
50 QPixmap regIcon; 52 QPixmap regIcon;
51 QPixmap bigIcon; 53 QPixmap bigIcon;
@@ -59,6 +61,7 @@ public:
59 61
60MimeType::Dict* MimeType::d=0; 62MimeType::Dict* MimeType::d=0;
61static QMap<QString,QString> *typeFor = 0; 63static QMap<QString,QString> *typeFor = 0;
64static QMap<QString,QString> *extFor = 0;
62 65
63MimeType::Dict& MimeType::dict() 66MimeType::Dict& MimeType::dict()
64{ 67{
@@ -96,6 +99,12 @@ QPixmap MimeType::pixmap() const
96 return d ? d->regIcon : QPixmap(); 99 return d ? d->regIcon : QPixmap();
97} 100}
98 101
102QString MimeType::extension() const
103{
104 loadExtensions();
105 return *(*extFor).find(i);
106}
107
99QPixmap MimeType::bigPixmap() const 108QPixmap MimeType::bigPixmap() const
100{ 109{
101 MimeTypeData* d = data(i); 110 MimeTypeData* d = data(i);
@@ -128,6 +137,7 @@ void MimeType::clear()
128void MimeType::loadExtensions() 137void MimeType::loadExtensions()
129{ 138{
130 if ( !typeFor ) { 139 if ( !typeFor ) {
140 extFor = new QMap<QString,QString>;
131 typeFor = new QMap<QString,QString>; 141 typeFor = new QMap<QString,QString>;
132 loadExtensions("/etc/mime.types"); 142 loadExtensions("/etc/mime.types");
133 loadExtensions(QPEApplication::qpeDir()+"etc/mime.types"); 143 loadExtensions(QPEApplication::qpeDir()+"etc/mime.types");
@@ -145,9 +155,12 @@ void MimeType::loadExtensions(const QString& filename)
145 QStringList::ConstIterator it = tokens.begin(); 155 QStringList::ConstIterator it = tokens.begin();
146 if ( it != tokens.end() ) { 156 if ( it != tokens.end() ) {
147 QString id = *it; ++it; 157 QString id = *it; ++it;
148 while (it != tokens.end()) { 158 if ( it != tokens.end() ) {
149 (*typeFor)[*it] = id; 159 (*extFor)[id] = *it;
150 ++it; 160 while (it != tokens.end()) {
161 (*typeFor)[*it] = id;
162 ++it;
163 }
151 } 164 }
152 } 165 }
153 } 166 }
diff --git a/library/mimetype.h b/library/mimetype.h
index 58725d7..b6cca95 100644
--- a/library/mimetype.h
+++ b/library/mimetype.h
@@ -40,6 +40,11 @@ public:
40 QPixmap pixmap() const; 40 QPixmap pixmap() const;
41 QPixmap bigPixmap() const; 41 QPixmap bigPixmap() const;
42 42
43// DON'T define this yourself!
44#ifdef QTOPIA_INTERNAL_MIMEEXT
45 QString extension() const;
46#endif
47
43 const AppLnk* application() const; 48 const AppLnk* application() const;
44 49
45 static QString appsFolderName(); 50 static QString appsFolderName();
diff --git a/library/network.cpp b/library/network.cpp
index 7d51016..e6d2781 100644
--- a/library/network.cpp
+++ b/library/network.cpp
@@ -18,6 +18,7 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#define QTOPIA_INTERNAL_LANGLIST
21#include "qpe/network.h" 22#include "qpe/network.h"
22#include "qpe/networkinterface.h" 23#include "qpe/networkinterface.h"
23#include "qpe/global.h" 24#include "qpe/global.h"
@@ -418,14 +419,16 @@ NetworkInterface* Network::loadPlugin(const QString& type)
418 if ( !lib.queryInterface( IID_Network, (QUnknownInterface**)&iface ) == QS_OK ) 419 if ( !lib.queryInterface( IID_Network, (QUnknownInterface**)&iface ) == QS_OK )
419 return 0; 420 return 0;
420 ifaces->insert(type,iface); 421 ifaces->insert(type,iface);
421 QString lang = getenv( "LANG" ); 422 QStringList langs = Global::languageList();
422 QTranslator * trans = new QTranslator(qApp); 423 for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) {
423 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/lib"+type+".qm"; 424 QString lang = *it;
424 if ( trans->load( tfn )) 425 QTranslator * trans = new QTranslator(qApp);
425 qApp->installTranslator( trans ); 426 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/lib"+type+".qm";
426 else 427 if ( trans->load( tfn ))
427 delete trans; 428 qApp->installTranslator( trans );
428 429 else
430 delete trans;
431 }
429 } 432 }
430 return iface; 433 return iface;
431#else 434#else
diff --git a/library/power.cpp b/library/power.cpp
index 990ff62..12b52ed 100644
--- a/library/power.cpp
+++ b/library/power.cpp
@@ -102,6 +102,8 @@ bool PowerStatusManager::getProcApmStatus( int &ac, int &bs, int &bf, int &pc, i
102 ps->bs = PowerStatus::Charging; 102 ps->bs = PowerStatus::Charging;
103 break; 103 break;
104 case 0x04: 104 case 0x04:
105 case 0xff: // 0xff is Unknown but we map to NotPresent
106 default:
105 ps->bs = PowerStatus::NotPresent; 107 ps->bs = PowerStatus::NotPresent;
106 break; 108 break;
107 } 109 }
diff --git a/library/qcopmessage_qws.h b/library/qcopmessage_qws.h
deleted file mode 100644
index c19f57d..0000000
--- a/library/qcopmessage_qws.h
+++ b/dev/null
@@ -1,99 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef QCOP_MESSAGE_H
22#define QCOP_MESSAGE_H
23
24#include <qdatastream.h>
25#include <qbuffer.h>
26
27class QCopMessage : public QDataStream {
28 public:
29 QCopMessage();
30 QCopMessage(const QCString& channel, const QCString& message);
31 QCopMessage(const QCopMessage& orig);
32 ~QCopMessage();
33
34 void setChannel(QCString& channel) { m_Channel = channel; }
35 QCString channel() const { return m_Channel; }
36 void setMessage(QCString& message) { m_Message = message; }
37 QCString message() const { return m_Message; }
38 const QByteArray data() const;
39
40 QCopMessage& operator=(const QCopMessage& orig);
41
42 private:
43 QCString m_Channel;
44 QCString m_Message;
45};
46
47// ### No need to inline, just maintaining binary compatability
48inline QCopMessage::QCopMessage() : QDataStream(new QBuffer()) {
49 device()->open(IO_WriteOnly);
50}
51
52inline QCopMessage::QCopMessage(const QCString& channel, const QCString& message)
53 : QDataStream(new QBuffer()), m_Channel(channel), m_Message(message) {
54 device()->open(IO_WriteOnly);
55}
56
57inline QCopMessage::QCopMessage(const QCopMessage& orig) : QDataStream() {
58 // The QBuffer is going to share the byte array, so it will keep the
59 // data pointer even when this one goes out of scope.
60 QByteArray array(((QBuffer*)orig.device())->buffer());
61 array.detach();
62 setDevice(new QBuffer(array));
63 device()->open(IO_Append);
64
65 m_Channel = orig.channel();
66 m_Message = orig.message();
67}
68
69inline QCopMessage& QCopMessage::operator=(const QCopMessage& orig) {
70 if (device()) {
71 delete device();
72 unsetDevice();
73 }
74
75 // The QBuffer is going to share the byte array, so it will keep the
76 // data pointer even when this one goes out of scope.
77 QByteArray array(((QBuffer*)orig.device())->buffer());
78 array.detach();
79 setDevice(new QBuffer(array));
80 device()->open(IO_Append);
81
82 m_Channel = orig.channel();
83 m_Message = orig.message();
84
85 return *this;
86}
87
88inline const QByteArray QCopMessage::data() const {
89 return ((QBuffer*)device())->buffer();
90}
91
92inline QCopMessage::~QCopMessage() {
93 // If we still have our QBuffer, clean it up...
94 if (device())
95 delete device();
96 unsetDevice();
97}
98
99#endif
diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp
index b6085ef..e041945 100644
--- a/library/qpedecoration_qws.cpp
+++ b/library/qpedecoration_qws.cpp
@@ -17,6 +17,7 @@
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#define QTOPIA_INTERNAL_LANGLIST
20#include <qapplication.h> 21#include <qapplication.h>
21#include <qstyle.h> 22#include <qstyle.h>
22#include <qwidget.h> 23#include <qwidget.h>
@@ -244,10 +245,10 @@ QPEDecoration::QPEDecoration()
244 imageClose = Resource::loadImage( "CloseButton" ); 245 imageClose = Resource::loadImage( "CloseButton" );
245 imageHelp = Resource::loadImage( "HelpButton" ); 246 imageHelp = Resource::loadImage( "HelpButton" );
246 helpFile = QString(qApp->argv()[0]) + ".html"; 247 helpFile = QString(qApp->argv()[0]) + ".html";
247 QString lang = getenv( "LANG" ); 248 QStringList path = Global::helpPath();
248 helpExists = QFile::exists( QPEApplication::qpeDir() + "/help/" + lang + "/html/" + helpFile ); 249 helpExists = FALSE;
249 if ( !helpExists ) 250 for (QStringList::ConstIterator it=path.begin(); it!=path.end() && !helpExists; ++it)
250 helpExists = QFile::exists( QPEApplication::qpeDir() + "/help/en/html/" + helpFile ); 251 helpExists = QFile::exists( *it + "/" + helpFile );
251#ifndef MINIMIZE_HELP_HACK 252#ifndef MINIMIZE_HELP_HACK
252 qpeManager = new QPEManager( this ); 253 qpeManager = new QPEManager( this );
253#else 254#else
diff --git a/noncore/games/go/gowidget.cpp b/noncore/games/go/gowidget.cpp
index fca9797..8567b30 100644
--- a/noncore/games/go/gowidget.cpp
+++ b/noncore/games/go/gowidget.cpp
@@ -49,6 +49,8 @@ static QPixmap *newBlackStone;
49static QPixmap *blackStone; 49static QPixmap *blackStone;
50static QPixmap *whiteStone; 50static QPixmap *whiteStone;
51 51
52static bool smallStones = FALSE;
53
52GoMainWidget::GoMainWidget( QWidget *parent, const char* name) : 54GoMainWidget::GoMainWidget( QWidget *parent, const char* name) :
53 QMainWindow( parent, name ) 55 QMainWindow( parent, name )
54{ 56{
@@ -197,6 +199,19 @@ void GoWidget::resizeEvent( QResizeEvent * )
197 // int r = (d/2-1); 199 // int r = (d/2-1);
198 bx = (width() - 18*d)/2 ; 200 bx = (width() - 18*d)/2 ;
199 by = (height() - 18*d)/2 ; 201 by = (height() - 18*d)/2 ;
202
203 if ( d < 10 && !smallStones ) {
204 blackStone->convertFromImage( blackStone->convertToImage().smoothScale(8,8) );
205 whiteStone->convertFromImage( whiteStone->convertToImage().smoothScale(8,8) );
206 newBlackStone->convertFromImage( newBlackStone->convertToImage().smoothScale(8,8) );
207
208 smallStones = TRUE;
209 } else if ( d >= 10 && smallStones ) {
210 blackStone = new QPixmap(Resource::loadPixmap( "Go-black" ));
211 whiteStone = new QPixmap(Resource::loadPixmap( "Go-white" ));
212 newBlackStone = new QPixmap(Resource::loadPixmap( "Go-black-highlight" ));
213 smallStones = FALSE;
214 }
200} 215}
201 216
202void GoWidget::init() 217void GoWidget::init()
diff --git a/noncore/games/minesweep/minefield.h b/noncore/games/minesweep/minefield.h
index 4ede435..1349c35 100644
--- a/noncore/games/minesweep/minefield.h
+++ b/noncore/games/minesweep/minefield.h
@@ -20,12 +20,12 @@
20#ifndef MINEFIELD_H 20#ifndef MINEFIELD_H
21#define MINEFIELD_H 21#define MINEFIELD_H
22 22
23#include <qtable.h> 23#include <qscrollview.h>
24 24
25class Mine; 25class Mine;
26class Config; 26class Config;
27 27
28class MineField : public QTable 28class MineField : public QScrollView
29{ 29{
30 Q_OBJECT 30 Q_OBJECT
31public: 31public:
@@ -41,6 +41,7 @@ public:
41 41
42 int level() const { return lev; } 42 int level() const { return lev; }
43 43
44 void setAvailableRect( const QRect & );
44public slots: 45public slots:
45 void setup( int level ); 46 void setup( int level );
46 47
@@ -52,23 +53,31 @@ signals:
52 void mineCount( int ); 53 void mineCount( int );
53 54
54protected: 55protected:
55 void paintFocus( QPainter*, const QRect& ); 56
56 void viewportMousePressEvent( QMouseEvent* ); 57 void contentsMousePressEvent( QMouseEvent* );
57 void viewportMouseReleaseEvent( QMouseEvent* ); 58 void contentsMouseReleaseEvent( QMouseEvent* );
58 void keyPressEvent( QKeyEvent* ); 59 void keyPressEvent( QKeyEvent* );
59 void keyReleaseEvent( QKeyEvent* ); 60 void keyReleaseEvent( QKeyEvent* );
60 61 void drawContents( QPainter * p, int clipx, int clipy, int clipw, int cliph );
62
61 int getHint( int row, int col ); 63 int getHint( int row, int col );
62 void setHint( Mine* ); 64 void setHint( int r, int c );
63 void updateMine( int row, int col ); 65 void updateMine( int row, int col );
64 void paletteChange( const QPalette & ); 66 void paletteChange( const QPalette & );
65 67 void updateCell( int r, int c );
68 bool onBoard( int r, int c ) const { return r >= 0 && r < numRows && c >= 0 && c < numCols; }
69 Mine *mine( int row, int col ) { return onBoard(row, col ) ? mines[row+numCols*col] : 0; }
70 const Mine *mine( int row, int col ) const { return onBoard(row, col ) ? mines[row+numCols*col] : 0; }
71
66protected slots: 72protected slots:
67 void cellPressed( int row, int col ); 73 void cellPressed( int row, int col );
68 void cellClicked( int row, int col ); 74 void cellClicked( int row, int col );
69 void held(); 75 void held();
70 76
71private: 77private:
78 int findCellSize();
79 void setCellSize( int );
80
72 State stat; 81 State stat;
73 void MineField::setState( State st ); 82 void MineField::setState( State st );
74 void MineField::placeMines(); 83 void MineField::placeMines();
@@ -77,11 +86,16 @@ private:
77 bool ignoreClick; 86 bool ignoreClick;
78 int currRow; 87 int currRow;
79 int currCol; 88 int currCol;
89 int numRows, numCols;
90
80 int minecount; 91 int minecount;
81 int mineguess; 92 int mineguess;
82 int nonminecount; 93 int nonminecount;
83 int lev; 94 int lev;
95 QRect availableRect;
96 int cellSize;
84 QTimer *holdTimer; 97 QTimer *holdTimer;
98 Mine **mines;
85}; 99};
86 100
87#endif // MINEFIELD_H 101#endif // MINEFIELD_H
diff --git a/noncore/games/minesweep/minesweep.cpp b/noncore/games/minesweep/minesweep.cpp
index 6492462..c84fe53 100644
--- a/noncore/games/minesweep/minesweep.cpp
+++ b/noncore/games/minesweep/minesweep.cpp
@@ -219,6 +219,23 @@ void ResultIndicator::timerEvent( QTimerEvent *te )
219} 219}
220 220
221 221
222class MineFrame : public QFrame
223{
224public:
225 MineFrame( QWidget *parent, const char *name = 0 )
226 :QFrame( parent, name ) {}
227 void setField( MineField *f ) { field = f; }
228protected:
229 void resizeEvent( QResizeEvent *e ) {
230 field->setAvailableRect( contentsRect());
231 QFrame::resizeEvent(e);
232 }
233private:
234 MineField *field;
235};
236
237
238
222MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) 239MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f )
223: QMainWindow( parent, name, f ) 240: QMainWindow( parent, name, f )
224{ 241{
@@ -226,8 +243,10 @@ MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f )
226 setCaption( tr("Mine Hunt") ); 243 setCaption( tr("Mine Hunt") );
227 setIcon( Resource::loadPixmap( "minesweep_icon" ) ); 244 setIcon( Resource::loadPixmap( "minesweep_icon" ) );
228 245
229 QPEToolBar *menuToolBar = new QPEToolBar( this ); 246 QPEToolBar *toolBar = new QPEToolBar( this );
230 QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); 247 toolBar->setHorizontalStretchable( TRUE );
248
249 QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
231 250
232 QPopupMenu *gameMenu = new QPopupMenu( this ); 251 QPopupMenu *gameMenu = new QPopupMenu( this );
233 gameMenu->insertItem( tr("Beginner"), this, SLOT( beginner() ) ); 252 gameMenu->insertItem( tr("Beginner"), this, SLOT( beginner() ) );
@@ -235,9 +254,6 @@ MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f )
235 gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) ); 254 gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) );
236 255
237 menuBar->insertItem( tr("Game"), gameMenu ); 256 menuBar->insertItem( tr("Game"), gameMenu );
238
239 QPEToolBar *toolBar = new QPEToolBar( this );
240 toolBar->setHorizontalStretchable( TRUE );
241 257
242 guessLCD = new QLCDNumber( toolBar ); 258 guessLCD = new QLCDNumber( toolBar );
243 toolBar->setStretchableWidget( guessLCD ); 259 toolBar->setStretchableWidget( guessLCD );
@@ -265,17 +281,16 @@ MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f )
265 281
266 setToolBarsMovable ( FALSE ); 282 setToolBarsMovable ( FALSE );
267 283
268 addToolBar( menuToolBar );
269 addToolBar( toolBar ); 284 addToolBar( toolBar );
270 285
271 QFrame *mainframe = new QFrame( this ); 286 MineFrame *mainframe = new MineFrame( this );
272 mainframe->setFrameShape( QFrame::Box ); 287 mainframe->setFrameShape( QFrame::Box );
273 mainframe->setFrameShadow( QFrame::Raised ); 288 mainframe->setFrameShadow( QFrame::Raised );
274 mainframe->setMargin(5); 289
275 mainframe->setLineWidth(2); 290 mainframe->setLineWidth(2);
276 QBoxLayout *box = new QVBoxLayout( mainframe ); 291
277 field = new MineField( mainframe ); 292 field = new MineField( mainframe );
278 box->addWidget( field, 0, AlignCenter ); 293 mainframe->setField( field );
279 QFont fnt = field->font(); 294 QFont fnt = field->font();
280 fnt.setBold( TRUE ); 295 fnt.setBold( TRUE );
281 field->setFont( QFont( fnt ) ); 296 field->setFont( QFont( fnt ) );
diff --git a/noncore/games/snake/interface.h b/noncore/games/snake/interface.h
index 30c7f84..454d4ee 100644
--- a/noncore/games/snake/interface.h
+++ b/noncore/games/snake/interface.h
@@ -36,7 +36,6 @@ public:
36 36
37 void clear(); 37 void clear();
38 void createTargets(); 38 void createTargets();
39 void welcomescreen();
40 39
41protected: 40protected:
42 virtual void keyPressEvent(QKeyEvent*); 41 virtual void keyPressEvent(QKeyEvent*);
@@ -51,6 +50,7 @@ private slots:
51 void wait(); 50 void wait();
52 void levelUp(); 51 void levelUp();
53 void scoreInc(); 52 void scoreInc();
53 void welcomescreen();
54 54
55private: 55private:
56 void showScore(int); 56 void showScore(int);
diff --git a/noncore/games/snake/obstacle.cpp b/noncore/games/snake/obstacle.cpp
index 2d07fe7..4bdefa5 100644
--- a/noncore/games/snake/obstacle.cpp
+++ b/noncore/games/snake/obstacle.cpp
@@ -23,20 +23,39 @@
23 23
24#include <qpe/resource.h> 24#include <qpe/resource.h>
25 25
26Obstacle::Obstacle(QCanvas* canvas, int x, int y) 26
27 : QCanvasSprite(0, canvas) 27
28Obstacle::Obstacle(QCanvas* canvas, int y)
29 : QCanvasSprite(0,canvas)
28{ 30{
29 newObstacle(x, y); 31 newObstacle(y);
30} 32}
31 33
32void Obstacle::newObstacle(int x, int y) 34void Obstacle::newObstacle(int y)
33{ 35{
34 QCanvasPixmapArray* obstaclearray = new QCanvasPixmapArray(Resource::findPixmap("snake/wall.png")); 36 QPixmap obstaclePix( Resource::findPixmap("snake/wall.png") );
35 37
38 if ( obstaclePix.width() > canvas()->width()*3/5 ) {
39 int w = canvas()->width()*3/5;
40 w = w - w % 16;
41 obstaclePix.resize( w, obstaclePix.height() );
42 }
43
44 QList<QPixmap> pixl;
45 pixl.append( &obstaclePix );
46
47 QPoint nullp;
48 QList<QPoint> pl;
49 pl.append( &nullp );
50
51 QCanvasPixmapArray* obstaclearray = new QCanvasPixmapArray(pixl, pl);
36 setSequence(obstaclearray); 52 setSequence(obstaclearray);
37 53
54 int x = ( canvas()->width() - obstaclePix.width() )/2;
55 x = x - x % 16;
56 y = y - y % 16;
38 move(x, y); 57 move(x, y);
39 58 setZ( -100 );
40 show(); 59 show();
41 canvas()->update(); 60 canvas()->update();
42} 61}
diff --git a/noncore/games/snake/obstacle.h b/noncore/games/snake/obstacle.h
index 838917f..b3c7846 100644
--- a/noncore/games/snake/obstacle.h
+++ b/noncore/games/snake/obstacle.h
@@ -23,8 +23,8 @@ class Obstacle : public QCanvasSprite
23{ 23{
24 24
25public: 25public:
26 Obstacle(QCanvas*, int x, int y); 26 Obstacle(QCanvas*, int y);
27 ~Obstacle(); 27 ~Obstacle();
28 void newObstacle(int x, int y); 28 void newObstacle(int y);
29 int rtti() const; 29 int rtti() const;
30}; 30};
diff --git a/noncore/games/solitaire/canvascard.cpp b/noncore/games/solitaire/canvascard.cpp
index ae3c859..7c4a5ba 100644
--- a/noncore/games/solitaire/canvascard.cpp
+++ b/noncore/games/solitaire/canvascard.cpp
@@ -27,6 +27,7 @@
27#include <qimage.h> 27#include <qimage.h>
28#include <qpaintdevice.h> 28#include <qpaintdevice.h>
29#include <qbitmap.h> 29#include <qbitmap.h>
30#include <qgfx_qws.h> // Needed to get the device's width
30 31
31#include <math.h> 32#include <math.h>
32 33
@@ -102,10 +103,17 @@ CanvasCard::CanvasCard( eValue v, eSuit s, bool f, QCanvas *canvas ) :
102 Card(v, s, f), QCanvasRectangle( 0, 0, 1, 1, canvas ), cardBack(1), scaleX(1.0), scaleY(1.0) 103 Card(v, s, f), QCanvasRectangle( 0, 0, 1, 1, canvas ), cardBack(1), scaleX(1.0), scaleY(1.0)
103{ 104{
104 if ( !cardsFaces ) { 105 if ( !cardsFaces ) {
105 cardsFaces = new QPixmap( Resource::loadPixmap( "cards/card_face" ) ); 106 if ( qt_screen->deviceWidth() < 200 ) {
106 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001" ) ); 107 cardsFaces = new QPixmap( Resource::loadPixmap( "cards/card_face_small" ) );
107 cardsChars = new QBitmap( Resource::loadBitmap( "cards/card_chars" ) ); 108 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001_small" ) );
108 cardsSuits = new QBitmap( Resource::loadBitmap( "cards/card_suits" ) ); 109 cardsChars = new QBitmap( Resource::loadBitmap( "cards/card_chars_small" ) );
110 cardsSuits = new QBitmap( Resource::loadBitmap( "cards/card_suits_small" ) );
111 } else {
112 cardsFaces = new QPixmap( Resource::loadPixmap( "cards/card_face" ) );
113 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001" ) );
114 cardsChars = new QBitmap( Resource::loadBitmap( "cards/card_chars" ) );
115 cardsSuits = new QBitmap( Resource::loadBitmap( "cards/card_suits" ) );
116 }
109 cardsCharsUpsideDown = Create180RotatedBitmap( cardsChars ); 117 cardsCharsUpsideDown = Create180RotatedBitmap( cardsChars );
110 cardsSuitsUpsideDown = Create180RotatedBitmap( cardsSuits ); 118 cardsSuitsUpsideDown = Create180RotatedBitmap( cardsSuits );
111 } 119 }
@@ -126,17 +134,32 @@ void CanvasCard::setCardBack(int b)
126 if ( cardsBacks ) 134 if ( cardsBacks )
127 delete cardsBacks; 135 delete cardsBacks;
128 136
129 switch (cardBack) { 137 if ( qt_screen->deviceWidth() < 200 ) {
130 case 0: 138 switch (cardBack) {
131 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001" ) ); break; 139 case 0:
132 case 1: 140 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001_small" ) ); break;
133 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0002" ) ); break; 141 case 1:
134 case 2: 142 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0002_small" ) ); break;
135 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0003" ) ); break; 143 case 2:
136 case 3: 144 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0003_small" ) ); break;
137 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0004" ) ); break; 145 case 3:
138 case 4: 146 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0004_small" ) ); break;
139 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0005" ) ); break; 147 case 4:
148 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0005_small" ) ); break;
149 }
150 } else {
151 switch (cardBack) {
152 case 0:
153 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001" ) ); break;
154 case 1:
155 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0002" ) ); break;
156 case 2:
157 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0003" ) ); break;
158 case 3:
159 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0004" ) ); break;
160 case 4:
161 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0005" ) ); break;
162 }
140 } 163 }
141 164
142 if ( !isFacing() ) 165 if ( !isFacing() )
@@ -181,11 +204,19 @@ void CanvasCard::draw(QPainter &painter)
181 else 204 else
182 p->setPen( QColor( 0, 0, 0 ) ); 205 p->setPen( QColor( 0, 0, 0 ) );
183 206
184 p->drawPixmap( ix + 0, iy + 0, *cardsFaces ); 207 if ( qt_screen->deviceWidth() < 200 ) {
185 p->drawPixmap( ix + 4, iy + 4, *cardsChars, 7*(getValue()-1), 0, 7, 7 ); 208 p->drawPixmap( ix + 0, iy + 0, *cardsFaces );
186 p->drawPixmap( ix + 12, iy + 4, *cardsSuits, 7*(getSuit()-1), 0, 7, 8 ); 209 p->drawPixmap( ix + 3, iy + 3, *cardsChars, 5*(getValue()-1), 0, 5, 6 );
187 p->drawPixmap( ix + w-4-7, iy + h-4-7, *cardsCharsUpsideDown, 7*(12-getValue()+1), 0, 7, 7 ); 210 p->drawPixmap( ix + 11, iy + 3, *cardsSuits, 5*(getSuit()-1), 0, 5, 6 );
188 p->drawPixmap( ix + w-12-7, iy + h-5-7, *cardsSuitsUpsideDown, 7*(3-getSuit()+1), 0, 7, 8 ); 211 p->drawPixmap( ix + w-3-5, iy + h-3-6, *cardsCharsUpsideDown, 5*(12-getValue()+1), 0, 5, 6 );
212 p->drawPixmap( ix + w-11-5, iy + h-3-6, *cardsSuitsUpsideDown, 5*(3-getSuit()+1), 0, 5, 6 );
213 } else {
214 p->drawPixmap( ix + 0, iy + 0, *cardsFaces );
215 p->drawPixmap( ix + 4, iy + 4, *cardsChars, 7*(getValue()-1), 0, 7, 7 );
216 p->drawPixmap( ix + 12, iy + 4, *cardsSuits, 7*(getSuit()-1), 0, 7, 8 );
217 p->drawPixmap( ix + w-4-7, iy + h-4-7, *cardsCharsUpsideDown, 7*(12-getValue()+1), 0, 7, 7 );
218 p->drawPixmap( ix + w-12-7, iy + h-5-7, *cardsSuitsUpsideDown, 7*(3-getSuit()+1), 0, 7, 8 );
219 }
189 220
190 } else { 221 } else {
191 222
diff --git a/noncore/games/solitaire/canvasshapes.cpp b/noncore/games/solitaire/canvasshapes.cpp
index 28d0b4e..6ccd4a4 100644
--- a/noncore/games/solitaire/canvasshapes.cpp
+++ b/noncore/games/solitaire/canvasshapes.cpp
@@ -19,11 +19,12 @@
19**********************************************************************/ 19**********************************************************************/
20#include <qpainter.h> 20#include <qpainter.h>
21#include <qcanvas.h> 21#include <qcanvas.h>
22#include <qgfx_qws.h>
22#include "canvasshapes.h" 23#include "canvasshapes.h"
23 24
24 25
25CanvasRoundRect::CanvasRoundRect(int x, int y, QCanvas *canvas) : 26CanvasRoundRect::CanvasRoundRect(int x, int y, QCanvas *canvas) :
26 QCanvasRectangle( x, y, 23, 36, canvas) 27 QCanvasRectangle( x, y, ( qt_screen->deviceWidth() < 200 ) ? 20 : 23, ( qt_screen->deviceWidth() < 200 ) ? 27 : 36, canvas)
27{ 28{
28 setZ(0); 29 setZ(0);
29 show(); 30 show();
@@ -39,7 +40,10 @@ void CanvasRoundRect::redraw()
39 40
40void CanvasRoundRect::drawShape(QPainter &p) 41void CanvasRoundRect::drawShape(QPainter &p)
41{ 42{
42 p.drawRoundRect( (int)x(), (int)y(), 23, 36); 43 if ( qt_screen->deviceWidth() < 200 )
44 p.drawRoundRect( (int)x() + 1, (int)y() + 1, 18, 25);
45 else
46 p.drawRoundRect( (int)x(), (int)y(), 23, 36);
43} 47}
44 48
45 49
@@ -73,20 +77,38 @@ void CanvasCircleOrCross::setCross()
73 77
74void CanvasCircleOrCross::drawShape(QPainter &p) 78void CanvasCircleOrCross::drawShape(QPainter &p)
75{ 79{
76 int x1 = (int)x(), y1 = (int)y(); 80 if ( qt_screen->deviceWidth() < 200 ) {
77 // Green circle 81 int x1 = (int)x(), y1 = (int)y();
78 if (circleShape == TRUE) { 82 // Green circle
79 p.setPen( QPen( QColor(0x10, 0xE0, 0x10), 1 ) ); 83 if (circleShape == TRUE) {
80 p.drawEllipse( x1 - 1, y1 - 1, 21, 21); 84 p.setPen( QPen( QColor(0x10, 0xE0, 0x10), 1 ) );
81 p.drawEllipse( x1 - 1, y1 - 0, 21, 19); 85 p.drawEllipse( x1 - 1, y1 - 1, 17, 17);
82 p.drawEllipse( x1 + 0, y1 + 0, 19, 19); 86 p.drawEllipse( x1 - 1, y1 - 0, 17, 15);
83 p.drawEllipse( x1 + 1, y1 + 0, 17, 19); 87 p.drawEllipse( x1 + 0, y1 + 0, 15, 15);
84 p.drawEllipse( x1 + 1, y1 + 1, 17, 17); 88 p.drawEllipse( x1 + 1, y1 + 0, 13, 15);
85 // Red cross 89 p.drawEllipse( x1 + 1, y1 + 1, 13, 13);
90 // Red cross
91 } else {
92 p.setPen( QPen( QColor(0xE0, 0x10, 0x10), 4 ) );
93 p.drawLine( x1, y1, x1 + 14, y1 + 14);
94 p.drawLine( x1 + 14, y1, x1, y1 + 14);
95 }
86 } else { 96 } else {
87 p.setPen( QPen( QColor(0xE0, 0x10, 0x10), 5 ) ); 97 int x1 = (int)x(), y1 = (int)y();
88 p.drawLine( x1, y1, x1 + 20, y1 + 20); 98 // Green circle
89 p.drawLine( x1 + 20, y1, x1, y1 + 20); 99 if (circleShape == TRUE) {
100 p.setPen( QPen( QColor(0x10, 0xE0, 0x10), 1 ) );
101 p.drawEllipse( x1 - 1, y1 - 1, 21, 21);
102 p.drawEllipse( x1 - 1, y1 - 0, 21, 19);
103 p.drawEllipse( x1 + 0, y1 + 0, 19, 19);
104 p.drawEllipse( x1 + 1, y1 + 0, 17, 19);
105 p.drawEllipse( x1 + 1, y1 + 1, 17, 17);
106 // Red cross
107 } else {
108 p.setPen( QPen( QColor(0xE0, 0x10, 0x10), 5 ) );
109 p.drawLine( x1, y1, x1 + 20, y1 + 20);
110 p.drawLine( x1 + 20, y1, x1, y1 + 20);
111 }
90 } 112 }
91} 113}
92 114
diff --git a/noncore/games/solitaire/freecellcardgame.cpp b/noncore/games/solitaire/freecellcardgame.cpp
index e82afd4..98415aa 100644
--- a/noncore/games/solitaire/freecellcardgame.cpp
+++ b/noncore/games/solitaire/freecellcardgame.cpp
@@ -17,6 +17,7 @@
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qgfx_qws.h>
20#include "freecellcardgame.h" 21#include "freecellcardgame.h"
21 22
22 23
@@ -29,16 +30,20 @@ FreecellCardGame::FreecellCardGame(QCanvas *c, bool snap, QWidget *parent) : Can
29 numberOfFreeCells = 4; 30 numberOfFreeCells = 4;
30 highestZ = 0; 31 highestZ = 0;
31 32
33 int spaceBetweenPiles = ( qt_screen->deviceWidth() < 200 ) ? 21 : 28;
34 int xOrigin = ( qt_screen->deviceWidth() < 200 ) ? 0 : 5;
35 int spacing = ( qt_screen->deviceWidth() < 200 ) ? 0 : 0;
36
32 for (int i = 0; i < 4; i++) { 37 for (int i = 0; i < 4; i++) {
33 freecellPiles[i] = new FreecellFreecellPile( 5 + i * 28, 10, canvas() ); 38 freecellPiles[i] = new FreecellFreecellPile( xOrigin + i * spaceBetweenPiles, 10, canvas() );
34 addCardPile(freecellPiles[i]); 39 addCardPile(freecellPiles[i]);
35 } 40 }
36 for (int i = 0; i < 4; i++) { 41 for (int i = 0; i < 4; i++) {
37 discardPiles[i] = new FreecellDiscardPile( 125 + i * 28, 10, canvas() ); 42 discardPiles[i] = new FreecellDiscardPile( xOrigin + spacing + 6 + (i + 4) * spaceBetweenPiles, 10, canvas() );
38 addCardPile(discardPiles[i]); 43 addCardPile(discardPiles[i]);
39 } 44 }
40 for (int i = 0; i < 8; i++) { 45 for (int i = 0; i < 8; i++) {
41 workingPiles[i] = new FreecellWorkingPile( 10 + i * 28, 50, canvas() ); 46 workingPiles[i] = new FreecellWorkingPile( xOrigin + spacing + 2 + i * spaceBetweenPiles, 50, canvas() );
42 addCardPile(workingPiles[i]); 47 addCardPile(workingPiles[i]);
43 } 48 }
44} 49}
diff --git a/noncore/games/solitaire/patiencecardgame.cpp b/noncore/games/solitaire/patiencecardgame.cpp
index 5a9326a..1501d2f 100644
--- a/noncore/games/solitaire/patiencecardgame.cpp
+++ b/noncore/games/solitaire/patiencecardgame.cpp
@@ -17,6 +17,7 @@
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qgfx_qws.h>
20#include "patiencecardgame.h" 21#include "patiencecardgame.h"
21 22
22 23
@@ -28,19 +29,35 @@ PatienceCardGame::PatienceCardGame(QCanvas *c, bool snap, QWidget *parent) : Can
28 numberOfTimesThroughDeck = 0; 29 numberOfTimesThroughDeck = 0;
29 highestZ = 0; 30 highestZ = 0;
30 31
31 circleCross = new CanvasCircleOrCross( 7, 18, canvas() ); 32 if ( qt_screen->deviceWidth() < 200 ) {
32 rectangle = new CanvasRoundRect( 35, 10, canvas() ); 33 circleCross = new CanvasCircleOrCross( 7, 16, canvas() );
34 rectangle = new CanvasRoundRect( 30, 10, canvas() );
33 35
34 for (int i = 0; i < 4; i++) { 36 for (int i = 0; i < 4; i++) {
35 discardPiles[i] = new PatienceDiscardPile( 110 + i * 30, 10, canvas() ); 37 discardPiles[i] = new PatienceDiscardPile( 78 + i * 23, 10, canvas() );
36 addCardPile(discardPiles[i]); 38 addCardPile(discardPiles[i]);
37 } 39 }
38 for (int i = 0; i < 7; i++) { 40 for (int i = 0; i < 7; i++) {
39 workingPiles[i] = new PatienceWorkingPile( 10 + i * 30, 50, canvas() ); 41 workingPiles[i] = new PatienceWorkingPile( 5 + i * 23, 50, canvas() );
40 addCardPile(workingPiles[i]); 42 addCardPile(workingPiles[i]);
43 }
44 faceDownDealingPile = new PatienceFaceDownDeck( 5, 10, canvas() );
45 faceUpDealingPile = new PatienceFaceUpDeck( 30, 10, canvas() );
46 } else {
47 circleCross = new CanvasCircleOrCross( 7, 18, canvas() );
48 rectangle = new CanvasRoundRect( 35, 10, canvas() );
49
50 for (int i = 0; i < 4; i++) {
51 discardPiles[i] = new PatienceDiscardPile( 110 + i * 30, 10, canvas() );
52 addCardPile(discardPiles[i]);
53 }
54 for (int i = 0; i < 7; i++) {
55 workingPiles[i] = new PatienceWorkingPile( 10 + i * 30, 50, canvas() );
56 addCardPile(workingPiles[i]);
57 }
58 faceDownDealingPile = new PatienceFaceDownDeck( 5, 10, canvas() );
59 faceUpDealingPile = new PatienceFaceUpDeck( 35, 10, canvas() );
41 } 60 }
42 faceDownDealingPile = new PatienceFaceDownDeck( 5, 10, canvas() );
43 faceUpDealingPile = new PatienceFaceUpDeck( 35, 10, canvas() );
44} 61}
45 62
46 63
@@ -173,7 +190,10 @@ bool PatienceCardGame::mousePressCard( Card *card, QPoint p )
173 faceUpDealingPile->addCardToTop(item); 190 faceUpDealingPile->addCardToTop(item);
174 item->setCardPile( faceUpDealingPile ); 191 item->setCardPile( faceUpDealingPile );
175 192
176 item->flipTo( 35, (int)item->y() ); 193 if ( qt_screen->deviceWidth() < 200 )
194 item->flipTo( 30, (int)item->y() );
195 else
196 item->flipTo( 35, (int)item->y() );
177 } 197 }
178 moving = NULL; 198 moving = NULL;
179 moved = FALSE; 199 moved = FALSE;
@@ -195,7 +215,10 @@ bool PatienceCardGame::mousePressCard( Card *card, QPoint p )
195 faceUpDealingPile->addCardToTop(item); 215 faceUpDealingPile->addCardToTop(item);
196 item->setCardPile( faceUpDealingPile ); 216 item->setCardPile( faceUpDealingPile );
197 217
198 item->flipTo( 35, (int)item->y(), 8 * flipped ); 218 if ( qt_screen->deviceWidth() < 200 )
219 item->flipTo( 30, (int)item->y(), 8 * flipped );
220 else
221 item->flipTo( 35, (int)item->y(), 8 * flipped );
199 } 222 }
200 } 223 }
201 224
diff --git a/noncore/games/solitaire/patiencecardgame.h b/noncore/games/solitaire/patiencecardgame.h
index c4f6c48..0d0e3d5 100644
--- a/noncore/games/solitaire/patiencecardgame.h
+++ b/noncore/games/solitaire/patiencecardgame.h
@@ -25,6 +25,7 @@
25#include <qmainwindow.h> 25#include <qmainwindow.h>
26#include <qintdict.h> 26#include <qintdict.h>
27#include <qcanvas.h> 27#include <qcanvas.h>
28#include <qgfx_qws.h>
28// #include "canvascardshapes.h" 29// #include "canvascardshapes.h"
29// #include "canvascard.h" 30// #include "canvascard.h"
30#include "canvascardgame.h" 31#include "canvascardgame.h"
@@ -130,11 +131,12 @@ public:
130 } else { 131 } else {
131 top = getCardPos(NULL); 132 top = getCardPos(NULL);
132 if ( newTopCard->isFacing() == FALSE ) { 133 if ( newTopCard->isFacing() == FALSE ) {
134 int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13;
133 // correct the position taking in to account the card is not 135 // correct the position taking in to account the card is not
134 // yet flipped, but will become flipped 136 // yet flipped, but will become flipped
135 top = QPoint( top.x() - 1, top.y() - 3 ); 137 top = QPoint( top.x() - 1, top.y() - 3 );
136 newTopCard->flipTo( top.x(), top.y() ); 138 newTopCard->flipTo( top.x(), top.y() );
137 top = QPoint( top.x(), top.y() + 13 ); 139 top = QPoint( top.x(), top.y() + offsetDown );
138 } 140 }
139 setNextX( top.x() ); 141 setNextX( top.x() );
140 setNextY( top.y() ); 142 setNextY( top.y() );
@@ -145,7 +147,8 @@ public:
145 Card *card = cardOnBottom(); 147 Card *card = cardOnBottom();
146 while ((card != c) && (card != NULL)) { 148 while ((card != c) && (card != NULL)) {
147 if (card->isFacing()) { 149 if (card->isFacing()) {
148 y += 13; 150 int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13;
151 y += offsetDown;
149 } else { 152 } else {
150 x += 1; 153 x += 1;
151 y += 3; 154 y += 3;
diff --git a/noncore/games/wordgame/wordgame.cpp b/noncore/games/wordgame/wordgame.cpp
index ca4352d..16d37b3 100644
--- a/noncore/games/wordgame/wordgame.cpp
+++ b/noncore/games/wordgame/wordgame.cpp
@@ -59,6 +59,13 @@ enum RuleEffects {
59 Start=128 59 Start=128
60}; 60};
61 61
62static int tile_smallw = 16;
63static int tile_smallh = 16;
64static int tile_bigw = 22;
65static int tile_bigh = 22;
66static int tile_stweak = -2;
67static int tile_btweak = -1;
68
62static const int rack_tiles=7; 69static const int rack_tiles=7;
63 70
64const char* sampleWGR= 71const char* sampleWGR=
@@ -111,6 +118,15 @@ const char* sampleWGR=
111WordGame::WordGame( QWidget* parent, const char* name, WFlags fl ) : 118WordGame::WordGame( QWidget* parent, const char* name, WFlags fl ) :
112 QMainWindow(parent, name, fl) 119 QMainWindow(parent, name, fl)
113{ 120{
121 if ( qApp->desktop()->width() < 240 ) {
122 tile_smallw = 10;
123 tile_smallh = 10;
124 tile_bigw = 16;
125 tile_bigh = 16;
126 tile_stweak = 0;
127 tile_btweak = 0;
128 }
129
114 setIcon( Resource::loadPixmap( "wordgame" ) ); 130 setIcon( Resource::loadPixmap( "wordgame" ) );
115 setCaption( tr("Word Game") ); 131 setCaption( tr("Word Game") );
116 132
@@ -247,6 +263,7 @@ void WordGame::startGame(const QStringList& playerlist)
247{ 263{
248 toolbar->show(); 264 toolbar->show();
249 racks = new QWidgetStack(vbox); 265 racks = new QWidgetStack(vbox);
266 racks->setFixedHeight(TileItem::bigHeight()+2);
250 namelist.clear(); 267 namelist.clear();
251 nplayers=0; 268 nplayers=0;
252 for (QStringList::ConstIterator it=playerlist.begin(); it!=playerlist.end(); ++it) 269 for (QStringList::ConstIterator it=playerlist.begin(); it!=playerlist.end(); ++it)
@@ -283,7 +300,6 @@ bool WordGame::loadRules(const QString &name)
283 if ( htiles < 3 || vtiles < 3 ) 300 if ( htiles < 3 || vtiles < 3 )
284 return FALSE; 301 return FALSE;
285 302
286 QPixmap bgshapes = Resource::loadPixmap(shapepixmap);
287 QString rule_shapes; 303 QString rule_shapes;
288 for (int i=0; i<vtiles; i++) { 304 for (int i=0; i<vtiles; i++) {
289 QString line; 305 QString line;
@@ -297,6 +313,12 @@ bool WordGame::loadRules(const QString &name)
297 rule_effects[re] = e; 313 rule_effects[re] = e;
298 if ( re++ < 10 ) ts >> e; 314 if ( re++ < 10 ) ts >> e;
299 } 315 }
316
317 QImage shim = Resource::loadImage(shapepixmap);
318 shim = shim.smoothScale((re-1)*TileItem::smallWidth(),TileItem::smallHeight());
319 QPixmap bgshapes;
320 bgshapes.convertFromImage(shim);
321
300 rule_effects[re++] = 100; // default bonus 322 rule_effects[re++] = 100; // default bonus
301 board = new Board(bgshapes, htiles, vtiles, vbox); 323 board = new Board(bgshapes, htiles, vtiles, vbox);
302 board->setRules(rule_shapes, rule_effects); 324 board->setRules(rule_shapes, rule_effects);
@@ -681,22 +703,22 @@ qDebug("%d,%d: %s (%d) for %d",current.x(),current.y(),st.latin1(),n,s);
681 703
682int TileItem::smallWidth() 704int TileItem::smallWidth()
683{ 705{
684 return 16; 706 return tile_smallw;
685} 707}
686 708
687int TileItem::smallHeight() 709int TileItem::smallHeight()
688{ 710{
689 return 16; 711 return tile_smallh;
690} 712}
691 713
692int TileItem::bigWidth() 714int TileItem::bigWidth()
693{ 715{
694 return 22; 716 return tile_bigw;
695} 717}
696 718
697int TileItem::bigHeight() 719int TileItem::bigHeight()
698{ 720{
699 return 22; 721 return tile_bigh;
700} 722}
701 723
702void TileItem::setState( State state ) 724void TileItem::setState( State state )
@@ -720,26 +742,36 @@ void TileItem::setBig(bool b)
720 742
721void TileItem::drawShape(QPainter& p) 743void TileItem::drawShape(QPainter& p)
722{ 744{
723 static QFont value_font("heletica",8); 745 static QFont *value_font=0;
724 static QFont big_font("smoothtimes",17); 746 static QFont *big_font=0;
725 static QFont small_font("smoothtimes",10); 747 static QFont *small_font=0;
748 if ( !value_font ) {
749 value_font = new QFont("helvetica",8);
750 if ( TileItem::bigWidth() < 20 ) {
751 big_font = new QFont("helvetica",12);
752 small_font = new QFont("helvetica",8);
753 } else {
754 big_font = new QFont("smoothtimes",17);
755 small_font = new QFont("smoothtimes",10);
756 }
757 }
726 758
727 QRect area(x(),y(),width(),height()); 759 QRect area(x(),y(),width(),height());
728 p.setBrush(s == Floating ? yellow/*lightGray*/ : white); 760 p.setBrush(s == Floating ? yellow/*lightGray*/ : white);
729 p.drawRect(area); 761 p.drawRect(area);
730 if ( big ) { 762 if ( big ) {
731 p.setFont(value_font); 763 p.setFont(*value_font);
732 QString n = QString::number(t.value()); 764 QString n = QString::number(t.value());
733 int w = p.fontMetrics().width('1'); 765 int w = p.fontMetrics().width('1');
734 int h = p.fontMetrics().height(); 766 int h = p.fontMetrics().height();
735 w *= n.length(); 767 w *= n.length();
736 QRect valuearea(x()+width()-w-2,y()+height()-h+1,w,h); 768 QRect valuearea(x()+width()-w-1,y()+height()-h,w,h);
737 p.drawText(valuearea,AlignCenter,n); 769 p.drawText(valuearea,AlignCenter,n);
738 p.setFont(big_font); 770 p.setFont(*big_font);
739 area = QRect(x(),y(),width()-2,height()-1); 771 area = QRect(x(),y()+tile_btweak,width()-4,height()-1);
740 } else { 772 } else {
741 p.setFont(small_font); 773 p.setFont(*small_font);
742 area = QRect(x(),y()+2,width(),height()-2); 774 area = QRect(x()+1+tile_stweak,y()+1,width(),height()-3);
743 } 775 }
744 if ( t.value() == 0 ) 776 if ( t.value() == 0 )
745 p.setPen(darkGray); 777 p.setPen(darkGray);
@@ -750,6 +782,7 @@ Board::Board(QPixmap bgshapes, int w, int h, QWidget* parent) :
750 QCanvasView(new QCanvas(bgshapes,w,h, TileItem::smallWidth(), TileItem::smallHeight()), 782 QCanvasView(new QCanvas(bgshapes,w,h, TileItem::smallWidth(), TileItem::smallHeight()),
751 parent) 783 parent)
752{ 784{
785 setFixedSize(w*TileItem::smallWidth(),h*TileItem::smallHeight());
753 grid = new TileItem*[w*h]; 786 grid = new TileItem*[w*h];
754 memset(grid,0,w*h*sizeof(TileItem*)); 787 memset(grid,0,w*h*sizeof(TileItem*));
755 setFrameStyle(0); 788 setFrameStyle(0);
@@ -764,6 +797,11 @@ Board::~Board()
764 delete canvas(); 797 delete canvas();
765} 798}
766 799
800QSize Board::sizeHint() const
801{
802 return QSize(canvas()->width(),canvas()->height());
803}
804
767void Board::writeConfig(Config& cfg) 805void Board::writeConfig(Config& cfg)
768{ 806{
769 QStringList t; 807 QStringList t;
@@ -1181,6 +1219,11 @@ Rack::~Rack()
1181 delete canvas(); 1219 delete canvas();
1182} 1220}
1183 1221
1222QSize Rack::sizeHint() const
1223{
1224 return QSize(-1,TileItem::bigHeight()+2);
1225}
1226
1184void Rack::clear() 1227void Rack::clear()
1185{ 1228{
1186 for (int i=0; i<n; i++) 1229 for (int i=0; i<n; i++)
diff --git a/noncore/games/wordgame/wordgame.h b/noncore/games/wordgame/wordgame.h
index 0ffa56a..f73c85a 100644
--- a/noncore/games/wordgame/wordgame.h
+++ b/noncore/games/wordgame/wordgame.h
@@ -148,6 +148,8 @@ public:
148 void setComputerization(int level) { cpu=level; } 148 void setComputerization(int level) { cpu=level; }
149 bool computerized() const { return cpu>0; } 149 bool computerized() const { return cpu>0; }
150 150
151 QSize sizeHint() const;
152
151protected: 153protected:
152 void resizeEvent(QResizeEvent*e); 154 void resizeEvent(QResizeEvent*e);
153 void contentsMousePressEvent(QMouseEvent*); 155 void contentsMousePressEvent(QMouseEvent*);
@@ -211,6 +213,8 @@ public:
211 213
212 int turnScore() const { return turn_score; } 214 int turnScore() const { return turn_score; }
213 215
216 QSize sizeHint() const;
217
214signals: 218signals:
215 void temporaryScore(int); 219 void temporaryScore(int);
216 220
@@ -331,7 +335,7 @@ private:
331 335
332 QWidgetStack *racks; 336 QWidgetStack *racks;
333 QToolBar* toolbar; 337 QToolBar* toolbar;
334 QVBox *vbox; 338 QWidget *vbox;
335 Board *board; 339 Board *board;
336 Bag *bag; 340 Bag *bag;
337 ScoreInfo *scoreinfo; 341 ScoreInfo *scoreinfo;
diff --git a/noncore/multimedia/showimg/settingsdialog.cpp b/noncore/multimedia/showimg/settingsdialog.cpp
deleted file mode 100644
index d21f4cb..0000000
--- a/noncore/multimedia/showimg/settingsdialog.cpp
+++ b/dev/null
@@ -1,57 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "settingsdialog.h"
22#include <qslider.h>
23#include <qlabel.h>
24#include <qcheckbox.h>
25
26SettingsDialog::SettingsDialog( QWidget *parent, const char *name, bool modal, WFlags f )
27 : SettingsDialogBase( parent, name, modal, f )
28{
29 connect( delaySlider, SIGNAL(valueChanged(int)), this, SLOT(delayChanged(int)) );
30}
31
32void SettingsDialog::setDelay( int d )
33{
34 delaySlider->setValue( d );
35 delayChanged( d );
36}
37
38int SettingsDialog::delay() const
39{
40 return delaySlider->value();
41}
42
43void SettingsDialog::setRepeat( bool r )
44{
45 repeatCheck->setChecked( r );
46}
47
48bool SettingsDialog::repeat() const
49{
50 return repeatCheck->isChecked();
51}
52
53void SettingsDialog::delayChanged( int d )
54{
55 delayText->setText( QString::number( d ) + " s" );
56}
57
diff --git a/noncore/multimedia/showimg/settingsdialog.h b/noncore/multimedia/showimg/settingsdialog.h
deleted file mode 100644
index 6dfd2c4..0000000
--- a/noncore/multimedia/showimg/settingsdialog.h
+++ b/dev/null
@@ -1,42 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef SETTINGSDIALOG_H
22#define SETTINGSDIALOG_H
23
24#include "settingsdialogbase.h"
25
26class SettingsDialog : public SettingsDialogBase
27{
28 Q_OBJECT
29public:
30 SettingsDialog( QWidget * parent=0, const char * name=0, bool modal=FALSE, WFlags f=0 );
31
32 void setDelay( int d );
33 int delay() const;
34 void setRepeat( bool r );
35 bool repeat() const;
36
37private slots:
38 void delayChanged( int );
39};
40
41
42#endif
diff --git a/noncore/multimedia/showimg/settingsdialogbase.ui b/noncore/multimedia/showimg/settingsdialogbase.ui
deleted file mode 100644
index ed404d8..0000000
--- a/noncore/multimedia/showimg/settingsdialogbase.ui
+++ b/dev/null
@@ -1,149 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>SettingsDialogBase</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>SettingsDialogBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>227</width>
15 <height>258</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Preferences</string>
21 </property>
22 <vbox>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget>
32 <class>QGroupBox</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>GroupBox1</cstring>
36 </property>
37 <property stdset="1">
38 <name>title</name>
39 <string>Slide Show</string>
40 </property>
41 <vbox>
42 <property stdset="1">
43 <name>margin</name>
44 <number>11</number>
45 </property>
46 <property stdset="1">
47 <name>spacing</name>
48 <number>6</number>
49 </property>
50 <widget>
51 <class>QCheckBox</class>
52 <property stdset="1">
53 <name>name</name>
54 <cstring>repeatCheck</cstring>
55 </property>
56 <property stdset="1">
57 <name>text</name>
58 <string>Repeat</string>
59 </property>
60 </widget>
61 <widget>
62 <class>QLayoutWidget</class>
63 <property stdset="1">
64 <name>name</name>
65 <cstring>Layout1</cstring>
66 </property>
67 <hbox>
68 <property stdset="1">
69 <name>margin</name>
70 <number>0</number>
71 </property>
72 <property stdset="1">
73 <name>spacing</name>
74 <number>6</number>
75 </property>
76 <widget>
77 <class>QLabel</class>
78 <property stdset="1">
79 <name>name</name>
80 <cstring>TextLabel1</cstring>
81 </property>
82 <property stdset="1">
83 <name>text</name>
84 <string>Delay</string>
85 </property>
86 </widget>
87 <widget>
88 <class>QSlider</class>
89 <property stdset="1">
90 <name>name</name>
91 <cstring>delaySlider</cstring>
92 </property>
93 <property stdset="1">
94 <name>minValue</name>
95 <number>5</number>
96 </property>
97 <property stdset="1">
98 <name>maxValue</name>
99 <number>60</number>
100 </property>
101 <property stdset="1">
102 <name>lineStep</name>
103 <number>5</number>
104 </property>
105 <property stdset="1">
106 <name>orientation</name>
107 <enum>Horizontal</enum>
108 </property>
109 <property stdset="1">
110 <name>tickmarks</name>
111 <enum>Right</enum>
112 </property>
113 <property stdset="1">
114 <name>tickInterval</name>
115 <number>10</number>
116 </property>
117 </widget>
118 <widget>
119 <class>QLabel</class>
120 <property stdset="1">
121 <name>name</name>
122 <cstring>delayText</cstring>
123 </property>
124 <property stdset="1">
125 <name>minimumSize</name>
126 <size>
127 <width>25</width>
128 <height>0</height>
129 </size>
130 </property>
131 <property stdset="1">
132 <name>text</name>
133 <string>s</string>
134 </property>
135 <property stdset="1">
136 <name>alignment</name>
137 <set>AlignVCenter|AlignRight</set>
138 </property>
139 <property>
140 <name>hAlign</name>
141 </property>
142 </widget>
143 </hbox>
144 </widget>
145 </vbox>
146 </widget>
147 </vbox>
148</widget>
149</UI>
diff --git a/pics/cards/circle.png b/pics/cards/circle.png
deleted file mode 100644
index 3b006de..0000000
--- a/pics/cards/circle.png
+++ b/dev/null
Binary files differ
diff --git a/pics/cards/cross.png b/pics/cards/cross.png
deleted file mode 100644
index cac7576..0000000
--- a/pics/cards/cross.png
+++ b/dev/null
Binary files differ
diff --git a/pics/inline/today.png b/pics/inline/today.png
deleted file mode 100644
index ac244c6..0000000
--- a/pics/inline/today.png
+++ b/dev/null
Binary files differ
diff --git a/pics/slideshow.png b/pics/slideshow.png
deleted file mode 100644
index 9a7f8d5..0000000
--- a/pics/slideshow.png
+++ b/dev/null
Binary files differ