1
/**************************************************************************
3
* Copyright 2014 Canonical Ltd.
4
* Copyright 2014 Carlos J Mazieri <carlos.mazieri@gmail.com>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation; version 3.
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 Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
* File: main_qsamba.cpp
22
#include "testqsambasuite.h"
24
#include <QCoreApplication>
25
#include <QStringList>
28
int main(int argc, char *argv[])
30
QCoreApplication app(argc, argv);
32
QStringList args = QCoreApplication::arguments();
33
QString permanentShareToCreate;
34
QString permanentShareToOpen;
36
bool listLocal = false;
37
int count = args.count();
40
//Ubuntu Touch parameter
41
if (args.at(count).startsWith(QLatin1String("--desktop_file_hint")))
46
if (args.at(count).startsWith(QLatin1String("--create")) && count > 0)
48
permanentShareToCreate = args.at(count+1);
49
args.removeAt(count+1);
53
if (args.at(count).startsWith(QLatin1String("--open")) && count > 0)
55
permanentShareToOpen = args.at(count+1);
56
args.removeAt(count+1);
60
if (args.at(count).startsWith(QLatin1String("--lall")) && count > 0)
66
if (args.at(count).startsWith(QLatin1String("--llocal")) && count > 0)
73
if (!permanentShareToOpen.isEmpty())
75
return tc.openPermanenteShare(permanentShareToOpen) ? 0 : 1;
77
if (!permanentShareToCreate.isEmpty())
79
return tc.createPermanentShare(permanentShareToCreate) ? 0 : 1;
83
return tc.listRecursive();
87
return tc.listLocalhost();
90
return QTest::qExec(&tc, args);