本文整理汇总了C++中FolderMan类的典型用法代码示例。如果您正苦于以下问题:C++ FolderMan类的具体用法?C++ FolderMan怎么用?C++ FolderMan使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FolderMan类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qDebug
void AccountSettings::slotFolderWizardRejected()
{
qDebug() << "* Folder wizard cancelled";
FolderMan *folderMan = FolderMan::instance();
folderMan->setSyncEnabled(true);
folderMan->slotScheduleAllFolders();
}
示例2: qDebug
void Application::slotConnectionValidatorResult(ConnectionValidator::Status status)
{
qDebug() << "Connection Validator Result: " << _conValidator->statusString(status);
QStringList startupFails;
if( status == ConnectionValidator::Connected ) {
FolderMan *folderMan = FolderMan::instance();
qDebug() << "######## Connection and Credentials are ok!";
folderMan->setSyncEnabled(true);
// queue up the sync for all folders.
folderMan->slotScheduleAllFolders();
} else {
// if we have problems here, it's unlikely that syncing will work.
FolderMan::instance()->setSyncEnabled(false);
startupFails = _conValidator->errors();
_startupNetworkError = _conValidator->networkError();
if (_userTriggeredConnect) {
_userTriggeredConnect = false;
}
QTimer::singleShot(30*1000, this, SLOT(slotCheckConnection()));
}
_gui->startupConnected( (status == ConnectionValidator::Connected), startupFails);
_conValidator->deleteLater();
}
示例3: qDebug
void AccountSettings::slotRemoveCurrentFolder()
{
QModelIndex selected = ui->_folderList->selectionModel()->currentIndex();
if( selected.isValid() ) {
QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString();
qDebug() << "Remove Folder alias " << alias;
if( !alias.isEmpty() ) {
// remove from file system through folder man
// _model->removeRow( selected.row() );
int ret = QMessageBox::question( this, tr("Confirm Folder Remove"),
tr("<p>Do you really want to stop syncing the folder <i>%1</i>?</p>"
"<p><b>Note:</b> This will not remove the files from your client.</p>").arg(alias),
QMessageBox::Yes|QMessageBox::No );
if( ret == QMessageBox::No ) {
return;
}
FolderMan *folderMan = FolderMan::instance();
folderMan->slotRemoveFolder( alias );
setFolderList(folderMan->map());
emit folderChanged();
slotCheckConnection();
}
}
}
示例4: slotAccountStateChanged
void Application::slotAccountStateChanged(int state)
{
FolderMan* folderMan = FolderMan::instance();
switch (state) {
case AccountState::Connected:
qDebug() << "Enabling sync scheduler, scheduling all folders";
folderMan->setSyncEnabled(true);
folderMan->slotScheduleAllFolders();
break;
case AccountState::ServiceUnavailable:
case AccountState::SignedOut:
case AccountState::ConfigurationError:
case AccountState::NetworkError:
case AccountState::Disconnected:
qDebug() << "Disabling sync scheduler, terminating sync";
folderMan->setSyncEnabled(false);
folderMan->terminateSyncProcess();
break;
}
// Stop checking the connection if we're manually signed out or
// when the error is permanent.
if (state == AccountState::SignedOut
|| state == AccountState::ConfigurationError) {
_checkConnectionTimer.stop();
} else if (! _checkConnectionTimer.isActive()) {
_checkConnectionTimer.start();
}
slotUpdateConnectionErrors(state);
}
示例5: startWizard
void OwncloudSetupWizard::startWizard()
{
FolderMan *folderMan = FolderMan::instance();
bool multiFolderSetup = folderMan->map().count() > 1;
// ###
Account *account = Account::restore();
if (!account) {
_ocWizard->setConfigExists(false);
account = new Account;
account->setCredentials(CredentialsFactory::create("dummy"));
} else {
_ocWizard->setConfigExists(true);
}
account->setSslErrorHandler(new SslDialogErrorHandler);
_ocWizard->setAccount(account);
_ocWizard->setOCUrl(account->url().toString());
_remoteFolder = Theme::instance()->defaultServerFolder();
// remoteFolder may be empty, which means /
QString localFolder = Theme::instance()->defaultClientFolder();
// if its a relative path, prepend with users home dir, otherwise use as absolute path
if( !QDir(localFolder).isAbsolute() ) {
localFolder = QDir::homePath() + QDir::separator() + localFolder;
}
if (!multiFolderSetup) {
QList<Folder*> folders = folderMan->map().values();
if (!folders.isEmpty()) {
Folder* folder = folders.first();
localFolder = QDir(folder->path()).absolutePath();
}
}
_ocWizard->setProperty("localFolder", localFolder);
// remember the local folder to compare later if it changed, but clean first
QString lf = QDir::fromNativeSeparators(localFolder);
if( !lf.endsWith(QLatin1Char('/'))) {
lf.append(QLatin1Char('/'));
}
_initLocalFolder = lf;
_ocWizard->setRemoteFolder(_remoteFolder);
_ocWizard->setStartId(WizardCommon::Page_ServerSetup);
_ocWizard->restart();
// settings re-initialized in initPage must be set here after restart
_ocWizard->setMultipleFoldersExist( multiFolderSetup );
_ocWizard->open();
_ocWizard->raise();
}
示例6: slotClearBlacklist
void ProtocolWidget::slotClearBlacklist()
{
FolderMan *folderMan = FolderMan::instance();
Folder::Map folders = folderMan->map();
foreach( Folder *f, folders ) {
int num = f->slotWipeBlacklist();
qDebug() << num << "entries were removed from"<< f->alias() << "blacklist";
}
示例7: slotAssistantFinished
// Method executed when the user ends has finished the basic setup.
void OwncloudSetupWizard::slotAssistantFinished( int result )
{
FolderMan *folderMan = FolderMan::instance();
if( result == QDialog::Rejected ) {
// the old config remains valid. Remove the temporary one.
_ocWizard->account()->deleteLater();
qDebug() << "Rejected the new config, use the old!";
} else if( result == QDialog::Accepted ) {
Account *newAccount = _ocWizard->account();
Account *origAccount = AccountManager::instance()->account();
const QString localFolder = _ocWizard->localFolder();
bool isInitialSetup = (origAccount == 0);
bool reinitRequired = newAccount->changed(origAccount, true /* ignoreProtocol, allows http->https */);
bool startFromScratch = _ocWizard->field("OCSyncFromScratch").toBool();
// This distinguishes three possibilities:
// 1. Initial setup, no prior account exists
if (isInitialSetup) {
folderMan->addFolderDefinition(Theme::instance()->appName(),
localFolder, _remoteFolder );
replaceDefaultAccountWith(newAccount);
}
// 2. Server URL or user changed, requires reinit of folders
else if (reinitRequired) {
// 2.1: startFromScratch: (Re)move local data, clean slate sync
if (startFromScratch) {
if (ensureStartFromScratch(localFolder)) {
folderMan->addFolderDefinition(Theme::instance()->appName(),
localFolder, _remoteFolder );
_ocWizard->appendToConfigurationLog(tr("<font color=\"green\"><b>Local sync folder %1 successfully created!</b></font>").arg(localFolder));
replaceDefaultAccountWith(newAccount);
}
}
// 2.2: Reinit: Remove journal and start a sync
else {
folderMan->removeAllFolderDefinitions();
folderMan->addFolderDefinition(Theme::instance()->appName(),
localFolder, _remoteFolder );
_ocWizard->appendToConfigurationLog(tr("<font color=\"green\"><b>Local sync folder %1 successfully created!</b></font>").arg(localFolder));
replaceDefaultAccountWith(newAccount);
}
}
// 3. Existing setup, http -> https or password changed
else {
replaceDefaultAccountWith(newAccount);
qDebug() << "Only password was changed, no changes to folder configuration.";
}
}
// notify others.
emit ownCloudWizardDone( result );
}
示例8: slotAddFolder
void AccountSettings::slotAddFolder()
{
FolderMan *folderMan = FolderMan::instance();
folderMan->setSyncEnabled(false); // do not start more syncs.
FolderWizard *folderWizard = new FolderWizard(this);
connect(folderWizard, SIGNAL(accepted()), SLOT(slotFolderWizardAccepted()));
connect(folderWizard, SIGNAL(rejected()), SLOT(slotFolderWizardRejected()));
folderWizard->open();
}
示例9: slotSyncStateChange
void SettingsDialogMac::slotSyncStateChange(const QString& alias)
{
FolderMan *folderMan = FolderMan::instance();
SyncResult state = folderMan->accountStatus(folderMan->map().values());
QIcon accountIcon = Theme::instance()->syncStateIcon(state.status());
setPreferencesPanelIcon(_accountIdx, accountIcon);
Folder *folder = folderMan->folder(alias);
if( folder ) {
_accountSettings->slotUpdateFolderState(folder);
}
}
示例10: slotRetrySync
void ProtocolWidget::slotRetrySync()
{
FolderMan *folderMan = FolderMan::instance();
Folder::Map folders = folderMan->map();
foreach( Folder *f, folders ) {
int num = f->slotWipeErrorBlacklist();
qDebug() << num << "entries were removed from"
<< f->alias() << "blacklist";
num = f->slotDiscardDownloadProgress();
qDebug() << num << "temporary files with partial downloads"
<< "were removed from" << f->alias();
}
示例11: slotownCloudWizardDone
void Application::slotownCloudWizardDone( int res )
{
FolderMan *folderMan = FolderMan::instance();
if( res == QDialog::Accepted ) {
int cnt = folderMan->setupFolders();
qDebug() << "Set up " << cnt << " folders.";
// We have some sort of configuration. Enable autostart
Utility::setLaunchOnStartup(_theme->appName(), _theme->appNameGUI(), true);
}
folderMan->setSyncEnabled( true );
if( res == QDialog::Accepted ) {
slotCheckConnection();
}
}
示例12: slotLogout
void Application::slotLogout()
{
Account *a = AccountManager::instance()->account();
if (a) {
// invalidate & forget token/password
a->credentials()->invalidateToken(a);
// terminate all syncs and unload folders
FolderMan *folderMan = FolderMan::instance();
folderMan->setSyncEnabled(false);
folderMan->terminateSyncProcess();
folderMan->unloadAllFolders();
a->setState(Account::SignedOut);
// show result
_gui->slotComputeOverallSyncStatus();
}
}
示例13: slotToggleFolderman
void Application::slotToggleFolderman(int state)
{
FolderMan* folderMan = FolderMan::instance();
switch (state) {
case Account::Connected:
folderMan->setSyncEnabled(true);
folderMan->slotScheduleAllFolders();
break;
case Account::Disconnected:
case Account::SignedOut:
case Account::InvalidCredidential:
folderMan->setSyncEnabled(false);
folderMan->terminateSyncProcess();
break;
}
}
示例14: slotAssistantFinished
// Method executed when the user ends has finished the basic setup.
void OwncloudSetupWizard::slotAssistantFinished( int result )
{
FolderMan *folderMan = FolderMan::instance();
if( result == QDialog::Rejected ) {
qDebug() << "Rejected the new config, use the old!";
} else if( result == QDialog::Accepted ) {
// This may or may not wipe all folder definitions, depending
// on whether a new account is activated or the existing one
// is changed.
auto account = applyAccountChanges();
QString localFolder = QDir::fromNativeSeparators(_ocWizard->localFolder());
if( !localFolder.endsWith(QLatin1Char('/'))) {
localFolder.append(QLatin1Char('/'));
}
bool startFromScratch = _ocWizard->field("OCSyncFromScratch").toBool();
if (!startFromScratch || ensureStartFromScratch(localFolder)) {
qDebug() << "Adding folder definition for" << localFolder << _remoteFolder;
FolderDefinition folderDefinition;
auto alias = Theme::instance()->appName();
int count = 0;
folderDefinition.alias = alias;
while (folderMan->folder(folderDefinition.alias)) {
// There is already a folder configured with this name and folder names need to be unique
folderDefinition.alias = alias + QString::number(++count);
}
folderDefinition.localPath = localFolder;
folderDefinition.targetPath = _remoteFolder;
auto f = folderMan->addFolder(account, folderDefinition);
if (f) {
f->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList,
_ocWizard->selectiveSyncBlacklist());
}
_ocWizard->appendToConfigurationLog(tr("<font color=\"green\"><b>Local sync folder %1 successfully created!</b></font>").arg(localFolder));
}
}
// notify others.
emit ownCloudWizardDone( result );
}
示例15: tr
void AccountSettings::slotResetCurrentFolder()
{
QModelIndex selected = ui->_folderList->selectionModel()->currentIndex();
if( selected.isValid() ) {
QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString();
int ret = QMessageBox::question( 0, tr("Confirm Folder Reset"),
tr("<p>Do you really want to reset folder <i>%1</i> and rebuild your client database?</p>"
"<p><b>Note:</b> While no files will be removed, this can cause significant data "
"traffic and take several minutes to hours, depending on the size of the folder.</p>").arg(alias),
QMessageBox::Yes|QMessageBox::No );
if( ret == QMessageBox::Yes ) {
FolderMan *folderMan = FolderMan::instance();
Folder *f = folderMan->folder(alias);
f->slotTerminateSync();
f->wipe();
folderMan->slotScheduleAllFolders();
}
}
}