author | chicken <chicken> | 2004-03-01 19:44:43 (UTC) |
---|---|---|
committer | chicken <chicken> | 2004-03-01 19:44:43 (UTC) |
commit | 18ea562480a63f504f4dc8e3f46c1db9d2cd6276 (patch) (unidiff) | |
tree | de22b70f1da5adeb072f0c30517bd92e9c7a839b | |
parent | 8ac7ec5e055dacd8c92d5a28336257cfe3e716e5 (diff) | |
download | opie-18ea562480a63f504f4dc8e3f46c1db9d2cd6276.zip opie-18ea562480a63f504f4dc8e3f46c1db9d2cd6276.tar.gz opie-18ea562480a63f504f4dc8e3f46c1db9d2cd6276.tar.bz2 |
fix includes
-rw-r--r-- | noncore/apps/opie-write/qcomplextext.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-write/qrichtext.cpp | 15 | ||||
-rw-r--r-- | noncore/apps/opie-write/qstylesheet.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-write/qtextedit.cpp | 20 | ||||
-rw-r--r-- | noncore/apps/oxygen/calcdlgui.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/oxygen/dataTable.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/oxygen/kmolcalc.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxyframe.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxygen.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.cpp | 2 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/account.cpp | 2 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/accountdisplay.cpp | 2 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/budgetdisplay.cpp | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/newaccount.cpp | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/newtransaction.cpp | 2 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/preferencedialogs.cpp | 1 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transactiondisplay.cpp | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transferdialog.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/tableviewer/tableviewer.cpp | 1 |
20 files changed, 0 insertions, 77 deletions
diff --git a/noncore/apps/opie-write/qcomplextext.cpp b/noncore/apps/opie-write/qcomplextext.cpp index e8b94da..473f184 100644 --- a/noncore/apps/opie-write/qcomplextext.cpp +++ b/noncore/apps/opie-write/qcomplextext.cpp | |||
@@ -1,106 +1,103 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of some internal classes | 4 | ** Implementation of some internal classes |
5 | ** | 5 | ** |
6 | ** Created : | 6 | ** Created : |
7 | ** | 7 | ** |
8 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the kernel module of the Qt GUI Toolkit. | 10 | ** This file is part of the kernel module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #include "qcomplextext_p.h" | ||
39 | 38 | ||
40 | #include "qrichtext_p.h" | 39 | #include "qrichtext_p.h" |
41 | #include "qfontmetrics.h" | ||
42 | #include "qrect.h" | ||
43 | 40 | ||
44 | #include <stdlib.h> | 41 | #include <stdlib.h> |
45 | 42 | ||
46 | using namespace Qt3; | 43 | using namespace Qt3; |
47 | 44 | ||
48 | // ----------------------------------------------------- | 45 | // ----------------------------------------------------- |
49 | 46 | ||
50 | /* a small helper class used internally to resolve Bidi embedding levels. | 47 | /* a small helper class used internally to resolve Bidi embedding levels. |
51 | Each line of text caches the embedding level at the start of the line for faster | 48 | Each line of text caches the embedding level at the start of the line for faster |
52 | relayouting | 49 | relayouting |
53 | */ | 50 | */ |
54 | QBidiContext::QBidiContext( uchar l, QChar::Direction e, QBidiContext *p, bool o ) | 51 | QBidiContext::QBidiContext( uchar l, QChar::Direction e, QBidiContext *p, bool o ) |
55 | : level(l) , override(o), dir(e) | 52 | : level(l) , override(o), dir(e) |
56 | { | 53 | { |
57 | if ( p ) | 54 | if ( p ) |
58 | p->ref(); | 55 | p->ref(); |
59 | parent = p; | 56 | parent = p; |
60 | count = 0; | 57 | count = 0; |
61 | } | 58 | } |
62 | 59 | ||
63 | QBidiContext::~QBidiContext() | 60 | QBidiContext::~QBidiContext() |
64 | { | 61 | { |
65 | if( parent && parent->deref() ) | 62 | if( parent && parent->deref() ) |
66 | delete parent; | 63 | delete parent; |
67 | } | 64 | } |
68 | 65 | ||
69 | /* | 66 | /* |
70 | Arabic shaping obeys a number of rules according to the joining classes (see Unicode book, section on | 67 | Arabic shaping obeys a number of rules according to the joining classes (see Unicode book, section on |
71 | arabic). | 68 | arabic). |
72 | 69 | ||
73 | Each unicode char has a joining class (right, dual (left&right), center (joincausing) or transparent). | 70 | Each unicode char has a joining class (right, dual (left&right), center (joincausing) or transparent). |
74 | transparent joining is not encoded in QChar::joining(), but applies to all combining marks and format marks. | 71 | transparent joining is not encoded in QChar::joining(), but applies to all combining marks and format marks. |
75 | 72 | ||
76 | Right join-causing: dual + center | 73 | Right join-causing: dual + center |
77 | Left join-causing: dual + right + center | 74 | Left join-causing: dual + right + center |
78 | 75 | ||
79 | Rules are as follows (for a string already in visual order, as we have it here): | 76 | Rules are as follows (for a string already in visual order, as we have it here): |
80 | 77 | ||
81 | R1 Transparent characters do not affect joining behaviour. | 78 | R1 Transparent characters do not affect joining behaviour. |
82 | R2 A right joining character, that has a right join-causing char on the right will get form XRight | 79 | R2 A right joining character, that has a right join-causing char on the right will get form XRight |
83 | (R3 A left joining character, that has a left join-causing char on the left will get form XLeft) | 80 | (R3 A left joining character, that has a left join-causing char on the left will get form XLeft) |
84 | Note: the above rule is meaningless, as there are no pure left joining characters defined in Unicode | 81 | Note: the above rule is meaningless, as there are no pure left joining characters defined in Unicode |
85 | R4 A dual joining character, that has a left join-causing char on the left and a right join-causing char on | 82 | R4 A dual joining character, that has a left join-causing char on the left and a right join-causing char on |
86 | the right will get form XMedial | 83 | the right will get form XMedial |
87 | R5 A dual joining character, that has a right join causing char on the right, and no left join causing char on the left | 84 | R5 A dual joining character, that has a right join causing char on the right, and no left join causing char on the left |
88 | will get form XRight | 85 | will get form XRight |
89 | R6 A dual joining character, that has a left join causing char on the left, and no right join causing char on the right | 86 | R6 A dual joining character, that has a left join causing char on the left, and no right join causing char on the right |
90 | will get form XLeft | 87 | will get form XLeft |
91 | R7 Otherwise the character will get form XIsolated | 88 | R7 Otherwise the character will get form XIsolated |
92 | 89 | ||
93 | Additionally we have to do the minimal ligature support for lam-alef ligatures: | 90 | Additionally we have to do the minimal ligature support for lam-alef ligatures: |
94 | 91 | ||
95 | L1 Transparent characters do not affect ligature behaviour. | 92 | L1 Transparent characters do not affect ligature behaviour. |
96 | L2 Any sequence of Alef(XRight) + Lam(XMedial) will form the ligature Alef.Lam(XLeft) | 93 | L2 Any sequence of Alef(XRight) + Lam(XMedial) will form the ligature Alef.Lam(XLeft) |
97 | L3 Any sequence of Alef(XRight) + Lam(XLeft) will form the ligature Alef.Lam(XIsolated) | 94 | L3 Any sequence of Alef(XRight) + Lam(XLeft) will form the ligature Alef.Lam(XIsolated) |
98 | 95 | ||
99 | The two functions defined in this class do shaping in visual and logical order. For logical order just replace right with | 96 | The two functions defined in this class do shaping in visual and logical order. For logical order just replace right with |
100 | previous and left with next in the above rules ;-) | 97 | previous and left with next in the above rules ;-) |
101 | */ | 98 | */ |
102 | 99 | ||
103 | /* | 100 | /* |
104 | Two small helper functions for arabic shaping. They get the next shape causing character on either | 101 | Two small helper functions for arabic shaping. They get the next shape causing character on either |
105 | side of the char in question. Implements rule R1. | 102 | side of the char in question. Implements rule R1. |
106 | 103 | ||
diff --git a/noncore/apps/opie-write/qrichtext.cpp b/noncore/apps/opie-write/qrichtext.cpp index 3b044c3..b77a0fc 100644 --- a/noncore/apps/opie-write/qrichtext.cpp +++ b/noncore/apps/opie-write/qrichtext.cpp | |||
@@ -1,121 +1,106 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of the internal Qt classes dealing with rich text | 4 | ** Implementation of the internal Qt classes dealing with rich text |
5 | ** | 5 | ** |
6 | ** Created : 990101 | 6 | ** Created : 990101 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the kernel module of the Qt GUI Toolkit. | 10 | ** This file is part of the kernel module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #include "qrichtext_p.h" | 38 | #include "qrichtext_p.h" |
39 | 39 | ||
40 | #include "qstringlist.h" | ||
41 | #include "qfont.h" | ||
42 | #include "qtextstream.h" | ||
43 | #include "qfile.h" | ||
44 | #include "qapplication.h" | ||
45 | #include "qmap.h" | ||
46 | #include "qfileinfo.h" | ||
47 | #include "qstylesheet.h" | ||
48 | #include "qmime.h" | ||
49 | #include "qimage.h" | ||
50 | #include "qdragobject.h" | 40 | #include "qdragobject.h" |
51 | #include "qpaintdevicemetrics.h" | 41 | #include "qpaintdevicemetrics.h" |
52 | #include "qpainter.h" | ||
53 | #include "qdrawutil.h" | 42 | #include "qdrawutil.h" |
54 | #include "qcursor.h" | ||
55 | #include "qstack.h" | ||
56 | #include "qstyle.h" | ||
57 | #include "qcomplextext_p.h" | ||
58 | #include "qcleanuphandler.h" | 43 | #include "qcleanuphandler.h" |
59 | 44 | ||
60 | #include <stdlib.h> | 45 | #include <stdlib.h> |
61 | 46 | ||
62 | using namespace Qt3; | 47 | using namespace Qt3; |
63 | 48 | ||
64 | static QTextCursor* richTextExportStart = 0; | 49 | static QTextCursor* richTextExportStart = 0; |
65 | static QTextCursor* richTextExportEnd = 0; | 50 | static QTextCursor* richTextExportEnd = 0; |
66 | 51 | ||
67 | static QTextFormatCollection *qFormatCollection = 0; | 52 | static QTextFormatCollection *qFormatCollection = 0; |
68 | 53 | ||
69 | const int border_tolerance = 2; | 54 | const int border_tolerance = 2; |
70 | 55 | ||
71 | #ifdef Q_WS_WIN | 56 | #ifdef Q_WS_WIN |
72 | #include "qt_windows.h" | 57 | #include "qt_windows.h" |
73 | #endif | 58 | #endif |
74 | 59 | ||
75 | #define QChar_linesep QChar(0x2028U) | 60 | #define QChar_linesep QChar(0x2028U) |
76 | 61 | ||
77 | static inline bool is_printer( QPainter *p ) | 62 | static inline bool is_printer( QPainter *p ) |
78 | { | 63 | { |
79 | if ( !p || !p->device() ) | 64 | if ( !p || !p->device() ) |
80 | return FALSE; | 65 | return FALSE; |
81 | return p->device()->devType() == QInternal::Printer; | 66 | return p->device()->devType() == QInternal::Printer; |
82 | } | 67 | } |
83 | 68 | ||
84 | static inline int scale( int value, QPainter *painter ) | 69 | static inline int scale( int value, QPainter *painter ) |
85 | { | 70 | { |
86 | if ( is_printer( painter ) ) { | 71 | if ( is_printer( painter ) ) { |
87 | QPaintDeviceMetrics metrics( painter->device() ); | 72 | QPaintDeviceMetrics metrics( painter->device() ); |
88 | #if defined(Q_WS_X11) | 73 | #if defined(Q_WS_X11) |
89 | value = value * metrics.logicalDpiY() / QPaintDevice::x11AppDpiY(); | 74 | value = value * metrics.logicalDpiY() / QPaintDevice::x11AppDpiY(); |
90 | #elif defined (Q_WS_WIN) | 75 | #elif defined (Q_WS_WIN) |
91 | HDC hdc = GetDC( 0 ); | 76 | HDC hdc = GetDC( 0 ); |
92 | int gdc = GetDeviceCaps( hdc, LOGPIXELSY ); | 77 | int gdc = GetDeviceCaps( hdc, LOGPIXELSY ); |
93 | if ( gdc ) | 78 | if ( gdc ) |
94 | value = value * metrics.logicalDpiY() / gdc; | 79 | value = value * metrics.logicalDpiY() / gdc; |
95 | ReleaseDC( 0, hdc ); | 80 | ReleaseDC( 0, hdc ); |
96 | #elif defined (Q_WS_MAC) | 81 | #elif defined (Q_WS_MAC) |
97 | value = value * metrics.logicalDpiY() / 75; // ##### FIXME | 82 | value = value * metrics.logicalDpiY() / 75; // ##### FIXME |
98 | #elif defined (Q_WS_QWS) | 83 | #elif defined (Q_WS_QWS) |
99 | value = value * metrics.logicalDpiY() / 75; | 84 | value = value * metrics.logicalDpiY() / 75; |
100 | #endif | 85 | #endif |
101 | } | 86 | } |
102 | return value; | 87 | return value; |
103 | } | 88 | } |
104 | 89 | ||
105 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 90 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
106 | 91 | ||
107 | void QTextCommandHistory::addCommand( QTextCommand *cmd ) | 92 | void QTextCommandHistory::addCommand( QTextCommand *cmd ) |
108 | { | 93 | { |
109 | if ( current < (int)history.count() - 1 ) { | 94 | if ( current < (int)history.count() - 1 ) { |
110 | QPtrList<QTextCommand> commands; | 95 | QPtrList<QTextCommand> commands; |
111 | commands.setAutoDelete( FALSE ); | 96 | commands.setAutoDelete( FALSE ); |
112 | 97 | ||
113 | for( int i = 0; i <= current; ++i ) { | 98 | for( int i = 0; i <= current; ++i ) { |
114 | commands.insert( i, history.at( 0 ) ); | 99 | commands.insert( i, history.at( 0 ) ); |
115 | history.take( 0 ); | 100 | history.take( 0 ); |
116 | } | 101 | } |
117 | 102 | ||
118 | commands.append( cmd ); | 103 | commands.append( cmd ); |
119 | history.clear(); | 104 | history.clear(); |
120 | history = commands; | 105 | history = commands; |
121 | history.setAutoDelete( TRUE ); | 106 | history.setAutoDelete( TRUE ); |
diff --git a/noncore/apps/opie-write/qstylesheet.cpp b/noncore/apps/opie-write/qstylesheet.cpp index 67cd828..ca634f7 100644 --- a/noncore/apps/opie-write/qstylesheet.cpp +++ b/noncore/apps/opie-write/qstylesheet.cpp | |||
@@ -1,106 +1,104 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of the QStyleSheet class | 4 | ** Implementation of the QStyleSheet class |
5 | ** | 5 | ** |
6 | ** Created : 990101 | 6 | ** Created : 990101 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the kernel module of the Qt GUI Toolkit. | 10 | ** This file is part of the kernel module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #include "qstylesheet.h" | 38 | #include "qstylesheet.h" |
39 | 39 | ||
40 | #include "qrichtext_p.h" | 40 | #include "qrichtext_p.h" |
41 | #include "qlayout.h" | ||
42 | #include "qpainter.h" | ||
43 | #include "qcleanuphandler.h" | 41 | #include "qcleanuphandler.h" |
44 | 42 | ||
45 | #include <stdio.h> | 43 | #include <stdio.h> |
46 | 44 | ||
47 | using namespace Qt3; | 45 | using namespace Qt3; |
48 | 46 | ||
49 | namespace Qt3 { | 47 | namespace Qt3 { |
50 | 48 | ||
51 | class QStyleSheetItemData | 49 | class QStyleSheetItemData |
52 | { | 50 | { |
53 | public: | 51 | public: |
54 | QStyleSheetItem::DisplayMode disp; | 52 | QStyleSheetItem::DisplayMode disp; |
55 | int fontitalic; | 53 | int fontitalic; |
56 | int fontunderline; | 54 | int fontunderline; |
57 | int fontstrikeout; | 55 | int fontstrikeout; |
58 | int fontweight; | 56 | int fontweight; |
59 | int fontsize; | 57 | int fontsize; |
60 | int fontsizelog; | 58 | int fontsizelog; |
61 | int fontsizestep; | 59 | int fontsizestep; |
62 | int lineSpacing; | 60 | int lineSpacing; |
63 | QString fontfamily; | 61 | QString fontfamily; |
64 | QStyleSheetItem *parentstyle; | 62 | QStyleSheetItem *parentstyle; |
65 | QString stylename; | 63 | QString stylename; |
66 | int ncolumns; | 64 | int ncolumns; |
67 | QColor col; | 65 | QColor col; |
68 | bool anchor; | 66 | bool anchor; |
69 | int align; | 67 | int align; |
70 | QStyleSheetItem::VerticalAlignment valign; | 68 | QStyleSheetItem::VerticalAlignment valign; |
71 | int margin[5]; | 69 | int margin[5]; |
72 | QStyleSheetItem::ListStyle list; | 70 | QStyleSheetItem::ListStyle list; |
73 | QStyleSheetItem::WhiteSpaceMode whitespacemode; | 71 | QStyleSheetItem::WhiteSpaceMode whitespacemode; |
74 | QString contxt; | 72 | QString contxt; |
75 | bool selfnest; | 73 | bool selfnest; |
76 | QStyleSheet* sheet; | 74 | QStyleSheet* sheet; |
77 | }; | 75 | }; |
78 | 76 | ||
79 | } | 77 | } |
80 | 78 | ||
81 | /*! | 79 | /*! |
82 | \class QStyleSheetItem qstylesheet.h | 80 | \class QStyleSheetItem qstylesheet.h |
83 | \brief The QStyleSheetItem class provides an encapsulation of a set of text styles. | 81 | \brief The QStyleSheetItem class provides an encapsulation of a set of text styles. |
84 | 82 | ||
85 | \ingroup text | 83 | \ingroup text |
86 | 84 | ||
87 | A style sheet item consists of a name and a set of attributes that | 85 | A style sheet item consists of a name and a set of attributes that |
88 | specifiy its font, color, etc. When used in a \link QStyleSheet | 86 | specifiy its font, color, etc. When used in a \link QStyleSheet |
89 | style sheet\endlink (see styleSheet()), items define the name() of | 87 | style sheet\endlink (see styleSheet()), items define the name() of |
90 | a rich text tag and the display property changes associated with | 88 | a rich text tag and the display property changes associated with |
91 | it. | 89 | it. |
92 | 90 | ||
93 | The \link QStyleSheetItem::DisplayMode display mode\endlink | 91 | The \link QStyleSheetItem::DisplayMode display mode\endlink |
94 | attribute indicates whether the item is a block, an inline element | 92 | attribute indicates whether the item is a block, an inline element |
95 | or a list element; see setDisplayMode(). The treatment of | 93 | or a list element; see setDisplayMode(). The treatment of |
96 | whitespace is controlled by the \link | 94 | whitespace is controlled by the \link |
97 | QStyleSheetItem::WhiteSpaceMode white space mode\endlink; see | 95 | QStyleSheetItem::WhiteSpaceMode white space mode\endlink; see |
98 | setWhiteSpaceMode(). An item's margins are set with setMargin(), | 96 | setWhiteSpaceMode(). An item's margins are set with setMargin(), |
99 | In the case of list items, the list style is set with | 97 | In the case of list items, the list style is set with |
100 | setListStyle(). An item may be a hypertext link anchor; see | 98 | setListStyle(). An item may be a hypertext link anchor; see |
101 | setAnchor(). Other attributes are set with setAlignment(), | 99 | setAnchor(). Other attributes are set with setAlignment(), |
102 | setVerticalAlignment(), setFontFamily(), setFontSize(), | 100 | setVerticalAlignment(), setFontFamily(), setFontSize(), |
103 | setFontWeight(), setFontItalic(), setFontUnderline(), | 101 | setFontWeight(), setFontItalic(), setFontUnderline(), |
104 | setFontStrikeOut and setColor(). | 102 | setFontStrikeOut and setColor(). |
105 | */ | 103 | */ |
106 | 104 | ||
diff --git a/noncore/apps/opie-write/qtextedit.cpp b/noncore/apps/opie-write/qtextedit.cpp index 82401c6..27dd515 100644 --- a/noncore/apps/opie-write/qtextedit.cpp +++ b/noncore/apps/opie-write/qtextedit.cpp | |||
@@ -1,126 +1,106 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of the QTextEdit class | 4 | ** Implementation of the QTextEdit class |
5 | ** | 5 | ** |
6 | ** Created : 990101 | 6 | ** Created : 990101 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the widgets module of the Qt GUI Toolkit. | 10 | ** This file is part of the widgets module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #include "qtextedit.h" | 38 | #include "qtextedit.h" |
39 | 39 | ||
40 | #include "qrichtext_p.h" | 40 | #include "qrichtext_p.h" |
41 | #include "qpainter.h" | ||
42 | #include "qpen.h" | ||
43 | #include "qbrush.h" | ||
44 | #include "qpixmap.h" | ||
45 | #include "qfont.h" | ||
46 | #include "qcolor.h" | ||
47 | #include "qstyle.h" | ||
48 | #include "qsize.h" | ||
49 | #include "qevent.h" | ||
50 | #include "qtimer.h" | ||
51 | #include "qapplication.h" | ||
52 | #include "qlistbox.h" | 41 | #include "qlistbox.h" |
53 | #include "qvbox.h" | ||
54 | #include "qapplication.h" | ||
55 | #include "qclipboard.h" | 42 | #include "qclipboard.h" |
56 | #include "qcolordialog.h" | ||
57 | #include "qfontdialog.h" | ||
58 | #include "qstylesheet.h" | ||
59 | #include "qdragobject.h" | ||
60 | #include "qurl.h" | ||
61 | #include "qcursor.h" | ||
62 | #include "qregexp.h" | ||
63 | #include "qpopupmenu.h" | 43 | #include "qpopupmenu.h" |
64 | 44 | ||
65 | #define ACCEL_KEY(k) "\t" + QString("Ctrl+" #k) | 45 | #define ACCEL_KEY(k) "\t" + QString("Ctrl+" #k) |
66 | 46 | ||
67 | using namespace Qt3; | 47 | using namespace Qt3; |
68 | 48 | ||
69 | static bool qt_enable_richtext_copy = FALSE; | 49 | static bool qt_enable_richtext_copy = FALSE; |
70 | 50 | ||
71 | struct QUndoRedoInfoPrivate | 51 | struct QUndoRedoInfoPrivate |
72 | { | 52 | { |
73 | QTextString text; | 53 | QTextString text; |
74 | }; | 54 | }; |
75 | 55 | ||
76 | namespace Qt3 { | 56 | namespace Qt3 { |
77 | 57 | ||
78 | class QTextEditPrivate | 58 | class QTextEditPrivate |
79 | { | 59 | { |
80 | public: | 60 | public: |
81 | QTextEditPrivate() | 61 | QTextEditPrivate() |
82 | :preeditStart(-1),preeditLength(-1),ensureCursorVisibleInShowEvent(FALSE) | 62 | :preeditStart(-1),preeditLength(-1),ensureCursorVisibleInShowEvent(FALSE) |
83 | { | 63 | { |
84 | for ( int i=0; i<7; i++ ) | 64 | for ( int i=0; i<7; i++ ) |
85 | id[i] = 0; | 65 | id[i] = 0; |
86 | } | 66 | } |
87 | int id[ 7 ]; | 67 | int id[ 7 ]; |
88 | int preeditStart; | 68 | int preeditStart; |
89 | int preeditLength; | 69 | int preeditLength; |
90 | bool ensureCursorVisibleInShowEvent; | 70 | bool ensureCursorVisibleInShowEvent; |
91 | QString scrollToAnchor; // used to deferr scrollToAnchor() until the show event when we are resized | 71 | QString scrollToAnchor; // used to deferr scrollToAnchor() until the show event when we are resized |
92 | }; | 72 | }; |
93 | 73 | ||
94 | } | 74 | } |
95 | 75 | ||
96 | static bool block_set_alignment = FALSE; | 76 | static bool block_set_alignment = FALSE; |
97 | 77 | ||
98 | /*! | 78 | /*! |
99 | \class QTextEdit qtextedit.h | 79 | \class QTextEdit qtextedit.h |
100 | \brief The QTextEdit widget provides a powerful single-page rich text editor. | 80 | \brief The QTextEdit widget provides a powerful single-page rich text editor. |
101 | 81 | ||
102 | \ingroup basic | 82 | \ingroup basic |
103 | \ingroup text | 83 | \ingroup text |
104 | \mainclass | 84 | \mainclass |
105 | 85 | ||
106 | \tableofcontents | 86 | \tableofcontents |
107 | 87 | ||
108 | \section1 Introduction and Concepts | 88 | \section1 Introduction and Concepts |
109 | 89 | ||
110 | QTextEdit is an advanced WYSIWYG viewer/editor supporting rich | 90 | QTextEdit is an advanced WYSIWYG viewer/editor supporting rich |
111 | text formatting using HTML-style tags. It is optimized to handle | 91 | text formatting using HTML-style tags. It is optimized to handle |
112 | large documents and to respond quickly to user input. | 92 | large documents and to respond quickly to user input. |
113 | 93 | ||
114 | QTextEdit has three modes of operation: | 94 | QTextEdit has three modes of operation: |
115 | \table | 95 | \table |
116 | \header \i Mode \i Command \i Notes | 96 | \header \i Mode \i Command \i Notes |
117 | \row \i Plain Text Editor \i setTextFormat(PlainText) | 97 | \row \i Plain Text Editor \i setTextFormat(PlainText) |
118 | \i Set text with setText(); text() returns plain text. Text | 98 | \i Set text with setText(); text() returns plain text. Text |
119 | attributes (e.g. colors) can be set, but plain text is always | 99 | attributes (e.g. colors) can be set, but plain text is always |
120 | returned.<sup>1.</sup> | 100 | returned.<sup>1.</sup> |
121 | \row \i Rich Text Editor \i setTextFormat(RichText) | 101 | \row \i Rich Text Editor \i setTextFormat(RichText) |
122 | \i Set text with setText(); text() returns rich text. Rich | 102 | \i Set text with setText(); text() returns rich text. Rich |
123 | text editing is fairly limited. You can't set margins or | 103 | text editing is fairly limited. You can't set margins or |
124 | insert images for example (although you can read and | 104 | insert images for example (although you can read and |
125 | correctly display files that have margins set and that | 105 | correctly display files that have margins set and that |
126 | include images). This mode is mostly useful for editing small | 106 | include images). This mode is mostly useful for editing small |
diff --git a/noncore/apps/oxygen/calcdlgui.cpp b/noncore/apps/oxygen/calcdlgui.cpp index f8dfde5..2bb8337 100644 --- a/noncore/apps/oxygen/calcdlgui.cpp +++ b/noncore/apps/oxygen/calcdlgui.cpp | |||
@@ -1,64 +1,63 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | 2 | application: : Oxygen |
3 | 3 | ||
4 | begin : September 2002 | 4 | begin : September 2002 |
5 | copyright : ( C ) 2002 by Carsten Niehaus | 5 | copyright : ( C ) 2002 by Carsten Niehaus |
6 | email : cniehaus@handhelds.org | 6 | email : cniehaus@handhelds.org |
7 | **************************************************************************/ | 7 | **************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
15 | * * | 15 | * * |
16 | **************************************************************************/ | 16 | **************************************************************************/ |
17 | #include "oxygen.h" | ||
18 | 17 | ||
19 | #include "calcdlgui.h" | 18 | #include "calcdlgui.h" |
20 | #include "kmolcalc.h" | 19 | #include "kmolcalc.h" |
21 | #include <qlineedit.h> | 20 | #include <qlineedit.h> |
22 | #include <qmultilineedit.h> | 21 | #include <qmultilineedit.h> |
23 | #include <qpushbutton.h> | 22 | #include <qpushbutton.h> |
24 | 23 | ||
25 | calcDlgUI::calcDlgUI() : CalcDlg() | 24 | calcDlgUI::calcDlgUI() : CalcDlg() |
26 | { | 25 | { |
27 | kmolcalc = new KMolCalc; | 26 | kmolcalc = new KMolCalc; |
28 | connect( calculate, SIGNAL( clicked() ), this, SLOT( calc() ) ); | 27 | connect( calculate, SIGNAL( clicked() ), this, SLOT( calc() ) ); |
29 | connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) ); | 28 | connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) ); |
30 | result->setReadOnly( true ); | 29 | result->setReadOnly( true ); |
31 | } | 30 | } |
32 | 31 | ||
33 | void calcDlgUI::calc() | 32 | void calcDlgUI::calc() |
34 | { | 33 | { |
35 | QString compound( formula->text() ); | 34 | QString compound( formula->text() ); |
36 | if ( compound.isEmpty() ) { | 35 | if ( compound.isEmpty() ) { |
37 | clear(); | 36 | clear(); |
38 | return; | 37 | return; |
39 | } | 38 | } |
40 | QString errors( kmolcalc->readFormula( compound ) ); | 39 | QString errors( kmolcalc->readFormula( compound ) ); |
41 | QString mw, ea; | 40 | QString mw, ea; |
42 | double weight = kmolcalc->getWeight(); | 41 | double weight = kmolcalc->getWeight(); |
43 | if ( errors == "OK" ) { | 42 | if ( errors == "OK" ) { |
44 | mw.setNum( weight ); | 43 | mw.setNum( weight ); |
45 | ea = kmolcalc->getEmpFormula() + " :\n" + kmolcalc->getEA(); | 44 | ea = kmolcalc->getEmpFormula() + " :\n" + kmolcalc->getEA(); |
46 | } else { | 45 | } else { |
47 | mw = "???"; | 46 | mw = "???"; |
48 | ea = tr( "ERROR: \n" ).arg( errors )+ "\n"; | 47 | ea = tr( "ERROR: \n" ).arg( errors )+ "\n"; |
49 | } | 48 | } |
50 | result->setText( mw ); | 49 | result->setText( mw ); |
51 | anal_display->setText( ea ); | 50 | anal_display->setText( ea ); |
52 | } | 51 | } |
53 | 52 | ||
54 | /** | 53 | /** |
55 | * * Clear all text entry / result fields. | 54 | * * Clear all text entry / result fields. |
56 | * */ | 55 | * */ |
57 | void calcDlgUI::clear() | 56 | void calcDlgUI::clear() |
58 | { | 57 | { |
59 | formula->clear(); | 58 | formula->clear(); |
60 | result->clear(); | 59 | result->clear(); |
61 | anal_display->clear(); | 60 | anal_display->clear(); |
62 | } | 61 | } |
63 | 62 | ||
64 | 63 | ||
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp index e3906be..48e2b20 100644 --- a/noncore/apps/oxygen/dataTable.cpp +++ b/noncore/apps/oxygen/dataTable.cpp | |||
@@ -1,92 +1,89 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | 2 | application: : Oxygen |
3 | 3 | ||
4 | begin : September 2002 | 4 | begin : September 2002 |
5 | copyright : ( C ) 2002 by Carsten Niehaus | 5 | copyright : ( C ) 2002 by Carsten Niehaus |
6 | email : cniehaus@handhelds.org | 6 | email : cniehaus@handhelds.org |
7 | **************************************************************************/ | 7 | **************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
15 | * * | 15 | * * |
16 | **************************************************************************/ | 16 | **************************************************************************/ |
17 | 17 | ||
18 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | 19 | ||
20 | #include "dataTable.h" | 20 | #include "dataTable.h" |
21 | #include <qwidget.h> | ||
22 | #include <qhbox.h> | 21 | #include <qhbox.h> |
23 | #include <qlabel.h> | 22 | #include <qlabel.h> |
24 | #include <qfont.h> | ||
25 | #include <qlayout.h> | 23 | #include <qlayout.h> |
26 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
27 | 25 | ||
28 | #include <qstringlist.h> | ||
29 | 26 | ||
30 | OxydataWidget::OxydataWidget(QWidget *parent, const char *name, const QStringList &list ) : QWidget( parent,name ), names( list ) | 27 | OxydataWidget::OxydataWidget(QWidget *parent, const char *name, const QStringList &list ) : QWidget( parent,name ), names( list ) |
31 | { | 28 | { |
32 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); | 29 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); |
33 | 30 | ||
34 | QHBox *hbox = new QHBox( this ); | 31 | QHBox *hbox = new QHBox( this ); |
35 | left = new QLabel( hbox ); | 32 | left = new QLabel( hbox ); |
36 | middle = new QLabel( hbox ); | 33 | middle = new QLabel( hbox ); |
37 | right = new QLabel( hbox ); | 34 | right = new QLabel( hbox ); |
38 | 35 | ||
39 | right->setAlignment( AlignRight ); | 36 | right->setAlignment( AlignRight ); |
40 | middle->setAlignment( AlignHCenter ); | 37 | middle->setAlignment( AlignHCenter ); |
41 | 38 | ||
42 | QFont bf; | 39 | QFont bf; |
43 | bf.setBold( true ); | 40 | bf.setBold( true ); |
44 | bf.setPointSize( bf.pointSize()+2 ); | 41 | bf.setPointSize( bf.pointSize()+2 ); |
45 | middle->setFont( bf ); | 42 | middle->setFont( bf ); |
46 | 43 | ||
47 | DataTable = new OxydataTable( 9,2, this ); | 44 | DataTable = new OxydataTable( 9,2, this ); |
48 | setTable(); | 45 | setTable(); |
49 | 46 | ||
50 | qgrid->addWidget( hbox,0,0 ); | 47 | qgrid->addWidget( hbox,0,0 ); |
51 | qgrid->addWidget( DataTable,1,0 ); | 48 | qgrid->addWidget( DataTable,1,0 ); |
52 | } | 49 | } |
53 | 50 | ||
54 | void OxydataWidget::setElement( int el ) | 51 | void OxydataWidget::setElement( int el ) |
55 | { | 52 | { |
56 | QStringList::ConstIterator it = names.at(el); | 53 | QStringList::ConstIterator it = names.at(el); |
57 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); | 54 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); |
58 | 55 | ||
59 | configobj.setGroup( QString::number( el+1 )); | 56 | configobj.setGroup( QString::number( el+1 )); |
60 | 57 | ||
61 | left->setText( configobj.readEntry( "Symbol" ) ); | 58 | left->setText( configobj.readEntry( "Symbol" ) ); |
62 | middle->setText( *it ); | 59 | middle->setText( *it ); |
63 | right->setText( QString::number( el+1 ) ); | 60 | right->setText( QString::number( el+1 ) ); |
64 | 61 | ||
65 | 62 | ||
66 | DataTable->setText( 0,1,tr( "%1 u" ).arg( configobj.readEntry( "Weight" ) ) ); | 63 | DataTable->setText( 0,1,tr( "%1 u" ).arg( configobj.readEntry( "Weight" ) ) ); |
67 | DataTable->setText( 1,1,configobj.readEntry( "Block" ) ); | 64 | DataTable->setText( 1,1,configobj.readEntry( "Block" ) ); |
68 | DataTable->setText( 2,1,configobj.readEntry( "Group" ) ); | 65 | DataTable->setText( 2,1,configobj.readEntry( "Group" ) ); |
69 | DataTable->setText( 3,1,configobj.readEntry( "EN" ) ); | 66 | DataTable->setText( 3,1,configobj.readEntry( "EN" ) ); |
70 | DataTable->setText( 4,1,tr( "%1 pm" ).arg( configobj.readEntry( "AR" ) ) ) ; | 67 | DataTable->setText( 4,1,tr( "%1 pm" ).arg( configobj.readEntry( "AR" ) ) ) ; |
71 | DataTable->setText( 5,1,tr( "%1 J" ).arg( configobj.readEntry( "IE" ) ) ); | 68 | DataTable->setText( 5,1,tr( "%1 J" ).arg( configobj.readEntry( "IE" ) ) ); |
72 | DataTable->setText( 6,1,tr( "%1 g/cm^3" ).arg( configobj.readEntry( "Density" ) ) ); | 69 | DataTable->setText( 6,1,tr( "%1 g/cm^3" ).arg( configobj.readEntry( "Density" ) ) ); |
73 | DataTable->setText( 7,1,tr( "%1 K" ).arg( configobj.readEntry( "BP" ) ) ); | 70 | DataTable->setText( 7,1,tr( "%1 K" ).arg( configobj.readEntry( "BP" ) ) ); |
74 | DataTable->setText( 8,1,tr( "%1 K" ).arg( configobj.readEntry( "MP" ) ) ); | 71 | DataTable->setText( 8,1,tr( "%1 K" ).arg( configobj.readEntry( "MP" ) ) ); |
75 | } | 72 | } |
76 | 73 | ||
77 | void OxydataWidget::setTable() const | 74 | void OxydataWidget::setTable() const |
78 | { | 75 | { |
79 | DataTable->setText( 0,0, tr( "Weight" ) ); | 76 | DataTable->setText( 0,0, tr( "Weight" ) ); |
80 | DataTable->setText( 1,0, tr( "Block" )) ; | 77 | DataTable->setText( 1,0, tr( "Block" )) ; |
81 | DataTable->setText( 2,0, tr( "Group" )) ; | 78 | DataTable->setText( 2,0, tr( "Group" )) ; |
82 | DataTable->setText( 3,0, tr( "Electronegativity" )) ; | 79 | DataTable->setText( 3,0, tr( "Electronegativity" )) ; |
83 | DataTable->setText( 4,0, tr( "Atomic radius" )) ; | 80 | DataTable->setText( 4,0, tr( "Atomic radius" )) ; |
84 | DataTable->setText( 5,0, tr( "Ionization Energy" )) ; | 81 | DataTable->setText( 5,0, tr( "Ionization Energy" )) ; |
85 | DataTable->setText( 6,0, tr( "Density" )) ; | 82 | DataTable->setText( 6,0, tr( "Density" )) ; |
86 | DataTable->setText( 7,0, tr( "Boiling point" ) ); | 83 | DataTable->setText( 7,0, tr( "Boiling point" ) ); |
87 | DataTable->setText( 8,0, tr( "Melting point" ) ); | 84 | DataTable->setText( 8,0, tr( "Melting point" ) ); |
88 | } | 85 | } |
89 | 86 | ||
90 | void OxydataWidget::setLayout() | 87 | void OxydataWidget::setLayout() |
91 | { | 88 | { |
92 | #warning this is not working and I have no idea why! | 89 | #warning this is not working and I have no idea why! |
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp index e1d6e41..dcb80e5 100644 --- a/noncore/apps/oxygen/datawidgetui.cpp +++ b/noncore/apps/oxygen/datawidgetui.cpp | |||
@@ -1,53 +1,48 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | 2 | application: : Oxygen |
3 | 3 | ||
4 | begin : September 2002 | 4 | begin : September 2002 |
5 | copyright : ( C ) 2002 by Carsten Niehaus | 5 | copyright : ( C ) 2002 by Carsten Niehaus |
6 | email : cniehaus@handhelds.org | 6 | email : cniehaus@handhelds.org |
7 | **************************************************************************/ | 7 | **************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
15 | * * | 15 | * * |
16 | **************************************************************************/ | 16 | **************************************************************************/ |
17 | 17 | ||
18 | #include "datawidgetui.h" | 18 | #include "datawidgetui.h" |
19 | #include "dataTable.h" | 19 | #include "dataTable.h" |
20 | 20 | ||
21 | #include <qpe/config.h> | ||
22 | #include <qstring.h> | ||
23 | #include <qcombobox.h> | 21 | #include <qcombobox.h> |
24 | #include <qlayout.h> | 22 | #include <qlayout.h> |
25 | #include <qhbox.h> | ||
26 | #include <qlabel.h> | ||
27 | #include <qpe/qpeapplication.h> | ||
28 | 23 | ||
29 | dataWidgetUI::dataWidgetUI(const QStringList &list) : QWidget() | 24 | dataWidgetUI::dataWidgetUI(const QStringList &list) : QWidget() |
30 | { | 25 | { |
31 | names = list; | 26 | names = list; |
32 | 27 | ||
33 | this->setCaption( tr( "Chemical Data" )); | 28 | this->setCaption( tr( "Chemical Data" )); |
34 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); | 29 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); |
35 | 30 | ||
36 | dataCombo = new QComboBox( this ); | 31 | dataCombo = new QComboBox( this ); |
37 | 32 | ||
38 | //read in all names of the 118 elements | 33 | //read in all names of the 118 elements |
39 | int i = 0; | 34 | int i = 0; |
40 | for ( QStringList::ConstIterator it = names.begin() ; it != names.end() ; ++it,i++) | 35 | for ( QStringList::ConstIterator it = names.begin() ; it != names.end() ; ++it,i++) |
41 | { | 36 | { |
42 | dataCombo->insertItem( QString::number( i+1 )+" - "+*it ); | 37 | dataCombo->insertItem( QString::number( i+1 )+" - "+*it ); |
43 | } | 38 | } |
44 | OxydataWidget *oxyDW = new OxydataWidget(this, "OxydataWidget_oxyDW", names); | 39 | OxydataWidget *oxyDW = new OxydataWidget(this, "OxydataWidget_oxyDW", names); |
45 | connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); | 40 | connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); |
46 | oxyDW->setElement( 0 ); | 41 | oxyDW->setElement( 0 ); |
47 | oxyDW->setLayout(); | 42 | oxyDW->setLayout(); |
48 | 43 | ||
49 | qgrid->addWidget( dataCombo, 0,0); | 44 | qgrid->addWidget( dataCombo, 0,0); |
50 | qgrid->addWidget( oxyDW , 1,0 ); | 45 | qgrid->addWidget( oxyDW , 1,0 ); |
51 | } | 46 | } |
52 | 47 | ||
53 | 48 | ||
diff --git a/noncore/apps/oxygen/kmolcalc.cpp b/noncore/apps/oxygen/kmolcalc.cpp index 7a47942..b9f5209 100644 --- a/noncore/apps/oxygen/kmolcalc.cpp +++ b/noncore/apps/oxygen/kmolcalc.cpp | |||
@@ -1,81 +1,78 @@ | |||
1 | /* | 1 | /* |
2 | * kmolcalc.cpp | 2 | * kmolcalc.cpp |
3 | * | 3 | * |
4 | * Copyright (C) 2000,2001 Tomislav Gountchev <tomi@idiom.com> | 4 | * Copyright (C) 2000,2001 Tomislav Gountchev <tomi@idiom.com> |
5 | * Copyright (C) 2002 Carsten Niehaus <cniehaus@handhelds.org> | 5 | * Copyright (C) 2002 Carsten Niehaus <cniehaus@handhelds.org> |
6 | */ | 6 | */ |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * KMOLCALC is the calculation engine. It knows about a hashtable of user defined atomic | 9 | * KMOLCALC is the calculation engine. It knows about a hashtable of user defined atomic |
10 | * weights and group definitions ELSTABLE, and the currently processed formula, stored | 10 | * weights and group definitions ELSTABLE, and the currently processed formula, stored |
11 | * as a list of elements and their coefficients, ELEMENTS. | 11 | * as a list of elements and their coefficients, ELEMENTS. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "kmolcalc.h" | 14 | #include "kmolcalc.h" |
15 | #include <qdict.h> | ||
16 | #include <qdir.h> | ||
17 | #include <qfile.h> | ||
18 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
19 | 16 | ||
20 | 17 | ||
21 | /** | 18 | /** |
22 | * Construct a new calculator object. | 19 | * Construct a new calculator object. |
23 | */ | 20 | */ |
24 | KMolCalc::KMolCalc() { | 21 | KMolCalc::KMolCalc() { |
25 | elements = new ElementList; | 22 | elements = new ElementList; |
26 | elstable = NULL; | 23 | elstable = NULL; |
27 | readElstable(); | 24 | readElstable(); |
28 | } | 25 | } |
29 | 26 | ||
30 | KMolCalc::~KMolCalc() { | 27 | KMolCalc::~KMolCalc() { |
31 | delete elements; | 28 | delete elements; |
32 | } | 29 | } |
33 | 30 | ||
34 | void KMolCalc::readElstable() { | 31 | void KMolCalc::readElstable() { |
35 | weight = -1; // not calculated yet | 32 | weight = -1; // not calculated yet |
36 | if (elstable) delete elstable; | 33 | if (elstable) delete elstable; |
37 | elstable = new QDict<SubUnit> (197, TRUE); | 34 | elstable = new QDict<SubUnit> (197, TRUE); |
38 | elstable->setAutoDelete(TRUE); | 35 | elstable->setAutoDelete(TRUE); |
39 | mwfile = QPEApplication::qpeDir() +"share/oxygen/kmolweights"; | 36 | mwfile = QPEApplication::qpeDir() +"share/oxygen/kmolweights"; |
40 | QFile f(mwfile); | 37 | QFile f(mwfile); |
41 | if (f.exists()) readMwfile(f); | 38 | if (f.exists()) readMwfile(f); |
42 | } | 39 | } |
43 | 40 | ||
44 | 41 | ||
45 | /** | 42 | /** |
46 | * Parse a string S and construct the ElementList this->ELEMENTS, representing the | 43 | * Parse a string S and construct the ElementList this->ELEMENTS, representing the |
47 | * composition of S. Returns 0 if successful, or an error code (currently -1) if | 44 | * composition of S. Returns 0 if successful, or an error code (currently -1) if |
48 | * parsing failed. | 45 | * parsing failed. |
49 | * The elements is S must be valid element or group symbols, as stored in this->ELSTABLE. | 46 | * The elements is S must be valid element or group symbols, as stored in this->ELSTABLE. |
50 | * See help files for correct formula syntax. | 47 | * See help files for correct formula syntax. |
51 | */ | 48 | */ |
52 | QString KMolCalc::readFormula(const QString& s) { | 49 | QString KMolCalc::readFormula(const QString& s) { |
53 | weight = -1; | 50 | weight = -1; |
54 | if (elements) delete elements; | 51 | if (elements) delete elements; |
55 | elements = new ElementList; | 52 | elements = new ElementList; |
56 | return KMolCalc::readGroup(s, elements); | 53 | return KMolCalc::readGroup(s, elements); |
57 | } | 54 | } |
58 | 55 | ||
59 | // read a formula group recursively. Called by readFormula. | 56 | // read a formula group recursively. Called by readFormula. |
60 | QString KMolCalc::readGroup(const QString& s, ElementList* els) { | 57 | QString KMolCalc::readGroup(const QString& s, ElementList* els) { |
61 | if (s.isEmpty()) return QString ("Enter a formula."); //ERROR | 58 | if (s.isEmpty()) return QString ("Enter a formula."); //ERROR |
62 | int sl = s.length(); | 59 | int sl = s.length(); |
63 | int i = 0; | 60 | int i = 0; |
64 | QString errors ("OK"); | 61 | QString errors ("OK"); |
65 | bool ok = TRUE; | 62 | bool ok = TRUE; |
66 | while (i < sl && ((s[i] <= '9' && s[i] >= '0') || s[i] == '.')) i++; | 63 | while (i < sl && ((s[i] <= '9' && s[i] >= '0') || s[i] == '.')) i++; |
67 | double prefix = (i == 0 ? 1 : s.left(i).toDouble(&ok)); | 64 | double prefix = (i == 0 ? 1 : s.left(i).toDouble(&ok)); |
68 | if (! ok || i == sl || prefix == 0) return QString ("Bad formula."); // ERROR | 65 | if (! ok || i == sl || prefix == 0) return QString ("Bad formula."); // ERROR |
69 | ElementList* elstemp = new ElementList; | 66 | ElementList* elstemp = new ElementList; |
70 | while (i < sl) { | 67 | while (i < sl) { |
71 | int j = i; | 68 | int j = i; |
72 | if (s[i] == '(') { | 69 | if (s[i] == '(') { |
73 | ElementList* inner = new ElementList; | 70 | ElementList* inner = new ElementList; |
74 | int level = 1; // count levels of nested ( ). | 71 | int level = 1; // count levels of nested ( ). |
75 | while (1) { | 72 | while (1) { |
76 | if (i++ == sl) { | 73 | if (i++ == sl) { |
77 | delete inner; | 74 | delete inner; |
78 | delete elstemp; | 75 | delete elstemp; |
79 | return QString ("Bad formula."); //ERROR | 76 | return QString ("Bad formula."); //ERROR |
80 | } | 77 | } |
81 | if (s[i] == '(') level++; | 78 | if (s[i] == '(') level++; |
diff --git a/noncore/apps/oxygen/oxyframe.cpp b/noncore/apps/oxygen/oxyframe.cpp index 5a4dbbe..8cc520e 100644 --- a/noncore/apps/oxygen/oxyframe.cpp +++ b/noncore/apps/oxygen/oxyframe.cpp | |||
@@ -1,41 +1,39 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | 2 | application: : Oxygen |
3 | 3 | ||
4 | begin : September 2002 | 4 | begin : September 2002 |
5 | copyright : ( C ) 2002 by Carsten Niehaus | 5 | copyright : ( C ) 2002 by Carsten Niehaus |
6 | email : cniehaus@handhelds.org | 6 | email : cniehaus@handhelds.org |
7 | **************************************************************************/ | 7 | **************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
15 | * * | 15 | * * |
16 | **************************************************************************/ | 16 | **************************************************************************/ |
17 | #include "oxygen.h" | ||
18 | 17 | ||
19 | #include <qpe/config.h> | ||
20 | #include "oxyframe.h" | 18 | #include "oxyframe.h" |
21 | 19 | ||
22 | OxyFrame::OxyFrame(QWidget *parent, const char *name, QString symbol ) | 20 | OxyFrame::OxyFrame(QWidget *parent, const char *name, QString symbol ) |
23 | : QLabel(parent,name) | 21 | : QLabel(parent,name) |
24 | { | 22 | { |
25 | N = name; | 23 | N = name; |
26 | this->setFrameStyle( QFrame::Box ); | 24 | this->setFrameStyle( QFrame::Box ); |
27 | this->setLineWidth( 0 ); | 25 | this->setLineWidth( 0 ); |
28 | this->setMidLineWidth( 1 ); | 26 | this->setMidLineWidth( 1 ); |
29 | this->setFrameShadow( QFrame::Sunken ); | 27 | this->setFrameShadow( QFrame::Sunken ); |
30 | setMinimumSize(6,6); | 28 | setMinimumSize(6,6); |
31 | setScaledContents( true ); | 29 | setScaledContents( true ); |
32 | QFont font; | 30 | QFont font; |
33 | font.setWeight(QFont::Light); | 31 | font.setWeight(QFont::Light); |
34 | font.setPixelSize(3); | 32 | font.setPixelSize(3); |
35 | setFont( font ); | 33 | setFont( font ); |
36 | setText( symbol ); | 34 | setText( symbol ); |
37 | } | 35 | } |
38 | 36 | ||
39 | void OxyFrame::mousePressEvent ( QMouseEvent* /*e*/ ){ | 37 | void OxyFrame::mousePressEvent ( QMouseEvent* /*e*/ ){ |
40 | emit num( N ); | 38 | emit num( N ); |
41 | }; | 39 | }; |
diff --git a/noncore/apps/oxygen/oxygen.cpp b/noncore/apps/oxygen/oxygen.cpp index 5bdc2aa..5ea97bf 100644 --- a/noncore/apps/oxygen/oxygen.cpp +++ b/noncore/apps/oxygen/oxygen.cpp | |||
@@ -1,86 +1,84 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | 2 | application: : Oxygen |
3 | 3 | ||
4 | begin : September 2002 | 4 | begin : September 2002 |
5 | copyright : ( C ) 2002 by Carsten Niehaus | 5 | copyright : ( C ) 2002 by Carsten Niehaus |
6 | email : cniehaus@handhelds.org | 6 | email : cniehaus@handhelds.org |
7 | **************************************************************************/ | 7 | **************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
15 | * * | 15 | * * |
16 | **************************************************************************/ | 16 | **************************************************************************/ |
17 | #include "oxygen.h" | 17 | #include "oxygen.h" |
18 | 18 | ||
19 | #include <qapplication.h> | ||
20 | #include <qtabwidget.h> | 19 | #include <qtabwidget.h> |
21 | 20 | ||
22 | #include "calcdlg.h" | ||
23 | #include "calcdlgui.h" | 21 | #include "calcdlgui.h" |
24 | #include "datawidgetui.h" | 22 | #include "datawidgetui.h" |
25 | #include "psewidget.h" | 23 | #include "psewidget.h" |
26 | 24 | ||
27 | 25 | ||
28 | Oxygen::Oxygen( QWidget *parent, const char *name, WFlags f) : QMainWindow( parent, name, f ) | 26 | Oxygen::Oxygen( QWidget *parent, const char *name, WFlags f) : QMainWindow( parent, name, f ) |
29 | { | 27 | { |
30 | loadNames(); | 28 | loadNames(); |
31 | calcDlgUI *CalcDlgUI = new calcDlgUI(); | 29 | calcDlgUI *CalcDlgUI = new calcDlgUI(); |
32 | PSEWidget *pse = new PSEWidget(names); | 30 | PSEWidget *pse = new PSEWidget(names); |
33 | dataWidgetUI *DataWidgetUI = new dataWidgetUI(names); | 31 | dataWidgetUI *DataWidgetUI = new dataWidgetUI(names); |
34 | 32 | ||
35 | setCaption( tr( "Oxygen" ) ); | 33 | setCaption( tr( "Oxygen" ) ); |
36 | 34 | ||
37 | QTabWidget *tabw = new QTabWidget( this , "qtab" ); | 35 | QTabWidget *tabw = new QTabWidget( this , "qtab" ); |
38 | tabw->addTab( pse, tr( "PSE" )); | 36 | tabw->addTab( pse, tr( "PSE" )); |
39 | tabw->addTab( DataWidgetUI , tr( "Data" ) ); | 37 | tabw->addTab( DataWidgetUI , tr( "Data" ) ); |
40 | tabw->addTab( CalcDlgUI, tr( "Calculations" ) ); | 38 | tabw->addTab( CalcDlgUI, tr( "Calculations" ) ); |
41 | setCentralWidget( tabw ); | 39 | setCentralWidget( tabw ); |
42 | } | 40 | } |
43 | 41 | ||
44 | void Oxygen::loadNames() | 42 | void Oxygen::loadNames() |
45 | { | 43 | { |
46 | names.clear(); | 44 | names.clear(); |
47 | names.append( tr("Hydrogen") ); | 45 | names.append( tr("Hydrogen") ); |
48 | names.append( tr("Helium") ); | 46 | names.append( tr("Helium") ); |
49 | names.append( tr("Lithium") ); | 47 | names.append( tr("Lithium") ); |
50 | names.append( tr("Beryllium") ); | 48 | names.append( tr("Beryllium") ); |
51 | names.append( tr("Boron") ); | 49 | names.append( tr("Boron") ); |
52 | names.append( tr("Carbon") ); | 50 | names.append( tr("Carbon") ); |
53 | names.append( tr("Nitrogen") ); | 51 | names.append( tr("Nitrogen") ); |
54 | names.append( tr("Oxygen") ); | 52 | names.append( tr("Oxygen") ); |
55 | names.append( tr("Fluorine") ); | 53 | names.append( tr("Fluorine") ); |
56 | names.append( tr("Neon") ); | 54 | names.append( tr("Neon") ); |
57 | names.append( tr("Sodium") ); | 55 | names.append( tr("Sodium") ); |
58 | names.append( tr("Magnesium") ); | 56 | names.append( tr("Magnesium") ); |
59 | names.append( tr("Aluminum") ); | 57 | names.append( tr("Aluminum") ); |
60 | names.append( tr("Silicon") ); | 58 | names.append( tr("Silicon") ); |
61 | names.append( tr("Phosphorus") ); | 59 | names.append( tr("Phosphorus") ); |
62 | names.append( tr("Sulfur") ); | 60 | names.append( tr("Sulfur") ); |
63 | names.append( tr("Chlorine") ); | 61 | names.append( tr("Chlorine") ); |
64 | names.append( tr("Argon") ); | 62 | names.append( tr("Argon") ); |
65 | names.append( tr("Potassium") ); | 63 | names.append( tr("Potassium") ); |
66 | names.append( tr("Calcium") ); | 64 | names.append( tr("Calcium") ); |
67 | names.append( tr("Scandium") ); | 65 | names.append( tr("Scandium") ); |
68 | names.append( tr("Titanium") ); | 66 | names.append( tr("Titanium") ); |
69 | names.append( tr("Vanadium") ); | 67 | names.append( tr("Vanadium") ); |
70 | names.append( tr("Chromium") ); | 68 | names.append( tr("Chromium") ); |
71 | names.append( tr("Manganese") ); | 69 | names.append( tr("Manganese") ); |
72 | names.append( tr("Iron") ); | 70 | names.append( tr("Iron") ); |
73 | names.append( tr("Cobalt") ); | 71 | names.append( tr("Cobalt") ); |
74 | names.append( tr("Nickel") ); | 72 | names.append( tr("Nickel") ); |
75 | names.append( tr("Copper") ); | 73 | names.append( tr("Copper") ); |
76 | names.append( tr("Zinc") ); | 74 | names.append( tr("Zinc") ); |
77 | names.append( tr("Gallium") ); | 75 | names.append( tr("Gallium") ); |
78 | names.append( tr("Germanium") ); | 76 | names.append( tr("Germanium") ); |
79 | names.append( tr("Arsenic") ); | 77 | names.append( tr("Arsenic") ); |
80 | names.append( tr("Selenium") ); | 78 | names.append( tr("Selenium") ); |
81 | names.append( tr("Bromine") ); | 79 | names.append( tr("Bromine") ); |
82 | names.append( tr("Krypton") ); | 80 | names.append( tr("Krypton") ); |
83 | names.append( tr("Rubidium") ); | 81 | names.append( tr("Rubidium") ); |
84 | names.append( tr("Strontium") ); | 82 | names.append( tr("Strontium") ); |
85 | names.append( tr("Yttrium") ); | 83 | names.append( tr("Yttrium") ); |
86 | names.append( tr("Zirconium") ); | 84 | names.append( tr("Zirconium") ); |
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp index be5185b..7f7ae0c 100644 --- a/noncore/apps/oxygen/psewidget.cpp +++ b/noncore/apps/oxygen/psewidget.cpp | |||
@@ -1,88 +1,86 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | 2 | application: : Oxygen |
3 | 3 | ||
4 | begin : September 2002 | 4 | begin : September 2002 |
5 | copyright : ( C ) 2002, 2003 by Carsten Niehaus | 5 | copyright : ( C ) 2002, 2003 by Carsten Niehaus |
6 | email : cniehaus@handhelds.org | 6 | email : cniehaus@handhelds.org |
7 | **************************************************************************/ | 7 | **************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
15 | * * | 15 | * * |
16 | **************************************************************************/ | 16 | **************************************************************************/ |
17 | 17 | ||
18 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | #include <qlayout.h> | 19 | #include <qlayout.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qlist.h> | ||
22 | #include "dataTable.h" | 21 | #include "dataTable.h" |
23 | #include "psewidget.h" | 22 | #include "psewidget.h" |
24 | #include "oxyframe.h" | ||
25 | 23 | ||
26 | 24 | ||
27 | PSEWidget::PSEWidget(const QStringList &list) : QWidget() | 25 | PSEWidget::PSEWidget(const QStringList &list) : QWidget() |
28 | { | 26 | { |
29 | this->setCaption( tr( "Periodic System" ) ); | 27 | this->setCaption( tr( "Periodic System" ) ); |
30 | 28 | ||
31 | lastElement=1; | 29 | lastElement=1; |
32 | names = list; | 30 | names = list; |
33 | 31 | ||
34 | QVBoxLayout *vlay = new QVBoxLayout( this ); | 32 | QVBoxLayout *vlay = new QVBoxLayout( this ); |
35 | 33 | ||
36 | QGridLayout *grid = new QGridLayout( 18,10 ); | 34 | QGridLayout *grid = new QGridLayout( 18,10 ); |
37 | int h=0, v=0; | 35 | int h=0, v=0; |
38 | 36 | ||
39 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); | 37 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); |
40 | for( int n = 0 ; n < 109 ; n++ ) | 38 | for( int n = 0 ; n < 109 ; n++ ) |
41 | { | 39 | { |
42 | configobj.setGroup( QString::number( n+1 )); | 40 | configobj.setGroup( QString::number( n+1 )); |
43 | 41 | ||
44 | position( n+1,h,v ); | 42 | position( n+1,h,v ); |
45 | PSEframe.append( new OxyFrame( this , QString::number(n), configobj.readEntry( "Symbol" ) ) ); | 43 | PSEframe.append( new OxyFrame( this , QString::number(n), configobj.readEntry( "Symbol" ) ) ); |
46 | grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); | 44 | grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); |
47 | PSEframe.current()->setMinimumHeight( 11 ); | 45 | PSEframe.current()->setMinimumHeight( 11 ); |
48 | PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) ); | 46 | PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) ); |
49 | connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) )); | 47 | connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) )); |
50 | connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( inverseColor(QString) )); | 48 | connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( inverseColor(QString) )); |
51 | } | 49 | } |
52 | 50 | ||
53 | oxyDW = new OxydataWidget(this, "PSEWidget_oxyDW", names); | 51 | oxyDW = new OxydataWidget(this, "PSEWidget_oxyDW", names); |
54 | oxyDW->setElement( 0 ); | 52 | oxyDW->setElement( 0 ); |
55 | oxyDW->setLayout(); | 53 | oxyDW->setLayout(); |
56 | 54 | ||
57 | vlay->addLayout( grid ); | 55 | vlay->addLayout( grid ); |
58 | vlay->addWidget( oxyDW ); | 56 | vlay->addWidget( oxyDW ); |
59 | } | 57 | } |
60 | 58 | ||
61 | QColor PSEWidget::PSEColor( QString block ) const | 59 | QColor PSEWidget::PSEColor( QString block ) const |
62 | { | 60 | { |
63 | QColor c; | 61 | QColor c; |
64 | if ( block == "s" ) c.setRgb( 213 , 233 , 231 ); | 62 | if ( block == "s" ) c.setRgb( 213 , 233 , 231 ); |
65 | else if ( block == "d" ) c.setRgb( 200,230,160 ); | 63 | else if ( block == "d" ) c.setRgb( 200,230,160 ); |
66 | else if ( block == "p" ) c.setRgb( 238,146,138 ); | 64 | else if ( block == "p" ) c.setRgb( 238,146,138 ); |
67 | else if ( block == "f" ) c.setRgb( 190 , 190 , 190 ); | 65 | else if ( block == "f" ) c.setRgb( 190 , 190 , 190 ); |
68 | return c; | 66 | return c; |
69 | }; | 67 | }; |
70 | 68 | ||
71 | void PSEWidget::inverseColor( QString number) | 69 | void PSEWidget::inverseColor( QString number) |
72 | { | 70 | { |
73 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); | 71 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); |
74 | configobj.setGroup( number ); | 72 | configobj.setGroup( number ); |
75 | QString block = configobj.readEntry( "Block" ); | 73 | QString block = configobj.readEntry( "Block" ); |
76 | QColor c, d; | 74 | QColor c, d; |
77 | c = PSEColor( block ); | 75 | c = PSEColor( block ); |
78 | d = c.dark(); | 76 | d = c.dark(); |
79 | 77 | ||
80 | PSEframe.at( number.toUInt() )->setPalette( QPalette( d ) ); | 78 | PSEframe.at( number.toUInt() )->setPalette( QPalette( d ) ); |
81 | 79 | ||
82 | configobj.setGroup( QString::number( lastElement+1 ) ); | 80 | configobj.setGroup( QString::number( lastElement+1 ) ); |
83 | block = configobj.readEntry( "Block" ); | 81 | block = configobj.readEntry( "Block" ); |
84 | c = PSEColor( block ); | 82 | c = PSEColor( block ); |
85 | PSEframe.at( lastElement )->setPalette( QPalette( c ) ); | 83 | PSEframe.at( lastElement )->setPalette( QPalette( c ) ); |
86 | 84 | ||
87 | lastElement=number.toInt(); | 85 | lastElement=number.toInt(); |
88 | } | 86 | } |
diff --git a/noncore/apps/qashmoney/account.cpp b/noncore/apps/qashmoney/account.cpp index 181be23..f21598e 100755 --- a/noncore/apps/qashmoney/account.cpp +++ b/noncore/apps/qashmoney/account.cpp | |||
@@ -1,67 +1,65 @@ | |||
1 | #include "account.h" | 1 | #include "account.h" |
2 | #include "transaction.h" | ||
3 | #include "transfer.h" | ||
4 | #include "preferences.h" | 2 | #include "preferences.h" |
5 | 3 | ||
6 | #include <qpixmap.h> | 4 | #include <qpixmap.h> |
7 | #include <stdlib.h> | 5 | #include <stdlib.h> |
8 | 6 | ||
9 | extern Preferences *preferences; | 7 | extern Preferences *preferences; |
10 | 8 | ||
11 | Account::Account () | 9 | Account::Account () |
12 | { | 10 | { |
13 | adb = sqlite_open ( "qmaccounts.db", 0, NULL ); | 11 | adb = sqlite_open ( "qmaccounts.db", 0, NULL ); |
14 | } | 12 | } |
15 | 13 | ||
16 | Account::~Account () | 14 | Account::~Account () |
17 | { | 15 | { |
18 | sqlite_close ( adb ); | 16 | sqlite_close ( adb ); |
19 | } | 17 | } |
20 | 18 | ||
21 | void Account::addAccount ( QString name, int parentid, float balance, int type, QString description, float creditlimit, | 19 | void Account::addAccount ( QString name, int parentid, float balance, int type, QString description, float creditlimit, |
22 | int statementyear, int statementmonth, int statementday, float statementbalance, const char *currency ) | 20 | int statementyear, int statementmonth, int statementday, float statementbalance, const char *currency ) |
23 | { | 21 | { |
24 | sqlite_exec_printf ( adb, "insert into accounts2 values ( '%q', %i, %.2f, %i, '%q', %.2f, %i, %i, %i, %.2f, '%q', 0, 0, 0, 0, 0, NULL );", 0, 0, 0, | 22 | sqlite_exec_printf ( adb, "insert into accounts2 values ( '%q', %i, %.2f, %i, '%q', %.2f, %i, %i, %i, %.2f, '%q', 0, 0, 0, 0, 0, NULL );", 0, 0, 0, |
25 | (const char *) name, parentid, balance, type, (const char *) description, creditlimit, statementyear, statementmonth, statementday, statementbalance, currency ); | 23 | (const char *) name, parentid, balance, type, (const char *) description, creditlimit, statementyear, statementmonth, statementday, statementbalance, currency ); |
26 | } | 24 | } |
27 | 25 | ||
28 | void Account::updateAccount ( QString name, QString description, QString currencycode, int accountid ) | 26 | void Account::updateAccount ( QString name, QString description, QString currencycode, int accountid ) |
29 | { | 27 | { |
30 | sqlite_exec_printf ( adb, "update accounts2 set name = '%q', description = '%q', currency = '%q' where accountid = %i;", 0, 0, 0, ( const char * ) name, ( const char * ) description, ( const char * ) currencycode, accountid ); | 28 | sqlite_exec_printf ( adb, "update accounts2 set name = '%q', description = '%q', currency = '%q' where accountid = %i;", 0, 0, 0, ( const char * ) name, ( const char * ) description, ( const char * ) currencycode, accountid ); |
31 | } | 29 | } |
32 | 30 | ||
33 | void Account::deleteAccount ( int accountid ) | 31 | void Account::deleteAccount ( int accountid ) |
34 | { | 32 | { |
35 | sqlite_exec_printf ( adb, "delete from accounts2 where accountid = %i;", 0, 0, 0, accountid ); | 33 | sqlite_exec_printf ( adb, "delete from accounts2 where accountid = %i;", 0, 0, 0, accountid ); |
36 | } | 34 | } |
37 | 35 | ||
38 | void Account::setAccountExpanded ( int expanded, int accountid ) | 36 | void Account::setAccountExpanded ( int expanded, int accountid ) |
39 | { | 37 | { |
40 | sqlite_exec_printf ( adb, "update accounts2 set r1 = %i where accountid = %i;", 0, 0, 0, expanded, accountid ); | 38 | sqlite_exec_printf ( adb, "update accounts2 set r1 = %i where accountid = %i;", 0, 0, 0, expanded, accountid ); |
41 | } | 39 | } |
42 | 40 | ||
43 | int Account::getAccountExpanded ( int id ) | 41 | int Account::getAccountExpanded ( int id ) |
44 | { | 42 | { |
45 | char **results; | 43 | char **results; |
46 | sqlite_get_table_printf ( adb, "select r1 from accounts2 where accountid = %i;", &results, 0, 0, 0, id ); | 44 | sqlite_get_table_printf ( adb, "select r1 from accounts2 where accountid = %i;", &results, 0, 0, 0, id ); |
47 | if ( strlen ( results [1] ) == 0 ) | 45 | if ( strlen ( results [1] ) == 0 ) |
48 | return 0; | 46 | return 0; |
49 | else | 47 | else |
50 | return atoi ( results [ 1 ] ); | 48 | return atoi ( results [ 1 ] ); |
51 | } | 49 | } |
52 | 50 | ||
53 | int Account::getNumberOfAccounts () | 51 | int Account::getNumberOfAccounts () |
54 | { | 52 | { |
55 | char **results; | 53 | char **results; |
56 | sqlite_get_table ( adb, "select count() from accounts2;", &results, NULL, NULL, NULL ); | 54 | sqlite_get_table ( adb, "select count() from accounts2;", &results, NULL, NULL, NULL ); |
57 | return atoi ( results [ 1 ] ); | 55 | return atoi ( results [ 1 ] ); |
58 | } | 56 | } |
59 | 57 | ||
60 | int Account::getNumberOfChildAccounts ( int id ) | 58 | int Account::getNumberOfChildAccounts ( int id ) |
61 | { | 59 | { |
62 | char **results; | 60 | char **results; |
63 | sqlite_get_table_printf ( adb, "select count() from accounts2 where parent = %i;", &results, NULL, NULL, NULL, id ); | 61 | sqlite_get_table_printf ( adb, "select count() from accounts2 where parent = %i;", &results, NULL, NULL, NULL, id ); |
64 | return atoi ( results [ 1 ] ); | 62 | return atoi ( results [ 1 ] ); |
65 | } | 63 | } |
66 | 64 | ||
67 | void Account::updateAccountBalance ( int accountid ) | 65 | void Account::updateAccountBalance ( int accountid ) |
diff --git a/noncore/apps/qashmoney/accountdisplay.cpp b/noncore/apps/qashmoney/accountdisplay.cpp index d0ba82a..5ef5454 100755 --- a/noncore/apps/qashmoney/accountdisplay.cpp +++ b/noncore/apps/qashmoney/accountdisplay.cpp | |||
@@ -1,73 +1,71 @@ | |||
1 | #include <qdatetime.h> | ||
2 | #include <qmessagebox.h> | 1 | #include <qmessagebox.h> |
3 | #include <qheader.h> | 2 | #include <qheader.h> |
4 | 3 | ||
5 | #include "accountdisplay.h" | 4 | #include "accountdisplay.h" |
6 | #include "newaccount.h" | 5 | #include "newaccount.h" |
7 | #include "transaction.h" | 6 | #include "transaction.h" |
8 | #include "transferdialog.h" | 7 | #include "transferdialog.h" |
9 | #include "preferences.h" | ||
10 | #include "transfer.h" | 8 | #include "transfer.h" |
11 | 9 | ||
12 | extern Account *account; | 10 | extern Account *account; |
13 | extern Transaction *transaction; | 11 | extern Transaction *transaction; |
14 | extern Transfer *transfer; | 12 | extern Transfer *transfer; |
15 | extern Preferences *preferences; | 13 | extern Preferences *preferences; |
16 | 14 | ||
17 | AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent ) | 15 | AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent ) |
18 | { | 16 | { |
19 | cleared = 0; | 17 | cleared = 0; |
20 | 18 | ||
21 | firstline = new QHBox ( this ); | 19 | firstline = new QHBox ( this ); |
22 | firstline->setSpacing ( 2 ); | 20 | firstline->setSpacing ( 2 ); |
23 | 21 | ||
24 | newaccount = new QPushButton ( firstline ); | 22 | newaccount = new QPushButton ( firstline ); |
25 | newaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") ); | 23 | newaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") ); |
26 | connect ( newaccount, SIGNAL ( released () ), this, SLOT ( addAccount () ) ); | 24 | connect ( newaccount, SIGNAL ( released () ), this, SLOT ( addAccount () ) ); |
27 | 25 | ||
28 | editaccount = new QPushButton ( firstline ); | 26 | editaccount = new QPushButton ( firstline ); |
29 | editaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); | 27 | editaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); |
30 | connect ( editaccount, SIGNAL ( released () ), this, SLOT ( editAccount () ) ); | 28 | connect ( editaccount, SIGNAL ( released () ), this, SLOT ( editAccount () ) ); |
31 | 29 | ||
32 | deleteaccount = new QPushButton ( firstline ); | 30 | deleteaccount = new QPushButton ( firstline ); |
33 | deleteaccount->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") ); | 31 | deleteaccount->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") ); |
34 | connect ( deleteaccount, SIGNAL ( released () ), this, SLOT ( deleteAccount () ) ); | 32 | connect ( deleteaccount, SIGNAL ( released () ), this, SLOT ( deleteAccount () ) ); |
35 | 33 | ||
36 | transferbutton = new QPushButton ( firstline ); | 34 | transferbutton = new QPushButton ( firstline ); |
37 | transferbutton->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/transfer.png") ); | 35 | transferbutton->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/transfer.png") ); |
38 | transferbutton->setToggleButton ( TRUE ); | 36 | transferbutton->setToggleButton ( TRUE ); |
39 | connect ( transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( accountTransfer ( bool ) ) ); | 37 | connect ( transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( accountTransfer ( bool ) ) ); |
40 | 38 | ||
41 | listview = new QListView ( this ); | 39 | listview = new QListView ( this ); |
42 | listview->setAllColumnsShowFocus ( TRUE ); | 40 | listview->setAllColumnsShowFocus ( TRUE ); |
43 | listview->setShowSortIndicator ( TRUE ); | 41 | listview->setShowSortIndicator ( TRUE ); |
44 | listview->setRootIsDecorated ( TRUE ); | 42 | listview->setRootIsDecorated ( TRUE ); |
45 | listview->setMultiSelection ( FALSE ); | 43 | listview->setMultiSelection ( FALSE ); |
46 | connect ( listview, SIGNAL ( expanded ( QListViewItem * ) ), this, SLOT ( setAccountExpanded ( QListViewItem * ) ) ); | 44 | connect ( listview, SIGNAL ( expanded ( QListViewItem * ) ), this, SLOT ( setAccountExpanded ( QListViewItem * ) ) ); |
47 | connect ( listview, SIGNAL ( collapsed ( QListViewItem * ) ), this, SLOT ( setAccountCollapsed ( QListViewItem * ) ) ); | 45 | connect ( listview, SIGNAL ( collapsed ( QListViewItem * ) ), this, SLOT ( setAccountCollapsed ( QListViewItem * ) ) ); |
48 | 46 | ||
49 | listview->header()->setTracking ( FALSE ); | 47 | listview->header()->setTracking ( FALSE ); |
50 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); | 48 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); |
51 | connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); | 49 | connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); |
52 | 50 | ||
53 | layout = new QVBoxLayout ( this, 2, 5 ); | 51 | layout = new QVBoxLayout ( this, 2, 5 ); |
54 | layout->addWidget ( firstline ); | 52 | layout->addWidget ( firstline ); |
55 | layout->addWidget ( listview ); | 53 | layout->addWidget ( listview ); |
56 | } | 54 | } |
57 | 55 | ||
58 | void AccountDisplay::setTabs ( QWidget *newtab2, QTabWidget *newtabs ) | 56 | void AccountDisplay::setTabs ( QWidget *newtab2, QTabWidget *newtabs ) |
59 | { | 57 | { |
60 | tab2 = newtab2; | 58 | tab2 = newtab2; |
61 | maintabs = newtabs; | 59 | maintabs = newtabs; |
62 | } | 60 | } |
63 | 61 | ||
64 | void AccountDisplay::addAccount () | 62 | void AccountDisplay::addAccount () |
65 | { | 63 | { |
66 | // initialize local variables | 64 | // initialize local variables |
67 | int parentid = 0; | 65 | int parentid = 0; |
68 | type = 0; | 66 | type = 0; |
69 | QString parentlist [ listview->childCount() + 1 ] [ 3 ] ; | 67 | QString parentlist [ listview->childCount() + 1 ] [ 3 ] ; |
70 | 68 | ||
71 | // create new account window for entering data | 69 | // create new account window for entering data |
72 | NewAccount *newaccount = new NewAccount ( this ); | 70 | NewAccount *newaccount = new NewAccount ( this ); |
73 | int width = this->width(); | 71 | int width = this->width(); |
diff --git a/noncore/apps/qashmoney/budgetdisplay.cpp b/noncore/apps/qashmoney/budgetdisplay.cpp index 492595a..d4047bf 100755 --- a/noncore/apps/qashmoney/budgetdisplay.cpp +++ b/noncore/apps/qashmoney/budgetdisplay.cpp | |||
@@ -1,74 +1,71 @@ | |||
1 | #include <qmessagebox.h> | 1 | #include <qmessagebox.h> |
2 | #include <qheader.h> | 2 | #include <qheader.h> |
3 | #include <qfont.h> | ||
4 | #include <sqlite.h> | 3 | #include <sqlite.h> |
5 | 4 | ||
6 | #include "budgetdisplay.h" | 5 | #include "budgetdisplay.h" |
7 | #include "budget.h" | 6 | #include "budget.h" |
8 | #include "newaccount.h" | ||
9 | #include "datepicker.h" | 7 | #include "datepicker.h" |
10 | #include "preferences.h" | ||
11 | #include "transaction.h" | 8 | #include "transaction.h" |
12 | 9 | ||
13 | extern Preferences *preferences; | 10 | extern Preferences *preferences; |
14 | extern Budget *budget; | 11 | extern Budget *budget; |
15 | extern Transaction *transaction; | 12 | extern Transaction *transaction; |
16 | 13 | ||
17 | BudgetDisplay::BudgetDisplay ( QWidget *parent ) : QWidget ( parent ) | 14 | BudgetDisplay::BudgetDisplay ( QWidget *parent ) : QWidget ( parent ) |
18 | { | 15 | { |
19 | QFont font = this->font(); | 16 | QFont font = this->font(); |
20 | font.setWeight ( QFont::Bold ); | 17 | font.setWeight ( QFont::Bold ); |
21 | 18 | ||
22 | //set the default date to today | 19 | //set the default date to today |
23 | newDate = QDate::currentDate (); | 20 | newDate = QDate::currentDate (); |
24 | year = newDate.year(); | 21 | year = newDate.year(); |
25 | month = newDate.month(); | 22 | month = newDate.month(); |
26 | day = newDate.day(); | 23 | day = newDate.day(); |
27 | datelabel = preferences->getDate ( year, month ); | 24 | datelabel = preferences->getDate ( year, month ); |
28 | 25 | ||
29 | setCaption ( "Budget" ); | 26 | setCaption ( "Budget" ); |
30 | 27 | ||
31 | firstline = new QHBox ( this ); | 28 | firstline = new QHBox ( this ); |
32 | firstline->setSpacing ( 2 ); | 29 | firstline->setSpacing ( 2 ); |
33 | secondline = new QHBox ( this ); | 30 | secondline = new QHBox ( this ); |
34 | secondline->setSpacing ( 10 ); | 31 | secondline->setSpacing ( 10 ); |
35 | 32 | ||
36 | menu = new QMenuBar ( this ); | 33 | menu = new QMenuBar ( this ); |
37 | menu->setFrameStyle ( QFrame::Box | QFrame::Sunken ); | 34 | menu->setFrameStyle ( QFrame::Box | QFrame::Sunken ); |
38 | budgetmenu = new QPopupMenu ( this ); | 35 | budgetmenu = new QPopupMenu ( this ); |
39 | lineitemsmenu = new QPopupMenu ( this ); | 36 | lineitemsmenu = new QPopupMenu ( this ); |
40 | datemenu = new QPopupMenu ( this ); | 37 | datemenu = new QPopupMenu ( this ); |
41 | menu->insertItem ( "Budget", budgetmenu ); | 38 | menu->insertItem ( "Budget", budgetmenu ); |
42 | menu->insertItem ( "Line Item", lineitemsmenu ); | 39 | menu->insertItem ( "Line Item", lineitemsmenu ); |
43 | menu->insertItem ( "Date", datemenu ); | 40 | menu->insertItem ( "Date", datemenu ); |
44 | budgetmenu->insertItem ( "New", this, SLOT ( newBudget () ), 0, 1 ); | 41 | budgetmenu->insertItem ( "New", this, SLOT ( newBudget () ), 0, 1 ); |
45 | budgetmenu->insertItem ( "Edit", this, SLOT ( editBudget () ), 0, 2 ); | 42 | budgetmenu->insertItem ( "Edit", this, SLOT ( editBudget () ), 0, 2 ); |
46 | budgetmenu->insertItem ( "Delete", this, SLOT ( deleteBudget () ), 0, 3 ); | 43 | budgetmenu->insertItem ( "Delete", this, SLOT ( deleteBudget () ), 0, 3 ); |
47 | lineitemsmenu->insertItem ( "New", this, SLOT ( newLineItem () ), 0, 1 ); | 44 | lineitemsmenu->insertItem ( "New", this, SLOT ( newLineItem () ), 0, 1 ); |
48 | lineitemsmenu->insertItem ( "Edit", this, SLOT ( editLineItem () ), 0, 2 ); | 45 | lineitemsmenu->insertItem ( "Edit", this, SLOT ( editLineItem () ), 0, 2 ); |
49 | lineitemsmenu->insertItem ( "Delete", this, SLOT ( deleteLineItem () ), 0, 3 ); | 46 | lineitemsmenu->insertItem ( "Delete", this, SLOT ( deleteLineItem () ), 0, 3 ); |
50 | datemenu->insertItem ( "Change", this, SLOT ( showCalendar() ) ); | 47 | datemenu->insertItem ( "Change", this, SLOT ( showCalendar() ) ); |
51 | 48 | ||
52 | budgetbox = new QComboBox ( firstline ); | 49 | budgetbox = new QComboBox ( firstline ); |
53 | connect ( budgetbox, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentBudget ( int ) ) ); | 50 | connect ( budgetbox, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentBudget ( int ) ) ); |
54 | 51 | ||
55 | budgetview = new QComboBox ( firstline ); | 52 | budgetview = new QComboBox ( firstline ); |
56 | budgetview->insertItem ( "Month" ); | 53 | budgetview->insertItem ( "Month" ); |
57 | budgetview->insertItem ( "Year" ); | 54 | budgetview->insertItem ( "Year" ); |
58 | connect ( budgetview, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentView ( int ) ) ); | 55 | connect ( budgetview, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentView ( int ) ) ); |
59 | 56 | ||
60 | budgeted = new QLabel ( secondline ); | 57 | budgeted = new QLabel ( secondline ); |
61 | budgeted->setFont ( font ); | 58 | budgeted->setFont ( font ); |
62 | actual = new QLabel ( secondline ); | 59 | actual = new QLabel ( secondline ); |
63 | actual->setFont ( font ); | 60 | actual->setFont ( font ); |
64 | date = new QLabel ( secondline ); | 61 | date = new QLabel ( secondline ); |
65 | date->setFont ( font ); | 62 | date->setFont ( font ); |
66 | 63 | ||
67 | listview = new QListView ( this ); | 64 | listview = new QListView ( this ); |
68 | listview->setAllColumnsShowFocus ( TRUE ); | 65 | listview->setAllColumnsShowFocus ( TRUE ); |
69 | listview->setShowSortIndicator ( TRUE ); | 66 | listview->setShowSortIndicator ( TRUE ); |
70 | listview->setRootIsDecorated ( TRUE ); | 67 | listview->setRootIsDecorated ( TRUE ); |
71 | listview->setMultiSelection ( FALSE ); | 68 | listview->setMultiSelection ( FALSE ); |
72 | listview->addColumn ( "Line Item", preferences->getColumnPreference ( 13 ) ); // column id 13 | 69 | listview->addColumn ( "Line Item", preferences->getColumnPreference ( 13 ) ); // column id 13 |
73 | listview->addColumn ( "Budget", preferences->getColumnPreference ( 14 ) ); // column id 14 | 70 | listview->addColumn ( "Budget", preferences->getColumnPreference ( 14 ) ); // column id 14 |
74 | listview->addColumn ( "Actual", preferences->getColumnPreference ( 15 ) ); // column id 15 | 71 | listview->addColumn ( "Actual", preferences->getColumnPreference ( 15 ) ); // column id 15 |
diff --git a/noncore/apps/qashmoney/newaccount.cpp b/noncore/apps/qashmoney/newaccount.cpp index 2ad8f60..7e57a18 100755 --- a/noncore/apps/qashmoney/newaccount.cpp +++ b/noncore/apps/qashmoney/newaccount.cpp | |||
@@ -1,70 +1,67 @@ | |||
1 | #include "newaccount.h" | 1 | #include "newaccount.h" |
2 | #include "calculator.h" | 2 | #include "calculator.h" |
3 | #include "datepicker.h" | 3 | #include "datepicker.h" |
4 | #include "transaction.h" | ||
5 | #include "preferences.h" | ||
6 | #include <qdatetime.h> | ||
7 | #include <qmultilineedit.h> | 4 | #include <qmultilineedit.h> |
8 | 5 | ||
9 | extern Preferences *preferences; | 6 | extern Preferences *preferences; |
10 | 7 | ||
11 | NewAccount::NewAccount ( QWidget *parent, const char *name, bool modal ) : QDialog ( parent, name, modal ) | 8 | NewAccount::NewAccount ( QWidget *parent, const char *name, bool modal ) : QDialog ( parent, name, modal ) |
12 | { | 9 | { |
13 | accountdescription = ""; | 10 | accountdescription = ""; |
14 | dateedited = FALSE; | 11 | dateedited = FALSE; |
15 | setCaption( tr( "Account" ) ); | 12 | setCaption( tr( "Account" ) ); |
16 | 13 | ||
17 | namelabel = new QLabel ( "Account Name", this ); | 14 | namelabel = new QLabel ( "Account Name", this ); |
18 | 15 | ||
19 | accountbox = new QHBox ( this ); | 16 | accountbox = new QHBox ( this ); |
20 | accountname = new QLineEdit ( accountbox ); | 17 | accountname = new QLineEdit ( accountbox ); |
21 | descriptionbutton = new QPushButton ( accountbox ); | 18 | descriptionbutton = new QPushButton ( accountbox ); |
22 | descriptionbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/info.png" ) ); | 19 | descriptionbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/info.png" ) ); |
23 | 20 | ||
24 | datelabel = new QLabel ( "Date", this ); | 21 | datelabel = new QLabel ( "Date", this ); |
25 | 22 | ||
26 | datebox = new QHBox ( this ); | 23 | datebox = new QHBox ( this ); |
27 | startdate = new QLineEdit ( datebox ); | 24 | startdate = new QLineEdit ( datebox ); |
28 | startdate->setDisabled ( TRUE ); | 25 | startdate->setDisabled ( TRUE ); |
29 | datebutton = new QPushButton ( datebox ); | 26 | datebutton = new QPushButton ( datebox ); |
30 | datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); | 27 | datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); |
31 | 28 | ||
32 | childcheckbox = new QCheckBox ( this ); | 29 | childcheckbox = new QCheckBox ( this ); |
33 | childcheckbox->setText( tr ( "Child Account" ) ); | 30 | childcheckbox->setText( tr ( "Child Account" ) ); |
34 | 31 | ||
35 | childlabel = new QLabel ( "Child of", this ); | 32 | childlabel = new QLabel ( "Child of", this ); |
36 | childbox = new QComboBox ( FALSE, this ); | 33 | childbox = new QComboBox ( FALSE, this ); |
37 | hideChildPulldownMenu (); | 34 | hideChildPulldownMenu (); |
38 | 35 | ||
39 | balancelabel = new QLabel ( "Balance", this ); | 36 | balancelabel = new QLabel ( "Balance", this ); |
40 | 37 | ||
41 | balancebox = new QHBox ( this ); | 38 | balancebox = new QHBox ( this ); |
42 | accountbalance = new QLineEdit ( balancebox ); | 39 | accountbalance = new QLineEdit ( balancebox ); |
43 | accountbalance->setText ( "0.00" ); | 40 | accountbalance->setText ( "0.00" ); |
44 | balancecalculator = new QPushButton( balancebox ); | 41 | balancecalculator = new QPushButton( balancebox ); |
45 | balancecalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); | 42 | balancecalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); |
46 | 43 | ||
47 | creditlimitlabel = new QLabel ( "Credit Limit", this ); | 44 | creditlimitlabel = new QLabel ( "Credit Limit", this ); |
48 | 45 | ||
49 | creditlimitbox = new QHBox ( this ); | 46 | creditlimitbox = new QHBox ( this ); |
50 | creditlimit = new QLineEdit ( creditlimitbox ); | 47 | creditlimit = new QLineEdit ( creditlimitbox ); |
51 | creditlimitbox->setEnabled ( FALSE ); | 48 | creditlimitbox->setEnabled ( FALSE ); |
52 | creditlimitcalculator = new QPushButton( creditlimitbox ); | 49 | creditlimitcalculator = new QPushButton( creditlimitbox ); |
53 | creditlimitcalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); | 50 | creditlimitcalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); |
54 | 51 | ||
55 | currencybox = new Currency ( this ); | 52 | currencybox = new Currency ( this ); |
56 | 53 | ||
57 | typelabel = new QLabel ( "Type", this ); | 54 | typelabel = new QLabel ( "Type", this ); |
58 | accounttype = new QComboBox ( FALSE, this ); | 55 | accounttype = new QComboBox ( FALSE, this ); |
59 | accounttype->insertItem( tr( "Bank" ) ); | 56 | accounttype->insertItem( tr( "Bank" ) ); |
60 | accounttype->insertItem( tr( "Cash" ) ); | 57 | accounttype->insertItem( tr( "Cash" ) ); |
61 | accounttype->insertItem( tr( "Credit Card" ) ); | 58 | accounttype->insertItem( tr( "Credit Card" ) ); |
62 | accounttype->insertItem( tr( "Equity" ) ); | 59 | accounttype->insertItem( tr( "Equity" ) ); |
63 | accounttype->insertItem( tr( "Asset" ) ); | 60 | accounttype->insertItem( tr( "Asset" ) ); |
64 | accounttype->insertItem( tr( "Liability" ) ); | 61 | accounttype->insertItem( tr( "Liability" ) ); |
65 | 62 | ||
66 | layout = new QGridLayout ( this, 7, 2, 4, 2 ); | 63 | layout = new QGridLayout ( this, 7, 2, 4, 2 ); |
67 | layout->addWidget ( namelabel , 0, 0, Qt::AlignLeft ); | 64 | layout->addWidget ( namelabel , 0, 0, Qt::AlignLeft ); |
68 | layout->addWidget ( accountbox, 1, 0, Qt::AlignLeft ); | 65 | layout->addWidget ( accountbox, 1, 0, Qt::AlignLeft ); |
69 | layout->addWidget ( datelabel, 2, 0, Qt::AlignLeft ); | 66 | layout->addWidget ( datelabel, 2, 0, Qt::AlignLeft ); |
70 | layout->addWidget ( datebox, 3, 0, Qt::AlignLeft ); | 67 | layout->addWidget ( datebox, 3, 0, Qt::AlignLeft ); |
diff --git a/noncore/apps/qashmoney/newtransaction.cpp b/noncore/apps/qashmoney/newtransaction.cpp index 630a8b8..5c78139 100755 --- a/noncore/apps/qashmoney/newtransaction.cpp +++ b/noncore/apps/qashmoney/newtransaction.cpp | |||
@@ -1,71 +1,69 @@ | |||
1 | #include "newtransaction.h" | 1 | #include "newtransaction.h" |
2 | #include "calculator.h" | 2 | #include "calculator.h" |
3 | #include "datepicker.h" | 3 | #include "datepicker.h" |
4 | #include "memory.h" | ||
5 | #include "budget.h" | 4 | #include "budget.h" |
6 | 5 | ||
7 | #include <qdatetime.h> | ||
8 | #include <qmultilineedit.h> | 6 | #include <qmultilineedit.h> |
9 | 7 | ||
10 | extern Budget *budget; | 8 | extern Budget *budget; |
11 | extern Preferences *preferences; | 9 | extern Preferences *preferences; |
12 | 10 | ||
13 | NewTransaction::NewTransaction ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) | 11 | NewTransaction::NewTransaction ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) |
14 | { | 12 | { |
15 | transactiondescription = ""; | 13 | transactiondescription = ""; |
16 | currentlineitem = -1; | 14 | currentlineitem = -1; |
17 | currentbudget = -1; | 15 | currentbudget = -1; |
18 | dateedited = FALSE; | 16 | dateedited = FALSE; |
19 | setCaption( tr( "Transaction" ) ); | 17 | setCaption( tr( "Transaction" ) ); |
20 | 18 | ||
21 | // START FIRST COLUMN | 19 | // START FIRST COLUMN |
22 | 20 | ||
23 | namelabel = new QLabel ( "Transaction", this ); | 21 | namelabel = new QLabel ( "Transaction", this ); |
24 | 22 | ||
25 | transactionnamebox = new QHBox ( this ); | 23 | transactionnamebox = new QHBox ( this ); |
26 | transactionname = new QComboBox ( transactionnamebox ); | 24 | transactionname = new QComboBox ( transactionnamebox ); |
27 | transactionname->setEditable ( TRUE ); | 25 | transactionname->setEditable ( TRUE ); |
28 | descriptionbutton = new QPushButton ( transactionnamebox ); | 26 | descriptionbutton = new QPushButton ( transactionnamebox ); |
29 | descriptionbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/info.png" ) ); | 27 | descriptionbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/info.png" ) ); |
30 | connect ( descriptionbutton, SIGNAL ( released () ), this, SLOT ( addTransactionDescription() ) ); | 28 | connect ( descriptionbutton, SIGNAL ( released () ), this, SLOT ( addTransactionDescription() ) ); |
31 | 29 | ||
32 | amountlabel = new QLabel ( "Amount", this ); | 30 | amountlabel = new QLabel ( "Amount", this ); |
33 | 31 | ||
34 | transactionamountbox = new QHBox ( this ); | 32 | transactionamountbox = new QHBox ( this ); |
35 | transactionamount = new QLineEdit ( transactionamountbox ); | 33 | transactionamount = new QLineEdit ( transactionamountbox ); |
36 | transactionamount->setAlignment ( Qt::AlignRight ); | 34 | transactionamount->setAlignment ( Qt::AlignRight ); |
37 | transactionamount->setText ( "0.00" ); | 35 | transactionamount->setText ( "0.00" ); |
38 | calculatorbutton = new QPushButton( transactionamountbox ); | 36 | calculatorbutton = new QPushButton( transactionamountbox ); |
39 | calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); | 37 | calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); |
40 | connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); | 38 | connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); |
41 | 39 | ||
42 | datelabel = new QLabel ( "Date", this ); | 40 | datelabel = new QLabel ( "Date", this ); |
43 | 41 | ||
44 | transactiondatebox = new QHBox ( this ); | 42 | transactiondatebox = new QHBox ( this ); |
45 | transactiondate = new QLineEdit ( transactiondatebox ); | 43 | transactiondate = new QLineEdit ( transactiondatebox ); |
46 | transactiondate->setAlignment ( Qt::AlignRight ); | 44 | transactiondate->setAlignment ( Qt::AlignRight ); |
47 | transactiondate->setDisabled ( TRUE ); | 45 | transactiondate->setDisabled ( TRUE ); |
48 | datebutton = new QPushButton( transactiondatebox ); | 46 | datebutton = new QPushButton( transactiondatebox ); |
49 | datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); | 47 | datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); |
50 | connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); | 48 | connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); |
51 | 49 | ||
52 | clearedcheckbox = new QCheckBox ( "Cleared", this ); | 50 | clearedcheckbox = new QCheckBox ( "Cleared", this ); |
53 | depositbox = new QCheckBox ( "Credit", this ); | 51 | depositbox = new QCheckBox ( "Credit", this ); |
54 | 52 | ||
55 | // START SECOND COLUMN | 53 | // START SECOND COLUMN |
56 | 54 | ||
57 | numberlabel = new QLabel ( "Number", this ); | 55 | numberlabel = new QLabel ( "Number", this ); |
58 | transactionnumber = new QLineEdit ( this ); | 56 | transactionnumber = new QLineEdit ( this ); |
59 | 57 | ||
60 | budgetlabel = new QLabel ( "Budget", this ); | 58 | budgetlabel = new QLabel ( "Budget", this ); |
61 | budgetbox = new QComboBox ( FALSE, this ); | 59 | budgetbox = new QComboBox ( FALSE, this ); |
62 | 60 | ||
63 | lineitemlabel = new QLabel ( "LineItem", this ); | 61 | lineitemlabel = new QLabel ( "LineItem", this ); |
64 | lineitembox = new QComboBox ( FALSE, this ); | 62 | lineitembox = new QComboBox ( FALSE, this ); |
65 | 63 | ||
66 | layout = new QGridLayout ( this, 7, 2, 2, 2 ); | 64 | layout = new QGridLayout ( this, 7, 2, 2, 2 ); |
67 | layout->addWidget ( namelabel, 0, 0, Qt::AlignLeft ); | 65 | layout->addWidget ( namelabel, 0, 0, Qt::AlignLeft ); |
68 | layout->addWidget ( transactionnamebox, 1, 0, Qt::AlignLeft ); | 66 | layout->addWidget ( transactionnamebox, 1, 0, Qt::AlignLeft ); |
69 | layout->addWidget ( amountlabel, 2, 0, Qt::AlignLeft ); | 67 | layout->addWidget ( amountlabel, 2, 0, Qt::AlignLeft ); |
70 | layout->addWidget ( transactionamountbox, 3, 0, Qt::AlignLeft ); | 68 | layout->addWidget ( transactionamountbox, 3, 0, Qt::AlignLeft ); |
71 | layout->addWidget ( datelabel, 4, 0, Qt::AlignLeft ); | 69 | layout->addWidget ( datelabel, 4, 0, Qt::AlignLeft ); |
diff --git a/noncore/apps/qashmoney/preferencedialogs.cpp b/noncore/apps/qashmoney/preferencedialogs.cpp index d7c66d3..5408a5b 100755 --- a/noncore/apps/qashmoney/preferencedialogs.cpp +++ b/noncore/apps/qashmoney/preferencedialogs.cpp | |||
@@ -1,67 +1,66 @@ | |||
1 | #include "preferencedialogs.h" | 1 | #include "preferencedialogs.h" |
2 | #include "preferences.h" | 2 | #include "preferences.h" |
3 | #include <qlabel.h> | ||
4 | 3 | ||
5 | extern Preferences *preferences; | 4 | extern Preferences *preferences; |
6 | 5 | ||
7 | DatePreferences::DatePreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) | 6 | DatePreferences::DatePreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) |
8 | { | 7 | { |
9 | setCaption( tr( "Date" ) ); | 8 | setCaption( tr( "Date" ) ); |
10 | 9 | ||
11 | QLabel *datelabel = new QLabel ( "Format", this ); | 10 | QLabel *datelabel = new QLabel ( "Format", this ); |
12 | dateformat = new QComboBox ( this ); | 11 | dateformat = new QComboBox ( this ); |
13 | dateformat->setEditable ( FALSE ); | 12 | dateformat->setEditable ( FALSE ); |
14 | dateformat->insertItem ( "yyyymmdd" ); | 13 | dateformat->insertItem ( "yyyymmdd" ); |
15 | dateformat->insertItem ( "yymmdd" ); | 14 | dateformat->insertItem ( "yymmdd" ); |
16 | dateformat->insertItem ( "mmddyyyy" ); | 15 | dateformat->insertItem ( "mmddyyyy" ); |
17 | dateformat->insertItem ( "mmddyy" ); | 16 | dateformat->insertItem ( "mmddyy" ); |
18 | dateformat->insertItem ( "yyyyddmm" ); | 17 | dateformat->insertItem ( "yyyyddmm" ); |
19 | dateformat->insertItem ( "yyddmm" ); | 18 | dateformat->insertItem ( "yyddmm" ); |
20 | dateformat->insertItem ( "ddmmyyyy" ); | 19 | dateformat->insertItem ( "ddmmyyyy" ); |
21 | dateformat->insertItem ( "ddmmyy" ); | 20 | dateformat->insertItem ( "ddmmyy" ); |
22 | connect ( dateformat, SIGNAL ( activated ( int ) ), this, SLOT ( changeDateFormat ( int ) ) ); | 21 | connect ( dateformat, SIGNAL ( activated ( int ) ), this, SLOT ( changeDateFormat ( int ) ) ); |
23 | 22 | ||
24 | QLabel *dateseparatorlabel = new QLabel ( "Separator", this ); | 23 | QLabel *dateseparatorlabel = new QLabel ( "Separator", this ); |
25 | dateseparator = new QComboBox ( this ); | 24 | dateseparator = new QComboBox ( this ); |
26 | dateseparator->insertItem ( "/" ); | 25 | dateseparator->insertItem ( "/" ); |
27 | dateseparator->insertItem ( "-" ); | 26 | dateseparator->insertItem ( "-" ); |
28 | dateseparator->insertItem ( "." ); | 27 | dateseparator->insertItem ( "." ); |
29 | connect ( dateseparator, SIGNAL ( activated ( int ) ), this, SLOT ( changeDateSeparator ( int ) ) ); | 28 | connect ( dateseparator, SIGNAL ( activated ( int ) ), this, SLOT ( changeDateSeparator ( int ) ) ); |
30 | 29 | ||
31 | defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); | 30 | defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); |
32 | connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultDatePreferences () ) ); | 31 | connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultDatePreferences () ) ); |
33 | 32 | ||
34 | dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 ); | 33 | dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 ); |
35 | dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 ); | 34 | dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 ); |
36 | 35 | ||
37 | layout = new QVBoxLayout ( this, 2, 2 ); | 36 | layout = new QVBoxLayout ( this, 2, 2 ); |
38 | layout->addWidget ( datelabel ); | 37 | layout->addWidget ( datelabel ); |
39 | layout->addWidget ( dateformat ); | 38 | layout->addWidget ( dateformat ); |
40 | layout->addWidget ( dateseparatorlabel ); | 39 | layout->addWidget ( dateseparatorlabel ); |
41 | layout->addWidget ( dateseparator ); | 40 | layout->addWidget ( dateseparator ); |
42 | layout->insertSpacing ( 4, 5 ); | 41 | layout->insertSpacing ( 4, 5 ); |
43 | layout->addWidget ( defaults ); | 42 | layout->addWidget ( defaults ); |
44 | 43 | ||
45 | } | 44 | } |
46 | 45 | ||
47 | DatePreferences::~DatePreferences () | 46 | DatePreferences::~DatePreferences () |
48 | { | 47 | { |
49 | } | 48 | } |
50 | 49 | ||
51 | void DatePreferences::changeDateFormat ( int index ) | 50 | void DatePreferences::changeDateFormat ( int index ) |
52 | { | 51 | { |
53 | index ++; | 52 | index ++; |
54 | preferences->changePreference ( 1, index ); | 53 | preferences->changePreference ( 1, index ); |
55 | } | 54 | } |
56 | 55 | ||
57 | void DatePreferences::changeDateSeparator ( int index ) | 56 | void DatePreferences::changeDateSeparator ( int index ) |
58 | { | 57 | { |
59 | index ++; | 58 | index ++; |
60 | preferences->changePreference ( 2, index ); | 59 | preferences->changePreference ( 2, index ); |
61 | } | 60 | } |
62 | 61 | ||
63 | void DatePreferences::setDefaultDatePreferences () | 62 | void DatePreferences::setDefaultDatePreferences () |
64 | { | 63 | { |
65 | preferences->setDefaultDatePreferences (); | 64 | preferences->setDefaultDatePreferences (); |
66 | dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 ); | 65 | dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 ); |
67 | dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 ); | 66 | dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 ); |
diff --git a/noncore/apps/qashmoney/transactiondisplay.cpp b/noncore/apps/qashmoney/transactiondisplay.cpp index 78b8a00..474f11e 100755 --- a/noncore/apps/qashmoney/transactiondisplay.cpp +++ b/noncore/apps/qashmoney/transactiondisplay.cpp | |||
@@ -1,79 +1,76 @@ | |||
1 | #include "transactiondisplay.h" | 1 | #include "transactiondisplay.h" |
2 | #include "newtransaction.h" | 2 | #include "newtransaction.h" |
3 | #include "account.h" | 3 | #include "account.h" |
4 | #include "budget.h" | 4 | #include "budget.h" |
5 | #include "memory.h" | 5 | #include "memory.h" |
6 | #include "transfer.h" | 6 | #include "transfer.h" |
7 | #include "preferences.h" | ||
8 | #include "calculator.h" | 7 | #include "calculator.h" |
9 | #include "datepicker.h" | 8 | #include "datepicker.h" |
10 | 9 | ||
11 | #include <qdatetime.h> | ||
12 | #include <qmessagebox.h> | 10 | #include <qmessagebox.h> |
13 | #include <qheader.h> | 11 | #include <qheader.h> |
14 | #include <qmultilineedit.h> | 12 | #include <qmultilineedit.h> |
15 | #include <qdatetime.h> | ||
16 | 13 | ||
17 | extern Transaction *transaction; | 14 | extern Transaction *transaction; |
18 | extern Budget *budget; | 15 | extern Budget *budget; |
19 | extern Account *account; | 16 | extern Account *account; |
20 | extern Preferences *preferences; | 17 | extern Preferences *preferences; |
21 | extern Memory *memory; | 18 | extern Memory *memory; |
22 | extern Transfer *transfer; | 19 | extern Transfer *transfer; |
23 | 20 | ||
24 | TransactionDisplay::TransactionDisplay ( QWidget* parent ) : QWidget ( parent ) | 21 | TransactionDisplay::TransactionDisplay ( QWidget* parent ) : QWidget ( parent ) |
25 | { | 22 | { |
26 | // set transactiondisplay variables; | 23 | // set transactiondisplay variables; |
27 | accountid = 0; | 24 | accountid = 0; |
28 | children = TRUE; | 25 | children = TRUE; |
29 | 26 | ||
30 | firstline = new QHBox ( this ); | 27 | firstline = new QHBox ( this ); |
31 | firstline->setSpacing ( 2 ); | 28 | firstline->setSpacing ( 2 ); |
32 | 29 | ||
33 | newtransaction = new QPushButton ( firstline ); | 30 | newtransaction = new QPushButton ( firstline ); |
34 | newtransaction->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") ); | 31 | newtransaction->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") ); |
35 | connect ( newtransaction, SIGNAL ( released () ), this, SLOT ( addTransaction () ) ); | 32 | connect ( newtransaction, SIGNAL ( released () ), this, SLOT ( addTransaction () ) ); |
36 | 33 | ||
37 | edittransaction = new QPushButton ( firstline ); | 34 | edittransaction = new QPushButton ( firstline ); |
38 | edittransaction->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); | 35 | edittransaction->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") ); |
39 | connect ( edittransaction, SIGNAL ( released () ), this, SLOT ( checkListViewEdit () ) ); | 36 | connect ( edittransaction, SIGNAL ( released () ), this, SLOT ( checkListViewEdit () ) ); |
40 | 37 | ||
41 | deletetransaction = new QPushButton ( firstline ); | 38 | deletetransaction = new QPushButton ( firstline ); |
42 | deletetransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") ); | 39 | deletetransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") ); |
43 | connect ( deletetransaction, SIGNAL ( released () ), this, SLOT ( checkListViewDelete () ) ); | 40 | connect ( deletetransaction, SIGNAL ( released () ), this, SLOT ( checkListViewDelete () ) ); |
44 | 41 | ||
45 | toggletransaction = new QPushButton ( firstline ); | 42 | toggletransaction = new QPushButton ( firstline ); |
46 | toggletransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/redo.png") ); | 43 | toggletransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/redo.png") ); |
47 | connect ( toggletransaction, SIGNAL ( released () ), this, SLOT ( checkListViewToggle () ) ); | 44 | connect ( toggletransaction, SIGNAL ( released () ), this, SLOT ( checkListViewToggle () ) ); |
48 | 45 | ||
49 | viewtransactionnotes = new QPushButton ( firstline ); | 46 | viewtransactionnotes = new QPushButton ( firstline ); |
50 | viewtransactionnotes->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/info.png") ); | 47 | viewtransactionnotes->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/info.png") ); |
51 | connect ( viewtransactionnotes, SIGNAL ( released () ), this, SLOT ( showTransactionNotes () ) ); | 48 | connect ( viewtransactionnotes, SIGNAL ( released () ), this, SLOT ( showTransactionNotes () ) ); |
52 | 49 | ||
53 | secondline = new QHBox ( this ); | 50 | secondline = new QHBox ( this ); |
54 | secondline->setSpacing ( 5 ); | 51 | secondline->setSpacing ( 5 ); |
55 | 52 | ||
56 | name = new QLabel ( secondline ); | 53 | name = new QLabel ( secondline ); |
57 | balance = new QLabel ( secondline ); | 54 | balance = new QLabel ( secondline ); |
58 | 55 | ||
59 | QLabel *limit = new QLabel ( "Limit", secondline ); | 56 | QLabel *limit = new QLabel ( "Limit", secondline ); |
60 | limitbox = new QLineEdit ( secondline ); | 57 | limitbox = new QLineEdit ( secondline ); |
61 | limitbox->setMinimumWidth ( ( int ) ( this->width() / 6 ) ); | 58 | limitbox->setMinimumWidth ( ( int ) ( this->width() / 6 ) ); |
62 | connect ( limitbox, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( limitDisplay ( const QString & ) ) ); | 59 | connect ( limitbox, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( limitDisplay ( const QString & ) ) ); |
63 | 60 | ||
64 | listview = new QListView ( this ); | 61 | listview = new QListView ( this ); |
65 | listview->setAllColumnsShowFocus ( TRUE ); | 62 | listview->setAllColumnsShowFocus ( TRUE ); |
66 | listview->setShowSortIndicator ( TRUE ); | 63 | listview->setShowSortIndicator ( TRUE ); |
67 | listview->header()->setTracking ( FALSE ); | 64 | listview->header()->setTracking ( FALSE ); |
68 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); | 65 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); |
69 | connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); | 66 | connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); |
70 | 67 | ||
71 | layout = new QVBoxLayout ( this, 2, 2 ); | 68 | layout = new QVBoxLayout ( this, 2, 2 ); |
72 | layout->addWidget ( firstline ); | 69 | layout->addWidget ( firstline ); |
73 | layout->addWidget ( secondline ); | 70 | layout->addWidget ( secondline ); |
74 | layout->addWidget ( listview ); | 71 | layout->addWidget ( listview ); |
75 | } | 72 | } |
76 | 73 | ||
77 | void TransactionDisplay::addTransaction () | 74 | void TransactionDisplay::addTransaction () |
78 | { | 75 | { |
79 | // create local variables | 76 | // create local variables |
diff --git a/noncore/apps/qashmoney/transferdialog.cpp b/noncore/apps/qashmoney/transferdialog.cpp index f85c740..558abec 100755 --- a/noncore/apps/qashmoney/transferdialog.cpp +++ b/noncore/apps/qashmoney/transferdialog.cpp | |||
@@ -1,70 +1,68 @@ | |||
1 | #include "transferdialog.h" | 1 | #include "transferdialog.h" |
2 | #include "datepicker.h" | 2 | #include "datepicker.h" |
3 | #include "calculator.h" | 3 | #include "calculator.h" |
4 | 4 | ||
5 | #include <qdatetime.h> | ||
6 | #include <qfont.h> | ||
7 | 5 | ||
8 | extern Preferences *preferences; | 6 | extern Preferences *preferences; |
9 | extern Account *account; | 7 | extern Account *account; |
10 | 8 | ||
11 | TransferDialog::TransferDialog ( QWidget *parent, int fromaccountid, int toaccountid ) : QDialog ( parent, 0, TRUE ) | 9 | TransferDialog::TransferDialog ( QWidget *parent, int fromaccountid, int toaccountid ) : QDialog ( parent, 0, TRUE ) |
12 | { | 10 | { |
13 | dateedited = FALSE; | 11 | dateedited = FALSE; |
14 | setCaption ( "Transfer" ); | 12 | setCaption ( "Transfer" ); |
15 | 13 | ||
16 | fromaccountlabel = new QLabel ( "From account:", this ); | 14 | fromaccountlabel = new QLabel ( "From account:", this ); |
17 | QFont f = this->font(); | 15 | QFont f = this->font(); |
18 | f.setWeight ( QFont::Bold ); | 16 | f.setWeight ( QFont::Bold ); |
19 | fromaccountlabel->setFont ( f ); | 17 | fromaccountlabel->setFont ( f ); |
20 | fromaccount = new QLabel ( account->getAccountName ( fromaccountid ), this ); | 18 | fromaccount = new QLabel ( account->getAccountName ( fromaccountid ), this ); |
21 | 19 | ||
22 | toaccountlabel = new QLabel ( "To Account:", this ); | 20 | toaccountlabel = new QLabel ( "To Account:", this ); |
23 | toaccountlabel->setFont ( f ); | 21 | toaccountlabel->setFont ( f ); |
24 | toaccount = new QLabel ( account->getAccountName ( toaccountid ), this ); | 22 | toaccount = new QLabel ( account->getAccountName ( toaccountid ), this ); |
25 | 23 | ||
26 | datelabel = new QLabel ( "Date", this ); | 24 | datelabel = new QLabel ( "Date", this ); |
27 | 25 | ||
28 | datebox = new QHBox ( this ); | 26 | datebox = new QHBox ( this ); |
29 | datebox->setSpacing ( 2 ); | 27 | datebox->setSpacing ( 2 ); |
30 | date = new QLineEdit ( datebox ); | 28 | date = new QLineEdit ( datebox ); |
31 | date->setAlignment ( Qt::AlignRight ); | 29 | date->setAlignment ( Qt::AlignRight ); |
32 | date->setDisabled ( TRUE ); | 30 | date->setDisabled ( TRUE ); |
33 | datebutton = new QPushButton ( datebox ); | 31 | datebutton = new QPushButton ( datebox ); |
34 | datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); | 32 | datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) ); |
35 | connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); | 33 | connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) ); |
36 | 34 | ||
37 | amounttlabel = new QLabel ( "Amount", this ); | 35 | amounttlabel = new QLabel ( "Amount", this ); |
38 | 36 | ||
39 | amountbox = new QHBox ( this ); | 37 | amountbox = new QHBox ( this ); |
40 | amountbox->setSpacing ( 2 ); | 38 | amountbox->setSpacing ( 2 ); |
41 | amount = new QLineEdit ( amountbox ); | 39 | amount = new QLineEdit ( amountbox ); |
42 | amount->setAlignment ( Qt::AlignRight ); | 40 | amount->setAlignment ( Qt::AlignRight ); |
43 | calculatorbutton = new QPushButton( amountbox ); | 41 | calculatorbutton = new QPushButton( amountbox ); |
44 | calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); | 42 | calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) ); |
45 | connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); | 43 | connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) ); |
46 | 44 | ||
47 | clearedcheckbox = new QCheckBox ( "Cleared", this ); | 45 | clearedcheckbox = new QCheckBox ( "Cleared", this ); |
48 | 46 | ||
49 | layout = new QVBoxLayout ( this, 4, 2 ); | 47 | layout = new QVBoxLayout ( this, 4, 2 ); |
50 | layout->addWidget ( fromaccountlabel, Qt::AlignLeft ); | 48 | layout->addWidget ( fromaccountlabel, Qt::AlignLeft ); |
51 | layout->addWidget ( fromaccount, Qt::AlignLeft ); | 49 | layout->addWidget ( fromaccount, Qt::AlignLeft ); |
52 | layout->addWidget ( toaccountlabel, Qt::AlignLeft ); | 50 | layout->addWidget ( toaccountlabel, Qt::AlignLeft ); |
53 | layout->addWidget ( toaccount, Qt::AlignLeft ); | 51 | layout->addWidget ( toaccount, Qt::AlignLeft ); |
54 | layout->addSpacing ( 5 ); | 52 | layout->addSpacing ( 5 ); |
55 | layout->addWidget ( datelabel, Qt::AlignLeft ); | 53 | layout->addWidget ( datelabel, Qt::AlignLeft ); |
56 | layout->addWidget ( datebox, Qt::AlignLeft ); | 54 | layout->addWidget ( datebox, Qt::AlignLeft ); |
57 | layout->addWidget ( amounttlabel, Qt::AlignLeft ); | 55 | layout->addWidget ( amounttlabel, Qt::AlignLeft ); |
58 | layout->addWidget ( amountbox, Qt::AlignLeft ); | 56 | layout->addWidget ( amountbox, Qt::AlignLeft ); |
59 | layout->addWidget ( clearedcheckbox, Qt::AlignLeft ); | 57 | layout->addWidget ( clearedcheckbox, Qt::AlignLeft ); |
60 | } | 58 | } |
61 | 59 | ||
62 | bool TransferDialog::getDateEdited () | 60 | bool TransferDialog::getDateEdited () |
63 | { | 61 | { |
64 | return dateedited; | 62 | return dateedited; |
65 | } | 63 | } |
66 | 64 | ||
67 | void TransferDialog::showCalendar () | 65 | void TransferDialog::showCalendar () |
68 | { | 66 | { |
69 | QDate newDate = QDate::currentDate (); | 67 | QDate newDate = QDate::currentDate (); |
70 | DatePicker *dp = new DatePicker ( newDate ); | 68 | DatePicker *dp = new DatePicker ( newDate ); |
diff --git a/noncore/apps/tableviewer/tableviewer.cpp b/noncore/apps/tableviewer/tableviewer.cpp index 207172d..f35dfcd 100644 --- a/noncore/apps/tableviewer/tableviewer.cpp +++ b/noncore/apps/tableviewer/tableviewer.cpp | |||
@@ -1,101 +1,100 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | /* local includes */ | 21 | /* local includes */ |
22 | #include "tableviewer.h" | 22 | #include "tableviewer.h" |
23 | #include "ui/tvbrowseview.h" | 23 | #include "ui/tvbrowseview.h" |
24 | #include "ui/tvfilterview.h" | 24 | #include "ui/tvfilterview.h" |
25 | #include "ui/tvlistview.h" | 25 | #include "ui/tvlistview.h" |
26 | #include "ui/tveditview.h" | 26 | #include "ui/tveditview.h" |
27 | #include "ui/tvkeyedit.h" | 27 | #include "ui/tvkeyedit.h" |
28 | #include "db/datacache.h" | 28 | #include "db/datacache.h" |
29 | 29 | ||
30 | /* QPE includes */ | 30 | /* QPE includes */ |
31 | #include <qpe/fileselector.h> | 31 | #include <qpe/fileselector.h> |
32 | #include <qpe/resource.h> | 32 | #include <qpe/resource.h> |
33 | #include <qpe/qpetoolbar.h> | 33 | #include <qpe/qpetoolbar.h> |
34 | 34 | ||
35 | /* QTE includes */ | 35 | /* QTE includes */ |
36 | #include <qmenubar.h> | 36 | #include <qmenubar.h> |
37 | #include <qpe/qpetoolbar.h> | ||
38 | #include <qpopupmenu.h> | 37 | #include <qpopupmenu.h> |
39 | #include <qapplication.h> | 38 | #include <qapplication.h> |
40 | #include <qwidgetstack.h> | 39 | #include <qwidgetstack.h> |
41 | #include <qlayout.h> | 40 | #include <qlayout.h> |
42 | #include <qbuffer.h> | 41 | #include <qbuffer.h> |
43 | /*! | 42 | /*! |
44 | \class TableViewerWindow | 43 | \class TableViewerWindow |
45 | \brief The main window widget of the application | 44 | \brief The main window widget of the application |
46 | 45 | ||
47 | This is the main widget of the table viewer application. | 46 | This is the main widget of the table viewer application. |
48 | It is the co-ordination point. | 47 | It is the co-ordination point. |
49 | */ | 48 | */ |
50 | 49 | ||
51 | /*! | 50 | /*! |
52 | Constructs a new TableViewerWindow | 51 | Constructs a new TableViewerWindow |
53 | */ | 52 | */ |
54 | TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f) | 53 | TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f) |
55 | : QMainWindow(parent, name, f) | 54 | : QMainWindow(parent, name, f) |
56 | { | 55 | { |
57 | setCaption(tr("Table Viewer")); | 56 | setCaption(tr("Table Viewer")); |
58 | 57 | ||
59 | /* Build data */ | 58 | /* Build data */ |
60 | ds = new DBStore(); | 59 | ds = new DBStore(); |
61 | doc.setType("text/x-xml-tableviewer"); | 60 | doc.setType("text/x-xml-tableviewer"); |
62 | doc.setName("table"); | 61 | doc.setName("table"); |
63 | 62 | ||
64 | dirty = FALSE; | 63 | dirty = FALSE; |
65 | ts.current_column = 0; | 64 | ts.current_column = 0; |
66 | ts.kRep = ds->getKeys(); | 65 | ts.kRep = ds->getKeys(); |
67 | 66 | ||
68 | /* build menus */ | 67 | /* build menus */ |
69 | menu = new QMenuBar(this, 0); | 68 | menu = new QMenuBar(this, 0); |
70 | 69 | ||
71 | QPopupMenu *file_menu = new QPopupMenu; | 70 | QPopupMenu *file_menu = new QPopupMenu; |
72 | file_menu->insertItem("New", this, SLOT(newDocument())); | 71 | file_menu->insertItem("New", this, SLOT(newDocument())); |
73 | 72 | ||
74 | file_menu->insertItem("Open", this, SLOT(selectDocument())); | 73 | file_menu->insertItem("Open", this, SLOT(selectDocument())); |
75 | file_menu->insertSeparator(); | 74 | file_menu->insertSeparator(); |
76 | file_menu->insertItem("Properties"); | 75 | file_menu->insertItem("Properties"); |
77 | 76 | ||
78 | /* later will want to set this up to clean up first via this, SLOT(quit) */ | 77 | /* later will want to set this up to clean up first via this, SLOT(quit) */ |
79 | menu->insertItem("Document", file_menu); | 78 | menu->insertItem("Document", file_menu); |
80 | 79 | ||
81 | QPopupMenu *edit_menu = new QPopupMenu; | 80 | QPopupMenu *edit_menu = new QPopupMenu; |
82 | edit_menu->insertItem("Edit Item", this, SLOT(editItemSlot())); | 81 | edit_menu->insertItem("Edit Item", this, SLOT(editItemSlot())); |
83 | edit_menu->insertItem("Edit Keys", this, SLOT(editKeysSlot())); | 82 | edit_menu->insertItem("Edit Keys", this, SLOT(editKeysSlot())); |
84 | edit_menu->insertItem("Edit filters", this, SLOT(filterViewSlot())); | 83 | edit_menu->insertItem("Edit filters", this, SLOT(filterViewSlot())); |
85 | menu->insertItem("Edit", edit_menu); | 84 | menu->insertItem("Edit", edit_menu); |
86 | 85 | ||
87 | QPopupMenu *view_menu = new QPopupMenu; | 86 | QPopupMenu *view_menu = new QPopupMenu; |
88 | view_menu->insertItem("Browse View", this, SLOT(browseViewSlot())); | 87 | view_menu->insertItem("Browse View", this, SLOT(browseViewSlot())); |
89 | view_menu->insertItem("List View", this, SLOT(listViewSlot())); | 88 | view_menu->insertItem("List View", this, SLOT(listViewSlot())); |
90 | menu->insertItem("View", view_menu); | 89 | menu->insertItem("View", view_menu); |
91 | 90 | ||
92 | QVBoxLayout *main_layout = new QVBoxLayout; | 91 | QVBoxLayout *main_layout = new QVBoxLayout; |
93 | 92 | ||
94 | /* Build tool bar */ | 93 | /* Build tool bar */ |
95 | navigation = new QToolBar(this, "navigation"); | 94 | navigation = new QToolBar(this, "navigation"); |
96 | QToolButton *newItemButton = new QToolButton( | 95 | QToolButton *newItemButton = new QToolButton( |
97 | QIconSet(Resource::loadPixmap("new")), "New Item", QString::null, | 96 | QIconSet(Resource::loadPixmap("new")), "New Item", QString::null, |
98 | this, SLOT(newItemSlot()), navigation, "New Item"); | 97 | this, SLOT(newItemSlot()), navigation, "New Item"); |
99 | QToolButton *editItemButton = new QToolButton( | 98 | QToolButton *editItemButton = new QToolButton( |
100 | QIconSet(Resource::loadPixmap("edit")), "Edit Item", QString::null, | 99 | QIconSet(Resource::loadPixmap("edit")), "Edit Item", QString::null, |
101 | this, SLOT(editItemSlot()), navigation, "Edit Item"); | 100 | this, SLOT(editItemSlot()), navigation, "Edit Item"); |