// add a monitor to the local file system. If there is a change in the // file system, the method slotFolderMonitorFired is triggered through // the SignalMapper void FolderMan::registerFolderMonitor( Folder *folder ) { if( !folder ) return; if( !_folderWatchers.contains(folder->alias() ) ) { FolderWatcher *fw = new FolderWatcher(folder->path(), folder); ConfigFile cfg; fw->addIgnoreListFile( cfg.excludeFile(ConfigFile::SystemScope) ); fw->addIgnoreListFile( cfg.excludeFile(ConfigFile::UserScope) ); fw->setIgnoreHidden( folder->ignoreHiddenFiles() ); // Connect the pathChanged signal, which comes with the changed path, // to the signal mapper which maps to the folder alias. The changed path // is lost this way, but we do not need it for the current implementation. connect(fw, SIGNAL(pathChanged(QString)), folder, SLOT(slotWatchedPathChanged(QString))); _folderWatchers.insert(folder->alias(), fw); // This is at the moment only for the behaviour of the SocketApi. connect(fw, SIGNAL(pathChanged(QString)), folder, SLOT(watcherSlot(QString))); } // register the folder with the socket API if( _socketApi ) { _socketApi->slotRegisterPath(folder->alias()); } }
void ConfigFile::setupDefaultExcludeFilePaths(ExcludedFiles &excludedFiles) { ConfigFile cfg; QString systemList = cfg.excludeFile(ConfigFile::SystemScope); qCInfo(lcConfigFile) << "Adding system ignore list to csync:" << systemList; excludedFiles.addExcludeFilePath(systemList); QString userList = cfg.excludeFile(ConfigFile::UserScope); if (QFile::exists(userList)) { qCInfo(lcConfigFile) << "Adding user defined ignore list to csync:" << userList; excludedFiles.addExcludeFilePath(userList); } }
void SocketApi::slotReadExcludes() { ConfigFile cfgFile; slotClearExcludesList(); QString excludeList = cfgFile.excludeFile( ConfigFile::SystemScope ); if( !excludeList.isEmpty() ) { qDebug() << "==== added system ignore list to socketapi:" << excludeList.toUtf8(); csync_exclude_load(excludeList.toUtf8(), &_excludes); } excludeList = cfgFile.excludeFile( ConfigFile::UserScope ); if( !excludeList.isEmpty() ) { qDebug() << "==== added user defined ignore list to csync:" << excludeList.toUtf8(); csync_exclude_load(excludeList.toUtf8(), &_excludes); } }
void IgnoreListEditor::slotUpdateLocalIgnoreList() { ConfigFile cfgFile; QString ignoreFile = cfgFile.excludeFile(ConfigFile::UserScope); QFile ignores(ignoreFile); if (ignores.open(QIODevice::WriteOnly)) { for(int row = 0; row < ui->tableWidget->rowCount(); ++row) { QTableWidgetItem *patternItem = ui->tableWidget->item(row, patternCol); QTableWidgetItem *deletableItem = ui->tableWidget->item(row, deletableCol); if (patternItem->flags() & Qt::ItemIsEnabled) { QByteArray prepend; if (deletableItem->checkState() == Qt::Checked) { prepend = "]"; } ignores.write(prepend+patternItem->text().toUtf8()+'\n'); } } // We need to force a remote discovery after a change of the ignore list. // Otherwise we would not download the files/directories that are no longer // ignored (because the remote etag did not change) (issue #3172) foreach (Folder* folder, FolderMan::instance()->map()) { folder->journalDb()->forceRemoteDiscoveryNextSync(); } } else {
bool Folder::setIgnoredFiles() { bool ok = false; ConfigFile cfgFile; csync_clear_exclude_list( _csync_ctx ); QString excludeList = cfgFile.excludeFile( ConfigFile::SystemScope ); if( !excludeList.isEmpty() ) { qDebug() << "==== added system ignore list to csync:" << excludeList.toUtf8(); if (csync_add_exclude_list( _csync_ctx, excludeList.toUtf8() ) == 0) { ok = true; } } excludeList = cfgFile.excludeFile( ConfigFile::UserScope ); if( !excludeList.isEmpty() ) { qDebug() << "==== added user defined ignore list to csync:" << excludeList.toUtf8(); csync_add_exclude_list( _csync_ctx, excludeList.toUtf8() ); // reading the user exclude file is optional } return ok; }