Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/textedit/textedit.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 55725cc..b54da34 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -142,50 +142,50 @@ void QpeEditor::find ( const QString &txt, bool caseSensitive, | |||
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | #else | 145 | #else |
146 | 146 | ||
147 | #error "Must make a QpeEditor that inherits QTextEdit" | 147 | #error "Must make a QpeEditor that inherits QTextEdit" |
148 | 148 | ||
149 | #endif | 149 | #endif |
150 | 150 | ||
151 | 151 | ||
152 | static const int nfontsizes = 6; | 152 | static const int nfontsizes = 6; |
153 | static const int fontsize[nfontsizes] = {8,10,12,14,18,24}; | 153 | static const int fontsize[nfontsizes] = {8,10,12,14,18,24}; |
154 | 154 | ||
155 | TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | 155 | TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) |
156 | : QMainWindow( parent, name, f ), bFromDocView( false ) | 156 | : QMainWindow( parent, name, f ), bFromDocView( false ) |
157 | { | 157 | { |
158 | doc = 0; | 158 | doc = 0; |
159 | edited=false; | 159 | edited=false; |
160 | fromSetDocument=false; | 160 | fromSetDocument=false; |
161 | 161 | ||
162 | setToolBarsMovable( false ); | 162 | setToolBarsMovable( false ); |
163 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 163 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
164 | 164 | ||
165 | channel = new QCopChannel( "QPE/Application/textedit", this ); | 165 | channel = new QCopChannel( "QPE/Application/textedit", this ); |
166 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 166 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
167 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 167 | this, SLOT(receive(const QCString&,const QByteArray&)) ); |
168 | 168 | ||
169 | setIcon( Resource::loadPixmap( "TextEditor" ) ); | 169 | setIcon( Resource::loadPixmap( "TextEditor" ) ); |
170 | 170 | ||
171 | QToolBar *bar = new QToolBar( this ); | 171 | QToolBar *bar = new QToolBar( this ); |
172 | bar->setHorizontalStretchable( true ); | 172 | bar->setHorizontalStretchable( true ); |
173 | menu = bar; | 173 | menu = bar; |
174 | 174 | ||
175 | QMenuBar *mb = new QMenuBar( bar ); | 175 | QMenuBar *mb = new QMenuBar( bar ); |
176 | QPopupMenu *file = new QPopupMenu( this ); | 176 | QPopupMenu *file = new QPopupMenu( this ); |
177 | QPopupMenu *edit = new QPopupMenu( this ); | 177 | QPopupMenu *edit = new QPopupMenu( this ); |
178 | QPopupMenu *advancedMenu = new QPopupMenu(this); | 178 | QPopupMenu *advancedMenu = new QPopupMenu(this); |
179 | 179 | ||
180 | font = new QPopupMenu( this ); | 180 | font = new QPopupMenu( this ); |
181 | 181 | ||
182 | bar = new QToolBar( this ); | 182 | bar = new QToolBar( this ); |
183 | editBar = bar; | 183 | editBar = bar; |
184 | 184 | ||
185 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), | 185 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), |
186 | QString::null, 0, this, 0 ); | 186 | QString::null, 0, this, 0 ); |
187 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 187 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
188 | // a->addTo( bar ); | 188 | // a->addTo( bar ); |
189 | a->addTo( file ); | 189 | a->addTo( file ); |
190 | 190 | ||
191 | a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), | 191 | a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), |
@@ -304,49 +304,49 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
304 | 304 | ||
305 | nAutoSave = new QAction( tr("Auto Save 5 min."), | 305 | nAutoSave = new QAction( tr("Auto Save 5 min."), |
306 | QString::null, 0, this, 0 ); | 306 | QString::null, 0, this, 0 ); |
307 | connect( nAutoSave, SIGNAL( toggled(bool) ), | 307 | connect( nAutoSave, SIGNAL( toggled(bool) ), |
308 | this, SLOT( doTimer(bool) ) ); | 308 | this, SLOT( doTimer(bool) ) ); |
309 | nAutoSave->setToggleAction(true); | 309 | nAutoSave->setToggleAction(true); |
310 | nAutoSave->addTo( advancedMenu); | 310 | nAutoSave->addTo( advancedMenu); |
311 | 311 | ||
312 | 312 | ||
313 | //font->insertSeparator(); | 313 | //font->insertSeparator(); |
314 | 314 | ||
315 | //font->insertItem(tr("About"), this, SLOT( doAbout()) ); | 315 | //font->insertItem(tr("About"), this, SLOT( doAbout()) ); |
316 | 316 | ||
317 | mb->insertItem( tr( "File" ), file ); | 317 | mb->insertItem( tr( "File" ), file ); |
318 | mb->insertItem( tr( "Edit" ), edit ); | 318 | mb->insertItem( tr( "Edit" ), edit ); |
319 | mb->insertItem( tr( "View" ), font ); | 319 | mb->insertItem( tr( "View" ), font ); |
320 | 320 | ||
321 | searchBar = new QToolBar(this); | 321 | searchBar = new QToolBar(this); |
322 | addToolBar( searchBar, "Search", QMainWindow::Top, true ); | 322 | addToolBar( searchBar, "Search", QMainWindow::Top, true ); |
323 | 323 | ||
324 | searchBar->setHorizontalStretchable( true ); | 324 | searchBar->setHorizontalStretchable( true ); |
325 | 325 | ||
326 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 326 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
327 | searchBar->setStretchableWidget( searchEdit ); | 327 | searchBar->setStretchableWidget( searchEdit ); |
328 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 328 | connect( searchEdit, SIGNAL( textChanged(const QString&) ), |
329 | this, SLOT( search() ) ); | 329 | this, SLOT( search() ) ); |
330 | 330 | ||
331 | a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), | 331 | a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), |
332 | QString::null, 0, this, 0 ); | 332 | QString::null, 0, this, 0 ); |
333 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); | 333 | connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) ); |
334 | a->addTo( searchBar ); | 334 | a->addTo( searchBar ); |
335 | a->addTo( edit ); | 335 | a->addTo( edit ); |
336 | 336 | ||
337 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), | 337 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), |
338 | QString::null, 0, this, 0 ); | 338 | QString::null, 0, this, 0 ); |
339 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 339 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
340 | a->addTo( searchBar ); | 340 | a->addTo( searchBar ); |
341 | 341 | ||
342 | edit->insertSeparator(); | 342 | edit->insertSeparator(); |
343 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), | 343 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), |
344 | QString::null, 0, this, 0 ); | 344 | QString::null, 0, this, 0 ); |
345 | connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); | 345 | connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) ); |
346 | a->addTo( edit ); | 346 | a->addTo( edit ); |
347 | 347 | ||
348 | searchBar->hide(); | 348 | searchBar->hide(); |
349 | 349 | ||
350 | editor = new QpeEditor( this ); | 350 | editor = new QpeEditor( this ); |
351 | setCentralWidget( editor ); | 351 | setCentralWidget( editor ); |
352 | editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 352 | editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
@@ -562,50 +562,50 @@ void TextEdit::fileOpen() { | |||
562 | map.insert(tr("Text"), text ); | 562 | map.insert(tr("Text"), text ); |
563 | text << "*"; | 563 | text << "*"; |
564 | map.insert(tr("All"), text ); | 564 | map.insert(tr("All"), text ); |
565 | QString str = OFileDialog::getOpenFileName( 2, | 565 | QString str = OFileDialog::getOpenFileName( 2, |
566 | QString::null , | 566 | QString::null , |
567 | QString::null, map); | 567 | QString::null, map); |
568 | if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) | 568 | if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) |
569 | { | 569 | { |
570 | openFile( str ); | 570 | openFile( str ); |
571 | } | 571 | } |
572 | else | 572 | else |
573 | updateCaption(); | 573 | updateCaption(); |
574 | } | 574 | } |
575 | 575 | ||
576 | void TextEdit::doSearchBar() { | 576 | void TextEdit::doSearchBar() { |
577 | if(!useSearchBar) | 577 | if(!useSearchBar) |
578 | searchBar->hide(); | 578 | searchBar->hide(); |
579 | else | 579 | else |
580 | searchBar->show(); | 580 | searchBar->show(); |
581 | } | 581 | } |
582 | 582 | ||
583 | #if 0 | 583 | #if 0 |
584 | void TextEdit::slotFind() { | 584 | void TextEdit::slotFind() { |
585 | FindDialog frmFind( tr("Text Editor"), this ); | 585 | FindDialog frmFind( tr("Text Editor"), this ); |
586 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), | 586 | connect( &frmFind, SIGNAL(signalFindClicked(const QString&,bool,bool,int)), |
587 | editor, SLOT(slotDoFind( const QString&,bool,bool))); | 587 | editor, SLOT(slotDoFind(const QString&,bool,bool))); |
588 | 588 | ||
589 | //case sensitive, backwards, [category] | 589 | //case sensitive, backwards, [category] |
590 | 590 | ||
591 | connect( editor, SIGNAL(notFound()), | 591 | connect( editor, SIGNAL(notFound()), |
592 | &frmFind, SLOT(slotNotFound()) ); | 592 | &frmFind, SLOT(slotNotFound()) ); |
593 | connect( editor, SIGNAL(searchWrapped()), | 593 | connect( editor, SIGNAL(searchWrapped()), |
594 | &frmFind, SLOT(slotWrapAround()) ); | 594 | &frmFind, SLOT(slotWrapAround()) ); |
595 | 595 | ||
596 | frmFind.exec(); | 596 | frmFind.exec(); |
597 | 597 | ||
598 | 598 | ||
599 | } | 599 | } |
600 | #endif | 600 | #endif |
601 | 601 | ||
602 | void TextEdit::fileRevert() { | 602 | void TextEdit::fileRevert() { |
603 | clear(); | 603 | clear(); |
604 | fileOpen(); | 604 | fileOpen(); |
605 | } | 605 | } |
606 | 606 | ||
607 | void TextEdit::editCut() { | 607 | void TextEdit::editCut() { |
608 | #ifndef QT_NO_CLIPBOARD | 608 | #ifndef QT_NO_CLIPBOARD |
609 | editor->cut(); | 609 | editor->cut(); |
610 | #endif | 610 | #endif |
611 | } | 611 | } |