summaryrefslogtreecommitdiffstats
path: root/kshowmail/uniqueapp.cpp
blob: 822c877de3c74a12a17b518ef4193c2c81e27025 (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
/***************************************************************************
                          uniqueapp.cpp  -  description
                             -------------------
    begin                : Mon Nov 19 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.                                   *
 *                                                                         *
 ***************************************************************************/

#include "uniqueapp.h"
#include <iostream>


UniqueApp::UniqueApp()
{
	m_pApp = NULL;
}

UniqueApp::~UniqueApp()
{}

int UniqueApp::newInstance ()
{
  //start our application
  //---------------------

  //at the first invoke of newInstance() create a new instance of kshowmail
  if (m_pApp == NULL)
  {
    m_pApp = new KShowMailApp ();
  }
//TODO: write english comments

  //frage das ConfigList-Objekt, ob die KShowMail beim Starten
  //normal oder nur in der Taskleiste gezeigt werden soll
  if( m_pApp->m_ConfigList.startMinimized() )
  {
    //lege die App auf die Taskleiste
    m_pApp->showMinimized ();
    m_pApp->hide();
  }
  else
  {
    //zeige das Hauptfenster
    m_pApp->showNormal ();
    m_pApp->raise();
  }

  //Kommandozeile-Argumente auswerten
  //---------------------------------

  //die in main() eingelesenen Kommandozeile-Argumente in ein
  //KCmdLineArgs-Objekt ablegen
  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

  //wenn als Kommandozeilen-Argument "config" übergeben wurde,
  //starte jetzt den Konfigurationsdialog
  if ( args->isSet( CMDLINE_CONFIG ) )
    m_pApp->slotSetup();

  //wenn als Kommandozeile-Argument "refresh" übergeben wurde,
  //schaue sofort nach neue Mails
  if ( args->isSet ( CMDLINE_REFRESH ) )
    m_pApp->slotRefresh();

  //lösche alle Kommandozeilen-Argumente im Objekt
  args->clear ();

  return 0;
}