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 | |||
@@ -14,78 +14,79 @@ | |||
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 |
@@ -122,13 +123,13 @@ void QTReaderApp::listBkmkFiles() | |||
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 | ||
@@ -143,13 +144,13 @@ void QTReaderApp::listBkmkFiles() | |||
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; |
@@ -211,14 +212,14 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
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; |
@@ -240,13 +241,13 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
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 |
@@ -257,19 +258,19 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
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); |
@@ -353,24 +354,24 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
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 |
@@ -766,13 +767,13 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
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 |
@@ -798,23 +799,23 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
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]; |
@@ -828,30 +829,30 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
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 | { |
@@ -867,13 +868,13 @@ QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f ) | |||
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 | ||
@@ -1025,20 +1026,20 @@ 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; |
@@ -1050,13 +1051,13 @@ QToolBar* QTReaderApp::viewbar() | |||
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 | } |
@@ -1066,21 +1067,21 @@ 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() |
@@ -1090,13 +1091,13 @@ QToolBar* QTReaderApp::markbar() | |||
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 | } |
@@ -1124,13 +1125,13 @@ 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; |
@@ -1478,13 +1479,13 @@ void QTReaderApp::setfullscreen(bool sfs) | |||
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 | } |
@@ -1560,13 +1561,13 @@ void QTReaderApp::fileClose() | |||
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 | { |
@@ -1574,32 +1575,32 @@ void QTReaderApp::updatefileinfo() | |||
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 | ||
@@ -1608,13 +1609,13 @@ void QTReaderApp::fileOpen() | |||
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() |
@@ -1649,13 +1650,13 @@ void QTReaderApp::fileOpen2() | |||
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 ) ); |
@@ -1669,13 +1670,13 @@ QString QTReaderApp::usefilebrowser() | |||
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 | ||
@@ -1800,13 +1801,13 @@ void QTReaderApp::showprefs() | |||
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(); |
@@ -1860,13 +1861,13 @@ void QTReaderApp::showtoolbarprefs() | |||
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); |
@@ -1897,13 +1898,13 @@ void QTReaderApp::showtoolbarprefs() | |||
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() ); |
@@ -2172,13 +2173,13 @@ void QTReaderApp::editFind() | |||
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)); |
@@ -2268,18 +2269,18 @@ bool QTReaderApp::dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg) | |||
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; |
@@ -2330,13 +2331,13 @@ void QTReaderApp::search() | |||
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(); |
@@ -2377,25 +2378,25 @@ void QTReaderApp::resizeEvent(QResizeEvent* e) | |||
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 | { |
@@ -2404,13 +2405,13 @@ void QTReaderApp::handlekey(QKeyEvent* e) | |||
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 | { |
@@ -2503,17 +2504,17 @@ void QTReaderApp::showEditTools() | |||
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(); |
@@ -2529,26 +2530,26 @@ void QTReaderApp::showEditTools() | |||
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 | { |
@@ -2611,13 +2612,13 @@ void QTReaderApp::setDocument(const QString& 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 | } |
@@ -2628,13 +2629,13 @@ void QTReaderApp::closeEvent( QCloseEvent *e ) | |||
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) |
@@ -2706,13 +2707,13 @@ bool QTReaderApp::listbkmk(CList<Bkmk>* plist, const QString& _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 | } |
@@ -2735,15 +2736,15 @@ void QTReaderApp::do_autogen() | |||
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(); |
@@ -2753,16 +2754,16 @@ void QTReaderApp::do_regedit() | |||
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) |
@@ -2778,13 +2779,13 @@ bool QTReaderApp::openfrombkmk(Bkmk* bk) | |||
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 |
@@ -2809,13 +2810,13 @@ void QTReaderApp::gotobkmk(int ind) | |||
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 | { |
@@ -2909,13 +2910,13 @@ void QTReaderApp::gotobkmk(int ind) | |||
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"; |
@@ -2929,17 +2930,17 @@ void QTReaderApp::gotobkmk(int ind) | |||
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 | } |
@@ -3006,13 +3007,13 @@ void QTReaderApp::do_regaction() | |||
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(); |
@@ -3098,45 +3099,45 @@ void QTReaderApp::setfontHelper(const QString& lcn, int size) | |||
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; |
@@ -3177,13 +3178,13 @@ void QTReaderApp::do_autogen(const QString& regText) | |||
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 ); |
@@ -3258,17 +3259,17 @@ void QTReaderApp::saveprefs() | |||
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 | { |
@@ -3338,16 +3339,16 @@ void QTReaderApp::readfilelist() | |||
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 | { |
@@ -3356,13 +3357,13 @@ void QTReaderApp::savefilelist() | |||
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 | { |
@@ -3466,13 +3467,13 @@ void QTReaderApp::showAnnotation() | |||
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 |
@@ -3516,13 +3517,13 @@ void QTReaderApp::doAction(ActionTypes a, QKeyEvent* e) | |||
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 | } |
@@ -3579,13 +3580,13 @@ void QTReaderApp::doAction(ActionTypes a, QKeyEvent* e) | |||
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); } |
@@ -3597,13 +3598,13 @@ void QTReaderApp::SaveConfig() | |||
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 | { |
@@ -3620,44 +3621,44 @@ void QTReaderApp::do_saveconfig(const QString& _txt, bool full) | |||
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 ); |
@@ -3931,32 +3932,32 @@ bool QTReaderApp::readconfig(const QString& _txt, bool full=false) | |||
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 | } |
@@ -4058,19 +4059,19 @@ bool QTReaderApp::PopulateConfig(const char* tgtdir) | |||
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 ); |
@@ -4081,13 +4082,13 @@ bool QTReaderApp::PopulateConfig(const char* tgtdir) | |||
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; |
@@ -4165,13 +4166,13 @@ void QTReaderApp::OnURLSelected(const QString& href) | |||
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) |
@@ -4189,20 +4190,20 @@ void QTReaderApp::writeUrl(const QString& file, const QString& href) | |||
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); |