kspread
kspread_dlg_goto.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <qlabel.h>
00026 #include <qlayout.h>
00027
00028 #include <klineedit.h>
00029
00030 #include "kspread_canvas.h"
00031 #include "kspread_doc.h"
00032 #include "kspread_locale.h"
00033 #include "kspread_util.h"
00034 #include "kspread_view.h"
00035 #include "selection.h"
00036
00037 #include "kspread_dlg_goto.h"
00038
00039 using namespace KSpread;
00040
00041 GotoDialog::GotoDialog( View* parent, const char* name )
00042 : KDialogBase( parent, name, TRUE, i18n("Goto Cell"), Ok|Cancel )
00043 {
00044 m_pView = parent;
00045 QWidget *page = new QWidget( this );
00046 setMainWidget(page);
00047 QVBoxLayout *lay1 = new QVBoxLayout( page, 0, spacingHint() );
00048
00049 QLabel *label = new QLabel(i18n("Enter cell:"), page);
00050 lay1->addWidget(label);
00051
00052 m_nameCell = new KLineEdit( page );
00053 lay1->addWidget(m_nameCell);
00054
00055 m_nameCell->setFocus();
00056 enableButtonOK( false );
00057
00058 connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) );
00059 connect( m_nameCell, SIGNAL(textChanged ( const QString & )),
00060 this, SLOT(textChanged ( const QString & )));
00061 }
00062
00063 void GotoDialog::textChanged ( const QString &_text )
00064 {
00065 enableButtonOK(!_text.isEmpty());
00066 }
00067
00068 void GotoDialog::slotOk()
00069 {
00070 m_pView->doc()->emitBeginOperation( false );
00071
00072 QString tmp_upper;
00073 tmp_upper=m_nameCell->text().upper();
00074 Region region(m_pView, tmp_upper);
00075 if ( region.isValid() )
00076 {
00077 m_pView->selectionInfo()->initialize(region);
00078 accept();
00079 }
00080 else
00081 {
00082 m_nameCell->clear();
00083 }
00084 m_pView->slotUpdateView( m_pView->activeSheet() );
00085 }
00086
00087 #include "kspread_dlg_goto.moc"
|