summaryrefslogtreecommitdiff
path: root/core/apps/textedit/textedit.cpp
Side-by-side diff
Diffstat (limited to 'core/apps/textedit/textedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp108
1 files changed, 26 insertions, 82 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();
@@ -300,9 +287,8 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
- a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
- connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) );
- edit->insertSeparator();
- a->addTo( bar );
- a->addTo( edit );
+ a = new QAction( tr( "Find..." ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) );
+ edit->insertSeparator();
+ a->addTo( bar );
+ a->addTo( edit );
-
int defsize;
@@ -373,6 +359,6 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
- a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 );
- connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) );
- a->addTo( searchBar );
- a->addTo( edit );
+ a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( findNext() ) );
+ a->addTo( searchBar );
+ a->addTo( edit );
@@ -382,23 +368,13 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
- edit->insertSeparator();
- a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
- connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) );
- a->addTo( edit );
-
- searchBar->hide();
-
- editorStack = new QWidgetStack( this );
- setCentralWidget( editorStack );
+ edit->insertSeparator();
+ a = new QAction( tr( "Delete" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( editDelete() ) );
+ a->addTo( edit );
- searchVisible = FALSE;
+ searchBar->hide();
- 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;
@@ -684,6 +637,6 @@ void TextEdit::openFile( const DocLnk &f )
qDebug( "Cannot open file" );
-
+
//return;
}
-
+
fileNew();
@@ -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,11 +839,4 @@ void TextEdit::closeEvent( QCloseEvent *e )
{
- if ( editorStack->visibleWidget() == fileSelector && !bFromDocView ) {
- e->ignore();
- repaint();
-// fileRevert();
-
- } else {
- bFromDocView = FALSE;
- e->accept();
- }
+ bFromDocView = FALSE;
+ e->accept();
}