Fix the folder setup wizard.

This commit is contained in:
Klaas Freitag 2013-05-24 08:11:17 +02:00
parent 0683c26d41
commit 70f627ba06
2 changed files with 6 additions and 26 deletions

View file

@ -637,30 +637,11 @@ void Application::slotAddFolder()
QString alias = _folderWizard->field(QLatin1String("alias")).toString();
QString sourceFolder = _folderWizard->field(QLatin1String("sourceFolder")).toString();
QString backend = QLatin1String("csync");
QString backend = QLatin1String("owncloud");
QString targetPath;
bool onlyThisLAN = false;
bool onlyOnline = false;
if (_folderWizard->field(QLatin1String("local?")).toBool()) {
// setup a local csync folder
targetPath = _folderWizard->field(QLatin1String("targetLocalFolder")).toString();
} else if (_folderWizard->field(QLatin1String("remote?")).toBool()) {
// setup a remote csync folder
targetPath = _folderWizard->field(QLatin1String("targetURLFolder")).toString();
onlyOnline = _folderWizard->field(QLatin1String("onlyOnline?")).toBool();
onlyThisLAN = _folderWizard->field(QLatin1String("onlyThisLAN?")).toBool();
(void) onlyOnline;
(void) onlyThisLAN;
} else if( _folderWizard->field(QLatin1String("OC?")).toBool() ||
Theme::instance()->singleSyncFolder()) {
// setup a ownCloud folder
backend = QLatin1String("owncloud");
targetPath = _folderWizard->field(QLatin1String("targetOCFolder")).toString(); //empty in single folder mode
} else {
qWarning() << "* Folder not local and note remote?";
goodData = false;
}
targetPath = _folderWizard->field(QLatin1String("OCFolderLineEdit")).toString();
_folderMan->setSyncEnabled(true); // do start sync again.

View file

@ -166,7 +166,7 @@ FolderWizardTargetPage::FolderWizardTargetPage()
_ui.setupUi(this);
_ui.warnFrame->hide();
registerField(QLatin1String("targetOCFolder"), _ui.OCFolderLineEdit);
registerField(QLatin1String("OCFolderLineEdit"), _ui.OCFolderLineEdit);
connect( _ui.OCFolderLineEdit, SIGNAL(textChanged(QString)),
SLOT(slotFolderTextChanged(QString)));
@ -213,11 +213,10 @@ void FolderWizardTargetPage::slotDirCheckReply(const QString &url, QNetworkReply
void FolderWizardTargetPage::slotCreateRemoteFolder()
{
_ui.OCFolderLineEdit->setEnabled( false );
const QString folder = _ui.OCFolderLineEdit->text();
if( folder.isEmpty() ) return;
_ui.OCFolderLineEdit->setEnabled( false );
qDebug() << "creating folder on ownCloud: " << folder;
ownCloudInfo::instance()->mkdirRequest( folder );
}
@ -244,8 +243,8 @@ FolderWizardTargetPage::~FolderWizardTargetPage()
bool FolderWizardTargetPage::isComplete() const
{
QString dir = _ui.OCFolderLineEdit->text();
if( dir.isEmpty() ) {
showWarn( tr("Better do not use the remote root directory.<br/>If you do, you can <b>not</b> mirror another local folder."), false);
if( dir.isEmpty() || dir == QLatin1String("/") ) {
showWarn( tr("If you sync the root folder, you can <b>not</b> configure another sync directory."), false);
return true;
} else {
if( _dirChecked ) {