Synchro::Synchro(const char *token, char *folder, char *URL) : folder(folder), URL(URL) { _instance = this; this->_sysWatcher = new QFileSystemWatcher(); connect(_instance->_sysWatcher, SIGNAL(directoryChanged(QString)), _instance, SLOT(directoryUpdated(QString))); connect(_instance->_sysWatcher, SIGNAL(fileChanged(QString)), _instance, SLOT(fileUpdated(QString))); this->xtoken = token; }
void QxrdFileBrowserModel::updatedFile(QFileInfo file) { // QxrdExperimentPtr expt(m_Experiment); // if (expt && qcepDebug(DEBUG_BROWSER)) { // expt->printMessage(tr("file %1 updated at %2") // .arg(path) // .arg(atTime.toString(Qt::ISODate))); // } emit fileUpdated(file); }
// note - you still need to delete the file yourself bool RDirNode::removeFile(RFile* f) { //doesnt match this path at all if(f->path.find(abspath) != 0) { return false; } //is this dir - add to this node if(f->path.compare(abspath) == 0) { for(std::list<RFile*>::iterator it = files.begin(); it != files.end(); it++) { if((*it)==f) { files.erase(it); if(!f->isHidden()) visible_count--; fileUpdated(false); return true; } } return false; } //does this belong to one of the children ? for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end(); it++) { RDirNode* node = (*it); bool removed = node->removeFile(f); if(removed) { //fprintf(stderr, "%s file removed from a child. child file count=%d, dir count =%d\n", getPath().c_str(), node->fileCount(), node->dirCount()); //node->printFiles(); //node is now empty, reap! if(node->noFiles() && node->noDirs()) { children.erase(it); //fprintf(stderr, "deleting node %s from %s\n", node->getPath().c_str(), getPath().c_str()); delete node; nodeUpdated(false); } return true; } } return false; }