moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kig / filters / drgeo-filter-chooser.cc
blob86dd1df8949449ccdda1e8e679b58270fabe7d17
1 // Copyright (C) 2004 Pino Toscano <toscano.pino@tiscali.it>
2 // Copyright (C) 2004 Dominique Devriese <devriese@kde.org>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 // This program 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
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17 // 02111-1307, USA.
19 #include "drgeo-filter-chooser.h"
20 #include "drgeo-filter-chooser.moc"
22 #include <klistbox.h>
23 #include <klocale.h>
24 #include <kmessagebox.h>
25 #include <kpushbutton.h>
26 #include <kstdguiitem.h>
28 KigFilterDrgeoChooser::KigFilterDrgeoChooser( const QStringList& l )
29 : KigFilterDrgeoChooserBase( 0, "drgeo_filter", true )
31 OKButton->setGuiItem( KStdGuiItem::ok() );
32 CancelButton->setGuiItem( KStdGuiItem::cancel() );
34 FigureListBox->insertStringList( l );
36 connect( OKButton, SIGNAL( clicked() ), SLOT( slotOKPressed() ) );
37 connect( CancelButton, SIGNAL( clicked() ), SLOT( slotCancelPressed() ) );
38 connect( FigureListBox, SIGNAL( executed( QListBoxItem* ) ), SLOT( slotExecuted( QListBoxItem* ) ) );
41 void KigFilterDrgeoChooser::slotOKPressed()
43 const int r = FigureListBox->currentItem();
44 if ( r == -1 )
46 KMessageBox::sorry( 0, i18n( "Please select a figure." ) );
47 return;
49 done( r );
52 void KigFilterDrgeoChooser::slotCancelPressed()
54 done( -1 );
57 KigFilterDrgeoChooser::~KigFilterDrgeoChooser()
62 void KigFilterDrgeoChooser::slotExecuted( QListBoxItem* i )
64 done( FigureListBox->index( i ) );