Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/apps/textedit/textedit.cpp | 72 |
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 @@ #include <qcheckbox.h> +#include <qcombo.h> #include <unistd.h> @@ -227,10 +228,2 @@ void QpeEditor::find ( const QString &txt, bool caseSensitive, - - -static int u_id = 1; -static int get_unique_id() -{ - return u_id++; -} - static const int nfontsizes = 6; @@ -267,7 +260,2 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); -// a->addTo( bar ); - a->addTo( file ); - - a = new QAction( tr( "Browse" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); - connect( a, SIGNAL( activated() ), this, SLOT( newFileOpen() ) ); a->addTo( bar ); @@ -277,3 +265,2 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); -// a->addTo( bar ); file->insertSeparator(); @@ -306,3 +293,2 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) - int defsize; @@ -389,16 +375,6 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) - editorStack = new QWidgetStack( this ); - setCentralWidget( editorStack ); - - searchVisible = FALSE; - - fileSelector = new FileSelector( "text/*", editorStack, "fileselector" , TRUE, TRUE); //buggy - connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) ); - connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); - connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( openFile( const DocLnk & ) ) ); -// fileOpen(); - editor = new QpeEditor( editorStack ); + editor = new QpeEditor( this ); + setCentralWidget( editor ); editor->setFrameStyle( QFrame::Panel | QFrame::Sunken ); - editorStack->addWidget( editor, get_unique_id() ); connect( editor, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); @@ -431,3 +407,3 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) } - + viewSelection = cfg.readNumEntry( "FileView", 0 ); } @@ -445,2 +421,3 @@ TextEdit::~TextEdit() cfg.writeEntry("Wrap",editor->wordWrap() == QMultiLineEdit::WidgetWidth); + cfg.writeEntry( "FileView", viewSelection ); } @@ -515,29 +492,4 @@ void TextEdit::fileOpen() { -// if ( !save() ) { -// if ( QMessageBox::critical( this, tr( "Out of space" ), -// tr( "Text Editor was unable to\n" -// "save your changes.\n" -// "Free some space and try again.\n" -// "\nContinue anyway?" ), -// QMessageBox::Yes|QMessageBox::Escape, -// QMessageBox::No|QMessageBox::Default ) -// != QMessageBox::Yes ) -// return; -// else { -// delete doc; -// doc = 0; -// } -// } - menu->hide(); - editBar->hide(); - searchBar->hide(); - clearWState (WState_Reserved1 ); - editorStack->raiseWidget( fileSelector ); - fileSelector->reread(); - updateCaption(); -} - -void TextEdit::newFileOpen() -{ browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "*"); + browseForFiles->setFileView( viewSelection ); browseForFiles->showMaximized(); @@ -559,2 +511,3 @@ void TextEdit::newFileOpen() } + viewSelection = browseForFiles->SelectionCombo->currentItem(); } @@ -644,3 +597,2 @@ void TextEdit::newFile( const DocLnk &f ) clear(); - editorStack->raiseWidget( editor ); setWState (WState_Reserved1 ); @@ -654,2 +606,3 @@ void TextEdit::openFile( const QString &f ) { + bFromDocView = TRUE; @@ -707,3 +660,2 @@ void TextEdit::showEditTools() // clear(); - fileSelector->hide(); menu->show(); @@ -713,3 +665,2 @@ void TextEdit::showEditTools() // updateCaption(); - editorStack->raiseWidget( editor ); setWState (WState_Reserved1 ); @@ -888,8 +839,2 @@ void TextEdit::closeEvent( QCloseEvent *e ) { - if ( editorStack->visibleWidget() == fileSelector && !bFromDocView ) { - e->ignore(); - repaint(); -// fileRevert(); - - } else { bFromDocView = FALSE; @@ -897,3 +842,2 @@ void TextEdit::closeEvent( QCloseEvent *e ) } -} |