2 <one line to give the program's name and a brief idea of what it does.>
3 Copyright (C) 2012 Ixonos Plc
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include <QtCore/QString>
21 #include <QtCore/QDebug>
22 #include <QFileDialog>
23 #include <meegotouch/mwindow.h>
25 #include "MainPageHandler.h"
31 MainPageHandler::MainPageHandler(QObject *parent) :
36 MainPageHandler::~MainPageHandler()
40 void MainPageHandler::fileSelectorOpen()
42 qDebug() << Q_FUNC_INFO;
43 QWidget* widget = qobject_cast<QWidget*>(MApplication::activeWindow());
44 QString filename = QFileDialog::getOpenFileName(widget, tr("Open torrent file"), QString(), tr("Torrent files (*.torrent)") );
45 on_torrentFileSelected(filename);
49 void MainPageHandler::on_torrentFileSelected(const QString& file)
51 qDebug() << Q_FUNC_INFO << " file selected: " << file;
53 // Torrent filename empty, do nothing.
58 // Otherwise add torrent
59 // For params, see: http://www.rasterbar.com/products/libtorrent/manual.html#add-torrent
60 // save_path is the only mandatory parameter, rest are optional.
61 //addParams.storage_mode = libtorrent::storage_mode_allocate;
63 // TODO: Enable this once server_ is in place
64 // server_.addTorrent(file,
65 // settings_.value("download/directory").toString(),
68 qDebug() << Q_FUNC_INFO << "Exception adding torrent";
72 } //namespace qtrapids