-rw-r--r-- | bin/kdepim/WhatsNew.txt | 9 | ||||
-rw-r--r-- | bin/kdepim/kaddressbook/germantranslation.txt | 8 | ||||
-rw-r--r-- | kaddressbook/xxport/csvimportdialog.cpp | 67 | ||||
-rw-r--r-- | kaddressbook/xxport/csvimportdialog.h | 4 | ||||
-rw-r--r-- | microkde/kfiledialog.cpp | 3 | ||||
-rw-r--r-- | microkde/kio/kfile/kurlrequester.cpp | 2 |
6 files changed, 75 insertions, 18 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,64 +1,73 @@ 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. Changed display of days in datenavigator: Birthdays are now blue, not dark green. When todo view is shown, no birtdays are shown and days with due todos are shown blue. When journal view is shown, only holidays are shown and days with journals are blue. Added Backup options to global config: You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ). It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again. The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups. ********** VERSION 2.1.1 ************ Stable release 2.1.1! KO/Pi: Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. ********** VERSION 2.1.0 ************ Stable release 2.1.0! Summary of changes/fixes compared to version 2.0.6: Many bugs of version 2.0.6 fixed. Most of them were small bugs, but some of them were important. It is recommended to use version 2.1.0 and not version 2.0.6. Important changes: Added recurring todos to KO/Pi. Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. Datenavigator can now display many months. Very useful on the desktop. KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. Made alarm sound working on Linux desktop. Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. Many other usebility enhancements. Special thanks to Ben for his suggestions! You can find the complete changelog from version 1.7.7 to 2.1.0 in the source package or on http://www.pi-sync.net/html/changelog.html 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 @@ -160,281 +160,281 @@ { "Export CSV List...","Exportiere CSV-Datei..." },
{ "Import KDE 2 Addressbook...","Importiere KDE 2 Adressbuch..." },
{ "Import vCard...","Importiere vCard..." },
{ "Export vCard 3.0...","Exportiere vCard 3.0..." },
{ "Import Qtopia...","Importiere Qtopia..." },
{ "Export Qtopia...","Exportiere Qtopia..." },
{ "Edit Contact","Bearbeite Kontakt" },
{ "Ok","Ok" },
{ "Apply","Anwenden" },
{ "Cancel","Abbrechen" },
{ "KAddressbook/Pi","KAdressbuch/Pi" },
{ "No Filter","Kein Filter" },
{ "Given Name","Vorname" },
{ "Family Name","Nachname" },
{ "Email Address","E-Mail Adresse" },
{ "All Fields","Alle Felder" },
{ "Question","Frage" },
{ "After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as "other".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?","After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as "other".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?" },
{ "No","Nein" },
{ "Yes","Ja" },
{ "Synchronization Preferences","Einstellungen der Synchronisationsprofile" },
{ "Local device name:","Name dieses Gerätes:" },
{ "New profile","Neues Profil" },
{ "Clone profile","Klone Profil" },
{ "Delete profile","Lösche Profil" },
{ "Profile:","Profil:" },
{ "Ask for every entry on conflict","Frage bei Konflikten nach"},
{ "Take local entry on conflict","Nimm lokalen Eintrag beim Konflikt" },
{ "Take newest entry on conflict","Nimm neuesten Eintrag beim Konflikt" },
{ "Take remote entry on conflict","Nimm fernen Eintrag beim Konflikt" }
{ "Force: Take local entry always","Erzwinge: Nimm immer lokalen Eintrag" },
{ "Force: Take remote entry always","Erzwinge: Nimm immer fernen Eintrag" },
{ "Show summary after sync","Zeige Zusammenfassung nach dem Synchronisieren" },
{ "Write back file","Schreibe Datei zurück" },
{ "Remote file (w down/upload command)","Entfernte Datei (via down/upload Kommando)" },
{ "Pre sync (download) command:","Bevor Sync (download) Kommando:" },
{ "Local device name:","Name dieses Gerätes:" },
{ "Ask for preferences before sync","Frage nach Synchronisationseinstellungen vor dem Syncen" },
{ "Sync preferences","Synchronisations Einstellungen" },
{ "Profile kind","Profil Art" },
{ "Local file","Lokale Datei" },
{ "Local file:","Lokale Datei:" },
{ "Post sync (upload) command:","Nach Sync (upload) Kommando:" },
{ "Fill in default values for:","Setze Beispiel Werte ein für:" },
{ "Hint: Use $PWD$ for placeholder of password!","Hinweis: Benutze $PWD$ als Platzhalter für ein Passwort!" },
{ "Synchronization Preferences","Einstellungen der Synchronisationsprofile"},
{ "Device","Gerät:" },
{ "Sync with file \n...%1\nfrom:\n%2\n","Sync mit Datei \n...%1\nvom:\n%2\n" },
{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n","Synchronisationsübersicht:\n\n %d items lokal hinzugefügt\n %d items entfernt hinzugefügt\n %d items lokal geändert\n %d items entfernt geändert\n %d items lokal gelöscht\n %d items entfernt gelöscht\n" },
{ "Synchronization successful","Synchronisation erfolgreich" },
{ "Sync cancelled or failed. Nothing synced.","Sync abgebrochen oder fehlgeschlagen. Nichts wurde gesynced." },
{ "Sync file \n...%1\ndoes not exist!\nNothing synced!\n","Sync Datei \n...%1\nexistiert nicht!\nNichts wurde gesynced!\n" },
{ "Sync filename(*.ics/*.vcs)","Sync Dateiname(*.ics/*.vcs)" },
{ "Enter password","Passwort eingeben" },
{ "Do you really want\nto remote sync\nwith profile \n","Wollen Sie wirklich\nmit dem entfernten\nProfil syncen: \n" },
{ "Copy remote file to local machine...","Kopiere entfernte Datei auf lokalen Rechner..." },
{ "Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n","Sorry, das Kopierkommando schlug fehl!\nKommando war:\n%1\n \nVersuche Kommando von Kosole um\nDetails für das Fehlschlagen\nzu erfahren.\n" },
{ "Writing back file result: ","Resultat des Dateizurückschreibens: " },
{ "Syncronization sucessfully completed","Synchronisation erfolgreich abgeschlossen" },
{ "Used %1 Client","Benutzter %1 Client" },
{ "No email client installed","Kein Email Klient installiert" },
{ "Userdefined email client","Benutzerdef. Email Klient" },
{ "OM/Pi email client","OM/Pi Email Klient" },
{ "Include in multiple ","Beziehe in mehrfach " },
{ "calendar ","Kalender " },
{ "addressbook ","Adressbuch " },
{ "pwmanager","PWmanager" },
{ " sync"," Sync ein" },
{ "Write back synced data","Schreibe gesyncte Daten zurück" },
{ "-- Write back (on remote) existing entries only","-- Schreibe nur existierende (entfernte) Einträge zurück" },
{ "-- Write back (calendar) entries in future only","-- Schreibe nur zukünftige Kalender-Einträge zurück" },
{ "---- Max. weeks in future: ","---- Max. wochen in der Zukunft: " },
{ "Pi-Sync ( direct Kx/Pi to Kx/Pi sync )","Pi-Sync ( direktes Kx/Pi zu Kx/Pi sync )" },
{ "Mobile device (cell phone)","Mobiles Gerät (Handy)" },
{ "Help...","Hilfe..." },
{ "Local file Cal:","Lokale Datei Kal:" },
{ "Local file ABook:","Lokale Datei ABuch:" },
{ "Local file PWMgr:","Lokale Datei PWMgr:" },
{ "Addressbook file (*.vcf) is used by KA/Pi","Adressbuch Datei (*.vcf) wird von KA/Pi genutzt" },
{ "Calendar:","Kalender:" },
{ "AddressBook:","AdressBuch:" },
{ "PWManager:","PWManager:" },
{ "Addressbook file is used by KA/Pi","Adressbuch Datei wird von KA/Pi genutzt" },
{ "ssh/scp","ssh/scp" },
{ "ftp","ftp" },
{ "Password for remote access: (could be the same for each)","Passwort für entfernten Zugriff: (kann dasselbe sein für alle)" },
{ "Remote IP address: (could be the same for each)","Entfernte IP Adresse: (kann dasselbe sein für alle)" },
{ "Remote port number: (should be different for each)","Entfernte Port Nummer: (Sollte für alle unterschiedlich sein)" },
{ "command for downloading remote file to local device","Kommando zum Download der entfernten Datei zum lokalen Gerät" },
{ "command for uploading local temp file to remote device","Kommando zum Upload der lokalen temp. Datei zum entfernten Gerät" },
{ "Insert device where\nphone is connected. E.g.:\n","Füge Device ein, an dem\ndas Handy angeschlossen ist. Z.B.:\n" },
{ "KDE-Pim sync config","KDE-Pim sync Konfig" },
{ "Insert kind of connection,e.g.:\n","Füge Art der Verbindung ein,z.B.:\n" },
{ "Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n","Empfohlen: Leer lassen!\n(So dass das Model\nautomatisch erkannt\nwerden kann)\nOder füge Model Name ein:\n" },
{ "Port number (Default: %1)","Port Nummer (Default: %1)" },
{ "Password to enable\naccess from remote:","Passwort um entfernten\nZugriff zuzulassen:" },
{ "Automatically start\nat application startup","Starte automatisch\nbeim Programmstart" },
{ "Automatically sync\nwith KDE-Desktop","Automatischer Sync\nmit dem KDE-Desktop" },
{ "Enter port for Pi-Sync","Port Nummer für Pi-Sync" },
{ "Disable Pi-Sync","Schalte Pi-Sync aus" },
{ "Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!","Wollen Sie wirklich\nmit allen selektierten\nProfilen \"Multi-Syncen\"?\nDas Syncen dauert einige Zeit -\nalle Profile werden zweimal gesynct!" },
{ "KDE-Pim Sync","KDE-Pim Sync" },
{ "Multiple profiles","Multi-Sync Profile" },
{ "Device: ","Gerät: " },
{ "Multiple sync started.","Multi-Sync gestartet." },
{ "Nothing synced! No profiles defined for multisync!","Nichts gesynct! Keine Profile\nselektiert für Multi-Sync" },
{ "KDE-Pim sync config","KDE-Pim Sync Konfig" },
{ "Insert kind of connection,e.g.:\n","Füge Art der Verbindung ein, z.B.:\n" },
{ "Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n","Empfohlen: Leer lassen!\n(So dass das Modell\nautomatisch\erkannt\nwerden kann)\nOder füge Model Name ein:\n" },
{ "KO/Pi config error","KO/Pi Konfig. Fehler" },
{ "Local device name undefined!\nPlease define device name!","Name dieses Gerätes undefiniert!\nBitte Namen angeben!" },
{ "Edit Address Book Filters","Editiere Addressbuch Filter" },
{ "&Add...","Hinzufügen..." },
{ "&Edit...","B&earbeiten..." },
{ "&Remove","Entfe&rne" },
{ "Modify View: ","Ansicht ändern: " },
{ "Fields","Felder" },
{ "Select Fields to Display","Wähle anzuzeigende Felder" },
{ "All","Alles" },
{ "Frequent","Frequent" },
{ "Address","Adresse" },
{ "Email","E-Mail" },
{ "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" },
{ "Home Address Label","Privat Adresse Label" },
{ "Business Address Street","Büro Adresse Strasse" },
{ "Business Address Locality","Büro Adresse Stadt" },
{ "Business Address Region","Büro Adresse Bundesland" },
{ "Business Address Postal Code","Büro Adresse PLZ" },
{ "Business Address Country","Büro Adresse Land" },
{ "Business Address Label","Büro Adresse Label" },
{ "Home Phone","Privat Telefon" },
{ "Business Phone","Büro Telefon" },
{ "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" },
{ "Default Filter","Default Filter" },
{ "The default filter will be activated whenever this view is displayed. This feature allows you to configure views that only interact with certain types of information based on the filter. Once the view is activated, the filter can be changed at anytime.","#The default filter will be activated whenever this view is displayed. This feature allows you to configure views that only interact with certain types of information based on the filter. Once the view is activated, the filter can be changed at anytime." },
{ "No default filter","Kein default Filter" },
{ "Use last active filter","Nutze letzen aktiven Filter" },
{ "Use filter:","Nutze Filter:" },
{ "Look & Feel","Look & Feel" },
{ "Row Separator","Reihen Separator" },
{ "Alternating backgrounds","Abwechselnder Hintergrund" },
{ "Single line","Einzelne Zeile" },
{ "Enable background image:","Hintergrundbild:" },
{ "Enable contact tooltips","Contact Tooltips" },
{ "&Enable custom Colors","Benutzerdef. Farben" },
{ "&Colors","Farben" },
{ "If custom colors are enabled, you may choose the colors for the view below. Otherwise colors from your current KDE color scheme are used.","#If custom colors are enabled, you may choose the colors for the view below. Otherwise colors from your current KDE color scheme are used." },
{ "Double click or press RETURN on a item to select a color for the related strings in the view.","#Double click or press RETURN on a item to select a color for the related strings in the view." },
{ "&Enable custom fonts","B&enutzerdefinierte Schriften" },
{ "&Text font:","Textschriftart:" },
{ "&Header font:","Titelschriftart:" },
{ "If custom fonts are enabled, you may choose which fonts to use for this view below. Otherwise the default KDE font will be used, in bold style for the header and normal style for the data.","#If custom fonts are enabled, you may choose which fonts to use for this view below. Otherwise the default KDE font will be used, in bold style for the header and normal style for the data." },
{ "&Fonts","Schri&ften" },
{ "Background Color","Hintergrundfarbe" },
{ "Text Color","Textfarbe" },
{ "Header Background Color","Titel Hintergrundfarbe" },
{ "Header Text Color","Titel Farbe" },
{ "Highlight Color","Auswahlfarbe" },
{ "Highlighted Text Color","Auswahltextfarbe" },
{ "Alternating Background Color","Abwechselnder Hintergrundfarbe" },
{ "Postal","Post" },
{ "Dr.","Dr." },
{ "Miss","Frl." },
{ "Mr.","Herr" },
{ "Mrs.","Frau" },
{ "Ms.","Fr." },
{ "Prof.","Prof." },
{ "I","I" },
{ "II","II" },
{ "III","III" },
{ "Jr.","Jr." },
{ "Sr.","Sr." },
{ "Name:","Name:" },
{ "Documents","Dokumente" },
{ "Files","Dateien" },
{ "All Files","Alle Dateien" },
{ "Name","Name" },
{ "Size","Größe" },
{ "Date","Datum" },
{ "Mime Type","Mime Typ" },
{ "Geo Data Input","Geo Dateneingabe" },
{ "Sexagesimal","Sexagesimal" },
{ "North","Nord" },
{ "South","Süd" },
{ "East","Ost" },
{ "West","West" },
{ "Undefined","Unbestimmt" },
{ "Edit Address","Bearbeite Adresse" },
{ "Street:","Strasse:" },
{ "Post office box:","Postfach:" },
{ "Locality:","Stadt:" },
{ "Region:","Region:" },
{ "Postal code:","PLZ:" },
{ "Country:","Staat:" },
{ "This is the preferred address","Dies ist die bevorzugte Adresse" },
{ "New...","Neu..." },
{ "Change Type","Ändere Art" },
{ "Edit Address Type","Ändere Address Art" },
{ "Address Types","Address Art" },
{ "Domestic","Inland" },
{ "International","International" },
{ "Parcel","Paket" },
{ "Edit Contact Name","Ändere Kontakt Name" },
{ "Honorific prefixes:","Namensprefixes:" },
{ "Given name:","Vorname:" },
{ "Additional names:","Mittelnamen:" },
{ "Family names:","Nachname:" },
{ "Honorific suffixes:","Namenssuffixe:" },
{ "Parse name automatically","Setze Namen automatisch" },
{ "Edit Phone Numbers","Bearbeite Telefonnummern" },
{ "Number","Nummer" },
{ "Type","Typ" },
{ "Edit Phone Number","Bearbeite Telefonnummer" },
{ "Number:","Nummer:" },
{ "This is the preferred phone number","Dies ist die bevorzugte Telefonnummer" },
{ "Types","Typen" },
{ "Messenger","Messenger" },
{ "Other","Anderes" },
{ "Video","Video" },
{ "Mailbox","Mailbox" },
{ "Modem","Modem" },
{ "Car","Auto" },
{ "PCS","PCS" },
{ "Category","Kategorie" },
{ "Select Categories","Wähle Kategorien" },
{ " &Deselect All "," &Deselektiere alle " },
{ " &Edit Categories "," B&earbeite Kategorien " },
{ "&OK","&OK" },
{ "&Cancel","Abbre&chen" },
{ "Configure","Konfiguriere" },
{ "Default","Voreinstellungen" },
{ "Addressbook","Adressbuch" },
{ "Details view font","Schriftart Detailansicht" },
{ "phone:123","phone:123" },
{ "Search only after <return> key pressed","Suche nur nach <return> Taste" },
{ "Honor KDE single click","Benutze KDE Einzelklick" },
{ "Automatic name parsing for new addressees","Automa. Name Parsen für neue Einträge" },
{ "Display List and Details at once (restart)","Zeige Liste und Details zusammen(neustart)" },
{ "Ask for quit when closing Ka/Pi","Vor Beenden von Ka/Pi nachfragen" },
{ "General","Allgemein" },
{ "Extensions (restart)","Extensions (restart)" },
{ "Description","Beschreibungen" },
{ "Extensions","Extensions" },
{ "Prefixes","Prefixe" },
{ "Inclusions","Inclusions" },
{ "Suffixes","Suffixe" },
{ "Default formatted name:","Default format. Name:" },
{ "Empty","Leer" },
{ "Simple Name","Einfacher Name" },
{ "Full Name","Voller Name" },
{ "Reverse Name","Namen umdrehen" },
{ "Contact","Kontakt" },
{ "Global","Allgemein" },
{ "Phone","Telefon" },
{ "SMS","SMS" },
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 @@ -1,926 +1,969 @@ /* This file is part of KAddressBook. Copyright (C) 2003 Tobias Koenig <tokoe@kde.org> based on the code of KSpread's CSV Import Dialog This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <qbuttongroup.h> #include <qcheckbox.h> #include <qcombobox.h> #ifdef DESKTOP_VERSION #include <qinputdialog.h> #else #include <qtcompat/qinputdialog.h> #endif #include <qlabel.h> #include <qlineedit.h> #include <qpushbutton.h> #include <qradiobutton.h> #include <qtable.h> #include <qlayout.h> #include <qtextstream.h> #include <qfile.h> #include <kapplication.h> #include <kdebug.h> #include <kdialogbase.h> #include <kfiledialog.h> #include <klineedit.h> #include <klocale.h> #include <kglobal.h> #include <kmessagebox.h> #include <kstandarddirs.h> #include <kurlrequester.h> #ifdef DESKTOP_VERSION #include "qtable.h" #else #include "qcombotableitem.h" #endif #include "csvimportdialog.h" CSVImportDialog::CSVImportDialog( KABC::AddressBook *ab, QWidget *parent, const char * name ) : KDialogBase( Plain, i18n ( "CSV Import Dialog" ), Ok | Cancel | User1 | User2, Ok, parent, name, true, true ), mAdjustRows( false ), mStartLine( 0 ), mTextQuote( '"' ), mDelimiter( "," ), mAddressBook( ab ) { initGUI(); mTypeMap.insert( i18n( "Undefined" ), Undefined ); mTypeMap.insert( KABC::Addressee::formattedNameLabel(), FormattedName ); mTypeMap.insert( KABC::Addressee::familyNameLabel(), FamilyName ); mTypeMap.insert( KABC::Addressee::givenNameLabel(), GivenName ); mTypeMap.insert( KABC::Addressee::additionalNameLabel(), AdditionalName ); mTypeMap.insert( KABC::Addressee::prefixLabel(), Prefix ); mTypeMap.insert( KABC::Addressee::suffixLabel(), Suffix ); mTypeMap.insert( KABC::Addressee::nickNameLabel(), NickName ); mTypeMap.insert( KABC::Addressee::birthdayLabel(), Birthday ); mTypeMap.insert( KABC::Addressee::homeAddressStreetLabel(), HomeAddressStreet ); mTypeMap.insert( KABC::Addressee::homeAddressLocalityLabel(), HomeAddressLocality ); mTypeMap.insert( KABC::Addressee::homeAddressRegionLabel(), HomeAddressRegion ); mTypeMap.insert( KABC::Addressee::homeAddressPostalCodeLabel(), HomeAddressPostalCode ); mTypeMap.insert( KABC::Addressee::homeAddressCountryLabel(), HomeAddressCountry ); mTypeMap.insert( KABC::Addressee::homeAddressLabelLabel(), HomeAddressLabel ); mTypeMap.insert( KABC::Addressee::businessAddressStreetLabel(), BusinessAddressStreet ); mTypeMap.insert( KABC::Addressee::businessAddressLocalityLabel(), BusinessAddressLocality ); mTypeMap.insert( KABC::Addressee::businessAddressRegionLabel(), BusinessAddressRegion ); mTypeMap.insert( KABC::Addressee::businessAddressPostalCodeLabel(), BusinessAddressPostalCode ); mTypeMap.insert( KABC::Addressee::businessAddressCountryLabel(), BusinessAddressCountry ); mTypeMap.insert( KABC::Addressee::businessAddressLabelLabel(), BusinessAddressLabel ); mTypeMap.insert( KABC::Addressee::homePhoneLabel(), HomePhone ); mTypeMap.insert( KABC::Addressee::businessPhoneLabel(), BusinessPhone ); mTypeMap.insert( KABC::Addressee::mobilePhoneLabel(), MobilePhone ); mTypeMap.insert( KABC::Addressee::homeFaxLabel(), HomeFax ); mTypeMap.insert( KABC::Addressee::businessFaxLabel(), BusinessFax ); mTypeMap.insert( KABC::Addressee::carPhoneLabel(), CarPhone ); mTypeMap.insert( KABC::Addressee::isdnLabel(), Isdn ); mTypeMap.insert( KABC::Addressee::pagerLabel(), Pager ); mTypeMap.insert( KABC::Addressee::emailLabel(), Email ); 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; for ( it = fields.begin(); it != fields.end(); ++it, ++count ) mTypeMap.insert( (*it)->label(), count ); connect( mDelimiterBox, SIGNAL( clicked( int ) ), this, SLOT( delimiterClicked( int ) ) ); 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& ) ), this, SLOT( setFile( const QString& ) ) ); connect( mUrlRequester, SIGNAL( urlSelected( const QString& ) ), this, SLOT( setFile( const QString& ) ) ); connect( mUrlRequester->lineEdit(), SIGNAL( textChanged ( const QString& ) ), this, SLOT( urlChanged( const QString& ) ) ); connect( this, SIGNAL( user1Clicked() ), this, SLOT( applyTemplate() ) ); connect( this, SIGNAL( user2Clicked() ), this, SLOT( saveTemplate() ) ); // if ( QApplication::desktop()->width() < 321 ) QIconSet icon = SmallIcon("filesave"); findButton( User2 )->setIconSet (icon ) ; icon = SmallIcon("fileopen"); findButton( User1 )->setIconSet (icon ) ; int wid = findButton( User2 )->sizeHint().height(); findButton( User2 )->setMaximumWidth( wid+4 ); findButton( User1 )->setMaximumWidth( wid+4 ); } CSVImportDialog::~CSVImportDialog() { } KABC::AddresseeList CSVImportDialog::contacts() const { KABC::AddresseeList contacts; for ( int row = 1; row < mTable->numRows(); ++row ) { KABC::Addressee a; bool emptyRow = true; KABC::Address addrHome( KABC::Address::Home ); KABC::Address addrWork( KABC::Address::Work ); for ( int col = 0; col < mTable->numCols(); ++col ) { QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0, col ) ); if ( !item ) { qDebug( "ERROR: item cast failed" ); continue; } QString value = mTable->text( row, col ); if ( !value.isEmpty() ) emptyRow = false; switch ( posToType( item->currentItem() ) ) { case Undefined: continue; break; case FormattedName: a.setFormattedName( value ); break; case GivenName: a.setGivenName( value ); break; case FamilyName: a.setFamilyName( value ); break; case AdditionalName: a.setAdditionalName( value ); break; case Prefix: a.setPrefix( value ); break; case Suffix: a.setSuffix( value ); break; case NickName: a.setNickName( value ); break; case Birthday: //US //the generated code had the following format: a.setBirthday( QDate::fromString( value, Qt::ISODate ) ); // But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ? { QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate a.setBirthday(dt); } break; case Email: if ( !value.isEmpty() ) a.insertEmail( value, true ); break; case Role: a.setRole( value ); break; case Title: a.setTitle( value ); break; case Mailer: a.setMailer( value ); break; case URL: a.setUrl( value ); break; case Organization: a.setOrganization( value ); break; case Note: + 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; case BusinessPhone: if ( !value.isEmpty() ) { KABC::PhoneNumber number( value, KABC::PhoneNumber::Work ); a.insertPhoneNumber( number ); } break; case MobilePhone: if ( !value.isEmpty() ) { KABC::PhoneNumber number( value, KABC::PhoneNumber::Cell ); a.insertPhoneNumber( number ); } break; case HomeFax: if ( !value.isEmpty() ) { KABC::PhoneNumber number( value, KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax ); a.insertPhoneNumber( number ); } break; case BusinessFax: if ( !value.isEmpty() ) { KABC::PhoneNumber number( value, KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax ); a.insertPhoneNumber( number ); } break; case CarPhone: if ( !value.isEmpty() ) { KABC::PhoneNumber number( value, KABC::PhoneNumber::Car ); a.insertPhoneNumber( number ); } break; case Isdn: if ( !value.isEmpty() ) { KABC::PhoneNumber number( value, KABC::PhoneNumber::Isdn ); a.insertPhoneNumber( number ); } break; case Pager: if ( !value.isEmpty() ) { KABC::PhoneNumber number( value, KABC::PhoneNumber::Pager ); a.insertPhoneNumber( number ); } break; case HomeAddressStreet: addrHome.setStreet( value ); break; case HomeAddressLocality: addrHome.setLocality( value ); break; case HomeAddressRegion: addrHome.setRegion( value ); break; case HomeAddressPostalCode: addrHome.setPostalCode( value ); break; case HomeAddressCountry: addrHome.setCountry( value ); break; case HomeAddressLabel: addrHome.setLabel( value ); break; case BusinessAddressStreet: addrWork.setStreet( value ); break; case BusinessAddressLocality: addrWork.setLocality( value ); break; case BusinessAddressRegion: addrWork.setRegion( value ); break; case BusinessAddressPostalCode: addrWork.setPostalCode( value ); break; case BusinessAddressCountry: addrWork.setCountry( value ); break; case BusinessAddressLabel: addrWork.setLabel( value ); break; default: KABC::Field::List fields = mAddressBook->fields( KABC::Field::CustomCategory ); KABC::Field::List::Iterator it; int counter = 0; for ( it = fields.begin(); it != fields.end(); ++it ) { if ( counter == (int)( posToType( item->currentItem() ) - mCustomCounter ) ) { (*it)->setValue( a, value ); continue; } ++counter; } break; } } if ( !addrHome.isEmpty() ) a.insertAddress( addrHome ); if ( !addrWork.isEmpty() ) a.insertAddress( addrWork ); if ( !emptyRow && !a.isEmpty() ) contacts.append( a ); } return contacts; } void CSVImportDialog::initGUI() { QWidget* page = plainPage(); QGridLayout *layout = new QGridLayout( page, 1, 1, marginHintSmall(), spacingHintSmall() ); QHBoxLayout *hbox = new QHBoxLayout(); hbox->setSpacing( spacingHint() ); QLabel *label = new QLabel( i18n( "File to import:" ), page ); 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 ); delimiterLayout->addWidget( mRadioSemicolon, 0, 1 ); mRadioTab = new QRadioButton( i18n( "Tabulator" ), mDelimiterBox ); delimiterLayout->addWidget( mRadioTab, 1, 0 ); mRadioSpace = new QRadioButton( i18n( "Space" ), mDelimiterBox ); delimiterLayout->addWidget( mRadioSpace, 1, 1 ); mRadioOther = new QRadioButton( i18n( "Other" ), mDelimiterBox ); delimiterLayout->addWidget( mRadioOther, 0, 2 ); mDelimiterEdit = new QLineEdit( mDelimiterBox ); delimiterLayout->addWidget( mDelimiterEdit, 1, 2 ); mComboLine = new QComboBox( false, page ); mComboLine->insertItem( i18n( "1" ) ); layout->addWidget( mComboLine, 3, 1 ); 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() { int row, column; bool lastCharDelimiter = false; bool ignoreDups = mIgnoreDuplicates->isChecked(); 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 x; QString field = ""; // store previous assignment QValueList<int> mTypeOld = mTypeStore; mTypeStore.clear(); for ( column = 0; column < mTable->numCols(); ++column ) { QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0, column ) ); if ( !item || mClearTypeStore ) mTypeStore.append( typeToPos( Undefined ) ); else if ( item ) 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 ); + + 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 switch ( state ) { case S_START : if ( x == mTextQuote ) { state = S_QUOTED_FIELD; } else if ( x == mDelimiter ) { if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) ++column; lastCharDelimiter = true; } else if ( x == '\n' ) { ++row; column = 1; } else { field += x; state = S_MAYBE_NORMAL_FIELD; } break; case S_QUOTED_FIELD : if ( x == mTextQuote ) { state = S_MAYBE_END_OF_QUOTED_FIELD; } else if ( x == '\n' ) { setText( row - mStartLine + 1, column, field ); field = ""; if ( x == '\n' ) { ++row; column = 1; } else { if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) ++column; lastCharDelimiter = true; } state = S_START; } else { field += x; } break; case S_MAYBE_END_OF_QUOTED_FIELD : if ( x == mTextQuote ) { field += x; state = S_QUOTED_FIELD; } else if ( x == mDelimiter || x == '\n' ) { setText( row - mStartLine + 1, column, field ); field = ""; if ( x == '\n' ) { ++row; column = 1; } else { if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) ++column; lastCharDelimiter = true; } state = S_START; } else { state = S_END_OF_QUOTED_FIELD; } break; case S_END_OF_QUOTED_FIELD : if ( x == mDelimiter || x == '\n' ) { setText( row - mStartLine + 1, column, field ); field = ""; if ( x == '\n' ) { ++row; column = 1; } else { if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) ++column; lastCharDelimiter = true; } state = S_START; } else { state = S_END_OF_QUOTED_FIELD; } break; case S_MAYBE_NORMAL_FIELD : if ( x == mTextQuote ) { field = ""; state = S_QUOTED_FIELD; break; } case S_NORMAL_FIELD : if ( x == mDelimiter || x == '\n' ) { setText( row - mStartLine + 1, column, field ); field = ""; if ( x == '\n' ) { ++row; column = 1; } else { if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) ++column; lastCharDelimiter = true; } state = S_START; } else { field += x; } } if ( x != mDelimiter ) lastCharDelimiter = false; if ( column > maxColumn ) maxColumn = column; } // file with only one line without '\n' if ( field.length() > 0 ) { setText( row - mStartLine + 1, column, field ); ++row; field = ""; } 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 ); mTable->setItem( 0, column, item ); if ( column < mTypeStore.count() ) item->setCurrentItem( mTypeStore[ column ] ); else item->setCurrentItem( typeToPos( Undefined ) ); mTable->adjustColumn( column ); } } void CSVImportDialog::clearTable() { for ( int row = 0; row < mTable->numRows(); ++row ) for ( int column = 0; column < mTable->numCols(); ++column ) mTable->clearCell( row, column ); } void CSVImportDialog::fillComboBox() { mComboLine->clear(); for ( int row = 1; row < mTable->numRows() + 1; ++row ) mComboLine->insertItem( QString::number( row ), row - 1 ); } void CSVImportDialog::setText( int row, int col, const QString& text ) { if ( row < 1 ) // skipped by the user return; if ( mTable->numRows() < row ) { mTable->setNumRows( row + 5000 ); // We add 5000 at a time to limit recalculations mAdjustRows = true; } if ( mTable->numCols() < col ) mTable->setNumCols( col + 50 ); // We add 50 at a time to limit recalculation mTable->setText( row - 1, col - 1, text ); } /* * Called after the first fillTable() when number of rows are unknown. */ void CSVImportDialog::adjustRows( int rows ) { if ( mAdjustRows ) { mTable->setNumRows( rows ); mAdjustRows = false; } } void CSVImportDialog::returnPressed() { if ( mDelimiterBox->id( mDelimiterBox->selected() ) != 4 ) return; mDelimiter = mDelimiterEdit->text(); fillTable(); } 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 = ","; break; case 4: // other mDelimiter = mDelimiterEdit->text(); break; case 2: // tab mDelimiter = "\t"; break; case 3: // space mDelimiter = " "; break; case 1: // semicolon mDelimiter = ";"; break; } fillTable(); } void CSVImportDialog::textquoteSelected( const QString& mark ) { if ( mComboQuote->currentItem() == 2 ) mTextQuote = 0; else mTextQuote = mark[ 0 ]; fillTable(); } void CSVImportDialog::lineSelected( const QString& line ) { mStartLine = line.toInt() - 1; fillTable(); } void CSVImportDialog::slotOk() { bool assigned = false; for ( int column = 0; column < mTable->numCols(); ++column ) { QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0, column ) ); if ( item && posToType( item->currentItem() ) != Undefined ) assigned = true; } if ( assigned ) KDialogBase::slotOk(); else KMessageBox::sorry( this, i18n( "You have to assign at least one column." ) ); } void CSVImportDialog::applyTemplate() { QMap<uint,int> columnMap; QMap<QString, QString> fileMap; QStringList templates; // load all template files /*US QStringList list = KGlobal::dirs()->findAllResources( "data" , QString( kapp->name() ) + "/csv-templates/*.desktop", true, true ); */ 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 ); KConfig config( fileMap[ tmp ] ); config.setGroup( "General" ); //US uint numColumns = config.readUnsignedNumEntry( "Columns" ); uint numColumns = (uint)config.readNumEntry( "Columns" ); mDelimiterEdit->setText( config.readEntry( "DelimiterOther" ) ); mDelimiterBox->setButton( config.readNumEntry( "DelimiterType" ) ); delimiterClicked( config.readNumEntry( "DelimiterType" ) ); int quoteType = config.readNumEntry( "QuoteType" ); mComboQuote->setCurrentItem( quoteType ); textquoteSelected( mComboQuote->currentText() ); // create the column map config.setGroup( "csv column map" ); for ( uint i = 0; i < numColumns; ++i ) { int col = config.readNumEntry( QString::number( i ) ); columnMap.insert( i, col ); } // apply the column map for ( uint column = 0; column < columnMap.count(); ++column ) { int type = columnMap[ column ]; QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0, column ) ); if ( item ) item->setCurrentItem( typeToPos( type ) ); } } void CSVImportDialog::saveTemplate() { /*US QString fileName = KFileDialog::getSaveFileName( locateLocal( "data", QString( kapp->name() ) + "/csv-templates/" ), "*.desktop", this ); */ QString fileName = KFileDialog::getSaveFileName( locateLocal( "data", KGlobal::getAppName() + "/csv-templates/" )+ "*.desktop",i18n("Save file name") , this ); if ( fileName.isEmpty() ) return; 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; KConfig config( fileName ); config.setGroup( "General" ); config.writeEntry( "Columns", mTable->numCols() ); config.writeEntry( "DelimiterType", mDelimiterBox->id( mDelimiterBox->selected() ) ); config.writeEntry( "DelimiterOther", mDelimiterEdit->text() ); config.writeEntry( "QuoteType", mComboQuote->currentItem() ); config.setGroup( "Misc" ); config.writeEntry( "Name", name ); config.setGroup( "csv column map" ); for ( uint column = 0; column < mTable->numCols(); ++column ) { QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0, column ) ); if ( item ) config.writeEntry( QString::number( column ), posToType( item->currentItem() ) ); else config.writeEntry( QString::number( column ), 0 ); } config.sync(); } 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(); } void CSVImportDialog::setFile( const QString &fileName ) { if ( fileName.isEmpty() ) return; QFile file( fileName ); if ( !file.open( IO_ReadOnly ) ) { KMessageBox::sorry( this, i18n( "Cannot open input file!" ) ); file.close(); return; } mFileArray = file.readAll(); file.close(); mClearTypeStore = true; clearTable(); mTable->setNumCols( 0 ); mTable->setNumRows( 0 ); fillTable(); mClearTypeStore = false; fillComboBox(); } void CSVImportDialog::urlChanged( const QString &file ) { bool state = !file.isEmpty(); enableButtonOK( state ); findButton( User1 )->setEnabled( state ); findButton( User2 )->setEnabled( state ); } #ifndef KAB_EMBEDDED #include <csvimportdialog.moc> #endif //KAB_EMBEDDED 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 @@ -1,124 +1,126 @@ /* This file is part of KAddressBook. Copyright (C) 2003 Tobias Koenig <tokoe@kde.org> based on the code of KSpread's CSV Import Dialog This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #ifndef CSV_IMPORT_DLG_H #define CSV_IMPORT_DLG_H #include <kabc/addressbook.h> #include <kabc/addresseelist.h> #include <kdialogbase.h> #include <qvaluelist.h> class KURLRequester; class QButtonGroup; class QComboBox; class QCheckBox; class QLineEdit; class QPushButton; class QRadioButton; class QTable; class CSVImportDialog : public KDialogBase { Q_OBJECT public: CSVImportDialog( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); ~CSVImportDialog(); KABC::AddresseeList contacts() const; protected slots: virtual void slotOk(); private slots: void returnPressed(); void delimiterClicked( int id ); 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, Prefix, Suffix, NickName, Birthday, 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(); void fillComboBox(); void setText( int row, int col, const QString& text ); void adjustRows( int rows ); QString getText( int row, int col ); uint posToType( int pos ) const; int typeToPos( uint type ) const; bool mAdjustRows; int mStartLine; QChar mTextQuote; QString mDelimiter; QString mData; QByteArray mFileArray; QMap<QString, uint> mTypeMap; KABC::AddressBook *mAddressBook; int mCustomCounter; bool mClearTypeStore; QValueList<int> mTypeStore; }; #endif diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp index 3f47425..6be1580 100644 --- a/microkde/kfiledialog.cpp +++ b/microkde/kfiledialog.cpp @@ -1,76 +1,79 @@ #include <kfiledialog.h> #include <qdialog.h> #include <qlayout.h> #include <qdir.h> #include <qfileinfo.h> #include <qapplication.h> #ifndef DESKTOP_VERSION //US orig#include <ofileselector.h> #include <ofileselector_p.h> QString KFileDialog::getSaveFileName( const QString & fn, const QString & cap , QWidget * par ) { QString retfile = ""; QDialog dia ( par, "input-dialog", true ); QVBoxLayout lay( &dia ); lay.setMargin(7); lay.setSpacing(7); QString file = fn; if ( file.isEmpty() ) file = QDir::homeDirPath()+"/*"; QFileInfo fi ( file ); 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(); + if ( cap.isEmpty() ) + dia.setCaption( file ); + else dia.setCaption( cap ); int res = dia.exec(); if ( res ) retfile = o.selectedName(); return retfile; } QString KFileDialog::getOpenFileName( const QString & fn, const QString & cap, QWidget * par ) { QString retfile = ""; QDialog dia ( par, "input-dialog", true ); // QLineEdit lab ( &dia ); QVBoxLayout lay( &dia ); lay.setMargin(7); lay.setSpacing(7); QString file = fn; if ( file.isEmpty() ) file = QDir::homeDirPath()+"/*";; QFileInfo fi ( file ); OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); lay.addWidget( &o); dia.showMaximized(); dia.setCaption( cap ); int res = dia.exec(); if ( res ) retfile = o.selectedName(); return retfile; } #else #include <qfiledialog.h> QString KFileDialog::getSaveFileName( const QString & fn, const QString & cap , QWidget * par ) { return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); } QString KFileDialog::getOpenFileName( const QString & fn, const QString & cap, QWidget * par ) { return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); } #endif 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 @@ -147,257 +147,257 @@ public: /*US KURLCompletion *comp; if ( combo ) comp = dynamic_cast<KURLCompletion*>(combo->completionObject()); else comp = dynamic_cast<KURLCompletion*>(edit->completionObject()); if ( comp ) return comp->replacedPath( txt ); else */ return txt; } KLineEdit *edit; //US KComboBox *combo; int fileDialogMode; QString fileDialogFilter; }; /*US KURLRequester::KURLRequester( QWidget *editWidget, QWidget *parent, const char *name ) : QHBox( parent, name ) { d = new KURLRequesterPrivate; // must have this as parent editWidget->reparent( this, 0, QPoint(0,0) ); //US d->edit = dynamic_cast<KLineEdit*>( editWidget ); d->edit = (KLineEdit*)( editWidget ); //US d->combo = dynamic_cast<KComboBox*>( editWidget ); init(); } */ KURLRequester::KURLRequester( QWidget *parent, const char *name ) : QHBox( parent, name ) { d = new KURLRequesterPrivate; init(); } KURLRequester::KURLRequester( const QString& url, QWidget *parent, const char *name ) : QHBox( parent, name ) { d = new KURLRequesterPrivate; init(); setURL( url ); } KURLRequester::~KURLRequester() { //US delete myCompletion; delete myFileDialog; delete d; } void KURLRequester::init() { myFileDialog = 0L; myShowLocalProt = false; if (/*US !d->combo && */ !d->edit ) d->edit = new KLineEdit( this, "KURLRequester::KLineEdit" ); myButton = new KURLDragPushButton( this, "kfile button"); QIconSet iconSet = SmallIconSet("fileopen"); QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal ); myButton->setIconSet( iconSet ); myButton->setFixedSize( pixMap.width()+8, pixMap.height()+8 ); //US QToolTip::add(myButton, i18n("Open file dialog")); connect( myButton, SIGNAL( pressed() ), SLOT( slotUpdateURL() )); setSpacing( KDialog::spacingHint() ); QWidget *widget = /*US d->combo ? (QWidget*) d->combo : */ (QWidget*) d->edit; setFocusProxy( widget ); d->connectSignals( this ); connect( myButton, SIGNAL( clicked() ), this, SLOT( slotOpenDialog() )); /*US myCompletion = new KURLCompletion(); d->setCompletionObject( myCompletion ); KAccel *accel = new KAccel( this ); accel->insert( KStdAccel::Open, this, SLOT( slotOpenDialog() )); accel->readSettings(); */ } void KURLRequester::setURL( const QString& url ) { bool hasLocalPrefix = (url.startsWith("file:")); if ( !myShowLocalProt && hasLocalPrefix ) d->setText( url.mid( 5, url.length()-5 )); else d->setText( url ); } void KURLRequester::setCaption( const QString& caption ) { //US fileDialog()->setCaption( caption ); //US QWidget::setCaption( caption ); } QString KURLRequester::url() const { return d->url(); } 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() ); /*US KFileDialog *dlg = fileDialog(); if ( !d->url().isEmpty() ) { KURL u( url() ); // If we won't be able to list it (e.g. http), then don't try :) if ( KProtocolInfo::supportsListing( u.protocol() ) ) dlg->setSelection( u.url() ); } if ( dlg->exec() == QDialog::Accepted ) { setURL( dlg->selectedURL().prettyURL() ); emit urlSelected( d->url() ); } */ } void KURLRequester::setMode(unsigned int mode) { /*US Q_ASSERT( (mode & KFile::Files) == 0 ); d->fileDialogMode = mode; if ( (mode & KFile::Directory) && !(mode & KFile::File) ) myCompletion->setMode( KURLCompletion::DirCompletion ); if (myFileDialog) myFileDialog->setMode( d->fileDialogMode ); */ } void KURLRequester::setFilter(const QString &filter) { /*US d->fileDialogFilter = filter; if (myFileDialog) myFileDialog->setFilter( d->fileDialogFilter ); */ } KFileDialog * KURLRequester::fileDialog() const { /*US if ( !myFileDialog ) { QWidget *p = parentWidget(); myFileDialog = new KFileDialog( QString::null, QString::null, p, "file dialog", true ); myFileDialog->setMode( d->fileDialogMode ); myFileDialog->setFilter( d->fileDialogFilter ); } return myFileDialog; */ return 0; } void KURLRequester::setShowLocalProtocol( bool b ) { if ( myShowLocalProt == b ) return; myShowLocalProt = b; setURL( url() ); } void KURLRequester::clear() { d->setText( QString::null ); } KLineEdit * KURLRequester::lineEdit() const { return d->edit; } /*US KComboBox * KURLRequester::comboBox() const { return d->combo; } */ void KURLRequester::slotUpdateURL() { // bin compat, myButton is declared as QPushButton //US KURL u( QDir::currentDirPath() + '/', url() ); KURL u( url() ); (static_cast<KURLDragPushButton *>( myButton))->setURL( u ); } QPushButton * KURLRequester::button() const { return myButton; } /*US KEditListBox::CustomEditor KURLRequester::customEditor() { setSizePolicy(QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed)); KLineEdit *edit = d->edit; if ( !edit && d->combo ) edit = dynamic_cast<KLineEdit*>( d->combo->lineEdit() ); #ifndef NDEBUG if ( !edit ) kdWarning() << "KURLRequester's lineedit is not a KLineEdit!??\n"; #endif KEditListBox::CustomEditor editor( this, edit ); return editor; } */ void KURLRequester::virtual_hook( int, void* ) { /*BASE::virtual_hook( id, data );*/ } /*US KURLComboRequester::KURLComboRequester( QWidget *parent, const char *name ) : KURLRequester( new KComboBox(false), parent, name) { } |