summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-10-28 11:31:59 (UTC)
committer zautrix <zautrix>2005-10-28 11:31:59 (UTC)
commitb27cb619bb9005ad4345d38bbee3b1c3d0eda1b2 (patch) (side-by-side diff)
treea7ac6002208ddedcd9dc13cd0e91294519883007
parent5ceebb8563f134c789e9082d1bc49723beb28c8c (diff)
downloadkdepimpi-b27cb619bb9005ad4345d38bbee3b1c3d0eda1b2.zip
kdepimpi-b27cb619bb9005ad4345d38bbee3b1c3d0eda1b2.tar.gz
kdepimpi-b27cb619bb9005ad4345d38bbee3b1c3d0eda1b2.tar.bz2
commit
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/kaddressbook/germantranslation.txt4
-rw-r--r--kabc/addressee.cpp4
-rw-r--r--kabc/addresseeview.cpp2
-rw-r--r--kaddressbook/phoneeditwidget.cpp112
-rw-r--r--kaddressbook/phoneeditwidget.h87
5 files changed, 193 insertions, 16 deletions
diff --git a/bin/kdepim/kaddressbook/germantranslation.txt b/bin/kdepim/kaddressbook/germantranslation.txt
index dcf43c1..f12f880 100644
--- a/bin/kdepim/kaddressbook/germantranslation.txt
+++ b/bin/kdepim/kaddressbook/germantranslation.txt
@@ -632,206 +632,206 @@
{ "View Type","Typ der Ansicht" },
{ "Icons represent contacts. Very simple view.","Icons repräsentieren Kontakte. Sehr einfache Ansicht." },
{ "A listing of contacts in a table. Each cell of the table holds a field of the contact.","Eine Kontaktliste in einer Tabelle." },
{ "Rolodex style cards represent contacts.","Rolodex Stil Karten repräsentieren Kontakte." },
{ "Draw &separators","Zeichne &Trennlinie" },
{ "Separator &width:","Trennlinien &Breite:" },
{ "&Padding:","Füllung:" },
{ "Cards","Karten" },
{ "&Margin:","&Rand:" },
{ "Draw &borders","Zeichne Ränder" },
{ "The item margin is the distance (in pixels) between the item edge and the item data. Most noticeably, incrementing the item margin will add space between the focus rectangle and the item data.","The item margin is the distance (in pixels) between the item edge and the item data. Most noticeably, incrementing the item margin will add space between the focus rectangle and the item data." },
{ "The Item Spacing decides the distance (in pixels) between the items and anything else: the view borders, other items or column separators.","The Item Spacing decides the distance (in pixels) between the items and anything else: the view borders, other items or column separators." },
{ "Sets the width of column separators","Sets the width of column separators" },
{ "&Layout","&Layout" },
{ "Show &empty fields","Zeige leere Felder" },
{ "Show field &labels","Zeige Feld Label" },
{ "Be&havior","Ver&halten" },
{ "Header, Border and Separator Color","Kopf, Rand und Trennlinien Farbe" },
{ "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>","<qt>Sind Sie sicher, dass Sie die Ansicht <b>%1</b> löschen möchten?</qt>" },
{ "Confirm Delete","Bestätige Löschen" },
{ "Edit Address Book Filter","Editiere Adressbuch Filter" },
{ "Category rule","Kategorie Regel" },
{ "Include categories","Inklusive" },
{ "Exclude categories","Exclusive" },
{ "Include contacts, that are:","Schließe folgende Kontakte ein:" },
{ "public","Öffentlich" },
{ "private","Privat" },
{ "confidential","Vertraulich" },
{ "Configure Resources","Konfiguriere Resourcen" },
{ "Resource Configuration","Resource Konfiguration" },
{ "Resources","Resourcen" },
{ "Standard","Standard" },
{ "&Use as Standard","Setze als Standard" },
{ "Select type of the new resource:","Selektiere Typ der neuen Resource:" },
{ "General Settings","Allgemeine Einstellungen" },
{ "Read-only","Nur-Lesen" },
{ "Include in sync","Schließe in Sync mit ein" },
{ "%1 Resource Settings","%1 Resource Einstellungen" },
{ "Format:","Format:" },
{ "Location:","Ort:" },
{ "Full Menu bar (restart)","Volle Menu Leiste (Neustart!)" },
{ "Language","Sprache" },
{ "Time Format","Zeit Format" },
{ "Time Zone","Zeit Zone" },
{ "Data storage path","Daten Speicherpfad" },
{ "Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail","Aktuelles Speicherverzeichnis ist:\n%1\nIhre Mail wird gespeichert in:\n(speicherverz.)/apps/kopiemail/localmail" },
{ "<b>New data storage dir:</b>","<b>Neues Datenspeicherverzeichnis:</b>" },
{ "New dirs are created automatically","Neue Verzeichnisse werden aut. erstellt" },
{ "Save settings","Speichere Einstellungen" },
{ "Save standard","Speichere Standard" },
{ "Save","Speichern" },
{ "<b>New settings are used\nafter a restart</b>","<b>Neue Einstellungen werden nach\neinem Neustart genutzt</b>" },
{ "Settings are stored in\n%1","Einstellungen werden gespeichert in:\n%1" },
{ "Multiple Sync options","Multi Sync Optionen" },
{ "Sync algo options","Sync Ablauf Optionen" },
{ "Apply filter when adding data to local:","Filter für das Hinzufügen von Daten zu Lokal:" },
{ "Incoming calendar filter:","Eingehender Kalender Filter:" },
{ "Incoming addressbook filter:","Eingehender Adressbuch Filter:" },
{ "Write back options","Optionen zum Zurückschreiben" },
{ "Write back (on remote) existing entries only","Schreibe nur existierende (auf Entfernt) Einträge zurück" },
{ "Apply filter when adding data to remote:","Filter für das Hinzufügen von Daten zu Entfernt:" },
{ "Outgoing calendar filter:","Ausgehender Kalender Filter:" },
{ "Outgoing addressbook filter:","Ausgehender Adressbuch Filter:" },
{ "Write back (calendar) entries for time period only","Schreibe nur Kalender Einträge für Zeitspanne zurück" },
{ "Time period","Zeitspanne" },
{ "From ","Von " },
{ " weeks in the past to "," Wochen in der Vergangenheit bis zu " },
{ " weeks in the future "," Wochen in der Zukunft " },
{ "Profile kind specific settings","Profil Art abhängige Einstellungen" },
{ "Local temp file:","Lokale temp Datei:" },
{ "Multiple profiles with same name!\nPlease use unique profile names!","Mehrere Profile mit demselben Namen!\nBitte verschiedene Namen benutzen!" },
{ "Aborted! Nothing synced!","Abgebrochen! Nichts wurde gesynct!" },
{ "You cannot remove your standard resource!\n Please select a new standard resource first.","Standard Resource kann\nnicht entfernt werden!\nBitte eine andere Resource\nals Standard setzen." },
{ "Sorry","Tut mir leid" },
{ "You cannot use a read-only<br> resource as standard!","Man kann nicht eine read-only<br> Resource als Standard setzen!" },
{ "Please restart to get the \nchanged resources (re)loaded!\n","Bitte starten Sie jetzt\ndas Programm neu, um die geänderten\nResourcen neu zu laden!\n" },
{ "The selected file does not\ninclude a valid vCard.\nPlease check the file and try again.\n","Die gewählte Datei enthält\nkeine gültige vCard.\nBitte prüfen Sie die Datei\nund versuchen es erneut.\n" },
{ "Unable to load resource '%1'","Resource kann nicht geladen werden: '%1'" },
{ "Some changes are only\neffective after a restart!\n","Einige Änderungen werden erst\nnach einem Neustart übernommen!\n" },
{ "Syncing aborted. Nothing synced.","Syncing abgebrochen.Nichts wurde gesynct." },
{ "Connected! Sending request for remote file ...","Verbunden! Sende Daten Anfrage..." },
{ "Trying to connect to remote...","Versuche mit Gegenstelle zu verbinden..." },
{ "Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?","Verbindungsversuch wegen\nZeitüberschreitung gescheitert!\nWurde vergessen Pi-Sync auf\nder Gegenstelle anzuschalten?" },
{ "ERROR: Receiving remote file failed.","FEHLER: Empfang der entfernten Daten fehlgeschlagen." },
{ "Error","Fehler" },
{ ""You entered an invalid date!\n Date changed to current date.","Ungültiges Datum eingegeben.\nSetze heutiges Datum." },
{ "You entered an invalid date!\n Will use current date instead.","Ungültiges Datum eingegeben.\nSetze stattdessen heutiges Datum." },
{ "Warning","Warnung" },
{ "Select week number","Wähle Wochen Nummer" },
{ "Februar","Februar" },
{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " },
{ "Password for remote access:","Passwort für fernen Zugriff:" },
{ "Remote IP address:","Ferne IP Adresse:" },
{ "Remote port number:","Ferne Port Nummer:" },
{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." },
{ "Remote from: ","Fern von: " },
{ "Local from: ","Lokal von: " },
{ "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 %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" },
{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" },
{ "Write back","Schreibe zurück" },
{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" },
{ "Received sync request","Sync Anfrage erhalten" },
{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." },
{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." },
{ "Data saved to temp file!","Daten in temp Datei gespeichert!" },
{ "Sending file...","Sende Datei..." },
{ "Waiting for synced file...","Warte auf gesyncte Daten..." },
{ "Receiving synced file...","Gesyncte Daten erhalten..." },
{ "Received %1 bytes","%1 Bytes erhalten" },
{ "Writing file to disk...","Speichere Datei..." },
{ "Pi-Sync successful!","Pi-Sync erfolgreich!" },
{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" },
{ "Synchronize!","Synchronisiere!" },
{ "High clock skew!","Großer Uhrzeitunterschied!" },
{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" },
{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" },
{ "Change search field enable jump bar","Ändere Suchfeld um Jumpbar anzuzeigen" },
{ "Search with '*' prefix (wildcard)","Suche mit '*' Prefix (Wildcard)" },
{ "Shrink searchfield in portrait view","Verkleinere Suchfeld im Portraitmodus" },
{ "Edit new contact","Bearbeite neuen Kontakt" },
{ "Edit ","Bearbeite " },
{ "No contact changed!","Kein Kontakt verändert" },
{ "%1 contacts changed!","%1 Kontakte geändert!" },
{ "Mobile (home)","Handy (Privat)" },
{ "Mobile (work)","Handy (Arbeit)" },
{ "Def.Formatted Name","Def. Format. Name" },
{ "Colors","Farben" },
{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" },
{ "Backup enabled","Backup angeschaltet" },
{ "Use standard backup dir","Standard Backupverzeichnis" },
{ "Number of Backups:","Anzahl der Backups" },
{ "Make backup every ","Mache ein Backup alle " },
{ " days"," Tage" },
{ "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." },
{ "Backup Failed!","Backup Problem!" },
{ "Try again now","Versuche jetzt nochmal" },
{ "Try again later","Versuche später nochmal" },
{ "Try again tomorrow","Versuche morgen nochmal" },
{ "Disable backup","Schalte Backup ab" },
{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" },
{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" },
{ "Choose action","Wähle Aktion" },
{ "&Configure KA/Pi...","Konfiguriere KA/Pi..." },
{ "Global Settings...","Globale Einstellungen..." },
{ "Spouse","Ehegatte" },
{ "Notes","Notizen" },
{ "Messanger","Messanger" },
{ "Assistant","Assistent" },
{ "Manager","Manager" },
{ "Secrecy","Sichtbar" },
{ "male","männlich" },
{ "female","weiblich" },
{ "Hide!","Verbergen!" },
{ "Show!","Anzeigen!" },
{ "Details","Details" },
{ "Search:","Suche:" },
{ "Automatically sync with KDE-Desktop\nwhen receiving sync request","Synce automatisch mit KDE-Desktop\nwenn eine Sync-Anforderung kommt" },
{ "Pi-Sync Port Error","Pi-Sync Port Fehler" },
{ "<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?","<b>Anschalten von Pi-Sync fehlgeschlagen!</b> Fehler beim Ansprechen des Ports %1! Ist bereits eine andere Anwendung dabei diesen Port zu nutzen?" },
{ "No valid port number:\n%1","Keine gültige Port Nummer:\n%1" },
{ "Port number (Default: %1)\nValid range from 1 to 65535","Port Nummer (Standard: %1)\nGültiger Bereich von 1 bis 65535" },
{ "Pi-Sync Error","Pi-Sync Fehler" },
{ "Got send file request\nwith invalid password","Erhielt "sende Datei" Anfrage\nmit ungültigem Passwort" },
{ "Got receive file request\nwith invalid password","Erhielt "empfange Datei" Anfrage\nmit ungültigem Passwort" },
{ "Wrong password: Receiving remote file failed.","Falsches Passwort: Empfangen von entfernter Datei fehlgeschlagen." },
{ "Please close error dialog on remote.","Bitte schließe Fehler-Dialog am entfernten Rechner" },
{ "Unknown error on remote.","Unbekannter Fehler am entfernten Rechner" },
{ "Pi-Sync: Connected!","Pi-Sync: Verbunden!" },
{ "Receiving file from remote...","Empfange entfernte Datei..." },
{ "Sending back synced file...","Sende synchronisierte Datei zurück..." },
{ "Do you want to\nclear all sync info\nof all profiles?","Möchten Sie wirklich\ndie Sync-Info\nfür alle Profile\nlöschen?" },
{ "Do you want to\nclear the sync\ninfo of profile\n%1?\n","Möchten Sie wirklich\ndie Sync-Info für Profil\n%1?\nlöschen" },
{ "Sorry, no valid port.Syncing cancelled.","Sorry, kein gültiger Port. Syncing abgebrochen." },
{ "Remote port number:\n(May be: 1 - 65535)","Ferne Port Nummer:\n(Darf sein: 1 - 65535)" },
{ "Writing back file ...","Schreibe Datei zurück..." },
{ "Sending back file ...","Sende Datei zurück..." },
{ "Eeek, there I am ticklish!","Huch, da bin ich kitzlig!" },
{ "Save using LOCAL storage","Speichere nutze LOCAL Pfad" },
{ "...and %1 more\ncontact(s) selected","...und noch %1 Kontakte\n mehr ausgewählt" },
{ "Do you really\nwant to delete the\nsetected contact(s)?\n\n","Möchten Sie wirklich\ndie ausgewählten\nKontakte löschen?\n\n" },
{ "%1 contacts\nsuccessfully\nimported.","%1 Kontakte\nerfolgreich\nimportiert." },
{ "Import this contact?","Importiere diesen Kontakt?" },
{ "Import all!","Importiere alle!" },
{ "Loading addressbook data ... please wait","Lade Adressbuchdaten ... bitte warten" },
{ "Import Format","Import Format" },
{ "Select import format!\nDefault and standard is Utf8.\nLatin1 may be the right\nfor some West Europian languages.","Wähle Import Format!\nDefault und Standard ist Utf8.\nLatin1 kann das richtige für\nWesteuropäische Sprachen sein." },
{ "Home2","Privat2" },
{ "Work2","Arbeit2" },
{ "Fax (Work)","Fax (Arbeit)" },
{ "Fax (Home)","Fax (Privat)" },
{ "Assistent","Sekretär(in)" },
{ "Company","Firma" },
-{ "Mobile2 (work)","Handy2 (Arbeit)" },
-{ "Mobile2 (car)","Handy2 (Auto)" },
+{ "Mobile2 (Work)","Handy2 (Arbeit)" },
+{ "Mobile2 (Car)","Handy2 (Auto)" },
{ "Callback","Rückruf" },
{ "Fax (Other)","Fax (Anderes)" },
{ "Primary","Bevorzugt" },
{ "Mobile (Home)","Handy (Privat)" },
{ "Unfiled","Nicht zugeordnet" },
{ "Format.n.:","Format.N.:" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" }, \ No newline at end of file
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 19c78ee..789a694 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -870,407 +870,407 @@ QString Addressee::givenName() const
QString Addressee::givenNameLabel()
{
return i18n("Given Name");
}
void Addressee::setAdditionalName( const QString &additionalName )
{
if ( additionalName == mData->additionalName ) return;
detach();
mData->empty = false;
mData->additionalName = additionalName;
}
QString Addressee::additionalName() const
{
return mData->additionalName;
}
QString Addressee::additionalNameLabel()
{
return i18n("Additional Names");
}
void Addressee::setPrefix( const QString &prefix )
{
if ( prefix == mData->prefix ) return;
detach();
mData->empty = false;
mData->prefix = prefix;
}
QString Addressee::prefix() const
{
return mData->prefix;
}
QString Addressee::prefixLabel()
{
return i18n("Honorific Prefixes");
}
void Addressee::setSuffix( const QString &suffix )
{
if ( suffix == mData->suffix ) return;
detach();
mData->empty = false;
mData->suffix = suffix;
}
QString Addressee::suffix() const
{
return mData->suffix;
}
QString Addressee::suffixLabel()
{
return i18n("Honorific Suffixes");
}
void Addressee::setNickName( const QString &nickName )
{
if ( nickName == mData->nickName ) return;
detach();
mData->empty = false;
mData->nickName = nickName;
}
QString Addressee::nickName() const
{
return mData->nickName;
}
QString Addressee::nickNameLabel()
{
return i18n("Nick Name");
}
void Addressee::setBirthday( const QDateTime &birthday )
{
if ( birthday == mData->birthday ) return;
detach();
mData->empty = false;
mData->birthday = birthday;
}
QDateTime Addressee::birthday() const
{
return mData->birthday;
}
QString Addressee::birthdayLabel()
{
return i18n("Birthday");
}
QString Addressee::homeAddressStreetLabel()
{
return i18n("Home Address Street");
}
QString Addressee::homeAddressLocalityLabel()
{
return i18n("Home Address Locality");
}
QString Addressee::homeAddressRegionLabel()
{
return i18n("Home Address Region");
}
QString Addressee::homeAddressPostalCodeLabel()
{
return i18n("Home Address Postal Code");
}
QString Addressee::homeAddressCountryLabel()
{
return i18n("Home Address Country");
}
QString Addressee::homeAddressLabelLabel()
{
return i18n("Home Address Label");
}
QString Addressee::businessAddressStreetLabel()
{
return i18n("Business Address Street");
}
QString Addressee::businessAddressLocalityLabel()
{
return i18n("Business Address Locality");
}
QString Addressee::businessAddressRegionLabel()
{
return i18n("Business Address Region");
}
QString Addressee::businessAddressPostalCodeLabel()
{
return i18n("Business Address Postal Code");
}
QString Addressee::businessAddressCountryLabel()
{
return i18n("Business Address Country");
}
QString Addressee::businessAddressLabelLabel()
{
return i18n("Business Address Label");
}
QString Addressee::homePhoneLabel()
{
return i18n("Home Phone");
}
QString Addressee::businessPhoneLabel()
{
return i18n("Work Phone");
}
QString Addressee::mobilePhoneLabel()
{
return i18n("Mobile Phone");
}
QString Addressee::mobileWorkPhoneLabel()
{
- return i18n("Mobile2 (work)");
+ return i18n("Mobile2 (Work)");
}
QString Addressee::mobileHomePhoneLabel()
{
return i18n("Mobile (Home)");
}
QString Addressee::homeFaxLabel()
{
return i18n("Fax (Home)");
}
QString Addressee::businessFaxLabel()
{
return i18n("Fax (Work)");
}
QString Addressee::carPhoneLabel()
{
- return i18n("Mobile2 (car)");
+ return i18n("Mobile2 (Car)");
}
QString Addressee::isdnLabel()
{
return i18n("ISDN");
}
QString Addressee::pagerLabel()
{
return i18n("Pager");
}
QString Addressee::sipLabel()
{
return i18n("SIP");
}
QString Addressee::emailLabel()
{
return i18n("Email Address");
}
void Addressee::setMailer( const QString &mailer )
{
if ( mailer == mData->mailer ) return;
detach();
mData->empty = false;
mData->mailer = mailer;
}
QString Addressee::mailer() const
{
return mData->mailer;
}
QString Addressee::mailerLabel()
{
return i18n("Mail Client");
}
void Addressee::setTimeZone( const TimeZone &timeZone )
{
if ( timeZone == mData->timeZone ) return;
detach();
mData->empty = false;
mData->timeZone = timeZone;
}
TimeZone Addressee::timeZone() const
{
return mData->timeZone;
}
QString Addressee::timeZoneLabel()
{
return i18n("Time Zone");
}
void Addressee::setGeo( const Geo &geo )
{
if ( geo == mData->geo ) return;
detach();
mData->empty = false;
mData->geo = geo;
}
Geo Addressee::geo() const
{
return mData->geo;
}
QString Addressee::geoLabel()
{
return i18n("Geographic Position");
}
void Addressee::setTitle( const QString &title )
{
if ( title == mData->title ) return;
detach();
mData->empty = false;
mData->title = title;
}
QString Addressee::title() const
{
return mData->title;
}
QString Addressee::titleLabel()
{
return i18n("Title");
}
void Addressee::setRole( const QString &role )
{
if ( role == mData->role ) return;
detach();
mData->empty = false;
mData->role = role;
}
QString Addressee::role() const
{
return mData->role;
}
QString Addressee::roleLabel()
{
return i18n("Role");
}
void Addressee::setOrganization( const QString &organization )
{
if ( organization == mData->organization ) return;
detach();
mData->empty = false;
mData->organization = organization;
}
QString Addressee::organization() const
{
return mData->organization;
}
QString Addressee::organizationLabel()
{
return i18n("Organization");
}
void Addressee::setNote( const QString &note )
{
if ( note == mData->note ) return;
detach();
mData->empty = false;
mData->note = note;
}
QString Addressee::note() const
{
return mData->note;
}
QString Addressee::noteLabel()
{
return i18n("Note");
}
void Addressee::setProductId( const QString &productId )
{
if ( productId == mData->productId ) return;
detach();
mData->empty = false;
mData->productId = productId;
}
QString Addressee::productId() const
{
return mData->productId;
}
QString Addressee::productIdLabel()
{
return i18n("Product Identifier");
}
void Addressee::setRevision( const QDateTime &revision )
{
if ( revision == mData->revision ) return;
detach();
mData->empty = false;
mData->revision = QDateTime( revision.date(),
QTime (revision.time().hour(),
revision.time().minute(),
revision.time().second()));
}
QDateTime Addressee::revision() const
{
return mData->revision;
}
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index 05d604f..aae923c 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -395,316 +395,318 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
bool picAvailUrl = false;
if (! picture.undefined() ) {
picAvailintern = (picture.isIntern() && !picture.data().isNull());
picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() );
}
if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) {
picString = "<img src=\"myimage\" width=\"50\" height=\"70\">";
if ( picAvailintern ) {
QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() );
int wid = picture.data().width();
int hei = picture.data().height();
if ( wid > 128 || hei > 128 ) {
if ( wid > hei ) {
hei = (hei*128)/wid;
wid = 128;
} else {
wid = (wid*128)/hei;
hei = 128;
}
}
picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei);
} else {
if ( picAvailUrl ) {
QPixmap picPix( picture.url() );
QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", picPix );
int wid = picPix.width();
int hei = picPix.height();
if ( wid > 128 || hei > 128 ) {
if ( wid > hei ) {
hei = (hei*128)/wid;
wid = 128;
} else {
wid = (wid*128)/hei;
hei = 128;
}
}
picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei);
} else {
if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) {
static bool setDefaultImageChildren = false;
if ( !setDefaultImageChildren ) {
QMimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) );
setDefaultImageChildren = true;
}
picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">";
} else if ( !mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ).isEmpty() ) {
static bool setDefaultImagepouses = false;
if ( !setDefaultImagepouses ) {
QMimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) );
setDefaultImagepouses = true;
}
picString = "<img src=\"SpousesIcon\" width=\"64\" height=\"64\">";
} else {
QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
if ( gen == "male" ) {
static bool setDefaultImageMale = false;
if ( !setDefaultImageMale ) {
QMimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) );
setDefaultImageMale = true;
}
picString = "<img src=\"MaleIcon\" width=\"64\" height=\"64\">";
} else if ( gen == "female" ) {
static bool setDefaultImageFemale = false;
if ( !setDefaultImageFemale ) {
QMimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) );
setDefaultImageFemale = true;
}
picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">";
} else {
static bool setDefaultImage = false;
if ( !setDefaultImage ) {
//qDebug("Setting default pixmap ");
QMimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) );
setDefaultImage = true;
}
picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">";
}
}
}
}
mText = QString::fromLatin1(
"<html>"
"<body text=\"%1\" bgcolor=\"%2\">" // text and background color
"<table>"
"<tr>"
"<td rowspan=\"3\" align=\"right\" valign=\"top\">"
"%3"
"</td>"
"<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name
"</tr>"
"%5" // role
"%6" // organization
"<td colspan=\"2\">&nbsp;</td>"
"%7" // dynamic part
"%8" // notes
"</table>"
"</body>"
"</html>")
//US
.arg( /*KGlobalSettings::textColor().name()*/ "black" )
//US
.arg( /*KGlobalSettings::baseColor().name()*/ "white" )
.arg( picString )
.arg( name )
.arg( aRole )
.arg( aOrga )
.arg( dynamicPart )
.arg( notes );
} else { // no picture!
mText = "<table width=\"100%\">\n";
//mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
#ifdef DESKTOP_VERSION
mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>";
mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>";
#else
mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>";
mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>";
#endif
mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
mText += "<table><td colspan=\"2\">&nbsp;</td>";
/*
mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>"
"<td align=\"left\"><b>%2</b></td></tr>" )
.arg( i18n(" ") )
.arg( name );
*/
if ( ! mAddressee.role().isEmpty() )
mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n(" ") )
.arg( mAddressee.role());
if ( ! mAddressee.organization().isEmpty() )
mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( i18n(" ") )
.arg( mAddressee.organization());
mText += dynamicPart;
mText += notes;
mText += "</table>";
}
// at last display it...
setText( mText );
}
QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones ,bool preferred )
{
ExternalAppHandler* eah = ExternalAppHandler::instance();
bool kphoneAvail = eah->isPhoneAppAvailable();
bool kfaxAvail = eah->isFaxAppAvailable();
bool ksmsAvail = eah->isSMSAppAvailable();
bool kpagerAvail = eah->isPagerAppAvailable();
bool ksipAvail = eah->isSIPAppAvailable();
QString dynamicPart;
KABC::PhoneNumber::List::ConstIterator phoneIt;
QString extension;
int phonetype;
QString sms;
for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) {
phonetype = (*phoneIt).type();
if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred )
continue;
if (ksmsAvail &&
(
((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) ||
((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell)
)
)
{
sms = QString("<a href=\"smsto:%1 \">(sms)</a>" )
.arg( (*phoneIt).number() );
}
else
sms = "";
extension = QString::null;
if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) {
if (kfaxAvail) extension = "faxto:";
}
else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) {
if (kpagerAvail) extension = "pagerto:";
}
+#if 0
else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) {
if (ksipAvail) extension = "sipto:";
}
+#endif
else if (kphoneAvail) {
extension = "phoneto:";
}
else
extension = QString::null;
if ( !extension.isEmpty() ) {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" )
.arg( KABC::PhoneNumber::typeLabel( phonetype ) )
.arg( extension )
.arg( (*phoneIt).number() )
.arg( (*phoneIt).number() )
.arg( sms );
} else {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2 %3</td></tr>" )
.arg( KABC::PhoneNumber::typeLabel( phonetype ) )
.arg( (*phoneIt).number() )
.arg( sms );
}
}
return dynamicPart;
}
/*
KABC::Addressee AddresseeView::addressee() const
{
return mAddressee;
}
*/
void AddresseeView::addTag(const QString & tag,const QString & text)
{
if ( text.isEmpty() )
return;
int number=text.contains("\n");
QString str = "<" + tag + ">";
QString tmpText=text;
QString tmpStr=str;
if(number !=-1)
{
if (number > 0) {
int pos=0;
QString tmp;
for(int i=0;i<=number;i++) {
pos=tmpText.find("\n");
tmp=tmpText.left(pos);
tmpText=tmpText.right(tmpText.length()-pos-1);
tmpStr+=tmp+"<br>";
}
}
else tmpStr += tmpText;
tmpStr+="</" + tag + ">";
mText.append(tmpStr);
}
else
{
str += text + "</" + tag + ">";
mText.append(str);
}
}
AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name,
true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false)
{
findButton( Close )->setText( i18n("Cancel Sync"));
findButton( Ok )->setText( i18n("Remote"));
findButton( User1 )->setText( i18n("Local"));
QWidget* topframe = new QWidget( this );
setMainWidget( topframe );
QBoxLayout* bl;
if ( QApplication::desktop()->width() < 640 ) {
bl = new QVBoxLayout( topframe );
} else {
bl = new QHBoxLayout( topframe );
}
QVBox* subframe = new QVBox( topframe );
bl->addWidget(subframe );
QLabel* lab = new QLabel( i18n("Local Addressee"), subframe );
if ( takeloc )
lab->setBackgroundColor(Qt::green.light() );
AddresseeView * av = new AddresseeView( subframe );
av->setAddressee( loc );
subframe = new QVBox( topframe );
bl->addWidget(subframe );
lab = new QLabel( i18n("Remote Addressee"), subframe );
if ( !takeloc )
lab->setBackgroundColor(Qt::green.light() );
av = new AddresseeView( subframe );
av->setAddressee( rem );
QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote()));
QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local()));
#ifndef DESKTOP_VERSION
showMaximized();
#else
resize ( 640, 400 );
#endif
}
int AddresseeChooser::executeD( bool local )
{
mSyncResult = 3;
if ( local )
findButton( User1 )->setFocus();
else
findButton( Ok )->setFocus();
exec();
return mSyncResult;
}
void AddresseeChooser::slot_remote()
{
mSyncResult = 2;
accept();
}
void AddresseeChooser::slot_local()
{
mSyncResult = 1;
accept();
}
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp
index 2bce39a..b20275d 100644
--- a/kaddressbook/phoneeditwidget.cpp
+++ b/kaddressbook/phoneeditwidget.cpp
@@ -1,244 +1,354 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
#include <qlabel.h>
#include <qtooltip.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qstring.h>
#include <qlistbox.h>
#include <qlistview.h>
#include <qbuttongroup.h>
+#include <qhbox.h>
#include <kbuttonbox.h>
#include <klistview.h>
#include <kapplication.h>
#include <qapplication.h>
#include <kconfig.h>
#include <klineedit.h>
#include <kcombobox.h>
#include <klocale.h>
#include <kdebug.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <kabc/phonenumber.h>
#include "typecombo.h"
#include "phoneeditwidget.h"
PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name )
+ : QScrollView(parent,name)
+{
+ setFrameStyle ( QFrame::Panel | QFrame::Plain );
+ setLineWidth ( 1 );
+ setMidLineWidth ( 1 );
+ mw = new QWidget ( viewport() );
+ addChild(mw);
+ setResizePolicy( AutoOneFit );
+ mainLayout = new QVBoxLayout ( mw );
+ mainLayout->setMargin( 2 );
+ mainLayout->setSpacing( 2 );
+ QWidget* hb = new QWidget ( mw );
+ mainLayout->add( hb );
+ QHBoxLayout* hbLayout = new QHBoxLayout ( hb );
+ QPushButton *addBut = new QPushButton ( "add", hb );
+ hbLayout->add( addBut );
+ addBut->setPixmap ( SmallIcon("plus"));
+ addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() );
+ connect(addBut,SIGNAL(clicked()),SLOT(addNumber()));
+ //QLabel * temp = new QLabel( i18n("Phone Type"), hb );
+ QLabel *temp = new QLabel( i18n("Phone Number"),hb );
+ temp->setAlignment( Qt::AlignCenter );
+ temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
+ hbLayout->add( temp );
+ appendEditCombo();
+ appendEditCombo();
+ appendEditCombo();
+ setDefaults();
+}
+
+PhoneEditWidget::~PhoneEditWidget()
+{
+}
+void PhoneEditWidget::setDefaults()
+{
+ PhoneTypeNumberEdit* edit = mTypeNumberEditList.first();
+ KABC::PhoneNumber phoneNumber;
+ phoneNumber.setType( KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref );
+ edit->setPhoneNumber( phoneNumber );
+ edit = mTypeNumberEditList.next();
+ phoneNumber.setType( KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref );
+ edit->setPhoneNumber( phoneNumber );
+ edit = mTypeNumberEditList.next();
+ phoneNumber.setType( KABC::PhoneNumber::Cell );
+ edit->setPhoneNumber( phoneNumber );
+ edit = mTypeNumberEditList.next();
+ while ( edit ) {
+ edit->hide();
+ edit = mTypeNumberEditList.next();
+ }
+}
+void PhoneEditWidget::addNumber()
+{
+
+}
+PhoneTypeNumberEdit* PhoneEditWidget::appendEditCombo()
+{
+ PhoneTypeNumberEdit* edit = new PhoneTypeNumberEdit( mw );
+ connect ( edit, SIGNAL ( typeChange( int , int) ), this, SIGNAL ( typeChange( int , int)) );
+ connect ( edit, SIGNAL ( modified() ), this, SIGNAL ( modified() ) );
+ connect ( this, SIGNAL ( typeChange( int , int)), edit, SLOT ( typeExternalChanged( int, int)) );
+
+ mainLayout->add( edit );
+ mTypeNumberEditList.append( edit );
+ return edit;
+}
+
+void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &li )
+{
+ if ( li.isEmpty() ) {
+ setDefaults();
+ return;
+ }
+ KABC::PhoneNumber::List::Iterator it;
+ KABC::PhoneNumber::List list = li;
+ PhoneTypeNumberEdit* edit = mTypeNumberEditList.first();
+ for ( it = list.begin(); it != list.end(); ++it ) {
+ if ( edit ) {
+ edit->setPhoneNumber( (*it ) );
+ edit = mTypeNumberEditList.next();
+ } else {
+ PhoneTypeNumberEdit* editNew = appendEditCombo();
+ editNew->setPhoneNumber( (*it ) );
+ }
+ }
+ while ( edit ) {
+ edit->hide();
+ edit = mTypeNumberEditList.next();
+ }
+ //mainLayout->invalidate ();
+ mw->update();
+}
+KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers()
+{
+ KABC::PhoneNumber::List retList;
+
+ PhoneTypeNumberEdit* edit = mTypeNumberEditList.first();
+ while ( edit ) {
+ if ( edit->isValid() ) {
+ retList.append( edit->phoneNumber());
+ }
+ edit = mTypeNumberEditList.next();
+
+ }
+ return retList;
+}
+
+#if 0
+PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
QGridLayout *layout = new QGridLayout( this, 4, 1 );
//US layout->setSpacing( KDialog::spacingHint() );
layout->setSpacing( KDialogBase::spacingHintSmall() );
QLabel* label = new QLabel( this );
//US loadIcon call is ambiguous. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
label->setAlignment( AlignCenter );
//US layout->addMultiCellWidget( label, 0, 1, 3, 3 );
layout->addWidget( label, 0, 0 );
QPushButton *editButton = new QPushButton( i18n( "Edit Phone Numbers..." ),
this );
if ( QApplication::desktop()->width() < 640 )
layout->addWidget( editButton, 0, 1 );
else
layout->addMultiCellWidget( editButton, 0, 0, 1, 3);
mPrefCombo = new PhoneTypeCombo( mPhoneList, this );
mPrefEdit = new KLineEdit( this );
//mPrefEdit->setMinimumWidth( int(mPrefEdit->sizeHint().width() * 1.5) );
mPrefCombo->setLineEdit( mPrefEdit );
layout->addWidget( mPrefCombo, 1, 0 );
layout->addWidget( mPrefEdit, 1, 1 );
int x = 1, y = 2;
if ( QApplication::desktop()->width() < 640 ) {
++x;
y = 0;
}
mSecondCombo = new PhoneTypeCombo( mPhoneList, this );
mSecondEdit = new KLineEdit( this );
mSecondCombo->setLineEdit( mSecondEdit );
layout->addWidget( mSecondCombo, x, y++ );
layout->addWidget( mSecondEdit, x, y++ );
y = 0;
++x;
mThirdCombo = new PhoneTypeCombo( mPhoneList, this );
mThirdEdit = new KLineEdit( this );
mThirdCombo->setLineEdit( mThirdEdit );
layout->addWidget( mThirdCombo, x, y++ );
layout->addWidget( mThirdEdit, x, y++ );
if ( QApplication::desktop()->width() < 640 ) {
++x;
y = 0;
}
mFourthCombo = new PhoneTypeCombo( mPhoneList, this );
mFourthEdit = new KLineEdit( this );
mFourthCombo->setLineEdit( mFourthEdit );
layout->addWidget( mFourthCombo, x, y++ );
layout->addWidget( mFourthEdit, x, y++ );
// Four numbers don't fit in the current dialog
if ( QApplication::desktop()->width() < 640 ) {
mFourthCombo->hide();
mFourthEdit->hide();
} else {
QFontMetrics fm ( font () ) ;
int wid = fm.width( "Messenger" ) +60;
mPrefCombo->setMaximumWidth( wid );
mSecondCombo->setMaximumWidth( wid );
mThirdCombo->setMaximumWidth( wid );
mFourthCombo->setMaximumWidth( wid );
}
connect( mPrefEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( slotPrefEditChanged() ) );
connect( mSecondEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( slotSecondEditChanged() ) );
connect( mThirdEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( slotThirdEditChanged() ) );
connect( mFourthEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( slotFourthEditChanged() ) );
connect( editButton, SIGNAL( clicked() ), SLOT( edit() ) );
connect( mPrefCombo, SIGNAL( activated( int ) ),
SLOT( updatePrefEdit() ) );
connect( mSecondCombo, SIGNAL( activated( int ) ),
SLOT( updateSecondEdit() ) );
connect( mThirdCombo, SIGNAL( activated( int ) ),
SLOT( updateThirdEdit() ) );
connect( mFourthCombo, SIGNAL( activated( int ) ),
SLOT( updateFourthEdit() ) );
}
PhoneEditWidget::~PhoneEditWidget()
{
}
void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &list )
{
mPhoneList.clear();
// Insert types for existing numbers.
mPrefCombo->insertTypeList( list );
QValueList<int> defaultTypes;
defaultTypes << KABC::PhoneNumber::Home;
defaultTypes << KABC::PhoneNumber::Work;
defaultTypes << KABC::PhoneNumber::Cell;
defaultTypes << ( KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax );
defaultTypes << ( KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax );
// Insert default types.
// Doing this for mPrefCombo is enough because the list is shared by all
// combos.
QValueList<int>::ConstIterator it;
for( it = defaultTypes.begin(); it != defaultTypes.end(); ++it ) {
if ( !mPrefCombo->hasType( *it ) )
mPrefCombo->insertType( list, *it, PhoneNumber( "", *it ) );
}
updateCombos();
mPrefCombo->selectType( defaultTypes[ 0 ] );
mSecondCombo->selectType( defaultTypes[ 1 ] );
mThirdCombo->selectType( defaultTypes[ 2 ] );
mFourthCombo->selectType( defaultTypes[ 3 ] );
updateLineEdits();
}
void PhoneEditWidget::updateLineEdits()
{
updatePrefEdit();
updateSecondEdit();
updateThirdEdit();
updateFourthEdit();
}
void PhoneEditWidget::updateCombos()
{
mPrefCombo->updateTypes();
mSecondCombo->updateTypes();
mThirdCombo->updateTypes();
mFourthCombo->updateTypes();
}
KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers()
{
KABC::PhoneNumber::List retList;
KABC::PhoneNumber::List::Iterator it;
for ( it = mPhoneList.begin(); it != mPhoneList.end(); ++it )
if ( !(*it).number().isEmpty() )
retList.append( *it );
return retList;
}
void PhoneEditWidget::edit()
{
PhoneEditDialog dlg( mPhoneList, this );
if ( dlg.exec() ) {
if ( dlg.changed() ) {
KABC::PhoneNumber::List list = dlg.phoneNumbers();
setPhoneNumbers( list );
updateCombos();
updateLineEdits();
emit modified();
}
}
}
void PhoneEditWidget::updatePrefEdit()
{
updateEdit( mPrefCombo );
}
void PhoneEditWidget::updateSecondEdit()
{
updateEdit( mSecondCombo );
}
void PhoneEditWidget::updateThirdEdit()
{
updateEdit( mThirdCombo );
}
void PhoneEditWidget::updateFourthEdit()
{
updateEdit( mFourthCombo );
}
@@ -361,196 +471,196 @@ void PhoneViewItem::makeText()
setText( 1, mPhoneNumber.typeLabel() );
}
PhoneEditDialog::PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name )
: KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Numbers" ),
KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok,
parent, name, true)
{
mPhoneNumberList = list;
QWidget *page = plainPage();
QGridLayout *layout = new QGridLayout( page, 1, 2 );
layout->setSpacing( spacingHint() );
mListView = new KListView( page );
mListView->setAllColumnsShowFocus( true );
mListView->addColumn( i18n( "Number" ) );
mListView->addColumn( i18n( "Type" ) );
KButtonBox *buttonBox = new KButtonBox( page, Vertical );
buttonBox->addButton( i18n( "&Add..." ), this, SLOT( slotAddPhoneNumber() ) );
mEditButton = buttonBox->addButton( i18n( "&Edit..." ), this, SLOT( slotEditPhoneNumber() ) );
mEditButton->setEnabled( false );
mRemoveButton = buttonBox->addButton( i18n( "&Remove" ), this, SLOT( slotRemovePhoneNumber() ) );
mRemoveButton->setEnabled( false );
buttonBox->layout();
layout->addWidget( mListView, 0, 0 );
layout->addWidget( buttonBox, 0, 1 );
connect( mListView, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()) );
connect( mListView, SIGNAL(doubleClicked( QListViewItem *, const QPoint &, int )), this, SLOT( slotEditPhoneNumber()));
KABC::PhoneNumber::List::Iterator it;
for ( it = mPhoneNumberList.begin(); it != mPhoneNumberList.end(); ++it )
new PhoneViewItem( mListView, *it );
if (QApplication::desktop()->width() < 480 )
showMaximized();
else
resize( 400, 400 );
mChanged = false;
}
PhoneEditDialog::~PhoneEditDialog()
{
}
void PhoneEditDialog::slotAddPhoneNumber()
{
KABC::PhoneNumber tmp( "", 0 );
PhoneTypeDialog dlg( tmp, this );
if ( dlg.exec() ) {
QListViewItem* i = mListView->firstChild();
KABC::PhoneNumber phoneNumber = dlg.phoneNumber();
bool insert = true;
while ( i ) {
PhoneViewItem* p = ( PhoneViewItem* ) i;
KABC::PhoneNumber pn = p->phoneNumber();
if ( (pn.type() | KABC::PhoneNumber::Pref) == (phoneNumber.type() | KABC::PhoneNumber::Pref) ) {
if ( p->text(0).isEmpty()) {
p->setPhoneNumber( phoneNumber );
mPhoneNumberList.remove( pn );
mPhoneNumberList.append( phoneNumber );
insert = false;
break;
}
}
i = i->nextSibling();
}
if ( insert ) {
mPhoneNumberList.append( phoneNumber );
new PhoneViewItem( mListView, phoneNumber );
}
mChanged = true;
}
}
void PhoneEditDialog::slotRemovePhoneNumber()
{
PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() );
if ( !item )
return;
mPhoneNumberList.remove( item->phoneNumber() );
QListViewItem *currItem = mListView->currentItem();
mListView->takeItem( currItem );
delete currItem;
mChanged = true;
}
void PhoneEditDialog::slotEditPhoneNumber()
{
PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() );
if ( !item )
return;
PhoneTypeDialog dlg( item->phoneNumber(), this );
if ( dlg.exec() ) {
slotRemovePhoneNumber();
KABC::PhoneNumber phoneNumber = dlg.phoneNumber();
mPhoneNumberList.append( phoneNumber );
new PhoneViewItem( mListView, phoneNumber );
mChanged = true;
}
}
void PhoneEditDialog::slotSelectionChanged()
{
bool state = ( mListView->currentItem() != 0 );
mRemoveButton->setEnabled( state );
mEditButton->setEnabled( state );
}
const KABC::PhoneNumber::List &PhoneEditDialog::phoneNumbers()
{
return mPhoneNumberList;
}
bool PhoneEditDialog::changed() const
{
return mChanged;
}
///////////////////////////////////////////
// PhoneTypeDialog
PhoneTypeDialog::PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber,
QWidget *parent, const char *name)
: KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Number" ),
KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok,
parent, name, true), mPhoneNumber( phoneNumber )
{
QWidget *page = plainPage();
QLabel *label = 0;
QGridLayout *layout = new QGridLayout( page, 3, 2, marginHint(), spacingHint() );
label = new QLabel( i18n( "Number:" ), page );
layout->addWidget( label, 0, 0 );
mNumber = new KLineEdit( page );
layout->addWidget( mNumber, 0, 1 );
mPreferredBox = new QCheckBox( i18n( "This is the preferred phone number" ), page );
layout->addMultiCellWidget( mPreferredBox, 1, 1, 0, 1 );
mGroup = new QButtonGroup( 2, Horizontal, i18n( "Types" ), page );
layout->addMultiCellWidget( mGroup, 2, 2, 0, 1 );
// fill widgets
mNumber->setText( mPhoneNumber.number() );
mTypeList = KABC::PhoneNumber::typeList();
mTypeList.remove( KABC::PhoneNumber::Pref );
KABC::PhoneNumber::TypeList::Iterator it;
for ( it = mTypeList.begin(); it != mTypeList.end(); ++it )
new QCheckBox( KABC::PhoneNumber::typeLabel( *it ), mGroup );
for ( int i = 0; i < mGroup->count(); ++i ) {
int type = mPhoneNumber.type();
QCheckBox *box = (QCheckBox*)mGroup->find( i );
box->setChecked( type & mTypeList[ i ] );
}
mPreferredBox->setChecked( mPhoneNumber.type() & KABC::PhoneNumber::Pref );
mNumber->setFocus();
mNumber->setSelection( 0, 1024);
}
KABC::PhoneNumber PhoneTypeDialog::phoneNumber()
{
mPhoneNumber.setNumber( mNumber->text() );
int type = 0;
for ( int i = 0; i < mGroup->count(); ++i ) {
QCheckBox *box = (QCheckBox*)mGroup->find( i );
if ( box->isChecked() )
type += mTypeList[ i ];
}
if ( mPreferredBox->isChecked() )
mPhoneNumber.setType( type | KABC::PhoneNumber::Pref );
else
mPhoneNumber.setType( type & ~KABC::PhoneNumber::Pref );
return mPhoneNumber;
}
-
+#endif
#ifndef KAB_EMBEDDED
#include "phoneeditwidget.moc"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h
index 0241cf0..6a514ed 100644
--- a/kaddressbook/phoneeditwidget.h
+++ b/kaddressbook/phoneeditwidget.h
@@ -1,222 +1,287 @@
#ifndef PHONEEDITWIDGET_H
#define PHONEEDITWIDGET_H
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <kdialogbase.h>
#include <kiconloader.h>
#include <qpushbutton.h>
#include <qlayout.h>
+#include <qptrlist.h>
+#include <qscrollview.h>
#include "addresseeconfig.h"
#include "typecombo.h"
class QButtonGroup;
class QCheckBox;
+class PhoneTypeNumberEdit;
#include <klineedit.h>
#include <kcombobox.h>
-class KListView;
+#include <kabc/phonenumber.h>
typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo;
/**
Widget for editing phone numbers.
*/
-class PhoneEditWidget : public QWidget
+class PhoneEditWidget : public QScrollView
{
Q_OBJECT
public:
PhoneEditWidget( QWidget *parent, const char *name = 0 );
~PhoneEditWidget();
void setPhoneNumbers( const KABC::PhoneNumber::List &list );
KABC::PhoneNumber::List phoneNumbers();
- void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* );
- KABC::PhoneNumber currentPhoneNumber( KComboBox*, int );
+ // void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* );
+ //KABC::PhoneNumber currentPhoneNumber( KComboBox*, int );
signals:
void modified();
+ void typeChange( int oldType, int newType );
private slots:
+ void addNumber();
+ protected:
+
+ private:
+ void setDefaults();
+ PhoneTypeNumberEdit* appendEditCombo();
+ QWidget* mw;
+ QVBoxLayout* mainLayout;
+ QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList;
+
+ KABC::PhoneNumber::List mPhoneList;
+};
+
+
+
+
+
+#if 0
+class PhoneEditWidget : public QWidget
+{
+ Q___OBJECT
+
+ public:
+ PhoneEditWidget( QWidget *parent, const char *name = 0 );
+ ~PhoneEditWidget();
+
+ void setPhoneNumbers( const KABC::PhoneNumber::List &list );
+ KABC::PhoneNumber::List phoneNumbers();
+
+ void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* );
+ KABC::PhoneNumber currentPhoneNumber( KComboBox*, int );
+
+ sig_nals:
+ void modified();
+ void typeChange( int oldType, int newType );
+
+ private sl_ots:
void edit();
void updatePrefEdit();
void updateSecondEdit();
void updateThirdEdit();
void updateFourthEdit();
void slotPrefEditChanged();
void slotSecondEditChanged();
void slotThirdEditChanged();
void slotFourthEditChanged();
protected:
void updateLineEdits();
void updateCombos();
private:
+ QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList;
void updateEdit( PhoneTypeCombo *combo );
void updatePhoneNumber( PhoneTypeCombo *combo );
void updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo );
PhoneTypeCombo *mPrefCombo;
PhoneTypeCombo *mSecondCombo;
PhoneTypeCombo *mThirdCombo;
PhoneTypeCombo *mFourthCombo;
KLineEdit *mPrefEdit;
KLineEdit *mSecondEdit;
KLineEdit *mThirdEdit;
KLineEdit *mFourthEdit;
KABC::PhoneNumber::List mPhoneList;
};
/**
Dialog for editing lists of phonenumbers.
*/
class PhoneEditDialog : public KDialogBase
{
- Q_OBJECT
+ Q___OBJECT
public:
PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name = 0 );
~PhoneEditDialog();
const KABC::PhoneNumber::List &phoneNumbers();
bool changed() const;
- protected slots:
+ protected s__lots:
void slotAddPhoneNumber();
void slotRemovePhoneNumber();
void slotEditPhoneNumber();
void slotSelectionChanged();
private:
KABC::PhoneNumber::List mPhoneNumberList;
KABC::PhoneNumber::TypeList mTypeList;
KComboBox *mTypeBox;
KListView *mListView;
QPushButton *mRemoveButton;
QPushButton *mEditButton;
bool mChanged;
};
/**
Dialog for editing phone number types.
*/
class PhoneTypeDialog : public KDialogBase
{
- Q_OBJECT
+ Q___OBJECT
public:
PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, QWidget *parent, const char *name = 0 );
KABC::PhoneNumber phoneNumber();
private:
KABC::PhoneNumber mPhoneNumber;
KABC::PhoneNumber::TypeList mTypeList;
QButtonGroup *mGroup;
QCheckBox *mPreferredBox;
KLineEdit *mNumber;
};
+#endif
+
class PhoneTypeNumberEdit : public QWidget
{
Q_OBJECT
public:
- PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 )
+ PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent )
{
QHBoxLayout * lay = new QHBoxLayout( this );
lay->setSpacing( KDialogBase::spacingHintSmall() );
lay->setMargin( KDialogBase::marginHintSmall() );
mMinusButton = new QPushButton ( this );
mMinusButton->setPixmap ( SmallIcon("minus"));
mCombo = new KComboBox( this );
mNumber = new KLineEdit( this );
lay->addWidget( mMinusButton );
lay->addWidget( mCombo );
lay->addWidget( mNumber );
connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) );
connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) );
+ connect( mNumber , SIGNAL ( textChanged ( const QString & ) ),
+ this, SLOT ( textChanged ( const QString & ) ) );
mCombo->insertStringList( PhoneNumber::supportedTypeListNames() );
+ mIsValid = true;
}
void setPhoneNumber( const KABC::PhoneNumber &phoneNumber )
{
mPhoneNumber = phoneNumber;
int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
mCombo->setCurrentItem( index );
mNumber->setText( mPhoneNumber.number() );
+ mIsValid = true;
show();
}
KABC::PhoneNumber phoneNumber()
{
mPhoneNumber.setNumber( mNumber->text() );
int index = mCombo->currentItem();
mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] );
return mPhoneNumber;
-
}
+ bool isValid()
+ {
+ if ( !mIsValid ) return false;
+ if ( mNumber->text().isEmpty() )return false;
+ return true;
+ }
private slots:
void typeExternalChanged( int oldType, int newType )
{
if ( mPhoneNumber.type() == newType ) {
mPhoneNumber.setType(oldType);
int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
mCombo->setCurrentItem( index );
}
-
}
void deleteNumber()
{
+ emit modified();
hide();
+ mIsValid = false;
}
void comboTypeChange( int index )
{
int old = mPhoneNumber.type();
int newT = PhoneNumber::supportedTypeList()[index];
if ( old != newT ) {
- mPhoneNumber.setType(newT );
+ emit modified();
emit typeChange ( old, newT );
+ mPhoneNumber.setType(newT );
}
}
+ int currentType()
+ {
+ return mCombo->currentItem();
+ }
+ void textChanged ( const QString & )
+ {
+ emit modified();
+ }
signals:
void typeChange( int oldType, int newType );
+ void modified();
private:
+ bool mIsValid;
KABC::PhoneNumber mPhoneNumber;
QPushButton* mMinusButton;
KComboBox *mCombo;
KLineEdit *mNumber;
};
#endif