summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 834971a..8004771 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -259,25 +259,24 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
a->addTo( file );
a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 );
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 );
a->addTo( file );
-//
a = new QAction( tr( "Save" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( save() ) );
// a->addTo( bar );
file->insertSeparator();
a->addTo( file );
a = new QAction( tr( "Save As" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) );
a->addTo( file );
a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
@@ -395,34 +394,26 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
cfg.setGroup("Font");
QString family = cfg.readEntry("Family", fontInfo.family());
QString style = cfg.readEntry("Style", fdb.styleString(defaultFont));
int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10);
QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) );
defaultFont = fdb.font(family,style,i_size,charSet);
editor->setFont( defaultFont);
wa->setOn(wrap);
updateCaption();
- if( qApp->argc() > 1 ) {
- for (int i=1;i< qApp->argc();i++) {
- QString tmp;
- currentFileName = tmp.sprintf("%s",qApp->argv()[i]);
- qDebug(currentFileName);
- setDocument( currentFileName );
- }
- }
- else
- fileNew();
+
+ fileNew();
}
TextEdit::~TextEdit()
{
saveAs();
Config cfg("TextEdit");
cfg.setGroup("View");
QFont f = editor->font();
cfg.writeEntry("FontSize",f.pointSize());
cfg.writeEntry("Bold",f.bold());
cfg.writeEntry("Italic",f.italic());
@@ -617,25 +608,25 @@ void TextEdit::search()
editor->find( searchEdit->text(), FALSE, FALSE );
}
void TextEdit::newFile( const DocLnk &f )
{
DocLnk nf = f;
nf.setType("text/plain");
clear();
editorStack->raiseWidget( editor );
setWState (WState_Reserved1 );
editor->setFocus();
doc = new DocLnk(nf);
-// updateCaption();
+ updateCaption(currentFileName);
}
void TextEdit::openFile( const QString &f )
{
bFromDocView = TRUE;
DocLnk nf;
nf.setType("text/plain");
nf.setFile(f);
openFile(nf);
showEditTools();
// Show filename in caption
QString name = f;
@@ -759,36 +750,37 @@ void TextEdit::clear()
doc = 0;
editor->clear();
}
void TextEdit::updateCaption( const QString &name )
{
if ( !doc )
setCaption( tr("Text Editor") );
else {
QString s = name;
if ( s.isNull() )
s = doc->name();
- if ( s.isEmpty() ) {
+ if ( s.isEmpty() ) {
s = tr( "Unnamed" );
currentFileName=s;
}
+
setCaption( s + " - " + tr("Text Editor") );
}
}
void TextEdit::setDocument(const QString& fileref)
{
bFromDocView = TRUE;
- openFile(DocLnk(fileref));
+ openFile(DocLnk(fileref));
// showEditTools();
}
void TextEdit::closeEvent( QCloseEvent *e )
{
if ( editorStack->visibleWidget() == fileSelector && !bFromDocView ) {
e->ignore();
repaint();
// fileRevert();
} else {
bFromDocView = FALSE;