summaryrefslogtreecommitdiff
path: root/recipes/opie-reader/files/qt4.patch
blob: f19000f12f4e91988b61029ba01c0b7e55696ee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
diff --git a/Aportis.cpp b/Aportis.cpp
index 37dcc99..03c26ea 100644
--- a/Aportis.cpp
+++ b/Aportis.cpp
@@ -443,8 +443,7 @@ unsuspend();
   gotorecordnumber(tgtrec);
   UInt8* imgbuffer = new UInt8[reclen];
   fread(imgbuffer, 1, reclen, fin);
-  QByteArray arr;
-  arr.assign((const char*)imgbuffer, reclen);
+  QByteArray arr((const char*)imgbuffer, reclen);
 
   QImage* qimage = new QImage(arr);
   fseek(fin, cur, SEEK_SET);
diff --git a/Bkmks.cpp b/Bkmks.cpp
index 45aa045..c67db9e 100644
--- a/Bkmks.cpp
+++ b/Bkmks.cpp
@@ -32,8 +32,7 @@ Bkmk::Bkmk(const Bkmk& rhs) :
   m_annolen(0),
   m_position(0)
 {
-    init(rhs.name(), sizeof(tchar)*(ustrlen(rhs.name())+1), rhs.anno(),
-         sizeof(tchar)*(ustrlen(rhs.anno())+1), rhs.value());
+    *this = rhs;
 }
 
 Bkmk::Bkmk(const tchar* _nm, const tchar* _anno, unsigned int _p) : m_position(_p)
diff --git a/BuffDoc.cpp b/BuffDoc.cpp
index 355d14d..170ed43 100644
--- a/BuffDoc.cpp
+++ b/BuffDoc.cpp
@@ -23,6 +23,8 @@
 #include "Reb.h"
 #endif
 
+#include "uqtcommon.h"
+
 
 linkType BuffDoc::hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm)
 {
@@ -674,35 +676,19 @@ int BuffDoc::openfile(QWidget* _parent, const char *src)
     }
     //        //qDebug("Doing final open:%x:%x",exp,filt);
 #else
