kexi

kexidswelcome.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include <tqlayout.h>
21#include <tqcheckbox.h>
22#include <tqpushbutton.h>
23
24#include <tdelocale.h>
25#include <kiconloader.h>
26#include <tdeglobalsettings.h>
27#include <kstdguiitem.h>
28
29#include "kexidatasourcewizard.h"
30#include "kexidswelcome.h"
31
32KexiDSWelcome::KexiDSWelcome(KexiDataSourceWizard *parent)
33 : TQWidget(parent)
34{
35 m_wiz = parent;
36 KexiDSPixmap *pic = new KexiDSPixmap(this);
37
38 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);
39 lText->setAlignment(AlignTop | AlignLeft | WordBreak);
40 TQCheckBox *useWizard = new TQCheckBox(i18n("Create %1 using the \"%1 Wizard\""), this);
41 connect(useWizard, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(setUseWizard(bool)));
42 useWizard->setChecked(true);
43
44 TQSpacerItem *spacer = new TQSpacerItem(320, 220);
45 TQCheckBox *dontShow = new TQCheckBox(i18n("Do not show this wizard again"), this);
46
47 TQGridLayout *g = new TQGridLayout(this);
48
49 g->addMultiCellWidget(pic, 0, 4, 0, 0);
50 g->addWidget(lText, 0, 1);
51 g->addWidget(useWizard, 2, 1);
52 g->addItem(spacer, 3, 1);
53 g->addWidget(dontShow, 4, 1);
54}
55
56void
57KexiDSWelcome::setUseWizard(bool use)
58{
59#if !defined(TQ_WS_WIN)
60 bool useIcons = TDEGlobalSettings::showIconsOnPushButtons();
61#else
62 bool useIcons = true;
63#endif
64 if(use)
65 {
66 KGuiItem forward = KStdGuiItem::forward(KStdGuiItem::UseRTL);
67
68 if(useIcons)
69 m_wiz->nextButton()->setIconSet( forward.iconSet() );
70
71 m_wiz->nextButton()->setText(i18n("&Next"));
72 }
73 else
74 {
75 if(useIcons)
76 m_wiz->nextButton()->setIconSet(SmallIconSet("apply"));
77
78 m_wiz->nextButton()->setText(i18n("&Finish"));
79 }
80
81 m_wiz->finishNext(!use);
82}
83
84KexiDSWelcome::~KexiDSWelcome()
85{
86}
87
88#include "kexidswelcome.moc"
89