diff options
author | Remko Tronçon <remko@synopsys.com> | 2011-09-30 17:10:20 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-09-30 17:15:59 (GMT) |
commit | 75818abb4baa26649baf8d3bf6709aefcda7195f (patch) | |
tree | 25cf8cc224100688d813ab57f3ccf32771f1bdf1 /Swift/QtUI | |
parent | a98f648f5cfbf474c566bd63193047e5381e7d5e (diff) | |
download | swift-contrib-75818abb4baa26649baf8d3bf6709aefcda7195f.zip swift-contrib-75818abb4baa26649baf8d3bf6709aefcda7195f.tar.bz2 |
Fixed some Windows issues with FT.
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtChatView.cpp | 3 | ||||
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 8 | ||||
-rw-r--r-- | Swift/QtUI/Roster/QtRosterWidget.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/Roster/QtTreeWidget.cpp | 2 |
4 files changed, 8 insertions, 7 deletions
diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp index cb7f901..7bb5818 100644 --- a/Swift/QtUI/QtChatView.cpp +++ b/Swift/QtUI/QtChatView.cpp @@ -16,18 +16,19 @@ #include <QStackedWidget> #include <QTimer> #include <QMessageBox> #include <QApplication> #include <Swiften/Base/Log.h> #include "QtWebView.h" #include "QtChatTheme.h" +#include "QtSwiftUtil.h" namespace Swift { QtChatView::QtChatView(QtChatTheme* theme, QWidget* parent) : QWidget(parent), fontSizeSteps_(0) { theme_ = theme; QVBoxLayout* mainLayout = new QVBoxLayout(this); mainLayout->setSpacing(0); @@ -296,19 +297,19 @@ void QtChatView::setFileTransferProgress(QString id, const int percentageDone) { progressBar.setStyleProperty("width", QString::number(percentageDone) + "%"); QWebElement progressBarValue = ftElement.findFirst("div.progressbar-value"); progressBarValue.setInnerXml(QString::number(percentageDone) + " %"); } void QtChatView::setFileTransferStatus(QString id, const ChatWindow::FileTransferState state, const QString& /* msg */) { QWebElement ftElement = findDivElementWithID(document_, id); if (ftElement.isNull()) { - SWIFT_LOG(debug) << "Tried to access FT UI via invalid id! id = " << id.toStdString() << std::endl; + SWIFT_LOG(debug) << "Tried to access FT UI via invalid id! id = " << Q2PSTRING(id) << std::endl; return; } QString newInnerHTML = ""; if (state == ChatWindow::WaitingForAccept) { newInnerHTML = "Waiting for other side to accept the transfer.<br/>" "<input id=\"discard\" type=\"submit\" value=\"Cancel\" onclick=\"filetransfer.cancel(\'" + id + "\');\">"; } if (state == ChatWindow::Negotiating) { diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 496c42c..07ff47e 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -531,43 +531,43 @@ void QtChatWindow::setFileTransferProgress(std::string id, const int percentageD messageLog_->setFileTransferProgress(QString::fromStdString(id), percentageDone); } void QtChatWindow::setFileTransferStatus(std::string id, const FileTransferState state, const std::string& msg) { messageLog_->setFileTransferStatus(QString::fromStdString(id), state, QString::fromStdString(msg)); } void QtChatWindow::handleFileTransferCancel(QString id) { qDebug() << "QtChatWindow::handleFileTransferCancel(" << id << ")"; - onFileTransferCancel(id.toStdString()); + onFileTransferCancel(Q2PSTRING(id)); } void QtChatWindow::handleFileTransferSetDescription(QString id) { bool ok = false; QString text = QInputDialog::getText(this, tr("File transfer description"), tr("Description:"), QLineEdit::Normal, "", &ok); if (ok) { descriptions[id] = text; } } void QtChatWindow::handleFileTransferStart(QString id) { qDebug() << "QtChatWindow::handleFileTransferStart(" << id << ")"; QString text = descriptions.find(id) == descriptions.end() ? QString() : descriptions[id]; - onFileTransferStart(id.toStdString(), text.toStdString()); + onFileTransferStart(Q2PSTRING(id), Q2PSTRING(text)); } void QtChatWindow::handleFileTransferAccept(QString id, QString filename) { qDebug() << "QtChatWindow::handleFileTransferAccept(" << id << ", " << filename << ")"; QString path = QFileDialog::getSaveFileName(this, tr("Save File"), filename); if (!path.isEmpty()) { - onFileTransferAccept(id.toStdString(), path.toStdString()); + onFileTransferAccept(Q2PSTRING(id), Q2PSTRING(path)); } } void QtChatWindow::addErrorMessage(const std::string& errorMessage) { if (isWidgetSelected()) { onAllMessagesRead(); } QString errorMessageHTML(Qt::escape(P2QSTRING(errorMessage))); @@ -671,19 +671,19 @@ void QtChatWindow::moveEvent(QMoveEvent*) { void QtChatWindow::dragEnterEvent(QDragEnterEvent *event) { if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() == 1) { // TODO: check whether contact actually supports file transfer event->acceptProposedAction(); } } void QtChatWindow::dropEvent(QDropEvent *event) { if (event->mimeData()->urls().size() == 1) { - onSendFileRequest(event->mimeData()->urls().at(0).toLocalFile().toStdString()); + onSendFileRequest(Q2PSTRING(event->mimeData()->urls().at(0).toLocalFile())); } else { addSystemMessage("Sending of multiple files at once isn't supported at this time."); } } void QtChatWindow::replaceLastMessage(const std::string& message) { messageLog_->replaceLastMessage(P2QSTRING(Linkify::linkify(message))); } diff --git a/Swift/QtUI/Roster/QtRosterWidget.cpp b/Swift/QtUI/Roster/QtRosterWidget.cpp index 3d9b273..4c96695 100644 --- a/Swift/QtUI/Roster/QtRosterWidget.cpp +++ b/Swift/QtUI/Roster/QtRosterWidget.cpp @@ -69,19 +69,19 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) { else if (result == removeContact) { if (QtContactEditWindow::confirmContactDeletion(contact->getJID())) { eventStream_->send(boost::make_shared<RemoveRosterItemUIEvent>(contact->getJID())); } } #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())); + eventStream_->send(boost::make_shared<SendFileUIEvent>(contact->getJID(), Q2PSTRING(fileName))); } } #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 2e37ba2..690515d 100644 --- a/Swift/QtUI/Roster/QtTreeWidget.cpp +++ b/Swift/QtUI/Roster/QtTreeWidget.cpp @@ -118,19 +118,19 @@ void QtTreeWidget::dragEnterEvent(QDragEnterEvent *event) { void QtTreeWidget::dropEvent(QDropEvent *event) { QModelIndex index = indexAt(event->pos()); if (index.isValid()) { RosterItem* item = static_cast<RosterItem*>(index.internalPointer()); if (ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item)) { if (contact->supportsFeature(ContactRosterItem::FileTransferFeature)) { QString filename = event->mimeData()->urls().at(0).toLocalFile(); if (!filename.isEmpty()) { - eventStream_->send(boost::make_shared<SendFileUIEvent>(contact->getJID(), filename.toStdString())); + eventStream_->send(boost::make_shared<SendFileUIEvent>(contact->getJID(), Q2PSTRING(filename))); } } } } } void QtTreeWidget::dragMoveEvent(QDragMoveEvent* event) { QModelIndex index = indexAt(event->pos()); if (index.isValid()) { |