summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/QTReaderApp.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/QTReaderApp.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.h73
1 files changed, 65 insertions, 8 deletions
diff --git a/noncore/apps/opie-reader/QTReaderApp.h b/noncore/apps/opie-reader/QTReaderApp.h
index 48575e9..22c57e4 100644
--- a/noncore/apps/opie-reader/QTReaderApp.h
+++ b/noncore/apps/opie-reader/QTReaderApp.h
@@ -20,30 +20,43 @@
20#ifndef __QTREADERAPP_H 20#ifndef __QTREADERAPP_H
21#define __QTREADERAPP_H 21#define __QTREADERAPP_H
22 22
23//#define __ISEARCH 23//#define __ISEARCH
24 24
25#define MAX_ENCODING 6 25#define MAX_ENCODING 6
26#define MAX_ACTIONS 3
26 27
27#include <qmainwindow.h> 28#include <qmainwindow.h>
28#include "QTReader.h" 29#include "CExpander.h"
29#include <qlist.h> 30#include <qlist.h>
30#include <qpe/filemanager.h> 31#include <qpe/filemanager.h>
31#include <qmap.h> 32#include <qmap.h>
32#include <qlineedit.h> 33#include <qlineedit.h>
33#include <qstack.h> 34#include <qstack.h>
34#include <qlistbox.h> 35#include <qlistbox.h>
35#include "Queue.h" 36//#include "Queue.h"
36 37
37class QWidgetStack; 38class QWidgetStack;
38class QToolButton; 39class QToolButton;
39class QPopupMenu; 40class QPopupMenu;
40class QToolBar; 41class QToolBar;
42class QPEToolBar;
41class CBkmkSelector; 43class CBkmkSelector;
42class QProgressBar; 44class QProgressBar;
43class QAction; 45class QAction;
46class CAnnoEdit;
47class QFloatBar;
48class CDrawBuffer;
49class QTReader;
50
51enum ActionTypes
52{
53 cesOpenFile = 0,
54 cesAutoScroll,
55 cesActionMark
56};
44 57
45#ifdef __ISEARCH 58#ifdef __ISEARCH
46struct searchrecord 59struct searchrecord
47{ 60{
48 QString s; 61 QString s;
49 size_t pos; 62 size_t pos;
@@ -55,34 +68,64 @@ class infowin;
55 68
56class QTReaderApp : public QMainWindow 69class QTReaderApp : public QMainWindow
57{ 70{
58 Q_OBJECT 71 Q_OBJECT
59 72
60 unsigned long m_savedpos; 73 unsigned long m_savedpos;
74 bool m_annoIsEditing;
61 75
62 public: 76 public:
63 QTReaderApp( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 77 QTReaderApp( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
64 ~QTReaderApp(); 78 ~QTReaderApp();
65 79
66 void openFile( const QString & ); 80 void openFile( const QString & );
67 81
68 void setScrollState(bool _b); 82 void setScrollState(bool _b);
69 83
70 protected: 84 protected:
85 void setfontHelper(const QString& lcn, int size = 0);
86 QAction* m_bkmkAvail;
87 CAnnoEdit* m_annoWin;
88 Bkmk* m_anno;
71 void closeEvent( QCloseEvent *e ); 89 void closeEvent( QCloseEvent *e );
72 void readbkmks(); 90 void readbkmks();
73 void do_mono(const QString&); 91 void do_mono(const QString&);
74 void do_jump(const QString&); 92 void do_jump(const QString&);
75 void do_overlap(const QString&); 93 void do_overlap(const QString&);
76 void do_settarget(const QString&); 94 void do_settarget(const QString&);
77 int EncNameToInt(const QString&); 95 int EncNameToInt(const QString&);
78 void saveprefs(); 96 ActionTypes ActNameToInt(const QString&);
97 bool m_doAnnotation;
98 bool m_doDictionary;
99 bool m_doClipboard;
79 100
101 public:
102 void saveprefs();
80private slots: 103private slots:
104 void setTwoTouch(bool _b);
105 void restoreFocus();
106 void OnAnnotation(bool _b)
107 {
108 m_doAnnotation = _b;
109 }
110 void OnDictionary(bool _b)
111 {
112 m_doDictionary = _b;
113 }
114 void OnClipboard(bool _b)
115 {
116 m_doClipboard = _b;
117 }
118 void OnWordSelected(const QString&, size_t, const QString&);
119 void addAnno(const QString&, const QString&, size_t);
120 void addAnno(const QString&, const QString&);
121 void addanno();
122 void showAnnotation();
81 void do_setfont(const QString&); 123 void do_setfont(const QString&);
82 void encodingSelected(QAction*); 124 void encodingSelected(QAction*);
125 void buttonActionSelected(QAction*);
83 void msgHandler(const QCString&, const QByteArray&); 126 void msgHandler(const QCString&, const QByteArray&);
84 void monospace(bool); 127 void monospace(bool);
85 void jump(); 128 void jump();
86 void setoverlap(); 129 void setoverlap();
87 void settarget(); 130 void settarget();
88 void setspacing(); 131 void setspacing();
@@ -124,60 +167,73 @@ private slots:
124#endif 167#endif
125 168
126 void openFile( const DocLnk & ); 169 void openFile( const DocLnk & );
127 void showEditTools(); 170 void showEditTools();
128 171
129 void stripcr(bool); 172 void stripcr(bool);
173 void peanut(bool _b);
174 void remap(bool);
175 void embolden(bool);
176 void autofmt(bool);
177 void textfmt(bool);
130 void striphtml(bool); 178 void striphtml(bool);
131 void dehyphen(bool); 179 void dehyphen(bool);
132 void unindent(bool); 180 void unindent(bool);
133 void repara(bool); 181 void repara(bool);
134 void setbold(bool);
135 void dblspce(bool); 182 void dblspce(bool);
136 void pagemode(bool); 183 void pagemode(bool);
137 // void gotobkmk(const QString& bm); 184 // void gotobkmk(const QString& bm);
138 void gotobkmk(int); 185 void gotobkmk(int);
139 void cancelbkmk(); 186 void cancelbkmk();
140 void do_gotomark(); 187 void do_gotomark();
141 void do_delmark(); 188 void do_delmark();
142 void do_autogen(); 189 void do_autogen();
143 void do_regaction(); 190 void do_regaction();
191 void OnRedraw();
192 void OnActionPressed();
144 193
145 private: 194 private:
195 QString m_targetapp, m_targetmsg;
146 void listbkmk(); 196 void listbkmk();
147 void do_regedit(); 197 void do_regedit();
148 void colorChanged( const QColor &c ); 198 void colorChanged( const QColor &c );
149 void clear(); 199 void clear();
150 void updateCaption(); 200 void updateCaption();
151 void do_autogen(const QString&); 201 void do_autogen(const QString&);
152 void do_addbkmk(const QString&); 202 void do_addbkmk(const QString&);
203 bool findNextBookmark(size_t start);
153 204
154 private: 205 private:
155 206
156 QAction* m_scrollButton; 207 QAction* m_scrollButton;
157 208
158 QAction* m_EncodingAction[MAX_ENCODING]; 209 QAction* m_EncodingAction[MAX_ENCODING];
159 210
211 QAction* m_buttonAction[MAX_ACTIONS];
212
160 CBkmkSelector* bkmkselector; 213 CBkmkSelector* bkmkselector;
161 214
215 ActionTypes m_spaceTarget;
162 size_t searchStart; 216 size_t searchStart;
163#ifdef __ISEARCH 217#ifdef __ISEARCH
164 QStack<searchrecord>* searchStack; 218 QStack<searchrecord>* searchStack;
165 bool dosearch(size_t start, CBuffer& test, const QString& arg); 219 bool dosearch(size_t start, CDrawBuffer& test, const QString& arg);
166#else 220#else
167 bool dosearch(size_t start, CBuffer& test, const QRegExp& arg); 221 bool dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg);
168#endif 222#endif
169 QWidgetStack *editorStack; 223 QWidgetStack *editorStack;
170 QTReader* reader; 224 QTReader* reader;
171 QComboBox* m_fontSelector; 225 QComboBox* m_fontSelector;
172 QToolBar *menu, *editBar, *searchBar, *regBar, *m_fontBar; 226 QPEToolBar /* *menu,*/ *editBar;
227 QFloatBar *searchBar, *regBar/*, *m_fontBar*/;
228 QToolBar /* *searchBar, *regBar,*/ *m_fontBar;
173 QLineEdit *searchEdit, *regEdit; 229 QLineEdit *searchEdit, *regEdit;
174 DocLnk *doc; 230 DocLnk *doc;
175 bool searchVisible; 231 bool searchVisible;
176 bool regVisible; 232 bool regVisible;
177 bool m_fontVisible; 233 bool m_fontVisible, m_twoTouch;
178 bool bFromDocView; 234 bool bFromDocView;
179 static unsigned long m_uid; 235 static unsigned long m_uid;
180 long unsigned get_unique_id() { return m_uid++; } 236 long unsigned get_unique_id() { return m_uid++; }
181 /* 237 /*
182 void resizeEvent( QResizeEvent * r) 238 void resizeEvent( QResizeEvent * r)
183 { 239 {
@@ -189,12 +245,13 @@ private slots:
189 CList<Bkmk>* pBkmklist; 245 CList<Bkmk>* pBkmklist;
190 infowin* m_infoWin; 246 infowin* m_infoWin;
191 QProgressBar* pbar; 247 QProgressBar* pbar;
192 bool m_fBkmksChanged; 248 bool m_fBkmksChanged;
193 int m_nRegAction; 249 int m_nRegAction;
194 QString m_autogenstr; 250 QString m_autogenstr;
251 bool m_dontSave;
195}; 252};
196 253
197const int cAutoGen = 0; 254const int cAutoGen = 0;
198const int cAddBkmk = 1; 255const int cAddBkmk = 1;
199const int cDelBkmk = 2; 256const int cDelBkmk = 2;
200const int cGotoBkmk = 3; 257const int cGotoBkmk = 3;