summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/consoleconfigwidget.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/consoleconfigwidget.cpp') (more/less context) (ignore 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 @@
5#include <qpushbutton.h> 5#include <qpushbutton.h>
6#include <qlistview.h> 6#include <qlistview.h>
7#include <qhbox.h> 7#include <qhbox.h>
8#include <qregexp.h> 8#include <qregexp.h>
9#include <stdio.h> 9#include <stdio.h>
10 10
11#include <pwd.h>
12#include <sys/types.h>
13
14
11#include "consoleconfigwidget.h" 15#include "consoleconfigwidget.h"
12 16
13ConsoleConfigWidget::ConsoleConfigWidget( const QString& name, QWidget* parent, 17ConsoleConfigWidget::ConsoleConfigWidget( const QString& name, QWidget* parent,
14 const char* na ) 18 const char* na )
15 : ProfileDialogConnectionWidget( name, parent, na ) { 19 : ProfileDialogConnectionWidget( name, parent, na ) {
16 m_lay = new QVBoxLayout( this ); 20 m_lay = new QVBoxLayout( this );
@@ -62,17 +66,24 @@ void ConsoleConfigWidget::slotRemove() {
62 66
63ConsoleConfigWidget::~ConsoleConfigWidget() { 67ConsoleConfigWidget::~ConsoleConfigWidget() {
64} 68}
65 69
66void ConsoleConfigWidget::load( const Profile& prof ) { 70void ConsoleConfigWidget::load( const Profile& prof ) {
67 /* 71 /*
68 * we will use /bin/bash as default 72 * default to the users default shell
69 * but will fallback in MyPty to /bin/sh
70 * if necessary
71 */ 73 */
72 m_cmd->setText(prof.readEntry("Command", "/bin/bash")); 74 struct passwd *ent = 0;
75 char *shell = "/bin/sh";
76
77 while ( (ent = getpwent()) != 0 ) {
78 if (ent->pw_shell != "") {
79 shell = ent->pw_shell;
80 }
81 }
82
83 m_cmd->setText(prof.readEntry("Command", shell ));
73 int envcount = prof.readNumEntry("EnvVars", 0); 84 int envcount = prof.readNumEntry("EnvVars", 0);
74 for (int i=0; i<envcount; i++) { 85 for (int i=0; i<envcount; i++) {
75 QString name = prof.readEntry("Env_Name_" + QString::number(i), ""); 86 QString name = prof.readEntry("Env_Name_" + QString::number(i), "");
76 QString value = prof.readEntry("Env_Value_" + QString::number(i), ""); 87 QString value = prof.readEntry("Env_Value_" + QString::number(i), "");
77 if (!(name.isEmpty() || value.isEmpty())) { 88 if (!(name.isEmpty() || value.isEmpty())) {
78 QListViewItem *item = new QListViewItem(m_env); 89 QListViewItem *item = new QListViewItem(m_env);