void FoursquareVenueSelectionPage::authenticate(void)
{
	FoursquareAuthPage *page =
		new FoursquareAuthPage();
	page->appear(scene(), MSceneWindow::DestroyWhenDismissed);
	connect(page, SIGNAL(authenticationComplete(const QString)),
		this, SLOT(authenticationComplete(const QString)));
	connect(page, SIGNAL(authenticationFailed()),
		this, SLOT(authenticationFailed()));
}
Exemplo n.º 2
0
 Mail::Mail()
     : CodeClass()
 {
     connect(&mSmtp, SIGNAL(connected()), this, SLOT(connected()));
     connect(&mSmtp, SIGNAL(connectionFailed(QByteArray)), this, SLOT(connectionFailed(QByteArray)));
     connect(&mSmtp, SIGNAL(encrypted()), this, SLOT(encrypted()));
     connect(&mSmtp, SIGNAL(encryptionFailed(QByteArray)), this, SLOT(encryptionFailed(QByteArray)));
     connect(&mSmtp, SIGNAL(authenticated()), this, SLOT(authenticated()));
     connect(&mSmtp, SIGNAL(authenticationFailed(QByteArray)), this, SLOT(authenticationFailed(QByteArray)));
     connect(&mSmtp, SIGNAL(senderRejected(int,QString,QByteArray)), this, SLOT(senderRejected(int,QString,QByteArray)));
     connect(&mSmtp, SIGNAL(recipientRejected(int,QString,QByteArray)), this, SLOT(recipientRejected(int,QString,QByteArray)));
     connect(&mSmtp, SIGNAL(mailFailed(int,int,QByteArray)), this, SLOT(mailFailed(int,int,QByteArray)));
     connect(&mSmtp, SIGNAL(mailSent(int)), this, SLOT(mailSent(int)));
     connect(&mSmtp, SIGNAL(finished()), this, SLOT(finished()));
     connect(&mSmtp, SIGNAL(disconnected()), this, SLOT(disconnected()));
 }
