summaryrefslogtreecommitdiff
path: root/core/apps/textedit/textedit.cpp
Unidiff
Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp72
1 files changed, 8 insertions, 64 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 3a189cb..68ee1b4 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -51,2 +51,3 @@
51#include <qcheckbox.h> 51#include <qcheckbox.h>
52#include <qcombo.h>
52#include <unistd.h> 53#include <unistd.h>
@@ -227,10 +228,2 @@ void QpeEditor::find ( const QString &txt, bool caseSensitive,
227 228
228
229
230static int u_id = 1;
231static int get_unique_id()
232{
233 return u_id++;
234}
235
236static const int nfontsizes = 6; 229static const int nfontsizes = 6;
@@ -267,7 +260,2 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
267 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); 260 connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
268// a->addTo( bar );
269 a->addTo( file );
270
271 a = new QAction( tr( "Browse" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 );
272 connect( a, SIGNAL( activated() ), this, SLOT( newFileOpen() ) );
273 a->addTo( bar ); 261 a->addTo( bar );
@@ -277,3 +265,2 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
277 connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); 265 connect( a, SIGNAL( activated() ), this, SLOT( save() ) );
278// a->addTo( bar );
279 file->insertSeparator(); 266 file->insertSeparator();
@@ -306,3 +293,2 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
306 293
307
308 int defsize; 294 int defsize;
@@ -389,16 +375,6 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
389 375
390 editorStack = new QWidgetStack( this );
391 setCentralWidget( editorStack );
392
393 searchVisible = FALSE;
394
395 fileSelector = new FileSelector( "text/*", editorStack, "fileselector" , TRUE, TRUE); //buggy
396 connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) );
397 connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
398 connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( openFile( const DocLnk & ) ) );
399// fileOpen();
400 376
401 editor = new QpeEditor( editorStack ); 377 editor = new QpeEditor( this );
378 setCentralWidget( editor );
402 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 379 editor->setFrameStyle( QFrame::Panel | QFrame::Sunken );
403 editorStack->addWidget( editor, get_unique_id() );
404 connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); 380 connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
@@ -431,3 +407,3 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
431 } 407 }
432 408 viewSelection = cfg.readNumEntry( "FileView", 0 );
433} 409}
@@ -445,2 +421,3 @@ TextEdit::~TextEdit()
445 cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth); 421 cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth);
422 cfg.writeEntry( "FileView", viewSelection );
446} 423}
@@ -515,29 +492,4 @@ void TextEdit::fileOpen()
515{ 492{
516// if ( !save() ) {
517// if ( QMessageBox::critical( this, tr( "Out of space" ),
518// tr( "Text Editor was unable to\n"
519// "save your changes.\n"
520// "Free some space and try again.\n"
521// "\nContinue anyway?" ),
522// QMessageBox::Yes|QMessageBox::Escape,
523// QMessageBox::No|QMessageBox::Default )
524// != QMessageBox::Yes )
525// return;
526// else {
527// delete doc;
528// doc = 0;
529// }
530// }
531 menu->hide();
532 editBar->hide();
533 searchBar->hide();
534 clearWState (WState_Reserved1 );
535 editorStack->raiseWidget( fileSelector );
536 fileSelector->reread();
537 updateCaption();
538}
539
540void TextEdit::newFileOpen()
541{
542 browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "*"); 493 browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "*");
494 browseForFiles->setFileView( viewSelection );
543 browseForFiles->showMaximized(); 495 browseForFiles->showMaximized();
@@ -559,2 +511,3 @@ void TextEdit::newFileOpen()
559 } 511 }
512 viewSelection = browseForFiles->SelectionCombo->currentItem();
560 } 513 }
@@ -644,3 +597,2 @@ void TextEdit::newFile( const DocLnk &f )
644 clear(); 597 clear();
645 editorStack->raiseWidget( editor );
646 setWState (WState_Reserved1 ); 598 setWState (WState_Reserved1 );
@@ -654,2 +606,3 @@ void TextEdit::openFile( const QString &f )
654{ 606{
607
655 bFromDocView = TRUE; 608 bFromDocView = TRUE;
@@ -707,3 +660,2 @@ void TextEdit::showEditTools()
707// clear(); 660// clear();
708 fileSelector->hide();
709 menu->show(); 661 menu->show();
@@ -713,3 +665,2 @@ void TextEdit::showEditTools()
713// updateCaption(); 665// updateCaption();
714 editorStack->raiseWidget( editor );
715 setWState (WState_Reserved1 ); 666 setWState (WState_Reserved1 );
@@ -888,8 +839,2 @@ void TextEdit::closeEvent( QCloseEvent *e )
888{ 839{
889 if ( editorStack->visibleWidget() == fileSelector && !bFromDocView ) {
890 e->ignore();
891 repaint();
892// fileRevert();
893
894 } else {
895 bFromDocView = FALSE; 840 bFromDocView = FALSE;
@@ -897,3 +842,2 @@ void TextEdit::closeEvent( QCloseEvent *e )
897 } 842 }
898}
899 843