author | bipolar <bipolar> | 2002-03-01 14:49:41 (UTC) |
---|---|---|
committer | bipolar <bipolar> | 2002-03-01 14:49:41 (UTC) |
commit | 2dfc5c76379baf8ae8ad6aed5f6c44d59d79087b (patch) (unidiff) | |
tree | d4b0572e3204ab4b7bdacde937bca46392182f75 /core/apps | |
parent | 38e7dc570dfbcea350795d9cf8f66b643ad159a8 (diff) | |
download | opie-2dfc5c76379baf8ae8ad6aed5f6c44d59d79087b.zip opie-2dfc5c76379baf8ae8ad6aed5f6c44d59d79087b.tar.gz opie-2dfc5c76379baf8ae8ad6aed5f6c44d59d79087b.tar.bz2 |
ljp (llornkcor) commited this. Fixes fileSaveas and filedialog positioning
when input method is opened. Added home buttons on each.
-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 22 | ||||
-rw-r--r-- | core/apps/textedit/fileBrowser.h | 2 | ||||
-rw-r--r-- | core/apps/textedit/fileSaver.cpp | 29 | ||||
-rw-r--r-- | core/apps/textedit/fileSaver.h | 2 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 3 |
5 files changed, 45 insertions, 13 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index 2275388..3e3cc3a 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp | |||
@@ -4,62 +4,71 @@ | |||
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 | 17 | ||
17 | #include <qlistview.h> | 18 | #include <qlistview.h> |
18 | #include <qpushbutton.h> | 19 | #include <qpushbutton.h> |
19 | #include <qfile.h> | 20 | #include <qfile.h> |
20 | #include <qmessagebox.h> | 21 | #include <qmessagebox.h> |
21 | #include <unistd.h> | 22 | #include <unistd.h> |
22 | 23 | ||
23 | 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 ) |
24 | : QDialog( parent, name, modal, fl ) | 25 | : QDialog( parent, name, modal, fl ) |
25 | { | 26 | { |
26 | if ( !name ) | 27 | if ( !name ) |
27 | setName( "fileBrowser" ); | 28 | setName( "fileBrowser" ); |
28 | resize( 236, 280 ); | 29 | resize( 240, 280 ); |
29 | setCaption(tr( "Browse for file" ) ); | 30 | setCaption(tr( "Browse for file" ) ); |
30 | filterStr=filter; | 31 | filterStr=filter; |
32 | |||
31 | dirLabel = new QLabel(this, "DirLabel"); | 33 | dirLabel = new QLabel(this, "DirLabel"); |
32 | dirLabel->setText(currentDir.canonicalPath()); | 34 | dirLabel->setText(currentDir.canonicalPath()); |
33 | dirLabel->setGeometry(10,4,230,30); | 35 | dirLabel->setGeometry(10,20,230,15); |
36 | |||
37 | QPushButton *homeButton; | ||
38 | homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton"); | ||
39 | homeButton->setGeometry(200,4,25,25); | ||
40 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | ||
41 | |||
34 | ListView = new QListView( this, "ListView" ); | 42 | ListView = new QListView( this, "ListView" ); |
35 | ListView->addColumn( tr( "Name" ) ); | 43 | ListView->addColumn( tr( "Name" ) ); |
36 | ListView->setColumnWidth(0,140); | 44 | ListView->setColumnWidth(0,140); |
37 | ListView->setSorting( 2, FALSE); | 45 | ListView->setSorting( 2, FALSE); |
38 | ListView->addColumn( tr( "Size" ) ); | 46 | ListView->addColumn( tr( "Size" ) ); |
39 | ListView->setColumnWidth(1,59); | 47 | ListView->setColumnWidth(1,59); |
40 | // ListView->addColumn( tr( "" ) ); | 48 | // ListView->addColumn( tr( "" ) ); |
41 | ListView->setColumnWidthMode(0,QListView::Manual); | 49 | ListView->setColumnWidthMode(0,QListView::Manual); |
42 | ListView->setColumnAlignment(1,QListView::AlignRight); | 50 | ListView->setColumnAlignment(1,QListView::AlignRight); |
43 | // ListView->setMultiSelection(true); | 51 | // ListView->setMultiSelection(true); |
44 | // ListView->setSelectionMode(QListView::Extended); | 52 | // ListView->setSelectionMode(QListView::Extended); |
45 | 53 | ||
46 | ListView->setAllColumnsShowFocus( TRUE ); | 54 | ListView->setAllColumnsShowFocus( TRUE ); |
47 | ListView->setGeometry( QRect( 10, 35, 220, 240 ) ); | 55 | ListView->setGeometry( QRect( 10, 35, 220, 240 ) ); |
48 | 56 | ||
49 | // signals and slots connections | 57 | // signals and slots connections |
50 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); | 58 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); |
51 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 59 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
52 | currentDir.setPath(QDir::currentDirPath()); | 60 | currentDir.setPath(QDir::currentDirPath()); |
53 | populateList(); | 61 | populateList(); |
62 | move(0,15); | ||
54 | } | 63 | } |
55 | 64 | ||
56 | fileBrowser::~fileBrowser() | 65 | fileBrowser::~fileBrowser() |
57 | { | 66 | { |
58 | } | 67 | } |
59 | 68 | ||
60 | 69 | ||
61 | void fileBrowser::populateList() | 70 | void fileBrowser::populateList() |
62 | { | 71 | { |
63 | ListView->clear(); | 72 | ListView->clear(); |
64 | //qDebug(currentDir.canonicalPath()); | 73 | //qDebug(currentDir.canonicalPath()); |
65 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden ); | 74 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden ); |
@@ -85,25 +94,25 @@ void fileBrowser::populateList() | |||
85 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 94 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
86 | fileS.sprintf( "%10li", fi->size() ); | 95 | fileS.sprintf( "%10li", fi->size() ); |
87 | fileL.sprintf( "%s",fi->fileName().data() ); | 96 | fileL.sprintf( "%s",fi->fileName().data() ); |
88 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 97 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
89 | fileL+="/"; | 98 | fileL+="/"; |
90 | // qDebug(currentDir.canonicalPath()+fileL); | 99 | // qDebug(currentDir.canonicalPath()+fileL); |
91 | } | 100 | } |
92 | } | 101 | } |
93 | item= new QListViewItem( ListView,fileL,fileS ); | 102 | item= new QListViewItem( ListView,fileL,fileS ); |
94 | ++it; | 103 | ++it; |
95 | } | 104 | } |
96 | ListView->setSorting( 2, FALSE); | 105 | ListView->setSorting( 2, FALSE); |
97 | dirLabel->setText("Current Directory:\n"+currentDir.canonicalPath()); | 106 | dirLabel->setText(currentDir.canonicalPath()); |
98 | } | 107 | } |
99 | 108 | ||
100 | void fileBrowser::upDir() | 109 | void fileBrowser::upDir() |
101 | { | 110 | { |
102 | // qDebug(currentDir.canonicalPath()); | 111 | // qDebug(currentDir.canonicalPath()); |
103 | } | 112 | } |
104 | 113 | ||
105 | void fileBrowser::listDoubleClicked(QListViewItem *selectedItem) | 114 | void fileBrowser::listDoubleClicked(QListViewItem *selectedItem) |
106 | { | 115 | { |
107 | } | 116 | } |
108 | 117 | ||
109 | // you may want to switch these 2 functions. I like single clicks | 118 | // you may want to switch these 2 functions. I like single clicks |
@@ -153,12 +162,19 @@ void fileBrowser::listClicked(QListViewItem *selectedItem) | |||
153 | void fileBrowser::OnOK() | 162 | void fileBrowser::OnOK() |
154 | { | 163 | { |
155 | QListViewItemIterator it1( ListView); | 164 | QListViewItemIterator it1( ListView); |
156 | for ( ; it1.current(); ++it1 ) { | 165 | for ( ; it1.current(); ++it1 ) { |
157 | if ( it1.current()->isSelected() ) { | 166 | if ( it1.current()->isSelected() ) { |
158 | selectedFileName=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+it1.current()->text(0)); | 167 | selectedFileName=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+it1.current()->text(0)); |
159 | qDebug("selected filename is "+selectedFileName); | 168 | qDebug("selected filename is "+selectedFileName); |
160 | fileList.append( selectedFileName ); | 169 | fileList.append( selectedFileName ); |
161 | } | 170 | } |
162 | } | 171 | } |
163 | accept(); | 172 | accept(); |
164 | } | 173 | } |
174 | |||
175 | void fileBrowser::homeButtonPushed() { | ||
176 | chdir( QDir::homeDirPath().latin1() ); | ||
177 | currentDir.cd( QDir::homeDirPath(), TRUE); | ||
178 | populateList(); | ||
179 | update(); | ||
180 | } | ||
diff --git a/core/apps/textedit/fileBrowser.h b/core/apps/textedit/fileBrowser.h index 17ed862..c0e1d4a 100644 --- a/core/apps/textedit/fileBrowser.h +++ b/core/apps/textedit/fileBrowser.h | |||
@@ -41,25 +41,25 @@ public: | |||
41 | 41 | ||
42 | QPushButton* buttonOk; | 42 | QPushButton* buttonOk; |
43 | QListView* ListView; | 43 | QListView* ListView; |
44 | QPushButton* buttonCancel; | 44 | QPushButton* buttonCancel; |
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 | ||
51 | QListViewItem * item; | 51 | QListViewItem * item; |
52 | public slots: | 52 | public slots: |
53 | 53 | void homeButtonPushed(); | |
54 | private: | 54 | private: |
55 | 55 | ||
56 | private slots: | 56 | private slots: |
57 | void upDir(); | 57 | void upDir(); |
58 | void listDoubleClicked(QListViewItem *); | 58 | void listDoubleClicked(QListViewItem *); |
59 | void listClicked(QListViewItem *); | 59 | void listClicked(QListViewItem *); |
60 | void OnOK(); | 60 | void OnOK(); |
61 | protected slots: | 61 | protected slots: |
62 | 62 | ||
63 | protected: | 63 | protected: |
64 | 64 | ||
65 | }; | 65 | }; |
diff --git a/core/apps/textedit/fileSaver.cpp b/core/apps/textedit/fileSaver.cpp index 9e9e863..de594aa 100644 --- a/core/apps/textedit/fileSaver.cpp +++ b/core/apps/textedit/fileSaver.cpp | |||
@@ -4,79 +4,87 @@ | |||
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> | ||
17 | |||
16 | #include <qpe/qpeapplication.h> | 18 | #include <qpe/qpeapplication.h> |
17 | #include <qlistview.h> | 19 | #include <qlistview.h> |
18 | #include <qpushbutton.h> | 20 | #include <qpushbutton.h> |
19 | #include <qfile.h> | 21 | #include <qfile.h> |
20 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
21 | #include <qlineedit.h> | 23 | #include <qlineedit.h> |
22 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
23 | 25 | ||
24 | #include <unistd.h> | 26 | #include <unistd.h> |
25 | 27 | ||
26 | 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 ) |
27 | : QDialog( parent, name, modal, fl ) | 29 | : QDialog( parent, name, modal, fl ) |
28 | { | 30 | { |
29 | if ( !name ) | 31 | if ( !name ) |
30 | setName( "fileSaver" ); | 32 | setName( "fileSaver" ); |
31 | resize( 236, 280 ); | 33 | resize( 240, 280 ); |
32 | setCaption(tr( "Save file" ) ); | 34 | setCaption(tr( "Save file" ) ); |
33 | QFileInfo fi(currentFileName); | 35 | QFileInfo fi(currentFileName); |
34 | QString tmpFileName=fi.fileName(); | 36 | QString tmpFileName=fi.fileName(); |
35 | // qDebug( tmpFileName); | 37 | // qDebug( tmpFileName); |
36 | |||
37 | dirLabel = new QLabel(this, "DirLabel"); | 38 | dirLabel = new QLabel(this, "DirLabel"); |
38 | dirLabel->setText(currentDir.canonicalPath()); | 39 | dirLabel->setText(currentDir.canonicalPath()); |
39 | dirLabel->setGeometry(10,4,230,30); | 40 | dirLabel->setGeometry(10,20,230,15); |
40 | 41 | ||
42 | QPushButton *homeButton; | ||
43 | homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton"); | ||
44 | homeButton->setGeometry(200,4,25,25); | ||
45 | connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); | ||
46 | |||
41 | ListView = new QListView( this, "ListView" ); | 47 | ListView = new QListView( this, "ListView" ); |
42 | ListView->addColumn( tr( "Name" ) ); | 48 | ListView->addColumn( tr( "Name" ) ); |
43 | ListView->setColumnWidth(0,140); | 49 | ListView->setColumnWidth(0,140); |
44 | ListView->setSorting( 2, FALSE); | 50 | ListView->setSorting( 2, FALSE); |
45 | ListView->addColumn( tr( "Size" ) ); | 51 | ListView->addColumn( tr( "Size" ) ); |
46 | ListView->setColumnWidth(1,59); | 52 | ListView->setColumnWidth(1,59); |
47 | ListView->setColumnWidthMode(0,QListView::Manual); | 53 | ListView->setColumnWidthMode(0,QListView::Manual); |
48 | ListView->setColumnAlignment(1,QListView::AlignRight); | 54 | ListView->setColumnAlignment(1,QListView::AlignRight); |
49 | // ListView->setMultiSelection(true); | 55 | // ListView->setMultiSelection(true); |
50 | // ListView->setSelectionMode(QListView::Extended); | 56 | // ListView->setSelectionMode(QListView::Extended); |
51 | 57 | ||
52 | ListView->setAllColumnsShowFocus( TRUE ); | 58 | ListView->setAllColumnsShowFocus( TRUE ); |
53 | ListView->setGeometry( QRect( 10, 35, 220, 160 ) ); | 59 | ListView->setGeometry( QRect( 10,35,220,125)); |
54 | 60 | ||
55 | fileEdit= new QLineEdit(this); | 61 | fileEdit= new QLineEdit(this); |
56 | fileEdit->setGeometry( QRect( 10, 200, 200, 22)); | 62 | fileEdit->setGeometry( QRect( 10, 162, 205, 17)); |
57 | 63 | ||
58 | fileEdit->setText( tmpFileName); | 64 | fileEdit->setText( tmpFileName); |
59 | 65 | ||
60 | filePermCheck = new QCheckBox( this, "SetFilePerms" ); | 66 | filePermCheck = new QCheckBox( this, "SetFilePerms" ); |
61 | filePermCheck->setText("set file permissions"); | 67 | filePermCheck->setText("set file permissions"); |
62 | filePermCheck->setGeometry(10, 220, 150,22); | 68 | filePermCheck->setGeometry(10, 178, 150,17); |
63 | // signals and slots connections | 69 | // signals and slots connections |
64 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); | 70 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); |
65 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 71 | connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
66 | 72 | ||
67 | // tmpFileName=fi.FilePath(); | 73 | // tmpFileName=fi.FilePath(); |
68 | // qDebug( tmpFileName); | 74 | // qDebug( tmpFileName); |
69 | currentDir.setPath( QDir::currentDirPath() ); | 75 | currentDir.setPath( QDir::currentDirPath() ); |
70 | populateList(); | 76 | populateList(); |
77 | move(0,15); | ||
78 | |||
71 | } | 79 | } |
72 | 80 | ||
73 | fileSaver::~fileSaver() | 81 | fileSaver::~fileSaver() |
74 | { | 82 | { |
75 | } | 83 | } |
76 | 84 | ||
77 | 85 | ||
78 | void fileSaver::populateList() | 86 | void fileSaver::populateList() |
79 | { | 87 | { |
80 | ListView->clear(); | 88 | ListView->clear(); |
81 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden ); | 89 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden ); |
82 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 90 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
@@ -100,25 +108,25 @@ void fileSaver::populateList() | |||
100 | // // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 108 | // // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
101 | fileS.sprintf( "%10li", fi->size() ); | 109 | fileS.sprintf( "%10li", fi->size() ); |
102 | fileL.sprintf( "%s",fi->fileName().data() ); | 110 | fileL.sprintf( "%s",fi->fileName().data() ); |
103 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 111 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
104 | fileL+="/"; | 112 | fileL+="/"; |
105 | // qDebug(currentDir.canonicalPath()+fileL); | 113 | // qDebug(currentDir.canonicalPath()+fileL); |
106 | } | 114 | } |
107 | } | 115 | } |
108 | item= new QListViewItem( ListView,fileL,fileS ); | 116 | item= new QListViewItem( ListView,fileL,fileS ); |
109 | ++it; | 117 | ++it; |
110 | } | 118 | } |
111 | ListView->setSorting( 2, FALSE); | 119 | ListView->setSorting( 2, FALSE); |
112 | dirLabel->setText("Current Directory:\n"+currentDir.canonicalPath()); | 120 | dirLabel->setText(currentDir.canonicalPath()); |
113 | 121 | ||
114 | 122 | ||
115 | } | 123 | } |
116 | 124 | ||
117 | void fileSaver::upDir() | 125 | void fileSaver::upDir() |
118 | { | 126 | { |
119 | // qDebug(currentDir.canonicalPath()); | 127 | // qDebug(currentDir.canonicalPath()); |
120 | } | 128 | } |
121 | 129 | ||
122 | void fileSaver::listDoubleClicked(QListViewItem *selectedItem) | 130 | void fileSaver::listDoubleClicked(QListViewItem *selectedItem) |
123 | { | 131 | { |
124 | } | 132 | } |
@@ -177,12 +185,19 @@ void fileSaver::closeEvent( QCloseEvent *e ) | |||
177 | 185 | ||
178 | void fileSaver::accept() { | 186 | void fileSaver::accept() { |
179 | selectedFileName = fileEdit->text(); | 187 | selectedFileName = fileEdit->text(); |
180 | QString path = currentDir.canonicalPath()+"/" + selectedFileName; | 188 | QString path = currentDir.canonicalPath()+"/" + selectedFileName; |
181 | if( path.find("//",0,TRUE) ==-1 ) { | 189 | if( path.find("//",0,TRUE) ==-1 ) { |
182 | selectedFileName = path; | 190 | selectedFileName = path; |
183 | } else { | 191 | } else { |
184 | selectedFileName = currentDir.canonicalPath()+selectedFileName; | 192 | selectedFileName = currentDir.canonicalPath()+selectedFileName; |
185 | } | 193 | } |
186 | qDebug("going to save "+selectedFileName); | 194 | qDebug("going to save "+selectedFileName); |
187 | done(1); | 195 | done(1); |
188 | } | 196 | } |
197 | |||
198 | void fileSaver::homeButtonPushed() { | ||
199 | chdir( QDir::homeDirPath().latin1() ); | ||
200 | currentDir.cd( QDir::homeDirPath(), TRUE); | ||
201 | populateList(); | ||
202 | update(); | ||
203 | } | ||
diff --git a/core/apps/textedit/fileSaver.h b/core/apps/textedit/fileSaver.h index ce4493e..526085d 100644 --- a/core/apps/textedit/fileSaver.h +++ b/core/apps/textedit/fileSaver.h | |||
@@ -46,25 +46,25 @@ public: | |||
46 | QPushButton* buttonOk; | 46 | QPushButton* buttonOk; |
47 | QListView* ListView; | 47 | QListView* ListView; |
48 | QPushButton* buttonCancel; | 48 | QPushButton* buttonCancel; |
49 | QLabel *dirLabel; | 49 | QLabel *dirLabel; |
50 | QString selectedFileName, filterStr; | 50 | QString selectedFileName, filterStr; |
51 | QDir currentDir; | 51 | QDir currentDir; |
52 | QFile file; | 52 | QFile file; |
53 | QStringList fileList; | 53 | QStringList fileList; |
54 | QCheckBox *filePermCheck; | 54 | QCheckBox *filePermCheck; |
55 | 55 | ||
56 | QListViewItem * item; | 56 | QListViewItem * item; |
57 | public slots: | 57 | public slots: |
58 | 58 | void homeButtonPushed(); | |
59 | private: | 59 | private: |
60 | 60 | ||
61 | private slots: | 61 | private slots: |
62 | void accept(); | 62 | void accept(); |
63 | void upDir(); | 63 | void upDir(); |
64 | void listDoubleClicked(QListViewItem *); | 64 | void listDoubleClicked(QListViewItem *); |
65 | void listClicked(QListViewItem *); | 65 | void listClicked(QListViewItem *); |
66 | void closeEvent( QCloseEvent * ); | 66 | void closeEvent( QCloseEvent * ); |
67 | 67 | ||
68 | protected slots: | 68 | protected slots: |
69 | 69 | ||
70 | protected: | 70 | protected: |
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index bc975f3..72cc4d1 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -754,25 +754,25 @@ bool TextEdit::saveAs() | |||
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,"SaveFile",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; |
@@ -880,19 +880,20 @@ void TextEdit::changeFont() { | |||
880 | editor->setFont( myFont); | 880 | editor->setFont( myFont); |
881 | delete fontDlg; | 881 | delete fontDlg; |
882 | 882 | ||
883 | } | 883 | } |
884 | 884 | ||
885 | void TextEdit::editDelete() | 885 | void TextEdit::editDelete() |
886 | { | 886 | { |
887 | switch ( QMessageBox::warning(this,"Text Editor","Do you really want\nto delete the current file\nfrom the disk?\nThis is irreversable!!","Yes","No",0,0,1) ) { | 887 | switch ( QMessageBox::warning(this,"Text Editor","Do you really want\nto delete the current file\nfrom the disk?\nThis is irreversable!!","Yes","No",0,0,1) ) { |
888 | case 0: | 888 | case 0: |
889 | if(doc) { | 889 | if(doc) { |
890 | doc->removeFiles(); | 890 | doc->removeFiles(); |
891 | clear(); | 891 | clear(); |
892 | setCaption( tr("Text Editor") ); | ||
892 | } | 893 | } |
893 | break; | 894 | break; |
894 | case 1: | 895 | case 1: |
895 | // exit | 896 | // exit |
896 | break; | 897 | break; |
897 | }; | 898 | }; |
898 | } | 899 | } |