summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp6
-rw-r--r--core/apps/textedit/fileSaver.cpp3
2 files changed, 4 insertions, 5 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp
index 3e3cc3a..b029e5b 100644
--- a/core/apps/textedit/fileBrowser.cpp
+++ b/core/apps/textedit/fileBrowser.cpp
@@ -1,180 +1,180 @@
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
24fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter ) 24fileBrowser::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( "Browse for file" ) );
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
65fileBrowser::~fileBrowser() 65fileBrowser::~fileBrowser()
66{ 66{
67} 67}
68 68
69 69
70void fileBrowser::populateList() 70void 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 ); 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);
79// currentDir.setNameFilter("*.txt;*.etx"); 79// currentDir.setNameFilter("*.txt;*.etx");
80 QString fileL, fileS; 80 QString fileL, fileS;
81 const QFileInfoList *list = currentDir.entryInfoList(QDir::All /*, QDir::SortByMask*/); 81 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
82 QFileInfoListIterator it(*list); 82 QFileInfoListIterator it(*list);
83 QFileInfo *fi; 83 QFileInfo *fi;
84 while ( (fi=it.current()) ) { 84 while ( (fi=it.current()) ) {
85 85
86 if (fi->isSymLink() ){ 86 if (fi->isSymLink() ){
87 QString symLink=fi->readLink(); 87 QString symLink=fi->readLink();
88// qDebug("Symlink detected "+symLink); 88// qDebug("Symlink detected "+symLink);
89 QFileInfo sym( symLink); 89 QFileInfo sym( symLink);
90 fileS.sprintf( "%10li", sym.size() ); 90 fileS.sprintf( "%10li", sym.size() );
91 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); 91 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() );
92 92
93 } else { 93 } else {
94// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 94// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
95 fileS.sprintf( "%10li", fi->size() ); 95 fileS.sprintf( "%10li", fi->size() );
96 fileL.sprintf( "%s",fi->fileName().data() ); 96 fileL.sprintf( "%s",fi->fileName().data() );
97 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 97 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
98 fileL+="/"; 98 fileL+="/";
99// qDebug(currentDir.canonicalPath()+fileL); 99// qDebug( fileL);
100 } 100 }
101 } 101 }
102 item= new QListViewItem( ListView,fileL,fileS ); 102 item= new QListViewItem( ListView,fileL,fileS );
103 ++it; 103 ++it;
104 } 104 }
105 ListView->setSorting( 2, FALSE); 105 ListView->setSorting( 2, FALSE);
106 dirLabel->setText(currentDir.canonicalPath()); 106 dirLabel->setText(currentDir.canonicalPath());
107} 107}
108 108
109void fileBrowser::upDir() 109void fileBrowser::upDir()
110{ 110{
111// qDebug(currentDir.canonicalPath()); 111// qDebug(currentDir.canonicalPath());
112} 112}
113 113
114void fileBrowser::listDoubleClicked(QListViewItem *selectedItem) 114void fileBrowser::listDoubleClicked(QListViewItem *selectedItem)
115{ 115{
116} 116}
117 117
118// 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
119void fileBrowser::listClicked(QListViewItem *selectedItem) 119void fileBrowser::listClicked(QListViewItem *selectedItem)
120{ 120{
121 QString strItem=selectedItem->text(0); 121 QString strItem=selectedItem->text(0);
122 QString strSize=selectedItem->text(1); 122 QString strSize=selectedItem->text(1);
123// qDebug("strItem is "+strItem); 123// qDebug("strItem is "+strItem);
124 strSize.stripWhiteSpace(); 124 strSize.stripWhiteSpace();
125// qDebug(strSize); 125// qDebug(strSize);
126 126
127 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 127 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
128 // is symlink 128 // is symlink
129 QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4); 129 QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4);
130// qDebug("strItem symlink is "+strItem2); 130// qDebug("strItem symlink is "+strItem2);
131 if(QDir(strItem2).exists() ) { 131 if(QDir(strItem2).exists() ) {
132 currentDir.cd(strItem2, TRUE); 132 currentDir.cd(strItem2, TRUE);
133 populateList(); 133 populateList();
134 } 134 }
135 } else { // not a symlink 135 } else { // not a symlink
136 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 136 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
137 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 137 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
138 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 138 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
139 currentDir.cd(strItem,FALSE); 139 currentDir.cd(strItem,FALSE);
140// qDebug("Path is "+strItem); 140// qDebug("Path is "+strItem);
141 populateList(); 141 populateList();
142 } else { 142 } else {
143 currentDir.cdUp(); 143 currentDir.cdUp();
144 populateList(); 144 populateList();
145 } 145 }
146 if(QDir(strItem).exists()){ 146 if(QDir(strItem).exists()){
147 currentDir.cd(strItem, TRUE); 147 currentDir.cd(strItem, TRUE);
148 populateList(); 148 populateList();
149 } 149 }
150 } else { 150 } else {
151 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 151 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
152 if( QFile::exists(strItem ) ) { 152 if( QFile::exists(strItem ) ) {
153//currentDir.canonicalPath() 153//currentDir.canonicalPath()
154 qDebug("We found our files!!"+strItem); 154 qDebug("We found our files!!"+strItem);
155 OnOK(); 155 OnOK();
156 } 156 }
157 } //end not symlink 157 } //end not symlink
158 chdir(strItem.latin1()); 158 chdir(strItem.latin1());
159 } 159 }
160} 160}
161 161
162void fileBrowser::OnOK() 162void fileBrowser::OnOK()
163{ 163{
164 QListViewItemIterator it1( ListView); 164 QListViewItemIterator it1( ListView);
165 for ( ; it1.current(); ++it1 ) { 165 for ( ; it1.current(); ++it1 ) {
166 if ( it1.current()->isSelected() ) { 166 if ( it1.current()->isSelected() ) {
167 selectedFileName=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+it1.current()->text(0)); 167 selectedFileName=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+it1.current()->text(0));
168 qDebug("selected filename is "+selectedFileName); 168 qDebug("selected filename is "+selectedFileName);
169 fileList.append( selectedFileName ); 169 fileList.append( selectedFileName );
170 } 170 }
171 } 171 }
172 accept(); 172 accept();
173} 173}
174 174
175void fileBrowser::homeButtonPushed() { 175void fileBrowser::homeButtonPushed() {
176 chdir( QDir::homeDirPath().latin1() ); 176 chdir( QDir::homeDirPath().latin1() );
177 currentDir.cd( QDir::homeDirPath(), TRUE); 177 currentDir.cd( QDir::homeDirPath(), TRUE);
178 populateList(); 178 populateList();
179 update(); 179 update();
180} 180}
diff --git a/core/apps/textedit/fileSaver.cpp b/core/apps/textedit/fileSaver.cpp
index de594aa..f3be914 100644
--- a/core/apps/textedit/fileSaver.cpp
+++ b/core/apps/textedit/fileSaver.cpp
@@ -1,191 +1,190 @@
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
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( "Save file" ) ); 34 setCaption(tr( "Save file" ) );
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
81fileSaver::~fileSaver() 81fileSaver::~fileSaver()
82{ 82{
83} 83}
84 84
85
86void fileSaver::populateList() 85void fileSaver::populateList()
87{ 86{
88 ListView->clear(); 87 ListView->clear();
89 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden ); 88 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden );
90 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 89 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
91 currentDir.setMatchAllDirs(TRUE); 90 currentDir.setMatchAllDirs(TRUE);
92 91
93 currentDir.setNameFilter("*"); 92 currentDir.setNameFilter("*");
94 QString fileL, fileS; 93 QString fileL, fileS;
95 const QFileInfoList *list = currentDir.entryInfoList(QDir::All /*, QDir::SortByMask*/); 94 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
96 QFileInfoListIterator it(*list); 95 QFileInfoListIterator it(*list);
97 QFileInfo *fi; 96 QFileInfo *fi;
98 while ( (fi=it.current()) ) { 97 while ( (fi=it.current()) ) {
99 98
100 if (fi->isSymLink() ){ 99 if (fi->isSymLink() ){
101 QString symLink=fi->readLink(); 100 QString symLink=fi->readLink();
102// qDebug("Symlink detected "+symLink); 101// qDebug("Symlink detected "+symLink);
103 QFileInfo sym( symLink); 102 QFileInfo sym( symLink);
104 fileS.sprintf( "%10li", sym.size() ); 103 fileS.sprintf( "%10li", sym.size() );
105 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); 104 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() );
106 105
107 } else { 106 } else {
108// // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 107// // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
109 fileS.sprintf( "%10li", fi->size() ); 108 fileS.sprintf( "%10li", fi->size() );
110 fileL.sprintf( "%s",fi->fileName().data() ); 109 fileL.sprintf( "%s",fi->fileName().data() );
111 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 110 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
112 fileL+="/"; 111 fileL+="/";
113// qDebug(currentDir.canonicalPath()+fileL); 112// qDebug(currentDir.canonicalPath()+fileL);
114 } 113 }
115 } 114 }
116 item= new QListViewItem( ListView,fileL,fileS ); 115 item= new QListViewItem( ListView,fileL,fileS );
117 ++it; 116 ++it;
118 } 117 }
119 ListView->setSorting( 2, FALSE); 118 ListView->setSorting( 2, FALSE);
120 dirLabel->setText(currentDir.canonicalPath()); 119 dirLabel->setText(currentDir.canonicalPath());
121 120
122 121
123} 122}
124 123
125void fileSaver::upDir() 124void fileSaver::upDir()
126{ 125{
127// qDebug(currentDir.canonicalPath()); 126// qDebug(currentDir.canonicalPath());
128} 127}
129 128
130void fileSaver::listDoubleClicked(QListViewItem *selectedItem) 129void fileSaver::listDoubleClicked(QListViewItem *selectedItem)
131{ 130{
132} 131}
133 132
134void fileSaver::listClicked(QListViewItem *selectedItem) 133void fileSaver::listClicked(QListViewItem *selectedItem)
135{ 134{
136 QString strItem=selectedItem->text(0); 135 QString strItem=selectedItem->text(0);
137 QString strSize=selectedItem->text(1); 136 QString strSize=selectedItem->text(1);
138// qDebug("strItem is "+strItem); 137// qDebug("strItem is "+strItem);
139 strSize.stripWhiteSpace(); 138 strSize.stripWhiteSpace();
140// qDebug(strSize); 139// qDebug(strSize);
141 140
142 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 141 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
143 QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4); 142 QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4);
144// qDebug("strItem symlink is "+strItem2); 143// qDebug("strItem symlink is "+strItem2);
145 if(QDir(strItem2).exists() ) { 144 if(QDir(strItem2).exists() ) {
146 currentDir.cd(strItem2, TRUE); 145 currentDir.cd(strItem2, TRUE);
147 populateList(); 146 populateList();
148 } 147 }
149 } else { // not a symlink 148 } else { // not a symlink
150 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 149 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
151 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 150 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
152 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 151 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
153 currentDir.cd(strItem,FALSE); 152 currentDir.cd(strItem,FALSE);
154// qDebug("Path is "+strItem); 153// qDebug("Path is "+strItem);
155 populateList(); 154 populateList();
156 } else { 155 } else {
157 currentDir.cdUp(); 156 currentDir.cdUp();
158 populateList(); 157 populateList();
159 } 158 }
160 if(QDir(strItem).exists()){ 159 if(QDir(strItem).exists()){
161 currentDir.cd(strItem, TRUE); 160 currentDir.cd(strItem, TRUE);
162 populateList(); 161 populateList();
163 } 162 }
164 } // else 163 } // else
165// if( QFile::exists(strItem ) ) { 164// if( QFile::exists(strItem ) ) {
166// qDebug("We found our files!!"); 165// qDebug("We found our files!!");
167 166
168// OnOK(); 167// OnOK();
169 } //end not symlink 168 } //end not symlink
170 chdir(strItem.latin1()); 169 chdir(strItem.latin1());
171 170
172 171
173} 172}
174 173
175 174
176void fileSaver::closeEvent( QCloseEvent *e ) 175void fileSaver::closeEvent( QCloseEvent *e )
177{ 176{
178 if(e->isAccepted()) { 177 if(e->isAccepted()) {
179 e->accept(); 178 e->accept();
180 } else { 179 } else {
181 qDebug("not accepted"); 180 qDebug("not accepted");
182 done(-1); 181 done(-1);
183 } 182 }
184} 183}
185 184
186void fileSaver::accept() { 185void fileSaver::accept() {
187 selectedFileName = fileEdit->text(); 186 selectedFileName = fileEdit->text();
188 QString path = currentDir.canonicalPath()+"/" + selectedFileName; 187 QString path = currentDir.canonicalPath()+"/" + selectedFileName;
189 if( path.find("//",0,TRUE) ==-1 ) { 188 if( path.find("//",0,TRUE) ==-1 ) {
190 selectedFileName = path; 189 selectedFileName = path;
191 } else { 190 } else {