summaryrefslogtreecommitdiff
path: root/core/apps/textedit/textedit.cpp
Unidiff
Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index b875228..0e3254f 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -1,77 +1,77 @@
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 <opie/ofileselector.h>
19#include <opie/ofiledialog.h> 19#include <opie/ofiledialog.h>
20#include <opie/ofontselector.h> 20#include <opie/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 <qpe/qpemenubar.h> 29#include <qmenubar.h>
30#include <qpe/qpetoolbar.h> 30#include <qpe/qpetoolbar.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
58#if QT_VERSION < 300 58#if QT_VERSION < 300
59 59
60class QpeEditor : public QMultiLineEdit 60class QpeEditor : public QMultiLineEdit
61{ 61{
62 62
63public: 63public:
64 QpeEditor( QWidget *parent, const char * name = 0 ) 64 QpeEditor( QWidget *parent, const char * name = 0 )
65 : QMultiLineEdit( parent, name ) { 65 : QMultiLineEdit( parent, name ) {
66 clearTableFlags(); 66 clearTableFlags();
67 setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar ); 67 setTableFlags( Tbl_vScrollBar | Tbl_autoHScrollBar );
68} 68}
69 69
70 void find( const QString &txt, bool caseSensitive, 70 void find( const QString &txt, bool caseSensitive,
71 bool backwards ); 71 bool backwards );
72protected: 72protected:
73 bool markIt; 73 bool markIt;
74 int line1, line2, col1, col2; 74 int line1, line2, col1, col2;
75 void mousePressEvent( QMouseEvent * ); 75 void mousePressEvent( QMouseEvent * );
76 void mouseReleaseEvent( QMouseEvent * ); 76 void mouseReleaseEvent( QMouseEvent * );
77 77
@@ -141,97 +141,97 @@ void QpeEditor::find ( const QString &txt, bool caseSensitive,
141 break; 141 break;
142 } 142 }
143 int findCol = getString( line )->find( txt, col, caseSensitive ); 143 int findCol = getString( line )->find( txt, col, caseSensitive );
144 if ( findCol >= 0 ) { 144 if ( findCol >= 0 ) {
145 setCursorPosition( line, findCol, false ); 145 setCursorPosition( line, findCol, false );
146 col = findCol + txt.length(); 146 col = findCol + txt.length();
147 setCursorPosition( line, col, true ); 147 setCursorPosition( line, col, true );
148 148
149 //found = true; 149 //found = true;
150 break; 150 break;
151 } 151 }
152 line++; 152 line++;
153 col = 0; 153 col = 0;
154 } 154 }
155 } 155 }
156} 156}
157 157
158 158
159#else 159#else
160 160
161#error "Must make a QpeEditor that inherits QTextEdit" 161#error "Must make a QpeEditor that inherits QTextEdit"
162 162
163#endif 163#endif
164 164
165 165
166static const int nfontsizes = 6; 166static const int nfontsizes = 6;
167static const int fontsize[nfontsizes] = {8,10,12,14,18,24}; 167static const int fontsize[nfontsizes] = {8,10,12,14,18,24};
168 168
169TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) 169TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
170 : QMainWindow( parent, name, f ), bFromDocView( false ) 170 : QMainWindow( parent, name, f ), bFromDocView( false )
171{ 171{
172 doc = 0; 172 doc = 0;
173 edited=false; 173 edited=false;
174 fromSetDocument=false; 174 fromSetDocument=false;
175 175
176 setToolBarsMovable( false ); 176 setToolBarsMovable( false );
177 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 177 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
178 178
179 channel = new QCopChannel( "QPE/Application/textedit", this ); 179 channel = new QCopChannel( "QPE/Application/textedit", this );
180 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 180 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
181 this, SLOT(receive(const QCString&, const QByteArray&)) ); 181 this, SLOT(receive(const QCString&, const QByteArray&)) );
182 182
183 setIcon( Resource::loadPixmap( "TextEditor" ) ); 183 setIcon( Resource::loadPixmap( "TextEditor" ) );
184 184
185 QPEToolBar *bar = new QPEToolBar( this ); 185 QPEToolBar *bar = new QPEToolBar( this );
186 bar->setHorizontalStretchable( true ); 186 bar->setHorizontalStretchable( true );
187 menu = bar; 187 menu = bar;
188 188
189 QPEMenuBar *mb = new QPEMenuBar( bar ); 189 QMenuBar *mb = new QMenuBar( bar );
190 QPopupMenu *file = new QPopupMenu( this ); 190 QPopupMenu *file = new QPopupMenu( this );
191 QPopupMenu *edit = new QPopupMenu( this ); 191 QPopupMenu *edit = new QPopupMenu( this );
192 QPopupMenu *advancedMenu = new QPopupMenu(this); 192 QPopupMenu *advancedMenu = new QPopupMenu(this);
193 193
194 font = new QPopupMenu( this ); 194 font = new QPopupMenu( this );
195 195
196 bar = new QPEToolBar( this ); 196 bar = new QPEToolBar( this );
197 editBar = bar; 197 editBar = bar;
198 198
199 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), 199 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ),
200 QString::null, 0, this, 0 ); 200 QString::null, 0, this, 0 );
201 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 201 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
202// a->addTo( bar ); 202// a->addTo( bar );
203 a->addTo( file ); 203 a->addTo( file );
204 204
205 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), 205 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ),
206 QString::null, 0, this, 0 ); 206 QString::null, 0, this, 0 );
207 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); 207 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
208 a->addTo( bar ); 208 a->addTo( bar );
209 a->addTo( file ); 209 a->addTo( file );
210 210
211 a = new QAction( tr( "Save" ), Resource::loadPixmap("save") , 211 a = new QAction( tr( "Save" ), Resource::loadPixmap("save") ,
212 QString::null, 0, this, 0 ); 212 QString::null, 0, this, 0 );
213 connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); 213 connect( a, SIGNAL( activated() ), this, SLOT( save() ) );
214 file->insertSeparator(); 214 file->insertSeparator();
215 a->addTo( bar ); 215 a->addTo( bar );
216 a->addTo( file ); 216 a->addTo( file );
217 217
218 a = new QAction( tr( "Save As" ), Resource::loadPixmap("save") , 218 a = new QAction( tr( "Save As" ), Resource::loadPixmap("save") ,
219 QString::null, 0, this, 0 ); 219 QString::null, 0, this, 0 );
220 connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) ); 220 connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) );
221 a->addTo( file ); 221 a->addTo( file );
222 222
223 a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), 223 a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ),
224 QString::null, 0, this, 0 ); 224 QString::null, 0, this, 0 );
225 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); 225 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
226 a->addTo( editBar ); 226 a->addTo( editBar );
227 a->addTo( edit ); 227 a->addTo( edit );
228 228
229 a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), 229 a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ),
230 QString::null, 0, this, 0 ); 230 QString::null, 0, this, 0 );
231 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); 231 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
232 a->addTo( editBar ); 232 a->addTo( editBar );
233 a->addTo( edit ); 233 a->addTo( edit );
234 234
235 a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), 235 a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ),
236 QString::null, 0, this, 0 ); 236 QString::null, 0, this, 0 );
237 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); 237 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );