Diffstat (limited to 'noncore/apps/opie-reader/QTReaderApp.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/QTReaderApp.cpp | 279 |
1 files changed, 140 insertions, 139 deletions
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp index b072854..f18cb59 100644 --- a/noncore/apps/opie-reader/QTReaderApp.cpp +++ b/noncore/apps/opie-reader/QTReaderApp.cpp | |||
@@ -8,90 +8,91 @@ | |||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | |||
20 | #include "useqpe.h" | 21 | #include "useqpe.h" |
21 | #include <qregexp.h> | 22 | #include "QTReader.h" |
22 | #include <qclipboard.h> | 23 | #include "GraphicWin.h" |
23 | #include <qwidgetstack.h> | 24 | #include "Bkmks.h" |
25 | #include "cbkmkselector.h" | ||
26 | #include "infowin.h" | ||
27 | #include "ToolbarPrefs.h" | ||
28 | #include "Prefs.h" | ||
29 | #include "CAnnoEdit.h" | ||
30 | #include "QFloatBar.h" | ||
31 | #include "FixedFont.h" | ||
32 | #include "URLDialog.h" | ||
33 | #include "QTReaderApp.h" | ||
34 | #include "CDrawBuffer.h" | ||
35 | #include "Filedata.h" | ||
36 | #include "opie.h" | ||
37 | #include "names.h" | ||
38 | #include "CEncoding_tables.h" | ||
39 | #include "CloseDialog.h" | ||
40 | |||
41 | /* OPIE */ | ||
42 | #include <opie2/odebug.h> | ||
43 | #ifdef USEQPE | ||
44 | #include <qpe/menubutton.h> | ||
45 | #include <qpe/fontdatabase.h> | ||
46 | #include <qpe/global.h> | ||
47 | #include <qpe/applnk.h> | ||
48 | #include <qpe/config.h> | ||
49 | #include <qpe/qcopenvelope_qws.h> | ||
50 | #endif | ||
51 | |||
52 | /* QT */ | ||
24 | #ifdef USEQPE | 53 | #ifdef USEQPE |
25 | #include <qmenubar.h> | 54 | #include <qmenubar.h> |
26 | #include <qtoolbar.h> | 55 | #include <qtoolbar.h> |
27 | #endif | 56 | #endif |
57 | #include <qregexp.h> | ||
58 | #include <qclipboard.h> | ||
59 | #include <qwidgetstack.h> | ||
28 | #include <qmenubar.h> | 60 | #include <qmenubar.h> |
29 | #include <qtoolbar.h> | 61 | #include <qtoolbar.h> |
30 | #ifdef USEQPE | ||
31 | #include <qpe/menubutton.h> | ||
32 | #include <qpe/fontdatabase.h> | ||
33 | #endif | ||
34 | #include <qcombobox.h> | 62 | #include <qcombobox.h> |
35 | #include <qpopupmenu.h> | 63 | #include <qpopupmenu.h> |
36 | #include <qaction.h> | 64 | #include <qaction.h> |
37 | #include <qapplication.h> | 65 | #include <qapplication.h> |
38 | #include <qlineedit.h> | 66 | #include <qlineedit.h> |
39 | #include <qtoolbutton.h> | 67 | #include <qtoolbutton.h> |
40 | #include <qspinbox.h> | 68 | #include <qspinbox.h> |
41 | #include <qobjectlist.h> | 69 | #include <qobjectlist.h> |
42 | #ifdef USEQPE | ||
43 | #include <qpe/global.h> | ||
44 | #include <qpe/applnk.h> | ||
45 | #endif | ||
46 | #include <qfileinfo.h> | 70 | #include <qfileinfo.h> |
47 | #include <stdlib.h> //getenv | ||
48 | #include <qprogressbar.h> | 71 | #include <qprogressbar.h> |
49 | #ifdef USEQPE | ||
50 | #include <qpe/config.h> | ||
51 | #endif | ||
52 | #include <qbuttongroup.h> | 72 | #include <qbuttongroup.h> |
53 | #include <qradiobutton.h> | 73 | #include <qradiobutton.h> |
54 | #ifdef USEQPE | 74 | |
55 | #include <qpe/qcopenvelope_qws.h> | 75 | /* STD */ |
56 | #endif | 76 | #include <stdlib.h> //getenv |
57 | #include "QTReader.h" | 77 | |
58 | #include "GraphicWin.h" | ||
59 | #include "Bkmks.h" | ||
60 | #include "cbkmkselector.h" | ||
61 | #include "infowin.h" | ||
62 | #include "ToolbarPrefs.h" | ||
63 | #include "Prefs.h" | ||
64 | #include "CAnnoEdit.h" | ||
65 | #include "QFloatBar.h" | ||
66 | #include "FixedFont.h" | ||
67 | #include "URLDialog.h" | ||
68 | //#include <qpe/fontdatabase.h> | ||
69 | 78 | ||
70 | #ifdef USEQPE | 79 | #ifdef USEQPE |
71 | #include <qpe/resource.h> | 80 | #include <qpe/resource.h> |
72 | #include <qpe/qpeapplication.h> | 81 | #include <qpe/qpeapplication.h> |
73 | #include "fileBrowser.h" | 82 | #include "fileBrowser.h" |
74 | #else | 83 | #else |
75 | #include "qfiledialog.h" | 84 | #include "qfiledialog.h" |
76 | #endif | 85 | #endif |
77 | 86 | ||
78 | #include "QTReaderApp.h" | ||
79 | #include "CDrawBuffer.h" | ||
80 | #include "Filedata.h" | ||
81 | #include "opie.h" | ||
82 | #include "names.h" | ||
83 | #include "CEncoding_tables.h" | ||
84 | #include "CloseDialog.h" | ||
85 | |||
86 | bool CheckVersion(int&, int&, char&); | 87 | bool CheckVersion(int&, int&, char&); |
87 | 88 | ||
88 | #ifdef _WINDOWS | 89 | #ifdef _WINDOWS |
89 | #define PICDIR "c:\\uqtreader\\pics\\" | 90 | #define PICDIR "c:\\uqtreader\\pics\\" |
90 | #else | 91 | #else |
91 | #ifdef USEQPE | 92 | #ifdef USEQPE |
92 | #define PICDIR "opie-reader/" | 93 | #define PICDIR "opie-reader/" |
93 | #else | 94 | #else |
94 | #define PICDIR "/home/tim/uqtreader/pics/" | 95 | #define PICDIR "/home/tim/uqtreader/pics/" |
95 | #endif | 96 | #endif |
96 | #endif | 97 | #endif |
97 | 98 | ||
@@ -116,46 +117,46 @@ void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); } | |||
116 | #include <dirent.h> | 117 | #include <dirent.h> |
117 | #endif | 118 | #endif |
118 | 119 | ||
119 | void QTReaderApp::listBkmkFiles() | 120 | void QTReaderApp::listBkmkFiles() |
120 | { | 121 | { |
121 | bkmkselector->clear(); | 122 | bkmkselector->clear(); |
122 | bkmkselector->setText("Cancel"); | 123 | bkmkselector->setText("Cancel"); |
123 | #ifndef USEQPE | 124 | #ifndef USEQPE |
124 | int cnt = 0; | 125 | int cnt = 0; |
125 | 126 | ||
126 | QDir d = QDir::home(); // "/" | 127 | QDir d = QDir::home(); // "/" |
127 | if ( !d.cd(APPDIR) ) { // "/tmp" | 128 | if ( !d.cd(APPDIR) ) { // "/tmp" |
128 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 129 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; |
129 | d = QDir::home(); | 130 | d = QDir::home(); |
130 | d.mkdir(APPDIR); | 131 | d.mkdir(APPDIR); |
131 | d.cd(APPDIR); | 132 | d.cd(APPDIR); |
132 | } | 133 | } |
133 | 134 | ||
134 | 135 | ||
135 | 136 | ||
136 | 137 | ||
137 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 138 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
138 | // d.setSorting( QDir::Size | QDir::Reversed ); | 139 | // d.setSorting( QDir::Size | QDir::Reversed ); |
139 | 140 | ||
140 | const QFileInfoList *list = d.entryInfoList(); | 141 | const QFileInfoList *list = d.entryInfoList(); |
141 | QFileInfoListIterator it( *list ); // create list iterator | 142 | QFileInfoListIterator it( *list ); // create list iterator |
142 | QFileInfo *fi; // pointer for traversing | 143 | QFileInfo *fi; // pointer for traversing |
143 | 144 | ||
144 | while ( (fi=it.current()) ) { // for each file... | 145 | while ( (fi=it.current()) ) { // for each file... |
145 | 146 | ||
146 | bkmkselector->insertItem(fi->fileName()); | 147 | bkmkselector->insertItem(fi->fileName()); |
147 | cnt++; | 148 | cnt++; |
148 | 149 | ||
149 | //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); | 150 | //odebug << "" << fi->size() << " " << fi->fileName().data() << "" << oendl; |
150 | ++it; // goto next list element | 151 | ++it; // goto next list element |
151 | } | 152 | } |
152 | 153 | ||
153 | #else /* USEQPE */ | 154 | #else /* USEQPE */ |
154 | int cnt = 0; | 155 | int cnt = 0; |
155 | DIR *d; | 156 | DIR *d; |
156 | d = opendir((const char *)Global::applicationFileName(APPDIR,"")); | 157 | d = opendir((const char *)Global::applicationFileName(APPDIR,"")); |
157 | 158 | ||
158 | while(1) | 159 | while(1) |
159 | { | 160 | { |
160 | struct dirent* de; | 161 | struct dirent* de; |
161 | struct stat buf; | 162 | struct stat buf; |
@@ -205,26 +206,26 @@ void QTReaderApp::hidetoolbars() | |||
205 | searchBar->hide(); | 206 | searchBar->hide(); |
206 | } | 207 | } |
207 | } | 208 | } |
208 | 209 | ||
209 | QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | 210 | QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) |
210 | : QMainWindow( parent, name, f ), bFromDocView( FALSE ), m_dontSave(false), | 211 | : QMainWindow( parent, name, f ), bFromDocView( FALSE ), m_dontSave(false), |
211 | fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL) | 212 | fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL) |
212 | { | 213 | { |
213 | m_url_clipboard = false; | 214 | m_url_clipboard = false; |
214 | m_url_localfile = false; | 215 | m_url_localfile = false; |
215 | m_url_globalfile = false; | 216 | m_url_globalfile = false; |
216 | ftime(&m_lastkeytime); | 217 | ftime(&m_lastkeytime); |
217 | //// qDebug("Application directory = %s", (const tchar *)QPEApplication::documentDir()); | 218 | //// odebug << "Application directory = " << (const tchar *)QPEApplication::documentDir() << "" << oendl; |
218 | //// qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml")); | 219 | //// odebug << "Application directory = " << (const tchar *)Global::applicationFileName("uqtreader" << "" << oendl; |
219 | 220 | ||
220 | m_bcloseDisabled = true; | 221 | m_bcloseDisabled = true; |
221 | m_disableesckey = false; | 222 | m_disableesckey = false; |
222 | pBkmklist = NULL; | 223 | pBkmklist = NULL; |
223 | pOpenlist = NULL; | 224 | pOpenlist = NULL; |
224 | // doc = 0; | 225 | // doc = 0; |
225 | 226 | ||
226 | m_fBkmksChanged = false; | 227 | m_fBkmksChanged = false; |
227 | 228 | ||
228 | QString lang = getenv( "LANG" ); | 229 | QString lang = getenv( "LANG" ); |
229 | QString rot = getenv( "QWS_DISPLAY" ); | 230 | QString rot = getenv( "QWS_DISPLAY" ); |
230 | 231 | ||
@@ -234,48 +235,48 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
234 | { | 235 | { |
235 | m_rot = 90; | 236 | m_rot = 90; |
236 | } | 237 | } |
237 | else if (rot.contains("Rot180")) | 238 | else if (rot.contains("Rot180")) |
238 | { | 239 | { |
239 | m_rot = 180; | 240 | m_rot = 180; |
240 | } | 241 | } |
241 | else if (rot.contains("Rot270")) | 242 | else if (rot.contains("Rot270")) |
242 | { | 243 | { |
243 | m_rot = 270; | 244 | m_rot = 270; |
244 | } | 245 | } |
245 | 246 | ||
246 | // qDebug("Initial Rotation(%d):%s", m_rot, (const char*)rot); | 247 | // odebug << "Initial Rotation(" << m_rot << "):" << rot << "" << oendl; |
247 | */ | 248 | */ |
248 | m_autogenstr = "^ *[A-Z].*[a-z] *$"; | 249 | m_autogenstr = "^ *[A-Z].*[a-z] *$"; |
249 | 250 | ||
250 | #ifdef USEQPE | 251 | #ifdef USEQPE |
251 | setIcon( Resource::loadPixmap( PICDIR "uqtreader") ); | 252 | setIcon( Resource::loadPixmap( PICDIR "uqtreader") ); |
252 | #else | 253 | #else |
253 | setIcon( QPixmap (PICDIR "uqtreader.png") ); | 254 | setIcon( QPixmap (PICDIR "uqtreader.png") ); |
254 | #endif /* USEQPE */ | 255 | #endif /* USEQPE */ |
255 | 256 | ||
256 | // QToolBar *bar = new QToolBar( this ); | 257 | // QToolBar *bar = new QToolBar( this ); |
257 | // menubar = new QToolBar( this ); | 258 | // menubar = new QToolBar( this ); |
258 | #ifdef USEQPE | 259 | #ifdef USEQPE |
259 | Config config( APPDIR ); | 260 | Config config( APPDIR ); |
260 | #else | 261 | #else |
261 | QDir d = QDir::home(); // "/" | 262 | QDir d = QDir::home(); // "/" |
262 | if ( !d.cd(APPDIR) ) { // "/tmp" | 263 | if ( !d.cd(APPDIR) ) { // "/tmp" |
263 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 264 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; |
264 | d = QDir::home(); | 265 | d = QDir::home(); |
265 | d.mkdir(APPDIR); | 266 | d.mkdir(APPDIR); |
266 | d.cd(APPDIR); | 267 | d.cd(APPDIR); |
267 | } | 268 | } |
268 | QFileInfo fi(d, INIFILE); | 269 | QFileInfo fi(d, INIFILE); |
269 | // qDebug("Path:%s", (const char*)fi.absFilePath()); | 270 | // odebug << "Path:" << fi.absFilePath() << "" << oendl; |
270 | Config config(fi.absFilePath()); | 271 | Config config(fi.absFilePath()); |
271 | #endif | 272 | #endif |
272 | config.setGroup("Toolbar"); | 273 | config.setGroup("Toolbar"); |
273 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false); | 274 | m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false); |
274 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1); | 275 | m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1); |
275 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2); | 276 | m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2); |
276 | menubar = new QToolBar("Menus", this, m_tbposition); | 277 | menubar = new QToolBar("Menus", this, m_tbposition); |
277 | 278 | ||
278 | // fileBar = new QToolBar("File", this); | 279 | // fileBar = new QToolBar("File", this); |
279 | // QToolBar* viewBar = new QToolBar("File", this); | 280 | // QToolBar* viewBar = new QToolBar("File", this); |
280 | // QToolBar* navBar = new QToolBar("File", this); | 281 | // QToolBar* navBar = new QToolBar("File", this); |
281 | // QToolBar* markBar = new QToolBar("File", this); | 282 | // QToolBar* markBar = new QToolBar("File", this); |
@@ -347,36 +348,36 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
347 | connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) ); | 348 | connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) ); |
348 | editorStack->addWidget( bkmkselector, get_unique_id() ); | 349 | editorStack->addWidget( bkmkselector, get_unique_id() ); |
349 | 350 | ||
350 | /* | 351 | /* |
351 | importSelector = new FileSelector( "*", editorStack, "importselector", false ); | 352 | importSelector = new FileSelector( "*", editorStack, "importselector", false ); |
352 | connect( importSelector, SIGNAL( fileSelected(const DocLnk&) ), this, SLOT( importFile(const DocLnk&) ) ); | 353 | connect( importSelector, SIGNAL( fileSelected(const DocLnk&) ), this, SLOT( importFile(const DocLnk&) ) ); |
353 | 354 | ||
354 | editorStack->addWidget( importSelector, get_unique_id() ); | 355 | editorStack->addWidget( importSelector, get_unique_id() ); |
355 | 356 | ||
356 | // don't need the close visible, it is redundant... | 357 | // don't need the close visible, it is redundant... |
357 | importSelector->setCloseVisible( FALSE ); | 358 | importSelector->setCloseVisible( FALSE ); |
358 | */ | 359 | */ |
359 | // qDebug("Reading file list"); | 360 | // odebug << "Reading file list" << oendl; |
360 | readfilelist(); | 361 | readfilelist(); |
361 | 362 | ||
362 | reader = new QTReader( editorStack ); | 363 | reader = new QTReader( editorStack ); |
363 | 364 | ||
364 | reader->bDoUpdates = false; | 365 | reader->bDoUpdates = false; |
365 | 366 | ||
366 | #ifdef USEQPE | 367 | #ifdef USEQPE |
367 | ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); | 368 | ((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold); |
368 | #endif | 369 | #endif |
369 | 370 | ||
370 | // qDebug("Reading config"); | 371 | // odebug << "Reading config" << oendl; |
371 | // Config config( APPDIR ); | 372 | // Config config( APPDIR ); |
372 | config.setGroup( "View" ); | 373 | config.setGroup( "View" ); |
373 | m_debounce = config.readNumEntry("Debounce", 0); | 374 | m_debounce = config.readNumEntry("Debounce", 0); |
374 | #ifdef USEQPE | 375 | #ifdef USEQPE |
375 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); | 376 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false); |
376 | #else | 377 | #else |
377 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true); | 378 | m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true); |
378 | #endif | 379 | #endif |
379 | reader->bstripcr = config.readBoolEntry( "StripCr", true ); | 380 | reader->bstripcr = config.readBoolEntry( "StripCr", true ); |
380 | reader->bfulljust = config.readBoolEntry( "FullJust", false ); | 381 | reader->bfulljust = config.readBoolEntry( "FullJust", false ); |
381 | reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 )); | 382 | reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 )); |
382 | reader->setlead(config.readNumEntry( "ExtraLead", 0 )); | 383 | reader->setlead(config.readNumEntry( "ExtraLead", 0 )); |
@@ -760,25 +761,25 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
760 | a->addTo( regBar ); | 761 | a->addTo( regBar ); |
761 | 762 | ||
762 | 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 ); |
763 | connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) ); | 764 | connect( a, SIGNAL( activated() ), this, SLOT( regClose() ) ); |
764 | a->addTo( regBar ); | 765 | a->addTo( regBar ); |
765 | 766 | ||
766 | regBar->hide(); | 767 | regBar->hide(); |
767 | 768 | ||
768 | m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE ); | 769 | m_fontBar = new QToolBar( "Autogen", this, QMainWindow::Top, TRUE ); |
769 | 770 | ||
770 | m_fontBar->setHorizontalStretchable( TRUE ); | 771 | m_fontBar->setHorizontalStretchable( TRUE ); |
771 | 772 | ||
772 | // qDebug("Font selector"); | 773 | // odebug << "Font selector" << oendl; |
773 | m_fontSelector = new QComboBox(false, m_fontBar); | 774 | m_fontSelector = new QComboBox(false, m_fontBar); |
774 | m_fontBar->setStretchableWidget( m_fontSelector ); | 775 | m_fontBar->setStretchableWidget( m_fontSelector ); |
775 | { | 776 | { |
776 | #ifndef USEQPE | 777 | #ifndef USEQPE |
777 | QFontDatabase f; | 778 | QFontDatabase f; |
778 | #else | 779 | #else |
779 | FontDatabase f; | 780 | FontDatabase f; |
780 | #endif | 781 | #endif |
781 | QStringList flist = f.families(); | 782 | QStringList flist = f.families(); |
782 | bool realfont = false; | 783 | bool realfont = false; |
783 | for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) | 784 | for (QStringList::Iterator nm = flist.begin(); nm != flist.end(); nm++) |
784 | { | 785 | { |
@@ -792,94 +793,94 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
792 | } // delete the FontDatabase!!! | 793 | } // delete the FontDatabase!!! |
793 | connect( m_fontSelector, SIGNAL( activated(const QString&) ), | 794 | connect( m_fontSelector, SIGNAL( activated(const QString&) ), |
794 | this, SLOT( do_setfont(const QString&) ) ); | 795 | this, SLOT( do_setfont(const QString&) ) ); |
795 | connect( m_fontSelector, SIGNAL( activated(int) ), | 796 | connect( m_fontSelector, SIGNAL( activated(int) ), |
796 | this, SLOT( do_setencoding(int) ) ); | 797 | this, SLOT( do_setencoding(int) ) ); |
797 | 798 | ||
798 | m_fontBar->hide(); | 799 | m_fontBar->hide(); |
799 | m_fontVisible = false; | 800 | m_fontVisible = false; |
800 | #ifdef USEMSGS | 801 | #ifdef USEMSGS |
801 | connect(qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), | 802 | connect(qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), |
802 | this, SLOT( msgHandler(const QCString&,const QByteArray&) ) ); | 803 | this, SLOT( msgHandler(const QCString&,const QByteArray&) ) ); |
803 | #endif | 804 | #endif |
804 | // qDebug("Initing"); | 805 | // odebug << "Initing" << oendl; |
805 | reader->init(); | 806 | reader->init(); |
806 | // qDebug("Inited"); | 807 | // odebug << "Inited" << oendl; |
807 | // m_buttonAction[m_spaceTarget]->setOn(true); | 808 | // m_buttonAction[m_spaceTarget]->setOn(true); |
808 | // qDebug("fonting"); | 809 | // odebug << "fonting" << oendl; |
809 | do_setfont(reader->m_fontname); | 810 | do_setfont(reader->m_fontname); |
810 | if (!reader->m_lastfile.isEmpty()) | 811 | if (!reader->m_lastfile.isEmpty()) |
811 | { | 812 | { |
812 | //qDebug("doclnk"); | 813 | // odebug << "doclnk" << oendl; |
813 | //doc = new DocLnk(reader->m_lastfile); | 814 | //doc = new DocLnk(reader->m_lastfile); |
814 | //qDebug("doclnk done"); | 815 | // odebug << "doclnk done" << oendl; |
815 | if (pOpenlist != NULL) | 816 | if (pOpenlist != NULL) |
816 | { | 817 | { |
817 | 818 | ||
818 | /* | 819 | /* |
819 | int ind = 0; | 820 | int ind = 0; |
820 | Bkmk* p = (*pOpenlist)[ind]; | 821 | Bkmk* p = (*pOpenlist)[ind]; |
821 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) | 822 | while (p != NULL && toQString(CFiledata(p->anno()).name()) != reader->m_lastfile) |
822 | { | 823 | { |
823 | p = (*pOpenlist)[++ind]; | 824 | p = (*pOpenlist)[++ind]; |
824 | } | 825 | } |
825 | */ | 826 | */ |
826 | Bkmk* p = NULL; | 827 | Bkmk* p = NULL; |
827 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) | 828 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) |
828 | { | 829 | { |
829 | p = iter.pContent(); | 830 | p = iter.pContent(); |
830 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) | 831 | if (toQString(CFiledata(p->anno()).name()) == reader->m_lastfile) |
831 | { | 832 | { |
832 | break; | 833 | break; |
833 | } | 834 | } |
834 | // qDebug("Item:%s", (const char*)toQString(CFiledata(p->anno()).name())); | 835 | // odebug << "Item:" << toQString(CFiledata(p->anno()).name()) << "" << oendl; |
835 | p = NULL; | 836 | p = NULL; |
836 | } | 837 | } |
837 | if (p != NULL) | 838 | if (p != NULL) |
838 | { | 839 | { |
839 | //qDebug("openfrombkmk"); | 840 | // odebug << "openfrombkmk" << oendl; |
840 | if (!openfrombkmk(p)) | 841 | if (!openfrombkmk(p)) |
841 | showEditTools(); | 842 | showEditTools(); |
842 | } | 843 | } |
843 | else | 844 | else |
844 | { | 845 | { |
845 | //qDebug("openfile"); | 846 | // odebug << "openfile" << oendl; |
846 | openFile( reader->m_lastfile ); | 847 | openFile( reader->m_lastfile ); |
847 | } | 848 | } |
848 | } | 849 | } |
849 | else | 850 | else |
850 | { | 851 | { |
851 | // qDebug("Openfile 2"); | 852 | // odebug << "Openfile 2" << oendl; |
852 | if (!reader->m_lastfile.isEmpty()) | 853 | if (!reader->m_lastfile.isEmpty()) |
853 | openFile( reader->m_lastfile ); | 854 | openFile( reader->m_lastfile ); |
854 | } | 855 | } |
855 | } | 856 | } |
856 | else | 857 | else |
857 | { | 858 | { |
858 | showEditTools(); | 859 | showEditTools(); |
859 | } | 860 | } |
860 | // qApp->processEvents(); | 861 | // qApp->processEvents(); |
861 | reader->bDoUpdates = true; | 862 | reader->bDoUpdates = true; |
862 | reader->update(); | 863 | reader->update(); |
863 | config.setGroup("Version"); | 864 | config.setGroup("Version"); |
864 | int major = config.readNumEntry("Major", 0); | 865 | int major = config.readNumEntry("Major", 0); |
865 | int bkmktype = config.readNumEntry("BkmkType", 0); | 866 | int bkmktype = config.readNumEntry("BkmkType", 0); |
866 | char minor = config.readNumEntry("Minor", 0); | 867 | char minor = config.readNumEntry("Minor", 0); |
867 | if (CheckVersion(major, bkmktype, minor)) | 868 | if (CheckVersion(major, bkmktype, minor)) |
868 | { | 869 | { |
869 | config.writeEntry("Major", major); | 870 | config.writeEntry("Major", major); |
870 | config.writeEntry("BkmkType", bkmktype); | 871 | config.writeEntry("BkmkType", bkmktype); |
871 | config.writeEntry("Minor", (int)minor); | 872 | config.writeEntry("Minor", (int)minor); |
872 | } | 873 | } |
873 | // qDebug("finished update"); | 874 | // odebug << "finished update" << oendl; |
874 | } | 875 | } |
875 | 876 | ||
876 | void QTReaderApp::addtoolbars(Config* config) | 877 | void QTReaderApp::addtoolbars(Config* config) |
877 | { | 878 | { |
878 | config->setGroup("Toolbar"); | 879 | config->setGroup("Toolbar"); |
879 | 880 | ||
880 | if (fileBar != NULL) | 881 | if (fileBar != NULL) |
881 | { | 882 | { |
882 | if (fileBar != menubar) | 883 | if (fileBar != menubar) |
883 | { | 884 | { |
884 | fileBar->clear(); | 885 | fileBar->clear(); |
885 | } | 886 | } |
@@ -1019,90 +1020,90 @@ bool QTReaderApp::checkbar(Config* _config, const QString& key) | |||
1019 | { | 1020 | { |
1020 | return _config->readBoolEntry(key, false); | 1021 | return _config->readBoolEntry(key, false); |
1021 | } | 1022 | } |
1022 | 1023 | ||
1023 | 1024 | ||
1024 | QToolBar* QTReaderApp::filebar() | 1025 | QToolBar* QTReaderApp::filebar() |
1025 | { | 1026 | { |
1026 | if (fileBar == NULL) | 1027 | if (fileBar == NULL) |
1027 | { | 1028 | { |
1028 | switch (m_tbpol) | 1029 | switch (m_tbpol) |
1029 | { | 1030 | { |
1030 | case cesSingle: | 1031 | case cesSingle: |
1031 | // qDebug("Setting filebar to menubar"); | 1032 | // odebug << "Setting filebar to menubar" << oendl; |
1032 | fileBar = menubar; | 1033 | fileBar = menubar; |
1033 | break; | 1034 | break; |
1034 | default: | 1035 | default: |
1035 | qDebug("Incorrect toolbar policy set"); | 1036 | odebug << "Incorrect toolbar policy set" << oendl; |
1036 | case cesMenuTool: | 1037 | case cesMenuTool: |
1037 | case cesMultiple: | 1038 | case cesMultiple: |
1038 | // qDebug("Creating new file bar"); | 1039 | // odebug << "Creating new file bar" << oendl; |
1039 | fileBar = new QToolBar("File", this, m_tbposition); | 1040 | fileBar = new QToolBar("File", this, m_tbposition); |
1040 | break; | 1041 | break; |
1041 | } | 1042 | } |
1042 | //fileBar->setHorizontalStretchable( true ); | 1043 | //fileBar->setHorizontalStretchable( true ); |
1043 | } | 1044 | } |
1044 | return fileBar; | 1045 | return fileBar; |
1045 | } | 1046 | } |
1046 | QToolBar* QTReaderApp::viewbar() | 1047 | QToolBar* QTReaderApp::viewbar() |
1047 | { | 1048 | { |
1048 | if (viewBar == NULL) | 1049 | if (viewBar == NULL) |
1049 | { | 1050 | { |
1050 | switch (m_tbpol) | 1051 | switch (m_tbpol) |
1051 | { | 1052 | { |
1052 | case cesMultiple: | 1053 | case cesMultiple: |
1053 | viewBar = new QToolBar("View", this, m_tbposition); | 1054 | viewBar = new QToolBar("View", this, m_tbposition); |
1054 | break; | 1055 | break; |
1055 | default: | 1056 | default: |
1056 | qDebug("Incorrect toolbar policy set"); | 1057 | odebug << "Incorrect toolbar policy set" << oendl; |
1057 | case cesSingle: | 1058 | case cesSingle: |
1058 | case cesMenuTool: | 1059 | case cesMenuTool: |
1059 | viewBar = fileBar; | 1060 | viewBar = fileBar; |
1060 | break; | 1061 | break; |
1061 | } | 1062 | } |
1062 | } | 1063 | } |
1063 | return viewBar; | 1064 | return viewBar; |
1064 | } | 1065 | } |
1065 | QToolBar* QTReaderApp::navbar() | 1066 | QToolBar* QTReaderApp::navbar() |
1066 | { | 1067 | { |
1067 | if (navBar == NULL) | 1068 | if (navBar == NULL) |
1068 | { | 1069 | { |
1069 | switch (m_tbpol) | 1070 | switch (m_tbpol) |
1070 | { | 1071 | { |
1071 | case cesMultiple: | 1072 | case cesMultiple: |
1072 | // qDebug("Creating new nav bar"); | 1073 | // odebug << "Creating new nav bar" << oendl; |
1073 | navBar = new QToolBar("Navigation", this, m_tbposition); | 1074 | navBar = new QToolBar("Navigation", this, m_tbposition); |
1074 | break; | 1075 | break; |
1075 | default: | 1076 | default: |
1076 | qDebug("Incorrect toolbar policy set"); | 1077 | odebug << "Incorrect toolbar policy set" << oendl; |
1077 | case cesSingle: | 1078 | case cesSingle: |
1078 | case cesMenuTool: | 1079 | case cesMenuTool: |
1079 | navBar = fileBar; | 1080 | navBar = fileBar; |
1080 | // qDebug("Setting navbar to filebar"); | 1081 | // odebug << "Setting navbar to filebar" << oendl; |
1081 | break; | 1082 | break; |
1082 | } | 1083 | } |
1083 | } | 1084 | } |
1084 | return navBar; | 1085 | return navBar; |
1085 | } | 1086 | } |
1086 | QToolBar* QTReaderApp::markbar() | 1087 | QToolBar* QTReaderApp::markbar() |
1087 | { | 1088 | { |
1088 | if (markBar == NULL) | 1089 | if (markBar == NULL) |
1089 | { | 1090 | { |
1090 | switch (m_tbpol) | 1091 | switch (m_tbpol) |
1091 | { | 1092 | { |
1092 | case cesMultiple: | 1093 | case cesMultiple: |
1093 | markBar = new QToolBar("Marks", this, m_tbposition); | 1094 | markBar = new QToolBar("Marks", this, m_tbposition); |
1094 | break; | 1095 | break; |
1095 | default: | 1096 | default: |
1096 | qDebug("Incorrect toolbar policy set"); | 1097 | odebug << "Incorrect toolbar policy set" << oendl; |
1097 | case cesSingle: | 1098 | case cesSingle: |
1098 | case cesMenuTool: | 1099 | case cesMenuTool: |
1099 | markBar = fileBar; | 1100 | markBar = fileBar; |
1100 | break; | 1101 | break; |
1101 | } | 1102 | } |
1102 | } | 1103 | } |
1103 | return markBar; | 1104 | return markBar; |
1104 | } | 1105 | } |
1105 | 1106 | ||
1106 | void QTReaderApp::addfilebar(Config* _config, const QString& key, QAction* a) | 1107 | void QTReaderApp::addfilebar(Config* _config, const QString& key, QAction* a) |
1107 | { | 1108 | { |
1108 | if (_config->readBoolEntry(key, false)) a->addTo( filebar() ); | 1109 | if (_config->readBoolEntry(key, false)) a->addTo( filebar() ); |
@@ -1118,25 +1119,25 @@ void QTReaderApp::addmarkbar(Config* _config, const QString& key, QAction* a) | |||
1118 | void QTReaderApp::addviewbar(Config* _config, const QString& key, QAction* a) | 1119 | void QTReaderApp::addviewbar(Config* _config, const QString& key, QAction* a) |
1119 | { | 1120 | { |
1120 | if (_config->readBoolEntry(key, false)) a->addTo( viewbar() ); | 1121 | if (_config->readBoolEntry(key, false)) a->addTo( viewbar() ); |
1121 | } | 1122 | } |
1122 | 1123 | ||
1123 | void QTReaderApp::suspend() { reader->suspend(); } | 1124 | void QTReaderApp::suspend() { reader->suspend(); } |
1124 | 1125 | ||
1125 | #ifdef USEMSGS | 1126 | #ifdef USEMSGS |
1126 | void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data) | 1127 | void QTReaderApp::msgHandler(const QCString& _msg, const QByteArray& _data) |
1127 | { | 1128 | { |
1128 | QString msg = QString::fromUtf8(_msg); | 1129 | QString msg = QString::fromUtf8(_msg); |
1129 | 1130 | ||
1130 | //// qDebug("Received:%s", (const char*)msg); | 1131 | //// odebug << "Received:" << msg << "" << oendl; |
1131 | 1132 | ||
1132 | QDataStream stream( _data, IO_ReadOnly ); | 1133 | QDataStream stream( _data, IO_ReadOnly ); |
1133 | if ( msg == "info(QString)" ) | 1134 | if ( msg == "info(QString)" ) |
1134 | { | 1135 | { |
1135 | QString info; | 1136 | QString info; |
1136 | stream >> info; | 1137 | stream >> info; |
1137 | QMessageBox::information(this, PROGNAME, info); | 1138 | QMessageBox::information(this, PROGNAME, info); |
1138 | } | 1139 | } |
1139 | else if ( msg == "Update(int)" ) | 1140 | else if ( msg == "Update(int)" ) |
1140 | { | 1141 | { |
1141 | int info; | 1142 | int info; |
1142 | stream >> info; | 1143 | stream >> info; |
@@ -1472,25 +1473,25 @@ ActionTypes QTReaderApp::ActNameToInt(const QString& _enc) | |||
1472 | void QTReaderApp::setfullscreen(bool sfs) | 1473 | void QTReaderApp::setfullscreen(bool sfs) |
1473 | { | 1474 | { |
1474 | reader->bDoUpdates = false; | 1475 | reader->bDoUpdates = false; |
1475 | m_fullscreen = sfs; | 1476 | m_fullscreen = sfs; |
1476 | showEditTools(); | 1477 | showEditTools(); |
1477 | // qApp->processEvents(); | 1478 | // qApp->processEvents(); |
1478 | reader->bDoUpdates = true; | 1479 | reader->bDoUpdates = true; |
1479 | reader->update(); | 1480 | reader->update(); |
1480 | } | 1481 | } |
1481 | 1482 | ||
1482 | void QTReaderApp::buttonActionSelected(QAction* _a) | 1483 | void QTReaderApp::buttonActionSelected(QAction* _a) |
1483 | { | 1484 | { |
1484 | //// qDebug("es:%x : %s (%u)", _a, (const char *)(_a->text()), ActNameToInt(_a->text())); | 1485 | //// odebug << "es:" << _a << " : " << (const char *)(_a->text()) << " (" << ActNameToInt(_a->text()) << ")" << oendl; |
1485 | m_spaceTarget = ActNameToInt(_a->text()); | 1486 | m_spaceTarget = ActNameToInt(_a->text()); |
1486 | } | 1487 | } |
1487 | 1488 | ||
1488 | QTReaderApp::~QTReaderApp() | 1489 | QTReaderApp::~QTReaderApp() |
1489 | { | 1490 | { |
1490 | } | 1491 | } |
1491 | 1492 | ||
1492 | void QTReaderApp::autoScroll(bool _b) | 1493 | void QTReaderApp::autoScroll(bool _b) |
1493 | { | 1494 | { |
1494 | reader->setautoscroll(_b); | 1495 | reader->setautoscroll(_b); |
1495 | setScrollState(reader->m_autoScroll); | 1496 | setScrollState(reader->m_autoScroll); |
1496 | } | 1497 | } |
@@ -1554,73 +1555,73 @@ void QTReaderApp::fileClose() | |||
1554 | 1555 | ||
1555 | fileOpen2(); | 1556 | fileOpen2(); |
1556 | } | 1557 | } |
1557 | delete cd; | 1558 | delete cd; |
1558 | } | 1559 | } |
1559 | 1560 | ||
1560 | void QTReaderApp::updatefileinfo() | 1561 | void QTReaderApp::updatefileinfo() |
1561 | { | 1562 | { |
1562 | if (reader->m_string.isEmpty()) return; | 1563 | if (reader->m_string.isEmpty()) return; |
1563 | if (reader->m_lastfile.isEmpty()) return; | 1564 | if (reader->m_lastfile.isEmpty()) return; |
1564 | tchar* nm = fromQString(reader->m_string); | 1565 | tchar* nm = fromQString(reader->m_string); |
1565 | tchar* fl = fromQString(reader->m_lastfile); | 1566 | tchar* fl = fromQString(reader->m_lastfile); |
1566 | // qDebug("Lastfile:%x", fl); | 1567 | // odebug << "Lastfile:" << fl << "" << oendl; |
1567 | bool notadded = true; | 1568 | bool notadded = true; |
1568 | if (pOpenlist == NULL) pOpenlist = new CList<Bkmk>; | 1569 | if (pOpenlist == NULL) pOpenlist = new CList<Bkmk>; |
1569 | else | 1570 | else |
1570 | { | 1571 | { |
1571 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) | 1572 | for (CList<Bkmk>::iterator iter = pOpenlist->begin(); iter != pOpenlist->end(); iter++) |
1572 | { | 1573 | { |
1573 | if (ustrcmp(CFiledata(iter->anno()).name(), fl) == 0) | 1574 | if (ustrcmp(CFiledata(iter->anno()).name(), fl) == 0) |
1574 | { | 1575 | { |
1575 | iter->value(reader->pagelocate()); | 1576 | iter->value(reader->pagelocate()); |
1576 | unsigned short dlen; | 1577 | unsigned short dlen; |
1577 | unsigned char* data; | 1578 | unsigned char* data; |
1578 | CFiledata fd(iter->anno()); | 1579 | CFiledata fd(iter->anno()); |
1579 | reader->setSaveData(data, dlen, fd.content(), fd.length()); | 1580 | reader->setSaveData(data, dlen, fd.content(), fd.length()); |
1580 | // qDebug("Filedata(1):%u, %u", fd.length(), dlen); | 1581 | // odebug << "Filedata(1):" << fd.length() << ", " << dlen << "" << oendl; |
1581 | // getstate(data, dlen); | 1582 | // getstate(data, dlen); |
1582 | iter->setAnno(data, dlen); | 1583 | iter->setAnno(data, dlen); |
1583 | notadded = false; | 1584 | notadded = false; |
1584 | delete [] data; | 1585 | delete [] data; |
1585 | break; | 1586 | break; |
1586 | } | 1587 | } |
1587 | } | 1588 | } |
1588 | } | 1589 | } |
1589 | // qDebug("Added?:%x", notadded); | 1590 | // odebug << "Added?:" << notadded << "" << oendl; |
1590 | if (notadded) | 1591 | if (notadded) |
1591 | { | 1592 | { |
1592 | struct stat fnstat; | 1593 | struct stat fnstat; |
1593 | stat((const char *)reader->m_lastfile, &fnstat); | 1594 | stat((const char *)reader->m_lastfile, &fnstat); |
1594 | CFiledata fd(fnstat.st_mtime, fl); | 1595 | CFiledata fd(fnstat.st_mtime, fl); |
1595 | unsigned short dlen; | 1596 | unsigned short dlen; |
1596 | unsigned char* data; | 1597 | unsigned char* data; |
1597 | reader->setSaveData(data, dlen, fd.content(), fd.length()); | 1598 | reader->setSaveData(data, dlen, fd.content(), fd.length()); |
1598 | pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate())); | 1599 | pOpenlist->push_front(Bkmk(nm, data, dlen, reader->pagelocate())); |
1599 | //qDebug("Filedata(2):%u, %u", fd.length(), dlen); | 1600 | // odebug << "Filedata(2):" << fd.length() << ", " << dlen << "" << oendl; |
1600 | delete [] data; | 1601 | delete [] data; |
1601 | } | 1602 | } |
1602 | delete [] nm; | 1603 | delete [] nm; |
1603 | delete [] fl; | 1604 | delete [] fl; |
1604 | } | 1605 | } |
1605 | 1606 | ||
1606 | void QTReaderApp::fileOpen() | 1607 | void QTReaderApp::fileOpen() |
1607 | { | 1608 | { |
1608 | /* | 1609 | /* |
1609 | menu->hide(); | 1610 | menu->hide(); |
1610 | fileBar->hide(); | 1611 | fileBar->hide(); |
1611 | if (regVisible) regBar->hide(); | 1612 | if (regVisible) regBar->hide(); |
1612 | if (searchVisible) searchBar->hide(); | 1613 | if (searchVisible) searchBar->hide(); |
1613 | */ | 1614 | */ |
1614 | // qDebug("fileOpen"); | 1615 | // odebug << "fileOpen" << oendl; |
1615 | // if (!reader->m_lastfile.isEmpty()) | 1616 | // if (!reader->m_lastfile.isEmpty()) |
1616 | updatefileinfo(); | 1617 | updatefileinfo(); |
1617 | fileOpen2(); | 1618 | fileOpen2(); |
1618 | } | 1619 | } |
1619 | 1620 | ||
1620 | void QTReaderApp::fileOpen2() | 1621 | void QTReaderApp::fileOpen2() |
1621 | { | 1622 | { |
1622 | if (pBkmklist != NULL) | 1623 | if (pBkmklist != NULL) |
1623 | { | 1624 | { |
1624 | if (m_fBkmksChanged) | 1625 | if (m_fBkmksChanged) |
1625 | { | 1626 | { |
1626 | 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) |
@@ -1643,45 +1644,45 @@ void QTReaderApp::fileOpen2() | |||
1643 | } | 1644 | } |
1644 | if (usebrowser) | 1645 | if (usebrowser) |
1645 | { | 1646 | { |
1646 | QString fn = usefilebrowser(); | 1647 | QString fn = usefilebrowser(); |
1647 | //qApp->processEvents(); | 1648 | //qApp->processEvents(); |
1648 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) | 1649 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) |
1649 | { | 1650 | { |
1650 | openFile(fn); | 1651 | openFile(fn); |
1651 | } | 1652 | } |
1652 | reader->setFocus(); | 1653 | reader->setFocus(); |
1653 | } | 1654 | } |
1654 | // reader->refresh(); | 1655 | // reader->refresh(); |
1655 | // qDebug("HEIGHT:%d", reader->m_lastheight); | 1656 | // odebug << "HEIGHT:" << reader->m_lastheight << "" << oendl; |
1656 | } | 1657 | } |
1657 | 1658 | ||
1658 | QString QTReaderApp::usefilebrowser() | 1659 | QString QTReaderApp::usefilebrowser() |
1659 | { | 1660 | { |
1660 | #ifndef USEQPE | 1661 | #ifndef USEQPE |
1661 | QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) ); | 1662 | QString s( QFileDialog::getOpenFileName( reader->m_lastfile, QString::null, this ) ); |
1662 | return s; | 1663 | return s; |
1663 | #else | 1664 | #else |
1664 | fileBrowser* fb = new fileBrowser(false, this,"OpieReader",!m_bFloatingDialog, | 1665 | fileBrowser* fb = new fileBrowser(false, this,"OpieReader",!m_bFloatingDialog, |
1665 | 0, | 1666 | 0, |
1666 | // WStyle_Customize | WStyle_NoBorderEx, | 1667 | // WStyle_Customize | WStyle_NoBorderEx, |
1667 | "*", QFileInfo(reader->m_lastfile).dirPath(true)); | 1668 | "*", QFileInfo(reader->m_lastfile).dirPath(true)); |
1668 | 1669 | ||
1669 | 1670 | ||
1670 | QString fn; | 1671 | QString fn; |
1671 | if (fb->exec()) | 1672 | if (fb->exec()) |
1672 | { | 1673 | { |
1673 | fn = fb->getCurrentFile(); | 1674 | fn = fb->getCurrentFile(); |
1674 | } | 1675 | } |
1675 | // qDebug("Selected %s", (const char*)fn); | 1676 | // odebug << "Selected " << fn << "" << oendl; |
1676 | delete fb; | 1677 | delete fb; |
1677 | showEditTools(); | 1678 | showEditTools(); |
1678 | return fn; | 1679 | return fn; |
1679 | #endif | 1680 | #endif |
1680 | } | 1681 | } |
1681 | 1682 | ||
1682 | void QTReaderApp::showgraphic(QImage& pm) | 1683 | void QTReaderApp::showgraphic(QImage& pm) |
1683 | { | 1684 | { |
1684 | QPixmap pc; | 1685 | QPixmap pc; |
1685 | pc.convertFromImage(pm); | 1686 | pc.convertFromImage(pm); |
1686 | m_graphicwin->setPixmap(pc); | 1687 | m_graphicwin->setPixmap(pc); |
1687 | editorStack->raiseWidget( m_graphicwin ); | 1688 | editorStack->raiseWidget( m_graphicwin ); |
@@ -1794,25 +1795,25 @@ void QTReaderApp::showprefs() | |||
1794 | case 1: | 1795 | case 1: |
1795 | break; | 1796 | break; |
1796 | case 2: | 1797 | case 2: |
1797 | reader->btextfmt = true; | 1798 | reader->btextfmt = true; |
1798 | break; | 1799 | break; |
1799 | case 3: | 1800 | case 3: |
1800 | reader->bstriphtml = true; | 1801 | reader->bstriphtml = true; |
1801 | break; | 1802 | break; |
1802 | case 4: | 1803 | case 4: |
1803 | reader->bpeanut = true; | 1804 | reader->bpeanut = true; |
1804 | break; | 1805 | break; |
1805 | default: | 1806 | default: |
1806 | qDebug("Format out of range"); | 1807 | odebug << "Format out of range" << oendl; |
1807 | } | 1808 | } |
1808 | reader->bdepluck = prefwin->Depluck(); | 1809 | reader->bdepluck = prefwin->Depluck(); |
1809 | reader->bdejpluck = prefwin->Dejpluck(); | 1810 | reader->bdejpluck = prefwin->Dejpluck(); |
1810 | reader->setContinuous(prefwin->Continuous()); | 1811 | reader->setContinuous(prefwin->Continuous()); |
1811 | 1812 | ||
1812 | m_spaceTarget = (ActionTypes)prefwin->spaceAction(); | 1813 | m_spaceTarget = (ActionTypes)prefwin->spaceAction(); |
1813 | m_escapeTarget = (ActionTypes)prefwin->escapeAction(); | 1814 | m_escapeTarget = (ActionTypes)prefwin->escapeAction(); |
1814 | m_returnTarget = (ActionTypes)prefwin->returnAction(); | 1815 | m_returnTarget = (ActionTypes)prefwin->returnAction(); |
1815 | m_leftTarget = (ActionTypes)prefwin->leftAction(); | 1816 | m_leftTarget = (ActionTypes)prefwin->leftAction(); |
1816 | m_rightTarget = (ActionTypes)prefwin->rightAction(); | 1817 | m_rightTarget = (ActionTypes)prefwin->rightAction(); |
1817 | m_upTarget = (ActionTypes)prefwin->upAction(); | 1818 | m_upTarget = (ActionTypes)prefwin->upAction(); |
1818 | m_downTarget = (ActionTypes)prefwin->downAction(); | 1819 | m_downTarget = (ActionTypes)prefwin->downAction(); |
@@ -1854,25 +1855,25 @@ void QTReaderApp::showprefs() | |||
1854 | } | 1855 | } |
1855 | } | 1856 | } |
1856 | 1857 | ||
1857 | void QTReaderApp::showtoolbarprefs() | 1858 | void QTReaderApp::showtoolbarprefs() |
1858 | { | 1859 | { |
1859 | #ifdef USEQPE | 1860 | #ifdef USEQPE |
1860 | CBarPrefs* prefwin = new CBarPrefs(APPDIR, !m_bFloatingDialog, this); | 1861 | CBarPrefs* prefwin = new CBarPrefs(APPDIR, !m_bFloatingDialog, this); |
1861 | #else | 1862 | #else |
1862 | QFileInfo fi; | 1863 | QFileInfo fi; |
1863 | QDir d = QDir::home(); // "/" | 1864 | QDir d = QDir::home(); // "/" |
1864 | if ( !d.cd(APPDIR) ) | 1865 | if ( !d.cd(APPDIR) ) |
1865 | { // "/tmp" | 1866 | { // "/tmp" |
1866 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); | 1867 | owarn << "Cannot find the \"~/" << APPDIR << "\" directory" << oendl; |
1867 | d = QDir::home(); | 1868 | d = QDir::home(); |
1868 | d.mkdir(APPDIR); | 1869 | d.mkdir(APPDIR); |
1869 | d.cd(APPDIR); | 1870 | d.cd(APPDIR); |
1870 | } | 1871 | } |
1871 | fi.setFile(d, INIFILE); | 1872 | fi.setFile(d, INIFILE); |
1872 | CBarPrefs* prefwin = new CBarPrefs(fi.absFilePath(), !m_bFloatingDialog, this); | 1873 | CBarPrefs* prefwin = new CBarPrefs(fi.absFilePath(), !m_bFloatingDialog, this); |
1873 | #endif | 1874 | #endif |
1874 | prefwin->tbpolicy(m_tbpolsave); | 1875 | prefwin->tbpolicy(m_tbpolsave); |
1875 | prefwin->tbposition(m_tbposition-2); | 1876 | prefwin->tbposition(m_tbposition-2); |
1876 | prefwin->tbmovable(m_tbmovesave); | 1877 | prefwin->tbmovable(m_tbmovesave); |
1877 | prefwin->floating(m_bFloatingDialog); | 1878 | prefwin->floating(m_bFloatingDialog); |
1878 | if (prefwin->exec()) | 1879 | if (prefwin->exec()) |
@@ -1891,25 +1892,25 @@ void QTReaderApp::showtoolbarprefs() | |||
1891 | m_tbpolsave = (ToolbarPolicy)prefwin->tbpolicy(); | 1892 | m_tbpolsave = (ToolbarPolicy)prefwin->tbpolicy(); |
1892 | m_tbposition = (ToolBarDock)(prefwin->tbposition()+2); | 1893 | m_tbposition = (ToolBarDock)(prefwin->tbposition()+2); |
1893 | m_tbmovesave = prefwin->tbmovable(); | 1894 | m_tbmovesave = prefwin->tbmovable(); |
1894 | bool isChanged = prefwin->isChanged(); | 1895 | bool isChanged = prefwin->isChanged(); |
1895 | delete prefwin; | 1896 | delete prefwin; |
1896 | #ifdef USEQPE | 1897 | #ifdef USEQPE |
1897 | Config config( APPDIR ); | 1898 | Config config( APPDIR ); |
1898 | #else | 1899 | #else |
1899 | QFileInfo fi; | 1900 | QFileInfo fi; |
1900 | QDir d = QDir::home(); // "/" | 1901 | QDir d = QDir::home(); // "/" |
1901 | if ( !d.cd(APPDIR) ) | 1902 | if ( !d.cd(APPDIR) ) |
1902 | { // "/tmp" | 1903 | { // "/tmp" |
1903 | qWarning( "Cannot find the \"~/%s\" directory", APPDIR ); | 1904 | owarn << "Cannot find the \"~/" << APPDIR << "\" directory" << oendl; |
1904 | d = QDir::home(); | 1905 | d = QDir::home(); |
1905 | d.mkdir(APPDIR); | 1906 | d.mkdir(APPDIR); |
1906 | d.cd(APPDIR); | 1907 | d.cd(APPDIR); |
1907 | } | 1908 | } |
1908 | fi.setFile(d, INIFILE); | 1909 | fi.setFile(d, INIFILE); |
1909 | Config config( fi.absFilePath() ); | 1910 | Config config( fi.absFilePath() ); |
1910 | #endif | 1911 | #endif |
1911 | if (isChanged) addtoolbars(&config); | 1912 | if (isChanged) addtoolbars(&config); |
1912 | } | 1913 | } |
1913 | else | 1914 | else |
1914 | { | 1915 | { |
1915 | delete prefwin; | 1916 | delete prefwin; |
@@ -2166,25 +2167,25 @@ void QTReaderApp::editFind() | |||
2166 | Global::showInputMethod(); | 2167 | Global::showInputMethod(); |
2167 | #endif | 2168 | #endif |
2168 | searchBar->show(); | 2169 | searchBar->show(); |
2169 | searchVisible = TRUE; | 2170 | searchVisible = TRUE; |
2170 | searchEdit->setFocus(); | 2171 | searchEdit->setFocus(); |
2171 | #ifdef __ISEARCH | 2172 | #ifdef __ISEARCH |
2172 | searchStack->push(new searchrecord("",reader->pagelocate())); | 2173 | searchStack->push(new searchrecord("",reader->pagelocate())); |
2173 | #endif | 2174 | #endif |
2174 | } | 2175 | } |
2175 | 2176 | ||
2176 | void QTReaderApp::findNext() | 2177 | void QTReaderApp::findNext() |
2177 | { | 2178 | { |
2178 | // // qDebug("findNext called\n"); | 2179 | // // odebug << "findNext called\n" << oendl; |
2179 | #ifdef __ISEARCH | 2180 | #ifdef __ISEARCH |
2180 | QString arg = searchEdit->text(); | 2181 | QString arg = searchEdit->text(); |
2181 | #else | 2182 | #else |
2182 | QRegExp arg = searchEdit->text(); | 2183 | QRegExp arg = searchEdit->text(); |
2183 | #endif | 2184 | #endif |
2184 | CDrawBuffer test(&(reader->m_fontControl)); | 2185 | CDrawBuffer test(&(reader->m_fontControl)); |
2185 | size_t start = reader->pagelocate(); | 2186 | size_t start = reader->pagelocate(); |
2186 | reader->jumpto(start); | 2187 | reader->jumpto(start); |
2187 | reader->getline(&test); | 2188 | reader->getline(&test); |
2188 | dosearch(start, test, arg); | 2189 | dosearch(start, test, arg); |
2189 | } | 2190 | } |
2190 | 2191 | ||
@@ -2262,30 +2263,30 @@ bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg) | |||
2262 | if (reader->buffdoc.getpara(test) < 0) | 2263 | if (reader->buffdoc.getpara(test) < 0) |
2263 | { | 2264 | { |
2264 | 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) |
2265 | pos = searchStart; | 2266 | pos = searchStart; |
2266 | else | 2267 | else |
2267 | pos = start; | 2268 | pos = start; |
2268 | findClose(); | 2269 | findClose(); |
2269 | pbar->hide(); | 2270 | pbar->hide(); |
2270 | reader->locate(pos); | 2271 | reader->locate(pos); |
2271 | return false; | 2272 | return false; |
2272 | } | 2273 | } |
2273 | } | 2274 | } |
2274 | // qDebug("Found it at %u:%u", pos, offset); | 2275 | // odebug << "Found it at " << pos << ":" << offset << "" << oendl; |
2275 | pbar->hide(); | 2276 | pbar->hide(); |
2276 | // qDebug("Hid"); | 2277 | // odebug << "Hid" << oendl; |
2277 | reader->locate(pos+offset); | 2278 | reader->locate(pos+offset); |
2278 | // qDebug("Loacted"); | 2279 | // odebug << "Loacted" << oendl; |
2279 | // qDebug("page up"); | 2280 | // odebug << "page up" << oendl; |
2280 | ret = true; | 2281 | ret = true; |
2281 | } | 2282 | } |
2282 | else | 2283 | else |
2283 | { | 2284 | { |
2284 | 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) |
2285 | pos = searchStart; | 2286 | pos = searchStart; |
2286 | else | 2287 | else |
2287 | pos = start; | 2288 | pos = start; |
2288 | ret = false; | 2289 | ret = false; |
2289 | findClose(); | 2290 | findClose(); |
2290 | } | 2291 | } |
2291 | return ret; | 2292 | return ret; |
@@ -2324,25 +2325,25 @@ void QTReaderApp::search(const QString & arg) | |||
2324 | } | 2325 | } |
2325 | dosearch(start, test, arg); | 2326 | dosearch(start, test, arg); |
2326 | } | 2327 | } |
2327 | #else | 2328 | #else |
2328 | void QTReaderApp::search() | 2329 | void QTReaderApp::search() |
2329 | { | 2330 | { |
2330 | findNext(); | 2331 | findNext(); |
2331 | } | 2332 | } |
2332 | #endif | 2333 | #endif |
2333 | 2334 | ||
2334 | void QTReaderApp::openFile( const QString &f ) | 2335 | void QTReaderApp::openFile( const QString &f ) |
2335 | { | 2336 | { |
2336 | // qDebug("File:%s", (const char*)f); | 2337 | // odebug << "File:" << f << "" << oendl; |
2337 | // openFile(DocLnk(f)); | 2338 | // openFile(DocLnk(f)); |
2338 | //} | 2339 | //} |
2339 | // | 2340 | // |
2340 | //void QTReaderApp::openFile( const DocLnk &f ) | 2341 | //void QTReaderApp::openFile( const DocLnk &f ) |
2341 | //{ | 2342 | //{ |
2342 | clear(); | 2343 | clear(); |
2343 | QFileInfo fm(f); | 2344 | QFileInfo fm(f); |
2344 | if ( fm.exists() ) | 2345 | if ( fm.exists() ) |
2345 | { | 2346 | { |
2346 | // QMessageBox::information(0, "Progress", "Calling fileNew()"); | 2347 | // QMessageBox::information(0, "Progress", "Calling fileNew()"); |
2347 | #ifdef USEQPE | 2348 | #ifdef USEQPE |
2348 | if (fm.extension( FALSE ) == "desktop") | 2349 | if (fm.extension( FALSE ) == "desktop") |
@@ -2371,52 +2372,52 @@ void QTReaderApp::openFile( const QString &f ) | |||
2371 | /* | 2372 | /* |
2372 | void QTReaderApp::resizeEvent(QResizeEvent* e) | 2373 | void QTReaderApp::resizeEvent(QResizeEvent* e) |
2373 | { | 2374 | { |
2374 | if (m_fullscreen) | 2375 | if (m_fullscreen) |
2375 | { | 2376 | { |
2376 | showNormal(); | 2377 | showNormal(); |
2377 | showFullScreen(); | 2378 | showFullScreen(); |
2378 | } | 2379 | } |
2379 | } | 2380 | } |
2380 | */ | 2381 | */ |
2381 | void QTReaderApp::handlekey(QKeyEvent* e) | 2382 | void QTReaderApp::handlekey(QKeyEvent* e) |
2382 | { | 2383 | { |
2383 | // qDebug("Keypress event"); | 2384 | // odebug << "Keypress event" << oendl; |
2384 | timeb now; | 2385 | timeb now; |
2385 | ftime(&now); | 2386 | ftime(&now); |
2386 | 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; |
2387 | if (etime < m_debounce) | 2388 | if (etime < m_debounce) |
2388 | { | 2389 | { |
2389 | return; | 2390 | return; |
2390 | } | 2391 | } |
2391 | m_lastkeytime = now; | 2392 | m_lastkeytime = now; |
2392 | switch(e->key()) | 2393 | switch(e->key()) |
2393 | { | 2394 | { |
2394 | case Key_Escape: | 2395 | case Key_Escape: |
2395 | // qDebug("escape event"); | 2396 | // odebug << "escape event" << oendl; |
2396 | if (m_disableesckey) | 2397 | if (m_disableesckey) |
2397 | { | 2398 | { |
2398 | m_disableesckey = false; | 2399 | m_disableesckey = false; |
2399 | } | 2400 | } |
2400 | else | 2401 | else |
2401 | { | 2402 | { |
2402 | m_bcloseDisabled = true; | 2403 | m_bcloseDisabled = true; |
2403 | if (m_fullscreen) | 2404 | if (m_fullscreen) |
2404 | { | 2405 | { |
2405 | m_actFullscreen->setOn(false); | 2406 | m_actFullscreen->setOn(false); |
2406 | e->accept(); | 2407 | e->accept(); |
2407 | } | 2408 | } |
2408 | else | 2409 | else |
2409 | { | 2410 | { |
2410 | // qDebug("escape action"); | 2411 | // odebug << "escape action" << oendl; |
2411 | doAction(m_escapeTarget, e); | 2412 | doAction(m_escapeTarget, e); |
2412 | } | 2413 | } |
2413 | } | 2414 | } |
2414 | break; | 2415 | break; |
2415 | case Key_Space: | 2416 | case Key_Space: |
2416 | { | 2417 | { |
2417 | doAction(m_spaceTarget, e); | 2418 | doAction(m_spaceTarget, e); |
2418 | } | 2419 | } |
2419 | break; | 2420 | break; |
2420 | case Key_Return: | 2421 | case Key_Return: |
2421 | { | 2422 | { |
2422 | doAction(m_returnTarget, e); | 2423 | doAction(m_returnTarget, e); |
@@ -2497,64 +2498,64 @@ void QTReaderApp::showEditTools() | |||
2497 | if (markBar != NULL) markBar->hide(); | 2498 | if (markBar != NULL) markBar->hide(); |
2498 | searchBar->hide(); | 2499 | searchBar->hide(); |
2499 | regBar->hide(); | 2500 | regBar->hide(); |
2500 | #ifdef USEQPE | 2501 | #ifdef USEQPE |
2501 | Global::hideInputMethod(); | 2502 | Global::hideInputMethod(); |
2502 | #endif | 2503 | #endif |
2503 | m_fontBar->hide(); | 2504 | m_fontBar->hide(); |
2504 | //showNormal(); | 2505 | //showNormal(); |
2505 | showFullScreen(); | 2506 | showFullScreen(); |
2506 | } | 2507 | } |
2507 | else | 2508 | else |
2508 | { | 2509 | { |
2509 | //qDebug("him"); | 2510 | // odebug << "him" << oendl; |
2510 | #ifdef USEQPE | 2511 | #ifdef USEQPE |
2511 | Global::hideInputMethod(); | 2512 | Global::hideInputMethod(); |
2512 | #endif | 2513 | #endif |
2513 | //qDebug("eb"); | 2514 | // odebug << "eb" << oendl; |
2514 | menubar->show(); | 2515 | menubar->show(); |
2515 | if (fileBar != NULL) fileBar->show(); | 2516 | if (fileBar != NULL) fileBar->show(); |
2516 | if (viewBar != NULL) viewBar->show(); | 2517 | if (viewBar != NULL) viewBar->show(); |
2517 | if (navBar != NULL) navBar->show(); | 2518 | if (navBar != NULL) navBar->show(); |
2518 | if (markBar != NULL) markBar->show(); | 2519 | if (markBar != NULL) markBar->show(); |
2519 | mb->show(); | 2520 | mb->show(); |
2520 | if ( searchVisible ) | 2521 | if ( searchVisible ) |
2521 | { | 2522 | { |
2522 | #ifdef USEQPE | 2523 | #ifdef USEQPE |
2523 | Global::showInputMethod(); | 2524 | Global::showInputMethod(); |
2524 | #endif | 2525 | #endif |
2525 | searchBar->show(); | 2526 | searchBar->show(); |
2526 | } | 2527 | } |
2527 | if ( regVisible ) | 2528 | if ( regVisible ) |
2528 | { | 2529 | { |
2529 | #ifdef USEQPE | 2530 | #ifdef USEQPE |
2530 | Global::showInputMethod(); | 2531 | Global::showInputMethod(); |
2531 | #endif | 2532 | #endif |
2532 | regBar->show(); | 2533 | regBar->show(); |
2533 | } | 2534 | } |
2534 | if (m_fontVisible) m_fontBar->show(); | 2535 | if (m_fontVisible) m_fontBar->show(); |
2535 | //qDebug("sn"); | 2536 | // odebug << "sn" << oendl; |
2536 | showNormal(); | 2537 | showNormal(); |
2537 | //qDebug("sm"); | 2538 | // odebug << "sm" << oendl; |
2538 | #ifdef USEQPE | 2539 | #ifdef USEQPE |
2539 | showMaximized(); | 2540 | showMaximized(); |
2540 | #endif | 2541 | #endif |
2541 | //setCentralWidget(reader); | 2542 | //setCentralWidget(reader); |
2542 | } | 2543 | } |
2543 | 2544 | ||
2544 | // qDebug("uc"); | 2545 | // odebug << "uc" << oendl; |
2545 | updateCaption(); | 2546 | updateCaption(); |
2546 | // qDebug("rw"); | 2547 | // odebug << "rw" << oendl; |
2547 | editorStack->raiseWidget( reader ); | 2548 | editorStack->raiseWidget( reader ); |
2548 | // qDebug("sf"); | 2549 | // odebug << "sf" << oendl; |
2549 | reader->setFocus(); | 2550 | reader->setFocus(); |
2550 | reader->refresh(); | 2551 | reader->refresh(); |
2551 | } | 2552 | } |
2552 | /* | 2553 | /* |
2553 | void QTReaderApp::save() | 2554 | void QTReaderApp::save() |
2554 | { | 2555 | { |
2555 | if ( !doc ) | 2556 | if ( !doc ) |
2556 | return; | 2557 | return; |
2557 | if ( !editor->edited() ) | 2558 | if ( !editor->edited() ) |
2558 | return; | 2559 | return; |
2559 | 2560 | ||
2560 | QString rt = editor->text(); | 2561 | QString rt = editor->text(); |
@@ -2605,42 +2606,42 @@ void QTReaderApp::updateCaption() | |||
2605 | } | 2606 | } |
2606 | 2607 | ||
2607 | void QTReaderApp::setDocument(const QString& fileref) | 2608 | void QTReaderApp::setDocument(const QString& fileref) |
2608 | { | 2609 | { |
2609 | bFromDocView = TRUE; | 2610 | bFromDocView = TRUE; |
2610 | //QMessageBox::information(0, "setDocument", fileref); | 2611 | //QMessageBox::information(0, "setDocument", fileref); |
2611 | openFile(fileref); | 2612 | openFile(fileref); |
2612 | // showEditTools(); | 2613 | // showEditTools(); |
2613 | } | 2614 | } |
2614 | 2615 | ||
2615 | void QTReaderApp::closeEvent( QCloseEvent *e ) | 2616 | void QTReaderApp::closeEvent( QCloseEvent *e ) |
2616 | { | 2617 | { |
2617 | // qDebug("Close event"); | 2618 | // odebug << "Close event" << oendl; |
2618 | if (m_fullscreen) | 2619 | if (m_fullscreen) |
2619 | { | 2620 | { |
2620 | m_fullscreen = false; | 2621 | m_fullscreen = false; |
2621 | showEditTools(); | 2622 | showEditTools(); |
2622 | e->accept(); | 2623 | e->accept(); |
2623 | } | 2624 | } |
2624 | else if (m_dontSave) | 2625 | else if (m_dontSave) |
2625 | { | 2626 | { |
2626 | e->accept(); | 2627 | e->accept(); |
2627 | } | 2628 | } |
2628 | else | 2629 | else |
2629 | { | 2630 | { |
2630 | if (editorStack->visibleWidget() == reader) | 2631 | if (editorStack->visibleWidget() == reader) |
2631 | { | 2632 | { |
2632 | if ((m_escapeTarget != cesNone) && m_bcloseDisabled) | 2633 | if ((m_escapeTarget != cesNone) && m_bcloseDisabled) |
2633 | { | 2634 | { |
2634 | //qDebug("Close disabled"); | 2635 | // odebug << "Close disabled" << oendl; |
2635 | m_bcloseDisabled = false; | 2636 | m_bcloseDisabled = false; |
2636 | e->ignore(); | 2637 | e->ignore(); |
2637 | } | 2638 | } |
2638 | else | 2639 | else |
2639 | { | 2640 | { |
2640 | if (m_fontVisible) | 2641 | if (m_fontVisible) |
2641 | { | 2642 | { |
2642 | m_fontBar->hide(); | 2643 | m_fontBar->hide(); |
2643 | m_fontVisible = false; | 2644 | m_fontVisible = false; |
2644 | } | 2645 | } |
2645 | if (regVisible) | 2646 | if (regVisible) |
2646 | { | 2647 | { |
@@ -2700,25 +2701,25 @@ bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab) | |||
2700 | { | 2701 | { |
2701 | bkmkselector->clear(); | 2702 | bkmkselector->clear(); |
2702 | if (_lab.isEmpty()) | 2703 | if (_lab.isEmpty()) |
2703 | bkmkselector->setText("Cancel"); | 2704 | bkmkselector->setText("Cancel"); |
2704 | else | 2705 | else |
2705 | bkmkselector->setText(_lab); | 2706 | bkmkselector->setText(_lab); |
2706 | int cnt = 0; | 2707 | int cnt = 0; |
2707 | if (plist != NULL) | 2708 | if (plist != NULL) |
2708 | { | 2709 | { |
2709 | for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) | 2710 | for (CList<Bkmk>::iterator i = plist->begin(); i != plist->end(); i++) |
2710 | { | 2711 | { |
2711 | #ifdef _UNICODE | 2712 | #ifdef _UNICODE |
2712 | // qDebug("Item:%s", (const char*)toQString(i->name())); | 2713 | // odebug << "Item:" << toQString(i->name()) << "" << oendl; |
2713 | bkmkselector->insertItem(toQString(i->name())); | 2714 | bkmkselector->insertItem(toQString(i->name())); |
2714 | #else | 2715 | #else |
2715 | bkmkselector->insertItem(i->name()); | 2716 | bkmkselector->insertItem(i->name()); |
2716 | #endif | 2717 | #endif |
2717 | cnt++; | 2718 | cnt++; |
2718 | } | 2719 | } |
2719 | } | 2720 | } |
2720 | if (cnt > 0) | 2721 | if (cnt > 0) |
2721 | { | 2722 | { |
2722 | hidetoolbars(); | 2723 | hidetoolbars(); |
2723 | editorStack->raiseWidget( bkmkselector ); | 2724 | editorStack->raiseWidget( bkmkselector ); |
2724 | return true; | 2725 | return true; |
@@ -2729,68 +2730,68 @@ bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _lab) | |||
2729 | 2730 | ||
2730 | void QTReaderApp::do_autogen() | 2731 | void QTReaderApp::do_autogen() |
2731 | { | 2732 | { |
2732 | m_nRegAction = cAutoGen; | 2733 | m_nRegAction = cAutoGen; |
2733 | regEdit->setText(m_autogenstr); | 2734 | regEdit->setText(m_autogenstr); |
2734 | do_regedit(); | 2735 | do_regedit(); |
2735 | } | 2736 | } |
2736 | 2737 | ||
2737 | void QTReaderApp::do_regedit() | 2738 | void QTReaderApp::do_regedit() |
2738 | { | 2739 | { |
2739 | // fileBar->hide(); | 2740 | // fileBar->hide(); |
2740 | reader->bDoUpdates = false; | 2741 | reader->bDoUpdates = false; |
2741 | // qDebug("Showing regbar"); | 2742 | // odebug << "Showing regbar" << oendl; |
2742 | regBar->show(); | 2743 | regBar->show(); |
2743 | // qDebug("Showing kbd"); | 2744 | // odebug << "Showing kbd" << oendl; |
2744 | #ifdef USEQPE | 2745 | #ifdef USEQPE |
2745 | Global::showInputMethod(); | 2746 | Global::showInputMethod(); |
2746 | #endif | 2747 | #endif |
2747 | regVisible = true; | 2748 | regVisible = true; |
2748 | regEdit->setFocus(); | 2749 | regEdit->setFocus(); |
2749 | // qApp->processEvents(); | 2750 | // qApp->processEvents(); |
2750 | reader->bDoUpdates = true; | 2751 | reader->bDoUpdates = true; |
2751 | reader->update(); | 2752 | reader->update(); |
2752 | } | 2753 | } |
2753 | 2754 | ||
2754 | bool QTReaderApp::openfrombkmk(Bkmk* bk) | 2755 | bool QTReaderApp::openfrombkmk(Bkmk* bk) |
2755 | { | 2756 | { |
2756 | QString fn = toQString( | 2757 | QString fn = toQString( |
2757 | CFiledata(bk->anno()).name() | 2758 | CFiledata(bk->anno()).name() |
2758 | ); | 2759 | ); |
2759 | //qDebug("fileinfo"); | 2760 | // odebug << "fileinfo" << oendl; |
2760 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) | 2761 | if (!fn.isEmpty() && QFileInfo(fn).isFile()) |
2761 | { | 2762 | { |
2762 | //qDebug("Opening"); | 2763 | // odebug << "Opening" << oendl; |
2763 | openFile(fn); | 2764 | openFile(fn); |
2764 | struct stat fnstat; | 2765 | struct stat fnstat; |
2765 | stat((const char *)reader->m_lastfile, &fnstat); | 2766 | stat((const char *)reader->m_lastfile, &fnstat); |
2766 | 2767 | ||
2767 | if (CFiledata(bk->anno()).date() | 2768 | if (CFiledata(bk->anno()).date() |
2768 | != fnstat.st_mtime) | 2769 | != fnstat.st_mtime) |
2769 | { | 2770 | { |
2770 | CFiledata fd(bk->anno()); | 2771 | CFiledata fd(bk->anno()); |
2771 | fd.setdate(fnstat.st_mtime); | 2772 | fd.setdate(fnstat.st_mtime); |
2772 | bk->value(0); | 2773 | bk->value(0); |
2773 | } | 2774 | } |
2774 | else | 2775 | else |
2775 | { | 2776 | { |
2776 | unsigned short svlen = bk->filedatalen(); | 2777 | unsigned short svlen = bk->filedatalen(); |
2777 | unsigned char* svdata = bk->filedata(); | 2778 | unsigned char* svdata = bk->filedata(); |
2778 | reader->putSaveData(svdata, svlen); | 2779 | reader->putSaveData(svdata, svlen); |
2779 | // setstate(svdata, svlen); | 2780 | // setstate(svdata, svlen); |
2780 | if (svlen != 0) | 2781 | if (svlen != 0) |
2781 | { | 2782 | { |
2782 | QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?"); | 2783 | QMessageBox::warning(this, PROGNAME, "Not all file data used\nNew version?"); |
2783 | } | 2784 | } |
2784 | // qDebug("updating"); | 2785 | // odebug << "updating" << oendl; |
2785 | // showEditTools(); | 2786 | // showEditTools(); |
2786 | reader->locate(bk->value()); | 2787 | reader->locate(bk->value()); |
2787 | } | 2788 | } |
2788 | return true; | 2789 | return true; |
2789 | } | 2790 | } |
2790 | else | 2791 | else |
2791 | { | 2792 | { |
2792 | return false; | 2793 | return false; |
2793 | } | 2794 | } |
2794 | } | 2795 | } |
2795 | 2796 | ||
2796 | void QTReaderApp::gotobkmk(int ind) | 2797 | void QTReaderApp::gotobkmk(int ind) |
@@ -2803,25 +2804,25 @@ void QTReaderApp::gotobkmk(int ind) | |||
2803 | // qApp->processEvents(); | 2804 | // qApp->processEvents(); |
2804 | if (!openfrombkmk((*pOpenlist)[ind])) | 2805 | if (!openfrombkmk((*pOpenlist)[ind])) |
2805 | { | 2806 | { |
2806 | pOpenlist->erase(ind); | 2807 | pOpenlist->erase(ind); |
2807 | QMessageBox::information(this, PROGNAME, "Can't find file"); | 2808 | QMessageBox::information(this, PROGNAME, "Can't find file"); |
2808 | } | 2809 | } |
2809 | } | 2810 | } |
2810 | break; | 2811 | break; |
2811 | case cGotoBkmk: | 2812 | case cGotoBkmk: |
2812 | reader->locate((*pBkmklist)[ind]->value()); | 2813 | reader->locate((*pBkmklist)[ind]->value()); |
2813 | break; | 2814 | break; |
2814 | case cDelBkmk: | 2815 | case cDelBkmk: |
2815 | //// qDebug("Deleting:%s\n",(*pBkmklist)[ind]->name()); | 2816 | //// odebug << "Deleting:" << (*pBkmklist)[ind]->name() << "\n" << oendl; |
2816 | pBkmklist->erase(ind); | 2817 | pBkmklist->erase(ind); |
2817 | m_fBkmksChanged = true; | 2818 | m_fBkmksChanged = true; |
2818 | // pBkmklist->sort(); | 2819 | // pBkmklist->sort(); |
2819 | break; | 2820 | break; |
2820 | case cRmBkmkFile: | 2821 | case cRmBkmkFile: |
2821 | { | 2822 | { |
2822 | #ifndef USEQPE | 2823 | #ifndef USEQPE |
2823 | QDir d = QDir::home(); // "/" | 2824 | QDir d = QDir::home(); // "/" |
2824 | d.cd(APPDIR); | 2825 | d.cd(APPDIR); |
2825 | d.remove(bkmkselector->text(ind)); | 2826 | d.remove(bkmkselector->text(ind)); |
2826 | #else /* USEQPE */ | 2827 | #else /* USEQPE */ |
2827 | unlink((const char *)Global::applicationFileName(APPDIR,bkmkselector->text(ind))); | 2828 | unlink((const char *)Global::applicationFileName(APPDIR,bkmkselector->text(ind))); |
@@ -2903,49 +2904,49 @@ void QTReaderApp::gotobkmk(int ind) | |||
2903 | delete fb; | 2904 | delete fb; |
2904 | fclose(fin); | 2905 | fclose(fin); |
2905 | 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))); |
2906 | } | 2907 | } |
2907 | else | 2908 | else |
2908 | { | 2909 | { |
2909 | QMessageBox::information(this, PROGNAME, "Couldn't open input"); | 2910 | QMessageBox::information(this, PROGNAME, "Couldn't open input"); |
2910 | } | 2911 | } |
2911 | 2912 | ||
2912 | /* | 2913 | /* |
2913 | 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 ); |
2914 | int ret = f->exec(); | 2915 | int ret = f->exec(); |
2915 | qDebug("Return:%d", ret); | 2916 | odebug << "Return:" << ret << "" << oendl; |
2916 | DocLnk* doc = f->getDoc(); | 2917 | DocLnk* doc = f->getDoc(); |
2917 | if (doc != NULL) | 2918 | if (doc != NULL) |
2918 | { | 2919 | { |
2919 | 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"); |
2920 | QString rt; | 2921 | QString rt; |
2921 | rt = "<html><body>\n"; | 2922 | rt = "<html><body>\n"; |
2922 | int ch = 0; | 2923 | int ch = 0; |
2923 | while ((ch = fgetc(fin)) != EOF) | 2924 | while ((ch = fgetc(fin)) != EOF) |
2924 | { | 2925 | { |
2925 | rt += (char)ch; | 2926 | rt += (char)ch; |
2926 | } | 2927 | } |
2927 | fclose(fin); | 2928 | fclose(fin); |
2928 | rt += "</html></body>\n"; | 2929 | rt += "</html></body>\n"; |
2929 | if ( doc->name().isEmpty() ) | 2930 | if ( doc->name().isEmpty() ) |
2930 | { | 2931 | { |
2931 | doc->setName(bkmkselector->text(ind)); | 2932 | doc->setName(bkmkselector->text(ind)); |
2932 | } | 2933 | } |
2933 | FileManager fm; | 2934 | FileManager fm; |
2934 | fm.saveFile( *doc, rt ); | 2935 | fm.saveFile( *doc, rt ); |
2935 | qDebug("YES"); | 2936 | odebug << "YES" << oendl; |
2936 | } | 2937 | } |
2937 | else | 2938 | else |
2938 | { | 2939 | { |
2939 | qDebug("NO"); | 2940 | odebug << "NO" << oendl; |
2940 | } | 2941 | } |
2941 | delete f; | 2942 | delete f; |
2942 | */ | 2943 | */ |
2943 | 2944 | ||
2944 | #endif /* USEQPE */ | 2945 | #endif /* USEQPE */ |
2945 | } | 2946 | } |
2946 | break; | 2947 | break; |
2947 | } | 2948 | } |
2948 | } | 2949 | } |
2949 | 2950 | ||
2950 | void QTReaderApp::cancelbkmk() | 2951 | void QTReaderApp::cancelbkmk() |
2951 | { | 2952 | { |
@@ -3000,25 +3001,25 @@ void QTReaderApp::do_regaction() | |||
3000 | do_mono(regEdit->text()); | 3001 | do_mono(regEdit->text()); |
3001 | break; | 3002 | break; |
3002 | */ | 3003 | */ |
3003 | case cSetTarget: | 3004 | case cSetTarget: |
3004 | do_settarget(regEdit->text()); | 3005 | do_settarget(regEdit->text()); |
3005 | break; | 3006 | break; |
3006 | #ifdef _SCROLLPIPE | 3007 | #ifdef _SCROLLPIPE |
3007 | case cSetPipeTarget: | 3008 | case cSetPipeTarget: |
3008 | do_setpipetarget(regEdit->text()); | 3009 | do_setpipetarget(regEdit->text()); |
3009 | break; | 3010 | break; |
3010 | #endif | 3011 | #endif |
3011 | case cSetConfigName: | 3012 | case cSetConfigName: |
3012 | // qDebug("Saving config"); | 3013 | // odebug << "Saving config" << oendl; |
3013 | do_saveconfig(regEdit->text(), false); | 3014 | do_saveconfig(regEdit->text(), false); |
3014 | break; | 3015 | break; |
3015 | } | 3016 | } |
3016 | // reader->restore(); | 3017 | // reader->restore(); |
3017 | // fileBar->show(); | 3018 | // fileBar->show(); |
3018 | reader->setFocus(); | 3019 | reader->setFocus(); |
3019 | // qApp->processEvents(); | 3020 | // qApp->processEvents(); |
3020 | reader->bDoUpdates = true; | 3021 | reader->bDoUpdates = true; |
3021 | reader->update(); | 3022 | reader->update(); |
3022 | } | 3023 | } |
3023 | 3024 | ||
3024 | void QTReaderApp::do_settarget(const QString& _txt) | 3025 | void QTReaderApp::do_settarget(const QString& _txt) |
@@ -3092,57 +3093,57 @@ void QTReaderApp::setfontHelper(const QString& lcn, int size) | |||
3092 | searchEdit->setFont( f ); | 3093 | searchEdit->setFont( f ); |
3093 | m_annoWin->setFont( f ); | 3094 | m_annoWin->setFont( f ); |
3094 | } | 3095 | } |
3095 | reader->m_fontname = lcn; | 3096 | reader->m_fontname = lcn; |
3096 | if (!reader->ChangeFont(size)) | 3097 | if (!reader->ChangeFont(size)) |
3097 | { | 3098 | { |
3098 | reader->ChangeFont(size); | 3099 | reader->ChangeFont(size); |
3099 | } | 3100 | } |
3100 | } | 3101 | } |
3101 | 3102 | ||
3102 | void QTReaderApp::do_setencoding(int i) | 3103 | void QTReaderApp::do_setencoding(int i) |
3103 | { | 3104 | { |
3104 | // qDebug("setencoding:%d", i); | 3105 | // odebug << "setencoding:" << i << "" << oendl; |
3105 | if (m_fontAction == cChooseEncoding) | 3106 | if (m_fontAction == cChooseEncoding) |
3106 | { | 3107 | { |
3107 | reader->setencoding(i); | 3108 | reader->setencoding(i); |
3108 | } | 3109 | } |
3109 | reader->refresh(); | 3110 | reader->refresh(); |
3110 | m_fontBar->hide(); | 3111 | m_fontBar->hide(); |
3111 | m_fontVisible = false; | 3112 | m_fontVisible = false; |
3112 | // qDebug("showedit"); | 3113 | // odebug << "showedit" << oendl; |
3113 | if (reader->isVisible()) showEditTools(); | 3114 | if (reader->isVisible()) showEditTools(); |
3114 | // qDebug("showeditdone"); | 3115 | // odebug << "showeditdone" << oendl; |
3115 | } | 3116 | } |
3116 | 3117 | ||
3117 | void QTReaderApp::do_setfont(const QString& lcn) | 3118 | void QTReaderApp::do_setfont(const QString& lcn) |
3118 | { | 3119 | { |
3119 | if (m_fontAction == cChooseFont) | 3120 | if (m_fontAction == cChooseFont) |
3120 | { | 3121 | { |
3121 | setfontHelper(lcn); | 3122 | setfontHelper(lcn); |
3122 | } | 3123 | } |
3123 | reader->refresh(); | 3124 | reader->refresh(); |
3124 | m_fontBar->hide(); | 3125 | m_fontBar->hide(); |
3125 | m_fontVisible = false; | 3126 | m_fontVisible = false; |
3126 | // qDebug("showedit"); | 3127 | // odebug << "showedit" << oendl; |
3127 | //if (reader->isVisible()) | 3128 | //if (reader->isVisible()) |
3128 | showEditTools(); | 3129 | showEditTools(); |
3129 | // qDebug("showeditdone"); | 3130 | // odebug << "showeditdone" << oendl; |
3130 | } | 3131 | } |
3131 | 3132 | ||
3132 | void QTReaderApp::do_autogen(const QString& regText) | 3133 | void QTReaderApp::do_autogen(const QString& regText) |
3133 | { | 3134 | { |
3134 | unsigned long fs, ts; | 3135 | unsigned long fs, ts; |
3135 | reader->sizes(fs,ts); | 3136 | reader->sizes(fs,ts); |
3136 | // // qDebug("Reg:%s\n", (const tchar*)(regEdit->text())); | 3137 | // // odebug << "Reg:" << (const tchar*)(regEdit->text()) << "\n" << oendl; |
3137 | m_autogenstr = regText; | 3138 | m_autogenstr = regText; |
3138 | QRegExp re(regText); | 3139 | QRegExp re(regText); |
3139 | CBuffer buff; | 3140 | CBuffer buff; |
3140 | if (pBkmklist != NULL) delete pBkmklist; | 3141 | if (pBkmklist != NULL) delete pBkmklist; |
3141 | pBkmklist = new CList<Bkmk>; | 3142 | pBkmklist = new CList<Bkmk>; |
3142 | m_fBkmksChanged = true; | 3143 | m_fBkmksChanged = true; |
3143 | 3144 | ||
3144 | pbar->setGeometry(regBar->x(),regBar->y(),regBar->width(), regBar->height()); | 3145 | pbar->setGeometry(regBar->x(),regBar->y(),regBar->width(), regBar->height()); |
3145 | pbar->show(); | 3146 | pbar->show(); |
3146 | pbar->raise(); | 3147 | pbar->raise(); |
3147 | pbar->reset(); | 3148 | pbar->reset(); |
3148 | reader->update(); | 3149 | reader->update(); |
@@ -3171,25 +3172,25 @@ void QTReaderApp::do_autogen(const QString& regText) | |||
3171 | #endif | 3172 | #endif |
3172 | pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); | 3173 | pBkmklist->push_back(Bkmk(buff.data(), NULL, lcn)); |
3173 | } | 3174 | } |
3174 | pBkmklist->sort(); | 3175 | pBkmklist->sort(); |
3175 | pbar->setProgress(100); | 3176 | pbar->setProgress(100); |
3176 | qApp->processEvents(); | 3177 | qApp->processEvents(); |
3177 | pbar->hide(); | 3178 | pbar->hide(); |
3178 | reader->refresh(); | 3179 | reader->refresh(); |
3179 | } | 3180 | } |
3180 | 3181 | ||
3181 | void QTReaderApp::saveprefs() | 3182 | void QTReaderApp::saveprefs() |
3182 | { | 3183 | { |
3183 | // qDebug("saveprefs"); | 3184 | // odebug << "saveprefs" << oendl; |
3184 | // reader->saveprefs("uqtreader"); | 3185 | // reader->saveprefs("uqtreader"); |
3185 | // if (!m_loadedconfig) | 3186 | // if (!m_loadedconfig) |
3186 | do_saveconfig( APPDIR, true ); | 3187 | do_saveconfig( APPDIR, true ); |
3187 | 3188 | ||
3188 | /* | 3189 | /* |
3189 | Config config( APPDIR ); | 3190 | Config config( APPDIR ); |
3190 | config.setGroup( "View" ); | 3191 | config.setGroup( "View" ); |
3191 | 3192 | ||
3192 | reader->m_lastposn = reader->pagelocate(); | 3193 | reader->m_lastposn = reader->pagelocate(); |
3193 | 3194 | ||
3194 | config.writeEntry("FloatDialogs", m_bFloatingDialog); | 3195 | config.writeEntry("FloatDialogs", m_bFloatingDialog); |
3195 | config.writeEntry( "StripCr", reader->bstripcr ); | 3196 | config.writeEntry( "StripCr", reader->bstripcr ); |
@@ -3252,29 +3253,29 @@ void QTReaderApp::saveprefs() | |||
3252 | 3253 | ||
3253 | config.setGroup( "Toolbar" ); | 3254 | config.setGroup( "Toolbar" ); |
3254 | config.writeEntry("Movable", m_tbmovesave); | 3255 | config.writeEntry("Movable", m_tbmovesave); |
3255 | config.writeEntry("Policy", m_tbpolsave); | 3256 | config.writeEntry("Policy", m_tbpolsave); |
3256 | config.writeEntry("Position", m_tbposition); | 3257 | config.writeEntry("Position", m_tbposition); |
3257 | */ | 3258 | */ |
3258 | savefilelist(); | 3259 | savefilelist(); |
3259 | } | 3260 | } |
3260 | 3261 | ||
3261 | /* | 3262 | /* |
3262 | void QTReaderApp::oldFile() | 3263 | void QTReaderApp::oldFile() |
3263 | { | 3264 | { |
3264 | // qDebug("oldFile called"); | 3265 | // odebug << "oldFile called" << oendl; |
3265 | reader->setText(true); | 3266 | reader->setText(true); |
3266 | // qDebug("settext called"); | 3267 | // odebug << "settext called" << oendl; |
3267 | showEditTools(); | 3268 | showEditTools(); |
3268 | // qDebug("showedit called"); | 3269 | // odebug << "showedit called" << oendl; |
3269 | } | 3270 | } |
3270 | */ | 3271 | */ |
3271 | 3272 | ||
3272 | /* | 3273 | /* |
3273 | void info_cb(Fl_Widget* o, void* _data) | 3274 | void info_cb(Fl_Widget* o, void* _data) |
3274 | { | 3275 | { |
3275 | 3276 | ||
3276 | if (infowin == NULL) | 3277 | if (infowin == NULL) |
3277 | { | 3278 | { |
3278 | 3279 | ||
3279 | infowin = new Fl_Window(160,240); | 3280 | infowin = new Fl_Window(160,240); |
3280 | filename = new Fl_Output(45,5,110,14,"Filename"); | 3281 | filename = new Fl_Output(45,5,110,14,"Filename"); |
@@ -3332,43 +3333,43 @@ void QTReaderApp::savebkmks() | |||
3332 | } | 3333 | } |
3333 | 3334 | ||
3334 | void QTReaderApp::readfilelist() | 3335 | void QTReaderApp::readfilelist() |
3335 | { | 3336 | { |
3336 | #ifndef USEQPE | 3337 | #ifndef USEQPE |
3337 | QDir d = QDir::home(); // "/" | 3338 | QDir d = QDir::home(); // "/" |
3338 | d.cd(APPDIR); | 3339 | d.cd(APPDIR); |
3339 | QFileInfo fi(d, ".openfiles"); | 3340 | QFileInfo fi(d, ".openfiles"); |
3340 | BkmkFile bf((const char *)fi.absFilePath()); | 3341 | BkmkFile bf((const char *)fi.absFilePath()); |
3341 | #else /* USEQPE */ | 3342 | #else /* USEQPE */ |
3342 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles")); | 3343 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles")); |
3343 | #endif /* USEQPE */ | 3344 | #endif /* USEQPE */ |
3344 | // qDebug("Reading open files"); | 3345 | // odebug << "Reading open files" << oendl; |
3345 | pOpenlist = bf.readall(); | 3346 | pOpenlist = bf.readall(); |
3346 | // if (pOpenlist != NULL) qDebug("...with success"); | 3347 | // if (pOpenlist != NULL) odebug << "...with success" << oendl; |
3347 | // else qDebug("...without success!"); | 3348 | // else odebug << "...without success!" << oendl; |
3348 | } | 3349 | } |
3349 | 3350 | ||
3350 | void QTReaderApp::savefilelist() | 3351 | void QTReaderApp::savefilelist() |
3351 | { | 3352 | { |
3352 | if (pOpenlist != NULL) | 3353 | if (pOpenlist != NULL) |
3353 | { | 3354 | { |
3354 | #ifndef USEQPE | 3355 | #ifndef USEQPE |
3355 | QDir d = QDir::home(); // "/" | 3356 | QDir d = QDir::home(); // "/" |
3356 | d.cd(APPDIR); | 3357 | d.cd(APPDIR); |
3357 | QFileInfo fi(d, ".openfiles"); | 3358 | QFileInfo fi(d, ".openfiles"); |
3358 | BkmkFile bf((const char *)fi.absFilePath(), true); | 3359 | BkmkFile bf((const char *)fi.absFilePath(), true); |
3359 | #else /* USEQPE */ | 3360 | #else /* USEQPE */ |
3360 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), true); | 3361 | BkmkFile bf((const char *)Global::applicationFileName(APPDIR,".openfiles"), true); |
3361 | #endif /* USEQPE */ | 3362 | #endif /* USEQPE */ |
3362 | //qDebug("Writing open files"); | 3363 | // odebug << "Writing open files" << oendl; |
3363 | bf.write(*pOpenlist); | 3364 | bf.write(*pOpenlist); |
3364 | } | 3365 | } |
3365 | } | 3366 | } |
3366 | 3367 | ||
3367 | void QTReaderApp::readbkmks() | 3368 | void QTReaderApp::readbkmks() |
3368 | { | 3369 | { |
3369 | if (pBkmklist != NULL) | 3370 | if (pBkmklist != NULL) |
3370 | { | 3371 | { |
3371 | delete pBkmklist; | 3372 | delete pBkmklist; |
3372 | } | 3373 | } |
3373 | struct stat fnstat; | 3374 | struct stat fnstat; |
3374 | struct stat bkstat; | 3375 | struct stat bkstat; |
@@ -3460,25 +3461,25 @@ void QTReaderApp::showAnnotation() | |||
3460 | m_annoWin->setName(toQString(m_anno->name())); | 3461 | m_annoWin->setName(toQString(m_anno->name())); |
3461 | m_annoWin->setAnno(toQString(m_anno->anno())); | 3462 | m_annoWin->setAnno(toQString(m_anno->anno())); |
3462 | m_annoIsEditing = false; | 3463 | m_annoIsEditing = false; |
3463 | #ifdef USEQPE | 3464 | #ifdef USEQPE |
3464 | Global::showInputMethod(); | 3465 | Global::showInputMethod(); |
3465 | #endif | 3466 | #endif |
3466 | editorStack->raiseWidget( m_annoWin ); | 3467 | editorStack->raiseWidget( m_annoWin ); |
3467 | m_annoWin->setFocus(); | 3468 | m_annoWin->setFocus(); |
3468 | } | 3469 | } |
3469 | 3470 | ||
3470 | void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, const QString& line) | 3471 | void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, const QString& line) |
3471 | { | 3472 | { |
3472 | //// qDebug("OnWordSelected(%u):%s", posn, (const char*)wrd); | 3473 | //// odebug << "OnWordSelected(" << posn << "):" << wrd << "" << oendl; |
3473 | 3474 | ||
3474 | if (m_doClipboard) | 3475 | if (m_doClipboard) |
3475 | { | 3476 | { |
3476 | QClipboard* cb = QApplication::clipboard(); | 3477 | QClipboard* cb = QApplication::clipboard(); |
3477 | cb->setText(wrd); | 3478 | cb->setText(wrd); |
3478 | #ifdef USEQPE | 3479 | #ifdef USEQPE |
3479 | if (wrd.length() > 10) | 3480 | if (wrd.length() > 10) |
3480 | { | 3481 | { |
3481 | Global::statusMessage(wrd.left(8) + ".."); | 3482 | Global::statusMessage(wrd.left(8) + ".."); |
3482 | } | 3483 | } |
3483 | else | 3484 | else |
3484 | { | 3485 | { |
@@ -3510,25 +3511,25 @@ void QTReaderApp::OnWordSelected(const QString& wrd, size_t posn, const QString& | |||
3510 | #endif | 3511 | #endif |
3511 | } | 3512 | } |
3512 | 3513 | ||
3513 | void QTReaderApp::doAction(ActionTypes a, QKeyEvent* e) | 3514 | void QTReaderApp::doAction(ActionTypes a, QKeyEvent* e) |
3514 | { | 3515 | { |
3515 | if (a == 0) | 3516 | if (a == 0) |
3516 | { | 3517 | { |
3517 | e->ignore(); | 3518 | e->ignore(); |
3518 | } | 3519 | } |
3519 | else | 3520 | else |
3520 | { | 3521 | { |
3521 | e->accept(); | 3522 | e->accept(); |
3522 | //qDebug("Accepted"); | 3523 | // odebug << "Accepted" << oendl; |
3523 | switch (a) | 3524 | switch (a) |
3524 | { | 3525 | { |
3525 | case cesOpenFile: | 3526 | case cesOpenFile: |
3526 | { | 3527 | { |
3527 | fileOpen(); | 3528 | fileOpen(); |
3528 | } | 3529 | } |
3529 | break; | 3530 | break; |
3530 | case cesAutoScroll: | 3531 | case cesAutoScroll: |
3531 | { | 3532 | { |
3532 | reader->setautoscroll(!reader->m_autoScroll); | 3533 | reader->setautoscroll(!reader->m_autoScroll); |
3533 | setScrollState(reader->m_autoScroll); | 3534 | setScrollState(reader->m_autoScroll); |
3534 | } | 3535 | } |
@@ -3573,97 +3574,97 @@ void QTReaderApp::doAction(ActionTypes a, QKeyEvent* e) | |||
3573 | reader->lineUp(); | 3574 | reader->lineUp(); |
3574 | break; | 3575 | break; |
3575 | case cesLineDown: | 3576 | case cesLineDown: |
3576 | reader->lineDown(); | 3577 | reader->lineDown(); |
3577 | break; | 3578 | break; |
3578 | case cesStartDoc: | 3579 | case cesStartDoc: |
3579 | gotoStart(); | 3580 | gotoStart(); |
3580 | break; | 3581 | break; |
3581 | case cesEndDoc: | 3582 | case cesEndDoc: |
3582 | gotoEnd(); | 3583 | gotoEnd(); |
3583 | break; | 3584 | break; |
3584 | default: | 3585 | default: |
3585 | qDebug("Unknown ActionType:%u", a); | 3586 | odebug << "Unknown ActionType:" << a << "" << oendl; |
3586 | break; | 3587 | break; |
3587 | } | 3588 | } |
3588 | } | 3589 | } |
3589 | } | 3590 | } |
3590 | 3591 | ||
3591 | void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); } | 3592 | void QTReaderApp::setTwoTouch(bool _b) { reader->setTwoTouch(_b); } |
3592 | void QTReaderApp::restoreFocus() { reader->setFocus(); } | 3593 | void QTReaderApp::restoreFocus() { reader->setFocus(); } |
3593 | 3594 | ||
3594 | void QTReaderApp::SaveConfig() | 3595 | void QTReaderApp::SaveConfig() |
3595 | { | 3596 | { |
3596 | m_nRegAction = cSetConfigName; | 3597 | m_nRegAction = cSetConfigName; |
3597 | regEdit->setText(reader->m_string); | 3598 | regEdit->setText(reader->m_string); |
3598 | do_regedit(); | 3599 | do_regedit(); |
3599 | } | 3600 | } |
3600 | 3601 | ||
3601 | void QTReaderApp::do_saveconfig(const QString& _txt, bool full) | 3602 | void QTReaderApp::do_saveconfig(const QString& _txt, bool full) |
3602 | { | 3603 | { |
3603 | // qDebug("do_saveconfig:%s", (const char*)_txt); | 3604 | // odebug << "do_saveconfig:" << _txt << "" << oendl; |
3604 | #ifdef USEQPE | 3605 | #ifdef USEQPE |
3605 | QString configname; | 3606 | QString configname; |
3606 | Config::Domain dom; | 3607 | Config::Domain dom; |
3607 | 3608 | ||
3608 | if (full) | 3609 | if (full) |
3609 | { | 3610 | { |
3610 | configname = _txt; | 3611 | configname = _txt; |
3611 | dom = Config::User; | 3612 | dom = Config::User; |
3612 | } | 3613 | } |
3613 | else | 3614 | else |
3614 | { | 3615 | { |
3615 | configname = Global::applicationFileName(APPDIR "/configs", _txt); | 3616 | configname = Global::applicationFileName(APPDIR "/configs", _txt); |
3616 | dom = Config::File; | 3617 | dom = Config::File; |
3617 | } | 3618 | } |
3618 | 3619 | ||
3619 | Config config(configname, dom); | 3620 | Config config(configname, dom); |
3620 | config.setGroup( "View" ); | 3621 | config.setGroup( "View" ); |
3621 | 3622 | ||
3622 | #else | 3623 | #else |
3623 | QFileInfo fi; | 3624 | QFileInfo fi; |
3624 | if (full) | 3625 | if (full) |
3625 | { | 3626 | { |
3626 | // qDebug("full:%s", (const char*)_txt); | 3627 | // odebug << "full:" << _txt << "" << oendl; |
3627 | QDir d = QDir::home(); // "/" | 3628 | QDir d = QDir::home(); // "/" |
3628 | if ( !d.cd(_txt) ) | 3629 | if ( !d.cd(_txt) ) |
3629 | { // "/tmp" | 3630 | { // "/tmp" |
3630 | qWarning( "Cannot find the \"~/%s\" directory", (const char*)_txt ); | 3631 | owarn << "Cannot find the \"~/" << _txt << "\" directory" << oendl; |
3631 | d = QDir::home(); | 3632 | d = QDir::home(); |
3632 | d.mkdir(_txt); | 3633 | d.mkdir(_txt); |
3633 | d.cd(_txt); | 3634 | d.cd(_txt); |
3634 | } | 3635 | } |
3635 | fi.setFile(d, INIFILE); | 3636 | fi.setFile(d, INIFILE); |
3636 | } | 3637 | } |
3637 | else | 3638 | else |
3638 | { | 3639 | { |
3639 | QDir d = QDir::home(); // "/" | 3640 | QDir d = QDir::home(); // "/" |
3640 | if ( !d.cd(APPDIR) ) | 3641 | if ( !d.cd(APPDIR) ) |
3641 | { // "/tmp" | 3642 | { // "/tmp" |
3642 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 3643 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; |
3643 | d = QDir::home(); | 3644 | d = QDir::home(); |
3644 | d.mkdir(APPDIR); | 3645 | d.mkdir(APPDIR); |
3645 | d.cd(APPDIR); | 3646 | d.cd(APPDIR); |
3646 | } | 3647 | } |
3647 | if ( !d.cd("configs") ) | 3648 | if ( !d.cd("configs") ) |
3648 | { // "/tmp" | 3649 | { // "/tmp" |
3649 | qWarning( "Cannot find the \"~/" APPDIR "/configs\" directory" ); | 3650 | owarn << "Cannot find the \"~/" APPDIR "/configs\" directory" << oendl; |
3650 | d = QDir::home(); | 3651 | d = QDir::home(); |
3651 | d.cd(APPDIR); | 3652 | d.cd(APPDIR); |
3652 | d.mkdir("configs"); | 3653 | d.mkdir("configs"); |
3653 | d.cd("configs"); | 3654 | d.cd("configs"); |
3654 | } | 3655 | } |
3655 | fi.setFile(d, _txt); | 3656 | fi.setFile(d, _txt); |
3656 | } | 3657 | } |
3657 | //qDebug("Path:%s", (const char*)fi.absFilePath()); | 3658 | // odebug << "Path:" << fi.absFilePath() << "" << oendl; |
3658 | Config config(fi.absFilePath()); | 3659 | Config config(fi.absFilePath()); |
3659 | #endif | 3660 | #endif |
3660 | 3661 | ||
3661 | 3662 | ||
3662 | config.writeEntry( "StripCr", reader->bstripcr ); | 3663 | config.writeEntry( "StripCr", reader->bstripcr ); |
3663 | config.writeEntry( "AutoFmt", reader->bautofmt ); | 3664 | config.writeEntry( "AutoFmt", reader->bautofmt ); |
3664 | config.writeEntry( "TextFmt", reader->btextfmt ); | 3665 | config.writeEntry( "TextFmt", reader->btextfmt ); |
3665 | config.writeEntry( "StripHtml", reader->bstriphtml ); | 3666 | config.writeEntry( "StripHtml", reader->bstriphtml ); |
3666 | config.writeEntry( "Dehyphen", reader->bdehyphen ); | 3667 | config.writeEntry( "Dehyphen", reader->bdehyphen ); |
3667 | config.writeEntry( "Depluck", reader->bdepluck ); | 3668 | config.writeEntry( "Depluck", reader->bdepluck ); |
3668 | config.writeEntry( "Dejpluck", reader->bdejpluck ); | 3669 | config.writeEntry( "Dejpluck", reader->bdejpluck ); |
3669 | config.writeEntry( "OneSpace", reader->bonespace ); | 3670 | config.writeEntry( "OneSpace", reader->bonespace ); |
@@ -3925,44 +3926,44 @@ bool QTReaderApp::readconfig(const QString& _txt, bool full=false) | |||
3925 | } | 3926 | } |
3926 | 3927 | ||
3927 | Config config(configname, dom); | 3928 | Config config(configname, dom); |
3928 | config.setGroup( "View" ); | 3929 | config.setGroup( "View" ); |
3929 | 3930 | ||
3930 | #else | 3931 | #else |
3931 | QFileInfo fi; | 3932 | QFileInfo fi; |
3932 | if (full) | 3933 | if (full) |
3933 | { | 3934 | { |
3934 | QDir d = QDir::home(); // "/" | 3935 | QDir d = QDir::home(); // "/" |
3935 | if ( !d.cd(_txt) ) | 3936 | if ( !d.cd(_txt) ) |
3936 | { // "/tmp" | 3937 | { // "/tmp" |
3937 | qWarning( "Cannot find the \"~/%s\" directory", (const char*)_txt ); | 3938 | owarn << "Cannot find the \"~/" << _txt << "\" directory" << oendl; |
3938 | d = QDir::home(); | 3939 | d = QDir::home(); |
3939 | d.mkdir(_txt); | 3940 | d.mkdir(_txt); |
3940 | d.cd(_txt); | 3941 | d.cd(_txt); |
3941 | } | 3942 | } |
3942 | fi.setFile(d, INIFILE); | 3943 | fi.setFile(d, INIFILE); |
3943 | } | 3944 | } |
3944 | else | 3945 | else |
3945 | { | 3946 | { |
3946 | QDir d = QDir::home(); // "/" | 3947 | QDir d = QDir::home(); // "/" |
3947 | if ( !d.cd(APPDIR) ) | 3948 | if ( !d.cd(APPDIR) ) |
3948 | { // "/tmp" | 3949 | { // "/tmp" |
3949 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 3950 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; |
3950 | d = QDir::home(); | 3951 | d = QDir::home(); |
3951 | d.mkdir(APPDIR); | 3952 | d.mkdir(APPDIR); |
3952 | d.cd(APPDIR); | 3953 | d.cd(APPDIR); |
3953 | } | 3954 | } |
3954 | if ( !d.cd("configs") ) | 3955 | if ( !d.cd("configs") ) |
3955 | { // "/tmp" | 3956 | { // "/tmp" |
3956 | qWarning( "Cannot find the \"~/" APPDIR "/configs\" directory" ); | 3957 | owarn << "Cannot find the \"~/" APPDIR "/configs\" directory" << oendl; |
3957 | d = QDir::home(); | 3958 | d = QDir::home(); |
3958 | d.mkdir("configs"); | 3959 | d.mkdir("configs"); |
3959 | d.cd("configs"); | 3960 | d.cd("configs"); |
3960 | } | 3961 | } |
3961 | fi.setFile(d, _txt); | 3962 | fi.setFile(d, _txt); |
3962 | } | 3963 | } |
3963 | #ifdef _WINDOWS | 3964 | #ifdef _WINDOWS |
3964 | struct stat fnstat; | 3965 | struct stat fnstat; |
3965 | 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 |
3966 | #else | 3967 | #else |
3967 | if (!fi.exists()) return false; | 3968 | if (!fi.exists()) return false; |
3968 | #endif | 3969 | #endif |
@@ -4052,48 +4053,48 @@ bool QTReaderApp::readconfig(const QString& _txt, bool full=false) | |||
4052 | return true; | 4053 | return true; |
4053 | } | 4054 | } |
4054 | 4055 | ||
4055 | bool QTReaderApp::PopulateConfig(const char* tgtdir) | 4056 | bool QTReaderApp::PopulateConfig(const char* tgtdir) |
4056 | { | 4057 | { |
4057 | bkmkselector->clear(); | 4058 | bkmkselector->clear(); |
4058 | bkmkselector->setText("Cancel"); | 4059 | bkmkselector->setText("Cancel"); |
4059 | #ifndef USEQPE | 4060 | #ifndef USEQPE |
4060 | int cnt = 0; | 4061 | int cnt = 0; |
4061 | 4062 | ||
4062 | QDir d = QDir::home(); // "/" | 4063 | QDir d = QDir::home(); // "/" |
4063 | if ( !d.cd(APPDIR) ) { // "/tmp" | 4064 | if ( !d.cd(APPDIR) ) { // "/tmp" |
4064 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 4065 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; |
4065 | d = QDir::home(); | 4066 | d = QDir::home(); |
4066 | d.mkdir(APPDIR); | 4067 | d.mkdir(APPDIR); |
4067 | d.cd(APPDIR); | 4068 | d.cd(APPDIR); |
4068 | } | 4069 | } |
4069 | if ( !d.cd(tgtdir) ) { // "/tmp" | 4070 | if ( !d.cd(tgtdir) ) { // "/tmp" |
4070 | qWarning( "Cannot find the \"~/" APPDIR "/%s\" directory", tgtdir ); | 4071 | owarn << "Cannot find the \"~/" APPDIR "/" << tgtdir << "\" directory" << oendl; |
4071 | d = QDir::home(); | 4072 | d = QDir::home(); |
4072 | d.mkdir(tgtdir); | 4073 | d.mkdir(tgtdir); |
4073 | d.cd(tgtdir); | 4074 | d.cd(tgtdir); |
4074 | } | 4075 | } |
4075 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 4076 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
4076 | // d.setSorting( QDir::Size | QDir::Reversed ); | 4077 | // d.setSorting( QDir::Size | QDir::Reversed ); |
4077 | 4078 | ||
4078 | const QFileInfoList *list = d.entryInfoList(); | 4079 | const QFileInfoList *list = d.entryInfoList(); |
4079 | QFileInfoListIterator it( *list ); // create list iterator | 4080 | QFileInfoListIterator it( *list ); // create list iterator |
4080 | QFileInfo *fi; // pointer for traversing | 4081 | QFileInfo *fi; // pointer for traversing |
4081 | 4082 | ||
4082 | while ( (fi=it.current()) ) { // for each file... | 4083 | while ( (fi=it.current()) ) { // for each file... |
4083 | 4084 | ||
4084 | bkmkselector->insertItem(fi->fileName()); | 4085 | bkmkselector->insertItem(fi->fileName()); |
4085 | cnt++; | 4086 | cnt++; |
4086 | 4087 | ||
4087 | //qDebug( "%10li %s", fi->size(), fi->fileName().data() ); | 4088 | //odebug << "" << fi->size() << " " << fi->fileName().data() << "" << oendl; |
4088 | ++it; // goto next list element | 4089 | ++it; // goto next list element |
4089 | } | 4090 | } |
4090 | 4091 | ||
4091 | #else /* USEQPE */ | 4092 | #else /* USEQPE */ |
4092 | int cnt = 0; | 4093 | int cnt = 0; |
4093 | DIR *d; | 4094 | DIR *d; |
4094 | char* finaldir; | 4095 | char* finaldir; |
4095 | finaldir = new char[strlen(APPDIR)+1+strlen(tgtdir)+1]; | 4096 | finaldir = new char[strlen(APPDIR)+1+strlen(tgtdir)+1]; |
4096 | strcpy(finaldir, APPDIR); | 4097 | strcpy(finaldir, APPDIR); |
4097 | strcat(finaldir, "/"); | 4098 | strcat(finaldir, "/"); |
4098 | strcat(finaldir, tgtdir); | 4099 | strcat(finaldir, tgtdir); |
4099 | d = opendir((const char *)Global::applicationFileName(finaldir,"")); | 4100 | d = opendir((const char *)Global::applicationFileName(finaldir,"")); |
@@ -4159,56 +4160,56 @@ void QTReaderApp::OnURLSelected(const QString& href) | |||
4159 | urld->clipboard(m_url_clipboard); | 4160 | urld->clipboard(m_url_clipboard); |
4160 | urld->localfile(m_url_localfile); | 4161 | urld->localfile(m_url_localfile); |
4161 | urld->globalfile(m_url_globalfile); | 4162 | urld->globalfile(m_url_globalfile); |
4162 | if (urld->exec()) | 4163 | if (urld->exec()) |
4163 | { | 4164 | { |
4164 | m_url_clipboard = urld->clipboard(); | 4165 | m_url_clipboard = urld->clipboard(); |
4165 | m_url_localfile = urld->localfile(); | 4166 | m_url_localfile = urld->localfile(); |
4166 | m_url_globalfile = urld->globalfile(); | 4167 | m_url_globalfile = urld->globalfile(); |
4167 | if (m_url_clipboard) | 4168 | if (m_url_clipboard) |
4168 | { | 4169 | { |
4169 | QClipboard* cb = QApplication::clipboard(); | 4170 | QClipboard* cb = QApplication::clipboard(); |
4170 | cb->setText(href); | 4171 | cb->setText(href); |
4171 | qDebug("<a href=\"%s\">%s</a>", (const char*)href, (const char*)href); | 4172 | odebug << "<a href=\"" << href << "\">" << href << "</a>" << oendl; |
4172 | } | 4173 | } |
4173 | if (m_url_localfile) | 4174 | if (m_url_localfile) |
4174 | { | 4175 | { |
4175 | writeUrl(reader->m_string, href); | 4176 | writeUrl(reader->m_string, href); |
4176 | } | 4177 | } |
4177 | if (m_url_globalfile) | 4178 | if (m_url_globalfile) |
4178 | { | 4179 | { |
4179 | writeUrl("GlobalURLFile", href); | 4180 | writeUrl("GlobalURLFile", href); |
4180 | } | 4181 | } |
4181 | } | 4182 | } |
4182 | delete urld; | 4183 | delete urld; |
4183 | } | 4184 | } |
4184 | 4185 | ||
4185 | void QTReaderApp::writeUrl(const QString& file, const QString& href) | 4186 | void QTReaderApp::writeUrl(const QString& file, const QString& href) |
4186 | { | 4187 | { |
4187 | QString filename; | 4188 | QString filename; |
4188 | #ifdef USEQPE | 4189 | #ifdef USEQPE |
4189 | filename = Global::applicationFileName(APPDIR "/urls", file); | 4190 | filename = Global::applicationFileName(APPDIR "/urls", file); |
4190 | #else | 4191 | #else |
4191 | QFileInfo fi; | 4192 | QFileInfo fi; |
4192 | QDir d = QDir::home(); // "/" | 4193 | QDir d = QDir::home(); // "/" |
4193 | if ( !d.cd(APPDIR) ) | 4194 | if ( !d.cd(APPDIR) ) |
4194 | { // "/tmp" | 4195 | { // "/tmp" |
4195 | qWarning( "Cannot find the \"~/" APPDIR "\" directory" ); | 4196 | owarn << "Cannot find the \"~/" APPDIR "\" directory" << oendl; |
4196 | d = QDir::home(); | 4197 | d = QDir::home(); |
4197 | d.mkdir(APPDIR); | 4198 | d.mkdir(APPDIR); |
4198 | d.cd(APPDIR); | 4199 | d.cd(APPDIR); |
4199 | } | 4200 | } |
4200 | if ( !d.cd("urls") ) | 4201 | if ( !d.cd("urls") ) |
4201 | { // "/tmp" | 4202 | { // "/tmp" |
4202 | qWarning( "Cannot find the \"~/" APPDIR "/urls\" directory" ); | 4203 | owarn << "Cannot find the \"~/" APPDIR "/urls\" directory" << oendl; |
4203 | d = QDir::home(); | 4204 | d = QDir::home(); |
4204 | d.cd(APPDIR); | 4205 | d.cd(APPDIR); |
4205 | d.mkdir("urls"); | 4206 | d.mkdir("urls"); |
4206 | d.cd("urls"); | 4207 | d.cd("urls"); |
4207 | } | 4208 | } |
4208 | fi.setFile(d, file); | 4209 | fi.setFile(d, file); |
4209 | filename = fi.absFilePath(); | 4210 | filename = fi.absFilePath(); |
4210 | #endif | 4211 | #endif |
4211 | FILE* fout = fopen(filename, "a"); | 4212 | FILE* fout = fopen(filename, "a"); |
4212 | if (fout != NULL) | 4213 | if (fout != NULL) |
4213 | { | 4214 | { |
4214 | 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); |