mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-27 15:05:19 +03:00
Move AccountState::displayName to Account.
This commit is contained in:
parent
89bb58ac30
commit
28306e5dfb
5 changed files with 10 additions and 11 deletions
|
@ -234,12 +234,5 @@ void AccountState::slotCredentialsFetched(AbstractCredentials* credentials)
|
|||
checkConnectivity();
|
||||
}
|
||||
|
||||
QString AccountState::displayName()
|
||||
{
|
||||
auto user = account()->credentials()->user();
|
||||
auto url = account()->url();
|
||||
return tr("%1@%2").arg(user, url.host());
|
||||
}
|
||||
|
||||
|
||||
} // namespace OCC
|
||||
|
|
|
@ -85,9 +85,6 @@ public:
|
|||
/// connection status and errors.
|
||||
void checkConnectivity();
|
||||
|
||||
// The name of the account as shown in the toolbar
|
||||
QString displayName();
|
||||
|
||||
private:
|
||||
void setState(State state);
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ void SettingsDialog::accountAdded(AccountState *s)
|
|||
QIcon accountIcon(QLatin1String(":/client/resources/account.png"));
|
||||
auto toolBar = qobject_cast<QToolBar*>(layout()->menuBar());
|
||||
Q_ASSERT(toolBar);
|
||||
auto accountAction = new QAction(accountIcon, s->displayName(), this);
|
||||
auto accountAction = new QAction(accountIcon, s->account()->displayName(), this);
|
||||
toolBar->insertAction(toolBar->actions().at(0), accountAction);
|
||||
accountAction->setCheckable(true);
|
||||
auto accountSettings = new AccountSettings(s, this);
|
||||
|
|
|
@ -71,6 +71,12 @@ AccountPtr Account::sharedFromThis()
|
|||
}
|
||||
|
||||
|
||||
QString Account::displayName() const
|
||||
{
|
||||
auto user = _credentials->user();
|
||||
return tr("%1@%2").arg(user, _url.host());
|
||||
}
|
||||
|
||||
static bool isEqualExceptProtocol(const QUrl &url1, const QUrl &url2)
|
||||
{
|
||||
return (url1.host() != url2.host() ||
|
||||
|
|
|
@ -62,6 +62,9 @@ public:
|
|||
void setSharedThis(AccountPtr sharedThis);
|
||||
AccountPtr sharedFromThis();
|
||||
|
||||
/// The name of the account as shown in the toolbar
|
||||
QString displayName() const;
|
||||
|
||||
/**
|
||||
* @brief Checks the Account instance is different from \param other
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue