diff options
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/MainController.cpp | 2 | ||||
-rw-r--r-- | Swift/Controllers/Roster/ContactRosterItem.cpp | 4 | ||||
-rw-r--r-- | Swift/Controllers/Roster/ContactRosterItem.h | 2 | ||||
-rw-r--r-- | Swift/Controllers/Roster/Roster.cpp | 7 | ||||
-rw-r--r-- | Swift/QtUI/QtChatView.cpp | 5 | ||||
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindow.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/Roster/QtRosterWidget.cpp | 6 | ||||
-rw-r--r-- | Swift/QtUI/Roster/QtTreeWidget.cpp | 2 |
9 files changed, 26 insertions, 6 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index b84e7d6..2f5356e 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -303,22 +303,24 @@ void MainController::handleConnected() { eventWindowController_ = new EventWindowController(eventController_, uiFactory_); loginWindow_->morphInto(rosterController_->getWindow()); DiscoInfo discoInfo; discoInfo.addIdentity(DiscoInfo::Identity(CLIENT_NAME, "client", "pc")); discoInfo.addFeature(DiscoInfo::ChatStatesFeature); discoInfo.addFeature(DiscoInfo::SecurityLabelsFeature); discoInfo.addFeature(DiscoInfo::MessageCorrectionFeature); +#ifdef SWIFT_EXPERIMENTAL_FT discoInfo.addFeature(DiscoInfo::JingleFeature); discoInfo.addFeature(DiscoInfo::JingleFTFeature); discoInfo.addFeature(DiscoInfo::JingleTransportsIBBFeature); discoInfo.addFeature(DiscoInfo::JingleTransportsS5BFeature); +#endif client_->getDiscoManager()->setCapsNode(CLIENT_NODE); client_->getDiscoManager()->setDiscoInfo(discoInfo); userSearchControllerChat_ = new UserSearchController(UserSearchController::StartChat, jid_, uiEventStream_, uiFactory_, client_->getIQRouter(), rosterController_); userSearchControllerAdd_ = new UserSearchController(UserSearchController::AddContact, jid_, uiEventStream_, uiFactory_, client_->getIQRouter(), rosterController_); adHocManager_ = new AdHocManager(boundJID_, uiFactory_, client_->getIQRouter(), uiEventStream_, rosterController_->getWindow()); } loginWindow_->setIsLoggingIn(false); diff --git a/Swift/Controllers/Roster/ContactRosterItem.cpp b/Swift/Controllers/Roster/ContactRosterItem.cpp index 6d707bb..8c388bf 100644 --- a/Swift/Controllers/Roster/ContactRosterItem.cpp +++ b/Swift/Controllers/Roster/ContactRosterItem.cpp @@ -111,16 +111,16 @@ void ContactRosterItem::addGroup(const std::string& group) { } void ContactRosterItem::removeGroup(const std::string& group) { groups_.erase(std::remove(groups_.begin(), groups_.end(), group), groups_.end()); } void ContactRosterItem::setSupportedFeatures(const std::set<Feature>& features) { features_ = features; } -bool ContactRosterItem::supportsFeature(const Feature feat) const { - return features_.find(feat) != features_.end(); +bool ContactRosterItem::supportsFeature(const Feature feature) const { + return features_.find(feature) != features_.end(); } } diff --git a/Swift/Controllers/Roster/ContactRosterItem.h b/Swift/Controllers/Roster/ContactRosterItem.h index 67ffaa9..9932dc4 100644 --- a/Swift/Controllers/Roster/ContactRosterItem.h +++ b/Swift/Controllers/Roster/ContactRosterItem.h @@ -42,19 +42,19 @@ class ContactRosterItem : public RosterItem { void applyPresence(const std::string& resource, boost::shared_ptr<Presence> presence); void clearPresence(); void calculateShownPresence(); 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 setSupportedFeatures(const std::set<Feature>& features); - bool supportsFeature(Feature feat) const; + bool supportsFeature(Feature feature) const; private: JID jid_; JID displayJID_; std::string avatarPath_; std::map<std::string, boost::shared_ptr<Presence> > presences_; boost::shared_ptr<Presence> offlinePresence_; boost::shared_ptr<Presence> shownPresence_; std::vector<std::string> groups_; std::set<Feature> features_; diff --git a/Swift/Controllers/Roster/Roster.cpp b/Swift/Controllers/Roster/Roster.cpp index f3d058e..83837b1 100644 --- a/Swift/Controllers/Roster/Roster.cpp +++ b/Swift/Controllers/Roster/Roster.cpp @@ -56,20 +56,23 @@ GroupRosterItem* Roster::getGroup(const std::string& groupName) { } GroupRosterItem* group = new GroupRosterItem(groupName, root_, sortByStatus_); root_->addChild(group); group->onChildrenChanged.connect(boost::bind(&Roster::handleChildrenChanged, this, group)); group->onDataChanged.connect(boost::bind(&Roster::handleDataChanged, this, group)); return group; } void Roster::setAvailableFeatures(const JID& jid, const std::set<ContactRosterItem::Feature>& features) { - if (itemMap_[fullJIDMapping_ ? jid : jid.toBare()].empty()) return; - foreach(ContactRosterItem* item, itemMap_[fullJIDMapping_ ? jid : jid.toBare()]) { + JID actualJID = fullJIDMapping_ ? jid : jid.toBare(); + if (itemMap_[actualJID].empty()) { + return; + } + foreach(ContactRosterItem* item, itemMap_[actualJID]) { item->setSupportedFeatures(features); } } void Roster::removeGroup(const std::string& group) { root_->removeGroupChild(group); } void Roster::handleDataChanged(RosterItem* item) { diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp index d51f74c..cb7f901 100644 --- a/Swift/QtUI/QtChatView.cpp +++ b/Swift/QtUI/QtChatView.cpp @@ -43,23 +43,28 @@ QtChatView::QtChatView(QtChatTheme* theme, QWidget* parent) : QWidget(parent), f /* To give a border on Linux, where it looks bad without */ QStackedWidget* stack = new QStackedWidget(this); stack->addWidget(webView_); stack->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); stack->setLineWidth(2); mainLayout->addWidget(stack); #else mainLayout->addWidget(webView_); #endif + +#ifdef SWIFT_EXPERIMENTAL_FT setAcceptDrops(true); +#endif webPage_ = new QWebPage(this); webPage_->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); +#ifdef SWIFT_EXPERIMENTAL_FT webPage_->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); +#endif webView_->setPage(webPage_); connect(webPage_, SIGNAL(selectionChanged()), SLOT(copySelectionToClipboard())); viewReady_ = false; isAtBottom_ = true; resetView(); } void QtChatView::handleClearRequested() { diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 238100a..fa039de 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -49,19 +49,21 @@ QtChatWindow::QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventSt unreadCount_ = 0; inputEnabled_ = true; completer_ = NULL; theme_ = theme; isCorrection_ = false; correctionEnabled_ = Maybe; updateTitleWithUnreadCount(); QtSettingsProvider settings; +#ifdef SWIFT_EXPERIMENTAL_FT setAcceptDrops(true); +#endif alertStyleSheet_ = "background: rgb(255, 255, 153); color: black"; QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom, this); layout->setContentsMargins(0,0,0,0); layout->setSpacing(2); alertWidget_ = new QWidget(this); QHBoxLayout* alertLayout = new QHBoxLayout(alertWidget_); diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index 543af65..0db6071 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -162,21 +162,23 @@ QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream) : QMainWindow(), forg QAction* aboutAction = new QAction(QString(tr("&About %1")).arg("Swift"), this); #endif connect(aboutAction, SIGNAL(triggered()), SLOT(handleAbout())); swiftMenu_->addAction(aboutAction); xmlConsoleAction_ = new QAction(tr("&Show Debug Console"), this); connect(xmlConsoleAction_, SIGNAL(triggered()), SLOT(handleShowXMLConsole())); generalMenu_->addAction(xmlConsoleAction_); +#ifdef SWIFT_EXPERIMENTAL_FT fileTransferOverviewAction_ = new QAction(tr("Show &File Transfer Overview"), this); connect(fileTransferOverviewAction_, SIGNAL(triggered()), SLOT(handleShowFileTransferOverview())); generalMenu_->addAction(fileTransferOverviewAction_); +#endif toggleSoundsAction_ = new QAction(tr("&Play Sounds"), this); toggleSoundsAction_->setCheckable(true); toggleSoundsAction_->setChecked(true); connect(toggleSoundsAction_, SIGNAL(toggled(bool)), SLOT(handleToggleSounds(bool))); generalMenu_->addAction(toggleSoundsAction_); toggleNotificationsAction_ = new QAction(tr("Display Pop-up &Notifications"), this); toggleNotificationsAction_->setCheckable(true); diff --git a/Swift/QtUI/Roster/QtRosterWidget.cpp b/Swift/QtUI/Roster/QtRosterWidget.cpp index f3b0441..3d9b273 100644 --- a/Swift/QtUI/Roster/QtRosterWidget.cpp +++ b/Swift/QtUI/Roster/QtRosterWidget.cpp @@ -50,37 +50,41 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) { QModelIndex index = indexAt(event->pos()); if (!index.isValid()) { return; } RosterItem* item = static_cast<RosterItem*>(index.internalPointer()); QMenu contextMenu; if (ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item)) { QAction* editContact = contextMenu.addAction(tr("Edit")); QAction* removeContact = contextMenu.addAction(tr("Remove")); +#ifdef SWIFT_EXPERIMENTAL_FT QAction* sendFile = NULL; if (contact->supportsFeature(ContactRosterItem::FileTransferFeature)) { sendFile = contextMenu.addAction(tr("Send File")); } +#endif QAction* result = contextMenu.exec(event->globalPos()); if (result == editContact) { eventStream_->send(boost::make_shared<RequestContactEditorUIEvent>(contact->getJID())); } else if (result == removeContact) { if (QtContactEditWindow::confirmContactDeletion(contact->getJID())) { eventStream_->send(boost::make_shared<RemoveRosterItemUIEvent>(contact->getJID())); } } - else if (result == sendFile) { +#ifdef SWIFT_EXPERIMENTAL_FT + else if (sendFile && result == sendFile) { QString fileName = QFileDialog::getOpenFileName(this, tr("Send File"), "", tr("All Files (*);;")); if (!fileName.isEmpty()) { eventStream_->send(boost::make_shared<SendFileUIEvent>(contact->getJID(), fileName.toStdString())); } } +#endif } else if (GroupRosterItem* group = dynamic_cast<GroupRosterItem*>(item)) { QAction* renameGroupAction = contextMenu.addAction(tr("Rename")); QAction* result = contextMenu.exec(event->globalPos()); if (result == renameGroupAction) { renameGroup(group); } } } diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp index 79dd6a2..2e37ba2 100644 --- a/Swift/QtUI/Roster/QtTreeWidget.cpp +++ b/Swift/QtUI/Roster/QtTreeWidget.cpp @@ -28,19 +28,21 @@ QtTreeWidget::QtTreeWidget(UIEventStream* eventStream, QWidget* parent) : QTreeV setItemDelegate(delegate_); setHeaderHidden(true); #ifdef SWIFT_PLATFORM_MACOSX setAlternatingRowColors(true); #endif setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); expandAll(); setAnimated(true); setIndentation(0); +#ifdef SWIFT_EXPERIMENTAL_FT setAcceptDrops(true); +#endif setRootIsDecorated(true); connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(handleItemActivated(const QModelIndex&))); connect(model_, SIGNAL(itemExpanded(const QModelIndex&, bool)), this, SLOT(handleModelItemExpanded(const QModelIndex&, bool))); connect(this, SIGNAL(expanded(const QModelIndex&)), this, SLOT(handleExpanded(const QModelIndex&))); connect(this, SIGNAL(collapsed(const QModelIndex&)), this, SLOT(handleCollapsed(const QModelIndex&))); connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(handleClicked(const QModelIndex&))); } QtTreeWidget::~QtTreeWidget() { |