Browse Source

Fix 'Open Containing Folder' on unselected file.

adaptive-webui-19844
sledgehammer999 10 years ago
parent
commit
94ae9544d8
  1. 23
      src/properties/propertieswidget.cpp

23
src/properties/propertieswidget.cpp

@ -446,29 +446,20 @@ void PropertiesWidget::openFile(const QModelIndex &index) { @@ -446,29 +446,20 @@ void PropertiesWidget::openFile(const QModelIndex &index) {
void PropertiesWidget::openFolder(const QModelIndex &index, bool containing_folder) {
// FOLDER
QStringList path_items;
path_items << index.data().toString();
QModelIndex parent = PropListModel->parent(index);
while(parent.isValid()) {
path_items.prepend(parent.data().toString());
parent = PropListModel->parent(parent);
}
if (path_items.isEmpty())
return;
int i = PropListModel->getFileIndex(index);
const QDir saveDir(h.save_path());
const QString filename = h.filepath_at(i);
const QString file_path = fsutils::expandPath(saveDir.absoluteFilePath(filename));
#if !(defined(Q_OS_WIN) || (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)))
if (containing_folder)
path_items.removeLast();
file_path = fsutils::folderName(file_path);
#endif
const QDir saveDir(h.save_path());
const QString filename = path_items.join("/");
// Flush data
h.flush_cache();
QString file_path = fsutils::expandPath(saveDir.absoluteFilePath(filename));
if (QFile::exists(file_path + ".!qB"))
file_path += ".!qB";
if (!QFile::exists(file_path))
return;
qDebug("Trying to open folder at %s", qPrintable(file_path));
#ifdef Q_OS_WIN

Loading…
Cancel
Save