コード例 #1
0
ファイル: owncloudwizard.cpp プロジェクト: Manoharsai/mirall
// Called if the user changes the user- or url field. Adjust the texts and
// evtl. warnings on the dialog.
void OwncloudSetupPage::slotHandleUserInput()
{
    // if the url has not changed, return.
    if( ! urlHasChanged() ) {
        // disable the advanced button as nothing has changed.
        _ui.cbAdvanced->setEnabled(false);
        _ui.advancedBox->setEnabled(false);
    } else {
        // Enable advanced stuff for new connection configuration.
        _ui.cbAdvanced->setEnabled(true);
        _ui.advancedBox->setEnabled(true);
    }

    const QString locFolder = localFolder();

    // check if the local folder exists. If so, and if its not empty, show a warning.
    QDir dir( locFolder );
    QStringList entries = dir.entryList(QDir::AllEntries | QDir::NoDotAndDotDot);

    QString t;

    if( !urlHasChanged() && _configExists ) {
        // This is the password change mode: No change to the url and a config
        // to an ownCloud exists.
        t = tr("Change the Password for your configured account.");
    } else {
        // Complete new setup.
        _ui.pbSelectLocalFolder->setText(QDir::toNativeSeparators(locFolder));

        if( _remoteFolder.isEmpty() || _remoteFolder == QLatin1String("/") ) {
            t = tr("Your entire account will be synced to the local folder '%1'.")
                    .arg(QDir::toNativeSeparators(locFolder));
        } else {
            t = tr("%1 folder '%2' is synced to local folder '%3'")
                    .arg(Theme::instance()->appName()).arg(_remoteFolder)
                    .arg(QDir::toNativeSeparators(locFolder));
        }

        if ( _multipleFoldersExist ) {
            t += tr("<p><small><strong>Warning:</strong> You currently have multiple folders "
                    "configured. If you continue with the current settings, the folder configurations "
                    "will be discarded and a single root folder sync will be created!</small></p>");
        }

        if( entries.count() > 0) {
            // the directory is not empty
            if (!_ui.cbAdvanced->isChecked()) {
                t += tr("<p><small><strong>Warning:</strong> The local directory is not empty. "
                        "Pick a resolution in the advanced settings!</small></p>");
            }
            _ui.resolutionWidget->setVisible(true);
        } else {
            // the dir is empty, which means that there is no problem.
            _ui.resolutionWidget->setVisible(false);
        }
    }

    _ui.syncModeLabel->setText(t);
    _ui.syncModeLabel->setFixedHeight(_ui.syncModeLabel->sizeHint().height());
}
コード例 #2
0
ファイル: owncloudwizard.cpp プロジェクト: samaraCro/mirall
// Called if the user changes the user- or url field. Adjust the texts and
// evtl. warnings on the dialog.
void OwncloudSetupPage::slotHandleUserInput()
{
    // if the url has not changed, return.
    if( ! urlHasChanged() ) {
        // disable the advanced button as nothing has changed.
        _ui.cbAdvanced->setEnabled(false);
        _ui.advancedBox->setEnabled(false);
    } else {
        // Enable advanced stuff for new connection configuration.
        _ui.cbAdvanced->setEnabled(true);
        _ui.advancedBox->setEnabled(true);
    }

    const QString locFolder = localFolder();

    // check if the local folder exists. If so, and if its not empty, show a warning.
    QDir dir( locFolder );
    QStringList entries = dir.entryList(QDir::AllEntries | QDir::NoDotAndDotDot);

    QString t;

    if( !urlHasChanged() && _configExists ) {
        // This is the password change mode: No change to the url and a config
        // to an ownCloud exists.
        t = tr("Change the Password for your configured ownCloud.");
    } else {
        // Complete new setup.
        _ui.pbSelectLocalFolder->setText(locFolder);

        if( _remoteFolder.isEmpty() || _remoteFolder == QLatin1String("/") ) {
            t = tr("Your entire account will be synced to the local folder '%1'").arg(locFolder);
        } else {
            t = tr("ownCloud folder '%1' is synced to local folder '%2'").arg(_remoteFolder).arg(locFolder);
        }

        if( entries.count() > 0 ) {
            // the directory is not empty
            // setErrorString( tr("The local directory is not empty! Open advanced settings for detailed settings.") );
            t += QLatin1String("<p/>");
            t += tr("The local directory is not empty. Check the advanced settings!");
            _ui.cbSyncFromScratch->setEnabled(true);
        } else {
            // the dir is empty, which means that there is no problem.
            _ui.cbSyncFromScratch->setEnabled(false);
        }
    }

    _ui.syncModeLabel->setText(t);
}