summaryrefslogtreecommitdiffstats
path: root/ark/main.cpp
blob: 3fd5e1ebf64b0bd5edd1b78bc71e93286a6df8e2 (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
/*

ark: A program for modifying archives via a GUI.

Copyright (C)
2002-2003: Helio Chissini de Castro <helio@conectiva.com.br>
2003: Georg Robbers <Georg.Robbers@urz.uni-hd.de>
2001: Roberto Selbach Teixeira <maragato@kde.org>
1999-2000: Corel Corporation (author: Emily Ezust  emilye@corel.com)
1999 Francois-Xavier Duranceau <duranceau@kde.org>
1997-1999 Robert Palmbos <palm9744@kettering.edu>

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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

*/

//
// Note: This is a TDEUniqueApplication.
// To debug add --nofork to the command line.
// Be aware that newInstance() will not be called in this case, but you
// can run ark from a console, and that will invoke it in the debugger.
//

// C includes
#include <stdlib.h>

// KDE includes
#include <kdebug.h>
#include <dcopclient.h>
#include <tdecmdlineargs.h>
#include <tdeaboutdata.h>
#include <tdelibs_export.h>
// ark includes
#include "arkapp.h"

static TDECmdLineOptions option[] =
{
    { "extract", I18N_NOOP( "Open extract dialog, quit when finished" ), 0 },
    { "extract-to", I18N_NOOP( "Extract 'archive' to 'folder'. Quit when finished.\n"
                               "'folder' will be created if it does not exist."), 0 },
    { "add", I18N_NOOP( "Ask for the name of the archive to add 'files' to. Quit when finished." ), 0 },
    { "add-to", I18N_NOOP( "Add 'files' to 'archive'. Quit when finished.\n'archive' "
                           "will be created if it does not exist." ), 0 },
    { "guess-name", I18N_NOOP( "Used with '--extract-to'. When specified, 'archive'\n"
                               "will be extracted to a subfolder of 'folder'\n"
                               "whose name will be the name of 'archive' without the filename extension."), 0 },
    { "+[folder]", I18N_NOOP( "Folder to extract to" ), 0 },
    { "+[files]", I18N_NOOP( "Files to be added" ), 0 },
    { "+[archive]", I18N_NOOP( "Open 'archive'" ), 0 },
    TDECmdLineLastOption
};

extern "C" TDE_EXPORT int kdemain( int argc, char *argv[]  )
{
	TDEAboutData aboutData( "ark", I18N_NOOP( "Ark" ),
	                      "2.6.4", I18N_NOOP( "TDE Archiving tool" ),
	                      TDEAboutData::License_GPL,
	                      I18N_NOOP( "(c) 1997-2006, The Various Ark Developers" )
	                    );

	aboutData.addAuthor( "Henrique Pinto",
	                     I18N_NOOP( "Maintainer" ),
	                     "henrique.pinto@kdemail.net" );
	aboutData.addAuthor( "Charis Kouzinopoulos",
	                     0,
	                     "kouzinopoulos@gmail.com" );
	aboutData.addAuthor( "Helio Chissini de Castro",
	                     I18N_NOOP( "Former maintainer" ),
	                     "helio@kde.org" );
	aboutData.addAuthor( "Georg Robbers",
	                     0,
	                     "Georg.Robbers@urz.uni-hd.de" );
	aboutData.addAuthor( "Roberto Selbach Teixeira",
	                     0,
	                     "maragato@kde.org" );
	aboutData.addAuthor( "Francois-Xavier Duranceau",
	                     0,
	                     "duranceau@kde.org" );
	aboutData.addAuthor( "Emily Ezust (Corel Corporation)",
	                     0,
	                     "emilye@corel.com" );
	aboutData.addAuthor( "Michael Jarrett (Corel Corporation)",
	                     0,
	                     "michaelj@corel.com" );
	aboutData.addAuthor( "Robert Palmbos",
	                     0,
	                     "palm9744@kettering.edu" );

	aboutData.addCredit( "Bryce Corkins",
	                     I18N_NOOP( "Icons" ),
	                     "dbryce@attglobal.net" );
	aboutData.addCredit( "Liam Smit",
	                     I18N_NOOP( "Ideas, help with the icons" ),
	                     "smitty@absamail.co.za" );

	TDECmdLineArgs::init( argc, argv, &aboutData );
	TDECmdLineArgs::addCmdLineOptions( option );
	TDECmdLineArgs::addTempFileOption();

	if ( !ArkApplication::start() )
	{
		// Already running!
		kdDebug( 1601 ) << "Already running" << endl;
		exit( 0 );
	}

	if ( ArkApplication::getInstance()->isRestored() )
	{
		kdDebug( 1601 ) << "In main: Restore..." << endl;
		RESTORE( MainWindow );
	}

	return ArkApplication::getInstance()->exec();
}