~ubuntu-branches/ubuntu/utopic/kdebase/utopic

« back to all changes in this revision

Viewing changes to apps/nsplugins/pluginscan.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-11-25 16:00:47 UTC
  • mfrom: (1.1.53 upstream)
  • Revision ID: james.westby@ubuntu.com-20101125160047-bsycodsp50o8su5s
Tags: 4:4.5.80-0ubuntu1
* New upstream beta release
* Drop kubuntu_06_simple_aboutpage.diff, didn't apply and no point
  keeping a distro patch to an app we don't ship by default
* Drop kubuntu_23_konqueror_spinner_in_toolbar.diff now upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
#include <kdebug.h>
46
46
#include <kglobal.h>
47
47
#include <kstandarddirs.h>
48
 
#include <klibloader.h>
 
48
#include <klibrary.h>
49
49
#include <kconfig.h>
50
50
#include <kconfiggroup.h>
51
51
#include <kcrash.h>
55
55
#include <kcmdlineargs.h>
56
56
#include <kaboutdata.h>
57
57
#include <klocale.h>
 
58
#include <kprocess.h>
 
59
#include <ksycoca.h>
58
60
 
59
61
#include "sdk/npupp.h"
60
62
 
224
226
 
225
227
static int tryCheck(int write_fd, const QString &absFile)
226
228
{
227
 
    KLibrary *_handle = KLibLoader::self()->library( QFile::encodeName(absFile) );
228
 
    if (!_handle) {
 
229
    KLibrary _handle(absFile);
 
230
    if (!_handle.load()) {
229
231
        kDebug(1433) << " - open failed with message " <<
230
 
                         KLibLoader::self()->lastErrorMessage() << ", skipping " << endl;
 
232
                         _handle.errorString() << ", skipping " << endl;
231
233
        return 1;
232
234
    }
233
235
 
237
239
 
238
240
    NPError (*func_GetValue)(void *, NPPVariable, void *) =
239
241
        (NPError(*)(void *, NPPVariable, void *))
240
 
        _handle->resolveFunction("NP_GetValue");
 
242
        _handle.resolveFunction("NP_GetValue");
241
243
    if ( func_GetValue ) {
242
244
 
243
245
        // get name
260
262
 
261
263
    // get mime description function pointer
262
264
    char* (*func_GetMIMEDescription)() =
263
 
        (char *(*)())_handle->resolveFunction("NP_GetMIMEDescription");
 
265
        (char *(*)())_handle.resolveFunction("NP_GetMIMEDescription");
264
266
    if ( !func_GetMIMEDescription ) {
265
267
        kDebug(1433) << " - no GetMIMEDescription, skipping";
266
 
        KLibLoader::self()->unloadLibrary( QFile::encodeName(absFile) );
 
268
        _handle.unload();
267
269
        return 1;
268
270
    }
269
271
 
271
273
    QString mimeInfo = func_GetMIMEDescription();
272
274
    if ( mimeInfo.isEmpty() ) {
273
275
        kDebug(1433) << " - no mime info returned, skipping";
274
 
        KLibLoader::self()->unloadLibrary( QFile::encodeName(absFile) );
 
276
        _handle.unload();
275
277
        return 1;
276
278
    }
277
279
 
284
286
 
285
287
    // unload plugin lib
286
288
    kDebug(1433) << " - unloading plugin";
287
 
    KLibLoader::self()->unloadLibrary( QFile::encodeName(absFile) );
 
289
    _handle.unload();
288
290
 
289
291
    // create a QDataStream for our IPC pipe (to send plugin info back to the parent)
290
292
    QFile stream_file;
669
671
      printf("90\n"); fflush(stdout);
670
672
    }
671
673
 
672
 
    // Tell kded to update sycoca database.
673
 
    QDBusInterface kbuildsycoca("org.kde.kded", "/kbuildsycoca",
674
 
                                "org.kde.kded");
675
 
    if (kbuildsycoca.isValid())
 
674
    if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kded")) {
 
675
        // Tell kded to update sycoca database.
 
676
        QDBusInterface kbuildsycoca("org.kde.kded", "/kbuildsycoca",
 
677
                                    "org.kde.kded");
676
678
        kbuildsycoca.call("recreate");
 
679
    } else {
 
680
        // kded not running? fallback to calling kbuildsycoca directly:
 
681
        KProcess proc;
 
682
        proc << KStandardDirs::findExe(KBUILDSYCOCA_EXENAME);
 
683
        proc.setOutputChannelMode(KProcess::MergedChannels); // silence kbuildsycoca output
 
684
        proc.execute();
 
685
    }
677
686
}