[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bbluedevil=5D_src/actionplugins/sendfile/helper=3A_U?=
From:       Alex Fiestas <alex () eyeos ! org>
Date:       2011-02-03 4:18:03
Message-ID: 20110203041803.ECBD6A60C6 () git ! kde ! org
[Download RAW message or body]

Git commit 40f2409e21899b4643516cf2478fa60cfbbd6f71 by Alex Fiestas.
Committed on 03/02/11 at 04:07.
Pushed by afiestas into branch 'master'.

Use a different Page for each way of launched sendfiles

sendfiles can be launched in tree different ways and now we're
using 3 different pages depending on how it is launched.

-Without UBI or Files
	-SelectDeviceAndFilesPage is used (this is the old DevicePage)
-With UBI
	-SelectFilesPage
-With Files
	-SelectDevicePage

Also this commit changes the way we were getting the files, now the
wizard stores a QStringList instead of the KFileDialog and and therefore
SendFilesJob has been ported to use QStringList instead.

M  +2    -0    src/actionplugins/sendfile/helper/CMakeLists.txt     
M  +5    -9    src/actionplugins/sendfile/helper/main.cpp     
A  +109  -0    src/actionplugins/sendfile/helper/pages/selectdeviceandfilespage.cpp   \
[License: GPL (v2+)] A  +55   -0    \
src/actionplugins/sendfile/helper/pages/selectdeviceandfilespage.h         [License: \
GPL (v2+)] M  +2    -34   \
src/actionplugins/sendfile/helper/pages/selectdevicepage.cpp      M  +0    -2    \
src/actionplugins/sendfile/helper/pages/selectdevicepage.h      A  +63   -0    \
src/actionplugins/sendfile/helper/pages/selectfilespage.cpp         [License: GPL \
(v2+)] A  +45   -0    src/actionplugins/sendfile/helper/pages/selectfilespage.h       \
[License: GPL (v2+)] M  +7    -10   \
src/actionplugins/sendfile/helper/sendfilesjob.cpp      M  +1    -1    \
src/actionplugins/sendfile/helper/sendfilesjob.h      M  +25   -11   \
src/actionplugins/sendfile/helper/sendfilewizard.cpp      M  +6    -5    \
src/actionplugins/sendfile/helper/sendfilewizard.h     

http://commits.kde.org/bluedevil/40f2409e21899b4643516cf2478fa60cfbbd6f71

diff --git a/src/actionplugins/sendfile/helper/CMakeLists.txt \
b/src/actionplugins/sendfile/helper/CMakeLists.txt index cd87c50..1b77133 100644
--- a/src/actionplugins/sendfile/helper/CMakeLists.txt
+++ b/src/actionplugins/sendfile/helper/CMakeLists.txt
@@ -8,7 +8,9 @@ set(sendfilehelper_SRCS
     main.cpp
     discoverwidget.cpp
     sendfilewizard.cpp
+    pages/selectdeviceandfilespage.cpp
     pages/selectdevicepage.cpp
+    pages/selectfilespage.cpp
     pages/connectingpage.cpp
     obexagent.cpp
     sendfilesjob.cpp
diff --git a/src/actionplugins/sendfile/helper/main.cpp \
b/src/actionplugins/sendfile/helper/main.cpp index 73e58ac..06a6b9d 100644
--- a/src/actionplugins/sendfile/helper/main.cpp
+++ b/src/actionplugins/sendfile/helper/main.cpp
@@ -36,23 +36,19 @@ int main(int argc, char *argv[])
     aboutData.setProgramIconName("preferences-system-bluetooth");
 
     KCmdLineArgs::init(argc, argv, &aboutData);
+
     KCmdLineOptions options;
-    options.add("+[URL]", ki18n("Device to send files to"));
+    options.add("u").add("ubi <ubi>", ki18n("Device UUID where the files will be \
sent")); +    options.add("f").add("files <files>", ki18n("Files that will be \
sent"));  KCmdLineArgs::addCmdLineOptions( options );
 
     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
-    QString wizardArg;
-    if (args->count()) {
-        wizardArg = KUrl(args->arg(0)).host().replace('-', ':');
-    }
 
     KApplication app;
     app.setQuitOnLastWindowClosed(false);
 
-    SendFileWizard *sendFileWizard = new SendFileWizard(wizardArg);
-    if (!wizardArg.isEmpty()) {
-        sendFileWizard->setDevice(Manager::self()->defaultAdapter()->deviceForAddress(wizardArg));
                
-    }
+    SendFileWizard *sendFileWizard = new SendFileWizard(args->getOption("ubi"), \
args->getOptionList("files")); +
     sendFileWizard->show();
 
     return app.exec();
diff --git a/src/actionplugins/sendfile/helper/pages/selectdeviceandfilespage.cpp \
b/src/actionplugins/sendfile/helper/pages/selectdeviceandfilespage.cpp new file mode \
100644 index 0000000..6170cf0
--- /dev/null
+++ b/src/actionplugins/sendfile/helper/pages/selectdeviceandfilespage.cpp
@@ -0,0 +1,109 @@
+/***************************************************************************
+ *   This file is part of the KDE project                                  *
+ *                                                                         *
+ *   Copyright (C) 2010 Alejandro Fiestas Olivares <alex@ufocoders.com>    *
+ *   Copyright (C) 2010 UFO Coders <info@ufocoders.com>                    *
+ *                                                                         *
+ *   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) any later version.                                   *
+ *                                                                         *
+ *   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 "selectdeviceandfilespage.h"
+#include "discoverwidget.h"
+#include "../sendfilewizard.h"
+
+#include <QDesktopServices>
+#include <QtGui/QVBoxLayout>
+
+#include <KUrl>
+#include <kfiledialog.h>
+#include <kfilewidget.h>
+#include <kdiroperator.h>
+#include <kurlrequester.h>
+#include <kurlcombobox.h>
+#include <kpixmapsequenceoverlaypainter.h>
+#include <KDebug>
+
+#include <bluedevil/bluedevil.h>
+#include <QLabel>
+
+using namespace BlueDevil;
+SelectDeviceAndFilesPage::SelectDeviceAndFilesPage(QWidget* parent): \
QWizardPage(parent), m_dialog(0) +{
+    setupUi(this);
+
+    DiscoverWidget *widget = new DiscoverWidget(this);
+    widget->setContentsMargins(0, 0, 0, 0);
+    discoverLayout->addWidget(widget);
+
+    KPixmapSequenceOverlayPainter *workingPainter = new \
KPixmapSequenceOverlayPainter(this); +    workingPainter->setWidget(working);
+    workingPainter->start();
+
+    int buttonSize = selectBtn->sizeHint().height();
+    selectBtn->setFixedSize(buttonSize, buttonSize);
+    selectBtn->setIcon(KIcon("document-open"));
+
+    connect(widget, SIGNAL(deviceSelected(Device*)), this, \
SLOT(deviceSelected(Device*))); +    connect(selectBtn, SIGNAL(clicked(bool)), this, \
SLOT(openFileDialog())); +}
+
+
+void SelectDeviceAndFilesPage::deviceSelected(Device* device)
+{
+    if (!device->name().isEmpty()) {
+        static_cast<SendFileWizard* >(wizard())->setDevice(device);
+    } else {
+        static_cast<SendFileWizard* >(wizard())->setDevice(0);
+    }
+    emit completeChanged();
+}
+
+void SelectDeviceAndFilesPage::openFileDialog()
+{
+    //Don't worry MLaurent, I'm not going to check the pointer before delete it :)
+    delete m_dialog;
+
+    m_dialog = new KFileDialog(KUrl(QDesktopServices::storageLocation(QDesktopServices::HomeLocation)), \
"*", this); +    m_dialog->setMode(KFile::Files);
+
+    connect(m_dialog, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
+
+    m_dialog->exec();
+}
+
+void SelectDeviceAndFilesPage::selectionChanged()
+{
+    if (m_dialog->selectedUrls().isEmpty()) {
+        selectLbl->setText(i18n("Select one or more files:"));
+    } else {
+        selectLbl->setText(i18n("Selected files: \
<b>%1</b>").arg(m_dialog->selectedUrls().count())); +        \
static_cast<SendFileWizard* >(wizard())->setFiles(m_dialog->selectedFiles()); +    }
+    emit completeChanged();
+}
+
+bool SelectDeviceAndFilesPage::isComplete() const
+{
+    if (!static_cast<SendFileWizard* >(wizard())->device()) {
+        return false;
+    }
+
+    if (!m_dialog || m_dialog->selectedUrls().isEmpty()) {
+        return false;
+    }
+
+    return true;
+}
diff --git a/src/actionplugins/sendfile/helper/pages/selectdeviceandfilespage.h \
b/src/actionplugins/sendfile/helper/pages/selectdeviceandfilespage.h new file mode \
100644 index 0000000..ce23dea
--- /dev/null
+++ b/src/actionplugins/sendfile/helper/pages/selectdeviceandfilespage.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ *   This file is part of the KDE project                                  *
+ *                                                                         *
+ *   Copyright (C) 2010 Alejandro Fiestas Olivares <alex@ufocoders.com>    *
+ *   Copyright (C) 2010 UFO Coders <info@ufocoders.com>                    *
+ *                                                                         *
+ *   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) any later version.                                   *
+ *                                                                         *
+ *   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 SELECTDEVICEFILESPAGE_H
+#define SELECTDEVICEFILESPAGE_H
+
+#include "ui_selectfilediscover.h"
+
+#include <QWizard>
+
+class KUrl;
+class KFileDialog;
+namespace BlueDevil {
+    class Device;
+}
+using namespace BlueDevil;
+
+class SelectDeviceAndFilesPage : public QWizardPage ,
+        public Ui::SelectFileDiscover
+{
+Q_OBJECT
+public:
+    SelectDeviceAndFilesPage(QWidget* parent = 0);
+
+    virtual bool isComplete() const;
+
+private Q_SLOTS:
+    void deviceSelected(Device*);
+    void openFileDialog();
+    void selectionChanged();
+
+private:
+    KFileDialog *m_dialog;
+};
+
+#endif // SELECTDEVICEFILESPAGE_H
diff --git a/src/actionplugins/sendfile/helper/pages/selectdevicepage.cpp \
b/src/actionplugins/sendfile/helper/pages/selectdevicepage.cpp index b84bb66..c2b044a \
                100644
--- a/src/actionplugins/sendfile/helper/pages/selectdevicepage.cpp
+++ b/src/actionplugins/sendfile/helper/pages/selectdevicepage.cpp
@@ -52,15 +52,11 @@ SelectDevicePage::SelectDevicePage(QWidget* parent): \
QWizardPage(parent), m_dial  workingPainter->setWidget(working);
     workingPainter->start();
 
-    int buttonSize = selectBtn->sizeHint().height();
-    selectBtn->setFixedSize(buttonSize, buttonSize);
-    selectBtn->setIcon(KIcon("document-open"));
-
+    selectBtn->setHidden(true);
+    selectLbl->setHidden(true);
     connect(widget, SIGNAL(deviceSelected(Device*)), this, \
                SLOT(deviceSelected(Device*)));
-    connect(selectBtn, SIGNAL(clicked(bool)), this, SLOT(openFileDialog()));
 }
 
-
 void SelectDevicePage::deviceSelected(Device* device)
 {
     if (!device->name().isEmpty()) {
@@ -71,39 +67,11 @@ void SelectDevicePage::deviceSelected(Device* device)
     emit completeChanged();
 }
 
-void SelectDevicePage::openFileDialog()
-{
-    //Don't worry MLaurent, I'm not going to check the pointer before delete it :)
-    delete m_dialog;
-
-    m_dialog = new KFileDialog(KUrl(QDesktopServices::storageLocation(QDesktopServices::HomeLocation)), \
                "*", this);
-    m_dialog->setMode(KFile::Files);
-
-    static_cast<SendFileWizard* >(wizard())->setFileDialog(m_dialog);
-    connect(m_dialog, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
-
-    m_dialog->exec();
-}
-
-void SelectDevicePage::selectionChanged()
-{
-    if (m_dialog->selectedUrls().isEmpty()) {
-        selectLbl->setText(i18n("Select one or more files:"));
-    } else {
-        selectLbl->setText(i18n("Selected files: \
                <b>%1</b>").arg(m_dialog->selectedUrls().count()));
-    }
-    emit completeChanged();
-}
-
 bool SelectDevicePage::isComplete() const
 {
     if (!static_cast<SendFileWizard* >(wizard())->device()) {
         return false;
     }
 
-    if (!m_dialog || m_dialog->selectedUrls().isEmpty()) {
-        return false;
-    }
-
     return true;
 }
diff --git a/src/actionplugins/sendfile/helper/pages/selectdevicepage.h \
b/src/actionplugins/sendfile/helper/pages/selectdevicepage.h index daa03dd..9972ce0 \
                100644
--- a/src/actionplugins/sendfile/helper/pages/selectdevicepage.h
+++ b/src/actionplugins/sendfile/helper/pages/selectdevicepage.h
@@ -45,8 +45,6 @@ public:
 
 private Q_SLOTS:
     void deviceSelected(Device*);
-    void openFileDialog();
-    void selectionChanged();
 
 private:
     KFileDialog *m_dialog;
diff --git a/src/actionplugins/sendfile/helper/pages/selectfilespage.cpp \
b/src/actionplugins/sendfile/helper/pages/selectfilespage.cpp new file mode 100644
index 0000000..d0818eb
--- /dev/null
+++ b/src/actionplugins/sendfile/helper/pages/selectfilespage.cpp
@@ -0,0 +1,63 @@
+/***************************************************************************
+ *   This file is part of the KDE project                                  *
+ *                                                                         *
+ *   Copyright (C) 2010 Alejandro Fiestas Olivares <alex@ufocoders.com>    *
+ *   Copyright (C) 2010 UFO Coders <info@ufocoders.com>                    *
+ *                                                                         *
+ *   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) any later version.                                   *
+ *                                                                         *
+ *   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 "selectfilespage.h"
+#include "../sendfilewizard.h"
+
+#include <kfilewidget.h>
+#include <kdiroperator.h>
+#include <kurl.h>
+#include <kfileitem.h>
+
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QLabel>
+
+#include <QDesktopServices>
+
+SelectFilesPage::SelectFilesPage(QWidget* parent): QWizardPage(parent)
+{
+    m_files = new KFileWidget(KUrl(QDesktopServices::storageLocation(QDesktopServices::HomeLocation)), \
this); +    m_files->setMode(KFile::Files);
+    m_files->setContentsMargins(0, 0, 0, 0);
+    setContentsMargins(0, 0, 0, 0);
+
+    connect(m_files, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(m_files);
+}
+
+void SelectFilesPage::selectionChanged()
+{
+    QStringList fileList;
+    KFileItemList itemList = m_files->dirOperator()->selectedItems();
+    Q_FOREACH(const KFileItem &file, itemList) {
+        fileList << file.localPath();
+    }
+    static_cast<SendFileWizard* >(wizard())->setFiles(fileList);
+    emit completeChanged();
+}
+
+bool SelectFilesPage::isComplete() const
+{
+    return !m_files->dirOperator()->selectedItems().isEmpty();
+}
\ No newline at end of file
diff --git a/src/actionplugins/sendfile/helper/pages/selectfilespage.h \
b/src/actionplugins/sendfile/helper/pages/selectfilespage.h new file mode 100644
index 0000000..315326d
--- /dev/null
+++ b/src/actionplugins/sendfile/helper/pages/selectfilespage.h
@@ -0,0 +1,45 @@
+/***************************************************************************
+ *   This file is part of the KDE project                                  *
+ *                                                                         *
+ *   Copyright (C) 2010 Alejandro Fiestas Olivares <alex@ufocoders.com>    *
+ *   Copyright (C) 2010 UFO Coders <info@ufocoders.com>                    *
+ *                                                                         *
+ *   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) any later version.                                   *
+ *                                                                         *
+ *   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 SELECTFILESPAGE_H
+#define SELECTFILESPAGE_H
+
+#include <QtGui/QWizard>
+
+class KFileWidget;
+
+class SelectFilesPage : public QWizardPage
+{
+Q_OBJECT
+public:
+    SelectFilesPage(QWidget* parent = 0);
+
+    virtual bool isComplete() const;
+
+private Q_SLOTS:
+    void selectionChanged();
+
+private:
+    KFileWidget *m_files;
+};
+
+#endif // SELECTFILESPAGE_H
diff --git a/src/actionplugins/sendfile/helper/sendfilesjob.cpp \
b/src/actionplugins/sendfile/helper/sendfilesjob.cpp index 211a6b5..2083d68 100644
--- a/src/actionplugins/sendfile/helper/sendfilesjob.cpp
+++ b/src/actionplugins/sendfile/helper/sendfilesjob.cpp
@@ -30,26 +30,23 @@
 #include <KDebug>
 
 #include <bluedevil/bluedevil.h>
-#include <kfile.h>
 
 using namespace BlueDevil;
-SendFilesJob::SendFilesJob(KUrl::List list, Device* device, ObexAgent* agent, \
QObject* parent): KJob(parent) +SendFilesJob::SendFilesJob(const QStringList& files, \
Device* device, ObexAgent* agent, QObject* parent): KJob(parent)  \
,m_currentTransferJob(0)  {
+    m_filesToSend = files;
     m_agent = agent;
     m_device = device;
 
     m_totalSize = 0;
     m_progress = 0;
 
-    Q_FOREACH(const KUrl &url, list) {
-        if (url.isLocalFile()) {
-            m_filesToSend << url.path();
-            QFile file(url.url());
-            kDebug() << "Adding size : " << file.size();
-            m_filesToSendSize << file.size();
-            m_totalSize += file.size();
-        }
+    Q_FOREACH(const QString &filePath, files) {
+        QFile file(filePath);
+        kDebug() << "Adding size : " << file.size();
+        m_filesToSendSize << file.size();
+        m_totalSize += file.size();
     }
 
     connect(m_agent, SIGNAL(request(OrgOpenobexTransferInterface *)), this, \
                SLOT(nextJob(OrgOpenobexTransferInterface*)));
diff --git a/src/actionplugins/sendfile/helper/sendfilesjob.h \
b/src/actionplugins/sendfile/helper/sendfilesjob.h index 3fb044a..49088a7 100644
--- a/src/actionplugins/sendfile/helper/sendfilesjob.h
+++ b/src/actionplugins/sendfile/helper/sendfilesjob.h
@@ -43,7 +43,7 @@ class SendFilesJob : public KJob
 {
 Q_OBJECT
 public:
-    SendFilesJob(KUrl::List list, BlueDevil::Device* device, ObexAgent* agent, \
QObject* parent = 0); +    SendFilesJob(const QStringList &files, BlueDevil::Device* \
device, ObexAgent* agent, QObject* parent = 0);  
     virtual void start();
     virtual bool doKill();
diff --git a/src/actionplugins/sendfile/helper/sendfilewizard.cpp \
b/src/actionplugins/sendfile/helper/sendfilewizard.cpp index c1fb97d..a2274a8 100644
--- a/src/actionplugins/sendfile/helper/sendfilewizard.cpp
+++ b/src/actionplugins/sendfile/helper/sendfilewizard.cpp
@@ -18,11 +18,15 @@
 
 #include "sendfilewizard.h"
 #include "obexagent.h"
+
+#include "pages/selectdeviceandfilespage.h"
 #include "pages/selectdevicepage.h"
+#include "pages/selectfilespage.h"
 #include "pages/connectingpage.h"
 
 #include <QApplication>
 
+#include <kdebug.h>
 #include <kstandardguiitem.h>
 #include <klocalizedstring.h>
 #include <kpushbutton.h>
@@ -35,7 +39,7 @@
 
 using namespace BlueDevil;
 
-SendFileWizard::SendFileWizard(const QString &deviceUri)
+SendFileWizard::SendFileWizard(const QString& deviceUBI, const QStringList& files)
     : QWizard()
     , m_device(0)
     , m_job(0)
@@ -52,8 +56,18 @@ SendFileWizard::SendFileWizard(const QString &deviceUri)
         setOption(QWizard::DisabledBackButtonOnLastPage);
         setOption(QWizard::NoBackButtonOnStartPage);
 
-        if (deviceUri.isEmpty()) {
+        if (deviceUBI.isEmpty() && files.isEmpty()) {
+            addPage(new SelectDeviceAndFilesPage());
+        } else if (deviceUBI.isEmpty()) {
             addPage(new SelectDevicePage());
+            setFiles(files);
+        } else if (files.isEmpty()) {
+            addPage(new SelectFilesPage());
+            setMinimumSize(680, 400);
+            setDevice(Manager::self()->defaultAdapter()->deviceForUBI(deviceUBI));
+        } else {
+            setFiles(files);
+            setDevice(Manager::self()->defaultAdapter()->deviceForUBI(deviceUBI));
         }
         addPage(new ConnectingPage());
 
@@ -76,15 +90,10 @@ void SendFileWizard::done(int result)
     }
 }
 
-
-void SendFileWizard::setFileDialog(KFileDialog *fileDialog)
+void SendFileWizard::setFiles(const QStringList& files)
 {
-    m_fileDialog = fileDialog;
-}
-
-KFileDialog* SendFileWizard::fileDialog()
-{
-    return m_fileDialog;
+    kDebug() << files;
+    m_files = files;
 }
 
 void SendFileWizard::setDevice(Device* device)
@@ -104,7 +113,12 @@ void SendFileWizard::wizardDone()
 
 void SendFileWizard::startTransfer()
 {
-    m_job = new SendFilesJob(m_fileDialog->selectedUrls(), m_device, m_agent);
+    if (m_files.isEmpty()) {
+        kDebug() << "No files to send";
+        return;
+    }
+
+    m_job = new SendFilesJob(m_files, m_device, m_agent);
     connect(m_job, SIGNAL(destroyed(QObject*)), qApp, SLOT(quit()));
 
     KIO::getJobTracker()->registerJob(m_job);
diff --git a/src/actionplugins/sendfile/helper/sendfilewizard.h \
b/src/actionplugins/sendfile/helper/sendfilewizard.h index de04dbd..5cf973c 100644
--- a/src/actionplugins/sendfile/helper/sendfilewizard.h
+++ b/src/actionplugins/sendfile/helper/sendfilewizard.h
@@ -21,10 +21,11 @@
 
 #include <QObject>
 #include <QWizard>
+#include <QStringList>
 #include "discoverwidget.h"
 
 class WizardAgent;
-class KFileDialog;
+class QStringList;
 class ObexAgent;
 class SendFilesJob;
 namespace BlueDevil {
@@ -37,13 +38,12 @@ class SendFileWizard : public QWizard
 Q_OBJECT
 
 public:
-    SendFileWizard(const QString &deviceUri);
+    SendFileWizard(const QString &deviceUBI, const QStringList &files);
     virtual ~SendFileWizard();
 
     virtual void done(int result);
 
-    void setFileDialog(KFileDialog *);
-    KFileDialog * fileDialog();
+    void setFiles(const QStringList &files);
 
     void setDevice(Device *device);
     Device* device();
@@ -54,7 +54,8 @@ private Q_SLOTS:
     void wizardDone();
 
 private:
-    KFileDialog  *m_fileDialog;
+    QStringList  m_files;
+
     Device       *m_device;
     ObexAgent    *m_agent;
     SendFilesJob *m_job;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic