diff options
Diffstat (limited to 'kchart/csvimportdialog.cc')
-rw-r--r-- | kchart/csvimportdialog.cc | 166 |
1 files changed, 83 insertions, 83 deletions
diff --git a/kchart/csvimportdialog.cc b/kchart/csvimportdialog.cc index e009024c..248719eb 100644 --- a/kchart/csvimportdialog.cc +++ b/kchart/csvimportdialog.cc @@ -21,17 +21,17 @@ #include <csvimportdialogui.h> #include <csvimportdialog.h> -#include <qtable.h> -#include <qcheckbox.h> -#include <qcursor.h> -#include <qlineedit.h> -#include <qcombobox.h> -#include <qspinbox.h> -#include <qtextstream.h> -#include <qbuttongroup.h> -#include <qpushbutton.h> -#include <qradiobutton.h> -#include <qtextcodec.h> +#include <tqtable.h> +#include <tqcheckbox.h> +#include <tqcursor.h> +#include <tqlineedit.h> +#include <tqcombobox.h> +#include <tqspinbox.h> +#include <tqtextstream.h> +#include <tqbuttongroup.h> +#include <tqpushbutton.h> +#include <tqradiobutton.h> +#include <tqtextcodec.h> #include <kapplication.h> #include <kdebug.h> @@ -41,8 +41,8 @@ #include <kcharsets.h> -CSVImportDialog::CSVImportDialog(QWidget* parent, QByteArray& fileArray) - : KDialogBase(parent, 0, true, QString::null, Ok|Cancel, No, true), +CSVImportDialog::CSVImportDialog(TQWidget* tqparent, TQByteArray& fileArray) + : KDialogBase(tqparent, 0, true, TQString(), Ok|Cancel, No, true), m_dialog(new DialogUI(this)), m_adjustRows(false), m_adjustCols(false), @@ -54,20 +54,20 @@ CSVImportDialog::CSVImportDialog(QWidget* parent, QByteArray& fileArray) m_delimiter(","), m_ignoreDups(false), m_fileArray(fileArray), - m_codec( QTextCodec::codecForName( "UTF-8" ) ) + m_codec( TQTextCodec::codecForName( "UTF-8" ) ) { setCaption( i18n( "Import Data" ) ); kapp->restoreOverrideCursor(); - QStringList encodings; - encodings << i18n( "Descriptive encoding name", "Recommended ( %1 )" ).arg( "UTF-8" ); - encodings << i18n( "Descriptive encoding name", "Locale ( %1 )" ).arg( QTextCodec::codecForLocale()->name() ); + TQStringList encodings; + encodings << i18n( "Descriptive encoding name", "Recommended ( %1 )" ).tqarg( "UTF-8" ); + encodings << i18n( "Descriptive encoding name", "Locale ( %1 )" ).tqarg( TQTextCodec::codecForLocale()->name() ); encodings += KGlobal::charsets()->descriptiveEncodingNames(); // Add a few non-standard encodings, which might be useful for text files - const QString description(i18n("Descriptive encoding name","Other ( %1 )")); - encodings << description.arg("Apple Roman"); // Apple - encodings << description.arg("IBM 850") << description.arg("IBM 866"); // MS DOS - encodings << description.arg("CP 1258"); // Windows + const TQString description(i18n("Descriptive encoding name","Other ( %1 )")); + encodings << description.tqarg("Apple Roman"); // Apple + encodings << description.tqarg("IBM 850") << description.tqarg("IBM 866"); // MS DOS + encodings << description.tqarg("CP 1258"); // Windows m_dialog->comboBoxEncoding->insertStringList(encodings); m_formatList << i18n( "Text" ); @@ -82,36 +82,36 @@ CSVImportDialog::CSVImportDialog(QWidget* parent, QByteArray& fileArray) fillTable(); - //resize(sizeHint()); + //resize(tqsizeHint()); resize( 600, 400 ); // Try to show as much as possible of the table view setMainWidget(m_dialog); - m_dialog->m_sheet->setSelectionMode( QTable::Multi ); - - connect(m_dialog->m_formatComboBox, SIGNAL(activated( const QString& )), - this, SLOT(formatChanged( const QString& ))); - connect(m_dialog->m_delimiterBox, SIGNAL(clicked(int)), - this, SLOT(delimiterClicked(int))); - connect(m_dialog->m_delimiterEdit, SIGNAL(returnPressed()), - this, SLOT(returnPressed())); - connect(m_dialog->m_delimiterEdit, SIGNAL(textChanged ( const QString & )), - this, SLOT(formatChanged ( const QString & ) )); - connect(m_dialog->m_comboQuote, SIGNAL(activated(const QString &)), - this, SLOT(textquoteSelected(const QString &))); - connect(m_dialog->m_sheet, SIGNAL(currentChanged(int, int)), - this, SLOT(currentCellChanged(int, int))); - connect(m_dialog->m_ignoreDuplicates, SIGNAL(stateChanged(int)), - this, SLOT(ignoreDuplicatesChanged(int))); - connect(m_dialog->m_updateButton, SIGNAL(clicked()), - this, SLOT(updateClicked())); - connect(m_dialog->comboBoxEncoding, SIGNAL(textChanged ( const QString & )), - this, SLOT(encodingChanged ( const QString & ) )); + m_dialog->m_sheet->setSelectionMode( TQTable::Multi ); + + connect(m_dialog->m_formatComboBox, TQT_SIGNAL(activated( const TQString& )), + this, TQT_SLOT(formatChanged( const TQString& ))); + connect(m_dialog->m_delimiterBox, TQT_SIGNAL(clicked(int)), + this, TQT_SLOT(delimiterClicked(int))); + connect(m_dialog->m_delimiterEdit, TQT_SIGNAL(returnPressed()), + this, TQT_SLOT(returnPressed())); + connect(m_dialog->m_delimiterEdit, TQT_SIGNAL(textChanged ( const TQString & )), + this, TQT_SLOT(formatChanged ( const TQString & ) )); + connect(m_dialog->m_comboQuote, TQT_SIGNAL(activated(const TQString &)), + this, TQT_SLOT(textquoteSelected(const TQString &))); + connect(m_dialog->m_sheet, TQT_SIGNAL(currentChanged(int, int)), + this, TQT_SLOT(currentCellChanged(int, int))); + connect(m_dialog->m_ignoreDuplicates, TQT_SIGNAL(stateChanged(int)), + this, TQT_SLOT(ignoreDuplicatesChanged(int))); + connect(m_dialog->m_updateButton, TQT_SIGNAL(clicked()), + this, TQT_SLOT(updateClicked())); + connect(m_dialog->comboBoxEncoding, TQT_SIGNAL(textChanged ( const TQString & )), + this, TQT_SLOT(encodingChanged ( const TQString & ) )); } CSVImportDialog::~CSVImportDialog() { - kapp->setOverrideCursor(Qt::waitCursor); + kapp->setOverrideCursor(TQt::waitCursor); } @@ -153,11 +153,11 @@ int CSVImportDialog::cols() } -QString CSVImportDialog::text(int row, int col) +TQString CSVImportDialog::text(int row, int col) { // Check for overflow. if ( row >= rows() || col >= cols()) - return QString::null; + return TQString(); return m_dialog->m_sheet->text( row - m_startRow, col - m_startCol ); } @@ -170,13 +170,13 @@ void CSVImportDialog::fillTable( ) { int row, column; bool lastCharDelimiter = false; - enum { S_START, S_QUOTED_FIELD, S_MAYBE_END_OF_QUOTED_FIELD, S_END_OF_QUOTED_FIELD, + enum { S_START, S_TQUOTED_FIELD, S_MAYBE_END_OF_TQUOTED_FIELD, S_END_OF_TQUOTED_FIELD, S_MAYBE_NORMAL_FIELD, S_NORMAL_FIELD } state = S_START; - QChar x; - QString field; + TQChar x; + TQString field; - kapp->setOverrideCursor(Qt::waitCursor); + kapp->setOverrideCursor(TQt::waitCursor); for (row = 0; row < m_dialog->m_sheet->numRows(); ++row) for (column = 0; column < m_dialog->m_sheet->numCols(); ++column) @@ -184,7 +184,7 @@ void CSVImportDialog::fillTable( ) int maxColumn = 1; row = column = 1; - QTextStream inputStream(m_fileArray, IO_ReadOnly); + TQTextStream inputStream(m_fileArray, IO_ReadOnly); kdDebug(30501) << "Encoding: " << m_codec->name() << endl; inputStream.setCodec( m_codec ); @@ -206,7 +206,7 @@ void CSVImportDialog::fillTable( ) lastCharWasCr = false; continue; } - else if ( x == QChar( 0xc ) ) + else if ( x == TQChar( 0xc ) ) { // We have a FormFeed, skip it lastCharWasCr = false; @@ -225,7 +225,7 @@ void CSVImportDialog::fillTable( ) case S_START : if (x == m_textquote) { - state = S_QUOTED_FIELD; + state = S_TQUOTED_FIELD; } else if (x == m_delimiter) { @@ -246,15 +246,15 @@ void CSVImportDialog::fillTable( ) state = S_MAYBE_NORMAL_FIELD; } break; - case S_QUOTED_FIELD : + case S_TQUOTED_FIELD : if (x == m_textquote) { - state = S_MAYBE_END_OF_QUOTED_FIELD; + state = S_MAYBE_END_OF_TQUOTED_FIELD; } else if (x == '\n') { setText(row - m_startRow, column - m_startCol, field); - field = QString::null; + field = TQString(); ++row; column = 1; @@ -268,16 +268,16 @@ void CSVImportDialog::fillTable( ) field += x; } break; - case S_MAYBE_END_OF_QUOTED_FIELD : + case S_MAYBE_END_OF_TQUOTED_FIELD : if (x == m_textquote) { field += x; - state = S_QUOTED_FIELD; + state = S_TQUOTED_FIELD; } else if (x == m_delimiter || x == '\n') { setText(row - m_startRow, column - m_startCol, field); - field = QString::null; + field = TQString(); if (x == '\n') { ++row; @@ -295,14 +295,14 @@ void CSVImportDialog::fillTable( ) } else { - state = S_END_OF_QUOTED_FIELD; + state = S_END_OF_TQUOTED_FIELD; } break; - case S_END_OF_QUOTED_FIELD : + case S_END_OF_TQUOTED_FIELD : if (x == m_delimiter || x == '\n') { setText(row - m_startRow, column - m_startCol, field); - field = QString::null; + field = TQString(); if (x == '\n') { ++row; @@ -320,21 +320,21 @@ void CSVImportDialog::fillTable( ) } else { - state = S_END_OF_QUOTED_FIELD; + state = S_END_OF_TQUOTED_FIELD; } break; case S_MAYBE_NORMAL_FIELD : if (x == m_textquote) { - field = QString::null; - state = S_QUOTED_FIELD; + field = TQString(); + state = S_TQUOTED_FIELD; break; } case S_NORMAL_FIELD : if (x == m_delimiter || x == '\n') { setText(row - m_startRow, column - m_startCol, field); - field = QString::null; + field = TQString(); if (x == '\n') { ++row; @@ -364,7 +364,7 @@ void CSVImportDialog::fillTable( ) // the last line of the file had not any line end setText(row - m_startRow, column - m_startCol, field); ++row; - field = QString::null; + field = TQString(); } m_adjustCols = true; @@ -377,8 +377,8 @@ void CSVImportDialog::fillTable( ) for (column = 0; column < m_dialog->m_sheet->numCols(); ++column) { - const QString header = m_dialog->m_sheet->horizontalHeader()->label(column); - if ( m_formatList.find( header ) == m_formatList.end() ) + const TQString header = m_dialog->m_sheet->horizontalHeader()->label(column); + if ( m_formatList.tqfind( header ) == m_formatList.end() ) m_dialog->m_sheet->horizontalHeader()->setLabel(column, i18n("Text")); m_dialog->m_sheet->adjustColumn(column); @@ -413,7 +413,7 @@ void CSVImportDialog::fillComboBox() int CSVImportDialog::headerType(int col) { - QString header = m_dialog->m_sheet->horizontalHeader()->label(col); + TQString header = m_dialog->m_sheet->horizontalHeader()->label(col); if (header == i18n("Text")) return TEXT; @@ -431,7 +431,7 @@ int CSVImportDialog::headerType(int col) return TEXT; // Should not happen } -void CSVImportDialog::setText(int row, int col, const QString& text) +void CSVImportDialog::setText(int row, int col, const TQString& text) { if ( row < 1 || col < 1 ) // skipped by the user return; @@ -492,18 +492,18 @@ void CSVImportDialog::returnPressed() fillTable(); } -void CSVImportDialog::textChanged ( const QString & ) +void CSVImportDialog::textChanged ( const TQString & ) { m_dialog->m_radioOther->setChecked ( true ); delimiterClicked(4); // other } -void CSVImportDialog::formatChanged( const QString& newValue ) +void CSVImportDialog::formatChanged( const TQString& newValue ) { //kdDebug(30501) << "CSVImportDialog::formatChanged:" << newValue << endl; for ( int i = 0; i < m_dialog->m_sheet->numSelections(); ++i ) { - QTableSelection select ( m_dialog->m_sheet->selection( i ) ); + TQTableSelection select ( m_dialog->m_sheet->selection( i ) ); for ( int j = select.leftCol(); j <= select.rightCol() ; ++j ) { m_dialog->m_sheet->horizontalHeader()->setLabel( j, newValue ); @@ -536,7 +536,7 @@ void CSVImportDialog::delimiterClicked(int id) fillTable(); } -void CSVImportDialog::textquoteSelected(const QString& mark) +void CSVImportDialog::textquoteSelected(const TQString& mark) { if (mark == i18n("None")) m_textquote = 0; @@ -574,7 +574,7 @@ bool CSVImportDialog::checkUpdateRange() void CSVImportDialog::currentCellChanged(int, int col) { - const QString header = m_dialog->m_sheet->horizontalHeader()->label(col); + const TQString header = m_dialog->m_sheet->horizontalHeader()->label(col); m_dialog->m_formatComboBox->setCurrentText( header ); } @@ -587,15 +587,15 @@ void CSVImportDialog::ignoreDuplicatesChanged(int) fillTable(); } -QTextCodec* CSVImportDialog::getCodec(void) const +TQTextCodec* CSVImportDialog::getCodec(void) const { - const QString strCodec( KGlobal::charsets()->encodingForName( m_dialog->comboBoxEncoding->currentText() ) ); + const TQString strCodec( KGlobal::charsets()->encodingForName( m_dialog->comboBoxEncoding->currentText() ) ); kdDebug(30502) << "Encoding: " << strCodec << endl; bool ok = false; - QTextCodec* codec = QTextCodec::codecForName( strCodec.utf8() ); + TQTextCodec* codec = TQTextCodec::codecForName( strCodec.utf8() ); - // If QTextCodec has not found a valid encoding, so try with KCharsets. + // If TQTextCodec has not found a valid encoding, so try with KCharsets. if ( codec ) { ok = true; @@ -610,17 +610,17 @@ QTextCodec* CSVImportDialog::getCodec(void) const { // Default: UTF-8 kdWarning(30502) << "Cannot find encoding:" << strCodec << endl; - // ### TODO: what parent to use? - KMessageBox::error( 0, i18n("Cannot find encoding: %1").arg( strCodec ) ); + // ### TODO: what tqparent to use? + KMessageBox::error( 0, i18n("Cannot find encoding: %1").tqarg( strCodec ) ); return 0; } return codec; } -void CSVImportDialog::encodingChanged ( const QString & ) +void CSVImportDialog::encodingChanged ( const TQString & ) { - QTextCodec* codec = getCodec(); + TQTextCodec* codec = getCodec(); if ( codec ) { |