kexi

kexidswelcome.cpp

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include <qlayout.h>
00021 #include <qcheckbox.h>
00022 #include <qpushbutton.h>
00023 
00024 #include <klocale.h>
00025 #include <kiconloader.h>
00026 #include <kglobalsettings.h>
00027 #include <kstdguiitem.h>
00028 #include <kdeversion.h>
00029 
00030 #include "kexidatasourcewizard.h"
00031 #include "kexidswelcome.h"
00032 
00033 KexiDSWelcome::KexiDSWelcome(KexiDataSourceWizard *parent)
00034  : QWidget(parent)
00035 {
00036     m_wiz = parent;
00037     KexiDSPixmap *pic = new KexiDSPixmap(this);
00038 
00039     QLabel *lText = new QLabel(i18n("Kexi can help you with creation of %2 using data sources in almost no time with the \"%1 Wizard\""), this);
00040     lText->setAlignment(AlignTop | AlignLeft | WordBreak);
00041     QCheckBox *useWizard = new QCheckBox(i18n("Create %1 using the \"%1 Wizard\""), this);
00042     connect(useWizard, SIGNAL(toggled(bool)), this, SLOT(setUseWizard(bool)));
00043     useWizard->setChecked(true);
00044 
00045     QSpacerItem *spacer = new QSpacerItem(320, 220);
00046     QCheckBox *dontShow = new QCheckBox(i18n("Do not show this wizard again"), this);
00047 
00048     QGridLayout *g = new QGridLayout(this);
00049 
00050     g->addMultiCellWidget(pic, 0, 4, 0, 0);
00051     g->addWidget(lText, 0, 1);
00052     g->addWidget(useWizard, 2, 1);
00053     g->addItem(spacer, 3, 1);
00054     g->addWidget(dontShow, 4, 1);
00055 }
00056 
00057 void
00058 KexiDSWelcome::setUseWizard(bool use)
00059 {
00060 #if KDE_IS_VERSION(3,1,9) && !defined(Q_WS_WIN)
00061     bool useIcons = KGlobalSettings::showIconsOnPushButtons();
00062 #else
00063     bool useIcons = true;
00064 #endif
00065     if(use)
00066     {
00067         KGuiItem forward = KStdGuiItem::forward(KStdGuiItem::UseRTL);
00068 
00069         if(useIcons)
00070             m_wiz->nextButton()->setIconSet( forward.iconSet() );
00071 
00072         m_wiz->nextButton()->setText(i18n("&Next"));
00073     }
00074     else
00075     {
00076         if(useIcons)
00077             m_wiz->nextButton()->setIconSet(SmallIconSet("apply"));
00078 
00079         m_wiz->nextButton()->setText(i18n("&Finish"));
00080     }
00081 
00082     m_wiz->finishNext(!use);
00083 }
00084 
00085 KexiDSWelcome::~KexiDSWelcome()
00086 {
00087 }
00088 
00089 #include "kexidswelcome.moc"
00090 
KDE Home | KDE Accessibility Home | Description of Access Keys