예제 #1
0
void OwncloudSetupWizard::setupLocalSyncFolder()
{
    _localFolder = QDir::homePath() + QDir::separator() + Theme::instance()->defaultClientFolder();

    if( ! _folderMan ) return;

    qDebug() << "Setup local sync folder for new oC connection " << _localFolder;
    QDir fi( _localFolder );

    bool localFolderOk = true;
    if( fi.exists() ) {
        // there is an existing local folder. If its non empty, it can only be synced if the
        // ownCloud is newly created.
        _ocWizard->appendToResultWidget( tr("Local sync folder %1 already exists, setting it up for sync.<br/><br/>").arg(_localFolder));
    } else {
        QString res = tr("Creating local sync folder %1... ").arg(_localFolder);
        if( fi.mkpath( _localFolder ) ) {
            Utility::setupFavLink( _localFolder );
            // FIXME: Create a local sync folder.
            res += tr("ok");
        } else {
            res += tr("failed.");
            qDebug() << "Failed to create " << fi.path();
            localFolderOk = false;
        }
        _ocWizard->appendToResultWidget( res );
    }

    if( localFolderOk ) {
        _remoteFolder = Theme::instance()->defaultServerFolder();
        slotCreateRemoteFolder(true);
    }
}
예제 #2
0
void FolderWizardTargetPage::initializePage()
{
    showWarn();

    /* check the owncloud configuration file and query the ownCloud */
    ownCloudInfo *ocInfo = ownCloudInfo::instance();
    if( ocInfo->isConfigured() ) {
        connect( ocInfo, SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),
                 SLOT(slotOwnCloudFound(QString,QString,QString,QString)));
        connect( ocInfo, SIGNAL(noOwncloudFound(QNetworkReply*)),
                 SLOT(slotNoOwnCloudFound(QNetworkReply*)));
        connect( ocInfo, SIGNAL(ownCloudDirExists(QString,QNetworkReply*)),
                 SLOT(slotDirCheckReply(QString,QNetworkReply*)));
        connect( ocInfo, SIGNAL(webdavColCreated(QNetworkReply::NetworkError)),
                 SLOT(slotCreateRemoteFolderFinished( QNetworkReply::NetworkError )));

        connect(_ui._buttCreateFolder, SIGNAL(clicked()), SLOT(slotCreateRemoteFolder()));
        ocInfo->checkInstallation();

        _ui.OCFolderLineEdit->setEnabled( false );

        QString dir = _ui.OCFolderLineEdit->text();
        if( !dir.isEmpty() ) {
            slotFolderTextChanged( dir );
        }
    }
}
예제 #3
0
void FolderWizardTargetPage::slotAddRemoteFolder()
{
    QTreeWidgetItem *current = _ui.folderTreeWidget->currentItem();

    QString parent('/');
    if (current) {
        parent = current->data(0, Qt::UserRole).toString();
    }

    QInputDialog *dlg = new QInputDialog(this);

    dlg->setWindowTitle(tr("Add Remote Folder"));
    dlg->setLabelText(tr("Enter the name of the new folder:"));
    dlg->setTextValue(parent);
    dlg->open(this, SLOT(slotCreateRemoteFolder(QString)));
    dlg->setAttribute(Qt::WA_DeleteOnClose);
}
예제 #4
0
void FolderWizardTargetPage::initializePage()
{
    slotToggleItems();
    showWarn();

    /* check the owncloud configuration file and query the ownCloud */
    ownCloudInfo *ocInfo = ownCloudInfo::instance();
    if( ocInfo->isConfigured() ) {
      connect(ocInfo,SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),SLOT(slotOwnCloudFound(QString,QString,QString,QString)));
      connect(ocInfo,SIGNAL(noOwncloudFound(QNetworkReply*)),SLOT(slotNoOwnCloudFound(QNetworkReply*)));
      connect(_ui._buttCreateFolder, SIGNAL(clicked()), SLOT(slotCreateRemoteFolder()));
      ocInfo->checkInstallation();

    } else {
      _ui.OCRadioBtn->setEnabled( false );
      _ui.OCFolderLineEdit->setEnabled( false );
    }

    QString dir = _ui.OCFolderLineEdit->text();
    if( !dir.isEmpty() ) {
        slotFolderTextChanged( dir );
    }
}