File: main.cpp

package info (click to toggle)
kde-workspace 4:4.11.13-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 67,756 kB
  • ctags: 47,705
  • sloc: cpp: 358,638; ansic: 34,695; xml: 5,231; perl: 1,598; sh: 1,307; ruby: 1,135; python: 651; asm: 566; makefile: 37
file content (83 lines) | stat: -rw-r--r-- 3,033 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 *   Copyright 2006-2008 Aaron Seigo <aseigo@kde.org>
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as
 *   published by the Free Software Foundation; either version 2,
 *   or (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details
 *
 *   You should have received a copy of the GNU Library General Public
 *   License along with this program; if not, write to the
 *   Free Software Foundation, Inc.,
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#include <KAboutData>
#include <KCmdLineArgs>
#include <KLocale>
#include <KIcon>
#include <KConfigGroup>

#include "plasmaapp.h"

static const char description[] = I18N_NOOP( "The KDE workspace application optimized for Netbook devices." );
static const char version[] = "0.2";

extern "C"
KDE_EXPORT int kdemain(int argc, char **argv)
{
    KAboutData aboutData("plasma-netbook", 0, ki18n("Plasma Netbook Shell"),
                         version, ki18n(description), KAboutData::License_GPL,
                         ki18n("Copyright 2006-2009, The KDE Team"));
    aboutData.addAuthor(ki18n("Aaron J. Seigo"),
                        ki18n("Author and maintainer"),
                        "aseigo@kde.org");


    bool customGraphicsSystem = false;
    bool argExplicitDesktop = false;
    for (int i = 0; i < argc; ++i) {
        QString arg(argv[i]);
        if (arg == "-graphicssystem") {
            customGraphicsSystem = true;
            break;
        } else if (arg == "--desktop") {
            argExplicitDesktop = true;
        } else if (arg == "--nodesktop") {
            argExplicitDesktop = false;
        }
    }

    if (!customGraphicsSystem) {
        KConfigGroup cg(KSharedConfig::openConfig("plasma-netbookrc"), "General");
        QApplication::setGraphicsSystem(cg.readEntry("GraphicsSystem", "native"));
    }

    KCmdLineArgs::init(argc, argv, &aboutData);

    KCmdLineOptions options;
    options.add("nodesktop", ki18n("Starts as a normal application instead of as the primary user interface"));
    options.add("opengl", ki18n("Use OpenGL to draw the main screen"));
    options.add("screen <geometry>", ki18n("The geometry of the screen"), "800x480");
    if (argExplicitDesktop)
        options.add("noautostart", ki18n("Explicit --desktop enables autostart handling which may be disabled with this option"));
    else
        options.add("autostart", ki18n("Enable autostart handling"));
    KCmdLineArgs::addCmdLineOptions(options);

    PlasmaApp *app = PlasmaApp::self();
    if (!app->shallBeStarted())
        return 0;

    QApplication::setWindowIcon(KIcon("plasma"));
    app->disableSessionManagement(); // autostarted
    int rc = app->exec();
    delete app;
    return rc;
}