-#ifdef USEQPE
-#ifdef OPIE
-  QString codecpath(getenv("OPIEDIR"));
-#else
-  QString codecpath(getenv("QTDIR"));
-#endif
-  codecpath += "/plugins/reader/codecs";
-#else
-  QString codecpath(getenv("READERDIR"));
-  codecpath += "/codecs";
-#endif
-  QDir d(codecpath, "*.so");
+  QDir d(uqt_codecspath(), "*.so");
 
   if (d.exists())
     {
 
-      const QFileInfoList *list = d.entryInfoList();
-      QFileInfoListIterator it( *list );      // create list iterator
-      QFileInfo *fi;                          // pointer for traversing
-  
+      QFileInfoList list = d.entryInfoList();
       int ret = -1;
-      while ( ret != 0 && (fi=it.current()) )
-	{           // for each file...
+      for(QFileInfoListIterator it=list.begin();ret && it!=list.end();++it) {
 	  if (exp != NULL) delete exp;
-	  qDebug("Trying %s", (const char*)fi->fileName());
-	  exp = new ebookcodec(fi->fileName());
+	  qDebug("Trying %s", (const char*)it->fileName());
+	  exp = new ebookcodec(it->fileName());
 	  ret = exp->openfile(src);
-	  ++it;
-	}
+      }
       qDebug("Buffdoc:Finished opening");
       if (ret != 0)
 	{
diff --git a/ButtonPrefs.cpp b/ButtonPrefs.cpp
index 762de55..2c4cad7 100644
--- a/ButtonPrefs.cpp
+++ b/ButtonPrefs.cpp
@@ -17,7 +17,7 @@
 #include <qtooltip.h>
 #include <qwhatsthis.h>
 #include <qbuttongroup.h>
-#include <qmultilineedit.h>
+#include <Qt3Support/Q3MultiLineEdit>
 #ifdef USECOMBO
 #include <qcombobox.h>
 #else
@@ -26,12 +26,14 @@
 #include <qfontdatabase.h>
 
 #include <qlistview.h>
+#include <Qt3Support/Q3ListViewItem>
+#include <QtGui/QKeyEvent>
 
-class MyQListViewItem : public QListViewItem
+class MyQListViewItem : public Q3ListViewItem
 {
   orKey o;
 public:
-  MyQListViewItem(const orKey& _o, QListView* p, const QString& c1, const QString& c2, const QString& c3) : QListViewItem(p, c1, c2, c3), o(_o) { }
+  MyQListViewItem(const orKey& _o, Q3ListView* p, const QString& c1, const QString& c2, const QString& c3) : Q3ListViewItem(p, c1, c2, c3), o(_o) { }
   orKey getKey() { return o; }
 };
 
@@ -43,7 +45,7 @@ void CButtonPrefs::mapkey(Qt::ButtonState st, int _key)
 void CButtonPrefs::mapkey(Qt::ButtonState st, int _key, int act)
 {
   orKey key(st, _key, ((act == cesScrollMore) || (act == cesScrollLess)));
-  QMap<orKey,QListViewItem*>::Iterator iter = listmap.find(key);
+  QMap<orKey,Q3ListViewItem*>::Iterator iter = listmap.find(key);
   if (iter != listmap.end())
     {
       lb->takeItem(iter.data());
@@ -112,7 +114,7 @@ CButtonPrefs::CButtonPrefs( QMap<orKey, int>* _kmap, QWidget* parent,  const cha
 {
   QVBoxLayout* vo = new QVBoxLayout(this);
   QHBoxLayout* lo = new QHBoxLayout();
-  setFocusPolicy(QWidget::StrongFocus);
+  setFocusPolicy(Qt::StrongFocus);
 #ifdef USECOMBO
     action = new QComboBox( this );
 #else
@@ -123,17 +125,17 @@ CButtonPrefs::CButtonPrefs( QMap<orKey, int>* _kmap, QWidget* parent,  const cha
 
 
 
-    QMultiLineEdit* TextLabel1 = new QMultiLineEdit( this );
+    Q3MultiLineEdit* TextLabel1 = new Q3MultiLineEdit( this );
     TextLabel1->setText( tr( "Press the key(s) you want assigned to the highlighted function.\n\nPress the delete button to unmap the key.\n\nUse the \"Close\" button (not the [x]) to finish." ) );
     TextLabel1->setReadOnly(true);
-    TextLabel1->setWordWrap(QMultiLineEdit::WidgetWidth);
+    TextLabel1->setWordWrap(Q3MultiLineEdit::WidgetWidth);
 
     //    lo->addWidget(TextLabel, 0, Qt::AlignTop);
     //    lo->addWidget(action, 0, Qt::AlignTop);
     lo->addWidget(TextLabel1);
     lo->addWidget(action);
     vo->addLayout(lo);
-    lb = new QListView(this);
+    lb = new Q3ListView(this);
     lb->addColumn( tr( "Key" ) );
     lb->addColumn( tr( "Function" ) );
     lb->addColumn( tr( "Scroll" ) );
diff --git a/ButtonPrefs.h b/ButtonPrefs.h
index 9af04e1..f09ad02 100644
--- a/ButtonPrefs.h
+++ b/ButtonPrefs.h
@@ -11,11 +11,13 @@
 
 #include <qvariant.h>
 #include <qwidget.h>
-#include <qtabdialog.h>
+#include <Qt3Support/Q3TabDialog>
 #include <qtabwidget.h>
 #include <qspinbox.h>
 #include <qcheckbox.h>
 #include <qlineedit.h>
+#include <qnamespace.h>
+using namespace Qt;
 
 #define USECOMBO
 
@@ -33,18 +35,18 @@ class QGridLayout;
 //class QCheckBox;
 class QLabel;
 //class QSpinBox;
-class QListViewItem;
+class Q3ListViewItem;
 
-class QListView;
-class QListViewItem;
+class Q3ListView;
+class Q3ListViewItem;
 
 class CButtonPrefs : public QWidget
 {
   Q_OBJECT
 
   QMap<orKey, int> *kmap;
-  QMap<orKey, QListViewItem*> listmap;
-  QListView* lb;
+  QMap<orKey, Q3ListViewItem*> listmap;
+  Q3ListView* lb;
   void keyPressEvent(QKeyEvent* e);
 #ifdef USECOMBO
     void populate(QComboBox*);
diff --git a/CAnnoEdit.cpp b/CAnnoEdit.cpp
index 35821ed..6ee1321 100644
--- a/CAnnoEdit.cpp
+++ b/CAnnoEdit.cpp
@@ -83,8 +83,8 @@ CAnnoEdit::CAnnoEdit(QWidget *parent, const char *name, WFlags f) :
 {
   QVBoxLayout* grid = new QVBoxLayout(this);
   m_name = new QLineEdit(this, "Name");
-  m_anno = new QMultiLineEdit(this, "Annotation");
-  m_anno->setWordWrap(QMultiLineEdit::WidgetWidth);
+  m_anno = new Q3MultiLineEdit(this, "Annotation");
+  m_anno->setWordWrap(Q3MultiLineEdit::WidgetWidth);
   QPushButton* exitButton = new QPushButton("Okay", this);
   connect(exitButton, SIGNAL( clicked() ), this, SLOT( slotOkay() ) );
   QPushButton* cancelButton = new QPushButton("Cancel", this);
diff --git a/CAnnoEdit.h b/CAnnoEdit.h
index 78d3eeb..c74c560 100644
--- a/CAnnoEdit.h
+++ b/CAnnoEdit.h
@@ -4,15 +4,17 @@
 #include <qlayout.h>
 #include <qpushbutton.h>
 #include <qlineedit.h>
-#include <qmultilineedit.h>
+#include <Qt3Support/Q3MultiLineEdit>
 #include <qcombobox.h>
+#include <qnamespace.h>
+using namespace Qt;
 
 class CAnnoEdit : public QWidget
 {
     Q_OBJECT
 
     QLineEdit* m_name;
-    QMultiLineEdit* m_anno;
+    Q3MultiLineEdit* m_anno;
     size_t m_posn, m_posn2;
     QComboBox* colorbox;
  public:
diff --git a/CFilter.cpp b/CFilter.cpp
index a4ea60a..84fa451 100644
--- a/CFilter.cpp
+++ b/CFilter.cpp
@@ -9,6 +9,7 @@
 #include "CDrawBuffer.h"
 #include "CFilter.h"
 #include "hrule.h"
+#include "uqtcommon.h"
 
 #include <qregexp.h>
 #include <qimage.h>
@@ -665,17 +666,8 @@ class ErrorFilter : public CFilter
 #ifndef __STATIC
 ExternFilter::ExternFilter(const QString& nm, const QString& optional) : filt(NULL), handle(NULL)
 {
-#ifdef USEQPE
-#ifdef OPIE
-  QString filterpath(getenv("OPIEDIR"));
-#else
-  QString filterpath(getenv("QTDIR"));
-#endif
-  filterpath += "/plugins/reader/filters/lib";
-#else
-  QString filterpath(getenv("READERDIR"));
-  filterpath += "/filters/lib";
-#endif
+  QString filterpath = uqt_filterspath();
+  filterpath += "lib";
   filterpath += nm;
   filterpath += ".so";
   if (QFile::exists(filterpath))
diff --git a/CHM.cpp b/CHM.cpp
index ace5abc..3c325bb 100644
--- a/CHM.cpp
+++ b/CHM.cpp
@@ -335,7 +335,7 @@ int CHM::getch() {
 #else
     QChar letter = chmBuffer[bufpos++];
 #endif
-    return (int)(char)letter;
+    return letter.unicode();
 }
 
 void CHM::getch(tchar& ch, CStyle& sty)
diff --git a/CloseDialog.cpp b/CloseDialog.cpp
index 741fa67..62ae906 100644
--- a/CloseDialog.cpp
+++ b/CloseDialog.cpp
@@ -5,7 +5,7 @@ CCloseDialog::CCloseDialog(const QString& fname, bool fs, QWidget* parent, const
 {
     setCaption(tr("Tidy-up"));
     QVBoxLayout *tmp = new QVBoxLayout(this);
-    QVButtonGroup* vb = new QVButtonGroup(tr("Delete"), this);
+    Q3VButtonGroup* vb = new Q3VButtonGroup(tr("Delete"), this);
     tmp->addWidget(vb);
     QString filestring = tr("Delete") + " " + fname;
     file = new QCheckBox(filestring, vb);
diff --git a/CloseDialog.h b/CloseDialog.h
index 54aaf1c..84609f5 100644
--- a/CloseDialog.h
+++ b/CloseDialog.h
@@ -11,14 +11,17 @@
 
 #include <qvariant.h>
 #include <qwidget.h>
-#include <qtabdialog.h>
+#include <Qt3Support/Q3TabDialog>
 #include <qtabwidget.h>
 #include <qspinbox.h>
 #include <qcheckbox.h>
 #include <qcombobox.h>
 #include <qlineedit.h>
 //#include <qpe/menubutton.h>
-#include <qvbuttongroup.h>
+#include <Qt3Support/Q3VButtonGroup>
+#include <QtGui/QKeyEvent>
+#include <qnamespace.h>
+using namespace Qt;
 
 class QVBoxLayout; 
 class QHBoxLayout; 
diff --git a/FontControl.cpp b/FontControl.cpp
index 08b8c52..0be54ba 100644
--- a/FontControl.cpp
+++ b/FontControl.cpp
@@ -1,4 +1,5 @@
 #include <qfontdatabase.h>
+#include <Qt3Support/Q3ValueList>
 
 #include "FontControl.h"
 
@@ -33,9 +34,9 @@ int FontControl::gzoom()
 
 bool FontControl::ChangeFont(QString& n, int tgt)
 {
-    QValueList<int>::Iterator it;
+    Q3ValueList<int>::Iterator it;
     QFontDatabase fdb;
-    QValueList<int> sizes = fdb.pointSizes(n);
+    Q3ValueList<int> sizes = fdb.pointSizes(n);
     if (sizes.count() == 0)
     {
 	return false;
@@ -65,3 +66,25 @@ bool FontControl::ChangeFont(QString& n, int tgt)
     }
     return true;
 }
+
+void FontControl::setCourier() {
+    setCourier(m_fontname);
+}
+void FontControl::setCourier(const QString fn) {
+    QFontDatabase fdb;
+    QStringList fl = fdb.families();
+    setCourier(fn,fl);
+}
+void FontControl::setCourier(const QString fn,const QStringList fl) {
+    QString fp;
+    int sp = fn.indexOf(' ');
+    if(sp>=0) fp = fn.left(sp);
+    for(QStringList::const_iterator i=fl.begin();i!=fl.end();++i) {
+	if(
+		( i->startsWith(fn,Qt::CaseInsensitive)
+		 || ( (!fp.isEmpty()) && i->startsWith(fp,Qt::CaseInsensitive) ) )
+		&& ( i->endsWith("mono",Qt::CaseInsensitive)
+		    || i->endsWith("Fixed") ) )
+	    hasCourier(true,*i);
+    }
+}
diff --git a/FontControl.h b/FontControl.h
index 563e1a8..c7a54ab 100644
--- a/FontControl.h
+++ b/FontControl.h
@@ -2,6 +2,7 @@
 #define __FONTCONTROL_H
 
 #include <qfontmetrics.h>
+#include <QFontDatabase>
 #include "StyleConsts.h"
 
 class FontControl
@@ -32,6 +33,7 @@ class FontControl
       m_fontsizes(NULL), m_hasCourier(false), m_leading(0), m_extraspace(0), m_fixgraphics(true)
     {
 	ChangeFont(n, size);
+	setCourier();
     }
     ~FontControl()
 	{
@@ -167,6 +169,10 @@ class FontControl
 	{
 	    return m_extraspace;
 	}
+
+    void setCourier();
+    void setCourier(const QString fn);
+    void setCourier(const QString fn,const QStringList fl);
 };
 
 #endif
diff --git a/GraphicWin.h b/GraphicWin.h
index 70d5f7e..a6c556a 100644
--- a/GraphicWin.h
+++ b/GraphicWin.h
@@ -1,14 +1,16 @@
 #ifndef __GRAPHICWIN_H
 #define __GRAPHICWIN_H
 
-#include <qscrollview.h>
+#include <Qt3Support/Q3ScrollView>
 #include <qpixmap.h>
 #include <qimage.h>
 #include <qpushbutton.h>
 #include <qlayout.h>
 #include <qwmatrix.h>
+#include <qnamespace.h>
+using namespace Qt;
 
-class GraphicScroll : public QScrollView
+class GraphicScroll : public Q3ScrollView
 {
   Q_OBJECT
   QWidget* m_picture;
@@ -19,7 +21,7 @@ class GraphicScroll : public QScrollView
     }
  public:
   GraphicScroll( QWidget *parent=0, const char *name=0, WFlags f = 0)
-    : QScrollView(parent, name, f)
+    : Q3ScrollView(parent, name, f)
     {
       m_picture = new QWidget(viewport());
       addChild(m_picture);
diff --git a/Prefs.cpp b/Prefs.cpp
index 6c4d45b..d20dc00 100644
--- a/Prefs.cpp
+++ b/Prefs.cpp
@@ -7,6 +7,7 @@
 ** WARNING! All changes made in this file will be lost!
 ****************************************************************************/
 #include "Prefs.h"
+#include "uqtcommon.h"
 
 #include <stdlib.h>
 
@@ -27,6 +28,7 @@
 #include <qpe/menubutton.h>
 #endif
 #include <qfontdatabase.h>
+#include <Qt3Support/Q3ButtonGroup>
 
 #ifdef USECOMBO
 void populate_colours(QComboBox *mb)
@@ -58,7 +60,7 @@ CLayoutPrefs::CLayoutPrefs( QWidget* parent,  const char* name, WFlags fl )
     : QWidget( parent, name, fl )
 {
     QHBoxLayout* hb = new QHBoxLayout(this);
-    QButtonGroup* bg = new QButtonGroup(2, Qt::Horizontal, "Text", this);
+    Q3ButtonGroup* bg = new Q3ButtonGroup(2, Qt::Horizontal, "Text", this);
     hb->addWidget(bg);
 
     StripCR = new QCheckBox( bg );
@@ -592,7 +594,7 @@ CMiscPrefs::CMiscPrefs( QWidget* parent,  const char* name, WFlags fl )
     vl->setMargin( 0 );
     hl->setMargin( 0 );
 
-    QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, "Select Action", this);
+    Q3GroupBox* gb = new Q3GroupBox(1, Qt::Horizontal, "Select Action", this);
     hl->addWidget( gb );
 
     annotation = new QCheckBox( gb );
@@ -607,7 +609,7 @@ CMiscPrefs::CMiscPrefs( QWidget* parent,  const char* name, WFlags fl )
     boutput = new QCheckBox( gb );
     boutput->setText( tr( "Output" ) );
 
-    QButtonGroup* bg = new QButtonGroup(1, Qt::Horizontal, "Plucker", this);
+    Q3ButtonGroup* bg = new Q3ButtonGroup(1, Qt::Horizontal, "Plucker", this);
     hl->addWidget( bg );
 
     Depluck = new QCheckBox( bg );
@@ -618,7 +620,7 @@ CMiscPrefs::CMiscPrefs( QWidget* parent,  const char* name, WFlags fl )
 
     Continuous = new QCheckBox( bg );
     Continuous->setText( tr( "Continuous" ) );
-    bg = new QButtonGroup(2, Qt::Horizontal, "Background", this);
+    bg = new Q3ButtonGroup(2, Qt::Horizontal, "Background", this);
     vl->addWidget( bg );
 
 //    QLabel* TextLabel = new QLabel( bg );
@@ -662,7 +664,7 @@ CScrollPrefs::CScrollPrefs( QWidget* parent,  const char* name, WFlags fl )
 
     hl->setMargin( 0 );
 
-    QButtonGroup* bg = new QButtonGroup(2, Qt::Horizontal, "Scroll", this);
+    Q3ButtonGroup* bg = new Q3ButtonGroup(2, Qt::Horizontal, "Scroll", this);
     hl->addWidget( bg );
 
     //    scrollinplace = new QCheckBox( bg );
@@ -707,18 +709,8 @@ CScrollPrefs::CScrollPrefs( QWidget* parent,  const char* name, WFlags fl )
 #else
     outcodec = new MenuButton( this);
 #endif
-#ifdef USEQPE
-#ifdef OPIE
-      QString codecpath(getenv("OPIEDIR"));
-#else
-      QString codecpath(getenv("QTDIR"));
-#endif
-      codecpath += "/plugins/reader/outcodecs";
-#else
-      QString codecpath(getenv("READERDIR"));
-      codecpath += "/outcodecs";
-#endif
-      QDir ocd(codecpath, "lib*.so");
+    QString codecpath = uqt_outcodecspath();
+      QDir ocd(uqt_outcodecspath(), "lib*.so");
       for (int i = 0; i < ocd.count(); ++i)
 	{
 	  QString tmp(ocd[i]);
@@ -772,7 +764,7 @@ CInterPrefs::CInterPrefs( QWidget* parent,  const char* name, WFlags fl )
 {
     QHBoxLayout* hb = new QHBoxLayout(this);
 
-    QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, tr("International"), this);
+    Q3GroupBox* gb = new Q3GroupBox(1, Qt::Horizontal, tr("International"), this);
 
     hb->addWidget(gb);
 
@@ -784,7 +776,7 @@ CInterPrefs::CInterPrefs( QWidget* parent,  const char* name, WFlags fl )
     TextLabel = new QLabel( gb );
     TextLabel->setText( tr( "Ideogram Width" ) );
     ideogramwidth = new QSpinBox( gb );
-    ideogramwidth->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+    // ideogramwidth->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
     ideogramwidth->setRange(1,200);
 
     propfontchange = new QCheckBox( gb );
@@ -809,7 +801,7 @@ CInterPrefs::CInterPrefs( QWidget* parent,  const char* name, WFlags fl )
 
     QVBoxLayout* vb = new QVBoxLayout;
 
-    gb = new QGroupBox(1, Qt::Horizontal, "Dictionary", this);
+    gb = new Q3GroupBox(1, Qt::Horizontal, "Dictionary", this);
 
     TextLabel = new QLabel( gb );
     TextLabel->setText( tr( "Application" ) );
diff --git a/Prefs.h b/Prefs.h
index 103484e..a499506 100644
--- a/Prefs.h
+++ b/Prefs.h
@@ -11,11 +11,14 @@
 
 #include <qvariant.h>
 #include <qwidget.h>
-#include <qtabdialog.h>
+#include <Qt3Support/Q3TabDialog>
 #include <qtabwidget.h>
 #include <qspinbox.h>
 #include <qcheckbox.h>
 #include <qlineedit.h>
+#include <qnamespace.h>
+using namespace Qt;
+#include <QtGui/QKeyEvent>
 
 #define USECOMBO
 
diff --git a/QFloatBar.h b/QFloatBar.h
index cc98233..0144fce 100644
--- a/QFloatBar.h
+++ b/QFloatBar.h
@@ -1,10 +1,11 @@
 #ifndef __QFLOATBAR_H
 #define __QFLOATBAR_H
 
-#include <qtoolbar.h>
-#include <qmainwindow.h>
+#include <Qt3Support/Q3ToolBar>
+#include <Qt3Support/Q3MainWindow>
+#include <qnamespace.h>
 
-class QFloatBar : public QToolBar
+class QFloatBar : public Q3ToolBar
 {
     Q_OBJECT
 	virtual void hideEvent(QHideEvent* e)
@@ -12,7 +13,7 @@ class QFloatBar : public QToolBar
 	    /*if (e->spontaneous())*/ emit OnHide();
 	}
 	public:
-    QFloatBar(char* t, QMainWindow* mw, QMainWindow::ToolBarDock td, bool f) : QToolBar(t, mw, td, f) {}
+    QFloatBar(char* t, Q3MainWindow* mw, Qt::ToolBarDock td, bool f) : Q3ToolBar(t, mw, td, f) {}
  signals:
     void OnHide();
 };
diff --git a/QTReader.cpp b/QTReader.cpp
index 75da8ac..2c698ba 100644
--- a/QTReader.cpp
+++ b/QTReader.cpp
@@ -1999,6 +1999,7 @@ void QTReader::drawFonts()
 	      }
 	  }
 	emitRedraw();
+	update();
     }
 /*
     else
@@ -2221,7 +2222,7 @@ void QTReader::init()
   setBackgroundColor( m_bg );
   buffdoc.setfilter(getfilter());
   ChangeFont(m_textsize);
-  setFocusPolicy(QWidget::StrongFocus);
+  setFocusPolicy(Qt::StrongFocus);
   timer = new QTimer(this);
   connect(timer, SIGNAL(timeout()), this, SLOT(doscroll()));
 #ifdef USETIMER
@@ -3096,7 +3097,7 @@ void QTReader::blitRot(int dx, int dy, int sw, int sh, CDrawBuffer* txt)
 
   QPixmap pm(sw, sh);
  
-  QPainter pd(&pm, this);
+  QPainter pd(&pm); // , this);
   if (m_bgpm.isNull())
     {
       pd.eraseRect(pm.rect());
@@ -3136,7 +3137,7 @@ void QTReader::blitRot(int dx, int dy, int sw, int sh, CDrawBuffer* txt)
   /*
   p.drawPixmap(QPoint(dx, dy), rp);
   */
-  bitBlt(this, dx, dy, &rp, 0, 0, -1, -1, CopyROP);
+  bitBlt(this, dx, dy, &rp, 0, 0, -1, -1, QPainter::CompositionMode_Source);
 }
 
 QString QTReader::about()
diff --git a/QTReader.h b/QTReader.h
index 9daa07a..6afa3e7 100644
--- a/QTReader.h
+++ b/QTReader.h
@@ -8,6 +8,9 @@
 #include "BuffDoc.h"
 #include "FontControl.h"
 
+#include <qnamespace.h>
+using namespace Qt;
+
 //#include <qtimer.h>
 
 class CDrawBuffer;
diff --git a/QTReaderApp.cpp b/QTReaderApp.cpp
index b985094..529ec9e 100644
--- a/QTReaderApp.cpp
+++ b/QTReaderApp.cpp
@@ -20,7 +20,9 @@
 
 #include <qregexp.h>
 #include <qclipboard.h>
-#include <qwidgetstack.h>
+#include <QStackedWidget>
+#include <Qt3Support/Q3Action>
+#include <qdesktopwidget.h>
 #ifdef USEQPE
 #include <qpe/qpemenubar.h>
 #include <qpe/qpetoolbar.h>
@@ -31,13 +33,12 @@
 #include <qpe/menubutton.h>
 #endif
 #include <qcombobox.h>
-#include <qpopupmenu.h>
+#include <Qt3Support/Q3PopupMenu>
 #include <qaction.h>
 #include <qapplication.h>
 #include <qlineedit.h>
 #include <qtoolbutton.h>
 #include <qspinbox.h>
-#include <qobjectlist.h>
 #include <qstatusbar.h>
 #ifdef USEQPE
 #include <qpe/global.h>
@@ -66,6 +67,7 @@
 #include "FixedFont.h"
 #include "URLDialog.h"
 #include "util.h"
+#include "uqtcommon.h"
 #include <qfontdatabase.h>
 
 #ifdef USEQPE
@@ -103,18 +105,10 @@ bool CheckVersion(int&, int&, char&, QWidget*);
 #define USEMSGS
 #define PICDIR "opie-reader/"
 #else
-//#define PICDIR "/home/tim/uqtreader/pics/"
-QString picdir()
-{
-  QString hd(getenv("READERDIR"));
-  return hd + "/pics";
-}
-#define PICDIR picdir()
+#define PICDIR uqt_picspath()
 #endif
 #endif
 
-unsigned long QTReaderApp::m_uid = 0;
-
 void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); }
 
 #ifdef USEQPE
@@ -156,16 +150,9 @@ void QTReaderApp::listBkmkFiles()
         d.setFilter( QDir::Files | QDir::NoSymLinks );
 //        d.setSorting( QDir::Size | QDir::Reversed );
 
-        const QFileInfoList *list = d.entryInfoList();
-        QFileInfoListIterator it( *list );      // create list iterator
-        QFileInfo *fi;                          // pointer for traversing
-        while ( (fi=it.current()) ) {           // for each file...
-  
-		    bkmkselector->insertItem(fi->fileName(), cnt++);
-			
-			//qDebug( "%10li %s", fi->size(), fi->fileName().data() );
-            ++it;                               // goto next list element
-        }
+        QFileInfoList list = d.entryInfoList();
+	for(QFileInfoListIterator it=list.begin();it!=list.end();++it)
+	    bkmkselector->insertItem(it->fileName(), cnt++);
  
 #else /* USEQPE */
     int cnt = 0;
@@ -192,7 +179,7 @@ void QTReaderApp::listBkmkFiles()
 //tjw        menu->hide();
 
 
-        editorStack->raiseWidget( bkmkselector );
+        editorStack->setCurrentWidget( bkmkselector );
         hidetoolbars();
 	m_nBkmkAction = cRmBkmkFile;
       }
@@ -207,6 +194,8 @@ void QTReaderApp::hidetoolbars()
 
 #if defined(USEQPE)
     menubar->hide();
+#else
+    mb->hide();
 #endif
 
     if (m_scrollbar != NULL) m_scrollbar->hide();
@@ -233,7 +222,7 @@ void QTReaderApp::hidetoolbars()
 }
 
 QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
-    : QMainWindow( parent, name, f ), m_dontSave(false),
+    : Q3MainWindow( parent, name, f ), m_dontSave(false),
       fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL), m_scrollbar(NULL), m_localscroll(2), m_hidebars(false), m_kmapchanged(false)
 {
   {
@@ -337,41 +326,41 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
 //    QToolBar* markBar = new QToolBar("File", this);
 
 #if defined(USEQPE)
-    menubar = new QToolBar("Menus", this, m_tbposition);
+    menubar = new Q3ToolBar("Menus", this, m_tbposition);
     mb = new QPEMenuBar( menubar );
 #else
     mb = new QMenuBar( this );
 #endif
 
 #if defined(USEQPE)
-    QPopupMenu* tmp = new QPopupMenu(mb);
+    Q3PopupMenu* tmp = new Q3PopupMenu(mb);
     mb->insertItem( geticon( "AppsIcon" ), tmp );
 #else
     QMenuBar* tmp = mb;
 #endif
 
-    QPopupMenu *file = new QPopupMenu( mb );
+    Q3PopupMenu *file = new Q3PopupMenu( mb );
     tmp->insertItem( tr( "File" ), file );
 
-    QPopupMenu *navigation = new QPopupMenu(mb);
+    Q3PopupMenu *navigation = new Q3PopupMenu(mb);
     tmp->insertItem( tr( "Navigation" ), navigation );
 
-    QPopupMenu *view = new QPopupMenu( mb );
+    Q3PopupMenu *view = new Q3PopupMenu( mb );
     tmp->insertItem( tr( "View" ), view );
 
-    QPopupMenu *marks = new QPopupMenu( this );
+    Q3PopupMenu *marks = new Q3PopupMenu( this );
     tmp->insertItem( tr( "Marks" ), marks );
 
-    QPopupMenu *settings = new QPopupMenu( this );
+    Q3PopupMenu *settings = new Q3PopupMenu( this );
     tmp->insertItem( tr( "Settings" ), settings );
 
 //    addToolBar(menubar, "Menus",QMainWindow::Top);
 //    addToolBar(fileBar, "Toolbar",QMainWindow::Top);
 
-    //    QPopupMenu *edit = new QPopupMenu( this );
+    //    Q3PopupMenu *edit = new Q3PopupMenu( this );
 
     /*
-    QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
+    Q3Action *a = new Q3Action( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
     connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
     a->addTo( bar );
     a->addTo( file );
@@ -379,34 +368,35 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
     QWidget* widge = new QWidget(this);
     setCentralWidget( widge );
     QVBoxLayout* vlayout = new QVBoxLayout(widge);
+    vlayout->setMargin(0);
     m_layout = new QBoxLayout(QBoxLayout::LeftToRight);
     m_prog = new QLabel(widge);
     vlayout->addLayout(m_layout, 1);
     vlayout->addWidget(m_prog);
 
-    editorStack = new QWidgetStack( widge );
+    editorStack = new QStackedWidget( widge );
     //    setCentralWidget( editorStack );
 
     searchVisible = FALSE;
     regVisible = FALSE;
     m_fontVisible = false;
 
-    m_buttonprefs = new CButtonPrefs(&kmap, this);
-    editorStack->addWidget(m_buttonprefs, get_unique_id());
+    m_buttonprefs = new CButtonPrefs(&kmap, editorStack);
+    editorStack->addWidget(m_buttonprefs);
     connect( m_buttonprefs, SIGNAL( Closed() ), this, SLOT( infoClose() ) );
 
 
     m_annoWin = new CAnnoEdit(editorStack);
-    editorStack->addWidget(m_annoWin, get_unique_id());
+    editorStack->addWidget(m_annoWin);
     connect( m_annoWin, SIGNAL( finished(const QString&, const QString&) ), this, SLOT( addAnno(const QString&, const QString&) ) );
     connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) );
 
     m_infoWin = new infowin(editorStack);
-    editorStack->addWidget(m_infoWin, get_unique_id());
+    editorStack->addWidget(m_infoWin);
     connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) );
 
     m_graphicwin = new GraphicWin(editorStack);
-    editorStack->addWidget(m_graphicwin, get_unique_id());
+    editorStack->addWidget(m_graphicwin);
     connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) );
 
 //    bkmkselector = new QListBox(editorStack, "Bookmarks");
@@ -414,7 +404,7 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
     //    connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) );
     connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) );
     connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) );
-    editorStack->addWidget( bkmkselector, get_unique_id() );
+    editorStack->addWidget( bkmkselector);
 
 /*
     importSelector = new FileSelector( "*", editorStack, "importselector", false );
@@ -572,139 +562,139 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
     connect( reader, SIGNAL( HandleKeyRequest(QKeyEvent*) ), this, SLOT( handlekey(QKeyEvent*) ) );
     connect( reader, SIGNAL( SetScrollState(bool) ), this, SLOT( setScrollState(bool) ) );
     connect( reader, SIGNAL(RefreshBitmap()), this, SLOT(setBackgroundBitmap()));
-    editorStack->addWidget( reader, get_unique_id() );
+    editorStack->addWidget( reader );
 
-    m_preferences_action = new QAction( tr( "Configuration" ), geticon( "SettingsIcon" ), QString::null, 0, this, NULL);
+    m_preferences_action = new Q3Action( tr( "Configuration" ), geticon( "SettingsIcon" ), QString::null, 0, this, NULL);
     connect( m_preferences_action, SIGNAL( activated() ), this, SLOT( showprefs() ) );
     m_preferences_action->addTo( settings );
 
-    m_saveconfig_action = new QAction( tr( "Save Config" ), QString::null, 0, this, NULL);
+    m_saveconfig_action = new Q3Action( tr( "Save Config" ), QString::null, 0, this, NULL);
     connect( m_saveconfig_action, SIGNAL( activated() ), this, SLOT( SaveConfig() ) );
     m_saveconfig_action->addTo( settings );
 
-    m_loadconfig_action = new QAction( tr( "Load Config" ), QString::null, 0, this, NULL);
+    m_loadconfig_action = new Q3Action( tr( "Load Config" ), QString::null, 0, this, NULL);
     connect( m_loadconfig_action, SIGNAL( activated() ), this, SLOT( LoadConfig() ) );
     m_loadconfig_action->addTo( settings );
 
-    m_tidyconfig_action = new QAction( tr( "Delete Config" ), QString::null, 0, this, NULL);
+    m_tidyconfig_action = new Q3Action( tr( "Delete Config" ), QString::null, 0, this, NULL);
     connect( m_tidyconfig_action, SIGNAL( activated() ), this, SLOT( TidyConfig() ) );
     m_tidyconfig_action->addTo( settings );
 
     settings->insertSeparator();
-    m_toolbarprefs_action = new QAction( tr( "Toolbars" ), QString::null, 0, this, NULL);
+    m_toolbarprefs_action = new Q3Action( tr( "Toolbars" ), QString::null, 0, this, NULL);
     connect( m_toolbarprefs_action, SIGNAL( activated() ), this, SLOT( showtoolbarprefs() ) );
     m_toolbarprefs_action->addTo( settings );
 
-    m_buttonprefs_action = new QAction( tr( "Buttons" ), QString::null, 0, this, NULL);
+    m_buttonprefs_action = new Q3Action( tr( "Buttons" ), QString::null, 0, this, NULL);
     connect( m_buttonprefs_action, SIGNAL( activated() ), this, SLOT( showbuttonprefs() ) );
     m_buttonprefs_action->addTo( settings );
 
-    m_loadtheme_action = new QAction( tr( "Load Theme" ), QString::null, 0, this, NULL);
+    m_loadtheme_action = new Q3Action( tr( "Load Theme" ), QString::null, 0, this, NULL);
     connect( m_loadtheme_action, SIGNAL( activated() ), this, SLOT( LoadTheme() ) );
     m_loadtheme_action->addTo( settings );
 
-    m_repara_action = new QAction( tr( "EOP Marker" ),  QString::null, 0, this, NULL);
+    m_repara_action = new Q3Action( tr( "EOP Marker" ),  QString::null, 0, this, NULL);
     connect( m_repara_action, SIGNAL( activated() ), this, SLOT( reparastring() ) );
     m_repara_action->addTo(settings);
 
 #ifdef USEQPE
-    m_grab_action = new QAction( tr( "Grab Buttons" ), QString::null, 0, this, NULL, true );
+    m_grab_action = new Q3Action( tr( "Grab Buttons" ), QString::null, 0, this, NULL, true );
     connect( m_grab_action, SIGNAL( toggled(bool) ), this, SLOT( setgrab(bool) ) );
     m_grab_action->setOn(m_grabkeyboard);
     m_grab_action->addTo( settings );
 #endif
 
-    m_open_action = new QAction( tr( "Open" ), geticon( "fileopen" ), QString::null, 0, this, 0 );
+    m_open_action = new Q3Action( tr( "Open" ), geticon( "fileopen" ), QString::null, 0, this, 0 );
     connect( m_open_action, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
     m_open_action->addTo( file );
 
-    m_close_action = new QAction( tr( "Close" ), geticon( "close" ), QString::null, 0, this, 0 );
+    m_close_action = new Q3Action( tr( "Close" ), geticon( "close" ), QString::null, 0, this, 0 );
     connect( m_close_action, SIGNAL( activated() ), this, SLOT( fileClose() ) );
     m_close_action->addTo( file );
 
 #ifdef _SCRIPT
-    a = new QAction( tr( "Run Script" ), QString::null, 0, this, NULL);
+    a = new Q3Action( tr( "Run Script" ), QString::null, 0, this, NULL);
     connect( a, SIGNAL( activated() ), this, SLOT( RunScript() ) );
     a->addTo( file );
 #endif
     /*
-    a = new QAction( tr( "Revert" ), geticon( "close" ), QString::null, 0, this, 0 );
+    a = new Q3Action( tr( "Revert" ), geticon( "close" ), QString::null, 0, this, 0 );
     connect( a, SIGNAL( activated() ), this, SLOT( fileRevert() ) );
     a->addTo( file );
 
-    a = new QAction( tr( "Cut" ), geticon( "cut" ), QString::null, 0, this, 0 );
+    a = new Q3Action( tr( "Cut" ), geticon( "cut" ), QString::null, 0, this, 0 );
     connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
     a->addTo( filebar() );
     a->addTo( edit );
     */
 
-    m_info_action = new QAction( tr( "Info" ), geticon( "UtilsIcon" ), QString::null, 0, this, NULL);
+    m_info_action = new Q3Action( tr( "Info" ), geticon( "UtilsIcon" ), QString::null, 0, this, NULL);
     connect( m_info_action, SIGNAL( activated() ), this, SLOT( showinfo() ) );
     m_info_action->addTo( file );
 
-    m_touch_action = new QAction( tr( "Two/One Touch" ), geticon( "1to1" ), QString::null, 0, this, NULL, true );
+    m_touch_action = new Q3Action( tr( "Two/One Touch" ), geticon( "1to1" ), QString::null, 0, this, NULL, true );
     connect( m_touch_action, SIGNAL( toggled(bool) ), this, SLOT( setTwoTouch(bool) ) );
     m_touch_action->setOn(m_twoTouch);
     m_touch_action->addTo( file );
 
-    m_find_action = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, NULL);
+    m_find_action = new Q3Action( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, NULL);
      connect( m_find_action, SIGNAL( activated() ), this, SLOT( editFind() ) );
      file->insertSeparator();
 //     a->addTo( bar );
      m_find_action->addTo( file );
 
-    m_exportlinks_action = new QAction( tr( "Export Links" ), QString::null, 0, this, NULL);
+    m_exportlinks_action = new Q3Action( tr( "Export Links" ), QString::null, 0, this, NULL);
     connect( m_exportlinks_action, SIGNAL( activated() ), this, SLOT( ExportLinks() ) );
     m_exportlinks_action->addTo( file );
 
-    m_scrollButton = new QAction( tr( "Scroll" ), getmyicon( "panel-arrow-down" ), QString::null, 0, this, 0, true );
+    m_scrollButton = new Q3Action( tr( "Scroll" ), getmyicon( "panel-arrow-down" ), QString::null, 0, this, 0, true );
     connect( m_scrollButton, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) );
     m_scrollButton->addTo(navigation);
     m_scrollButton->setOn(false);
 
-    m_start_action = new QAction( tr( "Goto Start" ), geticon( "start" ), QString::null, 0, this, NULL);
+    m_start_action = new Q3Action( tr( "Goto Start" ), geticon( "start" ), QString::null, 0, this, NULL);
     connect( m_start_action, SIGNAL( activated() ), this, SLOT( gotoStart() ) );
     m_start_action->addTo(navigation);
 
-    m_end_action = new QAction( tr( "Goto End" ), geticon( "finish" ), QString::null, 0, this, NULL);
+    m_end_action = new Q3Action( tr( "Goto End" ), geticon( "finish" ), QString::null, 0, this, NULL);
     connect( m_end_action, SIGNAL( activated() ), this, SLOT( gotoEnd() ) );
     m_end_action->addTo(navigation);
 
-    m_jump_action = new QAction( tr( "Jump" ), geticon( "rotate" ), QString::null, 0, this, NULL);
+    m_jump_action = new Q3Action( tr( "Jump" ), geticon( "rotate" ), QString::null, 0, this, NULL);
     connect( m_jump_action, SIGNAL( activated() ), this, SLOT( jump() ) );
     m_jump_action->addTo(navigation);
 
-    m_pageline_action = new QAction( tr( "Page/Line Scroll" ), geticon( "pass" ), QString::null, 0, this, NULL, true );
+    m_pageline_action = new Q3Action( tr( "Page/Line Scroll" ), geticon( "pass" ), QString::null, 0, this, NULL, true );
     connect( m_pageline_action, SIGNAL( toggled(bool) ), this, SLOT( pagemode(bool) ) );
     m_pageline_action->addTo(navigation);
     m_pageline_action->setOn(reader->m_bpagemode);
 
-    m_pageup_action = new QAction( tr( "Up" ), geticon( "up" ), QString::null, 0, this, 0 );
+    m_pageup_action = new Q3Action( tr( "Up" ), geticon( "up" ), QString::null, 0, this, 0 );
     connect( m_pageup_action, SIGNAL( activated() ), this, SLOT( pageup() ) );
     m_pageup_action->addTo( navigation );
     
-    m_pagedn_action = new QAction( tr( "Down" ), geticon( "down" ), QString::null, 0, this, 0 );
+    m_pagedn_action = new Q3Action( tr( "Down" ), geticon( "down" ), QString::null, 0, this, 0 );
     connect( m_pagedn_action, SIGNAL( activated() ), this, SLOT( pagedn() ) );
     m_pagedn_action->addTo( navigation );
 
-    m_back_action = new QAction( tr( "Back" ), geticon( "back" ), QString::null, 0, this, 0 );
+    m_back_action = new Q3Action( tr( "Back" ), geticon( "back" ), QString::null, 0, this, 0 );
     connect( m_back_action, SIGNAL( activated() ), reader, SLOT( goBack() ) );
     m_back_action->addTo( navigation );
 
-    m_home_action = new QAction( tr( "Home" ), geticon( "home" ), QString::null, 0, this, 0 );
+    m_home_action = new Q3Action( tr( "Home" ), geticon( "home" ), QString::null, 0, this, 0 );
     connect( m_home_action, SIGNAL( activated() ), reader, SLOT( goHome() ) );
     m_home_action->addTo( navigation );
 
-    m_forward_action = new QAction( tr( "Forward" ), geticon( "forward" ), QString::null, 0, this, 0 );
+    m_forward_action = new Q3Action( tr( "Forward" ), geticon( "forward" ), QString::null, 0, this, 0 );
     connect( m_forward_action, SIGNAL( activated() ), reader, SLOT( goForward() ) );
     m_forward_action->addTo( navigation );
 
     /*
-    a = new QAction( tr( "Find" ), QString::null, 0, this, NULL, true );
+    a = new Q3Action( tr( "Find" ), QString::null, 0, this, NULL, true );
     //    connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) );
     a->addTo( file );
 
-    a = new QAction( tr( "Find Again" ), QString::null, 0, this, NULL, true );
+    a = new Q3Action( tr( "Find Again" ), QString::null, 0, this, NULL, true );
     //    connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) );
     a->addTo( file );
     */
@@ -715,13 +705,13 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
 
     QActionGroup* ag = new QActionGroup(this);
     ag->setExclusive(false);
-    spacemenu = new QPopupMenu(this);
+    spacemenu = new Q3PopupMenu(this);
     file->insertItem( tr( "Scrolling" ), spacemenu );
 
-    a = new QAction( tr( "Set Target" ), QString::null, 0, ag, NULL);
+    a = new Q3Action( tr( "Set Target" ), QString::null, 0, ag, NULL);
     connect( a, SIGNAL( activated() ), this, SLOT( setpipetarget() ) );
 
-    a = new QAction( tr( "Pause Paras" ), QString::null, 0, ag, NULL, true );
+    a = new Q3Action( tr( "Pause Paras" ), QString::null, 0, ag, NULL, true );
     connect( a, SIGNAL( toggled(bool) ), this, SLOT( setpause(bool) ) );
     a->setOn(reader->m_pauseAfterEachPara);
 
@@ -731,64 +721,64 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
 #endif
 
 /*
-    a = new QAction( tr( "Import" ), QString::null, 0, this, NULL );
+    a = new Q3Action( tr( "Import" ), QString::null, 0, this, NULL );
     connect( a, SIGNAL( activated() ), this, SLOT( importFiles() ) );
     a->addTo( file );
 */
 
     /*
-    a = new QAction( tr( "Paste" ), geticon( "paste" ), QString::null, 0, this, 0 );
+    a = new Q3Action( tr( "Paste" ), geticon( "paste" ), QString::null, 0, this, 0 );
     connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
     a->addTo( fileBar );
     a->addTo( edit );
     */
 
-//     a = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, 0 );
+//     a = new Q3Action( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, 0 );
 
      m_fullscreen = false;
-    m_actFullscreen = new QAction( tr( "Fullscreen" ), geticon( "fullscreen" ), QString::null, 0, this, NULL, true );
+    m_actFullscreen = new Q3Action( tr( "Fullscreen" ), geticon( "fullscreen" ), QString::null, 0, this, NULL, true );
     connect( m_actFullscreen, SIGNAL( toggled(bool) ), this, SLOT( setfullscreen(bool) ) );
     m_actFullscreen->setOn(m_fullscreen);
     m_actFullscreen->addTo( view );
 
-    m_rotate_action = new QAction( tr( "Rotate" ), geticon( "repeat" ), QString::null, 0, this, NULL, true );
+    m_rotate_action = new Q3Action( tr( "Rotate" ), geticon( "repeat" ), QString::null, 0, this, NULL, true );
     connect( m_rotate_action, SIGNAL( toggled(bool) ), this, SLOT( setrotated(bool) ) );
     m_rotate_action->setOn(reader->m_rotated);
     m_rotate_action->addTo( view );
 
-    m_inverse_action = new QAction( tr( "Invert" ), getmyicon( "invert" ), QString::null, 0, this, NULL, true );
+    m_inverse_action = new Q3Action( tr( "Invert" ), getmyicon( "invert" ), QString::null, 0, this, NULL, true );
     connect( m_inverse_action, SIGNAL( toggled(bool) ), this, SLOT( setinverted(bool) ) );
     m_inverse_action->setOn(reader->bInverse);
     m_inverse_action->addTo( view );
 
     view->insertSeparator();
 
-    m_zoomin_action = new QAction( tr( "Zoom In" ), geticon( "zoom" ), QString::null, 0, this);
+    m_zoomin_action = new Q3Action( tr( "Zoom In" ), geticon( "zoom" ), QString::null, 0, this);
     connect( m_zoomin_action, SIGNAL( activated() ), this, SLOT( zoomin() ) );
     m_zoomin_action->addTo( view );
 
-    m_zoomout_action = new QAction( tr( "Zoom Out" ), geticon( "mag" ), QString::null, 0, this);
+    m_zoomout_action = new Q3Action( tr( "Zoom Out" ), geticon( "mag" ), QString::null, 0, this);
     connect( m_zoomout_action, SIGNAL( activated() ), this, SLOT( zoomout() ) );
     m_zoomout_action->addTo( view );
 
     view->insertSeparator();
-    m_setfont_action = new QAction( tr( "Set Font" ), getmyicon( "font" ), QString::null, 0, this);
+    m_setfont_action = new Q3Action( tr( "Set Font" ), getmyicon( "font" ), QString::null, 0, this);
     connect( m_setfont_action, SIGNAL( activated() ), this, SLOT( setfont() ) );
     m_setfont_action->addTo( view );
 
     view->insertSeparator();
-    m_setenc_action = new QAction( tr( "Set Encoding" ), getmyicon( "charset" ), QString::null, 0, this);
+    m_setenc_action = new Q3Action( tr( "Set Encoding" ), getmyicon( "charset" ), QString::null, 0, this);
     connect( m_setenc_action, SIGNAL( activated() ), this, SLOT( chooseencoding() ) );
     m_setenc_action->addTo( view );
 
-    m_setmono_action = new QAction( tr( "Ideogram" ), getmyicon( "ideogram" ), QString::null, 0, this, NULL, true);
+    m_setmono_action = new Q3Action( tr( "Ideogram" ), getmyicon( "ideogram" ), QString::null, 0, this, NULL, true);
     connect( m_setmono_action, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) );
     m_setmono_action->addTo( view );
     m_setmono_action->setOn(reader->m_bMonoSpaced);
 
 
-    //    a = new QAction( tr( "Zoom" ), QString::null, 0, this, NULL, true );
-    //    a = new QAction( tr( "Zoom" ), geticon( "mag" ), QString::null, 0, this, 0 );
+    //    a = new Q3Action( tr( "Zoom" ), QString::null, 0, this, NULL, true );
+    //    a = new Q3Action( tr( "Zoom" ), geticon( "mag" ), QString::null, 0, this, 0 );
 
 
 
@@ -796,57 +786,57 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
 //     view->insertSeparator();
 
 /*
-    a = new QAction( tr( "Ideogram/Word" ), QString::null, 0, this, NULL, true );
+    a = new Q3Action( tr( "Ideogram/Word" ), QString::null, 0, this, NULL, true );
     connect( a, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) );
     a->setOn(reader->m_bMonoSpaced);
     a->addTo( view );
 */
 /*
-    a = new QAction( tr( "Set Width" ), QString::null, 0, this, NULL);
+    a = new Q3Action( tr( "Set Width" ), QString::null, 0, this, NULL);
     connect( a, SIGNAL( activated() ), this, SLOT( setspacing() ) );
     a->addTo( view );
 */
 
-    m_mark_action = new QAction( tr( "Bookmark" ), getmyicon( "bookmark" ), QString::null, 0, this, NULL);
+    m_mark_action = new Q3Action( tr( "Bookmark" ), getmyicon( "bookmark" ), QString::null, 0, this, NULL);
     connect( m_mark_action, SIGNAL( activated() ), this, SLOT( addbkmk() ) );
     m_mark_action->addTo( marks );
 
-    m_annotate_action = new QAction( tr( "Annotate" ), getmyicon( "annotate" ), QString::null, 0, this, NULL);
+    m_annotate_action = new Q3Action( tr( "Annotate" ), getmyicon( "annotate" ), QString::null, 0, this, NULL);
     connect( m_annotate_action, SIGNAL( activated() ), this, SLOT( addanno() ) );
     m_annotate_action->addTo( marks );
 
-    m_goto_action = new QAction( tr( "Goto" ), getmyicon( "bookmark_goto" ), QString::null, 0, this, NULL, false );
+    m_goto_action = new Q3Action( tr( "Goto" ), getmyicon( "bookmark_goto" ), QString::null, 0, this, NULL, false );
     connect( m_goto_action, SIGNAL( activated() ), this, SLOT( do_gotomark() ) );
     m_goto_action->addTo( marks );
 
-    m_delete_action = new QAction( tr( "Delete" ), getmyicon( "bookmark_delete" ), QString::null, 0, this, NULL);
+    m_delete_action = new Q3Action( tr( "Delete" ), getmyicon( "bookmark_delete" ), QString::null, 0, this, NULL);
     connect( m_delete_action, SIGNAL( activated() ), this, SLOT( do_delmark() ) );
     m_delete_action->addTo( marks );
 
-    m_autogen_action = new QAction( tr( "Autogen" ), geticon( "exec" ), QString::null, 0, this, NULL, false );
+    m_autogen_action = new Q3Action( tr( "Autogen" ), geticon( "exec" ), QString::null, 0, this, NULL, false );
     connect( m_autogen_action, SIGNAL( activated() ), this, SLOT( do_autogen() ) );
      marks->insertSeparator();
     m_autogen_action->addTo( marks );
 
-    m_clear_action = new QAction( tr( "Clear" ), getmyicon( "bookmark_clear" ), QString::null, 0, this, NULL);
+    m_clear_action = new Q3Action( tr( "Clear" ), getmyicon( "bookmark_clear" ), QString::null, 0, this, NULL);
     connect( m_clear_action, SIGNAL( activated() ), this, SLOT( clearBkmkList() ) );
     m_clear_action->addTo( marks );
 
-    m_save_action = new QAction( tr( "Save" ), getmyicon( "bookmark_save" ), QString::null, 0, this, NULL );
+    m_save_action = new Q3Action( tr( "Save" ), getmyicon( "bookmark_save" ), QString::null, 0, this, NULL );
     connect( m_save_action, SIGNAL( activated() ), this, SLOT( savebkmks() ) );
     m_save_action->addTo( marks );
 
-    m_tidy_action = new QAction( tr( "Tidy" ), getmyicon( "bookmark_tidy" ), QString::null, 0, this, NULL);
+    m_tidy_action = new Q3Action( tr( "Tidy" ), getmyicon( "bookmark_tidy" ), QString::null, 0, this, NULL);
     connect( m_tidy_action, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) );
      marks->insertSeparator();
     m_tidy_action->addTo( marks );
 
-    m_startBlock_action = new QAction( tr( "Start Block" ), geticon( "new" ), QString::null, 0, this, NULL);
+    m_startBlock_action = new Q3Action( tr( "Start Block" ), geticon( "new" ), QString::null, 0, this, NULL);
     connect( m_startBlock_action, SIGNAL( activated() ), this, SLOT( editMark() ) );
     marks->insertSeparator();
     m_startBlock_action->addTo( marks );
 
-    m_endBlock_action = new QAction( tr( "Copy Block" ), geticon( "copy" ), QString::null, 0, this, NULL);
+    m_endBlock_action = new Q3Action( tr( "Copy Block" ), geticon( "copy" ), QString::null, 0, this, NULL);
     connect( m_endBlock_action, SIGNAL( activated() ), this, SLOT( editCopy() ) );
     m_endBlock_action->addTo( marks );
 
@@ -868,10 +858,10 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
       }
 
 
-    pbar = new QProgressBar(this);
+    pbar = new Q3ProgressBar(this);
     pbar->hide();
 
-    searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE );
+    searchBar = new QFloatBar( "Search", this, Qt::Top, TRUE );
 
     searchBar->setHorizontalStretchable( TRUE );
 
@@ -890,17 +880,17 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
     connect( searchEdit, SIGNAL( returnPressed( ) ),
 	     this, SLOT( search( ) ) );
 #endif
-     QAction*a = new QAction( tr( "Find Next" ), geticon( "next" ), QString::null, 0, this, 0 );
+     Q3Action*a = new Q3Action( tr( "Find Next" ), geticon( "next" ), QString::null, 0, this, 0 );
      connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) );
      a->addTo( searchBar );
 
