SocketAPI: Use Win32 function SHChangeNotify to notify Explorer.

This commit is contained in:
Klaas Freitag 2014-08-07 14:58:06 +02:00
parent 95a77e5ccc
commit 6cb8134690
3 changed files with 17 additions and 2 deletions

View file

@ -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() );
}
}
}
}

View file

@ -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()

View file

@ -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.