From d2a79869efe8b18849e45b8e1beedb5108eba6ac Mon Sep 17 00:00:00 2001 From: zecke Date: Thu, 31 Oct 2002 16:14:20 +0000 Subject: Auto connect on Locale Console again! MyPty test if cmd is available(exists) and then either use /bin/bash or /bin/sh ConsoleConfigWidget added a comment about the expected behaviour --- (limited to 'noncore/apps') diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp index b0f0275..c3c58be 100644 --- a/noncore/apps/opie-console/MyPty.cpp +++ b/noncore/apps/opie-console/MyPty.cpp @@ -291,7 +291,22 @@ void MyPty::close() { } void MyPty::reload( const Profile& prof) { m_env.clear(); - m_cmd = prof.readEntry("Command", "/bin/bash"); + m_cmd = prof.readEntry("Command", "/bin/sh"); + + /* + * Lets check if m_cmd actually + * exists.... + * we try to use bin/bash and if + * this fails we + * will fallback to /bin/sh + * which should be there 100% + */ + if ( !QFile::exists(QFile::encodeName(m_cmd) ) ) + if (QFile::exists("/bin/bash") ) + m_cmd = "/bin/bash"; + else + m_cmd = "/bin/sh"; + int envcount = prof.readNumEntry("EnvVars", 0); for (int i=0; iaddColumn(tr("Name")); m_env->addColumn(tr("Value")); m_lay->addWidget(m_env); - + QHBox *hbox = new QHBox(this); label = new QLabel(tr("Name :"), hbox); m_name = new QLineEdit(hbox); @@ -34,7 +34,7 @@ ConsoleConfigWidget::ConsoleConfigWidget( const QString& name, QWidget* parent, label = new QLabel(tr("Value :"), hbox); m_value = new QLineEdit(hbox); m_lay->addWidget(hbox); - + hbox = new QHBox(this); hbox->setSpacing(10); m_remove = new QPushButton(tr("Remove"), hbox); @@ -64,8 +64,13 @@ ConsoleConfigWidget::~ConsoleConfigWidget() { } void ConsoleConfigWidget::load( const Profile& prof ) { + /* + * we will use /bin/bash as default + * but will fallback in MyPty to /bin/sh + * if necessary + */ m_cmd->setText(prof.readEntry("Command", "/bin/bash")); - int envcount = prof.readNumEntry("EnvVars", 0); + int envcount = prof.readNumEntry("EnvVars", 0); for (int i=0; ilayer()->supports()[0] == 1 ) { - if ( m_conCmb ->currentText() == tr("local Console") ) { + if ( m_conCmb ->currentText() == tr("Local Console") ) { m_autoConnect->setChecked( true ); } else { m_autoConnect->setChecked( false ); -- cgit v0.9.0.2