forked from qt-creator/qt-creator
Core: FileSystemFilter code cosmetics
Namespaces. Change-Id: Iaab4a85a5dbc6a4dd6571d3705f6b7362b47762e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -44,10 +44,11 @@
|
||||
#include <QPushButton>
|
||||
#include <QRegularExpression>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Core::Internal;
|
||||
using namespace Utils;
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
|
||||
ILocatorFilter::MatchLevel FileSystemFilter::matchLevelFor(const QRegularExpressionMatch &match,
|
||||
const QString &matchText)
|
||||
{
|
||||
@@ -159,8 +160,7 @@ QList<LocatorFilterEntry> FileSystemFilter::matchesFor(QFutureInterface<LocatorF
|
||||
tr("Create and Open \"%1\"").arg(entry),
|
||||
fullFilePath);
|
||||
createAndOpen.filePath = FilePath::fromString(fullFilePath);
|
||||
createAndOpen.extraInfo = Utils::FilePath::fromString(dirInfo.absolutePath())
|
||||
.shortNativePath();
|
||||
createAndOpen.extraInfo = FilePath::fromString(dirInfo.absolutePath()).shortNativePath();
|
||||
entries[int(MatchLevel::Normal)].append(createAndOpen);
|
||||
}
|
||||
|
||||
@@ -186,13 +186,13 @@ void FileSystemFilter::accept(LocatorFilterEntry selection,
|
||||
QMetaObject::invokeMethod(EditorManager::instance(), [info, selection] {
|
||||
const QString targetFile = selection.internalData.toString();
|
||||
if (!info.exists()) {
|
||||
if (Utils::CheckableMessageBox::shouldAskAgain(ICore::settings(), kAlwaysCreate)) {
|
||||
Utils::CheckableMessageBox messageBox(ICore::dialogParent());
|
||||
if (CheckableMessageBox::shouldAskAgain(ICore::settings(), kAlwaysCreate)) {
|
||||
CheckableMessageBox messageBox(ICore::dialogParent());
|
||||
messageBox.setWindowTitle(tr("Create File"));
|
||||
messageBox.setIcon(QMessageBox::Question);
|
||||
messageBox.setText(
|
||||
tr("Create \"%1\"?")
|
||||
.arg(Utils::FilePath::fromString(targetFile).shortNativePath()));
|
||||
.arg(FilePath::fromString(targetFile).shortNativePath()));
|
||||
messageBox.setCheckBoxVisible(true);
|
||||
messageBox.setCheckBoxText(tr("Always create"));
|
||||
messageBox.setChecked(false);
|
||||
@@ -204,7 +204,7 @@ void FileSystemFilter::accept(LocatorFilterEntry selection,
|
||||
if (messageBox.clickedButton() != createButton)
|
||||
return;
|
||||
if (messageBox.isChecked())
|
||||
Utils::CheckableMessageBox::doNotAskAgain(ICore::settings(), kAlwaysCreate);
|
||||
CheckableMessageBox::doNotAskAgain(ICore::settings(), kAlwaysCreate);
|
||||
}
|
||||
QFile file(targetFile);
|
||||
file.open(QFile::WriteOnly);
|
||||
@@ -273,3 +273,6 @@ void FileSystemFilter::restoreState(const QByteArray &state)
|
||||
ILocatorFilter::restoreState(state);
|
||||
}
|
||||
}
|
||||
|
||||
} // Internal
|
||||
} // Core
|
||||
|
Reference in New Issue
Block a user