Diffstat (limited to 'core/apps/textedit/fileSaver.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/textedit/fileSaver.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
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 | |||
@@ -36,17 +36,28 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl | |||
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); |
@@ -70,25 +81,25 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl | |||
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 | ||
81 | fileSaver::~fileSaver() | 93 | fileSaver::~fileSaver() |
82 | { | 94 | { |
83 | } | 95 | } |
84 | 96 | ||
85 | void fileSaver::populateList() | 97 | void 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*/); |
@@ -197,6 +208,26 @@ void fileSaver::accept() { | |||
197 | void fileSaver::homeButtonPushed() { | 208 | void 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 | } |
214 | void fileSaver::docButtonPushed() { | ||
215 | chdir( QString(QPEApplication::documentDir()+"/text").latin1() ); | ||
216 | currentDir.cd( QPEApplication::documentDir()+"/text", TRUE); | ||
217 | populateList(); | ||
218 | update(); | ||
219 | |||
220 | } | ||
221 | |||
222 | void 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 | } | ||