summaryrefslogtreecommitdiff
path: root/core/applets/irdaapplet/irda.cpp
authorzecke <zecke>2003-02-16 15:49:02 (UTC)
committer zecke <zecke>2003-02-16 15:49:02 (UTC)
commit30a098530260176ac20d75ba6cb7abfb3d998c13 (patch) (side-by-side diff)
treeee5c08ca67fa00574414153921ab2de654c60421 /core/applets/irdaapplet/irda.cpp
parent7fab90d46144843d32e476ada8d0a5f40f50aa60 (diff)
downloadopie-30a098530260176ac20d75ba6cb7abfb3d998c13.zip
opie-30a098530260176ac20d75ba6cb7abfb3d998c13.tar.gz
opie-30a098530260176ac20d75ba6cb7abfb3d998c13.tar.bz2
disable snd in IrDaApplet it hangs on my machine..
Remove the hacky OBEX Implementation Add a more cleaned up more appealing (not yet working) version which will even be able to do OBEX over Bluetooth in the future -It handles receive better let's you choose what to do with custom files and created a DocLnk -Send lets you beam to multiple devices this needs the IrDa Applet to be present
Diffstat (limited to 'core/applets/irdaapplet/irda.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/irdaapplet/irda.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp
index 84c656f..a5b4bfc 100644
--- a/core/applets/irdaapplet/irda.cpp
+++ b/core/applets/irdaapplet/irda.cpp
@@ -131,139 +131,139 @@ bool IrdaApplet::setIrdaStatus ( bool b )
if ( ::ioctl ( m_sockfd, SIOCSIFFLAGS, &ifr ) < 0 )
return false;
return true;
}
bool IrdaApplet::checkIrdaDiscoveryStatus ( )
{
QFile discovery ( "/proc/sys/net/irda/discovery" );
QString streamIn = "0";
if ( discovery. open ( IO_ReadOnly )) {
QTextStream stream ( &discovery );
streamIn = stream. read ( );
}
return streamIn. toInt ( ) > 0;
}
bool IrdaApplet::setIrdaDiscoveryStatus ( bool d )
{
QFile discovery ( "/proc/sys/net/irda/discovery" );
if ( discovery. open ( IO_WriteOnly | IO_Raw )) {
discovery.putch ( d ? '1' : '0' );
return true;
}
return false;
}
bool IrdaApplet::setIrdaReceiveStatus ( bool d )
{
QCopEnvelope e ( "QPE/Obex", "receive(int)" );
e << ( d ? 1 : 0 );
m_receive_active = d;
m_receive_state_changed = true;
return true;
}
void IrdaApplet::showDiscovered ( )
{
- static Sound snd_found ( "irdaapplet/irdaon" );
- static Sound snd_lost ( "irdaapplet/irdaoff" );
+// static Sound snd_found ( "irdaapplet/irdaon" );
+// static Sound snd_lost ( "irdaapplet/irdaoff" );
QFile discovery ( "/proc/net/irda/discovery" );
if ( discovery. open ( IO_ReadOnly )) {
bool qcopsend = false;
QString discoveredDevice;
QString deviceAddr;
// since it is /proc we _must_ use QTextStream
QStringList list = QStringList::split ( "\n", QTextStream ( &discovery ). read ( ));
QMap <QString, QString>::Iterator it;
for ( it = m_devices. begin ( ); it != m_devices. end ( ); ++it )
it. data ( ). prepend ( "+++" );
for ( QStringList::Iterator lit = list. begin ( ); lit != list. end ( ); ++lit ) {
const QString &line = *lit;
if ( line. startsWith ( "nickname:" )) {
discoveredDevice = line. mid ( line. find ( ':' ) + 2, line. find ( ',' ) - line. find ( ':' ) - 2 );
deviceAddr = line. mid ( line. find ( "daddr:" ) + 9, 8 );
// qDebug(discoveredDevice + "(" + deviceAddr + ")");
if ( !m_devices. contains ( deviceAddr )) {
popup ( tr( "Found:" ) + " " + discoveredDevice );
- snd_found. play ( );
+ //snd_found. play ( );
qcopsend = true;
}
m_devices. replace ( deviceAddr, discoveredDevice );
}
}
for ( it = m_devices. begin ( ); it != m_devices. end ( ); ) {
// qDebug("IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?");
if ( it. data ( ). left ( 3 ) == "+++" ) {
popup ( tr( "Lost:" ) + " " + it. data ( ). mid ( 3 ));
- snd_lost. play ( );
+ //snd_lost. play ( );
QMap <QString, QString>::Iterator tmp = it;
tmp++;
m_devices. remove ( it ); // in contrast to QValueListIterator this remove doesn't return the next Iterator
it = tmp;
qcopsend = true;
}
else
it++;
}
// XXX if( qcopsend ) {
QCopEnvelope e ( "QPE/Network", "irdaSend(bool)" );
e << ( m_devices. count ( ) > 0 );
// }
}
}
void IrdaApplet::mousePressEvent ( QMouseEvent * )
{
QPopupMenu *menu = new QPopupMenu ( this );
QString cmd;
/* Refresh active state */
timerEvent ( 0 );
// menu->insertItem( tr("More..."), 4 );
if ( m_irda_active && !m_devices. isEmpty ( )) {
menu-> insertItem ( tr( "Discovered Device:" ), 9 );
for ( QMap<QString, QString>::Iterator it = m_devices. begin ( ); it != m_devices. end ( ); ++it )
menu-> insertItem ( *it );
menu-> insertSeparator ( );
}
menu-> insertItem ( m_irda_active ? tr( "Disable IrDA" ) : tr( "Enable IrDA" ), 0 );
if ( m_irda_active ) {
menu-> insertItem ( m_irda_discovery_active ? tr( "Disable Discovery" ) : tr( "Enable Discovery" ), 1 );
menu-> insertItem ( m_receive_active ? tr( "Disable Receive" ) : tr( "Enable Receive" ), 2 );
}
QPoint p = mapToGlobal ( QPoint ( 0, 0 ) );
QSize s = menu-> sizeHint ( );
p = QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( ));