~rpadovani/webbrowser-app/settings-page

« back to all changes in this revision

Viewing changes to click-hooks/hook.cpp

  • Committer: Alexandre Abreu
  • Date: 2014-11-12 17:00:12 UTC
  • mto: (806.3.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 827.
  • Revision ID: alexandre.abreu@canonical.com-20141112170012-6ov4k5pbqa8ta7sq
draft

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2014 Canonical Ltd.
 
3
 *
 
4
 * This file is part of webbrowser-app.
 
5
 *
 
6
 * webbrowser-app is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; version 3.
 
9
 *
 
10
 * webbrowser-app 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.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
#include <QCoreApplication>
 
20
#include <QDebug>
 
21
#include <QDir>
 
22
#include <QFileInfo>
 
23
#include <QStandardPaths>
 
24
#include <QString>
 
25
 
 
26
#include "hook-utils.h"
 
27
 
 
28
 
 
29
int main(int argc, char ** argv)
 
30
{
 
31
    QCoreApplication app(argc, argv);
 
32
 
 
33
    if (app.arguments().count() != 1)
 
34
    {
 
35
        qWarning() << "Invalid hook argument count";
 
36
        return EXIT_FAILURE;
 
37
    }
 
38
 
 
39
    HookUtils::WebappClickHookInstallDescription alreadyProcessedClickHooks =
 
40
            HookUtils::listWebappClickHookFilesIn(
 
41
                HookUtils::getProcessedClickHooksFolder());
 
42
 
 
43
    HookUtils::WebappClickHookInstallDescription installedClickHooks =
 
44
            HookUtils::listWebappClickHookFilesIn(
 
45
                HookUtils::getClickHooksInstallFolder());
 
46
 
 
47
    HookUtils::handleInstalls(
 
48
                alreadyProcessedClickHooks,
 
49
                installedClickHooks);
 
50
 
 
51
    HookUtils::handleUpdates(
 
52
                alreadyProcessedClickHooks,
 
53
                installedClickHooks);
 
54
 
 
55
    HookUtils::handleUninstall(
 
56
                alreadyProcessedClickHooks,
 
57
                installedClickHooks);
 
58
 
 
59
    return EXIT_SUCCESS;
 
60
}