forked from qt-creator/qt-creator
Core: Always use dialogParent() for FileUtils::showInGraphicalShell()
Change-Id: I02b0ded14c78872b59bd9ec4cfb53878d3f96ad5 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -826,7 +826,7 @@ void AndroidBuildApkStep::showInGraphicalShell()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Core::FileUtils::showInGraphicalShell(Core::ICore::dialogParent(), packagePath);
|
Core::FileUtils::showInGraphicalShell(packagePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *AndroidBuildApkStep::createConfigWidget()
|
QWidget *AndroidBuildApkStep::createConfigWidget()
|
||||||
|
@@ -204,7 +204,7 @@ static void addToPathChooserContextMenu(PathChooser *pathChooser, QMenu *menu)
|
|||||||
if (pathChooser->filePath().exists()) {
|
if (pathChooser->filePath().exists()) {
|
||||||
auto showInGraphicalShell = new QAction(FileUtils::msgGraphicalShellAction(), menu);
|
auto showInGraphicalShell = new QAction(FileUtils::msgGraphicalShellAction(), menu);
|
||||||
QObject::connect(showInGraphicalShell, &QAction::triggered, pathChooser, [pathChooser] {
|
QObject::connect(showInGraphicalShell, &QAction::triggered, pathChooser, [pathChooser] {
|
||||||
Core::FileUtils::showInGraphicalShell(pathChooser, pathChooser->filePath());
|
Core::FileUtils::showInGraphicalShell(pathChooser->filePath());
|
||||||
});
|
});
|
||||||
menu->insertAction(firstAction, showInGraphicalShell);
|
menu->insertAction(firstAction, showInGraphicalShell);
|
||||||
|
|
||||||
|
@@ -518,7 +518,7 @@ void EditorManagerPrivate::init()
|
|||||||
return;
|
return;
|
||||||
const FilePath fp = EditorManager::currentDocument()->filePath();
|
const FilePath fp = EditorManager::currentDocument()->filePath();
|
||||||
if (!fp.isEmpty())
|
if (!fp.isEmpty())
|
||||||
FileUtils::showInGraphicalShell(ICore::dialogParent(), fp);
|
FileUtils::showInGraphicalShell(fp);
|
||||||
});
|
});
|
||||||
|
|
||||||
ActionBuilder showInFileSystem(this, Constants::SHOWINFILESYSTEMVIEW);
|
ActionBuilder showInFileSystem(this, Constants::SHOWINFILESYSTEMVIEW);
|
||||||
@@ -560,7 +560,7 @@ void EditorManagerPrivate::init()
|
|||||||
connect(m_openGraphicalShellContextAction, &QAction::triggered, this, [this] {
|
connect(m_openGraphicalShellContextAction, &QAction::triggered, this, [this] {
|
||||||
if (!m_contextMenuDocument || m_contextMenuEntry->filePath().isEmpty())
|
if (!m_contextMenuDocument || m_contextMenuEntry->filePath().isEmpty())
|
||||||
return;
|
return;
|
||||||
FileUtils::showInGraphicalShell(ICore::dialogParent(), m_contextMenuEntry->filePath());
|
FileUtils::showInGraphicalShell(m_contextMenuEntry->filePath());
|
||||||
});
|
});
|
||||||
connect(m_showInFileSystemViewContextAction, &QAction::triggered, this, [this] {
|
connect(m_showInFileSystemViewContextAction, &QAction::triggered, this, [this] {
|
||||||
if (!m_contextMenuDocument || m_contextMenuEntry->filePath().isEmpty())
|
if (!m_contextMenuDocument || m_contextMenuEntry->filePath().isEmpty())
|
||||||
|
@@ -55,21 +55,21 @@ static FilePath windowsDirectory()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show error with option to open settings.
|
// Show error with option to open settings.
|
||||||
static void showGraphicalShellError(QWidget *parent, const QString &app, const QString &error)
|
static void showGraphicalShellError(const QString &app, const QString &error)
|
||||||
{
|
{
|
||||||
const QString title = Tr::tr("Launching a file browser failed");
|
const QString title = Tr::tr("Launching a file browser failed");
|
||||||
const QString msg = Tr::tr("Unable to start the file manager:\n\n%1\n\n").arg(app);
|
const QString msg = Tr::tr("Unable to start the file manager:\n\n%1\n\n").arg(app);
|
||||||
QMessageBox mbox(QMessageBox::Warning, title, msg, QMessageBox::Close, parent);
|
QMessageBox mbox(QMessageBox::Warning, title, msg, QMessageBox::Close, ICore::dialogParent());
|
||||||
if (!error.isEmpty())
|
if (!error.isEmpty())
|
||||||
mbox.setDetailedText(Tr::tr("\"%1\" returned the following error:\n\n%2").arg(app, error));
|
mbox.setDetailedText(Tr::tr("\"%1\" returned the following error:\n\n%2").arg(app, error));
|
||||||
QAbstractButton *settingsButton = mbox.addButton(Core::ICore::msgShowOptionsDialog(),
|
QAbstractButton *settingsButton = mbox.addButton(Core::ICore::msgShowOptionsDialog(),
|
||||||
QMessageBox::ActionRole);
|
QMessageBox::ActionRole);
|
||||||
mbox.exec();
|
mbox.exec();
|
||||||
if (mbox.clickedButton() == settingsButton)
|
if (mbox.clickedButton() == settingsButton)
|
||||||
ICore::showOptionsDialog(Constants::SETTINGS_ID_INTERFACE, parent);
|
ICore::showOptionsDialog(Constants::SETTINGS_ID_INTERFACE, ICore::dialogParent());
|
||||||
}
|
}
|
||||||
|
|
||||||
void showInGraphicalShell(QWidget *parent, const FilePath &pathIn)
|
void showInGraphicalShell(const FilePath &pathIn)
|
||||||
{
|
{
|
||||||
const QFileInfo fileInfo = pathIn.toFileInfo();
|
const QFileInfo fileInfo = pathIn.toFileInfo();
|
||||||
// Mac, Windows support folder or file.
|
// Mac, Windows support folder or file.
|
||||||
@@ -98,7 +98,7 @@ void showInGraphicalShell(QWidget *parent, const FilePath &pathIn)
|
|||||||
error = Tr::tr("Error while starting file browser.");
|
error = Tr::tr("Error while starting file browser.");
|
||||||
}
|
}
|
||||||
if (!error.isEmpty())
|
if (!error.isEmpty())
|
||||||
showGraphicalShellError(parent, app, error);
|
showGraphicalShellError(app, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,10 +7,6 @@
|
|||||||
|
|
||||||
#include <utils/filepath.h>
|
#include <utils/filepath.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QWidget;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Utils { class Environment; }
|
namespace Utils { class Environment; }
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
@@ -20,7 +16,7 @@ enum class HandleIncludeGuards { No, Yes };
|
|||||||
namespace FileUtils {
|
namespace FileUtils {
|
||||||
|
|
||||||
// Helpers for common directory browser options.
|
// Helpers for common directory browser options.
|
||||||
CORE_EXPORT void showInGraphicalShell(QWidget *parent, const Utils::FilePath &path);
|
CORE_EXPORT void showInGraphicalShell(const Utils::FilePath &path);
|
||||||
CORE_EXPORT void showInFileSystemView(const Utils::FilePath &path);
|
CORE_EXPORT void showInFileSystemView(const Utils::FilePath &path);
|
||||||
CORE_EXPORT void openTerminal(const Utils::FilePath &path, const Utils::Environment &env);
|
CORE_EXPORT void openTerminal(const Utils::FilePath &path, const Utils::Environment &env);
|
||||||
CORE_EXPORT QString msgFindInDirectory();
|
CORE_EXPORT QString msgFindInDirectory();
|
||||||
|
@@ -2539,9 +2539,9 @@ void ICorePrivate::changeLog()
|
|||||||
connect(showInExplorer, &QPushButton::clicked, this, [versionCombo, versionedFiles] {
|
connect(showInExplorer, &QPushButton::clicked, this, [versionCombo, versionedFiles] {
|
||||||
const int index = versionCombo->currentIndex();
|
const int index = versionCombo->currentIndex();
|
||||||
if (index >= 0 && index < versionedFiles.size())
|
if (index >= 0 && index < versionedFiles.size())
|
||||||
FileUtils::showInGraphicalShell(ICore::dialogParent(), versionedFiles.at(index).second);
|
FileUtils::showInGraphicalShell(versionedFiles.at(index).second);
|
||||||
else
|
else
|
||||||
FileUtils::showInGraphicalShell(ICore::dialogParent(), ICore::resourcePath("changelog"));
|
FileUtils::showInGraphicalShell(ICore::resourcePath("changelog"));
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog->show();
|
dialog->show();
|
||||||
|
@@ -3795,7 +3795,7 @@ void ProjectExplorerPluginPrivate::showInGraphicalShell()
|
|||||||
{
|
{
|
||||||
Node *currentNode = ProjectTree::currentNode();
|
Node *currentNode = ProjectTree::currentNode();
|
||||||
QTC_ASSERT(currentNode, return);
|
QTC_ASSERT(currentNode, return);
|
||||||
Core::FileUtils::showInGraphicalShell(ICore::dialogParent(), currentNode->path());
|
Core::FileUtils::showInGraphicalShell(currentNode->path());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPluginPrivate::showInFileSystemPane()
|
void ProjectExplorerPluginPrivate::showInFileSystemPane()
|
||||||
|
@@ -92,7 +92,7 @@ AssetExportDialog::AssetExportDialog(const FilePath &exportPath,
|
|||||||
m_exportPath->setPromptDialogFilter(tr("Metadata file (*.metadata)"));
|
m_exportPath->setPromptDialogFilter(tr("Metadata file (*.metadata)"));
|
||||||
m_exportPath->lineEdit()->setReadOnly(true);
|
m_exportPath->lineEdit()->setReadOnly(true);
|
||||||
m_exportPath->addButton(tr("Open"), this, [this] {
|
m_exportPath->addButton(tr("Open"), this, [this] {
|
||||||
Core::FileUtils::showInGraphicalShell(Core::ICore::dialogParent(), m_exportPath->filePath());
|
Core::FileUtils::showInGraphicalShell(m_exportPath->filePath());
|
||||||
});
|
});
|
||||||
|
|
||||||
m_exportAssetsCheck = new QCheckBox(tr("Export assets"), this);
|
m_exportAssetsCheck = new QCheckBox(tr("Export assets"), this);
|
||||||
|
@@ -221,7 +221,7 @@ bool AssetsLibraryWidget::canCreateEffects() const
|
|||||||
|
|
||||||
void AssetsLibraryWidget::showInGraphicalShell(const QString &path)
|
void AssetsLibraryWidget::showInGraphicalShell(const QString &path)
|
||||||
{
|
{
|
||||||
Core::FileUtils::showInGraphicalShell(Core::ICore::dialogParent(), Utils::FilePath::fromString(path));
|
Core::FileUtils::showInGraphicalShell(Utils::FilePath::fromString(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AssetsLibraryWidget::showInGraphicalShellMsg() const
|
QString AssetsLibraryWidget::showInGraphicalShellMsg() const
|
||||||
|
Reference in New Issue
Block a user