kshowmail: kshowmail/main.cpp Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories

# main.cpp

    00001 /***************************************************************************
    00002                           main.cpp  -  description
    00003                              -------------------
    00004     begin                : Fre Sep 28 23:29:54 CEST 2001
    00005     copyright            : (C) 2001 by Eggert Ehmke
    00006     email                : eggert.ehmke@berlin.de
    00007  ***************************************************************************/
    00008
    00009 /***************************************************************************
    00010  *                                                                         *
    00011  *   This program is free software; you can redistribute it and/or modify  *
    00012  *   it under the terms of the GNU General Public License as published by  *
    00013  *   the Free Software Foundation; either version 2 of the License, or     *
    00014  *   (at your option) any later version.                                   *
    00015  *                                                                         *
    00016  ***************************************************************************/
    00017
    00018 //KDE-Header
    00019 #include <tdecmdlineargs.h>
    00020 #include <tdeaboutdata.h>
    00021 #include <kuniqueapplication.h>
    00022 #include <tdelocale.h>
    00023 #include <kdebug.h>
    00024
    00025 //KShowmail-Header
    00026 #include "uniqueapp.h"
    00027 #include "kshowmail.h"
    00028 #include "constants.h"
    00029
    00030 using namespace Constants;
    00031
    00032 //description of the application
    00033 static const char *description = I18N_NOOP("A powerful pop3 mail checker");
    00034
    00035 //the command line options
    00036 //see constants.h
    00037 static TDECmdLineOptions kshowmailOptions[] =
    00038   {
    00039     { CMDLINE_REFRESH_SHORT, 0, 0},
    00040     { CMDLINE_REFRESH, I18N_NOOP("Refresh messages now"), 0 },
    00041     { CMDLINE_CONFIG_SHORT, 0, 0},
    00042     { CMDLINE_CONFIG, I18N_NOOP("Launch configure dialog"), 0 },
    00043     TDECmdLineLastOption
    00044   };
    00045
    00046 int main(int argc, char *argv[])
    00047 {
    00048   //create datas for the about box
    00049   KShowMailApp::m_pAbout = new TDEAboutData (
    00050                              /*appName    */ "kshowmail",
    00051                              /*programName*/ "KShowmail",
    00052                              /*version    */ VERSION,
    00053                              /*description*/ description,
    00054                              /*license    */ TDEAboutData::License_GPL_V2,
    00055                              /*copyright  */ "(C) 2000-2005, Eggert Ehmke",
    00056                              /*text       */ 0,
    00057                              /*homepage   */ "http://sourceforge.net/projects/kshowmail",
    00058                              /*bug email  */ "eggert.ehmke@berlin.de");
    00059
    00060   //add authors
    00061   KShowMailApp::m_pAbout->addAuthor ("Eggert Ehmke", 0, "eggert.ehmke@berlin.de", "http://kshowmail.sourceforge.net");
    00062   KShowMailApp::m_pAbout->addAuthor ("Allistar Melville", 0, "allistar@silvermoon.co.nz", 0);
    00063   KShowMailApp::m_pAbout->addAuthor ("Oleg Ivanov", 0, "saruman@unigsm.com", 0);
    00064   KShowMailApp::m_pAbout->addAuthor( "Ulrich Weigelt", 0, "ulrich.weigelt@gmx.de", 0 );
    00065   KShowMailApp::m_pAbout->setTranslator(I18N_NOOP("_: NAME OF TRANSLATORS\nYour names") ,I18N_NOOP("_: EMAIL OF TRANSLATORS\nYour emails"));
    00066
    00067   //Initialize command line arguments
    00068   TDECmdLineArgs::init(argc, argv, KShowMailApp::m_pAbout);
    00069   //add the special command line options of kshowmail which was specified above
    00070   TDECmdLineArgs::addCmdLineOptions(kshowmailOptions);
    00071
    00072   // when released, this must be 0!
    00073 #if 0
    00074
    00075   kdDebug () << "KShowmail running in debug mode" << endl;
    00076   TDEApplication::addCmdLineOptions();
    00077
    00078   TDEApplication app;
    00079   KShowMailApp* kshow = new KShowMailApp ();
    00080   kshow->show();
    00081   app.exec();
    00082
    00083 #else
    00084
    00085   //print debug message about run mode
    00086   kdDebug () << "KShowmail running in normal mode" << endl;
    00087
    00088   //add special command line options for unique KDE applications
    00089   KUniqueApplication::addCmdLineOptions();
    00090
    00091   //test whether the new application to start is unique
    00092   if (KUniqueApplication::start())
    00093   {
    00094     //yes, wa can start a unique kshowmail instance
    00095
    00096     //create a new unique appliction
    00097     //UniqueApp is a inherited class of KUniqueApplication
    00098     //see uniqueapp.h
    00099     UniqueApp* app = new UniqueApp ();
    00100
    00101     //start the application
    00102     app->exec ();
    00103   }
    00104   else
    00105   {
    00106     //kshowmail is already running
    00107     kdWarning() << I18N_NOOP ("Kshowmail is already running!") << endl;
    00108   }
    00109
    00110 #endif
    00111
    00112   return 0;
    00113 }
    00114