-    a = new QAction( tr( "Close Find" ), geticon( "close" ), QString::null, 0, this, 0 );
+    a = new Q3Action( tr( "Close Find" ), geticon( "close" ), QString::null, 0, this, 0 );
     connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
     a->addTo( searchBar );
 
     searchBar->hide();
 
-    regBar = new QFloatBar( "Autogen", this, QMainWindow::Top, TRUE );
+    regBar = new QFloatBar( "Autogen", this, Qt::Top, TRUE );
     connect(regBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() ));
 
     regBar->setHorizontalStretchable( TRUE );
@@ -913,17 +903,17 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
     connect( regEdit, SIGNAL( returnPressed( ) ),
 	     this, SLOT( do_regaction() ) );
 
-    a = new QAction( tr( "Do Reg" ), geticon( "enter" ), QString::null, 0, this, 0 );
+    a = new Q3Action( tr( "Do Reg" ), geticon( "enter" ), QString::null, 0, this, 0 );
     connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) );
     a->addTo( regBar );
 
-    a = new QAction( tr( "Close Edit" ), geticon( "close" ), QString::null, 0, this, 0 );
+    a = new Q3Action( tr( "Close Edit" ), geticon( "close" ), QString::null, 0, this, 0 );
     connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) );
     a->addTo( regBar );
 
     regBar->hide();
 
