mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-24 05:55:59 +03:00
Tray creation timing, account menu reinstantiating on visible change
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
This commit is contained in:
parent
80e21560eb
commit
a021f62e96
4 changed files with 14 additions and 8 deletions
|
@ -110,6 +110,8 @@ ownCloudGui::ownCloudGui(Application *parent)
|
|||
this, &ownCloudGui::slotShowOptionalTrayMessage);
|
||||
connect(Logger::instance(), &Logger::guiMessage,
|
||||
this, &ownCloudGui::slotShowGuiMessage);
|
||||
|
||||
_tray->create();
|
||||
}
|
||||
|
||||
#ifdef WITH_LIBCLOUDPROVIDERS
|
||||
|
|
|
@ -50,7 +50,6 @@ Systray::Systray() // TODO: make singleton, provide ::instance()
|
|||
_trayEngine->rootContext()->setContextProperty("systrayBackend", this);
|
||||
|
||||
_trayComponent = new QQmlComponent(_trayEngine, QUrl(QStringLiteral("qrc:/qml/src/gui/tray/Window.qml")));
|
||||
_trayContext = _trayEngine->contextForObject(_trayComponent->create());
|
||||
|
||||
if (!AccountManager::instance()->accounts().isEmpty()) {
|
||||
slotChangeActivityModel();
|
||||
|
@ -58,14 +57,20 @@ Systray::Systray() // TODO: make singleton, provide ::instance()
|
|||
|
||||
connect(UserModel::instance(), &UserModel::newUserSelected,
|
||||
this, &Systray::slotChangeActivityModel);
|
||||
|
||||
hideWindow();
|
||||
}
|
||||
|
||||
Systray::~Systray()
|
||||
{
|
||||
}
|
||||
|
||||
void Systray::create()
|
||||
{
|
||||
if (_trayContext == nullptr) {
|
||||
_trayContext = _trayEngine->contextForObject(_trayComponent->create());
|
||||
hideWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void Systray::slotChangeActivityModel()
|
||||
{
|
||||
_trayEngine->rootContext()->setContextProperty("activityModel", UserModel::instance()->currentActivityModel());
|
||||
|
|
|
@ -45,6 +45,7 @@ class Systray
|
|||
public:
|
||||
explicit Systray();
|
||||
~Systray();
|
||||
void create();
|
||||
void showMessage(const QString &title, const QString &message, MessageIcon icon = Information, int millisecondsTimeoutHint = 10000);
|
||||
void setToolTip(const QString &tip);
|
||||
bool isOpen();
|
||||
|
|
|
@ -27,6 +27,9 @@ Window {
|
|||
currentAccountUser.text = userModelBackend.currentUserName();
|
||||
currentAccountServer.text = userModelBackend.currentUserServer();
|
||||
trayWindowTalkButton.visible = userModelBackend.currentServerHasTalk() ? true : false;
|
||||
|
||||
userLineInstantiator.active = false;
|
||||
userLineInstantiator.active = true;
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
@ -116,11 +119,6 @@ Window {
|
|||
radius: 2
|
||||
}
|
||||
|
||||
onClosed: {
|
||||
userLineInstantiator.active = false;
|
||||
userLineInstantiator.active = true;
|
||||
}
|
||||
|
||||
Instantiator {
|
||||
id: userLineInstantiator
|
||||
model: userModelBackend
|
||||
|
|
Loading…
Reference in a new issue