summaryrefslogtreecommitdiffstats
path: root/tdelirc/irkick
diff options
context:
space:
mode:
Diffstat (limited to 'tdelirc/irkick')
-rw-r--r--tdelirc/irkick/CMakeLists.txt60
-rw-r--r--tdelirc/irkick/Makefile.am42
-rw-r--r--tdelirc/irkick/icons/CMakeLists.txt13
-rw-r--r--tdelirc/irkick/icons/Makefile.am3
-rw-r--r--tdelirc/irkick/irkick.cpp336
-rw-r--r--tdelirc/irkick/irkick.desktop116
-rw-r--r--tdelirc/irkick/irkick.h133
-rw-r--r--tdelirc/irkick/irkick.project12
-rw-r--r--tdelirc/irkick/kdedmodule_stub.h34
-rw-r--r--tdelirc/irkick/klircclient.cpp241
-rw-r--r--tdelirc/irkick/klircclient.h115
-rw-r--r--tdelirc/irkick/main.cpp39
12 files changed, 1144 insertions, 0 deletions
diff --git a/tdelirc/irkick/CMakeLists.txt b/tdelirc/irkick/CMakeLists.txt
new file mode 100644
index 0000000..d8d14d9
--- /dev/null
+++ b/tdelirc/irkick/CMakeLists.txt
@@ -0,0 +1,60 @@
+#################################################
+#
+# (C) 2012 Golubev Alexander
+# fatzer2 (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+add_subdirectory( icons )
+
+include_directories(
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_SOURCE_DIR}/tdelirc/tdelirc
+ ${TDE_INCLUDE_DIR}
+ ${TQT_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+ ${CMAKE_BINARY_DIR}/tdelirc/tdelirc
+)
+
+
+##### irkick_common (static) ####################
+
+tde_add_library( irkick_common STATIC_PIC AUTOMOC
+ SOURCES irkick.cpp irkick.skel
+ irkick.stub klircclient.cpp
+ LINK tdeui-shared tdelirc-static
+)
+
+
+##### irkick (tdeinit) ##########################
+
+tde_add_tdeinit_executable( irkick AUTOMOC
+ SOURCES main.cpp
+ LINK irkick_common-static
+)
+
+
+##### icons #####################################
+
+tde_install_icons( )
+
+
+##### other data ################################
+
+install( FILES irkick.desktop
+ DESTINATION ${XDG_APPS_INSTALL_DIR}
+)
+
+install( FILES irkick.desktop
+ DESTINATION ${AUTOSTART_INSTALL_DIR}
+)
+
diff --git a/tdelirc/irkick/Makefile.am b/tdelirc/irkick/Makefile.am
new file mode 100644
index 0000000..0e753f7
--- /dev/null
+++ b/tdelirc/irkick/Makefile.am
@@ -0,0 +1,42 @@
+SUBDIRS = icons
+
+bin_PROGRAMS =
+lib_LTLIBRARIES =
+noinst_LTLIBRARIES = libirkick_common.la
+tdeinit_LTLIBRARIES = irkick.la
+
+CLEANFILES = dummy.cpp
+
+libirkick_common_la_LIBADD = $(LIB_TDECORE) $(LIB_TDEUI) $(LIB_KSYCOCA) ../tdelirc/libtdelirc.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_TDECORE) ../tdelirc/libtdelirc.la
+
+noinst_HEADERS = irkick.h klircclient.h irkick_stub.h
+
+INCLUDES = -I$(srcdir)/../tdelirc $(all_includes)
+
+KDE_ICON = AUTO
+METASOURCES = AUTO
diff --git a/tdelirc/irkick/icons/CMakeLists.txt b/tdelirc/irkick/icons/CMakeLists.txt
new file mode 100644
index 0000000..ffd9b18
--- /dev/null
+++ b/tdelirc/irkick/icons/CMakeLists.txt
@@ -0,0 +1,13 @@
+#################################################
+#
+# (C) 2012 Golubev Alexander
+# fatzer2 (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+tde_install_icons( DESTINATION
+ ${DATA_INSTALL_DIR}/irkick/icons )
diff --git a/tdelirc/irkick/icons/Makefile.am b/tdelirc/irkick/icons/Makefile.am
new file mode 100644
index 0000000..307658e
--- /dev/null
+++ b/tdelirc/irkick/icons/Makefile.am
@@ -0,0 +1,3 @@
+irkickiconsdir = $(kde_datadir)/irkick/icons
+irkickicons_ICON = AUTO
+
diff --git a/tdelirc/irkick/irkick.cpp b/tdelirc/irkick/irkick.cpp
new file mode 100644
index 0000000..2d042f0
--- /dev/null
+++ b/tdelirc/irkick/irkick.cpp
@@ -0,0 +1,336 @@
+/***************************************************************************
+ irkick.cpp - Implementation of the main window
+ -------------------
+ copyright : (C) 2002 by Gav Wood
+***************************************************************************/
+
+// This program is free software.
+
+#include <tqwidget.h>
+#include <tqdialog.h>
+#include <tqtooltip.h>
+#include <tqregexp.h>
+#include <tqtimer.h>
+#include <tqevent.h>
+
+#include <tdeversion.h>
+#include <tdeapplication.h>
+#include <tdeaction.h>
+#if !(TDE_VERSION_MINOR<=1 && TDE_VERSION_RELEASE<=5)
+#include <tdeactioncollection.h>
+#endif
+#include <ksimpleconfig.h>
+#include <ksystemtray.h>
+#include <kiconloader.h>
+#include <kpassivepopup.h>
+#include <tdemessagebox.h>
+#include <tdepopupmenu.h>
+#include <kdebug.h>
+#include <tdelocale.h>
+#include <tdeaboutdialog.h>
+#include <tdeabouttde.h>
+#include <twinmodule.h>
+#include <twin.h>
+#include <khelpmenu.h>
+#include <tdeglobal.h>
+#include <kstdguiitem.h>
+
+#include <dcopclient.h>
+#include <dcopref.h>
+
+#include "profileserver.h"
+#include "irkick.h"
+
+void IRKTrayIcon::mousePressEvent(TQMouseEvent *e)
+{
+ KSystemTray::mousePressEvent(new TQMouseEvent(TQEvent::MouseButtonPress, e->pos(), e->globalPos(), e->button() == Qt::LeftButton ? Qt::RightButton : e->button(), e->state()));
+}
+
+IRKick::IRKick(const TQCString &obj) : TQObject(), DCOPObject(obj), npApp(TQString())
+{
+ kapp->dcopClient()->setDefaultObject(obj);
+ theClient = new KLircClient();
+
+ theTrayIcon = new IRKTrayIcon();
+ if(theClient->isConnected())
+ { theTrayIcon->setPixmap(SmallIcon("irkick"));
+ TQToolTip::add(theTrayIcon, i18n("TDE Lirc Server: Ready."));
+ }
+ else
+ { theTrayIcon->setPixmap(SmallIcon("irkickoff"));
+ TQToolTip::add(theTrayIcon, i18n("TDE Lirc Server: No infra-red remote controls found."));
+ TQTimer::singleShot(10000, this, TQT_SLOT(checkLirc()));
+ }
+ theFlashOff = new TQTimer(theTrayIcon);
+ connect(theFlashOff, TQT_SIGNAL(timeout()), TQT_SLOT(flashOff()));
+
+ theResetCount = 0;
+ slotReloadConfiguration();
+ connect(theClient, TQT_SIGNAL(connectionClosed()), this, TQT_SLOT(slotClosed()));
+ connect(theClient, TQT_SIGNAL(remotesRead()), this, TQT_SLOT(resetModes()));
+ connect(theClient, TQT_SIGNAL(commandReceived(const TQString &, const TQString &, int)), this, TQT_SLOT(gotMessage(const TQString &, const TQString &, int)));
+
+ theTrayIcon->contextMenu()->changeTitle(0, "IRKick");
+ theTrayIcon->contextMenu()->insertItem(SmallIcon( "configure" ), i18n("&Configure..."), this, TQT_SLOT(slotConfigure()));
+ theTrayIcon->contextMenu()->insertSeparator();
+ theTrayIcon->contextMenu()->insertItem(SmallIcon( "help" ), KStdGuiItem::help().text(), (new KHelpMenu(theTrayIcon, TDEGlobal::instance()->aboutData()))->menu());
+ theTrayIcon->actionCollection()->action("file_quit")->disconnect(TQT_SIGNAL(activated()));
+ connect(theTrayIcon->actionCollection()->action("file_quit"), TQT_SIGNAL(activated()), TQT_SLOT(doQuit()));
+
+ theTrayIcon->show();
+}
+
+IRKick::~IRKick()
+{
+ delete theTrayIcon;
+ for(TQMap<TQString,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);
+ TQTimer::singleShot(1000, this, TQT_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
+ TQTimer::singleShot(10000, this, TQT_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 TDE?"), 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;
+ }
+ TDEApplication::kApplication()->quit();
+}
+
+void IRKick::resetModes()
+{
+ if(theResetCount > 1)
+ KPassivePopup::message("IRKick", i18n("Resetting all modes."), SmallIcon("irkick"), theTrayIcon);
+ if(!theResetCount)
+ allModes.generateNulls(theClient->remotes());
+
+ TQStringList remotes = theClient->remotes();
+ for(TQStringList::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()
+{
+ TDEApplication::startServiceByDesktopName("kcmlirc");
+}
+
+void IRKick::updateModeIcons()
+{
+ for(TQMap<TQString,TQString>::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(TDEIconLoader().loadIcon(mode.iconFile(), TDEIcon::Panel));
+ TQToolTip::add(currentModeIcons[i.key()], mode.remoteName() + ": <b>" + mode.name() + "</b>");
+ }
+ }
+}
+
+bool IRKick::getPrograms(const IRAction &action, TQStringList &programs)
+{
+ DCOPClient *theDC = TDEApplication::dcopClient();
+ programs.clear();
+
+ if(action.unique())
+ { if(theDC->isApplicationRegistered(action.program().utf8()))
+ programs += action.program();
+ }
+ else
+ {
+ TQRegExp r = TQRegExp("^" + action.program() + "-(\\d+)$");
+ // find all instances...
+ QCStringList buf = theDC->registeredApplications();
+ for(QCStringList::iterator i = buf.begin(); i != buf.end(); ++i)
+ {
+ TQString program = TQString::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)
+ { TQValueList<WId> s = KWinModule().stackingOrder();
+ // go through all the (ordered) window pids
+ for(TQValueList<WId>::iterator i = s.fromLast(); i != s.end(); i--)
+ { int p = KWin::info(*i).pid;
+ TQString id = action.program() + "-" + TQString().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)
+ { TQValueList<WId> s = KWinModule().stackingOrder();
+ // go through all the (ordered) window pids
+ for(TQValueList<WId>::iterator i = s.begin(); i != s.end(); ++i)
+ { int p = KWin::info(*i).pid;
+ TQString id = action.program() + "-" + TQString().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 = TDEApplication::dcopClient();
+ TQStringList programs;
+
+ if(!getPrograms(action, programs)) return;
+
+ // if programs.size()==0 here, then the app is definately not running.
+ if(action.autoStart() && !programs.size())
+ { TQString sname = ProfileServer::profileServer()->getServiceName(action.program());
+ if(!sname.isNull())
+ {
+ KPassivePopup::message("IRKick", i18n("Starting <b>%1</b>...").arg(action.application()), SmallIcon("irkick"), theTrayIcon);
+ TDEApplication::startServiceByDesktopName(sname);
+ }
+ }
+ if(action.isJustStart()) return;
+
+ if(!getPrograms(action, programs)) return;
+
+ for(TQStringList::iterator i = programs.begin(); i != programs.end(); ++i)
+ { const TQString &program = *i;
+ if(theDC->isApplicationRegistered(program.utf8()))
+ { TQByteArray data; TQDataStream 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 TQVariant::Int: arg << (*j).toInt(); break;
+ case TQVariant::CString: arg << (*j).toCString(); break;
+ case TQVariant::StringList: arg << (*j).toStringList(); break;
+ case TQVariant::UInt: arg << (*j).toUInt(); break;
+ case TQVariant::Bool: arg << (*j).toBool(); break;
+ case TQVariant::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 TQString &theRemote, const TQString &theButton, int theRepeatCounter)
+{
+ kdDebug() << "Got message: " << theRemote << ": " << theButton << " (" << theRepeatCounter << ")" << endl;
+ theTrayIcon->setPixmap(SmallIcon("irkickflash"));
+ theFlashOff->start(200, true);
+ if(!npApp.isNull())
+ {
+ TQString theApp = npApp;
+ npApp = TQString();
+ // send notifier by DCOP to npApp/npModule/npMethod(theRemote, theButton);
+ TQByteArray data; TQDataStream arg(data, IO_WriteOnly);
+ arg << theRemote << theButton;
+ TDEApplication::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(TQString app, TQString module, TQString method)
+{
+ npApp = app;
+ npModule = module;
+ npMethod = method;
+}
+
+void IRKick::dontStealNextPress()
+{
+ npApp = TQString();
+}
+
+#include "irkick.moc"
diff --git a/tdelirc/irkick/irkick.desktop b/tdelirc/irkick/irkick.desktop
new file mode 100644
index 0000000..4f5cbb9
--- /dev/null
+++ b/tdelirc/irkick/irkick.desktop
@@ -0,0 +1,116 @@
+[Desktop Entry]
+Type=Service
+Name=IRKick
+Name[sv]=IRkick
+GenericName=TDE LIRC Server
+GenericName[ar]=خادم LIRC لكدى
+GenericName[bg]=Сървър LIRC
+GenericName[br]=Servijer LIRC TDE
+GenericName[bs]=TDE LIRC server
+GenericName[ca]=Servidor LIRC de TDE
+GenericName[cs]=LIRC server pro TDE
+GenericName[cy]=Gweinydd LIRC TDE
+GenericName[da]=TDE LIRC-server
+GenericName[de]=TDE LIRC-Server
+GenericName[el]=Εξυπηρετητής LIRC του TDE
+GenericName[eo]=TDE LIRC-servilo
+GenericName[es]=Servidor LIRC de TDE
+GenericName[et]=TDE LIRC server
+GenericName[eu]=TDE LIRC Zerbitzaria
+GenericName[fa]=TDE LIRC کارساز
+GenericName[fi]=TDE:n LIRC-palvelin
+GenericName[fr]=Serveur TDE LIRC
+GenericName[ga]=Freastalaí LIRC TDE
+GenericName[he]=שרת ה-LIRC של TDE
+GenericName[hu]=TDE LIRC szolgáltatás
+GenericName[is]=TDE LIRC þjónn
+GenericName[it]=Server LIRC di TDE
+GenericName[ja]=TDE LIRC サーバ
+GenericName[ka]=TDE LIRC სერვერი
+GenericName[kk]=TDE LIRC сервері
+GenericName[km]=ម៉ាស៊ីន​បម្រើ TDE LIRC
+GenericName[lt]=TDE LIRC serveris
+GenericName[nb]=TDE LIRC-tjener
+GenericName[nds]=TDE LIRC-Server
+GenericName[ne]=TDE LIRC सर्भर
+GenericName[nl]=TDE LIRC-server
+GenericName[nn]=TDE LIRC-tenar
+GenericName[pa]=TDE LIRC ਸਰਵਰ
+GenericName[pl]=Serwer LIRC dla TDE
+GenericName[pt]=Servidor de LIRC do TDE
+GenericName[pt_BR]=Servidor LIRC do TDE
+GenericName[ru]=Сервер LIRC для TDE
+GenericName[sk]=TDE LIRC server
+GenericName[sl]=Strežnik TDE LIRC
+GenericName[sr]=TDE-ов LIRC сервер
+GenericName[sr@Latn]=TDE-ov LIRC server
+GenericName[sv]=TDE:s LIRC-server
+GenericName[ta]=TDE LIRC சேவகன்
+GenericName[tr]=TDE LIRC Sunucusu
+GenericName[uk]=Сервер LIRC для TDE
+GenericName[uz]=TDE LIRC serveri
+GenericName[uz@cyrillic]=TDE LIRC сервери
+GenericName[zh_CN]=TDE LIRC 服务器
+GenericName[zh_TW]=TDE LIRC 伺服器
+
+X-TDE-Library=irkick
+X-TDE-autostart-after=panel
+X-TDE-StartupNotify=false
+X-DCOP-ServiceType=Unique
+X-TDE-autostart-condition=irkickrc:General:AutoStart:false
+Categories=Qt;TDE;Utility;X-TDE-Utilities-Peripherals;
+
+Exec=irkick
+Icon=irkick
+DocPath=irkick/index.html
+Comment=TDE Linux infrared remote control server.
+Comment[ar]=خادم كدى للتحكّم عن بعد بالأشعة تحت الحمراء في لينكس.
+Comment[bg]=Сървър за управление на дистанционно устройство с инфрачервени лъчи
+Comment[bs]=TDEov server za Linux infracrveno daljinsko upravljanje (Linux Infrared Remote Control).
+Comment[ca]=Servidor de control remot per infrarojos de Linux TDE.
+Comment[cs]=Server dálkového ovládání pro TDE.
+Comment[cy]=Gweinydd rheolydd pell isgoch Linux TDE
+Comment[da]=TDE Linux infrarød fjernbetjeningsserver.
+Comment[de]=TDE Linux Infrarot Fernsteuerungsserver.
+Comment[el]=Εξυπηρετητής τηλεχειριστηρίου υπερύθρων του Linux για το TDE.
+Comment[es]=Servidor de control remoto por infrarrojos de TDE
+Comment[et]=TDE Linuxi infrapuna kaugjuhtimise server.
+Comment[eu]=TDE Linux infrasare urruneko aginte zerbitzaria.
+Comment[fa]=TDE Linuxکارساز کنترل از راه دور مادون قرمز
+Comment[fi]=TDE:n Linux infrapunalla toimivien kauko-ohjainten ohjauspalvelin.
+Comment[fr]=Serveur de contrôle distant infrarouge sous Linux pour TDE.
+Comment[ga]=Freastalaí TDE cianrialaithe infridhearg Linux
+Comment[he]=שרת לשלט רחוק עבור TDE.
+Comment[hi]=केडीई लिनक्स इन्फ्रारेड रिमोट नियंत्रण सर्वर.
+Comment[hu]=TDE Linux szolgáltatás infravörös távirányítók kezeléséhez
+Comment[is]=TDE Linux innrauða fjarstýringarstjórnborðið
+Comment[it]=Server TDE per i telecomandi ad infrarossi
+Comment[ja]=TDE Linux 赤外線リモートコントロールサーバ
+Comment[ka]= TDE ლინუქსის ინფრაწითელი დაშორებული მართვის სერვერი
+Comment[kk]=TDE Linux инфрақызыл порт арқылы басқару сервері.
+Comment[km]=ម៉ាស៊ីន​បម្រើ​បញ្ជា TDE Linux infrared ពី​ចម្ងាយ ។
+Comment[lt]=TDE Linux infraraudonųjų spindulių sąsajos nuotolinio valdymo serveris
+Comment[nb]=TDE Linux-tjener for infrarød fjernkontroll
+Comment[nds]=TDE-Linux Infraroot-Feernbedeenkuntrullserver
+Comment[ne]=TDE लिनक्स अवरक्त टाढाको नियन्त्रण सर्भर ।
+Comment[nl]=TDE-server voor infrarood-afstandsbediening.
+Comment[nn]=TDE-tenar for infraraud fjernkontroll.
+Comment[pa]=TDE ਲੀਨਕਸ ਇੰਫਰਾਰੈੱਡ ਰਿਮੋਟ ਕੰਟਰੋਲ ਸਰਵਰ ਹੈ।
+Comment[pl]=Serwer obsługi pilotów dla TDE.
+Comment[pt]=Servidor de comandos à distância por infravermelhos do TDE.
+Comment[pt_BR]=servidor de controle infra-vermelho do Linux no TDE
+Comment[ro]=Server de control al telecomenziilor în infraroşu
+Comment[ru]=Сервер управления TDE через инфракрасный порт.
+Comment[sk]=TDE server pre infračervené vzdialené ovládanie pre Linux.
+Comment[sl]=Strežnik TDE Linux za infrardeči daljninski upravljalnik
+Comment[sr]=TDE-ов сервер за контролу инфрацрвених даљинских управљача у Linux-у.
+Comment[sr@Latn]=TDE-ov server za kontrolu infracrvenih daljinskih upravljača u Linux-u.
+Comment[sv]=Infraröd fjärrkontrollserver
+Comment[ta]=கேடிஇ லினக்ஸ் அகச்சிவப்பு கதிர் தொலைதூர கட்டுப்பாட்டு சேவகன்
+Comment[tg]=Хидматрасони идоракунии дурдасти инфрасурхи TDE Linux.
+Comment[tr]=TDE Linux kızılötesi uzaktan kontrol sunucusu.
+Comment[uk]=Сервер дистанційного керування інфрачервоними пристроями для Linux та TDE.
+Comment[uz]=Infraqizil nur bilan masofadan boshqarish serveri
+Comment[uz@cyrillic]=Инфрақизил нур билан масофадан бошқариш сервери
+Comment[zh_CN]=TDE Linux 红外远程控制服务器。
+Comment[zh_TW]=TDE Linux 紅外線遙控伺服器。
diff --git a/tdelirc/irkick/irkick.h b/tdelirc/irkick/irkick.h
new file mode 100644
index 0000000..786e100
--- /dev/null
+++ b/tdelirc/irkick/irkick.h
@@ -0,0 +1,133 @@
+/***************************************************************************
+ irkick.h - Interface of the main window
+ copyright : (C) 2002 by Gav Wood
+
+***************************************************************************/
+
+// This program is free software.
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef __IRKICK_H
+#define __IRKICK_H
+
+#include <tqstring.h>
+
+#include <ksystemtray.h>
+#include <kdedmodule.h>
+#include <tdeaboutdata.h>
+
+#include <dcopobject.h>
+
+#include "modes.h"
+#include "iractions.h"
+#include "klircclient.h"
+
+class TQMouseEvent;
+
+class IRKTrayIcon: public KSystemTray
+{
+ void mousePressEvent(TQMouseEvent *e);
+
+public:
+ TDEPopupMenu* contextMenu() const { return KSystemTray::contextMenu(); }
+ TDEActionCollection* actionCollection() { return KSystemTray::actionCollection(); }
+
+ IRKTrayIcon(TQWidget *parent = 0, const char *name = 0): KSystemTray(parent, name) {}
+};
+
+class IRKick: public TQObject, public DCOPObject
+{
+ Q_OBJECT
+//
+ K_DCOP
+
+ TQString npApp, npModule, npMethod;
+ TQMap<TQString, TQString> currentModes;
+ TQMap<TQString, IRKTrayIcon *> currentModeIcons;
+ IRActions allActions;
+ int theResetCount;
+ Modes allModes;
+
+ IRKTrayIcon *theTrayIcon;
+ TDEAboutData *aboutData;
+ TQTimer *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 TQStringList remotes() { return theClient->remotes(); }
+
+ /**
+ * Retrieve list of buttons of a praticular remote control.
+ *
+ * @returns said list.
+ */
+ virtual const TQStringList buttons(TQString 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 TQString parameters.
+ */
+ virtual void stealNextPress(TQString app, TQString module, TQString 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 TQString &theRemote, const TQString &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, TQStringList &populous);
+
+public:
+ IRKick(const TQCString &obj);
+ virtual ~IRKick();
+};
+
+#endif
diff --git a/tdelirc/irkick/irkick.project b/tdelirc/irkick/irkick.project
new file mode 100644
index 0000000..b486441
--- /dev/null
+++ b/tdelirc/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/tdelirc/irkick/kdedmodule_stub.h b/tdelirc/irkick/kdedmodule_stub.h
new file mode 100644
index 0000000..57542d2
--- /dev/null
+++ b/tdelirc/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 tdelibs/COPYING.
+*/
+
+#ifndef __KDEDMODULE_STUB__
+#define __KDEDMODULE_STUB__
+
+#include <dcopstub.h>
+#include <tqobject.h>
+#include <dcopobject.h>
+#include <dcopref.h>
+#include <ksharedptr.h>
+
+
+class KDEDModule_stub : virtual public DCOPStub
+{
+public:
+ KDEDModule_stub( const TQCString& app, const TQCString& id );
+ KDEDModule_stub( DCOPClient* client, const TQCString& app, const TQCString& id );
+ explicit KDEDModule_stub( const DCOPRef& ref );
+protected:
+ KDEDModule_stub() : DCOPStub( never_use ) {};
+};
+
+
+#endif
diff --git a/tdelirc/irkick/klircclient.cpp b/tdelirc/irkick/klircclient.cpp
new file mode 100644
index 0000000..b7051fc
--- /dev/null
+++ b/tdelirc/irkick/klircclient.cpp
@@ -0,0 +1,241 @@
+//
+//
+// C++ Implementation: $MODULE$
+//
+// Description:
+//
+//
+// Author: (C) 2002 by Malte Starostik
+// Adaption : Gav Wood <[email protected]>, (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 <tqwidget.h>
+#include <tqdialog.h>
+#include <tqtooltip.h>
+#include <tqsocket.h>
+#include <tqsocketnotifier.h>
+#include <tqfile.h>
+
+#include <tdeapplication.h>
+#include <ksystemtray.h>
+#include <kiconloader.h>
+#include <kpassivepopup.h>
+#include <tdemessagebox.h>
+#include <tdepopupmenu.h>
+#include <kdebug.h>
+#include <tdelocale.h>
+#include <tdeaboutdialog.h>
+#include <tdeabouttde.h>
+
+#include <dcopclient.h>
+#include <dcopref.h>
+
+#include "klircclient.h"
+
+
+KLircClient::KLircClient(TQWidget *parent, const char *name) : TQObject(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 TQSocket;
+ theSocket->setSocket(sock);
+ connect(theSocket, TQT_SIGNAL(readyRead()), TQT_SLOT(slotRead()));
+ connect(theSocket, TQT_SIGNAL(connectionClosed()), TQT_SLOT(slotClosed()));
+ updateRemotes();
+ return true;
+}
+
+KLircClient::~KLircClient()
+{
+// if(theSocket)
+ delete theSocket;
+}
+
+void KLircClient::slotClosed()
+{
+ delete theSocket;
+ theSocket = 0;
+ emit connectionClosed();
+}
+
+const TQStringList KLircClient::remotes() const
+{
+ TQStringList remotes;
+ for(TQMap<TQString, TQStringList>::ConstIterator i = theRemotes.begin(); i != theRemotes.end(); ++i)
+ remotes.append(i.key());
+ remotes.sort();
+ return remotes;
+}
+
+const TQStringList KLircClient::buttons(const TQString &theRemote) const
+{
+ return theRemotes[theRemote];
+}
+
+void KLircClient::slotRead()
+{
+ while (theSocket->bytesAvailable())
+ {
+ TQString 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;
+ }
+ TQStringList 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 (TQStringList::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;
+ }
+ TQString remote = line.mid(5);
+ TQStringList buttons;
+ int count = readLine().toInt();
+ for (int i = 0; i < count; ++i)
+ {
+ // <code> <name>
+ TQString 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;
+ TQString 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() == TQSocket::Connected;
+}
+
+bool KLircClient::haveFullList() const
+{
+ return listIsUpToDate;
+}
+
+const TQString 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 TQString();
+ }
+ }
+ TQString line = theSocket->readLine();
+ line.truncate(line.length() - 1);
+ return line;
+}
+
+void KLircClient::sendCommand(const TQString &command)
+{
+ TQString cmd = command + "\n";
+ theSocket->writeBlock(TQFile::encodeName( cmd ), cmd.length());
+}
+
+
+#include "klircclient.moc"
diff --git a/tdelirc/irkick/klircclient.h b/tdelirc/irkick/klircclient.h
new file mode 100644
index 0000000..3af4637
--- /dev/null
+++ b/tdelirc/irkick/klircclient.h
@@ -0,0 +1,115 @@
+//
+//
+// C++ Interface: $MODULE$
+//
+// Description:
+//
+//
+// Author: Gav Wood <[email protected]>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef KLIRCCLIENT_H
+#define KLIRCCLIENT_H
+
+#include <tqobject.h>
+#include <tqmap.h>
+#include <tqstring.h>
+#include <tqstringlist.h>
+
+class TQSocket;
+class TQSocketNotifier;
+
+/**
+@author Malte Starostik
+@author Gav Wood
+*/
+
+class KLircClient: public TQObject
+{
+ Q_OBJECT
+
+
+private:
+ struct lirc_config *theConfig;
+ TQSocket *theSocket;
+ TQSocketNotifier *theNotifier;
+ TQMap<TQString, TQStringList> theRemotes;
+ bool listIsUpToDate;
+
+ void updateRemotes();
+ void sendCommand(const TQString &command);
+ const TQString 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 TQString &remote, const TQString &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 TQStringList remotes() const;
+
+ /**
+ * Retrieve list of buttons of a praticular remote control.
+ *
+ * @returns said list.
+ */
+ const TQStringList buttons(const TQString &theRemote) const;
+
+ /**
+ * Connects to lirc.
+ *
+ * @returns true if connection is made.
+ */
+ bool connectToLirc();
+
+ KLircClient(TQWidget *parent = 0, const char *name = 0);
+ ~KLircClient();
+};
+
+#endif
diff --git a/tdelirc/irkick/main.cpp b/tdelirc/irkick/main.cpp
new file mode 100644
index 0000000..5d5a791
--- /dev/null
+++ b/tdelirc/irkick/main.cpp
@@ -0,0 +1,39 @@
+/***************************************************************************
+ main.cpp - Implementation of the main window
+ -------------------
+ copyright : (C) 2002 by Gav Wood
+***************************************************************************/
+
+// This program is free software.
+
+#include <tdelocale.h>
+#include <tdecmdlineargs.h>
+#include <twin.h>
+#include <tdeaboutdata.h>
+#include <tdeglobal.h>
+#include <kdebug.h>
+#include <kuniqueapplication.h>
+
+#include "irkick.h"
+
+extern "C" KDE_EXPORT int kdemain(int argc, char *argv[])
+{
+ TDEAboutData *aboutData = new TDEAboutData("irkick", I18N_NOOP("IRKick"), VERSION, I18N_NOOP("The TDE Infrared Remote Control Server"), TDEAboutData::License_GPL, "(c) 2003, Gav Wood", 0, 0, "[email protected]");
+ aboutData->addAuthor("Gav Wood", I18N_NOOP("Author"), "[email protected]", "http://www.indigoarchive.net/gav/");
+ aboutData->addCredit("Malte Starostik", I18N_NOOP("Original LIRC interface code"), "[email protected]");
+ aboutData->addCredit("Dirk Ziegelmeier", I18N_NOOP("Ideas, concept code"), "[email protected]");
+ aboutData->addCredit("Zsolt Rizsanyi", I18N_NOOP("Random patches"), "[email protected]");
+ aboutData->addCredit("Antonio Larrosa Jiménez", I18N_NOOP("Ideas"), "[email protected]");
+
+ TDECmdLineArgs::init( argc, argv, aboutData );
+ KUniqueApplication::addCmdLineOptions();
+ KUniqueApplication app;
+ TDEGlobal::locale()->insertCatalogue( "tdelirc" );
+ app.disableSessionManagement();
+ IRKick *theIRKick = new IRKick("IRKick");
+
+ int ret = app.exec();
+ delete theIRKick;
+ return ret;
+}