summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
blob: bfa6cc5e98f1db9397f786ccb3bd061e31a7aae6 (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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/***************************************************************************
*   Copyright (C) 2004 by Christoph Thielecke                             *
*   [email protected]                                                       *
*                                                                         *
*   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.                          *
*                                                                         *
*   You should have received a copy of the GNU General Public License     *
*   along with this program; if not, write to the                         *
*   Free Software Foundation, Inc.,                                       *
*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
***************************************************************************/

// KDE includes
#include <tdecmdlineargs.h>
#include <tdeaboutdata.h>
#include <tdemessagebox.h>
#include <tdemainwindow.h>
#include <kapp.h>

#include <tdelocale.h>
#include <dcopclient.h>
#include <tqstring.h>

// App includes
#include "kvpnc.h"
static const char *description =
    I18N_NOOP ( "TDE frontend for various vpn clients\nCurrently supported protocols:\n* Cisco (vpnc (free), vpnclient (propritary))\n* IPSec (FreeS/WAN, Openswan, strongSwan, racoon)\n* PPTP\n* OpenVPN\n* L2TP (l2tpd, xl2tpd, openl2tp) over IPSec (racoon, FreeS/WAN, Openswan, strongSwan)\n* Vtun\n* SSH" );
// TQDate().fromString(, TQt::LocalDate ).toString( "yyyyMMdd" )
TQString date ( __DATE__ );
TQString day= date.section ( ' ',0,0 );
TQString month= TQString().setNum ( TQDate::fromString ( date.section ( ' ',0,0 ),TQt::ISODate ).month() );
TQString year= date.section ( ' ',2,2 );

TQString currentdate ( "+SVN(" + date+" "+ TQTime().fromString ( TQString ( __TIME__ ) ).toString ( "hhmm" ) + ")" );


#define __is_release__

TQString versionstring1 = "0.9.6";

#ifdef __is_release__
static const char *KVPNCVERSION = versionstring1.ascii();
TQString versionstring =TQString ( KVPNCVERSION );
#else
TQString versionstring = versionstring1 + TQString (" TDE ") + currentdate;
static const char *KVPNCVERSION  = versionstring.ascii() ;
#endif


static TDECmdLineOptions options[] =
{
	// INSERT YOUR COMMANDLINE OPTIONS HERE
	{ "openvpnimport <file>", I18N_NOOP ( "Import OpenVPN config file" ), 0 },
	{ "ciscoimport <file>", I18N_NOOP ( "Import Cisco PCF file" ), 0 },
	{ ":", I18N_NOOP ( "Extra options:" ), 0 },
	TDECmdLineLastOption // End of options.
};

int main ( int argc, char *argv[] )
{
	TDEAboutData aboutData ( "kvpnc", I18N_NOOP ( "KVpnc" ),
	                       KVPNCVERSION, description, TDEAboutData::License_GPL_V2,
	                       I18N_NOOP ( "(C) 2005, the KVpnc team" ), 0,
	                       "http://home.gna.org/kvpnc/", "[email protected]" );

	aboutData.addAuthor ( "Christoph Thielecke", I18N_NOOP ( "Developer and maintainer" ), "[email protected]", "http://crissi.linux-administrator.com/" );

	aboutData.setVersion (versionstring.ascii());
	aboutData.setShortDescription (description );

	aboutData.addCredit ( "KDE Team" , I18N_NOOP ( "KDE" ), "", "http://www.kde.org/" );
	aboutData.addCredit ( "KDevelop Team" , I18N_NOOP ( "KDevelop" ), "", "http://www.kdevelop.org/" );
	aboutData.addCredit ( "Maurice Massar" , I18N_NOOP ( "Vpnc" ), "[email protected]", "http://www.unix-ag.uni-kl.de/~massar/vpnc/" );
	aboutData.addCredit ( "Witek Strzelczyk", I18N_NOOP ( "Polish translation" ), "[email protected]" );
	aboutData.addCredit ( "Tomas Olah" , I18N_NOOP ( "Slovak translation" ), "[email protected]" );
	aboutData.addCredit ( "Lapo Luchini" , I18N_NOOP ( "Italian translation" ), "[email protected]" );
	aboutData.addCredit ( "Karoly Barcza", I18N_NOOP ( "Hungary translation" ), "[email protected]" );
	aboutData.addCredit ( "Luk De Ketelaere" , I18N_NOOP ( "Dutch translation" ), "[email protected]" );
	aboutData.addCredit ( "Jorgen Kessler" , I18N_NOOP ( "Dutch translation" ), "[email protected]" );
	aboutData.addCredit ( "Atanas M." , I18N_NOOP ( "Bulgarian translation" ), "[email protected]" );
	aboutData.addCredit ( "Juanjo Avarez Martinez" , I18N_NOOP ( "Spanish translation" ), "[email protected]" );
	aboutData.addCredit ( "He Shi Jun" , I18N_NOOP ( "Chinese translation" ), "[email protected]" );
	aboutData.addCredit ( "Marius Pacha" , I18N_NOOP ( "Chinese translation" ), "[email protected]" );
	aboutData.addCredit ( "Valeriy Girchenko" , I18N_NOOP ( "Russian translation" ), "[email protected]" );
	aboutData.addCredit ( "Ahinu" , I18N_NOOP ( "French translation" ), "[email protected]" );
	aboutData.addCredit ( "Florian Fainelli" , I18N_NOOP ( "French translation" ), "[email protected]" );
	aboutData.addCredit ( "Damien Raude-Morvan" , I18N_NOOP ( "French translation" ), "[email protected]" );
	aboutData.addCredit ( "Daniel Nylander" , I18N_NOOP ( "Swedish translation" ), "[email protected]" );
	aboutData.addCredit ( "Yukiko Bando" , I18N_NOOP ( "Japanese translation" ), "[email protected]" );
	aboutData.addCredit ( "Marc Serra Romero" , I18N_NOOP ( "Catalan translation" ), "[email protected]" );
	aboutData.addCredit ( "Buelent SENER" , I18N_NOOP ( "Turkish  translation" ), "[email protected]" );
	aboutData.addCredit ( "Laurent Montel", I18N_NOOP ( "Patches" ), "[email protected]" );
	aboutData.addCredit ( "Peter Kussmann" , I18N_NOOP ( "PPTP-Test environment, OpenVPN testing, new ideas" ), "[email protected]" );
	aboutData.addCredit ( "Ansgar Jazdzewski" , I18N_NOOP ( "OpenVPN-Test environment, OpenVPN testing, new ideas" ), "[email protected]" );
	aboutData.addCredit ( "D. Klinkenberg" , I18N_NOOP ( "Testing PPTP, usebility hints & tests, bug hunting" ), "[email protected]" );
	aboutData.addCredit ( "Lenon Kitchens" , I18N_NOOP ( "Testing OpenSWAN, bug hunting" ), "[email protected]" );
	aboutData.addCredit ( "Fathi Boudra" , I18N_NOOP ( "Testing OpenVPN, bug hunting" ), "[email protected]" );
	aboutData.addCredit ( "HAL9000" , I18N_NOOP ( "Cisco password decoder" ), "[email protected]" );
	aboutData.addCredit ( "Marcin Prejsnar" , I18N_NOOP ( "Testing OpenVPN auth+cert, bug hunting" ), "[email protected]" );
	aboutData.addCredit ( "Elias Probst" , I18N_NOOP ( "Icon artwork, bug hunting" )," [email protected]" );
	aboutData.addCredit ( "Andreas Diestelmann" , I18N_NOOP ( "Support KVpnc development with 15EUR" ),"[email protected]" );
	aboutData.addCredit ( "Frank Visconti" , I18N_NOOP ( "Support KVpnc development with 30$" ),"[email protected]" );
	aboutData.addCredit ( "Christoph Schmid" , I18N_NOOP ( "Support KVpnc development with 30EUR" ),"[email protected]" );
	aboutData.addCredit ( "Attila Ruzsinszky" , I18N_NOOP ( "Cisco testbed, bug hunting" ), "[email protected]" );
	aboutData.addCredit ( "Christiansen" , I18N_NOOP ( "Danish translation" ), "[email protected]" );

	// Initialize command line args
	TDECmdLineArgs::init ( argc, argv, &aboutData);

	// Add options from other components
	TDEApplication::addCmdLineOptions();
	TDECmdLineArgs::addCmdLineOptions ( options );

	TDEApplication a;
	KVpnc *kvpnc =  new KVpnc ( &a );

	DCOPClient* dcop = a.dcopClient();
	dcop->attach();
	dcop->registerAs ( "kvpnc" );
	dcop->setNotifications ( true );

	// Broken on request from Eric M.
	if ( a.isSessionRestored() )
	{
		kvpnc->restore();
	}
	else
	{
// 		if (getenv("USER") != TQString("root"))
// 		{
// 			KMessageBox::error( 0, I18N_NOOP( "Kvpnc must be started as root!" ) );
// 			exit(0);
// 		}

		TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();

		a.setMainWidget ( kvpnc );

		if ( args->isSet ( "openvpnimport" ) )
		{
			TQString openvpnimportfile = TQString ( args->getOption ( "openvpnimport" ) );
			kvpnc->importOpenvpnProfileClicked ( openvpnimportfile );
		}
		else if ( args->isSet ( "ciscoimport" ) )
		{
			TQString ciscoimportfile = TQString ( args->getOption ( "ciscoimport" ) );
			kvpnc->importOpenvpnProfileClicked ( ciscoimportfile );
		}

	}
	int ret = a.exec();
	return ret;
}