F:/KPlato/koffice/libs/kotext/KoCreateStyleDia.cpp

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002    Copyright (C)  2002 Montel Laurent <lmontel@mandrakesoft.com>
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 <klocale.h>
00021 
00022 #include <kvbox.h>
00023 #include <QLabel>
00024 #include <QLineEdit>
00025 #include "KoCreateStyleDia.h"
00026 #include <kmessagebox.h>
00027 
00028 KoCreateStyleDia::KoCreateStyleDia( const QStringList & _list, QWidget *parent, const char *name )
00029     : KDialog( parent )
00030 {
00031     setModal( true );
00032     setObjectName( name );
00033     setButtons( Ok|Cancel );
00034     setDefaultButton( Ok );
00035     showButtonSeparator( true );
00036     styleList=_list;
00037     setCaption( i18n("Create New Style") );
00038     KVBox *page = new KVBox();
00039     setMainWidget(page);
00040     new QLabel(i18n("Please specify a new style name:"), page);
00041     m_styleName = new QLineEdit( page );
00042     m_styleName->setMinimumWidth( m_styleName->sizeHint().width() * 3 );
00043 
00044     connect( m_styleName, SIGNAL(textChanged ( const QString & )), this, SLOT(nameChanged( const QString &)));
00045     m_styleName->setFocus();
00046     enableButtonOk( false );
00047 }
00048 
00049 void KoCreateStyleDia::slotOk()
00050 {
00051     if ( styleList.findIndex(m_styleName->text() ) != -1 )
00052     {
00053         KMessageBox::error(this, i18n("Name already exists! Please choose another name"));
00054         m_styleName->clear();
00055     }
00056     else
00057         slotButtonClicked( Ok );
00058 }
00059 
00060 QString KoCreateStyleDia::nameOfNewStyle()const
00061 {
00062     return m_styleName->text();
00063 }
00064 
00065 void KoCreateStyleDia::nameChanged( const QString &text)
00066 {
00067     enableButtonOk( !text.isEmpty() );
00068 }
00069 #include "KoCreateStyleDia.moc"

Généré le Wed Nov 22 23:41:07 2006 pour KPlato par  doxygen 1.5.1-p1