-    m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE );
+    m_fontBar = new Q3ToolBar( "Autogen", this, Qt::Top, TRUE );
 
     m_fontBar->setHorizontalStretchable( TRUE );
 
@@ -940,9 +930,9 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
 	    {
 		realfont = true;
 	    }
-	    if ((*nm).contains(FIXEDFONT,false)) reader->m_fontControl.hasCourier(true, *nm);
 	}
 	if (!realfont) reader->m_fontname = flist[0];
+	reader->m_fontControl.setCourier(reader->m_fontname,flist);
     } // delete the FontDatabase!!!
     connect( m_fontSelector, SIGNAL( activated(const QString& ) ),
 	     this, SLOT( do_setfont(const QString&) ) );
@@ -965,7 +955,7 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
 
 	m_scrollbar->setVerticalStretchable( TRUE );
 	*/
-	scrollbar = m_scrollbar = new QScrollBar(QScrollBar::Vertical, widge);
+	scrollbar = m_scrollbar = new QScrollBar(Qt::Vertical, widge);
 	m_layout->addWidget(scrollbar);
 	scrollbar->setTracking(false);
 	//	connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) );
@@ -1226,7 +1216,7 @@ void QTReaderApp::addtoolbars(Config* config)
     {
 	if (m_bkmkAvail == NULL)
 	{
-	    m_bkmkAvail = new QAction( tr( "Annotation" ), geticon( "find" ), QString::null, 0, this, 0 );
+	    m_bkmkAvail = new Q3Action( tr( "Annotation" ), geticon( "find" ), QString::null, 0, this, 0 );
 	    connect( m_bkmkAvail, SIGNAL( activated() ), this, SLOT( showAnnotation() ) );
 	
 	    m_bkmkAvail->setEnabled(false);
@@ -1253,7 +1243,7 @@ bool QTReaderApp::checkbar(Config* _config, const QString& key)
 }
 
 
-QToolBar* QTReaderApp::filebar()
+Q3ToolBar* QTReaderApp::filebar()
 {
     if (fileBar == NULL)
     {
@@ -1270,21 +1260,21 @@ QToolBar* QTReaderApp::filebar()
 	    case cesMenuTool:
 	    case cesMultiple:
 //		qDebug("Creating new file bar");
-		fileBar = new QToolBar("File", this, m_tbposition);
+		fileBar = new Q3ToolBar("File", this, m_tbposition);
 		break;
 	}
 //	fileBar->setHorizontalStretchable( true );
     }
     return fileBar;
 }
