summaryrefslogtreecommitdiffstats
path: root/logic/lists/MojangAccountList.cpp
diff options
context:
space:
mode:
authorAndrew <forkk@forkk.net>2013-11-27 16:14:18 -0600
committerAndrew <forkk@forkk.net>2013-11-27 16:14:18 -0600
commita4c5f0135ef8e3671f54cf56b1aa8766ee4b4a20 (patch)
treee6b379e6a49e4dabb48ed216f0468a8daa276dac /logic/lists/MojangAccountList.cpp
parentd794a4d0bfac0341c15bd5273e8dc81fe82531ef (diff)
downloadMultiMC-a4c5f0135ef8e3671f54cf56b1aa8766ee4b4a20.tar
MultiMC-a4c5f0135ef8e3671f54cf56b1aa8766ee4b4a20.tar.gz
MultiMC-a4c5f0135ef8e3671f54cf56b1aa8766ee4b4a20.tar.lz
MultiMC-a4c5f0135ef8e3671f54cf56b1aa8766ee4b4a20.tar.xz
MultiMC-a4c5f0135ef8e3671f54cf56b1aa8766ee4b4a20.zip
Allow setting no default account
This allows the user to select an account to use every time they launch an instance.
Diffstat (limited to 'logic/lists/MojangAccountList.cpp')
-rw-r--r--logic/lists/MojangAccountList.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/logic/lists/MojangAccountList.cpp b/logic/lists/MojangAccountList.cpp
index 1d67c70f..a30ef4ab 100644
--- a/logic/lists/MojangAccountList.cpp
+++ b/logic/lists/MojangAccountList.cpp
@@ -93,9 +93,16 @@ MojangAccountPtr MojangAccountList::activeAccount() const
void MojangAccountList::setActiveAccount(const QString& username)
{
beginResetModel();
- for (MojangAccountPtr account : m_accounts)
- if (account->username() == username)
- m_activeAccount = username;
+ if (username.isEmpty())
+ {
+ m_activeAccount = "";
+ }
+ else
+ {
+ for (MojangAccountPtr account : m_accounts)
+ if (account->username() == username)
+ m_activeAccount = username;
+ }
endResetModel();
onListChanged();
}