Welcome to mirror list, hosted at ThFree Co, Russian Federation.

main.cpp « src - github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a1ee1d6ecf180da05e4f153734d5e645318f1bd3 (plain)
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
/*
 * Copyright (C) by Duncan Mac-Vicar P. <duncan@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 of the License, 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.
 */

#include "mirall/application.h"
#include "mirall/theme.h"

#include <QMessageBox>

int main(int argc, char **argv)
{
    Q_INIT_RESOURCE(mirall);

    Mirall::Application app(argc, argv);
    app.initialize();

    if( app.giveHelp() ) {
        app.showHelp();
        return 0;
    }

    // if the application is already running, notify it.
    if( app.isRunning() ) {
        QStringList args = app.arguments();
        if ( args.size() > 1 && ! app.giveHelp() ) {
            QString msg = args.join( QLatin1String("|") );
            if( ! app.sendMessage( msg ) )
                return -1;
        }
        return 0;
    } else {
        if (!QSystemTrayIcon::isSystemTrayAvailable()) {
            QMessageBox::critical(0, qApp->translate("main.cpp", "System Tray not available"),
                                  qApp->translate("main.cpp", "%1 requires on a working system tray. "
                                  "If you are running XFCE, please follow "
                                  "<a href=\"http://docs.xfce.org/xfce/xfce4-panel/systray\">these instructions</a>. "
                                  "Otherwise, please install a system tray application such as 'trayer' and try again.")
                    .arg(Mirall::Theme::instance()->appNameGUI()));
        }
    }
    return app.exec();
}