Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Commit

Permalink
fix: unable to use the open file under other notifications
Browse files Browse the repository at this point in the history
Change-Id: I54c7cfcfefeb726e3a8172f1ebb90a28093a5d01
  • Loading branch information
justforlxz committed Feb 25, 2019
1 parent 00e16cd commit 0df3442
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1368,20 +1368,29 @@ void MainWindow::sendNotify(int saveIndex, QString saveFilePath, const bool succ
exit(0);
}

QDBusInterface remote_dde_notify_obj("com.deepin.dde.Notification", "/com/deepin/dde/Notification",
"com.deepin.dde.Notification");

const bool remote_dde_notify_obj_exist = remote_dde_notify_obj.isValid();

QStringList actions;
actions << "_open" << tr("View");
QVariantMap hints;
QString fileDir = QUrl::fromLocalFile(QFileInfo(saveFilePath).absoluteDir().absolutePath()).toString();
QString filePath = QUrl::fromLocalFile(saveFilePath).toString();
QString command;
if (QFile("/usr/bin/dde-file-manager").exists()) {
command = QString("/usr/bin/dde-file-manager,%1?selectUrl=%2"
).arg(fileDir).arg(filePath);
} else {
command = QString("xdg-open,%1").arg(filePath);
}

hints["x-deepin-action-_open"] = command;
if (remote_dde_notify_obj_exist) {
actions << "_open" << tr("View");

QString fileDir = QUrl::fromLocalFile(QFileInfo(saveFilePath).absoluteDir().absolutePath()).toString();
QString filePath = QUrl::fromLocalFile(saveFilePath).toString();
QString command;
if (QFile("/usr/bin/dde-file-manager").exists()) {
command = QString("/usr/bin/dde-file-manager,%1?selectUrl=%2").arg(fileDir).arg(filePath);
}
else {
command = QString("xdg-open,%1").arg(filePath);
}

hints["x-deepin-action-_open"] = command;
}

qDebug() << "saveFilePath:" << saveFilePath;

Expand Down

0 comments on commit 0df3442

Please # to comment.