summaryrefslogtreecommitdiffstats
path: root/kdict/application.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kdict/application.cpp')
-rw-r--r--kdict/application.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/kdict/application.cpp b/kdict/application.cpp
new file mode 100644
index 00000000..28e3a398
--- /dev/null
+++ b/kdict/application.cpp
@@ -0,0 +1,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 <kwin.h>
+#include <kdebug.h>
+#include <kcmdlineargs.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...
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+ m_mainWindow->show();
+
+ if (args->isSet("clipboard"))
+ {
+ m_mainWindow->defineClipboard();
+ }
+ else
+ {
+ if (args->count()>0)
+ {
+ QString phrase;
+ for (int i=0;i<args->count();i++)
+ {
+ phrase += QString::fromLocal8Bit(args->arg(i));
+ if (i+1 < args->count())
+ phrase += " ";
+ }
+ m_mainWindow->define(phrase);
+ }
+ else
+ {
+ m_mainWindow->normalStartup();
+ }
+ }
+
+ return 0;
+}
+
+//--------------------------------
+
+#include "application.moc"