Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / konsole / src / RemoteConnectionDialog.cpp
blob4fdc5db66cfaf78d708fab5d632d6f153b33f407
1 /*
2 Copyright 2007 by Robert Knight <robertknight@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301 USA.
20 // Own
21 #include "RemoteConnectionDialog.h"
23 // Qt
24 #include <KDebug>
26 // KDE
27 #include <KLocale>
29 // Konsole
30 #include "SessionManager.h"
32 #include "ui_RemoteConnectionDialog.h"
34 using namespace Konsole;
36 RemoteConnectionDialog::RemoteConnectionDialog(QWidget* parent)
37 : KDialog(parent)
39 setCaption(i18n("New Remote Connection"));
40 setButtons( KDialog::Ok | KDialog::Cancel );
41 setButtonText( KDialog::Ok , i18n("Connect") );
43 _ui = new Ui::RemoteConnectionDialog();
44 _ui->setupUi(mainWidget());
46 // set initial UI state
47 _ui->userEdit->setFocus(Qt::OtherFocusReason);
49 RemoteConnectionDialog::~RemoteConnectionDialog()
51 delete _ui;
53 QString RemoteConnectionDialog::user() const
55 return _ui->userEdit->text();
57 QString RemoteConnectionDialog::host() const
59 return _ui->hostEdit->text();
61 QString RemoteConnectionDialog::service() const
63 return "ssh";
66 QString RemoteConnectionDialog::sessionKey() const
68 // SessionManager* manager = SessionManager::instance();
70 /*MutableSessionInfo* customSession =
71 new MutableSessionInfo(manager->defaultSessionType()->path());
72 customSession->setCommand( service() );
73 customSession->setName( i18n("%1 at %2",user(),host()) );
74 customSession->setArguments( QStringList() << customSession->command(true,true) <<
75 user() + '@' + host() );
77 //QString key = manager->addSessionType( customSession );
79 //kDebug() << "session key = " << key;
81 return QString();
82 //return key;