Fix language getting reset to system default on saving preferences
[amule.git] / src / utils / plasmamule / plasmamule-engine-feeder.cpp
blob1a85d0b7d8011bbcc0e841f544e1ac5dba438301
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
23 #include "plasmamule-dbus.h"
25 #include <plasma/dataengine.h>
26 #include <plasma/applet.h>
28 #include <QApplication>
29 #include <QMenu>
30 #include <QStringList>
32 int main(int argc, char *argv[])
34 QApplication app(argc, argv);
36 Plasma::Applet* aMuleEngine = new Plasma::Applet;
37 Plasma::DataEngine::Data data = aMuleEngine->dataEngine("plasmamule")->query(QString("cat_names"));
39 QStringList cat_names = data["cat_names"].toStringList();
40 QMenu *menu = new QMenu;
42 for (QStringList::const_iterator constIterator = cat_names.constBegin(); constIterator != cat_names.constEnd(); constIterator++)
44 menu->addAction(*constIterator);
45 if (constIterator != cat_names.constEnd())
47 menu->addSeparator();
51 QAction *cat_selection = menu->exec(QCursor::pos());
52 if (cat_selection)
54 for (int i = 1; i < argc; i++)
56 sendLinkToEngine (argv[i], cat_names.indexOf(cat_selection->text()), 0, 0);
60 QCoreApplication::exit(0);