Skip to content
GitLab
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
7af52ee8
Commit
7af52ee8
authored
Aug 13, 2022
by
Waqar Ahmed
Browse files
Fix git push dialog
parent
4de29e12
Pipeline
#217522
passed with stage
in 5 minutes and 25 seconds
Changes
3
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
addons/project/pushpulldialog.cpp
View file @
7af52ee8
...
...
@@ -23,6 +23,8 @@ PushPullDialog::PushPullDialog(KTextEditor::MainWindow *mainWindow, const QStrin
,
m_repo
(
repoPath
)
{
m_lineEdit
.
setFont
(
Utils
::
editorFont
());
m_treeView
.
setFont
(
Utils
::
editorFont
());
setFilteringEnabled
(
false
);
loadLastExecutedCommands
();
}
...
...
@@ -45,22 +47,13 @@ void PushPullDialog::openDialog(PushPullDialog::Mode m)
lastExecCmds
.
push_front
(
lastCmd
);
}
auto
*
model
=
new
QStandardItemModel
(
this
);
m_treeView
.
setModel
(
model
);
auto
monoFont
=
m_lineEdit
.
font
();
for
(
const
QString
&
cmd
:
std
::
as_const
(
lastExecCmds
))
{
auto
*
item
=
new
QStandardItem
(
cmd
);
item
->
setFont
(
monoFont
);
model
->
appendRow
(
item
);
}
setStringList
(
lastExecCmds
);
connect
(
m_treeView
.
selectionModel
(),
&
QItemSelectionModel
::
currentChanged
,
this
,
[
this
](
const
QModelIndex
&
current
,
const
QModelIndex
&
)
{
m_lineEdit
.
setText
(
current
.
data
().
toString
());
});
m_treeView
.
setCurrentIndex
(
model
->
index
(
0
,
0
)
);
reselectFirst
(
);
exec
();
}
...
...
apps/lib/quickdialog.cpp
View file @
7af52ee8
...
...
@@ -149,12 +149,7 @@ HUDDialog::HUDDialog(QWidget *parent, QWidget *mainWindow)
hide
();
});
// user can add this as necessary
connect
(
&
m_lineEdit
,
&
QLineEdit
::
textChanged
,
this
,
[
this
](
const
QString
&
txt
)
{
static_cast
<
FuzzyFilterModel
*>
(
m_proxy
.
data
())
->
setFilterString
(
txt
);
m_delegate
->
setFilterString
(
txt
);
m_treeView
.
viewport
()
->
update
();
m_treeView
.
setCurrentIndex
(
m_treeView
.
model
()
->
index
(
0
,
0
));
});
setFilteringEnabled
(
true
);
connect
(
&
m_treeView
,
&
QTreeView
::
clicked
,
this
,
&
HUDDialog
::
slotReturnPressed
);
m_treeView
.
setSortingEnabled
(
true
);
...
...
@@ -277,3 +272,23 @@ void HUDDialog::setModel(QAbstractItemModel *model, FilterType type, int filterK
proxy
->
setFilterType
(
type
);
proxy
->
setScoreRole
(
scoreRole
);
}
void
HUDDialog
::
setFilteringEnabled
(
bool
enabled
)
{
if
(
!
enabled
)
{
disconnect
(
&
m_lineEdit
,
&
QLineEdit
::
textChanged
,
this
,
nullptr
);
m_treeView
.
setModel
(
m_model
);
}
else
{
Q_ASSERT
(
m_proxy
);
if
(
m_treeView
.
model
()
!=
m_proxy
)
{
Q_ASSERT
(
m_proxy
->
sourceModel
());
m_treeView
.
setModel
(
m_proxy
);
}
connect
(
&
m_lineEdit
,
&
QLineEdit
::
textChanged
,
this
,
[
this
](
const
QString
&
txt
)
{
static_cast
<
FuzzyFilterModel
*>
(
m_proxy
.
data
())
->
setFilterString
(
txt
);
m_delegate
->
setFilterString
(
txt
);
m_treeView
.
viewport
()
->
update
();
m_treeView
.
setCurrentIndex
(
m_treeView
.
model
()
->
index
(
0
,
0
));
});
}
}
apps/lib/quickdialog.h
View file @
7af52ee8
...
...
@@ -60,6 +60,8 @@ public:
void
setModel
(
QAbstractItemModel
*
,
FilterType
,
int
filterKeyCol
=
0
,
int
filterRole
=
Qt
::
DisplayRole
,
int
scoreRole
=
-
1
);
void
setFilteringEnabled
(
bool
enabled
);
protected:
bool
eventFilter
(
QObject
*
obj
,
QEvent
*
event
)
override
;
void
updateViewGeometry
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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