author | llornkcor <llornkcor> | 2003-02-28 17:23:19 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-02-28 17:23:19 (UTC) |
commit | a5a5a25bee2596608906ae44cdad45bf89276385 (patch) (unidiff) | |
tree | a618cc62fceb34b0aa9a1f7a9d9bb744c57c5460 | |
parent | 81cbb2d97b4f0cd7eef56536d791434856d7ae8d (diff) | |
download | opie-a5a5a25bee2596608906ae44cdad45bf89276385.zip opie-a5a5a25bee2596608906ae44cdad45bf89276385.tar.gz opie-a5a5a25bee2596608906ae44cdad45bf89276385.tar.bz2 |
moved xmp to resource, and added goto line number
-rw-r--r-- | core/apps/textedit/resource.h | 104 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 130 | ||||
-rw-r--r-- | core/apps/textedit/textedit.h | 182 | ||||
-rw-r--r-- | core/apps/textedit/textedit.pro | 6 |
4 files changed, 231 insertions, 191 deletions
diff --git a/core/apps/textedit/resource.h b/core/apps/textedit/resource.h new file mode 100644 index 0000000..7a22f01 --- a/dev/null +++ b/core/apps/textedit/resource.h | |||
@@ -0,0 +1,104 @@ | |||
1 | #ifndef RESOURCE_H | ||
2 | #define RESOURCE_H | ||
3 | |||
4 | #include <qpixmap.h> | ||
5 | |||
6 | /* XPM */ | ||
7 | static char * filesave_xpm[] = { | ||
8 | "16 16 78 1", | ||
9 | " c None", | ||
10 | ". c #343434", | ||
11 | "+ c #A0A0A0", | ||
12 | "@ c #565656", | ||
13 | "# c #9E9E9E", | ||
14 | "$ c #525252", | ||
15 | "% c #929292", | ||
16 | "& c #676767", | ||
17 | "* c #848484", | ||
18 | "= c #666666", | ||
19 | "- c #D8D8D8", | ||
20 | "; c #FFFFFF", | ||
21 | "> c #DBDBDB", | ||
22 | ", c #636363", | ||
23 | "' c #989898", | ||
24 | ") c #2D2D2D", | ||
25 | "! c #909090", | ||
26 | "~ c #AEAEAE", | ||
27 | "{ c #EAEAEA", | ||
28 | "] c #575757", | ||
29 | "^ c #585858", | ||
30 | "/ c #8A8A8A", | ||
31 | "( c #828282", | ||
32 | "_ c #6F6F6F", | ||
33 | ": c #C9C9C9", | ||
34 | "< c #050505", | ||
35 | "[ c #292929", | ||
36 | "} c #777777", | ||
37 | "| c #616161", | ||
38 | "1 c #3A3A3A", | ||
39 | "2 c #BEBEBE", | ||
40 | "3 c #2C2C2C", | ||
41 | "4 c #7C7C7C", | ||
42 | "5 c #F6F6F6", | ||
43 | "6 c #FCFCFC", | ||
44 | "7 c #6B6B6B", | ||
45 | "8 c #959595", | ||
46 | "9 c #4F4F4F", | ||
47 | "0 c #808080", | ||
48 | "a c #767676", | ||
49 | "b c #818181", | ||
50 | "c c #B8B8B8", | ||
51 | "d c #FBFBFB", | ||
52 | "e c #F9F9F9", | ||
53 | "f c #CCCCCC", | ||
54 | "g c #030303", | ||
55 | "h c #737373", | ||
56 | "i c #7A7A7A", | ||
57 | "j c #7E7E7E", | ||
58 | "k c #6A6A6A", | ||
59 | "l c #FAFAFA", | ||
60 | "m c #505050", | ||
61 | "n c #9D9D9D", | ||
62 | "o c #333333", | ||
63 | "p c #7B7B7B", | ||
64 | "q c #787878", | ||
65 | "r c #696969", | ||
66 | "s c #494949", | ||
67 | "t c #555555", | ||
68 | "u c #949494", | ||
69 | "v c #E6E6E6", | ||
70 | "w c #424242", | ||
71 | "x c #515151", | ||
72 | "y c #535353", | ||
73 | "z c #3E3E3E", | ||
74 | "A c #D4D4D4", | ||
75 | "B c #0C0C0C", | ||
76 | "C c #353535", | ||
77 | "D c #474747", | ||
78 | "E c #ECECEC", | ||
79 | "F c #919191", | ||
80 | "G c #7D7D7D", | ||
81 | "H c #000000", | ||
82 | "I c #404040", | ||
83 | "J c #858585", | ||
84 | "K c #323232", | ||
85 | "L c #D0D0D0", | ||
86 | "M c #1C1C1C", | ||
87 | " ...+ ", | ||
88 | " @#$%&..+ ", | ||
89 | " .*=-;;>,..+ ", | ||
90 | " ')!~;;;;;;{]..", | ||
91 | " ^/(-;;;;;;;_:<", | ||
92 | " [}|;;;;;;;{12$", | ||
93 | " #34-55;;;;678$+", | ||
94 | " 90ab=c;dd;e1fg ", | ||
95 | " [ahij((kbl0mn$ ", | ||
96 | " op^q^^7r&]s/$+ ", | ||
97 | "@btu;vbwxy]zAB ", | ||
98 | "CzDEvEv;;DssF$ ", | ||
99 | "G.H{E{E{IxsJ$+ ", | ||
100 | " +...vEKxzLM ", | ||
101 | " +...z]n$ ", | ||
102 | " +... "}; | ||
103 | |||
104 | #endif | ||
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index f571511..b81f3b4 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -34,147 +34,49 @@ | |||
34 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include <qclipboard.h> | 36 | #include <qclipboard.h> |
37 | #include <qstringlist.h> | 37 | #include <qstringlist.h> |
38 | #include <qaction.h> | 38 | #include <qaction.h> |
39 | #include <qcolordialog.h> | 39 | #include <qcolordialog.h> |
40 | #include <qfileinfo.h> | 40 | #include <qfileinfo.h> |
41 | #include <qlineedit.h> | 41 | #include <qlineedit.h> |
42 | #include <qmessagebox.h> | 42 | #include <qmessagebox.h> |
43 | #include <qobjectlist.h> | 43 | #include <qobjectlist.h> |
44 | #include <qpopupmenu.h> | 44 | #include <qpopupmenu.h> |
45 | #include <qspinbox.h> | 45 | #include <qspinbox.h> |
46 | #include <qtoolbutton.h> | 46 | #include <qtoolbutton.h> |
47 | #include <qwidgetstack.h> | 47 | #include <qwidgetstack.h> |
48 | #include <qcheckbox.h> | 48 | #include <qcheckbox.h> |
49 | #include <qcombo.h> | 49 | #include <qcombo.h> |
50 | #include <qlayout.h> | 50 | #include <qlayout.h> |
51 | #include <qapplication.h> | 51 | #include <qapplication.h> |
52 | #include <qtimer.h> | 52 | #include <qtimer.h> |
53 | #include <qdir.h> | 53 | #include <qdir.h> |
54 | #include <unistd.h> | 54 | #include <unistd.h> |
55 | #include <sys/stat.h> | 55 | #include <sys/stat.h> |
56 | #include <stdlib.h> //getenv | 56 | #include <stdlib.h> //getenv |
57 | 57 | ||
58 | 58 | #include "resource.h" | |
59 | /* XPM */ | ||
60 | static char * filesave_xpm[] = { | ||
61 | "16 16 78 1", | ||
62 | " c None", | ||
63 | ". c #343434", | ||
64 | "+ c #A0A0A0", | ||
65 | "@ c #565656", | ||
66 | "# c #9E9E9E", | ||
67 | "$ c #525252", | ||
68 | "% c #929292", | ||
69 | "& c #676767", | ||
70 | "* c #848484", | ||
71 | "= c #666666", | ||
72 | "- c #D8D8D8", | ||
73 | "; c #FFFFFF", | ||
74 | "> c #DBDBDB", | ||
75 | ", c #636363", | ||
76 | "' c #989898", | ||
77 | ") c #2D2D2D", | ||
78 | "! c #909090", | ||
79 | "~ c #AEAEAE", | ||
80 | "{ c #EAEAEA", | ||
81 | "] c #575757", | ||
82 | "^ c #585858", | ||
83 | "/ c #8A8A8A", | ||
84 | "( c #828282", | ||
85 | "_ c #6F6F6F", | ||
86 | ": c #C9C9C9", | ||
87 | "< c #050505", | ||
88 | "[ c #292929", | ||
89 | "} c #777777", | ||
90 | "| c #616161", | ||
91 | "1 c #3A3A3A", | ||
92 | "2 c #BEBEBE", | ||
93 | "3 c #2C2C2C", | ||
94 | "4 c #7C7C7C", | ||
95 | "5 c #F6F6F6", | ||
96 | "6 c #FCFCFC", | ||
97 | "7 c #6B6B6B", | ||
98 | "8 c #959595", | ||
99 | "9 c #4F4F4F", | ||
100 | "0 c #808080", | ||
101 | "a c #767676", | ||
102 | "b c #818181", | ||
103 | "c c #B8B8B8", | ||
104 | "d c #FBFBFB", | ||
105 | "e c #F9F9F9", | ||
106 | "f c #CCCCCC", | ||
107 | "g c #030303", | ||
108 | "h c #737373", | ||
109 | "i c #7A7A7A", | ||
110 | "j c #7E7E7E", | ||
111 | "k c #6A6A6A", | ||
112 | "l c #FAFAFA", | ||
113 | "m c #505050", | ||
114 | "n c #9D9D9D", | ||
115 | "o c #333333", | ||
116 | "p c #7B7B7B", | ||
117 | "q c #787878", | ||
118 | "r c #696969", | ||
119 | "s c #494949", | ||
120 | "t c #555555", | ||
121 | "u c #949494", | ||
122 | "v c #E6E6E6", | ||
123 | "w c #424242", | ||
124 | "x c #515151", | ||
125 | "y c #535353", | ||
126 | "z c #3E3E3E", | ||
127 | "A c #D4D4D4", | ||
128 | "B c #0C0C0C", | ||
129 | "C c #353535", | ||
130 | "D c #474747", | ||
131 | "E c #ECECEC", | ||
132 | "F c #919191", | ||
133 | "G c #7D7D7D", | ||
134 | "H c #000000", | ||
135 | "I c #404040", | ||
136 | "J c #858585", | ||
137 | "K c #323232", | ||
138 | "L c #D0D0D0", | ||
139 | "M c #1C1C1C", | ||
140 | " ...+ ", | ||
141 | " @#$%&..+ ", | ||
142 | " .*=-;;>,..+ ", | ||
143 | " ')!~;;;;;;{]..", | ||
144 | " ^/(-;;;;;;;_:<", | ||
145 | " [}|;;;;;;;{12$", | ||
146 | " #34-55;;;;678$+", | ||
147 | " 90ab=c;dd;e1fg ", | ||
148 | " [ahij((kbl0mn$ ", | ||
149 | " op^q^^7r&]s/$+ ", | ||
150 | "@btu;vbwxy]zAB ", | ||
151 | "CzDEvEv;;DssF$ ", | ||
152 | "G.H{E{E{IxsJ$+ ", | ||
153 | " +...vEKxzLM ", | ||
154 | " +...z]n$ ", | ||
155 | " +... "}; | ||
156 | |||
157 | 59 | ||
158 | #if QT_VERSION < 300 | 60 | #if QT_VERSION < 300 |
159 | 61 | ||
160 | class QpeEditor : public QMultiLineEdit | 62 | class QpeEditor : public QMultiLineEdit |
161 | { | 63 | { |
162 | 64 | ||
163 | public: | 65 | public: |
164 | QpeEditor( QWidget *parent, const char * name = 0 ) | 66 | QpeEditor( QWidget *parent, const char * name = 0 ) |
165 | : QMultiLineEdit( parent, name ) { | 67 | : QMultiLineEdit( parent, name ) { |
166 | clearTableFlags(); | 68 | clearTableFlags(); |
167 | setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); | 69 | setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); |
168 | } | 70 | } |
169 | 71 | ||
170 | void find( const QString &txt, bool caseSensitive, | 72 | void find( const QString &txt, bool caseSensitive, |
171 | bool backwards ); | 73 | bool backwards ); |
172 | protected: | 74 | protected: |
173 | bool markIt; | 75 | bool markIt; |
174 | int line1, line2, col1, col2; | 76 | int line1, line2, col1, col2; |
175 | void mousePressEvent( QMouseEvent * ); | 77 | void mousePressEvent( QMouseEvent * ); |
176 | void mouseReleaseEvent( QMouseEvent * ); | 78 | void mouseReleaseEvent( QMouseEvent * ); |
177 | 79 | ||
178 | //public slots: | 80 | //public slots: |
179 | /* | 81 | /* |
180 | signals: | 82 | signals: |
@@ -332,48 +234,53 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
332 | a->addTo( editBar ); | 234 | a->addTo( editBar ); |
333 | a->addTo( edit ); | 235 | a->addTo( edit ); |
334 | 236 | ||
335 | a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), | 237 | a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), |
336 | QString::null, 0, this, 0 ); | 238 | QString::null, 0, this, 0 ); |
337 | connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); | 239 | connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); |
338 | a->addTo( editBar ); | 240 | a->addTo( editBar ); |
339 | a->addTo( edit ); | 241 | a->addTo( edit ); |
340 | 242 | ||
341 | 243 | ||
342 | #ifndef QT_NO_CLIPBOARD | 244 | #ifndef QT_NO_CLIPBOARD |
343 | a = new QAction( tr( "Insert Time and Date" ), Resource::loadPixmap( "paste" ), | 245 | a = new QAction( tr( "Insert Time and Date" ), Resource::loadPixmap( "paste" ), |
344 | QString::null, 0, this, 0 ); | 246 | QString::null, 0, this, 0 ); |
345 | connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) ); | 247 | connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) ); |
346 | a->addTo( edit ); | 248 | a->addTo( edit ); |
347 | #endif | 249 | #endif |
348 | 250 | ||
349 | a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), | 251 | a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), |
350 | QString::null, 0, this, 0 ); | 252 | QString::null, 0, this, 0 ); |
351 | connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); | 253 | connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); |
352 | edit->insertSeparator(); | 254 | edit->insertSeparator(); |
353 | a->addTo( bar ); | 255 | a->addTo( bar ); |
354 | a->addTo( edit ); | 256 | a->addTo( edit ); |
355 | 257 | ||
258 | a = new QAction( tr( "Goto Line..." ), Resource::loadPixmap( "find" ), | ||
259 | QString::null, 0, this, 0 ); | ||
260 | connect( a, SIGNAL( activated() ), this, SLOT( gotoLine() ) ); | ||
261 | a->addTo( edit ); | ||
262 | |||
356 | 263 | ||
357 | zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 ); | 264 | zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 ); |
358 | connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) ); | 265 | connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) ); |
359 | zin->addTo( font ); | 266 | zin->addTo( font ); |
360 | 267 | ||
361 | zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 ); | 268 | zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 ); |
362 | connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) ); | 269 | connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) ); |
363 | zout->addTo( font ); | 270 | zout->addTo( font ); |
364 | 271 | ||
365 | font->insertSeparator(); | 272 | font->insertSeparator(); |
366 | 273 | ||
367 | font->insertItem(tr("Font"), this, SLOT(changeFont()) ); | 274 | font->insertItem(tr("Font"), this, SLOT(changeFont()) ); |
368 | 275 | ||
369 | font->insertSeparator(); | 276 | font->insertSeparator(); |
370 | font->insertItem(tr("Advanced Features"), advancedMenu); | 277 | font->insertItem(tr("Advanced Features"), advancedMenu); |
371 | 278 | ||
372 | QAction *wa = new QAction( tr("Wrap lines"), | 279 | QAction *wa = new QAction( tr("Wrap lines"), |
373 | QString::null, 0, this, 0 ); | 280 | QString::null, 0, this, 0 ); |
374 | connect( wa, SIGNAL( toggled(bool) ), | 281 | connect( wa, SIGNAL( toggled(bool) ), |
375 | this, SLOT( setWordWrap(bool) ) ); | 282 | this, SLOT( setWordWrap(bool) ) ); |
376 | wa->setToggleAction(true); | 283 | wa->setToggleAction(true); |
377 | wa->addTo( advancedMenu); | 284 | wa->addTo( advancedMenu); |
378 | 285 | ||
379 | nStart = new QAction( tr("Start with new file"), | 286 | nStart = new QAction( tr("Start with new file"), |
@@ -1239,24 +1146,49 @@ void TextEdit::doTimer(bool b) | |||
1239 | Config cfg("TextEdit"); | 1146 | Config cfg("TextEdit"); |
1240 | cfg.setGroup ( "View" ); | 1147 | cfg.setGroup ( "View" ); |
1241 | cfg.writeEntry ( "autosave", b); | 1148 | cfg.writeEntry ( "autosave", b); |
1242 | featureAutoSave = b; | 1149 | featureAutoSave = b; |
1243 | nAutoSave->setOn(b); | 1150 | nAutoSave->setOn(b); |
1244 | if(b) | 1151 | if(b) |
1245 | { | 1152 | { |
1246 | // qDebug("doTimer true"); | 1153 | // qDebug("doTimer true"); |
1247 | setTimer(); | 1154 | setTimer(); |
1248 | } | 1155 | } |
1249 | // else | 1156 | // else |
1250 | // qDebug("doTimer false"); | 1157 | // qDebug("doTimer false"); |
1251 | } | 1158 | } |
1252 | 1159 | ||
1253 | void TextEdit::setTimer() | 1160 | void TextEdit::setTimer() |
1254 | { | 1161 | { |
1255 | if(featureAutoSave) | 1162 | if(featureAutoSave) |
1256 | { | 1163 | { |
1257 | // qDebug("setting autosave"); | 1164 | // qDebug("setting autosave"); |
1258 | QTimer *timer = new QTimer(this ); | 1165 | QTimer *timer = new QTimer(this ); |
1259 | connect( timer, SIGNAL(timeout()), this, SLOT(timerCrank()) ); | 1166 | connect( timer, SIGNAL(timeout()), this, SLOT(timerCrank()) ); |
1260 | timer->start( 300000, true); //5 minutes | 1167 | timer->start( 300000, true); //5 minutes |
1261 | } | 1168 | } |
1262 | } | 1169 | } |
1170 | |||
1171 | void TextEdit::gotoLine() { | ||
1172 | |||
1173 | QWidget *d = QApplication::desktop(); | ||
1174 | gotoEdit = new QLineEdit( 0, "Goto line"); | ||
1175 | |||
1176 | gotoEdit->move( (d->width()/2) - ( gotoEdit->width()/2) , (d->height()/2) - (gotoEdit->height()/2)); | ||
1177 | gotoEdit->setFrame(true); | ||
1178 | gotoEdit->show(); | ||
1179 | connect (gotoEdit,SIGNAL(returnPressed()), this, SLOT(doGoto())); | ||
1180 | } | ||
1181 | |||
1182 | void TextEdit::doGoto() { | ||
1183 | QString number = gotoEdit->text(); | ||
1184 | gotoEdit->hide(); | ||
1185 | if(gotoEdit) delete gotoEdit; | ||
1186 | bool ok; | ||
1187 | int lineNumber = number.toInt(&ok, 10); | ||
1188 | if(editor->numLines() < lineNumber) | ||
1189 | QMessageBox::message(tr("Text Edit"),tr("Not enough lines")); | ||
1190 | else | ||
1191 | { | ||
1192 | editor->setCursorPosition(lineNumber, 0, false); | ||
1193 | } | ||
1194 | } | ||
diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h index 643ea68..e0cbea2 100644 --- a/core/apps/textedit/textedit.h +++ b/core/apps/textedit/textedit.h | |||
@@ -1,138 +1,142 @@ | |||
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 | // additions made by L.J. Potter Sun 02-17-2002 22:27:46 | 20 | // additions made by L.J. Potter Sun 02-17-2002 22:27:46 |
21 | 21 | ||
22 | #ifndef TEXTEDIT_H | 22 | #ifndef TEXTEDIT_H |
23 | #define TEXTEDIT_H | 23 | #define TEXTEDIT_H |
24 | 24 | ||
25 | #define QTEXTEDIT_OPEN_API | 25 | #define QTEXTEDIT_OPEN_API |
26 | 26 | ||
27 | //#include "fileBrowser.h" | 27 | //#include "fileBrowser.h" |
28 | //#include "fileSaver.h" | 28 | //#include "fileSaver.h" |
29 | 29 | ||
30 | #include <qpe/filemanager.h> | 30 | #include <qpe/filemanager.h> |
31 | #include <qpe/qcopenvelope_qws.h> | 31 | #include <qpe/qcopenvelope_qws.h> |
32 | 32 | ||
33 | #include <opie/ofileselector.h> | 33 | #include <opie/ofileselector.h> |
34 | 34 | ||
35 | #include <qmainwindow.h> | 35 | #include <qmainwindow.h> |
36 | #include <qmultilineedit.h> | 36 | #include <qmultilineedit.h> |
37 | #include <qlist.h> | 37 | #include <qlist.h> |
38 | #include <qmap.h> | 38 | #include <qmap.h> |
39 | 39 | ||
40 | class QAction; | 40 | class QAction; |
41 | class QWidgetStack; | 41 | class QWidgetStack; |
42 | class QToolButton; | 42 | class QToolButton; |
43 | class QPopupMenu; | 43 | class QPopupMenu; |
44 | class QToolBar; | 44 | class QToolBar; |
45 | class QLineEdit; | 45 | class QLineEdit; |
46 | class QAction; | 46 | class QAction; |
47 | class FileSelector; | 47 | class FileSelector; |
48 | class QpeEditor; | 48 | class QpeEditor; |
49 | class QPopupMenu; | 49 | class QPopupMenu; |
50 | class QTimer; | 50 | class QTimer; |
51 | 51 | ||
52 | class TextEdit : public QMainWindow | 52 | class TextEdit : public QMainWindow |
53 | { | 53 | { |
54 | Q_OBJECT | 54 | Q_OBJECT |
55 | 55 | ||
56 | public: | 56 | public: |
57 | TextEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 57 | TextEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
58 | ~TextEdit(); | 58 | ~TextEdit(); |
59 | 59 | ||
60 | protected: | 60 | protected: |
61 | QPopupMenu *font; | 61 | QPopupMenu *font; |
62 | QAction *nStart, *nFileDlgOpt, *nAdvanced, *desktopAction, *filePermAction, *searchBarAction, *nAutoSave; | 62 | QAction *nStart, *nFileDlgOpt, *nAdvanced, *desktopAction, *filePermAction, *searchBarAction, *nAutoSave; |
63 | bool edited, edited1; | 63 | bool edited, edited1; |
64 | void openFile( const QString & ); | 64 | void openFile( const QString & ); |
65 | QCopChannel * channel; | 65 | QCopChannel * channel; |
66 | 66 | ||
67 | bool featureAutoSave; | 67 | bool featureAutoSave; |
68 | void closeEvent( QCloseEvent *e ); | 68 | void closeEvent( QCloseEvent *e ); |
69 | void doSearchBar(); | 69 | void doSearchBar(); |
70 | int savePrompt(); | 70 | int savePrompt(); |
71 | void setTimer(); | 71 | void setTimer(); |
72 | private slots: | 72 | private slots: |
73 | void editorChanged(); | 73 | void editorChanged(); |
74 | void receive(const QCString&, const QByteArray&); | 74 | void receive(const QCString&, const QByteArray&); |
75 | void timerCrank(); | 75 | void timerCrank(); |
76 | void doTimer(bool); | 76 | void doTimer(bool); |
77 | void editPasteTimeDate(); | 77 | void editPasteTimeDate(); |
78 | void doPrompt(bool); | 78 | void doPrompt(bool); |
79 | void doDesktop(bool); | 79 | void doDesktop(bool); |
80 | void doFilePerms(bool); | 80 | void doFilePerms(bool); |
81 | void doAbout(); | 81 | void doAbout(); |
82 | void setDocument(const QString&); | 82 | void setDocument(const QString&); |
83 | void changeFont(); | 83 | void changeFont(); |
84 | void fileNew(); | 84 | void fileNew(); |
85 | void fileRevert(); | 85 | void fileRevert(); |
86 | void fileOpen(); | 86 | void fileOpen(); |
87 | void changeStartConfig(bool); | 87 | void changeStartConfig(bool); |
88 | bool save(); | 88 | bool save(); |
89 | bool saveAs(); | 89 | bool saveAs(); |
90 | void cleanUp(); | 90 | void cleanUp(); |
91 | 91 | ||
92 | 92 | void gotoLine(); | |
93 | void editCut(); | 93 | void doGoto(); |
94 | void editCopy(); | 94 | |
95 | void editPaste(); | 95 | |
96 | void editFind(); | 96 | void editCut(); |
97 | void editDelete(); | 97 | void editCopy(); |
98 | 98 | void editPaste(); | |
99 | void findNext(); | 99 | void editFind(); |
100 | void findClose(); | 100 | void editDelete(); |
101 | 101 | ||
102 | void search(); | 102 | void findNext(); |
103 | void accept(); | 103 | void findClose(); |
104 | 104 | ||
105 | void newFile( const DocLnk & ); | 105 | void search(); |
106 | void openFile( const DocLnk & ); | 106 | void accept(); |
107 | void showEditTools(); | 107 | |
108 | 108 | void newFile( const DocLnk & ); | |
109 | void zoomIn(); | 109 | void openFile( const DocLnk & ); |
110 | void zoomOut(); | 110 | void showEditTools(); |
111 | void setBold(bool y); | 111 | |
112 | void setItalic(bool y); | 112 | void zoomIn(); |
113 | void setWordWrap(bool y); | 113 | void zoomOut(); |
114 | void setSearchBar(bool); | 114 | void setBold(bool y); |
115 | void setItalic(bool y); | ||
116 | void setWordWrap(bool y); | ||
117 | void setSearchBar(bool); | ||
115 | 118 | ||
116 | private: | 119 | private: |
117 | void openDotFile(const QString &); | 120 | void openDotFile(const QString &); |
118 | void colorChanged( const QColor &c ); | 121 | void colorChanged( const QColor &c ); |
119 | void clear(); | 122 | void clear(); |
120 | void updateCaption( const QString &name=QString::null ); | 123 | void updateCaption( const QString &name=QString::null ); |
121 | void setFontSize(int sz, bool round_down_not_up); | 124 | void setFontSize(int sz, bool round_down_not_up); |
122 | private: | 125 | private: |
123 | // fileSaver *fileSaveDlg; | 126 | // fileSaver *fileSaveDlg; |
124 | // fileBrowser *browseForFiles; | 127 | // fileBrowser *browseForFiles; |
125 | bool fromSetDocument; | 128 | bool fromSetDocument; |
126 | QpeEditor* editor; | 129 | QpeEditor* editor; |
127 | QToolBar *menu, *editBar, *searchBar; | 130 | QToolBar *menu, *editBar, *searchBar; |
128 | QPopupMenu *advancedMenu; | 131 | QPopupMenu *advancedMenu; |
129 | QLineEdit *searchEdit; | 132 | QLineEdit *gotoEdit; |
130 | DocLnk *doc; | 133 | QLineEdit *searchEdit; |
131 | bool fileIs, useAdvancedFeatures, promptExit, openDesktop, filePerms, useSearchBar, startWithNew; | 134 | DocLnk *doc; |
132 | bool bFromDocView; | 135 | bool fileIs, useAdvancedFeatures, promptExit, openDesktop, filePerms, useSearchBar, startWithNew; |
136 | bool bFromDocView; | ||
133 | int viewSelection; | 137 | int viewSelection; |
134 | QAction *zin, *zout; | 138 | QAction *zin, *zout; |
135 | QString currentFileName; | 139 | QString currentFileName; |
136 | }; | 140 | }; |
137 | 141 | ||
138 | #endif | 142 | #endif |
diff --git a/core/apps/textedit/textedit.pro b/core/apps/textedit/textedit.pro index f5e16a0..233dd67 100644 --- a/core/apps/textedit/textedit.pro +++ b/core/apps/textedit/textedit.pro | |||
@@ -1,30 +1,30 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | HEADERS = textedit.h filePermissions.h | 4 | HEADERS = textedit.h filePermissions.h resource.h |
5 | SOURCES = main.cpp textedit.cpp filePermissions.cpp | 5 | SOURCES = main.cpp textedit.cpp filePermissions.cpp |
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
7 | DEPENDPATH += $(OPIEDIR)/include | 7 | DEPENDPATH += $(OPIEDIR)/include |
8 | LIBS += -lqpe -lopie | 8 | LIBS += -lqpe -lopie |
9 | TARGET = textedit | 9 | TARGET = textedit |
10 | 10 | ||
11 | TRANSLATIONS = ../../../i18n/de/textedit.ts \ | 11 | TRANSLATIONS = ../../../i18n/de/textedit.ts \ |
12 | ../../../i18n/da/textedit.ts \ | 12 | ../../../i18n/da/textedit.ts \ |
13 | ../../../i18n/xx/textedit.ts \ | 13 | ../../../i18n/xx/textedit.ts \ |
14 | ../../../i18n/en/textedit.ts \ | 14 | ../../../i18n/en/textedit.ts \ |
15 | ../../../i18n/es/textedit.ts \ | 15 | ../../../i18n/es/textedit.ts \ |
16 | ../../../i18n/fr/textedit.ts \ | 16 | ../../../i18n/fr/textedit.ts \ |
17 | ../../../i18n/hu/textedit.ts \ | 17 | ../../../i18n/hu/textedit.ts \ |
18 | ../../../i18n/ja/textedit.ts \ | 18 | ../../../i18n/ja/textedit.ts \ |
19 | ../../../i18n/ko/textedit.ts \ | 19 | ../../../i18n/ko/textedit.ts \ |
20 | ../../../i18n/no/textedit.ts \ | 20 | ../../../i18n/no/textedit.ts \ |
21 | ../../../i18n/pl/textedit.ts \ | 21 | ../../../i18n/pl/textedit.ts \ |
22 | ../../../i18n/pt/textedit.ts \ | 22 | ../../../i18n/pt/textedit.ts \ |
23 | ../../../i18n/pt_BR/textedit.ts \ | 23 | ../../../i18n/pt_BR/textedit.ts \ |
24 | ../../../i18n/sl/textedit.ts \ | 24 | ../../../i18n/sl/textedit.ts \ |
25 | ../../../i18n/zh_CN/textedit.ts \ | 25 | ../../../i18n/zh_CN/textedit.ts \ |
26 | ../../../i18n/zh_TW/textedit.ts | 26 | ../../../i18n/zh_TW/textedit.ts |
27 | 27 | ||
28 | 28 | ||
29 | 29 | ||
30 | include ( $(OPIEDIR)/include.pro ) | 30 | include ( $(OPIEDIR)/include.pro ) |