summaryrefslogtreecommitdiffstats
path: root/kdelirc/irkick
diff options
context:
space:
mode:
Diffstat (limited to 'kdelirc/irkick')
-rw-r--r--kdelirc/irkick/Makefile.am42
-rw-r--r--kdelirc/irkick/hi16-app-irkick.pngbin0 -> 954 bytes
-rw-r--r--kdelirc/irkick/hi22-app-irkick.pngbin0 -> 1457 bytes
-rw-r--r--kdelirc/irkick/hi32-app-irkick.pngbin0 -> 2421 bytes
-rw-r--r--kdelirc/irkick/icons/Makefile.am3
-rw-r--r--kdelirc/irkick/icons/hi16-action-irkick.pngbin0 -> 954 bytes
-rw-r--r--kdelirc/irkick/icons/hi16-action-irkickflash.pngbin0 -> 892 bytes
-rw-r--r--kdelirc/irkick/icons/hi16-action-irkickoff.pngbin0 -> 1016 bytes
-rw-r--r--kdelirc/irkick/irkick.cpp336
-rw-r--r--kdelirc/irkick/irkick.desktop116
-rw-r--r--kdelirc/irkick/irkick.h132
-rw-r--r--kdelirc/irkick/irkick.project12
-rw-r--r--kdelirc/irkick/kdedmodule_stub.h34
-rw-r--r--kdelirc/irkick/klircclient.cpp241
-rw-r--r--kdelirc/irkick/klircclient.h114
-rw-r--r--kdelirc/irkick/lo16-app-irkick.pngbin0 -> 381 bytes
-rw-r--r--kdelirc/irkick/lo32-app-irkick.pngbin0 -> 603 bytes
-rw-r--r--kdelirc/irkick/main.cpp39
18 files changed, 1069 insertions, 0 deletions
diff --git a/kdelirc/irkick/Makefile.am b/kdelirc/irkick/Makefile.am
new file mode 100644
index 0000000..5479ac1
--- /dev/null
+++ b/kdelirc/irkick/Makefile.am
@@ -0,0 +1,42 @@
+SUBDIRS = icons
+
+bin_PROGRAMS =
+lib_LTLIBRARIES =
+noinst_LTLIBRARIES = libirkick_common.la
+kdeinit_LTLIBRARIES = irkick.la
+
+CLEANFILES = dummy.cpp
+
+libirkick_common_la_LIBADD = $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KSYCOCA) ../kdelirc/libkdelirc.la
+libirkick_common_la_SOURCES = main.cpp irkick.cpp irkick.skel irkick.stub klircclient.cpp
+
+libirkick_common_la_LDFLAGS = $(all_libraries)
+
+irkick_la_LIBADD = libirkick_common.la
+irkick_la_SOURCES = dummy.cpp
+irkick_la_LDFLAGS = $(all_libraries) -module -avoid-version
+
+xdg_apps_DATA = irkick.desktop
+
+autostartdir = $(datadir)/autostart
+autostart_DATA = irkick.desktop
+
+messages:
+ $(XGETTEXT) *.cpp -o $(podir)/irkick.pot
+
+dummy.cpp:
+ echo > dummy.cpp
+
+#kdedservicesdir = $(kde_servicesdir)/kded
+#kdedservices_DATA = irkick.desktop
+#lib_LTLIBRARIES = libkded_irkick.la
+#libkded_irkick_la_SOURCES = irkick.cpp irkick.skel irkick.stub klircclient.cpp
+#libkded_irkick_la_LDFLAGS = $(all_libraries) -module -avoid-version
+#libkded_irkick_la_LIBADD = $(LIB_KDECORE) ../kdelirc/libkdelirc.la
+
+noinst_HEADERS = irkick.h klircclient.h irkick_stub.h
+
+INCLUDES = -I$(srcdir)/../kdelirc $(all_includes)
+
+KDE_ICON = AUTO
+METASOURCES = AUTO
diff --git a/kdelirc/irkick/hi16-app-irkick.png b/kdelirc/irkick/hi16-app-irkick.png
new file mode 100644
index 0000000..65d7504
--- /dev/null
+++ b/kdelirc/irkick/hi16-app-irkick.png
Binary files differ
diff --git a/kdelirc/irkick/hi22-app-irkick.png b/kdelirc/irkick/hi22-app-irkick.png
new file mode 100644
index 0000000..fd09e86
--- /dev/null
+++ b/kdelirc/irkick/hi22-app-irkick.png
Binary files differ
diff --git a/kdelirc/irkick/hi32-app-irkick.png b/kdelirc/irkick/hi32-app-irkick.png
new file mode 100644
index 0000000..f283148
--- /dev/null
+++ b/kdelirc/irkick/hi32-app-irkick.png
Binary files differ
diff --git a/kdelirc/irkick/icons/Makefile.am b/kdelirc/irkick/icons/Makefile.am
new file mode 100644
index 0000000..307658e
--- /dev/null
+++ b/kdelirc/irkick/icons/Makefile.am
@@ -0,0 +1,3 @@
+irkickiconsdir = $(kde_datadir)/irkick/icons
+irkickicons_ICON = AUTO
+
diff --git a/kdelirc/irkick/icons/hi16-action-irkick.png b/kdelirc/irkick/icons/hi16-action-irkick.png
new file mode 100644
index 0000000..65d7504
--- /dev/null
+++ b/kdelirc/irkick/icons/hi16-action-irkick.png
Binary files differ
diff --git a/kdelirc/irkick/icons/hi16-action-irkickflash.png b/kdelirc/irkick/icons/hi16-action-irkickflash.png
new file mode 100644
index 0000000..8c4e5d3
--- /dev/null
+++ b/kdelirc/irkick/icons/hi16-action-irkickflash.png
Binary files differ
diff --git a/kdelirc/irkick/icons/hi16-action-irkickoff.png b/kdelirc/irkick/icons/hi16-action-irkickoff.png
new file mode 100644
index 0000000..5498652
--- /dev/null
+++ b/kdelirc/irkick/icons/hi16-action-irkickoff.png
Binary files differ
diff --git a/kdelirc/irkick/irkick.cpp b/kdelirc/irkick/irkick.cpp
new file mode 100644
index 0000000..31ec93c
--- /dev/null
+++ b/kdelirc/irkick/irkick.cpp
@@ -0,0 +1,336 @@
+/***************************************************************************
+ irkick.cpp - Implementation of the main window
+ -------------------
+ copyright : (C) 2002 by Gav Wood
+ email : gav@kde.org
+***************************************************************************/
+
+// This program is free software.
+
+#include <qwidget.h>
+#include <qdialog.h>
+#include <qtooltip.h>
+#include <qregexp.h>
+#include <qtimer.h>
+#include <qevent.h>
+
+#include <kdeversion.h>
+#include <kapplication.h>
+#include <kaction.h>
+#if !(KDE_VERSION_MINOR<=1 && KDE_VERSION_RELEASE<=5)
+#include <kactioncollection.h>
+#endif
+#include <ksimpleconfig.h>
+#include <ksystemtray.h>
+#include <kiconloader.h>
+#include <kpassivepopup.h>
+#include <kmessagebox.h>
+#include <kpopupmenu.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kaboutdialog.h>
+#include <kaboutkde.h>
+#include <kwinmodule.h>
+#include <kwin.h>
+#include <khelpmenu.h>
+#include <kglobal.h>
+#include <kstdguiitem.h>
+
+#include <dcopclient.h>
+#include <dcopref.h>
+
+#include "profileserver.h"
+#include "irkick.h"
+
+void IRKTrayIcon::mousePressEvent(QMouseEvent *e)
+{
+ KSystemTray::mousePressEvent(new QMouseEvent(QEvent::MouseButtonPress, e->pos(), e->globalPos(), e->button() == LeftButton ? RightButton : e->button(), e->state()));
+}
+
+IRKick::IRKick(const QCString &obj) : QObject(), DCOPObject(obj), npApp(QString::null)
+{
+ kapp->dcopClient()->setDefaultObject(obj);
+ theClient = new KLircClient();
+
+ theTrayIcon = new IRKTrayIcon();
+ if(theClient->isConnected())
+ { theTrayIcon->setPixmap(SmallIcon("irkick"));
+ QToolTip::add(theTrayIcon, i18n("KDE Lirc Server: Ready."));
+ }
+ else
+ { theTrayIcon->setPixmap(SmallIcon("irkickoff"));
+ QToolTip::add(theTrayIcon, i18n("KDE Lirc Server: No infra-red remote controls found."));
+ QTimer::singleShot(10000, this, SLOT(checkLirc()));
+ }
+ theFlashOff = new QTimer(theTrayIcon);
+ connect(theFlashOff, SIGNAL(timeout()), SLOT(flashOff()));
+
+ theResetCount = 0;
+ slotReloadConfiguration();
+ connect(theClient, SIGNAL(connectionClosed()), this, SLOT(slotClosed()));
+ connect(theClient, SIGNAL(remotesRead()), this, SLOT(resetModes()));
+ connect(theClient, SIGNAL(commandReceived(const QString &, const QString &, int)), this, SLOT(gotMessage(const QString &, const QString &, int)));
+
+ theTrayIcon->contextMenu()->changeTitle(0, "IRKick");
+ theTrayIcon->contextMenu()->insertItem(SmallIcon( "configure" ), i18n("&Configure..."), this, SLOT(slotConfigure()));
+ theTrayIcon->contextMenu()->insertSeparator();
+ theTrayIcon->contextMenu()->insertItem(SmallIcon( "help" ), KStdGuiItem::help().text(), (new KHelpMenu(theTrayIcon, KGlobal::instance()->aboutData()))->menu());
+ theTrayIcon->actionCollection()->action("file_quit")->disconnect(SIGNAL(activated()));
+ connect(theTrayIcon->actionCollection()->action("file_quit"), SIGNAL(activated()), SLOT(doQuit()));
+
+ theTrayIcon->show();
+}
+
+IRKick::~IRKick()
+{
+ delete theTrayIcon;
+ for(QMap<QString,IRKTrayIcon *>::iterator i = currentModeIcons.begin(); i != currentModeIcons.end(); ++i)
+ if(*i) delete *i;
+}
+
+void IRKick::slotClosed()
+{
+ theTrayIcon->setPixmap(SmallIcon("irkickoff"));
+ KPassivePopup::message("IRKick", i18n("The infrared system has severed its connection. Remote controls are no longer available."), SmallIcon("irkick"), theTrayIcon);
+ QTimer::singleShot(1000, this, SLOT(checkLirc()));
+}
+
+void IRKick::checkLirc()
+{
+ if(!theClient->isConnected())
+ if(theClient->connectToLirc())
+ { KPassivePopup::message("IRKick", i18n("A connection to the infrared system has been made. Remote controls may now be available."), SmallIcon("irkick"), theTrayIcon);
+ theTrayIcon->setPixmap(SmallIcon("irkick"));
+ }
+ else
+ QTimer::singleShot(10000, this, SLOT(checkLirc()));
+}
+
+void IRKick::flashOff()
+{
+ theTrayIcon->setPixmap(SmallIcon("irkick"));
+}
+
+void IRKick::doQuit()
+{
+ KSimpleConfig theConfig("irkickrc");
+ theConfig.setGroup("General");
+ switch(KMessageBox::questionYesNoCancel(0, i18n("Should the Infrared Remote Control server start automatically when you begin KDE?"), i18n("Automatically Start?"), i18n("Start Automatically"), i18n("Do Not Start")))
+ { case KMessageBox::No: theConfig.writeEntry("AutoStart", false); break;
+ case KMessageBox::Yes: theConfig.writeEntry("AutoStart", true); break;
+ case KMessageBox::Cancel: return;
+ }
+ KApplication::kApplication()->quit();
+}
+
+void IRKick::resetModes()
+{
+ if(theResetCount > 1)
+ KPassivePopup::message("IRKick", i18n("Resetting all modes."), SmallIcon("irkick"), theTrayIcon);
+ if(!theResetCount)
+ allModes.generateNulls(theClient->remotes());
+
+ QStringList remotes = theClient->remotes();
+ for(QStringList::iterator i = remotes.begin(); i != remotes.end(); ++i)
+ { currentModes[*i] = allModes.getDefault(*i).name();
+ if(theResetCount && currentModeIcons[*i]) delete currentModeIcons[*i];
+ currentModeIcons[*i] = 0;
+ }
+ updateModeIcons();
+ theResetCount++;
+}
+
+void IRKick::slotReloadConfiguration()
+{
+ // load configuration from config file
+ KSimpleConfig theConfig("irkickrc");
+ allActions.loadFromConfig(theConfig);
+ allModes.loadFromConfig(theConfig);
+ if(currentModes.count() && theResetCount)
+ resetModes();
+}
+
+void IRKick::slotConfigure()
+{
+ KApplication::startServiceByDesktopName("kcmlirc");
+}
+
+void IRKick::updateModeIcons()
+{
+ for(QMap<QString,QString>::iterator i = currentModes.begin(); i != currentModes.end(); ++i)
+ { Mode mode = allModes.getMode(i.key(), i.data());
+ if(mode.iconFile().isNull() || mode.iconFile().isEmpty())
+ { if(currentModeIcons[i.key()])
+ { delete currentModeIcons[i.key()];
+ currentModeIcons[i.key()] = 0;
+ }
+ }
+ else
+ { if(!currentModeIcons[i.key()])
+ { currentModeIcons[i.key()] = new IRKTrayIcon();
+ currentModeIcons[i.key()]->show();
+ currentModeIcons[i.key()]->contextMenu()->changeTitle(0, mode.remoteName());
+ currentModeIcons[i.key()]->actionCollection()->action("file_quit")->setEnabled(false);
+ }
+ currentModeIcons[i.key()]->setPixmap(KIconLoader().loadIcon(mode.iconFile(), KIcon::Panel));
+ QToolTip::add(currentModeIcons[i.key()], mode.remoteName() + ": <b>" + mode.name() + "</b>");
+ }
+ }
+}
+
+bool IRKick::getPrograms(const IRAction &action, QStringList &programs)
+{
+ DCOPClient *theDC = KApplication::dcopClient();
+ programs.clear();
+
+ if(action.unique())
+ { if(theDC->isApplicationRegistered(action.program().utf8()))
+ programs += action.program();
+ }
+ else
+ {
+ QRegExp r = QRegExp("^" + action.program() + "-(\\d+)$");
+ // find all instances...
+ QCStringList buf = theDC->registeredApplications();
+ for(QCStringList::iterator i = buf.begin(); i != buf.end(); ++i)
+ {
+ QString program = QString::fromUtf8(*i);
+ if(program.contains(r))
+ programs += program;
+ }
+ if(programs.size() > 1 && action.ifMulti() == IM_DONTSEND)
+ return false;
+ else if(programs.size() > 1 && action.ifMulti() == IM_SENDTOTOP)
+ { QValueList<WId> s = KWinModule().stackingOrder();
+ // go through all the (ordered) window pids
+ for(QValueList<WId>::iterator i = s.fromLast(); i != s.end(); i--)
+ { int p = KWin::info(*i).pid;
+ QString id = action.program() + "-" + QString().setNum(p);
+ if(programs.contains(id))
+ { programs.clear();
+ programs += id;
+ break;
+ }
+ }
+ while(programs.size() > 1) programs.remove(programs.begin());
+ }
+ else if(programs.size() > 1 && action.ifMulti() == IM_SENDTOBOTTOM)
+ { QValueList<WId> s = KWinModule().stackingOrder();
+ // go through all the (ordered) window pids
+ for(QValueList<WId>::iterator i = s.begin(); i != s.end(); ++i)
+ { int p = KWin::info(*i).pid;
+ QString id = action.program() + "-" + QString().setNum(p);
+ if(programs.contains(id))
+ { programs.clear();
+ programs += id;
+ break;
+ }
+ }
+ while(programs.size() > 1) programs.remove(programs.begin());
+ }
+ }
+ return true;
+}
+
+void IRKick::executeAction(const IRAction &action)
+{
+ DCOPClient *theDC = KApplication::dcopClient();
+ QStringList programs;
+
+ if(!getPrograms(action, programs)) return;
+
+ // if programs.size()==0 here, then the app is definately not running.
+ if(action.autoStart() && !programs.size())
+ { QString sname = ProfileServer::profileServer()->getServiceName(action.program());
+ if(!sname.isNull())
+ {
+ KPassivePopup::message("IRKick", i18n("Starting <b>%1</b>...").arg(action.application()), SmallIcon("irkick"), theTrayIcon);
+ KApplication::startServiceByDesktopName(sname);
+ }
+ }
+ if(action.isJustStart()) return;
+
+ if(!getPrograms(action, programs)) return;
+
+ for(QStringList::iterator i = programs.begin(); i != programs.end(); ++i)
+ { const QString &program = *i;
+ if(theDC->isApplicationRegistered(program.utf8()))
+ { QByteArray data; QDataStream arg(data, IO_WriteOnly);
+ kdDebug() << "Sending data (" << program << ", " << action.object() << ", " << action.method().prototypeNR() << endl;
+ for(Arguments::const_iterator j = action.arguments().begin(); j != action.arguments().end(); ++j)
+ { kdDebug() << "Got argument..." << endl;
+ switch((*j).type())
+ { case QVariant::Int: arg << (*j).toInt(); break;
+ case QVariant::CString: arg << (*j).toCString(); break;
+ case QVariant::StringList: arg << (*j).toStringList(); break;
+ case QVariant::UInt: arg << (*j).toUInt(); break;
+ case QVariant::Bool: arg << (*j).toBool(); break;
+ case QVariant::Double: arg << (*j).toDouble(); break;
+ default: arg << (*j).toString(); break;
+ }
+ }
+ theDC->send(program.utf8(), action.object().utf8(), action.method().prototypeNR().utf8(), data);
+ }
+ }
+}
+
+void IRKick::gotMessage(const QString &theRemote, const QString &theButton, int theRepeatCounter)
+{
+ kdDebug() << "Got message: " << theRemote << ": " << theButton << " (" << theRepeatCounter << ")" << endl;
+ theTrayIcon->setPixmap(SmallIcon("irkickflash"));
+ theFlashOff->start(200, true);
+ if(!npApp.isNull())
+ {
+ QString theApp = npApp;
+ npApp = QString::null;
+ // send notifier by DCOP to npApp/npModule/npMethod(theRemote, theButton);
+ QByteArray data; QDataStream arg(data, IO_WriteOnly);
+ arg << theRemote << theButton;
+ KApplication::dcopClient()->send(theApp.utf8(), npModule.utf8(), npMethod.utf8(), data);
+ }
+ else
+ {
+ if(currentModes[theRemote].isNull()) currentModes[theRemote] = "";
+ IRAItList l = allActions.findByModeButton(Mode(theRemote, currentModes[theRemote]), theButton);
+ if(!currentModes[theRemote].isEmpty())
+ l += allActions.findByModeButton(Mode(theRemote, ""), theButton);
+ bool doBefore = true, doAfter = false;
+ for(IRAItList::const_iterator i = l.begin(); i != l.end(); ++i)
+ if((**i).isModeChange() && !theRepeatCounter)
+ { // mode switch
+ currentModes[theRemote] = (**i).modeChange();
+ Mode mode = allModes.getMode(theRemote, (**i).modeChange());
+ updateModeIcons();
+ doBefore = (**i).doBefore();
+ doAfter = (**i).doAfter();
+ break;
+ }
+
+ for(int after = 0; after < 2; after++)
+ { if(doBefore && !after || doAfter && after)
+ for(IRAItList::const_iterator i = l.begin(); i != l.end(); ++i)
+ if(!(**i).isModeChange() && ((**i).repeat() || !theRepeatCounter))
+ { executeAction(**i);
+ }
+ if(!after && doAfter)
+ { l = allActions.findByModeButton(Mode(theRemote, currentModes[theRemote]), theButton);
+ if(!currentModes[theRemote].isEmpty())
+ l += allActions.findByModeButton(Mode(theRemote, ""), theButton);
+ }
+ }
+ }
+}
+
+void IRKick::stealNextPress(QString app, QString module, QString method)
+{
+ npApp = app;
+ npModule = module;
+ npMethod = method;
+}
+
+void IRKick::dontStealNextPress()
+{
+ npApp = QString::null;
+}
+
+#include "irkick.moc"
diff --git a/kdelirc/irkick/irkick.desktop b/kdelirc/irkick/irkick.desktop
new file mode 100644
index 0000000..406c214
--- /dev/null
+++ b/kdelirc/irkick/irkick.desktop
@@ -0,0 +1,116 @@
+[Desktop Entry]
+Type=Service
+Name=IRKick
+Name[sv]=IRkick
+GenericName=KDE LIRC Server
+GenericName[ar]=خادم LIRC لكدى
+GenericName[bg]=Сървър LIRC
+GenericName[br]=Servijer LIRC KDE
+GenericName[bs]=KDE LIRC server
+GenericName[ca]=Servidor LIRC de KDE
+GenericName[cs]=LIRC server pro KDE
+GenericName[cy]=Gweinydd LIRC KDE
+GenericName[da]=KDE LIRC-server
+GenericName[de]=KDE LIRC-Server
+GenericName[el]=Εξυπηρετητής LIRC του KDE
+GenericName[eo]=KDE LIRC-servilo
+GenericName[es]=Servidor LIRC de KDE
+GenericName[et]=KDE LIRC server
+GenericName[eu]=KDE LIRC Zerbitzaria
+GenericName[fa]=KDE LIRC کارساز
+GenericName[fi]=KDE:n LIRC-palvelin
+GenericName[fr]=Serveur KDE LIRC
+GenericName[ga]=Freastalaí LIRC KDE
+GenericName[he]=שרת ה-LIRC של KDE
+GenericName[hu]=KDE LIRC szolgáltatás
+GenericName[is]=KDE LIRC þjónn
+GenericName[it]=Server LIRC di KDE
+GenericName[ja]=KDE LIRC サーバ
+GenericName[ka]=KDE LIRC სერვერი
+GenericName[kk]=KDE LIRC сервері
+GenericName[km]=ម៉ាស៊ីន​បម្រើ KDE LIRC
+GenericName[lt]=KDE LIRC serveris
+GenericName[nb]=KDE LIRC-tjener
+GenericName[nds]=KDE LIRC-Server
+GenericName[ne]=KDE LIRC सर्भर
+GenericName[nl]=KDE LIRC-server
+GenericName[nn]=KDE LIRC-tenar
+GenericName[pa]=KDE LIRC ਸਰਵਰ
+GenericName[pl]=Serwer LIRC dla KDE
+GenericName[pt]=Servidor de LIRC do KDE
+GenericName[pt_BR]=Servidor LIRC do KDE
+GenericName[ru]=Сервер LIRC для KDE
+GenericName[sk]=KDE LIRC server
+GenericName[sl]=Strežnik KDE LIRC
+GenericName[sr]=KDE-ов LIRC сервер
+GenericName[sr@Latn]=KDE-ov LIRC server
+GenericName[sv]=KDE:s LIRC-server
+GenericName[ta]=KDE LIRC சேவகன்
+GenericName[tr]=KDE LIRC Sunucusu
+GenericName[uk]=Сервер LIRC для KDE
+GenericName[uz]=KDE LIRC serveri
+GenericName[uz@cyrillic]=KDE LIRC сервери
+GenericName[zh_CN]=KDE LIRC 服务器
+GenericName[zh_TW]=KDE LIRC 伺服器
+
+X-KDE-Library=irkick
+X-KDE-autostart-after=panel
+X-KDE-StartupNotify=false
+X-DCOP-ServiceType=Unique
+X-KDE-autostart-condition=irkickrc:General:AutoStart:false
+Categories=Qt;KDE;Utility;X-KDE-Utilities-Peripherals;
+
+Exec=irkick
+Icon=irkick
+DocPath=irkick/index.html
+Comment=KDE Linux infrared remote control server.
+Comment[ar]=خادم كدى للتحكّم عن بعد بالأشعة تحت الحمراء في لينكس.
+Comment[bg]=Сървър за управление на дистанционно устройство с инфрачервени лъчи
+Comment[bs]=KDEov server za Linux infracrveno daljinsko upravljanje (Linux Infrared Remote Control).
+Comment[ca]=Servidor de control remot per infrarojos de Linux KDE.
+Comment[cs]=Server dálkového ovládání pro KDE.
+Comment[cy]=Gweinydd rheolydd pell isgoch Linux KDE
+Comment[da]=KDE Linux infrarød fjernbetjeningsserver.
+Comment[de]=KDE Linux Infrarot Fernsteuerungsserver.
+Comment[el]=Εξυπηρετητής τηλεχειριστηρίου υπερύθρων του Linux για το KDE.
+Comment[es]=Servidor de control remoto por infrarrojos de KDE
+Comment[et]=KDE Linuxi infrapuna kaugjuhtimise server.
+Comment[eu]=KDE Linux infrasare urruneko aginte zerbitzaria.
+Comment[fa]=KDE Linuxکارساز کنترل از راه دور مادون قرمز
+Comment[fi]=KDE:n Linux infrapunalla toimivien kauko-ohjainten ohjauspalvelin.
+Comment[fr]=Serveur de contrôle distant infrarouge sous Linux pour KDE.
+Comment[ga]=Freastalaí KDE cianrialaithe infridhearg Linux
+Comment[he]=שרת לשלט רחוק עבור KDE.
+Comment[hi]=केडीई लिनक्स इन्फ्रारेड रिमोट नियंत्रण सर्वर.
+Comment[hu]=KDE Linux szolgáltatás infravörös távirányítók kezeléséhez
+Comment[is]=KDE Linux innrauða fjarstýringarstjórnborðið
+Comment[it]=Server KDE per i telecomandi ad infrarossi
+Comment[ja]=KDE Linux 赤外線リモートコントロールサーバ
+Comment[ka]= KDE ლინუქსის ინფრაწითელი დაშორებული მართვის სერვერი
+Comment[kk]=KDE Linux инфрақызыл порт арқылы басқару сервері.
+Comment[km]=ម៉ាស៊ីន​បម្រើ​បញ្ជា KDE Linux infrared ពី​ចម្ងាយ ។
+Comment[lt]=KDE Linux infraraudonųjų spindulių sąsajos nuotolinio valdymo serveris
+Comment[nb]=KDE Linux-tjener for infrarød fjernkontroll
+Comment[nds]=KDE-Linux Infraroot-Feernbedeenkuntrullserver
+Comment[ne]=KDE लिनक्स अवरक्त टाढाको नियन्त्रण सर्भर ।
+Comment[nl]=KDE-server voor infrarood-afstandsbediening.
+Comment[nn]=KDE-tenar for infraraud fjernkontroll.
+Comment[pa]=KDE ਲੀਨਕਸ ਇੰਫਰਾਰੈੱਡ ਰਿਮੋਟ ਕੰਟਰੋਲ ਸਰਵਰ ਹੈ।
+Comment[pl]=Serwer obsługi pilotów dla KDE.
+Comment[pt]=Servidor de comandos à distância por infravermelhos do KDE.
+Comment[pt_BR]=servidor de controle infra-vermelho do Linux no KDE
+Comment[ro]=Server de control al telecomenziilor în infraroşu
+Comment[ru]=Сервер управления KDE через инфракрасный порт.
+Comment[sk]=KDE server pre infračervené vzdialené ovládanie pre Linux.
+Comment[sl]=Strežnik KDE Linux za infrardeči daljninski upravljalnik
+Comment[sr]=KDE-ов сервер за контролу инфрацрвених даљинских управљача у Linux-у.
+Comment[sr@Latn]=KDE-ov server za kontrolu infracrvenih daljinskih upravljača u Linux-u.
+Comment[sv]=Infraröd fjärrkontrollserver
+Comment[ta]=கேடிஇ லினக்ஸ் அகச்சிவப்பு கதிர் தொலைதூர கட்டுப்பாட்டு சேவகன்
+Comment[tg]=Хидматрасони идоракунии дурдасти инфрасурхи KDE Linux.
+Comment[tr]=KDE Linux kızılötesi uzaktan kontrol sunucusu.
+Comment[uk]=Сервер дистанційного керування інфрачервоними пристроями для Linux та KDE.
+Comment[uz]=Infraqizil nur bilan masofadan boshqarish serveri
+Comment[uz@cyrillic]=Инфрақизил нур билан масофадан бошқариш сервери
+Comment[zh_CN]=KDE Linux 红外远程控制服务器。
+Comment[zh_TW]=KDE Linux 紅外線遙控伺服器。
diff --git a/kdelirc/irkick/irkick.h b/kdelirc/irkick/irkick.h
new file mode 100644
index 0000000..875d039
--- /dev/null
+++ b/kdelirc/irkick/irkick.h
@@ -0,0 +1,132 @@
+/***************************************************************************
+ irkick.h - Interface of the main window
+ copyright : (C) 2002 by Gav Wood
+ email : gav@kde.org
+
+***************************************************************************/
+
+// This program is free software.
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef __IRKICK_H
+#define __IRKICK_H
+
+#include <qstring.h>
+
+#include <ksystemtray.h>
+#include <kdedmodule.h>
+#include <kaboutdata.h>
+
+#include <dcopobject.h>
+
+#include "modes.h"
+#include "iractions.h"
+#include "klircclient.h"
+
+class QMouseEvent;
+
+class IRKTrayIcon: public KSystemTray
+{
+ void mousePressEvent(QMouseEvent *e);
+
+public:
+ KPopupMenu* contextMenu() const { return KSystemTray::contextMenu(); }
+ KActionCollection* actionCollection() { return KSystemTray::actionCollection(); }
+
+ IRKTrayIcon(QWidget *parent = 0, const char *name = 0): KSystemTray(parent, name) {}
+};
+
+class IRKick: public QObject, public DCOPObject
+{
+ Q_OBJECT
+ K_DCOP
+
+ QString npApp, npModule, npMethod;
+ QMap<QString, QString> currentModes;
+ QMap<QString, IRKTrayIcon *> currentModeIcons;
+ IRActions allActions;
+ int theResetCount;
+ Modes allModes;
+
+ IRKTrayIcon *theTrayIcon;
+ KAboutData *aboutData;
+ QTimer *theFlashOff;
+
+ void updateModeIcons();
+
+protected:
+ KLircClient *theClient;
+
+k_dcop:
+ /**
+ * Query status of connection.
+ *
+ * @returns true if connected to lircd.
+ */
+ virtual bool isConnected() { return theClient->isConnected(); }
+
+ /**
+ * Query status of remote list.
+ *
+ * Make sure this is true before calling remotes()/buttons(...).
+ *
+ * @returns true if up to date.
+ */
+ virtual bool haveFullList() { return theClient->haveFullList(); }
+
+ /**
+ * Retrieve list of remote controls.
+ *
+ * @returns said list.
+ */
+ virtual const QStringList remotes() { return theClient->remotes(); }
+
+ /**
+ * Retrieve list of buttons of a praticular remote control.
+ *
+ * @returns said list.
+ */
+ virtual const QStringList buttons(QString theRemote) { return theClient->buttons(theRemote); }
+
+ /**
+ * Sends next keypress to given application by DCOP.
+ *
+ * @param The receiving application.
+ * @param The receiving application module.
+ * @param The method name. Must have two QString parameters.
+ */
+ virtual void stealNextPress(QString app, QString module, QString method);
+
+ /**
+ * Cancels the proceedings of the previous stealNextPress call, if any.
+ */
+ virtual void dontStealNextPress();
+
+ /**
+ * Reloads configuration from file(s)
+ */
+ virtual void reloadConfiguration() { slotReloadConfiguration(); }
+
+private slots:
+ void gotMessage(const QString &theRemote, const QString &theButton, int theRepeatCounter);
+ void resetModes();
+ void doQuit();
+ void flashOff();
+ void checkLirc();
+
+ void slotConfigure();
+ void slotReloadConfiguration();
+ void slotClosed();
+private:
+ void executeAction(const IRAction &action);
+ bool getPrograms(const IRAction &action, QStringList &populous);
+
+public:
+ IRKick(const QCString &obj);
+ virtual ~IRKick();
+};
+
+#endif
diff --git a/kdelirc/irkick/irkick.project b/kdelirc/irkick/irkick.project
new file mode 100644
index 0000000..b486441
--- /dev/null
+++ b/kdelirc/irkick/irkick.project
@@ -0,0 +1,12 @@
+# KDE Config File
+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Exec=irkick -caption "%c" %i %m
+Icon=irkick.png
+DocPath=irkick/index.html
+Comment=
+Comment[de]=
+Terminal=0
+Name=IRKick
+Name[de]=IRKick
diff --git a/kdelirc/irkick/kdedmodule_stub.h b/kdelirc/irkick/kdedmodule_stub.h
new file mode 100644
index 0000000..5f248f8
--- /dev/null
+++ b/kdelirc/irkick/kdedmodule_stub.h
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** DCOP Stub Definition created by dcopidl2cpp from kdedmodule.kidl
+**
+** WARNING! All changes made in this file will be lost!
+**
+*****************************************************************************/
+
+/* This is a machine-generated file, and may be distributed under the GPL
+ licence, as described in kdelibs/COPYING.
+*/
+
+#ifndef __KDEDMODULE_STUB__
+#define __KDEDMODULE_STUB__
+
+#include <dcopstub.h>
+#include <qobject.h>
+#include <dcopobject.h>
+#include <dcopref.h>
+#include <ksharedptr.h>
+
+
+class KDEDModule_stub : virtual public DCOPStub
+{
+public:
+ KDEDModule_stub( const QCString& app, const QCString& id );
+ KDEDModule_stub( DCOPClient* client, const QCString& app, const QCString& id );
+ explicit KDEDModule_stub( const DCOPRef& ref );
+protected:
+ KDEDModule_stub() : DCOPStub( never_use ) {};
+};
+
+
+#endif
diff --git a/kdelirc/irkick/klircclient.cpp b/kdelirc/irkick/klircclient.cpp
new file mode 100644
index 0000000..2876079
--- /dev/null
+++ b/kdelirc/irkick/klircclient.cpp
@@ -0,0 +1,241 @@
+//
+//
+// C++ Implementation: $MODULE$
+//
+// Description:
+//
+//
+// Author: (C) 2002 by Malte Starostik
+// Adaption : Gav Wood <gav@kde.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <cstring>
+#include <sys/un.h>
+#include <sys/socket.h>
+#include <errno.h>
+
+#include <qwidget.h>
+#include <qdialog.h>
+#include <qtooltip.h>
+#include <qsocket.h>
+#include <qsocketnotifier.h>
+#include <qfile.h>
+
+#include <kapplication.h>
+#include <ksystemtray.h>
+#include <kiconloader.h>
+#include <kpassivepopup.h>
+#include <kmessagebox.h>
+#include <kpopupmenu.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kaboutdialog.h>
+#include <kaboutkde.h>
+
+#include <dcopclient.h>
+#include <dcopref.h>
+
+#include "klircclient.h"
+
+
+KLircClient::KLircClient(QWidget *parent, const char *name) : QObject(parent, name), theSocket(0), listIsUpToDate(false)
+{
+ connectToLirc();
+}
+
+bool KLircClient::connectToLirc()
+{
+ int sock = ::socket(PF_UNIX, SOCK_STREAM, 0);
+ if(sock == -1) return false;
+
+ sockaddr_un addr;
+ addr.sun_family = AF_UNIX;
+ strcpy(addr.sun_path, "/dev/lircd");
+ if(::connect(sock, (struct sockaddr *)(&addr), sizeof(addr)) == -1)
+ { ::close(sock);
+ // in case of mandrake...
+ strcpy(addr.sun_path, "/tmp/.lircd");
+ if(::connect(sock, (struct sockaddr *)(&addr), sizeof(addr)) == -1)
+ { ::close(sock);
+ return false;
+ }
+ }
+
+ theSocket = new QSocket;
+ theSocket->setSocket(sock);
+ connect(theSocket, SIGNAL(readyRead()), SLOT(slotRead()));
+ connect(theSocket, SIGNAL(connectionClosed()), SLOT(slotClosed()));
+ updateRemotes();
+ return true;
+}
+
+KLircClient::~KLircClient()
+{
+// if(theSocket)
+ delete theSocket;
+}
+
+void KLircClient::slotClosed()
+{
+ delete theSocket;
+ theSocket = 0;
+ emit connectionClosed();
+}
+
+const QStringList KLircClient::remotes() const
+{
+ QStringList remotes;
+ for(QMap<QString, QStringList>::ConstIterator i = theRemotes.begin(); i != theRemotes.end(); ++i)
+ remotes.append(i.key());
+ remotes.sort();
+ return remotes;
+}
+
+const QStringList KLircClient::buttons(const QString &theRemote) const
+{
+ return theRemotes[theRemote];
+}
+
+void KLircClient::slotRead()
+{
+ while (theSocket->bytesAvailable())
+ {
+ QString line = readLine();
+ if (line == "BEGIN")
+ {
+ // BEGIN
+ // <command>
+ // [SUCCESS|ERROR]
+ // [DATA
+ // n
+ // n lines of data]
+ // END
+ line = readLine();
+ if (line == "SIGHUP")
+ {
+ // Configuration changed
+ do line = readLine();
+ while (!line.isEmpty() && line != "END");
+ updateRemotes();
+ return;
+ }
+ else if (line == "LIST")
+ {
+ // remote control list
+ if (readLine() != "SUCCESS" || readLine() != "DATA")
+ {
+ do line = readLine();
+ while (!line.isEmpty() && line != "END");
+ return;
+ }
+ QStringList remotes;
+ int count = readLine().toInt();
+ for (int i = 0; i < count; ++i)
+ remotes.append(readLine());
+ do line = readLine();
+ while (!line.isEmpty() && line != "END");
+ if (line.isEmpty())
+ return; // abort on corrupt data
+ for (QStringList::ConstIterator it = remotes.begin(); it != remotes.end(); ++it)
+ sendCommand("LIST " + *it);
+ return;
+ }
+ else if (line.left(4) == "LIST")
+ {
+ // button list
+ if (readLine() != "SUCCESS" || readLine() != "DATA")
+ {
+ do line = readLine();
+ while (!line.isEmpty() && line != "END");
+ return;
+ }
+ QString remote = line.mid(5);
+ QStringList buttons;
+ int count = readLine().toInt();
+ for (int i = 0; i < count; ++i)
+ {
+ // <code> <name>
+ QString btn = readLine().mid(17);
+ if(btn.isNull()) break;
+ if(btn.startsWith("'") && btn.endsWith("'"))
+ btn = btn.mid(1, btn.length() - 2);
+ buttons.append(btn);
+ }
+ theRemotes.insert(remote, buttons);
+ }
+ do line = readLine();
+ while (!line.isEmpty() && line != "END");
+ listIsUpToDate = true;
+ emit remotesRead();
+ }
+ else
+ {
+ // <code> <repeat> <button name> <remote control name>
+ line.remove(0, 17); // strip code
+ int pos = line.find(' ');
+ if (pos < 0) return;
+ bool ok;
+ int repeat = line.left(pos).toInt(&ok, 16);
+ if (!ok) return;
+ line.remove(0, pos + 1);
+
+ pos = line.find(' ');
+ if (pos < 0) return;
+ QString btn = line.left(pos);
+ if(btn.startsWith("'") && btn.endsWith("'"))
+ btn = btn.mid(1, btn.length() - 2);
+ line.remove(0, pos + 1);
+
+ emit commandReceived(line, btn, repeat);
+ }
+ }
+}
+
+void KLircClient::updateRemotes()
+{
+ listIsUpToDate = false;
+ theRemotes.clear();
+ sendCommand("LIST");
+}
+
+bool KLircClient::isConnected() const
+{
+ if(!theSocket) return false;
+ return theSocket->state() == QSocket::Connected;
+}
+
+bool KLircClient::haveFullList() const
+{
+ return listIsUpToDate;
+}
+
+const QString KLircClient::readLine()
+{
+ if (!theSocket->canReadLine())
+ { bool timeout;
+ // FIXME: possible race condition -
+ // more might have arrived between canReadLine and waitForMore
+ theSocket->waitForMore(500, &timeout);
+ if (timeout)
+ { // something's wrong. there ain't no line comin!
+ return QString::null;
+ }
+ }
+ QString line = theSocket->readLine();
+ line.truncate(line.length() - 1);
+ return line;
+}
+
+void KLircClient::sendCommand(const QString &command)
+{
+ QString cmd = command + "\n";
+ theSocket->writeBlock(QFile::encodeName( cmd ), cmd.length());
+}
+
+
+#include "klircclient.moc"
diff --git a/kdelirc/irkick/klircclient.h b/kdelirc/irkick/klircclient.h
new file mode 100644
index 0000000..ea5fa75
--- /dev/null
+++ b/kdelirc/irkick/klircclient.h
@@ -0,0 +1,114 @@
+//
+//
+// C++ Interface: $MODULE$
+//
+// Description:
+//
+//
+// Author: Gav Wood <gav@kde.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef KLIRCCLIENT_H
+#define KLIRCCLIENT_H
+
+#include <qobject.h>
+#include <qmap.h>
+#include <qstring.h>
+#include <qstringlist.h>
+
+class QSocket;
+class QSocketNotifier;
+
+/**
+@author Malte Starostik
+@author Gav Wood
+*/
+
+class KLircClient: public QObject
+{
+ Q_OBJECT
+
+private:
+ struct lirc_config *theConfig;
+ QSocket *theSocket;
+ QSocketNotifier *theNotifier;
+ QMap<QString, QStringList> theRemotes;
+ bool listIsUpToDate;
+
+ void updateRemotes();
+ void sendCommand(const QString &command);
+ const QString readLine();
+
+private slots:
+ void slotRead();
+ void slotClosed();
+
+signals:
+ /**
+ * Emitted when the list of controls / buttons was completely read
+ */
+ void remotesRead();
+
+ /**
+ * Emitted when a IR command was received
+ *
+ * The arguments are the name of the remote control used,
+ * the name of the button pressed and the repeat counter.
+ *
+ * The signal is emitted repeatedly as long as the button
+ * on the remote control remains pressed.
+ * The repeat counter starts with 0 and increases
+ * every time this signal is emitted.
+ */
+ void commandReceived(const QString &remote, const QString &button, int repeatCounter);
+
+ /**
+ * Emitted when the Lirc connection is closed.
+ */
+ void connectionClosed();
+
+public:
+ /**
+ * Query status of connection.
+ *
+ * @returns true if connected to lircd.
+ */
+ bool isConnected() const;
+
+ /**
+ * Query status of remote list.
+ *
+ * Make sure this is true before calling remotes()/buttons(...).
+ *
+ * @returns true if up to date.
+ */
+ bool haveFullList() const;
+
+ /**
+ * Retrieve list of remote controls.
+ *
+ * @returns said list.
+ */
+ const QStringList remotes() const;
+
+ /**
+ * Retrieve list of buttons of a praticular remote control.
+ *
+ * @returns said list.
+ */
+ const QStringList buttons(const QString &theRemote) const;
+
+ /**
+ * Connects to lirc.
+ *
+ * @returns true if connection is made.
+ */
+ bool connectToLirc();
+
+ KLircClient(QWidget *parent = 0, const char *name = 0);
+ ~KLircClient();
+};
+
+#endif
diff --git a/kdelirc/irkick/lo16-app-irkick.png b/kdelirc/irkick/lo16-app-irkick.png
new file mode 100644
index 0000000..d142dff
--- /dev/null
+++ b/kdelirc/irkick/lo16-app-irkick.png
Binary files differ
diff --git a/kdelirc/irkick/lo32-app-irkick.png b/kdelirc/irkick/lo32-app-irkick.png
new file mode 100644
index 0000000..5ffc180
--- /dev/null
+++ b/kdelirc/irkick/lo32-app-irkick.png
Binary files differ
diff --git a/kdelirc/irkick/main.cpp b/kdelirc/irkick/main.cpp
new file mode 100644
index 0000000..956d000
--- /dev/null
+++ b/kdelirc/irkick/main.cpp
@@ -0,0 +1,39 @@
+/***************************************************************************
+ main.cpp - Implementation of the main window
+ -------------------
+ copyright : (C) 2002 by Gav Wood
+ email : gav@kde.org
+***************************************************************************/
+
+// This program is free software.
+
+#include <klocale.h>
+#include <kcmdlineargs.h>
+#include <kwin.h>
+#include <kaboutdata.h>
+#include <kglobal.h>
+#include <kdebug.h>
+#include <kuniqueapplication.h>
+
+#include "irkick.h"
+
+extern "C" KDE_EXPORT int kdemain(int argc, char *argv[])
+{
+ KAboutData *aboutData = new KAboutData("irkick", I18N_NOOP("IRKick"), VERSION, I18N_NOOP("The KDE Infrared Remote Control Server"), KAboutData::License_GPL, "(c) 2003, Gav Wood", 0, 0, "gav@kde.org");
+ aboutData->addAuthor("Gav Wood", I18N_NOOP("Author"), "gav@kde.org", "http://www.indigoarchive.net/gav/");
+ aboutData->addCredit("Malte Starostik", I18N_NOOP("Original LIRC interface code"), "malte.starostik@t-online.de");
+ aboutData->addCredit("Dirk Ziegelmeier", I18N_NOOP("Ideas, concept code"), "dirk@ziegelmeier.net");
+ aboutData->addCredit("Zsolt Rizsanyi", I18N_NOOP("Random patches"), "rizsanyi@myrealbox.com");
+ aboutData->addCredit("Antonio Larrosa Jiménez", I18N_NOOP("Ideas"), "larrosa@kde.org");
+
+ KCmdLineArgs::init( argc, argv, aboutData );
+ KUniqueApplication::addCmdLineOptions();
+ KUniqueApplication app;
+ KGlobal::locale()->insertCatalogue( "kdelirc" );
+ app.disableSessionManagement();
+ IRKick *theIRKick = new IRKick("IRKick");
+
+ int ret = app.exec();
+ delete theIRKick;
+ return ret;
+}