author | llornkcor <llornkcor> | 2002-10-03 13:04:26 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-10-03 13:04:26 (UTC) |
commit | 8a7f57c5c172958d67d8397eed1860c914df485d (patch) (unidiff) | |
tree | f665602210cf23240c626dabb15b2b4e13ad5e60 | |
parent | ee864e9e055fd23778a8e5dd3c35e3a29cded368 (diff) | |
download | opie-8a7f57c5c172958d67d8397eed1860c914df485d.zip opie-8a7f57c5c172958d67d8397eed1860c914df485d.tar.gz opie-8a7f57c5c172958d67d8397eed1860c914df485d.tar.bz2 |
fix not opening
-rw-r--r-- | core/apps/textedit/textedit.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 7b50a6c..6844023 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -1,960 +1,961 @@ | |||
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 = | 22 | useAdvancedfeatures = |
23 | 1) do not prompt on cancel, even if text is edited. | 23 | 1) do not prompt on cancel, even if text is edited. |
24 | 2) prompt user is .desktop file | 24 | 2) prompt user is .desktop file |
25 | 3) prompt user for File Permissions on saveAs | 25 | 3) prompt user for File Permissions on saveAs |
26 | */ | 26 | */ |
27 | #include "textedit.h" | 27 | #include "textedit.h" |
28 | #include "filePermissions.h" | 28 | #include "filePermissions.h" |
29 | //#include "fontDialog.h" | 29 | //#include "fontDialog.h" |
30 | 30 | ||
31 | #include <opie/ofileselector.h> | 31 | #include <opie/ofileselector.h> |
32 | #include <opie/ofiledialog.h> | 32 | #include <opie/ofiledialog.h> |
33 | #include <opie/ofontselector.h> | 33 | #include <opie/ofontselector.h> |
34 | 34 | ||
35 | #include <qpe/fontdatabase.h> | 35 | #include <qpe/fontdatabase.h> |
36 | #include <qpe/global.h> | 36 | #include <qpe/global.h> |
37 | #include <qpe/fileselector.h> | 37 | #include <qpe/fileselector.h> |
38 | #include <qpe/applnk.h> | 38 | #include <qpe/applnk.h> |
39 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
40 | #include <qpe/config.h> | 40 | #include <qpe/config.h> |
41 | #include <qpe/qpeapplication.h> | 41 | #include <qpe/qpeapplication.h> |
42 | #include <qpe/qpemenubar.h> | 42 | #include <qpe/qpemenubar.h> |
43 | #include <qpe/qpetoolbar.h> | 43 | #include <qpe/qpetoolbar.h> |
44 | #include <qpe/qcopenvelope_qws.h> | 44 | #include <qpe/qcopenvelope_qws.h> |
45 | 45 | ||
46 | #include <qdatetime.h> | 46 | #include <qdatetime.h> |
47 | #include <qclipboard.h> | 47 | #include <qclipboard.h> |
48 | #include <qstringlist.h> | 48 | #include <qstringlist.h> |
49 | #include <qaction.h> | 49 | #include <qaction.h> |
50 | #include <qcolordialog.h> | 50 | #include <qcolordialog.h> |
51 | #include <qfileinfo.h> | 51 | #include <qfileinfo.h> |
52 | #include <qlineedit.h> | 52 | #include <qlineedit.h> |
53 | #include <qmessagebox.h> | 53 | #include <qmessagebox.h> |
54 | #include <qobjectlist.h> | 54 | #include <qobjectlist.h> |
55 | #include <qpopupmenu.h> | 55 | #include <qpopupmenu.h> |
56 | #include <qspinbox.h> | 56 | #include <qspinbox.h> |
57 | #include <qtoolbutton.h> | 57 | #include <qtoolbutton.h> |
58 | #include <qwidgetstack.h> | 58 | #include <qwidgetstack.h> |
59 | #include <qcheckbox.h> | 59 | #include <qcheckbox.h> |
60 | #include <qcombo.h> | 60 | #include <qcombo.h> |
61 | #include <qlayout.h> | 61 | #include <qlayout.h> |
62 | 62 | ||
63 | #include <unistd.h> | 63 | #include <unistd.h> |
64 | #include <sys/stat.h> | 64 | #include <sys/stat.h> |
65 | #include <stdlib.h> //getenv | 65 | #include <stdlib.h> //getenv |
66 | 66 | ||
67 | 67 | ||
68 | /* XPM */ | 68 | /* XPM */ |
69 | static char * filesave_xpm[] = { | 69 | static char * filesave_xpm[] = { |
70 | "16 16 78 1", | 70 | "16 16 78 1", |
71 | " c None", | 71 | " c None", |
72 | ". c #343434", | 72 | ". c #343434", |
73 | "+ c #A0A0A0", | 73 | "+ c #A0A0A0", |
74 | "@ c #565656", | 74 | "@ c #565656", |
75 | "# c #9E9E9E", | 75 | "# c #9E9E9E", |
76 | "$ c #525252", | 76 | "$ c #525252", |
77 | "% c #929292", | 77 | "% c #929292", |
78 | "& c #676767", | 78 | "& c #676767", |
79 | "* c #848484", | 79 | "* c #848484", |
80 | "= c #666666", | 80 | "= c #666666", |
81 | "- c #D8D8D8", | 81 | "- c #D8D8D8", |
82 | "; c #FFFFFF", | 82 | "; c #FFFFFF", |
83 | "> c #DBDBDB", | 83 | "> c #DBDBDB", |
84 | ", c #636363", | 84 | ", c #636363", |
85 | "' c #989898", | 85 | "' c #989898", |
86 | ") c #2D2D2D", | 86 | ") c #2D2D2D", |
87 | "! c #909090", | 87 | "! c #909090", |
88 | "~ c #AEAEAE", | 88 | "~ c #AEAEAE", |
89 | "{ c #EAEAEA", | 89 | "{ c #EAEAEA", |
90 | "] c #575757", | 90 | "] c #575757", |
91 | "^ c #585858", | 91 | "^ c #585858", |
92 | "/ c #8A8A8A", | 92 | "/ c #8A8A8A", |
93 | "( c #828282", | 93 | "( c #828282", |
94 | "_ c #6F6F6F", | 94 | "_ c #6F6F6F", |
95 | ": c #C9C9C9", | 95 | ": c #C9C9C9", |
96 | "< c #050505", | 96 | "< c #050505", |
97 | "[ c #292929", | 97 | "[ c #292929", |
98 | "} c #777777", | 98 | "} c #777777", |
99 | "| c #616161", | 99 | "| c #616161", |
100 | "1 c #3A3A3A", | 100 | "1 c #3A3A3A", |
101 | "2 c #BEBEBE", | 101 | "2 c #BEBEBE", |
102 | "3 c #2C2C2C", | 102 | "3 c #2C2C2C", |
103 | "4 c #7C7C7C", | 103 | "4 c #7C7C7C", |
104 | "5 c #F6F6F6", | 104 | "5 c #F6F6F6", |
105 | "6 c #FCFCFC", | 105 | "6 c #FCFCFC", |
106 | "7 c #6B6B6B", | 106 | "7 c #6B6B6B", |
107 | "8 c #959595", | 107 | "8 c #959595", |
108 | "9 c #4F4F4F", | 108 | "9 c #4F4F4F", |
109 | "0 c #808080", | 109 | "0 c #808080", |
110 | "a c #767676", | 110 | "a c #767676", |
111 | "b c #818181", | 111 | "b c #818181", |
112 | "c c #B8B8B8", | 112 | "c c #B8B8B8", |
113 | "d c #FBFBFB", | 113 | "d c #FBFBFB", |
114 | "e c #F9F9F9", | 114 | "e c #F9F9F9", |
115 | "f c #CCCCCC", | 115 | "f c #CCCCCC", |
116 | "g c #030303", | 116 | "g c #030303", |
117 | "h c #737373", | 117 | "h c #737373", |
118 | "i c #7A7A7A", | 118 | "i c #7A7A7A", |
119 | "j c #7E7E7E", | 119 | "j c #7E7E7E", |
120 | "k c #6A6A6A", | 120 | "k c #6A6A6A", |
121 | "l c #FAFAFA", | 121 | "l c #FAFAFA", |
122 | "m c #505050", | 122 | "m c #505050", |
123 | "n c #9D9D9D", | 123 | "n c #9D9D9D", |
124 | "o c #333333", | 124 | "o c #333333", |
125 | "p c #7B7B7B", | 125 | "p c #7B7B7B", |
126 | "q c #787878", | 126 | "q c #787878", |
127 | "r c #696969", | 127 | "r c #696969", |
128 | "s c #494949", | 128 | "s c #494949", |
129 | "t c #555555", | 129 | "t c #555555", |
130 | "u c #949494", | 130 | "u c #949494", |
131 | "v c #E6E6E6", | 131 | "v c #E6E6E6", |
132 | "w c #424242", | 132 | "w c #424242", |
133 | "x c #515151", | 133 | "x c #515151", |
134 | "y c #535353", | 134 | "y c #535353", |
135 | "z c #3E3E3E", | 135 | "z c #3E3E3E", |
136 | "A c #D4D4D4", | 136 | "A c #D4D4D4", |
137 | "B c #0C0C0C", | 137 | "B c #0C0C0C", |
138 | "C c #353535", | 138 | "C c #353535", |
139 | "D c #474747", | 139 | "D c #474747", |
140 | "E c #ECECEC", | 140 | "E c #ECECEC", |
141 | "F c #919191", | 141 | "F c #919191", |
142 | "G c #7D7D7D", | 142 | "G c #7D7D7D", |
143 | "H c #000000", | 143 | "H c #000000", |
144 | "I c #404040", | 144 | "I c #404040", |
145 | "J c #858585", | 145 | "J c #858585", |
146 | "K c #323232", | 146 | "K c #323232", |
147 | "L c #D0D0D0", | 147 | "L c #D0D0D0", |
148 | "M c #1C1C1C", | 148 | "M c #1C1C1C", |
149 | " ...+ ", | 149 | " ...+ ", |
150 | " @#$%&..+ ", | 150 | " @#$%&..+ ", |
151 | " .*=-;;>,..+ ", | 151 | " .*=-;;>,..+ ", |
152 | " ')!~;;;;;;{]..", | 152 | " ')!~;;;;;;{]..", |
153 | " ^/(-;;;;;;;_:<", | 153 | " ^/(-;;;;;;;_:<", |
154 | " [}|;;;;;;;{12$", | 154 | " [}|;;;;;;;{12$", |
155 | " #34-55;;;;678$+", | 155 | " #34-55;;;;678$+", |
156 | " 90ab=c;dd;e1fg ", | 156 | " 90ab=c;dd;e1fg ", |
157 | " [ahij((kbl0mn$ ", | 157 | " [ahij((kbl0mn$ ", |
158 | " op^q^^7r&]s/$+ ", | 158 | " op^q^^7r&]s/$+ ", |
159 | "@btu;vbwxy]zAB ", | 159 | "@btu;vbwxy]zAB ", |
160 | "CzDEvEv;;DssF$ ", | 160 | "CzDEvEv;;DssF$ ", |
161 | "G.H{E{E{IxsJ$+ ", | 161 | "G.H{E{E{IxsJ$+ ", |
162 | " +...vEKxzLM ", | 162 | " +...vEKxzLM ", |
163 | " +...z]n$ ", | 163 | " +...z]n$ ", |
164 | " +... "}; | 164 | " +... "}; |
165 | 165 | ||
166 | 166 | ||
167 | #if QT_VERSION < 300 | 167 | #if QT_VERSION < 300 |
168 | 168 | ||
169 | class QpeEditor : public QMultiLineEdit | 169 | class QpeEditor : public QMultiLineEdit |
170 | { | 170 | { |
171 | // Q_OBJECT | 171 | // Q_OBJECT |
172 | public: | 172 | public: |
173 | QpeEditor( QWidget *parent, const char * name = 0 ) | 173 | QpeEditor( QWidget *parent, const char * name = 0 ) |
174 | : QMultiLineEdit( parent, name ) | 174 | : QMultiLineEdit( parent, name ) |
175 | { | 175 | { |
176 | clearTableFlags(); | 176 | clearTableFlags(); |
177 | setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); | 177 | setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); |
178 | } | 178 | } |
179 | 179 | ||
180 | void find( const QString &txt, bool caseSensitive, | 180 | void find( const QString &txt, bool caseSensitive, |
181 | bool backwards ); | 181 | bool backwards ); |
182 | //public slots: | 182 | //public slots: |
183 | /* | 183 | /* |
184 | signals: | 184 | signals: |
185 | void notFound(); | 185 | void notFound(); |
186 | void searchWrapped(); | 186 | void searchWrapped(); |
187 | */ | 187 | */ |
188 | 188 | ||
189 | private: | 189 | private: |
190 | 190 | ||
191 | }; | 191 | }; |
192 | 192 | ||
193 | 193 | ||
194 | void QpeEditor::find ( const QString &txt, bool caseSensitive, | 194 | void QpeEditor::find ( const QString &txt, bool caseSensitive, |
195 | bool backwards ) | 195 | bool backwards ) |
196 | { | 196 | { |
197 | static bool wrap = FALSE; | 197 | static bool wrap = FALSE; |
198 | int line, col; | 198 | int line, col; |
199 | if ( wrap ) { | 199 | if ( wrap ) { |
200 | if ( !backwards ) | 200 | if ( !backwards ) |
201 | line = col = 0; | 201 | line = col = 0; |
202 | wrap = FALSE; | 202 | wrap = FALSE; |
203 | // emit searchWrapped(); | 203 | // emit searchWrapped(); |
204 | } else { | 204 | } else { |
205 | getCursorPosition( &line, &col ); | 205 | getCursorPosition( &line, &col ); |
206 | } | 206 | } |
207 | //ignore backwards for now.... | 207 | //ignore backwards for now.... |
208 | if ( !backwards ) { | 208 | if ( !backwards ) { |
209 | for ( ; ; ) { | 209 | for ( ; ; ) { |
210 | if ( line >= numLines() ) { | 210 | if ( line >= numLines() ) { |
211 | wrap = TRUE; | 211 | wrap = TRUE; |
212 | //emit notFound(); | 212 | //emit notFound(); |
213 | break; | 213 | break; |
214 | } | 214 | } |
215 | int findCol = getString( line )->find( txt, col, caseSensitive ); | 215 | int findCol = getString( line )->find( txt, col, caseSensitive ); |
216 | if ( findCol >= 0 ) { | 216 | if ( findCol >= 0 ) { |
217 | setCursorPosition( line, findCol, FALSE ); | 217 | setCursorPosition( line, findCol, FALSE ); |
218 | col = findCol + txt.length(); | 218 | col = findCol + txt.length(); |
219 | setCursorPosition( line, col, TRUE ); | 219 | setCursorPosition( line, col, TRUE ); |
220 | 220 | ||
221 | //found = TRUE; | 221 | //found = TRUE; |
222 | break; | 222 | break; |
223 | } | 223 | } |
224 | line++; | 224 | line++; |
225 | col = 0; | 225 | col = 0; |
226 | } | 226 | } |
227 | 227 | ||
228 | } | 228 | } |
229 | 229 | ||
230 | } | 230 | } |
231 | 231 | ||
232 | 232 | ||
233 | #else | 233 | #else |
234 | 234 | ||
235 | #error "Must make a QpeEditor that inherits QTextEdit" | 235 | #error "Must make a QpeEditor that inherits QTextEdit" |
236 | 236 | ||
237 | #endif | 237 | #endif |
238 | 238 | ||
239 | 239 | ||
240 | static const int nfontsizes = 6; | 240 | static const int nfontsizes = 6; |
241 | static const int fontsize[nfontsizes] = {8,10,12,14,18,24}; | 241 | static const int fontsize[nfontsizes] = {8,10,12,14,18,24}; |
242 | 242 | ||
243 | TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | 243 | TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) |
244 | : QMainWindow( parent, name, f ), bFromDocView( FALSE ) | 244 | : QMainWindow( parent, name, f ), bFromDocView( FALSE ) |
245 | { | 245 | { |
246 | doc = 0; | 246 | doc = 0; |
247 | edited=FALSE; | 247 | edited=FALSE; |
248 | edited1=FALSE; | 248 | edited1=FALSE; |
249 | setToolBarsMovable( FALSE ); | 249 | setToolBarsMovable( FALSE ); |
250 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 250 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
251 | 251 | ||
252 | channel = new QCopChannel( "QPE/Application/textedit", this ); | 252 | channel = new QCopChannel( "QPE/Application/textedit", this ); |
253 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 253 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
254 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 254 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
255 | 255 | ||
256 | setIcon( Resource::loadPixmap( "TextEditor" ) ); | 256 | setIcon( Resource::loadPixmap( "TextEditor" ) ); |
257 | 257 | ||
258 | QPEToolBar *bar = new QPEToolBar( this ); | 258 | QPEToolBar *bar = new QPEToolBar( this ); |
259 | bar->setHorizontalStretchable( TRUE ); | 259 | bar->setHorizontalStretchable( TRUE ); |
260 | menu = bar; | 260 | menu = bar; |
261 | 261 | ||
262 | QPEMenuBar *mb = new QPEMenuBar( bar ); | 262 | QPEMenuBar *mb = new QPEMenuBar( bar ); |
263 | QPopupMenu *file = new QPopupMenu( this ); | 263 | QPopupMenu *file = new QPopupMenu( this ); |
264 | QPopupMenu *edit = new QPopupMenu( this ); | 264 | QPopupMenu *edit = new QPopupMenu( this ); |
265 | font = new QPopupMenu( this ); | 265 | font = new QPopupMenu( this ); |
266 | 266 | ||
267 | bar = new QPEToolBar( this ); | 267 | bar = new QPEToolBar( this ); |
268 | editBar = bar; | 268 | editBar = bar; |
269 | 269 | ||
270 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 270 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
271 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 271 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
272 | a->addTo( bar ); | 272 | a->addTo( bar ); |
273 | a->addTo( file ); | 273 | a->addTo( file ); |
274 | 274 | ||
275 | a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); | 275 | a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); |
276 | connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); | 276 | connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); |
277 | a->addTo( bar ); | 277 | a->addTo( bar ); |
278 | a->addTo( file ); | 278 | a->addTo( file ); |
279 | 279 | ||
280 | a = new QAction( tr( "Save" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); | 280 | a = new QAction( tr( "Save" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); |
281 | connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); | 281 | connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); |
282 | file->insertSeparator(); | 282 | file->insertSeparator(); |
283 | a->addTo( file ); | 283 | a->addTo( file ); |
284 | 284 | ||
285 | a = new QAction( tr( "Save As" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); | 285 | a = new QAction( tr( "Save As" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); |
286 | connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) ); | 286 | connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) ); |
287 | a->addTo( file ); | 287 | a->addTo( file ); |
288 | 288 | ||
289 | a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 ); | 289 | a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 ); |
290 | connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); | 290 | connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); |
291 | a->addTo( editBar ); | 291 | a->addTo( editBar ); |
292 | a->addTo( edit ); | 292 | a->addTo( edit ); |
293 | 293 | ||
294 | a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 ); | 294 | a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 ); |
295 | connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); | 295 | connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); |
296 | a->addTo( editBar ); | 296 | a->addTo( editBar ); |
297 | a->addTo( edit ); | 297 | a->addTo( edit ); |
298 | 298 | ||
299 | a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 299 | a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
300 | connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); | 300 | connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); |
301 | a->addTo( editBar ); | 301 | a->addTo( editBar ); |
302 | a->addTo( edit ); | 302 | a->addTo( edit ); |
303 | 303 | ||
304 | 304 | ||
305 | #ifndef QT_NO_CLIPBOARD | 305 | #ifndef QT_NO_CLIPBOARD |
306 | a = new QAction( tr( "Insert Time and Date" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 306 | a = new QAction( tr( "Insert Time and Date" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
307 | connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) ); | 307 | connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) ); |
308 | a->addTo( edit ); | 308 | a->addTo( edit ); |
309 | #endif | 309 | #endif |
310 | 310 | ||
311 | a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 311 | a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
312 | connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); | 312 | connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); |
313 | edit->insertSeparator(); | 313 | edit->insertSeparator(); |
314 | a->addTo( bar ); | 314 | a->addTo( bar ); |
315 | a->addTo( edit ); | 315 | a->addTo( edit ); |
316 | 316 | ||
317 | 317 | ||
318 | zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 ); | 318 | zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 ); |
319 | connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) ); | 319 | connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) ); |
320 | zin->addTo( font ); | 320 | zin->addTo( font ); |
321 | 321 | ||
322 | zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 ); | 322 | zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 ); |
323 | connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) ); | 323 | connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) ); |
324 | zout->addTo( font ); | 324 | zout->addTo( font ); |
325 | 325 | ||
326 | font->insertSeparator(); | 326 | font->insertSeparator(); |
327 | 327 | ||
328 | QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 ); | 328 | QAction *wa = new QAction( tr("Wrap lines"), QString::null, 0, this, 0 ); |
329 | connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) ); | 329 | connect( wa, SIGNAL( toggled(bool) ), this, SLOT( setWordWrap(bool) ) ); |
330 | wa->setToggleAction(TRUE); | 330 | wa->setToggleAction(TRUE); |
331 | wa->addTo( font ); | 331 | wa->addTo( font ); |
332 | 332 | ||
333 | font->insertSeparator(); | 333 | font->insertSeparator(); |
334 | font->insertItem(tr("Font"), this, SLOT(changeFont()) ); | 334 | font->insertItem(tr("Font"), this, SLOT(changeFont()) ); |
335 | 335 | ||
336 | font->insertSeparator(); | 336 | font->insertSeparator(); |
337 | 337 | ||
338 | nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 ); | 338 | nStart = new QAction( tr("Start with new file"), QString::null, 0, this, 0 ); |
339 | connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) ); | 339 | connect( nStart, SIGNAL( toggled(bool) ), this, SLOT( changeStartConfig(bool) ) ); |
340 | nStart->setToggleAction(TRUE); | 340 | nStart->setToggleAction(TRUE); |
341 | nStart->addTo( font ); | 341 | nStart->addTo( font ); |
342 | 342 | ||
343 | nAdvanced = new QAction( tr("Advanced features"), QString::null, 0, this, 0 ); | 343 | nAdvanced = new QAction( tr("Advanced features"), QString::null, 0, this, 0 ); |
344 | connect( nAdvanced, SIGNAL( toggled(bool) ), this, SLOT( doAdvanced(bool) ) ); | 344 | connect( nAdvanced, SIGNAL( toggled(bool) ), this, SLOT( doAdvanced(bool) ) ); |
345 | nAdvanced->setToggleAction(TRUE); | 345 | nAdvanced->setToggleAction(TRUE); |
346 | nAdvanced->addTo( font ); | 346 | nAdvanced->addTo( font ); |
347 | 347 | ||
348 | 348 | ||
349 | font->insertSeparator(); | 349 | font->insertSeparator(); |
350 | 350 | ||
351 | font->insertItem(tr("About"), this, SLOT( doAbout()) ); | 351 | font->insertItem(tr("About"), this, SLOT( doAbout()) ); |
352 | 352 | ||
353 | mb->insertItem( tr( "File" ), file ); | 353 | mb->insertItem( tr( "File" ), file ); |
354 | mb->insertItem( tr( "Edit" ), edit ); | 354 | mb->insertItem( tr( "Edit" ), edit ); |
355 | mb->insertItem( tr( "View" ), font ); | 355 | mb->insertItem( tr( "View" ), font ); |
356 | 356 | ||
357 | searchBar = new QPEToolBar(this); | 357 | searchBar = new QPEToolBar(this); |
358 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 358 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); |
359 | 359 | ||
360 | searchBar->setHorizontalStretchable( TRUE ); | 360 | searchBar->setHorizontalStretchable( TRUE ); |
361 | 361 | ||
362 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 362 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
363 | searchBar->setStretchableWidget( searchEdit ); | 363 | searchBar->setStretchableWidget( searchEdit ); |
364 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 364 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
365 | this, SLOT( search() ) ); | 365 | this, SLOT( search() ) ); |
366 | 366 | ||
367 | a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); | 367 | a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); |
368 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); | 368 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); |
369 | a->addTo( searchBar ); | 369 | a->addTo( searchBar ); |
370 | a->addTo( edit ); | 370 | a->addTo( edit ); |
371 | 371 | ||
372 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 372 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
373 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 373 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
374 | a->addTo( searchBar ); | 374 | a->addTo( searchBar ); |
375 | 375 | ||
376 | edit->insertSeparator(); | 376 | edit->insertSeparator(); |
377 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 377 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
378 | connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); | 378 | connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); |
379 | a->addTo( edit ); | 379 | a->addTo( edit ); |
380 | 380 | ||
381 | searchBar->hide(); | 381 | searchBar->hide(); |
382 | 382 | ||
383 | editor = new QpeEditor( this ); | 383 | editor = new QpeEditor( this ); |
384 | setCentralWidget( editor ); | 384 | setCentralWidget( editor ); |
385 | editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 385 | editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
386 | connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); | 386 | connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); |
387 | 387 | ||
388 | Config cfg("TextEdit"); | 388 | Config cfg("TextEdit"); |
389 | 389 | ||
390 | cfg. setGroup ( "Font" ); | 390 | cfg. setGroup ( "Font" ); |
391 | 391 | ||
392 | QFont defaultFont = editor-> font ( ); | 392 | QFont defaultFont = editor-> font ( ); |
393 | 393 | ||
394 | QString family = cfg. readEntry ( "Family", defaultFont. family ( )); | 394 | QString family = cfg. readEntry ( "Family", defaultFont. family ( )); |
395 | int size = cfg. readNumEntry ( "Size", defaultFont. pointSize ( )); | 395 | int size = cfg. readNumEntry ( "Size", defaultFont. pointSize ( )); |
396 | int weight = cfg. readNumEntry ( "Weight", defaultFont. weight ( )); | 396 | int weight = cfg. readNumEntry ( "Weight", defaultFont. weight ( )); |
397 | bool italic = cfg. readBoolEntry ( "Italic", defaultFont. italic ( )); | 397 | bool italic = cfg. readBoolEntry ( "Italic", defaultFont. italic ( )); |
398 | 398 | ||
399 | defaultFont = QFont ( family, size, weight, italic ); | 399 | defaultFont = QFont ( family, size, weight, italic ); |
400 | editor-> setFont ( defaultFont ); | 400 | editor-> setFont ( defaultFont ); |
401 | 401 | ||
402 | updateCaption(); | 402 | updateCaption(); |
403 | 403 | ||
404 | cfg.setGroup ( "View" ); | 404 | cfg.setGroup ( "View" ); |
405 | 405 | ||
406 | useAdvancedFeatures = cfg. readBoolEntry ( "AdvancedFeatures", false ); | 406 | useAdvancedFeatures = cfg. readBoolEntry ( "AdvancedFeatures", false ); |
407 | 407 | ||
408 | if ( useAdvancedFeatures ) | 408 | if ( useAdvancedFeatures ) |
409 | nAdvanced-> setOn ( true ); | 409 | nAdvanced-> setOn ( true ); |
410 | 410 | ||
411 | bool wrap = cfg. readBoolEntry ( "Wrap", true ); | 411 | bool wrap = cfg. readBoolEntry ( "Wrap", true ); |
412 | wa-> setOn ( wrap ); | 412 | wa-> setOn ( wrap ); |
413 | setWordWrap ( wrap ); | 413 | setWordWrap ( wrap ); |
414 | 414 | ||
415 | if(cfg.readEntry("startNew","TRUE") == "TRUE") { | 415 | if(cfg.readEntry("startNew","TRUE") == "TRUE") { |
416 | nStart->setOn(TRUE); | 416 | nStart->setOn(TRUE); |
417 | fileNew(); | 417 | fileNew(); |
418 | } else { | 418 | } else { |
419 | fileOpen(); | 419 | fileOpen(); |
420 | } | 420 | } |
421 | 421 | ||
422 | viewSelection = cfg.readNumEntry( "FileView", 0 ); | 422 | viewSelection = cfg.readNumEntry( "FileView", 0 ); |
423 | } | 423 | } |
424 | 424 | ||
425 | TextEdit::~TextEdit() { | 425 | TextEdit::~TextEdit() { |
426 | if( edited1 & !useAdvancedFeatures ) | 426 | if( edited1 & !useAdvancedFeatures ) |
427 | saveAs(); | 427 | saveAs(); |
428 | } | 428 | } |
429 | 429 | ||
430 | void TextEdit::cleanUp() { | 430 | void TextEdit::cleanUp() { |
431 | qDebug("cleanUp");// save(); | 431 | qDebug("cleanUp");// save(); |
432 | 432 | ||
433 | Config cfg ( "TextEdit" ); | 433 | Config cfg ( "TextEdit" ); |
434 | cfg. setGroup ( "Font" ); | 434 | cfg. setGroup ( "Font" ); |
435 | QFont f = editor->font(); | 435 | QFont f = editor->font(); |
436 | cfg. writeEntry ( "Family", f. family ( )); | 436 | cfg. writeEntry ( "Family", f. family ( )); |
437 | cfg. writeEntry ( "Size", f. pointSize ( )); | 437 | cfg. writeEntry ( "Size", f. pointSize ( )); |
438 | cfg. writeEntry ( "Weight", f. weight ( )); | 438 | cfg. writeEntry ( "Weight", f. weight ( )); |
439 | cfg. writeEntry ( "Italic", f. italic ( )); | 439 | cfg. writeEntry ( "Italic", f. italic ( )); |
440 | 440 | ||
441 | cfg. setGroup ( "View" ); | 441 | cfg. setGroup ( "View" ); |
442 | cfg. writeEntry ( "Wrap", editor-> wordWrap ( ) == QMultiLineEdit::WidgetWidth ); | 442 | cfg. writeEntry ( "Wrap", editor-> wordWrap ( ) == QMultiLineEdit::WidgetWidth ); |
443 | cfg. writeEntry ( "FileView", viewSelection ); | 443 | cfg. writeEntry ( "FileView", viewSelection ); |
444 | cfg. writeEntry ( "AdvancedFeatures", useAdvancedFeatures ); | 444 | cfg. writeEntry ( "AdvancedFeatures", useAdvancedFeatures ); |
445 | } | 445 | } |
446 | 446 | ||
447 | 447 | ||
448 | void TextEdit::accept() { | 448 | void TextEdit::accept() { |
449 | if( edited1) | 449 | if( edited1) |
450 | saveAs(); | 450 | saveAs(); |
451 | exit(0); | 451 | exit(0); |
452 | } | 452 | } |
453 | 453 | ||
454 | void TextEdit::zoomIn() { | 454 | void TextEdit::zoomIn() { |
455 | setFontSize(editor->font().pointSize()+1,FALSE); | 455 | setFontSize(editor->font().pointSize()+1,FALSE); |
456 | } | 456 | } |
457 | 457 | ||
458 | void TextEdit::zoomOut() { | 458 | void TextEdit::zoomOut() { |
459 | setFontSize(editor->font().pointSize()-1,TRUE); | 459 | setFontSize(editor->font().pointSize()-1,TRUE); |
460 | } | 460 | } |
461 | 461 | ||
462 | 462 | ||
463 | void TextEdit::setFontSize(int sz, bool round_down_not_up) { | 463 | void TextEdit::setFontSize(int sz, bool round_down_not_up) { |
464 | int s=10; | 464 | int s=10; |
465 | for (int i=0; i<nfontsizes; i++) { | 465 | for (int i=0; i<nfontsizes; i++) { |
466 | if ( fontsize[i] == sz ) { | 466 | if ( fontsize[i] == sz ) { |
467 | s = sz; | 467 | s = sz; |
468 | break; | 468 | break; |
469 | } else if ( round_down_not_up ) { | 469 | } else if ( round_down_not_up ) { |
470 | if ( fontsize[i] < sz ) | 470 | if ( fontsize[i] < sz ) |
471 | s = fontsize[i]; | 471 | s = fontsize[i]; |
472 | } else { | 472 | } else { |
473 | if ( fontsize[i] > sz ) { | 473 | if ( fontsize[i] > sz ) { |
474 | s = fontsize[i]; | 474 | s = fontsize[i]; |
475 | break; | 475 | break; |
476 | } | 476 | } |
477 | } | 477 | } |
478 | } | 478 | } |
479 | 479 | ||
480 | QFont f = editor->font(); | 480 | QFont f = editor->font(); |
481 | f.setPointSize(s); | 481 | f.setPointSize(s); |
482 | editor->setFont(f); | 482 | editor->setFont(f); |
483 | 483 | ||
484 | zin->setEnabled(s != fontsize[nfontsizes-1]); | 484 | zin->setEnabled(s != fontsize[nfontsizes-1]); |
485 | zout->setEnabled(s != fontsize[0]); | 485 | zout->setEnabled(s != fontsize[0]); |
486 | } | 486 | } |
487 | 487 | ||
488 | void TextEdit::setBold(bool y) { | 488 | void TextEdit::setBold(bool y) { |
489 | QFont f = editor->font(); | 489 | QFont f = editor->font(); |
490 | f.setBold(y); | 490 | f.setBold(y); |
491 | editor->setFont(f); | 491 | editor->setFont(f); |
492 | } | 492 | } |
493 | 493 | ||
494 | void TextEdit::setItalic(bool y) { | 494 | void TextEdit::setItalic(bool y) { |
495 | QFont f = editor->font(); | 495 | QFont f = editor->font(); |
496 | f.setItalic(y); | 496 | f.setItalic(y); |
497 | editor->setFont(f); | 497 | editor->setFont(f); |
498 | } | 498 | } |
499 | 499 | ||
500 | void TextEdit::setWordWrap(bool y) { | 500 | void TextEdit::setWordWrap(bool y) { |
501 | bool state = editor->edited(); | 501 | bool state = editor->edited(); |
502 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); | 502 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); |
503 | editor->setEdited( state ); | 503 | editor->setEdited( state ); |
504 | } | 504 | } |
505 | 505 | ||
506 | void TextEdit::fileNew() { | 506 | void TextEdit::fileNew() { |
507 | // if( !bFromDocView ) { | 507 | // if( !bFromDocView ) { |
508 | // saveAs(); | 508 | // saveAs(); |
509 | // } | 509 | // } |
510 | newFile(DocLnk()); | 510 | newFile(DocLnk()); |
511 | } | 511 | } |
512 | 512 | ||
513 | void TextEdit::fileOpen() { | 513 | void TextEdit::fileOpen() { |
514 | Config cfg("TextEdit"); | 514 | Config cfg("TextEdit"); |
515 | cfg.setGroup("View"); | 515 | cfg.setGroup("View"); |
516 | // bool b=FALSE; | 516 | // bool b=FALSE; |
517 | 517 | ||
518 | QMap<QString, QStringList> map; | 518 | QMap<QString, QStringList> map; |
519 | map.insert(tr("All"), QStringList() ); | 519 | map.insert(tr("All"), QStringList() ); |
520 | QStringList text; | 520 | QStringList text; |
521 | text << "text/*"; | 521 | text << "text/*"; |
522 | map.insert(tr("Text"), text ); | 522 | map.insert(tr("Text"), text ); |
523 | text << "*"; | 523 | text << "*"; |
524 | map.insert(tr("All"), text ); | 524 | map.insert(tr("All"), text ); |
525 | QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map); | 525 | QString str = OFileDialog::getOpenFileName( 2,"/", QString::null, map); |
526 | if(!str.isEmpty() ) | 526 | if(!str.isEmpty() ) |
527 | openFile( str ); | 527 | openFile( str ); |
528 | 528 | ||
529 | } | 529 | } |
530 | 530 | ||
531 | void TextEdit::doSearchBar() { | 531 | void TextEdit::doSearchBar() { |
532 | Config cfg("TextEdit"); | 532 | Config cfg("TextEdit"); |
533 | cfg.setGroup("View"); | 533 | cfg.setGroup("View"); |
534 | if(cfg.readEntry("SearchBar","Closed") != "Opened") | 534 | if(cfg.readEntry("SearchBar","Closed") != "Opened") |
535 | searchBar->hide(); | 535 | searchBar->hide(); |
536 | } | 536 | } |
537 | 537 | ||
538 | #if 0 | 538 | #if 0 |
539 | void TextEdit::slotFind() { | 539 | void TextEdit::slotFind() { |
540 | FindDialog frmFind( tr("Text Editor"), this ); | 540 | FindDialog frmFind( tr("Text Editor"), this ); |
541 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), | 541 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), |
542 | editor, SLOT(slotDoFind( const QString&,bool,bool))); | 542 | editor, SLOT(slotDoFind( const QString&,bool,bool))); |
543 | 543 | ||
544 | //case sensitive, backwards, [category] | 544 | //case sensitive, backwards, [category] |
545 | 545 | ||
546 | connect( editor, SIGNAL(notFound()), | 546 | connect( editor, SIGNAL(notFound()), |
547 | &frmFind, SLOT(slotNotFound()) ); | 547 | &frmFind, SLOT(slotNotFound()) ); |
548 | connect( editor, SIGNAL(searchWrapped()), | 548 | connect( editor, SIGNAL(searchWrapped()), |
549 | &frmFind, SLOT(slotWrapAround()) ); | 549 | &frmFind, SLOT(slotWrapAround()) ); |
550 | 550 | ||
551 | frmFind.exec(); | 551 | frmFind.exec(); |
552 | 552 | ||
553 | 553 | ||
554 | } | 554 | } |
555 | #endif | 555 | #endif |
556 | 556 | ||
557 | void TextEdit::fileRevert() { | 557 | void TextEdit::fileRevert() { |
558 | clear(); | 558 | clear(); |
559 | fileOpen(); | 559 | fileOpen(); |
560 | } | 560 | } |
561 | 561 | ||
562 | void TextEdit::editCut() { | 562 | void TextEdit::editCut() { |
563 | #ifndef QT_NO_CLIPBOARD | 563 | #ifndef QT_NO_CLIPBOARD |
564 | editor->cut(); | 564 | editor->cut(); |
565 | #endif | 565 | #endif |
566 | } | 566 | } |
567 | 567 | ||
568 | void TextEdit::editCopy() { | 568 | void TextEdit::editCopy() { |
569 | #ifndef QT_NO_CLIPBOARD | 569 | #ifndef QT_NO_CLIPBOARD |
570 | editor->copy(); | 570 | editor->copy(); |
571 | #endif | 571 | #endif |
572 | } | 572 | } |
573 | 573 | ||
574 | void TextEdit::editPaste() { | 574 | void TextEdit::editPaste() { |
575 | #ifndef QT_NO_CLIPBOARD | 575 | #ifndef QT_NO_CLIPBOARD |
576 | editor->paste(); | 576 | editor->paste(); |
577 | #endif | 577 | #endif |
578 | } | 578 | } |
579 | 579 | ||
580 | void TextEdit::editFind() { | 580 | void TextEdit::editFind() { |
581 | searchBar->show(); | 581 | searchBar->show(); |
582 | searchVisible = TRUE; | 582 | searchVisible = TRUE; |
583 | searchEdit->setFocus(); | 583 | searchEdit->setFocus(); |
584 | Config cfg("TextEdit"); | 584 | Config cfg("TextEdit"); |
585 | cfg.setGroup("View"); | 585 | cfg.setGroup("View"); |
586 | cfg.writeEntry("SearchBar","Opened"); | 586 | cfg.writeEntry("SearchBar","Opened"); |
587 | 587 | ||
588 | } | 588 | } |
589 | 589 | ||
590 | void TextEdit::findNext() { | 590 | void TextEdit::findNext() { |
591 | editor->find( searchEdit->text(), FALSE, FALSE ); | 591 | editor->find( searchEdit->text(), FALSE, FALSE ); |
592 | 592 | ||
593 | } | 593 | } |
594 | 594 | ||
595 | void TextEdit::findClose() { | 595 | void TextEdit::findClose() { |
596 | searchVisible = FALSE; | 596 | searchVisible = FALSE; |
597 | searchBar->hide(); | 597 | searchBar->hide(); |
598 | Config cfg("TextEdit"); | 598 | Config cfg("TextEdit"); |
599 | cfg.setGroup("View"); | 599 | cfg.setGroup("View"); |
600 | cfg.writeEntry("SearchBar","Closed"); | 600 | cfg.writeEntry("SearchBar","Closed"); |
601 | cfg.write(); | 601 | cfg.write(); |
602 | } | 602 | } |
603 | 603 | ||
604 | void TextEdit::search() { | 604 | void TextEdit::search() { |
605 | editor->find( searchEdit->text(), FALSE, FALSE ); | 605 | editor->find( searchEdit->text(), FALSE, FALSE ); |
606 | } | 606 | } |
607 | 607 | ||
608 | void TextEdit::newFile( const DocLnk &f ) { | 608 | void TextEdit::newFile( const DocLnk &f ) { |
609 | DocLnk nf = f; | 609 | DocLnk nf = f; |
610 | nf.setType("text/plain"); | 610 | nf.setType("text/plain"); |
611 | clear(); | 611 | clear(); |
612 | setWState (WState_Reserved1 ); | 612 | setWState (WState_Reserved1 ); |
613 | editor->setFocus(); | 613 | editor->setFocus(); |
614 | doc = new DocLnk(nf); | 614 | doc = new DocLnk(nf); |
615 | currentFileName = "Unnamed"; | 615 | currentFileName = "Unnamed"; |
616 | qDebug("newFile "+currentFileName); | 616 | qDebug("newFile "+currentFileName); |
617 | updateCaption( currentFileName); | 617 | updateCaption( currentFileName); |
618 | // editor->setEdited( FALSE); | 618 | // editor->setEdited( FALSE); |
619 | } | 619 | } |
620 | 620 | ||
621 | void TextEdit::openFile( const QString &f ) { | 621 | void TextEdit::openFile( const QString &f ) { |
622 | qDebug("filename is "+ f); | 622 | qDebug("filename is "+ f); |
623 | QString filer; | 623 | QString filer; |
624 | // bFromDocView = TRUE; | 624 | // bFromDocView = TRUE; |
625 | if(f.find(".desktop",0,TRUE) != -1 && useAdvancedFeatures) { | 625 | if(f.find(".desktop",0,TRUE) != -1 && useAdvancedFeatures) { |
626 | switch ( QMessageBox::warning(this,tr("Text Editor"), | 626 | switch ( QMessageBox::warning(this,tr("Text Editor"), |
627 | tr("Text Editor has detected<BR>you selected a <B>.desktop</B> file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?"), | 627 | tr("Text Editor has detected<BR>you selected a <B>.desktop</B> |
628 | file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?"), | ||
628 | tr(".desktop File"),tr("Linked Document"),0,1,1) ) { | 629 | tr(".desktop File"),tr("Linked Document"),0,1,1) ) { |
629 | case 0: | 630 | case 0: |
630 | filer = f; | 631 | filer = f; |
631 | break; | 632 | break; |
632 | case 1: | 633 | case 1: |
633 | DocLnk sf(f); | 634 | DocLnk sf(f); |
634 | filer = sf.file(); | 635 | filer = sf.file(); |
635 | break; | 636 | break; |
636 | } | 637 | } |
637 | } else { | 638 | } else { |
638 | DocLnk sf(f); | 639 | DocLnk sf(f); |
639 | filer = sf.file(); | 640 | filer = sf.file(); |
640 | // filer = f; | 641 | if(filer.right(1) == "/") |
641 | // fileIs = TRUE; | 642 | filer = f; |
642 | } | 643 | } |
643 | 644 | ||
644 | DocLnk nf; | 645 | DocLnk nf; |
645 | nf.setType("text/plain"); | 646 | nf.setType("text/plain"); |
646 | nf.setFile(filer); | 647 | nf.setFile(filer); |
647 | currentFileName=filer; | 648 | currentFileName=filer; |
648 | QFileInfo fi( currentFileName); | 649 | QFileInfo fi( currentFileName); |
649 | nf.setName(fi.baseName()); | 650 | nf.setName(fi.baseName()); |
650 | qDebug("openFile string "+currentFileName); | 651 | qDebug("openFile string "+currentFileName); |
651 | 652 | ||
652 | openFile(nf); | 653 | openFile(nf); |
653 | showEditTools(); | 654 | showEditTools(); |
654 | // Show filename in caption | 655 | // Show filename in caption |
655 | QString name = filer; | 656 | QString name = filer; |
656 | int sep = name.findRev( '/' ); | 657 | int sep = name.findRev( '/' ); |
657 | if ( sep > 0 ) | 658 | if ( sep > 0 ) |
658 | name = name.mid( sep+1 ); | 659 | name = name.mid( sep+1 ); |
659 | updateCaption( name ); | 660 | updateCaption( name ); |
660 | } | 661 | } |
661 | 662 | ||
662 | void TextEdit::openFile( const DocLnk &f ) { | 663 | void TextEdit::openFile( const DocLnk &f ) { |
663 | // clear(); | 664 | // clear(); |
664 | // bFromDocView = TRUE; | 665 | // bFromDocView = TRUE; |
665 | FileManager fm; | 666 | FileManager fm; |
666 | QString txt; | 667 | QString txt; |
667 | currentFileName=f.file(); | 668 | currentFileName=f.file(); |
668 | qDebug("openFile doclnk " + currentFileName); | 669 | qDebug("openFile doclnk " + currentFileName); |
669 | if ( !fm.loadFile( f, txt ) ) { | 670 | if ( !fm.loadFile( f, txt ) ) { |
670 | // ####### could be a new file | 671 | // ####### could be a new file |
671 | qDebug( "Cannot open file" ); | 672 | qDebug( "Cannot open file" ); |
672 | } | 673 | } |
673 | // fileNew(); | 674 | // fileNew(); |
674 | if ( doc ) | 675 | if ( doc ) |
675 | delete doc; | 676 | delete doc; |
676 | doc = new DocLnk(f); | 677 | doc = new DocLnk(f); |
677 | editor->setText(txt); | 678 | editor->setText(txt); |
678 | editor->setEdited( FALSE); | 679 | editor->setEdited( FALSE); |
679 | edited1=FALSE; | 680 | edited1=FALSE; |
680 | edited=FALSE; | 681 | edited=FALSE; |
681 | 682 | ||
682 | doc->setName(currentFileName); | 683 | doc->setName(currentFileName); |
683 | updateCaption(); | 684 | updateCaption(); |
684 | } | 685 | } |
685 | 686 | ||
686 | void TextEdit::showEditTools() { | 687 | void TextEdit::showEditTools() { |
687 | // if ( !doc ) | 688 | // if ( !doc ) |
688 | // close(); | 689 | // close(); |
689 | // clear(); | 690 | // clear(); |
690 | menu->show(); | 691 | menu->show(); |
691 | editBar->show(); | 692 | editBar->show(); |
692 | if ( searchVisible ) | 693 | if ( searchVisible ) |
693 | searchBar->show(); | 694 | searchBar->show(); |
694 | // updateCaption(); | 695 | // updateCaption(); |
695 | setWState (WState_Reserved1 ); | 696 | setWState (WState_Reserved1 ); |
696 | } | 697 | } |
697 | 698 | ||
698 | /*! | 699 | /*! |
699 | unprompted save */ | 700 | unprompted save */ |
700 | bool TextEdit::save() { | 701 | bool TextEdit::save() { |
701 | QString file = doc->file(); | 702 | QString file = doc->file(); |
702 | qDebug("saver file "+file); | 703 | qDebug("saver file "+file); |
703 | QString name= doc->name(); | 704 | QString name= doc->name(); |
704 | qDebug("File named "+name); | 705 | qDebug("File named "+name); |
705 | QString rt = editor->text(); | 706 | QString rt = editor->text(); |
706 | if( !rt.isEmpty() ) { | 707 | if( !rt.isEmpty() ) { |
707 | if(name.isEmpty()) { | 708 | if(name.isEmpty()) { |
708 | saveAs(); | 709 | saveAs(); |
709 | } else { | 710 | } else { |
710 | currentFileName= name ; | 711 | currentFileName= name ; |
711 | qDebug("saveFile "+currentFileName); | 712 | qDebug("saveFile "+currentFileName); |
712 | 713 | ||
713 | struct stat buf; | 714 | struct stat buf; |
714 | mode_t mode; | 715 | mode_t mode; |
715 | stat(file.latin1(), &buf); | 716 | stat(file.latin1(), &buf); |
716 | mode = buf.st_mode; | 717 | mode = buf.st_mode; |
717 | 718 | ||
718 | if(!fileIs) { | 719 | if(!fileIs) { |
719 | doc->setName( name); | 720 | doc->setName( name); |
720 | FileManager fm; | 721 | FileManager fm; |
721 | if ( !fm.saveFile( *doc, rt ) ) { | 722 | if ( !fm.saveFile( *doc, rt ) ) { |
722 | return false; | 723 | return false; |
723 | } | 724 | } |
724 | } else { | 725 | } else { |
725 | qDebug("regular save file"); | 726 | qDebug("regular save file"); |
726 | QFile f(file); | 727 | QFile f(file); |
727 | if( f.open(IO_WriteOnly)) { | 728 | if( f.open(IO_WriteOnly)) { |
728 | QCString crt = rt.utf8(); | 729 | QCString crt = rt.utf8(); |
729 | f.writeBlock(crt,crt.length()); | 730 | f.writeBlock(crt,crt.length()); |
730 | } else { | 731 | } else { |
731 | QMessageBox::message(tr("Text Edit"),tr("Write Failed")); | 732 | QMessageBox::message(tr("Text Edit"),tr("Write Failed")); |
732 | return false; | 733 | return false; |
733 | } | 734 | } |
734 | 735 | ||
735 | } | 736 | } |
736 | editor->setEdited( FALSE); | 737 | editor->setEdited( FALSE); |
737 | edited1=FALSE; | 738 | edited1=FALSE; |
738 | edited=FALSE; | 739 | edited=FALSE; |
739 | if(caption().left(1)=="*") | 740 | if(caption().left(1)=="*") |
740 | setCaption(caption().right(caption().length()-1)); | 741 | setCaption(caption().right(caption().length()-1)); |
741 | 742 | ||
742 | 743 | ||
743 | chmod( file.latin1(), mode); | 744 | chmod( file.latin1(), mode); |
744 | } | 745 | } |
745 | return true; | 746 | return true; |
746 | } | 747 | } |
747 | return false; | 748 | return false; |
748 | } | 749 | } |
749 | 750 | ||
750 | /*! | 751 | /*! |
751 | prompted save */ | 752 | prompted save */ |
752 | bool TextEdit::saveAs() { | 753 | bool TextEdit::saveAs() { |
753 | qDebug("saveAsFile "+currentFileName); | 754 | qDebug("saveAsFile "+currentFileName); |
754 | // case of nothing to save... | 755 | // case of nothing to save... |
755 | if ( !doc ) { | 756 | if ( !doc ) { |
756 | //|| !bFromDocView) | 757 | //|| !bFromDocView) |
757 | qDebug("no doc"); | 758 | qDebug("no doc"); |
758 | return true; | 759 | return true; |
759 | } | 760 | } |
760 | if ( !editor->edited() ) { | 761 | if ( !editor->edited() ) { |
761 | delete doc; | 762 | delete doc; |
762 | doc = 0; | 763 | doc = 0; |
763 | return true; | 764 | return true; |
764 | } | 765 | } |
765 | 766 | ||
766 | QString rt = editor->text(); | 767 | QString rt = editor->text(); |
767 | qDebug(currentFileName); | 768 | qDebug(currentFileName); |
768 | 769 | ||
769 | if( currentFileName.isEmpty() || currentFileName == tr("Unnamed") || currentFileName == tr("Text Editor")) { | 770 | if( currentFileName.isEmpty() || currentFileName == tr("Unnamed") || currentFileName == tr("Text Editor")) { |
770 | // qDebug("do silly TT filename thing"); | 771 | // qDebug("do silly TT filename thing"); |
771 | if ( doc->name().isEmpty() ) { | 772 | if ( doc->name().isEmpty() ) { |
772 | QString pt = rt.simplifyWhiteSpace(); | 773 | QString pt = rt.simplifyWhiteSpace(); |
773 | int i = pt.find( ' ' ); | 774 | int i = pt.find( ' ' ); |
774 | QString docname = pt; | 775 | QString docname = pt; |
775 | if ( i > 0 ) | 776 | if ( i > 0 ) |
776 | docname = pt.left( i ); | 777 | docname = pt.left( i ); |
777 | // remove "." at the beginning | 778 | // remove "." at the beginning |
778 | while( docname.startsWith( "." ) ) | 779 | while( docname.startsWith( "." ) ) |
779 | docname = docname.mid( 1 ); | 780 | docname = docname.mid( 1 ); |
780 | docname.replace( QRegExp("/"), "_" ); | 781 | docname.replace( QRegExp("/"), "_" ); |
781 | // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. | 782 | // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. |
782 | if ( docname.length() > 40 ) | 783 | if ( docname.length() > 40 ) |
783 | docname = docname.left(40); | 784 | docname = docname.left(40); |
784 | if ( docname.isEmpty() ) | 785 | if ( docname.isEmpty() ) |
785 | docname = tr("Unnamed"); | 786 | docname = tr("Unnamed"); |
786 | doc->setName(docname); | 787 | doc->setName(docname); |
787 | currentFileName=docname; | 788 | currentFileName=docname; |
788 | } | 789 | } |
789 | } | 790 | } |
790 | 791 | ||
791 | QMap<QString, QStringList> map; | 792 | QMap<QString, QStringList> map; |
792 | map.insert(tr("All"), QStringList() ); | 793 | map.insert(tr("All"), QStringList() ); |
793 | QStringList text; | 794 | QStringList text; |
794 | text << "text/*"; | 795 | text << "text/*"; |
795 | map.insert(tr("Text"), text ); | 796 | map.insert(tr("Text"), text ); |
796 | text << "*"; | 797 | text << "*"; |
797 | map.insert(tr("All"), text ); | 798 | map.insert(tr("All"), text ); |
798 | 799 | ||
799 | QString str = OFileDialog::getSaveFileName( 2,"/", QString::null, map); | 800 | QString str = OFileDialog::getSaveFileName( 2,"/", QString::null, map); |
800 | 801 | ||
801 | if(!str.isEmpty() ) { | 802 | if(!str.isEmpty() ) { |
802 | QString fileNm=str; | 803 | QString fileNm=str; |
803 | 804 | ||
804 | qDebug("saving filename "+fileNm); | 805 | qDebug("saving filename "+fileNm); |
805 | QFileInfo fi(fileNm); | 806 | QFileInfo fi(fileNm); |
806 | currentFileName=fi.fileName(); | 807 | currentFileName=fi.fileName(); |
807 | if(doc) { | 808 | if(doc) { |
808 | // QString file = doc->file(); | 809 | // QString file = doc->file(); |
809 | // doc->removeFiles(); | 810 | // doc->removeFiles(); |
810 | delete doc; | 811 | delete doc; |
811 | DocLnk nf; | 812 | DocLnk nf; |
812 | nf.setType("text/plain"); | 813 | nf.setType("text/plain"); |
813 | nf.setFile( fileNm); | 814 | nf.setFile( fileNm); |
814 | doc = new DocLnk(nf); | 815 | doc = new DocLnk(nf); |
815 | // editor->setText(rt); | 816 | // editor->setText(rt); |
816 | // qDebug("openFile doclnk "+currentFileName); | 817 | // qDebug("openFile doclnk "+currentFileName); |
817 | doc->setName( currentFileName); | 818 | doc->setName( currentFileName); |
818 | updateCaption( currentFileName); | 819 | updateCaption( currentFileName); |
819 | 820 | ||
820 | FileManager fm; | 821 | FileManager fm; |
821 | if ( !fm.saveFile( *doc, rt ) ) { | 822 | if ( !fm.saveFile( *doc, rt ) ) { |
822 | return false; | 823 | return false; |
823 | } | 824 | } |
824 | 825 | ||
825 | if( useAdvancedFeatures ) { | 826 | if( useAdvancedFeatures ) { |
826 | filePermissions *filePerm; | 827 | filePermissions *filePerm; |
827 | filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm); | 828 | filePerm = new filePermissions(this, tr("Permissions"),true,0,(const QString &)fileNm); |
828 | filePerm->showMaximized(); | 829 | filePerm->showMaximized(); |
829 | filePerm->exec(); | 830 | filePerm->exec(); |
830 | 831 | ||
831 | if( filePerm) | 832 | if( filePerm) |
832 | delete filePerm; | 833 | delete filePerm; |
833 | } | 834 | } |
834 | } | 835 | } |
835 | editor->setEdited( false); | 836 | editor->setEdited( false); |
836 | edited1 = false; | 837 | edited1 = false; |
837 | edited = false; | 838 | edited = false; |
838 | if(caption().left(1)=="*") | 839 | if(caption().left(1)=="*") |
839 | setCaption(caption().right(caption().length()-1)); | 840 | setCaption(caption().right(caption().length()-1)); |
840 | 841 | ||
841 | return true; | 842 | return true; |
842 | } | 843 | } |
843 | qDebug("returning false"); | 844 | qDebug("returning false"); |
844 | return false; | 845 | return false; |
845 | } //end saveAs | 846 | } //end saveAs |
846 | 847 | ||
847 | void TextEdit::clear() { | 848 | void TextEdit::clear() { |
848 | delete doc; | 849 | delete doc; |
849 | doc = 0; | 850 | doc = 0; |
850 | editor->clear(); | 851 | editor->clear(); |
851 | } | 852 | } |
852 | 853 | ||
853 | void TextEdit::updateCaption( const QString &name ) { | 854 | void TextEdit::updateCaption( const QString &name ) { |
854 | if ( !doc ) | 855 | if ( !doc ) |
855 | setCaption( tr("Text Editor") ); | 856 | setCaption( tr("Text Editor") ); |
856 | else { | 857 | else { |
857 | QString s = name; | 858 | QString s = name; |
858 | if ( s.isNull() ) | 859 | if ( s.isNull() ) |
859 | s = doc->name(); | 860 | s = doc->name(); |
860 | if ( s.isEmpty() ) { | 861 | if ( s.isEmpty() ) { |
861 | s = tr( "Unnamed" ); | 862 | s = tr( "Unnamed" ); |
862 | currentFileName=s; | 863 | currentFileName=s; |
863 | } | 864 | } |
864 | if(s.left(1) == "/") | 865 | if(s.left(1) == "/") |
865 | s = s.right(s.length()-1); | 866 | s = s.right(s.length()-1); |
866 | setCaption( s + " - " + tr("Text Editor") ); | 867 | setCaption( s + " - " + tr("Text Editor") ); |
867 | } | 868 | } |
868 | } | 869 | } |
869 | 870 | ||
870 | void TextEdit::setDocument(const QString& fileref) { | 871 | void TextEdit::setDocument(const QString& fileref) { |
871 | bFromDocView = TRUE; | 872 | bFromDocView = TRUE; |
872 | openFile(fileref); | 873 | openFile(fileref); |
873 | editor->setEdited(TRUE); | 874 | editor->setEdited(TRUE); |
874 | edited1=FALSE; | 875 | edited1=FALSE; |
875 | edited=TRUE; | 876 | edited=TRUE; |
876 | doSearchBar(); | 877 | doSearchBar(); |
877 | } | 878 | } |
878 | 879 | ||
879 | void TextEdit::closeEvent( QCloseEvent *e ) { | 880 | void TextEdit::closeEvent( QCloseEvent *e ) { |
880 | bFromDocView = FALSE; | 881 | bFromDocView = FALSE; |
881 | e->accept(); | 882 | e->accept(); |
882 | } | 883 | } |
883 | 884 | ||
884 | void TextEdit::changeFont() { | 885 | void TextEdit::changeFont() { |
885 | QDialog *d = new QDialog ( this, "FontDialog", true ); | 886 | QDialog *d = new QDialog ( this, "FontDialog", true ); |
886 | d-> setCaption ( tr( "Choose font" )); | 887 | d-> setCaption ( tr( "Choose font" )); |
887 | QBoxLayout *lay = new QVBoxLayout ( d ); | 888 | QBoxLayout *lay = new QVBoxLayout ( d ); |
888 | OFontSelector *ofs = new OFontSelector ( true, d ); | 889 | OFontSelector *ofs = new OFontSelector ( true, d ); |
889 | lay-> addWidget ( ofs ); | 890 | lay-> addWidget ( ofs ); |
890 | ofs-> setSelectedFont ( editor-> font ( )); | 891 | ofs-> setSelectedFont ( editor-> font ( )); |
891 | 892 | ||
892 | d-> showMaximized ( ); | 893 | d-> showMaximized ( ); |
893 | if ( d-> exec ( ) == QDialog::Accepted ) | 894 | if ( d-> exec ( ) == QDialog::Accepted ) |
894 | editor-> setFont ( ofs-> selectedFont ( )); | 895 | editor-> setFont ( ofs-> selectedFont ( )); |
895 | delete d; | 896 | delete d; |
896 | 897 | ||
897 | } | 898 | } |
898 | 899 | ||
899 | void TextEdit::editDelete() { | 900 | void TextEdit::editDelete() { |
900 | switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Do you really want<BR>to <B>delete</B> the current file\nfrom the disk?<BR>This is <B>irreversable!!</B>"),tr("Yes"),tr("No"),0,0,1) ) { | 901 | switch ( QMessageBox::warning(this,tr("Text Editor"),tr("Do you really want<BR>to <B>delete</B> the current file\nfrom the disk?<BR>This is <B>irreversable!!</B>"),tr("Yes"),tr("No"),0,0,1) ) { |
901 | case 0: | 902 | case 0: |
902 | if(doc) { | 903 | if(doc) { |
903 | doc->removeFiles(); | 904 | doc->removeFiles(); |
904 | clear(); | 905 | clear(); |
905 | setCaption( tr("Text Editor") ); | 906 | setCaption( tr("Text Editor") ); |
906 | } | 907 | } |
907 | break; | 908 | break; |
908 | case 1: | 909 | case 1: |
909 | // exit | 910 | // exit |
910 | break; | 911 | break; |
911 | }; | 912 | }; |
912 | } | 913 | } |
913 | 914 | ||
914 | void TextEdit::changeStartConfig( bool b ) { | 915 | void TextEdit::changeStartConfig( bool b ) { |
915 | 916 | ||
916 | Config cfg("TextEdit"); | 917 | Config cfg("TextEdit"); |
917 | cfg.setGroup("View"); | 918 | cfg.setGroup("View"); |
918 | if(b) { | 919 | if(b) { |
919 | qDebug("bool"); | 920 | qDebug("bool"); |
920 | cfg.writeEntry("startNew","TRUE"); | 921 | cfg.writeEntry("startNew","TRUE"); |
921 | } else { | 922 | } else { |
922 | cfg.writeEntry("startNew","FALSE"); | 923 | cfg.writeEntry("startNew","FALSE"); |
923 | } | 924 | } |
924 | update(); | 925 | update(); |
925 | } | 926 | } |
926 | 927 | ||
927 | void TextEdit::editorChanged() { | 928 | void TextEdit::editorChanged() { |
928 | if(editor->edited() && edited && !edited1) { | 929 | if(editor->edited() && edited && !edited1) { |
929 | setCaption( "*"+caption()); | 930 | setCaption( "*"+caption()); |
930 | edited1=TRUE; | 931 | edited1=TRUE; |
931 | } | 932 | } |
932 | edited=TRUE; | 933 | edited=TRUE; |
933 | } | 934 | } |
934 | 935 | ||
935 | void TextEdit::receive(const QCString&msg, const QByteArray&) { | 936 | void TextEdit::receive(const QCString&msg, const QByteArray&) { |
936 | qDebug("QCop "+msg); | 937 | qDebug("QCop "+msg); |
937 | if ( msg == "setDocument(QString)" ) { | 938 | if ( msg == "setDocument(QString)" ) { |
938 | qDebug("bugger all"); | 939 | qDebug("bugger all"); |
939 | } | 940 | } |
940 | 941 | ||
941 | } | 942 | } |
942 | void TextEdit::doAbout() { | 943 | void TextEdit::doAbout() { |
943 | QMessageBox::about(0,tr("Text Edit"),tr("Text Edit is copyright<BR>" | 944 | QMessageBox::about(0,tr("Text Edit"),tr("Text Edit is copyright<BR>" |
944 | "2000 Trolltech AS, and<BR>" | 945 | "2000 Trolltech AS, and<BR>" |
945 | "2002 by <B>L. J. Potter <BR>llornkcor@handhelds.org</B><BR>" | 946 | "2002 by <B>L. J. Potter <BR>llornkcor@handhelds.org</B><BR>" |
946 | "and is licensed under the GPL")); | 947 | "and is licensed under the GPL")); |
947 | } | 948 | } |
948 | 949 | ||
949 | void TextEdit::doAdvanced(bool b) { | 950 | void TextEdit::doAdvanced(bool b) { |
950 | useAdvancedFeatures=b; | 951 | useAdvancedFeatures=b; |
951 | } | 952 | } |
952 | 953 | ||
953 | void TextEdit::editPasteTimeDate() { | 954 | void TextEdit::editPasteTimeDate() { |
954 | #ifndef QT_NO_CLIPBOARD | 955 | #ifndef QT_NO_CLIPBOARD |
955 | QClipboard *cb = QApplication::clipboard(); | 956 | QClipboard *cb = QApplication::clipboard(); |
956 | QDateTime dt = QDateTime::currentDateTime(); | 957 | QDateTime dt = QDateTime::currentDateTime(); |
957 | cb->setText( dt.toString()); | 958 | cb->setText( dt.toString()); |
958 | editor->paste(); | 959 | editor->paste(); |
959 | #endif | 960 | #endif |
960 | } | 961 | } |