summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/tools/remote/buttondialog.cpp25
-rw-r--r--noncore/tools/remote/remotetab.cpp15
-rw-r--r--noncore/tools/remote/remotetab.h2
3 files changed, 40 insertions, 2 deletions
diff --git a/noncore/tools/remote/buttondialog.cpp b/noncore/tools/remote/buttondialog.cpp
index e7ff4b4..7479e85 100644
--- a/noncore/tools/remote/buttondialog.cpp
+++ b/noncore/tools/remote/buttondialog.cpp
@@ -95,12 +95,24 @@ QStringList ButtonDialog::getRemotes()
QStringList list;
addr.sun_family=AF_UNIX;
strcpy(addr.sun_path,"/dev/lircd");
fd = socket(AF_UNIX, SOCK_STREAM, 0);
+ if(fd == -1)
+ {
+ QMessageBox *mb = new QMessageBox("Error!",
+ "couldnt connect to socket",
+ QMessageBox::NoIcon,
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton);
+ mb->exec();
+ perror("ButtonDialog::GetRemotes");
+ return NULL;
+ }
if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
{
QMessageBox *mb = new QMessageBox("Error!",
"couldnt connect to socket",
QMessageBox::NoIcon,
@@ -155,12 +167,25 @@ QStringList ButtonDialog::getButtons(const char *remoteName)
QString string;
write_buffer += remoteName;
write_buffer += '\n';
fd = socket(AF_UNIX, SOCK_STREAM, 0);
+ if(fd == -1)
+ {
+ QMessageBox *mb = new QMessageBox("Error!",
+ "couldnt connect to socket",
+ QMessageBox::NoIcon,
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton);
+ mb->exec();
+ perror("ButtonDialog::GetButtons");
+ return NULL;
+ }
+
if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
{
QMessageBox *mb = new QMessageBox("Error!",
"couldnt connect to socket",
QMessageBox::NoIcon,
diff --git a/noncore/tools/remote/remotetab.cpp b/noncore/tools/remote/remotetab.cpp
index f3a8945..64b8ee4 100644
--- a/noncore/tools/remote/remotetab.cpp
+++ b/noncore/tools/remote/remotetab.cpp
@@ -48,22 +48,35 @@ RemoteTab::RemoteTab(QWidget *parent=0, const char *name=0):QWidget(parent,name)
timeout = 0;
addr.sun_family=AF_UNIX;
strcpy(addr.sun_path,"/dev/lircd");
}
-void RemoteTab::sendIR()
+int RemoteTab::sendIR()
{
const QObject *button = sender();
QString string = cfg->readEntry(button->name());
string+='\n';
const char *write_buffer = string.latin1();
const char *read_buffer;
bool done=false;
fd = socket(AF_UNIX, SOCK_STREAM, 0);
+ if(fd == -1)
+ {
+ QMessageBox *mb = new QMessageBox("Error!",
+ "couldnt connect to socket",
+ QMessageBox::NoIcon,
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton);
+ mb->exec();
+ perror("RemoteTab::SendIR");
+ return NULL;
+ }
+
if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
{
QMessageBox *mb = new QMessageBox("Error!",
"couldnt connect to socket",
QMessageBox::NoIcon,
diff --git a/noncore/tools/remote/remotetab.h b/noncore/tools/remote/remotetab.h
index 77a7318..38b58e9 100644
--- a/noncore/tools/remote/remotetab.h
+++ b/noncore/tools/remote/remotetab.h
@@ -47,13 +47,13 @@ public:
RemoteTab(QWidget *parent=0, const char *name=0);
void setIRSocket(int newfd);
const char *readPacket();
void setConfig(Config *newCfg);
void updateRemotesList();
public slots:
- void sendIR();
+ int sendIR();
void remoteSelected(const QString &string);
private:
int fd;
int timeout;
struct sockaddr_un addr;
Config *cfg;