summaryrefslogtreecommitdiffstats
path: root/libkdepim/kimportdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkdepim/kimportdialog.cpp')
-rw-r--r--libkdepim/kimportdialog.cpp206
1 files changed, 103 insertions, 103 deletions
diff --git a/libkdepim/kimportdialog.cpp b/libkdepim/kimportdialog.cpp
index d270ae6eb..ffccd5008 100644
--- a/libkdepim/kimportdialog.cpp
+++ b/libkdepim/kimportdialog.cpp
@@ -24,17 +24,17 @@
// class. Application specific code should go to a subclass provided by the
// application using this dialog.
-#include <qbuttongroup.h>
-#include <qfile.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qlineedit.h>
-#include <qlistview.h>
-#include <qradiobutton.h>
-#include <qregexp.h>
-#include <qtable.h>
-#include <qtextstream.h>
-#include <qvbox.h>
+#include <tqbuttongroup.h>
+#include <tqfile.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqlineedit.h>
+#include <tqlistview.h>
+#include <tqradiobutton.h>
+#include <tqregexp.h>
+#include <tqtable.h>
+#include <tqtextstream.h>
+#include <tqvbox.h>
#include <kapplication.h>
#include <kdebug.h>
@@ -51,7 +51,7 @@
#include "kimportdialog.h"
#include "kimportdialog.moc"
-KImportColumn::KImportColumn(KImportDialog *dlg,const QString &header, int count)
+KImportColumn::KImportColumn(KImportDialog *dlg,const TQString &header, int count)
: m_maxCount(count),
m_refCount(0),
m_header(header),
@@ -66,12 +66,12 @@ KImportColumn::KImportColumn(KImportDialog *dlg,const QString &header, int count
mDialog->addColumn(this);
}
-QValueList<int> KImportColumn::formats()
+TQValueList<int> KImportColumn::formats()
{
return mFormats;
}
-QString KImportColumn::formatName(int format)
+TQString KImportColumn::formatName(int format)
{
switch (format) {
case FormatPlain:
@@ -90,7 +90,7 @@ int KImportColumn::defaultFormat()
return mDefaultFormat;
}
-QString KImportColumn::preview(const QString &value, int format)
+TQString KImportColumn::preview(const TQString &value, int format)
{
if (format == FormatBracketed) {
return "(" + value + ")";
@@ -115,22 +115,22 @@ void KImportColumn::removeColId(int id)
mColIds.remove(id);
}
-QValueList<int> KImportColumn::colIdList()
+TQValueList<int> KImportColumn::colIdList()
{
return mColIds;
}
-QString KImportColumn::convert()
+TQString KImportColumn::convert()
{
- QValueList<int>::ConstIterator it = mColIds.begin();
+ TQValueList<int>::ConstIterator it = mColIds.begin();
if (it == mColIds.end()) return "";
else return mDialog->cell(*it);
}
-class ColumnItem : public QListViewItem {
+class ColumnItem : public TQListViewItem {
public:
- ColumnItem(KImportColumn *col,QListView *parent) : QListViewItem(parent), mColumn(col)
+ ColumnItem(KImportColumn *col,TQListView *parent) : TQListViewItem(parent), mColumn(col)
{
setText(0,mColumn->header());
}
@@ -148,36 +148,36 @@ class ColumnItem : public QListViewItem {
data objects, this class has to be inherited by a special class, which
reimplements the convertRow() function.
*/
-KImportDialog::KImportDialog(QWidget* parent)
+KImportDialog::KImportDialog(TQWidget* parent)
: KDialogBase(parent,"importdialog",true,i18n("Import Text File"),Ok|Cancel),
mSeparator(","),
mCurrentRow(0)
{
mData.setAutoDelete( true );
- QVBox *topBox = new QVBox(this);
+ TQVBox *topBox = new TQVBox(this);
setMainWidget(topBox);
topBox->setSpacing(spacingHint());
- QHBox *fileBox = new QHBox(topBox);
+ TQHBox *fileBox = new TQHBox(topBox);
fileBox->setSpacing(spacingHint());
- new QLabel(i18n("File to import:"),fileBox);
+ new TQLabel(i18n("File to import:"),fileBox);
KURLRequester *urlRequester = new KURLRequester(fileBox);
urlRequester->setFilter( "*.csv" );
- connect(urlRequester,SIGNAL(returnPressed(const QString &)),
- SLOT(setFile(const QString &)));
- connect(urlRequester,SIGNAL(urlSelected(const QString &)),
- SLOT(setFile(const QString &)));
- connect(urlRequester->lineEdit(),SIGNAL(textChanged ( const QString & )),
- SLOT(slotUrlChanged(const QString & )));
- mTable = new QTable(5,5,topBox);
+ connect(urlRequester,TQT_SIGNAL(returnPressed(const TQString &)),
+ TQT_SLOT(setFile(const TQString &)));
+ connect(urlRequester,TQT_SIGNAL(urlSelected(const TQString &)),
+ TQT_SLOT(setFile(const TQString &)));
+ connect(urlRequester->lineEdit(),TQT_SIGNAL(textChanged ( const TQString & )),
+ TQT_SLOT(slotUrlChanged(const TQString & )));
+ mTable = new TQTable(5,5,topBox);
mTable->setMinimumHeight( 150 );
- connect(mTable,SIGNAL(selectionChanged()),SLOT(tableSelected()));
+ connect(mTable,TQT_SIGNAL(selectionChanged()),TQT_SLOT(tableSelected()));
- QHBox *separatorBox = new QHBox( topBox );
+ TQHBox *separatorBox = new TQHBox( topBox );
separatorBox->setSpacing( spacingHint() );
- new QLabel( i18n( "Separator:" ), separatorBox );
+ new TQLabel( i18n( "Separator:" ), separatorBox );
mSeparatorCombo = new KComboBox( separatorBox );
mSeparatorCombo->insertItem( "," );
@@ -185,75 +185,75 @@ KImportDialog::KImportDialog(QWidget* parent)
mSeparatorCombo->insertItem( i18n( "Space" ) );
mSeparatorCombo->insertItem( "=" );
mSeparatorCombo->insertItem( ";" );
- connect(mSeparatorCombo, SIGNAL( activated(int) ),
- this, SLOT( separatorClicked(int) ) );
+ connect(mSeparatorCombo, TQT_SIGNAL( activated(int) ),
+ this, TQT_SLOT( separatorClicked(int) ) );
mSeparatorCombo->setCurrentItem( 0 );
- QHBox *rowsBox = new QHBox( topBox );
+ TQHBox *rowsBox = new TQHBox( topBox );
rowsBox->setSpacing( spacingHint() );
- new QLabel( i18n( "Import starts at row:" ), rowsBox );
- mStartRow = new QSpinBox( rowsBox );
+ new TQLabel( i18n( "Import starts at row:" ), rowsBox );
+ mStartRow = new TQSpinBox( rowsBox );
mStartRow->setMinValue( 1 );
/*
- new QLabel( i18n( "And ends at row:" ), rowsBox );
- mEndRow = new QSpinBox( rowsBox );
+ new TQLabel( i18n( "And ends at row:" ), rowsBox );
+ mEndRow = new TQSpinBox( rowsBox );
mEndRow->setMinValue( 1 );
*/
- QVBox *assignBox = new QVBox(topBox);
+ TQVBox *assignBox = new TQVBox(topBox);
assignBox->setSpacing(spacingHint());
- QHBox *listsBox = new QHBox(assignBox);
+ TQHBox *listsBox = new TQHBox(assignBox);
listsBox->setSpacing(spacingHint());
- mHeaderList = new QListView(listsBox);
+ mHeaderList = new TQListView(listsBox);
mHeaderList->addColumn(i18n("Header"));
- connect(mHeaderList, SIGNAL(selectionChanged(QListViewItem*)),
- this, SLOT(headerSelected(QListViewItem*)));
- connect(mHeaderList,SIGNAL(doubleClicked(QListViewItem*)),
- SLOT(assignColumn(QListViewItem *)));
+ connect(mHeaderList, TQT_SIGNAL(selectionChanged(TQListViewItem*)),
+ this, TQT_SLOT(headerSelected(TQListViewItem*)));
+ connect(mHeaderList,TQT_SIGNAL(doubleClicked(TQListViewItem*)),
+ TQT_SLOT(assignColumn(TQListViewItem *)));
mFormatCombo = new KComboBox( listsBox );
mFormatCombo->setDuplicatesEnabled( false );
- QPushButton *assignButton = new QPushButton(i18n("Assign to Selected Column"),
+ TQPushButton *assignButton = new TQPushButton(i18n("Assign to Selected Column"),
assignBox);
- connect(assignButton,SIGNAL(clicked()),SLOT(assignColumn()));
+ connect(assignButton,TQT_SIGNAL(clicked()),TQT_SLOT(assignColumn()));
- QPushButton *removeButton = new QPushButton(i18n("Remove Assignment From Selected Column"),
+ TQPushButton *removeButton = new TQPushButton(i18n("Remove Assignment From Selected Column"),
assignBox);
- connect(removeButton,SIGNAL(clicked()),SLOT(removeColumn()));
+ connect(removeButton,TQT_SIGNAL(clicked()),TQT_SLOT(removeColumn()));
- QPushButton *assignTemplateButton = new QPushButton(i18n("Assign with Template..."),
+ TQPushButton *assignTemplateButton = new TQPushButton(i18n("Assign with Template..."),
assignBox);
- connect(assignTemplateButton,SIGNAL(clicked()),SLOT(assignTemplate()));
+ connect(assignTemplateButton,TQT_SIGNAL(clicked()),TQT_SLOT(assignTemplate()));
- QPushButton *saveTemplateButton = new QPushButton(i18n("Save Current Template"),
+ TQPushButton *saveTemplateButton = new TQPushButton(i18n("Save Current Template"),
assignBox);
- connect(saveTemplateButton,SIGNAL(clicked()),SLOT(saveTemplate()));
+ connect(saveTemplateButton,TQT_SIGNAL(clicked()),TQT_SLOT(saveTemplate()));
resize(500,300);
- connect(this,SIGNAL(okClicked()),SLOT(applyConverter()));
- connect(this,SIGNAL(applyClicked()),SLOT(applyConverter()));
+ connect(this,TQT_SIGNAL(okClicked()),TQT_SLOT(applyConverter()));
+ connect(this,TQT_SIGNAL(applyClicked()),TQT_SLOT(applyConverter()));
enableButtonOK(!urlRequester->lineEdit()->text().isEmpty());
}
-void KImportDialog::slotUrlChanged(const QString & text)
+void KImportDialog::slotUrlChanged(const TQString & text)
{
enableButtonOK(!text.isEmpty());
}
-bool KImportDialog::setFile(const QString& file)
+bool KImportDialog::setFile(const TQString& file)
{
enableButtonOK(!file.isEmpty());
kdDebug(5300) << "KImportDialog::setFile(): " << file << endl;
- QFile f(file);
+ TQFile f(file);
if (f.open(IO_ReadOnly)) {
mFile = "";
- QTextStream t(&f);
+ TQTextStream t(&f);
mFile = t.read();
// while (!t.eof()) mFile.append(t.readLine());
f.close();
@@ -271,7 +271,7 @@ bool KImportDialog::setFile(const QString& file)
void KImportDialog::registerColumns()
{
- QPtrListIterator<KImportColumn> colIt(mColumns);
+ TQPtrListIterator<KImportColumn> colIt(mColumns);
for (; colIt.current(); ++colIt) {
new ColumnItem(*colIt,mHeaderList);
}
@@ -289,7 +289,7 @@ void KImportDialog::fillTable()
mTable->clearCell(row, column);
for ( row = 0; row < int(mData.count()); ++row ) {
- QValueVector<QString> *rowVector = mData[ row ];
+ TQValueVector<TQString> *rowVector = mData[ row ];
for( column = 0; column < int(rowVector->size()); ++column ) {
setCellText( row, column, rowVector->at( column ) );
}
@@ -306,15 +306,15 @@ void KImportDialog::readFile( int rows )
enum { S_START, S_QUOTED_FIELD, S_MAYBE_END_OF_QUOTED_FIELD, S_END_OF_QUOTED_FIELD,
S_MAYBE_NORMAL_FIELD, S_NORMAL_FIELD } state = S_START;
- QChar m_textquote = '"';
+ TQChar m_textquote = '"';
int m_startline = 0;
- QChar x;
- QString field = "";
+ TQChar x;
+ TQString field = "";
row = column = 0;
- QTextStream inputStream(mFile, IO_ReadOnly);
- inputStream.setEncoding(QTextStream::Locale);
+ TQTextStream inputStream(mFile, IO_ReadOnly);
+ inputStream.setEncoding(TQTextStream::Locale);
KProgressDialog pDialog(this, 0, i18n("Loading Progress"),
i18n("Please wait while the file is loaded."), true);
@@ -436,7 +436,7 @@ void KImportDialog::readFile( int rows )
fillTable();
}
-void KImportDialog::setCellText(int row, int col, const QString& text)
+void KImportDialog::setCellText(int row, int col, const TQString& text)
{
if (row < 0) return;
@@ -444,18 +444,18 @@ void KImportDialog::setCellText(int row, int col, const QString& text)
if ((mTable->numCols() - 1) < col) mTable->setNumCols(col + 1);
KImportColumn *c = mColumnDict.find(col);
- QString formattedText;
+ TQString formattedText;
if (c) formattedText = c->preview(text,findFormat(col));
else formattedText = text;
mTable->setText(row, col, formattedText);
}
-void KImportDialog::formatSelected(QListViewItem*)
+void KImportDialog::formatSelected(TQListViewItem*)
{
// kdDebug(5300) << "KImportDialog::formatSelected()" << endl;
}
-void KImportDialog::headerSelected(QListViewItem* item)
+void KImportDialog::headerSelected(TQListViewItem* item)
{
KImportColumn *col = ((ColumnItem *)item)->column();
@@ -463,16 +463,16 @@ void KImportDialog::headerSelected(QListViewItem* item)
mFormatCombo->clear();
- QValueList<int> formats = col->formats();
+ TQValueList<int> formats = col->formats();
- QValueList<int>::ConstIterator it = formats.begin();
- QValueList<int>::ConstIterator end = formats.end();
+ TQValueList<int>::ConstIterator it = formats.begin();
+ TQValueList<int>::ConstIterator end = formats.end();
while(it != end) {
mFormatCombo->insertItem( col->formatName(*it), *it - 1 );
++it;
}
- QTableSelection selection = mTable->selection(mTable->currentSelection());
+ TQTableSelection selection = mTable->selection(mTable->currentSelection());
updateFormatSelection(selection.leftCol());
}
@@ -489,9 +489,9 @@ void KImportDialog::updateFormatSelection(int column)
void KImportDialog::tableSelected()
{
- QTableSelection selection = mTable->selection(mTable->currentSelection());
+ TQTableSelection selection = mTable->selection(mTable->currentSelection());
- QListViewItem *item = mHeaderList->firstChild();
+ TQListViewItem *item = mHeaderList->firstChild();
KImportColumn *col = mColumnDict.find(selection.leftCol());
if (col) {
while(item) {
@@ -534,7 +534,7 @@ void KImportDialog::separatorClicked(int id)
readFile();
}
-void KImportDialog::assignColumn(QListViewItem *item)
+void KImportDialog::assignColumn(TQListViewItem *item)
{
if (!item) return;
@@ -543,7 +543,7 @@ void KImportDialog::assignColumn(QListViewItem *item)
ColumnItem *colItem = (ColumnItem *)item;
- QTableSelection selection = mTable->selection(mTable->currentSelection());
+ TQTableSelection selection = mTable->selection(mTable->currentSelection());
// kdDebug(5300) << " l: " << selection.leftCol() << " r: " << selection.rightCol() << endl;
@@ -567,15 +567,15 @@ void KImportDialog::assignColumn()
void KImportDialog::assignTemplate()
{
- QMap<uint,int> columnMap;
- QMap<QString, QString> fileMap;
- QStringList templates;
+ TQMap<uint,int> columnMap;
+ TQMap<TQString, TQString> fileMap;
+ TQStringList templates;
// load all template files
- QStringList list = KGlobal::dirs()->findAllResources( "data" , QString( kapp->name() ) +
+ TQStringList list = KGlobal::dirs()->findAllResources( "data" , TQString( kapp->name() ) +
"/csv-templates/*.desktop", true, true );
- for ( QStringList::iterator it = list.begin(); it != list.end(); ++it )
+ for ( TQStringList::iterator it = list.begin(); it != list.end(); ++it )
{
KSimpleConfig config( *it, true );
@@ -589,7 +589,7 @@ void KImportDialog::assignTemplate()
// let the user chose, what to take
bool ok = false;
- QString tmp;
+ TQString tmp;
tmp = KInputDialog::getItem( i18n( "Template Selection" ),
i18n( "Please select a template, that matches the CSV file:" ),
templates, 0, false, &ok, this );
@@ -605,7 +605,7 @@ void KImportDialog::assignTemplate()
// create the column map
config.setGroup( "csv column map" );
for ( uint i = 0; i < numColumns; ++i ) {
- int col = config.readNumEntry( QString::number( i ) );
+ int col = config.readNumEntry( TQString::number( i ) );
columnMap.insert( i, col );
}
@@ -626,13 +626,13 @@ void KImportDialog::assignTemplate()
void KImportDialog::removeColumn()
{
- QTableSelection selection = mTable->selection(mTable->currentSelection());
+ TQTableSelection selection = mTable->selection(mTable->currentSelection());
// kdDebug(5300) << " l: " << selection.leftCol() << " r: " << selection.rightCol() << endl;
for(int i=selection.leftCol();i<=selection.rightCol();++i) {
if (i >= 0) {
- mTable->horizontalHeader()->setLabel(i,QString::number(i+1));
+ mTable->horizontalHeader()->setLabel(i,TQString::number(i+1));
KImportColumn *col = mColumnDict.find(i);
if (col) {
mColumnDict.remove(i);
@@ -674,7 +674,7 @@ void KImportDialog::applyConverter()
int KImportDialog::findFormat(int column)
{
- QMap<int,int>::ConstIterator formatIt = mFormats.find(column);
+ TQMap<int,int>::ConstIterator formatIt = mFormats.find(column);
int format;
if (formatIt == mFormats.end()) format = KImportColumn::FormatUndefined;
else format = *formatIt;
@@ -684,7 +684,7 @@ int KImportDialog::findFormat(int column)
return format;
}
-QString KImportDialog::cell(uint col)
+TQString KImportDialog::cell(uint col)
{
if ( col >= mData[ mCurrentRow ]->size() ) return "";
else return data( mCurrentRow, col );
@@ -695,18 +695,18 @@ void KImportDialog::addColumn(KImportColumn *col)
mColumns.append(col);
}
-void KImportDialog::setData( uint row, uint col, const QString &value )
+void KImportDialog::setData( uint row, uint col, const TQString &value )
{
- QString val = value;
+ TQString val = value;
val.replace( "\\n", "\n" );
if ( row >= mData.count() ) {
mData.resize( row + 1 );
}
- QValueVector<QString> *rowVector = mData[ row ];
+ TQValueVector<TQString> *rowVector = mData[ row ];
if ( !rowVector ) {
- rowVector = new QValueVector<QString>;
+ rowVector = new TQValueVector<TQString>;
mData.insert( row, rowVector );
}
if ( col >= rowVector->size() ) {
@@ -720,15 +720,15 @@ void KImportDialog::setData( uint row, uint col, const QString &value )
rowVector->at( col ) = val;
}
-QString KImportDialog::data( uint row, uint col )
+TQString KImportDialog::data( uint row, uint col )
{
return mData[ row ]->at( col );
}
void KImportDialog::saveTemplate()
{
- QString fileName = KFileDialog::getSaveFileName(
- locateLocal( "data", QString( kapp->name() ) + "/csv-templates/" ),
+ TQString fileName = KFileDialog::getSaveFileName(
+ locateLocal( "data", TQString( kapp->name() ) + "/csv-templates/" ),
"*.desktop", this );
if ( fileName.isEmpty() )
@@ -737,7 +737,7 @@ void KImportDialog::saveTemplate()
if ( !fileName.contains( ".desktop" ) )
fileName += ".desktop";
- QString name = KInputDialog::getText( i18n( "Template Name" ), i18n( "Please enter a name for the template:" ) );
+ TQString name = KInputDialog::getText( i18n( "Template Name" ), i18n( "Please enter a name for the template:" ) );
if ( name.isEmpty() )
return;
@@ -755,11 +755,11 @@ void KImportDialog::saveTemplate()
KImportColumn *column;
uint counter = 0;
for ( column = mColumns.first(); column; column = mColumns.next() ) {
- QValueList<int> list = column->colIdList();
+ TQValueList<int> list = column->colIdList();
if ( list.count() > 0 )
- config.writeEntry( QString::number( counter ), list[ 0 ] );
+ config.writeEntry( TQString::number( counter ), list[ 0 ] );
else
- config.writeEntry( QString::number( counter ), -1 );
+ config.writeEntry( TQString::number( counter ), -1 );
counter++;
}