author | llornkcor <llornkcor> | 2002-04-19 23:58:35 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-19 23:58:35 (UTC) |
commit | 10c881d21c166bd7d06e96187cabf6cfe44ccdb3 (patch) (unidiff) | |
tree | b27032c8cf19943bdfe2f0def53fab961eeaf62d | |
parent | 221f2cbeaec8f28d39a5f95655f109a4b0fd33fc (diff) | |
download | opie-10c881d21c166bd7d06e96187cabf6cfe44ccdb3.zip opie-10c881d21c166bd7d06e96187cabf6cfe44ccdb3.tar.gz opie-10c881d21c166bd7d06e96187cabf6cfe44ccdb3.tar.bz2 |
frak! fixed symlink icon new location
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 2126745..fed15b4 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -242,385 +242,385 @@ void AdvancedFm::cleanUp() | |||
242 | QFile file( sfile); | 242 | QFile file( sfile); |
243 | if(file.exists()) | 243 | if(file.exists()) |
244 | file.remove(); | 244 | file.remove(); |
245 | } | 245 | } |
246 | 246 | ||
247 | void AdvancedFm::tabChanged(QWidget *w) | 247 | void AdvancedFm::tabChanged(QWidget *w) |
248 | { | 248 | { |
249 | if (TabWidget->currentPageIndex() == 0) { | 249 | if (TabWidget->currentPageIndex() == 0) { |
250 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 250 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
251 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 251 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
252 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 252 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
253 | } | 253 | } |
254 | if (TabWidget->currentPageIndex() == 1) { | 254 | if (TabWidget->currentPageIndex() == 1) { |
255 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); | 255 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); |
256 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); | 256 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); |
257 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); | 257 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); |
258 | } | 258 | } |
259 | } | 259 | } |
260 | 260 | ||
261 | 261 | ||
262 | void AdvancedFm::populateLocalView() | 262 | void AdvancedFm::populateLocalView() |
263 | { | 263 | { |
264 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 264 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
265 | // QListViewItemIterator it( Local_View ); | 265 | // QListViewItemIterator it( Local_View ); |
266 | // for ( ; it.current(); ++it ) { | 266 | // for ( ; it.current(); ++it ) { |
267 | // if ( it.current()->isSelected() ) { | 267 | // if ( it.current()->isSelected() ) { |
268 | // QString strItem = it.current()->text(0); | 268 | // QString strItem = it.current()->text(0); |
269 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 269 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
270 | // QFileInfo fi(localFile); | 270 | // QFileInfo fi(localFile); |
271 | // } | 271 | // } |
272 | // } | 272 | // } |
273 | QPixmap pm; | 273 | QPixmap pm; |
274 | Local_View->clear(); | 274 | Local_View->clear(); |
275 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 275 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
276 | currentDir.setMatchAllDirs(TRUE); | 276 | currentDir.setMatchAllDirs(TRUE); |
277 | currentDir.setNameFilter(filterStr); | 277 | currentDir.setNameFilter(filterStr); |
278 | QString fileL, fileS, fileDate; | 278 | QString fileL, fileS, fileDate; |
279 | // qDebug(currentDir.canonicalPath()); | 279 | // qDebug(currentDir.canonicalPath()); |
280 | 280 | ||
281 | bool isDir=FALSE; | 281 | bool isDir=FALSE; |
282 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 282 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
283 | QFileInfoListIterator it(*list); | 283 | QFileInfoListIterator it(*list); |
284 | QFileInfo *fi; | 284 | QFileInfo *fi; |
285 | while ( (fi=it.current()) ) { | 285 | while ( (fi=it.current()) ) { |
286 | if (fi->isSymLink() ) { | 286 | if (fi->isSymLink() ) { |
287 | QString symLink=fi->readLink(); | 287 | QString symLink=fi->readLink(); |
288 | // qDebug("Symlink detected "+symLink); | 288 | // qDebug("Symlink detected "+symLink); |
289 | QFileInfo sym( symLink); | 289 | QFileInfo sym( symLink); |
290 | fileS.sprintf( "%10li", sym.size() ); | 290 | fileS.sprintf( "%10li", sym.size() ); |
291 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 291 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
292 | fileDate = sym.lastModified().toString(); | 292 | fileDate = sym.lastModified().toString(); |
293 | } else { | 293 | } else { |
294 | fileS.sprintf( "%10li", fi->size() ); | 294 | fileS.sprintf( "%10li", fi->size() ); |
295 | fileL.sprintf( "%s",fi->fileName().data() ); | 295 | fileL.sprintf( "%s",fi->fileName().data() ); |
296 | fileDate= fi->lastModified().toString(); | 296 | fileDate= fi->lastModified().toString(); |
297 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 297 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
298 | fileL+="/"; | 298 | fileL+="/"; |
299 | isDir=TRUE; | 299 | isDir=TRUE; |
300 | // qDebug( fileL); | 300 | // qDebug( fileL); |
301 | } | 301 | } |
302 | } | 302 | } |
303 | if(fileL !="./" && fi->exists()) { | 303 | if(fileL !="./" && fi->exists()) { |
304 | item= new QListViewItem( Local_View, fileL , fileDate, fileS); | 304 | item= new QListViewItem( Local_View, fileL , fileDate, fileS); |
305 | 305 | ||
306 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 306 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
307 | if( !QDir( fi->filePath() ).isReadable()) | 307 | if( !QDir( fi->filePath() ).isReadable()) |
308 | pm = Resource::loadPixmap( "lockedfolder" ); | 308 | pm = Resource::loadPixmap( "lockedfolder" ); |
309 | else | 309 | else |
310 | pm= Resource::loadPixmap( "folder" ); | 310 | pm= Resource::loadPixmap( "folder" ); |
311 | item->setPixmap( 0,pm ); | 311 | item->setPixmap( 0,pm ); |
312 | } else { | 312 | } else { |
313 | if( !fi->isReadable() ) | 313 | if( !fi->isReadable() ) |
314 | pm = Resource::loadPixmap( "locked" ); | 314 | pm = Resource::loadPixmap( "locked" ); |
315 | else { | 315 | else { |
316 | MimeType mt(fi->filePath()); | 316 | MimeType mt(fi->filePath()); |
317 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 317 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
318 | if(pm.isNull()) | 318 | if(pm.isNull()) |
319 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 319 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
320 | item->setPixmap( 0,pm); | 320 | item->setPixmap( 0,pm); |
321 | } | 321 | } |
322 | } | 322 | } |
323 | if( fileL.find("->",0,TRUE) != -1) { | 323 | if( fileL.find("->",0,TRUE) != -1) { |
324 | // overlay link image | 324 | // overlay link image |
325 | pm= Resource::loadPixmap( "folder" ); | 325 | pm= Resource::loadPixmap( "folder" ); |
326 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 326 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
327 | QPainter painter( &pm ); | 327 | QPainter painter( &pm ); |
328 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 328 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
329 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 329 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
330 | item->setPixmap( 0, pm); | 330 | item->setPixmap( 0, pm); |
331 | } | 331 | } |
332 | } isDir=FALSE; | 332 | } isDir=FALSE; |
333 | ++it; | 333 | ++it; |
334 | } | 334 | } |
335 | 335 | ||
336 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { | 336 | if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { |
337 | struct stat buf; | 337 | struct stat buf; |
338 | struct stat st; | 338 | struct stat st; |
339 | dev_t devT; | 339 | dev_t devT; |
340 | mode_t mode; | 340 | mode_t mode; |
341 | DIR *dir; | 341 | DIR *dir; |
342 | int fd = 0; | 342 | int fd = 0; |
343 | struct dirent *mydirent; | 343 | struct dirent *mydirent; |
344 | int i = 1; | 344 | int i = 1; |
345 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) | 345 | if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) |
346 | while ((mydirent = readdir(dir)) != NULL) { | 346 | while ((mydirent = readdir(dir)) != NULL) { |
347 | lstat( mydirent->d_name, &buf); | 347 | lstat( mydirent->d_name, &buf); |
348 | qDebug(mydirent->d_name); | 348 | qDebug(mydirent->d_name); |
349 | // mode = buf.st_mode; | 349 | // mode = buf.st_mode; |
350 | fileL.sprintf("%s", mydirent->d_name); | 350 | fileL.sprintf("%s", mydirent->d_name); |
351 | // fileS.sprintf("%d, %d", ); //this isn't correct | 351 | // fileS.sprintf("%d, %d", ); //this isn't correct |
352 | devT = buf.st_dev; | 352 | devT = buf.st_dev; |
353 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); | 353 | fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); |
354 | // fileS.sprintf("%d,%d", devT, devT); | 354 | // fileS.sprintf("%d,%d", devT, devT); |
355 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 355 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
356 | if( fileL.find(".") == -1 ){ | 356 | if( fileL.find(".") == -1 ){ |
357 | item= new QListViewItem( Local_View, fileL, fileDate, fileS); | 357 | item= new QListViewItem( Local_View, fileL, fileDate, fileS); |
358 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 358 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
359 | item->setPixmap( 0,pm); | 359 | item->setPixmap( 0,pm); |
360 | } | 360 | } |
361 | } | 361 | } |
362 | 362 | ||
363 | closedir(dir); | 363 | closedir(dir); |
364 | } | 364 | } |
365 | 365 | ||
366 | Local_View->setSorting( 3,FALSE); | 366 | Local_View->setSorting( 3,FALSE); |
367 | fillCombo( (const QString &) currentDir.canonicalPath()); | 367 | fillCombo( (const QString &) currentDir.canonicalPath()); |
368 | } | 368 | } |
369 | 369 | ||
370 | void AdvancedFm::populateRemoteView() | 370 | void AdvancedFm::populateRemoteView() |
371 | { | 371 | { |
372 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 372 | // QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
373 | // QListViewItemIterator it( Remote_View ); | 373 | // QListViewItemIterator it( Remote_View ); |
374 | // for ( ; it.current(); ++it ) { | 374 | // for ( ; it.current(); ++it ) { |
375 | // if ( it.current()->isSelected() ) { | 375 | // if ( it.current()->isSelected() ) { |
376 | // QString strItem = it.current()->text(0); | 376 | // QString strItem = it.current()->text(0); |
377 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; | 377 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; |
378 | // QFileInfo fi(localFile); | 378 | // QFileInfo fi(localFile); |
379 | // } | 379 | // } |
380 | // } | 380 | // } |
381 | QPixmap pm; | 381 | QPixmap pm; |
382 | Remote_View->clear(); | 382 | Remote_View->clear(); |
383 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 383 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
384 | currentRemoteDir.setMatchAllDirs(TRUE); | 384 | currentRemoteDir.setMatchAllDirs(TRUE); |
385 | currentRemoteDir.setNameFilter(filterStr); | 385 | currentRemoteDir.setNameFilter(filterStr); |
386 | QString fileL, fileS, fileDate; | 386 | QString fileL, fileS, fileDate; |
387 | bool isDir=FALSE; | 387 | bool isDir=FALSE; |
388 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 388 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
389 | QFileInfoListIterator it(*list); | 389 | QFileInfoListIterator it(*list); |
390 | QFileInfo *fi; | 390 | QFileInfo *fi; |
391 | while ( (fi=it.current()) ) { | 391 | while ( (fi=it.current()) ) { |
392 | if (fi->isSymLink() ){ | 392 | if (fi->isSymLink() ){ |
393 | QString symLink=fi->readLink(); | 393 | QString symLink=fi->readLink(); |
394 | // qDebug("Symlink detected "+symLink); | 394 | // qDebug("Symlink detected "+symLink); |
395 | QFileInfo sym( symLink); | 395 | QFileInfo sym( symLink); |
396 | fileS.sprintf( "%10li", sym.size() ); | 396 | fileS.sprintf( "%10li", sym.size() ); |
397 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 397 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
398 | fileDate = sym.lastModified().toString(); | 398 | fileDate = sym.lastModified().toString(); |
399 | } else { | 399 | } else { |
400 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 400 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
401 | fileS.sprintf( "%10li", fi->size() ); | 401 | fileS.sprintf( "%10li", fi->size() ); |
402 | fileL.sprintf( "%s",fi->fileName().data() ); | 402 | fileL.sprintf( "%s",fi->fileName().data() ); |
403 | fileDate= fi->lastModified().toString(); | 403 | fileDate= fi->lastModified().toString(); |
404 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { | 404 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { |
405 | fileL+="/"; | 405 | fileL+="/"; |
406 | isDir=TRUE; | 406 | isDir=TRUE; |
407 | // qDebug( fileL); | 407 | // qDebug( fileL); |
408 | } | 408 | } |
409 | } | 409 | } |
410 | if(fileL !="./" && fi->exists()) { | 410 | if(fileL !="./" && fi->exists()) { |
411 | item= new QListViewItem( Remote_View, fileL, fileDate, fileS); | 411 | item= new QListViewItem( Remote_View, fileL, fileDate, fileS); |
412 | QPixmap pm; | 412 | QPixmap pm; |
413 | 413 | ||
414 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 414 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
415 | if( !QDir( fi->filePath() ).isReadable()) | 415 | if( !QDir( fi->filePath() ).isReadable()) |
416 | pm = Resource::loadPixmap( "lockedfolder" ); | 416 | pm = Resource::loadPixmap( "lockedfolder" ); |
417 | else | 417 | else |
418 | pm= Resource::loadPixmap( "folder" ); | 418 | pm= Resource::loadPixmap( "folder" ); |
419 | item->setPixmap( 0,pm ); | 419 | item->setPixmap( 0,pm ); |
420 | } else { | 420 | } else { |
421 | if( !fi->isReadable() ) | 421 | if( !fi->isReadable() ) |
422 | pm = Resource::loadPixmap( "locked" ); | 422 | pm = Resource::loadPixmap( "locked" ); |
423 | else { | 423 | else { |
424 | MimeType mt(fi->filePath()); | 424 | MimeType mt(fi->filePath()); |
425 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 425 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
426 | if(pm.isNull()) | 426 | if(pm.isNull()) |
427 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 427 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
428 | item->setPixmap( 0,pm); | 428 | item->setPixmap( 0,pm); |
429 | } | 429 | } |
430 | } | 430 | } |
431 | if( fileL.find("->",0,TRUE) != -1) { | 431 | if( fileL.find("->",0,TRUE) != -1) { |
432 | // overlay link image | 432 | // overlay link image |
433 | pm= Resource::loadPixmap( "folder" ); | 433 | pm= Resource::loadPixmap( "folder" ); |
434 | QPixmap lnk = Resource::loadPixmap( "symlink" ); | 434 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
435 | QPainter painter( &pm ); | 435 | QPainter painter( &pm ); |
436 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 436 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
437 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 437 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
438 | item->setPixmap( 0, pm); | 438 | item->setPixmap( 0, pm); |
439 | } | 439 | } |
440 | } isDir=FALSE; | 440 | } isDir=FALSE; |
441 | ++it; | 441 | ++it; |
442 | } | 442 | } |
443 | 443 | ||
444 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { | 444 | if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { |
445 | struct stat buf; | 445 | struct stat buf; |
446 | struct stat st; | 446 | struct stat st; |
447 | mode_t mode; | 447 | mode_t mode; |
448 | DIR *dir; | 448 | DIR *dir; |
449 | int fd = 0; | 449 | int fd = 0; |
450 | struct dirent *mydirent; | 450 | struct dirent *mydirent; |
451 | int i = 1; | 451 | int i = 1; |
452 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) | 452 | if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) |
453 | while ((mydirent = readdir(dir)) != NULL) { | 453 | while ((mydirent = readdir(dir)) != NULL) { |
454 | lstat( mydirent->d_name, &buf); | 454 | lstat( mydirent->d_name, &buf); |
455 | qDebug(mydirent->d_name); | 455 | qDebug(mydirent->d_name); |
456 | // mode = buf.st_mode; | 456 | // mode = buf.st_mode; |
457 | fileL.sprintf("%s", mydirent->d_name); | 457 | fileL.sprintf("%s", mydirent->d_name); |
458 | // fileS.sprintf("%d, %d", ); //this isn't correct | 458 | // fileS.sprintf("%d, %d", ); //this isn't correct |
459 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); | 459 | fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); |
460 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); | 460 | fileDate.sprintf("%s", ctime( &buf.st_mtime)); |
461 | if( fileL.find(".") == -1 ){ | 461 | if( fileL.find(".") == -1 ){ |
462 | item= new QListViewItem( Remote_View, fileL, fileDate, fileS); | 462 | item= new QListViewItem( Remote_View, fileL, fileDate, fileS); |
463 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 463 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
464 | item->setPixmap( 0,pm); | 464 | item->setPixmap( 0,pm); |
465 | } | 465 | } |
466 | } | 466 | } |
467 | 467 | ||
468 | closedir(dir); | 468 | closedir(dir); |
469 | } | 469 | } |
470 | 470 | ||
471 | Remote_View->setSorting( 3,FALSE); | 471 | Remote_View->setSorting( 3,FALSE); |
472 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); | 472 | fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); |
473 | } | 473 | } |
474 | 474 | ||
475 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) | 475 | void AdvancedFm::localListClicked(QListViewItem *selectedItem) |
476 | { | 476 | { |
477 | if(selectedItem) { | 477 | if(selectedItem) { |
478 | QString strItem=selectedItem->text(0); | 478 | QString strItem=selectedItem->text(0); |
479 | QString strSize=selectedItem->text(1); | 479 | QString strSize=selectedItem->text(1); |
480 | strSize=strSize.stripWhiteSpace(); | 480 | strSize=strSize.stripWhiteSpace(); |
481 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 481 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
482 | // is symlink | 482 | // is symlink |
483 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 483 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
484 | if(QDir(strItem2).exists() ) { | 484 | if(QDir(strItem2).exists() ) { |
485 | currentDir.cd(strItem2, TRUE); | 485 | currentDir.cd(strItem2, TRUE); |
486 | populateLocalView(); | 486 | populateLocalView(); |
487 | } | 487 | } |
488 | } else { // not a symlink | 488 | } else { // not a symlink |
489 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 489 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
490 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 490 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
491 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 491 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
492 | currentDir.cd(strItem,FALSE); | 492 | currentDir.cd(strItem,FALSE); |
493 | populateLocalView(); | 493 | populateLocalView(); |
494 | } else { | 494 | } else { |
495 | currentDir.cdUp(); | 495 | currentDir.cdUp(); |
496 | populateLocalView(); | 496 | populateLocalView(); |
497 | } | 497 | } |
498 | if(QDir(strItem).exists()){ | 498 | if(QDir(strItem).exists()){ |
499 | currentDir.cd(strItem, TRUE); | 499 | currentDir.cd(strItem, TRUE); |
500 | populateLocalView(); | 500 | populateLocalView(); |
501 | } | 501 | } |
502 | } else { | 502 | } else { |
503 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 503 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
504 | if( QFile::exists(strItem ) ) { | 504 | if( QFile::exists(strItem ) ) { |
505 | // qDebug("upload "+strItem); | 505 | // qDebug("upload "+strItem); |
506 | } | 506 | } |
507 | } //end not symlink | 507 | } //end not symlink |
508 | chdir(strItem.latin1()); | 508 | chdir(strItem.latin1()); |
509 | } | 509 | } |
510 | } | 510 | } |
511 | } | 511 | } |
512 | 512 | ||
513 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) | 513 | void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) |
514 | { | 514 | { |
515 | if(selectedItem) { | 515 | if(selectedItem) { |
516 | QString strItem=selectedItem->text(0); | 516 | QString strItem=selectedItem->text(0); |
517 | QString strSize=selectedItem->text(1); | 517 | QString strSize=selectedItem->text(1); |
518 | strSize=strSize.stripWhiteSpace(); | 518 | strSize=strSize.stripWhiteSpace(); |
519 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 519 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
520 | // is symlink | 520 | // is symlink |
521 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 521 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
522 | if(QDir(strItem2).exists() ) { | 522 | if(QDir(strItem2).exists() ) { |
523 | currentRemoteDir.cd(strItem2, TRUE); | 523 | currentRemoteDir.cd(strItem2, TRUE); |
524 | populateRemoteView(); | 524 | populateRemoteView(); |
525 | } | 525 | } |
526 | } else { // not a symlink | 526 | } else { // not a symlink |
527 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 527 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
528 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { | 528 | if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { |
529 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 529 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
530 | currentRemoteDir.cd(strItem,FALSE); | 530 | currentRemoteDir.cd(strItem,FALSE); |
531 | populateRemoteView(); | 531 | populateRemoteView(); |
532 | } else { | 532 | } else { |
533 | currentRemoteDir.cdUp(); | 533 | currentRemoteDir.cdUp(); |
534 | populateRemoteView(); | 534 | populateRemoteView(); |
535 | } | 535 | } |
536 | if(QDir(strItem).exists()){ | 536 | if(QDir(strItem).exists()){ |
537 | currentRemoteDir.cd(strItem, TRUE); | 537 | currentRemoteDir.cd(strItem, TRUE); |
538 | populateRemoteView(); | 538 | populateRemoteView(); |
539 | } | 539 | } |
540 | } else { | 540 | } else { |
541 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 541 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
542 | if( QFile::exists(strItem ) ) { | 542 | if( QFile::exists(strItem ) ) { |
543 | // qDebug("upload "+strItem); | 543 | // qDebug("upload "+strItem); |
544 | } | 544 | } |
545 | } //end not symlink | 545 | } //end not symlink |
546 | chdir(strItem.latin1()); | 546 | chdir(strItem.latin1()); |
547 | } | 547 | } |
548 | } | 548 | } |
549 | } | 549 | } |
550 | 550 | ||
551 | void AdvancedFm::doLocalCd() | 551 | void AdvancedFm::doLocalCd() |
552 | { | 552 | { |
553 | localListClicked( Local_View->currentItem()); | 553 | localListClicked( Local_View->currentItem()); |
554 | } | 554 | } |
555 | 555 | ||
556 | void AdvancedFm::doRemoteCd() | 556 | void AdvancedFm::doRemoteCd() |
557 | { | 557 | { |
558 | localListClicked( Remote_View->currentItem()); | 558 | localListClicked( Remote_View->currentItem()); |
559 | } | 559 | } |
560 | 560 | ||
561 | void AdvancedFm::showHidden() | 561 | void AdvancedFm::showHidden() |
562 | { | 562 | { |
563 | if (!b) { | 563 | if (!b) { |
564 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 564 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
565 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); | 565 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); |
566 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 566 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
567 | b=TRUE; | 567 | b=TRUE; |
568 | 568 | ||
569 | } else { | 569 | } else { |
570 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 570 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
571 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 571 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
572 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 572 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
573 | b=FALSE; | 573 | b=FALSE; |
574 | } | 574 | } |
575 | populateLocalView(); | 575 | populateLocalView(); |
576 | } | 576 | } |
577 | 577 | ||
578 | void AdvancedFm::showRemoteHidden() | 578 | void AdvancedFm::showRemoteHidden() |
579 | { | 579 | { |
580 | if (!b) { | 580 | if (!b) { |
581 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 581 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
582 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); | 582 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); |
583 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 583 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
584 | b=TRUE; | 584 | b=TRUE; |
585 | 585 | ||
586 | } else { | 586 | } else { |
587 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 587 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
588 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 588 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
589 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 589 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
590 | b=FALSE; | 590 | b=FALSE; |
591 | } | 591 | } |
592 | populateRemoteView(); | 592 | populateRemoteView(); |
593 | } | 593 | } |
594 | 594 | ||
595 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 595 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
596 | { | 596 | { |
597 | switch (mouse) { | 597 | switch (mouse) { |
598 | case 1: | 598 | case 1: |
599 | break; | 599 | break; |
600 | case 2: | 600 | case 2: |
601 | showLocalMenu(item); | 601 | showLocalMenu(item); |
602 | Local_View->clearSelection(); | 602 | Local_View->clearSelection(); |
603 | break; | 603 | break; |
604 | }; | 604 | }; |
605 | } | 605 | } |
606 | 606 | ||
607 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 607 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
608 | { | 608 | { |
609 | switch (mouse) { | 609 | switch (mouse) { |
610 | case 1: | 610 | case 1: |
611 | break; | 611 | break; |
612 | case 2: | 612 | case 2: |
613 | showRemoteMenu(item); | 613 | showRemoteMenu(item); |
614 | Remote_View->clearSelection(); | 614 | Remote_View->clearSelection(); |
615 | break; | 615 | break; |
616 | }; | 616 | }; |
617 | } | 617 | } |
618 | 618 | ||
619 | void AdvancedFm::showLocalMenu(QListViewItem * item) | 619 | void AdvancedFm::showLocalMenu(QListViewItem * item) |
620 | { | 620 | { |
621 | if(item) { | 621 | if(item) { |
622 | QPopupMenu m; | 622 | QPopupMenu m; |
623 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 623 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
624 | m.insertSeparator(); | 624 | m.insertSeparator(); |
625 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 625 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
626 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 626 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |