Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
3724b59e
Commit
3724b59e
authored
Sep 07, 2010
by
Morten Engvoldsen
Browse files
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
parents
f5297643
26f5aaef
Changes
33
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/coreconstants.h
View file @
3724b59e
...
...
@@ -246,6 +246,8 @@ const char * const SETTINGS_CATEGORY_CORE_ICON = ":/core/images/category_core.pn
const
char
*
const
SETTINGS_TR_CATEGORY_CORE
=
QT_TRANSLATE_NOOP
(
"Core"
,
"Environment"
);
const
char
*
const
SETTINGS_ID_ENVIRONMENT
=
"A.General"
;
const
char
*
const
ALL_FILES_FILTER
=
QT_TRANSLATE_NOOP
(
"Core"
,
"All Files (*)"
);
const
int
TARGET_ICON_SIZE
=
32
;
}
// namespace Constants
...
...
src/plugins/coreplugin/dialogs/shortcutsettings.cpp
View file @
3724b59e
...
...
@@ -264,8 +264,7 @@ void ShortcutSettings::exportAction()
QString
fileName
=
ICore
::
instance
()
->
fileManager
()
->
getSaveFileNameWithExtension
(
tr
(
"Export Keyboard Mapping Scheme"
),
ICore
::
instance
()
->
resourcePath
()
+
"/schemes/"
,
tr
(
"Keyboard Mapping Scheme (*.kms)"
),
".kms"
);
tr
(
"Keyboard Mapping Scheme (*.kms)"
));
if
(
!
fileName
.
isEmpty
())
{
CommandsFile
cf
(
fileName
);
cf
.
exportCommands
(
m_scitems
);
...
...
src/plugins/coreplugin/editormanager/editormanager.cpp
View file @
3724b59e
...
...
@@ -77,6 +77,8 @@
#include <QtGui/QSplitter>
#include <QtGui/QStackedLayout>
#include <algorithm>
Q_DECLARE_METATYPE
(
Core
::
IEditor
*
)
enum
{
debugEditorManager
=
0
};
...
...
@@ -208,9 +210,6 @@ struct EditorManagerPrivate {
QMap
<
QString
,
QVariant
>
m_editorStates
;
Internal
::
OpenEditorsViewFactory
*
m_openEditorsFactory
;
QString
fileFilters
;
QString
selectedFilter
;
OpenEditorsModel
*
m_editorModel
;
QString
m_externalEditor
;
...
...
@@ -1152,33 +1151,28 @@ QString EditorManager::getOpenWithEditorId(const QString &fileName,
return
selectedId
;
}
static
QString
formatFileFilters
(
const
Core
::
ICore
*
core
,
QString
*
selectedFilter
)
static
QString
formatFileFilters
(
const
Core
::
ICore
*
core
,
QString
*
selectedFilter
=
0
)
{
QString
rc
;
if
(
selectedFilter
)
selectedFilter
->
clear
();
// Compile list of filter strings
// Compile list of filter strings, sort, and remove duplicates (different mime types might
// generate the same filter).
QStringList
filters
=
core
->
mimeDatabase
()
->
filterStrings
();
filters
.
sort
();
selectedFilter
->
clear
();
if
(
filters
.
empty
())
return
rc
;
return
QString
();
filters
.
sort
();
filters
.
erase
(
std
::
unique
(
filters
.
begin
(),
filters
.
end
()),
filters
.
end
());
const
QString
filterSeparator
=
QLatin1String
(
";;"
);
foreach
(
const
QString
&
filterString
,
filters
)
{
if
(
!
rc
.
isEmpty
())
rc
+=
filterSeparator
;
rc
+=
filterString
;
}
static
const
QString
allFilesFilter
=
QCoreApplication
::
translate
(
"Core"
,
Constants
::
ALL_FILES_FILTER
);
if
(
selectedFilter
)
*
selectedFilter
=
allFilesFilter
;
// prepend all files filter
// prepending instead of appending to work around a bug in Qt/Mac
QString
allFilesFilter
=
EditorManager
::
tr
(
"All Files (*)"
);
if
(
!
rc
.
isEmpty
())
allFilesFilter
+=
filterSeparator
;
rc
.
prepend
(
allFilesFilter
);
*
selectedFilter
=
allFilesFilter
;
// Prepend all files filter (instead of appending to work around a bug in Qt/Mac).
filters
.
prepend
(
allFilesFilter
);
return
rc
;
return
filters
.
join
(
QLatin1String
(
";;"
))
;
}
IEditor
*
EditorManager
::
openEditor
(
const
QString
&
fileName
,
const
QString
&
editorId
,
...
...
@@ -1244,10 +1238,10 @@ bool EditorManager::openExternalEditor(const QString &fileName, const QString &e
QStringList
EditorManager
::
getOpenFileNames
()
const
{
if
(
m_d
->
fileFilters
.
isEmpty
())
m_d
->
fileFilters
=
formatFileFilters
(
m_d
->
m_core
,
&
m_d
->
selectedFilter
);
return
ICore
::
instance
()
->
fileManager
()
->
getOpenFileNames
(
m_d
->
fileFilters
,
QString
(),
&
m_d
->
selectedFilter
);
QString
selectedFilter
;
const
QString
&
fileFilters
=
formatFileFilters
(
m_d
->
m_core
,
&
selectedFilter
);
return
ICore
::
instance
()
->
fileManager
()
->
getOpenFileNames
(
fileFilters
,
QString
(),
&
selectedFilter
);
}
...
...
@@ -1475,23 +1469,35 @@ bool EditorManager::saveFileAs(IEditor *editor)
if
(
!
editor
)
return
false
;
QString
absoluteFilePath
=
m_d
->
m_core
->
fileManager
()
->
getSaveAsFileName
(
editor
->
file
());
IFile
*
file
=
editor
->
file
();
const
QString
&
filter
=
formatFileFilters
(
m_d
->
m_core
);
QString
selectedFilter
=
m_d
->
m_core
->
mimeDatabase
()
->
findByFile
(
QFileInfo
(
file
->
fileName
())).
filterString
();
const
QString
&
absoluteFilePath
=
m_d
->
m_core
->
fileManager
()
->
getSaveAsFileName
(
file
,
filter
,
&
selectedFilter
);
if
(
absoluteFilePath
.
isEmpty
())
return
false
;
if
(
absoluteFilePath
!=
editor
->
file
()
->
fileName
())
{
if
(
absoluteFilePath
!=
file
->
fileName
())
{
const
QList
<
IEditor
*>
existList
=
editorsForFileName
(
absoluteFilePath
);
if
(
!
existList
.
isEmpty
())
{
closeEditors
(
existList
,
false
);
}
}
m_d
->
m_core
->
fileManager
()
->
blockFileChange
(
editor
->
file
());
const
bool
success
=
editor
->
file
()
->
save
(
absoluteFilePath
);
m_d
->
m_core
->
fileManager
()
->
unblockFileChange
(
editor
->
file
());
editor
->
file
()
->
checkPermissions
();
m_d
->
m_core
->
fileManager
()
->
blockFileChange
(
file
);
const
bool
success
=
file
->
save
(
absoluteFilePath
);
m_d
->
m_core
->
fileManager
()
->
unblockFileChange
(
file
);
file
->
checkPermissions
();
// @todo: There is an issue to be treated here. The new file might be of a different mime
// type than the original and thus require a different editor. An alternative strategy
// would be to close the current editor and open a new appropriate one, but this is not
// a good way out either (also the undo stack would be lost). Perhaps the best is to
// re-think part of the editors design.
if
(
success
&&
!
editor
->
isTemporary
())
m_d
->
m_core
->
fileManager
()
->
addToRecentFiles
(
editor
->
file
()
->
fileName
());
m_d
->
m_core
->
fileManager
()
->
addToRecentFiles
(
file
->
fileName
());
updateActions
();
return
success
;
...
...
src/plugins/coreplugin/filemanager.cpp
View file @
3724b59e
...
...
@@ -37,6 +37,7 @@
#include "mimedatabase.h"
#include "saveitemsdialog.h"
#include "vcsmanager.h"
#include "coreconstants.h"
#include <utils/qtcassert.h>
#include <utils/pathchooser.h>
...
...
@@ -689,22 +690,45 @@ QList<IFile *> FileManager::saveModifiedFiles(const QList<IFile *> &files,
return
notSaved
;
}
QString
FileManager
::
getSaveFileName
WithExtension
(
const
QString
&
title
,
const
QString
&
pathIn
,
const
QString
&
fil
eFil
ter
,
const
QString
&
extension
)
QString
FileManager
::
getSaveFileName
(
const
QString
&
title
,
const
QString
&
pathIn
,
const
QString
&
filter
,
QString
*
selectedFilter
)
{
const
QString
&
path
=
pathIn
.
isEmpty
()
?
fileDialogInitialDirectory
()
:
pathIn
;
QString
fileName
;
bool
repeat
;
do
{
repeat
=
false
;
const
QString
path
=
pathIn
.
isEmpty
()
?
fileDialogInitialDirectory
()
:
pathIn
;
fileName
=
QFileDialog
::
getSaveFileName
(
d
->
m_mainWindow
,
title
,
path
,
fileFilter
);
if
(
!
fileName
.
isEmpty
()
&&
!
extension
.
isEmpty
()
&&
!
fileName
.
endsWith
(
extension
))
{
fileName
.
append
(
extension
);
fileName
=
QFileDialog
::
getSaveFileName
(
d
->
m_mainWindow
,
title
,
path
,
filter
,
selectedFilter
,
QFileDialog
::
DontConfirmOverwrite
);
if
(
!
fileName
.
isEmpty
())
{
// If the selected filter is All Files (*) we leave the name exactly as the user
// specified. Otherwise the suffix must be one available in the selected filter. If
// the name already ends with such suffix nothing needs to be done. But if not, the
// first one from the filter is appended.
if
(
selectedFilter
&&
*
selectedFilter
!=
QCoreApplication
::
translate
(
"Core"
,
Constants
::
ALL_FILES_FILTER
))
{
// Mime database creates filter strings like this: Anything here (*.foo *.bar)
QRegExp
regExp
(
".*
\\
s+
\\
((.*)
\\
)$"
);
const
int
index
=
regExp
.
lastIndexIn
(
*
selectedFilter
);
bool
suffixOk
=
false
;
if
(
index
!=
-
1
)
{
const
QStringList
&
suffixes
=
regExp
.
cap
(
1
).
remove
(
'*'
).
split
(
' '
);
foreach
(
const
QString
&
suffix
,
suffixes
)
if
(
fileName
.
endsWith
(
suffix
))
{
suffixOk
=
true
;
break
;
}
if
(
!
suffixOk
&&
!
suffixes
.
isEmpty
())
fileName
.
append
(
suffixes
.
at
(
0
));
}
}
if
(
QFile
::
exists
(
fileName
))
{
if
(
QMessageBox
::
warning
(
d
->
m_mainWindow
,
tr
(
"Overwrite?"
),
tr
(
"An item named '%1' already exists at this location. Do you want to overwrite it?"
).
arg
(
fileName
),
QMessageBox
::
Yes
|
QMessageBox
::
No
)
==
QMessageBox
::
No
)
tr
(
"An item named '%1' already exists at this location. "
"Do you want to overwrite it?"
).
arg
(
fileName
),
QMessageBox
::
Yes
|
QMessageBox
::
No
)
==
QMessageBox
::
No
)
{
repeat
=
true
;
}
}
}
}
while
(
repeat
);
...
...
@@ -713,12 +737,19 @@ QString FileManager::getSaveFileNameWithExtension(const QString &title, const QS
return
fileName
;
}
QString
FileManager
::
getSaveFileNameWithExtension
(
const
QString
&
title
,
const
QString
&
pathIn
,
const
QString
&
filter
)
{
QString
selected
=
filter
;
return
getSaveFileName
(
title
,
pathIn
,
filter
,
&
selected
);
}
/*!
\fn QString FileManager::getSaveAsFileName(IFile *file)
Asks the user for a new file name (Save File As) for /arg file.
*/
QString
FileManager
::
getSaveAsFileName
(
IFile
*
file
)
QString
FileManager
::
getSaveAsFileName
(
IFile
*
file
,
const
QString
&
filter
,
QString
*
selectedFilter
)
{
if
(
!
file
)
return
QLatin1String
(
""
);
...
...
@@ -732,17 +763,20 @@ QString FileManager::getSaveAsFileName(IFile *file)
if
(
!
defaultPath
.
isEmpty
())
path
=
defaultPath
;
}
QString
filterString
;
QString
preferredSuffix
;
if
(
const
MimeType
mt
=
Core
::
ICore
::
instance
()
->
mimeDatabase
()
->
findByFile
(
fi
))
{
filterString
=
mt
.
filterString
();
preferredSuffix
=
mt
.
preferredSuffix
();
if
(
filter
.
isEmpty
())
{
if
(
const
MimeType
&
mt
=
Core
::
ICore
::
instance
()
->
mimeDatabase
()
->
findByFile
(
fi
))
filterString
=
mt
.
filterString
();
selectedFilter
=
&
filterString
;
}
else
{
filterString
=
filter
;
}
absoluteFilePath
=
getSaveFileName
WithExtension
(
tr
(
"Save File As"
),
absoluteFilePath
=
getSaveFileName
(
tr
(
"Save File As"
),
path
+
QDir
::
separator
()
+
fileName
,
filterString
,
preferredSuffix
);
selectedFilter
);
return
absoluteFilePath
;
}
...
...
src/plugins/coreplugin/filemanager.h
View file @
3724b59e
...
...
@@ -87,10 +87,12 @@ public:
QStringList
getOpenFileNames
(
const
QString
&
filters
,
const
QString
path
=
QString
(),
QString
*
selectedFilter
=
0
);
QString
getSaveFileNameWithExtension
(
const
QString
&
title
,
const
QString
&
path
,
const
QString
&
fileFilter
,
const
QString
&
extension
);
QString
getSaveAsFileName
(
IFile
*
file
);
QString
getSaveFileName
(
const
QString
&
title
,
const
QString
&
pathIn
,
const
QString
&
filter
=
QString
(),
QString
*
selectedFilter
=
0
);
QString
getSaveFileNameWithExtension
(
const
QString
&
title
,
const
QString
&
pathIn
,
const
QString
&
filter
);
QString
getSaveAsFileName
(
IFile
*
file
,
const
QString
&
filter
=
QString
(),
QString
*
selectedFilter
=
0
);
QList
<
IFile
*>
saveModifiedFilesSilently
(
const
QList
<
IFile
*>
&
files
);
QList
<
IFile
*>
saveModifiedFiles
(
const
QList
<
IFile
*>
&
files
,
...
...
src/plugins/cpptools/cppcurrentdocumentfilter.cpp
View file @
3724b59e
...
...
@@ -58,7 +58,7 @@ CppCurrentDocumentFilter::CppCurrentDocumentFilter(CppModelManager *manager, Cor
this
,
SLOT
(
onEditorAboutToClose
(
Core
::
IEditor
*
)));
}
QList
<
Locator
::
FilterEntry
>
CppCurrentDocumentFilter
::
matchesFor
(
const
QString
&
origEntry
)
QList
<
Locator
::
FilterEntry
>
CppCurrentDocumentFilter
::
matchesFor
(
QFutureInterface
<
Locator
::
FilterEntry
>
&
future
,
const
QString
&
origEntry
)
{
QString
entry
=
trimWildcards
(
origEntry
);
QList
<
Locator
::
FilterEntry
>
goodEntries
;
...
...
@@ -82,6 +82,9 @@ QList<Locator::FilterEntry> CppCurrentDocumentFilter::matchesFor(const QString &
foreach
(
const
ModelItemInfo
&
info
,
m_itemsOfCurrentDoc
)
{
if
(
future
.
isCanceled
())
break
;
if
((
hasWildcard
&&
regexp
.
exactMatch
(
info
.
symbolName
))
||
(
!
hasWildcard
&&
matcher
.
indexIn
(
info
.
symbolName
)
!=
-
1
))
{
...
...
src/plugins/cpptools/cppcurrentdocumentfilter.h
View file @
3724b59e
...
...
@@ -53,7 +53,7 @@ public:
QString
displayName
()
const
{
return
tr
(
"Methods in current Document"
);
}
QString
id
()
const
{
return
QLatin1String
(
"Methods in current Document"
);
}
Priority
priority
()
const
{
return
Medium
;
}
QList
<
Locator
::
FilterEntry
>
matchesFor
(
const
QString
&
entry
);
QList
<
Locator
::
FilterEntry
>
matchesFor
(
QFutureInterface
<
Locator
::
FilterEntry
>
&
future
,
const
QString
&
entry
);
void
accept
(
Locator
::
FilterEntry
selection
)
const
;
void
refresh
(
QFutureInterface
<
void
>
&
future
);
...
...
src/plugins/cpptools/cpplocatorfilter.cpp
View file @
3724b59e
...
...
@@ -76,7 +76,7 @@ static bool compareLexigraphically(const Locator::FilterEntry &a,
return
a
.
displayName
<
b
.
displayName
;
}
QList
<
Locator
::
FilterEntry
>
CppLocatorFilter
::
matchesFor
(
const
QString
&
origEntry
)
QList
<
Locator
::
FilterEntry
>
CppLocatorFilter
::
matchesFor
(
QFutureInterface
<
Locator
::
FilterEntry
>
&
future
,
const
QString
&
origEntry
)
{
QString
entry
=
trimWildcards
(
origEntry
);
QList
<
Locator
::
FilterEntry
>
goodEntries
;
...
...
@@ -90,6 +90,9 @@ QList<Locator::FilterEntry> CppLocatorFilter::matchesFor(const QString &origEntr
QHashIterator
<
QString
,
QList
<
ModelItemInfo
>
>
it
(
m_searchList
);
while
(
it
.
hasNext
())
{
if
(
future
.
isCanceled
())
break
;
it
.
next
();
const
QList
<
ModelItemInfo
>
items
=
it
.
value
();
...
...
src/plugins/cpptools/cpplocatorfilter.h
View file @
3724b59e
...
...
@@ -48,7 +48,7 @@ public:
QString
displayName
()
const
{
return
tr
(
"Classes and Methods"
);
}
QString
id
()
const
{
return
QLatin1String
(
"Classes and Methods"
);
}
Priority
priority
()
const
{
return
Medium
;
}
QList
<
Locator
::
FilterEntry
>
matchesFor
(
const
QString
&
entry
);
QList
<
Locator
::
FilterEntry
>
matchesFor
(
QFutureInterface
<
Locator
::
FilterEntry
>
&
future
,
const
QString
&
entry
);
void
accept
(
Locator
::
FilterEntry
selection
)
const
;
void
refresh
(
QFutureInterface
<
void
>
&
future
);
...
...
src/plugins/help/helpindexfilter.cpp
View file @
3724b59e
...
...
@@ -70,7 +70,7 @@ ILocatorFilter::Priority HelpIndexFilter::priority() const
return
Medium
;
}
QList
<
FilterEntry
>
HelpIndexFilter
::
matchesFor
(
const
QString
&
entry
)
QList
<
FilterEntry
>
HelpIndexFilter
::
matchesFor
(
QFutureInterface
<
Locator
::
FilterEntry
>
&
future
,
const
QString
&
entry
)
{
QStringList
keywords
;
if
(
entry
.
length
()
<
2
)
...
...
@@ -79,8 +79,11 @@ QList<FilterEntry> HelpIndexFilter::matchesFor(const QString &entry)
keywords
=
Core
::
HelpManager
::
instance
()
->
findKeywords
(
entry
);
QList
<
FilterEntry
>
entries
;
foreach
(
const
QString
&
keyword
,
keywords
)
foreach
(
const
QString
&
keyword
,
keywords
)
{
if
(
future
.
isCanceled
())
break
;
entries
.
append
(
FilterEntry
(
this
,
keyword
,
QVariant
(),
m_icon
));
}
return
entries
;
}
...
...
src/plugins/help/helpindexfilter.h
View file @
3724b59e
...
...
@@ -49,7 +49,7 @@ public:
QString
displayName
()
const
;
QString
id
()
const
;
Priority
priority
()
const
;
QList
<
Locator
::
FilterEntry
>
matchesFor
(
const
QString
&
entry
);
QList
<
Locator
::
FilterEntry
>
matchesFor
(
QFutureInterface
<
Locator
::
FilterEntry
>
&
future
,
const
QString
&
entry
);
void
accept
(
Locator
::
FilterEntry
selection
)
const
;
void
refresh
(
QFutureInterface
<
void
>
&
future
);
...
...
src/plugins/help/remotehelpfilter.cpp
View file @
3724b59e
...
...
@@ -100,10 +100,13 @@ Locator::ILocatorFilter::Priority RemoteHelpFilter::priority() const
return
Medium
;
}
QList
<
Locator
::
FilterEntry
>
RemoteHelpFilter
::
matchesFor
(
const
QString
&
pattern
)
QList
<
Locator
::
FilterEntry
>
RemoteHelpFilter
::
matchesFor
(
QFutureInterface
<
Locator
::
FilterEntry
>
&
future
,
const
QString
&
pattern
)
{
QList
<
Locator
::
FilterEntry
>
entries
;
foreach
(
const
QString
&
url
,
m_remoteUrls
)
{
if
(
future
.
isCanceled
())
break
;
entries
.
append
(
Locator
::
FilterEntry
(
this
,
url
.
arg
(
pattern
),
QVariant
(),
m_icon
));
}
...
...
src/plugins/help/remotehelpfilter.h
View file @
3724b59e
...
...
@@ -50,7 +50,7 @@ public:
QString
displayName
()
const
;
QString
id
()
const
;
Priority
priority
()
const
;
QList
<
Locator
::
FilterEntry
>
matchesFor
(
const
QString
&
entry
);
QList
<
Locator
::
FilterEntry
>
matchesFor
(
QFutureInterface
<
Locator
::
FilterEntry
>
&
future
,
const
QString
&
entry
);
void
accept
(
Locator
::
FilterEntry
selection
)
const
;
void
refresh
(
QFutureInterface
<
void
>
&
future
);
QByteArray
saveState
()
const
;
...
...
src/plugins/locator/basefilefilter.cpp
View file @
3724b59e
...
...
@@ -42,7 +42,7 @@ BaseFileFilter::BaseFileFilter()
{
}
QList
<
FilterEntry
>
BaseFileFilter
::
matchesFor
(
const
QString
&
origEntry
)
QList
<
FilterEntry
>
BaseFileFilter
::
matchesFor
(
QFutureInterface
<
Locator
::
FilterEntry
>
&
future
,
const
QString
&
origEntry
)
{
updateFiles
();
QList
<
FilterEntry
>
matches
;
...
...
@@ -70,6 +70,9 @@ QList<FilterEntry> BaseFileFilter::matchesFor(const QString &origEntry)
QStringListIterator
paths
(
searchListPaths
);
QStringListIterator
names
(
searchListNames
);
while
(
paths
.
hasNext
()
&&
names
.
hasNext
())
{
if
(
future
.
isCanceled
())
break
;
QString
path
=
paths
.
next
();
QString
name
=
names
.
next
();
if
((
hasWildcard
&&
regexp
.
exactMatch
(
name
))
...
...
src/plugins/locator/basefilefilter.h
View file @
3724b59e
...
...
@@ -43,7 +43,7 @@ class LOCATOR_EXPORT BaseFileFilter : public Locator::ILocatorFilter
public:
BaseFileFilter
();
QList
<
Locator
::
FilterEntry
>
matchesFor
(
const
QString
&
entry
);
QList
<
Locator
::
FilterEntry
>
matchesFor
(
QFutureInterface
<
Locator
::
FilterEntry
>
&
future
,
const
QString
&
entry
);
void
accept
(
Locator
::
FilterEntry
selection
)
const
;
protected:
...
...
src/plugins/locator/commandlocator.cpp
View file @
3724b59e
...
...
@@ -84,7 +84,7 @@ ILocatorFilter::Priority CommandLocator::priority() const
return
Medium
;
}
QList
<
Locator
::
FilterEntry
>
CommandLocator
::
matchesFor
(
const
QString
&
entry
)
QList
<
Locator
::
FilterEntry
>
CommandLocator
::
matchesFor
(
QFutureInterface
<
Locator
::
FilterEntry
>
&
future
,
const
QString
&
entry
)
{
QList
<
FilterEntry
>
filters
;
// Get active, enabled actions matching text, store in list.
...
...
@@ -92,6 +92,8 @@ QList<Locator::FilterEntry> CommandLocator::matchesFor(const QString &entry)
const
QChar
ampersand
=
QLatin1Char
(
'&'
);
const
int
count
=
d
->
commands
.
size
();
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
if
(
future
.
isCanceled
())
break
;
if
(
d
->
commands
.
at
(
i
)
->
isActive
())
{
if
(
QAction
*
action
=
d
->
commands
.
at
(
i
)
->
action
())
if
(
action
->
isEnabled
())
{
...
...
src/plugins/locator/commandlocator.h
View file @
3724b59e
...
...
@@ -64,7 +64,7 @@ public:
virtual
QString
displayName
()
const
;
virtual
QString
id
()
const
;
virtual
Priority
priority
()
const
;
virtual
QList
<
FilterEntry
>
matchesFor
(
const
QString
&
entry
);
virtual
QList
<
FilterEntry
>
matchesFor
(
QFutureInterface
<
Locator
::
FilterEntry
>
&
future
,
const
QString
&
entry
);
virtual
void
accept
(
FilterEntry
selection
)
const
;
virtual
void
refresh
(
QFutureInterface
<
void
>
&
future
);
...
...
src/plugins/locator/filesystemfilter.cpp
View file @
3724b59e
...
...
@@ -45,7 +45,7 @@ FileSystemFilter::FileSystemFilter(EditorManager *editorManager, LocatorWidget *
setIncludedByDefault
(
false
);
}
QList
<
FilterEntry
>
FileSystemFilter
::
matchesFor
(
const
QString
&
entry
)
QList
<
FilterEntry
>
FileSystemFilter
::
matchesFor
(
QFutureInterface
<
Locator
::
FilterEntry
>
&
future
,
const
QString
&
entry
)
{
QList
<
FilterEntry
>
value
;
QFileInfo
entryInfo
(
entry
);
...
...
@@ -75,6 +75,8 @@ QList<FilterEntry> FileSystemFilter::matchesFor(const QString &entry)
QStringList
files
=
dirInfo
.
entryList
(
fileFilter
,
QDir
::
Name
|
QDir
::
IgnoreCase
|
QDir
::
LocaleAware
);
foreach
(
const
QString
&
dir
,
dirs
)
{
if
(
future
.
isCanceled
())
break
;
if
(
dir
!=
QLatin1String
(
"."
)
&&
(
name
.
isEmpty
()
||
dir
.
startsWith
(
name
,
Qt
::
CaseInsensitive
)))
{
FilterEntry
filterEntry
(
this
,
dir
,
dirInfo
.
filePath
(
dir
));
filterEntry
.
resolveFileIcon
=
true
;
...
...
@@ -82,6 +84,8 @@ QList<FilterEntry> FileSystemFilter::matchesFor(const QString &entry)
}
}
foreach
(
const
QString
&
file
,
files
)
{
if
(
future
.
isCanceled
())
break
;
if
(
name
.
isEmpty
()
||
file
.
startsWith
(
name
,
Qt
::
CaseInsensitive
))
{
const
QString
fullPath
=
dirInfo
.
filePath
(
file
);
FilterEntry
filterEntry
(
this
,
file
,
fullPath
);
...
...
src/plugins/locator/filesystemfilter.h
View file @
3724b59e
...
...
@@ -56,7 +56,7 @@ public:
QString
displayName
()
const
{
return
tr
(
"Files in file system"
);
}
QString
id
()
const
{
return
"Files in file system"
;
}
Locator
::
ILocatorFilter
::
Priority
priority
()
const
{
return
Locator
::
ILocatorFilter
::
Medium
;
}
QList
<
Locator
::
FilterEntry
>
matchesFor
(
const
QString
&
entry
);
QList
<
Locator
::
FilterEntry
>
matchesFor
(
QFutureInterface
<
Locator
::
FilterEntry
>
&
future
,
const
QString
&
entry
);
void
accept
(
Locator
::
FilterEntry
selection
)
const
;
QByteArray
saveState
()
const
;
bool
restoreState
(
const
QByteArray
&
state
);
...
...
src/plugins/locator/ilocatorfilter.h
View file @
3724b59e
...
...
@@ -100,7 +100,7 @@ public:
QString
shortcutString
()
const
;
/* List of matches for the given user entry. */
virtual
QList
<
FilterEntry
>
matchesFor
(
const
QString
&
entry
)
=
0
;
virtual
QList
<
FilterEntry
>
matchesFor
(
QFutureInterface
<
Locator
::
FilterEntry
>
&
future
,
const
QString
&
entry
)
=
0
;
/* User has selected the given entry that belongs to this filter. */
virtual
void
accept
(
FilterEntry
selection
)
const
=
0
;
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment