summaryrefslogtreecommitdiff
authordrw <drw>2004-02-23 23:19:47 (UTC)
committer drw <drw>2004-02-23 23:19:47 (UTC)
commit8fe156f20106aaa4861a60314273733685d37dad (patch) (unidiff)
tree3f069e0b432863fd27f0f1c28287b4a835f3d302
parentbff739b1760881bb326ec38ebe62a52195b8c032 (diff)
downloadopie-8fe156f20106aaa4861a60314273733685d37dad.zip
opie-8fe156f20106aaa4861a60314273733685d37dad.tar.gz
opie-8fe156f20106aaa4861a60314273733685d37dad.tar.bz2
Text Editor: libopie->libopie2
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/config.in2
-rw-r--r--core/apps/textedit/main.cpp3
-rw-r--r--core/apps/textedit/opie-textedit.control2
-rw-r--r--core/apps/textedit/textedit.cpp10
-rw-r--r--core/apps/textedit/textedit.h2
-rw-r--r--core/apps/textedit/textedit.pro2
6 files changed, 12 insertions, 9 deletions
diff --git a/core/apps/textedit/config.in b/core/apps/textedit/config.in
index e22135b..749af6c 100644
--- a/core/apps/textedit/config.in
+++ b/core/apps/textedit/config.in
@@ -1,4 +1,4 @@
1 config TEXTEDIT 1 config TEXTEDIT
2 boolean "opie-textedit (simple text editor)" 2 boolean "opie-textedit (simple text editor)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI
diff --git a/core/apps/textedit/main.cpp b/core/apps/textedit/main.cpp
index edab73d..9aee47b 100644
--- a/core/apps/textedit/main.cpp
+++ b/core/apps/textedit/main.cpp
@@ -1,26 +1,25 @@
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 20
21#include "textedit.h" 21#include "textedit.h"
22 22
23#include <qpe/qpeapplication.h> 23#include <opie2/oapplicationfactory.h>
24#include <opie/oapplicationfactory.h>
25 24
26OPIE_EXPORT_APP( OApplicationFactory<TextEdit> ) 25OPIE_EXPORT_APP( OApplicationFactory<TextEdit> )
diff --git a/core/apps/textedit/opie-textedit.control b/core/apps/textedit/opie-textedit.control
index 44af66c..aeaef72 100644
--- a/core/apps/textedit/opie-textedit.control
+++ b/core/apps/textedit/opie-textedit.control
@@ -1,10 +1,10 @@
1Package: opie-textedit 1Package: opie-textedit
2Files: plugins/application/libtextedit.so* bin/textedit apps/1Pim/textedit.desktop pics/textedit 2Files: plugins/application/libtextedit.so* bin/textedit apps/1Pim/textedit.desktop pics/textedit
3Priority: optional 3Priority: optional
4Section: opie/pim 4Section: opie/pim
5Maintainer: L.J. Potter <lpotter@trolltech.com> 5Maintainer: L.J. Potter <lpotter@trolltech.com>
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal, libopie1 7Depends: task-opie-minimal, libopiecore2, libopieui2
8Description: Text Editor 8Description: Text Editor
9 The text editor for the Opie environment. 9 The text editor for the Opie environment.
10Version: $QPE_VERSION$EXTRAVERSION 10Version: $QPE_VERSION$EXTRAVERSION
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 1299fe3..2a4d391 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -1,441 +1,445 @@
1/********************************************************************** 1/**********************************************************************
2// textedit.cpp 2// textedit.cpp
3** Copyright (C) 2000 Trolltech AS. All rights reserved. 3** Copyright (C) 2000 Trolltech AS. All rights reserved.
4** 4**
5** This file is part of Opie Environment. 5** This file is part of Opie Environment.
6** 6**
7** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 10** packaging of this file.
11** 11**
12**********************************************************************/ 12**********************************************************************/
13// changes added by L. J. Potter Sun 02-17-2002 21:31:31 13// changes added by L. J. Potter Sun 02-17-2002 21:31:31
14#include "textedit.h" 14#include "textedit.h"
15#include "filePermissions.h" 15#include "filePermissions.h"
16 16
17 17
18#include <opie/ofileselector.h> 18#include <opie2/ofileselector.h>
19#include <opie/ofiledialog.h> 19#include <opie2/ofiledialog.h>
20#include <opie/ofontselector.h> 20#include <opie2/ofontselector.h>
21 21
22#include <qpe/fontdatabase.h> 22#include <qpe/fontdatabase.h>
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/fileselector.h> 24#include <qpe/fileselector.h>
25#include <qpe/applnk.h> 25#include <qpe/applnk.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/config.h> 27#include <qpe/config.h>
28#include <qpe/qpeapplication.h> 28#include <qpe/qpeapplication.h>
29#include <qmenubar.h> 29#include <qmenubar.h>
30#include <qtoolbar.h> 30#include <qtoolbar.h>
31#include <qpe/qcopenvelope_qws.h> 31#include <qpe/qcopenvelope_qws.h>
32 32
33#include <qpoint.h> 33#include <qpoint.h>
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
58using Opie::OFileDialog;
59using Opie::OFileSelector;
60using Opie::OFontSelector;
61
58#if QT_VERSION < 300 62#if QT_VERSION < 300
59 63
60class QpeEditor : public QMultiLineEdit 64class QpeEditor : public QMultiLineEdit
61{ 65{
62 66
63public: 67public:
64 QpeEditor( QWidget *parent, const char * name = 0 ) 68 QpeEditor( QWidget *parent, const char * name = 0 )
65 : QMultiLineEdit( parent, name ) { 69 : QMultiLineEdit( parent, name ) {
66 clearTableFlags(); 70 clearTableFlags();
67 setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); 71 setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar );
68} 72}
69 73
70 void find( const QString &txt, bool caseSensitive, 74 void find( const QString &txt, bool caseSensitive,
71 bool backwards ); 75 bool backwards );
72protected: 76protected:
73 bool markIt; 77 bool markIt;
74 int line1, line2, col1, col2; 78 int line1, line2, col1, col2;
75 void mousePressEvent( QMouseEvent * ); 79 void mousePressEvent( QMouseEvent * );
76 void mouseReleaseEvent( QMouseEvent * ); 80 void mouseReleaseEvent( QMouseEvent * );
77 81
78//public slots: 82//public slots:
79 /* 83 /*
80signals: 84signals:
81 void notFound(); 85 void notFound();
82 void searchWrapped(); 86 void searchWrapped();
83 */ 87 */
84 88
85private: 89private:
86 90
87}; 91};
88 92
89void QpeEditor::mousePressEvent( QMouseEvent *e ) { 93void QpeEditor::mousePressEvent( QMouseEvent *e ) {
90 switch(e->button()) { 94 switch(e->button()) {
91 case RightButton: 95 case RightButton:
92 { //rediculous workaround for qt popup menu 96 { //rediculous workaround for qt popup menu
93 //and the hold right click mechanism 97 //and the hold right click mechanism
94 this->setSelection( line1, col1, line2, col2); 98 this->setSelection( line1, col1, line2, col2);
95 QMultiLineEdit::mousePressEvent( e ); 99 QMultiLineEdit::mousePressEvent( e );
96 markIt = false; 100 markIt = false;
97 } 101 }
98 break; 102 break;
99 default: 103 default:
100 { 104 {
101 if(!markIt) { 105 if(!markIt) {
102 int line, col; 106 int line, col;
103 this->getCursorPosition(&line, &col); 107 this->getCursorPosition(&line, &col);
104 line1=line2=line; 108 line1=line2=line;
105 col1=col2=col; 109 col1=col2=col;
106 } 110 }
107 QMultiLineEdit::mousePressEvent( e ); 111 QMultiLineEdit::mousePressEvent( e );
108 } 112 }
109 break; 113 break;
110 }; 114 };
111} 115}
112 116
113void QpeEditor::mouseReleaseEvent( QMouseEvent * ) { 117void QpeEditor::mouseReleaseEvent( QMouseEvent * ) {
114 if(this->hasMarkedText()) { 118 if(this->hasMarkedText()) {
115 markIt = true; 119 markIt = true;
116 this->getMarkedRegion( &line1, &col1, &line2, & col2 ); 120 this->getMarkedRegion( &line1, &col1, &line2, & col2 );
117 } else { 121 } else {
118 markIt = false; 122 markIt = false;
119 } 123 }
120} 124}
121 125
122void QpeEditor::find ( const QString &txt, bool caseSensitive, 126void QpeEditor::find ( const QString &txt, bool caseSensitive,
123 bool backwards ) 127 bool backwards )
124{ 128{
125 static bool wrap = false; 129 static bool wrap = false;
126 int line, col; 130 int line, col;
127 if ( wrap ) { 131 if ( wrap ) {
128 if ( !backwards ) 132 if ( !backwards )
129 line = col = 0; 133 line = col = 0;
130 wrap = false; 134 wrap = false;
131 // emit searchWrapped(); 135 // emit searchWrapped();
132 } else { 136 } else {
133 getCursorPosition( &line, &col ); 137 getCursorPosition( &line, &col );
134 } 138 }
135 //ignore backwards for now.... 139 //ignore backwards for now....
136 if ( !backwards ) { 140 if ( !backwards ) {
137 for ( ; ; ) { 141 for ( ; ; ) {
138 if ( line >= numLines() ) { 142 if ( line >= numLines() ) {
139 wrap = true; 143 wrap = true;
140 //emit notFound(); 144 //emit notFound();
141 break; 145 break;
142 } 146 }
143 int findCol = getString( line )->find( txt, col, caseSensitive ); 147 int findCol = getString( line )->find( txt, col, caseSensitive );
144 if ( findCol >= 0 ) { 148 if ( findCol >= 0 ) {
145 setCursorPosition( line, findCol, false ); 149 setCursorPosition( line, findCol, false );
146 col = findCol + txt.length(); 150 col = findCol + txt.length();
147 setCursorPosition( line, col, true ); 151 setCursorPosition( line, col, true );
148 152
149 //found = true; 153 //found = true;
150 break; 154 break;
151 } 155 }
152 line++; 156 line++;
153 col = 0; 157 col = 0;
154 } 158 }
155 } 159 }
156} 160}
157 161
158 162
159#else 163#else
160 164
161#error "Must make a QpeEditor that inherits QTextEdit" 165#error "Must make a QpeEditor that inherits QTextEdit"
162 166
163#endif 167#endif
164 168
165 169
166static const int nfontsizes = 6; 170static const int nfontsizes = 6;
167static const int fontsize[nfontsizes] = {8,10,12,14,18,24}; 171static const int fontsize[nfontsizes] = {8,10,12,14,18,24};
168 172
169TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) 173TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
170 : QMainWindow( parent, name, f ), bFromDocView( false ) 174 : QMainWindow( parent, name, f ), bFromDocView( false )
171{ 175{
172 doc = 0; 176 doc = 0;
173 edited=false; 177 edited=false;
174 fromSetDocument=false; 178 fromSetDocument=false;
175 179
176 setToolBarsMovable( false ); 180 setToolBarsMovable( false );
177 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 181 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
178 182
179 channel = new QCopChannel( "QPE/Application/textedit", this ); 183 channel = new QCopChannel( "QPE/Application/textedit", this );
180 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 184 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
181 this, SLOT(receive(const QCString&, const QByteArray&)) ); 185 this, SLOT(receive(const QCString&, const QByteArray&)) );
182 186
183 setIcon( Resource::loadPixmap( "TextEditor" ) ); 187 setIcon( Resource::loadPixmap( "TextEditor" ) );
184 188
185 QToolBar *bar = new QToolBar( this ); 189 QToolBar *bar = new QToolBar( this );
186 bar->setHorizontalStretchable( true ); 190 bar->setHorizontalStretchable( true );
187 menu = bar; 191 menu = bar;
188 192
189 QMenuBar *mb = new QMenuBar( bar ); 193 QMenuBar *mb = new QMenuBar( bar );
190 QPopupMenu *file = new QPopupMenu( this ); 194 QPopupMenu *file = new QPopupMenu( this );
191 QPopupMenu *edit = new QPopupMenu( this ); 195 QPopupMenu *edit = new QPopupMenu( this );
192 QPopupMenu *advancedMenu = new QPopupMenu(this); 196 QPopupMenu *advancedMenu = new QPopupMenu(this);
193 197
194 font = new QPopupMenu( this ); 198 font = new QPopupMenu( this );
195 199
196 bar = new QToolBar( this ); 200 bar = new QToolBar( this );
197 editBar = bar; 201 editBar = bar;
198 202
199 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), 203 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ),
200 QString::null, 0, this, 0 ); 204 QString::null, 0, this, 0 );
201 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 205 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
202// a->addTo( bar ); 206// a->addTo( bar );
203 a->addTo( file ); 207 a->addTo( file );
204 208
205 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), 209 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ),
206 QString::null, 0, this, 0 ); 210 QString::null, 0, this, 0 );
207 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); 211 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
208 a->addTo( bar ); 212 a->addTo( bar );
209 a->addTo( file ); 213 a->addTo( file );
210 214
211 a = new QAction( tr( "Save" ), Resource::loadPixmap("save") , 215 a = new QAction( tr( "Save" ), Resource::loadPixmap("save") ,
212 QString::null, 0, this, 0 ); 216 QString::null, 0, this, 0 );
213 connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); 217 connect( a, SIGNAL( activated() ), this, SLOT( save() ) );
214 file->insertSeparator(); 218 file->insertSeparator();
215 a->addTo( bar ); 219 a->addTo( bar );
216 a->addTo( file ); 220 a->addTo( file );
217 221
218 a = new QAction( tr( "Save As" ), Resource::loadPixmap("save") , 222 a = new QAction( tr( "Save As" ), Resource::loadPixmap("save") ,
219 QString::null, 0, this, 0 ); 223 QString::null, 0, this, 0 );
220 connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) ); 224 connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) );
221 a->addTo( file ); 225 a->addTo( file );
222 226
223 a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), 227 a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ),
224 QString::null, 0, this, 0 ); 228 QString::null, 0, this, 0 );
225 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); 229 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
226 a->addTo( editBar ); 230 a->addTo( editBar );
227 a->addTo( edit ); 231 a->addTo( edit );
228 232
229 a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), 233 a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ),
230 QString::null, 0, this, 0 ); 234 QString::null, 0, this, 0 );
231 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); 235 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
232 a->addTo( editBar ); 236 a->addTo( editBar );
233 a->addTo( edit ); 237 a->addTo( edit );
234 238
235 a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), 239 a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ),
236 QString::null, 0, this, 0 ); 240 QString::null, 0, this, 0 );
237 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); 241 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
238 a->addTo( editBar ); 242 a->addTo( editBar );
239 a->addTo( edit ); 243 a->addTo( edit );
240 244
241 245
242#ifndef QT_NO_CLIPBOARD 246#ifndef QT_NO_CLIPBOARD
243 a = new QAction( tr( "Insert Time and Date" ), Resource::loadPixmap( "paste" ), 247 a = new QAction( tr( "Insert Time and Date" ), Resource::loadPixmap( "paste" ),
244 QString::null, 0, this, 0 ); 248 QString::null, 0, this, 0 );
245 connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) ); 249 connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) );
246 a->addTo( edit ); 250 a->addTo( edit );
247#endif 251#endif
248 252
249 a = new QAction( tr( "Goto Line..." ), Resource::loadPixmap( "find" ), 253 a = new QAction( tr( "Goto Line..." ), Resource::loadPixmap( "find" ),
250 QString::null, 0, this, 0 ); 254 QString::null, 0, this, 0 );
251 connect( a, SIGNAL( activated() ), this, SLOT( gotoLine() ) ); 255 connect( a, SIGNAL( activated() ), this, SLOT( gotoLine() ) );
252 edit->insertSeparator(); 256 edit->insertSeparator();
253 a->addTo( edit ); 257 a->addTo( edit );
254 258
255 a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), 259 a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ),
256 QString::null, 0, this, 0 ); 260 QString::null, 0, this, 0 );
257 connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) ); 261 connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) );
258 a->addTo( bar ); 262 a->addTo( bar );
259 a->addTo( edit ); 263 a->addTo( edit );
260 264
261 zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 ); 265 zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 );
262 connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) ); 266 connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) );
263 zin->addTo( font ); 267 zin->addTo( font );
264 268
265 zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 ); 269 zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 );
266 connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) ); 270 connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) );
267 zout->addTo( font ); 271 zout->addTo( font );
268 272
269 font->insertSeparator(); 273 font->insertSeparator();
270 274
271 font->insertItem(tr("Font"), this, SLOT(changeFont()) ); 275 font->insertItem(tr("Font"), this, SLOT(changeFont()) );
272 276
273 font->insertSeparator(); 277 font->insertSeparator();
274 font->insertItem(tr("Advanced Features"), advancedMenu); 278 font->insertItem(tr("Advanced Features"), advancedMenu);
275 279
276 QAction *wa = new QAction( tr("Wrap lines"), 280 QAction *wa = new QAction( tr("Wrap lines"),
277 QString::null, 0, this, 0 ); 281 QString::null, 0, this, 0 );
278 connect( wa, SIGNAL( toggled(bool) ), 282 connect( wa, SIGNAL( toggled(bool) ),
279 this, SLOT( setWordWrap(bool) ) ); 283 this, SLOT( setWordWrap(bool) ) );
280 wa->setToggleAction(true); 284 wa->setToggleAction(true);
281 wa->addTo( advancedMenu); 285 wa->addTo( advancedMenu);
282 286
283 nStart = new QAction( tr("Start with new file"), 287 nStart = new QAction( tr("Start with new file"),
284 QString::null, 0, this, 0 ); 288 QString::null, 0, this, 0 );
285 connect( nStart, SIGNAL( toggled(bool) ), 289 connect( nStart, SIGNAL( toggled(bool) ),
286 this, SLOT( changeStartConfig(bool) ) ); 290 this, SLOT( changeStartConfig(bool) ) );
287 nStart->setToggleAction(true); 291 nStart->setToggleAction(true);
288 nStart->addTo( advancedMenu ); 292 nStart->addTo( advancedMenu );
289 nStart->setEnabled(false); 293 nStart->setEnabled(false);
290 294
291 nAdvanced = new QAction( tr("Prompt on Exit"), 295 nAdvanced = new QAction( tr("Prompt on Exit"),
292 QString::null, 0, this, 0 ); 296 QString::null, 0, this, 0 );
293 connect( nAdvanced, SIGNAL( toggled(bool) ), 297 connect( nAdvanced, SIGNAL( toggled(bool) ),
294 this, SLOT( doPrompt(bool) ) ); 298 this, SLOT( doPrompt(bool) ) );
295 nAdvanced->setToggleAction(true); 299 nAdvanced->setToggleAction(true);
296 nAdvanced->addTo( advancedMenu ); 300 nAdvanced->addTo( advancedMenu );
297 301
298 desktopAction = new QAction( tr("Always open linked file"), 302 desktopAction = new QAction( tr("Always open linked file"),
299 QString::null, 0, this, 0 ); 303 QString::null, 0, this, 0 );
300 connect( desktopAction, SIGNAL( toggled(bool) ), 304 connect( desktopAction, SIGNAL( toggled(bool) ),
301 this, SLOT( doDesktop(bool) ) ); 305 this, SLOT( doDesktop(bool) ) );
302 desktopAction->setToggleAction(true); 306 desktopAction->setToggleAction(true);
303 desktopAction->addTo( advancedMenu); 307 desktopAction->addTo( advancedMenu);
304 308
305 filePermAction = new QAction( tr("File Permissions"), 309 filePermAction = new QAction( tr("File Permissions"),
306 QString::null, 0, this, 0 ); 310 QString::null, 0, this, 0 );
307 connect( filePermAction, SIGNAL( toggled(bool) ), 311 connect( filePermAction, SIGNAL( toggled(bool) ),
308 this, SLOT( doFilePerms(bool) ) ); 312 this, SLOT( doFilePerms(bool) ) );
309 filePermAction->setToggleAction(true); 313 filePermAction->setToggleAction(true);
310 filePermAction->addTo( advancedMenu); 314 filePermAction->addTo( advancedMenu);
311 315
312 searchBarAction = new QAction( tr("Search Bar Open"), 316 searchBarAction = new QAction( tr("Search Bar Open"),
313 QString::null, 0, this, 0 ); 317 QString::null, 0, this, 0 );
314 connect( searchBarAction, SIGNAL( toggled(bool) ), 318 connect( searchBarAction, SIGNAL( toggled(bool) ),
315 this, SLOT( setSearchBar(bool) ) ); 319 this, SLOT( setSearchBar(bool) ) );
316 searchBarAction->setToggleAction(true); 320 searchBarAction->setToggleAction(true);
317 searchBarAction->addTo( advancedMenu); 321 searchBarAction->addTo( advancedMenu);
318 322
319 nAutoSave = new QAction( tr("Auto Save 5 min."), 323 nAutoSave = new QAction( tr("Auto Save 5 min."),
320 QString::null, 0, this, 0 ); 324 QString::null, 0, this, 0 );
321 connect( nAutoSave, SIGNAL( toggled(bool) ), 325 connect( nAutoSave, SIGNAL( toggled(bool) ),
322 this, SLOT( doTimer(bool) ) ); 326 this, SLOT( doTimer(bool) ) );
323 nAutoSave->setToggleAction(true); 327 nAutoSave->setToggleAction(true);
324 nAutoSave->addTo( advancedMenu); 328 nAutoSave->addTo( advancedMenu);
325 329
326 330
327 //font->insertSeparator(); 331 //font->insertSeparator();
328 332
329 //font->insertItem(tr("About"), this, SLOT( doAbout()) ); 333 //font->insertItem(tr("About"), this, SLOT( doAbout()) );
330 334
331 mb->insertItem( tr( "File" ), file ); 335 mb->insertItem( tr( "File" ), file );
332 mb->insertItem( tr( "Edit" ), edit ); 336 mb->insertItem( tr( "Edit" ), edit );
333 mb->insertItem( tr( "View" ), font ); 337 mb->insertItem( tr( "View" ), font );
334 338
335 searchBar = new QToolBar(this); 339 searchBar = new QToolBar(this);
336 addToolBar( searchBar, "Search", QMainWindow::Top, true ); 340 addToolBar( searchBar, "Search", QMainWindow::Top, true );
337 341
338 searchBar->setHorizontalStretchable( true ); 342 searchBar->setHorizontalStretchable( true );
339 343
340 searchEdit = new QLineEdit( searchBar, "searchEdit" ); 344 searchEdit = new QLineEdit( searchBar, "searchEdit" );
341 searchBar->setStretchableWidget( searchEdit ); 345 searchBar->setStretchableWidget( searchEdit );
342 connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 346 connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
343 this, SLOT( search() ) ); 347 this, SLOT( search() ) );
344 348
345 a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), 349 a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ),
346 QString::null, 0, this, 0 ); 350 QString::null, 0, this, 0 );
347 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); 351 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) );
348 a->addTo( searchBar ); 352 a->addTo( searchBar );
349 a->addTo( edit ); 353 a->addTo( edit );
350 354
351 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), 355 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ),
352 QString::null, 0, this, 0 ); 356 QString::null, 0, this, 0 );
353 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 357 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
354 a->addTo( searchBar ); 358 a->addTo( searchBar );
355 359
356 edit->insertSeparator(); 360 edit->insertSeparator();
357 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), 361 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ),
358 QString::null, 0, this, 0 ); 362 QString::null, 0, this, 0 );
359 connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); 363 connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) );
360 a->addTo( edit ); 364 a->addTo( edit );
361 365
362 searchBar->hide(); 366 searchBar->hide();
363 367
364 editor = new QpeEditor( this ); 368 editor = new QpeEditor( this );
365 setCentralWidget( editor ); 369 setCentralWidget( editor );
366 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 370 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken );
367 connect( editor, SIGNAL( textChanged() ), 371 connect( editor, SIGNAL( textChanged() ),
368 this, SLOT( editorChanged() ) ); 372 this, SLOT( editorChanged() ) );
369 373
370 QPEApplication::setStylusOperation( editor, QPEApplication::RightOnHold); 374 QPEApplication::setStylusOperation( editor, QPEApplication::RightOnHold);
371 375
372 Config cfg("TextEdit"); 376 Config cfg("TextEdit");
373 cfg. setGroup ( "Font" ); 377 cfg. setGroup ( "Font" );
374 378
375 QFont defaultFont = editor-> font ( ); 379 QFont defaultFont = editor-> font ( );
376 380
377 QString family = cfg. readEntry ( "Family", defaultFont. family ( )); 381 QString family = cfg. readEntry ( "Family", defaultFont. family ( ));
378 int size = cfg. readNumEntry ( "Size", defaultFont. pointSize ( )); 382 int size = cfg. readNumEntry ( "Size", defaultFont. pointSize ( ));
379 int weight = cfg. readNumEntry ( "Weight", defaultFont. weight ( )); 383 int weight = cfg. readNumEntry ( "Weight", defaultFont. weight ( ));
380 bool italic = cfg. readBoolEntry ( "Italic", defaultFont. italic ( )); 384 bool italic = cfg. readBoolEntry ( "Italic", defaultFont. italic ( ));
381 385
382 defaultFont = QFont ( family, size, weight, italic ); 386 defaultFont = QFont ( family, size, weight, italic );
383 editor-> setFont ( defaultFont ); 387 editor-> setFont ( defaultFont );
384// updateCaption(); 388// updateCaption();
385 389
386 cfg.setGroup ( "View" ); 390 cfg.setGroup ( "View" );
387 391
388 promptExit = cfg.readBoolEntry ( "PromptExit", false ); 392 promptExit = cfg.readBoolEntry ( "PromptExit", false );
389 openDesktop = cfg.readBoolEntry ( "OpenDesktop", true ); 393 openDesktop = cfg.readBoolEntry ( "OpenDesktop", true );
390 filePerms = cfg.readBoolEntry ( "FilePermissions", false ); 394 filePerms = cfg.readBoolEntry ( "FilePermissions", false );
391 useSearchBar = cfg.readBoolEntry ( "SearchBar", false ); 395 useSearchBar = cfg.readBoolEntry ( "SearchBar", false );
392 startWithNew = cfg.readBoolEntry ( "startNew", true); 396 startWithNew = cfg.readBoolEntry ( "startNew", true);
393 featureAutoSave = cfg.readBoolEntry( "autosave", false); 397 featureAutoSave = cfg.readBoolEntry( "autosave", false);
394 398
395 if(useSearchBar) searchBarAction->setOn(true); 399 if(useSearchBar) searchBarAction->setOn(true);
396 if(promptExit) nAdvanced->setOn( true ); 400 if(promptExit) nAdvanced->setOn( true );
397 if(openDesktop) desktopAction->setOn( true ); 401 if(openDesktop) desktopAction->setOn( true );
398 if(filePerms) filePermAction->setOn( true ); 402 if(filePerms) filePermAction->setOn( true );
399 if(startWithNew) nStart->setOn( true ); 403 if(startWithNew) nStart->setOn( true );
400 if(featureAutoSave) nAutoSave->setOn(true); 404 if(featureAutoSave) nAutoSave->setOn(true);
401 405
402// { 406// {
403// doTimer(true); 407// doTimer(true);
404// } 408// }
405 409
406 bool wrap = cfg. readBoolEntry ( "Wrap", true ); 410 bool wrap = cfg. readBoolEntry ( "Wrap", true );
407 wa-> setOn ( wrap ); 411 wa-> setOn ( wrap );
408 setWordWrap ( wrap ); 412 setWordWrap ( wrap );
409 413
410///////////////// 414/////////////////
411 if( qApp->argc() > 1) { 415 if( qApp->argc() > 1) {
412 currentFileName=qApp->argv()[1]; 416 currentFileName=qApp->argv()[1];
413 417
414 QFileInfo fi(currentFileName); 418 QFileInfo fi(currentFileName);
415 419
416 if(fi.baseName().left(1) == "") { 420 if(fi.baseName().left(1) == "") {
417 openDotFile(currentFileName); 421 openDotFile(currentFileName);
418 } else { 422 } else {
419 openFile(currentFileName); 423 openFile(currentFileName);
420 } 424 }
421 } else { 425 } else {
422 edited1=false; 426 edited1=false;
423 openDotFile(""); 427 openDotFile("");
424 } 428 }
425 429
426 viewSelection = cfg.readNumEntry( "FileView", 0 ); 430 viewSelection = cfg.readNumEntry( "FileView", 0 );
427} 431}
428 432
429TextEdit::~TextEdit() { 433TextEdit::~TextEdit() {
430 qWarning("textedit d'tor"); 434 qWarning("textedit d'tor");
431 delete editor; 435 delete editor;
432} 436}
433 437
434void TextEdit::closeEvent(QCloseEvent *) { 438void TextEdit::closeEvent(QCloseEvent *) {
435 if( edited1 && promptExit) 439 if( edited1 && promptExit)
436 { 440 {
437 switch( savePrompt() ) 441 switch( savePrompt() )
438 { 442 {
439 case 1: 443 case 1:
440 { 444 {
441 saveAs(); 445 saveAs();
diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h
index 303b707..34f3617 100644
--- a/core/apps/textedit/textedit.h
+++ b/core/apps/textedit/textedit.h
@@ -1,143 +1,143 @@
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
40class QAction; 40class QAction;
41class QWidgetStack; 41class QWidgetStack;
42class QToolButton; 42class QToolButton;
43class QPopupMenu; 43class QPopupMenu;
44class QToolBar; 44class QToolBar;
45class QLineEdit; 45class QLineEdit;
46class QAction; 46class QAction;
47class FileSelector; 47class FileSelector;
48class QpeEditor; 48class QpeEditor;
49class QPopupMenu; 49class QPopupMenu;
50class QTimer; 50class QTimer;
51 51
52class TextEdit : public QMainWindow 52class TextEdit : public QMainWindow
53{ 53{
54 Q_OBJECT 54 Q_OBJECT
55 55
56public: 56public:
57 static QString appName() { return QString::fromLatin1("textedit"); } 57 static QString appName() { return QString::fromLatin1("textedit"); }
58 TextEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 58 TextEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
59 ~TextEdit(); 59 ~TextEdit();
60 60
61protected: 61protected:
62 QPopupMenu *font; 62 QPopupMenu *font;
63 QAction *nStart, *nFileDlgOpt, *nAdvanced, *desktopAction, *filePermAction, *searchBarAction, *nAutoSave; 63 QAction *nStart, *nFileDlgOpt, *nAdvanced, *desktopAction, *filePermAction, *searchBarAction, *nAutoSave;
64 bool edited, edited1; 64 bool edited, edited1;
65 void openFile( const QString & ); 65 void openFile( const QString & );
66 QCopChannel * channel; 66 QCopChannel * channel;
67 67
68 bool featureAutoSave; 68 bool featureAutoSave;
69 void closeEvent( QCloseEvent *e ); 69 void closeEvent( QCloseEvent *e );
70 void doSearchBar(); 70 void doSearchBar();
71 int savePrompt(); 71 int savePrompt();
72 void setTimer(); 72 void setTimer();
73private slots: 73private slots:
74 void editorChanged(); 74 void editorChanged();
75 void receive(const QCString&, const QByteArray&); 75 void receive(const QCString&, const QByteArray&);
76 void timerCrank(); 76 void timerCrank();
77 void doTimer(bool); 77 void doTimer(bool);
78 void editPasteTimeDate(); 78 void editPasteTimeDate();
79 void doPrompt(bool); 79 void doPrompt(bool);
80 void doDesktop(bool); 80 void doDesktop(bool);
81 void doFilePerms(bool); 81 void doFilePerms(bool);
82 void doAbout(); 82 void doAbout();
83 void setDocument(const QString&); 83 void setDocument(const QString&);
84 void changeFont(); 84 void changeFont();
85 void fileNew(); 85 void fileNew();
86 void fileRevert(); 86 void fileRevert();
87 void fileOpen(); 87 void fileOpen();
88 void changeStartConfig(bool); 88 void changeStartConfig(bool);
89 bool save(); 89 bool save();
90 bool saveAs(); 90 bool saveAs();
91 void cleanUp(); 91 void cleanUp();
92 92
93 void gotoLine(); 93 void gotoLine();
94 void doGoto(); 94 void doGoto();
95 95
96 96
97 void editCut(); 97 void editCut();
98 void editCopy(); 98 void editCopy();
99 void editPaste(); 99 void editPaste();
100 void editFind(); 100 void editFind();
101 void editDelete(); 101 void editDelete();
102 102
103 void findNext(); 103 void findNext();
104 void findClose(); 104 void findClose();
105 105
106 void search(); 106 void search();
107 void accept(); 107 void accept();
108 108
109 void newFile( const DocLnk & ); 109 void newFile( const DocLnk & );
110 void openFile( const DocLnk & ); 110 void openFile( const DocLnk & );
111 void showEditTools(); 111 void showEditTools();
112 112
113 void zoomIn(); 113 void zoomIn();
114 void zoomOut(); 114 void zoomOut();
115 void setBold(bool y); 115 void setBold(bool y);
116 void setItalic(bool y); 116 void setItalic(bool y);
117 void setWordWrap(bool y); 117 void setWordWrap(bool y);
118 void setSearchBar(bool); 118 void setSearchBar(bool);
119 119
120private: 120private:
121 void openDotFile(const QString &); 121 void openDotFile(const QString &);
122 void colorChanged( const QColor &c ); 122 void colorChanged( const QColor &c );
123 void clear(); 123 void clear();
124 void updateCaption( const QString &name=QString::null ); 124 void updateCaption( const QString &name=QString::null );
125 void setFontSize(int sz, bool round_down_not_up); 125 void setFontSize(int sz, bool round_down_not_up);
126private: 126private:
127// fileSaver *fileSaveDlg; 127// fileSaver *fileSaveDlg;
128// fileBrowser *browseForFiles; 128// fileBrowser *browseForFiles;
129 bool fromSetDocument; 129 bool fromSetDocument;
130 QpeEditor* editor; 130 QpeEditor* editor;
131 QToolBar *menu, *editBar, *searchBar; 131 QToolBar *menu, *editBar, *searchBar;
132 QPopupMenu *advancedMenu; 132 QPopupMenu *advancedMenu;
133 QLineEdit *gotoEdit; 133 QLineEdit *gotoEdit;
134 QLineEdit *searchEdit; 134 QLineEdit *searchEdit;
135 DocLnk *doc; 135 DocLnk *doc;
136 bool fileIs, useAdvancedFeatures, promptExit, openDesktop, filePerms, useSearchBar, startWithNew; 136 bool fileIs, useAdvancedFeatures, promptExit, openDesktop, filePerms, useSearchBar, startWithNew;
137 bool bFromDocView; 137 bool bFromDocView;
138 int viewSelection; 138 int viewSelection;
139 QAction *zin, *zout; 139 QAction *zin, *zout;
140 QString currentFileName; 140 QString currentFileName;
141}; 141};
142 142
143#endif 143#endif
diff --git a/core/apps/textedit/textedit.pro b/core/apps/textedit/textedit.pro
index 6b77ca8..b6d8f15 100644
--- a/core/apps/textedit/textedit.pro
+++ b/core/apps/textedit/textedit.pro
@@ -1,9 +1,9 @@
1CONFIG += qt warn_on release quick-app 1CONFIG += qt warn_on release quick-app
2HEADERS = textedit.h filePermissions.h 2HEADERS = textedit.h filePermissions.h
3SOURCES = main.cpp textedit.cpp filePermissions.cpp 3SOURCES = main.cpp textedit.cpp filePermissions.cpp
4INCLUDEPATH += $(OPIEDIR)/include 4INCLUDEPATH += $(OPIEDIR)/include
5DEPENDPATH += $(OPIEDIR)/include 5DEPENDPATH += $(OPIEDIR)/include
6LIBS += -lqpe -lopie 6LIBS += -lqpe -lopiecore2 -lopieui2
7TARGET = textedit 7TARGET = textedit
8 8
9include ( $(OPIEDIR)/include.pro ) 9include ( $(OPIEDIR)/include.pro )