2
Copyright (c) 2009 David Faure <faure@kde.org>
4
This library is free software; you can redistribute it and/or modify
5
it under the terms of the GNU Lesser General Public License as published by
6
the Free Software Foundation; either version 2 of the License or ( at
7
your option ) version 3 or, at the discretion of KDE e.V. ( which shall
8
act as a proxy as in section 14 of the GPLv3 ), any later version.
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Library General Public License for more details.
15
You should have received a copy of the GNU Lesser General Public License
16
along with this library; see the file COPYING.LIB. If not, write to
17
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
Boston, MA 02110-1301, USA.
21
#include <QStringList>
27
* The module manager is responsible for discovering the modules (i.e. tabs,
28
* i.e. plugins, i.e. desktop files) to use in the sidebar, and for updating them.
29
* This class contains no GUI code, so that it can be unit-tested.
34
ModuleManager(KConfigGroup* config);
36
/// Returns the filenames of the modules that should be shown in the GUI
37
/// Example: "home.desktop" (default module), "dirtree1.desktop" (added by user)...
38
QStringList modules() const;
40
/// Returns the names of the available plugin libraries
41
/// Example: konqsidebar_tree, konqsidebar_web
42
KService::List availablePlugins() const;
44
/// Returns the paths of all modules that match a given filter, like websidebarplugin*.desktop
45
QStringList localModulePaths(const QString& filter) const;
47
/// Returns the relative path in the "data" resource, for a given module
48
QString moduleDataPath(const QString& fileName) const;
49
/// Returns the relative path of the entries directory in the "data" resource
50
QString relativeDataPath() const { return "konqsidebartng/entries/"; }
51
/// Returns the full path for a given module. TEMP HACK, TO BE REMOVED
52
QString moduleFullPath(const QString& fileName) const;
54
void rollbackToDefault();
56
void setModuleName(const QString& fileName, const QString& moduleName);
57
void setModuleUrl(const QString& fileName, const KUrl& url);
58
void setModuleIcon(const QString& fileName, const QString& icon);
60
/// Find a unique filename for a new module, based on a template name
61
/// like "dirtree%1.desktop".
62
/// @return the full path. templ is modified to contain the filename only.
63
QString addModuleFromTemplate(QString& templ);
65
/// Called when a module was added
66
void moduleAdded(const QString& fileName);
68
/// Remove a module (deletes the local .desktop file)
69
void removeModule(const QString& fileName);
72
void sortGlobalEntries(QStringList& fileNames) const;
74
KConfigGroup *m_config; // owned by SidebarWidget
75
QString m_localPath; // local path