-rw-r--r-- | core/apps/textedit/textedit.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 8eaafce..bd0014a 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -1,213 +1,218 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // changes added by L. J. Potter Sun 02-17-2002 21:31:31 | 20 | // changes added by L. J. Potter Sun 02-17-2002 21:31:31 |
21 | 21 | /* | |
22 | useAdvancedfeatures = | ||
23 | 1) do not prompt on cancel, even if text is edited. | ||
24 | 2) prompt user is .desktop file | ||
25 | 3) prompt user for File Permissions on saveAs | ||
26 | */ | ||
22 | #include "textedit.h" | 27 | #include "textedit.h" |
23 | #include "filePermissions.h" | 28 | #include "filePermissions.h" |
24 | #include "fontDialog.h" | 29 | #include "fontDialog.h" |
25 | 30 | ||
26 | #include <opie/ofileselector.h> | 31 | #include <opie/ofileselector.h> |
27 | #include <opie/ofiledialog.h> | 32 | #include <opie/ofiledialog.h> |
28 | 33 | ||
29 | #include <qpe/fontdatabase.h> | 34 | #include <qpe/fontdatabase.h> |
30 | #include <qpe/global.h> | 35 | #include <qpe/global.h> |
31 | #include <qpe/fileselector.h> | 36 | #include <qpe/fileselector.h> |
32 | #include <qpe/applnk.h> | 37 | #include <qpe/applnk.h> |
33 | #include <qpe/resource.h> | 38 | #include <qpe/resource.h> |
34 | #include <qpe/config.h> | 39 | #include <qpe/config.h> |
35 | #include <qpe/qpeapplication.h> | 40 | #include <qpe/qpeapplication.h> |
36 | #include <qpe/qpemenubar.h> | 41 | #include <qpe/qpemenubar.h> |
37 | #include <qpe/qpetoolbar.h> | 42 | #include <qpe/qpetoolbar.h> |
38 | #include <qpe/qcopenvelope_qws.h> | 43 | #include <qpe/qcopenvelope_qws.h> |
39 | 44 | ||
40 | #include <qdatetime.h> | 45 | #include <qdatetime.h> |
41 | #include <qclipboard.h> | 46 | #include <qclipboard.h> |
42 | #include <qstringlist.h> | 47 | #include <qstringlist.h> |
43 | #include <qaction.h> | 48 | #include <qaction.h> |
44 | #include <qcolordialog.h> | 49 | #include <qcolordialog.h> |
45 | #include <qfileinfo.h> | 50 | #include <qfileinfo.h> |
46 | #include <qlineedit.h> | 51 | #include <qlineedit.h> |
47 | #include <qmessagebox.h> | 52 | #include <qmessagebox.h> |
48 | #include <qobjectlist.h> | 53 | #include <qobjectlist.h> |
49 | #include <qpopupmenu.h> | 54 | #include <qpopupmenu.h> |
50 | #include <qspinbox.h> | 55 | #include <qspinbox.h> |
51 | #include <qtoolbutton.h> | 56 | #include <qtoolbutton.h> |
52 | #include <qwidgetstack.h> | 57 | #include <qwidgetstack.h> |
53 | #include <qcheckbox.h> | 58 | #include <qcheckbox.h> |
54 | #include <qcombo.h> | 59 | #include <qcombo.h> |
55 | 60 | ||
56 | #include <unistd.h> | 61 | #include <unistd.h> |
57 | #include <sys/stat.h> | 62 | #include <sys/stat.h> |
58 | #include <stdlib.h> //getenv | 63 | #include <stdlib.h> //getenv |
59 | 64 | ||
60 | 65 | ||
61 | /* XPM */ | 66 | /* XPM */ |
62 | static char * filesave_xpm[] = { | 67 | static char * filesave_xpm[] = { |
63 | "16 16 78 1", | 68 | "16 16 78 1", |
64 | " c None", | 69 | " c None", |
65 | ". c #343434", | 70 | ". c #343434", |
66 | "+ c #A0A0A0", | 71 | "+ c #A0A0A0", |
67 | "@ c #565656", | 72 | "@ c #565656", |
68 | "# c #9E9E9E", | 73 | "# c #9E9E9E", |
69 | "$ c #525252", | 74 | "$ c #525252", |
70 | "% c #929292", | 75 | "% c #929292", |
71 | "& c #676767", | 76 | "& c #676767", |
72 | "* c #848484", | 77 | "* c #848484", |
73 | "= c #666666", | 78 | "= c #666666", |
74 | "- c #D8D8D8", | 79 | "- c #D8D8D8", |
75 | "; c #FFFFFF", | 80 | "; c #FFFFFF", |
76 | "> c #DBDBDB", | 81 | "> c #DBDBDB", |
77 | ", c #636363", | 82 | ", c #636363", |
78 | "' c #989898", | 83 | "' c #989898", |
79 | ") c #2D2D2D", | 84 | ") c #2D2D2D", |
80 | "! c #909090", | 85 | "! c #909090", |
81 | "~ c #AEAEAE", | 86 | "~ c #AEAEAE", |
82 | "{ c #EAEAEA", | 87 | "{ c #EAEAEA", |
83 | "] c #575757", | 88 | "] c #575757", |
84 | "^ c #585858", | 89 | "^ c #585858", |
85 | "/ c #8A8A8A", | 90 | "/ c #8A8A8A", |
86 | "( c #828282", | 91 | "( c #828282", |
87 | "_ c #6F6F6F", | 92 | "_ c #6F6F6F", |
88 | ": c #C9C9C9", | 93 | ": c #C9C9C9", |
89 | "< c #050505", | 94 | "< c #050505", |
90 | "[ c #292929", | 95 | "[ c #292929", |
91 | "} c #777777", | 96 | "} c #777777", |
92 | "| c #616161", | 97 | "| c #616161", |
93 | "1 c #3A3A3A", | 98 | "1 c #3A3A3A", |
94 | "2 c #BEBEBE", | 99 | "2 c #BEBEBE", |
95 | "3 c #2C2C2C", | 100 | "3 c #2C2C2C", |
96 | "4 c #7C7C7C", | 101 | "4 c #7C7C7C", |
97 | "5 c #F6F6F6", | 102 | "5 c #F6F6F6", |
98 | "6 c #FCFCFC", | 103 | "6 c #FCFCFC", |
99 | "7 c #6B6B6B", | 104 | "7 c #6B6B6B", |
100 | "8 c #959595", | 105 | "8 c #959595", |
101 | "9 c #4F4F4F", | 106 | "9 c #4F4F4F", |
102 | "0 c #808080", | 107 | "0 c #808080", |
103 | "a c #767676", | 108 | "a c #767676", |
104 | "b c #818181", | 109 | "b c #818181", |
105 | "c c #B8B8B8", | 110 | "c c #B8B8B8", |
106 | "d c #FBFBFB", | 111 | "d c #FBFBFB", |
107 | "e c #F9F9F9", | 112 | "e c #F9F9F9", |
108 | "f c #CCCCCC", | 113 | "f c #CCCCCC", |
109 | "g c #030303", | 114 | "g c #030303", |
110 | "h c #737373", | 115 | "h c #737373", |
111 | "i c #7A7A7A", | 116 | "i c #7A7A7A", |
112 | "j c #7E7E7E", | 117 | "j c #7E7E7E", |
113 | "k c #6A6A6A", | 118 | "k c #6A6A6A", |
114 | "l c #FAFAFA", | 119 | "l c #FAFAFA", |
115 | "m c #505050", | 120 | "m c #505050", |
116 | "n c #9D9D9D", | 121 | "n c #9D9D9D", |
117 | "o c #333333", | 122 | "o c #333333", |
118 | "p c #7B7B7B", | 123 | "p c #7B7B7B", |
119 | "q c #787878", | 124 | "q c #787878", |
120 | "r c #696969", | 125 | "r c #696969", |
121 | "s c #494949", | 126 | "s c #494949", |
122 | "t c #555555", | 127 | "t c #555555", |
123 | "u c #949494", | 128 | "u c #949494", |
124 | "v c #E6E6E6", | 129 | "v c #E6E6E6", |
125 | "w c #424242", | 130 | "w c #424242", |
126 | "x c #515151", | 131 | "x c #515151", |
127 | "y c #535353", | 132 | "y c #535353", |
128 | "z c #3E3E3E", | 133 | "z c #3E3E3E", |
129 | "A c #D4D4D4", | 134 | "A c #D4D4D4", |
130 | "B c #0C0C0C", | 135 | "B c #0C0C0C", |
131 | "C c #353535", | 136 | "C c #353535", |
132 | "D c #474747", | 137 | "D c #474747", |
133 | "E c #ECECEC", | 138 | "E c #ECECEC", |
134 | "F c #919191", | 139 | "F c #919191", |
135 | "G c #7D7D7D", | 140 | "G c #7D7D7D", |
136 | "H c #000000", | 141 | "H c #000000", |
137 | "I c #404040", | 142 | "I c #404040", |
138 | "J c #858585", | 143 | "J c #858585", |
139 | "K c #323232", | 144 | "K c #323232", |
140 | "L c #D0D0D0", | 145 | "L c #D0D0D0", |
141 | "M c #1C1C1C", | 146 | "M c #1C1C1C", |
142 | " ...+ ", | 147 | " ...+ ", |
143 | " @#$%&..+ ", | 148 | " @#$%&..+ ", |
144 | " .*=-;;>,..+ ", | 149 | " .*=-;;>,..+ ", |
145 | " ')!~;;;;;;{]..", | 150 | " ')!~;;;;;;{]..", |
146 | " ^/(-;;;;;;;_:<", | 151 | " ^/(-;;;;;;;_:<", |
147 | " [}|;;;;;;;{12$", | 152 | " [}|;;;;;;;{12$", |
148 | " #34-55;;;;678$+", | 153 | " #34-55;;;;678$+", |
149 | " 90ab=c;dd;e1fg ", | 154 | " 90ab=c;dd;e1fg ", |
150 | " [ahij((kbl0mn$ ", | 155 | " [ahij((kbl0mn$ ", |
151 | " op^q^^7r&]s/$+ ", | 156 | " op^q^^7r&]s/$+ ", |
152 | "@btu;vbwxy]zAB ", | 157 | "@btu;vbwxy]zAB ", |
153 | "CzDEvEv;;DssF$ ", | 158 | "CzDEvEv;;DssF$ ", |
154 | "G.H{E{E{IxsJ$+ ", | 159 | "G.H{E{E{IxsJ$+ ", |
155 | " +...vEKxzLM ", | 160 | " +...vEKxzLM ", |
156 | " +...z]n$ ", | 161 | " +...z]n$ ", |
157 | " +... "}; | 162 | " +... "}; |
158 | 163 | ||
159 | 164 | ||
160 | #if QT_VERSION < 300 | 165 | #if QT_VERSION < 300 |
161 | 166 | ||
162 | class QpeEditor : public QMultiLineEdit | 167 | class QpeEditor : public QMultiLineEdit |
163 | { | 168 | { |
164 | // Q_OBJECT | 169 | // Q_OBJECT |
165 | public: | 170 | public: |
166 | QpeEditor( QWidget *parent, const char * name = 0 ) | 171 | QpeEditor( QWidget *parent, const char * name = 0 ) |
167 | : QMultiLineEdit( parent, name ) | 172 | : QMultiLineEdit( parent, name ) |
168 | { | 173 | { |
169 | clearTableFlags(); | 174 | clearTableFlags(); |
170 | setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); | 175 | setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); |
171 | } | 176 | } |
172 | 177 | ||
173 | void find( const QString &txt, bool caseSensitive, | 178 | void find( const QString &txt, bool caseSensitive, |
174 | bool backwards ); | 179 | bool backwards ); |
175 | //public slots: | 180 | //public slots: |
176 | /* | 181 | /* |
177 | signals: | 182 | signals: |
178 | void notFound(); | 183 | void notFound(); |
179 | void searchWrapped(); | 184 | void searchWrapped(); |
180 | */ | 185 | */ |
181 | 186 | ||
182 | private: | 187 | private: |
183 | 188 | ||
184 | }; | 189 | }; |
185 | 190 | ||
186 | 191 | ||
187 | void QpeEditor::find ( const QString &txt, bool caseSensitive, | 192 | void QpeEditor::find ( const QString &txt, bool caseSensitive, |
188 | bool backwards ) | 193 | bool backwards ) |
189 | { | 194 | { |
190 | static bool wrap = FALSE; | 195 | static bool wrap = FALSE; |
191 | int line, col; | 196 | int line, col; |
192 | if ( wrap ) { | 197 | if ( wrap ) { |
193 | if ( !backwards ) | 198 | if ( !backwards ) |
194 | line = col = 0; | 199 | line = col = 0; |
195 | wrap = FALSE; | 200 | wrap = FALSE; |
196 | // emit searchWrapped(); | 201 | // emit searchWrapped(); |
197 | } else { | 202 | } else { |
198 | getCursorPosition( &line, &col ); | 203 | getCursorPosition( &line, &col ); |
199 | } | 204 | } |
200 | //ignore backwards for now.... | 205 | //ignore backwards for now.... |
201 | if ( !backwards ) { | 206 | if ( !backwards ) { |
202 | for ( ; ; ) { | 207 | for ( ; ; ) { |
203 | if ( line >= numLines() ) { | 208 | if ( line >= numLines() ) { |
204 | wrap = TRUE; | 209 | wrap = TRUE; |
205 | //emit notFound(); | 210 | //emit notFound(); |
206 | break; | 211 | break; |
207 | } | 212 | } |
208 | int findCol = getString( line )->find( txt, col, caseSensitive ); | 213 | int findCol = getString( line )->find( txt, col, caseSensitive ); |
209 | if ( findCol >= 0 ) { | 214 | if ( findCol >= 0 ) { |
210 | setCursorPosition( line, findCol, FALSE ); | 215 | setCursorPosition( line, findCol, FALSE ); |
211 | col = findCol + txt.length(); | 216 | col = findCol + txt.length(); |
212 | setCursorPosition( line, col, TRUE ); | 217 | setCursorPosition( line, col, TRUE ); |
213 | 218 | ||