History

Make login dialog automatically show only once per domain visit

David Rowe committed 12 years ago

Commit 46c1a9d1 parent 61a09143 files · +22 −3Browse files

Showing the changes to interface/src/Menu.cpp (1 of 3 files). Show all

Unified · Split

interface/src/Menu.cpp+17−2
@@ -114,6 +114,7 @@ Menu::Menu() : · 113 unmodified lines
114 _loginAction(NULL),114 _loginAction(NULL),
115 _preferencesDialog(NULL),115 _preferencesDialog(NULL),
116 _loginDialog(NULL),116 _loginDialog(NULL),
117 _loginDomain(),
117 _snapshotsLocation(),118 _snapshotsLocation(),
118 _scriptsLocation(),119 _scriptsLocation(),
119 _walletPrivateKey()120 _walletPrivateKey()
@@ -1052,14 +1053,28 @@ void sendFakeEnterEvent() { · 932 unmodified lines
1052 1053
1053const float DIALOG_RATIO_OF_WINDOW = 0.30f;1054const float DIALOG_RATIO_OF_WINDOW = 0.30f;
1054 1055
1056void Menu::clearLoginDomain() {
1057 // Needed for domains that don't require login.
1058 _loginDomain = QString();
1059}
1060
1055void Menu::loginForCurrentDomain() {1061void Menu::loginForCurrentDomain() {
1056 if (!_loginDialog) {1062 QString domain = NodeList::getInstance()->getDomainHandler().getHostname();
1063 bool hasShownForDomain = domain == _loginDomain;
1064
1065 if (!_loginDialog && !hasShownForDomain) {
1066 _loginDomain = domain;
1057 _loginDialog = new LoginDialog(Application::getInstance()->getWindow());1067 _loginDialog = new LoginDialog(Application::getInstance()->getWindow());
1058 _loginDialog->show();1068 _loginDialog->show();
1059 _loginDialog->resizeAndPosition(false);1069 _loginDialog->resizeAndPosition(false);
1060 }1070 }
1061}1071}
1062 1072
1073void Menu::showLoginForCurrentDomain() {
1074 _loginDomain = QString();
1075 loginForCurrentDomain();
1076}
1077
1063void Menu::editPreferences() {1078void Menu::editPreferences() {
1064 if (!_preferencesDialog) {1079 if (!_preferencesDialog) {
1065 _preferencesDialog = new PreferencesDialog(Application::getInstance()->getWindow());1080 _preferencesDialog = new PreferencesDialog(Application::getInstance()->getWindow());
@@ -1404,7 +1419,7 @@ void Menu::toggleLoginMenuItem() { · 338 unmodified lines
1404 // change the menu item to login1419 // change the menu item to login
1405 _loginAction->setText("Login");1420 _loginAction->setText("Login");
1406 1421
1407 connect(_loginAction, &QAction::triggered, this, &Menu::loginForCurrentDomain);1422 connect(_loginAction, &QAction::triggered, this, &Menu::showLoginForCurrentDomain);
1408 }1423 }
1409}1424}
1410 1425

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t