* QComboBox -> KComboBox
[kdenetwork.git] / krdc / main.cpp
blobdcdcfa1a8a53bdba0a28a799ac97ddc671065632
1 /****************************************************************************
2 **
3 ** Copyright (C) 2001-2003 Tim Jansen <tim@tjansen.de>
4 ** Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
5 **
6 ** This file is part of KDE.
7 **
8 ** This program is free software; you can redistribute it and/or modify
9 ** it under the terms of the GNU General Public License as published by
10 ** the Free Software Foundation; either version 2 of the License, or
11 ** (at your option) any later version.
13 ** This program is distributed in the hope that it will be useful,
14 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ** GNU General Public License for more details.
18 ** You should have received a copy of the GNU General Public License
19 ** along with this program; see the file COPYING. If not, write to
20 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 ** Boston, MA 02110-1301, USA.
23 ****************************************************************************/
25 #include "mainwindow.h"
27 #include <KApplication>
28 #include <KLocale>
29 #include <KCmdLineArgs>
30 #include <KAboutData>
31 #include <KDebug>
33 int main(int argc, char **argv)
35 KAboutData aboutData("krdc", 0, ki18n("KRDC"), KDE_VERSION_STRING,
36 ki18n("KDE remote desktop connection"), KAboutData::License_GPL,
37 ki18n("(c) 2007-2008, Urs Wolfer\n"
38 "(c) 2001-2003, Tim Jansen\n"
39 "(c) 2002-2003, Arend van Beelen jr.\n"
40 "(c) 2000-2002, Const Kaplinsky\n"
41 "(c) 2000, Tridia Corporation\n"
42 "(c) 1999, AT&T Laboratories Boston\n"
43 "(c) 1999-2003, Matthew Chapman"));
45 aboutData.addAuthor(ki18n("Urs Wolfer"), ki18n("Developer, Maintainer"), "uwolfer@kde.org");
46 aboutData.addAuthor(ki18n("Tim Jansen"), ki18n("Former Developer"), "tim@tjansen.de");
47 aboutData.addAuthor(ki18n("Arend van Beelen jr."), ki18n("Initial RDP backend"), "arend@auton.nl");
48 aboutData.addCredit(ki18n("Brad Hards"), ki18n("Google Summer of Code 2007 KRDC project mentor"),
49 "bradh@frogmouth.net");
50 aboutData.addCredit(ki18n("LibVNCServer / LibVNCClient developers"), ki18n("VNC client library"),
51 "libvncserver-common@lists.sf.net");
53 KCmdLineArgs::init(argc, argv, &aboutData);
55 KCmdLineOptions options;
56 options.add("fullscreen", ki18n("Start KRDC with the provided URL in fullscreen mode (works only with one URL)"));
57 options.add("!+[URL]", ki18n("URLs to connect after startup"));
59 KCmdLineArgs::addCmdLineOptions(options);
61 KApplication app;
63 MainWindow *mainwindow = new MainWindow;
64 mainwindow->show();
66 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
68 if (args->count() > 0) {
69 for (int i = 0; i < args->count(); i++) {
70 KUrl u(args->url(i));
72 if (u.scheme().isEmpty() || u.host().isEmpty()) { // unusable url; try to recover it...
73 QString arg(args->url(i).url());
75 kDebug(5010) << "unusable url; try to recover it:" << arg;
77 if (arg.lastIndexOf('/') != 0)
78 arg = arg.right(arg.length() - arg.lastIndexOf('/') - 1);
80 if (!arg.contains("://"))
81 arg.prepend("vnc://"); // vnc was default in kde3 times...
83 kDebug(5010) << "recovered url:" << arg;
85 u = arg;
88 if (!u.isValid())
89 continue;
91 mainwindow->newConnection(u, ((args->isSet("fullscreen")) && (args->count() == 1)));
95 return app.exec();