summaryrefslogtreecommitdiff
path: root/noncore
authorjosef <josef>2002-10-07 14:25:13 (UTC)
committer josef <josef>2002-10-07 14:25:13 (UTC)
commitadd436706a938a71a487db019dcd6ff236207bfc (patch) (side-by-side diff)
treee774574de70c95f872ba190a502846c0f0bf5130 /noncore
parentfa8df8b9d316f15bc089df5bde7eafb2ef10b36d (diff)
downloadopie-add436706a938a71a487db019dcd6ff236207bfc.zip
opie-add436706a938a71a487db019dcd6ff236207bfc.tar.gz
opie-add436706a938a71a487db019dcd6ff236207bfc.tar.bz2
- first cleanups
- basic load/save works now, but none of the standard widget options is remembered?
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/metafactory.cpp2
-rw-r--r--noncore/apps/opie-console/metafactory.h4
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp14
-rw-r--r--noncore/apps/opie-console/profileeditorplugins.cpp102
-rw-r--r--noncore/apps/opie-console/profileeditorplugins.h10
5 files changed, 73 insertions, 59 deletions
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp
index c5e614d..b69d6da 100644
--- a/noncore/apps/opie-console/metafactory.cpp
+++ b/noncore/apps/opie-console/metafactory.cpp
@@ -60,7 +60,7 @@ IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) {
return lay;
}
-ProfileEditorPlugin *MetaFactory::newConfigPlugin ( const QString& str, QWidget *parent, const Profile& prof) {
+ProfileEditorPlugin *MetaFactory::newConfigPlugin ( const QString& str, QWidget *parent, Profile *prof) {
ProfileEditorPlugin *p = NULL;
configWidget c;
diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h
index 8c714b3..216de03 100644
--- a/noncore/apps/opie-console/metafactory.h
+++ b/noncore/apps/opie-console/metafactory.h
@@ -18,7 +18,7 @@
class MetaFactory {
public:
- typedef ProfileEditorPlugin* (*configWidget)(QWidget* parent, const Profile&);
+ typedef ProfileEditorPlugin* (*configWidget)(QWidget* parent, Profile* prof);
typedef IOLayer* (*iolayer)(const Profile& );
typedef FileTransferLayer* (*filelayer)(IOLayer*);
@@ -36,7 +36,7 @@ public:
QStringList configWidgets()const;
QStringList fileTransferLayers()const;
IOLayer* newIOLayer( const QString&,const Profile& );
- ProfileEditorPlugin *newConfigPlugin ( const QString&, QWidget*, const Profile& );
+ ProfileEditorPlugin *newConfigPlugin ( const QString&, QWidget*, Profile* );
QString name( const QString& );
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index d98e589..8e63429 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -73,7 +73,7 @@ void ProfileEditorDialog::initUI()
plugin_base = new QWidget(tabconn);
plugin_layout = new QHBoxLayout(plugin_base, 0);
- plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, m_prof);
+ plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, &m_prof);
plugin_layout->add(plugin_plugin->widget());
// connection tab, general part
@@ -112,6 +112,15 @@ void ProfileEditorDialog::initUI()
// 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
@@ -127,7 +136,7 @@ void ProfileEditorDialog::slotDevice(int id)
{
delete plugin_plugin;
- plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, m_prof);
+ 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()
@@ -152,6 +161,7 @@ void ProfileEditorDialog::accept()
// Save general values
m_prof.setName(prof_name());
+ m_prof.setIOLayer(prof_type());
QDialog::accept();
}
diff --git a/noncore/apps/opie-console/profileeditorplugins.cpp b/noncore/apps/opie-console/profileeditorplugins.cpp
index 32e8235..a0bcab8 100644
--- a/noncore/apps/opie-console/profileeditorplugins.cpp
+++ b/noncore/apps/opie-console/profileeditorplugins.cpp
@@ -15,7 +15,7 @@
// Base class
-ProfileEditorPlugin::ProfileEditorPlugin(QWidget *parent, Profile p)
+ProfileEditorPlugin::ProfileEditorPlugin(QWidget *parent, Profile *p)
{
m_parent = parent;
m_profile = p;
@@ -76,9 +76,10 @@ QWidget *ProfileEditorPlugin::connection_widget()
hbox2->add(parity_even);
// Apply profile settings
- int rad_flow = m_profile.readNumEntry("Flow");
- int rad_parity = m_profile.readNumEntry("Parity");
- int speed = m_profile.readNumEntry("Speed");
+
+ int rad_flow = m_profile->readNumEntry("Flow");
+ int rad_parity = m_profile->readNumEntry("Parity");
+ int speed = m_profile->readNumEntry("Speed");
if(rad_flow == IOSerial::FlowHW) flow_hw->setChecked(true);
else flow_sw->setChecked(true);
@@ -160,13 +161,14 @@ QWidget *ProfileEditorPlugin::terminal_widget()
hbox3->add(option_echo);
// Apply profile settings
- int term = m_profile.readNumEntry("Terminal");
- int colour = m_profile.readNumEntry("Colour");
- int fontsize = m_profile.readNumEntry("Font");
- int opt_echo = m_profile.readNumEntry("Echo");
- int opt_wrap = m_profile.readNumEntry("Wrap");
- int opt_inbound = m_profile.readNumEntry("Inbound");
- int opt_outbound = m_profile.readNumEntry("Outbound");
+
+ int term = m_profile->readNumEntry("Terminal");
+ int colour = m_profile->readNumEntry("Colour");
+ int fontsize = m_profile->readNumEntry("Font");
+ int opt_echo = m_profile->readNumEntry("Echo");
+ int opt_wrap = m_profile->readNumEntry("Wrap");
+ int opt_inbound = m_profile->readNumEntry("Inbound");
+ int opt_outbound = m_profile->readNumEntry("Outbound");
if(term == Profile::VT102) terminal_box->setCurrentItem(id_term_vt100);
@@ -201,10 +203,10 @@ void ProfileEditorPlugin::slotConnFlow(int id)
switch(id)
{
case id_flow_hw:
- m_profile.writeEntry("Flow", IOSerial::FlowHW);
+ m_profile->writeEntry("Flow", IOSerial::FlowHW);
break;
case id_flow_sw:
- m_profile.writeEntry("Flow", IOSerial::FlowSW);
+ m_profile->writeEntry("Flow", IOSerial::FlowSW);
break;
}
}
@@ -214,10 +216,10 @@ void ProfileEditorPlugin::slotConnParity(int id)
switch(id)
{
case id_parity_odd:
- m_profile.writeEntry("Parity", IOSerial::ParityEven);
+ m_profile->writeEntry("Parity", IOSerial::ParityEven);
break;
case id_parity_even:
- m_profile.writeEntry("Parity", IOSerial::ParityOdd);
+ m_profile->writeEntry("Parity", IOSerial::ParityOdd);
break;
}
}
@@ -228,19 +230,19 @@ void ProfileEditorPlugin::slotConnSpeed(int id)
{
case id_baud_115200:
- m_profile.writeEntry("Speed", 115200);
+ m_profile->writeEntry("Speed", 115200);
break;
case id_baud_57600:
- m_profile.writeEntry("Speed", 57600);
+ m_profile->writeEntry("Speed", 57600);
break;
case id_baud_38400:
- m_profile.writeEntry("Speed", 38400);
+ m_profile->writeEntry("Speed", 38400);
break;
case id_baud_19200:
- m_profile.writeEntry("Speed", 19200);
+ m_profile->writeEntry("Speed", 19200);
break;
case id_baud_9600:
- m_profile.writeEntry("Speed", 9600);
+ m_profile->writeEntry("Speed", 9600);
break;
}
}
@@ -250,13 +252,13 @@ void ProfileEditorPlugin::slotTermTerm(int id)
switch(id)
{
case id_term_vt100:
- m_profile.writeEntry("Terminal", Profile::VT102);
+ m_profile->writeEntry("Terminal", Profile::VT102);
break;
case id_term_vt220:
- m_profile.writeEntry("Terminal", Profile::VT102);
+ m_profile->writeEntry("Terminal", Profile::VT102);
break;
case id_term_ansi:
- m_profile.writeEntry("Terminal", Profile::VT102);
+ m_profile->writeEntry("Terminal", Profile::VT102);
break;
}
}
@@ -266,10 +268,10 @@ void ProfileEditorPlugin::slotTermColour(int id)
switch(id)
{
case id_term_black:
- m_profile.writeEntry("Colour", Profile::Black);
+ m_profile->writeEntry("Colour", Profile::Black);
break;
case id_term_white:
- m_profile.writeEntry("Colour", Profile::White);
+ m_profile->writeEntry("Colour", Profile::White);
break;
}
}
@@ -279,35 +281,35 @@ void ProfileEditorPlugin::slotTermFont(int id)
switch(id)
{
case id_size_small:
- m_profile.writeEntry("Font", Profile::Micro);
+ m_profile->writeEntry("Font", Profile::Micro);
break;
case id_size_medium:
- m_profile.writeEntry("Font", Profile::Small);
+ m_profile->writeEntry("Font", Profile::Small);
break;
case id_size_large:
- m_profile.writeEntry("Font", Profile::Medium);
+ m_profile->writeEntry("Font", Profile::Medium);
break;
}
}
void ProfileEditorPlugin::slotTermEcho(bool on)
{
- m_profile.writeEntry("Echo", on ? 1 : 0);
+ m_profile->writeEntry("Echo", on ? 1 : 0);
}
void ProfileEditorPlugin::slotTermWrap(bool on)
{
- m_profile.writeEntry("Wrap", on ? 1 : 0);
+ m_profile->writeEntry("Wrap", on ? 1 : 0);
}
void ProfileEditorPlugin::slotTermInbound(bool on)
{
- m_profile.writeEntry("Inbound", on ? 1 : 0);
+ m_profile->writeEntry("Inbound", on ? 1 : 0);
}
void ProfileEditorPlugin::slotTermOutbound(bool on)
{
- m_profile.writeEntry("Outbound", on ? 1 : 0);
+ m_profile->writeEntry("Outbound", on ? 1 : 0);
}
// Inherited classes
@@ -316,7 +318,7 @@ class ProfileEditorPluginSerial : public ProfileEditorPlugin
{
public:
- ProfileEditorPluginSerial(QWidget *parent, Profile p)
+ ProfileEditorPluginSerial(QWidget *parent, Profile *p)
: ProfileEditorPlugin(parent, p)
{
}
@@ -343,7 +345,9 @@ class ProfileEditorPluginSerial : public ProfileEditorPlugin
m_widget = device_frame;
// Load special settings
- device_line->setText(m_profile.readEntry("Device"));
+
+ QString dev = m_profile->readEntry("Device");
+ if(!dev.isNull()) device_line->setText(dev);
}
return m_widget;
@@ -352,8 +356,7 @@ class ProfileEditorPluginSerial : public ProfileEditorPlugin
void save()
{
// special settings
- Profile p = m_profile;
- p.writeEntry("Device", device_line->text());
+ m_profile->writeEntry("Device", device_line->text());
}
private:
@@ -364,7 +367,7 @@ class ProfileEditorPluginIrda : public ProfileEditorPlugin
{
public:
- ProfileEditorPluginIrda(QWidget *parent, Profile p)
+ ProfileEditorPluginIrda(QWidget *parent, Profile *p)
: ProfileEditorPlugin(parent, p)
{
}
@@ -391,7 +394,8 @@ class ProfileEditorPluginIrda : public ProfileEditorPlugin
m_widget = device_frame;
// Load special settings
- device_line->setText(m_profile.readEntry("Device"));
+ QString dev = m_profile->readEntry("Device");
+ if(!dev.isNull()) device_line->setText(dev);
}
return m_widget;
@@ -400,8 +404,7 @@ class ProfileEditorPluginIrda : public ProfileEditorPlugin
void save()
{
// special settings
- Profile p = m_profile;
- p.writeEntry("Device", device_line->text());
+ m_profile->writeEntry("Device", device_line->text());
}
private:
@@ -412,7 +415,7 @@ class ProfileEditorPluginModem : public ProfileEditorPlugin
{
public:
- ProfileEditorPluginModem(QWidget *parent, Profile p)
+ ProfileEditorPluginModem(QWidget *parent, Profile *p)
: ProfileEditorPlugin(parent, p)
{
}
@@ -443,8 +446,10 @@ class ProfileEditorPluginModem : public ProfileEditorPlugin
m_widget = device_frame;
// Load special settings
- device_line->setText(m_profile.readEntry("Device"));
- number_line->setText(m_profile.readEntry("Number"));
+ QString dev = m_profile->readEntry("Device");
+ QString num = m_profile->readEntry("Number");
+ if(!dev.isNull()) device_line->setText(dev);
+ number_line->setText(num);
}
return m_widget;
@@ -453,26 +458,25 @@ class ProfileEditorPluginModem : public ProfileEditorPlugin
void save()
{
// special settings
- Profile p = m_profile;
- p.writeEntry("Device", device_line->text());
- p.writeEntry("Number", number_line->text());
+ m_profile->writeEntry("Device", device_line->text());
+ m_profile->writeEntry("Number", number_line->text());
}
private:
QLineEdit *device_line, *number_line;
};
-ProfileEditorPlugin *factory_serial(QWidget *parent, const Profile& p)
+ProfileEditorPlugin *factory_serial(QWidget *parent, Profile *p)
{
return new ProfileEditorPluginSerial(parent, p);
}
-ProfileEditorPlugin *factory_irda(QWidget *parent, const Profile& p)
+ProfileEditorPlugin *factory_irda(QWidget *parent, Profile *p)
{
return new ProfileEditorPluginIrda(parent, p);
}
-ProfileEditorPlugin *factory_modem(QWidget *parent, const Profile& p)
+ProfileEditorPlugin *factory_modem(QWidget *parent, Profile *p)
{
return new ProfileEditorPluginModem(parent, p);
}
diff --git a/noncore/apps/opie-console/profileeditorplugins.h b/noncore/apps/opie-console/profileeditorplugins.h
index caec7ba..591163a 100644
--- a/noncore/apps/opie-console/profileeditorplugins.h
+++ b/noncore/apps/opie-console/profileeditorplugins.h
@@ -11,7 +11,7 @@ class ProfileEditorPlugin : public QObject
{
Q_OBJECT
public:
- ProfileEditorPlugin(QWidget *parent, Profile p);
+ ProfileEditorPlugin(QWidget *parent, Profile *p);
virtual ~ProfileEditorPlugin();
@@ -36,7 +36,7 @@ class ProfileEditorPlugin : public QObject
protected:
QWidget *m_parent, *m_widget;
- Profile m_profile;
+ Profile *m_profile;
private:
enum ParityIds
@@ -85,9 +85,9 @@ class ProfileEditorPlugin : public QObject
//extern "C" {
//#endif
-ProfileEditorPlugin *factory_serial(QWidget *parent, const Profile& p);
-ProfileEditorPlugin *factory_irda(QWidget *parent, const Profile& p);
-ProfileEditorPlugin *factory_modem(QWidget *parent, const Profile& p);
+ProfileEditorPlugin *factory_serial(QWidget *parent, Profile *p);
+ProfileEditorPlugin *factory_irda(QWidget *parent, Profile *p);
+ProfileEditorPlugin *factory_modem(QWidget *parent, Profile *p);
//#ifdef __cplusplus
//}