Exemplo n.º 3
0
void qevercloud::EvernoteOAuthWebView::setError(QString errorText)
{
    isSucceeded_ = false;
    this->setHtml("");
    this->history()->clear();
    errorText_ = errorText;
    emit authenticationFinished(false);
    emit authenticationFailed();
}
Exemplo n.º 4
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()));
}
Exemplo n.º 5
0
qevercloud::EvernoteOAuthDialog::EvernoteOAuthDialog(QString consumerKey, QString consumerSecret, QString host, QWidget *parent)
    : QDialog(parent), host_(host), consumerKey_(consumerKey), consumerSecret_(consumerSecret)
{
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    webView_ = new EvernoteOAuthWebView(this);
    connect(webView_, SIGNAL(authenticationSuceeded()), this, SLOT(accept()), Qt::QueuedConnection);
    connect(webView_, SIGNAL(authenticationFailed()), this, SLOT(reject()), Qt::QueuedConnection);

    QVBoxLayout* layout_ = new QVBoxLayout;
    layout_->addWidget(webView_);
    setLayout(layout_);
    webView_->setSizeHint(QSize(768,576));
    adjustSize();
}
Exemplo n.º 6
0
MainWindow::MainWindow(QWidget* parent): QMainWindow(parent), pop(0), msg(0)
{
    setupUi(this);
    settings = new QSettings(QSettings::UserScope,"Qxt", "MailTest", this);
    pop = new QxtPop3(this);
    pop->sslSocket()->setProtocol(QSsl::TlsV1_0);
    pop->sslSocket()->setPeerVerifyMode(QSslSocket::QueryPeer);
    QString username = settings->value("username").toString();
    QString hostname = settings->value("hostname").toString();
    QString pass = settings->value("password").toString();
    int port = settings->value("port").toInt();
    bool ok;
    Encryption enc = Encryption(settings->value("encryption").toInt(&ok));
    if (!ok) enc = Clear;
    switch (enc)
    {
    case UseSSL:
        sslRadioButton->setChecked(true);
        break;
    case UseStartTLS:
        startTLSRadioButton->setChecked(true);
        break;
    case Clear:
    default:
        clearRadioButton->setChecked(true);
        break;
    }
    usernameLineEdit->setText(username);
    hostnameLineEdit->setText(hostname);
    passwordLineEdit->setText(pass);
    if (port != 0) portLineEdit->setText(QString::number(port));
    connect(connectPushButton, SIGNAL(clicked()), this, SLOT(connectToHost()));
    connect(settingsPushButton, SIGNAL(clicked()), this, SLOT(saveSettings()));
    connect(pop, SIGNAL(disconnected()), this, SLOT(disconnected()));
    connect(pop, SIGNAL(connected()), this, SLOT(connected()));
    connect(pop, SIGNAL(connectionFailed(QByteArray)), this, SLOT(handleSslError(QByteArray)));
    connect(pop, SIGNAL(encryptionFailed(QByteArray)), this, SLOT(handleSslError(QByteArray)));
    connect(pop, SIGNAL(authenticationFailed(QByteArray)), this, SLOT(handleAuthError(QByteArray)));
    connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(newCmd()));
    help();
}
void
MeeGo::Sync::FrameworkClient::resultsAvailable(
  QString id,
  Buteo::SyncResults results)
{
  QString s;
  int const major = results.majorCode();

  if (major == Buteo::SyncResults::SYNC_RESULT_SUCCESS) {
    // @todo Should we instead display a time?
    //: Status message: successfully completed sync job.
    s = tr("Sync completed");

  } else if (major == Buteo::SyncResults::SYNC_RESULT_FAILED) {
    QString const e = syncResultToString(results);

    qWarning() << "WARNING:" << id << "sync failure:" << e;

    //: Sync result message.  The argument provides the error details.
    s = tr("Sync failed: %1").arg(e);

    // Issue a soft notification about the failure.
    MNotification n("Sync");
    n.setSummary(tr("%1 %2 sync failed").arg(m_service).arg(m_storage));
    n.setBody(e);
    n.setImage("image://meegotheme/icons/settings/sync");
    n.publish();

    // Pop up the login dialog on authentication failure.
    if (results.minorCode() == Buteo::SyncResults::AUTHENTICATION_FAILURE) {
      emit authenticationFailed();
    }
  }

  setStatus(s);
}
Exemplo n.º 8
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__"));
    }
}
Exemplo n.º 9
0
MainWindow::MainWindow(Eros *eros, QWidget *parent )
	: QMainWindow(parent)
{

	QFontDatabase::addApplicationFont(":/font/NotoSans-Regular");
	QFontDatabase::addApplicationFont(":/font/NotoSans-Bold");
	QFontDatabase::addApplicationFont(":/font/NotoSans-Italic");
	QFontDatabase::addApplicationFont(":/font/NotoSans-BoldItalic");
	QFontDatabase::addApplicationFont(":/font/Gobold");
	QFontDatabase::addApplicationFont(":/font/Gobold-bold");
	QFontDatabase::addApplicationFont(":/font/Gobold-thin");


	QFile version(":/data/version_info");
	if(!version.open(QIODevice::ReadOnly))
	{
		this->local_version_ = 1;
	}
	else
	{
		QByteArray data = version.readAll();
		QStringList tokens = QString::fromUtf8(data).split('|');
		this->local_version_ = tokens[0].toInt();
		version.close();
	}
	
	ui.setupUi(this);
	ui.centralWidget->setMouseTracking(true);
	this->setWindowTitle(tr("Alpha Version %1").arg(this->local_version_));

	setUiEnabled(false);
	this->eros_ = eros;
	this->config_ = new Config(this);
	this->connection_timer_ = new QTimer(this);
	this->matchmaking_timer_ = new QTimer(this);
	this->matchmaking_timer_->setInterval(500);
	this->matchmaking_start_ = new QTime();
	this->matchmaking_result_time_ = new QTime();
	this->long_process_start_time_ = new QTime();
	this->watcher_ = new DirectoryWatcher(this);
	this->watches_ = QList<DirectoryWatch*>();
	this->update_checker_nam_ = new QNetworkAccessManager(this);
	this->update_timer_ = new QTimer(this);
	this->long_process_timer_ = new QTimer(this);
	this->tray_icon_ = new QSystemTrayIcon(this);
	this->tray_icon_menu_ = new QMenu(this);
	this->preview_loader_nam_ = new QNetworkAccessManager(this);
	this->preview_cache_ = QMap<QString, QPixmap*>();
	this->upload_queue_ = QMap<QString, QTime*>();
	this->upload_queue_timer_ = new QTimer(this);

	tray_icon_action_show_ = new QAction("Hide Eros", this);
	tray_icon_action_close_ = new QAction("Close Eros", this);


	QObject::connect(tray_icon_action_show_, SIGNAL(triggered()), this, SLOT(toggleWindow()));
    QObject::connect(tray_icon_action_close_, SIGNAL(triggered()), qApp, SLOT(quit()));
	QObject::connect(this->tray_icon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconClicked(QSystemTrayIcon::ActivationReason)));


	this->tray_icon_->setIcon(QIcon(":/img/client/icons/icon_32x32"));
	this->tray_icon_menu_->addAction(tray_icon_action_show_);
	this->tray_icon_menu_->addAction(tray_icon_action_close_);
	this->tray_icon_->setContextMenu(this->tray_icon_menu_);

