Debian Codegraph @

src/plugin/folderlistmodel/smb/qsambaclient/test/main_testqsambaclient.cpp

raw symbols SCIP
1 /**************************************************************************
2 *
3 * Copyright 2014 Canonical Ltd.
4 * Copyright 2014 Carlos J Mazieri <[email protected]>
5 *
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.
9 *
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.
14 *
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/>.
17 *
18 * File: main_qsamba.cpp
19 * Date: 03/12/2014
20 */
21
22 #include "testqsambasuite.h"
23
24 #include <QCoreApplication>
25 #include <QStringList>
26 #include <QTest>
27
28 int main(int argc, char *argv[])
29 {
30 QCoreApplication app(argc, argv);
31 TestQSambaSuite tc;
32 QStringList args = QCoreApplication::arguments();
33 QString permanentShareToCreate;
34 QString permanentShareToOpen;
35 bool listAll = false;
36 bool listLocal = false;
37 int count = args.count();
38 while (count--)
39 {
40 //Ubuntu Touch parameter
41 if (args.at(count).startsWith(QLatin1String("--desktop_file_hint")))
42 {
43 args.removeAt(count);
44 }
45 else
46 if (args.at(count).startsWith(QLatin1String("--create")) && count > 0)
47 {
48 permanentShareToCreate = args.at(count+1);
49 args.removeAt(count+1);
50 args.removeAt(count);
51 }
52 else
53 if (args.at(count).startsWith(QLatin1String("--open")) && count > 0)
54 {
55 permanentShareToOpen = args.at(count+1);
56 args.removeAt(count+1);
57 args.removeAt(count);
58 }
59 else
60 if (args.at(count).startsWith(QLatin1String("--lall")) && count > 0)
61 {
62 listAll = true;
63 args.removeAt(count);
64 }
65 else
66 if (args.at(count).startsWith(QLatin1String("--llocal")) && count > 0)
67 {
68 listLocal = true;
69 args.removeAt(count);
70 }
71 }
72
73 if (!permanentShareToOpen.isEmpty())
74 {
75 return tc.openPermanenteShare(permanentShareToOpen) ? 0 : 1;
76 }
77 if (!permanentShareToCreate.isEmpty())
78 {
79 return tc.createPermanentShare(permanentShareToCreate) ? 0 : 1;
80 }
81 if (listAll)
82 {
83 return tc.listRecursive();
84 }
85 if (listLocal)
86 {
87 return tc.listLocalhost();
88 }
89
90 return QTest::qExec(&tc, args);
91 }
92
93
94