Changeset 08438b40


Ignore:
Timestamp:
06/23/14 19:51:11 (13 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, enter/10, releng/10.0.3, releng/10.1, releng/10.1.1, releng/10.1.2
Children:
bb3f61c
Parents:
060b819
Message:

Clean up the directory searching and recursive removal in lumina-fm

Location:
lumina/lumina-fm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lumina/lumina-fm/FODialog.cpp

    rb3b08221 r08438b40  
    6969    //Now recursively add any subdirectories and their contents 
    7070    QStringList subdirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::NoSort); 
    71     for(int i=0; i<subdirs.length(); i++){ out << subfiles(subdirs[i]); } 
     71    for(int i=0; i<subdirs.length(); i++){ out << subfiles(dir.absoluteFilePath(subdirs[i])); } 
    7272  } 
    7373  out << dirpath; //always put the parent directory after all the contents 
     
    9090  QStringList err;       
    9191  for(int i=0; i<items.length(); i++){ 
    92     if(QFileInfo(items[i]).isDir()){ 
     92    if(items[i]==path){ 
    9393      QDir dir; 
    94       if( !dir.rmdir(items[i]) ){ err << items[i]; } 
     94      if( !dir.rmdir(items[i]) ){ err << items[i]; }         
     95    }else if(QFileInfo(items[i]).isDir()){ 
     96      err << removeItem(items[i]); 
    9597    }else{ 
    9698      if( !QFile::remove(items[i]) ){ err << items[i]; } 
  • lumina/lumina-fm/MainUI.cpp

    r603a75a r08438b40  
    3030    ui->tree_dir_view->setContextMenuPolicy(Qt::CustomContextMenu); 
    3131  dirCompleter = new QCompleter(fsmod, this); 
     32    dirCompleter->setModelSorting( QCompleter::CaseInsensitivelySortedModel ); 
    3233    currentDir->setCompleter(dirCompleter); 
    3334  snapmod = new QFileSystemModel(this); 
     
    185186  if(!info.isDir() || !info.exists() ){  
    186187    qDebug() << "Invalid Directory:" << dir; 
    187     return;  
     188    //Try to just go up the dir tree one level 
     189    dir.chop(dir.section("/",-1).length()); 
     190    if(!QFile::exists(dir)){ 
     191      //Still bad dir - try to return to previously shown dir 
     192      if(currentDir->whatsThis().isEmpty()){ return; } //nothing to return to 
     193      else{ dir = currentDir->whatsThis(); } 
     194    } 
    188195  } //do nothing 
    189196  //qDebug() << "Show Directory:" << dir; 
     
    194201  //Update the directory viewer and update the line edit 
    195202  ui->tree_dir_view->setRootIndex( fsmod->setRootPath(dir) ); 
    196   dir.replace(QDir::homePath()+"/", "~/"); 
     203  //dir.replace(QDir::homePath()+"/", "~/"); 
    197204  currentDir->setText(dir); 
    198205  //Adjust the tab data 
     
    441448  }else if(old==currentDir){ 
    442449    QString dir = currentDir->text(); 
    443       dir.replace(QDir::homePath()+"/", "~/"); 
    444       currentDir->setText(dir); 
     450      setCurrentDir(dir); 
    445451  } 
    446452} 
Note: See TracChangeset for help on using the changeset viewer.