summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-03-10 03:22:06 (UTC)
committer llornkcor <llornkcor>2002-03-10 03:22:06 (UTC)
commit115b05c0aa6e11d8a0265f2e6806bdf9d03a404a (patch) (unidiff)
tree2d1648da4632fa2d248159a26abf2da30dff379e
parent637cea2664defb5414a3897f70b616deba926ffe (diff)
downloadopie-115b05c0aa6e11d8a0265f2e6806bdf9d03a404a.zip
opie-115b05c0aa6e11d8a0265f2e6806bdf9d03a404a.tar.gz
opie-115b05c0aa6e11d8a0265f2e6806bdf9d03a404a.tar.bz2
added a documents and hidden file buttons to fileSaver and fileBrowser
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp44
-rw-r--r--core/apps/textedit/fileBrowser.h11
-rw-r--r--core/apps/textedit/fileSaver.cpp35
-rw-r--r--core/apps/textedit/fileSaver.h7
-rw-r--r--core/apps/textedit/textedit.cpp4
5 files changed, 85 insertions, 16 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp
index 8c1e962..c16bd41 100644
--- a/core/apps/textedit/fileBrowser.cpp
+++ b/core/apps/textedit/fileBrowser.cpp
@@ -1,90 +1,105 @@
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 18
18#include <qlistview.h> 19#include <qlistview.h>
19#include <qpushbutton.h> 20#include <qpushbutton.h>
20#include <qfile.h> 21#include <qfile.h>
21#include <qmessagebox.h> 22#include <qmessagebox.h>
22#include <unistd.h> 23#include <unistd.h>
23 24
25
26
24fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter ) 27fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter )
25 : QDialog( parent, name, modal, fl ) 28 : QDialog( parent, name, modal, fl )
26{ 29{
27 if ( !name ) 30 if ( !name )
28 setName( "fileBrowser" ); 31 setName( "fileBrowser" );
29 resize( 240, 280 ); 32 resize( 240, 280 );
30 setCaption(tr( name ) ); 33 setCaption(tr( name ) );
31 filterStr=filter; 34 filterStr=filter;
32 35
33 dirLabel = new QLabel(this, "DirLabel"); 36 dirLabel = new QLabel(this, "DirLabel");
34 dirLabel->setText(currentDir.canonicalPath()); 37 dirLabel->setText(currentDir.canonicalPath());
35 dirLabel->setGeometry(10,20,230,15); 38 dirLabel->setGeometry(10,20,230,15);
36 39
37 QPushButton *homeButton; 40 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
38 homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton");
39 homeButton->setGeometry(200,4,25,25); 41 homeButton->setGeometry(200,4,25,25);
40 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 42 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
41 43 homeButton->setFlat(TRUE);
44
45 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
46 docButton->setGeometry(170,4,25,25);
47 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
48 docButton->setFlat(TRUE);
49
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
42 ListView = new QListView( this, "ListView" ); 56 ListView = new QListView( this, "ListView" );
43 ListView->addColumn( tr( "Name" ) ); 57 ListView->addColumn( tr( "Name" ) );
44 ListView->setColumnWidth(0,140); 58 ListView->setColumnWidth(0,140);
45 ListView->setSorting( 2, FALSE); 59 ListView->setSorting( 2, FALSE);
46 ListView->addColumn( tr( "Size" ) ); 60 ListView->addColumn( tr( "Size" ) );
47 ListView->setColumnWidth(1,59); 61 ListView->setColumnWidth(1,59);
48// ListView->addColumn( tr( "" ) ); 62// ListView->addColumn( tr( "" ) );
49 ListView->setColumnWidthMode(0,QListView::Manual); 63 ListView->setColumnWidthMode(0,QListView::Manual);
50 ListView->setColumnAlignment(1,QListView::AlignRight); 64 ListView->setColumnAlignment(1,QListView::AlignRight);
51// ListView->setMultiSelection(true); 65// ListView->setMultiSelection(true);
52// ListView->setSelectionMode(QListView::Extended); 66// ListView->setSelectionMode(QListView::Extended);
53 67
54 ListView->setAllColumnsShowFocus( TRUE ); 68 ListView->setAllColumnsShowFocus( TRUE );
55 ListView->setGeometry( QRect( 10, 35, 220, 240 ) ); 69 ListView->setGeometry( QRect( 10, 35, 220, 240 ) );
56 70
57 // signals and slots connections 71 // signals and slots connections
58 connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); 72 connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) );
59 connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); 73 connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
60 currentDir.setPath(QDir::currentDirPath()); 74 currentDir.setPath(QDir::currentDirPath());
75 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All);
76
61 populateList(); 77 populateList();
62 move(0,15); 78 move(0,15);
63} 79}
64 80
65fileBrowser::~fileBrowser() 81fileBrowser::~fileBrowser()
66{ 82{
67} 83}
68 84
69 85
70void fileBrowser::populateList() 86void fileBrowser::populateList()
71{ 87{
72 ListView->clear(); 88 ListView->clear();
73//qDebug(currentDir.canonicalPath()); 89//qDebug(currentDir.canonicalPath());
74 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
75 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 90 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
76 currentDir.setMatchAllDirs(TRUE); 91 currentDir.setMatchAllDirs(TRUE);
77 92
78 currentDir.setNameFilter(filterStr); 93 currentDir.setNameFilter(filterStr);
79// currentDir.setNameFilter("*.txt;*.etx"); 94// currentDir.setNameFilter("*.txt;*.etx");
80 QString fileL, fileS; 95 QString fileL, fileS;
81 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 96 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
82 QFileInfoListIterator it(*list); 97 QFileInfoListIterator it(*list);
83 QFileInfo *fi; 98 QFileInfo *fi;
84 while ( (fi=it.current()) ) { 99 while ( (fi=it.current()) ) {
85 100
86 if (fi->isSymLink() ){ 101 if (fi->isSymLink() ){
87 QString symLink=fi->readLink(); 102 QString symLink=fi->readLink();
88// qDebug("Symlink detected "+symLink); 103// qDebug("Symlink detected "+symLink);
89 QFileInfo sym( symLink); 104 QFileInfo sym( symLink);
90 fileS.sprintf( "%10li", sym.size() ); 105 fileS.sprintf( "%10li", sym.size() );
@@ -165,16 +180,37 @@ void fileBrowser::OnOK()
165 for ( ; it1.current(); ++it1 ) { 180 for ( ; it1.current(); ++it1 ) {
166 if ( it1.current()->isSelected() ) { 181 if ( it1.current()->isSelected() ) {
167 selectedFileName=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+it1.current()->text(0)); 182 selectedFileName=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+it1.current()->text(0));
168 qDebug("selected filename is "+selectedFileName); 183 qDebug("selected filename is "+selectedFileName);
169 fileList.append( selectedFileName ); 184 fileList.append( selectedFileName );
170 } 185 }
171 } 186 }
172 accept(); 187 accept();
173} 188}
174 189
175void fileBrowser::homeButtonPushed() { 190void fileBrowser::homeButtonPushed() {
176 chdir( QDir::homeDirPath().latin1() ); 191 chdir( QDir::homeDirPath().latin1() );
177 currentDir.cd( QDir::homeDirPath(), TRUE); 192 currentDir.cd( QDir::homeDirPath(), TRUE);
178 populateList(); 193 populateList();
179 update(); 194 update();
180} 195}
196
197void fileBrowser::docButtonPushed() {
198 chdir( QString(QPEApplication::documentDir()+"/text").latin1() );
199 currentDir.cd( QPEApplication::documentDir()+"/text", TRUE);
200 populateList();
201 update();
202
203}
204
205void fileBrowser::hideButtonPushed(bool b) {
206 if (b)
207 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
208 else
209 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
210
211// chdir( QString(QPEApplication::documentDir()+"/text").latin1() );
212// currentDir.cd( QPEApplication::documentDir()+"/text", TRUE);
213 populateList();
214 update();
215
216}
diff --git a/core/apps/textedit/fileBrowser.h b/core/apps/textedit/fileBrowser.h
index c0e1d4a..50ed485 100644
--- a/core/apps/textedit/fileBrowser.h
+++ b/core/apps/textedit/fileBrowser.h
@@ -26,42 +26,43 @@ copyright Sun 02-17-2002 22:28:23 L. J. Potter ljp@llornkcor.com
26class QVBoxLayout; 26class QVBoxLayout;
27class QHBoxLayout; 27class QHBoxLayout;
28class QGridLayout; 28class QGridLayout;
29class QListView; 29class QListView;
30class QListViewItem; 30class QListViewItem;
31class QPushButton; 31class QPushButton;
32 32
33class fileBrowser : public QDialog 33class fileBrowser : public QDialog
34{ 34{
35 Q_OBJECT 35 Q_OBJECT
36 36
37public: 37public:
38 void populateList(); 38 void populateList();
39 fileBrowser( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ,const QString filter=0); 39 fileBrowser( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ,const QString filter=0);
40 ~fileBrowser(); 40 ~fileBrowser();
41 41
42 QPushButton* buttonOk; 42 QPushButton *buttonOk, *buttonCancel, *homeButton, *docButton, *hideButton;
43 QListView* ListView; 43 QListView* ListView;
44 QPushButton* buttonCancel; 44
45 QLabel *dirLabel; 45 QLabel *dirLabel;
46 QString selectedFileName, filterStr; 46 QString selectedFileName, filterStr;
47 QDir currentDir; 47 QDir currentDir;
48 QFile file; 48 QFile file;
49 QStringList fileList; 49 QStringList fileList;
50 50 QListViewItem * item;
51QListViewItem * item;
52public slots: 51public slots:
53void homeButtonPushed(); 52 void homeButtonPushed();
53 void docButtonPushed();
54 void hideButtonPushed(bool);
54private: 55private:
55 56
56private slots: 57private slots:
57 void upDir(); 58 void upDir();
58 void listDoubleClicked(QListViewItem *); 59 void listDoubleClicked(QListViewItem *);
59 void listClicked(QListViewItem *); 60 void listClicked(QListViewItem *);
60 void OnOK(); 61 void OnOK();
61protected slots: 62protected slots:
62 63
63protected: 64protected:
64 65
65}; 66};
66 67
67#endif // FILEBROWSER_H 68#endif // FILEBROWSER_H
diff --git a/core/apps/textedit/fileSaver.cpp b/core/apps/textedit/fileSaver.cpp
index 4e80735..fbf50cf 100644
--- a/core/apps/textedit/fileSaver.cpp
+++ b/core/apps/textedit/fileSaver.cpp
@@ -26,79 +26,90 @@
26#include <unistd.h> 26#include <unistd.h>
27 27
28fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl , const QString currentFileName ) 28fileSaver::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( name ) ); 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;
43 homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton"); 42 homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton");
44 homeButton->setGeometry(200,4,25,25); 43 homeButton->setGeometry(200,4,25,25);
45 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 44 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
45 homeButton->setFlat(TRUE);
46 46
47 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
48 docButton->setGeometry(170,4,25,25);
49 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
50 docButton->setFlat(TRUE);
51
52 hideButton = new QPushButton( Resource::loadIconSet("s_hidden"),"",this,"hideButton");
53 hideButton->setGeometry(140,4,25,25);
54 connect( hideButton,SIGNAL(toggled(bool)),this,SLOT( hideButtonPushed(bool)) );
55 hideButton->setToggleButton(TRUE);
56 hideButton->setFlat(TRUE);
57
47 ListView = new QListView( this, "ListView" ); 58 ListView = new QListView( this, "ListView" );
48 ListView->addColumn( tr( "Name" ) ); 59 ListView->addColumn( tr( "Name" ) );
49 ListView->setColumnWidth(0,140); 60 ListView->setColumnWidth(0,140);
50 ListView->setSorting( 2, FALSE); 61 ListView->setSorting( 2, FALSE);
51 ListView->addColumn( tr( "Size" ) ); 62 ListView->addColumn( tr( "Size" ) );
52 ListView->setColumnWidth(1,59); 63 ListView->setColumnWidth(1,59);
53 ListView->setColumnWidthMode(0,QListView::Manual); 64 ListView->setColumnWidthMode(0,QListView::Manual);
54 ListView->setColumnAlignment(1,QListView::AlignRight); 65 ListView->setColumnAlignment(1,QListView::AlignRight);
55// ListView->setMultiSelection(true); 66// ListView->setMultiSelection(true);
56// ListView->setSelectionMode(QListView::Extended); 67// ListView->setSelectionMode(QListView::Extended);
57 68
58 ListView->setAllColumnsShowFocus( TRUE ); 69 ListView->setAllColumnsShowFocus( TRUE );
59 ListView->setGeometry( QRect( 10,35,220,125)); 70 ListView->setGeometry( QRect( 10,35,220,125));
60 71
61 fileEdit= new QLineEdit(this); 72 fileEdit= new QLineEdit(this);
62 fileEdit->setGeometry( QRect( 10, 162, 205, 17)); 73 fileEdit->setGeometry( QRect( 10, 162, 205, 17));
63 74
64 fileEdit->setText( tmpFileName); 75 fileEdit->setText( tmpFileName);
65 76
66 filePermCheck = new QCheckBox( this, "SetFilePerms" ); 77 filePermCheck = new QCheckBox( this, "SetFilePerms" );
67 filePermCheck->setText("set file permissions"); 78 filePermCheck->setText("set file permissions");
68 filePermCheck->setGeometry(10, 178, 150,17); 79 filePermCheck->setGeometry(10, 178, 150,17);
69 // signals and slots connections 80 // signals and slots connections
70 connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); 81 connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) );
71 connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); 82 connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
72 83
73// tmpFileName=fi.FilePath(); 84// tmpFileName=fi.FilePath();
74// qDebug( tmpFileName); 85// qDebug( tmpFileName);
75 currentDir.setPath( QDir::currentDirPath() ); 86 currentDir.setPath( QDir::currentDirPath() );
87 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All);
76 populateList(); 88 populateList();
77 move(0,15); 89 move(0,15);
78 fileEdit->setFocus(); 90 fileEdit->setFocus();
79} 91}
80 92
81fileSaver::~fileSaver() 93fileSaver::~fileSaver()
82{ 94{
83} 95}
84 96
85void fileSaver::populateList() 97void fileSaver::populateList()
86{ 98{
87 ListView->clear(); 99 ListView->clear();
88 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden );
89 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 100 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
90 currentDir.setMatchAllDirs(TRUE); 101 currentDir.setMatchAllDirs(TRUE);
91 102
92 currentDir.setNameFilter("*"); 103 currentDir.setNameFilter("*");
93 QString fileL, fileS; 104 QString fileL, fileS;
94 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 105 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
95 QFileInfoListIterator it(*list); 106 QFileInfoListIterator it(*list);
96 QFileInfo *fi; 107 QFileInfo *fi;
97 while ( (fi=it.current()) ) { 108 while ( (fi=it.current()) ) {
98 109
99 if (fi->isSymLink() ){ 110 if (fi->isSymLink() ){
100 QString symLink=fi->readLink(); 111 QString symLink=fi->readLink();
101// qDebug("Symlink detected "+symLink); 112// qDebug("Symlink detected "+symLink);
102 QFileInfo sym( symLink); 113 QFileInfo sym( symLink);
103 fileS.sprintf( "%10li", sym.size() ); 114 fileS.sprintf( "%10li", sym.size() );
104 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); 115 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() );
@@ -187,16 +198,36 @@ void fileSaver::accept() {
187 QString path = currentDir.canonicalPath()+"/" + selectedFileName; 198 QString path = currentDir.canonicalPath()+"/" + selectedFileName;
188 if( path.find("//",0,TRUE) ==-1 ) { 199 if( path.find("//",0,TRUE) ==-1 ) {
189 selectedFileName = path; 200 selectedFileName = path;
190 } else { 201 } else {
191 selectedFileName = currentDir.canonicalPath()+selectedFileName; 202 selectedFileName = currentDir.canonicalPath()+selectedFileName;
192 } 203 }
193 qDebug("going to save "+selectedFileName); 204 qDebug("going to save "+selectedFileName);
194 done(1); 205 done(1);
195} 206}
196 207
197void fileSaver::homeButtonPushed() { 208void fileSaver::homeButtonPushed() {
198 chdir( QDir::homeDirPath().latin1() ); 209 chdir( QDir::homeDirPath().latin1() );
199 currentDir.cd( QDir::homeDirPath(), TRUE); 210 currentDir.cd( QDir::homeDirPath(), TRUE);
200 populateList(); 211 populateList();
201 update(); 212 update();
202} 213}
214void fileSaver::docButtonPushed() {
215 chdir( QString(QPEApplication::documentDir()+"/text").latin1() );
216 currentDir.cd( QPEApplication::documentDir()+"/text", TRUE);
217 populateList();
218 update();
219
220}
221
222void fileSaver::hideButtonPushed(bool b) {
223 if (b)
224 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
225 else
226 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
227
228// chdir( QString(QPEApplication::documentDir()+"/text").latin1() );
229// currentDir.cd( QPEApplication::documentDir()+"/text", TRUE);
230 populateList();
231 update();
232
233}
diff --git a/core/apps/textedit/fileSaver.h b/core/apps/textedit/fileSaver.h
index 526085d..195a775 100644
--- a/core/apps/textedit/fileSaver.h
+++ b/core/apps/textedit/fileSaver.h
@@ -30,45 +30,46 @@ class QGridLayout;
30class QListView; 30class QListView;
31class QListViewItem; 31class QListViewItem;
32class QPushButton; 32class QPushButton;
33class QLineEdit; 33class QLineEdit;
34class QCheckBox; 34class QCheckBox;
35 35
36class fileSaver : public QDialog 36class fileSaver : public QDialog
37{ 37{
38 Q_OBJECT 38 Q_OBJECT
39 39
40public: 40public:
41 void populateList(); 41 void populateList();
42 fileSaver( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ,const QString filter=0); 42 fileSaver( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ,const QString filter=0);
43 ~fileSaver(); 43 ~fileSaver();
44 QLineEdit *fileEdit; 44 QLineEdit *fileEdit;
45 45
46 QPushButton* buttonOk; 46 QPushButton *buttonOk, *buttonCancel, *homeButton, *docButton, *hideButton;
47 QListView* ListView; 47 QListView* ListView;
48 QPushButton* buttonCancel;
49 QLabel *dirLabel; 48 QLabel *dirLabel;
50 QString selectedFileName, filterStr; 49 QString selectedFileName, filterStr;
51 QDir currentDir; 50 QDir currentDir;
52 QFile file; 51 QFile file;
53 QStringList fileList; 52 QStringList fileList;
54 QCheckBox *filePermCheck; 53 QCheckBox *filePermCheck;
55 54
56QListViewItem * item; 55QListViewItem * item;
57public slots: 56public slots:
58void homeButtonPushed(); 57 void homeButtonPushed();
58 void docButtonPushed();
59 void hideButtonPushed(bool);
59private: 60private:
60 61
61private slots: 62private slots:
62 void accept(); 63 void accept();
63 void upDir(); 64 void upDir();
64 void listDoubleClicked(QListViewItem *); 65 void listDoubleClicked(QListViewItem *);
65 void listClicked(QListViewItem *); 66 void listClicked(QListViewItem *);
66 void closeEvent( QCloseEvent * ); 67 void closeEvent( QCloseEvent * );
67 68
68protected slots: 69protected slots:
69 70
70protected: 71protected:
71 72
72}; 73};
73 74
74#endif // FILESAVER_H 75#endif // FILESAVER_H
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 78c4d8a..dafe1dc 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -548,33 +548,34 @@ void TextEdit::newFileOpen()
548 QString fileTemp; 548 QString fileTemp;
549 for ( f = fileList.begin(); f != fileList.end(); f++ ) { 549 for ( f = fileList.begin(); f != fileList.end(); f++ ) {
550 fileTemp = *f; 550 fileTemp = *f;
551 fileTemp.right( fileTemp.length()-5); 551 fileTemp.right( fileTemp.length()-5);
552 QString fileName = fileTemp; 552 QString fileName = fileTemp;
553 if( fileName != "Unnamed" || fileName != "Empty Text" ) { 553 if( fileName != "Unnamed" || fileName != "Empty Text" ) {
554 currentFileName = fileName; 554 currentFileName = fileName;
555 qDebug("please open "+currentFileName); 555 qDebug("please open "+currentFileName);
556 openFile(fileName ); 556 openFile(fileName );
557 } 557 }
558 } 558 }
559 } 559 }
560 delete browseForFiles; 560 delete browseForFiles;
561 editor->setEdited( FALSE); 561 editor->setEdited( FALSE);
562 edited1=FALSE; 562 edited1=FALSE;
563 edited=FALSE; 563 edited=FALSE;
564 setCaption(caption().right(caption().length()-1)); 564 if(caption().left(1)=="*")
565 setCaption(caption().right(caption().length()-1));
565} 566}
566 567
567#if 0 568#if 0
568void TextEdit::slotFind() 569void TextEdit::slotFind()
569{ 570{
570 FindDialog frmFind( "Text Editor", this ); 571 FindDialog frmFind( "Text Editor", this );
571 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), 572 connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)),
572 editor, SLOT(slotDoFind( const QString&,bool,bool))); 573 editor, SLOT(slotDoFind( const QString&,bool,bool)));
573 574
574 //case sensitive, backwards, [category] 575 //case sensitive, backwards, [category]
575 576
576 connect( editor, SIGNAL(notFound()), 577 connect( editor, SIGNAL(notFound()),
577 &frmFind, SLOT(slotNotFound()) ); 578 &frmFind, SLOT(slotNotFound()) );
578 connect( editor, SIGNAL(searchWrapped()), 579 connect( editor, SIGNAL(searchWrapped()),
579 &frmFind, SLOT(slotWrapAround()) ); 580 &frmFind, SLOT(slotWrapAround()) );
580 581
@@ -679,33 +680,32 @@ void TextEdit::openFile( const DocLnk &f )
679 qDebug("openFile doclnk " + currentFileName); 680 qDebug("openFile doclnk " + currentFileName);
680 if ( !fm.loadFile( f, txt ) ) { 681 if ( !fm.loadFile( f, txt ) ) {
681 // ####### could be a new file 682 // ####### could be a new file
682 qDebug( "Cannot open file" ); 683 qDebug( "Cannot open file" );
683 684
684 //return; 685 //return;
685 } 686 }
686 687
687 fileNew(); 688 fileNew();
688 if ( doc ) 689 if ( doc )
689 delete doc; 690 delete doc;
690 doc = new DocLnk(f); 691 doc = new DocLnk(f);
691 editor->setText(txt); 692 editor->setText(txt);
692 editor->setEdited( FALSE); 693 editor->setEdited( FALSE);
693 edited1=FALSE; 694 edited1=FALSE;
694 edited=FALSE; 695 edited=FALSE;
695 setCaption(caption().right(caption().length()-1));
696 696
697 qDebug("openFile doclnk "+currentFileName); 697 qDebug("openFile doclnk "+currentFileName);
698 doc->setName(currentFileName); 698 doc->setName(currentFileName);
699 updateCaption(); 699 updateCaption();
700} 700}
701 701
702void TextEdit::showEditTools() 702void TextEdit::showEditTools()
703{ 703{
704// if ( !doc ) 704// if ( !doc )
705// close(); 705// close();
706// clear(); 706// clear();
707 fileSelector->hide(); 707 fileSelector->hide();
708 menu->show(); 708 menu->show();
709 editBar->show(); 709 editBar->show();
710 if ( searchVisible ) 710 if ( searchVisible )
711 searchBar->show(); 711 searchBar->show();