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