-QToolBar* QTReaderApp::viewbar()
+Q3ToolBar* QTReaderApp::viewbar()
 {
     if (viewBar == NULL)
     {
 	switch (m_tbpol)
 	{
 	    case cesMultiple:
-		viewBar = new QToolBar("View", this, m_tbposition);
+		viewBar = new Q3ToolBar("View", this, m_tbposition);
 		break;
 	    default:
 		qDebug("Incorrect toolbar policy set");
@@ -1298,7 +1288,7 @@ QToolBar* QTReaderApp::viewbar()
     }
     return viewBar;
 }
-QToolBar* QTReaderApp::navbar()
+Q3ToolBar* QTReaderApp::navbar()
 {
     if (navBar == NULL)
     {
@@ -1306,7 +1296,7 @@ QToolBar* QTReaderApp::navbar()
 	{
 	    case cesMultiple:
 //		qDebug("Creating new nav bar");
-		navBar = new QToolBar("Navigation", this, m_tbposition);
+		navBar = new Q3ToolBar("Navigation", this, m_tbposition);
 		break;
 	    default:
 		qDebug("Incorrect toolbar policy set");
@@ -1321,14 +1311,14 @@ QToolBar* QTReaderApp::navbar()
     }
     return navBar;
 }
-QToolBar* QTReaderApp::markbar()
+Q3ToolBar* QTReaderApp::markbar()
 {
     if (markBar == NULL)
     {
 	switch (m_tbpol)
 	{
 	    case cesMultiple:
-		markBar = new QToolBar("Marks", this, m_tbposition);
+		markBar = new Q3ToolBar("Marks", this, m_tbposition);
 		break;
 	    default:
 		qDebug("Incorrect toolbar policy set");
@@ -1343,26 +1333,26 @@ QToolBar* QTReaderApp::markbar()
     return markBar;
 }
 
-void QTReaderApp::addfilebar(Config* _config, const QString& key, QAction* a)
+void QTReaderApp::addfilebar(Config* _config, const QString& key, Q3Action* a)
 {
     if (_config->readBoolEntry(key, false)) a->addTo( filebar() );
 }
-void QTReaderApp::addnavbar(Config* _config, const QString& key, QAction* a)
+void QTReaderApp::addnavbar(Config* _config, const QString& key, Q3Action* a)
 {
     if (_config->readBoolEntry(key, false)) a->addTo( navbar() );
 }
-void QTReaderApp::addmarkbar(Config* _config, const QString& key, QAction* a)
+void QTReaderApp::addmarkbar(Config* _config, const QString& key, Q3Action* a)
 {
     if (_config->readBoolEntry(key, false)) a->addTo( markbar() );
 }
-void QTReaderApp::addviewbar(Config* _config, const QString& key, QAction* a)
+void QTReaderApp::addviewbar(Config* _config, const QString& key, Q3Action* a)
 {
     if (_config->readBoolEntry(key, false)) a->addTo( viewbar() );
 }
 
 void QTReaderApp::suspend() { reader->suspend(); }
 
-void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data)
+void QTReaderApp::msgHandler(const Q3CString& _msg, const QByteArray& _data)
 {
 #ifndef USEMSGS
   return;
@@ -1787,7 +1777,7 @@ void QTReaderApp::setfullscreen(bool sfs)
     reader->update();
 }
 /*
-void QTReaderApp::buttonActionSelected(QAction* _a)
+void QTReaderApp::buttonActionSelected(Q3Action* _a)
 {
 ////    qDebug("es:%x : %s (%u)", _a, (const char *)(_a->text()), ActNameToInt(_a->text()));
     m_spaceTarget = ActNameToInt(_a->text());
@@ -2007,14 +1997,14 @@ QString QTReaderApp::usefilebrowser()
 void QTReaderApp::showgraphic(QImage& pm)
 {
     m_graphicwin->setImage(pm);
-    editorStack->raiseWidget( m_graphicwin );
+    editorStack->setCurrentWidget(  m_graphicwin );
     hidetoolbars();
     m_graphicwin->setFocus();
 }
 
 void QTReaderApp::showbuttonprefs()
 {
-    editorStack->raiseWidget( m_buttonprefs );
+    editorStack->setCurrentWidget( m_buttonprefs );
     hidetoolbars();
     m_buttonprefs->setFocus();
     m_kmapchanged = true;
@@ -2366,7 +2356,7 @@ void QTReaderApp::showinfo()
 	  }
 	m_infoWin->setZoom(reader->m_fontControl.currentsize()*10);
 	m_infoWin->setAbout(QString("\nApplication (c) Tim Wentford\n")+reader->about());
-	editorStack->raiseWidget( m_infoWin );
+	editorStack->setCurrentWidget( m_infoWin );
 	hidetoolbars();
 	m_infoWin->setFocus();
     }
@@ -2482,7 +2472,7 @@ void QTReaderApp::addanno()
 	m_annoWin->setAnno("");
 	m_annoWin->setPosn(reader->pagelocate());
 	m_annoIsEditing = true;
-	editorStack->raiseWidget( m_annoWin );
+	editorStack->setCurrentWidget( m_annoWin );
 	hidetoolbars();
 #ifdef USEQPE
 	Global::showInputMethod();
@@ -2658,7 +2648,7 @@ void QTReaderApp::findNext()
 #ifdef __ISEARCH
   QString arg = searchEdit->text();
 #else
-  QRegExp arg = searchEdit->text();
+  QRegExp arg(searchEdit->text());
 #endif
   CDrawBuffer test(&(reader->m_fontControl));
   size_t start = reader->pagelocate();
@@ -2722,7 +2712,7 @@ bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg)
       while (strstr(test.data(),(const tchar*)arg) == NULL)
 #else
 #ifdef _UNICODE
-      while ((offset = arg.match(toQString(test.data()))) == -1)
+      while ((offset = arg.exactMatch(toQString(test.data()))) == -1)
 #else
       while (arg.match(test.data()) == -1)
 #endif
@@ -2962,7 +2952,7 @@ void QTReaderApp::handlekey(QKeyEvent* e)
 #if defined(USEQPE) && defined(USENEWFULLSCREEN)
 void QTReaderApp::focusInEvent(QFocusEvent *)
 {
-  if (m_usenewfullscreen && m_fullscreen && (editorStack->visibleWidget() == reader))
+  if (m_usenewfullscreen && m_fullscreen && (editorStack->currentWidget() == reader))
     {
       m_usenewfullscreen = false;
       reader->bDoUpdates = false;
@@ -2975,7 +2965,7 @@ void QTReaderApp::focusInEvent(QFocusEvent *)
 
 void QTReaderApp::resizeEvent(QResizeEvent *)
 {
-  if (m_usenewfullscreen && m_fullscreen && (editorStack->visibleWidget() == reader))
+  if (m_usenewfullscreen && m_fullscreen && (editorStack->currentWidget() == reader))
     {
       m_usenewfullscreen = false;
       reader->bDoUpdates = false;
@@ -3078,7 +3068,7 @@ void QTReaderApp::showEditTools()
     //    qDebug("uc");
     updateCaption();
     //    qDebug("rw");
-    editorStack->raiseWidget( reader );
+    editorStack->setCurrentWidget( reader );
     //    qDebug("sf");
     reader->setFocus();
     //    qDebug("ref");
@@ -3156,7 +3146,7 @@ void QTReaderApp::closeEvent( QCloseEvent *e )
 	showEditTools();
 	e->ignore();
     }
-    else if (editorStack->visibleWidget() == m_buttonprefs)
+    else if (editorStack->currentWidget() == m_buttonprefs)
       {
 	int ret = QMessageBox::warning(this, PROGNAME,
 tr("Do you wish to map this key?\n\nIf you proceed you will map\nthe escape key and you will\nneed to press the close box\ntwice to exit this program\n\nContinue?"), tr("Yes"), tr("No"), QString::null, 0, 1);
@@ -3172,7 +3162,7 @@ tr("Do you wish to map this key?\n\nIf you proceed you will map\nthe escape key
     }
     else
     {
-	if (editorStack->visibleWidget() == reader)
+	if (editorStack->currentWidget() == reader)
 	{
 	    if ((kmap.find(orKey(Qt::NoButton,Key_Escape,false)) != kmap.end()) && m_bcloseDisabled)
 	    {
@@ -3277,7 +3267,7 @@ bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab, bool presel)
     if (cnt > 0)
       {
 	  hidetoolbars();
-        editorStack->raiseWidget( bkmkselector );
+        editorStack->setCurrentWidget( bkmkselector );
 	if (slt != -1) bkmkselector->setCurrentItem(slt);
 	return true;
       }
@@ -3799,7 +3789,7 @@ void QTReaderApp::do_autogen(const QString& regText)
       }
       i = reader->buffdoc.getpara(buff);
 #ifdef _UNICODE
-      if (re.match(toQString(buff.data())) != -1)
+      if (re.exactMatch(toQString(buff.data())) != -1)
 #else
       if (re.match(buff.data()) != -1)
 #endif
@@ -4113,7 +4103,7 @@ void QTReaderApp::showAnnotation()
 #ifdef USEQPE
     Global::showInputMethod();
 #endif
-    editorStack->raiseWidget( m_annoWin );
+    editorStack->setCurrentWidget( m_annoWin );
     hidetoolbars();
     m_annoWin->setFocus();
 }
@@ -4152,7 +4142,7 @@ void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, size_t posn2,
 #ifdef USEQPE
 	Global::showInputMethod();
 #endif
-	editorStack->raiseWidget( m_annoWin );
+	editorStack->setCurrentWidget( m_annoWin );
 	hidetoolbars();
     }
 #ifdef USEQPE
@@ -4738,17 +4728,9 @@ bool QTReaderApp::PopulateConfig(const char* tgtdir, bool usedirs)
     d.setFilter( ((usedirs) ? QDir::Dirs : QDir::Files) | QDir::NoSymLinks );
 //        d.setSorting( QDir::Size | QDir::Reversed );
 
-    const QFileInfoList *list = d.entryInfoList();
-    QFileInfoListIterator it( *list );      // create list iterator
-    QFileInfo *fi;                          // pointer for traversing
-
-    while ( (fi=it.current()) ) {           // for each file...
-  
-	bkmkselector->insertItem(fi->fileName(), cnt++);
-			
-	//qDebug( "%10li %s", fi->size(), fi->fileName().data() );
-	++it;                               // goto next list element
-    }
+    QFileInfoList list = d.entryInfoList();
+    for(QFileInfoListIterator it=list.begin();it!=list.end();++it)
+	bkmkselector->insertItem(it->fileName(), cnt++);
  
 #else /* USEQPE */
     int cnt = 0;
@@ -4782,7 +4764,7 @@ void QTReaderApp::LoadTheme()
 {
     if (PopulateConfig("Themes", true))
       {
-        editorStack->raiseWidget( bkmkselector );
+        editorStack->setCurrentWidget( bkmkselector );
         hidetoolbars();
 	m_nBkmkAction = cLdTheme;
       }
@@ -4794,7 +4776,7 @@ void QTReaderApp::LoadConfig()
 {
     if (PopulateConfig("configs"))
       {
-        editorStack->raiseWidget( bkmkselector );
+        editorStack->setCurrentWidget( bkmkselector );
         hidetoolbars();
 	m_nBkmkAction = cLdConfig;
       }
@@ -4806,7 +4788,7 @@ void QTReaderApp::TidyConfig()
 {
     if (PopulateConfig("configs"))
       {
-        editorStack->raiseWidget( bkmkselector );
+        editorStack->setCurrentWidget( bkmkselector );
         hidetoolbars();
 	m_nBkmkAction = cRmConfig;
       }
@@ -4818,7 +4800,7 @@ void QTReaderApp::ExportLinks()
 {
     if (PopulateConfig("urls"))
       {
-        editorStack->raiseWidget( bkmkselector );
+        editorStack->setCurrentWidget( bkmkselector );
         hidetoolbars();
 	m_nBkmkAction = cExportLinks;
       }
diff --git a/QTReaderApp.h b/QTReaderApp.h
index ab1b7ad..502079f 100644
--- a/QTReaderApp.h
+++ b/QTReaderApp.h
@@ -35,7 +35,15 @@
 #include <qmap.h>
 #include <qlineedit.h>
 #include <qstack.h>
-#include <qlistbox.h>
+#include <Qt3Support/Q3ListBox>
+#include <Qt3Support/Q3CString>
+#include <Qt3Support/Q3ProgressBar>
+#include <Qt3Support/Q3MainWindow>
+#include <Qt3Support/Q3Action>
+#include <QStackedWidget>
+#include <qcombobox.h>
+#include <qnamespace.h>
+using namespace Qt;
 #ifdef USEQPE
 #include <qpe/qpeapplication.h>
 #endif
@@ -126,7 +134,7 @@ struct searchrecord
 class infowin;
 class GraphicWin;
 
-class QTReaderApp : public QMainWindow
+class QTReaderApp : public Q3MainWindow
 {
     Q_OBJECT
 
@@ -180,7 +188,7 @@ class QTReaderApp : public QMainWindow
 
  protected:
     void setfontHelper(const QString& lcn, int size = 0);
-    QAction* m_bkmkAvail, *m_actFullscreen;
+    Q3Action* m_bkmkAvail, *m_actFullscreen;
     CAnnoEdit* m_annoWin;
     Bkmk* m_anno;
     int m_scrollcolor, m_scrollbarcolor, m_background, m_foreground;
@@ -262,8 +270,8 @@ private slots:
     void showAnnotation();
     void do_setencoding(int i);
 	void do_setfont(const QString&);
-	//	void buttonActionSelected(QAction*);
-	void msgHandler(const QCString&, const QByteArray&);
+	//	void buttonActionSelected(Q3Action*);
+	void msgHandler(const Q3CString&, const QByteArray&);
 	void monospace(bool);
 	void jump();
 	void reparastring();
@@ -346,35 +354,35 @@ private slots:
     void setscrollcolour();
     void setscrollbarcolour();
     void writeUrl(const QString& file, const QString& href);
-    QAction *m_preferences_action, *m_open_action, *m_close_action;
-    QAction *m_info_action, *m_touch_action, *m_find_action, *m_start_action;
-    QAction *m_end_action, *m_jump_action, *m_pageline_action;
-    QAction *m_pageup_action, *m_pagedn_action, *m_back_action;
-    QAction *m_home_action, *m_forward_action, *m_zoomin_action;
-    QAction *m_zoomout_action, *m_setfont_action, *m_mark_action;
-    QAction *m_annotate_action, *m_goto_action, *m_delete_action;
-    QAction *m_autogen_action, *m_clear_action, *m_save_action;
-    QAction *m_tidy_action, *m_startBlock_action, *m_endBlock_action;
-    QAction *m_setenc_action, *m_setmono_action, *m_saveconfig_action;
-    QAction *m_loadconfig_action, *m_loadtheme_action, *m_toolbarprefs_action, *m_tidyconfig_action;
-    QAction *m_exportlinks_action, *m_rotate_action, *m_buttonprefs_action, *m_inverse_action;
-    QAction *m_repara_action;
+    Q3Action *m_preferences_action, *m_open_action, *m_close_action;
+    Q3Action *m_info_action, *m_touch_action, *m_find_action, *m_start_action;
+    Q3Action *m_end_action, *m_jump_action, *m_pageline_action;
+    Q3Action *m_pageup_action, *m_pagedn_action, *m_back_action;
+    Q3Action *m_home_action, *m_forward_action, *m_zoomin_action;
+    Q3Action *m_zoomout_action, *m_setfont_action, *m_mark_action;
+    Q3Action *m_annotate_action, *m_goto_action, *m_delete_action;
+    Q3Action *m_autogen_action, *m_clear_action, *m_save_action;
+    Q3Action *m_tidy_action, *m_startBlock_action, *m_endBlock_action;
+    Q3Action *m_setenc_action, *m_setmono_action, *m_saveconfig_action;
+    Q3Action *m_loadconfig_action, *m_loadtheme_action, *m_toolbarprefs_action, *m_tidyconfig_action;
+    Q3Action *m_exportlinks_action, *m_rotate_action, *m_buttonprefs_action, *m_inverse_action;
+    Q3Action *m_repara_action;
 #ifdef USEQPE
-    QAction *m_grab_action;
+    Q3Action *m_grab_action;
 #endif
     void addtoolbars(Config* config);
     ToolbarPolicy m_tbpol, m_tbpolsave;
     ToolBarDock m_tbposition;
     bool m_tbmove, m_tbmovesave;
-    QToolBar* filebar();
-    QToolBar* viewbar();
-    QToolBar* navbar();
-    QToolBar* markbar();
+    Q3ToolBar* filebar();
+    Q3ToolBar* viewbar();
+    Q3ToolBar* navbar();
+    Q3ToolBar* markbar();
     void hidetoolbars();
-    void addfilebar(Config* _config, const QString& key, QAction* a);
-    void addviewbar(Config* _config, const QString& key, QAction* a);
-    void addnavbar(Config* _config, const QString& key, QAction* a);
-    void addmarkbar(Config* _config, const QString& key, QAction* a);
+    void addfilebar(Config* _config, const QString& key, Q3Action* a);
+    void addviewbar(Config* _config, const QString& key, Q3Action* a);
+    void addnavbar(Config* _config, const QString& key, Q3Action* a);
+    void addmarkbar(Config* _config, const QString& key, Q3Action* a);
     bool checkbar(Config* _config, const QString& key);
 #ifdef _SCRIPT
     void SaveScript(const char* sname);
@@ -401,9 +409,9 @@ private slots:
 
  private:
 
-    QAction* m_scrollButton;
+    Q3Action* m_scrollButton;
 
-    QAction* m_buttonAction[MAX_ACTIONS];
+    Q3Action* m_buttonAction[MAX_ACTIONS];
 
     CBkmkSelector* bkmkselector;
 
@@ -418,27 +426,25 @@ private slots:
 #else
     bool dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg);
 #endif
-    QWidgetStack *editorStack;
+    QStackedWidget *editorStack;
     QTReader* reader;
     QComboBox* m_fontSelector;
 //    QPEToolBar /* *menu,*/ *fileBar;
 #if defined(USEQPE)
-    QToolBar *menubar;
+    Q3ToolBar *menubar;
 #endif
-    QToolBar *fileBar, *navBar, *viewBar, *markBar;
+    Q3ToolBar *fileBar, *navBar, *viewBar, *markBar;
 #if defined(USEQPE)
     QPEMenuBar *mb;
 #else
     QMenuBar *mb;
 #endif
     QFloatBar *searchBar, *regBar/*, *m_fontBar*/;
-    QToolBar /* *searchBar, *regBar,*/ *m_fontBar;
+    Q3ToolBar /* *searchBar, *regBar,*/ *m_fontBar;
     QLineEdit *searchEdit, *regEdit;
     bool searchVisible;
     bool regVisible;
     bool m_fontVisible, m_twoTouch;
-    static unsigned long m_uid;
-    long unsigned get_unique_id() { return m_uid++; }
     /*
       void resizeEvent( QResizeEvent * r)
       {
@@ -451,7 +457,7 @@ private slots:
     CList<Bkmk>* pOpenlist;
     infowin*  m_infoWin;
     GraphicWin* m_graphicwin;
-    QProgressBar* pbar;
+    Q3ProgressBar* pbar;
     bool m_fBkmksChanged;
 //    int m_nRegAction;
     regedit_type m_nRegAction;
diff --git a/QtrListView.cpp b/QtrListView.cpp
index 67040f8..e73a395 100644
--- a/QtrListView.cpp
+++ b/QtrListView.cpp
@@ -1,4 +1,7 @@
 #include "QtrListView.h"
+#include <QtGui/QKeyEvent>
+#include <qnamespace.h>
+using namespace Qt;
 
 void QtrListView::keyPressEvent(QKeyEvent* e)
 {
@@ -19,6 +22,6 @@ void QtrListView::keyPressEvent(QKeyEvent* e)
 	    emit OnCancelButton();
 	    break;
 	default:
-	    QListView::keyPressEvent(e);
+	    Q3ListView::keyPressEvent(e);
     }
 }
diff --git a/QtrListView.h b/QtrListView.h
index c1b7f4d..02a74cc 100644
--- a/QtrListView.h
+++ b/QtrListView.h
@@ -2,18 +2,19 @@
 #define __QTRLISTVIEW_H
 
 #include <qlistview.h>
+#include <Qt3Support/Q3ListViewItem>
 
-class QtrListView : public QListView
+class QtrListView : public Q3ListView
 {
     Q_OBJECT
 
     virtual void keyPressEvent(QKeyEvent* e);
  public:
-    QtrListView(QWidget* parent, char* name) : QListView(parent, name) {};
+    QtrListView(QWidget* parent, char* name) : Q3ListView(parent, name) {};
 
  signals:
-    void OnOKButton(QListViewItem*);
-    void OnCentreButton(QListViewItem*);
+    void OnOKButton(Q3ListViewItem*);
+    void OnCentreButton(Q3ListViewItem*);
     void OnCancelButton();
 };
 
diff --git a/Reb.cpp b/Reb.cpp
index 65de9f6..9e6e552 100644
--- a/Reb.cpp
+++ b/Reb.cpp
@@ -105,8 +105,7 @@ QImage* CReb::getPicture(const QString& ref)
       char* imgbuffer = new char[rs.len];
       fseek(fin, page2pos(iter.data()), SEEK_SET);
       fread(imgbuffer, rs.len, 1, fin);
-      QByteArray arr;
-      arr.assign((const char*)imgbuffer, rs.len);
+      QByteArray arr((const char*)imgbuffer, rs.len);
       QImage* qimage = new QImage(arr);
       return qimage;
     }
@@ -581,7 +580,7 @@ void RBPage::startpage(UInt32 pos, UInt32 _cp, bool _isCompressed, UInt32 _len)
 int CReb::getch()
 {
   if (tagoffset < tagstring.length())
-    return tagstring[tagoffset++].unicode();
+    return tagstring.at(tagoffset++).unicode();
   else
     return currentpage.getch(this);
 }
diff --git a/TableDialog.cpp b/TableDialog.cpp
index b67d534..d0748d6 100644
--- a/TableDialog.cpp
+++ b/TableDialog.cpp
@@ -4,7 +4,7 @@ CTableDialog::CTableDialog(const QFont& f, const QString& tabtext, bool fs, QWid
 {
   setCaption("Table View");
   QVBoxLayout *tmp = new QVBoxLayout(this);
-  QTextView* qtv = new QTextView(this);
+  Q3TextView* qtv = new Q3TextView(this);
   qtv->setFont(f);
   tmp->addWidget(qtv);
   qtv->setText(tabtext);
diff --git a/TableDialog.h b/TableDialog.h
index 2257a81..14b1cf2 100644
--- a/TableDialog.h
+++ b/TableDialog.h
@@ -2,8 +2,11 @@
 #define __TABLEDIALOG_H
 
 #include <qdialog.h>
-#include <qtextview.h>
+#include <Qt3Support/Q3TextView>
+#include <QtGui/QKeyEvent>
 #include <qlayout.h>
+#include <qnamespace.h>
+using namespace Qt;
 
 class CTableDialog : public QDialog
 {
diff --git a/ToolbarPrefs.cpp b/ToolbarPrefs.cpp
index 56c4e9b..10fc6ec 100644
--- a/ToolbarPrefs.cpp
+++ b/ToolbarPrefs.cpp
@@ -22,6 +22,7 @@
 #ifdef USEQPE
 #include <qpe/menubutton.h>
 #endif
+#include <Qt3Support/Q3GroupBox>
 
 CBarPrefs::CBarPrefs(const QString& appdir, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true), config( appdir )
 {
@@ -222,7 +223,7 @@ CFileBarPrefs::CFileBarPrefs( Config& _config, QWidget* parent,  const char* nam
     config.setGroup( "Toolbar" );
     QVBoxLayout* vb = new QVBoxLayout(this);
 
-    QGroupBox* bg = new QGroupBox(2, Qt::Horizontal, "File", this);
+    Q3GroupBox* bg = new Q3GroupBox(2, Qt::Horizontal, "File", this);
     vb->addWidget(bg);
 
     open = new QCheckBox( tr("Open"), bg );
@@ -263,7 +264,7 @@ CNavBarPrefs::CNavBarPrefs( Config& _config, QWidget* parent,  const char* name,
     config.setGroup( "Toolbar" );
     QVBoxLayout* vb = new QVBoxLayout(this);
 
-    QGroupBox* bg = new QGroupBox(2, Qt::Horizontal, "Navigation", this);
+    Q3GroupBox* bg = new Q3GroupBox(2, Qt::Horizontal, "Navigation", this);
     vb->addWidget(bg);
     scroll = new QCheckBox( tr("Scroll"), bg );
     scroll->setChecked(config.readBoolEntry( "Scroll", false ));
@@ -324,7 +325,7 @@ CViewBarPrefs::CViewBarPrefs( Config& _config, QWidget* parent,  const char* nam
 {
     QVBoxLayout* vb = new QVBoxLayout(this);
 
-    QGroupBox* bg = new QGroupBox(2, Qt::Horizontal, "View", this);
+    Q3GroupBox* bg = new Q3GroupBox(2, Qt::Horizontal, "View", this);
     vb->addWidget(bg);
 
     config.setGroup( "Toolbar" );
@@ -381,7 +382,7 @@ CMarkBarPrefs::CMarkBarPrefs( Config& _config, QWidget* parent,  const char* nam
 {
     QVBoxLayout* vb = new QVBoxLayout(this);
 
-    QGroupBox* bg = new QGroupBox(2, Qt::Horizontal, "Marks", this);
+    Q3GroupBox* bg = new Q3GroupBox(2, Qt::Horizontal, "Marks", this);
     vb->addWidget(bg);
     mark = new QCheckBox( tr("Bookmark"), bg );
     mark->setChecked(config.readBoolEntry( "Mark", false ));
@@ -443,13 +444,13 @@ CMiscBarPrefs::CMiscBarPrefs( QWidget* parent,  const char* name, WFlags fl )
 
     hl->setMargin( 0 );
 
-    QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, "Dialogs", this);
+    Q3GroupBox* gb = new Q3GroupBox(1, Qt::Horizontal, "Dialogs", this);
     floating = new QCheckBox(gb);
     floating->setText(tr("Floating"));
     hl->addWidget( gb, 0, 0 );
 
 
-    gb = new QGroupBox(1, Qt::Horizontal, "Bars (Restart)", this);
+    gb = new Q3GroupBox(1, Qt::Horizontal, "Bars (Restart)", this);
 
 //    QLabel* ql = new QLabel("Restart to apply changes", gb);
 //    TextLabel = new QLabel( gb );
@@ -485,7 +486,7 @@ CMiscBarPrefs::CMiscBarPrefs( QWidget* parent,  const char* name, WFlags fl )
 
     hl->addWidget(gb, 0, 1);
 
-    gb = new QGroupBox(1, Qt::Horizontal, "QT Scroll Bar", this);
+    gb = new Q3GroupBox(1, Qt::Horizontal, "QT Scroll Bar", this);
 
 #ifdef USECOMBO
     qtscroll = new QComboBox(gb);
@@ -497,7 +498,7 @@ CMiscBarPrefs::CMiscBarPrefs( QWidget* parent,  const char* name, WFlags fl )
     qtscroll->insertItem(tr("Left"));
 
     hl->addWidget(gb, 1, 0);
-    gb = new QGroupBox(1, Qt::Horizontal, "Miniscroll", this);
+    gb = new Q3GroupBox(1, Qt::Horizontal, "Miniscroll", this);
 
 #ifdef USECOMBO
     localscroll = new QComboBox(gb);
@@ -527,7 +528,7 @@ CIndBarPrefs::CIndBarPrefs( Config& _config, QWidget* parent,  const char* name,
 {
     QVBoxLayout* vb = new QVBoxLayout(this);
 
-    QGroupBox* bg = new QGroupBox(1, Qt::Horizontal, "Indicators", this);
+    Q3GroupBox* bg = new Q3GroupBox(1, Qt::Horizontal, "Indicators", this);
     vb->addWidget(bg);
     indannotate = new QCheckBox( tr("Annotation"), bg );
     indannotate->setChecked(config.readBoolEntry( "Annotation indicator", false ));
diff --git a/ToolbarPrefs.h b/ToolbarPrefs.h
index 9df8940..2a9d5cd 100644
--- a/ToolbarPrefs.h
+++ b/ToolbarPrefs.h
@@ -11,12 +11,14 @@
 
 #include <qvariant.h>
 #include <qwidget.h>
-#include <qtabdialog.h>
+#include <Qt3Support/Q3TabDialog>
 #include <qtabwidget.h>
 #include <qspinbox.h>
 #include <qcheckbox.h>
 #include <qcombobox.h>
 #include <qlineedit.h>
+#include <qnamespace.h>
+using namespace Qt;
 #ifdef USEQPE
 #include <qpe/menubutton.h>
 #include <qpe/config.h>
@@ -25,6 +27,8 @@
 #endif
 #define USECOMBO
 
+#include <QtGui/QKeyEvent>
+
 class QVBoxLayout; 
 class QHBoxLayout; 
 class QGridLayout; 
diff --git a/URLDialog.cpp b/URLDialog.cpp
index dd4568b..9497979 100644
--- a/URLDialog.cpp
+++ b/URLDialog.cpp
@@ -5,7 +5,7 @@ CURLDialog::CURLDialog(const QString& fname, bool fs, QWidget* parent, const cha
 {
     setCaption(tr("Save URL"));
     QVBoxLayout *tmp = new QVBoxLayout(this);
-    QVButtonGroup* vb = new QVButtonGroup(fname, this);
+    Q3VButtonGroup* vb = new Q3VButtonGroup(fname, this);
     tmp->addWidget(vb);
     m_clipboard = new QCheckBox(tr("Clipboard"), vb);
     m_localfile = new QCheckBox(tr("Local file"), vb);
diff --git a/URLDialog.h b/URLDialog.h
index 792d13a..fffaf2b 100644
--- a/URLDialog.h
+++ b/URLDialog.h
@@ -11,14 +11,17 @@
 
 #include <qvariant.h>
 #include <qwidget.h>
-#include <qtabdialog.h>
+#include <Qt3Support/Q3TabDialog>
 #include <qtabwidget.h>
 #include <qspinbox.h>
 #include <qcheckbox.h>
 #include <qcombobox.h>
 #include <qlineedit.h>
 //#include <qpe/menubutton.h>
-#include <qvbuttongroup.h>
+#include <Qt3Support/Q3VButtonGroup>
+#include <QtGui/QKeyEvent>
+#include <qnamespace.h>
+using namespace Qt;
 
 class QVBoxLayout; 
 class QHBoxLayout; 
diff --git a/arrierego.cpp b/arrierego.cpp
index be2a3fa..b4f857f 100644
--- a/arrierego.cpp
+++ b/arrierego.cpp
@@ -114,8 +114,7 @@ void CArriere::setlink(QString& fn, const QString& wrd)
 
 QImage* CArriere::imagefromdata(UInt8* imgbuffer, UInt32 imgsize)
 {
-    QByteArray arr;
-    arr.assign((const char*)imgbuffer, imgsize);
+    QByteArray arr((const char*)imgbuffer, imgsize);
 
     QImage* qimage = new QImage(arr);
 
diff --git a/cbkmkselector.h b/cbkmkselector.h
index ec0c6e8..e36d31a 100644
--- a/cbkmkselector.h
+++ b/cbkmkselector.h
@@ -1,13 +1,15 @@
 #include <qwidget.h>
-#include <qlistbox.h>
+#include <Qt3Support/Q3ListBox>
 #include <qpushbutton.h>
 #include <qlayout.h>
+#include <qnamespace.h>
+using namespace Qt;
 
-class CBkmkSelectorItem : public QListBoxText
+class CBkmkSelectorItem : public Q3ListBoxText
 {
   int m_ref;
  public:
-  CBkmkSelectorItem(const QString& _t, int ref) : QListBoxText(_t), m_ref(ref)
+  CBkmkSelectorItem(const QString& _t, int ref) : Q3ListBoxText(_t), m_ref(ref)
     {
     }
   int reference() { return m_ref; }
@@ -18,7 +20,7 @@ class CBkmkSelector : public QWidget
 
   Q_OBJECT
 
-  QListBox* bkmkselector;
+  Q3ListBox* bkmkselector;
   QPushButton* exitButton;
   /*
   void keyPressEvent ( QKeyEvent * e )
@@ -38,7 +40,7 @@ signals:
   void selected(int i);
   void cancelled();
 private slots:
-  void slotSelected(QListBoxItem* t)
+  void slotSelected(Q3ListBoxItem* t)
   {
     if (t != NULL)
       {
@@ -64,13 +66,13 @@ public:
 
     QVBoxLayout* grid = new QVBoxLayout(this);
     QHBoxLayout* hgrid = new QHBoxLayout();
-    bkmkselector = new QListBox(this, tr("Bookmarks"));
+    bkmkselector = new Q3ListBox(this, tr("Bookmarks"));
     QPushButton* _sort = new QPushButton(tr("Sort"), this);
     connect(_sort, SIGNAL(clicked()), this, SLOT( slotSort() ) );
     exitButton = new QPushButton(tr("Cancel"), this);
     //    connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( slotSelected(int) ) );
-    connect(bkmkselector, SIGNAL( clicked(QListBoxItem*) ), this, SLOT( slotSelected(QListBoxItem*) ) );
-    connect(bkmkselector, SIGNAL( returnPressed(QListBoxItem*) ), this, SLOT( slotSelected(QListBoxItem*) ) );
+    connect(bkmkselector, SIGNAL( clicked(Q3ListBoxItem*) ), this, SLOT( slotSelected(Q3ListBoxItem*) ) );
+    connect(bkmkselector, SIGNAL( returnPressed(Q3ListBoxItem*) ), this, SLOT( slotSelected(Q3ListBoxItem*) ) );
     connect(exitButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) );
     grid->addWidget(bkmkselector,1);
     grid->addLayout(hgrid);
diff --git a/decompress.cpp b/decompress.cpp
index 6034e01..979b642 100644
--- a/decompress.cpp
+++ b/decompress.cpp
@@ -2,6 +2,7 @@
 #include "decompress.h"
 #include <zlib.h>
 #include <stdlib.h>
+#include "uqtcommon.h"
 
 size_t UnZip(UInt8* compressedbuffer, size_t reclen, UInt8* tgtbuffer, size_t bsize)
 {
@@ -60,17 +61,7 @@ size_t (*getdecompressor(char* _s))(UInt8*, size_t, UInt8*, size_t)
 
 size_t (*getdecompressor(char* _s))(UInt8*, size_t, UInt8*, size_t)
 {
-#ifdef USEQPE
-#ifdef OPIE
-  QString codecpath(getenv("OPIEDIR"));
-#else
-  QString codecpath(getenv("QTDIR"));
-#endif
-  codecpath += "/plugins/reader/support/libpluckerdecompress.so";
-#else
-  QString codecpath(getenv("READERDIR"));
-  codecpath += "/support/libpluckerdecompress.so";
-#endif
+    QString codecpath = uqt_supportpath()+"/libpluckerdecompress.so";
   qDebug("Codec:%s", (const char*)codecpath);
   if (QFile::exists(codecpath))
     {
diff --git a/ebookcodec.h b/ebookcodec.h
index 4229fb9..091894a 100644
--- a/ebookcodec.h
+++ b/ebookcodec.h
@@ -1,4 +1,5 @@
 #include "CExpander.h"
+#include "uqtcommon.h"
 
 #include <qfileinfo.h>
 #include <qdir.h>
@@ -22,17 +23,7 @@ class ebookcodec : public CExpander_Interface
     }
   ebookcodec(const QString& _s) : codec(NULL), handle(NULL), status(0)
     {
-#ifdef USEQPE
-#ifdef OPIE
-      QString codecpath(getenv("OPIEDIR"));
-#else
-		QString codecpath(getenv("QTDIR"));
-#endif
-      codecpath += "/plugins/reader/codecs/";
-#else
-      QString codecpath(getenv("READERDIR"));
-      codecpath += "/codecs/";
-#endif
+	QString codecpath = uqt_codecspath();
       codecpath += _s;
       if (QFile::exists(codecpath))
 	{
diff --git a/fileBrowser.cpp b/fileBrowser.cpp
index c8c371a..688f035 100644
--- a/fileBrowser.cpp
+++ b/fileBrowser.cpp
@@ -53,18 +53,18 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent,  const char* name, boo
     ListView->addColumn( tr( "Name" ) );
     ListView->setSorting( 2, FALSE);
     ListView->addColumn( tr( "Size" ) );
-    ListView->setSelectionMode(QListView::Single);
+    ListView->setSelectionMode(Q3ListView::Single);
     ListView->setAllColumnsShowFocus( TRUE );
-    ListView->setColumnWidthMode(0, ((modal) ? QListView::Manual : QListView::Maximum));
-    ListView->setColumnWidthMode(1, QListView::Manual);
+    ListView->setColumnWidthMode(0, ((modal) ? Q3ListView::Manual : Q3ListView::Maximum));
+    ListView->setColumnWidthMode(1, Q3ListView::Manual);
 
     // signals and slots connections
     connect( buttonShowHidden, SIGNAL( toggled(bool) ), this, SLOT( setHidden(bool) ) );
     connect( buttonOk, SIGNAL( clicked() ), this, SLOT( OnRoot() ) );
-    connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) );
-    connect( ListView, SIGNAL(clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
-    connect( ListView, SIGNAL(OnOKButton( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
-    connect( ListView, SIGNAL(OnCentreButton( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
+    connect( ListView, SIGNAL(doubleClicked( Q3ListViewItem*)), SLOT(listDoubleClicked(Q3ListViewItem *)) );
+    connect( ListView, SIGNAL(clicked( Q3ListViewItem*)), SLOT(listClicked(Q3ListViewItem *)) );
+    connect( ListView, SIGNAL(OnOKButton( Q3ListViewItem*)), SLOT(listClicked(Q3ListViewItem *)) );
+    connect( ListView, SIGNAL(OnCentreButton( Q3ListViewItem*)), SLOT(listClicked(Q3ListViewItem *)) );
     connect( ListView, SIGNAL(OnCancelButton()), SLOT(OnCancel()) );
 
     QVBoxLayout* grid = new QVBoxLayout(this);
@@ -143,16 +143,13 @@ void fileBrowser::populateList()
     currentDir.setNameFilter(filterStr);
 //    currentDir.setNameFilter("*.txt;*.etx");
     QString fileL, fileS;
-    const QFileInfoList *list = currentDir.entryInfoList();
-    QFileInfoListIterator it(*list);
-    QFileInfo *fi;
-    while ( (fi=it.current()) )
-    {
-	if (fi->fileName() != ".")
+    QFileInfoList list = currentDir.entryInfoList();
+    for(QFileInfoListIterator it=list.begin();it!=list.end();++it) {
+	if (it->fileName() != ".")
 	{
-	    fileS.sprintf( "%10li", fi->size() );
-	    fileL.sprintf( "%s",fi->fileName().data() );
-	    if( fi->isDir() )
+	    fileS.sprintf( "%10li", it->size() );
+	    fileL.sprintf( "%s",it->fileName().data() );
+	    if( it->isDir() )
 	    {
 		fileL+="/";
 	    } 
@@ -160,9 +157,8 @@ void fileBrowser::populateList()
 	    {
 ////        qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
 	    }
-	    new QListViewItem( ListView,fileL,fileS );
+	    new Q3ListViewItem( ListView,fileL,fileS );
 	}
-	++it;
     }
     ListView->setSorting( 2, FALSE);
     dirLabel->setText("Current Directory:\n"+currentDir.canonicalPath());
@@ -174,7 +170,7 @@ void fileBrowser::upDir()
 ////    qDebug(currentDir.canonicalPath());
 }
 
-void fileBrowser::listClicked(QListViewItem *selectedItem)
+void fileBrowser::listClicked(Q3ListViewItem *selectedItem)
 {
     if (selectedItem == NULL) return;
     QString strItem=selectedItem->text(0);
@@ -196,12 +192,12 @@ void fileBrowser::listClicked(QListViewItem *selectedItem)
 
 	if(QDir(strItem).exists())
 	{
-	    currentDir.cd(strItem, TRUE);
+	    currentDir.cd(strItem);
 	    populateList();
 	}
     } else
     {
-	QListViewItem *selectedItem = ListView->selectedItem();
+	Q3ListViewItem *selectedItem = ListView->selectedItem();
 	if (selectedItem == NULL)
 	{
 	    filename = "";
@@ -218,7 +214,7 @@ void fileBrowser::listClicked(QListViewItem *selectedItem)
 }
 
 // you may want to switch these 2 functions. I like single clicks
-void fileBrowser::listDoubleClicked(QListViewItem *selectedItem)
+void fileBrowser::listDoubleClicked(Q3ListViewItem *selectedItem)
 {
 }
 
@@ -253,7 +249,7 @@ void fileBrowser::setHidden(bool _hidden)
 
 void fileBrowser::onReturn()
 {
-    QListViewItem *selectedItem = ListView->selectedItem();
+    Q3ListViewItem *selectedItem = ListView->selectedItem();
     if (selectedItem == NULL)
     {
 	filename = m_filename->text();
@@ -282,7 +278,7 @@ void fileBrowser::onHome()
 
 void fileBrowser::setdir(const QString& s)
 {
-    currentDir.cd(s, TRUE);
+    currentDir.cd(s);
     populateList();
     chdir(s);
 }
diff --git a/fileBrowser.h b/fileBrowser.h
index c536e96..959e866 100644
--- a/fileBrowser.h
+++ b/fileBrowser.h
@@ -22,6 +22,9 @@ blah,blah,blah
 #include <qstringlist.h> 
 #include <qlabel.h>
 #include <qstring.h>
+#include <qnamespace.h>
+using namespace Qt;
+#include <Qt3Support/Q3ListViewItem>
 
 class QVBoxLayout; 
 class QHBoxLayout; 
@@ -50,7 +53,7 @@ class fileBrowser : public QDialog
   QFile file;
   QString getCurrentFile();
   QLineEdit* m_filename;
-  int filterspec;
+  QDir::Filters filterspec;
   //    QDir::FilterSpec filterspec;
  
   //QListViewItem * item;
@@ -60,8 +63,8 @@ class fileBrowser : public QDialog
   QString filename; 
   private slots: 
     void upDir();
-  void listDoubleClicked(QListViewItem *);
-  void listClicked(QListViewItem *);
+  void listDoubleClicked(Q3ListViewItem *);
+  void listClicked(Q3ListViewItem *);
   void OnRoot();
   void OnCancel();
   void setHidden(bool);
diff --git a/hrule.cpp b/hrule.cpp
index d697acb..4705057 100644
--- a/hrule.cpp
+++ b/hrule.cpp
@@ -1,4 +1,5 @@
 #include <qimage.h>
+#include <qpixmap.h>
 
 QImage* hRule(int w, int h, unsigned char r, unsigned char g, unsigned char b)
 {
diff --git a/infowin.cpp b/infowin.cpp
index 816a09f..0a25571 100644
--- a/infowin.cpp
+++ b/infowin.cpp
@@ -1,7 +1,7 @@
 #include "infowin.h"
 #include "version.h"
 #include <stdio.h>
-#include <qmultilineedit.h>
+#include <Qt3Support/Q3MultiLineEdit>
 #include <qlayout.h>
 #include <qpushbutton.h>
 #include "names.h"
@@ -20,9 +20,9 @@ infowin::infowin( QWidget *parent, const char *name, WFlags f) :
     QWidget(parent, name, f)
 {
   QVBoxLayout* vl = new QVBoxLayout(this);
-  aboutbox = new QMultiLineEdit(this);
+  aboutbox = new Q3MultiLineEdit(this);
   aboutbox->setReadOnly(true);
-    aboutbox->setWordWrap(QMultiLineEdit::WidgetWidth);
+    aboutbox->setWordWrap(Q3MultiLineEdit::WidgetWidth);
   //grid->addWidget(l, 5, 0);
   vl->addWidget(aboutbox);
     QGridLayout* grid = new QGridLayout(vl, 10, 2);
diff --git a/infowin.h b/infowin.h
index c003998..92cff3a 100644
--- a/infowin.h
+++ b/infowin.h
@@ -2,6 +2,9 @@
 #define __INFOWIN_H
 
 #include <qlabel.h>
+#include <Qt3Support/Q3MultiLineEdit>
+#include <qnamespace.h>
+using namespace Qt;
 class QString;
 class QMultiLineEdit;
 
@@ -17,7 +20,7 @@ Q_OBJECT
     QLabel* docSize;
     QLabel* docLocation;
     QLabel* zoom;
-    QMultiLineEdit* aboutbox;
+    Q3MultiLineEdit* aboutbox;
 public:
     infowin( QWidget *parent=0, const char *name=0, WFlags f = 0);
     void setFileSize(int sz) { fileSize->setNum(sz); }
diff --git a/opiedir/include.pro b/opiedir/include.pro
new file mode 100644
index 0000000..44c572b
--- /dev/null
+++ b/opiedir/include.pro
@@ -0,0 +1,15 @@
+DEFINES -= OPIE USEQPE
+DEFINES += QT3_SUPPORT
+
+LIBS -= -lopiecore2 -lopieui2 -lqpe
+LIBS += -L${OPIEDIR}/lib
+
+QT += core gui qt3support
+
+isEmpty(UQT_LIBDIR) {
+ UQT_LIBDIR = /usr/lib/uqtreader
+}
+isEmpty(UQT_DATADIR) {
+ UQT_DATADIR = /usr/share/uqtreader
+}
+DEFINES += UQT_LIBDIR='\\"$$UQT_LIBDIR\\"' UQT_DATADIR='\\"$$UQT_DATADIR\\"'
diff --git a/outputcodec.h b/outputcodec.h
index 727575c..dfba5a2 100644
--- a/outputcodec.h
+++ b/outputcodec.h
@@ -2,6 +2,8 @@
 #include <qfileinfo.h>
 #include <qdir.h>
 
+#include "uqtcommon.h"
+
 #ifdef USEQPE
 #include <qpe/global.h>
 #endif
@@ -29,17 +31,8 @@ class outputcodec : public COutput
     }
   outputcodec(const QString& _s) : codec(NULL), handle(NULL), status(-1)
     {
-#ifdef USEQPE
-#ifdef OPIE
-      QString codecpath(getenv("OPIEDIR"));
-#else
-      QString codecpath(getenv("QTDIR"));
-#endif
-      codecpath += "/plugins/reader/outcodecs/lib";
-#else
-      QString codecpath(getenv("READERDIR"));
-      codecpath += "/outcodecs/lib";
-#endif
+	QString codecpath = uqt_outcodecspath();
+	codecpath += "lib";
       codecpath += _s;
       codecpath += ".so";
       if (QFile::exists(codecpath))
diff --git a/preferences.cpp b/preferences.cpp
index 67960ed..044a003 100755
--- a/preferences.cpp
+++ b/preferences.cpp
@@ -14,7 +14,7 @@ Config::Config(const QString& _fn) : fname(_fn)
     {
 	QTextStream t(&fl);
 	QString key, value;
-	while (!t.eof())
+	while (!t.atEnd())
 	{
 	    QString data = t.readLine();
 	    int colon = data.find(':');
diff --git a/reader/reader.pro b/reader/reader.pro
index dc6a5dd..7552bd1 100644
--- a/reader/reader.pro
+++ b/reader/reader.pro
@@ -51,7 +51,8 @@ HEADERS		= Aportis.h \
 		  util.h \
                   utypes.h \
                   version.h \
-                  ztxt.h
+                  ztxt.h \
+		  preferences.h
 
 SOURCES		= BuffDoc.cpp \
                   ButtonPrefs.cpp \
@@ -76,7 +77,8 @@ SOURCES		= BuffDoc.cpp \
                   main.cpp \
 		  orkey.cpp \
 		  util.cpp \
-                  version.cpp
+                  version.cpp \
+		  preferences.cpp
 
 INTERFACES	= 
 DESTDIR		= $(OPIEDIR)/bin
diff --git a/striphtml.cpp b/striphtml.cpp
index a2ad56b..1346dc3 100644
--- a/striphtml.cpp
+++ b/striphtml.cpp
@@ -8,6 +8,7 @@
 #include "CDrawBuffer.h"
 #include "striphtml.h"
 #include "hrule.h"
+#include "uqtcommon.h"
 
 #include <qregexp.h>
 #include <qimage.h>
@@ -209,14 +210,14 @@ QString striphtml::dehtml(const QString& _info)
   QString info;
   for (int i = 0; i < _info.length(); i++)
   {
-    tchar ch = _info[i];
+    tchar ch = _info[i].unicode();
     if (ch == '%')
       {
 	ch = 0;
 	for (int j = 0; j < 2; j++)
 	  {
 	    ch <<= 4;
-	    tchar ch1 = _info[++i];
+	    tchar ch1 = _info[++i].unicode();
 	    if ('0' <= ch1 && ch1 <= '9')
 	      {
 		ch += ch1 - '0';
@@ -285,7 +286,7 @@ bool striphtml::findanchor(const QString& _info)
       while (1)
 	{
 	  //	  qApp->processEvents();
-	  if ((offset = name.match(toQString(test.data()))) != -1) break;
+	  if ((offset = name.exactMatch(toQString(test.data()))) != -1) break;
 #ifdef USEQPE
 	  if ((offset = id.match(toQString(test.data()))) != -1) break;
 #endif
@@ -325,17 +326,7 @@ striphtml::~striphtml()
 void striphtml::initentmap()
 {
   entmap = new QMap<QString, tchar>;
-#ifdef USEQPE
-#ifdef OPIE
-  QString fname(getenv("OPIEDIR"));
-#else
-  QString fname(getenv("QTDIR"));
-#endif
-  fname += "/plugins/reader/data";
-#else
-  QString fname(getenv("READERDIR"));
-  fname += "/data";
-#endif  
+  QString fname = uqt_datapath();
   QFileInfo fi;
   fi.setFile(fname, "HTMLentities");
   if (fi.exists())
@@ -347,7 +338,7 @@ void striphtml::initentmap()
 	{
 	  QTextStream t(&fl);
 	  QString key, value;
-	  while (!t.eof())
+	  while (!t.atEnd())
 	    {
 	      QString data = t.readLine();
 	      int colon = data.find(':');
diff --git a/uqtcommon.h b/uqtcommon.h
new file mode 100644
index 0000000..e551740
--- /dev/null
+++ b/uqtcommon.h
@@ -0,0 +1,57 @@
+#ifndef __UQTCOMMON_H
+#define __UQTCOMMON_H
+
+#include <qstring.h>
+
+#ifdef USEQPE
+# ifdef OPIE
+#  define Q_DIR_ENV "OPIEDIR"
+# else
+#  define Q_DIR_ENV "QTDIR"
+# endif
+#endif
+
+inline QString uqt_libdir() {
+#   ifdef USEQPE
+    return QString(getenv(Q_DIR_ENV))+"/plugins/reader";
+#   else
+    const char *rd = getenv("READERDIR");
+    if(rd) return rd;
+    return UQT_LIBDIR;
+#   endif
+}
+inline QString uqt_datadir() {
+#   ifdef USEQPE
+    return QString(geenv(Q_DIR_ENV));
+#   else
+    const char *rd = getenv("READERDIR");
+    if(rd) return rd;
+    return UQT_DATADIR;
+#   endif
+}
+
+inline QString uqt_codecspath() {
+    return uqt_libdir()+"/codecs/";
+}
+inline QString uqt_outcodecspath() {
+    return uqt_libdir()+"/outcodecs/";
+}
+inline QString uqt_filterspath() {
+    return uqt_libdir()+"/filters/";
+}
+inline QString uqt_supportpath() {
+    return uqt_libdir()+"/support/";
+}
+
+inline QString uqt_picspath() {
+    return uqt_datadir()+"/pics/";
+}
+inline QString uqt_datapath() {
+#   ifdef QPE
+    return uqt_datadir()+"/plugins/reader/data";
+#   else
+    return uqt_datadir()+"/data";
+#   endif
+}
+
+#endif /* __UQTCOMMON_H */
diff --git a/version.cpp b/version.cpp
index aafb3d8..743ef38 100644
--- a/version.cpp
+++ b/version.cpp
@@ -2,9 +2,9 @@
 #include "names.h"
 #include <qmessagebox.h>
 
-#include <qmultilineedit.h>
+#include <Qt3Support/Q3MultiLineEdit>
 #include <qlayout.h>
-#include <qtextview.h>
+#include <Qt3Support/Q3TextView>
 class versionbox : public QDialog
 {
 public:
@@ -19,7 +19,7 @@ public:
     box->setWordWrap(QMultiLineEdit::WidgetWidth);
     box->setText(txt);
     */
-    QTextView* box = new QTextView(this);
+    Q3TextView* box = new Q3TextView(this);
     v->addWidget(box);
     box->setText(txt);
 #ifdef USEQPE