author | llornkcor <llornkcor> | 2002-03-27 04:33:32 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-27 04:33:32 (UTC) |
commit | 7d6828df281631bce0aaa2aaa229b69b9329e03c (patch) (unidiff) | |
tree | efd928de11a2d7d2ae33bbccf737fae7a51ff36d | |
parent | 524ad1da733675debd5c248b54efc5d58e855485 (diff) | |
download | opie-7d6828df281631bce0aaa2aaa229b69b9329e03c.zip opie-7d6828df281631bce0aaa2aaa229b69b9329e03c.tar.gz opie-7d6828df281631bce0aaa2aaa229b69b9329e03c.tar.bz2 |
fixed something erother.. probably something todo with deleting or somesuch. probably broke something else in the process
-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 117 | ||||
-rw-r--r-- | core/apps/textedit/fileBrowser.h | 2 | ||||
-rw-r--r-- | core/apps/textedit/fileSaver.cpp | 45 |
3 files changed, 104 insertions, 60 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index 8c942a1..8ea8067 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp | |||
@@ -122,5 +122,5 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags | |||
122 | QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); | 122 | QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); |
123 | connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 123 | connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
124 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 124 | this, SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
125 | 125 | ||
126 | connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); | 126 | connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); |
@@ -172,4 +172,5 @@ void fileBrowser::populateList() | |||
172 | { | 172 | { |
173 | ListView->clear(); | 173 | ListView->clear(); |
174 | QListViewItem * item; | ||
174 | bool isDir=FALSE; | 175 | bool isDir=FALSE; |
175 | //qDebug(currentDir.canonicalPath()); | 176 | //qDebug(currentDir.canonicalPath()); |
@@ -183,56 +184,56 @@ void fileBrowser::populateList() | |||
183 | QFileInfo *fi; | 184 | QFileInfo *fi; |
184 | while ( (fi=it.current()) ) { | 185 | while ( (fi=it.current()) ) { |
185 | 186 | if (fi->isSymLink() ){ | |
186 | if (fi->isSymLink() ){ | 187 | QString symLink=fi->readLink(); |
187 | QString symLink=fi->readLink(); | ||
188 | // qDebug("Symlink detected "+symLink); | 188 | // qDebug("Symlink detected "+symLink); |
189 | QFileInfo sym( symLink); | 189 | QFileInfo sym( symLink); |
190 | fileS.sprintf( "%10li", sym.size() ); | 190 | fileS.sprintf( "%10li", sym.size() ); |
191 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 191 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
192 | fileDate = sym.lastModified().toString(); | 192 | fileDate = sym.lastModified().toString(); |
193 | } else { | 193 | } else { |
194 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 194 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
195 | fileS.sprintf( "%10li", fi->size() ); | 195 | fileS.sprintf( "%10li", fi->size() ); |
196 | fileL.sprintf( "%s",fi->fileName().data() ); | 196 | fileL.sprintf( "%s",fi->fileName().data() ); |
197 | fileDate= fi->lastModified().toString(); | 197 | fileDate= fi->lastModified().toString(); |
198 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 198 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
199 | fileL+="/"; | 199 | fileL+="/"; |
200 | isDir=TRUE; | 200 | isDir=TRUE; |
201 | // qDebug( fileL); | 201 | // qDebug( fileL); |
202 | } | ||
202 | } | 203 | } |
203 | } | 204 | if(fileL !="./" && fi->exists()) { |
204 | if(fileL !="./") { | 205 | item= new QListViewItem( ListView,fileL,fileS , fileDate); |
205 | item= new QListViewItem( ListView,fileL,fileS , fileDate); | 206 | QPixmap pm; |
206 | QPixmap pm; | ||
207 | 207 | ||
208 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 208 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
209 | if( !QDir( fi->filePath() ).isReadable()) | 209 | if( !QDir( fi->filePath() ).isReadable()) |
210 | pm = Resource::loadPixmap( "lockedfolder" ); | 210 | pm = Resource::loadPixmap( "lockedfolder" ); |
211 | else | 211 | else |
212 | pm= Resource::loadPixmap( "folder" ); | ||
213 | item->setPixmap( 0,pm ); | ||
214 | } else { | ||
215 | if( !fi->isReadable() ) | ||
216 | pm = Resource::loadPixmap( "locked" ); | ||
217 | else { | ||
218 | MimeType mt(fi->filePath()); | ||
219 | pm=mt.pixmap(); | ||
220 | if(pm.isNull()) | ||
221 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | ||
222 | item->setPixmap( 0,pm); | ||
223 | } | ||
224 | } | ||
225 | if( fileL.find("->",0,TRUE) != -1) { | ||
226 | // overlay link image | ||
212 | pm= Resource::loadPixmap( "folder" ); | 227 | pm= Resource::loadPixmap( "folder" ); |
213 | item->setPixmap( 0,pm ); | 228 | QPixmap lnk = Resource::loadPixmap( "symlink" ); |
214 | } else { | 229 | QPainter painter( &pm ); |
215 | if( !fi->isReadable() ) | 230 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
216 | pm = Resource::loadPixmap( "locked" ); | 231 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
217 | else { | 232 | item->setPixmap( 0, pm); |
218 | MimeType mt(fi->filePath()); | ||
219 | pm=mt.pixmap(); | ||
220 | if(pm.isNull()) | ||
221 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | ||
222 | item->setPixmap( 0,pm); | ||
223 | } | 233 | } |
224 | } | 234 | } |
225 | if( fileL.find("->",0,TRUE) != -1) { | 235 | isDir=FALSE; |
226 | // overlay link image | 236 | ++it; |
227 | pm= Resource::loadPixmap( "folder" ); | 237 | // } |
228 | QPixmap lnk = Resource::loadPixmap( "symlink" ); | ||
229 | QPainter painter( &pm ); | ||
230 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | ||
231 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | ||
232 | item->setPixmap( 0, pm); | ||
233 | } | ||
234 | } | ||
235 | isDir=FALSE; | ||
236 | ++it; | ||
237 | } | 238 | } |
238 | ListView->setSorting( 3, FALSE); | 239 | ListView->setSorting( 3, FALSE); |
@@ -264,4 +265,5 @@ void fileBrowser::upDir() | |||
264 | void fileBrowser::listClicked(QListViewItem *selectedItem) | 265 | void fileBrowser::listClicked(QListViewItem *selectedItem) |
265 | { | 266 | { |
267 | if(selectedItem) { | ||
266 | QString strItem=selectedItem->text(0); | 268 | QString strItem=selectedItem->text(0); |
267 | QString strSize=selectedItem->text(1); | 269 | QString strSize=selectedItem->text(1); |
@@ -303,4 +305,5 @@ void fileBrowser::listClicked(QListViewItem *selectedItem) | |||
303 | chdir(strItem.latin1()); | 305 | chdir(strItem.latin1()); |
304 | } | 306 | } |
307 | } | ||
305 | } | 308 | } |
306 | 309 | ||
@@ -379,14 +382,18 @@ void fileBrowser::showListMenu(QListViewItem *item) { | |||
379 | 382 | ||
380 | QPopupMenu m;// = new QPopupMenu( Local_View ); | 383 | QPopupMenu m;// = new QPopupMenu( Local_View ); |
381 | if( item->text(0).find("/",0,TRUE)) | 384 | if(item) { |
382 | m.insertItem( tr( "Change Directory" ), this, SLOT( doCd() )); | 385 | if( item->text(0).find("/",0,TRUE)) |
383 | else | 386 | m.insertItem( tr( "Change Directory" ), this, SLOT( doCd() )); |
384 | m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() )); | 387 | m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() )); |
385 | m.insertItem( tr( "Rescan" ), this, SLOT( populateList() )); | 388 | m.insertItem( tr( "Rescan" ), this, SLOT( populateList() )); |
386 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 389 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
387 | m.insertSeparator(); | 390 | m.insertSeparator(); |
388 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 391 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
392 | } else { | ||
393 | m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() )); | ||
394 | m.insertItem( tr( "Rescan" ), this, SLOT( populateList() )); | ||
395 | |||
396 | } | ||
389 | m.exec( QCursor::pos() ); | 397 | m.exec( QCursor::pos() ); |
390 | |||
391 | } | 398 | } |
392 | 399 | ||
@@ -401,4 +408,5 @@ void fileBrowser::makDir() { | |||
401 | if( fileDlg->result() == 1 ) { | 408 | if( fileDlg->result() == 1 ) { |
402 | QString filename = fileDlg->LineEdit1->text(); | 409 | QString filename = fileDlg->LineEdit1->text(); |
410 | qDebug("Make dir"); | ||
403 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 411 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
404 | } | 412 | } |
@@ -437,5 +445,4 @@ void fileBrowser::localDelete() { | |||
437 | break; | 445 | break; |
438 | }; | 446 | }; |
439 | |||
440 | } else { | 447 | } else { |
441 | switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f | 448 | switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f |
diff --git a/core/apps/textedit/fileBrowser.h b/core/apps/textedit/fileBrowser.h index 339483f..e76c7df 100644 --- a/core/apps/textedit/fileBrowser.h +++ b/core/apps/textedit/fileBrowser.h | |||
@@ -68,5 +68,5 @@ private: | |||
68 | QDir currentDir; | 68 | QDir currentDir; |
69 | QStringList dirPathStringList, mimetypes; | 69 | QStringList dirPathStringList, mimetypes; |
70 | QListViewItem * item; | 70 | /* QListViewItem * item; */ |
71 | QComboBox *dirPathCombo; | 71 | QComboBox *dirPathCombo; |
72 | MenuButton *typemb; | 72 | MenuButton *typemb; |
diff --git a/core/apps/textedit/fileSaver.cpp b/core/apps/textedit/fileSaver.cpp index 07fb5ba..f2a5355 100644 --- a/core/apps/textedit/fileSaver.cpp +++ b/core/apps/textedit/fileSaver.cpp | |||
@@ -15,4 +15,5 @@ | |||
15 | #include <qpe/config.h> | 15 | #include <qpe/config.h> |
16 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
17 | #include <qpe/mimetype.h> | ||
17 | 18 | ||
18 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
@@ -48,4 +49,5 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl | |||
48 | docButton->setGeometry(170,4,25,25); | 49 | docButton->setGeometry(170,4,25,25); |
49 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); | 50 | connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); |
51 | |||
50 | docButton->setFlat(TRUE); | 52 | docButton->setFlat(TRUE); |
51 | 53 | ||
@@ -58,8 +60,10 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl | |||
58 | ListView = new QListView( this, "ListView" ); | 60 | ListView = new QListView( this, "ListView" ); |
59 | ListView->addColumn( tr( "Name" ) ); | 61 | ListView->addColumn( tr( "Name" ) ); |
60 | ListView->setColumnWidth(0,140); | 62 | ListView->setColumnWidth(0,120); |
61 | ListView->setSorting( 2, FALSE); | 63 | ListView->setSorting( 2, FALSE); |
62 | ListView->addColumn( tr( "Size" ) ); | 64 | ListView->addColumn( tr( "Size" ) ); |
63 | ListView->setColumnWidth(1,59); | 65 | ListView->setColumnWidth(1,-1); |
66 | ListView->addColumn( "Date",-1); | ||
67 | |||
64 | ListView->setColumnWidthMode(0,QListView::Manual); | 68 | ListView->setColumnWidthMode(0,QListView::Manual); |
65 | ListView->setColumnAlignment(1,QListView::AlignRight); | 69 | ListView->setColumnAlignment(1,QListView::AlignRight); |
@@ -98,9 +102,10 @@ void fileSaver::populateList() | |||
98 | { | 102 | { |
99 | ListView->clear(); | 103 | ListView->clear(); |
104 | bool isDir=FALSE; | ||
100 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 105 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
101 | currentDir.setMatchAllDirs(TRUE); | 106 | currentDir.setMatchAllDirs(TRUE); |
102 | 107 | ||
103 | currentDir.setNameFilter("*"); | 108 | currentDir.setNameFilter("*"); |
104 | QString fileL, fileS; | 109 | QString fileL, fileS, fileDate; |
105 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 110 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
106 | QFileInfoListIterator it(*list); | 111 | QFileInfoListIterator it(*list); |
@@ -121,8 +126,40 @@ void fileSaver::populateList() | |||
121 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 126 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
122 | fileL+="/"; | 127 | fileL+="/"; |
128 | isDir=TRUE; | ||
123 | // qDebug(currentDir.canonicalPath()+fileL); | 129 | // qDebug(currentDir.canonicalPath()+fileL); |
124 | } | 130 | } |
125 | } | 131 | } |
126 | item= new QListViewItem( ListView,fileL,fileS ); | 132 | if(fileL !="./") { |
133 | item= new QListViewItem( ListView,fileL,fileS , fileDate); | ||
134 | QPixmap pm; | ||
135 | |||
136 | if(isDir || fileL.find("/",0,TRUE) != -1) { | ||
137 | if( !QDir( fi->filePath() ).isReadable()) | ||
138 | pm = Resource::loadPixmap( "lockedfolder" ); | ||
139 | else | ||
140 | pm= Resource::loadPixmap( "folder" ); | ||
141 | item->setPixmap( 0,pm ); | ||
142 | } else { | ||
143 | if( !fi->isReadable() ) | ||
144 | pm = Resource::loadPixmap( "locked" ); | ||
145 | else { | ||
146 | MimeType mt(fi->filePath()); | ||
147 | pm=mt.pixmap(); | ||
148 | if(pm.isNull()) | ||
149 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | ||
150 | item->setPixmap( 0,pm); | ||
151 | } | ||
152 | } | ||
153 | if( fileL.find("->",0,TRUE) != -1) { | ||
154 | // overlay link image | ||
155 | pm= Resource::loadPixmap( "folder" ); | ||
156 | QPixmap lnk = Resource::loadPixmap( "symlink" ); | ||
157 | QPainter painter( &pm ); | ||
158 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | ||
159 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | ||
160 | item->setPixmap( 0, pm); | ||
161 | } | ||
162 | } | ||
163 | isDir=FALSE; | ||
127 | ++it; | 164 | ++it; |
128 | } | 165 | } |