diff options
Diffstat (limited to 'kspread/dialogs/kspread_dlg_formula.cc')
| -rw-r--r-- | kspread/dialogs/kspread_dlg_formula.cc | 244 |
1 files changed, 122 insertions, 122 deletions
diff --git a/kspread/dialogs/kspread_dlg_formula.cc b/kspread/dialogs/kspread_dlg_formula.cc index 54100b8c9..0981a4e70 100644 --- a/kspread/dialogs/kspread_dlg_formula.cc +++ b/kspread/dialogs/kspread_dlg_formula.cc @@ -24,8 +24,8 @@ * Boston, MA 02110-1301, USA. */ -#include <qtextbrowser.h> -#include <qtabwidget.h> +#include <tqtextbrowser.h> +#include <tqtabwidget.h> #include "kspread_dlg_formula.h" #include "kspread_canvas.h" @@ -43,22 +43,22 @@ #include <kdebug.h> #include <kbuttonbox.h> #include <knumvalidator.h> -#include <qcombobox.h> -#include <qevent.h> -#include <qlistbox.h> -#include <qlabel.h> -#include <qpushbutton.h> +#include <tqcombobox.h> +#include <tqevent.h> +#include <tqlistbox.h> +#include <tqlabel.h> +#include <tqpushbutton.h> #include <klineedit.h> -#include <qlayout.h> +#include <tqlayout.h> using namespace KSpread; -FormulaDialog::FormulaDialog( View* parent, const char* name,const QString& formulaName) - : KDialogBase( parent, name,false,i18n("Function"), Ok|Cancel ) +FormulaDialog::FormulaDialog( View* tqparent, const char* name,const TQString& formulaName) + : KDialogBase( tqparent, name,false,i18n("Function"), Ok|Cancel ) { - setWFlags( Qt::WDestructiveClose ); + setWFlags( TQt::WDestructiveClose ); - m_pView = parent; + m_pView = tqparent; m_focus = 0; m_desc = 0; @@ -80,80 +80,80 @@ FormulaDialog::FormulaDialog( View* parent, const char* name,const QString& form Q_ASSERT( m_pView->canvasWidget()->editor() ); - QWidget *page = new QWidget( this ); + TQWidget *page = new TQWidget( this ); setMainWidget(page); - QGridLayout *grid1 = new QGridLayout(page,11,2,KDialog::marginHint(), KDialog::spacingHint()); + TQGridLayout *grid1 = new TQGridLayout(page,11,2,KDialog::marginHint(), KDialog::spacingHint()); searchFunct = new KLineEdit(page); - QSizePolicy sp3( QSizePolicy::Preferred, QSizePolicy::Fixed ); - searchFunct->setSizePolicy( sp3 ); + TQSizePolicy sp3( TQSizePolicy::Preferred, TQSizePolicy::Fixed ); + searchFunct->tqsetSizePolicy( sp3 ); grid1->addWidget( searchFunct, 0, 0 ); - typeFunction = new QComboBox(page); - QStringList cats = FunctionRepository::self()->groups(); + typeFunction = new TQComboBox(page); + TQStringList cats = FunctionRepository::self()->groups(); cats.prepend( i18n("All") ); typeFunction->insertStringList( cats ); grid1->addWidget( typeFunction, 1, 0 ); - functions = new QListBox(page); - QSizePolicy sp1( QSizePolicy::Preferred, QSizePolicy::Expanding ); - functions->setSizePolicy( sp1 ); + functions = new TQListBox(page); + TQSizePolicy sp1( TQSizePolicy::Preferred, TQSizePolicy::Expanding ); + functions->tqsetSizePolicy( sp1 ); grid1->addWidget( functions, 2, 0 ); - selectFunction = new QPushButton( page ); - QToolTip::add(selectFunction, i18n("Insert function") ); + selectFunction = new TQPushButton( page ); + TQToolTip::add(selectFunction, i18n("Insert function") ); selectFunction->setPixmap( BarIcon( "down", KIcon::SizeSmall ) ); grid1->addWidget( selectFunction, 3, 0 ); - result = new QLineEdit( page ); + result = new TQLineEdit( page ); grid1->addMultiCellWidget( result, 4, 4, 0, 1 ); - m_tabwidget = new QTabWidget( page ); - QSizePolicy sp2( QSizePolicy::Expanding, QSizePolicy::Expanding ); - m_tabwidget->setSizePolicy( sp2 ); + m_tabwidget = new TQTabWidget( page ); + TQSizePolicy sp2( TQSizePolicy::Expanding, TQSizePolicy::Expanding ); + m_tabwidget->tqsetSizePolicy( sp2 ); grid1->addMultiCellWidget( m_tabwidget, 0, 2, 1, 1 ); - m_browser = new QTextBrowser( m_tabwidget ); + m_browser = new TQTextBrowser( m_tabwidget ); m_browser->setMinimumWidth( 300 ); m_tabwidget->addTab( m_browser, i18n("&Help") ); int index = m_tabwidget->currentPageIndex(); - m_input = new QWidget( m_tabwidget ); - QVBoxLayout *grid2 = new QVBoxLayout( m_input, KDialog::marginHint(), KDialog::spacingHint() ); + m_input = new TQWidget( m_tabwidget ); + TQVBoxLayout *grid2 = new TQVBoxLayout( m_input, KDialog::marginHint(), KDialog::spacingHint() ); - // grid2->setResizeMode (QLayout::Minimum); + // grid2->setResizeMode (TQLayout::Minimum); - label1 = new QLabel(m_input); + label1 = new TQLabel(m_input); grid2->addWidget( label1 ); - firstElement=new QLineEdit(m_input); + firstElement=new TQLineEdit(m_input); grid2->addWidget( firstElement ); - label2=new QLabel(m_input); + label2=new TQLabel(m_input); grid2->addWidget( label2 ); - secondElement=new QLineEdit(m_input); + secondElement=new TQLineEdit(m_input); grid2->addWidget( secondElement ); - label3=new QLabel(m_input); + label3=new TQLabel(m_input); grid2->addWidget( label3 ); - thirdElement=new QLineEdit(m_input); + thirdElement=new TQLineEdit(m_input); grid2->addWidget( thirdElement ); - label4=new QLabel(m_input); + label4=new TQLabel(m_input); grid2->addWidget( label4 ); - fourElement=new QLineEdit(m_input); + fourElement=new TQLineEdit(m_input); grid2->addWidget( fourElement ); - label5=new QLabel(m_input); + label5=new TQLabel(m_input); grid2->addWidget( label5 ); - fiveElement=new QLineEdit(m_input); + fiveElement=new TQLineEdit(m_input); grid2->addWidget( fiveElement ); grid2->addStretch( 10 ); @@ -165,43 +165,43 @@ FormulaDialog::FormulaDialog( View* parent, const char* name,const QString& form refresh_result = true; - connect( this, SIGNAL( cancelClicked() ), this, SLOT( slotClose() ) ); - connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) ); - connect( typeFunction, SIGNAL( activated(const QString &) ), - this, SLOT( slotActivated(const QString &) ) ); - connect( functions, SIGNAL( highlighted(const QString &) ), - this, SLOT( slotSelected(const QString &) ) ); - connect( functions, SIGNAL( selected(const QString &) ), - this, SLOT( slotSelected(const QString &) ) ); - connect( functions, SIGNAL( doubleClicked(QListBoxItem * ) ), - this ,SLOT( slotDoubleClicked(QListBoxItem *) ) ); + connect( this, TQT_SIGNAL( cancelClicked() ), this, TQT_SLOT( slotClose() ) ); + connect( this, TQT_SIGNAL( okClicked() ), this, TQT_SLOT( slotOk() ) ); + connect( typeFunction, TQT_SIGNAL( activated(const TQString &) ), + this, TQT_SLOT( slotActivated(const TQString &) ) ); + connect( functions, TQT_SIGNAL( highlighted(const TQString &) ), + this, TQT_SLOT( slotSelected(const TQString &) ) ); + connect( functions, TQT_SIGNAL( selected(const TQString &) ), + this, TQT_SLOT( slotSelected(const TQString &) ) ); + connect( functions, TQT_SIGNAL( doubleClicked(TQListBoxItem * ) ), + this ,TQT_SLOT( slotDoubleClicked(TQListBoxItem *) ) ); slotActivated(i18n("All")); - connect( selectFunction, SIGNAL(clicked()), - this,SLOT(slotSelectButton())); + connect( selectFunction, TQT_SIGNAL(clicked()), + this,TQT_SLOT(slotSelectButton())); - connect( firstElement,SIGNAL(textChanged ( const QString & )), - this,SLOT(slotChangeText(const QString &))); - connect( secondElement,SIGNAL(textChanged ( const QString & )), - this,SLOT(slotChangeText(const QString &))); - connect( thirdElement,SIGNAL(textChanged ( const QString & )), - this,SLOT(slotChangeText(const QString &))); - connect( fourElement,SIGNAL(textChanged ( const QString & )), - this,SLOT(slotChangeText(const QString &))); - connect( fiveElement,SIGNAL(textChanged ( const QString & )), - this,SLOT(slotChangeText(const QString &))); + connect( firstElement,TQT_SIGNAL(textChanged ( const TQString & )), + this,TQT_SLOT(slotChangeText(const TQString &))); + connect( secondElement,TQT_SIGNAL(textChanged ( const TQString & )), + this,TQT_SLOT(slotChangeText(const TQString &))); + connect( thirdElement,TQT_SIGNAL(textChanged ( const TQString & )), + this,TQT_SLOT(slotChangeText(const TQString &))); + connect( fourElement,TQT_SIGNAL(textChanged ( const TQString & )), + this,TQT_SLOT(slotChangeText(const TQString &))); + connect( fiveElement,TQT_SIGNAL(textChanged ( const TQString & )), + this,TQT_SLOT(slotChangeText(const TQString &))); - connect( m_pView->choice(), SIGNAL(changed(const Region&)), - this, SLOT(slotSelectionChanged())); + connect( m_pView->choice(), TQT_SIGNAL(changed(const Region&)), + this, TQT_SLOT(slotSelectionChanged())); - connect( m_browser, SIGNAL( linkClicked( const QString& ) ), - this, SLOT( slotShowFunction( const QString& ) ) ); + connect( m_browser, TQT_SIGNAL( linkClicked( const TQString& ) ), + this, TQT_SLOT( slotShowFunction( const TQString& ) ) ); // Save the name of the active sheet. m_sheetName = m_pView->activeSheet()->sheetName(); // Save the cells current text. - QString tmp_oldText = m_pView->canvasWidget()->editor()->text(); + TQString tmp_oldText = m_pView->canvasWidget()->editor()->text(); // Position of the cell. m_column = m_pView->canvasWidget()->markerColumn(); m_row = m_pView->canvasWidget()->markerRow(); @@ -219,13 +219,13 @@ FormulaDialog::FormulaDialog( View* parent, const char* name,const QString& form // Allow the user to select cells on the spreadsheet. m_pView->canvasWidget()->startChoose(); - qApp->installEventFilter( this ); + tqApp->installEventFilter( this ); // Was a function name passed along with the constructor ? Then activate it. if( !formulaName.isEmpty() ) { - functions->setCurrentItem( functions->index( functions->findItem( formulaName ) ) ); - slotDoubleClicked( functions->findItem( formulaName ) ); + functions->setCurrentItem( functions->index( functions->tqfindItem( formulaName ) ) ); + slotDoubleClicked( functions->tqfindItem( formulaName ) ); } else { @@ -240,10 +240,10 @@ FormulaDialog::FormulaDialog( View* parent, const char* name,const QString& form if( functions->currentItem() == -1 ) selectFunction->setEnabled( false ); - connect( searchFunct, SIGNAL( textChanged( const QString & ) ), - this, SLOT( slotSearchText(const QString &) ) ); - connect( searchFunct, SIGNAL( returnPressed() ), - this, SLOT( slotPressReturn() ) ); + connect( searchFunct, TQT_SIGNAL( textChanged( const TQString & ) ), + this, TQT_SLOT( slotSearchText(const TQString &) ) ); + connect( searchFunct, TQT_SIGNAL( returnPressed() ), + this, TQT_SLOT( slotPressReturn() ) ); } FormulaDialog::~FormulaDialog() @@ -262,24 +262,24 @@ void FormulaDialog::slotPressReturn() */ } -void FormulaDialog::slotSearchText(const QString &_text) +void FormulaDialog::slotSearchText(const TQString &_text) { - QString result = listFunct.makeCompletion( _text.upper() ); + TQString result = listFunct.makeCompletion( _text.upper() ); if( !result.isNull() ) - functions->setCurrentItem( functions->index( functions->findItem( result ) ) ); + functions->setCurrentItem( functions->index( functions->tqfindItem( result ) ) ); } -bool FormulaDialog::eventFilter( QObject* obj, QEvent* ev ) +bool FormulaDialog::eventFilter( TQObject* obj, TQEvent* ev ) { - if ( obj == firstElement && ev->type() == QEvent::FocusIn ) + if ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(firstElement) && ev->type() == TQEvent::FocusIn ) m_focus = firstElement; - else if ( obj == secondElement && ev->type() == QEvent::FocusIn ) + else if ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(secondElement) && ev->type() == TQEvent::FocusIn ) m_focus = secondElement; - else if ( obj == thirdElement && ev->type() == QEvent::FocusIn ) + else if ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(thirdElement) && ev->type() == TQEvent::FocusIn ) m_focus = thirdElement; - else if ( obj == fourElement && ev->type() == QEvent::FocusIn ) + else if ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(fourElement) && ev->type() == TQEvent::FocusIn ) m_focus = fourElement; - else if ( obj == fiveElement && ev->type() == QEvent::FocusIn ) + else if ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(fiveElement) && ev->type() == TQEvent::FocusIn ) m_focus = fiveElement; else return FALSE; @@ -304,14 +304,14 @@ void FormulaDialog::slotOk() } // Revert the marker to its original position - m_pView->selectionInfo()->initialize( QPoint( m_column, m_row ) ); + m_pView->selectionInfo()->initialize( TQPoint( m_column, m_row ) ); // If there is still an editor then set the text. // Usually the editor is always in place. if( m_pView->canvasWidget()->editor() != 0 ) { Q_ASSERT( m_pView->canvasWidget()->editor() ); - QString tmp = result->text(); + TQString tmp = result->text(); if( tmp.at(0) != '=') tmp = "=" + tmp; int pos = m_pView->canvasWidget()->editor()->cursorPosition()+ tmp.length(); @@ -342,7 +342,7 @@ void FormulaDialog::slotClose() // Revert the marker to its original position - m_pView->selectionInfo()->initialize( QPoint( m_column, m_row ) ); + m_pView->selectionInfo()->initialize( TQPoint( m_column, m_row ) ); // If there is still an editor then reset the text. // Usually the editor is always in place. @@ -364,11 +364,11 @@ void FormulaDialog::slotSelectButton() { if( functions->currentItem() != -1 ) { - slotDoubleClicked(functions->findItem(functions->text(functions->currentItem()))); + slotDoubleClicked(functions->tqfindItem(functions->text(functions->currentItem()))); } } -void FormulaDialog::slotChangeText( const QString& ) +void FormulaDialog::slotChangeText( const TQString& ) { // Test the lock if( !refresh_result ) @@ -377,19 +377,19 @@ void FormulaDialog::slotChangeText( const QString& ) if ( m_focus == 0 ) return; - QString tmp = m_leftText+m_funcName+"("; + TQString tmp = m_leftText+m_funcName+"("; tmp += createFormula(); tmp = tmp+ ")" + m_rightText; result->setText( tmp ); } -QString FormulaDialog::createFormula() +TQString FormulaDialog::createFormula() { - QString tmp( "" ); + TQString tmp( "" ); if ( !m_desc ) - return QString::null; + return TQString(); bool first = TRUE; @@ -437,15 +437,15 @@ QString FormulaDialog::createFormula() return(tmp); } -QString FormulaDialog::createParameter( const QString& _text, int param ) +TQString FormulaDialog::createParameter( const TQString& _text, int param ) { if ( _text.isEmpty() ) - return QString( "" ); + return TQString( "" ); if ( !m_desc ) - return QString( "" ); + return TQString( "" ); - QString text; + TQString text; ParameterType elementType = m_desc->param( param ).type(); @@ -470,13 +470,13 @@ QString FormulaDialog::createParameter( const QString& _text, int param ) text = "\\"; // changed: was "\"" // Escape quotes - QString tmp = _text; + TQString tmp = _text; int pos; int start = 1; - while( ( pos = tmp.find( '"', start ) ) != -1 ) + while( ( pos = tmp.tqfind( '"', start ) ) != -1 ) { if (tmp[pos - 1] != '\\') - tmp.replace( pos, 1, "\\\"" ); + tmp.tqreplace( pos, 1, "\\\"" ); else start = pos + 1; } @@ -494,13 +494,13 @@ QString FormulaDialog::createParameter( const QString& _text, int param ) text = "\""; // Escape quotes - QString tmp = _text; + TQString tmp = _text; int pos; int start = 1; - while( ( pos = tmp.find( '"', start ) ) != -1 ) + while( ( pos = tmp.tqfind( '"', start ) ) != -1 ) { if (tmp[pos - 1] != '\\') - tmp.replace( pos, 1, "\\\"" ); + tmp.tqreplace( pos, 1, "\\\"" ); else start = pos + 1; } @@ -525,7 +525,7 @@ QString FormulaDialog::createParameter( const QString& _text, int param ) return text; } -static void showEntry( QLineEdit* edit, QLabel* label, +static void showEntry( TQLineEdit* edit, TQLabel* label, FunctionDescription* desc, int param ) { edit->show(); @@ -547,14 +547,14 @@ static void showEntry( QLineEdit* edit, QLabel* label, edit->setText( "0" ); break; case KSpread_Int: - edit->setValidator(new QIntValidator (edit)); + edit->setValidator(new TQIntValidator (TQT_TQOBJECT(edit))); edit->setText( "0" ); break; } } -void FormulaDialog::slotDoubleClicked( QListBoxItem* item ) +void FormulaDialog::slotDoubleClicked( TQListBoxItem* item ) { if ( !item ) return; @@ -568,13 +568,13 @@ void FormulaDialog::slotDoubleClicked( QListBoxItem* item ) m_focus = 0; int old_length = result->text().length(); - // Dont change order of these function calls due to a bug in Qt 2.2 - m_browser->setText( m_desc->toQML() ); + // Dont change order of these function calls due to a bug in TQt 2.2 + m_browser->setText( m_desc->toTQML() ); m_tabwidget->setTabEnabled( m_input, TRUE ); m_tabwidget->setCurrentPage( 1 ); // - // Show as many QLineEdits as needed. + // Show as many TQLineEdits as needed. // if( m_desc->params() > 0 ) { @@ -654,7 +654,7 @@ void FormulaDialog::slotDoubleClicked( QListBoxItem* item ) result->setText("=" + result->text()); // - // Put focus somewhere is there are no QLineEdits visible + // Put focus somewhere is there are no TQLineEdits visible // if( m_desc->params() == 0 ) { @@ -667,7 +667,7 @@ void FormulaDialog::slotDoubleClicked( QListBoxItem* item ) slotChangeText( "" ); } -void FormulaDialog::slotSelected( const QString& function ) +void FormulaDialog::slotSelected( const TQString& function ) { FunctionDescription* desc = FunctionRepository::self()->functionInfo (function); @@ -687,7 +687,7 @@ void FormulaDialog::slotSelected( const QString& function ) m_desc = desc; // Set the help text - m_browser->setText( m_desc->toQML() ); + m_browser->setText( m_desc->toTQML() ); m_browser->setContentsPos( 0, 0 ); m_focus=0; @@ -700,20 +700,20 @@ void FormulaDialog::slotSelected( const QString& function ) } // from hyperlink in the "Related Function" -void FormulaDialog::slotShowFunction( const QString& function ) +void FormulaDialog::slotShowFunction( const TQString& function ) { FunctionDescription* desc = FunctionRepository::self()->functionInfo( function ); if ( !desc ) return; // select the category - QString category = desc->group(); + TQString category = desc->group(); typeFunction->setCurrentText( category ); slotActivated( category ); // select the function - QListBoxItem* item = functions->findItem( function, - Qt::ExactMatch | Qt::CaseSensitive ); + TQListBoxItem* item = functions->tqfindItem( function, + TQt::ExactMatch | TQt::CaseSensitive ); if( item ) functions->setCurrentItem( item ); slotSelected( function ); @@ -726,14 +726,14 @@ void FormulaDialog::slotSelectionChanged() if (m_pView->choice()->isValid()) { - QString area = m_pView->choice()->name(); + TQString area = m_pView->choice()->name(); m_focus->setText( area ); } } -void FormulaDialog::slotActivated( const QString& category ) +void FormulaDialog::slotActivated( const TQString& category ) { - QStringList lst; + TQStringList lst; if ( category == i18n("All") ) lst = FunctionRepository::self()->functionNames(); else @@ -744,8 +744,8 @@ void FormulaDialog::slotActivated( const QString& category ) functions->clear(); functions->insertStringList( lst ); - QStringList upperList; - for ( QStringList::Iterator it = lst.begin(); it != lst.end();++it ) + TQStringList upperList; + for ( TQStringList::Iterator it = lst.begin(); it != lst.end();++it ) upperList.append((*it).upper()); listFunct.setItems( upperList ); @@ -755,7 +755,7 @@ void FormulaDialog::slotActivated( const QString& category ) slotSelected( functions->text(0) ); } -void FormulaDialog::closeEvent ( QCloseEvent * e ) +void FormulaDialog::closeEvent ( TQCloseEvent * e ) { e->accept(); } |
