author | llornkcor <llornkcor> | 2002-05-27 13:48:04 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-05-27 13:48:04 (UTC) |
commit | 22e2c411ad5e6ff1c01c754a2fe824af26c3c9bd (patch) (unidiff) | |
tree | 4fdcaa011e88ef93148825ca40696ab58ff2a57c | |
parent | 9dd7e9c149a17482fd947139f105946ede672b64 (diff) | |
download | opie-22e2c411ad5e6ff1c01c754a2fe824af26c3c9bd.zip opie-22e2c411ad5e6ff1c01c754a2fe824af26c3c9bd.tar.gz opie-22e2c411ad5e6ff1c01c754a2fe824af26c3c9bd.tar.bz2 |
removed redundant entries from suggested commands, added 3 qcop commands to main list
-rw-r--r-- | core/apps/embeddedkonsole/commandeditdialog.cpp | 34 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 3 |
2 files changed, 8 insertions, 29 deletions
diff --git a/core/apps/embeddedkonsole/commandeditdialog.cpp b/core/apps/embeddedkonsole/commandeditdialog.cpp index ce21c47..8b2abfa 100644 --- a/core/apps/embeddedkonsole/commandeditdialog.cpp +++ b/core/apps/embeddedkonsole/commandeditdialog.cpp | |||
@@ -1,177 +1,153 @@ | |||
1 | //comandeditdialog.cpp | 1 | //comandeditdialog.cpp |
2 | 2 | ||
3 | #include "commandeditdialog.h" | 3 | #include "commandeditdialog.h" |
4 | #include "playlistselection.h" | 4 | #include "playlistselection.h" |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | #include <qpe/config.h> | 6 | #include <qpe/config.h> |
7 | #include <qpe/qpetoolbar.h> | 7 | #include <qpe/qpetoolbar.h> |
8 | #include <qwidget.h> | 8 | #include <qwidget.h> |
9 | #include <qpe/qpemenubar.h> | 9 | #include <qpe/qpemenubar.h> |
10 | #include <qpe/resource.h> | 10 | #include <qpe/resource.h> |
11 | #include <qlist.h> | 11 | #include <qlist.h> |
12 | #include <qtoolbutton.h> | 12 | #include <qtoolbutton.h> |
13 | #include <qvbox.h> | 13 | #include <qvbox.h> |
14 | #include <qlistview.h> | 14 | #include <qlistview.h> |
15 | #include <qlineedit.h> | 15 | #include <qlineedit.h> |
16 | #include <qheader.h> | 16 | #include <qheader.h> |
17 | #include <qlabel.h> | 17 | #include <qlabel.h> |
18 | #include <qmessagebox.h> | 18 | #include <qmessagebox.h> |
19 | #include "smallcommandeditdialogbase.h" | 19 | #include "smallcommandeditdialogbase.h" |
20 | 20 | ||
21 | CommandEditDialog::CommandEditDialog(QWidget *parent, const char* name, WFlags fl ) | 21 | CommandEditDialog::CommandEditDialog(QWidget *parent, const char* name, WFlags fl ) |
22 | : CommandEditDialogBase(parent, name, TRUE, fl) | 22 | : CommandEditDialogBase(parent, name, TRUE, fl) |
23 | 23 | ||
24 | { | 24 | { |
25 | m_SuggestedCommandList->addColumn( tr("Command Selection") ); | 25 | m_SuggestedCommandList->addColumn( tr("Command Selection") ); |
26 | m_SuggestedCommandList->header()->hide(); | 26 | m_SuggestedCommandList->header()->hide(); |
27 | m_SuggestedCommandList->setSorting(-1,FALSE); | 27 | m_SuggestedCommandList->setSorting(-1,FALSE); |
28 | m_SuggestedCommandList->clearSelection(); | 28 | m_SuggestedCommandList->clearSelection(); |
29 | m_SuggestedCommandList->setSorting(0,TRUE); | 29 | m_SuggestedCommandList->setSorting(0,TRUE); |
30 | 30 | QListViewItem *item; | |
31 | QListViewItem *item; | ||
32 | |||
33 | |||
34 | item = new QListViewItem( m_SuggestedCommandList,"ls "); | ||
35 | |||
36 | item = new QListViewItem( m_SuggestedCommandList,"cat "); | ||
37 | item = new QListViewItem( m_SuggestedCommandList,"cd "); | ||
38 | item = new QListViewItem( m_SuggestedCommandList,"chmod "); | ||
39 | item = new QListViewItem( m_SuggestedCommandList,"cp "); | ||
40 | item = new QListViewItem( m_SuggestedCommandList,"dc "); | ||
41 | item = new QListViewItem( m_SuggestedCommandList,"df "); | ||
42 | item = new QListViewItem( m_SuggestedCommandList,"dmesg "); | ||
43 | item = new QListViewItem( m_SuggestedCommandList,"echo "); | ||
44 | item = new QListViewItem( m_SuggestedCommandList,"export "); | 31 | item = new QListViewItem( m_SuggestedCommandList,"export "); |
45 | item = new QListViewItem( m_SuggestedCommandList,"env "); | ||
46 | item = new QListViewItem( m_SuggestedCommandList,"find "); | ||
47 | item = new QListViewItem( m_SuggestedCommandList,"free "); | ||
48 | item = new QListViewItem( m_SuggestedCommandList,"ifconfig "); | 32 | item = new QListViewItem( m_SuggestedCommandList,"ifconfig "); |
49 | item = new QListViewItem( m_SuggestedCommandList,"ipkg "); | 33 | item = new QListViewItem( m_SuggestedCommandList,"ipkg "); |
50 | item = new QListViewItem( m_SuggestedCommandList,"mkdir "); | ||
51 | item = new QListViewItem( m_SuggestedCommandList,"mv "); | ||
52 | item = new QListViewItem( m_SuggestedCommandList,"nc localhost 7776 "); | ||
53 | item = new QListViewItem( m_SuggestedCommandList,"nc localhost 7777 "); | ||
54 | item = new QListViewItem( m_SuggestedCommandList,"nslookup "); | ||
55 | item = new QListViewItem( m_SuggestedCommandList,"ping "); | ||
56 | item = new QListViewItem( m_SuggestedCommandList,"ps aux"); | ||
57 | item = new QListViewItem( m_SuggestedCommandList,"pwd "); | ||
58 | item = new QListViewItem( m_SuggestedCommandList,"rm "); | ||
59 | item = new QListViewItem( m_SuggestedCommandList,"rmdir "); | ||
60 | item = new QListViewItem( m_SuggestedCommandList,"route "); | ||
61 | item = new QListViewItem( m_SuggestedCommandList,"gzip "); | 34 | item = new QListViewItem( m_SuggestedCommandList,"gzip "); |
62 | item = new QListViewItem( m_SuggestedCommandList,"gunzip "); | 35 | item = new QListViewItem( m_SuggestedCommandList,"gunzip "); |
63 | item = new QListViewItem( m_SuggestedCommandList,"chgrp "); | 36 | item = new QListViewItem( m_SuggestedCommandList,"chgrp "); |
64 | item = new QListViewItem( m_SuggestedCommandList,"chown "); | 37 | item = new QListViewItem( m_SuggestedCommandList,"chown "); |
65 | item = new QListViewItem( m_SuggestedCommandList,"date "); | 38 | item = new QListViewItem( m_SuggestedCommandList,"date "); |
66 | item = new QListViewItem( m_SuggestedCommandList,"dd "); | 39 | item = new QListViewItem( m_SuggestedCommandList,"dd "); |
67 | item = new QListViewItem( m_SuggestedCommandList,"df "); | ||
68 | item = new QListViewItem( m_SuggestedCommandList,"dmesg "); | 40 | item = new QListViewItem( m_SuggestedCommandList,"dmesg "); |
69 | item = new QListViewItem( m_SuggestedCommandList,"fuser "); | 41 | item = new QListViewItem( m_SuggestedCommandList,"fuser "); |
70 | item = new QListViewItem( m_SuggestedCommandList,"hostname "); | 42 | item = new QListViewItem( m_SuggestedCommandList,"hostname "); |
71 | item = new QListViewItem( m_SuggestedCommandList,"kill "); | 43 | item = new QListViewItem( m_SuggestedCommandList,"kill "); |
72 | item = new QListViewItem( m_SuggestedCommandList,"killall "); | 44 | item = new QListViewItem( m_SuggestedCommandList,"killall "); |
73 | item = new QListViewItem( m_SuggestedCommandList,"ln "); | 45 | item = new QListViewItem( m_SuggestedCommandList,"ln "); |
74 | item = new QListViewItem( m_SuggestedCommandList,"ln -s "); | 46 | item = new QListViewItem( m_SuggestedCommandList,"ln -s "); |
47 | item = new QListViewItem( m_SuggestedCommandList,"lsmod"); | ||
48 | item = new QListViewItem( m_SuggestedCommandList,"depmod -a"); | ||
49 | item = new QListViewItem( m_SuggestedCommandList,"modprobe "); | ||
75 | item = new QListViewItem( m_SuggestedCommandList,"mount "); | 50 | item = new QListViewItem( m_SuggestedCommandList,"mount "); |
76 | item = new QListViewItem( m_SuggestedCommandList,"more "); | 51 | item = new QListViewItem( m_SuggestedCommandList,"more "); |
77 | item = new QListViewItem( m_SuggestedCommandList,"sort "); | 52 | item = new QListViewItem( m_SuggestedCommandList,"sort "); |
78 | item = new QListViewItem( m_SuggestedCommandList,"touch "); | 53 | item = new QListViewItem( m_SuggestedCommandList,"touch "); |
79 | item = new QListViewItem( m_SuggestedCommandList,"umount "); | 54 | item = new QListViewItem( m_SuggestedCommandList,"umount "); |
80 | item = new QListViewItem( m_SuggestedCommandList,"mknod "); | 55 | item = new QListViewItem( m_SuggestedCommandList,"mknod "); |
81 | item = new QListViewItem( m_SuggestedCommandList,"netstat "); | 56 | item = new QListViewItem( m_SuggestedCommandList,"netstat "); |
57 | item = new QListViewItem( m_SuggestedCommandList,"route "); | ||
82 | item = new QListViewItem( m_SuggestedCommandList,"cardctl eject "); | 58 | item = new QListViewItem( m_SuggestedCommandList,"cardctl eject "); |
83 | m_SuggestedCommandList->setSelected(m_SuggestedCommandList->firstChild(),TRUE); | 59 | m_SuggestedCommandList->setSelected(m_SuggestedCommandList->firstChild(),TRUE); |
84 | m_SuggestedCommandList->sort(); | 60 | m_SuggestedCommandList->sort(); |
85 | 61 | ||
86 | connect( m_SuggestedCommandList, SIGNAL( clicked( QListViewItem * ) ), m_PlayListSelection, SLOT( addToSelection( QListViewItem *) ) ); | 62 | connect( m_SuggestedCommandList, SIGNAL( clicked( QListViewItem * ) ), m_PlayListSelection, SLOT( addToSelection( QListViewItem *) ) ); |
87 | 63 | ||
88 | 64 | ||
89 | 65 | ||
90 | ToolButton1->setTextLabel("new"); | 66 | ToolButton1->setTextLabel("new"); |
91 | ToolButton1->setPixmap(Resource::loadPixmap("new")); | 67 | ToolButton1->setPixmap(Resource::loadPixmap("new")); |
92 | ToolButton1->setAutoRaise(TRUE); | 68 | ToolButton1->setAutoRaise(TRUE); |
93 | ToolButton1->setFocusPolicy(QWidget::NoFocus); | 69 | ToolButton1->setFocusPolicy(QWidget::NoFocus); |
94 | connect(ToolButton1,SIGNAL(clicked()),this,SLOT(showAddDialog())); | 70 | connect(ToolButton1,SIGNAL(clicked()),this,SLOT(showAddDialog())); |
95 | 71 | ||
96 | ToolButton2->setTextLabel("edit"); | 72 | ToolButton2->setTextLabel("edit"); |
97 | ToolButton2->setPixmap(Resource::loadPixmap("edit")); | 73 | ToolButton2->setPixmap(Resource::loadPixmap("edit")); |
98 | ToolButton2->setAutoRaise(TRUE); | 74 | ToolButton2->setAutoRaise(TRUE); |
99 | ToolButton2->setFocusPolicy(QWidget::NoFocus); | 75 | ToolButton2->setFocusPolicy(QWidget::NoFocus); |
100 | connect(ToolButton2,SIGNAL(clicked()),this,SLOT(showEditDialog())); | 76 | connect(ToolButton2,SIGNAL(clicked()),this,SLOT(showEditDialog())); |
101 | 77 | ||
102 | ToolButton3->setTextLabel("delete"); | 78 | ToolButton3->setTextLabel("delete"); |
103 | ToolButton3->setPixmap(Resource::loadPixmap("editdelete")); | 79 | ToolButton3->setPixmap(Resource::loadPixmap("editdelete")); |
104 | ToolButton3->setAutoRaise(TRUE); | 80 | ToolButton3->setAutoRaise(TRUE); |
105 | ToolButton3->setFocusPolicy(QWidget::NoFocus); | 81 | ToolButton3->setFocusPolicy(QWidget::NoFocus); |
106 | connect(ToolButton3,SIGNAL(clicked()),m_PlayListSelection,SLOT(removeSelected())); | 82 | connect(ToolButton3,SIGNAL(clicked()),m_PlayListSelection,SLOT(removeSelected())); |
107 | 83 | ||
108 | ToolButton4->setTextLabel("up"); | 84 | ToolButton4->setTextLabel("up"); |
109 | ToolButton4->setPixmap(Resource::loadPixmap("up")); | 85 | ToolButton4->setPixmap(Resource::loadPixmap("up")); |
110 | ToolButton4->setAutoRaise(TRUE); | 86 | ToolButton4->setAutoRaise(TRUE); |
111 | ToolButton4->setFocusPolicy(QWidget::NoFocus); | 87 | ToolButton4->setFocusPolicy(QWidget::NoFocus); |
112 | connect(ToolButton4,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedUp())); | 88 | connect(ToolButton4,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedUp())); |
113 | 89 | ||
114 | ToolButton5->setTextLabel("down"); | 90 | ToolButton5->setTextLabel("down"); |
115 | ToolButton5->setPixmap(Resource::loadPixmap("down")); | 91 | ToolButton5->setPixmap(Resource::loadPixmap("down")); |
116 | ToolButton5->setAutoRaise(TRUE); | 92 | ToolButton5->setAutoRaise(TRUE); |
117 | ToolButton5->setFocusPolicy(QWidget::NoFocus); | 93 | ToolButton5->setFocusPolicy(QWidget::NoFocus); |
118 | 94 | ||
119 | connect(ToolButton5,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedDown())); | 95 | connect(ToolButton5,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedDown())); |
120 | 96 | ||
121 | 97 | ||
122 | 98 | ||
123 | 99 | ||
124 | QListViewItem *current = m_SuggestedCommandList->selectedItem(); | 100 | QListViewItem *current = m_SuggestedCommandList->selectedItem(); |
125 | if ( current ) | 101 | if ( current ) |
126 | item->moveItem( current ); | 102 | item->moveItem( current ); |
127 | m_SuggestedCommandList->setSelected( item, TRUE ); | 103 | m_SuggestedCommandList->setSelected( item, TRUE ); |
128 | m_SuggestedCommandList->ensureItemVisible( m_SuggestedCommandList->selectedItem() ); | 104 | m_SuggestedCommandList->ensureItemVisible( m_SuggestedCommandList->selectedItem() ); |
129 | Config cfg("Konsole"); | 105 | Config cfg("Konsole"); |
130 | cfg.setGroup("Commands"); | 106 | cfg.setGroup("Commands"); |
131 | if (cfg.readEntry("Commands Set","FALSE") == "TRUE") { | 107 | if (cfg.readEntry("Commands Set","FALSE") == "TRUE") { |
132 | for (int i = 0; i < 100; i++) { | 108 | for (int i = 0; i < 100; i++) { |
133 | QString tmp; | 109 | QString tmp; |
134 | tmp = cfg.readEntry( QString::number(i),""); | 110 | tmp = cfg.readEntry( QString::number(i),""); |
135 | if (!tmp.isEmpty()) | 111 | if (!tmp.isEmpty()) |
136 | m_PlayListSelection->addStringToSelection(tmp); | 112 | m_PlayListSelection->addStringToSelection(tmp); |
137 | } | 113 | } |
138 | } else { | 114 | } else { |
139 | 115 | ||
140 | m_PlayListSelection->addStringToSelection("ls "); | 116 | m_PlayListSelection->addStringToSelection("ls "); |
141 | m_PlayListSelection->addStringToSelection("cardctl eject"); | 117 | m_PlayListSelection->addStringToSelection("cardctl eject"); |
142 | m_PlayListSelection->addStringToSelection("cat "); | 118 | m_PlayListSelection->addStringToSelection("cat "); |
143 | m_PlayListSelection->addStringToSelection("cd "); | 119 | m_PlayListSelection->addStringToSelection("cd "); |
144 | m_PlayListSelection->addStringToSelection("chmod "); | 120 | m_PlayListSelection->addStringToSelection("chmod "); |
145 | m_PlayListSelection->addStringToSelection("cp "); | 121 | m_PlayListSelection->addStringToSelection("cp "); |
146 | m_PlayListSelection->addStringToSelection("dc "); | 122 | m_PlayListSelection->addStringToSelection("dc "); |
147 | m_PlayListSelection->addStringToSelection("df "); | 123 | m_PlayListSelection->addStringToSelection("df "); |
148 | m_PlayListSelection->addStringToSelection("dmesg"); | 124 | m_PlayListSelection->addStringToSelection("dmesg"); |
149 | m_PlayListSelection->addStringToSelection("echo "); | 125 | m_PlayListSelection->addStringToSelection("echo "); |
150 | m_PlayListSelection->addStringToSelection("env"); | 126 | m_PlayListSelection->addStringToSelection("env"); |
151 | m_PlayListSelection->addStringToSelection("find "); | 127 | m_PlayListSelection->addStringToSelection("find "); |
152 | m_PlayListSelection->addStringToSelection("free"); | 128 | m_PlayListSelection->addStringToSelection("free"); |
153 | m_PlayListSelection->addStringToSelection("grep "); | 129 | m_PlayListSelection->addStringToSelection("grep "); |
154 | m_PlayListSelection->addStringToSelection("ifconfig "); | 130 | m_PlayListSelection->addStringToSelection("ifconfig "); |
155 | m_PlayListSelection->addStringToSelection("ipkg "); | 131 | m_PlayListSelection->addStringToSelection("ipkg "); |
156 | m_PlayListSelection->addStringToSelection("mkdir "); | 132 | m_PlayListSelection->addStringToSelection("mkdir "); |
157 | m_PlayListSelection->addStringToSelection("mv "); | 133 | m_PlayListSelection->addStringToSelection("mv "); |
158 | m_PlayListSelection->addStringToSelection("nc localhost 7776"); | 134 | m_PlayListSelection->addStringToSelection("nc localhost 7776"); |
159 | m_PlayListSelection->addStringToSelection("nc localhost 7777"); | 135 | m_PlayListSelection->addStringToSelection("nc localhost 7777"); |
160 | m_PlayListSelection->addStringToSelection("nslookup "); | 136 | m_PlayListSelection->addStringToSelection("nslookup "); |
161 | m_PlayListSelection->addStringToSelection("ping "); | 137 | m_PlayListSelection->addStringToSelection("ping "); |
162 | m_PlayListSelection->addStringToSelection("ps aux"); | 138 | m_PlayListSelection->addStringToSelection("ps aux"); |
163 | m_PlayListSelection->addStringToSelection("pwd "); | 139 | m_PlayListSelection->addStringToSelection("pwd "); |
164 | m_PlayListSelection->addStringToSelection("rm "); | 140 | m_PlayListSelection->addStringToSelection("rm "); |
165 | m_PlayListSelection->addStringToSelection("rmdir "); | 141 | m_PlayListSelection->addStringToSelection("rmdir "); |
166 | m_PlayListSelection->addStringToSelection("route "); | 142 | m_PlayListSelection->addStringToSelection("route "); |
167 | m_PlayListSelection->addStringToSelection("set "); | 143 | m_PlayListSelection->addStringToSelection("set "); |
168 | m_PlayListSelection->addStringToSelection("traceroute"); | 144 | m_PlayListSelection->addStringToSelection("traceroute"); |
169 | 145 | ||
170 | } | 146 | } |
171 | } | 147 | } |
172 | CommandEditDialog::~CommandEditDialog() | 148 | CommandEditDialog::~CommandEditDialog() |
173 | { | 149 | { |
174 | } | 150 | } |
175 | 151 | ||
176 | void CommandEditDialog::accept() | 152 | void CommandEditDialog::accept() |
177 | { | 153 | { |
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index f13d0c9..3f6e0b4 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -36,192 +36,195 @@ | |||
36 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
37 | #include <qaction.h> | 37 | #include <qaction.h> |
38 | #include <qapplication.h> | 38 | #include <qapplication.h> |
39 | #include <qfontmetrics.h> | 39 | #include <qfontmetrics.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qevent.h> | 41 | #include <qevent.h> |
42 | #include <qtabwidget.h> | 42 | #include <qtabwidget.h> |
43 | #include <qtabbar.h> | 43 | #include <qtabbar.h> |
44 | #include <qpe/config.h> | 44 | #include <qpe/config.h> |
45 | #include <qstringlist.h> | 45 | #include <qstringlist.h> |
46 | #include <qpalette.h> | 46 | #include <qpalette.h> |
47 | 47 | ||
48 | #include <sys/wait.h> | 48 | #include <sys/wait.h> |
49 | #include <stdio.h> | 49 | #include <stdio.h> |
50 | #include <stdlib.h> | 50 | #include <stdlib.h> |
51 | #include <assert.h> | 51 | #include <assert.h> |
52 | 52 | ||
53 | #include "konsole.h" | 53 | #include "konsole.h" |
54 | #include "keytrans.h" | 54 | #include "keytrans.h" |
55 | #include "commandeditdialog.h" | 55 | #include "commandeditdialog.h" |
56 | 56 | ||
57 | class EKNumTabBar : public QTabBar { | 57 | class EKNumTabBar : public QTabBar { |
58 | public: | 58 | public: |
59 | void numberTabs() | 59 | void numberTabs() |
60 | { | 60 | { |
61 | // Yes, it really is this messy. QTabWidget needs functions | 61 | // Yes, it really is this messy. QTabWidget needs functions |
62 | // that provide acces to tabs in a sequential way. | 62 | // that provide acces to tabs in a sequential way. |
63 | int m=INT_MIN; | 63 | int m=INT_MIN; |
64 | for (int i=0; i<count(); i++) { | 64 | for (int i=0; i<count(); i++) { |
65 | QTab* left=0; | 65 | QTab* left=0; |
66 | QListIterator<QTab> it(*tabList()); | 66 | QListIterator<QTab> it(*tabList()); |
67 | int x=INT_MAX; | 67 | int x=INT_MAX; |
68 | for( QTab* t; (t=it.current()); ++it ) { | 68 | for( QTab* t; (t=it.current()); ++it ) { |
69 | int tx = t->rect().x(); | 69 | int tx = t->rect().x(); |
70 | if ( tx<x && tx>m ) { | 70 | if ( tx<x && tx>m ) { |
71 | x = tx; | 71 | x = tx; |
72 | left = t; | 72 | left = t; |
73 | } | 73 | } |
74 | } | 74 | } |
75 | if ( left ) { | 75 | if ( left ) { |
76 | left->setText(QString::number(i+1)); | 76 | left->setText(QString::number(i+1)); |
77 | m = left->rect().x(); | 77 | m = left->rect().x(); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | } | 80 | } |
81 | }; | 81 | }; |
82 | 82 | ||
83 | class EKNumTabWidget : public QTabWidget { | 83 | class EKNumTabWidget : public QTabWidget { |
84 | public: | 84 | public: |
85 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) | 85 | EKNumTabWidget(QWidget* parent) : QTabWidget(parent) |
86 | { | 86 | { |
87 | } | 87 | } |
88 | 88 | ||
89 | void addTab(QWidget* w) | 89 | void addTab(QWidget* w) |
90 | { | 90 | { |
91 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); | 91 | QTab* t = new QTab(QString::number(tabBar()->count()+1)); |
92 | QTabWidget::addTab(w,t); | 92 | QTabWidget::addTab(w,t); |
93 | } | 93 | } |
94 | 94 | ||
95 | void removeTab(QWidget* w) | 95 | void removeTab(QWidget* w) |
96 | { | 96 | { |
97 | removePage(w); | 97 | removePage(w); |
98 | ((EKNumTabBar*)tabBar())->numberTabs(); | 98 | ((EKNumTabBar*)tabBar())->numberTabs(); |
99 | } | 99 | } |
100 | }; | 100 | }; |
101 | 101 | ||
102 | // This could be configurable or dynamicly generated from the bash history | 102 | // This could be configurable or dynamicly generated from the bash history |
103 | // file of the user | 103 | // file of the user |
104 | static const char *commonCmds[] = | 104 | static const char *commonCmds[] = |
105 | { | 105 | { |
106 | "ls ", // I left this here, cause it looks better than the first alpha | 106 | "ls ", // I left this here, cause it looks better than the first alpha |
107 | "cardctl eject", | 107 | "cardctl eject", |
108 | "cat ", | 108 | "cat ", |
109 | "cd ", | 109 | "cd ", |
110 | "chmod ", | 110 | "chmod ", |
111 | "clear", | 111 | "clear", |
112 | "cp ", | 112 | "cp ", |
113 | "dc ", | 113 | "dc ", |
114 | "df ", | 114 | "df ", |
115 | "dmesg", | 115 | "dmesg", |
116 | "echo ", | 116 | "echo ", |
117 | "env", | 117 | "env", |
118 | "find ", | 118 | "find ", |
119 | "free", | 119 | "free", |
120 | "grep ", | 120 | "grep ", |
121 | "ifconfig ", | 121 | "ifconfig ", |
122 | "ipkg ", | 122 | "ipkg ", |
123 | "mkdir ", | 123 | "mkdir ", |
124 | "mv ", | 124 | "mv ", |
125 | "nc localhost 7776", | 125 | "nc localhost 7776", |
126 | "nc localhost 7777", | 126 | "nc localhost 7777", |
127 | "netstat ", | 127 | "netstat ", |
128 | "nslookup ", | 128 | "nslookup ", |
129 | "ping ", | 129 | "ping ", |
130 | "ps aux", | 130 | "ps aux", |
131 | "pwd ", | 131 | "pwd ", |
132 | "qcop QPE/System 'linkChanged(QString)' ''", | ||
133 | "qcop QPE/System 'restart()'", | ||
134 | "qcop QPE/System 'quit()'", | ||
132 | "rm ", | 135 | "rm ", |
133 | "rmdir ", | 136 | "rmdir ", |
134 | "route ", | 137 | "route ", |
135 | "set ", | 138 | "set ", |
136 | "traceroute", | 139 | "traceroute", |
137 | 140 | ||
138 | /* | 141 | /* |
139 | "gzip", | 142 | "gzip", |
140 | "gunzip", | 143 | "gunzip", |
141 | "chgrp", | 144 | "chgrp", |
142 | "chown", | 145 | "chown", |
143 | "date", | 146 | "date", |
144 | "dd", | 147 | "dd", |
145 | "df", | 148 | "df", |
146 | "dmesg", | 149 | "dmesg", |
147 | "fuser", | 150 | "fuser", |
148 | "hostname", | 151 | "hostname", |
149 | "kill", | 152 | "kill", |
150 | "killall", | 153 | "killall", |
151 | "ln", | 154 | "ln", |
152 | "ping", | 155 | "ping", |
153 | "mount", | 156 | "mount", |
154 | "more", | 157 | "more", |
155 | "sort", | 158 | "sort", |
156 | "touch", | 159 | "touch", |
157 | "umount", | 160 | "umount", |
158 | "mknod", | 161 | "mknod", |
159 | "netstat", | 162 | "netstat", |
160 | */ | 163 | */ |
161 | 164 | ||
162 | "exit", | 165 | "exit", |
163 | NULL | 166 | NULL |
164 | }; | 167 | }; |
165 | 168 | ||
166 | 169 | ||
167 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : | 170 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : |
168 | QMainWindow(parent, name, fl) | 171 | QMainWindow(parent, name, fl) |
169 | { | 172 | { |
170 | QStrList args; | 173 | QStrList args; |
171 | init("/bin/sh",args); | 174 | init("/bin/sh",args); |
172 | } | 175 | } |
173 | 176 | ||
174 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) | 177 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) |
175 | : QMainWindow(0, name) | 178 | : QMainWindow(0, name) |
176 | { | 179 | { |
177 | init(_pgm,_args); | 180 | init(_pgm,_args); |
178 | } | 181 | } |
179 | 182 | ||
180 | void Konsole::initCommandList() | 183 | void Konsole::initCommandList() |
181 | { | 184 | { |
182 | // qDebug("Konsole::initCommandList"); | 185 | // qDebug("Konsole::initCommandList"); |
183 | Config cfg("Konsole"); | 186 | Config cfg("Konsole"); |
184 | cfg.setGroup("Commands"); | 187 | cfg.setGroup("Commands"); |
185 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 188 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
186 | commonCombo->clear(); | 189 | commonCombo->clear(); |
187 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { | 190 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { |
188 | for (int i = 0; commonCmds[i] != NULL; i++) { | 191 | for (int i = 0; commonCmds[i] != NULL; i++) { |
189 | commonCombo->insertItem(commonCmds[i],i); | 192 | commonCombo->insertItem(commonCmds[i],i); |
190 | } | 193 | } |
191 | } else { | 194 | } else { |
192 | for (int i = 0; i < 100; i++) { | 195 | for (int i = 0; i < 100; i++) { |
193 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) | 196 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) |
194 | commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); | 197 | commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); |
195 | } | 198 | } |
196 | } | 199 | } |
197 | 200 | ||
198 | } | 201 | } |
199 | 202 | ||
200 | void Konsole::init(const char* _pgm, QStrList & _args) | 203 | void Konsole::init(const char* _pgm, QStrList & _args) |
201 | { | 204 | { |
202 | b_scroll = TRUE; // histon; | 205 | b_scroll = TRUE; // histon; |
203 | n_keytab = 0; | 206 | n_keytab = 0; |
204 | n_render = 0; | 207 | n_render = 0; |
205 | startUp=0; | 208 | startUp=0; |
206 | setCaption( tr("Terminal") ); | 209 | setCaption( tr("Terminal") ); |
207 | setIcon( Resource::loadPixmap( "konsole" ) ); | 210 | setIcon( Resource::loadPixmap( "konsole" ) ); |
208 | 211 | ||
209 | Config cfg("Konsole"); | 212 | Config cfg("Konsole"); |
210 | cfg.setGroup("Konsole"); | 213 | cfg.setGroup("Konsole"); |
211 | QString tmp; | 214 | QString tmp; |
212 | // initialize the list of allowed fonts /////////////////////////////////// | 215 | // initialize the list of allowed fonts /////////////////////////////////// |
213 | cfont = cfg.readNumEntry("FontID", 1); | 216 | cfont = cfg.readNumEntry("FontID", 1); |
214 | QFont f = QFont("Micro", 4, QFont::Normal); | 217 | QFont f = QFont("Micro", 4, QFont::Normal); |
215 | f.setFixedPitch(TRUE); | 218 | f.setFixedPitch(TRUE); |
216 | fonts.append(new VTFont(tr("Micro"), f)); | 219 | fonts.append(new VTFont(tr("Micro"), f)); |
217 | 220 | ||
218 | f = QFont("Fixed", 7, QFont::Normal); | 221 | f = QFont("Fixed", 7, QFont::Normal); |
219 | f.setFixedPitch(TRUE); | 222 | f.setFixedPitch(TRUE); |
220 | fonts.append(new VTFont(tr("Small Fixed"), f)); | 223 | fonts.append(new VTFont(tr("Small Fixed"), f)); |
221 | 224 | ||
222 | f = QFont("Fixed", 12, QFont::Normal); | 225 | f = QFont("Fixed", 12, QFont::Normal); |
223 | f.setFixedPitch(TRUE); | 226 | f.setFixedPitch(TRUE); |
224 | fonts.append(new VTFont(tr("Medium Fixed"), f)); | 227 | fonts.append(new VTFont(tr("Medium Fixed"), f)); |
225 | 228 | ||
226 | // create terminal emulation framework //////////////////////////////////// | 229 | // create terminal emulation framework //////////////////////////////////// |
227 | nsessions = 0; | 230 | nsessions = 0; |