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
Konsole
Commits
d2d2157f
Commit
d2d2157f
authored
Nov 30, 2021
by
Tomaz Canabrava
Browse files
new method: Has Host. Important to check if we loaded something yet
parent
52076ab9
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/SSHManager/sshmanagermodel.cpp
View file @
d2d2157f
...
...
@@ -115,6 +115,22 @@ QStringList SSHManagerModel::folders() const
return
retList
;
}
bool
SSHManagerModel
::
hasHost
(
const
QString
&
host
)
const
{
// runs in O(N), should be ok for the amount of data peophe have.
for
(
int
i
=
0
,
end
=
invisibleRootItem
()
->
rowCount
();
i
<
end
;
i
++
)
{
QStandardItem
*
iChild
=
invisibleRootItem
()
->
child
(
i
);
for
(
int
e
=
0
,
end
=
iChild
->
rowCount
();
i
<
end
;
e
++
)
{
QStandardItem
*
eChild
=
iChild
->
child
(
e
);
const
auto
data
=
eChild
->
data
(
SSHManagerModel
::
Roles
::
SSHRole
).
value
<
SSHConfigurationData
>
();
if
(
data
.
host
==
host
)
{
return
true
;
}
}
}
return
false
;
}
void
SSHManagerModel
::
load
()
{
auto
config
=
KConfig
(
QStringLiteral
(
"konsolesshconfig"
),
KConfig
::
OpenFlag
::
SimpleConfig
);
...
...
src/plugins/SSHManager/sshmanagermodel.h
View file @
d2d2157f
...
...
@@ -39,6 +39,8 @@ public:
void
load
();
void
save
();
bool
hasHost
(
const
QString
&
hostName
)
const
;
private:
QStandardItem
*
m_sshConfigTopLevelItem
=
nullptr
;
};
...
...
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