summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-08 16:37:37 (UTC)
committer zecke <zecke>2002-10-08 16:37:37 (UTC)
commit76fb8a57bf9fbae3a7073c8b0be1216f34adf99c (patch) (side-by-side diff)
tree3f486d66ce474039b1a0fc4ade770e6e8a7c32b3
parentfaeb94a4000dc539577af465107b5d10903f92d6 (diff)
downloadopie-76fb8a57bf9fbae3a7073c8b0be1216f34adf99c.zip
opie-76fb8a57bf9fbae3a7073c8b0be1216f34adf99c.tar.gz
opie-76fb8a57bf9fbae3a7073c8b0be1216f34adf99c.tar.bz2
SzModem:
Make it compile remove = 0 from sendFile Add a Type to Sz so it could cover SX,SY too MetaFactory: take QCString name QString uiString so Carsten will be able to translate and users can switch Language without losing profiles Default It's aware of all Default/BuiltIn Plugins and adds them to the factory Common typedef bool BOOL TT is not using bool because it wasn't available at that time they use uint : 1... maybe we should change UINT_8 to Q_UINT8... MainWindow: give the factory to the config widget use Default IOLayer reload should take Profile not Config ConfigDialog: make use of Factory and do not do new MetaFactory.. i should make the c'tor private and add MainWindow as friend ProfileEditorDialog: Huge clean ups to the architecture. I still need to convert the widgets. Use the factory right
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/common.h2
-rw-r--r--noncore/apps/opie-console/configdialog.cpp10
-rw-r--r--noncore/apps/opie-console/configdialog.h5
-rw-r--r--noncore/apps/opie-console/default.cpp65
-rw-r--r--noncore/apps/opie-console/default.h30
-rw-r--r--noncore/apps/opie-console/io_layer.h2
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp4
-rw-r--r--noncore/apps/opie-console/metafactory.cpp76
-rw-r--r--noncore/apps/opie-console/metafactory.h60
-rw-r--r--noncore/apps/opie-console/opie-console.pro16
-rw-r--r--noncore/apps/opie-console/profile.cpp21
-rw-r--r--noncore/apps/opie-console/profile.h11
-rw-r--r--noncore/apps/opie-console/profiledialogwidget.cpp32
-rw-r--r--noncore/apps/opie-console/profiledialogwidget.h50
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp239
-rw-r--r--noncore/apps/opie-console/profileeditordialog.h25
-rw-r--r--noncore/apps/opie-console/profileeditorplugins.h142
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp6
-rw-r--r--noncore/apps/opie-console/sz_transfer.cpp2
-rw-r--r--noncore/apps/opie-console/sz_transfer.h12
20 files changed, 544 insertions, 266 deletions
diff --git a/noncore/apps/opie-console/common.h b/noncore/apps/opie-console/common.h
index ac0e2cf..979c2bd 100644
--- a/noncore/apps/opie-console/common.h
+++ b/noncore/apps/opie-console/common.h
@@ -17,25 +17,25 @@
/* -------------------------------------------------------------------------- */
/*! \file TECommon.h
\brief Definitions shared between TEScreen and TEWidget.
*/
#ifndef TECOMMON_H
#define TECOMMON_H
#include <qcolor.h>
#ifndef BOOL
-typedef int BOOL;
+typedef bool BOOL;
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef UINT8
typedef unsigned char UINT8;
diff --git a/noncore/apps/opie-console/configdialog.cpp b/noncore/apps/opie-console/configdialog.cpp
index ee1ffb4..50512b6 100644
--- a/noncore/apps/opie-console/configdialog.cpp
+++ b/noncore/apps/opie-console/configdialog.cpp
@@ -20,26 +20,27 @@ ConfigListItem::ConfigListItem( QListView* item, const Profile& prof )
{
setText(0, prof.name() );
}
ConfigListItem::~ConfigListItem() {
}
Profile ConfigListItem::profile()const {
return m_prof;
}
/* Dialog */
-ConfigDialog::ConfigDialog( const Profile::ValueList& lis, QWidget* parent )
- : ConfigureBase( parent, 0, TRUE )
+ConfigDialog::ConfigDialog( const Profile::ValueList& lis, MetaFactory* fa,
+ QWidget* parent )
+ : ConfigureBase( parent, 0, TRUE ), m_fact( fa )
{
//init();
{
Profile::ValueList::ConstIterator it;
for (it = lis.begin(); it != lis.end(); ++it ) {
new ConfigListItem( lstView, (*it) );
}
}
}
ConfigDialog::~ConfigDialog() {
}
@@ -62,44 +63,45 @@ void ConfigDialog::slotRemove() {
lstView->takeItem( item );
delete item;
}
void ConfigDialog::slotEdit() {
Profile p;
if(!lstView->currentItem()) return;
// Load profile
p = ((ConfigListItem*)lstView->currentItem())->profile();
- ProfileEditorDialog dlg(new MetaFactory(), p);
+ ProfileEditorDialog dlg(m_fact, p);
dlg.setCaption("Edit Connection Profile");
dlg.showMaximized();
int ret = dlg.exec();
if(ret == QDialog::Accepted)
{
if(lstView->currentItem()) delete lstView->currentItem();
// use dlg.terminal()!
Profile p = dlg.profile();
new ConfigListItem(lstView, p);
}
}
void ConfigDialog::slotAdd() {
- ProfileEditorDialog dlg(new MetaFactory());
+ qWarning("slotAdd");
+ ProfileEditorDialog dlg(m_fact);
dlg.setCaption("New Connection");
dlg.showMaximized();
int ret = dlg.exec();
if(ret == QDialog::Accepted)
{
// TODO: Move into general profile save part
// assignments
//QString type = dlg.term_type();
//if(type == "VT102") profile = Profile::VT102;
diff --git a/noncore/apps/opie-console/configdialog.h b/noncore/apps/opie-console/configdialog.h
index a0c40d0..b81a004 100644
--- a/noncore/apps/opie-console/configdialog.h
+++ b/noncore/apps/opie-console/configdialog.h
@@ -1,23 +1,26 @@
#ifndef OPIE_CONFIG_DIALOG_H
#define OPIE_CONFIG_DIALOG_H
#include <qdialog.h>
#include "configurebase.h"
#include "profile.h"
+class MetaFactory;
class ConfigDialog : public ConfigureBase {
Q_OBJECT
public:
- ConfigDialog( const Profile::ValueList&, QWidget* parent = 0l);
+ ConfigDialog( const Profile::ValueList&, MetaFactory*, QWidget* parent = 0l);
~ConfigDialog();
Profile::ValueList list()const;
protected slots:
void slotRemove();
void slotEdit();
void slotAdd();
+private:
+ MetaFactory* m_fact;
};
#endif
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp
new file mode 100644
index 0000000..78495d2
--- a/dev/null
+++ b/noncore/apps/opie-console/default.cpp
@@ -0,0 +1,65 @@
+#include "io_serial.h"
+#include "sz_transfer.h"
+
+#include "default.h"
+
+extern "C" {
+ // FILE Transfer Stuff
+ FileTransferLayer* newSZTransfer(IOLayer* lay) {
+ return new SzTransfer( SzTransfer::SZ, lay );
+ }
+ FileTransferLayer* newSYTransfer(IOLayer* lay) {
+ return new SzTransfer( SzTransfer::SY, lay );
+ }
+ FileTransferLayer* newSXTransfer(IOLayer* lay) {
+ return new SzTransfer( SzTransfer::SX, lay );
+ }
+
+ // Layer stuff
+ IOLayer* newSerialLayer( const Profile& prof) {
+ return new IOSerial( prof );
+ }
+ IOLayer* newBTLayer( const Profile& ) {
+ return 0l;
+ }
+ IOLayer* newIrDaLayer( const Profile& ) {
+ return 0l;
+ }
+
+ // Connection Widgets
+ ProfileDialogWidget* newSerialWidget(const QString& str, QWidget* ) {
+ return 0l;
+ }
+ ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid) {
+ return newSerialWidget(str, wid);
+ }
+ ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid) {
+ return newSerialWidget(str, wid );
+ }
+
+ // Terminal Widget(s)
+ ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* ) {
+ return 0l;
+ }
+
+};
+
+Default::Default( MetaFactory* fact ) {
+ fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer );
+ fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer );
+ fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer );
+
+ fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer );
+ fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer );
+ fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer );
+
+ fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget );
+ fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget );
+ fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget );
+
+ fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget );
+
+}
+Default::~Default() {
+
+}
diff --git a/noncore/apps/opie-console/default.h b/noncore/apps/opie-console/default.h
new file mode 100644
index 0000000..ed78986
--- a/dev/null
+++ b/noncore/apps/opie-console/default.h
@@ -0,0 +1,30 @@
+#ifndef OPIE_DEFAULT_H
+#define OPIE_DEFAULT_H
+
+#include "metafactory.h"
+
+extern "C" {
+ FileTransferLayer* newSZTransfer(IOLayer*);
+ FileTransferLayer* newSYTransfer(IOLayer*);
+ FileTransferLayer* newSXTransfer(IOLayer*);
+
+ IOLayer* newSerialLayer(const Profile&);
+ IOLayer* newBTLayer(const Profile& );
+ IOLayer* newIrDaLayer(const Profile& );
+
+ ProfileDialogWidget* newSerialWidget(const QString&, QWidget* );
+ ProfileDialogWidget* newIrDaWidget (const QString&, QWidget* );
+ ProfileDialogWidget* newBTWidget (const QString&, QWidget* );
+
+ ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* );
+};
+
+class MetaFactory;
+struct Default {
+public:
+ Default(MetaFactory* );
+ ~Default();
+};
+
+
+#endif
diff --git a/noncore/apps/opie-console/io_layer.h b/noncore/apps/opie-console/io_layer.h
index 2f1ceef..b891b2b 100644
--- a/noncore/apps/opie-console/io_layer.h
+++ b/noncore/apps/opie-console/io_layer.h
@@ -72,16 +72,16 @@ public slots:
* bool open
*/
virtual bool open() = 0;
/**
* close the io
*/
virtual void close() = 0;
/**
* closes and reloads the settings
*/
- virtual void reload( const Config& ) = 0;
+ virtual void reload( const Profile& ) = 0;
};
#endif
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 31f1138..647a331 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -1,27 +1,29 @@
#include <qaction.h>
#include <qmenubar.h>
#include <qlabel.h>
#include <qpopupmenu.h>
#include <qtoolbar.h>
#include "configdialog.h"
+#include "default.h"
#include "metafactory.h"
#include "profilemanager.h"
#include "mainwindow.h"
#include "tabwidget.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 );
m_tool = new QToolBar( this );
@@ -147,25 +149,25 @@ void MainWindow::slotDisconnect() {
}
void MainWindow::slotTerminate() {
if ( currentSession() )
currentSession()->layer()->close();
delete m_curSession;
m_curSession = 0l;
/* FIXME move to the next session */
}
void MainWindow::slotConfigure() {
qWarning("configure");
- ConfigDialog conf( manager()->all() );
+ ConfigDialog conf( manager()->all(), factory() );
conf.showMaximized();
int ret = conf.exec();
if ( QDialog::Accepted == ret ) {
manager()->setProfiles( conf.list() );
populateProfiles();
}
}
void MainWindow::slotClose() {
}
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp
index b69d6da..077b418 100644
--- a/noncore/apps/opie-console/metafactory.cpp
+++ b/noncore/apps/opie-console/metafactory.cpp
@@ -1,46 +1,64 @@
#include <qpe/config.h>
#include "metafactory.h"
MetaFactory::MetaFactory() {
}
MetaFactory::~MetaFactory() {
}
-void MetaFactory::addConfigWidgetFactory( const QString& str,
- const QString& name,
- configWidget wid) {
- m_namemap.insert ( str, name );
- m_confFact.insert( str, wid );
+void MetaFactory::addConnectionWidgetFactory( const QCString& name,
+ const QString& str,
+ configWidget wid) {
+ m_strings.insert( str, name );
+ m_conFact.insert( str, wid );
}
-void MetaFactory::addIOLayerFactory( const QString& str,
+void MetaFactory::addTerminalWidgetFactory( const QCString& name,
+ const QString& str,
+ configWidget wid ) {
+ m_strings.insert( str, name );
+ m_termFact.insert( str, wid );
+}
+void MetaFactory::addIOLayerFactory( const QCString& name,
+ const QString& str,
iolayer lay) {
+ m_strings.insert( str, name );
m_layerFact.insert( str, lay );
}
-void MetaFactory::addFileTransferLayer( const QString& str,
+void MetaFactory::addFileTransferLayer( const QCString& name,
+ const QString& str,
filelayer lay) {
+ m_strings.insert(str, name );
m_fileFact.insert( str, lay );
}
QStringList MetaFactory::ioLayers()const {
QStringList list;
QMap<QString, iolayer>::ConstIterator it;
for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) {
list << it.key();
}
return list;
}
-QStringList MetaFactory::configWidgets()const {
+QStringList MetaFactory::connectionWidgets()const {
+ QStringList list;
+ QMap<QString, configWidget>::ConstIterator it;
+ for ( it = m_conFact.begin(); it != m_conFact.end(); ++it ) {
+ list << it.key();
+ }
+ return list;
+}
+QStringList MetaFactory::terminalWidgets()const {
QStringList list;
QMap<QString, configWidget>::ConstIterator it;
- for ( it = m_confFact.begin(); it != m_confFact.end(); ++it ) {
+ for ( it = m_termFact.begin(); it != m_termFact.end(); ++it ) {
list << it.key();
}
return list;
}
QStringList MetaFactory::fileTransferLayers()const {
QStringList list;
QMap<QString, filelayer>::ConstIterator it;
for ( it = m_fileFact.begin(); it != m_fileFact.end(); ++it ) {
list << it.key();
}
return list;
}
@@ -51,26 +69,46 @@ IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) {
QMap<QString, iolayer>::Iterator it;
it = m_layerFact.find( str );
if ( it != m_layerFact.end() ) {
lay = (*(it.data()))(prof);
/*
iolayer laye = it.data();
lay = (*laye )(conf);*/
}
return lay;
}
-ProfileEditorPlugin *MetaFactory::newConfigPlugin ( const QString& str, QWidget *parent, Profile *prof) {
- ProfileEditorPlugin *p = NULL;
- configWidget c;
+ProfileDialogWidget *MetaFactory::newConnectionPlugin ( const QString& str, QWidget *parent) {
+ ProfileDialogWidget* wid = 0l;
- c = m_confFact[str];
- if(c) p = c(parent, prof);
-
- return p;
+ QMap<QString, configWidget>::Iterator it;
+ it = m_conFact.find( str );
+ if ( it != m_conFact.end() ) {
+ wid = (*(it.data() ) )(str,parent);
+ }
+ return wid;
}
+ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget *parent) {
+ if (str.isEmpty() )
+ return 0l;
+ ProfileDialogWidget* wid = 0l;
+ qWarning("new terminalPlugin %s %l", str.latin1(), parent );
-QString MetaFactory::name( const QString& str ) {
- return m_namemap[str];
+ QMap<QString, configWidget>::Iterator it;
+ it = m_termFact.find( str );
+ if ( it != m_conFact.end() ) {
+ wid = (*(it.data() ) )(str,parent);
+ }
+ return wid;
+}
+QCString MetaFactory::internal( const QString& str )const {
+ return m_strings[str];
+}
+QString MetaFactory::external( const QCString& str )const {
+ QMap<QString, QCString>::ConstIterator it;
+ for ( it = m_strings.begin(); it != m_strings.end(); ++it ) {
+ if ( it.data() == str )
+ return it.key();
+ }
+ return QString::null;
}
-
diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h
index 216de03..3f7ddce 100644
--- a/noncore/apps/opie-console/metafactory.h
+++ b/noncore/apps/opie-console/metafactory.h
@@ -5,47 +5,81 @@
* The MetaFactory is used to keep track of all IOLayers, FileTransferLayers and ConfigWidgets
* and to instantiate these implementations on demand
*/
#include <qwidget.h>
#include <qmap.h>
#include <qpe/config.h>
#include "io_layer.h"
#include "file_layer.h"
#include "profile.h"
-#include "profileeditorplugins.h"
+#include "profiledialogwidget.h"
class MetaFactory {
public:
- typedef ProfileEditorPlugin* (*configWidget)(QWidget* parent, Profile* prof);
+ typedef ProfileDialogWidget* (*configWidget)(const QString&, QWidget* parent);
typedef IOLayer* (*iolayer)(const Profile& );
typedef FileTransferLayer* (*filelayer)(IOLayer*);
MetaFactory();
~MetaFactory();
- void addConfigWidgetFactory( const QString&,
- const QString&,
- configWidget );
- void addIOLayerFactory(const QString&,
- iolayer );
- void addFileTransferLayer( const QString&,
+ /**
+ * add a ProfileDialogWidget to the factory
+ * name is the name shown to the user
+ */
+ void addConnectionWidgetFactory( const QCString& internalName,
+ const QString& uiString,
+ configWidget );
+ void addTerminalWidgetFactory ( const QCString& internalName,
+ const QString& name,
+ configWidget );
+
+ /**
+ * adds an IOLayer factory
+ */
+ void addIOLayerFactory( const QCString&,
+ const QString&,
+ iolayer );
+
+ /**
+ * adds a FileTransfer Layer
+ */
+ void addFileTransferLayer( const QCString& name,
+ const QString&,
filelayer );
+
+ /* translated UI Strings */
QStringList ioLayers()const;
- QStringList configWidgets()const;
+ QStringList connectionWidgets()const;
+ QStringList terminalWidgets()const;
QStringList fileTransferLayers()const;
IOLayer* newIOLayer( const QString&,const Profile& );
- ProfileEditorPlugin *newConfigPlugin ( const QString&, QWidget*, Profile* );
+ ProfileDialogWidget *newConnectionPlugin ( const QString&, QWidget* );
+ ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* );
+
+ /*
+ * internal takes the maybe translated
+ * public QString and maps it to the internal
+ * not translatable QCString
+ */
+ QCString internal( const QString& )const;
+
+ /*
+ * external takes the internal name
+ * it returns a translated name
+ */
+ QString external( const QCString& )const;
- QString name( const QString& );
private:
- QMap<QString, configWidget> m_confFact;
+ QMap<QString, QCString> m_strings;
+ QMap<QString, configWidget> m_conFact;
+ QMap<QString, configWidget> m_termFact;
QMap<QString, iolayer> m_layerFact;
QMap<QString, filelayer> m_fileFact;
- QMap<QString, QString> m_namemap;
};
#endif
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro
index 768e453..984072a 100644
--- a/noncore/apps/opie-console/opie-console.pro
+++ b/noncore/apps/opie-console/opie-console.pro
@@ -4,52 +4,54 @@ CONFIG = qt debug
DESTDIR = $(OPIEDIR)/bin
HEADERS = io_layer.h io_serial.h \
file_layer.h sz_transfer.h \
metafactory.h \
session.h \
mainwindow.h \
profile.h \
profileconfig.h \
profilemanager.h \
configwidget.h \
tabwidget.h \
configdialog.h \
- profileeditordialog.h \
- profileeditorplugins.h \
emulation_layer.h \
widget.h \
vt102emulation.h \
common.h \
history.h \
screen.h \
keytrans.h \
widget_layer.h \
- transferdialog.h
+ transferdialog.h \
+ profiledialogwidget.h \
+ profileeditordialog.h \
+ default.h
SOURCES = io_layer.cpp io_serial.cpp \
file_layer.cpp sz_transfer.cpp \
- main.cpp \
+ main.cpp \
metafactory.cpp \
session.cpp \
mainwindow.cpp \
profile.cpp \
profileconfig.cpp \
profilemanager.cpp \
tabwidget.cpp \
configdialog.cpp \
- profileeditordialog.cpp \
- profileeditorplugins.cpp \
emulation_layer.cpp \
widget.cpp \
vt102emulation.cpp \
history.cpp \
screen.cpp \
keytrans.cpp \
widget_layer.cpp \
- transferdialog.cpp
+ transferdialog.cpp \
+ profiledialogwidget.cpp \
+ profileeditordialog.cpp \
+ default.cpp
INTERFACES = configurebase.ui editbase.ui
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie
TARGET = opie-console
diff --git a/noncore/apps/opie-console/profile.cpp b/noncore/apps/opie-console/profile.cpp
index c8f5eb0..1a94619 100644
--- a/noncore/apps/opie-console/profile.cpp
+++ b/noncore/apps/opie-console/profile.cpp
@@ -1,71 +1,78 @@
#include "profile.h"
Profile::Profile() {
}
Profile::Profile( const QString& name,
- const QString& iolayerName,
+ const QCString& iolayerName,
+ const QCString& termName,
int background,
int foreground,
int terminal )
- : m_name( name ), m_ioLayer( iolayerName ), m_back( background ),
- m_fore( foreground ), m_terminal( terminal )
-{
-}
+ : m_name( name ), m_ioLayer( iolayerName ), m_term( termName),
+ m_back( background ), m_fore( foreground ), m_terminal( terminal )
+{}
Profile::Profile( const Profile& prof )
{
(*this) = prof;
}
bool Profile::operator==( const Profile& prof ) {
if ( m_name == prof.m_name ) return true;
return false;
}
Profile &Profile::operator=( const Profile& prof ) {
m_name = prof.m_name;
m_ioLayer = prof.m_ioLayer;
m_back = prof.m_back;
m_fore = prof.m_fore;
m_terminal = prof.m_terminal;
m_conf = prof.m_conf;
+ m_term = prof.m_term;
return *this;
}
Profile::~Profile() {
}
QMap<QString, QString> Profile::conf()const {
return m_conf;
}
QString Profile::name()const {
return m_name;
}
-QString Profile::ioLayerName()const {
+QCString Profile::ioLayerName()const {
return m_ioLayer;
}
+QCString Profile::terminalName( )const {
+ return m_term;
+}
int Profile::foreground()const {
return m_fore;
}
int Profile::background()const {
return m_back;
}
int Profile::terminal()const {
return m_terminal;
}
void Profile::setName( const QString& str ) {
m_name = str;
}
-void Profile::setIOLayer( const QString& name ) {
+void Profile::setIOLayer( const QCString& name ) {
m_ioLayer = name;
}
+void Profile::setTerminalName( const QCString& str ) {
+ m_term = str;
+}
void Profile::setBackground( int back ) {
m_back = back;
}
void Profile::setForeground( int fore ) {
m_fore = fore;
}
void Profile::setTerminal( int term ) {
m_terminal = term;
}
/* config stuff */
void Profile::clearConf() {
m_conf.clear();
diff --git a/noncore/apps/opie-console/profile.h b/noncore/apps/opie-console/profile.h
index 5652ac5..78fe6ab 100644
--- a/noncore/apps/opie-console/profile.h
+++ b/noncore/apps/opie-console/profile.h
@@ -13,56 +13,59 @@
* Configuration is contained here too
*/
class Profile {
public:
typedef QValueList<Profile> ValueList;
enum Color { Black = 0,
White,
Gray };
enum Terminal {VT102 = 0 };
enum Font { Micro = 0, Small, Medium };
Profile();
Profile( const QString& name,
- const QString& iolayerName,
+ const QCString& iolayerName,
+ const QCString& termName,
int background,
int foreground,
int terminal);
Profile( const Profile& );
Profile &operator=( const Profile& );
bool operator==( const Profile& prof );
~Profile();
QString name()const;
- QString ioLayerName()const;
+ QCString ioLayerName()const;
+ QCString terminalName()const;
int foreground()const;
int background()const;
int terminal()const;
/*
* config stuff
*/
QMap<QString, QString> conf()const;
void clearConf();
void writeEntry( const QString& key, const QString& value );
void writeEntry( const QString& key, int num );
void writeEntry( const QString& key, bool b );
void writeEntry( const QString& key, const QStringList&, const QChar& );
QString readEntry( const QString& key, const QString& deflt = QString::null)const;
int readNumEntry( const QString& key, int = -1 )const;
bool readBoolEntry( const QString& key, bool = FALSE )const;
void setName( const QString& );
- void setIOLayer( const QString& );
+ void setIOLayer( const QCString& );
+ void setTerminalName( const QCString& );
void setBackground( int back );
void setForeground( int fore );
void setTerminal( int term );
void setConf( const QMap<QString, QString>& );
private:
QMap<QString, QString> m_conf;
QString m_name;
- QString m_ioLayer;
+ QCString m_ioLayer, m_term;
int m_back;
int m_fore;
int m_terminal;
};
#endif
diff --git a/noncore/apps/opie-console/profiledialogwidget.cpp b/noncore/apps/opie-console/profiledialogwidget.cpp
new file mode 100644
index 0000000..24d59bf
--- a/dev/null
+++ b/noncore/apps/opie-console/profiledialogwidget.cpp
@@ -0,0 +1,32 @@
+#include "profiledialogwidget.h"
+
+ProfileDialogWidget::ProfileDialogWidget( const QString&, QWidget* parent,
+ const char* name )
+ : QWidget( parent, name ) {
+}
+ProfileDialogWidget::~ProfileDialogWidget() {
+}
+
+ProfileDialogTerminalWidget::ProfileDialogTerminalWidget( const QString& na,
+ QWidget* parent,
+ const char* name )
+ : ProfileDialogWidget( na, parent, name )
+{
+}
+ProfileDialogTerminalWidget::~ProfileDialogTerminalWidget() {
+}
+ProfileDialogWidget::Type ProfileDialogTerminalWidget::type()const {
+ return Terminal;
+}
+
+ProfileDialogConnectionWidget::ProfileDialogConnectionWidget( const QString& na,
+ QWidget* parent,
+ const char* name )
+ : ProfileDialogWidget(na, parent, name )
+{
+}
+ProfileDialogConnectionWidget::~ProfileDialogConnectionWidget() {
+}
+ProfileDialogWidget::Type ProfileDialogConnectionWidget::type()const {
+ return Connection;
+}
diff --git a/noncore/apps/opie-console/profiledialogwidget.h b/noncore/apps/opie-console/profiledialogwidget.h
new file mode 100644
index 0000000..5d279e6
--- a/dev/null
+++ b/noncore/apps/opie-console/profiledialogwidget.h
@@ -0,0 +1,50 @@
+#ifndef OPIE_PROFILE_DIALOG_WIDGET_H
+#define OPIE_PROFILE_DIALOG_WIDGET_H
+
+#include <qwidget.h>
+
+#include "profile.h"
+
+class ProfileDialogWidget : public QWidget {
+ Q_OBJECT
+public:
+ enum Type {
+ Connection,
+ Terminal
+ };
+ ProfileDialogWidget( const QString& name, QWidget* parent, const char* name = 0l);
+ ~ProfileDialogWidget();
+
+ /*
+ * load data from a Profile into
+ * the DialogWidget
+ */
+ virtual void load( const Profile& ) = 0;
+
+ /*
+ * save data into a profile
+ * from the DialogWidget
+ */
+ virtual void save( Profile& ) = 0;
+
+ virtual Type type()const = 0;
+};
+class ProfileDialogTerminalWidget : public ProfileDialogWidget {
+ Q_OBJECT
+public:
+ ProfileDialogTerminalWidget( const QString& name, QWidget* widget,
+ const char* name =0l);
+ ~ProfileDialogTerminalWidget();
+ Type type()const;
+};
+class ProfileDialogConnectionWidget : public ProfileDialogWidget {
+ Q_OBJECT
+public:
+ ProfileDialogConnectionWidget( const QString& name, QWidget* parent,
+ const char* name =0l);
+ ~ProfileDialogConnectionWidget();
+ Type type() const;
+
+};
+
+#endif
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index 3843943..061b1c2 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -1,189 +1,190 @@
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qlabel.h>
+#include <qmessagebox.h>
+#include <qstringlist.h>
+#include <qcombobox.h>
-#include <opie/otabwidget.h>
-#include "profileeditordialog.h"
-#include "qlayout.h"
-#include "qlineedit.h"
-#include "qlabel.h"
-#include "qmessagebox.h"
-#include "qstringlist.h"
-#include "qcombobox.h"
+#include <opie/otabwidget.h>
#include "profileeditorplugins.h"
#include "metafactory.h"
+#include "profileeditordialog.h"
+
+namespace {
+ void setCurrent( const QString& str, QComboBox* bo ) {
+ for (uint i = 0; i < bo->count(); i++ ) {
+ if ( bo->text(i) == str ) {
+ bo->setCurrentItem( i );
+ }
+ }
+ }
+
+
+}
ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact,
const Profile& prof )
: QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof )
{
initUI();
// Apply current profile
// plugin_plugin->load(profile);
// ... (reset profile name line edit etc.)
}
ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
: QDialog(0, 0, TRUE), m_fact( fact )
{
// Default profile
- m_prof = Profile(QString::null, "serial", Profile::Black, Profile::White, Profile::VT102);
+ m_prof = Profile("New Profile", "serial", "default", Profile::Black, Profile::White, Profile::VT102);
initUI();
// Apply current profile
// plugin_plugin->load(profile);
}
Profile ProfileEditorDialog::profile() const
{
return m_prof;
}
void ProfileEditorDialog::initUI()
{
+ m_con = m_term = 0l;
QVBoxLayout *mainLayout = new QVBoxLayout( this );
OTabWidget *tabWidget = new OTabWidget( this );
mainLayout->add(tabWidget);
- QWidget *tabterm, *tabconn, *tabprof;
-
- tabprof = new QWidget(this);
- tabterm = new QWidget(this);
- tabconn = new QWidget(this);
-
- // for the time being: fake factory
-
- m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial);
- m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda);
- m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem);
-
- // profile tab
-
- QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
-
- name_line = new QLineEdit(tabprof);
-
- // connection tab, fixed part
-
- QLabel *device = new QLabel(QObject::tr("Device"), tabconn);
-
- device_box = new QComboBox(tabconn);
-
- QStringList w = m_fact->configWidgets();
- for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
- device_box->insertItem(m_fact->name((*it)));
-
- // connection tab, factory part
- plugin_base = new QWidget(tabconn);
- plugin_layout = new QHBoxLayout(plugin_base, 0);
-
- plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, &m_prof);
- plugin_layout->add(plugin_plugin->widget());
-
- // connection tab, general part
+ QWidget *tabprof;
+
+ /* base tabs */
+ tabprof = new QWidget(this);
+ m_tabTerm = new QWidget(this);
+ m_tabCon = new QWidget(this);
+
+ /* base layout for tabs */
+ m_layCon = new QHBoxLayout( m_tabCon , 2 );
+ m_layTerm = new QHBoxLayout( m_tabTerm, 2 );
+
+ // profile tab
+
+ QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
+ m_name = new QLineEdit(tabprof);
+ QLabel *con = new QLabel(tr("Connection"), tabprof );
+ QLabel *term = new QLabel(tr("Terminal"), tabprof );
+ m_conCmb = new QComboBox( tabprof );
+ m_termCmb = new QComboBox( tabprof );
+
+ // layouting
+ QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
+ vbox3->add(name);
+ vbox3->add(m_name);
+ vbox3->add(con );
+ vbox3->add(m_conCmb );
+ vbox3->add(term );
+ vbox3->add(m_termCmb );
+ vbox3->addStretch(1);
+
+ tabWidget->addTab(tabprof, "", QObject::tr("Profile"));
+ tabWidget->addTab(m_tabCon, "", QObject::tr("Connection"));
+ tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal"));
+ tabWidget->setCurrentTab( tabprof );
+
+
+ // fill the comboboxes
+ QStringList list = m_fact->connectionWidgets();
+ QStringList::Iterator it;
+ for (it =list.begin(); it != list.end(); ++it ) {
+ m_conCmb->insertItem( (*it) );
+ }
+ list = m_fact->terminalWidgets();
+ for (it =list.begin(); it != list.end(); ++it ) {
+ m_termCmb->insertItem( (*it) );
+ }
+
+ // load profile values
+ m_name->setText(m_prof.name());
+ slotConActivated( m_fact->external(m_prof.ioLayerName() ) );
+ slotTermActivated( m_fact->external(m_prof.terminalName() ) );
+ setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb );
+ setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb );
+
+ qWarning("Layer: %s %s", m_prof.ioLayerName().data(),
+ m_fact->external(m_prof.ioLayerName() ).latin1() );
+ qWarning("Term: %s %s", m_prof.terminalName().data(),
+ m_fact->external(m_prof.terminalName() ).latin1() );
+
+ // signal and slots
+ connect(m_conCmb, SIGNAL(activated(const QString& ) ),
+ this, SLOT(slotConActivated(const QString&) ) );
+ connect(m_termCmb, SIGNAL(activated(const QString& ) ),
+ this, SLOT(slotTermActivated(const QString& ) ) );
- QWidget *conn_widget = plugin_plugin->connection_widget();
- conn_widget->reparent(tabconn, 0, QPoint(), true);
-
- // terminal tab
-
- QWidget *term_widget = plugin_plugin->terminal_widget();
- term_widget->reparent(tabterm, 0, QPoint(), true);
-
- // layouting
-
- QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
- vbox3->add(name);
- vbox3->add(name_line);
- vbox3->addStretch(1);
-
- QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2);
- vbox->add(device);
- vbox->add(device_box);
- vbox->add(plugin_base);
- vbox->add(conn_widget);
- vbox->setStretchFactor(device, 1);
- vbox->setStretchFactor(device_box, 1);
- vbox->setStretchFactor(plugin_base, 1);
- vbox->setStretchFactor(conn_widget, 7);
-
- QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2);
- vbox2->add(term_widget);
-
- tabWidget->addTab(tabprof, "", QObject::tr("Profile"));
- tabWidget->addTab(tabconn, "", QObject::tr("Connection"));
- tabWidget->addTab(tabterm, "", QObject::tr("Terminal"));
- tabWidget->setCurrentTab( tabprof );
-
- // load profile values
- name_line->setText(m_prof.name());
- for(int i = 0; i < device_box->count(); i++)
- {
- device_box->setCurrentItem(i);
- if(prof_type() == m_prof.ioLayerName())
- {
- slotDevice(i);
- break;
- }
- }
-
- // signals
- connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int)));
}
ProfileEditorDialog::~ProfileEditorDialog() {
}
-
-void ProfileEditorDialog::slotDevice(int id)
-{
- delete plugin_plugin;
-
- plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, &m_prof);
- plugin_layout->add(plugin_plugin->widget());
-
- // Reload profile associated to device, including e.g. conn_device()
- // m_prof = plugin_plugin->profile()
- // or, keeping the profile name: m_prof->reload(plugin_plugin->profile())
-
- //plugin_plugin->show();
- plugin_plugin->widget()->show();
-}
-
void ProfileEditorDialog::accept()
{
- if(prof_name().isEmpty())
+ if(profName().isEmpty())
{
QMessageBox::information(this,
QObject::tr("Invalid profile"),
QObject::tr("Please enter a profile name."));
return;
}
// Save profile and plugin profile
- if(plugin_plugin) plugin_plugin->save();
+ //if(plugin_plugin) plugin_plugin->save();
// Save general values
- m_prof.setName(prof_name());
- m_prof.setIOLayer(prof_type());
+ m_prof.setName(profName());
+ m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) );
+ m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) );
+ qWarning("Term %s %s", m_fact->internal(m_termCmb->currentText() ).data(),
+ m_termCmb->currentText().latin1() );
QDialog::accept();
}
-QString ProfileEditorDialog::prof_name()
+QString ProfileEditorDialog::profName()const
{
- return name_line->text();
+ return m_name->text();
}
-QString ProfileEditorDialog::prof_type()
+QCString ProfileEditorDialog::profType()const
{
- QStringList w = m_fact->configWidgets();
+ /*QStringList w = m_fact->configWidgets();
for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
if(device_box->currentText() == m_fact->name((*it))) return (*it);
-
- return QString::null;
+ */
+ return QCString();
+}
+/*
+ * we need to switch the widget
+ */
+void ProfileEditorDialog::slotConActivated( const QString& str ) {
+ delete m_con;
+ m_con = m_fact->newConnectionPlugin( str, m_tabCon );
+
+ if (m_con )
+ m_layCon->addWidget( m_con );
+}
+/*
+ * we need to switch the widget
+ */
+void ProfileEditorDialog::slotTermActivated( const QString& str ) {
+ delete m_term;
+ m_term = m_fact->newTerminalPlugin( str, 0l );
+ qWarning("past");
+
+ if (m_term)
+ m_layTerm->addWidget( m_term );
}
-
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h
index 8e830f1..3b67bb3 100644
--- a/noncore/apps/opie-console/profileeditordialog.h
+++ b/noncore/apps/opie-console/profileeditordialog.h
@@ -3,48 +3,49 @@
#include <qdialog.h>
#include "profile.h"
class MetaFactory;
class EditBase;
class QTabWidget;
class QHBoxLayout;
class QLineEdit;
class QComboBox;
class QLabel;
-class ProfileEditorPlugin;
+class ProfileDialogWidget;
class ProfileEditorDialog : public QDialog {
Q_OBJECT
public:
ProfileEditorDialog(MetaFactory* fact,
const Profile& prof );
ProfileEditorDialog(MetaFactory* fact );
- ~ProfileEditorDialog();
+ ~ProfileEditorDialog();
Profile profile()const;
- QString prof_name();
- QString prof_type();
+
public slots:
void accept();
- void slotDevice(int id);
+private slots:
+ void slotConActivated(const QString& );
+ void slotTermActivated( const QString& );
private:
void initUI();
+ QString profName()const;
+ QCString profType()const;
MetaFactory* m_fact;
- EditBase* m_base;
- QTabWidget* m_tab;
QHBoxLayout* m_lay;
Profile m_prof;
- QLineEdit *name_line;
- QComboBox *device_box;
+ QLineEdit *m_name;
+ QComboBox *m_conCmb, *m_termCmb;
- QWidget *plugin_base;
- ProfileEditorPlugin *plugin_plugin;
- QHBoxLayout *plugin_layout;
+ QWidget *m_tabCon, *m_tabTerm;
+ ProfileDialogWidget* m_con, *m_term;
+ QHBoxLayout *m_layCon, *m_layTerm;
};
#endif
diff --git a/noncore/apps/opie-console/profileeditorplugins.h b/noncore/apps/opie-console/profileeditorplugins.h
index 591163a..4ca780e 100644
--- a/noncore/apps/opie-console/profileeditorplugins.h
+++ b/noncore/apps/opie-console/profileeditorplugins.h
@@ -1,93 +1,93 @@
#ifndef PROFILE_EDITOR_PLUGINS_H
#define PROFILE_EDITOR_PLUGINS_H
#include "profile.h"
-#include "qobject.h"
+#include <qobject.h>
class QWidget;
class ProfileEditorPlugin : public QObject
{
- Q_OBJECT
- public:
- ProfileEditorPlugin(QWidget *parent, Profile *p);
-
- virtual ~ProfileEditorPlugin();
-
- virtual void save() = 0;
-
- virtual QWidget *widget() = 0;
-
- QWidget *connection_widget();
- QWidget *terminal_widget();
-
- public slots:
- void slotConnFlow(int id);
- void slotConnParity(int id);
- void slotConnSpeed(int id);
- void slotTermTerm(int id);
- void slotTermColour(int id);
- void slotTermFont(int id);
- void slotTermEcho(bool on);
- void slotTermWrap(bool on);
- void slotTermInbound(bool on);
- void slotTermOutbound(bool on);
-
- protected:
- QWidget *m_parent, *m_widget;
- Profile *m_profile;
-
- private:
- enum ParityIds
- {
- id_parity_odd,
- id_parity_even
- };
-
- enum FlowIds
- {
- id_flow_hw,
- id_flow_sw
- };
-
- enum SpeedIds
- {
- id_baud_115200,
- id_baud_57600,
- id_baud_38400,
- id_baud_19200,
- id_baud_9600
- };
-
- enum TermIds
- {
- id_term_vt100,
- id_term_vt220,
- id_term_ansi
- };
-
- enum ColourIds
- {
- id_term_black,
- id_term_white
- };
-
- enum FontIds
- {
- id_size_small,
- id_size_medium,
- id_size_large
- };
+ Q_OBJECT
+public:
+ ProfileEditorPlugin(QWidget *parent);
+
+ virtual ~ProfileEditorPlugin();
+
+ virtual void save() = 0;
+
+ virtual QWidget *widget() = 0;
+
+ QWidget *connection_widget();
+ QWidget *terminal_widget();
+
+public slots:
+ void slotConnFlow(int id);
+ void slotConnParity(int id);
+ void slotConnSpeed(int id);
+ void slotTermTerm(int id);
+ void slotTermColour(int id);
+ void slotTermFont(int id);
+ void slotTermEcho(bool on);
+ void slotTermWrap(bool on);
+ void slotTermInbound(bool on);
+ void slotTermOutbound(bool on);
+
+protected:
+ QWidget *m_parent, *m_widget;
+ Profile *m_profile;
+
+private:
+ enum ParityIds
+ {
+ id_parity_odd,
+ id_parity_even
+ };
+
+ enum FlowIds
+ {
+ id_flow_hw,
+ id_flow_sw
+ };
+
+ enum SpeedIds
+ {
+ id_baud_115200,
+ id_baud_57600,
+ id_baud_38400,
+ id_baud_19200,
+ id_baud_9600
+ };
+
+ enum TermIds
+ {
+ id_term_vt100,
+ id_term_vt220,
+ id_term_ansi
+ };
+
+ enum ColourIds
+ {
+ id_term_black,
+ id_term_white
+ };
+
+ enum FontIds
+ {
+ id_size_small,
+ id_size_medium,
+ id_size_large
+ };
};
//#ifdef __cplusplus
//extern "C" {
//#endif
ProfileEditorPlugin *factory_serial(QWidget *parent, Profile *p);
ProfileEditorPlugin *factory_irda(QWidget *parent, Profile *p);
ProfileEditorPlugin *factory_modem(QWidget *parent, Profile *p);
//#ifdef __cplusplus
//}
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index 72a5117..6ad08b5 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -19,25 +19,26 @@ void ProfileManager::load() {
ProfileConfig conf("opie-console-profiles");
QStringList groups = conf.groups();
QStringList::Iterator it;
/*
* for each profile
*/
for ( it = groups.begin(); it != groups.end(); ++it ) {
qWarning("group " + (*it) );
conf.setGroup( (*it) );
Profile prof;
prof.setName( conf.readEntry("name") );
- prof.setIOLayer( conf.readEntry("iolayer") );
+ prof.setIOLayer( conf.readEntry("iolayer").utf8() );
+ prof.setTerminalName( conf.readEntry("term").utf8() );
prof.setBackground( conf.readNumEntry("back") );
prof.setForeground( conf.readNumEntry("fore") );
prof.setTerminal( conf.readNumEntry("terminal") );
prof.setConf( conf.items( (*it) ) );
/* now add it */
m_list.append( prof );
}
}
void ProfileManager::clear() {
m_list.clear();
@@ -56,25 +57,26 @@ Session* ProfileManager::fromProfile( const Profile& prof) {
* load widget?
* set colors + fonts
*/
return session;
}
void ProfileManager::save( ) {
ProfileConfig conf("opie-console-profiles");
conf.clearAll();
Profile::ValueList::Iterator it;
for (it = m_list.begin(); it != m_list.end(); ++it ) {
conf.setGroup( (*it).name() );
conf.writeEntry( "name", (*it).name() );
- conf.writeEntry( "ioplayer", (*it).ioLayerName() );
+ conf.writeEntry( "ioplayer", QString::fromUtf8( (*it).ioLayerName() ) );
+ conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) );
conf.writeEntry( "back", (*it).background() );
conf.writeEntry( "fore", (*it).foreground() );
conf.writeEntry( "terminal", (*it).terminal() );
/* now the config stuff */
QMap<QString, QString> map = (*it).conf();
QMap<QString, QString>::Iterator it;
for ( it = map.begin(); it != map.end(); ++it ) {
conf.writeEntry( it.key(), it.data() );
}
}
}
void ProfileManager::setProfiles( const Profile::ValueList& list ) {
diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp
index de321ae..10f3f7a 100644
--- a/noncore/apps/opie-console/sz_transfer.cpp
+++ b/noncore/apps/opie-console/sz_transfer.cpp
@@ -1,18 +1,18 @@
#include "sz_transfer.h"
#include <qfile.h>
#include <opie/oprocess.h>
-SzTransfer::SzTransfer(IOLayer *layer) : FileTransferLayer(layer)
+SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t)
{
}
SzTransfer::~SzTransfer() {
}
void SzTransfer::sendFile(const QFile& file) {
sendFile(file.name());
}
void SzTransfer::sendFile(const QString& file) {
diff --git a/noncore/apps/opie-console/sz_transfer.h b/noncore/apps/opie-console/sz_transfer.h
index 778d1d3..825680d 100644
--- a/noncore/apps/opie-console/sz_transfer.h
+++ b/noncore/apps/opie-console/sz_transfer.h
@@ -1,33 +1,39 @@
#ifndef OPIE_FL_SZ_H
#define OPIE_FL_SZ_H
#include "file_layer.h"
#include <opie/oprocess.h>
class SzTransfer : public FileTransferLayer {
Q_OBJECT
public:
+ enum Type {
+ SZ=0,
+ SX,
+ SY
+ };
- SzTransfer( IOLayer * );
+ SzTransfer( Type t, IOLayer * );
~SzTransfer();
public slots:
/**
* send a file over the layer
*/
- void sendFile( const QString& file ) = 0;
- void sendFile( const QFile& ) = 0;
+ void sendFile( const QString& file ) ;
+ void sendFile( const QFile& );
private slots:
void SzRecievedStdout(OProcess *, char *, int);
void SzRecievedStderr(OProcess *, char *, int);
void recievedStdin(QByteArray &);
private:
OProcess *proc;
+ Type m_t;
};
#endif