author | drw <drw> | 2002-03-15 01:09:57 (UTC) |
---|---|---|
committer | drw <drw> | 2002-03-15 01:09:57 (UTC) |
commit | 320291b5006c75e3e42ba1cbbac9639a54309553 (patch) (unidiff) | |
tree | 0cfd5d74be6598c778dc94688797cf47cdf6c9d6 | |
parent | 5283a32d6d9ab9b9bccd3482ab6694c940c874d3 (diff) | |
download | opie-320291b5006c75e3e42ba1cbbac9639a54309553.zip opie-320291b5006c75e3e42ba1cbbac9639a54309553.tar.gz opie-320291b5006c75e3e42ba1cbbac9639a54309553.tar.bz2 |
Made file browser resize
-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 46 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 1 |
2 files changed, 31 insertions, 16 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index c16bd41..2e88067 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp | |||
@@ -1,174 +1,188 @@ | |||
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 | #include <qpe/qpeapplication.h> | 17 | #include <qpe/qpeapplication.h> |
18 | 18 | ||
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 <qlayout.h> | ||
23 | #include <unistd.h> | 24 | #include <unistd.h> |
24 | 25 | ||
25 | 26 | ||
26 | 27 | ||
27 | fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter ) | 28 | fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter ) |
28 | : QDialog( parent, name, modal, fl ) | 29 | : QDialog( parent, name, modal, fl ) |
29 | { | 30 | { |
30 | if ( !name ) | 31 | if ( !name ) |
31 | setName( "fileBrowser" ); | 32 | setName( "fileBrowser" ); |
32 | resize( 240, 280 ); | ||
33 | setCaption(tr( name ) ); | 33 | setCaption(tr( name ) ); |
34 | filterStr=filter; | 34 | filterStr=filter; |
35 | 35 | ||
36 | QGridLayout *layout = new QGridLayout( this ); | ||
37 | layout->setSpacing( 4 ); | ||
38 | layout->setMargin( 4 ); | ||
39 | |||
40 | |||
36 | dirLabel = new QLabel(this, "DirLabel"); | 41 | dirLabel = new QLabel(this, "DirLabel"); |
37 | dirLabel->setText(currentDir.canonicalPath()); | 42 | dirLabel->setText(currentDir.canonicalPath()); |
38 | dirLabel->setGeometry(10,20,230,15); | 43 | dirLabel->setMinimumSize( QSize( 50, 15 ) ); |
44 | dirLabel->setMaximumSize( QSize( 250, 15 ) ); | ||
45 | layout->addWidget( dirLabel, 0, 0 ); | ||
39 | 46 | ||
40 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); | 47 | hideButton = new QPushButton( Resource::loadIconSet("s_hidden"),"",this,"hideButton"); |
41 | homeButton->setGeometry(200,4,25,25); | 48 | hideButton->setMinimumSize( QSize( 25, 25 ) ); |
42 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | 49 | hideButton->setMaximumSize( QSize( 25, 25 ) ); |
43 | homeButton->setFlat(TRUE); | 50 | connect( hideButton,SIGNAL(toggled(bool)),this,SLOT( hideButtonPushed(bool)) ); |
51 | hideButton->setToggleButton(TRUE); | ||
52 | hideButton->setFlat(TRUE); | ||
53 | layout->addWidget( hideButton, 0, 1 ); | ||
44 | 54 | ||
45 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); | 55 | docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); |
46 | docButton->setGeometry(170,4,25,25); | 56 | docButton->setMinimumSize( QSize( 25, 25 ) ); |
57 | docButton->setMaximumSize( QSize( 25, 25 ) ); | ||
47 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 58 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
48 | docButton->setFlat(TRUE); | 59 | docButton->setFlat(TRUE); |
60 | layout->addWidget( docButton, 0, 2 ); | ||
61 | |||
62 | homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); | ||
63 | homeButton->setMinimumSize( QSize( 25, 25 ) ); | ||
64 | homeButton->setMaximumSize( QSize( 25, 25 ) ); | ||
65 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | ||
66 | homeButton->setFlat(TRUE); | ||
67 | layout->addWidget( homeButton, 0, 3 ); | ||
49 | 68 | ||
50 | hideButton = new QPushButton( Resource::loadIconSet("s_hidden"),"",this,"hideButton"); | ||
51 | hideButton->setGeometry(140,4,25,25); | ||
52 | connect( hideButton,SIGNAL(toggled(bool)),this,SLOT( hideButtonPushed(bool)) ); | ||
53 | hideButton->setToggleButton(TRUE); | ||
54 | hideButton->setFlat(TRUE); | ||
55 | |||
56 | ListView = new QListView( this, "ListView" ); | 69 | ListView = new QListView( this, "ListView" ); |
70 | ListView->setMinimumSize( QSize( 100, 25 ) ); | ||
57 | ListView->addColumn( tr( "Name" ) ); | 71 | ListView->addColumn( tr( "Name" ) ); |
58 | ListView->setColumnWidth(0,140); | 72 | ListView->setColumnWidth(0,140); |
59 | ListView->setSorting( 2, FALSE); | 73 | ListView->setSorting( 2, FALSE); |
60 | ListView->addColumn( tr( "Size" ) ); | 74 | ListView->addColumn( tr( "Size" ) ); |
61 | ListView->setColumnWidth(1,59); | 75 | ListView->setColumnWidth(1,59); |
62 | // ListView->addColumn( tr( "" ) ); | 76 | // ListView->addColumn( tr( "" ) ); |
63 | ListView->setColumnWidthMode(0,QListView::Manual); | 77 | ListView->setColumnWidthMode(0,QListView::Manual); |
64 | ListView->setColumnAlignment(1,QListView::AlignRight); | 78 | ListView->setColumnAlignment(1,QListView::AlignRight); |
65 | // ListView->setMultiSelection(true); | 79 | // ListView->setMultiSelection(true); |
66 | // ListView->setSelectionMode(QListView::Extended); | 80 | // ListView->setSelectionMode(QListView::Extended); |
67 | 81 | ||
68 | ListView->setAllColumnsShowFocus( TRUE ); | 82 | ListView->setAllColumnsShowFocus( TRUE ); |
69 | ListView->setGeometry( QRect( 10, 35, 220, 240 ) ); | 83 | layout->addMultiCellWidget( ListView, 1, 1, 0, 3 ); |
70 | 84 | ||
71 | // signals and slots connections | 85 | // signals and slots connections |
72 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); | 86 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); |
73 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 87 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
74 | currentDir.setPath(QDir::currentDirPath()); | 88 | currentDir.setPath(QDir::currentDirPath()); |
75 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); | 89 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); |
76 | 90 | ||
77 | populateList(); | 91 | populateList(); |
78 | move(0,15); | 92 | move(0,15); |
79 | } | 93 | } |
80 | 94 | ||
81 | fileBrowser::~fileBrowser() | 95 | fileBrowser::~fileBrowser() |
82 | { | 96 | { |
83 | } | 97 | } |
84 | 98 | ||
85 | 99 | ||
86 | void fileBrowser::populateList() | 100 | void fileBrowser::populateList() |
87 | { | 101 | { |
88 | ListView->clear(); | 102 | ListView->clear(); |
89 | //qDebug(currentDir.canonicalPath()); | 103 | //qDebug(currentDir.canonicalPath()); |
90 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 104 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
91 | currentDir.setMatchAllDirs(TRUE); | 105 | currentDir.setMatchAllDirs(TRUE); |
92 | 106 | ||
93 | currentDir.setNameFilter(filterStr); | 107 | currentDir.setNameFilter(filterStr); |
94 | // currentDir.setNameFilter("*.txt;*.etx"); | 108 | // currentDir.setNameFilter("*.txt;*.etx"); |
95 | QString fileL, fileS; | 109 | QString fileL, fileS; |
96 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 110 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
97 | QFileInfoListIterator it(*list); | 111 | QFileInfoListIterator it(*list); |
98 | QFileInfo *fi; | 112 | QFileInfo *fi; |
99 | while ( (fi=it.current()) ) { | 113 | while ( (fi=it.current()) ) { |
100 | 114 | ||
101 | if (fi->isSymLink() ){ | 115 | if (fi->isSymLink() ){ |
102 | QString symLink=fi->readLink(); | 116 | QString symLink=fi->readLink(); |
103 | // qDebug("Symlink detected "+symLink); | 117 | // qDebug("Symlink detected "+symLink); |
104 | QFileInfo sym( symLink); | 118 | QFileInfo sym( symLink); |
105 | fileS.sprintf( "%10li", sym.size() ); | 119 | fileS.sprintf( "%10li", sym.size() ); |
106 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 120 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
107 | 121 | ||
108 | } else { | 122 | } else { |
109 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 123 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
110 | fileS.sprintf( "%10li", fi->size() ); | 124 | fileS.sprintf( "%10li", fi->size() ); |
111 | fileL.sprintf( "%s",fi->fileName().data() ); | 125 | fileL.sprintf( "%s",fi->fileName().data() ); |
112 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 126 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
113 | fileL+="/"; | 127 | fileL+="/"; |
114 | // qDebug( fileL); | 128 | // qDebug( fileL); |
115 | } | 129 | } |
116 | } | 130 | } |
117 | item= new QListViewItem( ListView,fileL,fileS ); | 131 | item= new QListViewItem( ListView,fileL,fileS ); |
118 | ++it; | 132 | ++it; |
119 | } | 133 | } |
120 | ListView->setSorting( 2, FALSE); | 134 | ListView->setSorting( 2, FALSE); |
121 | dirLabel->setText(currentDir.canonicalPath()); | 135 | dirLabel->setText(currentDir.canonicalPath()); |
122 | } | 136 | } |
123 | 137 | ||
124 | void fileBrowser::upDir() | 138 | void fileBrowser::upDir() |
125 | { | 139 | { |
126 | // qDebug(currentDir.canonicalPath()); | 140 | // qDebug(currentDir.canonicalPath()); |
127 | } | 141 | } |
128 | 142 | ||
129 | void fileBrowser::listDoubleClicked(QListViewItem *selectedItem) | 143 | void fileBrowser::listDoubleClicked(QListViewItem *selectedItem) |
130 | { | 144 | { |
131 | } | 145 | } |
132 | 146 | ||
133 | // you may want to switch these 2 functions. I like single clicks | 147 | // you may want to switch these 2 functions. I like single clicks |
134 | void fileBrowser::listClicked(QListViewItem *selectedItem) | 148 | void fileBrowser::listClicked(QListViewItem *selectedItem) |
135 | { | 149 | { |
136 | QString strItem=selectedItem->text(0); | 150 | QString strItem=selectedItem->text(0); |
137 | QString strSize=selectedItem->text(1); | 151 | QString strSize=selectedItem->text(1); |
138 | // qDebug("strItem is "+strItem); | 152 | // qDebug("strItem is "+strItem); |
139 | strSize.stripWhiteSpace(); | 153 | strSize.stripWhiteSpace(); |
140 | // qDebug(strSize); | 154 | // qDebug(strSize); |
141 | 155 | ||
142 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 156 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
143 | // is symlink | 157 | // is symlink |
144 | QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4); | 158 | QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4); |
145 | // qDebug("strItem symlink is "+strItem2); | 159 | // qDebug("strItem symlink is "+strItem2); |
146 | if(QDir(strItem2).exists() ) { | 160 | if(QDir(strItem2).exists() ) { |
147 | currentDir.cd(strItem2, TRUE); | 161 | currentDir.cd(strItem2, TRUE); |
148 | populateList(); | 162 | populateList(); |
149 | } | 163 | } |
150 | } else { // not a symlink | 164 | } else { // not a symlink |
151 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 165 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
152 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 166 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
153 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 167 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
154 | currentDir.cd(strItem,FALSE); | 168 | currentDir.cd(strItem,FALSE); |
155 | // qDebug("Path is "+strItem); | 169 | // qDebug("Path is "+strItem); |
156 | populateList(); | 170 | populateList(); |
157 | } else { | 171 | } else { |
158 | currentDir.cdUp(); | 172 | currentDir.cdUp(); |
159 | populateList(); | 173 | populateList(); |
160 | } | 174 | } |
161 | if(QDir(strItem).exists()){ | 175 | if(QDir(strItem).exists()){ |
162 | currentDir.cd(strItem, TRUE); | 176 | currentDir.cd(strItem, TRUE); |
163 | populateList(); | 177 | populateList(); |
164 | } | 178 | } |
165 | } else { | 179 | } else { |
166 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 180 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
167 | if( QFile::exists(strItem ) ) { | 181 | if( QFile::exists(strItem ) ) { |
168 | //currentDir.canonicalPath() | 182 | //currentDir.canonicalPath() |
169 | qDebug("We found our files!!"+strItem); | 183 | qDebug("We found our files!!"+strItem); |
170 | OnOK(); | 184 | OnOK(); |
171 | } | 185 | } |
172 | } //end not symlink | 186 | } //end not symlink |
173 | chdir(strItem.latin1()); | 187 | chdir(strItem.latin1()); |
174 | } | 188 | } |
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index c46f089..3a189cb 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -447,192 +447,193 @@ TextEdit::~TextEdit() | |||
447 | 447 | ||
448 | void TextEdit::zoomIn() | 448 | void TextEdit::zoomIn() |
449 | { | 449 | { |
450 | setFontSize(editor->font().pointSize()+1,FALSE); | 450 | setFontSize(editor->font().pointSize()+1,FALSE); |
451 | } | 451 | } |
452 | 452 | ||
453 | void TextEdit::zoomOut() | 453 | void TextEdit::zoomOut() |
454 | { | 454 | { |
455 | setFontSize(editor->font().pointSize()-1,TRUE); | 455 | setFontSize(editor->font().pointSize()-1,TRUE); |
456 | } | 456 | } |
457 | 457 | ||
458 | 458 | ||
459 | void TextEdit::setFontSize(int sz, bool round_down_not_up) | 459 | void TextEdit::setFontSize(int sz, bool round_down_not_up) |
460 | { | 460 | { |
461 | int s=10; | 461 | int s=10; |
462 | for (int i=0; i<nfontsizes; i++) { | 462 | for (int i=0; i<nfontsizes; i++) { |
463 | if ( fontsize[i] == sz ) { | 463 | if ( fontsize[i] == sz ) { |
464 | s = sz; | 464 | s = sz; |
465 | break; | 465 | break; |
466 | } else if ( round_down_not_up ) { | 466 | } else if ( round_down_not_up ) { |
467 | if ( fontsize[i] < sz ) | 467 | if ( fontsize[i] < sz ) |
468 | s = fontsize[i]; | 468 | s = fontsize[i]; |
469 | } else { | 469 | } else { |
470 | if ( fontsize[i] > sz ) { | 470 | if ( fontsize[i] > sz ) { |
471 | s = fontsize[i]; | 471 | s = fontsize[i]; |
472 | break; | 472 | break; |
473 | } | 473 | } |
474 | } | 474 | } |
475 | } | 475 | } |
476 | 476 | ||
477 | QFont f = editor->font(); | 477 | QFont f = editor->font(); |
478 | f.setPointSize(s); | 478 | f.setPointSize(s); |
479 | editor->setFont(f); | 479 | editor->setFont(f); |
480 | 480 | ||
481 | zin->setEnabled(s != fontsize[nfontsizes-1]); | 481 | zin->setEnabled(s != fontsize[nfontsizes-1]); |
482 | zout->setEnabled(s != fontsize[0]); | 482 | zout->setEnabled(s != fontsize[0]); |
483 | } | 483 | } |
484 | 484 | ||
485 | void TextEdit::setBold(bool y) | 485 | void TextEdit::setBold(bool y) |
486 | { | 486 | { |
487 | QFont f = editor->font(); | 487 | QFont f = editor->font(); |
488 | f.setBold(y); | 488 | f.setBold(y); |
489 | editor->setFont(f); | 489 | editor->setFont(f); |
490 | } | 490 | } |
491 | 491 | ||
492 | void TextEdit::setItalic(bool y) | 492 | void TextEdit::setItalic(bool y) |
493 | { | 493 | { |
494 | QFont f = editor->font(); | 494 | QFont f = editor->font(); |
495 | f.setItalic(y); | 495 | f.setItalic(y); |
496 | editor->setFont(f); | 496 | editor->setFont(f); |
497 | } | 497 | } |
498 | 498 | ||
499 | void TextEdit::setWordWrap(bool y) | 499 | void TextEdit::setWordWrap(bool y) |
500 | { | 500 | { |
501 | bool state = editor->edited(); | 501 | bool state = editor->edited(); |
502 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); | 502 | editor->setWordWrap(y ? QMultiLineEdit::WidgetWidth : QMultiLineEdit::NoWrap ); |
503 | editor->setEdited( state ); | 503 | editor->setEdited( state ); |
504 | } | 504 | } |
505 | 505 | ||
506 | void TextEdit::fileNew() | 506 | void TextEdit::fileNew() |
507 | { | 507 | { |
508 | if( !bFromDocView ) { | 508 | if( !bFromDocView ) { |
509 | saveAs(); | 509 | saveAs(); |
510 | } | 510 | } |
511 | newFile(DocLnk()); | 511 | newFile(DocLnk()); |
512 | } | 512 | } |
513 | 513 | ||
514 | void TextEdit::fileOpen() | 514 | void TextEdit::fileOpen() |
515 | { | 515 | { |
516 | // if ( !save() ) { | 516 | // if ( !save() ) { |
517 | // if ( QMessageBox::critical( this, tr( "Out of space" ), | 517 | // if ( QMessageBox::critical( this, tr( "Out of space" ), |
518 | // tr( "Text Editor was unable to\n" | 518 | // tr( "Text Editor was unable to\n" |
519 | // "save your changes.\n" | 519 | // "save your changes.\n" |
520 | // "Free some space and try again.\n" | 520 | // "Free some space and try again.\n" |
521 | // "\nContinue anyway?" ), | 521 | // "\nContinue anyway?" ), |
522 | // QMessageBox::Yes|QMessageBox::Escape, | 522 | // QMessageBox::Yes|QMessageBox::Escape, |
523 | // QMessageBox::No|QMessageBox::Default ) | 523 | // QMessageBox::No|QMessageBox::Default ) |
524 | // != QMessageBox::Yes ) | 524 | // != QMessageBox::Yes ) |
525 | // return; | 525 | // return; |
526 | // else { | 526 | // else { |
527 | // delete doc; | 527 | // delete doc; |
528 | // doc = 0; | 528 | // doc = 0; |
529 | // } | 529 | // } |
530 | // } | 530 | // } |
531 | menu->hide(); | 531 | menu->hide(); |
532 | editBar->hide(); | 532 | editBar->hide(); |
533 | searchBar->hide(); | 533 | searchBar->hide(); |
534 | clearWState (WState_Reserved1 ); | 534 | clearWState (WState_Reserved1 ); |
535 | editorStack->raiseWidget( fileSelector ); | 535 | editorStack->raiseWidget( fileSelector ); |
536 | fileSelector->reread(); | 536 | fileSelector->reread(); |
537 | updateCaption(); | 537 | updateCaption(); |
538 | } | 538 | } |
539 | 539 | ||
540 | void TextEdit::newFileOpen() | 540 | void TextEdit::newFileOpen() |
541 | { | 541 | { |
542 | browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "*"); | 542 | browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "*"); |
543 | browseForFiles->showMaximized(); | ||
543 | if( browseForFiles->exec() != -1 ) { | 544 | if( browseForFiles->exec() != -1 ) { |
544 | QString selFile= browseForFiles->selectedFileName; | 545 | QString selFile= browseForFiles->selectedFileName; |
545 | QStringList fileList=browseForFiles->fileList; | 546 | QStringList fileList=browseForFiles->fileList; |
546 | qDebug(selFile); | 547 | qDebug(selFile); |
547 | QStringList::ConstIterator f; | 548 | QStringList::ConstIterator f; |
548 | QString fileTemp; | 549 | QString fileTemp; |
549 | for ( f = fileList.begin(); f != fileList.end(); f++ ) { | 550 | for ( f = fileList.begin(); f != fileList.end(); f++ ) { |
550 | fileTemp = *f; | 551 | fileTemp = *f; |
551 | fileTemp.right( fileTemp.length()-5); | 552 | fileTemp.right( fileTemp.length()-5); |
552 | QString fileName = fileTemp; | 553 | QString fileName = fileTemp; |
553 | if( fileName != "Unnamed" || fileName != "Empty Text" ) { | 554 | if( fileName != "Unnamed" || fileName != "Empty Text" ) { |
554 | currentFileName = fileName; | 555 | currentFileName = fileName; |
555 | qDebug("please open "+currentFileName); | 556 | qDebug("please open "+currentFileName); |
556 | openFile(fileName ); | 557 | openFile(fileName ); |
557 | } | 558 | } |
558 | } | 559 | } |
559 | } | 560 | } |
560 | delete browseForFiles; | 561 | delete browseForFiles; |
561 | editor->setEdited( FALSE); | 562 | editor->setEdited( FALSE); |
562 | edited1=FALSE; | 563 | edited1=FALSE; |
563 | edited=FALSE; | 564 | edited=FALSE; |
564 | if(caption().left(1)=="*") | 565 | if(caption().left(1)=="*") |
565 | setCaption(caption().right(caption().length()-1)); | 566 | setCaption(caption().right(caption().length()-1)); |
566 | } | 567 | } |
567 | 568 | ||
568 | #if 0 | 569 | #if 0 |
569 | void TextEdit::slotFind() | 570 | void TextEdit::slotFind() |
570 | { | 571 | { |
571 | FindDialog frmFind( "Text Editor", this ); | 572 | FindDialog frmFind( "Text Editor", this ); |
572 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), | 573 | connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), |
573 | editor, SLOT(slotDoFind( const QString&,bool,bool))); | 574 | editor, SLOT(slotDoFind( const QString&,bool,bool))); |
574 | 575 | ||
575 | //case sensitive, backwards, [category] | 576 | //case sensitive, backwards, [category] |
576 | 577 | ||
577 | connect( editor, SIGNAL(notFound()), | 578 | connect( editor, SIGNAL(notFound()), |
578 | &frmFind, SLOT(slotNotFound()) ); | 579 | &frmFind, SLOT(slotNotFound()) ); |
579 | connect( editor, SIGNAL(searchWrapped()), | 580 | connect( editor, SIGNAL(searchWrapped()), |
580 | &frmFind, SLOT(slotWrapAround()) ); | 581 | &frmFind, SLOT(slotWrapAround()) ); |
581 | 582 | ||
582 | frmFind.exec(); | 583 | frmFind.exec(); |
583 | 584 | ||
584 | 585 | ||
585 | } | 586 | } |
586 | #endif | 587 | #endif |
587 | 588 | ||
588 | void TextEdit::fileRevert() | 589 | void TextEdit::fileRevert() |
589 | { | 590 | { |
590 | clear(); | 591 | clear(); |
591 | fileOpen(); | 592 | fileOpen(); |
592 | } | 593 | } |
593 | 594 | ||
594 | void TextEdit::editCut() | 595 | void TextEdit::editCut() |
595 | { | 596 | { |
596 | #ifndef QT_NO_CLIPBOARD | 597 | #ifndef QT_NO_CLIPBOARD |
597 | editor->cut(); | 598 | editor->cut(); |
598 | #endif | 599 | #endif |
599 | } | 600 | } |
600 | 601 | ||
601 | void TextEdit::editCopy() | 602 | void TextEdit::editCopy() |
602 | { | 603 | { |
603 | #ifndef QT_NO_CLIPBOARD | 604 | #ifndef QT_NO_CLIPBOARD |
604 | editor->copy(); | 605 | editor->copy(); |
605 | #endif | 606 | #endif |
606 | } | 607 | } |
607 | 608 | ||
608 | void TextEdit::editPaste() | 609 | void TextEdit::editPaste() |
609 | { | 610 | { |
610 | #ifndef QT_NO_CLIPBOARD | 611 | #ifndef QT_NO_CLIPBOARD |
611 | editor->paste(); | 612 | editor->paste(); |
612 | #endif | 613 | #endif |
613 | } | 614 | } |
614 | 615 | ||
615 | void TextEdit::editFind() | 616 | void TextEdit::editFind() |
616 | { | 617 | { |
617 | searchBar->show(); | 618 | searchBar->show(); |
618 | searchVisible = TRUE; | 619 | searchVisible = TRUE; |
619 | searchEdit->setFocus(); | 620 | searchEdit->setFocus(); |
620 | } | 621 | } |
621 | 622 | ||
622 | void TextEdit::findNext() | 623 | void TextEdit::findNext() |
623 | { | 624 | { |
624 | editor->find( searchEdit->text(), FALSE, FALSE ); | 625 | editor->find( searchEdit->text(), FALSE, FALSE ); |
625 | 626 | ||
626 | } | 627 | } |
627 | 628 | ||
628 | void TextEdit::findClose() | 629 | void TextEdit::findClose() |
629 | { | 630 | { |
630 | searchVisible = FALSE; | 631 | searchVisible = FALSE; |
631 | searchBar->hide(); | 632 | searchBar->hide(); |
632 | } | 633 | } |
633 | 634 | ||
634 | void TextEdit::search() | 635 | void TextEdit::search() |
635 | { | 636 | { |
636 | editor->find( searchEdit->text(), FALSE, FALSE ); | 637 | editor->find( searchEdit->text(), FALSE, FALSE ); |
637 | } | 638 | } |
638 | 639 | ||