22 #include "configguignokii.h"
24 #include <tdelocale.h>
26 #include <kcombobox.h>
32 #include <tqlineedit.h>
33 #include <tqcombobox.h>
37 ConfigGuiGnokii::ConfigGuiGnokii(
const QSync::Member &member, TQWidget *parent )
38 : ConfigGui( member, parent )
40 TQGridLayout *layout =
new TQGridLayout( topLayout() );
43 TQLabel *label =
new TQLabel( i18n(
"Model:"),
this );
44 layout->addWidget( label, 0, 0 );
46 mModel =
new KComboBox(
true,
this );
47 layout->addWidget( mModel, 0, 1 );
48 mModel->insertItem(
"2110" );
49 mModel->insertItem(
"3110" );
50 mModel->insertItem(
"6110" );
51 mModel->insertItem(
"6110" );
52 mModel->insertItem(
"6160" );
53 mModel->insertItem(
"6230" );
54 mModel->insertItem(
"6230i" );
55 mModel->insertItem(
"6510" );
56 mModel->insertItem(
"7110" );
57 mModel->insertItem(
"AT" );
59 mModel->insertItem(
"3650" );
60 mModel->insertItem(
"6600" );
61 mModel->insertItem(
"gnapplet" );
62 mModel->insertItem(
"symbian" );
63 mModel->insertItem(
"sx1" );
65 connect( mModel, TQT_SIGNAL (activated(
int ) ),
66 this, TQT_SLOT( slotModelChanged () ) );
69 label =
new TQLabel( i18n(
"Connection:"),
this );
70 layout->addWidget( label, 1, 0 );
72 mConnection =
new TQComboBox(
this );
73 layout->addWidget( mConnection, 1, 1 );
75 connect( mConnection, TQT_SIGNAL (activated(
int ) ),
76 this, TQT_SLOT( slotConnectionChanged (
int ) ) );
79 mConnectionTypes.append( ConnectionType(
"bluetooth", i18n(
"Bluetooth" ) ) );
80 mConnectionTypes.append( ConnectionType(
"irda", i18n(
"IrDA" ) ) );
81 mConnectionTypes.append( ConnectionType(
"serial", i18n(
"Serial" ) ) );
82 mConnectionTypes.append( ConnectionType(
"infrared", i18n(
"Infrared" ) ) );
83 mConnectionTypes.append( ConnectionType(
"tcp", i18n(
"TCP" ) ) );
84 mConnectionTypes.append( ConnectionType(
"dku2", i18n(
"USB (nokia_dku2)" ) ) );
85 mConnectionTypes.append( ConnectionType(
"dku2libusb", i18n(
"USB (libusb)" ) ) );
86 mConnectionTypes.append( ConnectionType(
"dau9p", i18n(
"Serial (DAU9P cable)" ) ) );
87 mConnectionTypes.append( ConnectionType(
"dlr3p", i18n(
"Serial (DLR3P cable)" ) ) );
88 mConnectionTypes.append( ConnectionType(
"tekram", i18n(
"Tekram Ir-Dongle" ) ) );
89 mConnectionTypes.append( ConnectionType(
"m2bus", i18n(
"Serial (M2BUS protocol)" ) ) );
91 ConnectionTypeList::ConstIterator it;
92 for ( it = mConnectionTypes.begin(); it != mConnectionTypes.end(); it++ ) {
93 mConnection->insertItem( (*it).second );
96 TQVBox *connectionWidget =
new TQVBox(
this );
97 connectionWidget->setMargin( KDialog::marginHint() );
98 connectionWidget->setSpacing( 5 );
100 mBluetooth =
new BluetoothWidget( connectionWidget );
103 layout->addMultiCellWidget( connectionWidget, 2, 2, 0, 1 );
106 mPortLabel =
new TQLabel( i18n(
"Port:"),
this );
107 layout->addWidget( mPortLabel, 2, 0 );
110 mPort =
new KComboBox(
true,
this );
111 layout->addWidget( mPort, 2, 1 );
114 mPort->insertItem(
"/dev/ircomm0" );
115 mPort->insertItem(
"/dev/ircomm1" );
116 mPort->insertItem(
"/dev/ttyS0" );
117 mPort->insertItem(
"/dev/ttyS1" );
118 mPort->insertItem(
"/dev/ttyUSB0" );
119 mPort->insertItem(
"/dev/ttyUSB1" );
121 layout->setColStretch( 1, 1 );
123 topLayout()->addStretch( 1 );
126 void ConfigGuiGnokii::slotConnectionChanged(
int nth )
137 if ( !mPort->currentText().isEmpty() )
138 mBluetooth->setAddress( mPort->currentText() );
141 }
else if ( nth == 6 ) {
150 void ConfigGuiGnokii::slotModelChanged()
152 mBluetooth->hideChannel();
154 if ( mModel->currentText() ==
"gnapplet"
155 || mModel->currentText() ==
"symbian"
156 || mModel->currentText() ==
"3650"
157 || mModel->currentText() ==
"6600"
158 || mModel->currentText() ==
"sx1")
159 mBluetooth->showChannel();
161 mBluetooth->setChannel(
"");
164 void ConfigGuiGnokii::load(
const TQString &xml )
167 doc.setContent( xml );
168 TQDomElement docElement = doc.documentElement();
170 for( n = docElement.firstChild(); !n.isNull(); n = n.nextSibling() ) {
171 TQDomElement e = n.toElement();
172 if ( e.tagName() ==
"connection" ) {
173 for ( uint i = 0; i < mConnectionTypes.count(); i++ ) {
174 if ( mConnectionTypes[i].first == e.text()) {
175 mConnection->setCurrentItem( i );
176 slotConnectionChanged( i );
180 }
else if ( e.tagName() ==
"port" ) {
181 mPort->setCurrentText( e.text() );
182 }
else if ( e.tagName() ==
"model" ) {
183 mModel->setCurrentText( e.text() );
184 }
else if ( e.tagName() ==
"rfcomm_channel" ) {
185 mBluetooth->setChannel( e.text() );
186 mBluetooth->showChannel();
191 TQString ConfigGuiGnokii::save()
const
196 ConnectionTypeList::ConstIterator it;
197 for ( it = mConnectionTypes.begin(); it != mConnectionTypes.end(); it++ ) {
198 if ( mConnection->currentText() == (*it).second ) {
199 xml +=
"<connection>" + (*it).first +
"</connection>";
204 if ( (*it).first ==
"bluetooth" )
205 xml +=
"<port>" + mBluetooth->address() +
"</port>";
206 else if ( (*it).first ==
"dku2libusb" )
207 xml +=
"<port>" + TQString(
"FF:FF:FF:FF:FF:FF") +
"</port>";
209 xml +=
"<port>" + mPort->currentText() +
"</port>";
212 xml +=
"<model>" + mModel->currentText() +
"</model>";
215 if ( !mBluetooth->channel().isNull() )
216 xml +=
"<rfcomm_channel>" + mBluetooth->channel() +
"</rfcomm_channel>";
223 #include "configguignokii.moc"