本文整理汇总了C++中MirallConfigFile类的典型用法代码示例。如果您正苦于以下问题:C++ MirallConfigFile类的具体用法?C++ MirallConfigFile怎么用?C++ MirallConfigFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MirallConfigFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qDebug
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();
}
示例2: updateStateOnStart
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;
}
示例3: replaceScheme
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;
}
示例4: setupCustomMedia
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();
}
}
示例5: connect
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();
}
示例6: saveProxySettings
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);
}
示例7: saveMiscSettings
void GeneralSettings::saveMiscSettings()
{
MirallConfigFile cfgFile;
bool isChecked = _ui->monoIconsCheckBox->isChecked();
cfgFile.setMonoIcons(isChecked);
Theme::instance()->setSystrayUseMonoIcons(isChecked);
}
示例8: QObject
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);
}
示例9:
ProtocolWidget::~ProtocolWidget()
{
MirallConfigFile cfg;
cfg.saveGeometryHeader(_ui->_treeWidget->header() );
delete _ui;
}
示例10: disabledTip
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);
}
}
}
}
示例11: secondPath
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;
}
示例12: qDebug
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:")
.arg(Theme::instance()->appName()),
QLineEdit::Password,
QString::null, &ok);
if( !ok ) {
_state = UserCanceled;
}
break;
}
case CredentialStore::Settings: {
/* Read from config file. */
pwd = cfgFile.ownCloudPasswd();
ok = true;
break;
}
case CredentialStore::KeyChain: {
#ifdef WITH_QTKEYCHAIN
_state = AsyncFetching;
if( !_user.isEmpty() ) {
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName());
// job->setAutoDelete( false );
// job->setSettings( )
job->setKey( keyChainKey( cfgFile.ownCloudUrl() ) );
connect( job, SIGNAL(finished(QKeychain::Job*)), this,
SLOT(slotKeyChainReadFinished(QKeychain::Job*)));
job->start();
}
#else
qDebug() << "QtKeyChain: Not yet implemented!";
_state = Error;
#endif
break;
}
default: {
break;
}
}
示例13: updateSucceeded
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;
}
示例14: QDialog
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);
}
示例15: slotStartInstaller
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");
}