~ubuntu-branches/ubuntu/natty/kdebase-runtime/natty-proposed

« back to all changes in this revision

Viewing changes to kcmshell/main.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-11-24 11:07:10 UTC
  • mto: (0.8.7 upstream)
  • mto: This revision was merged to the branch mainline in revision 129.
  • Revision ID: james.westby@ubuntu.com-20101124110710-6dbsyw0yh21qvn82
Tags: upstream-4.5.80
ImportĀ upstreamĀ versionĀ 4.5.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
  }
69
69
}
70
70
 
71
 
static KService::Ptr locateModule(const QByteArray& module)
 
71
static KService::Ptr locateModule(const QString& module)
72
72
{
73
 
    QString path = QFile::decodeName(module);
 
73
    QString path = module;
74
74
 
75
75
    if (!path.endsWith(QLatin1String(".desktop")))
76
76
        path += ".desktop";
77
77
 
78
78
    KService::Ptr service = KService::serviceByStorageId( path );
79
 
    if (!service)
80
 
    {
81
 
        kWarning(debugArea()) << "Could not find module '" << module << "'." ;
82
 
        return KService::Ptr();
83
 
    }
84
 
 
85
 
    if ( service->noDisplay() )
86
 
    {
 
79
    if (!service) {
 
80
        return KService::Ptr();
 
81
    }
 
82
 
 
83
    if (!service->hasServiceType("KCModule")) {
 
84
        // Not a KCModule. E.g. "kcmshell4 akonadi" finds services/kresources/kabc/akonadi.desktop, unrelated.
 
85
        return KService::Ptr();
 
86
    }
 
87
 
 
88
    if ( service->noDisplay() ) {
87
89
        kDebug(debugArea()) << module << " should not be loaded.";
88
90
        return KService::Ptr();
89
91
    }
231
233
    KService::List modules;
232
234
    for (int i = 0; i < args->count(); i++)
233
235
    {
234
 
        const QByteArray arg = args->arg(i).toLocal8Bit();
 
236
        const QString arg = args->arg(i);
235
237
        KService::Ptr service = locateModule(arg);
236
238
        if (!service) {
237
239
            service = locateModule("kcm_" + arg);
240
242
            service = locateModule("kcm" + arg);
241
243
        }
242
244
 
243
 
        if( service )
244
 
        {
 
245
        if (service) {
245
246
            modules.append(service);
246
247
            if( !serviceName.isEmpty() )
247
248
                serviceName += '_';
248
 
 
249
249
            serviceName += args->arg(i);
 
250
        } else {
 
251
            fprintf(stderr, "%s\n", i18n("Could not find module '%1'. See kcmshell4 --list for the full list of modules.", arg).toLocal8Bit().constData());
250
252
        }
251
253
    }
252
254