author | bipolar <bipolar> | 2002-03-03 18:33:27 (UTC) |
---|---|---|
committer | bipolar <bipolar> | 2002-03-03 18:33:27 (UTC) |
commit | 86ade8478229710d4a31d1c0604b79565935734e (patch) (unidiff) | |
tree | d8afea67cef67e151b9648b1411b7a34d677691e | |
parent | 9dfc9322b87eda3264b3b53039170c199c327e88 (diff) | |
download | opie-86ade8478229710d4a31d1c0604b79565935734e.zip opie-86ade8478229710d4a31d1c0604b79565935734e.tar.gz opie-86ade8478229710d4a31d1c0604b79565935734e.tar.bz2 |
committed by ljp (llornkcor) small change to captions.
-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 2 | ||||
-rw-r--r-- | core/apps/textedit/fileSaver.cpp | 2 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index b029e5b..8c1e962 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp | |||
@@ -1,78 +1,78 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** copyright 2001 ljp ljp@llornkcor.com | 2 | ** copyright 2001 ljp ljp@llornkcor.com |
3 | ** Created: Fri Dec 14 08:16:46 2001 | 3 | ** Created: Fri Dec 14 08:16:46 2001 |
4 | ** | 4 | ** |
5 | ** This file may be distributed and/or modified under the terms of the | 5 | ** This file may be distributed and/or modified under the terms of the |
6 | ** GNU General Public License version 2 as published by the Free Software | 6 | ** GNU General Public License version 2 as published by the Free Software |
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | 7 | ** Foundation and appearing in the file LICENSE.GPL included in the |
8 | ** packaging of this file. | 8 | ** packaging of this file. |
9 | ** | 9 | ** |
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
12 | ** | 12 | ** |
13 | ****************************************************************************/ | 13 | ****************************************************************************/ |
14 | #include "fileBrowser.h" | 14 | #include "fileBrowser.h" |
15 | #include <qpe/config.h> | 15 | #include <qpe/config.h> |
16 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
17 | 17 | ||
18 | #include <qlistview.h> | 18 | #include <qlistview.h> |
19 | #include <qpushbutton.h> | 19 | #include <qpushbutton.h> |
20 | #include <qfile.h> | 20 | #include <qfile.h> |
21 | #include <qmessagebox.h> | 21 | #include <qmessagebox.h> |
22 | #include <unistd.h> | 22 | #include <unistd.h> |
23 | 23 | ||
24 | fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter ) | 24 | fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter ) |
25 | : QDialog( parent, name, modal, fl ) | 25 | : QDialog( parent, name, modal, fl ) |
26 | { | 26 | { |
27 | if ( !name ) | 27 | if ( !name ) |
28 | setName( "fileBrowser" ); | 28 | setName( "fileBrowser" ); |
29 | resize( 240, 280 ); | 29 | resize( 240, 280 ); |
30 | setCaption(tr( "Browse for file" ) ); | 30 | setCaption(tr( name ) ); |
31 | filterStr=filter; | 31 | filterStr=filter; |
32 | 32 | ||
33 | dirLabel = new QLabel(this, "DirLabel"); | 33 | dirLabel = new QLabel(this, "DirLabel"); |
34 | dirLabel->setText(currentDir.canonicalPath()); | 34 | dirLabel->setText(currentDir.canonicalPath()); |
35 | dirLabel->setGeometry(10,20,230,15); | 35 | dirLabel->setGeometry(10,20,230,15); |
36 | 36 | ||
37 | QPushButton *homeButton; | 37 | QPushButton *homeButton; |
38 | homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton"); | 38 | homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton"); |
39 | homeButton->setGeometry(200,4,25,25); | 39 | homeButton->setGeometry(200,4,25,25); |
40 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 40 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
41 | 41 | ||
42 | ListView = new QListView( this, "ListView" ); | 42 | ListView = new QListView( this, "ListView" ); |
43 | ListView->addColumn( tr( "Name" ) ); | 43 | ListView->addColumn( tr( "Name" ) ); |
44 | ListView->setColumnWidth(0,140); | 44 | ListView->setColumnWidth(0,140); |
45 | ListView->setSorting( 2, FALSE); | 45 | ListView->setSorting( 2, FALSE); |
46 | ListView->addColumn( tr( "Size" ) ); | 46 | ListView->addColumn( tr( "Size" ) ); |
47 | ListView->setColumnWidth(1,59); | 47 | ListView->setColumnWidth(1,59); |
48 | // ListView->addColumn( tr( "" ) ); | 48 | // ListView->addColumn( tr( "" ) ); |
49 | ListView->setColumnWidthMode(0,QListView::Manual); | 49 | ListView->setColumnWidthMode(0,QListView::Manual); |
50 | ListView->setColumnAlignment(1,QListView::AlignRight); | 50 | ListView->setColumnAlignment(1,QListView::AlignRight); |
51 | // ListView->setMultiSelection(true); | 51 | // ListView->setMultiSelection(true); |
52 | // ListView->setSelectionMode(QListView::Extended); | 52 | // ListView->setSelectionMode(QListView::Extended); |
53 | 53 | ||
54 | ListView->setAllColumnsShowFocus( TRUE ); | 54 | ListView->setAllColumnsShowFocus( TRUE ); |
55 | ListView->setGeometry( QRect( 10, 35, 220, 240 ) ); | 55 | ListView->setGeometry( QRect( 10, 35, 220, 240 ) ); |
56 | 56 | ||
57 | // signals and slots connections | 57 | // signals and slots connections |
58 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); | 58 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); |
59 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 59 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
60 | currentDir.setPath(QDir::currentDirPath()); | 60 | currentDir.setPath(QDir::currentDirPath()); |
61 | populateList(); | 61 | populateList(); |
62 | move(0,15); | 62 | move(0,15); |
63 | } | 63 | } |
64 | 64 | ||
65 | fileBrowser::~fileBrowser() | 65 | fileBrowser::~fileBrowser() |
66 | { | 66 | { |
67 | } | 67 | } |
68 | 68 | ||
69 | 69 | ||
70 | void fileBrowser::populateList() | 70 | void fileBrowser::populateList() |
71 | { | 71 | { |
72 | ListView->clear(); | 72 | ListView->clear(); |
73 | //qDebug(currentDir.canonicalPath()); | 73 | //qDebug(currentDir.canonicalPath()); |
74 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 74 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
75 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 75 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
76 | currentDir.setMatchAllDirs(TRUE); | 76 | currentDir.setMatchAllDirs(TRUE); |
77 | 77 | ||
78 | currentDir.setNameFilter(filterStr); | 78 | currentDir.setNameFilter(filterStr); |
diff --git a/core/apps/textedit/fileSaver.cpp b/core/apps/textedit/fileSaver.cpp index f3be914..d78f2e8 100644 --- a/core/apps/textedit/fileSaver.cpp +++ b/core/apps/textedit/fileSaver.cpp | |||
@@ -1,82 +1,82 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** copyright 2001 ljp ljp@llornkcor.com | 2 | ** copyright 2001 ljp ljp@llornkcor.com |
3 | ** Created: Fri Dec 14 08:16:46 2001 fileSaver.cpp | 3 | ** Created: Fri Dec 14 08:16:46 2001 fileSaver.cpp |
4 | ** | 4 | ** |
5 | ** This file may be distributed and/or modified under the terms of the | 5 | ** This file may be distributed and/or modified under the terms of the |
6 | ** GNU General Public License version 2 as published by the Free Software | 6 | ** GNU General Public License version 2 as published by the Free Software |
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | 7 | ** Foundation and appearing in the file LICENSE.GPL included in the |
8 | ** packaging of this file. | 8 | ** packaging of this file. |
9 | ** | 9 | ** |
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
12 | ** | 12 | ** |
13 | ****************************************************************************/ | 13 | ****************************************************************************/ |
14 | #include "fileSaver.h" | 14 | #include "fileSaver.h" |
15 | #include <qpe/config.h> | 15 | #include <qpe/config.h> |
16 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
17 | 17 | ||
18 | #include <qpe/qpeapplication.h> | 18 | #include <qpe/qpeapplication.h> |
19 | #include <qlistview.h> | 19 | #include <qlistview.h> |
20 | #include <qpushbutton.h> | 20 | #include <qpushbutton.h> |
21 | #include <qfile.h> | 21 | #include <qfile.h> |
22 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
23 | #include <qlineedit.h> | 23 | #include <qlineedit.h> |
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | 25 | ||
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | 27 | ||
28 | fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl , const QString currentFileName ) | 28 | fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl , const QString currentFileName ) |
29 | : QDialog( parent, name, modal, fl ) | 29 | : QDialog( parent, name, modal, fl ) |
30 | { | 30 | { |
31 | if ( !name ) | 31 | if ( !name ) |
32 | setName( "fileSaver" ); | 32 | setName( "fileSaver" ); |
33 | resize( 240, 280 ); | 33 | resize( 240, 280 ); |
34 | setCaption(tr( "Save file" ) ); | 34 | setCaption(tr( name ) ); |
35 | QFileInfo fi(currentFileName); | 35 | QFileInfo fi(currentFileName); |
36 | QString tmpFileName=fi.fileName(); | 36 | QString tmpFileName=fi.fileName(); |
37 | // qDebug( tmpFileName); | 37 | // qDebug( tmpFileName); |
38 | dirLabel = new QLabel(this, "DirLabel"); | 38 | dirLabel = new QLabel(this, "DirLabel"); |
39 | dirLabel->setText(currentDir.canonicalPath()); | 39 | dirLabel->setText(currentDir.canonicalPath()); |
40 | dirLabel->setGeometry(10,20,230,15); | 40 | dirLabel->setGeometry(10,20,230,15); |
41 | 41 | ||
42 | QPushButton *homeButton; | 42 | QPushButton *homeButton; |
43 | homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton"); | 43 | homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton"); |
44 | homeButton->setGeometry(200,4,25,25); | 44 | homeButton->setGeometry(200,4,25,25); |
45 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 45 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); |
46 | 46 | ||
47 | ListView = new QListView( this, "ListView" ); | 47 | ListView = new QListView( this, "ListView" ); |
48 | ListView->addColumn( tr( "Name" ) ); | 48 | ListView->addColumn( tr( "Name" ) ); |
49 | ListView->setColumnWidth(0,140); | 49 | ListView->setColumnWidth(0,140); |
50 | ListView->setSorting( 2, FALSE); | 50 | ListView->setSorting( 2, FALSE); |
51 | ListView->addColumn( tr( "Size" ) ); | 51 | ListView->addColumn( tr( "Size" ) ); |
52 | ListView->setColumnWidth(1,59); | 52 | ListView->setColumnWidth(1,59); |
53 | ListView->setColumnWidthMode(0,QListView::Manual); | 53 | ListView->setColumnWidthMode(0,QListView::Manual); |
54 | ListView->setColumnAlignment(1,QListView::AlignRight); | 54 | ListView->setColumnAlignment(1,QListView::AlignRight); |
55 | // ListView->setMultiSelection(true); | 55 | // ListView->setMultiSelection(true); |
56 | // ListView->setSelectionMode(QListView::Extended); | 56 | // ListView->setSelectionMode(QListView::Extended); |
57 | 57 | ||
58 | ListView->setAllColumnsShowFocus( TRUE ); | 58 | ListView->setAllColumnsShowFocus( TRUE ); |
59 | ListView->setGeometry( QRect( 10,35,220,125)); | 59 | ListView->setGeometry( QRect( 10,35,220,125)); |
60 | 60 | ||
61 | fileEdit= new QLineEdit(this); | 61 | fileEdit= new QLineEdit(this); |
62 | fileEdit->setGeometry( QRect( 10, 162, 205, 17)); | 62 | fileEdit->setGeometry( QRect( 10, 162, 205, 17)); |
63 | 63 | ||
64 | fileEdit->setText( tmpFileName); | 64 | fileEdit->setText( tmpFileName); |
65 | 65 | ||
66 | filePermCheck = new QCheckBox( this, "SetFilePerms" ); | 66 | filePermCheck = new QCheckBox( this, "SetFilePerms" ); |
67 | filePermCheck->setText("set file permissions"); | 67 | filePermCheck->setText("set file permissions"); |
68 | filePermCheck->setGeometry(10, 178, 150,17); | 68 | filePermCheck->setGeometry(10, 178, 150,17); |
69 | // signals and slots connections | 69 | // signals and slots connections |
70 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); | 70 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); |
71 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 71 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
72 | 72 | ||
73 | // tmpFileName=fi.FilePath(); | 73 | // tmpFileName=fi.FilePath(); |
74 | // qDebug( tmpFileName); | 74 | // qDebug( tmpFileName); |
75 | currentDir.setPath( QDir::currentDirPath() ); | 75 | currentDir.setPath( QDir::currentDirPath() ); |
76 | populateList(); | 76 | populateList(); |
77 | move(0,15); | 77 | move(0,15); |
78 | 78 | ||
79 | } | 79 | } |
80 | 80 | ||
81 | fileSaver::~fileSaver() | 81 | fileSaver::~fileSaver() |
82 | { | 82 | { |
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 72cc4d1..f138572 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -479,97 +479,97 @@ void TextEdit::setItalic(bool y) | |||
479 | QFont f = editor->font(); | 479 | QFont f = editor->font(); |
480 | f.setItalic(y); | 480 | f.setItalic(y); |
481 | editor->setFont(f); | 481 | editor->setFont(f); |
482 | } | 482 | } |
483 | 483 | ||
484 | void TextEdit::setWordWrap(bool y) | 484 | void TextEdit::setWordWrap(bool y) |
485 | { | 485 | { |
486 | bool state = editor->edited(); | 486 | bool state = editor->edited(); |
487 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); | 487 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); |
488 | editor->setEdited( state ); | 488 | editor->setEdited( state ); |
489 | } | 489 | } |
490 | 490 | ||
491 | void TextEdit::fileNew() | 491 | void TextEdit::fileNew() |
492 | { | 492 | { |
493 | if( !bFromDocView ) { | 493 | if( !bFromDocView ) { |
494 | saveAs(); | 494 | saveAs(); |
495 | } | 495 | } |
496 | newFile(DocLnk()); | 496 | newFile(DocLnk()); |
497 | } | 497 | } |
498 | 498 | ||
499 | void TextEdit::fileOpen() | 499 | void TextEdit::fileOpen() |
500 | { | 500 | { |
501 | // if ( !save() ) { | 501 | // if ( !save() ) { |
502 | // if ( QMessageBox::critical( this, tr( "Out of space" ), | 502 | // if ( QMessageBox::critical( this, tr( "Out of space" ), |
503 | // tr( "Text Editor was unable to\n" | 503 | // tr( "Text Editor was unable to\n" |
504 | // "save your changes.\n" | 504 | // "save your changes.\n" |
505 | // "Free some space and try again.\n" | 505 | // "Free some space and try again.\n" |
506 | // "\nContinue anyway?" ), | 506 | // "\nContinue anyway?" ), |
507 | // QMessageBox::Yes|QMessageBox::Escape, | 507 | // QMessageBox::Yes|QMessageBox::Escape, |
508 | // QMessageBox::No|QMessageBox::Default ) | 508 | // QMessageBox::No|QMessageBox::Default ) |
509 | // != QMessageBox::Yes ) | 509 | // != QMessageBox::Yes ) |
510 | // return; | 510 | // return; |
511 | // else { | 511 | // else { |
512 | // delete doc; | 512 | // delete doc; |
513 | // doc = 0; | 513 | // doc = 0; |
514 | // } | 514 | // } |
515 | // } | 515 | // } |
516 | menu->hide(); | 516 | menu->hide(); |
517 | editBar->hide(); | 517 | editBar->hide(); |
518 | searchBar->hide(); | 518 | searchBar->hide(); |
519 | clearWState (WState_Reserved1 ); | 519 | clearWState (WState_Reserved1 ); |
520 | editorStack->raiseWidget( fileSelector ); | 520 | editorStack->raiseWidget( fileSelector ); |
521 | fileSelector->reread(); | 521 | fileSelector->reread(); |
522 | updateCaption(); | 522 | updateCaption(); |
523 | } | 523 | } |
524 | 524 | ||
525 | void TextEdit::newFileOpen() | 525 | void TextEdit::newFileOpen() |
526 | { | 526 | { |
527 | browseForFiles=new fileBrowser(this,"fileBrowser",TRUE,0, "*"); | 527 | browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "*"); |
528 | if( browseForFiles->exec() != -1 ) { | 528 | if( browseForFiles->exec() != -1 ) { |
529 | QString selFile= browseForFiles->selectedFileName; | 529 | QString selFile= browseForFiles->selectedFileName; |
530 | QStringList fileList=browseForFiles->fileList; | 530 | QStringList fileList=browseForFiles->fileList; |
531 | qDebug(selFile); | 531 | qDebug(selFile); |
532 | QStringList::ConstIterator f; | 532 | QStringList::ConstIterator f; |
533 | QString fileTemp; | 533 | QString fileTemp; |
534 | for ( f = fileList.begin(); f != fileList.end(); f++ ) { | 534 | for ( f = fileList.begin(); f != fileList.end(); f++ ) { |
535 | fileTemp = *f; | 535 | fileTemp = *f; |
536 | fileTemp.right( fileTemp.length()-5); | 536 | fileTemp.right( fileTemp.length()-5); |
537 | QString fileName = fileTemp; | 537 | QString fileName = fileTemp; |
538 | if( fileName != "Unnamed" || fileName != "Empty Text" ) { | 538 | if( fileName != "Unnamed" || fileName != "Empty Text" ) { |
539 | currentFileName = fileName; | 539 | currentFileName = fileName; |
540 | qDebug("please open "+currentFileName); | 540 | qDebug("please open "+currentFileName); |
541 | openFile(fileName ); | 541 | openFile(fileName ); |
542 | } | 542 | } |
543 | } | 543 | } |
544 | } | 544 | } |
545 | delete browseForFiles; | 545 | delete browseForFiles; |
546 | editor->setEdited( true ); | 546 | editor->setEdited( true ); |
547 | } | 547 | } |
548 | 548 | ||
549 | #if 0 | 549 | #if 0 |
550 | void TextEdit::slotFind() | 550 | void TextEdit::slotFind() |
551 | { | 551 | { |
552 | FindDialog frmFind( "Text Editor", this ); | 552 | FindDialog frmFind( "Text Editor", this ); |
553 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), | 553 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), |
554 | editor, SLOT(slotDoFind( const QString&,bool,bool))); | 554 | editor, SLOT(slotDoFind( const QString&,bool,bool))); |
555 | 555 | ||
556 | //case sensitive, backwards, [category] | 556 | //case sensitive, backwards, [category] |
557 | 557 | ||
558 | connect( editor, SIGNAL(notFound()), | 558 | connect( editor, SIGNAL(notFound()), |
559 | &frmFind, SLOT(slotNotFound()) ); | 559 | &frmFind, SLOT(slotNotFound()) ); |
560 | connect( editor, SIGNAL(searchWrapped()), | 560 | connect( editor, SIGNAL(searchWrapped()), |
561 | &frmFind, SLOT(slotWrapAround()) ); | 561 | &frmFind, SLOT(slotWrapAround()) ); |
562 | 562 | ||
563 | frmFind.exec(); | 563 | frmFind.exec(); |
564 | 564 | ||
565 | 565 | ||
566 | } | 566 | } |
567 | #endif | 567 | #endif |
568 | 568 | ||
569 | void TextEdit::fileRevert() | 569 | void TextEdit::fileRevert() |
570 | { | 570 | { |
571 | clear(); | 571 | clear(); |
572 | fileOpen(); | 572 | fileOpen(); |
573 | } | 573 | } |
574 | 574 | ||
575 | void TextEdit::editCut() | 575 | void TextEdit::editCut() |
@@ -718,97 +718,97 @@ bool TextEdit::save() | |||
718 | chmod( file.latin1(), mode); | 718 | chmod( file.latin1(), mode); |
719 | return true; | 719 | return true; |
720 | } | 720 | } |
721 | 721 | ||
722 | /*! | 722 | /*! |
723 | prompted save */ | 723 | prompted save */ |
724 | bool TextEdit::saveAs() | 724 | bool TextEdit::saveAs() |
725 | { | 725 | { |
726 | // qDebug("saveAsFile "+currentFileName); | 726 | // qDebug("saveAsFile "+currentFileName); |
727 | 727 | ||
728 | // case of nothing to save... /// there's always something to save | 728 | // case of nothing to save... /// there's always something to save |
729 | // if ( !doc )//|| !bFromDocView) | 729 | // if ( !doc )//|| !bFromDocView) |
730 | // { | 730 | // { |
731 | // qDebug("no doc"); | 731 | // qDebug("no doc"); |
732 | // return true; | 732 | // return true; |
733 | // } | 733 | // } |
734 | if ( !editor->edited() ) { | 734 | if ( !editor->edited() ) { |
735 | delete doc; | 735 | delete doc; |
736 | doc = 0; | 736 | doc = 0; |
737 | return true; | 737 | return true; |
738 | } | 738 | } |
739 | 739 | ||
740 | QString rt = editor->text(); | 740 | QString rt = editor->text(); |
741 | qDebug(currentFileName); | 741 | qDebug(currentFileName); |
742 | 742 | ||
743 | if( currentFileName.isEmpty() || currentFileName == "Unnamed") { | 743 | if( currentFileName.isEmpty() || currentFileName == "Unnamed") { |
744 | qDebug("do silly TT filename thing"); | 744 | qDebug("do silly TT filename thing"); |
745 | if ( doc->name().isEmpty() ) { | 745 | if ( doc->name().isEmpty() ) { |
746 | QString pt = rt.simplifyWhiteSpace(); | 746 | QString pt = rt.simplifyWhiteSpace(); |
747 | int i = pt.find( ' ' ); | 747 | int i = pt.find( ' ' ); |
748 | QString docname = pt; | 748 | QString docname = pt; |
749 | if ( i > 0 ) | 749 | if ( i > 0 ) |
750 | docname = pt.left( i ); | 750 | docname = pt.left( i ); |
751 | // remove "." at the beginning | 751 | // remove "." at the beginning |
752 | while( docname.startsWith( "." ) ) | 752 | while( docname.startsWith( "." ) ) |
753 | docname = docname.mid( 1 ); | 753 | docname = docname.mid( 1 ); |
754 | docname.replace( QRegExp("/"), "_" ); | 754 | docname.replace( QRegExp("/"), "_" ); |
755 | // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. | 755 | // cut the length. filenames longer than that don't make sense and something goes wrong when they get too long. |
756 | if ( docname.length() > 40 ) | 756 | if ( docname.length() > 40 ) |
757 | docname = docname.left(40); | 757 | docname = docname.left(40); |
758 | if ( docname.isEmpty() ) | 758 | if ( docname.isEmpty() ) |
759 | docname = "Unnamed"; | 759 | docname = "Unnamed"; |
760 | doc->setName(docname); | 760 | doc->setName(docname); |
761 | currentFileName=docname; | 761 | currentFileName=docname; |
762 | } | 762 | } |
763 | } | 763 | } |
764 | 764 | ||
765 | 765 | ||
766 | fileSaveDlg=new fileSaver(this,"SaveFile",TRUE, 0, currentFileName); | 766 | fileSaveDlg=new fileSaver(this,"Save File",TRUE, 0, currentFileName); |
767 | qDebug("wanna save filename "+currentFileName); | 767 | qDebug("wanna save filename "+currentFileName); |
768 | fileSaveDlg->exec(); | 768 | fileSaveDlg->exec(); |
769 | if( fileSaveDlg->result() == 1 ) { | 769 | if( fileSaveDlg->result() == 1 ) { |
770 | QString fileNm=fileSaveDlg->selectedFileName; | 770 | QString fileNm=fileSaveDlg->selectedFileName; |
771 | qDebug("saving filename "+fileNm); | 771 | qDebug("saving filename "+fileNm); |
772 | QFileInfo fi(fileNm); | 772 | QFileInfo fi(fileNm); |
773 | currentFileName=fi.fileName(); | 773 | currentFileName=fi.fileName(); |
774 | if(doc) { | 774 | if(doc) { |
775 | qDebug("doclnk exists"); | 775 | qDebug("doclnk exists"); |
776 | // QString file = doc->file(); | 776 | // QString file = doc->file(); |
777 | // doc->removeFiles(); | 777 | // doc->removeFiles(); |
778 | delete doc; | 778 | delete doc; |
779 | DocLnk nf; | 779 | DocLnk nf; |
780 | nf.setType("text/plain"); | 780 | nf.setType("text/plain"); |
781 | nf.setFile( fileNm); | 781 | nf.setFile( fileNm); |
782 | doc = new DocLnk(nf); | 782 | doc = new DocLnk(nf); |
783 | // editor->setText(rt); | 783 | // editor->setText(rt); |
784 | qDebug("openFile doclnk "+currentFileName); | 784 | qDebug("openFile doclnk "+currentFileName); |
785 | doc->setName( currentFileName); | 785 | doc->setName( currentFileName); |
786 | updateCaption( currentFileName); | 786 | updateCaption( currentFileName); |
787 | 787 | ||
788 | FileManager fm; | 788 | FileManager fm; |
789 | if ( !fm.saveFile( *doc, rt ) ) { | 789 | if ( !fm.saveFile( *doc, rt ) ) { |
790 | return false; | 790 | return false; |
791 | } | 791 | } |
792 | if( fileSaveDlg->filePermCheck->isChecked() ) { | 792 | if( fileSaveDlg->filePermCheck->isChecked() ) { |
793 | filePermissions *filePerm; | 793 | filePermissions *filePerm; |
794 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm); | 794 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)fileNm); |
795 | filePerm->exec(); | 795 | filePerm->exec(); |
796 | editor->setEdited( false ); | 796 | editor->setEdited( false ); |
797 | if( filePerm) | 797 | if( filePerm) |
798 | delete filePerm; | 798 | delete filePerm; |
799 | } | 799 | } |
800 | } | 800 | } |
801 | } | 801 | } |
802 | 802 | ||
803 | if(fileSaveDlg) | 803 | if(fileSaveDlg) |
804 | delete fileSaveDlg; | 804 | delete fileSaveDlg; |
805 | return true; | 805 | return true; |
806 | } | 806 | } |
807 | 807 | ||
808 | void TextEdit::clear() | 808 | void TextEdit::clear() |
809 | { | 809 | { |
810 | delete doc; | 810 | delete doc; |
811 | doc = 0; | 811 | doc = 0; |
812 | editor->clear(); | 812 | editor->clear(); |
813 | } | 813 | } |
814 | 814 | ||