summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/Controllers/Roster/ContactRosterItem.h8
-rw-r--r--Swift/QtUI/QtChatWindow.cpp3
-rw-r--r--Swift/QtUI/Roster/QtTreeWidget.cpp1
3 files changed, 9 insertions, 3 deletions
diff --git a/Swift/Controllers/Roster/ContactRosterItem.h b/Swift/Controllers/Roster/ContactRosterItem.h
index 37c3840..9779859 100644
--- a/Swift/Controllers/Roster/ContactRosterItem.h
+++ b/Swift/Controllers/Roster/ContactRosterItem.h
@@ -16,60 +16,68 @@
#include <boost/filesystem/path.hpp>
#include <boost/signals2.hpp>
#include <Swiften/Elements/MUCOccupant.h>
#include <Swiften/Elements/StatusShow.h>
#include <Swiften/Elements/VCard.h>
#include <Swiften/JID/JID.h>
#include <Swift/Controllers/Roster/RosterItem.h>
namespace Swift {
class GroupRosterItem;
class Presence;
class ContactRosterItem : public RosterItem {
public:
enum Feature {
FileTransferFeature,
WhiteboardFeature
};
enum BlockState {
BlockingNotSupported,
IsBlocked,
IsUnblocked,
IsDomainBlocked
};
public:
+ /**
+ * @brief ContactRosterItem contains the information of a contact that is part of a XMPP Roster.
+ * @param jid The JabberID of the contact in the Roster entry.
+ * @param displayJID An alternate JID that is used instead of the JID this item represents. If not available,
+ * an empty node should be passed. This parameter will be converted to a bare JID.
+ * @param name The name or nickname of the contact
+ * @param parent The roster group that the contact is a member of. The same JID may be in several roster groups, in which case they will have individual ContactRosterItems with the same JID.
+ */
ContactRosterItem(const JID& jid, const JID& displayJID, const std::string& name, GroupRosterItem* parent);
virtual ~ContactRosterItem();
StatusShow::Type getStatusShow() const;
StatusShow::Type getSimplifiedStatusShow() const;
std::string getStatusText() const;
std::string getIdleText() const;
boost::posix_time::ptime getIdle() const;
std::string getOfflineSinceText() const;
boost::posix_time::ptime getOfflineSince() const;
void setAvatarPath(const boost::filesystem::path& path);
const boost::filesystem::path& getAvatarPath() const;
const JID& getJID() const;
void setDisplayJID(const JID& jid);
const JID& getDisplayJID() const;
void applyPresence(std::shared_ptr<Presence> presence);
const std::vector<std::string>& getGroups() const;
/** Only used so a contact can know about the groups it's in*/
void addGroup(const std::string& group);
void removeGroup(const std::string& group);
void clearPresence();
MUCOccupant::Role getMUCRole() const;
void setMUCRole(const MUCOccupant::Role& role);
MUCOccupant::Affiliation getMUCAffiliation() const;
void setMUCAffiliation(const MUCOccupant::Affiliation& affiliation);
std::string getMUCAffiliationText() const;
void setSupportedFeatures(const std::set<Feature>& features);
bool supportsFeature(Feature feature) const;
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index ca615f3..c509ab3 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -87,61 +87,61 @@ QtChatWindow::QtChatWindow(const QString& contact, QtChatTheme* theme, UIEventSt
layout->setContentsMargins(0,0,0,0);
layout->setSpacing(2);
alertLayout_ = new QVBoxLayout();
layout->addLayout(alertLayout_);
subjectLayout_ = new QBoxLayout(QBoxLayout::LeftToRight);
subject_ = new QLineEdit(this);
subjectLayout_->addWidget(subject_);
setSubject("");
subject_->setReadOnly(true);
QPushButton* actionButton_ = new QPushButton(this);
actionButton_->setIcon(QIcon(":/icons/actions.png"));
connect(actionButton_, SIGNAL(clicked()), this, SLOT(handleActionButtonClicked()));
subject_->hide();
layout->addLayout(subjectLayout_);
logRosterSplitter_ = new QSplitter(this);
logRosterSplitter_->setAutoFillBackground(true);
layout->addWidget(logRosterSplitter_);
if (settings_->getSetting(QtUISettingConstants::USE_PLAIN_CHATS) || settings_->getSetting(QtUISettingConstants::USE_SCREENREADER)) {
messageLog_ = new QtPlainChatView(this, eventStream_);
}
else {
messageLog_ = new QtWebKitChatView(this, eventStream_, theme, this); // I accept that passing the ChatWindow in so that the view can call the signals is somewhat inelegant, but it saves a lot of boilerplate. This patch is unpleasant enough already. So let's fix this soon (it at least needs fixing by the time history is sorted), but not now.
}
logRosterSplitter_->addWidget(messageLog_);
- treeWidget_ = new QtOccupantListWidget(eventStream_, settings_, QtTreeWidget::MessageDefaultJID, this);
+ treeWidget_ = new QtOccupantListWidget(eventStream_, settings_, QtTreeWidget::MessageDisplayJID, this);
treeWidget_->hide();
logRosterSplitter_->addWidget(treeWidget_);
logRosterSplitter_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
connect(logRosterSplitter_, SIGNAL(splitterMoved(int, int)), this, SLOT(handleSplitterMoved(int, int)));
midBar_ = new QWidget(this);
//layout->addWidget(midBar);
midBar_->setAutoFillBackground(true);
QHBoxLayout *midBarLayout = new QHBoxLayout(midBar_);
midBarLayout->setContentsMargins(0,0,0,0);
midBarLayout->setSpacing(2);
//midBarLayout->addStretch();
labelsWidget_ = new QComboBox(this);
labelsWidget_->setFocusPolicy(Qt::NoFocus);
labelsWidget_->hide();
labelsWidget_->setSizeAdjustPolicy(QComboBox::AdjustToContents);
midBarLayout->addWidget(labelsWidget_,0);
connect(labelsWidget_, SIGNAL(currentIndexChanged(int)), this, SLOT(handleCurrentLabelChanged(int)));
defaultLabelsPalette_ = labelsWidget_->palette();
QHBoxLayout* inputBarLayout = new QHBoxLayout();
inputBarLayout->setContentsMargins(0,0,0,0);
inputBarLayout->setSpacing(2);
input_ = new QtTextEdit(settings_, this);
input_->setAcceptRichText(false);
inputBarLayout->addWidget(midBar_);
inputBarLayout->addWidget(input_);
correctingLabel_ = new QLabel(tr("Correcting"), this);
inputBarLayout->addWidget(correctingLabel_);
@@ -432,61 +432,60 @@ void QtChatWindow::setSecurityLabelsEnabled(bool enabled) {
labelsWidget_->setEnabled(true);
labelsWidget_->show();
}
else {
labelsWidget_->hide();
}
}
void QtChatWindow::setCorrectionEnabled(Tristate enabled) {
correctionEnabled_ = enabled;
}
void QtChatWindow::setFileTransferEnabled(Tristate enabled) {
fileTransferEnabled_ = enabled;
}
SecurityLabelsCatalog::Item QtChatWindow::getSelectedSecurityLabel() {
assert(labelsWidget_->isEnabled());
assert(labelsWidget_->currentIndex() >= 0 && static_cast<size_t>(labelsWidget_->currentIndex()) < labelModel_->availableLabels_.size());
return labelModel_->availableLabels_[labelsWidget_->currentIndex()];
}
void QtChatWindow::closeEvent(QCloseEvent* event) {
event->accept();
emit windowClosing();
onClosed();
}
void QtChatWindow::convertToMUC(MUCType mucType) {
impromptu_ = (mucType == ImpromptuMUC);
- treeWidget_->setMessageTarget(impromptu_ ? QtTreeWidget::MessageDisplayJID : QtTreeWidget::MessageDefaultJID);
isMUC_ = true;
treeWidget_->show();
subject_->setVisible(!impromptu_);
}
void QtChatWindow::setOnline(bool online) {
isOnline_ = online;
if (!online) {
if (mucConfigurationWindow_) {
delete mucConfigurationWindow_.data();
}
if (affiliationEditor_) {
delete affiliationEditor_.data();
}
}
}
void QtChatWindow::showEvent(QShowEvent* event) {
emit windowOpening();
QWidget::showEvent(event);
}
void QtChatWindow::setUnreadMessageCount(int count) {
if (unreadCount_ != count) {
unreadCount_ = count;
updateTitleWithUnreadCount();
emit countUpdated();
}
}
diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp
index 1264a09..ac9f541 100644
--- a/Swift/QtUI/Roster/QtTreeWidget.cpp
+++ b/Swift/QtUI/Roster/QtTreeWidget.cpp
@@ -213,55 +213,54 @@ void QtTreeWidget::handleCollapsed(const QModelIndex& index) {
item->setExpanded(false);
}
}
void QtTreeWidget::handleModelItemExpanded(const QModelIndex& index, bool shouldExpand) {
if (!index.isValid()) {
return;
}
bool alreadyRight = this->isExpanded(index) == shouldExpand;
if (alreadyRight) {
return;
}
setExpanded(index, shouldExpand);
}
void QtTreeWidget::drawBranches(QPainter*, const QRect&, const QModelIndex&) const {
}
void QtTreeWidget::show() {
QWidget::show();
}
void QtTreeWidget::setMessageTarget(MessageTarget messageTarget) {
messageTarget_ = messageTarget;
}
JID QtTreeWidget::jidFromIndex(const QModelIndex& index) const {
JID target;
if (messageTarget_ == MessageDisplayJID) {
target = JID(Q2PSTRING(index.data(DisplayJIDRole).toString()));
- target = target.toBare();
}
if (!target.isValid()) {
target = JID(Q2PSTRING(index.data(JIDRole).toString()));
}
return target;
}
JID QtTreeWidget::selectedJID() const {
QModelIndexList list = selectedIndexes();
if (list.size() != 1) {
return JID();
}
return jidFromIndex(list[0]);
}
void QtTreeWidget::setOnline(bool isOnline) {
isOnline_ = isOnline;
}
bool QtTreeWidget::isOnline() const {
return isOnline_;
}
}