summaryrefslogtreecommitdiffstats
path: root/kexi/widget/kexidswelcome.cpp
blob: ca2480f61286c9d553595b7f11e898d2bf3d0da8 (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
79
80
81
82
83
84
85
86
87
88
89
90
/* This file is part of the KDE project
   Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library 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
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
*/

#include <tqlayout.h>
#include <tqcheckbox.h>
#include <tqpushbutton.h>

#include <klocale.h>
#include <kiconloader.h>
#include <kglobalsettings.h>
#include <kstdguiitem.h>
#include <kdeversion.h>

#include "kexidatasourcewizard.h"
#include "kexidswelcome.h"

KexiDSWelcome::KexiDSWelcome(KexiDataSourceWizard *tqparent)
 : TQWidget(tqparent)
{
	m_wiz = tqparent;
	KexiDSPixmap *pic = new KexiDSPixmap(this);

	TQLabel *lText = new TQLabel(i18n("Kexi can help you with creation of %2 using data sources in almost no time with the \"%1 Wizard\""), this);
	lText->tqsetAlignment(AlignTop | AlignLeft | WordBreak);
	TQCheckBox *useWizard = new TQCheckBox(i18n("Create %1 using the \"%1 Wizard\""), this);
	connect(useWizard, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(setUseWizard(bool)));
	useWizard->setChecked(true);

	TQSpacerItem *spacer = new TQSpacerItem(320, 220);
	TQCheckBox *dontShow = new TQCheckBox(i18n("Do not show this wizard again"), this);

	TQGridLayout *g = new TQGridLayout(this);

	g->addMultiCellWidget(pic, 0, 4, 0, 0);
	g->addWidget(lText, 0, 1);
	g->addWidget(useWizard, 2, 1);
	g->addItem(spacer, 3, 1);
	g->addWidget(dontShow, 4, 1);
}

void
KexiDSWelcome::setUseWizard(bool use)
{
#if KDE_IS_VERSION(3,1,9) && !defined(TQ_WS_WIN)
	bool useIcons = KGlobalSettings::showIconsOnPushButtons();
#else
	bool useIcons = true;
#endif
	if(use)
	{
		KGuiItem forward = KStdGuiItem::forward(KStdGuiItem::UseRTL);

		if(useIcons)
			m_wiz->nextButton()->setIconSet( forward.iconSet() );

		m_wiz->nextButton()->setText(i18n("&Next"));
	}
	else
	{
		if(useIcons)
			m_wiz->nextButton()->setIconSet(SmallIconSet("apply"));

		m_wiz->nextButton()->setText(i18n("&Finish"));
	}

	m_wiz->finishNext(!use);
}

KexiDSWelcome::~KexiDSWelcome()
{
}

#include "kexidswelcome.moc"