summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show 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.pro20
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp268
-rw-r--r--core/apps/embeddedkonsole/konsole.h5
-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, 1108 insertions, 105 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,9 +1,6 @@
1 TEMPLATE= app 1 TEMPLATE= app
2
3 CONFIG += qt warn_on release 2 CONFIG += qt warn_on release
4
5 DESTDIR = $(OPIEDIR)/bin 3 DESTDIR = $(OPIEDIR)/bin
6
7 HEADERS = TEWidget.h \ 4 HEADERS = TEWidget.h \
8 TEScreen.h \ 5 TEScreen.h \
9 TECommon.h \ 6 TECommon.h \
@@ -13,8 +10,10 @@ HEADERS = TEWidget.h \
13 session.h \ 10 session.h \
14 keytrans.h \ 11 keytrans.h \
15 konsole.h \ 12 konsole.h \
13 commandeditdialog.h \
14 commandeditwidget.h \
15 playlistselection.h \
16 MyPty.h 16 MyPty.h
17
18 SOURCES = TEScreen.cpp \ 17 SOURCES = TEScreen.cpp \
19 TEWidget.cpp \ 18 TEWidget.cpp \
20 TEHistory.cpp \ 19 TEHistory.cpp \
@@ -23,16 +22,15 @@ SOURCES = TEScreen.cpp \
23 session.cpp \ 22 session.cpp \
24 keytrans.cpp \ 23 keytrans.cpp \
25 konsole.cpp \ 24 konsole.cpp \
26 main.cpp \ 25 commandeditdialog.cpp \
27 MyPty.cpp 26 commandeditwidget.cpp \
28 27 playlistselection.cpp \
28 MyPty.cpp \
29 main.cpp
30INTERFACES = commandeditdialogbase.ui smallcommandeditdialogbase.ui
29 TARGET = embeddedkonsole 31 TARGET = embeddedkonsole
30
31INCLUDEPATH += $(OPIEDIR)/include 32INCLUDEPATH += $(OPIEDIR)/include
32
33 DEPENDPATH+= $(OPIEDIR)/include 33 DEPENDPATH+= $(OPIEDIR)/include
34
35LIBS += -lqpe 34LIBS += -lqpe
36
37 REQUIRES= embeddedkonsole 35 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
@@ -51,6 +51,7 @@
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:
@@ -175,6 +176,26 @@ Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int)
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;
@@ -225,14 +246,17 @@ void Konsole::init(const char* _pgm, QStrList & _args)
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
@@ -266,7 +290,7 @@ void Konsole::init(const char* _pgm, QStrList & _args)
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
@@ -301,21 +325,24 @@ void Konsole::init(const char* _pgm, QStrList & _args)
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
@@ -587,7 +614,7 @@ void Konsole::switchSession(QWidget* w) {
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");
@@ -598,89 +625,89 @@ void Konsole::colorMenuSelected(int iD)
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) {
@@ -701,32 +728,32 @@ void Konsole::colorMenuSelected(int iD)
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
@@ -740,22 +767,22 @@ void Konsole::configMenuSelected(int iD)
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)
@@ -779,22 +806,77 @@ void Konsole::setColor()
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
@@ -70,7 +70,9 @@ private slots:
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);
@@ -79,6 +81,7 @@ private:
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();
84 QStringList commands;
82 85
83private: 86private:
84 class VTFont 87 class VTFont
@@ -112,7 +115,7 @@ private:
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;
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>