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
6a892085
Commit
6a892085
authored
Nov 26, 2021
by
Tomaz Canabrava
Browse files
Don't try to issue an ssh connection if not on the shell
parent
fc866e6f
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/ProcessInfo.h
View file @
6a892085
...
...
@@ -12,6 +12,8 @@
#include <QString>
#include <QVector>
#include "konsoleprivate_export.h"
namespace
Konsole
{
/**
...
...
@@ -56,7 +58,7 @@ namespace Konsole
* }
* @endcode
*/
class
ProcessInfo
class
KONSOLEPRIVATE_EXPORT
ProcessInfo
{
public:
/**
...
...
src/plugins/SSHManager/sshmanagerpluginwidget.cpp
View file @
6a892085
...
...
@@ -7,8 +7,11 @@
#include "sshmanagerpluginwidget.h"
#include "ProcessInfo.h"
#include "konsoledebug.h"
#include "session/Session.h"
#include "session/SessionController.h"
#include "sshmanagermodel.h"
#include "terminalDisplay/TerminalDisplay.h"
...
...
@@ -383,6 +386,26 @@ void SSHManagerTreeWidget::connectRequested(const QModelIndex &idx)
return
;
}
Konsole
::
ProcessInfo
*
info
=
d
->
controller
->
session
()
->
getProcessInfo
();
bool
ok
=
false
;
QString
processName
=
info
->
name
(
&
ok
);
if
(
!
ok
)
{
qDebug
()
<<
"Could not get the process name, assume that we can't request a connection"
;
return
;
}
if
(
!
QSet
<
QString
>
({
QStringLiteral
(
"fish"
),
QStringLiteral
(
"bash"
),
QStringLiteral
(
"dash"
),
QStringLiteral
(
"sh"
),
QStringLiteral
(
"csh"
),
QStringLiteral
(
"ksh"
),
QStringLiteral
(
"zsh"
)})
.
contains
(
processName
))
{
qDebug
()
<<
"You have an application running on the top of the shell, can't request a connection."
;
return
;
}
auto
item
=
d
->
model
->
itemFromIndex
(
sourceIdx
);
auto
data
=
item
->
data
(
SSHManagerModel
::
SSHRole
).
value
<
SSHConfigurationData
>
();
...
...
src/session/Session.h
View file @
6a892085
...
...
@@ -75,6 +75,9 @@ public:
explicit
Session
(
QObject
*
parent
=
nullptr
);
~
Session
()
override
;
/* Returns the process info so the plugins can peek at it's name */
ProcessInfo
*
getProcessInfo
();
/**
* Connect to an existing terminal. When a new Session() is constructed it
* automatically searches for and opens a new teletype. If you want to
...
...
@@ -791,7 +794,6 @@ private:
// if the program fails to start, or if the shell exits in
// an unsuccessful manner
void
terminalWarning
(
const
QString
&
message
);
ProcessInfo
*
getProcessInfo
();
void
updateSessionProcessInfo
();
bool
updateForegroundProcessInfo
();
void
updateWorkingDirectory
();
...
...
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