kexi

main.cpp

00001 /* This file is part of the KDE project
00002     
00003     begin                : Sun Jun  9 12:15:11 CEST 2002
00004     copyright            : (C) 2003 by lucijan busch, Joseph Wenninger
00005     email                : lucijan@gmx.at, jowenn@kde.org
00006    
00007    Copyright (C) 2003-2005 Jaroslaw Staniek <js@iidea.pl>
00008 
00009    This program is free software; you can redistribute it and/or
00010    modify it under the terms of the GNU Library General Public
00011    License as published by the Free Software Foundation; either
00012    version 2 of the License, or (at your option) any later version.
00013 
00014    This program is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017    Library General Public License for more details.
00018 
00019    You should have received a copy of the GNU Library General Public License
00020    along with this library; see the file COPYING.LIB.  If not, write to
00021    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00022  * Boston, MA 02110-1301, USA.
00023 */
00024 
00025 #include <kapplication.h>
00026 #include <dcopclient.h>
00027 #include <klocale.h>
00028 #include <kdebug.h>
00029 #include <kmessagebox.h>
00030 #include <kmimetype.h>
00031 #include <kiconloader.h>
00032 #include <kstandarddirs.h>
00033 
00034 #include "core/kexiproject.h"
00035 #include "core/kexidialogbase.h"
00036 #include "core/kexi.h"
00037 #include "main/keximainwindowimpl.h"
00038 #include "main/startup/KexiStartup.h"
00039 
00040 extern "C" int kdemain(int argc, char *argv[])
00041 {
00042     Kexi::initCmdLineArgs( argc, argv );
00043 
00044     bool GUIenabled = true;
00045     QWidget *dummyWidget = 0; //needed to have icon for dialogs before KexiMainWindowImpl is created
00047     KApplication app(true, GUIenabled);
00048 #ifdef KEXI_STANDALONE
00049     KGlobal::locale()->removeCatalogue("kexi");
00050     KGlobal::locale()->insertCatalogue("standalone_kexi");
00051 #endif
00052     KGlobal::locale()->insertCatalogue("koffice");
00053     KGlobal::locale()->insertCatalogue("koproperty");
00054 
00055     if (GUIenabled) {
00056         dummyWidget = new QWidget();
00057         dummyWidget->setIcon( DesktopIcon( "kexi" ) );
00058         app.setMainWidget(dummyWidget);
00059     }
00060 
00061     tristate res = Kexi::startupHandler().init(argc, argv);
00062     if (!res)
00063         return 1;
00064     if (~res)
00065         return 0;
00066     
00067     kdDebug() << "startupActions OK" <<endl;
00068 
00069     /* Exit requested, e.g. after database removing. */
00070     if (Kexi::startupHandler().action() == KexiStartupData::Exit)
00071         return 0;
00072 
00073 #ifdef CUSTOM_VERSION
00074 # include "custom_exec.h"
00075 #endif
00076 
00077     KexiMainWindowImpl *win = new KexiMainWindowImpl();
00078     app.setMainWidget(win);
00079     delete dummyWidget;
00080 
00081     if (true != win->startup()) {
00082         delete win;
00083         return 1;
00084     }
00085 
00086     win->show();
00087     app.processEvents();//allow refresh our app
00088 
00089     return app.exec();
00090 }
00091 
KDE Home | KDE Accessibility Home | Description of Access Keys