summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-27 23:23:17 (UTC)
committer zautrix <zautrix>2005-04-27 23:23:17 (UTC)
commit1540fc9be514330c76c999562fcf3e6bc1e2ffbb (patch) (side-by-side diff)
treeade066f57be45f0d9783c0efa4e869fee337dd51
parent3978688cbe832e2b72c8048b96c9a7c43ce11bc9 (diff)
downloadkdepimpi-1540fc9be514330c76c999562fcf3e6bc1e2ffbb.zip
kdepimpi-1540fc9be514330c76c999562fcf3e6bc1e2ffbb.tar.gz
kdepimpi-1540fc9be514330c76c999562fcf3e6bc1e2ffbb.tar.bz2
csv fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt9
-rw-r--r--bin/kdepim/kaddressbook/germantranslation.txt8
-rw-r--r--kaddressbook/xxport/csvimportdialog.cpp73
-rw-r--r--kaddressbook/xxport/csvimportdialog.h4
-rw-r--r--microkde/kfiledialog.cpp5
-rw-r--r--microkde/kio/kfile/kurlrequester.cpp2
6 files changed, 79 insertions, 22 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index fdcfab1..41b2a81 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,8 +1,17 @@
Info about the changes in new versions of KDE-Pim/Pi
+********** VERSION 2.1.3 ************
+
+Changed the menu structure of the alarm applet:
+Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List".
+
+Fixed several problems in the KA/Pi CSV import dialog:
+Added "Category", made codec configureable and made it possible to map many fields to the "Note" field.
+
+
********** VERSION 2.1.2 ************
Fixed a problem closing the alarm dialog on Zaurus with "OK" button.
Fixed a problem when importing data from Outlook with mutiple categories set.
diff --git a/bin/kdepim/kaddressbook/germantranslation.txt b/bin/kdepim/kaddressbook/germantranslation.txt
index ef4ab3f..899203e 100644
--- a/bin/kdepim/kaddressbook/germantranslation.txt
+++ b/bin/kdepim/kaddressbook/germantranslation.txt
@@ -282,15 +282,15 @@
{ "Personal","Persönl." },
{ "Organization","Organisation" },
{ "Custom","Benutzerdefiniert" },
{ "&Selected\nfields:","&Selektierte\nFelder:" },
{ "Formatted Name","Format. Name" },
{ "Additional Names","Mittelname" },
-{ "Honorific Prefixes","Namen Prefix" },
-{ "Honorific Suffixes","Namen Suffix" },
-{ "Nick Name","Sptitzname" },
+{ "Honorific Prefixes","Namensprefix" },
+{ "Honorific Suffixes","Namenssuffix" },
+{ "Nick Name","Spitzname" },
{ "Birthday","Geburtstag" },
{ "Home Address Street","Privat Adresse Strasse" },
{ "Home Address Locality","Privat Adresse Stadt" },
{ "Home Address Region","Privat Adresse Bundesland" },
{ "Home Address Postal Code","Privat Adresse PLZ" },
{ "Home Address Country","Privat Adresse Land" },
@@ -306,13 +306,13 @@
{ "Mobile Phone","Handy" },
{ "Home Fax","Privat Fax" },
{ "Business Fax","Büro Fax" },
{ "Car Phone","Autotelefon" },
{ "ISDN","ISDN" },
{ "Pager","Pager" },
-{ "Mail Client","Mail Client" },
+{ "Mail Client","Mail Klient" },
{ "Title","Titel" },
{ "Role","Rolle" },
{ "Note","Notiz" },
{ "URL","URL" },
{ "Resource","Resource" },
{ "SIP","SIP" },
diff --git a/kaddressbook/xxport/csvimportdialog.cpp b/kaddressbook/xxport/csvimportdialog.cpp
index cc55a24..41e2612 100644
--- a/kaddressbook/xxport/csvimportdialog.cpp
+++ b/kaddressbook/xxport/csvimportdialog.cpp
@@ -119,12 +119,13 @@ CSVImportDialog::CSVImportDialog( KABC::AddressBook *ab, QWidget *parent,
mTypeMap.insert( KABC::Addressee::mailerLabel(), Mailer );
mTypeMap.insert( KABC::Addressee::titleLabel(), Title );
mTypeMap.insert( KABC::Addressee::roleLabel(), Role );
mTypeMap.insert( KABC::Addressee::organizationLabel(), Organization );
mTypeMap.insert( KABC::Addressee::noteLabel(), Note );
mTypeMap.insert( KABC::Addressee::urlLabel(), URL );
+ mTypeMap.insert( KABC::Addressee::categoryLabel(), Categories );
mCustomCounter = mTypeMap.count();
int count = mCustomCounter;
KABC::Field::List fields = mAddressBook->fields( KABC::Field::CustomCategory );
KABC::Field::List::Iterator it;
@@ -136,12 +137,14 @@ CSVImportDialog::CSVImportDialog( KABC::AddressBook *ab, QWidget *parent,
connect( mDelimiterEdit, SIGNAL( returnPressed() ),
this, SLOT( returnPressed() ) );
connect( mDelimiterEdit, SIGNAL( textChanged ( const QString& ) ),
this, SLOT( textChanged ( const QString& ) ) );
connect( mComboLine, SIGNAL( activated( const QString& ) ),
this, SLOT( lineSelected( const QString& ) ) );
+ connect( mComboCodec, SIGNAL( activated( const QString& ) ),
+ this, SLOT( codecChanged( const QString& ) ) );
connect( mComboQuote, SIGNAL( activated( const QString& ) ),
this, SLOT( textquoteSelected( const QString& ) ) );
connect( mIgnoreDuplicates, SIGNAL( stateChanged( int ) ),
this, SLOT( ignoreDuplicatesChanged( int ) ) );
connect( mUrlRequester, SIGNAL( returnPressed( const QString& ) ),
@@ -246,15 +249,21 @@ KABC::AddresseeList CSVImportDialog::contacts() const
a.setUrl( value );
break;
case Organization:
a.setOrganization( value );
break;
case Note:
- a.setNote( value );
+ if ( a.note().isEmpty() )
+ a.setNote( value );
+ else {
+ a.setNote( a.note()+"\n"+value );
+ }
+ break;
+ case Categories:
+ a.insertCategory( value );
break;
-
case HomePhone:
if ( !value.isEmpty() ) {
KABC::PhoneNumber number( value, KABC::PhoneNumber::Home );
a.insertPhoneNumber( number );
}
break;
@@ -382,22 +391,22 @@ void CSVImportDialog::initGUI()
hbox->addWidget( label );
mUrlRequester = new KURLRequester( page );
mUrlRequester->setFilter( "*.csv" );
hbox->addWidget( mUrlRequester );
- layout->addMultiCellLayout( hbox, 0, 0, 0, 1 );
+ layout->addMultiCellLayout( hbox, 0, 0, 0, 2 );
// Delimiter: comma, semicolon, tab, space, other
mDelimiterBox = new QButtonGroup( i18n( "Delimiter" ), page );
mDelimiterBox->setColumnLayout( 0, Qt::Vertical );
mDelimiterBox->layout()->setSpacing( spacingHint() );
mDelimiterBox->layout()->setMargin( marginHint() );
QGridLayout *delimiterLayout = new QGridLayout( mDelimiterBox->layout() );
delimiterLayout->setAlignment( Qt::AlignTop );
- layout->addMultiCellWidget( mDelimiterBox, 1, 1, 0, 1 );
+ layout->addMultiCellWidget( mDelimiterBox, 1, 1, 0, 2 );
mRadioComma = new QRadioButton( i18n( "Comma" ), mDelimiterBox );
mRadioComma->setChecked( true );
delimiterLayout->addWidget( mRadioComma, 0, 0 );
mRadioSemicolon = new QRadioButton( i18n( "Semicolon" ), mDelimiterBox );
@@ -421,39 +430,45 @@ void CSVImportDialog::initGUI()
mComboQuote = new QComboBox( false, page );
mComboQuote->insertItem( i18n( "\"" ), 0 );
mComboQuote->insertItem( i18n( "'" ), 1 );
mComboQuote->insertItem( i18n( "None" ), 2 );
layout->addWidget( mComboQuote, 3, 0 );
-
+ mComboCodec = new QComboBox( false, page );
+ mComboCodec->insertItem( i18n( "UTF8" ), 0 );
+ mComboCodec->insertItem( i18n( "LATIN1" ), 1 );
+ mComboCodec->insertItem( i18n( "LOCALE" ), 2 );
+ layout->addWidget( mComboCodec, 3, 2 );
label = new QLabel( i18n( "Start at line:" ), page );
layout->addWidget( label, 2, 1 );
label = new QLabel( i18n( "Textquote:" ), page );
layout->addWidget( label, 2, 0 );
+ label = new QLabel( i18n( "Codec:" ), page );
+ layout->addWidget( label, 2, 2 );
mIgnoreDuplicates = new QCheckBox( page );
mIgnoreDuplicates->setText( i18n( "Ignore duplicate delimiters" ) );
- layout->addMultiCellWidget( mIgnoreDuplicates, 4, 4, 0, 1 );
+ layout->addMultiCellWidget( mIgnoreDuplicates, 4, 4, 0, 2 );
mTable = new QTable( 0, 0, page );
mTable->setSelectionMode( QTable::NoSelection );
//mTable->horizontalHeader()->hide();
- layout->addMultiCellWidget( mTable, 5, 5, 0, 1 );
+ layout->addMultiCellWidget( mTable, 5, 5, 0, 2 );
/*US
setButtonText( User1, i18n( "Apply Template" ) );
setButtonText( User2, i18n( "Save Template" ) );
*/
enableButtonOK( false );
findButton( User1 )->setEnabled( false );
findButton( User2 )->setEnabled( false );
#ifdef DESKTOP_VERSION
- resize( 500, 300 );
+ resize( 640, 480 );
#else
showMaximized();
#endif
}
void CSVImportDialog::fillTable()
@@ -480,16 +495,29 @@ void CSVImportDialog::fillTable()
mTypeStore.append( item->currentItem() );
}
clearTable();
row = column = 1;
- mData = QString( mFileArray );
+ if ( mComboCodec->currentItem () == 0 ) {
+ mData = QString::fromUtf8( mFileArray.data() );
+ } else if ( mComboCodec->currentItem () == 1 ) {
+ mData = QString::fromLatin1( mFileArray.data() );
+ } else {
+ mData = QString::fromLocal8Bit( mFileArray.data() );
+ }
QTextStream inputStream( mData, IO_ReadOnly );
- inputStream.setEncoding( QTextStream::Locale );
+
+ if ( mComboCodec->currentItem () == 0 ) {
+ inputStream.setEncoding( QTextStream::UnicodeUTF8 );
+ } else if ( mComboCodec->currentItem () == 1 ) {
+ inputStream.setEncoding( QTextStream::Latin1 );
+ } else {
+ inputStream.setEncoding( QTextStream::Locale );
+ }
int maxColumn = 0;
while ( !inputStream.atEnd() ) {
inputStream >> x; // read one char
if ( x == '\r' ) inputStream >> x; // eat '\r', to handle DOS/LOSEDOWS files correctly
@@ -605,15 +633,20 @@ void CSVImportDialog::fillTable()
adjustRows( row - mStartLine );
mTable->setNumCols( maxColumn );
//US begin
QStringList keys;
+ uint iii = 0, count = mTypeMap.count();
+ while ( iii < count ) {
+ keys << "dummy";
+ ++iii;
+ }
QMap<QString, uint>::ConstIterator it;
for ( it = mTypeMap.begin(); it != mTypeMap.end(); ++it)
- keys << it.key();
+ keys[( it.data() )] = it.key();
//US end
for ( column = 0; column < mTable->numCols(); ++column ) {
//US QComboTableItem *item = new QComboTableItem( mTable, mTypeMap.keys() );
QComboTableItem *item = new QComboTableItem( mTable, keys );
@@ -679,12 +712,16 @@ void CSVImportDialog::returnPressed()
void CSVImportDialog::textChanged ( const QString& )
{
mRadioOther->setChecked ( true );
delimiterClicked( 4 ); // other
}
+void CSVImportDialog::codecChanged ( const QString& )
+{
+ fillTable();
+}
void CSVImportDialog::delimiterClicked( int id )
{
switch ( id ) {
case 0: // comma
mDelimiter = ",";
@@ -751,29 +788,29 @@ void CSVImportDialog::applyTemplate()
*/
QStringList list = KGlobal::dirs()->findAllResources( "data" , KGlobal::getAppName() +
"/csv-templates/*.desktop", true, true );
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
{
- qDebug("for ");
+
//US KSimpleConfig config( *it, true );
KConfig config( *it );
if ( !config.hasGroup( "csv column map" ) )
continue;
config.setGroup( "Misc" );
templates.append( config.readEntry( "Name" ) );
fileMap.insert( config.readEntry( "Name" ), *it );
}
- qDebug("weiter ");
+
// let the user chose, what to take
bool ok = false;
QString tmp;
tmp = QInputDialog::getItem( i18n( "Template Selection" ),
- i18n( "Please select a template, that matches the CSV file." ),
+ i18n( "Please select a template\nthat matches the CSV file." ),
templates, 0, false, &ok, this );
if ( !ok )
return;
//US KSimpleConfig config( fileMap[ tmp ], true );
@@ -817,13 +854,13 @@ void CSVImportDialog::saveTemplate()
locateLocal( "data", KGlobal::getAppName() + "/csv-templates/" )+
"*.desktop",i18n("Save file name") , this );
if ( fileName.isEmpty() )
return;
- if ( !fileName.contains( ".desktop" ) )
+ if ( !fileName.contains( ".desktop" ) )
fileName += ".desktop";
QString name = QInputDialog::getText( i18n( "Template name" ), i18n( "Please enter a name for the template" ) );
if ( name.isEmpty() )
return;
@@ -857,30 +894,36 @@ QString CSVImportDialog::getText( int row, int col )
{
return mTable->text( row, col );
}
uint CSVImportDialog::posToType( int pos ) const
{
+ return pos;
+#if 0
uint counter = 0;
QMap<QString, uint>::ConstIterator it;
for ( it = mTypeMap.begin(); it != mTypeMap.end(); ++it, ++counter )
if ( counter == (uint)pos )
return it.data();
return 0;
+#endif
}
int CSVImportDialog::typeToPos( uint type ) const
{
+ return type;
+#if 0
uint counter = 0;
QMap<QString, uint>::ConstIterator it;
for ( it = mTypeMap.begin(); it != mTypeMap.end(); ++it, ++counter )
if ( it.data() == type )
return counter;
return -1;
+#endif
}
void CSVImportDialog::ignoreDuplicatesChanged( int )
{
fillTable();
}
diff --git a/kaddressbook/xxport/csvimportdialog.h b/kaddressbook/xxport/csvimportdialog.h
index 545b5f9..5f55ab2 100644
--- a/kaddressbook/xxport/csvimportdialog.h
+++ b/kaddressbook/xxport/csvimportdialog.h
@@ -65,12 +65,13 @@ class CSVImportDialog : public KDialogBase
void lineSelected( const QString& line );
void textquoteSelected( const QString& mark );
void textChanged ( const QString & );
void ignoreDuplicatesChanged( int );
void setFile( const QString& );
void urlChanged( const QString& );
+ void codecChanged ( const QString& );
void applyTemplate();
void saveTemplate();
private:
enum { Undefined, FormattedName, FamilyName, GivenName, AdditionalName,
@@ -78,25 +79,26 @@ class CSVImportDialog : public KDialogBase
HomeAddressStreet, HomeAddressLocality, HomeAddressRegion,
HomeAddressPostalCode, HomeAddressCountry, HomeAddressLabel,
BusinessAddressStreet, BusinessAddressLocality, BusinessAddressRegion,
BusinessAddressPostalCode, BusinessAddressCountry,
BusinessAddressLabel,
HomePhone, BusinessPhone, MobilePhone, HomeFax, BusinessFax, CarPhone,
- Isdn, Pager, Email, Mailer, Title, Role, Organization, Note, URL
+ Isdn, Pager, Email, Mailer, Title, Role, Organization, Note, URL, Categories
};
QTable* mTable;
QButtonGroup* mDelimiterBox;
QRadioButton* mRadioComma;
QRadioButton* mRadioSemicolon;
QRadioButton* mRadioTab;
QRadioButton* mRadioSpace;
QRadioButton* mRadioOther;
QLineEdit* mDelimiterEdit;
QComboBox* mComboLine;
QComboBox* mComboQuote;
+ QComboBox* mComboCodec;
QCheckBox* mIgnoreDuplicates;
KURLRequester* mUrlRequester;
void initGUI();
void fillTable();
void clearTable();
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp
index 3f47425..6be1580 100644
--- a/microkde/kfiledialog.cpp
+++ b/microkde/kfiledialog.cpp
@@ -23,13 +23,16 @@ QString KFileDialog::getSaveFileName( const QString & fn,
OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() );
QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) );
lay.addWidget( &o);
// o.setNewVisible( true );
// o.setNameVisible( true );
dia.showMaximized();
- dia.setCaption( cap );
+ if ( cap.isEmpty() )
+ dia.setCaption( file );
+ else
+ dia.setCaption( cap );
int res = dia.exec();
if ( res )
retfile = o.selectedName();
return retfile;
}
diff --git a/microkde/kio/kfile/kurlrequester.cpp b/microkde/kio/kfile/kurlrequester.cpp
index 6d39308..991c8be 100644
--- a/microkde/kio/kfile/kurlrequester.cpp
+++ b/microkde/kio/kfile/kurlrequester.cpp
@@ -269,13 +269,13 @@ void KURLRequester::slotOpenDialog()
emit openFileDialog( this );
//US use our special KFIleDialog instead
KURL u( url() );
//QString fn = u.url();
QString fn = d->edit->text();
- fn = KFileDialog::getSaveFileName( fn, "Save backup filename", this );
+ fn = KFileDialog::getSaveFileName( fn, "", this );
if ( fn == "" )
return;
setURL( fn );
emit urlSelected( d->url() );