2
* Copyright (C) 2007, 2008, 2009, 2010 Ivan Cukic <ivan.cukic(at)kde.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser/Library General Public License version 2,
6
* or (at your option) any later version, as published by the Free
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU Lesser/Library General Public License for more details
14
* You should have received a copy of the GNU Lesser/Library General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
#include "SystemServices.h"
23
#include <KStandardDirs>
29
#define LinkOrCopy(source, destination) \
30
kDebug() << "Models::LinkOrCopy:" \
31
<< source << destination; \
32
if (!QFile::link((source), (destination))) { \
33
kDebug() << "Models::LinkOrCopy:" \
34
<< "Linking failed ... copying"; \
35
QFile::copy((source), (destination)); \
38
SystemServices::SystemServices()
39
: FolderModel(SystemServices::path(), QDir::Name)
41
setSelfTitle(i18n("System"));
42
setSelfIcon(KIcon("computer"));
45
if (dir.entryList(QDir::Files | QDir::NoDotAndDotDot).size() == 0) {
47
QStringList applications;
55
foreach (const QString & serviceAlternatives, applications) {
56
foreach (const QString & serviceName, serviceAlternatives.split('|')) {
57
const KService::Ptr service = KService::serviceByStorageId(serviceName);
59
QFileInfo file(service->entryPath());
62
dir.absolutePath() + '/' +
63
QString::number(index++) + '_' + file.fileName());
71
SystemServices::~SystemServices()
75
QString SystemServices::path()
77
QString path = KStandardDirs::locateLocal("data", "lancelot", true);
78
if (!path.endsWith('/')) {
81
path += "/systemservices/";
90
} // namespace Lancelot