ClientTransferManager::ClientTransferManager(QObject *parent)
: TransferManager(parent)
{
-
+ connect(this, SIGNAL(transferAdded(const Transfer*)), SLOT(onTransferAdded(const Transfer*)));
}
Q_ASSERT(transfer);
addTransfer(transfer);
}
+
+
+void ClientTransferManager::onTransferAdded(const Transfer *transfer)
+{
+ // FIXME just a temporary solution
+ emit newTransfer(transfer);
+}
void onCoreTransferAdded(const QUuid &uuid);
void onTransferInitDone();
+signals:
+ void newTransfer(const Transfer *transfer);
+
+private slots:
+ void onTransferAdded(const Transfer *transfer);
+
};
#endif
qtuimessageprocessor.cpp
qtuisettings.cpp
qtuistyle.cpp
+ receivefiledlg.cpp
settingsdlg.cpp
settingspagedlg.cpp
simplenetworkeditor.cpp
qtuiapplication.h
qtuimessageprocessor.h
qtuistyle.h
+ receivefiledlg.h
settingsdlg.h
settingspagedlg.h
simplenetworkeditor.h
settingsdlg.ui
settingspagedlg.ui
simplenetworkeditor.ui
+ receivefiledlg.ui
topicwidget.ui)
if(HAVE_KDE)
#include "clientbufferviewconfig.h"
#include "clientbufferviewmanager.h"
#include "clientignorelistmanager.h"
+#include "clienttransfermanager.h"
#include "coreconfigwizard.h"
#include "coreconnectdlg.h"
#include "coreconnection.h"
#include "qtuimessageprocessor.h"
#include "qtuisettings.h"
#include "qtuistyle.h"
+#include "receivefiledlg.h"
#include "settingsdlg.h"
#include "settingspagedlg.h"
#include "statusnotifieritem.h"
#include "toolbaractionprovider.h"
#include "topicwidget.h"
+#include "transfer.h"
#include "verticaldock.h"
#ifndef HAVE_KDE
connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigDeleted(int)), this, SLOT(removeBufferView(int)));
connect(Client::bufferViewManager(), SIGNAL(initDone()), this, SLOT(loadLayout()));
+ connect(Client::transferManager(), SIGNAL(newTransfer(const Transfer*)), SLOT(showNewTransferDlg(const Transfer*)));
+
setConnectedState();
}
}
+void MainWin::showNewTransferDlg(const Transfer *transfer)
+{
+ ReceiveFileDlg *dlg = new ReceiveFileDlg(transfer, this);
+ dlg->show();
+}
+
+
void MainWin::onFullScreenToggled()
{
// Relying on QWidget::isFullScreen is discouraged, see the KToggleFullScreenAction docs
class SystemTray;
class ChatMonitorView;
class TopicWidget;
+class Transfer;
class QMenu;
class QLabel;
void showNotificationsDlg();
void showIgnoreList(QString newRule = QString());
void showShortcutsDlg();
+ void showNewTransferDlg(const Transfer *transfer);
void onFullScreenToggled();
void handleCoreConnectionError(const QString &errorMsg);
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-2013 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#include <QDir>
+#include <QFileDialog>
+
+#include "receivefiledlg.h"
+
+#include "transfer.h"
+
+ReceiveFileDlg::ReceiveFileDlg(const Transfer *transfer, QWidget *parent)
+ : QDialog(parent),
+ _transfer(transfer)
+{
+ setAttribute(Qt::WA_DeleteOnClose);
+ ui.setupUi(this);
+
+ QString label = tr("<b>%1</b> wants to send you a file:<br>%2 (%3 bytes)").arg(transfer->nick(), transfer->fileName()).arg(transfer->fileSize());
+ ui.infoText->setText(label);
+}
+
+
+void ReceiveFileDlg::on_buttonBox_clicked(QAbstractButton *button)
+{
+ if (ui.buttonBox->standardButton(button) == QDialogButtonBox::Save) {
+ QString name = QFileDialog::getSaveFileName(this, QString(), QDir::currentPath() + "/" + _transfer->fileName());
+ _transfer->accept(name);
+ }
+
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-2013 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#ifndef RECEIVEFILEDLG_H
+#define RECEIVEFILEDLG_H
+
+#include "ui_receivefiledlg.h"
+
+class Transfer;
+
+class ReceiveFileDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ ReceiveFileDlg(const Transfer *transfer, QWidget *parent = 0);
+
+private slots:
+ void on_buttonBox_clicked(QAbstractButton *button);
+
+private:
+ Ui::ReceiveFileDlg ui;
+ const Transfer *_transfer;
+};
+
+#endif
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ReceiveFileDlg</class>
+ <widget class="QDialog" name="ReceiveFileDlg">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>354</width>
+ <height>97</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Incoming File Transfer</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="infoText">
+ <property name="text">
+ <string notr="true">Someone is trying to send you a file.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Discard|QDialogButtonBox::Ignore|QDialogButtonBox::Save</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>ReceiveFileDlg</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>ReceiveFileDlg</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>