~ubuntu-branches/debian/stretch/apper/stretch

« back to all changes in this revision

Viewing changes to AppSetup/main.cpp

  • Committer: Package Import Robot
  • Author(s): Matthias Klumpp
  • Date: 2012-05-22 10:45:24 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20120522104524-jqbl47ulmak7sho6
Tags: 0.7.2-1
* New upstream release: 0.7.2
  - Automatic Refresh Cache properly fixed
  - Initial Listaller support (optional)
  - Supported filter added (depends on the backend)
  - KDED plugin runs on a separate thread to avoid
     desktop freezes
  - Fixed updating packages that were on untrusted repos
  - Fresh manual pages (thanks to Matthias)
  - Many other bug- and Krazy fixes
* Updated debian/copyright
* Switch to compat-level 9
* Updated watch file
* Split out arch-indep apper-data package
* Add apper-appsetup package for Listaller modules
* Remove old replacement for KPackageKit: No longer required
* Removed manpages: Pages are upstream now
* Override lintian false-positive about icon-sizes
* Allow DM upload

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of Apper
 
2
 *
 
3
 * Copyright (C) 2012 Matthias Klumpp <matthias@tenstral.net>
 
4
 *
 
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.
 
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 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; see the file COPYING. If not, write to
 
17
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
 * Boston, MA 02110-1301, USA.
 
19
 */
 
20
 
 
21
#include <KAboutData>
 
22
#include <KCmdLineArgs>
 
23
#include <KDebug>
 
24
#include <KApplication>
 
25
#include <KMessageBox>
 
26
#include <QFileInfo>
 
27
#include <glib-object.h>
 
28
#include <listaller.h>
 
29
 
 
30
#include "SetupWizard.h"
 
31
 
 
32
int main(int argc, char** argv)
 
33
{
 
34
    KAboutData aboutData("appsetup-kde", 0, ki18n("KDE Application Installer"), "0.1",
 
35
                         ki18n("KDE Application Installer"), KAboutData::License_GPL,
 
36
                         ki18n("(C) 2012, Matthias Klumpp"));
 
37
 
 
38
    aboutData.addAuthor(ki18nc("@info:credit", "Daniel Nicoletti"), ki18n("Developer"),
 
39
                        "dantti12@gmail.com");
 
40
    aboutData.addAuthor(ki18nc("@info:credit", "Matthias Klumpp"), ki18n("Developer"),
 
41
                        "matthias@tenstral.net");
 
42
    aboutData.setProductName("apper/listaller");
 
43
 
 
44
    KCmdLineArgs::init(argc, argv, &aboutData);
 
45
    // Add --verbose as commandline option
 
46
    KCmdLineOptions options;
 
47
    options.add("verbose", ki18n("Show verbose information"));
 
48
    options.add("+file", ki18n("IPK package filename"));
 
49
    KCmdLineArgs::addCmdLineOptions(options);
 
50
 
 
51
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
 
52
 
 
53
    // Set if we are in verbose mode
 
54
    listaller_set_verbose_mode(args->isSet("verbose"));
 
55
    listaller_add_log_domain("KDEAppSetup");
 
56
 
 
57
    QString fname;
 
58
    for(int i = 0; i < args->count(); i++) {
 
59
        fname = args->arg(i);
 
60
        QFileInfo file(fname);
 
61
        if (!file.exists())
 
62
            fname = "";
 
63
        else
 
64
            break;
 
65
    }
 
66
    args->clear();
 
67
 
 
68
    // Initialize GObject type system
 
69
    g_type_init();
 
70
 
 
71
    KApplication app;
 
72
 
 
73
    // Check if we have a package
 
74
    if (fname.isEmpty()) {
 
75
        KMessageBox::sorry (0, i18n("Sorry, we didn't get an existing IPK package as parameter."),
 
76
                            i18n("Package not found!"));
 
77
        return 1;
 
78
    }
 
79
 
 
80
    // Create & run the setup wizard
 
81
    SetupWizard *wizard = new SetupWizard(fname);
 
82
    wizard->show();
 
83
    return app.exec();
 
84
}