#if !defined(Q_OS_MAC)
    title_bar_ = ErosTitleBar::addToLayout(this, ui.verticalLayout);
    title_bar_->setMenu(this->tray_icon_menu_);
#endif



	// File watcher
	QObject::connect(this->watcher_, SIGNAL(added(const QString &, const QString &)), this, SLOT(fileAdded(const QString &, const QString&)));

	// Update checker
	QObject::connect(update_checker_nam_, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateCheckerFinished(QNetworkReply*)));
	QObject::connect(this->update_timer_, SIGNAL(timeout()), this, SLOT(updateCheckerTimerWorker()));

	//Preview loader
	QObject::connect(preview_loader_nam_, SIGNAL(finished(QNetworkReply*)), this, SLOT(previewDownloadFinished(QNetworkReply*)));

	// Set up Eros signals
	/// Eros Signals
	QObject::connect(eros_, SIGNAL(stateChanged(ErosState)), this, SLOT(erosStateChanged(ErosState)));
	QObject::connect(eros_, SIGNAL(connectionError(QAbstractSocket::SocketError, const QString)), this, SLOT(erosConnectionError(QAbstractSocket::SocketError, const QString)));
	QObject::connect(eros_, SIGNAL(connected()), this, SLOT(erosConnected()));
	QObject::connect(eros_, SIGNAL(disconnected()), this, SLOT(erosDisconnected()));
	QObject::connect(eros_, SIGNAL(authenticationFailed()), this, SLOT(erosAuthenticationFailed()));
	QObject::connect(eros_, SIGNAL(alreadyLoggedIn()), this, SLOT(erosAlreadyLoggedIn()));
	QObject::connect(eros_, SIGNAL(broadcastAlert(const QString, int)), this, SLOT(erosBroadcastAlert(const QString, int)));
	QObject::connect(eros_, SIGNAL(chatRoomAdded(ChatRoom*)), this, SLOT(erosChatRoomAdded(ChatRoom*)));
	QObject::connect(eros_, SIGNAL(chatRoomRemoved(ChatRoom*)), this, SLOT(erosChatRoomRemoved(ChatRoom*)));
	QObject::connect(eros_, SIGNAL(chatRoomJoined(ChatRoom*)), this, SLOT(erosChatRoomJoined(ChatRoom*)));
	QObject::connect(eros_, SIGNAL(chatRoomLeft(ChatRoom*)), this, SLOT(erosChatRoomLeft(ChatRoom*)));
	QObject::connect(eros_, SIGNAL(chatMessageReceieved(User*, const QString)), this, SLOT(erosChatMessageReceieved(User*, const QString)));
	QObject::connect(eros_, SIGNAL(localUserUpdated(LocalUser*)), this, SLOT(erosLocalUserUpdated(LocalUser*)));
	QObject::connect(eros_, SIGNAL(matchmakingStateChanged(ErosMatchmakingState)), this, SLOT(erosMatchmakingStateChanged(ErosMatchmakingState)));
	QObject::connect(eros_, SIGNAL(matchmakingMatchFound(MatchmakingMatch *)), this, SLOT(erosMatchmakingMatchFound(MatchmakingMatch *)));
	//QObject::connect(eros_, SIGNAL(regionStatsUpdated(ErosRegion, int)), this, SLOT(erosRegionStatsUpdated(ErosRegion, int)));
	QObject::connect(eros_, SIGNAL(statsUpdated(int, int)), this, SLOT(erosStatsUpdated(int, int)));
	QObject::connect(eros_, SIGNAL(replayUploadError(ErosError)), this, SLOT(erosReplayUploadError(ErosError)));
	QObject::connect(eros_, SIGNAL(replayUploaded()), this, SLOT(erosReplayUploaded()));
	QObject::connect(eros_, SIGNAL(uploadProgress(qint64, qint64)), this, SLOT(erosUploadProgress(qint64, qint64)));
	
	QObject::connect(eros_, SIGNAL(longProcessStateChanged(ErosLongProcessState)), this, SLOT(erosLongProcessStateChanged(ErosLongProcessState)));
	QObject::connect(eros_, SIGNAL(drawRequested()), this, SLOT(erosDrawRequested()));
	QObject::connect(eros_, SIGNAL(drawRequestFailed()), this, SLOT(erosDrawRequestFailed()));
	QObject::connect(eros_, SIGNAL(noShowRequested()), this, SLOT(erosNoShowRequested()));
	QObject::connect(eros_, SIGNAL(noShowRequestFailed()), this, SLOT(erosNoShowRequestFailed()));
	QObject::connect(eros_, SIGNAL(acknowledgeLongProcessFailed()), this, SLOT(erosAcknowledgeLongProcessFailed()));
	QObject::connect(eros_, SIGNAL(acknowledgedLongProcess()), this, SLOT(erosAcknowledgedLongProcess()));

	QObject::connect(eros_, SIGNAL(vetoesUpdated()), this, SLOT(erosVetoesUpdated()));
	QObject::connect(eros_, SIGNAL(toggleVetoFailed(Map*,ErosError)), this, SLOT(erosToggleVetoFailed(Map*,ErosError)));


	/// Eros Slots
	QObject::connect(this, SIGNAL(connectToEros(const QString, const QString, const QString)), eros_, SLOT(connectToEros(const QString, const QString, const QString)));
	QObject::connect(this, SIGNAL(disconnectFromEros()), eros_, SLOT(disconnectFromEros()));
	QObject::connect(ui.btnRefreshChats, SIGNAL(clicked()), eros_, SLOT(refreshChatRooms()));
	QObject::connect(this, SIGNAL(joinChatRoom(ChatRoom *, const QString)), eros_, SLOT(joinChatRoom(ChatRoom *, const QString)));
	QObject::connect(this, SIGNAL(leaveChatRoom(ChatRoom *)), eros_, SLOT(leaveChatRoom(ChatRoom *)));

	QObject::connect(this, SIGNAL(queueMatchmaking(ErosRegion, int)), eros_, SLOT(queueMatchmaking(ErosRegion, int)));
	QObject::connect(this, SIGNAL(queueMatchmaking(ErosRegionList, int)), eros_, SLOT(queueMatchmaking(ErosRegionList, int)));
	QObject::connect(this, SIGNAL(dequeueMatchmaking()), eros_, SLOT(dequeueMatchmaking()));
    QObject::connect(this, SIGNAL(forfeitMatchmaking()), eros_, SLOT(forfeitMatchmaking()));

	QObject::connect(this, SIGNAL(uploadReplay(QIODevice*)), eros_, SLOT(uploadReplay(QIODevice*)));
	QObject::connect(this, SIGNAL(uploadReplay(const QString)), eros_, SLOT(uploadReplay(const QString)));

	QObject::connect(this, SIGNAL(requestDraw()), eros_, SLOT(requestDraw()));
	QObject::connect(this, SIGNAL(requestNoShow()), eros_, SLOT(requestNoShow()));
	QObject::connect(this, SIGNAL(acknowledgeLongProcess(bool)), eros_, SLOT(acknowledgeLongProcess(bool)));

	QObject::connect(this, SIGNAL(toggleVeto(Map*)), eros_, SLOT(toggleVeto(Map*)));
	


	// timers
	QObject::connect(this->connection_timer_, SIGNAL(timeout()), this, SLOT(connectionTimerWorker()));
	QObject::connect(this->matchmaking_timer_, SIGNAL(timeout()), this, SLOT(matchmakingTimerWorker()));
	QObject::connect(this->long_process_timer_, SIGNAL(timeout()), this, SLOT(longProcessTimerWorker()));
	QObject::connect(this->upload_queue_timer_, SIGNAL(timeout()), this, SLOT(uploadTimerWorker()));

	this->long_process_timer_->setInterval(250);

	// UI Stuff
	settings_window_ = nullptr;
	bnetsettings_window_ = nullptr;

	// Remove the close box from the first 2 tabs.
    // On mac it's LeftSide. Assuming RightSide causes a nullptr.

	for (int i = 0; i < 3; i++)
	{
		QWidget *tab = ui.tabContainer->tabBar()->tabButton(i, QTabBar::RightSide);
		if (tab != nullptr)
			tab->resize(0, 0);

		tab = ui.tabContainer->tabBar()->tabButton(i, QTabBar::LeftSide);
		if (tab != nullptr)
			tab->resize(0, 0);
	}
    
	ui.tabContainer->tabBar()->setUsesScrollButtons(true);
	
	QObject::connect(ui.tabContainer, SIGNAL(tabCloseRequested(int)), this, SLOT(tabContainer_tabCloseRequested(int)));
	QObject::connect(ui.tabContainer, SIGNAL(currentChanged(int)), this, SLOT(tabContainer_currentChanged(int)));
	QObject::connect(ui.lblBottomMenu, SIGNAL(linkActivated(const QString &)), this, SLOT(label_linkActivated(const QString&)));
	QObject::connect(ui.btnJoinRoom, SIGNAL(clicked()), this, SLOT(btnJoinRoom_pressed()));
	QObject::connect(ui.lstChats, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(lstChats_currentItemChanged(QListWidgetItem *, QListWidgetItem *)));
	QObject::connect(ui.lstChats, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(lstChats_itemDoubleClicked(QListWidgetItem*)));
	QObject::connect(ui.cmbRegion, SIGNAL(currentIndexChanged(int)), this, SLOT(cmbRegion_currentIndexChanged(int)));
	QObject::connect(ui.cmbMapRegion, SIGNAL(currentIndexChanged(int)), this, SLOT(cmbMapRegion_currentIndexChanged(int)));
	QObject::connect(ui.btnQueue, SIGNAL(clicked()), this, SLOT(btnQueue_pressed()));
	QObject::connect(ui.btnDraw, SIGNAL(clicked()), this, SLOT(btnDraw_pressed()));
	QObject::connect(ui.btnNoShow, SIGNAL(clicked()), this, SLOT(btnNoShow_pressed()));
	QObject::connect(ui.lstMaps, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(lstMaps_currentItemChanged(QListWidgetItem *, QListWidgetItem *)));
	QObject::connect(ui.btnToggleVeto, SIGNAL(clicked()), this, SLOT(btnToggleVeto_clicked()));
	QObject::connect(ui.chkQueueRegion, SIGNAL(stateChanged(int)), this, SLOT(chkQueueRegion_stateChanged(int)));
#if !defined(Q_OS_MAC)
	this->tray_icon_->show();
#endif

		// The user should be prevented from emptying invalid values in the settings dialog.
	if (this->config_->profiles().count() == 0)
	{
		QMessageBox::information(this, "Eros", tr("Welcome to Eros! You need to configure some settings in order to continue. The settings window will now open."));
		openSettings();
	}
	else
	{
		this->connection_timer_->setInterval(500);
		this->connection_timer_->start();
	}

	QTimer::singleShot(0, this, SLOT(updateCheckerTimerWorker()));
	this->update_timer_->setInterval(1000 * 60 * 10);
	this->update_timer_->start();

	notification_sound_ = new QSound(":/sound/notification", this);
}