@@ -45,7 +45,6 @@ myModel::myModel(bool realMime, MimeUtils *mimeUtils) {
4545 thumbs = new QHash<QString,QByteArray>;
4646 icons = new QCache<QString,QIcon>;
4747 icons->setMaxCost (500 );
48- lockNotify = false ;
4948
5049 // Loads cached mime icons
5150 QFile fileIcons (QString (" %1/file.cache" ).arg (Common::configDir ()));
@@ -109,6 +108,13 @@ void myModel::clearIconCache() {
109108 QFile (QString (" %1/folder.cache" ).arg (Common::configDir ())).remove ();
110109 QFile (QString (" %1/file.cache" ).arg (Common::configDir ())).remove ();
111110}
111+
112+ void myModel::forceRefresh ()
113+ {
114+ qDebug () << " force refresh model view" ;
115+ beginResetModel ();
116+ endResetModel ();
117+ }
112118// ---------------------------------------------------------------------------
113119
114120/* *
@@ -287,11 +293,6 @@ void myModel::eventTimeout()
287293void myModel::notifyProcess (int eventID, QString fileName)
288294{
289295 qDebug () << " notifyProcess" << eventID << fileName;
290- if (lockNotify) {
291- qDebug () << " ignore notify" ;
292- return ;
293- }
294- lockNotify = true ;
295296 QString folderChanged;
296297 if (watchers.contains (eventID)) {
297298 myModelItem *parent = rootItem->matchPath (watchers.value (eventID).split (SEPARATOR));
@@ -333,7 +334,6 @@ void myModel::notifyProcess(int eventID, QString fileName)
333334 qDebug () << " folder modified" << folderChanged;
334335 emit reloadDir (folderChanged);
335336 }
336- QTimer::singleShot (500 , this , SLOT (unlockNotify ()));
337337}
338338
339339// ---------------------------------------------------------------------------------
@@ -454,6 +454,7 @@ void myModel::refreshItems()
454454{
455455 myModelItem *item = rootItem->matchPath (currentRootPath.split (SEPARATOR));
456456 if (item == NULL ) { return ; }
457+ qDebug () << " refresh items" ;
457458 item->clearAll ();
458459 populateItem (item);
459460}
@@ -927,11 +928,6 @@ QVariant myModel::findMimeIcon(myModelItem *item) const {
927928 return theIcon;
928929}
929930
930- void myModel::unlockNotify ()
931- {
932- qDebug () << " unlock notify" ;
933- lockNotify = false ;
934- }
935931// ---------------------------------------------------------------------------
936932
937933bool myModel::setData (const QModelIndex & index, const QVariant & value, int role)
0 commit comments