author | pohly <pohly> | 2005-05-05 14:39:33 (UTC) |
---|---|---|
committer | pohly <pohly> | 2005-05-05 14:39:33 (UTC) |
commit | 39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91 (patch) (unidiff) | |
tree | 96e66fdc18dca4d4ab8611133e072f57dea224b9 /noncore/apps/opie-reader/QTReaderApp.cpp | |
parent | 279fc4fd1986074acbadd3a8e86fcf3968a8dd5c (diff) | |
download | opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.zip opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.tar.gz opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.tar.bz2 |
new opie-reader sources with support for ArriereGo, Reb input and flite output plugins
Diffstat (limited to 'noncore/apps/opie-reader/QTReaderApp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/QTReaderApp.cpp | 246 |
1 files changed, 176 insertions, 70 deletions
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp index 876b65a..6753698 100644 --- a/noncore/apps/opie-reader/QTReaderApp.cpp +++ b/noncore/apps/opie-reader/QTReaderApp.cpp | |||
@@ -1,253 +1,256 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. Allrights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. Allrights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | |||
20 | #include <qregexp.h> | 21 | #include <qregexp.h> |
21 | #include <qclipboard.h> | 22 | #include <qclipboard.h> |
22 | #include <qwidgetstack.h> | 23 | #include <qwidgetstack.h> |
23 | #ifdef USEQPE | 24 | #ifdef USEQPE |
24 | #include <qpe/qpemenubar.h> | 25 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 26 | #include <qpe/qpetoolbar.h> |
26 | #endif | 27 | #endif |
27 | #include <qmenubar.h> | 28 | #include <qmenubar.h> |
28 | #include <qtoolbar.h> | 29 | #include <qtoolbar.h> |
29 | #ifdef USEQPE | 30 | #ifdef USEQPE |
30 | #include <qpe/menubutton.h> | 31 | #include <qpe/menubutton.h> |
31 | #endif | 32 | #endif |
32 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
33 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
34 | #include <qaction.h> | 35 | #include <qaction.h> |
35 | #include <qapplication.h> | 36 | #include <qapplication.h> |
36 | #include <qlineedit.h> | 37 | #include <qlineedit.h> |
37 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
38 | #include <qspinbox.h> | 39 | #include <qspinbox.h> |
39 | #include <qobjectlist.h> | 40 | #include <qobjectlist.h> |
40 | #include <qstatusbar.h> | 41 | #include <qstatusbar.h> |
41 | #ifdef USEQPE | 42 | #ifdef USEQPE |
42 | #include <qpe/global.h> | 43 | #include <qpe/global.h> |
43 | #include <qpe/applnk.h> | 44 | #include <qpe/applnk.h> |
44 | #endif | 45 | #endif |
45 | #include <qfileinfo.h> | 46 | #include <qfileinfo.h> |
46 | #include <stdlib.h> //getenv | 47 | #include <stdlib.h> //getenv |
47 | #include <qprogressbar.h> | 48 | #include <qprogressbar.h> |
48 | #ifdef USEQPE | 49 | #ifdef USEQPE |
49 | #include <qpe/config.h> | 50 | #include <qpe/config.h> |
50 | #endif | 51 | #endif |
51 | #include <qbuttongroup.h> | 52 | #include <qbuttongroup.h> |
52 | #include <qradiobutton.h> | 53 | #include <qradiobutton.h> |
53 | #ifdef USEQPE | 54 | #ifdef USEQPE |
54 | #include <qpe/qcopenvelope_qws.h> | 55 | #include <qpe/qcopenvelope_qws.h> |
55 | #endif | 56 | #endif |
56 | #include "QTReader.h" | 57 | #include "QTReader.h" |
57 | #include "GraphicWin.h" | 58 | #include "GraphicWin.h" |
58 | #include "Bkmks.h" | 59 | #include "Bkmks.h" |
59 | #include "cbkmkselector.h" | 60 | #include "cbkmkselector.h" |
60 | #include "infowin.h" | 61 | #include "infowin.h" |
61 | #include "ToolbarPrefs.h" | 62 | #include "ToolbarPrefs.h" |
62 | #include "Prefs.h" | 63 | #include "Prefs.h" |
63 | #include "CAnnoEdit.h" | 64 | #include "CAnnoEdit.h" |
64 | #include "QFloatBar.h" | 65 | #include "QFloatBar.h" |
65 | #include "FixedFont.h" | 66 | #include "FixedFont.h" |
66 | #include "URLDialog.h" | 67 | #include "URLDialog.h" |
67 | #include "util.h" | 68 | #include "util.h" |
68 | #include <qfontdatabase.h> | 69 | #include <qfontdatabase.h> |
70 | |||
69 | #ifdef USEQPE | 71 | #ifdef USEQPE |
70 | #include <qpe/resource.h> | 72 | #include <qpe/resource.h> |
71 | #ifdef OPIE | 73 | #ifdef OPIE |
72 | //#include <qpe/applnk.h> | 74 | #if defined(OPIEFILEDIALOG) |
75 | #include <qpe/applnk.h> | ||
73 | #include <opie2/ofiledialog.h> | 76 | #include <opie2/ofiledialog.h> |
74 | using namespace Opie::Ui; | 77 | using namespace Opie::Ui; |
75 | #else | 78 | #else |
76 | #include "fileBrowser.h" | 79 | #include "fileBrowser.h" |
77 | #endif | 80 | #endif |
78 | #else | 81 | #else |
82 | #include "fileBrowser.h" | ||
83 | #endif | ||
84 | #else | ||
79 | #include "qfiledialog.h" | 85 | #include "qfiledialog.h" |
80 | #endif | 86 | #endif |
81 | 87 | ||
82 | #include "QTReaderApp.h" | 88 | #include "QTReaderApp.h" |
83 | #include "CDrawBuffer.h" | 89 | #include "CDrawBuffer.h" |
84 | #include "Filedata.h" | 90 | #include "Filedata.h" |
85 | #include "names.h" | 91 | #include "names.h" |
86 | #include "CEncoding_tables.h" | 92 | #include "CEncoding_tables.h" |
87 | #include "CloseDialog.h" | 93 | #include "CloseDialog.h" |
88 | 94 | ||
89 | #include "ButtonPrefs.h" | 95 | #include "ButtonPrefs.h" |
90 | 96 | ||
91 | bool CheckVersion(int&, int&, char&); | 97 | bool CheckVersion(int&, int&, char&, QWidget*); |
92 | 98 | ||
93 | #ifdef _WINDOWS | 99 | #ifdef _WINDOWS |
94 | #define PICDIR "c:\\uqtreader\\pics\\" | 100 | #define PICDIR "c:\\uqtreader\\pics\\" |
95 | #else | 101 | #else |
96 | #ifdef USEQPE | 102 | #ifdef USEQPE |
97 | #define USEMSGS | 103 | #define USEMSGS |
98 | #define PICDIR "opie-reader/" | 104 | #define PICDIR "opie-reader/" |
99 | #else | 105 | #else |
100 | //#define PICDIR "/home/tim/uqtreader/pics/" | 106 | //#define PICDIR "/home/tim/uqtreader/pics/" |
101 | QString picdir() | 107 | QString picdir() |
102 | { | 108 | { |
103 | QString hd(getenv("READERDIR")); | 109 | QString hd(getenv("READERDIR")); |
104 | return hd + "/pics"; | 110 | return hd + "/pics"; |
105 | } | 111 | } |
106 | #define PICDIR picdir() | 112 | #define PICDIR picdir() |
107 | #endif | 113 | #endif |
108 | #endif | 114 | #endif |
109 | 115 | ||
110 | unsigned long QTReaderApp::m_uid = 0; | 116 | unsigned long QTReaderApp::m_uid = 0; |
111 | 117 | ||
112 | void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); } | 118 | void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); } |
113 | 119 | ||
114 | #ifdef USEQPE | 120 | #ifdef USEQPE |
115 | #define geticon(iconname) Resource::loadPixmap( iconname ) | 121 | #define geticon(iconname) Resource::loadPixmap( iconname ) |
116 | #define getmyicon(iconname) Resource::loadPixmap( PICDIR iconname ) | 122 | #define getmyicon(iconname) Resource::loadPixmap( PICDIR iconname ) |
117 | #else | 123 | #else |
118 | //#define geticon(iconname) QPixmap(PICDIR iconname ".png") | 124 | //#define geticon(iconname) QPixmap(PICDIR iconname ".png") |
119 | #define geticon(iconname) QPixmap(PICDIR +"/"+iconname+".png") | 125 | #define geticon(iconname) QPixmap(PICDIR +"/"+iconname+".png") |
120 | #define getmyicon(iconname) geticon(iconname) | 126 | #define getmyicon(iconname) geticon(iconname) |
121 | //#define geticon(iconname) QIconSet( QPixmap(PICDIR iconname) ) | 127 | //#define geticon(iconname) QIconSet( QPixmap(PICDIR iconname) ) |
122 | #endif | 128 | #endif |
123 | 129 | ||
124 | #ifndef _WINDOWS | 130 | #ifndef _WINDOWS |
125 | #include <unistd.h> | 131 | #include <unistd.h> |
126 | #endif | 132 | #endif |
127 | #include <stddef.h> | 133 | #include <stddef.h> |
128 | #ifndef _WINDOWS | 134 | #ifndef _WINDOWS |
129 | #include <dirent.h> | 135 | #include <dirent.h> |
130 | #endif | 136 | #endif |
131 | 137 | ||
132 | void QTReaderApp::listBkmkFiles() | 138 | void QTReaderApp::listBkmkFiles() |
133 | { | 139 | { |
134 | bkmkselector->clear(); | 140 | bkmkselector->clear(); |
135 | bkmkselector->setText("Cancel"); | 141 | bkmkselector->setText("Cancel"); |
136 | #ifndef USEQPE | 142 | #ifndef USEQPE |
137 | int cnt = 0; | 143 | int cnt = 0; |
138 | 144 | ||
139 | QDir d = QDir::home(); // "/" | 145 | QDir d = QDir::home(); // "/" |
140 | if ( !d.cd(APPDIR) ) { // "/tmp" | 146 | if ( !d.cd(APPDIR) ) { // "/tmp" |
141 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 147 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); |
142 | d = QDir::home(); | 148 | d = QDir::home(); |
143 | d.mkdir(APPDIR); | 149 | d.mkdir(APPDIR); |
144 | d.cd(APPDIR); | 150 | d.cd(APPDIR); |
145 | } | 151 | } |
146 | 152 | ||
147 | 153 | ||
148 | 154 | ||
149 | 155 | ||
150 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 156 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
151 | // d.setSorting( QDir::Size | QDir::Reversed ); | 157 | // d.setSorting( QDir::Size | QDir::Reversed ); |
152 | 158 | ||
153 | const QFileInfoList *list = d.entryInfoList(); | 159 | const QFileInfoList *list = d.entryInfoList(); |
154 | QFileInfoListIterator it( *list ); // create list iterator | 160 | QFileInfoListIterator it( *list ); // create list iterator |
155 | QFileInfo *fi; // pointer for traversing | 161 | QFileInfo *fi; // pointer for traversing |
156 | |||
157 | while ( (fi=it.current()) ) { // for each file... | 162 | while ( (fi=it.current()) ) { // for each file... |
158 | 163 | ||
159 | bkmkselector->insertItem(fi->fileName()); | 164 | bkmkselector->insertItem(fi->fileName(), cnt++); |
160 | cnt++; | ||
161 | 165 | ||
162 | //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); | 166 | //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); |
163 | ++it; // goto next list element | 167 | ++it; // goto next list element |
164 | } | 168 | } |
165 | 169 | ||
166 | #else /* USEQPE */ | 170 | #else /* USEQPE */ |
167 | int cnt = 0; | 171 | int cnt = 0; |
168 | DIR *d; | 172 | DIR *d; |
169 | d = opendir((const char *)Global::applicationFileName(APPDIR,"")); | 173 | d = opendir((const char *)Global::applicationFileName(APPDIR,"")); |
170 | 174 | ||
171 | while(1) | 175 | while(1) |
172 | { | 176 | { |
173 | struct dirent* de; | 177 | struct dirent* de; |
174 | struct stat buf; | 178 | struct stat buf; |
175 | de = readdir(d); | 179 | de = readdir(d); |
176 | if (de == NULL) break; | 180 | if (de == NULL) break; |
177 | 181 | ||
178 | if (lstat((const char *)Global::applicationFileName(APPDIR,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) | 182 | if (lstat((const char *)Global::applicationFileName(APPDIR,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) |
179 | { | 183 | { |
180 | bkmkselector->insertItem(de->d_name); | 184 | bkmkselector->insertItem(de->d_name, cnt++); |
181 | cnt++; | ||
182 | } | 185 | } |
183 | } | 186 | } |
184 | 187 | ||
185 | closedir(d); | 188 | closedir(d); |
186 | #endif | 189 | #endif |
187 | if (cnt > 0) | 190 | if (cnt > 0) |
188 | { | 191 | { |
189 | //tjw menu->hide(); | 192 | //tjw menu->hide(); |
190 | 193 | ||
191 | 194 | ||
192 | editorStack->raiseWidget( bkmkselector ); | 195 | editorStack->raiseWidget( bkmkselector ); |
193 | hidetoolbars(); | 196 | hidetoolbars(); |
194 | m_nBkmkAction = cRmBkmkFile; | 197 | m_nBkmkAction = cRmBkmkFile; |
195 | } | 198 | } |
196 | else | 199 | else |
197 | QMessageBox::information(this, PROGNAME, "No bookmark files"); | 200 | QMessageBox::information(this, PROGNAME, "No bookmark files"); |
198 | } | 201 | } |
199 | 202 | ||
200 | void QTReaderApp::hidetoolbars() | 203 | void QTReaderApp::hidetoolbars() |
201 | { | 204 | { |
202 | if (m_scrollbar != NULL) m_scrollbar->hide(); | 205 | if (m_scrollbar != NULL) m_scrollbar->hide(); |
203 | if (m_prog != NULL) m_prog->hide(); | 206 | if (m_prog != NULL) m_prog->hide(); |
204 | 207 | ||
205 | #ifdef USEQPE | 208 | #if defined(USEQPE) |
206 | menubar->hide(); | 209 | menubar->hide(); |
207 | #endif | 210 | #endif |
208 | 211 | ||
209 | if (m_scrollbar != NULL) m_scrollbar->hide(); | 212 | if (m_scrollbar != NULL) m_scrollbar->hide(); |
210 | 213 | ||
211 | if (fileBar != NULL) fileBar->hide(); | 214 | if (fileBar != NULL) fileBar->hide(); |
212 | if (viewBar != NULL) viewBar->hide(); | 215 | if (viewBar != NULL) viewBar->hide(); |
213 | if (navBar != NULL) navBar->hide(); | 216 | if (navBar != NULL) navBar->hide(); |
214 | if (markBar != NULL) markBar->hide(); | 217 | if (markBar != NULL) markBar->hide(); |
215 | if (m_fontVisible) m_fontBar->hide(); | 218 | if (m_fontVisible) m_fontBar->hide(); |
216 | if (regVisible) | 219 | if (regVisible) |
217 | { | 220 | { |
218 | #ifdef USEQPE | 221 | #ifdef USEQPE |
219 | Global::hideInputMethod(); | 222 | Global::hideInputMethod(); |
220 | #endif | 223 | #endif |
221 | regBar->hide(); | 224 | regBar->hide(); |
222 | } | 225 | } |
223 | if (searchVisible) | 226 | if (searchVisible) |
224 | { | 227 | { |
225 | #ifdef USEQPE | 228 | #ifdef USEQPE |
226 | Global::hideInputMethod(); | 229 | Global::hideInputMethod(); |
227 | #endif | 230 | #endif |
228 | searchBar->hide(); | 231 | searchBar->hide(); |
229 | } | 232 | } |
230 | } | 233 | } |
231 | 234 | ||
232 | QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | 235 | QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) |
233 | : QMainWindow( parent, name, f ), m_dontSave(false), | 236 | : QMainWindow( parent, name, f ), m_dontSave(false), |
234 | fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL), m_scrollbar(NULL), m_localscroll(2), m_hidebars(false), m_kmapchanged(false) | 237 | fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL), m_scrollbar(NULL), m_localscroll(2), m_hidebars(false), m_kmapchanged(false) |
235 | { | 238 | { |
236 | { | 239 | { |
237 | setKeyCompression ( true ); | 240 | setKeyCompression ( true ); |
238 | #ifndef USEQPE | 241 | #ifndef USEQPE |
239 | QDir d = QDir::home(); // "/" | 242 | QDir d = QDir::home(); // "/" |
240 | d.cd(APPDIR); | 243 | d.cd(APPDIR); |
241 | QFileInfo fi(d, ".keymap"); | 244 | QFileInfo fi(d, ".keymap"); |
242 | FILE* f = fopen((const char *)fi.absFilePath(), "r"); | 245 | FILE* f = fopen((const char *)fi.absFilePath(), "r"); |
243 | #else /* USEQPE */ | 246 | #else /* USEQPE */ |
244 | FILE* f = fopen((const char *)Global::applicationFileName(APPDIR,".keymap"), "r"); | 247 | FILE* f = fopen((const char *)Global::applicationFileName(APPDIR,".keymap"), "r"); |
245 | #endif /* USEQPE */ | 248 | #endif /* USEQPE */ |
246 | if (f != NULL) | 249 | if (f != NULL) |
247 | { | 250 | { |
248 | uint cnt; | 251 | uint cnt; |
249 | if ((fread(&cnt, sizeof(cnt), 1, f) != 0) && (cnt == KEYMAPVERSION)) | 252 | if ((fread(&cnt, sizeof(cnt), 1, f) != 0) && (cnt == KEYMAPVERSION)) |
250 | { | 253 | { |
251 | if (fread(&cnt, sizeof(cnt), 1, f) == 0) cnt = 0; | 254 | if (fread(&cnt, sizeof(cnt), 1, f) == 0) cnt = 0; |
252 | for (uint i = 0; i != cnt; i++) | 255 | for (uint i = 0; i != cnt; i++) |
253 | { | 256 | { |
@@ -288,279 +291,289 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
288 | } | 291 | } |
289 | else if (rot.contains("Rot180")) | 292 | else if (rot.contains("Rot180")) |
290 | { | 293 | { |
291 | m_rot = 180; | 294 | m_rot = 180; |
292 | } | 295 | } |
293 | else if (rot.contains("Rot270")) | 296 | else if (rot.contains("Rot270")) |
294 | { | 297 | { |
295 | m_rot = 270; | 298 | m_rot = 270; |
296 | } | 299 | } |
297 | 300 | ||
298 | // qDebug("Initial Rotation(%d):%s", m_rot, (const char*)rot); | 301 | // qDebug("Initial Rotation(%d):%s", m_rot, (const char*)rot); |
299 | */ | 302 | */ |
300 | m_autogenstr = "^ *[A-Z].*[a-z] *$"; | 303 | m_autogenstr = "^ *[A-Z].*[a-z] *$"; |
301 | 304 | ||
302 | #ifdef USEQPE | 305 | #ifdef USEQPE |
303 | setIcon( Resource::loadPixmap( PICDIR "uqtreader") ); | 306 | setIcon( Resource::loadPixmap( PICDIR "uqtreader") ); |
304 | #else | 307 | #else |
305 | setIcon( QPixmap (PICDIR + "/uqtreader.png") ); | 308 | setIcon( QPixmap (PICDIR + "/uqtreader.png") ); |
306 | #endif /* USEQPE */ | 309 | #endif /* USEQPE */ |
307 | 310 | ||
308 | // QPEToolBar *bar = new QPEToolBar( this ); | 311 | // QPEToolBar *bar = new QPEToolBar( this ); |
309 | // menubar = new QPEToolBar( this ); | 312 | // menubar = new QPEToolBar( this ); |
310 | #ifdef USEQPE | 313 | #ifdef USEQPE |
311 | Config config( APPDIR ); | 314 | Config config( APPDIR ); |
312 | #else | 315 | #else |
313 | QDir d = QDir::home(); // "/" | 316 | QDir d = QDir::home(); // "/" |
314 | if ( !d.cd(APPDIR) ) { // "/tmp" | 317 | if ( !d.cd(APPDIR) ) { // "/tmp" |
315 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 318 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); |
316 | d = QDir::home(); | 319 | d = QDir::home(); |
317 | d.mkdir(APPDIR); | 320 | d.mkdir(APPDIR); |
318 | d.cd(APPDIR); | 321 | d.cd(APPDIR); |
319 | } | 322 | } |
320 | QFileInfo fi(d, INIFILE); | 323 | QFileInfo fi(d, INIFILE); |
321 | // qDebug("Path:%s", (const char*)fi.absFilePath()); | 324 | // qDebug("Path:%s", (const char*)fi.absFilePath()); |
322 | Config config(fi.absFilePath()); | 325 | Config config(fi.absFilePath()); |
323 | #endif | 326 | #endif |
324 | config.setGroup("Toolbar"); | 327 | config.setGroup("Toolbar"); |
325 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false); | 328 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false); |
326 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1); | 329 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1); |
327 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2); | 330 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2); |
328 | m_qtscroll = config.readNumEntry("QTScrollBar", false); | 331 | m_qtscroll = config.readNumEntry("QTScrollBar", false); |
329 | m_localscroll = config.readNumEntry("LocalScrollBar", false); | 332 | m_localscroll = config.readNumEntry("LocalScrollBar", false); |
330 | 333 | ||
331 | // fileBar = new QToolBar("File", this); | 334 | // fileBar = new QToolBar("File", this); |
332 | // QToolBar* viewBar = new QToolBar("File", this); | 335 | // QToolBar* viewBar = new QToolBar("File", this); |
333 | // QToolBar* navBar = new QToolBar("File", this); | 336 | // QToolBar* navBar = new QToolBar("File", this); |
334 | // QToolBar* markBar = new QToolBar("File", this); | 337 | // QToolBar* markBar = new QToolBar("File", this); |
335 | 338 | ||
336 | #ifdef USEQPE | 339 | #if defined(USEQPE) |
337 | menubar = new QToolBar("Menus", this, m_tbposition); | 340 | menubar = new QToolBar("Menus", this, m_tbposition); |
338 | mb = new QPEMenuBar( menubar ); | 341 | mb = new QPEMenuBar( menubar ); |
339 | #else | 342 | #else |
340 | mb = new QMenuBar( this ); | 343 | mb = new QMenuBar( this ); |
341 | #endif | 344 | #endif |
342 | 345 | ||
343 | #ifdef USEQPE | 346 | #if defined(USEQPE) |
344 | QPopupMenu* tmp = new QPopupMenu(mb); | 347 | QPopupMenu* tmp = new QPopupMenu(mb); |
345 | mb->insertItem( geticon( "AppsIcon" ), tmp ); | 348 | mb->insertItem( geticon( "AppsIcon" ), tmp ); |
346 | #else | 349 | #else |
347 | QMenuBar* tmp = mb; | 350 | QMenuBar* tmp = mb; |
348 | #endif | 351 | #endif |
349 | 352 | ||
350 | QPopupMenu *file = new QPopupMenu( mb ); | 353 | QPopupMenu *file = new QPopupMenu( mb ); |
351 | tmp->insertItem( tr( "File" ), file ); | 354 | tmp->insertItem( tr( "File" ), file ); |
352 | 355 | ||
353 | QPopupMenu *navigation = new QPopupMenu(mb); | 356 | QPopupMenu *navigation = new QPopupMenu(mb); |
354 | tmp->insertItem( tr( "Navigation" ), navigation ); | 357 | tmp->insertItem( tr( "Navigation" ), navigation ); |
355 | 358 | ||
356 | QPopupMenu *view = new QPopupMenu( mb ); | 359 | QPopupMenu *view = new QPopupMenu( mb ); |
357 | tmp->insertItem( tr( "View" ), view ); | 360 | tmp->insertItem( tr( "View" ), view ); |
358 | 361 | ||
359 | QPopupMenu *marks = new QPopupMenu( this ); | 362 | QPopupMenu *marks = new QPopupMenu( this ); |
360 | tmp->insertItem( tr( "Marks" ), marks ); | 363 | tmp->insertItem( tr( "Marks" ), marks ); |
361 | 364 | ||
362 | QPopupMenu *settings = new QPopupMenu( this ); | 365 | QPopupMenu *settings = new QPopupMenu( this ); |
363 | tmp->insertItem( tr( "Settings" ), settings ); | 366 | tmp->insertItem( tr( "Settings" ), settings ); |
364 | 367 | ||
365 | // addToolBar(menubar, "Menus",QMainWindow::Top); | 368 | // addToolBar(menubar, "Menus",QMainWindow::Top); |
366 | // addToolBar(fileBar, "Toolbar",QMainWindow::Top); | 369 | // addToolBar(fileBar, "Toolbar",QMainWindow::Top); |
367 | 370 | ||
368 | // QPopupMenu *edit = new QPopupMenu( this ); | 371 | // QPopupMenu *edit = new QPopupMenu( this ); |
369 | 372 | ||
370 | /* | 373 | /* |
371 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 374 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
372 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 375 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
373 | a->addTo( bar ); | 376 | a->addTo( bar ); |
374 | a->addTo( file ); | 377 | a->addTo( file ); |
375 | */ | 378 | */ |
376 | QWidget* widge = new QWidget(this); | 379 | QWidget* widge = new QWidget(this); |
377 | setCentralWidget( widge ); | 380 | setCentralWidget( widge ); |
378 | QVBoxLayout* vlayout = new QVBoxLayout(widge); | 381 | QVBoxLayout* vlayout = new QVBoxLayout(widge); |
379 | m_layout = new QBoxLayout(QBoxLayout::LeftToRight); | 382 | m_layout = new QBoxLayout(QBoxLayout::LeftToRight); |
380 | m_prog = new QLabel(widge); | 383 | m_prog = new QLabel(widge); |
381 | vlayout->addLayout(m_layout, 1); | 384 | vlayout->addLayout(m_layout, 1); |
382 | vlayout->addWidget(m_prog); | 385 | vlayout->addWidget(m_prog); |
383 | 386 | ||
384 | editorStack = new QWidgetStack( widge ); | 387 | editorStack = new QWidgetStack( widge ); |
385 | // setCentralWidget( editorStack ); | 388 | // setCentralWidget( editorStack ); |
386 | 389 | ||
387 | searchVisible = FALSE; | 390 | searchVisible = FALSE; |
388 | regVisible = FALSE; | 391 | regVisible = FALSE; |
389 | m_fontVisible = false; | 392 | m_fontVisible = false; |
390 | 393 | ||
391 | m_buttonprefs = new CButtonPrefs(&kmap, this); | 394 | m_buttonprefs = new CButtonPrefs(&kmap, this); |
392 | editorStack->addWidget(m_buttonprefs, get_unique_id()); | 395 | editorStack->addWidget(m_buttonprefs, get_unique_id()); |
393 | connect( m_buttonprefs, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); | 396 | connect( m_buttonprefs, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); |
394 | 397 | ||
395 | 398 | ||
396 | m_annoWin = new CAnnoEdit(editorStack); | 399 | m_annoWin = new CAnnoEdit(editorStack); |
397 | editorStack->addWidget(m_annoWin, get_unique_id()); | 400 | editorStack->addWidget(m_annoWin, get_unique_id()); |
398 | connect( m_annoWin, SIGNAL( finished(const QString&, const QString&) ), this, SLOT( addAnno(const QString&, const QString&) ) ); | 401 | connect( m_annoWin, SIGNAL( finished(const QString&, const QString&) ), this, SLOT( addAnno(const QString&, const QString&) ) ); |
399 | connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) ); | 402 | connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) ); |
400 | 403 | ||
401 | m_infoWin = new infowin(editorStack); | 404 | m_infoWin = new infowin(editorStack); |
402 | editorStack->addWidget(m_infoWin, get_unique_id()); | 405 | editorStack->addWidget(m_infoWin, get_unique_id()); |
403 | connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) ); | 406 | connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) ); |
404 | 407 | ||
405 | m_graphicwin = new GraphicWin(editorStack); | 408 | m_graphicwin = new GraphicWin(editorStack); |
406 | editorStack->addWidget(m_graphicwin, get_unique_id()); | 409 | editorStack->addWidget(m_graphicwin, get_unique_id()); |
407 | connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); | 410 | connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); |
408 | 411 | ||
409 | // bkmkselector = new QListBox(editorStack, "Bookmarks"); | 412 | // bkmkselector = new QListBox(editorStack, "Bookmarks"); |
410 | bkmkselector = new CBkmkSelector(editorStack, "Bookmarks"); | 413 | bkmkselector = new CBkmkSelector(editorStack, "Bookmarks"); |
411 | // connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) ); | 414 | // connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) ); |
412 | connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) ); | 415 | connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) ); |
413 | connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) ); | 416 | connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) ); |
414 | editorStack->addWidget( bkmkselector, get_unique_id() ); | 417 | editorStack->addWidget( bkmkselector, get_unique_id() ); |
415 | 418 | ||
416 | /* | 419 | /* |
417 | importSelector = new FileSelector( "*", editorStack, "importselector", false ); | 420 | importSelector = new FileSelector( "*", editorStack, "importselector", false ); |
418 | connect( importSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( importFile( const DocLnk & ) ) ); | 421 | connect( importSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( importFile( const DocLnk & ) ) ); |
419 | 422 | ||
420 | editorStack->addWidget( importSelector, get_unique_id() ); | 423 | editorStack->addWidget( importSelector, get_unique_id() ); |
421 | 424 | ||
422 | // don't need the close visible, it is redundant... | 425 | // don't need the close visible, it is redundant... |
423 | importSelector->setCloseVisible( FALSE ); | 426 | importSelector->setCloseVisible( FALSE ); |
424 | */ | 427 | */ |
425 | // qDebug("Reading file list"); | 428 | // qDebug("Reading file list"); |
426 | readfilelist(); | 429 | readfilelist(); |
427 | 430 | ||
428 | reader = new QTReader( editorStack ); | 431 | reader = new QTReader( editorStack ); |
429 | 432 | ||
430 | reader->setDoUpdates(false); | 433 | reader->setDoUpdates(false); |
431 | 434 | ||
432 | #ifdef USEQPE | 435 | #ifdef USEQPE |
433 | ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); | 436 | ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); |
434 | #endif | 437 | #endif |
435 | 438 | ||
436 | // qDebug("Reading config"); | 439 | // qDebug("Reading config"); |
437 | // Config config( APPDIR ); | 440 | // Config config( APPDIR ); |
438 | config.setGroup( "View" ); | 441 | config.setGroup( "View" ); |
442 | #if defined(USEQPE) && defined(USENEWFULLSCREEN) | ||
443 | m_usenewfullscreen = config.readBoolEntry("NewFullScreen", false); | ||
444 | #endif | ||
439 | m_debounce = config.readNumEntry("Debounce", 0); | 445 | m_debounce = config.readNumEntry("Debounce", 0); |
440 | m_buttonprefs->Debounce(m_debounce); | 446 | m_buttonprefs->Debounce(m_debounce); |
441 | #ifdef USEQPE | 447 | #ifdef USEQPE |
442 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); | 448 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); |
443 | #else | 449 | #else |
444 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true); | 450 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true); |
445 | #endif | 451 | #endif |
446 | reader->setStripCR(config.readBoolEntry( "StripCr", true )); | 452 | reader->setStripCR(config.readBoolEntry( "StripCr", true )); |
447 | reader->bfulljust = config.readBoolEntry( "FullJust", false ); | 453 | reader->bfulljust = config.readBoolEntry( "FullJust", false ); |
448 | /* | 454 | /* |
449 | bool btmp = config.readBoolEntry("Negative", false); | 455 | bool btmp = config.readBoolEntry("Negative", false); |
450 | if (btmp) reader->setNegative(); | 456 | if (btmp) reader->setNegative(); |
451 | */ | 457 | */ |
452 | reader->bInverse = config.readBoolEntry("Inverse", false); | 458 | reader->bInverse = config.readBoolEntry("Inverse", false); |
453 | reader->m_fontControl.FixGraphics(config.readBoolEntry( "FixGraphics", false )); | 459 | reader->m_fontControl.FixGraphics(config.readBoolEntry( "FixGraphics", false )); |
454 | reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 )); | 460 | reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 )); |
455 | reader->setlead(config.readNumEntry( "ExtraLead", 0 )); | 461 | reader->setlead(config.readNumEntry( "ExtraLead", 0 )); |
456 | reader->btextfmt = config.readBoolEntry( "TextFmt", false ); | 462 | reader->btextfmt = config.readBoolEntry( "TextFmt", false ); |
457 | reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); | 463 | reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); |
458 | reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); | 464 | reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); |
465 | reader->bNoInlineTables = config.readBoolEntry( "NoInlineTables", false ); | ||
459 | reader->bpeanut = config.readBoolEntry( "Peanut", false ); | 466 | reader->bpeanut = config.readBoolEntry( "Peanut", false ); |
460 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); | 467 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); |
461 | reader->bdepluck = config.readBoolEntry( "Depluck", false ); | 468 | reader->bdepluck = config.readBoolEntry( "Depluck", false ); |
462 | reader->bdejpluck = config.readBoolEntry( "Dejpluck", false ); | 469 | reader->bdejpluck = config.readBoolEntry( "Dejpluck", false ); |
463 | reader->bonespace = config.readBoolEntry( "OneSpace", false ); | 470 | reader->bonespace = config.readBoolEntry( "OneSpace", false ); |
464 | reader->bunindent = config.readBoolEntry( "Unindent", false ); | 471 | reader->bunindent = config.readBoolEntry( "Unindent", false ); |
465 | reader->brepara = config.readBoolEntry( "Repara", false ); | 472 | reader->brepara = config.readBoolEntry( "Repara", false ); |
466 | reader->m_reparastring = config.readEntry( "ReparaString", "\\n{[\\n \\t]}"); | 473 | reader->m_reparastring = config.readEntry( "ReparaString", "\\n{[\\n \\t]}"); |
467 | m_bgtype = (bground)config.readNumEntry( "BackgroundType" , 0 ); | 474 | m_bgtype = (bground)config.readNumEntry( "BackgroundType" , 0 ); |
468 | m_themename = config.readEntry("Theme", QString::null ); | 475 | m_themename = config.readEntry("Theme", QString::null ); |
469 | reader->bdblspce = config.readBoolEntry( "DoubleSpace", false ); | 476 | reader->bdblspce = config.readBoolEntry( "DoubleSpace", false ); |
470 | reader->bindenter = config.readNumEntry( "Indent", 0 ); | 477 | reader->bindenter = config.readNumEntry( "Indent", 0 ); |
471 | reader->m_textsize = config.readNumEntry( "FontSize", 12 ); | 478 | reader->m_textsize = config.readNumEntry( "FontSize", 12 ); |
472 | reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); | 479 | reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); |
473 | reader->m_scrollstep = config.readNumEntry( "ScrollStep", 1); | 480 | reader->m_scrollstep = config.readNumEntry( "ScrollStep", 1); |
481 | reader->m_outputName = config.readEntry( "OutputCodec", ""); | ||
482 | |||
474 | 483 | ||
475 | reader->m_lastfile = config.readEntry( "LastFile", QString::null ); | 484 | reader->m_lastfile = config.readEntry( "LastFile", QString::null ); |
476 | reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); | 485 | reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); |
477 | reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); | 486 | reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); |
478 | reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); | 487 | reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); |
479 | reader->m_rotated = config.readBoolEntry( "IsRotated", false ); | 488 | reader->m_rotated = config.readBoolEntry( "IsRotated", false ); |
480 | reader->m_scrolltype = config.readNumEntry( "ScrollType", 0 ); | 489 | reader->m_scrolltype = config.readNumEntry( "ScrollType", 0 ); |
481 | m_statusstring = config.readEntry("StatusContent", "%P%% Doc:%d/%D %p%% %z%%"); | 490 | m_statusstring = config.readEntry("StatusContent", "%P%% Doc:%d/%D %p%% %z%%"); |
482 | m_statusishidden = config.readBoolEntry("StatusHidden", false); | 491 | m_statusishidden = config.readBoolEntry("StatusHidden", false); |
483 | m_background = config.readNumEntry( "Background", 0 ); | 492 | m_background = config.readNumEntry( "Background", 0 ); |
484 | reader->setBackground(getcolour(m_background)); | 493 | reader->setBackground(getcolour(m_background)); |
485 | m_foreground = config.readNumEntry( "Foreground", 1 ); | 494 | m_foreground = config.readNumEntry( "Foreground", 1 ); |
486 | reader->setForeground(getcolour(m_foreground)); | 495 | reader->setForeground(getcolour(m_foreground)); |
487 | m_scrollcolor = config.readNumEntry( "ScrollColour", 5 ); | 496 | m_scrollcolor = config.readNumEntry( "ScrollColour", 5 ); |
488 | setscrollcolour(); | 497 | setscrollcolour(); |
489 | m_scrollbarcolor = config.readNumEntry( "ScrollBarColour", 5 ); | 498 | m_scrollbarcolor = config.readNumEntry( "ScrollBarColour", 5 ); |
490 | setscrollbarcolour(); | 499 | setscrollbarcolour(); |
491 | reader->hyphenate = config.readBoolEntry( "Hyphenate", false ); | 500 | reader->hyphenate = config.readBoolEntry( "Hyphenate", false ); |
492 | reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false); | 501 | reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false); |
493 | reader->m_fontname = config.readEntry( "Fontname", "helvetica" ); | 502 | reader->m_fontname = config.readEntry( "Fontname", "helvetica" ); |
494 | reader->m_encd = config.readNumEntry( "Encoding", 0 ); | 503 | reader->m_encd = config.readNumEntry( "Encoding", 0 ); |
495 | reader->m_charpc = config.readNumEntry( "CharSpacing", 100 ); | 504 | reader->m_charpc = config.readNumEntry( "CharSpacing", 100 ); |
496 | reader->m_overlap = config.readNumEntry( "Overlap", 0 ); | 505 | reader->m_overlap = config.readNumEntry( "Overlap", 0 ); |
497 | reader->m_abstopmargin = config.readNumEntry( "Top Margin", 100 ); | 506 | reader->m_abstopmargin = config.readNumEntry( "Top Margin", 100 ); |
498 | reader->m_absbottommargin = config.readNumEntry( "Bottom Margin", 100 ); | 507 | reader->m_absbottommargin = config.readNumEntry( "Bottom Margin", 100 ); |
499 | reader->m_absleft_border = config.readNumEntry( "Left Margin", 100 ); | 508 | reader->m_absleft_border = config.readNumEntry( "Left Margin", 100 ); |
500 | reader->m_absright_border = config.readNumEntry( "Right Margin", 100 ); | 509 | reader->m_absright_border = config.readNumEntry( "Right Margin", 100 ); |
501 | 510 | ||
502 | m_scrollishidden = config.readBoolEntry( "HideScrollBar", false ); | 511 | m_scrollishidden = config.readBoolEntry( "HideScrollBar", false ); |
512 | m_hidebars = config.readBoolEntry( "HideToolBar", false ); | ||
503 | 513 | ||
504 | reader->brepalm = config.readBoolEntry( "Repalm", false ); | 514 | reader->brepalm = config.readBoolEntry( "Repalm", false ); |
515 | reader->bunderlineLink = config.readBoolEntry( "UnderlineLink", true ); | ||
505 | reader->bkern = config.readBoolEntry( "Kern", false ); | 516 | reader->bkern = config.readBoolEntry( "Kern", false ); |
506 | reader->bremap = config.readBoolEntry( "Remap", true ); | 517 | reader->bremap = config.readBoolEntry( "Remap", true ); |
507 | reader->bmakebold = config.readBoolEntry( "MakeBold", false ); | 518 | reader->bmakebold = config.readBoolEntry( "MakeBold", false ); |
508 | reader->setContinuous(config.readBoolEntry( "Continuous", true )); | 519 | reader->setContinuous(config.readBoolEntry( "Continuous", true )); |
520 | reader->setDoubleBuffer(config.readBoolEntry("DoubleBuffer", true)); | ||
509 | m_targetapp = config.readEntry( "TargetApp", QString::null ); | 521 | m_targetapp = config.readEntry( "TargetApp", QString::null ); |
510 | m_targetmsg = config.readEntry( "TargetMsg", QString::null ); | 522 | m_targetmsg = config.readEntry( "TargetMsg", QString::null ); |
511 | #ifdef _SCROLLPIPE | 523 | #ifdef _SCROLLPIPE |
512 | reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null ); | 524 | reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null ); |
513 | reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true ); | 525 | reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true ); |
514 | #endif | 526 | #endif |
515 | m_twoTouch = config.readBoolEntry( "TwoTouch", false); | 527 | m_twoTouch = config.readBoolEntry( "TwoTouch", false); |
516 | m_doAnnotation = config.readBoolEntry( "Annotation", false); | 528 | m_doAnnotation = config.readBoolEntry( "Annotation", false); |
517 | m_doDictionary = config.readBoolEntry( "Dictionary", false); | 529 | m_doDictionary = config.readBoolEntry( "Dictionary", false); |
518 | m_doClipboard = config.readBoolEntry( "Clipboard", false); | 530 | m_doClipboard = config.readBoolEntry( "Clipboard", false); |
531 | m_doOutput = config.readBoolEntry( "OutputTgt", false); | ||
519 | /* | 532 | /* |
520 | m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); | 533 | m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); |
521 | m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone); | 534 | m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone); |
522 | m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen); | 535 | m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen); |
523 | m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut); | 536 | m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut); |
524 | m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn); | 537 | m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn); |
525 | m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp); | 538 | m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp); |
526 | m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown); | 539 | m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown); |
527 | 540 | ||
528 | m_leftScroll = config.readBoolEntry("LeftScroll", false); | 541 | m_leftScroll = config.readBoolEntry("LeftScroll", false); |
529 | m_rightScroll = config.readBoolEntry("RightScroll", false); | 542 | m_rightScroll = config.readBoolEntry("RightScroll", false); |
530 | m_upScroll = config.readBoolEntry("UpScroll", true); | 543 | m_upScroll = config.readBoolEntry("UpScroll", true); |
531 | m_downScroll = config.readBoolEntry("DownScroll", true); | 544 | m_downScroll = config.readBoolEntry("DownScroll", true); |
532 | */ | 545 | */ |
533 | m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false); | 546 | m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false); |
534 | reader->setBaseSize(config.readNumEntry( "Basesize", 10 )); | 547 | reader->setBaseSize(config.readNumEntry( "Basesize", 10 )); |
535 | reader->setHyphenThreshold(config.readNumEntry( "HyphenThreshold", 50 )); | 548 | reader->setHyphenThreshold(config.readNumEntry( "HyphenThreshold", 50 )); |
536 | // reader->buffdoc.setCustomHyphen(config.readBoolEntry( "CustomHyphen", false )); | 549 | // reader->buffdoc.setCustomHyphen(config.readBoolEntry( "CustomHyphen", false )); |
537 | #ifndef USEQPE | 550 | #ifndef USEQPE |
538 | config.setGroup( "Geometry" ); | 551 | config.setGroup( "Geometry" ); |
539 | setGeometry(0,0, | 552 | setGeometry(0,0, |
540 | config.readNumEntry( "width", QApplication::desktop()->width()/2 ), | 553 | config.readNumEntry( "width", QApplication::desktop()->width()/2 ), |
541 | config.readNumEntry( "height", QApplication::desktop()->height()/2 )); | 554 | config.readNumEntry( "height", QApplication::desktop()->height()/2 )); |
542 | move( | 555 | move( |
543 | config.readNumEntry( "x", 20 ), | 556 | config.readNumEntry( "x", 20 ), |
544 | config.readNumEntry( "y", 20 )); | 557 | config.readNumEntry( "y", 20 )); |
545 | #else | 558 | #else |
546 | m_grabkeyboard = config.readBoolEntry( "GrabKeyboard", false); | 559 | m_grabkeyboard = config.readBoolEntry( "GrabKeyboard", false); |
547 | #endif | 560 | #endif |
548 | 561 | ||
549 | 562 | ||
550 | 563 | ||
551 | setTwoTouch(m_twoTouch); | 564 | setTwoTouch(m_twoTouch); |
552 | 565 | ||
553 | connect( reader, SIGNAL( OnShowPicture(QImage&) ), this, SLOT( showgraphic(QImage&) ) ); | 566 | connect( reader, SIGNAL( OnShowPicture(QImage&) ), this, SLOT( showgraphic(QImage&) ) ); |
554 | 567 | ||
555 | connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) ); | 568 | connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) ); |
556 | connect( reader, SIGNAL( OnWordSelected(const QString&, size_t, size_t, const QString&) ), this, SLOT( OnWordSelected(const QString&, size_t, size_t, const QString&) ) ); | 569 | connect( reader, SIGNAL( OnWordSelected(const QString&, size_t, size_t, const QString&) ), this, SLOT( OnWordSelected(const QString&, size_t, size_t, const QString&) ) ); |
557 | connect( reader, SIGNAL( OnURLSelected(const QString&, const size_t) ), this, SLOT( OnURLSelected(const QString&, const size_t) ) ); | 570 | connect( reader, SIGNAL( OnURLSelected(const QString&, const size_t) ), this, SLOT( OnURLSelected(const QString&, const size_t) ) ); |
558 | connect( reader, SIGNAL( NewFileRequest(const QString&) ), this, SLOT( forceopen(const QString&) ) ); | 571 | connect( reader, SIGNAL( NewFileRequest(const QString&) ), this, SLOT( forceopen(const QString&) ) ); |
559 | connect( reader, SIGNAL( HandleKeyRequest(QKeyEvent*) ), this, SLOT( handlekey(QKeyEvent*) ) ); | 572 | connect( reader, SIGNAL( HandleKeyRequest(QKeyEvent*) ), this, SLOT( handlekey(QKeyEvent*) ) ); |
560 | connect( reader, SIGNAL( SetScrollState(bool) ), this, SLOT( setScrollState(bool) ) ); | 573 | connect( reader, SIGNAL( SetScrollState(bool) ), this, SLOT( setScrollState(bool) ) ); |
561 | connect( reader, SIGNAL(RefreshBitmap()), this, SLOT(setBackgroundBitmap())); | 574 | connect( reader, SIGNAL(RefreshBitmap()), this, SLOT(setBackgroundBitmap())); |
562 | editorStack->addWidget( reader, get_unique_id() ); | 575 | editorStack->addWidget( reader, get_unique_id() ); |
563 | 576 | ||
564 | m_preferences_action = new QAction( tr( "Configuration" ), geticon( "SettingsIcon" ), QString::null, 0, this, NULL); | 577 | m_preferences_action = new QAction( tr( "Configuration" ), geticon( "SettingsIcon" ), QString::null, 0, this, NULL); |
565 | connect( m_preferences_action, SIGNAL( activated() ), this, SLOT( showprefs() ) ); | 578 | connect( m_preferences_action, SIGNAL( activated() ), this, SLOT( showprefs() ) ); |
566 | m_preferences_action->addTo( settings ); | 579 | m_preferences_action->addTo( settings ); |
@@ -797,96 +810,108 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
797 | m_mark_action = new QAction( tr( "Bookmark" ), getmyicon( "bookmark" ), QString::null, 0, this, NULL); | 810 | m_mark_action = new QAction( tr( "Bookmark" ), getmyicon( "bookmark" ), QString::null, 0, this, NULL); |
798 | connect( m_mark_action, SIGNAL( activated() ), this, SLOT( addbkmk() ) ); | 811 | connect( m_mark_action, SIGNAL( activated() ), this, SLOT( addbkmk() ) ); |
799 | m_mark_action->addTo( marks ); | 812 | m_mark_action->addTo( marks ); |
800 | 813 | ||
801 | m_annotate_action = new QAction( tr( "Annotate" ), getmyicon( "annotate" ), QString::null, 0, this, NULL); | 814 | m_annotate_action = new QAction( tr( "Annotate" ), getmyicon( "annotate" ), QString::null, 0, this, NULL); |
802 | connect( m_annotate_action, SIGNAL( activated() ), this, SLOT( addanno() ) ); | 815 | connect( m_annotate_action, SIGNAL( activated() ), this, SLOT( addanno() ) ); |
803 | m_annotate_action->addTo( marks ); | 816 | m_annotate_action->addTo( marks ); |
804 | 817 | ||
805 | m_goto_action = new QAction( tr( "Goto" ), getmyicon( "bookmark_goto" ), QString::null, 0, this, NULL, false ); | 818 | m_goto_action = new QAction( tr( "Goto" ), getmyicon( "bookmark_goto" ), QString::null, 0, this, NULL, false ); |
806 | connect( m_goto_action, SIGNAL( activated() ), this, SLOT( do_gotomark() ) ); | 819 | connect( m_goto_action, SIGNAL( activated() ), this, SLOT( do_gotomark() ) ); |
807 | m_goto_action->addTo( marks ); | 820 | m_goto_action->addTo( marks ); |
808 | 821 | ||
809 | m_delete_action = new QAction( tr( "Delete" ), getmyicon( "bookmark_delete" ), QString::null, 0, this, NULL); | 822 | m_delete_action = new QAction( tr( "Delete" ), getmyicon( "bookmark_delete" ), QString::null, 0, this, NULL); |
810 | connect( m_delete_action, SIGNAL( activated() ), this, SLOT( do_delmark() ) ); | 823 | connect( m_delete_action, SIGNAL( activated() ), this, SLOT( do_delmark() ) ); |
811 | m_delete_action->addTo( marks ); | 824 | m_delete_action->addTo( marks ); |
812 | 825 | ||
813 | m_autogen_action = new QAction( tr( "Autogen" ), geticon( "exec" ), QString::null, 0, this, NULL, false ); | 826 | m_autogen_action = new QAction( tr( "Autogen" ), geticon( "exec" ), QString::null, 0, this, NULL, false ); |
814 | connect( m_autogen_action, SIGNAL( activated() ), this, SLOT( do_autogen() ) ); | 827 | connect( m_autogen_action, SIGNAL( activated() ), this, SLOT( do_autogen() ) ); |
815 | marks->insertSeparator(); | 828 | marks->insertSeparator(); |
816 | m_autogen_action->addTo( marks ); | 829 | m_autogen_action->addTo( marks ); |
817 | 830 | ||
818 | m_clear_action = new QAction( tr( "Clear" ), getmyicon( "bookmark_clear" ), QString::null, 0, this, NULL); | 831 | m_clear_action = new QAction( tr( "Clear" ), getmyicon( "bookmark_clear" ), QString::null, 0, this, NULL); |
819 | connect( m_clear_action, SIGNAL( activated() ), this, SLOT( clearBkmkList() ) ); | 832 | connect( m_clear_action, SIGNAL( activated() ), this, SLOT( clearBkmkList() ) ); |
820 | m_clear_action->addTo( marks ); | 833 | m_clear_action->addTo( marks ); |
821 | 834 | ||
822 | m_save_action = new QAction( tr( "Save" ), getmyicon( "bookmark_save" ), QString::null, 0, this, NULL ); | 835 | m_save_action = new QAction( tr( "Save" ), getmyicon( "bookmark_save" ), QString::null, 0, this, NULL ); |
823 | connect( m_save_action, SIGNAL( activated() ), this, SLOT( savebkmks() ) ); | 836 | connect( m_save_action, SIGNAL( activated() ), this, SLOT( savebkmks() ) ); |
824 | m_save_action->addTo( marks ); | 837 | m_save_action->addTo( marks ); |
825 | 838 | ||
826 | m_tidy_action = new QAction( tr( "Tidy" ), getmyicon( "bookmark_tidy" ), QString::null, 0, this, NULL); | 839 | m_tidy_action = new QAction( tr( "Tidy" ), getmyicon( "bookmark_tidy" ), QString::null, 0, this, NULL); |
827 | connect( m_tidy_action, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) ); | 840 | connect( m_tidy_action, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) ); |
828 | marks->insertSeparator(); | 841 | marks->insertSeparator(); |
829 | m_tidy_action->addTo( marks ); | 842 | m_tidy_action->addTo( marks ); |
830 | 843 | ||
831 | m_startBlock_action = new QAction( tr( "Start Block" ), geticon( "new" ), QString::null, 0, this, NULL); | 844 | m_startBlock_action = new QAction( tr( "Start Block" ), geticon( "new" ), QString::null, 0, this, NULL); |
832 | connect( m_startBlock_action, SIGNAL( activated() ), this, SLOT( editMark() ) ); | 845 | connect( m_startBlock_action, SIGNAL( activated() ), this, SLOT( editMark() ) ); |
833 | marks->insertSeparator(); | 846 | marks->insertSeparator(); |
834 | m_startBlock_action->addTo( marks ); | 847 | m_startBlock_action->addTo( marks ); |
835 | 848 | ||
836 | m_endBlock_action = new QAction( tr( "Copy Block" ), geticon( "copy" ), QString::null, 0, this, NULL); | 849 | m_endBlock_action = new QAction( tr( "Copy Block" ), geticon( "copy" ), QString::null, 0, this, NULL); |
837 | connect( m_endBlock_action, SIGNAL( activated() ), this, SLOT( editCopy() ) ); | 850 | connect( m_endBlock_action, SIGNAL( activated() ), this, SLOT( editCopy() ) ); |
838 | m_endBlock_action->addTo( marks ); | 851 | m_endBlock_action->addTo( marks ); |
839 | 852 | ||
840 | m_bkmkAvail = NULL; | 853 | m_bkmkAvail = NULL; |
841 | 854 | ||
842 | 855 | ||
843 | setToolBarsMovable(m_tbmove); | 856 | setToolBarsMovable(m_tbmove); |
844 | addtoolbars(&config); | 857 | addtoolbars(&config); |
858 | if (m_hidebars) | ||
859 | { | ||
860 | #if defined(USEQPE) | ||
861 | menubar->hide(); | ||
862 | #endif | ||
863 | if (fileBar != NULL) fileBar->hide(); | ||
864 | if (viewBar != NULL) viewBar->hide(); | ||
865 | if (navBar != NULL) navBar->hide(); | ||
866 | if (markBar != NULL) markBar->hide(); | ||
867 | mb->hide(); | ||
868 | } | ||
869 | |||
845 | 870 | ||
846 | pbar = new QProgressBar(this); | 871 | pbar = new QProgressBar(this); |
847 | pbar->hide(); | 872 | pbar->hide(); |
848 | 873 | ||
849 | searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE ); | 874 | searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE ); |
850 | 875 | ||
851 | searchBar->setHorizontalStretchable( TRUE ); | 876 | searchBar->setHorizontalStretchable( TRUE ); |
852 | 877 | ||
853 | connect(searchBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); | 878 | connect(searchBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); |
854 | 879 | ||
855 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 880 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
856 | // QFont f("unifont", 16 /*, QFont::Bold*/); | 881 | // QFont f("unifont", 16 /*, QFont::Bold*/); |
857 | // searchEdit->setFont( f ); | 882 | // searchEdit->setFont( f ); |
858 | searchBar->setStretchableWidget( searchEdit ); | 883 | searchBar->setStretchableWidget( searchEdit ); |
859 | 884 | ||
860 | 885 | ||
861 | #ifdef __ISEARCH | 886 | #ifdef __ISEARCH |
862 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 887 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
863 | this, SLOT( search( const QString& ) ) ); | 888 | this, SLOT( search( const QString& ) ) ); |
864 | #else | 889 | #else |
865 | connect( searchEdit, SIGNAL( returnPressed( ) ), | 890 | connect( searchEdit, SIGNAL( returnPressed( ) ), |
866 | this, SLOT( search( ) ) ); | 891 | this, SLOT( search( ) ) ); |
867 | #endif | 892 | #endif |
868 | QAction*a = new QAction( tr( "Find Next" ), geticon( "next" ), QString::null, 0, this, 0 ); | 893 | QAction*a = new QAction( tr( "Find Next" ), geticon( "next" ), QString::null, 0, this, 0 ); |
869 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); | 894 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); |
870 | a->addTo( searchBar ); | 895 | a->addTo( searchBar ); |
871 | 896 | ||
872 | a = new QAction( tr( "Close Find" ), geticon( "close" ), QString::null, 0, this, 0 ); | 897 | a = new QAction( tr( "Close Find" ), geticon( "close" ), QString::null, 0, this, 0 ); |
873 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 898 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
874 | a->addTo( searchBar ); | 899 | a->addTo( searchBar ); |
875 | 900 | ||
876 | searchBar->hide(); | 901 | searchBar->hide(); |
877 | 902 | ||
878 | regBar = new QFloatBar( "Autogen", this, QMainWindow::Top, TRUE ); | 903 | regBar = new QFloatBar( "Autogen", this, QMainWindow::Top, TRUE ); |
879 | connect(regBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); | 904 | connect(regBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); |
880 | 905 | ||
881 | regBar->setHorizontalStretchable( TRUE ); | 906 | regBar->setHorizontalStretchable( TRUE ); |
882 | 907 | ||
883 | regEdit = new QLineEdit( regBar, "regEdit" ); | 908 | regEdit = new QLineEdit( regBar, "regEdit" ); |
884 | // regEdit->setFont( f ); | 909 | // regEdit->setFont( f ); |
885 | 910 | ||
886 | regBar->setStretchableWidget( regEdit ); | 911 | regBar->setStretchableWidget( regEdit ); |
887 | 912 | ||
888 | connect( regEdit, SIGNAL( returnPressed( ) ), | 913 | connect( regEdit, SIGNAL( returnPressed( ) ), |
889 | this, SLOT( do_regaction() ) ); | 914 | this, SLOT( do_regaction() ) ); |
890 | 915 | ||
891 | a = new QAction( tr( "Do Reg" ), geticon( "enter" ), QString::null, 0, this, 0 ); | 916 | a = new QAction( tr( "Do Reg" ), geticon( "enter" ), QString::null, 0, this, 0 ); |
892 | connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) ); | 917 | connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) ); |
@@ -927,358 +952,359 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
927 | m_fontBar->hide(); | 952 | m_fontBar->hide(); |
928 | m_fontVisible = false; | 953 | m_fontVisible = false; |
929 | #ifdef USEMSGS | 954 | #ifdef USEMSGS |
930 | connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ), | 955 | connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ), |
931 | this, SLOT( msgHandler(const QCString&, const QByteArray&) ) ); | 956 | this, SLOT( msgHandler(const QCString&, const QByteArray&) ) ); |
932 | #endif | 957 | #endif |
933 | // qDebug("Initing"); | 958 | // qDebug("Initing"); |
934 | 959 | ||
935 | m_layout->addWidget(editorStack); | 960 | m_layout->addWidget(editorStack); |
936 | if (m_qtscroll != 0) | 961 | if (m_qtscroll != 0) |
937 | { | 962 | { |
938 | /* | 963 | /* |
939 | m_scrollbar = new QToolBar( "Autogen", this, (m_localscrollbar) ? QMainWindow::Left : QMainWindow::Right, TRUE ); | 964 | m_scrollbar = new QToolBar( "Autogen", this, (m_localscrollbar) ? QMainWindow::Left : QMainWindow::Right, TRUE ); |
940 | 965 | ||
941 | m_scrollbar->setVerticalStretchable( TRUE ); | 966 | m_scrollbar->setVerticalStretchable( TRUE ); |
942 | */ | 967 | */ |
943 | scrollbar = m_scrollbar = new QScrollBar(QScrollBar::Vertical, widge); | 968 | scrollbar = m_scrollbar = new QScrollBar(QScrollBar::Vertical, widge); |
944 | m_layout->addWidget(scrollbar); | 969 | m_layout->addWidget(scrollbar); |
945 | scrollbar->setTracking(false); | 970 | scrollbar->setTracking(false); |
946 | //connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); | 971 | //connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); |
947 | //m_scrollbar->setStretchableWidget( scrollbar ); | 972 | //m_scrollbar->setStretchableWidget( scrollbar ); |
948 | if (m_scrollishidden) | 973 | if (m_scrollishidden) |
949 | { | 974 | { |
950 | m_scrollbar->hide(); | 975 | m_scrollbar->hide(); |
951 | } | 976 | } |
952 | else | 977 | else |
953 | { | 978 | { |
954 | m_scrollbar->show(); | 979 | m_scrollbar->show(); |
955 | } | 980 | } |
956 | 981 | ||
957 | setrotated(reader->m_rotated); | 982 | setrotated(reader->m_rotated); |
958 | } | 983 | } |
959 | else | 984 | else |
960 | { | 985 | { |
961 | m_scrollbar = NULL; | 986 | m_scrollbar = NULL; |
962 | } | 987 | } |
963 | setBackgroundBitmap(); | 988 | setBackgroundBitmap(); |
964 | m_inverse_action->setOn(reader->bInverse); | 989 | m_inverse_action->setOn(reader->bInverse); |
965 | reader->init(); | 990 | reader->init(); |
966 | 991 | ||
967 | // qDebug("Inited"); | 992 | // qDebug("Inited"); |
968 | // m_buttonAction[m_spaceTarget]->setOn(true); | 993 | // m_buttonAction[m_spaceTarget]->setOn(true); |
969 | // qDebug("fonting"); | 994 | // qDebug("fonting"); |
970 | do_setfont(reader->m_fontname); | 995 | do_setfont(reader->m_fontname); |
971 | // qDebug("fonted"); | 996 | // qDebug("fonted"); |
972 | QFont progfont(reader->m_fontname, reader->m_fontControl.getsize(0)); | 997 | QFont progfont(reader->m_fontname, reader->m_fontControl.getsize(0)); |
973 | m_prog->setFont( progfont ); | 998 | m_prog->setFont( progfont ); |
974 | if (m_statusishidden) m_prog->hide(); | 999 | if (m_statusishidden) m_prog->hide(); |
1000 | showEditTools(); | ||
975 | if (!reader->m_lastfile.isEmpty()) | 1001 | if (!reader->m_lastfile.isEmpty()) |
976 | { | 1002 | { |
977 | //qDebug("doclnk"); | 1003 | //qDebug("doclnk"); |
978 | //doc = new DocLnk(reader->m_lastfile); | 1004 | //doc = new DocLnk(reader->m_lastfile); |
979 | //qDebug("doclnk done"); | 1005 | //qDebug("doclnk done"); |
980 | if (pOpenlist != NULL) | 1006 | if (pOpenlist != NULL) |
981 | { | 1007 | { |
982 | 1008 | ||
983 | /* | 1009 | /* |
984 | int ind = 0; | 1010 | int ind = 0; |
985 | Bkmk* p = (*pOpenlist)[ind]; | 1011 | Bkmk* p = (*pOpenlist)[ind]; |
986 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) | 1012 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) |
987 | { | 1013 | { |
988 | p = (*pOpenlist)[++ind]; | 1014 | p = (*pOpenlist)[++ind]; |
989 | } | 1015 | } |
990 | */ | 1016 | */ |
991 | Bkmk* p = NULL; | 1017 | Bkmk* p = NULL; |
992 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) | 1018 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) |
993 | { | 1019 | { |
994 | p = iter.pContent(); | 1020 | p = iter.pContent(); |
995 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) | 1021 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) |
996 | { | 1022 | { |
997 | break; | 1023 | break; |
998 | } | 1024 | } |
999 | // qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name())); | 1025 | // qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name())); |
1000 | p = NULL; | 1026 | p = NULL; |
1001 | } | 1027 | } |
1002 | if (p != NULL) | 1028 | if (p != NULL) |
1003 | { | 1029 | { |
1004 | if (!openfrombkmk(p)) | 1030 | if (!openfrombkmk(p)) |
1005 | { | 1031 | { |
1006 | showEditTools(); | 1032 | showEditTools(); |
1007 | } | 1033 | } |
1008 | } | 1034 | } |
1009 | else | 1035 | else |
1010 | { | 1036 | { |
1011 | openFile( reader->m_lastfile ); | 1037 | openFile( reader->m_lastfile ); |
1012 | } | 1038 | } |
1013 | } | 1039 | } |
1014 | else | 1040 | else |
1015 | { | 1041 | { |
1016 | if (!reader->m_lastfile.isEmpty()) | 1042 | if (!reader->m_lastfile.isEmpty()) |
1017 | { | 1043 | { |
1018 | openFile( reader->m_lastfile ); | 1044 | openFile( reader->m_lastfile ); |
1019 | } | 1045 | } |
1020 | } | 1046 | } |
1021 | } | 1047 | } |
1022 | else | 1048 | else |
1023 | { | 1049 | { |
1024 | showEditTools(); | 1050 | showEditTools(); |
1025 | } | 1051 | } |
1026 | // qApp->processEvents(); | 1052 | // qApp->processEvents(); |
1027 | if (m_scrollbar == NULL || m_scrollbar->isHidden()) | 1053 | if (m_scrollbar == NULL || m_scrollbar->isHidden()) |
1028 | { | 1054 | { |
1029 | reader->m_scrollpos = m_localscroll; | 1055 | reader->m_scrollpos = m_localscroll; |
1030 | } | 1056 | } |
1031 | else | 1057 | else |
1032 | { | 1058 | { |
1033 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; | 1059 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; |
1034 | } | 1060 | } |
1035 | reader->bDoUpdates = true; | 1061 | // reader->bDoUpdates = true; |
1036 | reader->update(); | 1062 | // reader->update(); |
1037 | config.setGroup("Version"); | 1063 | config.setGroup("Version"); |
1038 | int major = config.readNumEntry("Major", 0); | 1064 | int major = config.readNumEntry("Major", 0); |
1039 | int bkmktype = config.readNumEntry("BkmkType", 0); | 1065 | int bkmktype = config.readNumEntry("BkmkType", 0); |
1040 | char minor = config.readNumEntry("Minor", 0); | 1066 | char minor = config.readNumEntry("Minor", 0); |
1041 | if (CheckVersion(major, bkmktype, minor)) | 1067 | if (CheckVersion(major, bkmktype, minor, this)) |
1042 | { | 1068 | { |
1043 | config.writeEntry("Major", major); | 1069 | config.writeEntry("Major", major); |
1044 | config.writeEntry("BkmkType", bkmktype); | 1070 | config.writeEntry("BkmkType", bkmktype); |
1045 | config.writeEntry("Minor", (int)minor); | 1071 | config.writeEntry("Minor", (int)minor); |
1046 | } | 1072 | } |
1047 | // qDebug("finished update"); | 1073 | // qDebug("finished update"); |
1048 | if (kmap.isEmpty()) | 1074 | if (kmap.isEmpty()) |
1049 | { | 1075 | { |
1050 | QMessageBox::warning(this, PROGNAME, "You haven't mapped any keys yet!\n\nYou will be taken to the key\nmapping dialog.\nA few defaults are provided\nbut you can change then to\nsuit yourself.\n\nYou can change the key\nmapping at any time by\nselecting the Settings/Button\noption on the menu."); | 1076 | QMessageBox::warning(this, PROGNAME, "You haven't mapped any keys yet!\n\nYou will be taken to the key\nmapping dialog.\nA few defaults are provided\nbut you can change then to\nsuit yourself.\n\nYou can change the key\nmapping at any time by\nselecting the Settings/Button\noption on the menu."); |
1051 | 1077 | ||
1052 | m_buttonprefs->mapkey(Qt::NoButton, Key_Up, cesPageUp); | 1078 | m_buttonprefs->mapkey(Qt::NoButton, Key_Up, cesPageUp); |
1053 | m_buttonprefs->mapkey(Qt::NoButton, Key_Down, cesPageDown); | 1079 | m_buttonprefs->mapkey(Qt::NoButton, Key_Down, cesPageDown); |
1054 | 1080 | ||
1055 | m_buttonprefs->mapkey(Qt::NoButton, Key_Right, cesZoomIn); | 1081 | m_buttonprefs->mapkey(Qt::NoButton, Key_Right, cesZoomIn); |
1056 | m_buttonprefs->mapkey(Qt::NoButton, Key_Left, cesZoomOut); | 1082 | m_buttonprefs->mapkey(Qt::NoButton, Key_Left, cesZoomOut); |
1057 | 1083 | ||
1058 | showbuttonprefs(); | 1084 | showbuttonprefs(); |
1059 | } | 1085 | } |
1060 | } | 1086 | } |
1061 | 1087 | ||
1062 | void QTReaderApp::addtoolbars(Config* config) | 1088 | void QTReaderApp::addtoolbars(Config* config) |
1063 | { | 1089 | { |
1064 | config->setGroup("Toolbar"); | 1090 | config->setGroup("Toolbar"); |
1065 | 1091 | ||
1066 | if (fileBar != NULL) | 1092 | if (fileBar != NULL) |
1067 | { | 1093 | { |
1068 | #ifdef USEQPE | 1094 | #if defined(USEQPE) |
1069 | if (fileBar != menubar) | 1095 | if (fileBar != menubar) |
1070 | { | 1096 | { |
1071 | fileBar->clear(); | 1097 | fileBar->clear(); |
1072 | } | 1098 | } |
1073 | else | 1099 | else |
1074 | { | 1100 | { |
1075 | m_preferences_action->removeFrom( filebar() ); | 1101 | m_preferences_action->removeFrom( filebar() ); |
1076 | m_open_action->removeFrom( filebar() ); | 1102 | m_open_action->removeFrom( filebar() ); |
1077 | m_close_action->removeFrom( filebar() ); | 1103 | m_close_action->removeFrom( filebar() ); |
1078 | m_info_action->removeFrom( filebar() ); | 1104 | m_info_action->removeFrom( filebar() ); |
1079 | m_touch_action->removeFrom( filebar() ); | 1105 | m_touch_action->removeFrom( filebar() ); |
1080 | m_find_action->removeFrom( filebar() ); | 1106 | m_find_action->removeFrom( filebar() ); |
1081 | } | 1107 | } |
1082 | #else | 1108 | #else |
1083 | fileBar->clear(); | 1109 | fileBar->clear(); |
1084 | #endif | 1110 | #endif |
1085 | } | 1111 | } |
1086 | 1112 | ||
1087 | m_preferences_action->addTo( filebar() ); | 1113 | m_preferences_action->addTo( filebar() ); |
1088 | addfilebar(config, "Open", m_open_action); | 1114 | addfilebar(config, "Open", m_open_action); |
1089 | addfilebar(config, "Close", m_close_action); | 1115 | addfilebar(config, "Close", m_close_action); |
1090 | addfilebar(config, "Info", m_info_action); | 1116 | addfilebar(config, "Info", m_info_action); |
1091 | addfilebar(config, "Two/One Touch", m_touch_action); | 1117 | addfilebar(config, "Two/One Touch", m_touch_action); |
1092 | addfilebar(config, "Find", m_find_action); | 1118 | addfilebar(config, "Find", m_find_action); |
1093 | 1119 | ||
1094 | if (navBar != NULL) | 1120 | if (navBar != NULL) |
1095 | { | 1121 | { |
1096 | #ifdef USEQPE | 1122 | #if defined(USEQPE) |
1097 | if ((navBar == fileBar) && (fileBar == menubar)) | 1123 | if ((navBar == fileBar) && (fileBar == menubar)) |
1098 | #else | 1124 | #else |
1099 | if (navBar == fileBar) | 1125 | if (navBar == fileBar) |
1100 | #endif | 1126 | #endif |
1101 | { | 1127 | { |
1102 | m_scrollButton->removeFrom( navbar() ); | 1128 | m_scrollButton->removeFrom( navbar() ); |
1103 | m_start_action->removeFrom( navbar() ); | 1129 | m_start_action->removeFrom( navbar() ); |
1104 | m_end_action->removeFrom( navbar() ); | 1130 | m_end_action->removeFrom( navbar() ); |
1105 | m_jump_action->removeFrom( navbar() ); | 1131 | m_jump_action->removeFrom( navbar() ); |
1106 | m_pageline_action->removeFrom( navbar() ); | 1132 | m_pageline_action->removeFrom( navbar() ); |
1107 | m_pageup_action->removeFrom( navbar() ); | 1133 | m_pageup_action->removeFrom( navbar() ); |
1108 | m_pagedn_action->removeFrom( navbar() ); | 1134 | m_pagedn_action->removeFrom( navbar() ); |
1109 | m_back_action->removeFrom( navbar() ); | 1135 | m_back_action->removeFrom( navbar() ); |
1110 | m_home_action->removeFrom( navbar() ); | 1136 | m_home_action->removeFrom( navbar() ); |
1111 | m_forward_action->removeFrom( navbar() ); | 1137 | m_forward_action->removeFrom( navbar() ); |
1112 | } | 1138 | } |
1113 | else if (navBar != fileBar) | 1139 | else if (navBar != fileBar) |
1114 | { | 1140 | { |
1115 | navBar->clear(); | 1141 | navBar->clear(); |
1116 | } | 1142 | } |
1117 | } | 1143 | } |
1118 | 1144 | ||
1119 | addnavbar(config, "Scroll", m_scrollButton); | 1145 | addnavbar(config, "Scroll", m_scrollButton); |
1120 | addnavbar(config, "Goto Start", m_start_action); | 1146 | addnavbar(config, "Goto Start", m_start_action); |
1121 | addnavbar(config, "Goto End", m_end_action); | 1147 | addnavbar(config, "Goto End", m_end_action); |
1122 | 1148 | ||
1123 | addnavbar(config, "Jump", m_jump_action); | 1149 | addnavbar(config, "Jump", m_jump_action); |
1124 | addnavbar(config, "Page/Line Scroll", m_pageline_action); | 1150 | addnavbar(config, "Page/Line Scroll", m_pageline_action); |
1125 | 1151 | ||
1126 | addnavbar(config, "Page Up", m_pageup_action); | 1152 | addnavbar(config, "Page Up", m_pageup_action); |
1127 | addnavbar(config, "Page Down", m_pagedn_action); | 1153 | addnavbar(config, "Page Down", m_pagedn_action); |
1128 | 1154 | ||
1129 | addnavbar(config, "Back", m_back_action); | 1155 | addnavbar(config, "Back", m_back_action); |
1130 | addnavbar(config, "Home", m_home_action); | 1156 | addnavbar(config, "Home", m_home_action); |
1131 | addnavbar(config, "Forward", m_forward_action); | 1157 | addnavbar(config, "Forward", m_forward_action); |
1132 | 1158 | ||
1133 | if (viewBar != NULL) | 1159 | if (viewBar != NULL) |
1134 | { | 1160 | { |
1135 | #ifdef USEQPE | 1161 | #if defined(USEQPE) |
1136 | if ((viewBar == fileBar) && (fileBar == menubar)) | 1162 | if ((viewBar == fileBar) && (fileBar == menubar)) |
1137 | #else | 1163 | #else |
1138 | if (viewBar == fileBar) | 1164 | if (viewBar == fileBar) |
1139 | #endif | 1165 | #endif |
1140 | { | 1166 | { |
1141 | m_actFullscreen->removeFrom( filebar() ); | 1167 | m_actFullscreen->removeFrom( filebar() ); |
1142 | m_rotate_action->removeFrom( viewbar() ); | 1168 | m_rotate_action->removeFrom( viewbar() ); |
1143 | m_inverse_action->removeFrom( viewbar() ); | 1169 | m_inverse_action->removeFrom( viewbar() ); |
1144 | m_zoomin_action->removeFrom( viewbar() ); | 1170 | m_zoomin_action->removeFrom( viewbar() ); |
1145 | m_zoomout_action->removeFrom( viewbar() ); | 1171 | m_zoomout_action->removeFrom( viewbar() ); |
1146 | m_setfont_action->removeFrom( viewbar() ); | 1172 | m_setfont_action->removeFrom( viewbar() ); |
1147 | m_setenc_action->removeFrom( viewbar() ); | 1173 | m_setenc_action->removeFrom( viewbar() ); |
1148 | m_setmono_action->removeFrom( viewbar() ); | 1174 | m_setmono_action->removeFrom( viewbar() ); |
1149 | } | 1175 | } |
1150 | else if (viewBar != fileBar) | 1176 | else if (viewBar != fileBar) |
1151 | { | 1177 | { |
1152 | viewBar->clear(); | 1178 | viewBar->clear(); |
1153 | } | 1179 | } |
1154 | } | 1180 | } |
1155 | 1181 | ||
1156 | addviewbar(config, "Fullscreen", m_actFullscreen); | 1182 | addviewbar(config, "Fullscreen", m_actFullscreen); |
1157 | addviewbar(config, "Rotate", m_rotate_action); | 1183 | addviewbar(config, "Rotate", m_rotate_action); |
1158 | addviewbar(config, "Invert Action", m_inverse_action); | 1184 | addviewbar(config, "Invert Action", m_inverse_action); |
1159 | addviewbar(config, "Zoom In", m_zoomin_action); | 1185 | addviewbar(config, "Zoom In", m_zoomin_action); |
1160 | addviewbar(config, "Zoom Out", m_zoomout_action); | 1186 | addviewbar(config, "Zoom Out", m_zoomout_action); |
1161 | addviewbar(config, "Set Font", m_setfont_action); | 1187 | addviewbar(config, "Set Font", m_setfont_action); |
1162 | addviewbar(config, "Encoding Select", m_setenc_action); | 1188 | addviewbar(config, "Encoding Select", m_setenc_action); |
1163 | addviewbar(config, "Ideogram Mode", m_setmono_action); | 1189 | addviewbar(config, "Ideogram Mode", m_setmono_action); |
1164 | 1190 | ||
1165 | if (markBar != NULL) | 1191 | if (markBar != NULL) |
1166 | { | 1192 | { |
1167 | #ifdef USEQPE | 1193 | #if defined(USEQPE) |
1168 | if ((markBar == fileBar) && (fileBar == menubar)) | 1194 | if ((markBar == fileBar) && (fileBar == menubar)) |
1169 | #else | 1195 | #else |
1170 | if (markBar == fileBar) | 1196 | if (markBar == fileBar) |
1171 | #endif | 1197 | #endif |
1172 | { | 1198 | { |
1173 | m_mark_action->removeFrom( markbar() ); | 1199 | m_mark_action->removeFrom( markbar() ); |
1174 | m_annotate_action->removeFrom( markbar()); | 1200 | m_annotate_action->removeFrom( markbar()); |
1175 | m_goto_action->removeFrom( markbar() ); | 1201 | m_goto_action->removeFrom( markbar() ); |
1176 | m_delete_action->removeFrom( markbar() ); | 1202 | m_delete_action->removeFrom( markbar() ); |
1177 | m_autogen_action->removeFrom( markbar() ); | 1203 | m_autogen_action->removeFrom( markbar() ); |
1178 | m_clear_action->removeFrom( markbar() ); | 1204 | m_clear_action->removeFrom( markbar() ); |
1179 | m_save_action->removeFrom( markbar() ); | 1205 | m_save_action->removeFrom( markbar() ); |
1180 | m_tidy_action->removeFrom( markbar() ); | 1206 | m_tidy_action->removeFrom( markbar() ); |
1181 | m_startBlock_action->removeFrom( markbar() ); | 1207 | m_startBlock_action->removeFrom( markbar() ); |
1182 | m_endBlock_action->removeFrom( markbar() ); | 1208 | m_endBlock_action->removeFrom( markbar() ); |
1183 | } | 1209 | } |
1184 | else if (markBar != fileBar) | 1210 | else if (markBar != fileBar) |
1185 | { | 1211 | { |
1186 | markBar->clear(); | 1212 | markBar->clear(); |
1187 | } | 1213 | } |
1188 | } | 1214 | } |
1189 | addmarkbar(config, "Mark", m_mark_action); | 1215 | addmarkbar(config, "Mark", m_mark_action); |
1190 | addmarkbar(config, "Annotate", m_annotate_action); | 1216 | addmarkbar(config, "Annotate", m_annotate_action); |
1191 | addmarkbar(config, "Goto", m_goto_action); | 1217 | addmarkbar(config, "Goto", m_goto_action); |
1192 | addmarkbar(config, "Delete", m_delete_action); | 1218 | addmarkbar(config, "Delete", m_delete_action); |
1193 | addmarkbar(config, "Autogen", m_autogen_action); | 1219 | addmarkbar(config, "Autogen", m_autogen_action); |
1194 | addmarkbar(config, "Clear", m_clear_action); | 1220 | addmarkbar(config, "Clear", m_clear_action); |
1195 | addmarkbar(config, "Save", m_save_action); | 1221 | addmarkbar(config, "Save", m_save_action); |
1196 | addmarkbar(config, "Tidy", m_tidy_action); | 1222 | addmarkbar(config, "Tidy", m_tidy_action); |
1197 | addmarkbar(config, "Start Block", m_startBlock_action); | 1223 | addmarkbar(config, "Start Block", m_startBlock_action); |
1198 | addmarkbar(config, "Copy Block", m_endBlock_action); | 1224 | addmarkbar(config, "Copy Block", m_endBlock_action); |
1199 | if (checkbar(config, "Annotation indicator")) | 1225 | if (checkbar(config, "Annotation indicator")) |
1200 | { | 1226 | { |
1201 | if (m_bkmkAvail == NULL) | 1227 | if (m_bkmkAvail == NULL) |
1202 | { | 1228 | { |
1203 | m_bkmkAvail = new QAction( tr( "Annotation" ), geticon( "find" ), QString::null, 0, this, 0 ); | 1229 | m_bkmkAvail = new QAction( tr( "Annotation" ), geticon( "find" ), QString::null, 0, this, 0 ); |
1204 | connect( m_bkmkAvail, SIGNAL( activated() ), this, SLOT( showAnnotation() ) ); | 1230 | connect( m_bkmkAvail, SIGNAL( activated() ), this, SLOT( showAnnotation() ) ); |
1205 | 1231 | ||
1206 | m_bkmkAvail->setEnabled(false); | 1232 | m_bkmkAvail->setEnabled(false); |
1207 | } | 1233 | } |
1208 | QLabel *spacer = new QLabel(markBar, ""); | 1234 | QLabel *spacer = new QLabel(markBar, ""); |
1209 | markbar()->setStretchableWidget(spacer); | 1235 | markbar()->setStretchableWidget(spacer); |
1210 | m_bkmkAvail->removeFrom( markbar() ); | 1236 | m_bkmkAvail->removeFrom( markbar() ); |
1211 | m_bkmkAvail->addTo( markbar() ); | 1237 | m_bkmkAvail->addTo( markbar() ); |
1212 | } | 1238 | } |
1213 | else | 1239 | else |
1214 | { | 1240 | { |
1215 | if (m_bkmkAvail != NULL) | 1241 | if (m_bkmkAvail != NULL) |
1216 | { | 1242 | { |
1217 | m_bkmkAvail->removeFrom( markbar() ); | 1243 | m_bkmkAvail->removeFrom( markbar() ); |
1218 | delete m_bkmkAvail; | 1244 | delete m_bkmkAvail; |
1219 | m_bkmkAvail = NULL; | 1245 | m_bkmkAvail = NULL; |
1220 | } | 1246 | } |
1221 | } | 1247 | } |
1222 | } | 1248 | } |
1223 | 1249 | ||
1224 | bool QTReaderApp::checkbar(Config* _config, const QString& key) | 1250 | bool QTReaderApp::checkbar(Config* _config, const QString& key) |
1225 | { | 1251 | { |
1226 | return _config->readBoolEntry(key, false); | 1252 | return _config->readBoolEntry(key, false); |
1227 | } | 1253 | } |
1228 | 1254 | ||
1229 | 1255 | ||
1230 | QToolBar* QTReaderApp::filebar() | 1256 | QToolBar* QTReaderApp::filebar() |
1231 | { | 1257 | { |
1232 | if (fileBar == NULL) | 1258 | if (fileBar == NULL) |
1233 | { | 1259 | { |
1234 | switch (m_tbpol) | 1260 | switch (m_tbpol) |
1235 | { | 1261 | { |
1236 | #ifdef USEQPE | 1262 | #if defined(USEQPE) |
1237 | case cesSingle: | 1263 | case cesSingle: |
1238 | // qDebug("Setting filebar to menubar"); | 1264 | // qDebug("Setting filebar to menubar"); |
1239 | fileBar = menubar; | 1265 | fileBar = menubar; |
1240 | break; | 1266 | break; |
1241 | #endif | 1267 | #endif |
1242 | default: | 1268 | default: |
1243 | qDebug("Incorrect toolbar policy set"); | 1269 | qDebug("Incorrect toolbar policy set"); |
1244 | case cesMenuTool: | 1270 | case cesMenuTool: |
1245 | case cesMultiple: | 1271 | case cesMultiple: |
1246 | // qDebug("Creating new file bar"); | 1272 | // qDebug("Creating new file bar"); |
1247 | fileBar = new QToolBar("File", this, m_tbposition); | 1273 | fileBar = new QToolBar("File", this, m_tbposition); |
1248 | break; | 1274 | break; |
1249 | } | 1275 | } |
1250 | //fileBar->setHorizontalStretchable( true ); | 1276 | //fileBar->setHorizontalStretchable( true ); |
1251 | } | 1277 | } |
1252 | return fileBar; | 1278 | return fileBar; |
1253 | } | 1279 | } |
1254 | QToolBar* QTReaderApp::viewbar() | 1280 | QToolBar* QTReaderApp::viewbar() |
1255 | { | 1281 | { |
1256 | if (viewBar == NULL) | 1282 | if (viewBar == NULL) |
1257 | { | 1283 | { |
1258 | switch (m_tbpol) | 1284 | switch (m_tbpol) |
1259 | { | 1285 | { |
1260 | case cesMultiple: | 1286 | case cesMultiple: |
1261 | viewBar = new QToolBar("View", this, m_tbposition); | 1287 | viewBar = new QToolBar("View", this, m_tbposition); |
1262 | break; | 1288 | break; |
1263 | default: | 1289 | default: |
1264 | qDebug("Incorrect toolbar policy set"); | 1290 | qDebug("Incorrect toolbar policy set"); |
1265 | #ifdef USEQPE | 1291 | #ifdef USEQPE |
1266 | case cesSingle: | 1292 | case cesSingle: |
1267 | #endif | 1293 | #endif |
1268 | case cesMenuTool: | 1294 | case cesMenuTool: |
1269 | viewBar = fileBar; | 1295 | viewBar = fileBar; |
1270 | break; | 1296 | break; |
1271 | } | 1297 | } |
1272 | } | 1298 | } |
1273 | return viewBar; | 1299 | return viewBar; |
1274 | } | 1300 | } |
1275 | QToolBar* QTReaderApp::navbar() | 1301 | QToolBar* QTReaderApp::navbar() |
1276 | { | 1302 | { |
1277 | if (navBar == NULL) | 1303 | if (navBar == NULL) |
1278 | { | 1304 | { |
1279 | switch (m_tbpol) | 1305 | switch (m_tbpol) |
1280 | { | 1306 | { |
1281 | case cesMultiple: | 1307 | case cesMultiple: |
1282 | // qDebug("Creating new nav bar"); | 1308 | // qDebug("Creating new nav bar"); |
1283 | navBar = new QToolBar("Navigation", this, m_tbposition); | 1309 | navBar = new QToolBar("Navigation", this, m_tbposition); |
1284 | break; | 1310 | break; |
@@ -1672,115 +1698,113 @@ void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data) | |||
1672 | stream >> info; | 1698 | stream >> info; |
1673 | do_autogen(info); | 1699 | do_autogen(info); |
1674 | } | 1700 | } |
1675 | else if ( msg == "File/StartBlock()" ) | 1701 | else if ( msg == "File/StartBlock()" ) |
1676 | { | 1702 | { |
1677 | editMark(); | 1703 | editMark(); |
1678 | } | 1704 | } |
1679 | else if ( msg == "File/CopyBlock()" ) | 1705 | else if ( msg == "File/CopyBlock()" ) |
1680 | { | 1706 | { |
1681 | editCopy(); | 1707 | editCopy(); |
1682 | } | 1708 | } |
1683 | */ | 1709 | */ |
1684 | #endif | 1710 | #endif |
1685 | } | 1711 | } |
1686 | 1712 | ||
1687 | ActionTypes QTReaderApp::ActNameToInt(const QString& _enc) | 1713 | ActionTypes QTReaderApp::ActNameToInt(const QString& _enc) |
1688 | { | 1714 | { |
1689 | for (int i = 0; i < MAX_ACTIONS; i++) | 1715 | for (int i = 0; i < MAX_ACTIONS; i++) |
1690 | { | 1716 | { |
1691 | if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i; | 1717 | if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i; |
1692 | } | 1718 | } |
1693 | return cesAutoScroll; | 1719 | return cesAutoScroll; |
1694 | } | 1720 | } |
1695 | 1721 | ||
1696 | void QTReaderApp::setinverted(bool sfs) | 1722 | void QTReaderApp::setinverted(bool sfs) |
1697 | { | 1723 | { |
1698 | reader->setInverse(sfs); | 1724 | reader->setInverse(sfs); |
1699 | reader->setfilter(reader->getfilter()); | 1725 | reader->setfilter(reader->getfilter()); |
1700 | reader->refresh(); | 1726 | reader->refresh(); |
1701 | } | 1727 | } |
1702 | 1728 | ||
1703 | void QTReaderApp::setrotated(bool sfs) | 1729 | void QTReaderApp::setrotated(bool sfs) |
1704 | { | 1730 | { |
1705 | reader->setrotated(sfs); | 1731 | reader->setrotated(sfs); |
1706 | if (sfs) | 1732 | if (sfs) |
1707 | { | 1733 | { |
1708 | m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::BottomToTop : QBoxLayout::TopToBottom ); | 1734 | m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::BottomToTop : QBoxLayout::TopToBottom ); |
1709 | if (m_scrollbar != NULL) | 1735 | if (m_scrollbar != NULL) |
1710 | { | 1736 | { |
1711 | scrollbar->disconnect(); | 1737 | scrollbar->disconnect(); |
1712 | m_scrollbar->setOrientation(Qt::Horizontal); | 1738 | m_scrollbar->setOrientation(Qt::Horizontal); |
1713 | connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineUp()) ); | 1739 | connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineUp()) ); |
1714 | connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineDown()) ); | 1740 | connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineDown()) ); |
1715 | connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopageup()) ); | 1741 | connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopageup()) ); |
1716 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopagedn()) ); | 1742 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopagedn()) ); |
1717 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); | 1743 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); |
1718 | } | 1744 | } |
1719 | //reader->repaint(0, reader->m_left_border, reader->width(), reader->height()-2*reader->m_border); | 1745 | //reader->repaint(0, reader->m_left_border, reader->width(), reader->height()-2*reader->m_border); |
1720 | reader->repaint(); | ||
1721 | } | 1746 | } |
1722 | else | 1747 | else |
1723 | { | 1748 | { |
1724 | m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::RightToLeft : QBoxLayout::LeftToRight ); | 1749 | m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::RightToLeft : QBoxLayout::LeftToRight ); |
1725 | if (m_scrollbar != NULL) | 1750 | if (m_scrollbar != NULL) |
1726 | { | 1751 | { |
1727 | scrollbar->disconnect(); | 1752 | scrollbar->disconnect(); |
1728 | m_scrollbar->setOrientation(Qt::Vertical); | 1753 | m_scrollbar->setOrientation(Qt::Vertical); |
1729 | connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineDown()) ); | 1754 | connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineDown()) ); |
1730 | connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineUp()) ); | 1755 | connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineUp()) ); |
1731 | connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopagedn()) ); | 1756 | connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopagedn()) ); |
1732 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopageup()) ); | 1757 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopageup()) ); |
1733 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); | 1758 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); |
1734 | } | 1759 | } |
1735 | //reader->repaint(reader->m_border, 0, reader->width()-2*reader->m_border, reader->height()); | 1760 | //reader->repaint(reader->m_border, 0, reader->width()-2*reader->m_border, reader->height()); |
1736 | reader->repaint(); | ||
1737 | } | 1761 | } |
1738 | // reader->update(); | 1762 | reader->refresh(); |
1739 | } | 1763 | } |
1740 | 1764 | ||
1741 | void QTReaderApp::setgrab(bool sfs) | 1765 | void QTReaderApp::setgrab(bool sfs) |
1742 | { | 1766 | { |
1743 | #ifdef USEQPE | 1767 | #ifdef USEQPE |
1744 | m_grabkeyboard = sfs; | 1768 | m_grabkeyboard = sfs; |
1745 | if (m_grabkeyboard) | 1769 | if (m_grabkeyboard) |
1746 | { | 1770 | { |
1747 | ((QPEApplication*)qApp)->grabKeyboard(); | 1771 | ((QPEApplication*)qApp)->grabKeyboard(); |
1748 | } | 1772 | } |
1749 | else | 1773 | else |
1750 | { | 1774 | { |
1751 | ((QPEApplication*)qApp)->ungrabKeyboard(); | 1775 | ((QPEApplication*)qApp)->ungrabKeyboard(); |
1752 | } | 1776 | } |
1753 | #endif | 1777 | #endif |
1754 | } | 1778 | } |
1755 | 1779 | ||
1756 | void QTReaderApp::setfullscreen(bool sfs) | 1780 | void QTReaderApp::setfullscreen(bool sfs) |
1757 | { | 1781 | { |
1758 | reader->bDoUpdates = false; | 1782 | reader->bDoUpdates = false; |
1759 | m_fullscreen = sfs; | 1783 | m_fullscreen = sfs; |
1760 | showEditTools(); | 1784 | showEditTools(); |
1761 | // qApp->processEvents(); | 1785 | // qApp->processEvents(); |
1762 | reader->bDoUpdates = true; | 1786 | reader->bDoUpdates = true; |
1763 | reader->update(); | 1787 | reader->update(); |
1764 | } | 1788 | } |
1765 | /* | 1789 | /* |
1766 | void QTReaderApp::buttonActionSelected(QAction* _a) | 1790 | void QTReaderApp::buttonActionSelected(QAction* _a) |
1767 | { | 1791 | { |
1768 | //// qDebug("es:%x : %s (%u)", _a, (const char *)(_a->text()), ActNameToInt(_a->text())); | 1792 | //// qDebug("es:%x : %s (%u)", _a, (const char *)(_a->text()), ActNameToInt(_a->text())); |
1769 | m_spaceTarget = ActNameToInt(_a->text()); | 1793 | m_spaceTarget = ActNameToInt(_a->text()); |
1770 | } | 1794 | } |
1771 | */ | 1795 | */ |
1772 | QTReaderApp::~QTReaderApp() | 1796 | QTReaderApp::~QTReaderApp() |
1773 | { | 1797 | { |
1774 | } | 1798 | } |
1775 | 1799 | ||
1776 | void QTReaderApp::autoScroll(bool _b) | 1800 | void QTReaderApp::autoScroll(bool _b) |
1777 | { | 1801 | { |
1778 | reader->setautoscroll(_b); | 1802 | reader->setautoscroll(_b); |
1779 | setScrollState(reader->m_autoScroll); | 1803 | setScrollState(reader->m_autoScroll); |
1780 | } | 1804 | } |
1781 | 1805 | ||
1782 | void QTReaderApp::zoomin() | 1806 | void QTReaderApp::zoomin() |
1783 | { | 1807 | { |
1784 | reader->zoomin(); | 1808 | reader->zoomin(); |
1785 | QFont f(reader->m_fontname, reader->m_fontControl.getsize(0)); | 1809 | QFont f(reader->m_fontname, reader->m_fontControl.getsize(0)); |
1786 | m_prog->setFont( f ); | 1810 | m_prog->setFont( f ); |
@@ -1883,351 +1907,371 @@ void QTReaderApp::updatefileinfo() | |||
1883 | CFiledata fd(fnstat.st_mtime, fl); | 1907 | CFiledata fd(fnstat.st_mtime, fl); |
1884 | unsigned short dlen; | 1908 | unsigned short dlen; |
1885 | unsigned char* data; | 1909 | unsigned char* data; |
1886 | reader->setSaveData(data, dlen, fd.content(), fd.length()); | 1910 | reader->setSaveData(data, dlen, fd.content(), fd.length()); |
1887 | pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate())); | 1911 | pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate())); |
1888 | //qDebug("Filedata(2):%u, %u", fd.length(), dlen); | 1912 | //qDebug("Filedata(2):%u, %u", fd.length(), dlen); |
1889 | delete [] data; | 1913 | delete [] data; |
1890 | } | 1914 | } |
1891 | delete [] nm; | 1915 | delete [] nm; |
1892 | delete [] fl; | 1916 | delete [] fl; |
1893 | } | 1917 | } |
1894 | 1918 | ||
1895 | void QTReaderApp::fileOpen() | 1919 | void QTReaderApp::fileOpen() |
1896 | { | 1920 | { |
1897 | /* | 1921 | /* |
1898 | menu->hide(); | 1922 | menu->hide(); |
1899 | fileBar->hide(); | 1923 | fileBar->hide(); |
1900 | if (regVisible) regBar->hide(); | 1924 | if (regVisible) regBar->hide(); |
1901 | if (searchVisible) searchBar->hide(); | 1925 | if (searchVisible) searchBar->hide(); |
1902 | */ | 1926 | */ |
1903 | // qDebug("fileOpen"); | 1927 | // qDebug("fileOpen"); |
1904 | // if (!reader->m_lastfile.isEmpty()) | 1928 | // if (!reader->m_lastfile.isEmpty()) |
1905 | updatefileinfo(); | 1929 | updatefileinfo(); |
1906 | fileOpen2(); | 1930 | fileOpen2(); |
1907 | } | 1931 | } |
1908 | 1932 | ||
1909 | void QTReaderApp::fileOpen2() | 1933 | void QTReaderApp::fileOpen2() |
1910 | { | 1934 | { |
1911 | if (pBkmklist != NULL) | 1935 | if (pBkmklist != NULL) |
1912 | { | 1936 | { |
1913 | if (m_fBkmksChanged) | 1937 | if (m_fBkmksChanged) |
1914 | { | 1938 | { |
1915 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) | 1939 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) |
1916 | savebkmks(); | 1940 | savebkmks(); |
1917 | } | 1941 | } |
1918 | delete pBkmklist; | 1942 | delete pBkmklist; |
1919 | reader->pBkmklist = pBkmklist = NULL; | 1943 | reader->pBkmklist = pBkmklist = NULL; |
1920 | m_fBkmksChanged = false; | 1944 | m_fBkmksChanged = false; |
1921 | } | 1945 | } |
1922 | reader->disableAutoscroll(); | 1946 | reader->disableAutoscroll(); |
1923 | /* | 1947 | /* |
1924 | editorStack->raiseWidget( fileSelector ); | 1948 | editorStack->raiseWidget( fileSelector ); |
1925 | fileSelector->reread(); | 1949 | fileSelector->reread(); |
1926 | */ | 1950 | */ |
1927 | bool usebrowser = true; | 1951 | bool usebrowser = true; |
1928 | if (pOpenlist != NULL) | 1952 | if (pOpenlist != NULL) |
1929 | { | 1953 | { |
1930 | m_nBkmkAction = cOpenFile; | 1954 | m_nBkmkAction = cOpenFile; |
1931 | if (listbkmk(pOpenlist, "Browse")) usebrowser = false; | 1955 | if (listbkmk(pOpenlist, "Browse", true)) usebrowser = false; |
1932 | } | 1956 | } |
1933 | if (usebrowser) | 1957 | if (usebrowser) |
1934 | { | 1958 | { |
1935 | QString fn = usefilebrowser(); | 1959 | QString fn = usefilebrowser(); |
1936 | //qApp->processEvents(); | 1960 | //qApp->processEvents(); |
1937 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) | 1961 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) |
1938 | { | 1962 | { |
1939 | openFile(fn); | 1963 | openFile(fn); |
1940 | } | 1964 | } |
1941 | reader->setFocus(); | 1965 | reader->setFocus(); |
1942 | } | 1966 | } |
1943 | // reader->refresh(); | 1967 | // reader->refresh(); |
1944 | // qDebug("HEIGHT:%d", reader->m_lastheight); | 1968 | // qDebug("HEIGHT:%d", reader->m_lastheight); |
1945 | } | 1969 | } |
1946 | 1970 | ||
1947 | QString QTReaderApp::usefilebrowser() | 1971 | QString QTReaderApp::usefilebrowser() |
1948 | { | 1972 | { |
1949 | #ifndef USEQPE | 1973 | #ifndef USEQPE |
1950 | QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) ); | 1974 | QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) ); |
1951 | return s; | 1975 | return s; |
1952 | #else | 1976 | #else |
1953 | QString fn; | 1977 | QString fn; |
1954 | #ifdef OPIE | 1978 | #if defined(OPIE) && defined(OPIEFILEDIALOG) |
1955 | QMap<QString, QStringList> mimeTypes; | 1979 | QMap<QString, QStringList> mimeTypes; |
1956 | QStringList etypes; | 1980 | QStringList etypes; |
1957 | etypes << "etext/*"; | 1981 | etypes << "etext/*"; |
1958 | mimeTypes.insert( tr("eText"), etypes ); | 1982 | mimeTypes.insert( tr("eText"), etypes ); |
1959 | QStringList types; | 1983 | QStringList types; |
1960 | types << "text/*"; | 1984 | types << "text/*"; |
1961 | mimeTypes.insert( tr("Text"), types ); | 1985 | mimeTypes.insert( tr("Text"), types ); |
1962 | mimeTypes.insert( tr("All"), "*/*" ); | 1986 | mimeTypes.insert( tr("All"), "*/*" ); |
1963 | fn = OFileDialog::getOpenFileName(OFileSelector::EXTENDED_ALL, QFileInfo(reader->m_lastfile).dirPath(true), QString::null, mimeTypes, 0, "OpieReader"); | 1987 | fn = OFileDialog::getOpenFileName(OFileSelector::EXTENDED_ALL, QFileInfo(reader->m_lastfile).dirPath(true), QString::null, mimeTypes, 0, "OpieReader"); |
1964 | #else | 1988 | #else |
1965 | fileBrowser* fb = new fileBrowser(false, this,"OpieReader",!m_bFloatingDialog, | 1989 | fileBrowser* fb = new fileBrowser(false, this,"OpieReader",!m_bFloatingDialog, |
1966 | 0, | 1990 | 0, |
1967 | // WStyle_Customize | WStyle_NoBorderEx, | 1991 | // WStyle_Customize | WStyle_NoBorderEx, |
1968 | "*", QFileInfo(reader->m_lastfile).dirPath(true)); | 1992 | "*", QFileInfo(reader->m_lastfile).dirPath(true)); |
1969 | 1993 | ||
1970 | 1994 | ||
1971 | if (fb->exec()) | 1995 | if (fb->exec()) |
1972 | { | 1996 | { |
1973 | fn = fb->getCurrentFile(); | 1997 | fn = fb->getCurrentFile(); |
1974 | } | 1998 | } |
1975 | // qDebug("Selected %s", (const char*)fn); | 1999 | // qDebug("Selected %s", (const char*)fn); |
1976 | delete fb; | 2000 | delete fb; |
1977 | #endif | 2001 | #endif |
1978 | showEditTools(); | 2002 | showEditTools(); |
1979 | return fn; | 2003 | return fn; |
1980 | #endif | 2004 | #endif |
1981 | } | 2005 | } |
1982 | 2006 | ||
1983 | void QTReaderApp::showgraphic(QImage& pm) | 2007 | void QTReaderApp::showgraphic(QImage& pm) |
1984 | { | 2008 | { |
1985 | m_graphicwin->setImage(pm); | 2009 | m_graphicwin->setImage(pm); |
1986 | editorStack->raiseWidget( m_graphicwin ); | 2010 | editorStack->raiseWidget( m_graphicwin ); |
1987 | hidetoolbars(); | 2011 | hidetoolbars(); |
1988 | m_graphicwin->setFocus(); | 2012 | m_graphicwin->setFocus(); |
1989 | } | 2013 | } |
1990 | 2014 | ||
1991 | void QTReaderApp::showbuttonprefs() | 2015 | void QTReaderApp::showbuttonprefs() |
1992 | { | 2016 | { |
1993 | editorStack->raiseWidget( m_buttonprefs ); | 2017 | editorStack->raiseWidget( m_buttonprefs ); |
1994 | hidetoolbars(); | 2018 | hidetoolbars(); |
1995 | m_buttonprefs->setFocus(); | 2019 | m_buttonprefs->setFocus(); |
1996 | m_kmapchanged = true; | 2020 | m_kmapchanged = true; |
1997 | } | 2021 | } |
1998 | 2022 | ||
1999 | void QTReaderApp::showprefs() | 2023 | void QTReaderApp::showprefs() |
2000 | { | 2024 | { |
2001 | CPrefs* prefwin = new CPrefs(reader->width(), !m_bFloatingDialog, this); | 2025 | CPrefs* prefwin = new CPrefs(reader->width(), !m_bFloatingDialog, this); |
2002 | 2026 | ||
2003 | // prefwin->Debounce(m_debounce); | 2027 | // prefwin->Debounce(m_debounce); |
2004 | prefwin->bgtype(m_bgtype); | 2028 | prefwin->bgtype(m_bgtype); |
2005 | prefwin->repalm(reader->brepalm); | 2029 | prefwin->repalm(reader->brepalm); |
2030 | prefwin->UnderlineLink(reader->bunderlineLink); | ||
2006 | prefwin->kern(reader->bkern); | 2031 | prefwin->kern(reader->bkern); |
2007 | prefwin->hyphenate(reader->hyphenate); | 2032 | prefwin->hyphenate(reader->hyphenate); |
2008 | // prefwin->customhyphen(reader->buffdoc.getCustomHyphen()); | 2033 | // prefwin->customhyphen(reader->buffdoc.getCustomHyphen()); |
2009 | prefwin->scrolltype(reader->m_scrolltype); | 2034 | prefwin->scrolltype(reader->m_scrolltype); |
2010 | prefwin->scrollstep(reader->m_scrollstep); | 2035 | prefwin->scrollstep(reader->m_scrollstep); |
2011 | prefwin->scrollcolor(m_scrollcolor); | 2036 | prefwin->scrollcolor(m_scrollcolor); |
2012 | prefwin->minibarcol(m_scrollbarcolor); | 2037 | prefwin->minibarcol(m_scrollbarcolor); |
2013 | prefwin->foreground(m_foreground); | 2038 | prefwin->foreground(m_foreground); |
2014 | prefwin->background(m_background); | 2039 | prefwin->background(m_background); |
2015 | prefwin->twotouch(m_twoTouch); | 2040 | prefwin->twotouch(m_twoTouch); |
2016 | prefwin->propfontchange(m_propogatefontchange); | 2041 | prefwin->propfontchange(m_propogatefontchange); |
2017 | prefwin->StripCR(reader->bstripcr); | 2042 | prefwin->StripCR(reader->bstripcr); |
2043 | prefwin->InlineTables(!reader->bNoInlineTables); | ||
2018 | prefwin->Dehyphen(reader->bdehyphen); | 2044 | prefwin->Dehyphen(reader->bdehyphen); |
2019 | prefwin->SingleSpace(reader->bonespace); | 2045 | prefwin->SingleSpace(reader->bonespace); |
2020 | prefwin->Unindent(reader->bunindent); | 2046 | prefwin->Unindent(reader->bunindent); |
2021 | prefwin->Reparagraph(reader->brepara); | 2047 | prefwin->Reparagraph(reader->brepara); |
2022 | prefwin->DoubleSpace(reader->bdblspce); | 2048 | prefwin->DoubleSpace(reader->bdblspce); |
2023 | prefwin->Remap(reader->bremap); | 2049 | prefwin->Remap(reader->bremap); |
2024 | prefwin->Embolden(reader->bmakebold); | 2050 | prefwin->Embolden(reader->bmakebold); |
2025 | prefwin->FullJustify(reader->bfulljust); | 2051 | prefwin->FullJustify(reader->bfulljust); |
2026 | // prefwin->Inverse(reader->bInverse); | 2052 | // prefwin->Inverse(reader->bInverse); |
2027 | // prefwin->Negative(reader->bNegative); | 2053 | // prefwin->Negative(reader->bNegative); |
2028 | prefwin->FixGraphics(reader->m_fontControl.FixGraphics()); | 2054 | prefwin->FixGraphics(reader->m_fontControl.FixGraphics()); |
2029 | prefwin->ParaLead(reader->getextraspace()); | 2055 | prefwin->ParaLead(reader->getextraspace()); |
2030 | prefwin->LineLead(reader->getlead()); | 2056 | prefwin->LineLead(reader->getlead()); |
2031 | prefwin->TopMargin(reader->m_abstopmargin); | 2057 | prefwin->TopMargin(reader->m_abstopmargin); |
2032 | prefwin->BottomMargin(reader->m_absbottommargin); | 2058 | prefwin->BottomMargin(reader->m_absbottommargin); |
2033 | prefwin->LeftMargin(reader->m_absleft_border); | 2059 | prefwin->LeftMargin(reader->m_absleft_border); |
2034 | prefwin->RightMargin(reader->m_absright_border); | 2060 | prefwin->RightMargin(reader->m_absright_border); |
2035 | prefwin->Indent(reader->bindenter); | 2061 | prefwin->Indent(reader->bindenter); |
2036 | if (reader->bautofmt) | 2062 | if (reader->bautofmt) |
2037 | { | 2063 | { |
2038 | prefwin->Markup(0); | 2064 | prefwin->Markup(0); |
2039 | } | 2065 | } |
2040 | else if (reader->btextfmt) | 2066 | else if (reader->btextfmt) |
2041 | { | 2067 | { |
2042 | prefwin->Markup(2); | 2068 | prefwin->Markup(2); |
2043 | } | 2069 | } |
2044 | else if (reader->bstriphtml) | 2070 | else if (reader->bstriphtml) |
2045 | { | 2071 | { |
2046 | prefwin->Markup(3); | 2072 | prefwin->Markup(3); |
2047 | } | 2073 | } |
2048 | else if (reader->bpeanut) | 2074 | else if (reader->bpeanut) |
2049 | { | 2075 | { |
2050 | prefwin->Markup(4); | 2076 | prefwin->Markup(4); |
2051 | } | 2077 | } |
2052 | else | 2078 | else |
2053 | { | 2079 | { |
2054 | prefwin->Markup(1); | 2080 | prefwin->Markup(1); |
2055 | } | 2081 | } |
2056 | prefwin->Depluck(reader->bdepluck); | 2082 | prefwin->Depluck(reader->bdepluck); |
2057 | prefwin->Dejpluck(reader->bdejpluck); | 2083 | prefwin->Dejpluck(reader->bdejpluck); |
2058 | prefwin->Continuous(reader->m_continuousDocument); | 2084 | prefwin->Continuous(reader->m_continuousDocument); |
2085 | prefwin->DoubleBuffer(reader->m_doubleBuffered); | ||
2059 | 2086 | ||
2060 | prefwin->dictApplication(m_targetapp); | 2087 | prefwin->dictApplication(m_targetapp); |
2061 | prefwin->dictMessage(m_targetmsg); | 2088 | prefwin->dictMessage(m_targetmsg); |
2062 | 2089 | ||
2063 | /* | 2090 | /* |
2064 | prefwin->leftScroll(m_leftScroll); | 2091 | prefwin->leftScroll(m_leftScroll); |
2065 | prefwin->rightScroll(m_rightScroll); | 2092 | prefwin->rightScroll(m_rightScroll); |
2066 | prefwin->upScroll(m_upScroll); | 2093 | prefwin->upScroll(m_upScroll); |
2067 | prefwin->downScroll(m_downScroll); | 2094 | prefwin->downScroll(m_downScroll); |
2068 | */ | 2095 | */ |
2069 | 2096 | ||
2070 | prefwin->miscannotation(m_doAnnotation); | 2097 | prefwin->miscannotation(m_doAnnotation); |
2071 | prefwin->miscdictionary(m_doDictionary); | 2098 | prefwin->miscdictionary(m_doDictionary); |
2072 | prefwin->miscclipboard(m_doClipboard); | 2099 | prefwin->miscclipboard(m_doClipboard); |
2100 | prefwin->miscoutput(m_doOutput); | ||
2073 | 2101 | ||
2074 | prefwin->SwapMouse(reader->m_swapmouse); | 2102 | prefwin->SwapMouse(reader->m_swapmouse); |
2075 | 2103 | ||
2076 | prefwin->Font(reader->m_fontname); | 2104 | prefwin->Font(reader->m_fontname); |
2077 | 2105 | ||
2078 | prefwin->gfxsize(reader->getBaseSize()); | 2106 | prefwin->gfxsize(reader->getBaseSize()); |
2079 | 2107 | ||
2080 | prefwin->pageoverlap(reader->m_overlap); | 2108 | prefwin->pageoverlap(reader->m_overlap); |
2081 | 2109 | ||
2082 | prefwin->ideogram(reader->m_bMonoSpaced); | 2110 | prefwin->ideogram(reader->m_bMonoSpaced); |
2083 | 2111 | ||
2084 | prefwin->encoding(reader->m_encd); | 2112 | prefwin->encoding(reader->m_encd); |
2085 | 2113 | ||
2086 | prefwin->ideogramwidth(reader->m_charpc); | 2114 | prefwin->ideogramwidth(reader->m_charpc); |
2087 | 2115 | ||
2116 | prefwin->outcodec(reader->m_outputName); | ||
2117 | |||
2088 | if (prefwin->exec()) | 2118 | if (prefwin->exec()) |
2089 | { | 2119 | { |
2090 | // m_debounce = prefwin->Debounce(); | 2120 | // m_debounce = prefwin->Debounce(); |
2091 | reader->brepalm = prefwin->repalm(); | 2121 | reader->brepalm = prefwin->repalm(); |
2122 | reader->bunderlineLink = prefwin->UnderlineLink(); | ||
2123 | |||
2092 | reader->bkern = prefwin->kern(); | 2124 | reader->bkern = prefwin->kern(); |
2093 | reader->hyphenate = prefwin->hyphenate(); | 2125 | reader->hyphenate = prefwin->hyphenate(); |
2094 | // reader->buffdoc.setCustomHyphen(prefwin->customhyphen()); | 2126 | // reader->buffdoc.setCustomHyphen(prefwin->customhyphen()); |
2095 | reader->m_scrolltype = prefwin->scrolltype(); | 2127 | reader->m_scrolltype = prefwin->scrolltype(); |
2096 | reader->m_scrollstep = prefwin->scrollstep(); | 2128 | reader->m_scrollstep = prefwin->scrollstep(); |
2097 | m_scrollcolor = prefwin->scrollcolor(); | 2129 | m_scrollcolor = prefwin->scrollcolor(); |
2098 | setscrollcolour(); | 2130 | setscrollcolour(); |
2099 | m_scrollbarcolor = prefwin->minibarcol(); | 2131 | m_scrollbarcolor = prefwin->minibarcol(); |
2100 | setscrollbarcolour(); | 2132 | setscrollbarcolour(); |
2101 | m_foreground = prefwin->foreground(); | 2133 | m_foreground = prefwin->foreground(); |
2102 | reader->setForeground(getcolour(m_foreground)); | 2134 | reader->setForeground(getcolour(m_foreground)); |
2103 | m_background = prefwin->background(); | 2135 | m_background = prefwin->background(); |
2104 | reader->setBackground(getcolour(m_background)); | 2136 | reader->setBackground(getcolour(m_background)); |
2105 | m_twoTouch = prefwin->twotouch(); | 2137 | m_twoTouch = prefwin->twotouch(); |
2106 | reader->setTwoTouch(m_twoTouch); | 2138 | reader->setTwoTouch(m_twoTouch); |
2107 | m_touch_action->setOn(m_twoTouch); | 2139 | m_touch_action->setOn(m_twoTouch); |
2108 | 2140 | ||
2109 | reader->bstripcr = prefwin->StripCR(); | 2141 | reader->bstripcr = prefwin->StripCR(); |
2142 | reader->bNoInlineTables = !prefwin->InlineTables(); | ||
2110 | reader->bdehyphen = prefwin->Dehyphen(); | 2143 | reader->bdehyphen = prefwin->Dehyphen(); |
2111 | reader->bonespace = prefwin->SingleSpace(); | 2144 | reader->bonespace = prefwin->SingleSpace(); |
2112 | reader->bunindent = prefwin->Unindent(); | 2145 | reader->bunindent = prefwin->Unindent(); |
2113 | reader->brepara = prefwin->Reparagraph(); | 2146 | reader->brepara = prefwin->Reparagraph(); |
2114 | reader->bdblspce = prefwin->DoubleSpace(); | 2147 | reader->bdblspce = prefwin->DoubleSpace(); |
2115 | reader->bremap = prefwin->Remap(); | 2148 | reader->bremap = prefwin->Remap(); |
2116 | reader->bmakebold = prefwin->Embolden(); | 2149 | reader->bmakebold = prefwin->Embolden(); |
2117 | reader->bfulljust = prefwin->FullJustify(); | 2150 | reader->bfulljust = prefwin->FullJustify(); |
2118 | //if (reader->bInverse != prefwin->Inverse()) reader->setInverse(prefwin->Inverse()); | 2151 | //if (reader->bInverse != prefwin->Inverse()) reader->setInverse(prefwin->Inverse()); |
2119 | //if (reader->bNegative != prefwin->Negative()) reader->setNegative(); | 2152 | //if (reader->bNegative != prefwin->Negative()) reader->setNegative(); |
2120 | reader->m_fontControl.FixGraphics(prefwin->FixGraphics()); | 2153 | reader->m_fontControl.FixGraphics(prefwin->FixGraphics()); |
2121 | 2154 | ||
2122 | reader->setextraspace(prefwin->ParaLead()); | 2155 | reader->setextraspace(prefwin->ParaLead()); |
2123 | reader->setlead(prefwin->LineLead()); | 2156 | reader->setlead(prefwin->LineLead()); |
2124 | reader->m_abstopmargin = prefwin->TopMargin(); | 2157 | reader->m_abstopmargin = prefwin->TopMargin(); |
2125 | reader->m_absbottommargin = prefwin->BottomMargin(); | 2158 | reader->m_absbottommargin = prefwin->BottomMargin(); |
2126 | reader->m_absleft_border = prefwin->LeftMargin(); | 2159 | reader->m_absleft_border = prefwin->LeftMargin(); |
2127 | reader->m_absright_border = prefwin->RightMargin(); | 2160 | reader->m_absright_border = prefwin->RightMargin(); |
2128 | reader->bindenter = prefwin->Indent(); | 2161 | reader->bindenter = prefwin->Indent(); |
2129 | reader->bautofmt = reader->btextfmt = reader->bstriphtml = reader->bpeanut = false; | 2162 | reader->bautofmt = reader->btextfmt = reader->bstriphtml = reader->bpeanut = false; |
2130 | switch (prefwin->Markup()) | 2163 | switch (prefwin->Markup()) |
2131 | { | 2164 | { |
2132 | case 0: | 2165 | case 0: |
2133 | reader->bautofmt = true; | 2166 | reader->bautofmt = true; |
2134 | break; | 2167 | break; |
2135 | case 1: | 2168 | case 1: |
2136 | break; | 2169 | break; |
2137 | case 2: | 2170 | case 2: |
2138 | reader->btextfmt = true; | 2171 | reader->btextfmt = true; |
2139 | break; | 2172 | break; |
2140 | case 3: | 2173 | case 3: |
2141 | reader->bstriphtml = true; | 2174 | reader->bstriphtml = true; |
2142 | break; | 2175 | break; |
2143 | case 4: | 2176 | case 4: |
2144 | reader->bpeanut = true; | 2177 | reader->bpeanut = true; |
2145 | break; | 2178 | break; |
2146 | default: | 2179 | default: |
2147 | qDebug("Format out of range"); | 2180 | qDebug("Format out of range"); |
2148 | } | 2181 | } |
2149 | reader->bdepluck = prefwin->Depluck(); | 2182 | reader->bdepluck = prefwin->Depluck(); |
2150 | reader->bdejpluck = prefwin->Dejpluck(); | 2183 | reader->bdejpluck = prefwin->Dejpluck(); |
2151 | reader->setContinuous(prefwin->Continuous()); | 2184 | reader->setContinuous(prefwin->Continuous()); |
2185 | reader->setDoubleBuffer(prefwin->DoubleBuffer()); | ||
2152 | 2186 | ||
2153 | /* | 2187 | /* |
2154 | m_leftScroll = prefwin->leftScroll(); | 2188 | m_leftScroll = prefwin->leftScroll(); |
2155 | m_rightScroll = prefwin->rightScroll(); | 2189 | m_rightScroll = prefwin->rightScroll(); |
2156 | m_upScroll = prefwin->upScroll(); | 2190 | m_upScroll = prefwin->upScroll(); |
2157 | m_downScroll = prefwin->downScroll(); | 2191 | m_downScroll = prefwin->downScroll(); |
2158 | */ | 2192 | */ |
2159 | m_targetapp = prefwin->dictApplication(); | 2193 | m_targetapp = prefwin->dictApplication(); |
2160 | m_targetmsg = prefwin->dictMessage(); | 2194 | m_targetmsg = prefwin->dictMessage(); |
2161 | 2195 | ||
2162 | m_doAnnotation = prefwin->miscannotation(); | 2196 | m_doAnnotation = prefwin->miscannotation(); |
2163 | m_doDictionary = prefwin->miscdictionary(); | 2197 | m_doDictionary = prefwin->miscdictionary(); |
2164 | m_doClipboard = prefwin->miscclipboard(); | 2198 | m_doClipboard = prefwin->miscclipboard(); |
2199 | m_doOutput = prefwin->miscoutput(); | ||
2165 | reader->m_swapmouse = prefwin->SwapMouse(); | 2200 | reader->m_swapmouse = prefwin->SwapMouse(); |
2166 | reader->setBaseSize(prefwin->gfxsize()); | 2201 | reader->setBaseSize(prefwin->gfxsize()); |
2167 | reader->m_overlap = prefwin->pageoverlap(); | 2202 | reader->m_overlap = prefwin->pageoverlap(); |
2168 | reader->m_bMonoSpaced = prefwin->ideogram(); | 2203 | reader->m_bMonoSpaced = prefwin->ideogram(); |
2169 | m_setmono_action->setOn(reader->m_bMonoSpaced); | 2204 | m_setmono_action->setOn(reader->m_bMonoSpaced); |
2170 | reader->m_encd = prefwin->encoding(); | 2205 | reader->m_encd = prefwin->encoding(); |
2171 | reader->m_charpc = prefwin->ideogramwidth(); | 2206 | reader->m_charpc = prefwin->ideogramwidth(); |
2172 | 2207 | ||
2173 | if ( | 2208 | if ( |
2174 | reader->m_fontname != prefwin->Font() | 2209 | reader->m_fontname != prefwin->Font() |
2175 | || | 2210 | || |
2176 | m_propogatefontchange != prefwin->propfontchange()) | 2211 | m_propogatefontchange != prefwin->propfontchange()) |
2177 | { | 2212 | { |
2178 | m_propogatefontchange = prefwin->propfontchange(); | 2213 | m_propogatefontchange = prefwin->propfontchange(); |
2179 | setfontHelper(prefwin->Font()); | 2214 | setfontHelper(prefwin->Font()); |
2180 | } | 2215 | } |
2181 | if (m_bgtype != (bground)prefwin->bgtype()) | 2216 | if (m_bgtype != (bground)prefwin->bgtype()) |
2182 | { | 2217 | { |
2183 | m_bgtype = (bground)prefwin->bgtype(); | 2218 | m_bgtype = (bground)prefwin->bgtype(); |
2184 | setBackgroundBitmap(); | 2219 | setBackgroundBitmap(); |
2185 | } | 2220 | } |
2221 | qDebug("OutCodec:%s", (const char*)prefwin->outcodec()); | ||
2222 | if (reader->m_outputName != prefwin->outcodec()) | ||
2223 | { | ||
2224 | if (reader->m_output != NULL) | ||
2225 | { | ||
2226 | QMessageBox::warning(this, PROGNAME, "Change of output codec\nrequires a restart"); | ||
2227 | } | ||
2228 | reader->m_outputName = prefwin->outcodec(); | ||
2229 | } | ||
2186 | delete prefwin; | 2230 | delete prefwin; |
2187 | reader->setfilter(reader->getfilter()); | 2231 | reader->setfilter(reader->getfilter()); |
2188 | reader->refresh(); | 2232 | reader->refresh(); |
2189 | } | 2233 | } |
2190 | else | 2234 | else |
2191 | { | 2235 | { |
2192 | delete prefwin; | 2236 | delete prefwin; |
2193 | } | 2237 | } |
2194 | } | 2238 | } |
2195 | 2239 | ||
2196 | void QTReaderApp::showtoolbarprefs() | 2240 | void QTReaderApp::showtoolbarprefs() |
2197 | { | 2241 | { |
2198 | #ifdef USEQPE | 2242 | #ifdef USEQPE |
2199 | CBarPrefs* prefwin = new CBarPrefs(APPDIR, !m_bFloatingDialog, this); | 2243 | CBarPrefs* prefwin = new CBarPrefs(APPDIR, !m_bFloatingDialog, this); |
2200 | #else | 2244 | #else |
2201 | QFileInfo fi; | 2245 | QFileInfo fi; |
2202 | QDir d = QDir::home(); // "/" | 2246 | QDir d = QDir::home(); // "/" |
2203 | if ( !d.cd(APPDIR) ) | 2247 | if ( !d.cd(APPDIR) ) |
2204 | { // "/tmp" | 2248 | { // "/tmp" |
2205 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); | 2249 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); |
2206 | d = QDir::home(); | 2250 | d = QDir::home(); |
2207 | d.mkdir(APPDIR); | 2251 | d.mkdir(APPDIR); |
2208 | d.cd(APPDIR); | 2252 | d.cd(APPDIR); |
2209 | } | 2253 | } |
2210 | fi.setFile(d, INIFILE); | 2254 | fi.setFile(d, INIFILE); |
2211 | CBarPrefs* prefwin = new CBarPrefs(fi.absFilePath(), !m_bFloatingDialog, this); | 2255 | CBarPrefs* prefwin = new CBarPrefs(fi.absFilePath(), !m_bFloatingDialog, this); |
2212 | #endif | 2256 | #endif |
2213 | prefwin->tbpolicy(m_tbpolsave); | 2257 | prefwin->tbpolicy(m_tbpolsave); |
2214 | prefwin->tbposition(m_tbposition-2); | 2258 | prefwin->tbposition(m_tbposition-2); |
2215 | prefwin->tbmovable(m_tbmovesave); | 2259 | prefwin->tbmovable(m_tbmovesave); |
2216 | prefwin->floating(m_bFloatingDialog); | 2260 | prefwin->floating(m_bFloatingDialog); |
2217 | prefwin->qtscroll(m_qtscroll); | 2261 | prefwin->qtscroll(m_qtscroll); |
2218 | prefwin->localscroll(m_localscroll); | 2262 | prefwin->localscroll(m_localscroll); |
2219 | if (prefwin->exec()) | 2263 | if (prefwin->exec()) |
2220 | { | 2264 | { |
2221 | m_bFloatingDialog = prefwin->floating(); | 2265 | m_bFloatingDialog = prefwin->floating(); |
2222 | if ( | 2266 | if ( |
2223 | m_tbpolsave != (ToolbarPolicy)prefwin->tbpolicy() | 2267 | m_tbpolsave != (ToolbarPolicy)prefwin->tbpolicy() |
2224 | || | 2268 | || |
2225 | m_tbposition != (ToolBarDock)(prefwin->tbposition()+2) | 2269 | m_tbposition != (ToolBarDock)(prefwin->tbposition()+2) |
2226 | || | 2270 | || |
2227 | m_tbmovesave != prefwin->tbmovable() | 2271 | m_tbmovesave != prefwin->tbmovable() |
2228 | || | 2272 | || |
2229 | m_qtscroll != prefwin->qtscroll() | 2273 | m_qtscroll != prefwin->qtscroll() |
2230 | // || | 2274 | // || |
2231 | // m_localscrollbar != prefwin->scrollonleft() | 2275 | // m_localscrollbar != prefwin->scrollonleft() |
2232 | ) | 2276 | ) |
2233 | { | 2277 | { |
@@ -2245,102 +2289,126 @@ void QTReaderApp::showtoolbarprefs() | |||
2245 | if (m_scrollbar == NULL || m_scrollbar->isHidden()) | 2289 | if (m_scrollbar == NULL || m_scrollbar->isHidden()) |
2246 | { | 2290 | { |
2247 | reader->m_scrollpos = m_localscroll; | 2291 | reader->m_scrollpos = m_localscroll; |
2248 | } | 2292 | } |
2249 | else | 2293 | else |
2250 | { | 2294 | { |
2251 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; | 2295 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; |
2252 | } | 2296 | } |
2253 | bool isChanged = prefwin->isChanged(); | 2297 | bool isChanged = prefwin->isChanged(); |
2254 | delete prefwin; | 2298 | delete prefwin; |
2255 | #ifdef USEQPE | 2299 | #ifdef USEQPE |
2256 | Config config( APPDIR ); | 2300 | Config config( APPDIR ); |
2257 | #else | 2301 | #else |
2258 | QFileInfo fi; | 2302 | QFileInfo fi; |
2259 | QDir d = QDir::home(); // "/" | 2303 | QDir d = QDir::home(); // "/" |
2260 | if ( !d.cd(APPDIR) ) | 2304 | if ( !d.cd(APPDIR) ) |
2261 | { // "/tmp" | 2305 | { // "/tmp" |
2262 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); | 2306 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); |
2263 | d = QDir::home(); | 2307 | d = QDir::home(); |
2264 | d.mkdir(APPDIR); | 2308 | d.mkdir(APPDIR); |
2265 | d.cd(APPDIR); | 2309 | d.cd(APPDIR); |
2266 | } | 2310 | } |
2267 | fi.setFile(d, INIFILE); | 2311 | fi.setFile(d, INIFILE); |
2268 | Config config( fi.absFilePath() ); | 2312 | Config config( fi.absFilePath() ); |
2269 | #endif | 2313 | #endif |
2270 | if (isChanged) addtoolbars(&config); | 2314 | if (isChanged) addtoolbars(&config); |
2271 | } | 2315 | } |
2272 | else | 2316 | else |
2273 | { | 2317 | { |
2274 | delete prefwin; | 2318 | delete prefwin; |
2275 | } | 2319 | } |
2276 | } | 2320 | } |
2277 | 2321 | ||
2278 | void QTReaderApp::showinfo() | 2322 | void QTReaderApp::showinfo() |
2279 | { | 2323 | { |
2280 | unsigned long ds, fs, ts, pl, dl; | 2324 | unsigned long ds, fs, ts, pl, dl; |
2281 | if (reader->empty()) | 2325 | if (reader->empty()) |
2282 | { | 2326 | { |
2283 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); | 2327 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); |
2284 | } | 2328 | } |
2285 | else | 2329 | else |
2286 | { | 2330 | { |
2287 | reader->sizes(fs,ts); | 2331 | reader->sizes(fs,ts); |
2288 | ds = reader->buffdoc.endSection() - reader->buffdoc.startSection(); | 2332 | ds = reader->buffdoc.endSection() - reader->buffdoc.startSection(); |
2289 | pl = reader->pagelocate(); | 2333 | pl = reader->pagelocate(); |
2290 | dl = pl - reader->buffdoc.startSection(); | 2334 | dl = pl - reader->buffdoc.startSection(); |
2291 | m_infoWin->setFileSize(fs); | 2335 | m_infoWin->setFileSize(fs); |
2292 | m_infoWin->setTextSize(ts); | 2336 | m_infoWin->setTextSize(ts); |
2293 | m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); | 2337 | if (fs > UINT_MAX/100) |
2338 | { | ||
2339 | unsigned long t1 = (ts+50)/100; | ||
2340 | m_infoWin->setRatio(100-(fs + (t1 >> 1))/t1); | ||
2341 | } | ||
2342 | else | ||
2343 | { | ||
2344 | m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); | ||
2345 | } | ||
2294 | m_infoWin->setLocation(pl); | 2346 | m_infoWin->setLocation(pl); |
2295 | m_infoWin->setRead((100*pl + (ts >> 1))/ts); | 2347 | if (pl > UINT_MAX/100) |
2348 | { | ||
2349 | unsigned long t1 = (ts+50)/100; | ||
2350 | m_infoWin->setRead((pl + (t1 >> 1))/t1); | ||
2351 | } | ||
2352 | else | ||
2353 | { | ||
2354 | m_infoWin->setRead((100*pl + (ts >> 1))/ts); | ||
2355 | } | ||
2296 | m_infoWin->setDocSize(ds); | 2356 | m_infoWin->setDocSize(ds); |
2297 | m_infoWin->setDocLocation(dl); | 2357 | m_infoWin->setDocLocation(dl); |
2298 | m_infoWin->setDocRead((100*dl + (ds >> 1))/ds); | 2358 | if (dl > UINT_MAX/100) |
2359 | { | ||
2360 | unsigned long d1 = (ds+50)/100; | ||
2361 | m_infoWin->setDocRead((dl + (d1 >> 1))/d1); | ||
2362 | } | ||
2363 | else | ||
2364 | { | ||
2365 | m_infoWin->setDocRead((100*dl + (ds >> 1))/ds); | ||
2366 | } | ||
2299 | m_infoWin->setZoom(reader->m_fontControl.currentsize()*10); | 2367 | m_infoWin->setZoom(reader->m_fontControl.currentsize()*10); |
2300 | m_infoWin->setAbout(QString("\nApplication (c) Tim Wentford\n")+reader->about()); | 2368 | m_infoWin->setAbout(QString("\nApplication (c) Tim Wentford\n")+reader->about()); |
2301 | editorStack->raiseWidget( m_infoWin ); | 2369 | editorStack->raiseWidget( m_infoWin ); |
2302 | hidetoolbars(); | 2370 | hidetoolbars(); |
2303 | m_infoWin->setFocus(); | 2371 | m_infoWin->setFocus(); |
2304 | } | 2372 | } |
2305 | } | 2373 | } |
2306 | 2374 | ||
2307 | void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn, size_t posn2) | 2375 | void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn, size_t posn2) |
2308 | { | 2376 | { |
2309 | if (pBkmklist == NULL) reader->pBkmklist = pBkmklist = new CList<Bkmk>; | 2377 | if (pBkmklist == NULL) reader->pBkmklist = pBkmklist = new CList<Bkmk>; |
2310 | #ifdef _UNICODE | 2378 | #ifdef _UNICODE |
2311 | CBuffer buff(name.length()+1); | 2379 | CBuffer buff(name.length()+1); |
2312 | int i; | 2380 | int i; |
2313 | for (i = 0; i < name.length(); i++) | 2381 | for (i = 0; i < name.length(); i++) |
2314 | { | 2382 | { |
2315 | buff[i] = name[i].unicode(); | 2383 | buff[i] = name[i].unicode(); |
2316 | } | 2384 | } |
2317 | buff[i] = 0; | 2385 | buff[i] = 0; |
2318 | CBuffer buff2(text.length()+1); | 2386 | CBuffer buff2(text.length()+1); |
2319 | for (i = 0; i < text.length(); i++) | 2387 | for (i = 0; i < text.length(); i++) |
2320 | { | 2388 | { |
2321 | buff2[i] = text[i].unicode(); | 2389 | buff2[i] = text[i].unicode(); |
2322 | } | 2390 | } |
2323 | buff2[i] = 0; | 2391 | buff2[i] = 0; |
2324 | Bkmk b(buff.data(), buff2.data(), posn, posn2); | 2392 | Bkmk b(buff.data(), buff2.data(), posn, posn2); |
2325 | QColor c = m_annoWin->getColor(); | 2393 | QColor c = m_annoWin->getColor(); |
2326 | int red,green,blue; | 2394 | int red,green,blue; |
2327 | c.rgb(&red, &green, &blue); | 2395 | c.rgb(&red, &green, &blue); |
2328 | b.red(red); | 2396 | b.red(red); |
2329 | b.green(green); | 2397 | b.green(green); |
2330 | b.blue(blue); | 2398 | b.blue(blue); |
2331 | pBkmklist->push_front(b); | 2399 | pBkmklist->push_front(b); |
2332 | #else | 2400 | #else |
2333 | pBkmklist->push_front(Bkmk((const tchar*)text,posn)); | 2401 | pBkmklist->push_front(Bkmk((const tchar*)text,posn)); |
2334 | #endif | 2402 | #endif |
2335 | m_fBkmksChanged = true; | 2403 | m_fBkmksChanged = true; |
2336 | pBkmklist->sort(); | 2404 | pBkmklist->sort(); |
2337 | } | 2405 | } |
2338 | 2406 | ||
2339 | void QTReaderApp::addAnno(const QString& name, const QString& text) | 2407 | void QTReaderApp::addAnno(const QString& name, const QString& text) |
2340 | { | 2408 | { |
2341 | if (m_annoIsEditing) | 2409 | if (m_annoIsEditing) |
2342 | { | 2410 | { |
2343 | if (name.isEmpty()) | 2411 | if (name.isEmpty()) |
2344 | { | 2412 | { |
2345 | QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nPlease try again", 1); | 2413 | QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nPlease try again", 1); |
2346 | } | 2414 | } |
@@ -2697,372 +2765,369 @@ bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg) | |||
2697 | else | 2765 | else |
2698 | pos = start; | 2766 | pos = start; |
2699 | ret = false; | 2767 | ret = false; |
2700 | findClose(); | 2768 | findClose(); |
2701 | } | 2769 | } |
2702 | return ret; | 2770 | return ret; |
2703 | } | 2771 | } |
2704 | 2772 | ||
2705 | #ifdef __ISEARCH | 2773 | #ifdef __ISEARCH |
2706 | void QTReaderApp::search(const QString & arg) | 2774 | void QTReaderApp::search(const QString & arg) |
2707 | { | 2775 | { |
2708 | searchrecord* ss = searchStack->top(); | 2776 | searchrecord* ss = searchStack->top(); |
2709 | CBuffer test; | 2777 | CBuffer test; |
2710 | size_t start = reader->pagelocate(); | 2778 | size_t start = reader->pagelocate(); |
2711 | bool haspopped = false; | 2779 | bool haspopped = false; |
2712 | while (arg.left(ss->s.length()) != ss->s) | 2780 | while (arg.left(ss->s.length()) != ss->s) |
2713 | { | 2781 | { |
2714 | haspopped = true; | 2782 | haspopped = true; |
2715 | start = ss->pos; | 2783 | start = ss->pos; |
2716 | // reader->locate(start); | 2784 | // reader->locate(start); |
2717 | searchStack->pop(); | 2785 | searchStack->pop(); |
2718 | delete ss; | 2786 | delete ss; |
2719 | } | 2787 | } |
2720 | if (haspopped) reader->locate(start); | 2788 | if (haspopped) reader->locate(start); |
2721 | /* | 2789 | /* |
2722 | if (arg.length() < ss->len) | 2790 | if (arg.length() < ss->len) |
2723 | { | 2791 | { |
2724 | start = ss->pos; | 2792 | start = ss->pos; |
2725 | reader->locate(start); | 2793 | reader->locate(start); |
2726 | searchStack->pop(); | 2794 | searchStack->pop(); |
2727 | delete ss; | 2795 | delete ss; |
2728 | } | 2796 | } |
2729 | */ | 2797 | */ |
2730 | else | 2798 | else |
2731 | { | 2799 | { |
2732 | start = reader->pagelocate(); | 2800 | start = reader->pagelocate(); |
2733 | reader->jumpto(start); | 2801 | reader->jumpto(start); |
2734 | searchStack->push(new searchrecord(arg,start)); | 2802 | searchStack->push(new searchrecord(arg,start)); |
2735 | } | 2803 | } |
2736 | dosearch(start, test, arg); | 2804 | dosearch(start, test, arg); |
2737 | } | 2805 | } |
2738 | #else | 2806 | #else |
2739 | void QTReaderApp::search() | 2807 | void QTReaderApp::search() |
2740 | { | 2808 | { |
2741 | findNext(); | 2809 | findNext(); |
2742 | } | 2810 | } |
2743 | #endif | 2811 | #endif |
2744 | 2812 | ||
2745 | void QTReaderApp::openFile( const QString &f ) | 2813 | void QTReaderApp::openFile( const QString &f, unsigned int loc ) |
2746 | { | 2814 | { |
2747 | // qDebug("File:%s", (const char*)f); | 2815 | // qDebug("File:%s", (const char*)f); |
2748 | // openFile(DocLnk(f)); | 2816 | // openFile(DocLnk(f)); |
2749 | //} | 2817 | //} |
2750 | // | 2818 | // |
2751 | //void QTReaderApp::openFile( const DocLnk &f ) | 2819 | //void QTReaderApp::openFile( const DocLnk &f ) |
2752 | //{ | 2820 | //{ |
2753 | clear(); | 2821 | clear(); |
2754 | QFileInfo fm(f); | 2822 | QFileInfo fm(f); |
2755 | if ( fm.exists() ) | 2823 | if ( fm.exists() ) |
2756 | { | 2824 | { |
2757 | // QMessageBox::information(0, "Progress", "Calling fileNew()"); | 2825 | // QMessageBox::information(0, "Progress", "Calling fileNew()"); |
2758 | #ifdef USEQPE | 2826 | #ifdef USEQPE |
2759 | if (fm.extension( FALSE ) == "desktop") | 2827 | if (fm.extension( FALSE ) == "desktop") |
2760 | { | 2828 | { |
2761 | DocLnk d(f); | 2829 | DocLnk d(f); |
2762 | QFileInfo fnew(d.file()); | 2830 | QFileInfo fnew(d.file()); |
2763 | fm = fnew; | 2831 | fm = fnew; |
2764 | if (!fm.exists()) return; | 2832 | if (!fm.exists()) return; |
2765 | } | 2833 | } |
2766 | #endif | 2834 | #endif |
2767 | clear(); | 2835 | clear(); |
2768 | reader->setText(fm.baseName(), fm.absFilePath()); | 2836 | reader->setText(fm.baseName(), fm.absFilePath(), loc); |
2769 | m_loadedconfig = readconfig(APPDIR "/configs", reader->m_string, false); | 2837 | m_loadedconfig = readconfig(APPDIR "/configs", reader->m_string, false); |
2770 | qDebug("Showing tools"); | 2838 | qDebug("Showing tools"); |
2771 | showEditTools(); | 2839 | showEditTools(); |
2772 | qDebug("Shown tools"); | 2840 | qDebug("Shown tools"); |
2773 | readbkmks(); | 2841 | readbkmks(); |
2774 | qDebug("read markss"); | 2842 | qDebug("read markss"); |
2775 | m_savedpos = 0xffffffff; | 2843 | m_savedpos = 0xffffffff; |
2776 | } | 2844 | } |
2777 | else | 2845 | else |
2778 | { | 2846 | { |
2779 | QString msg = f; | 2847 | QString msg = f; |
2780 | msg += "\nFile does not exist"; | 2848 | msg += "\nFile does not exist"; |
2781 | QMessageBox::information(this, PROGNAME, msg); | 2849 | QMessageBox::information(this, PROGNAME, msg); |
2782 | reader->m_lastfile = QString::null; | 2850 | reader->m_lastfile = QString::null; |
2783 | } | 2851 | } |
2784 | 2852 | ||
2785 | } | 2853 | } |
2786 | /* | 2854 | /* |
2787 | void QTReaderApp::resizeEvent(QResizeEvent* e) | 2855 | void QTReaderApp::resizeEvent(QResizeEvent* e) |
2788 | { | 2856 | { |
2789 | if (m_fullscreen) | 2857 | if (m_fullscreen) |
2790 | { | 2858 | { |
2791 | showNormal(); | 2859 | showNormal(); |
2792 | showFullScreen(); | 2860 | showFullScreen(); |
2793 | } | 2861 | } |
2794 | } | 2862 | } |
2795 | */ | 2863 | */ |
2796 | void QTReaderApp::handlekey(QKeyEvent* e) | 2864 | void QTReaderApp::handlekey(QKeyEvent* e) |
2797 | { | 2865 | { |
2798 | // qDebug("Keypress event"); | 2866 | // qDebug("Keypress event"); |
2799 | timeb now; | 2867 | timeb now; |
2800 | ftime(&now); | 2868 | ftime(&now); |
2801 | unsigned long etime = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm; | 2869 | unsigned long etime = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm; |
2802 | if (etime < m_debounce) | 2870 | if (etime < m_debounce) |
2803 | { | 2871 | { |
2804 | return; | 2872 | return; |
2805 | } | 2873 | } |
2806 | switch(e->key()) | 2874 | switch(e->key()) |
2807 | { | 2875 | { |
2808 | case Key_Escape: | 2876 | case Key_Escape: |
2809 | // qDebug("escape event"); | 2877 | qDebug("escape event"); |
2810 | if (m_disableesckey) | 2878 | if (m_disableesckey) |
2811 | { | 2879 | { |
2812 | m_disableesckey = false; | 2880 | m_disableesckey = false; |
2813 | } | 2881 | } |
2814 | else | 2882 | else |
2815 | { | 2883 | { |
2816 | m_bcloseDisabled = true; | 2884 | m_bcloseDisabled = true; |
2817 | if (m_fullscreen) | 2885 | if (m_fullscreen) |
2818 | { | 2886 | { |
2819 | m_actFullscreen->setOn(false); | 2887 | m_actFullscreen->setOn(false); |
2820 | e->accept(); | 2888 | e->accept(); |
2821 | } | 2889 | } |
2822 | else | 2890 | else |
2823 | { | 2891 | { |
2824 | // qDebug("escape action"); | 2892 | // qDebug("escape action"); |
2825 | doAction(e); | 2893 | doAction(e); |
2826 | } | 2894 | } |
2827 | } | 2895 | } |
2828 | break; | 2896 | break; |
2829 | /* | 2897 | /* |
2830 | case Key_Left: | 2898 | case Key_Left: |
2831 | { | 2899 | { |
2832 | if (reader->m_autoScroll) | 2900 | if (reader->m_autoScroll) |
2833 | { | 2901 | { |
2834 | reader->reduceScroll(); | 2902 | reader->reduceScroll(); |
2835 | } | 2903 | } |
2836 | else | 2904 | else |
2837 | { | 2905 | { |
2838 | doAction(e); | 2906 | doAction(e); |
2839 | } | 2907 | } |
2840 | } | 2908 | } |
2841 | break; | 2909 | break; |
2842 | case Key_Right: | 2910 | case Key_Right: |
2843 | { | 2911 | { |
2844 | if (reader->m_autoScroll) | 2912 | if (reader->m_autoScroll) |
2845 | { | 2913 | { |
2846 | reader->increaseScroll(); | 2914 | reader->increaseScroll(); |
2847 | } | 2915 | } |
2848 | else | 2916 | else |
2849 | { | 2917 | { |
2850 | doAction(e); | 2918 | doAction(e); |
2851 | } | 2919 | } |
2852 | } | 2920 | } |
2853 | break; | 2921 | break; |
2854 | case Key_Up: | 2922 | case Key_Up: |
2855 | { | 2923 | { |
2856 | if (reader->m_autoScroll) | 2924 | if (reader->m_autoScroll) |
2857 | { | 2925 | { |
2858 | reader->increaseScroll(); | 2926 | reader->increaseScroll(); |
2859 | } | 2927 | } |
2860 | else | 2928 | else |
2861 | { | 2929 | { |
2862 | doAction(e); | 2930 | doAction(e); |
2863 | } | 2931 | } |
2864 | } | 2932 | } |
2865 | break; | 2933 | break; |
2866 | case Key_Down: | 2934 | case Key_Down: |
2867 | { | 2935 | { |
2868 | if (reader->m_autoScroll) | 2936 | if (reader->m_autoScroll) |
2869 | { | 2937 | { |
2870 | reader->reduceScroll(); | 2938 | reader->reduceScroll(); |
2871 | } | 2939 | } |
2872 | else | 2940 | else |
2873 | { | 2941 | { |
2874 | doAction(e); | 2942 | doAction(e); |
2875 | } | 2943 | } |
2876 | } | 2944 | } |
2877 | break; | 2945 | break; |
2878 | */ | 2946 | */ |
2879 | default: | 2947 | default: |
2880 | { | 2948 | { |
2881 | doAction(e); | 2949 | doAction(e); |
2882 | } | 2950 | } |
2883 | 2951 | ||
2884 | /* | 2952 | /* |
2885 | QString msg("Key press was:"); | 2953 | QString msg("Key press was:"); |
2886 | QString key; | 2954 | QString key; |
2887 | msg += key.setNum(e->key()); | 2955 | msg += key.setNum(e->key()); |
2888 | QMessageBox::information(this, PROGNAME, msg); | 2956 | QMessageBox::information(this, PROGNAME, msg); |
2889 | */ | 2957 | */ |
2890 | } | 2958 | } |
2891 | ftime(&m_lastkeytime); | 2959 | ftime(&m_lastkeytime); |
2892 | } | 2960 | } |
2893 | 2961 | ||
2894 | #ifdef NEWFULLSCREEN | 2962 | #if defined(USEQPE) && defined(USENEWFULLSCREEN) |
2895 | void QTReaderApp::enableFullscreen() | 2963 | void QTReaderApp::focusInEvent(QFocusEvent *) |
2896 | { | ||
2897 | setFixedSize(qApp->desktop()->size()); | ||
2898 | showNormal(); | ||
2899 | reparent(0, WStyle_Customize | WStyle_NoBorder, QPoint(0,0)); | ||
2900 | showFullScreen(); | ||
2901 | } | ||
2902 | |||
2903 | void QTReaderApp::resizeEvent(QResizeEvent *) | ||
2904 | { | 2964 | { |
2905 | if (m_fullscreen && (size() != qApp->desktop()->size())) | 2965 | if (m_usenewfullscreen && m_fullscreen && (editorStack->visibleWidget() == reader)) |
2906 | { | 2966 | { |
2907 | enableFullscreen(); | 2967 | m_usenewfullscreen = false; |
2968 | reader->bDoUpdates = false; | ||
2969 | showEditTools(); | ||
2970 | reader->bDoUpdates = true; | ||
2971 | reader->update(); | ||
2972 | m_usenewfullscreen = true; | ||
2908 | } | 2973 | } |
2909 | } | 2974 | } |
2910 | 2975 | ||
2911 | void QTReaderApp::focusInEvent(QFocusEvent*) | 2976 | void QTReaderApp::resizeEvent(QResizeEvent *) |
2912 | { | 2977 | { |
2913 | if (m_fullscreen) | 2978 | if (m_usenewfullscreen && m_fullscreen && (editorStack->visibleWidget() == reader)) |
2914 | { | 2979 | { |
2915 | enableFullscreen(); | 2980 | m_usenewfullscreen = false; |
2916 | raise(); | 2981 | reader->bDoUpdates = false; |
2982 | showEditTools(); | ||
2983 | reader->bDoUpdates = true; | ||
2984 | reader->update(); | ||
2985 | m_usenewfullscreen = true; | ||
2917 | } | 2986 | } |
2918 | } | 2987 | } |
2919 | #endif | 2988 | #endif |
2920 | 2989 | ||
2921 | void QTReaderApp::showEditTools() | 2990 | void QTReaderApp::showEditTools() |
2922 | { | 2991 | { |
2923 | // if ( !doc ) | 2992 | // if ( !doc ) |
2924 | //close(); | 2993 | //close(); |
2925 | if (m_fullscreen) | 2994 | if (m_fullscreen) |
2926 | { | 2995 | { |
2927 | #ifdef USEQPE | 2996 | #if defined(USEQPE) |
2928 | if (menubar != NULL) menubar->hide(); | 2997 | if (menubar != NULL) menubar->hide(); |
2929 | #endif | 2998 | #endif |
2930 | if (fileBar != NULL) fileBar->hide(); | 2999 | if (fileBar != NULL) fileBar->hide(); |
2931 | if (viewBar != NULL) viewBar->hide(); | 3000 | if (viewBar != NULL) viewBar->hide(); |
2932 | if (navBar != NULL) navBar->hide(); | 3001 | if (navBar != NULL) navBar->hide(); |
2933 | if (markBar != NULL) markBar->hide(); | 3002 | if (markBar != NULL) markBar->hide(); |
2934 | if (m_prog != NULL) | 3003 | if (m_prog != NULL) |
2935 | { | 3004 | { |
2936 | // qDebug("Hiding status"); | 3005 | // qDebug("Hiding status"); |
2937 | m_prog->hide(); | 3006 | m_prog->hide(); |
2938 | } | 3007 | } |
2939 | searchBar->hide(); | 3008 | searchBar->hide(); |
2940 | regBar->hide(); | 3009 | regBar->hide(); |
2941 | #ifdef USEQPE | 3010 | #ifdef USEQPE |
2942 | Global::hideInputMethod(); | 3011 | Global::hideInputMethod(); |
2943 | #endif | 3012 | #endif |
2944 | if (m_scrollbar != NULL) m_scrollbar->hide(); | 3013 | if (m_scrollbar != NULL) m_scrollbar->hide(); |
2945 | m_fontBar->hide(); | 3014 | m_fontBar->hide(); |
2946 | //showNormal(); | 3015 | //showNormal(); |
2947 | #ifdef NEWFULLSCREEN | ||
2948 | enableFullscreen(); | ||
2949 | #else | ||
2950 | showFullScreen(); | 3016 | showFullScreen(); |
2951 | #endif | 3017 | } |
2952 | } | ||
2953 | else | 3018 | else |
2954 | { | 3019 | { |
2955 | //qDebug("him"); | 3020 | //qDebug("him"); |
2956 | #ifdef USEQPE | 3021 | #ifdef USEQPE |
2957 | Global::hideInputMethod(); | 3022 | Global::hideInputMethod(); |
2958 | #endif | 3023 | #endif |
2959 | //qDebug("eb"); | 3024 | //qDebug("eb"); |
2960 | if (m_scrollbar != NULL) | 3025 | if (m_scrollbar != NULL) |
2961 | { | 3026 | { |
2962 | if (m_scrollishidden) | 3027 | if (m_scrollishidden) |
2963 | { | 3028 | { |
2964 | m_scrollbar->hide(); | 3029 | m_scrollbar->hide(); |
2965 | } | 3030 | } |
2966 | else | 3031 | else |
2967 | { | 3032 | { |
2968 | m_scrollbar->show(); | 3033 | m_scrollbar->show(); |
2969 | } | 3034 | } |
2970 | } | 3035 | } |
2971 | if (!m_hidebars) | 3036 | if (!m_hidebars) |
2972 | { | 3037 | { |
2973 | #ifdef USEQPE | 3038 | #if defined(USEQPE) |
2974 | menubar->show(); | 3039 | menubar->show(); |
2975 | #endif | 3040 | #endif |
2976 | if (fileBar != NULL) fileBar->show(); | 3041 | if (fileBar != NULL) fileBar->show(); |
2977 | if (viewBar != NULL) viewBar->show(); | 3042 | if (viewBar != NULL) viewBar->show(); |
2978 | if (navBar != NULL) navBar->show(); | 3043 | if (navBar != NULL) navBar->show(); |
2979 | if (markBar != NULL) markBar->show(); | 3044 | if (markBar != NULL) markBar->show(); |
2980 | if (m_prog != NULL && !m_statusishidden) | 3045 | if (m_prog != NULL && !m_statusishidden) |
2981 | { | 3046 | { |
2982 | // qDebug("Showing status"); | 3047 | // qDebug("Showing status"); |
2983 | m_prog->show(); | 3048 | m_prog->show(); |
2984 | // qDebug("Shown status"); | 3049 | // qDebug("Shown status"); |
2985 | } | 3050 | } |
2986 | // qDebug("Showing mb"); | 3051 | // qDebug("Showing mb"); |
2987 | mb->show(); | 3052 | mb->show(); |
2988 | } | 3053 | } |
2989 | if ( searchVisible ) | 3054 | if ( searchVisible ) |
2990 | { | 3055 | { |
2991 | #ifdef USEQPE | 3056 | #ifdef USEQPE |
2992 | Global::showInputMethod(); | 3057 | Global::showInputMethod(); |
2993 | #endif | 3058 | #endif |
2994 | searchBar->show(); | 3059 | searchBar->show(); |
2995 | } | 3060 | } |
2996 | if ( regVisible ) | 3061 | if ( regVisible ) |
2997 | { | 3062 | { |
2998 | #ifdef USEQPE | 3063 | #ifdef USEQPE |
2999 | Global::showInputMethod(); | 3064 | Global::showInputMethod(); |
3000 | #endif | 3065 | #endif |
3001 | regBar->show(); | 3066 | regBar->show(); |
3002 | } | 3067 | } |
3003 | if (m_fontVisible) m_fontBar->show(); | 3068 | if (m_fontVisible) m_fontBar->show(); |
3004 | //qDebug("sn"); | 3069 | //qDebug("sn"); |
3005 | showNormal(); | 3070 | showNormal(); |
3006 | //qDebug("sm"); | 3071 | //qDebug("sm"); |
3007 | #ifdef USEQPE | 3072 | #if defined(USEQPE) && !defined(SIMPAD) |
3008 | showMaximized(); | 3073 | showMaximized(); |
3009 | #endif | 3074 | #endif |
3010 | //setCentralWidget(reader); | 3075 | //setCentralWidget(reader); |
3011 | } | 3076 | } |
3012 | 3077 | ||
3013 | // qDebug("uc"); | 3078 | // qDebug("uc"); |
3014 | updateCaption(); | 3079 | updateCaption(); |
3015 | // qDebug("rw"); | 3080 | // qDebug("rw"); |
3016 | editorStack->raiseWidget( reader ); | 3081 | editorStack->raiseWidget( reader ); |
3017 | // qDebug("sf"); | 3082 | // qDebug("sf"); |
3018 | reader->setFocus(); | 3083 | reader->setFocus(); |
3019 | // qDebug("ref"); | 3084 | // qDebug("ref"); |
3020 | reader->refresh(true); | 3085 | //reader->refresh(true); |
3021 | // qDebug("done"); | 3086 | // qDebug("done"); |
3022 | } | 3087 | } |
3023 | /* | 3088 | /* |
3024 | void QTReaderApp::save() | 3089 | void QTReaderApp::save() |
3025 | { | 3090 | { |
3026 | if ( !doc ) | 3091 | if ( !doc ) |
3027 | return; | 3092 | return; |
3028 | if ( !editor->edited() ) | 3093 | if ( !editor->edited() ) |
3029 | return; | 3094 | return; |
3030 | 3095 | ||
3031 | QString rt = editor->text(); | 3096 | QString rt = editor->text(); |
3032 | QString pt = rt; | 3097 | QString pt = rt; |
3033 | 3098 | ||
3034 | if ( doc->name().isEmpty() ) { | 3099 | if ( doc->name().isEmpty() ) { |
3035 | unsigned ispace = pt.find( ' ' ); | 3100 | unsigned ispace = pt.find( ' ' ); |
3036 | unsigned ienter = pt.find( '\n' ); | 3101 | unsigned ienter = pt.find( '\n' ); |
3037 | int i = (ispace < ienter) ? ispace : ienter; | 3102 | int i = (ispace < ienter) ? ispace : ienter; |
3038 | QString docname; | 3103 | QString docname; |
3039 | if ( i == -1 ) { | 3104 | if ( i == -1 ) { |
3040 | if ( pt.isEmpty() ) | 3105 | if ( pt.isEmpty() ) |
3041 | docname = "Empty Text"; | 3106 | docname = "Empty Text"; |
3042 | else | 3107 | else |
3043 | docname = pt; | 3108 | docname = pt; |
3044 | } else { | 3109 | } else { |
3045 | docname = pt.left( i ); | 3110 | docname = pt.left( i ); |
3046 | } | 3111 | } |
3047 | doc->setName(docname); | 3112 | doc->setName(docname); |
3048 | } | 3113 | } |
3049 | FileManager fm; | 3114 | FileManager fm; |
3050 | fm.saveFile( *doc, rt ); | 3115 | fm.saveFile( *doc, rt ); |
3051 | } | 3116 | } |
3052 | */ | 3117 | */ |
3053 | 3118 | ||
3054 | void QTReaderApp::clear() | 3119 | void QTReaderApp::clear() |
3055 | { | 3120 | { |
3056 | // if (doc != 0) | 3121 | // if (doc != 0) |
3057 | // { | 3122 | // { |
3058 | // QMessageBox::information(this, PROGNAME, "Deleting doc", 1); | 3123 | // QMessageBox::information(this, PROGNAME, "Deleting doc", 1); |
3059 | //delete doc; | 3124 | //delete doc; |
3060 | // QMessageBox::information(this, PROGNAME, "Deleted doc", 1); | 3125 | // QMessageBox::information(this, PROGNAME, "Deleted doc", 1); |
3061 | //doc = 0; | 3126 | //doc = 0; |
3062 | // } | 3127 | // } |
3063 | reader->clear(); | 3128 | reader->clear(); |
3064 | } | 3129 | } |
3065 | 3130 | ||
3066 | void QTReaderApp::updateCaption() | 3131 | void QTReaderApp::updateCaption() |
3067 | { | 3132 | { |
3068 | // if ( !doc ) | 3133 | // if ( !doc ) |
@@ -3129,184 +3194,195 @@ void QTReaderApp::closeEvent( QCloseEvent *e ) | |||
3129 | e->ignore(); | 3194 | e->ignore(); |
3130 | return; | 3195 | return; |
3131 | } | 3196 | } |
3132 | if (searchVisible) | 3197 | if (searchVisible) |
3133 | { | 3198 | { |
3134 | searchBar->hide(); | 3199 | searchBar->hide(); |
3135 | #ifdef USEQPE | 3200 | #ifdef USEQPE |
3136 | Global::hideInputMethod(); | 3201 | Global::hideInputMethod(); |
3137 | #endif | 3202 | #endif |
3138 | searchVisible = false; | 3203 | searchVisible = false; |
3139 | e->ignore(); | 3204 | e->ignore(); |
3140 | return; | 3205 | return; |
3141 | } | 3206 | } |
3142 | if (m_fBkmksChanged && pBkmklist != NULL) | 3207 | if (m_fBkmksChanged && pBkmklist != NULL) |
3143 | { | 3208 | { |
3144 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) | 3209 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) |
3145 | savebkmks(); | 3210 | savebkmks(); |
3146 | delete pBkmklist; | 3211 | delete pBkmklist; |
3147 | reader->pBkmklist = pBkmklist = NULL; | 3212 | reader->pBkmklist = pBkmklist = NULL; |
3148 | m_fBkmksChanged = false; | 3213 | m_fBkmksChanged = false; |
3149 | } | 3214 | } |
3150 | updatefileinfo(); | 3215 | updatefileinfo(); |
3151 | saveprefs(); | 3216 | saveprefs(); |
3152 | e->accept(); | 3217 | e->accept(); |
3153 | } | 3218 | } |
3154 | } | 3219 | } |
3155 | else | 3220 | else |
3156 | { | 3221 | { |
3157 | showEditTools(); | 3222 | showEditTools(); |
3158 | m_disableesckey = true; | 3223 | m_disableesckey = true; |
3159 | } | 3224 | } |
3160 | } | 3225 | } |
3161 | } | 3226 | } |
3162 | 3227 | ||
3163 | void QTReaderApp::do_gotomark() | 3228 | void QTReaderApp::do_gotomark() |
3164 | { | 3229 | { |
3165 | m_nBkmkAction = cGotoBkmk; | 3230 | m_nBkmkAction = cGotoBkmk; |
3166 | if (!listbkmk(pBkmklist)) | 3231 | if (!listbkmk(pBkmklist)) |
3167 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); | 3232 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); |
3168 | } | 3233 | } |
3169 | 3234 | ||
3170 | void QTReaderApp::do_delmark() | 3235 | void QTReaderApp::do_delmark() |
3171 | { | 3236 | { |
3172 | m_nBkmkAction = cDelBkmk; | 3237 | m_nBkmkAction = cDelBkmk; |
3173 | if (!listbkmk(pBkmklist)) | 3238 | if (!listbkmk(pBkmklist)) |
3174 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); | 3239 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); |
3175 | } | 3240 | } |
3176 | 3241 | ||
3177 | bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab) | 3242 | bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab, bool presel) |
3178 | { | 3243 | { |
3179 | bkmkselector->clear(); | 3244 | bkmkselector->clear(); |
3180 | if (_lab.isEmpty()) | 3245 | if (_lab.isEmpty()) |
3181 | bkmkselector->setText("Cancel"); | 3246 | bkmkselector->setText("Cancel"); |
3182 | else | 3247 | else |
3183 | bkmkselector->setText(_lab); | 3248 | bkmkselector->setText(_lab); |
3184 | int cnt = 0; | 3249 | int cnt = 0; |
3250 | int slt = -1; | ||
3185 | if (plist != NULL) | 3251 | if (plist != NULL) |
3186 | { | 3252 | { |
3187 | for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) | 3253 | for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) |
3188 | { | 3254 | { |
3255 | if (presel) | ||
3256 | { | ||
3257 | Bkmk* p = i.pContent(); | ||
3258 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) | ||
3259 | { | ||
3260 | slt = cnt; | ||
3261 | } | ||
3262 | } | ||
3189 | #ifdef _UNICODE | 3263 | #ifdef _UNICODE |
3190 | // qDebug("Item:%s", (const char*)toQString(i->name())); | 3264 | // qDebug("Item:%s", (const char*)toQString(i->name())); |
3191 | bkmkselector->insertItem(toQString(i->name())); | 3265 | bkmkselector->insertItem(toQString(i->name()), cnt++); |
3192 | #else | 3266 | #else |
3193 | bkmkselector->insertItem(i->name()); | 3267 | bkmkselector->insertItem(i->name(), cnt++); |
3194 | #endif | 3268 | #endif |
3195 | cnt++; | 3269 | |
3196 | } | 3270 | } |
3197 | } | 3271 | } |
3198 | if (cnt > 0) | 3272 | if (cnt > 0) |
3199 | { | 3273 | { |
3200 | hidetoolbars(); | 3274 | hidetoolbars(); |
3201 | editorStack->raiseWidget( bkmkselector ); | 3275 | editorStack->raiseWidget( bkmkselector ); |
3276 | if (slt != -1) bkmkselector->setCurrentItem(slt); | ||
3202 | return true; | 3277 | return true; |
3203 | } | 3278 | } |
3204 | else | 3279 | else |
3205 | return false; | 3280 | return false; |
3206 | } | 3281 | } |
3207 | 3282 | ||
3208 | void QTReaderApp::do_autogen() | 3283 | void QTReaderApp::do_autogen() |
3209 | { | 3284 | { |
3210 | m_nRegAction = cAutoGen; | 3285 | m_nRegAction = cAutoGen; |
3211 | regEdit->setText(m_autogenstr); | 3286 | regEdit->setText(m_autogenstr); |
3212 | do_regedit(); | 3287 | do_regedit(); |
3213 | } | 3288 | } |
3214 | 3289 | ||
3215 | void QTReaderApp::do_regedit() | 3290 | void QTReaderApp::do_regedit() |
3216 | { | 3291 | { |
3217 | // fileBar->hide(); | 3292 | // fileBar->hide(); |
3218 | reader->bDoUpdates = false; | 3293 | reader->bDoUpdates = false; |
3219 | // qDebug("Showing regbar"); | 3294 | // qDebug("Showing regbar"); |
3220 | regBar->show(); | 3295 | regBar->show(); |
3221 | // qDebug("Showing kbd"); | 3296 | // qDebug("Showing kbd"); |
3222 | #ifdef USEQPE | 3297 | #ifdef USEQPE |
3223 | Global::showInputMethod(); | 3298 | Global::showInputMethod(); |
3224 | #endif | 3299 | #endif |
3225 | regVisible = true; | 3300 | regVisible = true; |
3226 | regEdit->setFocus(); | 3301 | regEdit->setFocus(); |
3227 | // qApp->processEvents(); | 3302 | // qApp->processEvents(); |
3228 | reader->bDoUpdates = true; | 3303 | reader->bDoUpdates = true; |
3229 | reader->update(); | 3304 | reader->update(); |
3230 | } | 3305 | } |
3231 | 3306 | ||
3232 | bool QTReaderApp::openfrombkmk(Bkmk* bk) | 3307 | bool QTReaderApp::openfrombkmk(Bkmk* bk) |
3233 | { | 3308 | { |
3234 | QString fn = toQString( | 3309 | QString fn = toQString( |
3235 | CFiledata(bk->anno()).name() | 3310 | CFiledata(bk->anno()).name() |
3236 | ); | 3311 | ); |
3237 | //qDebug("fileinfo"); | 3312 | //qDebug("fileinfo"); |
3238 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) | 3313 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) |
3239 | { | 3314 | { |
3240 | //qDebug("Opening"); | 3315 | //qDebug("Opening"); |
3241 | openFile(fn); | ||
3242 | struct stat fnstat; | 3316 | struct stat fnstat; |
3243 | stat((const char *)reader->m_lastfile, &fnstat); | 3317 | stat((const char *)fn, &fnstat); |
3244 | 3318 | ||
3245 | if (CFiledata(bk->anno()).date() | 3319 | if (CFiledata(bk->anno()).date() |
3246 | != fnstat.st_mtime) | 3320 | != fnstat.st_mtime) |
3247 | { | 3321 | { |
3248 | CFiledata fd(bk->anno()); | 3322 | CFiledata fd(bk->anno()); |
3249 | fd.setdate(fnstat.st_mtime); | 3323 | fd.setdate(fnstat.st_mtime); |
3250 | bk->value(0); | 3324 | bk->value(0); |
3325 | reader->m_lastposn = 0; | ||
3326 | openFile(fn); | ||
3251 | } | 3327 | } |
3252 | else | 3328 | else |
3253 | { | 3329 | { |
3254 | unsigned short svlen = bk->filedatalen(); | 3330 | unsigned short svlen = bk->filedatalen(); |
3255 | unsigned char* svdata = bk->filedata(); | 3331 | unsigned char* svdata = bk->filedata(); |
3332 | openFile(fn, bk->value()); | ||
3256 | reader->putSaveData(svdata, svlen); | 3333 | reader->putSaveData(svdata, svlen); |
3257 | // setstate(svdata, svlen); | 3334 | // setstate(svdata, svlen); |
3258 | if (svlen != 0) | 3335 | if (svlen != 0) |
3259 | { | 3336 | { |
3260 | QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?"); | 3337 | QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?"); |
3261 | } | 3338 | } |
3262 | // qDebug("updating"); | 3339 | // qDebug("updating"); |
3263 | // showEditTools(); | 3340 | // showEditTools(); |
3264 | reader->locate(bk->value()); | ||
3265 | } | 3341 | } |
3266 | return true; | 3342 | return true; |
3267 | } | 3343 | } |
3268 | else | 3344 | else |
3269 | { | 3345 | { |
3270 | return false; | 3346 | return false; |
3271 | } | 3347 | } |
3272 | } | 3348 | } |
3273 | 3349 | ||
3274 | void QTReaderApp::gotobkmk(int ind) | 3350 | void QTReaderApp::gotobkmk(int ind) |
3275 | { | 3351 | { |
3276 | qDebug("gbkmk"); | 3352 | qDebug("gbkmk"); |
3277 | showEditTools(); | 3353 | showEditTools(); |
3278 | switch (m_nBkmkAction) | 3354 | switch (m_nBkmkAction) |
3279 | { | 3355 | { |
3280 | case cOpenFile: | 3356 | case cOpenFile: |
3281 | { | 3357 | { |
3282 | // qApp->processEvents(); | 3358 | // qApp->processEvents(); |
3283 | if (!openfrombkmk((*pOpenlist)[ind])) | 3359 | if (!openfrombkmk((*pOpenlist)[ind])) |
3284 | { | 3360 | { |
3285 | pOpenlist->erase(ind); | 3361 | pOpenlist->erase(ind); |
3286 | QMessageBox::information(this, PROGNAME, "Can't find file"); | 3362 | QMessageBox::information(this, PROGNAME, "Can't find file"); |
3287 | } | 3363 | } |
3288 | } | 3364 | } |
3289 | break; | 3365 | break; |
3290 | case cGotoBkmk: | 3366 | case cGotoBkmk: |
3291 | reader->buffdoc.saveposn(reader->m_lastfile, reader->pagelocate()); | 3367 | reader->buffdoc.saveposn(reader->m_lastfile, reader->pagelocate()); |
3292 | reader->locate((*pBkmklist)[ind]->value()); | 3368 | reader->locate((*pBkmklist)[ind]->value()); |
3293 | break; | 3369 | break; |
3294 | case cDelBkmk: | 3370 | case cDelBkmk: |
3295 | //// qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name()); | 3371 | //// qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name()); |
3296 | pBkmklist->erase(ind); | 3372 | pBkmklist->erase(ind); |
3297 | m_fBkmksChanged = true; | 3373 | m_fBkmksChanged = true; |
3298 | reader->refresh(true); | 3374 | reader->refresh(true); |
3299 | // pBkmklist->sort(); | 3375 | // pBkmklist->sort(); |
3300 | break; | 3376 | break; |
3301 | case cRmBkmkFile: | 3377 | case cRmBkmkFile: |
3302 | { | 3378 | { |
3303 | #ifndef USEQPE | 3379 | #ifndef USEQPE |
3304 | QDir d = QDir::home(); // "/" | 3380 | QDir d = QDir::home(); // "/" |
3305 | d.cd(APPDIR); | 3381 | d.cd(APPDIR); |
3306 | d.remove(bkmkselector->text(ind)); | 3382 | d.remove(bkmkselector->text(ind)); |
3307 | #else /* USEQPE */ | 3383 | #else /* USEQPE */ |
3308 | unlink((const char *)Global::applicationFileName(APPDIR,bkmkselector->text(ind))); | 3384 | unlink((const char *)Global::applicationFileName(APPDIR,bkmkselector->text(ind))); |
3309 | #endif /* USEQPE */ | 3385 | #endif /* USEQPE */ |
3310 | } | 3386 | } |
3311 | break; | 3387 | break; |
3312 | case cLdConfig: | 3388 | case cLdConfig: |
@@ -3321,97 +3397,97 @@ void QTReaderApp::gotobkmk(int ind) | |||
3321 | { | 3397 | { |
3322 | #ifndef USEQPE | 3398 | #ifndef USEQPE |
3323 | QDir d = QDir::home(); // "/" | 3399 | QDir d = QDir::home(); // "/" |
3324 | d.cd(APPDIR "/configs"); | 3400 | d.cd(APPDIR "/configs"); |
3325 | d.remove(bkmkselector->text(ind)); | 3401 | d.remove(bkmkselector->text(ind)); |
3326 | #else /* USEQPE */ | 3402 | #else /* USEQPE */ |
3327 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",bkmkselector->text(ind))); | 3403 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",bkmkselector->text(ind))); |
3328 | #endif /* USEQPE */ | 3404 | #endif /* USEQPE */ |
3329 | } | 3405 | } |
3330 | break; | 3406 | break; |
3331 | case cExportLinks: | 3407 | case cExportLinks: |
3332 | { | 3408 | { |
3333 | #ifndef USEQPE | 3409 | #ifndef USEQPE |
3334 | QDir d = QDir::home(); // "/" | 3410 | QDir d = QDir::home(); // "/" |
3335 | d.cd(APPDIR "/urls"); | 3411 | d.cd(APPDIR "/urls"); |
3336 | QFileInfo fi(d, bkmkselector->text(ind)); | 3412 | QFileInfo fi(d, bkmkselector->text(ind)); |
3337 | if (fi.exists()) | 3413 | if (fi.exists()) |
3338 | { | 3414 | { |
3339 | QString outfile( QFileDialog::getSaveFileName( QString::null, QString::null, this ) ); | 3415 | QString outfile( QFileDialog::getSaveFileName( QString::null, QString::null, this ) ); |
3340 | if (!outfile.isEmpty()) | 3416 | if (!outfile.isEmpty()) |
3341 | { | 3417 | { |
3342 | FILE* fout = fopen((const char *)outfile, "w"); | 3418 | FILE* fout = fopen((const char *)outfile, "w"); |
3343 | if (fout != NULL) | 3419 | if (fout != NULL) |
3344 | { | 3420 | { |
3345 | FILE* fin = fopen((const char *)fi.absFilePath(), "r"); | 3421 | FILE* fin = fopen((const char *)fi.absFilePath(), "r"); |
3346 | if (fin != NULL) | 3422 | if (fin != NULL) |
3347 | { | 3423 | { |
3348 | fprintf(fout, "<html><body>\n"); | 3424 | fprintf(fout, "<html><body>\n"); |
3349 | int ch = 0; | 3425 | int ch = 0; |
3350 | while ((ch = fgetc(fin)) != EOF) | 3426 | while ((ch = fgetc(fin)) != EOF) |
3351 | { | 3427 | { |
3352 | fputc(ch, fout); | 3428 | fputc(ch, fout); |
3353 | } | 3429 | } |
3354 | fclose(fin); | 3430 | fclose(fin); |
3355 | fprintf(fout, "</html></body>\n"); | 3431 | fprintf(fout, "</html></body>\n"); |
3356 | d.remove(bkmkselector->text(ind)); | 3432 | d.remove(bkmkselector->text(ind)); |
3357 | } | 3433 | } |
3358 | fclose(fout); | 3434 | fclose(fout); |
3359 | } | 3435 | } |
3360 | else | 3436 | else |
3361 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); | 3437 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); |
3362 | } | 3438 | } |
3363 | } | 3439 | } |
3364 | #else /* USEQPE */ | 3440 | #else /* USEQPE */ |
3365 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); | 3441 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); |
3366 | if (fin != NULL) | 3442 | if (fin != NULL) |
3367 | { | 3443 | { |
3368 | bool allok = false; | 3444 | bool allok = false; |
3369 | #ifdef OPIE | 3445 | #if defined(OPIE) && defined(OPIEFILEDIALOG) |
3370 | QString outfile = OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, QString::null, QString::null, MimeTypes(), 0, "OpieReader"); | 3446 | QString outfile = OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, QString::null, QString::null, MimeTypes(), 0, "OpieReader"); |
3371 | if (!outfile.isEmpty()) | 3447 | if (!outfile.isEmpty()) |
3372 | { | 3448 | { |
3373 | FILE* fout = fopen((const char *)outfile, "w"); | 3449 | FILE* fout = fopen((const char *)outfile, "w"); |
3374 | if (fout != NULL) | 3450 | if (fout != NULL) |
3375 | { | 3451 | { |
3376 | fprintf(fout, "<html><body>\n"); | 3452 | fprintf(fout, "<html><body>\n"); |
3377 | int ch = 0; | 3453 | int ch = 0; |
3378 | while ((ch = fgetc(fin)) != EOF) | 3454 | while ((ch = fgetc(fin)) != EOF) |
3379 | { | 3455 | { |
3380 | fputc(ch, fout); | 3456 | fputc(ch, fout); |
3381 | } | 3457 | } |
3382 | fprintf(fout, "</html></body>\n"); | 3458 | fprintf(fout, "</html></body>\n"); |
3383 | fclose(fout); | 3459 | fclose(fout); |
3384 | allok = true; | 3460 | allok = true; |
3385 | } | 3461 | } |
3386 | else | 3462 | else |
3387 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); | 3463 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); |
3388 | } | 3464 | } |
3389 | fclose(fin); | 3465 | fclose(fin); |
3390 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); | 3466 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); |
3391 | #else | 3467 | #else |
3392 | fileBrowser* fb = new fileBrowser(true, this,"OpieReader",!m_bFloatingDialog, 0, "*", QString::null); | 3468 | fileBrowser* fb = new fileBrowser(true, this,"OpieReader",!m_bFloatingDialog, 0, "*", QString::null); |
3393 | if (fb->exec()) | 3469 | if (fb->exec()) |
3394 | { | 3470 | { |
3395 | QString outfile = fb->getCurrentFile(); | 3471 | QString outfile = fb->getCurrentFile(); |
3396 | FILE* fout = fopen((const char *)outfile, "w"); | 3472 | FILE* fout = fopen((const char *)outfile, "w"); |
3397 | if (fout != NULL) | 3473 | if (fout != NULL) |
3398 | { | 3474 | { |
3399 | fprintf(fout, "<html><body>\n"); | 3475 | fprintf(fout, "<html><body>\n"); |
3400 | int ch = 0; | 3476 | int ch = 0; |
3401 | while ((ch = fgetc(fin)) != EOF) | 3477 | while ((ch = fgetc(fin)) != EOF) |
3402 | { | 3478 | { |
3403 | fputc(ch, fout); | 3479 | fputc(ch, fout); |
3404 | } | 3480 | } |
3405 | fprintf(fout, "</html></body>\n"); | 3481 | fprintf(fout, "</html></body>\n"); |
3406 | fclose(fout); | 3482 | fclose(fout); |
3407 | allok = true; | 3483 | allok = true; |
3408 | } | 3484 | } |
3409 | else | 3485 | else |
3410 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); | 3486 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); |
3411 | } | 3487 | } |
3412 | delete fb; | 3488 | delete fb; |
3413 | fclose(fin); | 3489 | fclose(fin); |
3414 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); | 3490 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); |
3415 | #endif | 3491 | #endif |
3416 | } | 3492 | } |
3417 | else | 3493 | else |
@@ -3658,115 +3734,124 @@ void QTReaderApp::do_setencoding(int i) | |||
3658 | { | 3734 | { |
3659 | reader->setencoding(i); | 3735 | reader->setencoding(i); |
3660 | } | 3736 | } |
3661 | reader->refresh(); | 3737 | reader->refresh(); |
3662 | m_fontBar->hide(); | 3738 | m_fontBar->hide(); |
3663 | m_fontVisible = false; | 3739 | m_fontVisible = false; |
3664 | // qDebug("showedit"); | 3740 | // qDebug("showedit"); |
3665 | if (reader->isVisible()) showEditTools(); | 3741 | if (reader->isVisible()) showEditTools(); |
3666 | // qDebug("showeditdone"); | 3742 | // qDebug("showeditdone"); |
3667 | } | 3743 | } |
3668 | 3744 | ||
3669 | void QTReaderApp::do_setfont(const QString& lcn) | 3745 | void QTReaderApp::do_setfont(const QString& lcn) |
3670 | { | 3746 | { |
3671 | if (m_fontAction == cChooseFont) | 3747 | if (m_fontAction == cChooseFont) |
3672 | { | 3748 | { |
3673 | setfontHelper(lcn); | 3749 | setfontHelper(lcn); |
3674 | } | 3750 | } |
3675 | reader->refresh(); | 3751 | reader->refresh(); |
3676 | m_fontBar->hide(); | 3752 | m_fontBar->hide(); |
3677 | m_fontVisible = false; | 3753 | m_fontVisible = false; |
3678 | // qDebug("setfont"); | 3754 | // qDebug("setfont"); |
3679 | //if (reader->isVisible()) | 3755 | //if (reader->isVisible()) |
3680 | showEditTools(); | 3756 | showEditTools(); |
3681 | // qDebug("showeditdone"); | 3757 | // qDebug("showeditdone"); |
3682 | } | 3758 | } |
3683 | 3759 | ||
3684 | void QTReaderApp::do_autogen(const QString& regText) | 3760 | void QTReaderApp::do_autogen(const QString& regText) |
3685 | { | 3761 | { |
3686 | unsigned long fs, ts; | 3762 | unsigned long fs, ts; |
3687 | reader->sizes(fs,ts); | 3763 | reader->sizes(fs,ts); |
3688 | // // qDebug("Reg:%s\n", (const tchar*)(regEdit->text())); | 3764 | // // qDebug("Reg:%s\n", (const tchar*)(regEdit->text())); |
3689 | m_autogenstr = regText; | 3765 | m_autogenstr = regText; |
3690 | QRegExp re(regText); | 3766 | QRegExp re(regText); |
3691 | CBuffer buff; | 3767 | CBuffer buff; |
3692 | if (pBkmklist != NULL) delete pBkmklist; | 3768 | if (pBkmklist != NULL) delete pBkmklist; |
3693 | reader->pBkmklist = pBkmklist = new CList<Bkmk>; | 3769 | reader->pBkmklist = pBkmklist = new CList<Bkmk>; |
3694 | m_fBkmksChanged = true; | 3770 | m_fBkmksChanged = true; |
3695 | 3771 | ||
3696 | pbar->setGeometry(regBar->x(),regBar->y(),regBar->width(), regBar->height()); | 3772 | pbar->setGeometry(regBar->x(),regBar->y(),regBar->width(), regBar->height()); |
3697 | pbar->show(); | 3773 | pbar->show(); |
3698 | pbar->raise(); | 3774 | pbar->raise(); |
3699 | pbar->reset(); | 3775 | pbar->reset(); |
3700 | reader->update(); | 3776 | reader->update(); |
3701 | qApp->processEvents(); | 3777 | qApp->processEvents(); |
3702 | reader->setFocus(); | 3778 | reader->setFocus(); |
3703 | reader->jumpto(0); | 3779 | reader->jumpto(0); |
3704 | int lastpc = 0; | 3780 | int lastpc = 0; |
3705 | int i = 0; | 3781 | int i = 0; |
3782 | unsigned int llcn = reader->locate(); | ||
3706 | while (i >= 0) | 3783 | while (i >= 0) |
3707 | { | 3784 | { |
3708 | unsigned int lcn = reader->locate(); | 3785 | unsigned int lcn = llcn; |
3709 | int pc = (100*lcn)/ts; | 3786 | int pc = (100*lcn)/ts; |
3710 | if (pc != lastpc) | 3787 | if (pc != lastpc) |
3711 | { | 3788 | { |
3712 | pbar->setProgress(pc); | 3789 | pbar->setProgress(pc); |
3713 | qApp->processEvents(); | 3790 | qApp->processEvents(); |
3714 | if (reader->locate() != lcn) reader->jumpto(lcn); | 3791 | if (reader->locate() != lcn) reader->jumpto(lcn); |
3715 | reader->setFocus(); | 3792 | reader->setFocus(); |
3716 | lastpc = pc; | 3793 | lastpc = pc; |
3717 | } | 3794 | } |
3718 | i = reader->buffdoc.getpara(buff); | 3795 | i = reader->buffdoc.getpara(buff); |
3719 | #ifdef _UNICODE | 3796 | #ifdef _UNICODE |
3720 | if (re.match(toQString(buff.data())) != -1) | 3797 | if (re.match(toQString(buff.data())) != -1) |
3721 | #else | 3798 | #else |
3722 | if (re.match(buff.data()) != -1) | 3799 | if (re.match(buff.data()) != -1) |
3723 | #endif | 3800 | #endif |
3724 | pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); | 3801 | pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); |
3802 | /* | ||
3803 | llcn = reader->locate(); | ||
3804 | if ((i == 0) && (llcn+1 < ts)) | ||
3805 | { | ||
3806 | reader->jumpto(++llcn); | ||
3807 | i = 1; | ||
3808 | } | ||
3809 | */ | ||
3725 | } | 3810 | } |
3726 | pBkmklist->sort(); | 3811 | pBkmklist->sort(); |
3727 | pbar->setProgress(100); | 3812 | pbar->setProgress(100); |
3728 | qApp->processEvents(); | 3813 | qApp->processEvents(); |
3729 | pbar->hide(); | 3814 | pbar->hide(); |
3730 | reader->refresh(); | 3815 | reader->refresh(); |
3731 | } | 3816 | } |
3732 | 3817 | ||
3733 | void QTReaderApp::saveprefs() | 3818 | void QTReaderApp::saveprefs() |
3734 | { | 3819 | { |
3735 | do_saveconfig( APPDIR, true ); | 3820 | do_saveconfig( APPDIR, true ); |
3736 | savefilelist(); | 3821 | savefilelist(); |
3737 | } | 3822 | } |
3738 | 3823 | ||
3739 | /* | 3824 | /* |
3740 | void QTReaderApp::oldFile() | 3825 | void QTReaderApp::oldFile() |
3741 | { | 3826 | { |
3742 | // qDebug("oldFile called"); | 3827 | // qDebug("oldFile called"); |
3743 | reader->setText(true); | 3828 | reader->setText(true); |
3744 | // qDebug("settext called"); | 3829 | // qDebug("settext called"); |
3745 | showEditTools(); | 3830 | showEditTools(); |
3746 | // qDebug("showedit called"); | 3831 | // qDebug("showedit called"); |
3747 | } | 3832 | } |
3748 | */ | 3833 | */ |
3749 | 3834 | ||
3750 | /* | 3835 | /* |
3751 | void info_cb(Fl_Widget* o, void* _data) | 3836 | void info_cb(Fl_Widget* o, void* _data) |
3752 | { | 3837 | { |
3753 | 3838 | ||
3754 | if (infowin == NULL) | 3839 | if (infowin == NULL) |
3755 | { | 3840 | { |
3756 | 3841 | ||
3757 | infowin = new Fl_Window(160,240); | 3842 | infowin = new Fl_Window(160,240); |
3758 | filename = new Fl_Output(45,5,110,14,"Filename"); | 3843 | filename = new Fl_Output(45,5,110,14,"Filename"); |
3759 | filesize = new Fl_Output(45,25,110,14,"Filesize"); | 3844 | filesize = new Fl_Output(45,25,110,14,"Filesize"); |
3760 | textsize = new Fl_Output(45,45,110,14,"Textsize"); | 3845 | textsize = new Fl_Output(45,45,110,14,"Textsize"); |
3761 | comprat = new CBar(45,65,110,14,"Ratio %"); | 3846 | comprat = new CBar(45,65,110,14,"Ratio %"); |
3762 | posn = new Fl_Output(45,85,110,14,"Location"); | 3847 | posn = new Fl_Output(45,85,110,14,"Location"); |
3763 | frcn = new CBar(45,105,110,14,"% Read"); | 3848 | frcn = new CBar(45,105,110,14,"% Read"); |
3764 | about = new Fl_Multiline_Output(5,125,150,90); | 3849 | about = new Fl_Multiline_Output(5,125,150,90); |
3765 | about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files"); | 3850 | about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files"); |
3766 | Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay"); | 3851 | Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay"); |
3767 | infowin->set_modal(); | 3852 | infowin->set_modal(); |
3768 | } | 3853 | } |
3769 | if (((reader_ui *)_data)->g_filename[0] != '\0') | 3854 | if (((reader_ui *)_data)->g_filename[0] != '\0') |
3770 | { | 3855 | { |
3771 | unsigned long fs,ts; | 3856 | unsigned long fs,ts; |
3772 | tchar sz[20]; | 3857 | tchar sz[20]; |
@@ -3987,192 +4072,196 @@ void QTReaderApp::UpdateStatus() | |||
3987 | status += m_statusstring[i]; | 4072 | status += m_statusstring[i]; |
3988 | } | 4073 | } |
3989 | } | 4074 | } |
3990 | m_prog->setText(status); | 4075 | m_prog->setText(status); |
3991 | } | 4076 | } |
3992 | 4077 | ||
3993 | void QTReaderApp::OnRedraw() | 4078 | void QTReaderApp::OnRedraw() |
3994 | { | 4079 | { |
3995 | if ((pBkmklist != NULL) && (m_bkmkAvail != NULL)) | 4080 | if ((pBkmklist != NULL) && (m_bkmkAvail != NULL)) |
3996 | { | 4081 | { |
3997 | bool found = findNextBookmark(reader->pagelocate()); | 4082 | bool found = findNextBookmark(reader->pagelocate()); |
3998 | m_bkmkAvail->setEnabled(found); | 4083 | m_bkmkAvail->setEnabled(found); |
3999 | } | 4084 | } |
4000 | if (m_scrollbar != NULL) | 4085 | if (m_scrollbar != NULL) |
4001 | { | 4086 | { |
4002 | //qDebug("OnRedraw:[%u, %u]", reader->buffdoc.startSection(), reader->buffdoc.endSection()); | 4087 | //qDebug("OnRedraw:[%u, %u]", reader->buffdoc.startSection(), reader->buffdoc.endSection()); |
4003 | scrollbar->setRange(reader->buffdoc.startSection(), reader->buffdoc.endSection()-1); | 4088 | scrollbar->setRange(reader->buffdoc.startSection(), reader->buffdoc.endSection()-1); |
4004 | scrollbar->setPageStep(reader->locate()-reader->pagelocate()); | 4089 | scrollbar->setPageStep(reader->locate()-reader->pagelocate()); |
4005 | scrollbar->setValue((reader->m_rotated) ? | 4090 | scrollbar->setValue((reader->m_rotated) ? |
4006 | (reader->buffdoc.endSection() - reader->locate()+reader->buffdoc.startSection()) : | 4091 | (reader->buffdoc.endSection() - reader->locate()+reader->buffdoc.startSection()) : |
4007 | reader->pagelocate()); | 4092 | reader->pagelocate()); |
4008 | } | 4093 | } |
4009 | if (m_prog->isVisible()) | 4094 | if (m_prog->isVisible()) |
4010 | { | 4095 | { |
4011 | // qDebug("updating status"); | 4096 | // qDebug("updating status"); |
4012 | UpdateStatus(); | 4097 | UpdateStatus(); |
4013 | // qDebug("updated status"); | 4098 | // qDebug("updated status"); |
4014 | } | 4099 | } |
4015 | } | 4100 | } |
4016 | 4101 | ||
4017 | void QTReaderApp::showAnnotation() | 4102 | void QTReaderApp::showAnnotation() |
4018 | { | 4103 | { |
4019 | m_annoWin->setName(toQString(m_anno->name())); | 4104 | m_annoWin->setName(toQString(m_anno->name())); |
4020 | m_annoWin->setAnno(toQString(m_anno->anno())); | 4105 | m_annoWin->setAnno(toQString(m_anno->anno())); |
4021 | m_annoWin->setColor(QColor(m_anno->red(), m_anno->green(), m_anno->blue())); | 4106 | m_annoWin->setColor(QColor(m_anno->red(), m_anno->green(), m_anno->blue())); |
4022 | m_annoIsEditing = false; | 4107 | m_annoIsEditing = false; |
4023 | #ifdef USEQPE | 4108 | #ifdef USEQPE |
4024 | Global::showInputMethod(); | 4109 | Global::showInputMethod(); |
4025 | #endif | 4110 | #endif |
4026 | editorStack->raiseWidget( m_annoWin ); | 4111 | editorStack->raiseWidget( m_annoWin ); |
4027 | hidetoolbars(); | 4112 | hidetoolbars(); |
4028 | m_annoWin->setFocus(); | 4113 | m_annoWin->setFocus(); |
4029 | } | 4114 | } |
4030 | 4115 | ||
4031 | void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, size_t posn2, const QString& line) | 4116 | void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, size_t posn2, const QString& line) |
4032 | { | 4117 | { |
4033 | //// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd); | 4118 | //// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd); |
4034 | 4119 | ||
4120 | if (m_doOutput && reader->checkoutput()) | ||
4121 | { | ||
4122 | reader->doOutput(wrd); | ||
4123 | } | ||
4035 | if (m_doClipboard) | 4124 | if (m_doClipboard) |
4036 | { | 4125 | { |
4037 | QClipboard* cb = QApplication::clipboard(); | 4126 | QClipboard* cb = QApplication::clipboard(); |
4038 | cb->setText(wrd); | 4127 | cb->setText(wrd); |
4039 | #ifdef USEQPE | 4128 | #ifdef USEQPE |
4040 | if (wrd.length() > 10) | 4129 | if (wrd.length() > 10) |
4041 | { | 4130 | { |
4042 | Global::statusMessage(wrd.left(8) + ".."); | 4131 | Global::statusMessage(wrd.left(8) + ".."); |
4043 | } | 4132 | } |
4044 | else | 4133 | else |
4045 | { | 4134 | { |
4046 | Global::statusMessage(wrd); | 4135 | Global::statusMessage(wrd); |
4047 | } | 4136 | } |
4048 | #endif | 4137 | #endif |
4049 | } | 4138 | } |
4050 | if (m_doAnnotation) | 4139 | if (m_doAnnotation) |
4051 | { | 4140 | { |
4052 | //addAnno(wrd, "Need to be able to edit this", posn); | 4141 | //addAnno(wrd, "Need to be able to edit this", posn); |
4053 | m_annoWin->setName(line); | 4142 | m_annoWin->setName(line); |
4054 | m_annoWin->setAnno(""); | 4143 | m_annoWin->setAnno(""); |
4055 | m_annoWin->setPosn(posn); | 4144 | m_annoWin->setPosn(posn); |
4056 | m_annoWin->setPosn2(posn2); | 4145 | m_annoWin->setPosn2(posn2); |
4057 | m_annoIsEditing = true; | 4146 | m_annoIsEditing = true; |
4058 | #ifdef USEQPE | 4147 | #ifdef USEQPE |
4059 | Global::showInputMethod(); | 4148 | Global::showInputMethod(); |
4060 | #endif | 4149 | #endif |
4061 | editorStack->raiseWidget( m_annoWin ); | 4150 | editorStack->raiseWidget( m_annoWin ); |
4062 | hidetoolbars(); | 4151 | hidetoolbars(); |
4063 | } | 4152 | } |
4064 | #ifdef USEQPE | 4153 | #ifdef USEQPE |
4065 | if (m_doDictionary) | 4154 | if (m_doDictionary) |
4066 | { | 4155 | { |
4067 | if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty()) | 4156 | if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty()) |
4068 | { | 4157 | { |
4069 | QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8()); | 4158 | QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8()); |
4070 | e << wrd; | 4159 | e << wrd; |
4071 | } | 4160 | } |
4072 | } | 4161 | } |
4073 | #endif | 4162 | #endif |
4074 | } | 4163 | } |
4075 | 4164 | ||
4076 | void QTReaderApp::doAction(QKeyEvent* e) | 4165 | void QTReaderApp::doAction(QKeyEvent* e) |
4077 | { | 4166 | { |
4078 | QMap<orKey,int>::Iterator f = kmap.end(); | 4167 | QMap<orKey,int>::Iterator f = kmap.end(); |
4079 | 4168 | ||
4080 | if (reader->m_autoScroll) | 4169 | if (reader->m_autoScroll) |
4081 | { | 4170 | { |
4082 | f = kmap.find(orKey(e->state(), e->key(), true)); | 4171 | f = kmap.find(orKey(e->state(), e->key(), true)); |
4083 | } | 4172 | } |
4084 | if (f == kmap.end()) | 4173 | if (f == kmap.end()) |
4085 | { | 4174 | { |
4086 | f = kmap.find(orKey(e->state(), e->key(), false)); | 4175 | f = kmap.find(orKey(e->state(), e->key(), false)); |
4087 | } | 4176 | } |
4088 | 4177 | ||
4089 | if (f == kmap.end()) | 4178 | if (f == kmap.end()) |
4090 | { | 4179 | { |
4091 | qDebug("doaction (no action) : %d %d %d", e->key(), e->state(), f.data()); | 4180 | qDebug("doaction (no action) : %d %d %d", e->key(), e->state(), f.data()); |
4092 | e->ignore(); | 4181 | e->ignore(); |
4093 | } | 4182 | } |
4094 | else | 4183 | else |
4095 | { | 4184 | { |
4096 | qDebug("doaction (some action) : %d %d %d", e->key(), e->state(), f.data()); | 4185 | qDebug("doaction (some action) : %d %d %d", e->key(), e->state(), f.data()); |
4097 | ActionTypes a = (ActionTypes)f.data(); | 4186 | ActionTypes a = (ActionTypes)f.data(); |
4098 | e->accept(); | 4187 | e->accept(); |
4099 | //qDebug("Accepted"); | 4188 | //qDebug("Accepted"); |
4100 | switch (a) | 4189 | switch (a) |
4101 | { | 4190 | { |
4102 | case cesGotoLink: | 4191 | case cesGotoLink: |
4103 | { | 4192 | { |
4104 | reader->gotoLink(); | 4193 | reader->gotoLink(); |
4105 | } | 4194 | } |
4106 | break; | 4195 | break; |
4107 | case cesNextLink: | 4196 | case cesNextLink: |
4108 | { | 4197 | { |
4109 | reader->getNextLink(); | 4198 | reader->getNextLink(); |
4110 | } | 4199 | } |
4111 | break; | 4200 | break; |
4112 | case cesInvertColours: | 4201 | case cesInvertColours: |
4113 | m_inverse_action->setOn(!reader->bInverse); | 4202 | m_inverse_action->setOn(!reader->bInverse); |
4114 | break; | 4203 | break; |
4115 | case cesToggleBars: | 4204 | case cesToggleBars: |
4116 | m_hidebars = !m_hidebars; | 4205 | m_hidebars = !m_hidebars; |
4117 | if (m_hidebars) | 4206 | if (m_hidebars) |
4118 | { | 4207 | { |
4119 | #ifdef USEQPE | 4208 | #if defined(USEQPE) |
4120 | menubar->hide(); | 4209 | menubar->hide(); |
4121 | #endif | 4210 | #endif |
4122 | if (fileBar != NULL) fileBar->hide(); | 4211 | if (fileBar != NULL) fileBar->hide(); |
4123 | if (viewBar != NULL) viewBar->hide(); | 4212 | if (viewBar != NULL) viewBar->hide(); |
4124 | if (navBar != NULL) navBar->hide(); | 4213 | if (navBar != NULL) navBar->hide(); |
4125 | if (markBar != NULL) markBar->hide(); | 4214 | if (markBar != NULL) markBar->hide(); |
4126 | mb->hide(); | 4215 | mb->hide(); |
4127 | } | 4216 | } |
4128 | else | 4217 | else |
4129 | { | 4218 | { |
4130 | #ifdef USEQPE | 4219 | #if defined(USEQPE) |
4131 | menubar->show(); | 4220 | menubar->show(); |
4132 | #endif | 4221 | #endif |
4133 | if (fileBar != NULL) fileBar->show(); | 4222 | if (fileBar != NULL) fileBar->show(); |
4134 | if (viewBar != NULL) viewBar->show(); | 4223 | if (viewBar != NULL) viewBar->show(); |
4135 | if (navBar != NULL) navBar->show(); | 4224 | if (navBar != NULL) navBar->show(); |
4136 | if (markBar != NULL) markBar->show(); | 4225 | if (markBar != NULL) markBar->show(); |
4137 | mb->show(); | 4226 | mb->show(); |
4138 | } | 4227 | } |
4139 | break; | 4228 | break; |
4140 | case cesToggleScrollBar: | 4229 | case cesToggleScrollBar: |
4141 | if (m_scrollbar != NULL) | 4230 | if (m_scrollbar != NULL) |
4142 | { | 4231 | { |
4143 | if (m_scrollbar->isHidden()) | 4232 | if (m_scrollbar->isHidden()) |
4144 | { | 4233 | { |
4145 | m_scrollishidden = false; | 4234 | m_scrollishidden = false; |
4146 | m_scrollbar->show(); | 4235 | m_scrollbar->show(); |
4147 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; | 4236 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; |
4148 | } | 4237 | } |
4149 | else | 4238 | else |
4150 | { | 4239 | { |
4151 | m_scrollishidden = true; | 4240 | m_scrollishidden = true; |
4152 | m_scrollbar->hide(); | 4241 | m_scrollbar->hide(); |
4153 | reader->m_scrollpos = m_localscroll; | 4242 | reader->m_scrollpos = m_localscroll; |
4154 | } | 4243 | } |
4155 | } | 4244 | } |
4156 | break; | 4245 | break; |
4157 | case cesToggleStatusBar: | 4246 | case cesToggleStatusBar: |
4158 | if (m_prog != NULL) | 4247 | if (m_prog != NULL) |
4159 | { | 4248 | { |
4160 | if (m_prog->isHidden()) | 4249 | if (m_prog->isHidden()) |
4161 | { | 4250 | { |
4162 | m_statusishidden = false; | 4251 | m_statusishidden = false; |
4163 | m_prog->show(); | 4252 | m_prog->show(); |
4164 | } | 4253 | } |
4165 | else | 4254 | else |
4166 | { | 4255 | { |
4167 | m_statusishidden = true; | 4256 | m_statusishidden = true; |
4168 | m_prog->hide(); | 4257 | m_prog->hide(); |
4169 | } | 4258 | } |
4170 | } | 4259 | } |
4171 | break; | 4260 | break; |
4172 | case cesOpenFile: | 4261 | case cesOpenFile: |
4173 | { | 4262 | { |
4174 | qDebug("Open file"); | 4263 | qDebug("Open file"); |
4175 | fileOpen(); | 4264 | fileOpen(); |
4176 | } | 4265 | } |
4177 | break; | 4266 | break; |
4178 | case cesAutoScroll: | 4267 | case cesAutoScroll: |
@@ -4295,172 +4384,178 @@ void QTReaderApp::do_saveconfig(const QString& _txt, bool full) | |||
4295 | configname = Global::applicationFileName(APPDIR "/configs", _txt); | 4384 | configname = Global::applicationFileName(APPDIR "/configs", _txt); |
4296 | dom = Config::File; | 4385 | dom = Config::File; |
4297 | } | 4386 | } |
4298 | 4387 | ||
4299 | Config config(configname, dom); | 4388 | Config config(configname, dom); |
4300 | config.setGroup( "View" ); | 4389 | config.setGroup( "View" ); |
4301 | 4390 | ||
4302 | #else | 4391 | #else |
4303 | QFileInfo fi; | 4392 | QFileInfo fi; |
4304 | if (full) | 4393 | if (full) |
4305 | { | 4394 | { |
4306 | // qDebug("full:%s", (const char*)_txt); | 4395 | // qDebug("full:%s", (const char*)_txt); |
4307 | QDir d = QDir::home(); // "/" | 4396 | QDir d = QDir::home(); // "/" |
4308 | if ( !d.cd(_txt) ) | 4397 | if ( !d.cd(_txt) ) |
4309 | { // "/tmp" | 4398 | { // "/tmp" |
4310 | qWarning( "Cannot find the \"~/%s\" directory", (const char*)_txt ); | 4399 | qWarning( "Cannot find the \"~/%s\" directory", (const char*)_txt ); |
4311 | d = QDir::home(); | 4400 | d = QDir::home(); |
4312 | d.mkdir(_txt); | 4401 | d.mkdir(_txt); |
4313 | d.cd(_txt); | 4402 | d.cd(_txt); |
4314 | } | 4403 | } |
4315 | fi.setFile(d, INIFILE); | 4404 | fi.setFile(d, INIFILE); |
4316 | } | 4405 | } |
4317 | else | 4406 | else |
4318 | { | 4407 | { |
4319 | QDir d = QDir::home(); // "/" | 4408 | QDir d = QDir::home(); // "/" |
4320 | if ( !d.cd(APPDIR) ) | 4409 | if ( !d.cd(APPDIR) ) |
4321 | { // "/tmp" | 4410 | { // "/tmp" |
4322 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 4411 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); |
4323 | d = QDir::home(); | 4412 | d = QDir::home(); |
4324 | d.mkdir(APPDIR); | 4413 | d.mkdir(APPDIR); |
4325 | d.cd(APPDIR); | 4414 | d.cd(APPDIR); |
4326 | } | 4415 | } |
4327 | if ( !d.cd("configs") ) | 4416 | if ( !d.cd("configs") ) |
4328 | { // "/tmp" | 4417 | { // "/tmp" |
4329 | qWarning( "Cannot find the \"~/" APPDIR "/configs\" directory" ); | 4418 | qWarning( "Cannot find the \"~/" APPDIR "/configs\" directory" ); |
4330 | d = QDir::home(); | 4419 | d = QDir::home(); |
4331 | d.cd(APPDIR); | 4420 | d.cd(APPDIR); |
4332 | d.mkdir("configs"); | 4421 | d.mkdir("configs"); |
4333 | d.cd("configs"); | 4422 | d.cd("configs"); |
4334 | } | 4423 | } |
4335 | fi.setFile(d, _txt); | 4424 | fi.setFile(d, _txt); |
4336 | } | 4425 | } |
4337 | //qDebug("Path:%s", (const char*)fi.absFilePath()); | 4426 | //qDebug("Path:%s", (const char*)fi.absFilePath()); |
4338 | Config config(fi.absFilePath()); | 4427 | Config config(fi.absFilePath()); |
4339 | #endif | 4428 | #endif |
4340 | 4429 | ||
4341 | 4430 | ||
4342 | config.writeEntry( "StripCr", reader->bstripcr ); | 4431 | config.writeEntry( "StripCr", reader->bstripcr ); |
4432 | config.writeEntry( "NoInlineTables", reader->bNoInlineTables ); | ||
4343 | config.writeEntry( "AutoFmt", reader->bautofmt ); | 4433 | config.writeEntry( "AutoFmt", reader->bautofmt ); |
4344 | config.writeEntry( "TextFmt", reader->btextfmt ); | 4434 | config.writeEntry( "TextFmt", reader->btextfmt ); |
4345 | config.writeEntry( "StripHtml", reader->bstriphtml ); | 4435 | config.writeEntry( "StripHtml", reader->bstriphtml ); |
4346 | config.writeEntry( "Dehyphen", reader->bdehyphen ); | 4436 | config.writeEntry( "Dehyphen", reader->bdehyphen ); |
4347 | config.writeEntry( "Depluck", reader->bdepluck ); | 4437 | config.writeEntry( "Depluck", reader->bdepluck ); |
4348 | config.writeEntry( "Dejpluck", reader->bdejpluck ); | 4438 | config.writeEntry( "Dejpluck", reader->bdejpluck ); |
4349 | config.writeEntry( "OneSpace", reader->bonespace ); | 4439 | config.writeEntry( "OneSpace", reader->bonespace ); |
4350 | config.writeEntry( "Unindent", reader->bunindent ); | 4440 | config.writeEntry( "Unindent", reader->bunindent ); |
4351 | config.writeEntry( "Repara", reader->brepara ); | 4441 | config.writeEntry( "Repara", reader->brepara ); |
4352 | config.writeEntry( "ReparaString", reader->m_reparastring); | 4442 | config.writeEntry( "ReparaString", reader->m_reparastring); |
4353 | config.writeEntry( "BackgroundType" , (int)m_bgtype ); | 4443 | config.writeEntry( "BackgroundType" , (int)m_bgtype ); |
4354 | config.writeEntry( "Theme", m_themename ); | 4444 | config.writeEntry( "Theme", m_themename ); |
4355 | config.writeEntry( "DoubleSpace", reader->bdblspce ); | 4445 | config.writeEntry( "DoubleSpace", reader->bdblspce ); |
4356 | config.writeEntry( "Indent", reader->bindenter ); | 4446 | config.writeEntry( "Indent", reader->bindenter ); |
4357 | config.writeEntry( "FontSize", (int)(reader->m_fontControl.currentsize()) ); | 4447 | config.writeEntry( "FontSize", (int)(reader->m_fontControl.currentsize()) ); |
4358 | config.writeEntry( "ScrollDelay", reader->m_delay); | 4448 | config.writeEntry( "ScrollDelay", reader->m_delay); |
4359 | config.writeEntry( "ScrollStep", reader->m_scrollstep); | 4449 | config.writeEntry( "ScrollStep", reader->m_scrollstep); |
4360 | config.writeEntry( "ScrollType", reader->m_scrolltype ); | 4450 | config.writeEntry( "ScrollType", reader->m_scrolltype ); |
4361 | if (full) | 4451 | if (full) |
4362 | { | 4452 | { |
4363 | config.writeEntry("Debounce", m_debounce); | 4453 | config.writeEntry("Debounce", m_debounce); |
4364 | config.writeEntry("FloatDialogs", m_bFloatingDialog); | 4454 | config.writeEntry("FloatDialogs", m_bFloatingDialog); |
4365 | reader->m_lastposn = reader->pagelocate(); | 4455 | reader->m_lastposn = reader->pagelocate(); |
4366 | config.writeEntry( "LastFile", reader->m_lastfile ); | 4456 | config.writeEntry( "LastFile", reader->m_lastfile ); |
4367 | config.writeEntry( "LastPosn", (int)(reader->pagelocate()) ); | 4457 | config.writeEntry( "LastPosn", (int)(reader->pagelocate()) ); |
4458 | config.writeEntry( "OutputCodec", reader->m_outputName); | ||
4368 | } | 4459 | } |
4369 | config.writeEntry( "PageMode", reader->m_bpagemode ); | 4460 | config.writeEntry( "PageMode", reader->m_bpagemode ); |
4370 | config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced ); | 4461 | config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced ); |
4371 | config.writeEntry( "SwapMouse", reader->m_swapmouse); | 4462 | config.writeEntry( "SwapMouse", reader->m_swapmouse); |
4372 | config.writeEntry( "IsRotated", reader->m_rotated ); | 4463 | config.writeEntry( "IsRotated", reader->m_rotated ); |
4373 | config.writeEntry("StatusContent", m_statusstring); | 4464 | config.writeEntry("StatusContent", m_statusstring); |
4374 | config.writeEntry("StatusHidden", m_statusishidden); | 4465 | config.writeEntry("StatusHidden", m_statusishidden); |
4375 | config.writeEntry( "Background", m_background ); | 4466 | config.writeEntry( "Background", m_background ); |
4376 | config.writeEntry( "Foreground", m_foreground ); | 4467 | config.writeEntry( "Foreground", m_foreground ); |
4377 | config.writeEntry( "ScrollColour", m_scrollcolor ); | 4468 | config.writeEntry( "ScrollColour", m_scrollcolor ); |
4378 | config.writeEntry( "ScrollBarColour", m_scrollbarcolor ); | 4469 | config.writeEntry( "ScrollBarColour", m_scrollbarcolor ); |
4379 | config.writeEntry( "Hyphenate", reader->hyphenate ); | 4470 | config.writeEntry( "Hyphenate", reader->hyphenate ); |
4380 | // config.writeEntry( "CustomHyphen", reader->buffdoc.getCustomHyphen() ); | 4471 | // config.writeEntry( "CustomHyphen", reader->buffdoc.getCustomHyphen() ); |
4381 | config.writeEntry( "Fontname", reader->m_fontname ); | 4472 | config.writeEntry( "Fontname", reader->m_fontname ); |
4382 | config.writeEntry( "Encoding", reader->m_encd ); | 4473 | config.writeEntry( "Encoding", reader->m_encd ); |
4383 | config.writeEntry( "CharSpacing", reader->m_charpc ); | 4474 | config.writeEntry( "CharSpacing", reader->m_charpc ); |
4384 | config.writeEntry( "Overlap", (int)(reader->m_overlap) ); | 4475 | config.writeEntry( "Overlap", (int)(reader->m_overlap) ); |
4385 | config.writeEntry( "Top Margin", (int)reader->m_abstopmargin ); | 4476 | config.writeEntry( "Top Margin", (int)reader->m_abstopmargin ); |
4386 | config.writeEntry( "Bottom Margin", (int)reader->m_absbottommargin ); | 4477 | config.writeEntry( "Bottom Margin", (int)reader->m_absbottommargin ); |
4387 | config.writeEntry( "Left Margin", (int)reader->m_absleft_border ); | 4478 | config.writeEntry( "Left Margin", (int)reader->m_absleft_border ); |
4388 | config.writeEntry( "Right Margin", (int)reader->m_absright_border ); | 4479 | config.writeEntry( "Right Margin", (int)reader->m_absright_border ); |
4389 | config.writeEntry( "TargetApp", m_targetapp ); | 4480 | config.writeEntry( "TargetApp", m_targetapp ); |
4390 | config.writeEntry( "TargetMsg", m_targetmsg ); | 4481 | config.writeEntry( "TargetMsg", m_targetmsg ); |
4391 | #ifdef _SCROLLPIPE | 4482 | #ifdef _SCROLLPIPE |
4392 | config.writeEntry( "PipeTarget", reader->m_pipetarget ); | 4483 | config.writeEntry( "PipeTarget", reader->m_pipetarget ); |
4393 | config.writeEntry( "PauseAfterPara", reader->m_pauseAfterEachPara ); | 4484 | config.writeEntry( "PauseAfterPara", reader->m_pauseAfterEachPara ); |
4394 | #endif | 4485 | #endif |
4395 | config.writeEntry( "TwoTouch", m_twoTouch ); | 4486 | config.writeEntry( "TwoTouch", m_twoTouch ); |
4396 | config.writeEntry( "Annotation", m_doAnnotation); | 4487 | config.writeEntry( "Annotation", m_doAnnotation); |
4397 | config.writeEntry( "Dictionary", m_doDictionary); | 4488 | config.writeEntry( "Dictionary", m_doDictionary); |
4398 | config.writeEntry( "Clipboard", m_doClipboard); | 4489 | config.writeEntry( "Clipboard", m_doClipboard); |
4490 | config.writeEntry( "OutputTgt", m_doOutput); | ||
4399 | /* | 4491 | /* |
4400 | config.writeEntry( "SpaceTarget", m_spaceTarget); | 4492 | config.writeEntry( "SpaceTarget", m_spaceTarget); |
4401 | config.writeEntry( "EscapeTarget", m_escapeTarget); | 4493 | config.writeEntry( "EscapeTarget", m_escapeTarget); |
4402 | config.writeEntry( "ReturnTarget", m_returnTarget); | 4494 | config.writeEntry( "ReturnTarget", m_returnTarget); |
4403 | config.writeEntry( "LeftTarget", m_leftTarget); | 4495 | config.writeEntry( "LeftTarget", m_leftTarget); |
4404 | config.writeEntry( "RightTarget", m_rightTarget); | 4496 | config.writeEntry( "RightTarget", m_rightTarget); |
4405 | config.writeEntry( "UpTarget", m_upTarget); | 4497 | config.writeEntry( "UpTarget", m_upTarget); |
4406 | config.writeEntry( "DownTarget", m_downTarget); | 4498 | config.writeEntry( "DownTarget", m_downTarget); |
4407 | config.writeEntry("LeftScroll", m_leftScroll); | 4499 | config.writeEntry("LeftScroll", m_leftScroll); |
4408 | config.writeEntry("RightScroll", m_rightScroll); | 4500 | config.writeEntry("RightScroll", m_rightScroll); |
4409 | config.writeEntry("UpScroll", m_upScroll); | 4501 | config.writeEntry("UpScroll", m_upScroll); |
4410 | config.writeEntry("DownScroll", m_downScroll); | 4502 | config.writeEntry("DownScroll", m_downScroll); |
4411 | */ | 4503 | */ |
4412 | config.writeEntry( "Repalm", reader->brepalm ); | 4504 | config.writeEntry( "Repalm", reader->brepalm ); |
4505 | config.writeEntry( "UnderlineLink", reader->bunderlineLink ); | ||
4413 | config.writeEntry( "HideScrollBar", m_scrollishidden ); | 4506 | config.writeEntry( "HideScrollBar", m_scrollishidden ); |
4507 | config.writeEntry( "HideToolBar", m_hidebars ); | ||
4414 | config.writeEntry( "Kern", reader->bkern ); | 4508 | config.writeEntry( "Kern", reader->bkern ); |
4415 | config.writeEntry( "Remap", reader->bremap ); | 4509 | config.writeEntry( "Remap", reader->bremap ); |
4416 | config.writeEntry( "Peanut", reader->bpeanut ); | 4510 | config.writeEntry( "Peanut", reader->bpeanut ); |
4417 | config.writeEntry( "MakeBold", reader->bmakebold ); | 4511 | config.writeEntry( "MakeBold", reader->bmakebold ); |
4418 | config.writeEntry( "Continuous", reader->m_continuousDocument ); | 4512 | config.writeEntry( "Continuous", reader->m_continuousDocument ); |
4513 | config.writeEntry( "DoubleBuffer", reader->m_doubleBuffered); | ||
4419 | config.writeEntry( "FullJust", reader->bfulljust ); | 4514 | config.writeEntry( "FullJust", reader->bfulljust ); |
4420 | // config.writeEntry( "Negative", reader->bNegative ); | 4515 | // config.writeEntry( "Negative", reader->bNegative ); |
4421 | config.writeEntry( "Inverse", reader->bInverse ); | 4516 | config.writeEntry( "Inverse", reader->bInverse ); |
4422 | config.writeEntry( "FixGraphics", reader->m_fontControl.FixGraphics()); | 4517 | config.writeEntry( "FixGraphics", reader->m_fontControl.FixGraphics()); |
4423 | config.writeEntry( "ExtraSpace", reader->getextraspace() ); | 4518 | config.writeEntry( "ExtraSpace", reader->getextraspace() ); |
4424 | config.writeEntry( "ExtraLead", reader->getlead() ); | 4519 | config.writeEntry( "ExtraLead", reader->getlead() ); |
4425 | config.writeEntry( "Basesize", (int)reader->getBaseSize()); | 4520 | config.writeEntry( "Basesize", (int)reader->getBaseSize()); |
4426 | config.writeEntry( "RequestorFontChange", m_propogatefontchange); | 4521 | config.writeEntry( "RequestorFontChange", m_propogatefontchange); |
4427 | #ifdef USEQPE | 4522 | #ifdef USEQPE |
4428 | config.writeEntry( "GrabKeyboard", m_grabkeyboard ); | 4523 | config.writeEntry( "GrabKeyboard", m_grabkeyboard ); |
4429 | #endif | 4524 | #endif |
4430 | if (full) | 4525 | if (full) |
4431 | { | 4526 | { |
4432 | config.setGroup( "Toolbar" ); | 4527 | config.setGroup( "Toolbar" ); |
4433 | config.writeEntry("QTScrollBar", m_qtscroll); | 4528 | config.writeEntry("QTScrollBar", m_qtscroll); |
4434 | config.writeEntry("LocalScrollBar", m_localscroll); | 4529 | config.writeEntry("LocalScrollBar", m_localscroll); |
4435 | config.writeEntry("Movable", m_tbmovesave); | 4530 | config.writeEntry("Movable", m_tbmovesave); |
4436 | config.writeEntry("Policy", m_tbpolsave); | 4531 | config.writeEntry("Policy", m_tbpolsave); |
4437 | config.writeEntry("Position", m_tbposition); | 4532 | config.writeEntry("Position", m_tbposition); |
4438 | #ifndef USEQPE | 4533 | #ifndef USEQPE |
4439 | if (!isMaximized() && !isMinimized()) | 4534 | if (!isMaximized() && !isMinimized()) |
4440 | { | 4535 | { |
4441 | config.setGroup( "Geometry" ); | 4536 | config.setGroup( "Geometry" ); |
4442 | config.writeEntry( "x", x() ); | 4537 | config.writeEntry( "x", x() ); |
4443 | config.writeEntry( "y", y() ); | 4538 | config.writeEntry( "y", y() ); |
4444 | config.writeEntry( "width", width() ); | 4539 | config.writeEntry( "width", width() ); |
4445 | config.writeEntry( "height", height() ); | 4540 | config.writeEntry( "height", height() ); |
4446 | } | 4541 | } |
4447 | #endif | 4542 | #endif |
4448 | } | 4543 | } |
4449 | } | 4544 | } |
4450 | 4545 | ||
4451 | #ifdef _SCROLLPIPE | 4546 | #ifdef _SCROLLPIPE |
4452 | void QTReaderApp::setpipetarget() | 4547 | void QTReaderApp::setpipetarget() |
4453 | { | 4548 | { |
4454 | m_nRegAction = cSetPipeTarget; | 4549 | m_nRegAction = cSetPipeTarget; |
4455 | QString text = (reader->m_pipetarget.isEmpty()) ? QString("") : reader->m_pipetarget; | 4550 | QString text = (reader->m_pipetarget.isEmpty()) ? QString("") : reader->m_pipetarget; |
4456 | regEdit->setText(text); | 4551 | regEdit->setText(text); |
4457 | do_regedit(); | 4552 | do_regedit(); |
4458 | } | 4553 | } |
4459 | 4554 | ||
4460 | void QTReaderApp::do_setpipetarget(const QString& _txt) | 4555 | void QTReaderApp::do_setpipetarget(const QString& _txt) |
4461 | { | 4556 | { |
4462 | reader->m_pipetarget = _txt; | 4557 | reader->m_pipetarget = _txt; |
4463 | } | 4558 | } |
4464 | 4559 | ||
4465 | void QTReaderApp::setpause(bool sfs) | 4560 | void QTReaderApp::setpause(bool sfs) |
4466 | { | 4561 | { |
@@ -4474,312 +4569,319 @@ void QTReaderApp::monospace(bool _b) | |||
4474 | } | 4569 | } |
4475 | 4570 | ||
4476 | bool QTReaderApp::readconfig(const QString& dirname, const QString& _txt, bool full=false) | 4571 | bool QTReaderApp::readconfig(const QString& dirname, const QString& _txt, bool full=false) |
4477 | { | 4572 | { |
4478 | #ifdef USEQPE | 4573 | #ifdef USEQPE |
4479 | QString configname; | 4574 | QString configname; |
4480 | Config::Domain dom; | 4575 | Config::Domain dom; |
4481 | 4576 | ||
4482 | if (full) | 4577 | if (full) |
4483 | { | 4578 | { |
4484 | configname = _txt; | 4579 | configname = _txt; |
4485 | dom = Config::User; | 4580 | dom = Config::User; |
4486 | } | 4581 | } |
4487 | else | 4582 | else |
4488 | { | 4583 | { |
4489 | configname = Global::applicationFileName(dirname, _txt); | 4584 | configname = Global::applicationFileName(dirname, _txt); |
4490 | QFileInfo fm(configname); | 4585 | QFileInfo fm(configname); |
4491 | if ( !fm.exists() ) return false; | 4586 | if ( !fm.exists() ) return false; |
4492 | dom = Config::File; | 4587 | dom = Config::File; |
4493 | } | 4588 | } |
4494 | 4589 | ||
4495 | Config config(configname, dom); | 4590 | Config config(configname, dom); |
4496 | config.setGroup( "View" ); | 4591 | config.setGroup( "View" ); |
4497 | 4592 | ||
4498 | #else | 4593 | #else |
4499 | QString fullname; | 4594 | QString fullname; |
4500 | if (full) | 4595 | if (full) |
4501 | { | 4596 | { |
4502 | fullname = QDir::homeDirPath() + "/" + _txt + "/" + INIFILE; | 4597 | fullname = QDir::homeDirPath() + "/" + _txt + "/" + INIFILE; |
4503 | } | 4598 | } |
4504 | else | 4599 | else |
4505 | { | 4600 | { |
4506 | fullname = QDir::homeDirPath() + "/" + dirname + "/" + _txt; | 4601 | fullname = QDir::homeDirPath() + "/" + dirname + "/" + _txt; |
4507 | } | 4602 | } |
4508 | if (!QFile::exists(fullname)) return false; | 4603 | if (!QFile::exists(fullname)) return false; |
4509 | 4604 | ||
4510 | Config config(fullname); | 4605 | Config config(fullname); |
4511 | #endif | 4606 | #endif |
4512 | if (full) | 4607 | if (full) |
4513 | { | 4608 | { |
4514 | config.setGroup("Toolbar"); | 4609 | config.setGroup("Toolbar"); |
4515 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", m_tbmovesave); | 4610 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", m_tbmovesave); |
4516 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", m_tbpolsave); | 4611 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", m_tbpolsave); |
4517 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", m_tbposition); | 4612 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", m_tbposition); |
4518 | } | 4613 | } |
4519 | config.setGroup( "View" ); | 4614 | config.setGroup( "View" ); |
4520 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", m_bFloatingDialog); | 4615 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", m_bFloatingDialog); |
4521 | reader->bstripcr = config.readBoolEntry( "StripCr", reader->bstripcr ); | 4616 | reader->bstripcr = config.readBoolEntry( "StripCr", reader->bstripcr ); |
4617 | reader->bNoInlineTables = config.readBoolEntry( "NoInlineTables", reader->bNoInlineTables ); | ||
4522 | reader->bfulljust = config.readBoolEntry( "FullJust", reader->bfulljust ); | 4618 | reader->bfulljust = config.readBoolEntry( "FullJust", reader->bfulljust ); |
4523 | reader->bInverse = config.readBoolEntry( "Inverse", reader->bInverse ); | 4619 | reader->bInverse = config.readBoolEntry( "Inverse", reader->bInverse ); |
4524 | // reader->bNegative = config.readBoolEntry( "Negative", false ); | 4620 | // reader->bNegative = config.readBoolEntry( "Negative", false ); |
4525 | reader->m_fontControl.FixGraphics(config.readBoolEntry( "FixGraphics", reader->m_fontControl.FixGraphics() )); | 4621 | reader->m_fontControl.FixGraphics(config.readBoolEntry( "FixGraphics", reader->m_fontControl.FixGraphics() )); |
4526 | reader->setextraspace(config.readNumEntry( "ExtraSpace", reader->getextraspace() )); | 4622 | reader->setextraspace(config.readNumEntry( "ExtraSpace", reader->getextraspace() )); |
4527 | reader->setlead(config.readNumEntry( "ExtraLead", reader->getlead() )); | 4623 | reader->setlead(config.readNumEntry( "ExtraLead", reader->getlead() )); |
4528 | reader->btextfmt = config.readBoolEntry( "TextFmt", reader->btextfmt ); | 4624 | reader->btextfmt = config.readBoolEntry( "TextFmt", reader->btextfmt ); |
4529 | reader->bautofmt = config.readBoolEntry( "AutoFmt", reader->bautofmt ); | 4625 | reader->bautofmt = config.readBoolEntry( "AutoFmt", reader->bautofmt ); |
4530 | reader->bstriphtml = config.readBoolEntry( "StripHtml", reader->bstriphtml ); | 4626 | reader->bstriphtml = config.readBoolEntry( "StripHtml", reader->bstriphtml ); |
4531 | reader->bpeanut = config.readBoolEntry( "Peanut", reader->bpeanut ); | 4627 | reader->bpeanut = config.readBoolEntry( "Peanut", reader->bpeanut ); |
4532 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", reader->bdehyphen ); | 4628 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", reader->bdehyphen ); |
4533 | reader->bdepluck = config.readBoolEntry( "Depluck", reader->bdepluck ); | 4629 | reader->bdepluck = config.readBoolEntry( "Depluck", reader->bdepluck ); |
4534 | reader->bdejpluck = config.readBoolEntry( "Dejpluck", reader->bdejpluck ); | 4630 | reader->bdejpluck = config.readBoolEntry( "Dejpluck", reader->bdejpluck ); |
4535 | reader->bonespace = config.readBoolEntry( "OneSpace", reader->bonespace ); | 4631 | reader->bonespace = config.readBoolEntry( "OneSpace", reader->bonespace ); |
4536 | reader->bunindent = config.readBoolEntry( "Unindent", reader->bunindent ); | 4632 | reader->bunindent = config.readBoolEntry( "Unindent", reader->bunindent ); |
4537 | reader->brepara = config.readBoolEntry( "Repara", reader->brepara ); | 4633 | reader->brepara = config.readBoolEntry( "Repara", reader->brepara ); |
4538 | reader->m_reparastring = config.readEntry( "ReparaString", reader->m_reparastring); | 4634 | reader->m_reparastring = config.readEntry( "ReparaString", reader->m_reparastring); |
4539 | m_bgtype = (bground)config.readNumEntry( "BackgroundType" , m_bgtype ); | 4635 | m_bgtype = (bground)config.readNumEntry( "BackgroundType" , m_bgtype ); |
4540 | m_themename = config.readEntry("Theme", m_themename ); | 4636 | m_themename = config.readEntry("Theme", m_themename ); |
4541 | reader->bdblspce = config.readBoolEntry( "DoubleSpace", reader->bdblspce ); | 4637 | reader->bdblspce = config.readBoolEntry( "DoubleSpace", reader->bdblspce ); |
4542 | reader->bindenter = config.readNumEntry( "Indent", reader->bindenter ); | 4638 | reader->bindenter = config.readNumEntry( "Indent", reader->bindenter ); |
4543 | reader->m_textsize = config.readNumEntry( "FontSize", reader->m_textsize ); | 4639 | reader->m_textsize = config.readNumEntry( "FontSize", reader->m_textsize ); |
4544 | reader->m_delay = config.readNumEntry( "ScrollDelay", reader->m_delay); | 4640 | reader->m_delay = config.readNumEntry( "ScrollDelay", reader->m_delay); |
4545 | reader->m_scrollstep = config.readNumEntry( "ScrollStep", reader->m_scrollstep); | 4641 | reader->m_scrollstep = config.readNumEntry( "ScrollStep", reader->m_scrollstep); |
4546 | reader->m_scrolltype = config.readNumEntry( "ScrollType", reader->m_scrolltype); | 4642 | reader->m_scrolltype = config.readNumEntry( "ScrollType", reader->m_scrolltype); |
4547 | if (full) | 4643 | if (full) |
4548 | { | 4644 | { |
4549 | reader->m_lastfile = config.readEntry( "LastFile", reader->m_lastfile ); | 4645 | reader->m_lastfile = config.readEntry( "LastFile", reader->m_lastfile ); |
4550 | reader->m_lastposn = config.readNumEntry( "LastPosn", reader->m_lastposn ); | 4646 | reader->m_lastposn = config.readNumEntry( "LastPosn", reader->m_lastposn ); |
4551 | } | 4647 | } |
4552 | reader->m_bpagemode = config.readBoolEntry( "PageMode", reader->m_bpagemode ); | 4648 | reader->m_bpagemode = config.readBoolEntry( "PageMode", reader->m_bpagemode ); |
4553 | reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", reader->m_bMonoSpaced); | 4649 | reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", reader->m_bMonoSpaced); |
4554 | reader->m_rotated = config.readBoolEntry( "IsRotated", reader->m_rotated ); | 4650 | reader->m_rotated = config.readBoolEntry( "IsRotated", reader->m_rotated ); |
4555 | m_statusstring = config.readEntry("StatusContent", m_statusstring); | 4651 | m_statusstring = config.readEntry("StatusContent", m_statusstring); |
4556 | m_statusishidden = config.readBoolEntry("StatusHidden", m_statusishidden); | 4652 | m_statusishidden = config.readBoolEntry("StatusHidden", m_statusishidden); |
4557 | m_background = config.readNumEntry( "Background", m_background ); | 4653 | m_background = config.readNumEntry( "Background", m_background ); |
4558 | reader->setBackground(getcolour(m_background)); | 4654 | reader->setBackground(getcolour(m_background)); |
4559 | m_foreground = config.readNumEntry( "Foreground", m_foreground ); | 4655 | m_foreground = config.readNumEntry( "Foreground", m_foreground ); |
4560 | reader->setForeground(getcolour(m_foreground)); | 4656 | reader->setForeground(getcolour(m_foreground)); |
4561 | m_scrollcolor = config.readNumEntry( "ScrollColour", m_scrollcolor); | 4657 | m_scrollcolor = config.readNumEntry( "ScrollColour", m_scrollcolor); |
4562 | setscrollcolour(); | 4658 | setscrollcolour(); |
4563 | m_scrollbarcolor = config.readNumEntry( "ScrollBarColour", m_scrollbarcolor); | 4659 | m_scrollbarcolor = config.readNumEntry( "ScrollBarColour", m_scrollbarcolor); |
4564 | setscrollbarcolour(); | 4660 | setscrollbarcolour(); |
4565 | reader->hyphenate = config.readBoolEntry( "Hyphenate", reader->hyphenate ); | 4661 | reader->hyphenate = config.readBoolEntry( "Hyphenate", reader->hyphenate ); |
4566 | // reader->buffdoc.setCustomHyphen(config.readBoolEntry( "CustomHyphen", false )); | 4662 | // reader->buffdoc.setCustomHyphen(config.readBoolEntry( "CustomHyphen", false )); |
4567 | reader->m_swapmouse = config.readBoolEntry( "SwapMouse", reader->m_swapmouse); | 4663 | reader->m_swapmouse = config.readBoolEntry( "SwapMouse", reader->m_swapmouse); |
4568 | reader->m_fontname = config.readEntry( "Fontname", reader->m_fontname ); | 4664 | reader->m_fontname = config.readEntry( "Fontname", reader->m_fontname ); |
4569 | reader->m_encd = config.readNumEntry( "Encoding", reader->m_encd ); | 4665 | reader->m_encd = config.readNumEntry( "Encoding", reader->m_encd ); |
4570 | reader->m_charpc = config.readNumEntry( "CharSpacing", reader->m_charpc ); | 4666 | reader->m_charpc = config.readNumEntry( "CharSpacing", reader->m_charpc ); |
4571 | reader->m_overlap = config.readNumEntry( "Overlap", reader->m_overlap ); | 4667 | reader->m_overlap = config.readNumEntry( "Overlap", reader->m_overlap ); |
4572 | reader->m_abstopmargin = config.readNumEntry( "Top Margin", reader->m_abstopmargin ); | 4668 | reader->m_abstopmargin = config.readNumEntry( "Top Margin", reader->m_abstopmargin ); |
4573 | reader->m_absbottommargin = config.readNumEntry( "Bottom Margin", reader->m_absbottommargin ); | 4669 | reader->m_absbottommargin = config.readNumEntry( "Bottom Margin", reader->m_absbottommargin ); |
4574 | reader->m_absleft_border = config.readNumEntry( "Left Margin", reader->m_absleft_border ); | 4670 | reader->m_absleft_border = config.readNumEntry( "Left Margin", reader->m_absleft_border ); |
4575 | reader->m_absright_border = config.readNumEntry( "Right Margin", reader->m_absright_border ); | 4671 | reader->m_absright_border = config.readNumEntry( "Right Margin", reader->m_absright_border ); |
4576 | m_scrollishidden = config.readBoolEntry( "HideScrollBar", m_scrollishidden ); | 4672 | m_scrollishidden = config.readBoolEntry( "HideScrollBar", m_scrollishidden ); |
4673 | m_hidebars = config.readBoolEntry( "HideToolBar", m_hidebars ); | ||
4577 | reader->brepalm = config.readBoolEntry( "Repalm", reader->brepalm ); | 4674 | reader->brepalm = config.readBoolEntry( "Repalm", reader->brepalm ); |
4675 | reader->bunderlineLink = config.readBoolEntry( "UnderlineLink", reader->bunderlineLink ); | ||
4578 | reader->bkern = config.readBoolEntry( "Kern", reader->bkern ); | 4676 | reader->bkern = config.readBoolEntry( "Kern", reader->bkern ); |
4579 | reader->bremap = config.readBoolEntry( "Remap", reader->bremap ); | 4677 | reader->bremap = config.readBoolEntry( "Remap", reader->bremap ); |
4580 | reader->bmakebold = config.readBoolEntry( "MakeBold", reader->bmakebold ); | 4678 | reader->bmakebold = config.readBoolEntry( "MakeBold", reader->bmakebold ); |
4581 | reader->setContinuous(config.readBoolEntry( "Continuous", reader->m_continuousDocument )); | 4679 | reader->setContinuous(config.readBoolEntry( "Continuous", reader->m_continuousDocument )); |
4680 | reader->setDoubleBuffer(config.readBoolEntry("DoubleBuffer", reader->m_doubleBuffered)); | ||
4582 | m_targetapp = config.readEntry( "TargetApp", m_targetapp ); | 4681 | m_targetapp = config.readEntry( "TargetApp", m_targetapp ); |
4583 | m_targetmsg = config.readEntry( "TargetMsg", m_targetmsg ); | 4682 | m_targetmsg = config.readEntry( "TargetMsg", m_targetmsg ); |
4584 | #ifdef _SCROLLPIPE | 4683 | #ifdef _SCROLLPIPE |
4585 | reader->m_pipetarget = config.readEntry( "PipeTarget", reader->m_pipetarget ); | 4684 | reader->m_pipetarget = config.readEntry( "PipeTarget", reader->m_pipetarget ); |
4586 | reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", reader->m_pauseAfterEachPara ); | 4685 | reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", reader->m_pauseAfterEachPara ); |
4587 | #endif | 4686 | #endif |
4588 | m_twoTouch = config.readBoolEntry( "TwoTouch", m_twoTouch); | 4687 | m_twoTouch = config.readBoolEntry( "TwoTouch", m_twoTouch); |
4589 | m_doAnnotation = config.readBoolEntry( "Annotation", m_doAnnotation); | 4688 | m_doAnnotation = config.readBoolEntry( "Annotation", m_doAnnotation); |
4590 | m_doDictionary = config.readBoolEntry( "Dictionary", m_doDictionary); | 4689 | m_doDictionary = config.readBoolEntry( "Dictionary", m_doDictionary); |
4591 | m_doClipboard = config.readBoolEntry( "Clipboard", m_doClipboard); | 4690 | m_doClipboard = config.readBoolEntry( "Clipboard", m_doClipboard); |
4691 | m_doOutput = config.readBoolEntry( "OutputTgt", m_doOutput); | ||
4592 | #ifdef USEQPE | 4692 | #ifdef USEQPE |
4593 | m_grabkeyboard = config.readBoolEntry( "GrabKeyboard", m_grabkeyboard); | 4693 | m_grabkeyboard = config.readBoolEntry( "GrabKeyboard", m_grabkeyboard); |
4594 | #endif | 4694 | #endif |
4595 | m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", m_propogatefontchange); | 4695 | m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", m_propogatefontchange); |
4596 | reader->setBaseSize(config.readNumEntry( "Basesize", reader->getBaseSize() )); | 4696 | reader->setBaseSize(config.readNumEntry( "Basesize", reader->getBaseSize() )); |
4597 | reader->setTwoTouch(m_twoTouch); | 4697 | reader->setTwoTouch(m_twoTouch); |
4698 | |||
4699 | reader->m_outputName = config.readEntry( "OutputCodec", reader->m_outputName); | ||
4598 | 4700 | ||
4599 | m_touch_action->setOn(m_twoTouch); | 4701 | m_touch_action->setOn(m_twoTouch); |
4600 | m_setmono_action->setOn(reader->m_bMonoSpaced); | 4702 | m_setmono_action->setOn(reader->m_bMonoSpaced); |
4601 | setfontHelper(reader->m_fontname); | 4703 | setfontHelper(reader->m_fontname); |
4602 | if (full) | 4704 | if (full) |
4603 | { | 4705 | { |
4604 | addtoolbars(&config); | 4706 | addtoolbars(&config); |
4605 | } | 4707 | } |
4606 | reader->setfilter(reader->getfilter()); | 4708 | reader->setfilter(reader->getfilter()); |
4607 | reader->refresh(); | 4709 | reader->refresh(); |
4608 | return true; | 4710 | return true; |
4609 | } | 4711 | } |
4610 | 4712 | ||
4611 | bool QTReaderApp::PopulateConfig(const char* tgtdir, bool usedirs) | 4713 | bool QTReaderApp::PopulateConfig(const char* tgtdir, bool usedirs) |
4612 | { | 4714 | { |
4613 | bkmkselector->clear(); | 4715 | bkmkselector->clear(); |
4614 | bkmkselector->setText("Cancel"); | 4716 | bkmkselector->setText("Cancel"); |
4615 | #ifndef USEQPE | 4717 | #ifndef USEQPE |
4616 | int cnt = 0; | 4718 | int cnt = 0; |
4617 | 4719 | ||
4618 | QDir d = QDir::home(); // "/" | 4720 | QDir d = QDir::home(); // "/" |
4619 | if ( !d.cd(APPDIR) ) { // "/tmp" | 4721 | if ( !d.cd(APPDIR) ) { // "/tmp" |
4620 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 4722 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); |
4621 | d = QDir::home(); | 4723 | d = QDir::home(); |
4622 | d.mkdir(APPDIR); | 4724 | d.mkdir(APPDIR); |
4623 | d.cd(APPDIR); | 4725 | d.cd(APPDIR); |
4624 | } | 4726 | } |
4625 | if ( !d.cd(tgtdir) ) { // "/tmp" | 4727 | if ( !d.cd(tgtdir) ) { // "/tmp" |
4626 | qWarning( "Cannot find the \"~/" APPDIR "/%s\" directory", tgtdir ); | 4728 | qWarning( "Cannot find the \"~/" APPDIR "/%s\" directory", tgtdir ); |
4627 | d = QDir::home(); | 4729 | d = QDir::home(); |
4628 | d.mkdir(tgtdir); | 4730 | d.mkdir(tgtdir); |
4629 | d.cd(tgtdir); | 4731 | d.cd(tgtdir); |
4630 | } | 4732 | } |
4631 | d.setFilter( ((usedirs) ? QDir::Dirs : QDir::Files) | QDir::NoSymLinks ); | 4733 | d.setFilter( ((usedirs) ? QDir::Dirs : QDir::Files) | QDir::NoSymLinks ); |
4632 | // d.setSorting( QDir::Size | QDir::Reversed ); | 4734 | // d.setSorting( QDir::Size | QDir::Reversed ); |
4633 | 4735 | ||
4634 | const QFileInfoList *list = d.entryInfoList(); | 4736 | const QFileInfoList *list = d.entryInfoList(); |
4635 | QFileInfoListIterator it( *list ); // create list iterator | 4737 | QFileInfoListIterator it( *list ); // create list iterator |
4636 | QFileInfo *fi; // pointer for traversing | 4738 | QFileInfo *fi; // pointer for traversing |
4637 | 4739 | ||
4638 | while ( (fi=it.current()) ) { // for each file... | 4740 | while ( (fi=it.current()) ) { // for each file... |
4639 | 4741 | ||
4640 | bkmkselector->insertItem(fi->fileName()); | 4742 | bkmkselector->insertItem(fi->fileName(), cnt++); |
4641 | cnt++; | ||
4642 | 4743 | ||
4643 | //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); | 4744 | //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); |
4644 | ++it; // goto next list element | 4745 | ++it; // goto next list element |
4645 | } | 4746 | } |
4646 | 4747 | ||
4647 | #else /* USEQPE */ | 4748 | #else /* USEQPE */ |
4648 | int cnt = 0; | 4749 | int cnt = 0; |
4649 | DIR *d; | 4750 | DIR *d; |
4650 | char* finaldir; | 4751 | char* finaldir; |
4651 | finaldir = new char[strlen(APPDIR)+1+strlen(tgtdir)+1]; | 4752 | finaldir = new char[strlen(APPDIR)+1+strlen(tgtdir)+1]; |
4652 | strcpy(finaldir, APPDIR); | 4753 | strcpy(finaldir, APPDIR); |
4653 | strcat(finaldir, "/"); | 4754 | strcat(finaldir, "/"); |
4654 | strcat(finaldir, tgtdir); | 4755 | strcat(finaldir, tgtdir); |
4655 | d = opendir((const char *)Global::applicationFileName(finaldir,"")); | 4756 | d = opendir((const char *)Global::applicationFileName(finaldir,"")); |
4656 | 4757 | ||
4657 | while(1) | 4758 | while(1) |
4658 | { | 4759 | { |
4659 | struct dirent* de; | 4760 | struct dirent* de; |
4660 | struct stat buf; | 4761 | struct stat buf; |
4661 | de = readdir(d); | 4762 | de = readdir(d); |
4662 | if (de == NULL) break; | 4763 | if (de == NULL) break; |
4663 | 4764 | ||
4664 | if (lstat((const char *)Global::applicationFileName(finaldir,de->d_name),&buf) == 0 && ((usedirs && S_ISDIR(buf.st_mode)) || (!usedirs && S_ISREG(buf.st_mode)))) | 4765 | if (lstat((const char *)Global::applicationFileName(finaldir,de->d_name),&buf) == 0 && ((usedirs && S_ISDIR(buf.st_mode)) || (!usedirs && S_ISREG(buf.st_mode)))) |
4665 | { | 4766 | { |
4666 | bkmkselector->insertItem(de->d_name); | 4767 | bkmkselector->insertItem(de->d_name, cnt++); |
4667 | cnt++; | ||
4668 | } | 4768 | } |
4669 | } | 4769 | } |
4670 | delete [] finaldir; | 4770 | delete [] finaldir; |
4671 | closedir(d); | 4771 | closedir(d); |
4672 | #endif | 4772 | #endif |
4673 | return (cnt > 0); | 4773 | return (cnt > 0); |
4674 | } | 4774 | } |
4675 | 4775 | ||
4676 | void QTReaderApp::LoadTheme() | 4776 | void QTReaderApp::LoadTheme() |
4677 | { | 4777 | { |
4678 | if (PopulateConfig("Themes", true)) | 4778 | if (PopulateConfig("Themes", true)) |
4679 | { | 4779 | { |
4680 | editorStack->raiseWidget( bkmkselector ); | 4780 | editorStack->raiseWidget( bkmkselector ); |
4681 | hidetoolbars(); | 4781 | hidetoolbars(); |
4682 | m_nBkmkAction = cLdTheme; | 4782 | m_nBkmkAction = cLdTheme; |
4683 | } | 4783 | } |
4684 | else | 4784 | else |
4685 | QMessageBox::information(this, PROGNAME, "No config files"); | 4785 | QMessageBox::information(this, PROGNAME, "No config files"); |
4686 | } | 4786 | } |
4687 | 4787 | ||
4688 | void QTReaderApp::LoadConfig() | 4788 | void QTReaderApp::LoadConfig() |
4689 | { | 4789 | { |
4690 | if (PopulateConfig("configs")) | 4790 | if (PopulateConfig("configs")) |
4691 | { | 4791 | { |
4692 | editorStack->raiseWidget( bkmkselector ); | 4792 | editorStack->raiseWidget( bkmkselector ); |
4693 | hidetoolbars(); | 4793 | hidetoolbars(); |
4694 | m_nBkmkAction = cLdConfig; | 4794 | m_nBkmkAction = cLdConfig; |
4695 | } | 4795 | } |
4696 | else | 4796 | else |
4697 | QMessageBox::information(this, PROGNAME, "No config files"); | 4797 | QMessageBox::information(this, PROGNAME, "No config files"); |
4698 | } | 4798 | } |
4699 | 4799 | ||
4700 | void QTReaderApp::TidyConfig() | 4800 | void QTReaderApp::TidyConfig() |
4701 | { | 4801 | { |
4702 | if (PopulateConfig("configs")) | 4802 | if (PopulateConfig("configs")) |
4703 | { | 4803 | { |
4704 | editorStack->raiseWidget( bkmkselector ); | 4804 | editorStack->raiseWidget( bkmkselector ); |
4705 | hidetoolbars(); | 4805 | hidetoolbars(); |
4706 | m_nBkmkAction = cRmConfig; | 4806 | m_nBkmkAction = cRmConfig; |
4707 | } | 4807 | } |
4708 | else | 4808 | else |
4709 | QMessageBox::information(this, PROGNAME, "No config files"); | 4809 | QMessageBox::information(this, PROGNAME, "No config files"); |
4710 | } | 4810 | } |
4711 | 4811 | ||
4712 | void QTReaderApp::ExportLinks() | 4812 | void QTReaderApp::ExportLinks() |
4713 | { | 4813 | { |
4714 | if (PopulateConfig("urls")) | 4814 | if (PopulateConfig("urls")) |
4715 | { | 4815 | { |
4716 | editorStack->raiseWidget( bkmkselector ); | 4816 | editorStack->raiseWidget( bkmkselector ); |
4717 | hidetoolbars(); | 4817 | hidetoolbars(); |
4718 | m_nBkmkAction = cExportLinks; | 4818 | m_nBkmkAction = cExportLinks; |
4719 | } | 4819 | } |
4720 | else | 4820 | else |
4721 | QMessageBox::information(this, PROGNAME, "No url files"); | 4821 | QMessageBox::information(this, PROGNAME, "No url files"); |
4722 | } | 4822 | } |
4723 | 4823 | ||
4724 | void QTReaderApp::OnURLSelected(const QString& href, const size_t tgt) | 4824 | void QTReaderApp::OnURLSelected(const QString& href, const size_t tgt) |
4725 | { | 4825 | { |
4726 | #ifndef USEQPE | 4826 | #ifndef USEQPE |
4727 | qDebug("URL:%s", (const char*)href); | 4827 | qDebug("URL:%s", (const char*)href); |
4728 | int col = href.find(':'); | 4828 | int col = href.find(':'); |
4729 | if (col > 0) | 4829 | if (col > 0) |
4730 | { | 4830 | { |
4731 | QString type = href.left(col); | 4831 | QString type = href.left(col); |
4732 | qDebug("Type:%s", (const char*)type); | 4832 | qDebug("Type:%s", (const char*)type); |
4733 | } | 4833 | } |
4734 | else | 4834 | else |
4735 | { | 4835 | { |
4736 | qDebug("No type"); | 4836 | qDebug("No type"); |
4737 | } | 4837 | } |
4838 | QString msg = "External URL\n" + href; | ||
4839 | QMessageBox::information(this, PROGNAME, msg); | ||
4738 | #else | 4840 | #else |
4739 | if (href.isEmpty()) | 4841 | if (href.isEmpty()) |
4740 | { | 4842 | { |
4741 | QMessageBox::information(this, PROGNAME, "No URL information supplied"); | 4843 | QMessageBox::information(this, PROGNAME, "No URL information supplied"); |
4742 | } | 4844 | } |
4743 | else | 4845 | else |
4744 | { | 4846 | { |
4745 | CURLDialog* urld = new CURLDialog(href, false, this); | 4847 | CURLDialog* urld = new CURLDialog(href, false, this); |
4746 | urld->clipboard(m_url_clipboard); | 4848 | urld->clipboard(m_url_clipboard); |
4747 | urld->localfile(m_url_localfile); | 4849 | urld->localfile(m_url_localfile); |
4748 | urld->globalfile(m_url_globalfile); | 4850 | urld->globalfile(m_url_globalfile); |
4749 | if (urld->exec()) | 4851 | if (urld->exec()) |
4750 | { | 4852 | { |
4751 | m_url_clipboard = urld->clipboard(); | 4853 | m_url_clipboard = urld->clipboard(); |
4752 | m_url_localfile = urld->localfile(); | 4854 | m_url_localfile = urld->localfile(); |
4753 | m_url_globalfile = urld->globalfile(); | 4855 | m_url_globalfile = urld->globalfile(); |
4754 | if (m_url_clipboard) | 4856 | if (m_url_clipboard) |
4755 | { | 4857 | { |
4756 | QClipboard* cb = QApplication::clipboard(); | 4858 | QClipboard* cb = QApplication::clipboard(); |
4757 | cb->setText(href); | 4859 | cb->setText(href); |
4758 | qDebug("<a href=\"%s\">%s</a>", (const char*)href, (const char*)href); | 4860 | qDebug("<a href=\"%s\">%s</a>", (const char*)href, (const char*)href); |
4759 | } | 4861 | } |
4760 | if (m_url_localfile) | 4862 | if (m_url_localfile) |
4761 | { | 4863 | { |
4762 | writeUrl(reader->m_string, href); | 4864 | writeUrl(reader->m_string, href); |
4763 | } | 4865 | } |
4764 | if (m_url_globalfile) | 4866 | if (m_url_globalfile) |
4765 | { | 4867 | { |
4766 | writeUrl("GlobalURLFile", href); | 4868 | writeUrl("GlobalURLFile", href); |
4767 | } | 4869 | } |
4768 | } | 4870 | } |
4769 | delete urld; | 4871 | delete urld; |
4770 | } | 4872 | } |
4771 | #endif | 4873 | #endif |
4772 | } | 4874 | } |
4773 | 4875 | ||
4774 | void QTReaderApp::writeUrl(const QString& file, const QString& href) | 4876 | void QTReaderApp::writeUrl(const QString& file, const QString& href) |
4775 | { | 4877 | { |
4776 | QString filename; | 4878 | QString filename; |
4777 | #ifdef USEQPE | 4879 | #ifdef USEQPE |
4778 | filename = Global::applicationFileName(APPDIR "/urls", file); | 4880 | filename = Global::applicationFileName(APPDIR "/urls", file); |
4779 | #else | 4881 | #else |
4780 | QFileInfo fi; | 4882 | QFileInfo fi; |
4781 | QDir d = QDir::home(); // "/" | 4883 | QDir d = QDir::home(); // "/" |
4782 | if ( !d.cd(APPDIR) ) | 4884 | if ( !d.cd(APPDIR) ) |
4783 | { // "/tmp" | 4885 | { // "/tmp" |
4784 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 4886 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); |
4785 | d = QDir::home(); | 4887 | d = QDir::home(); |
@@ -4856,108 +4958,112 @@ QColor QTReaderApp::getcolour(int _c) | |||
4856 | case 13: | 4958 | case 13: |
4857 | c = darkBlue; | 4959 | c = darkBlue; |
4858 | break; | 4960 | break; |
4859 | case 14: | 4961 | case 14: |
4860 | c = darkCyan; | 4962 | c = darkCyan; |
4861 | break; | 4963 | break; |
4862 | case 15: | 4964 | case 15: |
4863 | c = darkMagenta; | 4965 | c = darkMagenta; |
4864 | break; | 4966 | break; |
4865 | case 16: | 4967 | case 16: |
4866 | c = darkYellow; | 4968 | c = darkYellow; |
4867 | break; | 4969 | break; |
4868 | default: | 4970 | default: |
4869 | c = lightGray; | 4971 | c = lightGray; |
4870 | break; | 4972 | break; |
4871 | } | 4973 | } |
4872 | return c; | 4974 | return c; |
4873 | } | 4975 | } |
4874 | 4976 | ||
4875 | void QTReaderApp::setscrollcolour() | 4977 | void QTReaderApp::setscrollcolour() |
4876 | { | 4978 | { |
4877 | /* | 4979 | /* |
4878 | QColor xc = getcolour(m_scrollcolor); | 4980 | QColor xc = getcolour(m_scrollcolor); |
4879 | int r,g,b; | 4981 | int r,g,b; |
4880 | xc.rgb(&r,&g,&b); | 4982 | xc.rgb(&r,&g,&b); |
4881 | reader->m_scrollcolor.setRgb(255^r, 255^g, 255^b); | 4983 | reader->m_scrollcolor.setRgb(255^r, 255^g, 255^b); |
4882 | */ | 4984 | */ |
4883 | reader->m_scrollcolor = getcolour(m_scrollcolor); | 4985 | reader->m_scrollcolor = getcolour(m_scrollcolor); |
4884 | } | 4986 | } |
4885 | 4987 | ||
4886 | void QTReaderApp::setscrollbarcolour() | 4988 | void QTReaderApp::setscrollbarcolour() |
4887 | { | 4989 | { |
4888 | /* | 4990 | /* |
4889 | QColor xc = getcolour(m_scrollcolor); | 4991 | QColor xc = getcolour(m_scrollcolor); |
4890 | int r,g,b; | 4992 | int r,g,b; |
4891 | xc.rgb(&r,&g,&b); | 4993 | xc.rgb(&r,&g,&b); |
4892 | reader->m_scrollcolor.setRgb(255^r, 255^g, 255^b); | 4994 | reader->m_scrollcolor.setRgb(255^r, 255^g, 255^b); |
4893 | */ | 4995 | */ |
4894 | reader->m_scrollbarcolor = getcolour(m_scrollbarcolor); | 4996 | reader->m_scrollbarcolor = getcolour(m_scrollbarcolor); |
4895 | } | 4997 | } |
4896 | 4998 | ||
4897 | void QTReaderApp::forceopen(const QString& filename) | 4999 | void QTReaderApp::forceopen(const QString& filename) |
4898 | { | 5000 | { |
4899 | /* | 5001 | /* |
4900 | QFileInfo fi(reader->m_lastfile); | 5002 | QFileInfo fi(reader->m_lastfile); |
4901 | fi = QFileInfo(filename); | 5003 | fi = QFileInfo(filename); |
4902 | QString flnm = fi.absFilePath(); | 5004 | QString flnm = fi.absFilePath(); |
4903 | */ | 5005 | */ |
4904 | if (!filename.isEmpty()) | 5006 | if (!filename.isEmpty() && QFileInfo(filename).exists()) |
4905 | { | 5007 | { |
4906 | updatefileinfo(); | 5008 | updatefileinfo(); |
4907 | if (pBkmklist != NULL) | 5009 | if (pBkmklist != NULL) |
4908 | { | 5010 | { |
4909 | if (m_fBkmksChanged) | 5011 | if (m_fBkmksChanged) |
4910 | { | 5012 | { |
4911 | savebkmks(); | 5013 | savebkmks(); |
4912 | } | 5014 | } |
4913 | delete pBkmklist; | 5015 | delete pBkmklist; |
4914 | pBkmklist = NULL; | 5016 | pBkmklist = NULL; |
4915 | m_fBkmksChanged = false; | 5017 | m_fBkmksChanged = false; |
4916 | } | 5018 | } |
4917 | reader->disableAutoscroll(); | 5019 | reader->disableAutoscroll(); |
4918 | openFile(filename); | 5020 | openFile(filename); |
4919 | reader->setFocus(); | 5021 | reader->setFocus(); |
4920 | } | 5022 | } |
5023 | else | ||
5024 | { | ||
5025 | OnURLSelected(filename, 0); | ||
5026 | } | ||
4921 | } | 5027 | } |
4922 | 5028 | ||
4923 | void QTReaderApp::actionscroll(int v) | 5029 | void QTReaderApp::actionscroll(int v) |
4924 | { | 5030 | { |
4925 | if (reader->m_rotated) | 5031 | if (reader->m_rotated) |
4926 | { | 5032 | { |
4927 | reader->dopageup(reader->buffdoc.startSection()+reader->buffdoc.endSection()-v); | 5033 | reader->dopageup(reader->buffdoc.startSection()+reader->buffdoc.endSection()-v); |
4928 | } | 5034 | } |
4929 | else | 5035 | else |
4930 | { | 5036 | { |
4931 | /* | 5037 | /* |
4932 | if (reader->pagelocate() < v) | 5038 | if (reader->pagelocate() < v) |
4933 | { | 5039 | { |
4934 | while (reader->pagelocate() < v) reader->lineDown(); | 5040 | while (reader->pagelocate() < v) reader->lineDown(); |
4935 | } | 5041 | } |
4936 | else | 5042 | else |
4937 | */ | 5043 | */ |
4938 | reader->locate(v); | 5044 | reader->locate(v); |
4939 | } | 5045 | } |
4940 | } | 5046 | } |
4941 | 5047 | ||
4942 | void QTReaderApp::setBackgroundBitmap() | 5048 | void QTReaderApp::setBackgroundBitmap() |
4943 | { | 5049 | { |
4944 | #ifdef USEQPE | 5050 | #ifdef USEQPE |
4945 | QString file = APPDIR "/Themes/"; | 5051 | QString file = APPDIR "/Themes/"; |
4946 | file += m_themename; | 5052 | file += m_themename; |
4947 | QString tgt = Global::applicationFileName(file,"background"); | 5053 | QString tgt = Global::applicationFileName(file,"background"); |
4948 | #else | 5054 | #else |
4949 | QString tgt(QDir::homeDirPath()); | 5055 | QString tgt(QDir::homeDirPath()); |
4950 | tgt += QString("/" APPDIR "/Themes/") + m_themename + "/background"; | 5056 | tgt += QString("/" APPDIR "/Themes/") + m_themename + "/background"; |
4951 | #endif | 5057 | #endif |
4952 | qDebug("Trying to load %s", (const char *)tgt); | 5058 | qDebug("Trying to load %s", (const char *)tgt); |
4953 | QPixmap pm(tgt); | 5059 | QPixmap pm(tgt); |
4954 | reader->setBackgroundBitmap(pm, m_bgtype); | 5060 | reader->setBackgroundBitmap(pm, m_bgtype); |
4955 | } | 5061 | } |
4956 | 5062 | ||
4957 | /* | 5063 | /* |
4958 | 5064 | ||
4959 | myChannel = new QCopChannel( "QPE/FooBar", this ); | 5065 | myChannel = new QCopChannel( "QPE/FooBar", this ); |
4960 | connect( myChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 5066 | connect( myChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
4961 | this, SLOT(fooBarMessage( const QCString &, const QByteArray &)) ); | 5067 | this, SLOT(fooBarMessage( const QCString &, const QByteArray &)) ); |
4962 | 5068 | ||
4963 | */ | 5069 | */ |