Skip to content

Commit

Permalink
Remove qt_mac_execute_apple_script
Browse files Browse the repository at this point in the history
Not only these functions are never called, one of
them also calls deprecated APIs.

Change-Id: I172043b7059316e029a853e48e7f22f08e2a8b69
Reviewed-by: Timur Pocheptsov <[email protected]>
  • Loading branch information
Gabriel de Dietrich committed Jul 7, 2016
1 parent e91c412 commit c85fdc6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 64 deletions.
4 changes: 0 additions & 4 deletions src/plugins/platforms/cocoa/qcocoahelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ NSRect qt_mac_flipRect(const QRect &rect);

Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum);

bool qt_mac_execute_apple_script(const char *script, long script_len, AEDesc *ret);
bool qt_mac_execute_apple_script(const char *script, AEDesc *ret);
bool qt_mac_execute_apple_script(const QString &script, AEDesc *ret);

// strip out '&' characters, and convert "&&" to a single '&', in menu
// text - since menu text is sometimes decorated with these for Windows
// accelerators.
Expand Down
60 changes: 0 additions & 60 deletions src/plugins/platforms/cocoa/qcocoahelpers.mm
Original file line number Diff line number Diff line change
Expand Up @@ -636,66 +636,6 @@ OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGIm
return Qt::NoButton;
}

bool qt_mac_execute_apple_script(const char *script, long script_len, AEDesc *ret) {
OSStatus err;
AEDesc scriptTextDesc;
ComponentInstance theComponent = 0;
OSAID scriptID = kOSANullScript, resultID = kOSANullScript;

// set up locals to a known state
AECreateDesc(typeNull, 0, 0, &scriptTextDesc);
scriptID = kOSANullScript;
resultID = kOSANullScript;

// open the scripting component
theComponent = OpenDefaultComponent(kOSAComponentType, typeAppleScript);
if (!theComponent) {
err = paramErr;
goto bail;
}

// put the script text into an aedesc
err = AECreateDesc(typeUTF8Text, script, script_len, &scriptTextDesc);
if (err != noErr)
goto bail;

// compile the script
err = OSACompile(theComponent, &scriptTextDesc, kOSAModeNull, &scriptID);
if (err != noErr)
goto bail;

// run the script
err = OSAExecute(theComponent, scriptID, kOSANullScript, kOSAModeNull, &resultID);

// collect the results - if any
if (ret) {
AECreateDesc(typeNull, 0, 0, ret);
if (err == errOSAScriptError)
OSAScriptError(theComponent, kOSAErrorMessage, typeChar, ret);
else if (err == noErr && resultID != kOSANullScript)
OSADisplay(theComponent, resultID, typeChar, kOSAModeNull, ret);
}
bail:
AEDisposeDesc(&scriptTextDesc);
if (scriptID != kOSANullScript)
OSADispose(theComponent, scriptID);
if (resultID != kOSANullScript)
OSADispose(theComponent, resultID);
if (theComponent)
CloseComponent(theComponent);
return err == noErr;
}

bool qt_mac_execute_apple_script(const char *script, AEDesc *ret)
{
return qt_mac_execute_apple_script(script, qstrlen(script), ret);
}

bool qt_mac_execute_apple_script(const QString &script, AEDesc *ret)
{
const QByteArray l = script.toUtf8(); return qt_mac_execute_apple_script(l.constData(), l.size(), ret);
}

QString qt_mac_removeAmpersandEscapes(QString s)
{
return QPlatformTheme::removeMnemonics(s).trimmed();
Expand Down

0 comments on commit c85fdc6

Please sign in to comment.