Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make file opening the default action on finished download notification
  • Loading branch information
pvuorela committed Mar 11, 2021
1 parent ede8a21 commit 743820c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/transferengine.cpp
Expand Up @@ -193,8 +193,10 @@ TransferEnginePrivate::TransferEnginePrivate(TransferEngine *parent):
settings.endGroup();

if (!service.isEmpty() && !path.isEmpty() && !iface.isEmpty() && !method.isEmpty()) {
m_defaultActions << Notification::remoteAction("default", "", service, path, iface, method)
<< Notification::remoteAction("app", "", service, path, iface, method);
m_defaultActions << Notification::remoteAction("default", QString(), service, path, iface, method);
//% "Show transfers"
m_showTransfersAction = Notification::remoteAction(QString(), qtTrId("transferengine-no-show_transfers"),
service, path, iface, method);
}
}
}
Expand Down Expand Up @@ -380,15 +382,15 @@ void TransferEnginePrivate::sendNotification(TransferEngineData::TransferType ty
body = qtTrId("transferengine-no-file-download-success");
summary = fileName;
if (!localFileUrl.isEmpty()) {
remoteActions.append(Notification::remoteAction(QString(),
//: Open a downloaded file
//% "Open"
qtTrId("transferengine-no-open"),
remoteActions.clear();
remoteActions.append(Notification::remoteAction(QLatin1String("default"),
QString(),
"org.sailfishos.fileservice",
"/",
"org.sailfishos.fileservice",
"openUrl",
QVariantList() << localFileUrl.toString()));
remoteActions.append(m_showTransfersAction);
}
break;
case TransferEngineData::Sync:
Expand Down
1 change: 1 addition & 0 deletions src/transferengine_p.h
Expand Up @@ -147,6 +147,7 @@ public Q_SLOTS:
ClientActivityMonitor *m_activityMonitor;
TransferEngine *q_ptr;
QVariantList m_defaultActions;
QVariant m_showTransfersAction;
Q_DECLARE_PUBLIC(TransferEngine)
};

Expand Down

0 comments on commit 743820c

Please sign in to comment.