summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/MyPty.cpp2
-rw-r--r--noncore/apps/opie-console/TEWidget.cpp27
-rw-r--r--noncore/apps/opie-console/TEWidget.h20
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp6
-rw-r--r--noncore/apps/opie-console/emulation_handler.h4
-rw-r--r--noncore/apps/opie-console/file_layer.cpp4
-rw-r--r--noncore/apps/opie-console/io_bt.cpp7
-rw-r--r--noncore/apps/opie-console/io_irda.cpp5
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp49
-rw-r--r--noncore/apps/opie-console/mainwindow.h7
-rw-r--r--noncore/apps/opie-console/opie-console.control2
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp4
-rw-r--r--noncore/apps/opie-console/receive_layer.cpp3
-rw-r--r--noncore/apps/opie-console/session.cpp7
-rw-r--r--noncore/apps/opie-console/session.h7
15 files changed, 123 insertions, 31 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp
index 16bb5ff..984e347 100644
--- a/noncore/apps/opie-console/MyPty.cpp
+++ b/noncore/apps/opie-console/MyPty.cpp
@@ -107,13 +107,12 @@ void MyPty::setSize(int lines, int columns)
}
void MyPty::donePty()
{
// This is code from the Qt DumbTerminal example
- int status = 0;
::close(m_fd);
if (m_cpid) {
kill(m_cpid, SIGHUP);
//waitpid(m_cpid, &status, 0);
@@ -254,12 +253,13 @@ MyPty::MyPty(const Profile& prof) : m_cpid(0)
break;
}
m_sn_e = 0l;
m_sn_r = 0l;
m_fd = openPty();
ProcCtl* ctl = ProcCtl::self();
+ Q_UNUSED(ctl);
}
/*!
Destructor.
Note that the related client program is not killed
(yet) when a instance is deleted.
diff --git a/noncore/apps/opie-console/TEWidget.cpp b/noncore/apps/opie-console/TEWidget.cpp
index f3f462f..e4415dc 100644
--- a/noncore/apps/opie-console/TEWidget.cpp
+++ b/noncore/apps/opie-console/TEWidget.cpp
@@ -92,12 +92,37 @@
#define SCRWIDTH 16 // width of the scrollbar
#define yMouseScroll 1
// scroll increment used when dragging selection at top/bottom of window.
+/* Button XPM */
+namespace {
+static char * menu_xpm[] = {
+"12 12 5 1",
+" c None",
+". c #000000",
+"+ c #FFFDAD",
+"@ c #FFFF00",
+"# c #E5E100",
+" ",
+" ",
+" ......... ",
+" .+++++++. ",
+" .+@@@@#. ",
+" .+@@@#. ",
+" .+@@#. ",
+" .+@#. ",
+" .+#. ",
+" .+. ",
+" .. ",
+" "};
+
+}
+
+
/* ------------------------------------------------------------------------- */
/* */
/* Colors */
/* */
/* ------------------------------------------------------------------------- */
@@ -1238,13 +1263,13 @@ void TEWidget::dropEvent(QDropEvent* event)
// Paste it
}
}
#endif
-void TEWidget::drop_menu_activated(int item)
+void TEWidget::drop_menu_activated(int)
{
#ifndef QT_NO_DRAGANDDROP
switch (item)
{
case 0: // paste
currentSession->getEmulation()->sendString(dropText.local8Bit());
diff --git a/noncore/apps/opie-console/TEWidget.h b/noncore/apps/opie-console/TEWidget.h
index 1b5300f..f03a16e 100644
--- a/noncore/apps/opie-console/TEWidget.h
+++ b/noncore/apps/opie-console/TEWidget.h
@@ -31,31 +31,13 @@
#include "TECommon.h"
extern unsigned short vt100_graphics[32];
-static char * menu_xpm[] = {
-"12 12 5 1",
-" c None",
-". c #000000",
-"+ c #FFFDAD",
-"@ c #FFFF00",
-"# c #E5E100",
-" ",
-" ",
-" ......... ",
-" .+++++++. ",
-" .+@@@@#. ",
-" .+@@@#. ",
-" .+@@#. ",
-" .+@#. ",
-" .+#. ",
-" .+. ",
-" .. ",
-" "};
+
class TESession;
// class Konsole;
class TEWidget : public QFrame
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp
index bdc8b43..bb3dd28 100644
--- a/noncore/apps/opie-console/emulation_handler.cpp
+++ b/noncore/apps/opie-console/emulation_handler.cpp
@@ -189,6 +189,12 @@ void EmulationHandler::clearScript() {
}
void EmulationHandler::runScript(const Script *script) {
emit send(script->script());
}
+void EmulationHandler::copy() {
+ m_teWid->emitSelection();
+}
+void EmulationHandler::paste() {
+ m_teWid->pasteClipboard();
+}
diff --git a/noncore/apps/opie-console/emulation_handler.h b/noncore/apps/opie-console/emulation_handler.h
index 7ca2cf3..12abbc5 100644
--- a/noncore/apps/opie-console/emulation_handler.h
+++ b/noncore/apps/opie-console/emulation_handler.h
@@ -46,13 +46,13 @@ public:
~EmulationHandler();
void load( const Profile& );
QWidget* widget();
void setColor( const QColor& fore, const QColor& back );
QPushButton* cornerButton();
-
+
/* Scripts */
/* Create a new script and record all typed characters */
void startRecording();
/* Return whether we are currently recording a script */
bool isRecording();
@@ -70,12 +70,14 @@ signals:
void send( const QByteArray& );
void changeSize(int rows, int cols );
public slots:
void recv( const QByteArray& );
+ void paste();
+ void copy();
private slots:
void recvEmulation( const char*, int len );
private:
QFont font( int );
QColor foreColor(int );
diff --git a/noncore/apps/opie-console/file_layer.cpp b/noncore/apps/opie-console/file_layer.cpp
index 43e9c8f..0c83700 100644
--- a/noncore/apps/opie-console/file_layer.cpp
+++ b/noncore/apps/opie-console/file_layer.cpp
@@ -8,16 +8,16 @@ FileTransferLayer::FileTransferLayer(IOLayer *layer)
{
}
FileTransferLayer::~FileTransferLayer() {
}
-void FileTransferLayer::sendFile(const QFile& file) {
+void FileTransferLayer::sendFile(const QFile&) {
}
-void FileTransferLayer::sendFile(const QString& file) {
+void FileTransferLayer::sendFile(const QString&) {
}
IOLayer* FileTransferLayer::layer() {
return m_layer;
}
diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp
index 4486eea..8dd8151 100644
--- a/noncore/apps/opie-console/io_bt.cpp
+++ b/noncore/apps/opie-console/io_bt.cpp
@@ -21,12 +21,13 @@ void IOBt::close() {
delete m_attach;
m_attach = 0;
}
}
bool IOBt::open() {
+ bool ret = false;
// only set up bt stuff if mac address was set, otherwise use the device set
if ( !m_mac.isEmpty() ) {
// now it should also be checked, if there is a connection to the device with that mac allready
// hciattach here
@@ -36,24 +37,25 @@ bool IOBt::open() {
// then start hcid, then rcfomm handling (m_mac)
connect( m_attach, SIGNAL( processExited( OProcess* ) ),
this, SLOT( slotExited( OProcess* ) ) );
if ( m_attach->start() ) {
- IOSerial::open();
+ ret = IOSerial::open();
} else {
qWarning("could not attach to device");
delete m_attach;
m_attach = 0;
}
} else {
// directly to the normal serial
// TODO: look first if the connection really exists. ( is set up )
- IOSerial::open();
+ ret =IOSerial::open();
}
+ return ret;
}
void IOBt::reload( const Profile &config ) {
m_device = config.readEntry("Device", BT_DEFAULT_DEVICE);
m_mac = config.readEntry("Mac", BT_DEFAULT_MAC);
m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD);
@@ -71,7 +73,8 @@ QString IOBt::identifier() const {
QString IOBt::name() const {
return "BLuetooth IO Layer";
}
void IOBt::slotExited( OProcess* proc ){
close();
+ delete proc;
}
diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp
index 56a373c..b3b693f 100644
--- a/noncore/apps/opie-console/io_irda.cpp
+++ b/noncore/apps/opie-console/io_irda.cpp
@@ -18,28 +18,30 @@ void IOIrda::close() {
IOSerial::close();
// still need error handling
delete m_attach;
}
bool IOIrda::open() {
+ bool ret;
// irdaattach here
m_attach = new OProcess();
*m_attach << "irattach /dev/ttyS2 -s";
connect( m_attach, SIGNAL( processExited( OProcess* ) ),
this, SLOT( slotExited( OProcess* ) ) );
if ( m_attach->start() ) {
- IOSerial::open();
+ ret= IOSerial::open();
} else {
// emit error!!!
qWarning("could not attach to device");
delete m_attach;
m_attach = 0l;
}
+ return ret;
}
void IOIrda::reload( const Profile &config ) {
m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE);
m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD);
m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY);
@@ -56,7 +58,8 @@ QString IOIrda::identifier() const {
QString IOIrda::name() const {
return "Irda IO Layer";
}
void IOIrda::slotExited(OProcess* proc ){
close();
+ delete proc;
}
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index e2f4d12..02a3fa9 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -86,12 +86,22 @@ void MainWindow::initUI() {
QString::null, 0, this, 0);
a->addTo( m_console );
a->addTo( m_icons );
connect(a, SIGNAL(activated() ),
this, SLOT(slotNew() ) );
+ m_console->insertSeparator();
+ /* save icon is not available */
+ a = new QAction(tr("Save Connection"),
+ Resource::loadPixmap("save"), QString::null,
+ 0, this, 0 );
+ a->addTo( m_console );
+ connect(a, SIGNAL(activated() ),
+ this, SLOT(slotSaveSession() ) );
+ m_console->insertSeparator();
+
/*
* connect action
*/
m_connect = new QAction();
m_connect->setText( tr("Connect") );
m_connect->addTo( m_console );
@@ -173,13 +183,13 @@ void MainWindow::initUI() {
this, SLOT(slotOpenKeb(bool)));
m_openKeys->addTo(m_icons);
/*
* action that open/closes the keyboard
-
+
m_openButtons = new QAction ( tr( "Open Buttons..." ),
Resource::loadPixmap( "" ),
QString::null, 0, this, 0 );
m_openButtons->setToggleAction( true );
@@ -219,12 +229,26 @@ void MainWindow::initUI() {
/*
m_qb = new QuickButton( m_buttonBar );
connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ),
this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) );
*/
+ /* now add the copy and paste actions */
+ a = new QAction(tr("Copy"),
+ Resource::loadPixmap("copy"), QString::null,
+ 0, this, 0 );
+ //a->addTo( m_icons );
+ connect( a, SIGNAL(activated() ),
+ this, SLOT(slotCopy() ) );
+
+ a = new QAction(tr("Paste"),
+ Resource::loadPixmap("paste"), QString::null,
+ 0, this, 0 );
+ a->addTo( m_icons );
+ connect( a, SIGNAL(activated() ),
+ this, SLOT(slotPaste() ) );
m_connect->setEnabled( false );
m_disconnect->setEnabled( false );
m_terminate->setEnabled( false );
m_transfer->setEnabled( false );
@@ -536,6 +560,29 @@ void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) {
// where should i send this event? doesnt work sending it here
QApplication::sendEvent((QObject *)m_curSession->widget(), &ke);
ke.ignore();
}
}
+void MainWindow::slotCopy() {
+ if (!currentSession() ) return;
+ currentSession()->emulationHandler()->copy();
+}
+void MainWindow::slotPaste() {
+ if (!currentSession() ) return;
+ currentSession()->emulationHandler()->paste();
+}
+
+/*
+ * Save the session
+ */
+
+void MainWindow::slotSaveSession() {
+ if (!currentSession() ) {
+ QMessageBox::information(this, tr("Save Connection"),
+ tr("<qt>There is no Connection.</qt>"), 1 );
+ return;
+ }
+ manager()->add( currentSession()->profile() );
+ manager()->save();
+ populateProfiles();
+}
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h
index 0f52e76..16b6252 100644
--- a/noncore/apps/opie-console/mainwindow.h
+++ b/noncore/apps/opie-console/mainwindow.h
@@ -67,12 +67,19 @@ private slots:
void slotSaveScript();
void slotRunScript();
void slotFullscreen();
void slotSessionChanged( Session* );
void slotKeyReceived(FKey, ushort, ushort, bool);
+ /* what could these both slot do? */
+ void slotCopy();
+ void slotPaste();
+
+ /* save the currentSession() to Profiles */
+ void slotSaveSession();
+
private:
void initUI();
void populateProfiles();
void create( const Profile& );
/**
* the current session
diff --git a/noncore/apps/opie-console/opie-console.control b/noncore/apps/opie-console/opie-console.control
index d41ef58..8541d22 100644
--- a/noncore/apps/opie-console/opie-console.control
+++ b/noncore/apps/opie-console/opie-console.control
@@ -1,7 +1,7 @@
-Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* etc/keytabs/default.Keytab
+Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* etc/keytabs/default.Keytab bin/sz bin/rz
Priority: optional
Section: opie/applications
Maintainer: Opie team <opie@handhelds.org>
Architecture: arm
Version: 0.6-$SUB_VERSION
Depends: qpe-base ($QPE_VERSION), libopie ($QPE_VERSION), opie-console-help-en
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index 5d39d96..cad2567 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -90,12 +90,13 @@ Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) {
QWidget* dummy = new QHBox( stack );
stack->raiseWidget( dummy );
EmulationHandler* handler = new EmulationHandler(prof,dummy );
session->setEmulationHandler( handler );
session->connect();
+ session->setProfile( prof );
return session;
}
void ProfileManager::save( ) {
QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) );
ProfileConfig conf("opie-console-profiles");
@@ -118,12 +119,15 @@ void ProfileManager::save( ) {
conf.writeEntry( "autoConnect", (*it2).autoConnect());
conf.writeEntry( "back", (*it2).background() );
conf.writeEntry( "fore", (*it2).foreground() );
conf.writeEntry( "terminal", (*it2).terminal() );
}
}
+void ProfileManager::add( const Profile& prof) {
+ m_list.append( prof );
+}
void ProfileManager::setProfiles( const Profile::ValueList& list ) {
m_list = list;
};
Profile ProfileManager::profile( const QString& name )const {
Profile prof;
Profile::ValueList::ConstIterator it;
diff --git a/noncore/apps/opie-console/receive_layer.cpp b/noncore/apps/opie-console/receive_layer.cpp
index 05e2c67..bbde339 100644
--- a/noncore/apps/opie-console/receive_layer.cpp
+++ b/noncore/apps/opie-console/receive_layer.cpp
@@ -1,8 +1,9 @@
#include <unistd.h>
+#include <qdir.h>
#include <qstring.h>
#include <qfile.h>
#include "io_layer.h"
#include "receive_layer.h"
@@ -16,13 +17,13 @@ ReceiveLayer::~ReceiveLayer() {
}
IOLayer* ReceiveLayer::layer() {
return m_layer;
}
QString ReceiveLayer::currentDir()const{
if (m_curDir.isEmpty() )
- return QString::fromLocal8Bit( ::getwd(NULL) );
+ return QDir::currentDirPath();
return m_curDir;
}
void ReceiveLayer::changeDir( const QString& str) {
::chdir( str.latin1() );
}
void ReceiveLayer::receive( const QString& dir, Mode, Features ) {
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp
index 03d0fcd..c166d95 100644
--- a/noncore/apps/opie-console/session.cpp
+++ b/noncore/apps/opie-console/session.cpp
@@ -1,8 +1,9 @@
+#include "profile.h"
#include "io_layer.h"
#include "file_layer.h"
#include "emulation_handler.h"
#include "session.h"
@@ -39,12 +40,15 @@ EmulationHandler* Session::emulationHandler() {
QWidget* Session::widget() {
if (!m_emu )
return 0l;
return m_emu->widget();
}
+Profile Session::profile()const {
+ return m_prof;
+}
/*
WidgetLayer* Session::emulationWidget() {
return m_widLay;
}
*/
void Session::connect() {
@@ -88,12 +92,15 @@ void Session::setIOLayer( IOLayer* lay ) {
}
void Session::setEmulationHandler( EmulationHandler* lay ) {
delete m_emu;
m_emu = lay;
}
+void Session::setProfile( const Profile& prof ) {
+ m_prof = prof;
+}
/*
void Session::setEmulationWidget( WidgetLayer* lay ) {
delete m_widLay;
m_widLay = lay;
}
*/
diff --git a/noncore/apps/opie-console/session.h b/noncore/apps/opie-console/session.h
index 83b2046..f60a6c0 100644
--- a/noncore/apps/opie-console/session.h
+++ b/noncore/apps/opie-console/session.h
@@ -1,11 +1,13 @@
#ifndef OPIE_SESSION_H
#define OPIE_SESSION_H
#include <qwidgetstack.h>
+#include "profile.h"
+
class IOLayer;
class EmulationHandler;
/**
* This is a Session. A session contains
* a QWidget pointer and a IOLayer
* Imagine a session like a collection of what
@@ -39,12 +41,13 @@ public:
/**
* return the layer
*/
IOLayer* layer();
EmulationHandler* emulationHandler();
+ Profile profile()const;
/*
* connects the data flow from
* the IOLayer to the EmulationLayer
*/
void connect();
@@ -56,17 +59,19 @@ public:
void disconnect();
void setWidgetStack( QWidgetStack* widget );
void setEmulationHandler( EmulationHandler* lay );
void setIOLayer( IOLayer* );
void setName( const QString& );
+ void setProfile( const Profile& );
private:
QString m_name;
QWidgetStack* m_widget;
IOLayer* m_layer;
EmulationHandler* m_emu;
- bool m_connected;
+ bool m_connected : 1;
+ Profile m_prof;
};
#endif