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