~ubuntu-branches/ubuntu/vivid/muon/vivid-proposed

« back to all changes in this revision

Viewing changes to libmuon/MuonBackendsFactory.cpp

  • Committer: Package Import Robot
  • Author(s): Scarlett Clark
  • Date: 2015-03-24 07:36:31 UTC
  • mto: This revision was merged to the branch mainline in revision 86.
  • Revision ID: package-import@ubuntu.com-20150324073631-7nmay5episnfkdlt
Tags: upstream-5.2.2
ImportĀ upstreamĀ versionĀ 5.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
AbstractResourcesBackend* MuonBackendsFactory::backend(const QString& name) const
40
40
{
41
 
    QString data = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("libmuon/backends/%1.desktop").arg(name));
42
 
    return backendForFile(data);
 
41
    if (QDir::isAbsolutePath(name) && QStandardPaths::isTestModeEnabled()) {
 
42
        QString path = name;
 
43
        return backendForFile(path, QFileInfo(name).fileName());
 
44
    } else {
 
45
        QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("libmuon/backends/%1.desktop").arg(name));
 
46
        return backendForFile(path, name);
 
47
    }
43
48
}
44
49
 
45
 
AbstractResourcesBackend* MuonBackendsFactory::backendForFile(const QString& path) const
 
50
AbstractResourcesBackend* MuonBackendsFactory::backendForFile(const QString& path, const QString& name) const
46
51
{
47
52
    Q_ASSERT(!path.isEmpty());
48
53
    KDesktopFile cfg(path);
60
65
    if(!instance) {
61
66
        qWarning() << "Couldn't find the backend: " << path << "among" << allBackendNames(false) << "because" << loader->errorString();
62
67
    }
 
68
    instance->setName(name);
63
69
    instance->setMetaData(path);
64
70
 
65
71
    return instance;
114
120
 
115
121
void MuonBackendsFactory::processCommandLine(QCommandLineParser* parser)
116
122
{
117
 
    *s_requestedBackends = parser->value("backends").split(",", QString::SkipEmptyParts);
 
123
    *s_requestedBackends = parser->value("backends").split(',', QString::SkipEmptyParts);
118
124
    if(parser->isSet("listbackends")) {
119
125
        fprintf(stdout, "%s", qPrintable(i18n("Available backends:\n")));
120
126
        MuonBackendsFactory f;