summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/QTReaderApp.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/QTReaderApp.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.cpp811
1 files changed, 694 insertions, 117 deletions
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp
index 8726df7..2044b1d 100644
--- a/noncore/apps/opie-reader/QTReaderApp.cpp
+++ b/noncore/apps/opie-reader/QTReaderApp.cpp
@@ -21,7 +21,10 @@
21#include <qclipboard.h> 21#include <qclipboard.h>
22#include <qwidgetstack.h> 22#include <qwidgetstack.h>
23#include <qpe/qpemenubar.h> 23#include <qpe/qpemenubar.h>
24#include <qpe/qpetoolbar.h> 24//#include <qpe/qpetoolbar.h>
25#include <qmenubar.h>
26#include <qtoolbar.h>
27#include <qpe/menubutton.h>
25#include <qpe/fontdatabase.h> 28#include <qpe/fontdatabase.h>
26#include <qcombobox.h> 29#include <qcombobox.h>
27#include <qpopupmenu.h> 30#include <qpopupmenu.h>
@@ -42,6 +45,7 @@
42#include <qpe/qcopenvelope_qws.h> 45#include <qpe/qcopenvelope_qws.h>
43 46
44#include "QTReader.h" 47#include "QTReader.h"
48#include "GraphicWin.h"
45#include "Bkmks.h" 49#include "Bkmks.h"
46#include "cbkmkselector.h" 50#include "cbkmkselector.h"
47#include "infowin.h" 51#include "infowin.h"
@@ -55,6 +59,16 @@
55#include "QTReaderApp.h" 59#include "QTReaderApp.h"
56#include "fileBrowser.h" 60#include "fileBrowser.h"
57#include "CDrawBuffer.h" 61#include "CDrawBuffer.h"
62#include "Filedata.h"
63#include "opie.h"
64#include "name.h"
65#include "StateData.h"
66
67#ifdef OPIE
68#define PICDIR "opie-reader/"
69#else
70#define PICDIR
71#endif
58 72
59 73
60unsigned long QTReaderApp::m_uid = 0; 74unsigned long QTReaderApp::m_uid = 0;
@@ -68,9 +82,10 @@ void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); }
68void QTReaderApp::listBkmkFiles() 82void QTReaderApp::listBkmkFiles()
69{ 83{
70 bkmkselector->clear(); 84 bkmkselector->clear();
85 bkmkselector->setText("Cancel");
71 int cnt = 0; 86 int cnt = 0;
72 DIR *d; 87 DIR *d;
73 d = opendir((const char *)Global::applicationFileName("uqtreader","")); 88 d = opendir((const char *)Global::applicationFileName(APPDIR,""));
74 89
75 while(1) 90 while(1)
76 { 91 {
@@ -79,7 +94,7 @@ void QTReaderApp::listBkmkFiles()
79 de = readdir(d); 94 de = readdir(d);
80 if (de == NULL) break; 95 if (de == NULL) break;
81 96
82 if (lstat((const char *)Global::applicationFileName("uqtreader",de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) 97 if (lstat((const char *)Global::applicationFileName(APPDIR,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode))
83 { 98 {
84 bkmkselector->insertItem(de->d_name); 99 bkmkselector->insertItem(de->d_name);
85 cnt++; 100 cnt++;
@@ -93,13 +108,21 @@ void QTReaderApp::listBkmkFiles()
93//tjw menu->hide(); 108//tjw menu->hide();
94 editBar->hide(); 109 editBar->hide();
95 if (m_fontVisible) m_fontBar->hide(); 110 if (m_fontVisible) m_fontBar->hide();
96 if (regVisible) regBar->hide(); 111 if (regVisible)
97 if (searchVisible) searchBar->hide(); 112 {
113 Global::hideInputMethod();
114 regBar->hide();
115 }
116 if (searchVisible)
117 {
118 Global::hideInputMethod();
119 searchBar->hide();
120 }
98 m_nRegAction = cRmBkmkFile; 121 m_nRegAction = cRmBkmkFile;
99 editorStack->raiseWidget( bkmkselector ); 122 editorStack->raiseWidget( bkmkselector );
100 } 123 }
101 else 124 else
102 QMessageBox::information(this, "OpieReader", "No bookmark files"); 125 QMessageBox::information(this, PROGNAME, "No bookmark files");
103} 126}
104 127
105QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) 128QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
@@ -109,7 +132,8 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
109// qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml")); 132// qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml"));
110 133
111 pBkmklist = NULL; 134 pBkmklist = NULL;
112 doc = 0; 135 pOpenlist = NULL;
136// doc = 0;
113 137
114 m_fBkmksChanged = false; 138 m_fBkmksChanged = false;
115 139
@@ -118,14 +142,16 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
118 m_autogenstr = "^ *[A-Z].*[a-z] *$"; 142 m_autogenstr = "^ *[A-Z].*[a-z] *$";
119 setToolBarsMovable( FALSE ); 143 setToolBarsMovable( FALSE );
120 144
121 setIcon( Resource::loadPixmap( "opie-reader/uqtreader" ) ); 145 setIcon( Resource::loadPixmap( "uqtreader" ) );
122 146
123 QPEToolBar *bar = new QPEToolBar( this ); 147// QPEToolBar *bar = new QPEToolBar( this );
148 QToolBar *bar = new QToolBar( this );
124 bar->setHorizontalStretchable( TRUE ); 149 bar->setHorizontalStretchable( TRUE );
125 addToolBar(bar, "tool",QMainWindow::Top, true); 150 addToolBar(bar, "tool",QMainWindow::Top, true);
126//tjw menu = bar; 151//tjw menu = bar;
127 152
128 QPEMenuBar *mb = new QPEMenuBar( bar ); 153 QPEMenuBar *mb = new QPEMenuBar( bar );
154// QMenuBar *mb = new QMenuBar( bar );
129 QPopupMenu *file = new QPopupMenu( this ); 155 QPopupMenu *file = new QPopupMenu( this );
130 QPopupMenu *format = new QPopupMenu( this ); 156 QPopupMenu *format = new QPopupMenu( this );
131 // QPopupMenu *edit = new QPopupMenu( this ); 157 // QPopupMenu *edit = new QPopupMenu( this );
@@ -159,6 +185,10 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
159 editorStack->addWidget(m_infoWin, get_unique_id()); 185 editorStack->addWidget(m_infoWin, get_unique_id());
160 connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) ); 186 connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) );
161 187
188 m_graphicwin = new GraphicWin(editorStack);
189 editorStack->addWidget(m_graphicwin, get_unique_id());
190 connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) );
191
162// bkmkselector = new QListBox(editorStack, "Bookmarks"); 192// bkmkselector = new QListBox(editorStack, "Bookmarks");
163 bkmkselector = new CBkmkSelector(editorStack, "Bookmarks"); 193 bkmkselector = new CBkmkSelector(editorStack, "Bookmarks");
164 // connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) ); 194 // connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) );
@@ -175,12 +205,17 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
175 // don't need the close visible, it is redundant... 205 // don't need the close visible, it is redundant...
176 importSelector->setCloseVisible( FALSE ); 206 importSelector->setCloseVisible( FALSE );
177*/ 207*/
208 qDebug("Reading file list");
209 readfilelist();
178 210
179 reader = new QTReader( editorStack ); 211 reader = new QTReader( editorStack );
180 212
213 reader->bDoUpdates = false;
214
181 ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); 215 ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold);
182 216
183 Config config( "uqtreader" ); 217 qDebug("Reading config");
218 Config config( APPDIR );
184 config.setGroup( "View" ); 219 config.setGroup( "View" );
185 220
186 reader->bstripcr = config.readBoolEntry( "StripCr", true ); 221 reader->bstripcr = config.readBoolEntry( "StripCr", true );
@@ -189,6 +224,7 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
189 reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); 224 reader->bstriphtml = config.readBoolEntry( "StripHtml", false );
190 reader->bpeanut = config.readBoolEntry( "Peanut", false ); 225 reader->bpeanut = config.readBoolEntry( "Peanut", false );
191 reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); 226 reader->bdehyphen = config.readBoolEntry( "Dehyphen", false );
227 reader->bonespace = config.readBoolEntry( "OneSpace", false );
192 reader->bunindent = config.readBoolEntry( "Unindent", false ); 228 reader->bunindent = config.readBoolEntry( "Unindent", false );
193 reader->brepara = config.readBoolEntry( "Repara", false ); 229 reader->brepara = config.readBoolEntry( "Repara", false );
194 reader->bdblspce = config.readBoolEntry( "DoubleSpace", false ); 230 reader->bdblspce = config.readBoolEntry( "DoubleSpace", false );
@@ -198,13 +234,18 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
198 reader->m_lastfile = config.readEntry( "LastFile", QString::null ); 234 reader->m_lastfile = config.readEntry( "LastFile", QString::null );
199 reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); 235 reader->m_lastposn = config.readNumEntry( "LastPosn", 0 );
200 reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); 236 reader->m_bpagemode = config.readBoolEntry( "PageMode", true );
237 reader->m_navkeys = config.readBoolEntry( "CursorNavigation", false );
201 reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); 238 reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false);
202 reader->m_fontname = config.readEntry( "Fontname", "helvetica" ); 239 reader->m_fontname = config.readEntry( "Fontname", "helvetica" );
203 reader->m_encd = config.readNumEntry( "Encoding", 0 ); 240 reader->m_encd = config.readNumEntry( "Encoding", 0 );
204 reader->m_charpc = config.readNumEntry( "CharSpacing", 100 ); 241 reader->m_charpc = config.readNumEntry( "CharSpacing", 100 );
205 reader->m_overlap = config.readNumEntry( "Overlap", 0 ); 242 reader->m_overlap = config.readNumEntry( "Overlap", 0 );
243#ifdef REPALM
244 reader->brepalm = config.readBoolEntry( "Repalm", true );
245#endif
206 reader->bremap = config.readBoolEntry( "Remap", true ); 246 reader->bremap = config.readBoolEntry( "Remap", true );
207 reader->bmakebold = config.readBoolEntry( "MakeBold", false ); 247 reader->bmakebold = config.readBoolEntry( "MakeBold", false );
248 reader->setContinuous(config.readBoolEntry( "Continuous", true ));
208 m_targetapp = config.readEntry( "TargetApp", QString::null ); 249 m_targetapp = config.readEntry( "TargetApp", QString::null );
209 m_targetmsg = config.readEntry( "TargetMsg", QString::null ); 250 m_targetmsg = config.readEntry( "TargetMsg", QString::null );
210 m_twoTouch = config.readBoolEntry( "TwoTouch", false); 251 m_twoTouch = config.readBoolEntry( "TwoTouch", false);
@@ -215,6 +256,8 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
215 setTwoTouch(m_twoTouch); 256 setTwoTouch(m_twoTouch);
216 257
217 258
259 connect( reader, SIGNAL( OnShowPicture(QPixmap&) ), this, SLOT( showgraphic(QPixmap&) ) );
260
218 connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) ); 261 connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) );
219 connect( reader, SIGNAL( OnActionPressed() ), this, SLOT( OnActionPressed() ) ); 262 connect( reader, SIGNAL( OnActionPressed() ), this, SLOT( OnActionPressed() ) );
220 connect( reader, SIGNAL( OnWordSelected(const QString&, size_t, const QString&) ), this, SLOT( OnWordSelected(const QString&, size_t, const QString&) ) ); 263 connect( reader, SIGNAL( OnWordSelected(const QString&, size_t, const QString&) ), this, SLOT( OnWordSelected(const QString&, size_t, const QString&) ) );
@@ -225,6 +268,11 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
225 a->addTo( bar ); 268 a->addTo( bar );
226 a->addTo( file ); 269 a->addTo( file );
227 270
271 a = new QAction( tr( "Close" ), Resource::loadPixmap( "fileclose" ), QString::null, 0, this, 0 );
272 connect( a, SIGNAL( activated() ), this, SLOT( fileClose() ) );
273// a->addTo( bar );
274 a->addTo( file );
275
228 /* 276 /*
229 a = new QAction( tr( "Revert" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 277 a = new QAction( tr( "Revert" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
230 connect( a, SIGNAL( activated() ), this, SLOT( fileRevert() ) ); 278 connect( a, SIGNAL( activated() ), this, SLOT( fileRevert() ) );
@@ -250,18 +298,40 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
250 298
251 m_buttonAction[2] = new QAction( tr( "Mark" ), QString::null, 0, ag, NULL, true ); 299 m_buttonAction[2] = new QAction( tr( "Mark" ), QString::null, 0, ag, NULL, true );
252 300
301 m_buttonAction[3] = new QAction( tr( "Fullscreen" ), QString::null, 0, ag, NULL, true );
302
253 ag->addTo(spacemenu); 303 ag->addTo(spacemenu);
254 304
255 connect(ag, SIGNAL( selected(QAction*) ), this, SLOT( buttonActionSelected(QAction*) ) ); 305 connect(ag, SIGNAL( selected(QAction*) ), this, SLOT( buttonActionSelected(QAction*) ) );
256 306
307 file->insertSeparator();
308
309 ag = new QActionGroup(this);
310 ag->setExclusive(false);
311 QPopupMenu *encoding = new QPopupMenu(this);
312 file->insertItem( tr( "Navigation" ), encoding );
313
314 a = m_scrollButton = new QAction( tr( "Scroll" ), Resource::loadPixmap( PICDIR "panel-arrow-down" ), QString::null, 0, ag, 0, true );
257 315
258 a = m_scrollButton = new QAction( tr( "Scroll" ), Resource::loadPixmap( "opie-reader/panel-arrow-down" ), QString::null, 0, this, 0, true );
259// connect( a, SIGNAL( activated() ), this, SLOT( autoScroll() ) );
260 a->setOn(false); 316 a->setOn(false);
261 connect( a, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) ); 317 connect( a, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) );
262 file->insertSeparator();
263 a->addTo( bar ); 318 a->addTo( bar );
264 a->addTo( file ); 319
320 a = new QAction( tr( "Jump" ), QString::null, 0, ag, NULL);
321 connect( a, SIGNAL( activated() ), this, SLOT( jump() ) );
322
323 a = new QAction( tr( "Page/Line Scroll" ), QString::null, 0, ag, NULL, true );
324 connect( a, SIGNAL( toggled(bool) ), this, SLOT( pagemode(bool) ) );
325 a->setOn(reader->m_bpagemode);
326
327 a = new QAction( tr( "Set Overlap" ), QString::null, 0, ag, NULL);
328 connect( a, SIGNAL( activated() ), this, SLOT( setoverlap() ) );
329
330 a = new QAction( tr( "Use Cursor" ), QString::null, 0, ag, NULL, true );
331 connect( a, SIGNAL( toggled(bool) ), this, SLOT( navkeys(bool) ) );
332 a->setOn(reader->m_navkeys);
333
334 ag->addTo(encoding);
265 335
266 /* 336 /*
267 a = new QAction( tr( "Find" ), QString::null, 0, this, NULL, true ); 337 a = new QAction( tr( "Find" ), QString::null, 0, this, NULL, true );
@@ -272,18 +342,6 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
272 // connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) ); 342 // connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) );
273 a->addTo( file ); 343 a->addTo( file );
274 */ 344 */
275 a = new QAction( tr( "Jump" ), QString::null, 0, this, NULL);
276 connect( a, SIGNAL( activated() ), this, SLOT( jump() ) );
277 a->addTo( file );
278
279 a = new QAction( tr( "Page/Line Scroll" ), QString::null, 0, this, NULL, true );
280 connect( a, SIGNAL( toggled(bool) ), this, SLOT( pagemode(bool) ) );
281 a->setOn(reader->m_bpagemode);
282 a->addTo( file );
283
284 a = new QAction( tr( "Set Overlap" ), QString::null, 0, this, NULL);
285 connect( a, SIGNAL( activated() ), this, SLOT( setoverlap() ) );
286 a->addTo( file );
287 345
288 file->insertSeparator(); 346 file->insertSeparator();
289 347
@@ -298,7 +356,7 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
298 356
299 ag = new QActionGroup(this); 357 ag = new QActionGroup(this);
300 ag->setExclusive(false); 358 ag->setExclusive(false);
301 QPopupMenu *encoding = new QPopupMenu(this); 359 encoding = new QPopupMenu(this);
302 file->insertItem( tr( "Target" ), encoding ); 360 file->insertItem( tr( "Target" ), encoding );
303 361
304 a = new QAction( tr( "Annotation" ), QString::null, 0, ag, NULL, true ); 362 a = new QAction( tr( "Annotation" ), QString::null, 0, ag, NULL, true );
@@ -345,6 +403,17 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
345 a->addTo( file ); 403 a->addTo( file );
346 404
347 405
406 m_fullscreen = false;
407 a = m_actFullscreen = new QAction( tr( "Fullscreen" ), QString::null, 0, this, NULL, true );
408 connect( a, SIGNAL( toggled(bool) ), this, SLOT( setfullscreen(bool) ) );
409 a->setOn(m_fullscreen);
410 a->addTo( file );
411
412 a = new QAction( tr( "Continuous" ), QString::null, 0, ag, NULL, true );
413 connect( a, SIGNAL( toggled(bool) ), this, SLOT( setcontinuous(bool) ) );
414 a->setOn(reader->m_continuousDocument);
415 a->addTo( file );
416
348 a = m_bkmkAvail = new QAction( tr( "Annotation" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 417 a = m_bkmkAvail = new QAction( tr( "Annotation" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
349 connect( a, SIGNAL( activated() ), this, SLOT( showAnnotation() ) ); 418 connect( a, SIGNAL( activated() ), this, SLOT( showAnnotation() ) );
350 a->addTo( bar ); 419 a->addTo( bar );
@@ -395,6 +464,10 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
395 connect( a, SIGNAL( toggled(bool) ), this, SLOT( dehyphen(bool) ) ); 464 connect( a, SIGNAL( toggled(bool) ), this, SLOT( dehyphen(bool) ) );
396// a->addTo( format ); 465// a->addTo( format );
397 466
467 a = new QAction( tr( "Single Space" ), QString::null, 0, ag, NULL, true );
468 a->setOn(reader->bonespace);
469 connect( a, SIGNAL( toggled(bool) ), this, SLOT( onespace(bool) ) );
470
398 a = new QAction( tr( "Unindent" ), QString::null, 0, ag, NULL, true ); 471 a = new QAction( tr( "Unindent" ), QString::null, 0, ag, NULL, true );
399 connect( a, SIGNAL( toggled(bool) ), this, SLOT( unindent(bool) ) ); 472 connect( a, SIGNAL( toggled(bool) ), this, SLOT( unindent(bool) ) );
400 a->setOn(reader->bunindent); 473 a->setOn(reader->bunindent);
@@ -416,7 +489,11 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
416 489
417 a = new QAction( tr( "Indent-" ), QString::null, 0, ag, NULL ); 490 a = new QAction( tr( "Indent-" ), QString::null, 0, ag, NULL );
418 connect( a, SIGNAL( activated() ), this, SLOT( indentminus() ) ); 491 connect( a, SIGNAL( activated() ), this, SLOT( indentminus() ) );
419 492#ifdef REPALM
493 a = new QAction( tr( "Repalm" ), QString::null, 0, ag, NULL, true );
494 a->setOn(reader->brepalm);
495 connect( a, SIGNAL( toggled(bool) ), this, SLOT( repalm(bool) ) );
496#endif
420 a = new QAction( tr( "Remap" ), QString::null, 0, ag, NULL, true ); 497 a = new QAction( tr( "Remap" ), QString::null, 0, ag, NULL, true );
421 connect( a, SIGNAL( toggled(bool) ), this, SLOT( remap(bool) ) ); 498 connect( a, SIGNAL( toggled(bool) ), this, SLOT( remap(bool) ) );
422 a->setOn(reader->bremap); 499 a->setOn(reader->bremap);
@@ -429,17 +506,20 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
429 506
430 // a = new QAction( tr( "Zoom" ), QString::null, 0, this, NULL, true ); 507 // a = new QAction( tr( "Zoom" ), QString::null, 0, this, NULL, true );
431 // a = new QAction( tr( "Zoom" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 ); 508 // a = new QAction( tr( "Zoom" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 );
432 a = new QAction( tr( "Zoom" ), QString::null, 0, this);
433 connect( a, SIGNAL( activated() ), this, SLOT( TBDzoom() ) );
434 format->insertSeparator(); 509 format->insertSeparator();
510 a = new QAction( tr( "Zoom In" ), QString::null, 0, this);
511 connect( a, SIGNAL( activated() ), this, SLOT( zoomin() ) );
512 a->addTo( format );
513 a = new QAction( tr( "Zoom Out" ), QString::null, 0, this);
514 connect( a, SIGNAL( activated() ), this, SLOT( zoomout() ) );
435 a->addTo( format ); 515 a->addTo( format );
436 // a->addTo( editBar ); 516 // a->addTo( editBar );
517 format->insertSeparator();
437 518
438 519
439 a = new QAction( tr( "Ideogram/Word" ), QString::null, 0, this, NULL, true ); 520 a = new QAction( tr( "Ideogram/Word" ), QString::null, 0, this, NULL, true );
440 connect( a, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) ); 521 connect( a, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) );
441 a->setOn(reader->m_bMonoSpaced); 522 a->setOn(reader->m_bMonoSpaced);
442 format->insertSeparator();
443 a->addTo( format ); 523 a->addTo( format );
444 524
445 a = new QAction( tr( "Set width" ), QString::null, 0, this, NULL); 525 a = new QAction( tr( "Set width" ), QString::null, 0, this, NULL);
@@ -579,6 +659,7 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
579 659
580 m_fontBar->setHorizontalStretchable( TRUE ); 660 m_fontBar->setHorizontalStretchable( TRUE );
581 661
662 qDebug("Font selector");
582 m_fontSelector = new QComboBox(false, m_fontBar); 663 m_fontSelector = new QComboBox(false, m_fontBar);
583 m_fontBar->setStretchableWidget( m_fontSelector ); 664 m_fontBar->setStretchableWidget( m_fontSelector );
584 { 665 {
@@ -592,8 +673,8 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
592 if (reader->m_fontname == *nm) 673 if (reader->m_fontname == *nm)
593 { 674 {
594 realfont = true; 675 realfont = true;
595 break;
596 } 676 }
677 if (*nm == "courier") reader->m_fontControl.hasCourier(true);
597 } 678 }
598 if (!realfont) reader->m_fontname = flist[0]; 679 if (!realfont) reader->m_fontname = flist[0];
599 } // delete the FontDatabase!!! 680 } // delete the FontDatabase!!!
@@ -607,17 +688,65 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
607 connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ), 688 connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ),
608 this, SLOT( msgHandler(const QCString&, const QByteArray&) ) ); 689 this, SLOT( msgHandler(const QCString&, const QByteArray&) ) );
609 690
610 691 qDebug("Initing");
611 reader->init(); 692 reader->init();
693 qDebug("Inited");
694 m_EncodingAction[reader->m_encd]->setOn(true);
695 m_buttonAction[m_spaceTarget]->setOn(true);
696 qDebug("fonting");
697 do_setfont(reader->m_fontname);
612 if (!reader->m_lastfile.isEmpty()) 698 if (!reader->m_lastfile.isEmpty())
613 { 699 {
700 qDebug("doclnk");
701 //doc = new DocLnk(reader->m_lastfile);
702 qDebug("doclnk done");
703 if (pOpenlist != NULL)
704 {
705
706/*
707 int ind = 0;
708 Bkmk* p = (*pOpenlist)[ind];
709 while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile)
710 {
711 p = (*pOpenlist)[++ind];
712 }
713*/
714 Bkmk* p = NULL;
715 for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++)
716 {
717 p = iter.pContent();
718 if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile)
719 {
720 break;
721 }
722 qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name()));
723 p = NULL;
724 }
725 if (p != NULL)
726 {
727 qDebug("openfrombkmk");
728 openfrombkmk(p);
729 }
730 else
731 {
732 qDebug("openfile");
614 openFile( reader->m_lastfile ); 733 openFile( reader->m_lastfile );
615 doc = new DocLnk(reader->m_lastfile);
616 } 734 }
617 m_EncodingAction[reader->m_encd]->setOn(true);
618 m_buttonAction[m_spaceTarget]->setOn(true);
619 do_setfont(reader->m_fontname);
620} 735}
736 else
737 {
738 qDebug("Openfile 2");
739 if (!reader->m_lastfile.isNull())
740 openFile( reader->m_lastfile );
741 }
742 }
743 qApp->processEvents();
744 reader->bDoUpdates = true;
745 reader->update();
746 qDebug("finished update");
747}
748
749void QTReaderApp::suspend() { reader->suspend(); }
621 750
622void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data) 751void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data)
623{ 752{
@@ -630,13 +759,13 @@ void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data)
630 { 759 {
631 QString info; 760 QString info;
632 stream >> info; 761 stream >> info;
633 QMessageBox::information(this, "OpieReader", info); 762 QMessageBox::information(this, PROGNAME, info);
634 } 763 }
635 else if ( msg == "warn(QString)" ) 764 else if ( msg == "warn(QString)" )
636 { 765 {
637 QString info; 766 QString info;
638 stream >> info; 767 stream >> info;
639 QMessageBox::warning(this, "OpieReader", info); 768 QMessageBox::warning(this, PROGNAME, info);
640 } 769 }
641 770
642 771
@@ -751,7 +880,7 @@ void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data)
751 pos = reader->locate(); 880 pos = reader->locate();
752 if (!reader->buffdoc.getline(&test,reader->width())) 881 if (!reader->buffdoc.getline(&test,reader->width()))
753 { 882 {
754 QMessageBox::information(this, "OpieReader", QString("Can't find\n")+info); 883 QMessageBox::information(this, PROGNAME, QString("Can't find\n")+info);
755 pos = start; 884 pos = start;
756 break; 885 break;
757 } 886 }
@@ -764,6 +893,20 @@ void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data)
764 stream >> info; 893 stream >> info;
765 stripcr(info); 894 stripcr(info);
766 } 895 }
896 else if ( msg == "Layout/Single Space" )
897 {
898 int info;
899 stream >> info;
900 onespace(info);
901 }
902#ifdef REPALM
903 else if ( msg == "Layout/Repalm(int)" )
904 {
905 int info;
906 stream >> info;
907 repalm(info);
908 }
909#endif
767 else if ( msg == "Markup/Auto(int)" ) 910 else if ( msg == "Markup/Auto(int)" )
768 { 911 {
769 int info; 912 int info;
@@ -876,6 +1019,22 @@ ActionTypes QTReaderApp::ActNameToInt(const QString& _enc)
876 return cesAutoScroll; 1019 return cesAutoScroll;
877} 1020}
878 1021
1022void QTReaderApp::setfullscreen(bool sfs)
1023{
1024 reader->bDoUpdates = false;
1025 m_fullscreen = sfs;
1026 showEditTools();
1027 qApp->processEvents();
1028 reader->bDoUpdates = true;
1029 reader->update();
1030}
1031
1032void QTReaderApp::setcontinuous(bool sfs)
1033{
1034 reader->setContinuous(sfs);
1035 reader->refresh();
1036}
1037
879int QTReaderApp::EncNameToInt(const QString& _enc) 1038int QTReaderApp::EncNameToInt(const QString& _enc)
880{ 1039{
881 for (int i = 0; i < MAX_ENCODING; i++) 1040 for (int i = 0; i < MAX_ENCODING; i++)
@@ -910,16 +1069,17 @@ QTReaderApp::~QTReaderApp()
910void QTReaderApp::autoScroll(bool _b) 1069void QTReaderApp::autoScroll(bool _b)
911{ 1070{
912 reader->setautoscroll(_b); 1071 reader->setautoscroll(_b);
1072 setScrollState(reader->m_autoScroll);
913} 1073}
914 1074
915void QTReaderApp::TBD() 1075void QTReaderApp::zoomin()
916{ 1076{
917 QMessageBox::information(this, "OpieReader", "Not yet implemented", 1); 1077 reader->zoomin();
918} 1078}
919 1079
920void QTReaderApp::TBDzoom() 1080void QTReaderApp::zoomout()
921{ 1081{
922 QMessageBox::information(this, "OpieReader", "Zooming is done interactively\nTry left/right cursor keys", 1); 1082 reader->zoomout();
923} 1083}
924 1084
925void QTReaderApp::clearBkmkList() 1085void QTReaderApp::clearBkmkList()
@@ -929,6 +1089,78 @@ void QTReaderApp::clearBkmkList()
929 m_fBkmksChanged = false; 1089 m_fBkmksChanged = false;
930} 1090}
931 1091
1092void QTReaderApp::fileClose()
1093{
1094 if (pOpenlist != NULL)
1095 {
1096 int ind = 0;
1097 Bkmk* p = (*pOpenlist)[ind];
1098 while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile)
1099 {
1100 p = (*pOpenlist)[++ind];
1101 }
1102 if (p != NULL) pOpenlist->erase(ind);
1103 switch (QMessageBox::information ( this , PROGNAME, "What do you want to delete?", "Nothing", "Marks", "Marks\nFile", 1, 0 ))
1104 {
1105 case 0:
1106 default:
1107 break;
1108 case 2:
1109 unlink((const char*)reader->m_lastfile);
1110 case 1:
1111 unlink((const char *)Global::applicationFileName(APPDIR, reader->m_string));
1112 }
1113 }
1114
1115 fileOpen2();
1116}
1117
1118void QTReaderApp::updatefileinfo()
1119{
1120 if (reader->m_string.isNull()) return;
1121 if (reader->m_lastfile.isNull()) return;
1122 tchar* nm = fromQString(reader->m_string);
1123 tchar* fl = fromQString(reader->m_lastfile);
1124 qDebug("Lastfile:%x", fl);
1125 bool notadded = true;
1126 if (pOpenlist == NULL) pOpenlist = new CList<Bkmk>;
1127 else
1128 {
1129 for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++)
1130 {
1131 if (ustrcmp(CFiledata(iter->anno()).name(), fl) == 0)
1132 {
1133 iter->value(reader->pagelocate());
1134 unsigned short dlen;
1135 unsigned char* data;
1136 CFiledata fd(iter->anno());
1137 reader->setSaveData(data, dlen, fd.content(), fd.length());
1138 qDebug("Filedata(1):%u, %u", fd.length(), dlen);
1139 // getstate(data, dlen);
1140 iter->setAnno(data, dlen);
1141 notadded = false;
1142 delete [] data;
1143 break;
1144 }
1145 }
1146 }
1147 qDebug("Added?:%x", notadded);
1148 if (notadded)
1149 {
1150 struct stat fnstat;
1151 stat((const char *)reader->m_lastfile, &fnstat);
1152 CFiledata fd(fnstat.st_mtime, fl);
1153 unsigned short dlen;
1154 unsigned char* data;
1155 reader->setSaveData(data, dlen, fd.content(), fd.length());
1156 pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate()));
1157 qDebug("Filedata(2):%u, %u", fd.length(), dlen);
1158 delete [] data;
1159 }
1160 delete [] nm;
1161 delete [] fl;
1162}
1163
932void QTReaderApp::fileOpen() 1164void QTReaderApp::fileOpen()
933{ 1165{
934/* 1166/*
@@ -937,11 +1169,19 @@ void QTReaderApp::fileOpen()
937 if (regVisible) regBar->hide(); 1169 if (regVisible) regBar->hide();
938 if (searchVisible) searchBar->hide(); 1170 if (searchVisible) searchBar->hide();
939*/ 1171*/
1172 qDebug("fileOpen");
1173// if (!reader->m_lastfile.isEmpty())
1174 updatefileinfo();
1175 fileOpen2();
1176}
1177
1178void QTReaderApp::fileOpen2()
1179{
940 if (pBkmklist != NULL) 1180 if (pBkmklist != NULL)
941 { 1181 {
942 if (m_fBkmksChanged) 1182 if (m_fBkmksChanged)
943 { 1183 {
944 if (QMessageBox::warning(this, "OpieReader", "Save bookmarks?", "Save", "Don't bother") == 0) 1184 if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0)
945 savebkmks(); 1185 savebkmks();
946 } 1186 }
947 delete pBkmklist; 1187 delete pBkmklist;
@@ -953,19 +1193,45 @@ void QTReaderApp::fileOpen()
953 editorStack->raiseWidget( fileSelector ); 1193 editorStack->raiseWidget( fileSelector );
954 fileSelector->reread(); 1194 fileSelector->reread();
955*/ 1195*/
956 fileBrowser* fb = new fileBrowser(this,"OpieReader",TRUE, 1196 if (pOpenlist != NULL)
1197 {
1198 m_nRegAction = cOpenFile;
1199 listbkmk(pOpenlist, "Browse");
1200 }
1201 else
1202 {
1203 QString fn = usefilebrowser();
1204 if (!fn.isEmpty() && QFileInfo(fn).isFile())
1205 {
1206 openFile(fn);
1207 }
1208 reader->setFocus();
1209 }
1210}
1211
1212QString QTReaderApp::usefilebrowser()
1213{
1214 fileBrowser* fb = new fileBrowser(this,"QTReader",TRUE,
957 0, 1215 0,
958// WStyle_Customize | WStyle_NoBorderEx, 1216// WStyle_Customize | WStyle_NoBorderEx,
959 "*", QFileInfo(reader->m_lastfile).dirPath(true)); 1217 "*", QFileInfo(reader->m_lastfile).dirPath(true));
960 1218
1219
1220 QString fn;
961 if (fb->exec()) 1221 if (fb->exec())
962 { 1222 {
963 QString fn(fb->fileList[0]); 1223 fn = fb->fileList[0];
964// fb->populateList();
965 if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn);
966 } 1224 }
1225 qDebug("Selected %s", (const char*)fn);
967 delete fb; 1226 delete fb;
968 reader->setFocus(); 1227 return fn;
1228}
1229
1230void QTReaderApp::showgraphic(QPixmap& pm)
1231{
1232 m_graphicwin->setPixmap(pm);
1233 editorStack->raiseWidget( m_graphicwin );
1234 m_graphicwin->setFocus();
969} 1235}
970 1236
971void QTReaderApp::showinfo() 1237void QTReaderApp::showinfo()
@@ -973,7 +1239,7 @@ void QTReaderApp::showinfo()
973 unsigned long fs, ts, pl; 1239 unsigned long fs, ts, pl;
974 if (reader->empty()) 1240 if (reader->empty())
975 { 1241 {
976 QMessageBox::information(this, "OpieReader", "No file loaded", 1); 1242 QMessageBox::information(this, PROGNAME, "No file loaded", 1);
977 } 1243 }
978 else 1244 else
979 { 1245 {
@@ -1020,7 +1286,7 @@ void QTReaderApp::addAnno(const QString& name, const QString& text)
1020 { 1286 {
1021 if (name.isEmpty()) 1287 if (name.isEmpty())
1022 { 1288 {
1023 QMessageBox::information(this, "OpieReader", "Need a name for the bookmark\nPlease try again", 1); 1289 QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nPlease try again", 1);
1024 } 1290 }
1025 else 1291 else
1026 { 1292 {
@@ -1077,7 +1343,7 @@ void QTReaderApp::addanno()
1077{ 1343{
1078 if (reader->empty()) 1344 if (reader->empty())
1079 { 1345 {
1080 QMessageBox::information(this, "OpieReader", "No file loaded", 1); 1346 QMessageBox::information(this, PROGNAME, "No file loaded", 1);
1081 } 1347 }
1082 else 1348 else
1083 { 1349 {
@@ -1086,6 +1352,7 @@ void QTReaderApp::addanno()
1086 m_annoWin->setPosn(reader->pagelocate()); 1352 m_annoWin->setPosn(reader->pagelocate());
1087 m_annoIsEditing = true; 1353 m_annoIsEditing = true;
1088 editorStack->raiseWidget( m_annoWin ); 1354 editorStack->raiseWidget( m_annoWin );
1355 Global::showInputMethod();
1089 m_annoWin->setFocus(); 1356 m_annoWin->setFocus();
1090 } 1357 }
1091} 1358}
@@ -1132,18 +1399,28 @@ void QTReaderApp::editCopy()
1132 1399
1133void QTReaderApp::pageup() 1400void QTReaderApp::pageup()
1134{ 1401{
1135 reader->goUp(); 1402 reader->NavUp();
1136} 1403}
1137 1404
1138void QTReaderApp::pagedn() 1405void QTReaderApp::pagedn()
1139{ 1406{
1140 reader->goDown(); 1407 reader->NavDown();
1141} 1408}
1142 1409
1143void QTReaderApp::stripcr(bool _b) 1410void QTReaderApp::stripcr(bool _b)
1144{ 1411{
1145 reader->setstripcr(_b); 1412 reader->setstripcr(_b);
1146} 1413}
1414void QTReaderApp::onespace(bool _b)
1415{
1416 reader->setonespace(_b);
1417}
1418#ifdef REPALM
1419void QTReaderApp::repalm(bool _b)
1420{
1421 reader->setrepalm(_b);
1422}
1423#endif
1147void QTReaderApp::remap(bool _b) 1424void QTReaderApp::remap(bool _b)
1148{ 1425{
1149 reader->setremap(_b); 1426 reader->setremap(_b);
@@ -1188,7 +1465,10 @@ void QTReaderApp::pagemode(bool _b)
1188{ 1465{
1189 reader->setpagemode(_b); 1466 reader->setpagemode(_b);
1190} 1467}
1191 1468void QTReaderApp::navkeys(bool _b)
1469{
1470 reader->m_navkeys = _b;
1471}
1192void QTReaderApp::monospace(bool _b) 1472void QTReaderApp::monospace(bool _b)
1193{ 1473{
1194 reader->setmono(_b); 1474 reader->setmono(_b);
@@ -1231,7 +1511,7 @@ void QTReaderApp::do_overlap(const QString& lcn)
1231 reader->m_overlap = ulcn; 1511 reader->m_overlap = ulcn;
1232 } 1512 }
1233 else 1513 else
1234 QMessageBox::information(this, "OpieReader", "Must be a number"); 1514 QMessageBox::information(this, PROGNAME, "Must be a number");
1235} 1515}
1236 1516
1237void QTReaderApp::do_mono(const QString& lcn) 1517void QTReaderApp::do_mono(const QString& lcn)
@@ -1246,7 +1526,7 @@ void QTReaderApp::do_mono(const QString& lcn)
1246// reader->setmono(true); 1526// reader->setmono(true);
1247 } 1527 }
1248 else 1528 else
1249 QMessageBox::information(this, "OpieReader", "Must be a number"); 1529 QMessageBox::information(this, PROGNAME, "Must be a number");
1250} 1530}
1251 1531
1252/* 1532/*
@@ -1264,6 +1544,7 @@ void QTReaderApp::editFind()
1264#ifdef __ISEARCH 1544#ifdef __ISEARCH
1265 searchStack = new QStack<searchrecord>; 1545 searchStack = new QStack<searchrecord>;
1266#endif 1546#endif
1547 Global::showInputMethod();
1267 searchBar->show(); 1548 searchBar->show();
1268 searchVisible = TRUE; 1549 searchVisible = TRUE;
1269 searchEdit->setFocus(); 1550 searchEdit->setFocus();
@@ -1291,6 +1572,7 @@ void QTReaderApp::findClose()
1291{ 1572{
1292 searchVisible = FALSE; 1573 searchVisible = FALSE;
1293 searchEdit->setText(""); 1574 searchEdit->setText("");
1575 Global::hideInputMethod();
1294 searchBar->hide(); 1576 searchBar->hide();
1295#ifdef __ISEARCH 1577#ifdef __ISEARCH
1296// searchStack = new QStack<searchrecord>; 1578// searchStack = new QStack<searchrecord>;
@@ -1308,6 +1590,7 @@ void QTReaderApp::regClose()
1308 regVisible = FALSE; 1590 regVisible = FALSE;
1309 regEdit->setText(""); 1591 regEdit->setText("");
1310 regBar->hide(); 1592 regBar->hide();
1593 Global::hideInputMethod();
1311 reader->setFocus(); 1594 reader->setFocus();
1312} 1595}
1313 1596
@@ -1318,8 +1601,17 @@ bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg)
1318#endif 1601#endif
1319{ 1602{
1320 bool ret = true; 1603 bool ret = true;
1604 unsigned long fs, ts;
1605 reader->sizes(fs,ts);
1321 size_t pos = reader->locate(); 1606 size_t pos = reader->locate();
1322 reader->buffdoc.getline(&test,reader->width()); 1607 reader->buffdoc.getline(&test,reader->width());
1608 pbar->show();
1609 pbar->resize(width(), editBar->height());
1610 pbar->reset();
1611 int lastpc = (100*pos)/ts;
1612 pbar->setProgress(lastpc);
1613 qApp->processEvents();
1614 reader->setFocus();
1323#ifdef __ISEARCH 1615#ifdef __ISEARCH
1324 while (strstr(test.data(),(const tchar*)arg) == NULL) 1616 while (strstr(test.data(),(const tchar*)arg) == NULL)
1325#else 1617#else
@@ -1331,6 +1623,16 @@ bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg)
1331#endif 1623#endif
1332 { 1624 {
1333 pos = reader->locate(); 1625 pos = reader->locate();
1626 unsigned int lcn = reader->locate();
1627 int pc = (100*pos)/ts;
1628 if (pc != lastpc)
1629 {
1630 pbar->setProgress(pc);
1631 qApp->processEvents();
1632 reader->setFocus();
1633 lastpc = pc;
1634 }
1635
1334 if (!reader->buffdoc.getline(&test,reader->width())) 1636 if (!reader->buffdoc.getline(&test,reader->width()))
1335 { 1637 {
1336 if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) 1638 if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2)
@@ -1342,6 +1644,7 @@ bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg)
1342 break; 1644 break;
1343 } 1645 }
1344 } 1646 }
1647 pbar->hide();
1345 reader->locate(pos); 1648 reader->locate(pos);
1346 return ret; 1649 return ret;
1347} 1650}
@@ -1388,56 +1691,124 @@ void QTReaderApp::search()
1388 1691
1389void QTReaderApp::openFile( const QString &f ) 1692void QTReaderApp::openFile( const QString &f )
1390{ 1693{
1391 openFile(DocLnk(f)); 1694 qDebug("File:%s", (const char*)f);
1392} 1695// openFile(DocLnk(f));
1393 1696//}
1394void QTReaderApp::openFile( const DocLnk &f ) 1697//
1395{ 1698//void QTReaderApp::openFile( const DocLnk &f )
1699//{
1396 clear(); 1700 clear();
1397 FileManager fm; 1701 QFileInfo fm(f);
1398 if ( fm.exists( f ) ) 1702 if ( fm.exists() )
1399 { 1703 {
1400// QMessageBox::information(0, "Progress", "Calling fileNew()"); 1704// QMessageBox::information(0, "Progress", "Calling fileNew()");
1401 1705
1402 clear(); 1706 if (fm.extension( FALSE ) == "desktop")
1403 1707 {
1404 // editorStack->raiseWidget( reader ); 1708 DocLnk d(f);
1405 1709 QFileInfo fnew(d.file());
1406 // reader->setFocus(); 1710 fm = fnew;
1711 if (!fm.exists()) return;
1712 }
1407 1713
1408 // QMessageBox::information(0, "DocLnk", "Begin"); 1714 clear();
1409 doc = new DocLnk(f);
1410 // QMessageBox::information(0, "DocLnk done", doc->file());
1411 // QMessageBox::information(0, "Progress", "Calling setText()");
1412 // QMessageBox::information(0, "Progress", "Textset");
1413 1715
1414 // updateCaption(); 1716 reader->setText(fm.baseName(), fm.absFilePath());
1415 showEditTools(); 1717 showEditTools();
1416 reader->setText(doc->name(), doc->file());
1417 readbkmks(); 1718 readbkmks();
1418 } 1719 }
1419 else 1720 else
1420 { 1721 {
1421 QMessageBox::information(this, "OpieReader", "File does not exist"); 1722 QMessageBox::information(this, PROGNAME, "File does not exist");
1422 } 1723 }
1423 1724
1424} 1725}
1726/*
1727void QTReaderApp::resizeEvent(QResizeEvent* e)
1728{
1729 if (m_fullscreen)
1730 {
1731 showNormal();
1732 showFullScreen();
1733 }
1734}
1735*/
1736void QTReaderApp::keyPressEvent(QKeyEvent* e)
1737{
1738 if (m_fullscreen)
1739 {
1740 switch(e->key())
1741 {
1742 case Key_Escape:
1743 m_actFullscreen->setOn(false);
1744 if (m_fullscreen)
1745 {
1746 qDebug("Fullscreen already set - remove this!");
1747 }
1748 else
1749 {
1750 m_fullscreen = false;
1751 reader->bDoUpdates = false;
1752 showEditTools();
1753 qApp->processEvents();
1754 reader->bDoUpdates = true;
1755 reader->update();
1756 }
1757 e->accept();
1758 break;
1759 default:
1760 e->ignore();
1761 }
1762 }
1763 else
1764 {
1765 e->ignore();
1766 }
1767}
1425 1768
1426void QTReaderApp::showEditTools() 1769void QTReaderApp::showEditTools()
1427{ 1770{
1428 if ( !doc ) 1771// if ( !doc )
1429 close(); 1772 //close();
1430// fileSelector->hide(); 1773 if (m_fullscreen)
1431//tjw menu->show(); 1774 {
1775 editBar->hide();
1776 searchBar->hide();
1777 regBar->hide();
1778 Global::hideInputMethod();
1779 m_fontBar->hide();
1780 //showNormal();
1781 showFullScreen();
1782 }
1783 else
1784 {
1785 qDebug("him");
1786 Global::hideInputMethod();
1787 qDebug("eb");
1432 editBar->show(); 1788 editBar->show();
1433 if ( searchVisible ) 1789 if ( searchVisible )
1790 {
1791 Global::showInputMethod();
1434 searchBar->show(); 1792 searchBar->show();
1793 }
1435 if ( regVisible ) 1794 if ( regVisible )
1795 {
1796 Global::showInputMethod();
1436 regBar->show(); 1797 regBar->show();
1798 }
1437 if (m_fontVisible) m_fontBar->show(); 1799 if (m_fontVisible) m_fontBar->show();
1800 qDebug("sn");
1801 showNormal();
1802 qDebug("sm");
1803 showMaximized();
1804 //setCentralWidget(reader);
1805 }
1438 1806
1807 qDebug("uc");
1439 updateCaption(); 1808 updateCaption();
1809 qDebug("rw");
1440 editorStack->raiseWidget( reader ); 1810 editorStack->raiseWidget( reader );
1811 qDebug("sf");
1441 reader->setFocus(); 1812 reader->setFocus();
1442} 1813}
1443/* 1814/*
@@ -1473,39 +1844,45 @@ void QTReaderApp::save()
1473 1844
1474void QTReaderApp::clear() 1845void QTReaderApp::clear()
1475{ 1846{
1476 if (doc != 0) 1847// if (doc != 0)
1477 { 1848// {
1478// QMessageBox::information(this, "QTReader", "Deleting doc", 1); 1849// QMessageBox::information(this, PROGNAME, "Deleting doc", 1);
1479 delete doc; 1850 //delete doc;
1480// QMessageBox::information(this, "QTReader", "Deleted doc", 1); 1851// QMessageBox::information(this, PROGNAME, "Deleted doc", 1);
1481 doc = 0; 1852 //doc = 0;
1482 } 1853 // }
1483 reader->clear(); 1854 reader->clear();
1484} 1855}
1485 1856
1486void QTReaderApp::updateCaption() 1857void QTReaderApp::updateCaption()
1487{ 1858{
1488 if ( !doc ) 1859// if ( !doc )
1489 setCaption( tr("OpieReader") ); 1860 //setCaption( tr("QTReader") );
1490 else { 1861// else {
1491 QString s = doc->name(); 1862 //QString s = doc->name();
1492 if ( s.isEmpty() ) 1863 //if ( s.isEmpty() )
1493 s = tr( "Unnamed" ); 1864 // s = tr( "Unnamed" );
1494 setCaption( s + " - " + tr("OpieReader") ); 1865 setCaption( reader->m_string + " - " + tr(SHORTPROGNAME) );
1495 } 1866// }
1496} 1867}
1497 1868
1498void QTReaderApp::setDocument(const QString& fileref) 1869void QTReaderApp::setDocument(const QString& fileref)
1499{ 1870{
1500 bFromDocView = TRUE; 1871 bFromDocView = TRUE;
1501//QMessageBox::information(0, "setDocument", fileref); 1872//QMessageBox::information(0, "setDocument", fileref);
1502 openFile(DocLnk(fileref)); 1873 openFile(fileref);
1503// showEditTools(); 1874// showEditTools();
1504} 1875}
1505 1876
1506void QTReaderApp::closeEvent( QCloseEvent *e ) 1877void QTReaderApp::closeEvent( QCloseEvent *e )
1507{ 1878{
1508 if (m_dontSave) 1879 if (m_fullscreen)
1880 {
1881 m_fullscreen = false;
1882 showEditTools();
1883 e->accept();
1884 }
1885 else if (m_dontSave)
1509 { 1886 {
1510 e->accept(); 1887 e->accept();
1511 } 1888 }
@@ -1521,24 +1898,27 @@ void QTReaderApp::closeEvent( QCloseEvent *e )
1521 if (regVisible) 1898 if (regVisible)
1522 { 1899 {
1523 regBar->hide(); 1900 regBar->hide();
1901 Global::hideInputMethod();
1524 regVisible = false; 1902 regVisible = false;
1525 return; 1903 return;
1526 } 1904 }
1527 if (searchVisible) 1905 if (searchVisible)
1528 { 1906 {
1529 searchBar->hide(); 1907 searchBar->hide();
1908 Global::hideInputMethod();
1530 searchVisible = false; 1909 searchVisible = false;
1531 return; 1910 return;
1532 } 1911 }
1533 if (m_fBkmksChanged && pBkmklist != NULL) 1912 if (m_fBkmksChanged && pBkmklist != NULL)
1534 { 1913 {
1535 if (QMessageBox::warning(this, "OpieReader", "Save bookmarks?", "Save", "Don't bother") == 0) 1914 if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0)
1536 savebkmks(); 1915 savebkmks();
1537 delete pBkmklist; 1916 delete pBkmklist;
1538 pBkmklist = NULL; 1917 pBkmklist = NULL;
1539 m_fBkmksChanged = false; 1918 m_fBkmksChanged = false;
1540 } 1919 }
1541 bFromDocView = FALSE; 1920 bFromDocView = FALSE;
1921 updatefileinfo();
1542 saveprefs(); 1922 saveprefs();
1543 e->accept(); 1923 e->accept();
1544 } 1924 }
@@ -1552,24 +1932,29 @@ void QTReaderApp::closeEvent( QCloseEvent *e )
1552void QTReaderApp::do_gotomark() 1932void QTReaderApp::do_gotomark()
1553{ 1933{
1554 m_nRegAction = cGotoBkmk; 1934 m_nRegAction = cGotoBkmk;
1555 listbkmk(); 1935 listbkmk(pBkmklist);
1556} 1936}
1557 1937
1558void QTReaderApp::do_delmark() 1938void QTReaderApp::do_delmark()
1559{ 1939{
1560 m_nRegAction = cDelBkmk; 1940 m_nRegAction = cDelBkmk;
1561 listbkmk(); 1941 listbkmk(pBkmklist);
1562} 1942}
1563 1943
1564void QTReaderApp::listbkmk() 1944void QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab)
1565{ 1945{
1566 bkmkselector->clear(); 1946 bkmkselector->clear();
1947 if (_lab.isNull())
1948 bkmkselector->setText("Cancel");
1949 else
1950 bkmkselector->setText(_lab);
1567 int cnt = 0; 1951 int cnt = 0;
1568 if (pBkmklist != NULL) 1952 if (plist != NULL)
1569 { 1953 {
1570 for (CList<Bkmk>::iterator i = pBkmklist->begin(); i != pBkmklist->end(); i++) 1954 for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++)
1571 { 1955 {
1572#ifdef _UNICODE 1956#ifdef _UNICODE
1957 qDebug("Item:%s", (const char*)toQString(i->name()));
1573 bkmkselector->insertItem(toQString(i->name())); 1958 bkmkselector->insertItem(toQString(i->name()));
1574#else 1959#else
1575 bkmkselector->insertItem(i->name()); 1960 bkmkselector->insertItem(i->name());
@@ -1582,12 +1967,20 @@ void QTReaderApp::listbkmk()
1582//tjw menu->hide(); 1967//tjw menu->hide();
1583 editBar->hide(); 1968 editBar->hide();
1584 if (m_fontVisible) m_fontBar->hide(); 1969 if (m_fontVisible) m_fontBar->hide();
1585 if (regVisible) regBar->hide(); 1970 if (regVisible)
1586 if (searchVisible) searchBar->hide(); 1971 {
1972 Global::hideInputMethod();
1973 regBar->hide();
1974 }
1975 if (searchVisible)
1976 {
1977 Global::hideInputMethod();
1978 searchBar->hide();
1979 }
1587 editorStack->raiseWidget( bkmkselector ); 1980 editorStack->raiseWidget( bkmkselector );
1588 } 1981 }
1589 else 1982 else
1590 QMessageBox::information(this, "OpieReader", "No bookmarks in memory"); 1983 QMessageBox::information(this, PROGNAME, "No bookmarks in memory");
1591} 1984}
1592 1985
1593void QTReaderApp::do_autogen() 1986void QTReaderApp::do_autogen()
@@ -1600,15 +1993,72 @@ void QTReaderApp::do_autogen()
1600void QTReaderApp::do_regedit() 1993void QTReaderApp::do_regedit()
1601{ 1994{
1602// editBar->hide(); 1995// editBar->hide();
1996 reader->bDoUpdates = false;
1997 qDebug("Showing regbar");
1603 regBar->show(); 1998 regBar->show();
1999 qDebug("Showing kbd");
2000 Global::showInputMethod();
1604 regVisible = true; 2001 regVisible = true;
1605 regEdit->setFocus(); 2002 regEdit->setFocus();
2003 qApp->processEvents();
2004 reader->bDoUpdates = true;
2005 reader->update();
2006}
2007
2008bool QTReaderApp::openfrombkmk(Bkmk* bk)
2009{
2010 QString fn = toQString(
2011 CFiledata(bk->anno()).name()
2012 );
2013 qDebug("fileinfo");
2014 if (!fn.isEmpty() && QFileInfo(fn).isFile())
2015 {
2016 qDebug("Opening");
2017 openFile(fn);
2018 struct stat fnstat;
2019 stat((const char *)reader->m_lastfile, &fnstat);
2020
2021 if (CFiledata(bk->anno()).date()
2022 != fnstat.st_mtime)
2023 {
2024 CFiledata fd(bk->anno());
2025 fd.setdate(fnstat.st_mtime);
2026 bk->value(0);
2027 }
2028 else
2029 {
2030 unsigned short svlen = bk->filedatalen();
2031 unsigned char* svdata = bk->filedata();
2032 reader->putSaveData(svdata, svlen);
2033 // setstate(svdata, svlen);
2034 if (svlen != 0)
2035 {
2036 QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?");
2037 }
2038 qDebug("updating");
2039 reader->locate(bk->value());
2040 }
2041 return true;
2042 }
2043 else
2044 {
2045 return false;
2046 }
1606} 2047}
1607 2048
1608void QTReaderApp::gotobkmk(int ind) 2049void QTReaderApp::gotobkmk(int ind)
1609{ 2050{
1610 switch (m_nRegAction) 2051 switch (m_nRegAction)
1611 { 2052 {
2053 case cOpenFile:
2054 {
2055 if (!openfrombkmk((*pOpenlist)[ind]))
2056 {
2057 pOpenlist->erase(ind);
2058 QMessageBox::information(this, PROGNAME, "Can't find file");
2059 }
2060 }
2061 break;
1612 case cGotoBkmk: 2062 case cGotoBkmk:
1613 reader->locate((*pBkmklist)[ind]->value()); 2063 reader->locate((*pBkmklist)[ind]->value());
1614 break; 2064 break;
@@ -1619,7 +2069,7 @@ void QTReaderApp::gotobkmk(int ind)
1619// pBkmklist->sort(); 2069// pBkmklist->sort();
1620 break; 2070 break;
1621 case cRmBkmkFile: 2071 case cRmBkmkFile:
1622 unlink((const char *)Global::applicationFileName("uqtreader",bkmkselector->text(ind))); 2072 unlink((const char *)Global::applicationFileName(APPDIR,bkmkselector->text(ind)));
1623 break; 2073 break;
1624 } 2074 }
1625 showEditTools(); 2075 showEditTools();
@@ -1627,6 +2077,11 @@ void QTReaderApp::gotobkmk(int ind)
1627 2077
1628void QTReaderApp::cancelbkmk() 2078void QTReaderApp::cancelbkmk()
1629{ 2079{
2080 if (m_nRegAction == cOpenFile)
2081 {
2082 QString fn = usefilebrowser();
2083 if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn);
2084 }
1630 showEditTools(); 2085 showEditTools();
1631} 2086}
1632 2087
@@ -1646,12 +2101,14 @@ void QTReaderApp::do_jump(const QString& lcn)
1646 if (ok) 2101 if (ok)
1647 reader->locate(ulcn); 2102 reader->locate(ulcn);
1648 else 2103 else
1649 QMessageBox::information(this, "OpieReader", "Must be a number"); 2104 QMessageBox::information(this, PROGNAME, "Must be a number");
1650} 2105}
1651 2106
1652void QTReaderApp::do_regaction() 2107void QTReaderApp::do_regaction()
1653{ 2108{
2109 reader->bDoUpdates = false;
1654 regBar->hide(); 2110 regBar->hide();
2111 Global::hideInputMethod();
1655 regVisible = false; 2112 regVisible = false;
1656 switch(m_nRegAction) 2113 switch(m_nRegAction)
1657 { 2114 {
@@ -1677,6 +2134,9 @@ void QTReaderApp::do_regaction()
1677 reader->restore(); 2134 reader->restore();
1678// editBar->show(); 2135// editBar->show();
1679 reader->setFocus(); 2136 reader->setFocus();
2137 qApp->processEvents();
2138 reader->bDoUpdates = true;
2139 reader->update();
1680} 2140}
1681 2141
1682void QTReaderApp::do_settarget(const QString& _txt) 2142void QTReaderApp::do_settarget(const QString& _txt)
@@ -1686,7 +2146,7 @@ void QTReaderApp::do_settarget(const QString& _txt)
1686 { 2146 {
1687 m_targetapp = ""; 2147 m_targetapp = "";
1688 m_targetmsg = ""; 2148 m_targetmsg = "";
1689 QMessageBox::information(this, "OpieReader", "Format is\nappname/messagename"); 2149 QMessageBox::information(this, PROGNAME, "Format is\nappname/messagename");
1690 } 2150 }
1691 else 2151 else
1692 { 2152 {
@@ -1709,23 +2169,32 @@ void QTReaderApp::setfont()
1709 m_fontVisible = true; 2169 m_fontVisible = true;
1710} 2170}
1711 2171
1712void QTReaderApp::setfontHelper(const QString& lcn, int size) 2172void QTReaderApp::setfontHelper(const QString& lcn, int size = 0)
1713{ 2173{
1714 if (size == 0) size = reader->m_fontControl.currentsize(); 2174 if (size == 0) size = reader->m_fontControl.currentsize();
1715 QFont f(lcn, 10 /*, QFont::Bold*/); 2175 QFont f(lcn, 10 /*, QFont::Bold*/);
2176 qDebug("bs");
1716 bkmkselector->setFont( f ); 2177 bkmkselector->setFont( f );
2178 qDebug("re");
1717 regEdit->setFont( f ); 2179 regEdit->setFont( f );
2180 qDebug("se");
1718 searchEdit->setFont( f ); 2181 searchEdit->setFont( f );
2182 qDebug("aw");
1719 m_annoWin->setFont( f ); 2183 m_annoWin->setFont( f );
1720 reader->m_fontname = lcn; 2184 reader->m_fontname = lcn;
2185 qDebug("cf1");
1721 if (!reader->ChangeFont(size)) 2186 if (!reader->ChangeFont(size))
1722 { 2187 {
2188 qDebug("cf2");
1723 reader->ChangeFont(size); 2189 reader->ChangeFont(size);
1724 } 2190 }
2191 qDebug("ref");
1725 reader->refresh(); 2192 reader->refresh();
1726 m_fontBar->hide(); 2193 m_fontBar->hide();
1727 m_fontVisible = false; 2194 m_fontVisible = false;
1728 showEditTools(); 2195 qDebug("showedit");
2196 if (reader->isVisible()) showEditTools();
2197 qDebug("showeditdone");
1729} 2198}
1730 2199
1731void QTReaderApp::do_setfont(const QString& lcn) 2200void QTReaderApp::do_setfont(const QString& lcn)
@@ -1781,7 +2250,7 @@ pbar->resize(width(), editBar->height());
1781void QTReaderApp::saveprefs() 2250void QTReaderApp::saveprefs()
1782{ 2251{
1783// reader->saveprefs("uqtreader"); 2252// reader->saveprefs("uqtreader");
1784 Config config( "uqtreader" ); 2253 Config config( APPDIR );
1785 config.setGroup( "View" ); 2254 config.setGroup( "View" );
1786 2255
1787 reader->m_lastposn = reader->pagelocate(); 2256 reader->m_lastposn = reader->pagelocate();
@@ -1791,6 +2260,7 @@ void QTReaderApp::saveprefs()
1791 config.writeEntry( "TextFmt", reader->btextfmt ); 2260 config.writeEntry( "TextFmt", reader->btextfmt );
1792 config.writeEntry( "StripHtml", reader->bstriphtml ); 2261 config.writeEntry( "StripHtml", reader->bstriphtml );
1793 config.writeEntry( "Dehyphen", reader->bdehyphen ); 2262 config.writeEntry( "Dehyphen", reader->bdehyphen );
2263 config.writeEntry( "OneSpace", reader->bonespace );
1794 config.writeEntry( "Unindent", reader->bunindent ); 2264 config.writeEntry( "Unindent", reader->bunindent );
1795 config.writeEntry( "Repara", reader->brepara ); 2265 config.writeEntry( "Repara", reader->brepara );
1796 config.writeEntry( "DoubleSpace", reader->bdblspce ); 2266 config.writeEntry( "DoubleSpace", reader->bdblspce );
@@ -1800,6 +2270,7 @@ void QTReaderApp::saveprefs()
1800 config.writeEntry( "LastFile", reader->m_lastfile ); 2270 config.writeEntry( "LastFile", reader->m_lastfile );
1801 config.writeEntry( "LastPosn", (int)(reader->pagelocate()) ); 2271 config.writeEntry( "LastPosn", (int)(reader->pagelocate()) );
1802 config.writeEntry( "PageMode", reader->m_bpagemode ); 2272 config.writeEntry( "PageMode", reader->m_bpagemode );
2273 config.writeEntry( "CursorNavigation", reader->m_navkeys );
1803 config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced ); 2274 config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced );
1804 config.writeEntry( "Fontname", reader->m_fontname ); 2275 config.writeEntry( "Fontname", reader->m_fontname );
1805 config.writeEntry( "Encoding", reader->m_encd ); 2276 config.writeEntry( "Encoding", reader->m_encd );
@@ -1812,9 +2283,15 @@ void QTReaderApp::saveprefs()
1812 config.writeEntry( "Dictionary", m_doDictionary); 2283 config.writeEntry( "Dictionary", m_doDictionary);
1813 config.writeEntry( "Clipboard", m_doClipboard); 2284 config.writeEntry( "Clipboard", m_doClipboard);
1814 config.writeEntry( "SpaceTarget", m_spaceTarget); 2285 config.writeEntry( "SpaceTarget", m_spaceTarget);
2286#ifdef REPALM
2287 config.writeEntry( "Repalm", reader->brepalm );
2288#endif
1815 config.writeEntry( "Remap", reader->bremap ); 2289 config.writeEntry( "Remap", reader->bremap );
1816 config.writeEntry( "Peanut", reader->bpeanut ); 2290 config.writeEntry( "Peanut", reader->bpeanut );
1817 config.writeEntry( "MakeBold", reader->bmakebold ); 2291 config.writeEntry( "MakeBold", reader->bmakebold );
2292 config.writeEntry( "Continuous", reader->m_continuousDocument );
2293
2294 savefilelist();
1818} 2295}
1819 2296
1820void QTReaderApp::indentplus() 2297void QTReaderApp::indentplus()
@@ -1887,19 +2364,53 @@ void QTReaderApp::savebkmks()
1887{ 2364{
1888 if (pBkmklist != NULL) 2365 if (pBkmklist != NULL)
1889 { 2366 {
1890 BkmkFile bf((const char *)Global::applicationFileName("uqtreader",reader->m_string), true); 2367 BkmkFile bf((const char *)Global::applicationFileName(APPDIR, reader->m_string), true);
1891 bf.write(*pBkmklist); 2368 bf.write(*pBkmklist);
1892 } 2369 }
1893 m_fBkmksChanged = false; 2370 m_fBkmksChanged = false;
1894} 2371}
1895 2372
2373void QTReaderApp::readfilelist()
2374{
2375 BkmkFile bf((const char *)Global::applicationFileName(APPDIR, ".openfiles"));
2376 qDebug("Reading open files");
2377 pOpenlist = bf.readall();
2378 if (pOpenlist != NULL) qDebug("...with success");
2379 else qDebug("...without success!");
2380}
2381
2382void QTReaderApp::savefilelist()
2383{
2384 if (pOpenlist != NULL)
2385 {
2386 BkmkFile bf((const char *)Global::applicationFileName(APPDIR, ".openfiles"), true);
2387 qDebug("Writing open files");
2388 bf.write(*pOpenlist);
2389 }
2390}
2391
1896void QTReaderApp::readbkmks() 2392void QTReaderApp::readbkmks()
1897{ 2393{
1898 if (pBkmklist != NULL) 2394 if (pBkmklist != NULL)
1899 { 2395 {
1900 delete pBkmklist; 2396 delete pBkmklist;
1901 } 2397 }
1902 BkmkFile bf((const char *)Global::applicationFileName("uqtreader",reader->m_string)); 2398 struct stat fnstat;
2399 struct stat bkstat;
2400 if (
2401 stat((const char *)reader->m_lastfile, &fnstat) == 0
2402 &&
2403 stat((const char *)Global::applicationFileName(APPDIR, reader->m_string), &bkstat) == 0
2404 )
2405 {
2406 if (bkstat.st_mtime < fnstat.st_mtime)
2407 {
2408 unlink((const char *)Global::applicationFileName(APPDIR, reader->m_string));
2409 }
2410 }
2411
2412 BkmkFile bf((const char *)Global::applicationFileName(APPDIR, reader->m_string));
2413
1903 pBkmklist = bf.readall(); 2414 pBkmklist = bf.readall();
1904 m_fBkmksChanged = bf.upgraded(); 2415 m_fBkmksChanged = bf.upgraded();
1905 if (pBkmklist == NULL) 2416 if (pBkmklist == NULL)
@@ -1921,7 +2432,7 @@ void QTReaderApp::do_addbkmk(const QString& text)
1921{ 2432{
1922 if (text.isEmpty()) 2433 if (text.isEmpty())
1923 { 2434 {
1924 QMessageBox::information(this, "OpieReader", "Need a name for the bookmark\nSelect add again", 1); 2435 QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nSelect add again", 1);
1925 } 2436 }
1926 else 2437 else
1927 { 2438 {
@@ -1957,6 +2468,7 @@ void QTReaderApp::showAnnotation()
1957 m_annoWin->setName(toQString(m_anno->name())); 2468 m_annoWin->setName(toQString(m_anno->name()));
1958 m_annoWin->setAnno(toQString(m_anno->anno())); 2469 m_annoWin->setAnno(toQString(m_anno->anno()));
1959 m_annoIsEditing = false; 2470 m_annoIsEditing = false;
2471 Global::showInputMethod();
1960 editorStack->raiseWidget( m_annoWin ); 2472 editorStack->raiseWidget( m_annoWin );
1961 m_annoWin->setFocus(); 2473 m_annoWin->setFocus();
1962} 2474}
@@ -1985,6 +2497,7 @@ void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, const QString&
1985 m_annoWin->setAnno(""); 2497 m_annoWin->setAnno("");
1986 m_annoWin->setPosn(posn); 2498 m_annoWin->setPosn(posn);
1987 m_annoIsEditing = true; 2499 m_annoIsEditing = true;
2500 Global::showInputMethod();
1988 editorStack->raiseWidget( m_annoWin ); 2501 editorStack->raiseWidget( m_annoWin );
1989 } 2502 }
1990 if (m_doDictionary) 2503 if (m_doDictionary)
@@ -2017,6 +2530,11 @@ void QTReaderApp::OnActionPressed()
2017 addbkmk(); 2530 addbkmk();
2018 } 2531 }
2019 break; 2532 break;
2533 case cesFullScreen:
2534 {
2535 m_actFullscreen->setOn(true);
2536 }
2537 break;
2020 default: 2538 default:
2021 { 2539 {
2022 qDebug("Unknown ActionType:%u", m_spaceTarget); 2540 qDebug("Unknown ActionType:%u", m_spaceTarget);
@@ -2027,3 +2545,62 @@ void QTReaderApp::OnActionPressed()
2027 2545
2028void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); } 2546void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); }
2029void QTReaderApp::restoreFocus() { reader->setFocus(); } 2547void QTReaderApp::restoreFocus() { reader->setFocus(); }
2548
2549/*
2550void QTReaderApp::setstate(unsigned char* _sd, unsigned short _sdlen)
2551{
2552 unsigned short sdlen;
2553 memcpy(&sdlen, _sd, sizeof(sdlen));
2554 sdlen -= sizeof(sdlen);
2555 _sd += sizeof(sdlen);
2556 statedata* sd;
2557 char* data;
2558 if (sdlen < sizeof(statedata)+1)
2559 {
2560 sdlen = sizeof(statedata)+1;
2561 }
2562 data = new char[sdlen];
2563 sd = (statedata*)data;
2564 memcpy(sd, _sd, sdlen);
2565 data[sdlen] = 0;
2566 reader->setstate(*sd);
2567 delete [] data;
2568}
2569
2570void QTReaderApp::getstate(unsigned char*& data, unsigned short& len)
2571{
2572 unsigned char* olddata = data;
2573 unsigned short oldlen = len;
2574 len = oldlen+sizeof(unsigned short)+sizeof(statedata)+reader->m_fontname.length();
2575 data = new unsigned char[len];
2576 memcpy(data, olddata, oldlen);
2577 delete [] olddata;
2578 memcpy(data+oldlen, &len, sizeof(len));
2579 statedata* sd = (statedata*)(data+oldlen+sizeof(unsigned short));
2580
2581 sd->bstripcr = reader->bstripcr;
2582 sd->btextfmt = reader->btextfmt;
2583 sd->bautofmt = reader->bautofmt;
2584 sd->bstriphtml = reader->bstriphtml;
2585 sd->bpeanut = reader->bpeanut;
2586 sd->bdehyphen = reader->bdehyphen;
2587 sd->bonespace = reader->bonespace;
2588 sd->bunindent = reader->bunindent;
2589 sd->brepara = reader->brepara;
2590 sd->bdblspce = reader->bdblspce;
2591 sd->m_bpagemode = reader->m_bpagemode;
2592 sd->m_navkeys = reader->m_navkeys;
2593 sd->m_bMonoSpaced = reader->m_bMonoSpaced;
2594 sd->bremap = reader->bremap;
2595 sd->bmakebold = reader->bmakebold;
2596 sd->Continuous = reader->m_continuousDocument;
2597#ifdef REPALM
2598 sd->brepalm = reader->brepalm;
2599#endif
2600 sd->bindenter = reader->bindenter;
2601 sd->m_textsize = reader->m_textsize; //reader->m_fontControl.currentsize()
2602 sd->m_encd = reader->m_encd;
2603 sd->m_charpc = reader->m_charpc;
2604 strcpy(sd->m_fontname, reader->m_fontname.latin1());
2605}
2606*/