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