summaryrefslogtreecommitdiffstats
path: root/kbabel/kbabel/main.cpp
blob: ee8e02a190a7cf726443013e1828f0567ab2aedd (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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
/* ****************************************************************************
  This file is part of KBabel

  Copyright (C) 1999-2001 by Matthias Kiefer <matthias.kiefer@gmx.de>
		2002-2005 by Stanislav Visnovsky <visnovsky@kde.org>
  Copyright (C) 2006 by Nicolas GOUTTE <goutte@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.

  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.

  In addition, as a special exception, the copyright holders give
  permission to link the code of this program with any edition of
  the TQt library by Trolltech AS, Norway (or with modified versions
  of TQt that use the same license as TQt), and distribute linked
  combinations including the two.  You must obey the GNU General
  Public License in all respects for all of the code used other than
  TQt. If you modify this file, you may extend this exception to
  your version of the file, but you are not obligated to do so.  If
  you do not wish to do so, delete this exception statement from
  your version.

**************************************************************************** */
#include "kbabel.h"
#include "kbabeliface.h"
#include "kbprojectmanager.h"
#include "catalog.h"
#include "kbabelsplash.h"
#include "findoptions.h"

#include "version.h"

#include <dcopclient.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <kcursor.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kuniqueapplication.h>
#include <twin.h>

#include <tqfile.h>
#include <tqfileinfo.h>
#include <tqtimer.h>

class KBabelInterface : public KBabelIface
{
public:
    KBabelInterface();

    virtual void openURL(TQCString url, TQCString package, WId window, int newWindow);
    virtual void openURL(TQCString url, TQCString package, WId window, int newWindow, TQCString projectFile);
    virtual void openTemplate(TQCString openFilename, TQCString saveFilename, TQCString package, int newWindow );
    virtual void openTemplate(TQCString openFilename, TQCString saveFilename, TQCString package, int newWindow, TQCString projectFile );
    virtual void gotoFileEntry(TQCString url, TQCString msgid);
    virtual void gotoFileEntry(TQCString url, TQCString package, int msgid);
    virtual void gotoFileEntry(TQCString url, TQCString package, int msgid, TQCString projectFile);
    virtual bool findInFile(TQCString fileSource, TQCString url,
	TQString findStr, int caseSensitive, int wholeWords, int isRegExp,
	int inMsgid, int inMsgstr, int inComment,
	int ignoreAccelMarker, int ignoreContextInfo, int askForNextFile, int askForSave);
    virtual bool replaceInFile(TQCString fileSource, TQCString url,
	TQString findStr, TQString replaceStr, int caseSensitive, int wholeWords, int isRegExp,
	int inMsgid, int inMsgstr, int inComment,
	int ignoreAccelMarker, int ignoreContextInfo, int ask, int askForNextFile, int askForSave);
    virtual bool findInFile(TQCString fileSource, TQCString url,
	TQString findStr, int caseSensitive, int wholeWords, int isRegExp,
	int inMsgid, int inMsgstr, int inComment,
	int ignoreAccelMarker, int ignoreContextInfo, int askForNextFile, int askForSave, TQCString project );
    virtual bool replaceInFile(TQCString fileSource, TQCString url,
	TQString findStr, TQString replaceStr, int caseSensitive, int wholeWords, int isRegExp,
	int inMsgid, int inMsgstr, int inComment,
	int ignoreAccelMarker, int ignoreContextInfo, int ask, int askForNextFile, int askForSave, TQCString project );
    virtual void spellcheck(TQStringList fileList);
private:
    KBabelMW* findInstance( const KURL& url, const TQString& project, const TQString& package) const;
};


class KBabelApp : public KUniqueApplication
{
public:
    KBabelApp();
    virtual ~KBabelApp();

    virtual int newInstance();

private:
    KBabelInterface *kbInterface;
};

KBabelApp::KBabelApp()
    : KUniqueApplication()
{
    kbInterface = new KBabelInterface;
}

KBabelApp::~KBabelApp()
{
    delete kbInterface;
}

int KBabelApp::newInstance()
{
    bool first=true;
    if(KBabelMW::memberList && !KBabelMW::memberList->isEmpty())
    {
        first=false;
    }

    // see if we are starting with session management
#if KDE_IS_VERSION(3,3,0)
    if (!restoringSession())
#else
    if (!isRestored() || !first)
#endif
    {
	kdDebug () << "Suspending DCOP" << endl;
	kapp->dcopClient()->suspend();

        TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();

        TQTimer timer;
        TQWidget *splash=0;
        bool showSplash=args->isSet("splash");

        if( showSplash && first )
        {
            setOverrideCursor(KCursor::waitCursor());
            splash = new KBabelSplash();
	    splash->show();
            timer.start(4000,true);
        }

        TQString projectFile=args->getOption("project");
	if( !projectFile.isEmpty() )
	{
	    TQFileInfo fi(projectFile);
	    projectFile = fi.absFilePath();
	} 
	else
	{
	    projectFile = KBabel::ProjectManager::defaultProjectName();
	    kdDebug(KBABEL) << "Using the default project Project: " << projectFile << endl;
	}

	kdDebug() << "Project: " << projectFile << endl;
	TQCString msgid=args->getOption("gotomsgid");
        if(!msgid.isEmpty() && args->count() > 0)
        {
            kdDebug(KBABEL) << "gotomsgid" << endl;
            TQString m = TQString::fromLocal8Bit(msgid);

	    kdDebug () << "Resuming DCOP" << endl;
	    kapp->dcopClient()->resume();
            kbInterface->gotoFileEntry(args->url(0).url().local8Bit(),m.utf8());
        }
        else
        {
            // no session.. just start up normally
    	    KBabelMW *widget=0;
            if(args->count() > 0)
            {
                KURL u = args->url(0);
                widget=KBabelMW::winForURL(u,projectFile);
            }

            if(!widget)
                widget=KBabelMW::emptyWin(projectFile);

            if(!widget)
                widget=new KBabelMW(projectFile);

            while(timer.isActive()) // let the user admire the splash screen ;-)
                processEvents();

            widget->show();
            for (int i=0; i < args->count(); i++)
            {
               widget->open( args->url(i) , TQString(), i != 0 );
            }

	    kdDebug () << "Resuming DCOP" << endl;
	    kapp->dcopClient()->resume();
        }


        args->clear();

        if(splash)
        {
	    delete KBabelSplash::instance;
        }
        if(showSplash)
        {
            TDEApplication::restoreOverrideCursor();
            /*
            KMessageBox::information(0,
                    "This is a development version of KBabel!\n"
                    "Please double check the files you edit "
                    "and save with this version for correctness.\n"
                    "Please report any bug you find to kiefer@kde.org.\n"
                    "Thanks.", "Warning");
            */
        }
    }

    return 0;
}

KBabelInterface::KBabelInterface()
    : DCOPObject("KBabelIFace")
{
}

void KBabelInterface::openURL(TQCString url, TQCString package, WId window, int newWindow)
{
    openURL(url,package,window,newWindow,  KBabel::ProjectManager::defaultProjectName().local8Bit());
}

void KBabelInterface::openURL(TQCString url, TQCString package, WId window, int newWindow, TQCString projectFile)
{
    const TQString project( TQString::fromLocal8Bit( projectFile ) );

    kdDebug() << "openURL " << url << endl;

    KURL u(TQString::fromLocal8Bit(url));

    kdDebug () << "Suspending DCOP" << endl;
    kapp->dcopClient()->suspend();

    KBabelMW *kb = KBabelMW::winForURL(u,project);
    if(kb)
    {
        KWin::activateWindow(kb->topLevelWidget()->winId());
    }
    else
    {
        TDEMainWindow *mw = 0;
        if(TDEMainWindow::memberList && !TDEMainWindow::memberList->isEmpty())
            mw=TDEMainWindow::memberList->first();

	// first, try to lookup correct winid
        while( mw ) {
	    if( mw->inherits("KBabelMW") && mw->winId() == window)
    	    {
        	kb = static_cast<KBabelMW*>(mw);
        	KWin::activateWindow(kb->topLevelWidget()->winId());
        	kb->open(u, TQString::fromUtf8(package),newWindow);

		kdDebug () << "Resuming DCOP" << endl;
		kapp->dcopClient()->resume();

		return ;
	    }
	    mw = TDEMainWindow::memberList->next();
        }

	// now, the empty window
	kb = KBabelMW::emptyWin(projectFile);
	if (kb)
	{
	    // here, we don't care about "open in new window", because
	    // it's empty
    	    KWin::setActiveWindow(kb->topLevelWidget()->winId());
	    kb->projectOpen(projectFile);
    	    kb->open(u,TQString::fromUtf8(package),false);

	    kdDebug () << "Resuming DCOP" << endl;
	    kapp->dcopClient()->resume();

	    return;
	}

        if(TDEMainWindow::memberList && !TDEMainWindow::memberList->isEmpty())
            mw=TDEMainWindow::memberList->first();

        while( mw ) {
	    if( mw->inherits("KBabelMW") && static_cast<KBabelMW*>(mw)->project()==project)
    	    {
        	kb = static_cast<KBabelMW*>(mw);
        	KWin::activateWindow(kb->topLevelWidget()->winId());
        	kb->open(u, TQString::fromUtf8(package),newWindow);

		kdDebug () << "Resuming DCOP" << endl;
		kapp->dcopClient()->resume();

		return ;
	    }
	    mw = TDEMainWindow::memberList->next();
        }

        if( !mw )
	{
	    kb = new KBabelMW(project);
    	    kb->show();
	} else kb = static_cast<KBabelMW*>(mw);
        KWin::activateWindow(kb->topLevelWidget()->winId());
        kb->open(u,TQString::fromUtf8(package),newWindow);
    }
    
    kdDebug () << "Resuming DCOP" << endl;
    kapp->dcopClient()->resume();
}

void KBabelInterface::openTemplate(TQCString openFilename, TQCString saveFilename, TQCString package, int newWindow)
{
    openTemplate(openFilename, saveFilename, package, newWindow, KBabel::ProjectManager::defaultProjectName().local8Bit());
}

void KBabelInterface::openTemplate(TQCString openFilename, TQCString saveFilename, TQCString package, int newWindow, TQCString projectFile)
{
    const TQString project( TQString::fromLocal8Bit( projectFile ) );

    const KURL u( TQString::fromLocal8Bit( saveFilename ) );
    const KURL t( TQString::fromLocal8Bit( openFilename ) );

    kdDebug () << "Suspending DCOP" << endl;
    kapp->dcopClient()->suspend();

    KBabelMW *kb = KBabelMW::winForURL(u, project);
    if(kb)
    {
        KWin::activateWindow(kb->topLevelWidget()->winId());
    }
    else
    {
        TDEMainWindow *mw = 0;
        if(TDEMainWindow::memberList && !TDEMainWindow::memberList->isEmpty())
            mw=TDEMainWindow::memberList->first();

        if(mw && mw->inherits("KBabelMW") && static_cast<KBabelMW*>(mw)->project()==project)
        {
            kb = static_cast<KBabelMW*>(mw);
            KWin::activateWindow(kb->topLevelWidget()->winId());
	    kb->projectOpen(projectFile);
            kb->openTemplate(t,u,TQString::fromUtf8(package),newWindow);
        }
        else
        {
            kb = new KBabelMW(project);
            kb->show();
            KWin::activateWindow(kb->topLevelWidget()->winId());
            kb->openTemplate(t,u,TQString::fromUtf8(package));
        }
    }

    kdDebug () << "Resuming DCOP" << endl;
    kapp->dcopClient()->resume();
}

void KBabelInterface::gotoFileEntry(TQCString url, TQCString m)
{
    const KURL u( TQString::fromLocal8Bit( url ) );
    KBabelMW *kb = findInstance( u, KBabel::ProjectManager::defaultProjectName(), TQString() );

    if(!kb) return;

    TQString msgid = TQString::fromUtf8(m);
    int index = kb->m_view->catalog()->indexForMsgid(msgid);
    if(index >= 0)
    {
	KBabel::DocPosition pos;
	pos.item=index;
	pos.form=0;
        kb->m_view->gotoEntry(pos);
    }
}

void KBabelInterface::gotoFileEntry(TQCString url, TQCString package, int m)
{
    gotoFileEntry(url, package, m, KBabel::ProjectManager::defaultProjectName().local8Bit() );
}

void KBabelInterface::gotoFileEntry(TQCString url, TQCString package, int m, TQCString projectFile)
{
    const KURL u ( TQString::fromLocal8Bit( url ) );
    const TQString p ( TQString::fromUtf8( package ) ); // ### VERIFY encoding!
    KBabelMW *kb = findInstance( u, projectFile, p );

    if(!kb) return;

    KBabel::DocPosition pos;
    pos.item=m;
    pos.form=0;
    kb->m_view->gotoEntry(pos);
}

bool KBabelInterface::findInFile(TQCString fileSource, TQCString url,
	TQString findStr, int caseSensitive, int wholeWords, int isRegExp,
	int inMsgid, int inMsgstr, int inComment,
	int ignoreAccelMarker, int ignoreContextInfo, int askForNextFile, int askForSave)
{
	// no project given, open with default project
	return findInFile ( fileSource, url, findStr, caseSensitive, 
                             wholeWords, isRegExp, inMsgid, inMsgstr, inComment, ignoreAccelMarker, ignoreContextInfo,
                             askForNextFile, askForSave,
			     KBabel::ProjectManager::defaultProjectName().utf8() );
}

bool KBabelInterface::findInFile(TQCString fileSource, TQCString url,
	TQString findStr, int caseSensitive, int wholeWords, int isRegExp,
	int inMsgid, int inMsgstr, int inComment,
	int ignoreAccelMarker, int ignoreContextInfo, int askForNextFile, int askForSave, TQCString project )
{
    kdDebug(KBABEL) << "findInFile (" <<fileSource<< "): " << url << " for " << findStr << endl;

    const KURL u( TQString::fromLocal8Bit( url ) );
    KBabelMW *kb = findInstance( u, TQString::fromLocal8Bit(project), TQString() );

    if(!kb) return false;

    KBabel::FindOptions options;
    options.findStr = findStr;
    options.caseSensitive = (caseSensitive>0);
    options.fromCursor = false;
    options.backwards = false;
    options.wholeWords = (wholeWords>0);
    options.isRegExp = (isRegExp>0);
    options.inMsgid = (inMsgid>0);
    options.inMsgstr = (inMsgstr>0);
    options.inComment = (inComment>0);
    options.ignoreAccelMarker = (ignoreAccelMarker>0);
    options.ignoreContextInfo = (ignoreContextInfo>0);
    options.askForNextFile = (askForNextFile>0);
    options.askForSave = (askForSave>0);
    kb->m_view->findInFile(fileSource, options);

    return true;
}

bool KBabelInterface::replaceInFile(TQCString fileSource, TQCString url,
	TQString findStr, TQString replaceStr, int caseSensitive, int wholeWords, int isRegExp,
	int inMsgid, int inMsgstr, int inComment,
	int ignoreAccelMarker, int ignoreContextInfo, int ask, int askForNextFile, int askForSave)
{
	return replaceInFile( fileSource, url,
                               findStr, replaceStr, caseSensitive, wholeWords, isRegExp,
                               inMsgid, inMsgstr, inComment, ignoreAccelMarker, ignoreContextInfo,
                               ask, askForNextFile, askForSave,
			       KBabel::ProjectManager::defaultProjectName().utf8() );	
}

bool KBabelInterface::replaceInFile(TQCString fileSource, TQCString url,
	TQString findStr, TQString replaceStr, int caseSensitive, int wholeWords, int isRegExp,
	int inMsgid, int inMsgstr, int inComment,
	int ignoreAccelMarker, int ignoreContextInfo, int ask, int askForNextFile, int askForSave,
        TQCString project )
{
    kdDebug(KBABEL) << "replaceInFile (" <<fileSource<< "): " << url << " for " << findStr << endl;

    const KURL u ( TQString::fromLocal8Bit( url ) );
    KBabelMW *kb = findInstance( u, TQString::fromLocal8Bit(project), TQString() );

    if( !kb ) return false;

    KBabel::ReplaceOptions options;
    options.findStr = findStr;
    options.replaceStr = replaceStr;
    options.caseSensitive = (caseSensitive>0);
    options.fromCursor = false;
    options.backwards = false;
    options.wholeWords = (wholeWords>0);
    options.isRegExp = (isRegExp>0);
    options.inMsgid = (inMsgid>0);
    options.inMsgstr = (inMsgstr>0);
    options.inComment = (inComment>0);
    options.ignoreAccelMarker = (ignoreAccelMarker>0);
    options.ignoreContextInfo = (ignoreContextInfo>0);
    options.ask = (ask>0);
    options.askForNextFile = (askForNextFile>0);
    options.askForSave = (askForSave>0);
    kb->m_view->replaceInFile(fileSource, options);

    return true;
}

void KBabelInterface::spellcheck(TQStringList fileList)
{
    // ### FIXME: the default project might use the wrong language!
    KBabelMW *kb = findInstance( KURL(), KBabel::ProjectManager::defaultProjectName(), TQString() );
    kb->show();
    kb->spellcheckMoreFiles( fileList );
}

KBabelMW* KBabelInterface::findInstance( const KURL& url, const TQString& project, const TQString& package) const
{
    kdDebug () << "Suspending DCOP" << endl;
    kapp->dcopClient()->suspend();

    KBabelMW *kb = 0;
    if( !url.isEmpty() )
    {
	kb = KBabelMW::winForURL( url, project );

	if(kb)
	{
    	    KWin::activateWindow(kb->topLevelWidget()->winId());
	}
    }

    if( !kb )
    {
	kb = KBabelMW::emptyWin(project);
	if( !kb ) 
	{
	    kb = new KBabelMW(project);
	}
	else
	{
	    kb->projectOpen(project);
	}

        kb->show();
        if ( !url.isEmpty() )
            kb->open( url, package, false );
    }

    kdDebug () << "Resuming DCOP" << endl;
    kapp->dcopClient()->resume();

    return kb;
}

static TDECmdLineOptions options[] =
{
   {"gotomsgid <msgid>",I18N_NOOP("Go to entry with msgid <msgid>"),0},
   {"nosplash",I18N_NOOP("Disable splashscreen at startup"),0},
   {"project <configfile>",I18N_NOOP("File to load configuration from"),0},
   {"+[file]",I18N_NOOP("Files to open"),0},
   TDECmdLineLastOption
};


int main(int argc, char **argv)
{
    TDEAboutData about("kbabel",I18N_NOOP("KBabel"),VERSION,
       I18N_NOOP("An advanced PO file editor"),TDEAboutData::License_GPL,
       I18N_NOOP("(c) 1999,2000,2001,2002,2003,2004,2005,2006 The KBabel developers"),0,"http://kbabel.kde.org");

    about.addAuthor("Matthias Kiefer",I18N_NOOP("Original author"),"kiefer@kde.org");
    about.addAuthor("Wolfram Diestel"
         ,I18N_NOOP("Wrote diff algorithm, fixed KSpell and gave a lot "
         "of useful hints."),"wolfram@steloj.de");
    about.addAuthor("Andrea Rizzi",I18N_NOOP("Wrote the dictionary plugin "
		"for searching in a database and some other code.")
            ,"rizzi@kde.org");
    about.addAuthor("Stanislav Visnovsky",I18N_NOOP("Current maintainer, porting to KDE3/Qt3.")
	,"visnovsky@kde.org");
    about.addAuthor("Marco Wegner",I18N_NOOP("Bug fixes, KFilePlugin for PO files, CVS support, mailing files")
         ,"dubbleu@web.de");
    about.addAuthor("Asgeir Frimannsson",I18N_NOOP("Translation List View")
         ,"asgeirf@redhat.com");
    about.addAuthor("Nicolas Goutte", I18N_NOOP("Current maintainer"), "goutte@kde.org");

    about.addCredit("Claudiu Costin",I18N_NOOP("Wrote documentation and sent "
		"many bug reports and suggestions for improvements.")
         ,"claudiuc@geocities.com");
    about.addCredit("Thomas Diehl",I18N_NOOP("Gave many suggestions for the GUI "
         "and the behavior of KBabel. He also contributed the beautiful splash screen.")
            ,"thd@kde.org");
    about.addCredit("Stephan Kulow",I18N_NOOP("Helped keep KBabel up to date "
		"with the KDE API and gave a lot of other help."),"coolo@kde.org");
    about.addCredit("Stefan Asserhall",I18N_NOOP("Implemented XML validation/highlighting "
	 "plus other small fixes.") ,"stefan.asserhall@telia.com");
    about.addCredit("Dwayne Bailey",I18N_NOOP("Various validation plugins.")
	 ,"dwayne@translate.org.za");
	about.addCredit("SuSE GmbH"
					,I18N_NOOP("Sponsored development of KBabel for a while.")
					,"suse@suse.de","http://www.suse.de");
    about.addCredit("Trolltech", I18N_NOOP("KBabel contains code from TQt"), 0, "http://www.trolltech.com");

    about.addCredit("Eva Brucherseifer", I18N_NOOP("String distance algorithm implementation"), "eva@kde.org");

    about.addCredit("Albert Cervera Areny", I18N_NOOP("Error list for current entry, regexp data tool"), "albertca@hotpop.com");

    about.addCredit("Nick Shaforostoff", I18N_NOOP("Word-by-word string difference algorithm implementation"), "shafff@ukr.net");

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

    // Tell which options are supported
    TDECmdLineArgs::addCmdLineOptions( options );

    // Add options from other components
    KUniqueApplication::addCmdLineOptions();


    if(!KUniqueApplication::start())
    {
        return 0;
    }

    KBabelApp app;

    if( app.isRestored() )
    {
	RESTORE(KBabelMW)
    }

    return app.exec();
}