author | zecke <zecke> | 2002-10-24 12:13:09 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-24 12:13:09 (UTC) |
commit | acf708cee945b8b843b0132672d79f5c4571c22b (patch) (side-by-side diff) | |
tree | 96b6bee6e6df3c6a252ff5680275f7080ad93729 | |
parent | 41c59e994e023f5c236502538f54d0f3fce8435a (diff) | |
download | opie-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
-rw-r--r-- | noncore/apps/opie-console/MyPty.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/TEWidget.cpp | 27 | ||||
-rw-r--r-- | noncore/apps/opie-console/TEWidget.h | 20 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/file_layer.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_bt.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_irda.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 49 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 7 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.control | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/profilemanager.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/receive_layer.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.h | 7 |
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 @@ -111,5 +111,4 @@ void MyPty::donePty() { // This is code from the Qt DumbTerminal example - int status = 0; ::close(m_fd); @@ -258,4 +257,5 @@ MyPty::MyPty(const Profile& prof) : m_cpid(0) 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 @@ -96,4 +96,29 @@ // 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", +" ", +" ", +" ......... ", +" .+++++++. ", +" .+@@@@#. ", +" .+@@@#. ", +" .+@@#. ", +" .+@#. ", +" .+#. ", +" .+. ", +" .. ", +" "}; + +} + + /* ------------------------------------------------------------------------- */ /* */ @@ -1242,5 +1267,5 @@ void TEWidget::dropEvent(QDropEvent* event) -void TEWidget::drop_menu_activated(int item) +void TEWidget::drop_menu_activated(int) { #ifndef QT_NO_DRAGANDDROP 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 @@ -35,23 +35,5 @@ 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 @@ -193,2 +193,8 @@ void EmulationHandler::runScript(const 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 @@ -50,5 +50,5 @@ public: void setColor( const QColor& fore, const QColor& back ); QPushButton* cornerButton(); - + /* Scripts */ /* Create a new script and record all typed characters */ @@ -74,4 +74,6 @@ signals: public slots: void recv( const QByteArray& ); + void paste(); + void copy(); private slots: 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 @@ -12,9 +12,9 @@ FileTransferLayer::~FileTransferLayer() { } -void FileTransferLayer::sendFile(const QFile& file) { +void FileTransferLayer::sendFile(const QFile&) { } -void FileTransferLayer::sendFile(const QString& file) { +void FileTransferLayer::sendFile(const QString&) { } 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 @@ -25,4 +25,5 @@ void IOBt::close() { bool IOBt::open() { + bool ret = false; // only set up bt stuff if mac address was set, otherwise use the device set @@ -40,5 +41,5 @@ bool IOBt::open() { if ( m_attach->start() ) { - IOSerial::open(); + ret = IOSerial::open(); } else { qWarning("could not attach to device"); @@ -50,6 +51,7 @@ bool IOBt::open() { // TODO: look first if the connection really exists. ( is set up ) - IOSerial::open(); + ret =IOSerial::open(); } + return ret; } @@ -75,3 +77,4 @@ 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 @@ -22,4 +22,5 @@ void IOIrda::close() { bool IOIrda::open() { + bool ret; // irdaattach here @@ -31,5 +32,5 @@ bool IOIrda::open() { if ( m_attach->start() ) { - IOSerial::open(); + ret= IOSerial::open(); } else { // emit error!!! @@ -38,4 +39,5 @@ bool IOIrda::open() { m_attach = 0l; } + return ret; } @@ -60,3 +62,4 @@ 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 @@ -90,4 +90,14 @@ void MainWindow::initUI() { 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 @@ -177,5 +187,5 @@ void MainWindow::initUI() { /* * action that open/closes the keyboard - + m_openButtons = new QAction ( tr( "Open Buttons..." ), Resource::loadPixmap( "" ), @@ -223,4 +233,18 @@ void MainWindow::initUI() { 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() ) ); @@ -540,2 +564,25 @@ void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { } } +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 @@ -71,4 +71,11 @@ private slots: 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(); 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,3 +1,3 @@ -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 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 @@ -94,4 +94,5 @@ Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) { session->setEmulationHandler( handler ); session->connect(); + session->setProfile( prof ); return session; @@ -122,4 +123,7 @@ void ProfileManager::save( ) { } } +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,4 +1,5 @@ #include <unistd.h> +#include <qdir.h> #include <qstring.h> #include <qfile.h> @@ -20,5 +21,5 @@ IOLayer* ReceiveLayer::layer() { QString ReceiveLayer::currentDir()const{ if (m_curDir.isEmpty() ) - return QString::fromLocal8Bit( ::getwd(NULL) ); + return QDir::currentDirPath(); return m_curDir; } 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,4 +1,5 @@ +#include "profile.h" #include "io_layer.h" #include "file_layer.h" @@ -43,4 +44,7 @@ QWidget* Session::widget() { return m_emu->widget(); } +Profile Session::profile()const { + return m_prof; +} /* WidgetLayer* Session::emulationWidget() { @@ -92,4 +96,7 @@ void Session::setEmulationHandler( EmulationHandler* lay ) { m_emu = lay; } +void Session::setProfile( const Profile& prof ) { + m_prof = prof; +} /* void Session::setEmulationWidget( WidgetLayer* 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 @@ -4,4 +4,6 @@ #include <qwidgetstack.h> +#include "profile.h" + class IOLayer; class EmulationHandler; @@ -43,4 +45,5 @@ public: EmulationHandler* emulationHandler(); + Profile profile()const; /* @@ -60,4 +63,5 @@ public: void setIOLayer( IOLayer* ); void setName( const QString& ); + void setProfile( const Profile& ); private: @@ -66,5 +70,6 @@ private: IOLayer* m_layer; EmulationHandler* m_emu; - bool m_connected; + bool m_connected : 1; + Profile m_prof; }; |