////////////////////////////////////////////////////////////////////////// /// A FileSystemWatcher notification when a file is renamed ////////////////////////////////////////////////////////////////////////// void SyncSystem::slotFileRenamed(QString oldName, QString newName) { if(m_LostSyncTimer->isActive()) { //Force the timer to run for 5 more seconds m_LostSyncTimer->setInterval(s_ResyncTimeout); } QSharedPointer<SyncRules> oldPathRules = GetSyncRulesForPath(oldName); QSharedPointer<SyncRules> newPathRules = GetSyncRulesForPath(newName); SyncRuleFlags_e eOldFlags; SyncRuleFlags_e eFlags; if(oldPathRules->CheckFileAndPath(oldName.toLower(), eOldFlags) ) { if(checkForRescan(newName)) { return; } bool oldBinary = ((eOldFlags & e_Binary) == e_Binary); bool oldExecutable = ((eOldFlags & e_Executable) == e_Executable); //old name should be synced if(newPathRules->CheckFileAndPath(newName.toLower(), eFlags)) { bool binary = ((eFlags & e_Binary) == e_Binary); bool executable = ((eFlags & e_Executable) == e_Executable); //new file should also be synced, delete the old sync the new (to avoid the need for new server protocol) addTodo(oldName, oldBinary, oldExecutable, true); addTodo(newName, binary, executable, false); } else { //old name was in sync, new is not. delete addTodo(oldName, oldBinary, oldExecutable, true); } } else if(newPathRules->CheckFileAndPath(newName.toLower(), eFlags)) { if(checkForRescan(newName)) { return; } bool binary = ((eFlags & e_Binary) == e_Binary); bool executable = ((eFlags & e_Executable) == e_Executable); //Old file was not in sync, but the new is addTodo(newName, binary, executable, false); } }
////////////////////////////////////////////////////////////////////////// /// A FileSystemWatcher notification when a file is changed ////////////////////////////////////////////////////////////////////////// void SyncSystem::slotFileChanged(QString file) { if(m_LostSyncTimer->isActive()) { //Force the timer to run for 5 more seconds m_LostSyncTimer->setInterval(s_ResyncTimeout); } QSharedPointer<SyncRules> rules = GetSyncRulesForPath(file); SyncRuleFlags_e eFlags; if(rules->CheckFileAndPath(file.toLower(), eFlags)) { bool binary = ((eFlags & e_Binary) == e_Binary); bool executable = ((eFlags & e_Executable) == e_Executable); addTodo(file, binary, executable, false); } }