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
Utilities
Kate
Commits
1e600053
Commit
1e600053
authored
Jan 11, 2021
by
Kåre Särs
Browse files
Re-add the eventfiltering for enter
parent
2480eae3
Changes
1
Hide whitespace changes
Inline
Side-by-side
addons/search/plugin_search.cpp
View file @
1e600053
...
...
@@ -168,48 +168,6 @@ static void regexHelperActOnAction(QAction *resultAction, const QSet<QAction *>
}
}
class
TreeWidgetItem
:
public
QTreeWidgetItem
{
public:
TreeWidgetItem
(
QTreeWidget
*
parent
)
:
QTreeWidgetItem
(
parent
)
{
}
TreeWidgetItem
(
QTreeWidget
*
parent
,
const
QStringList
&
list
)
:
QTreeWidgetItem
(
parent
,
list
)
{
}
TreeWidgetItem
(
QTreeWidgetItem
*
parent
,
const
QStringList
&
list
)
:
QTreeWidgetItem
(
parent
,
list
)
{
}
private:
bool
operator
<
(
const
QTreeWidgetItem
&
other
)
const
override
{
if
(
childCount
()
==
0
)
{
int
line
=
data
(
0
,
ReplaceMatches
::
StartLineRole
).
toInt
();
int
column
=
data
(
0
,
ReplaceMatches
::
StartColumnRole
).
toInt
();
int
oLine
=
other
.
data
(
0
,
ReplaceMatches
::
StartLineRole
).
toInt
();
int
oColumn
=
other
.
data
(
0
,
ReplaceMatches
::
StartColumnRole
).
toInt
();
if
(
line
<
oLine
)
{
return
true
;
}
if
((
line
==
oLine
)
&&
(
column
<
oColumn
))
{
return
true
;
}
return
false
;
}
int
sepCount
=
data
(
0
,
ReplaceMatches
::
FileUrlRole
).
toString
().
count
(
QDir
::
separator
());
int
oSepCount
=
other
.
data
(
0
,
ReplaceMatches
::
FileUrlRole
).
toString
().
count
(
QDir
::
separator
());
if
(
sepCount
<
oSepCount
)
return
true
;
if
(
sepCount
>
oSepCount
)
return
false
;
return
data
(
0
,
ReplaceMatches
::
FileUrlRole
).
toString
().
toLower
()
<
other
.
data
(
0
,
ReplaceMatches
::
FileUrlRole
).
toString
().
toLower
();
}
};
Results
::
Results
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
...
...
@@ -1478,9 +1436,8 @@ void KatePluginSearchView::updateMatchMarks()
// Re-add the highlighting on document reload
connect
(
doc
,
&
KTextEditor
::
Document
::
reloaded
,
this
,
&
KatePluginSearchView
::
updateMatchMarks
,
Qt
::
UniqueConnection
);
//
FIXME
for all matches in file
//
Add match marks
for all matches in
the
file
QModelIndex
fileIndex
=
res
->
matchModel
.
fileIndex
(
doc
->
url
());
int
fileMatches
=
res
->
matchModel
.
rowCount
(
fileIndex
);
for
(
int
i
=
0
;
i
<
fileMatches
;
++
i
)
{
QModelIndex
matchIndex
=
res
->
matchModel
.
index
(
i
,
0
,
fileIndex
);
...
...
@@ -1813,7 +1770,7 @@ void KatePluginSearchView::addTab()
m_ui
.
resultTabWidget
->
tabBar
()
->
show
();
m_ui
.
displayOptions
->
setChecked
(
false
);
// FIXME
res->treeView->installEventFilter(this);
res
->
treeView
->
installEventFilter
(
this
);
}
void
KatePluginSearchView
::
tabCloseRequested
(
int
index
)
...
...
@@ -2025,7 +1982,7 @@ bool KatePluginSearchView::eventFilter(QObject *obj, QEvent *event)
}
}
else
if
(
event
->
type
()
==
QEvent
::
KeyPress
)
{
QKeyEvent
*
ke
=
static_cast
<
QKeyEvent
*>
(
event
);
QTreeView
*
treeView
=
qobject_cast
<
QTree
Widget
*>
(
obj
);
QTreeView
*
treeView
=
qobject_cast
<
QTree
View
*>
(
obj
);
if
(
treeView
)
{
if
(
ke
->
matches
(
QKeySequence
::
Copy
))
{
copySearchToClipboard
(
All
);
...
...
@@ -2033,11 +1990,11 @@ bool KatePluginSearchView::eventFilter(QObject *obj, QEvent *event)
return
true
;
}
if
(
ke
->
key
()
==
Qt
::
Key_Enter
||
ke
->
key
()
==
Qt
::
Key_Return
)
{
//FIXME
if (tree->currentI
tem
()) {
//
itemSelected(tree->currentI
tem
());
//
event->accept();
//
return true;
//
}
if
(
tree
View
->
currentI
ndex
().
isValid
())
{
itemSelected
(
tree
View
->
currentI
ndex
());
event
->
accept
();
return
true
;
}
}
}
// NOTE: Qt::Key_Escape is handled by handleEsc
...
...
Write
Preview
Supports
Markdown
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