summaryrefslogtreecommitdiff
Side-by-side diff
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 @@
+//comandeditdialog.cpp
+
+#include "commandeditdialog.h"
+#include "playlistselection.h"
+#include <qstring.h>
+#include <qpe/config.h>
+#include <qpe/qpetoolbar.h>
+#include <qwidget.h>
+#include <qpe/qpemenubar.h>
+#include <qpe/resource.h>
+#include <qlist.h>
+#include <qtoolbutton.h>
+#include <qvbox.h>
+#include <qlistview.h>
+#include <qlineedit.h>
+#include <qheader.h>
+#include <qlabel.h>
+#include <qmessagebox.h>
+#include "smallcommandeditdialogbase.h"
+
+CommandEditDialog::CommandEditDialog(QWidget *parent, const char* name, WFlags fl )
+ : CommandEditDialogBase(parent, name, TRUE, fl)
+
+{
+ m_SuggestedCommandList->addColumn( tr("Command Selection") );
+ m_SuggestedCommandList->header()->hide();
+ m_SuggestedCommandList->setSorting(-1,FALSE);
+ m_SuggestedCommandList->clearSelection();
+ m_SuggestedCommandList->setSorting(0,TRUE);
+
+ QListViewItem *item;
+
+
+ item = new QListViewItem( m_SuggestedCommandList,"ls ");
+
+ item = new QListViewItem( m_SuggestedCommandList,"cat ");
+ item = new QListViewItem( m_SuggestedCommandList,"cd ");
+ item = new QListViewItem( m_SuggestedCommandList,"chmod ");
+ item = new QListViewItem( m_SuggestedCommandList,"cp ");
+ item = new QListViewItem( m_SuggestedCommandList,"dc ");
+ item = new QListViewItem( m_SuggestedCommandList,"df ");
+ item = new QListViewItem( m_SuggestedCommandList,"dmesg ");
+ item = new QListViewItem( m_SuggestedCommandList,"echo ");
+ item = new QListViewItem( m_SuggestedCommandList,"export ");
+ item = new QListViewItem( m_SuggestedCommandList,"env ");
+ item = new QListViewItem( m_SuggestedCommandList,"find ");
+ item = new QListViewItem( m_SuggestedCommandList,"free ");
+ item = new QListViewItem( m_SuggestedCommandList,"ifconfig ");
+ item = new QListViewItem( m_SuggestedCommandList,"ipkg ");
+ item = new QListViewItem( m_SuggestedCommandList,"mkdir ");
+ item = new QListViewItem( m_SuggestedCommandList,"mv ");
+ item = new QListViewItem( m_SuggestedCommandList,"nc localhost 7776 ");
+ item = new QListViewItem( m_SuggestedCommandList,"nc localhost 7777 ");
+ item = new QListViewItem( m_SuggestedCommandList,"nslookup ");
+ item = new QListViewItem( m_SuggestedCommandList,"ping ");
+ item = new QListViewItem( m_SuggestedCommandList,"ps aux");
+ item = new QListViewItem( m_SuggestedCommandList,"pwd ");
+ item = new QListViewItem( m_SuggestedCommandList,"rm ");
+ item = new QListViewItem( m_SuggestedCommandList,"rmdir ");
+ item = new QListViewItem( m_SuggestedCommandList,"route ");
+ item = new QListViewItem( m_SuggestedCommandList,"gzip ");
+ item = new QListViewItem( m_SuggestedCommandList,"gunzip ");
+ item = new QListViewItem( m_SuggestedCommandList,"chgrp ");
+ item = new QListViewItem( m_SuggestedCommandList,"chown ");
+ item = new QListViewItem( m_SuggestedCommandList,"date ");
+ item = new QListViewItem( m_SuggestedCommandList,"dd ");
+ item = new QListViewItem( m_SuggestedCommandList,"df ");
+ item = new QListViewItem( m_SuggestedCommandList,"dmesg ");
+ item = new QListViewItem( m_SuggestedCommandList,"fuser ");
+ item = new QListViewItem( m_SuggestedCommandList,"hostname ");
+ item = new QListViewItem( m_SuggestedCommandList,"kill ");
+ item = new QListViewItem( m_SuggestedCommandList,"killall ");
+ item = new QListViewItem( m_SuggestedCommandList,"ln ");
+ item = new QListViewItem( m_SuggestedCommandList,"ln -s ");
+ item = new QListViewItem( m_SuggestedCommandList,"mount ");
+ item = new QListViewItem( m_SuggestedCommandList,"more ");
+ item = new QListViewItem( m_SuggestedCommandList,"sort ");
+ item = new QListViewItem( m_SuggestedCommandList,"touch ");
+ item = new QListViewItem( m_SuggestedCommandList,"umount ");
+ item = new QListViewItem( m_SuggestedCommandList,"mknod ");
+ item = new QListViewItem( m_SuggestedCommandList,"netstat ");
+ item = new QListViewItem( m_SuggestedCommandList,"cardctl eject ");
+ m_SuggestedCommandList->setSelected(m_SuggestedCommandList->firstChild(),TRUE);
+ m_SuggestedCommandList->sort();
+
+ connect( m_SuggestedCommandList, SIGNAL( clicked( QListViewItem * ) ), m_PlayListSelection, SLOT( addToSelection( QListViewItem *) ) );
+
+
+
+ ToolButton1->setTextLabel("new");
+ ToolButton1->setPixmap(Resource::loadPixmap("new"));
+ ToolButton1->setAutoRaise(TRUE);
+ ToolButton1->setFocusPolicy(QWidget::NoFocus);
+ connect(ToolButton1,SIGNAL(clicked()),this,SLOT(showAddDialog()));
+
+ ToolButton2->setTextLabel("edit");
+ ToolButton2->setPixmap(Resource::loadPixmap("edit"));
+ ToolButton2->setAutoRaise(TRUE);
+ ToolButton2->setFocusPolicy(QWidget::NoFocus);
+ connect(ToolButton2,SIGNAL(clicked()),this,SLOT(showEditDialog()));
+
+ ToolButton3->setTextLabel("delete");
+ ToolButton3->setPixmap(Resource::loadPixmap("editdelete"));
+ ToolButton3->setAutoRaise(TRUE);
+ ToolButton3->setFocusPolicy(QWidget::NoFocus);
+ connect(ToolButton3,SIGNAL(clicked()),m_PlayListSelection,SLOT(removeSelected()));
+
+ ToolButton4->setTextLabel("up");
+ ToolButton4->setPixmap(Resource::loadPixmap("up"));
+ ToolButton4->setAutoRaise(TRUE);
+ ToolButton4->setFocusPolicy(QWidget::NoFocus);
+ connect(ToolButton4,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedUp()));
+
+ ToolButton5->setTextLabel("down");
+ ToolButton5->setPixmap(Resource::loadPixmap("down"));
+ ToolButton5->setAutoRaise(TRUE);
+ ToolButton5->setFocusPolicy(QWidget::NoFocus);
+
+connect(ToolButton5,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedDown()));
+
+
+
+
+ QListViewItem *current = m_SuggestedCommandList->selectedItem();
+ if ( current )
+ item->moveItem( current );
+ m_SuggestedCommandList->setSelected( item, TRUE );
+ m_SuggestedCommandList->ensureItemVisible( m_SuggestedCommandList->selectedItem() );
+ Config cfg("Konsole");
+ cfg.setGroup("Commands");
+ if (cfg.readEntry("Commands Set","FALSE") == "TRUE") {
+ for (int i = 0; i < 100; i++) {
+ QString tmp;
+ tmp = cfg.readEntry( QString::number(i),"");
+ if (!tmp.isEmpty())
+ m_PlayListSelection->addStringToSelection(tmp);
+ }
+ } else {
+
+m_PlayListSelection->addStringToSelection("ls ");
+m_PlayListSelection->addStringToSelection("cardctl eject");
+m_PlayListSelection->addStringToSelection("cat ");
+m_PlayListSelection->addStringToSelection("cd ");
+m_PlayListSelection->addStringToSelection("chmod ");
+m_PlayListSelection->addStringToSelection("cp ");
+m_PlayListSelection->addStringToSelection("dc ");
+m_PlayListSelection->addStringToSelection("df ");
+m_PlayListSelection->addStringToSelection("dmesg");
+m_PlayListSelection->addStringToSelection("echo ");
+m_PlayListSelection->addStringToSelection("env");
+m_PlayListSelection->addStringToSelection("find ");
+m_PlayListSelection->addStringToSelection("free");
+m_PlayListSelection->addStringToSelection("grep ");
+m_PlayListSelection->addStringToSelection("ifconfig ");
+m_PlayListSelection->addStringToSelection("ipkg ");
+m_PlayListSelection->addStringToSelection("mkdir ");
+m_PlayListSelection->addStringToSelection("mv ");
+m_PlayListSelection->addStringToSelection("nc localhost 7776");
+m_PlayListSelection->addStringToSelection("nc localhost 7777");
+m_PlayListSelection->addStringToSelection("nslookup ");
+m_PlayListSelection->addStringToSelection("ping ");
+m_PlayListSelection->addStringToSelection("ps aux");
+m_PlayListSelection->addStringToSelection("pwd ");
+m_PlayListSelection->addStringToSelection("rm ");
+m_PlayListSelection->addStringToSelection("rmdir ");
+m_PlayListSelection->addStringToSelection("route ");
+m_PlayListSelection->addStringToSelection("set ");
+m_PlayListSelection->addStringToSelection("traceroute");
+
+}
+}
+CommandEditDialog::~CommandEditDialog()
+{
+}
+
+void CommandEditDialog::accept()
+{
+int i = 0;
+ Config *cfg = new Config("Konsole");
+ cfg->setGroup("Commands");
+ cfg->clearGroup();
+
+ QListViewItemIterator it( m_PlayListSelection );
+
+ for ( ; it.current(); ++it ) {
+// qDebug(it.current()->text(0));
+ cfg->writeEntry(QString::number(i),it.current()->text(0));
+ i++;
+
+ }
+ cfg->writeEntry("Commands Set","TRUE");
+// qDebug("CommandEditDialog::accept() - written");
+ delete cfg;
+ emit commandsEdited();
+ close();
+
+
+
+
+
+}
+
+void CommandEditDialog::showEditDialog()
+{
+editCommandBase *d = new editCommandBase(this,"smalleditdialog", TRUE);
+d->setCaption("Edit command");
+d->TextLabel->setText("Edit command:");
+d->commandEdit->setText(m_PlayListSelection->currentItem()->text(0));
+int i = d->exec();
+if ((i==1) && (!(d->commandEdit->text()).isEmpty()))
+ m_PlayListSelection->currentItem()->setText(0,(d->commandEdit->text()));
+}
+
+void CommandEditDialog::showAddDialog()
+{
+
+editCommandBase *d = new editCommandBase(this,"smalleditdialog", TRUE);
+int i = d->exec();
+if ((i==1) && (!(d->commandEdit->text()).isEmpty()))
+m_PlayListSelection->addStringToSelection(d->commandEdit->text());
+
+}
+
+
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 @@
+//comandeditdialog.h
+#ifndef COMMAND_EDIT_DIALOG_H
+#define COMMAND_EDIT_DIALOG_H
+#include "commandeditdialogbase.h"
+class CommandEditDialog : public CommandEditDialogBase
+{
+Q_OBJECT
+
+public:
+
+ CommandEditDialog( QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ ~CommandEditDialog();
+
+protected:
+ void accept();
+
+public slots:
+ void showEditDialog();
+ void showAddDialog();
+
+signals:
+ void commandsEdited();
+};
+
+#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 @@
+<!DOCTYPE UI><UI>
+<class>CommandEditDialogBase</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>CommandEditDialogBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>196</width>
+ <height>414</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Commands</string>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&lt;B&gt;Commands&lt;/B&gt;:</string>
+ </property>
+ </widget>
+ <widget row="1" column="2" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout2</cstring>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ToolButton1</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ToolButton2</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ToolButton3</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ToolButton4</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ToolButton5</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ </sizepolicy>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer row="0" column="2" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer3</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Fixed</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>21</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget row="2" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&lt;B&gt;Suggested Commands&lt;/B&gt;:</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" rowspan="1" colspan="2" >
+ <class>PlayListSelection</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_PlayListSelection</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ </sizepolicy>
+ </property>
+ </widget>
+ <spacer row="2" column="1" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer17</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Fixed</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="2" column="2" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Fixed</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget row="3" column="0" rowspan="1" colspan="2" >
+ <class>QListView</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_SuggestedCommandList</cstring>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>PlayListSelection</class>
+ <header location="local">playlistselection.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ <slot access="public">prev()</slot>
+ <slot access="public">next()</slot>
+ <slot access="public">first()</slot>
+ <slot access="public">last()</slot>
+ <slot access="public">moveSelectedDown()</slot>
+ <slot access="public">moveSelectedUp()</slot>
+ </customwidget>
+ <customwidget>
+ <class>QToolButton</class>
+ <header location="global">qtoolbutton.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>QListView</class>
+ <header location="global">qlistview.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image>
+ <name>image0</name>
+ <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
+ </image>
+</images>
+</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 @@
+/****************************************************************************
+** Form implementation generated from reading ui file 'commandeditwidget.ui'
+**
+** Created: Sat Feb 2 11:08:25 2002
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#include "commandeditwidget.h"
+
+#include <qpushbutton.h>
+#include "playlistselection.h"
+#include <qlayout.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+/*
+ * Constructs a Form1 which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ */
+Form1::Form1( QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl )
+{
+ if ( !name )
+ setName( "Form1" );
+ resize( 596, 480 );
+ setCaption( tr( "Form1" ) );
+ Form1Layout = new QGridLayout( this );
+ Form1Layout->setSpacing( 6 );
+ Form1Layout->setMargin( 11 );
+
+ MyCustomWidget1 = new PlayListSelection( this, "MyCustomWidget1" );
+
+ Form1Layout->addWidget( MyCustomWidget1, 0, 0 );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+Form1::~Form1()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
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 @@
+/****************************************************************************
+** Form interface generated from reading ui file 'commandeditwidget.ui'
+**
+** Created: Sat Feb 2 11:08:25 2002
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#ifndef FORM1_H
+#define FORM1_H
+
+#include <qvariant.h>
+#include <qwidget.h>
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class PlayListSelection;
+
+class Form1 : public QWidget
+{
+ Q_OBJECT
+
+public:
+ Form1( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~Form1();
+
+ PlayListSelection* MyCustomWidget1;
+
+protected:
+ QGridLayout* Form1Layout;
+};
+
+#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 @@
-TEMPLATE = app
-
-CONFIG += qt warn_on release
-
-DESTDIR = $(OPIEDIR)/bin
-
-HEADERS = TEWidget.h \
- TEScreen.h \
- TECommon.h \
- TEHistory.h \
- TEmulation.h \
- TEmuVt102.h \
- session.h \
- keytrans.h \
- konsole.h \
- MyPty.h
-
-SOURCES = TEScreen.cpp \
- TEWidget.cpp \
- TEHistory.cpp \
- TEmulation.cpp \
- TEmuVt102.cpp \
- session.cpp \
- keytrans.cpp \
- konsole.cpp \
- main.cpp \
- MyPty.cpp
-
-TARGET = embeddedkonsole
-
+TEMPLATE = app
+CONFIG += qt warn_on release
+DESTDIR = $(OPIEDIR)/bin
+HEADERS = TEWidget.h \
+ TEScreen.h \
+ TECommon.h \
+ TEHistory.h \
+ TEmulation.h \
+ TEmuVt102.h \
+ session.h \
+ keytrans.h \
+ konsole.h \
+ commandeditdialog.h \
+ commandeditwidget.h \
+ playlistselection.h \
+ MyPty.h
+SOURCES = TEScreen.cpp \
+ TEWidget.cpp \
+ TEHistory.cpp \
+ TEmulation.cpp \
+ TEmuVt102.cpp \
+ session.cpp \
+ keytrans.cpp \
+ konsole.cpp \
+ commandeditdialog.cpp \
+ commandeditwidget.cpp \
+ playlistselection.cpp \
+ MyPty.cpp \
+ main.cpp
+INTERFACES = commandeditdialogbase.ui smallcommandeditdialogbase.ui
+TARGET = embeddedkonsole
INCLUDEPATH += $(OPIEDIR)/include
-
-DEPENDPATH += $(OPIEDIR)/include
-
+DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe
-
-REQUIRES = embeddedkonsole
+REQUIRES = embeddedkonsole
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
@@ -42,24 +42,25 @@
#include <qtabbar.h>
#include <qpe/config.h>
#include <qstringlist.h>
#include <qpalette.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "konsole.h"
#include "keytrans.h"
+#include "commandeditdialog.h"
class EKNumTabBar : public QTabBar {
public:
void numberTabs()
{
// Yes, it really is this messy. QTabWidget needs functions
// that provide acces to tabs in a sequential way.
int m=INT_MIN;
for (int i=0; i<count(); i++) {
QTab* left=0;
QListIterator<QTab> it(*tabList());
int x=INT_MAX;
@@ -166,24 +167,44 @@ Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) :
QMainWindow(parent, name, fl)
{
QStrList args;
init("/bin/sh",args);
}
Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int)
: QMainWindow(0, name)
{
init(_pgm,_args);
}
+void Konsole::initCommandList()
+{
+// qDebug("Konsole::initCommandList");
+ Config cfg("Konsole");
+ cfg.setGroup("Commands");
+ commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
+ commonCombo->clear();
+ if (cfg.readEntry("Commands Set","FALSE") == "FALSE") {
+ for (int i = 0; commonCmds[i] != NULL; i++) {
+ commonCombo->insertItem(commonCmds[i],i);
+ }
+ } else {
+ for (int i = 0; i < 100; i++) {
+ if (!(cfg.readEntry( QString::number(i),"")).isEmpty())
+ commonCombo->insertItem((cfg.readEntry( QString::number(i),"")));
+ }
+ }
+
+}
+
void Konsole::init(const char* _pgm, QStrList & _args)
{
b_scroll = TRUE; // histon;
n_keytab = 0;
n_render = 0;
setCaption( tr("Terminal") );
setIcon( Resource::loadPixmap( "konsole" ) );
Config cfg("Konsole");
cfg.setGroup("Konsole");
QString tmp;
@@ -216,32 +237,35 @@ void Konsole::init(const char* _pgm, QStrList & _args)
QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar );
fontList = new QPopupMenu( this );
for(uint i = 0; i < fonts.count(); i++) {
VTFont *fnt = fonts.at(i);
fontList->insertItem(fnt->getName(), i);
}
fontChanged(cfont);
configMenu = new QPopupMenu( this);
colorMenu = new QPopupMenu( this);
scrollMenu = new QPopupMenu( this);
+ editCommandListMenu = new QPopupMenu( this);
+
+ configMenu->insertItem("Command List",editCommandListMenu);
bool listHidden;
cfg.setGroup("Menubar");
if( cfg.readEntry("Hidden","FALSE") == "TRUE") {
- configMenu->insertItem("Show command list");
+ editCommandListMenu->insertItem("Show command list");
listHidden=TRUE;
} else {
- configMenu->insertItem("Hide command list");
+ editCommandListMenu->insertItem("Hide command list");
listHidden=FALSE;
}
cfg.setGroup("Tabs");
tmp=cfg.readEntry("Position","Bottom");
if(tmp=="Top") {
tab->setTabPosition(QTabWidget::Top);
configMenu->insertItem("Tabs on Bottom");
} else {
tab->setTabPosition(QTabWidget::Bottom);
configMenu->insertItem("Tabs on Top");
}
@@ -257,25 +281,25 @@ void Konsole::init(const char* _pgm, QStrList & _args)
colorMenu->insertItem("Blue on Magenta");
colorMenu->insertItem("Magenta on Blue");
colorMenu->insertItem("Cyan on White");
colorMenu->insertItem("White on Cyan");
colorMenu->insertItem("Blue on Black");
colorMenu->insertItem("Amber on Black");
configMenu->insertItem("Colors",colorMenu);
connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) ));
connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) ));
connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) ));
connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int)));
-
+ connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int)));
menuBar->insertItem( tr("Font"), fontList );
menuBar->insertItem( tr("Options"), configMenu );
QPEToolBar *toolbar = new QPEToolBar( this );
QAction *a;
// Button Commands
a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar );
a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar );
@@ -292,39 +316,42 @@ void Konsole::init(const char* _pgm, QStrList & _args)
/*
a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
*/
secondToolBar = new QPEToolBar( this );
secondToolBar->setHorizontalStretchable( TRUE );
commonCombo = new QComboBox( secondToolBar );
commonCombo->setMaximumWidth(236);
- configMenu->insertItem( "Edit Command List");
+
+ editCommandListMenu->insertItem( "Quick Edit");
if( listHidden) {
secondToolBar->hide();
- configMenu->setItemEnabled(-20 ,FALSE);
+ editCommandListMenu->setItemEnabled(-22 ,FALSE);
}
+ editCommandListMenu->insertItem( "Edit");
cfg.setGroup("Commands");
commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
-
- for (int i = 0; commonCmds[i] != NULL; i++) {
- commonCombo->insertItem( commonCmds[i], i );
- tmp = cfg.readEntry( QString::number(i),"");
- if(tmp != "")
- commonCombo->changeItem( tmp,i );
- }
+
+ initCommandList();
+// for (int i = 0; commonCmds[i] != NULL; i++) {
+// commonCombo->insertItem( commonCmds[i], i );
+// tmp = cfg.readEntry( QString::number(i),"");
+// if(tmp != "")
+// commonCombo->changeItem( tmp,i );
+// }
connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) ));
scrollMenu->insertItem("None");
scrollMenu->insertItem("Left");
scrollMenu->insertItem("Right");
configMenu->insertItem("ScrollBar",scrollMenu);
// create applications /////////////////////////////////////////////////////
setCentralWidget(tab);
// load keymaps ////////////////////////////////////////////////////////////
@@ -577,224 +604,279 @@ void Konsole::switchSession(QWidget* w) {
VTFont *fnt = fonts.at(i);
bool cf = fnt->getFont() == teFnt;
fontList->setItemChecked(i, cf);
if (cf) {
cfont = i;
}
}
}
/// ------------------------------- some new stuff by L.J. Potter
void Konsole::colorMenuSelected(int iD)
{ // this is NOT pretty, elegant or anything else besides functional
-// QString temp;
-// qDebug( temp.sprintf("%d", iD));
+// QString temp;
+// qDebug( temp.sprintf("colormenu %d", iD));
TEWidget* te = getTe();
Config cfg("Konsole");
cfg.setGroup("Colors");
QColor foreground;
QColor background;
colorMenu->setItemChecked(lastSelectedMenu,FALSE);
ColorEntry m_table[TABLE_COLORS];
const ColorEntry * defaultCt=te->getdefaultColorTable();
/////////// fore back
int i;
- if(iD==-8) { // default default
+ if(iD==-9) { // default default
for (i = 0; i < TABLE_COLORS; i++) {
m_table[i].color = defaultCt[i].color;
if(i==1 || i == 11)
m_table[i].transparent=1;
- cfg.writeEntry("Schema","8");
- colorMenu->setItemChecked(-8,TRUE);
+ cfg.writeEntry("Schema","98");
+ colorMenu->setItemChecked(-9,TRUE);
}
} else {
- if(iD==-5) { // green black
+ if(iD==-6) { // green black
foreground.setRgb(0x18,255,0x18);
background.setRgb(0x00,0x00,0x00);
- cfg.writeEntry("Schema","5");
- colorMenu->setItemChecked(-5,TRUE);
+ cfg.writeEntry("Schema","6");
+ colorMenu->setItemChecked(-6,TRUE);
}
- if(iD==-6) { // black white
+ if(iD==-7) { // black white
foreground.setRgb(0x00,0x00,0x00);
background.setRgb(0xFF,0xFF,0xFF);
- cfg.writeEntry("Schema","6");
- colorMenu->setItemChecked(-6,TRUE);
+ cfg.writeEntry("Schema","7");
+ colorMenu->setItemChecked(-7,TRUE);
}
- if(iD==-7) { // white black
+ if(iD==-8) { // white black
foreground.setRgb(0xFF,0xFF,0xFF);
background.setRgb(0x00,0x00,0x00);
- cfg.writeEntry("Schema","7");
- colorMenu->setItemChecked(-7,TRUE);
+ cfg.writeEntry("Schema","8");
+ colorMenu->setItemChecked(-8,TRUE);
}
- if(iD==-9) {// Black, Red
+ if(iD==-10) {// Black, Red
foreground.setRgb(0x00,0x00,0x00);
background.setRgb(0xB2,0x18,0x18);
- cfg.writeEntry("Schema","9");
- colorMenu->setItemChecked(-9,TRUE);
+ cfg.writeEntry("Schema","10");
+ colorMenu->setItemChecked(-10,TRUE);
}
- if(iD==-10) {// Red, Black
+ if(iD==-11) {// Red, Black
foreground.setRgb(230,31,31); //0xB2,0x18,0x18
background.setRgb(0x00,0x00,0x00);
- cfg.writeEntry("Schema","10");
- colorMenu->setItemChecked(-10,TRUE);
+ cfg.writeEntry("Schema","11");
+ colorMenu->setItemChecked(-11,TRUE);
}
- if(iD==-11) {// Green, Yellow - is ugly
+ if(iD==-12) {// Green, Yellow - is ugly
// foreground.setRgb(0x18,0xB2,0x18);
foreground.setRgb(36,139,10);
// background.setRgb(0xB2,0x68,0x18);
background.setRgb(255,255,0);
- cfg.writeEntry("Schema","11");
- colorMenu->setItemChecked(-11,TRUE);
- }
- if(iD==-12) {// Blue, Magenta
- foreground.setRgb(0x18,0xB2,0xB2);
- background.setRgb(0x18,0x18,0xB2);
cfg.writeEntry("Schema","12");
colorMenu->setItemChecked(-12,TRUE);
}
- if(iD==-13) {// Magenta, Blue
- foreground.setRgb(0x18,0x18,0xB2);
- background.setRgb(0x18,0xB2,0xB2);
+ if(iD==-13) {// Blue, Magenta
+ foreground.setRgb(0x18,0xB2,0xB2);
+ background.setRgb(0x18,0x18,0xB2);
cfg.writeEntry("Schema","13");
colorMenu->setItemChecked(-13,TRUE);
}
- if(iD==-14) {// Cyan, White
- foreground.setRgb(0x18,0xB2,0xB2);
- background.setRgb(0xFF,0xFF,0xFF);
+ if(iD==-14) {// Magenta, Blue
+ foreground.setRgb(0x18,0x18,0xB2);
+ background.setRgb(0x18,0xB2,0xB2);
cfg.writeEntry("Schema","14");
colorMenu->setItemChecked(-14,TRUE);
}
- if(iD==-15) {// White, Cyan
- background.setRgb(0x18,0xB2,0xB2);
- foreground.setRgb(0xFF,0xFF,0xFF);
+ if(iD==-15) {// Cyan, White
+ foreground.setRgb(0x18,0xB2,0xB2);
+ background.setRgb(0xFF,0xFF,0xFF);
cfg.writeEntry("Schema","15");
colorMenu->setItemChecked(-15,TRUE);
}
- if(iD==-16) {// Black, Blue
- background.setRgb(0x00,0x00,0x00);
- foreground.setRgb(0x18,0xB2,0xB2);
+ if(iD==-16) {// White, Cyan
+ background.setRgb(0x18,0xB2,0xB2);
+ foreground.setRgb(0xFF,0xFF,0xFF);
cfg.writeEntry("Schema","16");
colorMenu->setItemChecked(-16,TRUE);
}
- if(iD==-17) {// Black, Gold
+ if(iD==-17) {// Black, Blue
background.setRgb(0x00,0x00,0x00);
- foreground.setRgb(255,215,0);
+ foreground.setRgb(0x18,0xB2,0xB2);
cfg.writeEntry("Schema","17");
colorMenu->setItemChecked(-17,TRUE);
}
+ if(iD==-18) {// Black, Gold
+ background.setRgb(0x00,0x00,0x00);
+ foreground.setRgb(255,215,0);
+ cfg.writeEntry("Schema","18");
+ colorMenu->setItemChecked(-18,TRUE);
+ }
for (i = 0; i < TABLE_COLORS; i++) {
if(i==0 || i == 10) {
m_table[i].color = foreground;
}
else if(i==1 || i == 11) {
m_table[i].color = background; m_table[i].transparent=0;
}
else
m_table[i].color = defaultCt[i].color;
}
}
lastSelectedMenu = iD;
te->setColorTable(m_table);
update();
}
void Konsole::configMenuSelected(int iD)
{
- QString temp;
- qDebug( temp.sprintf("%d",iD));
+ QString temp;
+ qDebug( temp.sprintf("configmenu %d",iD));
TEWidget* te = getTe();
Config cfg("Konsole");
cfg.setGroup("Menubar");
- if( iD == -2) {
- if(!secondToolBar->isHidden()) {
- secondToolBar->hide();
- configMenu->changeItem( iD,"Show Command List");
- cfg.writeEntry("Hidden","TRUE");
- configMenu->setItemEnabled(-20 ,FALSE);
- } else {
- secondToolBar->show();
- configMenu->changeItem( iD,"Hide Command List");
- cfg.writeEntry("Hidden","FALSE");
- configMenu->setItemEnabled(-20 ,TRUE);
-
- if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") {
- configMenu->setItemChecked(-20,TRUE);
- commonCombo->setEditable( TRUE );
- } else {
- configMenu->setItemChecked(-20,FALSE);
- commonCombo->setEditable( FALSE );
- }
- }
- }
- if( iD == -3) {
+// if( iD == -2) {
+// if(!secondToolBar->isHidden()) {
+// secondToolBar->hide();
+// configMenu->changeItem( iD,"Show Command List");
+// cfg.writeEntry("Hidden","TRUE");
+// configMenu->setItemEnabled(-20 ,FALSE);
+// } else {
+// secondToolBar->show();
+// configMenu->changeItem( iD,"Hide Command List");
+// cfg.writeEntry("Hidden","FALSE");
+// configMenu->setItemEnabled(-20 ,TRUE);
+
+// if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") {
+// configMenu->setItemChecked(-20,TRUE);
+// commonCombo->setEditable( TRUE );
+// } else {
+// configMenu->setItemChecked(-20,FALSE);
+// commonCombo->setEditable( FALSE );
+// }
+// }
+// }
+ if( iD == -4) {
cfg.setGroup("Tabs");
QString tmp=cfg.readEntry("Position","Top");
if(tmp=="Top") {
tab->setTabPosition(QTabWidget::Bottom);
configMenu->changeItem( iD,"Tabs on Top");
cfg.writeEntry("Position","Bottom");
} else {
tab->setTabPosition(QTabWidget::Top);
configMenu->changeItem( iD,"Tabs on Bottom");
cfg.writeEntry("Position","Top");
}
}
- if( iD == -20) {
- cfg.setGroup("Commands");
-// qDebug("enableCommandEdit");
- if( !configMenu->isItemChecked(iD) ) {
- commonCombo->setEditable( TRUE );
- configMenu->setItemChecked(iD,TRUE);
- commonCombo->setCurrentItem(0);
- cfg.writeEntry("EditEnabled","TRUE");
- } else {
- commonCombo->setEditable( FALSE );
- configMenu->setItemChecked(iD,FALSE);
- cfg.writeEntry("EditEnabled","FALSE");
- commonCombo->setFocusPolicy(QWidget::NoFocus);
- te->setFocus();
- }
- }
+// if( iD == -20) {
+// cfg.setGroup("Commands");
+// // qDebug("enableCommandEdit");
+// if( !configMenu->isItemChecked(iD) ) {
+// commonCombo->setEditable( TRUE );
+// configMenu->setItemChecked(iD,TRUE);
+// commonCombo->setCurrentItem(0);
+// cfg.writeEntry("EditEnabled","TRUE");
+// } else {
+// commonCombo->setEditable( FALSE );
+// configMenu->setItemChecked(iD,FALSE);
+// cfg.writeEntry("EditEnabled","FALSE");
+// commonCombo->setFocusPolicy(QWidget::NoFocus);
+// te->setFocus();
+// }
+// }
}
void Konsole::changeCommand(const QString &text, int c)
{
Config cfg("Konsole");
cfg.setGroup("Commands");
if(commonCmds[c] != text) {
cfg.writeEntry(QString::number(c),text);
commonCombo->clearEdit();
commonCombo->setCurrentItem(c);
}
}
void Konsole::setColor()
{
Config cfg("Konsole");
cfg.setGroup("Colors");
int scheme = cfg.readNumEntry("Schema",1);
if(scheme != 1) colorMenuSelected( -scheme);
}
void Konsole::scrollMenuSelected(int index)
{
+// QString temp;
+// qDebug( temp.sprintf("scrollbar menu %d",index));
TEWidget* te = getTe();
Config cfg("Konsole");
cfg.setGroup("Scrollbar");
switch( index){
- case -21:
+ case -24:
te->setScrollbarLocation(0);
cfg.writeEntry("Position",0);
break;
- case -22:
+ case -25:
te->setScrollbarLocation(1);
cfg.writeEntry("Position",1);
break;
- case -23:
+ case -26:
te->setScrollbarLocation(2);
cfg.writeEntry("Position",2);
break;
};
}
+
+void Konsole::editCommandListMenuSelected(int iD)
+{
+// QString temp;
+// qDebug( temp.sprintf("edit command list %d",iD));
+ TEWidget* te = getTe();
+ Config cfg("Konsole");
+ cfg.setGroup("Menubar");
+ if( iD == -3) {
+ if(!secondToolBar->isHidden()) {
+ secondToolBar->hide();
+ configMenu->changeItem( iD,"Show Command List");
+ cfg.writeEntry("Hidden","TRUE");
+ configMenu->setItemEnabled(-22 ,FALSE);
+ } else {
+ secondToolBar->show();
+ configMenu->changeItem( iD,"Hide Command List");
+ cfg.writeEntry("Hidden","FALSE");
+ configMenu->setItemEnabled(-22 ,TRUE);
+
+ if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") {
+ configMenu->setItemChecked(-22,TRUE);
+ commonCombo->setEditable( TRUE );
+ } else {
+ configMenu->setItemChecked(-22,FALSE);
+ commonCombo->setEditable( FALSE );
+ }
+ }
+ }
+ if( iD == -22) {
+ cfg.setGroup("Commands");
+// qDebug("enableCommandEdit");
+ if( !configMenu->isItemChecked(iD) ) {
+ commonCombo->setEditable( TRUE );
+ configMenu->setItemChecked(iD,TRUE);
+ commonCombo->setCurrentItem(0);
+ cfg.writeEntry("EditEnabled","TRUE");
+ } else {
+ commonCombo->setEditable( FALSE );
+ configMenu->setItemChecked(iD,FALSE);
+ cfg.writeEntry("EditEnabled","FALSE");
+ commonCombo->setFocusPolicy(QWidget::NoFocus);
+ te->setFocus();
+ }
+ }
+ if(iD == -23) {
+ // "edit commands"
+ CommandEditDialog *m = new CommandEditDialog(this);
+ connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList()));
+ m->showMaximized();
+ }
+
+}
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
@@ -61,34 +61,37 @@ private slots:
void configMenuSelected(int );
void colorMenuSelected(int);
void enterCommand(int);
void hitEnter();
void hitSpace();
void hitTab();
void hitPaste();
void hitUp();
void hitDown();
void switchSession(QWidget *);
void newSession();
void changeCommand(const QString &, int);
+ void initCommandList();
void scrollMenuSelected(int);
+ void editCommandListMenuSelected(int);
private:
void init(const char* _pgm, QStrList & _args);
void initSession(const char* _pgm, QStrList & _args);
void runSession(TESession* s);
void setColorPixmaps();
void setHistory(bool);
QSize calcSize(int columns, int lines);
TEWidget* getTe();
-
+ QStringList commands;
+
private:
class VTFont
{
public:
VTFont(QString name, QFont& font)
{
this->name = name;
this->font = font;
}
QFont& getFont()
{
@@ -103,25 +106,25 @@ private:
private:
QString name;
QFont font;
};
EKNumTabWidget* tab;
int nsessions;
QList<VTFont> fonts;
int cfont;
QCString se_pgm;
QStrList se_args;
- QPopupMenu* fontList,*configMenu,*colorMenu,*scrollMenu;
+ QPopupMenu *fontList,*configMenu,*colorMenu,*scrollMenu,*editCommandListMenu;
QComboBox *commonCombo;
// history scrolling I think
bool b_scroll;
int n_keytab;
int n_scroll;
int n_render;
QString pmPath; // pixmap path
QString dropText;
QFont defaultFont;
QSize defaultSize;
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 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#include <qpe/applnk.h>
+#include <qpe/resource.h>
+#include <qpainter.h>
+#include <qimage.h>
+#include <qheader.h>
+#include <qlistview.h>
+#include <qlist.h>
+#include <qpixmap.h>
+
+#include "playlistselection.h"
+
+#include <stdlib.h>
+
+
+
+
+
+PlayListSelection::PlayListSelection( QWidget *parent, const char *name )
+ : QListView( parent, name )
+{
+ setAllColumnsShowFocus( TRUE );
+ addColumn( tr( "Command Selection" ) );
+ header()->hide();
+ setSorting( -1, FALSE );
+}
+
+
+PlayListSelection::~PlayListSelection() {
+}
+
+
+
+void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) {
+ if ( event->state() == QMouseEvent::LeftButton ) {
+ QListViewItem *currentItem = selectedItem();
+ QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) );
+ if ( currentItem && currentItem->itemAbove() == itemUnder )
+ moveSelectedUp();
+ else if ( currentItem && currentItem->itemBelow() == itemUnder )
+ moveSelectedDown();
+ }
+}
+
+
+const QString *PlayListSelection::current() {
+ PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem();
+ if ( item )
+ return item->file();
+ return NULL;
+}
+
+
+void PlayListSelection::addToSelection( QListViewItem *lnk ) {
+PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk->text(0) ) );
+ QListViewItem *current = selectedItem();
+ if ( current )
+ item->moveItem( current );
+ setSelected( item, TRUE );
+ ensureItemVisible( selectedItem() );
+}
+
+void PlayListSelection::addStringToSelection (const QString & lnk) {
+ PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk ) );
+ QListViewItem *current = selectedItem();
+ if ( current )
+ item->moveItem( current );
+ setSelected( item, TRUE );
+ ensureItemVisible( selectedItem() );
+
+}
+void PlayListSelection::removeSelected() {
+ qDebug("removeSelected()");
+ QListViewItem *item = selectedItem();
+ if ( item )
+ delete item;
+ setSelected( currentItem(), TRUE );
+ ensureItemVisible( selectedItem() );
+}
+
+
+void PlayListSelection::moveSelectedUp() {
+ QListViewItem *item = selectedItem();
+ if ( item && item->itemAbove() )
+ item->itemAbove()->moveItem( item );
+ ensureItemVisible( selectedItem() );
+}
+
+
+void PlayListSelection::moveSelectedDown() {
+ QListViewItem *item = selectedItem();
+ if ( item && item->itemBelow() )
+ item->moveItem( item->itemBelow() );
+ ensureItemVisible( selectedItem() );
+}
+
+
+bool PlayListSelection::prev() {
+ QListViewItem *item = selectedItem();
+ if ( item && item->itemAbove() )
+ setSelected( item->itemAbove(), TRUE );
+ else
+ return FALSE;
+ ensureItemVisible( selectedItem() );
+ return TRUE;
+}
+
+
+bool PlayListSelection::next() {
+ QListViewItem *item = selectedItem();
+ if ( item && item->itemBelow() )
+ setSelected( item->itemBelow(), TRUE );
+ else
+ return FALSE;
+ ensureItemVisible( selectedItem() );
+ return TRUE;
+}
+
+
+bool PlayListSelection::first() {
+ QListViewItem *item = firstChild();
+ if ( item )
+ setSelected( item, TRUE );
+ else
+ return FALSE;
+ ensureItemVisible( selectedItem() );
+ return TRUE;
+}
+
+
+bool PlayListSelection::last() {
+ QListViewItem *prevItem = NULL;
+ QListViewItem *item = firstChild();
+ while ( ( item = item->nextSibling() ) )
+ prevItem = item;
+ if ( prevItem )
+ setSelected( prevItem, TRUE );
+ else
+ return FALSE;
+ ensureItemVisible( selectedItem() );
+ return TRUE;
+}
+
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 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef PLAY_LIST_SELECTION_H
+#define PLAY_LIST_SELECTION_H
+
+
+#include <qlist.h>
+#include <qlistview.h>
+#include <qpe/applnk.h>
+
+class PlayListSelectionItem : public QListViewItem {
+public:
+ PlayListSelectionItem( QListView *parent, QString *f ) : QListViewItem( parent ), fl( f ) {
+ setText(0, *f );
+ }
+
+ ~PlayListSelectionItem() {
+ };
+
+ const QString *file() const { return fl; }
+
+private:
+ const QString *fl;
+};
+
+class PlayListSelection : public QListView {
+ Q_OBJECT
+public:
+ PlayListSelection( QWidget *parent, const char *name=0 );
+ ~PlayListSelection();
+
+ const QString *current(); // retrieve the current playlist entry (media file link)
+
+public slots:
+ void addToSelection( QListViewItem * ); // Add a media file to the playlist
+ void addStringToSelection ( const QString &);
+ void removeSelected(); // Remove a media file from the playlist
+ void moveSelectedUp(); // Move the media file up the playlist so it is played earlier
+ void moveSelectedDown(); // Move the media file down the playlist so it is played later
+ bool prev();
+ bool next();
+ bool first();
+ bool last();
+
+protected:
+ virtual void contentsMouseMoveEvent(QMouseEvent *);
+
+
+private:
+ QStringList selectedList;
+ QString *cmd;
+};
+
+
+#endif // PLAY_LIST_SELECTION_H
+
+
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 @@
+<!DOCTYPE UI><UI>
+<class>editCommandBase</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>editCommandBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>222</width>
+ <height>94</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Add command</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>151</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Enter command to add:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>commandEdit</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>10</x>
+ <y>40</y>
+ <width>201</width>
+ <height>22</height>
+ </rect>
+ </property>
+ </widget>
+</widget>
+</UI>