summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-02-28 17:52:09 (UTC)
committer llornkcor <llornkcor>2003-02-28 17:52:09 (UTC)
commitd4db61dbd748040bed740e08a839e01b86af2c87 (patch) (unidiff)
tree847f76a0d19e71d1c3213cec918153c53a43de3d
parent92c322fc6500de8c33409e0cecb25bf655bee8bc (diff)
downloadopie-d4db61dbd748040bed740e08a839e01b86af2c87.zip
opie-d4db61dbd748040bed740e08a839e01b86af2c87.tar.gz
opie-d4db61dbd748040bed740e08a839e01b86af2c87.tar.bz2
move goto menu entry
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 2f62789..797c61b 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -123,268 +123,267 @@ void QpeEditor::mouseReleaseEvent( QMouseEvent * ) {
123 123
124void QpeEditor::find ( const QString &txt, bool caseSensitive, 124void QpeEditor::find ( const QString &txt, bool caseSensitive,
125 bool backwards ) 125 bool backwards )
126{ 126{
127 static bool wrap = false; 127 static bool wrap = false;
128 int line, col; 128 int line, col;
129 if ( wrap ) { 129 if ( wrap ) {
130 if ( !backwards ) 130 if ( !backwards )
131 line = col = 0; 131 line = col = 0;
132 wrap = false; 132 wrap = false;
133 // emit searchWrapped(); 133 // emit searchWrapped();
134 } else { 134 } else {
135 getCursorPosition( &line, &col ); 135 getCursorPosition( &line, &col );
136 } 136 }
137 //ignore backwards for now.... 137 //ignore backwards for now....
138 if ( !backwards ) { 138 if ( !backwards ) {
139 for ( ; ; ) { 139 for ( ; ; ) {
140 if ( line >= numLines() ) { 140 if ( line >= numLines() ) {
141 wrap = true; 141 wrap = true;
142 //emit notFound(); 142 //emit notFound();
143 break; 143 break;
144 } 144 }
145 int findCol = getString( line )->find( txt, col, caseSensitive ); 145 int findCol = getString( line )->find( txt, col, caseSensitive );
146 if ( findCol >= 0 ) { 146 if ( findCol >= 0 ) {
147 setCursorPosition( line, findCol, false ); 147 setCursorPosition( line, findCol, false );
148 col = findCol + txt.length(); 148 col = findCol + txt.length();
149 setCursorPosition( line, col, true ); 149 setCursorPosition( line, col, true );
150 150
151 //found = true; 151 //found = true;
152 break; 152 break;
153 } 153 }
154 line++; 154 line++;
155 col = 0; 155 col = 0;
156 } 156 }
157 } 157 }
158} 158}
159 159
160 160
161#else 161#else
162 162
163#error "Must make a QpeEditor that inherits QTextEdit" 163#error "Must make a QpeEditor that inherits QTextEdit"
164 164
165#endif 165#endif
166 166
167 167
168static const int nfontsizes = 6; 168static const int nfontsizes = 6;
169static const int fontsize[nfontsizes] = {8,10,12,14,18,24}; 169static const int fontsize[nfontsizes] = {8,10,12,14,18,24};
170 170
171TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) 171TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
172 : QMainWindow( parent, name, f ), bFromDocView( false ) 172 : QMainWindow( parent, name, f ), bFromDocView( false )
173{ 173{
174 doc = 0; 174 doc = 0;
175 edited=false; 175 edited=false;
176 fromSetDocument=false; 176 fromSetDocument=false;
177 177
178 setToolBarsMovable( false ); 178 setToolBarsMovable( false );
179 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 179 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
180 180
181 channel = new QCopChannel( "QPE/Application/textedit", this ); 181 channel = new QCopChannel( "QPE/Application/textedit", this );
182 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 182 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
183 this, SLOT(receive(const QCString&, const QByteArray&)) ); 183 this, SLOT(receive(const QCString&, const QByteArray&)) );
184 184
185 setIcon( Resource::loadPixmap( "TextEditor" ) ); 185 setIcon( Resource::loadPixmap( "TextEditor" ) );
186 186
187 QPEToolBar *bar = new QPEToolBar( this ); 187 QPEToolBar *bar = new QPEToolBar( this );
188 bar->setHorizontalStretchable( true ); 188 bar->setHorizontalStretchable( true );
189 menu = bar; 189 menu = bar;
190 190
191 QPEMenuBar *mb = new QPEMenuBar( bar ); 191 QPEMenuBar *mb = new QPEMenuBar( bar );
192 QPopupMenu *file = new QPopupMenu( this ); 192 QPopupMenu *file = new QPopupMenu( this );
193 QPopupMenu *edit = new QPopupMenu( this ); 193 QPopupMenu *edit = new QPopupMenu( this );
194 QPopupMenu *advancedMenu = new QPopupMenu(this); 194 QPopupMenu *advancedMenu = new QPopupMenu(this);
195 195
196 font = new QPopupMenu( this ); 196 font = new QPopupMenu( this );
197 197
198 bar = new QPEToolBar( this ); 198 bar = new QPEToolBar( this );
199 editBar = bar; 199 editBar = bar;
200 200
201 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), 201 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ),
202 QString::null, 0, this, 0 ); 202 QString::null, 0, this, 0 );
203 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 203 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
204// a->addTo( bar ); 204// a->addTo( bar );
205 a->addTo( file ); 205 a->addTo( file );
206 206
207 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), 207 a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ),
208 QString::null, 0, this, 0 ); 208 QString::null, 0, this, 0 );
209 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); 209 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
210 a->addTo( bar ); 210 a->addTo( bar );
211 a->addTo( file ); 211 a->addTo( file );
212 212
213 a = new QAction( tr( "Save" ), QPixmap(( const char** ) filesave_xpm ) , 213 a = new QAction( tr( "Save" ), QPixmap(( const char** ) filesave_xpm ) ,
214 QString::null, 0, this, 0 ); 214 QString::null, 0, this, 0 );
215 connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); 215 connect( a, SIGNAL( activated() ), this, SLOT( save() ) );
216 file->insertSeparator(); 216 file->insertSeparator();
217 a->addTo( bar ); 217 a->addTo( bar );
218 a->addTo( file ); 218 a->addTo( file );
219 219
220 a = new QAction( tr( "Save As" ), QPixmap(( const char** ) filesave_xpm ) , 220 a = new QAction( tr( "Save As" ), QPixmap(( const char** ) filesave_xpm ) ,
221 QString::null, 0, this, 0 ); 221 QString::null, 0, this, 0 );
222 connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) ); 222 connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) );
223 a->addTo( file ); 223 a->addTo( file );
224 224
225 a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), 225 a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ),
226 QString::null, 0, this, 0 ); 226 QString::null, 0, this, 0 );
227 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); 227 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
228 a->addTo( editBar ); 228 a->addTo( editBar );
229 a->addTo( edit ); 229 a->addTo( edit );
230 230
231 a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), 231 a = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ),
232 QString::null, 0, this, 0 ); 232 QString::null, 0, this, 0 );
233 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) ); 233 connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
234 a->addTo( editBar ); 234 a->addTo( editBar );
235 a->addTo( edit ); 235 a->addTo( edit );
236 236
237 a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), 237 a = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ),
238 QString::null, 0, this, 0 ); 238 QString::null, 0, this, 0 );
239 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) ); 239 connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
240 a->addTo( editBar ); 240 a->addTo( editBar );
241 a->addTo( edit ); 241 a->addTo( edit );
242 242
243 243
244#ifndef QT_NO_CLIPBOARD 244#ifndef QT_NO_CLIPBOARD
245 a = new QAction( tr( "Insert Time and Date" ), Resource::loadPixmap( "paste" ), 245 a = new QAction( tr( "Insert Time and Date" ), Resource::loadPixmap( "paste" ),
246 QString::null, 0, this, 0 ); 246 QString::null, 0, this, 0 );
247 connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) ); 247 connect( a, SIGNAL( activated() ), this, SLOT( editPasteTimeDate() ) );
248 a->addTo( edit ); 248 a->addTo( edit );
249#endif 249#endif
250 250
251 a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ),
252 QString::null, 0, this, 0 );
253 connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) );
254 edit->insertSeparator();
255 a->addTo( bar );
256 a->addTo( edit );
257
258 a = new QAction( tr( "Goto Line..." ), Resource::loadPixmap( "find" ), 251 a = new QAction( tr( "Goto Line..." ), Resource::loadPixmap( "find" ),
259 QString::null, 0, this, 0 ); 252 QString::null, 0, this, 0 );
260 connect( a, SIGNAL( activated() ), this, SLOT( gotoLine() ) ); 253 connect( a, SIGNAL( activated() ), this, SLOT( gotoLine() ) );
254 edit->insertSeparator();
261 a->addTo( edit ); 255 a->addTo( edit );
262 256
257 a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ),
258 QString::null, 0, this, 0 );
259 connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) );
260 a->addTo( bar );
261 a->addTo( edit );
263 262
264 zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 ); 263 zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 );
265 connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) ); 264 connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) );
266 zin->addTo( font ); 265 zin->addTo( font );
267 266
268 zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 ); 267 zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 );
269 connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) ); 268 connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) );
270 zout->addTo( font ); 269 zout->addTo( font );
271 270
272 font->insertSeparator(); 271 font->insertSeparator();
273 272
274 font->insertItem(tr("Font"), this, SLOT(changeFont()) ); 273 font->insertItem(tr("Font"), this, SLOT(changeFont()) );
275 274
276 font->insertSeparator(); 275 font->insertSeparator();
277 font->insertItem(tr("Advanced Features"), advancedMenu); 276 font->insertItem(tr("Advanced Features"), advancedMenu);
278 277
279 QAction *wa = new QAction( tr("Wrap lines"), 278 QAction *wa = new QAction( tr("Wrap lines"),
280 QString::null, 0, this, 0 ); 279 QString::null, 0, this, 0 );
281 connect( wa, SIGNAL( toggled(bool) ), 280 connect( wa, SIGNAL( toggled(bool) ),
282 this, SLOT( setWordWrap(bool) ) ); 281 this, SLOT( setWordWrap(bool) ) );
283 wa->setToggleAction(true); 282 wa->setToggleAction(true);
284 wa->addTo( advancedMenu); 283 wa->addTo( advancedMenu);
285 284
286 nStart = new QAction( tr("Start with new file"), 285 nStart = new QAction( tr("Start with new file"),
287 QString::null, 0, this, 0 ); 286 QString::null, 0, this, 0 );
288 connect( nStart, SIGNAL( toggled(bool) ), 287 connect( nStart, SIGNAL( toggled(bool) ),
289 this, SLOT( changeStartConfig(bool) ) ); 288 this, SLOT( changeStartConfig(bool) ) );
290 nStart->setToggleAction(true); 289 nStart->setToggleAction(true);
291 nStart->addTo( advancedMenu ); 290 nStart->addTo( advancedMenu );
292 nStart->setEnabled(false); 291 nStart->setEnabled(false);
293 292
294 nAdvanced = new QAction( tr("Prompt on Exit"), 293 nAdvanced = new QAction( tr("Prompt on Exit"),
295 QString::null, 0, this, 0 ); 294 QString::null, 0, this, 0 );
296 connect( nAdvanced, SIGNAL( toggled(bool) ), 295 connect( nAdvanced, SIGNAL( toggled(bool) ),
297 this, SLOT( doPrompt(bool) ) ); 296 this, SLOT( doPrompt(bool) ) );
298 nAdvanced->setToggleAction(true); 297 nAdvanced->setToggleAction(true);
299 nAdvanced->addTo( advancedMenu ); 298 nAdvanced->addTo( advancedMenu );
300 299
301 desktopAction = new QAction( tr("Always open linked file"), 300 desktopAction = new QAction( tr("Always open linked file"),
302 QString::null, 0, this, 0 ); 301 QString::null, 0, this, 0 );
303 connect( desktopAction, SIGNAL( toggled(bool) ), 302 connect( desktopAction, SIGNAL( toggled(bool) ),
304 this, SLOT( doDesktop(bool) ) ); 303 this, SLOT( doDesktop(bool) ) );
305 desktopAction->setToggleAction(true); 304 desktopAction->setToggleAction(true);
306 desktopAction->addTo( advancedMenu); 305 desktopAction->addTo( advancedMenu);
307 306
308 filePermAction = new QAction( tr("File Permissions"), 307 filePermAction = new QAction( tr("File Permissions"),
309 QString::null, 0, this, 0 ); 308 QString::null, 0, this, 0 );
310 connect( filePermAction, SIGNAL( toggled(bool) ), 309 connect( filePermAction, SIGNAL( toggled(bool) ),
311 this, SLOT( doFilePerms(bool) ) ); 310 this, SLOT( doFilePerms(bool) ) );
312 filePermAction->setToggleAction(true); 311 filePermAction->setToggleAction(true);
313 filePermAction->addTo( advancedMenu); 312 filePermAction->addTo( advancedMenu);
314 313
315 searchBarAction = new QAction( tr("Search Bar Open"), 314 searchBarAction = new QAction( tr("Search Bar Open"),
316 QString::null, 0, this, 0 ); 315 QString::null, 0, this, 0 );
317 connect( searchBarAction, SIGNAL( toggled(bool) ), 316 connect( searchBarAction, SIGNAL( toggled(bool) ),
318 this, SLOT( setSearchBar(bool) ) ); 317 this, SLOT( setSearchBar(bool) ) );
319 searchBarAction->setToggleAction(true); 318 searchBarAction->setToggleAction(true);
320 searchBarAction->addTo( advancedMenu); 319 searchBarAction->addTo( advancedMenu);
321 320
322 nAutoSave = new QAction( tr("Auto Save 5 min."), 321 nAutoSave = new QAction( tr("Auto Save 5 min."),
323 QString::null, 0, this, 0 ); 322 QString::null, 0, this, 0 );
324 connect( nAutoSave, SIGNAL( toggled(bool) ), 323 connect( nAutoSave, SIGNAL( toggled(bool) ),
325 this, SLOT( doTimer(bool) ) ); 324 this, SLOT( doTimer(bool) ) );
326 nAutoSave->setToggleAction(true); 325 nAutoSave->setToggleAction(true);
327 nAutoSave->addTo( advancedMenu); 326 nAutoSave->addTo( advancedMenu);
328 327
329 328
330 font->insertSeparator(); 329 font->insertSeparator();
331 330
332 font->insertItem(tr("About"), this, SLOT( doAbout()) ); 331 font->insertItem(tr("About"), this, SLOT( doAbout()) );
333 332
334 mb->insertItem( tr( "File" ), file ); 333 mb->insertItem( tr( "File" ), file );
335 mb->insertItem( tr( "Edit" ), edit ); 334 mb->insertItem( tr( "Edit" ), edit );
336 mb->insertItem( tr( "View" ), font ); 335 mb->insertItem( tr( "View" ), font );
337 336
338 searchBar = new QPEToolBar(this); 337 searchBar = new QPEToolBar(this);
339 addToolBar( searchBar, "Search", QMainWindow::Top, true ); 338 addToolBar( searchBar, "Search", QMainWindow::Top, true );
340 339
341 searchBar->setHorizontalStretchable( true ); 340 searchBar->setHorizontalStretchable( true );
342 341
343 searchEdit = new QLineEdit( searchBar, "searchEdit" ); 342 searchEdit = new QLineEdit( searchBar, "searchEdit" );
344 searchBar->setStretchableWidget( searchEdit ); 343 searchBar->setStretchableWidget( searchEdit );
345 connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 344 connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
346 this, SLOT( search() ) ); 345 this, SLOT( search() ) );
347 346
348 a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), 347 a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ),
349 QString::null, 0, this, 0 ); 348 QString::null, 0, this, 0 );
350 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); 349 connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) );
351 a->addTo( searchBar ); 350 a->addTo( searchBar );
352 a->addTo( edit ); 351 a->addTo( edit );
353 352
354 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), 353 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ),
355 QString::null, 0, this, 0 ); 354 QString::null, 0, this, 0 );
356 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 355 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
357 a->addTo( searchBar ); 356 a->addTo( searchBar );
358 357
359 edit->insertSeparator(); 358 edit->insertSeparator();
360 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), 359 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ),
361 QString::null, 0, this, 0 ); 360 QString::null, 0, this, 0 );
362 connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); 361 connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) );
363 a->addTo( edit ); 362 a->addTo( edit );
364 363
365 searchBar->hide(); 364 searchBar->hide();
366 365
367 editor = new QpeEditor( this ); 366 editor = new QpeEditor( this );
368 setCentralWidget( editor ); 367 setCentralWidget( editor );
369 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 368 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken );
370 connect( editor, SIGNAL( textChanged() ), 369 connect( editor, SIGNAL( textChanged() ),
371 this, SLOT( editorChanged() ) ); 370 this, SLOT( editorChanged() ) );
372 371
373 QPEApplication::setStylusOperation( editor, QPEApplication::RightOnHold); 372 QPEApplication::setStylusOperation( editor, QPEApplication::RightOnHold);
374 373
375 Config cfg("TextEdit"); 374 Config cfg("TextEdit");
376 cfg. setGroup ( "Font" ); 375 cfg. setGroup ( "Font" );
377 376
378 QFont defaultFont = editor-> font ( ); 377 QFont defaultFont = editor-> font ( );
379 378
380 QString family = cfg. readEntry ( "Family", defaultFont. family ( )); 379 QString family = cfg. readEntry ( "Family", defaultFont. family ( ));
381 int size = cfg. readNumEntry ( "Size", defaultFont. pointSize ( )); 380 int size = cfg. readNumEntry ( "Size", defaultFont. pointSize ( ));
382 int weight = cfg. readNumEntry ( "Weight", defaultFont. weight ( )); 381 int weight = cfg. readNumEntry ( "Weight", defaultFont. weight ( ));
383 bool italic = cfg. readBoolEntry ( "Italic", defaultFont. italic ( )); 382 bool italic = cfg. readBoolEntry ( "Italic", defaultFont. italic ( ));
384 383
385 defaultFont = QFont ( family, size, weight, italic ); 384 defaultFont = QFont ( family, size, weight, italic );
386 editor-> setFont ( defaultFont ); 385 editor-> setFont ( defaultFont );
387 386
388// updateCaption(); 387// updateCaption();
389 388
390 cfg.setGroup ( "View" ); 389 cfg.setGroup ( "View" );