summaryrefslogtreecommitdiff
authorar <ar>2004-02-08 19:14:56 (UTC)
committer ar <ar>2004-02-08 19:14:56 (UTC)
commit5f698069bca9dde2c8be9ff1bf863ee3a7a33cf0 (patch) (unidiff)
tree525f35c4937c9f4ae99538289c5d1f96c53d7fa7
parent2dc8add65c44b3dd240cf2bd3c276c3c0155f46b (diff)
downloadopie-5f698069bca9dde2c8be9ff1bf863ee3a7a33cf0.zip
opie-5f698069bca9dde2c8be9ff1bf863ee3a7a33cf0.tar.gz
opie-5f698069bca9dde2c8be9ff1bf863ee3a7a33cf0.tar.bz2
improve support for BigScreen
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp1704
-rw-r--r--noncore/apps/checkbook/checkbook.cpp6
-rw-r--r--noncore/apps/checkbook/mainwindow.cpp11
-rw-r--r--noncore/apps/odict/configdlg.cpp9
-rw-r--r--noncore/apps/odict/searchmethoddlg.cpp15
-rw-r--r--noncore/apps/opie-bartender/bartender.cpp16
-rw-r--r--noncore/apps/opie-console/configdialog.cpp10
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp7
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.cpp9
-rw-r--r--noncore/apps/opie-reader/CloseDialog.cpp5
-rw-r--r--noncore/apps/opie-reader/Prefs.cpp5
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.cpp8444
-rw-r--r--noncore/apps/opie-reader/ToolbarPrefs.cpp10
-rw-r--r--noncore/apps/opie-reader/URLDialog.cpp31
-rw-r--r--noncore/apps/opie-reader/fileBrowser.cpp5
-rw-r--r--noncore/apps/opie-sheet/mainwindow.cpp9
-rw-r--r--noncore/apps/tableviewer/ui/tveditview.cpp8
-rw-r--r--noncore/apps/tableviewer/ui/tvfilterview.cpp8
-rw-r--r--noncore/apps/tableviewer/ui/tvkeyedit.cpp8
-rw-r--r--noncore/apps/tinykate/libkate/view/kateview.cpp4
-rw-r--r--noncore/apps/zsafe/scqtfileedit.cpp4
-rw-r--r--noncore/apps/zsafe/zsafe.cpp31
-rw-r--r--noncore/comm/keypebble/kvnc.cpp7
23 files changed, 5180 insertions, 5186 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 26bc36d..78f9da2 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -1,854 +1,850 @@
1/*************************************************************************** 1/***************************************************************************
2 AdvancedFm.cpp 2 AdvancedFm.cpp
3 ------------------- 3 -------------------
4 ** Created: Sat Mar 9 23:33:09 2002 4 ** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#include "advancedfm.h" 12#include "advancedfm.h"
13#include "output.h" 13#include "output.h"
14#include "filePermissions.h" 14#include "filePermissions.h"
15 15
16#include <opie/otabwidget.h> 16#include <opie/otabwidget.h>
17#include <opie/oprocess.h> 17#include <opie/oprocess.h>
18 18
19#include <qpe/lnkproperties.h> 19#include <qpe/lnkproperties.h>
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23#include <qpe/applnk.h> 23#include <qpe/applnk.h>
24#include <qpe/ir.h> 24#include <qpe/ir.h>
25 25
26#include <qmessagebox.h> 26#include <qmessagebox.h>
27#include <qmultilineedit.h> 27#include <qmultilineedit.h>
28 28
29#include <qstring.h> 29#include <qstring.h>
30 30
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qpixmap.h> 32#include <qpixmap.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qtabwidget.h> 35#include <qtabwidget.h>
36#include <qtoolbutton.h> 36#include <qtoolbutton.h>
37#include <qlineedit.h> 37#include <qlineedit.h>
38#include <qlistview.h> 38#include <qlistview.h>
39 39
40#include <errno.h> 40#include <errno.h>
41#include <stdlib.h> 41#include <stdlib.h>
42#include <unistd.h> 42#include <unistd.h>
43#include <sys/stat.h> 43#include <sys/stat.h>
44#include <dirent.h> 44#include <dirent.h>
45#include <sys/sendfile.h> 45#include <sys/sendfile.h>
46#include <fcntl.h> 46#include <fcntl.h>
47 47
48 48
49void AdvancedFm::doDirChange() { 49void AdvancedFm::doDirChange() {
50 QString pathItem = CurrentView()->currentItem()->text(0); 50 QString pathItem = CurrentView()->currentItem()->text(0);
51 if( pathItem == "../") { 51 if( pathItem == "../") {
52 ListClicked( CurrentView()->currentItem()); 52 ListClicked( CurrentView()->currentItem());
53 } else { 53 } else {
54 if( pathItem.find(" -> ",0,TRUE) != -1) 54 if( pathItem.find(" -> ",0,TRUE) != -1)
55 pathItem = dealWithSymName((const QString&)pathItem)+"/"; 55 pathItem = dealWithSymName((const QString&)pathItem)+"/";
56// qWarning(pathItem); 56// qWarning(pathItem);
57 gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); 57 gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) );
58 } 58 }
59} 59}
60 60
61void AdvancedFm::showMenuHidden() { 61void AdvancedFm::showMenuHidden() {
62 if (b) { 62 if (b) {
63 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 63 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
64 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 64 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
65 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 65 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
66 } else { 66 } else {
67 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 67 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
68 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 68 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
69 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 69 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
70 } 70 }
71 b = !b; 71 b = !b;
72 populateView(); 72 populateView();
73} 73}
74 74
75void AdvancedFm::showHidden() { 75void AdvancedFm::showHidden() {
76 if (b) { 76 if (b) {
77 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 77 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
78 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 78 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
79 } else { 79 } else {
80 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 80 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
81 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 81 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
82 } 82 }
83 populateView(); 83 populateView();
84} 84}
85 85
86QString AdvancedFm::dealWithSymName(const QString &fileName) { 86QString AdvancedFm::dealWithSymName(const QString &fileName) {
87 QString strItem = fileName; 87 QString strItem = fileName;
88 return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 88 return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
89} 89}
90 90
91void AdvancedFm::runThis() { 91void AdvancedFm::runThis() {
92 if( !CurrentView()->currentItem()) return; 92 if( !CurrentView()->currentItem()) return;
93 QString fs; 93 QString fs;
94 QDir *thisDir = CurrentDir(); 94 QDir *thisDir = CurrentDir();
95 95
96 QString curFile = CurrentView()->currentItem()->text(0); 96 QString curFile = CurrentView()->currentItem()->text(0);
97 QString path = thisDir->canonicalPath(); 97 QString path = thisDir->canonicalPath();
98 98
99 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink 99 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
100 100
101 curFile = dealWithSymName((const QString&)curFile); 101 curFile = dealWithSymName((const QString&)curFile);
102 102
103 if(curFile != "../") { 103 if(curFile != "../") {
104 104
105 fs = getFileSystemType((const QString &) path); 105 fs = getFileSystemType((const QString &) path);
106 QFileInfo fileInfo( path + "/" + curFile); 106 QFileInfo fileInfo( path + "/" + curFile);
107// qDebug( fileInfo.owner()); 107// qDebug( fileInfo.owner());
108 108
109 if( (fileInfo.permission( QFileInfo::ExeUser) 109 if( (fileInfo.permission( QFileInfo::ExeUser)
110 | fileInfo.permission( QFileInfo::ExeGroup) 110 | fileInfo.permission( QFileInfo::ExeGroup)
111 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 111 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
112 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 112 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
113 QCopEnvelope e("QPE/System", "execute(QString)" ); 113 QCopEnvelope e("QPE/System", "execute(QString)" );
114 e << curFile; 114 e << curFile;
115 } else { 115 } else {
116 curFile = path + "/" + curFile; 116 curFile = path + "/" + curFile;
117 DocLnk nf(curFile); 117 DocLnk nf(curFile);
118 QString execStr = nf.exec(); 118 QString execStr = nf.exec();
119// qDebug( execStr); 119// qDebug( execStr);
120 if( execStr.isEmpty() ) { 120 if( execStr.isEmpty() ) {
121 } else { 121 } else {
122 nf.execute(); 122 nf.execute();
123 } 123 }
124 } 124 }
125 } 125 }
126} 126}
127 127
128void AdvancedFm::runText() { 128void AdvancedFm::runText() {
129 if( !CurrentView()->currentItem()) return; 129 if( !CurrentView()->currentItem()) return;
130 QString curFile = CurrentView()->currentItem()->text(0); 130 QString curFile = CurrentView()->currentItem()->text(0);
131 if(curFile != "../") { 131 if(curFile != "../") {
132 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink 132 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
133 curFile = dealWithSymName((const QString&)curFile); 133 curFile = dealWithSymName((const QString&)curFile);
134 curFile = CurrentDir()->canonicalPath()+"/"+curFile; 134 curFile = CurrentDir()->canonicalPath()+"/"+curFile;
135 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 135 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
136 e << curFile; 136 e << curFile;
137 } 137 }
138} 138}
139 139
140void AdvancedFm::makeDir() { 140void AdvancedFm::makeDir() {
141 InputDialog *fileDlg; 141 InputDialog *fileDlg;
142 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 142 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
143 fileDlg->exec(); 143 fileDlg->exec();
144 if( fileDlg->result() == 1 ) { 144 if( fileDlg->result() == 1 ) {
145 QDir *thisDir = CurrentDir(); 145 QDir *thisDir = CurrentDir();
146 QString filename = fileDlg->LineEdit1->text(); 146 QString filename = fileDlg->LineEdit1->text();
147 thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); 147 thisDir->mkdir( thisDir->canonicalPath()+"/"+filename);
148 } 148 }
149 populateView(); 149 populateView();
150} 150}
151 151
152void AdvancedFm::doDelete() { 152void AdvancedFm::doDelete() {
153 QStringList curFileList = getPath(); 153 QStringList curFileList = getPath();
154 bool doMsg=true; 154 bool doMsg=true;
155 int count = curFileList.count(); 155 int count = curFileList.count();
156 if( count > 0) { 156 if( count > 0) {
157 if(count > 1 ) { 157 if(count > 1 ) {
158 QString msg; 158 QString msg;
159 msg=tr("Really delete\n%1 files?").arg(count); 159 msg=tr("Really delete\n%1 files?").arg(count);
160 switch ( QMessageBox::warning(this,tr("Delete"),msg 160 switch ( QMessageBox::warning(this,tr("Delete"),msg
161 ,tr("Yes"),tr("No"),0,0,1) ) 161 ,tr("Yes"),tr("No"),0,0,1) )
162 { 162 {
163 case 0: 163 case 0:
164 doMsg=false; 164 doMsg=false;
165 break; 165 break;
166 case 1: 166 case 1:
167 return; 167 return;
168 break; 168 break;
169 }; 169 };
170 } 170 }
171 171
172 QString myFile; 172 QString myFile;
173 173
174 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 174 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
175 myFile = (*it); 175 myFile = (*it);
176 if( myFile.find(" -> ",0,TRUE) != -1) 176 if( myFile.find(" -> ",0,TRUE) != -1)
177 myFile = myFile.left( myFile.find(" -> ",0,TRUE)); 177 myFile = myFile.left( myFile.find(" -> ",0,TRUE));
178 178
179 QString f = CurrentDir()->canonicalPath(); 179 QString f = CurrentDir()->canonicalPath();
180 if(f.right(1).find("/",0,TRUE) == -1) 180 if(f.right(1).find("/",0,TRUE) == -1)
181 f += "/"; 181 f += "/";
182 f += myFile; 182 f += myFile;
183 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 183 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
184 //if file is a directory 184 //if file is a directory
185 185
186 switch ( QMessageBox::warning( this, tr("Delete Directory?"), 186 switch ( QMessageBox::warning( this, tr("Delete Directory?"),
187 tr("Really delete %1\nand all it's contents ?" ).arg( f ) , 187 tr("Really delete %1\nand all it's contents ?" ).arg( f ) ,
188 tr("Yes"), tr("No"), 0, 0, 1) ) { 188 tr("Yes"), tr("No"), 0, 0, 1) ) {
189 case 0: 189 case 0:
190 { 190 {
191 f=f.left(f.length()-1); 191 f=f.left(f.length()-1);
192 QString cmd="rm -rf "+f; 192 QString cmd="rm -rf "+f;
193 startProcess( (const QString)cmd.latin1() ); 193 startProcess( (const QString)cmd.latin1() );
194 populateView(); 194 populateView();
195 } 195 }
196 break; 196 break;
197 case 1: 197 case 1:
198 // exit 198 // exit
199 break; 199 break;
200 }; 200 };
201 201
202 } else { 202 } else {
203 if(doMsg) { 203 if(doMsg) {
204 switch ( QMessageBox::warning(this,tr("Delete"), 204 switch ( QMessageBox::warning(this,tr("Delete"),
205 tr("Really delete\n%1?").arg( myFile ), 205 tr("Really delete\n%1?").arg( myFile ),
206 tr("Yes"), tr("No"), 0, 0, 1) ) { 206 tr("Yes"), tr("No"), 0, 0, 1) ) {
207 case 1: 207 case 1:
208 return; 208 return;
209 break; 209 break;
210 }; 210 };
211 } 211 }
212 212
213 QString cmd="rm "+f; 213 QString cmd="rm "+f;
214 QFile file(f); 214 QFile file(f);
215 QFileInfo fi(myFile); 215 QFileInfo fi(myFile);
216 if( fi.fileName().find("../",0,TRUE)==-1) { 216 if( fi.fileName().find("../",0,TRUE)==-1) {
217// qDebug("remove link files "+myFile); 217// qDebug("remove link files "+myFile);
218 218
219// DocLnk lnk(f); 219// DocLnk lnk(f);
220 DocLnk *lnk; 220 DocLnk *lnk;
221 lnk = new DocLnk(f); 221 lnk = new DocLnk(f);
222// qDebug("Deleting doclnk " + lnk->linkFile()); 222// qDebug("Deleting doclnk " + lnk->linkFile());
223 if(lnk->isValid()) 223 if(lnk->isValid())
224 lnk->removeLinkFile(); 224 lnk->removeLinkFile();
225 // delete lnk; 225 // delete lnk;
226 file.remove(); 226 file.remove();
227 } 227 }
228 } 228 }
229 } 229 }
230 } 230 }
231 populateView(); 231 populateView();
232} 232}
233 233
234void AdvancedFm::filePerms() { 234void AdvancedFm::filePerms() {
235 QStringList curFileList = getPath(); 235 QStringList curFileList = getPath();
236 QString filePath; 236 QString filePath;
237 237
238 filePath = CurrentDir()->canonicalPath()+"/"; 238 filePath = CurrentDir()->canonicalPath()+"/";
239 239
240 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 240 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
241 filePermissions *filePerm; 241 filePermissions *filePerm;
242 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); 242 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
243 filePerm->showMaximized(); 243 QPEApplication::execDialog( filePerm );
244 filePerm->exec(); 244 if( filePerm )
245 if( filePerm) 245 delete filePerm;
246 delete filePerm; 246 }
247 } 247 populateView();
248 populateView(); 248}
249} 249
250 250void AdvancedFm::doProperties() {
251void AdvancedFm::doProperties() { 251#if defined(QT_QWS_OPIE)
252#if defined(QT_QWS_OPIE) 252
253 253 QStringList curFileList = getPath();
254 QStringList curFileList = getPath(); 254
255 255 QString filePath;
256 QString filePath; 256 filePath = CurrentDir()->canonicalPath()+"/";
257 filePath = CurrentDir()->canonicalPath()+"/"; 257
258 258// qDebug("%d",curFileList.count());
259// qDebug("%d",curFileList.count()); 259
260 260 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
261 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 261// qDebug((filePath+*it));
262// qDebug((filePath+*it)); 262 DocLnk lnk( (filePath+*it));
263 DocLnk lnk( (filePath+*it)); 263 LnkProperties prop( &lnk );
264 LnkProperties prop( &lnk ); 264 QPEApplication::execDialog( &prop );
265 prop.showMaximized(); 265 }
266 prop.exec(); 266#endif
267 } 267
268#endif 268}
269 269
270} 270void AdvancedFm::upDir() {
271 271 QDir *thisDir = CurrentDir();
272void AdvancedFm::upDir() { 272 QString current = thisDir->canonicalPath();
273 QDir *thisDir = CurrentDir(); 273 QDir dir(current);
274 QString current = thisDir->canonicalPath(); 274 dir.cdUp();
275 QDir dir(current); 275 current = dir.canonicalPath();
276 dir.cdUp(); 276 chdir( current.latin1() );
277 current = dir.canonicalPath(); 277 thisDir->cd( current, TRUE);
278 chdir( current.latin1() ); 278
279 thisDir->cd( current, TRUE); 279 populateView();
280 280 update();
281 populateView(); 281}
282 update(); 282
283} 283void AdvancedFm::copy() {
284 284 qApp->processEvents();
285void AdvancedFm::copy() { 285 QStringList curFileList = getPath();
286 qApp->processEvents(); 286
287 QStringList curFileList = getPath(); 287 QDir *thisDir = CurrentDir();
288 288 QDir *thatDir = OtherDir();
289 QDir *thisDir = CurrentDir(); 289
290 QDir *thatDir = OtherDir(); 290 bool doMsg=true;
291 291 int count=curFileList.count();
292 bool doMsg=true; 292 if( count > 0) {
293 int count=curFileList.count(); 293 if(count > 1 ){
294 if( count > 0) { 294 QString msg;
295 if(count > 1 ){ 295 msg=tr("Really copy\n%1 files?").arg(count);
296 QString msg; 296 switch ( QMessageBox::warning(this,tr("Copy"),msg
297 msg=tr("Really copy\n%1 files?").arg(count); 297 ,tr("Yes"),tr("No"),0,0,1) )
298 switch ( QMessageBox::warning(this,tr("Copy"),msg 298 {
299 ,tr("Yes"),tr("No"),0,0,1) ) 299 case 0:
300 { 300 doMsg=false;
301 case 0: 301 break;
302 doMsg=false; 302 case 1:
303 break; 303 return;
304 case 1: 304 break;
305 return; 305 };
306 break; 306 }
307 }; 307
308 } 308 QString curFile, item, destFile;
309 309 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
310 QString curFile, item, destFile; 310 item=(*it);
311 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 311 if(item.find("->",0,TRUE)) //symlink
312 item=(*it); 312 item = item.left(item.find("->",0,TRUE));
313 if(item.find("->",0,TRUE)) //symlink 313
314 item = item.left(item.find("->",0,TRUE)); 314 curFile = thisDir->canonicalPath()+"/"+ item;
315 315 destFile = thatDir->canonicalPath()+"/"+ item;
316 curFile = thisDir->canonicalPath()+"/"+ item; 316
317 destFile = thatDir->canonicalPath()+"/"+ item; 317// qDebug("Destination file is "+destFile);
318 318// qDebug("CurrentFile file is " + curFile);
319// qDebug("Destination file is "+destFile); 319
320// qDebug("CurrentFile file is " + curFile); 320 QFile f(destFile);
321 321 if( f.exists()) {
322 QFile f(destFile); 322 if(doMsg) {
323 if( f.exists()) { 323 switch ( QMessageBox::warning(this,tr("File Exists!"),
324 if(doMsg) { 324 tr("%1 exists. Ok to overwrite?").arg( item ),
325 switch ( QMessageBox::warning(this,tr("File Exists!"), 325 tr("Yes"),tr("No"),0,0,1) ) {
326 tr("%1 exists. Ok to overwrite?").arg( item ), 326 case 1:
327 tr("Yes"),tr("No"),0,0,1) ) { 327 return;
328 case 1: 328 break;
329 return; 329 };
330 break; 330 }
331 }; 331 f.remove();
332 } 332 }
333 f.remove(); 333
334 } 334 if( !copyFile( curFile, destFile) ) {
335 335 QMessageBox::message("AdvancedFm",
336 if( !copyFile( curFile, destFile) ) { 336 tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) );
337 QMessageBox::message("AdvancedFm", 337 return;
338 tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) ); 338 }
339 return; 339 }
340 } 340 setOtherTabCurrent();
341 } 341 rePopulate();
342 setOtherTabCurrent(); 342 }
343 rePopulate(); 343}
344 } 344
345} 345void AdvancedFm::copyAs() {
346 346 qApp->processEvents();
347void AdvancedFm::copyAs() { 347
348 qApp->processEvents(); 348 QStringList curFileList = getPath();
349 349 QString curFile, item;
350 QStringList curFileList = getPath(); 350 InputDialog *fileDlg;
351 QString curFile, item; 351
352 InputDialog *fileDlg; 352 QDir *thisDir = CurrentDir();
353 353 QDir *thatDir = OtherDir();
354 QDir *thisDir = CurrentDir(); 354
355 QDir *thatDir = OtherDir(); 355 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
356 356 QString destFile;
357 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 357 item=(*it);
358 QString destFile; 358 curFile = thisDir->canonicalPath()+"/"+(*it);
359 item=(*it); 359 fileDlg = new InputDialog( this, tr("Copy "+curFile+" As"), TRUE, 0);
360 curFile = thisDir->canonicalPath()+"/"+(*it); 360
361 fileDlg = new InputDialog( this, tr("Copy "+curFile+" As"), TRUE, 0); 361 fileDlg->setInputText((const QString &) destFile );
362 362 fileDlg->exec();
363 fileDlg->setInputText((const QString &) destFile ); 363
364 fileDlg->exec(); 364 if( fileDlg->result() == 1 ) {
365 365 QString filename = fileDlg->LineEdit1->text();
366 if( fileDlg->result() == 1 ) { 366 destFile = thatDir->canonicalPath()+"/"+filename;
367 QString filename = fileDlg->LineEdit1->text(); 367
368 destFile = thatDir->canonicalPath()+"/"+filename; 368 QFile f( destFile);
369 369 if( f.exists()) {
370 QFile f( destFile); 370 switch (QMessageBox::warning(this,tr("File Exists!"),
371 if( f.exists()) { 371 item+tr("\nexists. Ok to overwrite?"),
372 switch (QMessageBox::warning(this,tr("File Exists!"), 372 tr("Yes"),tr("No"),0,0,1) ) {
373 item+tr("\nexists. Ok to overwrite?"), 373 case 0:
374 tr("Yes"),tr("No"),0,0,1) ) { 374 f.remove();
375 case 0: 375 break;
376 f.remove(); 376 case 1:
377 break; 377 return;
378 case 1: 378 break;
379 return; 379 };
380 break; 380 }
381 }; 381 if( !copyFile( curFile, destFile) ) {
382 } 382 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
383 if( !copyFile( curFile, destFile) ) { 383 +curFile +tr("to\n")+destFile);
384 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 384 return;
385 +curFile +tr("to\n")+destFile); 385 }
386 return; 386 }
387 } 387 delete fileDlg;
388 } 388
389 delete fileDlg; 389 }
390 390 rePopulate();
391 } 391 setOtherTabCurrent();
392 rePopulate(); 392}
393 setOtherTabCurrent(); 393
394} 394void AdvancedFm::copySameDir() {
395 395 qApp->processEvents();
396void AdvancedFm::copySameDir() { 396 QStringList curFileList = getPath();
397 qApp->processEvents(); 397 QString curFile, item, destFile;
398 QStringList curFileList = getPath(); 398 InputDialog *fileDlg;
399 QString curFile, item, destFile; 399
400 InputDialog *fileDlg; 400 QDir *thisDir = CurrentDir();
401 401
402 QDir *thisDir = CurrentDir(); 402 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
403 403 item=(*it);
404 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 404 curFile = thisDir->canonicalPath()+"/"+ item;
405 item=(*it); 405
406 curFile = thisDir->canonicalPath()+"/"+ item; 406 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0);
407 407 fileDlg->setInputText((const QString &) destFile );
408 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); 408 fileDlg->exec();
409 fileDlg->setInputText((const QString &) destFile ); 409
410 fileDlg->exec(); 410 if( fileDlg->result() == 1 ) {
411 411
412 if( fileDlg->result() == 1 ) { 412 QString filename = fileDlg->LineEdit1->text();
413 413 destFile = thisDir->canonicalPath()+"/"+filename;
414 QString filename = fileDlg->LineEdit1->text(); 414
415 destFile = thisDir->canonicalPath()+"/"+filename; 415 QFile f(destFile);
416 416 if( f.exists()) {
417 QFile f(destFile); 417 switch (QMessageBox::warning(this,tr("Delete"),
418 if( f.exists()) { 418 destFile+tr(" already exists.\nDo you really want to delete it?"),
419 switch (QMessageBox::warning(this,tr("Delete"), 419 tr("Yes"),tr("No"),0,0,1) ) {
420 destFile+tr(" already exists.\nDo you really want to delete it?"), 420 case 0:
421 tr("Yes"),tr("No"),0,0,1) ) { 421
422 case 0: 422 f.remove();
423 423 break;
424 f.remove(); 424 case 1:
425 break; 425 return;
426 case 1: 426 break;
427 return; 427 };
428 break; 428 }
429 }; 429 if(!copyFile( curFile,destFile) ) {
430 } 430 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
431 if(!copyFile( curFile,destFile) ) { 431 +curFile +tr("to\n")+destFile);
432 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 432 return;
433 +curFile +tr("to\n")+destFile); 433 }
434 return; 434
435 } 435// qDebug("copy "+curFile+" as "+destFile);
436 436 }
437// qDebug("copy "+curFile+" as "+destFile); 437 delete fileDlg;
438 } 438 }
439 delete fileDlg; 439 rePopulate();
440 } 440}
441 rePopulate(); 441
442} 442void AdvancedFm::move() {
443 443 qApp->processEvents();
444void AdvancedFm::move() { 444
445 qApp->processEvents(); 445 QStringList curFileList = getPath();
446 446 if( curFileList.count() > 0) {
447 QStringList curFileList = getPath(); 447 QString curFile, destFile, item;
448 if( curFileList.count() > 0) { 448
449 QString curFile, destFile, item; 449 QDir *thisDir = CurrentDir();
450 450 QDir *thatDir = OtherDir();
451 QDir *thisDir = CurrentDir(); 451 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
452 QDir *thatDir = OtherDir(); 452 item=(*it);
453 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 453 QString destFile = thatDir->canonicalPath();
454 item=(*it); 454
455 QString destFile = thatDir->canonicalPath(); 455 if(destFile.right(1).find("/",0,TRUE) == -1)
456 456 destFile+="/";
457 if(destFile.right(1).find("/",0,TRUE) == -1) 457 destFile += item;
458 destFile+="/"; 458// qDebug("Destination file is "+destFile);
459 destFile += item; 459
460// qDebug("Destination file is "+destFile); 460 curFile = thisDir->canonicalPath();
461 461 if(curFile.right(1).find("/",0,TRUE) == -1)
462 curFile = thisDir->canonicalPath(); 462 curFile +="/";
463 if(curFile.right(1).find("/",0,TRUE) == -1) 463 curFile+= item;
464 curFile +="/"; 464// qDebug("CurrentFile file is " + curFile);
465 curFile+= item; 465
466// qDebug("CurrentFile file is " + curFile); 466 if(QFileInfo(curFile).isDir()) {
467 467 moveDirectory( curFile, destFile );
468 if(QFileInfo(curFile).isDir()) { 468 rePopulate();
469 moveDirectory( curFile, destFile ); 469 return;
470 rePopulate(); 470 }
471 return; 471
472 } 472 QFile f( curFile);
473 473 if( f.exists()) {
474 QFile f( curFile); 474 if( !copyFile( curFile, destFile) ) {
475 if( f.exists()) { 475 QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile);
476 if( !copyFile( curFile, destFile) ) { 476 return;
477 QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); 477 } else
478 return; 478 QFile::remove(curFile);
479 } else 479 }
480 QFile::remove(curFile); 480 }
481 } 481
482 } 482 }
483 483 rePopulate();
484 } 484 setOtherTabCurrent();
485 rePopulate(); 485}
486 setOtherTabCurrent(); 486
487} 487bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) {
488 488 int err = 0;
489bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { 489 if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src;
490 int err = 0; 490 err = system((const char*)cmd);
491 if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src; 491 } else
492 err = system((const char*)cmd); 492 err = -1;
493 } else 493
494 err = -1; 494 if(err!=0) {
495 495 QMessageBox::message(tr("Note"),tr("Could not move\n") + src);
496 if(err!=0) { 496 return false;
497 QMessageBox::message(tr("Note"),tr("Could not move\n") + src); 497 }
498 return false; 498 return true;
499 } 499}
500 return true; 500
501} 501bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) {
502 502
503bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { 503 QStringcmd = "/bin/cp -fpR " + src + " " + dest;
504 504 qWarning(cmd);
505 QStringcmd = "/bin/cp -fpR " + src + " " + dest; 505 interr = system( (const char *) cmd );
506 qWarning(cmd); 506 if ( err != 0 ) {
507 interr = system( (const char *) cmd ); 507 QMessageBox::message("AdvancedFm",
508 if ( err != 0 ) { 508 tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) );
509 QMessageBox::message("AdvancedFm", 509 return false;
510 tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) ); 510 }
511 return false; 511
512 } 512 return true;
513 513}
514 return true; 514
515} 515
516 516bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
517 517
518bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { 518
519 519 if(QFileInfo(src).isDir()) {
520 520 if( copyDirectory( src, dest )) {
521 if(QFileInfo(src).isDir()) { 521 setOtherTabCurrent();
522 if( copyDirectory( src, dest )) { 522 populateView();
523 setOtherTabCurrent(); 523 return true;
524 populateView(); 524 }
525 return true; 525 else
526 } 526 return false;
527 else 527 }
528 return false; 528
529 } 529
530 530 bool success = true;
531 531 struct stat status;
532 bool success = true; 532 QFile srcFile(src);
533 struct stat status; 533 QFile destFile(dest);
534 QFile srcFile(src); 534 int err=0;
535 QFile destFile(dest); 535 int read_fd=0;
536 int err=0; 536 int write_fd=0;
537 int read_fd=0; 537 struct stat stat_buf;
538 int write_fd=0; 538 off_t offset = 0;
539 struct stat stat_buf; 539 if(!srcFile.open( IO_ReadOnly|IO_Raw)) {
540 off_t offset = 0; 540// qWarning("open failed");
541 if(!srcFile.open( IO_ReadOnly|IO_Raw)) { 541 return success = false;
542// qWarning("open failed"); 542 }
543 return success = false; 543 read_fd = srcFile.handle();
544 } 544 if(read_fd != -1) {
545 read_fd = srcFile.handle(); 545 fstat (read_fd, &stat_buf);
546 if(read_fd != -1) { 546 if( !destFile.open( IO_WriteOnly|IO_Raw ) ) {
547 fstat (read_fd, &stat_buf); 547// qWarning("destfile open failed");
548 if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { 548 return success = false;
549// qWarning("destfile open failed"); 549 }
550 return success = false; 550 write_fd = destFile.handle();
551 } 551 if(write_fd != -1) {
552 write_fd = destFile.handle(); 552 err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size);
553 if(write_fd != -1) { 553 if( err == -1) {
554 err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); 554 QString msg;
555 if( err == -1) { 555 switch(err) {
556 QString msg; 556 case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. ";
557 switch(err) { 557 case EINVAL: msg = "Descriptor is not valid or locked. ";
558 case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; 558 case ENOMEM: msg = "Insufficient memory to read from in_fd.";
559 case EINVAL: msg = "Descriptor is not valid or locked. "; 559 case EIO: msg = "Unspecified error while reading from in_fd.";
560 case ENOMEM: msg = "Insufficient memory to read from in_fd."; 560 };
561 case EIO: msg = "Unspecified error while reading from in_fd."; 561 success = false;
562 }; 562// qWarning(msg);
563 success = false; 563 }
564// qWarning(msg); 564 } else {
565 } 565 success = false;
566 } else { 566 }
567 success = false; 567 } else {
568 } 568 success = false;
569 } else { 569 }
570 success = false; 570 srcFile.close();
571 } 571 destFile.close();
572 srcFile.close(); 572 // Set file permissions
573 destFile.close(); 573 if( stat( (const char *) src, &status ) == 0 ) {
574 // Set file permissions 574 chmod( (const char *) dest, status.st_mode );
575 if( stat( (const char *) src, &status ) == 0 ) { 575 }
576 chmod( (const char *) dest, status.st_mode ); 576
577 } 577 return success;
578 578}
579 return success; 579
580} 580void AdvancedFm::runCommand() {
581 581 if( !CurrentView()->currentItem()) return;
582void AdvancedFm::runCommand() { 582 QDir *thisDir = CurrentDir();
583 if( !CurrentView()->currentItem()) return; 583
584 QDir *thisDir = CurrentDir(); 584 QString curFile;
585 585 curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0);
586 QString curFile; 586
587 curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0); 587 InputDialog *fileDlg;
588 588 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
589 InputDialog *fileDlg; 589 fileDlg->setInputText(curFile);
590 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 590 fileDlg->exec();
591 fileDlg->setInputText(curFile); 591 //QString command;
592 fileDlg->exec(); 592
593 //QString command; 593 if( fileDlg->result() == 1 ) {
594 594// qDebug(fileDlg->LineEdit1->text());
595 if( fileDlg->result() == 1 ) { 595 QStringList command;
596// qDebug(fileDlg->LineEdit1->text()); 596
597 QStringList command; 597 command << "/bin/sh";
598 598 command << "-c";
599 command << "/bin/sh"; 599 command << fileDlg->LineEdit1->text();
600 command << "-c"; 600 Output *outDlg;
601 command << fileDlg->LineEdit1->text(); 601 outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
602 Output *outDlg; 602 QPEApplication::execDialog( outDlg );
603 outDlg = new Output( command, this, tr("AdvancedFm Output"), true); 603 qApp->processEvents();
604 outDlg->showMaximized(); 604
605 outDlg->exec(); 605 }
606 qApp->processEvents(); 606}
607 607
608 } 608void AdvancedFm::runCommandStd() {
609} 609 if( !CurrentView()->currentItem()) return;
610 610 QString curFile;
611void AdvancedFm::runCommandStd() { 611 QDir *thisDir = CurrentDir();
612 if( !CurrentView()->currentItem()) return; 612 QListView *thisView = CurrentView();
613 QString curFile; 613 if( thisView->currentItem())
614 QDir *thisDir = CurrentDir(); 614 curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0);
615 QListView *thisView = CurrentView(); 615
616 if( thisView->currentItem()) 616 InputDialog *fileDlg;
617 curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0); 617 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
618 618 fileDlg->setInputText(curFile);
619 InputDialog *fileDlg; 619 fileDlg->exec();
620 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 620
621 fileDlg->setInputText(curFile); 621 if( fileDlg->result() == 1 ) {
622 fileDlg->exec(); 622 qApp->processEvents();
623 623 startProcess( (const QString)fileDlg->LineEdit1->text().latin1());
624 if( fileDlg->result() == 1 ) { 624 }
625 qApp->processEvents(); 625}
626 startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); 626
627 } 627void AdvancedFm::fileStatus() {
628} 628 if( !CurrentView()->currentItem()) return;
629 629 QString curFile;
630void AdvancedFm::fileStatus() { 630 curFile = CurrentView()->currentItem()->text(0);
631 if( !CurrentView()->currentItem()) return; 631
632 QString curFile; 632 QStringList command;
633 curFile = CurrentView()->currentItem()->text(0); 633 command << "/bin/sh";
634 634 command << "-c";
635 QStringList command; 635 command << "stat -l "+ curFile;
636 command << "/bin/sh"; 636
637 command << "-c"; 637 Output *outDlg;
638 command << "stat -l "+ curFile; 638 outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
639 639 QPEApplication::execDialog( outDlg );
640 Output *outDlg; 640 qApp->processEvents();
641 outDlg = new Output( command, this, tr("AdvancedFm Output"), true); 641}
642 outDlg->showMaximized(); 642
643 outDlg->exec(); 643
644 qApp->processEvents(); 644void AdvancedFm::mkDir() {
645} 645 makeDir();
646 646}
647 647
648void AdvancedFm::mkDir() { 648void AdvancedFm::rn() {
649 makeDir(); 649 renameIt();
650} 650}
651 651
652void AdvancedFm::rn() { 652void AdvancedFm::del() {
653 renameIt(); 653 doDelete();
654} 654}
655 655
656void AdvancedFm::del() { 656void AdvancedFm::mkSym() {
657 doDelete(); 657 QString cmd;
658} 658 QStringList curFileList = getPath();
659 659 if( curFileList.count() > 0) {
660void AdvancedFm::mkSym() { 660 QDir *thisDir = CurrentDir();
661 QString cmd; 661 QDir * thatDir = OtherDir();
662 QStringList curFileList = getPath(); 662
663 if( curFileList.count() > 0) { 663 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
664 QDir *thisDir = CurrentDir(); 664
665 QDir * thatDir = OtherDir(); 665 QString destName = thatDir->canonicalPath()+"/"+(*it);
666 666 if(destName.right(1) == "/") {
667 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 667 destName = destName.left( destName.length() -1);
668 668 }
669 QString destName = thatDir->canonicalPath()+"/"+(*it); 669
670 if(destName.right(1) == "/") { 670 QString curFile = thisDir->canonicalPath()+"/"+(*it);
671 destName = destName.left( destName.length() -1); 671
672 } 672 if( curFile.right(1) == "/") {
673 673 curFile = curFile.left( curFile.length() -1);
674 QString curFile = thisDir->canonicalPath()+"/"+(*it); 674 }
675 675
676 if( curFile.right(1) == "/") { 676 cmd = "ln -s "+curFile+" "+destName;
677 curFile = curFile.left( curFile.length() -1); 677// qDebug(cmd);
678 } 678 startProcess( (const QString)cmd );
679 679 }
680 cmd = "ln -s "+curFile+" "+destName; 680 rePopulate();
681// qDebug(cmd); 681 setOtherTabCurrent();
682 startProcess( (const QString)cmd ); 682 }
683 } 683}
684 rePopulate(); 684
685 setOtherTabCurrent(); 685void AdvancedFm::doBeam() {
686 } 686 Ir ir;
687} 687 if(!ir.supported()) {
688 688 } else {
689void AdvancedFm::doBeam() { 689 QStringList curFileList = getPath();
690 Ir ir; 690 if( curFileList.count() > 0) {
691 if(!ir.supported()) { 691 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
692 } else { 692 QString curFile = (*it);
693 QStringList curFileList = getPath(); 693 QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile;
694 if( curFileList.count() > 0) { 694 if( curFilePath.right(1) == "/") {
695 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 695 curFilePath = curFilePath.left( curFilePath.length() -1);
696 QString curFile = (*it); 696 }
697 QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; 697 Ir *file = new Ir(this, "IR");
698 if( curFilePath.right(1) == "/") { 698 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * )));
699 curFilePath = curFilePath.left( curFilePath.length() -1); 699 file->send( curFilePath, curFile );
700 } 700 }
701 Ir *file = new Ir(this, "IR"); 701 }
702 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); 702 }
703 file->send( curFilePath, curFile ); 703}
704 } 704
705 } 705void AdvancedFm::fileBeamFinished( Ir *) {
706 } 706 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
707} 707}
708 708
709void AdvancedFm::fileBeamFinished( Ir *) { 709void AdvancedFm::selectAll() {
710 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 710 QListView *thisView = CurrentView();
711} 711 thisView->selectAll(true);
712 712 thisView->setSelected( thisView->firstChild(),false);
713void AdvancedFm::selectAll() { 713}
714 QListView *thisView = CurrentView(); 714
715 thisView->selectAll(true); 715void AdvancedFm::startProcess(const QString & cmd) {
716 thisView->setSelected( thisView->firstChild(),false); 716 QStringList command;
717} 717 OProcess *process;
718 718 process = new OProcess();
719void AdvancedFm::startProcess(const QString & cmd) { 719 connect(process, SIGNAL(processExited(OProcess *)),
720 QStringList command; 720 this, SLOT( processEnded(OProcess *)));
721 OProcess *process; 721
722 process = new OProcess(); 722 connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)),
723 connect(process, SIGNAL(processExited(OProcess *)), 723 this, SLOT( oprocessStderr(OProcess *, char *, int)));
724 this, SLOT( processEnded(OProcess *))); 724
725 725 command << "/bin/sh";
726 connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)), 726 command << "-c";
727 this, SLOT( oprocessStderr(OProcess *, char *, int))); 727 command << cmd.latin1();
728 728 *process << command;
729 command << "/bin/sh"; 729 if(!process->start(OProcess::NotifyOnExit, OProcess::All) )
730 command << "-c"; 730 qDebug("could not start process");
731 command << cmd.latin1(); 731}
732 *process << command; 732
733 if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) 733void AdvancedFm::processEnded(OProcess *) {
734 qDebug("could not start process"); 734 rePopulate();
735} 735}
736 736
737void AdvancedFm::processEnded(OProcess *) { 737void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
738 rePopulate(); 738// qWarning("received stderrt %d bytes", buflen);
739} 739
740 740 QString lineStr = buffer;
741void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { 741 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
742// qWarning("received stderrt %d bytes", buflen); 742}
743 743
744 QString lineStr = buffer; 744bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
745 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); 745 if ( o->inherits( "QLineEdit" ) ) {
746} 746 if ( e->type() == QEvent::KeyPress ) {
747 747 QKeyEvent *ke = (QKeyEvent*)e;
748bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { 748 if ( ke->key() == Key_Return ||
749 if ( o->inherits( "QLineEdit" ) ) { 749 ke->key() == Key_Enter ) {
750 if ( e->type() == QEvent::KeyPress ) { 750 okRename();
751 QKeyEvent *ke = (QKeyEvent*)e; 751 return true;
752 if ( ke->key() == Key_Return || 752 }
753 ke->key() == Key_Enter ) { 753 else if ( ke->key() == Key_Escape ) {
754 okRename(); 754 cancelRename();
755 return true; 755 return true;
756 } 756 }
757 else if ( ke->key() == Key_Escape ) { 757 }
758 cancelRename(); 758 else if ( e->type() == QEvent::FocusOut ) {
759 return true; 759 cancelRename();
760 } 760 return true;
761 } 761 }
762 else if ( e->type() == QEvent::FocusOut ) { 762 }
763 cancelRename(); 763 if ( o->inherits( "QListView" ) ) {
764 return true; 764 if ( e->type() == QEvent::FocusIn ) {
765 } 765 if( o == Local_View) { //keep track of which view
766 } 766 whichTab=1;
767 if ( o->inherits( "QListView" ) ) { 767 }
768 if ( e->type() == QEvent::FocusIn ) { 768 else {
769 if( o == Local_View) { //keep track of which view 769 whichTab=2;
770 whichTab=1; 770 }
771 } 771 }
772 else { 772 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection
773 whichTab=2; 773 }
774 } 774
775 } 775 return QWidget::eventFilter( o, e );
776 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection 776}
777 } 777
778 778
779 return QWidget::eventFilter( o, e ); 779void AdvancedFm::cancelRename() {
780} 780// qDebug("cancel rename");
781 781 QListView * view;
782 782 view = CurrentView();
783void AdvancedFm::cancelRename() { 783
784// qDebug("cancel rename"); 784 bool resetFocus = view->viewport()->focusProxy() == renameBox;
785 QListView * view; 785 delete renameBox;
786 view = CurrentView(); 786 renameBox = 0;
787 787 if ( resetFocus ) {
788 bool resetFocus = view->viewport()->focusProxy() == renameBox; 788 view->viewport()->setFocusProxy( view);
789 delete renameBox; 789 view->setFocus();
790 renameBox = 0; 790 }
791 if ( resetFocus ) { 791}
792 view->viewport()->setFocusProxy( view); 792
793 view->setFocus(); 793void AdvancedFm::doRename(QListView * view) {
794 } 794 if( !CurrentView()->currentItem()) return;
795} 795
796 796 QRect r = view->itemRect( view->currentItem( ));
797void AdvancedFm::doRename(QListView * view) { 797 r = QRect( view->viewportToContents( r.topLeft() ), r.size() );
798 if( !CurrentView()->currentItem()) return; 798 r.setX( view->contentsX() );
799 799
800 QRect r = view->itemRect( view->currentItem( )); 800 if ( r.width() > view->visibleWidth() )
801 r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); 801 r.setWidth( view->visibleWidth() );
802 r.setX( view->contentsX() ); 802
803 803 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" );
804 if ( r.width() > view->visibleWidth() ) 804 renameBox->setFrame(true);
805 r.setWidth( view->visibleWidth() ); 805
806 806 renameBox->setText( view->currentItem()->text(0) );
807 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); 807
808 renameBox->setFrame(true); 808 renameBox->selectAll();
809 809 renameBox->installEventFilter( this );
810 renameBox->setText( view->currentItem()->text(0) ); 810
811 811 view->addChild( renameBox, r.x(), r.y() );
812 renameBox->selectAll(); 812
813 renameBox->installEventFilter( this ); 813 renameBox->resize( r.size() );
814 814
815 view->addChild( renameBox, r.x(), r.y() ); 815 view->viewport()->setFocusProxy( renameBox );
816 816
817 renameBox->resize( r.size() ); 817 renameBox->setFocus();
818 818 renameBox->show();
819 view->viewport()->setFocusProxy( renameBox ); 819}
820 820
821 renameBox->setFocus(); 821
822 renameBox->show(); 822void AdvancedFm::renameIt() {
823} 823 if( !CurrentView()->currentItem()) return;
824 824
825 825 QListView *thisView = CurrentView();
826void AdvancedFm::renameIt() { 826 oldName = thisView->currentItem()->text(0);
827 if( !CurrentView()->currentItem()) return; 827 doRename( thisView );
828 828}
829 QListView *thisView = CurrentView(); 829
830 oldName = thisView->currentItem()->text(0); 830void AdvancedFm::okRename() {
831 doRename( thisView ); 831 if( !CurrentView()->currentItem()) return;
832} 832
833 833 QString newName = renameBox->text();
834void AdvancedFm::okRename() { 834 cancelRename();
835 if( !CurrentView()->currentItem()) return; 835 QListView * view = CurrentView();
836 836 QString path = CurrentDir()->canonicalPath() + "/";
837 QString newName = renameBox->text(); 837 oldName = path + oldName;
838 cancelRename(); 838 newName = path + newName;
839 QListView * view = CurrentView(); 839 if( rename( oldName.latin1(), newName.latin1())== -1)
840 QString path = CurrentDir()->canonicalPath() + "/"; 840 QMessageBox::message(tr("Note"),tr("Could not rename"));
841 oldName = path + oldName; 841 else
842 newName = path + newName; 842 oldName = "";
843 if( rename( oldName.latin1(), newName.latin1())== -1) 843 view->takeItem( view->currentItem() );
844 QMessageBox::message(tr("Note"),tr("Could not rename")); 844 delete view->currentItem();
845 else 845 rePopulate();
846 oldName = ""; 846}
847 view->takeItem( view->currentItem() ); 847
848 delete view->currentItem(); 848void AdvancedFm::openSearch() {
849 rePopulate(); 849 QMessageBox::message(tr("Note"),tr("Not Yet Implemented"));
850} 850}
851
852void AdvancedFm::openSearch() {
853 QMessageBox::message(tr("Note"),tr("Not Yet Implemented"));
854}
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp
index a42c824..a5492e4 100644
--- a/noncore/apps/checkbook/checkbook.cpp
+++ b/noncore/apps/checkbook/checkbook.cpp
@@ -482,10 +482,9 @@ void Checkbook::slotNewTran()
482 482
483 Transaction *currtran = new Transaction( this, true, info->name(), 483 Transaction *currtran = new Transaction( this, true, info->name(),
484 traninfo, 484 traninfo,
485 _pCfg ); 485 _pCfg );
486 currtran->showMaximized(); 486 if ( QPEApplication::execDialog( currtran ) == QDialog::Accepted )
487 if ( currtran->exec() == QDialog::Accepted )
488 { 487 {
489 // Add to transaction list 488 // Add to transaction list
490 info->addTransaction( traninfo ); 489 info->addTransaction( traninfo );
491 490
@@ -529,10 +528,9 @@ void Checkbook::slotEditTran()
529 528
530 Transaction *currtran = new Transaction( this, false, info->name(), 529 Transaction *currtran = new Transaction( this, false, info->name(),
531 traninfo, 530 traninfo,
532 _pCfg ); 531 _pCfg );
533 currtran->showMaximized(); 532 if ( QPEApplication::execDialog( currtran ) == QDialog::Accepted )
534 if ( currtran->exec() == QDialog::Accepted )
535 { 533 {
536 curritem->setText( COL_NUM, traninfo->number() ); 534 curritem->setText( COL_NUM, traninfo->number() );
537 curritem->setText( COL_SORTDATE, traninfo->datestr(false) ); 535 curritem->setText( COL_SORTDATE, traninfo->datestr(false) );
538 curritem->setText( COL_DATE, traninfo->datestr(true) ); 536 curritem->setText( COL_DATE, traninfo->datestr(true) );
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp
index f29001a..60aea42 100644
--- a/noncore/apps/checkbook/mainwindow.cpp
+++ b/noncore/apps/checkbook/mainwindow.cpp
@@ -35,13 +35,13 @@
35 35
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <qpe/global.h> 37#include <qpe/global.h>
38#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
39#include <qmenubar.h>
40#include <qpe/qpemessagebox.h> 39#include <qpe/qpemessagebox.h>
41#include <qpe/qpetoolbar.h> 40#include <qpe/qpetoolbar.h>
42#include <qpe/resource.h> 41#include <qpe/resource.h>
43 42
43#include <qmenubar.h>
44#include <qaction.h> 44#include <qaction.h>
45#include <qcheckbox.h> 45#include <qcheckbox.h>
46#include <qdir.h> 46#include <qdir.h>
47#include <qlineedit.h> 47#include <qlineedit.h>
@@ -213,10 +213,9 @@ void MainWindow::slotNew()
213{ 213{
214 CBInfo *cb = new CBInfo(); 214 CBInfo *cb = new CBInfo();
215 215
216 Checkbook *currcb = new Checkbook( this, cb, &_cfg ); 216 Checkbook *currcb = new Checkbook( this, cb, &_cfg );
217 currcb->showMaximized(); 217 if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted )
218 if ( currcb->exec() == QDialog::Accepted )
219 { 218 {
220 // Save new checkbook 219 // Save new checkbook
221 buildFilename( cb->name() ); 220 buildFilename( cb->name() );
222 _cfg.setLastBook( cb->name() ); 221 _cfg.setLastBook( cb->name() );
@@ -271,10 +270,9 @@ void MainWindow::openBook(QListViewItem *curritem)
271 } 270 }
272 271
273 _cfg.setLastBook( currname ); 272 _cfg.setLastBook( currname );
274 Checkbook *currcb = new Checkbook( this, cb, &_cfg ); 273 Checkbook *currcb = new Checkbook( this, cb, &_cfg );
275 currcb->showMaximized(); 274 if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted )
276 if ( currcb->exec() == QDialog::Accepted )
277 { 275 {
278 QString newname = cb->name(); 276 QString newname = cb->name();
279 if ( currname != newname ) 277 if ( currname != newname )
280 { 278 {
@@ -344,10 +342,9 @@ void MainWindow::slotDelete()
344// --- slotConfigure ---------------------------------------------------------- 342// --- slotConfigure ----------------------------------------------------------
345void MainWindow::slotConfigure() 343void MainWindow::slotConfigure()
346{ 344{
347 Configuration *cfgdlg = new Configuration( this, _cfg ); 345 Configuration *cfgdlg = new Configuration( this, _cfg );
348 cfgdlg->showMaximized(); 346 if ( QPEApplication::execDialog( cfgdlg ) == QDialog::Accepted )
349 if ( cfgdlg->exec() == QDialog::Accepted )
350 { 347 {
351 // read data from config dialog & save it 348 // read data from config dialog & save it
352 cfgdlg->saveConfig( _cfg ); 349 cfgdlg->saveConfig( _cfg );
353 writeConfig(); 350 writeConfig();
diff --git a/noncore/apps/odict/configdlg.cpp b/noncore/apps/odict/configdlg.cpp
index 2103df9..b12a395 100644
--- a/noncore/apps/odict/configdlg.cpp
+++ b/noncore/apps/odict/configdlg.cpp
@@ -16,12 +16,13 @@
16 **************************************************************************/ 16 **************************************************************************/
17#include "configdlg.h" 17#include "configdlg.h"
18#include "searchmethoddlg.h" 18#include "searchmethoddlg.h"
19 19
20#include <qdialog.h> 20#include <qpe/qpeapplication.h>
21#include <qpe/config.h> 21#include <qpe/config.h>
22#include <qlayout.h>
23 22
23#include <qdialog.h>
24#include <qlayout.h>
24#include <qhbox.h> 25#include <qhbox.h>
25#include <qvbox.h> 26#include <qvbox.h>
26#include <qlabel.h> 27#include <qlabel.h>
27#include <qlistview.h> 28#include <qlistview.h>
@@ -34,9 +35,9 @@ ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(pa
34 setCaption( tr( "Options" ) ); 35 setCaption( tr( "Options" ) );
35 QVBoxLayout *vbox_layout = new QVBoxLayout( this ); 36 QVBoxLayout *vbox_layout = new QVBoxLayout( this );
36 search_tab = new QWidget( this , "search_tab" ); 37 search_tab = new QWidget( this , "search_tab" );
37 QVBoxLayout *vbox_layout_searchtab = new QVBoxLayout( search_tab, 4 , 4 ,"blah" ); 38 QVBoxLayout *vbox_layout_searchtab = new QVBoxLayout( search_tab, 4 , 4 ,"blah" );
38 39
39 QHBox *hbox = new QHBox( search_tab ); 40 QHBox *hbox = new QHBox( search_tab );
40 list = new QListView( hbox ); 41 list = new QListView( hbox );
41 list->addColumn( tr( "Searchmethod" ) ); 42 list->addColumn( tr( "Searchmethod" ) );
42 loadSearchMethodNames(); 43 loadSearchMethodNames();
@@ -52,9 +53,9 @@ ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(pa
52 vbox_layout_searchtab->addWidget( hbox ); 53 vbox_layout_searchtab->addWidget( hbox );
53 54
54 vbox_layout->addWidget( search_tab ); 55 vbox_layout->addWidget( search_tab );
55 56
56 showMaximized(); 57 QPEApplication::execDialog( this );
57} 58}
58 59
59void ConfigDlg::slotNewMethod() 60void ConfigDlg::slotNewMethod()
60{ 61{
diff --git a/noncore/apps/odict/searchmethoddlg.cpp b/noncore/apps/odict/searchmethoddlg.cpp
index 99cd8db..8ed7152 100644
--- a/noncore/apps/odict/searchmethoddlg.cpp
+++ b/noncore/apps/odict/searchmethoddlg.cpp
@@ -15,12 +15,13 @@
15 * * 15 * *
16 **************************************************************************/ 16 **************************************************************************/
17#include "searchmethoddlg.h" 17#include "searchmethoddlg.h"
18 18
19#include <qdialog.h>
20#include <qpe/config.h> 19#include <qpe/config.h>
21#include <qlayout.h> 20#include <qpe/qpeapplication.h>
22 21
22#include <qdialog.h>
23#include <qlayout.h>
23#include <qhbox.h> 24#include <qhbox.h>
24#include <qvbox.h> 25#include <qvbox.h>
25#include <qlabel.h> 26#include <qlabel.h>
26#include <qpushbutton.h> 27#include <qpushbutton.h>
@@ -54,24 +55,24 @@ SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal,
54 lang1 = new QLineEdit( dummywidget ); 55 lang1 = new QLineEdit( dummywidget );
55 lang2 = new QLineEdit( dummywidget ); 56 lang2 = new QLineEdit( dummywidget );
56 trenner = new QLineEdit( dummywidget ); 57 trenner = new QLineEdit( dummywidget );
57 trenner->setText( "::" ); 58 trenner->setText( "::" );
58 59
59 QGridLayout *grid = new QGridLayout( dummywidget, 2,3 ); 60 QGridLayout *grid = new QGridLayout( dummywidget, 2,3 );
60 grid->addWidget( lag1, 0,0 ); 61 grid->addWidget( lag1, 0,0 );
61 grid->addWidget( devider, 0,1 ); 62 grid->addWidget( devider, 0,1 );
62 grid->addWidget( lag2, 0,2 ); 63 grid->addWidget( lag2, 0,2 );
63 grid->addWidget( lang1, 1,0 ); 64 grid->addWidget( lang1, 1,0 );
64 grid->addWidget( trenner, 1,1 ); 65 grid->addWidget( trenner, 1,1 );
65 grid->addWidget( lang2, 1,2 ); 66 grid->addWidget( lang2, 1,2 );
66 67
67 vbox_layout->addWidget( vbox ); 68 vbox_layout->addWidget( vbox );
68 69
69 showMaximized(); 70 QPEApplication::execDialog ( this );
70 71
71 if( !itemname ) 72 if( !itemname )
72 setCaption( tr( "New Searchmethod" ) ); 73 setCaption( tr( "New Searchmethod" ) );
73 else 74 else
74 { 75 {
75 setCaption( tr( "Change Searchmethod" ) ); 76 setCaption( tr( "Change Searchmethod" ) );
76 itemName = itemname; 77 itemName = itemname;
77 setupEntries(itemname); 78 setupEntries(itemname);
diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp
index 8c4ee93..cd0a364 100644
--- a/noncore/apps/opie-bartender/bartender.cpp
+++ b/noncore/apps/opie-bartender/bartender.cpp
@@ -168,10 +168,9 @@ void Bartender::fileNew() {
168 168
169 New_Drink *newDrinks; 169 New_Drink *newDrinks;
170 newDrinks = new New_Drink(this,"New Drink....", TRUE); 170 newDrinks = new New_Drink(this,"New Drink....", TRUE);
171 QString newName, newIng; 171 QString newName, newIng;
172 newDrinks->showMaximized(); 172 QPEApplication::execDialog( newDrinks );
173 newDrinks->exec();
174 newName = newDrinks->LineEdit1->text(); 173 newName = newDrinks->LineEdit1->text();
175 newIng= newDrinks->MultiLineEdit1->text(); 174 newIng= newDrinks->MultiLineEdit1->text();
176 175
177 if(dbFile.isOpen()) 176 if(dbFile.isOpen())
@@ -225,10 +224,9 @@ void Bartender::showDrink( QListViewItem *item) {
225 if( dbFile.atEnd() ) break; 224 if( dbFile.atEnd() ) break;
226 } 225 }
227 } 226 }
228 } 227 }
229 showDrinks->showMaximized(); 228 QPEApplication::execDialog( showDrinks );
230 showDrinks->exec();
231 229
232 if(showDrinks ->result() ==0) { 230 if(showDrinks ->result() ==0) {
233 doEdit(); 231 doEdit();
234 } 232 }
@@ -316,11 +314,10 @@ void Bartender::showSearchResult(QStringList &searchList) {
316 314
317 searchList.sort(); 315 searchList.sort();
318 316
319 searchDlg = new Search_Results(this, "Search Results", TRUE); 317 searchDlg = new Search_Results(this, "Search Results", TRUE);
320 searchDlg->showMaximized();
321 searchDlg->ListBox1->insertStringList( searchList,-1); 318 searchDlg->ListBox1->insertStringList( searchList,-1);
322 searchDlg->exec(); 319 QPEApplication::execDialog( searchDlg );
323 320
324 if( searchDlg->result() == 1 ) { 321 if( searchDlg->result() == 1 ) {
325 result= searchDlg->ListBox1->currentText(); 322 result= searchDlg->ListBox1->currentText();
326 } 323 }
@@ -345,11 +342,11 @@ void Bartender::doEdit() {
345 int foundAt=0; 342 int foundAt=0;
346 New_Drink *newDrinks; 343 New_Drink *newDrinks;
347 newDrinks = new New_Drink(this,"Edit Drink....", TRUE); 344 newDrinks = new New_Drink(this,"Edit Drink....", TRUE);
348 QString newName, newIng; 345 QString newName, newIng;
349 newDrinks->showMaximized(); 346 QPEApplication::showDialog( newDrinks );
350 QTextStream t( &dbFile); 347 QTextStream t( &dbFile);
351 348
352 QString s, s2; 349 QString s, s2;
353 while ( !t.eof()) { 350 while ( !t.eof()) {
354 s = t.readLine(); 351 s = t.readLine();
355 if(s.find( myDrink, 0, TRUE) != -1) { 352 if(s.find( myDrink, 0, TRUE) != -1) {
@@ -400,10 +397,9 @@ void Bartender::clearList() {
400 397
401void Bartender::doBac() { 398void Bartender::doBac() {
402 BacDialog *bacDlg; 399 BacDialog *bacDlg;
403 bacDlg = new BacDialog(this,"BAC",TRUE); 400 bacDlg = new BacDialog(this,"BAC",TRUE);
404 bacDlg->showMaximized(); 401 QPEApplication::execDialog( bacDlg );
405 bacDlg->exec();
406 delete bacDlg; 402 delete bacDlg;
407} 403}
408 404
409void Bartender::openCurrentDrink() { 405void Bartender::openCurrentDrink() {
diff --git a/noncore/apps/opie-console/configdialog.cpp b/noncore/apps/opie-console/configdialog.cpp
index b23f4d0..882cd3d 100644
--- a/noncore/apps/opie-console/configdialog.cpp
+++ b/noncore/apps/opie-console/configdialog.cpp
@@ -1,6 +1,8 @@
1#include <qlistview.h>
2 1
2#include <qpe/qpeapplication.h>
3
4#include <qlistview.h>
3 5
4#include "configdialog.h" 6#include "configdialog.h"
5#include "profileeditordialog.h" 7#include "profileeditordialog.h"
6 8
@@ -72,10 +74,9 @@ void ConfigDialog::slotEdit() {
72 74
73 ProfileEditorDialog dlg(m_fact, p); 75 ProfileEditorDialog dlg(m_fact, p);
74 76
75 dlg.setCaption(tr("Edit Connection Profile")); 77 dlg.setCaption(tr("Edit Connection Profile"));
76 dlg.showMaximized(); 78 int ret = QPEApplication::execDialog( &dlg );
77 int ret = dlg.exec();
78 79
79 if(ret == QDialog::Accepted) 80 if(ret == QDialog::Accepted)
80 { 81 {
81 if(lstView->currentItem()) delete lstView->currentItem(); 82 if(lstView->currentItem()) delete lstView->currentItem();
@@ -91,10 +92,9 @@ void ConfigDialog::slotEdit() {
91void ConfigDialog::slotAdd() { 92void ConfigDialog::slotAdd() {
92 ProfileEditorDialog dlg(m_fact); 93 ProfileEditorDialog dlg(m_fact);
93 94
94 dlg.setCaption(tr("New Connection")); 95 dlg.setCaption(tr("New Connection"));
95 dlg.showMaximized(); 96 int ret = QPEApplication::execDialog( &dlg );
96 int ret = dlg.exec();
97 97
98 if(ret == QDialog::Accepted) 98 if(ret == QDialog::Accepted)
99 { 99 {
100 // TODO: Move into general profile save part 100 // TODO: Move into general profile save part
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 2673335..3fe9040 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -7,8 +7,9 @@
7#include <qwhatsthis.h> 7#include <qwhatsthis.h>
8#include <qfileinfo.h> 8#include <qfileinfo.h>
9 9
10#include <qpe/filemanager.h> 10#include <qpe/filemanager.h>
11#include <qpe/qpeapplication.h>
11 12
12#include <opie/ofiledialog.h> 13#include <opie/ofiledialog.h>
13 14
14#include "TEmulation.h" 15#include "TEmulation.h"
@@ -309,11 +310,10 @@ QList<Session> MainWindow::sessions() {
309} 310}
310 311
311void MainWindow::slotNew() { 312void MainWindow::slotNew() {
312 ProfileEditorDialog dlg(factory() ); 313 ProfileEditorDialog dlg(factory() );
313 dlg.showMaximized();
314 dlg.setCaption( tr("New Connection") ); 314 dlg.setCaption( tr("New Connection") );
315 int ret = dlg.exec(); 315 int ret = QPEApplication::execDialog( &dlg );
316 316
317 if ( ret == QDialog::Accepted ) { 317 if ( ret == QDialog::Accepted ) {
318 create( dlg.profile() ); 318 create( dlg.profile() );
319 } 319 }
@@ -424,11 +424,10 @@ void MainWindow::slotQuickLaunch() {
424} 424}
425 425
426void MainWindow::slotConfigure() { 426void MainWindow::slotConfigure() {
427 ConfigDialog conf( manager()->all(), factory() ); 427 ConfigDialog conf( manager()->all(), factory() );
428 conf.showMaximized();
429 428
430 int ret = conf.exec(); 429 int ret = QPEApplication::execDialog( &conf );
431 430
432 if ( QDialog::Accepted == ret ) { 431 if ( QDialog::Accepted == ret ) {
433 manager()->setProfiles( conf.list() ); 432 manager()->setProfiles( conf.list() );
434 manager()->save(); 433 manager()->save();
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp
index e552990..3466e3a 100644
--- a/noncore/apps/opie-console/modemconfigwidget.cpp
+++ b/noncore/apps/opie-console/modemconfigwidget.cpp
@@ -1,4 +1,7 @@
1
2#include <qpe/qpeapplication.h>
3
1#include <qlabel.h> 4#include <qlabel.h>
2#include <qlayout.h> 5#include <qlayout.h>
3#include <qcombobox.h> 6#include <qcombobox.h>
4#include <qpushbutton.h> 7#include <qpushbutton.h>
@@ -236,10 +239,9 @@ void ModemConfigWidget::slotAT() {
236 // josef/Max I know why don't you create the stuff on the stack 239 // josef/Max I know why don't you create the stuff on the stack
237 // but making it a TopLevel Dialog and ignoring 240 // but making it a TopLevel Dialog and ignoring
238 // cancel is not fun either... 241 // cancel is not fun either...
239 // what to do? FIXME!!! -zecke 242 // what to do? FIXME!!! -zecke
240 atConf->showMaximized(); 243 if ( QPEApplication::execDialog( atConf ) != QDialog::Accepted ) {
241 if ( atConf->exec() != QDialog::Accepted ) {
242 // reload old settings 244 // reload old settings
243 } 245 }
244} 246}
245 247
@@ -247,9 +249,8 @@ void ModemConfigWidget::slotDial() {
247 DialDialog dial( this, "DialConfig", true ); 249 DialDialog dial( this, "DialConfig", true );
248 if(!m_telNumber->text().isEmpty()) { 250 if(!m_telNumber->text().isEmpty()) {
249 dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ \\.\\,]"), "")); 251 dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ \\.\\,]"), ""));
250 } 252 }
251 dial.showMaximized(); 253 if ( QPEApplication::execDialog( &dial ) == QDialog::Accepted ) {
252 if ( dial.exec() == QDialog::Accepted ) {
253 m_telNumber->setText( dial.number() ); 254 m_telNumber->setText( dial.number() );
254 } 255 }
255} 256}
diff --git a/noncore/apps/opie-reader/CloseDialog.cpp b/noncore/apps/opie-reader/CloseDialog.cpp
index 741fa67..d7c2652 100644
--- a/noncore/apps/opie-reader/CloseDialog.cpp
+++ b/noncore/apps/opie-reader/CloseDialog.cpp
@@ -1,7 +1,9 @@
1#include "CloseDialog.h" 1#include "CloseDialog.h"
2#include "qlayout.h" 2#include "qlayout.h"
3 3
4#include <qpe/qpeapplication.h>
5
4CCloseDialog::CCloseDialog(const QString& fname, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true) 6CCloseDialog::CCloseDialog(const QString& fname, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true)
5{ 7{
6 setCaption(tr("Tidy-up")); 8 setCaption(tr("Tidy-up"));
7 QVBoxLayout *tmp = new QVBoxLayout(this); 9 QVBoxLayout *tmp = new QVBoxLayout(this);
@@ -13,6 +15,7 @@ CCloseDialog::CCloseDialog(const QString& fname, bool fs, QWidget* parent, const
13 config = new QCheckBox(tr("Delete Configuration"), vb); 15 config = new QCheckBox(tr("Delete Configuration"), vb);
14 file->setChecked(false); 16 file->setChecked(false);
15 marks->setChecked(true); 17 marks->setChecked(true);
16 config->setChecked(true); 18 config->setChecked(true);
17 if (fs) showMaximized(); 19 if (fs)
20 QPEApplication::showDialog( this );
18} 21}
diff --git a/noncore/apps/opie-reader/Prefs.cpp b/noncore/apps/opie-reader/Prefs.cpp
index e5320d9..5150ca5 100644
--- a/noncore/apps/opie-reader/Prefs.cpp
+++ b/noncore/apps/opie-reader/Prefs.cpp
@@ -26,8 +26,10 @@
26#else 26#else
27#include <qfontdatabase.h> 27#include <qfontdatabase.h>
28#endif 28#endif
29 29
30#include <qpe/qpeapplication.h>
31
30CLayoutPrefs::CLayoutPrefs( QWidget* parent, const char* name, WFlags fl ) 32CLayoutPrefs::CLayoutPrefs( QWidget* parent, const char* name, WFlags fl )
31 : QWidget( parent, name, fl ) 33 : QWidget( parent, name, fl )
32{ 34{
33 QHBoxLayout* hb = new QHBoxLayout(this); 35 QHBoxLayout* hb = new QHBoxLayout(this);
@@ -426,9 +428,10 @@ CPrefs::CPrefs(bool fs, QWidget* parent, const char* name) : QDialog(parent, nam
426 td->addTab(button, tr("Buttons")); 428 td->addTab(button, tr("Buttons"));
427 QVBoxLayout* v = new QVBoxLayout(this); 429 QVBoxLayout* v = new QVBoxLayout(this);
428 v->addWidget(td); 430 v->addWidget(td);
429 431
430 if (fs) showMaximized(); 432 if (fs)
433 QPEApplication::showDialog( this );
431} 434}
432 435
433 436
434/* 437/*
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp
index f10020a..07af597 100644
--- a/noncore/apps/opie-reader/QTReaderApp.cpp
+++ b/noncore/apps/opie-reader/QTReaderApp.cpp
@@ -1,4222 +1,4222 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. Allrights reserved. 2** Copyright (C) 2000 Trolltech AS. Allrights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "useqpe.h" 20#include "useqpe.h"
21#include <qregexp.h> 21#include <qregexp.h>
22#include <qclipboard.h> 22#include <qclipboard.h>
23#include <qwidgetstack.h> 23#include <qwidgetstack.h>
24#ifdef USEQPE 24#ifdef USEQPE
25#include <qmenubar.h> 25#include <qmenubar.h>
26#include <qpe/qpetoolbar.h> 26#include <qpe/qpetoolbar.h>
27#endif 27#endif
28#include <qmenubar.h> 28#include <qmenubar.h>
29#include <qtoolbar.h> 29#include <qtoolbar.h>
30#ifdef USEQPE 30#ifdef USEQPE
31#include <qpe/menubutton.h> 31#include <qpe/menubutton.h>
32#include <qpe/fontdatabase.h> 32#include <qpe/fontdatabase.h>
33#endif 33#endif
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36#include <qaction.h> 36#include <qaction.h>
37#include <qapplication.h> 37#include <qapplication.h>
38#include <qlineedit.h> 38#include <qlineedit.h>
39#include <qtoolbutton.h> 39#include <qtoolbutton.h>
40#include <qspinbox.h> 40#include <qspinbox.h>
41#include <qobjectlist.h> 41#include <qobjectlist.h>
42#ifdef USEQPE 42#ifdef USEQPE
43#include <qpe/global.h> 43#include <qpe/global.h>
44#include <qpe/applnk.h> 44#include <qpe/applnk.h>
45#endif 45#endif
46#include <qfileinfo.h> 46#include <qfileinfo.h>
47#include <stdlib.h> //getenv 47#include <stdlib.h> //getenv
48#include <qprogressbar.h> 48#include <qprogressbar.h>
49#ifdef USEQPE 49#ifdef USEQPE
50#include <qpe/config.h> 50#include <qpe/config.h>
51#endif 51#endif
52#include <qbuttongroup.h> 52#include <qbuttongroup.h>
53#include <qradiobutton.h> 53#include <qradiobutton.h>
54#ifdef USEQPE 54#ifdef USEQPE
55#include <qpe/qcopenvelope_qws.h> 55#include <qpe/qcopenvelope_qws.h>
56#endif 56#endif
57#include "QTReader.h" 57#include "QTReader.h"
58#include "GraphicWin.h" 58#include "GraphicWin.h"
59#include "Bkmks.h" 59#include "Bkmks.h"
60#include "cbkmkselector.h" 60#include "cbkmkselector.h"
61#include "infowin.h" 61#include "infowin.h"
62#include "ToolbarPrefs.h" 62#include "ToolbarPrefs.h"
63#include "Prefs.h" 63#include "Prefs.h"
64#include "CAnnoEdit.h" 64#include "CAnnoEdit.h"
65#include "QFloatBar.h" 65#include "QFloatBar.h"
66#include "FixedFont.h" 66#include "FixedFont.h"
67#include "URLDialog.h" 67#include "URLDialog.h"
68//#include <qpe/fontdatabase.h> 68//#include <qpe/fontdatabase.h>
69 69
70#ifdef USEQPE 70#ifdef USEQPE
71#include <qpe/resource.h> 71#include <qpe/resource.h>
72#include <qpe/qpeapplication.h> 72#include <qpe/qpeapplication.h>
73#include "fileBrowser.h" 73#include "fileBrowser.h"
74#else 74#else
75#include "qfiledialog.h" 75#include "qfiledialog.h"
76#endif 76#endif
77 77
78#include "QTReaderApp.h" 78#include "QTReaderApp.h"
79#include "CDrawBuffer.h" 79#include "CDrawBuffer.h"
80#include "Filedata.h" 80#include "Filedata.h"
81#include "opie.h" 81#include "opie.h"
82#include "useqpe.h" 82#include "useqpe.h"
83#include "names.h" 83#include "names.h"
84#include "CEncoding_tables.h" 84#include "CEncoding_tables.h"
85#include "CloseDialog.h" 85#include "CloseDialog.h"
86 86
87bool CheckVersion(int&, int&, char&); 87bool CheckVersion(int&, int&, char&);
88 88
89#ifdef _WINDOWS 89#ifdef _WINDOWS
90#define PICDIR "c:\\uqtreader\\pics\\" 90#define PICDIR "c:\\uqtreader\\pics\\"
91#else 91#else
92#ifdef USEQPE 92#ifdef USEQPE
93#define PICDIR "opie-reader/" 93#define PICDIR "opie-reader/"
94#else 94#else
95#define PICDIR "/home/tim/uqtreader/pics/" 95#define PICDIR "/home/tim/uqtreader/pics/"
96#endif 96#endif
97#endif 97#endif
98 98
99unsigned long QTReaderApp::m_uid = 0; 99unsigned long QTReaderApp::m_uid = 0;
100 100
101void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); } 101void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); }
102 102
103#ifdef USEQPE 103#ifdef USEQPE
104#define geticon(iconname) Resource::loadPixmap( iconname ) 104#define geticon(iconname) Resource::loadPixmap( iconname )
105#define getmyicon(iconname) Resource::loadPixmap( PICDIR iconname ) 105#define getmyicon(iconname) Resource::loadPixmap( PICDIR iconname )
106#else 106#else
107#define geticon(iconname) QPixmap(PICDIR iconname ".png") 107#define geticon(iconname) QPixmap(PICDIR iconname ".png")
108#define getmyicon(iconname) geticon(iconname) 108#define getmyicon(iconname) geticon(iconname)
109//#define geticon(iconname) QIconSet( QPixmap(PICDIR iconname) ) 109//#define geticon(iconname) QIconSet( QPixmap(PICDIR iconname) )
110#endif 110#endif
111 111
112#ifndef _WINDOWS 112#ifndef _WINDOWS
113#include <unistd.h> 113#include <unistd.h>
114#endif 114#endif
115#include <stddef.h> 115#include <stddef.h>
116#ifndef _WINDOWS 116#ifndef _WINDOWS
117#include <dirent.h> 117#include <dirent.h>
118#endif 118#endif
119 119
120void QTReaderApp::listBkmkFiles() 120void QTReaderApp::listBkmkFiles()
121{ 121{
122 bkmkselector->clear(); 122 bkmkselector->clear();
123 bkmkselector->setText("Cancel"); 123 bkmkselector->setText("Cancel");
124#ifndef USEQPE 124#ifndef USEQPE
125 int cnt = 0; 125 int cnt = 0;
126 126
127 QDir d = QDir::home(); // "/" 127 QDir d = QDir::home(); // "/"
128 if ( !d.cd(APPDIR) ) { // "/tmp" 128 if ( !d.cd(APPDIR) ) { // "/tmp"
129 qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); 129 qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
130 d = QDir::home(); 130 d = QDir::home();
131 d.mkdir(APPDIR); 131 d.mkdir(APPDIR);
132 d.cd(APPDIR); 132 d.cd(APPDIR);
133 } 133 }
134 134
135 135
136 136
137 137
138 d.setFilter( QDir::Files | QDir::NoSymLinks ); 138 d.setFilter( QDir::Files | QDir::NoSymLinks );
139// d.setSorting( QDir::Size | QDir::Reversed ); 139// d.setSorting( QDir::Size | QDir::Reversed );
140 140
141 const QFileInfoList *list = d.entryInfoList(); 141 const QFileInfoList *list = d.entryInfoList();
142 QFileInfoListIterator it( *list ); // create list iterator 142 QFileInfoListIterator it( *list ); // create list iterator
143 QFileInfo *fi; // pointer for traversing 143 QFileInfo *fi; // pointer for traversing
144 144
145 while ( (fi=it.current()) ) { // for each file... 145 while ( (fi=it.current()) ) { // for each file...
146 146
147 bkmkselector->insertItem(fi->fileName()); 147 bkmkselector->insertItem(fi->fileName());
148 cnt++; 148 cnt++;
149 149
150 //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); 150 //qDebug( "%10li %s", fi->size(), fi->fileName().data() );
151 ++it; // goto next list element 151 ++it; // goto next list element
152 } 152 }
153 153
154#else /* USEQPE */ 154#else /* USEQPE */
155 int cnt = 0; 155 int cnt = 0;
156 DIR *d; 156 DIR *d;
157 d = opendir((const char *)Global::applicationFileName(APPDIR,"")); 157 d = opendir((const char *)Global::applicationFileName(APPDIR,""));
158 158
159 while(1) 159 while(1)
160 { 160 {
161 struct dirent* de; 161 struct dirent* de;
162 struct stat buf; 162 struct stat buf;
163 de = readdir(d); 163 de = readdir(d);
164 if (de == NULL) break; 164 if (de == NULL) break;
165 165
166 if (lstat((const char *)Global::applicationFileName(APPDIR,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) 166 if (lstat((const char *)Global::applicationFileName(APPDIR,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode))
167 { 167 {
168 bkmkselector->insertItem(de->d_name); 168 bkmkselector->insertItem(de->d_name);
169 cnt++; 169 cnt++;
170 } 170 }
171 } 171 }
172 172
173 closedir(d); 173 closedir(d);
174#endif 174#endif
175 if (cnt > 0) 175 if (cnt > 0)
176 { 176 {
177//tjw menu->hide(); 177//tjw menu->hide();
178 editorStack->raiseWidget( bkmkselector ); 178 editorStack->raiseWidget( bkmkselector );
179 hidetoolbars(); 179 hidetoolbars();
180 m_nBkmkAction = cRmBkmkFile; 180 m_nBkmkAction = cRmBkmkFile;
181 } 181 }
182 else 182 else
183 QMessageBox::information(this, PROGNAME, "No bookmark files"); 183 QMessageBox::information(this, PROGNAME, "No bookmark files");
184} 184}
185 185
186void QTReaderApp::hidetoolbars() 186void QTReaderApp::hidetoolbars()
187{ 187{
188 menubar->hide(); 188 menubar->hide();
189 if (fileBar != NULL) fileBar->hide(); 189 if (fileBar != NULL) fileBar->hide();
190 if (viewBar != NULL) viewBar->hide(); 190 if (viewBar != NULL) viewBar->hide();
191 if (navBar != NULL) navBar->hide(); 191 if (navBar != NULL) navBar->hide();
192 if (markBar != NULL) markBar->hide(); 192 if (markBar != NULL) markBar->hide();
193 if (m_fontVisible) m_fontBar->hide(); 193 if (m_fontVisible) m_fontBar->hide();
194 if (regVisible) 194 if (regVisible)
195 { 195 {
196#ifdef USEQPE 196#ifdef USEQPE
197 Global::hideInputMethod(); 197 Global::hideInputMethod();
198#endif 198#endif
199 regBar->hide(); 199 regBar->hide();
200 } 200 }
201 if (searchVisible) 201 if (searchVisible)
202 { 202 {
203#ifdef USEQPE 203#ifdef USEQPE
204 Global::hideInputMethod(); 204 Global::hideInputMethod();
205#endif 205#endif
206 searchBar->hide(); 206 searchBar->hide();
207 } 207 }
208} 208}
209 209
210QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) 210QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
211 : QMainWindow( parent, name, f ), bFromDocView( FALSE ), m_dontSave(false), 211 : QMainWindow( parent, name, f ), bFromDocView( FALSE ), m_dontSave(false),
212 fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL) 212 fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL)
213{ 213{
214 m_url_clipboard = false; 214 m_url_clipboard = false;
215 m_url_localfile = false; 215 m_url_localfile = false;
216 m_url_globalfile = false; 216 m_url_globalfile = false;
217 ftime(&m_lastkeytime); 217 ftime(&m_lastkeytime);
218//// qDebug("Application directory = %s", (const tchar *)QPEApplication::documentDir()); 218//// qDebug("Application directory = %s", (const tchar *)QPEApplication::documentDir());
219//// qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml")); 219//// qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml"));
220 220
221 m_bcloseDisabled = true; 221 m_bcloseDisabled = true;
222 m_disableesckey = false; 222 m_disableesckey = false;
223 pBkmklist = NULL; 223 pBkmklist = NULL;
224 pOpenlist = NULL; 224 pOpenlist = NULL;
225// doc = 0; 225// doc = 0;
226 226
227 m_fBkmksChanged = false; 227 m_fBkmksChanged = false;
228 228
229 QString lang = getenv( "LANG" ); 229 QString lang = getenv( "LANG" );
230 QString rot = getenv( "QWS_DISPLAY" ); 230 QString rot = getenv( "QWS_DISPLAY" );
231 231
232/* 232/*
233 int m_rot = 0; 233 int m_rot = 0;
234 if (rot.contains("Rot90")) 234 if (rot.contains("Rot90"))
235 { 235 {
236 m_rot = 90; 236 m_rot = 90;
237 } 237 }
238 else if (rot.contains("Rot180")) 238 else if (rot.contains("Rot180"))
239 { 239 {
240 m_rot = 180; 240 m_rot = 180;
241 } 241 }
242 else if (rot.contains("Rot270")) 242 else if (rot.contains("Rot270"))
243 { 243 {
244 m_rot = 270; 244 m_rot = 270;
245 } 245 }
246 246
247// qDebug("Initial Rotation(%d):%s", m_rot, (const char*)rot); 247// qDebug("Initial Rotation(%d):%s", m_rot, (const char*)rot);
248*/ 248*/
249 m_autogenstr = "^ *[A-Z].*[a-z] *$"; 249 m_autogenstr = "^ *[A-Z].*[a-z] *$";
250 250
251#ifdef USEQPE 251#ifdef USEQPE
252 setIcon( Resource::loadPixmap( PICDIR "uqtreader") ); 252 setIcon( Resource::loadPixmap( PICDIR "uqtreader") );
253#else 253#else
254 setIcon( QPixmap (PICDIR "uqtreader.png") ); 254 setIcon( QPixmap (PICDIR "uqtreader.png") );
255#endif /* USEQPE */ 255#endif /* USEQPE */
256 256
257// QToolBar *bar = new QToolBar( this ); 257// QToolBar *bar = new QToolBar( this );
258// menubar = new QToolBar( this ); 258// menubar = new QToolBar( this );
259#ifdef USEQPE 259#ifdef USEQPE
260 Config config( APPDIR ); 260 Config config( APPDIR );
261#else 261#else
262 QDir d = QDir::home(); // "/" 262 QDir d = QDir::home(); // "/"
263 if ( !d.cd(APPDIR) ) { // "/tmp" 263 if ( !d.cd(APPDIR) ) { // "/tmp"
264 qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); 264 qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
265 d = QDir::home(); 265 d = QDir::home();
266 d.mkdir(APPDIR); 266 d.mkdir(APPDIR);
267 d.cd(APPDIR); 267 d.cd(APPDIR);
268 } 268 }
269 QFileInfo fi(d, INIFILE); 269 QFileInfo fi(d, INIFILE);
270// qDebug("Path:%s", (const char*)fi.absFilePath()); 270// qDebug("Path:%s", (const char*)fi.absFilePath());
271 Config config(fi.absFilePath()); 271 Config config(fi.absFilePath());
272#endif 272#endif
273 config.setGroup("Toolbar"); 273 config.setGroup("Toolbar");
274 m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false); 274 m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false);
275 m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1); 275 m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1);
276 m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2); 276 m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2);
277 menubar = new QToolBar("Menus", this, m_tbposition); 277 menubar = new QToolBar("Menus", this, m_tbposition);
278 278
279// fileBar = new QToolBar("File", this); 279// fileBar = new QToolBar("File", this);
280// QToolBar* viewBar = new QToolBar("File", this); 280// QToolBar* viewBar = new QToolBar("File", this);
281// QToolBar* navBar = new QToolBar("File", this); 281// QToolBar* navBar = new QToolBar("File", this);
282// QToolBar* markBar = new QToolBar("File", this); 282// QToolBar* markBar = new QToolBar("File", this);
283 283
284#ifdef USEQPE 284#ifdef USEQPE
285 mb = new QMenuBar( menubar ); 285 mb = new QMenuBar( menubar );
286#else 286#else
287 mb = new QMenuBar( menubar ); 287 mb = new QMenuBar( menubar );
288#endif 288#endif
289 289
290//#ifdef USEQPE 290//#ifdef USEQPE
291 QPopupMenu* tmp = new QPopupMenu(mb); 291 QPopupMenu* tmp = new QPopupMenu(mb);
292 mb->insertItem( geticon( "AppsIcon" ), tmp ); 292 mb->insertItem( geticon( "AppsIcon" ), tmp );
293//#else 293//#else
294// QMenuBar* tmp = mb; 294// QMenuBar* tmp = mb;
295//#endif 295//#endif
296 296
297 QPopupMenu *file = new QPopupMenu( mb ); 297 QPopupMenu *file = new QPopupMenu( mb );
298 tmp->insertItem( tr( "File" ), file ); 298 tmp->insertItem( tr( "File" ), file );
299 299
300 QPopupMenu *navigation = new QPopupMenu(mb); 300 QPopupMenu *navigation = new QPopupMenu(mb);
301 tmp->insertItem( tr( "Navigation" ), navigation ); 301 tmp->insertItem( tr( "Navigation" ), navigation );
302 302
303 QPopupMenu *view = new QPopupMenu( mb ); 303 QPopupMenu *view = new QPopupMenu( mb );
304 tmp->insertItem( tr( "View" ), view ); 304 tmp->insertItem( tr( "View" ), view );
305 305
306 QPopupMenu *marks = new QPopupMenu( this ); 306 QPopupMenu *marks = new QPopupMenu( this );
307 tmp->insertItem( tr( "Marks" ), marks ); 307 tmp->insertItem( tr( "Marks" ), marks );
308 308
309 QPopupMenu *settings = new QPopupMenu( this ); 309 QPopupMenu *settings = new QPopupMenu( this );
310 tmp->insertItem( tr( "Settings" ), settings ); 310 tmp->insertItem( tr( "Settings" ), settings );
311 311
312// addToolBar(menubar, "Menus",QMainWindow::Top); 312// addToolBar(menubar, "Menus",QMainWindow::Top);
313// addToolBar(fileBar, "Toolbar",QMainWindow::Top); 313// addToolBar(fileBar, "Toolbar",QMainWindow::Top);
314 314
315 // QPopupMenu *edit = new QPopupMenu( this ); 315 // QPopupMenu *edit = new QPopupMenu( this );
316 316
317 /* 317 /*
318 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 318 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
319 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 319 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
320 a->addTo( bar ); 320 a->addTo( bar );
321 a->addTo( file ); 321 a->addTo( file );
322 */ 322 */
323 323
324 editorStack = new QWidgetStack( this ); 324 editorStack = new QWidgetStack( this );
325 setCentralWidget( editorStack ); 325 setCentralWidget( editorStack );
326 326
327 searchVisible = FALSE; 327 searchVisible = FALSE;
328 regVisible = FALSE; 328 regVisible = FALSE;
329 m_fontVisible = false; 329 m_fontVisible = false;
330 330
331 m_annoWin = new CAnnoEdit(editorStack); 331 m_annoWin = new CAnnoEdit(editorStack);
332 editorStack->addWidget(m_annoWin, get_unique_id()); 332 editorStack->addWidget(m_annoWin, get_unique_id());
333 connect( m_annoWin, SIGNAL( finished(const QString&, const QString&) ), this, SLOT( addAnno(const QString&, const QString&) ) ); 333 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() ) ); 334 connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) );
335 335
336 m_infoWin = new infowin(editorStack); 336 m_infoWin = new infowin(editorStack);
337 editorStack->addWidget(m_infoWin, get_unique_id()); 337 editorStack->addWidget(m_infoWin, get_unique_id());
338 connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) ); 338 connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) );
339 339
340 m_graphicwin = new GraphicWin(editorStack); 340 m_graphicwin = new GraphicWin(editorStack);
341 editorStack->addWidget(m_graphicwin, get_unique_id()); 341 editorStack->addWidget(m_graphicwin, get_unique_id());
342 connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) ); 342 connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) );
343 343
344// bkmkselector = new QListBox(editorStack, "Bookmarks"); 344// bkmkselector = new QListBox(editorStack, "Bookmarks");
345 bkmkselector = new CBkmkSelector(editorStack, "Bookmarks"); 345 bkmkselector = new CBkmkSelector(editorStack, "Bookmarks");
346 // connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) ); 346 // connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) );
347 connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) ); 347 connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) );
348 connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) ); 348 connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) );
349 editorStack->addWidget( bkmkselector, get_unique_id() ); 349 editorStack->addWidget( bkmkselector, get_unique_id() );
350 350
351/* 351/*
352 importSelector = new FileSelector( "*", editorStack, "importselector", false ); 352 importSelector = new FileSelector( "*", editorStack, "importselector", false );
353 connect( importSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( importFile( const DocLnk & ) ) ); 353 connect( importSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( importFile( const DocLnk & ) ) );
354 354
355 editorStack->addWidget( importSelector, get_unique_id() ); 355 editorStack->addWidget( importSelector, get_unique_id() );
356 356
357 // don't need the close visible, it is redundant... 357 // don't need the close visible, it is redundant...
358 importSelector->setCloseVisible( FALSE ); 358 importSelector->setCloseVisible( FALSE );
359*/ 359*/
360// qDebug("Reading file list"); 360// qDebug("Reading file list");
361 readfilelist(); 361 readfilelist();
362 362
363 reader = new QTReader( editorStack ); 363 reader = new QTReader( editorStack );
364 364
365 reader->bDoUpdates = false; 365 reader->bDoUpdates = false;
366 366
367#ifdef USEQPE 367#ifdef USEQPE
368 ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); 368 ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold);
369#endif 369#endif
370 370
371// qDebug("Reading config"); 371// qDebug("Reading config");
372// Config config( APPDIR ); 372// Config config( APPDIR );
373 config.setGroup( "View" ); 373 config.setGroup( "View" );
374 m_debounce = config.readNumEntry("Debounce", 0); 374 m_debounce = config.readNumEntry("Debounce", 0);
375#ifdef USEQPE 375#ifdef USEQPE
376 m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); 376 m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false);
377#else 377#else
378 m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true); 378 m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true);
379#endif 379#endif
380 reader->bstripcr = config.readBoolEntry( "StripCr", true ); 380 reader->bstripcr = config.readBoolEntry( "StripCr", true );
381 reader->bfulljust = config.readBoolEntry( "FullJust", false ); 381 reader->bfulljust = config.readBoolEntry( "FullJust", false );
382 reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 )); 382 reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 ));
383 reader->setlead(config.readNumEntry( "ExtraLead", 0 )); 383 reader->setlead(config.readNumEntry( "ExtraLead", 0 ));
384 reader->btextfmt = config.readBoolEntry( "TextFmt", false ); 384 reader->btextfmt = config.readBoolEntry( "TextFmt", false );
385 reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); 385 reader->bautofmt = config.readBoolEntry( "AutoFmt", true );
386 reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); 386 reader->bstriphtml = config.readBoolEntry( "StripHtml", false );
387 reader->bpeanut = config.readBoolEntry( "Peanut", false ); 387 reader->bpeanut = config.readBoolEntry( "Peanut", false );
388 reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); 388 reader->bdehyphen = config.readBoolEntry( "Dehyphen", false );
389 reader->bdepluck = config.readBoolEntry( "Depluck", false ); 389 reader->bdepluck = config.readBoolEntry( "Depluck", false );
390 reader->bdejpluck = config.readBoolEntry( "Dejpluck", false ); 390 reader->bdejpluck = config.readBoolEntry( "Dejpluck", false );
391 reader->bonespace = config.readBoolEntry( "OneSpace", false ); 391 reader->bonespace = config.readBoolEntry( "OneSpace", false );
392 reader->bunindent = config.readBoolEntry( "Unindent", false ); 392 reader->bunindent = config.readBoolEntry( "Unindent", false );
393 reader->brepara = config.readBoolEntry( "Repara", false ); 393 reader->brepara = config.readBoolEntry( "Repara", false );
394 reader->bdblspce = config.readBoolEntry( "DoubleSpace", false ); 394 reader->bdblspce = config.readBoolEntry( "DoubleSpace", false );
395 reader->bindenter = config.readNumEntry( "Indent", 0 ); 395 reader->bindenter = config.readNumEntry( "Indent", 0 );
396 reader->m_textsize = config.readNumEntry( "FontSize", 12 ); 396 reader->m_textsize = config.readNumEntry( "FontSize", 12 );
397 reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); 397 reader->m_delay = config.readNumEntry( "ScrollDelay", 5184);
398 reader->m_lastfile = config.readEntry( "LastFile", QString::null ); 398 reader->m_lastfile = config.readEntry( "LastFile", QString::null );
399 reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); 399 reader->m_lastposn = config.readNumEntry( "LastPosn", 0 );
400 reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); 400 reader->m_bpagemode = config.readBoolEntry( "PageMode", true );
401 reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); 401 reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false);
402 reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false); 402 reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false);
403 reader->m_fontname = config.readEntry( "Fontname", "helvetica" ); 403 reader->m_fontname = config.readEntry( "Fontname", "helvetica" );
404 reader->m_encd = config.readNumEntry( "Encoding", 0 ); 404 reader->m_encd = config.readNumEntry( "Encoding", 0 );
405 reader->m_charpc = config.readNumEntry( "CharSpacing", 100 ); 405 reader->m_charpc = config.readNumEntry( "CharSpacing", 100 );
406 reader->m_overlap = config.readNumEntry( "Overlap", 0 ); 406 reader->m_overlap = config.readNumEntry( "Overlap", 0 );
407 reader->m_border = config.readNumEntry( "Margin", 6 ); 407 reader->m_border = config.readNumEntry( "Margin", 6 );
408#ifdef REPALM 408#ifdef REPALM
409 reader->brepalm = config.readBoolEntry( "Repalm", true ); 409 reader->brepalm = config.readBoolEntry( "Repalm", true );
410#endif 410#endif
411 reader->bremap = config.readBoolEntry( "Remap", true ); 411 reader->bremap = config.readBoolEntry( "Remap", true );
412 reader->bmakebold = config.readBoolEntry( "MakeBold", false ); 412 reader->bmakebold = config.readBoolEntry( "MakeBold", false );
413 reader->setContinuous(config.readBoolEntry( "Continuous", true )); 413 reader->setContinuous(config.readBoolEntry( "Continuous", true ));
414 m_targetapp = config.readEntry( "TargetApp", QString::null ); 414 m_targetapp = config.readEntry( "TargetApp", QString::null );
415 m_targetmsg = config.readEntry( "TargetMsg", QString::null ); 415 m_targetmsg = config.readEntry( "TargetMsg", QString::null );
416#ifdef _SCROLLPIPE 416#ifdef _SCROLLPIPE
417 reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null ); 417 reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null );
418 reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true ); 418 reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true );
419#endif 419#endif
420 m_twoTouch = config.readBoolEntry( "TwoTouch", false); 420 m_twoTouch = config.readBoolEntry( "TwoTouch", false);
421 m_doAnnotation = config.readBoolEntry( "Annotation", false); 421 m_doAnnotation = config.readBoolEntry( "Annotation", false);
422 m_doDictionary = config.readBoolEntry( "Dictionary", false); 422 m_doDictionary = config.readBoolEntry( "Dictionary", false);
423 m_doClipboard = config.readBoolEntry( "Clipboard", false); 423 m_doClipboard = config.readBoolEntry( "Clipboard", false);
424 m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); 424 m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll);
425 m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone); 425 m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone);
426 m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen); 426 m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen);
427 m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut); 427 m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut);
428 m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn); 428 m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn);
429 m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp); 429 m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp);
430 m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown); 430 m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown);
431 431
432 m_leftScroll = config.readBoolEntry("LeftScroll", false); 432 m_leftScroll = config.readBoolEntry("LeftScroll", false);
433 m_rightScroll = config.readBoolEntry("RightScroll", false); 433 m_rightScroll = config.readBoolEntry("RightScroll", false);
434 m_upScroll = config.readBoolEntry("UpScroll", true); 434 m_upScroll = config.readBoolEntry("UpScroll", true);
435 m_downScroll = config.readBoolEntry("DownScroll", true); 435 m_downScroll = config.readBoolEntry("DownScroll", true);
436 436
437 m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false); 437 m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false);
438 reader->setBaseSize(config.readNumEntry( "Basesize", 10 )); 438 reader->setBaseSize(config.readNumEntry( "Basesize", 10 ));
439 439
440#ifndef USEQPE 440#ifndef USEQPE
441 config.setGroup( "Geometry" ); 441 config.setGroup( "Geometry" );
442 setGeometry(0,0, 442 setGeometry(0,0,
443 config.readNumEntry( "width", QApplication::desktop()->width()/2 ), 443 config.readNumEntry( "width", QApplication::desktop()->width()/2 ),
444 config.readNumEntry( "height", QApplication::desktop()->height()/2 )); 444 config.readNumEntry( "height", QApplication::desktop()->height()/2 ));
445 move( 445 move(
446 config.readNumEntry( "x", 20 ), 446 config.readNumEntry( "x", 20 ),
447 config.readNumEntry( "y", 20 )); 447 config.readNumEntry( "y", 20 ));
448#endif 448#endif
449 449
450 450
451 451
452 setTwoTouch(m_twoTouch); 452 setTwoTouch(m_twoTouch);
453 453
454 connect( reader, SIGNAL( OnShowPicture(QImage&) ), this, SLOT( showgraphic(QImage&) ) ); 454 connect( reader, SIGNAL( OnShowPicture(QImage&) ), this, SLOT( showgraphic(QImage&) ) );
455 455
456 connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) ); 456 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&) ) ); 457 connect( reader, SIGNAL( OnWordSelected(const QString&, size_t, const QString&) ), this, SLOT( OnWordSelected(const QString&, size_t, const QString&) ) );
458 connect( reader, SIGNAL( OnURLSelected(const QString&) ), this, SLOT( OnURLSelected(const QString&) ) ); 458 connect( reader, SIGNAL( OnURLSelected(const QString&) ), this, SLOT( OnURLSelected(const QString&) ) );
459 editorStack->addWidget( reader, get_unique_id() ); 459 editorStack->addWidget( reader, get_unique_id() );
460 460
461 m_preferences_action = new QAction( tr( "Configuration" ), geticon( "SettingsIcon" ), QString::null, 0, this, NULL); 461 m_preferences_action = new QAction( tr( "Configuration" ), geticon( "SettingsIcon" ), QString::null, 0, this, NULL);
462 connect( m_preferences_action, SIGNAL( activated() ), this, SLOT( showprefs() ) ); 462 connect( m_preferences_action, SIGNAL( activated() ), this, SLOT( showprefs() ) );
463 m_preferences_action->addTo( settings ); 463 m_preferences_action->addTo( settings );
464 464
465 m_saveconfig_action = new QAction( tr( "Save Config" ), QString::null, 0, this, NULL); 465 m_saveconfig_action = new QAction( tr( "Save Config" ), QString::null, 0, this, NULL);
466 connect( m_saveconfig_action, SIGNAL( activated() ), this, SLOT( SaveConfig() ) ); 466 connect( m_saveconfig_action, SIGNAL( activated() ), this, SLOT( SaveConfig() ) );
467 m_saveconfig_action->addTo( settings ); 467 m_saveconfig_action->addTo( settings );
468 468
469 m_loadconfig_action = new QAction( tr( "Load Config" ), QString::null, 0, this, NULL); 469 m_loadconfig_action = new QAction( tr( "Load Config" ), QString::null, 0, this, NULL);
470 connect( m_loadconfig_action, SIGNAL( activated() ), this, SLOT( LoadConfig() ) ); 470 connect( m_loadconfig_action, SIGNAL( activated() ), this, SLOT( LoadConfig() ) );
471 m_loadconfig_action->addTo( settings ); 471 m_loadconfig_action->addTo( settings );
472 472
473 m_tidyconfig_action = new QAction( tr( "Delete Config" ), QString::null, 0, this, NULL); 473 m_tidyconfig_action = new QAction( tr( "Delete Config" ), QString::null, 0, this, NULL);
474 connect( m_tidyconfig_action, SIGNAL( activated() ), this, SLOT( TidyConfig() ) ); 474 connect( m_tidyconfig_action, SIGNAL( activated() ), this, SLOT( TidyConfig() ) );
475 m_tidyconfig_action->addTo( settings ); 475 m_tidyconfig_action->addTo( settings );
476 476
477 settings->insertSeparator(); 477 settings->insertSeparator();
478 m_toolbarprefs_action = new QAction( tr( "Toolbars" ), QString::null, 0, this, NULL); 478 m_toolbarprefs_action = new QAction( tr( "Toolbars" ), QString::null, 0, this, NULL);
479 connect( m_toolbarprefs_action, SIGNAL( activated() ), this, SLOT( showtoolbarprefs() ) ); 479 connect( m_toolbarprefs_action, SIGNAL( activated() ), this, SLOT( showtoolbarprefs() ) );
480 m_toolbarprefs_action->addTo( settings ); 480 m_toolbarprefs_action->addTo( settings );
481 481
482 m_open_action = new QAction( tr( "Open" ), geticon( "fileopen" ), QString::null, 0, this, 0 ); 482 m_open_action = new QAction( tr( "Open" ), geticon( "fileopen" ), QString::null, 0, this, 0 );
483 connect( m_open_action, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); 483 connect( m_open_action, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
484 m_open_action->addTo( file ); 484 m_open_action->addTo( file );
485 485
486 m_close_action = new QAction( tr( "Close" ), geticon( "close" ), QString::null, 0, this, 0 ); 486 m_close_action = new QAction( tr( "Close" ), geticon( "close" ), QString::null, 0, this, 0 );
487 connect( m_close_action, SIGNAL( activated() ), this, SLOT( fileClose() ) ); 487 connect( m_close_action, SIGNAL( activated() ), this, SLOT( fileClose() ) );
488 m_close_action->addTo( file ); 488 m_close_action->addTo( file );
489 489
490#ifdef _SCRIPT 490#ifdef _SCRIPT
491 a = new QAction( tr( "Run Script" ), QString::null, 0, this, NULL); 491 a = new QAction( tr( "Run Script" ), QString::null, 0, this, NULL);
492 connect( a, SIGNAL( activated() ), this, SLOT( RunScript() ) ); 492 connect( a, SIGNAL( activated() ), this, SLOT( RunScript() ) );
493 a->addTo( file ); 493 a->addTo( file );
494#endif 494#endif
495 /* 495 /*
496 a = new QAction( tr( "Revert" ), geticon( "close" ), QString::null, 0, this, 0 ); 496 a = new QAction( tr( "Revert" ), geticon( "close" ), QString::null, 0, this, 0 );
497 connect( a, SIGNAL( activated() ), this, SLOT( fileRevert() ) ); 497 connect( a, SIGNAL( activated() ), this, SLOT( fileRevert() ) );
498 a->addTo( file ); 498 a->addTo( file );
499 499
500 a = new QAction( tr( "Cut" ), geticon( "cut" ), QString::null, 0, this, 0 ); 500 a = new QAction( tr( "Cut" ), geticon( "cut" ), QString::null, 0, this, 0 );
501 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); 501 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
502 a->addTo( filebar() ); 502 a->addTo( filebar() );
503 a->addTo( edit ); 503 a->addTo( edit );
504 */ 504 */
505 505
506 m_info_action = new QAction( tr( "Info" ), geticon( "UtilsIcon" ), QString::null, 0, this, NULL); 506 m_info_action = new QAction( tr( "Info" ), geticon( "UtilsIcon" ), QString::null, 0, this, NULL);
507 connect( m_info_action, SIGNAL( activated() ), this, SLOT( showinfo() ) ); 507 connect( m_info_action, SIGNAL( activated() ), this, SLOT( showinfo() ) );
508 m_info_action->addTo( file ); 508 m_info_action->addTo( file );
509 509
510 m_touch_action = new QAction( tr( "Two/One Touch" ), geticon( "1to1" ), QString::null, 0, this, NULL, true ); 510 m_touch_action = new QAction( tr( "Two/One Touch" ), geticon( "1to1" ), QString::null, 0, this, NULL, true );
511 connect( m_touch_action, SIGNAL( toggled(bool) ), this, SLOT( setTwoTouch(bool) ) ); 511 connect( m_touch_action, SIGNAL( toggled(bool) ), this, SLOT( setTwoTouch(bool) ) );
512 m_touch_action->setOn(m_twoTouch); 512 m_touch_action->setOn(m_twoTouch);
513 m_touch_action->addTo( file ); 513 m_touch_action->addTo( file );
514 514
515 m_find_action = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, NULL); 515 m_find_action = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, NULL);
516 connect( m_find_action, SIGNAL( activated() ), this, SLOT( editFind() ) ); 516 connect( m_find_action, SIGNAL( activated() ), this, SLOT( editFind() ) );
517 file->insertSeparator(); 517 file->insertSeparator();
518// a->addTo( bar ); 518// a->addTo( bar );
519 m_find_action->addTo( file ); 519 m_find_action->addTo( file );
520 520
521 m_exportlinks_action = new QAction( tr( "Export Links" ), QString::null, 0, this, NULL); 521 m_exportlinks_action = new QAction( tr( "Export Links" ), QString::null, 0, this, NULL);
522 connect( m_exportlinks_action, SIGNAL( activated() ), this, SLOT( ExportLinks() ) ); 522 connect( m_exportlinks_action, SIGNAL( activated() ), this, SLOT( ExportLinks() ) );
523 m_exportlinks_action->addTo( file ); 523 m_exportlinks_action->addTo( file );
524 524
525 m_scrollButton = new QAction( tr( "Scroll" ), getmyicon( "panel-arrow-down" ), QString::null, 0, this, 0, true ); 525 m_scrollButton = new QAction( tr( "Scroll" ), getmyicon( "panel-arrow-down" ), QString::null, 0, this, 0, true );
526 connect( m_scrollButton, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) ); 526 connect( m_scrollButton, SIGNAL( toggled(bool) ), this, SLOT( autoScroll(bool) ) );
527 m_scrollButton->addTo(navigation); 527 m_scrollButton->addTo(navigation);
528 m_scrollButton->setOn(false); 528 m_scrollButton->setOn(false);
529 529
530 m_start_action = new QAction( tr( "Goto Start" ), geticon( "start" ), QString::null, 0, this, NULL); 530 m_start_action = new QAction( tr( "Goto Start" ), geticon( "start" ), QString::null, 0, this, NULL);
531 connect( m_start_action, SIGNAL( activated() ), this, SLOT( gotoStart() ) ); 531 connect( m_start_action, SIGNAL( activated() ), this, SLOT( gotoStart() ) );
532 m_start_action->addTo(navigation); 532 m_start_action->addTo(navigation);
533 533
534 m_end_action = new QAction( tr( "Goto End" ), geticon( "finish" ), QString::null, 0, this, NULL); 534 m_end_action = new QAction( tr( "Goto End" ), geticon( "finish" ), QString::null, 0, this, NULL);
535 connect( m_end_action, SIGNAL( activated() ), this, SLOT( gotoEnd() ) ); 535 connect( m_end_action, SIGNAL( activated() ), this, SLOT( gotoEnd() ) );
536 m_end_action->addTo(navigation); 536 m_end_action->addTo(navigation);
537 537
538 m_jump_action = new QAction( tr( "Jump" ), geticon( "rotate" ), QString::null, 0, this, NULL); 538 m_jump_action = new QAction( tr( "Jump" ), geticon( "rotate" ), QString::null, 0, this, NULL);
539 connect( m_jump_action, SIGNAL( activated() ), this, SLOT( jump() ) ); 539 connect( m_jump_action, SIGNAL( activated() ), this, SLOT( jump() ) );
540 m_jump_action->addTo(navigation); 540 m_jump_action->addTo(navigation);
541 541
542 m_pageline_action = new QAction( tr( "Page/Line Scroll" ), geticon( "pass" ), QString::null, 0, this, NULL, true ); 542 m_pageline_action = new QAction( tr( "Page/Line Scroll" ), geticon( "pass" ), QString::null, 0, this, NULL, true );
543 connect( m_pageline_action, SIGNAL( toggled(bool) ), this, SLOT( pagemode(bool) ) ); 543 connect( m_pageline_action, SIGNAL( toggled(bool) ), this, SLOT( pagemode(bool) ) );
544 m_pageline_action->addTo(navigation); 544 m_pageline_action->addTo(navigation);
545 m_pageline_action->setOn(reader->m_bpagemode); 545 m_pageline_action->setOn(reader->m_bpagemode);
546 546
547 m_pageup_action = new QAction( tr( "Up" ), geticon( "up" ), QString::null, 0, this, 0 ); 547 m_pageup_action = new QAction( tr( "Up" ), geticon( "up" ), QString::null, 0, this, 0 );
548 connect( m_pageup_action, SIGNAL( activated() ), this, SLOT( pageup() ) ); 548 connect( m_pageup_action, SIGNAL( activated() ), this, SLOT( pageup() ) );
549 m_pageup_action->addTo( navigation ); 549 m_pageup_action->addTo( navigation );
550 550
551 m_pagedn_action = new QAction( tr( "Down" ), geticon( "down" ), QString::null, 0, this, 0 ); 551 m_pagedn_action = new QAction( tr( "Down" ), geticon( "down" ), QString::null, 0, this, 0 );
552 connect( m_pagedn_action, SIGNAL( activated() ), this, SLOT( pagedn() ) ); 552 connect( m_pagedn_action, SIGNAL( activated() ), this, SLOT( pagedn() ) );
553 m_pagedn_action->addTo( navigation ); 553 m_pagedn_action->addTo( navigation );
554 554
555 m_back_action = new QAction( tr( "Back" ), geticon( "back" ), QString::null, 0, this, 0 ); 555 m_back_action = new QAction( tr( "Back" ), geticon( "back" ), QString::null, 0, this, 0 );
556 connect( m_back_action, SIGNAL( activated() ), reader, SLOT( goBack() ) ); 556 connect( m_back_action, SIGNAL( activated() ), reader, SLOT( goBack() ) );
557 m_back_action->addTo( navigation ); 557 m_back_action->addTo( navigation );
558 558
559 m_home_action = new QAction( tr( "Home" ), geticon( "home" ), QString::null, 0, this, 0 ); 559 m_home_action = new QAction( tr( "Home" ), geticon( "home" ), QString::null, 0, this, 0 );
560 connect( m_home_action, SIGNAL( activated() ), reader, SLOT( goHome() ) ); 560 connect( m_home_action, SIGNAL( activated() ), reader, SLOT( goHome() ) );
561 m_home_action->addTo( navigation ); 561 m_home_action->addTo( navigation );
562 562
563 m_forward_action = new QAction( tr( "Forward" ), geticon( "forward" ), QString::null, 0, this, 0 ); 563 m_forward_action = new QAction( tr( "Forward" ), geticon( "forward" ), QString::null, 0, this, 0 );
564 connect( m_forward_action, SIGNAL( activated() ), reader, SLOT( goForward() ) ); 564 connect( m_forward_action, SIGNAL( activated() ), reader, SLOT( goForward() ) );
565 m_forward_action->addTo( navigation ); 565 m_forward_action->addTo( navigation );
566 566
567 /* 567 /*
568 a = new QAction( tr( "Find" ), QString::null, 0, this, NULL, true ); 568 a = new QAction( tr( "Find" ), QString::null, 0, this, NULL, true );
569 // connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) ); 569 // connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) );
570 a->addTo( file ); 570 a->addTo( file );
571 571
572 a = new QAction( tr( "Find Again" ), QString::null, 0, this, NULL, true ); 572 a = new QAction( tr( "Find Again" ), QString::null, 0, this, NULL, true );
573 // connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) ); 573 // connect( a, SIGNAL( activated() ), this, SLOT( pagedn() ) );
574 a->addTo( file ); 574 a->addTo( file );
575 */ 575 */
576 576
577// file->insertSeparator(); 577// file->insertSeparator();
578 578
579#ifdef _SCROLLPIPE 579#ifdef _SCROLLPIPE
580 580
581 QActionGroup* ag = new QActionGroup(this); 581 QActionGroup* ag = new QActionGroup(this);
582 ag->setExclusive(false); 582 ag->setExclusive(false);
583 spacemenu = new QPopupMenu(this); 583 spacemenu = new QPopupMenu(this);
584 file->insertItem( tr( "Scrolling" ), spacemenu ); 584 file->insertItem( tr( "Scrolling" ), spacemenu );
585 585
586 a = new QAction( tr( "Set Target" ), QString::null, 0, ag, NULL); 586 a = new QAction( tr( "Set Target" ), QString::null, 0, ag, NULL);
587 connect( a, SIGNAL( activated() ), this, SLOT( setpipetarget() ) ); 587 connect( a, SIGNAL( activated() ), this, SLOT( setpipetarget() ) );
588 588
589 a = new QAction( tr( "Pause Paras" ), QString::null, 0, ag, NULL, true ); 589 a = new QAction( tr( "Pause Paras" ), QString::null, 0, ag, NULL, true );
590 connect( a, SIGNAL( toggled(bool) ), this, SLOT( setpause(bool) ) ); 590 connect( a, SIGNAL( toggled(bool) ), this, SLOT( setpause(bool) ) );
591 a->setOn(reader->m_pauseAfterEachPara); 591 a->setOn(reader->m_pauseAfterEachPara);
592 592
593 ag->addTo(spacemenu); 593 ag->addTo(spacemenu);
594// file->insertSeparator(); 594// file->insertSeparator();
595 595
596#endif 596#endif
597 597
598/* 598/*
599 a = new QAction( tr( "Import" ), QString::null, 0, this, NULL ); 599 a = new QAction( tr( "Import" ), QString::null, 0, this, NULL );
600 connect( a, SIGNAL( activated() ), this, SLOT( importFiles() ) ); 600 connect( a, SIGNAL( activated() ), this, SLOT( importFiles() ) );
601 a->addTo( file ); 601 a->addTo( file );
602*/ 602*/
603 603
604 /* 604 /*
605 a = new QAction( tr( "Paste" ), geticon( "paste" ), QString::null, 0, this, 0 ); 605 a = new QAction( tr( "Paste" ), geticon( "paste" ), QString::null, 0, this, 0 );
606 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); 606 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
607 a->addTo( fileBar ); 607 a->addTo( fileBar );
608 a->addTo( edit ); 608 a->addTo( edit );
609 */ 609 */
610 610
611// a = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, 0 ); 611// a = new QAction( tr( "Find..." ), geticon( "find" ), QString::null, 0, this, 0 );
612 612
613 m_fullscreen = false; 613 m_fullscreen = false;
614 m_actFullscreen = new QAction( tr( "Fullscreen" ), geticon( "fullscreen" ), QString::null, 0, this, NULL, true ); 614 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) ) ); 615 connect( m_actFullscreen, SIGNAL( toggled(bool) ), this, SLOT( setfullscreen(bool) ) );
616 m_actFullscreen->setOn(m_fullscreen); 616 m_actFullscreen->setOn(m_fullscreen);
617 m_actFullscreen->addTo( view ); 617 m_actFullscreen->addTo( view );
618 618
619 view->insertSeparator(); 619 view->insertSeparator();
620 620
621 m_zoomin_action = new QAction( tr( "Zoom In" ), geticon( "zoom" ), QString::null, 0, this); 621 m_zoomin_action = new QAction( tr( "Zoom In" ), geticon( "zoom" ), QString::null, 0, this);
622 connect( m_zoomin_action, SIGNAL( activated() ), this, SLOT( zoomin() ) ); 622 connect( m_zoomin_action, SIGNAL( activated() ), this, SLOT( zoomin() ) );
623 m_zoomin_action->addTo( view ); 623 m_zoomin_action->addTo( view );
624 624
625 m_zoomout_action = new QAction( tr( "Zoom Out" ), geticon( "mag" ), QString::null, 0, this); 625 m_zoomout_action = new QAction( tr( "Zoom Out" ), geticon( "mag" ), QString::null, 0, this);
626 connect( m_zoomout_action, SIGNAL( activated() ), this, SLOT( zoomout() ) ); 626 connect( m_zoomout_action, SIGNAL( activated() ), this, SLOT( zoomout() ) );
627 m_zoomout_action->addTo( view ); 627 m_zoomout_action->addTo( view );
628 628
629 view->insertSeparator(); 629 view->insertSeparator();
630 m_setfont_action = new QAction( tr( "Set Font" ), getmyicon( "font" ), QString::null, 0, this); 630 m_setfont_action = new QAction( tr( "Set Font" ), getmyicon( "font" ), QString::null, 0, this);
631 connect( m_setfont_action, SIGNAL( activated() ), this, SLOT( setfont() ) ); 631 connect( m_setfont_action, SIGNAL( activated() ), this, SLOT( setfont() ) );
632 m_setfont_action->addTo( view ); 632 m_setfont_action->addTo( view );
633 633
634 view->insertSeparator(); 634 view->insertSeparator();
635 m_setenc_action = new QAction( tr( "Set Encoding" ), getmyicon( "charset" ), QString::null, 0, this); 635 m_setenc_action = new QAction( tr( "Set Encoding" ), getmyicon( "charset" ), QString::null, 0, this);
636 connect( m_setenc_action, SIGNAL( activated() ), this, SLOT( chooseencoding() ) ); 636 connect( m_setenc_action, SIGNAL( activated() ), this, SLOT( chooseencoding() ) );
637 m_setenc_action->addTo( view ); 637 m_setenc_action->addTo( view );
638 638
639 m_setmono_action = new QAction( tr( "Ideogram" ), getmyicon( "ideogram" ), QString::null, 0, this, NULL, true); 639 m_setmono_action = new QAction( tr( "Ideogram" ), getmyicon( "ideogram" ), QString::null, 0, this, NULL, true);
640 connect( m_setmono_action, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) ); 640 connect( m_setmono_action, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) );
641 m_setmono_action->addTo( view ); 641 m_setmono_action->addTo( view );
642 m_setmono_action->setOn(reader->m_bMonoSpaced); 642 m_setmono_action->setOn(reader->m_bMonoSpaced);
643 643
644 644
645 // a = new QAction( tr( "Zoom" ), QString::null, 0, this, NULL, true ); 645 // a = new QAction( tr( "Zoom" ), QString::null, 0, this, NULL, true );
646 // a = new QAction( tr( "Zoom" ), geticon( "mag" ), QString::null, 0, this, 0 ); 646 // a = new QAction( tr( "Zoom" ), geticon( "mag" ), QString::null, 0, this, 0 );
647 647
648 648
649 649
650 // a->addTo( filebar() ); 650 // a->addTo( filebar() );
651// view->insertSeparator(); 651// view->insertSeparator();
652 652
653/* 653/*
654 a = new QAction( tr( "Ideogram/Word" ), QString::null, 0, this, NULL, true ); 654 a = new QAction( tr( "Ideogram/Word" ), QString::null, 0, this, NULL, true );
655 connect( a, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) ); 655 connect( a, SIGNAL( toggled(bool) ), this, SLOT( monospace(bool) ) );
656 a->setOn(reader->m_bMonoSpaced); 656 a->setOn(reader->m_bMonoSpaced);
657 a->addTo( view ); 657 a->addTo( view );
658*/ 658*/
659/* 659/*
660 a = new QAction( tr( "Set Width" ), QString::null, 0, this, NULL); 660 a = new QAction( tr( "Set Width" ), QString::null, 0, this, NULL);
661 connect( a, SIGNAL( activated() ), this, SLOT( setspacing() ) ); 661 connect( a, SIGNAL( activated() ), this, SLOT( setspacing() ) );
662 a->addTo( view ); 662 a->addTo( view );
663*/ 663*/
664 664
665 m_mark_action = new QAction( tr( "Bookmark" ), getmyicon( "bookmark" ), QString::null, 0, this, NULL); 665 m_mark_action = new QAction( tr( "Bookmark" ), getmyicon( "bookmark" ), QString::null, 0, this, NULL);
666 connect( m_mark_action, SIGNAL( activated() ), this, SLOT( addbkmk() ) ); 666 connect( m_mark_action, SIGNAL( activated() ), this, SLOT( addbkmk() ) );
667 m_mark_action->addTo( marks ); 667 m_mark_action->addTo( marks );
668 668
669 m_annotate_action = new QAction( tr( "Annotate" ), getmyicon( "annotate" ), QString::null, 0, this, NULL); 669 m_annotate_action = new QAction( tr( "Annotate" ), getmyicon( "annotate" ), QString::null, 0, this, NULL);
670 connect( m_annotate_action, SIGNAL( activated() ), this, SLOT( addanno() ) ); 670 connect( m_annotate_action, SIGNAL( activated() ), this, SLOT( addanno() ) );
671 m_annotate_action->addTo( marks ); 671 m_annotate_action->addTo( marks );
672 672
673 m_goto_action = new QAction( tr( "Goto" ), getmyicon( "bookmark_goto" ), QString::null, 0, this, NULL, false ); 673 m_goto_action = new QAction( tr( "Goto" ), getmyicon( "bookmark_goto" ), QString::null, 0, this, NULL, false );
674 connect( m_goto_action, SIGNAL( activated() ), this, SLOT( do_gotomark() ) ); 674 connect( m_goto_action, SIGNAL( activated() ), this, SLOT( do_gotomark() ) );
675 m_goto_action->addTo( marks ); 675 m_goto_action->addTo( marks );
676 676
677 m_delete_action = new QAction( tr( "Delete" ), getmyicon( "bookmark_delete" ), QString::null, 0, this, NULL); 677 m_delete_action = new QAction( tr( "Delete" ), getmyicon( "bookmark_delete" ), QString::null, 0, this, NULL);
678 connect( m_delete_action, SIGNAL( activated() ), this, SLOT( do_delmark() ) ); 678 connect( m_delete_action, SIGNAL( activated() ), this, SLOT( do_delmark() ) );
679 m_delete_action->addTo( marks ); 679 m_delete_action->addTo( marks );
680 680
681 m_autogen_action = new QAction( tr( "Autogen" ), geticon( "exec" ), QString::null, 0, this, NULL, false ); 681 m_autogen_action = new QAction( tr( "Autogen" ), geticon( "exec" ), QString::null, 0, this, NULL, false );
682 connect( m_autogen_action, SIGNAL( activated() ), this, SLOT( do_autogen() ) ); 682 connect( m_autogen_action, SIGNAL( activated() ), this, SLOT( do_autogen() ) );
683 marks->insertSeparator(); 683 marks->insertSeparator();
684 m_autogen_action->addTo( marks ); 684 m_autogen_action->addTo( marks );
685 685
686 m_clear_action = new QAction( tr( "Clear" ), getmyicon( "bookmark_clear" ), QString::null, 0, this, NULL); 686 m_clear_action = new QAction( tr( "Clear" ), getmyicon( "bookmark_clear" ), QString::null, 0, this, NULL);
687 connect( m_clear_action, SIGNAL( activated() ), this, SLOT( clearBkmkList() ) ); 687 connect( m_clear_action, SIGNAL( activated() ), this, SLOT( clearBkmkList() ) );
688 m_clear_action->addTo( marks ); 688 m_clear_action->addTo( marks );
689 689
690 m_save_action = new QAction( tr( "Save" ), getmyicon( "bookmark_save" ), QString::null, 0, this, NULL ); 690 m_save_action = new QAction( tr( "Save" ), getmyicon( "bookmark_save" ), QString::null, 0, this, NULL );
691 connect( m_save_action, SIGNAL( activated() ), this, SLOT( savebkmks() ) ); 691 connect( m_save_action, SIGNAL( activated() ), this, SLOT( savebkmks() ) );
692 m_save_action->addTo( marks ); 692 m_save_action->addTo( marks );
693 693
694 m_tidy_action = new QAction( tr( "Tidy" ), getmyicon( "bookmark_tidy" ), QString::null, 0, this, NULL); 694 m_tidy_action = new QAction( tr( "Tidy" ), getmyicon( "bookmark_tidy" ), QString::null, 0, this, NULL);
695 connect( m_tidy_action, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) ); 695 connect( m_tidy_action, SIGNAL( activated() ), this, SLOT( listBkmkFiles() ) );
696 marks->insertSeparator(); 696 marks->insertSeparator();
697 m_tidy_action->addTo( marks ); 697 m_tidy_action->addTo( marks );
698 698
699 m_startBlock_action = new QAction( tr( "Start Block" ), geticon( "new" ), QString::null, 0, this, NULL); 699 m_startBlock_action = new QAction( tr( "Start Block" ), geticon( "new" ), QString::null, 0, this, NULL);
700 connect( m_startBlock_action, SIGNAL( activated() ), this, SLOT( editMark() ) ); 700 connect( m_startBlock_action, SIGNAL( activated() ), this, SLOT( editMark() ) );
701 marks->insertSeparator(); 701 marks->insertSeparator();
702 m_startBlock_action->addTo( marks ); 702 m_startBlock_action->addTo( marks );
703 703
704 m_endBlock_action = new QAction( tr( "Copy Block" ), geticon( "copy" ), QString::null, 0, this, NULL); 704 m_endBlock_action = new QAction( tr( "Copy Block" ), geticon( "copy" ), QString::null, 0, this, NULL);
705 connect( m_endBlock_action, SIGNAL( activated() ), this, SLOT( editCopy() ) ); 705 connect( m_endBlock_action, SIGNAL( activated() ), this, SLOT( editCopy() ) );
706 m_endBlock_action->addTo( marks ); 706 m_endBlock_action->addTo( marks );
707 707
708 m_bkmkAvail = NULL; 708 m_bkmkAvail = NULL;
709 709
710 710
711 setToolBarsMovable(m_tbmove); 711 setToolBarsMovable(m_tbmove);
712 addtoolbars(&config); 712 addtoolbars(&config);
713 713
714 pbar = new QProgressBar(this); 714 pbar = new QProgressBar(this);
715 pbar->hide(); 715 pbar->hide();
716 716
717 searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE ); 717 searchBar = new QFloatBar( "Search", this, QMainWindow::Top, TRUE );
718 718
719 searchBar->setHorizontalStretchable( TRUE ); 719 searchBar->setHorizontalStretchable( TRUE );
720 720
721 connect(searchBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); 721 connect(searchBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() ));
722 722
723 searchEdit = new QLineEdit( searchBar, "searchEdit" ); 723 searchEdit = new QLineEdit( searchBar, "searchEdit" );
724// QFont f("unifont", 16 /*, QFont::Bold*/); 724// QFont f("unifont", 16 /*, QFont::Bold*/);
725// searchEdit->setFont( f ); 725// searchEdit->setFont( f );
726 searchBar->setStretchableWidget( searchEdit ); 726 searchBar->setStretchableWidget( searchEdit );
727 727
728 728
729#ifdef __ISEARCH 729#ifdef __ISEARCH
730 connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 730 connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
731 this, SLOT( search( const QString& ) ) ); 731 this, SLOT( search( const QString& ) ) );
732#else 732#else
733 connect( searchEdit, SIGNAL( returnPressed( ) ), 733 connect( searchEdit, SIGNAL( returnPressed( ) ),
734 this, SLOT( search( ) ) ); 734 this, SLOT( search( ) ) );
735#endif 735#endif
736 QAction*a = new QAction( tr( "Find Next" ), geticon( "next" ), QString::null, 0, this, 0 ); 736 QAction*a = new QAction( tr( "Find Next" ), geticon( "next" ), QString::null, 0, this, 0 );
737 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); 737 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) );
738 a->addTo( searchBar ); 738 a->addTo( searchBar );
739 739
740 a = new QAction( tr( "Close Find" ), geticon( "close" ), QString::null, 0, this, 0 ); 740 a = new QAction( tr( "Close Find" ), geticon( "close" ), QString::null, 0, this, 0 );
741 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 741 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
742 a->addTo( searchBar ); 742 a->addTo( searchBar );
743 743
744 searchBar->hide(); 744 searchBar->hide();
745 745
746 regBar = new QFloatBar( "Autogen", this, QMainWindow::Top, TRUE ); 746 regBar = new QFloatBar( "Autogen", this, QMainWindow::Top, TRUE );
747 connect(regBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() )); 747 connect(regBar, SIGNAL( OnHide() ), this, SLOT( restoreFocus() ));
748 748
749 regBar->setHorizontalStretchable( TRUE ); 749 regBar->setHorizontalStretchable( TRUE );
750 750
751 regEdit = new QLineEdit( regBar, "regEdit" ); 751 regEdit = new QLineEdit( regBar, "regEdit" );
752// regEdit->setFont( f ); 752// regEdit->setFont( f );
753 753
754 regBar->setStretchableWidget( regEdit ); 754 regBar->setStretchableWidget( regEdit );
755 755
756 connect( regEdit, SIGNAL( returnPressed( ) ), 756 connect( regEdit, SIGNAL( returnPressed( ) ),
757 this, SLOT( do_regaction() ) ); 757 this, SLOT( do_regaction() ) );
758 758
759 a = new QAction( tr( "Do Reg" ), geticon( "enter" ), QString::null, 0, this, 0 ); 759 a = new QAction( tr( "Do Reg" ), geticon( "enter" ), QString::null, 0, this, 0 );
760 connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) ); 760 connect( a, SIGNAL( activated() ), this, SLOT( do_regaction() ) );
761 a->addTo( regBar ); 761 a->addTo( regBar );
762 762
763 a = new QAction( tr( "Close Edit" ), geticon( "close" ), QString::null, 0, this, 0 ); 763 a = new QAction( tr( "Close Edit" ), geticon( "close" ), QString::null, 0, this, 0 );
764 connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) ); 764 connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) );
765 a->addTo( regBar ); 765 a->addTo( regBar );
766 766
767 regBar->hide(); 767 regBar->hide();
768 768
769 m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE ); 769 m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE );
770 770
771 m_fontBar->setHorizontalStretchable( TRUE ); 771 m_fontBar->setHorizontalStretchable( TRUE );
772 772
773// qDebug("Font selector"); 773// qDebug("Font selector");
774 m_fontSelector = new QComboBox(false, m_fontBar); 774 m_fontSelector = new QComboBox(false, m_fontBar);
775 m_fontBar->setStretchableWidget( m_fontSelector ); 775 m_fontBar->setStretchableWidget( m_fontSelector );
776 { 776 {
777#ifndef USEQPE 777#ifndef USEQPE
778 QFontDatabase f; 778 QFontDatabase f;
779#else 779#else
780 FontDatabase f; 780 FontDatabase f;
781#endif 781#endif
782 QStringList flist = f.families(); 782 QStringList flist = f.families();
783 bool realfont = false; 783 bool realfont = false;
784 for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) 784 for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++)
785 { 785 {
786 if (reader->m_fontname == *nm) 786 if (reader->m_fontname == *nm)
787 { 787 {
788 realfont = true; 788 realfont = true;
789 } 789 }
790 if ((*nm).contains(FIXEDFONT,false)) reader->m_fontControl.hasCourier(true, *nm); 790 if ((*nm).contains(FIXEDFONT,false)) reader->m_fontControl.hasCourier(true, *nm);
791 } 791 }
792 if (!realfont) reader->m_fontname = flist[0]; 792 if (!realfont) reader->m_fontname = flist[0];
793 } // delete the FontDatabase!!! 793 } // delete the FontDatabase!!!
794 connect( m_fontSelector, SIGNAL( activated(const QString& ) ), 794 connect( m_fontSelector, SIGNAL( activated(const QString& ) ),
795 this, SLOT( do_setfont(const QString&) ) ); 795 this, SLOT( do_setfont(const QString&) ) );
796 connect( m_fontSelector, SIGNAL( activated(int ) ), 796 connect( m_fontSelector, SIGNAL( activated(int ) ),
797 this, SLOT( do_setencoding(int) ) ); 797 this, SLOT( do_setencoding(int) ) );
798 798
799 m_fontBar->hide(); 799 m_fontBar->hide();
800 m_fontVisible = false; 800 m_fontVisible = false;
801#ifdef USEMSGS 801#ifdef USEMSGS
802 connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ), 802 connect(qApp, SIGNAL( appMessage(const QCString&, const QByteArray& ) ),
803 this, SLOT( msgHandler(const QCString&, const QByteArray&) ) ); 803 this, SLOT( msgHandler(const QCString&, const QByteArray&) ) );
804#endif 804#endif
805// qDebug("Initing"); 805// qDebug("Initing");
806 reader->init(); 806 reader->init();
807// qDebug("Inited"); 807// qDebug("Inited");
808// m_buttonAction[m_spaceTarget]->setOn(true); 808// m_buttonAction[m_spaceTarget]->setOn(true);
809// qDebug("fonting"); 809// qDebug("fonting");
810 do_setfont(reader->m_fontname); 810 do_setfont(reader->m_fontname);
811 if (!reader->m_lastfile.isEmpty()) 811 if (!reader->m_lastfile.isEmpty())
812 { 812 {
813 //qDebug("doclnk"); 813 //qDebug("doclnk");
814 //doc = new DocLnk(reader->m_lastfile); 814 //doc = new DocLnk(reader->m_lastfile);
815 //qDebug("doclnk done"); 815 //qDebug("doclnk done");
816 if (pOpenlist != NULL) 816 if (pOpenlist != NULL)
817 { 817 {
818 818
819/* 819/*
820 int ind = 0; 820 int ind = 0;
821 Bkmk* p = (*pOpenlist)[ind]; 821 Bkmk* p = (*pOpenlist)[ind];
822 while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) 822 while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile)
823 { 823 {
824 p = (*pOpenlist)[++ind]; 824 p = (*pOpenlist)[++ind];
825 } 825 }
826*/ 826*/
827 Bkmk* p = NULL; 827 Bkmk* p = NULL;
828 for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) 828 for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++)
829 { 829 {
830 p = iter.pContent(); 830 p = iter.pContent();
831 if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) 831 if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile)
832 { 832 {
833 break; 833 break;
834 } 834 }
835 // qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name())); 835 // qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name()));
836 p = NULL; 836 p = NULL;
837 } 837 }
838 if (p != NULL) 838 if (p != NULL)
839 { 839 {
840 //qDebug("openfrombkmk"); 840 //qDebug("openfrombkmk");
841 if (!openfrombkmk(p)) 841 if (!openfrombkmk(p))
842 showEditTools(); 842 showEditTools();
843 } 843 }
844 else 844 else
845 { 845 {
846 //qDebug("openfile"); 846 //qDebug("openfile");
847 openFile( reader->m_lastfile ); 847 openFile( reader->m_lastfile );
848 } 848 }
849 } 849 }
850 else 850 else
851 { 851 {
852 // qDebug("Openfile 2"); 852 // qDebug("Openfile 2");
853 if (!reader->m_lastfile.isEmpty()) 853 if (!reader->m_lastfile.isEmpty())
854 openFile( reader->m_lastfile ); 854 openFile( reader->m_lastfile );
855 } 855 }
856 } 856 }
857 else 857 else
858 { 858 {
859 showEditTools(); 859 showEditTools();
860 } 860 }
861// qApp->processEvents(); 861// qApp->processEvents();
862 reader->bDoUpdates = true; 862 reader->bDoUpdates = true;
863 reader->update(); 863 reader->update();
864 config.setGroup("Version"); 864 config.setGroup("Version");
865 int major = config.readNumEntry("Major", 0); 865 int major = config.readNumEntry("Major", 0);
866 int bkmktype = config.readNumEntry("BkmkType", 0); 866 int bkmktype = config.readNumEntry("BkmkType", 0);
867 char minor = config.readNumEntry("Minor", 0); 867 char minor = config.readNumEntry("Minor", 0);
868 if (CheckVersion(major, bkmktype, minor)) 868 if (CheckVersion(major, bkmktype, minor))
869 { 869 {
870 config.writeEntry("Major", major); 870 config.writeEntry("Major", major);
871 config.writeEntry("BkmkType", bkmktype); 871 config.writeEntry("BkmkType", bkmktype);
872 config.writeEntry("Minor", (int)minor); 872 config.writeEntry("Minor", (int)minor);
873 } 873 }
874// qDebug("finished update"); 874// qDebug("finished update");
875} 875}
876 876
877void QTReaderApp::addtoolbars(Config* config) 877void QTReaderApp::addtoolbars(Config* config)
878{ 878{
879 config->setGroup("Toolbar"); 879 config->setGroup("Toolbar");
880 880
881 if (fileBar != NULL) 881 if (fileBar != NULL)
882 { 882 {
883 if (fileBar != menubar) 883 if (fileBar != menubar)
884 { 884 {
885 fileBar->clear(); 885 fileBar->clear();
886 } 886 }
887 else 887 else
888 { 888 {
889 m_preferences_action->removeFrom( filebar() ); 889 m_preferences_action->removeFrom( filebar() );
890 m_open_action->removeFrom( filebar() ); 890 m_open_action->removeFrom( filebar() );
891 m_close_action->removeFrom( filebar() ); 891 m_close_action->removeFrom( filebar() );
892 m_info_action->removeFrom( filebar() ); 892 m_info_action->removeFrom( filebar() );
893 m_touch_action->removeFrom( filebar() ); 893 m_touch_action->removeFrom( filebar() );
894 m_find_action->removeFrom( filebar() ); 894 m_find_action->removeFrom( filebar() );
895 } 895 }
896 } 896 }
897 897
898 m_preferences_action->addTo( filebar() ); 898 m_preferences_action->addTo( filebar() );
899 addfilebar(config, "Open", m_open_action); 899 addfilebar(config, "Open", m_open_action);
900 addfilebar(config, "Close", m_close_action); 900 addfilebar(config, "Close", m_close_action);
901 addfilebar(config, "Info", m_info_action); 901 addfilebar(config, "Info", m_info_action);
902 addfilebar(config, "Two/One Touch", m_touch_action); 902 addfilebar(config, "Two/One Touch", m_touch_action);
903 addfilebar(config, "Find", m_find_action); 903 addfilebar(config, "Find", m_find_action);
904 904
905 if (navBar != NULL) 905 if (navBar != NULL)
906 { 906 {
907 if ((navBar == fileBar) && (fileBar == menubar)) 907 if ((navBar == fileBar) && (fileBar == menubar))
908 { 908 {
909 m_scrollButton->removeFrom( navbar() ); 909 m_scrollButton->removeFrom( navbar() );
910 m_start_action->removeFrom( navbar() ); 910 m_start_action->removeFrom( navbar() );
911 m_end_action->removeFrom( navbar() ); 911 m_end_action->removeFrom( navbar() );
912 m_jump_action->removeFrom( navbar() ); 912 m_jump_action->removeFrom( navbar() );
913 m_pageline_action->removeFrom( navbar() ); 913 m_pageline_action->removeFrom( navbar() );
914 m_pageup_action->removeFrom( navbar() ); 914 m_pageup_action->removeFrom( navbar() );
915 m_pagedn_action->removeFrom( navbar() ); 915 m_pagedn_action->removeFrom( navbar() );
916 m_back_action->removeFrom( navbar() ); 916 m_back_action->removeFrom( navbar() );
917 m_home_action->removeFrom( navbar() ); 917 m_home_action->removeFrom( navbar() );
918 m_forward_action->removeFrom( navbar() ); 918 m_forward_action->removeFrom( navbar() );
919 } 919 }
920 else if (navBar != fileBar) 920 else if (navBar != fileBar)
921 { 921 {
922 navBar->clear(); 922 navBar->clear();
923 } 923 }
924 } 924 }
925 925
926 addnavbar(config, "Scroll", m_scrollButton); 926 addnavbar(config, "Scroll", m_scrollButton);
927 addnavbar(config, "Goto Start", m_start_action); 927 addnavbar(config, "Goto Start", m_start_action);
928 addnavbar(config, "Goto End", m_end_action); 928 addnavbar(config, "Goto End", m_end_action);
929 929
930 addnavbar(config, "Jump", m_jump_action); 930 addnavbar(config, "Jump", m_jump_action);
931 addnavbar(config, "Page/Line Scroll", m_pageline_action); 931 addnavbar(config, "Page/Line Scroll", m_pageline_action);
932 932
933 addnavbar(config, "Page Up", m_pageup_action); 933 addnavbar(config, "Page Up", m_pageup_action);
934 addnavbar(config, "Page Down", m_pagedn_action); 934 addnavbar(config, "Page Down", m_pagedn_action);
935 935
936 addnavbar(config, "Back", m_back_action); 936 addnavbar(config, "Back", m_back_action);
937 addnavbar(config, "Home", m_home_action); 937 addnavbar(config, "Home", m_home_action);
938 addnavbar(config, "Forward", m_forward_action); 938 addnavbar(config, "Forward", m_forward_action);
939 939
940 if (viewBar != NULL) 940 if (viewBar != NULL)
941 { 941 {
942 if ((viewBar == fileBar) && (fileBar == menubar)) 942 if ((viewBar == fileBar) && (fileBar == menubar))
943 { 943 {
944 m_actFullscreen->removeFrom( filebar() ); 944 m_actFullscreen->removeFrom( filebar() );
945 m_zoomin_action->removeFrom( viewbar() ); 945 m_zoomin_action->removeFrom( viewbar() );
946 m_zoomout_action->removeFrom( viewbar() ); 946 m_zoomout_action->removeFrom( viewbar() );
947 m_setfont_action->removeFrom( viewbar() ); 947 m_setfont_action->removeFrom( viewbar() );
948 m_setenc_action->removeFrom( viewbar() ); 948 m_setenc_action->removeFrom( viewbar() );
949 m_setmono_action->removeFrom( viewbar() ); 949 m_setmono_action->removeFrom( viewbar() );
950 } 950 }
951 else if (viewBar != fileBar) 951 else if (viewBar != fileBar)
952 { 952 {
953 viewBar->clear(); 953 viewBar->clear();
954 } 954 }
955 } 955 }
956 956
957 addviewbar(config, "Fullscreen", m_actFullscreen); 957 addviewbar(config, "Fullscreen", m_actFullscreen);
958 addviewbar(config, "Zoom In", m_zoomin_action); 958 addviewbar(config, "Zoom In", m_zoomin_action);
959 addviewbar(config, "Zoom Out", m_zoomout_action); 959 addviewbar(config, "Zoom Out", m_zoomout_action);
960 addviewbar(config, "Set Font", m_setfont_action); 960 addviewbar(config, "Set Font", m_setfont_action);
961 addviewbar(config, "Encoding Select", m_setenc_action); 961 addviewbar(config, "Encoding Select", m_setenc_action);
962 addviewbar(config, "Ideogram Mode", m_setmono_action); 962 addviewbar(config, "Ideogram Mode", m_setmono_action);
963 963
964 if (markBar != NULL) 964 if (markBar != NULL)
965 { 965 {
966 if ((markBar == fileBar) && (fileBar == menubar)) 966 if ((markBar == fileBar) && (fileBar == menubar))
967 { 967 {
968 m_mark_action->removeFrom( markbar() ); 968 m_mark_action->removeFrom( markbar() );
969 m_annotate_action->removeFrom( markbar()); 969 m_annotate_action->removeFrom( markbar());
970 m_goto_action->removeFrom( markbar() ); 970 m_goto_action->removeFrom( markbar() );
971 m_delete_action->removeFrom( markbar() ); 971 m_delete_action->removeFrom( markbar() );
972 m_autogen_action->removeFrom( markbar() ); 972 m_autogen_action->removeFrom( markbar() );
973 m_clear_action->removeFrom( markbar() ); 973 m_clear_action->removeFrom( markbar() );
974 m_save_action->removeFrom( markbar() ); 974 m_save_action->removeFrom( markbar() );
975 m_tidy_action->removeFrom( markbar() ); 975 m_tidy_action->removeFrom( markbar() );
976 m_startBlock_action->removeFrom( markbar() ); 976 m_startBlock_action->removeFrom( markbar() );
977 m_endBlock_action->removeFrom( markbar() ); 977 m_endBlock_action->removeFrom( markbar() );
978 } 978 }
979 else if (markBar != fileBar) 979 else if (markBar != fileBar)
980 { 980 {
981 markBar->clear(); 981 markBar->clear();
982 } 982 }
983 } 983 }
984 addmarkbar(config, "Mark", m_mark_action); 984 addmarkbar(config, "Mark", m_mark_action);
985 addmarkbar(config, "Annotate", m_annotate_action); 985 addmarkbar(config, "Annotate", m_annotate_action);
986 addmarkbar(config, "Goto", m_goto_action); 986 addmarkbar(config, "Goto", m_goto_action);
987 addmarkbar(config, "Delete", m_delete_action); 987 addmarkbar(config, "Delete", m_delete_action);
988 addmarkbar(config, "Autogen", m_autogen_action); 988 addmarkbar(config, "Autogen", m_autogen_action);
989 addmarkbar(config, "Clear", m_clear_action); 989 addmarkbar(config, "Clear", m_clear_action);
990 addmarkbar(config, "Save", m_save_action); 990 addmarkbar(config, "Save", m_save_action);
991 addmarkbar(config, "Tidy", m_tidy_action); 991 addmarkbar(config, "Tidy", m_tidy_action);
992 addmarkbar(config, "Start Block", m_startBlock_action); 992 addmarkbar(config, "Start Block", m_startBlock_action);
993 addmarkbar(config, "Copy Block", m_endBlock_action); 993 addmarkbar(config, "Copy Block", m_endBlock_action);
994 if (checkbar(config, "Annotation indicator")) 994 if (checkbar(config, "Annotation indicator"))
995 { 995 {
996 if (m_bkmkAvail == NULL) 996 if (m_bkmkAvail == NULL)
997 { 997 {
998 m_bkmkAvail = new QAction( tr( "Annotation" ), geticon( "find" ), QString::null, 0, this, 0 ); 998 m_bkmkAvail = new QAction( tr( "Annotation" ), geticon( "find" ), QString::null, 0, this, 0 );
999 connect( m_bkmkAvail, SIGNAL( activated() ), this, SLOT( showAnnotation() ) ); 999 connect( m_bkmkAvail, SIGNAL( activated() ), this, SLOT( showAnnotation() ) );
1000 1000
1001 m_bkmkAvail->setEnabled(false); 1001 m_bkmkAvail->setEnabled(false);
1002 } 1002 }
1003 QLabel *spacer = new QLabel(markBar, ""); 1003 QLabel *spacer = new QLabel(markBar, "");
1004 markbar()->setStretchableWidget(spacer); 1004 markbar()->setStretchableWidget(spacer);
1005 m_bkmkAvail->removeFrom( markbar() ); 1005 m_bkmkAvail->removeFrom( markbar() );
1006 m_bkmkAvail->addTo( markbar() ); 1006 m_bkmkAvail->addTo( markbar() );
1007 } 1007 }
1008 else 1008 else
1009 { 1009 {
1010 if (m_bkmkAvail != NULL) 1010 if (m_bkmkAvail != NULL)
1011 { 1011 {
1012 m_bkmkAvail->removeFrom( markbar() ); 1012 m_bkmkAvail->removeFrom( markbar() );
1013 delete m_bkmkAvail; 1013 delete m_bkmkAvail;
1014 m_bkmkAvail = NULL; 1014 m_bkmkAvail = NULL;
1015 } 1015 }
1016 } 1016 }
1017} 1017}
1018 1018
1019bool QTReaderApp::checkbar(Config* _config, const QString& key) 1019bool QTReaderApp::checkbar(Config* _config, const QString& key)
1020{ 1020{
1021 return _config->readBoolEntry(key, false); 1021 return _config->readBoolEntry(key, false);
1022} 1022}
1023 1023
1024 1024
1025QToolBar* QTReaderApp::filebar() 1025QToolBar* QTReaderApp::filebar()
1026{ 1026{
1027 if (fileBar == NULL) 1027 if (fileBar == NULL)
1028 { 1028 {
1029 switch (m_tbpol) 1029 switch (m_tbpol)
1030 { 1030 {
1031 case cesSingle: 1031 case cesSingle:
1032 // qDebug("Setting filebar to menubar"); 1032 // qDebug("Setting filebar to menubar");
1033 fileBar = menubar; 1033 fileBar = menubar;
1034 break; 1034 break;
1035 default: 1035 default:
1036 qDebug("Incorrect toolbar policy set"); 1036 qDebug("Incorrect toolbar policy set");
1037 case cesMenuTool: 1037 case cesMenuTool:
1038 case cesMultiple: 1038 case cesMultiple:
1039 // qDebug("Creating new file bar"); 1039 // qDebug("Creating new file bar");
1040 fileBar = new QToolBar("File", this, m_tbposition); 1040 fileBar = new QToolBar("File", this, m_tbposition);
1041 break; 1041 break;
1042 } 1042 }
1043 //fileBar->setHorizontalStretchable( true ); 1043 //fileBar->setHorizontalStretchable( true );
1044 } 1044 }
1045 return fileBar; 1045 return fileBar;
1046} 1046}
1047QToolBar* QTReaderApp::viewbar() 1047QToolBar* QTReaderApp::viewbar()
1048{ 1048{
1049 if (viewBar == NULL) 1049 if (viewBar == NULL)
1050 { 1050 {
1051 switch (m_tbpol) 1051 switch (m_tbpol)
1052 { 1052 {
1053 case cesMultiple: 1053 case cesMultiple:
1054 viewBar = new QToolBar("View", this, m_tbposition); 1054 viewBar = new QToolBar("View", this, m_tbposition);
1055 break; 1055 break;
1056 default: 1056 default:
1057 qDebug("Incorrect toolbar policy set"); 1057 qDebug("Incorrect toolbar policy set");
1058 case cesSingle: 1058 case cesSingle:
1059 case cesMenuTool: 1059 case cesMenuTool:
1060 viewBar = fileBar; 1060 viewBar = fileBar;
1061 break; 1061 break;
1062 } 1062 }
1063 } 1063 }
1064 return viewBar; 1064 return viewBar;
1065} 1065}
1066QToolBar* QTReaderApp::navbar() 1066QToolBar* QTReaderApp::navbar()
1067{ 1067{
1068 if (navBar == NULL) 1068 if (navBar == NULL)
1069 { 1069 {
1070 switch (m_tbpol) 1070 switch (m_tbpol)
1071 { 1071 {
1072 case cesMultiple: 1072 case cesMultiple:
1073 // qDebug("Creating new nav bar"); 1073 // qDebug("Creating new nav bar");
1074 navBar = new QToolBar("Navigation", this, m_tbposition); 1074 navBar = new QToolBar("Navigation", this, m_tbposition);
1075 break; 1075 break;
1076 default: 1076 default:
1077 qDebug("Incorrect toolbar policy set"); 1077 qDebug("Incorrect toolbar policy set");
1078 case cesSingle: 1078 case cesSingle:
1079 case cesMenuTool: 1079 case cesMenuTool:
1080 navBar = fileBar; 1080 navBar = fileBar;
1081 // qDebug("Setting navbar to filebar"); 1081 // qDebug("Setting navbar to filebar");
1082 break; 1082 break;
1083 } 1083 }
1084 } 1084 }
1085 return navBar; 1085 return navBar;
1086} 1086}
1087QToolBar* QTReaderApp::markbar() 1087QToolBar* QTReaderApp::markbar()
1088{ 1088{
1089 if (markBar == NULL) 1089 if (markBar == NULL)
1090 { 1090 {
1091 switch (m_tbpol) 1091 switch (m_tbpol)
1092 { 1092 {
1093 case cesMultiple: 1093 case cesMultiple:
1094 markBar = new QToolBar("Marks", this, m_tbposition); 1094 markBar = new QToolBar("Marks", this, m_tbposition);
1095 break; 1095 break;
1096 default: 1096 default:
1097 qDebug("Incorrect toolbar policy set"); 1097 qDebug("Incorrect toolbar policy set");
1098 case cesSingle: 1098 case cesSingle:
1099 case cesMenuTool: 1099 case cesMenuTool:
1100 markBar = fileBar; 1100 markBar = fileBar;
1101 break; 1101 break;
1102 } 1102 }
1103 } 1103 }
1104 return markBar; 1104 return markBar;
1105} 1105}
1106 1106
1107void QTReaderApp::addfilebar(Config* _config, const QString& key, QAction* a) 1107void QTReaderApp::addfilebar(Config* _config, const QString& key, QAction* a)
1108{ 1108{
1109 if (_config->readBoolEntry(key, false)) a->addTo( filebar() ); 1109 if (_config->readBoolEntry(key, false)) a->addTo( filebar() );
1110} 1110}
1111void QTReaderApp::addnavbar(Config* _config, const QString& key, QAction* a) 1111void QTReaderApp::addnavbar(Config* _config, const QString& key, QAction* a)
1112{ 1112{
1113 if (_config->readBoolEntry(key, false)) a->addTo( navbar() ); 1113 if (_config->readBoolEntry(key, false)) a->addTo( navbar() );
1114} 1114}
1115void QTReaderApp::addmarkbar(Config* _config, const QString& key, QAction* a) 1115void QTReaderApp::addmarkbar(Config* _config, const QString& key, QAction* a)
1116{ 1116{
1117 if (_config->readBoolEntry(key, false)) a->addTo( markbar() ); 1117 if (_config->readBoolEntry(key, false)) a->addTo( markbar() );
1118} 1118}
1119void QTReaderApp::addviewbar(Config* _config, const QString& key, QAction* a) 1119void QTReaderApp::addviewbar(Config* _config, const QString& key, QAction* a)
1120{ 1120{
1121 if (_config->readBoolEntry(key, false)) a->addTo( viewbar() ); 1121 if (_config->readBoolEntry(key, false)) a->addTo( viewbar() );
1122} 1122}
1123 1123
1124void QTReaderApp::suspend() { reader->suspend(); } 1124void QTReaderApp::suspend() { reader->suspend(); }
1125 1125
1126#ifdef USEMSGS 1126#ifdef USEMSGS
1127void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data) 1127void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data)
1128{ 1128{
1129 QString msg = QString::fromUtf8(_msg); 1129 QString msg = QString::fromUtf8(_msg);
1130 1130
1131//// qDebug("Received:%s", (const char*)msg); 1131//// qDebug("Received:%s", (const char*)msg);
1132 1132
1133 QDataStream stream( _data, IO_ReadOnly ); 1133 QDataStream stream( _data, IO_ReadOnly );
1134 if ( msg == "info(QString)" ) 1134 if ( msg == "info(QString)" )
1135 { 1135 {
1136 QString info; 1136 QString info;
1137 stream >> info; 1137 stream >> info;
1138 QMessageBox::information(this, PROGNAME, info); 1138 QMessageBox::information(this, PROGNAME, info);
1139 } 1139 }
1140 else if ( msg == "Update(int)" ) 1140 else if ( msg == "Update(int)" )
1141 { 1141 {
1142 int info; 1142 int info;
1143 stream >> info; 1143 stream >> info;
1144 if (info) 1144 if (info)
1145 { 1145 {
1146 reader->bDoUpdates = true; 1146 reader->bDoUpdates = true;
1147 reader->refresh(); 1147 reader->refresh();
1148 } 1148 }
1149 else 1149 else
1150 { 1150 {
1151 reader->bDoUpdates = false; 1151 reader->bDoUpdates = false;
1152 } 1152 }
1153 } 1153 }
1154 else if ( msg == "warn(QString)" ) 1154 else if ( msg == "warn(QString)" )
1155 { 1155 {
1156 QString info; 1156 QString info;
1157 stream >> info; 1157 stream >> info;
1158 QMessageBox::warning(this, PROGNAME, info); 1158 QMessageBox::warning(this, PROGNAME, info);
1159 } 1159 }
1160 else if ( msg == "exit()" ) 1160 else if ( msg == "exit()" )
1161 { 1161 {
1162 m_dontSave = true; 1162 m_dontSave = true;
1163 close(); 1163 close();
1164 } 1164 }
1165 else if ( msg == "pageDown()" ) 1165 else if ( msg == "pageDown()" )
1166 { 1166 {
1167 reader->dopagedn(); 1167 reader->dopagedn();
1168 } 1168 }
1169 else if ( msg == "pageUp()" ) 1169 else if ( msg == "pageUp()" )
1170 { 1170 {
1171 reader->dopageup(); 1171 reader->dopageup();
1172 } 1172 }
1173 else if ( msg == "lineDown()" ) 1173 else if ( msg == "lineDown()" )
1174 { 1174 {
1175 reader->lineDown(); 1175 reader->lineDown();
1176 } 1176 }
1177 else if ( msg == "lineUp()" ) 1177 else if ( msg == "lineUp()" )
1178 { 1178 {
1179 reader->lineUp(); 1179 reader->lineUp();
1180 } 1180 }
1181 else if ( msg == "showText()" ) 1181 else if ( msg == "showText()" )
1182 { 1182 {
1183 showEditTools(); 1183 showEditTools();
1184 } 1184 }
1185 else if ( msg == "home()" ) 1185 else if ( msg == "home()" )
1186 { 1186 {
1187 reader->goHome(); 1187 reader->goHome();
1188 } 1188 }
1189 else if ( msg == "back()" ) 1189 else if ( msg == "back()" )
1190 { 1190 {
1191 reader->goBack(); 1191 reader->goBack();
1192 } 1192 }
1193 else if ( msg == "forward()" ) 1193 else if ( msg == "forward()" )
1194 { 1194 {
1195 reader->goForward(); 1195 reader->goForward();
1196 } 1196 }
1197 else if ( msg == "File/Open(QString)" ) 1197 else if ( msg == "File/Open(QString)" )
1198 { 1198 {
1199 QString info; 1199 QString info;
1200 stream >> info; 1200 stream >> info;
1201 openFile( info ); 1201 openFile( info );
1202 } 1202 }
1203 else if ( msg == "File/Info()" ) 1203 else if ( msg == "File/Info()" )
1204 { 1204 {
1205 showinfo(); 1205 showinfo();
1206 } 1206 }
1207 else if ( msg == "File/Action(QString)" ) 1207 else if ( msg == "File/Action(QString)" )
1208 { 1208 {
1209 QString info; 1209 QString info;
1210 stream >> info; 1210 stream >> info;
1211 m_spaceTarget = ActNameToInt(info); 1211 m_spaceTarget = ActNameToInt(info);
1212 } 1212 }
1213 else if ( msg == "Navigation/Scroll(int)" ) 1213 else if ( msg == "Navigation/Scroll(int)" )
1214 { 1214 {
1215 int info; 1215 int info;
1216 stream >> info; 1216 stream >> info;
1217 autoScroll(info); 1217 autoScroll(info);
1218 } 1218 }
1219 1219
1220 else if ( msg == "Navigation/GotoStart()" ) 1220 else if ( msg == "Navigation/GotoStart()" )
1221 { 1221 {
1222 gotoStart(); 1222 gotoStart();
1223 } 1223 }
1224 else if ( msg == "Navigation/GotoEnd()" ) 1224 else if ( msg == "Navigation/GotoEnd()" )
1225 { 1225 {
1226 gotoEnd(); 1226 gotoEnd();
1227 } 1227 }
1228 else if ( msg == "Navigation/Jump(int)" ) 1228 else if ( msg == "Navigation/Jump(int)" )
1229 { 1229 {
1230 int info; 1230 int info;
1231 stream >> info; 1231 stream >> info;
1232 reader->locate(info); 1232 reader->locate(info);
1233 } 1233 }
1234 else if ( msg == "Navigation/Page/LineScroll(int)" ) 1234 else if ( msg == "Navigation/Page/LineScroll(int)" )
1235 { 1235 {
1236 int info; 1236 int info;
1237 stream >> info; 1237 stream >> info;
1238 pagemode(info); 1238 pagemode(info);
1239 } 1239 }
1240 else if ( msg == "Navigation/SetOverlap(int)" ) 1240 else if ( msg == "Navigation/SetOverlap(int)" )
1241 { 1241 {
1242 int info; 1242 int info;
1243 stream >> info; 1243 stream >> info;
1244 reader->m_overlap = info; 1244 reader->m_overlap = info;
1245 } 1245 }
1246 else if ( msg == "Navigation/SetMargin(int)" ) 1246 else if ( msg == "Navigation/SetMargin(int)" )
1247 { 1247 {
1248 int info; 1248 int info;
1249 stream >> info; 1249 stream >> info;
1250 do_margin(info); 1250 do_margin(info);
1251 } 1251 }
1252 else if ( msg == "File/SetDictionary(QString)" ) 1252 else if ( msg == "File/SetDictionary(QString)" )
1253 { 1253 {
1254 QString info; 1254 QString info;
1255 stream >> info; 1255 stream >> info;
1256 do_settarget(info); 1256 do_settarget(info);
1257 } 1257 }
1258#ifdef _SCROLLPIPE 1258#ifdef _SCROLLPIPE
1259 else if ( msg == "File/SetScrollTarget(QString)" ) 1259 else if ( msg == "File/SetScrollTarget(QString)" )
1260 { 1260 {
1261 QString info; 1261 QString info;
1262 stream >> info; 1262 stream >> info;
1263 reader->m_pipetarget = info; 1263 reader->m_pipetarget = info;
1264 } 1264 }
1265#endif 1265#endif
1266 else if ( msg == "File/Two/OneTouch(int)" ) 1266 else if ( msg == "File/Two/OneTouch(int)" )
1267 { 1267 {
1268 int info; 1268 int info;
1269 stream >> info; 1269 stream >> info;
1270 setTwoTouch(info); 1270 setTwoTouch(info);
1271 } 1271 }
1272 else if ( msg == "Target/Annotation(int)" ) 1272 else if ( msg == "Target/Annotation(int)" )
1273 { 1273 {
1274 int info; 1274 int info;
1275 stream >> info; 1275 stream >> info;
1276 OnAnnotation(info); 1276 OnAnnotation(info);
1277 } 1277 }
1278 else if ( msg == "Target/Dictionary(int)" ) 1278 else if ( msg == "Target/Dictionary(int)" )
1279 { 1279 {
1280 int info; 1280 int info;
1281 stream >> info; 1281 stream >> info;
1282 OnDictionary(info); 1282 OnDictionary(info);
1283 } 1283 }
1284 else if ( msg == "Target/Clipboard(int)" ) 1284 else if ( msg == "Target/Clipboard(int)" )
1285 { 1285 {
1286 int info; 1286 int info;
1287 stream >> info; 1287 stream >> info;
1288 OnClipboard(info); 1288 OnClipboard(info);
1289 } 1289 }
1290 else if ( msg == "File/Find(QString)" ) 1290 else if ( msg == "File/Find(QString)" )
1291 { 1291 {
1292 QString info; 1292 QString info;
1293 stream >> info; 1293 stream >> info;
1294 QRegExp arg(info); 1294 QRegExp arg(info);
1295 size_t pos = reader->pagelocate(); 1295 size_t pos = reader->pagelocate();
1296 size_t start = pos; 1296 size_t start = pos;
1297 CDrawBuffer test(&(reader->m_fontControl)); 1297 CDrawBuffer test(&(reader->m_fontControl));
1298 reader->getline(&test); 1298 reader->getline(&test);
1299 while (arg.match(toQString(test.data())) == -1) 1299 while (arg.match(toQString(test.data())) == -1)
1300 { 1300 {
1301 pos = reader->locate(); 1301 pos = reader->locate();
1302 if (!reader->getline(&test)) 1302 if (!reader->getline(&test))
1303 { 1303 {
1304 QMessageBox::information(this, PROGNAME, QString("Can't find\n")+info); 1304 QMessageBox::information(this, PROGNAME, QString("Can't find\n")+info);
1305 pos = start; 1305 pos = start;
1306 break; 1306 break;
1307 } 1307 }
1308 } 1308 }
1309 reader->locate(pos); 1309 reader->locate(pos);
1310 } 1310 }
1311 else if ( msg == "File/Fullscreen(int)" ) 1311 else if ( msg == "File/Fullscreen(int)" )
1312 { 1312 {
1313 int info; 1313 int info;
1314 stream >> info; 1314 stream >> info;
1315 setfullscreen(info); 1315 setfullscreen(info);
1316 } 1316 }
1317 else if ( msg == "File/Continuous(int)" ) 1317 else if ( msg == "File/Continuous(int)" )
1318 { 1318 {
1319 int info; 1319 int info;
1320 stream >> info; 1320 stream >> info;
1321 setcontinuous(info); 1321 setcontinuous(info);
1322 } 1322 }
1323 else if ( msg == "Markup(QString)" ) 1323 else if ( msg == "Markup(QString)" )
1324 { 1324 {
1325 QString info; 1325 QString info;
1326 stream >> info; 1326 stream >> info;
1327 if (info == "Auto") 1327 if (info == "Auto")
1328 { 1328 {
1329 autofmt(true); 1329 autofmt(true);
1330 } 1330 }
1331 if (info == "None") 1331 if (info == "None")
1332 { 1332 {
1333 autofmt(false); 1333 autofmt(false);
1334 textfmt(false); 1334 textfmt(false);
1335 striphtml(false); 1335 striphtml(false);
1336 peanut(false); 1336 peanut(false);
1337 } 1337 }
1338 if (info == "Text") 1338 if (info == "Text")
1339 { 1339 {
1340 textfmt(true); 1340 textfmt(true);
1341 } 1341 }
1342 if (info == "HTML") 1342 if (info == "HTML")
1343 { 1343 {
1344 striphtml(true); 1344 striphtml(true);
1345 } 1345 }
1346 if (info == "Peanut/PML") 1346 if (info == "Peanut/PML")
1347 { 1347 {
1348 peanut(true); 1348 peanut(true);
1349 } 1349 }
1350 } 1350 }
1351 else if ( msg == "Layout/StripCR(int)" ) 1351 else if ( msg == "Layout/StripCR(int)" )
1352 { 1352 {
1353 int info; 1353 int info;
1354 stream >> info; 1354 stream >> info;
1355 stripcr(info); 1355 stripcr(info);
1356 } 1356 }
1357 else if ( msg == "Layout/Dehyphen(int)" ) 1357 else if ( msg == "Layout/Dehyphen(int)" )
1358 { 1358 {
1359 int info; 1359 int info;
1360 stream >> info; 1360 stream >> info;
1361 dehyphen(info); 1361 dehyphen(info);
1362 } 1362 }
1363 else if ( msg == "Layout/Depluck(int)" ) 1363 else if ( msg == "Layout/Depluck(int)" )
1364 { 1364 {
1365 int info; 1365 int info;
1366 stream >> info; 1366 stream >> info;
1367 depluck(info); 1367 depluck(info);
1368 } 1368 }
1369 else if ( msg == "Layout/Dejpluck(int)" ) 1369 else if ( msg == "Layout/Dejpluck(int)" )
1370 { 1370 {
1371 int info; 1371 int info;
1372 stream >> info; 1372 stream >> info;
1373 dejpluck(info); 1373 dejpluck(info);
1374 } 1374 }
1375 else if ( msg == "Layout/SingleSpace(int)" ) 1375 else if ( msg == "Layout/SingleSpace(int)" )
1376 { 1376 {
1377 int info; 1377 int info;
1378 stream >> info; 1378 stream >> info;
1379 onespace(info); 1379 onespace(info);
1380 } 1380 }
1381#ifdef REPALM 1381#ifdef REPALM
1382 else if ( msg == "Layout/Repalm(int)" ) 1382 else if ( msg == "Layout/Repalm(int)" )
1383 { 1383 {
1384 int info; 1384 int info;
1385 stream >> info; 1385 stream >> info;
1386 repalm(info); 1386 repalm(info);
1387 } 1387 }
1388#endif 1388#endif
1389 else if ( msg == "Layout/Unindent(int)" ) 1389 else if ( msg == "Layout/Unindent(int)" )
1390 { 1390 {
1391 int info; 1391 int info;
1392 stream >> info; 1392 stream >> info;
1393 unindent(info); 1393 unindent(info);
1394 } 1394 }
1395 else if ( msg == "Layout/Re-paragraph(int)" ) 1395 else if ( msg == "Layout/Re-paragraph(int)" )
1396 { 1396 {
1397 int info; 1397 int info;
1398 stream >> info; 1398 stream >> info;
1399 repara(info); 1399 repara(info);
1400 } 1400 }
1401 else if ( msg == "Layout/DoubleSpace(int)" ) 1401 else if ( msg == "Layout/DoubleSpace(int)" )
1402 { 1402 {
1403 int info; 1403 int info;
1404 stream >> info; 1404 stream >> info;
1405 dblspce(info); 1405 dblspce(info);
1406 } 1406 }
1407 else if ( msg == "Layout/Indent(int)" ) 1407 else if ( msg == "Layout/Indent(int)" )
1408 { 1408 {
1409 int info; 1409 int info;
1410 stream >> info; 1410 stream >> info;
1411 reader->bindenter = info; 1411 reader->bindenter = info;
1412 reader->setfilter(reader->getfilter()); 1412 reader->setfilter(reader->getfilter());
1413 } 1413 }
1414 else if ( msg == "Layout/Remap(int)" ) 1414 else if ( msg == "Layout/Remap(int)" )
1415 { 1415 {
1416 int info; 1416 int info;
1417 stream >> info; 1417 stream >> info;
1418 remap(info); 1418 remap(info);
1419 } 1419 }
1420 else if ( msg == "Layout/Embolden(int)" ) 1420 else if ( msg == "Layout/Embolden(int)" )
1421 { 1421 {
1422 int info; 1422 int info;
1423 stream >> info; 1423 stream >> info;
1424 embolden(info); 1424 embolden(info);
1425 } 1425 }
1426 else if ( msg == "Format/Ideogram/Word(int)" ) 1426 else if ( msg == "Format/Ideogram/Word(int)" )
1427 { 1427 {
1428 int info; 1428 int info;
1429 stream >> info; 1429 stream >> info;
1430 monospace(info); 1430 monospace(info);
1431 } 1431 }
1432 else if ( msg == "Format/SetWidth(int)" ) 1432 else if ( msg == "Format/SetWidth(int)" )
1433 { 1433 {
1434 int info; 1434 int info;
1435 stream >> info; 1435 stream >> info;
1436 reader->m_charpc = info; 1436 reader->m_charpc = info;
1437 reader->setfont(); 1437 reader->setfont();
1438 reader->refresh(); 1438 reader->refresh();
1439 } 1439 }
1440 else if ( msg == "Format/SetFont(QString,int)" ) 1440 else if ( msg == "Format/SetFont(QString,int)" )
1441 { 1441 {
1442 QString fontname; 1442 QString fontname;
1443 int size; 1443 int size;
1444 stream >> fontname; 1444 stream >> fontname;
1445 stream >> size; 1445 stream >> size;
1446 setfontHelper(fontname, size); 1446 setfontHelper(fontname, size);
1447 } 1447 }
1448 else if ( msg == "Marks/Autogen(QString)" ) 1448 else if ( msg == "Marks/Autogen(QString)" )
1449 { 1449 {
1450 QString info; 1450 QString info;
1451 stream >> info; 1451 stream >> info;
1452 do_autogen(info); 1452 do_autogen(info);
1453 } 1453 }
1454 else if ( msg == "File/StartBlock()" ) 1454 else if ( msg == "File/StartBlock()" )
1455 { 1455 {
1456 editMark(); 1456 editMark();
1457 } 1457 }
1458 else if ( msg == "File/CopyBlock()" ) 1458 else if ( msg == "File/CopyBlock()" )
1459 { 1459 {
1460 editCopy(); 1460 editCopy();
1461 } 1461 }
1462} 1462}
1463#endif 1463#endif
1464ActionTypes QTReaderApp::ActNameToInt(const QString& _enc) 1464ActionTypes QTReaderApp::ActNameToInt(const QString& _enc)
1465{ 1465{
1466 for (int i = 0; i < MAX_ACTIONS; i++) 1466 for (int i = 0; i < MAX_ACTIONS; i++)
1467 { 1467 {
1468 if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i; 1468 if (m_buttonAction[i]->text() == _enc) return (ActionTypes)i;
1469 } 1469 }
1470 return cesAutoScroll; 1470 return cesAutoScroll;
1471} 1471}
1472 1472
1473void QTReaderApp::setfullscreen(bool sfs) 1473void QTReaderApp::setfullscreen(bool sfs)
1474{ 1474{
1475 reader->bDoUpdates = false; 1475 reader->bDoUpdates = false;
1476 m_fullscreen = sfs; 1476 m_fullscreen = sfs;
1477 showEditTools(); 1477 showEditTools();
1478// qApp->processEvents(); 1478// qApp->processEvents();
1479 reader->bDoUpdates = true; 1479 reader->bDoUpdates = true;
1480 reader->update(); 1480 reader->update();
1481} 1481}
1482 1482
1483void QTReaderApp::buttonActionSelected(QAction* _a) 1483void QTReaderApp::buttonActionSelected(QAction* _a)
1484{ 1484{
1485//// qDebug("es:%x : %s (%u)", _a, (const char *)(_a->text()), ActNameToInt(_a->text())); 1485//// qDebug("es:%x : %s (%u)", _a, (const char *)(_a->text()), ActNameToInt(_a->text()));
1486 m_spaceTarget = ActNameToInt(_a->text()); 1486 m_spaceTarget = ActNameToInt(_a->text());
1487} 1487}
1488 1488
1489QTReaderApp::~QTReaderApp() 1489QTReaderApp::~QTReaderApp()
1490{ 1490{
1491} 1491}
1492 1492
1493void QTReaderApp::autoScroll(bool _b) 1493void QTReaderApp::autoScroll(bool _b)
1494{ 1494{
1495 reader->setautoscroll(_b); 1495 reader->setautoscroll(_b);
1496 setScrollState(reader->m_autoScroll); 1496 setScrollState(reader->m_autoScroll);
1497} 1497}
1498 1498
1499void QTReaderApp::zoomin() 1499void QTReaderApp::zoomin()
1500{ 1500{
1501 reader->zoomin(); 1501 reader->zoomin();
1502} 1502}
1503 1503
1504void QTReaderApp::zoomout() 1504void QTReaderApp::zoomout()
1505{ 1505{
1506 reader->zoomout(); 1506 reader->zoomout();
1507} 1507}
1508 1508
1509void QTReaderApp::clearBkmkList() 1509void QTReaderApp::clearBkmkList()
1510{ 1510{
1511 delete pBkmklist; 1511 delete pBkmklist;
1512 pBkmklist = NULL; 1512 pBkmklist = NULL;
1513 m_fBkmksChanged = false; 1513 m_fBkmksChanged = false;
1514} 1514}
1515 1515
1516void QTReaderApp::fileClose() 1516void QTReaderApp::fileClose()
1517{ 1517{
1518 CCloseDialog* cd = new CCloseDialog(reader->m_string, false, this); 1518 CCloseDialog* cd = new CCloseDialog(reader->m_string, false, this);
1519 if (cd->exec()) 1519 if (cd->exec())
1520 { 1520 {
1521 if (pOpenlist != NULL) 1521 if (pOpenlist != NULL)
1522 { 1522 {
1523 int ind = 0; 1523 int ind = 0;
1524 Bkmk* p = (*pOpenlist)[ind]; 1524 Bkmk* p = (*pOpenlist)[ind];
1525 while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) 1525 while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile)
1526 { 1526 {
1527 p = (*pOpenlist)[++ind]; 1527 p = (*pOpenlist)[++ind];
1528 } 1528 }
1529 if (p != NULL) pOpenlist->erase(ind); 1529 if (p != NULL) pOpenlist->erase(ind);
1530 if (cd->delFile()) 1530 if (cd->delFile())
1531 { 1531 {
1532 unlink((const char*)reader->m_lastfile); 1532 unlink((const char*)reader->m_lastfile);
1533 } 1533 }
1534 if (cd->delMarks()) 1534 if (cd->delMarks())
1535 { 1535 {
1536#ifndef USEQPE 1536#ifndef USEQPE
1537 QDir d = QDir::home(); // "/" 1537 QDir d = QDir::home(); // "/"
1538 d.cd(APPDIR); 1538 d.cd(APPDIR);
1539 d.remove(reader->m_string); 1539 d.remove(reader->m_string);
1540#else /* USEQPE */ 1540#else /* USEQPE */
1541 unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); 1541 unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string));
1542#endif /* USEQPE */ 1542#endif /* USEQPE */
1543 } 1543 }
1544 if (cd->delConfig()) 1544 if (cd->delConfig())
1545 { 1545 {
1546#ifndef USEQPE 1546#ifndef USEQPE
1547 QDir d = QDir::home(); // "/" 1547 QDir d = QDir::home(); // "/"
1548 d.cd(APPDIR "/configs"); 1548 d.cd(APPDIR "/configs");
1549 d.remove(reader->m_string); 1549 d.remove(reader->m_string);
1550#else /* USEQPE */ 1550#else /* USEQPE */
1551 unlink((const char *)Global::applicationFileName(APPDIR "/configs",reader->m_string)); 1551 unlink((const char *)Global::applicationFileName(APPDIR "/configs",reader->m_string));
1552#endif /* USEQPE */ 1552#endif /* USEQPE */
1553 } 1553 }
1554 } 1554 }
1555 1555
1556 fileOpen2(); 1556 fileOpen2();
1557 } 1557 }
1558 delete cd; 1558 delete cd;
1559} 1559}
1560 1560
1561void QTReaderApp::updatefileinfo() 1561void QTReaderApp::updatefileinfo()
1562{ 1562{
1563 if (reader->m_string.isEmpty()) return; 1563 if (reader->m_string.isEmpty()) return;
1564 if (reader->m_lastfile.isEmpty()) return; 1564 if (reader->m_lastfile.isEmpty()) return;
1565 tchar* nm = fromQString(reader->m_string); 1565 tchar* nm = fromQString(reader->m_string);
1566 tchar* fl = fromQString(reader->m_lastfile); 1566 tchar* fl = fromQString(reader->m_lastfile);
1567// qDebug("Lastfile:%x", fl); 1567// qDebug("Lastfile:%x", fl);
1568 bool notadded = true; 1568 bool notadded = true;
1569 if (pOpenlist == NULL) pOpenlist = new CList<Bkmk>; 1569 if (pOpenlist == NULL) pOpenlist = new CList<Bkmk>;
1570 else 1570 else
1571 { 1571 {
1572 for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) 1572 for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++)
1573 { 1573 {
1574 if (ustrcmp(CFiledata(iter->anno()).name(), fl) == 0) 1574 if (ustrcmp(CFiledata(iter->anno()).name(), fl) == 0)
1575 { 1575 {
1576 iter->value(reader->pagelocate()); 1576 iter->value(reader->pagelocate());
1577 unsigned short dlen; 1577 unsigned short dlen;
1578 unsigned char* data; 1578 unsigned char* data;
1579 CFiledata fd(iter->anno()); 1579 CFiledata fd(iter->anno());
1580 reader->setSaveData(data, dlen, fd.content(), fd.length()); 1580 reader->setSaveData(data, dlen, fd.content(), fd.length());
1581 // qDebug("Filedata(1):%u, %u", fd.length(), dlen); 1581 // qDebug("Filedata(1):%u, %u", fd.length(), dlen);
1582 // getstate(data, dlen); 1582 // getstate(data, dlen);
1583 iter->setAnno(data, dlen); 1583 iter->setAnno(data, dlen);
1584 notadded = false; 1584 notadded = false;
1585 delete [] data; 1585 delete [] data;
1586 break; 1586 break;
1587 } 1587 }
1588 } 1588 }
1589 } 1589 }
1590// qDebug("Added?:%x", notadded); 1590// qDebug("Added?:%x", notadded);
1591 if (notadded) 1591 if (notadded)
1592 { 1592 {
1593 struct stat fnstat; 1593 struct stat fnstat;
1594 stat((const char *)reader->m_lastfile, &fnstat); 1594 stat((const char *)reader->m_lastfile, &fnstat);
1595 CFiledata fd(fnstat.st_mtime, fl); 1595 CFiledata fd(fnstat.st_mtime, fl);
1596 unsigned short dlen; 1596 unsigned short dlen;
1597 unsigned char* data; 1597 unsigned char* data;
1598 reader->setSaveData(data, dlen, fd.content(), fd.length()); 1598 reader->setSaveData(data, dlen, fd.content(), fd.length());
1599 pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate())); 1599 pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate()));
1600 //qDebug("Filedata(2):%u, %u", fd.length(), dlen); 1600 //qDebug("Filedata(2):%u, %u", fd.length(), dlen);
1601 delete [] data; 1601 delete [] data;
1602 } 1602 }
1603 delete [] nm; 1603 delete [] nm;
1604 delete [] fl; 1604 delete [] fl;
1605} 1605}
1606 1606
1607void QTReaderApp::fileOpen() 1607void QTReaderApp::fileOpen()
1608{ 1608{
1609/* 1609/*
1610 menu->hide(); 1610 menu->hide();
1611 fileBar->hide(); 1611 fileBar->hide();
1612 if (regVisible) regBar->hide(); 1612 if (regVisible) regBar->hide();
1613 if (searchVisible) searchBar->hide(); 1613 if (searchVisible) searchBar->hide();
1614*/ 1614*/
1615// qDebug("fileOpen"); 1615// qDebug("fileOpen");
1616// if (!reader->m_lastfile.isEmpty()) 1616// if (!reader->m_lastfile.isEmpty())
1617 updatefileinfo(); 1617 updatefileinfo();
1618 fileOpen2(); 1618 fileOpen2();
1619} 1619}
1620 1620
1621void QTReaderApp::fileOpen2() 1621void QTReaderApp::fileOpen2()
1622{ 1622{
1623 if (pBkmklist != NULL) 1623 if (pBkmklist != NULL)
1624 { 1624 {
1625 if (m_fBkmksChanged) 1625 if (m_fBkmksChanged)
1626 { 1626 {
1627 if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) 1627 if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0)
1628 savebkmks(); 1628 savebkmks();
1629 } 1629 }
1630 delete pBkmklist; 1630 delete pBkmklist;
1631 pBkmklist = NULL; 1631 pBkmklist = NULL;
1632 m_fBkmksChanged = false; 1632 m_fBkmksChanged = false;
1633 } 1633 }
1634 reader->disableAutoscroll(); 1634 reader->disableAutoscroll();
1635/* 1635/*
1636 editorStack->raiseWidget( fileSelector ); 1636 editorStack->raiseWidget( fileSelector );
1637 fileSelector->reread(); 1637 fileSelector->reread();
1638*/ 1638*/
1639 bool usebrowser = true; 1639 bool usebrowser = true;
1640 if (pOpenlist != NULL) 1640 if (pOpenlist != NULL)
1641 { 1641 {
1642 m_nBkmkAction = cOpenFile; 1642 m_nBkmkAction = cOpenFile;
1643 if (listbkmk(pOpenlist, "Browse")) usebrowser = false; 1643 if (listbkmk(pOpenlist, "Browse")) usebrowser = false;
1644 } 1644 }
1645 if (usebrowser) 1645 if (usebrowser)
1646 { 1646 {
1647 QString fn = usefilebrowser(); 1647 QString fn = usefilebrowser();
1648 //qApp->processEvents(); 1648 //qApp->processEvents();
1649 if (!fn.isEmpty() && QFileInfo(fn).isFile()) 1649 if (!fn.isEmpty() && QFileInfo(fn).isFile())
1650 { 1650 {
1651 openFile(fn); 1651 openFile(fn);
1652 } 1652 }
1653 reader->setFocus(); 1653 reader->setFocus();
1654 } 1654 }
1655// reader->refresh(); 1655// reader->refresh();
1656// qDebug("HEIGHT:%d", reader->m_lastheight); 1656// qDebug("HEIGHT:%d", reader->m_lastheight);
1657} 1657}
1658 1658
1659QString QTReaderApp::usefilebrowser() 1659QString QTReaderApp::usefilebrowser()
1660{ 1660{
1661#ifndef USEQPE 1661#ifndef USEQPE
1662 QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) ); 1662 QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) );
1663 return s; 1663 return s;
1664#else 1664#else
1665 fileBrowser* fb = new fileBrowser(false, this,"OpieReader",!m_bFloatingDialog, 1665 fileBrowser* fb = new fileBrowser(false, this,"OpieReader",!m_bFloatingDialog,
1666 0, 1666 0,
1667 // WStyle_Customize | WStyle_NoBorderEx, 1667 // WStyle_Customize | WStyle_NoBorderEx,
1668 "*", QFileInfo(reader->m_lastfile).dirPath(true)); 1668 "*", QFileInfo(reader->m_lastfile).dirPath(true));
1669 1669
1670 1670
1671 QString fn; 1671 QString fn;
1672 if (fb->exec()) 1672 if (fb->exec())
1673 { 1673 {
1674 fn = fb->getCurrentFile(); 1674 fn = fb->getCurrentFile();
1675 } 1675 }
1676// qDebug("Selected %s", (const char*)fn); 1676// qDebug("Selected %s", (const char*)fn);
1677 delete fb; 1677 delete fb;
1678 showEditTools(); 1678 showEditTools();
1679 return fn; 1679 return fn;
1680#endif 1680#endif
1681} 1681}
1682 1682
1683void QTReaderApp::showgraphic(QImage& pm) 1683void QTReaderApp::showgraphic(QImage& pm)
1684{ 1684{
1685 QPixmap pc; 1685 QPixmap pc;
1686 pc.convertFromImage(pm); 1686 pc.convertFromImage(pm);
1687 m_graphicwin->setPixmap(pc); 1687 m_graphicwin->setPixmap(pc);
1688 editorStack->raiseWidget( m_graphicwin ); 1688 editorStack->raiseWidget( m_graphicwin );
1689 m_graphicwin->setFocus(); 1689 m_graphicwin->setFocus();
1690} 1690}
1691 1691
1692 1692
1693void QTReaderApp::showprefs() 1693void QTReaderApp::showprefs()
1694{ 1694{
1695 CPrefs* prefwin = new CPrefs(!m_bFloatingDialog, this); 1695 CPrefs* prefwin = new CPrefs(!m_bFloatingDialog, this);
1696 1696
1697 prefwin->twotouch(m_twoTouch); 1697 prefwin->twotouch(m_twoTouch);
1698 prefwin->propfontchange(m_propogatefontchange); 1698 prefwin->propfontchange(m_propogatefontchange);
1699 prefwin->StripCR(reader->bstripcr); 1699 prefwin->StripCR(reader->bstripcr);
1700 prefwin->Dehyphen(reader->bdehyphen); 1700 prefwin->Dehyphen(reader->bdehyphen);
1701 prefwin->SingleSpace(reader->bonespace); 1701 prefwin->SingleSpace(reader->bonespace);
1702 prefwin->Unindent(reader->bunindent); 1702 prefwin->Unindent(reader->bunindent);
1703 prefwin->Reparagraph(reader->brepara); 1703 prefwin->Reparagraph(reader->brepara);
1704 prefwin->DoubleSpace(reader->bdblspce); 1704 prefwin->DoubleSpace(reader->bdblspce);
1705 prefwin->Remap(reader->bremap); 1705 prefwin->Remap(reader->bremap);
1706 prefwin->Embolden(reader->bmakebold); 1706 prefwin->Embolden(reader->bmakebold);
1707 prefwin->FullJustify(reader->bfulljust); 1707 prefwin->FullJustify(reader->bfulljust);
1708 prefwin->ParaLead(reader->getextraspace()); 1708 prefwin->ParaLead(reader->getextraspace());
1709 prefwin->LineLead(reader->getlead()); 1709 prefwin->LineLead(reader->getlead());
1710 prefwin->Margin(reader->m_border); 1710 prefwin->Margin(reader->m_border);
1711 prefwin->Indent(reader->bindenter); 1711 prefwin->Indent(reader->bindenter);
1712 if (reader->bautofmt) 1712 if (reader->bautofmt)
1713 { 1713 {
1714 prefwin->Markup(0); 1714 prefwin->Markup(0);
1715 } 1715 }
1716 else if (reader->btextfmt) 1716 else if (reader->btextfmt)
1717 { 1717 {
1718 prefwin->Markup(2); 1718 prefwin->Markup(2);
1719 } 1719 }
1720 else if (reader->bstriphtml) 1720 else if (reader->bstriphtml)
1721 { 1721 {
1722 prefwin->Markup(3); 1722 prefwin->Markup(3);
1723 } 1723 }
1724 else if (reader->bpeanut) 1724 else if (reader->bpeanut)
1725 { 1725 {
1726 prefwin->Markup(4); 1726 prefwin->Markup(4);
1727 } 1727 }
1728 else 1728 else
1729 { 1729 {
1730 prefwin->Markup(1); 1730 prefwin->Markup(1);
1731 } 1731 }
1732 prefwin->Depluck(reader->bdepluck); 1732 prefwin->Depluck(reader->bdepluck);
1733 prefwin->Dejpluck(reader->bdejpluck); 1733 prefwin->Dejpluck(reader->bdejpluck);
1734 prefwin->Continuous(reader->m_continuousDocument); 1734 prefwin->Continuous(reader->m_continuousDocument);
1735 1735
1736 prefwin->dictApplication(m_targetapp); 1736 prefwin->dictApplication(m_targetapp);
1737 prefwin->dictMessage(m_targetmsg); 1737 prefwin->dictMessage(m_targetmsg);
1738 1738
1739 prefwin->spaceAction(m_spaceTarget); 1739 prefwin->spaceAction(m_spaceTarget);
1740 prefwin->escapeAction(m_escapeTarget); 1740 prefwin->escapeAction(m_escapeTarget);
1741 prefwin->returnAction(m_returnTarget); 1741 prefwin->returnAction(m_returnTarget);
1742 prefwin->leftAction(m_leftTarget); 1742 prefwin->leftAction(m_leftTarget);
1743 prefwin->rightAction(m_rightTarget); 1743 prefwin->rightAction(m_rightTarget);
1744 prefwin->upAction(m_upTarget); 1744 prefwin->upAction(m_upTarget);
1745 prefwin->downAction(m_downTarget); 1745 prefwin->downAction(m_downTarget);
1746 1746
1747 prefwin->leftScroll(m_leftScroll); 1747 prefwin->leftScroll(m_leftScroll);
1748 prefwin->rightScroll(m_rightScroll); 1748 prefwin->rightScroll(m_rightScroll);
1749 prefwin->upScroll(m_upScroll); 1749 prefwin->upScroll(m_upScroll);
1750 prefwin->downScroll(m_downScroll); 1750 prefwin->downScroll(m_downScroll);
1751 1751
1752 prefwin->miscannotation(m_doAnnotation); 1752 prefwin->miscannotation(m_doAnnotation);
1753 prefwin->miscdictionary(m_doDictionary); 1753 prefwin->miscdictionary(m_doDictionary);
1754 prefwin->miscclipboard(m_doClipboard); 1754 prefwin->miscclipboard(m_doClipboard);
1755 1755
1756 prefwin->SwapMouse(reader->m_swapmouse); 1756 prefwin->SwapMouse(reader->m_swapmouse);
1757 1757
1758 prefwin->Font(reader->m_fontname); 1758 prefwin->Font(reader->m_fontname);
1759 1759
1760 prefwin->gfxsize(reader->getBaseSize()); 1760 prefwin->gfxsize(reader->getBaseSize());
1761 1761
1762 prefwin->pageoverlap(reader->m_overlap); 1762 prefwin->pageoverlap(reader->m_overlap);
1763 1763
1764 prefwin->ideogram(reader->m_bMonoSpaced); 1764 prefwin->ideogram(reader->m_bMonoSpaced);
1765 1765
1766 prefwin->encoding(reader->m_encd); 1766 prefwin->encoding(reader->m_encd);
1767 1767
1768 prefwin->ideogramwidth(reader->m_charpc); 1768 prefwin->ideogramwidth(reader->m_charpc);
1769 1769
1770 if (prefwin->exec()) 1770 if (prefwin->exec())
1771 { 1771 {
1772 m_twoTouch = prefwin->twotouch(); 1772 m_twoTouch = prefwin->twotouch();
1773 reader->setTwoTouch(m_twoTouch); 1773 reader->setTwoTouch(m_twoTouch);
1774 m_touch_action->setOn(m_twoTouch); 1774 m_touch_action->setOn(m_twoTouch);
1775 1775
1776 reader->bstripcr = prefwin->StripCR(); 1776 reader->bstripcr = prefwin->StripCR();
1777 reader->bdehyphen = prefwin->Dehyphen(); 1777 reader->bdehyphen = prefwin->Dehyphen();
1778 reader->bonespace = prefwin->SingleSpace(); 1778 reader->bonespace = prefwin->SingleSpace();
1779 reader->bunindent = prefwin->Unindent(); 1779 reader->bunindent = prefwin->Unindent();
1780 reader->brepara = prefwin->Reparagraph(); 1780 reader->brepara = prefwin->Reparagraph();
1781 reader->bdblspce = prefwin->DoubleSpace(); 1781 reader->bdblspce = prefwin->DoubleSpace();
1782 reader->bremap = prefwin->Remap(); 1782 reader->bremap = prefwin->Remap();
1783 reader->bmakebold = prefwin->Embolden(); 1783 reader->bmakebold = prefwin->Embolden();
1784 reader->bfulljust = prefwin->FullJustify(); 1784 reader->bfulljust = prefwin->FullJustify();
1785 reader->setextraspace(prefwin->ParaLead()); 1785 reader->setextraspace(prefwin->ParaLead());
1786 reader->setlead(prefwin->LineLead()); 1786 reader->setlead(prefwin->LineLead());
1787 reader->m_border = prefwin->Margin(); 1787 reader->m_border = prefwin->Margin();
1788 reader->bindenter = prefwin->Indent(); 1788 reader->bindenter = prefwin->Indent();
1789 reader->bautofmt = reader->btextfmt = reader->bstriphtml = reader->bpeanut = false; 1789 reader->bautofmt = reader->btextfmt = reader->bstriphtml = reader->bpeanut = false;
1790 switch (prefwin->Markup()) 1790 switch (prefwin->Markup())
1791 { 1791 {
1792 case 0: 1792 case 0:
1793 reader->bautofmt = true; 1793 reader->bautofmt = true;
1794 break; 1794 break;
1795 case 1: 1795 case 1:
1796 break; 1796 break;
1797 case 2: 1797 case 2:
1798 reader->btextfmt = true; 1798 reader->btextfmt = true;
1799 break; 1799 break;
1800 case 3: 1800 case 3:
1801 reader->bstriphtml = true; 1801 reader->bstriphtml = true;
1802 break; 1802 break;
1803 case 4: 1803 case 4:
1804 reader->bpeanut = true; 1804 reader->bpeanut = true;
1805 break; 1805 break;
1806 default: 1806 default:
1807 qDebug("Format out of range"); 1807 qDebug("Format out of range");
1808 } 1808 }
1809 reader->bdepluck = prefwin->Depluck(); 1809 reader->bdepluck = prefwin->Depluck();
1810 reader->bdejpluck = prefwin->Dejpluck(); 1810 reader->bdejpluck = prefwin->Dejpluck();
1811 reader->setContinuous(prefwin->Continuous()); 1811 reader->setContinuous(prefwin->Continuous());
1812 1812
1813 m_spaceTarget = (ActionTypes)prefwin->spaceAction(); 1813 m_spaceTarget = (ActionTypes)prefwin->spaceAction();
1814 m_escapeTarget = (ActionTypes)prefwin->escapeAction(); 1814 m_escapeTarget = (ActionTypes)prefwin->escapeAction();
1815 m_returnTarget = (ActionTypes)prefwin->returnAction(); 1815 m_returnTarget = (ActionTypes)prefwin->returnAction();
1816 m_leftTarget = (ActionTypes)prefwin->leftAction(); 1816 m_leftTarget = (ActionTypes)prefwin->leftAction();
1817 m_rightTarget = (ActionTypes)prefwin->rightAction(); 1817 m_rightTarget = (ActionTypes)prefwin->rightAction();
1818 m_upTarget = (ActionTypes)prefwin->upAction(); 1818 m_upTarget = (ActionTypes)prefwin->upAction();
1819 m_downTarget = (ActionTypes)prefwin->downAction(); 1819 m_downTarget = (ActionTypes)prefwin->downAction();
1820 m_leftScroll = prefwin->leftScroll(); 1820 m_leftScroll = prefwin->leftScroll();
1821 m_rightScroll = prefwin->rightScroll(); 1821 m_rightScroll = prefwin->rightScroll();
1822 m_upScroll = prefwin->upScroll(); 1822 m_upScroll = prefwin->upScroll();
1823 m_downScroll = prefwin->downScroll(); 1823 m_downScroll = prefwin->downScroll();
1824 1824
1825 m_targetapp = prefwin->dictApplication(); 1825 m_targetapp = prefwin->dictApplication();
1826 m_targetmsg = prefwin->dictMessage(); 1826 m_targetmsg = prefwin->dictMessage();
1827 1827
1828 m_doAnnotation = prefwin->miscannotation(); 1828 m_doAnnotation = prefwin->miscannotation();
1829 m_doDictionary = prefwin->miscdictionary(); 1829 m_doDictionary = prefwin->miscdictionary();
1830 m_doClipboard = prefwin->miscclipboard(); 1830 m_doClipboard = prefwin->miscclipboard();
1831 reader->m_swapmouse = prefwin->SwapMouse(); 1831 reader->m_swapmouse = prefwin->SwapMouse();
1832 reader->setBaseSize(prefwin->gfxsize()); 1832 reader->setBaseSize(prefwin->gfxsize());
1833 reader->m_overlap = prefwin->pageoverlap(); 1833 reader->m_overlap = prefwin->pageoverlap();
1834 reader->m_bMonoSpaced = prefwin->ideogram(); 1834 reader->m_bMonoSpaced = prefwin->ideogram();
1835 m_setmono_action->setOn(reader->m_bMonoSpaced); 1835 m_setmono_action->setOn(reader->m_bMonoSpaced);
1836 reader->m_encd = prefwin->encoding(); 1836 reader->m_encd = prefwin->encoding();
1837 reader->m_charpc = prefwin->ideogramwidth(); 1837 reader->m_charpc = prefwin->ideogramwidth();
1838 1838
1839 if ( 1839 if (
1840 reader->m_fontname != prefwin->Font() 1840 reader->m_fontname != prefwin->Font()
1841 || 1841 ||
1842 m_propogatefontchange != prefwin->propfontchange()) 1842 m_propogatefontchange != prefwin->propfontchange())
1843 { 1843 {
1844 m_propogatefontchange = prefwin->propfontchange(); 1844 m_propogatefontchange = prefwin->propfontchange();
1845 setfontHelper(prefwin->Font()); 1845 setfontHelper(prefwin->Font());
1846 } 1846 }
1847 delete prefwin; 1847 delete prefwin;
1848 reader->setfilter(reader->getfilter()); 1848 reader->setfilter(reader->getfilter());
1849 reader->refresh(); 1849 reader->refresh();
1850 1850
1851 } 1851 }
1852 else 1852 else
1853 { 1853 {
1854 delete prefwin; 1854 delete prefwin;
1855 } 1855 }
1856} 1856}
1857 1857
1858void QTReaderApp::showtoolbarprefs() 1858void QTReaderApp::showtoolbarprefs()
1859{ 1859{
1860#ifdef USEQPE 1860#ifdef USEQPE
1861 CBarPrefs* prefwin = new CBarPrefs(APPDIR, !m_bFloatingDialog, this); 1861 CBarPrefs* prefwin = new CBarPrefs(APPDIR, !m_bFloatingDialog, this);
1862#else 1862#else
1863 QFileInfo fi; 1863 QFileInfo fi;
1864 QDir d = QDir::home(); // "/" 1864 QDir d = QDir::home(); // "/"
1865 if ( !d.cd(APPDIR) ) 1865 if ( !d.cd(APPDIR) )
1866 { // "/tmp" 1866 { // "/tmp"
1867 qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); 1867 qWarning( "Cannot find the \"~/%s\" directory", APPDIR );
1868 d = QDir::home(); 1868 d = QDir::home();
1869 d.mkdir(APPDIR); 1869 d.mkdir(APPDIR);
1870 d.cd(APPDIR); 1870 d.cd(APPDIR);
1871 } 1871 }
1872 fi.setFile(d, INIFILE); 1872 fi.setFile(d, INIFILE);
1873 CBarPrefs* prefwin = new CBarPrefs(fi.absFilePath(), !m_bFloatingDialog, this); 1873 CBarPrefs* prefwin = new CBarPrefs(fi.absFilePath(), !m_bFloatingDialog, this);
1874#endif 1874#endif
1875 prefwin->tbpolicy(m_tbpolsave); 1875 prefwin->tbpolicy(m_tbpolsave);
1876 prefwin->tbposition(m_tbposition-2); 1876 prefwin->tbposition(m_tbposition-2);
1877 prefwin->tbmovable(m_tbmovesave); 1877 prefwin->tbmovable(m_tbmovesave);
1878 prefwin->floating(m_bFloatingDialog); 1878 prefwin->floating(m_bFloatingDialog);
1879 if (prefwin->exec()) 1879 if (prefwin->exec())
1880 { 1880 {
1881 m_bFloatingDialog = prefwin->floating(); 1881 m_bFloatingDialog = prefwin->floating();
1882 if ( 1882 if (
1883 m_tbpolsave != (ToolbarPolicy)prefwin->tbpolicy() 1883 m_tbpolsave != (ToolbarPolicy)prefwin->tbpolicy()
1884 || 1884 ||
1885 m_tbposition != (ToolBarDock)(prefwin->tbposition()+2) 1885 m_tbposition != (ToolBarDock)(prefwin->tbposition()+2)
1886 || 1886 ||
1887 m_tbmovesave != prefwin->tbmovable() 1887 m_tbmovesave != prefwin->tbmovable()
1888 ) 1888 )
1889 { 1889 {
1890 QMessageBox::warning(this, PROGNAME, "Some changes won't take effect\nuntil the next time the\napplication is started"); 1890 QMessageBox::warning(this, PROGNAME, "Some changes won't take effect\nuntil the next time the\napplication is started");
1891 } 1891 }
1892 m_tbpolsave = (ToolbarPolicy)prefwin->tbpolicy(); 1892 m_tbpolsave = (ToolbarPolicy)prefwin->tbpolicy();
1893 m_tbposition = (ToolBarDock)(prefwin->tbposition()+2); 1893 m_tbposition = (ToolBarDock)(prefwin->tbposition()+2);
1894 m_tbmovesave = prefwin->tbmovable(); 1894 m_tbmovesave = prefwin->tbmovable();
1895 bool isChanged = prefwin->isChanged(); 1895 bool isChanged = prefwin->isChanged();
1896 delete prefwin; 1896 delete prefwin;
1897#ifdef USEQPE 1897#ifdef USEQPE
1898 Config config( APPDIR ); 1898 Config config( APPDIR );
1899#else 1899#else
1900 QFileInfo fi; 1900 QFileInfo fi;
1901 QDir d = QDir::home(); // "/" 1901 QDir d = QDir::home(); // "/"
1902 if ( !d.cd(APPDIR) ) 1902 if ( !d.cd(APPDIR) )
1903 { // "/tmp" 1903 { // "/tmp"
1904 qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); 1904 qWarning( "Cannot find the \"~/%s\" directory", APPDIR );
1905 d = QDir::home(); 1905 d = QDir::home();
1906 d.mkdir(APPDIR); 1906 d.mkdir(APPDIR);
1907 d.cd(APPDIR); 1907 d.cd(APPDIR);
1908 } 1908 }
1909 fi.setFile(d, INIFILE); 1909 fi.setFile(d, INIFILE);
1910 Config config( fi.absFilePath() ); 1910 Config config( fi.absFilePath() );
1911#endif 1911#endif
1912 if (isChanged) addtoolbars(&config); 1912 if (isChanged) addtoolbars(&config);
1913 } 1913 }
1914 else 1914 else
1915 { 1915 {
1916 delete prefwin; 1916 delete prefwin;
1917 } 1917 }
1918} 1918}
1919 1919
1920void QTReaderApp::showinfo() 1920void QTReaderApp::showinfo()
1921{ 1921{
1922 unsigned long fs, ts, pl; 1922 unsigned long fs, ts, pl;
1923 if (reader->empty()) 1923 if (reader->empty())
1924 { 1924 {
1925 QMessageBox::information(this, PROGNAME, "No file loaded", 1); 1925 QMessageBox::information(this, PROGNAME, "No file loaded", 1);
1926 } 1926 }
1927 else 1927 else
1928 { 1928 {
1929 reader->sizes(fs,ts); 1929 reader->sizes(fs,ts);
1930 pl = reader->pagelocate(); 1930 pl = reader->pagelocate();
1931 m_infoWin->setFileSize(fs); 1931 m_infoWin->setFileSize(fs);
1932 m_infoWin->setTextSize(ts); 1932 m_infoWin->setTextSize(ts);
1933 m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts); 1933 m_infoWin->setRatio(100-(100*fs + (ts >> 1))/ts);
1934 m_infoWin->setLocation(pl); 1934 m_infoWin->setLocation(pl);
1935 m_infoWin->setRead((100*pl + (ts >> 1))/ts); 1935 m_infoWin->setRead((100*pl + (ts >> 1))/ts);
1936 editorStack->raiseWidget( m_infoWin ); 1936 editorStack->raiseWidget( m_infoWin );
1937 m_infoWin->setFocus(); 1937 m_infoWin->setFocus();
1938 } 1938 }
1939} 1939}
1940 1940
1941void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn) 1941void QTReaderApp::addAnno(const QString& name, const QString& text, size_t posn)
1942{ 1942{
1943 if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>; 1943 if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>;
1944#ifdef _UNICODE 1944#ifdef _UNICODE
1945 CBuffer buff(name.length()+1); 1945 CBuffer buff(name.length()+1);
1946 int i; 1946 int i;
1947 for (i = 0; i < name.length(); i++) 1947 for (i = 0; i < name.length(); i++)
1948 { 1948 {
1949 buff[i] = name[i].unicode(); 1949 buff[i] = name[i].unicode();
1950 } 1950 }
1951 buff[i] = 0; 1951 buff[i] = 0;
1952 CBuffer buff2(text.length()+1); 1952 CBuffer buff2(text.length()+1);
1953 for (i = 0; i < text.length(); i++) 1953 for (i = 0; i < text.length(); i++)
1954 { 1954 {
1955 buff2[i] = text[i].unicode(); 1955 buff2[i] = text[i].unicode();
1956 } 1956 }
1957 buff2[i] = 0; 1957 buff2[i] = 0;
1958 pBkmklist->push_front(Bkmk(buff.data(), buff2.data(), posn)); 1958 pBkmklist->push_front(Bkmk(buff.data(), buff2.data(), posn));
1959#else 1959#else
1960 pBkmklist->push_front(Bkmk((const tchar*)text,posn)); 1960 pBkmklist->push_front(Bkmk((const tchar*)text,posn));
1961#endif 1961#endif
1962 m_fBkmksChanged = true; 1962 m_fBkmksChanged = true;
1963 pBkmklist->sort(); 1963 pBkmklist->sort();
1964} 1964}
1965 1965
1966void QTReaderApp::addAnno(const QString& name, const QString& text) 1966void QTReaderApp::addAnno(const QString& name, const QString& text)
1967{ 1967{
1968 if (m_annoIsEditing) 1968 if (m_annoIsEditing)
1969 { 1969 {
1970 if (name.isEmpty()) 1970 if (name.isEmpty())
1971 { 1971 {
1972 QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nPlease try again", 1); 1972 QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nPlease try again", 1);
1973 } 1973 }
1974 else 1974 else
1975 { 1975 {
1976 addAnno(name, text, m_annoWin->getPosn()); 1976 addAnno(name, text, m_annoWin->getPosn());
1977 } 1977 }
1978 showEditTools(); 1978 showEditTools();
1979 } 1979 }
1980 else 1980 else
1981 { 1981 {
1982 if (m_annoWin->edited()) 1982 if (m_annoWin->edited())
1983 { 1983 {
1984 CBuffer buff(text.length()+1); 1984 CBuffer buff(text.length()+1);
1985 int i; 1985 int i;
1986 for (i = 0; i < text.length(); i++) 1986 for (i = 0; i < text.length(); i++)
1987 { 1987 {
1988 buff[i] = text[i].unicode(); 1988 buff[i] = text[i].unicode();
1989 } 1989 }
1990 buff[i] = 0; 1990 buff[i] = 0;
1991 m_fBkmksChanged = true; 1991 m_fBkmksChanged = true;
1992 m_anno->setAnno(buff.data()); 1992 m_anno->setAnno(buff.data());
1993 } 1993 }
1994 bool found = findNextBookmark(m_anno->value()+1); 1994 bool found = findNextBookmark(m_anno->value()+1);
1995 if (found) 1995 if (found)
1996 { 1996 {
1997 m_annoWin->setName(toQString(m_anno->name())); 1997 m_annoWin->setName(toQString(m_anno->name()));
1998 m_annoWin->setAnno(toQString(m_anno->anno())); 1998 m_annoWin->setAnno(toQString(m_anno->anno()));
1999 } 1999 }
2000 else 2000 else
2001 { 2001 {
2002 showEditTools(); 2002 showEditTools();
2003 } 2003 }
2004 } 2004 }
2005} 2005}
2006 2006
2007bool QTReaderApp::findNextBookmark(size_t start) 2007bool QTReaderApp::findNextBookmark(size_t start)
2008{ 2008{
2009 bool found = false; 2009 bool found = false;
2010 for (CList<Bkmk>::iterator iter = pBkmklist->begin(); iter != pBkmklist->end(); iter++) 2010 for (CList<Bkmk>::iterator iter = pBkmklist->begin(); iter != pBkmklist->end(); iter++)
2011 { 2011 {
2012 if (iter->value() >= start) 2012 if (iter->value() >= start)
2013 { 2013 {
2014 if (iter->value() < reader->locate()) 2014 if (iter->value() < reader->locate())
2015 { 2015 {
2016 found = true; 2016 found = true;
2017 m_anno = iter.pContent(); 2017 m_anno = iter.pContent();
2018 } 2018 }
2019 break; 2019 break;
2020 } 2020 }
2021 } 2021 }
2022 return found; 2022 return found;
2023} 2023}
2024 2024
2025void QTReaderApp::addanno() 2025void QTReaderApp::addanno()
2026{ 2026{
2027 if (reader->empty()) 2027 if (reader->empty())
2028 { 2028 {
2029 QMessageBox::information(this, PROGNAME, "No file loaded", 1); 2029 QMessageBox::information(this, PROGNAME, "No file loaded", 1);
2030 } 2030 }
2031 else 2031 else
2032 { 2032 {
2033 m_annoWin->setName(""); 2033 m_annoWin->setName("");
2034 m_annoWin->setAnno(""); 2034 m_annoWin->setAnno("");
2035 m_annoWin->setPosn(reader->pagelocate()); 2035 m_annoWin->setPosn(reader->pagelocate());
2036 m_annoIsEditing = true; 2036 m_annoIsEditing = true;
2037 editorStack->raiseWidget( m_annoWin ); 2037 editorStack->raiseWidget( m_annoWin );
2038#ifdef USEQPE 2038#ifdef USEQPE
2039 Global::showInputMethod(); 2039 Global::showInputMethod();
2040#endif 2040#endif
2041 m_annoWin->setFocus(); 2041 m_annoWin->setFocus();
2042 } 2042 }
2043} 2043}
2044 2044
2045void QTReaderApp::infoClose() 2045void QTReaderApp::infoClose()
2046{ 2046{
2047 showEditTools(); 2047 showEditTools();
2048} 2048}
2049 2049
2050/* 2050/*
2051void QTReaderApp::fileRevert() 2051void QTReaderApp::fileRevert()
2052{ 2052{
2053 clear(); 2053 clear();
2054 fileOpen(); 2054 fileOpen();
2055} 2055}
2056 2056
2057void QTReaderApp::editCut() 2057void QTReaderApp::editCut()
2058{ 2058{
2059#ifndef QT_NO_CLIPBOARD 2059#ifndef QT_NO_CLIPBOARD
2060 editor->cut(); 2060 editor->cut();
2061#endif 2061#endif
2062} 2062}
2063*/ 2063*/
2064void QTReaderApp::editMark() 2064void QTReaderApp::editMark()
2065{ 2065{
2066 m_savedpos = reader->pagelocate(); 2066 m_savedpos = reader->pagelocate();
2067} 2067}
2068 2068
2069void QTReaderApp::editCopy() 2069void QTReaderApp::editCopy()
2070{ 2070{
2071 QClipboard* cb = QApplication::clipboard(); 2071 QClipboard* cb = QApplication::clipboard();
2072 QString text; 2072 QString text;
2073 int ch; 2073 int ch;
2074 unsigned long currentpos = reader->pagelocate(); 2074 unsigned long currentpos = reader->pagelocate();
2075 unsigned long endpos = reader->locate(); 2075 unsigned long endpos = reader->locate();
2076 if (m_savedpos == 0xffffffff) 2076 if (m_savedpos == 0xffffffff)
2077 { 2077 {
2078 m_savedpos = currentpos; 2078 m_savedpos = currentpos;
2079 } 2079 }
2080 reader->jumpto(m_savedpos); 2080 reader->jumpto(m_savedpos);
2081 while (reader->explocate() < endpos && (ch = reader->getch()) != UEOF) 2081 while (reader->explocate() < endpos && (ch = reader->getch()) != UEOF)
2082 { 2082 {
2083 text += ch; 2083 text += ch;
2084 } 2084 }
2085 cb->setText(text); 2085 cb->setText(text);
2086 reader->locate(currentpos); 2086 reader->locate(currentpos);
2087 m_savedpos = 0xffffffff; 2087 m_savedpos = 0xffffffff;
2088} 2088}
2089 2089
2090void QTReaderApp::gotoStart() 2090void QTReaderApp::gotoStart()
2091{ 2091{
2092 reader->locate(reader->buffdoc.startSection()); 2092 reader->locate(reader->buffdoc.startSection());
2093} 2093}
2094 2094
2095void QTReaderApp::gotoEnd() 2095void QTReaderApp::gotoEnd()
2096{ 2096{
2097 reader->dopageup(reader->buffdoc.endSection()); 2097 reader->dopageup(reader->buffdoc.endSection());
2098} 2098}
2099 2099
2100void QTReaderApp::pageup() 2100void QTReaderApp::pageup()
2101{ 2101{
2102 reader->NavUp(); 2102 reader->NavUp();
2103} 2103}
2104 2104
2105void QTReaderApp::pagedn() 2105void QTReaderApp::pagedn()
2106{ 2106{
2107 reader->NavDown(); 2107 reader->NavDown();
2108} 2108}
2109 2109
2110void QTReaderApp::pagemode(bool _b) 2110void QTReaderApp::pagemode(bool _b)
2111{ 2111{
2112 reader->setpagemode(_b); 2112 reader->setpagemode(_b);
2113} 2113}
2114 2114
2115/* 2115/*
2116void QTReaderApp::setspacing() 2116void QTReaderApp::setspacing()
2117{ 2117{
2118 m_nRegAction = cMonoSpace; 2118 m_nRegAction = cMonoSpace;
2119 char lcn[20]; 2119 char lcn[20];
2120 sprintf(lcn, "%lu", reader->m_charpc); 2120 sprintf(lcn, "%lu", reader->m_charpc);
2121 regEdit->setText(lcn); 2121 regEdit->setText(lcn);
2122 do_regedit(); 2122 do_regedit();
2123} 2123}
2124*/ 2124*/
2125void QTReaderApp::settarget() 2125void QTReaderApp::settarget()
2126{ 2126{
2127 m_nRegAction = cSetTarget; 2127 m_nRegAction = cSetTarget;
2128 QString text = ((m_targetapp.isEmpty()) ? QString("") : m_targetapp) 2128 QString text = ((m_targetapp.isEmpty()) ? QString("") : m_targetapp)
2129 + "/" 2129 + "/"
2130 + ((m_targetmsg.isEmpty()) ? QString("") : m_targetmsg); 2130 + ((m_targetmsg.isEmpty()) ? QString("") : m_targetmsg);
2131 regEdit->setText(text); 2131 regEdit->setText(text);
2132 do_regedit(); 2132 do_regedit();
2133} 2133}
2134 2134
2135/* 2135/*
2136void QTReaderApp::do_mono(const QString& lcn) 2136void QTReaderApp::do_mono(const QString& lcn)
2137{ 2137{
2138 bool ok; 2138 bool ok;
2139 unsigned long ulcn = lcn.toULong(&ok); 2139 unsigned long ulcn = lcn.toULong(&ok);
2140 if (ok) 2140 if (ok)
2141 { 2141 {
2142 reader->m_charpc = ulcn; 2142 reader->m_charpc = ulcn;
2143 reader->setfont(); 2143 reader->setfont();
2144 reader->refresh(); 2144 reader->refresh();
2145 //reader->setmono(true); 2145 //reader->setmono(true);
2146 } 2146 }
2147 else 2147 else
2148 QMessageBox::information(this, PROGNAME, "Must be a number"); 2148 QMessageBox::information(this, PROGNAME, "Must be a number");
2149} 2149}
2150*/ 2150*/
2151/* 2151/*
2152void QTReaderApp::editPaste() 2152void QTReaderApp::editPaste()
2153{ 2153{
2154#ifndef QT_NO_CLIPBOARD 2154#ifndef QT_NO_CLIPBOARD
2155 editor->paste(); 2155 editor->paste();
2156#endif 2156#endif
2157} 2157}
2158*/ 2158*/
2159 2159
2160void QTReaderApp::editFind() 2160void QTReaderApp::editFind()
2161{ 2161{
2162 searchStart = reader->pagelocate(); 2162 searchStart = reader->pagelocate();
2163#ifdef __ISEARCH 2163#ifdef __ISEARCH
2164 searchStack = new QStack<searchrecord>; 2164 searchStack = new QStack<searchrecord>;
2165#endif 2165#endif
2166#ifdef USEQPE 2166#ifdef USEQPE
2167 Global::showInputMethod(); 2167 Global::showInputMethod();
2168#endif 2168#endif
2169 searchBar->show(); 2169 searchBar->show();
2170 searchVisible = TRUE; 2170 searchVisible = TRUE;
2171 searchEdit->setFocus(); 2171 searchEdit->setFocus();
2172#ifdef __ISEARCH 2172#ifdef __ISEARCH
2173 searchStack->push(new searchrecord("",reader->pagelocate())); 2173 searchStack->push(new searchrecord("",reader->pagelocate()));
2174#endif 2174#endif
2175} 2175}
2176 2176
2177void QTReaderApp::findNext() 2177void QTReaderApp::findNext()
2178{ 2178{
2179// // qDebug("findNext called\n"); 2179// // qDebug("findNext called\n");
2180#ifdef __ISEARCH 2180#ifdef __ISEARCH
2181 QString arg = searchEdit->text(); 2181 QString arg = searchEdit->text();
2182#else 2182#else
2183 QRegExp arg = searchEdit->text(); 2183 QRegExp arg = searchEdit->text();
2184#endif 2184#endif
2185 CDrawBuffer test(&(reader->m_fontControl)); 2185 CDrawBuffer test(&(reader->m_fontControl));
2186 size_t start = reader->pagelocate(); 2186 size_t start = reader->pagelocate();
2187 reader->jumpto(start); 2187 reader->jumpto(start);
2188 reader->getline(&test); 2188 reader->getline(&test);
2189 dosearch(start, test, arg); 2189 dosearch(start, test, arg);
2190} 2190}
2191 2191
2192void QTReaderApp::findClose() 2192void QTReaderApp::findClose()
2193{ 2193{
2194 searchVisible = FALSE; 2194 searchVisible = FALSE;
2195 searchEdit->setText(""); 2195 searchEdit->setText("");
2196#ifdef USEQPE 2196#ifdef USEQPE
2197 Global::hideInputMethod(); 2197 Global::hideInputMethod();
2198#endif 2198#endif
2199 searchBar->hide(); 2199 searchBar->hide();
2200#ifdef __ISEARCH 2200#ifdef __ISEARCH
2201// searchStack = new QStack<searchrecord>; 2201// searchStack = new QStack<searchrecord>;
2202 while (!searchStack->isEmpty()) 2202 while (!searchStack->isEmpty())
2203 { 2203 {
2204 delete searchStack->pop(); 2204 delete searchStack->pop();
2205 } 2205 }
2206 delete searchStack; 2206 delete searchStack;
2207#endif 2207#endif
2208 reader->setFocus(); 2208 reader->setFocus();
2209} 2209}
2210 2210
2211void QTReaderApp::regClose() 2211void QTReaderApp::regClose()
2212{ 2212{
2213 regVisible = FALSE; 2213 regVisible = FALSE;
2214 regEdit->setText(""); 2214 regEdit->setText("");
2215 regBar->hide(); 2215 regBar->hide();
2216#ifdef USEQPE 2216#ifdef USEQPE
2217 Global::hideInputMethod(); 2217 Global::hideInputMethod();
2218#endif 2218#endif
2219 reader->setFocus(); 2219 reader->setFocus();
2220} 2220}
2221 2221
2222#ifdef __ISEARCH 2222#ifdef __ISEARCH
2223bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QString& arg) 2223bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QString& arg)
2224#else 2224#else
2225bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg) 2225bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg)
2226#endif 2226#endif
2227{ 2227{
2228 bool ret = true; 2228 bool ret = true;
2229 unsigned long fs, ts; 2229 unsigned long fs, ts;
2230 reader->sizes(fs,ts); 2230 reader->sizes(fs,ts);
2231 size_t pos = reader->locate(); 2231 size_t pos = reader->locate();
2232 pbar->setGeometry(searchBar->x(),searchBar->y(),searchBar->width(), searchBar->height()); 2232 pbar->setGeometry(searchBar->x(),searchBar->y(),searchBar->width(), searchBar->height());
2233 pbar->show(); 2233 pbar->show();
2234 pbar->raise(); 2234 pbar->raise();
2235 pbar->reset(); 2235 pbar->reset();
2236 int offset; 2236 int offset;
2237 int lastpc = (100*pos)/ts; 2237 int lastpc = (100*pos)/ts;
2238 pbar->setProgress(lastpc); 2238 pbar->setProgress(lastpc);
2239// qApp->processEvents(); 2239// qApp->processEvents();
2240 if (reader->buffdoc.getpara(test) >= 0) 2240 if (reader->buffdoc.getpara(test) >= 0)
2241 { 2241 {
2242 reader->setFocus(); 2242 reader->setFocus();
2243#ifdef __ISEARCH 2243#ifdef __ISEARCH
2244 while (strstr(test.data(),(const tchar*)arg) == NULL) 2244 while (strstr(test.data(),(const tchar*)arg) == NULL)
2245#else 2245#else
2246#ifdef _UNICODE 2246#ifdef _UNICODE
2247 while ((offset = arg.match(toQString(test.data()))) == -1) 2247 while ((offset = arg.match(toQString(test.data()))) == -1)
2248#else 2248#else
2249 while (arg.match(test.data()) == -1) 2249 while (arg.match(test.data()) == -1)
2250#endif 2250#endif
2251#endif 2251#endif
2252 { 2252 {
2253 pos = reader->locate(); 2253 pos = reader->locate();
2254 int pc = (100*pos)/ts; 2254 int pc = (100*pos)/ts;
2255 if (pc != lastpc) 2255 if (pc != lastpc)
2256 { 2256 {
2257 pbar->setProgress(pc); 2257 pbar->setProgress(pc);
2258 qApp->processEvents(); 2258 qApp->processEvents();
2259 reader->setFocus(); 2259 reader->setFocus();
2260 lastpc = pc; 2260 lastpc = pc;
2261 } 2261 }
2262 2262
2263 if (reader->buffdoc.getpara(test) < 0) 2263 if (reader->buffdoc.getpara(test) < 0)
2264 { 2264 {
2265 if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) 2265 if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2)
2266 pos = searchStart; 2266 pos = searchStart;
2267 else 2267 else
2268 pos = start; 2268 pos = start;
2269 findClose(); 2269 findClose();
2270 pbar->hide(); 2270 pbar->hide();
2271 reader->locate(pos); 2271 reader->locate(pos);
2272 return false; 2272 return false;
2273 } 2273 }
2274 } 2274 }
2275// qDebug("Found it at %u:%u", pos, offset); 2275// qDebug("Found it at %u:%u", pos, offset);
2276 pbar->hide(); 2276 pbar->hide();
2277// qDebug("Hid"); 2277// qDebug("Hid");
2278 reader->locate(pos+offset); 2278 reader->locate(pos+offset);
2279// qDebug("Loacted"); 2279// qDebug("Loacted");
2280// qDebug("page up"); 2280// qDebug("page up");
2281 ret = true; 2281 ret = true;
2282 } 2282 }
2283 else 2283 else
2284 { 2284 {
2285 if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2) 2285 if (QMessageBox::warning(this, "Can't find", searchEdit->text(), 1, 2) == 2)
2286 pos = searchStart; 2286 pos = searchStart;
2287 else 2287 else
2288 pos = start; 2288 pos = start;
2289 ret = false; 2289 ret = false;
2290 findClose(); 2290 findClose();
2291 } 2291 }
2292 return ret; 2292 return ret;
2293} 2293}
2294 2294
2295#ifdef __ISEARCH 2295#ifdef __ISEARCH
2296void QTReaderApp::search(const QString & arg) 2296void QTReaderApp::search(const QString & arg)
2297{ 2297{
2298 searchrecord* ss = searchStack->top(); 2298 searchrecord* ss = searchStack->top();
2299 CBuffer test; 2299 CBuffer test;
2300 size_t start = reader->pagelocate(); 2300 size_t start = reader->pagelocate();
2301 bool haspopped = false; 2301 bool haspopped = false;
2302 while (arg.left(ss->s.length()) != ss->s) 2302 while (arg.left(ss->s.length()) != ss->s)
2303 { 2303 {
2304 haspopped = true; 2304 haspopped = true;
2305 start = ss->pos; 2305 start = ss->pos;
2306// reader->locate(start); 2306// reader->locate(start);
2307 searchStack->pop(); 2307 searchStack->pop();
2308 delete ss; 2308 delete ss;
2309 } 2309 }
2310 if (haspopped) reader->locate(start); 2310 if (haspopped) reader->locate(start);
2311/* 2311/*
2312 if (arg.length() < ss->len) 2312 if (arg.length() < ss->len)
2313 { 2313 {
2314 start = ss->pos; 2314 start = ss->pos;
2315 reader->locate(start); 2315 reader->locate(start);
2316 searchStack->pop(); 2316 searchStack->pop();
2317 delete ss; 2317 delete ss;
2318 } 2318 }
2319*/ 2319*/
2320 else 2320 else
2321 { 2321 {
2322 start = reader->pagelocate(); 2322 start = reader->pagelocate();
2323 reader->jumpto(start); 2323 reader->jumpto(start);
2324 searchStack->push(new searchrecord(arg,start)); 2324 searchStack->push(new searchrecord(arg,start));
2325 } 2325 }
2326 dosearch(start, test, arg); 2326 dosearch(start, test, arg);
2327} 2327}
2328#else 2328#else
2329void QTReaderApp::search() 2329void QTReaderApp::search()
2330{ 2330{
2331 findNext(); 2331 findNext();
2332} 2332}
2333#endif 2333#endif
2334 2334
2335void QTReaderApp::openFile( const QString &f ) 2335void QTReaderApp::openFile( const QString &f )
2336{ 2336{
2337// qDebug("File:%s", (const char*)f); 2337// qDebug("File:%s", (const char*)f);
2338// openFile(DocLnk(f)); 2338// openFile(DocLnk(f));
2339//} 2339//}
2340// 2340//
2341//void QTReaderApp::openFile( const DocLnk &f ) 2341//void QTReaderApp::openFile( const DocLnk &f )
2342//{ 2342//{
2343 clear(); 2343 clear();
2344 QFileInfo fm(f); 2344 QFileInfo fm(f);
2345 if ( fm.exists() ) 2345 if ( fm.exists() )
2346 { 2346 {
2347// QMessageBox::information(0, "Progress", "Calling fileNew()"); 2347// QMessageBox::information(0, "Progress", "Calling fileNew()");
2348#ifdef USEQPE 2348#ifdef USEQPE
2349 if (fm.extension( FALSE ) == "desktop") 2349 if (fm.extension( FALSE ) == "desktop")
2350 { 2350 {
2351 DocLnk d(f); 2351 DocLnk d(f);
2352 QFileInfo fnew(d.file()); 2352 QFileInfo fnew(d.file());
2353 fm = fnew; 2353 fm = fnew;
2354 if (!fm.exists()) return; 2354 if (!fm.exists()) return;
2355 } 2355 }
2356#endif 2356#endif
2357 clear(); 2357 clear();
2358 2358
2359 reader->setText(fm.baseName(), fm.absFilePath()); 2359 reader->setText(fm.baseName(), fm.absFilePath());
2360 m_loadedconfig = readconfig(reader->m_string, false); 2360 m_loadedconfig = readconfig(reader->m_string, false);
2361 showEditTools(); 2361 showEditTools();
2362 readbkmks(); 2362 readbkmks();
2363 m_savedpos = 0xffffffff; 2363 m_savedpos = 0xffffffff;
2364 } 2364 }
2365 else 2365 else
2366 { 2366 {
2367 QMessageBox::information(this, PROGNAME, "File does not exist"); 2367 QMessageBox::information(this, PROGNAME, "File does not exist");
2368 reader->m_lastfile = QString::null; 2368 reader->m_lastfile = QString::null;
2369 } 2369 }
2370 2370
2371} 2371}
2372/* 2372/*
2373void QTReaderApp::resizeEvent(QResizeEvent* e) 2373void QTReaderApp::resizeEvent(QResizeEvent* e)
2374{ 2374{
2375 if (m_fullscreen) 2375 if (m_fullscreen)
2376 { 2376 {
2377 showNormal(); 2377 showNormal();
2378 showFullScreen(); 2378 showFullScreen();
2379 } 2379 }
2380} 2380}
2381*/ 2381*/
2382void QTReaderApp::handlekey(QKeyEvent* e) 2382void QTReaderApp::handlekey(QKeyEvent* e)
2383{ 2383{
2384// qDebug("Keypress event"); 2384// qDebug("Keypress event");
2385 timeb now; 2385 timeb now;
2386 ftime(&now); 2386 ftime(&now);
2387 unsigned long etime = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm; 2387 unsigned long etime = (1000*(now.time - m_lastkeytime.time) + now.millitm)-m_lastkeytime.millitm;
2388 if (etime < m_debounce) 2388 if (etime < m_debounce)
2389 { 2389 {
2390 return; 2390 return;
2391 } 2391 }
2392 m_lastkeytime = now; 2392 m_lastkeytime = now;
2393 switch(e->key()) 2393 switch(e->key())
2394 { 2394 {
2395 case Key_Escape: 2395 case Key_Escape:
2396 // qDebug("escape event"); 2396 // qDebug("escape event");
2397 if (m_disableesckey) 2397 if (m_disableesckey)
2398 { 2398 {
2399 m_disableesckey = false; 2399 m_disableesckey = false;
2400 } 2400 }
2401 else 2401 else
2402 { 2402 {
2403 m_bcloseDisabled = true; 2403 m_bcloseDisabled = true;
2404 if (m_fullscreen) 2404 if (m_fullscreen)
2405 { 2405 {
2406 m_actFullscreen->setOn(false); 2406 m_actFullscreen->setOn(false);
2407 e->accept(); 2407 e->accept();
2408 } 2408 }
2409 else 2409 else
2410 { 2410 {
2411 // qDebug("escape action"); 2411 // qDebug("escape action");
2412 doAction(m_escapeTarget, e); 2412 doAction(m_escapeTarget, e);
2413 } 2413 }
2414 } 2414 }
2415 break; 2415 break;
2416 case Key_Space: 2416 case Key_Space:
2417 { 2417 {
2418 doAction(m_spaceTarget, e); 2418 doAction(m_spaceTarget, e);
2419 } 2419 }
2420 break; 2420 break;
2421 case Key_Return: 2421 case Key_Return:
2422 { 2422 {
2423 doAction(m_returnTarget, e); 2423 doAction(m_returnTarget, e);
2424 } 2424 }
2425 break; 2425 break;
2426 case Key_Left: 2426 case Key_Left:
2427 { 2427 {
2428 if (reader->m_autoScroll && m_leftScroll) 2428 if (reader->m_autoScroll && m_leftScroll)
2429 { 2429 {
2430 reader->reduceScroll(); 2430 reader->reduceScroll();
2431 } 2431 }
2432 else 2432 else
2433 { 2433 {
2434 doAction(m_leftTarget, e); 2434 doAction(m_leftTarget, e);
2435 } 2435 }
2436 } 2436 }
2437 break; 2437 break;
2438 case Key_Right: 2438 case Key_Right:
2439 { 2439 {
2440 if (reader->m_autoScroll && m_rightScroll) 2440 if (reader->m_autoScroll && m_rightScroll)
2441 { 2441 {
2442 reader->increaseScroll(); 2442 reader->increaseScroll();
2443 } 2443 }
2444 else 2444 else
2445 { 2445 {
2446 doAction(m_rightTarget, e); 2446 doAction(m_rightTarget, e);
2447 } 2447 }
2448 } 2448 }
2449 break; 2449 break;
2450 case Key_Up: 2450 case Key_Up:
2451 { 2451 {
2452 if (reader->m_autoScroll && m_upScroll) 2452 if (reader->m_autoScroll && m_upScroll)
2453 { 2453 {
2454 reader->increaseScroll(); 2454 reader->increaseScroll();
2455 } 2455 }
2456 else 2456 else
2457 { 2457 {
2458 doAction(m_upTarget, e); 2458 doAction(m_upTarget, e);
2459 } 2459 }
2460 } 2460 }
2461 break; 2461 break;
2462 case Key_Down: 2462 case Key_Down:
2463 { 2463 {
2464 if (reader->m_autoScroll && m_downScroll) 2464 if (reader->m_autoScroll && m_downScroll)
2465 { 2465 {
2466 reader->reduceScroll(); 2466 reader->reduceScroll();
2467 } 2467 }
2468 else 2468 else
2469 { 2469 {
2470 doAction(m_downTarget, e); 2470 doAction(m_downTarget, e);
2471 } 2471 }
2472 } 2472 }
2473 break; 2473 break;
2474 default: 2474 default:
2475 { 2475 {
2476 e->ignore(); 2476 e->ignore();
2477 } 2477 }
2478 2478
2479/* 2479/*
2480 QString msg("Key press was:"); 2480 QString msg("Key press was:");
2481 QString key; 2481 QString key;
2482 msg += key.setNum(e->key()); 2482 msg += key.setNum(e->key());
2483 QMessageBox::information(this, PROGNAME, msg); 2483 QMessageBox::information(this, PROGNAME, msg);
2484*/ 2484*/
2485 } 2485 }
2486} 2486}
2487 2487
2488void QTReaderApp::showEditTools() 2488void QTReaderApp::showEditTools()
2489{ 2489{
2490// if ( !doc ) 2490// if ( !doc )
2491 //close(); 2491 //close();
2492 if (m_fullscreen) 2492 if (m_fullscreen)
2493 { 2493 {
2494 if (menubar != NULL) menubar->hide(); 2494 if (menubar != NULL) menubar->hide();
2495 if (fileBar != NULL) fileBar->hide(); 2495 if (fileBar != NULL) fileBar->hide();
2496 if (viewBar != NULL) viewBar->hide(); 2496 if (viewBar != NULL) viewBar->hide();
2497 if (navBar != NULL) navBar->hide(); 2497 if (navBar != NULL) navBar->hide();
2498 if (markBar != NULL) markBar->hide(); 2498 if (markBar != NULL) markBar->hide();
2499 searchBar->hide(); 2499 searchBar->hide();
2500 regBar->hide(); 2500 regBar->hide();
2501#ifdef USEQPE 2501#ifdef USEQPE
2502 Global::hideInputMethod(); 2502 Global::hideInputMethod();
2503#endif 2503#endif
2504 m_fontBar->hide(); 2504 m_fontBar->hide();
2505 //showNormal(); 2505 //showNormal();
2506 showFullScreen(); 2506 showFullScreen();
2507 } 2507 }
2508 else 2508 else
2509 { 2509 {
2510 //qDebug("him"); 2510 //qDebug("him");
2511#ifdef USEQPE 2511#ifdef USEQPE
2512 Global::hideInputMethod(); 2512 Global::hideInputMethod();
2513#endif 2513#endif
2514 //qDebug("eb"); 2514 //qDebug("eb");
2515 menubar->show(); 2515 menubar->show();
2516 if (fileBar != NULL) fileBar->show(); 2516 if (fileBar != NULL) fileBar->show();
2517 if (viewBar != NULL) viewBar->show(); 2517 if (viewBar != NULL) viewBar->show();
2518 if (navBar != NULL) navBar->show(); 2518 if (navBar != NULL) navBar->show();
2519 if (markBar != NULL) markBar->show(); 2519 if (markBar != NULL) markBar->show();
2520 mb->show(); 2520 mb->show();
2521 if ( searchVisible ) 2521 if ( searchVisible )
2522 { 2522 {
2523#ifdef USEQPE 2523#ifdef USEQPE
2524 Global::showInputMethod(); 2524 Global::showInputMethod();
2525#endif 2525#endif
2526 searchBar->show(); 2526 searchBar->show();
2527 } 2527 }
2528 if ( regVisible ) 2528 if ( regVisible )
2529 { 2529 {
2530#ifdef USEQPE 2530#ifdef USEQPE
2531 Global::showInputMethod(); 2531 Global::showInputMethod();
2532#endif 2532#endif
2533 regBar->show(); 2533 regBar->show();
2534 } 2534 }
2535 if (m_fontVisible) m_fontBar->show(); 2535 if (m_fontVisible) m_fontBar->show();
2536 //qDebug("sn"); 2536 //qDebug("sn");
2537 showNormal(); 2537 showNormal();
2538 //qDebug("sm"); 2538 //qDebug("sm");
2539#ifdef USEQPE 2539#ifdef USEQPE
2540 showMaximized(); 2540 showMaximized();
2541#endif 2541#endif
2542 //setCentralWidget(reader); 2542 //setCentralWidget(reader);
2543 } 2543 }
2544 2544
2545// qDebug("uc"); 2545// qDebug("uc");
2546 updateCaption(); 2546 updateCaption();
2547// qDebug("rw"); 2547// qDebug("rw");
2548 editorStack->raiseWidget( reader ); 2548 editorStack->raiseWidget( reader );
2549// qDebug("sf"); 2549// qDebug("sf");
2550 reader->setFocus(); 2550 reader->setFocus();
2551 reader->refresh(); 2551 reader->refresh();
2552} 2552}
2553/* 2553/*
2554void QTReaderApp::save() 2554void QTReaderApp::save()
2555{ 2555{
2556 if ( !doc ) 2556 if ( !doc )
2557 return; 2557 return;
2558 if ( !editor->edited() ) 2558 if ( !editor->edited() )
2559 return; 2559 return;
2560 2560
2561 QString rt = editor->text(); 2561 QString rt = editor->text();
2562 QString pt = rt; 2562 QString pt = rt;
2563 2563
2564 if ( doc->name().isEmpty() ) { 2564 if ( doc->name().isEmpty() ) {
2565 unsigned ispace = pt.find( ' ' ); 2565 unsigned ispace = pt.find( ' ' );
2566 unsigned ienter = pt.find( '\n' ); 2566 unsigned ienter = pt.find( '\n' );
2567 int i = (ispace < ienter) ? ispace : ienter; 2567 int i = (ispace < ienter) ? ispace : ienter;
2568 QString docname; 2568 QString docname;
2569 if ( i == -1 ) { 2569 if ( i == -1 ) {
2570 if ( pt.isEmpty() ) 2570 if ( pt.isEmpty() )
2571 docname = "Empty Text"; 2571 docname = "Empty Text";
2572 else 2572 else
2573 docname = pt; 2573 docname = pt;
2574 } else { 2574 } else {
2575 docname = pt.left( i ); 2575 docname = pt.left( i );
2576 } 2576 }
2577 doc->setName(docname); 2577 doc->setName(docname);
2578 } 2578 }
2579 FileManager fm; 2579 FileManager fm;
2580 fm.saveFile( *doc, rt ); 2580 fm.saveFile( *doc, rt );
2581} 2581}
2582*/ 2582*/
2583 2583
2584void QTReaderApp::clear() 2584void QTReaderApp::clear()
2585{ 2585{
2586// if (doc != 0) 2586// if (doc != 0)
2587// { 2587// {
2588// QMessageBox::information(this, PROGNAME, "Deleting doc", 1); 2588// QMessageBox::information(this, PROGNAME, "Deleting doc", 1);
2589 //delete doc; 2589 //delete doc;
2590// QMessageBox::information(this, PROGNAME, "Deleted doc", 1); 2590// QMessageBox::information(this, PROGNAME, "Deleted doc", 1);
2591 //doc = 0; 2591 //doc = 0;
2592 // } 2592 // }
2593 reader->clear(); 2593 reader->clear();
2594} 2594}
2595 2595
2596void QTReaderApp::updateCaption() 2596void QTReaderApp::updateCaption()
2597{ 2597{
2598// if ( !doc ) 2598// if ( !doc )
2599 //setCaption( tr("QTReader") ); 2599 //setCaption( tr("QTReader") );
2600// else { 2600// else {
2601 //QString s = doc->name(); 2601 //QString s = doc->name();
2602 //if ( s.isEmpty() ) 2602 //if ( s.isEmpty() )
2603 // s = tr( "Unnamed" ); 2603 // s = tr( "Unnamed" );
2604 setCaption( reader->m_string + " - " + tr("Reader") ); 2604 setCaption( reader->m_string + " - " + tr("Reader") );
2605// } 2605// }
2606} 2606}
2607 2607
2608void QTReaderApp::setDocument(const QString& fileref) 2608void QTReaderApp::setDocument(const QString& fileref)
2609{ 2609{
2610 bFromDocView = TRUE; 2610 bFromDocView = TRUE;
2611//QMessageBox::information(0, "setDocument", fileref); 2611//QMessageBox::information(0, "setDocument", fileref);
2612 openFile(fileref); 2612 openFile(fileref);
2613// showEditTools(); 2613// showEditTools();
2614} 2614}
2615 2615
2616void QTReaderApp::closeEvent( QCloseEvent *e ) 2616void QTReaderApp::closeEvent( QCloseEvent *e )
2617{ 2617{
2618// qDebug("Close event"); 2618// qDebug("Close event");
2619 if (m_fullscreen) 2619 if (m_fullscreen)
2620 { 2620 {
2621 m_fullscreen = false; 2621 m_fullscreen = false;
2622 showEditTools(); 2622 showEditTools();
2623 e->accept(); 2623 e->accept();
2624 } 2624 }
2625 else if (m_dontSave) 2625 else if (m_dontSave)
2626 { 2626 {
2627 e->accept(); 2627 e->accept();
2628 } 2628 }
2629 else 2629 else
2630 { 2630 {
2631 if (editorStack->visibleWidget() == reader) 2631 if (editorStack->visibleWidget() == reader)
2632 { 2632 {
2633 if ((m_escapeTarget != cesNone) && m_bcloseDisabled) 2633 if ((m_escapeTarget != cesNone) && m_bcloseDisabled)
2634 { 2634 {
2635 //qDebug("Close disabled"); 2635 //qDebug("Close disabled");
2636 m_bcloseDisabled = false; 2636 m_bcloseDisabled = false;
2637 e->ignore(); 2637 e->ignore();
2638 } 2638 }
2639 else 2639 else
2640 { 2640 {
2641 if (m_fontVisible) 2641 if (m_fontVisible)
2642 { 2642 {
2643 m_fontBar->hide(); 2643 m_fontBar->hide();
2644 m_fontVisible = false; 2644 m_fontVisible = false;
2645 } 2645 }
2646 if (regVisible) 2646 if (regVisible)
2647 { 2647 {
2648 regBar->hide(); 2648 regBar->hide();
2649#ifdef USEQPE 2649#ifdef USEQPE
2650 Global::hideInputMethod(); 2650 Global::hideInputMethod();
2651#endif 2651#endif
2652 regVisible = false; 2652 regVisible = false;
2653 return; 2653 return;
2654 } 2654 }
2655 if (searchVisible) 2655 if (searchVisible)
2656 { 2656 {
2657 searchBar->hide(); 2657 searchBar->hide();
2658#ifdef USEQPE 2658#ifdef USEQPE
2659 Global::hideInputMethod(); 2659 Global::hideInputMethod();
2660#endif 2660#endif
2661 searchVisible = false; 2661 searchVisible = false;
2662 return; 2662 return;
2663 } 2663 }
2664 if (m_fBkmksChanged && pBkmklist != NULL) 2664 if (m_fBkmksChanged && pBkmklist != NULL)
2665 { 2665 {
2666 if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) 2666 if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0)
2667 savebkmks(); 2667 savebkmks();
2668 delete pBkmklist; 2668 delete pBkmklist;
2669 pBkmklist = NULL; 2669 pBkmklist = NULL;
2670 m_fBkmksChanged = false; 2670 m_fBkmksChanged = false;
2671 } 2671 }
2672 bFromDocView = FALSE; 2672 bFromDocView = FALSE;
2673 updatefileinfo(); 2673 updatefileinfo();
2674 saveprefs(); 2674 saveprefs();
2675 e->accept(); 2675 e->accept();
2676 } 2676 }
2677 } 2677 }
2678 else 2678 else
2679 { 2679 {
2680 showEditTools(); 2680 showEditTools();
2681 m_disableesckey = true; 2681 m_disableesckey = true;
2682 } 2682 }
2683 } 2683 }
2684} 2684}
2685 2685
2686void QTReaderApp::do_gotomark() 2686void QTReaderApp::do_gotomark()
2687{ 2687{
2688 m_nBkmkAction = cGotoBkmk; 2688 m_nBkmkAction = cGotoBkmk;
2689 if (!listbkmk(pBkmklist)) 2689 if (!listbkmk(pBkmklist))
2690 QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); 2690 QMessageBox::information(this, PROGNAME, "No bookmarks in memory");
2691} 2691}
2692 2692
2693void QTReaderApp::do_delmark() 2693void QTReaderApp::do_delmark()
2694{ 2694{
2695 m_nBkmkAction = cDelBkmk; 2695 m_nBkmkAction = cDelBkmk;
2696 if (!listbkmk(pBkmklist)) 2696 if (!listbkmk(pBkmklist))
2697 QMessageBox::information(this, PROGNAME, "No bookmarks in memory"); 2697 QMessageBox::information(this, PROGNAME, "No bookmarks in memory");
2698} 2698}
2699 2699
2700bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab) 2700bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab)
2701{ 2701{
2702 bkmkselector->clear(); 2702 bkmkselector->clear();
2703 if (_lab.isEmpty()) 2703 if (_lab.isEmpty())
2704 bkmkselector->setText("Cancel"); 2704 bkmkselector->setText("Cancel");
2705 else 2705 else
2706 bkmkselector->setText(_lab); 2706 bkmkselector->setText(_lab);
2707 int cnt = 0; 2707 int cnt = 0;
2708 if (plist != NULL) 2708 if (plist != NULL)
2709 { 2709 {
2710 for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) 2710 for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++)
2711 { 2711 {
2712#ifdef _UNICODE 2712#ifdef _UNICODE
2713 // qDebug("Item:%s", (const char*)toQString(i->name())); 2713 // qDebug("Item:%s", (const char*)toQString(i->name()));
2714 bkmkselector->insertItem(toQString(i->name())); 2714 bkmkselector->insertItem(toQString(i->name()));
2715#else 2715#else
2716 bkmkselector->insertItem(i->name()); 2716 bkmkselector->insertItem(i->name());
2717#endif 2717#endif
2718 cnt++; 2718 cnt++;
2719 } 2719 }
2720 } 2720 }
2721 if (cnt > 0) 2721 if (cnt > 0)
2722 { 2722 {
2723 hidetoolbars(); 2723 hidetoolbars();
2724 editorStack->raiseWidget( bkmkselector ); 2724 editorStack->raiseWidget( bkmkselector );
2725 return true; 2725 return true;
2726 } 2726 }
2727 else 2727 else
2728 return false; 2728 return false;
2729} 2729}
2730 2730
2731void QTReaderApp::do_autogen() 2731void QTReaderApp::do_autogen()
2732{ 2732{
2733 m_nRegAction = cAutoGen; 2733 m_nRegAction = cAutoGen;
2734 regEdit->setText(m_autogenstr); 2734 regEdit->setText(m_autogenstr);
2735 do_regedit(); 2735 do_regedit();
2736} 2736}
2737 2737
2738void QTReaderApp::do_regedit() 2738void QTReaderApp::do_regedit()
2739{ 2739{
2740// fileBar->hide(); 2740// fileBar->hide();
2741 reader->bDoUpdates = false; 2741 reader->bDoUpdates = false;
2742// qDebug("Showing regbar"); 2742// qDebug("Showing regbar");
2743 regBar->show(); 2743 regBar->show();
2744// qDebug("Showing kbd"); 2744// qDebug("Showing kbd");
2745#ifdef USEQPE 2745#ifdef USEQPE
2746 Global::showInputMethod(); 2746 Global::showInputMethod();
2747#endif 2747#endif
2748 regVisible = true; 2748 regVisible = true;
2749 regEdit->setFocus(); 2749 regEdit->setFocus();
2750// qApp->processEvents(); 2750// qApp->processEvents();
2751 reader->bDoUpdates = true; 2751 reader->bDoUpdates = true;
2752 reader->update(); 2752 reader->update();
2753} 2753}
2754 2754
2755bool QTReaderApp::openfrombkmk(Bkmk* bk) 2755bool QTReaderApp::openfrombkmk(Bkmk* bk)
2756{ 2756{
2757 QString fn = toQString( 2757 QString fn = toQString(
2758 CFiledata(bk->anno()).name() 2758 CFiledata(bk->anno()).name()
2759 ); 2759 );
2760 //qDebug("fileinfo"); 2760 //qDebug("fileinfo");
2761 if (!fn.isEmpty() && QFileInfo(fn).isFile()) 2761 if (!fn.isEmpty() && QFileInfo(fn).isFile())
2762 { 2762 {
2763 //qDebug("Opening"); 2763 //qDebug("Opening");
2764 openFile(fn); 2764 openFile(fn);
2765 struct stat fnstat; 2765 struct stat fnstat;
2766 stat((const char *)reader->m_lastfile, &fnstat); 2766 stat((const char *)reader->m_lastfile, &fnstat);
2767 2767
2768 if (CFiledata(bk->anno()).date() 2768 if (CFiledata(bk->anno()).date()
2769 != fnstat.st_mtime) 2769 != fnstat.st_mtime)
2770 { 2770 {
2771 CFiledata fd(bk->anno()); 2771 CFiledata fd(bk->anno());
2772 fd.setdate(fnstat.st_mtime); 2772 fd.setdate(fnstat.st_mtime);
2773 bk->value(0); 2773 bk->value(0);
2774 } 2774 }
2775 else 2775 else
2776 { 2776 {
2777 unsigned short svlen = bk->filedatalen(); 2777 unsigned short svlen = bk->filedatalen();
2778 unsigned char* svdata = bk->filedata(); 2778 unsigned char* svdata = bk->filedata();
2779 reader->putSaveData(svdata, svlen); 2779 reader->putSaveData(svdata, svlen);
2780 // setstate(svdata, svlen); 2780 // setstate(svdata, svlen);
2781 if (svlen != 0) 2781 if (svlen != 0)
2782 { 2782 {
2783 QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?"); 2783 QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?");
2784 } 2784 }
2785 // qDebug("updating"); 2785 // qDebug("updating");
2786 // showEditTools(); 2786 // showEditTools();
2787 reader->locate(bk->value()); 2787 reader->locate(bk->value());
2788 } 2788 }
2789 return true; 2789 return true;
2790 } 2790 }
2791 else 2791 else
2792 { 2792 {
2793 return false; 2793 return false;
2794 } 2794 }
2795} 2795}
2796 2796
2797void QTReaderApp::gotobkmk(int ind) 2797void QTReaderApp::gotobkmk(int ind)
2798{ 2798{
2799 showEditTools(); 2799 showEditTools();
2800 switch (m_nBkmkAction) 2800 switch (m_nBkmkAction)
2801 { 2801 {
2802 case cOpenFile: 2802 case cOpenFile:
2803 { 2803 {
2804 // qApp->processEvents(); 2804 // qApp->processEvents();
2805 if (!openfrombkmk((*pOpenlist)[ind])) 2805 if (!openfrombkmk((*pOpenlist)[ind]))
2806 { 2806 {
2807 pOpenlist->erase(ind); 2807 pOpenlist->erase(ind);
2808 QMessageBox::information(this, PROGNAME, "Can't find file"); 2808 QMessageBox::information(this, PROGNAME, "Can't find file");
2809 } 2809 }
2810 } 2810 }
2811 break; 2811 break;
2812 case cGotoBkmk: 2812 case cGotoBkmk:
2813 reader->locate((*pBkmklist)[ind]->value()); 2813 reader->locate((*pBkmklist)[ind]->value());
2814 break; 2814 break;
2815 case cDelBkmk: 2815 case cDelBkmk:
2816 //// qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name()); 2816 //// qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name());
2817 pBkmklist->erase(ind); 2817 pBkmklist->erase(ind);
2818 m_fBkmksChanged = true; 2818 m_fBkmksChanged = true;
2819 // pBkmklist->sort(); 2819 // pBkmklist->sort();
2820 break; 2820 break;
2821 case cRmBkmkFile: 2821 case cRmBkmkFile:
2822 { 2822 {
2823#ifndef USEQPE 2823#ifndef USEQPE
2824 QDir d = QDir::home(); // "/" 2824 QDir d = QDir::home(); // "/"
2825 d.cd(APPDIR); 2825 d.cd(APPDIR);
2826 d.remove(bkmkselector->text(ind)); 2826 d.remove(bkmkselector->text(ind));
2827#else /* USEQPE */ 2827#else /* USEQPE */
2828 unlink((const char *)Global::applicationFileName(APPDIR,bkmkselector->text(ind))); 2828 unlink((const char *)Global::applicationFileName(APPDIR,bkmkselector->text(ind)));
2829#endif /* USEQPE */ 2829#endif /* USEQPE */
2830 } 2830 }
2831 break; 2831 break;
2832 case cLdConfig: 2832 case cLdConfig:
2833 readconfig(bkmkselector->text(ind), false); 2833 readconfig(bkmkselector->text(ind), false);
2834 break; 2834 break;
2835 case cRmConfig: 2835 case cRmConfig:
2836 { 2836 {
2837#ifndef USEQPE 2837#ifndef USEQPE
2838 QDir d = QDir::home(); // "/" 2838 QDir d = QDir::home(); // "/"
2839 d.cd(APPDIR "/configs"); 2839 d.cd(APPDIR "/configs");
2840 d.remove(bkmkselector->text(ind)); 2840 d.remove(bkmkselector->text(ind));
2841#else /* USEQPE */ 2841#else /* USEQPE */
2842 unlink((const char *)Global::applicationFileName(APPDIR "/configs",bkmkselector->text(ind))); 2842 unlink((const char *)Global::applicationFileName(APPDIR "/configs",bkmkselector->text(ind)));
2843#endif /* USEQPE */ 2843#endif /* USEQPE */
2844 } 2844 }
2845 break; 2845 break;
2846 case cExportLinks: 2846 case cExportLinks:
2847 { 2847 {
2848#ifndef USEQPE 2848#ifndef USEQPE
2849 QDir d = QDir::home(); // "/" 2849 QDir d = QDir::home(); // "/"
2850 d.cd(APPDIR "/urls"); 2850 d.cd(APPDIR "/urls");
2851 QFileInfo fi(d, bkmkselector->text(ind)); 2851 QFileInfo fi(d, bkmkselector->text(ind));
2852 if (fi.exists()) 2852 if (fi.exists())
2853 { 2853 {
2854 QString outfile( QFileDialog::getSaveFileName( QString::null, QString::null, this ) ); 2854 QString outfile( QFileDialog::getSaveFileName( QString::null, QString::null, this ) );
2855 if (!outfile.isEmpty()) 2855 if (!outfile.isEmpty())
2856 { 2856 {
2857 FILE* fout = fopen((const char *)outfile, "w"); 2857 FILE* fout = fopen((const char *)outfile, "w");
2858 if (fout != NULL) 2858 if (fout != NULL)
2859 { 2859 {
2860 FILE* fin = fopen((const char *)fi.absFilePath(), "r"); 2860 FILE* fin = fopen((const char *)fi.absFilePath(), "r");
2861 if (fin != NULL) 2861 if (fin != NULL)
2862 { 2862 {
2863 fprintf(fout, "<html><body>\n"); 2863 fprintf(fout, "<html><body>\n");
2864 int ch = 0; 2864 int ch = 0;
2865 while ((ch = fgetc(fin)) != EOF) 2865 while ((ch = fgetc(fin)) != EOF)
2866 { 2866 {
2867 fputc(ch, fout); 2867 fputc(ch, fout);
2868 } 2868 }
2869 fclose(fin); 2869 fclose(fin);
2870 fprintf(fout, "</html></body>\n"); 2870 fprintf(fout, "</html></body>\n");
2871 d.remove(bkmkselector->text(ind)); 2871 d.remove(bkmkselector->text(ind));
2872 } 2872 }
2873 fclose(fout); 2873 fclose(fout);
2874 } 2874 }
2875 else 2875 else
2876 QMessageBox::information(this, PROGNAME, "Couldn't open output"); 2876 QMessageBox::information(this, PROGNAME, "Couldn't open output");
2877 } 2877 }
2878 } 2878 }
2879#else /* USEQPE */ 2879#else /* USEQPE */
2880 FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); 2880 FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r");
2881 if (fin != NULL) 2881 if (fin != NULL)
2882 { 2882 {
2883 bool allok = false; 2883 bool allok = false;
2884 fileBrowser* fb = new fileBrowser(true, this,"OpieReader",!m_bFloatingDialog, 0, "*", QString::null); 2884 fileBrowser* fb = new fileBrowser(true, this,"OpieReader",!m_bFloatingDialog, 0, "*", QString::null);
2885 if (fb->exec()) 2885 if (fb->exec())
2886 { 2886 {
2887 QString outfile = fb->getCurrentFile(); 2887 QString outfile = fb->getCurrentFile();
2888 FILE* fout = fopen((const char *)outfile, "w"); 2888 FILE* fout = fopen((const char *)outfile, "w");
2889 if (fout != NULL) 2889 if (fout != NULL)
2890 { 2890 {
2891 fprintf(fout, "<html><body>\n"); 2891 fprintf(fout, "<html><body>\n");
2892 int ch = 0; 2892 int ch = 0;
2893 while ((ch = fgetc(fin)) != EOF) 2893 while ((ch = fgetc(fin)) != EOF)
2894 { 2894 {
2895 fputc(ch, fout); 2895 fputc(ch, fout);
2896 } 2896 }
2897 fprintf(fout, "</html></body>\n"); 2897 fprintf(fout, "</html></body>\n");
2898 fclose(fout); 2898 fclose(fout);
2899 allok = true; 2899 allok = true;
2900 } 2900 }
2901 else 2901 else
2902 QMessageBox::information(this, PROGNAME, "Couldn't open output"); 2902 QMessageBox::information(this, PROGNAME, "Couldn't open output");
2903 } 2903 }
2904 delete fb; 2904 delete fb;
2905 fclose(fin); 2905 fclose(fin);
2906 if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind))); 2906 if (allok) unlink((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)));
2907 } 2907 }
2908 else 2908 else
2909 { 2909 {
2910 QMessageBox::information(this, PROGNAME, "Couldn't open input"); 2910 QMessageBox::information(this, PROGNAME, "Couldn't open input");
2911 } 2911 }
2912 2912
2913/* 2913/*
2914 CFileSelector *f = new CFileSelector("text/html", this, NULL, !m_bFloatingDialog, TRUE, TRUE ); 2914 CFileSelector *f = new CFileSelector("text/html", this, NULL, !m_bFloatingDialog, TRUE, TRUE );
2915 int ret = f->exec(); 2915 int ret = f->exec();
2916 qDebug("Return:%d", ret); 2916 qDebug("Return:%d", ret);
2917 DocLnk* doc = f->getDoc(); 2917 DocLnk* doc = f->getDoc();
2918 if (doc != NULL) 2918 if (doc != NULL)
2919 { 2919 {
2920 FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r"); 2920 FILE* fin = fopen((const char *)Global::applicationFileName(APPDIR "/urls",bkmkselector->text(ind)), "r");
2921 QString rt; 2921 QString rt;
2922 rt = "<html><body>\n"; 2922 rt = "<html><body>\n";
2923 int ch = 0; 2923 int ch = 0;
2924 while ((ch = fgetc(fin)) != EOF) 2924 while ((ch = fgetc(fin)) != EOF)
2925 { 2925 {
2926 rt += (char)ch; 2926 rt += (char)ch;
2927 } 2927 }
2928 fclose(fin); 2928 fclose(fin);
2929 rt += "</html></body>\n"; 2929 rt += "</html></body>\n";
2930 if ( doc->name().isEmpty() ) 2930 if ( doc->name().isEmpty() )
2931 { 2931 {
2932 doc->setName(bkmkselector->text(ind)); 2932 doc->setName(bkmkselector->text(ind));
2933 } 2933 }
2934 FileManager fm; 2934 FileManager fm;
2935 fm.saveFile( *doc, rt ); 2935 fm.saveFile( *doc, rt );
2936 qDebug("YES"); 2936 qDebug("YES");
2937 } 2937 }
2938 else 2938 else
2939 { 2939 {
2940 qDebug("NO"); 2940 qDebug("NO");
2941 } 2941 }
2942 delete f; 2942 delete f;
2943*/ 2943*/
2944 2944
2945#endif /* USEQPE */ 2945#endif /* USEQPE */
2946 } 2946 }
2947 break; 2947 break;
2948 } 2948 }
2949} 2949}
2950 2950
2951void QTReaderApp::cancelbkmk() 2951void QTReaderApp::cancelbkmk()
2952{ 2952{
2953 if (m_nBkmkAction == cOpenFile) 2953 if (m_nBkmkAction == cOpenFile)
2954 { 2954 {
2955 QString fn = usefilebrowser(); 2955 QString fn = usefilebrowser();
2956 if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn); 2956 if (!fn.isEmpty() && QFileInfo(fn).isFile()) openFile(fn);
2957 } 2957 }
2958 showEditTools(); 2958 showEditTools();
2959} 2959}
2960 2960
2961void QTReaderApp::jump() 2961void QTReaderApp::jump()
2962{ 2962{
2963 m_nRegAction = cJump; 2963 m_nRegAction = cJump;
2964 char lcn[20]; 2964 char lcn[20];
2965 sprintf(lcn, "%lu", reader->pagelocate()); 2965 sprintf(lcn, "%lu", reader->pagelocate());
2966 regEdit->setText(lcn); 2966 regEdit->setText(lcn);
2967 do_regedit(); 2967 do_regedit();
2968} 2968}
2969 2969
2970void QTReaderApp::do_jump(const QString& lcn) 2970void QTReaderApp::do_jump(const QString& lcn)
2971{ 2971{
2972 bool ok; 2972 bool ok;
2973 unsigned long ulcn = lcn.toULong(&ok); 2973 unsigned long ulcn = lcn.toULong(&ok);
2974 if (ok) 2974 if (ok)
2975 reader->locate(ulcn); 2975 reader->locate(ulcn);
2976 else 2976 else
2977 QMessageBox::information(this, PROGNAME, "Must be a number"); 2977 QMessageBox::information(this, PROGNAME, "Must be a number");
2978} 2978}
2979 2979
2980void QTReaderApp::do_regaction() 2980void QTReaderApp::do_regaction()
2981{ 2981{
2982 reader->bDoUpdates = false; 2982 reader->bDoUpdates = false;
2983 regBar->hide(); 2983 regBar->hide();
2984#ifdef USEQPE 2984#ifdef USEQPE
2985 Global::hideInputMethod(); 2985 Global::hideInputMethod();
2986#endif 2986#endif
2987 regVisible = false; 2987 regVisible = false;
2988 switch(m_nRegAction) 2988 switch(m_nRegAction)
2989 { 2989 {
2990 case cAutoGen: 2990 case cAutoGen:
2991 do_autogen(regEdit->text()); 2991 do_autogen(regEdit->text());
2992 break; 2992 break;
2993 case cAddBkmk: 2993 case cAddBkmk:
2994 do_addbkmk(regEdit->text()); 2994 do_addbkmk(regEdit->text());
2995 break; 2995 break;
2996 case cJump: 2996 case cJump:
2997 do_jump(regEdit->text()); 2997 do_jump(regEdit->text());
2998 break; 2998 break;
2999/* 2999/*
3000 case cMonoSpace: 3000 case cMonoSpace:
3001 do_mono(regEdit->text()); 3001 do_mono(regEdit->text());
3002 break; 3002 break;
3003*/ 3003*/
3004 case cSetTarget: 3004 case cSetTarget:
3005 do_settarget(regEdit->text()); 3005 do_settarget(regEdit->text());
3006 break; 3006 break;
3007#ifdef _SCROLLPIPE 3007#ifdef _SCROLLPIPE
3008 case cSetPipeTarget: 3008 case cSetPipeTarget:
3009 do_setpipetarget(regEdit->text()); 3009 do_setpipetarget(regEdit->text());
3010 break; 3010 break;
3011#endif 3011#endif
3012 case cSetConfigName: 3012 case cSetConfigName:
3013 // qDebug("Saving config"); 3013 // qDebug("Saving config");
3014 do_saveconfig(regEdit->text(), false); 3014 do_saveconfig(regEdit->text(), false);
3015 break; 3015 break;
3016 } 3016 }
3017// reader->restore(); 3017// reader->restore();
3018// fileBar->show(); 3018// fileBar->show();
3019 reader->setFocus(); 3019 reader->setFocus();
3020// qApp->processEvents(); 3020// qApp->processEvents();
3021 reader->bDoUpdates = true; 3021 reader->bDoUpdates = true;
3022 reader->update(); 3022 reader->update();
3023} 3023}
3024 3024
3025void QTReaderApp::do_settarget(const QString& _txt) 3025void QTReaderApp::do_settarget(const QString& _txt)
3026{ 3026{
3027 int ind = _txt.find('/'); 3027 int ind = _txt.find('/');
3028 if (ind == -1) 3028 if (ind == -1)
3029 { 3029 {
3030 m_targetapp = ""; 3030 m_targetapp = "";
3031 m_targetmsg = ""; 3031 m_targetmsg = "";
3032 QMessageBox::information(this, PROGNAME, "Format is\nappname/messagename"); 3032 QMessageBox::information(this, PROGNAME, "Format is\nappname/messagename");
3033 } 3033 }
3034 else 3034 else
3035 { 3035 {
3036 m_targetapp = _txt.left(ind); 3036 m_targetapp = _txt.left(ind);
3037 m_targetmsg = _txt.right(_txt.length()-ind-1); 3037 m_targetmsg = _txt.right(_txt.length()-ind-1);
3038 } 3038 }
3039} 3039}
3040 3040
3041void QTReaderApp::chooseencoding() 3041void QTReaderApp::chooseencoding()
3042{ 3042{
3043 m_fontSelector->clear(); 3043 m_fontSelector->clear();
3044 m_fontSelector->insertItem("Ascii"); 3044 m_fontSelector->insertItem("Ascii");
3045 m_fontSelector->insertItem("UTF-8"); 3045 m_fontSelector->insertItem("UTF-8");
3046 m_fontSelector->insertItem("UCS-2(BE)"); 3046 m_fontSelector->insertItem("UCS-2(BE)");
3047 m_fontSelector->insertItem("USC-2(LE)"); 3047 m_fontSelector->insertItem("USC-2(LE)");
3048 m_fontSelector->insertItem("Palm"); 3048 m_fontSelector->insertItem("Palm");
3049 for (unicodetable::iterator iter = unicodetable::begin(); iter != unicodetable::end(); iter++) 3049 for (unicodetable::iterator iter = unicodetable::begin(); iter != unicodetable::end(); iter++)
3050 { 3050 {
3051 m_fontSelector->insertItem(iter->mime); 3051 m_fontSelector->insertItem(iter->mime);
3052 } // delete the FontDatabase!!! 3052 } // delete the FontDatabase!!!
3053 m_fontSelector->setCurrentItem (reader->m_encd); 3053 m_fontSelector->setCurrentItem (reader->m_encd);
3054 m_fontAction = cChooseEncoding; 3054 m_fontAction = cChooseEncoding;
3055 m_fontBar->show(); 3055 m_fontBar->show();
3056 m_fontVisible = true; 3056 m_fontVisible = true;
3057} 3057}
3058 3058
3059void QTReaderApp::setfont() 3059void QTReaderApp::setfont()
3060{ 3060{
3061 m_fontSelector->clear(); 3061 m_fontSelector->clear();
3062 { 3062 {
3063#ifdef USEQPE 3063#ifdef USEQPE
3064 FontDatabase f; 3064 FontDatabase f;
3065#else 3065#else
3066 QFontDatabase f; 3066 QFontDatabase f;
3067#endif 3067#endif
3068 QStringList flist = f.families(); 3068 QStringList flist = f.families();
3069 m_fontSelector->insertStringList(flist); 3069 m_fontSelector->insertStringList(flist);
3070 } // delete the FontDatabase!!! 3070 } // delete the FontDatabase!!!
3071 3071
3072 for (int i = 1; i <= m_fontSelector->count(); i++) 3072 for (int i = 1; i <= m_fontSelector->count(); i++)
3073 { 3073 {
3074 if (m_fontSelector->text(i) == reader->m_fontname) 3074 if (m_fontSelector->text(i) == reader->m_fontname)
3075 { 3075 {
3076 m_fontSelector->setCurrentItem(i); 3076 m_fontSelector->setCurrentItem(i);
3077 break; 3077 break;
3078 } 3078 }
3079 } 3079 }
3080 m_fontAction = cChooseFont; 3080 m_fontAction = cChooseFont;
3081 m_fontBar->show(); 3081 m_fontBar->show();
3082 m_fontVisible = true; 3082 m_fontVisible = true;
3083} 3083}
3084 3084
3085void QTReaderApp::setfontHelper(const QString& lcn, int size) 3085void QTReaderApp::setfontHelper(const QString& lcn, int size)
3086{ 3086{
3087 if (size == 0) size = reader->m_fontControl.currentsize(); 3087 if (size == 0) size = reader->m_fontControl.currentsize();
3088 if (m_propogatefontchange) 3088 if (m_propogatefontchange)
3089 { 3089 {
3090 QFont f(lcn, 10); 3090 QFont f(lcn, 10);
3091 bkmkselector->setFont( f ); 3091 bkmkselector->setFont( f );
3092 regEdit->setFont( f ); 3092 regEdit->setFont( f );
3093 searchEdit->setFont( f ); 3093 searchEdit->setFont( f );
3094 m_annoWin->setFont( f ); 3094 m_annoWin->setFont( f );
3095 } 3095 }
3096 reader->m_fontname = lcn; 3096 reader->m_fontname = lcn;
3097 if (!reader->ChangeFont(size)) 3097 if (!reader->ChangeFont(size))
3098 { 3098 {
3099 reader->ChangeFont(size); 3099 reader->ChangeFont(size);
3100 } 3100 }
3101} 3101}
3102 3102
3103void QTReaderApp::do_setencoding(int i) 3103void QTReaderApp::do_setencoding(int i)
3104{ 3104{
3105// qDebug("setencoding:%d", i); 3105// qDebug("setencoding:%d", i);
3106 if (m_fontAction == cChooseEncoding) 3106 if (m_fontAction == cChooseEncoding)
3107 { 3107 {
3108 reader->setencoding(i); 3108 reader->setencoding(i);
3109 } 3109 }
3110 reader->refresh(); 3110 reader->refresh();
3111 m_fontBar->hide(); 3111 m_fontBar->hide();
3112 m_fontVisible = false; 3112 m_fontVisible = false;
3113// qDebug("showedit"); 3113// qDebug("showedit");
3114 if (reader->isVisible()) showEditTools(); 3114 if (reader->isVisible()) showEditTools();
3115// qDebug("showeditdone"); 3115// qDebug("showeditdone");
3116} 3116}
3117 3117
3118void QTReaderApp::do_setfont(const QString& lcn) 3118void QTReaderApp::do_setfont(const QString& lcn)
3119{ 3119{
3120 if (m_fontAction == cChooseFont) 3120 if (m_fontAction == cChooseFont)
3121 { 3121 {
3122 setfontHelper(lcn); 3122 setfontHelper(lcn);
3123 } 3123 }
3124 reader->refresh(); 3124 reader->refresh();
3125 m_fontBar->hide(); 3125 m_fontBar->hide();
3126 m_fontVisible = false; 3126 m_fontVisible = false;
3127// qDebug("showedit"); 3127// qDebug("showedit");
3128 //if (reader->isVisible()) 3128 //if (reader->isVisible())
3129 showEditTools(); 3129 showEditTools();
3130// qDebug("showeditdone"); 3130// qDebug("showeditdone");
3131} 3131}
3132 3132
3133void QTReaderApp::do_autogen(const QString& regText) 3133void QTReaderApp::do_autogen(const QString& regText)
3134{ 3134{
3135 unsigned long fs, ts; 3135 unsigned long fs, ts;
3136 reader->sizes(fs,ts); 3136 reader->sizes(fs,ts);
3137// // qDebug("Reg:%s\n", (const tchar*)(regEdit->text())); 3137// // qDebug("Reg:%s\n", (const tchar*)(regEdit->text()));
3138 m_autogenstr = regText; 3138 m_autogenstr = regText;
3139 QRegExp re(regText); 3139 QRegExp re(regText);
3140 CBuffer buff; 3140 CBuffer buff;
3141 if (pBkmklist != NULL) delete pBkmklist; 3141 if (pBkmklist != NULL) delete pBkmklist;
3142 pBkmklist = new CList<Bkmk>; 3142 pBkmklist = new CList<Bkmk>;
3143 m_fBkmksChanged = true; 3143 m_fBkmksChanged = true;
3144 3144
3145 pbar->setGeometry(regBar->x(),regBar->y(),regBar->width(), regBar->height()); 3145 pbar->setGeometry(regBar->x(),regBar->y(),regBar->width(), regBar->height());
3146 pbar->show(); 3146 pbar->show();
3147 pbar->raise(); 3147 pbar->raise();
3148 pbar->reset(); 3148 pbar->reset();
3149 reader->update(); 3149 reader->update();
3150 qApp->processEvents(); 3150 qApp->processEvents();
3151 reader->setFocus(); 3151 reader->setFocus();
3152 reader->jumpto(0); 3152 reader->jumpto(0);
3153 int lastpc = 0; 3153 int lastpc = 0;
3154 int i = 0; 3154 int i = 0;
3155 while (i >= 0) 3155 while (i >= 0)
3156 { 3156 {
3157 unsigned int lcn = reader->locate(); 3157 unsigned int lcn = reader->locate();
3158 int pc = (100*lcn)/ts; 3158 int pc = (100*lcn)/ts;
3159 if (pc != lastpc) 3159 if (pc != lastpc)
3160 { 3160 {
3161 pbar->setProgress(pc); 3161 pbar->setProgress(pc);
3162 qApp->processEvents(); 3162 qApp->processEvents();
3163 if (reader->locate() != lcn) reader->jumpto(lcn); 3163 if (reader->locate() != lcn) reader->jumpto(lcn);
3164 reader->setFocus(); 3164 reader->setFocus();
3165 lastpc = pc; 3165 lastpc = pc;
3166 } 3166 }
3167 i = reader->buffdoc.getpara(buff); 3167 i = reader->buffdoc.getpara(buff);
3168#ifdef _UNICODE 3168#ifdef _UNICODE
3169 if (re.match(toQString(buff.data())) != -1) 3169 if (re.match(toQString(buff.data())) != -1)
3170#else 3170#else
3171 if (re.match(buff.data()) != -1) 3171 if (re.match(buff.data()) != -1)
3172#endif 3172#endif
3173 pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); 3173 pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn));
3174 } 3174 }
3175 pBkmklist->sort(); 3175 pBkmklist->sort();
3176 pbar->setProgress(100); 3176 pbar->setProgress(100);
3177 qApp->processEvents(); 3177 qApp->processEvents();
3178 pbar->hide(); 3178 pbar->hide();
3179 reader->refresh(); 3179 reader->refresh();
3180} 3180}
3181 3181
3182void QTReaderApp::saveprefs() 3182void QTReaderApp::saveprefs()
3183{ 3183{
3184// qDebug("saveprefs"); 3184// qDebug("saveprefs");
3185// reader->saveprefs("uqtreader"); 3185// reader->saveprefs("uqtreader");
3186// if (!m_loadedconfig) 3186// if (!m_loadedconfig)
3187 do_saveconfig( APPDIR, true ); 3187 do_saveconfig( APPDIR, true );
3188 3188
3189/* 3189/*
3190 Config config( APPDIR ); 3190 Config config( APPDIR );
3191 config.setGroup( "View" ); 3191 config.setGroup( "View" );
3192 3192
3193 reader->m_lastposn = reader->pagelocate(); 3193 reader->m_lastposn = reader->pagelocate();
3194 3194
3195 config.writeEntry("FloatDialogs", m_bFloatingDialog); 3195 config.writeEntry("FloatDialogs", m_bFloatingDialog);
3196 config.writeEntry( "StripCr", reader->bstripcr ); 3196 config.writeEntry( "StripCr", reader->bstripcr );
3197 config.writeEntry( "AutoFmt", reader->bautofmt ); 3197 config.writeEntry( "AutoFmt", reader->bautofmt );
3198 config.writeEntry( "TextFmt", reader->btextfmt ); 3198 config.writeEntry( "TextFmt", reader->btextfmt );
3199 config.writeEntry( "StripHtml", reader->bstriphtml ); 3199 config.writeEntry( "StripHtml", reader->bstriphtml );
3200 config.writeEntry( "Dehyphen", reader->bdehyphen ); 3200 config.writeEntry( "Dehyphen", reader->bdehyphen );
3201 config.writeEntry( "Depluck", reader->bdepluck ); 3201 config.writeEntry( "Depluck", reader->bdepluck );
3202 config.writeEntry( "Dejpluck", reader->bdejpluck ); 3202 config.writeEntry( "Dejpluck", reader->bdejpluck );
3203 config.writeEntry( "OneSpace", reader->bonespace ); 3203 config.writeEntry( "OneSpace", reader->bonespace );
3204 config.writeEntry( "Unindent", reader->bunindent ); 3204 config.writeEntry( "Unindent", reader->bunindent );
3205 config.writeEntry( "Repara", reader->brepara ); 3205 config.writeEntry( "Repara", reader->brepara );
3206 config.writeEntry( "DoubleSpace", reader->bdblspce ); 3206 config.writeEntry( "DoubleSpace", reader->bdblspce );
3207 config.writeEntry( "Indent", reader->bindenter ); 3207 config.writeEntry( "Indent", reader->bindenter );
3208 config.writeEntry( "FontSize", (int)(reader->m_fontControl.currentsize()) ); 3208 config.writeEntry( "FontSize", (int)(reader->m_fontControl.currentsize()) );
3209 config.writeEntry( "ScrollDelay", reader->m_delay); 3209 config.writeEntry( "ScrollDelay", reader->m_delay);
3210 config.writeEntry( "LastFile", reader->m_lastfile ); 3210 config.writeEntry( "LastFile", reader->m_lastfile );
3211 config.writeEntry( "LastPosn", (int)(reader->pagelocate()) ); 3211 config.writeEntry( "LastPosn", (int)(reader->pagelocate()) );
3212 config.writeEntry( "PageMode", reader->m_bpagemode ); 3212 config.writeEntry( "PageMode", reader->m_bpagemode );
3213 config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced ); 3213 config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced );
3214 config.writeEntry( "SwapMouse", reader->m_swapmouse); 3214 config.writeEntry( "SwapMouse", reader->m_swapmouse);
3215 config.writeEntry( "Fontname", reader->m_fontname ); 3215 config.writeEntry( "Fontname", reader->m_fontname );
3216 config.writeEntry( "Encoding", reader->m_encd ); 3216 config.writeEntry( "Encoding", reader->m_encd );
3217 config.writeEntry( "CharSpacing", reader->m_charpc ); 3217 config.writeEntry( "CharSpacing", reader->m_charpc );
3218 config.writeEntry( "Overlap", (int)(reader->m_overlap) ); 3218 config.writeEntry( "Overlap", (int)(reader->m_overlap) );
3219 config.writeEntry( "Margin", (int)reader->m_border ); 3219 config.writeEntry( "Margin", (int)reader->m_border );
3220 config.writeEntry( "TargetApp", m_targetapp ); 3220 config.writeEntry( "TargetApp", m_targetapp );
3221 config.writeEntry( "TargetMsg", m_targetmsg ); 3221 config.writeEntry( "TargetMsg", m_targetmsg );
3222#ifdef _SCROLLPIPE 3222#ifdef _SCROLLPIPE
3223 config.writeEntry( "PipeTarget", reader->m_pipetarget ); 3223 config.writeEntry( "PipeTarget", reader->m_pipetarget );
3224 config.writeEntry( "PauseAfterPara", reader->m_pauseAfterEachPara ); 3224 config.writeEntry( "PauseAfterPara", reader->m_pauseAfterEachPara );
3225#endif 3225#endif
3226 config.writeEntry( "TwoTouch", m_twoTouch ); 3226 config.writeEntry( "TwoTouch", m_twoTouch );
3227 config.writeEntry( "Annotation", m_doAnnotation); 3227 config.writeEntry( "Annotation", m_doAnnotation);
3228 config.writeEntry( "Dictionary", m_doDictionary); 3228 config.writeEntry( "Dictionary", m_doDictionary);
3229 config.writeEntry( "Clipboard", m_doClipboard); 3229 config.writeEntry( "Clipboard", m_doClipboard);
3230 config.writeEntry( "SpaceTarget", m_spaceTarget); 3230 config.writeEntry( "SpaceTarget", m_spaceTarget);
3231 config.writeEntry( "EscapeTarget", m_escapeTarget); 3231 config.writeEntry( "EscapeTarget", m_escapeTarget);
3232 config.writeEntry( "ReturnTarget", m_returnTarget); 3232 config.writeEntry( "ReturnTarget", m_returnTarget);
3233 config.writeEntry( "LeftTarget", m_leftTarget); 3233 config.writeEntry( "LeftTarget", m_leftTarget);
3234 config.writeEntry( "RightTarget", m_rightTarget); 3234 config.writeEntry( "RightTarget", m_rightTarget);
3235 config.writeEntry( "UpTarget", m_upTarget); 3235 config.writeEntry( "UpTarget", m_upTarget);
3236 config.writeEntry( "DownTarget", m_downTarget); 3236 config.writeEntry( "DownTarget", m_downTarget);
3237 config.writeEntry("LeftScroll", m_leftScroll); 3237 config.writeEntry("LeftScroll", m_leftScroll);
3238 config.writeEntry("RightScroll", m_rightScroll); 3238 config.writeEntry("RightScroll", m_rightScroll);
3239 config.writeEntry("UpScroll", m_upScroll); 3239 config.writeEntry("UpScroll", m_upScroll);
3240 config.writeEntry("DownScroll", m_downScroll); 3240 config.writeEntry("DownScroll", m_downScroll);
3241#ifdef REPALM 3241#ifdef REPALM
3242 config.writeEntry( "Repalm", reader->brepalm ); 3242 config.writeEntry( "Repalm", reader->brepalm );
3243#endif 3243#endif
3244 config.writeEntry( "Remap", reader->bremap ); 3244 config.writeEntry( "Remap", reader->bremap );
3245 config.writeEntry( "Peanut", reader->bpeanut ); 3245 config.writeEntry( "Peanut", reader->bpeanut );
3246 config.writeEntry( "MakeBold", reader->bmakebold ); 3246 config.writeEntry( "MakeBold", reader->bmakebold );
3247 config.writeEntry( "Continuous", reader->m_continuousDocument ); 3247 config.writeEntry( "Continuous", reader->m_continuousDocument );
3248 config.writeEntry( "FullJust", reader->bfulljust ); 3248 config.writeEntry( "FullJust", reader->bfulljust );
3249 config.writeEntry( "ExtraSpace", reader->getextraspace() ); 3249 config.writeEntry( "ExtraSpace", reader->getextraspace() );
3250 config.writeEntry( "ExtraLead", reader->getlead() ); 3250 config.writeEntry( "ExtraLead", reader->getlead() );
3251 config.writeEntry( "Basesize", (int)reader->getBaseSize()); 3251 config.writeEntry( "Basesize", (int)reader->getBaseSize());
3252 config.writeEntry( "RequestorFontChange", m_propogatefontchange); 3252 config.writeEntry( "RequestorFontChange", m_propogatefontchange);
3253 3253
3254 config.setGroup( "Toolbar" ); 3254 config.setGroup( "Toolbar" );
3255 config.writeEntry("Movable", m_tbmovesave); 3255 config.writeEntry("Movable", m_tbmovesave);
3256 config.writeEntry("Policy", m_tbpolsave); 3256 config.writeEntry("Policy", m_tbpolsave);
3257 config.writeEntry("Position", m_tbposition); 3257 config.writeEntry("Position", m_tbposition);
3258*/ 3258*/
3259 savefilelist(); 3259 savefilelist();
3260} 3260}
3261 3261
3262/* 3262/*
3263void QTReaderApp::oldFile() 3263void QTReaderApp::oldFile()
3264{ 3264{
3265// qDebug("oldFile called"); 3265// qDebug("oldFile called");
3266 reader->setText(true); 3266 reader->setText(true);
3267// qDebug("settext called"); 3267// qDebug("settext called");
3268 showEditTools(); 3268 showEditTools();
3269// qDebug("showedit called"); 3269// qDebug("showedit called");
3270} 3270}
3271*/ 3271*/
3272 3272
3273/* 3273/*
3274void info_cb(Fl_Widget* o, void* _data) 3274void info_cb(Fl_Widget* o, void* _data)
3275{ 3275{
3276 3276
3277 if (infowin == NULL) 3277 if (infowin == NULL)
3278 { 3278 {
3279 3279
3280 infowin = new Fl_Window(160,240); 3280 infowin = new Fl_Window(160,240);
3281 filename = new Fl_Output(45,5,110,14,"Filename"); 3281 filename = new Fl_Output(45,5,110,14,"Filename");
3282 filesize = new Fl_Output(45,25,110,14,"Filesize"); 3282 filesize = new Fl_Output(45,25,110,14,"Filesize");
3283 textsize = new Fl_Output(45,45,110,14,"Textsize"); 3283 textsize = new Fl_Output(45,45,110,14,"Textsize");
3284 comprat = new CBar(45,65,110,14,"Ratio %"); 3284 comprat = new CBar(45,65,110,14,"Ratio %");
3285 posn = new Fl_Output(45,85,110,14,"Location"); 3285 posn = new Fl_Output(45,85,110,14,"Location");
3286 frcn = new CBar(45,105,110,14,"% Read"); 3286 frcn = new CBar(45,105,110,14,"% Read");
3287 about = new Fl_Multiline_Output(5,125,150,90); 3287 about = new Fl_Multiline_Output(5,125,150,90);
3288 about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files"); 3288 about->value("TWReader - $Name$\n\nA file reader program for the Agenda\n\nReads text, PalmDoc and ppms format files");
3289 Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay"); 3289 Fl_Button *jump_accept = new Fl_Button(62,220,35,14,"Okay");
3290 infowin->set_modal(); 3290 infowin->set_modal();
3291 } 3291 }
3292 if (((reader_ui *)_data)->g_filename[0] != '\0') 3292 if (((reader_ui *)_data)->g_filename[0] != '\0')
3293 { 3293 {
3294 unsigned long fs,ts; 3294 unsigned long fs,ts;
3295 tchar sz[20]; 3295 tchar sz[20];
3296 ((reader_ui *)_data)->input->sizes(fs,ts); 3296 ((reader_ui *)_data)->input->sizes(fs,ts);
3297 unsigned long pl = ((reader_ui *)_data)->input->locate(); 3297 unsigned long pl = ((reader_ui *)_data)->input->locate();
3298 3298
3299 filename->value(((reader_ui *)_data)->g_filename); 3299 filename->value(((reader_ui *)_data)->g_filename);
3300 3300
3301 sprintf(sz,"%u",fs); 3301 sprintf(sz,"%u",fs);
3302 filesize->value(sz); 3302 filesize->value(sz);
3303 3303
3304 sprintf(sz,"%u",ts); 3304 sprintf(sz,"%u",ts);
3305 textsize->value(sz); 3305 textsize->value(sz);
3306 3306
3307 comprat->value(100-(100*fs + (ts >> 1))/ts); 3307 comprat->value(100-(100*fs + (ts >> 1))/ts);
3308 3308
3309 sprintf(sz,"%u",pl); 3309 sprintf(sz,"%u",pl);
3310 posn->value(sz); 3310 posn->value(sz);
3311 3311
3312 frcn->value((100*pl + (ts >> 1))/ts); 3312 frcn->value((100*pl + (ts >> 1))/ts);
3313 } 3313 }
3314 infowin->show(); 3314 infowin->show();
3315} 3315}
3316*/ 3316*/
3317 3317
3318void QTReaderApp::savebkmks() 3318void QTReaderApp::savebkmks()
3319{ 3319{
3320 if (pBkmklist != NULL) 3320 if (pBkmklist != NULL)
3321 { 3321 {
3322#ifndef USEQPE 3322#ifndef USEQPE
3323 QDir d = QDir::home(); // "/" 3323 QDir d = QDir::home(); // "/"
3324 d.cd(APPDIR); 3324 d.cd(APPDIR);
3325 QFileInfo fi(d, reader->m_string); 3325 QFileInfo fi(d, reader->m_string);
3326 BkmkFile bf((const char *)fi.absFilePath(), true); 3326 BkmkFile bf((const char *)fi.absFilePath(), true);
3327#else /* USEQPE */ 3327#else /* USEQPE */
3328 BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), true); 3328 BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string), true);
3329#endif /* USEQPE */ 3329#endif /* USEQPE */
3330 bf.write(*pBkmklist); 3330 bf.write(*pBkmklist);
3331 } 3331 }
3332 m_fBkmksChanged = false; 3332 m_fBkmksChanged = false;
3333} 3333}
3334 3334
3335void QTReaderApp::readfilelist() 3335void QTReaderApp::readfilelist()
3336{ 3336{
3337#ifndef USEQPE 3337#ifndef USEQPE
3338 QDir d = QDir::home(); // "/" 3338 QDir d = QDir::home(); // "/"
3339 d.cd(APPDIR); 3339 d.cd(APPDIR);
3340 QFileInfo fi(d, ".openfiles"); 3340 QFileInfo fi(d, ".openfiles");
3341 BkmkFile bf((const char *)fi.absFilePath()); 3341 BkmkFile bf((const char *)fi.absFilePath());
3342#else /* USEQPE */ 3342#else /* USEQPE */
3343 BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles")); 3343 BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"));
3344#endif /* USEQPE */ 3344#endif /* USEQPE */
3345// qDebug("Reading open files"); 3345// qDebug("Reading open files");
3346 pOpenlist = bf.readall(); 3346 pOpenlist = bf.readall();
3347// if (pOpenlist != NULL) qDebug("...with success"); 3347// if (pOpenlist != NULL) qDebug("...with success");
3348// else qDebug("...without success!"); 3348// else qDebug("...without success!");
3349} 3349}
3350 3350
3351void QTReaderApp::savefilelist() 3351void QTReaderApp::savefilelist()
3352{ 3352{
3353 if (pOpenlist != NULL) 3353 if (pOpenlist != NULL)
3354 { 3354 {
3355#ifndef USEQPE 3355#ifndef USEQPE
3356 QDir d = QDir::home(); // "/" 3356 QDir d = QDir::home(); // "/"
3357 d.cd(APPDIR); 3357 d.cd(APPDIR);
3358 QFileInfo fi(d, ".openfiles"); 3358 QFileInfo fi(d, ".openfiles");
3359 BkmkFile bf((const char *)fi.absFilePath(), true); 3359 BkmkFile bf((const char *)fi.absFilePath(), true);
3360#else /* USEQPE */ 3360#else /* USEQPE */
3361 BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), true); 3361 BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), true);
3362#endif /* USEQPE */ 3362#endif /* USEQPE */
3363 //qDebug("Writing open files"); 3363 //qDebug("Writing open files");
3364 bf.write(*pOpenlist); 3364 bf.write(*pOpenlist);
3365 } 3365 }
3366} 3366}
3367 3367
3368void QTReaderApp::readbkmks() 3368void QTReaderApp::readbkmks()
3369{ 3369{
3370 if (pBkmklist != NULL) 3370 if (pBkmklist != NULL)
3371 { 3371 {
3372 delete pBkmklist; 3372 delete pBkmklist;
3373 } 3373 }
3374 struct stat fnstat; 3374 struct stat fnstat;
3375 struct stat bkstat; 3375 struct stat bkstat;
3376#ifndef USEQPE 3376#ifndef USEQPE
3377 QDir d = QDir::home(); // "/" 3377 QDir d = QDir::home(); // "/"
3378 d.cd(APPDIR); 3378 d.cd(APPDIR);
3379 QFileInfo fi(d, reader->m_string); 3379 QFileInfo fi(d, reader->m_string);
3380#endif /* ! USEQPE */ 3380#endif /* ! USEQPE */
3381 if ( 3381 if (
3382 stat((const char *)reader->m_lastfile, &fnstat) == 0 3382 stat((const char *)reader->m_lastfile, &fnstat) == 0
3383 && 3383 &&
3384#ifndef USEQPE 3384#ifndef USEQPE
3385 stat((const char *)fi.absFilePath(), &bkstat) == 0 3385 stat((const char *)fi.absFilePath(), &bkstat) == 0
3386#else /* USEQPE */ 3386#else /* USEQPE */
3387 stat((const char *)Global::applicationFileName(APPDIR,reader->m_string), &bkstat) == 0 3387 stat((const char *)Global::applicationFileName(APPDIR,reader->m_string), &bkstat) == 0
3388#endif /* USEQPE */ 3388#endif /* USEQPE */
3389 ) 3389 )
3390 { 3390 {
3391 if (bkstat.st_mtime < fnstat.st_mtime) 3391 if (bkstat.st_mtime < fnstat.st_mtime)
3392 { 3392 {
3393#ifndef USEQPE 3393#ifndef USEQPE
3394 unlink((const char *)fi.absFilePath()); 3394 unlink((const char *)fi.absFilePath());
3395#else /* USEQPE */ 3395#else /* USEQPE */
3396 unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string)); 3396 unlink((const char *)Global::applicationFileName(APPDIR,reader->m_string));
3397#endif /* USEQPE */ 3397#endif /* USEQPE */
3398 } 3398 }
3399 } 3399 }
3400 3400
3401#ifndef USEQPE 3401#ifndef USEQPE
3402 BkmkFile bf((const char *)fi.absFilePath()); 3402 BkmkFile bf((const char *)fi.absFilePath());
3403#else /* USEQPE */ 3403#else /* USEQPE */
3404 BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string)); 3404 BkmkFile bf((const char *)Global::applicationFileName(APPDIR,reader->m_string));
3405#endif /* USEQPE */ 3405#endif /* USEQPE */
3406 3406
3407 pBkmklist = bf.readall(); 3407 pBkmklist = bf.readall();
3408 m_fBkmksChanged = bf.upgraded(); 3408 m_fBkmksChanged = bf.upgraded();
3409 if (pBkmklist == NULL) 3409 if (pBkmklist == NULL)
3410 { 3410 {
3411 pBkmklist = reader->getbkmklist(); 3411 pBkmklist = reader->getbkmklist();
3412 } 3412 }
3413 if (pBkmklist != NULL) 3413 if (pBkmklist != NULL)
3414 pBkmklist->sort(); 3414 pBkmklist->sort();
3415} 3415}
3416 3416
3417void QTReaderApp::addbkmk() 3417void QTReaderApp::addbkmk()
3418{ 3418{
3419 m_nRegAction = cAddBkmk; 3419 m_nRegAction = cAddBkmk;
3420 regEdit->setText(reader->firstword()); 3420 regEdit->setText(reader->firstword());
3421 do_regedit(); 3421 do_regedit();
3422} 3422}
3423 3423
3424void QTReaderApp::do_addbkmk(const QString& text) 3424void QTReaderApp::do_addbkmk(const QString& text)
3425{ 3425{
3426 if (text.isEmpty()) 3426 if (text.isEmpty())
3427 { 3427 {
3428 QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nSelect add again", 1); 3428 QMessageBox::information(this, PROGNAME, "Need a name for the bookmark\nSelect add again", 1);
3429 } 3429 }
3430 else 3430 else
3431 { 3431 {
3432 if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>; 3432 if (pBkmklist == NULL) pBkmklist = new CList<Bkmk>;
3433#ifdef _UNICODE 3433#ifdef _UNICODE
3434 CBuffer buff; 3434 CBuffer buff;
3435 int i = 0; 3435 int i = 0;
3436 for (i = 0; i < text.length(); i++) 3436 for (i = 0; i < text.length(); i++)
3437 { 3437 {
3438 buff[i] = text[i].unicode(); 3438 buff[i] = text[i].unicode();
3439 } 3439 }
3440 buff[i] = 0; 3440 buff[i] = 0;
3441 pBkmklist->push_front(Bkmk(buff.data(), NULL, reader->pagelocate())); 3441 pBkmklist->push_front(Bkmk(buff.data(), NULL, reader->pagelocate()));
3442#else 3442#else
3443 pBkmklist->push_front(Bkmk((const tchar*)text, reader->pagelocate())); 3443 pBkmklist->push_front(Bkmk((const tchar*)text, reader->pagelocate()));
3444#endif 3444#endif
3445 m_fBkmksChanged = true; 3445 m_fBkmksChanged = true;
3446 pBkmklist->sort(); 3446 pBkmklist->sort();
3447 } 3447 }
3448} 3448}
3449 3449
3450void QTReaderApp::OnRedraw() 3450void QTReaderApp::OnRedraw()
3451{ 3451{
3452 if ((pBkmklist != NULL) && (m_bkmkAvail != NULL)) 3452 if ((pBkmklist != NULL) && (m_bkmkAvail != NULL))
3453 { 3453 {
3454 bool found = findNextBookmark(reader->pagelocate()); 3454 bool found = findNextBookmark(reader->pagelocate());
3455 m_bkmkAvail->setEnabled(found); 3455 m_bkmkAvail->setEnabled(found);
3456 } 3456 }
3457} 3457}
3458 3458
3459void QTReaderApp::showAnnotation() 3459void QTReaderApp::showAnnotation()
3460{ 3460{
3461 m_annoWin->setName(toQString(m_anno->name())); 3461 m_annoWin->setName(toQString(m_anno->name()));
3462 m_annoWin->setAnno(toQString(m_anno->anno())); 3462 m_annoWin->setAnno(toQString(m_anno->anno()));
3463 m_annoIsEditing = false; 3463 m_annoIsEditing = false;
3464#ifdef USEQPE 3464#ifdef USEQPE
3465 Global::showInputMethod(); 3465 Global::showInputMethod();
3466#endif 3466#endif
3467 editorStack->raiseWidget( m_annoWin ); 3467 editorStack->raiseWidget( m_annoWin );
3468 m_annoWin->setFocus(); 3468 m_annoWin->setFocus();
3469} 3469}
3470 3470
3471void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, const QString& line) 3471void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, const QString& line)
3472{ 3472{
3473//// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd); 3473//// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd);
3474 3474
3475 if (m_doClipboard) 3475 if (m_doClipboard)
3476 { 3476 {
3477 QClipboard* cb = QApplication::clipboard(); 3477 QClipboard* cb = QApplication::clipboard();
3478 cb->setText(wrd); 3478 cb->setText(wrd);
3479#ifdef USEQPE 3479#ifdef USEQPE
3480 if (wrd.length() > 10) 3480 if (wrd.length() > 10)
3481 { 3481 {
3482 Global::statusMessage(wrd.left(8) + ".."); 3482 Global::statusMessage(wrd.left(8) + "..");
3483 } 3483 }
3484 else 3484 else
3485 { 3485 {
3486 Global::statusMessage(wrd); 3486 Global::statusMessage(wrd);
3487 } 3487 }
3488#endif 3488#endif
3489 } 3489 }
3490 if (m_doAnnotation) 3490 if (m_doAnnotation)
3491 { 3491 {
3492 //addAnno(wrd, "Need to be able to edit this", posn); 3492 //addAnno(wrd, "Need to be able to edit this", posn);
3493 m_annoWin->setName(line); 3493 m_annoWin->setName(line);
3494 m_annoWin->setAnno(""); 3494 m_annoWin->setAnno("");
3495 m_annoWin->setPosn(posn); 3495 m_annoWin->setPosn(posn);
3496 m_annoIsEditing = true; 3496 m_annoIsEditing = true;
3497#ifdef USEQPE 3497#ifdef USEQPE
3498 Global::showInputMethod(); 3498 Global::showInputMethod();
3499#endif 3499#endif
3500 editorStack->raiseWidget( m_annoWin ); 3500 editorStack->raiseWidget( m_annoWin );
3501 } 3501 }
3502#ifdef USEQPE 3502#ifdef USEQPE
3503 if (m_doDictionary) 3503 if (m_doDictionary)
3504 { 3504 {
3505 if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty()) 3505 if (!m_targetapp.isEmpty() && !m_targetmsg.isEmpty())
3506 { 3506 {
3507 QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8()); 3507 QCopEnvelope e(("QPE/Application/"+m_targetapp).utf8(), (m_targetmsg+"(QString)").utf8());
3508 e << wrd; 3508 e << wrd;
3509 } 3509 }
3510 } 3510 }
3511#endif 3511#endif
3512} 3512}
3513 3513
3514void QTReaderApp::doAction(ActionTypes a, QKeyEvent* e) 3514void QTReaderApp::doAction(ActionTypes a, QKeyEvent* e)
3515{ 3515{
3516 if (a == 0) 3516 if (a == 0)
3517 { 3517 {
3518 e->ignore(); 3518 e->ignore();
3519 } 3519 }
3520 else 3520 else
3521 { 3521 {
3522 e->accept(); 3522 e->accept();
3523 //qDebug("Accepted"); 3523 //qDebug("Accepted");
3524 switch (a) 3524 switch (a)
3525 { 3525 {
3526 case cesOpenFile: 3526 case cesOpenFile:
3527 { 3527 {
3528 fileOpen(); 3528 fileOpen();
3529 } 3529 }
3530 break; 3530 break;
3531 case cesAutoScroll: 3531 case cesAutoScroll:
3532 { 3532 {
3533 reader->setautoscroll(!reader->m_autoScroll); 3533 reader->setautoscroll(!reader->m_autoScroll);
3534 setScrollState(reader->m_autoScroll); 3534 setScrollState(reader->m_autoScroll);
3535 } 3535 }
3536 break; 3536 break;
3537 case cesActionMark: 3537 case cesActionMark:
3538 { 3538 {
3539 addbkmk(); 3539 addbkmk();
3540 } 3540 }
3541 break; 3541 break;
3542 case cesFullScreen: 3542 case cesFullScreen:
3543 { 3543 {
3544 m_actFullscreen->setOn(!m_fullscreen); 3544 m_actFullscreen->setOn(!m_fullscreen);
3545 } 3545 }
3546 break; 3546 break;
3547 case cesActionAnno: 3547 case cesActionAnno:
3548 { 3548 {
3549 addanno(); 3549 addanno();
3550 } 3550 }
3551 break; 3551 break;
3552 case cesZoomIn: 3552 case cesZoomIn:
3553 zoomin(); 3553 zoomin();
3554 break; 3554 break;
3555 case cesZoomOut: 3555 case cesZoomOut:
3556 zoomout(); 3556 zoomout();
3557 break; 3557 break;
3558 case cesBack: 3558 case cesBack:
3559 reader->goBack(); 3559 reader->goBack();
3560 break; 3560 break;
3561 case cesForward: 3561 case cesForward:
3562 reader->goForward(); 3562 reader->goForward();
3563 break; 3563 break;
3564 case cesHome: 3564 case cesHome:
3565 reader->goHome(); 3565 reader->goHome();
3566 break; 3566 break;
3567 case cesPageUp: 3567 case cesPageUp:
3568 reader->dopageup(); 3568 reader->dopageup();
3569 break; 3569 break;
3570 case cesPageDown: 3570 case cesPageDown:
3571 reader->dopagedn(); 3571 reader->dopagedn();
3572 break; 3572 break;
3573 case cesLineUp: 3573 case cesLineUp:
3574 reader->lineUp(); 3574 reader->lineUp();
3575 break; 3575 break;
3576 case cesLineDown: 3576 case cesLineDown:
3577 reader->lineDown(); 3577 reader->lineDown();
3578 break; 3578 break;
3579 case cesStartDoc: 3579 case cesStartDoc:
3580 gotoStart(); 3580 gotoStart();
3581 break; 3581 break;
3582 case cesEndDoc: 3582 case cesEndDoc:
3583 gotoEnd(); 3583 gotoEnd();
3584 break; 3584 break;
3585 default: 3585 default:
3586 qDebug("Unknown ActionType:%u", a); 3586 qDebug("Unknown ActionType:%u", a);
3587 break; 3587 break;
3588 } 3588 }
3589 } 3589 }
3590} 3590}
3591 3591
3592void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); } 3592void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); }
3593void QTReaderApp::restoreFocus() { reader->setFocus(); } 3593void QTReaderApp::restoreFocus() { reader->setFocus(); }
3594 3594
3595void QTReaderApp::SaveConfig() 3595void QTReaderApp::SaveConfig()
3596{ 3596{
3597 m_nRegAction = cSetConfigName; 3597 m_nRegAction = cSetConfigName;
3598 regEdit->setText(reader->m_string); 3598 regEdit->setText(reader->m_string);
3599 do_regedit(); 3599 do_regedit();
3600} 3600}
3601 3601
3602void QTReaderApp::do_saveconfig(const QString& _txt, bool full) 3602void QTReaderApp::do_saveconfig(const QString& _txt, bool full)
3603{ 3603{
3604// qDebug("do_saveconfig:%s", (const char*)_txt); 3604// qDebug("do_saveconfig:%s", (const char*)_txt);
3605#ifdef USEQPE 3605#ifdef USEQPE
3606 QString configname; 3606 QString configname;
3607 Config::Domain dom; 3607 Config::Domain dom;
3608 3608
3609 if (full) 3609 if (full)
3610 { 3610 {
3611 configname = _txt; 3611 configname = _txt;
3612 dom = Config::User; 3612 dom = Config::User;
3613 } 3613 }
3614 else 3614 else
3615 { 3615 {
3616 configname = Global::applicationFileName(APPDIR "/configs", _txt); 3616 configname = Global::applicationFileName(APPDIR "/configs", _txt);
3617 dom = Config::File; 3617 dom = Config::File;
3618 } 3618 }
3619 3619
3620 Config config(configname, dom); 3620 Config config(configname, dom);
3621 config.setGroup( "View" ); 3621 config.setGroup( "View" );
3622 3622
3623#else 3623#else
3624 QFileInfo fi; 3624 QFileInfo fi;
3625 if (full) 3625 if (full)
3626 { 3626 {
3627 // qDebug("full:%s", (const char*)_txt); 3627 // qDebug("full:%s", (const char*)_txt);
3628 QDir d = QDir::home(); // "/" 3628 QDir d = QDir::home(); // "/"
3629 if ( !d.cd(_txt) ) 3629 if ( !d.cd(_txt) )
3630 { // "/tmp" 3630 { // "/tmp"
3631 qWarning( "Cannot find the \"~/%s\" directory", (const char*)_txt ); 3631 qWarning( "Cannot find the \"~/%s\" directory", (const char*)_txt );
3632 d = QDir::home(); 3632 d = QDir::home();
3633 d.mkdir(_txt); 3633 d.mkdir(_txt);
3634 d.cd(_txt); 3634 d.cd(_txt);
3635 } 3635 }
3636 fi.setFile(d, INIFILE); 3636 fi.setFile(d, INIFILE);
3637 } 3637 }
3638 else 3638 else
3639 { 3639 {
3640 QDir d = QDir::home(); // "/" 3640 QDir d = QDir::home(); // "/"
3641 if ( !d.cd(APPDIR) ) 3641 if ( !d.cd(APPDIR) )
3642 { // "/tmp" 3642 { // "/tmp"
3643 qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); 3643 qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
3644 d = QDir::home(); 3644 d = QDir::home();
3645 d.mkdir(APPDIR); 3645 d.mkdir(APPDIR);
3646 d.cd(APPDIR); 3646 d.cd(APPDIR);
3647 } 3647 }
3648 if ( !d.cd("configs") ) 3648 if ( !d.cd("configs") )
3649 { // "/tmp" 3649 { // "/tmp"
3650 qWarning( "Cannot find the \"~/" APPDIR "/configs\" directory" ); 3650 qWarning( "Cannot find the \"~/" APPDIR "/configs\" directory" );
3651 d = QDir::home(); 3651 d = QDir::home();
3652 d.cd(APPDIR); 3652 d.cd(APPDIR);
3653 d.mkdir("configs"); 3653 d.mkdir("configs");
3654 d.cd("configs"); 3654 d.cd("configs");
3655 } 3655 }
3656 fi.setFile(d, _txt); 3656 fi.setFile(d, _txt);
3657 } 3657 }
3658 //qDebug("Path:%s", (const char*)fi.absFilePath()); 3658 //qDebug("Path:%s", (const char*)fi.absFilePath());
3659 Config config(fi.absFilePath()); 3659 Config config(fi.absFilePath());
3660#endif 3660#endif
3661 3661
3662 3662
3663 config.writeEntry( "StripCr", reader->bstripcr ); 3663 config.writeEntry( "StripCr", reader->bstripcr );
3664 config.writeEntry( "AutoFmt", reader->bautofmt ); 3664 config.writeEntry( "AutoFmt", reader->bautofmt );
3665 config.writeEntry( "TextFmt", reader->btextfmt ); 3665 config.writeEntry( "TextFmt", reader->btextfmt );
3666 config.writeEntry( "StripHtml", reader->bstriphtml ); 3666 config.writeEntry( "StripHtml", reader->bstriphtml );
3667 config.writeEntry( "Dehyphen", reader->bdehyphen ); 3667 config.writeEntry( "Dehyphen", reader->bdehyphen );
3668 config.writeEntry( "Depluck", reader->bdepluck ); 3668 config.writeEntry( "Depluck", reader->bdepluck );
3669 config.writeEntry( "Dejpluck", reader->bdejpluck ); 3669 config.writeEntry( "Dejpluck", reader->bdejpluck );
3670 config.writeEntry( "OneSpace", reader->bonespace ); 3670 config.writeEntry( "OneSpace", reader->bonespace );
3671 config.writeEntry( "Unindent", reader->bunindent ); 3671 config.writeEntry( "Unindent", reader->bunindent );
3672 config.writeEntry( "Repara", reader->brepara ); 3672 config.writeEntry( "Repara", reader->brepara );
3673 config.writeEntry( "DoubleSpace", reader->bdblspce ); 3673 config.writeEntry( "DoubleSpace", reader->bdblspce );
3674 config.writeEntry( "Indent", reader->bindenter ); 3674 config.writeEntry( "Indent", reader->bindenter );
3675 config.writeEntry( "FontSize", (int)(reader->m_fontControl.currentsize()) ); 3675 config.writeEntry( "FontSize", (int)(reader->m_fontControl.currentsize()) );
3676 config.writeEntry( "ScrollDelay", reader->m_delay); 3676 config.writeEntry( "ScrollDelay", reader->m_delay);
3677 if (full) 3677 if (full)
3678 { 3678 {
3679 config.writeEntry("Debounce", m_debounce); 3679 config.writeEntry("Debounce", m_debounce);
3680 config.writeEntry("FloatDialogs", m_bFloatingDialog); 3680 config.writeEntry("FloatDialogs", m_bFloatingDialog);
3681 reader->m_lastposn = reader->pagelocate(); 3681 reader->m_lastposn = reader->pagelocate();
3682 config.writeEntry( "LastFile", reader->m_lastfile ); 3682 config.writeEntry( "LastFile", reader->m_lastfile );
3683 config.writeEntry( "LastPosn", (int)(reader->pagelocate()) ); 3683 config.writeEntry( "LastPosn", (int)(reader->pagelocate()) );
3684 } 3684 }
3685 config.writeEntry( "PageMode", reader->m_bpagemode ); 3685 config.writeEntry( "PageMode", reader->m_bpagemode );
3686 config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced ); 3686 config.writeEntry( "MonoSpaced", reader->m_bMonoSpaced );
3687 config.writeEntry( "SwapMouse", reader->m_swapmouse); 3687 config.writeEntry( "SwapMouse", reader->m_swapmouse);
3688 config.writeEntry( "Fontname", reader->m_fontname ); 3688 config.writeEntry( "Fontname", reader->m_fontname );
3689 config.writeEntry( "Encoding", reader->m_encd ); 3689 config.writeEntry( "Encoding", reader->m_encd );
3690 config.writeEntry( "CharSpacing", reader->m_charpc ); 3690 config.writeEntry( "CharSpacing", reader->m_charpc );
3691 config.writeEntry( "Overlap", (int)(reader->m_overlap) ); 3691 config.writeEntry( "Overlap", (int)(reader->m_overlap) );
3692 config.writeEntry( "Margin", (int)reader->m_border ); 3692 config.writeEntry( "Margin", (int)reader->m_border );
3693 config.writeEntry( "TargetApp", m_targetapp ); 3693 config.writeEntry( "TargetApp", m_targetapp );
3694 config.writeEntry( "TargetMsg", m_targetmsg ); 3694 config.writeEntry( "TargetMsg", m_targetmsg );
3695#ifdef _SCROLLPIPE 3695#ifdef _SCROLLPIPE
3696 config.writeEntry( "PipeTarget", reader->m_pipetarget ); 3696 config.writeEntry( "PipeTarget", reader->m_pipetarget );
3697 config.writeEntry( "PauseAfterPara", reader->m_pauseAfterEachPara ); 3697 config.writeEntry( "PauseAfterPara", reader->m_pauseAfterEachPara );
3698#endif 3698#endif
3699 config.writeEntry( "TwoTouch", m_twoTouch ); 3699 config.writeEntry( "TwoTouch", m_twoTouch );
3700 config.writeEntry( "Annotation", m_doAnnotation); 3700 config.writeEntry( "Annotation", m_doAnnotation);
3701 config.writeEntry( "Dictionary", m_doDictionary); 3701 config.writeEntry( "Dictionary", m_doDictionary);
3702 config.writeEntry( "Clipboard", m_doClipboard); 3702 config.writeEntry( "Clipboard", m_doClipboard);
3703 config.writeEntry( "SpaceTarget", m_spaceTarget); 3703 config.writeEntry( "SpaceTarget", m_spaceTarget);
3704 config.writeEntry( "EscapeTarget", m_escapeTarget); 3704 config.writeEntry( "EscapeTarget", m_escapeTarget);
3705 config.writeEntry( "ReturnTarget", m_returnTarget); 3705 config.writeEntry( "ReturnTarget", m_returnTarget);
3706 config.writeEntry( "LeftTarget", m_leftTarget); 3706 config.writeEntry( "LeftTarget", m_leftTarget);
3707 config.writeEntry( "RightTarget", m_rightTarget); 3707 config.writeEntry( "RightTarget", m_rightTarget);
3708 config.writeEntry( "UpTarget", m_upTarget); 3708 config.writeEntry( "UpTarget", m_upTarget);
3709 config.writeEntry( "DownTarget", m_downTarget); 3709 config.writeEntry( "DownTarget", m_downTarget);
3710 config.writeEntry("LeftScroll", m_leftScroll); 3710 config.writeEntry("LeftScroll", m_leftScroll);
3711 config.writeEntry("RightScroll", m_rightScroll); 3711 config.writeEntry("RightScroll", m_rightScroll);
3712 config.writeEntry("UpScroll", m_upScroll); 3712 config.writeEntry("UpScroll", m_upScroll);
3713 config.writeEntry("DownScroll", m_downScroll); 3713 config.writeEntry("DownScroll", m_downScroll);
3714#ifdef REPALM 3714#ifdef REPALM
3715 config.writeEntry( "Repalm", reader->brepalm ); 3715 config.writeEntry( "Repalm", reader->brepalm );
3716#endif 3716#endif
3717 config.writeEntry( "Remap", reader->bremap ); 3717 config.writeEntry( "Remap", reader->bremap );
3718 config.writeEntry( "Peanut", reader->bpeanut ); 3718 config.writeEntry( "Peanut", reader->bpeanut );
3719 config.writeEntry( "MakeBold", reader->bmakebold ); 3719 config.writeEntry( "MakeBold", reader->bmakebold );
3720 config.writeEntry( "Continuous", reader->m_continuousDocument ); 3720 config.writeEntry( "Continuous", reader->m_continuousDocument );
3721 config.writeEntry( "FullJust", reader->bfulljust ); 3721 config.writeEntry( "FullJust", reader->bfulljust );
3722 config.writeEntry( "ExtraSpace", reader->getextraspace() ); 3722 config.writeEntry( "ExtraSpace", reader->getextraspace() );
3723 config.writeEntry( "ExtraLead", reader->getlead() ); 3723 config.writeEntry( "ExtraLead", reader->getlead() );
3724 config.writeEntry( "Basesize", (int)reader->getBaseSize()); 3724 config.writeEntry( "Basesize", (int)reader->getBaseSize());
3725 config.writeEntry( "RequestorFontChange", m_propogatefontchange); 3725 config.writeEntry( "RequestorFontChange", m_propogatefontchange);
3726 if (full) 3726 if (full)
3727 { 3727 {
3728 config.setGroup( "Toolbar" ); 3728 config.setGroup( "Toolbar" );
3729 config.writeEntry("Movable", m_tbmovesave); 3729 config.writeEntry("Movable", m_tbmovesave);
3730 config.writeEntry("Policy", m_tbpolsave); 3730 config.writeEntry("Policy", m_tbpolsave);
3731 config.writeEntry("Position", m_tbposition); 3731 config.writeEntry("Position", m_tbposition);
3732#ifndef USEQPE 3732#ifndef USEQPE
3733 config.setGroup( "Geometry" ); 3733 config.setGroup( "Geometry" );
3734 config.writeEntry( "x", x() ); 3734 config.writeEntry( "x", x() );
3735 config.writeEntry( "y", y() ); 3735 config.writeEntry( "y", y() );
3736 config.writeEntry( "width", width() ); 3736 config.writeEntry( "width", width() );
3737 config.writeEntry( "height", height() ); 3737 config.writeEntry( "height", height() );
3738#endif 3738#endif
3739 } 3739 }
3740} 3740}
3741 3741
3742/* 3742/*
3743void QTReaderApp::setstate(unsigned char* _sd, unsigned short _sdlen) 3743void QTReaderApp::setstate(unsigned char* _sd, unsigned short _sdlen)
3744{ 3744{
3745 unsigned short sdlen; 3745 unsigned short sdlen;
3746 memcpy(&sdlen, _sd, sizeof(sdlen)); 3746 memcpy(&sdlen, _sd, sizeof(sdlen));
3747 sdlen -= sizeof(sdlen); 3747 sdlen -= sizeof(sdlen);
3748 _sd += sizeof(sdlen); 3748 _sd += sizeof(sdlen);
3749 statedata* sd; 3749 statedata* sd;
3750 char* data; 3750 char* data;
3751 if (sdlen < sizeof(statedata)+1) 3751 if (sdlen < sizeof(statedata)+1)
3752 { 3752 {
3753 sdlen = sizeof(statedata)+1; 3753 sdlen = sizeof(statedata)+1;
3754 } 3754 }
3755 data = new char[sdlen]; 3755 data = new char[sdlen];
3756 sd = (statedata*)data; 3756 sd = (statedata*)data;
3757 memcpy(sd, _sd, sdlen); 3757 memcpy(sd, _sd, sdlen);
3758 data[sdlen] = 0; 3758 data[sdlen] = 0;
3759 reader->setstate(*sd); 3759 reader->setstate(*sd);
3760 delete [] data; 3760 delete [] data;
3761} 3761}
3762 3762
3763void QTReaderApp::getstate(unsigned char*& data, unsigned short& len) 3763void QTReaderApp::getstate(unsigned char*& data, unsigned short& len)
3764{ 3764{
3765 unsigned char* olddata = data; 3765 unsigned char* olddata = data;
3766 unsigned short oldlen = len; 3766 unsigned short oldlen = len;
3767 len = oldlen+sizeof(unsigned short)+sizeof(statedata)+reader->m_fontname.length(); 3767 len = oldlen+sizeof(unsigned short)+sizeof(statedata)+reader->m_fontname.length();
3768 data = new unsigned char[len]; 3768 data = new unsigned char[len];
3769 memcpy(data, olddata, oldlen); 3769 memcpy(data, olddata, oldlen);
3770 delete [] olddata; 3770 delete [] olddata;
3771 memcpy(data+oldlen, &len, sizeof(len)); 3771 memcpy(data+oldlen, &len, sizeof(len));
3772 statedata* sd = (statedata*)(data+oldlen+sizeof(unsigned short)); 3772 statedata* sd = (statedata*)(data+oldlen+sizeof(unsigned short));
3773 3773
3774 sd->bstripcr = reader->bstripcr; 3774 sd->bstripcr = reader->bstripcr;
3775 sd->btextfmt = reader->btextfmt; 3775 sd->btextfmt = reader->btextfmt;
3776 sd->bautofmt = reader->bautofmt; 3776 sd->bautofmt = reader->bautofmt;
3777 sd->bstriphtml = reader->bstriphtml; 3777 sd->bstriphtml = reader->bstriphtml;
3778 sd->bpeanut = reader->bpeanut; 3778 sd->bpeanut = reader->bpeanut;
3779 sd->bdehyphen = reader->bdehyphen; 3779 sd->bdehyphen = reader->bdehyphen;
3780 sd->bdepluck = reader->bdepluck; 3780 sd->bdepluck = reader->bdepluck;
3781 sd->bdejpluck = reader->bdejpluck; 3781 sd->bdejpluck = reader->bdejpluck;
3782 sd->bonespace = reader->bonespace; 3782 sd->bonespace = reader->bonespace;
3783 sd->bunindent = reader->bunindent; 3783 sd->bunindent = reader->bunindent;
3784 sd->brepara = reader->brepara; 3784 sd->brepara = reader->brepara;
3785 sd->bdblspce = reader->bdblspce; 3785 sd->bdblspce = reader->bdblspce;
3786 sd->m_bpagemode = reader->m_bpagemode; 3786 sd->m_bpagemode = reader->m_bpagemode;
3787 sd->m_bMonoSpaced = reader->m_bMonoSpaced; 3787 sd->m_bMonoSpaced = reader->m_bMonoSpaced;
3788 sd->bremap = reader->bremap; 3788 sd->bremap = reader->bremap;
3789 sd->bmakebold = reader->bmakebold; 3789 sd->bmakebold = reader->bmakebold;
3790 sd->Continuous = reader->m_continuousDocument; 3790 sd->Continuous = reader->m_continuousDocument;
3791#ifdef REPALM 3791#ifdef REPALM
3792 sd->brepalm = reader->brepalm; 3792 sd->brepalm = reader->brepalm;
3793#endif 3793#endif
3794 sd->bindenter = reader->bindenter; 3794 sd->bindenter = reader->bindenter;
3795 sd->m_textsize = reader->m_textsize; //reader->m_fontControl.currentsize() 3795 sd->m_textsize = reader->m_textsize; //reader->m_fontControl.currentsize()
3796 sd->m_encd = reader->m_encd; 3796 sd->m_encd = reader->m_encd;
3797 sd->m_charpc = reader->m_charpc; 3797 sd->m_charpc = reader->m_charpc;
3798 strcpy(sd->m_fontname, reader->m_fontname.latin1()); 3798 strcpy(sd->m_fontname, reader->m_fontname.latin1());
3799} 3799}
3800*/ 3800*/
3801#ifdef _SCRIPT 3801#ifdef _SCRIPT
3802void QTReaderApp::RunScript() 3802void QTReaderApp::RunScript()
3803{ 3803{
3804 fileBrowser* fb = new fileBrowser(this,"OpieReader",!m_bFloatingDialog, 3804 fileBrowser* fb = new fileBrowser(this,"OpieReader",!m_bFloatingDialog,
3805 0, 3805 0,
3806 // WStyle_Customize | WStyle_NoBorderEx, 3806 // WStyle_Customize | WStyle_NoBorderEx,
3807 "*", Global::applicationFileName(APPDIR "/scripts", "")); 3807 "*", Global::applicationFileName(APPDIR "/scripts", ""));
3808 3808
3809 QString fn; 3809 QString fn;
3810 if (fb->exec()) 3810 if (fb->exec())
3811 { 3811 {
3812 fn = fb->fileList[0]; 3812 fn = fb->fileList[0];
3813 } 3813 }
3814 delete fb; 3814 delete fb;
3815 if ( !fn.isEmpty() && fork() == 0 ) 3815 if ( !fn.isEmpty() && fork() == 0 )
3816 { 3816 {
3817 execlp((const char *)fn,(const char *)fn,NULL); 3817 execlp((const char *)fn,(const char *)fn,NULL);
3818 } 3818 }
3819} 3819}
3820 3820
3821void QTReaderApp::SaveScript(const char* sname) 3821void QTReaderApp::SaveScript(const char* sname)
3822{ 3822{
3823 FILE* f = fopen(sname,"w"); 3823 FILE* f = fopen(sname,"w");
3824 if (f != NULL) 3824 if (f != NULL)
3825 { 3825 {
3826#ifdef OPIE 3826#ifdef OPIE
3827 fprintf(f, "#!/bin/sh\nmsg() {\n\tqcop QPE/Application/reader \"$1\" \"$2\" \"$3\"\n}\n"); 3827 fprintf(f, "#!/bin/sh\nmsg() {\n\tqcop QPE/Application/reader \"$1\" \"$2\" \"$3\"\n}\n");
3828#else 3828#else
3829 fprintf(f, "#!/bin/bash\nmsg() {\n\tqcop QPE/Application/uqtreader \"$1\" \"$2\" \"$3\"\n}\n"); 3829 fprintf(f, "#!/bin/bash\nmsg() {\n\tqcop QPE/Application/uqtreader \"$1\" \"$2\" \"$3\"\n}\n");
3830#endif 3830#endif
3831 fprintf(f, "msg \"Update(int)\" 0\n"); 3831 fprintf(f, "msg \"Update(int)\" 0\n");
3832 fprintf(f, "msg \"Layout/StripCR(int)\" %d\n", (reader->bstripcr) ? 1:0); 3832 fprintf(f, "msg \"Layout/StripCR(int)\" %d\n", (reader->bstripcr) ? 1:0);
3833 if (reader->btextfmt) fprintf(f, "msg \"Markup(QString)\" \"Text\"\n"); 3833 if (reader->btextfmt) fprintf(f, "msg \"Markup(QString)\" \"Text\"\n");
3834 else if (reader->bautofmt) fprintf(f, "msg \"Markup(QString)\" \"Auto\"\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"); 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"); 3836 else if (reader->bpeanut) fprintf(f, "msg \"Markup(QString)\" \"Peanut/PML\"\n");
3837 else fprintf(f, "msg \"Markup(QString)\" \"None\"\n"); 3837 else fprintf(f, "msg \"Markup(QString)\" \"None\"\n");
3838 fprintf(f, "msg \"Layout/Dehyphen(int)\" %d\n", (reader->bdehyphen) ? 1:0); 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); 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); 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); 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); 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); 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); 3844 fprintf(f, "msg \"Layout/DoubleSpace(int)\" %d\n", (reader->bdblspce) ? 1:0);
3845 fprintf(f, "msg \"Layout/Indent(int)\" %d\n", reader->bindenter); 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); 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); 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); 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()); 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); 3850 fprintf(f, "msg \"Format/SetWidth(int)\" %d\n", reader->m_charpc);
3851 fprintf(f, "msg \"Navigation/SetOverlap(int)\" %d\n", reader->m_overlap); 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); 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); 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); 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); 3855 fprintf(f, "msg \"File/SetDictionary(QString)\" \"%s/%s\"\n", (const char *)m_targetapp, (const char *)m_targetmsg);
3856#ifdef _SCROLLPIPE 3856#ifdef _SCROLLPIPE
3857 fprintf(f, "msg \"File/SetScrollTarget(QString)\" \"%s\"\n", (const char *)reader->m_pipetarget); 3857 fprintf(f, "msg \"File/SetScrollTarget(QString)\" \"%s\"\n", (const char *)reader->m_pipetarget);
3858#endif 3858#endif
3859 fprintf(f, "msg \"File/Two/OneTouch(int)\" %d\n", (m_twoTouch) ? 1:0); 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); 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); 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); 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()); 3863 fprintf(f, "msg \"File/Action(QString)\" \"%s\"\n", (const char *)m_buttonAction[m_spaceTarget]->text());
3864 fprintf(f, "msg \"Update(int)\" 1\n"); 3864 fprintf(f, "msg \"Update(int)\" 1\n");
3865 fprintf(f, "msg \"info(QString)\" \"All Done\"\n"); 3865 fprintf(f, "msg \"info(QString)\" \"All Done\"\n");
3866 fclose(f); 3866 fclose(f);
3867 chmod(sname, S_IXUSR | S_IXGRP | S_IXOTH); 3867 chmod(sname, S_IXUSR | S_IXGRP | S_IXOTH);
3868 } 3868 }
3869} 3869}
3870 3870
3871void QTReaderApp::SaveConfig() 3871void QTReaderApp::SaveConfig()
3872{ 3872{
3873 m_nRegAction = cSetConfigName; 3873 m_nRegAction = cSetConfigName;
3874 regEdit->setText(""); 3874 regEdit->setText("");
3875 do_regedit(); 3875 do_regedit();
3876} 3876}
3877 3877
3878void QTReaderApp::do_saveconfig(const QString& _txt) 3878void QTReaderApp::do_saveconfig(const QString& _txt)
3879{ 3879{
3880 SaveScript(Global::applicationFileName(APPDIR "/scripts", _txt)); 3880 SaveScript(Global::applicationFileName(APPDIR "/scripts", _txt));
3881} 3881}
3882#endif 3882#endif
3883 3883
3884#ifdef _SCROLLPIPE 3884#ifdef _SCROLLPIPE
3885void QTReaderApp::setpipetarget() 3885void QTReaderApp::setpipetarget()
3886{ 3886{
3887 m_nRegAction = cSetPipeTarget; 3887 m_nRegAction = cSetPipeTarget;
3888 QString text = (reader->m_pipetarget.isEmpty()) ? QString("") : reader->m_pipetarget; 3888 QString text = (reader->m_pipetarget.isEmpty()) ? QString("") : reader->m_pipetarget;
3889 regEdit->setText(text); 3889 regEdit->setText(text);
3890 do_regedit(); 3890 do_regedit();
3891} 3891}
3892 3892
3893void QTReaderApp::do_setpipetarget(const QString& _txt) 3893void QTReaderApp::do_setpipetarget(const QString& _txt)
3894{ 3894{
3895 reader->m_pipetarget = _txt; 3895 reader->m_pipetarget = _txt;
3896} 3896}
3897 3897
3898void QTReaderApp::setpause(bool sfs) 3898void QTReaderApp::setpause(bool sfs)
3899{ 3899{
3900 reader->m_pauseAfterEachPara = sfs; 3900 reader->m_pauseAfterEachPara = sfs;
3901} 3901}
3902#endif 3902#endif
3903 3903
3904void QTReaderApp::monospace(bool _b) 3904void QTReaderApp::monospace(bool _b)
3905{ 3905{
3906 reader->setmono(_b); 3906 reader->setmono(_b);
3907} 3907}
3908 3908
3909bool QTReaderApp::readconfig(const QString& _txt, bool full=false) 3909bool QTReaderApp::readconfig(const QString& _txt, bool full=false)
3910{ 3910{
3911#ifdef USEQPE 3911#ifdef USEQPE
3912 QString configname; 3912 QString configname;
3913 Config::Domain dom; 3913 Config::Domain dom;
3914 3914
3915 if (full) 3915 if (full)
3916 { 3916 {
3917 configname = _txt; 3917 configname = _txt;
3918 dom = Config::User; 3918 dom = Config::User;
3919 } 3919 }
3920 else 3920 else
3921 { 3921 {
3922 configname = Global::applicationFileName(APPDIR "/configs", _txt); 3922 configname = Global::applicationFileName(APPDIR "/configs", _txt);
3923 QFileInfo fm(configname); 3923 QFileInfo fm(configname);
3924 if ( !fm.exists() ) return false; 3924 if ( !fm.exists() ) return false;
3925 dom = Config::File; 3925 dom = Config::File;
3926 } 3926 }
3927 3927
3928 Config config(configname, dom); 3928 Config config(configname, dom);
3929 config.setGroup( "View" ); 3929 config.setGroup( "View" );
3930 3930
3931#else 3931#else
3932 QFileInfo fi; 3932 QFileInfo fi;
3933 if (full) 3933 if (full)
3934 { 3934 {
3935 QDir d = QDir::home(); // "/" 3935 QDir d = QDir::home(); // "/"
3936 if ( !d.cd(_txt) ) 3936 if ( !d.cd(_txt) )
3937 { // "/tmp" 3937 { // "/tmp"
3938 qWarning( "Cannot find the \"~/%s\" directory", (const char*)_txt ); 3938 qWarning( "Cannot find the \"~/%s\" directory", (const char*)_txt );
3939 d = QDir::home(); 3939 d = QDir::home();
3940 d.mkdir(_txt); 3940 d.mkdir(_txt);
3941 d.cd(_txt); 3941 d.cd(_txt);
3942 } 3942 }
3943 fi.setFile(d, INIFILE); 3943 fi.setFile(d, INIFILE);
3944 } 3944 }
3945 else 3945 else
3946 { 3946 {
3947 QDir d = QDir::home(); // "/" 3947 QDir d = QDir::home(); // "/"
3948 if ( !d.cd(APPDIR) ) 3948 if ( !d.cd(APPDIR) )
3949 { // "/tmp" 3949 { // "/tmp"
3950 qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); 3950 qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
3951 d = QDir::home(); 3951 d = QDir::home();
3952 d.mkdir(APPDIR); 3952 d.mkdir(APPDIR);
3953 d.cd(APPDIR); 3953 d.cd(APPDIR);
3954 } 3954 }
3955 if ( !d.cd("configs") ) 3955 if ( !d.cd("configs") )
3956 { // "/tmp" 3956 { // "/tmp"
3957 qWarning( "Cannot find the \"~/" APPDIR "/configs\" directory" ); 3957 qWarning( "Cannot find the \"~/" APPDIR "/configs\" directory" );
3958 d = QDir::home(); 3958 d = QDir::home();
3959 d.mkdir("configs"); 3959 d.mkdir("configs");
3960 d.cd("configs"); 3960 d.cd("configs");
3961 } 3961 }
3962 fi.setFile(d, _txt); 3962 fi.setFile(d, _txt);
3963 } 3963 }
3964#ifdef _WINDOWS 3964#ifdef _WINDOWS
3965 struct stat fnstat; 3965 struct stat fnstat;
3966 if (stat((const char *)reader->m_lastfile, &fnstat) == 0) return false; // get round fileinfo bug on windows 3966 if (stat((const char *)reader->m_lastfile, &fnstat) == 0) return false; // get round fileinfo bug on windows
3967#else 3967#else
3968 if (!fi.exists()) return false; 3968 if (!fi.exists()) return false;
3969#endif 3969#endif
3970 Config config(fi.absFilePath()); 3970 Config config(fi.absFilePath());
3971#endif 3971#endif
3972 if (full) 3972 if (full)
3973 { 3973 {
3974 config.setGroup("Toolbar"); 3974 config.setGroup("Toolbar");
3975 m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false); 3975 m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false);
3976 m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1); 3976 m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1);
3977 m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2); 3977 m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2);
3978 } 3978 }
3979 config.setGroup( "View" ); 3979 config.setGroup( "View" );
3980 m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); 3980 m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false);
3981 reader->bstripcr = config.readBoolEntry( "StripCr", true ); 3981 reader->bstripcr = config.readBoolEntry( "StripCr", true );
3982 reader->bfulljust = config.readBoolEntry( "FullJust", false ); 3982 reader->bfulljust = config.readBoolEntry( "FullJust", false );
3983 reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 )); 3983 reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 ));
3984 reader->setlead(config.readNumEntry( "ExtraLead", 0 )); 3984 reader->setlead(config.readNumEntry( "ExtraLead", 0 ));
3985 reader->btextfmt = config.readBoolEntry( "TextFmt", false ); 3985 reader->btextfmt = config.readBoolEntry( "TextFmt", false );
3986 reader->bautofmt = config.readBoolEntry( "AutoFmt", true ); 3986 reader->bautofmt = config.readBoolEntry( "AutoFmt", true );
3987 reader->bstriphtml = config.readBoolEntry( "StripHtml", false ); 3987 reader->bstriphtml = config.readBoolEntry( "StripHtml", false );
3988 reader->bpeanut = config.readBoolEntry( "Peanut", false ); 3988 reader->bpeanut = config.readBoolEntry( "Peanut", false );
3989 reader->bdehyphen = config.readBoolEntry( "Dehyphen", false ); 3989 reader->bdehyphen = config.readBoolEntry( "Dehyphen", false );
3990 reader->bdepluck = config.readBoolEntry( "Depluck", false ); 3990 reader->bdepluck = config.readBoolEntry( "Depluck", false );
3991 reader->bdejpluck = config.readBoolEntry( "Dejpluck", false ); 3991 reader->bdejpluck = config.readBoolEntry( "Dejpluck", false );
3992 reader->bonespace = config.readBoolEntry( "OneSpace", false ); 3992 reader->bonespace = config.readBoolEntry( "OneSpace", false );
3993 reader->bunindent = config.readBoolEntry( "Unindent", false ); 3993 reader->bunindent = config.readBoolEntry( "Unindent", false );
3994 reader->brepara = config.readBoolEntry( "Repara", false ); 3994 reader->brepara = config.readBoolEntry( "Repara", false );
3995 reader->bdblspce = config.readBoolEntry( "DoubleSpace", false ); 3995 reader->bdblspce = config.readBoolEntry( "DoubleSpace", false );
3996 reader->bindenter = config.readNumEntry( "Indent", 0 ); 3996 reader->bindenter = config.readNumEntry( "Indent", 0 );
3997 reader->m_textsize = config.readNumEntry( "FontSize", 12 ); 3997 reader->m_textsize = config.readNumEntry( "FontSize", 12 );
3998 reader->m_delay = config.readNumEntry( "ScrollDelay", 5184); 3998 reader->m_delay = config.readNumEntry( "ScrollDelay", 5184);
3999 if (full) 3999 if (full)
4000 { 4000 {
4001 reader->m_lastfile = config.readEntry( "LastFile", QString::null ); 4001 reader->m_lastfile = config.readEntry( "LastFile", QString::null );
4002 reader->m_lastposn = config.readNumEntry( "LastPosn", 0 ); 4002 reader->m_lastposn = config.readNumEntry( "LastPosn", 0 );
4003 } 4003 }
4004 reader->m_bpagemode = config.readBoolEntry( "PageMode", true ); 4004 reader->m_bpagemode = config.readBoolEntry( "PageMode", true );
4005 reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false); 4005 reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false);
4006 reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false); 4006 reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false);
4007 reader->m_fontname = config.readEntry( "Fontname", "helvetica" ); 4007 reader->m_fontname = config.readEntry( "Fontname", "helvetica" );
4008 reader->m_encd = config.readNumEntry( "Encoding", 0 ); 4008 reader->m_encd = config.readNumEntry( "Encoding", 0 );
4009 reader->m_charpc = config.readNumEntry( "CharSpacing", 100 ); 4009 reader->m_charpc = config.readNumEntry( "CharSpacing", 100 );
4010 reader->m_overlap = config.readNumEntry( "Overlap", 0 ); 4010 reader->m_overlap = config.readNumEntry( "Overlap", 0 );
4011 reader->m_border = config.readNumEntry( "Margin", 6 ); 4011 reader->m_border = config.readNumEntry( "Margin", 6 );
4012#ifdef REPALM 4012#ifdef REPALM
4013 reader->brepalm = config.readBoolEntry( "Repalm", true ); 4013 reader->brepalm = config.readBoolEntry( "Repalm", true );
4014#endif 4014#endif
4015 reader->bremap = config.readBoolEntry( "Remap", true ); 4015 reader->bremap = config.readBoolEntry( "Remap", true );
4016 reader->bmakebold = config.readBoolEntry( "MakeBold", false ); 4016 reader->bmakebold = config.readBoolEntry( "MakeBold", false );
4017 reader->setContinuous(config.readBoolEntry( "Continuous", true )); 4017 reader->setContinuous(config.readBoolEntry( "Continuous", true ));
4018 m_targetapp = config.readEntry( "TargetApp", QString::null ); 4018 m_targetapp = config.readEntry( "TargetApp", QString::null );
4019 m_targetmsg = config.readEntry( "TargetMsg", QString::null ); 4019 m_targetmsg = config.readEntry( "TargetMsg", QString::null );
4020#ifdef _SCROLLPIPE 4020#ifdef _SCROLLPIPE
4021 reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null ); 4021 reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null );
4022 reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true ); 4022 reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true );
4023#endif 4023#endif
4024 m_twoTouch = config.readBoolEntry( "TwoTouch", false); 4024 m_twoTouch = config.readBoolEntry( "TwoTouch", false);
4025 m_doAnnotation = config.readBoolEntry( "Annotation", false); 4025 m_doAnnotation = config.readBoolEntry( "Annotation", false);
4026 m_doDictionary = config.readBoolEntry( "Dictionary", false); 4026 m_doDictionary = config.readBoolEntry( "Dictionary", false);
4027 m_doClipboard = config.readBoolEntry( "Clipboard", false); 4027 m_doClipboard = config.readBoolEntry( "Clipboard", false);
4028 m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll); 4028 m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll);
4029 m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone); 4029 m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone);
4030 m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen); 4030 m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen);
4031 m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut); 4031 m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut);
4032 m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn); 4032 m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn);
4033 m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp); 4033 m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp);
4034 m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown); 4034 m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown);
4035 4035
4036 m_leftScroll = config.readBoolEntry("LeftScroll", false); 4036 m_leftScroll = config.readBoolEntry("LeftScroll", false);
4037 m_rightScroll = config.readBoolEntry("RightScroll", false); 4037 m_rightScroll = config.readBoolEntry("RightScroll", false);
4038 m_upScroll = config.readBoolEntry("UpScroll", true); 4038 m_upScroll = config.readBoolEntry("UpScroll", true);
4039 m_downScroll = config.readBoolEntry("DownScroll", true); 4039 m_downScroll = config.readBoolEntry("DownScroll", true);
4040 m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false); 4040 m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false);
4041 reader->setBaseSize(config.readNumEntry( "Basesize", 10 )); 4041 reader->setBaseSize(config.readNumEntry( "Basesize", 10 ));
4042 reader->setTwoTouch(m_twoTouch); 4042 reader->setTwoTouch(m_twoTouch);
4043 4043
4044 m_touch_action->setOn(m_twoTouch); 4044 m_touch_action->setOn(m_twoTouch);
4045 m_setmono_action->setOn(reader->m_bMonoSpaced); 4045 m_setmono_action->setOn(reader->m_bMonoSpaced);
4046 setfontHelper(reader->m_fontname); 4046 setfontHelper(reader->m_fontname);
4047 if (full) 4047 if (full)
4048 { 4048 {
4049 addtoolbars(&config); 4049 addtoolbars(&config);
4050 } 4050 }
4051 reader->setfilter(reader->getfilter()); 4051 reader->setfilter(reader->getfilter());
4052 reader->refresh(); 4052 reader->refresh();
4053 return true; 4053 return true;
4054} 4054}
4055 4055
4056bool QTReaderApp::PopulateConfig(const char* tgtdir) 4056bool QTReaderApp::PopulateConfig(const char* tgtdir)
4057{ 4057{
4058 bkmkselector->clear(); 4058 bkmkselector->clear();
4059 bkmkselector->setText("Cancel"); 4059 bkmkselector->setText("Cancel");
4060#ifndef USEQPE 4060#ifndef USEQPE
4061 int cnt = 0; 4061 int cnt = 0;
4062 4062
4063 QDir d = QDir::home(); // "/" 4063 QDir d = QDir::home(); // "/"
4064 if ( !d.cd(APPDIR) ) { // "/tmp" 4064 if ( !d.cd(APPDIR) ) { // "/tmp"
4065 qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); 4065 qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
4066 d = QDir::home(); 4066 d = QDir::home();
4067 d.mkdir(APPDIR); 4067 d.mkdir(APPDIR);
4068 d.cd(APPDIR); 4068 d.cd(APPDIR);
4069 } 4069 }
4070 if ( !d.cd(tgtdir) ) { // "/tmp" 4070 if ( !d.cd(tgtdir) ) { // "/tmp"
4071 qWarning( "Cannot find the \"~/" APPDIR "/%s\" directory", tgtdir ); 4071 qWarning( "Cannot find the \"~/" APPDIR "/%s\" directory", tgtdir );
4072 d = QDir::home(); 4072 d = QDir::home();
4073 d.mkdir(tgtdir); 4073 d.mkdir(tgtdir);
4074 d.cd(tgtdir); 4074 d.cd(tgtdir);
4075 } 4075 }
4076 d.setFilter( QDir::Files | QDir::NoSymLinks ); 4076 d.setFilter( QDir::Files | QDir::NoSymLinks );
4077// d.setSorting( QDir::Size | QDir::Reversed ); 4077// d.setSorting( QDir::Size | QDir::Reversed );
4078 4078
4079 const QFileInfoList *list = d.entryInfoList(); 4079 const QFileInfoList *list = d.entryInfoList();
4080 QFileInfoListIterator it( *list ); // create list iterator 4080 QFileInfoListIterator it( *list ); // create list iterator
4081 QFileInfo *fi; // pointer for traversing 4081 QFileInfo *fi; // pointer for traversing
4082 4082
4083 while ( (fi=it.current()) ) { // for each file... 4083 while ( (fi=it.current()) ) { // for each file...
4084 4084
4085 bkmkselector->insertItem(fi->fileName()); 4085 bkmkselector->insertItem(fi->fileName());
4086 cnt++; 4086 cnt++;
4087 4087
4088 //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); 4088 //qDebug( "%10li %s", fi->size(), fi->fileName().data() );
4089 ++it; // goto next list element 4089 ++it; // goto next list element
4090 } 4090 }
4091 4091
4092#else /* USEQPE */ 4092#else /* USEQPE */
4093 int cnt = 0; 4093 int cnt = 0;
4094 DIR *d; 4094 DIR *d;
4095 char* finaldir; 4095 char* finaldir;
4096 finaldir = new char[strlen(APPDIR)+1+strlen(tgtdir)+1]; 4096 finaldir = new char[strlen(APPDIR)+1+strlen(tgtdir)+1];
4097 strcpy(finaldir, APPDIR); 4097 strcpy(finaldir, APPDIR);
4098 strcat(finaldir, "/"); 4098 strcat(finaldir, "/");
4099 strcat(finaldir, tgtdir); 4099 strcat(finaldir, tgtdir);
4100 d = opendir((const char *)Global::applicationFileName(finaldir,"")); 4100 d = opendir((const char *)Global::applicationFileName(finaldir,""));
4101 4101
4102 while(1) 4102 while(1)
4103 { 4103 {
4104 struct dirent* de; 4104 struct dirent* de;
4105 struct stat buf; 4105 struct stat buf;
4106 de = readdir(d); 4106 de = readdir(d);
4107 if (de == NULL) break; 4107 if (de == NULL) break;
4108 4108
4109 if (lstat((const char *)Global::applicationFileName(finaldir,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode)) 4109 if (lstat((const char *)Global::applicationFileName(finaldir,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode))
4110 { 4110 {
4111 bkmkselector->insertItem(de->d_name); 4111 bkmkselector->insertItem(de->d_name);
4112 cnt++; 4112 cnt++;
4113 } 4113 }
4114 } 4114 }
4115 delete [] finaldir; 4115 delete [] finaldir;
4116 closedir(d); 4116 closedir(d);
4117#endif 4117#endif
4118 return (cnt > 0); 4118 return (cnt > 0);
4119} 4119}
4120 4120
4121void QTReaderApp::LoadConfig() 4121void QTReaderApp::LoadConfig()
4122{ 4122{
4123 if (PopulateConfig("configs")) 4123 if (PopulateConfig("configs"))
4124 { 4124 {
4125 editorStack->raiseWidget( bkmkselector ); 4125 editorStack->raiseWidget( bkmkselector );
4126 hidetoolbars(); 4126 hidetoolbars();
4127 m_nBkmkAction = cLdConfig; 4127 m_nBkmkAction = cLdConfig;
4128 } 4128 }
4129 else 4129 else
4130 QMessageBox::information(this, PROGNAME, "No config files"); 4130 QMessageBox::information(this, PROGNAME, "No config files");
4131} 4131}
4132 4132
4133void QTReaderApp::TidyConfig() 4133void QTReaderApp::TidyConfig()
4134{ 4134{
4135 if (PopulateConfig("configs")) 4135 if (PopulateConfig("configs"))
4136 { 4136 {
4137 editorStack->raiseWidget( bkmkselector ); 4137 editorStack->raiseWidget( bkmkselector );
4138 hidetoolbars(); 4138 hidetoolbars();
4139 m_nBkmkAction = cRmConfig; 4139 m_nBkmkAction = cRmConfig;
4140 } 4140 }
4141 else 4141 else
4142 QMessageBox::information(this, PROGNAME, "No config files"); 4142 QMessageBox::information(this, PROGNAME, "No config files");
4143} 4143}
4144 4144
4145void QTReaderApp::ExportLinks() 4145void QTReaderApp::ExportLinks()
4146{ 4146{
4147 if (PopulateConfig("urls")) 4147 if (PopulateConfig("urls"))
4148 { 4148 {
4149 editorStack->raiseWidget( bkmkselector ); 4149 editorStack->raiseWidget( bkmkselector );
4150 hidetoolbars(); 4150 hidetoolbars();
4151 m_nBkmkAction = cExportLinks; 4151 m_nBkmkAction = cExportLinks;
4152 } 4152 }
4153 else 4153 else
4154 QMessageBox::information(this, PROGNAME, "No url files"); 4154 QMessageBox::information(this, PROGNAME, "No url files");
4155} 4155}
4156 4156
4157void QTReaderApp::OnURLSelected(const QString& href) 4157void QTReaderApp::OnURLSelected(const QString& href)
4158{ 4158{
4159 CURLDialog* urld = new CURLDialog(href, false, this); 4159 CURLDialog* urld = new CURLDialog(href, false, this);
4160 urld->clipboard(m_url_clipboard); 4160 urld->clipboard(m_url_clipboard);
4161 urld->localfile(m_url_localfile); 4161 urld->localfile(m_url_localfile);
4162 urld->globalfile(m_url_globalfile); 4162 urld->globalfile(m_url_globalfile);
4163 if (urld->exec()) 4163 if (urld->exec())
4164 { 4164 {
4165 m_url_clipboard = urld->clipboard(); 4165 m_url_clipboard = urld->clipboard();
4166 m_url_localfile = urld->localfile(); 4166 m_url_localfile = urld->localfile();
4167 m_url_globalfile = urld->globalfile(); 4167 m_url_globalfile = urld->globalfile();
4168 if (m_url_clipboard) 4168 if (m_url_clipboard)
4169 { 4169 {
4170 QClipboard* cb = QApplication::clipboard(); 4170 QClipboard* cb = QApplication::clipboard();
4171 cb->setText(href); 4171 cb->setText(href);
4172 qDebug("<a href=\"%s\">%s</a>", (const char*)href, (const char*)href); 4172 qDebug("<a href=\"%s\">%s</a>", (const char*)href, (const char*)href);
4173 } 4173 }
4174 if (m_url_localfile) 4174 if (m_url_localfile)
4175 { 4175 {
4176 writeUrl(reader->m_string, href); 4176 writeUrl(reader->m_string, href);
4177 } 4177 }
4178 if (m_url_globalfile) 4178 if (m_url_globalfile)
4179 { 4179 {
4180 writeUrl("GlobalURLFile", href); 4180 writeUrl("GlobalURLFile", href);
4181 } 4181 }
4182 } 4182 }
4183 delete urld; 4183 delete urld;
4184} 4184}
4185 4185
4186void QTReaderApp::writeUrl(const QString& file, const QString& href) 4186void QTReaderApp::writeUrl(const QString& file, const QString& href)
4187{ 4187{
4188 QString filename; 4188 QString filename;
4189#ifdef USEQPE 4189#ifdef USEQPE
4190 filename = Global::applicationFileName(APPDIR "/urls", file); 4190 filename = Global::applicationFileName(APPDIR "/urls", file);
4191#else 4191#else
4192 QFileInfo fi; 4192 QFileInfo fi;
4193 QDir d = QDir::home(); // "/" 4193 QDir d = QDir::home(); // "/"
4194 if ( !d.cd(APPDIR) ) 4194 if ( !d.cd(APPDIR) )
4195 { // "/tmp" 4195 { // "/tmp"
4196 qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); 4196 qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
4197 d = QDir::home(); 4197 d = QDir::home();
4198 d.mkdir(APPDIR); 4198 d.mkdir(APPDIR);
4199 d.cd(APPDIR); 4199 d.cd(APPDIR);
4200 } 4200 }
4201 if ( !d.cd("urls") ) 4201 if ( !d.cd("urls") )
4202 { // "/tmp" 4202 { // "/tmp"
4203 qWarning( "Cannot find the \"~/" APPDIR "/urls\" directory" ); 4203 qWarning( "Cannot find the \"~/" APPDIR "/urls\" directory" );
4204 d = QDir::home(); 4204 d = QDir::home();
4205 d.cd(APPDIR); 4205 d.cd(APPDIR);
4206 d.mkdir("urls"); 4206 d.mkdir("urls");
4207 d.cd("urls"); 4207 d.cd("urls");
4208 } 4208 }
4209 fi.setFile(d, file); 4209 fi.setFile(d, file);
4210 filename = fi.absFilePath(); 4210 filename = fi.absFilePath();
4211#endif 4211#endif
4212 FILE* fout = fopen(filename, "a"); 4212 FILE* fout = fopen(filename, "a");
4213 if (fout != NULL) 4213 if (fout != NULL)
4214 { 4214 {
4215 fprintf(fout, "<p><a href=\"%s\">%s</a>\n", (const char*)href, (const char*)href); 4215 fprintf(fout, "<p><a href=\"%s\">%s</a>\n", (const char*)href, (const char*)href);
4216 fclose(fout); 4216 fclose(fout);
4217 } 4217 }
4218 else 4218 else
4219 { 4219 {
4220 QMessageBox::warning(this, PROGNAME, "Problem with writing URL"); 4220 QMessageBox::warning(this, PROGNAME, "Problem with writing URL");
4221 } 4221 }
4222} 4222}
diff --git a/noncore/apps/opie-reader/ToolbarPrefs.cpp b/noncore/apps/opie-reader/ToolbarPrefs.cpp
index 361bf97..d878829 100644
--- a/noncore/apps/opie-reader/ToolbarPrefs.cpp
+++ b/noncore/apps/opie-reader/ToolbarPrefs.cpp
@@ -5,9 +5,9 @@
5** by: The User Interface Compiler (uic) 5** by: The User Interface Compiler (uic)
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9#include "useqpe.h" 9#include "useqpe.h"
10#include "ToolbarPrefs.h" 10#include "ToolbarPrefs.h"
11 11
12#include <qcheckbox.h> 12#include <qcheckbox.h>
13#include <qlabel.h> 13#include <qlabel.h>
@@ -19,11 +19,12 @@
19#include <qwhatsthis.h> 19#include <qwhatsthis.h>
20#include <qcombobox.h> 20#include <qcombobox.h>
21#include <qbuttongroup.h> 21#include <qbuttongroup.h>
22#include <qlineedit.h> 22#include <qlineedit.h>
23#ifdef USEQPE 23#ifdef USEQPE
24#include <qpe/menubutton.h> 24#include <qpe/menubutton.h>
25#endif 25#endif
26#include <qpe/qpeapplication.h>
26 27
27CBarPrefs::CBarPrefs(const QString& appdir, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true), config( appdir ) 28CBarPrefs::CBarPrefs(const QString& appdir, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true), config( appdir )
28{ 29{
29 setCaption(tr( "Toolbar Settings" ) ); 30 setCaption(tr( "Toolbar Settings" ) );
@@ -42,9 +43,10 @@ CBarPrefs::CBarPrefs(const QString& appdir, bool fs, QWidget* parent, const char
42 td->addTab(misc, tr("Policy")); 43 td->addTab(misc, tr("Policy"));
43 QVBoxLayout* v = new QVBoxLayout(this); 44 QVBoxLayout* v = new QVBoxLayout(this);
44 v->addWidget(td); 45 v->addWidget(td);
45 46
46 if (fs) showMaximized(); 47 if (fs)
48 QPEApplication::showDialog( this );
47} 49}
48 50
49/* 51/*
50CBarPrefs1::CBarPrefs1( Config& _config, QWidget* parent, const char* name, WFlags fl ) 52CBarPrefs1::CBarPrefs1( Config& _config, QWidget* parent, const char* name, WFlags fl )
diff --git a/noncore/apps/opie-reader/URLDialog.cpp b/noncore/apps/opie-reader/URLDialog.cpp
index dd4568b..e572c80 100644
--- a/noncore/apps/opie-reader/URLDialog.cpp
+++ b/noncore/apps/opie-reader/URLDialog.cpp
@@ -1,14 +1,17 @@
1#include "URLDialog.h" 1#include "URLDialog.h"
2#include "qlayout.h" 2#include "qlayout.h"
3 3
4CURLDialog::CURLDialog(const QString& fname, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true) 4#include <qpe/qpeapplication.h>
5{ 5
6 setCaption(tr("Save URL")); 6CURLDialog::CURLDialog(const QString& fname, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true)
7 QVBoxLayout *tmp = new QVBoxLayout(this); 7{
8 QVButtonGroup* vb = new QVButtonGroup(fname, this); 8 setCaption(tr("Save URL"));
9 tmp->addWidget(vb); 9 QVBoxLayout *tmp = new QVBoxLayout(this);
10 m_clipboard = new QCheckBox(tr("Clipboard"), vb); 10 QVButtonGroup* vb = new QVButtonGroup(fname, this);
11 m_localfile = new QCheckBox(tr("Local file"), vb); 11 tmp->addWidget(vb);
12 m_globalfile = new QCheckBox(tr("Global file"), vb); 12 m_clipboard = new QCheckBox(tr("Clipboard"), vb);
13 if (fs) showMaximized(); 13 m_localfile = new QCheckBox(tr("Local file"), vb);
14} 14 m_globalfile = new QCheckBox(tr("Global file"), vb);
15 if (fs)
16 QPEApplication::showDialog( this );
17}
diff --git a/noncore/apps/opie-reader/fileBrowser.cpp b/noncore/apps/opie-reader/fileBrowser.cpp
index 9cd371d..05f2c31 100644
--- a/noncore/apps/opie-reader/fileBrowser.cpp
+++ b/noncore/apps/opie-reader/fileBrowser.cpp
@@ -21,8 +21,10 @@ Extensive modification by Tim Wentford to allow it to work in rotated mode
21#ifdef _WINDOWS 21#ifdef _WINDOWS
22#include <direct.h> 22#include <direct.h>
23#endif 23#endif
24 24
25#include <qpe/qpeapplication.h>
26
25#include "opie.h" 27#include "opie.h"
26 28
27fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath ) 29fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath )
28 : QDialog( parent, name, true, 30 : QDialog( parent, name, true,
@@ -114,9 +116,10 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo
114 } 116 }
115 117
116 populateList(); 118 populateList();
117 119
118 if (modal) showMaximized(); 120 if (modal)
121 QPEApplication::showDialog( this );
119} 122}
120 123
121void fileBrowser::resizeEvent(QResizeEvent* e) 124void fileBrowser::resizeEvent(QResizeEvent* e)
122{ 125{
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp
index bd98aca..3d3c688 100644
--- a/noncore/apps/opie-sheet/mainwindow.cpp
+++ b/noncore/apps/opie-sheet/mainwindow.cpp
@@ -16,12 +16,15 @@
16 16
17#include <qpe/filemanager.h> 17#include <qpe/filemanager.h>
18#include <qpe/qcopenvelope_qws.h> 18#include <qpe/qcopenvelope_qws.h>
19#include <qpe/resource.h> 19#include <qpe/resource.h>
20#include <qpe/qpeapplication.h>
21
20#include <qmessagebox.h> 22#include <qmessagebox.h>
21#include <qfile.h> 23#include <qfile.h>
22#include <qtranslator.h> 24#include <qtranslator.h>
23#include <qradiobutton.h> 25#include <qradiobutton.h>
26
24#include "cellformat.h" 27#include "cellformat.h"
25#include "numberdlg.h" 28#include "numberdlg.h"
26#include "textdlg.h" 29#include "textdlg.h"
27#include "sortdlg.h" 30#include "sortdlg.h"
@@ -746,9 +749,9 @@ void MainWindow::addFlyAction(const QString &text, const QString &menuText, cons
746 749
747void MainWindow::slotFormatCells() 750void MainWindow::slotFormatCells()
748{ 751{
749 CellFormat dialogCellFormat(this); 752 CellFormat dialogCellFormat(this);
750 dialogCellFormat.showMaximized(); 753 QPEApplication::showDialog( &dialogCellFormat );
751 dialogCellFormat.exec(sheet); 754 dialogCellFormat.exec(sheet);
752} 755}
753 756
754void MainWindow::slotEditPaste() 757void MainWindow::slotEditPaste()
@@ -966,9 +969,9 @@ void MainWindow::slotSheetRemove()
966 969
967void MainWindow::slotDataSort() 970void MainWindow::slotDataSort()
968{ 971{
969 SortDialog dialogSort(this); 972 SortDialog dialogSort(this);
970 dialogSort.showMaximized(); 973 QPEApplication::showDialog( &dialogSort );
971 dialogSort.exec(sheet); 974 dialogSort.exec(sheet);
972} 975}
973 976
974void MainWindow::slotDocModified() 977void MainWindow::slotDocModified()
@@ -1002,7 +1005,7 @@ void MainWindow::slotInsertCells()
1002 1005
1003void MainWindow::slotDataFindReplace() 1006void MainWindow::slotDataFindReplace()
1004{ 1007{
1005 FindDialog dialogFind(this); 1008 FindDialog dialogFind(this);
1006 dialogFind.showMaximized(); 1009 QPEApplication::showDialog( &dialogFind );
1007 dialogFind.exec(sheet); 1010 dialogFind.exec(sheet);
1008} 1011}
diff --git a/noncore/apps/tableviewer/ui/tveditview.cpp b/noncore/apps/tableviewer/ui/tveditview.cpp
index 23e2b42..20a24c8 100644
--- a/noncore/apps/tableviewer/ui/tveditview.cpp
+++ b/noncore/apps/tableviewer/ui/tveditview.cpp
@@ -39,16 +39,18 @@
39#include <qlabel.h> 39#include <qlabel.h>
40#include <qscrollview.h> 40#include <qscrollview.h>
41#include <qsignalmapper.h> 41#include <qsignalmapper.h>
42 42
43TVEditView::TVEditView(TableState *s, DataElem *d, QWidget* parent, 43#include <qpe/qpeapplication.h>
44
45TVEditView::TVEditView(TableState *s, DataElem *d, QWidget* parent,
44 const char *name, WFlags fl ) : QDialog(parent, name, true, fl) 46 const char *name, WFlags fl ) : QDialog(parent, name, true, fl)
45{ 47{
46 if (!name) 48 if (!name)
47 setName("TVEditView"); 49 setName("TVEditView");
48 50
49 QVBoxLayout *layout = new QVBoxLayout(this, 0); /* only so that will resize 51 QVBoxLayout *layout = new QVBoxLayout(this, 0); /* only so that will resize
50 correctly in other 52 correctly in other
51 widgets */ 53 widgets */
52 54
53 toggles = new QSignalMapper(this); 55 toggles = new QSignalMapper(this);
54 QScrollView *sv = new QScrollView(this, 0); 56 QScrollView *sv = new QScrollView(this, 0);
@@ -63,9 +65,9 @@ TVEditView::TVEditView(TableState *s, DataElem *d, QWidget* parent,
63 connect(toggles, SIGNAL(mapped(int)), this, SLOT(toggleEnabled(int))); 65 connect(toggles, SIGNAL(mapped(int)), this, SLOT(toggleEnabled(int)));
64 66
65 setData(s, d); 67 setData(s, d);
66#ifdef Q_WS_QWS 68#ifdef Q_WS_QWS
67 showMaximized(); 69 QPEApplication::showDialog( this );
68#endif 70#endif
69} 71}
70 72
71TVEditView::~TVEditView() 73TVEditView::~TVEditView()
diff --git a/noncore/apps/tableviewer/ui/tvfilterview.cpp b/noncore/apps/tableviewer/ui/tvfilterview.cpp
index 0182127..b03e846 100644
--- a/noncore/apps/tableviewer/ui/tvfilterview.cpp
+++ b/noncore/apps/tableviewer/ui/tvfilterview.cpp
@@ -15,9 +15,9 @@
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "tvfilterview.h" 20#include "tvfilterview.h"
21#include <qtoolbutton.h> 21#include <qtoolbutton.h>
22#include <qcombobox.h> 22#include <qcombobox.h>
23#include <qlistview.h> 23#include <qlistview.h>
@@ -25,9 +25,11 @@
25#include <qheader.h> 25#include <qheader.h>
26#include <qpushbutton.h> 26#include <qpushbutton.h>
27#include <qlabel.h> 27#include <qlabel.h>
28 28
29TVFilterView::TVFilterView(TableState *t, QWidget* parent, 29#include <qpe/qpeapplication.h>
30
31TVFilterView::TVFilterView(TableState *t, QWidget* parent,
30 const char *name, WFlags fl ) : QDialog(parent, name, TRUE, fl) 32 const char *name, WFlags fl ) : QDialog(parent, name, TRUE, fl)
31{ 33{
32 if ( !name ) 34 if ( !name )
33 setName( "Filter View" ); 35 setName( "Filter View" );
@@ -94,9 +96,9 @@ TVFilterView::TVFilterView(TableState *t, QWidget* parent,
94 terms.setAutoDelete(true); 96 terms.setAutoDelete(true);
95 do_filter = false; 97 do_filter = false;
96 98
97#ifdef Q_WS_QWS 99#ifdef Q_WS_QWS
98 showMaximized(); 100 QPEApplication::showDialog( this );
99#endif 101#endif
100} 102}
101 103
102/*! 104/*!
diff --git a/noncore/apps/tableviewer/ui/tvkeyedit.cpp b/noncore/apps/tableviewer/ui/tvkeyedit.cpp
index 4849e87..c22ecd3 100644
--- a/noncore/apps/tableviewer/ui/tvkeyedit.cpp
+++ b/noncore/apps/tableviewer/ui/tvkeyedit.cpp
@@ -25,8 +25,10 @@
25#include <qmessagebox.h> 25#include <qmessagebox.h>
26#include <stdlib.h> 26#include <stdlib.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
28 28
29#include <qpe/qpeapplication.h>
30
29/* QList view item... ?? that can store and update the values that I will 31/* QList view item... ?? that can store and update the values that I will
30 * be changing */ 32 * be changing */
31 33
32class TVKEListViewItem : public QListViewItem 34class TVKEListViewItem : public QListViewItem
@@ -134,21 +136,21 @@ TVKeyEdit::TVKeyEdit(TableState *t, QWidget* parent, const char *name,
134 } 136 }
135 137
136 display->setSorting(0); 138 display->setSorting(0);
137#ifdef Q_WS_QWS 139#ifdef Q_WS_QWS
138 showMaximized(); 140 QPEApplication::showDialog( this );
139#endif 141#endif
140} 142}
141 143
142/*! 144/*!
143 Destroys the TVKeyEdit widget 145 Destroys the TVKeyEdit widget
144*/ 146*/
145TVKeyEdit::~TVKeyEdit() 147TVKeyEdit::~TVKeyEdit()
146{ 148{
147} 149}
148 150
149/* SLOTS */ 151/* SLOTS */
150void TVKeyEdit::newTerm() 152void TVKeyEdit::newTerm()
151{ 153{
152 /* new item, make current Item */ 154 /* new item, make current Item */
153 int i; 155 int i;
154 156
diff --git a/noncore/apps/tinykate/libkate/view/kateview.cpp b/noncore/apps/tinykate/libkate/view/kateview.cpp
index af3b30d..794fbdb 100644
--- a/noncore/apps/tinykate/libkate/view/kateview.cpp
+++ b/noncore/apps/tinykate/libkate/view/kateview.cpp
@@ -83,8 +83,9 @@
83#include "../document/katetextline.h" 83#include "../document/katetextline.h"
84#include "kateviewdialog.h" 84#include "kateviewdialog.h"
85#include "kateundohistory.h" 85#include "kateundohistory.h"
86#include <qlayout.h> 86#include <qlayout.h>
87#include <qpe/qpeapplication.h>
87 88
88KateViewInternal::KateViewInternal(KateView *view, KateDocument *doc) : QWidget(view) 89KateViewInternal::KateViewInternal(KateView *view, KateDocument *doc) : QWidget(view)
89{ 90{
90 waitForPreHighlight=-1; 91 waitForPreHighlight=-1;
@@ -2326,10 +2327,9 @@ void KateView::configDialog()
2326 page=kd->addPage(i18n("Highlighting")); 2327 page=kd->addPage(i18n("Highlighting"));
2327 (new QVBoxLayout(page))->setAutoAdd(true); 2328 (new QVBoxLayout(page))->setAutoAdd(true);
2328 2329
2329 hlPage = new HighlightDialogPage(hlManager, &defaultStyleList, &hlDataList, 0, page); 2330 hlPage = new HighlightDialogPage(hlManager, &defaultStyleList, &hlDataList, 0, page);
2330 kd->showMaximized(); 2331 if ( QPEApplication::execDialog( kd )) {
2331 if (kd->exec()) {
2332 // color options 2332 // color options
2333 colorConfig->getColors(colors); 2333 colorConfig->getColors(colors);
2334 myDoc->setFont (fontConfig->getFont()); 2334 myDoc->setFont (fontConfig->getFont());
2335 2335
diff --git a/noncore/apps/zsafe/scqtfileedit.cpp b/noncore/apps/zsafe/scqtfileedit.cpp
index effd86b..7a3d906 100644
--- a/noncore/apps/zsafe/scqtfileedit.cpp
+++ b/noncore/apps/zsafe/scqtfileedit.cpp
@@ -27,8 +27,10 @@
27#include "qtoolbutton.h" 27#include "qtoolbutton.h"
28 28
29#include "scqtfileedit.h" 29#include "scqtfileedit.h"
30 30
31#include <qpe/qpeapplication.h>
32
31// #define DEBUGFILEEDIT 33// #define DEBUGFILEEDIT
32 34
33/* XPM */ 35/* XPM */
34static const char* const file_xpm[]={ 36static const char* const file_xpm[]={
@@ -157,9 +159,9 @@ ScQtFileEditDlg::ScQtFileEditDlg( QWidget *parent, const char *name,
157 linkIcon = new QPixmap( (const char **)link_file_xpm); 159 linkIcon = new QPixmap( (const char **)link_file_xpm);
158 cdToParentIcon = new QPixmap( (const char **)cdtoparent_xpm); 160 cdToParentIcon = new QPixmap( (const char **)cdtoparent_xpm);
159 161
160#ifdef QWS 162#ifdef QWS
161 showMaximized(); 163 QPEApplication::execDialog( this );
162#endif 164#endif
163 165
164 mkdirflag = false; 166 mkdirflag = false;
165 MkDirButton->setEnabled( false ); 167 MkDirButton->setEnabled( false );
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index ee1da77..bdd2aed 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -774,16 +774,10 @@ void ZSafe::editPwd()
774 dialog->Field5->setText(selectedItem->text (4)); 774 dialog->Field5->setText(selectedItem->text (4));
775 dialog->Field6->setText(selectedItem->text (5)); 775 dialog->Field6->setText(selectedItem->text (5));
776 dialog->CommentField->insertLine(comment); 776 dialog->CommentField->insertLine(comment);
777 dialog->CommentField->setCursorPosition(0,0); 777 dialog->CommentField->setCursorPosition(0,0);
778#ifdef DESKTOP 778
779#ifndef WIN32 779 DialogCode result = (DialogCode) QPEApplication::execDialog( dialog );
780 dialog->show();
781#endif
782#else
783 dialog->showMaximized();
784#endif
785 DialogCode result = (DialogCode) dialog->exec();
786 780
787#ifdef DESKTOP 781#ifdef DESKTOP
788 result = Accepted; 782 result = Accepted;
789#endif 783#endif
@@ -839,23 +833,17 @@ void ZSafe::newPwd()
839 dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); 833 dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
840 dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); 834 dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4")));
841 dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); 835 dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5")));
842retype: 836retype:
843#ifdef DESKTOP 837
844#ifndef WIN32 838 DialogCode result = (DialogCode) QPEApplication::execDialog( dialog );
845 dialog->show();
846#endif
847#else
848 dialog->showMaximized();
849#endif
850 DialogCode result = (DialogCode) dialog->exec();
851#ifdef DESKTOP 839#ifdef DESKTOP
852 result = Accepted; 840 result = Accepted;
853#endif 841#endif
854 842
855 if (result == Accepted) 843 if (result == Accepted)
856 { 844 {
857 845
858 QString name = dialog->NameField->text(); 846 QString name = dialog->NameField->text();
859 if (cat == name) 847 if (cat == name)
860 { 848 {
861 QMessageBox::critical( 0, tr("ZSafe"), 849 QMessageBox::critical( 0, tr("ZSafe"),
@@ -1187,14 +1175,9 @@ void ZSafe::showInfo( QListViewItem *_item)
1187 text += "</body></html>"; 1175 text += "</body></html>";
1188 1176
1189 infoForm->InfoText->setText(text); 1177 infoForm->InfoText->setText(text);
1190 infoForm->hide(); 1178 infoForm->hide();
1191#ifdef DESKTOP 1179 QPEApplication::showDialog( infoForm );
1192 infoForm->show();
1193#else
1194 infoForm->showMaximized();
1195#endif
1196
1197 } 1180 }
1198} 1181}
1199 1182
1200void ZSafe::listViewSelected( QListViewItem *_item) 1183void ZSafe::listViewSelected( QListViewItem *_item)
@@ -1202,9 +1185,9 @@ void ZSafe::listViewSelected( QListViewItem *_item)
1202 if (!_item) 1185 if (!_item)
1203 return; 1186 return;
1204 if (selectedItem != NULL) 1187 if (selectedItem != NULL)
1205 selectedItem->setSelected(FALSE); 1188 selectedItem->setSelected(FALSE);
1206 1189
1207 selectedItem = _item; 1190 selectedItem = _item;
1208 1191
1209#ifndef DESKTOP 1192#ifndef DESKTOP
1210 // set the column text dependent on the selected item 1193 // set the column text dependent on the selected item
diff --git a/noncore/comm/keypebble/kvnc.cpp b/noncore/comm/keypebble/kvnc.cpp
index 25c8919..2fa8d1f 100644
--- a/noncore/comm/keypebble/kvnc.cpp
+++ b/noncore/comm/keypebble/kvnc.cpp
@@ -126,10 +126,9 @@ void KVNC::newConnection()
126{ 126{
127 curServer=new KRFBServer; 127 curServer=new KRFBServer;
128 128
129 KVNCConnDlg dlg( curServer,this); 129 KVNCConnDlg dlg( curServer,this);
130 dlg.showMaximized(); 130 if ( QPEApplication::execDialog( &dlg )) {
131 if (dlg.exec()) {
132 if (!curServer->name.isEmpty()) 131 if (!curServer->name.isEmpty())
133 bookmarkSelector->addBookmark(curServer); 132 bookmarkSelector->addBookmark(curServer);
134 canvas->openConnection(*curServer); 133 canvas->openConnection(*curServer);
135 } else 134 } else
@@ -141,11 +140,9 @@ void KVNC::openConnection( QString name)
141 curServer=bookmarkSelector->getServer(name); 140 curServer=bookmarkSelector->getServer(name);
142 141
143 if (curServer) { 142 if (curServer) {
144 KVNCConnDlg dlg( curServer,this); 143 KVNCConnDlg dlg( curServer,this);
145 dlg.showMaximized(); 144 if ( QPEApplication::execDialog( &dlg ) ) {
146
147 if ( dlg.exec() ) {
148 canvas->openConnection(*curServer); 145 canvas->openConnection(*curServer);
149 bookmarkSelector->writeBookmarks(); 146 bookmarkSelector->writeBookmarks();
150 } else 147 } else
151 curServer=0; 148 curServer=0;