Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 7 additions & 42 deletions client/Application_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "Application.h"

#include <Cocoa/Cocoa.h>
#include <QtCore/QTextStream>
#include <QtCore/QUrl>
#include <QtCore/QUrlQuery>
#include <QtGui/QDesktopServices>
Expand Down Expand Up @@ -100,49 +99,15 @@ - (void)openCrypto:(NSPasteboard *)pboard userData:(NSString *)data error:(NSStr
void Application::mailTo( const QUrl &url )
{
QUrlQuery q(url);
if(NSURL *appUrl = [NSWorkspace.sharedWorkspace URLForApplicationToOpenURL:url.toNSURL()])
NSSharingService *service = [NSSharingService sharingServiceNamed:NSSharingServiceNameComposeEmail];
if(service)
{
QString p;
QTextStream s( &p );
if([appUrl.path rangeOfString:@"/Applications/Mail.app"].location != NSNotFound)
{
s << "on run" << Qt::endl
<< "set vattachment to \"" << q.queryItemValue("attachment") << "\"" << Qt::endl
<< "set vsubject to \"" << q.queryItemValue("subject") << "\"" << Qt::endl
<< "tell application \"Mail\"" << Qt::endl
<< "set msg to make new outgoing message with properties {subject:vsubject, visible:true}" << Qt::endl
<< "tell content of msg to make new attachment with properties {file name:(vattachment as POSIX file) as alias}" << Qt::endl
<< "activate" << Qt::endl
<< "end tell" << Qt::endl
<< "end run" << Qt::endl;
}
else if([appUrl.path rangeOfString:@"Outlook"].location != NSNotFound)
{
s << "on run" << Qt::endl
<< "set vattachment to \"" << q.queryItemValue(u"attachment"_s) << "\" as POSIX file" << Qt::endl
<< "set vsubject to \"" << q.queryItemValue(u"subject"_s) << "\"" << Qt::endl
<< "tell application \"Microsoft Outlook\"" << Qt::endl
<< "activate" << Qt::endl
<< "set vmessage to make new outgoing message with properties {subject:vsubject}" << Qt::endl
<< "make new attachment at vmessage with properties {file: vattachment}" << Qt::endl
<< "open vmessage" << Qt::endl
<< "end tell" << Qt::endl
<< "end run" << Qt::endl;
}
#if 0
else if([appUrl.path rangeOfString:"/Applications/Thunderbird.app"].location != NSNotFound)
{
// TODO: Handle Thunderbird here? Impossible?
}
#endif
if(!p.isEmpty())
{
NSDictionary *err;
if([[[NSAppleScript alloc] initWithSource:p.toNSString()] executeAndReturnError:&err])
return;
}
service.subject = q.queryItemValue(u"subject"_s).toNSString();
NSURL *fileURL = [NSURL fileURLWithPath:q.queryItemValue(u"attachment"_s).toNSString()];
[service performWithItems:@[fileURL]];
return;
}
QDesktopServices::openUrl( url );
QDesktopServices::openUrl(url);
}

QString Application::groupContainerPath()
Expand Down
11 changes: 0 additions & 11 deletions qdigidoc4.eToken.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
<true/>
<key>com.apple.security.print</key>
<true/>
<key>com.apple.security.scripting-targets</key>
<dict>
<key>com.apple.mail</key>
<array>
<string>com.apple.mail.compose</string>
</array>
</dict>
<key>com.apple.security.smartcard</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
Expand All @@ -25,10 +18,6 @@
<array>
<string>group.ee.ria.qdigidoc4.tsl</string>
</array>
<key>com.apple.security.temporary-exception.apple-events</key>
<array>
<string>com.microsoft.outlook</string>
</array>
<key>com.apple.security.temporary-exception.files.absolute-path.read-only</key>
<array>
<string>/private/etc/eToken.conf</string>
Expand Down
11 changes: 0 additions & 11 deletions qdigidoc4.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,11 @@
<true/>
<key>com.apple.security.print</key>
<true/>
<key>com.apple.security.scripting-targets</key>
<dict>
<key>com.apple.mail</key>
<array>
<string>com.apple.mail.compose</string>
</array>
</dict>
<key>com.apple.security.smartcard</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>group.ee.ria.qdigidoc4.tsl</string>
</array>
<key>com.apple.security.temporary-exception.apple-events</key>
<array>
<string>com.microsoft.outlook</string>
</array>
</dict>
</plist>
Loading