diff options
author | Ken Moore <ken@pcbsd.org> | 2015-03-14 08:19:59 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-03-14 08:19:59 -0400 |
commit | 3d88cde77119b30e9dba0dedb0afabeba8c68362 (patch) | |
tree | 3a119ca9fe8e49986b6a4cbb14ef955920e2e887 /lumina-fm/MainUI.cpp | |
parent | Revert the previous update with regards to the removal of broken "favorite" s... (diff) | |
download | lumina-3d88cde77119b30e9dba0dedb0afabeba8c68362.tar.gz lumina-3d88cde77119b30e9dba0dedb0afabeba8c68362.tar.bz2 lumina-3d88cde77119b30e9dba0dedb0afabeba8c68362.zip |
Allow the favoriting of files in lumina-fm that do *not* conflict with a currently-active favorite with the same name. If the current favorite is stale/broken - go ahead and replace it with the new one.
Diffstat (limited to 'lumina-fm/MainUI.cpp')
-rw-r--r-- | lumina-fm/MainUI.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index 8ac468a0..1576e65a 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -973,7 +973,17 @@ void MainUI::ItemSelectionChanged(){ } QString itname; if(sel.length()==1){ itname = sel[0].fileName(); } - ui->tool_act_fav->setEnabled(!itname.isEmpty() && !QFile::exists(favdir+itname) ); + bool ok = !itname.isEmpty() && (getCurrentDir()!=QDir::homePath()+"/Desktop"); + if(ok){ + if(QFile::exists(favdir+itname)){ + //Make sure this favorite does not already point to the current file + QFileInfo info(favdir+itname); + if(info.isSymLink() && info.exists()){ + ok = false; //still an active favorite - do not allow replacement + } + } + } + ui->tool_act_fav->setEnabled(ok); } //------------------------------- @@ -1365,6 +1375,7 @@ void MainUI::FavoriteItem(){ QString fname = CItem; QString fullpath = fname; fname = fname.section("/",-1); //turn this into just the file name + if(QFile::exists(favdir+fname)){ QFile::remove(favdir+fname); } //remove the stale link QFile::link(fullpath, favdir+fname); CItem.clear(); ItemSelectionChanged(); |