summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/kaddressbook/germantranslation.txt2
-rw-r--r--kaddressbook/views/kaddressbookcardview.cpp8
-rw-r--r--kaddressbook/views/kaddressbookiconview.cpp8
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp6
4 files changed, 12 insertions, 12 deletions
diff --git a/bin/kdepim/kaddressbook/germantranslation.txt b/bin/kdepim/kaddressbook/germantranslation.txt
index b2f2704..f64bfda 100644
--- a/bin/kdepim/kaddressbook/germantranslation.txt
+++ b/bin/kdepim/kaddressbook/germantranslation.txt
@@ -596,198 +596,198 @@
{ "I/O device: ","I/O device: " },
{ "Connection: ","Connection: " },
{ "Model(opt.): ","Model(opt.): " },
{ "Exporting to phone...","Exportiere aufs Handy..." },
{ "Error exporting to phone","Fehler beim Export aufs Handy" },
{ "contacts successfully exported.","Kontakte erfolgreich exportiert." },
{ "Do you want to remove<br>all existing entries from<br>%1<br>before exporting.?","Wollen Sie<br>alle existieren Einträge von<br>%1<br>vor dem Export entfernen?" },
{ "Set formatted name","Setze formatierten Namen" },
{ "You can set the formatted name\nfor a list of contacts in one go.","Sie können den formatierten Namen für\nein Liste von Kontakten auf einmal setzen." },
{ "Set formatted name to:","Setze formatierten Name auf:" },
{ "Simple: James Bond","Einfach: James Bond" },
{ "Full: Mr. James 007 Bond I","Voll: Mr. James 007 Bond I" },
{ "Reverse: Bond, James","Umgekehrt: Bond, James" },
{ "Organization: MI6","Organisation: MI6" },
{ "Set formatted name to\norganization, if name empty","Setze formatierten Namen auf\nOrganisation, wenn Name leer ist." },
{ "Select contact list","Selektiere Kontakt Liste" },
{ "Changing contact #%1","Ändere Kontakt #%1" },
{ "Refreshing view...","Lade Ansicht neu..." },
{ "Setting formatted name completed!","Setzen vom formatierten Namen beendet!" },
{ "Removing voice...","Entferne voice..." },
{ "Remove voice completed!","Entferne voice beendet!" },
{ "Merge with existing categories?","Zu bestehenden\nKategorien hinzufügen?" },
{ "Setting categories ... please wait!","Setze Kategorien ... bitte warten!" },
{ "Setting categories completed!","Setzen der Kategorien beendet!" },
{ "OK","OK" },
{ "Please wait, processing categories...","Bitte warten, bearbeite Kategorien..." },
{ "Processing contact #%1","Bearbeite Kontakt #%1" },
{ " categories added to list! "," Kategorien zur Liste hinzugefügt! " },
{ "%1: %2","%1: %2" },
{ "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n","Ihr persönlicher Kontakt ist\nnicht gesetzt! Bitte selektieren Sie\nihn und setzen ihn mit Menu:\nKonfiguration - Setze wer bin ich\n" },
{ "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>","<qt>Wollen Sie wirklich<br><b>%1</b><br>als persönlichen Kontakt setzent?</qt>" },
{ "Cut","Ausschneiden" },
{ "Paste","Einfügen" },
{ "Delete","Löschen" },
{ "Choose...","Wähle..." },
{ "Add View","Ansicht hinzufügen" },
{ "View name:","Ansicht Name:" },
{ "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 (Arbeit)" },
{ "Mobile (work)","Handy (Privat)" },
{ "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:" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" }, \ No newline at end of file
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp
index 9c35fd6..ca21016 100644
--- a/kaddressbook/views/kaddressbookcardview.cpp
+++ b/kaddressbook/views/kaddressbookcardview.cpp
@@ -126,382 +126,382 @@ void AddresseeCardView::printMe()
QPainter p;
p.begin ( &printer );
QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
float dx, dy;
int wid = (m.width() * 9)/10;
dx = (float) wid/(float)contentsWidth ();
dy = (float)(m.height()) / (float)contentsHeight ();
float scale;
// scale to fit the width or height of the paper
if ( dx < dy )
scale = dx;
else
scale = dy;
p.translate( m.width()/10,0 );
p.scale( scale, scale );
drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
p.end();
repaint();
#endif
}
void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e)
{
#ifndef KAB_EMBEDDED
if (QTextDrag::canDecode(e))
e->accept();
#else //KAB_EMBEDDED
qDebug("AddresseeCardView::dragEnterEvent drag&drop is not implemented");
#endif //KAB_EMBEDDED
}
void AddresseeCardView::dropEvent(QDropEvent *e)
{
emit addresseeDropped(e);
}
void AddresseeCardView::startDrag()
{
emit startAddresseeDrag();
}
///////////////////////////////
// KAddressBookCardView
KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab,
QWidget *parent, const char *name )
: KAddressBookView( ab, parent, name )
{
mShowEmptyFields = false;
// Init the GUI
QVBoxLayout *layout = new QVBoxLayout(viewWidget());
mCardView = new AddresseeCardView(viewWidget(), "mCardView");
mCardView->setSelectionMode(CardView::Extended);
layout->addWidget(mCardView);
// Connect up the signals
connect(mCardView, SIGNAL(executed(CardViewItem *)),
this, SLOT(addresseeExecuted(CardViewItem *)));
connect(mCardView, SIGNAL(selectionChanged()),
this, SLOT(addresseeSelected()));
connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)),
this, SIGNAL(dropped(QDropEvent*)));
connect(mCardView, SIGNAL(startAddresseeDrag()),
this, SIGNAL(startDrag()));
connect(this, SIGNAL(printView()),
mCardView , SLOT(printMe()));
}
KAddressBookCardView::~KAddressBookCardView()
{
}
void KAddressBookCardView::setFocusAV()
{
if ( mCardView )
mCardView->setFocus();
}
void KAddressBookCardView::scrollUP()
{
QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
QApplication::postEvent( mCardView, ev );
ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Up, 0,0 );
QApplication::postEvent( mCardView, ev );
}
void KAddressBookCardView::scrollDOWN()
{
QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
QApplication::postEvent( mCardView, ev );
ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 );
QApplication::postEvent( mCardView, ev );
}
void KAddressBookCardView::readConfig(KConfig *config)
{
KAddressBookView::readConfig(config);
// costum colors?
if ( config->readBoolEntry( "EnableCustomColors", false ) )
{
QPalette p( mCardView->palette() );
QColor c = p.color(QPalette::Normal, QColorGroup::Base );
p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) );
c = p.color(QPalette::Normal, QColorGroup::Text );
p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) );
c = p.color(QPalette::Normal, QColorGroup::Button );
p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) );
c = p.color(QPalette::Normal, QColorGroup::ButtonText );
p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) );
c = p.color(QPalette::Normal, QColorGroup::Highlight );
p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) );
c = p.color(QPalette::Normal, QColorGroup::HighlightedText );
p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) );
mCardView->viewport()->setPalette( p );
}
else
{
// needed if turned off during a session.
mCardView->viewport()->setPalette( mCardView->palette() );
}
//custom fonts?
QFont f( font() );
if ( config->readBoolEntry( "EnableCustomFonts", false ) )
{
mCardView->setFont( config->readFontEntry( "TextFont", &f) );
f.setBold( true );
mCardView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) );
}
else
{
mCardView->setFont( f );
f.setBold( true );
mCardView->setHeaderFont( f );
}
mCardView->setDrawCardBorder(config->readBoolEntry("DrawBorder", true));
mCardView->setDrawColSeparators(config->readBoolEntry("DrawSeparators",
true));
mCardView->setDrawFieldLabels(config->readBoolEntry("DrawFieldLabels",false));
mShowEmptyFields = config->readBoolEntry("ShowEmptyFields", false);
mCardView->setShowEmptyFields( mShowEmptyFields );
mCardView->setItemWidth( config->readNumEntry( "ItemWidth", 200 ) );
mCardView->setItemMargin( config->readNumEntry( "ItemMargin", 0 ) );
mCardView->setItemSpacing( config->readNumEntry( "ItemSpacing", 10 ) );
mCardView->setSeparatorWidth( config->readNumEntry( "SeparatorWidth", 2 ) );
#if 0
// LR KABPrefs::instance()->mHonorSingleClick is handled and fixed in cardviews contentsMouseDoubleClickEven
disconnect(mCardView, SIGNAL(executed(CardViewItem *)),
this, SLOT(addresseeExecuted(CardViewItem *)));
if (KABPrefs::instance()->mHonorSingleClick)
connect(mCardView, SIGNAL(executed(CardViewItem *)),
this, SLOT(addresseeExecuted(CardViewItem *)));
else
connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)),
this, SLOT(addresseeExecuted(CardViewItem *)));
#endif
connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)),
this, SLOT(addresseeExecuted(CardViewItem *)));
}
void KAddressBookCardView::writeConfig( KConfig *config )
{
config->writeEntry( "ItemWidth", mCardView->itemWidth() );
KAddressBookView::writeConfig( config );
}
void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field )
{
mCardView->clear();
if ( s.isEmpty() || s == "*" ) {
refresh();
return;
}
QRegExp re = getRegExp( s );
if (!re.isValid())
return;
mCardView->viewport()->setUpdatesEnabled( false );
KABC::Addressee::List addresseeList = addressees();
KABC::Addressee::List::Iterator it;
if ( field ) {
for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
#if QT_VERSION >= 0x030000
- if (re.search(field->value( *it ).lower()) != -1)
+ if (re.search(field->value( *it ).lower()) == 0)
#else
- if (re.match(field->value( *it ).lower()) != -1)
+ if (re.match(field->value( *it ).lower()) == 0)
#endif
new AddresseeCardViewItem(fields(), mShowEmptyFields,
addressBook(), *it, mCardView);
}
} else {
KABC::Field::List fieldList = allFields();
KABC::Field::List::ConstIterator fieldIt;
for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
#if QT_VERSION >= 0x030000
- if (re.search((*fieldIt)->value( *it ).lower()) != -1)
+ if (re.search((*fieldIt)->value( *it ).lower()) == 0)
#else
- if (re.match((*fieldIt)->value( *it ).lower()) != -1)
+ if (re.match((*fieldIt)->value( *it ).lower()) == 0)
#endif
{
new AddresseeCardViewItem(fields(), mShowEmptyFields,
addressBook(), *it, mCardView);
break;
}
}
}
}
mCardView->viewport()->setUpdatesEnabled( true );
mCardView->viewport()->update();
if ( mCardView->firstItem() ) {
mCardView->setCurrentItem ( mCardView->firstItem() );
mCardView->setSelected ( mCardView->firstItem() , true );
}
else
emit selected(QString::null);
}
QStringList KAddressBookCardView::selectedUids()
{
QStringList uidList;
CardViewItem *item;
AddresseeCardViewItem *aItem;
for (item = mCardView->firstItem(); item; item = item->nextItem())
{
if (item->isSelected())
{
#ifndef KAB_EMBEDDED
aItem = dynamic_cast<AddresseeCardViewItem*>(item);
#else //KAB_EMBEDDED
aItem = (AddresseeCardViewItem*)(item);
#endif //KAB_EMBEDDED
if (aItem)
uidList << aItem->addressee().uid();
}
}
return uidList;
}
void KAddressBookCardView::refresh(QString uid)
{
CardViewItem *item;
AddresseeCardViewItem *aItem;
if (uid.isNull())
{
// Rebuild the view
mCardView->viewport()->setUpdatesEnabled( false );
mCardView->clear();
KABC::Addressee::List addresseeList = addressees();
KABC::Addressee::List::Iterator iter;
for (iter = addresseeList.begin(); iter != addresseeList.end(); ++iter)
{
if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") )
continue;
aItem = new AddresseeCardViewItem(fields(), mShowEmptyFields,
addressBook(), *iter, mCardView);
}
mCardView->viewport()->setUpdatesEnabled( true );
mCardView->viewport()->update();
// by default nothing is selected
emit selected(QString::null);
}
else
{
// Try to find the one to refresh
bool found = false;
for (item = mCardView->firstItem(); item && !found;
item = item->nextItem())
{
#ifndef KAB_EMBEDDED
aItem = dynamic_cast<AddresseeCardViewItem*>(item);
#else //KAB_EMBEDDED
aItem = (AddresseeCardViewItem*)(item);
#endif //KAB_EMBEDDED
if ((aItem) && (aItem->addressee().uid() == uid))
{
aItem->refresh();
found = true;
}
}
}
}
void KAddressBookCardView::setSelected(QString uid, bool selected)
{
CardViewItem *item;
AddresseeCardViewItem *aItem;
if (uid.isNull())
{
mCardView->selectAll(selected);
}
else
{
bool found = false;
for (item = mCardView->firstItem(); item && !found;
item = item->nextItem())
{
#ifndef KAB_EMBEDDED
aItem = dynamic_cast<AddresseeCardViewItem*>(item);
#else //KAB_EMBEDDED
aItem = (AddresseeCardViewItem*)(item);
#endif //KAB_EMBEDDED
if ((aItem) && (aItem->addressee().uid() == uid))
{
mCardView->setSelected(aItem, selected);
mCardView->ensureItemVisible(item);
found = true;
}
}
}
}
//US added an additional method without parameter
void KAddressBookCardView::setSelected()
{
setSelected(QString::null, true);
}
void KAddressBookCardView::addresseeExecuted(CardViewItem *item)
{
#ifndef KAB_EMBEDDED
AddresseeCardViewItem *aItem = dynamic_cast<AddresseeCardViewItem*>(item);
#else //KAB_EMBEDDED
AddresseeCardViewItem *aItem = (AddresseeCardViewItem*)(item);
#endif //KAB_EMBEDDED
if (aItem)
{
//kdDebug()<<"... even has a valid item:)"<<endl;
emit executed(aItem->addressee().uid());
}
}
void KAddressBookCardView::addresseeSelected()
{
CardViewItem *item;
AddresseeCardViewItem *aItem;
bool found = false;
for (item = mCardView->firstItem(); item && !found;
item = item->nextItem())
{
if (item->isSelected())
{
#ifndef KAB_EMBEDDED
aItem = dynamic_cast<AddresseeCardViewItem*>(item);
#else //KAB_EMBEDDED
aItem = (AddresseeCardViewItem*)(item);
#endif //KAB_EMBEDDED
if ( aItem )
{
emit selected(aItem->addressee().uid());
found = true;
}
}
}
if (!found)
emit selected(QString::null);
}
#ifndef KAB_EMBEDDED
#include "kaddressbookcardview.moc"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp
index 3bdfd1a..4bbdf1d 100644
--- a/kaddressbook/views/kaddressbookiconview.cpp
+++ b/kaddressbook/views/kaddressbookiconview.cpp
@@ -80,373 +80,373 @@ AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name)
setSelectionMode( QIconView::Extended );
setResizeMode( QIconView::Adjust );
setWordWrapIconText( true );
setGridX( 100 );
setItemsMovable(false);
setSorting(true, true);
//US ??? setMode( KIconView::Select );
#ifndef KAB_EMBEDDED
connect(this, SIGNAL(dropped(QDropEvent*, const QValueList<QIconDragItem>&)),
this, SLOT(itemDropped(QDropEvent*, const QValueList<QIconDragItem>&)));
#endif //KAB_EMBEDDED
}
AddresseeIconView::~AddresseeIconView()
{
}
void AddresseeIconView::itemDropped(QDropEvent *e,
const QValueList<QIconDragItem> &)
{
emit addresseeDropped(e);
}
QDragObject *AddresseeIconView::dragObject()
{
emit startAddresseeDrag();
// We never want IconView to start the drag
return 0;
}
////////////////////////////////
// AddresseeIconViewItem (internal class)
#ifndef KAB_EMBEDDED
class AddresseeIconViewItem : public KIconViewItem
#else //KAB_EMBEDDED
class AddresseeIconViewItem : public QIconViewItem
#endif //KAB_EMBEDDED
{
public:
#ifndef KAB_EMBEDDED
AddresseeIconViewItem(const KABC::Field::List &fields,
KABC::AddressBook *doc, const KABC::Addressee &a,
QIconView *parent)
: KIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a)
#else //KAB_EMBEDDED
AddresseeIconViewItem(const KABC::Field::List &fields,
KABC::AddressBook *doc, const KABC::Addressee &a,
QIconView *parent)
: QIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a)
#endif //KAB_EMBEDDED
{
if ( mFields.isEmpty() ) {
mFields = KABC::Field::defaultFields();
}
refresh();
}
const KABC::Addressee &addressee() const { return mAddressee; }
void refresh()
{
// Update our addressee, since it may have changed elsewhere
mAddressee = mDocument->findByUid(mAddressee.uid());
if (!mAddressee.isEmpty())
setText( mAddressee.givenName() + " " + mAddressee.familyName() );
QPixmap icon;
QPixmap defaultIcon( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop, 128 ) );
KABC::Picture pic = mAddressee.photo();
if ( pic.data().isNull() )
pic = mAddressee.logo();
if ( pic.isIntern() && !pic.data().isNull() ) {
QImage img = pic.data();
#ifndef KAB_EMBEDDED
if ( img.width() > img.height() )
icon = img.scaleWidth( 32 );
else
icon = img.scaleHeight( 32 );
#else //KAB_EMBEDDED
qDebug("AddresseeIconViewItem::refresh - scale here dependend of the displaysize and the right factor");
icon.convertFromImage(img.smoothScale(32, 32));
#endif //KAB_EMBEDDED
} else
icon = defaultIcon;
setPixmap( icon );
}
private:
KABC::Field::List mFields;
KABC::AddressBook *mDocument;
KABC::Addressee mAddressee;
};
///////////////////////////////
// KAddressBookView
KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab,
QWidget *parent, const char *name)
: KAddressBookView( ab, parent, name )
{
// Init the GUI
QVBoxLayout *layout = new QVBoxLayout(viewWidget());
mIconView = new AddresseeIconView(viewWidget(), "mIconView");
layout->addWidget(mIconView);
// Connect up the signals
//US method executed is part of KIconView
//US connect(mIconView, SIGNAL(executed(QIconViewItem *)),
//US this, SLOT(addresseeExecuted(QIconViewItem *)));
connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)),
this, SLOT(addresseeExecuted(QIconViewItem *)));
connect(mIconView, SIGNAL(selectionChanged()),
this, SLOT(addresseeSelected()));
connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)),
this, SIGNAL(dropped(QDropEvent*)));
connect(mIconView, SIGNAL(startAddresseeDrag()),
this, SIGNAL(startDrag()));
}
KAddressBookIconView::~KAddressBookIconView()
{
}
void KAddressBookIconView::setFocusAV()
{
if ( mIconView )
mIconView->setFocus();
}
void KAddressBookIconView::scrollUP()
{
QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
QApplication::postEvent( mIconView, ev );
}
void KAddressBookIconView::scrollDOWN()
{
QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
QApplication::postEvent( mIconView, ev );
}
void KAddressBookIconView::readConfig(KConfig *config)
{
KAddressBookView::readConfig(config);
//US method executed is part of KIconView
//US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)),
//US this, SLOT(addresseeExecuted(QIconViewItem *)));
disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)),
this, SLOT(addresseeExecuted(QIconViewItem *)));
//US method executed is part of KIconView. Use selectionChanged instead
/*US
if (KABPrefs::instance()->mHonorSingleClick)
connect(mIconView, SIGNAL(executed(QIconViewItem *)),
this, SLOT(addresseeExecuted(QIconViewItem *)));
else
connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)),
this, SLOT(addresseeExecuted(QIconViewItem *)));
*/
connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)),
this, SLOT(addresseeExecuted(QIconViewItem *)));
}
void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field )
{
mIconView->clear();
mIconList.clear();
if ( s.isEmpty() || s == "*" ) {
refresh();
return;
}
QRegExp re = getRegExp( s );
if (!re.isValid())
return;
KABC::Addressee::List addresseeList = addressees();
KABC::Addressee::List::Iterator it;
if ( field ) {
for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
#if QT_VERSION >= 0x030000
- if (re.search(field->value( *it ).lower()) != -1)
+ if (re.search(field->value( *it ).lower()) == 0)
#else
- if (re.match(field->value( *it ).lower()) != -1)
+ if (re.match(field->value( *it ).lower()) == 0)
#endif
mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView ));
}
} else {
KABC::Field::List fieldList = allFields();
KABC::Field::List::ConstIterator fieldIt;
for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
#if QT_VERSION >= 0x030000
- if (re.search((*fieldIt)->value( *it ).lower()) != -1)
+ if (re.search((*fieldIt)->value( *it ).lower()) == 0)
#else
- if (re.match((*fieldIt)->value( *it ).lower()) != -1)
+ if (re.match((*fieldIt)->value( *it ).lower()) == 0)
#endif
{
mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView ));
break;
}
}
}
}
mIconView->arrangeItemsInGrid( true );
if ( mIconView->firstItem() ) {
mIconView->setCurrentItem ( mIconView->firstItem() );
mIconView->setSelected ( mIconView->firstItem() , true );
}
else
emit selected(QString::null);
}
QStringList KAddressBookIconView::selectedUids()
{
QStringList uidList;
QIconViewItem *item;
AddresseeIconViewItem *aItem;
for (item = mIconView->firstItem(); item; item = item->nextItem())
{
if (item->isSelected())
{
#ifndef KAB_EMBEDDED
aItem = dynamic_cast<AddresseeIconViewItem*>(item);
#else //KAB_EMBEDDED
aItem = (AddresseeIconViewItem*)(item);
#endif //KAB_EMBEDDED
if (aItem)
uidList << aItem->addressee().uid();
}
}
return uidList;
}
void KAddressBookIconView::refresh(QString uid)
{
QIconViewItem *item;
AddresseeIconViewItem *aItem;
if ( uid.isNull() ) {
// Rebuild the view
mIconView->clear();
mIconList.clear();
KABC::Addressee::List addresseeList = addressees();
KABC::Addressee::List::Iterator iter;
for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter ) {
if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") )
continue;
aItem = new AddresseeIconViewItem( fields(), addressBook(), *iter, mIconView );
}
mIconView->arrangeItemsInGrid( true );
for ( item = mIconView->firstItem(); item; item = item->nextItem() )
{
#ifndef KAB_EMBEDDED
AddresseeIconViewItem* aivi = dynamic_cast<AddresseeIconViewItem*>( item );
#else //KAB_EMBEDDED
AddresseeIconViewItem* aivi = (AddresseeIconViewItem*)( item );
#endif //KAB_EMBEDDED
mIconList.append( aivi );
}
} else {
// Try to find the one to refresh
for ( item = mIconView->firstItem(); item; item = item->nextItem() ) {
#ifndef KAB_EMBEDDED
aItem = dynamic_cast<AddresseeIconViewItem*>(item);
#else //KAB_EMBEDDED
aItem = (AddresseeIconViewItem*)(item);
#endif //KAB_EMBEDDED
if ((aItem) && (aItem->addressee().uid() == uid)) {
aItem->refresh();
mIconView->arrangeItemsInGrid( true );
return;
}
}
refresh( QString::null );
}
}
void KAddressBookIconView::setSelected(QString uid, bool selected)
{
QIconViewItem *item;
AddresseeIconViewItem *aItem;
if (uid.isNull())
{
mIconView->selectAll(selected);
}
else
{
bool found = false;
for (item = mIconView->firstItem(); item && !found;
item = item->nextItem())
{
#ifndef KAB_EMBEDDED
aItem = dynamic_cast<AddresseeIconViewItem*>(item);
#else //KAB_EMBEDDED
aItem = (AddresseeIconViewItem*)(item);
#endif //KAB_EMBEDDED
if ((aItem) && (aItem->addressee().uid() == uid))
{
mIconView->setSelected(aItem, selected);
mIconView->ensureItemVisible( aItem );
found = true;
}
}
}
}
void KAddressBookIconView::addresseeExecuted(QIconViewItem *item)
{
#ifndef KAB_EMBEDDED
AddresseeIconViewItem *aItem = dynamic_cast<AddresseeIconViewItem*>(item);
#else //KAB_EMBEDDED
AddresseeIconViewItem *aItem = (AddresseeIconViewItem*)(item);
#endif //KAB_EMBEDDED
if (aItem) {
emit executed(aItem->addressee().uid());
}
}
void KAddressBookIconView::addresseeSelected()
{
QIconViewItem *item;
AddresseeIconViewItem *aItem;
bool found = false;
for (item = mIconView->firstItem(); item && !found;
item = item->nextItem())
{
if (item->isSelected())
{
#ifndef KAB_EMBEDDED
aItem = dynamic_cast<AddresseeIconViewItem*>(item);
#else //KAB_EMBEDDED
aItem = (AddresseeIconViewItem*)(item);
#endif //KAB_EMBEDDED
if (aItem)
{
emit selected(aItem->addressee().uid());
found = true;
}
}
}
if (!found)
emit selected(QString::null);
}
#ifndef KAB_EMBEDDED
#include "kaddressbookiconview.moc"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp
index 565cd1d..348f491 100644
--- a/kaddressbook/views/kaddressbooktableview.cpp
+++ b/kaddressbook/views/kaddressbooktableview.cpp
@@ -1,369 +1,369 @@
// $Id$
#include <qvbox.h>
#include <qlistbox.h>
#include <qwidget.h>
#include <qfile.h>
#include <qimage.h>
#include <qcombobox.h>
#include <qapplication.h>
#include <qdragobject.h>
#include <qevent.h>
#include <qurl.h>
#include <qpixmap.h>
#include <kabc/addressbook.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kcolorbutton.h>
#include <kdebug.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <klineedit.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kurl.h>
#include <kurlrequester.h>
//US#include "configuretableviewdialog.h"
#include "contactlistview.h"
#include "kabprefs.h"
#include "undocmds.h"
#include "viewmanager.h"
#include <qlayout.h>
#include <qheader.h>
#include <qregexp.h>
#include "kaddressbooktableview.h"
KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab,
QWidget *parent, const char *name )
: KAddressBookView( ab, parent, name )
{
mainLayout = new QVBoxLayout( viewWidget(), 2 );
// The list view will be created when the config is read.
mListView = 0;
}
KAddressBookTableView::~KAddressBookTableView()
{
}
void KAddressBookTableView::setFocusAV()
{
if ( mListView )
mListView->setFocus();
}
void KAddressBookTableView::scrollUP()
{
QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
QApplication::postEvent( mListView, ev );
ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Up, 0,0 );
QApplication::postEvent( mListView, ev );
}
void KAddressBookTableView::scrollDOWN()
{
QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
QApplication::postEvent( mListView, ev );
ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 );
QApplication::postEvent( mListView, ev );
}
void KAddressBookTableView::reconstructListView()
{
if (mListView)
{
disconnect(mListView, SIGNAL(selectionChanged()),
this, SLOT(addresseeSelected()));
disconnect(mListView, SIGNAL(executed(QListViewItem*)),
this, SLOT(addresseeExecuted(QListViewItem*)));
disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)),
this, SLOT(addresseeExecuted(QListViewItem*)));
disconnect(mListView, SIGNAL(startAddresseeDrag()), this,
SIGNAL(startDrag()));
disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)),
this, SLOT(addresseeExecuted(QListViewItem*)));
disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this,
SIGNAL(dropped(QDropEvent*)));
delete mListView;
}
mListView = new ContactListView( this, addressBook(), viewWidget() );
connect(this, SIGNAL(printView()),
mListView , SLOT(printMe()));
//US set singleClick manually, because it is no global configparameter in embedded space
mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick);
// Add the columns
KABC::Field::List fieldList = fields();
KABC::Field::List::ConstIterator it;
int c = 0;
for( it = fieldList.begin(); it != fieldList.end(); ++it ) {
mListView->addColumn( (*it)->label() );
mListView->setColumnWidthMode(c++, QListView::Manual);
//US
// qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1());
}
connect(mListView, SIGNAL(selectionChanged()),
this, SLOT(addresseeSelected()));
connect(mListView, SIGNAL(startAddresseeDrag()), this,
SIGNAL(startDrag()));
connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this,
SIGNAL(dropped(QDropEvent*)));
if (KABPrefs::instance()->mHonorSingleClick) {
// qDebug("KAddressBookTableView::reconstructListView single");
connect(mListView, SIGNAL(executed(QListViewItem*)),
this, SLOT(addresseeExecuted(QListViewItem*)));
} else {
// qDebug("KAddressBookTableView::reconstructListView double");
connect(mListView, SIGNAL(doubleClicked(QListViewItem*)),
this, SLOT(addresseeExecuted(QListViewItem*)));
}
connect(mListView, SIGNAL(returnPressed(QListViewItem*)),
this, SLOT(addresseeExecuted(QListViewItem*)));
connect(mListView, SIGNAL(signalDelete()),
this, SLOT(addresseeDeleted()));
//US performceimprovement. Refresh is done from the outside
//US refresh();
mListView->setSorting( 0, true );
mainLayout->addWidget( mListView );
mainLayout->activate();
mListView->show();
}
void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field )
{
mListView->clear();
if ( s.isEmpty() || s == "*" ) {
refresh();
return;
}
QRegExp re = getRegExp( s );
if (!re.isValid())
return;
KABC::Addressee::List addresseeList = addressees();
KABC::Addressee::List::Iterator it;
if ( field ) {
for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
#if QT_VERSION >= 0x030000
if (re.search(field->value( *it ).lower()) == 0)
#else
- if (re.match(field->value( *it ).lower()) != -1)
+ if (re.match(field->value( *it ).lower()) == 0)
#endif
ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
}
} else {
KABC::Field::List fieldList = allFields();
KABC::Field::List::ConstIterator fieldIt;
for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
#if QT_VERSION >= 0x030000
- if (re.search((*fieldIt)->value( *it ).lower()) != -1)
+ if (re.search((*fieldIt)->value( *it ).lower()) == 0)
#else
- if (re.match((*fieldIt)->value( *it ).lower()) != -1)
+ if (re.match((*fieldIt)->value( *it ).lower()) == 0)
#endif
{
//qDebug("match %s %s %s", pattern.latin1(), (*fieldIt)->value( *it ).latin1(), (*fieldIt)->label().latin1() );
ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
break;
}
}
}
}
// Sometimes the background pixmap gets messed up when we add lots
// of items.
//mListView->repaint();
if ( mListView->firstChild() ) {
mListView->setCurrentItem ( mListView->firstChild() );
mListView->setSelected ( mListView->firstChild(), true );
}
else
emit selected(QString::null);
}
void KAddressBookTableView::writeConfig(KConfig *config)
{
KAddressBookView::writeConfig(config);
mListView->saveLayout(config, config->group());
}
void KAddressBookTableView::readConfig(KConfig *config)
{
KAddressBookView::readConfig( config );
// The config could have changed the fields, so we need to reconstruct
// the listview.
reconstructListView();
// costum colors?
if ( config->readBoolEntry( "EnableCustomColors", false ) )
{
QPalette p( mListView->palette() );
QColor c = p.color(QPalette::Normal, QColorGroup::Base );
p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) );
c = p.color(QPalette::Normal, QColorGroup::Text );
p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) );
c = p.color(QPalette::Normal, QColorGroup::Button );
p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) );
c = p.color(QPalette::Normal, QColorGroup::ButtonText );
p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) );
c = p.color(QPalette::Normal, QColorGroup::Highlight );
p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) );
c = p.color(QPalette::Normal, QColorGroup::HighlightedText );
p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) );
#ifndef KAB_EMBEDDED
c = KGlobalSettings::alternateBackgroundColor();
#else //KAB_EMBEDDED
c = QColor(240, 240, 240);
#endif //KAB_EMBEDDED
c = config->readColorEntry ("AlternatingBackgroundColor", &c);
mListView->setAlternateColor(c);
//US mListView->viewport()->setPalette( p );
mListView->setPalette( p );
}
else
{
// needed if turned off during a session.
//US mListView->viewport()->setPalette( mListView->palette() );
mListView->setPalette( mListView->palette() );
}
//custom fonts?
QFont f( font() );
if ( config->readBoolEntry( "EnableCustomFonts", false ) )
{
mListView->setFont( config->readFontEntry( "TextFont", &f) );
f.setBold( true );
//US mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) );
mListView->header()->setFont( config->readFontEntry( "HeaderFont", &f ) );
}
else
{
mListView->setFont( f );
f.setBold( true );
//US mListView->setHeaderFont( f );
mListView->header()->setFont( f );
}
// Set the list view options
mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground",
true));
mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false));
mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true));
if (config->readBoolEntry("Background", false))
mListView->setBackgroundPixmap(config->readEntry("BackgroundName"));
// Restore the layout of the listview
mListView->restoreLayout(config, config->group());
}
void KAddressBookTableView::refresh(QString uid)
{
// For now just repopulate. In reality this method should
// check the value of uid, and if valid iterate through
// the listview to find the entry, then tell it to refresh.
if (uid.isNull()) {
// Clear the list view
QString currentUID, nextUID;
#ifndef KAB_EMBEDDED
ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() );
#else //KAB_EMBEDDED
ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() );
#endif //KAB_EMBEDDED
if ( currentItem ) {
#ifndef KAB_EMBEDDED
ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() );
#else //KAB_EMBEDDED
ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() );
#endif //KAB_EMBEDDED
if ( nextItem )
nextUID = nextItem->addressee().uid();
currentUID = currentItem->addressee().uid();
}
mListView->clear();
currentItem = 0;
KABC::Addressee::List addresseeList = addressees();
KABC::Addressee::List::Iterator it;
for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
if ( (*it).uid() == currentUID )
currentItem = item;
else if ( (*it).uid() == nextUID && !currentItem )
currentItem = item;
}
// Sometimes the background pixmap gets messed up when we add lots
// of items.
mListView->repaint();
if ( currentItem ) {
mListView->setCurrentItem( currentItem );
mListView->ensureItemVisible( currentItem );
}
} else {
// Only need to update on entry. Iterate through and try to find it
ContactListViewItem *ceItem;
QListViewItemIterator it( mListView );
while ( it.current() ) {
#ifndef KAB_EMBEDDED
ceItem = dynamic_cast<ContactListViewItem*>( it.current() );
#else //KAB_EMBEDDED
ceItem = (ContactListViewItem*)( it.current() );
#endif //KAB_EMBEDDED
if ( ceItem && ceItem->addressee().uid() == uid ) {
ceItem->refresh();
return;
}
++it;
}
refresh( QString::null );
}
}
QStringList KAddressBookTableView::selectedUids()
{
QStringList uidList;
QListViewItem *item;
ContactListViewItem *ceItem;
for(item = mListView->firstChild(); item; item = item->itemBelow())
{
if (mListView->isSelected( item ))
{
#ifndef KAB_EMBEDDED
ceItem = dynamic_cast<ContactListViewItem*>(item);
#else //KAB_EMBEDDED
ceItem = (ContactListViewItem*)(item);
#endif //KAB_EMBEDDED
if (ceItem != 0L)
uidList << ceItem->addressee().uid();
}
}
if ( uidList.count() == 0 )
if ( mListView->currentItem() ) {