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 <QPushButton>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
|
||||||
using namespace Core;
|
|
||||||
using namespace Core::Internal;
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
ILocatorFilter::MatchLevel FileSystemFilter::matchLevelFor(const QRegularExpressionMatch &match,
|
ILocatorFilter::MatchLevel FileSystemFilter::matchLevelFor(const QRegularExpressionMatch &match,
|
||||||
const QString &matchText)
|
const QString &matchText)
|
||||||
{
|
{
|
||||||
@@ -159,8 +160,7 @@ QList<LocatorFilterEntry> FileSystemFilter::matchesFor(QFutureInterface<LocatorF
|
|||||||
tr("Create and Open \"%1\"").arg(entry),
|
tr("Create and Open \"%1\"").arg(entry),
|
||||||
fullFilePath);
|
fullFilePath);
|
||||||
createAndOpen.filePath = FilePath::fromString(fullFilePath);
|
createAndOpen.filePath = FilePath::fromString(fullFilePath);
|
||||||
createAndOpen.extraInfo = Utils::FilePath::fromString(dirInfo.absolutePath())
|
createAndOpen.extraInfo = FilePath::fromString(dirInfo.absolutePath()).shortNativePath();
|
||||||
.shortNativePath();
|
|
||||||
entries[int(MatchLevel::Normal)].append(createAndOpen);
|
entries[int(MatchLevel::Normal)].append(createAndOpen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,13 +186,13 @@ void FileSystemFilter::accept(LocatorFilterEntry selection,
|
|||||||
QMetaObject::invokeMethod(EditorManager::instance(), [info, selection] {
|
QMetaObject::invokeMethod(EditorManager::instance(), [info, selection] {
|
||||||
const QString targetFile = selection.internalData.toString();
|
const QString targetFile = selection.internalData.toString();
|
||||||
if (!info.exists()) {
|
if (!info.exists()) {
|
||||||
if (Utils::CheckableMessageBox::shouldAskAgain(ICore::settings(), kAlwaysCreate)) {
|
if (CheckableMessageBox::shouldAskAgain(ICore::settings(), kAlwaysCreate)) {
|
||||||
Utils::CheckableMessageBox messageBox(ICore::dialogParent());
|
CheckableMessageBox messageBox(ICore::dialogParent());
|
||||||
messageBox.setWindowTitle(tr("Create File"));
|
messageBox.setWindowTitle(tr("Create File"));
|
||||||
messageBox.setIcon(QMessageBox::Question);
|
messageBox.setIcon(QMessageBox::Question);
|
||||||
messageBox.setText(
|
messageBox.setText(
|
||||||
tr("Create \"%1\"?")
|
tr("Create \"%1\"?")
|
||||||
.arg(Utils::FilePath::fromString(targetFile).shortNativePath()));
|
.arg(FilePath::fromString(targetFile).shortNativePath()));
|
||||||
messageBox.setCheckBoxVisible(true);
|
messageBox.setCheckBoxVisible(true);
|
||||||
messageBox.setCheckBoxText(tr("Always create"));
|
messageBox.setCheckBoxText(tr("Always create"));
|
||||||
messageBox.setChecked(false);
|
messageBox.setChecked(false);
|
||||||
@@ -204,7 +204,7 @@ void FileSystemFilter::accept(LocatorFilterEntry selection,
|
|||||||
if (messageBox.clickedButton() != createButton)
|
if (messageBox.clickedButton() != createButton)
|
||||||
return;
|
return;
|
||||||
if (messageBox.isChecked())
|
if (messageBox.isChecked())
|
||||||
Utils::CheckableMessageBox::doNotAskAgain(ICore::settings(), kAlwaysCreate);
|
CheckableMessageBox::doNotAskAgain(ICore::settings(), kAlwaysCreate);
|
||||||
}
|
}
|
||||||
QFile file(targetFile);
|
QFile file(targetFile);
|
||||||
file.open(QFile::WriteOnly);
|
file.open(QFile::WriteOnly);
|
||||||
@@ -273,3 +273,6 @@ void FileSystemFilter::restoreState(const QByteArray &state)
|
|||||||
ILocatorFilter::restoreState(state);
|
ILocatorFilter::restoreState(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // Internal
|
||||||
|
} // Core
|
||||||
|
Reference in New Issue
Block a user