Ejemplo n.º 1
0
void BackstageOSF::setOnlineDataManager(OnlineDataManager *odm)
{
	_odm = odm;
	_model->setOnlineDataManager(_odm);

	_newFolderButton->setEnabled(_model->isAuthenticated());
	_nameButton->setVisible(_model->isAuthenticated());

	connect(_model, SIGNAL(authenticationSuccess()), this, SLOT(authenticatedHandler()));
}
Ejemplo n.º 2
0
void FSBrowser::setFSModel(FSBModel *model)
{
    _model = model;
    _model->refresh();
    refresh();

    connect(_model, SIGNAL(entriesChanged()), this, SLOT(refresh()));
    connect(_model, SIGNAL(processingEntries()), this, SLOT(processingEntries()));
    connect(_model, SIGNAL(authenticationSuccess()), this, SLOT(refresh()));
    connect(_model, SIGNAL(authenticationClear()), this, SLOT(refresh()));
    connect(_model, SIGNAL(authenticationFail(QString)), this, SLOT(authenticationFailed(QString)));
    connect(_model, SIGNAL(hideAuthentication()), this, SLOT(hideAuthentication()));
}
Ejemplo n.º 3
0
void FSBMOSF::setAuthenticated(bool value)
{
	if (value)
	{
		_isAuthenticated = true;
		emit authenticationSuccess();
		refresh();
	}
	else
	{
		_isAuthenticated = false;
		emit authenticationFail("Username and/or password are not correct. Please try again.");
	}
}
Ejemplo n.º 4
0
void EvernoteSession::auth(const QString& username, const QString& password){
    qDebug() << "EvernoteSession :: auth" << endl;
    try {
        recreateUserStoreClient(true);
        AuthenticationResult result;
        userStoreClient->authenticate(result,username.toStdString(),password.toStdString(),CONSUMER_KEY,CONSUMER_SECRET, 0);
        qDebug() << "EvernoteSession :: got auth token " << result.authenticationToken.c_str();
        Settings::instance()->setUsername(username);
        Settings::instance()->setPassword(password);
        Settings::instance()->setAuthToken(result.authenticationToken.c_str());
        Settings::instance()->setUser(result.user);
        recreateSyncClient(true);
        authenticationSuccess();
    }catch (EDAMUserException& e){
        if(e.errorCode == EDAMErrorCode::DATA_REQUIRED){
            if(e.parameter == "password"){
                authenticationFailed(tr("__empty_password__"));
            }else if(e.parameter == "username"){
                authenticationFailed(tr("__empty_username__"));
            }
        }else if(e.errorCode == EDAMErrorCode::INVALID_AUTH){
            if(e.parameter == "password"){
                authenticationFailed(tr("__invalid_password__"));
            }else if(e.parameter == "username"){
                authenticationFailed(tr("__invalid_username__"));
            }
        }else{
            authenticationFailed(tr("__basic_network_error__"));
        }

    }

    catch (TException &tx) {
        qDebug() << "EvernoteSession :: excetion while login: "******"__basic_network_error__"));
    }
}
Ejemplo n.º 5
0
BackstageOSF::BackstageOSF(QWidget *parent) : BackstagePage(parent)
{
	QGridLayout *layout = new QGridLayout(this);
	layout->setSpacing(0);
	layout->setContentsMargins(0, 0, 0, 0);
	setLayout(layout);

	QWidget *topRow = new QWidget(this);
	layout->addWidget(topRow);

	QGridLayout *topRowLayout = new QGridLayout();
	topRowLayout->setContentsMargins(0, 6, 12, 0);
	topRow->setLayout(topRowLayout);

	QLabel *label = new QLabel("Open Science Framework", topRow);
	QSizePolicy sp = label->sizePolicy();
	sp.setHorizontalStretch(1);
	label->setSizePolicy(sp);
	label->setContentsMargins(12, 12, 12, 1);
	topRowLayout->addWidget(label, 0, 0);

	_nameButton = new QToolButton(topRow);
	_nameButton->hide();
	topRowLayout->addWidget(_nameButton, 0, 1);

	connect(_nameButton, SIGNAL(clicked(bool)), this, SLOT(nameClicked()));

	QWidget *buttonsWidget = new QWidget(this);
	buttonsWidget->setContentsMargins(0, 0, 0, 0);
	layout->addWidget(buttonsWidget);

	QGridLayout *buttonsWidgetLayout = new QGridLayout(buttonsWidget);
	buttonsWidgetLayout->setContentsMargins(0, 0, 12, 0);
	buttonsWidget->setLayout(buttonsWidgetLayout);

	_breadCrumbs = new BreadCrumbs(buttonsWidget);
	buttonsWidgetLayout->addWidget(_breadCrumbs, 0, 0);

	_newFolderButton = new QToolButton(buttonsWidget);
	_newFolderButton->setText("New Folder");
	_newFolderButton->hide();
	buttonsWidgetLayout->addWidget(_newFolderButton, 0, 2);

	_fileNameContainer = new QWidget(this);
	_fileNameContainer->hide();
	_fileNameContainer->setObjectName("browseContainer");
	layout->addWidget(_fileNameContainer);

	QHBoxLayout *saveLayout = new QHBoxLayout(_fileNameContainer);
	_fileNameContainer->setLayout(saveLayout);

	_fileNameTextBox = new QLineEdit(_fileNameContainer);
	QSizePolicy policy = _fileNameTextBox->sizePolicy();
	policy.setHorizontalStretch(1);
	_fileNameTextBox->setSizePolicy(policy);
	_fileNameTextBox->setEnabled(false);

	saveLayout->addWidget(_fileNameTextBox);

	_saveButton = new QPushButton(_fileNameContainer);
	_saveButton->setText("Save");
	_saveButton->setEnabled(false);
	saveLayout->addWidget(_saveButton, 0, Qt::AlignRight);

	QWidget *line;

	line = new QWidget(this);
	line->setFixedHeight(1);
	line->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
	line->setStyleSheet("QWidget { background-color: #A3A4A5 ; }");
	layout->addWidget(line);

	_model = new FSBMOSF();

	connect(_model, SIGNAL(authenticationSuccess()), this, SLOT(updateUserDetails()));
	connect(_model, SIGNAL(authenticationClear()), this, SLOT(updateUserDetails()));

	_fsBrowser = new FSBrowser(this);
	_fsBrowser->setViewType(FSBrowser::ListView);
	_fsBrowser->setFSModel(_model);
	layout->addWidget(_fsBrowser);

	_breadCrumbs->setModel(_model);
	_breadCrumbs->setEnabled(false);

	connect(_fsBrowser, SIGNAL(entryOpened(QString)), this, SLOT(notifyDataSetOpened(QString)));
	connect(_fsBrowser, SIGNAL(entrySelected(QString)), this, SLOT(notifyDataSetSelected(QString)));

	connect(_saveButton, SIGNAL(clicked()), this, SLOT(saveClicked()));
	connect(_newFolderButton, SIGNAL(clicked(bool)), this, SLOT(newFolderClicked()));

	line = new QWidget(this);
	line->setFixedWidth(1);
	line->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
	line->setStyleSheet("QWidget { background-color: #A3A4A5 ; }");
	layout->addWidget(line, 0, 1, 6, 1);

	QWidget *about = new QWidget(this);
	about->setObjectName("aboutOSF");
	about->setStyleSheet("#aboutOSF { border-top: 1px solid #A3A4A5 ; }");
	layout->addWidget(about);

	QHBoxLayout *aboutLayout = new QHBoxLayout(about);
	aboutLayout->setSpacing(12);
	about->setLayout(aboutLayout);

	HyperlinkLabel *aboutOSF = new HyperlinkLabel(about);
	aboutOSF->setText("<a href='https://osf.io/getting-started/'>About the OSF</a>");

	HyperlinkLabel *registerOSF = new HyperlinkLabel(about);
	registerOSF->setText("<a href='https://osf.io/'>Register</a>");

	aboutLayout->addWidget(aboutOSF);
	aboutLayout->addWidget(registerOSF);
	aboutLayout->addStretch(1);
}
Ejemplo n.º 6
0
void Synchronizer::authenticate(QString email, QString password, bool rememberMe) {
    emit authenticationSuccess(connection.authenticateOnly(), email, password, rememberMe);
}