-rw-r--r-- | noncore/apps/opie-reader/QTReaderApp.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-reader/opie-reader.control | 2 | ||||
-rw-r--r-- | noncore/apps/opie-reader/opie-reader.pro | 1 |
3 files changed, 6 insertions, 5 deletions
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp index 8ef0674..b985094 100644 --- a/noncore/apps/opie-reader/QTReaderApp.cpp +++ b/noncore/apps/opie-reader/QTReaderApp.cpp | |||
@@ -1,4402 +1,4402 @@ | |||
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 | ||
21 | #include <qregexp.h> | 21 | #include <qregexp.h> |
22 | #include <qclipboard.h> | 22 | #include <qclipboard.h> |
23 | #include <qwidgetstack.h> | 23 | #include <qwidgetstack.h> |
24 | #ifdef USEQPE | 24 | #ifdef USEQPE |
25 | #include <qpe/qpemenubar.h> | 25 | #include <qpe/qpemenubar.h> |
26 | #include <qpe/qpetoolbar.h> | 26 | #include <qpe/qpetoolbar.h> |
27 | #endif | 27 | #endif |
28 | #include <qmenubar.h> | 28 | #include <qmenubar.h> |
29 | #include <qtoolbar.h> | 29 | #include <qtoolbar.h> |
30 | #ifdef USEQPE | 30 | #ifdef USEQPE |
31 | #include <qpe/menubutton.h> | 31 | #include <qpe/menubutton.h> |
32 | #endif | 32 | #endif |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qaction.h> | 35 | #include <qaction.h> |
36 | #include <qapplication.h> | 36 | #include <qapplication.h> |
37 | #include <qlineedit.h> | 37 | #include <qlineedit.h> |
38 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
39 | #include <qspinbox.h> | 39 | #include <qspinbox.h> |
40 | #include <qobjectlist.h> | 40 | #include <qobjectlist.h> |
41 | #include <qstatusbar.h> | 41 | #include <qstatusbar.h> |
42 | #ifdef USEQPE | 42 | #ifdef USEQPE |
43 | #include <qpe/global.h> | 43 | #include <qpe/global.h> |
44 | #include <qpe/applnk.h> | 44 | #include <qpe/applnk.h> |
45 | #endif | 45 | #endif |
46 | #include <qfileinfo.h> | 46 | #include <qfileinfo.h> |
47 | #include <stdlib.h> //getenv | 47 | #include <stdlib.h> //getenv |
48 | #include <qprogressbar.h> | 48 | #include <qprogressbar.h> |
49 | #ifdef USEQPE | 49 | #ifdef USEQPE |
50 | #include <qpe/config.h> | 50 | #include <qpe/config.h> |
51 | #endif | 51 | #endif |
52 | #include <qbuttongroup.h> | 52 | #include <qbuttongroup.h> |
53 | #include <qradiobutton.h> | 53 | #include <qradiobutton.h> |
54 | #ifdef USEQPE | 54 | #ifdef USEQPE |
55 | #include <qpe/qcopenvelope_qws.h> | 55 | #include <qpe/qcopenvelope_qws.h> |
56 | #endif | 56 | #endif |
57 | #include "QTReader.h" | 57 | #include "QTReader.h" |
58 | #include "GraphicWin.h" | 58 | #include "GraphicWin.h" |
59 | #include "Bkmks.h" | 59 | #include "Bkmks.h" |
60 | #include "cbkmkselector.h" | 60 | #include "cbkmkselector.h" |
61 | #include "infowin.h" | 61 | #include "infowin.h" |
62 | #include "ToolbarPrefs.h" | 62 | #include "ToolbarPrefs.h" |
63 | #include "Prefs.h" | 63 | #include "Prefs.h" |
64 | #include "CAnnoEdit.h" | 64 | #include "CAnnoEdit.h" |
65 | #include "QFloatBar.h" | 65 | #include "QFloatBar.h" |
66 | #include "FixedFont.h" | 66 | #include "FixedFont.h" |
67 | #include "URLDialog.h" | 67 | #include "URLDialog.h" |
68 | #include "util.h" | 68 | #include "util.h" |
69 | #include <qfontdatabase.h> | 69 | #include <qfontdatabase.h> |
70 | 70 | ||
71 | #ifdef USEQPE | 71 | #ifdef USEQPE |
72 | #include <qpe/resource.h> | 72 | #include <opie2/oresource.h> |
73 | #ifdef OPIE | 73 | #ifdef OPIE |
74 | #if defined(OPIEFILEDIALOG) | 74 | #if defined(OPIEFILEDIALOG) |
75 | #include <qpe/applnk.h> | 75 | #include <qpe/applnk.h> |
76 | #include <opie2/ofiledialog.h> | 76 | #include <opie2/ofiledialog.h> |
77 | using namespace Opie::Ui; | 77 | using namespace Opie::Ui; |
78 | #else | 78 | #else |
79 | #include "fileBrowser.h" | 79 | #include "fileBrowser.h" |
80 | #endif | 80 | #endif |
81 | #else | 81 | #else |
82 | #include "fileBrowser.h" | 82 | #include "fileBrowser.h" |
83 | #endif | 83 | #endif |
84 | #else | 84 | #else |
85 | #include "qfiledialog.h" | 85 | #include "qfiledialog.h" |
86 | #endif | 86 | #endif |
87 | 87 | ||
88 | #include "QTReaderApp.h" | 88 | #include "QTReaderApp.h" |
89 | #include "CDrawBuffer.h" | 89 | #include "CDrawBuffer.h" |
90 | #include "Filedata.h" | 90 | #include "Filedata.h" |
91 | #include "names.h" | 91 | #include "names.h" |
92 | #include "CEncoding_tables.h" | 92 | #include "CEncoding_tables.h" |
93 | #include "CloseDialog.h" | 93 | #include "CloseDialog.h" |
94 | 94 | ||
95 | #include "ButtonPrefs.h" | 95 | #include "ButtonPrefs.h" |
96 | 96 | ||
97 | bool CheckVersion(int&, int&, char&, QWidget*); | 97 | bool CheckVersion(int&, int&, char&, QWidget*); |
98 | 98 | ||
99 | #ifdef _WINDOWS | 99 | #ifdef _WINDOWS |
100 | #define PICDIR "c:\\uqtreader\\pics\\" | 100 | #define PICDIR "c:\\uqtreader\\pics\\" |
101 | #else | 101 | #else |
102 | #ifdef USEQPE | 102 | #ifdef USEQPE |
103 | #define USEMSGS | 103 | #define USEMSGS |
104 | #define PICDIR "opie-reader/" | 104 | #define PICDIR "opie-reader/" |
105 | #else | 105 | #else |
106 | //#define PICDIR "/home/tim/uqtreader/pics/" | 106 | //#define PICDIR "/home/tim/uqtreader/pics/" |
107 | QString picdir() | 107 | QString picdir() |
108 | { | 108 | { |
109 | QString hd(getenv("READERDIR")); | 109 | QString hd(getenv("READERDIR")); |
110 | return hd + "/pics"; | 110 | return hd + "/pics"; |
111 | } | 111 | } |
112 | #define PICDIR picdir() | 112 | #define PICDIR picdir() |
113 | #endif | 113 | #endif |
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | unsigned long QTReaderApp::m_uid = 0; | 116 | unsigned long QTReaderApp::m_uid = 0; |
117 | 117 | ||
118 | void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); } | 118 | void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); } |
119 | 119 | ||
120 | #ifdef USEQPE | 120 | #ifdef USEQPE |
121 | #define geticon(iconname) Resource::loadPixmap( iconname ) | 121 | #define geticon(iconname) Opie::Core::OResource::loadPixmap( iconname, Opie::Core::OResource::SmallIcon ) |
122 | #define getmyicon(iconname) Resource::loadPixmap( PICDIR iconname ) | 122 | #define getmyicon(iconname) Opie::Core::OResource::loadPixmap( PICDIR iconname, Opie::Core::OResource::SmallIcon ) |
123 | #else | 123 | #else |
124 | //#define geticon(iconname) QPixmap(PICDIR iconname ".png") | 124 | //#define geticon(iconname) QPixmap(PICDIR iconname ".png") |
125 | #define geticon(iconname) QPixmap(PICDIR +"/"+iconname+".png") | 125 | #define geticon(iconname) QPixmap(PICDIR +"/"+iconname+".png") |
126 | #define getmyicon(iconname) geticon(iconname) | 126 | #define getmyicon(iconname) geticon(iconname) |
127 | //#define geticon(iconname) QIconSet( QPixmap(PICDIR iconname) ) | 127 | //#define geticon(iconname) QIconSet( QPixmap(PICDIR iconname) ) |
128 | #endif | 128 | #endif |
129 | 129 | ||
130 | #ifndef _WINDOWS | 130 | #ifndef _WINDOWS |
131 | #include <unistd.h> | 131 | #include <unistd.h> |
132 | #endif | 132 | #endif |
133 | #include <stddef.h> | 133 | #include <stddef.h> |
134 | #ifndef _WINDOWS | 134 | #ifndef _WINDOWS |
135 | #include <dirent.h> | 135 | #include <dirent.h> |
136 | #endif | 136 | #endif |
137 | 137 | ||
138 | void QTReaderApp::listBkmkFiles() | 138 | void QTReaderApp::listBkmkFiles() |
139 | { | 139 | { |
140 | bkmkselector->clear(); | 140 | bkmkselector->clear(); |
141 | bkmkselector->setText("Cancel"); | 141 | bkmkselector->setText("Cancel"); |
142 | #ifndef USEQPE | 142 | #ifndef USEQPE |
143 | int cnt = 0; | 143 | int cnt = 0; |
144 | 144 | ||
145 | QDir d = QDir::home(); // "/" | 145 | QDir d = QDir::home(); // "/" |
146 | if ( !d.cd(APPDIR) ) { // "/tmp" | 146 | if ( !d.cd(APPDIR) ) { // "/tmp" |
147 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 147 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); |
148 | d = QDir::home(); | 148 | d = QDir::home(); |
149 | d.mkdir(APPDIR); | 149 | d.mkdir(APPDIR); |
150 | d.cd(APPDIR); | 150 | d.cd(APPDIR); |
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | 154 | ||
155 | 155 | ||
156 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 156 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
157 | // d.setSorting( QDir::Size | QDir::Reversed ); | 157 | // d.setSorting( QDir::Size | QDir::Reversed ); |
158 | 158 | ||
159 | const QFileInfoList *list = d.entryInfoList(); | 159 | const QFileInfoList *list = d.entryInfoList(); |
160 | QFileInfoListIterator it( *list ); // create list iterator | 160 | QFileInfoListIterator it( *list ); // create list iterator |
161 | QFileInfo *fi; // pointer for traversing | 161 | QFileInfo *fi; // pointer for traversing |
162 | while ( (fi=it.current()) ) { // for each file... | 162 | while ( (fi=it.current()) ) { // for each file... |
163 | 163 | ||
164 | bkmkselector->insertItem(fi->fileName(), cnt++); | 164 | bkmkselector->insertItem(fi->fileName(), cnt++); |
165 | 165 | ||
166 | //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); | 166 | //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); |
167 | ++it; // goto next list element | 167 | ++it; // goto next list element |
168 | } | 168 | } |
169 | 169 | ||
170 | #else /* USEQPE */ | 170 | #else /* USEQPE */ |
171 | int cnt = 0; | 171 | int cnt = 0; |
172 | DIR *d; | 172 | DIR *d; |
173 | d = opendir((const char *)Global::applicationFileName(APPDIR,"")); | 173 | d = opendir((const char *)Global::applicationFileName(APPDIR,"")); |
174 | 174 | ||
175 | while(1) | 175 | while(1) |
176 | { | 176 | { |
177 | struct dirent* de; | 177 | struct dirent* de; |
178 | struct stat buf; | 178 | struct stat buf; |
179 | de = readdir(d); | 179 | de = readdir(d); |
180 | if (de == NULL) break; | 180 | if (de == NULL) break; |
181 | 181 | ||
182 | 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)) |
183 | { | 183 | { |
184 | bkmkselector->insertItem(de->d_name, cnt++); | 184 | bkmkselector->insertItem(de->d_name, cnt++); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | closedir(d); | 188 | closedir(d); |
189 | #endif | 189 | #endif |
190 | if (cnt > 0) | 190 | if (cnt > 0) |
191 | { | 191 | { |
192 | //tjw menu->hide(); | 192 | //tjw menu->hide(); |
193 | 193 | ||
194 | 194 | ||
195 | editorStack->raiseWidget( bkmkselector ); | 195 | editorStack->raiseWidget( bkmkselector ); |
196 | hidetoolbars(); | 196 | hidetoolbars(); |
197 | m_nBkmkAction = cRmBkmkFile; | 197 | m_nBkmkAction = cRmBkmkFile; |
198 | } | 198 | } |
199 | else | 199 | else |
200 | QMessageBox::information(this, PROGNAME, "No bookmark files"); | 200 | QMessageBox::information(this, PROGNAME, "No bookmark files"); |
201 | } | 201 | } |
202 | 202 | ||
203 | void QTReaderApp::hidetoolbars() | 203 | void QTReaderApp::hidetoolbars() |
204 | { | 204 | { |
205 | if (m_scrollbar != NULL) m_scrollbar->hide(); | 205 | if (m_scrollbar != NULL) m_scrollbar->hide(); |
206 | if (m_prog != NULL) m_prog->hide(); | 206 | if (m_prog != NULL) m_prog->hide(); |
207 | 207 | ||
208 | #if defined(USEQPE) | 208 | #if defined(USEQPE) |
209 | menubar->hide(); | 209 | menubar->hide(); |
210 | #endif | 210 | #endif |
211 | 211 | ||
212 | if (m_scrollbar != NULL) m_scrollbar->hide(); | 212 | if (m_scrollbar != NULL) m_scrollbar->hide(); |
213 | 213 | ||
214 | if (fileBar != NULL) fileBar->hide(); | 214 | if (fileBar != NULL) fileBar->hide(); |
215 | if (viewBar != NULL) viewBar->hide(); | 215 | if (viewBar != NULL) viewBar->hide(); |
216 | if (navBar != NULL) navBar->hide(); | 216 | if (navBar != NULL) navBar->hide(); |
217 | if (markBar != NULL) markBar->hide(); | 217 | if (markBar != NULL) markBar->hide(); |
218 | if (m_fontVisible) m_fontBar->hide(); | 218 | if (m_fontVisible) m_fontBar->hide(); |
219 | if (regVisible) | 219 | if (regVisible) |
220 | { | 220 | { |
221 | #ifdef USEQPE | 221 | #ifdef USEQPE |
222 | Global::hideInputMethod(); | 222 | Global::hideInputMethod(); |
223 | #endif | 223 | #endif |
224 | regBar->hide(); | 224 | regBar->hide(); |
225 | } | 225 | } |
226 | if (searchVisible) | 226 | if (searchVisible) |
227 | { | 227 | { |
228 | #ifdef USEQPE | 228 | #ifdef USEQPE |
229 | Global::hideInputMethod(); | 229 | Global::hideInputMethod(); |
230 | #endif | 230 | #endif |
231 | searchBar->hide(); | 231 | searchBar->hide(); |
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | 235 | QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) |
236 | : QMainWindow( parent, name, f ), m_dontSave(false), | 236 | : QMainWindow( parent, name, f ), m_dontSave(false), |
237 | 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) |
238 | { | 238 | { |
239 | { | 239 | { |
240 | setKeyCompression ( true ); | 240 | setKeyCompression ( true ); |
241 | #ifndef USEQPE | 241 | #ifndef USEQPE |
242 | QDir d = QDir::home(); // "/" | 242 | QDir d = QDir::home(); // "/" |
243 | d.cd(APPDIR); | 243 | d.cd(APPDIR); |
244 | QFileInfo fi(d, ".keymap"); | 244 | QFileInfo fi(d, ".keymap"); |
245 | FILE* f = fopen((const char *)fi.absFilePath(), "r"); | 245 | FILE* f = fopen((const char *)fi.absFilePath(), "r"); |
246 | #else /* USEQPE */ | 246 | #else /* USEQPE */ |
247 | FILE* f = fopen((const char *)Global::applicationFileName(APPDIR,".keymap"), "r"); | 247 | FILE* f = fopen((const char *)Global::applicationFileName(APPDIR,".keymap"), "r"); |
248 | #endif /* USEQPE */ | 248 | #endif /* USEQPE */ |
249 | if (f != NULL) | 249 | if (f != NULL) |
250 | { | 250 | { |
251 | uint cnt; | 251 | uint cnt; |
252 | if ((fread(&cnt, sizeof(cnt), 1, f) != 0) && (cnt == KEYMAPVERSION)) | 252 | if ((fread(&cnt, sizeof(cnt), 1, f) != 0) && (cnt == KEYMAPVERSION)) |
253 | { | 253 | { |
254 | if (fread(&cnt, sizeof(cnt), 1, f) == 0) cnt = 0; | 254 | if (fread(&cnt, sizeof(cnt), 1, f) == 0) cnt = 0; |
255 | for (uint i = 0; i != cnt; i++) | 255 | for (uint i = 0; i != cnt; i++) |
256 | { | 256 | { |
257 | orKey key; | 257 | orKey key; |
258 | int data; | 258 | int data; |
259 | fread(&key, sizeof(key), 1, f); | 259 | fread(&key, sizeof(key), 1, f); |
260 | fread(&data, sizeof(data), 1, f); | 260 | fread(&data, sizeof(data), 1, f); |
261 | kmap[key] = data; | 261 | kmap[key] = data; |
262 | } | 262 | } |
263 | } | 263 | } |
264 | fclose(f); | 264 | fclose(f); |
265 | } | 265 | } |
266 | } | 266 | } |
267 | 267 | ||
268 | m_url_clipboard = false; | 268 | m_url_clipboard = false; |
269 | m_url_localfile = false; | 269 | m_url_localfile = false; |
270 | m_url_globalfile = false; | 270 | m_url_globalfile = false; |
271 | ftime(&m_lastkeytime); | 271 | ftime(&m_lastkeytime); |
272 | //// qDebug("Application directory = %s", (const tchar *)QPEApplication::documentDir()); | 272 | //// qDebug("Application directory = %s", (const tchar *)QPEApplication::documentDir()); |
273 | //// qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml")); | 273 | //// qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml")); |
274 | 274 | ||
275 | m_bcloseDisabled = true; | 275 | m_bcloseDisabled = true; |
276 | m_disableesckey = false; | 276 | m_disableesckey = false; |
277 | pBkmklist = NULL; | 277 | pBkmklist = NULL; |
278 | pOpenlist = NULL; | 278 | pOpenlist = NULL; |
279 | // doc = 0; | 279 | // doc = 0; |
280 | 280 | ||
281 | m_fBkmksChanged = false; | 281 | m_fBkmksChanged = false; |
282 | 282 | ||
283 | QString lang = getenv( "LANG" ); | 283 | QString lang = getenv( "LANG" ); |
284 | QString rot = getenv( "QWS_DISPLAY" ); | 284 | QString rot = getenv( "QWS_DISPLAY" ); |
285 | 285 | ||
286 | /* | 286 | /* |
287 | int m_rot = 0; | 287 | int m_rot = 0; |
288 | if (rot.contains("Rot90")) | 288 | if (rot.contains("Rot90")) |
289 | { | 289 | { |
290 | m_rot = 90; | 290 | m_rot = 90; |
291 | } | 291 | } |
292 | else if (rot.contains("Rot180")) | 292 | else if (rot.contains("Rot180")) |
293 | { | 293 | { |
294 | m_rot = 180; | 294 | m_rot = 180; |
295 | } | 295 | } |
296 | else if (rot.contains("Rot270")) | 296 | else if (rot.contains("Rot270")) |
297 | { | 297 | { |
298 | m_rot = 270; | 298 | m_rot = 270; |
299 | } | 299 | } |
300 | 300 | ||
301 | // qDebug("Initial Rotation(%d):%s", m_rot, (const char*)rot); | 301 | // qDebug("Initial Rotation(%d):%s", m_rot, (const char*)rot); |
302 | */ | 302 | */ |
303 | m_autogenstr = "^ *[A-Z].*[a-z] *$"; | 303 | m_autogenstr = "^ *[A-Z].*[a-z] *$"; |
304 | 304 | ||
305 | #ifdef USEQPE | 305 | #ifdef USEQPE |
306 | setIcon( Resource::loadPixmap( PICDIR "uqtreader") ); | 306 | setIcon( Opie::Core::OResource::loadPixmap( PICDIR "uqtreader", Opie::Core::OResource::SmallIcon ) ); |
307 | #else | 307 | #else |
308 | setIcon( QPixmap (PICDIR + "/uqtreader.png") ); | 308 | setIcon( QPixmap (PICDIR + "/uqtreader.png") ); |
309 | #endif /* USEQPE */ | 309 | #endif /* USEQPE */ |
310 | 310 | ||
311 | // QPEToolBar *bar = new QPEToolBar( this ); | 311 | // QPEToolBar *bar = new QPEToolBar( this ); |
312 | // menubar = new QPEToolBar( this ); | 312 | // menubar = new QPEToolBar( this ); |
313 | #ifdef USEQPE | 313 | #ifdef USEQPE |
314 | Config config( APPDIR ); | 314 | Config config( APPDIR ); |
315 | #else | 315 | #else |
316 | QDir d = QDir::home(); // "/" | 316 | QDir d = QDir::home(); // "/" |
317 | if ( !d.cd(APPDIR) ) { // "/tmp" | 317 | if ( !d.cd(APPDIR) ) { // "/tmp" |
318 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 318 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); |
319 | d = QDir::home(); | 319 | d = QDir::home(); |
320 | d.mkdir(APPDIR); | 320 | d.mkdir(APPDIR); |
321 | d.cd(APPDIR); | 321 | d.cd(APPDIR); |
322 | } | 322 | } |
323 | QFileInfo fi(d, INIFILE); | 323 | QFileInfo fi(d, INIFILE); |
324 | // qDebug("Path:%s", (const char*)fi.absFilePath()); | 324 | // qDebug("Path:%s", (const char*)fi.absFilePath()); |
325 | Config config(fi.absFilePath()); | 325 | Config config(fi.absFilePath()); |
326 | #endif | 326 | #endif |
327 | config.setGroup("Toolbar"); | 327 | config.setGroup("Toolbar"); |
328 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false); | 328 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false); |
329 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1); | 329 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1); |
330 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2); | 330 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2); |
331 | m_qtscroll = config.readNumEntry("QTScrollBar", false); | 331 | m_qtscroll = config.readNumEntry("QTScrollBar", false); |
332 | m_localscroll = config.readNumEntry("LocalScrollBar", false); | 332 | m_localscroll = config.readNumEntry("LocalScrollBar", false); |
333 | 333 | ||
334 | // fileBar = new QToolBar("File", this); | 334 | // fileBar = new QToolBar("File", this); |
335 | // QToolBar* viewBar = new QToolBar("File", this); | 335 | // QToolBar* viewBar = new QToolBar("File", this); |
336 | // QToolBar* navBar = new QToolBar("File", this); | 336 | // QToolBar* navBar = new QToolBar("File", this); |
337 | // QToolBar* markBar = new QToolBar("File", this); | 337 | // QToolBar* markBar = new QToolBar("File", this); |
338 | 338 | ||
339 | #if defined(USEQPE) | 339 | #if defined(USEQPE) |
340 | menubar = new QToolBar("Menus", this, m_tbposition); | 340 | menubar = new QToolBar("Menus", this, m_tbposition); |
341 | mb = new QPEMenuBar( menubar ); | 341 | mb = new QPEMenuBar( menubar ); |
342 | #else | 342 | #else |
343 | mb = new QMenuBar( this ); | 343 | mb = new QMenuBar( this ); |
344 | #endif | 344 | #endif |
345 | 345 | ||
346 | #if defined(USEQPE) | 346 | #if defined(USEQPE) |
347 | QPopupMenu* tmp = new QPopupMenu(mb); | 347 | QPopupMenu* tmp = new QPopupMenu(mb); |
348 | mb->insertItem( geticon( "AppsIcon" ), tmp ); | 348 | mb->insertItem( geticon( "AppsIcon" ), tmp ); |
349 | #else | 349 | #else |
350 | QMenuBar* tmp = mb; | 350 | QMenuBar* tmp = mb; |
351 | #endif | 351 | #endif |
352 | 352 | ||
353 | QPopupMenu *file = new QPopupMenu( mb ); | 353 | QPopupMenu *file = new QPopupMenu( mb ); |
354 | tmp->insertItem( tr( "File" ), file ); | 354 | tmp->insertItem( tr( "File" ), file ); |
355 | 355 | ||
356 | QPopupMenu *navigation = new QPopupMenu(mb); | 356 | QPopupMenu *navigation = new QPopupMenu(mb); |
357 | tmp->insertItem( tr( "Navigation" ), navigation ); | 357 | tmp->insertItem( tr( "Navigation" ), navigation ); |
358 | 358 | ||
359 | QPopupMenu *view = new QPopupMenu( mb ); | 359 | QPopupMenu *view = new QPopupMenu( mb ); |
360 | tmp->insertItem( tr( "View" ), view ); | 360 | tmp->insertItem( tr( "View" ), view ); |
361 | 361 | ||
362 | QPopupMenu *marks = new QPopupMenu( this ); | 362 | QPopupMenu *marks = new QPopupMenu( this ); |
363 | tmp->insertItem( tr( "Marks" ), marks ); | 363 | tmp->insertItem( tr( "Marks" ), marks ); |
364 | 364 | ||
365 | QPopupMenu *settings = new QPopupMenu( this ); | 365 | QPopupMenu *settings = new QPopupMenu( this ); |
366 | tmp->insertItem( tr( "Settings" ), settings ); | 366 | tmp->insertItem( tr( "Settings" ), settings ); |
367 | 367 | ||
368 | // addToolBar(menubar, "Menus",QMainWindow::Top); | 368 | // addToolBar(menubar, "Menus",QMainWindow::Top); |
369 | // addToolBar(fileBar, "Toolbar",QMainWindow::Top); | 369 | // addToolBar(fileBar, "Toolbar",QMainWindow::Top); |
370 | 370 | ||
371 | // QPopupMenu *edit = new QPopupMenu( this ); | 371 | // QPopupMenu *edit = new QPopupMenu( this ); |
372 | 372 | ||
373 | /* | 373 | /* |
374 | 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 ); |
375 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 375 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
376 | a->addTo( bar ); | 376 | a->addTo( bar ); |
377 | a->addTo( file ); | 377 | a->addTo( file ); |
378 | */ | 378 | */ |
379 | QWidget* widge = new QWidget(this); | 379 | QWidget* widge = new QWidget(this); |
380 | setCentralWidget( widge ); | 380 | setCentralWidget( widge ); |
381 | QVBoxLayout* vlayout = new QVBoxLayout(widge); | 381 | QVBoxLayout* vlayout = new QVBoxLayout(widge); |
382 | m_layout = new QBoxLayout(QBoxLayout::LeftToRight); | 382 | m_layout = new QBoxLayout(QBoxLayout::LeftToRight); |
383 | m_prog = new QLabel(widge); | 383 | m_prog = new QLabel(widge); |
384 | vlayout->addLayout(m_layout, 1); | 384 | vlayout->addLayout(m_layout, 1); |
385 | vlayout->addWidget(m_prog); | 385 | vlayout->addWidget(m_prog); |
386 | 386 | ||
387 | editorStack = new QWidgetStack( widge ); | 387 | editorStack = new QWidgetStack( widge ); |
388 | // setCentralWidget( editorStack ); | 388 | // setCentralWidget( editorStack ); |
389 | 389 | ||
390 | searchVisible = FALSE; | 390 | searchVisible = FALSE; |
391 | regVisible = FALSE; | 391 | regVisible = FALSE; |
392 | m_fontVisible = false; | 392 | m_fontVisible = false; |
393 | 393 | ||
394 | m_buttonprefs = new CButtonPrefs(&kmap, this); | 394 | m_buttonprefs = new CButtonPrefs(&kmap, this); |
395 | editorStack->addWidget(m_buttonprefs, get_unique_id()); | 395 | editorStack->addWidget(m_buttonprefs, get_unique_id()); |
396 | connect( m_buttonprefs, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); | 396 | connect( m_buttonprefs, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); |
397 | 397 | ||
398 | 398 | ||
399 | m_annoWin = new CAnnoEdit(editorStack); | 399 | m_annoWin = new CAnnoEdit(editorStack); |
400 | editorStack->addWidget(m_annoWin, get_unique_id()); | 400 | editorStack->addWidget(m_annoWin, get_unique_id()); |
401 | 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&) ) ); |
402 | connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) ); | 402 | connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) ); |
403 | 403 | ||
404 | m_infoWin = new infowin(editorStack); | 404 | m_infoWin = new infowin(editorStack); |
405 | editorStack->addWidget(m_infoWin, get_unique_id()); | 405 | editorStack->addWidget(m_infoWin, get_unique_id()); |
406 | connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) ); | 406 | connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) ); |
407 | 407 | ||
408 | m_graphicwin = new GraphicWin(editorStack); | 408 | m_graphicwin = new GraphicWin(editorStack); |
409 | editorStack->addWidget(m_graphicwin, get_unique_id()); | 409 | editorStack->addWidget(m_graphicwin, get_unique_id()); |
410 | connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); | 410 | connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); |
411 | 411 | ||
412 | // bkmkselector = new QListBox(editorStack, "Bookmarks"); | 412 | // bkmkselector = new QListBox(editorStack, "Bookmarks"); |
413 | bkmkselector = new CBkmkSelector(editorStack, "Bookmarks"); | 413 | bkmkselector = new CBkmkSelector(editorStack, "Bookmarks"); |
414 | // connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) ); | 414 | // connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) ); |
415 | connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) ); | 415 | connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) ); |
416 | connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) ); | 416 | connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) ); |
417 | editorStack->addWidget( bkmkselector, get_unique_id() ); | 417 | editorStack->addWidget( bkmkselector, get_unique_id() ); |
418 | 418 | ||
419 | /* | 419 | /* |
420 | importSelector = new FileSelector( "*", editorStack, "importselector", false ); | 420 | importSelector = new FileSelector( "*", editorStack, "importselector", false ); |
421 | connect( importSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( importFile( const DocLnk & ) ) ); | 421 | connect( importSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( importFile( const DocLnk & ) ) ); |
422 | 422 | ||
423 | editorStack->addWidget( importSelector, get_unique_id() ); | 423 | editorStack->addWidget( importSelector, get_unique_id() ); |
424 | 424 | ||
425 | // don't need the close visible, it is redundant... | 425 | // don't need the close visible, it is redundant... |
426 | importSelector->setCloseVisible( FALSE ); | 426 | importSelector->setCloseVisible( FALSE ); |
427 | */ | 427 | */ |
428 | // qDebug("Reading file list"); | 428 | // qDebug("Reading file list"); |
429 | readfilelist(); | 429 | readfilelist(); |
430 | 430 | ||
431 | reader = new QTReader( editorStack ); | 431 | reader = new QTReader( editorStack ); |
432 | 432 | ||
433 | reader->setDoUpdates(false); | 433 | reader->setDoUpdates(false); |
434 | 434 | ||
435 | #ifdef USEQPE | 435 | #ifdef USEQPE |
436 | ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); | 436 | ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); |
437 | #endif | 437 | #endif |
438 | 438 | ||
439 | // qDebug("Reading config"); | 439 | // qDebug("Reading config"); |
440 | // Config config( APPDIR ); | 440 | // Config config( APPDIR ); |
441 | config.setGroup( "View" ); | 441 | config.setGroup( "View" ); |
442 | #if defined(USEQPE) && defined(USENEWFULLSCREEN) | 442 | #if defined(USEQPE) && defined(USENEWFULLSCREEN) |
443 | m_usenewfullscreen = config.readBoolEntry("NewFullScreen", false); | 443 | m_usenewfullscreen = config.readBoolEntry("NewFullScreen", false); |
444 | #endif | 444 | #endif |
445 | m_debounce = config.readNumEntry("Debounce", 0); | 445 | m_debounce = config.readNumEntry("Debounce", 0); |
446 | m_buttonprefs->Debounce(m_debounce); | 446 | m_buttonprefs->Debounce(m_debounce); |
447 | #ifdef USEQPE | 447 | #ifdef USEQPE |
448 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); | 448 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); |
449 | #else | 449 | #else |
450 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true); | 450 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true); |
451 | #endif | 451 | #endif |
452 | reader->setStripCR(config.readBoolEntry( "StripCr", true )); | 452 | reader->setStripCR(config.readBoolEntry( "StripCr", true )); |
453 | reader->bfulljust = config.readBoolEntry( "FullJust", false ); | 453 | reader->bfulljust = config.readBoolEntry( "FullJust", false ); |
454 | /* | 454 | /* |
455 | bool btmp = config.readBoolEntry("Negative", false); | 455 | bool btmp = config.readBoolEntry("Negative", false); |
456 | if (btmp) reader->setNegative(); | 456 | if (btmp) reader->setNegative(); |
457 | */ | 457 | */ |
458 | reader->bInverse = config.readBoolEntry("Inverse", false); | 458 | reader->bInverse = config.readBoolEntry("Inverse", false); |
459 | reader->m_fontControl.FixGraphics(config.readBoolEntry( "FixGraphics", false )); | 459 | reader->m_fontControl.FixGraphics(config.readBoolEntry( "FixGraphics", false )); |
460 | reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 )); | 460 | reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 )); |
461 | reader->setlead(config.readNumEntry( "ExtraLead", 0 )); | 461 | reader->setlead(config.readNumEntry( "ExtraLead", 0 )); |
462 | reader->btextfmt = config.readBoolEntry( "TextFmt", false ); | 462 | reader->btextfmt = config.readBoolEntry( "TextFmt", false ); |
463 | reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); | 463 | reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); |
464 | reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); | 464 | reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); |
465 | reader->bNoInlineTables = config.readBoolEntry( "NoInlineTables", false ); | 465 | reader->bNoInlineTables = config.readBoolEntry( "NoInlineTables", false ); |
466 | reader->bpeanut = config.readBoolEntry( "Peanut", false ); | 466 | reader->bpeanut = config.readBoolEntry( "Peanut", false ); |
467 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); | 467 | reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); |
468 | reader->bdepluck = config.readBoolEntry( "Depluck", false ); | 468 | reader->bdepluck = config.readBoolEntry( "Depluck", false ); |
469 | reader->bdejpluck = config.readBoolEntry( "Dejpluck", false ); | 469 | reader->bdejpluck = config.readBoolEntry( "Dejpluck", false ); |
470 | reader->bonespace = config.readBoolEntry( "OneSpace", false ); | 470 | reader->bonespace = config.readBoolEntry( "OneSpace", false ); |
471 | reader->bunindent = config.readBoolEntry( "Unindent", false ); | 471 | reader->bunindent = config.readBoolEntry( "Unindent", false ); |
472 | reader->brepara = config.readBoolEntry( "Repara", false ); | 472 | reader->brepara = config.readBoolEntry( "Repara", false ); |
473 | reader->m_reparastring = config.readEntry( "ReparaString", "\\n{[\\n \\t]}"); | 473 | reader->m_reparastring = config.readEntry( "ReparaString", "\\n{[\\n \\t]}"); |
474 | m_bgtype = (bground)config.readNumEntry( "BackgroundType" , 0 ); | 474 | m_bgtype = (bground)config.readNumEntry( "BackgroundType" , 0 ); |
475 | m_themename = config.readEntry("Theme", QString::null ); | 475 | m_themename = config.readEntry("Theme", QString::null ); |
476 | reader->bdblspce = config.readBoolEntry( "DoubleSpace", false ); | 476 | reader->bdblspce = config.readBoolEntry( "DoubleSpace", false ); |
477 | reader->bindenter = config.readNumEntry( "Indent", 0 ); | 477 | reader->bindenter = config.readNumEntry( "Indent", 0 ); |
478 | reader->m_textsize = config.readNumEntry( "FontSize", 12 ); | 478 | reader->m_textsize = config.readNumEntry( "FontSize", 12 ); |
479 | reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); | 479 | reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); |
480 | reader->m_scrollstep = config.readNumEntry( "ScrollStep", 1); | 480 | reader->m_scrollstep = config.readNumEntry( "ScrollStep", 1); |
481 | reader->m_outputName = config.readEntry( "OutputCodec", ""); | 481 | reader->m_outputName = config.readEntry( "OutputCodec", ""); |
482 | 482 | ||
483 | 483 | ||
484 | reader->m_lastfile = config.readEntry( "LastFile", QString::null ); | 484 | reader->m_lastfile = config.readEntry( "LastFile", QString::null ); |
485 | reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); | 485 | reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); |
486 | reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); | 486 | reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); |
487 | reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); | 487 | reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); |
488 | reader->m_rotated = config.readBoolEntry( "IsRotated", false ); | 488 | reader->m_rotated = config.readBoolEntry( "IsRotated", false ); |
489 | reader->m_scrolltype = config.readNumEntry( "ScrollType", 0 ); | 489 | reader->m_scrolltype = config.readNumEntry( "ScrollType", 0 ); |
490 | m_statusstring = config.readEntry("StatusContent", "%P%% Doc:%d/%D %p%% %z%%"); | 490 | m_statusstring = config.readEntry("StatusContent", "%P%% Doc:%d/%D %p%% %z%%"); |
491 | m_statusishidden = config.readBoolEntry("StatusHidden", false); | 491 | m_statusishidden = config.readBoolEntry("StatusHidden", false); |
492 | m_background = config.readNumEntry( "Background", 0 ); | 492 | m_background = config.readNumEntry( "Background", 0 ); |
493 | reader->setBackground(getcolour(m_background)); | 493 | reader->setBackground(getcolour(m_background)); |
494 | m_foreground = config.readNumEntry( "Foreground", 1 ); | 494 | m_foreground = config.readNumEntry( "Foreground", 1 ); |
495 | reader->setForeground(getcolour(m_foreground)); | 495 | reader->setForeground(getcolour(m_foreground)); |
496 | m_scrollcolor = config.readNumEntry( "ScrollColour", 5 ); | 496 | m_scrollcolor = config.readNumEntry( "ScrollColour", 5 ); |
497 | setscrollcolour(); | 497 | setscrollcolour(); |
498 | m_scrollbarcolor = config.readNumEntry( "ScrollBarColour", 5 ); | 498 | m_scrollbarcolor = config.readNumEntry( "ScrollBarColour", 5 ); |
499 | setscrollbarcolour(); | 499 | setscrollbarcolour(); |
500 | reader->hyphenate = config.readBoolEntry( "Hyphenate", false ); | 500 | reader->hyphenate = config.readBoolEntry( "Hyphenate", false ); |
501 | reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false); | 501 | reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false); |
502 | reader->m_fontname = config.readEntry( "Fontname", "helvetica" ); | 502 | reader->m_fontname = config.readEntry( "Fontname", "helvetica" ); |
503 | reader->m_encd = config.readNumEntry( "Encoding", 0 ); | 503 | reader->m_encd = config.readNumEntry( "Encoding", 0 ); |
504 | reader->m_charpc = config.readNumEntry( "CharSpacing", 100 ); | 504 | reader->m_charpc = config.readNumEntry( "CharSpacing", 100 ); |
505 | reader->m_overlap = config.readNumEntry( "Overlap", 0 ); | 505 | reader->m_overlap = config.readNumEntry( "Overlap", 0 ); |
506 | reader->m_abstopmargin = config.readNumEntry( "Top Margin", 100 ); | 506 | reader->m_abstopmargin = config.readNumEntry( "Top Margin", 100 ); |
507 | reader->m_absbottommargin = config.readNumEntry( "Bottom Margin", 100 ); | 507 | reader->m_absbottommargin = config.readNumEntry( "Bottom Margin", 100 ); |
508 | reader->m_absleft_border = config.readNumEntry( "Left Margin", 100 ); | 508 | reader->m_absleft_border = config.readNumEntry( "Left Margin", 100 ); |
509 | reader->m_absright_border = config.readNumEntry( "Right Margin", 100 ); | 509 | reader->m_absright_border = config.readNumEntry( "Right Margin", 100 ); |
510 | 510 | ||
511 | m_scrollishidden = config.readBoolEntry( "HideScrollBar", false ); | 511 | m_scrollishidden = config.readBoolEntry( "HideScrollBar", false ); |
512 | m_hidebars = config.readBoolEntry( "HideToolBar", false ); | 512 | m_hidebars = config.readBoolEntry( "HideToolBar", false ); |
513 | 513 | ||
514 | reader->brepalm = config.readBoolEntry( "Repalm", false ); | 514 | reader->brepalm = config.readBoolEntry( "Repalm", false ); |
515 | reader->bunderlineLink = config.readBoolEntry( "UnderlineLink", true ); | 515 | reader->bunderlineLink = config.readBoolEntry( "UnderlineLink", true ); |
516 | reader->bkern = config.readBoolEntry( "Kern", false ); | 516 | reader->bkern = config.readBoolEntry( "Kern", false ); |
517 | reader->bremap = config.readBoolEntry( "Remap", true ); | 517 | reader->bremap = config.readBoolEntry( "Remap", true ); |
518 | reader->bmakebold = config.readBoolEntry( "MakeBold", false ); | 518 | reader->bmakebold = config.readBoolEntry( "MakeBold", false ); |
519 | reader->setContinuous(config.readBoolEntry( "Continuous", true )); | 519 | reader->setContinuous(config.readBoolEntry( "Continuous", true )); |
520 | reader->setDoubleBuffer(config.readBoolEntry("DoubleBuffer", true)); | 520 | reader->setDoubleBuffer(config.readBoolEntry("DoubleBuffer", true)); |
521 | m_targetapp = config.readEntry( "TargetApp", QString::null ); | 521 | m_targetapp = config.readEntry( "TargetApp", QString::null ); |
522 | m_targetmsg = config.readEntry( "TargetMsg", QString::null ); | 522 | m_targetmsg = config.readEntry( "TargetMsg", QString::null ); |
523 | #ifdef _SCROLLPIPE | 523 | #ifdef _SCROLLPIPE |
524 | reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null ); | 524 | reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null ); |
525 | reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true ); | 525 | reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true ); |
526 | #endif | 526 | #endif |
527 | m_twoTouch = config.readBoolEntry( "TwoTouch", false); | 527 | m_twoTouch = config.readBoolEntry( "TwoTouch", false); |
528 | m_doAnnotation = config.readBoolEntry( "Annotation", false); | 528 | m_doAnnotation = config.readBoolEntry( "Annotation", false); |
529 | m_doDictionary = config.readBoolEntry( "Dictionary", false); | 529 | m_doDictionary = config.readBoolEntry( "Dictionary", false); |
530 | m_doClipboard = config.readBoolEntry( "Clipboard", false); | 530 | m_doClipboard = config.readBoolEntry( "Clipboard", false); |
531 | m_doOutput = config.readBoolEntry( "OutputTgt", false); | 531 | m_doOutput = config.readBoolEntry( "OutputTgt", false); |
532 | /* | 532 | /* |
533 | m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); | 533 | m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); |
534 | m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone); | 534 | m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone); |
535 | m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen); | 535 | m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen); |
536 | m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut); | 536 | m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut); |
537 | m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn); | 537 | m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn); |
538 | m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp); | 538 | m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp); |
539 | m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown); | 539 | m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown); |
540 | 540 | ||
541 | m_leftScroll = config.readBoolEntry("LeftScroll", false); | 541 | m_leftScroll = config.readBoolEntry("LeftScroll", false); |
542 | m_rightScroll = config.readBoolEntry("RightScroll", false); | 542 | m_rightScroll = config.readBoolEntry("RightScroll", false); |
543 | m_upScroll = config.readBoolEntry("UpScroll", true); | 543 | m_upScroll = config.readBoolEntry("UpScroll", true); |
544 | m_downScroll = config.readBoolEntry("DownScroll", true); | 544 | m_downScroll = config.readBoolEntry("DownScroll", true); |
545 | */ | 545 | */ |
546 | m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false); | 546 | m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false); |
547 | reader->setBaseSize(config.readNumEntry( "Basesize", 10 )); | 547 | reader->setBaseSize(config.readNumEntry( "Basesize", 10 )); |
548 | reader->setHyphenThreshold(config.readNumEntry( "HyphenThreshold", 50 )); | 548 | reader->setHyphenThreshold(config.readNumEntry( "HyphenThreshold", 50 )); |
549 | // reader->buffdoc.setCustomHyphen(config.readBoolEntry( "CustomHyphen", false )); | 549 | // reader->buffdoc.setCustomHyphen(config.readBoolEntry( "CustomHyphen", false )); |
550 | #ifndef USEQPE | 550 | #ifndef USEQPE |
551 | config.setGroup( "Geometry" ); | 551 | config.setGroup( "Geometry" ); |
552 | setGeometry(0,0, | 552 | setGeometry(0,0, |
553 | config.readNumEntry( "width", QApplication::desktop()->width()/2 ), | 553 | config.readNumEntry( "width", QApplication::desktop()->width()/2 ), |
554 | config.readNumEntry( "height", QApplication::desktop()->height()/2 )); | 554 | config.readNumEntry( "height", QApplication::desktop()->height()/2 )); |
555 | move( | 555 | move( |
556 | config.readNumEntry( "x", 20 ), | 556 | config.readNumEntry( "x", 20 ), |
557 | config.readNumEntry( "y", 20 )); | 557 | config.readNumEntry( "y", 20 )); |
558 | #else | 558 | #else |
559 | m_grabkeyboard = config.readBoolEntry( "GrabKeyboard", false); | 559 | m_grabkeyboard = config.readBoolEntry( "GrabKeyboard", false); |
560 | #endif | 560 | #endif |
561 | 561 | ||
562 | 562 | ||
563 | 563 | ||
564 | setTwoTouch(m_twoTouch); | 564 | setTwoTouch(m_twoTouch); |
565 | 565 | ||
566 | connect( reader, SIGNAL( OnShowPicture(QImage&) ), this, SLOT( showgraphic(QImage&) ) ); | 566 | connect( reader, SIGNAL( OnShowPicture(QImage&) ), this, SLOT( showgraphic(QImage&) ) ); |
567 | 567 | ||
568 | connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) ); | 568 | connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) ); |
569 | 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&) ) ); |
570 | 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) ) ); |
571 | connect( reader, SIGNAL( NewFileRequest(const QString&) ), this, SLOT( forceopen(const QString&) ) ); | 571 | connect( reader, SIGNAL( NewFileRequest(const QString&) ), this, SLOT( forceopen(const QString&) ) ); |
572 | connect( reader, SIGNAL( HandleKeyRequest(QKeyEvent*) ), this, SLOT( handlekey(QKeyEvent*) ) ); | 572 | connect( reader, SIGNAL( HandleKeyRequest(QKeyEvent*) ), this, SLOT( handlekey(QKeyEvent*) ) ); |
573 | connect( reader, SIGNAL( SetScrollState(bool) ), this, SLOT( setScrollState(bool) ) ); | 573 | connect( reader, SIGNAL( SetScrollState(bool) ), this, SLOT( setScrollState(bool) ) ); |
574 | connect( reader, SIGNAL(RefreshBitmap()), this, SLOT(setBackgroundBitmap())); | 574 | connect( reader, SIGNAL(RefreshBitmap()), this, SLOT(setBackgroundBitmap())); |
575 | editorStack->addWidget( reader, get_unique_id() ); | 575 | editorStack->addWidget( reader, get_unique_id() ); |
576 | 576 | ||
577 | 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); |
578 | connect( m_preferences_action, SIGNAL( activated() ), this, SLOT( showprefs() ) ); | 578 | connect( m_preferences_action, SIGNAL( activated() ), this, SLOT( showprefs() ) ); |
579 | m_preferences_action->addTo( settings ); | 579 | m_preferences_action->addTo( settings ); |
580 | 580 | ||
581 | m_saveconfig_action = new QAction( tr( "Save Config" ), QString::null, 0, this, NULL); | 581 | m_saveconfig_action = new QAction( tr( "Save Config" ), QString::null, 0, this, NULL); |
582 | connect( m_saveconfig_action, SIGNAL( activated() ), this, SLOT( SaveConfig() ) ); | 582 | connect( m_saveconfig_action, SIGNAL( activated() ), this, SLOT( SaveConfig() ) ); |
583 | m_saveconfig_action->addTo( settings ); | 583 | m_saveconfig_action->addTo( settings ); |
584 | 584 | ||
585 | m_loadconfig_action = new QAction( tr( "Load Config" ), QString::null, 0, this, NULL); | 585 | m_loadconfig_action = new QAction( tr( "Load Config" ), QString::null, 0, this, NULL); |
586 | connect( m_loadconfig_action, SIGNAL( activated() ), this, SLOT( LoadConfig() ) ); | 586 | connect( m_loadconfig_action, SIGNAL( activated() ), this, SLOT( LoadConfig() ) ); |
587 | m_loadconfig_action->addTo( settings ); | 587 | m_loadconfig_action->addTo( settings ); |
588 | 588 | ||
589 | m_tidyconfig_action = new QAction( tr( "Delete Config" ), QString::null, 0, this, NULL); | 589 | m_tidyconfig_action = new QAction( tr( "Delete Config" ), QString::null, 0, this, NULL); |
590 | connect( m_tidyconfig_action, SIGNAL( activated() ), this, SLOT( TidyConfig() ) ); | 590 | connect( m_tidyconfig_action, SIGNAL( activated() ), this, SLOT( TidyConfig() ) ); |
591 | m_tidyconfig_action->addTo( settings ); | 591 | m_tidyconfig_action->addTo( settings ); |
592 | 592 | ||
593 | settings->insertSeparator(); | 593 | settings->insertSeparator(); |
594 | m_toolbarprefs_action = new QAction( tr( "Toolbars" ), QString::null, 0, this, NULL); | 594 | m_toolbarprefs_action = new QAction( tr( "Toolbars" ), QString::null, 0, this, NULL); |
595 | connect( m_toolbarprefs_action, SIGNAL( activated() ), this, SLOT( showtoolbarprefs() ) ); | 595 | connect( m_toolbarprefs_action, SIGNAL( activated() ), this, SLOT( showtoolbarprefs() ) ); |
596 | m_toolbarprefs_action->addTo( settings ); | 596 | m_toolbarprefs_action->addTo( settings ); |
597 | 597 | ||
598 | m_buttonprefs_action = new QAction( tr( "Buttons" ), QString::null, 0, this, NULL); | 598 | m_buttonprefs_action = new QAction( tr( "Buttons" ), QString::null, 0, this, NULL); |
599 | connect( m_buttonprefs_action, SIGNAL( activated() ), this, SLOT( showbuttonprefs() ) ); | 599 | connect( m_buttonprefs_action, SIGNAL( activated() ), this, SLOT( showbuttonprefs() ) ); |
600 | m_buttonprefs_action->addTo( settings ); | 600 | m_buttonprefs_action->addTo( settings ); |
601 | 601 | ||
602 | m_loadtheme_action = new QAction( tr( "Load Theme" ), QString::null, 0, this, NULL); | 602 | m_loadtheme_action = new QAction( tr( "Load Theme" ), QString::null, 0, this, NULL); |
603 | connect( m_loadtheme_action, SIGNAL( activated() ), this, SLOT( LoadTheme() ) ); | 603 | connect( m_loadtheme_action, SIGNAL( activated() ), this, SLOT( LoadTheme() ) ); |
604 | m_loadtheme_action->addTo( settings ); | 604 | m_loadtheme_action->addTo( settings ); |
605 | 605 | ||
606 | m_repara_action = new QAction( tr( "EOP Marker" ), QString::null, 0, this, NULL); | 606 | m_repara_action = new QAction( tr( "EOP Marker" ), QString::null, 0, this, NULL); |
607 | connect( m_repara_action, SIGNAL( activated() ), this, SLOT( reparastring() ) ); | 607 | connect( m_repara_action, SIGNAL( activated() ), this, SLOT( reparastring() ) ); |
608 | m_repara_action->addTo(settings); | 608 | m_repara_action->addTo(settings); |
609 | 609 | ||
610 | #ifdef USEQPE | 610 | #ifdef USEQPE |
611 | m_grab_action = new QAction( tr( "Grab Buttons" ), QString::null, 0, this, NULL, true ); | 611 | m_grab_action = new QAction( tr( "Grab Buttons" ), QString::null, 0, this, NULL, true ); |
612 | connect( m_grab_action, SIGNAL( toggled(bool) ), this, SLOT( setgrab(bool) ) ); | 612 | connect( m_grab_action, SIGNAL( toggled(bool) ), this, SLOT( setgrab(bool) ) ); |
613 | m_grab_action->setOn(m_grabkeyboard); | 613 | m_grab_action->setOn(m_grabkeyboard); |
614 | m_grab_action->addTo( settings ); | 614 | m_grab_action->addTo( settings ); |
615 | #endif | 615 | #endif |
616 | 616 | ||
617 | m_open_action = new QAction( tr( "Open" ), geticon( "fileopen" ), QString::null, 0, this, 0 ); | 617 | m_open_action = new QAction( tr( "Open" ), geticon( "fileopen" ), QString::null, 0, this, 0 ); |
618 | connect( m_open_action, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); | 618 | connect( m_open_action, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); |
619 | m_open_action->addTo( file ); | 619 | m_open_action->addTo( file ); |
620 | 620 | ||
621 | m_close_action = new QAction( tr( "Close" ), geticon( "close" ), QString::null, 0, this, 0 ); | 621 | m_close_action = new QAction( tr( "Close" ), geticon( "close" ), QString::null, 0, this, 0 ); |
622 | connect( m_close_action, SIGNAL( activated() ), this, SLOT( fileClose() ) ); | 622 | connect( m_close_action, SIGNAL( activated() ), this, SLOT( fileClose() ) ); |
623 | m_close_action->addTo( file ); | 623 | m_close_action->addTo( file ); |
624 | 624 | ||
625 | #ifdef _SCRIPT | 625 | #ifdef _SCRIPT |
626 | a = new QAction( tr( "Run Script" ), QString::null, 0, this, NULL); | 626 | a = new QAction( tr( "Run Script" ), QString::null, 0, this, NULL); |
627 | connect( a, SIGNAL( activated() ), this, SLOT( RunScript() ) ); | 627 | connect( a, SIGNAL( activated() ), this, SLOT( RunScript() ) ); |
628 | a->addTo( file ); | 628 | a->addTo( file ); |
629 | #endif | 629 | #endif |
630 | /* | 630 | /* |
631 | a = new QAction( tr( "Revert" ), geticon( "close" ), QString::null, 0, this, 0 ); | 631 | a = new QAction( tr( "Revert" ), geticon( "close" ), QString::null, 0, this, 0 ); |
632 | connect( a, SIGNAL( activated() ), this, SLOT( fileRevert() ) ); | 632 | connect( a, SIGNAL( activated() ), this, SLOT( fileRevert() ) ); |
633 | a->addTo( file ); | 633 | a->addTo( file ); |
634 | 634 | ||
635 | a = new QAction( tr( "Cut" ), geticon( "cut" ), QString::null, 0, this, 0 ); | 635 | a = new QAction( tr( "Cut" ), geticon( "cut" ), QString::null, 0, this, 0 ); |
636 | connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); | 636 | connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); |
637 | a->addTo( filebar() ); | 637 | a->addTo( filebar() ); |
638 | a->addTo( edit ); | 638 | a->addTo( edit ); |
639 | */ | 639 | */ |
640 | 640 | ||
641 | m_info_action = new QAction( tr( "Info" ), geticon( "UtilsIcon" ), QString::null, 0, this, NULL); | 641 | m_info_action = new QAction( tr( "Info" ), geticon( "UtilsIcon" ), QString::null, 0, this, NULL); |
642 | connect( m_info_action, SIGNAL( activated() ), this, SLOT( showinfo() ) ); | 642 | connect( m_info_action, SIGNAL( activated() ), this, SLOT( showinfo() ) ); |
643 | m_info_action->addTo( file ); | 643 | m_info_action->addTo( file ); |
644 | 644 | ||
645 | m_touch_action = new QAction( tr( "Two/One Touch" ), geticon( "1to1" ), QString::null, 0, this, NULL, true ); | 645 | m_touch_action = new QAction( tr( "Two/One Touch" ), geticon( "1to1" ), QString::null, 0, this, NULL, true ); |
646 | connect( m_touch_action, SIGNAL( toggled(bool) ), this, SLOT( setTwoTouch(bool) ) ); | 646 | connect( m_touch_action, SIGNAL( toggled(bool) ), this, SLOT( setTwoTouch(bool) ) ); |
647 | m_touch_action->setOn(m_twoTouch); | 647 | m_touch_action->setOn(m_twoTouch); |
648 | m_touch_action->addTo( file ); | 648 | m_touch_action->addTo( file ); |
649 | 649 | ||
650 | m_find_action = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, NULL); | 650 | m_find_action = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, NULL); |
651 | connect( m_find_action, SIGNAL( activated() ), this, SLOT( editFind() ) ); | 651 | connect( m_find_action, SIGNAL( activated() ), this, SLOT( editFind() ) ); |
652 | file->insertSeparator(); | 652 | file->insertSeparator(); |
653 | // a->addTo( bar ); | 653 | // a->addTo( bar ); |
654 | m_find_action->addTo( file ); | 654 | m_find_action->addTo( file ); |
655 | 655 | ||
656 | m_exportlinks_action = new QAction( tr( "Export Links" ), QString::null, 0, this, NULL); | 656 | m_exportlinks_action = new QAction( tr( "Export Links" ), QString::null, 0, this, NULL); |
657 | connect( m_exportlinks_action, SIGNAL( activated() ), this, SLOT( ExportLinks() ) ); | 657 | connect( m_exportlinks_action, SIGNAL( activated() ), this, SLOT( ExportLinks() ) ); |
658 | m_exportlinks_action->addTo( file ); | 658 | m_exportlinks_action->addTo( file ); |
659 | 659 | ||
660 | m_scrollButton = new QAction( tr( "Scroll" ), getmyicon( "panel-arrow-down" ), QString::null, 0, this, 0, true ); | 660 | m_scrollButton = new QAction( tr( "Scroll" ), getmyicon( "panel-arrow-down" ), QString::null, 0, this, 0, true ); |
661 | connect( m_scrollButton, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) ); | 661 | connect( m_scrollButton, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) ); |
662 | m_scrollButton->addTo(navigation); | 662 | m_scrollButton->addTo(navigation); |
663 | m_scrollButton->setOn(false); | 663 | m_scrollButton->setOn(false); |
664 | 664 | ||
665 | m_start_action = new QAction( tr( "Goto Start" ), geticon( "start" ), QString::null, 0, this, NULL); | 665 | m_start_action = new QAction( tr( "Goto Start" ), geticon( "start" ), QString::null, 0, this, NULL); |
666 | connect( m_start_action, SIGNAL( activated() ), this, SLOT( gotoStart() ) ); | 666 | connect( m_start_action, SIGNAL( activated() ), this, SLOT( gotoStart() ) ); |
667 | m_start_action->addTo(navigation); | 667 | m_start_action->addTo(navigation); |
668 | 668 | ||
669 | m_end_action = new QAction( tr( "Goto End" ), geticon( "finish" ), QString::null, 0, this, NULL); | 669 | m_end_action = new QAction( tr( "Goto End" ), geticon( "finish" ), QString::null, 0, this, NULL); |
670 | connect( m_end_action, SIGNAL( activated() ), this, SLOT( gotoEnd() ) ); | 670 | connect( m_end_action, SIGNAL( activated() ), this, SLOT( gotoEnd() ) ); |
671 | m_end_action->addTo(navigation); | 671 | m_end_action->addTo(navigation); |
672 | 672 | ||
673 | m_jump_action = new QAction( tr( "Jump" ), geticon( "rotate" ), QString::null, 0, this, NULL); | 673 | m_jump_action = new QAction( tr( "Jump" ), geticon( "rotate" ), QString::null, 0, this, NULL); |
674 | connect( m_jump_action, SIGNAL( activated() ), this, SLOT( jump() ) ); | 674 | connect( m_jump_action, SIGNAL( activated() ), this, SLOT( jump() ) ); |
675 | m_jump_action->addTo(navigation); | 675 | m_jump_action->addTo(navigation); |
676 | 676 | ||
677 | m_pageline_action = new QAction( tr( "Page/Line Scroll" ), geticon( "pass" ), QString::null, 0, this, NULL, true ); | 677 | m_pageline_action = new QAction( tr( "Page/Line Scroll" ), geticon( "pass" ), QString::null, 0, this, NULL, true ); |
678 | connect( m_pageline_action, SIGNAL( toggled(bool) ), this, SLOT( pagemode(bool) ) ); | 678 | connect( m_pageline_action, SIGNAL( toggled(bool) ), this, SLOT( pagemode(bool) ) ); |
679 | m_pageline_action->addTo(navigation); | 679 | m_pageline_action->addTo(navigation); |
680 | m_pageline_action->setOn(reader->m_bpagemode); | 680 | m_pageline_action->setOn(reader->m_bpagemode); |
681 | 681 | ||
682 | m_pageup_action = new QAction( tr( "Up" ), geticon( "up" ), QString::null, 0, this, 0 ); | 682 | m_pageup_action = new QAction( tr( "Up" ), geticon( "up" ), QString::null, 0, this, 0 ); |
683 | connect( m_pageup_action, SIGNAL( activated() ), this, SLOT( pageup() ) ); | 683 | connect( m_pageup_action, SIGNAL( activated() ), this, SLOT( pageup() ) ); |
684 | m_pageup_action->addTo( navigation ); | 684 | m_pageup_action->addTo( navigation ); |
685 | 685 | ||
686 | m_pagedn_action = new QAction( tr( "Down" ), geticon( "down" ), QString::null, 0, this, 0 ); | 686 | m_pagedn_action = new QAction( tr( "Down" ), geticon( "down" ), QString::null, 0, this, 0 ); |
687 | connect( m_pagedn_action, SIGNAL( activated() ), this, SLOT( pagedn() ) ); | 687 | connect( m_pagedn_action, SIGNAL( activated() ), this, SLOT( pagedn() ) ); |
688 | m_pagedn_action->addTo( navigation ); | 688 | m_pagedn_action->addTo( navigation ); |
689 | 689 | ||
690 | m_back_action = new QAction( tr( "Back" ), geticon( "back" ), QString::null, 0, this, 0 ); | 690 | m_back_action = new QAction( tr( "Back" ), geticon( "back" ), QString::null, 0, this, 0 ); |
691 | connect( m_back_action, SIGNAL( activated() ), reader, SLOT( goBack() ) ); | 691 | connect( m_back_action, SIGNAL( activated() ), reader, SLOT( goBack() ) ); |
692 | m_back_action->addTo( navigation ); | 692 | m_back_action->addTo( navigation ); |
693 | 693 | ||
694 | m_home_action = new QAction( tr( "Home" ), geticon( "home" ), QString::null, 0, this, 0 ); | 694 | m_home_action = new QAction( tr( "Home" ), geticon( "home" ), QString::null, 0, this, 0 ); |
695 | connect( m_home_action, SIGNAL( activated() ), reader, SLOT( goHome() ) ); | 695 | connect( m_home_action, SIGNAL( activated() ), reader, SLOT( goHome() ) ); |
696 | m_home_action->addTo( navigation ); | 696 | m_home_action->addTo( navigation ); |
697 | 697 | ||
698 | m_forward_action = new QAction( tr( "Forward" ), geticon( "forward" ), QString::null, 0, this, 0 ); | 698 | m_forward_action = new QAction( tr( "Forward" ), geticon( "forward" ), QString::null, 0, this, 0 ); |
699 | connect( m_forward_action, SIGNAL( activated() ), reader, SLOT( goForward() ) ); | 699 | connect( m_forward_action, SIGNAL( activated() ), reader, SLOT( goForward() ) ); |
700 | m_forward_action->addTo( navigation ); | 700 | m_forward_action->addTo( navigation ); |
701 | 701 | ||
702 | /* | 702 | /* |
703 | a = new QAction( tr( "Find" ), QString::null, 0, this, NULL, true ); | 703 | a = new QAction( tr( "Find" ), QString::null, 0, this, NULL, true ); |
704 | // connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) ); | 704 | // connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) ); |
705 | a->addTo( file ); | 705 | a->addTo( file ); |
706 | 706 | ||
707 | a = new QAction( tr( "Find Again" ), QString::null, 0, this, NULL, true ); | 707 | a = new QAction( tr( "Find Again" ), QString::null, 0, this, NULL, true ); |
708 | // connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) ); | 708 | // connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) ); |
709 | a->addTo( file ); | 709 | a->addTo( file ); |
710 | */ | 710 | */ |
711 | 711 | ||
712 | // file->insertSeparator(); | 712 | // file->insertSeparator(); |
713 | 713 | ||
714 | #ifdef _SCROLLPIPE | 714 | #ifdef _SCROLLPIPE |
715 | 715 | ||
716 | QActionGroup* ag = new QActionGroup(this); | 716 | QActionGroup* ag = new QActionGroup(this); |
717 | ag->setExclusive(false); | 717 | ag->setExclusive(false); |
718 | spacemenu = new QPopupMenu(this); | 718 | spacemenu = new QPopupMenu(this); |
719 | file->insertItem( tr( "Scrolling" ), spacemenu ); | 719 | file->insertItem( tr( "Scrolling" ), spacemenu ); |
720 | 720 | ||
721 | a = new QAction( tr( "Set Target" ), QString::null, 0, ag, NULL); | 721 | a = new QAction( tr( "Set Target" ), QString::null, 0, ag, NULL); |
722 | connect( a, SIGNAL( activated() ), this, SLOT( setpipetarget() ) ); | 722 | connect( a, SIGNAL( activated() ), this, SLOT( setpipetarget() ) ); |
723 | 723 | ||
724 | a = new QAction( tr( "Pause Paras" ), QString::null, 0, ag, NULL, true ); | 724 | a = new QAction( tr( "Pause Paras" ), QString::null, 0, ag, NULL, true ); |
725 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( setpause(bool) ) ); | 725 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( setpause(bool) ) ); |
726 | a->setOn(reader->m_pauseAfterEachPara); | 726 | a->setOn(reader->m_pauseAfterEachPara); |
727 | 727 | ||
728 | ag->addTo(spacemenu); | 728 | ag->addTo(spacemenu); |
729 | // file->insertSeparator(); | 729 | // file->insertSeparator(); |
730 | 730 | ||
731 | #endif | 731 | #endif |
732 | 732 | ||
733 | /* | 733 | /* |
734 | a = new QAction( tr( "Import" ), QString::null, 0, this, NULL ); | 734 | a = new QAction( tr( "Import" ), QString::null, 0, this, NULL ); |
735 | connect( a, SIGNAL( activated() ), this, SLOT( importFiles() ) ); | 735 | connect( a, SIGNAL( activated() ), this, SLOT( importFiles() ) ); |
736 | a->addTo( file ); | 736 | a->addTo( file ); |
737 | */ | 737 | */ |
738 | 738 | ||
739 | /* | 739 | /* |
740 | a = new QAction( tr( "Paste" ), geticon( "paste" ), QString::null, 0, this, 0 ); | 740 | a = new QAction( tr( "Paste" ), geticon( "paste" ), QString::null, 0, this, 0 ); |
741 | connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); | 741 | connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); |
742 | a->addTo( fileBar ); | 742 | a->addTo( fileBar ); |
743 | a->addTo( edit ); | 743 | a->addTo( edit ); |
744 | */ | 744 | */ |
745 | 745 | ||
746 | // a = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, 0 ); | 746 | // a = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, 0 ); |
747 | 747 | ||
748 | m_fullscreen = false; | 748 | m_fullscreen = false; |
749 | m_actFullscreen = new QAction( tr( "Fullscreen" ), geticon( "fullscreen" ), QString::null, 0, this, NULL, true ); | 749 | m_actFullscreen = new QAction( tr( "Fullscreen" ), geticon( "fullscreen" ), QString::null, 0, this, NULL, true ); |
750 | connect( m_actFullscreen, SIGNAL( toggled(bool) ), this, SLOT( setfullscreen(bool) ) ); | 750 | connect( m_actFullscreen, SIGNAL( toggled(bool) ), this, SLOT( setfullscreen(bool) ) ); |
751 | m_actFullscreen->setOn(m_fullscreen); | 751 | m_actFullscreen->setOn(m_fullscreen); |
752 | m_actFullscreen->addTo( view ); | 752 | m_actFullscreen->addTo( view ); |
753 | 753 | ||
754 | m_rotate_action = new QAction( tr( "Rotate" ), geticon( "repeat" ), QString::null, 0, this, NULL, true ); | 754 | m_rotate_action = new QAction( tr( "Rotate" ), geticon( "repeat" ), QString::null, 0, this, NULL, true ); |
755 | connect( m_rotate_action, SIGNAL( toggled(bool) ), this, SLOT( setrotated(bool) ) ); | 755 | connect( m_rotate_action, SIGNAL( toggled(bool) ), this, SLOT( setrotated(bool) ) ); |
756 | m_rotate_action->setOn(reader->m_rotated); | 756 | m_rotate_action->setOn(reader->m_rotated); |
757 | m_rotate_action->addTo( view ); | 757 | m_rotate_action->addTo( view ); |
758 | 758 | ||
759 | m_inverse_action = new QAction( tr( "Invert" ), getmyicon( "invert" ), QString::null, 0, this, NULL, true ); | 759 | m_inverse_action = new QAction( tr( "Invert" ), getmyicon( "invert" ), QString::null, 0, this, NULL, true ); |
760 | connect( m_inverse_action, SIGNAL( toggled(bool) ), this, SLOT( setinverted(bool) ) ); | 760 | connect( m_inverse_action, SIGNAL( toggled(bool) ), this, SLOT( setinverted(bool) ) ); |
761 | m_inverse_action->setOn(reader->bInverse); | 761 | m_inverse_action->setOn(reader->bInverse); |
762 | m_inverse_action->addTo( view ); | 762 | m_inverse_action->addTo( view ); |
763 | 763 | ||
764 | view->insertSeparator(); | 764 | view->insertSeparator(); |
765 | 765 | ||
766 | m_zoomin_action = new QAction( tr( "Zoom In" ), geticon( "zoom" ), QString::null, 0, this); | 766 | m_zoomin_action = new QAction( tr( "Zoom In" ), geticon( "zoom" ), QString::null, 0, this); |
767 | connect( m_zoomin_action, SIGNAL( activated() ), this, SLOT( zoomin() ) ); | 767 | connect( m_zoomin_action, SIGNAL( activated() ), this, SLOT( zoomin() ) ); |
768 | m_zoomin_action->addTo( view ); | 768 | m_zoomin_action->addTo( view ); |
769 | 769 | ||
770 | m_zoomout_action = new QAction( tr( "Zoom Out" ), geticon( "mag" ), QString::null, 0, this); | 770 | m_zoomout_action = new QAction( tr( "Zoom Out" ), geticon( "mag" ), QString::null, 0, this); |
771 | connect( m_zoomout_action, SIGNAL( activated() ), this, SLOT( zoomout() ) ); | 771 | connect( m_zoomout_action, SIGNAL( activated() ), this, SLOT( zoomout() ) ); |
772 | m_zoomout_action->addTo( view ); | 772 | m_zoomout_action->addTo( view ); |
773 | 773 | ||
774 | view->insertSeparator(); | 774 | view->insertSeparator(); |
775 | m_setfont_action = new QAction( tr( "Set Font" ), getmyicon( "font" ), QString::null, 0, this); | 775 | m_setfont_action = new QAction( tr( "Set Font" ), getmyicon( "font" ), QString::null, 0, this); |
776 | connect( m_setfont_action, SIGNAL( activated() ), this, SLOT( setfont() ) ); | 776 | connect( m_setfont_action, SIGNAL( activated() ), this, SLOT( setfont() ) ); |
777 | m_setfont_action->addTo( view ); | 777 | m_setfont_action->addTo( view ); |
778 | 778 | ||
779 | view->insertSeparator(); | 779 | view->insertSeparator(); |
780 | m_setenc_action = new QAction( tr( "Set Encoding" ), getmyicon( "charset" ), QString::null, 0, this); | 780 | m_setenc_action = new QAction( tr( "Set Encoding" ), getmyicon( "charset" ), QString::null, 0, this); |
781 | connect( m_setenc_action, SIGNAL( activated() ), this, SLOT( chooseencoding() ) ); | 781 | connect( m_setenc_action, SIGNAL( activated() ), this, SLOT( chooseencoding() ) ); |
782 | m_setenc_action->addTo( view ); | 782 | m_setenc_action->addTo( view ); |
783 | 783 | ||
784 | m_setmono_action = new QAction( tr( "Ideogram" ), getmyicon( "ideogram" ), QString::null, 0, this, NULL, true); | 784 | m_setmono_action = new QAction( tr( "Ideogram" ), getmyicon( "ideogram" ), QString::null, 0, this, NULL, true); |
785 | connect( m_setmono_action, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) ); | 785 | connect( m_setmono_action, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) ); |
786 | m_setmono_action->addTo( view ); | 786 | m_setmono_action->addTo( view ); |
787 | m_setmono_action->setOn(reader->m_bMonoSpaced); | 787 | m_setmono_action->setOn(reader->m_bMonoSpaced); |
788 | 788 | ||
789 | 789 | ||
790 | // a = new QAction( tr( "Zoom" ), QString::null, 0, this, NULL, true ); | 790 | // a = new QAction( tr( "Zoom" ), QString::null, 0, this, NULL, true ); |
791 | // a = new QAction( tr( "Zoom" ), geticon( "mag" ), QString::null, 0, this, 0 ); | 791 | // a = new QAction( tr( "Zoom" ), geticon( "mag" ), QString::null, 0, this, 0 ); |
792 | 792 | ||
793 | 793 | ||
794 | 794 | ||
795 | // a->addTo( filebar() ); | 795 | // a->addTo( filebar() ); |
796 | // view->insertSeparator(); | 796 | // view->insertSeparator(); |
797 | 797 | ||
798 | /* | 798 | /* |
799 | a = new QAction( tr( "Ideogram/Word" ), QString::null, 0, this, NULL, true ); | 799 | a = new QAction( tr( "Ideogram/Word" ), QString::null, 0, this, NULL, true ); |
800 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) ); | 800 | connect( a, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) ); |
801 | a->setOn(reader->m_bMonoSpaced); | 801 | a->setOn(reader->m_bMonoSpaced); |
802 | a->addTo( view ); | 802 | a->addTo( view ); |
803 | */ | 803 | */ |
804 | /* | 804 | /* |
805 | a = new QAction( tr( "Set Width" ), QString::null, 0, this, NULL); | 805 | a = new QAction( tr( "Set Width" ), QString::null, 0, this, NULL); |
806 | connect( a, SIGNAL( activated() ), this, SLOT( setspacing() ) ); | 806 | connect( a, SIGNAL( activated() ), this, SLOT( setspacing() ) ); |
807 | a->addTo( view ); | 807 | a->addTo( view ); |
808 | */ | 808 | */ |
809 | 809 | ||
810 | 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); |
811 | connect( m_mark_action, SIGNAL( activated() ), this, SLOT( addbkmk() ) ); | 811 | connect( m_mark_action, SIGNAL( activated() ), this, SLOT( addbkmk() ) ); |
812 | m_mark_action->addTo( marks ); | 812 | m_mark_action->addTo( marks ); |
813 | 813 | ||
814 | 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); |
815 | connect( m_annotate_action, SIGNAL( activated() ), this, SLOT( addanno() ) ); | 815 | connect( m_annotate_action, SIGNAL( activated() ), this, SLOT( addanno() ) ); |
816 | m_annotate_action->addTo( marks ); | 816 | m_annotate_action->addTo( marks ); |
817 | 817 | ||
818 | 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 ); |
819 | connect( m_goto_action, SIGNAL( activated() ), this, SLOT( do_gotomark() ) ); | 819 | connect( m_goto_action, SIGNAL( activated() ), this, SLOT( do_gotomark() ) ); |
820 | m_goto_action->addTo( marks ); | 820 | m_goto_action->addTo( marks ); |
821 | 821 | ||
822 | 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); |
823 | connect( m_delete_action, SIGNAL( activated() ), this, SLOT( do_delmark() ) ); | 823 | connect( m_delete_action, SIGNAL( activated() ), this, SLOT( do_delmark() ) ); |
824 | m_delete_action->addTo( marks ); | 824 | m_delete_action->addTo( marks ); |
825 | 825 | ||
826 | 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 ); |
827 | connect( m_autogen_action, SIGNAL( activated() ), this, SLOT( do_autogen() ) ); | 827 | connect( m_autogen_action, SIGNAL( activated() ), this, SLOT( do_autogen() ) ); |
828 | marks->insertSeparator(); | 828 | marks->insertSeparator(); |
829 | m_autogen_action->addTo( marks ); | 829 | m_autogen_action->addTo( marks ); |
830 | 830 | ||
831 | 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); |
832 | connect( m_clear_action, SIGNAL( activated() ), this, SLOT( clearBkmkList() ) ); | 832 | connect( m_clear_action, SIGNAL( activated() ), this, SLOT( clearBkmkList() ) ); |
833 | m_clear_action->addTo( marks ); | 833 | m_clear_action->addTo( marks ); |
834 | 834 | ||
835 | 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 ); |
836 | connect( m_save_action, SIGNAL( activated() ), this, SLOT( savebkmks() ) ); | 836 | connect( m_save_action, SIGNAL( activated() ), this, SLOT( savebkmks() ) ); |
837 | m_save_action->addTo( marks ); | 837 | m_save_action->addTo( marks ); |
838 | 838 | ||
839 | 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); |
840 | connect( m_tidy_action, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) ); | 840 | connect( m_tidy_action, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) ); |
841 | marks->insertSeparator(); | 841 | marks->insertSeparator(); |
842 | m_tidy_action->addTo( marks ); | 842 | m_tidy_action->addTo( marks ); |
843 | 843 | ||
844 | 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); |
845 | connect( m_startBlock_action, SIGNAL( activated() ), this, SLOT( editMark() ) ); | 845 | connect( m_startBlock_action, SIGNAL( activated() ), this, SLOT( editMark() ) ); |
846 | marks->insertSeparator(); | 846 | marks->insertSeparator(); |
847 | m_startBlock_action->addTo( marks ); | 847 | m_startBlock_action->addTo( marks ); |
848 | 848 | ||
849 | 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); |
850 | connect( m_endBlock_action, SIGNAL( activated() ), this, SLOT( editCopy() ) ); | 850 | connect( m_endBlock_action, SIGNAL( activated() ), this, SLOT( editCopy() ) ); |
851 | m_endBlock_action->addTo( marks ); | 851 | m_endBlock_action->addTo( marks ); |
852 | 852 | ||
853 | m_bkmkAvail = NULL; | 853 | m_bkmkAvail = NULL; |
854 | 854 | ||
855 | 855 | ||
856 | setToolBarsMovable(m_tbmove); | 856 | setToolBarsMovable(m_tbmove); |
857 | addtoolbars(&config); | 857 | addtoolbars(&config); |
858 | if (m_hidebars) | 858 | if (m_hidebars) |
859 | { | 859 | { |
860 | #if defined(USEQPE) | 860 | #if defined(USEQPE) |
861 | menubar->hide(); | 861 | menubar->hide(); |
862 | #endif | 862 | #endif |
863 | if (fileBar != NULL) fileBar->hide(); | 863 | if (fileBar != NULL) fileBar->hide(); |
864 | if (viewBar != NULL) viewBar->hide(); | 864 | if (viewBar != NULL) viewBar->hide(); |
865 | if (navBar != NULL) navBar->hide(); | 865 | if (navBar != NULL) navBar->hide(); |
866 | if (markBar != NULL) markBar->hide(); | 866 | if (markBar != NULL) markBar->hide(); |
867 | mb->hide(); | 867 | mb->hide(); |
868 | } | 868 | } |
869 | 869 | ||
870 | 870 | ||
871 | pbar = new QProgressBar(this); | 871 | pbar = new QProgressBar(this); |
872 | pbar->hide(); | 872 | pbar->hide(); |
873 | 873 | ||
874 | searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE ); | 874 | searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE ); |
875 | 875 | ||
876 | searchBar->setHorizontalStretchable( TRUE ); | 876 | searchBar->setHorizontalStretchable( TRUE ); |
877 | 877 | ||
878 | connect(searchBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); | 878 | connect(searchBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); |
879 | 879 | ||
880 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 880 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
881 | // QFont f("unifont", 16 /*, QFont::Bold*/); | 881 | // QFont f("unifont", 16 /*, QFont::Bold*/); |
882 | // searchEdit->setFont( f ); | 882 | // searchEdit->setFont( f ); |
883 | searchBar->setStretchableWidget( searchEdit ); | 883 | searchBar->setStretchableWidget( searchEdit ); |
884 | 884 | ||
885 | 885 | ||
886 | #ifdef __ISEARCH | 886 | #ifdef __ISEARCH |
887 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 887 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
888 | this, SLOT( search( const QString& ) ) ); | 888 | this, SLOT( search( const QString& ) ) ); |
889 | #else | 889 | #else |
890 | connect( searchEdit, SIGNAL( returnPressed( ) ), | 890 | connect( searchEdit, SIGNAL( returnPressed( ) ), |
891 | this, SLOT( search( ) ) ); | 891 | this, SLOT( search( ) ) ); |
892 | #endif | 892 | #endif |
893 | 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 ); |
894 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); | 894 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); |
895 | a->addTo( searchBar ); | 895 | a->addTo( searchBar ); |
896 | 896 | ||
897 | 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 ); |
898 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 898 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
899 | a->addTo( searchBar ); | 899 | a->addTo( searchBar ); |
900 | 900 | ||
901 | searchBar->hide(); | 901 | searchBar->hide(); |
902 | 902 | ||
903 | regBar = new QFloatBar( "Autogen", this, QMainWindow::Top, TRUE ); | 903 | regBar = new QFloatBar( "Autogen", this, QMainWindow::Top, TRUE ); |
904 | connect(regBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); | 904 | connect(regBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); |
905 | 905 | ||
906 | regBar->setHorizontalStretchable( TRUE ); | 906 | regBar->setHorizontalStretchable( TRUE ); |
907 | 907 | ||
908 | regEdit = new QLineEdit( regBar, "regEdit" ); | 908 | regEdit = new QLineEdit( regBar, "regEdit" ); |
909 | // regEdit->setFont( f ); | 909 | // regEdit->setFont( f ); |
910 | 910 | ||
911 | regBar->setStretchableWidget( regEdit ); | 911 | regBar->setStretchableWidget( regEdit ); |
912 | 912 | ||
913 | connect( regEdit, SIGNAL( returnPressed( ) ), | 913 | connect( regEdit, SIGNAL( returnPressed( ) ), |
914 | this, SLOT( do_regaction() ) ); | 914 | this, SLOT( do_regaction() ) ); |
915 | 915 | ||
916 | 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 ); |
917 | connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) ); | 917 | connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) ); |
918 | a->addTo( regBar ); | 918 | a->addTo( regBar ); |
919 | 919 | ||
920 | a = new QAction( tr( "Close Edit" ), geticon( "close" ), QString::null, 0, this, 0 ); | 920 | a = new QAction( tr( "Close Edit" ), geticon( "close" ), QString::null, 0, this, 0 ); |
921 | connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) ); | 921 | connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) ); |
922 | a->addTo( regBar ); | 922 | a->addTo( regBar ); |
923 | 923 | ||
924 | regBar->hide(); | 924 | regBar->hide(); |
925 | 925 | ||
926 | m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE ); | 926 | m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE ); |
927 | 927 | ||
928 | m_fontBar->setHorizontalStretchable( TRUE ); | 928 | m_fontBar->setHorizontalStretchable( TRUE ); |
929 | 929 | ||
930 | // qDebug("Font selector"); | 930 | // qDebug("Font selector"); |
931 | m_fontSelector = new QComboBox(false, m_fontBar); | 931 | m_fontSelector = new QComboBox(false, m_fontBar); |
932 | m_fontBar->setStretchableWidget( m_fontSelector ); | 932 | m_fontBar->setStretchableWidget( m_fontSelector ); |
933 | { | 933 | { |
934 | QFontDatabase f; | 934 | QFontDatabase f; |
935 | QStringList flist = f.families(); | 935 | QStringList flist = f.families(); |
936 | bool realfont = false; | 936 | bool realfont = false; |
937 | for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) | 937 | for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) |
938 | { | 938 | { |
939 | if (reader->m_fontname == *nm) | 939 | if (reader->m_fontname == *nm) |
940 | { | 940 | { |
941 | realfont = true; | 941 | realfont = true; |
942 | } | 942 | } |
943 | if ((*nm).contains(FIXEDFONT,false)) reader->m_fontControl.hasCourier(true, *nm); | 943 | if ((*nm).contains(FIXEDFONT,false)) reader->m_fontControl.hasCourier(true, *nm); |
944 | } | 944 | } |
945 | if (!realfont) reader->m_fontname = flist[0]; | 945 | if (!realfont) reader->m_fontname = flist[0]; |
946 | } // delete the FontDatabase!!! | 946 | } // delete the FontDatabase!!! |
947 | connect( m_fontSelector, SIGNAL( activated(const QString& ) ), | 947 | connect( m_fontSelector, SIGNAL( activated(const QString& ) ), |
948 | this, SLOT( do_setfont(const QString&) ) ); | 948 | this, SLOT( do_setfont(const QString&) ) ); |
949 | connect( m_fontSelector, SIGNAL( activated(int ) ), | 949 | connect( m_fontSelector, SIGNAL( activated(int ) ), |
950 | this, SLOT( do_setencoding(int) ) ); | 950 | this, SLOT( do_setencoding(int) ) ); |
951 | 951 | ||
952 | m_fontBar->hide(); | 952 | m_fontBar->hide(); |
953 | m_fontVisible = false; | 953 | m_fontVisible = false; |
954 | #ifdef USEMSGS | 954 | #ifdef USEMSGS |
955 | connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ), | 955 | connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ), |
956 | this, SLOT( msgHandler(const QCString&, const QByteArray&) ) ); | 956 | this, SLOT( msgHandler(const QCString&, const QByteArray&) ) ); |
957 | #endif | 957 | #endif |
958 | // qDebug("Initing"); | 958 | // qDebug("Initing"); |
959 | 959 | ||
960 | m_layout->addWidget(editorStack); | 960 | m_layout->addWidget(editorStack); |
961 | if (m_qtscroll != 0) | 961 | if (m_qtscroll != 0) |
962 | { | 962 | { |
963 | /* | 963 | /* |
964 | 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 ); |
965 | 965 | ||
966 | m_scrollbar->setVerticalStretchable( TRUE ); | 966 | m_scrollbar->setVerticalStretchable( TRUE ); |
967 | */ | 967 | */ |
968 | scrollbar = m_scrollbar = new QScrollBar(QScrollBar::Vertical, widge); | 968 | scrollbar = m_scrollbar = new QScrollBar(QScrollBar::Vertical, widge); |
969 | m_layout->addWidget(scrollbar); | 969 | m_layout->addWidget(scrollbar); |
970 | scrollbar->setTracking(false); | 970 | scrollbar->setTracking(false); |
971 | //connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); | 971 | //connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); |
972 | //m_scrollbar->setStretchableWidget( scrollbar ); | 972 | //m_scrollbar->setStretchableWidget( scrollbar ); |
973 | if (m_scrollishidden) | 973 | if (m_scrollishidden) |
974 | { | 974 | { |
975 | m_scrollbar->hide(); | 975 | m_scrollbar->hide(); |
976 | } | 976 | } |
977 | else | 977 | else |
978 | { | 978 | { |
979 | m_scrollbar->show(); | 979 | m_scrollbar->show(); |
980 | } | 980 | } |
981 | 981 | ||
982 | setrotated(reader->m_rotated); | 982 | setrotated(reader->m_rotated); |
983 | } | 983 | } |
984 | else | 984 | else |
985 | { | 985 | { |
986 | m_scrollbar = NULL; | 986 | m_scrollbar = NULL; |
987 | } | 987 | } |
988 | setBackgroundBitmap(); | 988 | setBackgroundBitmap(); |
989 | m_inverse_action->setOn(reader->bInverse); | 989 | m_inverse_action->setOn(reader->bInverse); |
990 | reader->init(); | 990 | reader->init(); |
991 | 991 | ||
992 | // qDebug("Inited"); | 992 | // qDebug("Inited"); |
993 | // m_buttonAction[m_spaceTarget]->setOn(true); | 993 | // m_buttonAction[m_spaceTarget]->setOn(true); |
994 | // qDebug("fonting"); | 994 | // qDebug("fonting"); |
995 | do_setfont(reader->m_fontname); | 995 | do_setfont(reader->m_fontname); |
996 | // qDebug("fonted"); | 996 | // qDebug("fonted"); |
997 | QFont progfont(reader->m_fontname, reader->m_fontControl.getsize(0)); | 997 | QFont progfont(reader->m_fontname, reader->m_fontControl.getsize(0)); |
998 | m_prog->setFont( progfont ); | 998 | m_prog->setFont( progfont ); |
999 | if (m_statusishidden) m_prog->hide(); | 999 | if (m_statusishidden) m_prog->hide(); |
1000 | showEditTools(); | 1000 | showEditTools(); |
1001 | if (!reader->m_lastfile.isEmpty()) | 1001 | if (!reader->m_lastfile.isEmpty()) |
1002 | { | 1002 | { |
1003 | //qDebug("doclnk"); | 1003 | //qDebug("doclnk"); |
1004 | //doc = new DocLnk(reader->m_lastfile); | 1004 | //doc = new DocLnk(reader->m_lastfile); |
1005 | //qDebug("doclnk done"); | 1005 | //qDebug("doclnk done"); |
1006 | if (pOpenlist != NULL) | 1006 | if (pOpenlist != NULL) |
1007 | { | 1007 | { |
1008 | 1008 | ||
1009 | /* | 1009 | /* |
1010 | int ind = 0; | 1010 | int ind = 0; |
1011 | Bkmk* p = (*pOpenlist)[ind]; | 1011 | Bkmk* p = (*pOpenlist)[ind]; |
1012 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) | 1012 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) |
1013 | { | 1013 | { |
1014 | p = (*pOpenlist)[++ind]; | 1014 | p = (*pOpenlist)[++ind]; |
1015 | } | 1015 | } |
1016 | */ | 1016 | */ |
1017 | Bkmk* p = NULL; | 1017 | Bkmk* p = NULL; |
1018 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) | 1018 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) |
1019 | { | 1019 | { |
1020 | p = iter.pContent(); | 1020 | p = iter.pContent(); |
1021 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) | 1021 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) |
1022 | { | 1022 | { |
1023 | break; | 1023 | break; |
1024 | } | 1024 | } |
1025 | // qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name())); | 1025 | // qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name())); |
1026 | p = NULL; | 1026 | p = NULL; |
1027 | } | 1027 | } |
1028 | if (p != NULL) | 1028 | if (p != NULL) |
1029 | { | 1029 | { |
1030 | if (!openfrombkmk(p)) | 1030 | if (!openfrombkmk(p)) |
1031 | { | 1031 | { |
1032 | showEditTools(); | 1032 | showEditTools(); |
1033 | } | 1033 | } |
1034 | } | 1034 | } |
1035 | else | 1035 | else |
1036 | { | 1036 | { |
1037 | openFile( reader->m_lastfile ); | 1037 | openFile( reader->m_lastfile ); |
1038 | } | 1038 | } |
1039 | } | 1039 | } |
1040 | else | 1040 | else |
1041 | { | 1041 | { |
1042 | if (!reader->m_lastfile.isEmpty()) | 1042 | if (!reader->m_lastfile.isEmpty()) |
1043 | { | 1043 | { |
1044 | openFile( reader->m_lastfile ); | 1044 | openFile( reader->m_lastfile ); |
1045 | } | 1045 | } |
1046 | } | 1046 | } |
1047 | } | 1047 | } |
1048 | else | 1048 | else |
1049 | { | 1049 | { |
1050 | showEditTools(); | 1050 | showEditTools(); |
1051 | } | 1051 | } |
1052 | // qApp->processEvents(); | 1052 | // qApp->processEvents(); |
1053 | if (m_scrollbar == NULL || m_scrollbar->isHidden()) | 1053 | if (m_scrollbar == NULL || m_scrollbar->isHidden()) |
1054 | { | 1054 | { |
1055 | reader->m_scrollpos = m_localscroll; | 1055 | reader->m_scrollpos = m_localscroll; |
1056 | } | 1056 | } |
1057 | else | 1057 | else |
1058 | { | 1058 | { |
1059 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; | 1059 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; |
1060 | } | 1060 | } |
1061 | // reader->bDoUpdates = true; | 1061 | // reader->bDoUpdates = true; |
1062 | // reader->update(); | 1062 | // reader->update(); |
1063 | config.setGroup("Version"); | 1063 | config.setGroup("Version"); |
1064 | int major = config.readNumEntry("Major", 0); | 1064 | int major = config.readNumEntry("Major", 0); |
1065 | int bkmktype = config.readNumEntry("BkmkType", 0); | 1065 | int bkmktype = config.readNumEntry("BkmkType", 0); |
1066 | char minor = config.readNumEntry("Minor", 0); | 1066 | char minor = config.readNumEntry("Minor", 0); |
1067 | if (CheckVersion(major, bkmktype, minor, this)) | 1067 | if (CheckVersion(major, bkmktype, minor, this)) |
1068 | { | 1068 | { |
1069 | config.writeEntry("Major", major); | 1069 | config.writeEntry("Major", major); |
1070 | config.writeEntry("BkmkType", bkmktype); | 1070 | config.writeEntry("BkmkType", bkmktype); |
1071 | config.writeEntry("Minor", (int)minor); | 1071 | config.writeEntry("Minor", (int)minor); |
1072 | } | 1072 | } |
1073 | // qDebug("finished update"); | 1073 | // qDebug("finished update"); |
1074 | if (kmap.isEmpty()) | 1074 | if (kmap.isEmpty()) |
1075 | { | 1075 | { |
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."); | 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."); |
1077 | 1077 | ||
1078 | m_buttonprefs->mapkey(Qt::NoButton, Key_Up, cesPageUp); | 1078 | m_buttonprefs->mapkey(Qt::NoButton, Key_Up, cesPageUp); |
1079 | m_buttonprefs->mapkey(Qt::NoButton, Key_Down, cesPageDown); | 1079 | m_buttonprefs->mapkey(Qt::NoButton, Key_Down, cesPageDown); |
1080 | 1080 | ||
1081 | m_buttonprefs->mapkey(Qt::NoButton, Key_Right, cesZoomIn); | 1081 | m_buttonprefs->mapkey(Qt::NoButton, Key_Right, cesZoomIn); |
1082 | m_buttonprefs->mapkey(Qt::NoButton, Key_Left, cesZoomOut); | 1082 | m_buttonprefs->mapkey(Qt::NoButton, Key_Left, cesZoomOut); |
1083 | 1083 | ||
1084 | showbuttonprefs(); | 1084 | showbuttonprefs(); |
1085 | } | 1085 | } |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | void QTReaderApp::addtoolbars(Config* config) | 1088 | void QTReaderApp::addtoolbars(Config* config) |
1089 | { | 1089 | { |
1090 | config->setGroup("Toolbar"); | 1090 | config->setGroup("Toolbar"); |
1091 | 1091 | ||
1092 | if (fileBar != NULL) | 1092 | if (fileBar != NULL) |
1093 | { | 1093 | { |
1094 | #if defined(USEQPE) | 1094 | #if defined(USEQPE) |
1095 | if (fileBar != menubar) | 1095 | if (fileBar != menubar) |
1096 | { | 1096 | { |
1097 | fileBar->clear(); | 1097 | fileBar->clear(); |
1098 | } | 1098 | } |
1099 | else | 1099 | else |
1100 | { | 1100 | { |
1101 | m_preferences_action->removeFrom( filebar() ); | 1101 | m_preferences_action->removeFrom( filebar() ); |
1102 | m_open_action->removeFrom( filebar() ); | 1102 | m_open_action->removeFrom( filebar() ); |
1103 | m_close_action->removeFrom( filebar() ); | 1103 | m_close_action->removeFrom( filebar() ); |
1104 | m_info_action->removeFrom( filebar() ); | 1104 | m_info_action->removeFrom( filebar() ); |
1105 | m_touch_action->removeFrom( filebar() ); | 1105 | m_touch_action->removeFrom( filebar() ); |
1106 | m_find_action->removeFrom( filebar() ); | 1106 | m_find_action->removeFrom( filebar() ); |
1107 | } | 1107 | } |
1108 | #else | 1108 | #else |
1109 | fileBar->clear(); | 1109 | fileBar->clear(); |
1110 | #endif | 1110 | #endif |
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | m_preferences_action->addTo( filebar() ); | 1113 | m_preferences_action->addTo( filebar() ); |
1114 | addfilebar(config, "Open", m_open_action); | 1114 | addfilebar(config, "Open", m_open_action); |
1115 | addfilebar(config, "Close", m_close_action); | 1115 | addfilebar(config, "Close", m_close_action); |
1116 | addfilebar(config, "Info", m_info_action); | 1116 | addfilebar(config, "Info", m_info_action); |
1117 | addfilebar(config, "Two/One Touch", m_touch_action); | 1117 | addfilebar(config, "Two/One Touch", m_touch_action); |
1118 | addfilebar(config, "Find", m_find_action); | 1118 | addfilebar(config, "Find", m_find_action); |
1119 | 1119 | ||
1120 | if (navBar != NULL) | 1120 | if (navBar != NULL) |
1121 | { | 1121 | { |
1122 | #if defined(USEQPE) | 1122 | #if defined(USEQPE) |
1123 | if ((navBar == fileBar) && (fileBar == menubar)) | 1123 | if ((navBar == fileBar) && (fileBar == menubar)) |
1124 | #else | 1124 | #else |
1125 | if (navBar == fileBar) | 1125 | if (navBar == fileBar) |
1126 | #endif | 1126 | #endif |
1127 | { | 1127 | { |
1128 | m_scrollButton->removeFrom( navbar() ); | 1128 | m_scrollButton->removeFrom( navbar() ); |
1129 | m_start_action->removeFrom( navbar() ); | 1129 | m_start_action->removeFrom( navbar() ); |
1130 | m_end_action->removeFrom( navbar() ); | 1130 | m_end_action->removeFrom( navbar() ); |
1131 | m_jump_action->removeFrom( navbar() ); | 1131 | m_jump_action->removeFrom( navbar() ); |
1132 | m_pageline_action->removeFrom( navbar() ); | 1132 | m_pageline_action->removeFrom( navbar() ); |
1133 | m_pageup_action->removeFrom( navbar() ); | 1133 | m_pageup_action->removeFrom( navbar() ); |
1134 | m_pagedn_action->removeFrom( navbar() ); | 1134 | m_pagedn_action->removeFrom( navbar() ); |
1135 | m_back_action->removeFrom( navbar() ); | 1135 | m_back_action->removeFrom( navbar() ); |
1136 | m_home_action->removeFrom( navbar() ); | 1136 | m_home_action->removeFrom( navbar() ); |
1137 | m_forward_action->removeFrom( navbar() ); | 1137 | m_forward_action->removeFrom( navbar() ); |
1138 | } | 1138 | } |
1139 | else if (navBar != fileBar) | 1139 | else if (navBar != fileBar) |
1140 | { | 1140 | { |
1141 | navBar->clear(); | 1141 | navBar->clear(); |
1142 | } | 1142 | } |
1143 | } | 1143 | } |
1144 | 1144 | ||
1145 | addnavbar(config, "Scroll", m_scrollButton); | 1145 | addnavbar(config, "Scroll", m_scrollButton); |
1146 | addnavbar(config, "Goto Start", m_start_action); | 1146 | addnavbar(config, "Goto Start", m_start_action); |
1147 | addnavbar(config, "Goto End", m_end_action); | 1147 | addnavbar(config, "Goto End", m_end_action); |
1148 | 1148 | ||
1149 | addnavbar(config, "Jump", m_jump_action); | 1149 | addnavbar(config, "Jump", m_jump_action); |
1150 | addnavbar(config, "Page/Line Scroll", m_pageline_action); | 1150 | addnavbar(config, "Page/Line Scroll", m_pageline_action); |
1151 | 1151 | ||
1152 | addnavbar(config, "Page Up", m_pageup_action); | 1152 | addnavbar(config, "Page Up", m_pageup_action); |
1153 | addnavbar(config, "Page Down", m_pagedn_action); | 1153 | addnavbar(config, "Page Down", m_pagedn_action); |
1154 | 1154 | ||
1155 | addnavbar(config, "Back", m_back_action); | 1155 | addnavbar(config, "Back", m_back_action); |
1156 | addnavbar(config, "Home", m_home_action); | 1156 | addnavbar(config, "Home", m_home_action); |
1157 | addnavbar(config, "Forward", m_forward_action); | 1157 | addnavbar(config, "Forward", m_forward_action); |
1158 | 1158 | ||
1159 | if (viewBar != NULL) | 1159 | if (viewBar != NULL) |
1160 | { | 1160 | { |
1161 | #if defined(USEQPE) | 1161 | #if defined(USEQPE) |
1162 | if ((viewBar == fileBar) && (fileBar == menubar)) | 1162 | if ((viewBar == fileBar) && (fileBar == menubar)) |
1163 | #else | 1163 | #else |
1164 | if (viewBar == fileBar) | 1164 | if (viewBar == fileBar) |
1165 | #endif | 1165 | #endif |
1166 | { | 1166 | { |
1167 | m_actFullscreen->removeFrom( filebar() ); | 1167 | m_actFullscreen->removeFrom( filebar() ); |
1168 | m_rotate_action->removeFrom( viewbar() ); | 1168 | m_rotate_action->removeFrom( viewbar() ); |
1169 | m_inverse_action->removeFrom( viewbar() ); | 1169 | m_inverse_action->removeFrom( viewbar() ); |
1170 | m_zoomin_action->removeFrom( viewbar() ); | 1170 | m_zoomin_action->removeFrom( viewbar() ); |
1171 | m_zoomout_action->removeFrom( viewbar() ); | 1171 | m_zoomout_action->removeFrom( viewbar() ); |
1172 | m_setfont_action->removeFrom( viewbar() ); | 1172 | m_setfont_action->removeFrom( viewbar() ); |
1173 | m_setenc_action->removeFrom( viewbar() ); | 1173 | m_setenc_action->removeFrom( viewbar() ); |
1174 | m_setmono_action->removeFrom( viewbar() ); | 1174 | m_setmono_action->removeFrom( viewbar() ); |
1175 | } | 1175 | } |
1176 | else if (viewBar != fileBar) | 1176 | else if (viewBar != fileBar) |
1177 | { | 1177 | { |
1178 | viewBar->clear(); | 1178 | viewBar->clear(); |
1179 | } | 1179 | } |
1180 | } | 1180 | } |
1181 | 1181 | ||
1182 | addviewbar(config, "Fullscreen", m_actFullscreen); | 1182 | addviewbar(config, "Fullscreen", m_actFullscreen); |
1183 | addviewbar(config, "Rotate", m_rotate_action); | 1183 | addviewbar(config, "Rotate", m_rotate_action); |
1184 | addviewbar(config, "Invert Action", m_inverse_action); | 1184 | addviewbar(config, "Invert Action", m_inverse_action); |
1185 | addviewbar(config, "Zoom In", m_zoomin_action); | 1185 | addviewbar(config, "Zoom In", m_zoomin_action); |
1186 | addviewbar(config, "Zoom Out", m_zoomout_action); | 1186 | addviewbar(config, "Zoom Out", m_zoomout_action); |
1187 | addviewbar(config, "Set Font", m_setfont_action); | 1187 | addviewbar(config, "Set Font", m_setfont_action); |
1188 | addviewbar(config, "Encoding Select", m_setenc_action); | 1188 | addviewbar(config, "Encoding Select", m_setenc_action); |
1189 | addviewbar(config, "Ideogram Mode", m_setmono_action); | 1189 | addviewbar(config, "Ideogram Mode", m_setmono_action); |
1190 | 1190 | ||
1191 | if (markBar != NULL) | 1191 | if (markBar != NULL) |
1192 | { | 1192 | { |
1193 | #if defined(USEQPE) | 1193 | #if defined(USEQPE) |
1194 | if ((markBar == fileBar) && (fileBar == menubar)) | 1194 | if ((markBar == fileBar) && (fileBar == menubar)) |
1195 | #else | 1195 | #else |
1196 | if (markBar == fileBar) | 1196 | if (markBar == fileBar) |
1197 | #endif | 1197 | #endif |
1198 | { | 1198 | { |
1199 | m_mark_action->removeFrom( markbar() ); | 1199 | m_mark_action->removeFrom( markbar() ); |
1200 | m_annotate_action->removeFrom( markbar()); | 1200 | m_annotate_action->removeFrom( markbar()); |
1201 | m_goto_action->removeFrom( markbar() ); | 1201 | m_goto_action->removeFrom( markbar() ); |
1202 | m_delete_action->removeFrom( markbar() ); | 1202 | m_delete_action->removeFrom( markbar() ); |
1203 | m_autogen_action->removeFrom( markbar() ); | 1203 | m_autogen_action->removeFrom( markbar() ); |
1204 | m_clear_action->removeFrom( markbar() ); | 1204 | m_clear_action->removeFrom( markbar() ); |
1205 | m_save_action->removeFrom( markbar() ); | 1205 | m_save_action->removeFrom( markbar() ); |
1206 | m_tidy_action->removeFrom( markbar() ); | 1206 | m_tidy_action->removeFrom( markbar() ); |
1207 | m_startBlock_action->removeFrom( markbar() ); | 1207 | m_startBlock_action->removeFrom( markbar() ); |
1208 | m_endBlock_action->removeFrom( markbar() ); | 1208 | m_endBlock_action->removeFrom( markbar() ); |
1209 | } | 1209 | } |
1210 | else if (markBar != fileBar) | 1210 | else if (markBar != fileBar) |
1211 | { | 1211 | { |
1212 | markBar->clear(); | 1212 | markBar->clear(); |
1213 | } | 1213 | } |
1214 | } | 1214 | } |
1215 | addmarkbar(config, "Mark", m_mark_action); | 1215 | addmarkbar(config, "Mark", m_mark_action); |
1216 | addmarkbar(config, "Annotate", m_annotate_action); | 1216 | addmarkbar(config, "Annotate", m_annotate_action); |
1217 | addmarkbar(config, "Goto", m_goto_action); | 1217 | addmarkbar(config, "Goto", m_goto_action); |
1218 | addmarkbar(config, "Delete", m_delete_action); | 1218 | addmarkbar(config, "Delete", m_delete_action); |
1219 | addmarkbar(config, "Autogen", m_autogen_action); | 1219 | addmarkbar(config, "Autogen", m_autogen_action); |
1220 | addmarkbar(config, "Clear", m_clear_action); | 1220 | addmarkbar(config, "Clear", m_clear_action); |
1221 | addmarkbar(config, "Save", m_save_action); | 1221 | addmarkbar(config, "Save", m_save_action); |
1222 | addmarkbar(config, "Tidy", m_tidy_action); | 1222 | addmarkbar(config, "Tidy", m_tidy_action); |
1223 | addmarkbar(config, "Start Block", m_startBlock_action); | 1223 | addmarkbar(config, "Start Block", m_startBlock_action); |
1224 | addmarkbar(config, "Copy Block", m_endBlock_action); | 1224 | addmarkbar(config, "Copy Block", m_endBlock_action); |
1225 | if (checkbar(config, "Annotation indicator")) | 1225 | if (checkbar(config, "Annotation indicator")) |
1226 | { | 1226 | { |
1227 | if (m_bkmkAvail == NULL) | 1227 | if (m_bkmkAvail == NULL) |
1228 | { | 1228 | { |
1229 | 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 ); |
1230 | connect( m_bkmkAvail, SIGNAL( activated() ), this, SLOT( showAnnotation() ) ); | 1230 | connect( m_bkmkAvail, SIGNAL( activated() ), this, SLOT( showAnnotation() ) ); |
1231 | 1231 | ||
1232 | m_bkmkAvail->setEnabled(false); | 1232 | m_bkmkAvail->setEnabled(false); |
1233 | } | 1233 | } |
1234 | QLabel *spacer = new QLabel(markBar, ""); | 1234 | QLabel *spacer = new QLabel(markBar, ""); |
1235 | markbar()->setStretchableWidget(spacer); | 1235 | markbar()->setStretchableWidget(spacer); |
1236 | m_bkmkAvail->removeFrom( markbar() ); | 1236 | m_bkmkAvail->removeFrom( markbar() ); |
1237 | m_bkmkAvail->addTo( markbar() ); | 1237 | m_bkmkAvail->addTo( markbar() ); |
1238 | } | 1238 | } |
1239 | else | 1239 | else |
1240 | { | 1240 | { |
1241 | if (m_bkmkAvail != NULL) | 1241 | if (m_bkmkAvail != NULL) |
1242 | { | 1242 | { |
1243 | m_bkmkAvail->removeFrom( markbar() ); | 1243 | m_bkmkAvail->removeFrom( markbar() ); |
1244 | delete m_bkmkAvail; | 1244 | delete m_bkmkAvail; |
1245 | m_bkmkAvail = NULL; | 1245 | m_bkmkAvail = NULL; |
1246 | } | 1246 | } |
1247 | } | 1247 | } |
1248 | } | 1248 | } |
1249 | 1249 | ||
1250 | bool QTReaderApp::checkbar(Config* _config, const QString& key) | 1250 | bool QTReaderApp::checkbar(Config* _config, const QString& key) |
1251 | { | 1251 | { |
1252 | return _config->readBoolEntry(key, false); | 1252 | return _config->readBoolEntry(key, false); |
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | 1255 | ||
1256 | QToolBar* QTReaderApp::filebar() | 1256 | QToolBar* QTReaderApp::filebar() |
1257 | { | 1257 | { |
1258 | if (fileBar == NULL) | 1258 | if (fileBar == NULL) |
1259 | { | 1259 | { |
1260 | switch (m_tbpol) | 1260 | switch (m_tbpol) |
1261 | { | 1261 | { |
1262 | #if defined(USEQPE) | 1262 | #if defined(USEQPE) |
1263 | case cesSingle: | 1263 | case cesSingle: |
1264 | // qDebug("Setting filebar to menubar"); | 1264 | // qDebug("Setting filebar to menubar"); |
1265 | fileBar = menubar; | 1265 | fileBar = menubar; |
1266 | break; | 1266 | break; |
1267 | #endif | 1267 | #endif |
1268 | default: | 1268 | default: |
1269 | qDebug("Incorrect toolbar policy set"); | 1269 | qDebug("Incorrect toolbar policy set"); |
1270 | case cesMenuTool: | 1270 | case cesMenuTool: |
1271 | case cesMultiple: | 1271 | case cesMultiple: |
1272 | // qDebug("Creating new file bar"); | 1272 | // qDebug("Creating new file bar"); |
1273 | fileBar = new QToolBar("File", this, m_tbposition); | 1273 | fileBar = new QToolBar("File", this, m_tbposition); |
1274 | break; | 1274 | break; |
1275 | } | 1275 | } |
1276 | //fileBar->setHorizontalStretchable( true ); | 1276 | //fileBar->setHorizontalStretchable( true ); |
1277 | } | 1277 | } |
1278 | return fileBar; | 1278 | return fileBar; |
1279 | } | 1279 | } |
1280 | QToolBar* QTReaderApp::viewbar() | 1280 | QToolBar* QTReaderApp::viewbar() |
1281 | { | 1281 | { |
1282 | if (viewBar == NULL) | 1282 | if (viewBar == NULL) |
1283 | { | 1283 | { |
1284 | switch (m_tbpol) | 1284 | switch (m_tbpol) |
1285 | { | 1285 | { |
1286 | case cesMultiple: | 1286 | case cesMultiple: |
1287 | viewBar = new QToolBar("View", this, m_tbposition); | 1287 | viewBar = new QToolBar("View", this, m_tbposition); |
1288 | break; | 1288 | break; |
1289 | default: | 1289 | default: |
1290 | qDebug("Incorrect toolbar policy set"); | 1290 | qDebug("Incorrect toolbar policy set"); |
1291 | #ifdef USEQPE | 1291 | #ifdef USEQPE |
1292 | case cesSingle: | 1292 | case cesSingle: |
1293 | #endif | 1293 | #endif |
1294 | case cesMenuTool: | 1294 | case cesMenuTool: |
1295 | viewBar = fileBar; | 1295 | viewBar = fileBar; |
1296 | break; | 1296 | break; |
1297 | } | 1297 | } |
1298 | } | 1298 | } |
1299 | return viewBar; | 1299 | return viewBar; |
1300 | } | 1300 | } |
1301 | QToolBar* QTReaderApp::navbar() | 1301 | QToolBar* QTReaderApp::navbar() |
1302 | { | 1302 | { |
1303 | if (navBar == NULL) | 1303 | if (navBar == NULL) |
1304 | { | 1304 | { |
1305 | switch (m_tbpol) | 1305 | switch (m_tbpol) |
1306 | { | 1306 | { |
1307 | case cesMultiple: | 1307 | case cesMultiple: |
1308 | // qDebug("Creating new nav bar"); | 1308 | // qDebug("Creating new nav bar"); |
1309 | navBar = new QToolBar("Navigation", this, m_tbposition); | 1309 | navBar = new QToolBar("Navigation", this, m_tbposition); |
1310 | break; | 1310 | break; |
1311 | default: | 1311 | default: |
1312 | qDebug("Incorrect toolbar policy set"); | 1312 | qDebug("Incorrect toolbar policy set"); |
1313 | #ifdef USEQPE | 1313 | #ifdef USEQPE |
1314 | case cesSingle: | 1314 | case cesSingle: |
1315 | #endif | 1315 | #endif |
1316 | case cesMenuTool: | 1316 | case cesMenuTool: |
1317 | navBar = fileBar; | 1317 | navBar = fileBar; |
1318 | // qDebug("Setting navbar to filebar"); | 1318 | // qDebug("Setting navbar to filebar"); |
1319 | break; | 1319 | break; |
1320 | } | 1320 | } |
1321 | } | 1321 | } |
1322 | return navBar; | 1322 | return navBar; |
1323 | } | 1323 | } |
1324 | QToolBar* QTReaderApp::markbar() | 1324 | QToolBar* QTReaderApp::markbar() |
1325 | { | 1325 | { |
1326 | if (markBar == NULL) | 1326 | if (markBar == NULL) |
1327 | { | 1327 | { |
1328 | switch (m_tbpol) | 1328 | switch (m_tbpol) |
1329 | { | 1329 | { |
1330 | case cesMultiple: | 1330 | case cesMultiple: |
1331 | markBar = new QToolBar("Marks", this, m_tbposition); | 1331 | markBar = new QToolBar("Marks", this, m_tbposition); |
1332 | break; | 1332 | break; |
1333 | default: | 1333 | default: |
1334 | qDebug("Incorrect toolbar policy set"); | 1334 | qDebug("Incorrect toolbar policy set"); |
1335 | #ifdef USEQPE | 1335 | #ifdef USEQPE |
1336 | case cesSingle: | 1336 | case cesSingle: |
1337 | #endif | 1337 | #endif |
1338 | case cesMenuTool: | 1338 | case cesMenuTool: |
1339 | markBar = fileBar; | 1339 | markBar = fileBar; |
1340 | break; | 1340 | break; |
1341 | } | 1341 | } |
1342 | } | 1342 | } |
1343 | return markBar; | 1343 | return markBar; |
1344 | } | 1344 | } |
1345 | 1345 | ||
1346 | void QTReaderApp::addfilebar(Config* _config, const QString& key, QAction* a) | 1346 | void QTReaderApp::addfilebar(Config* _config, const QString& key, QAction* a) |
1347 | { | 1347 | { |
1348 | if (_config->readBoolEntry(key, false)) a->addTo( filebar() ); | 1348 | if (_config->readBoolEntry(key, false)) a->addTo( filebar() ); |
1349 | } | 1349 | } |
1350 | void QTReaderApp::addnavbar(Config* _config, const QString& key, QAction* a) | 1350 | void QTReaderApp::addnavbar(Config* _config, const QString& key, QAction* a) |
1351 | { | 1351 | { |
1352 | if (_config->readBoolEntry(key, false)) a->addTo( navbar() ); | 1352 | if (_config->readBoolEntry(key, false)) a->addTo( navbar() ); |
1353 | } | 1353 | } |
1354 | void QTReaderApp::addmarkbar(Config* _config, const QString& key, QAction* a) | 1354 | void QTReaderApp::addmarkbar(Config* _config, const QString& key, QAction* a) |
1355 | { | 1355 | { |
1356 | if (_config->readBoolEntry(key, false)) a->addTo( markbar() ); | 1356 | if (_config->readBoolEntry(key, false)) a->addTo( markbar() ); |
1357 | } | 1357 | } |
1358 | void QTReaderApp::addviewbar(Config* _config, const QString& key, QAction* a) | 1358 | void QTReaderApp::addviewbar(Config* _config, const QString& key, QAction* a) |
1359 | { | 1359 | { |
1360 | if (_config->readBoolEntry(key, false)) a->addTo( viewbar() ); | 1360 | if (_config->readBoolEntry(key, false)) a->addTo( viewbar() ); |
1361 | } | 1361 | } |
1362 | 1362 | ||
1363 | void QTReaderApp::suspend() { reader->suspend(); } | 1363 | void QTReaderApp::suspend() { reader->suspend(); } |
1364 | 1364 | ||
1365 | void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data) | 1365 | void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data) |
1366 | { | 1366 | { |
1367 | #ifndef USEMSGS | 1367 | #ifndef USEMSGS |
1368 | return; | 1368 | return; |
1369 | #else | 1369 | #else |
1370 | QString msg = QString::fromUtf8(_msg); | 1370 | QString msg = QString::fromUtf8(_msg); |
1371 | 1371 | ||
1372 | qDebug("Received:%s", (const char*)msg); | 1372 | qDebug("Received:%s", (const char*)msg); |
1373 | QDataStream stream( _data, IO_ReadOnly ); | 1373 | QDataStream stream( _data, IO_ReadOnly ); |
1374 | if ( msg == "suspend()" ) | 1374 | if ( msg == "suspend()" ) |
1375 | { | 1375 | { |
1376 | qDebug("Suspending"); | 1376 | qDebug("Suspending"); |
1377 | suspend(); | 1377 | suspend(); |
1378 | qDebug("Suspendedb"); | 1378 | qDebug("Suspendedb"); |
1379 | } | 1379 | } |
1380 | return; | 1380 | return; |
1381 | /* | 1381 | /* |
1382 | QDataStream stream( _data, IO_ReadOnly ); | 1382 | QDataStream stream( _data, IO_ReadOnly ); |
1383 | if ( msg == "info(QString)" ) | 1383 | if ( msg == "info(QString)" ) |
1384 | { | 1384 | { |
1385 | QString info; | 1385 | QString info; |
1386 | stream >> info; | 1386 | stream >> info; |
1387 | QMessageBox::information(this, PROGNAME, info); | 1387 | QMessageBox::information(this, PROGNAME, info); |
1388 | } | 1388 | } |
1389 | else if ( msg == "Update(int)" ) | 1389 | else if ( msg == "Update(int)" ) |
1390 | { | 1390 | { |
1391 | int info; | 1391 | int info; |
1392 | stream >> info; | 1392 | stream >> info; |
1393 | if (info) | 1393 | if (info) |
1394 | { | 1394 | { |
1395 | reader->bDoUpdates = true; | 1395 | reader->bDoUpdates = true; |
1396 | reader->refresh(); | 1396 | reader->refresh(); |
1397 | } | 1397 | } |
1398 | else | 1398 | else |
1399 | { | 1399 | { |
1400 | reader->bDoUpdates = false; | 1400 | reader->bDoUpdates = false; |
1401 | } | 1401 | } |
1402 | } | 1402 | } |
1403 | else if ( msg == "warn(QString)" ) | 1403 | else if ( msg == "warn(QString)" ) |
1404 | { | 1404 | { |
1405 | QString info; | 1405 | QString info; |
1406 | stream >> info; | 1406 | stream >> info; |
1407 | QMessageBox::warning(this, PROGNAME, info); | 1407 | QMessageBox::warning(this, PROGNAME, info); |
1408 | } | 1408 | } |
1409 | else if ( msg == "exit()" ) | 1409 | else if ( msg == "exit()" ) |
1410 | { | 1410 | { |
1411 | m_dontSave = true; | 1411 | m_dontSave = true; |
1412 | close(); | 1412 | close(); |
1413 | } | 1413 | } |
1414 | else if ( msg == "pageDown()" ) | 1414 | else if ( msg == "pageDown()" ) |
1415 | { | 1415 | { |
1416 | reader->dopagedn(); | 1416 | reader->dopagedn(); |
1417 | } | 1417 | } |
1418 | else if ( msg == "pageUp()" ) | 1418 | else if ( msg == "pageUp()" ) |
1419 | { | 1419 | { |
1420 | reader->dopageup(); | 1420 | reader->dopageup(); |
1421 | } | 1421 | } |
1422 | else if ( msg == "lineDown()" ) | 1422 | else if ( msg == "lineDown()" ) |
1423 | { | 1423 | { |
1424 | reader->lineDown(); | 1424 | reader->lineDown(); |
1425 | } | 1425 | } |
1426 | else if ( msg == "lineUp()" ) | 1426 | else if ( msg == "lineUp()" ) |
1427 | { | 1427 | { |
1428 | reader->lineUp(); | 1428 | reader->lineUp(); |
1429 | } | 1429 | } |
1430 | else if ( msg == "showText()" ) | 1430 | else if ( msg == "showText()" ) |
1431 | { | 1431 | { |
1432 | showEditTools(); | 1432 | showEditTools(); |
1433 | } | 1433 | } |
1434 | else if ( msg == "home()" ) | 1434 | else if ( msg == "home()" ) |
1435 | { | 1435 | { |
1436 | reader->goHome(); | 1436 | reader->goHome(); |
1437 | } | 1437 | } |
1438 | else if ( msg == "back()" ) | 1438 | else if ( msg == "back()" ) |
1439 | { | 1439 | { |
1440 | reader->goBack(); | 1440 | reader->goBack(); |
1441 | } | 1441 | } |
1442 | else if ( msg == "forward()" ) | 1442 | else if ( msg == "forward()" ) |
1443 | { | 1443 | { |
1444 | reader->goForward(); | 1444 | reader->goForward(); |
1445 | } | 1445 | } |
1446 | else if ( msg == "File/Open(QString)" ) | 1446 | else if ( msg == "File/Open(QString)" ) |
1447 | { | 1447 | { |
1448 | QString info; | 1448 | QString info; |
1449 | stream >> info; | 1449 | stream >> info; |
1450 | openFile( info ); | 1450 | openFile( info ); |
1451 | } | 1451 | } |
1452 | else if ( msg == "File/Info()" ) | 1452 | else if ( msg == "File/Info()" ) |
1453 | { | 1453 | { |
1454 | showinfo(); | 1454 | showinfo(); |
1455 | } | 1455 | } |
1456 | else if ( msg == "File/Action(QString)" ) | 1456 | else if ( msg == "File/Action(QString)" ) |
1457 | { | 1457 | { |
1458 | QString info; | 1458 | QString info; |
1459 | stream >> info; | 1459 | stream >> info; |
1460 | m_spaceTarget = ActNameToInt(info); | 1460 | m_spaceTarget = ActNameToInt(info); |
1461 | } | 1461 | } |
1462 | else if ( msg == "Navigation/Scroll(int)" ) | 1462 | else if ( msg == "Navigation/Scroll(int)" ) |
1463 | { | 1463 | { |
1464 | int info; | 1464 | int info; |
1465 | stream >> info; | 1465 | stream >> info; |
1466 | autoScroll(info); | 1466 | autoScroll(info); |
1467 | } | 1467 | } |
1468 | 1468 | ||
1469 | else if ( msg == "Navigation/GotoStart()" ) | 1469 | else if ( msg == "Navigation/GotoStart()" ) |
1470 | { | 1470 | { |
1471 | gotoStart(); | 1471 | gotoStart(); |
1472 | } | 1472 | } |
1473 | else if ( msg == "Navigation/GotoEnd()" ) | 1473 | else if ( msg == "Navigation/GotoEnd()" ) |
1474 | { | 1474 | { |
1475 | gotoEnd(); | 1475 | gotoEnd(); |
1476 | } | 1476 | } |
1477 | else if ( msg == "Navigation/Jump(int)" ) | 1477 | else if ( msg == "Navigation/Jump(int)" ) |
1478 | { | 1478 | { |
1479 | int info; | 1479 | int info; |
1480 | stream >> info; | 1480 | stream >> info; |
1481 | reader->locate(info); | 1481 | reader->locate(info); |
1482 | } | 1482 | } |
1483 | else if ( msg == "Navigation/Page/LineScroll(int)" ) | 1483 | else if ( msg == "Navigation/Page/LineScroll(int)" ) |
1484 | { | 1484 | { |
1485 | int info; | 1485 | int info; |
1486 | stream >> info; | 1486 | stream >> info; |
1487 | pagemode(info); | 1487 | pagemode(info); |
1488 | } | 1488 | } |
1489 | else if ( msg == "Navigation/SetOverlap(int)" ) | 1489 | else if ( msg == "Navigation/SetOverlap(int)" ) |
1490 | { | 1490 | { |
1491 | int info; | 1491 | int info; |
1492 | stream >> info; | 1492 | stream >> info; |
1493 | reader->m_overlap = info; | 1493 | reader->m_overlap = info; |
1494 | } | 1494 | } |
1495 | else if ( msg == "Navigation/SetMargin(int)" ) | 1495 | else if ( msg == "Navigation/SetMargin(int)" ) |
1496 | { | 1496 | { |
1497 | int info; | 1497 | int info; |
1498 | stream >> info; | 1498 | stream >> info; |
1499 | do_margin(info); | 1499 | do_margin(info); |
1500 | } | 1500 | } |
1501 | else if ( msg == "File/SetDictionary(QString)" ) | 1501 | else if ( msg == "File/SetDictionary(QString)" ) |
1502 | { | 1502 | { |
1503 | QString info; | 1503 | QString info; |
1504 | stream >> info; | 1504 | stream >> info; |
1505 | do_settarget(info); | 1505 | do_settarget(info); |
1506 | } | 1506 | } |
1507 | #ifdef _SCROLLPIPE | 1507 | #ifdef _SCROLLPIPE |
1508 | else if ( msg == "File/SetScrollTarget(QString)" ) | 1508 | else if ( msg == "File/SetScrollTarget(QString)" ) |
1509 | { | 1509 | { |
1510 | QString info; | 1510 | QString info; |
1511 | stream >> info; | 1511 | stream >> info; |
1512 | reader->m_pipetarget = info; | 1512 | reader->m_pipetarget = info; |
1513 | } | 1513 | } |
1514 | #endif | 1514 | #endif |
1515 | else if ( msg == "File/Two/OneTouch(int)" ) | 1515 | else if ( msg == "File/Two/OneTouch(int)" ) |
1516 | { | 1516 | { |
1517 | int info; | 1517 | int info; |
1518 | stream >> info; | 1518 | stream >> info; |
1519 | setTwoTouch(info); | 1519 | setTwoTouch(info); |
1520 | } | 1520 | } |
1521 | else if ( msg == "Target/Annotation(int)" ) | 1521 | else if ( msg == "Target/Annotation(int)" ) |
1522 | { | 1522 | { |
1523 | int info; | 1523 | int info; |
1524 | stream >> info; | 1524 | stream >> info; |
1525 | OnAnnotation(info); | 1525 | OnAnnotation(info); |
1526 | } | 1526 | } |
1527 | else if ( msg == "Target/Dictionary(int)" ) | 1527 | else if ( msg == "Target/Dictionary(int)" ) |
1528 | { | 1528 | { |
1529 | int info; | 1529 | int info; |
1530 | stream >> info; | 1530 | stream >> info; |
1531 | OnDictionary(info); | 1531 | OnDictionary(info); |
1532 | } | 1532 | } |
1533 | else if ( msg == "Target/Clipboard(int)" ) | 1533 | else if ( msg == "Target/Clipboard(int)" ) |
1534 | { | 1534 | { |
1535 | int info; | 1535 | int info; |
1536 | stream >> info; | 1536 | stream >> info; |
1537 | OnClipboard(info); | 1537 | OnClipboard(info); |
1538 | } | 1538 | } |
1539 | else if ( msg == "File/Find(QString)" ) | 1539 | else if ( msg == "File/Find(QString)" ) |
1540 | { | 1540 | { |
1541 | QString info; | 1541 | QString info; |
1542 | stream >> info; | 1542 | stream >> info; |
1543 | QRegExp arg(info); | 1543 | QRegExp arg(info); |
1544 | size_t pos = reader->pagelocate(); | 1544 | size_t pos = reader->pagelocate(); |
1545 | size_t start = pos; | 1545 | size_t start = pos; |
1546 | CDrawBuffer test(&(reader->m_fontControl)); | 1546 | CDrawBuffer test(&(reader->m_fontControl)); |
1547 | reader->getline(&test); | 1547 | reader->getline(&test); |
1548 | while (arg.match(toQString(test.data())) == -1) | 1548 | while (arg.match(toQString(test.data())) == -1) |
1549 | { | 1549 | { |
1550 | pos = reader->locate(); | 1550 | pos = reader->locate(); |
1551 | if (!reader->getline(&test)) | 1551 | if (!reader->getline(&test)) |
1552 | { | 1552 | { |
1553 | QMessageBox::information(this, PROGNAME, QString("Can't find\n")+info); | 1553 | QMessageBox::information(this, PROGNAME, QString("Can't find\n")+info); |
1554 | pos = start; | 1554 | pos = start; |
1555 | break; | 1555 | break; |
1556 | } | 1556 | } |
1557 | } | 1557 | } |
1558 | reader->locate(pos); | 1558 | reader->locate(pos); |
1559 | } | 1559 | } |
1560 | else if ( msg == "File/Fullscreen(int)" ) | 1560 | else if ( msg == "File/Fullscreen(int)" ) |
1561 | { | 1561 | { |
1562 | int info; | 1562 | int info; |
1563 | stream >> info; | 1563 | stream >> info; |
1564 | setfullscreen(info); | 1564 | setfullscreen(info); |
1565 | } | 1565 | } |
1566 | else if ( msg == "File/Continuous(int)" ) | 1566 | else if ( msg == "File/Continuous(int)" ) |
1567 | { | 1567 | { |
1568 | int info; | 1568 | int info; |
1569 | stream >> info; | 1569 | stream >> info; |
1570 | setcontinuous(info); | 1570 | setcontinuous(info); |
1571 | } | 1571 | } |
1572 | else if ( msg == "Markup(QString)" ) | 1572 | else if ( msg == "Markup(QString)" ) |
1573 | { | 1573 | { |
1574 | QString info; | 1574 | QString info; |
1575 | stream >> info; | 1575 | stream >> info; |
1576 | if (info == "Auto") | 1576 | if (info == "Auto") |
1577 | { | 1577 | { |
1578 | autofmt(true); | 1578 | autofmt(true); |
1579 | } | 1579 | } |
1580 | if (info == "None") | 1580 | if (info == "None") |
1581 | { | 1581 | { |
1582 | autofmt(false); | 1582 | autofmt(false); |
1583 | textfmt(false); | 1583 | textfmt(false); |
1584 | striphtml(false); | 1584 | striphtml(false); |
1585 | peanut(false); | 1585 | peanut(false); |
1586 | } | 1586 | } |
1587 | if (info == "Text") | 1587 | if (info == "Text") |
1588 | { | 1588 | { |
1589 | textfmt(true); | 1589 | textfmt(true); |
1590 | } | 1590 | } |
1591 | if (info == "HTML") | 1591 | if (info == "HTML") |
1592 | { | 1592 | { |
1593 | striphtml(true); | 1593 | striphtml(true); |
1594 | } | 1594 | } |
1595 | if (info == "Peanut/PML") | 1595 | if (info == "Peanut/PML") |
1596 | { | 1596 | { |
1597 | peanut(true); | 1597 | peanut(true); |
1598 | } | 1598 | } |
1599 | } | 1599 | } |
1600 | else if ( msg == "Layout/StripCR(int)" ) | 1600 | else if ( msg == "Layout/StripCR(int)" ) |
1601 | { | 1601 | { |
1602 | int info; | 1602 | int info; |
1603 | stream >> info; | 1603 | stream >> info; |
1604 | stripcr(info); | 1604 | stripcr(info); |
1605 | } | 1605 | } |
1606 | else if ( msg == "Layout/Dehyphen(int)" ) | 1606 | else if ( msg == "Layout/Dehyphen(int)" ) |
1607 | { | 1607 | { |
1608 | int info; | 1608 | int info; |
1609 | stream >> info; | 1609 | stream >> info; |
1610 | dehyphen(info); | 1610 | dehyphen(info); |
1611 | } | 1611 | } |
1612 | else if ( msg == "Layout/Depluck(int)" ) | 1612 | else if ( msg == "Layout/Depluck(int)" ) |
1613 | { | 1613 | { |
1614 | int info; | 1614 | int info; |
1615 | stream >> info; | 1615 | stream >> info; |
1616 | depluck(info); | 1616 | depluck(info); |
1617 | } | 1617 | } |
1618 | else if ( msg == "Layout/Dejpluck(int)" ) | 1618 | else if ( msg == "Layout/Dejpluck(int)" ) |
1619 | { | 1619 | { |
1620 | int info; | 1620 | int info; |
1621 | stream >> info; | 1621 | stream >> info; |
1622 | dejpluck(info); | 1622 | dejpluck(info); |
1623 | } | 1623 | } |
1624 | else if ( msg == "Layout/SingleSpace(int)" ) | 1624 | else if ( msg == "Layout/SingleSpace(int)" ) |
1625 | { | 1625 | { |
1626 | int info; | 1626 | int info; |
1627 | stream >> info; | 1627 | stream >> info; |
1628 | onespace(info); | 1628 | onespace(info); |
1629 | } | 1629 | } |
1630 | else if ( msg == "Layout/Repalm(int)" ) | 1630 | else if ( msg == "Layout/Repalm(int)" ) |
1631 | { | 1631 | { |
1632 | int info; | 1632 | int info; |
1633 | stream >> info; | 1633 | stream >> info; |
1634 | repalm(info); | 1634 | repalm(info); |
1635 | } | 1635 | } |
1636 | else if ( msg == "Layout/Unindent(int)" ) | 1636 | else if ( msg == "Layout/Unindent(int)" ) |
1637 | { | 1637 | { |
1638 | int info; | 1638 | int info; |
1639 | stream >> info; | 1639 | stream >> info; |
1640 | unindent(info); | 1640 | unindent(info); |
1641 | } | 1641 | } |
1642 | else if ( msg == "Layout/Re-paragraph(int)" ) | 1642 | else if ( msg == "Layout/Re-paragraph(int)" ) |
1643 | { | 1643 | { |
1644 | int info; | 1644 | int info; |
1645 | stream >> info; | 1645 | stream >> info; |
1646 | repara(info); | 1646 | repara(info); |
1647 | } | 1647 | } |
1648 | else if ( msg == "Layout/DoubleSpace(int)" ) | 1648 | else if ( msg == "Layout/DoubleSpace(int)" ) |
1649 | { | 1649 | { |
1650 | int info; | 1650 | int info; |
1651 | stream >> info; | 1651 | stream >> info; |
1652 | dblspce(info); | 1652 | dblspce(info); |
1653 | } | 1653 | } |
1654 | else if ( msg == "Layout/Indent(int)" ) | 1654 | else if ( msg == "Layout/Indent(int)" ) |
1655 | { | 1655 | { |
1656 | int info; | 1656 | int info; |
1657 | stream >> info; | 1657 | stream >> info; |
1658 | reader->bindenter = info; | 1658 | reader->bindenter = info; |
1659 | reader->setfilter(reader->getfilter()); | 1659 | reader->setfilter(reader->getfilter()); |
1660 | } | 1660 | } |
1661 | else if ( msg == "Layout/Remap(int)" ) | 1661 | else if ( msg == "Layout/Remap(int)" ) |
1662 | { | 1662 | { |
1663 | int info; | 1663 | int info; |
1664 | stream >> info; | 1664 | stream >> info; |
1665 | remap(info); | 1665 | remap(info); |
1666 | } | 1666 | } |
1667 | else if ( msg == "Layout/Embolden(int)" ) | 1667 | else if ( msg == "Layout/Embolden(int)" ) |
1668 | { | 1668 | { |
1669 | int info; | 1669 | int info; |
1670 | stream >> info; | 1670 | stream >> info; |
1671 | embolden(info); | 1671 | embolden(info); |
1672 | } | 1672 | } |
1673 | else if ( msg == "Format/Ideogram/Word(int)" ) | 1673 | else if ( msg == "Format/Ideogram/Word(int)" ) |
1674 | { | 1674 | { |
1675 | int info; | 1675 | int info; |
1676 | stream >> info; | 1676 | stream >> info; |
1677 | monospace(info); | 1677 | monospace(info); |
1678 | } | 1678 | } |
1679 | else if ( msg == "Format/SetWidth(int)" ) | 1679 | else if ( msg == "Format/SetWidth(int)" ) |
1680 | { | 1680 | { |
1681 | int info; | 1681 | int info; |
1682 | stream >> info; | 1682 | stream >> info; |
1683 | reader->m_charpc = info; | 1683 | reader->m_charpc = info; |
1684 | reader->setfont(); | 1684 | reader->setfont(); |
1685 | reader->refresh(); | 1685 | reader->refresh(); |
1686 | } | 1686 | } |
1687 | else if ( msg == "Format/SetFont(QString,int)" ) | 1687 | else if ( msg == "Format/SetFont(QString,int)" ) |
1688 | { | 1688 | { |
1689 | QString fontname; | 1689 | QString fontname; |
1690 | int size; | 1690 | int size; |
1691 | stream >> fontname; | 1691 | stream >> fontname; |
1692 | stream >> size; | 1692 | stream >> size; |
1693 | setfontHelper(fontname, size); | 1693 | setfontHelper(fontname, size); |
1694 | } | 1694 | } |
1695 | else if ( msg == "Marks/Autogen(QString)" ) | 1695 | else if ( msg == "Marks/Autogen(QString)" ) |
1696 | { | 1696 | { |
1697 | QString info; | 1697 | QString info; |
1698 | stream >> info; | 1698 | stream >> info; |
1699 | do_autogen(info); | 1699 | do_autogen(info); |
1700 | } | 1700 | } |
1701 | else if ( msg == "File/StartBlock()" ) | 1701 | else if ( msg == "File/StartBlock()" ) |
1702 | { | 1702 | { |
1703 | editMark(); | 1703 | editMark(); |
1704 | } | 1704 | } |
1705 | else if ( msg == "File/CopyBlock()" ) | 1705 | else if ( msg == "File/CopyBlock()" ) |
1706 | { | 1706 | { |
1707 | editCopy(); | 1707 | editCopy(); |
1708 | } | 1708 | } |
1709 | */ | 1709 | */ |
1710 | #endif | 1710 | #endif |
1711 | } | 1711 | } |
1712 | 1712 | ||
1713 | ActionTypes QTReaderApp::ActNameToInt(const QString& _enc) | 1713 | ActionTypes QTReaderApp::ActNameToInt(const QString& _enc) |
1714 | { | 1714 | { |
1715 | for (int i = 0; i < MAX_ACTIONS; i++) | 1715 | for (int i = 0; i < MAX_ACTIONS; i++) |
1716 | { | 1716 | { |
1717 | if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i; | 1717 | if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i; |
1718 | } | 1718 | } |
1719 | return cesAutoScroll; | 1719 | return cesAutoScroll; |
1720 | } | 1720 | } |
1721 | 1721 | ||
1722 | void QTReaderApp::setinverted(bool sfs) | 1722 | void QTReaderApp::setinverted(bool sfs) |
1723 | { | 1723 | { |
1724 | reader->setInverse(sfs); | 1724 | reader->setInverse(sfs); |
1725 | reader->setfilter(reader->getfilter()); | 1725 | reader->setfilter(reader->getfilter()); |
1726 | reader->refresh(); | 1726 | reader->refresh(); |
1727 | } | 1727 | } |
1728 | 1728 | ||
1729 | void QTReaderApp::setrotated(bool sfs) | 1729 | void QTReaderApp::setrotated(bool sfs) |
1730 | { | 1730 | { |
1731 | reader->setrotated(sfs); | 1731 | reader->setrotated(sfs); |
1732 | if (sfs) | 1732 | if (sfs) |
1733 | { | 1733 | { |
1734 | m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::BottomToTop : QBoxLayout::TopToBottom ); | 1734 | m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::BottomToTop : QBoxLayout::TopToBottom ); |
1735 | if (m_scrollbar != NULL) | 1735 | if (m_scrollbar != NULL) |
1736 | { | 1736 | { |
1737 | scrollbar->disconnect(); | 1737 | scrollbar->disconnect(); |
1738 | m_scrollbar->setOrientation(Qt::Horizontal); | 1738 | m_scrollbar->setOrientation(Qt::Horizontal); |
1739 | connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineUp()) ); | 1739 | connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineUp()) ); |
1740 | connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineDown()) ); | 1740 | connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineDown()) ); |
1741 | connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopageup()) ); | 1741 | connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopageup()) ); |
1742 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopagedn()) ); | 1742 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopagedn()) ); |
1743 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); | 1743 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); |
1744 | } | 1744 | } |
1745 | //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); |
1746 | } | 1746 | } |
1747 | else | 1747 | else |
1748 | { | 1748 | { |
1749 | m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::RightToLeft : QBoxLayout::LeftToRight ); | 1749 | m_layout->setDirection( (m_qtscroll == 2) ? QBoxLayout::RightToLeft : QBoxLayout::LeftToRight ); |
1750 | if (m_scrollbar != NULL) | 1750 | if (m_scrollbar != NULL) |
1751 | { | 1751 | { |
1752 | scrollbar->disconnect(); | 1752 | scrollbar->disconnect(); |
1753 | m_scrollbar->setOrientation(Qt::Vertical); | 1753 | m_scrollbar->setOrientation(Qt::Vertical); |
1754 | connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineDown()) ); | 1754 | connect(scrollbar, SIGNAL(nextLine()), reader, SLOT(lineDown()) ); |
1755 | connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineUp()) ); | 1755 | connect(scrollbar, SIGNAL(prevLine()), reader, SLOT(lineUp()) ); |
1756 | connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopagedn()) ); | 1756 | connect(scrollbar, SIGNAL(nextPage()), reader, SLOT(dopagedn()) ); |
1757 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopageup()) ); | 1757 | connect(scrollbar, SIGNAL(prevPage()), reader, SLOT(dopageup()) ); |
1758 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); | 1758 | connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(actionscroll(int)) ); |
1759 | } | 1759 | } |
1760 | //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()); |
1761 | } | 1761 | } |
1762 | reader->refresh(); | 1762 | reader->refresh(); |
1763 | } | 1763 | } |
1764 | 1764 | ||
1765 | void QTReaderApp::setgrab(bool sfs) | 1765 | void QTReaderApp::setgrab(bool sfs) |
1766 | { | 1766 | { |
1767 | #ifdef USEQPE | 1767 | #ifdef USEQPE |
1768 | m_grabkeyboard = sfs; | 1768 | m_grabkeyboard = sfs; |
1769 | if (m_grabkeyboard) | 1769 | if (m_grabkeyboard) |
1770 | { | 1770 | { |
1771 | ((QPEApplication*)qApp)->grabKeyboard(); | 1771 | ((QPEApplication*)qApp)->grabKeyboard(); |
1772 | } | 1772 | } |
1773 | else | 1773 | else |
1774 | { | 1774 | { |
1775 | ((QPEApplication*)qApp)->ungrabKeyboard(); | 1775 | ((QPEApplication*)qApp)->ungrabKeyboard(); |
1776 | } | 1776 | } |
1777 | #endif | 1777 | #endif |
1778 | } | 1778 | } |
1779 | 1779 | ||
1780 | void QTReaderApp::setfullscreen(bool sfs) | 1780 | void QTReaderApp::setfullscreen(bool sfs) |
1781 | { | 1781 | { |
1782 | reader->bDoUpdates = false; | 1782 | reader->bDoUpdates = false; |
1783 | m_fullscreen = sfs; | 1783 | m_fullscreen = sfs; |
1784 | showEditTools(); | 1784 | showEditTools(); |
1785 | // qApp->processEvents(); | 1785 | // qApp->processEvents(); |
1786 | reader->bDoUpdates = true; | 1786 | reader->bDoUpdates = true; |
1787 | reader->update(); | 1787 | reader->update(); |
1788 | } | 1788 | } |
1789 | /* | 1789 | /* |
1790 | void QTReaderApp::buttonActionSelected(QAction* _a) | 1790 | void QTReaderApp::buttonActionSelected(QAction* _a) |
1791 | { | 1791 | { |
1792 | //// 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())); |
1793 | m_spaceTarget = ActNameToInt(_a->text()); | 1793 | m_spaceTarget = ActNameToInt(_a->text()); |
1794 | } | 1794 | } |
1795 | */ | 1795 | */ |
1796 | QTReaderApp::~QTReaderApp() | 1796 | QTReaderApp::~QTReaderApp() |
1797 | { | 1797 | { |
1798 | } | 1798 | } |
1799 | 1799 | ||
1800 | void QTReaderApp::autoScroll(bool _b) | 1800 | void QTReaderApp::autoScroll(bool _b) |
1801 | { | 1801 | { |
1802 | reader->setautoscroll(_b); | 1802 | reader->setautoscroll(_b); |
1803 | setScrollState(reader->m_autoScroll); | 1803 | setScrollState(reader->m_autoScroll); |
1804 | } | 1804 | } |
1805 | 1805 | ||
1806 | void QTReaderApp::zoomin() | 1806 | void QTReaderApp::zoomin() |
1807 | { | 1807 | { |
1808 | reader->zoomin(); | 1808 | reader->zoomin(); |
1809 | QFont f(reader->m_fontname, reader->m_fontControl.getsize(0)); | 1809 | QFont f(reader->m_fontname, reader->m_fontControl.getsize(0)); |
1810 | m_prog->setFont( f ); | 1810 | m_prog->setFont( f ); |
1811 | } | 1811 | } |
1812 | 1812 | ||
1813 | void QTReaderApp::zoomout() | 1813 | void QTReaderApp::zoomout() |
1814 | { | 1814 | { |
1815 | reader->zoomout(); | 1815 | reader->zoomout(); |
1816 | QFont f(reader->m_fontname, reader->m_fontControl.getsize(0)); | 1816 | QFont f(reader->m_fontname, reader->m_fontControl.getsize(0)); |
1817 | m_prog->setFont( f ); | 1817 | m_prog->setFont( f ); |
1818 | } | 1818 | } |
1819 | 1819 | ||
1820 | void QTReaderApp::clearBkmkList() | 1820 | void QTReaderApp::clearBkmkList() |
1821 | { | 1821 | { |
1822 | delete pBkmklist; | 1822 | delete pBkmklist; |
1823 | reader->pBkmklist = pBkmklist = NULL; | 1823 | reader->pBkmklist = pBkmklist = NULL; |
1824 | m_fBkmksChanged = false; | 1824 | m_fBkmksChanged = false; |
1825 | reader->refresh(true); | 1825 | reader->refresh(true); |
1826 | } | 1826 | } |
1827 | 1827 | ||
1828 | void QTReaderApp::fileClose() | 1828 | void QTReaderApp::fileClose() |
1829 | { | 1829 | { |
1830 | CCloseDialog* cd = new CCloseDialog(reader->m_string, false, this); | 1830 | CCloseDialog* cd = new CCloseDialog(reader->m_string, false, this); |
1831 | if (cd->exec()) | 1831 | if (cd->exec()) |
1832 | { | 1832 | { |
1833 | if (pOpenlist != NULL) | 1833 | if (pOpenlist != NULL) |
1834 | { | 1834 | { |
1835 | int ind = 0; | 1835 | int ind = 0; |
1836 | Bkmk* p = (*pOpenlist)[ind]; | 1836 | Bkmk* p = (*pOpenlist)[ind]; |
1837 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) | 1837 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) |
1838 | { | 1838 | { |
1839 | p = (*pOpenlist)[++ind]; | 1839 | p = (*pOpenlist)[++ind]; |
1840 | } | 1840 | } |
1841 | if (p != NULL) pOpenlist->erase(ind); | 1841 | if (p != NULL) pOpenlist->erase(ind); |
1842 | if (cd->delFile()) | 1842 | if (cd->delFile()) |
1843 | { | 1843 | { |
1844 | unlink((const char*)reader->m_lastfile); | 1844 | unlink((const char*)reader->m_lastfile); |
1845 | } | 1845 | } |
1846 | if (cd->delMarks()) | 1846 | if (cd->delMarks()) |
1847 | { | 1847 | { |
1848 | #ifndef USEQPE | 1848 | #ifndef USEQPE |
1849 | QDir d = QDir::home(); // "/" | 1849 | QDir d = QDir::home(); // "/" |
1850 | d.cd(APPDIR); | 1850 | d.cd(APPDIR); |
1851 | d.remove(reader->m_string); | 1851 | d.remove(reader->m_string); |
1852 | #else /* USEQPE */ | 1852 | #else /* USEQPE */ |
1853 | unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); | 1853 | unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); |
1854 | #endif /* USEQPE */ | 1854 | #endif /* USEQPE */ |
1855 | } | 1855 | } |
1856 | if (cd->delConfig()) | 1856 | if (cd->delConfig()) |
1857 | { | 1857 | { |
1858 | #ifndef USEQPE | 1858 | #ifndef USEQPE |
1859 | QDir d = QDir::home(); // "/" | 1859 | QDir d = QDir::home(); // "/" |
1860 | d.cd(APPDIR "/configs"); | 1860 | d.cd(APPDIR "/configs"); |
1861 | d.remove(reader->m_string); | 1861 | d.remove(reader->m_string); |
1862 | #else /* USEQPE */ | 1862 | #else /* USEQPE */ |
1863 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",reader->m_string)); | 1863 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",reader->m_string)); |
1864 | #endif /* USEQPE */ | 1864 | #endif /* USEQPE */ |
1865 | } | 1865 | } |
1866 | } | 1866 | } |
1867 | 1867 | ||
1868 | fileOpen2(); | 1868 | fileOpen2(); |
1869 | } | 1869 | } |
1870 | delete cd; | 1870 | delete cd; |
1871 | } | 1871 | } |
1872 | 1872 | ||
1873 | void QTReaderApp::updatefileinfo() | 1873 | void QTReaderApp::updatefileinfo() |
1874 | { | 1874 | { |
1875 | if (reader->m_string.isEmpty()) return; | 1875 | if (reader->m_string.isEmpty()) return; |
1876 | if (reader->m_lastfile.isEmpty()) return; | 1876 | if (reader->m_lastfile.isEmpty()) return; |
1877 | tchar* nm = fromQString(reader->m_string); | 1877 | tchar* nm = fromQString(reader->m_string); |
1878 | tchar* fl = fromQString(reader->m_lastfile); | 1878 | tchar* fl = fromQString(reader->m_lastfile); |
1879 | // qDebug("Lastfile:%x", fl); | 1879 | // qDebug("Lastfile:%x", fl); |
1880 | bool notadded = true; | 1880 | bool notadded = true; |
1881 | if (pOpenlist == NULL) pOpenlist = new CList<Bkmk>; | 1881 | if (pOpenlist == NULL) pOpenlist = new CList<Bkmk>; |
1882 | else | 1882 | else |
1883 | { | 1883 | { |
1884 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) | 1884 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) |
1885 | { | 1885 | { |
1886 | if (ustrcmp(CFiledata(iter->anno()).name(), fl) == 0) | 1886 | if (ustrcmp(CFiledata(iter->anno()).name(), fl) == 0) |
1887 | { | 1887 | { |
1888 | iter->value(reader->pagelocate()); | 1888 | iter->value(reader->pagelocate()); |
1889 | unsigned short dlen; | 1889 | unsigned short dlen; |
1890 | unsigned char* data; | 1890 | unsigned char* data; |
1891 | CFiledata fd(iter->anno()); | 1891 | CFiledata fd(iter->anno()); |
1892 | reader->setSaveData(data, dlen, fd.content(), fd.length()); | 1892 | reader->setSaveData(data, dlen, fd.content(), fd.length()); |
1893 | // qDebug("Filedata(1):%u, %u", fd.length(), dlen); | 1893 | // qDebug("Filedata(1):%u, %u", fd.length(), dlen); |
1894 | // getstate(data, dlen); | 1894 | // getstate(data, dlen); |
1895 | iter->setAnno(data, dlen); | 1895 | iter->setAnno(data, dlen); |
1896 | notadded = false; | 1896 | notadded = false; |
1897 | delete [] data; | 1897 | delete [] data; |
1898 | break; | 1898 | break; |
1899 | } | 1899 | } |
1900 | } | 1900 | } |
1901 | } | 1901 | } |
1902 | // qDebug("Added?:%x", notadded); | 1902 | // qDebug("Added?:%x", notadded); |
1903 | if (notadded) | 1903 | if (notadded) |
1904 | { | 1904 | { |
1905 | struct stat fnstat; | 1905 | struct stat fnstat; |
1906 | stat((const char *)reader->m_lastfile, &fnstat); | 1906 | stat((const char *)reader->m_lastfile, &fnstat); |
1907 | CFiledata fd(fnstat.st_mtime, fl); | 1907 | CFiledata fd(fnstat.st_mtime, fl); |
1908 | unsigned short dlen; | 1908 | unsigned short dlen; |
1909 | unsigned char* data; | 1909 | unsigned char* data; |
1910 | reader->setSaveData(data, dlen, fd.content(), fd.length()); | 1910 | reader->setSaveData(data, dlen, fd.content(), fd.length()); |
1911 | pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate())); | 1911 | pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate())); |
1912 | //qDebug("Filedata(2):%u, %u", fd.length(), dlen); | 1912 | //qDebug("Filedata(2):%u, %u", fd.length(), dlen); |
1913 | delete [] data; | 1913 | delete [] data; |
1914 | } | 1914 | } |
1915 | delete [] nm; | 1915 | delete [] nm; |
1916 | delete [] fl; | 1916 | delete [] fl; |
1917 | } | 1917 | } |
1918 | 1918 | ||
1919 | void QTReaderApp::fileOpen() | 1919 | void QTReaderApp::fileOpen() |
1920 | { | 1920 | { |
1921 | /* | 1921 | /* |
1922 | menu->hide(); | 1922 | menu->hide(); |
1923 | fileBar->hide(); | 1923 | fileBar->hide(); |
1924 | if (regVisible) regBar->hide(); | 1924 | if (regVisible) regBar->hide(); |
1925 | if (searchVisible) searchBar->hide(); | 1925 | if (searchVisible) searchBar->hide(); |
1926 | */ | 1926 | */ |
1927 | // qDebug("fileOpen"); | 1927 | // qDebug("fileOpen"); |
1928 | // if (!reader->m_lastfile.isEmpty()) | 1928 | // if (!reader->m_lastfile.isEmpty()) |
1929 | updatefileinfo(); | 1929 | updatefileinfo(); |
1930 | fileOpen2(); | 1930 | fileOpen2(); |
1931 | } | 1931 | } |
1932 | 1932 | ||
1933 | void QTReaderApp::fileOpen2() | 1933 | void QTReaderApp::fileOpen2() |
1934 | { | 1934 | { |
1935 | if (pBkmklist != NULL) | 1935 | if (pBkmklist != NULL) |
1936 | { | 1936 | { |
1937 | if (m_fBkmksChanged) | 1937 | if (m_fBkmksChanged) |
1938 | { | 1938 | { |
1939 | 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) |
1940 | savebkmks(); | 1940 | savebkmks(); |
1941 | } | 1941 | } |
1942 | delete pBkmklist; | 1942 | delete pBkmklist; |
1943 | reader->pBkmklist = pBkmklist = NULL; | 1943 | reader->pBkmklist = pBkmklist = NULL; |
1944 | m_fBkmksChanged = false; | 1944 | m_fBkmksChanged = false; |
1945 | } | 1945 | } |
1946 | reader->disableAutoscroll(); | 1946 | reader->disableAutoscroll(); |
1947 | /* | 1947 | /* |
1948 | editorStack->raiseWidget( fileSelector ); | 1948 | editorStack->raiseWidget( fileSelector ); |
1949 | fileSelector->reread(); | 1949 | fileSelector->reread(); |
1950 | */ | 1950 | */ |
1951 | bool usebrowser = true; | 1951 | bool usebrowser = true; |
1952 | if (pOpenlist != NULL) | 1952 | if (pOpenlist != NULL) |
1953 | { | 1953 | { |
1954 | m_nBkmkAction = cOpenFile; | 1954 | m_nBkmkAction = cOpenFile; |
1955 | if (listbkmk(pOpenlist, "Browse", true)) usebrowser = false; | 1955 | if (listbkmk(pOpenlist, "Browse", true)) usebrowser = false; |
1956 | } | 1956 | } |
1957 | if (usebrowser) | 1957 | if (usebrowser) |
1958 | { | 1958 | { |
1959 | QString fn = usefilebrowser(); | 1959 | QString fn = usefilebrowser(); |
1960 | //qApp->processEvents(); | 1960 | //qApp->processEvents(); |
1961 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) | 1961 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) |
1962 | { | 1962 | { |
1963 | openFile(fn); | 1963 | openFile(fn); |
1964 | } | 1964 | } |
1965 | reader->setFocus(); | 1965 | reader->setFocus(); |
1966 | } | 1966 | } |
1967 | // reader->refresh(); | 1967 | // reader->refresh(); |
1968 | // qDebug("HEIGHT:%d", reader->m_lastheight); | 1968 | // qDebug("HEIGHT:%d", reader->m_lastheight); |
1969 | } | 1969 | } |
1970 | 1970 | ||
1971 | QString QTReaderApp::usefilebrowser() | 1971 | QString QTReaderApp::usefilebrowser() |
1972 | { | 1972 | { |
1973 | #ifndef USEQPE | 1973 | #ifndef USEQPE |
1974 | QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) ); | 1974 | QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) ); |
1975 | return s; | 1975 | return s; |
1976 | #else | 1976 | #else |
1977 | QString fn; | 1977 | QString fn; |
1978 | #if defined(OPIE) && defined(OPIEFILEDIALOG) | 1978 | #if defined(OPIE) && defined(OPIEFILEDIALOG) |
1979 | QMap<QString, QStringList> mimeTypes; | 1979 | QMap<QString, QStringList> mimeTypes; |
1980 | QStringList etypes; | 1980 | QStringList etypes; |
1981 | etypes << "etext/*"; | 1981 | etypes << "etext/*"; |
1982 | mimeTypes.insert( tr("eText"), etypes ); | 1982 | mimeTypes.insert( tr("eText"), etypes ); |
1983 | QStringList types; | 1983 | QStringList types; |
1984 | types << "text/*"; | 1984 | types << "text/*"; |
1985 | mimeTypes.insert( tr("Text"), types ); | 1985 | mimeTypes.insert( tr("Text"), types ); |
1986 | mimeTypes.insert( tr("All"), "*/*" ); | 1986 | mimeTypes.insert( tr("All"), "*/*" ); |
1987 | 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"); |
1988 | #else | 1988 | #else |
1989 | fileBrowser* fb = new fileBrowser(false, this,"OpieReader",!m_bFloatingDialog, | 1989 | fileBrowser* fb = new fileBrowser(false, this,"OpieReader",!m_bFloatingDialog, |
1990 | 0, | 1990 | 0, |
1991 | // WStyle_Customize | WStyle_NoBorderEx, | 1991 | // WStyle_Customize | WStyle_NoBorderEx, |
1992 | "*", QFileInfo(reader->m_lastfile).dirPath(true)); | 1992 | "*", QFileInfo(reader->m_lastfile).dirPath(true)); |
1993 | 1993 | ||
1994 | 1994 | ||
1995 | if (fb->exec()) | 1995 | if (fb->exec()) |
1996 | { | 1996 | { |
1997 | fn = fb->getCurrentFile(); | 1997 | fn = fb->getCurrentFile(); |
1998 | } | 1998 | } |
1999 | // qDebug("Selected %s", (const char*)fn); | 1999 | // qDebug("Selected %s", (const char*)fn); |
2000 | delete fb; | 2000 | delete fb; |
2001 | #endif | 2001 | #endif |
2002 | showEditTools(); | 2002 | showEditTools(); |
2003 | return fn; | 2003 | return fn; |
2004 | #endif | 2004 | #endif |
2005 | } | 2005 | } |
2006 | 2006 | ||
2007 | void QTReaderApp::showgraphic(QImage& pm) | 2007 | void QTReaderApp::showgraphic(QImage& pm) |
2008 | { | 2008 | { |
2009 | m_graphicwin->setImage(pm); | 2009 | m_graphicwin->setImage(pm); |
2010 | editorStack->raiseWidget( m_graphicwin ); | 2010 | editorStack->raiseWidget( m_graphicwin ); |
2011 | hidetoolbars(); | 2011 | hidetoolbars(); |
2012 | m_graphicwin->setFocus(); | 2012 | m_graphicwin->setFocus(); |
2013 | } | 2013 | } |
2014 | 2014 | ||
2015 | void QTReaderApp::showbuttonprefs() | 2015 | void QTReaderApp::showbuttonprefs() |
2016 | { | 2016 | { |
2017 | editorStack->raiseWidget( m_buttonprefs ); | 2017 | editorStack->raiseWidget( m_buttonprefs ); |
2018 | hidetoolbars(); | 2018 | hidetoolbars(); |
2019 | m_buttonprefs->setFocus(); | 2019 | m_buttonprefs->setFocus(); |
2020 | m_kmapchanged = true; | 2020 | m_kmapchanged = true; |
2021 | } | 2021 | } |
2022 | 2022 | ||
2023 | void QTReaderApp::showprefs() | 2023 | void QTReaderApp::showprefs() |
2024 | { | 2024 | { |
2025 | CPrefs* prefwin = new CPrefs(reader->width(), !m_bFloatingDialog, this); | 2025 | CPrefs* prefwin = new CPrefs(reader->width(), !m_bFloatingDialog, this); |
2026 | 2026 | ||
2027 | // prefwin->Debounce(m_debounce); | 2027 | // prefwin->Debounce(m_debounce); |
2028 | prefwin->bgtype(m_bgtype); | 2028 | prefwin->bgtype(m_bgtype); |
2029 | prefwin->repalm(reader->brepalm); | 2029 | prefwin->repalm(reader->brepalm); |
2030 | prefwin->UnderlineLink(reader->bunderlineLink); | 2030 | prefwin->UnderlineLink(reader->bunderlineLink); |
2031 | prefwin->kern(reader->bkern); | 2031 | prefwin->kern(reader->bkern); |
2032 | prefwin->hyphenate(reader->hyphenate); | 2032 | prefwin->hyphenate(reader->hyphenate); |
2033 | // prefwin->customhyphen(reader->buffdoc.getCustomHyphen()); | 2033 | // prefwin->customhyphen(reader->buffdoc.getCustomHyphen()); |
2034 | prefwin->scrolltype(reader->m_scrolltype); | 2034 | prefwin->scrolltype(reader->m_scrolltype); |
2035 | prefwin->scrollstep(reader->m_scrollstep); | 2035 | prefwin->scrollstep(reader->m_scrollstep); |
2036 | prefwin->scrollcolor(m_scrollcolor); | 2036 | prefwin->scrollcolor(m_scrollcolor); |
2037 | prefwin->minibarcol(m_scrollbarcolor); | 2037 | prefwin->minibarcol(m_scrollbarcolor); |
2038 | prefwin->foreground(m_foreground); | 2038 | prefwin->foreground(m_foreground); |
2039 | prefwin->background(m_background); | 2039 | prefwin->background(m_background); |
2040 | prefwin->twotouch(m_twoTouch); | 2040 | prefwin->twotouch(m_twoTouch); |
2041 | prefwin->propfontchange(m_propogatefontchange); | 2041 | prefwin->propfontchange(m_propogatefontchange); |
2042 | prefwin->StripCR(reader->bstripcr); | 2042 | prefwin->StripCR(reader->bstripcr); |
2043 | prefwin->InlineTables(!reader->bNoInlineTables); | 2043 | prefwin->InlineTables(!reader->bNoInlineTables); |
2044 | prefwin->Dehyphen(reader->bdehyphen); | 2044 | prefwin->Dehyphen(reader->bdehyphen); |
2045 | prefwin->SingleSpace(reader->bonespace); | 2045 | prefwin->SingleSpace(reader->bonespace); |
2046 | prefwin->Unindent(reader->bunindent); | 2046 | prefwin->Unindent(reader->bunindent); |
2047 | prefwin->Reparagraph(reader->brepara); | 2047 | prefwin->Reparagraph(reader->brepara); |
2048 | prefwin->DoubleSpace(reader->bdblspce); | 2048 | prefwin->DoubleSpace(reader->bdblspce); |
2049 | prefwin->Remap(reader->bremap); | 2049 | prefwin->Remap(reader->bremap); |
2050 | prefwin->Embolden(reader->bmakebold); | 2050 | prefwin->Embolden(reader->bmakebold); |
2051 | prefwin->FullJustify(reader->bfulljust); | 2051 | prefwin->FullJustify(reader->bfulljust); |
2052 | // prefwin->Inverse(reader->bInverse); | 2052 | // prefwin->Inverse(reader->bInverse); |
2053 | // prefwin->Negative(reader->bNegative); | 2053 | // prefwin->Negative(reader->bNegative); |
2054 | prefwin->FixGraphics(reader->m_fontControl.FixGraphics()); | 2054 | prefwin->FixGraphics(reader->m_fontControl.FixGraphics()); |
2055 | prefwin->ParaLead(reader->getextraspace()); | 2055 | prefwin->ParaLead(reader->getextraspace()); |
2056 | prefwin->LineLead(reader->getlead()); | 2056 | prefwin->LineLead(reader->getlead()); |
2057 | prefwin->TopMargin(reader->m_abstopmargin); | 2057 | prefwin->TopMargin(reader->m_abstopmargin); |
2058 | prefwin->BottomMargin(reader->m_absbottommargin); | 2058 | prefwin->BottomMargin(reader->m_absbottommargin); |
2059 | prefwin->LeftMargin(reader->m_absleft_border); | 2059 | prefwin->LeftMargin(reader->m_absleft_border); |
2060 | prefwin->RightMargin(reader->m_absright_border); | 2060 | prefwin->RightMargin(reader->m_absright_border); |
2061 | prefwin->Indent(reader->bindenter); | 2061 | prefwin->Indent(reader->bindenter); |
2062 | if (reader->bautofmt) | 2062 | if (reader->bautofmt) |
2063 | { | 2063 | { |
2064 | prefwin->Markup(0); | 2064 | prefwin->Markup(0); |
2065 | } | 2065 | } |
2066 | else if (reader->btextfmt) | 2066 | else if (reader->btextfmt) |
2067 | { | 2067 | { |
2068 | prefwin->Markup(2); | 2068 | prefwin->Markup(2); |
2069 | } | 2069 | } |
2070 | else if (reader->bstriphtml) | 2070 | else if (reader->bstriphtml) |
2071 | { | 2071 | { |
2072 | prefwin->Markup(3); | 2072 | prefwin->Markup(3); |
2073 | } | 2073 | } |
2074 | else if (reader->bpeanut) | 2074 | else if (reader->bpeanut) |
2075 | { | 2075 | { |
2076 | prefwin->Markup(4); | 2076 | prefwin->Markup(4); |
2077 | } | 2077 | } |
2078 | else | 2078 | else |
2079 | { | 2079 | { |
2080 | prefwin->Markup(1); | 2080 | prefwin->Markup(1); |
2081 | } | 2081 | } |
2082 | prefwin->Depluck(reader->bdepluck); | 2082 | prefwin->Depluck(reader->bdepluck); |
2083 | prefwin->Dejpluck(reader->bdejpluck); | 2083 | prefwin->Dejpluck(reader->bdejpluck); |
2084 | prefwin->Continuous(reader->m_continuousDocument); | 2084 | prefwin->Continuous(reader->m_continuousDocument); |
2085 | prefwin->DoubleBuffer(reader->m_doubleBuffered); | 2085 | prefwin->DoubleBuffer(reader->m_doubleBuffered); |
2086 | 2086 | ||
2087 | prefwin->dictApplication(m_targetapp); | 2087 | prefwin->dictApplication(m_targetapp); |
2088 | prefwin->dictMessage(m_targetmsg); | 2088 | prefwin->dictMessage(m_targetmsg); |
2089 | 2089 | ||
2090 | /* | 2090 | /* |
2091 | prefwin->leftScroll(m_leftScroll); | 2091 | prefwin->leftScroll(m_leftScroll); |
2092 | prefwin->rightScroll(m_rightScroll); | 2092 | prefwin->rightScroll(m_rightScroll); |
2093 | prefwin->upScroll(m_upScroll); | 2093 | prefwin->upScroll(m_upScroll); |
2094 | prefwin->downScroll(m_downScroll); | 2094 | prefwin->downScroll(m_downScroll); |
2095 | */ | 2095 | */ |
2096 | 2096 | ||
2097 | prefwin->miscannotation(m_doAnnotation); | 2097 | prefwin->miscannotation(m_doAnnotation); |
2098 | prefwin->miscdictionary(m_doDictionary); | 2098 | prefwin->miscdictionary(m_doDictionary); |
2099 | prefwin->miscclipboard(m_doClipboard); | 2099 | prefwin->miscclipboard(m_doClipboard); |
2100 | prefwin->miscoutput(m_doOutput); | 2100 | prefwin->miscoutput(m_doOutput); |
2101 | 2101 | ||
2102 | prefwin->SwapMouse(reader->m_swapmouse); | 2102 | prefwin->SwapMouse(reader->m_swapmouse); |
2103 | 2103 | ||
2104 | prefwin->Font(reader->m_fontname); | 2104 | prefwin->Font(reader->m_fontname); |
2105 | 2105 | ||
2106 | prefwin->gfxsize(reader->getBaseSize()); | 2106 | prefwin->gfxsize(reader->getBaseSize()); |
2107 | 2107 | ||
2108 | prefwin->pageoverlap(reader->m_overlap); | 2108 | prefwin->pageoverlap(reader->m_overlap); |
2109 | 2109 | ||
2110 | prefwin->ideogram(reader->m_bMonoSpaced); | 2110 | prefwin->ideogram(reader->m_bMonoSpaced); |
2111 | 2111 | ||
2112 | prefwin->encoding(reader->m_encd); | 2112 | prefwin->encoding(reader->m_encd); |
2113 | 2113 | ||
2114 | prefwin->ideogramwidth(reader->m_charpc); | 2114 | prefwin->ideogramwidth(reader->m_charpc); |
2115 | 2115 | ||
2116 | prefwin->outcodec(reader->m_outputName); | 2116 | prefwin->outcodec(reader->m_outputName); |
2117 | 2117 | ||
2118 | if (prefwin->exec()) | 2118 | if (prefwin->exec()) |
2119 | { | 2119 | { |
2120 | // m_debounce = prefwin->Debounce(); | 2120 | // m_debounce = prefwin->Debounce(); |
2121 | reader->brepalm = prefwin->repalm(); | 2121 | reader->brepalm = prefwin->repalm(); |
2122 | reader->bunderlineLink = prefwin->UnderlineLink(); | 2122 | reader->bunderlineLink = prefwin->UnderlineLink(); |
2123 | 2123 | ||
2124 | reader->bkern = prefwin->kern(); | 2124 | reader->bkern = prefwin->kern(); |
2125 | reader->hyphenate = prefwin->hyphenate(); | 2125 | reader->hyphenate = prefwin->hyphenate(); |
2126 | // reader->buffdoc.setCustomHyphen(prefwin->customhyphen()); | 2126 | // reader->buffdoc.setCustomHyphen(prefwin->customhyphen()); |
2127 | reader->m_scrolltype = prefwin->scrolltype(); | 2127 | reader->m_scrolltype = prefwin->scrolltype(); |
2128 | reader->m_scrollstep = prefwin->scrollstep(); | 2128 | reader->m_scrollstep = prefwin->scrollstep(); |
2129 | m_scrollcolor = prefwin->scrollcolor(); | 2129 | m_scrollcolor = prefwin->scrollcolor(); |
2130 | setscrollcolour(); | 2130 | setscrollcolour(); |
2131 | m_scrollbarcolor = prefwin->minibarcol(); | 2131 | m_scrollbarcolor = prefwin->minibarcol(); |
2132 | setscrollbarcolour(); | 2132 | setscrollbarcolour(); |
2133 | m_foreground = prefwin->foreground(); | 2133 | m_foreground = prefwin->foreground(); |
2134 | reader->setForeground(getcolour(m_foreground)); | 2134 | reader->setForeground(getcolour(m_foreground)); |
2135 | m_background = prefwin->background(); | 2135 | m_background = prefwin->background(); |
2136 | reader->setBackground(getcolour(m_background)); | 2136 | reader->setBackground(getcolour(m_background)); |
2137 | m_twoTouch = prefwin->twotouch(); | 2137 | m_twoTouch = prefwin->twotouch(); |
2138 | reader->setTwoTouch(m_twoTouch); | 2138 | reader->setTwoTouch(m_twoTouch); |
2139 | m_touch_action->setOn(m_twoTouch); | 2139 | m_touch_action->setOn(m_twoTouch); |
2140 | 2140 | ||
2141 | reader->bstripcr = prefwin->StripCR(); | 2141 | reader->bstripcr = prefwin->StripCR(); |
2142 | reader->bNoInlineTables = !prefwin->InlineTables(); | 2142 | reader->bNoInlineTables = !prefwin->InlineTables(); |
2143 | reader->bdehyphen = prefwin->Dehyphen(); | 2143 | reader->bdehyphen = prefwin->Dehyphen(); |
2144 | reader->bonespace = prefwin->SingleSpace(); | 2144 | reader->bonespace = prefwin->SingleSpace(); |
2145 | reader->bunindent = prefwin->Unindent(); | 2145 | reader->bunindent = prefwin->Unindent(); |
2146 | reader->brepara = prefwin->Reparagraph(); | 2146 | reader->brepara = prefwin->Reparagraph(); |
2147 | reader->bdblspce = prefwin->DoubleSpace(); | 2147 | reader->bdblspce = prefwin->DoubleSpace(); |
2148 | reader->bremap = prefwin->Remap(); | 2148 | reader->bremap = prefwin->Remap(); |
2149 | reader->bmakebold = prefwin->Embolden(); | 2149 | reader->bmakebold = prefwin->Embolden(); |
2150 | reader->bfulljust = prefwin->FullJustify(); | 2150 | reader->bfulljust = prefwin->FullJustify(); |
2151 | //if (reader->bInverse != prefwin->Inverse()) reader->setInverse(prefwin->Inverse()); | 2151 | //if (reader->bInverse != prefwin->Inverse()) reader->setInverse(prefwin->Inverse()); |
2152 | //if (reader->bNegative != prefwin->Negative()) reader->setNegative(); | 2152 | //if (reader->bNegative != prefwin->Negative()) reader->setNegative(); |
2153 | reader->m_fontControl.FixGraphics(prefwin->FixGraphics()); | 2153 | reader->m_fontControl.FixGraphics(prefwin->FixGraphics()); |
2154 | 2154 | ||
2155 | reader->setextraspace(prefwin->ParaLead()); | 2155 | reader->setextraspace(prefwin->ParaLead()); |
2156 | reader->setlead(prefwin->LineLead()); | 2156 | reader->setlead(prefwin->LineLead()); |
2157 | reader->m_abstopmargin = prefwin->TopMargin(); | 2157 | reader->m_abstopmargin = prefwin->TopMargin(); |
2158 | reader->m_absbottommargin = prefwin->BottomMargin(); | 2158 | reader->m_absbottommargin = prefwin->BottomMargin(); |
2159 | reader->m_absleft_border = prefwin->LeftMargin(); | 2159 | reader->m_absleft_border = prefwin->LeftMargin(); |
2160 | reader->m_absright_border = prefwin->RightMargin(); | 2160 | reader->m_absright_border = prefwin->RightMargin(); |
2161 | reader->bindenter = prefwin->Indent(); | 2161 | reader->bindenter = prefwin->Indent(); |
2162 | reader->bautofmt = reader->btextfmt = reader->bstriphtml = reader->bpeanut = false; | 2162 | reader->bautofmt = reader->btextfmt = reader->bstriphtml = reader->bpeanut = false; |
2163 | switch (prefwin->Markup()) | 2163 | switch (prefwin->Markup()) |
2164 | { | 2164 | { |
2165 | case 0: | 2165 | case 0: |
2166 | reader->bautofmt = true; | 2166 | reader->bautofmt = true; |
2167 | break; | 2167 | break; |
2168 | case 1: | 2168 | case 1: |
2169 | break; | 2169 | break; |
2170 | case 2: | 2170 | case 2: |
2171 | reader->btextfmt = true; | 2171 | reader->btextfmt = true; |
2172 | break; | 2172 | break; |
2173 | case 3: | 2173 | case 3: |
2174 | reader->bstriphtml = true; | 2174 | reader->bstriphtml = true; |
2175 | break; | 2175 | break; |
2176 | case 4: | 2176 | case 4: |
2177 | reader->bpeanut = true; | 2177 | reader->bpeanut = true; |
2178 | break; | 2178 | break; |
2179 | default: | 2179 | default: |
2180 | qDebug("Format out of range"); | 2180 | qDebug("Format out of range"); |
2181 | } | 2181 | } |
2182 | reader->bdepluck = prefwin->Depluck(); | 2182 | reader->bdepluck = prefwin->Depluck(); |
2183 | reader->bdejpluck = prefwin->Dejpluck(); | 2183 | reader->bdejpluck = prefwin->Dejpluck(); |
2184 | reader->setContinuous(prefwin->Continuous()); | 2184 | reader->setContinuous(prefwin->Continuous()); |
2185 | reader->setDoubleBuffer(prefwin->DoubleBuffer()); | 2185 | reader->setDoubleBuffer(prefwin->DoubleBuffer()); |
2186 | 2186 | ||
2187 | /* | 2187 | /* |
2188 | m_leftScroll = prefwin->leftScroll(); | 2188 | m_leftScroll = prefwin->leftScroll(); |
2189 | m_rightScroll = prefwin->rightScroll(); | 2189 | m_rightScroll = prefwin->rightScroll(); |
2190 | m_upScroll = prefwin->upScroll(); | 2190 | m_upScroll = prefwin->upScroll(); |
2191 | m_downScroll = prefwin->downScroll(); | 2191 | m_downScroll = prefwin->downScroll(); |
2192 | */ | 2192 | */ |
2193 | m_targetapp = prefwin->dictApplication(); | 2193 | m_targetapp = prefwin->dictApplication(); |
2194 | m_targetmsg = prefwin->dictMessage(); | 2194 | m_targetmsg = prefwin->dictMessage(); |
2195 | 2195 | ||
2196 | m_doAnnotation = prefwin->miscannotation(); | 2196 | m_doAnnotation = prefwin->miscannotation(); |
2197 | m_doDictionary = prefwin->miscdictionary(); | 2197 | m_doDictionary = prefwin->miscdictionary(); |
2198 | m_doClipboard = prefwin->miscclipboard(); | 2198 | m_doClipboard = prefwin->miscclipboard(); |
2199 | m_doOutput = prefwin->miscoutput(); | 2199 | m_doOutput = prefwin->miscoutput(); |
2200 | reader->m_swapmouse = prefwin->SwapMouse(); | 2200 | reader->m_swapmouse = prefwin->SwapMouse(); |
2201 | reader->setBaseSize(prefwin->gfxsize()); | 2201 | reader->setBaseSize(prefwin->gfxsize()); |
2202 | reader->m_overlap = prefwin->pageoverlap(); | 2202 | reader->m_overlap = prefwin->pageoverlap(); |
2203 | reader->m_bMonoSpaced = prefwin->ideogram(); | 2203 | reader->m_bMonoSpaced = prefwin->ideogram(); |
2204 | m_setmono_action->setOn(reader->m_bMonoSpaced); | 2204 | m_setmono_action->setOn(reader->m_bMonoSpaced); |
2205 | reader->m_encd = prefwin->encoding(); | 2205 | reader->m_encd = prefwin->encoding(); |
2206 | reader->m_charpc = prefwin->ideogramwidth(); | 2206 | reader->m_charpc = prefwin->ideogramwidth(); |
2207 | 2207 | ||
2208 | if ( | 2208 | if ( |
2209 | reader->m_fontname != prefwin->Font() | 2209 | reader->m_fontname != prefwin->Font() |
2210 | || | 2210 | || |
2211 | m_propogatefontchange != prefwin->propfontchange()) | 2211 | m_propogatefontchange != prefwin->propfontchange()) |
2212 | { | 2212 | { |
2213 | m_propogatefontchange = prefwin->propfontchange(); | 2213 | m_propogatefontchange = prefwin->propfontchange(); |
2214 | setfontHelper(prefwin->Font()); | 2214 | setfontHelper(prefwin->Font()); |
2215 | } | 2215 | } |
2216 | if (m_bgtype != (bground)prefwin->bgtype()) | 2216 | if (m_bgtype != (bground)prefwin->bgtype()) |
2217 | { | 2217 | { |
2218 | m_bgtype = (bground)prefwin->bgtype(); | 2218 | m_bgtype = (bground)prefwin->bgtype(); |
2219 | setBackgroundBitmap(); | 2219 | setBackgroundBitmap(); |
2220 | } | 2220 | } |
2221 | qDebug("OutCodec:%s", (const char*)prefwin->outcodec()); | 2221 | qDebug("OutCodec:%s", (const char*)prefwin->outcodec()); |
2222 | if (reader->m_outputName != prefwin->outcodec()) | 2222 | if (reader->m_outputName != prefwin->outcodec()) |
2223 | { | 2223 | { |
2224 | if (reader->m_output != NULL) | 2224 | if (reader->m_output != NULL) |
2225 | { | 2225 | { |
2226 | QMessageBox::warning(this, PROGNAME, "Change of output codec\nrequires a restart"); | 2226 | QMessageBox::warning(this, PROGNAME, "Change of output codec\nrequires a restart"); |
2227 | } | 2227 | } |
2228 | reader->m_outputName = prefwin->outcodec(); | 2228 | reader->m_outputName = prefwin->outcodec(); |
2229 | } | 2229 | } |
2230 | delete prefwin; | 2230 | delete prefwin; |
2231 | reader->setfilter(reader->getfilter()); | 2231 | reader->setfilter(reader->getfilter()); |
2232 | reader->refresh(); | 2232 | reader->refresh(); |
2233 | } | 2233 | } |
2234 | else | 2234 | else |
2235 | { | 2235 | { |
2236 | delete prefwin; | 2236 | delete prefwin; |
2237 | } | 2237 | } |
2238 | } | 2238 | } |
2239 | 2239 | ||
2240 | void QTReaderApp::showtoolbarprefs() | 2240 | void QTReaderApp::showtoolbarprefs() |
2241 | { | 2241 | { |
2242 | #ifdef USEQPE | 2242 | #ifdef USEQPE |
2243 | CBarPrefs* prefwin = new CBarPrefs(APPDIR, !m_bFloatingDialog, this); | 2243 | CBarPrefs* prefwin = new CBarPrefs(APPDIR, !m_bFloatingDialog, this); |
2244 | #else | 2244 | #else |
2245 | QFileInfo fi; | 2245 | QFileInfo fi; |
2246 | QDir d = QDir::home(); // "/" | 2246 | QDir d = QDir::home(); // "/" |
2247 | if ( !d.cd(APPDIR) ) | 2247 | if ( !d.cd(APPDIR) ) |
2248 | { // "/tmp" | 2248 | { // "/tmp" |
2249 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); | 2249 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); |
2250 | d = QDir::home(); | 2250 | d = QDir::home(); |
2251 | d.mkdir(APPDIR); | 2251 | d.mkdir(APPDIR); |
2252 | d.cd(APPDIR); | 2252 | d.cd(APPDIR); |
2253 | } | 2253 | } |
2254 | fi.setFile(d, INIFILE); | 2254 | fi.setFile(d, INIFILE); |
2255 | CBarPrefs* prefwin = new CBarPrefs(fi.absFilePath(), !m_bFloatingDialog, this); | 2255 | CBarPrefs* prefwin = new CBarPrefs(fi.absFilePath(), !m_bFloatingDialog, this); |
2256 | #endif | 2256 | #endif |
2257 | prefwin->tbpolicy(m_tbpolsave); | 2257 | prefwin->tbpolicy(m_tbpolsave); |
2258 | prefwin->tbposition(m_tbposition-2); | 2258 | prefwin->tbposition(m_tbposition-2); |
2259 | prefwin->tbmovable(m_tbmovesave); | 2259 | prefwin->tbmovable(m_tbmovesave); |
2260 | prefwin->floating(m_bFloatingDialog); | 2260 | prefwin->floating(m_bFloatingDialog); |
2261 | prefwin->qtscroll(m_qtscroll); | 2261 | prefwin->qtscroll(m_qtscroll); |
2262 | prefwin->localscroll(m_localscroll); | 2262 | prefwin->localscroll(m_localscroll); |
2263 | if (prefwin->exec()) | 2263 | if (prefwin->exec()) |
2264 | { | 2264 | { |
2265 | m_bFloatingDialog = prefwin->floating(); | 2265 | m_bFloatingDialog = prefwin->floating(); |
2266 | if ( | 2266 | if ( |
2267 | m_tbpolsave != (ToolbarPolicy)prefwin->tbpolicy() | 2267 | m_tbpolsave != (ToolbarPolicy)prefwin->tbpolicy() |
2268 | || | 2268 | || |
2269 | m_tbposition != (ToolBarDock)(prefwin->tbposition()+2) | 2269 | m_tbposition != (ToolBarDock)(prefwin->tbposition()+2) |
2270 | || | 2270 | || |
2271 | m_tbmovesave != prefwin->tbmovable() | 2271 | m_tbmovesave != prefwin->tbmovable() |
2272 | || | 2272 | || |
2273 | m_qtscroll != prefwin->qtscroll() | 2273 | m_qtscroll != prefwin->qtscroll() |
2274 | // || | 2274 | // || |
2275 | // m_localscrollbar != prefwin->scrollonleft() | 2275 | // m_localscrollbar != prefwin->scrollonleft() |
2276 | ) | 2276 | ) |
2277 | { | 2277 | { |
2278 | QMessageBox::warning(this, PROGNAME, "Some changes won't take effect\nuntil the next time the\napplication is started"); | 2278 | QMessageBox::warning(this, PROGNAME, "Some changes won't take effect\nuntil the next time the\napplication is started"); |
2279 | } | 2279 | } |
2280 | m_tbpolsave = (ToolbarPolicy)prefwin->tbpolicy(); | 2280 | m_tbpolsave = (ToolbarPolicy)prefwin->tbpolicy(); |
2281 | m_tbposition = (ToolBarDock)(prefwin->tbposition()+2); | 2281 | m_tbposition = (ToolBarDock)(prefwin->tbposition()+2); |
2282 | m_tbmovesave = prefwin->tbmovable(); | 2282 | m_tbmovesave = prefwin->tbmovable(); |
2283 | reader->m_scrollpos = m_localscroll = prefwin->localscroll(); | 2283 | reader->m_scrollpos = m_localscroll = prefwin->localscroll(); |
2284 | if (m_qtscroll != prefwin->qtscroll()) | 2284 | if (m_qtscroll != prefwin->qtscroll()) |
2285 | { | 2285 | { |
2286 | m_qtscroll = prefwin->qtscroll(); | 2286 | m_qtscroll = prefwin->qtscroll(); |
2287 | setrotated(reader->m_rotated); | 2287 | setrotated(reader->m_rotated); |
2288 | } | 2288 | } |
2289 | if (m_scrollbar == NULL || m_scrollbar->isHidden()) | 2289 | if (m_scrollbar == NULL || m_scrollbar->isHidden()) |
2290 | { | 2290 | { |
2291 | reader->m_scrollpos = m_localscroll; | 2291 | reader->m_scrollpos = m_localscroll; |
2292 | } | 2292 | } |
2293 | else | 2293 | else |
2294 | { | 2294 | { |
2295 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; | 2295 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; |
2296 | } | 2296 | } |
2297 | bool isChanged = prefwin->isChanged(); | 2297 | bool isChanged = prefwin->isChanged(); |
2298 | delete prefwin; | 2298 | delete prefwin; |
2299 | #ifdef USEQPE | 2299 | #ifdef USEQPE |
2300 | Config config( APPDIR ); | 2300 | Config config( APPDIR ); |
2301 | #else | 2301 | #else |
2302 | QFileInfo fi; | 2302 | QFileInfo fi; |
2303 | QDir d = QDir::home(); // "/" | 2303 | QDir d = QDir::home(); // "/" |
2304 | if ( !d.cd(APPDIR) ) | 2304 | if ( !d.cd(APPDIR) ) |
2305 | { // "/tmp" | 2305 | { // "/tmp" |
2306 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); | 2306 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); |
2307 | d = QDir::home(); | 2307 | d = QDir::home(); |
2308 | d.mkdir(APPDIR); | 2308 | d.mkdir(APPDIR); |
2309 | d.cd(APPDIR); | 2309 | d.cd(APPDIR); |
2310 | } | 2310 | } |
2311 | fi.setFile(d, INIFILE); | 2311 | fi.setFile(d, INIFILE); |
2312 | Config config( fi.absFilePath() ); | 2312 | Config config( fi.absFilePath() ); |
2313 | #endif | 2313 | #endif |
2314 | if (isChanged) addtoolbars(&config); | 2314 | if (isChanged) addtoolbars(&config); |
2315 | } | 2315 | } |
2316 | else | 2316 | else |
2317 | { | 2317 | { |
2318 | delete prefwin; | 2318 | delete prefwin; |
2319 | } | 2319 | } |
2320 | } | 2320 | } |
2321 | 2321 | ||
2322 | void QTReaderApp::showinfo() | 2322 | void QTReaderApp::showinfo() |
2323 | { | 2323 | { |
2324 | unsigned long ds, fs, ts, pl, dl; | 2324 | unsigned long ds, fs, ts, pl, dl; |
2325 | if (reader->empty()) | 2325 | if (reader->empty()) |
2326 | { | 2326 | { |
2327 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); | 2327 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); |
2328 | } | 2328 | } |
2329 | else | 2329 | else |
2330 | { | 2330 | { |
2331 | reader->sizes(fs,ts); | 2331 | reader->sizes(fs,ts); |
2332 | ds = reader->buffdoc.endSection() - reader->buffdoc.startSection(); | 2332 | ds = reader->buffdoc.endSection() - reader->buffdoc.startSection(); |
2333 | pl = reader->pagelocate(); | 2333 | pl = reader->pagelocate(); |
2334 | dl = pl - reader->buffdoc.startSection(); | 2334 | dl = pl - reader->buffdoc.startSection(); |
2335 | m_infoWin->setFileSize(fs); | 2335 | m_infoWin->setFileSize(fs); |
2336 | m_infoWin->setTextSize(ts); | 2336 | m_infoWin->setTextSize(ts); |
2337 | if (fs > UINT_MAX/100) | 2337 | if (fs > UINT_MAX/100) |
2338 | { | 2338 | { |
2339 | unsigned long t1 = (ts+50)/100; | 2339 | unsigned long t1 = (ts+50)/100; |
2340 | m_infoWin->setRatio(100-(fs + (t1 >> 1))/t1); | 2340 | m_infoWin->setRatio(100-(fs + (t1 >> 1))/t1); |
2341 | } | 2341 | } |
2342 | else | 2342 | else |
2343 | { | 2343 | { |
2344 | m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); | 2344 | m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); |
2345 | } | 2345 | } |
2346 | m_infoWin->setLocation(pl); | 2346 | m_infoWin->setLocation(pl); |
2347 | if (pl > UINT_MAX/100) | 2347 | if (pl > UINT_MAX/100) |
2348 | { | 2348 | { |
2349 | unsigned long t1 = (ts+50)/100; | 2349 | unsigned long t1 = (ts+50)/100; |
2350 | m_infoWin->setRead((pl + (t1 >> 1))/t1); | 2350 | m_infoWin->setRead((pl + (t1 >> 1))/t1); |
2351 | } | 2351 | } |
2352 | else | 2352 | else |
2353 | { | 2353 | { |
2354 | m_infoWin->setRead((100*pl + (ts >> 1))/ts); | 2354 | m_infoWin->setRead((100*pl + (ts >> 1))/ts); |
2355 | } | 2355 | } |
2356 | m_infoWin->setDocSize(ds); | 2356 | m_infoWin->setDocSize(ds); |
2357 | m_infoWin->setDocLocation(dl); | 2357 | m_infoWin->setDocLocation(dl); |
2358 | if (dl > UINT_MAX/100) | 2358 | if (dl > UINT_MAX/100) |
2359 | { | 2359 | { |
2360 | unsigned long d1 = (ds+50)/100; | 2360 | unsigned long d1 = (ds+50)/100; |
2361 | m_infoWin->setDocRead((dl + (d1 >> 1))/d1); | 2361 | m_infoWin->setDocRead((dl + (d1 >> 1))/d1); |
2362 | } | 2362 | } |
2363 | else | 2363 | else |
2364 | { | 2364 | { |
2365 | m_infoWin->setDocRead((100*dl + (ds >> 1))/ds); | 2365 | m_infoWin->setDocRead((100*dl + (ds >> 1))/ds); |
2366 | } | 2366 | } |
2367 | m_infoWin->setZoom(reader->m_fontControl.currentsize()*10); | 2367 | m_infoWin->setZoom(reader->m_fontControl.currentsize()*10); |
2368 | m_infoWin->setAbout(QString("\nApplication (c) Tim Wentford\n")+reader->about()); | 2368 | m_infoWin->setAbout(QString("\nApplication (c) Tim Wentford\n")+reader->about()); |
2369 | editorStack->raiseWidget( m_infoWin ); | 2369 | editorStack->raiseWidget( m_infoWin ); |
2370 | hidetoolbars(); | 2370 | hidetoolbars(); |
2371 | m_infoWin->setFocus(); | 2371 | m_infoWin->setFocus(); |
2372 | } | 2372 | } |
2373 | } | 2373 | } |
2374 | 2374 | ||
2375 | 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) |
2376 | { | 2376 | { |
2377 | if (pBkmklist == NULL) reader->pBkmklist = pBkmklist = new CList<Bkmk>; | 2377 | if (pBkmklist == NULL) reader->pBkmklist = pBkmklist = new CList<Bkmk>; |
2378 | #ifdef _UNICODE | 2378 | #ifdef _UNICODE |
2379 | CBuffer buff(name.length()+1); | 2379 | CBuffer buff(name.length()+1); |
2380 | int i; | 2380 | int i; |
2381 | for (i = 0; i < name.length(); i++) | 2381 | for (i = 0; i < name.length(); i++) |
2382 | { | 2382 | { |
2383 | buff[i] = name[i].unicode(); | 2383 | buff[i] = name[i].unicode(); |
2384 | } | 2384 | } |
2385 | buff[i] = 0; | 2385 | buff[i] = 0; |
2386 | CBuffer buff2(text.length()+1); | 2386 | CBuffer buff2(text.length()+1); |
2387 | for (i = 0; i < text.length(); i++) | 2387 | for (i = 0; i < text.length(); i++) |
2388 | { | 2388 | { |
2389 | buff2[i] = text[i].unicode(); | 2389 | buff2[i] = text[i].unicode(); |
2390 | } | 2390 | } |
2391 | buff2[i] = 0; | 2391 | buff2[i] = 0; |
2392 | Bkmk b(buff.data(), buff2.data(), posn, posn2); | 2392 | Bkmk b(buff.data(), buff2.data(), posn, posn2); |
2393 | QColor c = m_annoWin->getColor(); | 2393 | QColor c = m_annoWin->getColor(); |
2394 | int red,green,blue; | 2394 | int red,green,blue; |
2395 | c.rgb(&red, &green, &blue); | 2395 | c.rgb(&red, &green, &blue); |
2396 | b.red(red); | 2396 | b.red(red); |
2397 | b.green(green); | 2397 | b.green(green); |
2398 | b.blue(blue); | 2398 | b.blue(blue); |
2399 | pBkmklist->push_front(b); | 2399 | pBkmklist->push_front(b); |
2400 | #else | 2400 | #else |
2401 | pBkmklist->push_front(Bkmk((const tchar*)text,posn)); | 2401 | pBkmklist->push_front(Bkmk((const tchar*)text,posn)); |
2402 | #endif | 2402 | #endif |
2403 | m_fBkmksChanged = true; | 2403 | m_fBkmksChanged = true; |
2404 | pBkmklist->sort(); | 2404 | pBkmklist->sort(); |
2405 | } | 2405 | } |
2406 | 2406 | ||
2407 | void QTReaderApp::addAnno(const QString& name, const QString& text) | 2407 | void QTReaderApp::addAnno(const QString& name, const QString& text) |
2408 | { | 2408 | { |
2409 | if (m_annoIsEditing) | 2409 | if (m_annoIsEditing) |
2410 | { | 2410 | { |
2411 | if (name.isEmpty()) | 2411 | if (name.isEmpty()) |
2412 | { | 2412 | { |
2413 | 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); |
2414 | } | 2414 | } |
2415 | else | 2415 | else |
2416 | { | 2416 | { |
2417 | addAnno(name, text, m_annoWin->getPosn(), m_annoWin->getPosn2()); | 2417 | addAnno(name, text, m_annoWin->getPosn(), m_annoWin->getPosn2()); |
2418 | } | 2418 | } |
2419 | showEditTools(); | 2419 | showEditTools(); |
2420 | } | 2420 | } |
2421 | else | 2421 | else |
2422 | { | 2422 | { |
2423 | if (m_annoWin->edited()) | 2423 | if (m_annoWin->edited()) |
2424 | { | 2424 | { |
2425 | CBuffer buff(text.length()+1); | 2425 | CBuffer buff(text.length()+1); |
2426 | int i; | 2426 | int i; |
2427 | for (i = 0; i < text.length(); i++) | 2427 | for (i = 0; i < text.length(); i++) |
2428 | { | 2428 | { |
2429 | buff[i] = text[i].unicode(); | 2429 | buff[i] = text[i].unicode(); |
2430 | } | 2430 | } |
2431 | buff[i] = 0; | 2431 | buff[i] = 0; |
2432 | m_fBkmksChanged = true; | 2432 | m_fBkmksChanged = true; |
2433 | m_anno->setAnno(buff.data()); | 2433 | m_anno->setAnno(buff.data()); |
2434 | } | 2434 | } |
2435 | QColor c = m_annoWin->getColor(); | 2435 | QColor c = m_annoWin->getColor(); |
2436 | int red,green,blue; | 2436 | int red,green,blue; |
2437 | c.rgb(&red, &green, &blue); | 2437 | c.rgb(&red, &green, &blue); |
2438 | m_anno->red(red); | 2438 | m_anno->red(red); |
2439 | m_anno->green(green); | 2439 | m_anno->green(green); |
2440 | m_anno->blue(blue); | 2440 | m_anno->blue(blue); |
2441 | bool found = findNextBookmark(m_anno->value()+1); | 2441 | bool found = findNextBookmark(m_anno->value()+1); |
2442 | if (found) | 2442 | if (found) |
2443 | { | 2443 | { |
2444 | m_annoWin->setName(toQString(m_anno->name())); | 2444 | m_annoWin->setName(toQString(m_anno->name())); |
2445 | m_annoWin->setAnno(toQString(m_anno->anno())); | 2445 | m_annoWin->setAnno(toQString(m_anno->anno())); |
2446 | m_annoWin->setColor(QColor(m_anno->red(), m_anno->green(), m_anno->blue())); | 2446 | m_annoWin->setColor(QColor(m_anno->red(), m_anno->green(), m_anno->blue())); |
2447 | } | 2447 | } |
2448 | else | 2448 | else |
2449 | { | 2449 | { |
2450 | showEditTools(); | 2450 | showEditTools(); |
2451 | } | 2451 | } |
2452 | } | 2452 | } |
2453 | } | 2453 | } |
2454 | 2454 | ||
2455 | bool QTReaderApp::findNextBookmark(size_t start) | 2455 | bool QTReaderApp::findNextBookmark(size_t start) |
2456 | { | 2456 | { |
2457 | bool found = false; | 2457 | bool found = false; |
2458 | for (CList<Bkmk>::iterator iter = pBkmklist->begin(); iter != pBkmklist->end(); iter++) | 2458 | for (CList<Bkmk>::iterator iter = pBkmklist->begin(); iter != pBkmklist->end(); iter++) |
2459 | { | 2459 | { |
2460 | if (iter->value() >= start) | 2460 | if (iter->value() >= start) |
2461 | { | 2461 | { |
2462 | if (iter->value() < reader->locate()) | 2462 | if (iter->value() < reader->locate()) |
2463 | { | 2463 | { |
2464 | found = true; | 2464 | found = true; |
2465 | m_anno = iter.pContent(); | 2465 | m_anno = iter.pContent(); |
2466 | } | 2466 | } |
2467 | break; | 2467 | break; |
2468 | } | 2468 | } |
2469 | } | 2469 | } |
2470 | return found; | 2470 | return found; |
2471 | } | 2471 | } |
2472 | 2472 | ||
2473 | void QTReaderApp::addanno() | 2473 | void QTReaderApp::addanno() |
2474 | { | 2474 | { |
2475 | if (reader->empty()) | 2475 | if (reader->empty()) |
2476 | { | 2476 | { |
2477 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); | 2477 | QMessageBox::information(this, PROGNAME, "No file loaded", 1); |
2478 | } | 2478 | } |
2479 | else | 2479 | else |
2480 | { | 2480 | { |
2481 | m_annoWin->setName(""); | 2481 | m_annoWin->setName(""); |
2482 | m_annoWin->setAnno(""); | 2482 | m_annoWin->setAnno(""); |
2483 | m_annoWin->setPosn(reader->pagelocate()); | 2483 | m_annoWin->setPosn(reader->pagelocate()); |
2484 | m_annoIsEditing = true; | 2484 | m_annoIsEditing = true; |
2485 | editorStack->raiseWidget( m_annoWin ); | 2485 | editorStack->raiseWidget( m_annoWin ); |
2486 | hidetoolbars(); | 2486 | hidetoolbars(); |
2487 | #ifdef USEQPE | 2487 | #ifdef USEQPE |
2488 | Global::showInputMethod(); | 2488 | Global::showInputMethod(); |
2489 | #endif | 2489 | #endif |
2490 | m_annoWin->setFocus(); | 2490 | m_annoWin->setFocus(); |
2491 | } | 2491 | } |
2492 | } | 2492 | } |
2493 | 2493 | ||
2494 | void QTReaderApp::infoClose() | 2494 | void QTReaderApp::infoClose() |
2495 | { | 2495 | { |
2496 | m_debounce = m_buttonprefs->Debounce(); | 2496 | m_debounce = m_buttonprefs->Debounce(); |
2497 | if (m_kmapchanged) | 2497 | if (m_kmapchanged) |
2498 | { | 2498 | { |
2499 | m_kmapchanged = false; | 2499 | m_kmapchanged = false; |
2500 | #ifndef USEQPE | 2500 | #ifndef USEQPE |
2501 | QDir d = QDir::home(); // "/" | 2501 | QDir d = QDir::home(); // "/" |
2502 | d.cd(APPDIR); | 2502 | d.cd(APPDIR); |
2503 | QFileInfo fi(d, ".keymap"); | 2503 | QFileInfo fi(d, ".keymap"); |
2504 | FILE* f = fopen((const char *)fi.absFilePath(), "w"); | 2504 | FILE* f = fopen((const char *)fi.absFilePath(), "w"); |
2505 | #else /* USEQPE */ | 2505 | #else /* USEQPE */ |
2506 | FILE* f = fopen((const char *)Global::applicationFileName(APPDIR,".keymap"), "w"); | 2506 | FILE* f = fopen((const char *)Global::applicationFileName(APPDIR,".keymap"), "w"); |
2507 | #endif /* USEQPE */ | 2507 | #endif /* USEQPE */ |
2508 | if (f != NULL) | 2508 | if (f != NULL) |
2509 | { | 2509 | { |
2510 | uint cnt = KEYMAPVERSION; | 2510 | uint cnt = KEYMAPVERSION; |
2511 | fwrite(&cnt, sizeof(cnt), 1, f); | 2511 | fwrite(&cnt, sizeof(cnt), 1, f); |
2512 | cnt = kmap.count(); | 2512 | cnt = kmap.count(); |
2513 | fwrite(&cnt, sizeof(cnt), 1, f); | 2513 | fwrite(&cnt, sizeof(cnt), 1, f); |
2514 | for (QMap<orKey,int>::Iterator i = kmap.begin(); i != kmap.end(); i++) | 2514 | for (QMap<orKey,int>::Iterator i = kmap.begin(); i != kmap.end(); i++) |
2515 | { | 2515 | { |
2516 | orKey key = i.key(); | 2516 | orKey key = i.key(); |
2517 | int data = i.data(); | 2517 | int data = i.data(); |
2518 | fwrite(&key, sizeof(key), 1, f); | 2518 | fwrite(&key, sizeof(key), 1, f); |
2519 | fwrite(&data, sizeof(data), 1, f); | 2519 | fwrite(&data, sizeof(data), 1, f); |
2520 | qDebug("Saved %s as %u", (const char*)key.text(), data); | 2520 | qDebug("Saved %s as %u", (const char*)key.text(), data); |
2521 | } | 2521 | } |
2522 | fclose(f); | 2522 | fclose(f); |
2523 | } | 2523 | } |
2524 | } | 2524 | } |
2525 | showEditTools(); | 2525 | showEditTools(); |
2526 | } | 2526 | } |
2527 | 2527 | ||
2528 | /* | 2528 | /* |
2529 | void QTReaderApp::fileRevert() | 2529 | void QTReaderApp::fileRevert() |
2530 | { | 2530 | { |
2531 | clear(); | 2531 | clear(); |
2532 | fileOpen(); | 2532 | fileOpen(); |
2533 | } | 2533 | } |
2534 | 2534 | ||
2535 | void QTReaderApp::editCut() | 2535 | void QTReaderApp::editCut() |
2536 | { | 2536 | { |
2537 | #ifndef QT_NO_CLIPBOARD | 2537 | #ifndef QT_NO_CLIPBOARD |
2538 | editor->cut(); | 2538 | editor->cut(); |
2539 | #endif | 2539 | #endif |
2540 | } | 2540 | } |
2541 | */ | 2541 | */ |
2542 | void QTReaderApp::editMark() | 2542 | void QTReaderApp::editMark() |
2543 | { | 2543 | { |
2544 | m_savedpos = reader->pagelocate(); | 2544 | m_savedpos = reader->pagelocate(); |
2545 | } | 2545 | } |
2546 | 2546 | ||
2547 | void QTReaderApp::editCopy() | 2547 | void QTReaderApp::editCopy() |
2548 | { | 2548 | { |
2549 | QClipboard* cb = QApplication::clipboard(); | 2549 | QClipboard* cb = QApplication::clipboard(); |
2550 | QString text; | 2550 | QString text; |
2551 | int ch; | 2551 | int ch; |
2552 | unsigned long currentpos = reader->pagelocate(); | 2552 | unsigned long currentpos = reader->pagelocate(); |
2553 | unsigned long endpos = reader->locate(); | 2553 | unsigned long endpos = reader->locate(); |
2554 | if (m_savedpos == 0xffffffff) | 2554 | if (m_savedpos == 0xffffffff) |
2555 | { | 2555 | { |
2556 | m_savedpos = currentpos; | 2556 | m_savedpos = currentpos; |
2557 | } | 2557 | } |
2558 | reader->jumpto(m_savedpos); | 2558 | reader->jumpto(m_savedpos); |
2559 | while (reader->explocate() < endpos && (ch = reader->getch()) != UEOF) | 2559 | while (reader->explocate() < endpos && (ch = reader->getch()) != UEOF) |
2560 | { | 2560 | { |
2561 | text += ch; | 2561 | text += ch; |
2562 | } | 2562 | } |
2563 | cb->setText(text); | 2563 | cb->setText(text); |
2564 | reader->locate(currentpos); | 2564 | reader->locate(currentpos); |
2565 | m_savedpos = 0xffffffff; | 2565 | m_savedpos = 0xffffffff; |
2566 | } | 2566 | } |
2567 | 2567 | ||
2568 | void QTReaderApp::gotoStart() | 2568 | void QTReaderApp::gotoStart() |
2569 | { | 2569 | { |
2570 | reader->locate(reader->buffdoc.startSection()); | 2570 | reader->locate(reader->buffdoc.startSection()); |
2571 | } | 2571 | } |
2572 | 2572 | ||
2573 | void QTReaderApp::gotoEnd() | 2573 | void QTReaderApp::gotoEnd() |
2574 | { | 2574 | { |
2575 | reader->dopageup(reader->buffdoc.endSection()); | 2575 | reader->dopageup(reader->buffdoc.endSection()); |
2576 | } | 2576 | } |
2577 | 2577 | ||
2578 | void QTReaderApp::pageup() | 2578 | void QTReaderApp::pageup() |
2579 | { | 2579 | { |
2580 | reader->NavUp(); | 2580 | reader->NavUp(); |
2581 | } | 2581 | } |
2582 | 2582 | ||
2583 | void QTReaderApp::pagedn() | 2583 | void QTReaderApp::pagedn() |
2584 | { | 2584 | { |
2585 | reader->NavDown(); | 2585 | reader->NavDown(); |
2586 | } | 2586 | } |
2587 | 2587 | ||
2588 | void QTReaderApp::pagemode(bool _b) | 2588 | void QTReaderApp::pagemode(bool _b) |
2589 | { | 2589 | { |
2590 | reader->setpagemode(_b); | 2590 | reader->setpagemode(_b); |
2591 | } | 2591 | } |
2592 | 2592 | ||
2593 | /* | 2593 | /* |
2594 | void QTReaderApp::setspacing() | 2594 | void QTReaderApp::setspacing() |
2595 | { | 2595 | { |
2596 | m_nRegAction = cMonoSpace; | 2596 | m_nRegAction = cMonoSpace; |
2597 | char lcn[20]; | 2597 | char lcn[20]; |
2598 | sprintf(lcn, "%lu", reader->m_charpc); | 2598 | sprintf(lcn, "%lu", reader->m_charpc); |
2599 | regEdit->setText(lcn); | 2599 | regEdit->setText(lcn); |
2600 | do_regedit(); | 2600 | do_regedit(); |
2601 | } | 2601 | } |
2602 | */ | 2602 | */ |
2603 | void QTReaderApp::settarget() | 2603 | void QTReaderApp::settarget() |
2604 | { | 2604 | { |
2605 | m_nRegAction = cSetTarget; | 2605 | m_nRegAction = cSetTarget; |
2606 | QString text = ((m_targetapp.isEmpty()) ? QString("") : m_targetapp) | 2606 | QString text = ((m_targetapp.isEmpty()) ? QString("") : m_targetapp) |
2607 | + "/" | 2607 | + "/" |
2608 | + ((m_targetmsg.isEmpty()) ? QString("") : m_targetmsg); | 2608 | + ((m_targetmsg.isEmpty()) ? QString("") : m_targetmsg); |
2609 | regEdit->setText(text); | 2609 | regEdit->setText(text); |
2610 | do_regedit(); | 2610 | do_regedit(); |
2611 | } | 2611 | } |
2612 | 2612 | ||
2613 | /* | 2613 | /* |
2614 | void QTReaderApp::do_mono(const QString& lcn) | 2614 | void QTReaderApp::do_mono(const QString& lcn) |
2615 | { | 2615 | { |
2616 | bool ok; | 2616 | bool ok; |
2617 | unsigned long ulcn = lcn.toULong(&ok); | 2617 | unsigned long ulcn = lcn.toULong(&ok); |
2618 | if (ok) | 2618 | if (ok) |
2619 | { | 2619 | { |
2620 | reader->m_charpc = ulcn; | 2620 | reader->m_charpc = ulcn; |
2621 | reader->setfont(); | 2621 | reader->setfont(); |
2622 | reader->refresh(); | 2622 | reader->refresh(); |
2623 | //reader->setmono(true); | 2623 | //reader->setmono(true); |
2624 | } | 2624 | } |
2625 | else | 2625 | else |
2626 | QMessageBox::information(this, PROGNAME, "Must be a number"); | 2626 | QMessageBox::information(this, PROGNAME, "Must be a number"); |
2627 | } | 2627 | } |
2628 | */ | 2628 | */ |
2629 | /* | 2629 | /* |
2630 | void QTReaderApp::editPaste() | 2630 | void QTReaderApp::editPaste() |
2631 | { | 2631 | { |
2632 | #ifndef QT_NO_CLIPBOARD | 2632 | #ifndef QT_NO_CLIPBOARD |
2633 | editor->paste(); | 2633 | editor->paste(); |
2634 | #endif | 2634 | #endif |
2635 | } | 2635 | } |
2636 | */ | 2636 | */ |
2637 | 2637 | ||
2638 | void QTReaderApp::editFind() | 2638 | void QTReaderApp::editFind() |
2639 | { | 2639 | { |
2640 | searchStart = reader->pagelocate(); | 2640 | searchStart = reader->pagelocate(); |
2641 | #ifdef __ISEARCH | 2641 | #ifdef __ISEARCH |
2642 | searchStack = new QStack<searchrecord>; | 2642 | searchStack = new QStack<searchrecord>; |
2643 | #endif | 2643 | #endif |
2644 | #ifdef USEQPE | 2644 | #ifdef USEQPE |
2645 | Global::showInputMethod(); | 2645 | Global::showInputMethod(); |
2646 | #endif | 2646 | #endif |
2647 | searchBar->show(); | 2647 | searchBar->show(); |
2648 | searchVisible = TRUE; | 2648 | searchVisible = TRUE; |
2649 | searchEdit->setFocus(); | 2649 | searchEdit->setFocus(); |
2650 | #ifdef __ISEARCH | 2650 | #ifdef __ISEARCH |
2651 | searchStack->push(new searchrecord("",reader->pagelocate())); | 2651 | searchStack->push(new searchrecord("",reader->pagelocate())); |
2652 | #endif | 2652 | #endif |
2653 | } | 2653 | } |
2654 | 2654 | ||
2655 | void QTReaderApp::findNext() | 2655 | void QTReaderApp::findNext() |
2656 | { | 2656 | { |
2657 | // // qDebug("findNext called\n"); | 2657 | // // qDebug("findNext called\n"); |
2658 | #ifdef __ISEARCH | 2658 | #ifdef __ISEARCH |
2659 | QString arg = searchEdit->text(); | 2659 | QString arg = searchEdit->text(); |
2660 | #else | 2660 | #else |
2661 | QRegExp arg = searchEdit->text(); | 2661 | QRegExp arg = searchEdit->text(); |
2662 | #endif | 2662 | #endif |
2663 | CDrawBuffer test(&(reader->m_fontControl)); | 2663 | CDrawBuffer test(&(reader->m_fontControl)); |
2664 | size_t start = reader->pagelocate(); | 2664 | size_t start = reader->pagelocate(); |
2665 | reader->jumpto(start); | 2665 | reader->jumpto(start); |
2666 | reader->getline(&test); | 2666 | reader->getline(&test); |
2667 | dosearch(start, test, arg); | 2667 | dosearch(start, test, arg); |
2668 | } | 2668 | } |
2669 | 2669 | ||
2670 | void QTReaderApp::findClose() | 2670 | void QTReaderApp::findClose() |
2671 | { | 2671 | { |
2672 | searchVisible = FALSE; | 2672 | searchVisible = FALSE; |
2673 | searchEdit->setText(""); | 2673 | searchEdit->setText(""); |
2674 | #ifdef USEQPE | 2674 | #ifdef USEQPE |
2675 | Global::hideInputMethod(); | 2675 | Global::hideInputMethod(); |
2676 | #endif | 2676 | #endif |
2677 | searchBar->hide(); | 2677 | searchBar->hide(); |
2678 | #ifdef __ISEARCH | 2678 | #ifdef __ISEARCH |
2679 | // searchStack = new QStack<searchrecord>; | 2679 | // searchStack = new QStack<searchrecord>; |
2680 | while (!searchStack->isEmpty()) | 2680 | while (!searchStack->isEmpty()) |
2681 | { | 2681 | { |
2682 | delete searchStack->pop(); | 2682 | delete searchStack->pop(); |
2683 | } | 2683 | } |
2684 | delete searchStack; | 2684 | delete searchStack; |
2685 | #endif | 2685 | #endif |
2686 | reader->setFocus(); | 2686 | reader->setFocus(); |
2687 | } | 2687 | } |
2688 | 2688 | ||
2689 | void QTReaderApp::regClose() | 2689 | void QTReaderApp::regClose() |
2690 | { | 2690 | { |
2691 | regVisible = FALSE; | 2691 | regVisible = FALSE; |
2692 | regEdit->setText(""); | 2692 | regEdit->setText(""); |
2693 | regBar->hide(); | 2693 | regBar->hide(); |
2694 | #ifdef USEQPE | 2694 | #ifdef USEQPE |
2695 | Global::hideInputMethod(); | 2695 | Global::hideInputMethod(); |
2696 | #endif | 2696 | #endif |
2697 | reader->setFocus(); | 2697 | reader->setFocus(); |
2698 | } | 2698 | } |
2699 | 2699 | ||
2700 | #ifdef __ISEARCH | 2700 | #ifdef __ISEARCH |
2701 | bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QString& arg) | 2701 | bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QString& arg) |
2702 | #else | 2702 | #else |
2703 | bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg) | 2703 | bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg) |
2704 | #endif | 2704 | #endif |
2705 | { | 2705 | { |
2706 | bool ret = true; | 2706 | bool ret = true; |
2707 | unsigned long fs, ts; | 2707 | unsigned long fs, ts; |
2708 | reader->sizes(fs,ts); | 2708 | reader->sizes(fs,ts); |
2709 | size_t pos = reader->locate(); | 2709 | size_t pos = reader->locate(); |
2710 | pbar->setGeometry(searchBar->x(),searchBar->y(),searchBar->width(), searchBar->height()); | 2710 | pbar->setGeometry(searchBar->x(),searchBar->y(),searchBar->width(), searchBar->height()); |
2711 | pbar->show(); | 2711 | pbar->show(); |
2712 | pbar->raise(); | 2712 | pbar->raise(); |
2713 | pbar->reset(); | 2713 | pbar->reset(); |
2714 | int offset; | 2714 | int offset; |
2715 | int lastpc = (100*pos)/ts; | 2715 | int lastpc = (100*pos)/ts; |
2716 | pbar->setProgress(lastpc); | 2716 | pbar->setProgress(lastpc); |
2717 | // qApp->processEvents(); | 2717 | // qApp->processEvents(); |
2718 | if (reader->buffdoc.getpara(test) >= 0) | 2718 | if (reader->buffdoc.getpara(test) >= 0) |
2719 | { | 2719 | { |
2720 | reader->setFocus(); | 2720 | reader->setFocus(); |
2721 | #ifdef __ISEARCH | 2721 | #ifdef __ISEARCH |
2722 | while (strstr(test.data(),(const tchar*)arg) == NULL) | 2722 | while (strstr(test.data(),(const tchar*)arg) == NULL) |
2723 | #else | 2723 | #else |
2724 | #ifdef _UNICODE | 2724 | #ifdef _UNICODE |
2725 | while ((offset = arg.match(toQString(test.data()))) == -1) | 2725 | while ((offset = arg.match(toQString(test.data()))) == -1) |
2726 | #else | 2726 | #else |
2727 | while (arg.match(test.data()) == -1) | 2727 | while (arg.match(test.data()) == -1) |
2728 | #endif | 2728 | #endif |
2729 | #endif | 2729 | #endif |
2730 | { | 2730 | { |
2731 | pos = reader->locate(); | 2731 | pos = reader->locate(); |
2732 | int pc = (100*pos)/ts; | 2732 | int pc = (100*pos)/ts; |
2733 | if (pc != lastpc) | 2733 | if (pc != lastpc) |
2734 | { | 2734 | { |
2735 | pbar->setProgress(pc); | 2735 | pbar->setProgress(pc); |
2736 | qApp->processEvents(); | 2736 | qApp->processEvents(); |
2737 | reader->setFocus(); | 2737 | reader->setFocus(); |
2738 | lastpc = pc; | 2738 | lastpc = pc; |
2739 | } | 2739 | } |
2740 | 2740 | ||
2741 | if (reader->buffdoc.getpara(test) < 0) | 2741 | if (reader->buffdoc.getpara(test) < 0) |
2742 | { | 2742 | { |
2743 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) | 2743 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) |
2744 | pos = searchStart; | 2744 | pos = searchStart; |
2745 | else | 2745 | else |
2746 | pos = start; | 2746 | pos = start; |
2747 | findClose(); | 2747 | findClose(); |
2748 | pbar->hide(); | 2748 | pbar->hide(); |
2749 | reader->locate(pos); | 2749 | reader->locate(pos); |
2750 | return false; | 2750 | return false; |
2751 | } | 2751 | } |
2752 | } | 2752 | } |
2753 | // qDebug("Found it at %u:%u", pos, offset); | 2753 | // qDebug("Found it at %u:%u", pos, offset); |
2754 | pbar->hide(); | 2754 | pbar->hide(); |
2755 | // qDebug("Hid"); | 2755 | // qDebug("Hid"); |
2756 | reader->locate(pos+offset); | 2756 | reader->locate(pos+offset); |
2757 | // qDebug("Loacted"); | 2757 | // qDebug("Loacted"); |
2758 | // qDebug("page up"); | 2758 | // qDebug("page up"); |
2759 | ret = true; | 2759 | ret = true; |
2760 | } | 2760 | } |
2761 | else | 2761 | else |
2762 | { | 2762 | { |
2763 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) | 2763 | if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) |
2764 | pos = searchStart; | 2764 | pos = searchStart; |
2765 | else | 2765 | else |
2766 | pos = start; | 2766 | pos = start; |
2767 | ret = false; | 2767 | ret = false; |
2768 | findClose(); | 2768 | findClose(); |
2769 | } | 2769 | } |
2770 | return ret; | 2770 | return ret; |
2771 | } | 2771 | } |
2772 | 2772 | ||
2773 | #ifdef __ISEARCH | 2773 | #ifdef __ISEARCH |
2774 | void QTReaderApp::search(const QString & arg) | 2774 | void QTReaderApp::search(const QString & arg) |
2775 | { | 2775 | { |
2776 | searchrecord* ss = searchStack->top(); | 2776 | searchrecord* ss = searchStack->top(); |
2777 | CBuffer test; | 2777 | CBuffer test; |
2778 | size_t start = reader->pagelocate(); | 2778 | size_t start = reader->pagelocate(); |
2779 | bool haspopped = false; | 2779 | bool haspopped = false; |
2780 | while (arg.left(ss->s.length()) != ss->s) | 2780 | while (arg.left(ss->s.length()) != ss->s) |
2781 | { | 2781 | { |
2782 | haspopped = true; | 2782 | haspopped = true; |
2783 | start = ss->pos; | 2783 | start = ss->pos; |
2784 | // reader->locate(start); | 2784 | // reader->locate(start); |
2785 | searchStack->pop(); | 2785 | searchStack->pop(); |
2786 | delete ss; | 2786 | delete ss; |
2787 | } | 2787 | } |
2788 | if (haspopped) reader->locate(start); | 2788 | if (haspopped) reader->locate(start); |
2789 | /* | 2789 | /* |
2790 | if (arg.length() < ss->len) | 2790 | if (arg.length() < ss->len) |
2791 | { | 2791 | { |
2792 | start = ss->pos; | 2792 | start = ss->pos; |
2793 | reader->locate(start); | 2793 | reader->locate(start); |
2794 | searchStack->pop(); | 2794 | searchStack->pop(); |
2795 | delete ss; | 2795 | delete ss; |
2796 | } | 2796 | } |
2797 | */ | 2797 | */ |
2798 | else | 2798 | else |
2799 | { | 2799 | { |
2800 | start = reader->pagelocate(); | 2800 | start = reader->pagelocate(); |
2801 | reader->jumpto(start); | 2801 | reader->jumpto(start); |
2802 | searchStack->push(new searchrecord(arg,start)); | 2802 | searchStack->push(new searchrecord(arg,start)); |
2803 | } | 2803 | } |
2804 | dosearch(start, test, arg); | 2804 | dosearch(start, test, arg); |
2805 | } | 2805 | } |
2806 | #else | 2806 | #else |
2807 | void QTReaderApp::search() | 2807 | void QTReaderApp::search() |
2808 | { | 2808 | { |
2809 | findNext(); | 2809 | findNext(); |
2810 | } | 2810 | } |
2811 | #endif | 2811 | #endif |
2812 | 2812 | ||
2813 | void QTReaderApp::openFile( const QString &f, unsigned int loc ) | 2813 | void QTReaderApp::openFile( const QString &f, unsigned int loc ) |
2814 | { | 2814 | { |
2815 | // qDebug("File:%s", (const char*)f); | 2815 | // qDebug("File:%s", (const char*)f); |
2816 | // openFile(DocLnk(f)); | 2816 | // openFile(DocLnk(f)); |
2817 | //} | 2817 | //} |
2818 | // | 2818 | // |
2819 | //void QTReaderApp::openFile( const DocLnk &f ) | 2819 | //void QTReaderApp::openFile( const DocLnk &f ) |
2820 | //{ | 2820 | //{ |
2821 | clear(); | 2821 | clear(); |
2822 | QFileInfo fm(f); | 2822 | QFileInfo fm(f); |
2823 | if ( fm.exists() ) | 2823 | if ( fm.exists() ) |
2824 | { | 2824 | { |
2825 | // QMessageBox::information(0, "Progress", "Calling fileNew()"); | 2825 | // QMessageBox::information(0, "Progress", "Calling fileNew()"); |
2826 | #ifdef USEQPE | 2826 | #ifdef USEQPE |
2827 | if (fm.extension( FALSE ) == "desktop") | 2827 | if (fm.extension( FALSE ) == "desktop") |
2828 | { | 2828 | { |
2829 | DocLnk d(f); | 2829 | DocLnk d(f); |
2830 | QFileInfo fnew(d.file()); | 2830 | QFileInfo fnew(d.file()); |
2831 | fm = fnew; | 2831 | fm = fnew; |
2832 | if (!fm.exists()) return; | 2832 | if (!fm.exists()) return; |
2833 | } | 2833 | } |
2834 | #endif | 2834 | #endif |
2835 | clear(); | 2835 | clear(); |
2836 | reader->setText(fm.baseName(), fm.absFilePath(), loc); | 2836 | reader->setText(fm.baseName(), fm.absFilePath(), loc); |
2837 | m_loadedconfig = readconfig(APPDIR "/configs", reader->m_string, false); | 2837 | m_loadedconfig = readconfig(APPDIR "/configs", reader->m_string, false); |
2838 | qDebug("Showing tools"); | 2838 | qDebug("Showing tools"); |
2839 | showEditTools(); | 2839 | showEditTools(); |
2840 | qDebug("Shown tools"); | 2840 | qDebug("Shown tools"); |
2841 | readbkmks(); | 2841 | readbkmks(); |
2842 | qDebug("read markss"); | 2842 | qDebug("read markss"); |
2843 | m_savedpos = 0xffffffff; | 2843 | m_savedpos = 0xffffffff; |
2844 | } | 2844 | } |
2845 | else | 2845 | else |
2846 | { | 2846 | { |
2847 | QString msg = f; | 2847 | QString msg = f; |
2848 | msg += "\nFile does not exist"; | 2848 | msg += "\nFile does not exist"; |
2849 | QMessageBox::information(this, PROGNAME, msg); | 2849 | QMessageBox::information(this, PROGNAME, msg); |
2850 | reader->m_lastfile = QString::null; | 2850 | reader->m_lastfile = QString::null; |
2851 | } | 2851 | } |
2852 | 2852 | ||
2853 | } | 2853 | } |
2854 | /* | 2854 | /* |
2855 | void QTReaderApp::resizeEvent(QResizeEvent* e) | 2855 | void QTReaderApp::resizeEvent(QResizeEvent* e) |
2856 | { | 2856 | { |
2857 | if (m_fullscreen) | 2857 | if (m_fullscreen) |
2858 | { | 2858 | { |
2859 | showNormal(); | 2859 | showNormal(); |
2860 | showFullScreen(); | 2860 | showFullScreen(); |
2861 | } | 2861 | } |
2862 | } | 2862 | } |
2863 | */ | 2863 | */ |
2864 | void QTReaderApp::handlekey(QKeyEvent* e) | 2864 | void QTReaderApp::handlekey(QKeyEvent* e) |
2865 | { | 2865 | { |
2866 | // qDebug("Keypress event"); | 2866 | // qDebug("Keypress event"); |
2867 | timeb now; | 2867 | timeb now; |
2868 | ftime(&now); | 2868 | ftime(&now); |
2869 | 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; |
2870 | if (etime < m_debounce) | 2870 | if (etime < m_debounce) |
2871 | { | 2871 | { |
2872 | return; | 2872 | return; |
2873 | } | 2873 | } |
2874 | switch(e->key()) | 2874 | switch(e->key()) |
2875 | { | 2875 | { |
2876 | case Key_Escape: | 2876 | case Key_Escape: |
2877 | qDebug("escape event"); | 2877 | qDebug("escape event"); |
2878 | if (m_disableesckey) | 2878 | if (m_disableesckey) |
2879 | { | 2879 | { |
2880 | m_disableesckey = false; | 2880 | m_disableesckey = false; |
2881 | } | 2881 | } |
2882 | else | 2882 | else |
2883 | { | 2883 | { |
2884 | m_bcloseDisabled = true; | 2884 | m_bcloseDisabled = true; |
2885 | if (m_fullscreen) | 2885 | if (m_fullscreen) |
2886 | { | 2886 | { |
2887 | m_actFullscreen->setOn(false); | 2887 | m_actFullscreen->setOn(false); |
2888 | e->accept(); | 2888 | e->accept(); |
2889 | } | 2889 | } |
2890 | else | 2890 | else |
2891 | { | 2891 | { |
2892 | // qDebug("escape action"); | 2892 | // qDebug("escape action"); |
2893 | doAction(e); | 2893 | doAction(e); |
2894 | } | 2894 | } |
2895 | } | 2895 | } |
2896 | break; | 2896 | break; |
2897 | /* | 2897 | /* |
2898 | case Key_Left: | 2898 | case Key_Left: |
2899 | { | 2899 | { |
2900 | if (reader->m_autoScroll) | 2900 | if (reader->m_autoScroll) |
2901 | { | 2901 | { |
2902 | reader->reduceScroll(); | 2902 | reader->reduceScroll(); |
2903 | } | 2903 | } |
2904 | else | 2904 | else |
2905 | { | 2905 | { |
2906 | doAction(e); | 2906 | doAction(e); |
2907 | } | 2907 | } |
2908 | } | 2908 | } |
2909 | break; | 2909 | break; |
2910 | case Key_Right: | 2910 | case Key_Right: |
2911 | { | 2911 | { |
2912 | if (reader->m_autoScroll) | 2912 | if (reader->m_autoScroll) |
2913 | { | 2913 | { |
2914 | reader->increaseScroll(); | 2914 | reader->increaseScroll(); |
2915 | } | 2915 | } |
2916 | else | 2916 | else |
2917 | { | 2917 | { |
2918 | doAction(e); | 2918 | doAction(e); |
2919 | } | 2919 | } |
2920 | } | 2920 | } |
2921 | break; | 2921 | break; |
2922 | case Key_Up: | 2922 | case Key_Up: |
2923 | { | 2923 | { |
2924 | if (reader->m_autoScroll) | 2924 | if (reader->m_autoScroll) |
2925 | { | 2925 | { |
2926 | reader->increaseScroll(); | 2926 | reader->increaseScroll(); |
2927 | } | 2927 | } |
2928 | else | 2928 | else |
2929 | { | 2929 | { |
2930 | doAction(e); | 2930 | doAction(e); |
2931 | } | 2931 | } |
2932 | } | 2932 | } |
2933 | break; | 2933 | break; |
2934 | case Key_Down: | 2934 | case Key_Down: |
2935 | { | 2935 | { |
2936 | if (reader->m_autoScroll) | 2936 | if (reader->m_autoScroll) |
2937 | { | 2937 | { |
2938 | reader->reduceScroll(); | 2938 | reader->reduceScroll(); |
2939 | } | 2939 | } |
2940 | else | 2940 | else |
2941 | { | 2941 | { |
2942 | doAction(e); | 2942 | doAction(e); |
2943 | } | 2943 | } |
2944 | } | 2944 | } |
2945 | break; | 2945 | break; |
2946 | */ | 2946 | */ |
2947 | default: | 2947 | default: |
2948 | { | 2948 | { |
2949 | doAction(e); | 2949 | doAction(e); |
2950 | } | 2950 | } |
2951 | 2951 | ||
2952 | /* | 2952 | /* |
2953 | QString msg("Key press was:"); | 2953 | QString msg("Key press was:"); |
2954 | QString key; | 2954 | QString key; |
2955 | msg += key.setNum(e->key()); | 2955 | msg += key.setNum(e->key()); |
2956 | QMessageBox::information(this, PROGNAME, msg); | 2956 | QMessageBox::information(this, PROGNAME, msg); |
2957 | */ | 2957 | */ |
2958 | } | 2958 | } |
2959 | ftime(&m_lastkeytime); | 2959 | ftime(&m_lastkeytime); |
2960 | } | 2960 | } |
2961 | 2961 | ||
2962 | #if defined(USEQPE) && defined(USENEWFULLSCREEN) | 2962 | #if defined(USEQPE) && defined(USENEWFULLSCREEN) |
2963 | void QTReaderApp::focusInEvent(QFocusEvent *) | 2963 | void QTReaderApp::focusInEvent(QFocusEvent *) |
2964 | { | 2964 | { |
2965 | if (m_usenewfullscreen && m_fullscreen && (editorStack->visibleWidget() == reader)) | 2965 | if (m_usenewfullscreen && m_fullscreen && (editorStack->visibleWidget() == reader)) |
2966 | { | 2966 | { |
2967 | m_usenewfullscreen = false; | 2967 | m_usenewfullscreen = false; |
2968 | reader->bDoUpdates = false; | 2968 | reader->bDoUpdates = false; |
2969 | showEditTools(); | 2969 | showEditTools(); |
2970 | reader->bDoUpdates = true; | 2970 | reader->bDoUpdates = true; |
2971 | reader->update(); | 2971 | reader->update(); |
2972 | m_usenewfullscreen = true; | 2972 | m_usenewfullscreen = true; |
2973 | } | 2973 | } |
2974 | } | 2974 | } |
2975 | 2975 | ||
2976 | void QTReaderApp::resizeEvent(QResizeEvent *) | 2976 | void QTReaderApp::resizeEvent(QResizeEvent *) |
2977 | { | 2977 | { |
2978 | if (m_usenewfullscreen && m_fullscreen && (editorStack->visibleWidget() == reader)) | 2978 | if (m_usenewfullscreen && m_fullscreen && (editorStack->visibleWidget() == reader)) |
2979 | { | 2979 | { |
2980 | m_usenewfullscreen = false; | 2980 | m_usenewfullscreen = false; |
2981 | reader->bDoUpdates = false; | 2981 | reader->bDoUpdates = false; |
2982 | showEditTools(); | 2982 | showEditTools(); |
2983 | reader->bDoUpdates = true; | 2983 | reader->bDoUpdates = true; |
2984 | reader->update(); | 2984 | reader->update(); |
2985 | m_usenewfullscreen = true; | 2985 | m_usenewfullscreen = true; |
2986 | } | 2986 | } |
2987 | } | 2987 | } |
2988 | #endif | 2988 | #endif |
2989 | 2989 | ||
2990 | void QTReaderApp::showEditTools() | 2990 | void QTReaderApp::showEditTools() |
2991 | { | 2991 | { |
2992 | // if ( !doc ) | 2992 | // if ( !doc ) |
2993 | //close(); | 2993 | //close(); |
2994 | if (m_fullscreen) | 2994 | if (m_fullscreen) |
2995 | { | 2995 | { |
2996 | #if defined(USEQPE) | 2996 | #if defined(USEQPE) |
2997 | if (menubar != NULL) menubar->hide(); | 2997 | if (menubar != NULL) menubar->hide(); |
2998 | #endif | 2998 | #endif |
2999 | if (fileBar != NULL) fileBar->hide(); | 2999 | if (fileBar != NULL) fileBar->hide(); |
3000 | if (viewBar != NULL) viewBar->hide(); | 3000 | if (viewBar != NULL) viewBar->hide(); |
3001 | if (navBar != NULL) navBar->hide(); | 3001 | if (navBar != NULL) navBar->hide(); |
3002 | if (markBar != NULL) markBar->hide(); | 3002 | if (markBar != NULL) markBar->hide(); |
3003 | if (m_prog != NULL) | 3003 | if (m_prog != NULL) |
3004 | { | 3004 | { |
3005 | // qDebug("Hiding status"); | 3005 | // qDebug("Hiding status"); |
3006 | m_prog->hide(); | 3006 | m_prog->hide(); |
3007 | } | 3007 | } |
3008 | searchBar->hide(); | 3008 | searchBar->hide(); |
3009 | regBar->hide(); | 3009 | regBar->hide(); |
3010 | #ifdef USEQPE | 3010 | #ifdef USEQPE |
3011 | Global::hideInputMethod(); | 3011 | Global::hideInputMethod(); |
3012 | #endif | 3012 | #endif |
3013 | if (m_scrollbar != NULL) m_scrollbar->hide(); | 3013 | if (m_scrollbar != NULL) m_scrollbar->hide(); |
3014 | m_fontBar->hide(); | 3014 | m_fontBar->hide(); |
3015 | //showNormal(); | 3015 | //showNormal(); |
3016 | showFullScreen(); | 3016 | showFullScreen(); |
3017 | } | 3017 | } |
3018 | else | 3018 | else |
3019 | { | 3019 | { |
3020 | //qDebug("him"); | 3020 | //qDebug("him"); |
3021 | #ifdef USEQPE | 3021 | #ifdef USEQPE |
3022 | Global::hideInputMethod(); | 3022 | Global::hideInputMethod(); |
3023 | #endif | 3023 | #endif |
3024 | //qDebug("eb"); | 3024 | //qDebug("eb"); |
3025 | if (m_scrollbar != NULL) | 3025 | if (m_scrollbar != NULL) |
3026 | { | 3026 | { |
3027 | if (m_scrollishidden) | 3027 | if (m_scrollishidden) |
3028 | { | 3028 | { |
3029 | m_scrollbar->hide(); | 3029 | m_scrollbar->hide(); |
3030 | } | 3030 | } |
3031 | else | 3031 | else |
3032 | { | 3032 | { |
3033 | m_scrollbar->show(); | 3033 | m_scrollbar->show(); |
3034 | } | 3034 | } |
3035 | } | 3035 | } |
3036 | if (!m_hidebars) | 3036 | if (!m_hidebars) |
3037 | { | 3037 | { |
3038 | #if defined(USEQPE) | 3038 | #if defined(USEQPE) |
3039 | menubar->show(); | 3039 | menubar->show(); |
3040 | #endif | 3040 | #endif |
3041 | if (fileBar != NULL) fileBar->show(); | 3041 | if (fileBar != NULL) fileBar->show(); |
3042 | if (viewBar != NULL) viewBar->show(); | 3042 | if (viewBar != NULL) viewBar->show(); |
3043 | if (navBar != NULL) navBar->show(); | 3043 | if (navBar != NULL) navBar->show(); |
3044 | if (markBar != NULL) markBar->show(); | 3044 | if (markBar != NULL) markBar->show(); |
3045 | if (m_prog != NULL && !m_statusishidden) | 3045 | if (m_prog != NULL && !m_statusishidden) |
3046 | { | 3046 | { |
3047 | // qDebug("Showing status"); | 3047 | // qDebug("Showing status"); |
3048 | m_prog->show(); | 3048 | m_prog->show(); |
3049 | // qDebug("Shown status"); | 3049 | // qDebug("Shown status"); |
3050 | } | 3050 | } |
3051 | // qDebug("Showing mb"); | 3051 | // qDebug("Showing mb"); |
3052 | mb->show(); | 3052 | mb->show(); |
3053 | } | 3053 | } |
3054 | if ( searchVisible ) | 3054 | if ( searchVisible ) |
3055 | { | 3055 | { |
3056 | #ifdef USEQPE | 3056 | #ifdef USEQPE |
3057 | Global::showInputMethod(); | 3057 | Global::showInputMethod(); |
3058 | #endif | 3058 | #endif |
3059 | searchBar->show(); | 3059 | searchBar->show(); |
3060 | } | 3060 | } |
3061 | if ( regVisible ) | 3061 | if ( regVisible ) |
3062 | { | 3062 | { |
3063 | #ifdef USEQPE | 3063 | #ifdef USEQPE |
3064 | Global::showInputMethod(); | 3064 | Global::showInputMethod(); |
3065 | #endif | 3065 | #endif |
3066 | regBar->show(); | 3066 | regBar->show(); |
3067 | } | 3067 | } |
3068 | if (m_fontVisible) m_fontBar->show(); | 3068 | if (m_fontVisible) m_fontBar->show(); |
3069 | //qDebug("sn"); | 3069 | //qDebug("sn"); |
3070 | showNormal(); | 3070 | showNormal(); |
3071 | //qDebug("sm"); | 3071 | //qDebug("sm"); |
3072 | #if defined(USEQPE) && !defined(SIMPAD) | 3072 | #if defined(USEQPE) && !defined(SIMPAD) |
3073 | showMaximized(); | 3073 | showMaximized(); |
3074 | #endif | 3074 | #endif |
3075 | //setCentralWidget(reader); | 3075 | //setCentralWidget(reader); |
3076 | } | 3076 | } |
3077 | 3077 | ||
3078 | // qDebug("uc"); | 3078 | // qDebug("uc"); |
3079 | updateCaption(); | 3079 | updateCaption(); |
3080 | // qDebug("rw"); | 3080 | // qDebug("rw"); |
3081 | editorStack->raiseWidget( reader ); | 3081 | editorStack->raiseWidget( reader ); |
3082 | // qDebug("sf"); | 3082 | // qDebug("sf"); |
3083 | reader->setFocus(); | 3083 | reader->setFocus(); |
3084 | // qDebug("ref"); | 3084 | // qDebug("ref"); |
3085 | //reader->refresh(true); | 3085 | //reader->refresh(true); |
3086 | // qDebug("done"); | 3086 | // qDebug("done"); |
3087 | } | 3087 | } |
3088 | /* | 3088 | /* |
3089 | void QTReaderApp::save() | 3089 | void QTReaderApp::save() |
3090 | { | 3090 | { |
3091 | if ( !doc ) | 3091 | if ( !doc ) |
3092 | return; | 3092 | return; |
3093 | if ( !editor->edited() ) | 3093 | if ( !editor->edited() ) |
3094 | return; | 3094 | return; |
3095 | 3095 | ||
3096 | QString rt = editor->text(); | 3096 | QString rt = editor->text(); |
3097 | QString pt = rt; | 3097 | QString pt = rt; |
3098 | 3098 | ||
3099 | if ( doc->name().isEmpty() ) { | 3099 | if ( doc->name().isEmpty() ) { |
3100 | unsigned ispace = pt.find( ' ' ); | 3100 | unsigned ispace = pt.find( ' ' ); |
3101 | unsigned ienter = pt.find( '\n' ); | 3101 | unsigned ienter = pt.find( '\n' ); |
3102 | int i = (ispace < ienter) ? ispace : ienter; | 3102 | int i = (ispace < ienter) ? ispace : ienter; |
3103 | QString docname; | 3103 | QString docname; |
3104 | if ( i == -1 ) { | 3104 | if ( i == -1 ) { |
3105 | if ( pt.isEmpty() ) | 3105 | if ( pt.isEmpty() ) |
3106 | docname = "Empty Text"; | 3106 | docname = "Empty Text"; |
3107 | else | 3107 | else |
3108 | docname = pt; | 3108 | docname = pt; |
3109 | } else { | 3109 | } else { |
3110 | docname = pt.left( i ); | 3110 | docname = pt.left( i ); |
3111 | } | 3111 | } |
3112 | doc->setName(docname); | 3112 | doc->setName(docname); |
3113 | } | 3113 | } |
3114 | FileManager fm; | 3114 | FileManager fm; |
3115 | fm.saveFile( *doc, rt ); | 3115 | fm.saveFile( *doc, rt ); |
3116 | } | 3116 | } |
3117 | */ | 3117 | */ |
3118 | 3118 | ||
3119 | void QTReaderApp::clear() | 3119 | void QTReaderApp::clear() |
3120 | { | 3120 | { |
3121 | // if (doc != 0) | 3121 | // if (doc != 0) |
3122 | // { | 3122 | // { |
3123 | // QMessageBox::information(this, PROGNAME, "Deleting doc", 1); | 3123 | // QMessageBox::information(this, PROGNAME, "Deleting doc", 1); |
3124 | //delete doc; | 3124 | //delete doc; |
3125 | // QMessageBox::information(this, PROGNAME, "Deleted doc", 1); | 3125 | // QMessageBox::information(this, PROGNAME, "Deleted doc", 1); |
3126 | //doc = 0; | 3126 | //doc = 0; |
3127 | // } | 3127 | // } |
3128 | reader->clear(); | 3128 | reader->clear(); |
3129 | } | 3129 | } |
3130 | 3130 | ||
3131 | void QTReaderApp::updateCaption() | 3131 | void QTReaderApp::updateCaption() |
3132 | { | 3132 | { |
3133 | // if ( !doc ) | 3133 | // if ( !doc ) |
3134 | //setCaption( tr("QTReader") ); | 3134 | //setCaption( tr("QTReader") ); |
3135 | // else { | 3135 | // else { |
3136 | //QString s = doc->name(); | 3136 | //QString s = doc->name(); |
3137 | //if ( s.isEmpty() ) | 3137 | //if ( s.isEmpty() ) |
3138 | // s = tr( "Unnamed" ); | 3138 | // s = tr( "Unnamed" ); |
3139 | setCaption( reader->m_string + " - " + tr(SHORTPROGNAME) ); | 3139 | setCaption( reader->m_string + " - " + tr(SHORTPROGNAME) ); |
3140 | // } | 3140 | // } |
3141 | } | 3141 | } |
3142 | 3142 | ||
3143 | void QTReaderApp::setDocument(const QString& fileref) | 3143 | void QTReaderApp::setDocument(const QString& fileref) |
3144 | { | 3144 | { |
3145 | //QMessageBox::information(0, "setDocument", fileref); | 3145 | //QMessageBox::information(0, "setDocument", fileref); |
3146 | openFile(fileref); | 3146 | openFile(fileref); |
3147 | // showEditTools(); | 3147 | // showEditTools(); |
3148 | } | 3148 | } |
3149 | 3149 | ||
3150 | void QTReaderApp::closeEvent( QCloseEvent *e ) | 3150 | void QTReaderApp::closeEvent( QCloseEvent *e ) |
3151 | { | 3151 | { |
3152 | // qDebug("Close event"); | 3152 | // qDebug("Close event"); |
3153 | if (m_fullscreen) | 3153 | if (m_fullscreen) |
3154 | { | 3154 | { |
3155 | m_fullscreen = false; | 3155 | m_fullscreen = false; |
3156 | showEditTools(); | 3156 | showEditTools(); |
3157 | e->ignore(); | 3157 | e->ignore(); |
3158 | } | 3158 | } |
3159 | else if (editorStack->visibleWidget() == m_buttonprefs) | 3159 | else if (editorStack->visibleWidget() == m_buttonprefs) |
3160 | { | 3160 | { |
3161 | int ret = QMessageBox::warning(this, PROGNAME, | 3161 | int ret = QMessageBox::warning(this, PROGNAME, |
3162 | tr("Do you wish to map this key?\n\nIf you proceed you will map\nthe escape key and you will\nneed to press the close box\ntwice to exit this program\n\nContinue?"), tr("Yes"), tr("No"), QString::null, 0, 1); | 3162 | tr("Do you wish to map this key?\n\nIf you proceed you will map\nthe escape key and you will\nneed to press the close box\ntwice to exit this program\n\nContinue?"), tr("Yes"), tr("No"), QString::null, 0, 1); |
3163 | if (ret == 0) | 3163 | if (ret == 0) |
3164 | { | 3164 | { |
3165 | m_buttonprefs->mapkey(Qt::NoButton, Key_Escape); | 3165 | m_buttonprefs->mapkey(Qt::NoButton, Key_Escape); |
3166 | } | 3166 | } |
3167 | e->ignore(); | 3167 | e->ignore(); |
3168 | } | 3168 | } |
3169 | else if (m_dontSave) | 3169 | else if (m_dontSave) |
3170 | { | 3170 | { |
3171 | e->accept(); | 3171 | e->accept(); |
3172 | } | 3172 | } |
3173 | else | 3173 | else |
3174 | { | 3174 | { |
3175 | if (editorStack->visibleWidget() == reader) | 3175 | if (editorStack->visibleWidget() == reader) |
3176 | { | 3176 | { |
3177 | if ((kmap.find(orKey(Qt::NoButton,Key_Escape,false)) != kmap.end()) && m_bcloseDisabled) | 3177 | if ((kmap.find(orKey(Qt::NoButton,Key_Escape,false)) != kmap.end()) && m_bcloseDisabled) |
3178 | { | 3178 | { |
3179 | //qDebug("Close disabled"); | 3179 | //qDebug("Close disabled"); |
3180 | m_bcloseDisabled = false; | 3180 | m_bcloseDisabled = false; |
3181 | e->ignore(); | 3181 | e->ignore(); |
3182 | } | 3182 | } |
3183 | else | 3183 | else |
3184 | { | 3184 | { |
3185 | if (m_fontVisible) | 3185 | if (m_fontVisible) |
3186 | { | 3186 | { |
3187 | m_fontBar->hide(); | 3187 | m_fontBar->hide(); |
3188 | m_fontVisible = false; | 3188 | m_fontVisible = false; |
3189 | e->ignore(); | 3189 | e->ignore(); |
3190 | return; | 3190 | return; |
3191 | } | 3191 | } |
3192 | if (regVisible) | 3192 | if (regVisible) |
3193 | { | 3193 | { |
3194 | regBar->hide(); | 3194 | regBar->hide(); |
3195 | #ifdef USEQPE | 3195 | #ifdef USEQPE |
3196 | Global::hideInputMethod(); | 3196 | Global::hideInputMethod(); |
3197 | #endif | 3197 | #endif |
3198 | regVisible = false; | 3198 | regVisible = false; |
3199 | e->ignore(); | 3199 | e->ignore(); |
3200 | return; | 3200 | return; |
3201 | } | 3201 | } |
3202 | if (searchVisible) | 3202 | if (searchVisible) |
3203 | { | 3203 | { |
3204 | searchBar->hide(); | 3204 | searchBar->hide(); |
3205 | #ifdef USEQPE | 3205 | #ifdef USEQPE |
3206 | Global::hideInputMethod(); | 3206 | Global::hideInputMethod(); |
3207 | #endif | 3207 | #endif |
3208 | searchVisible = false; | 3208 | searchVisible = false; |
3209 | e->ignore(); | 3209 | e->ignore(); |
3210 | return; | 3210 | return; |
3211 | } | 3211 | } |
3212 | if (m_fBkmksChanged && pBkmklist != NULL) | 3212 | if (m_fBkmksChanged && pBkmklist != NULL) |
3213 | { | 3213 | { |
3214 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) | 3214 | if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) |
3215 | savebkmks(); | 3215 | savebkmks(); |
3216 | delete pBkmklist; | 3216 | delete pBkmklist; |
3217 | reader->pBkmklist = pBkmklist = NULL; | 3217 | reader->pBkmklist = pBkmklist = NULL; |
3218 | m_fBkmksChanged = false; | 3218 | m_fBkmksChanged = false; |
3219 | } | 3219 | } |
3220 | updatefileinfo(); | 3220 | updatefileinfo(); |
3221 | saveprefs(); | 3221 | saveprefs(); |
3222 | e->accept(); | 3222 | e->accept(); |
3223 | } | 3223 | } |
3224 | } | 3224 | } |
3225 | else | 3225 | else |
3226 | { | 3226 | { |
3227 | showEditTools(); | 3227 | showEditTools(); |
3228 | m_disableesckey = true; | 3228 | m_disableesckey = true; |
3229 | } | 3229 | } |
3230 | } | 3230 | } |
3231 | } | 3231 | } |
3232 | 3232 | ||
3233 | void QTReaderApp::do_gotomark() | 3233 | void QTReaderApp::do_gotomark() |
3234 | { | 3234 | { |
3235 | m_nBkmkAction = cGotoBkmk; | 3235 | m_nBkmkAction = cGotoBkmk; |
3236 | if (!listbkmk(pBkmklist)) | 3236 | if (!listbkmk(pBkmklist)) |
3237 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); | 3237 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); |
3238 | } | 3238 | } |
3239 | 3239 | ||
3240 | void QTReaderApp::do_delmark() | 3240 | void QTReaderApp::do_delmark() |
3241 | { | 3241 | { |
3242 | m_nBkmkAction = cDelBkmk; | 3242 | m_nBkmkAction = cDelBkmk; |
3243 | if (!listbkmk(pBkmklist)) | 3243 | if (!listbkmk(pBkmklist)) |
3244 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); | 3244 | QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); |
3245 | } | 3245 | } |
3246 | 3246 | ||
3247 | bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab, bool presel) | 3247 | bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab, bool presel) |
3248 | { | 3248 | { |
3249 | bkmkselector->clear(); | 3249 | bkmkselector->clear(); |
3250 | if (_lab.isEmpty()) | 3250 | if (_lab.isEmpty()) |
3251 | bkmkselector->setText("Cancel"); | 3251 | bkmkselector->setText("Cancel"); |
3252 | else | 3252 | else |
3253 | bkmkselector->setText(_lab); | 3253 | bkmkselector->setText(_lab); |
3254 | int cnt = 0; | 3254 | int cnt = 0; |
3255 | int slt = -1; | 3255 | int slt = -1; |
3256 | if (plist != NULL) | 3256 | if (plist != NULL) |
3257 | { | 3257 | { |
3258 | for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) | 3258 | for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) |
3259 | { | 3259 | { |
3260 | if (presel) | 3260 | if (presel) |
3261 | { | 3261 | { |
3262 | Bkmk* p = i.pContent(); | 3262 | Bkmk* p = i.pContent(); |
3263 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) | 3263 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) |
3264 | { | 3264 | { |
3265 | slt = cnt; | 3265 | slt = cnt; |
3266 | } | 3266 | } |
3267 | } | 3267 | } |
3268 | #ifdef _UNICODE | 3268 | #ifdef _UNICODE |
3269 | // qDebug("Item:%s", (const char*)toQString(i->name())); | 3269 | // qDebug("Item:%s", (const char*)toQString(i->name())); |
3270 | bkmkselector->insertItem(toQString(i->name()), cnt++); | 3270 | bkmkselector->insertItem(toQString(i->name()), cnt++); |
3271 | #else | 3271 | #else |
3272 | bkmkselector->insertItem(i->name(), cnt++); | 3272 | bkmkselector->insertItem(i->name(), cnt++); |
3273 | #endif | 3273 | #endif |
3274 | 3274 | ||
3275 | } | 3275 | } |
3276 | } | 3276 | } |
3277 | if (cnt > 0) | 3277 | if (cnt > 0) |
3278 | { | 3278 | { |
3279 | hidetoolbars(); | 3279 | hidetoolbars(); |
3280 | editorStack->raiseWidget( bkmkselector ); | 3280 | editorStack->raiseWidget( bkmkselector ); |
3281 | if (slt != -1) bkmkselector->setCurrentItem(slt); | 3281 | if (slt != -1) bkmkselector->setCurrentItem(slt); |
3282 | return true; | 3282 | return true; |
3283 | } | 3283 | } |
3284 | else | 3284 | else |
3285 | return false; | 3285 | return false; |
3286 | } | 3286 | } |
3287 | 3287 | ||
3288 | void QTReaderApp::do_autogen() | 3288 | void QTReaderApp::do_autogen() |
3289 | { | 3289 | { |
3290 | m_nRegAction = cAutoGen; | 3290 | m_nRegAction = cAutoGen; |
3291 | regEdit->setText(m_autogenstr); | 3291 | regEdit->setText(m_autogenstr); |
3292 | do_regedit(); | 3292 | do_regedit(); |
3293 | } | 3293 | } |
3294 | 3294 | ||
3295 | void QTReaderApp::do_regedit() | 3295 | void QTReaderApp::do_regedit() |
3296 | { | 3296 | { |
3297 | // fileBar->hide(); | 3297 | // fileBar->hide(); |
3298 | reader->bDoUpdates = false; | 3298 | reader->bDoUpdates = false; |
3299 | // qDebug("Showing regbar"); | 3299 | // qDebug("Showing regbar"); |
3300 | regBar->show(); | 3300 | regBar->show(); |
3301 | // qDebug("Showing kbd"); | 3301 | // qDebug("Showing kbd"); |
3302 | #ifdef USEQPE | 3302 | #ifdef USEQPE |
3303 | Global::showInputMethod(); | 3303 | Global::showInputMethod(); |
3304 | #endif | 3304 | #endif |
3305 | regVisible = true; | 3305 | regVisible = true; |
3306 | regEdit->setFocus(); | 3306 | regEdit->setFocus(); |
3307 | // qApp->processEvents(); | 3307 | // qApp->processEvents(); |
3308 | reader->bDoUpdates = true; | 3308 | reader->bDoUpdates = true; |
3309 | reader->update(); | 3309 | reader->update(); |
3310 | } | 3310 | } |
3311 | 3311 | ||
3312 | bool QTReaderApp::openfrombkmk(Bkmk* bk) | 3312 | bool QTReaderApp::openfrombkmk(Bkmk* bk) |
3313 | { | 3313 | { |
3314 | QString fn = toQString( | 3314 | QString fn = toQString( |
3315 | CFiledata(bk->anno()).name() | 3315 | CFiledata(bk->anno()).name() |
3316 | ); | 3316 | ); |
3317 | //qDebug("fileinfo"); | 3317 | //qDebug("fileinfo"); |
3318 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) | 3318 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) |
3319 | { | 3319 | { |
3320 | //qDebug("Opening"); | 3320 | //qDebug("Opening"); |
3321 | struct stat fnstat; | 3321 | struct stat fnstat; |
3322 | stat((const char *)fn, &fnstat); | 3322 | stat((const char *)fn, &fnstat); |
3323 | 3323 | ||
3324 | if (CFiledata(bk->anno()).date() | 3324 | if (CFiledata(bk->anno()).date() |
3325 | != fnstat.st_mtime) | 3325 | != fnstat.st_mtime) |
3326 | { | 3326 | { |
3327 | CFiledata fd(bk->anno()); | 3327 | CFiledata fd(bk->anno()); |
3328 | fd.setdate(fnstat.st_mtime); | 3328 | fd.setdate(fnstat.st_mtime); |
3329 | bk->value(0); | 3329 | bk->value(0); |
3330 | reader->m_lastposn = 0; | 3330 | reader->m_lastposn = 0; |
3331 | openFile(fn); | 3331 | openFile(fn); |
3332 | } | 3332 | } |
3333 | else | 3333 | else |
3334 | { | 3334 | { |
3335 | unsigned short svlen = bk->filedatalen(); | 3335 | unsigned short svlen = bk->filedatalen(); |
3336 | unsigned char* svdata = bk->filedata(); | 3336 | unsigned char* svdata = bk->filedata(); |
3337 | openFile(fn, bk->value()); | 3337 | openFile(fn, bk->value()); |
3338 | reader->putSaveData(svdata, svlen); | 3338 | reader->putSaveData(svdata, svlen); |
3339 | // setstate(svdata, svlen); | 3339 | // setstate(svdata, svlen); |
3340 | if (svlen != 0) | 3340 | if (svlen != 0) |
3341 | { | 3341 | { |
3342 | QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?"); | 3342 | QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?"); |
3343 | } | 3343 | } |
3344 | // qDebug("updating"); | 3344 | // qDebug("updating"); |
3345 | // showEditTools(); | 3345 | // showEditTools(); |
3346 | } | 3346 | } |
3347 | return true; | 3347 | return true; |
3348 | } | 3348 | } |
3349 | else | 3349 | else |
3350 | { | 3350 | { |
3351 | return false; | 3351 | return false; |
3352 | } | 3352 | } |
3353 | } | 3353 | } |
3354 | 3354 | ||
3355 | void QTReaderApp::gotobkmk(int ind) | 3355 | void QTReaderApp::gotobkmk(int ind) |
3356 | { | 3356 | { |
3357 | qDebug("gbkmk"); | 3357 | qDebug("gbkmk"); |
3358 | showEditTools(); | 3358 | showEditTools(); |
3359 | switch (m_nBkmkAction) | 3359 | switch (m_nBkmkAction) |
3360 | { | 3360 | { |
3361 | case cOpenFile: | 3361 | case cOpenFile: |
3362 | { | 3362 | { |
3363 | // qApp->processEvents(); | 3363 | // qApp->processEvents(); |
3364 | if (!openfrombkmk((*pOpenlist)[ind])) | 3364 | if (!openfrombkmk((*pOpenlist)[ind])) |
3365 | { | 3365 | { |
3366 | pOpenlist->erase(ind); | 3366 | pOpenlist->erase(ind); |
3367 | QMessageBox::information(this, PROGNAME, "Can't find file"); | 3367 | QMessageBox::information(this, PROGNAME, "Can't find file"); |
3368 | } | 3368 | } |
3369 | } | 3369 | } |
3370 | break; | 3370 | break; |
3371 | case cGotoBkmk: | 3371 | case cGotoBkmk: |
3372 | reader->buffdoc.saveposn(reader->m_lastfile, reader->pagelocate()); | 3372 | reader->buffdoc.saveposn(reader->m_lastfile, reader->pagelocate()); |
3373 | reader->locate((*pBkmklist)[ind]->value()); | 3373 | reader->locate((*pBkmklist)[ind]->value()); |
3374 | break; | 3374 | break; |
3375 | case cDelBkmk: | 3375 | case cDelBkmk: |
3376 | //// qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name()); | 3376 | //// qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name()); |
3377 | pBkmklist->erase(ind); | 3377 | pBkmklist->erase(ind); |
3378 | m_fBkmksChanged = true; | 3378 | m_fBkmksChanged = true; |
3379 | reader->refresh(true); | 3379 | reader->refresh(true); |
3380 | // pBkmklist->sort(); | 3380 | // pBkmklist->sort(); |
3381 | break; | 3381 | break; |
3382 | case cRmBkmkFile: | 3382 | case cRmBkmkFile: |
3383 | { | 3383 | { |
3384 | #ifndef USEQPE | 3384 | #ifndef USEQPE |
3385 | QDir d = QDir::home(); // "/" | 3385 | QDir d = QDir::home(); // "/" |
3386 | d.cd(APPDIR); | 3386 | d.cd(APPDIR); |
3387 | d.remove(bkmkselector->text(ind)); | 3387 | d.remove(bkmkselector->text(ind)); |
3388 | #else /* USEQPE */ | 3388 | #else /* USEQPE */ |
3389 | unlink((const char *)Global::applicationFileName(APPDIR,bkmkselector->text(ind))); | 3389 | unlink((const char *)Global::applicationFileName(APPDIR,bkmkselector->text(ind))); |
3390 | #endif /* USEQPE */ | 3390 | #endif /* USEQPE */ |
3391 | } | 3391 | } |
3392 | break; | 3392 | break; |
3393 | case cLdConfig: | 3393 | case cLdConfig: |
3394 | readconfig(APPDIR "/configs", bkmkselector->text(ind), false); | 3394 | readconfig(APPDIR "/configs", bkmkselector->text(ind), false); |
3395 | break; | 3395 | break; |
3396 | case cLdTheme: | 3396 | case cLdTheme: |
3397 | m_themename = bkmkselector->text(ind); | 3397 | m_themename = bkmkselector->text(ind); |
3398 | readconfig(QString(APPDIR "/Themes/")+m_themename , "config", false); | 3398 | readconfig(QString(APPDIR "/Themes/")+m_themename , "config", false); |
3399 | setBackgroundBitmap(); | 3399 | setBackgroundBitmap(); |
3400 | break; | 3400 | break; |
3401 | case cRmConfig: | 3401 | case cRmConfig: |
3402 | { | 3402 | { |
3403 | #ifndef USEQPE | 3403 | #ifndef USEQPE |
3404 | QDir d = QDir::home(); // "/" | 3404 | QDir d = QDir::home(); // "/" |
3405 | d.cd(APPDIR "/configs"); | 3405 | d.cd(APPDIR "/configs"); |
3406 | d.remove(bkmkselector->text(ind)); | 3406 | d.remove(bkmkselector->text(ind)); |
3407 | #else /* USEQPE */ | 3407 | #else /* USEQPE */ |
3408 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",bkmkselector->text(ind))); | 3408 | unlink((const char *)Global::applicationFileName(APPDIR "/configs",bkmkselector->text(ind))); |
3409 | #endif /* USEQPE */ | 3409 | #endif /* USEQPE */ |
3410 | } | 3410 | } |
3411 | break; | 3411 | break; |
3412 | case cExportLinks: | 3412 | case cExportLinks: |
3413 | { | 3413 | { |
3414 | #ifndef USEQPE | 3414 | #ifndef USEQPE |
3415 | QDir d = QDir::home(); // "/" | 3415 | QDir d = QDir::home(); // "/" |
3416 | d.cd(APPDIR "/urls"); | 3416 | d.cd(APPDIR "/urls"); |
3417 | QFileInfo fi(d, bkmkselector->text(ind)); | 3417 | QFileInfo fi(d, bkmkselector->text(ind)); |
3418 | if (fi.exists()) | 3418 | if (fi.exists()) |
3419 | { | 3419 | { |
3420 | QString outfile( QFileDialog::getSaveFileName( QString::null, QString::null, this ) ); | 3420 | QString outfile( QFileDialog::getSaveFileName( QString::null, QString::null, this ) ); |
3421 | if (!outfile.isEmpty()) | 3421 | if (!outfile.isEmpty()) |
3422 | { | 3422 | { |
3423 | FILE* fout = fopen((const char *)outfile, "w"); | 3423 | FILE* fout = fopen((const char *)outfile, "w"); |
3424 | if (fout != NULL) | 3424 | if (fout != NULL) |
3425 | { | 3425 | { |
3426 | FILE* fin = fopen((const char *)fi.absFilePath(), "r"); | 3426 | FILE* fin = fopen((const char *)fi.absFilePath(), "r"); |
3427 | if (fin != NULL) | 3427 | if (fin != NULL) |
3428 | { | 3428 | { |
3429 | fprintf(fout, "<html><body>\n"); | 3429 | fprintf(fout, "<html><body>\n"); |
3430 | int ch = 0; | 3430 | int ch = 0; |
3431 | while ((ch = fgetc(fin)) != EOF) | 3431 | while ((ch = fgetc(fin)) != EOF) |
3432 | { | 3432 | { |
3433 | fputc(ch, fout); | 3433 | fputc(ch, fout); |
3434 | } | 3434 | } |
3435 | fclose(fin); | 3435 | fclose(fin); |
3436 | fprintf(fout, "</html></body>\n"); | 3436 | fprintf(fout, "</html></body>\n"); |
3437 | d.remove(bkmkselector->text(ind)); | 3437 | d.remove(bkmkselector->text(ind)); |
3438 | } | 3438 | } |
3439 | fclose(fout); | 3439 | fclose(fout); |
3440 | } | 3440 | } |
3441 | else | 3441 | else |
3442 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); | 3442 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); |
3443 | } | 3443 | } |
3444 | } | 3444 | } |
3445 | #else /* USEQPE */ | 3445 | #else /* USEQPE */ |
3446 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); | 3446 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); |
3447 | if (fin != NULL) | 3447 | if (fin != NULL) |
3448 | { | 3448 | { |
3449 | bool allok = false; | 3449 | bool allok = false; |
3450 | #if defined(OPIE) && defined(OPIEFILEDIALOG) | 3450 | #if defined(OPIE) && defined(OPIEFILEDIALOG) |
3451 | QString outfile = OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, QString::null, QString::null, MimeTypes(), 0, "OpieReader"); | 3451 | QString outfile = OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, QString::null, QString::null, MimeTypes(), 0, "OpieReader"); |
3452 | if (!outfile.isEmpty()) | 3452 | if (!outfile.isEmpty()) |
3453 | { | 3453 | { |
3454 | FILE* fout = fopen((const char *)outfile, "w"); | 3454 | FILE* fout = fopen((const char *)outfile, "w"); |
3455 | if (fout != NULL) | 3455 | if (fout != NULL) |
3456 | { | 3456 | { |
3457 | fprintf(fout, "<html><body>\n"); | 3457 | fprintf(fout, "<html><body>\n"); |
3458 | int ch = 0; | 3458 | int ch = 0; |
3459 | while ((ch = fgetc(fin)) != EOF) | 3459 | while ((ch = fgetc(fin)) != EOF) |
3460 | { | 3460 | { |
3461 | fputc(ch, fout); | 3461 | fputc(ch, fout); |
3462 | } | 3462 | } |
3463 | fprintf(fout, "</html></body>\n"); | 3463 | fprintf(fout, "</html></body>\n"); |
3464 | fclose(fout); | 3464 | fclose(fout); |
3465 | allok = true; | 3465 | allok = true; |
3466 | } | 3466 | } |
3467 | else | 3467 | else |
3468 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); | 3468 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); |
3469 | } | 3469 | } |
3470 | fclose(fin); | 3470 | fclose(fin); |
3471 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); | 3471 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); |
3472 | #else | 3472 | #else |
3473 | fileBrowser* fb = new fileBrowser(true, this,"OpieReader",!m_bFloatingDialog, 0, "*", QString::null); | 3473 | fileBrowser* fb = new fileBrowser(true, this,"OpieReader",!m_bFloatingDialog, 0, "*", QString::null); |
3474 | if (fb->exec()) | 3474 | if (fb->exec()) |
3475 | { | 3475 | { |
3476 | QString outfile = fb->getCurrentFile(); | 3476 | QString outfile = fb->getCurrentFile(); |
3477 | FILE* fout = fopen((const char *)outfile, "w"); | 3477 | FILE* fout = fopen((const char *)outfile, "w"); |
3478 | if (fout != NULL) | 3478 | if (fout != NULL) |
3479 | { | 3479 | { |
3480 | fprintf(fout, "<html><body>\n"); | 3480 | fprintf(fout, "<html><body>\n"); |
3481 | int ch = 0; | 3481 | int ch = 0; |
3482 | while ((ch = fgetc(fin)) != EOF) | 3482 | while ((ch = fgetc(fin)) != EOF) |
3483 | { | 3483 | { |
3484 | fputc(ch, fout); | 3484 | fputc(ch, fout); |
3485 | } | 3485 | } |
3486 | fprintf(fout, "</html></body>\n"); | 3486 | fprintf(fout, "</html></body>\n"); |
3487 | fclose(fout); | 3487 | fclose(fout); |
3488 | allok = true; | 3488 | allok = true; |
3489 | } | 3489 | } |
3490 | else | 3490 | else |
3491 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); | 3491 | QMessageBox::information(this, PROGNAME, "Couldn't open output"); |
3492 | } | 3492 | } |
3493 | delete fb; | 3493 | delete fb; |
3494 | fclose(fin); | 3494 | fclose(fin); |
3495 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); | 3495 | if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); |
3496 | #endif | 3496 | #endif |
3497 | } | 3497 | } |
3498 | else | 3498 | else |
3499 | { | 3499 | { |
3500 | QMessageBox::information(this, PROGNAME, "Couldn't open input"); | 3500 | QMessageBox::information(this, PROGNAME, "Couldn't open input"); |
3501 | } | 3501 | } |
3502 | 3502 | ||
3503 | /* | 3503 | /* |
3504 | CFileSelector *f = new CFileSelector("text/html", this, NULL, !m_bFloatingDialog, TRUE, TRUE ); | 3504 | CFileSelector *f = new CFileSelector("text/html", this, NULL, !m_bFloatingDialog, TRUE, TRUE ); |
3505 | int ret = f->exec(); | 3505 | int ret = f->exec(); |
3506 | qDebug("Return:%d", ret); | 3506 | qDebug("Return:%d", ret); |
3507 | DocLnk* doc = f->getDoc(); | 3507 | DocLnk* doc = f->getDoc(); |
3508 | if (doc != NULL) | 3508 | if (doc != NULL) |
3509 | { | 3509 | { |
3510 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); | 3510 | FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); |
3511 | QString rt; | 3511 | QString rt; |
3512 | rt = "<html><body>\n"; | 3512 | rt = "<html><body>\n"; |
3513 | int ch = 0; | 3513 | int ch = 0; |
3514 | while ((ch = fgetc(fin)) != EOF) | 3514 | while ((ch = fgetc(fin)) != EOF) |
3515 | { | 3515 | { |
3516 | rt += (char)ch; | 3516 | rt += (char)ch; |
3517 | } | 3517 | } |
3518 | fclose(fin); | 3518 | fclose(fin); |
3519 | rt += "</html></body>\n"; | 3519 | rt += "</html></body>\n"; |
3520 | if ( doc->name().isEmpty() ) | 3520 | if ( doc->name().isEmpty() ) |
3521 | { | 3521 | { |
3522 | doc->setName(bkmkselector->text(ind)); | 3522 | doc->setName(bkmkselector->text(ind)); |
3523 | } | 3523 | } |
3524 | FileManager fm; | 3524 | FileManager fm; |
3525 | fm.saveFile( *doc, rt ); | 3525 | fm.saveFile( *doc, rt ); |
3526 | qDebug("YES"); | 3526 | qDebug("YES"); |
3527 | } | 3527 | } |
3528 | else | 3528 | else |
3529 | { | 3529 | { |
3530 | qDebug("NO"); | 3530 | qDebug("NO"); |
3531 | } | 3531 | } |
3532 | delete f; | 3532 | delete f; |
3533 | */ | 3533 | */ |
3534 | 3534 | ||
3535 | #endif /* USEQPE */ | 3535 | #endif /* USEQPE */ |
3536 | } | 3536 | } |
3537 | break; | 3537 | break; |
3538 | } | 3538 | } |
3539 | } | 3539 | } |
3540 | 3540 | ||
3541 | void QTReaderApp::cancelbkmk() | 3541 | void QTReaderApp::cancelbkmk() |
3542 | { | 3542 | { |
3543 | if (m_nBkmkAction == cOpenFile) | 3543 | if (m_nBkmkAction == cOpenFile) |
3544 | { | 3544 | { |
3545 | QString fn = usefilebrowser(); | 3545 | QString fn = usefilebrowser(); |
3546 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn); | 3546 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn); |
3547 | } | 3547 | } |
3548 | showEditTools(); | 3548 | showEditTools(); |
3549 | } | 3549 | } |
3550 | 3550 | ||
3551 | void QTReaderApp::reparastring() | 3551 | void QTReaderApp::reparastring() |
3552 | { | 3552 | { |
3553 | m_nRegAction = cRepara; | 3553 | m_nRegAction = cRepara; |
3554 | regEdit->setText(reader->m_reparastring); | 3554 | regEdit->setText(reader->m_reparastring); |
3555 | do_regedit(); | 3555 | do_regedit(); |
3556 | } | 3556 | } |
3557 | 3557 | ||
3558 | void QTReaderApp::do_reparastring(const QString& _lcn) | 3558 | void QTReaderApp::do_reparastring(const QString& _lcn) |
3559 | { | 3559 | { |
3560 | reader->m_reparastring = _lcn; | 3560 | reader->m_reparastring = _lcn; |
3561 | if (reader->brepara) | 3561 | if (reader->brepara) |
3562 | { | 3562 | { |
3563 | reader->bDoUpdates = true; | 3563 | reader->bDoUpdates = true; |
3564 | reader->setfilter(reader->getfilter()); | 3564 | reader->setfilter(reader->getfilter()); |
3565 | } | 3565 | } |
3566 | } | 3566 | } |
3567 | 3567 | ||
3568 | void QTReaderApp::jump() | 3568 | void QTReaderApp::jump() |
3569 | { | 3569 | { |
3570 | m_nRegAction = cJump; | 3570 | m_nRegAction = cJump; |
3571 | char lcn[20]; | 3571 | char lcn[20]; |
3572 | sprintf(lcn, "%lu", reader->pagelocate()); | 3572 | sprintf(lcn, "%lu", reader->pagelocate()); |
3573 | regEdit->setText(lcn); | 3573 | regEdit->setText(lcn); |
3574 | do_regedit(); | 3574 | do_regedit(); |
3575 | } | 3575 | } |
3576 | 3576 | ||
3577 | void QTReaderApp::do_jump(const QString& _lcn) | 3577 | void QTReaderApp::do_jump(const QString& _lcn) |
3578 | { | 3578 | { |
3579 | bool ok; | 3579 | bool ok; |
3580 | QString lcn = _lcn.stripWhiteSpace(); | 3580 | QString lcn = _lcn.stripWhiteSpace(); |
3581 | unsigned long ulcn = lcn.toULong(&ok); | 3581 | unsigned long ulcn = lcn.toULong(&ok); |
3582 | if (!ok) | 3582 | if (!ok) |
3583 | { | 3583 | { |
3584 | double pc = 0.0; | 3584 | double pc = 0.0; |
3585 | #ifdef _WINDOWS | 3585 | #ifdef _WINDOWS |
3586 | if (lcn.at(lcn.length()-1) == '%') | 3586 | if (lcn.at(lcn.length()-1) == '%') |
3587 | #else | 3587 | #else |
3588 | if (lcn[lcn.length()-1] == '%') | 3588 | if (lcn[lcn.length()-1] == '%') |
3589 | #endif | 3589 | #endif |
3590 | { | 3590 | { |
3591 | lcn = lcn.left(lcn.length()-1); | 3591 | lcn = lcn.left(lcn.length()-1); |
3592 | pc = lcn.toDouble(&ok); | 3592 | pc = lcn.toDouble(&ok); |
3593 | } | 3593 | } |
3594 | else | 3594 | else |
3595 | { | 3595 | { |
3596 | pc = lcn.toDouble(&ok); | 3596 | pc = lcn.toDouble(&ok); |
3597 | } | 3597 | } |
3598 | if (ok && 0 <= pc && pc <= 100) | 3598 | if (ok && 0 <= pc && pc <= 100) |
3599 | { | 3599 | { |
3600 | ulcn = (pc*(reader->buffdoc.endSection()-reader->buffdoc.startSection()))/100 + reader->buffdoc.startSection(); | 3600 | ulcn = (pc*(reader->buffdoc.endSection()-reader->buffdoc.startSection()))/100 + reader->buffdoc.startSection(); |
3601 | } | 3601 | } |
3602 | else | 3602 | else |
3603 | { | 3603 | { |
3604 | ok = false; | 3604 | ok = false; |
3605 | } | 3605 | } |
3606 | } | 3606 | } |
3607 | if (ok) | 3607 | if (ok) |
3608 | reader->locate(ulcn); | 3608 | reader->locate(ulcn); |
3609 | else | 3609 | else |
3610 | QMessageBox::information(this, PROGNAME, "Must be a number\nor a percentage"); | 3610 | QMessageBox::information(this, PROGNAME, "Must be a number\nor a percentage"); |
3611 | } | 3611 | } |
3612 | 3612 | ||
3613 | void QTReaderApp::do_regaction() | 3613 | void QTReaderApp::do_regaction() |
3614 | { | 3614 | { |
3615 | reader->bDoUpdates = false; | 3615 | reader->bDoUpdates = false; |
3616 | regBar->hide(); | 3616 | regBar->hide(); |
3617 | #ifdef USEQPE | 3617 | #ifdef USEQPE |
3618 | Global::hideInputMethod(); | 3618 | Global::hideInputMethod(); |
3619 | #endif | 3619 | #endif |
3620 | regVisible = false; | 3620 | regVisible = false; |
3621 | switch(m_nRegAction) | 3621 | switch(m_nRegAction) |
3622 | { | 3622 | { |
3623 | case cAutoGen: | 3623 | case cAutoGen: |
3624 | do_autogen(regEdit->text()); | 3624 | do_autogen(regEdit->text()); |
3625 | break; | 3625 | break; |
3626 | case cAddBkmk: | 3626 | case cAddBkmk: |
3627 | do_addbkmk(regEdit->text()); | 3627 | do_addbkmk(regEdit->text()); |
3628 | break; | 3628 | break; |
3629 | case cRepara: | 3629 | case cRepara: |
3630 | do_reparastring(regEdit->text()); | 3630 | do_reparastring(regEdit->text()); |
3631 | break; | 3631 | break; |
3632 | case cJump: | 3632 | case cJump: |
3633 | do_jump(regEdit->text()); | 3633 | do_jump(regEdit->text()); |
3634 | break; | 3634 | break; |
3635 | /* | 3635 | /* |
3636 | case cMonoSpace: | 3636 | case cMonoSpace: |
3637 | do_mono(regEdit->text()); | 3637 | do_mono(regEdit->text()); |
3638 | break; | 3638 | break; |
3639 | */ | 3639 | */ |
3640 | case cSetTarget: | 3640 | case cSetTarget: |
3641 | do_settarget(regEdit->text()); | 3641 | do_settarget(regEdit->text()); |
3642 | break; | 3642 | break; |
3643 | #ifdef _SCROLLPIPE | 3643 | #ifdef _SCROLLPIPE |
3644 | case cSetPipeTarget: | 3644 | case cSetPipeTarget: |
3645 | do_setpipetarget(regEdit->text()); | 3645 | do_setpipetarget(regEdit->text()); |
3646 | break; | 3646 | break; |
3647 | #endif | 3647 | #endif |
3648 | case cSetConfigName: | 3648 | case cSetConfigName: |
3649 | // qDebug("Saving config"); | 3649 | // qDebug("Saving config"); |
3650 | do_saveconfig(regEdit->text(), false); | 3650 | do_saveconfig(regEdit->text(), false); |
3651 | break; | 3651 | break; |
3652 | } | 3652 | } |
3653 | // reader->restore(); | 3653 | // reader->restore(); |
3654 | // fileBar->show(); | 3654 | // fileBar->show(); |
3655 | reader->setFocus(); | 3655 | reader->setFocus(); |
3656 | // qApp->processEvents(); | 3656 | // qApp->processEvents(); |
3657 | reader->bDoUpdates = true; | 3657 | reader->bDoUpdates = true; |
3658 | reader->update(); | 3658 | reader->update(); |
3659 | } | 3659 | } |
3660 | 3660 | ||
3661 | void QTReaderApp::do_settarget(const QString& _txt) | 3661 | void QTReaderApp::do_settarget(const QString& _txt) |
3662 | { | 3662 | { |
3663 | int ind = _txt.find('/'); | 3663 | int ind = _txt.find('/'); |
3664 | if (ind == -1) | 3664 | if (ind == -1) |
3665 | { | 3665 | { |
3666 | m_targetapp = ""; | 3666 | m_targetapp = ""; |
3667 | m_targetmsg = ""; | 3667 | m_targetmsg = ""; |
3668 | QMessageBox::information(this, PROGNAME, "Format is\nappname/messagename"); | 3668 | QMessageBox::information(this, PROGNAME, "Format is\nappname/messagename"); |
3669 | } | 3669 | } |
3670 | else | 3670 | else |
3671 | { | 3671 | { |
3672 | m_targetapp = _txt.left(ind); | 3672 | m_targetapp = _txt.left(ind); |
3673 | m_targetmsg = _txt.right(_txt.length()-ind-1); | 3673 | m_targetmsg = _txt.right(_txt.length()-ind-1); |
3674 | } | 3674 | } |
3675 | } | 3675 | } |
3676 | 3676 | ||
3677 | void QTReaderApp::chooseencoding() | 3677 | void QTReaderApp::chooseencoding() |
3678 | { | 3678 | { |
3679 | m_fontSelector->clear(); | 3679 | m_fontSelector->clear(); |
3680 | m_fontSelector->insertItem("Ascii"); | 3680 | m_fontSelector->insertItem("Ascii"); |
3681 | m_fontSelector->insertItem("UTF-8"); | 3681 | m_fontSelector->insertItem("UTF-8"); |
3682 | m_fontSelector->insertItem("UCS-2(BE)"); | 3682 | m_fontSelector->insertItem("UCS-2(BE)"); |
3683 | m_fontSelector->insertItem("USC-2(LE)"); | 3683 | m_fontSelector->insertItem("USC-2(LE)"); |
3684 | m_fontSelector->insertItem("Palm"); | 3684 | m_fontSelector->insertItem("Palm"); |
3685 | for (unicodetable::iterator iter = unicodetable::begin(); iter != unicodetable::end(); iter++) | 3685 | for (unicodetable::iterator iter = unicodetable::begin(); iter != unicodetable::end(); iter++) |
3686 | { | 3686 | { |
3687 | m_fontSelector->insertItem(iter->mime); | 3687 | m_fontSelector->insertItem(iter->mime); |
3688 | } // delete the FontDatabase!!! | 3688 | } // delete the FontDatabase!!! |
3689 | m_fontSelector->setCurrentItem (reader->m_encd); | 3689 | m_fontSelector->setCurrentItem (reader->m_encd); |
3690 | m_fontAction = cChooseEncoding; | 3690 | m_fontAction = cChooseEncoding; |
3691 | m_fontBar->show(); | 3691 | m_fontBar->show(); |
3692 | m_fontVisible = true; | 3692 | m_fontVisible = true; |
3693 | } | 3693 | } |
3694 | 3694 | ||
3695 | void QTReaderApp::setfont() | 3695 | void QTReaderApp::setfont() |
3696 | { | 3696 | { |
3697 | m_fontSelector->clear(); | 3697 | m_fontSelector->clear(); |
3698 | { | 3698 | { |
3699 | QFontDatabase f; | 3699 | QFontDatabase f; |
3700 | QStringList flist = f.families(); | 3700 | QStringList flist = f.families(); |
3701 | m_fontSelector->insertStringList(flist); | 3701 | m_fontSelector->insertStringList(flist); |
3702 | } // delete the FontDatabase!!! | 3702 | } // delete the FontDatabase!!! |
3703 | 3703 | ||
3704 | for (int i = 1; i <= m_fontSelector->count(); i++) | 3704 | for (int i = 1; i <= m_fontSelector->count(); i++) |
3705 | { | 3705 | { |
3706 | if (m_fontSelector->text(i) == reader->m_fontname) | 3706 | if (m_fontSelector->text(i) == reader->m_fontname) |
3707 | { | 3707 | { |
3708 | m_fontSelector->setCurrentItem(i); | 3708 | m_fontSelector->setCurrentItem(i); |
3709 | break; | 3709 | break; |
3710 | } | 3710 | } |
3711 | } | 3711 | } |
3712 | m_fontAction = cChooseFont; | 3712 | m_fontAction = cChooseFont; |
3713 | m_fontBar->show(); | 3713 | m_fontBar->show(); |
3714 | m_fontVisible = true; | 3714 | m_fontVisible = true; |
3715 | } | 3715 | } |
3716 | 3716 | ||
3717 | void QTReaderApp::setfontHelper(const QString& lcn, int size) | 3717 | void QTReaderApp::setfontHelper(const QString& lcn, int size) |
3718 | { | 3718 | { |
3719 | if (size == 0) size = reader->m_fontControl.currentsize(); | 3719 | if (size == 0) size = reader->m_fontControl.currentsize(); |
3720 | if (m_propogatefontchange) | 3720 | if (m_propogatefontchange) |
3721 | { | 3721 | { |
3722 | QFont f(lcn, 10); | 3722 | QFont f(lcn, 10); |
3723 | bkmkselector->setFont( f ); | 3723 | bkmkselector->setFont( f ); |
3724 | regEdit->setFont( f ); | 3724 | regEdit->setFont( f ); |
3725 | searchEdit->setFont( f ); | 3725 | searchEdit->setFont( f ); |
3726 | m_annoWin->setFont( f ); | 3726 | m_annoWin->setFont( f ); |
3727 | } | 3727 | } |
3728 | reader->m_fontname = lcn; | 3728 | reader->m_fontname = lcn; |
3729 | if (!reader->ChangeFont(size)) | 3729 | if (!reader->ChangeFont(size)) |
3730 | { | 3730 | { |
3731 | reader->ChangeFont(size); | 3731 | reader->ChangeFont(size); |
3732 | } | 3732 | } |
3733 | } | 3733 | } |
3734 | 3734 | ||
3735 | void QTReaderApp::do_setencoding(int i) | 3735 | void QTReaderApp::do_setencoding(int i) |
3736 | { | 3736 | { |
3737 | qDebug("setencoding:%d", i); | 3737 | qDebug("setencoding:%d", i); |
3738 | if (m_fontAction == cChooseEncoding) | 3738 | if (m_fontAction == cChooseEncoding) |
3739 | { | 3739 | { |
3740 | reader->setencoding(i); | 3740 | reader->setencoding(i); |
3741 | } | 3741 | } |
3742 | reader->refresh(); | 3742 | reader->refresh(); |
3743 | m_fontBar->hide(); | 3743 | m_fontBar->hide(); |
3744 | m_fontVisible = false; | 3744 | m_fontVisible = false; |
3745 | // qDebug("showedit"); | 3745 | // qDebug("showedit"); |
3746 | if (reader->isVisible()) showEditTools(); | 3746 | if (reader->isVisible()) showEditTools(); |
3747 | // qDebug("showeditdone"); | 3747 | // qDebug("showeditdone"); |
3748 | } | 3748 | } |
3749 | 3749 | ||
3750 | void QTReaderApp::do_setfont(const QString& lcn) | 3750 | void QTReaderApp::do_setfont(const QString& lcn) |
3751 | { | 3751 | { |
3752 | if (m_fontAction == cChooseFont) | 3752 | if (m_fontAction == cChooseFont) |
3753 | { | 3753 | { |
3754 | setfontHelper(lcn); | 3754 | setfontHelper(lcn); |
3755 | } | 3755 | } |
3756 | reader->refresh(); | 3756 | reader->refresh(); |
3757 | m_fontBar->hide(); | 3757 | m_fontBar->hide(); |
3758 | m_fontVisible = false; | 3758 | m_fontVisible = false; |
3759 | // qDebug("setfont"); | 3759 | // qDebug("setfont"); |
3760 | //if (reader->isVisible()) | 3760 | //if (reader->isVisible()) |
3761 | showEditTools(); | 3761 | showEditTools(); |
3762 | // qDebug("showeditdone"); | 3762 | // qDebug("showeditdone"); |
3763 | } | 3763 | } |
3764 | 3764 | ||
3765 | void QTReaderApp::do_autogen(const QString& regText) | 3765 | void QTReaderApp::do_autogen(const QString& regText) |
3766 | { | 3766 | { |
3767 | unsigned long fs, ts; | 3767 | unsigned long fs, ts; |
3768 | reader->sizes(fs,ts); | 3768 | reader->sizes(fs,ts); |
3769 | // // qDebug("Reg:%s\n", (const tchar*)(regEdit->text())); | 3769 | // // qDebug("Reg:%s\n", (const tchar*)(regEdit->text())); |
3770 | m_autogenstr = regText; | 3770 | m_autogenstr = regText; |
3771 | QRegExp re(regText); | 3771 | QRegExp re(regText); |
3772 | CBuffer buff; | 3772 | CBuffer buff; |
3773 | if (pBkmklist != NULL) delete pBkmklist; | 3773 | if (pBkmklist != NULL) delete pBkmklist; |
3774 | reader->pBkmklist = pBkmklist = new CList<Bkmk>; | 3774 | reader->pBkmklist = pBkmklist = new CList<Bkmk>; |
3775 | m_fBkmksChanged = true; | 3775 | m_fBkmksChanged = true; |
3776 | 3776 | ||
3777 | pbar->setGeometry(regBar->x(),regBar->y(),regBar->width(), regBar->height()); | 3777 | pbar->setGeometry(regBar->x(),regBar->y(),regBar->width(), regBar->height()); |
3778 | pbar->show(); | 3778 | pbar->show(); |
3779 | pbar->raise(); | 3779 | pbar->raise(); |
3780 | pbar->reset(); | 3780 | pbar->reset(); |
3781 | reader->update(); | 3781 | reader->update(); |
3782 | qApp->processEvents(); | 3782 | qApp->processEvents(); |
3783 | reader->setFocus(); | 3783 | reader->setFocus(); |
3784 | reader->jumpto(0); | 3784 | reader->jumpto(0); |
3785 | int lastpc = 0; | 3785 | int lastpc = 0; |
3786 | int i = 0; | 3786 | int i = 0; |
3787 | unsigned int llcn = reader->locate(); | 3787 | unsigned int llcn = reader->locate(); |
3788 | while (i >= 0) | 3788 | while (i >= 0) |
3789 | { | 3789 | { |
3790 | unsigned int lcn = llcn; | 3790 | unsigned int lcn = llcn; |
3791 | int pc = (100*lcn)/ts; | 3791 | int pc = (100*lcn)/ts; |
3792 | if (pc != lastpc) | 3792 | if (pc != lastpc) |
3793 | { | 3793 | { |
3794 | pbar->setProgress(pc); | 3794 | pbar->setProgress(pc); |
3795 | qApp->processEvents(); | 3795 | qApp->processEvents(); |
3796 | if (reader->locate() != lcn) reader->jumpto(lcn); | 3796 | if (reader->locate() != lcn) reader->jumpto(lcn); |
3797 | reader->setFocus(); | 3797 | reader->setFocus(); |
3798 | lastpc = pc; | 3798 | lastpc = pc; |
3799 | } | 3799 | } |
3800 | i = reader->buffdoc.getpara(buff); | 3800 | i = reader->buffdoc.getpara(buff); |
3801 | #ifdef _UNICODE | 3801 | #ifdef _UNICODE |
3802 | if (re.match(toQString(buff.data())) != -1) | 3802 | if (re.match(toQString(buff.data())) != -1) |
3803 | #else | 3803 | #else |
3804 | if (re.match(buff.data()) != -1) | 3804 | if (re.match(buff.data()) != -1) |
3805 | #endif | 3805 | #endif |
3806 | pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); | 3806 | pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); |
3807 | /* | 3807 | /* |
3808 | llcn = reader->locate(); | 3808 | llcn = reader->locate(); |
3809 | if ((i == 0) && (llcn+1 < ts)) | 3809 | if ((i == 0) && (llcn+1 < ts)) |
3810 | { | 3810 | { |
3811 | reader->jumpto(++llcn); | 3811 | reader->jumpto(++llcn); |
3812 | i = 1; | 3812 | i = 1; |
3813 | } | 3813 | } |
3814 | */ | 3814 | */ |
3815 | } | 3815 | } |
3816 | pBkmklist->sort(); | 3816 | pBkmklist->sort(); |
3817 | pbar->setProgress(100); | 3817 | pbar->setProgress(100); |
3818 | qApp->processEvents(); | 3818 | qApp->processEvents(); |
3819 | pbar->hide(); | 3819 | pbar->hide(); |
3820 | reader->refresh(); | 3820 | reader->refresh(); |
3821 | } | 3821 | } |
3822 | 3822 | ||
3823 | void QTReaderApp::saveprefs() | 3823 | void QTReaderApp::saveprefs() |
3824 | { | 3824 | { |
3825 | do_saveconfig( APPDIR, true ); | 3825 | do_saveconfig( APPDIR, true ); |
3826 | savefilelist(); | 3826 | savefilelist(); |
3827 | } | 3827 | } |
3828 | 3828 | ||
3829 | /* | 3829 | /* |
3830 | void QTReaderApp::oldFile() | 3830 | void QTReaderApp::oldFile() |
3831 | { | 3831 | { |
3832 | // qDebug("oldFile called"); | 3832 | // qDebug("oldFile called"); |
3833 | reader->setText(true); | 3833 | reader->setText(true); |
3834 | // qDebug("settext called"); | 3834 | // qDebug("settext called"); |
3835 | showEditTools(); | 3835 | showEditTools(); |
3836 | // qDebug("showedit called"); | 3836 | // qDebug("showedit called"); |
3837 | } | 3837 | } |
3838 | */ | 3838 | */ |
3839 | 3839 | ||
3840 | /* | 3840 | /* |
3841 | void info_cb(Fl_Widget* o, void* _data) | 3841 | void info_cb(Fl_Widget* o, void* _data) |
3842 | { | 3842 | { |
3843 | 3843 | ||
3844 | if (infowin == NULL) | 3844 | if (infowin == NULL) |
3845 | { | 3845 | { |
3846 | 3846 | ||
3847 | infowin = new Fl_Window(160,240); | 3847 | infowin = new Fl_Window(160,240); |
3848 | filename = new Fl_Output(45,5,110,14,"Filename"); | 3848 | filename = new Fl_Output(45,5,110,14,"Filename"); |
3849 | filesize = new Fl_Output(45,25,110,14,"Filesize"); | 3849 | filesize = new Fl_Output(45,25,110,14,"Filesize"); |
3850 | textsize = new Fl_Output(45,45,110,14,"Textsize"); | 3850 | textsize = new Fl_Output(45,45,110,14,"Textsize"); |
3851 | comprat = new CBar(45,65,110,14,"Ratio %"); | 3851 | comprat = new CBar(45,65,110,14,"Ratio %"); |
3852 | posn = new Fl_Output(45,85,110,14,"Location"); | 3852 | posn = new Fl_Output(45,85,110,14,"Location"); |
3853 | frcn = new CBar(45,105,110,14,"% Read"); | 3853 | frcn = new CBar(45,105,110,14,"% Read"); |
3854 | about = new Fl_Multiline_Output(5,125,150,90); | 3854 | about = new Fl_Multiline_Output(5,125,150,90); |
3855 | about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files"); | 3855 | about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files"); |
3856 | Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay"); | 3856 | Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay"); |
3857 | infowin->set_modal(); | 3857 | infowin->set_modal(); |
3858 | } | 3858 | } |
3859 | if (((reader_ui *)_data)->g_filename[0] != '\0') | 3859 | if (((reader_ui *)_data)->g_filename[0] != '\0') |
3860 | { | 3860 | { |
3861 | unsigned long fs,ts; | 3861 | unsigned long fs,ts; |
3862 | tchar sz[20]; | 3862 | tchar sz[20]; |
3863 | ((reader_ui *)_data)->input->sizes(fs,ts); | 3863 | ((reader_ui *)_data)->input->sizes(fs,ts); |
3864 | unsigned long pl = ((reader_ui *)_data)->input->locate(); | 3864 | unsigned long pl = ((reader_ui *)_data)->input->locate(); |
3865 | 3865 | ||
3866 | filename->value(((reader_ui *)_data)->g_filename); | 3866 | filename->value(((reader_ui *)_data)->g_filename); |
3867 | 3867 | ||
3868 | sprintf(sz,"%u",fs); | 3868 | sprintf(sz,"%u",fs); |
3869 | filesize->value(sz); | 3869 | filesize->value(sz); |
3870 | 3870 | ||
3871 | sprintf(sz,"%u",ts); | 3871 | sprintf(sz,"%u",ts); |
3872 | textsize->value(sz); | 3872 | textsize->value(sz); |
3873 | 3873 | ||
3874 | comprat->value(100-(100*fs + (ts >> 1))/ts); | 3874 | comprat->value(100-(100*fs + (ts >> 1))/ts); |
3875 | 3875 | ||
3876 | sprintf(sz,"%u",pl); | 3876 | sprintf(sz,"%u",pl); |
3877 | posn->value(sz); | 3877 | posn->value(sz); |
3878 | 3878 | ||
3879 | frcn->value((100*pl + (ts >> 1))/ts); | 3879 | frcn->value((100*pl + (ts >> 1))/ts); |
3880 | } | 3880 | } |
3881 | infowin->show(); | 3881 | infowin->show(); |
3882 | } | 3882 | } |
3883 | */ | 3883 | */ |
3884 | 3884 | ||
3885 | void QTReaderApp::savebkmks() | 3885 | void QTReaderApp::savebkmks() |
3886 | { | 3886 | { |
3887 | if (pBkmklist != NULL) | 3887 | if (pBkmklist != NULL) |
3888 | { | 3888 | { |
3889 | #ifndef USEQPE | 3889 | #ifndef USEQPE |
3890 | QDir d = QDir::home(); // "/" | 3890 | QDir d = QDir::home(); // "/" |
3891 | d.cd(APPDIR); | 3891 | d.cd(APPDIR); |
3892 | QFileInfo fi(d, reader->m_string); | 3892 | QFileInfo fi(d, reader->m_string); |
3893 | BkmkFile bf((const char *)fi.absFilePath(), true, true); | 3893 | BkmkFile bf((const char *)fi.absFilePath(), true, true); |
3894 | #else /* USEQPE */ | 3894 | #else /* USEQPE */ |
3895 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), true, true); | 3895 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), true, true); |
3896 | #endif /* USEQPE */ | 3896 | #endif /* USEQPE */ |
3897 | bf.write(*pBkmklist); | 3897 | bf.write(*pBkmklist); |
3898 | } | 3898 | } |
3899 | m_fBkmksChanged = false; | 3899 | m_fBkmksChanged = false; |
3900 | } | 3900 | } |
3901 | 3901 | ||
3902 | void QTReaderApp::readfilelist() | 3902 | void QTReaderApp::readfilelist() |
3903 | { | 3903 | { |
3904 | #ifndef USEQPE | 3904 | #ifndef USEQPE |
3905 | QDir d = QDir::home(); // "/" | 3905 | QDir d = QDir::home(); // "/" |
3906 | d.cd(APPDIR); | 3906 | d.cd(APPDIR); |
3907 | QFileInfo fi(d, ".openfiles"); | 3907 | QFileInfo fi(d, ".openfiles"); |
3908 | BkmkFile bf((const char *)fi.absFilePath(), false, false); | 3908 | BkmkFile bf((const char *)fi.absFilePath(), false, false); |
3909 | #else /* USEQPE */ | 3909 | #else /* USEQPE */ |
3910 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), false, false); | 3910 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), false, false); |
3911 | #endif /* USEQPE */ | 3911 | #endif /* USEQPE */ |
3912 | // qDebug("Reading open files"); | 3912 | // qDebug("Reading open files"); |
3913 | pOpenlist = bf.readall(); | 3913 | pOpenlist = bf.readall(); |
3914 | // if (pOpenlist != NULL) qDebug("...with success"); | 3914 | // if (pOpenlist != NULL) qDebug("...with success"); |
3915 | // else qDebug("...without success!"); | 3915 | // else qDebug("...without success!"); |
3916 | } | 3916 | } |
3917 | 3917 | ||
3918 | void QTReaderApp::savefilelist() | 3918 | void QTReaderApp::savefilelist() |
3919 | { | 3919 | { |
3920 | if (pOpenlist != NULL) | 3920 | if (pOpenlist != NULL) |
3921 | { | 3921 | { |
3922 | #ifndef USEQPE | 3922 | #ifndef USEQPE |
3923 | QDir d = QDir::home(); // "/" | 3923 | QDir d = QDir::home(); // "/" |
3924 | d.cd(APPDIR); | 3924 | d.cd(APPDIR); |
3925 | QFileInfo fi(d, ".openfiles"); | 3925 | QFileInfo fi(d, ".openfiles"); |
3926 | BkmkFile bf((const char *)fi.absFilePath(), true, false); | 3926 | BkmkFile bf((const char *)fi.absFilePath(), true, false); |
3927 | #else /* USEQPE */ | 3927 | #else /* USEQPE */ |
3928 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), true, false); | 3928 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), true, false); |
3929 | #endif /* USEQPE */ | 3929 | #endif /* USEQPE */ |
3930 | //qDebug("Writing open files"); | 3930 | //qDebug("Writing open files"); |
3931 | bf.write(*pOpenlist); | 3931 | bf.write(*pOpenlist); |
3932 | } | 3932 | } |
3933 | } | 3933 | } |
3934 | 3934 | ||
3935 | void QTReaderApp::readbkmks() | 3935 | void QTReaderApp::readbkmks() |
3936 | { | 3936 | { |
3937 | if (pBkmklist != NULL) | 3937 | if (pBkmklist != NULL) |
3938 | { | 3938 | { |
3939 | delete pBkmklist; | 3939 | delete pBkmklist; |
3940 | } | 3940 | } |
3941 | struct stat fnstat; | 3941 | struct stat fnstat; |
3942 | struct stat bkstat; | 3942 | struct stat bkstat; |
3943 | #ifndef USEQPE | 3943 | #ifndef USEQPE |
3944 | QDir d = QDir::home(); // "/" | 3944 | QDir d = QDir::home(); // "/" |
3945 | d.cd(APPDIR); | 3945 | d.cd(APPDIR); |
3946 | QFileInfo fi(d, reader->m_string); | 3946 | QFileInfo fi(d, reader->m_string); |
3947 | #endif /* ! USEQPE */ | 3947 | #endif /* ! USEQPE */ |
3948 | if ( | 3948 | if ( |
3949 | stat((const char *)reader->m_lastfile, &fnstat) == 0 | 3949 | stat((const char *)reader->m_lastfile, &fnstat) == 0 |
3950 | && | 3950 | && |
3951 | #ifndef USEQPE | 3951 | #ifndef USEQPE |
3952 | stat((const char *)fi.absFilePath(), &bkstat) == 0 | 3952 | stat((const char *)fi.absFilePath(), &bkstat) == 0 |
3953 | #else /* USEQPE */ | 3953 | #else /* USEQPE */ |
3954 | stat((const char *)Global::applicationFileName(APPDIR,reader->m_string), &bkstat) == 0 | 3954 | stat((const char *)Global::applicationFileName(APPDIR,reader->m_string), &bkstat) == 0 |
3955 | #endif /* USEQPE */ | 3955 | #endif /* USEQPE */ |
3956 | ) | 3956 | ) |
3957 | { | 3957 | { |
3958 | if (bkstat.st_mtime < fnstat.st_mtime) | 3958 | if (bkstat.st_mtime < fnstat.st_mtime) |
3959 | { | 3959 | { |
3960 | #ifndef USEQPE | 3960 | #ifndef USEQPE |
3961 | unlink((const char *)fi.absFilePath()); | 3961 | unlink((const char *)fi.absFilePath()); |
3962 | #else /* USEQPE */ | 3962 | #else /* USEQPE */ |
3963 | unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); | 3963 | unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); |
3964 | #endif /* USEQPE */ | 3964 | #endif /* USEQPE */ |
3965 | } | 3965 | } |
3966 | } | 3966 | } |
3967 | 3967 | ||
3968 | #ifndef USEQPE | 3968 | #ifndef USEQPE |
3969 | BkmkFile bf((const char *)fi.absFilePath(), false, true); | 3969 | BkmkFile bf((const char *)fi.absFilePath(), false, true); |
3970 | #else /* USEQPE */ | 3970 | #else /* USEQPE */ |
3971 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), false, true); | 3971 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), false, true); |
3972 | #endif /* USEQPE */ | 3972 | #endif /* USEQPE */ |
3973 | 3973 | ||
3974 | reader->pBkmklist = pBkmklist = bf.readall(); | 3974 | reader->pBkmklist = pBkmklist = bf.readall(); |
3975 | m_fBkmksChanged = bf.upgraded(); | 3975 | m_fBkmksChanged = bf.upgraded(); |
3976 | if (pBkmklist == NULL) | 3976 | if (pBkmklist == NULL) |
3977 | { | 3977 | { |
3978 | reader->pBkmklist = pBkmklist = reader->getbkmklist(); | 3978 | reader->pBkmklist = pBkmklist = reader->getbkmklist(); |
3979 | } | 3979 | } |
3980 | if (pBkmklist != NULL) | 3980 | if (pBkmklist != NULL) |
3981 | pBkmklist->sort(); | 3981 | pBkmklist->sort(); |
3982 | } | 3982 | } |
3983 | 3983 | ||
3984 | void QTReaderApp::addbkmk() | 3984 | void QTReaderApp::addbkmk() |
3985 | { | 3985 | { |
3986 | m_nRegAction = cAddBkmk; | 3986 | m_nRegAction = cAddBkmk; |
3987 | regEdit->setText(reader->firstword()); | 3987 | regEdit->setText(reader->firstword()); |
3988 | do_regedit(); | 3988 | do_regedit(); |
3989 | } | 3989 | } |
3990 | 3990 | ||
3991 | void QTReaderApp::do_addbkmk(const QString& text) | 3991 | void QTReaderApp::do_addbkmk(const QString& text) |
3992 | { | 3992 | { |
3993 | if (text.isEmpty()) | 3993 | if (text.isEmpty()) |
3994 | { | 3994 | { |
3995 | QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nSelect add again", 1); | 3995 | QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nSelect add again", 1); |
3996 | } | 3996 | } |
3997 | else | 3997 | else |
3998 | { | 3998 | { |
3999 | if (pBkmklist == NULL) reader->pBkmklist = pBkmklist = new CList<Bkmk>; | 3999 | if (pBkmklist == NULL) reader->pBkmklist = pBkmklist = new CList<Bkmk>; |
4000 | #ifdef _UNICODE | 4000 | #ifdef _UNICODE |
4001 | CBuffer buff; | 4001 | CBuffer buff; |
4002 | int i = 0; | 4002 | int i = 0; |
4003 | for (i = 0; i < text.length(); i++) | 4003 | for (i = 0; i < text.length(); i++) |
4004 | { | 4004 | { |
4005 | buff[i] = text[i].unicode(); | 4005 | buff[i] = text[i].unicode(); |
4006 | } | 4006 | } |
4007 | buff[i] = 0; | 4007 | buff[i] = 0; |
4008 | pBkmklist->push_front(Bkmk(buff.data(), NULL, reader->pagelocate())); | 4008 | pBkmklist->push_front(Bkmk(buff.data(), NULL, reader->pagelocate())); |
4009 | #else | 4009 | #else |
4010 | pBkmklist->push_front(Bkmk((const tchar*)text, reader->pagelocate())); | 4010 | pBkmklist->push_front(Bkmk((const tchar*)text, reader->pagelocate())); |
4011 | #endif | 4011 | #endif |
4012 | m_fBkmksChanged = true; | 4012 | m_fBkmksChanged = true; |
4013 | pBkmklist->sort(); | 4013 | pBkmklist->sort(); |
4014 | reader->refresh(true); | 4014 | reader->refresh(true); |
4015 | } | 4015 | } |
4016 | } | 4016 | } |
4017 | 4017 | ||
4018 | void QTReaderApp::UpdateStatus() | 4018 | void QTReaderApp::UpdateStatus() |
4019 | { | 4019 | { |
4020 | QString status; | 4020 | QString status; |
4021 | for (int i = 0; i < m_statusstring.length(); i++) | 4021 | for (int i = 0; i < m_statusstring.length(); i++) |
4022 | { | 4022 | { |
4023 | if (m_statusstring[i].unicode() == '%') | 4023 | if (m_statusstring[i].unicode() == '%') |
4024 | { | 4024 | { |
4025 | i++; | 4025 | i++; |
4026 | if (i < m_statusstring.length()) | 4026 | if (i < m_statusstring.length()) |
4027 | { | 4027 | { |
4028 | switch (m_statusstring[i].unicode()) | 4028 | switch (m_statusstring[i].unicode()) |
4029 | { | 4029 | { |
4030 | case 'F': | 4030 | case 'F': |
4031 | { | 4031 | { |
4032 | unsigned long fs,ts; | 4032 | unsigned long fs,ts; |
4033 | reader->sizes(fs,ts); | 4033 | reader->sizes(fs,ts); |
4034 | status += filesize(ts); | 4034 | status += filesize(ts); |
4035 | } | 4035 | } |
4036 | break; | 4036 | break; |
4037 | case 'f': | 4037 | case 'f': |
4038 | { | 4038 | { |
4039 | status += filesize(reader->pagelocate()); | 4039 | status += filesize(reader->pagelocate()); |
4040 | } | 4040 | } |
4041 | break; | 4041 | break; |
4042 | case 'D': | 4042 | case 'D': |
4043 | { | 4043 | { |
4044 | status += filesize(reader->buffdoc.endSection()-reader->buffdoc.startSection()); | 4044 | status += filesize(reader->buffdoc.endSection()-reader->buffdoc.startSection()); |
4045 | } | 4045 | } |
4046 | break; | 4046 | break; |
4047 | case 'd': | 4047 | case 'd': |
4048 | { | 4048 | { |
4049 | status += filesize(reader->pagelocate()-reader->buffdoc.startSection()); | 4049 | status += filesize(reader->pagelocate()-reader->buffdoc.startSection()); |
4050 | } | 4050 | } |
4051 | break; | 4051 | break; |
4052 | case 'P': | 4052 | case 'P': |
4053 | { | 4053 | { |
4054 | unsigned long fs,ts; | 4054 | unsigned long fs,ts; |
4055 | reader->sizes(fs,ts); | 4055 | reader->sizes(fs,ts); |
4056 | status += percent(reader->pagelocate(),ts); | 4056 | status += percent(reader->pagelocate(),ts); |
4057 | } | 4057 | } |
4058 | break; | 4058 | break; |
4059 | case 'p': | 4059 | case 'p': |
4060 | { | 4060 | { |
4061 | status += percent(reader->pagelocate()-reader->buffdoc.startSection(),reader->buffdoc.endSection()-reader->buffdoc.startSection()); | 4061 | status += percent(reader->pagelocate()-reader->buffdoc.startSection(),reader->buffdoc.endSection()-reader->buffdoc.startSection()); |
4062 | } | 4062 | } |
4063 | break; | 4063 | break; |
4064 | case 'z': | 4064 | case 'z': |
4065 | { | 4065 | { |
4066 | // qDebug("case d"); | 4066 | // qDebug("case d"); |
4067 | status += QString().setNum(reader->m_fontControl.currentsize()*10); | 4067 | status += QString().setNum(reader->m_fontControl.currentsize()*10); |
4068 | } | 4068 | } |
4069 | break; | 4069 | break; |
4070 | default: | 4070 | default: |
4071 | status += m_statusstring[i]; | 4071 | status += m_statusstring[i]; |
4072 | } | 4072 | } |
4073 | } | 4073 | } |
4074 | } | 4074 | } |
4075 | else | 4075 | else |
4076 | { | 4076 | { |
4077 | status += m_statusstring[i]; | 4077 | status += m_statusstring[i]; |
4078 | } | 4078 | } |
4079 | } | 4079 | } |
4080 | m_prog->setText(status); | 4080 | m_prog->setText(status); |
4081 | } | 4081 | } |
4082 | 4082 | ||
4083 | void QTReaderApp::OnRedraw() | 4083 | void QTReaderApp::OnRedraw() |
4084 | { | 4084 | { |
4085 | if ((pBkmklist != NULL) && (m_bkmkAvail != NULL)) | 4085 | if ((pBkmklist != NULL) && (m_bkmkAvail != NULL)) |
4086 | { | 4086 | { |
4087 | bool found = findNextBookmark(reader->pagelocate()); | 4087 | bool found = findNextBookmark(reader->pagelocate()); |
4088 | m_bkmkAvail->setEnabled(found); | 4088 | m_bkmkAvail->setEnabled(found); |
4089 | } | 4089 | } |
4090 | if (m_scrollbar != NULL) | 4090 | if (m_scrollbar != NULL) |
4091 | { | 4091 | { |
4092 | //qDebug("OnRedraw:[%u, %u]", reader->buffdoc.startSection(), reader->buffdoc.endSection()); | 4092 | //qDebug("OnRedraw:[%u, %u]", reader->buffdoc.startSection(), reader->buffdoc.endSection()); |
4093 | scrollbar->setRange(reader->buffdoc.startSection(), reader->buffdoc.endSection()-1); | 4093 | scrollbar->setRange(reader->buffdoc.startSection(), reader->buffdoc.endSection()-1); |
4094 | scrollbar->setPageStep(reader->locate()-reader->pagelocate()); | 4094 | scrollbar->setPageStep(reader->locate()-reader->pagelocate()); |
4095 | scrollbar->setValue((reader->m_rotated) ? | 4095 | scrollbar->setValue((reader->m_rotated) ? |
4096 | (reader->buffdoc.endSection() - reader->locate()+reader->buffdoc.startSection()) : | 4096 | (reader->buffdoc.endSection() - reader->locate()+reader->buffdoc.startSection()) : |
4097 | reader->pagelocate()); | 4097 | reader->pagelocate()); |
4098 | } | 4098 | } |
4099 | if (m_prog->isVisible()) | 4099 | if (m_prog->isVisible()) |
4100 | { | 4100 | { |
4101 | // qDebug("updating status"); | 4101 | // qDebug("updating status"); |
4102 | UpdateStatus(); | 4102 | UpdateStatus(); |
4103 | // qDebug("updated status"); | 4103 | // qDebug("updated status"); |
4104 | } | 4104 | } |
4105 | } | 4105 | } |
4106 | 4106 | ||
4107 | void QTReaderApp::showAnnotation() | 4107 | void QTReaderApp::showAnnotation() |
4108 | { | 4108 | { |
4109 | m_annoWin->setName(toQString(m_anno->name())); | 4109 | m_annoWin->setName(toQString(m_anno->name())); |
4110 | m_annoWin->setAnno(toQString(m_anno->anno())); | 4110 | m_annoWin->setAnno(toQString(m_anno->anno())); |
4111 | m_annoWin->setColor(QColor(m_anno->red(), m_anno->green(), m_anno->blue())); | 4111 | m_annoWin->setColor(QColor(m_anno->red(), m_anno->green(), m_anno->blue())); |
4112 | m_annoIsEditing = false; | 4112 | m_annoIsEditing = false; |
4113 | #ifdef USEQPE | 4113 | #ifdef USEQPE |
4114 | Global::showInputMethod(); | 4114 | Global::showInputMethod(); |
4115 | #endif | 4115 | #endif |
4116 | editorStack->raiseWidget( m_annoWin ); | 4116 | editorStack->raiseWidget( m_annoWin ); |
4117 | hidetoolbars(); | 4117 | hidetoolbars(); |
4118 | m_annoWin->setFocus(); | 4118 | m_annoWin->setFocus(); |
4119 | } | 4119 | } |
4120 | 4120 | ||
4121 | void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, size_t posn2, const QString& line) | 4121 | void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, size_t posn2, const QString& line) |
4122 | { | 4122 | { |
4123 | //// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd); | 4123 | //// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd); |
4124 | 4124 | ||
4125 | if (m_doOutput && reader->checkoutput()) | 4125 | if (m_doOutput && reader->checkoutput()) |
4126 | { | 4126 | { |
4127 | reader->doOutput(wrd); | 4127 | reader->doOutput(wrd); |
4128 | } | 4128 | } |
4129 | if (m_doClipboard) | 4129 | if (m_doClipboard) |
4130 | { | 4130 | { |
4131 | QClipboard* cb = QApplication::clipboard(); | 4131 | QClipboard* cb = QApplication::clipboard(); |
4132 | cb->setText(wrd); | 4132 | cb->setText(wrd); |
4133 | #ifdef USEQPE | 4133 | #ifdef USEQPE |
4134 | if (wrd.length() > 10) | 4134 | if (wrd.length() > 10) |
4135 | { | 4135 | { |
4136 | Global::statusMessage(wrd.left(8) + ".."); | 4136 | Global::statusMessage(wrd.left(8) + ".."); |
4137 | } | 4137 | } |
4138 | else | 4138 | else |
4139 | { | 4139 | { |
4140 | Global::statusMessage(wrd); | 4140 | Global::statusMessage(wrd); |
4141 | } | 4141 | } |
4142 | #endif | 4142 | #endif |
4143 | } | 4143 | } |
4144 | if (m_doAnnotation) | 4144 | if (m_doAnnotation) |
4145 | { | 4145 | { |
4146 | //addAnno(wrd, "Need to be able to edit this", posn); | 4146 | //addAnno(wrd, "Need to be able to edit this", posn); |
4147 | m_annoWin->setName(line); | 4147 | m_annoWin->setName(line); |
4148 | m_annoWin->setAnno(""); | 4148 | m_annoWin->setAnno(""); |
4149 | m_annoWin->setPosn(posn); | 4149 | m_annoWin->setPosn(posn); |
4150 | m_annoWin->setPosn2(posn2); | 4150 | m_annoWin->setPosn2(posn2); |
4151 | m_annoIsEditing = true; | 4151 | m_annoIsEditing = true; |
4152 | #ifdef USEQPE | 4152 | #ifdef USEQPE |
4153 | Global::showInputMethod(); | 4153 | Global::showInputMethod(); |
4154 | #endif | 4154 | #endif |
4155 | editorStack->raiseWidget( m_annoWin ); | 4155 | editorStack->raiseWidget( m_annoWin ); |
4156 | hidetoolbars(); | 4156 | hidetoolbars(); |
4157 | } | 4157 | } |
4158 | #ifdef USEQPE | 4158 | #ifdef USEQPE |
4159 | if (m_doDictionary) | 4159 | if (m_doDictionary) |
4160 | { | 4160 | { |
4161 | if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty()) | 4161 | if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty()) |
4162 | { | 4162 | { |
4163 | QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8()); | 4163 | QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8()); |
4164 | e << wrd; | 4164 | e << wrd; |
4165 | } | 4165 | } |
4166 | } | 4166 | } |
4167 | #endif | 4167 | #endif |
4168 | } | 4168 | } |
4169 | 4169 | ||
4170 | void QTReaderApp::doAction(QKeyEvent* e) | 4170 | void QTReaderApp::doAction(QKeyEvent* e) |
4171 | { | 4171 | { |
4172 | QMap<orKey,int>::Iterator f = kmap.end(); | 4172 | QMap<orKey,int>::Iterator f = kmap.end(); |
4173 | 4173 | ||
4174 | if (reader->m_autoScroll) | 4174 | if (reader->m_autoScroll) |
4175 | { | 4175 | { |
4176 | f = kmap.find(orKey(e->state(), e->key(), true)); | 4176 | f = kmap.find(orKey(e->state(), e->key(), true)); |
4177 | } | 4177 | } |
4178 | if (f == kmap.end()) | 4178 | if (f == kmap.end()) |
4179 | { | 4179 | { |
4180 | f = kmap.find(orKey(e->state(), e->key(), false)); | 4180 | f = kmap.find(orKey(e->state(), e->key(), false)); |
4181 | } | 4181 | } |
4182 | 4182 | ||
4183 | if (f == kmap.end()) | 4183 | if (f == kmap.end()) |
4184 | { | 4184 | { |
4185 | qDebug("doaction (no action) : %d %d %d", e->key(), e->state(), f.data()); | 4185 | qDebug("doaction (no action) : %d %d %d", e->key(), e->state(), f.data()); |
4186 | e->ignore(); | 4186 | e->ignore(); |
4187 | } | 4187 | } |
4188 | else | 4188 | else |
4189 | { | 4189 | { |
4190 | qDebug("doaction (some action) : %d %d %d", e->key(), e->state(), f.data()); | 4190 | qDebug("doaction (some action) : %d %d %d", e->key(), e->state(), f.data()); |
4191 | ActionTypes a = (ActionTypes)f.data(); | 4191 | ActionTypes a = (ActionTypes)f.data(); |
4192 | e->accept(); | 4192 | e->accept(); |
4193 | //qDebug("Accepted"); | 4193 | //qDebug("Accepted"); |
4194 | switch (a) | 4194 | switch (a) |
4195 | { | 4195 | { |
4196 | case cesGotoLink: | 4196 | case cesGotoLink: |
4197 | { | 4197 | { |
4198 | reader->gotoLink(); | 4198 | reader->gotoLink(); |
4199 | } | 4199 | } |
4200 | break; | 4200 | break; |
4201 | case cesNextLink: | 4201 | case cesNextLink: |
4202 | { | 4202 | { |
4203 | reader->getNextLink(); | 4203 | reader->getNextLink(); |
4204 | } | 4204 | } |
4205 | break; | 4205 | break; |
4206 | case cesInvertColours: | 4206 | case cesInvertColours: |
4207 | m_inverse_action->setOn(!reader->bInverse); | 4207 | m_inverse_action->setOn(!reader->bInverse); |
4208 | break; | 4208 | break; |
4209 | case cesToggleBars: | 4209 | case cesToggleBars: |
4210 | m_hidebars = !m_hidebars; | 4210 | m_hidebars = !m_hidebars; |
4211 | if (m_hidebars) | 4211 | if (m_hidebars) |
4212 | { | 4212 | { |
4213 | #if defined(USEQPE) | 4213 | #if defined(USEQPE) |
4214 | menubar->hide(); | 4214 | menubar->hide(); |
4215 | #endif | 4215 | #endif |
4216 | if (fileBar != NULL) fileBar->hide(); | 4216 | if (fileBar != NULL) fileBar->hide(); |
4217 | if (viewBar != NULL) viewBar->hide(); | 4217 | if (viewBar != NULL) viewBar->hide(); |
4218 | if (navBar != NULL) navBar->hide(); | 4218 | if (navBar != NULL) navBar->hide(); |
4219 | if (markBar != NULL) markBar->hide(); | 4219 | if (markBar != NULL) markBar->hide(); |
4220 | mb->hide(); | 4220 | mb->hide(); |
4221 | } | 4221 | } |
4222 | else | 4222 | else |
4223 | { | 4223 | { |
4224 | #if defined(USEQPE) | 4224 | #if defined(USEQPE) |
4225 | menubar->show(); | 4225 | menubar->show(); |
4226 | #endif | 4226 | #endif |
4227 | if (fileBar != NULL) fileBar->show(); | 4227 | if (fileBar != NULL) fileBar->show(); |
4228 | if (viewBar != NULL) viewBar->show(); | 4228 | if (viewBar != NULL) viewBar->show(); |
4229 | if (navBar != NULL) navBar->show(); | 4229 | if (navBar != NULL) navBar->show(); |
4230 | if (markBar != NULL) markBar->show(); | 4230 | if (markBar != NULL) markBar->show(); |
4231 | mb->show(); | 4231 | mb->show(); |
4232 | } | 4232 | } |
4233 | break; | 4233 | break; |
4234 | case cesToggleScrollBar: | 4234 | case cesToggleScrollBar: |
4235 | if (m_scrollbar != NULL) | 4235 | if (m_scrollbar != NULL) |
4236 | { | 4236 | { |
4237 | if (m_scrollbar->isHidden()) | 4237 | if (m_scrollbar->isHidden()) |
4238 | { | 4238 | { |
4239 | m_scrollishidden = false; | 4239 | m_scrollishidden = false; |
4240 | m_scrollbar->show(); | 4240 | m_scrollbar->show(); |
4241 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; | 4241 | reader->m_scrollpos = (m_qtscroll == 0) ? m_localscroll : 0; |
4242 | } | 4242 | } |
4243 | else | 4243 | else |
4244 | { | 4244 | { |
4245 | m_scrollishidden = true; | 4245 | m_scrollishidden = true; |
4246 | m_scrollbar->hide(); | 4246 | m_scrollbar->hide(); |
4247 | reader->m_scrollpos = m_localscroll; | 4247 | reader->m_scrollpos = m_localscroll; |
4248 | } | 4248 | } |
4249 | } | 4249 | } |
4250 | break; | 4250 | break; |
4251 | case cesToggleStatusBar: | 4251 | case cesToggleStatusBar: |
4252 | if (m_prog != NULL) | 4252 | if (m_prog != NULL) |
4253 | { | 4253 | { |
4254 | if (m_prog->isHidden()) | 4254 | if (m_prog->isHidden()) |
4255 | { | 4255 | { |
4256 | m_statusishidden = false; | 4256 | m_statusishidden = false; |
4257 | m_prog->show(); | 4257 | m_prog->show(); |
4258 | } | 4258 | } |
4259 | else | 4259 | else |
4260 | { | 4260 | { |
4261 | m_statusishidden = true; | 4261 | m_statusishidden = true; |
4262 | m_prog->hide(); | 4262 | m_prog->hide(); |
4263 | } | 4263 | } |
4264 | } | 4264 | } |
4265 | break; | 4265 | break; |
4266 | case cesOpenFile: | 4266 | case cesOpenFile: |
4267 | { | 4267 | { |
4268 | qDebug("Open file"); | 4268 | qDebug("Open file"); |
4269 | fileOpen(); | 4269 | fileOpen(); |
4270 | } | 4270 | } |
4271 | break; | 4271 | break; |
4272 | case cesAutoScroll: | 4272 | case cesAutoScroll: |
4273 | { | 4273 | { |
4274 | reader->setautoscroll(!reader->m_autoScroll); | 4274 | reader->setautoscroll(!reader->m_autoScroll); |
4275 | setScrollState(reader->m_autoScroll); | 4275 | setScrollState(reader->m_autoScroll); |
4276 | } | 4276 | } |
4277 | break; | 4277 | break; |
4278 | case cesActionMark: | 4278 | case cesActionMark: |
4279 | { | 4279 | { |
4280 | addbkmk(); | 4280 | addbkmk(); |
4281 | } | 4281 | } |
4282 | break; | 4282 | break; |
4283 | case cesFullScreen: | 4283 | case cesFullScreen: |
4284 | { | 4284 | { |
4285 | m_actFullscreen->setOn(!m_fullscreen); | 4285 | m_actFullscreen->setOn(!m_fullscreen); |
4286 | } | 4286 | } |
4287 | break; | 4287 | break; |
4288 | case cesRotate: | 4288 | case cesRotate: |
4289 | { | 4289 | { |
4290 | m_rotate_action->setOn(!reader->m_rotated); | 4290 | m_rotate_action->setOn(!reader->m_rotated); |
4291 | } | 4291 | } |
4292 | break; | 4292 | break; |
4293 | case cesActionAnno: | 4293 | case cesActionAnno: |
4294 | { | 4294 | { |
4295 | addanno(); | 4295 | addanno(); |
4296 | } | 4296 | } |
4297 | break; | 4297 | break; |
4298 | case cesZoomIn: | 4298 | case cesZoomIn: |
4299 | zoomin(); | 4299 | zoomin(); |
4300 | break; | 4300 | break; |
4301 | case cesZoomOut: | 4301 | case cesZoomOut: |
4302 | zoomout(); | 4302 | zoomout(); |
4303 | break; | 4303 | break; |
4304 | case cesBack: | 4304 | case cesBack: |
4305 | reader->goBack(); | 4305 | reader->goBack(); |
4306 | break; | 4306 | break; |
4307 | case cesForward: | 4307 | case cesForward: |
4308 | reader->goForward(); | 4308 | reader->goForward(); |
4309 | break; | 4309 | break; |
4310 | case cesHome: | 4310 | case cesHome: |
4311 | reader->goHome(); | 4311 | reader->goHome(); |
4312 | break; | 4312 | break; |
4313 | case cesPageUp: | 4313 | case cesPageUp: |
4314 | reader->dopageup(); | 4314 | reader->dopageup(); |
4315 | /* | 4315 | /* |
4316 | ftime(&m_lastkeytime); | 4316 | ftime(&m_lastkeytime); |
4317 | m_fndelay = m_debounce; | 4317 | m_fndelay = m_debounce; |
4318 | // | 4318 | // |
4319 | { | 4319 | { |
4320 | timeb now; | 4320 | timeb now; |
4321 | ftime(&now); | 4321 | ftime(&now); |
4322 | m_fndelay = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm+100; | 4322 | m_fndelay = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm+100; |
4323 | } | 4323 | } |
4324 | */ | 4324 | */ |
4325 | break; | 4325 | break; |
4326 | case cesPageDown: | 4326 | case cesPageDown: |
4327 | reader->dopagedn(); | 4327 | reader->dopagedn(); |
4328 | /* | 4328 | /* |
4329 | ftime(&m_lastkeytime); | 4329 | ftime(&m_lastkeytime); |
4330 | m_fndelay = m_debounce; | 4330 | m_fndelay = m_debounce; |
4331 | // | 4331 | // |
4332 | if (m_debounce != 0) | 4332 | if (m_debounce != 0) |
4333 | { | 4333 | { |
4334 | timeb now; | 4334 | timeb now; |
4335 | ftime(&now); | 4335 | ftime(&now); |
4336 | m_fndelay = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm+10; | 4336 | m_fndelay = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm+10; |
4337 | } | 4337 | } |
4338 | */ | 4338 | */ |
4339 | break; | 4339 | break; |
4340 | case cesLineUp: | 4340 | case cesLineUp: |
4341 | reader->lineUp(); | 4341 | reader->lineUp(); |
4342 | break; | 4342 | break; |
4343 | case cesLineDown: | 4343 | case cesLineDown: |
4344 | reader->lineDown(); | 4344 | reader->lineDown(); |
4345 | break; | 4345 | break; |
4346 | case cesStartDoc: | 4346 | case cesStartDoc: |
4347 | gotoStart(); | 4347 | gotoStart(); |
4348 | break; | 4348 | break; |
4349 | case cesEndDoc: | 4349 | case cesEndDoc: |
4350 | gotoEnd(); | 4350 | gotoEnd(); |
4351 | break; | 4351 | break; |
4352 | case cesScrollMore: | 4352 | case cesScrollMore: |
4353 | reader->increaseScroll(); | 4353 | reader->increaseScroll(); |
4354 | break; | 4354 | break; |
4355 | case cesScrollLess: | 4355 | case cesScrollLess: |
4356 | reader->reduceScroll(); | 4356 | reader->reduceScroll(); |
4357 | break; | 4357 | break; |
4358 | default: | 4358 | default: |
4359 | qDebug("Unknown ActionType:%u", a); | 4359 | qDebug("Unknown ActionType:%u", a); |
4360 | break; | 4360 | break; |
4361 | } | 4361 | } |
4362 | } | 4362 | } |
4363 | } | 4363 | } |
4364 | 4364 | ||
4365 | void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); } | 4365 | void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); } |
4366 | void QTReaderApp::restoreFocus() { reader->setFocus(); } | 4366 | void QTReaderApp::restoreFocus() { reader->setFocus(); } |
4367 | 4367 | ||
4368 | void QTReaderApp::SaveConfig() | 4368 | void QTReaderApp::SaveConfig() |
4369 | { | 4369 | { |
4370 | m_nRegAction = cSetConfigName; | 4370 | m_nRegAction = cSetConfigName; |
4371 | regEdit->setText(reader->m_string); | 4371 | regEdit->setText(reader->m_string); |
4372 | do_regedit(); | 4372 | do_regedit(); |
4373 | } | 4373 | } |
4374 | 4374 | ||
4375 | void QTReaderApp::do_saveconfig(const QString& _txt, bool full) | 4375 | void QTReaderApp::do_saveconfig(const QString& _txt, bool full) |
4376 | { | 4376 | { |
4377 | // qDebug("do_saveconfig:%s", (const char*)_txt); | 4377 | // qDebug("do_saveconfig:%s", (const char*)_txt); |
4378 | #ifdef USEQPE | 4378 | #ifdef USEQPE |
4379 | QString configname; | 4379 | QString configname; |
4380 | Config::Domain dom; | 4380 | Config::Domain dom; |
4381 | 4381 | ||
4382 | if (full) | 4382 | if (full) |
4383 | { | 4383 | { |
4384 | configname = _txt; | 4384 | configname = _txt; |
4385 | dom = Config::User; | 4385 | dom = Config::User; |
4386 | } | 4386 | } |
4387 | else | 4387 | else |
4388 | { | 4388 | { |
4389 | configname = Global::applicationFileName(APPDIR "/configs", _txt); | 4389 | configname = Global::applicationFileName(APPDIR "/configs", _txt); |
4390 | dom = Config::File; | 4390 | dom = Config::File; |
4391 | } | 4391 | } |
4392 | 4392 | ||
4393 | Config config(configname, dom); | 4393 | Config config(configname, dom); |
4394 | config.setGroup( "View" ); | 4394 | config.setGroup( "View" ); |
4395 | 4395 | ||
4396 | #else | 4396 | #else |
4397 | QFileInfo fi; | 4397 | QFileInfo fi; |
4398 | if (full) | 4398 | if (full) |
4399 | { | 4399 | { |
4400 | // qDebug("full:%s", (const char*)_txt); | 4400 | // qDebug("full:%s", (const char*)_txt); |
4401 | QDir d = QDir::home(); // "/" | 4401 | QDir d = QDir::home(); // "/" |
4402 | if ( !d.cd(_txt) ) | 4402 | if ( !d.cd(_txt) ) |
diff --git a/noncore/apps/opie-reader/opie-reader.control b/noncore/apps/opie-reader/opie-reader.control index 60976b2..d53f70d 100644 --- a/noncore/apps/opie-reader/opie-reader.control +++ b/noncore/apps/opie-reader/opie-reader.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-reader | 1 | Package: opie-reader |
2 | Files: bin/reader lib/libreader* plugins/reader/* apps/Applications/opie-reader.desktop pics/opie-reader/* | 2 | Files: bin/reader lib/libreader* plugins/reader/* apps/Applications/opie-reader.desktop pics/opie-reader/* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Tim Wentford <timwentford@hotmail.com> | 5 | Maintainer: Tim Wentford <timwentford@hotmail.com> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal, libopiecore2 |
8 | License: GPL | 8 | License: GPL |
9 | Description: E-Book reader | 9 | Description: E-Book reader |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/noncore/apps/opie-reader/opie-reader.pro b/noncore/apps/opie-reader/opie-reader.pro index 47980e1..da39154 100644 --- a/noncore/apps/opie-reader/opie-reader.pro +++ b/noncore/apps/opie-reader/opie-reader.pro | |||
@@ -1,24 +1,25 @@ | |||
1 | TEMPLATE = subdirs | 1 | TEMPLATE = subdirs |
2 | SUBDIRS = pluckerbaselib \ | 2 | SUBDIRS = pluckerbaselib \ |
3 | codeclib \ | 3 | codeclib \ |
4 | pdblib \ | 4 | pdblib \ |
5 | PluckerCodec \ | 5 | PluckerCodec \ |
6 | AportisCodec \ | 6 | AportisCodec \ |
7 | CHM \ | 7 | CHM \ |
8 | HTMLFilter \ | 8 | HTMLFilter \ |
9 | WeaselCodec \ | 9 | WeaselCodec \ |
10 | iSiloCodec \ | 10 | iSiloCodec \ |
11 | ppmsCodec \ | 11 | ppmsCodec \ |
12 | FliteCmd \ | 12 | FliteCmd \ |
13 | pluckerdecompress \ | 13 | pluckerdecompress \ |
14 | ArriereCodec \ | 14 | ArriereCodec \ |
15 | RebCodec \ | 15 | RebCodec \ |
16 | reader | 16 | reader |
17 | LIBS += -lopiecore2 | ||
17 | 18 | ||
18 | # these are added only built if enabled in "make menuconfig" | 19 | # these are added only built if enabled in "make menuconfig" |
19 | # FliteDyn | 20 | # FliteDyn |
20 | # FliteDyn16 | 21 | # FliteDyn16 |
21 | 22 | ||
22 | include( $(OPIEDIR)/include.pro ) | 23 | include( $(OPIEDIR)/include.pro ) |
23 | 24 | ||
24 | 25 | ||