mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-28 03:49:20 +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);
|
this, &ownCloudGui::slotShowOptionalTrayMessage);
|
||||||
connect(Logger::instance(), &Logger::guiMessage,
|
connect(Logger::instance(), &Logger::guiMessage,
|
||||||
this, &ownCloudGui::slotShowGuiMessage);
|
this, &ownCloudGui::slotShowGuiMessage);
|
||||||
|
|
||||||
|
_tray->create();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_LIBCLOUDPROVIDERS
|
#ifdef WITH_LIBCLOUDPROVIDERS
|
||||||
|
|
|
@ -50,7 +50,6 @@ Systray::Systray() // TODO: make singleton, provide ::instance()
|
||||||
_trayEngine->rootContext()->setContextProperty("systrayBackend", this);
|
_trayEngine->rootContext()->setContextProperty("systrayBackend", this);
|
||||||
|
|
||||||
_trayComponent = new QQmlComponent(_trayEngine, QUrl(QStringLiteral("qrc:/qml/src/gui/tray/Window.qml")));
|
_trayComponent = new QQmlComponent(_trayEngine, QUrl(QStringLiteral("qrc:/qml/src/gui/tray/Window.qml")));
|
||||||
_trayContext = _trayEngine->contextForObject(_trayComponent->create());
|
|
||||||
|
|
||||||
if (!AccountManager::instance()->accounts().isEmpty()) {
|
if (!AccountManager::instance()->accounts().isEmpty()) {
|
||||||
slotChangeActivityModel();
|
slotChangeActivityModel();
|
||||||
|
@ -58,14 +57,20 @@ Systray::Systray() // TODO: make singleton, provide ::instance()
|
||||||
|
|
||||||
connect(UserModel::instance(), &UserModel::newUserSelected,
|
connect(UserModel::instance(), &UserModel::newUserSelected,
|
||||||
this, &Systray::slotChangeActivityModel);
|
this, &Systray::slotChangeActivityModel);
|
||||||
|
|
||||||
hideWindow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Systray::~Systray()
|
Systray::~Systray()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Systray::create()
|
||||||
|
{
|
||||||
|
if (_trayContext == nullptr) {
|
||||||
|
_trayContext = _trayEngine->contextForObject(_trayComponent->create());
|
||||||
|
hideWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Systray::slotChangeActivityModel()
|
void Systray::slotChangeActivityModel()
|
||||||
{
|
{
|
||||||
_trayEngine->rootContext()->setContextProperty("activityModel", UserModel::instance()->currentActivityModel());
|
_trayEngine->rootContext()->setContextProperty("activityModel", UserModel::instance()->currentActivityModel());
|
||||||
|
|
|
@ -45,6 +45,7 @@ class Systray
|
||||||
public:
|
public:
|
||||||
explicit Systray();
|
explicit Systray();
|
||||||
~Systray();
|
~Systray();
|
||||||
|
void create();
|
||||||
void showMessage(const QString &title, const QString &message, MessageIcon icon = Information, int millisecondsTimeoutHint = 10000);
|
void showMessage(const QString &title, const QString &message, MessageIcon icon = Information, int millisecondsTimeoutHint = 10000);
|
||||||
void setToolTip(const QString &tip);
|
void setToolTip(const QString &tip);
|
||||||
bool isOpen();
|
bool isOpen();
|
||||||
|
|
|
@ -27,6 +27,9 @@ Window {
|
||||||
currentAccountUser.text = userModelBackend.currentUserName();
|
currentAccountUser.text = userModelBackend.currentUserName();
|
||||||
currentAccountServer.text = userModelBackend.currentUserServer();
|
currentAccountServer.text = userModelBackend.currentUserServer();
|
||||||
trayWindowTalkButton.visible = userModelBackend.currentServerHasTalk() ? true : false;
|
trayWindowTalkButton.visible = userModelBackend.currentServerHasTalk() ? true : false;
|
||||||
|
|
||||||
|
userLineInstantiator.active = false;
|
||||||
|
userLineInstantiator.active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
@ -116,11 +119,6 @@ Window {
|
||||||
radius: 2
|
radius: 2
|
||||||
}
|
}
|
||||||
|
|
||||||
onClosed: {
|
|
||||||
userLineInstantiator.active = false;
|
|
||||||
userLineInstantiator.active = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Instantiator {
|
Instantiator {
|
||||||
id: userLineInstantiator
|
id: userLineInstantiator
|
||||||
model: userModelBackend
|
model: userModelBackend
|
||||||
|
|
Loading…
Reference in a new issue