[Pkg-owncloud-commits] [owncloud-client] 319/332: SocketAPI: Use Win32 function SHChangeNotify to notify Explorer.

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Aug 14 21:07:17 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 6cb813469098dc6025c8adab37425802250264f6
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Thu Aug 7 14:58:06 2014 +0200

    SocketAPI: Use Win32 function SHChangeNotify to notify Explorer.
---
 src/mirall/socketapi.cpp |  6 +++++-
 src/mirall/utility.cpp   | 11 +++++++++++
 src/mirall/utility.h     |  2 +-
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/mirall/socketapi.cpp b/src/mirall/socketapi.cpp
index 60b70f1..1f5f02a 100644
--- a/src/mirall/socketapi.cpp
+++ b/src/mirall/socketapi.cpp
@@ -276,7 +276,11 @@ void SocketApi::slotUpdateFolderView(const QString& alias)
                 f->syncResult().status() == SyncResult::Problem ||
                 f->syncResult().status() == SyncResult::Error   ||
                 f->syncResult().status() == SyncResult::SetupError ) {
-            broadcastMessage(QLatin1String("UPDATE_VIEW"), f->path() );
+            if( Utility::isWindows() ) {
+                Utility::winShellChangeNotify( f->path() );
+            } else {
+                broadcastMessage(QLatin1String("UPDATE_VIEW"), f->path() );
+            }
         }
     }
 }
diff --git a/src/mirall/utility.cpp b/src/mirall/utility.cpp
index 1b4956f..9b47c89 100644
--- a/src/mirall/utility.cpp
+++ b/src/mirall/utility.cpp
@@ -361,6 +361,17 @@ bool Utility::isLinux()
 #endif
 }
 
+void Utility::winShellChangeNotify( const QString& path )
+{
+#ifdef Q_OS_WIN
+    SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT,
+                   reinterpret_cast<const wchar_t *>(QDir::toNativeSeparators(path).utf16()), NULL );
+#else
+    qDebug() << Q_FUNC_INFO << " is not implemented on non Windows systems.";
+#endif
+}
+
+
 static const char STOPWATCH_END_TAG[] = "_STOPWATCH_END";
 
 void Utility::StopWatch::start()
diff --git a/src/mirall/utility.h b/src/mirall/utility.h
index 0d46146..ac451cf 100644
--- a/src/mirall/utility.h
+++ b/src/mirall/utility.h
@@ -59,7 +59,7 @@ namespace Utility
     OWNCLOUDSYNC_EXPORT QDateTime qDateTimeFromTime_t(qint64 t);
     OWNCLOUDSYNC_EXPORT qint64 qDateTimeToTime_t(const QDateTime &t);
 
-
+    OWNCLOUDSYNC_EXPORT void winShellChangeNotify( const QString& path );
 
     /**
      * @brief Convert milliseconds to HMS string.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list