author | llornkcor <llornkcor> | 2002-02-18 16:49:50 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-18 16:49:50 (UTC) |
commit | 6e03d71c0e471659e7899e6641b20c62088cf34c (patch) (unidiff) | |
tree | d1f01af7b910ed78d50ace71870e07bf6efce4d2 | |
parent | a6266fb220a61c4904e24ebf31eeefab34362e59 (diff) | |
download | opie-6e03d71c0e471659e7899e6641b20c62088cf34c.zip opie-6e03d71c0e471659e7899e6641b20c62088cf34c.tar.gz opie-6e03d71c0e471659e7899e6641b20c62088cf34c.tar.bz2 |
removed argv stuff
-rw-r--r-- | core/apps/textedit/textedit.cpp | 20 |
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 | |||
@@ -263,17 +263,16 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
263 | // a->addTo( bar ); | 263 | // a->addTo( bar ); |
264 | a->addTo( file ); | 264 | a->addTo( file ); |
265 | 265 | ||
266 | a = new QAction( tr( "Browse" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); | 266 | a = new QAction( tr( "Browse" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); |
267 | connect( a, SIGNAL( activated() ), this, SLOT( newFileOpen() ) ); | 267 | connect( a, SIGNAL( activated() ), this, SLOT( newFileOpen() ) ); |
268 | a->addTo( bar ); | 268 | a->addTo( bar ); |
269 | a->addTo( file ); | 269 | a->addTo( file ); |
270 | 270 | ||
271 | // | ||
272 | a = new QAction( tr( "Save" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); | 271 | a = new QAction( tr( "Save" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); |
273 | connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); | 272 | connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); |
274 | // a->addTo( bar ); | 273 | // a->addTo( bar ); |
275 | file->insertSeparator(); | 274 | file->insertSeparator(); |
276 | a->addTo( file ); | 275 | a->addTo( file ); |
277 | 276 | ||
278 | a = new QAction( tr( "Save As" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); | 277 | a = new QAction( tr( "Save As" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); |
279 | connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) ); | 278 | connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) ); |
@@ -399,26 +398,18 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
399 | int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); | 398 | int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); |
400 | QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); | 399 | QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); |
401 | 400 | ||
402 | defaultFont = fdb.font(family,style,i_size,charSet); | 401 | defaultFont = fdb.font(family,style,i_size,charSet); |
403 | editor->setFont( defaultFont); | 402 | editor->setFont( defaultFont); |
404 | 403 | ||
405 | wa->setOn(wrap); | 404 | wa->setOn(wrap); |
406 | updateCaption(); | 405 | updateCaption(); |
407 | if( qApp->argc() > 1 ) { | 406 | |
408 | for (int i=1;i< qApp->argc();i++) { | 407 | fileNew(); |
409 | QString tmp; | ||
410 | currentFileName = tmp.sprintf("%s",qApp->argv()[i]); | ||
411 | qDebug(currentFileName); | ||
412 | setDocument( currentFileName ); | ||
413 | } | ||
414 | } | ||
415 | else | ||
416 | fileNew(); | ||
417 | } | 408 | } |
418 | 409 | ||
419 | TextEdit::~TextEdit() | 410 | TextEdit::~TextEdit() |
420 | { | 411 | { |
421 | saveAs(); | 412 | saveAs(); |
422 | 413 | ||
423 | Config cfg("TextEdit"); | 414 | Config cfg("TextEdit"); |
424 | cfg.setGroup("View"); | 415 | cfg.setGroup("View"); |
@@ -621,17 +612,17 @@ void TextEdit::newFile( const DocLnk &f ) | |||
621 | { | 612 | { |
622 | DocLnk nf = f; | 613 | DocLnk nf = f; |
623 | nf.setType("text/plain"); | 614 | nf.setType("text/plain"); |
624 | clear(); | 615 | clear(); |
625 | editorStack->raiseWidget( editor ); | 616 | editorStack->raiseWidget( editor ); |
626 | setWState (WState_Reserved1 ); | 617 | setWState (WState_Reserved1 ); |
627 | editor->setFocus(); | 618 | editor->setFocus(); |
628 | doc = new DocLnk(nf); | 619 | doc = new DocLnk(nf); |
629 | // updateCaption(); | 620 | updateCaption(currentFileName); |
630 | } | 621 | } |
631 | 622 | ||
632 | void TextEdit::openFile( const QString &f ) | 623 | void TextEdit::openFile( const QString &f ) |
633 | { | 624 | { |
634 | bFromDocView = TRUE; | 625 | bFromDocView = TRUE; |
635 | DocLnk nf; | 626 | DocLnk nf; |
636 | nf.setType("text/plain"); | 627 | nf.setType("text/plain"); |
637 | nf.setFile(f); | 628 | nf.setFile(f); |
@@ -763,28 +754,29 @@ void TextEdit::clear() | |||
763 | void TextEdit::updateCaption( const QString &name ) | 754 | void TextEdit::updateCaption( const QString &name ) |
764 | { | 755 | { |
765 | if ( !doc ) | 756 | if ( !doc ) |
766 | setCaption( tr("Text Editor") ); | 757 | setCaption( tr("Text Editor") ); |
767 | else { | 758 | else { |
768 | QString s = name; | 759 | QString s = name; |
769 | if ( s.isNull() ) | 760 | if ( s.isNull() ) |
770 | s = doc->name(); | 761 | s = doc->name(); |
771 | if ( s.isEmpty() ) { | 762 | if ( s.isEmpty() ) { |
772 | s = tr( "Unnamed" ); | 763 | s = tr( "Unnamed" ); |
773 | currentFileName=s; | 764 | currentFileName=s; |
774 | } | 765 | } |
766 | |||
775 | setCaption( s + " - " + tr("Text Editor") ); | 767 | setCaption( s + " - " + tr("Text Editor") ); |
776 | } | 768 | } |
777 | } | 769 | } |
778 | 770 | ||
779 | void TextEdit::setDocument(const QString& fileref) | 771 | void TextEdit::setDocument(const QString& fileref) |
780 | { | 772 | { |
781 | bFromDocView = TRUE; | 773 | bFromDocView = TRUE; |
782 | openFile(DocLnk(fileref)); | 774 | openFile(DocLnk(fileref)); |
783 | // showEditTools(); | 775 | // showEditTools(); |
784 | } | 776 | } |
785 | 777 | ||
786 | void TextEdit::closeEvent( QCloseEvent *e ) | 778 | void TextEdit::closeEvent( QCloseEvent *e ) |
787 | { | 779 | { |
788 | if ( editorStack->visibleWidget() == fileSelector && !bFromDocView ) { | 780 | if ( editorStack->visibleWidget() == fileSelector && !bFromDocView ) { |
789 | e->ignore(); | 781 | e->ignore(); |
790 | repaint(); | 782 | repaint(); |