summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtChatWindow.cpp1
-rw-r--r--Swift/QtUI/Roster/QtTreeWidget.cpp5
-rw-r--r--Swift/QtUI/Roster/QtTreeWidget.h3
3 files changed, 8 insertions, 1 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index 3e314e5..f056a1d 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -48,6 +48,7 @@ QtChatWindow::QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventSt
logRosterSplitter->addWidget(messageLog_);
treeWidget_ = new QtTreeWidget(eventStream_);
+ treeWidget_->setEditable(false);
treeWidget_->hide();
logRosterSplitter->addWidget(treeWidget_);
logRosterSplitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp
index 963ce72..e88e1bb 100644
--- a/Swift/QtUI/Roster/QtTreeWidget.cpp
+++ b/Swift/QtUI/Roster/QtTreeWidget.cpp
@@ -22,7 +22,7 @@
namespace Swift {
-QtTreeWidget::QtTreeWidget(UIEventStream* eventStream, QWidget* parent) : QTreeView(parent) {
+QtTreeWidget::QtTreeWidget(UIEventStream* eventStream, QWidget* parent) : QTreeView(parent), editable_(false) {
eventStream_ = eventStream;
model_ = new RosterModel(this);
setModel(model_);
@@ -76,6 +76,9 @@ void QtTreeWidget::handleItemActivated(const QModelIndex& index) {
}
void QtTreeWidget::contextMenuEvent(QContextMenuEvent* event) {
+ if (!editable_) {
+ return;
+ }
QModelIndex index = indexAt(event->pos());
if (!index.isValid()) {
return;
diff --git a/Swift/QtUI/Roster/QtTreeWidget.h b/Swift/QtUI/Roster/QtTreeWidget.h
index 3430f7e..ce2351b 100644
--- a/Swift/QtUI/Roster/QtTreeWidget.h
+++ b/Swift/QtUI/Roster/QtTreeWidget.h
@@ -23,6 +23,8 @@ class QtTreeWidget : public QTreeView{
QtTreeWidgetItem* getRoot();
void setRosterModel(Roster* roster);
Roster* getRoster() {return roster_;}
+ void setEditable(bool b) { editable_ = b; }
+
private slots:
void handleItemActivated(const QModelIndex&);
void handleModelItemExpanded(const QModelIndex&, bool expanded);
@@ -39,6 +41,7 @@ class QtTreeWidget : public QTreeView{
RosterDelegate* delegate_;
QtTreeWidgetItem* treeRoot_;
UIEventStream* eventStream_;
+ bool editable_;
};
}