Skip to content

Commit

Permalink
Make public API explicit about blacklist kind. #2301
Browse files Browse the repository at this point in the history
'blacklist' can mean the selective sync blacklist or the error
blacklist. Names in public API are now explicit about which
blacklist is meant.
  • Loading branch information
ckamm committed Jan 16, 2015
1 parent b50475b commit 91fce3e
Show file tree
Hide file tree
Showing 15 changed files with 92 additions and 92 deletions.
8 changes: 4 additions & 4 deletions src/gui/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,14 +516,14 @@ int Folder::downloadInfoCount()
return _journal.downloadInfoCount();
}

int Folder::blackListEntryCount()
int Folder::errorBlackListEntryCount()
{
return _journal.blackListEntryCount();
return _journal.errorBlackListEntryCount();
}

int Folder::slotWipeBlacklist()
int Folder::slotWipeErrorBlacklist()
{
return _journal.wipeBlacklist();
return _journal.wipeErrorBlacklist();
}

void Folder::slotWatchedPathChanged(const QString& path)
Expand Down
4 changes: 2 additions & 2 deletions src/gui/folder.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ public slots:

int slotDiscardDownloadProgress();
int downloadInfoCount();
int slotWipeBlacklist();
int blackListEntryCount();
int slotWipeErrorBlacklist();
int errorBlackListEntryCount();

