Ticket #46975: patch-make-kioexec-agent.diff

File patch-make-kioexec-agent.diff, 1.8 KB (added by RJVB (René Bertin), 10 years ago)
  • kioexec/main.cpp

    diff --git kioexec/main.cpp kioexec/main.cpp
    index 06cd8f3..699e94f 100644
     
    2121
    2222#include "main.h"
    2323
     24#ifdef Q_OS_MAC
     25// kioexec is declared NOGUI in its CMakeLists.txt file, which on OS X means
     26// it is *not* created as an AppBundle (which we don't want). It can however
     27// also mean the KApplication instance will be created with GUIenabled=false
     28// (depending on the patches installed), which is not appropriate for kioexec.
     29// Undefining KDE_WITHOUT_GUI restores the pre 4.14.1 default behaviour (GUIenabled=true)
     30// (when included before kapplication.h ...)
     31#undef KDE_WITHOUT_GUI
     32#include <CoreFoundation/CoreFoundation.h>
     33#endif
     34
    2435#include <QtCore/QFile>
    2536#include <QtCore/Q_PID>
    2637
    void KIOExec::slotRunApp() 
    250261
    251262int main( int argc, char **argv )
    252263{
     264#ifdef Q_OS_MAC
     265    CFBundleRef mainBundle = CFBundleGetMainBundle();
     266    if (mainBundle) {
     267        // get the application's Info Dictionary. For app bundles this would live in the bundle's Info.plist,
     268        // for regular executables it is obtained in another way.
     269        CFMutableDictionaryRef infoDict = (CFMutableDictionaryRef) CFBundleGetInfoDictionary(mainBundle);
     270        if (infoDict) {
     271            // Add or set the "LSUIElement" key with/to value "1". This can simply be a CFString.
     272            CFDictionarySetValue(infoDict, CFSTR("LSUIElement"), CFSTR("1"));
     273            // That's it. We're now considered as an "agent" by the window server, and thus will have
     274            // neither menubar nor presence in the Dock or App Switcher.
     275        }
     276    }
     277#endif
     278
    253279    KAboutData aboutData( "kioexec", "kioexec", ki18n("KIOExec"),
    254280        KDE_VERSION_STRING, ki18n(description), KAboutData::License_GPL,
    255281        ki18n("(c) 1998-2000,2003 The KFM/Konqueror Developers"));