summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 0385cb1..3e7e2ab 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -119,196 +119,197 @@ namespace OpieTooth {
void BlueBase::writeConfig() {
Config cfg( "bluetoothmanager" );
cfg.setGroup( "bluezsettings" );
cfg.writeEntry( "name" , deviceName );
cfg.writeEntryCrypt( "passkey" , defaultPasskey );
cfg.writeEntry( "useEncryption" , useEncryption );
cfg.writeEntry( "enableAuthentification" , enableAuthentification );
cfg.writeEntry( "enablePagescan" , enablePagescan );
cfg.writeEntry( "enableInquiryscan" , enableInquiryscan );
writeToHciConfig();
}
void BlueBase::writeToHciConfig() {
HciConfWrapper *hciconf = new HciConfWrapper( "/tmp/hcid.conf" );
hciconf->setPinHelper( "/bin/QtPalmtop/bin/blue-pin" );
// hciconf->setPinHelper( "/bin/QtPalmtop/bin/blue-pin" );
hciconf->setName( deviceName );
if ( useEncryption == 1) {
hciconf->setEncrypt( true );
} else {
hciconf->setEncrypt( false );
}
if ( enableAuthentification == 1) {
hciconf->setAuth( true );
} else {
hciconf->setAuth( false );
}
if ( enablePagescan == 1) {
hciconf->setPscan( true );
} else {
hciconf->setPscan( false );
}
if ( enableInquiryscan == 1) {
hciconf->setIscan( true );
} else {
hciconf->setIscan( false );
}
delete hciconf;
}
/**
* Read the list of allready known devices
*
*/
void BlueBase::readSavedDevices() {
QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>;
QDir deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/");
// list of .conf files
QStringList devicesFileList = deviceListSave.entryList();
// cut .conf of to get the mac and also read the name entry in it.
for ( QStringList::Iterator it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) {
QString name;
QString mac;
qDebug((*it).latin1() );
Config conf((*it));
conf.setGroup("Info");
name = conf.readEntry("name", "Error");
qDebug("MAC: " + mac);
qDebug("NAME: " + name);
RemoteDevice currentDevice = RemoteDevice( mac , name );
loadedDevices->append( &currentDevice );
}
addSearchedDevices( *loadedDevices );
}
/**
* Write the list of allready known devices
*
*/
void BlueBase::writeSavedDevices() {
QListViewItemIterator it( ListView2 );
for ( ; it.current(); ++it ) {
// seperate config file for each device, to store more information in future.
// TO FIX: BTLISTITEM!!!
+ qDebug( "/Settings/bluetooth/" + (((BTListItem*)it.current())->mac()) + ".conf");
+ Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (((BTListItem*)it.current())->mac()) + ".conf", Config::File );
- // Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (((BTListItem)it.current())->mac()) + ".conf", Config::File );
- // conf.setGroup( "Info" );
- // conf.writeEntry( "name", it.current()->name() );
+ conf.setGroup( "Info" );
+ conf.writeEntry( "name", ((BTListItem*)it.current())->name() );
}
}
/**
* Set up the gui
*/
void BlueBase::initGui() {
StatusLabel->setText( getStatus() ); // maybe move it to getStatus()
cryptCheckBox->setChecked( useEncryption );
authCheckBox->setChecked( enableAuthentification );
pagescanCheckBox->setChecked( enablePagescan );
inquiryscanCheckBox->setChecked( enableInquiryscan );
deviceNameLine->setText( deviceName );
passkeyLine->setText( defaultPasskey );
// set info tab
setInfo();
}
/**
* Get the status informations and returns it
* @return QString the status informations gathered
*/
QString BlueBase::getStatus(){
QString infoString = tr( "<b>Device name : </b> Ipaq" );
infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" );
infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
return (infoString);
}
/**
* Read the current values from the gui and invoke writeConfig()
*/
void BlueBase::applyConfigChanges() {
deviceName = deviceNameLine->text();
defaultPasskey = passkeyLine->text();
useEncryption = cryptCheckBox->isChecked();
enableAuthentification = authCheckBox->isChecked();
enablePagescan = pagescanCheckBox->isChecked();
enableInquiryscan = inquiryscanCheckBox->isChecked();
writeConfig();
QMessageBox* box = new QMessageBox( this, "Test" );
box->setText( tr( "Changes applied" ) );
box->show();
// falls nötig hcid killhupen - die funktionalität adden
}
/**
* Add fresh found devices from scan dialog to the listing
*
*/
void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) {
BTListItem * deviceItem;
QListIterator<RemoteDevice> it( newDevices );
for( ; it.current() ; ++it ) {
RemoteDevice *dev = it.current();
deviceItem = new BTListItem( ListView2 , dev->name(), dev->mac(), "device" );
deviceItem->setExpandable ( true );
// look if device is avail. atm, async
deviceActive( dev );
// move into the c'tor
// deviceItem->setMac( dev->mac() );
// what kind of entry is it.
//deviceItem->setType( "device");
// ggf auch hier?
addServicesToDevice( deviceItem );
}
}
/**
* Action that is toggled on entrys on click
*/
void BlueBase::startServiceActionClicked( QListViewItem *item ) {
}