MCPcopy Create free account
hub / github.com/alpha-liu-01/SpeedyNote / shareFile

Function shareFile

source/android/AndroidShareHelper.cpp:12–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10namespace AndroidShareHelper {
11
12void shareFile(const QString& filePath, const QString& mimeType, const QString& chooserTitle)
13{
14 if (filePath.isEmpty()) {
15 qWarning() << "AndroidShareHelper::shareFile: Empty file path";
16 return;
17 }
18
19 QJniObject activity = QNativeInterface::QAndroidApplication::context();
20 if (!activity.isValid()) {
21 qWarning() << "AndroidShareHelper::shareFile: Failed to get Android context";
22 return;
23 }
24
25 QJniObject::callStaticMethod<void>(
26 "org/speedynote/app/ShareHelper",
27 "shareFileWithTitle",
28 "(Landroid/app/Activity;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V",
29 activity.object<jobject>(),
30 QJniObject::fromString(filePath).object<jstring>(),
31 QJniObject::fromString(mimeType).object<jstring>(),
32 QJniObject::fromString(chooserTitle).object<jstring>()
33 );
34
35 QJniEnvironment env;
36 if (env.checkAndClearExceptions()) {
37 qWarning() << "AndroidShareHelper::shareFile: JNI exception occurred";
38 }
39}
40
41void shareMultipleFiles(const QStringList& filePaths, const QString& mimeType, const QString& chooserTitle)
42{

Callers 2

setupUiMethod · 0.85
showPdfExportDialogMethod · 0.85

Calls 2

isEmptyMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected