summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-06-24 21:05:01 (UTC)
committer harlekin <harlekin>2002-06-24 21:05:01 (UTC)
commit67b1be897a8c02b70b6e0805ff0c5ae19146905c (patch) (side-by-side diff)
tree02f0e45847959560f1912a06d31f5895618edc88
parent2751bb111d21a5672c7caa7a6c2c45d14a642dbd (diff)
downloadopie-67b1be897a8c02b70b6e0805ff0c5ae19146905c.zip
opie-67b1be897a8c02b70b6e0805ff0c5ae19146905c.tar.gz
opie-67b1be897a8c02b70b6e0805ff0c5ae19146905c.tar.bz2
fixed a segfault if a device is discovered on opie start and added sounds
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/irdaapplet/irda.cpp28
-rw-r--r--core/applets/irdaapplet/irda.h3
-rw-r--r--core/applets/irdaapplet/irdaapplet.pro31
-rw-r--r--core/applets/irdaapplet/opie-irdaapplet.control2
4 files changed, 36 insertions, 28 deletions
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp
index c0f11c0..42bed5e 100644
--- a/core/applets/irdaapplet/irda.cpp
+++ b/core/applets/irdaapplet/irda.cpp
@@ -45,4 +45,5 @@
#include <qtextstream.h>
#include <qpopupmenu.h>
+#include <qsound.h>
#include <net/if.h>
@@ -65,10 +66,13 @@ IrdaApplet::IrdaApplet( QWidget *parent, const char *name )
receiveActivePixmap = Resource::loadPixmap("irdaapplet/receive");
receiveActive = false;
- startTimer(5000);
- timerEvent(NULL);
popupMenu = 0;
devicesAvailable.setAutoDelete(TRUE);
}
+void IrdaApplet::show() {
+ QWidget::show();
+ startTimer(2000);
+}
+
IrdaApplet::~IrdaApplet() {
close(sockfd);
@@ -207,17 +211,18 @@ void IrdaApplet::showDiscovered() {
for(QStringList::Iterator line=list.begin(); line!=list.end(); line++) {
- qDebug( (*line) );
+ // qDebug( (*line) );
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 + ")");
+ // qDebug(discoveredDevice + "(" + deviceAddr + ")");
if( ! devicesAvailable.find(deviceAddr) ) {
popup( tr("Found:") + " " + discoveredDevice );
+ QSound::play(Resource::findSound("irdaapplet/irdaon"));
qcopsend = TRUE;
}
devicesAvailable.replace( deviceAddr, new QString(discoveredDevice) );
- //qDebug("IrdaMon: " + deviceAddr + "=" + *devicesAvailable[deviceAddr] );
+ // qDebug("IrdaMon: " + deviceAddr + "=" + *devicesAvailable[deviceAddr] );
}
}
@@ -225,9 +230,10 @@ void IrdaApplet::showDiscovered() {
it.toFirst();
while ( it.current() ) {
- qDebug("IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?");
+ // qDebug("IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?");
if ( (*it.current()).left(3) == "+++" ) {
popup( tr("Lost:") + " " + (*devicesAvailable[it.currentKey()]).mid(3) );
+ QSound::play(Resource::findSound("irdaapplet/irdaoff"));
devicesAvailable.remove( it.currentKey() );
- qDebug("IrdaMon: delete " + it.currentKey() + "!");
+ // qDebug("IrdaMon: delete " + it.currentKey() + "!");
qcopsend = TRUE;
}
@@ -252,6 +258,5 @@ void IrdaApplet::mousePressEvent( QMouseEvent *) {
if (irdaactive && devicesAvailable.count() > 0) {
- menu->insertItem( tr("Discovered Device:"), 9);
-
+ menu->insertItem( tr("Discovered Device:"), 9);
QDictIterator<QString> it( devicesAvailable );
while ( it.current() ) {
@@ -317,7 +322,4 @@ void IrdaApplet::mousePressEvent( QMouseEvent *) {
break;
}
- case 6:
- qDebug("FIXME: Bring up pretty menu...\n");
- // With table of currently-detected devices.
}
delete menu; // Can somebody explain why use a QPopupMenu* and not QPopupMenu nor QAction. with out delete we will leak cause QPopupMenu doesn't have a parent in this case
@@ -350,5 +352,5 @@ void IrdaApplet::timerEvent( QTimerEvent * ) {
void IrdaApplet::paintEvent( QPaintEvent* ) {
QPainter p(this);
- qDebug("paint irda pixmap");
+ // qDebug("paint irda pixmap");
p.eraseRect ( 0, 0, this->width(), this->height() );
diff --git a/core/applets/irdaapplet/irda.h b/core/applets/irdaapplet/irda.h
index 7b37847..e878946 100644
--- a/core/applets/irdaapplet/irda.h
+++ b/core/applets/irdaapplet/irda.h
@@ -48,4 +48,7 @@ private:
int sockfd;
+public slots:
+ void show();
+
private slots:
void popupTimeout();
diff --git a/core/applets/irdaapplet/irdaapplet.pro b/core/applets/irdaapplet/irdaapplet.pro
index 035b0c1..47267f7 100644
--- a/core/applets/irdaapplet/irdaapplet.pro
+++ b/core/applets/irdaapplet/irdaapplet.pro
@@ -10,16 +10,19 @@ LIBS += -lqpe
VERSION = 1.0.0
-TRANSLATIONS = ../../i18n/de/libirdaapplet.ts
-TRANSLATIONS += ../../i18n/en/libirdaapplet.ts
-TRANSLATIONS += ../../i18n/es/libirdaapplet.ts
-TRANSLATIONS += ../../i18n/fr/libirdaapplet.ts
-TRANSLATIONS += ../../i18n/hu/libirdaapplet.ts
-TRANSLATIONS += ../../i18n/ja/libirdaapplet.ts
-TRANSLATIONS += ../../i18n/ko/libirdaapplet.ts
-TRANSLATIONS += ../../i18n/no/libirdaapplet.ts
-TRANSLATIONS += ../../i18n/pl/libirdaapplet.ts
-TRANSLATIONS += ../../i18n/pt/libirdaapplet.ts
-TRANSLATIONS += ../../i18n/pt_BR/libirdaapplet.ts
-TRANSLATIONS += ../../i18n/sl/libirdaapplet.ts
-TRANSLATIONS += ../../i18n/zh_CN/libirdaapplet.ts
-TRANSLATIONS += ../../i18n/zh_TW/libirdaapplet.ts
+
+
+TRANSLATIONS = ../../../i18n/de/libirdaapplet.ts
+TRANSLATIONS += ../../../i18n/en/libirdaapplet.ts
+TRANSLATIONS += ../../../i18n/es/libirdaapplet.ts
+TRANSLATIONS += ../../../i18n/fr/libirdaapplet.ts
+TRANSLATIONS += ../../../i18n/hu/libirdaapplet.ts
+TRANSLATIONS += ../../../i18n/ja/libirdaapplet.ts
+TRANSLATIONS += ../../../i18n/ko/libirdaapplet.ts
+TRANSLATIONS += ../../../i18n/no/libirdaapplet.ts
+TRANSLATIONS += ../../../i18n/pl/libirdaapplet.ts
+TRANSLATIONS += ../../../i18n/pt/libirdaapplet.ts
+TRANSLATIONS += ../../../i18n/pt_BR/libirdaapplet.ts
+TRANSLATIONS += ../../../i18n/sl/libirdaapplet.ts
+TRANSLATIONS += ../../../i18n/zh_CN/libirdaapplet.ts
+TRANSLATIONS += ../../../i18n/zh_TW/libirdaapplet.ts
+
diff --git a/core/applets/irdaapplet/opie-irdaapplet.control b/core/applets/irdaapplet/opie-irdaapplet.control
index 85c3386..5b901de 100644
--- a/core/applets/irdaapplet/opie-irdaapplet.control
+++ b/core/applets/irdaapplet/opie-irdaapplet.control
@@ -1,3 +1,3 @@
-Files: plugins/applets/libirdaapplet.so* pics/irdaapplet/*
+Files: plugins/applets/libirdaapplet.so* pics/irdaapplet/* sounds/irdaapplet/*.wav
Priority: optional
Section: opie/system