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#include <tdeversion.h>
29
30#include "kexidatasourcewizard.h"
31#include "kexidswelcome.h"
32
33KexiDSWelcome::KexiDSWelcome(KexiDataSourceWizard *parent)
34 : TQWidget(parent)
35{
36 m_wiz = parent;
37 KexiDSPixmap *pic = new KexiDSPixmap(this);
38
39 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);
40 lText->setAlignment(AlignTop | AlignLeft | WordBreak);
41 TQCheckBox *useWizard = new TQCheckBox(i18n("Create %1 using the \"%1 Wizard\""), this);
42 connect(useWizard, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(setUseWizard(bool)));
43 useWizard->setChecked(true);
44
45 TQSpacerItem *spacer = new TQSpacerItem(320, 220);
46 TQCheckBox *dontShow = new TQCheckBox(i18n("Do not show this wizard again"), this);
47
48 TQGridLayout *g = new TQGridLayout(this);
49
50 g->addMultiCellWidget(pic, 0, 4, 0, 0);
51 g->addWidget(lText, 0, 1);
52 g->addWidget(useWizard, 2, 1);
53 g->addItem(spacer, 3, 1);
54 g->addWidget(dontShow, 4, 1);
55}
56
57void
58KexiDSWelcome::setUseWizard(bool use)
59{
60#if KDE_IS_VERSION(3,1,9) && !defined(TQ_WS_WIN)
61 bool useIcons = TDEGlobalSettings::showIconsOnPushButtons();
62#else
63 bool useIcons = true;
64#endif
65 if(use)
66 {
67 KGuiItem forward = KStdGuiItem::forward(KStdGuiItem::UseRTL);
68
69 if(useIcons)
70 m_wiz->nextButton()->setIconSet( forward.iconSet() );
71
72 m_wiz->nextButton()->setText(i18n("&Next"));
73 }
74 else
75 {
76 if(useIcons)
77 m_wiz->nextButton()->setIconSet(SmallIconSet("apply"));
78
79 m_wiz->nextButton()->setText(i18n("&Finish"));
80 }
81
82 m_wiz->finishNext(!use);
83}
84
85KexiDSWelcome::~KexiDSWelcome()
86{
87}
88
89#include "kexidswelcome.moc"
90