-rw-r--r-- | noncore/apps/opie-reader/CEncoding_tables.cpp | 534 | ||||
-rw-r--r-- | noncore/apps/opie-reader/CEncoding_tables.h | 65 | ||||
-rw-r--r-- | noncore/apps/opie-reader/CloseDialog.cpp | 18 | ||||
-rw-r--r-- | noncore/apps/opie-reader/CloseDialog.h | 62 | ||||
-rwxr-xr-x | noncore/apps/opie-reader/FixedFont.h | 6 | ||||
-rw-r--r-- | noncore/apps/opie-reader/Prefs.cpp | 636 | ||||
-rw-r--r-- | noncore/apps/opie-reader/Prefs.h | 340 | ||||
-rw-r--r-- | noncore/apps/opie-reader/ToolbarPrefs.cpp | 499 | ||||
-rw-r--r-- | noncore/apps/opie-reader/ToolbarPrefs.h | 263 | ||||
-rw-r--r-- | noncore/apps/opie-reader/URLDialog.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/opie-reader/URLDialog.h | 65 | ||||
-rw-r--r-- | noncore/apps/opie-reader/linktype.h | 11 | ||||
-rw-r--r-- | noncore/apps/opie-reader/names.h | 14 | ||||
-rw-r--r-- | noncore/apps/opie-reader/plucker_base.cpp | 1240 | ||||
-rw-r--r-- | noncore/apps/opie-reader/plucker_base.h | 119 | ||||
-rw-r--r-- | noncore/apps/opie-reader/qtreader.pro | 90 | ||||
-rw-r--r-- | noncore/apps/opie-reader/usenef.h | 6 | ||||
-rw-r--r-- | noncore/apps/opie-reader/useqpe.h | 3 | ||||
-rw-r--r-- | noncore/apps/opie-reader/version.cpp | 39 |
19 files changed, 4024 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/CEncoding_tables.cpp b/noncore/apps/opie-reader/CEncoding_tables.cpp new file mode 100644 index 0000000..667bda0 --- a/dev/null +++ b/noncore/apps/opie-reader/CEncoding_tables.cpp | |||
@@ -0,0 +1,534 @@ | |||
1 | #include "CEncoding_tables.h" | ||
2 | #include "config.h" | ||
3 | |||
4 | static const unicodetable unicodevalues[] = { | ||
5 | // from RFC 1489, ftp://ftp.isi.edu/in-notes/rfc1489.txt | ||
6 | { "KOI8-R", "KOI8-R", 2084, | ||
7 | { 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, | ||
8 | 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, | ||
9 | 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219/**/, 0x221A, 0x2248, | ||
10 | 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, | ||
11 | 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556, | ||
12 | 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x255C, 0x255D, 0x255E, | ||
13 | 0x255F, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565, | ||
14 | 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x256B, 0x256C, 0x00A9, | ||
15 | 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, | ||
16 | 0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, | ||
17 | 0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, | ||
18 | 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A, | ||
19 | 0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, | ||
20 | 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, | ||
21 | 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, | ||
22 | 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A } }, | ||
23 | // /**/ - The BULLET OPERATOR is confused. Some people think | ||
24 | // it should be 0x2022 (BULLET). | ||
25 | |||
26 | // from RFC 2319, ftp://ftp.isi.edu/in-notes/rfc2319.txt | ||
27 | { "KOI8-U", "KOI8-U", 2088, | ||
28 | { 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, | ||
29 | 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, | ||
30 | 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248, | ||
31 | 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, | ||
32 | 0x2550, 0x2551, 0x2552, 0x0451, 0x0454, 0x2554, 0x0456, 0x0457, | ||
33 | 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x0491, 0x255D, 0x255E, | ||
34 | 0x255F, 0x2560, 0x2561, 0x0401, 0x0404, 0x2563, 0x0406, 0x0407, | ||
35 | 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x0490, 0x256C, 0x00A9, | ||
36 | 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, | ||
37 | 0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, | ||
38 | 0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, | ||
39 | 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A, | ||
40 | 0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, | ||
41 | 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, | ||
42 | 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, | ||
43 | 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A } }, | ||
44 | |||
45 | // next bits generated from tables on the Unicode 2.0 CD. we can | ||
46 | // use these tables since this is part of the transition to using | ||
47 | // unicode everywhere in qt. | ||
48 | |||
49 | // $ for A in 8 9 A B C D E F ; do for B in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do echo 0x${A}${B} 0xFFFD ; done ; done > /tmp/digits ; for a in 8859-* ; do ( awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a ; cat /tmp/digits ) | sort | uniq -w4 | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done | ||
50 | |||
51 | // then I inserted the files manually. | ||
52 | { "ISO-8859-2", "ISO 8859-2", 5, | ||
53 | { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, | ||
54 | 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, | ||
55 | 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, | ||
56 | 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, | ||
57 | 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, | ||
58 | 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, | ||
59 | 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, | ||
60 | 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, | ||
61 | 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, | ||
62 | 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, | ||
63 | 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, | ||
64 | 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, | ||
65 | 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, | ||
66 | 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, | ||
67 | 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, | ||
68 | 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9} }, | ||
69 | { "ISO-8859-3", "ISO 8859-3", 6, | ||
70 | { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, | ||
71 | 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, | ||
72 | 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, | ||
73 | 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, | ||
74 | 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0xFFFD, 0x0124, 0x00A7, | ||
75 | 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0xFFFD, 0x017B, | ||
76 | 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7, | ||
77 | 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0xFFFD, 0x017C, | ||
78 | 0x00C0, 0x00C1, 0x00C2, 0xFFFD, 0x00C4, 0x010A, 0x0108, 0x00C7, | ||
79 | 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, | ||
80 | 0xFFFD, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7, | ||
81 | 0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF, | ||
82 | 0x00E0, 0x00E1, 0x00E2, 0xFFFD, 0x00E4, 0x010B, 0x0109, 0x00E7, | ||
83 | 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, | ||
84 | 0xFFFD, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7, | ||
85 | 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9} }, | ||
86 | { "ISO-8859-4", "ISO 8859-4", 7, | ||
87 | { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, | ||
88 | 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, | ||
89 | 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, | ||
90 | 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, | ||
91 | 0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7, | ||
92 | 0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF, | ||
93 | 0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7, | ||
94 | 0x00B8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014A, 0x017E, 0x014B, | ||
95 | 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, | ||
96 | 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x012A, | ||
97 | 0x0110, 0x0145, 0x014C, 0x0136, 0x00D4, 0x00D5, 0x00D6, 0x00D7, | ||
98 | 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x0168, 0x016A, 0x00DF, | ||
99 | 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, | ||
100 | 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B, | ||
101 | 0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7, | ||
102 | 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9} }, | ||
103 | { "ISO-8859-5", "ISO 8859-5", 8, | ||
104 | { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, | ||
105 | 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, | ||
106 | 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, | ||
107 | 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, | ||
108 | 0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, | ||
109 | 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F, | ||
110 | 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, | ||
111 | 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, | ||
112 | 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, | ||
113 | 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, | ||
114 | 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, | ||
115 | 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, | ||
116 | 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, | ||
117 | 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, | ||
118 | 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, | ||
119 | 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F} }, | ||
120 | { "ISO-8859-6", "ISO 8859-6", 82, | ||
121 | { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, | ||
122 | 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, | ||
123 | 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, | ||
124 | 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, | ||
125 | 0x00A0, 0xFFFD, 0xFFFD, 0xFFFD, 0x00A4, 0xFFFD, 0xFFFD, 0xFFFD, | ||
126 | 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x060C, 0x00AD, 0xFFFD, 0xFFFD, | ||
127 | 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
128 | 0xFFFD, 0xFFFD, 0xFFFD, 0x061B, 0xFFFD, 0xFFFD, 0xFFFD, 0x061F, | ||
129 | 0xFFFD, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, | ||
130 | 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, | ||
131 | 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, | ||
132 | 0x0638, 0x0639, 0x063A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
133 | 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, | ||
134 | 0x0648, 0x0649, 0x064A, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, | ||
135 | 0x0650, 0x0651, 0x0652, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
136 | 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} }, | ||
137 | { "ISO-8859-7", "ISO 8859-7", 10, | ||
138 | { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, | ||
139 | 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, | ||
140 | 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, | ||
141 | 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, | ||
142 | 0x00A0, 0x2018, 0x2019, 0x00A3, 0xFFFD, 0xFFFD, 0x00A6, 0x00A7, | ||
143 | 0x00A8, 0x00A9, 0xFFFD, 0x00AB, 0x00AC, 0x00AD, 0xFFFD, 0x2015, | ||
144 | 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7, | ||
145 | 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, | ||
146 | 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, | ||
147 | 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, | ||
148 | 0x03A0, 0x03A1, 0xFFFD, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, | ||
149 | 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, | ||
150 | 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, | ||
151 | 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, | ||
152 | 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, | ||
153 | 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFD} }, | ||
154 | { "ISO-8859-8-I", "ISO 8859-8-I", 85, | ||
155 | { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, | ||
156 | 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, | ||
157 | 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, | ||
158 | 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, | ||
159 | 0x00A0, 0xFFFD, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, | ||
160 | 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x203E, | ||
161 | 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, | ||
162 | 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0xFFFD, | ||
163 | 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
164 | 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
165 | 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
166 | 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2017, | ||
167 | 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, | ||
168 | 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, | ||
169 | 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, | ||
170 | 0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} }, | ||
171 | { "ISO-8859-9", "ISO 8859-9", 12, | ||
172 | { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, | ||
173 | 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, | ||
174 | 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, | ||
175 | 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, | ||
176 | 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, | ||
177 | 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, | ||
178 | 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, | ||
179 | 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, | ||
180 | 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, | ||
181 | 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, | ||
182 | 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, | ||
183 | 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, | ||
184 | 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, | ||
185 | 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, | ||
186 | 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, | ||
187 | 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF} }, | ||
188 | { "ISO-8859-10", "ISO 8859-10", 13, | ||
189 | { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, | ||
190 | 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, | ||
191 | 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, | ||
192 | 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, | ||
193 | 0x00A0, 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7, | ||
194 | 0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A, | ||
195 | 0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7, | ||
196 | 0x013C, 0x0111, 0x0161, 0x0167, 0x017E, 0x2015, 0x016B, 0x014B, | ||
197 | 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, | ||
198 | 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x00CF, | ||
199 | 0x00D0, 0x0145, 0x014C, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x0168, | ||
200 | 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, | ||
201 | 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, | ||
202 | 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF, | ||
203 | 0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169, | ||
204 | 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138} }, | ||
205 | { "ISO-8859-13", "ISO 8859-13", 109, | ||
206 | { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, | ||
207 | 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, | ||
208 | 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, | ||
209 | 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, | ||
210 | 0x00A0, 0x201D, 0x00A2, 0x00A3, 0x00A4, 0x201E, 0x00A6, 0x00A7, | ||
211 | 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, | ||
212 | 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x201C, 0x00B5, 0x00B6, 0x00B7, | ||
213 | 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, | ||
214 | 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, | ||
215 | 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, | ||
216 | 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, | ||
217 | 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, | ||
218 | 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, | ||
219 | 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, | ||
220 | 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, | ||
221 | 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x2019} }, | ||
222 | { "ISO-8859-14", "ISO 8859-14", 110, | ||
223 | { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, | ||
224 | 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, | ||
225 | 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, | ||
226 | 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, | ||
227 | 0x00A0, 0x1E02, 0x1E03, 0x00A3, 0x010A, 0x010B, 0x1E0A, 0x00A7, | ||
228 | 0x1E80, 0x00A9, 0x1E82, 0x1E0B, 0x1EF2, 0x00AD, 0x00AE, 0x0178, | ||
229 | 0x1E1E, 0x1E1F, 0x0120, 0x0121, 0x1E40, 0x1E41, 0x00B6, 0x1E56, | ||
230 | 0x1E81, 0x1E57, 0x1E83, 0x1E60, 0x1EF3, 0x1E84, 0x1E85, 0x1E61, | ||
231 | 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, | ||
232 | 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, | ||
233 | 0x0174, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x1E6A, | ||
234 | 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x0176, 0x00DF, | ||
235 | 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, | ||
236 | 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, | ||
237 | 0x0175, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x1E6B, | ||
238 | 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x0177, 0x00FF} }, | ||
239 | |||
240 | // next bits generated again from tables on the Unicode 3.0 CD. | ||
241 | |||
242 | // $ for a in CP* ; do ( awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a ) | sort | sed -e 's/#UNDEF.*$/0xFFFD/' | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done | ||
243 | |||
244 | { "CP 850", "IBM 850", 2009, | ||
245 | { 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, | ||
246 | 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, | ||
247 | 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, | ||
248 | 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192, | ||
249 | 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, | ||
250 | 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, | ||
251 | 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, | ||
252 | 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510, | ||
253 | 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, | ||
254 | 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4, | ||
255 | 0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, | ||
256 | 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580, | ||
257 | 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, | ||
258 | 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4, | ||
259 | 0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, | ||
260 | 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0} }, | ||
261 | { "CP 874", "CP 874", 0, //### what is the mib? | ||
262 | { 0x20AC, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2026, 0xFFFD, 0xFFFD, | ||
263 | 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
264 | 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, | ||
265 | 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
266 | 0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, | ||
267 | 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F, | ||
268 | 0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, | ||
269 | 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F, | ||
270 | 0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, | ||
271 | 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F, | ||
272 | 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, | ||
273 | 0x0E38, 0x0E39, 0x0E3A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x0E3F, | ||
274 | 0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, | ||
275 | 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F, | ||
276 | 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, | ||
277 | 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} }, | ||
278 | { "IBM 866", "IBM 866", 2086, | ||
279 | { 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, | ||
280 | 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, | ||
281 | 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, | ||
282 | 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, | ||
283 | 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, | ||
284 | 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, | ||
285 | 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, | ||
286 | 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, | ||
287 | 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, | ||
288 | 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, | ||
289 | 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, | ||
290 | 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, | ||
291 | 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, | ||
292 | 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, | ||
293 | 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040E, 0x045E, | ||
294 | 0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0} }, | ||
295 | |||
296 | { "windows-1250", "CP 1250", 2250, | ||
297 | { 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021, | ||
298 | 0xFFFD, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179, | ||
299 | 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, | ||
300 | 0xFFFD, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A, | ||
301 | 0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7, | ||
302 | 0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B, | ||
303 | 0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7, | ||
304 | 0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C, | ||
305 | 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, | ||
306 | 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, | ||
307 | 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, | ||
308 | 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, | ||
309 | 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, | ||
310 | 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, | ||
311 | 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, | ||
312 | 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9} }, | ||
313 | { "windows-1251", "CP 1251", 2251, | ||
314 | { 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, | ||
315 | 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, | ||
316 | 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, | ||
317 | 0xFFFD, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F, | ||
318 | 0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, | ||
319 | 0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407, | ||
320 | 0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, | ||
321 | 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457, | ||
322 | 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, | ||
323 | 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, | ||
324 | 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, | ||
325 | 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, | ||
326 | 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, | ||
327 | 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, | ||
328 | 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, | ||
329 | 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F} }, | ||
330 | { "windows-1252", "CP 1252", 2252, | ||
331 | { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, | ||
332 | 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFD, 0x017D, 0xFFFD, | ||
333 | 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, | ||
334 | 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0xFFFD, 0x017E, 0x0178, | ||
335 | 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, | ||
336 | 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, | ||
337 | 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, | ||
338 | 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, | ||
339 | 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, | ||
340 | 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, | ||
341 | 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, | ||
342 | 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, | ||
343 | 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, | ||
344 | 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, | ||
345 | 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, | ||
346 | 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF} }, | ||
347 | { "windows-1253", "CP 1253", 2253, | ||
348 | { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, | ||
349 | 0xFFFD, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
350 | 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, | ||
351 | 0xFFFD, 0x2122, 0xFFFD, 0x203A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
352 | 0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, | ||
353 | 0x00A8, 0x00A9, 0xFFFD, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015, | ||
354 | 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7, | ||
355 | 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, | ||
356 | 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, | ||
357 | 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, | ||
358 | 0x03A0, 0x03A1, 0xFFFD, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, | ||
359 | 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, | ||
360 | 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, | ||
361 | 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, | ||
362 | 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, | ||
363 | 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFD} }, | ||
364 | { "windows-1254", "CP 1254", 2254, | ||
365 | { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, | ||
366 | 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD, | ||
367 | 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, | ||
368 | 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0xFFFD, 0xFFFD, 0x0178, | ||
369 | 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, | ||
370 | 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, | ||
371 | 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, | ||
372 | 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, | ||
373 | 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, | ||
374 | 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, | ||
375 | 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, | ||
376 | 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, | ||
377 | 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, | ||
378 | 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, | ||
379 | 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, | ||
380 | 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF} }, | ||
381 | { "windows-1255", "CP 1255", 2255, | ||
382 | { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, | ||
383 | 0x02C6, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
384 | 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, | ||
385 | 0x02DC, 0x2122, 0xFFFD, 0x203A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
386 | 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AA, 0x00A5, 0x00A6, 0x00A7, | ||
387 | 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, | ||
388 | 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, | ||
389 | 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, | ||
390 | 0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7, | ||
391 | 0x05B8, 0x05B9, 0xFFFD, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF, | ||
392 | 0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05F0, 0x05F1, 0x05F2, 0x05F3, | ||
393 | 0x05F4, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
394 | 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, | ||
395 | 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, | ||
396 | 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, | ||
397 | 0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0x200E, 0x200F, 0xFFFD} }, | ||
398 | { "windows-1256", "CP 1256", 2256, | ||
399 | { 0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, | ||
400 | 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, | ||
401 | 0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, | ||
402 | 0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA, | ||
403 | 0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, | ||
404 | 0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, | ||
405 | 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, | ||
406 | 0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F, | ||
407 | 0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, | ||
408 | 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, | ||
409 | 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7, | ||
410 | 0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0641, 0x0642, 0x0643, | ||
411 | 0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7, | ||
412 | 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF, | ||
413 | 0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7, | ||
414 | 0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2} }, | ||
415 | { "windows-1257", "CP 1257", 2257, | ||
416 | { 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021, | ||
417 | 0xFFFD, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0x00A8, 0x02C7, 0x00B8, | ||
418 | 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, | ||
419 | 0xFFFD, 0x2122, 0xFFFD, 0x203A, 0xFFFD, 0x00AF, 0x02DB, 0xFFFD, | ||
420 | 0x00A0, 0xFFFD, 0x00A2, 0x00A3, 0x00A4, 0xFFFD, 0x00A6, 0x00A7, | ||
421 | 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, | ||
422 | 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, | ||
423 | 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, | ||
424 | 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, | ||
425 | 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, | ||
426 | 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, | ||
427 | 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, | ||
428 | 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, | ||
429 | 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, | ||
430 | 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, | ||
431 | 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9} }, | ||
432 | { "windows-1258", "CP 1258", 2258, | ||
433 | { 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, | ||
434 | 0x02C6, 0x2030, 0xFFFD, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD, | ||
435 | 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, | ||
436 | 0x02DC, 0x2122, 0xFFFD, 0x203A, 0x0153, 0xFFFD, 0xFFFD, 0x0178, | ||
437 | 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, | ||
438 | 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, | ||
439 | 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, | ||
440 | 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, | ||
441 | 0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x00C5, 0x00C6, 0x00C7, | ||
442 | 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x0300, 0x00CD, 0x00CE, 0x00CF, | ||
443 | 0x0110, 0x00D1, 0x0309, 0x00D3, 0x00D4, 0x01A0, 0x00D6, 0x00D7, | ||
444 | 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x01AF, 0x0303, 0x00DF, | ||
445 | 0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x00E5, 0x00E6, 0x00E7, | ||
446 | 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0301, 0x00ED, 0x00EE, 0x00EF, | ||
447 | 0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7, | ||
448 | 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF} }, | ||
449 | |||
450 | { "Apple Roman", "Apple Roman", 0, | ||
451 | { 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, | ||
452 | 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, | ||
453 | 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, | ||
454 | 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, | ||
455 | 0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, | ||
456 | 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8, | ||
457 | 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, | ||
458 | 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x00E6, 0x00F8, | ||
459 | 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, | ||
460 | 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153, | ||
461 | 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, | ||
462 | 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, 0xFB01, 0xFB02, | ||
463 | 0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, | ||
464 | 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4, | ||
465 | 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, | ||
466 | 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7} }, | ||
467 | |||
468 | |||
469 | |||
470 | // This one is based on the charmap file | ||
471 | // /usr/share/i18n/charmaps/SAMI-WS2.gz, which is manually adapted | ||
472 | // to this format by Børre Gaup <boerre@subdimension.com> | ||
473 | { "WINSAMI2", "WS2", 0, | ||
474 | { 0x20AC, 0xFFFD, 0x010C, 0x0192, 0x010D, 0x01B7, 0x0292, 0x01EE, | ||
475 | 0x01EF, 0x0110, 0x0160, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD, | ||
476 | 0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, | ||
477 | 0x0111, 0x01E6, 0x0161, 0x203A, 0x0153, 0xFFFD, 0xFFFD, 0x0178, | ||
478 | 0x00A0, 0x01E7, 0x01E4, 0x00A3, 0x00A4, 0x01E5, 0x00A6, 0x00A7, | ||
479 | 0x00A8, 0x00A9, 0x021E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x021F, | ||
480 | 0x00B0, 0x00B1, 0x01E8, 0x01E9, 0x00B4, 0x00B5, 0x00B6, 0x00B7, | ||
481 | 0x014A, 0x014B, 0x0166, 0x00BB, 0x0167, 0x00BD, 0x017D, 0x017E, | ||
482 | 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, | ||
483 | 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, | ||
484 | 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, | ||
485 | 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, | ||
486 | 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, | ||
487 | 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, | ||
488 | 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, | ||
489 | 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF} }, | ||
490 | |||
491 | |||
492 | // this one is generated from the charmap file located in /usr/share/i18n/charmaps | ||
493 | // on most Linux distributions. The thai character set tis620 is byte by byte equivalent | ||
494 | // to iso8859-11, so we name it 8859-11 here, but recognise the name tis620 too. | ||
495 | |||
496 | // $ for A in 8 9 A B C D E F ; do for B in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do echo x${A}${B} 0xFFFD ; done ; done > /tmp/digits ; ( cut -c25- < TIS-620 ; cat /tmp/digits ) | awk '/^x[89ABCDEF]/{ print $1, $2 }' | sed -e 's/<U/0x/' -e 's/>//' | sort | uniq -w4 | cut -c5- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/tis-620 | ||
497 | { "TIS-620", "ISO 8859-11", 2259, // Thai character set mib enum taken from tis620 (which is byte by byte equivalent) | ||
498 | { 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
499 | 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
500 | 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
501 | 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, | ||
502 | 0xFFFD, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, | ||
503 | 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F, | ||
504 | 0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, | ||
505 | 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F, | ||
506 | 0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, | ||
507 | 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F, | ||
508 | 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, | ||
509 | 0x0E38, 0x0E39, 0x0E3A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x0E3F, | ||
510 | 0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, | ||
511 | 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F, | ||
512 | 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, | ||
513 | 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} }, | ||
514 | |||
515 | // if you add more chacater sets at the end, change LAST_MIB above | ||
516 | }; | ||
517 | |||
518 | const unicodetable& unicodetable::iterator::operator*() | ||
519 | { | ||
520 | return unicodevalues[offset]; | ||
521 | } | ||
522 | |||
523 | const unicodetable* unicodetable::iterator::operator->() | ||
524 | { | ||
525 | return unicodevalues+offset; | ||
526 | } | ||
527 | |||
528 | unsigned short unicodetable::unicodevalue(int offset, unsigned short c) | ||
529 | { | ||
530 | if (c > 127 && c < 256) | ||
531 | return unicodevalues[offset].values[c-128]; | ||
532 | else | ||
533 | return c; | ||
534 | } | ||
diff --git a/noncore/apps/opie-reader/CEncoding_tables.h b/noncore/apps/opie-reader/CEncoding_tables.h new file mode 100644 index 0000000..eb8744f --- a/dev/null +++ b/noncore/apps/opie-reader/CEncoding_tables.h | |||
@@ -0,0 +1,65 @@ | |||
1 | /**************************************************************************** | ||
2 | ** $Id$ | ||
3 | ** | ||
4 | ** Implementation of QTextCodec class | ||
5 | ** | ||
6 | ** Created : 981015 | ||
7 | ** | ||
8 | ** Copyright (C) 1998-2002 Trolltech AS. All rights reserved. | ||
9 | ** | ||
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | ||
11 | ** | ||
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 | ||
14 | ** LICENSE.QPL included in the packaging of this file. | ||
15 | ** | ||
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 | ||
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
19 | ** packaging of this file. | ||
20 | ** | ||
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | ||
22 | ** licenses may use this file in accordance with the Qt Commercial License | ||
23 | ** Agreement provided with the Software. | ||
24 | ** | ||
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. | ||
27 | ** | ||
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | ||
29 | ** information about Qt Commercial License Agreements. | ||
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | ||
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
32 | ** | ||
33 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
34 | ** not clear to you. | ||
35 | ** | ||
36 | **********************************************************************/ | ||
37 | |||
38 | |||
39 | #ifndef __CENCODING_TABLES_H | ||
40 | #define __CENCODING_TABLES_H | ||
41 | |||
42 | struct unicodetable | ||
43 | { | ||
44 | const char *mime; | ||
45 | const char * cs; | ||
46 | int mib; | ||
47 | unsigned short values[128]; | ||
48 | class iterator | ||
49 | { | ||
50 | int offset; | ||
51 | public: | ||
52 | iterator(int _i) : offset(_i) {} | ||
53 | const unicodetable& operator*(); | ||
54 | const unicodetable* operator->(); | ||
55 | iterator& operator++() { offset++; return *this; } | ||
56 | iterator& operator++(int) { offset++; return *this; } | ||
57 | bool operator!=(const iterator& rhs) { return (offset != rhs.offset); } | ||
58 | int reference() { return offset; } | ||
59 | }; | ||
60 | static iterator begin() { return iterator(0); } | ||
61 | static iterator end() { return iterator(28); } | ||
62 | static unsigned short unicodevalue(int offset, unsigned short c); | ||
63 | }; | ||
64 | |||
65 | #endif | ||
diff --git a/noncore/apps/opie-reader/CloseDialog.cpp b/noncore/apps/opie-reader/CloseDialog.cpp new file mode 100644 index 0000000..741fa67 --- a/dev/null +++ b/noncore/apps/opie-reader/CloseDialog.cpp | |||
@@ -0,0 +1,18 @@ | |||
1 | #include "CloseDialog.h" | ||
2 | #include "qlayout.h" | ||
3 | |||
4 | CCloseDialog::CCloseDialog(const QString& fname, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true) | ||
5 | { | ||
6 | setCaption(tr("Tidy-up")); | ||
7 | QVBoxLayout *tmp = new QVBoxLayout(this); | ||
8 | QVButtonGroup* vb = new QVButtonGroup(tr("Delete"), this); | ||
9 | tmp->addWidget(vb); | ||
10 | QString filestring = tr("Delete") + " " + fname; | ||
11 | file = new QCheckBox(filestring, vb); | ||
12 | marks = new QCheckBox(tr("Delete Bookmarks"), vb); | ||
13 | config = new QCheckBox(tr("Delete Configuration"), vb); | ||
14 | file->setChecked(false); | ||
15 | marks->setChecked(true); | ||
16 | config->setChecked(true); | ||
17 | if (fs) showMaximized(); | ||
18 | } | ||
diff --git a/noncore/apps/opie-reader/CloseDialog.h b/noncore/apps/opie-reader/CloseDialog.h new file mode 100644 index 0000000..62e6423 --- a/dev/null +++ b/noncore/apps/opie-reader/CloseDialog.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form interface generated from reading ui file 'Prefs.ui' | ||
3 | ** | ||
4 | ** Created: Tue Feb 11 23:53:32 2003 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #ifndef __CLOSEDIALOG_H | ||
10 | #define __CLOSEDIALOG_H | ||
11 | |||
12 | #include "useqpe.h" | ||
13 | #include <qvariant.h> | ||
14 | #include <qwidget.h> | ||
15 | #include <qtabdialog.h> | ||
16 | #include <qtabwidget.h> | ||
17 | #include <qspinbox.h> | ||
18 | #include <qcheckbox.h> | ||
19 | #include <qcombobox.h> | ||
20 | #include <qlineedit.h> | ||
21 | //#include <qpe/menubutton.h> | ||
22 | #include <qvbuttongroup.h> | ||
23 | |||
24 | class QVBoxLayout; | ||
25 | class QHBoxLayout; | ||
26 | class QGridLayout; | ||
27 | //class QCheckBox; | ||
28 | class QLabel; | ||
29 | //class QSpinBox; | ||
30 | |||
31 | class CCloseDialog : public QDialog | ||
32 | { | ||
33 | Q_OBJECT | ||
34 | QCheckBox *file, *marks, *config; | ||
35 | #ifndef USEQPE | ||
36 | void keyPressEvent(QKeyEvent* e) | ||
37 | { | ||
38 | switch (e->key()) | ||
39 | { | ||
40 | case Key_Escape: | ||
41 | e->accept(); | ||
42 | reject(); | ||
43 | break; | ||
44 | case Key_Space: | ||
45 | case Key_Return: | ||
46 | e->accept(); | ||
47 | accept(); | ||
48 | break; | ||
49 | default: | ||
50 | QWidget::keyPressEvent(e); | ||
51 | } | ||
52 | } | ||
53 | #endif | ||
54 | public: | ||
55 | CCloseDialog(const QString&, bool fs = true, QWidget* parent = 0, const char* name = 0); | ||
56 | ~CCloseDialog() {} | ||
57 | bool delFile() { return file->isChecked(); } | ||
58 | bool delMarks() { return marks->isChecked(); } | ||
59 | bool delConfig() { return config->isChecked(); } | ||
60 | |||
61 | }; | ||
62 | #endif // CPREFS_H | ||
diff --git a/noncore/apps/opie-reader/FixedFont.h b/noncore/apps/opie-reader/FixedFont.h new file mode 100755 index 0000000..8b67ffc --- a/dev/null +++ b/noncore/apps/opie-reader/FixedFont.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __FIXEDFONT_H | ||
2 | #define __FIXEDFONT_H | ||
3 | |||
4 | #define FIXEDFONT "courier" | ||
5 | |||
6 | #endif | ||
diff --git a/noncore/apps/opie-reader/Prefs.cpp b/noncore/apps/opie-reader/Prefs.cpp new file mode 100644 index 0000000..825608e --- a/dev/null +++ b/noncore/apps/opie-reader/Prefs.cpp | |||
@@ -0,0 +1,636 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form implementation generated from reading ui file 'Prefs.ui' | ||
3 | ** | ||
4 | ** Created: Tue Feb 11 23:53:35 2003 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #include "useqpe.h" | ||
10 | #include "Prefs.h" | ||
11 | |||
12 | #include <qcheckbox.h> | ||
13 | #include <qlabel.h> | ||
14 | #include <qpushbutton.h> | ||
15 | #include <qspinbox.h> | ||
16 | #include <qlayout.h> | ||
17 | #include <qvariant.h> | ||
18 | #include <qtooltip.h> | ||
19 | #include <qwhatsthis.h> | ||
20 | #include <qcombobox.h> | ||
21 | #include <qbuttongroup.h> | ||
22 | #include <qlineedit.h> | ||
23 | #ifdef USEQPE | ||
24 | #include <qpe/menubutton.h> | ||
25 | #include <qpe/fontdatabase.h> | ||
26 | #else | ||
27 | #include <qfontdatabase.h> | ||
28 | #endif | ||
29 | |||
30 | CLayoutPrefs::CLayoutPrefs( QWidget* parent, const char* name, WFlags fl ) | ||
31 | : QWidget( parent, name, fl ) | ||
32 | { | ||
33 | QHBoxLayout* hb = new QHBoxLayout(this); | ||
34 | QButtonGroup* bg = new QButtonGroup(2, Qt::Horizontal, "Text", this); | ||
35 | hb->addWidget(bg); | ||
36 | |||
37 | StripCR = new QCheckBox( bg ); | ||
38 | StripCR->setText( tr( "Strip CR" ) ); | ||
39 | |||
40 | Dehyphen = new QCheckBox( bg ); | ||
41 | Dehyphen->setText( tr( "Dehyphen" ) ); | ||
42 | |||
43 | SingleSpace = new QCheckBox( bg ); | ||
44 | SingleSpace->setText( tr( "Single Space" ) ); | ||
45 | |||
46 | Unindent = new QCheckBox( bg ); | ||
47 | Unindent->setText( tr( "Unindent" ) ); | ||
48 | |||
49 | Reparagraph = new QCheckBox( bg ); | ||
50 | Reparagraph->setText( tr( "Reparagraph" ) ); | ||
51 | |||
52 | DoubleSpace = new QCheckBox( bg ); | ||
53 | DoubleSpace->setText( tr( "Double Space" ) ); | ||
54 | |||
55 | Remap = new QCheckBox( bg ); | ||
56 | Remap->setText( tr( "Remap" ) ); | ||
57 | |||
58 | Embolden = new QCheckBox( bg ); | ||
59 | Embolden->setText( tr( "Embolden" ) ); | ||
60 | |||
61 | FullJustify = new QCheckBox( bg ); | ||
62 | FullJustify->setText( tr( "Full Justify" ) ); | ||
63 | |||
64 | } | ||
65 | |||
66 | /* | ||
67 | * Destroys the object and frees any allocated resources | ||
68 | */ | ||
69 | CLayoutPrefs::~CLayoutPrefs() | ||
70 | { | ||
71 | // no need to delete child widgets, Qt does it all for us | ||
72 | } | ||
73 | |||
74 | |||
75 | |||
76 | CLayoutPrefs2::CLayoutPrefs2( QWidget* parent, const char* name, WFlags fl ) | ||
77 | : QWidget( parent, name, fl ) | ||
78 | { | ||
79 | |||
80 | QVBoxLayout* vb = new QVBoxLayout(this); | ||
81 | QGridLayout* gl = new QGridLayout(vb, 4, 3); | ||
82 | |||
83 | QLabel *TextLabel; | ||
84 | |||
85 | TextLabel = new QLabel( this, "TextLabel1" ); | ||
86 | TextLabel->setText( tr( "Indent" ) ); | ||
87 | gl->addWidget(TextLabel, 0, 0); | ||
88 | |||
89 | |||
90 | TextLabel = new QLabel( this ); | ||
91 | TextLabel->setText( tr( "Page\nOverlap" ) ); | ||
92 | gl->addWidget(TextLabel, 0, 1); | ||
93 | |||
94 | TextLabel = new QLabel( this ); | ||
95 | TextLabel->setText( tr( "Graphics\nZoom" ) ); | ||
96 | gl->addWidget(TextLabel, 0, 2); | ||
97 | |||
98 | Indent = new QSpinBox( this, "Indent" ); | ||
99 | Indent->setRange(0,20); | ||
100 | gl->addWidget(Indent, 1, 0); | ||
101 | |||
102 | pageoverlap = new QSpinBox( this ); | ||
103 | pageoverlap->setRange(0,20); | ||
104 | gl->addWidget(pageoverlap, 1, 1); | ||
105 | |||
106 | gfxzoom = new QSpinBox( this ); | ||
107 | gfxzoom->setRange(0,100); | ||
108 | gl->addWidget(gfxzoom, 1, 2); | ||
109 | |||
110 | TextLabel = new QLabel( this, "TextLabel4" ); | ||
111 | TextLabel->setText( tr( "Margin" ) ); | ||
112 | gl->addWidget(TextLabel, 2, 0); | ||
113 | |||
114 | TextLabel = new QLabel( this ); | ||
115 | TextLabel->setText( tr( "Paragraph\nLeading" ) ); | ||
116 | gl->addWidget(TextLabel, 2, 1); | ||
117 | |||
118 | TextLabel = new QLabel( this ); | ||
119 | TextLabel->setText( tr( "Line\nLeading" ) ); | ||
120 | gl->addWidget(TextLabel, 2, 2); | ||
121 | |||
122 | Margin = new QSpinBox( this, "Margin" ); | ||
123 | Margin->setRange(0, 100); | ||
124 | gl->addWidget(Margin, 3, 0); | ||
125 | |||
126 | ParaLead = new QSpinBox( this ); | ||
127 | ParaLead->setRange(-5, 50); | ||
128 | gl->addWidget(ParaLead, 3, 1); | ||
129 | |||
130 | LineLead = new QSpinBox( this ); | ||
131 | LineLead->setRange(-5, 50); | ||
132 | gl->addWidget(LineLead, 3, 2); | ||
133 | |||
134 | gl = new QGridLayout(vb, 2, 2); | ||
135 | |||
136 | TextLabel = new QLabel( this); | ||
137 | TextLabel->setText( tr( "Markup" ) ); | ||
138 | gl->addWidget(TextLabel, 0, 0, Qt::AlignBottom); | ||
139 | TextLabel = new QLabel( this); | ||
140 | TextLabel->setText( tr( "Font" ) ); | ||
141 | gl->addWidget(TextLabel, 0, 1, Qt::AlignBottom); | ||
142 | |||
143 | |||
144 | #ifdef USECOMBO | ||
145 | Markup = new QComboBox( this); | ||
146 | #else | ||
147 | Markup = new MenuButton( this); | ||
148 | #endif | ||
149 | Markup->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
150 | Markup->insertItem("Auto"); | ||
151 | Markup->insertItem("None"); | ||
152 | Markup->insertItem("Text"); | ||
153 | Markup->insertItem("HTML"); | ||
154 | Markup->insertItem("PML"); | ||
155 | gl->addWidget(Markup, 1, 0, Qt::AlignTop); | ||
156 | |||
157 | #ifdef USECOMBO | ||
158 | fontselector = new QComboBox( this); | ||
159 | #else | ||
160 | fontselector = new MenuButton( this); | ||
161 | #endif | ||
162 | fontselector->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
163 | { | ||
164 | #ifdef USEQPE | ||
165 | FontDatabase f; | ||
166 | #else | ||
167 | QFontDatabase f; | ||
168 | #endif | ||
169 | QStringList flist = f.families(); | ||
170 | for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) | ||
171 | { | ||
172 | fontselector->insertItem(*nm); | ||
173 | } | ||
174 | } // delete the FontDatabase!!! | ||
175 | gl->addWidget(fontselector, 1, 1, Qt::AlignTop); | ||
176 | } | ||
177 | /* | ||
178 | CLayoutPrefs2::CLayoutPrefs2( QWidget* parent, const char* name, WFlags fl ) | ||
179 | : QWidget( parent, name, fl ) | ||
180 | { | ||
181 | QHBoxLayout* hb = new QHBoxLayout(this); | ||
182 | |||
183 | QVBoxLayout* vb = new QVBoxLayout; | ||
184 | hb->addLayout(vb); | ||
185 | |||
186 | QLabel *TextLabel; | ||
187 | |||
188 | TextLabel = new QLabel( this, "TextLabel1" ); | ||
189 | TextLabel->setText( tr( "Indent" ) ); | ||
190 | vb->addWidget( TextLabel, 0, Qt::AlignBottom ); | ||
191 | Indent = new QSpinBox( this, "Indent" ); | ||
192 | Indent->setRange(0,20); | ||
193 | vb->addWidget( Indent, 0, Qt::AlignLeft ); | ||
194 | |||
195 | TextLabel = new QLabel( this ); | ||
196 | TextLabel->setText( tr( "Page\nOverlap" ) ); | ||
197 | vb->addWidget( TextLabel, 0, Qt::AlignBottom ); | ||
198 | pageoverlap = new QSpinBox( this ); | ||
199 | pageoverlap->setRange(0,20); | ||
200 | vb->addWidget( pageoverlap, 0, Qt::AlignLeft ); | ||
201 | |||
202 | TextLabel = new QLabel( this ); | ||
203 | TextLabel->setText( tr( "Graphics\nZoom" ) ); | ||
204 | vb->addWidget( TextLabel, 0, Qt::AlignBottom ); | ||
205 | gfxzoom = new QSpinBox( this ); | ||
206 | gfxzoom->setRange(0,100); | ||
207 | vb->addWidget( gfxzoom, 0, Qt::AlignLeft ); | ||
208 | |||
209 | vb->addStretch(); | ||
210 | |||
211 | vb = new QVBoxLayout; | ||
212 | hb->addLayout(vb); | ||
213 | |||
214 | TextLabel = new QLabel( this, "TextLabel4" ); | ||
215 | TextLabel->setText( tr( "Margin" ) ); | ||
216 | vb->addWidget( TextLabel, 0, Qt::AlignBottom ); | ||
217 | Margin = new QSpinBox( this, "Margin" ); | ||
218 | Margin->setRange(0, 100); | ||
219 | vb->addWidget( Margin, 0, Qt::AlignLeft ); | ||
220 | |||
221 | TextLabel = new QLabel( this ); | ||
222 | TextLabel->setText( tr( "Paragraph\nLeading" ) ); | ||
223 | vb->addWidget( TextLabel, 0, Qt::AlignBottom ); | ||
224 | ParaLead = new QSpinBox( this ); | ||
225 | ParaLead->setRange(-5, 50); | ||
226 | vb->addWidget( ParaLead, 0, Qt::AlignLeft ); | ||
227 | |||
228 | TextLabel = new QLabel( this ); | ||
229 | TextLabel->setText( tr( "Line\nLeading" ) ); | ||
230 | vb->addWidget( TextLabel, 0, Qt::AlignBottom ); | ||
231 | LineLead = new QSpinBox( this ); | ||
232 | LineLead->setRange(-5, 50); | ||
233 | vb->addWidget( LineLead, 0, Qt::AlignLeft ); | ||
234 | |||
235 | vb->addStretch(); | ||
236 | |||
237 | vb = new QVBoxLayout; | ||
238 | hb->addLayout(vb); | ||
239 | |||
240 | |||
241 | TextLabel = new QLabel( this); | ||
242 | TextLabel->setText( tr( "Markup" ) ); | ||
243 | vb->addWidget( TextLabel, 0, Qt::AlignBottom ); | ||
244 | Markup = new MenuButton( this); | ||
245 | Markup->insertItem("Auto"); | ||
246 | Markup->insertItem("None"); | ||
247 | Markup->insertItem("Text"); | ||
248 | Markup->insertItem("HTML"); | ||
249 | Markup->insertItem("PML"); | ||
250 | vb->addWidget( Markup, 0, Qt::AlignLeft ); | ||
251 | |||
252 | TextLabel = new QLabel( this); | ||
253 | TextLabel->setText( tr( "Font" ) ); | ||
254 | vb->addWidget( TextLabel, 0, Qt::AlignBottom ); | ||
255 | fontselector = new MenuButton( this); | ||
256 | fontselector->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
257 | { | ||
258 | FontDatabase f; | ||
259 | QStringList flist = f.families(); | ||
260 | for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) | ||
261 | { | ||
262 | fontselector->insertItem(*nm); | ||
263 | } | ||
264 | } // delete the FontDatabase!!! | ||
265 | vb->addWidget( fontselector, 0, Qt::AlignLeft ); | ||
266 | |||
267 | vb->addStretch(); | ||
268 | } | ||
269 | */ | ||
270 | /* | ||
271 | * Destroys the object and frees any allocated resources | ||
272 | */ | ||
273 | CLayoutPrefs2::~CLayoutPrefs2() | ||
274 | { | ||
275 | // no need to delete child widgets, Qt does it all for us | ||
276 | } | ||
277 | |||
278 | /* | ||
279 | CPluckerPrefs::CPluckerPrefs( QWidget* parent, const char* name, WFlags fl ) | ||
280 | : QWidget( parent, name, fl ) | ||
281 | { | ||
282 | Layout11 = new QVBoxLayout(this); | ||
283 | Layout11->setMargin( 0 ); | ||
284 | |||
285 | Depluck = new QCheckBox( this, "Depluck" ); | ||
286 | Depluck->setText( tr( "Depluck" ) ); | ||
287 | Layout11->addWidget( Depluck ); | ||
288 | |||
289 | Dejpluck = new QCheckBox( this, "Dejpluck" ); | ||
290 | Dejpluck->setText( tr( "Dejpluck" ) ); | ||
291 | Layout11->addWidget( Dejpluck ); | ||
292 | |||
293 | Continuous = new QCheckBox( this, "Continuous" ); | ||
294 | Continuous->setText( tr( "Continuous" ) ); | ||
295 | Layout11->addWidget( Continuous ); | ||
296 | |||
297 | } | ||
298 | |||
299 | CPluckerPrefs::~CPluckerPrefs() | ||
300 | { | ||
301 | // no need to delete child widgets, Qt does it all for us | ||
302 | } | ||
303 | */ | ||
304 | /* | ||
305 | CMiscPrefs::CMiscPrefs( QWidget* parent, const char* name, WFlags fl ) | ||
306 | : QWidget( parent, name, fl ) | ||
307 | { | ||
308 | |||
309 | QVBoxLayout* Layout11 = new QVBoxLayout(this); | ||
310 | Layout11->setMargin( 0 ); | ||
311 | |||
312 | |||
313 | QHBoxLayout* hl = new QHBoxLayout; | ||
314 | |||
315 | QLabel* TextLabel = new QLabel( this ); | ||
316 | TextLabel->setText( tr( "Action for\nSelect Button" ) ); | ||
317 | hl->addWidget(TextLabel); | ||
318 | |||
319 | action = new QComboBox( this ); | ||
320 | action->insertItem("Open file"); | ||
321 | action->insertItem("Autoscroll"); | ||
322 | action->insertItem("Mark"); | ||
323 | action->insertItem("Annotate"); | ||
324 | action->insertItem("Fullscreen"); | ||
325 | hl->addWidget( action ); | ||
326 | |||
327 | Layout11->addLayout(hl); | ||
328 | |||
329 | hl = new QHBoxLayout; | ||
330 | |||
331 | TextLabel = new QLabel( this ); | ||
332 | TextLabel->setText( tr( "Dictionary\nApplication" ) ); | ||
333 | hl->addWidget(TextLabel); | ||
334 | target = new QLineEdit(this); | ||
335 | hl->addWidget( target ); | ||
336 | |||
337 | Layout11->addLayout(hl); | ||
338 | |||
339 | |||
340 | QButtonGroup* bg = new QButtonGroup(1, Qt::Horizontal, "Selection Target", this); | ||
341 | Layout11->addWidget( bg ); | ||
342 | |||
343 | annotation = new QCheckBox( bg ); | ||
344 | annotation->setText( tr( "Annotation" ) ); | ||
345 | |||
346 | dictionary = new QCheckBox( bg ); | ||
347 | dictionary->setText( tr( "Dictionary" ) ); | ||
348 | |||
349 | clipboard = new QCheckBox( bg ); | ||
350 | clipboard->setText( tr( "Clipboard" ) ); | ||
351 | |||
352 | } | ||
353 | |||
354 | CMiscPrefs::~CMiscPrefs() | ||
355 | { | ||
356 | // no need to delete child widgets, Qt does it all for us | ||
357 | } | ||
358 | */ | ||
359 | |||
360 | CMiscPrefs::CMiscPrefs( QWidget* parent, const char* name, WFlags fl ) | ||
361 | : QWidget( parent, name, fl ) | ||
362 | { | ||
363 | |||
364 | QGridLayout* hl = new QGridLayout(this,1,2); | ||
365 | |||
366 | hl->setMargin( 0 ); | ||
367 | |||
368 | QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, "Select Action", this); | ||
369 | hl->addWidget( gb, 0, 0 ); | ||
370 | |||
371 | annotation = new QCheckBox( gb ); | ||
372 | annotation->setText( tr( "Annotation" ) ); | ||
373 | |||
374 | dictionary = new QCheckBox( gb ); | ||
375 | dictionary->setText( tr( "Dictionary" ) ); | ||
376 | |||
377 | clipboard = new QCheckBox( gb ); | ||
378 | clipboard->setText( tr( "Clipboard" ) ); | ||
379 | |||
380 | QButtonGroup* bg = new QButtonGroup(1, Qt::Horizontal, "Plucker", this); | ||
381 | hl->addWidget( bg, 0 , 1 ); | ||
382 | |||
383 | Depluck = new QCheckBox( bg ); | ||
384 | Depluck->setText( tr( "Depluck" ) ); | ||
385 | |||
386 | Dejpluck = new QCheckBox( bg ); | ||
387 | Dejpluck->setText( tr( "Dejpluck" ) ); | ||
388 | |||
389 | Continuous = new QCheckBox( bg ); | ||
390 | Continuous->setText( tr( "Continuous" ) ); | ||
391 | |||
392 | |||
393 | /* | ||
394 | |||
395 | QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, "Navigation", this); | ||
396 | TextLabel = new QLabel( gb ); | ||
397 | TextLabel->setText( tr( "Overlap" ) ); | ||
398 | QSpinBox* sb = new QSpinBox( gb ); | ||
399 | |||
400 | Internationalisation | ||
401 | Ideogram/Word | ||
402 | Set Width | ||
403 | Set Encoding | ||
404 | Set Font | ||
405 | */ | ||
406 | } | ||
407 | |||
408 | CMiscPrefs::~CMiscPrefs() | ||
409 | { | ||
410 | // no need to delete child widgets, Qt does it all for us | ||
411 | } | ||
412 | |||
413 | CPrefs::CPrefs(bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true) | ||
414 | { | ||
415 | setCaption(tr( "OpieReader Settings" ) ); | ||
416 | QTabWidget* td = new QTabWidget(this); | ||
417 | layout = new CLayoutPrefs(this); | ||
418 | layout2 = new CLayoutPrefs2(this); | ||
419 | misc = new CMiscPrefs(this); | ||
420 | button = new CButtonPrefs(this); | ||
421 | inter = new CInterPrefs(this); | ||
422 | td->addTab(layout, tr("Layout")); | ||
423 | td->addTab(layout2, tr("Layout(2)")); | ||
424 | td->addTab(inter, tr("Locale")); | ||
425 | td->addTab(misc, tr("Misc")); | ||
426 | td->addTab(button, tr("Buttons")); | ||
427 | QVBoxLayout* v = new QVBoxLayout(this); | ||
428 | v->addWidget(td); | ||
429 | |||
430 | if (fs) showMaximized(); | ||
431 | } | ||
432 | |||
433 | |||
434 | /* | ||
435 | |||
436 | Unicode | ||
437 | Ideo/Word | ||
438 | Width | ||
439 | Encoding | ||
440 | |||
441 | */ | ||
442 | |||
443 | #include "CEncoding_tables.h" | ||
444 | |||
445 | CInterPrefs::CInterPrefs( QWidget* parent, const char* name, WFlags fl ) | ||
446 | : QWidget( parent, name, fl ) | ||
447 | { | ||
448 | QHBoxLayout* hb = new QHBoxLayout(this); | ||
449 | |||
450 | QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, tr("International"), this); | ||
451 | |||
452 | hb->addWidget(gb); | ||
453 | |||
454 | QLabel *TextLabel; | ||
455 | |||
456 | ideogram = new QCheckBox( gb ); | ||
457 | ideogram->setText( tr( "Ideograms" ) ); | ||
458 | |||
459 | TextLabel = new QLabel( gb ); | ||
460 | TextLabel->setText( tr( "Ideogram Width" ) ); | ||
461 | ideogramwidth = new QSpinBox( gb ); | ||
462 | ideogramwidth->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
463 | ideogramwidth->setRange(1,200); | ||
464 | |||
465 | propfontchange = new QCheckBox( gb ); | ||
466 | propfontchange->setText( tr( "Apply font\nto dialogs" ) ); | ||
467 | |||
468 | TextLabel = new QLabel( gb ); | ||
469 | TextLabel->setText( tr( "Encoding" ) ); | ||
470 | #ifdef USECOMBO | ||
471 | encoding = new QComboBox(gb); | ||
472 | #else | ||
473 | encoding = new MenuButton(gb); | ||
474 | #endif | ||
475 | encoding->insertItem("Ascii"); | ||
476 | encoding->insertItem("UTF-8"); | ||
477 | encoding->insertItem("UCS-2(BE)"); | ||
478 | encoding->insertItem("USC-2(LE)"); | ||
479 | encoding->insertItem("Palm"); | ||
480 | for (unicodetable::iterator iter = unicodetable::begin(); iter != unicodetable::end(); iter++) | ||
481 | { | ||
482 | encoding->insertItem(iter->mime); | ||
483 | } | ||
484 | |||
485 | QVBoxLayout* vb = new QVBoxLayout; | ||
486 | |||
487 | gb = new QGroupBox(1, Qt::Horizontal, "Dictionary", this); | ||
488 | |||
489 | TextLabel = new QLabel( gb ); | ||
490 | TextLabel->setText( tr( "Application" ) ); | ||
491 | application = new QLineEdit(gb); | ||
492 | application->setFixedWidth(80); | ||
493 | |||
494 | TextLabel = new QLabel( gb ); | ||
495 | TextLabel->setText( tr( "Message" ) ); | ||
496 | message = new QLineEdit(gb); | ||
497 | message->setFixedWidth(80); | ||
498 | // message->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
499 | twotouch = new QCheckBox( gb ); | ||
500 | twotouch->setText( tr( "Two/One\nTouch" ) ); | ||
501 | |||
502 | SwapMouse = new QCheckBox( gb ); | ||
503 | SwapMouse->setText("Swap Tap\nActions"); | ||
504 | |||
505 | |||
506 | vb->addWidget(gb); | ||
507 | |||
508 | // vb->addStretch(); | ||
509 | hb->addLayout(vb); | ||
510 | } | ||
511 | |||
512 | CInterPrefs::~CInterPrefs() | ||
513 | { | ||
514 | // no need to delete child widgets, Qt does it all for us | ||
515 | } | ||
516 | |||
517 | |||
518 | |||
519 | #ifdef USECOMBO | ||
520 | void CButtonPrefs::populate(QComboBox *mb) | ||
521 | #else | ||
522 | void CButtonPrefs::populate(MenuButton *mb) | ||
523 | #endif | ||
524 | { | ||
525 | mb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
526 | mb->insertItem("<Nothing>"); | ||
527 | mb->insertItem("Open file"); | ||
528 | mb->insertItem("Autoscroll"); | ||
529 | mb->insertItem("Bookmark"); | ||
530 | mb->insertItem("Annotate"); | ||
531 | mb->insertItem("Fullscreen"); | ||
532 | |||
533 | mb->insertItem("Zoom in"); | ||
534 | mb->insertItem("Zoom out"); | ||
535 | mb->insertItem("Back"); | ||
536 | mb->insertItem("Forward"); | ||
537 | mb->insertItem("Home"); | ||
538 | mb->insertItem("Page up"); | ||
539 | mb->insertItem("Page down"); | ||
540 | mb->insertItem("Line up"); | ||
541 | mb->insertItem("Line down"); | ||
542 | mb->insertItem("Beginning"); | ||
543 | mb->insertItem("End"); | ||
544 | } | ||
545 | |||
546 | CButtonPrefs::CButtonPrefs( QWidget* parent, const char* name, WFlags fl ) | ||
547 | : QWidget( parent, name, fl ) | ||
548 | { | ||
549 | |||
550 | QGridLayout* hl = new QGridLayout(this,10,2); | ||
551 | |||
552 | hl->setMargin( 0 ); | ||
553 | |||
554 | QLabel* ql = new QLabel("Escape Button", this); | ||
555 | hl->addWidget(ql, 0, 0, Qt::AlignBottom); | ||
556 | #ifdef USECOMBO | ||
557 | escapeAction = new QComboBox( this ); | ||
558 | #else | ||
559 | escapeAction = new MenuButton( this ); | ||
560 | #endif | ||
561 | populate(escapeAction); | ||
562 | hl->addWidget(escapeAction, 1, 0, Qt::AlignTop | Qt::AlignLeft); | ||
563 | |||
564 | ql = new QLabel("Space Button", this); | ||
565 | hl->addWidget(ql, 2, 0, Qt::AlignBottom); | ||
566 | #ifdef USECOMBO | ||
567 | spaceAction = new QComboBox( this ); | ||
568 | #else | ||
569 | spaceAction = new MenuButton( this ); | ||
570 | #endif | ||
571 | populate(spaceAction); | ||
572 | hl->addWidget(spaceAction, 3, 0, Qt::AlignTop | Qt::AlignLeft); | ||
573 | |||
574 | ql = new QLabel("Return Button", this); | ||
575 | hl->addWidget(ql, 2, 1, Qt::AlignBottom); | ||
576 | #ifdef USECOMBO | ||
577 | returnAction = new QComboBox( this ); | ||
578 | #else | ||
579 | returnAction = new MenuButton( this ); | ||
580 | #endif | ||
581 | populate(returnAction); | ||
582 | hl->addWidget(returnAction, 3, 1, Qt::AlignTop | Qt::AlignLeft); | ||
583 | |||
584 | ql = new QLabel("Left Arrow", this); | ||
585 | hl->addWidget(ql, 4, 0, Qt::AlignBottom); | ||
586 | #ifdef USECOMBO | ||
587 | leftAction = new QComboBox( this ); | ||
588 | #else | ||
589 | leftAction = new MenuButton( this ); | ||
590 | #endif | ||
591 | populate(leftAction); | ||
592 | hl->addWidget(leftAction, 5, 0, Qt::AlignTop | Qt::AlignLeft); | ||
593 | leftScroll = new QCheckBox( tr("Scroll Speed"), this ); | ||
594 | hl->addWidget(leftScroll, 6, 0, Qt::AlignTop | Qt::AlignLeft); | ||
595 | |||
596 | ql = new QLabel("Right Arrow", this); | ||
597 | hl->addWidget(ql, 4, 1, Qt::AlignBottom); | ||
598 | #ifdef USECOMBO | ||
599 | rightAction = new QComboBox( this ); | ||
600 | #else | ||
601 | rightAction = new MenuButton( this ); | ||
602 | #endif | ||
603 | populate(rightAction); | ||
604 | hl->addWidget(rightAction, 5, 1, Qt::AlignTop | Qt::AlignLeft); | ||
605 | rightScroll = new QCheckBox( tr("Scroll Speed"), this ); | ||
606 | hl->addWidget(rightScroll, 6, 1, Qt::AlignTop | Qt::AlignLeft); | ||
607 | |||
608 | ql = new QLabel("Down Arrow", this); | ||
609 | hl->addWidget(ql, 7, 0, Qt::AlignBottom); | ||
610 | #ifdef USECOMBO | ||
611 | downAction = new QComboBox( this ); | ||
612 | #else | ||
613 | downAction = new MenuButton( this ); | ||
614 | #endif | ||
615 | populate(downAction); | ||
616 | hl->addWidget(downAction, 8, 0, Qt::AlignTop | Qt::AlignLeft); | ||
617 | downScroll = new QCheckBox( tr("Scroll Speed"), this ); | ||
618 | hl->addWidget(downScroll, 9, 0, Qt::AlignTop | Qt::AlignLeft); | ||
619 | |||
620 | ql = new QLabel("Up Arrow", this); | ||
621 | hl->addWidget(ql, 7, 1, Qt::AlignBottom); | ||
622 | #ifdef USECOMBO | ||
623 | upAction = new QComboBox( this ); | ||
624 | #else | ||
625 | upAction = new MenuButton( this ); | ||
626 | #endif | ||
627 | populate(upAction); | ||
628 | hl->addWidget(upAction, 8, 1, Qt::AlignTop | Qt::AlignLeft); | ||
629 | upScroll = new QCheckBox( tr("Scroll Speed"), this ); | ||
630 | hl->addWidget(upScroll, 9, 1, Qt::AlignTop | Qt::AlignLeft); | ||
631 | } | ||
632 | |||
633 | CButtonPrefs::~CButtonPrefs() | ||
634 | { | ||
635 | // no need to delete child widgets, Qt does it all for us | ||
636 | } | ||
diff --git a/noncore/apps/opie-reader/Prefs.h b/noncore/apps/opie-reader/Prefs.h new file mode 100644 index 0000000..37d8c9e --- a/dev/null +++ b/noncore/apps/opie-reader/Prefs.h | |||
@@ -0,0 +1,340 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form interface generated from reading ui file 'Prefs.ui' | ||
3 | ** | ||
4 | ** Created: Tue Feb 11 23:53:32 2003 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #ifndef CPREFS_H | ||
10 | #define CPREFS_H | ||
11 | #include "useqpe.h" | ||
12 | #include <qvariant.h> | ||
13 | #include <qwidget.h> | ||
14 | #include <qtabdialog.h> | ||
15 | #include <qtabwidget.h> | ||
16 | #include <qspinbox.h> | ||
17 | #include <qcheckbox.h> | ||
18 | #include <qcombobox.h> | ||
19 | #include <qlineedit.h> | ||
20 | #ifdef USEQPE | ||
21 | #include <qpe/menubutton.h> | ||
22 | #endif | ||
23 | //#include "opie.h" | ||
24 | |||
25 | //#ifdef OPIE | ||
26 | #define USECOMBO | ||
27 | //#endif | ||
28 | |||
29 | class QVBoxLayout; | ||
30 | class QHBoxLayout; | ||
31 | class QGridLayout; | ||
32 | //class QCheckBox; | ||
33 | class QLabel; | ||
34 | //class QSpinBox; | ||
35 | |||
36 | class CLayoutPrefs : public QWidget | ||
37 | { | ||
38 | |||
39 | public: | ||
40 | |||
41 | friend class CPrefs; | ||
42 | |||
43 | CLayoutPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
44 | ~CLayoutPrefs(); | ||
45 | |||
46 | QCheckBox* StripCR; | ||
47 | QCheckBox* Dehyphen; | ||
48 | QCheckBox* SingleSpace; | ||
49 | QCheckBox* Unindent; | ||
50 | QCheckBox* Reparagraph; | ||
51 | QCheckBox* DoubleSpace; | ||
52 | QCheckBox* Remap; | ||
53 | QCheckBox* Embolden; | ||
54 | QCheckBox* FullJustify; | ||
55 | }; | ||
56 | |||
57 | class CLayoutPrefs2 : public QWidget | ||
58 | { | ||
59 | |||
60 | public: | ||
61 | |||
62 | friend class CPrefs; | ||
63 | |||
64 | CLayoutPrefs2( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
65 | ~CLayoutPrefs2(); | ||
66 | |||
67 | QSpinBox* ParaLead; | ||
68 | QSpinBox* LineLead; | ||
69 | QSpinBox* Indent; | ||
70 | QSpinBox* Margin, *gfxzoom, *pageoverlap; | ||
71 | #ifdef USECOMBO | ||
72 | QComboBox *Markup, *fontselector; | ||
73 | #else | ||
74 | MenuButton *Markup, *fontselector; | ||
75 | #endif | ||
76 | }; | ||
77 | |||
78 | /* | ||
79 | class CPluckerPrefs : public QWidget | ||
80 | { | ||
81 | |||
82 | public: | ||
83 | |||
84 | friend class CPrefs; | ||
85 | |||
86 | CPluckerPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
87 | ~CPluckerPrefs(); | ||
88 | |||
89 | QCheckBox* Depluck; | ||
90 | QCheckBox* Dejpluck; | ||
91 | QCheckBox* Continuous; | ||
92 | protected: | ||
93 | |||
94 | QHBoxLayout* Layout5; | ||
95 | QVBoxLayout* Layout11; | ||
96 | QGridLayout* Layout4; | ||
97 | |||
98 | }; | ||
99 | */ | ||
100 | class CMiscPrefs : public QWidget | ||
101 | { | ||
102 | |||
103 | public: | ||
104 | |||
105 | friend class CPrefs; | ||
106 | |||
107 | CMiscPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
108 | ~CMiscPrefs(); | ||
109 | |||
110 | QCheckBox *annotation, *dictionary, *clipboard; | ||
111 | QCheckBox *Depluck, *Dejpluck, *Continuous; | ||
112 | }; | ||
113 | |||
114 | class CButtonPrefs : public QWidget | ||
115 | { | ||
116 | #ifdef USECOMBO | ||
117 | void populate(QComboBox*); | ||
118 | #else | ||
119 | void populate(MenuButton*); | ||
120 | #endif | ||
121 | public: | ||
122 | |||
123 | friend class CPrefs; | ||
124 | |||
125 | CButtonPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
126 | ~CButtonPrefs(); | ||
127 | |||
128 | #ifdef USECOMBO | ||
129 | QComboBox *returnAction, *spaceAction, *escapeAction, *leftAction, *rightAction, *upAction, *downAction; | ||
130 | #else | ||
131 | MenuButton *returnAction, *spaceAction, *escapeAction, *leftAction, *rightAction, *upAction, *downAction; | ||
132 | #endif | ||
133 | QCheckBox *leftScroll, *rightScroll, *upScroll, *downScroll; | ||
134 | }; | ||
135 | |||
136 | class CInterPrefs : public QWidget | ||
137 | { | ||
138 | |||
139 | public: | ||
140 | |||
141 | friend class CPrefs; | ||
142 | |||
143 | CInterPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
144 | ~CInterPrefs(); | ||
145 | |||
146 | QCheckBox *ideogram, *propfontchange, *SwapMouse, *twotouch; | ||
147 | #ifdef USECOMBO | ||
148 | QComboBox* encoding; | ||
149 | #else | ||
150 | MenuButton* encoding; | ||
151 | #endif | ||
152 | QSpinBox* ideogramwidth; | ||
153 | QLineEdit *application, *message; | ||
154 | }; | ||
155 | |||
156 | |||
157 | class CPrefs : public QDialog | ||
158 | { | ||
159 | Q_OBJECT | ||
160 | CLayoutPrefs* layout; | ||
161 | CLayoutPrefs2* layout2; | ||
162 | CMiscPrefs* misc; | ||
163 | CButtonPrefs* button; | ||
164 | CInterPrefs* inter; | ||
165 | |||
166 | void keyPressEvent(QKeyEvent* e) | ||
167 | { | ||
168 | switch (e->key()) | ||
169 | { | ||
170 | case Key_Escape: | ||
171 | e->accept(); | ||
172 | reject(); | ||
173 | break; | ||
174 | case Key_Space: | ||
175 | case Key_Return: | ||
176 | e->accept(); | ||
177 | accept(); | ||
178 | break; | ||
179 | default: | ||
180 | QWidget::keyPressEvent(e); | ||
181 | } | ||
182 | } | ||
183 | public: | ||
184 | CPrefs(bool fs = true, QWidget* parent = 0, const char* name = 0); | ||
185 | ~CPrefs() | ||
186 | { | ||
187 | } | ||
188 | bool StripCR() { return layout->StripCR->isChecked(); } | ||
189 | bool Dehyphen() { return layout->Dehyphen->isChecked(); } | ||
190 | bool SingleSpace() { return layout->SingleSpace->isChecked(); } | ||
191 | bool Unindent() { return layout->Unindent->isChecked(); } | ||
192 | bool Reparagraph() { return layout->Reparagraph->isChecked(); } | ||
193 | bool DoubleSpace() { return layout->DoubleSpace->isChecked(); } | ||
194 | bool Remap() { return layout->Remap->isChecked(); } | ||
195 | bool Embolden() { return layout->Embolden->isChecked(); } | ||
196 | bool FullJustify() { return layout->FullJustify->isChecked(); } | ||
197 | int ParaLead() { return layout2->ParaLead->value(); } | ||
198 | int LineLead() { return layout2->LineLead->value(); } | ||
199 | int Margin() { return layout2->Margin->value(); } | ||
200 | int Indent() { return layout2->Indent->value(); } | ||
201 | int Markup() { return layout2->Markup->currentItem(); } | ||
202 | QString Font() { return layout2->fontselector->currentText(); } | ||
203 | |||
204 | |||
205 | void StripCR(bool v) { layout->StripCR->setChecked(v); } | ||
206 | void Dehyphen(bool v) { layout->Dehyphen->setChecked(v); } | ||
207 | void SingleSpace(bool v) { layout->SingleSpace->setChecked(v); } | ||
208 | void Unindent(bool v) { layout->Unindent->setChecked(v); } | ||
209 | void Reparagraph(bool v) { layout->Reparagraph->setChecked(v); } | ||
210 | void DoubleSpace(bool v) { layout->DoubleSpace->setChecked(v); } | ||
211 | void Remap(bool v) { layout->Remap->setChecked(v); } | ||
212 | void Embolden(bool v) { layout->Embolden->setChecked(v); } | ||
213 | void FullJustify(bool v) { layout->FullJustify->setChecked(v); } | ||
214 | void ParaLead(int v) { layout2->ParaLead->setValue(v); } | ||
215 | void LineLead(int v) { layout2->LineLead->setValue(v); } | ||
216 | void Margin(int v) { layout2->Margin->setValue(v); } | ||
217 | void Indent(int v) { layout2->Indent->setValue(v); } | ||
218 | #ifdef USECOMBO | ||
219 | void Markup(int v) { layout2->Markup->setCurrentItem(v); } | ||
220 | #else | ||
221 | void Markup(int v) { layout2->Markup->select(v); } | ||
222 | #endif | ||
223 | #ifdef USECOMBO | ||
224 | void Font(QString& s) | ||
225 | { | ||
226 | for (int i = 1; i <= layout2->fontselector->count(); i++) | ||
227 | { | ||
228 | if (layout2->fontselector->text(i) == s) | ||
229 | { | ||
230 | layout2->fontselector->setCurrentItem(i); | ||
231 | break; | ||
232 | } | ||
233 | } | ||
234 | } | ||
235 | #else | ||
236 | void Font(QString& s) { layout2->fontselector->select(s); } | ||
237 | #endif | ||
238 | |||
239 | bool Depluck() { return misc->Depluck->isChecked(); } | ||
240 | void Depluck(bool v) { misc->Depluck->setChecked(v); } | ||
241 | bool Dejpluck() { return misc->Dejpluck->isChecked(); } | ||
242 | void Dejpluck(bool v) { misc->Dejpluck->setChecked(v); } | ||
243 | bool Continuous() { return misc->Continuous->isChecked(); } | ||
244 | void Continuous(bool v) { misc->Continuous->setChecked(v); } | ||
245 | bool SwapMouse() { return inter->SwapMouse->isChecked(); } | ||
246 | void SwapMouse(bool v) { inter->SwapMouse->setChecked(v); } | ||
247 | |||
248 | |||
249 | void dictApplication(const QString& v) { inter->application->setText(v); } | ||
250 | QString dictApplication() { return inter->application->text(); } | ||
251 | void dictMessage(const QString& v) { inter->message->setText(v); } | ||
252 | QString dictMessage() { return inter->message->text(); } | ||
253 | |||
254 | void miscannotation(bool v) { misc->annotation->setChecked(v); } | ||
255 | void miscdictionary(bool v) { misc->dictionary->setChecked(v); } | ||
256 | void miscclipboard(bool v) { misc->clipboard->setChecked(v); } | ||
257 | bool miscannotation() { return misc->annotation->isChecked(); } | ||
258 | bool miscdictionary() { return misc->dictionary->isChecked(); } | ||
259 | bool miscclipboard() { return misc->clipboard->isChecked(); } | ||
260 | |||
261 | int spaceAction() { return button->spaceAction->currentItem(); } | ||
262 | #ifdef USECOMBO | ||
263 | void spaceAction(int v) { button->spaceAction->setCurrentItem(v); } | ||
264 | #else | ||
265 | void spaceAction(int v) { button->spaceAction->select(v); } | ||
266 | #endif | ||
267 | int escapeAction() { return button->escapeAction->currentItem(); } | ||
268 | #ifdef USECOMBO | ||
269 | void escapeAction(int v) { button->escapeAction->setCurrentItem(v); } | ||
270 | #else | ||
271 | void escapeAction(int v) { button->escapeAction->select(v); } | ||
272 | #endif | ||
273 | int returnAction() { return button->returnAction->currentItem(); } | ||
274 | #ifdef USECOMBO | ||
275 | void returnAction(int v) { button->returnAction->setCurrentItem(v); } | ||
276 | #else | ||
277 | void returnAction(int v) { button->returnAction->select(v); } | ||
278 | #endif | ||
279 | int leftAction() { return button->leftAction->currentItem(); } | ||
280 | #ifdef USECOMBO | ||
281 | void leftAction(int v) { button->leftAction->setCurrentItem(v); } | ||
282 | #else | ||
283 | void leftAction(int v) { button->leftAction->select(v); } | ||
284 | #endif | ||
285 | int rightAction() { return button->rightAction->currentItem(); } | ||
286 | #ifdef USECOMBO | ||
287 | void rightAction(int v) { button->rightAction->setCurrentItem(v); } | ||
288 | #else | ||
289 | void rightAction(int v) { button->rightAction->select(v); } | ||
290 | #endif | ||
291 | int upAction() { return button->upAction->currentItem(); } | ||
292 | #ifdef USECOMBO | ||
293 | void upAction(int v) { button->upAction->setCurrentItem(v); } | ||
294 | #else | ||
295 | void upAction(int v) { button->upAction->select(v); } | ||
296 | #endif | ||
297 | int downAction() { return button->downAction->currentItem(); } | ||
298 | #ifdef USECOMBO | ||
299 | void downAction(int v) { button->downAction->setCurrentItem(v); } | ||
300 | #else | ||
301 | void downAction(int v) { button->downAction->select(v); } | ||
302 | #endif | ||
303 | bool leftScroll() { return button->leftScroll->isChecked(); } | ||
304 | void leftScroll(bool v) { button->leftScroll->setChecked(v); } | ||
305 | bool rightScroll() { return button->rightScroll->isChecked(); } | ||
306 | void rightScroll(bool v) { button->rightScroll->setChecked(v); } | ||
307 | bool upScroll() { return button->upScroll->isChecked(); } | ||
308 | void upScroll(bool v) { button->upScroll->setChecked(v); } | ||
309 | bool downScroll() { return button->downScroll->isChecked(); } | ||
310 | void downScroll(bool v) { button->downScroll->setChecked(v); } | ||
311 | |||
312 | |||
313 | int gfxsize() { return layout2->gfxzoom->value(); } | ||
314 | void gfxsize(int v) { layout2->gfxzoom->setValue(v); } | ||
315 | int pageoverlap() { return layout2->pageoverlap->value(); } | ||
316 | void pageoverlap(int v) { layout2->pageoverlap->setValue(v); } | ||
317 | |||
318 | bool twotouch() { return inter->twotouch->isChecked(); } | ||
319 | void twotouch(bool v) { inter->twotouch->setChecked(v); } | ||
320 | |||
321 | bool ideogram() { return inter->ideogram->isChecked(); } | ||
322 | void ideogram(bool v) { inter->ideogram->setChecked(v); } | ||
323 | |||
324 | int ideogramwidth() { return inter->ideogramwidth->value(); } | ||
325 | void ideogramwidth(int v) { inter->ideogramwidth->setValue(v); } | ||
326 | |||
327 | bool propfontchange() { return inter->propfontchange->isChecked(); } | ||
328 | void propfontchange(bool v) { inter->propfontchange->setChecked(v); } | ||
329 | |||
330 | int encoding() { return inter->encoding->currentItem(); } | ||
331 | #ifdef USECOMBO | ||
332 | void encoding(int v) { inter->encoding->setCurrentItem(v); } | ||
333 | #else | ||
334 | void encoding(int v) { inter->encoding->select(v); } | ||
335 | #endif | ||
336 | |||
337 | |||
338 | |||
339 | }; | ||
340 | #endif // CPREFS_H | ||
diff --git a/noncore/apps/opie-reader/ToolbarPrefs.cpp b/noncore/apps/opie-reader/ToolbarPrefs.cpp new file mode 100644 index 0000000..361bf97 --- a/dev/null +++ b/noncore/apps/opie-reader/ToolbarPrefs.cpp | |||
@@ -0,0 +1,499 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form implementation generated from reading ui file 'Prefs.ui' | ||
3 | ** | ||
4 | ** Created: Tue Feb 11 23:53:35 2003 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #include "useqpe.h" | ||
10 | #include "ToolbarPrefs.h" | ||
11 | |||
12 | #include <qcheckbox.h> | ||
13 | #include <qlabel.h> | ||
14 | #include <qpushbutton.h> | ||
15 | #include <qspinbox.h> | ||
16 | #include <qlayout.h> | ||
17 | #include <qvariant.h> | ||
18 | #include <qtooltip.h> | ||
19 | #include <qwhatsthis.h> | ||
20 | #include <qcombobox.h> | ||
21 | #include <qbuttongroup.h> | ||
22 | #include <qlineedit.h> | ||
23 | #ifdef USEQPE | ||
24 | #include <qpe/menubutton.h> | ||
25 | #endif | ||
26 | |||
27 | CBarPrefs::CBarPrefs(const QString& appdir, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true), config( appdir ) | ||
28 | { | ||
29 | setCaption(tr( "Toolbar Settings" ) ); | ||
30 | QTabWidget* td = new QTabWidget(this); | ||
31 | misc = new CMiscBarPrefs(this); | ||
32 | filebar = new CFileBarPrefs(config, this); | ||
33 | navbar = new CNavBarPrefs(config, this); | ||
34 | viewbar = new CViewBarPrefs(config, this); | ||
35 | markbar = new CMarkBarPrefs(config, this); | ||
36 | indbar = new CIndBarPrefs(config, this); | ||
37 | td->addTab(filebar, tr("File")); | ||
38 | td->addTab(navbar, tr("Navigation")); | ||
39 | td->addTab(viewbar, tr("View")); | ||
40 | td->addTab(markbar, tr("Marks")); | ||
41 | td->addTab(indbar, tr("Indicators")); | ||
42 | td->addTab(misc, tr("Policy")); | ||
43 | QVBoxLayout* v = new QVBoxLayout(this); | ||
44 | v->addWidget(td); | ||
45 | |||
46 | if (fs) showMaximized(); | ||
47 | } | ||
48 | |||
49 | /* | ||
50 | CBarPrefs1::CBarPrefs1( Config& _config, QWidget* parent, const char* name, WFlags fl ) | ||
51 | : QWidget( parent, name, fl ), config(_config) | ||
52 | { | ||
53 | config.setGroup( "Toolbar" ); | ||
54 | QVBoxLayout* vb = new QVBoxLayout(this); | ||
55 | |||
56 | QGroupBox* bg = new QGroupBox(3, Qt::Horizontal, "File", this); | ||
57 | vb->addWidget(bg); | ||
58 | |||
59 | open = new QCheckBox( tr("Open"), bg ); | ||
60 | open->setChecked(config.readBoolEntry( "Open", false )); | ||
61 | connect(open, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
62 | close = new QCheckBox( tr("Close"), bg ); | ||
63 | close->setChecked(config.readBoolEntry( "Close", false )); | ||
64 | connect(close, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
65 | info = new QCheckBox( tr("Info"), bg ); | ||
66 | info->setChecked(config.readBoolEntry( "Info", false )); | ||
67 | connect(info, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
68 | twotouch = new QCheckBox( tr("Two/One\nTouch"), bg ); | ||
69 | twotouch->setChecked(config.readBoolEntry( "Two/One Touch", false )); | ||
70 | connect(twotouch, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
71 | find = new QCheckBox( tr("Find"), bg ); | ||
72 | find->setChecked(config.readBoolEntry( "Find", false )); | ||
73 | connect(find, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
74 | |||
75 | bg = new QGroupBox(2, Qt::Horizontal, "Navigation", this); | ||
76 | vb->addWidget(bg); | ||
77 | scroll = new QCheckBox( tr("Scroll"), bg ); | ||
78 | scroll->setChecked(config.readBoolEntry( "Scroll", false )); | ||
79 | connect(scroll, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
80 | navigation = new QCheckBox( tr("Back/Home/Forward"), bg ); | ||
81 | navigation->setChecked(config.readBoolEntry( "Back/Home/Forward", false )); | ||
82 | connect(navigation, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
83 | page = new QCheckBox( tr("Page\nUp/Down"), bg ); | ||
84 | page->setChecked(config.readBoolEntry( "Page Up/Down", false )); | ||
85 | connect(page, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
86 | startend = new QCheckBox( tr("Goto Start/End"), bg ); | ||
87 | startend->setChecked(config.readBoolEntry( "Goto Start/End", false )); | ||
88 | connect(startend, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
89 | jump = new QCheckBox( tr("Jump"), bg ); | ||
90 | jump->setChecked(config.readBoolEntry( "Jump", false )); | ||
91 | connect(jump, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
92 | pageline = new QCheckBox( tr("Page/Line Scroll"), bg ); | ||
93 | pageline->setChecked(config.readBoolEntry( "Page/Line Scroll", false )); | ||
94 | connect(pageline, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
95 | m_isChanged = false; | ||
96 | } | ||
97 | |||
98 | void CBarPrefs1::saveall() | ||
99 | { | ||
100 | config.setGroup( "Toolbar" ); | ||
101 | config.writeEntry( "Open", open->isChecked()); | ||
102 | config.writeEntry( "Close", close->isChecked()); | ||
103 | config.writeEntry( "Info", info->isChecked()); | ||
104 | config.writeEntry( "Two/One Touch", twotouch->isChecked()); | ||
105 | config.writeEntry( "Find", find->isChecked()); | ||
106 | config.writeEntry( "Scroll", scroll->isChecked()); | ||
107 | config.writeEntry( "Back/Home/Forward", navigation->isChecked()); | ||
108 | config.writeEntry( "Page Up/Down", page->isChecked()); | ||
109 | config.writeEntry( "Goto Start/End", startend->isChecked()); | ||
110 | config.writeEntry( "Jump", jump->isChecked()); | ||
111 | config.writeEntry( "Page/Line Scroll", pageline->isChecked()); | ||
112 | } | ||
113 | |||
114 | CBarPrefs1::~CBarPrefs1() | ||
115 | { | ||
116 | } | ||
117 | */ | ||
118 | /* | ||
119 | CBarPrefs2::CBarPrefs2( Config& _config, QWidget* parent, const char* name, WFlags fl ) | ||
120 | : QWidget( parent, name, fl ), config(_config) | ||
121 | { | ||
122 | QVBoxLayout* vb = new QVBoxLayout(this); | ||
123 | |||
124 | QGroupBox* bg = new QGroupBox(3, Qt::Horizontal, "View", this); | ||
125 | vb->addWidget(bg); | ||
126 | |||
127 | config.setGroup( "Toolbar" ); | ||
128 | |||
129 | fullscreen = new QCheckBox( tr("Fullscreen"), bg ); | ||
130 | fullscreen->setChecked(config.readBoolEntry( "Fullscreen", false )); | ||
131 | connect(fullscreen, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
132 | zoom = new QCheckBox( tr("Zoom"), bg ); | ||
133 | zoom->setChecked(config.readBoolEntry( "Zoom In/Out", false )); | ||
134 | connect(zoom, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
135 | setfont = new QCheckBox( tr("Set Font"), bg ); | ||
136 | setfont->setChecked(config.readBoolEntry( "Set Font", false )); | ||
137 | connect(setfont, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
138 | |||
139 | encoding = new QCheckBox( tr("Encoding"), bg ); | ||
140 | encoding->setChecked(config.readBoolEntry("Encoding Select", false)); | ||
141 | connect(encoding, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
142 | ideogram = new QCheckBox( tr("Ideogram"), bg ); | ||
143 | ideogram->setChecked(config.readBoolEntry("Ideogram Mode", false)); | ||
144 | connect(ideogram, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
145 | |||
146 | bg = new QGroupBox(3, Qt::Horizontal, "Marks", this); | ||
147 | vb->addWidget(bg); | ||
148 | mark = new QCheckBox( tr("Bookmark"), bg ); | ||
149 | mark->setChecked(config.readBoolEntry( "Mark", false )); | ||
150 | connect(mark, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
151 | annotate = new QCheckBox( tr("Annotate"), bg ); | ||
152 | annotate->setChecked(config.readBoolEntry( "Annotate", false )); | ||
153 | connect(annotate, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
154 | go_to = new QCheckBox( tr("Goto"), bg ); | ||
155 | go_to->setChecked(config.readBoolEntry( "Goto", false )); | ||
156 | connect(go_to, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
157 | Delete = new QCheckBox( tr("Delete"), bg ); | ||
158 | Delete->setChecked(config.readBoolEntry( "Delete", false )); | ||
159 | connect(Delete, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
160 | autogen = new QCheckBox( tr("Autogen"), bg ); | ||
161 | autogen->setChecked(config.readBoolEntry( "Autogen", false )); | ||
162 | connect(autogen, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
163 | clear = new QCheckBox( tr("Clear"), bg ); | ||
164 | clear->setChecked(config.readBoolEntry( "Clear", false )); | ||
165 | connect(clear, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
166 | save = new QCheckBox( tr("Save"), bg ); | ||
167 | save->setChecked(config.readBoolEntry( "Save", false )); | ||
168 | connect(save, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
169 | tidy = new QCheckBox( tr("Tidy"), bg ); | ||
170 | tidy->setChecked(config.readBoolEntry( "Tidy", false )); | ||
171 | connect(tidy, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
172 | block = new QCheckBox( tr("Mark/Copy"), bg ); | ||
173 | block->setChecked(config.readBoolEntry( "Start/Copy Block", false )); | ||
174 | connect(block, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
175 | |||
176 | bg = new QGroupBox(1, Qt::Horizontal, "Indicators", this); | ||
177 | vb->addWidget(bg); | ||
178 | indannotate = new QCheckBox( tr("Annotation"), bg ); | ||
179 | indannotate->setChecked(config.readBoolEntry( "Annotation indicator", false )); | ||
180 | connect(indannotate, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
181 | m_isChanged = false; | ||
182 | } | ||
183 | |||
184 | void CBarPrefs2::saveall() | ||
185 | { | ||
186 | config.setGroup( "Toolbar" ); | ||
187 | config.writeEntry( "Fullscreen", fullscreen->isChecked()); | ||
188 | config.writeEntry( "Zoom In/Out", zoom->isChecked()); | ||
189 | config.writeEntry( "Set Font", setfont->isChecked()); | ||
190 | config.writeEntry("Encoding Select", encoding->isChecked()); | ||
191 | config.writeEntry("Ideogram Mode", ideogram->isChecked()); | ||
192 | |||
193 | config.writeEntry( "Mark", mark->isChecked()); | ||
194 | config.writeEntry( "Annotate", annotate->isChecked()); | ||
195 | config.writeEntry( "Goto", go_to->isChecked()); | ||
196 | config.writeEntry( "Delete", Delete->isChecked()); | ||
197 | config.writeEntry( "Autogen", autogen->isChecked()); | ||
198 | config.writeEntry( "Clear", clear->isChecked()); | ||
199 | config.writeEntry( "Save", save->isChecked()); | ||
200 | config.writeEntry( "Tidy", tidy->isChecked()); | ||
201 | config.writeEntry( "Start/Copy Block", block->isChecked()); | ||
202 | config.writeEntry( "Annotation indicator", indannotate->isChecked()); | ||
203 | } | ||
204 | |||
205 | CBarPrefs2::~CBarPrefs2() | ||
206 | { | ||
207 | } | ||
208 | */ | ||
209 | |||
210 | CFileBarPrefs::CFileBarPrefs( Config& _config, QWidget* parent, const char* name, WFlags fl ) | ||
211 | : QWidget( parent, name, fl ), config(_config) | ||
212 | { | ||
213 | config.setGroup( "Toolbar" ); | ||
214 | QVBoxLayout* vb = new QVBoxLayout(this); | ||
215 | |||
216 | QGroupBox* bg = new QGroupBox(2, Qt::Horizontal, "File", this); | ||
217 | vb->addWidget(bg); | ||
218 | |||
219 | open = new QCheckBox( tr("Open"), bg ); | ||
220 | open->setChecked(config.readBoolEntry( "Open", false )); | ||
221 | connect(open, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
222 | close = new QCheckBox( tr("Close"), bg ); | ||
223 | close->setChecked(config.readBoolEntry( "Close", false )); | ||
224 | connect(close, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
225 | info = new QCheckBox( tr("Info"), bg ); | ||
226 | info->setChecked(config.readBoolEntry( "Info", false )); | ||
227 | connect(info, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
228 | twotouch = new QCheckBox( tr("Two/One\nTouch"), bg ); | ||
229 | twotouch->setChecked(config.readBoolEntry( "Two/One Touch", false )); | ||
230 | connect(twotouch, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
231 | find = new QCheckBox( tr("Find"), bg ); | ||
232 | find->setChecked(config.readBoolEntry( "Find", false )); | ||
233 | connect(find, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
234 | m_isChanged = false; | ||
235 | } | ||
236 | |||
237 | void CFileBarPrefs::saveall() | ||
238 | { | ||
239 | config.setGroup( "Toolbar" ); | ||
240 | config.writeEntry( "Open", open->isChecked()); | ||
241 | config.writeEntry( "Close", close->isChecked()); | ||
242 | config.writeEntry( "Info", info->isChecked()); | ||
243 | config.writeEntry( "Two/One Touch", twotouch->isChecked()); | ||
244 | config.writeEntry( "Find", find->isChecked()); | ||
245 | } | ||
246 | |||
247 | CFileBarPrefs::~CFileBarPrefs() | ||
248 | { | ||
249 | } | ||
250 | |||
251 | CNavBarPrefs::CNavBarPrefs( Config& _config, QWidget* parent, const char* name, WFlags fl ) | ||
252 | : QWidget( parent, name, fl ), config(_config) | ||
253 | { | ||
254 | config.setGroup( "Toolbar" ); | ||
255 | QVBoxLayout* vb = new QVBoxLayout(this); | ||
256 | |||
257 | QGroupBox* bg = new QGroupBox(2, Qt::Horizontal, "Navigation", this); | ||
258 | vb->addWidget(bg); | ||
259 | scroll = new QCheckBox( tr("Scroll"), bg ); | ||
260 | scroll->setChecked(config.readBoolEntry( "Scroll", false )); | ||
261 | connect(scroll, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
262 | |||
263 | navback = new QCheckBox( tr("Back"), bg ); | ||
264 | navback->setChecked(config.readBoolEntry( "Back", false )); | ||
265 | connect(navback, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
266 | navhome = new QCheckBox( tr("Home"), bg ); | ||
267 | navhome->setChecked(config.readBoolEntry( "Home", false )); | ||
268 | connect(navhome, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
269 | navforward = new QCheckBox( tr("Forward"), bg ); | ||
270 | navforward->setChecked(config.readBoolEntry( "Forward", false )); | ||
271 | connect(navforward, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
272 | |||
273 | pageup = new QCheckBox( tr("Page Up"), bg ); | ||
274 | pageup->setChecked(config.readBoolEntry( "Page Up", false )); | ||
275 | connect(pageup, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
276 | pagedown = new QCheckBox( tr("Page Down"), bg ); | ||
277 | pagedown->setChecked(config.readBoolEntry( "Page Down", false )); | ||
278 | connect(pagedown, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
279 | gotostart = new QCheckBox( tr("Goto Start"), bg ); | ||
280 | gotostart->setChecked(config.readBoolEntry( "Goto Start", false )); | ||
281 | connect(gotostart, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
282 | gotoend = new QCheckBox( tr("Goto End"), bg ); | ||
283 | gotoend->setChecked(config.readBoolEntry( "Goto End", false )); | ||
284 | connect(gotoend, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
285 | jump = new QCheckBox( tr("Jump"), bg ); | ||
286 | jump->setChecked(config.readBoolEntry( "Jump", false )); | ||
287 | connect(jump, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
288 | pageline = new QCheckBox( tr("Page/Line Scroll"), bg ); | ||
289 | pageline->setChecked(config.readBoolEntry( "Page/Line Scroll", false )); | ||
290 | connect(pageline, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
291 | m_isChanged = false; | ||
292 | } | ||
293 | |||
294 | void CNavBarPrefs::saveall() | ||
295 | { | ||
296 | config.setGroup( "Toolbar" ); | ||
297 | config.writeEntry( "Scroll", scroll->isChecked()); | ||
298 | config.writeEntry( "Back", navback->isChecked()); | ||
299 | config.writeEntry( "Home", navhome->isChecked()); | ||
300 | config.writeEntry( "Forward", navforward->isChecked()); | ||
301 | config.writeEntry( "Page Up", pageup->isChecked()); | ||
302 | config.writeEntry( "Page Down", pagedown->isChecked()); | ||
303 | config.writeEntry( "Goto Start", gotostart->isChecked()); | ||
304 | config.writeEntry( "Goto End", gotoend->isChecked()); | ||
305 | config.writeEntry( "Jump", jump->isChecked()); | ||
306 | config.writeEntry( "Page/Line Scroll", pageline->isChecked()); | ||
307 | } | ||
308 | |||
309 | CNavBarPrefs::~CNavBarPrefs() | ||
310 | { | ||
311 | } | ||
312 | |||
313 | CViewBarPrefs::CViewBarPrefs( Config& _config, QWidget* parent, const char* name, WFlags fl ) | ||
314 | : QWidget( parent, name, fl ), config(_config) | ||
315 | { | ||
316 | QVBoxLayout* vb = new QVBoxLayout(this); | ||
317 | |||
318 | QGroupBox* bg = new QGroupBox(2, Qt::Horizontal, "View", this); | ||
319 | vb->addWidget(bg); | ||
320 | |||
321 | config.setGroup( "Toolbar" ); | ||
322 | |||
323 | fullscreen = new QCheckBox( tr("Fullscreen"), bg ); | ||
324 | fullscreen->setChecked(config.readBoolEntry( "Fullscreen", false )); | ||
325 | connect(fullscreen, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
326 | zoomin = new QCheckBox( tr("Zoom In"), bg ); | ||
327 | zoomin->setChecked(config.readBoolEntry( "Zoom In", false )); | ||
328 | connect(zoomin, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
329 | zoomout = new QCheckBox( tr("Zoom Out"), bg ); | ||
330 | zoomout->setChecked(config.readBoolEntry( "Zoom Out", false )); | ||
331 | connect(zoomout, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
332 | setfont = new QCheckBox( tr("Set Font"), bg ); | ||
333 | setfont->setChecked(config.readBoolEntry( "Set Font", false )); | ||
334 | connect(setfont, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
335 | |||
336 | encoding = new QCheckBox( tr("Encoding"), bg ); | ||
337 | encoding->setChecked(config.readBoolEntry("Encoding Select", false)); | ||
338 | connect(encoding, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
339 | ideogram = new QCheckBox( tr("Ideogram"), bg ); | ||
340 | ideogram->setChecked(config.readBoolEntry("Ideogram Mode", false)); | ||
341 | connect(ideogram, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
342 | m_isChanged = false; | ||
343 | } | ||
344 | |||
345 | void CViewBarPrefs::saveall() | ||
346 | { | ||
347 | config.setGroup( "Toolbar" ); | ||
348 | config.writeEntry( "Fullscreen", fullscreen->isChecked()); | ||
349 | config.writeEntry( "Zoom In", zoomin->isChecked()); | ||
350 | config.writeEntry( "Zoom Out", zoomout->isChecked()); | ||
351 | config.writeEntry( "Set Font", setfont->isChecked()); | ||
352 | config.writeEntry("Encoding Select", encoding->isChecked()); | ||
353 | config.writeEntry("Ideogram Mode", ideogram->isChecked()); | ||
354 | } | ||
355 | |||
356 | CViewBarPrefs::~CViewBarPrefs() | ||
357 | { | ||
358 | } | ||
359 | |||
360 | CMarkBarPrefs::CMarkBarPrefs( Config& _config, QWidget* parent, const char* name, WFlags fl ) | ||
361 | : QWidget( parent, name, fl ), config(_config) | ||
362 | { | ||
363 | QVBoxLayout* vb = new QVBoxLayout(this); | ||
364 | |||
365 | QGroupBox* bg = new QGroupBox(2, Qt::Horizontal, "Marks", this); | ||
366 | vb->addWidget(bg); | ||
367 | mark = new QCheckBox( tr("Bookmark"), bg ); | ||
368 | mark->setChecked(config.readBoolEntry( "Mark", false )); | ||
369 | connect(mark, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
370 | annotate = new QCheckBox( tr("Annotate"), bg ); | ||
371 | annotate->setChecked(config.readBoolEntry( "Annotate", false )); | ||
372 | connect(annotate, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
373 | go_to = new QCheckBox( tr("Goto"), bg ); | ||
374 | go_to->setChecked(config.readBoolEntry( "Goto", false )); | ||
375 | connect(go_to, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
376 | Delete = new QCheckBox( tr("Delete"), bg ); | ||
377 | Delete->setChecked(config.readBoolEntry( "Delete", false )); | ||
378 | connect(Delete, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
379 | autogen = new QCheckBox( tr("Autogen"), bg ); | ||
380 | autogen->setChecked(config.readBoolEntry( "Autogen", false )); | ||
381 | connect(autogen, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
382 | clear = new QCheckBox( tr("Clear"), bg ); | ||
383 | clear->setChecked(config.readBoolEntry( "Clear", false )); | ||
384 | connect(clear, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
385 | save = new QCheckBox( tr("Save"), bg ); | ||
386 | save->setChecked(config.readBoolEntry( "Save", false )); | ||
387 | connect(save, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
388 | tidy = new QCheckBox( tr("Tidy"), bg ); | ||
389 | tidy->setChecked(config.readBoolEntry( "Tidy", false )); | ||
390 | connect(tidy, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
391 | startblock = new QCheckBox( tr("Mark Block"), bg ); | ||
392 | startblock->setChecked(config.readBoolEntry( "Start Block", false )); | ||
393 | connect(startblock, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
394 | copyblock = new QCheckBox( tr("Copy Block"), bg ); | ||
395 | copyblock->setChecked(config.readBoolEntry( "Copy Block", false )); | ||
396 | connect(copyblock, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
397 | m_isChanged = false; | ||
398 | } | ||
399 | |||
400 | void CMarkBarPrefs::saveall() | ||
401 | { | ||
402 | config.setGroup( "Toolbar" ); | ||
403 | config.writeEntry( "Mark", mark->isChecked()); | ||
404 | config.writeEntry( "Annotate", annotate->isChecked()); | ||
405 | config.writeEntry( "Goto", go_to->isChecked()); | ||
406 | config.writeEntry( "Delete", Delete->isChecked()); | ||
407 | config.writeEntry( "Autogen", autogen->isChecked()); | ||
408 | config.writeEntry( "Clear", clear->isChecked()); | ||
409 | config.writeEntry( "Save", save->isChecked()); | ||
410 | config.writeEntry( "Tidy", tidy->isChecked()); | ||
411 | config.writeEntry( "Start Block", startblock->isChecked()); | ||
412 | config.writeEntry( "Copy Block", copyblock->isChecked()); | ||
413 | } | ||
414 | |||
415 | CMarkBarPrefs::~CMarkBarPrefs() | ||
416 | { | ||
417 | } | ||
418 | |||
419 | CMiscBarPrefs::CMiscBarPrefs( QWidget* parent, const char* name, WFlags fl ) | ||
420 | : QWidget( parent, name, fl ) | ||
421 | { | ||
422 | |||
423 | QGridLayout* hl = new QGridLayout(this,1,2); | ||
424 | |||
425 | hl->setMargin( 0 ); | ||
426 | |||
427 | QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, "Dialogs", this); | ||
428 | floating = new QCheckBox(gb); | ||
429 | floating->setText(tr("Floating")); | ||
430 | |||
431 | // QLabel* TextLabel = new QLabel( gb ); | ||
432 | // TextLabel->setText( tr( "Select Button" ) ); | ||
433 | |||
434 | |||
435 | hl->addWidget( gb, 0, 0 ); | ||
436 | |||
437 | |||
438 | gb = new QGroupBox(1, Qt::Horizontal, "Bars (Restart)", this); | ||
439 | |||
440 | // QLabel* ql = new QLabel("Restart to apply changes", gb); | ||
441 | // TextLabel = new QLabel( gb ); | ||
442 | // TextLabel->setText( tr( "Policy" ) ); | ||
443 | |||
444 | #ifdef USECOMBO | ||
445 | tbpolicy = new QComboBox(gb); | ||
446 | #else | ||
447 | tbpolicy = new MenuButton(gb); | ||
448 | #endif | ||
449 | tbpolicy->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); | ||
450 | tbpolicy->insertItem(tr("Single bar")); | ||
451 | tbpolicy->insertItem(tr("Menu/tool bar")); | ||
452 | tbpolicy->insertItem(tr("Multiple bars")); | ||
453 | |||
454 | #ifdef USECOMBO | ||
455 | tbposition = new QComboBox(gb); | ||
456 | #else | ||
457 | tbposition = new MenuButton(gb); | ||
458 | #endif | ||
459 | tbposition->insertItem(tr("Top")); | ||
460 | tbposition->insertItem(tr("Bottom")); | ||
461 | tbposition->insertItem(tr("Right")); | ||
462 | tbposition->insertItem(tr("Left")); | ||
463 | tbposition->insertItem(tr("Minimised")); | ||
464 | |||
465 | tbmovable = new QCheckBox( tr("Movable"), gb ); | ||
466 | // ch->setChecked(config.readBoolEntry( "Movable", false )); | ||
467 | |||
468 | hl->addWidget(gb, 0, 1); | ||
469 | |||
470 | } | ||
471 | |||
472 | CMiscBarPrefs::~CMiscBarPrefs() | ||
473 | { | ||
474 | // no need to delete child widgets, Qt does it all for us | ||
475 | } | ||
476 | |||
477 | |||
478 | CIndBarPrefs::CIndBarPrefs( Config& _config, QWidget* parent, const char* name, WFlags fl ) | ||
479 | : QWidget( parent, name, fl ), config(_config) | ||
480 | { | ||
481 | QVBoxLayout* vb = new QVBoxLayout(this); | ||
482 | |||
483 | QGroupBox* bg = new QGroupBox(1, Qt::Horizontal, "Indicators", this); | ||
484 | vb->addWidget(bg); | ||
485 | indannotate = new QCheckBox( tr("Annotation"), bg ); | ||
486 | indannotate->setChecked(config.readBoolEntry( "Annotation indicator", false )); | ||
487 | connect(indannotate, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); | ||
488 | m_isChanged = false; | ||
489 | } | ||
490 | |||
491 | void CIndBarPrefs::saveall() | ||
492 | { | ||
493 | config.setGroup( "Toolbar" ); | ||
494 | config.writeEntry( "Annotation indicator", indannotate->isChecked()); | ||
495 | } | ||
496 | |||
497 | CIndBarPrefs::~CIndBarPrefs() | ||
498 | { | ||
499 | } | ||
diff --git a/noncore/apps/opie-reader/ToolbarPrefs.h b/noncore/apps/opie-reader/ToolbarPrefs.h new file mode 100644 index 0000000..297d63a --- a/dev/null +++ b/noncore/apps/opie-reader/ToolbarPrefs.h | |||
@@ -0,0 +1,263 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form interface generated from reading ui file 'Prefs.ui' | ||
3 | ** | ||
4 | ** Created: Tue Feb 11 23:53:32 2003 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #ifndef CTOOLBARPREFS_H | ||
10 | #define CTOOLBARPREFS_H | ||
11 | #include "useqpe.h" | ||
12 | #include <qvariant.h> | ||
13 | #include <qwidget.h> | ||
14 | #include <qtabdialog.h> | ||
15 | #include <qtabwidget.h> | ||
16 | #include <qspinbox.h> | ||
17 | #include <qcheckbox.h> | ||
18 | #include <qcombobox.h> | ||
19 | #include <qlineedit.h> | ||
20 | #ifdef USEQPE | ||
21 | #include <qpe/menubutton.h> | ||
22 | #include <qpe/config.h> | ||
23 | #else | ||
24 | #include "preferences.h" | ||
25 | #endif | ||
26 | //#include "opie.h" | ||
27 | //#ifdef OPIE | ||
28 | #define USECOMBO | ||
29 | //#endif | ||
30 | |||
31 | class QVBoxLayout; | ||
32 | class QHBoxLayout; | ||
33 | class QGridLayout; | ||
34 | //class QCheckBox; | ||
35 | class QLabel; | ||
36 | //class QSpinBox; | ||
37 | /* | ||
38 | class CBarPrefs1 : public QWidget | ||
39 | { | ||
40 | Q_OBJECT | ||
41 | |||
42 | Config& config; | ||
43 | QCheckBox *open, *close, *info, *twotouch,*find,*scroll,*navigation,*page,*startend,*jump,*pageline; | ||
44 | |||
45 | bool m_isChanged; | ||
46 | |||
47 | private slots: | ||
48 | void isChanged(int _v) { m_isChanged = true; } | ||
49 | |||
50 | public: | ||
51 | CBarPrefs1( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
52 | ~CBarPrefs1(); | ||
53 | void saveall(); | ||
54 | bool isChanged() { return m_isChanged; } | ||
55 | }; | ||
56 | */ | ||
57 | class CFileBarPrefs : public QWidget | ||
58 | { | ||
59 | Q_OBJECT | ||
60 | |||
61 | Config& config; | ||
62 | QCheckBox *open, *close, *info, *twotouch, *find, *scroll; | ||
63 | |||
64 | bool m_isChanged; | ||
65 | |||
66 | private slots: | ||
67 | void isChanged(int _v) { m_isChanged = true; } | ||
68 | |||
69 | public: | ||
70 | CFileBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
71 | ~CFileBarPrefs(); | ||
72 | void saveall(); | ||
73 | bool isChanged() { return m_isChanged; } | ||
74 | }; | ||
75 | |||
76 | class CNavBarPrefs : public QWidget | ||
77 | { | ||
78 | Q_OBJECT | ||
79 | |||
80 | Config& config; | ||
81 | QCheckBox *scroll, *navback, *navhome, *navforward; | ||
82 | QCheckBox *pageup, *pagedown, *gotostart, *gotoend, *jump, *pageline; | ||
83 | |||
84 | bool m_isChanged; | ||
85 | |||
86 | private slots: | ||
87 | void isChanged(int _v) { m_isChanged = true; } | ||
88 | |||
89 | public: | ||
90 | CNavBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
91 | ~CNavBarPrefs(); | ||
92 | void saveall(); | ||
93 | bool isChanged() { return m_isChanged; } | ||
94 | }; | ||
95 | /* | ||
96 | class CBarPrefs2 : public QWidget | ||
97 | { | ||
98 | Q_OBJECT | ||
99 | Config& config; | ||
100 | QCheckBox *fullscreen, *zoom, *setfont, *mark, *annotate, *go_to, *Delete, *autogen, *clear, *save, *tidy, *block, *indannotate, *encoding, *ideogram; | ||
101 | |||
102 | bool m_isChanged; | ||
103 | |||
104 | private slots: | ||
105 | void isChanged(int _v) { m_isChanged = true; } | ||
106 | |||
107 | public: | ||
108 | CBarPrefs2( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
109 | ~CBarPrefs2(); | ||
110 | void saveall(); | ||
111 | bool isChanged() { return m_isChanged; } | ||
112 | |||
113 | }; | ||
114 | */ | ||
115 | class CViewBarPrefs : public QWidget | ||
116 | { | ||
117 | Q_OBJECT | ||
118 | Config& config; | ||
119 | QCheckBox *fullscreen, *zoomin, *zoomout, *setfont, *encoding, *ideogram; | ||
120 | |||
121 | bool m_isChanged; | ||
122 | |||
123 | private slots: | ||
124 | void isChanged(int _v) { m_isChanged = true; } | ||
125 | |||
126 | public: | ||
127 | CViewBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
128 | ~CViewBarPrefs(); | ||
129 | void saveall(); | ||
130 | bool isChanged() { return m_isChanged; } | ||
131 | |||
132 | }; | ||
133 | |||
134 | class CMarkBarPrefs : public QWidget | ||
135 | { | ||
136 | Q_OBJECT | ||
137 | Config& config; | ||
138 | QCheckBox *mark, *annotate, *go_to, *Delete, *autogen, *clear, *save, *tidy, *startblock, *copyblock; | ||
139 | |||
140 | bool m_isChanged; | ||
141 | |||
142 | private slots: | ||
143 | void isChanged(int _v) { m_isChanged = true; } | ||
144 | |||
145 | public: | ||
146 | CMarkBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
147 | ~CMarkBarPrefs(); | ||
148 | void saveall(); | ||
149 | bool isChanged() { return m_isChanged; } | ||
150 | |||
151 | }; | ||
152 | |||
153 | class CIndBarPrefs : public QWidget | ||
154 | { | ||
155 | Q_OBJECT | ||
156 | Config& config; | ||
157 | QCheckBox *indannotate; | ||
158 | |||
159 | bool m_isChanged; | ||
160 | |||
161 | private slots: | ||
162 | void isChanged(int _v) { m_isChanged = true; } | ||
163 | |||
164 | public: | ||
165 | CIndBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
166 | ~CIndBarPrefs(); | ||
167 | void saveall(); | ||
168 | bool isChanged() { return m_isChanged; } | ||
169 | |||
170 | }; | ||
171 | |||
172 | class CMiscBarPrefs : public QWidget | ||
173 | { | ||
174 | |||
175 | public: | ||
176 | |||
177 | CMiscBarPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
178 | ~CMiscBarPrefs(); | ||
179 | |||
180 | #ifdef USECOMBO | ||
181 | QComboBox *tbpolicy, *tbposition; | ||
182 | #else | ||
183 | MenuButton *tbpolicy, *tbposition; | ||
184 | #endif | ||
185 | QCheckBox *tbmovable, *floating; | ||
186 | }; | ||
187 | |||
188 | class CBarPrefs : public QDialog | ||
189 | { | ||
190 | Q_OBJECT | ||
191 | ; | ||
192 | CMiscBarPrefs* misc; | ||
193 | CFileBarPrefs* filebar; | ||
194 | CNavBarPrefs* navbar; | ||
195 | CViewBarPrefs* viewbar; | ||
196 | CMarkBarPrefs* markbar; | ||
197 | CIndBarPrefs* indbar; | ||
198 | Config config; | ||
199 | |||
200 | void keyPressEvent(QKeyEvent* e) | ||
201 | { | ||
202 | switch (e->key()) | ||
203 | { | ||
204 | case Key_Escape: | ||
205 | e->accept(); | ||
206 | reject(); | ||
207 | break; | ||
208 | case Key_Space: | ||
209 | case Key_Return: | ||
210 | e->accept(); | ||
211 | accept(); | ||
212 | break; | ||
213 | default: | ||
214 | QWidget::keyPressEvent(e); | ||
215 | } | ||
216 | } | ||
217 | public: | ||
218 | CBarPrefs(const QString& appdir, bool fs = true, QWidget* parent = 0, const char* name = 0); | ||
219 | ~CBarPrefs() | ||
220 | { | ||
221 | if (result()) | ||
222 | { | ||
223 | if (navbar->isChanged()) navbar->saveall(); | ||
224 | if (filebar->isChanged()) filebar->saveall(); | ||
225 | if (viewbar->isChanged()) viewbar->saveall(); | ||
226 | if (markbar->isChanged()) markbar->saveall(); | ||
227 | if (indbar->isChanged()) indbar->saveall(); | ||
228 | } | ||
229 | } | ||
230 | bool isChanged() | ||
231 | { | ||
232 | return | ||
233 | ( | ||
234 | filebar->isChanged() | ||
235 | || | ||
236 | navbar->isChanged() | ||
237 | || | ||
238 | viewbar->isChanged() | ||
239 | || | ||
240 | markbar->isChanged() | ||
241 | || | ||
242 | indbar->isChanged() | ||
243 | ); | ||
244 | } | ||
245 | bool floating() { return misc->floating->isChecked(); } | ||
246 | void floating(bool v) { misc->floating->setChecked(v); } | ||
247 | int tbpolicy() { return misc->tbpolicy->currentItem(); } | ||
248 | #ifdef USECOMBO | ||
249 | void tbpolicy(int v) { misc->tbpolicy->setCurrentItem(v); } | ||
250 | #else | ||
251 | void tbpolicy(int v) { misc->tbpolicy->select(v); } | ||
252 | #endif | ||
253 | bool tbmovable() { return misc->tbmovable->isChecked(); } | ||
254 | void tbmovable(bool v) { misc->tbmovable->setChecked(v); } | ||
255 | int tbposition() { return misc->tbposition->currentItem(); } | ||
256 | #ifdef USECOMBO | ||
257 | void tbposition(int v) { misc->tbposition->setCurrentItem(v); } | ||
258 | #else | ||
259 | void tbposition(int v) { misc->tbposition->select(v); } | ||
260 | #endif | ||
261 | |||
262 | }; | ||
263 | #endif // CPREFS_H | ||
diff --git a/noncore/apps/opie-reader/URLDialog.cpp b/noncore/apps/opie-reader/URLDialog.cpp new file mode 100644 index 0000000..dd4568b --- a/dev/null +++ b/noncore/apps/opie-reader/URLDialog.cpp | |||
@@ -0,0 +1,14 @@ | |||
1 | #include "URLDialog.h" | ||
2 | #include "qlayout.h" | ||
3 | |||
4 | CURLDialog::CURLDialog(const QString& fname, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true) | ||
5 | { | ||
6 | setCaption(tr("Save URL")); | ||
7 | QVBoxLayout *tmp = new QVBoxLayout(this); | ||
8 | QVButtonGroup* vb = new QVButtonGroup(fname, this); | ||
9 | tmp->addWidget(vb); | ||
10 | m_clipboard = new QCheckBox(tr("Clipboard"), vb); | ||
11 | m_localfile = new QCheckBox(tr("Local file"), vb); | ||
12 | m_globalfile = new QCheckBox(tr("Global file"), vb); | ||
13 | if (fs) showMaximized(); | ||
14 | } | ||
diff --git a/noncore/apps/opie-reader/URLDialog.h b/noncore/apps/opie-reader/URLDialog.h new file mode 100644 index 0000000..1bcc4bd --- a/dev/null +++ b/noncore/apps/opie-reader/URLDialog.h | |||
@@ -0,0 +1,65 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form interface generated from reading ui file 'Prefs.ui' | ||
3 | ** | ||
4 | ** Created: Tue Feb 11 23:53:32 2003 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #ifndef __URLDIALOG_H | ||
10 | #define __URLDIALOG_H | ||
11 | |||
12 | #include "useqpe.h" | ||
13 | #include <qvariant.h> | ||
14 | #include <qwidget.h> | ||
15 | #include <qtabdialog.h> | ||
16 | #include <qtabwidget.h> | ||
17 | #include <qspinbox.h> | ||
18 | #include <qcheckbox.h> | ||
19 | #include <qcombobox.h> | ||
20 | #include <qlineedit.h> | ||
21 | //#include <qpe/menubutton.h> | ||
22 | #include <qvbuttongroup.h> | ||
23 | |||
24 | class QVBoxLayout; | ||
25 | class QHBoxLayout; | ||
26 | class QGridLayout; | ||
27 | //class QCheckBox; | ||
28 | class QLabel; | ||
29 | //class QSpinBox; | ||
30 | |||
31 | class CURLDialog : public QDialog | ||
32 | { | ||
33 | Q_OBJECT | ||
34 | QCheckBox *m_localfile, *m_globalfile, *m_clipboard; | ||
35 | #ifndef USEQPE | ||
36 | void keyPressEvent(QKeyEvent* e) | ||
37 | { | ||
38 | switch (e->key()) | ||
39 | { | ||
40 | case Key_Escape: | ||
41 | e->accept(); | ||
42 | reject(); | ||
43 | break; | ||
44 | case Key_Space: | ||
45 | case Key_Return: | ||
46 | e->accept(); | ||
47 | accept(); | ||
48 | break; | ||
49 | default: | ||
50 | QWidget::keyPressEvent(e); | ||
51 | } | ||
52 | } | ||
53 | #endif | ||
54 | public: | ||
55 | CURLDialog(const QString&, bool fs = true, QWidget* parent = 0, const char* name = 0); | ||
56 | ~CURLDialog() {} | ||
57 | bool clipboard() { return m_clipboard->isChecked(); } | ||
58 | bool localfile() { return m_localfile->isChecked(); } | ||
59 | bool globalfile() { return m_globalfile->isChecked(); } | ||
60 | void clipboard(bool _b) { m_clipboard->setChecked(_b); } | ||
61 | void localfile(bool _b) { m_localfile->setChecked(_b); } | ||
62 | void globalfile(bool _b) { m_globalfile->setChecked(_b); } | ||
63 | |||
64 | }; | ||
65 | #endif // CPREFS_H | ||
diff --git a/noncore/apps/opie-reader/linktype.h b/noncore/apps/opie-reader/linktype.h new file mode 100644 index 0000000..fa22b2f --- a/dev/null +++ b/noncore/apps/opie-reader/linktype.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef __LINKTYPE_H | ||
2 | #define __LINKTYPE_H | ||
3 | |||
4 | enum linkType | ||
5 | { | ||
6 | eNone, | ||
7 | eLink, | ||
8 | ePicture | ||
9 | }; | ||
10 | |||
11 | #endif | ||
diff --git a/noncore/apps/opie-reader/names.h b/noncore/apps/opie-reader/names.h new file mode 100644 index 0000000..0549750 --- a/dev/null +++ b/noncore/apps/opie-reader/names.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef __NAMES_H | ||
2 | #define __NAMES_H | ||
3 | // For message box titles etc | ||
4 | #define PROGNAME "Opie-Reader" | ||
5 | |||
6 | // For the caption eg "Anne of Green Gables - Reader" | ||
7 | #define SHORTPROGNAME "Reader" | ||
8 | |||
9 | // For configuration and bookmark files | ||
10 | #define APPDIR "uqtreader" | ||
11 | |||
12 | // Name of the configuration file | ||
13 | #define INIFILE ".readerrc" | ||
14 | #endif | ||
diff --git a/noncore/apps/opie-reader/plucker_base.cpp b/noncore/apps/opie-reader/plucker_base.cpp new file mode 100644 index 0000000..9047a45 --- a/dev/null +++ b/noncore/apps/opie-reader/plucker_base.cpp | |||
@@ -0,0 +1,1240 @@ | |||
1 | #include "useqpe.h" | ||
2 | #include <stdio.h> | ||
3 | #include <string.h> | ||
4 | #include <qmessagebox.h> | ||
5 | #include <qpixmap.h> | ||
6 | #ifdef USEQPE | ||
7 | #include <qpe/qcopenvelope_qws.h> | ||
8 | #endif /* USEQPE */ | ||
9 | #ifdef LOCALPICTURES | ||
10 | #include <qscrollview.h> | ||
11 | #endif | ||
12 | #ifdef USEQPE | ||
13 | #include <qpe/global.h> | ||
14 | #endif /* USEQPE */ | ||
15 | #include <qclipboard.h> | ||
16 | #ifndef USEQPE | ||
17 | #include <qapplication.h> | ||
18 | #else /* USEQPE */ | ||
19 | #include <qpe/qpeapplication.h> | ||
20 | #endif /* USEQPE */ | ||
21 | |||
22 | #include "plucker_base.h" | ||
23 | #include "Aportis.h" | ||
24 | #include "Palm2QImage.h" | ||
25 | |||
26 | CPlucker_base::CPlucker_base() : | ||
27 | #ifdef LOCALPICTURES | ||
28 | m_viewer(NULL), | ||
29 | m_picture(NULL), | ||
30 | #endif | ||
31 | expandedtextbuffer(NULL), | ||
32 | compressedtextbuffer(NULL) | ||
33 | //, urls(NULL) | ||
34 | { /*printf("constructing:%x\n",fin);*/ } | ||
35 | |||
36 | |||
37 | void CPlucker_base::Expand(UInt32 reclen, UInt8 type, UInt8* buffer, UInt32 buffersize) | ||
38 | { | ||
39 | if (type%2 == 0) | ||
40 | { | ||
41 | fread(buffer, reclen, sizeof(char), fin); | ||
42 | } | ||
43 | else | ||
44 | { | ||
45 | UInt8* readbuffer = NULL; | ||
46 | if (reclen > compressedbuffersize) | ||
47 | { | ||
48 | readbuffer = new UInt8[reclen]; | ||
49 | } | ||
50 | else | ||
51 | { | ||
52 | readbuffer = compressedtextbuffer; | ||
53 | } | ||
54 | if (readbuffer != NULL) | ||
55 | { | ||
56 | fread(readbuffer, reclen, sizeof(char), fin); | ||
57 | switch (ntohs(hdr0.version)) | ||
58 | { | ||
59 | case 2: | ||
60 | UnZip(readbuffer, reclen, buffer, buffersize); | ||
61 | break; | ||
62 | case 1: | ||
63 | UnDoc(readbuffer, reclen, buffer, buffersize); | ||
64 | break; | ||
65 | } | ||
66 | if (reclen > compressedbuffersize) | ||
67 | { | ||
68 | delete [] readbuffer; | ||
69 | } | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | |||
74 | void CPlucker_base::sizes(unsigned long& _file, unsigned long& _text) | ||
75 | { | ||
76 | _file = file_length; | ||
77 | if (textlength == 0) | ||
78 | { | ||
79 | for (int recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | ||
80 | { | ||
81 | gotorecordnumber(recptr); | ||
82 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
83 | UInt32 thishdr_size; | ||
84 | UInt8 thishdr_type, thishdr_reserved; | ||
85 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
86 | if (thishdr_type < 2) textlength += thishdr_size; | ||
87 | } | ||
88 | } | ||
89 | _text = textlength; | ||
90 | //ntohl(hdr0.size); | ||
91 | } | ||
92 | |||
93 | char* CPlucker_base::geturl(UInt16 tgt) | ||
94 | { | ||
95 | char * pRet = NULL; | ||
96 | gotorecordnumber(0); | ||
97 | fread(&hdr0, 1, 6, fin); | ||
98 | unsigned int nrecs = ntohs(hdr0.nRecords); | ||
99 | //qDebug("Version %u, no. recs %u", ntohs(hdr0.version), nrecs); | ||
100 | UInt16 urlid = 0; | ||
101 | bool urlsfound = false; | ||
102 | char* urls = NULL; | ||
103 | size_t urlsize = 0; | ||
104 | for (unsigned int i = 0; i < nrecs; i++) | ||
105 | { | ||
106 | UInt16 id, name; | ||
107 | fread(&name, 1, sizeof(name), fin); | ||
108 | fread(&id, 1, sizeof(id), fin); | ||
109 | //qDebug("N:%d, I:%d", ntohs(name), ntohs(id)); | ||
110 | if (ntohs(name) == 2) | ||
111 | { | ||
112 | urlsfound = true; | ||
113 | urlid = id; | ||
114 | //qDebug("Found url index:%d", ntohs(urlid)); | ||
115 | } | ||
116 | ////qDebug("%x", id); | ||
117 | } | ||
118 | if (urlsfound) | ||
119 | { | ||
120 | unsigned short recptr = finduid(ntohs(urlid)); | ||
121 | if (recptr != 0) | ||
122 | { | ||
123 | gotorecordnumber(recptr); | ||
124 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
125 | UInt32 thishdr_size; | ||
126 | UInt8 thishdr_type, thishdr_reserved; | ||
127 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
128 | UInt16 urlctr = 0; | ||
129 | while (1) | ||
130 | { | ||
131 | UInt16 tctr; | ||
132 | fread(&tctr, 1, sizeof(tctr), fin); | ||
133 | fread(&urlid, 1, sizeof(urlid), fin); | ||
134 | tctr = ntohs(tctr); | ||
135 | //qDebug("tgt:%u urlctr:%u tctr:%u", tgt, urlctr, tctr); | ||
136 | if (tctr >= tgt) | ||
137 | { | ||
138 | break; | ||
139 | } | ||
140 | urlctr = tctr; | ||
141 | } | ||
142 | //qDebug("urls are in %d", ntohs(urlid)); | ||
143 | recptr = finduid(ntohs(urlid)); | ||
144 | if (recptr != 0) | ||
145 | { | ||
146 | UInt32 reclen = recordlength(recptr) - HeaderSize(); | ||
147 | gotorecordnumber(recptr); | ||
148 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
149 | //qDebug("Found urls:%x",thishdr_type); | ||
150 | urlsize = thishdr_size; | ||
151 | urls = new char[urlsize]; | ||
152 | Expand(reclen, thishdr_type, (UInt8*)urls, urlsize); | ||
153 | char* ptr = urls; | ||
154 | int rn = urlctr+1; | ||
155 | while (ptr - urls < urlsize) | ||
156 | { | ||
157 | if (rn == tgt) | ||
158 | { | ||
159 | //qDebug("URL:%s", ptr); | ||
160 | int len = strlen(ptr)+1; | ||
161 | pRet = new char[len]; | ||
162 | memcpy(pRet, ptr, len); | ||
163 | break; | ||
164 | } | ||
165 | ptr += strlen(ptr)+1; | ||
166 | rn++; | ||
167 | } | ||
168 | delete [] urls; | ||
169 | } | ||
170 | } | ||
171 | } | ||
172 | else | ||
173 | { | ||
174 | QMessageBox::information(NULL, | ||
175 | QString(PROGNAME), | ||
176 | QString("No external links\nin this pluck") | ||
177 | ); | ||
178 | } | ||
179 | return pRet; | ||
180 | } | ||
181 | |||
182 | CPlucker_base::~CPlucker_base() | ||
183 | { | ||
184 | if (expandedtextbuffer != NULL) delete [] expandedtextbuffer; | ||
185 | if (compressedtextbuffer != NULL) delete [] compressedtextbuffer; | ||
186 | #ifdef LOCALPICTURES | ||
187 | if (m_viewer != NULL) delete m_viewer; | ||
188 | #endif | ||
189 | } | ||
190 | |||
191 | int CPlucker_base::getch() { return getch(false); } | ||
192 | |||
193 | void CPlucker_base::getch(tchar& ch, CStyle& sty) | ||
194 | { | ||
195 | ch = getch(false); | ||
196 | sty = mystyle; | ||
197 | } | ||
198 | |||
199 | unsigned int CPlucker_base::locate() | ||
200 | { | ||
201 | return currentpos; | ||
202 | /* | ||
203 | UInt16 thisrec = 1; | ||
204 | unsigned long locpos = 0; | ||
205 | gotorecordnumber(thisrec); | ||
206 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
207 | UInt32 thishdr_size; | ||
208 | UInt8 thishdr_type, thishdr_reserved; | ||
209 | while (thisrec < bufferrec) | ||
210 | { | ||
211 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
212 | if (thishdr_type < 2) locpos += thishdr_size; | ||
213 | thisrec++; | ||
214 | gotorecordnumber(thisrec); | ||
215 | } | ||
216 | return locpos+bufferpos; | ||
217 | */ | ||
218 | } | ||
219 | |||
220 | void CPlucker_base::locate(unsigned int n) | ||
221 | { | ||
222 | |||
223 | // clock_t start = clock(); | ||
224 | UInt32 textlength = currentpos - bufferpos; | ||
225 | UInt16 recptr = bufferrec; | ||
226 | if (n < textlength/2) | ||
227 | { | ||
228 | textlength = 0; | ||
229 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
230 | UInt32 thishdr_size = buffercontent; | ||
231 | UInt8 thishdr_type, thishdr_reserved; | ||
232 | for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | ||
233 | { | ||
234 | gotorecordnumber(recptr); | ||
235 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
236 | if (thishdr_type < 2) | ||
237 | { | ||
238 | textlength += thishdr_size; | ||
239 | if (textlength > n) | ||
240 | { | ||
241 | textlength -= thishdr_size; | ||
242 | break; | ||
243 | } | ||
244 | } | ||
245 | } | ||
246 | } | ||
247 | else if (n < textlength) | ||
248 | { | ||
249 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
250 | UInt32 thishdr_size; | ||
251 | UInt8 thishdr_type, thishdr_reserved; | ||
252 | while (n < textlength && recptr > 1) | ||
253 | { | ||
254 | recptr--; | ||
255 | gotorecordnumber(recptr); | ||
256 | //qDebug("recptr:%u", recptr); | ||
257 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
258 | if (thishdr_type < 2) | ||
259 | { | ||
260 | textlength -= thishdr_size; | ||
261 | } | ||
262 | } | ||
263 | } | ||
264 | else | ||
265 | { | ||
266 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
267 | UInt32 thishdr_size = buffercontent; | ||
268 | UInt8 thishdr_type, thishdr_reserved; | ||
269 | while (n > textlength + thishdr_size && recptr < ntohs(head.recordList.numRecords)-1) | ||
270 | { | ||
271 | textlength += thishdr_size; | ||
272 | recptr++; | ||
273 | gotorecordnumber(recptr); | ||
274 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
275 | if (!(thishdr_type < 2)) | ||
276 | { | ||
277 | thishdr_size = 0; | ||
278 | } | ||
279 | } | ||
280 | } | ||
281 | // qDebug("Time(1): %u", clock()-start); | ||
282 | /* | ||
283 | expand(recptr); | ||
284 | mystyle.unset(); | ||
285 | bufferpos = n-textlength; | ||
286 | currentpos = n; | ||
287 | while (bufferpos >= m_nextPara && m_nextPara >= 0) | ||
288 | { | ||
289 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; | ||
290 | m_nextParaIndex++; | ||
291 | if (m_nextParaIndex == m_nParas) | ||
292 | { | ||
293 | m_nextPara = -1; | ||
294 | } | ||
295 | else | ||
296 | { | ||
297 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; | ||
298 | } | ||
299 | } | ||
300 | |||
301 | return; | ||
302 | */ | ||
303 | // start = clock(); | ||
304 | |||
305 | UInt16 thisrec = 0; | ||
306 | unsigned long locpos = 0; | ||
307 | unsigned long bs = 0; | ||
308 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
309 | UInt32 thishdr_size; | ||
310 | UInt8 thishdr_type, thishdr_reserved; | ||
311 | do | ||
312 | { | ||
313 | thisrec++; | ||
314 | locpos += bs; | ||
315 | gotorecordnumber(thisrec); | ||
316 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
317 | if (thishdr_type < 2) | ||
318 | { | ||
319 | bs = thishdr_size; | ||
320 | } | ||
321 | else | ||
322 | { | ||
323 | bs = 0; | ||
324 | } | ||
325 | } while (locpos + bs <= n); | ||
326 | |||
327 | // qDebug("Time(2): %u", clock()-start); | ||
328 | if (recptr != thisrec) | ||
329 | { | ||
330 | qDebug("Disaster:recptr:%u thisrec:%u", recptr, thisrec); | ||
331 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
332 | UInt32 thishdr_size = buffercontent; | ||
333 | UInt8 thishdr_type, thishdr_reserved; | ||
334 | for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | ||
335 | { | ||
336 | gotorecordnumber(recptr); | ||
337 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
338 | // qDebug("UID:%u Paras:%u Size:%u Type:%u Reserved:%u", thishdr_uid, thishdr_nParagraphs, thishdr_size, (unsigned int)thishdr_type, (unsigned int)thishdr_reserved); | ||
339 | } | ||
340 | //QApplication::exit ( 100 ); | ||
341 | } | ||
342 | |||
343 | currentpos = locpos; | ||
344 | expand(thisrec); | ||
345 | while (currentpos < n && bufferpos < buffercontent) getch_base(true); | ||
346 | |||
347 | /* // This is faster but the alignment attribute doesn't get set 8^( | ||
348 | bufferpos = n-locpos; | ||
349 | currentpos = n; | ||
350 | while (bufferpos >= m_nextPara && m_nextPara >= 0) | ||
351 | { | ||
352 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; | ||
353 | m_nextParaIndex++; | ||
354 | if (m_nextParaIndex == m_nParas) | ||
355 | { | ||
356 | m_nextPara = -1; | ||
357 | } | ||
358 | else | ||
359 | { | ||
360 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; | ||
361 | } | ||
362 | } | ||
363 | */ | ||
364 | } | ||
365 | |||
366 | bool CPlucker_base::expand(int thisrec) | ||
367 | { | ||
368 | mystyle.unset(); | ||
369 | size_t reclen = recordlength(thisrec); | ||
370 | gotorecordnumber(thisrec); | ||
371 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
372 | UInt32 thishdr_size; | ||
373 | UInt8 thishdr_type, thishdr_reserved; | ||
374 | while (1) | ||
375 | { | ||
376 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
377 | //qDebug("This (%d) type is %d, uid is %u", thisrec, thishdr_type, thishdr_uid); | ||
378 | if (thishdr_type < 2) break; | ||
379 | //qDebug("Skipping paragraph of type %d", thishdr_type); | ||
380 | if (++thisrec >= ntohs(head.recordList.numRecords) - 1) return false; | ||
381 | reclen = recordlength(thisrec); | ||
382 | gotorecordnumber(thisrec); | ||
383 | } | ||
384 | m_nParas = thishdr_nParagraphs; | ||
385 | m_bufferisreserved = (thishdr_reserved != 0); | ||
386 | //qDebug("It has %u paragraphs and is %u bytes", thishdr_nParagraphs, thishdr_size); | ||
387 | uid = thishdr_uid; | ||
388 | // gotorecordnumber(thisrec); | ||
389 | // fread(expandedtextbuffer,1,10,fin); | ||
390 | for (int i = 0; i < m_nParas; i++) | ||
391 | { | ||
392 | UInt16 ubytes, attrs; | ||
393 | fread(&ubytes, 1, sizeof(ubytes), fin); | ||
394 | fread(&attrs, 1, sizeof(attrs), fin); | ||
395 | m_ParaOffsets[i] = ntohs(ubytes); | ||
396 | m_ParaAttrs[i] = ntohs(attrs); | ||
397 | ////qDebug("Bytes %u, Attr %x", ntohs(ubytes), ntohs(attrs)); | ||
398 | } | ||
399 | if (m_nParas > 0) | ||
400 | { | ||
401 | m_nextPara = m_ParaOffsets[0]; | ||
402 | //qDebug("First offset = %u", m_nextPara); | ||
403 | m_nextParaIndex = 0; | ||
404 | } | ||
405 | else | ||
406 | { | ||
407 | m_nextPara = -1; | ||
408 | } | ||
409 | |||
410 | reclen -= HeaderSize()+4*m_nParas; | ||
411 | |||
412 | buffercontent = thishdr_size; | ||
413 | |||
414 | if (thishdr_size > buffersize) | ||
415 | { | ||
416 | delete [] expandedtextbuffer; | ||
417 | buffersize = thishdr_size; | ||
418 | expandedtextbuffer = new UInt8[buffersize]; | ||
419 | } | ||
420 | |||
421 | Expand(reclen, thishdr_type, expandedtextbuffer, buffercontent); | ||
422 | bufferpos = 0; | ||
423 | bufferrec = thisrec; | ||
424 | //qDebug("BC:%u, HS:%u", buffercontent, thishdr_size); | ||
425 | return true; | ||
426 | } | ||
427 | |||
428 | void CPlucker_base::UnZip(UInt8* compressedbuffer, size_t reclen, UInt8* tgtbuffer, size_t bsize) | ||
429 | { | ||
430 | z_stream zstream; | ||
431 | memset(&zstream,sizeof(zstream),0); | ||
432 | zstream.next_in = compressedbuffer; | ||
433 | zstream.next_out = tgtbuffer; | ||
434 | zstream.avail_out = bsize; | ||
435 | zstream.avail_in = reclen; | ||
436 | |||
437 | int keylen = 0; | ||
438 | |||
439 | zstream.zalloc = Z_NULL; | ||
440 | zstream.zfree = Z_NULL; | ||
441 | zstream.opaque = Z_NULL; | ||
442 | |||
443 | // printf("Initialising\n"); | ||
444 | |||
445 | inflateInit(&zstream); | ||
446 | int err = 0; | ||
447 | do { | ||
448 | if ( zstream.avail_in == 0 && 0 < keylen ) { | ||
449 | zstream.next_in = compressedbuffer + keylen; | ||
450 | zstream.avail_in = reclen - keylen; | ||
451 | keylen = 0; | ||
452 | } | ||
453 | zstream.next_out = tgtbuffer; | ||
454 | zstream.avail_out = bsize; | ||
455 | |||
456 | err = inflate( &zstream, Z_SYNC_FLUSH ); | ||
457 | |||
458 | ////qDebug("err:%d - %u", err, zstream.avail_in); | ||
459 | |||
460 | } while ( err == Z_OK ); | ||
461 | |||
462 | inflateEnd(&zstream); | ||
463 | } | ||
464 | |||
465 | void CPlucker_base::UnDoc(UInt8* compressedbuffer, size_t reclen, UInt8* tgtbuffer, size_t bsize) | ||
466 | { | ||
467 | // UInt16 headerSize; | ||
468 | UInt16 docSize; | ||
469 | UInt16 i; | ||
470 | UInt16 j; | ||
471 | UInt16 k; | ||
472 | |||
473 | UInt8 *inBuf = compressedbuffer; | ||
474 | UInt8 *outBuf = tgtbuffer; | ||
475 | |||
476 | // headerSize = sizeof( Header ) + record->paragraphs * sizeof( Paragraph ); | ||
477 | docSize = reclen; | ||
478 | |||
479 | j = 0; | ||
480 | k = 0; | ||
481 | while ( j < docSize ) { | ||
482 | i = 0; | ||
483 | while ( i < bsize && j < docSize ) { | ||
484 | UInt16 c; | ||
485 | |||
486 | c = (UInt16) inBuf[ j++ ]; | ||
487 | if ( 0 < c && c < 9 ) { | ||
488 | while ( 0 < c-- ) | ||
489 | outBuf[ i++ ] = inBuf[ j++ ]; | ||
490 | } | ||
491 | else if ( c < 0x80 ) | ||
492 | outBuf[ i++ ] = c; | ||
493 | else if ( 0xc0 <= c ) { | ||
494 | outBuf[ i++ ] = ' '; | ||
495 | outBuf[ i++ ] = c ^ 0x80; | ||
496 | } | ||
497 | else { | ||
498 | Int16 m; | ||
499 | Int16 n; | ||
500 | |||
501 | c <<= 8; | ||
502 | c += inBuf[ j++ ]; | ||
503 | |||
504 | m = ( c & 0x3fff ) >> COUNT_BITS; | ||
505 | n = c & ( ( 1 << COUNT_BITS ) - 1 ); | ||
506 | n += 2; | ||
507 | |||
508 | do { | ||
509 | outBuf[ i ] = outBuf[ i - m ]; | ||
510 | i++; | ||
511 | } while ( 0 < n-- ); | ||
512 | } | ||
513 | } | ||
514 | k += bsize; | ||
515 | } | ||
516 | } | ||
517 | |||
518 | void CPlucker_base::home() | ||
519 | { | ||
520 | currentpos = 0; | ||
521 | expand(1); | ||
522 | } | ||
523 | |||
524 | CList<Bkmk>* CPlucker_base::getbkmklist() | ||
525 | { | ||
526 | /* | ||
527 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
528 | UInt32 thishdr_size; | ||
529 | UInt8 thishdr_type, thishdr_reserved; | ||
530 | |||
531 | for (int i = 1; i < ntohs(head.recordList.numRecords); i++) | ||
532 | { | ||
533 | gotorecordnumber(i); | ||
534 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
535 | if (thishdr_type == 8) | ||
536 | { | ||
537 | UInt16 n; | ||
538 | fread(&n, 1, sizeof(n), fin); | ||
539 | n = ntohs(n); | ||
540 | //qDebug("Found %u bookmarks", n); | ||
541 | } | ||
542 | //qDebug("Found:%d, %u", i , thishdr_type); | ||
543 | } | ||
544 | */ | ||
545 | return NULL; | ||
546 | } | ||
547 | |||
548 | #include <qnamespace.h> | ||
549 | |||
550 | QImage* CPlucker_base::expandimg(UInt16 tgt, bool border) | ||
551 | { | ||
552 | QImage* qimage = getimg(tgt); | ||
553 | QImage* ret; | ||
554 | if (qimage == NULL) return NULL; | ||
555 | if (border) | ||
556 | { | ||
557 | QPixmap* image = new QPixmap(0,0); | ||
558 | image->convertFromImage(*qimage); | ||
559 | delete qimage; | ||
560 | QPixmap* pret = new QPixmap(image->width()+4, image->height()+4); | ||
561 | pret->fill(Qt::red); | ||
562 | bitBlt(pret, 2, 2, image, 0, 0, -1, -1);//, Qt::RasterOp::CopyROP); | ||
563 | delete image; | ||
564 | ret = new QImage(pret->convertToImage()); | ||
565 | } | ||
566 | else | ||
567 | { | ||
568 | ret = qimage; | ||
569 | } | ||
570 | return ret; | ||
571 | } | ||
572 | |||
573 | #ifdef _BUFFERPICS | ||
574 | #include <qmap.h> | ||
575 | #endif | ||
576 | |||
577 | QImage* CPlucker_base::getPicture(unsigned long tgt) | ||
578 | { | ||
579 | #ifdef _BUFFERPICS | ||
580 | static QMap<unsigned long, QPixmap> pix; | ||
581 | QMap<unsigned long, QPixmap>::Iterator t = pix.find(tgt); | ||
582 | if (t == pix.end()) | ||
583 | { | ||
584 | pix[tgt] = *expandimg(tgt); | ||
585 | return &pix[tgt]; | ||
586 | } | ||
587 | else | ||
588 | return &(t.data()); | ||
589 | #else | ||
590 | return expandimg(tgt >> 16); | ||
591 | #endif | ||
592 | } | ||
593 | |||
594 | #ifdef LOCALPICTURES | ||
595 | #include <unistd.h> | ||
596 | #include <qpe/global.h> | ||
597 | void CPlucker_base::showimg(UInt16 tgt) | ||
598 | { | ||
599 | //qDebug("Crassssssh!"); | ||
600 | QPixmap* qimage = expandimg(tgt); | ||
601 | m_picture->setFixedSize(qimage->size()); | ||
602 | m_picture->setBackgroundPixmap(*qimage); | ||
603 | delete qimage; | ||
604 | m_viewer->show(); | ||
605 | |||
606 | /* | ||
607 | char tmp[] = "uqtreader.XXXXXX"; | ||
608 | QImage* qimage = getimg(tgt); | ||
609 | QPixmap* image = new QPixmap(0,0); | ||
610 | // //qDebug("New image"); | ||
611 | image->convertFromImage(*qimage); | ||
612 | delete qimage; | ||
613 | char tmpfile[sizeof(tmp)+1]; | ||
614 | strcpy(tmpfile,tmp); | ||
615 | int f = mkstemp(tmpfile); | ||
616 | close(f); | ||
617 | //qDebug("TMPFILE:%s", tmpfile); | ||
618 | if (image->save(tmpfile,"PNG")) | ||
619 | { | ||
620 | QCopEnvelope e("QPE/Application/showimg", "setDocument(QString)"); | ||
621 | e << QString(tmpfile); | ||
622 | } | ||
623 | Global::statusMessage("Opening image"); | ||
624 | sleep(5); | ||
625 | delete image; | ||
626 | unlink(tmpfile); | ||
627 | */ | ||
628 | } | ||
629 | |||
630 | #endif | ||
631 | |||
632 | unsigned short CPlucker_base::finduid(unsigned short urlid) | ||
633 | { | ||
634 | // //qDebug("Finding %u", urlid); | ||
635 | unsigned short jmin = 1, jmax = ntohs(head.recordList.numRecords); | ||
636 | unsigned short jmid = (jmin+jmax) >> 1; | ||
637 | while (jmax - jmin > 1) | ||
638 | { | ||
639 | gotorecordnumber(jmid); | ||
640 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
641 | UInt32 thishdr_size; | ||
642 | UInt8 thishdr_type, thishdr_reserved; | ||
643 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
644 | unsigned short luid = thishdr_uid; | ||
645 | ////qDebug("%u %u %u : %u", jmin, jmid, jmax, urlid); | ||
646 | if (luid == urlid) | ||
647 | { | ||
648 | return jmid; | ||
649 | } | ||
650 | if (luid < urlid) | ||
651 | { | ||
652 | jmin = jmid; | ||
653 | } | ||
654 | else | ||
655 | { | ||
656 | jmax = jmid; | ||
657 | } | ||
658 | jmid = (jmin+jmax) >> 1; | ||
659 | } | ||
660 | gotorecordnumber(jmin); | ||
661 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
662 | UInt32 thishdr_size; | ||
663 | UInt8 thishdr_type, thishdr_reserved; | ||
664 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
665 | unsigned short luid = thishdr_uid; | ||
666 | //qDebug("jmin at end:%u,%u", jmin, luid); | ||
667 | if (luid == urlid) | ||
668 | { | ||
669 | return jmin; | ||
670 | } | ||
671 | gotorecordnumber(jmax); | ||
672 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
673 | luid = thishdr_uid; | ||
674 | //qDebug("jmax at end:%u,%u", jmax, luid); | ||
675 | if (luid == urlid) | ||
676 | { | ||
677 | return jmax; | ||
678 | } | ||
679 | //qDebug("Couldn't find %u", urlid); | ||
680 | return 0; // Not found! | ||
681 | } | ||
682 | |||
683 | #include <qnamespace.h> | ||
684 | |||
685 | void CPlucker_base::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) | ||
686 | { | ||
687 | unsigned short sz = 0; | ||
688 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) | ||
689 | { | ||
690 | sz++; | ||
691 | } | ||
692 | size_t newlen = srclen+sizeof(sz)+sz*sizeof(unsigned long); | ||
693 | unsigned char* newdata = new unsigned char[newlen]; | ||
694 | unsigned char* pdata = newdata; | ||
695 | memcpy(newdata, src, srclen); | ||
696 | newdata += srclen; | ||
697 | memcpy(newdata, &sz, sizeof(sz)); | ||
698 | newdata += sizeof(sz); | ||
699 | #ifdef _WINDOWS | ||
700 | for (it = visited.begin(); it != visited.end(); it++) | ||
701 | #else | ||
702 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) | ||
703 | #endif | ||
704 | { | ||
705 | unsigned long t = *it; | ||
706 | //qDebug("[%u]", t); | ||
707 | memcpy(newdata, &t, sizeof(t)); | ||
708 | newdata += sizeof(t); | ||
709 | } | ||
710 | m_nav.setSaveData(data, len, pdata, newlen); | ||
711 | delete [] pdata; | ||
712 | } | ||
713 | |||
714 | void CPlucker_base::putSaveData(unsigned char*& src, unsigned short& srclen) | ||
715 | { | ||
716 | unsigned short sz; | ||
717 | if (srclen >= sizeof(sz)) | ||
718 | { | ||
719 | memcpy(&sz, src, sizeof(sz)); | ||
720 | src += sizeof(sz); | ||
721 | srclen -= sizeof(sz); | ||
722 | } | ||
723 | for (int i = 0; i < sz; i++) | ||
724 | { | ||
725 | unsigned long t; | ||
726 | if (srclen >= sizeof(t)) | ||
727 | { | ||
728 | memcpy(&t, src, sizeof(t)); | ||
729 | // qDebug("[%u]", t); | ||
730 | visited.push_front(t); | ||
731 | src += sizeof(t); | ||
732 | srclen -= sizeof(t); | ||
733 | } | ||
734 | else | ||
735 | { | ||
736 | QMessageBox::warning(NULL, PROGNAME, "File data mismatch\nMight fix itself"); | ||
737 | break; | ||
738 | } | ||
739 | } | ||
740 | m_nav.putSaveData(src, srclen); | ||
741 | } | ||
742 | |||
743 | int CPlucker_base::OpenFile(const char *src) | ||
744 | { | ||
745 | m_lastBreak = 0; | ||
746 | if (!Cpdb::openfile(src)) | ||
747 | { | ||
748 | return -1; | ||
749 | } | ||
750 | |||
751 | if (!CorrectDecoder()) return -1; | ||
752 | |||
753 | gotorecordnumber(0); | ||
754 | fread(&hdr0, 1, 6, fin); | ||
755 | setbuffersize(); | ||
756 | compressedtextbuffer = new UInt8[compressedbuffersize]; | ||
757 | expandedtextbuffer = new UInt8[buffersize]; | ||
758 | |||
759 | //qDebug("Total number of records:%u", ntohs(head.recordList.numRecords)); | ||
760 | |||
761 | unsigned int nrecs = ntohs(hdr0.nRecords); | ||
762 | //qDebug("Version %u, no. recs %u", ntohs(hdr0.version), nrecs); | ||
763 | UInt16 homerecid = 1; | ||
764 | for (unsigned int i = 0; i < nrecs; i++) | ||
765 | { | ||
766 | UInt16 id, name; | ||
767 | fread(&name, 1, sizeof(name), fin); | ||
768 | fread(&id, 1, sizeof(id), fin); | ||
769 | //qDebug("N:%d, I:%d", ntohs(name), ntohs(id)); | ||
770 | if (ntohs(name) == 0) homerecid = ntohs(id); | ||
771 | } | ||
772 | |||
773 | textlength = 0; | ||
774 | for (int recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) | ||
775 | { | ||
776 | gotorecordnumber(recptr); | ||
777 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
778 | UInt32 thishdr_size; | ||
779 | UInt8 thishdr_type, thishdr_reserved; | ||
780 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
781 | if (thishdr_uid == homerecid) | ||
782 | { | ||
783 | m_homepos = textlength; | ||
784 | break; | ||
785 | } | ||
786 | if (thishdr_type < 2) textlength += thishdr_size; | ||
787 | } | ||
788 | textlength = 0; | ||
789 | home(); | ||
790 | #ifdef LOCALPICTURES | ||
791 | if (m_viewer == NULL) | ||
792 | { | ||
793 | m_viewer = new QScrollView(NULL); | ||
794 | m_picture = new QWidget(m_viewer->viewport()); | ||
795 | m_viewer->addChild(m_picture); | ||
796 | } | ||
797 | #endif | ||
798 | return 0; | ||
799 | |||
800 | } | ||
801 | |||
802 | QImage* CPlucker_base::getimg(UInt16 tgt) | ||
803 | { | ||
804 | size_t reclen; | ||
805 | UInt16 thisrec = finduid(tgt); | ||
806 | reclen = recordlength(thisrec); | ||
807 | gotorecordnumber(thisrec); | ||
808 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
809 | UInt32 thishdr_size; | ||
810 | UInt8 thishdr_type, thishdr_reserved; | ||
811 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
812 | reclen -= HeaderSize(); | ||
813 | |||
814 | UInt32 imgsize = thishdr_size; | ||
815 | UInt8* imgbuffer = new UInt8[imgsize]; | ||
816 | |||
817 | Expand(reclen, thishdr_type, imgbuffer, imgsize); | ||
818 | |||
819 | return imagefromdata(imgbuffer, imgsize); | ||
820 | } | ||
821 | |||
822 | linkType CPlucker_base::hyperlink(unsigned int n, QString& wrd) | ||
823 | { | ||
824 | visited.push_front(n); | ||
825 | UInt16 tuid = (n >> 16); | ||
826 | n &= 0xffff; | ||
827 | // //qDebug("Hyper:<%u,%u>", tuid, n); | ||
828 | UInt16 thisrec = 1; | ||
829 | currentpos = 0; | ||
830 | gotorecordnumber(thisrec); | ||
831 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
832 | UInt32 thishdr_size; | ||
833 | UInt8 thishdr_type, thishdr_reserved; | ||
834 | while (1) | ||
835 | { | ||
836 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
837 | if (tuid == thishdr_uid) break; | ||
838 | if (thishdr_type < 2) currentpos += thishdr_size; | ||
839 | ////qDebug("hyper-cp:%u", currentpos); | ||
840 | thisrec++; | ||
841 | if (thisrec >= ntohs(head.recordList.numRecords)) | ||
842 | { | ||
843 | char *turl = geturl(tuid); | ||
844 | if (turl == NULL) | ||
845 | { | ||
846 | QMessageBox::information(NULL, | ||
847 | QString(PROGNAME), | ||
848 | QString("Couldn't find link") | ||
849 | ); | ||
850 | } | ||
851 | else | ||
852 | { | ||
853 | wrd = turl; | ||
854 | #ifdef USEQPE | ||
855 | if (wrd.length() > 10) | ||
856 | { | ||
857 | Global::statusMessage(wrd.left(8) + ".."); | ||
858 | } | ||
859 | else | ||
860 | { | ||
861 | Global::statusMessage(wrd); | ||
862 | } | ||
863 | #else | ||
864 | #endif /* USEQPE */ | ||
865 | //qDebug("Link:%s", (const char*)wrd); | ||
866 | // setlink(fn, wrd); | ||
867 | delete [] turl; | ||
868 | } | ||
869 | return eNone; | ||
870 | } | ||
871 | gotorecordnumber(thisrec); | ||
872 | } | ||
873 | if (thishdr_type > 1) | ||
874 | { | ||
875 | if (thishdr_type == 4) | ||
876 | { | ||
877 | QMessageBox::information(NULL, | ||
878 | QString(PROGNAME), | ||
879 | QString("Mailto links\nnot yet supported (2)")); | ||
880 | } | ||
881 | else | ||
882 | { | ||
883 | if (thishdr_type > 3) | ||
884 | { | ||
885 | QMessageBox::information(NULL, | ||
886 | QString(PROGNAME), | ||
887 | QString("External links\nnot yet supported (2)") | ||
888 | ); | ||
889 | return eNone; | ||
890 | } | ||
891 | else | ||
892 | { | ||
893 | #ifdef LOCALPICTURES | ||
894 | showimg(tuid); | ||
895 | #else | ||
896 | return ePicture; | ||
897 | #endif | ||
898 | } | ||
899 | } | ||
900 | return eNone; | ||
901 | } | ||
902 | /* | ||
903 | if (thishdr_type == 2 || thishdr_type == 3) | ||
904 | { | ||
905 | expandimg(thisrec); | ||
906 | |||
907 | } | ||
908 | */ | ||
909 | else | ||
910 | { | ||
911 | expand(thisrec); | ||
912 | if (n != 0) | ||
913 | { | ||
914 | if (n >= m_nParas) | ||
915 | { | ||
916 | QMessageBox::information(NULL, | ||
917 | QString(PROGNAME), | ||
918 | QString("Error in link\nPara # too big") | ||
919 | ); | ||
920 | return eNone; | ||
921 | } | ||
922 | unsigned int noff = 0; | ||
923 | for (unsigned int i = 0; i < n; i++) noff += m_ParaOffsets[i]; | ||
924 | n = noff; | ||
925 | } | ||
926 | if (n > thishdr_size) | ||
927 | { | ||
928 | QMessageBox::information(NULL, | ||
929 | QString(PROGNAME), | ||
930 | QString("Error in link\nOffset too big") | ||
931 | ); | ||
932 | return eNone; | ||
933 | } | ||
934 | //qDebug("Hyper:<%u,%u>", tuid, n); | ||
935 | while (bufferpos < n && bufferpos < buffercontent) getch_base(true); | ||
936 | /* // This is faster but the alignment doesn't get set | ||
937 | mystyle.unset(); | ||
938 | bufferpos = n; | ||
939 | currentpos += n; | ||
940 | while (bufferpos >= m_nextPara && m_nextPara >= 0) | ||
941 | { | ||
942 | UInt16 attr = m_ParaAttrs[m_nextParaIndex]; | ||
943 | m_nextParaIndex++; | ||
944 | if (m_nextParaIndex == m_nParas) | ||
945 | { | ||
946 | m_nextPara = -1; | ||
947 | } | ||
948 | else | ||
949 | { | ||
950 | m_nextPara += m_ParaOffsets[m_nextParaIndex]; | ||
951 | } | ||
952 | } | ||
953 | */ | ||
954 | } | ||
955 | return eLink; | ||
956 | } | ||
957 | |||
958 | tchar CPlucker_base::getch_base(bool fast) | ||
959 | { | ||
960 | int ch = bgetch(); | ||
961 | while (ch == 0) | ||
962 | { | ||
963 | ch = bgetch(); | ||
964 | ////qDebug("Function:%x", ch); | ||
965 | switch (ch) | ||
966 | { | ||
967 | case 0x38: | ||
968 | // //qDebug("Break:%u", locate()); | ||
969 | if (m_lastBreak == locate()) | ||
970 | { | ||
971 | ch = bgetch(); | ||
972 | } | ||
973 | else | ||
974 | { | ||
975 | ch = 10; | ||
976 | } | ||
977 | m_lastBreak = locate(); | ||
978 | break; | ||
979 | case 0x0a: | ||
980 | case 0x0c: | ||
981 | { | ||
982 | unsigned long ln = 0; | ||
983 | int skip = ch & 7; | ||
984 | for (int i = 0; i < 2; i++) | ||
985 | { | ||
986 | int ch = bgetch(); | ||
987 | ln = (ln << 8) + ch; | ||
988 | // //qDebug("ch:%d, ln:%u", ch, ln); | ||
989 | } | ||
990 | if (skip == 2) | ||
991 | { | ||
992 | ln <<= 16; | ||
993 | } | ||
994 | else | ||
995 | { | ||
996 | for (int i = 0; i < 2; i++) | ||
997 | { | ||
998 | int ch = bgetch(); | ||
999 | ln = (ln << 8) + ch; | ||
1000 | // //qDebug("ch:%d, ln:%u", ch, ln); | ||
1001 | } | ||
1002 | } | ||
1003 | // //qDebug("ln:%u", ln); | ||
1004 | mystyle.setLink(true); | ||
1005 | mystyle.setData(ln); | ||
1006 | // mystyle.setColour(255, 0, 0); | ||
1007 | bool hasseen = false; | ||
1008 | for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) | ||
1009 | { | ||
1010 | if (*it == ln) | ||
1011 | { | ||
1012 | hasseen = true; | ||
1013 | break; | ||
1014 | } | ||
1015 | } | ||
1016 | if (hasseen) | ||
1017 | { | ||
1018 | mystyle.setStrikethru(); | ||
1019 | } | ||
1020 | else | ||
1021 | { | ||
1022 | mystyle.setUnderline(); | ||
1023 | } | ||
1024 | ch = bgetch(); | ||
1025 | } | ||
1026 | break; | ||
1027 | case 0x08: | ||
1028 | ch = bgetch(); | ||
1029 | // mystyle.setColour(0, 0, 0); | ||
1030 | mystyle.unsetUnderline(); | ||
1031 | mystyle.unsetStrikethru(); | ||
1032 | mystyle.setLink(false); | ||
1033 | mystyle.setData(0); | ||
1034 | break; | ||
1035 | case 0x40: | ||
1036 | mystyle.setItalic(); | ||
1037 | ch = bgetch(); | ||
1038 | break; | ||
1039 | case 0x48: | ||
1040 | mystyle.unsetItalic(); | ||
1041 | ch = bgetch(); | ||
1042 | break; | ||
1043 | case 0x11: | ||
1044 | { | ||
1045 | ch = bgetch(); | ||
1046 | // //qDebug("Font:%d",ch); | ||
1047 | mystyle.setVOffset(0); | ||
1048 | mystyle.unsetMono(); | ||
1049 | mystyle.unsetBold(); | ||
1050 | mystyle.setFontSize(0); | ||
1051 | switch (ch) | ||
1052 | { | ||
1053 | case 0: | ||
1054 | break; | ||
1055 | case 1: | ||
1056 | mystyle.setBold(); | ||
1057 | mystyle.setFontSize(3); | ||
1058 | break; | ||
1059 | case 2: | ||
1060 | mystyle.setBold(); | ||
1061 | mystyle.setFontSize(2); | ||
1062 | break; | ||
1063 | case 3: | ||
1064 | mystyle.setBold(); | ||
1065 | mystyle.setFontSize(1); | ||
1066 | break; | ||
1067 | case 4: | ||
1068 | mystyle.setBold(); | ||
1069 | break; | ||
1070 | case 5: | ||
1071 | mystyle.setBold(); | ||
1072 | break; | ||
1073 | case 6: | ||
1074 | mystyle.setBold(); | ||
1075 | break; | ||
1076 | case 7: | ||
1077 | mystyle.setBold(); | ||
1078 | break; | ||
1079 | case 8: // should be fixed width | ||
1080 | //qDebug("Trying fixed width"); | ||
1081 | mystyle.setMono(); | ||
1082 | break; | ||
1083 | case 9: | ||
1084 | mystyle.setFontSize(-1); | ||
1085 | break; | ||
1086 | case 10: | ||
1087 | mystyle.setFontSize(-2); | ||
1088 | mystyle.setVOffset(1); | ||
1089 | break; | ||
1090 | case 11: | ||
1091 | mystyle.setFontSize(-2); | ||
1092 | mystyle.setVOffset(-1); | ||
1093 | break; | ||
1094 | default: | ||
1095 | qDebug("Unrecognised font"); | ||
1096 | break; | ||
1097 | } | ||
1098 | ch = bgetch(); | ||
1099 | } | ||
1100 | break; | ||
1101 | case 0x29: | ||
1102 | ch = bgetch(); | ||
1103 | switch (ch) | ||
1104 | { | ||
1105 | case 0: | ||
1106 | mystyle.setLeftJustify(); | ||
1107 | // //qDebug("left"); | ||
1108 | break; | ||
1109 | case 1: | ||
1110 | mystyle.setRightJustify(); | ||
1111 | // //qDebug("right"); | ||
1112 | break; | ||
1113 | case 2: | ||
1114 | mystyle.setCentreJustify(); | ||
1115 | // //qDebug("centre"); | ||
1116 | break; | ||
1117 | case 3: | ||
1118 | mystyle.setFullJustify(); | ||
1119 | // //qDebug("full"); | ||
1120 | break; | ||
1121 | |||
1122 | } | ||
1123 | ch = bgetch(); | ||
1124 | break; | ||
1125 | case 0x53: | ||
1126 | { | ||
1127 | int r = bgetch(); | ||
1128 | int g = bgetch(); | ||
1129 | int b = bgetch(); | ||
1130 | mystyle.setColour(r,g,b); | ||
1131 | ch = bgetch(); | ||
1132 | } | ||
1133 | break; | ||
1134 | case 0x1a: | ||
1135 | case 0x5c: | ||
1136 | { | ||
1137 | bool hasalternate = (ch == 0x5c); | ||
1138 | UInt16 ir = bgetch(); | ||
1139 | ir = (ir << 8) + bgetch(); | ||
1140 | if (hasalternate) | ||
1141 | { | ||
1142 | //qDebug("Alternate image:%x", ir); | ||
1143 | UInt16 ir2 = bgetch(); | ||
1144 | ir2 = (ir2 << 8) + bgetch(); | ||
1145 | if (!fast) mystyle.setPicture(true, expandimg(ir2, true), true, ir << 16); | ||
1146 | #ifdef LOCALPICTURES | ||
1147 | UInt32 ln = ir; | ||
1148 | ln <<= 16; | ||
1149 | mystyle.setLink(true); | ||
1150 | mystyle.setData(ln); | ||
1151 | #endif | ||
1152 | } | ||
1153 | else | ||
1154 | { | ||
1155 | if (!fast) mystyle.setPicture(true, expandimg(ir)); | ||
1156 | } | ||
1157 | // if (mystyle.getLink()) qDebug("Picture link!"); | ||
1158 | ch = '#'; | ||
1159 | } | ||
1160 | // ch = bgetch(); | ||
1161 | break; | ||
1162 | case 0x33: | ||
1163 | { | ||
1164 | UInt8 h = bgetch(); | ||
1165 | UInt8 wc = bgetch(); | ||
1166 | UInt8 pc = bgetch(); | ||
1167 | UInt16 w = wc; | ||
1168 | // //qDebug("h,w,pc [%u, %u, %u]", h, w, pc); | ||
1169 | if (w == 0) | ||
1170 | { | ||
1171 | w = (m_scrWidth*(unsigned long)pc)/100; | ||
1172 | } | ||
1173 | if (w == 0) w = m_scrWidth; | ||
1174 | mystyle.setPicture(false, hRule(w,h,mystyle.Red(),mystyle.Green(),mystyle.Blue())); | ||
1175 | // if (mystyle.getLink()) //qDebug("hRule link!"); | ||
1176 | ch = '#'; | ||
1177 | } | ||
1178 | break; | ||
1179 | case 0x60: | ||
1180 | mystyle.setUnderline(); | ||
1181 | ch = bgetch(); | ||
1182 | break; | ||
1183 | case 0x68: | ||
1184 | mystyle.unsetUnderline(); | ||
1185 | ch = bgetch(); | ||
1186 | break; | ||
1187 | case 0x22: | ||
1188 | ch = bgetch(); | ||
1189 | mystyle.setLeftMargin(ch); | ||
1190 | // //qDebug("Left margin:%d", ch); | ||
1191 | ch = bgetch(); | ||
1192 | mystyle.setRightMargin(ch); | ||
1193 | // //qDebug("Right margin:%d", ch); | ||
1194 | ch = bgetch(); | ||
1195 | break; | ||
1196 | case 0x70: | ||
1197 | mystyle.setStrikethru(); | ||
1198 | ch = bgetch(); | ||
1199 | break; | ||
1200 | case 0x78: | ||
1201 | mystyle.unsetStrikethru(); | ||
1202 | ch = bgetch(); | ||
1203 | break; | ||
1204 | case 0x83: | ||
1205 | { | ||
1206 | int tlen = bgetch(); | ||
1207 | ch = bgetch(); | ||
1208 | ch <<= 8; | ||
1209 | ch |= (tchar)bgetch(); | ||
1210 | for (int i = 0; i < tlen; i++) bgetch(); | ||
1211 | //qDebug("Function 83"); | ||
1212 | } | ||
1213 | break; | ||
1214 | case 0x85: | ||
1215 | default: | ||
1216 | qDebug("Function:%x NOT IMPLEMENTED", ch); | ||
1217 | { | ||
1218 | int skip = ch & 7; | ||
1219 | for (int i = 0; i < skip; i++) | ||
1220 | { | ||
1221 | ch = bgetch(); | ||
1222 | //qDebug("Arg %d, %d", i, ch); | ||
1223 | } | ||
1224 | ch = bgetch(); | ||
1225 | } | ||
1226 | } | ||
1227 | } | ||
1228 | |||
1229 | if (m_lastIsBreak && !mystyle.isMono()) | ||
1230 | { | ||
1231 | while (ch == ' ') | ||
1232 | { | ||
1233 | ch = getch(false); | ||
1234 | } | ||
1235 | } | ||
1236 | |||
1237 | m_lastIsBreak = (ch == 10); | ||
1238 | |||
1239 | return (ch == EOF) ? UEOF : ch; | ||
1240 | } | ||
diff --git a/noncore/apps/opie-reader/plucker_base.h b/noncore/apps/opie-reader/plucker_base.h new file mode 100644 index 0000000..131b999 --- a/dev/null +++ b/noncore/apps/opie-reader/plucker_base.h | |||
@@ -0,0 +1,119 @@ | |||
1 | #ifndef __PLUCKER_BASE_H | ||
2 | #define __PLUCKER_BASE_H | ||
3 | |||
4 | #include "useqpe.h" | ||
5 | #include "CExpander.h" | ||
6 | #include <zlib.h> | ||
7 | #include "ztxt.h" | ||
8 | #include "pdb.h" | ||
9 | #include "CBuffer.h" | ||
10 | #include "my_list.h" | ||
11 | #include "Navigation.h" | ||
12 | |||
13 | struct CPlucker_record0 | ||
14 | { | ||
15 | UInt16 uid; | ||
16 | UInt16 version; | ||
17 | UInt16 nRecords; | ||
18 | }; | ||
19 | |||
20 | struct CPluckerbkmk | ||
21 | { | ||
22 | UInt32 offset; | ||
23 | tchar title[MAX_BMRK_LENGTH]; | ||
24 | }; | ||
25 | |||
26 | #ifdef LOCALPICTURES | ||
27 | class QScrollView; | ||
28 | class QWidget; | ||
29 | #endif | ||
30 | |||
31 | class CPlucker_base : public CExpander, public Cpdb | ||
32 | { | ||
33 | protected: | ||
34 | virtual void setbuffersize() = 0; | ||
35 | virtual void GetHeader(UInt16&, UInt16&, UInt32&, UInt8&, UInt8&) = 0; | ||
36 | virtual int HeaderSize() = 0; | ||
37 | unsigned short finduid(unsigned short); | ||
38 | char* geturl(UInt16); | ||
39 | void Expand(UInt32, UInt8, UInt8*, UInt32); | ||
40 | CList<unsigned long> visited; | ||
41 | bool m_lastIsBreak; | ||
42 | #ifdef LOCALPICTURES | ||
43 | QScrollView* m_viewer; | ||
44 | QWidget* m_picture; | ||
45 | #endif | ||
46 | size_t textlength, m_lastBreak; | ||
47 | UInt16 uid; | ||
48 | int m_nextPara, m_nextParaIndex; | ||
49 | CBufferFace<UInt16> m_ParaOffsets; | ||
50 | CBufferFace<UInt16> m_ParaAttrs; | ||
51 | UInt16 m_nParas; | ||
52 | CStyle mystyle; | ||
53 | // bool bInit; | ||
54 | UInt32 buffersize; | ||
55 | UInt32 compressedbuffersize; | ||
56 | UInt32 buffercontent; | ||
57 | UInt8* expandedtextbuffer; | ||
58 | UInt8* compressedtextbuffer; | ||
59 | // char* urls; | ||
60 | // size_t urlsize; | ||
61 | size_t bufferpos; | ||
62 | UInt16 bufferrec; | ||
63 | CPlucker_record0 hdr0; | ||
64 | bool m_bufferisreserved; | ||
65 | size_t currentpos; | ||
66 | bool expand(int); | ||
67 | void UnZip(UInt8*, size_t, UInt8*, size_t); | ||
68 | void UnDoc(UInt8*, size_t, UInt8*, size_t); | ||
69 | #ifdef LOCALPICTURES | ||
70 | void showimg(UInt16 tgt); | ||
71 | #endif | ||
72 | QImage* getimg(UInt16 tgt); | ||
73 | QImage* expandimg(UInt16 tgt, bool border=false); | ||
74 | void home(); | ||
75 | virtual int bgetch() = 0; | ||
76 | CNavigation m_nav; | ||
77 | public: | ||
78 | #ifdef USEQPE | ||
79 | void suspend() | ||
80 | { | ||
81 | CExpander::suspend(fin); | ||
82 | } | ||
83 | void unsuspend() | ||
84 | { | ||
85 | CExpander::unsuspend(fin); | ||
86 | } | ||
87 | #endif | ||
88 | QImage* getPicture(unsigned long tgt); | ||
89 | void sizes(unsigned long& _file, unsigned long& _text); | ||
90 | bool hasrandomaccess() { return true; } | ||
91 | virtual ~CPlucker_base(); | ||
92 | CPlucker_base(); | ||
93 | int OpenFile(const char *src); | ||
94 | virtual tchar getch(bool) = 0; | ||
95 | tchar getch_base(bool); | ||
96 | int getch(); | ||
97 | void getch(tchar&, CStyle&); | ||
98 | unsigned int locate(); | ||
99 | void locate(unsigned int n); | ||
100 | CList<Bkmk>* getbkmklist(); | ||
101 | linkType hyperlink(unsigned int n, QString&); | ||
102 | MarkupType PreferredMarkup() | ||
103 | { | ||
104 | return cNONE; | ||
105 | } | ||
106 | void saveposn(size_t posn) { m_nav.saveposn(posn); } | ||
107 | void writeposn(size_t posn) { m_nav.writeposn(posn); } | ||
108 | bool forward(size_t& loc) { return m_nav.forward(loc); } | ||
109 | bool back(size_t& loc) { return m_nav.back(loc); } | ||
110 | bool hasnavigation() { return true; } | ||
111 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen); | ||
112 | void putSaveData(unsigned char*& src, unsigned short& srclen); | ||
113 | |||
114 | virtual bool CorrectDecoder() = 0; | ||
115 | // virtual void setlink(QString&, const QString&) = 0; | ||
116 | virtual QImage* imagefromdata(UInt8*, UInt32) = 0; | ||
117 | }; | ||
118 | |||
119 | #endif | ||
diff --git a/noncore/apps/opie-reader/qtreader.pro b/noncore/apps/opie-reader/qtreader.pro new file mode 100644 index 0000000..db85aa4 --- a/dev/null +++ b/noncore/apps/opie-reader/qtreader.pro | |||
@@ -0,0 +1,90 @@ | |||
1 | TEMPLATE= app | ||
2 | CONFIG = qt warn_on release | ||
3 | HEADERS = Aportis.h \ | ||
4 | Bkmks.h \ | ||
5 | BuffDoc.h \ | ||
6 | CAnnoEdit.h \ | ||
7 | CBuffer.h \ | ||
8 | CDrawBuffer.h \ | ||
9 | CEncoding.h \ | ||
10 | CEncoding_tables.h \ | ||
11 | CExpander.h \ | ||
12 | CFilter.h \ | ||
13 | CloseDialog.h \ | ||
14 | Filedata.h \ | ||
15 | FixedFont.h \ | ||
16 | FontControl.h \ | ||
17 | GraphicWin.h \ | ||
18 | Markups.h \ | ||
19 | Navigation.h \ | ||
20 | Palm2QImage.h \ | ||
21 | Prefs.h \ | ||
22 | QFloatBar.h \ | ||
23 | QTReader.h \ | ||
24 | QTReaderApp.h \ | ||
25 | QtrListView.h \ | ||
26 | Queue.h \ | ||
27 | StateData.h \ | ||
28 | StyleConsts.h \ | ||
29 | ToolbarPrefs.h \ | ||
30 | URLDialog.h \ | ||
31 | ZText.h \ | ||
32 | arith.h \ | ||
33 | cbkmkselector.h \ | ||
34 | config.h \ | ||
35 | fileBrowser.h \ | ||
36 | infowin.h \ | ||
37 | linktype.h \ | ||
38 | my_list.h \ | ||
39 | names.h \ | ||
40 | opie.h \ | ||
41 | pdb.h \ | ||
42 | plucker_base.h \ | ||
43 | plucker.h \ | ||
44 | ppm.h \ | ||
45 | ppm_expander.h \ | ||
46 | usenef.h \ | ||
47 | useqpe.h \ | ||
48 | ustring.h \ | ||
49 | utypes.h \ | ||
50 | version.h \ | ||
51 | ztxt.h | ||
52 | |||
53 | SOURCES = Aportis.cpp \ | ||
54 | Bkmks.cpp \ | ||
55 | BuffDoc.cpp \ | ||
56 | CBuffer.cpp \ | ||
57 | CDrawBuffer.cpp \ | ||
58 | CEncoding.cpp \ | ||
59 | CEncoding_tables.cpp \ | ||
60 | CFilter.cpp \ | ||
61 | CloseDialog.cpp \ | ||
62 | FontControl.cpp \ | ||
63 | Navigation.cpp \ | ||
64 | Palm2QImage.cpp \ | ||
65 | Prefs.cpp \ | ||
66 | QTReader.cpp \ | ||
67 | QTReaderApp.cpp \ | ||
68 | QtrListView.cpp \ | ||
69 | StyleConsts.cpp \ | ||
70 | ToolbarPrefs.cpp \ | ||
71 | URLDialog.cpp \ | ||
72 | arith_d.cpp \ | ||
73 | fileBrowser.cpp \ | ||
74 | infowin.cpp \ | ||
75 | main.cpp \ | ||
76 | pdb.cpp \ | ||
77 | plucker.cpp \ | ||
78 | plucker_base.cpp \ | ||
79 | ppm.cpp \ | ||
80 | ppm_expander.cpp \ | ||
81 | version.cpp \ | ||
82 | ztxt.cpp | ||
83 | |||
84 | INTERFACES= | ||
85 | DESTDIR = ../bin | ||
86 | #INCLUDEPATH+= $(QPEDIR)/include | ||
87 | #DEPENDPATH+= $(QPEDIR)/include | ||
88 | TARGET = uqtreader | ||
89 | LIBS += -lqpe | ||
90 | |||
diff --git a/noncore/apps/opie-reader/usenef.h b/noncore/apps/opie-reader/usenef.h new file mode 100644 index 0000000..57898cb --- a/dev/null +++ b/noncore/apps/opie-reader/usenef.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __USENEF_H | ||
2 | #define __USENEF_H | ||
3 | |||
4 | //#define USENEF | ||
5 | |||
6 | #endif | ||
diff --git a/noncore/apps/opie-reader/useqpe.h b/noncore/apps/opie-reader/useqpe.h new file mode 100644 index 0000000..1fc39de --- a/dev/null +++ b/noncore/apps/opie-reader/useqpe.h | |||
@@ -0,0 +1,3 @@ | |||
1 | #ifndef USEQPE | ||
2 | #define USEQPE | ||
3 | #endif | ||
diff --git a/noncore/apps/opie-reader/version.cpp b/noncore/apps/opie-reader/version.cpp new file mode 100644 index 0000000..3796b67 --- a/dev/null +++ b/noncore/apps/opie-reader/version.cpp | |||
@@ -0,0 +1,39 @@ | |||
1 | #include "version.h" | ||
2 | #include "names.h" | ||
3 | #include <qmessagebox.h> | ||
4 | |||
5 | bool CheckVersion(int& major, int& bkmktype, char& minor) | ||
6 | { | ||
7 | if ( | ||
8 | (major != MAJOR) | ||
9 | || | ||
10 | (bkmktype != BKMKTYPE) | ||
11 | || | ||
12 | (minor != MINOR) | ||
13 | ) | ||
14 | { | ||
15 | major = MAJOR; | ||
16 | bkmktype = BKMKTYPE; | ||
17 | minor = MINOR; | ||
18 | /* | ||
19 | QMessageBox::warning(NULL, PROGNAME, | ||
20 | "This is the first time that you have\n" | ||
21 | "run this version of OpieReader.\n\n" | ||
22 | "There are two new icons visible at\n" | ||
23 | "the left end of the toolbar. The left\n" | ||
24 | "one brings up the menus, the next\n" | ||
25 | "one brings up the settings dialog.\n\n" | ||
26 | "Start by tapping the settings icon\n" | ||
27 | "and selecting the Buttons tab to\n" | ||
28 | "make sure that the buttons are\n" | ||
29 | "mapped as you expect\n\n" | ||
30 | "Next go to Settings/Toolbars via the\n" | ||
31 | "menu icon to set up your toolbars."); | ||
32 | */ | ||
33 | return true; | ||
34 | } | ||
35 | else | ||
36 | { | ||
37 | return false; | ||
38 | } | ||
39 | } | ||