diff options
author | Tobias Markmann <tm@ayena.de> | 2014-09-29 08:07:05 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2014-10-17 20:11:30 (GMT) |
commit | 38b0cb785fea8eae5e48fae56440695fdfd10ee1 (patch) | |
tree | 78bb8ce9a6bcbc397805bcd433b96b3b23994f09 /Swift/QtUI/Roster/QtTreeWidget.cpp | |
parent | 1722d220533a78e8b2acbcd571631960656e78f8 (diff) | |
download | swift-contrib-38b0cb785fea8eae5e48fae56440695fdfd10ee1.zip swift-contrib-38b0cb785fea8eae5e48fae56440695fdfd10ee1.tar.bz2 |
Disable online only actions when offline.
Disabling action, menu items and drag 'n' drop which require an online
connection when the user is offline.
Test-Information:
Checked by going offline and checking the relevant actions and menu items.
Change-Id: Iacfa2c9f815d3b9bbad9ca4c2d0d04f95ce9a9e4
Diffstat (limited to 'Swift/QtUI/Roster/QtTreeWidget.cpp')
-rw-r--r-- | Swift/QtUI/Roster/QtTreeWidget.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp index 5333260..f296088 100644 --- a/Swift/QtUI/Roster/QtTreeWidget.cpp +++ b/Swift/QtUI/Roster/QtTreeWidget.cpp @@ -1,37 +1,37 @@ /* - * Copyright (c) 2010-2012 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #include <Swift/QtUI/Roster/QtTreeWidget.h> #include <boost/smart_ptr/make_shared.hpp> #include <boost/bind.hpp> #include <QUrl> #include <QMimeData> #include <QObject> #include <QLabel> #include <QTimer> #include <QToolTip> #include <Swiften/Base/Platform.h> #include <Swift/Controllers/Roster/ContactRosterItem.h> #include <Swift/Controllers/Roster/GroupRosterItem.h> #include <Swift/Controllers/UIEvents/UIEventStream.h> #include <Swift/Controllers/UIEvents/RequestChatUIEvent.h> #include <Swift/Controllers/UIEvents/SendFileUIEvent.h> #include <Swift/Controllers/Settings/SettingsProvider.h> #include <Swift/QtUI/QtUISettingConstants.h> #include <Swift/QtUI/Roster/RosterModel.h> #include <QtSwiftUtil.h> namespace Swift { QtTreeWidget::QtTreeWidget(UIEventStream* eventStream, SettingsProvider* settings, MessageTarget messageTarget, QWidget* parent) : QTreeView(parent), tooltipShown_(false), messageTarget_(messageTarget) { eventStream_ = eventStream; settings_ = settings; model_ = new RosterModel(this, settings_->getSetting(QtUISettingConstants::USE_SCREENREADER)); @@ -220,36 +220,44 @@ void QtTreeWidget::handleModelItemExpanded(const QModelIndex& index, bool should } 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_; +} + } |