author | josef <josef> | 2002-10-14 17:21:03 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-14 17:21:03 (UTC) |
commit | 51e18b363eb37621479a059af58da3040db1be7e (patch) (side-by-side diff) | |
tree | 0099ca456633dda2ef68c3336a1541ecb95d1ae8 | |
parent | 49d40f92a6988a3deaf9b775803092616d312403 (diff) | |
download | opie-51e18b363eb37621479a059af58da3040db1be7e.zip opie-51e18b363eb37621479a059af58da3040db1be7e.tar.gz opie-51e18b363eb37621479a059af58da3040db1be7e.tar.bz2 |
- only allow sessions if all components (layer, widgetstack) are available
- add io_modem to .pro file so it gets compiled
- fix io_modem compilation (untested, but better than nothing)
-rw-r--r-- | noncore/apps/opie-console/io_modem.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_modem.h | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 4 |
4 files changed, 19 insertions, 6 deletions
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp index eb0aeb7..56147d8 100644 --- a/noncore/apps/opie-console/io_modem.cpp +++ b/noncore/apps/opie-console/io_modem.cpp @@ -1,73 +1,75 @@ #include "io_modem.h" #include "dialer.h" -IOModem:IOModem( const Profile &config ) : IOSerial( config ) { - m_config = config; +IOModem::IOModem( const Profile &profile ) + : IOSerial( profile ), m_profile( profile ) { } IOModem::~IOModem() { } void IOModem::close() { IOSerial::close(); } bool IOModem::open() { + qWarning("IOModem::open"); IOSerial::open(); Dialer d(m_profile); int result = d.exec(); if(result == QDialog::Accepted) { return true; } else return false; } void IOModem::reload( const Profile &config ) { m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE); m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD); m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY); m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS); m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS); m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW); m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ); m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ); m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ); m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ); m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ); m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ); m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ); m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ); m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ); m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ); m_cancel = config.readEntry("CancelString", MODEM_DEFAULT_CANCEL_STRING ); m_dialTime = config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ); m_delayRedial = config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ); m_numberTries = config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ); m_dtrDropTime = config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ); m_bpsDetect = config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ); m_dcdLines = config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ); m_multiLineUntag = config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ); } QString IOModem::identifier() const { return "modem"; } QString IOModem::name() const { return "Modem IO Layer"; } -void IOIrda::slotExited(OProcess* proc ){ +void IOModem::slotExited(OProcess* proc ){ close(); } + diff --git a/noncore/apps/opie-console/io_modem.h b/noncore/apps/opie-console/io_modem.h index 6d44349..d681f66 100644 --- a/noncore/apps/opie-console/io_modem.h +++ b/noncore/apps/opie-console/io_modem.h @@ -1,70 +1,71 @@ #ifndef OPIE_IO_MODEM #define OPIE_IO_MODEM #include <opie/oprocess.h> #include "io_serial.h" +#include "profile.h" /* Default values to be used if the profile information is incomplete */ #define MODEM_DEFAULT_DEVICE "/dev/ttyS0" #define MODEM_DEFAULT_BAUD 9600 #define MODEM_DEFAULT_PARITY 0 #define MODEM_DEFAULT_DBITS 8 #define MODEM_DEFAULT_SBITS 1 #define MODEM_DEFAULT_FLOW 0 #define MODEM_DEFAULT_INIT_STRING "~^M~ATZ^M~" #define MODEM_DEFAULT_RESET_STRING "~^M~ATZ^M~" #define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT" #define MODEM_DEFAULT_DIAL_SUFFIX1 "^M" #define MODEM_DEFAULT_DIAL_PREFIX2 "ATDP" #define MODEM_DEFAULT_DIAL_SUFFIX2 "^M" #define MODEM_DEFAULT_DIAL_PREFIX3 "ATX1DT" #define MODEM_DEFAULT_DIAL_SUFFIX3 ";X4D^M" #define MODEM_DEFAULT_CONNECT_STRING "CONNECT" #define MODEM_DEFAULT_HANGUP_STRING "~~+++~~ATH^M" #define MODEM_DEFAULT_CANCEL_STRING "^M" #define MODEM_DEFAULT_DIAL_TIME 45 #define MODEM_DEFAULT_DELAY_REDIAL 2 #define MODEM_DEFAULT_NUMBER_TRIES 10 #define MODEM_DEFAULT_DTR_DROP_TIME 1 #define MODEM_DEFAULT_BPS_DETECT 0 // bool #define MODEM_DEFAULT_DCD_LINES 1 //bool #define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool /* IOSerial implements a RS232 IO Layer */ class IOModem : public IOSerial { Q_OBJECT public: IOModem(const Profile &); ~IOModem(); QString identifier() const; QString name() const; signals: void received(const QByteArray &); void error(int, const QString &); public slots: bool open(); void close(); void reload(const Profile &); private: QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2, - m_dialSuf2, dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel; + m_dialSuf2, m_dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel; int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime, m_bpsDetect, m_dcdLines, m_multiLineUntag; const Profile& m_profile; private slots: void slotExited(OProcess* proc); }; #endif diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 415259e..1adb43d 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -1,40 +1,41 @@ #include <qaction.h> #include <qmenubar.h> #include <qlabel.h> #include <qpopupmenu.h> #include <qtoolbar.h> #include <qpe/resource.h> #include <opie/ofiledialog.h> +#include <qmessagebox.h> #include "profileeditordialog.h" #include "configdialog.h" #include "default.h" #include "metafactory.h" #include "profile.h" #include "profilemanager.h" #include "mainwindow.h" #include "tabwidget.h" #include "transferdialog.h" #include "function_keyboard.h" #include "script.h" MainWindow::MainWindow() { m_factory = new MetaFactory(); Default def(m_factory); m_sessions.setAutoDelete( TRUE ); m_curSession = 0; m_manager = new ProfileManager( m_factory ); m_manager->load(); initUI(); populateProfiles(); } void MainWindow::initUI() { setToolBarsMovable( FALSE ); /* tool bar for the menu */ m_tool = new QToolBar( this ); m_tool->setHorizontalStretchable( TRUE ); m_bar = new QMenuBar( m_tool ); @@ -280,60 +281,69 @@ void MainWindow::slotConfigure() { } /* * we will remove * this window from the tabwidget * remove it from the list * delete it * and set the currentSession() */ void MainWindow::slotClose() { qWarning("close"); if (!currentSession() ) return; tabWidget()->remove( currentSession() ); /*it's autodelete */ m_sessions.remove( m_curSession ); m_curSession = m_sessions.first(); tabWidget()->setCurrent( m_curSession ); } /* * We will get the name * Then the profile * and then we will make a profile */ void MainWindow::slotProfile( int id) { Profile prof = manager()->profile( m_sessionsPop->text( id) ); create( prof ); } void MainWindow::create( const Profile& prof ) { Session *ses = manager()->fromProfile( prof, tabWidget() ); + if((!ses) || (!ses->layer()) || (!ses->widgetStack())) + { + QMessageBox::warning(this, + QObject::tr("Session failed"), + QObject::tr("Cannot open session: Not all components were found.")); + //if(ses) delete ses; + return; + } + m_sessions.append( ses ); tabWidget()->add( ses ); m_curSession = ses; } void MainWindow::slotTransfer() { // if ( currentSession() ) { TransferDialog dlg(this); dlg.showMaximized(); dlg.exec(); // } } void MainWindow::slotOpenKeb(bool state) { if (state) m_keyBar->show(); else m_keyBar->hide(); } void MainWindow::slotSessionChanged( Session* ses ) { if ( ses ) { qWarning("changing %s", ses->name().latin1() ); m_curSession = ses; } } diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index ef6bc21..26bce83 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro @@ -1,70 +1,70 @@ TEMPLATE = app #CONFIG = qt warn_on release CONFIG = qt debug DESTDIR = $(OPIEDIR)/bin -HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h\ +HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ file_layer.h filetransfer.h \ metafactory.h \ session.h \ mainwindow.h \ profile.h \ profileconfig.h \ profilemanager.h \ configwidget.h \ tabwidget.h \ configdialog.h \ emulation_layer.h \ vt102emulation.h \ common.h \ history.h \ screen.h \ keytrans.h \ widget_layer.h \ transferdialog.h \ profiledialogwidget.h \ profileeditordialog.h \ default.h \ terminalwidget.h \ iolayerbase.h \ serialconfigwidget.h irdaconfigwidget.h \ btconfigwidget.h modemconfigwidget.h \ atconfigdialog.h dialdialog.h \ emulation_widget.h procctl.h \ function_keyboard.h \ receive_layer.h filereceive.h \ script.h \ dialer.h -SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp \ +SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \ file_layer.cpp filetransfer.cpp \ main.cpp \ metafactory.cpp \ session.cpp \ mainwindow.cpp \ profile.cpp \ profileconfig.cpp \ profilemanager.cpp \ tabwidget.cpp \ configdialog.cpp \ emulation_layer.cpp \ vt102emulation.cpp \ history.cpp \ screen.cpp \ keytrans.cpp \ widget_layer.cpp \ transferdialog.cpp \ profiledialogwidget.cpp \ profileeditordialog.cpp \ terminalwidget.cpp \ iolayerbase.cpp \ serialconfigwidget.cpp irdaconfigwidget.cpp \ btconfigwidget.cpp modemconfigwidget.cpp \ atconfigdialog.cpp dialdialog.cpp \ emulation_widget.cpp default.cpp procctl.cpp \ function_keyboard.cpp \ receive_layer.cpp filereceive.cpp \ script.cpp \ dialer.cpp INTERFACES = configurebase.ui editbase.ui INCLUDEPATH += $(OPIEDIR)/include |