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) (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
@@ -110,7 +110,6 @@ void MyPty::setSize(int lines, int columns)
void MyPty::donePty()
{
// This is code from the Qt DumbTerminal example
- int status = 0;
::close(m_fd);
@@ -257,6 +256,7 @@ MyPty::MyPty(const Profile& prof) : m_cpid(0)
m_sn_r = 0l;
m_fd = openPty();
ProcCtl* ctl = ProcCtl::self();
+ Q_UNUSED(ctl);
}
/*!
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
@@ -95,6 +95,31 @@
#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 */
@@ -1241,7 +1266,7 @@ void TEWidget::dropEvent(QDropEvent* event)
#endif
-void TEWidget::drop_menu_activated(int item)
+void TEWidget::drop_menu_activated(int)
{
#ifndef QT_NO_DRAGANDDROP
switch (item)
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
@@ -34,25 +34,7 @@ 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;
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
@@ -192,3 +192,9 @@ 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
@@ -49,7 +49,7 @@ public:
QWidget* widget();
void setColor( const QColor& fore, const QColor& back );
QPushButton* cornerButton();
-
+
/* Scripts */
/* Create a new script and record all typed characters */
void startRecording();
@@ -73,6 +73,8 @@ signals:
public slots:
void recv( const QByteArray& );
+ void paste();
+ void copy();
private slots:
void recvEmulation( const char*, int len );
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
@@ -11,11 +11,11 @@ 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() {
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
@@ -24,6 +24,7 @@ void IOBt::close() {
}
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() ) {
@@ -39,7 +40,7 @@ bool IOBt::open() {
this, SLOT( slotExited( OProcess* ) ) );
if ( m_attach->start() ) {
- IOSerial::open();
+ ret = IOSerial::open();
} else {
qWarning("could not attach to device");
delete m_attach;
@@ -49,8 +50,9 @@ bool IOBt::open() {
// 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 ) {
@@ -74,4 +76,5 @@ QString IOBt::name() const {
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
@@ -21,6 +21,7 @@ void IOIrda::close() {
}
bool IOIrda::open() {
+ bool ret;
// irdaattach here
m_attach = new OProcess();
@@ -30,13 +31,14 @@ bool IOIrda::open() {
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 ) {
@@ -59,4 +61,5 @@ QString IOIrda::name() const {
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
@@ -89,6 +89,16 @@ void MainWindow::initUI() {
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
*/
@@ -176,7 +186,7 @@ void MainWindow::initUI() {
/*
* action that open/closes the keyboard
-
+
m_openButtons = new QAction ( tr( "Open Buttons..." ),
Resource::loadPixmap( "" ),
QString::null, 0, this, 0 );
@@ -222,6 +232,20 @@ void MainWindow::initUI() {
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 );
@@ -539,3 +563,26 @@ void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) {
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
@@ -70,6 +70,13 @@ private slots:
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();
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,4 +1,4 @@
-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>
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
@@ -93,6 +93,7 @@ Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) {
EmulationHandler* handler = new EmulationHandler(prof,dummy );
session->setEmulationHandler( handler );
session->connect();
+ session->setProfile( prof );
return session;
}
@@ -121,6 +122,9 @@ void ProfileManager::save( ) {
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;
};
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,5 +1,6 @@
#include <unistd.h>
+#include <qdir.h>
#include <qstring.h>
#include <qfile.h>
@@ -19,7 +20,7 @@ IOLayer* ReceiveLayer::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) {
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,5 +1,6 @@
+#include "profile.h"
#include "io_layer.h"
#include "file_layer.h"
#include "emulation_handler.h"
@@ -42,6 +43,9 @@ QWidget* Session::widget() {
return m_emu->widget();
}
+Profile Session::profile()const {
+ return m_prof;
+}
/*
WidgetLayer* Session::emulationWidget() {
return m_widLay;
@@ -91,6 +95,9 @@ 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;
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
@@ -3,6 +3,8 @@
#include <qwidgetstack.h>
+#include "profile.h"
+
class IOLayer;
class EmulationHandler;
/**
@@ -42,6 +44,7 @@ public:
IOLayer* layer();
EmulationHandler* emulationHandler();
+ Profile profile()const;
/*
* connects the data flow from
@@ -59,13 +62,15 @@ public:
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;
};