summaryrefslogtreecommitdiffstats
path: root/kshowmail/main.cpp
blob: a28067a231665b02a230ac520d02eb89a6eacc9c (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
/***************************************************************************
                          main.cpp  -  description
                             -------------------
    begin                : Fre Sep 28 23:29:54 CEST 2001
    copyright            : (C) 2001 by Eggert Ehmke
    email                : eggert.ehmke@berlin.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

//KDE-Header
#include <kcmdlineargs.h>
#include <kaboutdata.h>
#include <kuniqueapplication.h>
#include <klocale.h>
#include <kdebug.h>

//KShowmail-Header
#include "uniqueapp.h"
#include "kshowmail.h"
#include "constants.h"

using namespace Constants;

//description of the application
static const char *description = I18N_NOOP("A powerful pop3 mail checker");

//the command line options
//see constants.h
static KCmdLineOptions kshowmailOptions[] =
  {
    { CMDLINE_REFRESH_SHORT, 0, 0},
    { CMDLINE_REFRESH, I18N_NOOP("Refresh messages now"), 0 },
    { CMDLINE_CONFIG_SHORT, 0, 0},
    { CMDLINE_CONFIG, I18N_NOOP("Launch configure dialog"), 0 },
    KCmdLineLastOption
  };

int main(int argc, char *argv[])
{
  //create datas for the about box
  KShowMailApp::m_pAbout = new KAboutData (
                             /*appName    */ "kshowmail",
                             /*programName*/ "KShowmail",
                             /*version    */ VERSION,
                             /*description*/ description,
                             /*license    */ KAboutData::License_GPL_V2,
                             /*copyright  */ "(C) 2000-2005, Eggert Ehmke",
                             /*text       */ 0,
                             /*homepage   */ "http://sourceforge.net/projects/kshowmail",
                             /*bug email  */ "eggert.ehmke@berlin.de");

  //add authors
  KShowMailApp::m_pAbout->addAuthor ("Eggert Ehmke", 0, "eggert.ehmke@berlin.de", "http://kshowmail.sourceforge.net");
  KShowMailApp::m_pAbout->addAuthor ("Allistar Melville", 0, "allistar@silvermoon.co.nz", 0);
  KShowMailApp::m_pAbout->addAuthor ("Oleg Ivanov", 0, "saruman@unigsm.com", 0);
  KShowMailApp::m_pAbout->addAuthor( "Ulrich Weigelt", 0, "ulrich.weigelt@gmx.de", 0 );
  KShowMailApp::m_pAbout->setTranslator(I18N_NOOP("_: NAME OF TRANSLATORS\nYour names") ,I18N_NOOP("_: EMAIL OF TRANSLATORS\nYour emails"));

  //Initialize command line arguments
  KCmdLineArgs::init(argc, argv, KShowMailApp::m_pAbout);
  //add the special command line options of kshowmail which was specified above
  KCmdLineArgs::addCmdLineOptions(kshowmailOptions);

  // when released, this must be 0!
#if 0

  kdDebug () << "KShowmail running in debug mode" << endl;
  KApplication::addCmdLineOptions();

  KApplication app;
  KShowMailApp* kshow = new KShowMailApp ();
  kshow->show();
  app.exec();

#else

  //print debug message about run mode
  kdDebug () << "KShowmail running in normal mode" << endl;

  //add special command line options for unique KDE applications
  KUniqueApplication::addCmdLineOptions();

  //test whether the new application to start is unique
  if (KUniqueApplication::start())
  {
    //yes, wa can start a unique kshowmail instance

    //create a new unique appliction
    //UniqueApp is a inherited class of KUniqueApplication
    //see uniqueapp.h
    UniqueApp* app = new UniqueApp ();

    //start the application
    app->exec ();
  }
  else
  {
    //kshowmail is already running
    kdWarning() << I18N_NOOP ("Kshowmail is already running!") << endl;
  }

#endif

  return 0;
}