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