author | zautrix <zautrix> | 2005-06-18 16:38:24 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-18 16:38:24 (UTC) |
commit | 1919ddd25fb835b0eb03a44cbfbf4713d45266b8 (patch) (unidiff) | |
tree | f2ed65d2ad6b204dcb7eeb76da8776aae69aba6c /microkde | |
parent | 4ad2d49928757d72657735e088ac1cf587637fca (diff) | |
download | kdepimpi-1919ddd25fb835b0eb03a44cbfbf4713d45266b8.zip kdepimpi-1919ddd25fb835b0eb03a44cbfbf4713d45266b8.tar.gz kdepimpi-1919ddd25fb835b0eb03a44cbfbf4713d45266b8.tar.bz2 |
fixed links
-rw-r--r-- | microkde/ofileselector_p.cpp | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/microkde/ofileselector_p.cpp b/microkde/ofileselector_p.cpp index f85f8f4..e2af32b 100644 --- a/microkde/ofileselector_p.cpp +++ b/microkde/ofileselector_p.cpp | |||
@@ -156,10 +156,23 @@ OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, | |||
156 | bool isLocked, bool isDir ) | 156 | bool isLocked, bool isDir ) |
157 | : QListViewItem( view ) | 157 | : QListViewItem( view ) |
158 | { | 158 | { |
159 | |||
160 | QString kind; | ||
161 | QString _path = path; | ||
162 | if ( isDir ) | ||
163 | kind = "dir"; | ||
164 | else | ||
165 | kind = "file"; | ||
159 | setPixmap(0, pixmap ); | 166 | setPixmap(0, pixmap ); |
160 | setText(1, path ); | 167 | int arrow = path.find( "->" ); |
168 | if (arrow > 0 ) { | ||
169 | kind += path.mid( arrow ); | ||
170 | _path = path.left(arrow); | ||
171 | } | ||
172 | setText(1, _path ); | ||
161 | setText(2, size ); | 173 | setText(2, size ); |
162 | setText(3, date ); | 174 | setText(3, date ); |
175 | setText(4, kind ); | ||
163 | m_isDir = isDir; | 176 | m_isDir = isDir; |
164 | m_dir = dir; | 177 | m_dir = dir; |
165 | m_locked = isLocked; | 178 | m_locked = isLocked; |
@@ -190,7 +203,12 @@ QString OFileSelectorItem::key( int id, bool )const { | |||
190 | ke.append( text(1) ); | 203 | ke.append( text(1) ); |
191 | } | 204 | } |
192 | return ke; | 205 | return ke; |
193 | }else | 206 | } else if ( id == 2 ) { |
207 | QString sort = "00000000"; | ||
208 | sort = sort.left( 9-text( 2 ).length()) + text( 2 ); | ||
209 | return sort; | ||
210 | |||
211 | } else | ||
194 | return text( id ); | 212 | return text( id ); |
195 | 213 | ||
196 | } | 214 | } |
@@ -345,9 +363,11 @@ void OFileViewFileListView::reread( bool all ) { | |||
345 | * | 363 | * |
346 | */ | 364 | */ |
347 | if( fi->isSymLink() ){ | 365 | if( fi->isSymLink() ){ |
348 | QString file = fi->dirPath( true ) + "/" + fi->readLink(); | 366 | qDebug("SYMLINK "); |
349 | for( int i = 0; i<=4; i++) { // 5 tries to prevent dos | 367 | QString file = fi->readLink(); |
368 | for( int i = 0; i<=5; i++) { // 5 tries to prevent dos | ||
350 | QFileInfo info( file ); | 369 | QFileInfo info( file ); |
370 | qDebug("FILE %s ", file.latin1()); | ||
351 | if( !info.exists() ){ | 371 | if( !info.exists() ){ |
352 | addSymlink( fi, TRUE ); | 372 | addSymlink( fi, TRUE ); |
353 | break; | 373 | break; |
@@ -358,7 +378,7 @@ void OFileViewFileListView::reread( bool all ) { | |||
358 | addFile( fi, TRUE ); | 378 | addFile( fi, TRUE ); |
359 | break; | 379 | break; |
360 | }else if( info.isSymLink() ){ | 380 | }else if( info.isSymLink() ){ |
361 | file = info.dirPath(true ) + "/" + info.readLink() ; | 381 | file = info.readLink() ; |
362 | break; | 382 | break; |
363 | }else if( i == 4){ // couldn't resolve symlink add it as symlink | 383 | }else if( i == 4){ // couldn't resolve symlink add it as symlink |
364 | addSymlink( fi ); | 384 | addSymlink( fi ); |
@@ -486,7 +506,7 @@ void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) { | |||
486 | dir = info->dirPath( true ); | 506 | dir = info->dirPath( true ); |
487 | locked = false; | 507 | locked = false; |
488 | if ( symlink ) | 508 | if ( symlink ) |
489 | name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); | 509 | name = info->fileName() + " -> " + info->readLink(); |
490 | else{ | 510 | else{ |
491 | name = info->fileName(); | 511 | name = info->fileName(); |
492 | if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || | 512 | if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || |
@@ -512,7 +532,7 @@ void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) { | |||
512 | }else | 532 | }else |
513 | pix = symlink ? Resource::loadPixmap( "symlink") : Resource::loadPixmap("folder"); | 533 | pix = symlink ? Resource::loadPixmap( "symlink") : Resource::loadPixmap("folder"); |
514 | 534 | ||
515 | name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() : | 535 | name = symlink ? info->fileName() + " -> " + info->readLink() : |
516 | info->fileName(); | 536 | info->fileName(); |
517 | 537 | ||
518 | (void)new OFileSelectorItem( m_view, pix, name, | 538 | (void)new OFileSelectorItem( m_view, pix, name, |