summaryrefslogtreecommitdiff
path: root/noncore/tools/remote/remotetab.cpp
Unidiff
Diffstat (limited to 'noncore/tools/remote/remotetab.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/remote/remotetab.cpp15
1 files changed, 14 insertions, 1 deletions
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
@@ -42,34 +42,47 @@ RemoteTab::RemoteTab(QWidget *parent=0, const char *name=0):QWidget(parent,name)
42 channelGroup = new ChannelGroup(this); 42 channelGroup = new ChannelGroup(this);
43 //channelGroup->setMaximumHeight(91); 43 //channelGroup->setMaximumHeight(91);
44 layout->addWidget(channelGroup, 0, 0); 44 layout->addWidget(channelGroup, 0, 0);
45 45
46 this->setMaximumWidth(240); 46 this->setMaximumWidth(240);
47 47
48 timeout = 0; 48 timeout = 0;
49 49
50 addr.sun_family=AF_UNIX; 50 addr.sun_family=AF_UNIX;
51 strcpy(addr.sun_path,"/dev/lircd"); 51 strcpy(addr.sun_path,"/dev/lircd");
52} 52}
53 53
54void RemoteTab::sendIR() 54int RemoteTab::sendIR()
55{ 55{
56 const QObject *button = sender(); 56 const QObject *button = sender();
57 QString string = cfg->readEntry(button->name()); 57 QString string = cfg->readEntry(button->name());
58 string+='\n'; 58 string+='\n';
59 const char *write_buffer = string.latin1(); 59 const char *write_buffer = string.latin1();
60 const char *read_buffer; 60 const char *read_buffer;
61 bool done=false; 61 bool done=false;
62 62
63 fd = socket(AF_UNIX, SOCK_STREAM, 0); 63 fd = socket(AF_UNIX, SOCK_STREAM, 0);
64 if(fd == -1)
65 {
66 QMessageBox *mb = new QMessageBox("Error!",
67 "couldnt connect to socket",
68 QMessageBox::NoIcon,
69 QMessageBox::Ok,
70 QMessageBox::NoButton,
71 QMessageBox::NoButton);
72 mb->exec();
73 perror("RemoteTab::SendIR");
74 return NULL;
75 }
76
64 77
65 if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) 78 if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
66 { 79 {
67 QMessageBox *mb = new QMessageBox("Error!", 80 QMessageBox *mb = new QMessageBox("Error!",
68 "couldnt connect to socket", 81 "couldnt connect to socket",
69 QMessageBox::NoIcon, 82 QMessageBox::NoIcon,
70 QMessageBox::Ok, 83 QMessageBox::Ok,
71 QMessageBox::NoButton, 84 QMessageBox::NoButton,
72 QMessageBox::NoButton); 85 QMessageBox::NoButton);
73 mb->exec(); 86 mb->exec();
74 perror("RemoteTab::SendIR"); 87 perror("RemoteTab::SendIR");
75 } 88 }