blob: ec11785d35ad6275ca271e7fee52742a41c6664c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#include "Slimber/MenuletController.h"
#include "Swiften/Base/foreach.h"
#include "Swiften/Base/String.h"
#include "Slimber/Menulet.h"
#include <iostream>
using namespace Swift;
MenuletController::MenuletController(Menulet* menulet) :
menulet(menulet), xmppStatus(Offline) {
update();
}
MenuletController::~MenuletController() {
}
void MenuletController::setXMPPStatus(const String& message, Status status) {
xmppStatus = status;
xmppStatusMessage = message;
update();
}
void MenuletController::setUserNames(const std::vector<String>& users) {
linkLocalUsers = users;
update();
}
void MenuletController::update() {
menulet->clear();
if (linkLocalUsers.empty()) {
menulet->setIcon("UsersOffline");
menulet->addItem("No online users");
}
else {
menulet->setIcon("UsersOnline");
menulet->addItem("Online users:");
foreach(const String& user, linkLocalUsers) {
menulet->addItem(String(" ") + user);
}
}
menulet->addSeparator();
menulet->addItem(xmppStatusMessage, (xmppStatus == Online ? "Online" : "Offline"));
menulet->addSeparator();
menulet->addAboutItem();
menulet->addSeparator();
menulet->addExitItem();
}
|