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
114114 _loginAction(NULL),
115115 _preferencesDialog(NULL),
116116 _loginDialog(NULL),
117+ _loginDomain(),
117118 _snapshotsLocation(),
118119 _scriptsLocation(),
119120 _walletPrivateKey()
@@ -1052,14 +1053,28 @@ void sendFakeEnterEvent() { · 932 unmodified lines
10521053
10531054 const float DIALOG_RATIO_OF_WINDOW = 0.30f;
10541055
1056+void Menu::clearLoginDomain() {
1057+ // Needed for domains that don't require login.
1058+ _loginDomain = QString();
1059+}
1060+
10551061 void 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;
10571067 _loginDialog = new LoginDialog(Application::getInstance()->getWindow());
10581068 _loginDialog->show();
10591069 _loginDialog->resizeAndPosition(false);
10601070 }
10611071 }
10621072
1073+void Menu::showLoginForCurrentDomain() {
1074+ _loginDomain = QString();
1075+ loginForCurrentDomain();
1076+}
1077+
10631078 void Menu::editPreferences() {
10641079 if (!_preferencesDialog) {
10651080 _preferencesDialog = new PreferencesDialog(Application::getInstance()->getWindow());
@@ -1404,7 +1419,7 @@ void Menu::toggleLoginMenuItem() { · 338 unmodified lines
14041419 // change the menu item to login
14051420 _loginAction->setText("Login");
14061421
1407− connect(_loginAction, &QAction::triggered, this, &Menu::loginForCurrentDomain);
1422+ connect(_loginAction, &QAction::triggered, this, &Menu::showLoginForCurrentDomain);
14081423 }
14091424 }
14101425

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