summaryrefslogtreecommitdiffstats
path: root/ktip/ktipwindow.cpp
blob: f15b20309e741cf7b76708c91f1de35d317f3502 (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
/*
    KTip, the KDE Tip Of the Day

	Copyright (c) 2000, Matthias Hoelzer-Kluepfel
	Copyright (c) 2002 Tobias Koenig <[email protected]>

    This program is free software; you can redistribute it and/or
    modify it under the terms of version 2 of the GNU General Public
    License as published by the Free Software Foundation

    This program 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 program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#include <dcopclient.h>

#include <tdeaboutdata.h>
#include <tdecmdlineargs.h>
#include <tdelocale.h>
#include <kstandarddirs.h>
#include <ktip.h>
#include <kuniqueapplication.h>
#include <twin.h>
#include <stdlib.h>

static const char description[] = I18N_NOOP("Useful tips");

int main(int argc, char *argv[])
{
	TDEAboutData aboutData("ktip", I18N_NOOP("KTip"),
				"0.3", description, TDEAboutData::License_GPL,
				"(c) 1998-2002, KDE Developers");
	TDECmdLineArgs::init( argc, argv, &aboutData );
	KUniqueApplication::addCmdLineOptions();

	if (!KUniqueApplication::start())
		exit(-1);

	KUniqueApplication app;

	KTipDialog *tipDialog = new KTipDialog(new KTipDatabase(locate("data", TQString("tdewizard/tips"))));
	TQ_CHECK_PTR(tipDialog);
#ifdef Q_WS_X11
	KWin::setState(tipDialog->winId(), NET::StaysOnTop);
#endif
	tipDialog->setCaption(i18n("Useful Tips"));
	app.dcopClient()->send("ksplash", "ksplash", "close()", TQByteArray()); // Close splash screen
	tipDialog->show();

	TQObject::connect(tqApp, TQ_SIGNAL(lastWindowClosed()), tqApp, TQ_SLOT(quit()));

	app.setMainWidget(tipDialog);

	return app.exec();
}