summaryrefslogtreecommitdiffstats
path: root/kdict/application.cpp
blob: de0c294eae103afdb01ca057d60d6dd7bd263e67 (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
/* -------------------------------------------------------------

   application.cpp (part of The KDE Dictionary Client)

   Copyright (C) 2000-2001 Christian Gebauer <gebauer@kde.org>

   This file is distributed under the Artistic License.
   See LICENSE for details.

 ------------------------------------------------------------- */

#include <twin.h>
#include <kdebug.h>
#include <tdecmdlineargs.h>

#include "application.h"
#include "toplevel.h"


Application::Application()
 : KUniqueApplication()
{
  m_mainWindow = new TopLevel( 0, "mainWindow" );
}


Application::~Application()
{
  delete m_mainWindow;
}


int Application::newInstance()
{
  kdDebug(5004) << "Application::newInstance()" << endl;
  KUniqueApplication::newInstance();

  // process parameters...
  TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();

  m_mainWindow->show();

  if (args->isSet("clipboard"))
  {
    m_mainWindow->defineClipboard();
  }
  else
  {
    if (args->count()>0)
    {
      TQString phrase;
      for (int i=0;i<args->count();i++)
      {
        phrase += TQString::fromLocal8Bit(args->arg(i));
        if (i+1 < args->count())
          phrase += " ";
      }
      m_mainWindow->define(phrase);
    }
    else
    {
      m_mainWindow->normalStartup();
    }
  }

  return 0;
}

//--------------------------------

#include "application.moc"