summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-02-03 18:23:27 (UTC)
committer llornkcor <llornkcor>2002-02-03 18:23:27 (UTC)
commit09c3eed0c594f4c93157faf5269ef4d975a310ca (patch) (unidiff)
tree9034282b1376e00baadc4405d1c24c1067d6bcb9
parentbbbccc44398fc92dcbb148def8d30f2e78f71aa5 (diff)
downloadopie-09c3eed0c594f4c93157faf5269ef4d975a310ca.zip
opie-09c3eed0c594f4c93157faf5269ef4d975a310ca.tar.gz
opie-09c3eed0c594f4c93157faf5269ef4d975a310ca.tar.bz2
merged in Marks commandlist edit dialog
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/commandeditdialog.cpp224
-rw-r--r--core/apps/embeddedkonsole/commandeditdialog.h25
-rw-r--r--core/apps/embeddedkonsole/commandeditdialogbase.ui296
-rw-r--r--core/apps/embeddedkonsole/commandeditwidget.cpp45
-rw-r--r--core/apps/embeddedkonsole/commandeditwidget.h33
-rwxr-xr-xcore/apps/embeddedkonsole/embeddedkonsole.pro68
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp274
-rw-r--r--core/apps/embeddedkonsole/konsole.h7
-rw-r--r--core/apps/embeddedkonsole/playlistselection.cpp161
-rw-r--r--core/apps/embeddedkonsole/playlistselection.h74
-rw-r--r--core/apps/embeddedkonsole/smallcommandeditdialogbase.ui62
11 files changed, 1136 insertions, 133 deletions
diff --git a/core/apps/embeddedkonsole/commandeditdialog.cpp b/core/apps/embeddedkonsole/commandeditdialog.cpp
new file mode 100644
index 0000000..e8ef858
--- a/dev/null
+++ b/core/apps/embeddedkonsole/commandeditdialog.cpp
@@ -0,0 +1,224 @@
1//comandeditdialog.cpp
2
3#include "commandeditdialog.h"
4#include "playlistselection.h"
5#include <qstring.h>
6#include <qpe/config.h>
7#include <qpe/qpetoolbar.h>
8#include <qwidget.h>
9#include <qpe/qpemenubar.h>
10#include <qpe/resource.h>
11#include <qlist.h>
12#include <qtoolbutton.h>
13#include <qvbox.h>
14#include <qlistview.h>
15#include <qlineedit.h>
16#include <qheader.h>
17#include <qlabel.h>
18#include <qmessagebox.h>
19#include "smallcommandeditdialogbase.h"
20
21CommandEditDialog::CommandEditDialog(QWidget *parent, const char* name, WFlags fl )
22 : CommandEditDialogBase(parent, name, TRUE, fl)
23
24{
25 m_SuggestedCommandList->addColumn( tr("Command Selection") );
26 m_SuggestedCommandList->header()->hide();
27 m_SuggestedCommandList->setSorting(-1,FALSE);
28 m_SuggestedCommandList->clearSelection();
29 m_SuggestedCommandList->setSorting(0,TRUE);
30
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 ");
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 ");
49 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 ");
62 item = new QListViewItem( m_SuggestedCommandList,"gunzip ");
63 item = new QListViewItem( m_SuggestedCommandList,"chgrp ");
64 item = new QListViewItem( m_SuggestedCommandList,"chown ");
65 item = new QListViewItem( m_SuggestedCommandList,"date ");
66 item = new QListViewItem( m_SuggestedCommandList,"dd ");
67 item = new QListViewItem( m_SuggestedCommandList,"df ");
68 item = new QListViewItem( m_SuggestedCommandList,"dmesg ");
69 item = new QListViewItem( m_SuggestedCommandList,"fuser ");
70 item = new QListViewItem( m_SuggestedCommandList,"hostname ");
71 item = new QListViewItem( m_SuggestedCommandList,"kill ");
72 item = new QListViewItem( m_SuggestedCommandList,"killall ");
73 item = new QListViewItem( m_SuggestedCommandList,"ln ");
74 item = new QListViewItem( m_SuggestedCommandList,"ln -s ");
75 item = new QListViewItem( m_SuggestedCommandList,"mount ");
76 item = new QListViewItem( m_SuggestedCommandList,"more ");
77 item = new QListViewItem( m_SuggestedCommandList,"sort ");
78 item = new QListViewItem( m_SuggestedCommandList,"touch ");
79 item = new QListViewItem( m_SuggestedCommandList,"umount ");
80 item = new QListViewItem( m_SuggestedCommandList,"mknod ");
81 item = new QListViewItem( m_SuggestedCommandList,"netstat ");
82 item = new QListViewItem( m_SuggestedCommandList,"cardctl eject ");
83 m_SuggestedCommandList->setSelected(m_SuggestedCommandList->firstChild(),TRUE);
84 m_SuggestedCommandList->sort();
85
86 connect( m_SuggestedCommandList, SIGNAL( clicked( QListViewItem * ) ), m_PlayListSelection, SLOT( addToSelection( QListViewItem *) ) );
87
88
89
90 ToolButton1->setTextLabel("new");
91 ToolButton1->setPixmap(Resource::loadPixmap("new"));
92 ToolButton1->setAutoRaise(TRUE);
93 ToolButton1->setFocusPolicy(QWidget::NoFocus);
94 connect(ToolButton1,SIGNAL(clicked()),this,SLOT(showAddDialog()));
95
96 ToolButton2->setTextLabel("edit");
97 ToolButton2->setPixmap(Resource::loadPixmap("edit"));
98 ToolButton2->setAutoRaise(TRUE);
99 ToolButton2->setFocusPolicy(QWidget::NoFocus);
100 connect(ToolButton2,SIGNAL(clicked()),this,SLOT(showEditDialog()));
101
102 ToolButton3->setTextLabel("delete");
103 ToolButton3->setPixmap(Resource::loadPixmap("editdelete"));
104 ToolButton3->setAutoRaise(TRUE);
105 ToolButton3->setFocusPolicy(QWidget::NoFocus);
106 connect(ToolButton3,SIGNAL(clicked()),m_PlayListSelection,SLOT(removeSelected()));
107
108 ToolButton4->setTextLabel("up");
109 ToolButton4->setPixmap(Resource::loadPixmap("up"));
110 ToolButton4->setAutoRaise(TRUE);
111 ToolButton4->setFocusPolicy(QWidget::NoFocus);
112 connect(ToolButton4,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedUp()));
113
114 ToolButton5->setTextLabel("down");
115 ToolButton5->setPixmap(Resource::loadPixmap("down"));
116 ToolButton5->setAutoRaise(TRUE);
117 ToolButton5->setFocusPolicy(QWidget::NoFocus);
118
119connect(ToolButton5,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedDown()));
120
121
122
123
124 QListViewItem *current = m_SuggestedCommandList->selectedItem();
125 if ( current )
126 item->moveItem( current );
127 m_SuggestedCommandList->setSelected( item, TRUE );
128 m_SuggestedCommandList->ensureItemVisible( m_SuggestedCommandList->selectedItem() );
129 Config cfg("Konsole");
130 cfg.setGroup("Commands");
131 if (cfg.readEntry("Commands Set","FALSE") == "TRUE") {
132 for (int i = 0; i < 100; i++) {
133 QString tmp;
134 tmp = cfg.readEntry( QString::number(i),"");
135 if (!tmp.isEmpty())
136 m_PlayListSelection->addStringToSelection(tmp);
137 }
138 } else {
139
140m_PlayListSelection->addStringToSelection("ls ");
141m_PlayListSelection->addStringToSelection("cardctl eject");
142m_PlayListSelection->addStringToSelection("cat ");
143m_PlayListSelection->addStringToSelection("cd ");
144m_PlayListSelection->addStringToSelection("chmod ");
145m_PlayListSelection->addStringToSelection("cp ");
146m_PlayListSelection->addStringToSelection("dc ");
147m_PlayListSelection->addStringToSelection("df ");
148m_PlayListSelection->addStringToSelection("dmesg");
149m_PlayListSelection->addStringToSelection("echo ");
150m_PlayListSelection->addStringToSelection("env");
151m_PlayListSelection->addStringToSelection("find ");
152m_PlayListSelection->addStringToSelection("free");
153m_PlayListSelection->addStringToSelection("grep ");
154m_PlayListSelection->addStringToSelection("ifconfig ");
155m_PlayListSelection->addStringToSelection("ipkg ");
156m_PlayListSelection->addStringToSelection("mkdir ");
157m_PlayListSelection->addStringToSelection("mv ");
158m_PlayListSelection->addStringToSelection("nc localhost 7776");
159m_PlayListSelection->addStringToSelection("nc localhost 7777");
160m_PlayListSelection->addStringToSelection("nslookup ");
161m_PlayListSelection->addStringToSelection("ping ");
162m_PlayListSelection->addStringToSelection("ps aux");
163m_PlayListSelection->addStringToSelection("pwd ");
164m_PlayListSelection->addStringToSelection("rm ");
165m_PlayListSelection->addStringToSelection("rmdir ");
166m_PlayListSelection->addStringToSelection("route ");
167m_PlayListSelection->addStringToSelection("set ");
168m_PlayListSelection->addStringToSelection("traceroute");
169
170}
171}
172CommandEditDialog::~CommandEditDialog()
173{
174}
175
176void CommandEditDialog::accept()
177{
178int i = 0;
179 Config *cfg = new Config("Konsole");
180 cfg->setGroup("Commands");
181 cfg->clearGroup();
182
183 QListViewItemIterator it( m_PlayListSelection );
184
185 for ( ; it.current(); ++it ) {
186// qDebug(it.current()->text(0));
187 cfg->writeEntry(QString::number(i),it.current()->text(0));
188 i++;
189
190 }
191 cfg->writeEntry("Commands Set","TRUE");
192// qDebug("CommandEditDialog::accept() - written");
193 delete cfg;
194 emit commandsEdited();
195 close();
196
197
198
199
200
201}
202
203void CommandEditDialog::showEditDialog()
204{
205editCommandBase *d = new editCommandBase(this,"smalleditdialog", TRUE);
206d->setCaption("Edit command");
207d->TextLabel->setText("Edit command:");
208d->commandEdit->setText(m_PlayListSelection->currentItem()->text(0));
209int i = d->exec();
210if ((i==1) && (!(d->commandEdit->text()).isEmpty()))
211 m_PlayListSelection->currentItem()->setText(0,(d->commandEdit->text()));
212}
213
214void CommandEditDialog::showAddDialog()
215{
216
217editCommandBase *d = new editCommandBase(this,"smalleditdialog", TRUE);
218int i = d->exec();
219if ((i==1) && (!(d->commandEdit->text()).isEmpty()))
220m_PlayListSelection->addStringToSelection(d->commandEdit->text());
221
222}
223
224
diff --git a/core/apps/embeddedkonsole/commandeditdialog.h b/core/apps/embeddedkonsole/commandeditdialog.h
new file mode 100644
index 0000000..6dcf93f
--- a/dev/null
+++ b/core/apps/embeddedkonsole/commandeditdialog.h
@@ -0,0 +1,25 @@
1//comandeditdialog.h
2#ifndef COMMAND_EDIT_DIALOG_H
3#define COMMAND_EDIT_DIALOG_H
4#include "commandeditdialogbase.h"
5class CommandEditDialog : public CommandEditDialogBase
6{
7Q_OBJECT
8
9public:
10
11 CommandEditDialog( QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
12 ~CommandEditDialog();
13
14protected:
15 void accept();
16
17public slots:
18 void showEditDialog();
19 void showAddDialog();
20
21signals:
22 void commandsEdited();
23};
24
25#endif
diff --git a/core/apps/embeddedkonsole/commandeditdialogbase.ui b/core/apps/embeddedkonsole/commandeditdialogbase.ui
new file mode 100644
index 0000000..dc22e87
--- a/dev/null
+++ b/core/apps/embeddedkonsole/commandeditdialogbase.ui
@@ -0,0 +1,296 @@
1<!DOCTYPE UI><UI>
2<class>CommandEditDialogBase</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>CommandEditDialogBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>196</width>
15 <height>414</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Commands</string>
21 </property>
22 <grid>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget row="0" column="0" >
32 <class>QLabel</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>TextLabel1</cstring>
36 </property>
37 <property stdset="1">
38 <name>sizePolicy</name>
39 <sizepolicy>
40 <hsizetype>0</hsizetype>
41 <vsizetype>0</vsizetype>
42 </sizepolicy>
43 </property>
44 <property stdset="1">
45 <name>text</name>
46 <string>&lt;B&gt;Commands&lt;/B&gt;:</string>
47 </property>
48 </widget>
49 <widget row="1" column="2" >
50 <class>QLayoutWidget</class>
51 <property stdset="1">
52 <name>name</name>
53 <cstring>Layout2</cstring>
54 </property>
55 <vbox>
56 <property stdset="1">
57 <name>margin</name>
58 <number>0</number>
59 </property>
60 <property stdset="1">
61 <name>spacing</name>
62 <number>6</number>
63 </property>
64 <widget>
65 <class>QToolButton</class>
66 <property stdset="1">
67 <name>name</name>
68 <cstring>ToolButton1</cstring>
69 </property>
70 <property stdset="1">
71 <name>sizePolicy</name>
72 <sizepolicy>
73 <hsizetype>5</hsizetype>
74 <vsizetype>5</vsizetype>
75 </sizepolicy>
76 </property>
77 </widget>
78 <widget>
79 <class>QToolButton</class>
80 <property stdset="1">
81 <name>name</name>
82 <cstring>ToolButton2</cstring>
83 </property>
84 <property stdset="1">
85 <name>sizePolicy</name>
86 <sizepolicy>
87 <hsizetype>5</hsizetype>
88 <vsizetype>5</vsizetype>
89 </sizepolicy>
90 </property>
91 </widget>
92 <widget>
93 <class>QToolButton</class>
94 <property stdset="1">
95 <name>name</name>
96 <cstring>ToolButton3</cstring>
97 </property>
98 <property stdset="1">
99 <name>sizePolicy</name>
100 <sizepolicy>
101 <hsizetype>5</hsizetype>
102 <vsizetype>5</vsizetype>
103 </sizepolicy>
104 </property>
105 </widget>
106 <widget>
107 <class>QToolButton</class>
108 <property stdset="1">
109 <name>name</name>
110 <cstring>ToolButton4</cstring>
111 </property>
112 <property stdset="1">
113 <name>sizePolicy</name>
114 <sizepolicy>
115 <hsizetype>5</hsizetype>
116 <vsizetype>5</vsizetype>
117 </sizepolicy>
118 </property>
119 </widget>
120 <widget>
121 <class>QToolButton</class>
122 <property stdset="1">
123 <name>name</name>
124 <cstring>ToolButton5</cstring>
125 </property>
126 <property stdset="1">
127 <name>sizePolicy</name>
128 <sizepolicy>
129 <hsizetype>5</hsizetype>
130 <vsizetype>5</vsizetype>
131 </sizepolicy>
132 </property>
133 </widget>
134 </vbox>
135 </widget>
136 <spacer row="0" column="2" >
137 <property>
138 <name>name</name>
139 <cstring>Spacer3</cstring>
140 </property>
141 <property stdset="1">
142 <name>orientation</name>
143 <enum>Horizontal</enum>
144 </property>
145 <property stdset="1">
146 <name>sizeType</name>
147 <enum>Fixed</enum>
148 </property>
149 <property>
150 <name>sizeHint</name>
151 <size>
152 <width>21</width>
153 <height>20</height>
154 </size>
155 </property>
156 </spacer>
157 <widget row="2" column="0" >
158 <class>QLabel</class>
159 <property stdset="1">
160 <name>name</name>
161 <cstring>TextLabel1_2</cstring>
162 </property>
163 <property stdset="1">
164 <name>sizePolicy</name>
165 <sizepolicy>
166 <hsizetype>0</hsizetype>
167 <vsizetype>0</vsizetype>
168 </sizepolicy>
169 </property>
170 <property stdset="1">
171 <name>text</name>
172 <string>&lt;B&gt;Suggested Commands&lt;/B&gt;:</string>
173 </property>
174 </widget>
175 <widget row="1" column="0" rowspan="1" colspan="2" >
176 <class>PlayListSelection</class>
177 <property stdset="1">
178 <name>name</name>
179 <cstring>m_PlayListSelection</cstring>
180 </property>
181 <property stdset="1">
182 <name>sizePolicy</name>
183 <sizepolicy>
184 <hsizetype>5</hsizetype>
185 <vsizetype>5</vsizetype>
186 </sizepolicy>
187 </property>
188 </widget>
189 <spacer row="2" column="1" >
190 <property>
191 <name>name</name>
192 <cstring>Spacer17</cstring>
193 </property>
194 <property stdset="1">
195 <name>orientation</name>
196 <enum>Vertical</enum>
197 </property>
198 <property stdset="1">
199 <name>sizeType</name>
200 <enum>Fixed</enum>
201 </property>
202 <property>
203 <name>sizeHint</name>
204 <size>
205 <width>20</width>
206 <height>30</height>
207 </size>
208 </property>
209 </spacer>
210 <spacer row="2" column="2" >
211 <property>
212 <name>name</name>
213 <cstring>Spacer2</cstring>
214 </property>
215 <property stdset="1">
216 <name>orientation</name>
217 <enum>Vertical</enum>
218 </property>
219 <property stdset="1">
220 <name>sizeType</name>
221 <enum>Fixed</enum>
222 </property>
223 <property>
224 <name>sizeHint</name>
225 <size>
226 <width>20</width>
227 <height>20</height>
228 </size>
229 </property>
230 </spacer>
231 <widget row="3" column="0" rowspan="1" colspan="2" >
232 <class>QListView</class>
233 <property stdset="1">
234 <name>name</name>
235 <cstring>m_SuggestedCommandList</cstring>
236 </property>
237 </widget>
238 </grid>
239</widget>
240<customwidgets>
241 <customwidget>
242 <class>PlayListSelection</class>
243 <header location="local">playlistselection.h</header>
244 <sizehint>
245 <width>-1</width>
246 <height>-1</height>
247 </sizehint>
248 <container>0</container>
249 <sizepolicy>
250 <hordata>5</hordata>
251 <verdata>5</verdata>
252 </sizepolicy>
253 <pixmap>image0</pixmap>
254 <slot access="public">prev()</slot>
255 <slot access="public">next()</slot>
256 <slot access="public">first()</slot>
257 <slot access="public">last()</slot>
258 <slot access="public">moveSelectedDown()</slot>
259 <slot access="public">moveSelectedUp()</slot>
260 </customwidget>
261 <customwidget>
262 <class>QToolButton</class>
263 <header location="global">qtoolbutton.h</header>
264 <sizehint>
265 <width>-1</width>
266 <height>-1</height>
267 </sizehint>
268 <container>0</container>
269 <sizepolicy>
270 <hordata>5</hordata>
271 <verdata>5</verdata>
272 </sizepolicy>
273 <pixmap>image0</pixmap>
274 </customwidget>
275 <customwidget>
276 <class>QListView</class>
277 <header location="global">qlistview.h</header>
278 <sizehint>
279 <width>-1</width>
280 <height>-1</height>
281 </sizehint>
282 <container>0</container>
283 <sizepolicy>
284 <hordata>5</hordata>
285 <verdata>5</verdata>
286 </sizepolicy>
287 <pixmap>image0</pixmap>
288 </customwidget>
289</customwidgets>
290<images>
291 <image>
292 <name>image0</name>
293 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
294 </image>
295</images>
296</UI>
diff --git a/core/apps/embeddedkonsole/commandeditwidget.cpp b/core/apps/embeddedkonsole/commandeditwidget.cpp
new file mode 100644
index 0000000..84962ef
--- a/dev/null
+++ b/core/apps/embeddedkonsole/commandeditwidget.cpp
@@ -0,0 +1,45 @@
1/****************************************************************************
2** Form implementation generated from reading ui file 'commandeditwidget.ui'
3**
4** Created: Sat Feb 2 11:08:25 2002
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#include "commandeditwidget.h"
10
11#include <qpushbutton.h>
12#include "playlistselection.h"
13#include <qlayout.h>
14#include <qvariant.h>
15#include <qtooltip.h>
16#include <qwhatsthis.h>
17
18/*
19 * Constructs a Form1 which is a child of 'parent', with the
20 * name 'name' and widget flags set to 'f'
21 */
22Form1::Form1( QWidget* parent, const char* name, WFlags fl )
23 : QWidget( parent, name, fl )
24{
25 if ( !name )
26 setName( "Form1" );
27 resize( 596, 480 );
28 setCaption( tr( "Form1" ) );
29 Form1Layout = new QGridLayout( this );
30 Form1Layout->setSpacing( 6 );
31 Form1Layout->setMargin( 11 );
32
33 MyCustomWidget1 = new PlayListSelection( this, "MyCustomWidget1" );
34
35 Form1Layout->addWidget( MyCustomWidget1, 0, 0 );
36}
37
38/*
39 * Destroys the object and frees any allocated resources
40 */
41Form1::~Form1()
42{
43 // no need to delete child widgets, Qt does it all for us
44}
45
diff --git a/core/apps/embeddedkonsole/commandeditwidget.h b/core/apps/embeddedkonsole/commandeditwidget.h
new file mode 100644
index 0000000..c88de73
--- a/dev/null
+++ b/core/apps/embeddedkonsole/commandeditwidget.h
@@ -0,0 +1,33 @@
1/****************************************************************************
2** Form interface generated from reading ui file 'commandeditwidget.ui'
3**
4** Created: Sat Feb 2 11:08:25 2002
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#ifndef FORM1_H
10#define FORM1_H
11
12#include <qvariant.h>
13#include <qwidget.h>
14class QVBoxLayout;
15class QHBoxLayout;
16class QGridLayout;
17class PlayListSelection;
18
19class Form1 : public QWidget
20{
21 Q_OBJECT
22
23public:
24 Form1( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
25 ~Form1();
26
27 PlayListSelection* MyCustomWidget1;
28
29protected:
30 QGridLayout* Form1Layout;
31};
32
33#endif // FORM1_H
diff --git a/core/apps/embeddedkonsole/embeddedkonsole.pro b/core/apps/embeddedkonsole/embeddedkonsole.pro
index 3452014..f4e1f2d 100755
--- a/core/apps/embeddedkonsole/embeddedkonsole.pro
+++ b/core/apps/embeddedkonsole/embeddedkonsole.pro
@@ -1,38 +1,36 @@
1 TEMPLATE= app 1TEMPLATE = app
2 2CONFIG += qt warn_on release
3 CONFIG += qt warn_on release 3DESTDIR = $(OPIEDIR)/bin
4 4HEADERS = TEWidget.h \
5 DESTDIR = $(OPIEDIR)/bin 5 TEScreen.h \
6 6 TECommon.h \
7 HEADERS = TEWidget.h \ 7 TEHistory.h \
8 TEScreen.h \ 8 TEmulation.h \
9 TECommon.h \ 9 TEmuVt102.h \
10 TEHistory.h \ 10 session.h \
11 TEmulation.h \ 11 keytrans.h \
12 TEmuVt102.h \ 12 konsole.h \
13 session.h \ 13 commandeditdialog.h \
14 keytrans.h \ 14 commandeditwidget.h \
15 konsole.h \ 15 playlistselection.h \
16 MyPty.h 16 MyPty.h
17 17SOURCES = TEScreen.cpp \
18 SOURCES = TEScreen.cpp \ 18 TEWidget.cpp \
19 TEWidget.cpp \ 19 TEHistory.cpp \
20 TEHistory.cpp \ 20 TEmulation.cpp \
21 TEmulation.cpp \ 21 TEmuVt102.cpp \
22 TEmuVt102.cpp \ 22 session.cpp \
23 session.cpp \ 23 keytrans.cpp \
24 keytrans.cpp \ 24 konsole.cpp \
25 konsole.cpp \ 25 commandeditdialog.cpp \
26 main.cpp \ 26 commandeditwidget.cpp \
27 MyPty.cpp 27 playlistselection.cpp \
28 28 MyPty.cpp \
29 TARGET = embeddedkonsole 29 main.cpp
30 30INTERFACES = commandeditdialogbase.ui smallcommandeditdialogbase.ui
31TARGET = embeddedkonsole
31INCLUDEPATH += $(OPIEDIR)/include 32INCLUDEPATH += $(OPIEDIR)/include
32 33DEPENDPATH += $(OPIEDIR)/include
33 DEPENDPATH+= $(OPIEDIR)/include
34
35LIBS += -lqpe 34LIBS += -lqpe
36 35REQUIRES = embeddedkonsole
37 REQUIRES= embeddedkonsole
38 36
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index 23c12f8..bc5a766 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -30,48 +30,49 @@
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qfontdialog.h> 31#include <qfontdialog.h>
32#include <qglobal.h> 32#include <qglobal.h>
33#include <qpainter.h> 33#include <qpainter.h>
34#include <qpe/qpemenubar.h> 34#include <qpe/qpemenubar.h>
35#include <qmessagebox.h> 35#include <qmessagebox.h>
36#include <qaction.h> 36#include <qaction.h>
37#include <qapplication.h> 37#include <qapplication.h>
38#include <qfontmetrics.h> 38#include <qfontmetrics.h>
39#include <qcombobox.h> 39#include <qcombobox.h>
40#include <qevent.h> 40#include <qevent.h>
41#include <qtabwidget.h> 41#include <qtabwidget.h>
42#include <qtabbar.h> 42#include <qtabbar.h>
43#include <qpe/config.h> 43#include <qpe/config.h>
44#include <qstringlist.h> 44#include <qstringlist.h>
45#include <qpalette.h> 45#include <qpalette.h>
46 46
47#include <sys/wait.h> 47#include <sys/wait.h>
48#include <stdio.h> 48#include <stdio.h>
49#include <stdlib.h> 49#include <stdlib.h>
50#include <assert.h> 50#include <assert.h>
51 51
52#include "konsole.h" 52#include "konsole.h"
53#include "keytrans.h" 53#include "keytrans.h"
54#include "commandeditdialog.h"
54 55
55class EKNumTabBar : public QTabBar { 56class EKNumTabBar : public QTabBar {
56public: 57public:
57 void numberTabs() 58 void numberTabs()
58 { 59 {
59 // Yes, it really is this messy. QTabWidget needs functions 60 // Yes, it really is this messy. QTabWidget needs functions
60 // that provide acces to tabs in a sequential way. 61 // that provide acces to tabs in a sequential way.
61 int m=INT_MIN; 62 int m=INT_MIN;
62 for (int i=0; i<count(); i++) { 63 for (int i=0; i<count(); i++) {
63 QTab* left=0; 64 QTab* left=0;
64 QListIterator<QTab> it(*tabList()); 65 QListIterator<QTab> it(*tabList());
65 int x=INT_MAX; 66 int x=INT_MAX;
66 for( QTab* t; (t=it.current()); ++it ) { 67 for( QTab* t; (t=it.current()); ++it ) {
67 int tx = t->rect().x(); 68 int tx = t->rect().x();
68 if ( tx<x && tx>m ) { 69 if ( tx<x && tx>m ) {
69 x = tx; 70 x = tx;
70 left = t; 71 left = t;
71 } 72 }
72 } 73 }
73 if ( left ) { 74 if ( left ) {
74 left->setText(QString::number(i+1)); 75 left->setText(QString::number(i+1));
75 m = left->rect().x(); 76 m = left->rect().x();
76 } 77 }
77 } 78 }
@@ -154,48 +155,68 @@ static const char *commonCmds[] =
154 "touch", 155 "touch",
155 "umount", 156 "umount",
156 "mknod", 157 "mknod",
157 "netstat", 158 "netstat",
158*/ 159*/
159 160
160 "exit", 161 "exit",
161 NULL 162 NULL
162}; 163};
163 164
164 165
165Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : 166Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) :
166 QMainWindow(parent, name, fl) 167 QMainWindow(parent, name, fl)
167{ 168{
168 QStrList args; 169 QStrList args;
169 init("/bin/sh",args); 170 init("/bin/sh",args);
170} 171}
171 172
172Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) 173Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int)
173 : QMainWindow(0, name) 174 : QMainWindow(0, name)
174{ 175{
175 init(_pgm,_args); 176 init(_pgm,_args);
176} 177}
177 178
179void Konsole::initCommandList()
180{
181// qDebug("Konsole::initCommandList");
182 Config cfg("Konsole");
183 cfg.setGroup("Commands");
184 commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
185 commonCombo->clear();
186 if (cfg.readEntry("Commands Set","FALSE") == "FALSE") {
187 for (int i = 0; commonCmds[i] != NULL; i++) {
188 commonCombo->insertItem(commonCmds[i],i);
189 }
190 } else {
191 for (int i = 0; i < 100; i++) {
192 if (!(cfg.readEntry( QString::number(i),"")).isEmpty())
193 commonCombo->insertItem((cfg.readEntry( QString::number(i),"")));
194 }
195 }
196
197}
198
178void Konsole::init(const char* _pgm, QStrList & _args) 199void Konsole::init(const char* _pgm, QStrList & _args)
179{ 200{
180 b_scroll = TRUE; // histon; 201 b_scroll = TRUE; // histon;
181 n_keytab = 0; 202 n_keytab = 0;
182 n_render = 0; 203 n_render = 0;
183 204
184 setCaption( tr("Terminal") ); 205 setCaption( tr("Terminal") );
185 setIcon( Resource::loadPixmap( "konsole" ) ); 206 setIcon( Resource::loadPixmap( "konsole" ) );
186 207
187 Config cfg("Konsole"); 208 Config cfg("Konsole");
188 cfg.setGroup("Konsole"); 209 cfg.setGroup("Konsole");
189 QString tmp; 210 QString tmp;
190 // initialize the list of allowed fonts /////////////////////////////////// 211 // initialize the list of allowed fonts ///////////////////////////////////
191 cfont = cfg.readNumEntry("FontID", 1); 212 cfont = cfg.readNumEntry("FontID", 1);
192 QFont f = QFont("Micro", 4, QFont::Normal); 213 QFont f = QFont("Micro", 4, QFont::Normal);
193 f.setFixedPitch(TRUE); 214 f.setFixedPitch(TRUE);
194 fonts.append(new VTFont(tr("Micro"), f)); 215 fonts.append(new VTFont(tr("Micro"), f));
195 216
196 f = QFont("Fixed", 7, QFont::Normal); 217 f = QFont("Fixed", 7, QFont::Normal);
197 f.setFixedPitch(TRUE); 218 f.setFixedPitch(TRUE);
198 fonts.append(new VTFont(tr("Small Fixed"), f)); 219 fonts.append(new VTFont(tr("Small Fixed"), f));
199 220
200 f = QFont("Fixed", 12, QFont::Normal); 221 f = QFont("Fixed", 12, QFont::Normal);
201 f.setFixedPitch(TRUE); 222 f.setFixedPitch(TRUE);
@@ -204,139 +225,145 @@ void Konsole::init(const char* _pgm, QStrList & _args)
204 // create terminal emulation framework //////////////////////////////////// 225 // create terminal emulation framework ////////////////////////////////////
205 nsessions = 0; 226 nsessions = 0;
206 227
207 tab = new EKNumTabWidget(this); 228 tab = new EKNumTabWidget(this);
208 229
209 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); 230 connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*)));
210 231
211 // create terminal toolbar //////////////////////////////////////////////// 232 // create terminal toolbar ////////////////////////////////////////////////
212 setToolBarsMovable( FALSE ); 233 setToolBarsMovable( FALSE );
213 QPEToolBar *menuToolBar = new QPEToolBar( this ); 234 QPEToolBar *menuToolBar = new QPEToolBar( this );
214 menuToolBar->setHorizontalStretchable( TRUE ); 235 menuToolBar->setHorizontalStretchable( TRUE );
215 236
216 QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); 237 QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar );
217 238
218 fontList = new QPopupMenu( this ); 239 fontList = new QPopupMenu( this );
219 for(uint i = 0; i < fonts.count(); i++) { 240 for(uint i = 0; i < fonts.count(); i++) {
220 VTFont *fnt = fonts.at(i); 241 VTFont *fnt = fonts.at(i);
221 fontList->insertItem(fnt->getName(), i); 242 fontList->insertItem(fnt->getName(), i);
222 } 243 }
223 fontChanged(cfont); 244 fontChanged(cfont);
224 245
225 configMenu = new QPopupMenu( this); 246 configMenu = new QPopupMenu( this);
226 colorMenu = new QPopupMenu( this); 247 colorMenu = new QPopupMenu( this);
227 scrollMenu = new QPopupMenu( this); 248 scrollMenu = new QPopupMenu( this);
249 editCommandListMenu = new QPopupMenu( this);
250
251 configMenu->insertItem("Command List",editCommandListMenu);
228 252
229 bool listHidden; 253 bool listHidden;
230 cfg.setGroup("Menubar"); 254 cfg.setGroup("Menubar");
231 if( cfg.readEntry("Hidden","FALSE") == "TRUE") { 255 if( cfg.readEntry("Hidden","FALSE") == "TRUE") {
232 configMenu->insertItem("Show command list"); 256 editCommandListMenu->insertItem("Show command list");
233 listHidden=TRUE; 257 listHidden=TRUE;
234 } else { 258 } else {
235 configMenu->insertItem("Hide command list"); 259 editCommandListMenu->insertItem("Hide command list");
236 listHidden=FALSE; 260 listHidden=FALSE;
237 } 261 }
238 262
239 cfg.setGroup("Tabs"); 263 cfg.setGroup("Tabs");
240 tmp=cfg.readEntry("Position","Bottom"); 264 tmp=cfg.readEntry("Position","Bottom");
241 if(tmp=="Top") { 265 if(tmp=="Top") {
242 tab->setTabPosition(QTabWidget::Top); 266 tab->setTabPosition(QTabWidget::Top);
243 configMenu->insertItem("Tabs on Bottom"); 267 configMenu->insertItem("Tabs on Bottom");
244 } else { 268 } else {
245 tab->setTabPosition(QTabWidget::Bottom); 269 tab->setTabPosition(QTabWidget::Bottom);
246 configMenu->insertItem("Tabs on Top"); 270 configMenu->insertItem("Tabs on Top");
247 } 271 }
248 configMenu->insertSeparator(2); 272 configMenu->insertSeparator(2);
249 273
250 colorMenu->insertItem("Green on Black"); 274 colorMenu->insertItem("Green on Black");
251 colorMenu->insertItem("Black on White"); 275 colorMenu->insertItem("Black on White");
252 colorMenu->insertItem("White on Black"); 276 colorMenu->insertItem("White on Black");
253 colorMenu->insertItem("Black on Transparent"); 277 colorMenu->insertItem("Black on Transparent");
254 colorMenu->insertItem("Black on Red"); 278 colorMenu->insertItem("Black on Red");
255 colorMenu->insertItem("Red on Black"); 279 colorMenu->insertItem("Red on Black");
256 colorMenu->insertItem("Green on Yellow"); 280 colorMenu->insertItem("Green on Yellow");
257 colorMenu->insertItem("Blue on Magenta"); 281 colorMenu->insertItem("Blue on Magenta");
258 colorMenu->insertItem("Magenta on Blue"); 282 colorMenu->insertItem("Magenta on Blue");
259 colorMenu->insertItem("Cyan on White"); 283 colorMenu->insertItem("Cyan on White");
260 colorMenu->insertItem("White on Cyan"); 284 colorMenu->insertItem("White on Cyan");
261 colorMenu->insertItem("Blue on Black"); 285 colorMenu->insertItem("Blue on Black");
262 colorMenu->insertItem("Amber on Black"); 286 colorMenu->insertItem("Amber on Black");
263 configMenu->insertItem("Colors",colorMenu); 287 configMenu->insertItem("Colors",colorMenu);
264 288
265 connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); 289 connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) ));
266 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); 290 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) ));
267 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); 291 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) ));
268 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); 292 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int)));
269 293 connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int)));
270 menuBar->insertItem( tr("Font"), fontList ); 294 menuBar->insertItem( tr("Font"), fontList );
271 menuBar->insertItem( tr("Options"), configMenu ); 295 menuBar->insertItem( tr("Options"), configMenu );
272 296
273 QPEToolBar *toolbar = new QPEToolBar( this ); 297 QPEToolBar *toolbar = new QPEToolBar( this );
274 298
275 QAction *a; 299 QAction *a;
276 300
277 // Button Commands 301 // Button Commands
278 a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); 302 a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 );
279 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); 303 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar );
280 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); 304 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 );
281 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); 305 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar );
282 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); 306 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 );
283 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); 307 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar );
284 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); 308 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 );
285 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); 309 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar );
286 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); 310 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 );
287 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); 311 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
288 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); 312 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 );
289 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); 313 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
290 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); 314 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 );
291 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); 315 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar );
292/* 316/*
293 a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); 317 a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 );
294 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); 318 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
295 a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); 319 a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 );
296 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); 320 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
297*/ 321*/
298 322
299 secondToolBar = new QPEToolBar( this ); 323 secondToolBar = new QPEToolBar( this );
300 secondToolBar->setHorizontalStretchable( TRUE ); 324 secondToolBar->setHorizontalStretchable( TRUE );
301 325
302 commonCombo = new QComboBox( secondToolBar ); 326 commonCombo = new QComboBox( secondToolBar );
303 commonCombo->setMaximumWidth(236); 327 commonCombo->setMaximumWidth(236);
304 configMenu->insertItem( "Edit Command List"); 328
329 editCommandListMenu->insertItem( "Quick Edit");
305 if( listHidden) { 330 if( listHidden) {
306 secondToolBar->hide(); 331 secondToolBar->hide();
307 configMenu->setItemEnabled(-20 ,FALSE); 332 editCommandListMenu->setItemEnabled(-22 ,FALSE);
308 } 333 }
334 editCommandListMenu->insertItem( "Edit");
309 335
310 cfg.setGroup("Commands"); 336 cfg.setGroup("Commands");
311 commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 337 commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
312 338
313 for (int i = 0; commonCmds[i] != NULL; i++) { 339 initCommandList();
314 commonCombo->insertItem( commonCmds[i], i ); 340// for (int i = 0; commonCmds[i] != NULL; i++) {
315 tmp = cfg.readEntry( QString::number(i),""); 341// commonCombo->insertItem( commonCmds[i], i );
316 if(tmp != "") 342// tmp = cfg.readEntry( QString::number(i),"");
317 commonCombo->changeItem( tmp,i ); 343// if(tmp != "")
318 } 344// commonCombo->changeItem( tmp,i );
345// }
319 346
320 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); 347 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) ));
321 348
322 scrollMenu->insertItem("None"); 349 scrollMenu->insertItem("None");
323 scrollMenu->insertItem("Left"); 350 scrollMenu->insertItem("Left");
324 scrollMenu->insertItem("Right"); 351 scrollMenu->insertItem("Right");
325 configMenu->insertItem("ScrollBar",scrollMenu); 352 configMenu->insertItem("ScrollBar",scrollMenu);
326 353
327 // create applications ///////////////////////////////////////////////////// 354 // create applications /////////////////////////////////////////////////////
328 setCentralWidget(tab); 355 setCentralWidget(tab);
329 356
330 // load keymaps //////////////////////////////////////////////////////////// 357 // load keymaps ////////////////////////////////////////////////////////////
331 KeyTrans::loadAll(); 358 KeyTrans::loadAll();
332 for (int i = 0; i < KeyTrans::count(); i++) 359 for (int i = 0; i < KeyTrans::count(); i++)
333 { KeyTrans* s = KeyTrans::find(i); 360 { KeyTrans* s = KeyTrans::find(i);
334 assert( s ); 361 assert( s );
335 } 362 }
336 363
337 se_pgm = _pgm; 364 se_pgm = _pgm;
338 se_args = _args; 365 se_args = _args;
339 366
340 // read and apply default values /////////////////////////////////////////// 367 // read and apply default values ///////////////////////////////////////////
341 resize(321, 321); // Dummy. 368 resize(321, 321); // Dummy.
342 QSize currentSize = size(); 369 QSize currentSize = size();
@@ -565,236 +592,291 @@ TEWidget* Konsole::getTe() {
565 if (nsessions) { 592 if (nsessions) {
566 return (TEWidget *) tab->currentPage(); 593 return (TEWidget *) tab->currentPage();
567 } else { 594 } else {
568 return 0; 595 return 0;
569 } 596 }
570} 597}
571 598
572void Konsole::switchSession(QWidget* w) { 599void Konsole::switchSession(QWidget* w) {
573 TEWidget* te = (TEWidget *) w; 600 TEWidget* te = (TEWidget *) w;
574 601
575 QFont teFnt = te->getVTFont(); 602 QFont teFnt = te->getVTFont();
576 for(uint i = 0; i < fonts.count(); i++) { 603 for(uint i = 0; i < fonts.count(); i++) {
577 VTFont *fnt = fonts.at(i); 604 VTFont *fnt = fonts.at(i);
578 bool cf = fnt->getFont() == teFnt; 605 bool cf = fnt->getFont() == teFnt;
579 fontList->setItemChecked(i, cf); 606 fontList->setItemChecked(i, cf);
580 if (cf) { 607 if (cf) {
581 cfont = i; 608 cfont = i;
582 } 609 }
583 } 610 }
584} 611}
585 612
586/// ------------------------------- some new stuff by L.J. Potter 613/// ------------------------------- some new stuff by L.J. Potter
587void Konsole::colorMenuSelected(int iD) 614void Konsole::colorMenuSelected(int iD)
588{ // this is NOT pretty, elegant or anything else besides functional 615{ // this is NOT pretty, elegant or anything else besides functional
589// QString temp; 616// QString temp;
590// qDebug( temp.sprintf("%d", iD)); 617// qDebug( temp.sprintf("colormenu %d", iD));
591 TEWidget* te = getTe(); 618 TEWidget* te = getTe();
592 Config cfg("Konsole"); 619 Config cfg("Konsole");
593 cfg.setGroup("Colors"); 620 cfg.setGroup("Colors");
594 QColor foreground; 621 QColor foreground;
595 QColor background; 622 QColor background;
596 colorMenu->setItemChecked(lastSelectedMenu,FALSE); 623 colorMenu->setItemChecked(lastSelectedMenu,FALSE);
597 ColorEntry m_table[TABLE_COLORS]; 624 ColorEntry m_table[TABLE_COLORS];
598 const ColorEntry * defaultCt=te->getdefaultColorTable(); 625 const ColorEntry * defaultCt=te->getdefaultColorTable();
599 /////////// fore back 626 /////////// fore back
600 int i; 627 int i;
601 if(iD==-8) { // default default 628 if(iD==-9) { // default default
602 for (i = 0; i < TABLE_COLORS; i++) { 629 for (i = 0; i < TABLE_COLORS; i++) {
603 m_table[i].color = defaultCt[i].color; 630 m_table[i].color = defaultCt[i].color;
604 if(i==1 || i == 11) 631 if(i==1 || i == 11)
605 m_table[i].transparent=1; 632 m_table[i].transparent=1;
606 cfg.writeEntry("Schema","8"); 633 cfg.writeEntry("Schema","98");
607 colorMenu->setItemChecked(-8,TRUE); 634 colorMenu->setItemChecked(-9,TRUE);
608 } 635 }
609 } else { 636 } else {
610 if(iD==-5) { // green black 637 if(iD==-6) { // green black
611 foreground.setRgb(0x18,255,0x18); 638 foreground.setRgb(0x18,255,0x18);
612 background.setRgb(0x00,0x00,0x00); 639 background.setRgb(0x00,0x00,0x00);
613 cfg.writeEntry("Schema","5"); 640 cfg.writeEntry("Schema","6");
614 colorMenu->setItemChecked(-5,TRUE); 641 colorMenu->setItemChecked(-6,TRUE);
615 } 642 }
616 if(iD==-6) { // black white 643 if(iD==-7) { // black white
617 foreground.setRgb(0x00,0x00,0x00); 644 foreground.setRgb(0x00,0x00,0x00);
618 background.setRgb(0xFF,0xFF,0xFF); 645 background.setRgb(0xFF,0xFF,0xFF);
619 cfg.writeEntry("Schema","6"); 646 cfg.writeEntry("Schema","7");
620 colorMenu->setItemChecked(-6,TRUE); 647 colorMenu->setItemChecked(-7,TRUE);
621 } 648 }
622 if(iD==-7) { // white black 649 if(iD==-8) { // white black
623 foreground.setRgb(0xFF,0xFF,0xFF); 650 foreground.setRgb(0xFF,0xFF,0xFF);
624 background.setRgb(0x00,0x00,0x00); 651 background.setRgb(0x00,0x00,0x00);
625 cfg.writeEntry("Schema","7"); 652 cfg.writeEntry("Schema","8");
626 colorMenu->setItemChecked(-7,TRUE); 653 colorMenu->setItemChecked(-8,TRUE);
627 } 654 }
628 if(iD==-9) {// Black, Red 655 if(iD==-10) {// Black, Red
629 foreground.setRgb(0x00,0x00,0x00); 656 foreground.setRgb(0x00,0x00,0x00);
630 background.setRgb(0xB2,0x18,0x18); 657 background.setRgb(0xB2,0x18,0x18);
631 cfg.writeEntry("Schema","9"); 658 cfg.writeEntry("Schema","10");
632 colorMenu->setItemChecked(-9,TRUE); 659 colorMenu->setItemChecked(-10,TRUE);
633 } 660 }
634 if(iD==-10) {// Red, Black 661 if(iD==-11) {// Red, Black
635 foreground.setRgb(230,31,31); //0xB2,0x18,0x18 662 foreground.setRgb(230,31,31); //0xB2,0x18,0x18
636 background.setRgb(0x00,0x00,0x00); 663 background.setRgb(0x00,0x00,0x00);
637 cfg.writeEntry("Schema","10"); 664 cfg.writeEntry("Schema","11");
638 colorMenu->setItemChecked(-10,TRUE); 665 colorMenu->setItemChecked(-11,TRUE);
639 } 666 }
640 if(iD==-11) {// Green, Yellow - is ugly 667 if(iD==-12) {// Green, Yellow - is ugly
641// foreground.setRgb(0x18,0xB2,0x18); 668// foreground.setRgb(0x18,0xB2,0x18);
642 foreground.setRgb(36,139,10); 669 foreground.setRgb(36,139,10);
643// background.setRgb(0xB2,0x68,0x18); 670// background.setRgb(0xB2,0x68,0x18);
644 background.setRgb(255,255,0); 671 background.setRgb(255,255,0);
645 cfg.writeEntry("Schema","11");
646 colorMenu->setItemChecked(-11,TRUE);
647 }
648 if(iD==-12) {// Blue, Magenta
649 foreground.setRgb(0x18,0xB2,0xB2);
650 background.setRgb(0x18,0x18,0xB2);
651 cfg.writeEntry("Schema","12"); 672 cfg.writeEntry("Schema","12");
652 colorMenu->setItemChecked(-12,TRUE); 673 colorMenu->setItemChecked(-12,TRUE);
653 } 674 }
654 if(iD==-13) {// Magenta, Blue 675 if(iD==-13) {// Blue, Magenta
655 foreground.setRgb(0x18,0x18,0xB2); 676 foreground.setRgb(0x18,0xB2,0xB2);
656 background.setRgb(0x18,0xB2,0xB2); 677 background.setRgb(0x18,0x18,0xB2);
657 cfg.writeEntry("Schema","13"); 678 cfg.writeEntry("Schema","13");
658 colorMenu->setItemChecked(-13,TRUE); 679 colorMenu->setItemChecked(-13,TRUE);
659 } 680 }
660 if(iD==-14) {// Cyan, White 681 if(iD==-14) {// Magenta, Blue
661 foreground.setRgb(0x18,0xB2,0xB2); 682 foreground.setRgb(0x18,0x18,0xB2);
662 background.setRgb(0xFF,0xFF,0xFF); 683 background.setRgb(0x18,0xB2,0xB2);
663 cfg.writeEntry("Schema","14"); 684 cfg.writeEntry("Schema","14");
664 colorMenu->setItemChecked(-14,TRUE); 685 colorMenu->setItemChecked(-14,TRUE);
665 } 686 }
666 if(iD==-15) {// White, Cyan 687 if(iD==-15) {// Cyan, White
667 background.setRgb(0x18,0xB2,0xB2); 688 foreground.setRgb(0x18,0xB2,0xB2);
668 foreground.setRgb(0xFF,0xFF,0xFF); 689 background.setRgb(0xFF,0xFF,0xFF);
669 cfg.writeEntry("Schema","15"); 690 cfg.writeEntry("Schema","15");
670 colorMenu->setItemChecked(-15,TRUE); 691 colorMenu->setItemChecked(-15,TRUE);
671 } 692 }
672 if(iD==-16) {// Black, Blue 693 if(iD==-16) {// White, Cyan
673 background.setRgb(0x00,0x00,0x00); 694 background.setRgb(0x18,0xB2,0xB2);
674 foreground.setRgb(0x18,0xB2,0xB2); 695 foreground.setRgb(0xFF,0xFF,0xFF);
675 cfg.writeEntry("Schema","16"); 696 cfg.writeEntry("Schema","16");
676 colorMenu->setItemChecked(-16,TRUE); 697 colorMenu->setItemChecked(-16,TRUE);
677 } 698 }
678 if(iD==-17) {// Black, Gold 699 if(iD==-17) {// Black, Blue
679 background.setRgb(0x00,0x00,0x00); 700 background.setRgb(0x00,0x00,0x00);
680 foreground.setRgb(255,215,0); 701 foreground.setRgb(0x18,0xB2,0xB2);
681 cfg.writeEntry("Schema","17"); 702 cfg.writeEntry("Schema","17");
682 colorMenu->setItemChecked(-17,TRUE); 703 colorMenu->setItemChecked(-17,TRUE);
683 } 704 }
705 if(iD==-18) {// Black, Gold
706 background.setRgb(0x00,0x00,0x00);
707 foreground.setRgb(255,215,0);
708 cfg.writeEntry("Schema","18");
709 colorMenu->setItemChecked(-18,TRUE);
710 }
684 711
685 for (i = 0; i < TABLE_COLORS; i++) { 712 for (i = 0; i < TABLE_COLORS; i++) {
686 if(i==0 || i == 10) { 713 if(i==0 || i == 10) {
687 m_table[i].color = foreground; 714 m_table[i].color = foreground;
688 } 715 }
689 else if(i==1 || i == 11) { 716 else if(i==1 || i == 11) {
690 m_table[i].color = background; m_table[i].transparent=0; 717 m_table[i].color = background; m_table[i].transparent=0;
691 } 718 }
692 else 719 else
693 m_table[i].color = defaultCt[i].color; 720 m_table[i].color = defaultCt[i].color;
694 } 721 }
695 } 722 }
696 lastSelectedMenu = iD; 723 lastSelectedMenu = iD;
697 te->setColorTable(m_table); 724 te->setColorTable(m_table);
698 update(); 725 update();
699} 726}
700 727
701void Konsole::configMenuSelected(int iD) 728void Konsole::configMenuSelected(int iD)
702{ 729{
703 QString temp; 730 QString temp;
704 qDebug( temp.sprintf("%d",iD)); 731 qDebug( temp.sprintf("configmenu %d",iD));
705 TEWidget* te = getTe(); 732 TEWidget* te = getTe();
706 Config cfg("Konsole"); 733 Config cfg("Konsole");
707 cfg.setGroup("Menubar"); 734 cfg.setGroup("Menubar");
708 if( iD == -2) { 735// if( iD == -2) {
709 if(!secondToolBar->isHidden()) { 736// if(!secondToolBar->isHidden()) {
710 secondToolBar->hide(); 737// secondToolBar->hide();
711 configMenu->changeItem( iD,"Show Command List"); 738// configMenu->changeItem( iD,"Show Command List");
712 cfg.writeEntry("Hidden","TRUE"); 739// cfg.writeEntry("Hidden","TRUE");
713 configMenu->setItemEnabled(-20 ,FALSE); 740// configMenu->setItemEnabled(-20 ,FALSE);
714 } else { 741// } else {
715 secondToolBar->show(); 742// secondToolBar->show();
716 configMenu->changeItem( iD,"Hide Command List"); 743// configMenu->changeItem( iD,"Hide Command List");
717 cfg.writeEntry("Hidden","FALSE"); 744// cfg.writeEntry("Hidden","FALSE");
718 configMenu->setItemEnabled(-20 ,TRUE); 745// configMenu->setItemEnabled(-20 ,TRUE);
719 746
720 if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { 747// if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") {
721 configMenu->setItemChecked(-20,TRUE); 748// configMenu->setItemChecked(-20,TRUE);
722 commonCombo->setEditable( TRUE ); 749// commonCombo->setEditable( TRUE );
723 } else { 750// } else {
724 configMenu->setItemChecked(-20,FALSE); 751// configMenu->setItemChecked(-20,FALSE);
725 commonCombo->setEditable( FALSE ); 752// commonCombo->setEditable( FALSE );
726 } 753// }
727 } 754// }
728 } 755// }
729 if( iD == -3) { 756 if( iD == -4) {
730 cfg.setGroup("Tabs"); 757 cfg.setGroup("Tabs");
731 QString tmp=cfg.readEntry("Position","Top"); 758 QString tmp=cfg.readEntry("Position","Top");
732 759
733 if(tmp=="Top") { 760 if(tmp=="Top") {
734 tab->setTabPosition(QTabWidget::Bottom); 761 tab->setTabPosition(QTabWidget::Bottom);
735 configMenu->changeItem( iD,"Tabs on Top"); 762 configMenu->changeItem( iD,"Tabs on Top");
736 cfg.writeEntry("Position","Bottom"); 763 cfg.writeEntry("Position","Bottom");
737 } else { 764 } else {
738 tab->setTabPosition(QTabWidget::Top); 765 tab->setTabPosition(QTabWidget::Top);
739 configMenu->changeItem( iD,"Tabs on Bottom"); 766 configMenu->changeItem( iD,"Tabs on Bottom");
740 cfg.writeEntry("Position","Top"); 767 cfg.writeEntry("Position","Top");
741 } 768 }
742 } 769 }
743 if( iD == -20) { 770// if( iD == -20) {
744 cfg.setGroup("Commands"); 771// cfg.setGroup("Commands");
745// qDebug("enableCommandEdit"); 772// // qDebug("enableCommandEdit");
746 if( !configMenu->isItemChecked(iD) ) { 773// if( !configMenu->isItemChecked(iD) ) {
747 commonCombo->setEditable( TRUE ); 774// commonCombo->setEditable( TRUE );
748 configMenu->setItemChecked(iD,TRUE); 775// configMenu->setItemChecked(iD,TRUE);
749 commonCombo->setCurrentItem(0); 776// commonCombo->setCurrentItem(0);
750 cfg.writeEntry("EditEnabled","TRUE"); 777// cfg.writeEntry("EditEnabled","TRUE");
751 } else { 778// } else {
752 commonCombo->setEditable( FALSE ); 779// commonCombo->setEditable( FALSE );
753 configMenu->setItemChecked(iD,FALSE); 780// configMenu->setItemChecked(iD,FALSE);
754 cfg.writeEntry("EditEnabled","FALSE"); 781// cfg.writeEntry("EditEnabled","FALSE");
755 commonCombo->setFocusPolicy(QWidget::NoFocus); 782// commonCombo->setFocusPolicy(QWidget::NoFocus);
756 te->setFocus(); 783// te->setFocus();
757 } 784// }
758 } 785// }
759} 786}
760 787
761void Konsole::changeCommand(const QString &text, int c) 788void Konsole::changeCommand(const QString &text, int c)
762{ 789{
763 Config cfg("Konsole"); 790 Config cfg("Konsole");
764 cfg.setGroup("Commands"); 791 cfg.setGroup("Commands");
765 if(commonCmds[c] != text) { 792 if(commonCmds[c] != text) {
766 cfg.writeEntry(QString::number(c),text); 793 cfg.writeEntry(QString::number(c),text);
767 commonCombo->clearEdit(); 794 commonCombo->clearEdit();
768 commonCombo->setCurrentItem(c); 795 commonCombo->setCurrentItem(c);
769 } 796 }
770} 797}
771 798
772void Konsole::setColor() 799void Konsole::setColor()
773{ 800{
774 Config cfg("Konsole"); 801 Config cfg("Konsole");
775 cfg.setGroup("Colors"); 802 cfg.setGroup("Colors");
776 int scheme = cfg.readNumEntry("Schema",1); 803 int scheme = cfg.readNumEntry("Schema",1);
777 if(scheme != 1) colorMenuSelected( -scheme); 804 if(scheme != 1) colorMenuSelected( -scheme);
778} 805}
779 806
780void Konsole::scrollMenuSelected(int index) 807void Konsole::scrollMenuSelected(int index)
781{ 808{
809// QString temp;
810// qDebug( temp.sprintf("scrollbar menu %d",index));
782 TEWidget* te = getTe(); 811 TEWidget* te = getTe();
783 Config cfg("Konsole"); 812 Config cfg("Konsole");
784 cfg.setGroup("Scrollbar"); 813 cfg.setGroup("Scrollbar");
785 switch( index){ 814 switch( index){
786 case -21: 815 case -24:
787 te->setScrollbarLocation(0); 816 te->setScrollbarLocation(0);
788 cfg.writeEntry("Position",0); 817 cfg.writeEntry("Position",0);
789 break; 818 break;
790 case -22: 819 case -25:
791 te->setScrollbarLocation(1); 820 te->setScrollbarLocation(1);
792 cfg.writeEntry("Position",1); 821 cfg.writeEntry("Position",1);
793 break; 822 break;
794 case -23: 823 case -26:
795 te->setScrollbarLocation(2); 824 te->setScrollbarLocation(2);
796 cfg.writeEntry("Position",2); 825 cfg.writeEntry("Position",2);
797 break; 826 break;
798 }; 827 };
799 828
800} 829}
830
831void Konsole::editCommandListMenuSelected(int iD)
832{
833// QString temp;
834// qDebug( temp.sprintf("edit command list %d",iD));
835 TEWidget* te = getTe();
836 Config cfg("Konsole");
837 cfg.setGroup("Menubar");
838 if( iD == -3) {
839 if(!secondToolBar->isHidden()) {
840 secondToolBar->hide();
841 configMenu->changeItem( iD,"Show Command List");
842 cfg.writeEntry("Hidden","TRUE");
843 configMenu->setItemEnabled(-22 ,FALSE);
844 } else {
845 secondToolBar->show();
846 configMenu->changeItem( iD,"Hide Command List");
847 cfg.writeEntry("Hidden","FALSE");
848 configMenu->setItemEnabled(-22 ,TRUE);
849
850 if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") {
851 configMenu->setItemChecked(-22,TRUE);
852 commonCombo->setEditable( TRUE );
853 } else {
854 configMenu->setItemChecked(-22,FALSE);
855 commonCombo->setEditable( FALSE );
856 }
857 }
858 }
859 if( iD == -22) {
860 cfg.setGroup("Commands");
861// qDebug("enableCommandEdit");
862 if( !configMenu->isItemChecked(iD) ) {
863 commonCombo->setEditable( TRUE );
864 configMenu->setItemChecked(iD,TRUE);
865 commonCombo->setCurrentItem(0);
866 cfg.writeEntry("EditEnabled","TRUE");
867 } else {
868 commonCombo->setEditable( FALSE );
869 configMenu->setItemChecked(iD,FALSE);
870 cfg.writeEntry("EditEnabled","FALSE");
871 commonCombo->setFocusPolicy(QWidget::NoFocus);
872 te->setFocus();
873 }
874 }
875 if(iD == -23) {
876 // "edit commands"
877 CommandEditDialog *m = new CommandEditDialog(this);
878 connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList()));
879 m->showMaximized();
880 }
881
882}
diff --git a/core/apps/embeddedkonsole/konsole.h b/core/apps/embeddedkonsole/konsole.h
index b4e5d87..b508cf8 100644
--- a/core/apps/embeddedkonsole/konsole.h
+++ b/core/apps/embeddedkonsole/konsole.h
@@ -49,83 +49,86 @@ public:
49 Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); 49 Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
50 Konsole(const char * name, const char* pgm, QStrList & _args, int histon); 50 Konsole(const char * name, const char* pgm, QStrList & _args, int histon);
51 ~Konsole(); 51 ~Konsole();
52 void setColLin(int columns, int lines); 52 void setColLin(int columns, int lines);
53 QPEToolBar *secondToolBar; 53 QPEToolBar *secondToolBar;
54 void show(); 54 void show();
55 void setColor(); 55 void setColor();
56 int lastSelectedMenu; 56 int lastSelectedMenu;
57private slots: 57private slots:
58 void doneSession(TESession*,int); 58 void doneSession(TESession*,int);
59 void changeColumns(int); 59 void changeColumns(int);
60 void fontChanged(int); 60 void fontChanged(int);
61 void configMenuSelected(int ); 61 void configMenuSelected(int );
62 void colorMenuSelected(int); 62 void colorMenuSelected(int);
63 void enterCommand(int); 63 void enterCommand(int);
64 void hitEnter(); 64 void hitEnter();
65 void hitSpace(); 65 void hitSpace();
66 void hitTab(); 66 void hitTab();
67 void hitPaste(); 67 void hitPaste();
68 void hitUp(); 68 void hitUp();
69 void hitDown(); 69 void hitDown();
70 void switchSession(QWidget *); 70 void switchSession(QWidget *);
71 void newSession(); 71 void newSession();
72 void changeCommand(const QString &, int); 72 void changeCommand(const QString &, int);
73 void initCommandList();
73 void scrollMenuSelected(int); 74 void scrollMenuSelected(int);
75 void editCommandListMenuSelected(int);
74private: 76private:
75 void init(const char* _pgm, QStrList & _args); 77 void init(const char* _pgm, QStrList & _args);
76 void initSession(const char* _pgm, QStrList & _args); 78 void initSession(const char* _pgm, QStrList & _args);
77 void runSession(TESession* s); 79 void runSession(TESession* s);
78 void setColorPixmaps(); 80 void setColorPixmaps();
79 void setHistory(bool); 81 void setHistory(bool);
80 QSize calcSize(int columns, int lines); 82 QSize calcSize(int columns, int lines);
81 TEWidget* getTe(); 83 TEWidget* getTe();
82 84 QStringList commands;
85
83private: 86private:
84 class VTFont 87 class VTFont
85 { 88 {
86 public: 89 public:
87 VTFont(QString name, QFont& font) 90 VTFont(QString name, QFont& font)
88 { 91 {
89 this->name = name; 92 this->name = name;
90 this->font = font; 93 this->font = font;
91 } 94 }
92 95
93 QFont& getFont() 96 QFont& getFont()
94 { 97 {
95 return font; 98 return font;
96 } 99 }
97 100
98 QString getName() 101 QString getName()
99 { 102 {
100 return name; 103 return name;
101 } 104 }
102 105
103 private: 106 private:
104 QString name; 107 QString name;
105 QFont font; 108 QFont font;
106 }; 109 };
107 110
108 EKNumTabWidget* tab; 111 EKNumTabWidget* tab;
109 int nsessions; 112 int nsessions;
110 QList<VTFont> fonts; 113 QList<VTFont> fonts;
111 int cfont; 114 int cfont;
112 QCString se_pgm; 115 QCString se_pgm;
113 QStrList se_args; 116 QStrList se_args;
114 117
115 QPopupMenu* fontList,*configMenu,*colorMenu,*scrollMenu; 118 QPopupMenu *fontList,*configMenu,*colorMenu,*scrollMenu,*editCommandListMenu;
116 QComboBox *commonCombo; 119 QComboBox *commonCombo;
117 // history scrolling I think 120 // history scrolling I think
118 bool b_scroll; 121 bool b_scroll;
119 122
120 int n_keytab; 123 int n_keytab;
121 int n_scroll; 124 int n_scroll;
122 int n_render; 125 int n_render;
123 QString pmPath; // pixmap path 126 QString pmPath; // pixmap path
124 QString dropText; 127 QString dropText;
125 QFont defaultFont; 128 QFont defaultFont;
126 QSize defaultSize; 129 QSize defaultSize;
127 130
128}; 131};
129 132
130#endif 133#endif
131 134
diff --git a/core/apps/embeddedkonsole/playlistselection.cpp b/core/apps/embeddedkonsole/playlistselection.cpp
new file mode 100644
index 0000000..b9b9401
--- a/dev/null
+++ b/core/apps/embeddedkonsole/playlistselection.cpp
@@ -0,0 +1,161 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#include <qpe/applnk.h>
21#include <qpe/resource.h>
22#include <qpainter.h>
23#include <qimage.h>
24#include <qheader.h>
25#include <qlistview.h>
26#include <qlist.h>
27#include <qpixmap.h>
28
29#include "playlistselection.h"
30
31#include <stdlib.h>
32
33
34
35
36
37PlayListSelection::PlayListSelection( QWidget *parent, const char *name )
38 : QListView( parent, name )
39{
40 setAllColumnsShowFocus( TRUE );
41 addColumn( tr( "Command Selection" ) );
42 header()->hide();
43 setSorting( -1, FALSE );
44}
45
46
47PlayListSelection::~PlayListSelection() {
48}
49
50
51
52void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) {
53 if ( event->state() == QMouseEvent::LeftButton ) {
54 QListViewItem *currentItem = selectedItem();
55 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) );
56 if ( currentItem && currentItem->itemAbove() == itemUnder )
57 moveSelectedUp();
58 else if ( currentItem && currentItem->itemBelow() == itemUnder )
59 moveSelectedDown();
60 }
61}
62
63
64const QString *PlayListSelection::current() {
65 PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem();
66 if ( item )
67 return item->file();
68 return NULL;
69}
70
71
72void PlayListSelection::addToSelection( QListViewItem *lnk ) {
73PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk->text(0) ) );
74 QListViewItem *current = selectedItem();
75 if ( current )
76 item->moveItem( current );
77 setSelected( item, TRUE );
78 ensureItemVisible( selectedItem() );
79}
80
81void PlayListSelection::addStringToSelection (const QString & lnk) {
82 PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk ) );
83 QListViewItem *current = selectedItem();
84 if ( current )
85 item->moveItem( current );
86 setSelected( item, TRUE );
87 ensureItemVisible( selectedItem() );
88
89}
90void PlayListSelection::removeSelected() {
91 qDebug("removeSelected()");
92 QListViewItem *item = selectedItem();
93 if ( item )
94 delete item;
95 setSelected( currentItem(), TRUE );
96 ensureItemVisible( selectedItem() );
97}
98
99
100void PlayListSelection::moveSelectedUp() {
101 QListViewItem *item = selectedItem();
102 if ( item && item->itemAbove() )
103 item->itemAbove()->moveItem( item );
104 ensureItemVisible( selectedItem() );
105}
106
107
108void PlayListSelection::moveSelectedDown() {
109 QListViewItem *item = selectedItem();
110 if ( item && item->itemBelow() )
111 item->moveItem( item->itemBelow() );
112 ensureItemVisible( selectedItem() );
113}
114
115
116bool PlayListSelection::prev() {
117 QListViewItem *item = selectedItem();
118 if ( item && item->itemAbove() )
119 setSelected( item->itemAbove(), TRUE );
120 else
121 return FALSE;
122 ensureItemVisible( selectedItem() );
123 return TRUE;
124}
125
126
127bool PlayListSelection::next() {
128 QListViewItem *item = selectedItem();
129 if ( item && item->itemBelow() )
130 setSelected( item->itemBelow(), TRUE );
131 else
132 return FALSE;
133 ensureItemVisible( selectedItem() );
134 return TRUE;
135}
136
137
138bool PlayListSelection::first() {
139 QListViewItem *item = firstChild();
140 if ( item )
141 setSelected( item, TRUE );
142 else
143 return FALSE;
144 ensureItemVisible( selectedItem() );
145 return TRUE;
146}
147
148
149bool PlayListSelection::last() {
150 QListViewItem *prevItem = NULL;
151 QListViewItem *item = firstChild();
152 while ( ( item = item->nextSibling() ) )
153 prevItem = item;
154 if ( prevItem )
155 setSelected( prevItem, TRUE );
156 else
157 return FALSE;
158 ensureItemVisible( selectedItem() );
159 return TRUE;
160}
161
diff --git a/core/apps/embeddedkonsole/playlistselection.h b/core/apps/embeddedkonsole/playlistselection.h
new file mode 100644
index 0000000..c307f14
--- a/dev/null
+++ b/core/apps/embeddedkonsole/playlistselection.h
@@ -0,0 +1,74 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef PLAY_LIST_SELECTION_H
21#define PLAY_LIST_SELECTION_H
22
23
24#include <qlist.h>
25#include <qlistview.h>
26#include <qpe/applnk.h>
27
28class PlayListSelectionItem : public QListViewItem {
29public:
30 PlayListSelectionItem( QListView *parent, QString *f ) : QListViewItem( parent ), fl( f ) {
31 setText(0, *f );
32 }
33
34 ~PlayListSelectionItem() {
35 };
36
37 const QString *file() const { return fl; }
38
39private:
40 const QString *fl;
41};
42
43class PlayListSelection : public QListView {
44 Q_OBJECT
45public:
46 PlayListSelection( QWidget *parent, const char *name=0 );
47 ~PlayListSelection();
48
49 const QString *current(); // retrieve the current playlist entry (media file link)
50
51public slots:
52 void addToSelection( QListViewItem * ); // Add a media file to the playlist
53 void addStringToSelection ( const QString &);
54 void removeSelected(); // Remove a media file from the playlist
55 void moveSelectedUp(); // Move the media file up the playlist so it is played earlier
56 void moveSelectedDown(); // Move the media file down the playlist so it is played later
57 bool prev();
58 bool next();
59 bool first();
60 bool last();
61
62protected:
63 virtual void contentsMouseMoveEvent(QMouseEvent *);
64
65
66private:
67 QStringList selectedList;
68 QString *cmd;
69};
70
71
72#endif // PLAY_LIST_SELECTION_H
73
74
diff --git a/core/apps/embeddedkonsole/smallcommandeditdialogbase.ui b/core/apps/embeddedkonsole/smallcommandeditdialogbase.ui
new file mode 100644
index 0000000..2625a57
--- a/dev/null
+++ b/core/apps/embeddedkonsole/smallcommandeditdialogbase.ui
@@ -0,0 +1,62 @@
1<!DOCTYPE UI><UI>
2<class>editCommandBase</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>editCommandBase</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>222</width>
15 <height>94</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Add command</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <widget>
26 <class>QLabel</class>
27 <property stdset="1">
28 <name>name</name>
29 <cstring>TextLabel</cstring>
30 </property>
31 <property stdset="1">
32 <name>geometry</name>
33 <rect>
34 <x>10</x>
35 <y>10</y>
36 <width>151</width>
37 <height>20</height>
38 </rect>
39 </property>
40 <property stdset="1">
41 <name>text</name>
42 <string>Enter command to add:</string>
43 </property>
44 </widget>
45 <widget>
46 <class>QLineEdit</class>
47 <property stdset="1">
48 <name>name</name>
49 <cstring>commandEdit</cstring>
50 </property>
51 <property stdset="1">
52 <name>geometry</name>
53 <rect>
54 <x>10</x>
55 <y>40</y>
56 <width>201</width>
57 <height>22</height>
58 </rect>
59 </property>
60 </widget>
61</widget>
62</UI>