summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/consoleconfigwidget.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-console/consoleconfigwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/consoleconfigwidget.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/consoleconfigwidget.cpp b/noncore/apps/opie-console/consoleconfigwidget.cpp
index 3f2d154..faedc58 100644
--- a/noncore/apps/opie-console/consoleconfigwidget.cpp
+++ b/noncore/apps/opie-console/consoleconfigwidget.cpp
@@ -5,12 +5,16 @@
#include <qpushbutton.h>
#include <qlistview.h>
#include <qhbox.h>
#include <qregexp.h>
#include <stdio.h>
+#include <pwd.h>
+#include <sys/types.h>
+
+
#include "consoleconfigwidget.h"
ConsoleConfigWidget::ConsoleConfigWidget( const QString& name, QWidget* parent,
const char* na )
: ProfileDialogConnectionWidget( name, parent, na ) {
m_lay = new QVBoxLayout( this );
@@ -62,17 +66,24 @@ void ConsoleConfigWidget::slotRemove() {
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
+ * default to the users default shell
*/
- m_cmd->setText(prof.readEntry("Command", "/bin/bash"));
+ struct passwd *ent = 0;
+ char *shell = "/bin/sh";
+
+ while ( (ent = getpwent()) != 0 ) {
+ if (ent->pw_shell != "") {
+ shell = ent->pw_shell;
+ }
+ }
+
+ m_cmd->setText(prof.readEntry("Command", shell ));
int envcount = prof.readNumEntry("EnvVars", 0);
for (int i=0; i<envcount; i++) {
QString name = prof.readEntry("Env_Name_" + QString::number(i), "");
QString value = prof.readEntry("Env_Value_" + QString::number(i), "");
if (!(name.isEmpty() || value.isEmpty())) {
QListViewItem *item = new QListViewItem(m_env);