void Folder::slotTerminateSync() { qDebug() << "folder " << alias() << " Terminating!"; MirallConfigFile cfg; QString configDir = cfg.configPath(); qDebug() << "csync's Config Dir: " << configDir; if( _thread && _csync ) { csync_request_abort(_csync_ctx); _thread->quit(); _thread->wait(); _csync->deleteLater(); delete _thread; _csync = 0; _thread = 0; csync_resume(_csync_ctx); } if( ! configDir.isEmpty() ) { QFile file( configDir + QLatin1String("/lock")); if( file.exists() ) { qDebug() << "After termination, lock file exists and gets removed."; file.remove(); } } _errors.append( tr("The CSync thread terminated.") ); _csyncError = true; qDebug() << "-> CSync Terminated!"; slotCSyncFinished(); }
NSISUpdater::UpdateState NSISUpdater::updateStateOnStart() { MirallConfigFile cfg; QSettings settings(cfg.configFile(), QSettings::IniFormat); QString updateFileName = settings.value(updateAvailableC).toString(); // has the previous run downloaded an update? if (!updateFileName.isEmpty() && QFile(updateFileName).exists()) { // did it try to execute the update? if (settings.value(autoUpdateAttemptedC, false).toBool()) { // clean up settings.remove(autoUpdateAttemptedC); settings.remove(updateAvailableC); QFile::remove(updateFileName); if (updateSucceeded()) { // success: clean up even more settings.remove(updateTargetVersionC); settings.remove(autoUpdateFailedVersionC); return NoUpdate; } else { // auto update failed. Set autoUpdateFailedVersion as a hint // for visual fallback notification QString targetVersion = settings.value(updateTargetVersionC).toString(); settings.setValue(autoUpdateFailedVersionC, targetVersion); settings.remove(updateTargetVersionC); return UpdateFailed; } } else { if (!settings.contains(autoUpdateFailedVersionC)) { return UpdateAvailable; } } } return NoUpdate; }
bool ownCloudFolder::init() { QString url = replaceScheme(ownCloudInfo::instance()->webdavUrl() + secondPath()); QString localpath = path(); if( csync_create( &_csync_ctx, localpath.toUtf8().data(), url.toUtf8().data() ) < 0 ) { qDebug() << "Unable to create csync-context!"; slotCSyncError(tr("Unable to create csync-context")); _csync_ctx = 0; } else { csync_set_log_callback( _csync_ctx, csyncLogCatcher ); csync_set_log_verbosity(_csync_ctx, 11); MirallConfigFile cfgFile; csync_set_config_dir( _csync_ctx, cfgFile.configPath().toUtf8() ); csync_enable_conflictcopys(_csync_ctx); QString excludeList = cfgFile.excludeFile(); if( !excludeList.isEmpty() ) { qDebug() << "==== added CSync exclude List: " << excludeList.toUtf8(); csync_add_exclude_list( _csync_ctx, excludeList.toUtf8() ); } csync_set_auth_callback( _csync_ctx, getauth ); if( csync_init( _csync_ctx ) < 0 ) { qDebug() << "Could not initialize csync!" << csync_get_error(_csync_ctx) << csync_get_error_string(_csync_ctx); slotCSyncError(CSyncThread::csyncErrorToString(csync_get_error(_csync_ctx), csync_get_error_string(_csync_ctx))); csync_destroy(_csync_ctx); _csync_ctx = 0; } setProxy(); } return _csync_ctx; }
void OwncloudSetupPage::setupCustomization() { // set defaults for the customize labels. _ui.sideLabel->setText( QString::null ); _ui.sideLabel->setFixedWidth(160); _ui.topLabel->hide(); _ui.bottomLabel->hide(); MirallConfigFile cfg; QVariant variant = cfg.customMedia( MirallConfigFile::oCSetupTop ); setupCustomMedia( variant, _ui.topLabel ); variant = cfg.customMedia( MirallConfigFile::oCSetupSide ); setupCustomMedia( variant, _ui.sideLabel ); variant = cfg.customMedia( MirallConfigFile::oCSetupBottom ); setupCustomMedia( variant, _ui.bottomLabel ); QString fixUrl = cfg.customMedia( MirallConfigFile::oCSetupFixUrl ).toString(); if( !fixUrl.isEmpty() ) { setOCUrl( fixUrl ); _ui.leUrl->setEnabled( false ); _ui.cbSecureConnect->hide(); _ui.leUrl->hide(); _ui.protocolLabel->hide(); _ui.serverAddressLabel->hide(); } }
void OwncloudSetupWizard::startWizard(bool intro) { // create the ocInfo object connect(ownCloudInfo::instance(),SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),SLOT(slotOwnCloudFound(QString,QString,QString,QString))); connect(ownCloudInfo::instance(),SIGNAL(noOwncloudFound(QNetworkReply*)),SLOT(slotNoOwnCloudFound(QNetworkReply*))); connect(ownCloudInfo::instance(),SIGNAL(webdavColCreated(QNetworkReply::NetworkError)),SLOT(slotCreateRemoteFolderFinished(QNetworkReply::NetworkError))); MirallConfigFile cfgFile; QString url = cfgFile.ownCloudUrl(); if( !url.isEmpty() ) { _ocWizard->setOCUrl( url ); } #ifdef OWNCLOUD_CLIENT QString user = cfgFile.ownCloudUser(); if( !user.isEmpty() ) { _ocWizard->setOCUser( user ); } bool doStore = cfgFile.passwordStorageAllowed(); _ocWizard->setAllowPasswordStorage( doStore ); if (intro) _ocWizard->setStartId(OwncloudWizard::Page_oCWelcome); else _ocWizard->setStartId(OwncloudWizard::Page_oCSetup); #endif _ocWizard->restart(); _ocWizard->show(); }
void NetworkSettings::saveProxySettings() { MirallConfigFile cfgFile; if (_ui->noProxyRadioButton->isChecked()){ cfgFile.setProxyType(QNetworkProxy::NoProxy); } else if (_ui->systemProxyRadioButton->isChecked()){ cfgFile.setProxyType(QNetworkProxy::DefaultProxy); } else if (_ui->manualProxyRadioButton->isChecked()) { int type = _ui->typeComboBox->itemData(_ui->typeComboBox->currentIndex()).toInt(); bool needsAuth = _ui->authRequiredcheckBox->isChecked(); QString user = _ui->userLineEdit->text(); QString pass = _ui->passwordLineEdit->text(); cfgFile.setProxyType(type, _ui->hostLineEdit->text(), _ui->portSpinBox->value(), needsAuth, user, pass); } ClientProxy proxy; proxy.setupQtProxyFromConfig(); // Refresh the Qt proxy settings as the // quota check can happen all the time. // ...and set the folders dirty, they refresh their proxy next time they // start the sync. FolderMan::instance()->setDirtyProxy(true); }
void GeneralSettings::saveMiscSettings() { MirallConfigFile cfgFile; bool isChecked = _ui->monoIconsCheckBox->isChecked(); cfgFile.setMonoIcons(isChecked); Theme::instance()->setSystrayUseMonoIcons(isChecked); }
Folder::Folder(const QString &alias, const QString &path, const QString& secondPath, QObject *parent) : QObject(parent) , _path(path) , _remotePath(secondPath) , _alias(alias) , _enabled(true) , _csyncError(false) , _csyncUnavail(false) , _wipeDb(false) , _proxyDirty(true) , _journal(path) , _csync_ctx(0) { qsrand(QTime::currentTime().msec()); _timeSinceLastSync.start(); MirallConfigFile cfg; _syncResult.setStatus( SyncResult::NotYetStarted ); // check if the local path exists checkLocalPath(); int polltime = cfg.remotePollInterval(); qDebug() << "setting remote poll timer interval to" << polltime << "msec"; _pollTimer.setInterval( polltime ); QObject::connect(&_pollTimer, SIGNAL(timeout()), this, SLOT(slotPollTimerTimeout())); _pollTimer.start(); _syncResult.setFolder(alias); }
ProtocolWidget::~ProtocolWidget() { MirallConfigFile cfg; cfg.saveGeometryHeader(_ui->_treeWidget->header() ); delete _ui; }
void IgnoreListEditor::readIgnoreFile(const QString &file, bool readOnly) { MirallConfigFile cfgFile; const QString disabledTip(tr("This entry is provided by the system at '%1' " "and cannot be modified in this view.") .arg(QDir::toNativeSeparators(cfgFile.excludeFile(MirallConfigFile::SystemScope)))); QFile ignores(file); if (ignores.open(QIODevice::ReadOnly)) { while (!ignores.atEnd()) { QString line = QString::fromUtf8(ignores.readLine()); line.chop(1); if (!line.isEmpty() && !line.startsWith("#")) { QListWidgetItem *item = new QListWidgetItem; setupItemFlags(item); if (line.startsWith("]")) { line = line.mid(1); item->setCheckState(Qt::Checked); } item->setText(line); if (readOnly) { item->setFlags(item->flags() ^ Qt::ItemIsEnabled); item->setToolTip(disabledTip); } ui->listWidget->addItem(item); } } } }
bool Folder::init() { QString url = Utility::toCSyncScheme(ownCloudInfo::instance()->webdavUrl() + secondPath()); QString localpath = path(); if( csync_create( &_csync_ctx, localpath.toUtf8().data(), url.toUtf8().data() ) < 0 ) { qDebug() << "Unable to create csync-context!"; slotCSyncError(tr("Unable to create csync-context")); _csync_ctx = 0; } else { csync_set_log_callback( _csync_ctx, csyncLogCatcher ); csync_set_log_verbosity(_csync_ctx, 11); MirallConfigFile cfgFile; csync_set_config_dir( _csync_ctx, cfgFile.configPath().toUtf8() ); csync_enable_conflictcopys(_csync_ctx); setIgnoredFiles(); cfgFile.getCredentials()->syncContextPreInit(_csync_ctx); if( csync_init( _csync_ctx ) < 0 ) { qDebug() << "Could not initialize csync!" << csync_get_error(_csync_ctx) << csync_get_error_string(_csync_ctx); slotCSyncError(CSyncThread::csyncErrorToString(csync_get_error(_csync_ctx), csync_get_error_string(_csync_ctx))); csync_destroy(_csync_ctx); _csync_ctx = 0; } } return _csync_ctx; }
void CredentialStore::fetchCredentials() { _state = Fetching; MirallConfigFile cfgFile; if( ++_tries > MAX_LOGIN_ATTEMPTS ) { qDebug() << "Too many attempts to enter password!"; _state = TooManyAttempts; return; } bool ok = false; QString pwd; _state = Fetching; _user = cfgFile.ownCloudUser(); switch( _type ) { case CredentialStore::User: { /* Ask the user for the password */ /* Fixme: Move user interaction out here. */ pwd = QInputDialog::getText(0, QApplication::translate("MirallConfigFile","Password Required"), QApplication::translate("MirallConfigFile","Please enter your %1 password:"******"QtKeyChain: Not yet implemented!"; _state = Error; #endif break; } default: { break; } }
bool OCUpdater::updateSucceeded() const { MirallConfigFile cfg; QSettings settings(cfg.configFile(), QSettings::IniFormat); qint64 targetVersionInt = Helper::stringVersionToInt(settings.value(updateTargetVersionC).toString()); qint64 currentVersion = Helper::currentVersionToInt(); return currentVersion >= targetVersionInt; }
SettingsDialog::SettingsDialog(Application *app, QWidget *parent) : QDialog(parent), _ui(new Ui::SettingsDialog) { _ui->setupUi(this); setObjectName("Settings"); // required as group for saveGeometry call setWindowTitle(tr("%1 Settings").arg(Theme::instance()->appNameGUI())); QIcon generalIcon(QLatin1String(":/mirall/resources/settings.png")); QListWidgetItem *general = new QListWidgetItem(generalIcon, tr("General"), _ui->labelWidget); general->setSizeHint(QSize(0, 32)); _ui->labelWidget->addItem(general); GeneralSettings *generalSettings = new GeneralSettings; _ui->stack->addWidget(generalSettings); QIcon networkIcon(QLatin1String(":/mirall/resources/network.png")); QListWidgetItem *network = new QListWidgetItem(networkIcon, tr("Network"), _ui->labelWidget); network->setSizeHint(QSize(0, 32)); _ui->labelWidget->addItem(network); NetworkSettings *networkSettings = new NetworkSettings; _ui->stack->addWidget(networkSettings); connect(networkSettings, SIGNAL(proxySettingsChanged()), app, SLOT(slotSetupProxy())); connect(networkSettings, SIGNAL(proxySettingsChanged()), FolderMan::instance(), SLOT(slotScheduleAllFolders())); //connect(generalSettings, SIGNAL(resizeToSizeHint()), SLOT(resizeToSizeHint())); _accountSettings = new AccountSettings(this); addAccount(tr("Account"), _accountSettings); slotUpdateAccountState(); connect( app, SIGNAL(folderStateChanged(Folder*)), _accountSettings, SLOT(slotUpdateFolderState(Folder*))); connect( app, SIGNAL(folderStateChanged(Folder*)), SLOT(slotUpdateAccountState())); connect( _accountSettings, SIGNAL(addASync()), app, SLOT(slotFolderAdded()) ); connect( _accountSettings, SIGNAL(folderChanged()), app, SLOT(slotFoldersChanged())); connect( _accountSettings, SIGNAL(openFolderAlias(const QString&)), app, SLOT(slotFolderOpenAction(QString))); connect( _accountSettings, SIGNAL(openProgressDialog()), app, SLOT(slotItemProgressDialog())); connect( ProgressDispatcher::instance(), SIGNAL(progressInfo(QString, Progress::Info)), _accountSettings, SLOT(slotSetProgress(QString, Progress::Info)) ); connect( ProgressDispatcher::instance(), SIGNAL(progressSyncProblem(QString,Progress::SyncProblem)), _accountSettings, SLOT(slotProgressProblem(QString,Progress::SyncProblem)) ); _ui->labelWidget->setCurrentRow(_ui->labelWidget->row(general)); connect(_ui->labelWidget, SIGNAL(currentRowChanged(int)), _ui->stack, SLOT(setCurrentIndex(int))); QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close); connect(closeButton, SIGNAL(pressed()), SLOT(accept())); MirallConfigFile cfg; cfg.restoreGeometry(this); }
void OCUpdater::slotStartInstaller() { MirallConfigFile cfg; QSettings settings(cfg.configFile(), QSettings::IniFormat); QString updateFile = settings.value(updateAvailableC).toString(); settings.setValue(autoUpdateAttemptedC, true); settings.sync(); qDebug() << "Running updater" << updateFile; QProcess::startDetached(updateFile, QStringList() << "/S" << "/launch"); }
void CSyncThread::startSync() { if (!_syncMutex.tryLock()) { qDebug() << Q_FUNC_INFO << "WARNING: Another sync seems to be running. Not starting a new one."; return; } if( ! _csync_ctx ) { qDebug() << "XXXXXXXXXXXXXXXX FAIL: do not have csync_ctx!"; } qDebug() << Q_FUNC_INFO << "Sync started"; qDebug() << "starting to sync " << qApp->thread() << QThread::currentThread(); _mutex.lock(); _syncedItems.clear(); _needsUpdate = false; _mutex.unlock(); // cleans up behind us and emits finished() to ease error handling CSyncRunScopeHelper helper(_csync_ctx, this); // maybe move this somewhere else where it can influence a running sync? MirallConfigFile cfg; int downloadLimit = 0; if (cfg.useDownloadLimit()) { downloadLimit = cfg.downloadLimit(); } csync_set_module_property(_csync_ctx, "bandwidth_limit_download", &downloadLimit); int uploadLimit = -75; // 75% int useUpLimit = cfg.useUploadLimit(); if ( useUpLimit >= 1) { uploadLimit = cfg.uploadLimit(); } else if (useUpLimit == 0) { uploadLimit = 0; } csync_set_module_property(_csync_ctx, "bandwidth_limit_upload", &uploadLimit); csync_set_progress_callback( _csync_ctx, cb_progress ); csync_set_module_property(_csync_ctx, "csync_context", _csync_ctx); csync_set_userdata(_csync_ctx, this); if (_lastAuthCookies.length() > 0) { // Stuff cookies inside csync, then we can avoid the intermediate HTTP 401 reply // when https://github.com/owncloud/core/pull/4042 is merged. QString cookiesAsString; foreach(QNetworkCookie c, _lastAuthCookies) { cookiesAsString += c.name(); cookiesAsString += '='; cookiesAsString += c.value(); cookiesAsString += "; "; }
SettingsDialogMac::SettingsDialogMac(ownCloudGui *gui, QWidget *parent) : MacPreferencesWindow(parent) { // do not show minimize button. There is no use, and retoring the // dialog from minimize is broken in MacPreferencesWindow setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint); // Emulate dialog behavior: Escape means close QAction *closeDialogAction = new QAction(this); closeDialogAction->setShortcut(QKeySequence(Qt::Key_Escape)); connect(closeDialogAction, SIGNAL(triggered()), SLOT(close())); addAction(closeDialogAction); // People perceive this as a Window, so also make Ctrl+W work QAction *closeWindowAction = new QAction(this); closeWindowAction->setShortcut(QKeySequence("Ctrl+W")); connect(closeWindowAction, SIGNAL(triggered()), SLOT(close())); addAction(closeWindowAction); setObjectName("SettingsMac"); // required as group for saveGeometry call setWindowTitle(tr("%1").arg(Theme::instance()->appNameGUI())); _accountSettings = new AccountSettings; QIcon icon = Theme::instance()->syncStateIcon(SyncResult::Undefined, true); _accountIdx = addPreferencesPanel(icon, tr("Account"), _accountSettings); QIcon protocolIcon(QLatin1String(":/mirall/resources/activity.png")); _protocolWidget = new ProtocolWidget; _protocolIdx = addPreferencesPanel(protocolIcon, tr("Activity"), _protocolWidget); QIcon generalIcon = MacStandardIcon::icon(MacStandardIcon::PreferencesGeneral); GeneralSettings *generalSettings = new GeneralSettings; addPreferencesPanel(generalIcon, tr("General"), generalSettings); QIcon networkIcon = MacStandardIcon::icon(MacStandardIcon::Network); NetworkSettings *networkSettings = new NetworkSettings; addPreferencesPanel(networkIcon, tr("Network"), networkSettings); FolderMan *folderMan = FolderMan::instance(); connect( folderMan, SIGNAL(folderSyncStateChange(QString)), this, SLOT(slotSyncStateChange(QString))); connect( ProgressDispatcher::instance(), SIGNAL(progressInfo(QString, Progress::Info)), _accountSettings, SLOT(slotSetProgress(QString, Progress::Info)) ); QAction *showLogWindow = new QAction(this); showLogWindow->setShortcut(QKeySequence("F12")); connect(showLogWindow, SIGNAL(triggered()), gui, SLOT(slotToggleLogBrowser())); addAction(showLogWindow); MirallConfigFile cfg; cfg.restoreGeometry(this); }
void OwncloudSetupWizard::startWizard() { MirallConfigFile cfgFile; QString url = cfgFile.ownCloudUrl(); if( !url.isEmpty() ) { _ocWizard->setOCUrl( url ); } _ocWizard->restart(); _ocWizard->show(); }
void OwncloudWizardResultPage::setupCustomization() { // set defaults for the customize labels. _ui.topLabel->setText( QString::null ); _ui.topLabel->hide(); MirallConfigFile cfg; QVariant variant = cfg.customMedia( MirallConfigFile::oCSetupResultTop ); setupCustomMedia( variant, _ui.topLabel ); }
void OwncloudSetupWizard::slotNoOwnCloudFound( QNetworkReply::NetworkError err ) { _ocWizard->appendToResultWidget(tr("<font color=\"red\">Failed to connect to ownCloud!</font>") ); _ocWizard->appendToResultWidget(tr("Error number %1").arg(err) ); // remove the config file again MirallConfigFile cfgFile; cfgFile.removeConnection(); // Error detection! }
QString ownCloudFolder::secondPath() const { QString re(_secondPath); MirallConfigFile cfg; const QString ocUrl = cfg.ownCloudUrl(QString::null, true); // qDebug() << "**** " << ocUrl << " <-> " << re; if( re.startsWith( ocUrl ) ) { re.remove( ocUrl ); } return re; }
LogWidget::LogWidget(QWidget *parent) :QPlainTextEdit(parent) { setReadOnly( true ); QFont font; font.setFamily(QLatin1String("Courier New")); font.setFixedPitch(true); document()->setDefaultFont( font ); MirallConfigFile cfg; int lines = cfg.maxLogLines(); // qDebug() << "# ## Have " << lines << " Loglines!"; document()->setMaximumBlockCount( lines ); }
void ownCloudFolder::startSync(const QStringList &pathList) { if (_thread && _thread->isRunning()) { qCritical() << "* ERROR csync is still running and new sync requested."; return; } delete _csync; delete _thread; _errors.clear(); _csyncError = false; _csyncUnavail = false; _wipeDb = false; MirallConfigFile cfgFile; _syncResult.clearErrors(); // we now have watchers for everything, so every sync is remote. _syncResult.setLocalRunOnly( false ); _syncResult.setStatus( SyncResult::SyncPrepare ); emit syncStateChange(); QString url = replaceScheme(_secondPath); qDebug() << "*** Start syncing url to ownCloud: " << url; _thread = new QThread(this); _csync = new CSyncThread( path(), url); _csync->moveToThread(_thread); QList<QNetworkProxy> proxies = QNetworkProxyFactory::proxyForQuery(QUrl(cfgFile.ownCloudUrl())); // We set at least one in Application Q_ASSERT(proxies.count() > 0); QNetworkProxy proxy = proxies.first(); _csync->setConnectionDetails( CredentialStore::instance()->user(), CredentialStore::instance()->password(), proxy ); qRegisterMetaType<SyncFileItemVector>("SyncFileItemVector"); connect( _csync, SIGNAL(treeWalkResult(const SyncFileItemVector&)), this, SLOT(slotThreadTreeWalkResult(const SyncFileItemVector&)), Qt::QueuedConnection); connect(_csync, SIGNAL(started()), SLOT(slotCSyncStarted()), Qt::QueuedConnection); connect(_csync, SIGNAL(finished()), SLOT(slotCSyncFinished()), Qt::QueuedConnection); connect(_csync, SIGNAL(csyncError(QString)), SLOT(slotCSyncError(QString)), Qt::QueuedConnection); connect(_csync, SIGNAL(csyncUnavailable()), SLOT(slotCsyncUnavailable()), Qt::QueuedConnection); _thread->start(); QMetaObject::invokeMethod(_csync, "startSync", Qt::QueuedConnection); emit syncStarted(); }
void NetworkSettings::loadBWLimitSettings() { MirallConfigFile cfgFile; _ui->downloadLimitRadioButton->setChecked(cfgFile.useDownloadLimit()); int uploadLimit = cfgFile.useUploadLimit(); if ( uploadLimit >= 1 ) { _ui->uploadLimitRadioButton->setChecked(true); } else if (uploadLimit == 0){ _ui->noUploadLimitRadioButton->setChecked(true); } else { _ui->autoUploadLimitRadioButton->setChecked(true); } _ui->downloadSpinBox->setValue(cfgFile.downloadLimit()); _ui->uploadSpinBox->setValue(cfgFile.uploadLimit()); }
void OwncloudHttpCredsPage::initializePage() { WizardCommon::initErrorLabel(_ui.errorLabel); MirallConfigFile cfgFile; HttpCredentials* httpCreds(dynamic_cast< HttpCredentials* >(cfgFile.getCredentials())); if (httpCreds) { const QString user = httpCreds->user(); if (!user.isEmpty()) { _ui.leUsername->setText(user); } } _ui.leUsername->setFocus(); }
bool OCUpdater::performUpdate() { MirallConfigFile cfg; QSettings settings(cfg.configFile(), QSettings::IniFormat); QString updateFile = settings.value(updateAvailableC).toString(); if (!updateFile.isEmpty() && QFile(updateFile).exists()) { if (QMessageBox::information(0, tr("New Update Ready"), tr("A new update is about to be installed. The updater may ask\n" "for additional privileges during the process."), QMessageBox::Ok)) { slotStartInstaller(); return true; } } return false; }
void Folder::setIgnoredFiles() { MirallConfigFile cfgFile; csync_clear_exclude_list( _csync_ctx ); QString excludeList = cfgFile.excludeFile( MirallConfigFile::SystemScope ); if( !excludeList.isEmpty() ) { qDebug() << "==== added system ignore list to csync:" << excludeList.toUtf8(); csync_add_exclude_list( _csync_ctx, excludeList.toUtf8() ); } excludeList = cfgFile.excludeFile( MirallConfigFile::UserScope ); if( !excludeList.isEmpty() ) { qDebug() << "==== added user defined ignore list to csync:" << excludeList.toUtf8(); csync_add_exclude_list( _csync_ctx, excludeList.toUtf8() ); } }
FolderMan::FolderMan(QObject *parent) : QObject(parent), _syncEnabled( true ) { // if QDir::mkpath would not be so stupid, I would not need to have this // duplication of folderConfigPath() here MirallConfigFile cfg; QDir storageDir(cfg.configPath()); storageDir.mkpath(QLatin1String("folders")); _folderConfigPath = cfg.configPath() + QLatin1String("folders"); _folderChangeSignalMapper = new QSignalMapper(this); connect(_folderChangeSignalMapper, SIGNAL(mapped(const QString &)), this, SIGNAL(folderSyncStateChange(const QString &))); }
void OwncloudSetupWizard::testOwnCloudConnect() { // write a temporary config. QDateTime now = QDateTime::currentDateTime(); _configHandle = now.toString(QLatin1String("MMddyyhhmmss")); MirallConfigFile cfgFile( _configHandle ); cfgFile.writeOwncloudConfig( Theme::instance()->appName(), _ocWizard->field(QLatin1String("OCUrl")).toString(), _ocWizard->field(QLatin1String("OCUser")).toString(), _ocWizard->field(QLatin1String("OCPasswd")).toString(), _ocWizard->field(QLatin1String("secureConnect")).toBool(), _ocWizard->field(QLatin1String("PwdNoLocalStore")).toBool() ); // If there is already a config, take its proxy config. if( ownCloudInfo::instance()->isConfigured() ) { MirallConfigFile prevCfg; if( prevCfg.proxyType() != QNetworkProxy::DefaultProxy ) { cfgFile.setProxyType( prevCfg.proxyType(), prevCfg.proxyHostName(), prevCfg.proxyPort(), prevCfg.proxyUser(), prevCfg.proxyPassword() ); } } // now start ownCloudInfo to check the connection. ownCloudInfo* info = ownCloudInfo::instance(); info->setCustomConfigHandle( _configHandle ); if( info->isConfigured() ) { // reset the SSL Untrust flag to let the SSL dialog appear again. info->resetSSLUntrust(); _checkInstallationRequest = info->checkInstallation(); } else { qDebug() << " ownCloud seems not to be configured, can not start test connect."; } }
// 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(), this); MirallConfigFile cfg; fw->addIgnoreListFile( cfg.excludeFile(MirallConfigFile::SystemScope) ); fw->addIgnoreListFile( cfg.excludeFile(MirallConfigFile::UserScope) ); // Connect the folderChanged 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(folderChanged(QString)), _folderWatcherSignalMapper, SLOT(map())); _folderWatcherSignalMapper->setMapping(fw, folder->alias()); _folderWatchers.insert(folder->alias(), fw); } }