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
|
/*
* Copyright (C) 2004 Girish Ramakrishnan All Rights Reserved.
*
* This 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.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
// $Id: main.cpp,v 1.7 2004/11/08 07:14:18 cs19713 Exp $
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <tdeaboutdata.h>
#include <tdeapplication.h>
#include <tdecmdlineargs.h>
#include <tdeglobal.h>
#include <tdelocale.h>
#include <tqdir.h>
#include "tdedocker.h"
#include "traylabelmgr.h"
#include "trace.h"
#include <X11/Xlib.h>
static void sighandler(int sig)
{
if (sig == SIGUSR1)
{
DUMP_TRACE((TQDir::homeDirPath() + "/tdedocker.trace").local8Bit());
return;
}
tqDebug("%s", i18n("Caught signal %1. Cleaning up.").arg(sig).local8Bit().data());
((TDEDocker*)TDEApplication::kApplication())->trayLabelMgr()->undockAll();
TDEApplication::kApplication()->quit();
}
static const TDECmdLineOptions options[] =
{
{ "b", I18N_NOOP("Dont warn about non-normal windows (blind mode)"), 0L },
{ "d", I18N_NOOP("Disable session management"), 0L },
{ "e", I18N_NOOP("Enable session management"), 0L },
{ "f", I18N_NOOP("Dock window that has the focus(active window)"), 0L },
{ "i icon", I18N_NOOP("Custom dock Icon"), 0L },
{ "m", I18N_NOOP("Keep application window mapped (dont hide on dock)"), 0L },
{ "o", I18N_NOOP("Dock when obscured"), 0L },
{ "p secs", I18N_NOOP("Set ballooning timeout (popup time)"), 0L },
{ "q", I18N_NOOP("Disable ballooning title changes (quiet)"), 0L },
{ "t", I18N_NOOP("Remove this application from the task bar"), 0L },
{ "w wid", I18N_NOOP("Window id of the application to dock"), 0L },
{ "+[command <args>]", I18N_NOOP("Application to dock"), 0 },
TDECmdLineLastOption
};
//extern "C" int KDE_EXPORT kdemain(int argc, char* argv[])
int main(int argc, char *argv[])
{
TDEAboutData about("tdedocker", I18N_NOOP("tdedocker"), "1.3",
I18N_NOOP("Docks any application into the system tray\nNOTE: Use -d for all startup scripts."), TDEAboutData::License_GPL);
about.addAuthor("John Schember", I18N_NOOP("Original KDocker maintainer"), "john@nachtimwald.com");
about.addAuthor("Girish Ramakrishnan", I18N_NOOP("Original KDocker developer"), "ramakrishnan.girish@gmail.com");
TDEGlobal::locale()->setMainCatalogue("tdedocker");
TDECmdLineArgs::init(argc, argv, &about);
TDECmdLineArgs::addCmdLineOptions(options);
TDEDocker::addCmdLineOptions();
TDEDocker app;
// setup signal handlers that undock and quit (must be done after the TDEApplication constructor has run)
signal(SIGHUP, sighandler);
signal(SIGTERM, sighandler);
signal(SIGINT, sighandler);
signal(SIGUSR1, sighandler);
return app.exec();
}
|