From f1aa2ce87342babb5bc002a8682f371bade91a2f Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 12 Nov 2014 12:34:12 -0500 Subject: A couple little bugfixes for lumina-fm: 1) Adjust the extension auto-add function to account for hidden files without an extension 2) Make sure the image/multimedia/snapshot checker is re-run in the background when the directory contents change. --- lumina-fm/MainUI.cpp | 22 ++++++++++++++++------ lumina-fm/MainUI.h | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'lumina-fm') diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index c70e3918..8712ebbb 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -175,7 +175,8 @@ void MainUI::setupConnections(){ connect(radio_view_details, SIGNAL(toggled(bool)), this, SLOT(viewModeChanged(bool)) ); connect(radio_view_list, SIGNAL(toggled(bool)), this, SLOT(viewModeChanged(bool)) ); connect(radio_view_icons, SIGNAL(toggled(bool)), this, SLOT(viewModeChanged(bool)) ); - + connect(fsmod, SIGNAL(directoryLoaded(QString)), this, SLOT(currentDirectoryLoaded()) ); + //Background worker class connect(this, SIGNAL(DirChanged(QString)), worker, SLOT(startDirChecks(QString)) ); connect(worker, SIGNAL(ImagesAvailable(QStringList)), this, SLOT(AvailablePictures(QStringList)) ); @@ -344,6 +345,7 @@ QString MainUI::getCurrentDir(){ void MainUI::setCurrentDir(QString dir){ if(dir.isEmpty()){ return; } QFileInfo info(dir); + QString olddir = currentDir->whatsThis(); if(!info.isDir() || !info.exists() ){ qDebug() << "Invalid Directory:" << dir; //Try to just go up the dir tree one level @@ -384,10 +386,9 @@ void MainUI::setCurrentDir(QString dir){ ui->tool_goToPlayer->setVisible(false); ui->tool_goToRestore->setVisible(false); ui->tool_goToImages->setVisible(false); - emit DirChanged(rawdir); - //QTimer::singleShot(0, this, SLOT(checkForMultimediaFiles())); - //QTimer::singleShot(0, this, SLOT(checkForBackups())); - //QTimer::singleShot(0, this, SLOT(checkForPictures())); + if(olddir==rawdir){ + emit DirChanged(rawdir); //This will be automatically run when a new dir is loaded + } if(isUserWritable){ ui->label_dir_stats->setText(""); } else{ ui->label_dir_stats->setText(tr("Limited Access Directory")); } ui->tool_addToDir->setVisible(isUserWritable); @@ -765,6 +766,14 @@ void MainUI::reloadDirectory(){ setCurrentDir( getCurrentDir() ); } +void MainUI::currentDirectoryLoaded(){ + //The directory was just loaded: refresh the action buttons as neccesary + ui->tool_goToPlayer->setVisible(false); + ui->tool_goToRestore->setVisible(false); + ui->tool_goToImages->setVisible(false); + emit DirChanged(getCurrentDir()); +} + void MainUI::on_tool_addToDir_clicked(){ bool ok = false; QString newdir = QInputDialog::getText(this, tr("New Directory"), tr("Name:"), QLineEdit::Normal, "", \ @@ -1173,7 +1182,8 @@ void MainUI::RenameItem(){ if(!ok || nname.isEmpty()){ CItem.clear(); return; } //cancelled //Now check for a file extension and add it if necessary QString oext = fname.section(".",-1); - if(oext==fname){ oext.clear(); } //no extension + if("."+oext == fname){ oext.clear(); } //hidden file without an extension + else if(oext==fname){ oext.clear(); } //no extension QString next = nname.section(".",-1); if(next==nname){ next.clear(); } //no extension if(next.isEmpty() && !oext.isEmpty()){ diff --git a/lumina-fm/MainUI.h b/lumina-fm/MainUI.h index 61e34ffe..87a52668 100644 --- a/lumina-fm/MainUI.h +++ b/lumina-fm/MainUI.h @@ -156,6 +156,7 @@ private slots: void startEditDir(QWidget *old, QWidget *now); void goToDirectory(); //go to a manually typed in directory void reloadDirectory(); //Update the widget with the dir contents + void currentDirectoryLoaded(); //The file system model re-loaded the directory void on_tool_addToDir_clicked(); void tabChanged(int tab); void tabClosed(int tab = -1); -- cgit