Upstream tarball 10153
[amule.git] / src / utils / plasmamule / plasma-engine-plasmamule.h
blob7bcb2c8c903f509c7cd8374e64f6baa1340c7ead
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2010 Werner Mahr (Vollstrecker) <amule@vollstreckernet.de>
5 //
6 // Any parts of this program contributed by third-party developers are copyrighted
7 // by their respective authors.
8 //
9 // This program is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 3 of the License, or
12 // (at your option) any later version.
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #ifndef PLASMAMULENGINE_H
25 #define PLASMAMULENGINE_H
27 #include <kdirwatch.h>
28 #include <plasma/dataengine.h>
30 #include <QtDBus/QtDBus>
31 #include <QFile>
32 #include <QStringList>
34 class PlasmaMuleEngine : public Plasma::DataEngine
37 Q_OBJECT
39 public:
40 PlasmaMuleEngine(QObject* parent, const QVariantList& args);
41 QStringList sources() const;
42 void init ();
44 public Q_SLOTS:
45 Q_SCRIPTABLE void engine_add_link (const QString &link, const int &category);
47 protected:
48 bool sourceRequestEvent(const QString& name);
49 bool updateSourceEvent(const QString& name);
51 protected Q_SLOTS:
52 void file_changed (const QString &path);
53 void new_file (const QString &path);
54 void timeout ();
56 private:
57 void initVals ();
58 void regDbus ();
60 bool m_OSActive, m_timer;
61 KDirWatch m_dirwatcher;
62 QFile m_OSFile;
63 QStringList m_incoming_dirs;
64 QString Home;
67 class EngineAdaptor: public QDBusAbstractAdaptor
69 Q_OBJECT
70 Q_CLASSINFO("D-Bus Interface", "org.amule.engine")
71 Q_CLASSINFO("D-Bus Introspection", ""
72 " <interface name=\"org.amule.engine\" >\n"
73 " <method name=\"engine_add_link\" >\n"
74 " <arg direction=\"in\" type=\"as\" name=\"link\" />\n"
75 " <arg direction=\"in\" type=\"i\" name=\"category\" />\n"
76 " </method>\n"
77 " </interface>\n"
78 "")
80 public:
81 EngineAdaptor(QObject *parent);
82 virtual ~EngineAdaptor();
84 public Q_SLOTS:
85 void engine_add_link(const QString &link, const int &category);
88 #endif // PLASMAMULENGINE_H