summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-24 12:13:09 (UTC)
committer zecke <zecke>2002-10-24 12:13:09 (UTC)
commitacf708cee945b8b843b0132672d79f5c4571c22b (patch) (side-by-side diff)
tree96b6bee6e6df3c6a252ff5680275f7080ad93729
parent41c59e994e023f5c236502538f54d0f3fce8435a (diff)
downloadopie-acf708cee945b8b843b0132672d79f5c4571c22b.zip
opie-acf708cee945b8b843b0132672d79f5c4571c22b.tar.gz
opie-acf708cee945b8b843b0132672d79f5c4571c22b.tar.bz2
Fixed warnings
Now we're down to two warning with number conversions Enable Saving Sessions Enable Copy and Paste
Diffstat (more/less context) (show 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.h2
-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.cpp47
-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, 121 insertions, 29 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
@@ -105,17 +105,16 @@ void MyPty::setSize(int lines, int columns)
if(m_fd < 0) return;
ioctl(m_fd,TIOCSWINSZ,(char *)&wsize);
}
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);
delete m_sn_e;
delete m_sn_r;
@@ -252,16 +251,17 @@ MyPty::MyPty(const Profile& prof) : m_cpid(0)
case Profile::XTerm:
m_term = "xterm";
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.
*/
MyPty::~MyPty()
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
@@ -90,16 +90,41 @@
#define rimX 0 // left/right rim width
#define rimY 0 // top/bottom rim high
#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 */
/* */
/* ------------------------------------------------------------------------- */
//FIXME: the default color table is in session.C now.
// We need a way to get rid of this one, here.
@@ -1236,17 +1261,17 @@ void TEWidget::dropEvent(QDropEvent* event)
currentSession->getEmulation()->sendString(dropText.local8Bit());
}
// 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());
// KWM::activate((Window)this->winId());
break;
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
@@ -29,35 +29,17 @@
#include <qpushbutton.h>
#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
// a widget representing attributed text
{
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
@@ -187,8 +187,14 @@ void EmulationHandler::clearScript() {
m_script = 0;
}
}
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
@@ -68,16 +68,18 @@ public:
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 );
QColor backColor(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
@@ -6,18 +6,18 @@
FileTransferLayer::FileTransferLayer(IOLayer *layer)
: QObject(), m_layer( 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
@@ -19,43 +19,45 @@ void IOBt::close() {
// still need error handling
if ( m_attach ) {
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
m_attach = new OProcess();
*m_attach << "hciattach /dev/ttyS2 any 57600";
// 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);
m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY);
m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS);
@@ -69,9 +71,10 @@ 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
@@ -16,32 +16,34 @@ IOIrda::~IOIrda() {
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);
m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS);
m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS);
@@ -54,9 +56,10 @@ 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
@@ -84,16 +84,26 @@ void MainWindow::initUI() {
QAction* a = new QAction(tr("New Connection"),
Resource::loadPixmap( "new" ),
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 );
connect(m_connect, SIGNAL(activated() ),
this, SLOT(slotConnect() ) );
@@ -217,16 +227,30 @@ void MainWindow::initUI() {
m_buttonBar->setHorizontalStretchable( TRUE );
m_buttonBar->hide();
/*
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 );
m_recordScript->setEnabled( false );
m_saveScript->setEnabled( false );
@@ -534,8 +558,31 @@ void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) {
QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode)));
// 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
@@ -65,16 +65,23 @@ private slots:
void slotOpenButtons(bool);
void slotRecordScript();
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
*/
Session* m_curSession;
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,9 +1,9 @@
-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
License: GPL
Description: Opie terminal app
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
@@ -88,16 +88,17 @@ Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) {
QWidgetStack *stack = new QWidgetStack( parent );
session->setWidgetStack( stack );
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");
Profile::ValueList::Iterator it2;
for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) {
@@ -116,16 +117,19 @@ void ProfileManager::save( ) {
conf.writeEntry( "iolayer", str );
conf.writeEntry( "term", QString::fromUtf8( (*it2).terminalName() ) );
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;
for ( it = m_list.begin(); it != m_list.end(); ++it ) {
if ( name == (*it).name() ) {
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,10 +1,11 @@
#include <unistd.h>
+#include <qdir.h>
#include <qstring.h>
#include <qfile.h>
#include "io_layer.h"
#include "receive_layer.h"
ReceiveLayer::ReceiveLayer( IOLayer* lay, const QString& startDir )
: QObject(), m_curDir( startDir ), m_layer(lay )
@@ -14,17 +15,17 @@ ReceiveLayer::ReceiveLayer( IOLayer* lay, const QString& startDir )
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 ) {
receive( dir );
}
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,10 +1,11 @@
+#include "profile.h"
#include "io_layer.h"
#include "file_layer.h"
#include "emulation_handler.h"
#include "session.h"
Session::Session() {
m_widget = 0l;
@@ -37,16 +38,19 @@ EmulationHandler* Session::emulationHandler() {
return m_emu;
}
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() {
if ( !m_layer || !m_emu )
return;
@@ -86,15 +90,18 @@ void Session::setIOLayer( IOLayer* lay ) {
delete m_layer;
m_layer = 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,13 +1,15 @@
#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
* is needed to show your widget in a tab ;)
*/
@@ -37,16 +39,17 @@ public:
QWidget* widget();
/**
* return the layer
*/
IOLayer* layer();
EmulationHandler* emulationHandler();
+ Profile profile()const;
/*
* connects the data flow from
* the IOLayer to the EmulationLayer
*/
void connect();
/*
@@ -54,19 +57,21 @@ public:
* this will be done for ft
*/
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