aboutsummaryrefslogtreecommitdiff
path: root/lumina-fm/widgets/DirWidget.cpp
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-10-08 11:21:38 -0400
committerKen Moore <moorekou@gmail.com>2015-10-08 11:21:38 -0400
commit13d170e92dc2c8c649956ac5af9800172fbfd4f9 (patch)
tree6b240c998aee9125c7d167f526cb6c17808cac88 /lumina-fm/widgets/DirWidget.cpp
parentAdd a hidden option to lumina-open to test the crash handler (-testcrash). Th... (diff)
downloadlumina-13d170e92dc2c8c649956ac5af9800172fbfd4f9.tar.gz
lumina-13d170e92dc2c8c649956ac5af9800172fbfd4f9.tar.bz2
lumina-13d170e92dc2c8c649956ac5af9800172fbfd4f9.zip
Ensure that item selection is preserved when switching between basic/detailed list modes in lumina-fm.
Diffstat (limited to 'lumina-fm/widgets/DirWidget.cpp')
-rw-r--r--lumina-fm/widgets/DirWidget.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lumina-fm/widgets/DirWidget.cpp b/lumina-fm/widgets/DirWidget.cpp
index ccca4c17..728adc96 100644
--- a/lumina-fm/widgets/DirWidget.cpp
+++ b/lumina-fm/widgets/DirWidget.cpp
@@ -98,6 +98,10 @@ QString DirWidget::currentDir(){
}
void DirWidget::setShowDetails(bool show){
+ if(show!=showDetails){
+ //View about to change - ensure the selection gets transferred too
+ tmpSel = currentSelection();
+ }
showDetails = show;
listWidget->setVisible(!showDetails);
treeWidget->setVisible(showDetails);
@@ -383,6 +387,7 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
}
}
if(addnew){ treeWidget->addTopLevelItem(it); }
+ if(tmpSel.contains(list[i].absoluteFilePath())){ it->setSelected(true); }
if(lastdir == CDIR+"/"+list[i].fileName()){
treeWidget->setCurrentItem(it);
treeWidget->scrollToItem(it);
@@ -412,6 +417,7 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
it->setIcon(LXDG::findIcon(list[i].iconfile(),"unknown") );
}
listWidget->addItem(it);
+ if(tmpSel.contains(list[i].absoluteFilePath())){ it->setSelected(true); }
if(lastdir == CDIR+"/"+list[i].fileName()){
listWidget->setCurrentItem(it);
listWidget->scrollToItem(it);
@@ -420,6 +426,7 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){
if(i%15==0){ QApplication::processEvents(); }//keep the UI snappy while loading a directory
if(DEBUG){ qDebug() << " - item finished:" << i << time.elapsed(); }
}
+ tmpSel.clear();
if(DEBUG){ qDebug() << "Done with item loop:" << time.elapsed() << list.length(); }
ui->actionStopLoad->setVisible(false);
//Another check to ensure the current item is visible (or return to the same scroll position)
bgstack15