diff --git a/cockatrice/src/dlg_connect.cpp b/cockatrice/src/dlg_connect.cpp index df290d645..f057b204c 100644 --- a/cockatrice/src/dlg_connect.cpp +++ b/cockatrice/src/dlg_connect.cpp @@ -347,6 +347,11 @@ bool DeleteHighlightedItemWhenShiftDelPressedEventFilter::eventFilter(QObject *o void DlgConnect::actForgotPassword() { + ServersSettings &servers = SettingsCache::instance().servers(); + servers.setFPHostName(hostEdit->text()); + servers.setFPPort(portEdit->text()); + servers.setFPPlayerName(playernameEdit->text().trimmed()); + emit sigStartForgotPasswordRequest(); reject(); } diff --git a/cockatrice/src/window_main.cpp b/cockatrice/src/window_main.cpp index f9feb7e26..fe9db724a 100644 --- a/cockatrice/src/window_main.cpp +++ b/cockatrice/src/window_main.cpp @@ -146,12 +146,14 @@ void MainWindow::statusChanged(ClientStatus _status) aConnect->setEnabled(true); aRegister->setEnabled(true); aDisconnect->setEnabled(false); + aForgotPassword->setEnabled(true); break; case StatusLoggingIn: aSinglePlayer->setEnabled(false); aConnect->setEnabled(false); aRegister->setEnabled(false); aDisconnect->setEnabled(true); + aForgotPassword->setEnabled(false); break; case StatusConnecting: case StatusRegistering: @@ -219,6 +221,7 @@ void MainWindow::actSinglePlayer() aConnect->setEnabled(false); aRegister->setEnabled(false); + aForgotPassword->setEnabled(false); aSinglePlayer->setEnabled(false); localServer = new LocalServer(this); @@ -269,6 +272,7 @@ void MainWindow::localGameEnded() aConnect->setEnabled(true); aRegister->setEnabled(true); + aForgotPassword->setEnabled(true); aSinglePlayer->setEnabled(true); } @@ -628,6 +632,7 @@ void MainWindow::retranslateUi() aDeckEditor->setText(tr("&Deck editor")); aFullScreen->setText(tr("&Full screen")); aRegister->setText(tr("&Register to server...")); + aForgotPassword->setText(tr("&Restore password...")); aSettings->setText(tr("&Settings...")); aSettings->setIcon(QPixmap("theme:icons/settings")); aExit->setText(tr("&Exit")); @@ -672,6 +677,8 @@ void MainWindow::createActions() connect(aFullScreen, SIGNAL(toggled(bool)), this, SLOT(actFullScreen(bool))); aRegister = new QAction(this); connect(aRegister, SIGNAL(triggered()), this, SLOT(actRegister())); + aForgotPassword = new QAction(this); + connect(aForgotPassword, SIGNAL(triggered()), this, SLOT(actForgotPasswordRequest())); aSettings = new QAction(this); connect(aSettings, SIGNAL(triggered()), this, SLOT(actSettings())); aExit = new QAction(this); @@ -739,6 +746,7 @@ void MainWindow::createMenus() cockatriceMenu->addAction(aConnect); cockatriceMenu->addAction(aDisconnect); cockatriceMenu->addAction(aRegister); + cockatriceMenu->addAction(aForgotPassword); cockatriceMenu->addSeparator(); cockatriceMenu->addAction(aSinglePlayer); cockatriceMenu->addAction(aWatchReplay); diff --git a/cockatrice/src/window_main.h b/cockatrice/src/window_main.h index e9f3c7338..c17ef4989 100644 --- a/cockatrice/src/window_main.h +++ b/cockatrice/src/window_main.h @@ -125,7 +125,7 @@ private: QList tabMenus; QMenu *cockatriceMenu, *dbMenu, *helpMenu, *trayIconMenu; QAction *aConnect, *aDisconnect, *aSinglePlayer, *aWatchReplay, *aDeckEditor, *aFullScreen, *aSettings, *aExit, - *aAbout, *aTips, *aCheckCardUpdates, *aRegister, *aUpdate, *aViewLog, *closeAction; + *aAbout, *aTips, *aCheckCardUpdates, *aRegister, *aForgotPassword, *aUpdate, *aViewLog, *closeAction; QAction *aManageSets, *aEditTokens, *aOpenCustomFolder, *aOpenCustomsetsFolder, *aAddCustomSet; TabSupervisor *tabSupervisor; WndSets *wndSets;