diff --git a/libpeony-qt/file-operation/file-operation-manager.cpp b/libpeony-qt/file-operation/file-operation-manager.cpp old mode 100644 new mode 100755 index e8046da3..f69a9f24 --- a/libpeony-qt/file-operation/file-operation-manager.cpp +++ b/libpeony-qt/file-operation/file-operation-manager.cpp @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include "file-copy-operation.h" #include "file-delete-operation.h" @@ -90,10 +92,33 @@ FileOperationManager::FileOperationManager(QObject *parent) : QObject(parent) if (pconnection) { g_dbus_connection_signal_subscribe(pconnection, "org.freedesktop.login1", "org.freedesktop.login1.Manager", "PrepareForSleep", "/org/freedesktop/login1", NULL, G_DBUS_SIGNAL_FLAGS_NONE, systemSleep, this, NULL); } + + QDBusConnection conn = QDBusConnection::sessionBus(); + if (!conn.isConnected()) { + qCritical()<<"failed to init mDbusDateServer, can not connect to session dbus"; + return; + } + + m_iface = new QDBusInterface("org.ukui.peony", "/org/ukui/peony", "org.ukui.peony", QDBusConnection::sessionBus()); + if (!m_iface->isValid()){ + qCritical() << "Create /org/ukui/peony Interface Failed " << QDBusConnection::sessionBus().lastError(); + return; + } + + QDBusConnection::sessionBus().connect("org.ukui.peony", + "/org/ukui/peony", + "org.ukui.peony", + "opreateFinishedOfEngrampa", + this, + SLOT(slot_opreateFinishedOfEngrampa(QString, bool))); } FileOperationManager::~FileOperationManager() { + if(m_iface){ + delete m_iface; + m_iface = nullptr; + } } @@ -818,6 +843,36 @@ void FileOperationManager::manuallyNotifyDirectoryChanged(FileOperationInfo *inf } } +void FileOperationManager::slot_opreateFinishedOfEngrampa(const QString &path, bool finish) +{ + if(!finish || path.isEmpty()) + return; + + if(!path.startsWith("smb://") && !path.startsWith("ftp://") && !path.startsWith("sftp://")) + return; + + for (auto watcher : m_watchers) { + if(watcher->supportMonitor()) + continue; + QString watcherUri = watcher->currentUri(); + //'file:///run/user/1000/gvfs/smb-share:server=xxx,share=xxx/' converted to 'smb://xxx' + if(watcherUri.startsWith("file:///run/user/1000/gvfs/smb-share:")){ + GFile * file = g_file_new_for_uri(watcherUri.toUtf8().data()); + char *uri = g_file_get_uri(file); + if (uri) { + watcherUri = uri; + } + g_object_unref(file); + g_free(uri); + } + //auto watcherDecodeUri = FileUtils::urlDecode(watcherUri); + //auto destDecodePath = FileUtils::urlDecode(path); + if (watcherUri == path || watcherUri == path + QString("/")){ + watcher->requestUpdateDirectory(); + } + } +} + //FIXME: get opposite info correcty. FileOperationInfo::FileOperationInfo(QStringList srcUris, QString destDirUri, diff --git a/libpeony-qt/file-operation/file-operation-manager.h b/libpeony-qt/file-operation/file-operation-manager.h old mode 100644 new mode 100755 index 208eaf7a..f1857a5f --- a/libpeony-qt/file-operation/file-operation-manager.h +++ b/libpeony-qt/file-operation/file-operation-manager.h @@ -36,7 +36,7 @@ #include "peony-core_global.h" #include "file-operation-progress-bar.h" #include "file-operation-error-dialogs.h" - +class QDBusInterface; namespace Peony { @@ -134,6 +134,9 @@ public Q_SLOTS: * not support monitoring. */ void manuallyNotifyDirectoryChanged(FileOperationInfo *info); + + void slot_opreateFinishedOfEngrampa(const QString& path, bool finish);/* hotfix bug#188622 【文件管理器】连接共享文件夹后进行压缩/解压缩操作,需要手动刷新后才会显示 */ + private: explicit FileOperationManager(QObject *parent = nullptr); ~FileOperationManager(); @@ -160,6 +163,7 @@ private: QStack> m_redo_stack; QHash *m_mount_operation_list = nullptr; QHash *m_operation_use_list = nullptr; + QDBusInterface* m_iface = nullptr; }; class FileOperationInfo : public QObject diff --git a/peony-qt-desktop/peony-dbus-service.cpp b/peony-qt-desktop/peony-dbus-service.cpp old mode 100644 new mode 100755 index 529380c4..ea81198a --- a/peony-qt-desktop/peony-dbus-service.cpp +++ b/peony-qt-desktop/peony-dbus-service.cpp @@ -91,3 +91,8 @@ QStringList PeonyDbusService::getBWListInfo() qDebug() << "getBWListInfo in service:"<