/**
* Triggered by the folder watcher when a file/dir in this folder
Expand Down
2 changes: 1 addition & 1 deletion src/gui/owncloudsetupwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
if (!startFromScratch || ensureStartFromScratch(localFolder)) {
qDebug() << "Adding folder definition for" << localFolder << _remoteFolder;
folderMan->addFolderDefinition(Theme::instance()->appName(),
localFolder, _remoteFolder, _ocWizard->blacklist() );
localFolder, _remoteFolder, _ocWizard->selectiveSyncBlacklist() );
_ocWizard->appendToConfigurationLog(tr("<font color=\"green\"><b>Local sync folder %1 successfully created!</b></font>").arg(localFolder));
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/protocolwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void ProtocolWidget::slotRetrySync()
Folder::Map folders = folderMan->map();

foreach( Folder *f, folders ) {
int num = f->slotWipeBlacklist();
int num = f->slotWipeErrorBlacklist();
qDebug() << num << "entries were removed from"
<< f->alias() << "blacklist";

Expand Down Expand Up @@ -255,7 +255,7 @@ void ProtocolWidget::computeResyncButtonEnabled()
int blacklist_cnt = 0;
int downloads_cnt = 0;
foreach( Folder *f, folders ) {
blacklist_cnt += f->blackListEntryCount();
blacklist_cnt += f->errorBlackListEntryCount();
downloads_cnt += f->downloadInfoCount();
}

Expand Down
16 changes: 8 additions & 8 deletions src/gui/wizard/owncloudadvancedsetuppage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ QString OwncloudAdvancedSetupPage::localFolder() const
return folder;
}

QStringList OwncloudAdvancedSetupPage::blacklist() const
QStringList OwncloudAdvancedSetupPage::selectiveSyncBlacklist() const
{
return _blacklist;
return _selectiveSyncBlacklist;
}

bool OwncloudAdvancedSetupPage::validatePage()
Expand Down Expand Up @@ -276,13 +276,13 @@ void OwncloudAdvancedSetupPage::setConfigExists(bool config)
void OwncloudAdvancedSetupPage::slotSelectiveSyncClicked()
{
// Because clicking on it also changes it, restore it to the previous state in case the user cancel the dialog
_ui.rSyncEverything->setChecked(_blacklist.isEmpty());
_ui.rSyncEverything->setChecked(_selectiveSyncBlacklist.isEmpty());

AccountPtr acc = static_cast<OwncloudWizard *>(wizard())->account();
SelectiveSyncDialog *dlg = new SelectiveSyncDialog(acc, _blacklist, this);
SelectiveSyncDialog *dlg = new SelectiveSyncDialog(acc, _selectiveSyncBlacklist, this);
if (dlg->exec() == QDialog::Accepted) {
_blacklist = dlg->createBlackList();
if (!_blacklist.isEmpty()) {
_selectiveSyncBlacklist = dlg->createBlackList();
if (!_selectiveSyncBlacklist.isEmpty()) {
_ui.rSelectiveSync->blockSignals(true);
_ui.rSelectiveSync->setChecked(true);
_ui.rSelectiveSync->blockSignals(false);
Expand All @@ -296,15 +296,15 @@ void OwncloudAdvancedSetupPage::slotSelectiveSyncClicked()
_ui.rSyncEverything->setChecked(true);
_ui.lSelectiveSyncSizeLabel->setText(QString());
}
wizard()->setProperty("blacklist", _blacklist);
wizard()->setProperty("blacklist", _selectiveSyncBlacklist);
}
}

void OwncloudAdvancedSetupPage::slotSyncEverythingClicked()
{
_ui.lSelectiveSyncSizeLabel->setText(QString());
_ui.rSyncEverything->setChecked(true);
_blacklist.clear();
_selectiveSyncBlacklist.clear();
}

void OwncloudAdvancedSetupPage::slotQuotaRetrieved(qint64, qint64 usedQuota)
Expand Down
4 changes: 2 additions & 2 deletions src/gui/wizard/owncloudadvancedsetuppage.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class OwncloudAdvancedSetupPage: public QWizardPage
virtual int nextId() const Q_DECL_OVERRIDE;
bool validatePage() Q_DECL_OVERRIDE;
QString localFolder() const;
QStringList blacklist() const;
QStringList selectiveSyncBlacklist() const;
void setRemoteFolder( const QString& remoteFolder);
void setMultipleFoldersExist( bool exist );
void directoriesCreated();
Expand Down Expand Up @@ -69,7 +69,7 @@ private slots:
QProgressIndicator* _progressIndi;
QString _oldLocalFolder;
QString _remoteFolder;
QStringList _blacklist;
QStringList _selectiveSyncBlacklist;
};

} // namespace OCC
Expand Down
4 changes: 2 additions & 2 deletions src/gui/wizard/owncloudwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ QString OwncloudWizard::localFolder() const
return(_advancedSetupPage->localFolder());
}

QStringList OwncloudWizard::blacklist() const
QStringList OwncloudWizard::selectiveSyncBlacklist() const
{
return _advancedSetupPage->blacklist();
return _advancedSetupPage->selectiveSyncBlacklist();
}


Expand Down
2 changes: 1 addition & 1 deletion src/gui/wizard/owncloudwizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class OwncloudWizard: public QWizard
void setupCustomMedia( QVariant, QLabel* );
QString ocUrl() const;
QString localFolder() const;
QStringList blacklist() const;
QStringList selectiveSyncBlacklist() const;

void enableFinishOnResultWidget(bool enable);

Expand Down
12 changes: 6 additions & 6 deletions src/libsync/owncloudpropagator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ int OwncloudPropagator::maximumActiveJob()
*/
static bool blacklist(SyncJournalDb* journal, const SyncFileItem& item)
{
SyncJournalBlacklistRecord oldEntry = journal->blacklistEntry(item._file);
SyncJournalBlacklistRecord newEntry = SyncJournalBlacklistRecord::update(oldEntry, item);
SyncJournalErrorBlacklistRecord oldEntry = journal->errorBlacklistEntry(item._file);
SyncJournalErrorBlacklistRecord newEntry = SyncJournalErrorBlacklistRecord::update(oldEntry, item);

if (newEntry.isValid()) {
journal->updateBlacklistEntry(newEntry);
journal->updateErrorBlacklistEntry(newEntry);
} else if (oldEntry.isValid()) {
journal->wipeBlacklistEntry(item._file);
journal->wipeErrorBlacklistEntry(item._file);
}

return newEntry.isValid();
Expand Down Expand Up @@ -106,10 +106,10 @@ void PropagateItemJob::done(SyncFileItem::Status status, const QString &errorStr
case SyncFileItem::Restoration:
if( _item._hasBlacklistEntry ) {
// wipe blacklist entry.
_propagator->_journal->wipeBlacklistEntry(_item._file);
_propagator->_journal->wipeErrorBlacklistEntry(_item._file);
// remove a blacklist entry in case the file was moved.
if( _item._originalFile != _item._file ) {
_propagator->_journal->wipeBlacklistEntry(_item._originalFile);
_propagator->_journal->wipeErrorBlacklistEntry(_item._originalFile);
}
}
break;
Expand Down
12 changes: 6 additions & 6 deletions src/libsync/syncengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,14 @@ QString SyncEngine::csyncErrorToString(CSYNC_STATUS err)

}

bool SyncEngine::checkBlacklisting( SyncFileItem *item )
bool SyncEngine::checkErrorBlacklisting( SyncFileItem *item )
{
if( !_journal ) {
qWarning() << "Journal is undefined!";
return false;
}

SyncJournalBlacklistRecord entry = _journal->blacklistEntry(item->_file);
SyncJournalErrorBlacklistRecord entry = _journal->errorBlacklistEntry(item->_file);
item->_hasBlacklistEntry = false;

if( !entry.isValid() ) {
Expand Down Expand Up @@ -254,7 +254,7 @@ void SyncEngine::deleteStaleUploadInfos()
_journal->deleteStaleUploadInfos(upload_file_paths);
}

void SyncEngine::deleteStaleBlacklistEntries()
void SyncEngine::deleteStaleErrorBlacklistEntries()
{
// Find all blacklisted paths that we want to preserve.
QSet<QString> blacklist_file_paths;
Expand All @@ -264,7 +264,7 @@ void SyncEngine::deleteStaleBlacklistEntries()
}

// Delete from journal.
_journal->deleteStaleBlacklistEntries(blacklist_file_paths);
_journal->deleteStaleErrorBlacklistEntries(blacklist_file_paths);
}

int SyncEngine::treewalkLocal( TREE_WALK_FILE* file, void *data )
Expand Down Expand Up @@ -451,7 +451,7 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
item._direction = dir;
// check for blacklisting of this item.
// if the item is on blacklist, the instruction was set to IGNORE
checkBlacklisting( &item );
checkErrorBlacklisting( &item );

if (!item._isDirectory) {
_progressInfo._totalFileCount++;
Expand Down Expand Up @@ -741,7 +741,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)

deleteStaleDownloadInfos();
deleteStaleUploadInfos();
deleteStaleBlacklistEntries();
deleteStaleErrorBlacklistEntries();
_journal->commit("post stale entry removal");

// Emit the started signal only after the propagator has been set up.
Expand Down
6 changes: 3 additions & 3 deletions src/libsync/syncengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private slots:
static int treewalkLocal( TREE_WALK_FILE*, void *);
static int treewalkRemote( TREE_WALK_FILE*, void *);
int treewalkFile( TREE_WALK_FILE*, bool );
bool checkBlacklisting( SyncFileItem *item );
bool checkErrorBlacklisting( SyncFileItem *item );

// Cleans up unnecessary downloadinfo entries in the journal as well
// as their temporary files.
Expand All @@ -129,8 +129,8 @@ private slots:
// Removes stale uploadinfos from the journal.
void deleteStaleUploadInfos();

// Removes stale blacklist entries from the journal.
void deleteStaleBlacklistEntries();
// Removes stale error blacklist entries from the journal.
void deleteStaleErrorBlacklistEntries();

// cleanup and emit the finished signal
void finalize();
Expand Down
Loading

0 comments on commit 91fce3e

Please sign in to comment.