summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-10-05 13:39:47 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-10-05 13:39:47 (GMT)
commit16a895e7d64b71d1aa7a971d77e8daf6591e9c56 (patch)
tree9c1c71eb1a80dd0fd813ea6ba42d1d4c7d4889ed /Swift/QtUI/QtChatWindow.cpp
parent8159071adb232b68c2ce79479145fbcd04979245 (diff)
downloadswift-contrib-16a895e7d64b71d1aa7a971d77e8daf6591e9c56.zip
swift-contrib-16a895e7d64b71d1aa7a971d77e8daf6591e9c56.tar.bz2
Allow role changing in MUCs.
Resolves: #987
Diffstat (limited to 'Swift/QtUI/QtChatWindow.cpp')
-rw-r--r--Swift/QtUI/QtChatWindow.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index 10daa68..7e47f4d 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -309,70 +309,71 @@ void QtChatWindow::setAvailableSecurityLabels(const std::vector<SecurityLabelsCa
int i = 0;
int defaultIndex = 0;
foreach (SecurityLabelsCatalog::Item label, labels) {
std::string selector = label.getSelector();
std::string displayMarking = label.getLabel() ? label.getLabel()->getDisplayMarking() : "";
QString labelName = selector.empty() ? displayMarking.c_str() : selector.c_str();
labelsWidget_->addItem(labelName, QVariant(i));
if (label.getIsDefault()) {
defaultIndex = i;
}
i++;
}
labelsWidget_->setCurrentIndex(defaultIndex);
}
void QtChatWindow::setSecurityLabelsError() {
labelsWidget_->setEnabled(false);
}
void QtChatWindow::setSecurityLabelsEnabled(bool enabled) {
if (enabled) {
labelsWidget_->setEnabled(true);
labelsWidget_->show();
} else {
labelsWidget_->hide();
}
}
void QtChatWindow::setCorrectionEnabled(Tristate enabled) {
correctionEnabled_ = enabled;
}
SecurityLabelsCatalog::Item QtChatWindow::getSelectedSecurityLabel() {
assert(labelsWidget_->isEnabled());
+ assert(labelsWidget_->currentIndex() >= 0 && labelsWidget_->currentIndex() < availableLabels_.size());
return availableLabels_[labelsWidget_->currentIndex()];
}
void QtChatWindow::closeEvent(QCloseEvent* event) {
event->accept();
emit windowClosing();
onClosed();
}
void QtChatWindow::convertToMUC() {
setAcceptDrops(false);
treeWidget_->show();
subject_->show();
actionButton_->show();
}
void QtChatWindow::qAppFocusChanged(QWidget* /*old*/, QWidget* /*now*/) {
if (isWidgetSelected()) {
lastLineTracker_.setHasFocus(true);
input_->setFocus();
onAllMessagesRead();
}
else {
lastLineTracker_.setHasFocus(false);
}
}
void QtChatWindow::setInputEnabled(bool enabled) {
inputEnabled_ = enabled;
if (!enabled && mucConfigurationWindow) {
delete mucConfigurationWindow.data();
}
}
void QtChatWindow::showEvent(QShowEvent* event) {